query
stringlengths
10
3.85k
ru_query
stringlengths
9
3.76k
document
stringlengths
17
430k
metadata
dict
negatives
listlengths
97
100
negative_scores
listlengths
97
100
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KMSConfiguration.
DeepCopy — это автоматически сгенерированная функция глубокого копирования, копирующая получателя, создавая новый объект KMSConfiguration.
func (in *KMSConfiguration) DeepCopy() *KMSConfiguration { if in == nil { return nil } out := new(KMSConfiguration) in.DeepCopyInto(out) return out }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (in *KalmConfig) DeepCopy() *KalmConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KalmConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KubemanagerConfig) DeepCopy() *KubemanagerConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubemanagerConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSManagedConfiguration) DeepCopy() *EKSManagedConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSManagedConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KubeadmConfig) DeepCopy() *KubeadmConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubeadmConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KopsConfig) DeepCopy() *KopsConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KopsConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSCFConfiguration) DeepCopy() *EKSCFConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSCFConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KVConfiguration) DeepCopy() *KVConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KVConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KubebenchConfig) DeepCopy() *KubebenchConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubebenchConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KubeadmConfigList) DeepCopy() *KubeadmConfigList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubeadmConfigList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KubeadmConfigSpec) DeepCopy() *KubeadmConfigSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubeadmConfigSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SmsConfigurationType) DeepCopy() *SmsConfigurationType {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SmsConfigurationType)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CrdManagementConfiguration) DeepCopy() *CrdManagementConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CrdManagementConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MetricsConfiguration) DeepCopy() *MetricsConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MetricsConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MySQLConfiguration) DeepCopy() *MySQLConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MySQLConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AWSAccessRequestConfiguration) DeepCopy() *AWSAccessRequestConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSAccessRequestConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KMSKeySpec) DeepCopy() *KMSKeySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KMSKeySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KVMConfig) DeepCopy() *KVMConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KVMConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MariaDBConfiguration) DeepCopy() *MariaDBConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MariaDBConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KMSKeyList) DeepCopy() *KMSKeyList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KMSKeyList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ControllerManagerConfiguration) DeepCopy() *ControllerManagerConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ControllerManagerConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ControllerManagerConfiguration) DeepCopy() *ControllerManagerConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ControllerManagerConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ControllerManagerLoggerConfiguration) DeepCopy() *ControllerManagerLoggerConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ControllerManagerLoggerConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KokuMetricsConfig) DeepCopy() *KokuMetricsConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KokuMetricsConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KMSKey) DeepCopy() *KMSKey {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KMSKey)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GKEPrivateClusterConfig) DeepCopy() *GKEPrivateClusterConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GKEPrivateClusterConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ControllerManagerWebhookConfiguration) DeepCopy() *ControllerManagerWebhookConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ControllerManagerWebhookConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ControllerManagerWebhookConfiguration) DeepCopy() *ControllerManagerWebhookConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ControllerManagerWebhookConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *Client) GetKmsConfig(ctx context.Context, req *netapppb.GetKmsConfigRequest, opts ...gax.CallOption) (*netapppb.KmsConfig, error) {\n\treturn c.internalClient.GetKmsConfig(ctx, req, opts...)\n}", "func (in *GKEMasterAuthorizedNetworksConfig) DeepCopy() *GKEMasterAuthorizedNetworksConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GKEMasterAuthorizedNetworksConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretboxConfiguration) DeepCopy() *SecretboxConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretboxConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretAccessRequestConfiguration) DeepCopy() *SecretAccessRequestConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretAccessRequestConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *SseConfiguration) SetKmsEncryptionConfig(v *KmsEncryptionConfig) *SseConfiguration {\n\ts.KmsEncryptionConfig = v\n\treturn s\n}", "func (in *StickinessConfig) DeepCopy() *StickinessConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StickinessConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GetKubeconfigOptions) DeepCopy() *GetKubeconfigOptions {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GetKubeconfigOptions)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggingConfiguration) DeepCopy() *LoggingConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggingConfiguration) DeepCopy() *LoggingConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (k Kconfig) KconfigEqual(other Kconfig) bool {\n\treturn reflect.DeepEqual(k.Spec, other.Spec)\n}", "func (in *ControllerManagerControllerConfiguration) DeepCopy() *ControllerManagerControllerConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ControllerManagerControllerConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ControllerManagerControllerConfiguration) DeepCopy() *ControllerManagerControllerConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ControllerManagerControllerConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KubeAuthConfiguration) DeepCopy() *KubeAuthConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubeAuthConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SharedMemoryStoreConfig) DeepCopy() *SharedMemoryStoreConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SharedMemoryStoreConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DCGMExporterServiceMonitorConfig) DeepCopy() *DCGMExporterServiceMonitorConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DCGMExporterServiceMonitorConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MemoryQOSCfg) DeepCopy() *MemoryQOSCfg {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MemoryQOSCfg)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MultiClusterConfig) DeepCopy() *MultiClusterConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MultiClusterConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DeviceConfigurationType) DeepCopy() *DeviceConfigurationType {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DeviceConfigurationType)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GKEClusterConfig) DeepCopy() *GKEClusterConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GKEClusterConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConfigurationSpec) DeepCopy() *ConfigurationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigurationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConfigurationSpec) DeepCopy() *ConfigurationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigurationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o JobCopyDestinationEncryptionConfigurationOutput) KmsKeyVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v JobCopyDestinationEncryptionConfiguration) *string { return v.KmsKeyVersion }).(pulumi.StringPtrOutput)\n}", "func (in *KVMConfigSpecKVMK8sKVM) DeepCopy() *KVMConfigSpecKVMK8sKVM {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KVMConfigSpecKVMK8sKVM)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KubeConfig) DeepCopy() *KubeConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubeConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KubeConfig) DeepCopy() *KubeConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubeConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GKEClusterConfigList) DeepCopy() *GKEClusterConfigList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GKEClusterConfigList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggingConfigurationSpec) DeepCopy() *LoggingConfigurationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfigurationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *Config) Copy() *Config {\n\tc.Lock()\n\tdefer c.Unlock()\n\tn := &Config{\n\t\tm: make(map[string]interface{}),\n\t}\n\tfor key, value := range c.m {\n\t\tn.m[key] = value\n\t}\n\treturn n\n}", "func (in *KokuMetricsConfigSpec) DeepCopy() *KokuMetricsConfigSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KokuMetricsConfigSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GKEClusterConfigSpec) DeepCopy() *GKEClusterConfigSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GKEClusterConfigSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BcsConfigMapSpec) DeepCopy() *BcsConfigMapSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BcsConfigMapSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KVMConfigSpec) DeepCopy() *KVMConfigSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KVMConfigSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PrivateLinkServiceOperatorConfigMaps) DeepCopy() *PrivateLinkServiceOperatorConfigMaps {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrivateLinkServiceOperatorConfigMaps)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GKENodeTaintConfig) DeepCopy() *GKENodeTaintConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GKENodeTaintConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EncryptionConfiguration) DeepCopy() *EncryptionConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EncryptionConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MongoDBConfiguration) DeepCopy() *MongoDBConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MongoDBConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KVMConfigSpecKVM) DeepCopy() *KVMConfigSpecKVM {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KVMConfigSpecKVM)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KVMConfigList) DeepCopy() *KVMConfigList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KVMConfigList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PodMemoryQOSConfig) DeepCopy() *PodMemoryQOSConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PodMemoryQOSConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretEngineConfiguration) DeepCopy() *SecretEngineConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretEngineConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *TargetNamespaceConfig) DeepCopy() *TargetNamespaceConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TargetNamespaceConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AWSConfiguration) DeepCopy() *AWSConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PrivateLinkServiceIpConfiguration) DeepCopy() *PrivateLinkServiceIpConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrivateLinkServiceIpConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConfigMapTemplate) DeepCopy() *ConfigMapTemplate {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigMapTemplate)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KokuMetricsConfigList) DeepCopy() *KokuMetricsConfigList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KokuMetricsConfigList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RedisConfiguration) DeepCopy() *RedisConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RedisConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *Client) ListKmsConfigs(ctx context.Context, req *netapppb.ListKmsConfigsRequest, opts ...gax.CallOption) *KmsConfigIterator {\n\treturn c.internalClient.ListKmsConfigs(ctx, req, opts...)\n}", "func (in *BootConfiguration) DeepCopy() *BootConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BootConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BaseKubernetesContainerConfiguration) DeepCopy() *BaseKubernetesContainerConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BaseKubernetesContainerConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Servers_Configuration_Spec) DeepCopy() *Servers_Configuration_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Servers_Configuration_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BcsConfigMap) DeepCopy() *BcsConfigMap {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BcsConfigMap)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o JobCopyDestinationEncryptionConfigurationPtrOutput) KmsKeyVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobCopyDestinationEncryptionConfiguration) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.KmsKeyVersion\n\t}).(pulumi.StringPtrOutput)\n}", "func (in *ConfigurationList) DeepCopy() *ConfigurationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigurationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (proxy *StandAloneProxyConfig) DeepCopy() *StandAloneProxyConfig {\n\tif proxy == nil {\n\t\treturn nil\n\t}\n\tcloned := new(StandAloneProxyConfig)\n\tcloned.proxyCredentials = make(map[string]*ProxyUser)\n\tcloned.managementServers = make(map[url.URL]*ManagementServer)\n\tcloned.managedArrays = make(map[string]*StorageArray)\n\tfor key, value := range proxy.managedArrays {\n\t\tarray := *value\n\t\tcloned.managedArrays[key] = &array\n\t}\n\tfor key, value := range proxy.managementServers {\n\t\tcloned.managementServers[key] = value.DeepCopy()\n\t}\n\tfor key, value := range proxy.proxyCredentials {\n\t\tcreds := *value\n\t\tcloned.proxyCredentials[key] = &creds\n\t}\n\treturn cloned\n}", "func (in *JKSKeystore) DeepCopy() *JKSKeystore {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(JKSKeystore)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GKENodeConfig) DeepCopy() *GKENodeConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GKENodeConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (g *GKE) KubeConfig(ctx context.Context) (*rest.Config, error) {\n\tcluster, location, project, useInternalIP, err := clpFromClusterCtx(g.SkyCtx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to extract cluster info from %v: %v\", g, err)\n\t}\n\treturn BuildKubeRestConfSACred(ctx, cluster, location, project, useInternalIP, g.svcAcctKeyFile, g.userAgent)\n}", "func (in *WorkloadMetadataConfig) DeepCopy() *WorkloadMetadataConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WorkloadMetadataConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *OpenShiftControllerManagerConfig) DeepCopy() *OpenShiftControllerManagerConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(OpenShiftControllerManagerConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func UnmarshalKMSSettings(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(KMSSettings)\n\terr = core.UnmarshalPrimitive(m, \"location\", &obj.Location)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"encryption_scheme\", &obj.EncryptionScheme)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"resource_group\", &obj.ResourceGroup)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"primary_crk\", &obj.PrimaryCrk, UnmarshalKMSSettingsPrimaryCrk)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"secondary_crk\", &obj.SecondaryCrk, UnmarshalKMSSettingsSecondaryCrk)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func (c *Config) DeepCopy() *Config {\n\tif c == nil {\n\t\treturn &Config{}\n\t}\n\tcfg := *c\n\treturn &cfg\n}", "func NewConfigurationSSEKMS(kmsMasterKey string) *Configuration {\n\treturn &Configuration{\n\t\tRules: []Rule{\n\t\t\t{\n\t\t\t\tApply: ApplySSEByDefault{\n\t\t\t\t\tKmsMasterKeyID: kmsMasterKey,\n\t\t\t\t\tSSEAlgorithm: \"aws:kms\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "func (in *SharedMemoryServerConfig) DeepCopy() *SharedMemoryServerConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SharedMemoryServerConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o JobLoadDestinationEncryptionConfigurationOutput) KmsKeyVersion() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v JobLoadDestinationEncryptionConfiguration) *string { return v.KmsKeyVersion }).(pulumi.StringPtrOutput)\n}", "func (in *ApplicationConfiguration) DeepCopy() *ApplicationConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplicationConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MutatingWebhookConfigurationRef) DeepCopy() *MutatingWebhookConfigurationRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MutatingWebhookConfigurationRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GCPConfiguration) DeepCopy() *GCPConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GCPConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ServiceAccountControllerConfiguration) DeepCopy() *ServiceAccountControllerConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ServiceAccountControllerConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o BackupOutput) EncryptionConfigKmsKeyName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Backup) pulumi.StringPtrOutput { return v.EncryptionConfigKmsKeyName }).(pulumi.StringPtrOutput)\n}", "func (in *KVMConfigSpecKVMK8sKVMDocker) DeepCopy() *KVMConfigSpecKVMK8sKVMDocker {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KVMConfigSpecKVMK8sKVMDocker)\n\tin.DeepCopyInto(out)\n\treturn out\n}" ]
[ "0.7320824", "0.6503556", "0.6401234", "0.6188418", "0.6117832", "0.6105569", "0.59326637", "0.5710905", "0.5679013", "0.56328255", "0.5623401", "0.5505632", "0.54571265", "0.5398764", "0.5378795", "0.5364599", "0.53576845", "0.5333917", "0.5312741", "0.5305671", "0.5305671", "0.5291316", "0.5280115", "0.5252718", "0.52487415", "0.5234498", "0.5234498", "0.51478785", "0.51456535", "0.5106915", "0.5099548", "0.5069849", "0.5054385", "0.50503707", "0.5005388", "0.5005388", "0.49932897", "0.4992017", "0.4992017", "0.49617696", "0.4924222", "0.48887536", "0.4858364", "0.48524597", "0.48356938", "0.48325393", "0.48060256", "0.48060256", "0.47911215", "0.47910473", "0.47861952", "0.47861952", "0.47845626", "0.4778098", "0.47766158", "0.47713622", "0.4770698", "0.4770698", "0.4770698", "0.47675568", "0.47667867", "0.47665957", "0.47654215", "0.4759552", "0.47566843", "0.4731189", "0.4727384", "0.47254223", "0.4719976", "0.47167408", "0.47139132", "0.47138572", "0.47088185", "0.4708703", "0.4703641", "0.46925375", "0.46886942", "0.46869993", "0.46865875", "0.46738216", "0.46694887", "0.465537", "0.46449688", "0.4644965", "0.46390256", "0.4630661", "0.4629305", "0.46220487", "0.46194556", "0.46170318", "0.46160033", "0.46084353", "0.46027786", "0.45994836", "0.45982057", "0.45975778", "0.45952702", "0.4595106", "0.45949808", "0.45881918" ]
0.81662655
0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Key.
DeepCopy — это автоматически сгенерированная функция глубокого копирования, копирующая получателя, создавая новый Key.
func (in *Key) DeepCopy() *Key { if in == nil { return nil } out := new(Key) in.DeepCopyInto(out) return out }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (in *KeyReference) DeepCopy() *KeyReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KeyReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SignerKey) DeepCopy() *SignerKey {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SignerKey)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *TrustKey) DeepCopy() *TrustKey {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TrustKey)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NameKey) DeepCopy() *NameKey {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NameKey)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SignKey) DeepCopy() *SignKey {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SignKey)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KMSKey) DeepCopy() *KMSKey {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KMSKey)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *HlsContentProtection) SetKey(v string) *HlsContentProtection {\n\ts.Key = &v\n\treturn s\n}", "func (o *LabelProperties) SetKey(v string) {\n\n\to.Key = &v\n\n}", "func (s *PlayReadyDrm) SetKey(v string) *PlayReadyDrm {\n\ts.Key = &v\n\treturn s\n}", "func (s *AssetDestinationEntry) SetKey(v string) *AssetDestinationEntry {\n\ts.Key = &v\n\treturn s\n}", "func (s *CaptionSource) SetKey(v string) *CaptionSource {\n\ts.Key = &v\n\treturn s\n}", "func (o *LongProperty) SetKey(v string) {\n\to.Key = &v\n}", "func (s *EnvironmentParameter) SetKey(v string) *EnvironmentParameter {\n\ts.Key = &v\n\treturn s\n}", "func NewKey(kdf kdf.HKDF, key []byte) *Key {\n\trootKey := Key{\n\t\tkdf: kdf,\n\t\tkey: key,\n\t}\n\n\treturn &rootKey\n}", "func (o *CustomHostMetadataKey) SetKey(v string) {\n\to.Key = v\n}", "func (in *ProjectKey) DeepCopy() *ProjectKey {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProjectKey)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *ConfigurationTag) SetKey(v string) *ConfigurationTag {\n\ts.Key = &v\n\treturn s\n}", "func (s *ProvisioningParameter) SetKey(v string) *ProvisioningParameter {\n\ts.Key = &v\n\treturn s\n}", "func (s *AssetSourceEntry) SetKey(v string) *AssetSourceEntry {\n\ts.Key = &v\n\treturn s\n}", "func NewKey() *Key {\n\tkeypair, err := crypto.GenerateKeyPair()\n\tcommon.FatalIfErr(err, \"There was an error generating a key pair\")\n\treturn &Key{\n\t\tID: uuid.NewRandom(),\n\t\tKeyPair: &keypair,\n\t}\n}", "func (s *KeyValuePair) SetKey(v string) *KeyValuePair {\n\ts.Key = &v\n\treturn s\n}", "func (s *ListServiceInstancesFilter) SetKey(v string) *ListServiceInstancesFilter {\n\ts.Key = &v\n\treturn s\n}", "func (o *ApiKey) SetKey(v string) {\n\to.Key = &v\n}", "func (o *ResourceDefinitionFilter) SetKey(v string) {\n\to.Key = v\n}", "func (o *SearchTagItem) SetKey(v string) {\n\to.Key = &v\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func NewKey(key string) (*Key, error) {\n\tif len(key) != 32 {\n\t\treturn nil, fmt.Errorf(\"invalid key[%s]'s len[%d]\", key, len(key))\n\t}\n\tpayload, err := hex.DecodeString(key)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid key[%s]\", key)\n\t}\n\tbuf := bytes.NewBuffer(payload)\n\tvar rt uint64\n\tvar counter uint64\n\tif err := binary.Read(buf, binary.BigEndian, &rt); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid key[%s]\", key)\n\t}\n\tif err := binary.Read(buf, binary.BigEndian, &counter); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid key[%s]\", key)\n\t}\n\treturn &Key{Rand: uint32(rt >> 40), Timestamp: rt << 24 >> 24, Counter: counter}, nil\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func (s *Tag) SetKey(v string) *Tag {\n\ts.Key = &v\n\treturn s\n}", "func (s *FeatureParameter) SetKey(v string) *FeatureParameter {\n\ts.Key = &v\n\treturn s\n}", "func (s *TagRef) SetKey(v string) *TagRef {\n\ts.Key = &v\n\treturn s\n}", "func (o *OAUTHKey) DeepCopy() *OAUTHKey {\n\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\tout := &OAUTHKey{}\n\to.DeepCopyInto(out)\n\n\treturn out\n}", "func (s *JobOutput) SetKey(v string) *JobOutput {\n\ts.Key = &v\n\treturn s\n}", "func NewKey() (key *Key, err error) {\n\tpriv, pub, err := native.GenerateKeyPair(\"\")\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn &Key{\n\t\tPriv: priv,\n\t\tPub: pub,\n\t}, nil\n}", "func (s *CreateJobOutput) SetKey(v string) *CreateJobOutput {\n\ts.Key = &v\n\treturn s\n}", "func (transaction *AccountCreateTransaction) SetKey(key Key) *AccountCreateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.key = key\n\treturn transaction\n}", "func (s *S3ObjectSource) SetKey(v string) *S3ObjectSource {\n\ts.Key = &v\n\treturn s\n}", "func NewKey(key jwk.Key, kid string, exp, nbf *time.Time) *Key {\n\treturn &Key{\n\t\tKey: key,\n\t\tkid: kid,\n\t\texp: exp,\n\t\tnbf: nbf,\n\t}\n}", "func (a *Aes) SetKey(value string) *Aes {\n\ta.Key = value\n\treturn a\n}", "func (s *JobInput) SetKey(v string) *JobInput {\n\ts.Key = &v\n\treturn s\n}", "func (o *DeployKey) SetKey(v string) {\n\to.Key = &v\n}", "func (j *JetStreamRecord) SetKey(k string) *JetStreamRecord {\n\tj.key = k\n\treturn j\n}", "func (s *SyncBlockerContext) SetKey(v string) *SyncBlockerContext {\n\ts.Key = &v\n\treturn s\n}", "func (o *ChartDataPoint) SetKey(v string) {\n\to.Key = &v\n}", "func (s *TagSet) SetKey(v string) *TagSet {\n\ts.Key = &v\n\treturn s\n}", "func (n *Node) DeepKeyCopy() store.LocalKey {\n\treturn n.DeepCopy()\n}", "func (s *Encryption) SetKey(v string) *Encryption {\n\ts.Key = &v\n\treturn s\n}", "func (k *Key) GetKey() string {\n\tif k == nil || k.Key == nil {\n\t\treturn \"\"\n\t}\n\treturn *k.Key\n}", "func (s *SecurityKey) SetKey(v string) *SecurityKey {\n\ts.Key = &v\n\treturn s\n}", "func (s *Output_) SetKey(v string) *Output_ {\n\ts.Key = &v\n\treturn s\n}", "func NewKey(saddr, daddr util.Address, sport, dport uint16, topicName string, requestAPIKey, requestAPIVersion uint16) Key {\n\treturn Key{\n\t\tConnectionKey: types.NewConnectionKey(saddr, daddr, sport, dport),\n\t\tTopicName: topicName,\n\t\tRequestAPIKey: requestAPIKey,\n\t\tRequestVersion: requestAPIVersion,\n\t}\n}", "func NewKey(applicationKey string, apiKey string) Key {\n\treturn Key{applicationKey: applicationKey, apiKey: apiKey}\n}", "func NewKey(b []byte) Key {\n\tk := newKey(b)\n\t//\tif bytes.HasPrefix(k.object[:], specialPrefix) &&\n\t//\tk != Empty {\n\t//\t\treturn Invalid\n\t//\t}\n\treturn k\n}", "func (transaction *AccountUpdateTransaction) SetKey(key Key) *AccountUpdateTransaction {\n\ttransaction._RequireNotFrozen()\n\ttransaction.key = key\n\treturn transaction\n}", "func (k Keys) HashKey() interface{} { return k[0] }", "func NewKey(s *secret.SecretsItemResponse) *Key {\n\treturn &Key{\n\t\tUser: s.Values[secretTypes.User],\n\t\tIdentifier: s.Values[secretTypes.Identifier],\n\t\tPublicKeyData: s.Values[secretTypes.PublicKeyData],\n\t\tPublicKeyFingerprint: s.Values[secretTypes.PublicKeyFingerprint],\n\t\tPrivateKeyData: s.Values[secretTypes.PrivateKeyData],\n\t}\n}", "func (c *Client) SetKey(key string) *Client {\n\tc.Key = key\n\treturn c\n}", "func (o *GetJobEventsParams) SetKey(key *string) {\n\to.Key = key\n}", "func (instance *DSInstance) NewKey(kind string, name string, parent *datastore.Key) *datastore.Key {\n\tkey := datastore.NameKey(kind, name, parent)\n\tkey.Namespace = instance.namespace\n\treturn key\n}", "func (s *S3Location) SetKey(v string) *S3Location {\n\ts.Key = &v\n\treturn s\n}", "func NewKeyed(key []byte) hash.Hash {\n\td := new(digest)\n\td.key = key\n\td.Reset()\n\treturn d\n}", "func (s *AssociateSecurityKeyInput) SetKey(v string) *AssociateSecurityKeyInput {\n\ts.Key = &v\n\treturn s\n}", "func NewKey(expiry time.Time) (*KeyData, error) {\n\tkey := make([]byte, 16)\n\tif _, err := rand.Read(key); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &KeyData{\n\t\tKey: key,\n\t\tExpiry: expiry,\n\t}, nil\n}", "func (key twofishKey) Key() []byte {\n\treturn key[:]\n}", "func (o *RemoveAPIKeyPrivilegeParams) SetKey(key string) {\n\to.Key = key\n}", "func NewKey(value uint64) Key {\n\treturn Key(value)\n}", "func (r KeyGenerator) NewKey() (Key, error) {\n\tif len(r.buffer) == 0 {\n\t\tgo func() {\n\t\t\tr.fetchKeys()\n\t\t}()\n\t}\n\n\tentry := <-r.buffer\n\treturn entry.key, entry.err\n}", "func (v *KeyValue_SetValueV2_Args) GetKey() (o Key) {\n\tif v != nil {\n\t\to = v.Key\n\t}\n\treturn\n}", "func (o *ApiKey) GetKey() string {\n\tif o == nil || o.Key == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Key\n}", "func (in *ApiKey) DeepCopy() *ApiKey {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApiKey)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewKey(field string, value interface{}) *Key {\n\treturn &Key{\n\t\tfield: field,\n\t\tvalue: value,\n\t}\n}", "func (akv StringKeyValue) Key() string {\n\treturn akv.orig.Key\n}", "func (e Encoder) AppendKey(dst []byte, key string) []byte {\n\tif len(dst) < 1 {\n\t\tdst = e.AppendBeginMarker(dst)\n\t}\n\treturn e.AppendString(dst, key)\n}", "func (ƨ *DiffTestResult) Key(key *datastore.Key) *KeyedDiffTestResult {\n\treturn &KeyedDiffTestResult{\n\t\tDiffTestResult: ƨ,\n\t\tKey: key,\n\t}\n}", "func NewKey() (*rsa.PrivateKey, error) {\n\treturn rsa.GenerateKey(rand.Reader, 2048)\n}", "func (ck *CertKey) Key() []byte { return ck.key }", "func NewKey(id uint32, dport uint16, proto uint8, trafficDirection uint8) PolicyKey {\n\t// For now prefix length is derived from the proto and dport values\n\t// This will have to be exposed to the caller when port ranges are supported.\n\tprefixLen := StaticPrefixBits\n\tif proto != 0 {\n\t\tprefixLen += NexthdrBits\n\t\tif dport != 0 {\n\t\t\tprefixLen += DestPortBits\n\t\t}\n\t}\n\treturn PolicyKey{\n\t\tPrefixlen: prefixLen,\n\t\tIdentity: id,\n\t\tTrafficDirection: trafficDirection,\n\t\tNexthdr: proto,\n\t\tDestPortNetwork: byteorder.HostToNetwork16(dport),\n\t}\n}", "func (in *SSHKeyPair) DeepCopy() *SSHKeyPair {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SSHKeyPair)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o *CustomHostMetadataKey) GetKey() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Key\n}", "func (key StepsCacheKey) Key() (string, error) {\n\treturn marshalAndHashStepsCacheKey(key, []string{})\n}", "func (k *Key) Equals(k1 *Key) bool {\n\tif k1 == nil {\n\t\treturn false\n\t}\n\treturn k.Rand == k1.Rand && k.Timestamp == k1.Timestamp && k.Counter == k1.Counter\n}", "func NewKey() *[KeySize]byte {\r\n\tp := randBytes(KeySize)\r\n\tif p == nil {\r\n\t\treturn nil\r\n\t}\r\n\tdefer zero(p)\r\n\tvar key [KeySize]byte\r\n\tcopy(key[:], p)\r\n\treturn &key\r\n}", "func New(key interface{}) (Key, error) {\n\tif key == nil {\n\t\treturn nil, errors.New(`jwk.New requires a non-nil key`)\n\t}\n\n\tvar ptr interface{}\n\tswitch v := key.(type) {\n\tcase rsa.PrivateKey:\n\t\tptr = &v\n\tcase rsa.PublicKey:\n\t\tptr = &v\n\tcase ecdsa.PrivateKey:\n\t\tptr = &v\n\tcase ecdsa.PublicKey:\n\t\tptr = &v\n\tdefault:\n\t\tptr = v\n\t}\n\n\tswitch rawKey := ptr.(type) {\n\tcase *rsa.PrivateKey:\n\t\tk := NewRSAPrivateKey()\n\t\tif err := k.FromRaw(rawKey); err != nil {\n\t\t\treturn nil, errors.Wrapf(err, `failed to initialize %T from %T`, k, rawKey)\n\t\t}\n\t\treturn k, nil\n\tcase *rsa.PublicKey:\n\t\tk := NewRSAPublicKey()\n\t\tif err := k.FromRaw(rawKey); err != nil {\n\t\t\treturn nil, errors.Wrapf(err, `failed to initialize %T from %T`, k, rawKey)\n\t\t}\n\t\treturn k, nil\n\tcase *ecdsa.PrivateKey:\n\t\tk := NewECDSAPrivateKey()\n\t\tif err := k.FromRaw(rawKey); err != nil {\n\t\t\treturn nil, errors.Wrapf(err, `failed to initialize %T from %T`, k, rawKey)\n\t\t}\n\t\treturn k, nil\n\tcase *ecdsa.PublicKey:\n\t\tk := NewECDSAPublicKey()\n\t\tif err := k.FromRaw(rawKey); err != nil {\n\t\t\treturn nil, errors.Wrapf(err, `failed to initialize %T from %T`, k, rawKey)\n\t\t}\n\t\treturn k, nil\n\tcase []byte:\n\t\tk := NewSymmetricKey()\n\t\tif err := k.FromRaw(rawKey); err != nil {\n\t\t\treturn nil, errors.Wrapf(err, `failed to initialize %T from %T`, k, rawKey)\n\t\t}\n\t\treturn k, nil\n\tdefault:\n\t\treturn nil, errors.Errorf(`invalid key type '%T' for jwk.New`, key)\n\t}\n}" ]
[ "0.73871976", "0.714478", "0.709059", "0.6912021", "0.6843181", "0.6613832", "0.65244293", "0.64699113", "0.64592344", "0.642474", "0.64237607", "0.64236516", "0.6421394", "0.641982", "0.6363098", "0.63512987", "0.63231707", "0.6312608", "0.6305274", "0.6305012", "0.6303637", "0.62961084", "0.6291304", "0.62858695", "0.62683356", "0.62473667", "0.62473243", "0.62467307", "0.6246343", "0.6246343", "0.6246343", "0.6246343", "0.6246343", "0.6246343", "0.6246343", "0.6246343", "0.6246343", "0.6246343", "0.6246343", "0.6246343", "0.6246343", "0.6246343", "0.6246343", "0.6246343", "0.6246343", "0.6238299", "0.62236613", "0.62182873", "0.62101257", "0.6188641", "0.61846113", "0.6170784", "0.614482", "0.61425865", "0.61159", "0.61135185", "0.6088872", "0.6074415", "0.60695726", "0.6068463", "0.6065476", "0.60269314", "0.60262793", "0.60223323", "0.60214", "0.600413", "0.59914094", "0.5965155", "0.5954169", "0.59448385", "0.59228665", "0.59169436", "0.58994436", "0.58986753", "0.5885643", "0.58672106", "0.5866227", "0.58636427", "0.58441556", "0.58260536", "0.5819937", "0.58187777", "0.581428", "0.58120704", "0.5809726", "0.5808344", "0.5794041", "0.57595754", "0.5742875", "0.5741434", "0.57380915", "0.5733938", "0.5718384", "0.5708727", "0.5704226", "0.57038975", "0.569383", "0.56892943", "0.56872946" ]
0.862469
1
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderConfiguration.
DeepCopy — это автоматически сгенерированная функция глубокого копирования, копирующая получатель, создавая новый ProviderConfiguration.
func (in *ProviderConfiguration) DeepCopy() *ProviderConfiguration { if in == nil { return nil } out := new(ProviderConfiguration) in.DeepCopyInto(out) return out }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (in *Provider) DeepCopy() *Provider {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Provider)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Provider) DeepCopy() *Provider {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Provider)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ProviderSettings) DeepCopy() *ProviderSettings {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProviderSettings)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ProviderDescription) DeepCopy() *ProviderDescription {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProviderDescription)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ProviderRef) DeepCopy() *ProviderRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProviderRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ProviderSettingsSpec) DeepCopy() *ProviderSettingsSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ProviderSettingsSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AzureConfigStatusProvider) DeepCopy() *AzureConfigStatusProvider {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AzureConfigStatusProvider)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AuthorizationPolicy_ExtensionProvider) DeepCopy() *AuthorizationPolicy_ExtensionProvider {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuthorizationPolicy_ExtensionProvider)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func ProviderCfg(cfg config.Configurator) (*Config, func(), error) {\n\tc := &Config{\n\t\tinvoker: invoker.NewInvoker(),\n\t}\n\te := cfg.UnmarshalKeyOnReload(UnmarshalKey, c)\n\treturn c, func() {}, e\n}", "func (client *AccessGovernanceCPClient) ConfigurationProvider() *common.ConfigurationProvider {\n\treturn client.config\n}", "func (c *config) WithProvider(provider string) Config {\n\tc.provider = provider\n\treturn c\n}", "func NewConfigProvider(options ...ConfigProviderOption) ConfigProvider {\n\treturn newConfigProvider(options...)\n}", "func NewConfigProvider() *ConfigProvider {\n\treturn &ConfigProvider{}\n}", "func (client *NotificationDataPlaneClient) ConfigurationProvider() *common.ConfigurationProvider {\n\treturn client.config\n}", "func (in *MetricProvider) DeepCopy() *MetricProvider {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MetricProvider)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (client *GovernanceClient) ConfigurationProvider() *common.ConfigurationProvider {\n\treturn client.config\n}", "func (client *DnsClient) ConfigurationProvider() *common.ConfigurationProvider {\n\treturn client.config\n}", "func (client *IdentityClient) ConfigurationProvider() *common.ConfigurationProvider {\n\treturn client.config\n}", "func (in *ExternalDNSInfobloxProviderOptions) DeepCopy() *ExternalDNSInfobloxProviderOptions {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ExternalDNSInfobloxProviderOptions)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (client *RoverClusterClient) ConfigurationProvider() *common.ConfigurationProvider {\n\treturn client.config\n}", "func New(p Provider) (*Config, error) {\n\tm, err := p.Provide()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc := &Config{\n\t\tm: m,\n\t}\n\treturn c, nil\n}", "func (in *ExternalDNSBlueCatProviderOptions) DeepCopy() *ExternalDNSBlueCatProviderOptions {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ExternalDNSBlueCatProviderOptions)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretProviderClass) DeepCopy() *SecretProviderClass {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretProviderClass)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (p *ProviderConfig) AddProviderConfig(name string, provider interface{}) error {\n\tif utils.IsOneOf(name, p.GetAllProviderNames()) {\n\t\treturn fmt.Errorf(\"the provider name '%s' is already used\", name)\n\t}\n\n\tswitch providerSpec := provider.(type) {\n\tcase *models.AlibabaCloudSpec:\n\t\tif p.Alibaba == nil {\n\t\t\tp.Alibaba = make(map[string]*models.AlibabaCloudSpec)\n\t\t}\n\t\tp.Alibaba[name] = providerSpec\n\tcase *models.AnexiaCloudSpec:\n\t\tif p.Anexia == nil {\n\t\t\tp.Anexia = make(map[string]*models.AnexiaCloudSpec)\n\t\t}\n\t\tp.Anexia[name] = providerSpec\n\tcase *models.AWSCloudSpec:\n\t\tif p.Aws == nil {\n\t\t\tp.Aws = make(map[string]*models.AWSCloudSpec)\n\t\t}\n\t\tp.Aws[name] = providerSpec\n\tcase *models.AzureCloudSpec:\n\t\tif p.Azure == nil {\n\t\t\tp.Azure = make(map[string]*models.AzureCloudSpec)\n\t\t}\n\t\tp.Azure[name] = providerSpec\n\tcase *models.DigitaloceanCloudSpec:\n\t\tif p.Digitalocean == nil {\n\t\t\tp.Digitalocean = make(map[string]*models.DigitaloceanCloudSpec)\n\t\t}\n\t\tp.Digitalocean[name] = providerSpec\n\tcase *models.FakeCloudSpec:\n\t\tif p.Fake == nil {\n\t\t\tp.Fake = make(map[string]*models.FakeCloudSpec)\n\t\t}\n\t\tp.Fake[name] = providerSpec\n\tcase *models.GCPCloudSpec:\n\t\tif p.Gcp == nil {\n\t\t\tp.Gcp = make(map[string]*models.GCPCloudSpec)\n\t\t}\n\t\tp.Gcp[name] = providerSpec\n\tcase *models.HetznerCloudSpec:\n\t\tif p.Hetzner == nil {\n\t\t\tp.Hetzner = make(map[string]*models.HetznerCloudSpec)\n\t\t}\n\t\tp.Hetzner[name] = providerSpec\n\tcase *models.KubevirtCloudSpec:\n\t\tif p.Kubevirt == nil {\n\t\t\tp.Kubevirt = make(map[string]*models.KubevirtCloudSpec)\n\t\t}\n\t\tp.Kubevirt[name] = providerSpec\n\tcase *models.OpenstackCloudSpec:\n\t\tif p.Openstack == nil {\n\t\t\tp.Openstack = make(map[string]*models.OpenstackCloudSpec)\n\t\t}\n\t\tp.Openstack[name] = providerSpec\n\tcase *models.PacketCloudSpec:\n\t\tif p.Packet == nil {\n\t\t\tp.Packet = make(map[string]*models.PacketCloudSpec)\n\t\t}\n\t\tp.Packet[name] = providerSpec\n\tcase *models.VSphereCloudSpec:\n\t\tif p.Vsphere == nil {\n\t\t\tp.Vsphere = make(map[string]*models.VSphereCloudSpec)\n\t\t}\n\t\tp.Vsphere[name] = providerSpec\n\tdefault:\n\t\treturn fmt.Errorf(\"failed to determine the correct cloudSpecType\")\n\t}\n\n\treturn nil\n}", "func (exporter *Exporter) ExportProviderConfiguration(region string) {\n\tfmt.Printf(configurationTemplateProvider, region)\n}", "func (client *ArtifactsClient) ConfigurationProvider() *common.ConfigurationProvider {\n\treturn client.config\n}", "func NewProvider() *ProviderConfig {\n\tproviderConfig := &ProviderConfig{\n\t\tAlibaba: make(map[string]*models.AlibabaCloudSpec),\n\t\tAnexia: make(map[string]*models.AnexiaCloudSpec),\n\t\tAws: make(map[string]*models.AWSCloudSpec),\n\t\tAzure: make(map[string]*models.AzureCloudSpec),\n\t\tDigitalocean: make(map[string]*models.DigitaloceanCloudSpec),\n\t\tFake: make(map[string]*models.FakeCloudSpec),\n\t\tGcp: make(map[string]*models.GCPCloudSpec),\n\t\tHetzner: make(map[string]*models.HetznerCloudSpec),\n\t\tKubevirt: make(map[string]*models.KubevirtCloudSpec),\n\t\tOpenstack: make(map[string]*models.OpenstackCloudSpec),\n\t\tPacket: make(map[string]*models.PacketCloudSpec),\n\t\tVsphere: make(map[string]*models.VSphereCloudSpec),\n\t}\n\n\tproviderConfig.Alibaba[\"Alibaba\"] = newAlibabaCloudSpec()\n\tproviderConfig.Anexia[\"Anexia\"] = newAnexiaCloudSpec()\n\tproviderConfig.Aws[\"Aws\"] = newAWSCloudSpec()\n\tproviderConfig.Azure[\"Azure\"] = newAzureCloudSpec()\n\tproviderConfig.Digitalocean[\"Digitalocean\"] = newDigitaloceanCloudSpec()\n\tproviderConfig.Fake[\"Fake\"] = newFakeCloudSpec()\n\tproviderConfig.Gcp[\"Gcp\"] = newGCPCloudSpec()\n\tproviderConfig.Hetzner[\"Hetzner\"] = newHetznerCloudSpec()\n\tproviderConfig.Kubevirt[\"Kubevirt\"] = newKubevirtCloudSpec()\n\tproviderConfig.Openstack[\"Openstack\"] = newOpenstackCloudSpec()\n\tproviderConfig.Packet[\"Packet\"] = newPacketCloudSpec()\n\tproviderConfig.Vsphere[\"Vsphere\"] = newVSphereCloudSpec()\n\n\treturn providerConfig\n}", "func (client *StorageGatewayClient) ConfigurationProvider() *common.ConfigurationProvider {\n\treturn client.config\n}", "func (client *OccMetricsClient) ConfigurationProvider() *common.ConfigurationProvider {\n\treturn client.config\n}", "func (mg *SQLStoredProcedure) SetProviderConfigReference(r *xpv1.Reference) {\n\tmg.Spec.ProviderConfigReference = r\n}", "func (mg *Firewall) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (in *PrivateconnectionVpcPeeringConfig) DeepCopy() *PrivateconnectionVpcPeeringConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrivateconnectionVpcPeeringConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (client *BastionClient) ConfigurationProvider() *common.ConfigurationProvider {\n\treturn client.config\n}", "func (p Provider) GetConfig() model.ProviderConfig {\n\treturn p.config\n}", "func LoadConfigProvider(appName string) *viper.Viper {\n\treturn readViperConfig(appName)\n}", "func LoadConfigProvider(appName string) *viper.Viper {\n\treturn readViperConfig(appName)\n}", "func WithProvider(provider Provider) Option {\n\treturn func(cfg *config) {\n\t\tcfg.provider = provider\n\t}\n}", "func (client *ComplianceDocClient) ConfigurationProvider() *common.ConfigurationProvider {\n\treturn client.config\n}", "func (in *SecretProviderClassSpec) DeepCopy() *SecretProviderClassSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretProviderClassSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (mg *EC2NetworkInterface) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (mg *InstanceProfile) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (in *KubemanagerConfig) DeepCopy() *KubemanagerConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubemanagerConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (mg *IPv4CIDRBlockAssociation) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (mg *GremlinGraph) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func ProviderSpec() *ProviderSpecApplyConfiguration {\n\treturn &ProviderSpecApplyConfiguration{}\n}", "func (mg *GremlinGraph) SetProviderConfigReference(r *xpv1.Reference) {\n\tmg.Spec.ProviderConfigReference = r\n}", "func (mg *Subnetwork) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (mg *Network) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (mg *EC2LaunchTemplate) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (mg *Policy) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (mg *Subnet) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (in *DevicePluginConfig) DeepCopy() *DevicePluginConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DevicePluginConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (mg *Firewall) SetProviderConfigReference(r *xpv1.Reference) {\n\tmg.Spec.ProviderConfigReference = r\n}", "func (mg *VpcPeeringConnection) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (in *DeviceSecretVerifierConfigType) DeepCopy() *DeviceSecretVerifierConfigType {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DeviceSecretVerifierConfigType)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (mg *UserGroupMembership) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func LoadConfigProvider(appName string) Provider {\r\n\treturn readViperConfig(appName)\r\n}", "func (mg *SQLStoredProcedure) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (mg *Group) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func NewProvider(cfg Config) *Provider {\n\treturn &Provider{\n\t\tConfig: cfg,\n\t}\n}", "func (in *EndpointConfigurationParameters) DeepCopy() *EndpointConfigurationParameters {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EndpointConfigurationParameters)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (mg *NotebookWorkspace) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (mg *EC2NetworkInterface) SetProviderConfigReference(r *xpv1.Reference) {\n\tmg.Spec.ProviderConfigReference = r\n}", "func (mg *Instance) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (mg *Instance) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (mg *InstanceProfile) SetProviderConfigReference(r *xpv1.Reference) {\n\tmg.Spec.ProviderConfigReference = r\n}", "func (mg *GroupPolicyAttachment) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (mg *SecurityGroupRule) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (mg *Network) SetProviderConfigReference(r *xpv1.Reference) {\n\tmg.Spec.ProviderConfigReference = r\n}", "func (mg *SecurityGroup) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (in *PrivateLinkServiceIpConfiguration) DeepCopy() *PrivateLinkServiceIpConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrivateLinkServiceIpConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func ProvidersConfig(t *testing.T) *config.Config {\n\tconst (\n\t\ttestClientKey = \"provider-test-client-key\"\n\t\ttestSecret = \"provider-test-secret\"\n\t\ttestCallback = \"http://auth.exmaple.com/test/callback\"\n\t)\n\tsetEnv(t, config.Auth0DomainEnv, \"example.com\")\n\tsetEnv(t, config.OpenIDConnectURLEnv, MockOpenIDConnect(t))\n\tsetEnv(t, config.AzureADTenantEnv, string(azureadv2.CommonTenant))\n\tvar testScopes = []string{\"test-scope-1\", \"test-scope-2\"}\n\tc := Config(t)\n\ta := config.Authorization{\n\t\tProviders: map[provider.Name]config.Provider{},\n\t}\n\ta.UseInternal = true\n\tfor name := range provider.External {\n\t\ta.Providers[name] = config.Provider{\n\t\t\tClientKey: testClientKey,\n\t\t\tSecret: testSecret,\n\t\t\tCallbackURL: testCallback,\n\t\t\tScopes: testScopes,\n\t\t}\n\t}\n\t// FIXME: core/auth/providers.go:162\n\tt.Log(\"skipping \", provider.Apple)\n\tdelete(a.Providers, provider.Apple)\n\tc.Authorization = a\n\treturn c\n}", "func (mg *Policy) SetProviderConfigReference(r *xpv1.Reference) {\n\tmg.Spec.ProviderConfigReference = r\n}", "func (mg *OpenIDConnectProvider) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (in *EKSManagedConfiguration) DeepCopy() *EKSManagedConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSManagedConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KalmConfig) DeepCopy() *KalmConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KalmConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (mg *VpcEndpoint) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (mg *EC2LaunchTemplate) SetProviderConfigReference(r *xpv1.Reference) {\n\tmg.Spec.ProviderConfigReference = r\n}", "func (mg *Group) SetProviderConfigReference(r *xpv1.Reference) {\n\tmg.Spec.ProviderConfigReference = r\n}", "func (mg *GremlinDatabase) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (store *credentialConfig) Provider() credentials.Provider {\n\treturn credentials.UseKey(store.getCredentialReader()).Passphrase(store.PassphraseReader())\n}", "func (mg *Subnetwork) SetProviderConfigReference(r *xpv1.Reference) {\n\tmg.Spec.ProviderConfigReference = r\n}", "func (mg *Router) SetProviderConfigReference(r *xpv1.Reference) {\n\tmg.Spec.ProviderConfigReference = r\n}", "func (mg *Instance) SetProviderConfigReference(r *xpv1.Reference) {\n\tmg.Spec.ProviderConfigReference = r\n}", "func (mg *Instance) SetProviderConfigReference(r *xpv1.Reference) {\n\tmg.Spec.ProviderConfigReference = r\n}", "func (mg *ManagedSSLCertificate) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func CfgProviderConfig(providerConfig string) ManagerConfigOpt {\n\treturn func(config *ManagerConfig) {\n\t\tconfig.ProviderConfig = providerConfig\n\t}\n}", "func (mg *Subnet) SetProviderConfigReference(r *xpv1.Reference) {\n\tmg.Spec.ProviderConfigReference = r\n}", "func (mg *AccessKey) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (mg *Router) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (mg *GremlinDatabase) SetProviderConfigReference(r *xpv1.Reference) {\n\tmg.Spec.ProviderConfigReference = r\n}", "func (in *SecretEngineConfiguration) DeepCopy() *SecretEngineConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretEngineConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ExternalDNSAWSProviderOptions) DeepCopy() *ExternalDNSAWSProviderOptions {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ExternalDNSAWSProviderOptions)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (mg *VpcPeeringConnection) SetProviderConfigReference(r *xpv1.Reference) {\n\tmg.Spec.ProviderConfigReference = r\n}", "func (in *PrivateEndpointIPConfiguration) DeepCopy() *PrivateEndpointIPConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrivateEndpointIPConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (mg *Address) GetProviderConfigReference() *xpv1.Reference {\n\treturn mg.Spec.ProviderConfigReference\n}", "func (proxy *StandAloneProxyConfig) DeepCopy() *StandAloneProxyConfig {\n\tif proxy == nil {\n\t\treturn nil\n\t}\n\tcloned := new(StandAloneProxyConfig)\n\tcloned.proxyCredentials = make(map[string]*ProxyUser)\n\tcloned.managementServers = make(map[url.URL]*ManagementServer)\n\tcloned.managedArrays = make(map[string]*StorageArray)\n\tfor key, value := range proxy.managedArrays {\n\t\tarray := *value\n\t\tcloned.managedArrays[key] = &array\n\t}\n\tfor key, value := range proxy.managementServers {\n\t\tcloned.managementServers[key] = value.DeepCopy()\n\t}\n\tfor key, value := range proxy.proxyCredentials {\n\t\tcreds := *value\n\t\tcloned.proxyCredentials[key] = &creds\n\t}\n\treturn cloned\n}" ]
[ "0.65710604", "0.65710604", "0.65028113", "0.63433236", "0.5991025", "0.59304255", "0.58877087", "0.5869135", "0.57617694", "0.5751949", "0.56482095", "0.56043553", "0.5583803", "0.55688334", "0.55674565", "0.5523267", "0.5475685", "0.5468203", "0.5455061", "0.54211265", "0.5414148", "0.5398919", "0.5368394", "0.5357251", "0.53501856", "0.5343473", "0.53274935", "0.5324562", "0.52237767", "0.522306", "0.52222013", "0.5209832", "0.5209566", "0.51961744", "0.5191946", "0.5191946", "0.5179865", "0.5162668", "0.5146989", "0.51357234", "0.51336485", "0.51217353", "0.51075643", "0.5098117", "0.5094373", "0.508392", "0.5080976", "0.5078239", "0.50771576", "0.50686216", "0.5066181", "0.5062687", "0.5050596", "0.5046654", "0.5034266", "0.5030429", "0.5023633", "0.50200176", "0.5016167", "0.5010959", "0.50093627", "0.5006649", "0.50061756", "0.50047976", "0.50047976", "0.4998675", "0.4980776", "0.4976389", "0.4970914", "0.4970914", "0.4970914", "0.49694198", "0.49692383", "0.4968876", "0.49681914", "0.4962657", "0.49622768", "0.49617374", "0.4954744", "0.4953938", "0.4952861", "0.49484053", "0.49439412", "0.49420917", "0.49418384", "0.49405605", "0.49396357", "0.49396357", "0.49384362", "0.49373424", "0.4932232", "0.49300846", "0.4922397", "0.49210003", "0.4918259", "0.4911395", "0.49106824", "0.49105853", "0.49082574", "0.49065247" ]
0.8349167
0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceConfiguration.
DeepCopy — это автоматически сгенерированная функция глубокого копирования, копирующая получатель, создавая новый ResourceConfiguration.
func (in *ResourceConfiguration) DeepCopy() *ResourceConfiguration { if in == nil { return nil } out := new(ResourceConfiguration) in.DeepCopyInto(out) return out }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (in *ResourceConfig) DeepCopy() *ResourceConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BaseKubernetesResourceConfig) DeepCopy() *BaseKubernetesResourceConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BaseKubernetesResourceConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceOptions) DeepCopy() *ResourceOptions {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceOptions)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IpConfiguration_ARM) DeepCopy() *IpConfiguration_ARM {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IpConfiguration_ARM)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LabelingJobResourceConfig) DeepCopy() *LabelingJobResourceConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LabelingJobResourceConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceDescription) DeepCopy() *ResourceDescription {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceDescription)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RegistryConfiguration) DeepCopy() *RegistryConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RegistryConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Resource) DeepCopy() *Resource {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Resource)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Resource) DeepCopy() *Resource {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Resource)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceOutput) DeepCopy() *ResourceOutput {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceOutput)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceCondition) DeepCopy() *ResourceCondition {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceCondition)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceAttribute) DeepCopy() *ResourceAttribute {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceAttribute)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ApplicationGatewaySubResource) DeepCopy() *ApplicationGatewaySubResource {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplicationGatewaySubResource)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RedisConfiguration) DeepCopy() *RedisConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RedisConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PrivateEndpointIPConfiguration_ARM) DeepCopy() *PrivateEndpointIPConfiguration_ARM {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrivateEndpointIPConfiguration_ARM)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ApplicationGatewaySubResource_ARM) DeepCopy() *ApplicationGatewaySubResource_ARM {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplicationGatewaySubResource_ARM)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceSpec) DeepCopy() *ResourceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceSpec) DeepCopy() *ResourceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceSpec) DeepCopy() *ResourceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceSpec) DeepCopy() *ResourceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PrivateLinkServiceIpConfiguration_ARM) DeepCopy() *PrivateLinkServiceIpConfiguration_ARM {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrivateLinkServiceIpConfiguration_ARM)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceThresholdStrategy) DeepCopy() *ResourceThresholdStrategy {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceThresholdStrategy)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceSelector) DeepCopy() *ResourceSelector {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceSelector)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceServerParameters) DeepCopy() *ResourceServerParameters {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceServerParameters)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CrdManagementConfiguration) DeepCopy() *CrdManagementConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CrdManagementConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *OCIConfiguration) DeepCopy() *OCIConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(OCIConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceEvent) DeepCopy() *ResourceEvent {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceEvent)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DnsresolverSubResource_ARM) DeepCopy() *DnsresolverSubResource_ARM {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DnsresolverSubResource_ARM)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceRef) DeepCopy() *ResourceRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BaseKubernetesResourceConfig) DeepCopyInterface() interface{} {\n\treturn in.DeepCopy()\n}", "func (in *RestApi_EndpointConfiguration) DeepCopy() *RestApi_EndpointConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RestApi_EndpointConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IpConfiguration_STATUS_ARM) DeepCopy() *IpConfiguration_STATUS_ARM {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IpConfiguration_STATUS_ARM)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ExtendedResource) DeepCopy() *ExtendedResource {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ExtendedResource)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ControllerConfiguration) DeepCopy() *ControllerConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ControllerConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceCapacityThreshold) DeepCopy() *ResourceCapacityThreshold {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceCapacityThreshold)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ControllerResource) DeepCopy() *ControllerResource {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ControllerResource)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CertificateRenewalConfig) DeepCopy() *CertificateRenewalConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CertificateRenewalConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RelabelConfig) DeepCopy() *RelabelConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RelabelConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSCFConfiguration) DeepCopy() *EKSCFConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSCFConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *K8SResourcePolicy) DeepCopy() *K8SResourcePolicy {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(K8SResourcePolicy)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceMap) DeepCopy() *ResourceMap {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceMap)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ApplicationConfiguration) DeepCopy() *ApplicationConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplicationConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AdmissionWebhookConfiguration) DeepCopy() *AdmissionWebhookConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AdmissionWebhookConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Resources) DeepCopy() *Resources {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Resources)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Resources) DeepCopy() *Resources {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Resources)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Resources) DeepCopy() *Resources {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Resources)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Resources) DeepCopy() *Resources {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Resources)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceSigningProfile) DeepCopy() *ResourceSigningProfile {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceSigningProfile)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BastionHostIPConfiguration_ARM) DeepCopy() *BastionHostIPConfiguration_ARM {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BastionHostIPConfiguration_ARM)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceRequirements) DeepCopy() *ResourceRequirements {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceRequirements)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceRequirements) DeepCopy() *ResourceRequirements {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceRequirements)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceRequirements) DeepCopy() *ResourceRequirements {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceRequirements)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceServer) DeepCopy() *ResourceServer {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceServer)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RestoreResourceHook) DeepCopy() *RestoreResourceHook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RestoreResourceHook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DebugRuleConfiguration) DeepCopy() *DebugRuleConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DebugRuleConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DnsresolverSubResource) DeepCopy() *DnsresolverSubResource {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DnsresolverSubResource)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceRestoreResourceInfo) DeepCopy() *ResourceRestoreResourceInfo {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceRestoreResourceInfo)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceReference) DeepCopy() *ResourceReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceEventList) DeepCopy() *ResourceEventList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceEventList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ControllerManagerWebhookConfiguration) DeepCopy() *ControllerManagerWebhookConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ControllerManagerWebhookConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ControllerManagerWebhookConfiguration) DeepCopy() *ControllerManagerWebhookConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ControllerManagerWebhookConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceUsageExportConfig) DeepCopy() *ResourceUsageExportConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceUsageExportConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MutatingWebhookConfigurationRef) DeepCopy() *MutatingWebhookConfigurationRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MutatingWebhookConfigurationRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PolicyResource) DeepCopy() *PolicyResource {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PolicyResource)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConfigurationSpec) DeepCopy() *ConfigurationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigurationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConfigurationSpec) DeepCopy() *ConfigurationSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigurationSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MongoDBConfiguration) DeepCopy() *MongoDBConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MongoDBConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceEventSpec) DeepCopy() *ResourceEventSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceEventSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceRequirement) DeepCopy() *ResourceRequirement {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceRequirement)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceExport) DeepCopy() *ResourceExport {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceExport)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceExport) DeepCopy() *ResourceExport {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceExport)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GCPConfiguration) DeepCopy() *GCPConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GCPConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggingConfiguration) DeepCopy() *LoggingConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggingConfiguration) DeepCopy() *LoggingConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IpConfiguration_STATUS) DeepCopy() *IpConfiguration_STATUS {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IpConfiguration_STATUS)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func WithResourceAttributes(attributes map[string]string) Option {\n\treturn func(c *Config) {\n\t\tc.ResourceAttributes = attributes\n\t}\n}", "func (in *ResourceStatus) DeepCopy() *ResourceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceStatus) DeepCopy() *ResourceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DeviceConfigurationType) DeepCopy() *DeviceConfigurationType {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DeviceConfigurationType)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PrivateDnsZoneConfig_ARM) DeepCopy() *PrivateDnsZoneConfig_ARM {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrivateDnsZoneConfig_ARM)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *NetworkConfiguration) DeepCopy() *NetworkConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *IpConfiguration) DeepCopy() *IpConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(IpConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in KubernetesResourceMap) DeepCopy() KubernetesResourceMap {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubernetesResourceMap)\n\tin.DeepCopyInto(out)\n\treturn *out\n}", "func (in *DomainName_EndpointConfiguration) DeepCopy() *DomainName_EndpointConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DomainName_EndpointConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceDiscovererSpec) DeepCopy() *ResourceDiscovererSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceDiscovererSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EndpointConfigurationParameters) DeepCopy() *EndpointConfigurationParameters {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EndpointConfigurationParameters)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PrivateLinkServiceIpConfigurationProperties_ARM) DeepCopy() *PrivateLinkServiceIpConfigurationProperties_ARM {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrivateLinkServiceIpConfigurationProperties_ARM)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *AwsResourceRef) DeepCopy() *AwsResourceRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AwsResourceRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceList) DeepCopy() *ResourceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ResourceList) DeepCopy() *ResourceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConfigurationList) DeepCopy() *ConfigurationList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigurationList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CollectionConfiguration) DeepCopy() *CollectionConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CollectionConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *Config) DeepCopy() *Config {\n\tif c == nil {\n\t\treturn &Config{}\n\t}\n\tcfg := *c\n\treturn &cfg\n}", "func (in *BackupResourceHook) DeepCopy() *BackupResourceHook {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BackupResourceHook)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func LoadResourceConfig() map[string]ResourceConfig {\n\treturn getDefaultResourceConfig()\n}", "func (in *MariaDBConfiguration) DeepCopy() *MariaDBConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MariaDBConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *RestoreResourceHookSpec) DeepCopy() *RestoreResourceHookSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RestoreResourceHookSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}" ]
[ "0.7895176", "0.6825849", "0.67865694", "0.6739", "0.6708907", "0.6551092", "0.613349", "0.60686964", "0.60686964", "0.6034275", "0.6017182", "0.5848022", "0.58381516", "0.5824164", "0.5757487", "0.57524174", "0.5726038", "0.5726038", "0.5726038", "0.57107085", "0.57107085", "0.57107085", "0.57107085", "0.56992215", "0.5695592", "0.56795007", "0.5519691", "0.5518238", "0.5511697", "0.55082566", "0.5490514", "0.546124", "0.5435611", "0.5425961", "0.54207206", "0.53966695", "0.5395642", "0.5390621", "0.5387943", "0.53853935", "0.5374838", "0.5365735", "0.5362526", "0.533373", "0.5328879", "0.5322848", "0.5304739", "0.5304739", "0.5304739", "0.5304739", "0.530031", "0.5289826", "0.52710444", "0.52710444", "0.52710444", "0.52667767", "0.52661705", "0.52655625", "0.52543664", "0.5252686", "0.5252648", "0.5242177", "0.523542", "0.523542", "0.52330494", "0.52270496", "0.521278", "0.5200666", "0.5200666", "0.5178746", "0.5152194", "0.5148623", "0.51367074", "0.51367074", "0.51163685", "0.51107097", "0.51107097", "0.5098078", "0.5092771", "0.50858086", "0.50858086", "0.50837386", "0.50811726", "0.50781107", "0.50760204", "0.5062348", "0.50503373", "0.50409657", "0.5040562", "0.50377136", "0.5035848", "0.5035549", "0.5035549", "0.503297", "0.5024159", "0.5017947", "0.5015719", "0.50107986", "0.5007292", "0.50054586" ]
0.8736436
0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretboxConfiguration.
DeepCopy — это автоматически сгенерированная функция глубокого копирования, копирующая получателя, создавая новый объект SecretboxConfiguration.
func (in *SecretboxConfiguration) DeepCopy() *SecretboxConfiguration { if in == nil { return nil } out := new(SecretboxConfiguration) in.DeepCopyInto(out) return out }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *VaultConfig) Copy() *VaultConfig {\n\tif c == nil {\n\t\treturn nil\n\t}\n\n\tvar o VaultConfig\n\to.Address = c.Address\n\n\to.Enabled = c.Enabled\n\n\to.Namespace = c.Namespace\n\n\to.RenewToken = c.RenewToken\n\n\tif c.Retry != nil {\n\t\to.Retry = c.Retry.Copy()\n\t}\n\n\tif c.SSL != nil {\n\t\to.SSL = c.SSL.Copy()\n\t}\n\n\to.Token = c.Token\n\n\to.VaultAgentTokenFile = c.VaultAgentTokenFile\n\n\tif c.Transport != nil {\n\t\to.Transport = c.Transport.Copy()\n\t}\n\n\to.UnwrapToken = c.UnwrapToken\n\n\to.DefaultLeaseDuration = c.DefaultLeaseDuration\n\to.LeaseRenewalThreshold = c.LeaseRenewalThreshold\n\n\to.K8SAuthRoleName = c.K8SAuthRoleName\n\to.K8SServiceAccountToken = c.K8SServiceAccountToken\n\to.K8SServiceAccountTokenPath = c.K8SServiceAccountTokenPath\n\to.K8SServiceMountPath = c.K8SServiceMountPath\n\n\treturn &o\n}", "func (in *SecretEngineConfiguration) DeepCopy() *SecretEngineConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretEngineConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConfigMapSecret) DeepCopy() *ConfigMapSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigMapSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DatabaseSecretEngineConfig) DeepCopy() *DatabaseSecretEngineConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DatabaseSecretEngineConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *VaultSecret) DeepCopy() *VaultSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VaultSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Secret) DeepCopy() *Secret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Secret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretAccessRequestConfiguration) DeepCopy() *SecretAccessRequestConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretAccessRequestConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *Config) Copy() (*Config, error) {\n\tnewC := New()\n\tc.Viper.Unmarshal(&newC.plainTextConfig)\n\tc.Viper.Unmarshal(&newC.secureConfig)\n\treturn newC, nil\n}", "func (in *BcsSecret) DeepCopy() *BcsSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BcsSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DeviceSecretVerifierConfigType) DeepCopy() *DeviceSecretVerifierConfigType {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DeviceSecretVerifierConfigType)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c Config) Copy() Config {\n\tdst := Config{}\n\tdst.Credentials = c.Credentials\n\tdst.Endpoint = c.Endpoint\n\tdst.Region = c.Region\n\tdst.DisableSSL = c.DisableSSL\n\tdst.ManualSend = c.ManualSend\n\tdst.HTTPClient = c.HTTPClient\n\tdst.LogHTTPBody = c.LogHTTPBody\n\tdst.LogLevel = c.LogLevel\n\tdst.Logger = c.Logger\n\tdst.MaxRetries = c.MaxRetries\n\tdst.DisableParamValidation = c.DisableParamValidation\n\tdst.DisableComputeChecksums = c.DisableComputeChecksums\n\tdst.S3ForcePathStyle = c.S3ForcePathStyle\n\tdst.DomainMode = c.DomainMode\n\tdst.SignerVersion = c.SignerVersion\n\treturn dst\n}", "func (in *DatabaseSecretEngineConfigSpec) DeepCopy() *DatabaseSecretEngineConfigSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DatabaseSecretEngineConfigSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (old ContainerConfig) Copy() ContainerConfig {\n\t// Copy all fields\n\tres := old\n\n\t// Make deep copy of slices\n\t// none yet - placeholder\n\n\treturn res\n}", "func (proxy *StandAloneProxyConfig) DeepCopy() *StandAloneProxyConfig {\n\tif proxy == nil {\n\t\treturn nil\n\t}\n\tcloned := new(StandAloneProxyConfig)\n\tcloned.proxyCredentials = make(map[string]*ProxyUser)\n\tcloned.managementServers = make(map[url.URL]*ManagementServer)\n\tcloned.managedArrays = make(map[string]*StorageArray)\n\tfor key, value := range proxy.managedArrays {\n\t\tarray := *value\n\t\tcloned.managedArrays[key] = &array\n\t}\n\tfor key, value := range proxy.managementServers {\n\t\tcloned.managementServers[key] = value.DeepCopy()\n\t}\n\tfor key, value := range proxy.proxyCredentials {\n\t\tcreds := *value\n\t\tcloned.proxyCredentials[key] = &creds\n\t}\n\treturn cloned\n}", "func (in *CredentialSecret) DeepCopy() *CredentialSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CredentialSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o *Config) Copy(s Config) {\n o.Enable = s.Enable\n o.RouterId = s.RouterId\n o.AsNumber = s.AsNumber\n o.BfdProfile = s.BfdProfile\n o.RejectDefaultRoute = s.RejectDefaultRoute\n o.InstallRoute = s.InstallRoute\n o.AggregateMed = s.AggregateMed\n o.DefaultLocalPreference = s.DefaultLocalPreference\n o.AsFormat = s.AsFormat\n o.AlwaysCompareMed = s.AlwaysCompareMed\n o.DeterministicMedComparison = s.DeterministicMedComparison\n o.EcmpMultiAs = s.EcmpMultiAs\n o.EnforceFirstAs = s.EnforceFirstAs\n o.EnableGracefulRestart = s.EnableGracefulRestart\n o.StaleRouteTime = s.StaleRouteTime\n o.LocalRestartTime = s.LocalRestartTime\n o.MaxPeerRestartTime = s.MaxPeerRestartTime\n o.ReflectorClusterId = s.ReflectorClusterId\n o.ConfederationMemberAs = s.ConfederationMemberAs\n o.AllowRedistributeDefaultRoute = s.AllowRedistributeDefaultRoute\n}", "func (in *VaultSecretSpec) DeepCopy() *VaultSecretSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VaultSecretSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ContainernodepoolSandboxConfig) DeepCopy() *ContainernodepoolSandboxConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContainernodepoolSandboxConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *PasswordSecret) DeepCopy() *PasswordSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PasswordSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretInfo) DeepCopy() *SecretInfo {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretInfo)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o *Block) GetSecretConfiguration(ctx context.Context, options map[string]dbus.Variant) (configuration []struct {\n\tV0 string\n\tV1 map[string]dbus.Variant\n}, err error) {\n\terr = o.object.CallWithContext(ctx, InterfaceBlock+\".GetSecretConfiguration\", 0, options).Store(&configuration)\n\treturn\n}", "func (opts OAuth2WellKnownConfiguration) Copy() (optsCopy OAuth2WellKnownConfiguration) {\n\toptsCopy = OAuth2WellKnownConfiguration{\n\t\tCommonDiscoveryOptions: opts.CommonDiscoveryOptions,\n\t\tOAuth2DiscoveryOptions: opts.OAuth2DiscoveryOptions,\n\t}\n\n\tif opts.OAuth2DeviceAuthorizationGrantDiscoveryOptions != nil {\n\t\toptsCopy.OAuth2DeviceAuthorizationGrantDiscoveryOptions = &OAuth2DeviceAuthorizationGrantDiscoveryOptions{}\n\t\t*optsCopy.OAuth2DeviceAuthorizationGrantDiscoveryOptions = *opts.OAuth2DeviceAuthorizationGrantDiscoveryOptions\n\t}\n\n\tif opts.OAuth2MutualTLSClientAuthenticationDiscoveryOptions != nil {\n\t\toptsCopy.OAuth2MutualTLSClientAuthenticationDiscoveryOptions = &OAuth2MutualTLSClientAuthenticationDiscoveryOptions{}\n\t\t*optsCopy.OAuth2MutualTLSClientAuthenticationDiscoveryOptions = *opts.OAuth2MutualTLSClientAuthenticationDiscoveryOptions\n\t}\n\n\tif opts.OAuth2IssuerIdentificationDiscoveryOptions != nil {\n\t\toptsCopy.OAuth2IssuerIdentificationDiscoveryOptions = &OAuth2IssuerIdentificationDiscoveryOptions{}\n\t\t*optsCopy.OAuth2IssuerIdentificationDiscoveryOptions = *opts.OAuth2IssuerIdentificationDiscoveryOptions\n\t}\n\n\tif opts.OAuth2JWTIntrospectionResponseDiscoveryOptions != nil {\n\t\toptsCopy.OAuth2JWTIntrospectionResponseDiscoveryOptions = &OAuth2JWTIntrospectionResponseDiscoveryOptions{}\n\t\t*optsCopy.OAuth2JWTIntrospectionResponseDiscoveryOptions = *opts.OAuth2JWTIntrospectionResponseDiscoveryOptions\n\t}\n\n\tif opts.OAuth2JWTSecuredAuthorizationRequestDiscoveryOptions != nil {\n\t\toptsCopy.OAuth2JWTSecuredAuthorizationRequestDiscoveryOptions = &OAuth2JWTSecuredAuthorizationRequestDiscoveryOptions{}\n\t\t*optsCopy.OAuth2JWTSecuredAuthorizationRequestDiscoveryOptions = *opts.OAuth2JWTSecuredAuthorizationRequestDiscoveryOptions\n\t}\n\n\tif opts.OAuth2PushedAuthorizationDiscoveryOptions != nil {\n\t\toptsCopy.OAuth2PushedAuthorizationDiscoveryOptions = &OAuth2PushedAuthorizationDiscoveryOptions{}\n\t\t*optsCopy.OAuth2PushedAuthorizationDiscoveryOptions = *opts.OAuth2PushedAuthorizationDiscoveryOptions\n\t}\n\n\treturn optsCopy\n}", "func (c *Config) Copy() *Config {\n\td := new(Config)\n\tcopier.Copy(d, c)\n\treturn d\n}", "func (o *Config) Copy(s Config) {\n\to.Enable = s.Enable\n\to.RouterId = s.RouterId\n\to.AsNumber = s.AsNumber\n\to.BfdProfile = s.BfdProfile\n\to.RejectDefaultRoute = s.RejectDefaultRoute\n\to.InstallRoute = s.InstallRoute\n\to.AggregateMed = s.AggregateMed\n\to.DefaultLocalPreference = s.DefaultLocalPreference\n\to.AsFormat = s.AsFormat\n\to.AlwaysCompareMed = s.AlwaysCompareMed\n\to.DeterministicMedComparison = s.DeterministicMedComparison\n\to.EcmpMultiAs = s.EcmpMultiAs\n\to.EnforceFirstAs = s.EnforceFirstAs\n\to.EnableGracefulRestart = s.EnableGracefulRestart\n\to.StaleRouteTime = s.StaleRouteTime\n\to.LocalRestartTime = s.LocalRestartTime\n\to.MaxPeerRestartTime = s.MaxPeerRestartTime\n\to.ReflectorClusterId = s.ReflectorClusterId\n\to.ConfederationMemberAs = s.ConfederationMemberAs\n\to.AllowRedistributeDefaultRoute = s.AllowRedistributeDefaultRoute\n}", "func (in *AESConfiguration) DeepCopy() *AESConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AESConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConfigMapSecretSpec) DeepCopy() *ConfigMapSecretSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigMapSecretSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BcsSecretSpec) DeepCopy() *BcsSecretSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BcsSecretSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KubemanagerConfig) DeepCopy() *KubemanagerConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubemanagerConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DopplerSecret) DeepCopy() *DopplerSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DopplerSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ContainernodepoolShieldedInstanceConfig) DeepCopy() *ContainernodepoolShieldedInstanceConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContainernodepoolShieldedInstanceConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConfigMapSecretList) DeepCopy() *ConfigMapSecretList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigMapSecretList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KMSConfiguration) DeepCopy() *KMSConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KMSConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DatabaseSecretEngineConfigList) DeepCopy() *DatabaseSecretEngineConfigList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DatabaseSecretEngineConfigList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *BcsSecretList) DeepCopy() *BcsSecretList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BcsSecretList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (cb *ConfigBuilder) WithPassword(password string) *ConfigBuilder {\n\tcb.config.Password = password\n\treturn cb\n}", "func (proxyConfig *ProxyConfig) DeepCopy() *ProxyConfig {\n\tif proxyConfig == nil {\n\t\treturn nil\n\t}\n\tcloned := ProxyConfig{}\n\tcloned = *proxyConfig\n\tcloned.LinkProxyConfig = proxyConfig.LinkProxyConfig.DeepCopy()\n\tcloned.StandAloneProxyConfig = proxyConfig.StandAloneProxyConfig.DeepCopy()\n\treturn &cloned\n}", "func (in *RootCredentialConfig) DeepCopy() *RootCredentialConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RootCredentialConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretSpec) DeepCopy() *SecretSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretSpec) DeepCopy() *SecretSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func GetSecretConfig(secret *v1.Secret) Config {\n\treturn Config{\n\t\tNamespace: secret.Namespace,\n\t\tResourceName: secret.Name,\n\t\tResourceAnnotations: secret.Annotations,\n\t\tAnnotation: options.SecretUpdateOnChangeAnnotation,\n\t\tSHAValue: GetSHAfromSecret(secret.Data),\n\t\tType: constants.SecretEnvVarPostfix,\n\t}\n}", "func (in *ToolchainSecret) DeepCopy() *ToolchainSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ToolchainSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (proxy *LinkedProxyConfig) DeepCopy() *LinkedProxyConfig {\n\tif proxy == nil {\n\t\treturn nil\n\t}\n\tcloned := new(LinkedProxyConfig)\n\tcloned.Primary = proxy.Primary.DeepCopy()\n\tif proxy.Backup != nil {\n\t\tcloned.Backup = proxy.Backup.DeepCopy()\n\t}\n\treturn cloned\n}", "func (in *MySQLConfiguration) DeepCopy() *MySQLConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MySQLConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *Config) DeepCopy() *Config {\n\tif c == nil {\n\t\treturn &Config{}\n\t}\n\tcfg := *c\n\treturn &cfg\n}", "func (in *KubebenchConfig) DeepCopy() *KubebenchConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubebenchConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CheSecret) DeepCopy() *CheSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CheSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (b *BackendConfiguration) ToSecretConfig() (SecretConfig, error) {\n\tuserName, password, err := helper.StartStdInput()\n\tif err != nil {\n\t\treturn SecretConfig{}, err\n\t}\n\n\treturn SecretConfig{\n\t\tName: b.Name,\n\t\tNamespace: b.NameSpace,\n\t\tUser: userName,\n\t\tPwd: password,\n\t}, nil\n}", "func (conf *Configuration) Copy() *Configuration {\n\tvar dup Configuration\n\n\t_ = Copy(&dup, conf)\n\n\tdup.TestMode = conf.TestMode\n\n\treturn &dup\n}", "func (c *IssuerConfig) Copy() *IssuerConfig {\n\td := new(IssuerConfig)\n\tcopier.Copy(d, c)\n\treturn d\n}", "func (in *StickinessConfig) DeepCopy() *StickinessConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StickinessConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConsoleConfig) DeepCopy() *ConsoleConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConsoleConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KVMConfig) DeepCopy() *KVMConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KVMConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EncryptionConfiguration) DeepCopy() *EncryptionConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EncryptionConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ToolchainConfig) DeepCopy() *ToolchainConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ToolchainConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *VaultSecretReference) DeepCopy() *VaultSecretReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VaultSecretReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DatabaseSecretEngineConfig) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (in *SharedMemoryServerConfig) DeepCopy() *SharedMemoryServerConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SharedMemoryServerConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MongoDBConfiguration) DeepCopy() *MongoDBConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MongoDBConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (cc *ConnConfig) Copy() *ConnConfig {\n\tnewConfig := new(ConnConfig)\n\t*newConfig = *cc\n\tnewConfig.Config = *newConfig.Config.Copy()\n\treturn newConfig\n}", "func ConfigClone(c *tls.Config,) *tls.Config", "func (in *DopplerSecretSpec) DeepCopy() *DopplerSecretSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DopplerSecretSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SandboxConfig) DeepCopy() *SandboxConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SandboxConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (config Config) Copy() Config {\n\tnewConfig := Config{\n\t\tNum: config.Num,\n\t\tShards: config.Shards,\n\t\tGroups: copyConfigGroups(config.Groups),\n\t}\n\treturn newConfig\n}", "func (in *MemberSecret) DeepCopy() *MemberSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MemberSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (b *Bot) DumpConfig() error {\n\treturn b.conf.ToFile(\"\")\n}", "func (c *SecretConfig) ToSecret() corev1.Secret {\n\treturn corev1.Secret{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: ApiVersion,\n\t\t\tKind: KindSecret,\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: c.Name,\n\t\t\tNamespace: c.Namespace,\n\t\t},\n\t\tStringData: map[string]string{\n\t\t\t\"password\": c.Pwd,\n\t\t\t\"user\": c.User,\n\t\t},\n\t\tType: \"Opaque\",\n\t}\n}", "func (in *WebhookSecret) DeepCopy() *WebhookSecret {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WebhookSecret)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ShieldedInstanceConfig) DeepCopy() *ShieldedInstanceConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ShieldedInstanceConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CaptchaConfig) DeepCopy() *CaptchaConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CaptchaConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (opts OpenIDConnectWellKnownConfiguration) Copy() (optsCopy OpenIDConnectWellKnownConfiguration) {\n\toptsCopy = OpenIDConnectWellKnownConfiguration{\n\t\tOAuth2WellKnownConfiguration: opts.OAuth2WellKnownConfiguration.Copy(),\n\t\tOpenIDConnectDiscoveryOptions: opts.OpenIDConnectDiscoveryOptions,\n\t}\n\n\tif opts.OpenIDConnectFrontChannelLogoutDiscoveryOptions != nil {\n\t\toptsCopy.OpenIDConnectFrontChannelLogoutDiscoveryOptions = &OpenIDConnectFrontChannelLogoutDiscoveryOptions{}\n\t\t*optsCopy.OpenIDConnectFrontChannelLogoutDiscoveryOptions = *opts.OpenIDConnectFrontChannelLogoutDiscoveryOptions\n\t}\n\n\tif opts.OpenIDConnectBackChannelLogoutDiscoveryOptions != nil {\n\t\toptsCopy.OpenIDConnectBackChannelLogoutDiscoveryOptions = &OpenIDConnectBackChannelLogoutDiscoveryOptions{}\n\t\t*optsCopy.OpenIDConnectBackChannelLogoutDiscoveryOptions = *opts.OpenIDConnectBackChannelLogoutDiscoveryOptions\n\t}\n\n\tif opts.OpenIDConnectSessionManagementDiscoveryOptions != nil {\n\t\toptsCopy.OpenIDConnectSessionManagementDiscoveryOptions = &OpenIDConnectSessionManagementDiscoveryOptions{}\n\t\t*optsCopy.OpenIDConnectSessionManagementDiscoveryOptions = *opts.OpenIDConnectSessionManagementDiscoveryOptions\n\t}\n\n\tif opts.OpenIDConnectRPInitiatedLogoutDiscoveryOptions != nil {\n\t\toptsCopy.OpenIDConnectRPInitiatedLogoutDiscoveryOptions = &OpenIDConnectRPInitiatedLogoutDiscoveryOptions{}\n\t\t*optsCopy.OpenIDConnectRPInitiatedLogoutDiscoveryOptions = *opts.OpenIDConnectRPInitiatedLogoutDiscoveryOptions\n\t}\n\n\tif opts.OpenIDConnectPromptCreateDiscoveryOptions != nil {\n\t\toptsCopy.OpenIDConnectPromptCreateDiscoveryOptions = &OpenIDConnectPromptCreateDiscoveryOptions{}\n\t\t*optsCopy.OpenIDConnectPromptCreateDiscoveryOptions = *opts.OpenIDConnectPromptCreateDiscoveryOptions\n\t}\n\n\tif opts.OpenIDConnectClientInitiatedBackChannelAuthFlowDiscoveryOptions != nil {\n\t\toptsCopy.OpenIDConnectClientInitiatedBackChannelAuthFlowDiscoveryOptions = &OpenIDConnectClientInitiatedBackChannelAuthFlowDiscoveryOptions{}\n\t\t*optsCopy.OpenIDConnectClientInitiatedBackChannelAuthFlowDiscoveryOptions = *opts.OpenIDConnectClientInitiatedBackChannelAuthFlowDiscoveryOptions\n\t}\n\n\tif opts.OpenIDConnectJWTSecuredAuthorizationResponseModeDiscoveryOptions != nil {\n\t\toptsCopy.OpenIDConnectJWTSecuredAuthorizationResponseModeDiscoveryOptions = &OpenIDConnectJWTSecuredAuthorizationResponseModeDiscoveryOptions{}\n\t\t*optsCopy.OpenIDConnectJWTSecuredAuthorizationResponseModeDiscoveryOptions = *opts.OpenIDConnectJWTSecuredAuthorizationResponseModeDiscoveryOptions\n\t}\n\n\tif opts.OpenIDFederationDiscoveryOptions != nil {\n\t\toptsCopy.OpenIDFederationDiscoveryOptions = &OpenIDFederationDiscoveryOptions{}\n\t\t*optsCopy.OpenIDFederationDiscoveryOptions = *opts.OpenIDFederationDiscoveryOptions\n\t}\n\n\treturn optsCopy\n}", "func (in *CASignedConfig) DeepCopy() *CASignedConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CASignedConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c Configuration) Clone() Configuration {\n\treturn Configuration{\n\t\tEDATool: c.EDATool,\n\t\tInputFile: c.InputFile,\n\t\tOutputFile: c.OutputFile,\n\t\tLastUpdated: c.LastUpdated,\n\t}\n}", "func (in *ConfigConnectorConfig) DeepCopy() *ConfigConnectorConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConfigConnectorConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretReference) DeepCopy() *SecretReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretReference) DeepCopy() *SecretReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretReference) DeepCopy() *SecretReference {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretReference)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *KVConfiguration) DeepCopy() *KVConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KVConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretRef) DeepCopy() *SecretRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretRef) DeepCopy() *SecretRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *SecretRef) DeepCopy() *SecretRef {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SecretRef)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *MariaDBConfiguration) DeepCopy() *MariaDBConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MariaDBConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ConnectionPoolSettings) DeepCopy() *ConnectionPoolSettings {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ConnectionPoolSettings)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ShuffleServerConfig) DeepCopy() *ShuffleServerConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ShuffleServerConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *Config) Copy() *Config {\n\tconfigCopy := &Config{\n\t\tFilter: c.Filter,\n\t\tIncludeMsgTypes: util.CopyStringSlice(c.IncludeMsgTypes),\n\t\tSubject: c.Subject,\n\t}\n\tif c.Email != nil {\n\t\tconfigCopy.Email = &EmailNotifierConfig{\n\t\t\tEmails: util.CopyStringSlice(c.Email.Emails),\n\t\t}\n\t}\n\tif c.Chat != nil {\n\t\tconfigCopy.Chat = &ChatNotifierConfig{\n\t\t\tRoomID: c.Chat.RoomID,\n\t\t}\n\t}\n\tif c.PubSub != nil {\n\t\tconfigCopy.PubSub = &PubSubNotifierConfig{\n\t\t\tTopic: c.PubSub.Topic,\n\t\t}\n\t}\n\tif c.Monorail != nil {\n\t\tconfigCopy.Monorail = &MonorailNotifierConfig{\n\t\t\tProject: c.Monorail.Project,\n\t\t\tOwner: c.Monorail.Owner,\n\t\t\tCC: util.CopyStringSlice(c.Monorail.CC),\n\t\t\tComponents: util.CopyStringSlice(c.Monorail.Components),\n\t\t\tLabels: util.CopyStringSlice(c.Monorail.Labels),\n\t\t}\n\t}\n\treturn configCopy\n}", "func (in *ServerConfig) DeepCopy() *ServerConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ServerConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *config) WithPassword(password string) Config {\n\tc.password = password\n\treturn c\n}", "func (in *KVMConfigList) DeepCopy() *KVMConfigList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KVMConfigList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *DatabaseSecretEngineConfigList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "func (conf *ThrapConfig) Clone() *ThrapConfig {\n\tif conf == nil {\n\t\treturn nil\n\t}\n\n\tc := &ThrapConfig{\n\t\tVCS: make(map[string]*VCSConfig, len(conf.VCS)),\n\t\tOrchestrator: make(map[string]*OrchestratorConfig, len(conf.Orchestrator)),\n\t\tRegistry: make(map[string]*RegistryConfig, len(conf.Registry)),\n\t\tSecrets: make(map[string]*SecretsConfig, len(conf.Secrets)),\n\t}\n\n\tfor k, v := range conf.VCS {\n\t\tc.VCS[k] = v.Clone()\n\t}\n\tfor k, v := range conf.Orchestrator {\n\t\tc.Orchestrator[k] = v.Clone()\n\t}\n\tfor k, v := range conf.Registry {\n\t\tc.Registry[k] = v.Clone()\n\t}\n\tfor k, v := range conf.Secrets {\n\t\tc.Secrets[k] = v.Clone()\n\t}\n\n\treturn conf\n}", "func (cfg *appConfig) copy() appConfig { return *cfg }", "func (in *DiamondConfig) DeepCopy() *DiamondConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DiamondConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *ObjectStorageConfig) DeepCopy() *ObjectStorageConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ObjectStorageConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *Config) Copy() *Config {\n\tc.Lock()\n\tdefer c.Unlock()\n\tn := &Config{\n\t\tm: make(map[string]interface{}),\n\t}\n\tfor key, value := range c.m {\n\t\tn.m[key] = value\n\t}\n\treturn n\n}", "func (in *VaultSecretList) DeepCopy() *VaultSecretList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VaultSecretList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggingConfiguration) DeepCopy() *LoggingConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *LoggingConfiguration) DeepCopy() *LoggingConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoggingConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (co *ConfigOptions) Clone() (*ConfigOptions, error) {\n\tout, err := yaml.Marshal(co)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnewCo := &ConfigOptions{}\n\terr = yaml.Unmarshal(out, newCo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newCo, nil\n}", "func (in *SharedMemoryStoreConfig) DeepCopy() *SharedMemoryStoreConfig {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SharedMemoryStoreConfig)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *EKSCFConfiguration) DeepCopy() *EKSCFConfiguration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EKSCFConfiguration)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Configuration) DeepCopy() *Configuration {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Configuration)\n\tin.DeepCopyInto(out)\n\treturn out\n}" ]
[ "0.60144943", "0.5966961", "0.5891478", "0.5733064", "0.5586271", "0.55468184", "0.55379814", "0.55241823", "0.5468137", "0.54423493", "0.5412706", "0.53246456", "0.53073645", "0.52828056", "0.52819806", "0.527624", "0.525599", "0.5251909", "0.5250702", "0.52440095", "0.5237304", "0.5223912", "0.52163714", "0.51898414", "0.5180599", "0.5171406", "0.5162189", "0.5154262", "0.51525426", "0.51477784", "0.5121849", "0.5100011", "0.5076809", "0.50718963", "0.506771", "0.50631225", "0.5056182", "0.505489", "0.505489", "0.505216", "0.5041107", "0.5008642", "0.50072306", "0.49966687", "0.49919817", "0.49893504", "0.4968937", "0.4942438", "0.4940173", "0.49357915", "0.49304864", "0.49125263", "0.49085802", "0.48927593", "0.4884021", "0.48762038", "0.4874974", "0.48644447", "0.4859461", "0.48588717", "0.48520452", "0.4838714", "0.48381528", "0.48320577", "0.48238185", "0.48199207", "0.48192886", "0.48161247", "0.48074582", "0.4802351", "0.47781578", "0.4774746", "0.47638658", "0.47513387", "0.47513387", "0.47513387", "0.47473267", "0.4740429", "0.4740429", "0.4740429", "0.4735441", "0.4728189", "0.472274", "0.4714049", "0.47060144", "0.4705047", "0.4698211", "0.46963742", "0.46867976", "0.46863317", "0.46732464", "0.46679264", "0.46440026", "0.4635198", "0.46248907", "0.46248907", "0.462217", "0.46144766", "0.4614418", "0.46057272" ]
0.83404136
0
IsOk check response code is equal to 200
Проверка кода ответа на равенство 200
func (r *Response) IsOk() bool { return r.Code == ok }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (resp *Response) OK() bool {\n\treturn resp.StatusCode < 400\n}", "func (w *responseWrapper) IsOK() bool {\n\treturn w.status == 200\n}", "func (resp *Response) Ok() bool {\n\treturn resp.OK()\n}", "func (s *APIStatusResponse) OK() bool {\n\treturn s.StatusCode == \"ok\"\n}", "func isOK(statusCode int) bool {\n\treturn statusCode < minHTTPErrorStatusCode\n}", "func isResponseSuccess(resp *http.Response) bool {\n\tif resp == nil {\n\t\treturn false\n\t}\n\tstatusCode := resp.StatusCode\n\n\treturn statusCode >= http.StatusOK && statusCode <= 299\n}", "func (cr *ClientResponse) Ok() bool {\n\treturn cr.ok\n}", "func (c *Client) IsOK() bool {\n\turl := fmt.Sprintf(\"%s/v1/sys/health\", c.addr)\n\n\tr, _ := http.NewRequest(http.MethodGet, url, nil)\n\t//r.Header.Add(\"X-Vault-Token\", \"root\")\n\n\tresp, err := http.DefaultClient.Do(r)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (s statusCode) Successful() bool { return s >= 200 && s < 300 }", "func (r XMLResponse) IsOK() bool {\n\treturn r.Status == ErrorOK\n}", "func (ir *IndexResponse) IsOk() bool {\n\treturn ir.Ok\n}", "func (vr *VersionResponse) IsOk() bool {\n\treturn len(vr.version) > 0\n}", "func (er *ExitResponse) IsOk() bool {\n\treturn er.Ok\n}", "func (res *Response) isSuccessfulResponse() bool {\n\treturn res.IsSuccessfulResponse\n}", "func (h Health) Ok() bool {\n\treturn h.success\n}", "func (o *WebSvmGetOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func alwaysOk(http.ResponseWriter, *http.Request, int) (int, error) { return 0, nil }", "func (sr *SearchResponse) IsOk() bool {\n\t// Empty responses (meaning no matches) are not errors...\n\treturn len(sr.Documents) > 0\n}", "func (o *GetMeOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func OK(r *http.ResponseWriter) error {\n\tresponse := *r\n\tresponse.WriteHeader(200)\n\treturn nil\n}", "func (resp *Response) StatusOk(w http.ResponseWriter) {\n\tresp.Ok = true\n\twrite(resp, w)\n}", "func (dr *DeleteResponse) IsOk() bool {\n\treturn dr.ok\n}", "func (res *ClientHTTPResponse) CheckOKResponse(okResponses []int) {\n\tfor _, okResponse := range okResponses {\n\t\tif res.rawResponse.StatusCode == okResponse {\n\t\t\treturn\n\t\t}\n\t}\n\n\tres.req.Logger.Warn(\"Unknown response status code\",\n\t\tzap.Int(\"status code\", res.rawResponse.StatusCode),\n\t)\n}", "func (o *ApiResponse) GetCodeOk() (int32, bool) {\n\tif o == nil || o.Code == nil {\n\t\tvar ret int32\n\t\treturn ret, false\n\t}\n\treturn *o.Code, true\n}", "func Ok(msg string) *Response {\n\treturn &Response{\n\t\tCode: http.StatusOK,\n\t\tMessage: msg,\n\t\tData: nil,\n\t}\n}", "func IsSuccessHTTPRequest(t *testing.T, actual *http.Response, err error) bool {\n\tif err != nil {\n\t\tt.Error(\"Unexpected error occered\")\n\t\treturn false\n\t}\n\texpected := http.StatusOK\n\tif actual.StatusCode != expected {\n\t\tt.Errorf(\"Status code error. Expected %v, but got %v\", expected, actual.StatusCode)\n\t\treturn false\n\t}\n\treturn true\n}", "func CheckCode(res *http.Response) {\n\tif res.StatusCode != 200 {\n\t\tlog.Fatalf(\"status code err: %d %s\", res.StatusCode, res.Status)\n\t}\n}", "func (o *ValidateUsingPUTOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func IsSuccess(code int) bool {\n\treturn http.StatusOK <= code && code < http.StatusMultipleChoices\n}", "func (r *Response) IsSuccess() bool {\n\treturn (r.Code == http.StatusOK || r.Code == http.StatusConflict)\n}", "func (fault SOAPFault) Ok() bool {\n\treturn fault.Code == \"\"\n}", "func (o *VerifyConnectionOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func requestOk(w http.ResponseWriter, r *http.Request) bool {\n\tif r.Body == nil {\n\t\thttp.Error(w, \"Please send a request body\", 400)\n\t\treturn false\n\t}\n\treturn true\n}", "func (c *requestContext) ok() {\n\tc.Writer.Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\tc.Writer.WriteHeader(200)\n\tfmt.Fprintln(c.Writer, \"OK\")\n}", "func (r *Responder) OK() { r.write(http.StatusOK) }", "func (o *ApiResponse) GetCodeOk() (*int32, bool) {\n\tif o == nil || IsNil(o.Code) {\n\t\treturn nil, false\n\t}\n\treturn o.Code, true\n}", "func Is2xx(status int) bool {\n\treturn status >= 200 && status < 300\n}", "func checkResponse(t *testing.T, resp *http.Response, err error) {\n\tassert.Nil(t, err)\n\tassert.Equal(t, 200, resp.StatusCode)\n}", "func CheckOKResponse(r *http.Response) error {\n\tisOK := r.StatusCode >= 200 && r.StatusCode <= 299\n\tif !isOK {\n\t\treturn errors.New(\"response error with http status: \"+r.Status, errors.Internal)\n\t}\n\treturn nil\n}", "func (o *ObjectsGetOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (r *GetReservationRS) Ok() bool {\n\treturn len(r.Errors.Error) <= 0\n}", "func is200(t *testing.T, ts *httptest.Server, path string) []byte {\n\tres, body := checkGet(t, ts, path)\n\tif res.StatusCode != 200 {\n\t\tt.Fatalf(\"Expected status %d, got %d. Path: %s\", 200, res.StatusCode, path)\n\t}\n\treturn body\n}", "func ok(w http.ResponseWriter, r *http.Request, c *Context) {\n\tfmt.Fprintln(w, \"ok\")\n}", "func (r *Reply) Ok() *Reply {\n\treturn r.Status(http.StatusOK)\n}", "func (o *GetRequestTrackerOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (r *BaseStandard) IsOk() bool {\n\tif r.AuditInfo.StatusCode < http.StatusOK || r.AuditInfo.StatusCode >= http.StatusMultipleChoices {\n\t\treturn false\n\t}\n\n\tif !r.HasItems() {\n\t\treturn false\n\t}\n\n\tif len(r.AuditInfo.Errors.Items) > 0 {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (r Response) OK(code string, payload Payload, header ...ResponseHeader) {\n\tr.Response(code, http.OK, payload, header...)\n}", "func (o *UploadResponse) HasOk() bool {\n\tif o != nil && o.Ok != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MetroclusterSvmGetOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *WebModifyOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *NodesGetOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *PcloudImagesGetallOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (a *App) Ok(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\tlogerr(w.Write(randomByteSlice(10, \"OK\", \"0123456789abcdef\")))\n}", "func (o *IpspacesGetOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *WebSvmGetOK) IsSuccess() bool {\n\treturn true\n}", "func (o *SoftwarePackageGetOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *OpenAPIDiscoveryOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *DNSGetOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func Ok(c *routing.Context, msg string, service string) error {\n\tResponse(c, msg, 200, service, \"application/json\")\n\treturn nil\n}", "func (o *UserGetMeOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func IsHttpStatusOK(statusCode int) bool {\n\treturn statusCode >= http.StatusOK && statusCode < http.StatusMultipleChoices\n}", "func healthcheckok(writer http.ResponseWriter, request *http.Request) {\n\twriter.WriteHeader(200)\n}", "func (o *GetAlertsOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *VscanOnDemandGetOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func validate(status int, _ string) bool {\n\treturn status == 200\n}", "func (suite *HandlerTestSuite) assertSuccessfulResponse(response events.APIGatewayProxyResponse) {\n\tsuite.True(response.StatusCode >= 200 && response.StatusCode <= 299)\n}", "func (o *GetPublishersOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *SyncProjectsPrincipalsUsingPOSTOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *GetRunDownstreamLineageOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *GetCertificateInfoOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (c *CountHandler) OkResponse(resp http.ResponseWriter, req *http.Request) {\n\tc.numRequests++\n\tresp.WriteHeader(http.StatusOK)\n\tresp.Write([]byte(\"{\\\"stat\\\": \\\"ok\\\"}\"))\n}", "func ExpectOK(res *http.Response, msg string) error {\n\treturn ExpectStatus(res, http.StatusOK, msg)\n}", "func (o *GetDeploymentActionsUsingGET2OK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *DescribeServerOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *GetVersionOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func Is2xx(code int) bool {\n\treturn (code >= 200) && (code <= 299)\n}", "func TestServerResponseOk(t *testing.T) {\n\ttestServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(`{}`))\n\t}))\n\tresult, err := sendMessage(testServer.URL, \"test@email.com\", \"test\")\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif result != false {\n\t\tt.Fail()\n\t}\n}", "func successStatus(status int) bool {\n\treturn status >= 200 && status <= 399\n}", "func (o *ErrorResponseWeb) GetCodeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Code, true\n}", "func (o *WebModifyDefault) IsSuccess() bool {\n\treturn o._statusCode/100 == 2\n}", "func (result *HTTPResult) Successful() bool {\n\treturn result.Status < 400\n}", "func statusGood(status int) bool {\n\treturn status >= 200 && status <= 299\n}", "func (o *SyncPerspectiveGroupUsingPOST2OK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (req *Request) OK(body string) {\n\treq.Reply(http.StatusOK, body)\n}", "func (o *GetProjectOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *UploadResponse) GetOkOk() (*bool, bool) {\n\tif o == nil || o.Ok == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Ok, true\n}", "func (o *SignupOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func OK(condition bool, statusCode int, message string, args ...interface{}) {\n\tif err := ok(condition, statusCode, message, args...); err != nil {\n\t\tpanic(err)\n\t}\n}", "func (o *SearchAclsOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func WaitForHTTPStatusOk(ctx context.Context, transport http.RoundTripper, urltocheck string) error {\n\tcli := &http.Client{\n\t\tTransport: transport,\n\t\tTimeout: 10 * time.Second,\n\t}\n\n\treq, err := http.NewRequest(\"GET\", urltocheck, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn wait.PollImmediateUntil(time.Second, func() (bool, error) {\n\t\tresp, err := cli.Do(req)\n\t\tif err, ok := err.(*url.Error); ok {\n\t\t\tif err, ok := err.Err.(*net.OpError); ok {\n\t\t\t\tif err, ok := err.Err.(*os.SyscallError); ok {\n\t\t\t\t\tif err.Err == syscall.ENETUNREACH {\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\tif err.Timeout() || err.Err == io.EOF || err.Err == io.ErrUnexpectedEOF {\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t}\n\t\tif err == io.EOF {\n\t\t\treturn false, nil\n\t\t}\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\treturn resp != nil && resp.StatusCode == http.StatusOK, nil\n\t}, ctx.Done())\n}", "func (o *GetV1AlertsOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *S3GroupGetOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *UnauthorizedErrorResponse) HasOk() bool {\n\tif o != nil && o.Ok != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ObjectsCreateOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func (o *ResponseEntity) GetStatusCodeOk() (*string, bool) {\n\tif o == nil || o.StatusCode == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StatusCode, true\n}", "func (o *GetLoadBalancerOK) IsCode(code int) bool {\n\treturn code == 200\n}", "func IsSuccess(statusCode int) bool {\n\treturn statusCode >= 200 && statusCode <= 299\n}", "func respondOk(writer http.ResponseWriter) {\n\twriter.WriteHeader(http.StatusOK)\n\twriter.Header().Set(\"Content-Type\", \"application/json\")\n\tio.WriteString(writer, `{ \"status\": \"OK\" }`)\n}", "func (o *WebModifyOK) IsSuccess() bool {\n\treturn true\n}", "func isSuccessHTTPResponse(resp *http.Response, err error) (isSuccess bool, realError error) {\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif resp != nil {\n\t\t// HTTP 2xx suggests a successful response\n\t\tif 199 < resp.StatusCode && resp.StatusCode < 300 {\n\t\t\treturn true, nil\n\t\t}\n\n\t\treturn false, fmt.Errorf(\"failed with HTTP status code %d\", resp.StatusCode)\n\t}\n\n\t// This shouldn't happen, it only ensures all exceptions are handled.\n\treturn false, fmt.Errorf(\"failed with unknown error\")\n}" ]
[ "0.7763328", "0.7720846", "0.74847406", "0.7463899", "0.7392119", "0.73865634", "0.7201045", "0.7040394", "0.70257586", "0.6942052", "0.68642926", "0.68560714", "0.677577", "0.67510307", "0.6729229", "0.671001", "0.66298383", "0.65708536", "0.6570777", "0.65460277", "0.65407306", "0.651619", "0.6503107", "0.6490824", "0.64867175", "0.64851964", "0.6485109", "0.6484076", "0.64515734", "0.6422833", "0.6417678", "0.6414394", "0.64009124", "0.6399303", "0.63981694", "0.639475", "0.6380017", "0.63786733", "0.63702434", "0.6363522", "0.6356344", "0.63436157", "0.6331071", "0.6330961", "0.63087136", "0.6289296", "0.6261871", "0.626041", "0.6258926", "0.62547654", "0.6230273", "0.6221629", "0.6220299", "0.62160844", "0.62149924", "0.6207108", "0.61969", "0.61938864", "0.61916226", "0.6190963", "0.6189018", "0.6183937", "0.6171287", "0.6171103", "0.6163916", "0.615282", "0.6143739", "0.6136825", "0.613518", "0.61339366", "0.61320364", "0.61201096", "0.6120085", "0.6118192", "0.6117659", "0.61100894", "0.6109676", "0.61019605", "0.60953313", "0.6091407", "0.60899293", "0.60859907", "0.6084041", "0.6082306", "0.6076544", "0.60745907", "0.6072186", "0.6071362", "0.60692644", "0.6065048", "0.6056482", "0.60531807", "0.6052673", "0.6041824", "0.60416967", "0.60414404", "0.60375583", "0.6036582", "0.6024362", "0.60219556" ]
0.7804289
0
Deprecated: Use SyncLocationReq.ProtoReflect.Descriptor instead.
Устарело: используйте SyncLocationReq.ProtoReflect.Descriptor вместо этого.
func (*SyncLocationReq) Descriptor() ([]byte, []int) { return file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{0} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*UpdateLocationRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_protobuf_spec_connection_user_v1_proto_rawDescGZIP(), []int{2}\n}", "func (*SyncLocationRsp) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{1}\n}", "func (*GetLocationRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_protobuf_spec_connection_user_v1_proto_rawDescGZIP(), []int{3}\n}", "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{16}\n}", "func (*UpdatePermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{9}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{12}\n}", "func (*UpdateDomainMappingRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{40}\n}", "func (*SyncRequest) Descriptor() ([]byte, []int) {\n\treturn file_recordwants_proto_rawDescGZIP(), []int{12}\n}", "func (*SyncRequest) Descriptor() ([]byte, []int) {\n\treturn file_ysync_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateTelemetryReportedRequest) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{29}\n}", "func (*PatchAnnotationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{4}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*MemberReceiveAddressUpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{86}\n}", "func (*SyncRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{19}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{6}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_recordwants_proto_rawDescGZIP(), []int{6}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{5}\n}", "func (*UpdateContactRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_essentialcontacts_v1_service_proto_rawDescGZIP(), []int{6}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{7}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_Ultimate_Super_WebDev_Corp_gateway_services_customer_customer_proto_rawDescGZIP(), []int{4}\n}", "func (*UpdateModelRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_automl_v1_service_proto_rawDescGZIP(), []int{14}\n}", "func (*UpdateEndpointRequest) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{14}\n}", "func (*PatchConceptsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{34}\n}", "func (*GetBlockLocalPathInfoRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{6}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_patrol_proto_rawDescGZIP(), []int{10}\n}", "func (*PatchAnnotationsStatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{5}\n}", "func (*MemberAddressUpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{14}\n}", "func (*CMsgGCPlayerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{117}\n}", "func (*ProvideValidationFeedbackRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_addressvalidation_v1_address_validation_service_proto_rawDescGZIP(), []int{2}\n}", "func (*RegistrationUpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_registration_proto_rawDescGZIP(), []int{19}\n}", "func (*LocatePhoneRequest) Descriptor() ([]byte, []int) {\n\treturn file_contacts_phones_proto_rawDescGZIP(), []int{3}\n}", "func (*MeasureDistanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_coolenv_proto_rawDescGZIP(), []int{3}\n}", "func (*UpdateFriendStatusReq) Descriptor() ([]byte, []int) {\n\treturn file_v1_friend_friend_proto_rawDescGZIP(), []int{2}\n}", "func (*SyncTimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_worker_v1_device_state_proto_rawDescGZIP(), []int{2}\n}", "func (*BatchUpdateReferencesRequest_Request) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_icas_icas_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{5}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_app_config_agent_cmd_grpcserver_proto_api_app_config_proto_rawDescGZIP(), []int{17}\n}", "func (*UpdateEndpointApiRequest) Descriptor() ([]byte, []int) {\n\treturn file_endpoint_api_proto_rawDescGZIP(), []int{5}\n}", "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_toit_api_auth_proto_rawDescGZIP(), []int{1}\n}", "func (*UpdatePermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_protodef_user_user_proto_rawDescGZIP(), []int{16}\n}", "func (*UpdateEntityRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataplex_v1_metadata_proto_rawDescGZIP(), []int{1}\n}", "func (*PatchConceptLanguagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{50}\n}", "func (*TelemetryRequest) Descriptor() ([]byte, []int) {\n\treturn file_interservice_license_control_license_control_proto_rawDescGZIP(), []int{11}\n}", "func (*RouteLookupRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_lookup_v1_rls_proto_rawDescGZIP(), []int{0}\n}", "func (*OffsetRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_carbon_proto_rawDescGZIP(), []int{1}\n}", "func (*UpdateRefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_auth_auth_proto_rawDescGZIP(), []int{15}\n}", "func (*UpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_internal_proto_crypto_proto_rawDescGZIP(), []int{8}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_interservice_license_control_license_control_proto_rawDescGZIP(), []int{9}\n}", "func (*PatchKeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{74}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*TaskUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_protobuf_v1_task_proto_rawDescGZIP(), []int{2}\n}", "func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{6}\n}", "func (*PatchTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{154}\n}", "func (*RefreshServiceAclRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshAuthorizationPolicyProtocol_proto_rawDescGZIP(), []int{0}\n}", "func (*LookupRequest) Descriptor() ([]byte, []int) {\n\treturn file_authzed_api_v0_acl_service_proto_rawDescGZIP(), []int{10}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_user_proto_rawDescGZIP(), []int{4}\n}", "func (*UpdatePhoneRequest) Descriptor() ([]byte, []int) {\n\treturn file_contacts_phones_proto_rawDescGZIP(), []int{7}\n}", "func (*GetCollectorRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{163}\n}", "func (*ListPlannableLocationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateTaskRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_runtime_v1_shim_v1_shim_proto_rawDescGZIP(), []int{15}\n}", "func (*ModifyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{10}\n}", "func (*QueryPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_permission_pb_request_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateCheckRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_check_api_ocp_check_api_proto_rawDescGZIP(), []int{8}\n}", "func (*CheckRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicecontrol_v1_service_controller_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateFriendStatusRsp) Descriptor() ([]byte, []int) {\n\treturn file_v1_friend_friend_proto_rawDescGZIP(), []int{3}\n}", "func (*UpdateNetworkRequest) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_iam_v1_service_proto_rawDescGZIP(), []int{8}\n}", "func (*GetBlockLocalPathInfoResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{7}\n}", "func (*DescribePermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{6}\n}", "func (*CodeLensResolveRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{33}\n}", "func (*TelemetryRequest) Descriptor() ([]byte, []int) {\n\treturn file_automate_gateway_api_telemetry_telemetry_proto_rawDescGZIP(), []int{0}\n}", "func (*DeliveryVehicleLocation) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_fleetengine_delivery_v1_common_proto_rawDescGZIP(), []int{1}\n}", "func (*UpdateServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{7}\n}", "func (*GetServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{6}\n}", "func (*LookupRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_ip_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgGCNotificationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{113}\n}", "func (*GetRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_comments_proto_rawDescGZIP(), []int{3}\n}", "func (*RefreshNamenodesRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{2}\n}", "func (*CheckPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_permission_pb_request_proto_rawDescGZIP(), []int{2}\n}", "func (*GetLocationResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_protobuf_spec_connection_user_v1_proto_rawDescGZIP(), []int{4}\n}", "func (*ResolveRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{1}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{5}\n}", "func (*UpdateVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{13}\n}", "func (*MemberLevelUpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{50}\n}", "func (*MemberTaskUpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{122}\n}", "func (*UpdateConversationRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{8}\n}", "func (*BatchUpdateReferencesRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_icas_icas_proto_rawDescGZIP(), []int{1}\n}", "func (*MyScopesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{109}\n}", "func (*CBroadcast_WatchBroadcast_Request) Descriptor() ([]byte, []int) {\n\treturn file_steammessages_broadcast_steamclient_proto_rawDescGZIP(), []int{7}\n}", "func (*ModelControlRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_proto_rawDescGZIP(), []int{4}\n}", "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_auth_auth_proto_rawDescGZIP(), []int{6}\n}", "func (*SignalRequest) Descriptor() ([]byte, []int) {\n\treturn file_cmd_server_grpc_proto_sfu_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateRemoteMirrorRequest) Descriptor() ([]byte, []int) {\n\treturn file_remote_proto_rawDescGZIP(), []int{0}\n}", "func (*Locations) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{22}\n}", "func (*PatchWorkflowsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{131}\n}", "func (*MemberUpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{5}\n}", "func (*UnaryMapMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{10}\n}", "func (*WatchRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{25}\n}", "func (*ReferenceRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{141}\n}", "func (*FsyncRequest) Descriptor() ([]byte, []int) {\n\treturn file_IOService_proto_rawDescGZIP(), []int{56}\n}", "func (*FeedbackRequest) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{10}\n}" ]
[ "0.71103185", "0.69038934", "0.6815616", "0.6785577", "0.67049074", "0.66889256", "0.6613836", "0.66054076", "0.65946", "0.65917665", "0.6582088", "0.65695715", "0.6560337", "0.6535074", "0.65338737", "0.65247077", "0.65170616", "0.6483615", "0.64714944", "0.64662427", "0.6456886", "0.64484286", "0.6445085", "0.6440484", "0.643664", "0.6436235", "0.64324015", "0.6431758", "0.64295584", "0.642198", "0.6421411", "0.64174163", "0.6416304", "0.63977665", "0.63900965", "0.6387687", "0.6386571", "0.63825965", "0.6374931", "0.6367375", "0.6364737", "0.63547707", "0.6353727", "0.6353155", "0.6351243", "0.63476485", "0.6344454", "0.634137", "0.6337473", "0.6337249", "0.63332945", "0.6329875", "0.63260186", "0.63150734", "0.63125783", "0.63102835", "0.63077265", "0.63076824", "0.63054395", "0.6303244", "0.630058", "0.6293954", "0.6291491", "0.6284448", "0.62817305", "0.62751764", "0.6271683", "0.62706834", "0.62680095", "0.626329", "0.6263225", "0.62603605", "0.62598467", "0.62565595", "0.6254934", "0.62508035", "0.6249023", "0.6246905", "0.6245876", "0.6243899", "0.6235574", "0.6233067", "0.62289417", "0.6224867", "0.6224783", "0.6224115", "0.6222461", "0.62200356", "0.6218277", "0.62176937", "0.6217214", "0.62167656", "0.6216338", "0.62147206", "0.6211842", "0.6208964", "0.62086654", "0.6207624", "0.62056744", "0.62056166" ]
0.7409314
0
Deprecated: Use SyncLocationRsp.ProtoReflect.Descriptor instead.
Устарело: используйте SyncLocationRsp.ProtoReflect.Descriptor вместо этого.
func (*SyncLocationRsp) Descriptor() ([]byte, []int) { return file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{1} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*SyncLocationReq) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateFriendStatusRsp) Descriptor() ([]byte, []int) {\n\treturn file_v1_friend_friend_proto_rawDescGZIP(), []int{3}\n}", "func (*RefreshResponse) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{17}\n}", "func (DeliveryVehicleLocationSensor) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_maps_fleetengine_delivery_v1_common_proto_rawDescGZIP(), []int{0}\n}", "func (*GetRsp) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{1}\n}", "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{16}\n}", "func (*ClusterRsp) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{8}\n}", "func (*GroupRsp) Descriptor() ([]byte, []int) {\n\treturn file_chatMsg_msg_proto_rawDescGZIP(), []int{6}\n}", "func (*CreateFriendRsp) Descriptor() ([]byte, []int) {\n\treturn file_v1_friend_friend_proto_rawDescGZIP(), []int{1}\n}", "func (*MemberReceiveAddressUpdateResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{87}\n}", "func (*GetLocationResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_protobuf_spec_connection_user_v1_proto_rawDescGZIP(), []int{4}\n}", "func (Diagnostic_Kind) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_api_servicemanagement_v1_resources_proto_rawDescGZIP(), []int{2, 0}\n}", "func (*DeliveryVehicleLocation) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_fleetengine_delivery_v1_common_proto_rawDescGZIP(), []int{1}\n}", "func (*ChangeInfoRsp) Descriptor() ([]byte, []int) {\n\treturn file_Auth_Auth_proto_rawDescGZIP(), []int{5}\n}", "func (*UpdateLocationRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_protobuf_spec_connection_user_v1_proto_rawDescGZIP(), []int{2}\n}", "func (*GetBlockLocalPathInfoResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{7}\n}", "func (EBroadcastWatchLocation) EnumDescriptor() ([]byte, []int) {\n\treturn file_steammessages_broadcast_steamclient_proto_rawDescGZIP(), []int{0}\n}", "func (RouteLookupRequest_Reason) EnumDescriptor() ([]byte, []int) {\n\treturn file_grpc_lookup_v1_rls_proto_rawDescGZIP(), []int{0, 0}\n}", "func (StatusMessage_Reference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1, 0}\n}", "func (Span_SpanKind) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*CMsgSetMapLocationStateResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{62}\n}", "func (*UpdateFriendRemarkRsp) Descriptor() ([]byte, []int) {\n\treturn file_v1_friend_friend_proto_rawDescGZIP(), []int{5}\n}", "func (*Locations) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{22}\n}", "func (LocationMetadata_LocationSource) EnumDescriptor() ([]byte, []int) {\n\treturn file_router_proto_rawDescGZIP(), []int{7, 0}\n}", "func (*RefreshCallQueueResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{1}\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (*SwitchKeeperRsp) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{6}\n}", "func (*GetLocationRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_protobuf_spec_connection_user_v1_proto_rawDescGZIP(), []int{3}\n}", "func (*PlannableLocation) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{2}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*StopBroadcastResponse) Descriptor() ([]byte, []int) {\n\treturn file_services_core_protobuf_servers_proto_rawDescGZIP(), []int{5}\n}", "func (*LocationLinks) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{23}\n}", "func (*RefreshNamenodesResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{3}\n}", "func (Span_Link_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{0, 3, 0}\n}", "func (*UpdateTelemetryReportedResponse) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{30}\n}", "func (LocationType) EnumDescriptor() ([]byte, []int) {\n\treturn file_determined_project_v1_project_proto_rawDescGZIP(), []int{0}\n}", "func (*CancelDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{8}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{15}\n}", "func (SocketAddress_Protocol) EnumDescriptor() ([]byte, []int) {\n\treturn file_envoy_config_core_v3_address_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*Diagnostic) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicemanagement_v1_resources_proto_rawDescGZIP(), []int{2}\n}", "func (*CMsgResetMapLocationsResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{64}\n}", "func (*RefreshServiceAclResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshAuthorizationPolicyProtocol_proto_rawDescGZIP(), []int{1}\n}", "func (SyncSubType) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_proto_global_Global_proto_rawDescGZIP(), []int{6}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*RouteLookupResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_lookup_v1_rls_proto_rawDescGZIP(), []int{1}\n}", "func (*RouteLegTravelAdvisory) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_routing_v2_route_proto_rawDescGZIP(), []int{2}\n}", "func (*RefreshCallQueueRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{0}\n}", "func (*GetDatanodeInfoResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{13}\n}", "func (RefType) EnumDescriptor() ([]byte, []int) {\n\treturn file_common_trace_common_proto_rawDescGZIP(), []int{1}\n}", "func (*MemberReceiveAddressUpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{86}\n}", "func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParamsResponse\n}", "func (*HelloRsp) Descriptor() ([]byte, []int) {\n\treturn file_helloword_proto_rawDescGZIP(), []int{1}\n}", "func (*AddPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{30}\n}", "func (*ProvideValidationFeedbackResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_addressvalidation_v1_address_validation_service_proto_rawDescGZIP(), []int{3}\n}", "func (*StopBroadcastRequest) Descriptor() ([]byte, []int) {\n\treturn file_services_core_protobuf_servers_proto_rawDescGZIP(), []int{4}\n}", "func (*RefreshServiceAclRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshAuthorizationPolicyProtocol_proto_rawDescGZIP(), []int{0}\n}", "func (*LocationMetadata) Descriptor() ([]byte, []int) {\n\treturn file_router_proto_rawDescGZIP(), []int{7}\n}", "func (*RouteLookupRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_lookup_v1_rls_proto_rawDescGZIP(), []int{0}\n}", "func (*ConsumableTrafficPolyline) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_fleetengine_v1_traffic_proto_rawDescGZIP(), []int{1}\n}", "func (*GetPeerInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{28}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{17}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (DnsRegMethod) EnumDescriptor() ([]byte, []int) {\n\treturn file_signalling_proto_rawDescGZIP(), []int{1}\n}", "func (*GetBlockLocalPathInfoRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{6}\n}", "func (*ListPlannableLocationsResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{1}\n}", "func (*ListUserFriendRsp) Descriptor() ([]byte, []int) {\n\treturn file_v1_friend_friend_proto_rawDescGZIP(), []int{7}\n}", "func (x *fastReflection_AddressStringToBytesResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_AddressStringToBytesResponse\n}", "func (*UpdateTelemetryReportedRequest) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{29}\n}", "func (Protocol) EnumDescriptor() ([]byte, []int) {\n\treturn file_github_com_ameliaikeda_protoc_gen_router_proto_router_proto_rawDescGZIP(), []int{0}\n}", "func (PolicyBasedRoute_Warnings_Code) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_networkconnectivity_v1_policy_based_routing_proto_rawDescGZIP(), []int{0, 3, 0}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*Location) Descriptor() ([]byte, []int) {\n\treturn file_clientToAppMgr_proto_rawDescGZIP(), []int{1}\n}", "func (*RouteLeg) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_routing_v2_route_proto_rawDescGZIP(), []int{4}\n}", "func (*LocatePhoneRequest) Descriptor() ([]byte, []int) {\n\treturn file_contacts_phones_proto_rawDescGZIP(), []int{3}\n}", "func (x *fastReflection_AddressBytesToStringResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_AddressBytesToStringResponse\n}", "func (*UpdateResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{13}\n}", "func (SpanLayer) EnumDescriptor() ([]byte, []int) {\n\treturn file_common_trace_common_proto_rawDescGZIP(), []int{2}\n}", "func (*SyncTagsEventRsp) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_user_SyncTagsEvent_proto_rawDescGZIP(), []int{1}\n}", "func (MsgSubType) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_proto_global_Global_proto_rawDescGZIP(), []int{5}\n}", "func LegacyLoadMessageDesc(t reflect.Type) protoreflect.MessageDescriptor {\n\treturn legacyLoadMessageDesc(t, \"\")\n}", "func (*GetCollectorRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{163}\n}", "func (SVC_Messages) EnumDescriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{4}\n}", "func (*MemberAddressUpdateResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{15}\n}", "func (*TelemetryParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{62}\n}", "func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{6}\n}", "func (SymbolKind) EnumDescriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{7}\n}", "func (*PatchAnnotationsStatusResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{6}\n}", "func (*RenewDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{6}\n}", "func (FriendSubType) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_proto_global_Global_proto_rawDescGZIP(), []int{3}\n}", "func (*RouteLegStepTravelAdvisory) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_routing_v2_route_proto_rawDescGZIP(), []int{3}\n}", "func (*PatchAnnotationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{4}\n}", "func (SqlUpdateTrack) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{8}\n}", "func (SqlUpdateTrack) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{13}\n}", "func (*CMsgSetMapLocationState) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{61}\n}", "func (*Location) Descriptor() ([]byte, []int) {\n\treturn file_tlogpb_tlog_proto_rawDescGZIP(), []int{2}\n}", "func (*RegisterNodeRsp) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{10}\n}", "func (*ComputeRoutesResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_maps_routes_v1_compute_routes_response_proto_rawDescGZIP(), []int{0}\n}", "func (UpdateType) EnumDescriptor() ([]byte, []int) {\n\treturn file_GetUserInfo_proto_rawDescGZIP(), []int{0}\n}", "func (*Span) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{0}\n}", "func (*DeviceStateRefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_worker_v1_device_state_proto_rawDescGZIP(), []int{4}\n}" ]
[ "0.6654763", "0.663932", "0.6555286", "0.65550774", "0.65344405", "0.65240306", "0.6431467", "0.6428126", "0.6421469", "0.64044356", "0.64010787", "0.6398879", "0.6377352", "0.6371854", "0.6344242", "0.6334764", "0.6315522", "0.6313767", "0.63100225", "0.63098186", "0.6308928", "0.6300741", "0.6297876", "0.62957907", "0.62866217", "0.62855846", "0.626995", "0.6268929", "0.6251781", "0.624252", "0.62377894", "0.6232149", "0.62194085", "0.62188077", "0.62102", "0.62071586", "0.62070006", "0.6206325", "0.6204493", "0.6204394", "0.61924213", "0.6190351", "0.6189968", "0.617781", "0.6173126", "0.6161842", "0.6159241", "0.61525697", "0.6150274", "0.6148279", "0.6144668", "0.61424667", "0.61424375", "0.6140847", "0.6140338", "0.6137101", "0.6131071", "0.6128279", "0.6125489", "0.61116815", "0.6108788", "0.6106509", "0.6106314", "0.6103288", "0.60982585", "0.6097865", "0.60956013", "0.60903215", "0.60877764", "0.60875654", "0.608052", "0.6072344", "0.6069711", "0.60692436", "0.6067341", "0.6061138", "0.60580873", "0.6056635", "0.6053889", "0.6053458", "0.6052595", "0.60520935", "0.6050501", "0.6048721", "0.6048194", "0.60460997", "0.60459805", "0.6042694", "0.6038981", "0.6034592", "0.6032689", "0.6032459", "0.6032243", "0.6031134", "0.60308063", "0.60201734", "0.60201186", "0.60200113", "0.60194004", "0.60107654" ]
0.73720187
0
Deprecated: Use RemoveKeeperReq.ProtoReflect.Descriptor instead.
Устарело: используйте RemoveKeeperReq.ProtoReflect.Descriptor вместо этого.
func (*RemoveKeeperReq) Descriptor() ([]byte, []int) { return file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{2} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*ExternalIDPRemoveRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{162}\n}", "func (*RemoveCheckRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_check_api_ocp_check_api_proto_rawDescGZIP(), []int{10}\n}", "func (*RemoveRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_bucketsd_pb_bucketsd_proto_rawDescGZIP(), []int{27}\n}", "func (*MemberLevelDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{52}\n}", "func (*MessageHubRemoveRequest) Descriptor() ([]byte, []int) {\n\treturn file_messagehub_proto_rawDescGZIP(), []int{7}\n}", "func (*MemberDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{7}\n}", "func (*MemberReceiveAddressDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{88}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_wallet_proto_rawDescGZIP(), []int{3}\n}", "func (*DeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_internal_proto_crypto_proto_rawDescGZIP(), []int{10}\n}", "func (*RemovePermissionFromRoleRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{8}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{7}\n}", "func (*DelRequest) Descriptor() ([]byte, []int) {\n\treturn file_patrol_proto_rawDescGZIP(), []int{8}\n}", "func (*GroupRemoveRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{34}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{7}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{12}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_message_service_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteMicroRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_micro_pb_request_proto_rawDescGZIP(), []int{4}\n}", "func (*RemoveItemFromGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_apps_mconf_pb_request_proto_rawDescGZIP(), []int{7}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteFriendRequest) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{7}\n}", "func (*RemoveRemindRequest) Descriptor() ([]byte, []int) {\n\treturn file_ocp_remind_api_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{14}\n}", "func (*RemoveAllReq) Descriptor() ([]byte, []int) {\n\treturn file_dfs_proto_rawDescGZIP(), []int{3}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{8}\n}", "func (*MemberTagDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{115}\n}", "func (*MemberRuleSettingDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{97}\n}", "func (*RemoveOrgMemberRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{67}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_mods_v1_mods_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{7}\n}", "func (*RevokeJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{20}\n}", "func (*GrowthChangeHistoryDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{25}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{10}\n}", "func (*IntegrationChangeHistoryDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{34}\n}", "func (*DeleteBrokerRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_iot_broker_v1_broker_service_proto_rawDescGZIP(), []int{7}\n}", "func (*DeleteBrokerPasswordRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_iot_broker_v1_broker_service_proto_rawDescGZIP(), []int{19}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_githubcard_proto_rawDescGZIP(), []int{11}\n}", "func (*MemberAddressDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{16}\n}", "func (*DeleteKeyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{73}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_storage_server_proto_rawDescGZIP(), []int{2}\n}", "func (*RemovePathRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_bucketsd_pb_bucketsd_proto_rawDescGZIP(), []int{29}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_index_proto_rawDescGZIP(), []int{13}\n}", "func (*DeleteFeedbackRequest) Descriptor() ([]byte, []int) {\n\treturn file_feedbackreq_proto_rawDescGZIP(), []int{6}\n}", "func (*RemoveOrgMemberRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{64}\n}", "func (*RemoveCertificateV1Request) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_certificate_api_ocp_certificate_api_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteHelmContextReq) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{18}\n}", "func (*UnregisterClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_grpc_proto_cluster_cluster_proto_rawDescGZIP(), []int{3}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_task_v1_task_proto_rawDescGZIP(), []int{13}\n}", "func (*DeleteLeaderboardRecordRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{31}\n}", "func (*DeleteRefRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cipd_api_cipd_v1_repo_proto_rawDescGZIP(), []int{14}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_vote_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_apps_mconf_pb_request_proto_rawDescGZIP(), []int{4}\n}", "func (*RemoveXAttrRequest) Descriptor() ([]byte, []int) {\n\treturn file_IOService_proto_rawDescGZIP(), []int{52}\n}", "func (*RemoveFaultRequest) Descriptor() ([]byte, []int) {\n\treturn file_faultinjector_proto_rawDescGZIP(), []int{6}\n}", "func (*DeleteWalletLedgerRequest) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_versions_v1_versions_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteRoleRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_store_store_proto_rawDescGZIP(), []int{9}\n}", "func (*DeleteModelRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_automl_v1_service_proto_rawDescGZIP(), []int{13}\n}", "func (*ProvisioningPolicyChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_devices_proto_v1alpha_provisioning_policy_change_proto_rawDescGZIP(), []int{0, 3}\n}", "func (*RemoveCheckResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_check_api_ocp_check_api_proto_rawDescGZIP(), []int{11}\n}", "func (*MemberStatisticsInfoDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{106}\n}", "func (*MemberTaskDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{124}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{6}\n}", "func (*PlanChange_Removed) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_plan_change_proto_rawDescGZIP(), []int{0, 3}\n}", "func (*MemberLoginLogDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{61}\n}", "func (*DeleteRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteNSRecordRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_record_proto_rawDescGZIP(), []int{3}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_ric_action_ricaction_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_threads_proto_rawDescGZIP(), []int{31}\n}", "func (*DeleteFriendsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{29}\n}", "func (*DataDataSyncDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_DataData_DataData_proto_rawDescGZIP(), []int{6}\n}", "func (*DeleteModelRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{81}\n}", "func (*MemcacheDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_memcache_service_proto_rawDescGZIP(), []int{7}\n}", "func (*DeregisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{8}\n}", "func (*RemoveProjectRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{6}\n}", "func (*DeleteIngressRuleRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{27}\n}", "func (*SharedMemoryControlRequest_Unregister) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_proto_rawDescGZIP(), []int{6, 1}\n}", "func (*DeleteWebhookRequest) Descriptor() ([]byte, []int) {\n\treturn file_events_Event_proto_rawDescGZIP(), []int{6}\n}", "func (*DeleteLimitRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_limit_service_proto_rawDescGZIP(), []int{10}\n}", "func (*DeleteWebhookRequest) Descriptor() ([]byte, []int) {\n\treturn file_uac_Event_proto_rawDescGZIP(), []int{5}\n}", "func (*MemberTagRelationDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{70}\n}", "func (*CleanupRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{14}\n}", "func (*DeleteMessageRequest) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{13}\n}", "func (*RemoveResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_bucketsd_pb_bucketsd_proto_rawDescGZIP(), []int{28}\n}", "func (*GetDeleteDisconnectedServicesConfigReq) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{17}\n}", "func (*DeleteCheckerV1Request) Descriptor() ([]byte, []int) {\n\treturn file_checker_v1_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteProvisionerRequest) Descriptor() ([]byte, []int) {\n\treturn file_majordomo_proto_rawDescGZIP(), []int{9}\n}", "func (*DeleteVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{14}\n}", "func (*IntegrationConsumeSettingDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{43}\n}", "func (*RemoveVacancyV1Request) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_vacancy_api_ocp_vacancy_api_proto_rawDescGZIP(), []int{9}\n}", "func (*DeleteMetadataRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_index_proto_rawDescGZIP(), []int{19}\n}", "func (*ReleaseDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_release_proto_rawDescGZIP(), []int{11}\n}", "func (*DeleteInputRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{60}\n}", "func (*DeleteSecretRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_secrets_proto_rawDescGZIP(), []int{7}\n}", "func (*RevokeTokensRequest) Descriptor() ([]byte, []int) {\n\treturn file_token_proto_rawDescGZIP(), []int{17}\n}", "func (*DelGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_userGroups_proto_rawDescGZIP(), []int{3}\n}", "func (*EmailDelReq) Descriptor() ([]byte, []int) {\n\treturn file_login_proto_rawDescGZIP(), []int{53}\n}", "func (*InterfaceDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_jnx_interfaces_service_proto_rawDescGZIP(), []int{21}\n}", "func (*DeleteClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_greenplum_v1_cluster_service_proto_rawDescGZIP(), []int{7}\n}" ]
[ "0.7382873", "0.7358745", "0.7324274", "0.721699", "0.71849823", "0.7162527", "0.7161694", "0.71450984", "0.7122148", "0.7120509", "0.71141547", "0.70940745", "0.7093572", "0.7085726", "0.7074796", "0.7035921", "0.7029398", "0.702928", "0.70082223", "0.7003014", "0.6984949", "0.6955201", "0.6952391", "0.69488364", "0.69445163", "0.6942311", "0.6934907", "0.69342136", "0.69136673", "0.69131", "0.69125175", "0.6908887", "0.68961847", "0.68833977", "0.68773836", "0.68735546", "0.68731457", "0.6870962", "0.68663836", "0.6861858", "0.686121", "0.6855915", "0.6855378", "0.6851162", "0.68465495", "0.6846268", "0.68400717", "0.6838346", "0.68357295", "0.683041", "0.6820257", "0.6819497", "0.6819097", "0.6818325", "0.68175447", "0.68153936", "0.68107027", "0.6807418", "0.6797242", "0.6796404", "0.67945063", "0.67872286", "0.6785094", "0.67847055", "0.6784116", "0.6775595", "0.67637134", "0.67633325", "0.67534465", "0.675073", "0.67500657", "0.67478263", "0.6747347", "0.6746063", "0.6742839", "0.6741175", "0.674092", "0.6734443", "0.67316645", "0.6731342", "0.672524", "0.6719356", "0.6714675", "0.6710737", "0.67004544", "0.66986173", "0.6698114", "0.66942316", "0.6693011", "0.66881245", "0.66866755", "0.66859597", "0.66666424", "0.66649914", "0.6655599", "0.66547143", "0.66522026", "0.66459125", "0.66445386", "0.66425145" ]
0.7849878
0
Deprecated: Use AddKeeperReq.ProtoReflect.Descriptor instead.
Устарело: используйте AddKeeperReq.ProtoReflect.Descriptor вместо этого.
func (*AddKeeperReq) Descriptor() ([]byte, []int) { return file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{3} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*RemoveKeeperReq) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{2}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*AddRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_calculator_proto_calc_proto_rawDescGZIP(), []int{0}\n}", "func (*MemberLevelAddReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{45}\n}", "func (*AddRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_calculate_proto_rawDescGZIP(), []int{3}\n}", "func (*AddApikeyRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{2}\n}", "func (*AddProducerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{2}\n}", "func (*MemberAddReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{0}\n}", "func (*SwitchKeeperReq) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{5}\n}", "func (*ModifyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{10}\n}", "func (*UpdateWithdrawRequest) Descriptor() ([]byte, []int) {\n\treturn file_services_temporal_service_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{7}\n}", "func (*UpdatePermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{9}\n}", "func (*AddWantRequest) Descriptor() ([]byte, []int) {\n\treturn file_recordwants_proto_rawDescGZIP(), []int{8}\n}", "func (*PatchKeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{74}\n}", "func (*CMsgClientToGCWageringRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{169}\n}", "func (*DeleteWalletLedgerRequest) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{10}\n}", "func (*AddFriendsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{11}\n}", "func (*AddBrokerPasswordRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_iot_broker_v1_broker_service_proto_rawDescGZIP(), []int{17}\n}", "func (*MemberReceiveAddressAddReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{81}\n}", "func (*AddItemToGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_apps_mconf_pb_request_proto_rawDescGZIP(), []int{6}\n}", "func (*WatchRequest) Descriptor() ([]byte, []int) {\n\treturn file_authzed_api_v0_watch_service_proto_rawDescGZIP(), []int{0}\n}", "func (*ListenRequest) Descriptor() ([]byte, []int) {\n\treturn file_faultinjector_proto_rawDescGZIP(), []int{8}\n}", "func (*CheckRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicecontrol_v1_service_controller_proto_rawDescGZIP(), []int{0}\n}", "func (*MemberLevelUpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{50}\n}", "func (*DelRequest) Descriptor() ([]byte, []int) {\n\treturn file_patrol_proto_rawDescGZIP(), []int{8}\n}", "func (*AddPersonRequest) Descriptor() ([]byte, []int) {\n\treturn file_protos_face_recognition_service_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgGCPlayerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{117}\n}", "func (*AddPermissionToRoleRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{7}\n}", "func (*AddRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{1}\n}", "func (*GrowthChangeHistoryAddReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{18}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_wallet_proto_rawDescGZIP(), []int{3}\n}", "func (*AddRequest) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{2}\n}", "func (*IntegrationChangeHistoryAddReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{27}\n}", "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_Trd_ModifyOrder_proto_rawDescGZIP(), []int{2}\n}", "func (*CreateAlterRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{1}\n}", "func (*RevokeJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{20}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_recordwants_proto_rawDescGZIP(), []int{6}\n}", "func (*UpdateBrokerRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_iot_broker_v1_broker_service_proto_rawDescGZIP(), []int{5}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_Ultimate_Super_WebDev_Corp_gateway_services_customer_customer_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteFriendRequest) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{7}\n}", "func (*CMsgClientToGCPlayerStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{143}\n}", "func (*AppendPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_app_config_agent_cmd_grpcserver_proto_api_app_config_proto_rawDescGZIP(), []int{5}\n}", "func (*AddInstanceRequest) Descriptor() ([]byte, []int) {\n\treturn file_myshoes_proto_rawDescGZIP(), []int{0}\n}", "func (*DeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_internal_proto_crypto_proto_rawDescGZIP(), []int{10}\n}", "func (x *fastReflection_Bech32PrefixRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Bech32PrefixRequest\n}", "func (*ControlRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_gateway_v1_control_proto_rawDescGZIP(), []int{0}\n}", "func (*MemberRuleSettingAddReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{90}\n}", "func (*RollbackAppendPermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_app_config_agent_cmd_grpcserver_proto_api_app_config_proto_rawDescGZIP(), []int{7}\n}", "func (*AddMachineKeyRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{21}\n}", "func (*PlayerAddRequest) Descriptor() ([]byte, []int) {\n\treturn file_player_proto_rawDescGZIP(), []int{2}\n}", "func (*UpdateIngressRuleRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{26}\n}", "func (*ChangeRequest) Descriptor() ([]byte, []int) {\n\treturn file_authorization_proto_rawDescGZIP(), []int{0}\n}", "func (*AddBrokerCertificateRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_iot_broker_v1_broker_service_proto_rawDescGZIP(), []int{11}\n}", "func (*MemberLevelDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{52}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_interservice_license_control_license_control_proto_rawDescGZIP(), []int{9}\n}", "func (*BatchUpdateReferencesRequest_Request) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_icas_icas_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*WatchRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{25}\n}", "func (*UpdateTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_access_service_token_proto_rawDescGZIP(), []int{2}\n}", "func (*MarginLevelsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_trading_proto_rawDescGZIP(), []int{49}\n}", "func (*RemoveCheckRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_check_api_ocp_check_api_proto_rawDescGZIP(), []int{10}\n}", "func (*WriteRequest) Descriptor() ([]byte, []int) {\n\treturn file_authzed_api_v0_acl_service_proto_rawDescGZIP(), []int{3}\n}", "func (*WithdrawalRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_trading_proto_rawDescGZIP(), []int{132}\n}", "func (*OutdatedRequest) Descriptor() ([]byte, []int) {\n\treturn file_cc_arduino_cli_commands_v1_commands_proto_rawDescGZIP(), []int{12}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_app_config_agent_cmd_grpcserver_proto_api_app_config_proto_rawDescGZIP(), []int{17}\n}", "func (*CMsgClientToGCUnderDraftRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{367}\n}", "func (*UpdateTelemetryReportedRequest) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{29}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_todo_proto_rawDescGZIP(), []int{5}\n}", "func (*CheckRequest) Descriptor() ([]byte, []int) {\n\treturn file_authzed_api_v0_acl_service_proto_rawDescGZIP(), []int{5}\n}", "func (*UpdateNetworkRequest) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_iam_v1_service_proto_rawDescGZIP(), []int{8}\n}", "func (*AddMetaRequest) Descriptor() ([]byte, []int) {\n\treturn file_token_balance_proto_rawDescGZIP(), []int{12}\n}", "func (*GetRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_comments_proto_rawDescGZIP(), []int{3}\n}", "func (*AddRefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_auth_auth_proto_rawDescGZIP(), []int{10}\n}", "func (*AddMockRequest) Descriptor() ([]byte, []int) {\n\treturn file_mocking_service_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateHookRequest) Descriptor() ([]byte, []int) {\n\treturn file_hook_proto_rawDescGZIP(), []int{4}\n}", "func (*MemberTagAddReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{108}\n}", "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{16}\n}", "func (*CalculatorRequest) Descriptor() ([]byte, []int) {\n\treturn file_basicpb_unary_api_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{7}\n}", "func (*UpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_internal_proto_crypto_proto_rawDescGZIP(), []int{8}\n}", "func (*CreateFriendReq) Descriptor() ([]byte, []int) {\n\treturn file_v1_friend_friend_proto_rawDescGZIP(), []int{0}\n}", "func (*CreateCheckpointRequest) Descriptor() ([]byte, []int) {\n\treturn file_keepsake_proto_rawDescGZIP(), []int{2}\n}", "func (*MarginLevelsSubscribeRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_trading_proto_rawDescGZIP(), []int{47}\n}", "func (*AddCommentReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_comment_comment_proto_rawDescGZIP(), []int{6}\n}", "func (*MemberLoginLogAddReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{54}\n}", "func (*RenewDelegationTokenRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{5}\n}", "func (*MemberReceiveAddressDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{88}\n}", "func (*TelemetryRequest) Descriptor() ([]byte, []int) {\n\treturn file_interservice_license_control_license_control_proto_rawDescGZIP(), []int{11}\n}", "func (*DeleteMicroRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_micro_pb_request_proto_rawDescGZIP(), []int{4}\n}", "func (*CreateWithdrawRequest) Descriptor() ([]byte, []int) {\n\treturn file_services_temporal_service_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateLimitRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_limit_service_proto_rawDescGZIP(), []int{9}\n}", "func (*AddLiftRequest) Descriptor() ([]byte, []int) {\n\treturn file_API_session_proto_rawDescGZIP(), []int{0}\n}", "func (*UpgradeRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{9}\n}", "func (*InterfaceAddRequest) Descriptor() ([]byte, []int) {\n\treturn file_jnx_interfaces_service_proto_rawDescGZIP(), []int{12}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{12}\n}", "func (*DeleteFeedbackRequest) Descriptor() ([]byte, []int) {\n\treturn file_feedbackreq_proto_rawDescGZIP(), []int{6}\n}", "func (*CMsgProfileRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{275}\n}", "func (*MemberDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{7}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*ValidateClientCredentialRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_micro_pb_request_proto_rawDescGZIP(), []int{0}\n}" ]
[ "0.71223587", "0.698026", "0.68898994", "0.6857225", "0.67590207", "0.67427474", "0.67198485", "0.6710893", "0.66748834", "0.6674649", "0.66576546", "0.6655914", "0.6629135", "0.6626807", "0.6617738", "0.66125524", "0.6579504", "0.6575033", "0.65688556", "0.6568845", "0.65657747", "0.65649956", "0.6562206", "0.6558641", "0.6554327", "0.65524167", "0.6548536", "0.6544852", "0.6537183", "0.65285635", "0.65261984", "0.6525718", "0.65197337", "0.6512616", "0.6510023", "0.650672", "0.6502714", "0.65021276", "0.6499182", "0.6495064", "0.64947057", "0.64944947", "0.6493683", "0.6484797", "0.64847606", "0.6478963", "0.647865", "0.64741504", "0.6473329", "0.6469736", "0.64681244", "0.6467158", "0.646614", "0.6457722", "0.64556336", "0.6455386", "0.6451455", "0.64513344", "0.64426666", "0.64410347", "0.6433083", "0.6431107", "0.6430378", "0.6429819", "0.6425565", "0.6425279", "0.6418118", "0.64133686", "0.64121246", "0.6410763", "0.640919", "0.64089173", "0.64087355", "0.64074975", "0.6406293", "0.64020216", "0.6400482", "0.6399319", "0.6398838", "0.63975185", "0.6397487", "0.6396813", "0.63965577", "0.6394357", "0.6392978", "0.63929677", "0.63914084", "0.63912743", "0.63906467", "0.6388079", "0.6387804", "0.6385782", "0.63819146", "0.6381661", "0.6380932", "0.63801056", "0.63760066", "0.6375921", "0.6374243", "0.63739365" ]
0.7387112
0
Deprecated: Use AssignAck.ProtoReflect.Descriptor instead.
Устарело: используйте AssignAck.ProtoReflect.Descriptor вместо этого.
func (*AssignAck) Descriptor() ([]byte, []int) { return file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{4} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*Ack) Descriptor() ([]byte, []int) {\n\treturn file_chatMsg_msg_proto_rawDescGZIP(), []int{0}\n}", "func (*EpochChangeAck) Descriptor() ([]byte, []int) {\n\treturn file_msgs_msgs_proto_rawDescGZIP(), []int{22}\n}", "func (*AckRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_acknowledge_proto_rawDescGZIP(), []int{0}\n}", "func (*RequestAck) Descriptor() ([]byte, []int) {\n\treturn file_msgs_msgs_proto_rawDescGZIP(), []int{15}\n}", "func (*Ack) Descriptor() ([]byte, []int) {\n\treturn file_publisher_proto_rawDescGZIP(), []int{1}\n}", "func (*AckResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_acknowledge_proto_rawDescGZIP(), []int{1}\n}", "func (*MoveAcknowledgment) Descriptor() ([]byte, []int) {\n\treturn file_FillerGame_proto_rawDescGZIP(), []int{4}\n}", "func (*PullFrameFromFlowResponse_Ack) Descriptor() ([]byte, []int) {\n\treturn file_pull_frame_from_flow_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*CCLCMsg_BaselineAck) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{17}\n}", "func (*CCLCMsg_BaselineAck) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{17}\n}", "func (*EventAck) Descriptor() ([]byte, []int) {\n\treturn file_arista_event_v1_event_proto_rawDescGZIP(), []int{2}\n}", "func (*AcknowledgeRequest) Descriptor() ([]byte, []int) {\n\treturn file_toit_api_data_proto_rawDescGZIP(), []int{12}\n}", "func (*TxAcknowledgment) Descriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_messages_proto_rawDescGZIP(), []int{2}\n}", "func (*ClusterRsp) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{8}\n}", "func (*CDOTABroadcastMsg) Descriptor() ([]byte, []int) {\n\treturn file_dota_broadcastmessages_proto_rawDescGZIP(), []int{0}\n}", "func (*AckWebsocketRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_webview_view_proto_rawDescGZIP(), []int{14}\n}", "func (*RefreshCallQueueRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{0}\n}", "func (*StorageObjectAck) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{81}\n}", "func (*CSVCMsg_FixAngle) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{34}\n}", "func (*AnalyzeReply) Descriptor() ([]byte, []int) {\n\treturn file_grpcapi_sequencelabeler_proto_rawDescGZIP(), []int{2}\n}", "func (*AcknowledgeResponse) Descriptor() ([]byte, []int) {\n\treturn file_toit_api_data_proto_rawDescGZIP(), []int{13}\n}", "func (*CSVCMsg_FixAngle) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{34}\n}", "func (*RefreshServiceAclRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshAuthorizationPolicyProtocol_proto_rawDescGZIP(), []int{0}\n}", "func (*GatewayTxAcknowledgment) Descriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_messages_proto_rawDescGZIP(), []int{3}\n}", "func (*ClusterReq) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{7}\n}", "func (*Approve) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{4}\n}", "func (*Topic) Descriptor() ([]byte, []int) {\n\treturn file_feedbackreq_proto_rawDescGZIP(), []int{2}\n}", "func (*Answer) Descriptor() ([]byte, []int) {\n\treturn file_protos_clac_proto_rawDescGZIP(), []int{1}\n}", "func (*DownlinkQueueRequest) Descriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_messages_proto_rawDescGZIP(), []int{17}\n}", "func (*AddKeeperReq) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{3}\n}", "func (*CMsgAckSharedPaintBuffers) Descriptor() ([]byte, []int) {\n\treturn file_steam_htmlmessages_proto_rawDescGZIP(), []int{68}\n}", "func (*ClientUpdatePendingMessageDelivery) Descriptor() ([]byte, []int) {\n\treturn file_client_updates_proto_rawDescGZIP(), []int{0}\n}", "func (*GroupAddRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{33}\n}", "func (*EvictWritersRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{10}\n}", "func (*RefreshNamenodesRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{2}\n}", "func (*AckWebsocketResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_webview_view_proto_rawDescGZIP(), []int{15}\n}", "func (*RefreshCallQueueResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{1}\n}", "func (*CMsgDOTABroadcastNotification) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{5}\n}", "func (*AnalysisMessageWeakSchema_ArgType) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*Action) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{1}\n}", "func (*CSVCMsg_Prefetch) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{36}\n}", "func (*CancelPlanResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{23}\n}", "func (*TriggerActionResponse) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{16}\n}", "func (*CSVCMsg_Prefetch) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{36}\n}", "func (*Message12821) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{2}\n}", "func (*ApplicationDownlink_ConfirmedRetry) Descriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_messages_proto_rawDescGZIP(), []int{9, 1}\n}", "func (*AnalysisMessageWeakSchema) Descriptor() ([]byte, []int) {\n\treturn file_analysis_v1alpha1_message_proto_rawDescGZIP(), []int{1}\n}", "func (*SwitchKeeperRsp) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{6}\n}", "func (*CancelPlanRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{22}\n}", "func (*Checkpoint) Descriptor() ([]byte, []int) {\n\treturn file_msgs_msgs_proto_rawDescGZIP(), []int{19}\n}", "func (*KeepAlive) Descriptor() ([]byte, []int) {\n\treturn file_chatMsg_msg_proto_rawDescGZIP(), []int{4}\n}", "func (*Message6578) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{7}\n}", "func (*Message7511) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{16}\n}", "func (*EvictWritersResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{11}\n}", "func (*Message12774) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{0}\n}", "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "func (*Message12818) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{5}\n}", "func (*RenewDelegationTokenRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{5}\n}", "func (*AssignmentFailure) Descriptor() ([]byte, []int) {\n\treturn file_api_backend_proto_rawDescGZIP(), []int{8}\n}", "func (*Message12817) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{22}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*Message5881) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{9}\n}", "func (*DecreaseAllowance) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{6}\n}", "func (*Message6108) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{31}\n}", "func (*TopicMessage) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_routing_v2_service_proto_rawDescGZIP(), []int{9}\n}", "func (*DownlinkMessage) Descriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_messages_proto_rawDescGZIP(), []int{1}\n}", "func (*CMsgDOTAKickedFromMatchmakingQueue) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{21}\n}", "func (*NewEnforcerReply) Descriptor() ([]byte, []int) {\n\treturn file_proto_casbin_proto_rawDescGZIP(), []int{1}\n}", "func (*Message6110) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{10}\n}", "func (*MsgWithRequired) Descriptor() ([]byte, []int) {\n\treturn file_jsonpb_proto_test2_proto_rawDescGZIP(), []int{9}\n}", "func (*IncreaseAllowance) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{5}\n}", "func (*Message7920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{20}\n}", "func (*AssignmentGroup) Descriptor() ([]byte, []int) {\n\treturn file_api_backend_proto_rawDescGZIP(), []int{7}\n}", "func (*Message12820) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{3}\n}", "func (*UplinkMessage) Descriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_messages_proto_rawDescGZIP(), []int{0}\n}", "func (*Message6127) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{24}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*MessageHubApproveRequest) Descriptor() ([]byte, []int) {\n\treturn file_messagehub_proto_rawDescGZIP(), []int{5}\n}", "func (*GroupRemoveRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{34}\n}", "func (*Message12796) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{1}\n}", "func (*CSVCMsg_SetPause) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{28}\n}", "func (*Message5903) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{34}\n}", "func (*MemberReceiveAddressDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{88}\n}", "func (*TriggerActionRequest) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{15}\n}", "func (*Reply) Descriptor() ([]byte, []int) {\n\treturn file_my_task_my_task_proto_rawDescGZIP(), []int{1}\n}", "func (*TcpKeepalive) Descriptor() ([]byte, []int) {\n\treturn file_envoy_config_core_v3_address_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteFeedbackRequest) Descriptor() ([]byte, []int) {\n\treturn file_feedbackreq_proto_rawDescGZIP(), []int{6}\n}", "func (*CBroadcast_WebRTCSetAnswer_Notification) Descriptor() ([]byte, []int) {\n\treturn file_steammessages_broadcast_steamclient_proto_rawDescGZIP(), []int{75}\n}", "func (*ForwardRequest) Descriptor() ([]byte, []int) {\n\treturn file_msgs_msgs_proto_rawDescGZIP(), []int{13}\n}", "func (*CSVCMsg_HltvReplay) Descriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{51}\n}", "func (*CSVCMsg_HltvReplay) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{51}\n}", "func (*MsgPack) Descriptor() ([]byte, []int) {\n\treturn file_chatMsg_msg_proto_rawDescGZIP(), []int{2}\n}", "func (*RaftClientRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{26}\n}", "func (*RevokeCertificateRequest) Descriptor() ([]byte, []int) {\n\treturn file_sa_proto_rawDescGZIP(), []int{33}\n}", "func (x *fastReflection_MsgSetWithdrawAddress) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgSetWithdrawAddress\n}", "func (*Message7921) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{19}\n}", "func (*AddBrokerCertificateRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_iot_broker_v1_broker_service_proto_rawDescGZIP(), []int{11}\n}", "func (*Message7865) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{15}\n}", "func (*CCLCMsg_HltvReplay) Descriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{52}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}" ]
[ "0.6931855", "0.6785189", "0.67617804", "0.6728953", "0.65926194", "0.6559347", "0.6514554", "0.64602405", "0.6412379", "0.64036167", "0.624473", "0.62233335", "0.6151008", "0.6145046", "0.61359626", "0.6081008", "0.6074918", "0.60593617", "0.60510236", "0.60306334", "0.60263705", "0.60232085", "0.59805846", "0.5970373", "0.5961037", "0.5958772", "0.5953138", "0.59257346", "0.58914053", "0.58899105", "0.5884694", "0.58806396", "0.58773607", "0.58768475", "0.5875401", "0.58736825", "0.58660775", "0.5862988", "0.5856513", "0.58370477", "0.5833868", "0.583158", "0.5829422", "0.5827609", "0.5827393", "0.58269525", "0.58249015", "0.58224493", "0.5809792", "0.5807087", "0.5800557", "0.57987267", "0.57971644", "0.57971585", "0.57962763", "0.5792581", "0.5789384", "0.5788274", "0.5788157", "0.5777743", "0.57771146", "0.577581", "0.5772932", "0.5764816", "0.5761675", "0.576164", "0.5760634", "0.57597727", "0.5756312", "0.5756102", "0.575592", "0.5753866", "0.5753537", "0.5752993", "0.575175", "0.57466495", "0.5746242", "0.5741718", "0.5739966", "0.5739557", "0.57384944", "0.5736139", "0.5734648", "0.5734148", "0.57333815", "0.57306707", "0.57303405", "0.5728583", "0.572761", "0.5721718", "0.5720787", "0.57184654", "0.5717135", "0.5716778", "0.5714086", "0.57125014", "0.5711893", "0.5711516", "0.571046", "0.57099503" ]
0.7436857
0
Deprecated: Use SwitchKeeperReq.ProtoReflect.Descriptor instead.
Устарело: используйте SwitchKeeperReq.ProtoReflect.Descriptor вместо этого.
func (*SwitchKeeperReq) Descriptor() ([]byte, []int) { return file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{5} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*ControlRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_gateway_v1_control_proto_rawDescGZIP(), []int{0}\n}", "func (*CheckRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicecontrol_v1_service_controller_proto_rawDescGZIP(), []int{0}\n}", "func (*SwitchRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{7}\n}", "func (*WatchRequest) Descriptor() ([]byte, []int) {\n\treturn file_authzed_api_v0_watch_service_proto_rawDescGZIP(), []int{0}\n}", "func (*SwitchKeeperRsp) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{6}\n}", "func (*WatchRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{25}\n}", "func (x *fastReflection_Bech32PrefixRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_Bech32PrefixRequest\n}", "func (*ProbeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_gateway_v1_control_proto_rawDescGZIP(), []int{2}\n}", "func (*ChangeRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{2}\n}", "func (*ChangeRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{2}\n}", "func (*RemoveKeeperReq) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{2}\n}", "func (*ListenRequest) Descriptor() ([]byte, []int) {\n\treturn file_faultinjector_proto_rawDescGZIP(), []int{8}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*AddKeeperReq) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{3}\n}", "func (*TelemetryRequest) Descriptor() ([]byte, []int) {\n\treturn file_interservice_license_control_license_control_proto_rawDescGZIP(), []int{11}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*FeedbackRequest) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{10}\n}", "func (*ChangeRequest) Descriptor() ([]byte, []int) {\n\treturn file_authorization_proto_rawDescGZIP(), []int{0}\n}", "func (*PatchKeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{74}\n}", "func (*ModelControlRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_proto_rawDescGZIP(), []int{4}\n}", "func (*SelectorVerificationReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_selector_verification_msgs_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgGCPlayerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{117}\n}", "func (*NewChromeRequest) Descriptor() ([]byte, []int) {\n\treturn file_check_power_menu_service_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgClientToGCWageringRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{169}\n}", "func (*ModifyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{10}\n}", "func (*GetVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{9}\n}", "func (*ChangePasswordRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_Ultimate_Super_WebDev_Corp_gateway_services_customer_customer_proto_rawDescGZIP(), []int{1}\n}", "func (*ListenRequest) Descriptor() ([]byte, []int) {\n\treturn file_threads_proto_rawDescGZIP(), []int{46}\n}", "func (*DiagnoseRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{16}\n}", "func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{6}\n}", "func (*ChangeModeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_bfd_bfd_proto_rawDescGZIP(), []int{5}\n}", "func (*MemberLevelUpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{50}\n}", "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{16}\n}", "func (*StateRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_runtime_v1_shim_v1_shim_proto_rawDescGZIP(), []int{7}\n}", "func (*GetRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_comments_proto_rawDescGZIP(), []int{3}\n}", "func (*UpdateMachineRequest) Descriptor() ([]byte, []int) {\n\treturn file_management_proto_rawDescGZIP(), []int{20}\n}", "func (*UpdatePermissionRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{9}\n}", "func (*TelemetryRequest) Descriptor() ([]byte, []int) {\n\treturn file_automate_gateway_api_telemetry_telemetry_proto_rawDescGZIP(), []int{0}\n}", "func (*SelectorVerificationsReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_selector_verification_msgs_proto_rawDescGZIP(), []int{2}\n}", "func (*UpdateNetworkRequest) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_iam_v1_service_proto_rawDescGZIP(), []int{8}\n}", "func (*RevokeJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{20}\n}", "func (*PollCredentialOffersRequest) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{30}\n}", "func (*CMsgClientToGCPlayerStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{143}\n}", "func (*SignalRequest) Descriptor() ([]byte, []int) {\n\treturn file_cmd_server_grpc_proto_sfu_proto_rawDescGZIP(), []int{0}\n}", "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_Trd_ModifyOrder_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteFeedbackRequest) Descriptor() ([]byte, []int) {\n\treturn file_feedbackreq_proto_rawDescGZIP(), []int{6}\n}", "func (*WatchLimitsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_limit_service_proto_rawDescGZIP(), []int{7}\n}", "func (*SetTraceRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*UpgradeRuntimeRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_notebooks_v1_managed_service_proto_rawDescGZIP(), []int{9}\n}", "func (*UpgradeReq) Descriptor() ([]byte, []int) {\n\treturn file_helm_api_proto_rawDescGZIP(), []int{8}\n}", "func (*MoneyRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_swap_swap_proto_rawDescGZIP(), []int{0}\n}", "func (*CBroadcast_WebRTCStopped_Request) Descriptor() ([]byte, []int) {\n\treturn file_steammessages_broadcast_steamclient_proto_rawDescGZIP(), []int{47}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_Ultimate_Super_WebDev_Corp_gateway_services_customer_customer_proto_rawDescGZIP(), []int{4}\n}", "func (*RenameReq) Descriptor() ([]byte, []int) {\n\treturn file_dfs_proto_rawDescGZIP(), []int{4}\n}", "func (*DeleteWalletLedgerRequest) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{10}\n}", "func (*ReportRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicecontrol_v1_service_controller_proto_rawDescGZIP(), []int{2}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_recordwants_proto_rawDescGZIP(), []int{6}\n}", "func (*ConnectedRequest) Descriptor() ([]byte, []int) {\n\treturn file_vm_vm_proto_rawDescGZIP(), []int{28}\n}", "func (*PatchWorkflowVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{143}\n}", "func (*CodeLensRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{163}\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_interservice_license_control_license_control_proto_rawDescGZIP(), []int{9}\n}", "func (*DisconnectedServicesReq) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{6}\n}", "func (*FeedbackRequest) Descriptor() ([]byte, []int) {\n\treturn file_feedbackreq_proto_rawDescGZIP(), []int{3}\n}", "func (*PatchModelVersionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{86}\n}", "func (*RenameRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{194}\n}", "func (*UpgradeRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_pb_protobuf_api_proto_rawDescGZIP(), []int{6}\n}", "func (*WatchConfigMapsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_applications_proto_v1alpha2_config_map_service_proto_rawDescGZIP(), []int{7}\n}", "func (*UpdateBrokerRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_iot_broker_v1_broker_service_proto_rawDescGZIP(), []int{5}\n}", "func (*SetStrategyRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{21}\n}", "func (*GenerateProductMixIdeasRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{7}\n}", "func (*PrepareFeedbackRequest) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{9}\n}", "func (*UpdateHookRequest) Descriptor() ([]byte, []int) {\n\treturn file_hook_proto_rawDescGZIP(), []int{4}\n}", "func (*WaitRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_containerd_containerd_runtime_v1_shim_v1_shim_proto_rawDescGZIP(), []int{18}\n}", "func (*GetRequest) Descriptor() ([]byte, []int) {\n\treturn file_vote_proto_rawDescGZIP(), []int{9}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*DeviceRestartRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_worker_v1_device_state_proto_rawDescGZIP(), []int{0}\n}", "func (*CMsgProfileRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{275}\n}", "func (*ShowMessageRequestRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{58}\n}", "func (*ToggleFavoriteTranslationRequest) Descriptor() ([]byte, []int) {\n\treturn file_translation_proto_rawDescGZIP(), []int{5}\n}", "func (*GetRequest) Descriptor() ([]byte, []int) {\n\treturn file_index_faults_rpc_rpc_proto_rawDescGZIP(), []int{2}\n}", "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{7}\n}", "func (*WatchLimitRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_limit_service_proto_rawDescGZIP(), []int{5}\n}", "func (*CAccountHardware_VRCompatibilityCheck_Request) Descriptor() ([]byte, []int) {\n\treturn file_steammessages_accounthardware_steamclient_proto_rawDescGZIP(), []int{19}\n}", "func (*GetRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_app_config_agent_cmd_grpcserver_proto_api_app_config_proto_rawDescGZIP(), []int{15}\n}", "func (*ChangePasswordRequest) Descriptor() ([]byte, []int) {\n\treturn file_pb_auth_proto_rawDescGZIP(), []int{2}\n}", "func (*ChangeUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_githubcard_proto_rawDescGZIP(), []int{23}\n}", "func (*DeviceStateRefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_worker_v1_device_state_proto_rawDescGZIP(), []int{4}\n}", "func (*HoverRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{111}\n}", "func (*UpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_internal_proto_crypto_proto_rawDescGZIP(), []int{8}\n}", "func (*PatchModelsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{80}\n}", "func (*GetServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{6}\n}", "func (*ModifyGatewayRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_pb_protobuf_api_proto_rawDescGZIP(), []int{20}\n}", "func (*ValidateClientCredentialRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_micro_pb_request_proto_rawDescGZIP(), []int{0}\n}", "func (*OutdatedRequest) Descriptor() ([]byte, []int) {\n\treturn file_cc_arduino_cli_commands_v1_commands_proto_rawDescGZIP(), []int{12}\n}", "func (*GenerateFeedbackRequest) Descriptor() ([]byte, []int) {\n\treturn file_feedbackreq_proto_rawDescGZIP(), []int{8}\n}", "func (*DescribeCheckRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_check_api_ocp_check_api_proto_rawDescGZIP(), []int{2}\n}", "func (*CapabilityRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_gnmi_gnmi_proto_rawDescGZIP(), []int{20}\n}", "func (*ToggleWorkflowRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_workflows_proto_rawDescGZIP(), []int{35}\n}", "func (*SetStateRequest) Descriptor() ([]byte, []int) {\n\treturn file_vm_vm_proto_rawDescGZIP(), []int{3}\n}", "func (*GetRequest) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_api_jsonapi_request_proto_rawDescGZIP(), []int{0}\n}" ]
[ "0.67672926", "0.67448694", "0.6714067", "0.6700932", "0.66939986", "0.6679988", "0.66392297", "0.6629699", "0.66290075", "0.66290075", "0.66270024", "0.6600582", "0.6593718", "0.65869516", "0.6586671", "0.65798324", "0.6578982", "0.65722543", "0.6559393", "0.6541644", "0.65267646", "0.65265423", "0.65179485", "0.6513421", "0.6503316", "0.649521", "0.6491715", "0.6480754", "0.6480587", "0.6468997", "0.6466369", "0.6466115", "0.646355", "0.64544034", "0.64454424", "0.64377344", "0.6436496", "0.6430463", "0.6424914", "0.64243186", "0.6419063", "0.6416301", "0.6412139", "0.64117485", "0.64084595", "0.64054406", "0.64028746", "0.6401506", "0.6395661", "0.6394999", "0.63918316", "0.63897383", "0.6383831", "0.6383094", "0.6381685", "0.63784", "0.63768744", "0.6375659", "0.63738394", "0.6372521", "0.63718444", "0.63693017", "0.63666797", "0.6364774", "0.63639015", "0.6362834", "0.63560724", "0.635578", "0.63546145", "0.6352296", "0.6351564", "0.63509506", "0.63493705", "0.6344447", "0.634378", "0.63431734", "0.6342378", "0.63421416", "0.6339831", "0.63387823", "0.63367987", "0.6333681", "0.63287485", "0.6328048", "0.63273853", "0.6322997", "0.63226646", "0.63218224", "0.63218033", "0.6321513", "0.63211846", "0.6320323", "0.6319321", "0.63172567", "0.63148344", "0.63144857", "0.6313351", "0.6312946", "0.6308311", "0.63081616" ]
0.7221775
0
Deprecated: Use SwitchKeeperRsp.ProtoReflect.Descriptor instead.
Устарело: используйте SwitchKeeperRsp.ProtoReflect.Descriptor вместо этого.
func (*SwitchKeeperRsp) Descriptor() ([]byte, []int) { return file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{6} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (SVC_Messages) EnumDescriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{4}\n}", "func (SVC_Messages) EnumDescriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{4}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*GroupRsp) Descriptor() ([]byte, []int) {\n\treturn file_chatMsg_msg_proto_rawDescGZIP(), []int{6}\n}", "func (*ChangeInfoRsp) Descriptor() ([]byte, []int) {\n\treturn file_Auth_Auth_proto_rawDescGZIP(), []int{5}\n}", "func (*GetRsp) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{1}\n}", "func (StatusMessage_Reference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1, 0}\n}", "func (Gateway_Listener_Protocol) EnumDescriptor() ([]byte, []int) {\n\treturn file_mesh_v1alpha1_gateway_proto_rawDescGZIP(), []int{0, 1, 0}\n}", "func (Listener_Protocol) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_loadbalancer_v1_network_load_balancer_proto_rawDescGZIP(), []int{2, 0}\n}", "func (CLC_Messages) EnumDescriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{1}\n}", "func (*Listen) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{4}\n}", "func (*AddPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{30}\n}", "func (CBroadcast_WatchBroadcast_Response_EWatchResponse) EnumDescriptor() ([]byte, []int) {\n\treturn file_steammessages_broadcast_steamclient_proto_rawDescGZIP(), []int{8, 0}\n}", "func (ConfigureStatelessRequest_Cmd) EnumDescriptor() ([]byte, []int) {\n\treturn file_orc8r_protos_magmad_proto_rawDescGZIP(), []int{15, 0}\n}", "func (CLC_Messages) EnumDescriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{1}\n}", "func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParamsResponse\n}", "func (SpanLayer) EnumDescriptor() ([]byte, []int) {\n\treturn file_common_trace_common_proto_rawDescGZIP(), []int{2}\n}", "func (*CancelPlanResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{23}\n}", "func (*RefreshResponse) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{17}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (*ClusterRsp) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{8}\n}", "func (CMsgClientToGCGiveTipResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{240, 0}\n}", "func (RouteLookupRequest_Reason) EnumDescriptor() ([]byte, []int) {\n\treturn file_grpc_lookup_v1_rls_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*UpdateFriendStatusRsp) Descriptor() ([]byte, []int) {\n\treturn file_v1_friend_friend_proto_rawDescGZIP(), []int{3}\n}", "func (DOTA_WatchReplayType) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{0}\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (NET_Messages) EnumDescriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{0}\n}", "func (EUnderDraftResponse) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{11}\n}", "func (Diagnostic_Kind) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_api_servicemanagement_v1_resources_proto_rawDescGZIP(), []int{2, 0}\n}", "func (*DecodeReply) Descriptor() ([]byte, []int) {\n\treturn file_proto_videoservice_proto_rawDescGZIP(), []int{1}\n}", "func (*CreateFriendRsp) Descriptor() ([]byte, []int) {\n\treturn file_v1_friend_friend_proto_rawDescGZIP(), []int{1}\n}", "func (Retry_Conf_Grpc_RetryOn) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_mesh_v1alpha1_retry_proto_rawDescGZIP(), []int{0, 0, 3, 0}\n}", "func (*ListenResponse) Descriptor() ([]byte, []int) {\n\treturn file_faultinjector_proto_rawDescGZIP(), []int{9}\n}", "func (StandardProtocols_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54, 0}\n}", "func (ProbeConf_Method) EnumDescriptor() ([]byte, []int) {\n\treturn file_github_com_google_cloudprober_probes_http_proto_config_proto_rawDescGZIP(), []int{0, 1}\n}", "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{16}\n}", "func (*RefreshCallQueueResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{1}\n}", "func (*SwitchKeeperReq) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{5}\n}", "func (Span_SpanKind) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{0, 0}\n}", "func (RefType) EnumDescriptor() ([]byte, []int) {\n\treturn file_common_trace_common_proto_rawDescGZIP(), []int{1}\n}", "func (Span_Link_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{0, 3, 0}\n}", "func (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "func (*DiagOperation) Descriptor() ([]byte, []int) {\n\treturn file_testvector_tv_proto_rawDescGZIP(), []int{10}\n}", "func (ProbeConf_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_github_com_cloudprober_cloudprober_probes_udplistener_proto_config_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*GetPeerInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{28}\n}", "func (CP2P_Voice_Handler_Flags) EnumDescriptor() ([]byte, []int) {\n\treturn file_c_peer2peer_netmessages_proto_rawDescGZIP(), []int{2, 0}\n}", "func (CMsgClientToGCRecyclePlayerCardResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{215, 0}\n}", "func (NET_Messages) EnumDescriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{0}\n}", "func (*ScheduleDownlinkResponse) Descriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_gatewayserver_proto_rawDescGZIP(), []int{2}\n}", "func (*HelloRsp) Descriptor() ([]byte, []int) {\n\treturn file_helloword_proto_rawDescGZIP(), []int{1}\n}", "func (*EvictWritersResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{11}\n}", "func (ConstantSampler_ConstantDecision) EnumDescriptor() ([]byte, []int) {\n\treturn file_opencensus_proto_trace_v1_trace_config_proto_rawDescGZIP(), []int{2, 0}\n}", "func (*ListenRequest) Descriptor() ([]byte, []int) {\n\treturn file_faultinjector_proto_rawDescGZIP(), []int{8}\n}", "func (Protocol) EnumDescriptor() ([]byte, []int) {\n\treturn file_github_com_ameliaikeda_protoc_gen_router_proto_router_proto_rawDescGZIP(), []int{0}\n}", "func (*StopBroadcastResponse) Descriptor() ([]byte, []int) {\n\treturn file_services_core_protobuf_servers_proto_rawDescGZIP(), []int{5}\n}", "func (*DisconnectedRequest) Descriptor() ([]byte, []int) {\n\treturn file_vm_vm_proto_rawDescGZIP(), []int{29}\n}", "func (MsgSubType) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_proto_global_Global_proto_rawDescGZIP(), []int{5}\n}", "func (Connector_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_kafka_v1_connector_proto_rawDescGZIP(), []int{10, 1}\n}", "func (FileSystemWatcher_WatchKind) EnumDescriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{76, 0}\n}", "func (LightstepConfig_PropagationMode) EnumDescriptor() ([]byte, []int) {\n\treturn file_envoy_config_trace_v3_lightstep_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*CancelDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{8}\n}", "func (ConstantSampler_ConstantDecision) EnumDescriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_external_envoy_config_trace_v3_opencensus_proto_rawDescGZIP(), []int{3, 0}\n}", "func (Strategy) EnumDescriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{1}\n}", "func (EDevEventRequestResult) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{7}\n}", "func (ESupportEventRequestResult) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{8}\n}", "func (P2P_Messages) EnumDescriptor() ([]byte, []int) {\n\treturn file_c_peer2peer_netmessages_proto_rawDescGZIP(), []int{0}\n}", "func (CMsgClientToGCRecycleHeroRelicResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{268, 0}\n}", "func (EOverwatchConviction) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_common_proto_rawDescGZIP(), []int{7}\n}", "func (*MemberReceiveAddressUpdateResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{87}\n}", "func (Span_TimeEvent_MessageEvent_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{0, 1, 1, 0}\n}", "func (ListenNetworkEnum) EnumDescriptor() ([]byte, []int) {\n\treturn file_pkg_kascfg_kascfg_proto_rawDescGZIP(), []int{0}\n}", "func (*WatchResponse) Descriptor() ([]byte, []int) {\n\treturn file_authzed_api_v0_watch_service_proto_rawDescGZIP(), []int{1}\n}", "func (NET_Messages) EnumDescriptor() ([]byte, []int) {\n\treturn file_artifact_networkbasetypes_proto_rawDescGZIP(), []int{0}\n}", "func (SocketAddress_Protocol) EnumDescriptor() ([]byte, []int) {\n\treturn file_envoy_config_core_v3_address_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*CheckResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicecontrol_v1_service_controller_proto_rawDescGZIP(), []int{1}\n}", "func (OpenCensusConfig_TraceContext) EnumDescriptor() ([]byte, []int) {\n\treturn file_github_com_solo_io_gloo_projects_gloo_api_external_envoy_config_trace_v3_opencensus_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*ProbeResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_gateway_v1_control_proto_rawDescGZIP(), []int{3}\n}", "func (MSG) EnumDescriptor() ([]byte, []int) {\n\treturn file_chat_proto_rawDescGZIP(), []int{0}\n}", "func (PolicyBasedRoute_Warnings_Code) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_networkconnectivity_v1_policy_based_routing_proto_rawDescGZIP(), []int{0, 3, 0}\n}", "func (CMsgProfileUpdateResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{278, 0}\n}", "func (*SendFromMinerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{26}\n}", "func (ListenReply_Action) EnumDescriptor() ([]byte, []int) {\n\treturn file_threads_proto_rawDescGZIP(), []int{47, 0}\n}", "func (CMsgDOTADestroyLobbyResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{258, 0}\n}", "func (Kind) EnumDescriptor() ([]byte, []int) {\n\treturn file_go_pkg_beam_core_runtime_harness_session_proto_rawDescGZIP(), []int{0}\n}", "func (WinRMProtocolType) EnumDescriptor() ([]byte, []int) {\n\treturn file_moc_common_computecommon_proto_rawDescGZIP(), []int{5}\n}", "func (*DeviceStateRefreshReply) Descriptor() ([]byte, []int) {\n\treturn file_api_worker_v1_device_state_proto_rawDescGZIP(), []int{5}\n}", "func (*SignalReply) Descriptor() ([]byte, []int) {\n\treturn file_cmd_server_grpc_proto_sfu_proto_rawDescGZIP(), []int{1}\n}", "func (*DisconnectedServicesReq) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{6}\n}", "func (*DiagnoseResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{17}\n}", "func (ReplyType) EnumDescriptor() ([]byte, []int) {\n\treturn file_fk_atlas_proto_rawDescGZIP(), []int{13}\n}", "func (*DiagnoseRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{16}\n}", "func (*RefreshCallQueueRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{0}\n}", "func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{6}\n}", "func (*SetTraceRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*WinRMListener) Descriptor() ([]byte, []int) {\n\treturn file_moc_common_computecommon_proto_rawDescGZIP(), []int{0}\n}", "func (*RenewDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{6}\n}", "func (*FeedbackRequest) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{10}\n}", "func (*RefreshNamenodesResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{3}\n}" ]
[ "0.6646759", "0.66103727", "0.65684617", "0.65414816", "0.6525648", "0.6515199", "0.65136725", "0.6510185", "0.6498448", "0.64884603", "0.6486122", "0.6476423", "0.64567405", "0.6449851", "0.6436708", "0.64062786", "0.640551", "0.6400204", "0.6399626", "0.6393379", "0.63858473", "0.6380418", "0.63794726", "0.6377344", "0.63766587", "0.6366592", "0.63663375", "0.63643116", "0.63642377", "0.63621867", "0.6358558", "0.635826", "0.6358192", "0.63563603", "0.6355208", "0.63535726", "0.63454574", "0.6345231", "0.6342059", "0.63408595", "0.63406956", "0.6336321", "0.633601", "0.63358504", "0.6335744", "0.6334608", "0.6327953", "0.63261795", "0.63241047", "0.63168305", "0.63144165", "0.6312551", "0.6312306", "0.63089395", "0.63075423", "0.6303985", "0.6299445", "0.629137", "0.6287585", "0.628528", "0.6282853", "0.6275765", "0.6273658", "0.6259821", "0.62598085", "0.6258975", "0.6258675", "0.6252341", "0.62506515", "0.6249553", "0.6248571", "0.624788", "0.6247757", "0.62476796", "0.6245605", "0.6245536", "0.62448156", "0.62420434", "0.62420076", "0.6240708", "0.62403476", "0.62400836", "0.62376803", "0.6237537", "0.62356204", "0.6234964", "0.6234492", "0.62333965", "0.62330765", "0.6228893", "0.6228874", "0.6228836", "0.6228725", "0.6225904", "0.62251645", "0.6222487", "0.62187475", "0.62177664", "0.6217729", "0.6217605" ]
0.7286045
0
Deprecated: Use ClusterRsp.ProtoReflect.Descriptor instead.
Устаревший: используйте ClusterRsp.ProtoReflect.Descriptor вместо этого.
func (*ClusterRsp) Descriptor() ([]byte, []int) { return file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{8} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*UnregisterClusterResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_grpc_proto_cluster_cluster_proto_rawDescGZIP(), []int{4}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*GroupRsp) Descriptor() ([]byte, []int) {\n\treturn file_chatMsg_msg_proto_rawDescGZIP(), []int{6}\n}", "func (*UnregisterClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_grpc_proto_cluster_cluster_proto_rawDescGZIP(), []int{3}\n}", "func (*AddPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{30}\n}", "func (*StopClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_greenplum_v1_cluster_service_proto_rawDescGZIP(), []int{11}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*GetRsp) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{1}\n}", "func (*GetPeerInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{28}\n}", "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "func (*RefreshNamenodesResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{3}\n}", "func (*GetClusterInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_uber_cadence_api_v1_service_workflow_proto_rawDescGZIP(), []int{21}\n}", "func (*CancelPlanResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{23}\n}", "func (*SwitchKeeperRsp) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{6}\n}", "func (*RefreshResponse) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{17}\n}", "func (*StopBroadcastResponse) Descriptor() ([]byte, []int) {\n\treturn file_services_core_protobuf_servers_proto_rawDescGZIP(), []int{5}\n}", "func (SVC_Messages) EnumDescriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{4}\n}", "func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{6}\n}", "func (x *fastReflection_RpcCommandOptions) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_RpcCommandOptions\n}", "func (*GetMetricsInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{44}\n}", "func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParamsResponse\n}", "func (*CreateFriendRsp) Descriptor() ([]byte, []int) {\n\treturn file_v1_friend_friend_proto_rawDescGZIP(), []int{1}\n}", "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{16}\n}", "func (SVC_Messages) EnumDescriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{4}\n}", "func (Diagnostic_Kind) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_api_servicemanagement_v1_resources_proto_rawDescGZIP(), []int{2, 0}\n}", "func (*DeleteClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_greenplum_v1_cluster_service_proto_rawDescGZIP(), []int{7}\n}", "func (*DisconnectedRequest) Descriptor() ([]byte, []int) {\n\treturn file_vm_vm_proto_rawDescGZIP(), []int{29}\n}", "func (CMsgClientToGCRecyclePlayerCardResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{215, 0}\n}", "func (*GetClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_greenplum_v1_cluster_service_proto_rawDescGZIP(), []int{0}\n}", "func (ComputeApiClass) EnumDescriptor() ([]byte, []int) {\n\treturn file_spacemesh_v1_smesher_types_proto_rawDescGZIP(), []int{0}\n}", "func (x *fastReflection_ServiceCommandDescriptor) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ServiceCommandDescriptor\n}", "func (*GetDatanodeInfoResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{13}\n}", "func (*StopBroadcastRequest) Descriptor() ([]byte, []int) {\n\treturn file_services_core_protobuf_servers_proto_rawDescGZIP(), []int{4}\n}", "func (*ListClusterOperationsResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_greenplum_v1_cluster_service_proto_rawDescGZIP(), []int{14}\n}", "func (CMsgClientToGCGiveTipResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{240, 0}\n}", "func (*UpdateClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_greenplum_v1_cluster_service_proto_rawDescGZIP(), []int{5}\n}", "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "func (*UpdateFriendStatusRsp) Descriptor() ([]byte, []int) {\n\treturn file_v1_friend_friend_proto_rawDescGZIP(), []int{3}\n}", "func (x *fastReflection_AddressStringToBytesResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_AddressStringToBytesResponse\n}", "func (*ListClustersResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_greenplum_v1_cluster_service_proto_rawDescGZIP(), []int{2}\n}", "func (ReplyType) EnumDescriptor() ([]byte, []int) {\n\treturn file_fk_atlas_proto_rawDescGZIP(), []int{13}\n}", "func (CMsgClientToGCRecycleHeroRelicResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{268, 0}\n}", "func (*MemberReceiveAddressUpdateResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{87}\n}", "func (*MetricsServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{18}\n}", "func (CMsgDOTADestroyLobbyResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{258, 0}\n}", "func (*PreviewUpdateGameServerClusterResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_gaming_v1beta_game_server_clusters_proto_rawDescGZIP(), []int{11}\n}", "func (*RefreshCallQueueResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{1}\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (*CancelDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{8}\n}", "func (*StopClusterMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_greenplum_v1_cluster_service_proto_rawDescGZIP(), []int{12}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_contact_proto_rawDescGZIP(), []int{15}\n}", "func (StatusMessage_Reference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1, 0}\n}", "func (Host_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_clickhouse_v1_cluster_proto_rawDescGZIP(), []int{6, 0}\n}", "func (*ClusterResponse) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_index_proto_rawDescGZIP(), []int{8}\n}", "func (*RestartServicesRequest) Descriptor() ([]byte, []int) {\n\treturn file_orc8r_protos_magmad_proto_rawDescGZIP(), []int{9}\n}", "func (CLC_Messages) EnumDescriptor() ([]byte, []int) {\n\treturn file_csgo_netmessages_proto_rawDescGZIP(), []int{1}\n}", "func (*ScheduleDownlinkResponse) Descriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_gatewayserver_proto_rawDescGZIP(), []int{2}\n}", "func (*GetStatsResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{45}\n}", "func (*RefreshNamenodesRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{2}\n}", "func (*PreviewDeleteGameServerClusterResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_gaming_v1beta_game_server_clusters_proto_rawDescGZIP(), []int{8}\n}", "func (Span_SpanKind) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*GetCollectorRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{163}\n}", "func (Cluster_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_clickhouse_v1_cluster_proto_rawDescGZIP(), []int{0, 2}\n}", "func (ClusterCommand_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{1, 0}\n}", "func (*DiagOperation) Descriptor() ([]byte, []int) {\n\treturn file_testvector_tv_proto_rawDescGZIP(), []int{10}\n}", "func (*Listen) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{4}\n}", "func (Span_Link_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{0, 3, 0}\n}", "func (x *fastReflection_AddressBytesToStringResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_AddressBytesToStringResponse\n}", "func (*MemberReceiveAddressDeleteResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{89}\n}", "func (RouteLookupRequest_Reason) EnumDescriptor() ([]byte, []int) {\n\treturn file_grpc_lookup_v1_rls_proto_rawDescGZIP(), []int{0, 0}\n}", "func (*Diagnostic) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicemanagement_v1_resources_proto_rawDescGZIP(), []int{2}\n}", "func (*HelloRsp) Descriptor() ([]byte, []int) {\n\treturn file_helloword_proto_rawDescGZIP(), []int{1}\n}", "func (*SyncLocationRsp) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{1}\n}", "func (*SendResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{27}\n}", "func (*RaftRpcReplyProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{12}\n}", "func (*SemanticTokensLegend) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{215}\n}", "func (*ClusterReq) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{7}\n}", "func (*ChangeInfoRsp) Descriptor() ([]byte, []int) {\n\treturn file_Auth_Auth_proto_rawDescGZIP(), []int{5}\n}", "func (*GetVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{9}\n}", "func (ConfigureStatelessRequest_Cmd) EnumDescriptor() ([]byte, []int) {\n\treturn file_orc8r_protos_magmad_proto_rawDescGZIP(), []int{15, 0}\n}", "func (*RaftRpcRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{10}\n}", "func (*GenerateProductMixIdeasResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{9}\n}", "func (CLC_Messages) EnumDescriptor() ([]byte, []int) {\n\treturn file_netmessages_proto_rawDescGZIP(), []int{1}\n}", "func (*ContractQueryResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{50}\n}", "func (*DisconnectedServicesReq) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{6}\n}", "func (*ListResponse) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{1}\n}", "func (Service_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_clickhouse_v1_cluster_proto_rawDescGZIP(), []int{7, 0}\n}", "func (*SendFromMinerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{26}\n}", "func (*ListenResponse) Descriptor() ([]byte, []int) {\n\treturn file_faultinjector_proto_rawDescGZIP(), []int{9}\n}", "func (*RegisterCloudAgentResponse) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{18}\n}", "func (EUnderDraftResponse) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{11}\n}", "func (x *fastReflection_MsgSetWithdrawAddressResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgSetWithdrawAddressResponse\n}", "func (ClusterStatus) EnumDescriptor() ([]byte, []int) {\n\treturn file_common_proto_rawDescGZIP(), []int{2}\n}", "func (*UpdateGameServerClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_gaming_v1beta_game_server_clusters_proto_rawDescGZIP(), []int{9}\n}", "func (*GetStatisticsBroadcastResponse) Descriptor() ([]byte, []int) {\n\treturn file_services_core_protobuf_servers_proto_rawDescGZIP(), []int{3}\n}", "func (*PerformanceResponse) Descriptor() ([]byte, []int) {\n\treturn file_commissionService_proto_rawDescGZIP(), []int{5}\n}", "func (*UpdateFriendRemarkRsp) Descriptor() ([]byte, []int) {\n\treturn file_v1_friend_friend_proto_rawDescGZIP(), []int{5}\n}", "func (*NetInfoResponse_Peer) Descriptor() ([]byte, []int) {\n\treturn file_resources_proto_rawDescGZIP(), []int{26, 0}\n}", "func (CMsgClientToGCCreatePlayerCardPackResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{217, 0}\n}" ]
[ "0.6898454", "0.67633843", "0.6758483", "0.6746874", "0.6743965", "0.67191446", "0.66340137", "0.66231334", "0.6572636", "0.6567905", "0.6558229", "0.6550756", "0.6548363", "0.65297997", "0.65099263", "0.65075445", "0.6496817", "0.64858085", "0.64842874", "0.6477165", "0.6475513", "0.645865", "0.6450189", "0.6448742", "0.643245", "0.64242333", "0.6419134", "0.64151925", "0.64133644", "0.6409787", "0.64094967", "0.64039683", "0.6399687", "0.6398866", "0.63976514", "0.63938653", "0.63897943", "0.63891894", "0.6388436", "0.63844055", "0.6383178", "0.6379609", "0.6379397", "0.63748395", "0.6374649", "0.6372124", "0.63706404", "0.6367573", "0.63675094", "0.63569736", "0.635491", "0.6351502", "0.6345293", "0.634178", "0.6336906", "0.63360673", "0.6333758", "0.6324927", "0.6324368", "0.6322618", "0.63195217", "0.6315967", "0.63157415", "0.6313903", "0.63127977", "0.6308051", "0.63070905", "0.63040274", "0.6303538", "0.6300831", "0.6300532", "0.6295648", "0.62937266", "0.62921065", "0.6291331", "0.6289534", "0.6288345", "0.62857735", "0.62790966", "0.6276947", "0.62733513", "0.62725365", "0.6271181", "0.6267489", "0.6266212", "0.6264401", "0.6263438", "0.6258668", "0.6256646", "0.6251169", "0.6249095", "0.62485284", "0.6247776", "0.6242372", "0.62417203", "0.62393385", "0.6233339", "0.623208", "0.6231275", "0.6229103" ]
0.7362352
0
Deprecated: Use RegisterNodeReq.ProtoReflect.Descriptor instead.
Устарело: используйте RegisterNodeReq.ProtoReflect.Descriptor вместо этого.
func (*RegisterNodeReq) Descriptor() ([]byte, []int) { return file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{9} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*RegisterClusterNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{2}\n}", "func (*NodeGroupForNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{4}\n}", "func (*SetNodeConfigRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{47}\n}", "func (*RegisterNodeRsp) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{10}\n}", "func (*UpdateNodeDNSRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{49}\n}", "func (*UpgradeNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{24}\n}", "func (*UpdateNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{11}\n}", "func (*GetNodeSelectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_spire_api_registration_registration_proto_rawDescGZIP(), []int{22}\n}", "func (*UpdateNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{6}\n}", "func (*RegisterRequest_SecondaryNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_supernode_proto_rawDescGZIP(), []int{2, 1}\n}", "func (*UpdateNSNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{12}\n}", "func (*InstallNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{22}\n}", "func (*CreateNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{0}\n}", "func (*RegistrationAddReq) Descriptor() ([]byte, []int) {\n\treturn file_registration_proto_rawDescGZIP(), []int{11}\n}", "func (*CreateNSNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{7}\n}", "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{6}\n}", "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_menger_menger_proto_rawDescGZIP(), []int{5}\n}", "func (*UpdateNodeStatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{19}\n}", "func (*InstallNSNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{13}\n}", "func (*RegistrationRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_registration_proto_rawDescGZIP(), []int{0}\n}", "func (*NodeGroupsRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{2}\n}", "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_legacy_upstream_proto_rawDescGZIP(), []int{3}\n}", "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_agency_web_proto_rawDescGZIP(), []int{8}\n}", "func (*UpdateNSNodeStatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{18}\n}", "func (*NodeGroupNodesRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{26}\n}", "func (*SiteRegReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_registration_msgs_proto_rawDescGZIP(), []int{0}\n}", "func (*RegisterRequest_PrimaryNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_supernode_proto_rawDescGZIP(), []int{2, 0}\n}", "func (*RegistrationUpdateReq) Descriptor() ([]byte, []int) {\n\treturn file_registration_proto_rawDescGZIP(), []int{19}\n}", "func (*UpdateNodeSystemRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{58}\n}", "func (*FindEnabledNodeDNSRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{47}\n}", "func (*DeleteNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{9}\n}", "func (*FindEnabledNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{12}\n}", "func (*NodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_workflows_proto_rawDescGZIP(), []int{1}\n}", "func (*RegisterReq) Descriptor() ([]byte, []int) {\n\treturn file_login_proto_rawDescGZIP(), []int{17}\n}", "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_register_proto_rawDescGZIP(), []int{0}\n}", "func (*RenewDelegationTokenRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{5}\n}", "func (*UpdateNodeUpRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{55}\n}", "func (*UpdateNodeConnectedAPINodesRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{30}\n}", "func (*RegisterClusterNodeResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{3}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*AsyncRegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_legacy_upstream_proto_rawDescGZIP(), []int{1}\n}", "func (*RegistrationRequest) Descriptor() ([]byte, []int) {\n\treturn file_cvInterface_proto_rawDescGZIP(), []int{1}\n}", "func (*NotificationRegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_sdk_service_proto_rawDescGZIP(), []int{6}\n}", "func (*UpdateNodeCacheRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{59}\n}", "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{7}\n}", "func (*NodeSelectors) Descriptor() ([]byte, []int) {\n\treturn file_spire_api_registration_registration_proto_rawDescGZIP(), []int{21}\n}", "func (*GetNodesRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{2}\n}", "func (*MessageHubRegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_messagehub_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateNodeLoginRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{42}\n}", "func (*RefreshNamenodesRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{2}\n}", "func (*MemberAddReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{0}\n}", "func (*UpdateNodeIsInstalledRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{21}\n}", "func (*GetNodesRequest) Descriptor() ([]byte, []int) {\n\treturn file_observer_observer_proto_rawDescGZIP(), []int{8}\n}", "func (*Node) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{0}\n}", "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_internal_master_master_server_proto_rawDescGZIP(), []int{2}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*RenameReq) Descriptor() ([]byte, []int) {\n\treturn file_dfs_proto_rawDescGZIP(), []int{4}\n}", "func (*UpdateNSNodeConnectedAPINodesRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{26}\n}", "func (*FindEnabledNSNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{10}\n}", "func (*DeregisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{8}\n}", "func (*UpdateAttestedNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_spire_server_datastore_datastore_proto_rawDescGZIP(), []int{33}\n}", "func (*NodeGroupTemplateNodeInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{31}\n}", "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_supernode_proto_rawDescGZIP(), []int{2}\n}", "func (*StartNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{26}\n}", "func (*GetDelegationTokenRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{3}\n}", "func (*RegistrationGetReq) Descriptor() ([]byte, []int) {\n\treturn file_registration_proto_rawDescGZIP(), []int{15}\n}", "func (*DeleteNodeFromNodeClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{10}\n}", "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_pb_user_user_proto_rawDescGZIP(), []int{3}\n}", "func (*CreateAttestedNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_spire_server_datastore_datastore_proto_rawDescGZIP(), []int{30}\n}", "func (*SharedMemoryControlRequest_Register) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_proto_rawDescGZIP(), []int{6, 0}\n}", "func (*SubscribeRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{17}\n}", "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_apiuser_api_user_v1_user_proto_rawDescGZIP(), []int{0}\n}", "func (*RegisterCloudAgentRequest) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{17}\n}", "func (*UpdateNSNodeIsInstalledRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{17}\n}", "func (*CreateNodePlanningsRequest) Descriptor() ([]byte, []int) {\n\treturn file_alameda_api_v1alpha1_datahub_plannings_services_proto_rawDescGZIP(), []int{4}\n}", "func (*MemberTaskAddReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{117}\n}", "func (*DeleteNSNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{9}\n}", "func (*RegistrationListReq) Descriptor() ([]byte, []int) {\n\treturn file_registration_proto_rawDescGZIP(), []int{23}\n}", "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{5}\n}", "func (*SetNodeGroupsRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{19}\n}", "func (*PacketBrokerRegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_packetbrokeragent_proto_rawDescGZIP(), []int{8}\n}", "func (*ProviderDisregisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_hourglass_v1_provider_proto_rawDescGZIP(), []int{2}\n}", "func (*UpdateNSNodeLoginRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{27}\n}", "func (*StartNSNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{28}\n}", "func (*AddPermissionToRoleRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_role_pb_request_proto_rawDescGZIP(), []int{7}\n}", "func (*NodeGroupForNodeResponse) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{5}\n}", "func (*MemberTagAddReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{108}\n}", "func (*ExternalGrpcNode) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{1}\n}", "func (*Request) Descriptor() ([]byte, []int) {\n\treturn file_register_registerpb_register_proto_rawDescGZIP(), []int{0}\n}", "func (*ProviderRegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_hourglass_v1_provider_proto_rawDescGZIP(), []int{0}\n}", "func (*SelectorVerificationReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_selector_verification_msgs_proto_rawDescGZIP(), []int{0}\n}", "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_githubcard_proto_rawDescGZIP(), []int{9}\n}", "func (*RegistrationParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{64}\n}", "func (*Registration) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{63}\n}", "func (*RenameRequest) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{194}\n}", "func (*RenameRegistrationOptions) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{193}\n}", "func (*MemberLevelAddReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{45}\n}", "func (*ValidateTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_proto_rawDescGZIP(), []int{4}\n}", "func (*RegistrationPayReq) Descriptor() ([]byte, []int) {\n\treturn file_registration_proto_rawDescGZIP(), []int{13}\n}", "func (*CreateNodeGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataproc_v1_node_groups_proto_rawDescGZIP(), []int{0}\n}" ]
[ "0.6880646", "0.6877073", "0.6814076", "0.6804911", "0.67620736", "0.6750105", "0.67320293", "0.6688599", "0.66595477", "0.66334426", "0.6607929", "0.6590114", "0.6576788", "0.6574392", "0.6560336", "0.65601087", "0.65396374", "0.6493717", "0.649143", "0.64790636", "0.64757216", "0.64738816", "0.64598745", "0.64514214", "0.64501405", "0.6445339", "0.6439367", "0.64307123", "0.6423784", "0.64075416", "0.6400095", "0.6396512", "0.6390322", "0.6373391", "0.63598585", "0.63547057", "0.6347056", "0.6342663", "0.63337636", "0.63164693", "0.63137317", "0.62970084", "0.6294383", "0.6293366", "0.6290622", "0.62892264", "0.6287928", "0.62862337", "0.6282152", "0.62777436", "0.6254323", "0.6251453", "0.62485045", "0.6246547", "0.6243493", "0.6242972", "0.6240717", "0.6231083", "0.6228757", "0.6226468", "0.62122065", "0.62113893", "0.6209763", "0.620831", "0.6203343", "0.6202858", "0.62004256", "0.6192907", "0.6191191", "0.6189617", "0.61889195", "0.61866355", "0.61848044", "0.6181929", "0.61800766", "0.61780715", "0.6172771", "0.61716294", "0.6167977", "0.61676496", "0.6166828", "0.61635596", "0.61615044", "0.6159662", "0.61434567", "0.61371195", "0.61360544", "0.6128991", "0.61272675", "0.612572", "0.612197", "0.6117154", "0.61168313", "0.6115889", "0.6111685", "0.61079144", "0.6103386", "0.60951084", "0.6093391", "0.60919833" ]
0.73164415
0
Deprecated: Use RegisterNodeRsp.ProtoReflect.Descriptor instead.
Устарело: используйте RegisterNodeRsp.ProtoReflect.Descriptor вместо этого.
func (*RegisterNodeRsp) Descriptor() ([]byte, []int) { return file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{10} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*RegisterNodeReq) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{9}\n}", "func (*RegisterReply_SecondaryNodeReply) Descriptor() ([]byte, []int) {\n\treturn file_supernode_proto_rawDescGZIP(), []int{3, 1}\n}", "func (*RegisterClusterNodeResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{3}\n}", "func (*NodeGroupForNodeResponse) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{5}\n}", "func (*RegisterRequest_SecondaryNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_supernode_proto_rawDescGZIP(), []int{2, 1}\n}", "func (*Node) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{0}\n}", "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "func (*UpgradeNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{24}\n}", "func (*UpgradeNodeResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{25}\n}", "func (*CreateFriendRsp) Descriptor() ([]byte, []int) {\n\treturn file_v1_friend_friend_proto_rawDescGZIP(), []int{1}\n}", "func (*NodeGroupForNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{4}\n}", "func (*SetNodeConfigRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{47}\n}", "func (*Registration) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{63}\n}", "func (*UpdateNodeDNSRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{49}\n}", "func (*RegisterClusterNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{2}\n}", "func (*RenameRegistrationOptions) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{193}\n}", "func (*RenewDelegationTokenRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{5}\n}", "func (*RenewDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{6}\n}", "func (*RegistResp) Descriptor() ([]byte, []int) {\n\treturn file_proto_register_proto_rawDescGZIP(), []int{1}\n}", "func (*RegistrationReply) Descriptor() ([]byte, []int) {\n\treturn file_grpc_registration_proto_rawDescGZIP(), []int{1}\n}", "func (*RefreshNamenodesResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{3}\n}", "func (*SemanticTokensRegistrationOptions) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{218}\n}", "func (*RegisterResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_menger_menger_proto_rawDescGZIP(), []int{6}\n}", "func (*UpdateNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{11}\n}", "func (*GroupRsp) Descriptor() ([]byte, []int) {\n\treturn file_chatMsg_msg_proto_rawDescGZIP(), []int{6}\n}", "func (*RefreshNamenodesRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{2}\n}", "func (*SiteRegReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_registration_msgs_proto_rawDescGZIP(), []int{0}\n}", "func (*GetOssTokenRsp) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_msg_GetOssToken_proto_rawDescGZIP(), []int{1}\n}", "func (*GetDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{4}\n}", "func (DnsRegMethod) EnumDescriptor() ([]byte, []int) {\n\treturn file_signalling_proto_rawDescGZIP(), []int{1}\n}", "func (*ClusterRsp) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{8}\n}", "func (*CreateNodeResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{1}\n}", "func (*CreateNSNodeResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{8}\n}", "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_menger_menger_proto_rawDescGZIP(), []int{5}\n}", "func (*RegisterResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_agency_web_proto_rawDescGZIP(), []int{9}\n}", "func (*GetRsp) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{1}\n}", "func (*GetDelegationTokenRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{3}\n}", "func (*GetNodeSelectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_spire_api_registration_registration_proto_rawDescGZIP(), []int{22}\n}", "func (*RegistrationParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{64}\n}", "func (*DeregisterResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{9}\n}", "func (*RegistrationRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_registration_proto_rawDescGZIP(), []int{0}\n}", "func (*ProviderDisregisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_hourglass_v1_provider_proto_rawDescGZIP(), []int{2}\n}", "func (*RegisterResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{7}\n}", "func (*SiteRegRes) Descriptor() ([]byte, []int) {\n\treturn file_proto_registration_msgs_proto_rawDescGZIP(), []int{1}\n}", "func (*UpdateNodeResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{7}\n}", "func (*NodeSelectors) Descriptor() ([]byte, []int) {\n\treturn file_spire_api_registration_registration_proto_rawDescGZIP(), []int{21}\n}", "func (*AddPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{30}\n}", "func (*SwitchKeeperRsp) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{6}\n}", "func (NodeType) EnumDescriptor() ([]byte, []int) {\n\treturn file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_rawDescGZIP(), []int{0}\n}", "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "func (*ComposeNSBoardResponse_NodeStat) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_proto_rawDescGZIP(), []int{1, 2}\n}", "func (SetNodeConfigRequest_ConfigType) EnumDescriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{47, 0}\n}", "func (*UpdateNSNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{12}\n}", "func (*DeregisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{8}\n}", "func (*StopNodeResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{29}\n}", "func (*StopNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{28}\n}", "func (*RegisterResp) Descriptor() ([]byte, []int) {\n\treturn file_login_proto_rawDescGZIP(), []int{18}\n}", "func (*GetNodeSelectorsResponse) Descriptor() ([]byte, []int) {\n\treturn file_spire_api_registration_registration_proto_rawDescGZIP(), []int{23}\n}", "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{6}\n}", "func (*UpdateFriendStatusRsp) Descriptor() ([]byte, []int) {\n\treturn file_v1_friend_friend_proto_rawDescGZIP(), []int{3}\n}", "func (*StopNSNodeResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{31}\n}", "func (*UpdateNodeStatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{19}\n}", "func (*ExternalGrpcNode) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{1}\n}", "func (*NodeResponse) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_index_proto_rawDescGZIP(), []int{7}\n}", "func (*SharedMemoryControlRequest_Register) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_proto_rawDescGZIP(), []int{6, 0}\n}", "func (*Unregistration) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{65}\n}", "func (*TypeDefinitionRegistrationOptions) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{132}\n}", "func (*NotificationRegisterResponse) Descriptor() ([]byte, []int) {\n\treturn file_sdk_service_proto_rawDescGZIP(), []int{7}\n}", "func (*UpdateNSNodeStatusRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{18}\n}", "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_internal_master_master_server_proto_rawDescGZIP(), []int{2}\n}", "func (*CreateNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{0}\n}", "func (*RegistrationAddRes) Descriptor() ([]byte, []int) {\n\treturn file_registration_proto_rawDescGZIP(), []int{12}\n}", "func (*StopNSNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{30}\n}", "func (*SemanticTokensLegend) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{215}\n}", "func (*InstallNodeResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{23}\n}", "func (*UpdateNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{6}\n}", "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_agency_web_proto_rawDescGZIP(), []int{8}\n}", "func (*RegisterEdgeAgentResponse) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{16}\n}", "func (*RegisterResponse) Descriptor() ([]byte, []int) {\n\treturn file_internal_master_master_server_proto_rawDescGZIP(), []int{3}\n}", "func (*UpdateNodeSystemRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{58}\n}", "func (*CancelDelegationTokenResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_Security_proto_rawDescGZIP(), []int{8}\n}", "func (*FindEnabledNodeDNSResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{48}\n}", "func (*RegistrationAddReq) Descriptor() ([]byte, []int) {\n\treturn file_registration_proto_rawDescGZIP(), []int{11}\n}", "func (*NodeGroupsRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{2}\n}", "func (*SyncLocationRsp) Descriptor() ([]byte, []int) {\n\treturn file_Assigneer_Assigneer_proto_rawDescGZIP(), []int{1}\n}", "func (*RegisterResponse) Descriptor() ([]byte, []int) {\n\treturn file_register_proto_rawDescGZIP(), []int{1}\n}", "func (*NodeResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_flow_grpc_workflows_proto_rawDescGZIP(), []int{2}\n}", "func (NodeState) EnumDescriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{0}\n}", "func (*CreateNSNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{7}\n}", "func (*RegisterResponse) Descriptor() ([]byte, []int) {\n\treturn file_legacy_upstream_proto_rawDescGZIP(), []int{2}\n}", "func (*NodeGroupsResponse) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{3}\n}", "func (*FindEnabledNodeResponse) Descriptor() ([]byte, []int) {\n\treturn file_service_node_proto_rawDescGZIP(), []int{13}\n}", "func (*MemberReceiveAddressAddResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{82}\n}", "func (*NodeGroup) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{0}\n}", "func (*GetNodeConfigResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{46}\n}", "func (*RegisterReply) Descriptor() ([]byte, []int) {\n\treturn file_supernode_proto_rawDescGZIP(), []int{3}\n}", "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_legacy_upstream_proto_rawDescGZIP(), []int{3}\n}", "func (*CallHierarchyRegistrationOptions) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{208}\n}", "func (*RegisterResponse) Descriptor() ([]byte, []int) {\n\treturn file_auth_svr_proto_rawDescGZIP(), []int{5}\n}", "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_register_proto_rawDescGZIP(), []int{0}\n}" ]
[ "0.65351105", "0.6272938", "0.6221827", "0.6136749", "0.6130905", "0.6119569", "0.61121607", "0.6094849", "0.60934556", "0.6086631", "0.6078589", "0.6075387", "0.6069023", "0.6054839", "0.60497314", "0.6033443", "0.6018209", "0.6007721", "0.59920925", "0.59901917", "0.5986334", "0.5960919", "0.59569865", "0.5955123", "0.5954828", "0.5954109", "0.59480935", "0.5946708", "0.5945324", "0.59443676", "0.59412843", "0.59156376", "0.591277", "0.5902446", "0.5898729", "0.58985555", "0.58943367", "0.58895284", "0.5884065", "0.5883237", "0.58829266", "0.5882104", "0.5875691", "0.58737797", "0.58709365", "0.58695465", "0.58685964", "0.586516", "0.5856571", "0.5855411", "0.5855095", "0.5853296", "0.58518624", "0.5843722", "0.5842851", "0.58401614", "0.58392453", "0.583831", "0.5837858", "0.58240384", "0.582191", "0.5820607", "0.58200234", "0.58135235", "0.58063924", "0.58031493", "0.57914174", "0.5790832", "0.5790085", "0.5789044", "0.57858396", "0.5777367", "0.57768697", "0.5770626", "0.57698184", "0.5767145", "0.5758909", "0.57584965", "0.5753123", "0.57457614", "0.5745498", "0.57453126", "0.57444", "0.57400393", "0.573992", "0.573775", "0.5737218", "0.5734087", "0.57330644", "0.5732063", "0.5729384", "0.5727108", "0.57261825", "0.5725105", "0.57241327", "0.5723691", "0.57219017", "0.5721107", "0.57210106", "0.57196504" ]
0.73833364
0
Deserializes your encoded data to tree.
Десериализует ваше зашифрованное данные в дерево.
func (this *Codec) deserialize(data string) *TreeNode { data = data[1 : len(data)-1] this.data = strings.Split(data, ",") n := this.d() return n }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (this *Codec) deserialize(data string) *TreeNode {\n\tlist := strings.Split(data, \",\")\n\treturn buildTree(&list)\n}", "func (this *Codec) deserialize(data string) *TreeNode {\n\n\tqueue := strings.Split(data, \",\")\n\treturn buildTree(&queue)\n}", "func (this *Codec) deserialize(data string) *TreeNode {\n\ttmp := strings.Split(this.SerializeStr, \",\")\n\treturn d(&tmp)\n}", "func (this *Codec) deserialize(data string) *TreeNode {\n\tif len(data) == 0 {\n\t\treturn nil\n\t}\n\n\tres := strings.Split(data, \",\")\n\troot := &TreeNode{}\n\troot.Val, _ = strconv.Atoi(res[0])\n\tres = res[1:]\n\tqueue := make([]*TreeNode, 0)\n\tqueue = append(queue, root)\n\tfor len(queue) > 0 {\n\t\tif res[0] != \"#\" {\n\t\t\tleftVal, _ := strconv.Atoi(res[0])\n\t\t\tqueue[0].Left.Val = leftVal\n\t\t\tqueue = append(queue, queue[0].Left)\n\t\t}\n\t\tif res[1] != \"#\" {\n\t\t\trightVal, _ := strconv.Atoi(res[1])\n\t\t\tqueue[1].Right.Val = rightVal\n\t\t\tqueue = append(queue, queue[0].Right)\n\t\t}\n\t\tres = res[2:]\n\t\tqueue = queue[1:]\n\t}\n\treturn root\n}", "func (this *Codec) deserialize(data string) *TreeNode { \n list := strings.Split(data, \",\")\n var dfs func() *TreeNode\n dfs = func() *TreeNode {\n val := list[0]\n list = list[1:]\n if val == \"x\" {\n return nil\n }\n Val,_ := strconv.Atoi(val)\n root := &TreeNode{Val: Val}\n root.Left = dfs()\n root.Right = dfs()\n return root\n }\n return dfs()\n}", "func (this *Codec) deserialize(data string) *TreeNode {\n\tstrs := strings.Split(data, this.sep)\n\tpos := 0\n\tvar buildTree func() *TreeNode\n\tbuildTree = func() *TreeNode {\n\t\tval := strs[pos]\n\t\tpos++\n\t\tif val == this.null {\n\t\t\treturn nil\n\t\t}\n\t\tnum, error := strconv.Atoi(val)\n\t\tif error != nil {\n\t\t\tpanic(error)\n\t\t}\n\t\tnode := &TreeNode{Val: num}\n\t\tnode.Left = buildTree()\n\t\tnode.Right = buildTree()\n\t\treturn node\n\t}\n\treturn buildTree()\n}", "func (this *Codec) deserialize(data string) *TreeNode {\n\tstrList := strings.Split(data, \",\")\n\tindex := 0\n\tvar solve func() *TreeNode\n\tsolve = func() *TreeNode {\n\t\tif index >= len(strList) {\n\t\t\treturn nil\n\t\t}\n\t\tif strList[index] == \"$\" {\n\t\t\tindex++\n\t\t\treturn nil\n\t\t}\n\t\tval, _ := strconv.Atoi(strList[index])\n\t\troot := &TreeNode{\n\t\t\tVal: val,\n\t\t}\n\t\tindex++\n\t\troot.Left = solve()\n\t\troot.Right = solve()\n\t\treturn root\n\t}\n\treturn solve()\n}", "func (c *Codec) deserialize(data string) *TreeNode {\n\tl := strings.Split(data, \",\")\n\tfor i := 0; i < len(l); i++ {\n\t\tif l[i] != \"\" {\n\t\t\tc.l = append(c.l, l[i])\n\t\t}\n\t}\n\treturn c.rdeserialize()\n}", "func (this *Codec) deserialize(data string) *TreeNode {\n\tvar root *TreeNode\n\tif len(data) == 0 || data[0] == ' ' {\n\t\treturn root\n\t}\n\tnode := new(TreeNode)\n\troot = node\n\tnode.Val = int(data[0])\n\tqueue := new(Queue)\n\tqueue.EnQueue(node)\n\tfor index := 1; index < len(data); {\n\t\tif !queue.IsEmpty() {\n\t\t\tgenerics := queue.DeQueue()\n\t\t\tswitch t := generics.(type) {\n\t\t\tcase *TreeNode:\n\t\t\t\tif data[index] == ' ' {\n\t\t\t\t\tt.Left = nil\n\t\t\t\t} else {\n\t\t\t\t\tt.Left = new(TreeNode)\n\t\t\t\t\tt.Val = int(data[index])\n\t\t\t\t\tqueue.EnQueue(t.Left)\n\t\t\t\t}\n\t\t\t\tindex++\n\t\t\t\tif index >= len(data) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tif data[index] == ' ' {\n\t\t\t\t\tt.Right = nil\n\t\t\t\t} else {\n\t\t\t\t\tt.Right = new(TreeNode)\n\t\t\t\t\tt.Val = int(data[index])\n\t\t\t\t\tqueue.EnQueue(t.Right)\n\t\t\t\t}\n\t\t\t\tindex++\n\t\t\t}\n\t\t}\n\t}\n\treturn root\n}", "func (this *Codec) deserialize(data string) *TreeNode {\n\n\tif len(data) == 0 {\n\t\treturn nil\n\t}\n\n\tcode := data[1:]\n\tcode = code[:len(code)-1]\n\tnodeStr := strings.Split(code, \",\")\n\tif len(nodeStr) == 0 {\n\t\treturn nil\n\t}\n\n\tif nodeStr[0] == \"null\" {\n\t\treturn nil\n\t}\n\n\tnodes := []*TreeNode{}\n\tv, _ := strconv.Atoi(nodeStr[0])\n\troot := &TreeNode{\n\t\tVal: v,\n\t}\n\tnodes = append(nodes, root)\n\n\tnodeStr = nodeStr[1:]\n\tfor len(nodeStr) > 0 {\n\n\t\tnewNodes := []*TreeNode{}\n\t\tchildNum := 2 * len(nodes)\n\t\tif childNum > len(nodeStr) {\n\t\t\tchildNum = len(nodeStr)\n\t\t}\n\n\t\tfor j := 0; j < childNum; j++ {\n\t\t\tvar curNode *TreeNode\n\t\t\tif nodeStr[j] != \"null\" {\n\t\t\t\tv, _ := strconv.Atoi(nodeStr[j])\n\t\t\t\tcurNode = &TreeNode{\n\t\t\t\t\tVal: v,\n\t\t\t\t}\n\n\t\t\t\tnewNodes = append(newNodes, curNode)\n\t\t\t}\n\n\t\t\tparNode := nodes[j/2]\n\t\t\tif j&1 == 0 {\n\t\t\t\tparNode.Left = curNode\n\t\t\t} else {\n\t\t\t\tparNode.Right = curNode\n\t\t\t}\n\t\t}\n\n\t\tnodeStr = nodeStr[childNum:]\n\t\tnodes = newNodes\n\t}\n\n\treturn root\n}", "func (this *Codec) deserialize(data string) *TreeNode {\n\t// fmt.Println(data)\n\tdata = data[1 : len(data)-1] // remove the \"[]\"\n\telements := strings.Split(data, \",\")\n\n\tif len(elements) < 3 {\n\t\treturn nil\n\t}\n\n\trootVal, _ := strconv.Atoi(elements[0])\n\troot := &TreeNode{\n\t\tVal: rootVal,\n\t}\n\tqueue := []*TreeNode{}\n\tqueue = append(queue, root)\n\n\ti := 1\n\tfor ; i < len(elements); i = i + 2 {\n\t\tparent := queue[0]\n\t\tqueue = queue[1:]\n\n\t\tleft := elements[i]\n\t\tright := elements[i+1]\n\n\t\tif left != NULL_STR {\n\t\t\tleftVal, _ := strconv.Atoi(left)\n\t\t\tleftNode := &TreeNode{\n\t\t\t\tVal: leftVal,\n\t\t\t}\n\t\t\tparent.Left = leftNode\n\t\t\tqueue = append(queue, leftNode)\n\t\t}\n\n\t\tif right != NULL_STR {\n\t\t\trightVal, _ := strconv.Atoi(right)\n\t\t\trightNode := &TreeNode{\n\t\t\t\tVal: rightVal,\n\t\t\t}\n\t\t\tparent.Right = rightNode\n\t\t\tqueue = append(queue, rightNode)\n\t\t}\n\t}\n\n\treturn root\n}", "func (this *Codec) deserialize(data string) *TreeNode {\n\tif len(data) == 0 || data == \"[]\" {\n\t\treturn nil\n\t}\n\n\tarray := strings.Split(data, \",\")\n\tmaps := make(map[int64]int)\n\n\tfor _, v := range array {\n\t\tkeyValueArray := strings.Split(v, \":\")\n\t\tindex, _ := strconv.ParseInt(keyValueArray[0], 10, 64)\n\t\tvalue, _ := strconv.Atoi(keyValueArray[1])\n\t\tmaps[index] = value\n\t}\n\n\troot := TreeNode{\n\t\tVal: maps[1],\n\t\tRight: innerDeserialize(&maps, 3),\n\t\tLeft: innerDeserialize(&maps, 2),\n\t}\n\n\treturn &root\n}", "func (this *Codec) deserialize(data string) *TreeNode {\n\tlist := strings.Split(data, \",\")\n\tfor i := 0; i < len(list); i++ {\n\t\tif list[i] != \"\" {\n\t\t\tthis.list = append(this.list, list[i])\n\t\t}\n\t}\n\treturn this.rdeserialize()\n}", "func (this *Codec) deserialize(data string) *TreeNode {\n\tif len(data) <= 2 {\n\t\treturn nil\n\t}\n\tdata = data[1:len(data)-1]\n\tstrList := strings.Split(data, \",\")\n\tnodes := []*TreeNode{}\n\tfor _, str := range strList{\n\t\tval, _ := strconv.Atoi(str)\n\t\tnodes = append(nodes, &TreeNode{Val:val})\n\t}\n\ti, j := 0, 1\n\tfor j + 2 < len(nodes) {\n\t\tnodes[i].Left = nodes[j]\n\t\tnodes[i].Left = nodes[j+1]\n\t\ti, j = i + 1, j + 2\n\t}\n\treturn nodes[0]\n}", "func (this *Codec) deserialize(data string) *TreeNode {\n\tif data == \"\" {\n\t\treturn nil\n\t}\n\titems := strings.Split(data, \",\")\n\tvalue, _ := strconv.Atoi(items[0])\n\troot := &TreeNode{Val: value}\n\tp := root\n\tqueue := []*TreeNode{root}\n\tfor i := 0; len(queue) != 0; {\n\t\tp = queue[0]\n\t\tqueue = queue[1:]\n\t\ti++\n\t\tif items[i] == \"\" {\n\t\t\tp.Left = nil\n\t\t} else {\n\t\t\tvalue, _ = strconv.Atoi(items[i])\n\t\t\tp.Left = &TreeNode{Val: value}\n\t\t\tqueue = append(queue, p.Left)\n\t\t}\n\t\ti++\n\t\tif items[i] == \"\" {\n\t\t\tp.Right = nil\n\t\t} else {\n\t\t\tvalue, _ = strconv.Atoi(items[i])\n\t\t\tp.Right = &TreeNode{Val: value}\n\t\t\tqueue = append(queue, p.Right)\n\t\t}\n\t}\n\treturn root\n}", "func (this *Codec) deserialize(data string) *TreeNode {\n\ts := strings.Split(data, \",\")\n\tvar traverse func() *TreeNode\n\n\ttraverse = func() *TreeNode {\n\t\tval := s[0]\n\n\t\tif val == \"null\" {\n\t\t\ts = s[1:]\n\t\t\t// 这一步很关键\n\t\t\treturn nil\n\t\t}\n\n\t\tv, _ := strconv.Atoi(val)\n\t\ts = s[1:]\n\n\t\treturn &TreeNode{\n\t\t\tVal: v,\n\t\t\tLeft: traverse(),\n\t\t\tRight: traverse(),\n\t\t}\n\t}\n\n\treturn traverse()\n}", "func (this *Codec) deserialize(data string) *TreeNode {\n\tif len(data) == 0 {\n\t\treturn nil\n\t}\n\tq := strings.Split(data, \" \")\n\tif len(q) == 0 {\n\t\treturn nil\n\t}\n\n\t// 큐 맨 앞값 파악\n\tmin := -1 << 31\n\tmax := 1<<31 - 1\n\treturn _to_BinaryTreeNode(&q, min, max)\n}", "func (this *Codec) deserialize(data string) *TreeNode {\n\tif data == \"\" {\n\t\treturn nil\n\t}\n\tans := strings.Split(data, \",\")\n\n\tvar i = new(int)\n\t*i = 0\n\treturn deserialize(&ans, i)\n}", "func (this *Codec) deserialize(data string) *TreeNode {\n\tc := strings.Split(data, \",\")\n\n\tif len(data) == 0 {\n\t\treturn nil\n\t}\n\n\tt := &TreeNode{Val: myAtoi(c[0])}\n\tqueue := []*TreeNode{t}\n\n\ti := 1\n\tfor len(queue) > 0 {\n\t\tl := len(queue)\n\t\tfor j := 0; j < l; j++ {\n\t\t\tif c[i] == \"nil\" {\n\t\t\t\tqueue[j].Left = nil\n\t\t\t} else {\n\t\t\t\tqueue[j].Left = &TreeNode{Val: myAtoi2(c[i])}\n\t\t\t\tqueue = append(queue, queue[j].Left)\n\t\t\t}\n\t\t\ti++\n\t\t\tif c[i] == \"nil\" {\n\t\t\t\tqueue[j].Right = nil\n\t\t\t} else {\n\t\t\t\tqueue[j].Right = &TreeNode{Val: myAtoi2(c[i])}\n\t\t\t\tqueue = append(queue, queue[j].Right)\n\t\t\t}\n\t\t\ti++\n\t\t}\n\t\tqueue = queue[l:]\n\t}\n\treturn t\n}", "func (this *Codec) deserialize(data string) *TreeNode {\n\tints := strings.Split(data, \",\")\n\n\treturn dHelper(&ints)\n}", "func (ths *TreeHashStack) Deserialize(data []byte) error {\n\treturn gob.NewDecoder(bytes.NewBuffer(data)).Decode(ths)\n}", "func (this *Codec) deserialize(data string) *TreeNode { \n l:=strings.Split(data,\",\")\n for i:=0;i<len(l);i++{\n if l[i]!=\"\"{\n this.l=append(this.l,l[i])\n }\n }\n fmt.Println(this.l)\n return this.helpDeserialize()\n}", "func (this *Codec) deserialize1(data string) *TreeNode {\n\tc := strings.Split(data, \",\")\n\n\tif len(data) == 0 {\n\t\treturn nil\n\t}\n\n\tt := &TreeNode{Val: myAtoi(c[0])}\n\tqueue := []*TreeNode{t}\n\n\ti := 1\n\tfor len(queue) > 0 {\n\t\tl := len(queue)\n\t\tfor j := 0; j < l; j++ {\n\t\t\tif c[i] == \"nil\" {\n\t\t\t\tqueue[j].Left = nil\n\t\t\t} else {\n\t\t\t\tqueue[j].Left = &TreeNode{Val: myAtoi(c[i])}\n\t\t\t\tqueue = append(queue, queue[j].Left)\n\t\t\t}\n\t\t\ti++\n\t\t\tif c[i] == \"nil\" {\n\t\t\t\tqueue[j].Right = nil\n\t\t\t} else {\n\t\t\t\tqueue[j].Right = &TreeNode{Val: myAtoi(c[i])}\n\t\t\t\tqueue = append(queue, queue[j].Right)\n\t\t\t}\n\t\t\ti++\n\t\t}\n\t\tqueue = queue[l:]\n\t}\n\treturn t\n}", "func (c *Codec) deserialize(data string) *TreeNode {\n\tif len(data) < 2 {\n\t\treturn nil\n\t}\n\tif data[0] != '[' && data[len(data)-1] != ']' {\n\t\treturn nil\n\t}\n\tdata = data[1 : len(data)-1]\n\n\tvar nums []*int\n\tfor _, s := range strings.Split(data, \",\") {\n\t\tif s == \"null\" {\n\t\t\tnums = append(nums, nil)\n\t\t} else {\n\t\t\tnum, err := strconv.Atoi(s)\n\t\t\tif err == nil {\n\t\t\t\tnums = append(nums, &num)\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(nums) == 0 {\n\t\treturn nil\n\t}\n\n\tif nums[0] == nil {\n\t\treturn nil\n\t}\n\tvar root = &TreeNode{Val: *nums[0]}\n\tvar q []*TreeNode\n\tq = append(q, root)\n\n\tfor i := 1; len(q) != 0; {\n\t\tcurr := q[0]\n\n\t\tif curr != nil {\n\t\t\tvar left, right *int\n\t\t\tif i < len(nums) {\n\t\t\t\tleft = nums[i]\n\t\t\t\tif i+1 < len(nums) {\n\t\t\t\t\tright = nums[i+1]\n\t\t\t\t}\n\t\t\t\ti += 2\n\t\t\t}\n\t\t\tif left != nil {\n\t\t\t\tcurr.Left = &TreeNode{\n\t\t\t\t\tVal: *left,\n\t\t\t\t}\n\t\t\t\tq = append(q, curr.Left)\n\t\t\t}\n\t\t\tif right != nil {\n\t\t\t\tcurr.Right = &TreeNode{\n\t\t\t\t\tVal: *right,\n\t\t\t\t}\n\t\t\t\tq = append(q, curr.Right)\n\t\t\t}\n\t\t}\n\n\t\tq = q[1:]\n\t}\n\n\treturn root\n}", "func DecodeTree(na ipld.NodeAssembler, rd *bufio.Reader) error {\n\tif _, err := readNullTerminatedNumber(rd); err != nil {\n\t\treturn err\n\t}\n\n\tt := Type.Tree__Repr.NewBuilder()\n\tma, err := t.BeginMap(-1)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor {\n\t\tname, node, err := DecodeTreeEntry(rd)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tee, err := ma.AssembleEntry(name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err = ee.AssignNode(node); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := ma.Finish(); err != nil {\n\t\treturn err\n\t}\n\treturn na.AssignNode(t.Build())\n}", "func (this *Codec) deserializeV2(data string) *TreeNode {\n\n\tif data==\"null\" {\n\t\treturn nil\n\t}\n\tlist :=strings.Split(data,\",\")// 序列化字符串split成数组\n\tval, _ := strconv.Atoi(list[0])\n\troot :=&TreeNode{Val: val} // 构建根节点\n\tqueue :=[]*TreeNode{}\n\tqueue=append(queue,root) // 根节点入队列\n\tcursor :=1 // data指向下一个节点\n\tfor cursor<len(list) {\n\t\tnode :=queue[0]\n\t\tqueue=queue[1:] // 出队列\n\t\tleftVal :=list[cursor]\n\t\trightVal:=list[cursor+1]\n\t\tif leftVal!=\"null\" { // 如果左子节点val 不为空 入队列\n\t\t\tVal, _ := strconv.Atoi(leftVal)\n\t\t\tleftNode:=&TreeNode{Val: Val}\n\t\t\tnode.Left=leftNode\n\t\t\tqueue=append(queue,leftNode)\n\t\t}\n\n\t\tif rightVal!=\"null\" { // 如果右子节点val 不为空入队列\n\t\t\tVal, _ := strconv.Atoi(rightVal)\n\t\t\trightNode :=&TreeNode{Val: Val}\n\t\t\tnode.Right=rightNode\n\t\t\tqueue=append(queue,rightNode)\n\t\t}\n\t\tcursor+=2\n\t}\n\treturn root\n}", "func main() {\n\troot := &TreeNode{\n\t\tVal: 2,\n\t\tLeft: &TreeNode{\n\t\t\tVal: 1,\n\t\t},\n\t\tRight: &TreeNode{\n\t\t\tVal: 3,\n\t\t},\n\t}\n\tprintTreeNodeByDFS(root)\n\tfmt.Println()\n\n\tser := Constructor()\n\ttreeString := ser.serialize(root)\n\tfmt.Println(treeString)\n\tans := ser.deserialize(treeString)\n\t// printTreeNodeByBFS(ans)\n\tprintTreeNodeByDFS(ans)\n\tfmt.Println()\n}", "func decodeV1(data string) (tree.Tree, error) {\n\tvar storage fsStorage\n\tb, err := base64.StdEncoding.DecodeString(data)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"decoding base64\")\n\t}\n\tvar r io.ReadCloser\n\tr, err = gzip.NewReader(bytes.NewReader(b))\n\tif err != nil {\n\t\t// Fallback to non-zipped version.\n\t\tlog.Printf(\n\t\t\t\"Decoding gzip: %s. Falling back to non-gzip loading.\",\n\t\t\terr)\n\t\tr = ioutil.NopCloser(bytes.NewReader(b))\n\t}\n\tdefer r.Close()\n\terr = gob.NewDecoder(r).Decode(&storage)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"decoding gob\")\n\t}\n\tt := make(tree.Tree)\n\tfor dir := range storage.Dirs {\n\t\tt.AddDir(dir)\n\t}\n\tfor path, content := range storage.Files {\n\t\tt.AddFileContent(path, content)\n\t}\n\treturn t, err\n}", "func (leaf *Node) Decode() ([]byte, error) {\n\tif len(leaf.ContentEncoding) == 0 {\n\t\tleaf.plainv = leaf.V\n\t\treturn leaf.plainv, nil\n\t}\n\n\tleaf.plainv = leaf.plainv[:0]\n\n\tif leaf.ContentEncoding == EncodingGzip {\n\t\tr, err := gzip.NewReader(bytes.NewReader(leaf.V))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tbuf := make([]byte, 1024)\n\t\tfor {\n\t\t\tn, err := r.Read(buf)\n\t\t\tif n > 0 {\n\t\t\t\tleaf.plainv = append(leaf.plainv, buf[:n]...)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tbuf = buf[0:]\n\t\t}\n\t}\n\n\treturn leaf.plainv, nil\n}", "func decodeTree(r *bitio.Reader, nTree byte) (root *Node, err error) {\n\tvar head Node\n\tvar nodes byte\n\tvar leaves byte\n\tvar u uint64\n\n\tfor nodes < nTree {\n\t\tu, err = r.ReadBits(1)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif u == 1 {\n\t\t\tleaves++\n\t\t\tsymbol, err := r.ReadBits(8)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tnode := &Node{value: byte(symbol)}\n\t\t\thead.pushBack(node)\n\t\t}\n\n\t\tif u == 0 {\n\t\t\tnodes++\n\t\t\tif nodes == nTree {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tr := head.popLast()\n\t\t\tl := head.popLast()\n\t\t\tnode := join(l, r)\n\t\t\thead.pushBack(node)\n\t\t}\n\t}\n\n\tif nodes != leaves {\n\t\terr = errors.New(\"nodes != leaves\")\n\t}\n\n\treturn head.next, err\n}", "func (n *Node) Unmarshal(encoded []byte) error {\n\tvar pbn pb.PBNode\n\tif err := pbn.Unmarshal(encoded); err != nil {\n\t\treturn fmt.Errorf(\"Unmarshal failed. %v\", err)\n\t}\n\n\tpbnl := pbn.GetLinks()\n\tn.Links = make([]*Link, len(pbnl))\n\tfor i, l := range pbnl {\n\t\tn.Links[i] = &Link{Name: l.GetName(), Size: l.GetTsize()}\n\t\th, err := mh.Cast(l.GetHash())\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Link hash is not valid multihash. %v\", err)\n\t\t}\n\t\tn.Links[i].Hash = h\n\t}\n\tsort.Stable(LinkSlice(n.Links)) // keep links sorted\n\n\tn.Data = pbn.GetData()\n\treturn nil\n}", "func (s *NodeKeySignature) Unserialize(data []byte) error {\n\tdec, _ := cborDecOpts.DecMode()\n\treturn dec.Unmarshal(data, s)\n}", "func main() {\n\troot := TreeNode{\n\t\tVal: 1,\n\t\tLeft: &TreeNode{\n\t\t\tVal: 2,\n\t\t\tLeft: nil,\n\t\t\tRight: nil,\n\t\t},\n\t\tRight: &TreeNode{\n\t\t\tVal: 3,\n\t\t\tLeft: &TreeNode{\n\t\t\t\tVal: 4,\n\t\t\t\tRight: nil,\n\t\t\t\tLeft: nil,\n\t\t\t},\n\t\t\tRight: &TreeNode{\n\t\t\t\tVal: 5,\n\t\t\t\tRight: nil,\n\t\t\t\tLeft: nil,\n\t\t\t},\n\t\t},\n\t}\n\tobj := Constructor()\n\tdata := obj.serialize(&root)\n\tfmt.Println(data)\n}", "func (d *decoder) createTree() *node {\n\tif val, _ := readBit(d.r); val {\n\t\treturn &node{readByte(d.r), -1, false, nil, nil}\n\t} else if d.numChars != d.numCharsDecoded {\n\t\tleft := d.createTree()\n\t\tright := d.createTree()\n\t\treturn &node{0, -1, true, left, right}\n\t}\n\n\treturn nil\n}", "func (n *Node) UnmarshalJSON(byteData []byte) error {\n\tvar node struct {\n\t\tLeft *Node\n\t\tRight *Node\n\t\tHash []byte\n\t\tC json.RawMessage\n\t\ttree *MerkleTree\n\t\tparent *Node\n\t\tleaf bool\n\t\tDup bool\n\t}\n\tif err := json.Unmarshal(byteData, &node); err != nil {\n\t\treturn err\n\t}\n\tn.Left = node.Left\n\tn.Right = node.Right\n\tn.Hash = node.Hash\n\tn.tree = node.tree\n\tn.parent = node.parent\n\tn.leaf = node.leaf\n\tn.Dup = node.Dup\n\n\t// Check how to cast Content C\n\tif len(node.C) > 0 && string(node.C) != `null` {\n\n\t\tvar _type struct {\n\t\t\tType string `json:\"_type\"`\n\t\t}\n\t\tif err := json.Unmarshal([]byte(node.C), &_type); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tc := newContent[_type.Type]()\n\n\t\tif err := json.Unmarshal([]byte(node.C), c); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tn.C = c\n\n\t}\n\treturn nil\n}", "func (this *Codec) serialize(root *TreeNode) string {\n\tthis.s(root)\n\treturn \"[\" + strings.Join(this.data, \",\") + \"]\"\n}", "func (n *Node) Unmarshal(data []byte) error {\n\treturn json.Unmarshal(data, n)\n}", "func Decoded(encoded []byte) (*Node, error) {\n\tn := new(Node)\n\terr := n.Unmarshal(encoded)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"incorrectly formatted merkledag node: %s\", err)\n\t}\n\treturn n, nil\n}", "func Decode(f filetree.FileTree) (*Data, error) {\n\tdata := &Data{\n\t\tIdentities: make(map[string]Identity),\n\t\tNumbers: make(map[string]Numbers),\n\t}\n\n\tdirs := [...]string{\n\t\t\"common/main\",\n\t\t\"common/supplemental\",\n\t}\n\tfor _, dir := range dirs {\n\t\terr := f.Walk(dir, func(path string, r io.Reader) error {\n\t\t\treturn decodeXML(path, r, data.decode)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn data, nil\n}", "func (decTree *Tree) ReadTree(filename string) error {\n\tfile, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\tfmt.Println(\"Error opening input file: \", filename)\n\t\treturn err\n\t}\n\n\tsDat := fmt.Sprintf(\"%s\", file)\n\tdatLines := strings.Split(sDat, \"\\n\")\n\n\tcurrNode := decTree\n\tvar treeStack []*Tree\n\ttreeLen := 1\n\tlastNode := false\n\n\tfor _, line := range datLines {\n\t\tif !lastNode {\n\t\t\tcurrNode.Details.Leaf, currNode.Details.IndexSplit, currNode.Details.SplitVal, currNode.Details.Class, err = parseLine(line)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif currNode.Details.Leaf == false {\n\t\t\t\tcurrNode.Left = new(Tree)\n\t\t\t\tcurrNode.Right = new(Tree)\n\n\t\t\t\ttreeStack = append(treeStack, currNode.Right)\n\t\t\t\tcurrNode = currNode.Left\n\t\t\t\ttreeLen++\n\t\t\t} else {\n\t\t\t\ttreeLen--\n\t\t\t\tif treeLen > 0 {\n\t\t\t\t\tcurrNode, treeStack = treeStack[treeLen-1], treeStack[:treeLen-1]\n\t\t\t\t} else {\n\t\t\t\t\tlastNode = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (pd *pymtData) Deserialize(b []byte) error {\n\terr := json.Unmarshal(b, pd)\n\tif err != nil {\n\t\treturn errors.Wrap(err, ErrInvalidFormatBlob)\n\t}\n\n\treturn nil\n}", "func (s *Node) Unmarshal(val []byte) (err error) {\n\terr = json.Unmarshal(val, s)\n\treturn\n}", "func (sig *MerkleSig) Deserialize(data []byte) error {\n\tbuf := bytes.NewBuffer(data)\n\tdec := gob.NewDecoder(buf)\n\n\treturn dec.Decode(sig)\n}", "func LoadTree(jsonTree []byte) (*Tree, error) {\n\tvar trees []Tree\n\terr := json.Unmarshal(jsonTree, &trees)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn CreateTree(trees), nil\n}", "func Deserialize(data []byte, typ string, registry Registry) (interface{}, error) {\n\tif len(data) == 0 {\n\t\treturn nil, nil\n\t}\n\tserde, err := registry.GetSerde(typ)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn serde.Deserialize(data)\n}", "func (this *Codec) serialize(root *TreeNode) string {\n\tnodeValues := []int{}\n\t// preoder 노드 탐색\n\t_to_string(root, &nodeValues)\n\n\t// 노드 값을 공백으로 구분한 스트링으로 리턴\n\tr := \"\"\n\tfor i := 0; i < len(nodeValues); i++ {\n\t\tr += fmt.Sprintf(\"%d \", nodeValues[i])\n\t}\n\treturn strings.TrimSpace(r)\n}", "func (d *decoder) decodeHeader() {\n\t// first byte is the number of leaf nodes\n\td.numChars = uint8(readByte(d.r))\n\n\t// read in the total number of characters in the encoded data\n\tbuf := make([]byte, 2)\n\tbuf[0] = readByte(d.r)\n\tbuf[1] = readByte(d.r)\n\n\td.numCharsEncoded = binary.LittleEndian.Uint16(buf)\n\n\t// deserialize the tree\n\td.root = d.createTree()\n}", "func Deserialize(registerValue interface{}, data []byte, targetPointer interface{}) error {\n\tif registerValue != nil {\n\t\tgob.Register(registerValue)\n\t}\n\tdecoder := gob.NewDecoder(bytes.NewReader(data))\n\terr := decoder.Decode(targetPointer)\n\n\treturn err\n}", "func (n *HostNode) Decode(data []byte) error {\n\tif err := ffjson.Unmarshal(data, n); err != nil {\n\t\tlogrus.Error(\"decode node info error:\", err.Error())\n\t\treturn err\n\t}\n\treturn nil\n}", "func (d *Dao) Tree(c context.Context, token string) (data interface{}, err error) {\n\tvar (\n\t\treq *http.Request\n\t\ttmp map[string]interface{}\n\t\tok bool\n\t)\n\tif req, err = http.NewRequest(\"GET\", dataURI, nil); err != nil {\n\t\tlog.Error(\"Status url(%s) error(%v)\", dataURI, err)\n\t\treturn\n\t}\n\treq.Header.Set(\"X-Authorization-Token\", token)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tvar res struct {\n\t\tCode int `json:\"code\"`\n\t\tData map[string]map[string]interface{} `json:\"data\"`\n\t\tMessage string `json:\"message\"`\n\t\tStatus int `json:\"status\"`\n\t}\n\tif err = d.client.Do(c, req, &res); err != nil {\n\t\tlog.Error(\"d.Status url(%s) res($s) err(%v)\", dataURI, res, err)\n\t\treturn\n\t}\n\tif res.Code != 90000 {\n\t\terr = fmt.Errorf(\"error code :%d\", res.Code)\n\t\tlog.Error(\"Status url(%s) res(%v)\", dataURI, res)\n\t\treturn\n\t}\n\tif tmp, ok = res.Data[\"bilibili\"]; ok {\n\t\tdata, ok = tmp[\"children\"]\n\t}\n\tif !ok {\n\t\terr = ecode.NothingFound\n\t}\n\treturn\n}", "func CalTree(data [][]byte) {\r\n\tvar Root Node\r\n\tRoot.GenerateRoot(data, true)\r\n}", "func (this *Codec) serialize(root *TreeNode) string {\n\treturn this.rserialize(root, \"\")\n}", "func Unserialize(data []byte, v interface{}) error {\n\treturn gob.NewDecoder(bytes.NewBuffer(data)).Decode(v)\n}", "func DecodeTreeEntry(rd *bufio.Reader) (string, ipld.Node, error) {\n\tdata, err := rd.ReadString(' ')\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\tdata = data[:len(data)-1]\n\n\tname, err := rd.ReadString(0)\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\tname = name[:len(name)-1]\n\n\tsha := make([]byte, 20)\n\t_, err = io.ReadFull(rd, sha)\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\tte := _TreeEntry{\n\t\tmode: _String{data},\n\t\thash: _Link{cidlink.Link{Cid: shaToCid(sha)}},\n\t}\n\treturn name, &te, nil\n}", "func (n *Node) Unmarshal(_ string, data []byte) error {\n\tnewNode := Node{}\n\tif err := json.Unmarshal(data, &newNode); err != nil {\n\t\treturn err\n\t}\n\n\tif err := newNode.validate(); err != nil {\n\t\treturn err\n\t}\n\n\t*n = newNode\n\n\treturn nil\n}", "func unconvertData(data []byte) interface{} {\n\tif data == nil || string(data) == \"\" {\n\t\treturn nil\n\t}\n\n\tvar proto interface{}\n\tresult, err := serial.Deserialize(data, proto, serial.PERSISTENT)\n\tif err != nil {\n\t\tlog.Fatal(\"Persistent Deserialization Failed\", \"err\", err, \"data\", data)\n\t}\n\treturn result\n}", "func (c *Codec) serialize(root *TreeNode) string {\n\treturn rserialize(root, \"\")\n}", "func (c *CheckboxBase) Deserialize(d page.Decoder) {\n\tc.ControlBase.Deserialize(d)\n\n\tif err := d.Decode(&c.checked); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := d.Decode(&c.LabelMode); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := d.Decode(&c.labelAttributes); err != nil {\n\t\tpanic(err)\n\t}\n}", "func (n *Node) UnmarshalJSON(b []byte) error {\n\ttype proxy struct {\n\t\tID string `json:\"id\"`\n\t\tValue *Value `json:\"value,omitempty\"`\n\t\tStatus map[string]interface{} `json:\"status\"`\n\t\tChildren map[string]*Node `json:\"children\"`\n\t}\n\n\tp := &proxy{}\n\n\tdec := json.NewDecoder(bytes.NewBuffer(b))\n\tdec.UseNumber()\n\terr := dec.Decode(p)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tn.id = p.ID\n\tn.value = p.Value\n\tn.status = p.Status\n\tn.children = p.Children\n\n\treturn nil\n}", "func (this *Codec) serialize(root *TreeNode) string {\n\treturn dfsSerial(root, \"\")\n}", "func Decode(r io.Reader, data interface{}) error {\n\tmeta, err := toml.DecodeReader(r, data)\n\tif undecoded := meta.Undecoded(); undecoded != nil && len(undecoded) > 0 {\n\t\tlog.Infoln(\"toml.Decode:\", \"undecoded keys exist,\", undecoded)\n\t}\n\treturn err\n}", "func Decompress(file *os.File, outputName string) {\n\t// Ler Árvore (Reconstruir)\n\treader := bit.NewReader(file)\n\troot := readTree(reader)\n\tif root == nil {\n\t\tpanic(\"Árvore nula!\")\n\t}\n\t// Decodificar percorrendo a arvore\n\tif root.IsLeaf() {\n\t\tnodeHelper := tree.New(\"\", nil, nil)\n\t\tnodeHelper.Left = root\n\t\troot = nodeHelper\n\t}\n\tdecodeFile(reader, outputName, root)\n}", "func (prkg *KeyIterator) Deserialize(data []byte) error {\n\treturn gob.NewDecoder(bytes.NewBuffer(data)).Decode(prkg)\n}", "func (t *TableNode) UnmarshalJSON(data []byte) error {\n\tm := &tableNode{}\n\terr := json.Unmarshal(data, m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.UID = m.UID\n\tt.Word = []rune(m.Word)\n\tt.PUID = m.PUID\n\tt.Name = m.Name\n\tt.Children = m.Children\n\tt.Resolved = m.Resolved\n\tt.DefaultDateFieldUID = m.DefaultDateFieldUID\n\tt.DefaultDateField = m.DefaultDateField\n\tt.Description = m.Description\n\tt.DatastoreID = m.DatastoreID\n\treturn nil\n}", "func (w *RootWalker) DeserializeFromRef(ref skyobject.Reference, p interface{}) error {\n\tif w.r == nil {\n\t\treturn ErrRootNotFound\n\t}\n\tdata, got := w.r.Get(ref)\n\tif !got {\n\t\treturn ErrObjNotFound\n\t}\n\treturn encoder.DeserializeRaw(data, p)\n}", "func (v *FrameTree) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeGithubComChromedpCdprotoPage61(&r, v)\n\treturn r.Error()\n}", "func DeserializeTransaction(data []byte) Transaction {\n\tvar transaction Transaction\n\n\tdec := gob.NewDecoder(bytes.NewReader(data))\n\terr := dec.Decode(&transaction)\n\tHandle(err)\n\n\treturn transaction\n}", "func (id *NodeID) Unmarshal(data []byte) error {\n\tvar err error\n\t*id, err = NodeIDFromBytes(data)\n\treturn err\n}", "func (e EmptyNode) DecodeBinary(*io.BinReader) {\n}", "func Deserialize(data []byte, value interface{}) error {\n\treturn rlp.DecodeBytes(data, value)\n}", "func (q *Quote) Deserialize(b []byte) error {\n\tbuf := bytes.NewBuffer(b)\n\tdec := gob.NewDecoder(buf)\n\terr := dec.Decode(q)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Deserialize: decoding failed for %s\", b)\n\t}\n\treturn nil\n}", "func (this *Codec) serialize(root *TreeNode) string {\n\tstrs := make([]string, 0)\n\tvar preorder func(*TreeNode)\n\tpreorder = func(node *TreeNode) {\n\t\tif node == nil {\n\t\t\tstrs = append(strs, this.null)\n\t\t\treturn\n\t\t}\n\n\t\tstrs = append(strs, strconv.Itoa(node.Val))\n\t\tpreorder(node.Left)\n\t\tpreorder(node.Right)\n\t}\n\tpreorder(root)\n\treturn strings.Join(strs, this.sep)\n}", "func NewMerkelTree(data [][]byte) *MerkelTree {\n\tvar nodes []MerkelNode\n\tif len(data)%2 != 0 {\n\t\tdata = append(data, data[len(data)-1])\n\t}\n\tfor _, dat := range data {\n\t\ttemp := NewMerkelNode(nil, nil, dat)\n\t\tnodes = append(nodes, *temp)\n\t}\n\tfor i := 0; i < len(data)/2; i++ {\n\t\tvar lvl []MerkelNode\n\t\tfor j := 0; j < len(nodes); j += 2 {\n\t\t\ttemp := NewMerkelNode(&nodes[j], &nodes[j+1], nil)\n\t\t\tlvl = append(lvl, *temp)\n\t\t}\n\t\tnodes = lvl\n\t}\n\tmkltree := MerkelTree{&nodes[0]}\n\treturn &mkltree\n}", "func (this *Codec) serialize(root *TreeNode) string {\n if root == nil {\n return \"x\"\n }\n return strconv.Itoa(root.Val) + \",\" + this.serialize(root.Left)+ \",\" + this.serialize(root.Right)\n}", "func (i *IpldRawNode) Tree(p string, depth int) []string {\n\treturn nil\n}", "func (this *Codec) serialize(root *TreeNode) string {\n\ttmp := []string{}\n\ts(root, &tmp)\n\tthis.SerializeStr = strings.Join(tmp, \",\")\n\treturn this.SerializeStr\n}", "func (txn *Transaction) Deserialize(gobdata utils.Gob) {\n\t// Decode the gob data into the blockheader\n\tutils.GobDecode(gobdata, txn)\n}", "func (t *Trie) UnmarshalJSON(data []byte) error {\n\tm := marshalTrie{t.m}\n\terr := json.Unmarshal(data, &m)\n\tt.m = m.M\n\treturn err\n}", "func Decode(tomlBlob string, target interface{}) error {\n\tsreader := strings.NewReader(tomlBlob)\n\tdecoder := toml.NewDecoder(sreader)\n\terr := decoder.Decode(target)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func DeserializeForest(d []byte) (*Forest, error) {\n\tslice, err := serializer.DeserializeSlice(d)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(slice) < 1 {\n\t\treturn nil, errors.New(\"invalid Forest slice\")\n\t}\n\tintVal, ok := slice[0].(serializer.Int)\n\tif !ok {\n\t\treturn nil, errors.New(\"invalid Forest slice\")\n\t}\n\tvar res Forest\n\tres.Bigraph = intVal == 1\n\tfor _, t := range slice[1:] {\n\t\ttree, ok := t.(*treeSerializer)\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"invalid Forest slice\")\n\t\t}\n\t\tres.Forest = append(res.Forest, tree.Tree())\n\t}\n\treturn &res, nil\n}", "func (tree *Tree) ConstructTree(details *pb.MetricDetailsResponse) error {\n\talreadyVisited := []*caching.Node{}\n\troot, err := tree.GetNode(tree.RootName)\n\tif err != nil {\n\t\treturn err\n\t}\n\t//cycles on all the metrics of the details response.\n\t//For each metric it splits the metric name into dot separated elements. Each\n\t//element will represent a node in the tree structure.\n\t//\n\t//All the nodes will have initial Size = 0\n\tfor metric, data := range details.Metrics {\n\t\tparts := strings.Split(metric, \".\")\n\t\tleafIndex := len(parts) - 1\n\n\t\talreadyVisited = []*caching.Node{root}\n\n\t\tfor currentIndex := 0; currentIndex <= leafIndex; currentIndex++ {\n\t\t\tcurrentName := strings.Join(parts[0:currentIndex+1], \".\")\n\t\t\tif val, _ := tree.GetNodeFromRoot(currentName); val != nil {\n\t\t\t\talreadyVisited = append(alreadyVisited, val)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif currentIndex == leafIndex {\n\t\t\t\tfor index, node := range alreadyVisited {\n\t\t\t\t\tif index != len(alreadyVisited)-1 {\n\t\t\t\t\t\tnode.Leaf = false\n\t\t\t\t\t}\n\t\t\t\t\tnode.Size += data.Size_\n\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tcurrentNode := &caching.Node{\n\t\t\t\tName: tree.RootName + \".\" + currentName,\n\t\t\t\tChildren: []*caching.Node{},\n\t\t\t\tLeaf: true,\n\t\t\t\tSize: int64(0),\n\t\t\t}\n\n\t\t\ttree.AddNode(currentName, currentNode)\n\t\t\ttree.AddChild(alreadyVisited[len(alreadyVisited)-1], currentNode)\n\n\t\t\talreadyVisited = append(alreadyVisited, currentNode)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (dt *Depth) UnmarshalBinary(data []byte) (int, error) {\n\t*dt = Depth(binary.LittleEndian.Uint16(data[0:DepthSize]))\n\treturn DepthSize, nil\n}", "func (this *Codec) serialize(root *TreeNode) string {\n\tif root == nil {\n\t\treturn \"\"\n\t}\n\tans := make([]string, 0, 10)\n\tserialize(root, &ans)\n\n\treturn strings.Join(ans, \",\")\n}", "func (this *Codec) serialize(root *TreeNode) string {\n\n\tif root == nil {\n\t\treturn \"[null]\"\n\t}\n\n\tnodes := []*TreeNode{root}\n\tcode := \"[\" + strconv.Itoa(root.Val)\n\n\tfor len(nodes) > 0 {\n\t\tnewNodes := []*TreeNode{}\n\n\t\tfor i := range nodes {\n\n\t\t\tif nodes[i].Left != nil {\n\t\t\t\tnewNodes = append(newNodes, nodes[i].Left)\n\t\t\t\tcode = code + \",\" + strconv.Itoa(nodes[i].Left.Val)\n\t\t\t} else {\n\t\t\t\tcode = code + \",null\"\n\t\t\t}\n\n\t\t\tif nodes[i].Right != nil {\n\t\t\t\tnewNodes = append(newNodes, nodes[i].Right)\n\t\t\t\tcode = code + \",\" + strconv.Itoa(nodes[i].Right.Val)\n\t\t\t} else {\n\t\t\t\tcode = code + \",null\"\n\t\t\t}\n\n\t\t}\n\n\t\tnodes = newNodes\n\n\t}\n\tcode = code + \"]\"\n\treturn code\n}", "func (this *Codec) serialize(root *TreeNode) string {\n\ts := \"\"\n\n\tif root == nil {\n\t\treturn s\n\t}\n\n\ts = s + strconv.Itoa(root.Val)\n\n\tif root.Left != nil {\n\t\ts = s + \",\" + this.serialize(root.Left)\n\t} else {\n\t\ts = s + \",\" + \"null\"\n\t}\n\n\tif root.Right != nil {\n\t\ts = s + \",\" + this.serialize(root.Right)\n\t} else {\n\t\ts = s + \",\" + \"null\"\n\t}\n\n\treturn s\n}", "func (t *Torrent) UnmarshalJSON(data []byte) error {\n\tvar aux struct {\n\t\tID flexInt `json:\"id\"`\n\t\tCategory flexInt `json:\"category\"`\n\t\tStatus string `json:\"status\"`\n\t\tName string `json:\"name\"`\n\t\tNumFiles flexInt `json:\"num_files\"`\n\t\tInfoHash string `json:\"info_hash\"`\n\t\tDescription string `json:\"descr\"`\n\t\tLeechers flexInt `json:\"leechers\"`\n\t\tSeeders flexInt `json:\"seeders\"`\n\t\tUser string `json:\"username\"`\n\t\tSize flexInt `json:\"size\"`\n\t\tAdded flexInt `json:\"added\"`\n\t\tImdbID flexString `json:\"imdb\"`\n\t}\n\n\t// Decode json into the aux struct\n\tif err := json.Unmarshal(data, &aux); err != nil {\n\t\treturn err\n\t}\n\n\tt.ID = int(aux.ID)\n\tt.Category = TorrentCategory(int(aux.Category))\n\tt.Status = UserStatus(aux.Status)\n\tt.Name = aux.Name\n\tt.NumFiles = int(aux.NumFiles)\n\tt.Size = uint64(aux.Size)\n\tt.Seeders = int(aux.Seeders)\n\tt.Leechers = int(aux.Leechers)\n\tt.User = aux.User\n\tt.Added = time.Unix(int64(aux.Added), 0)\n\tt.Description = aux.Description\n\tt.InfoHash = aux.InfoHash\n\tt.ImdbID = string(aux.ImdbID)\n\n\treturn nil\n}", "func (n *Node) UnmarshalJSON(b []byte) error {\n\tvar tmp1 struct {\n\t\tType string `json:\"type\"`\n\t}\n\tif err := json.Unmarshal(b, &tmp1); err != nil {\n\t\treturn err\n\t}\n\tn.Type = tmp1.Type\n\n\tswitch n.Type {\n\n\tcase \"AssignmentExpression\", \"AssignmentPattern\", \"BinaryExpression\", \"LogicalExpression\":\n\t\tvar tmp2 struct {\n\t\t\tLeft *Node `json:\"left\"`\n\t\t\tRight *Node `json:\"right\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = []*Node{tmp2.Left, tmp2.Right}\n\n\tcase \"ArrayExpression\", \"ArrayPattern\":\n\t\tvar tmp2 struct {\n\t\t\tElements []*Node `json:\"elements\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = tmp2.Elements\n\n\tcase \"ArrowFunctionExpression\":\n\t\tvar tmp2 struct {\n\t\t\tParams []*Node `json:\"params\"`\n\t\t\tBody *Node `json:\"body\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = append(tmp2.Params, tmp2.Body)\n\n\tcase \"BlockStatement\", \"ClassBody\", \"DoExpression\", \"LabeledStatement\", \"Program\":\n\t\tvar tmp2 struct {\n\t\t\tBody []*Node `json:\"body\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = tmp2.Body\n\n\tcase \"BindExpression\":\n\t\tvar tmp2 struct {\n\t\t\tCallee *Node `json:\"callee\"`\n\t\t\tObject *Node `json:\"object\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = []*Node{tmp2.Callee, tmp2.Object}\n\n\tcase \"CallExpression\", \"NewExpression\":\n\t\tvar tmp2 struct {\n\t\t\tCallee *Node\n\t\t\tArguments []*Node `json:\"arguments\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Name = tmp2.Callee.Name\n\t\tn.From = tmp2.Callee.From\n\t\tn.Children = tmp2.Arguments\n\n\tcase \"ClassDeclaration\", \"ClassExpression\":\n\t\tvar tmp2 struct {\n\t\t\tSuperClass *Node `json:\"superClass\"`\n\t\t\tBody *Node `json:\"body\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = []*Node{tmp2.SuperClass, tmp2.Body}\n\n\tcase \"ClassMethod\":\n\t\tvar tmp2 struct {\n\t\t\tKey *Node `json:\"key\"`\n\t\t\tBody *Node `json:\"body\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Name = tmp2.Key.Name\n\t\tn.Children = []*Node{tmp2.Body}\n\n\tcase \"ClassProperty\":\n\t\tvar tmp2 struct {\n\t\t\tKey *Node `json:\"key\"`\n\t\t\tValue *Node `json:\"value\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Name = tmp2.Key.Name\n\t\tn.Children = []*Node{tmp2.Value}\n\n\tcase \"CatchClause\":\n\t\tvar tmp2 struct {\n\t\t\tParam *Node `json:\"param\"`\n\t\t\tBody *Node `json:\"body\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = []*Node{tmp2.Param, tmp2.Body}\n\n\tcase \"DoWhileStatement\", \"WhileStatement\":\n\t\tvar tmp2 struct {\n\t\t\tBody *Node `json:\"body\"`\n\t\t\tTest *Node `json:\"test\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = []*Node{tmp2.Body, tmp2.Test}\n\n\tcase \"ExportAllDeclaration\", \"ExportDefaultDeclaration\", \"ExportNamedDeclaration\":\n\t\tvar tmp2 struct {\n\t\t\tDeclaration *Node `json:\"declaration\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = []*Node{tmp2.Declaration}\n\n\tcase \"ExpressionStatement\", \"JSXExpressionContainer\":\n\t\tvar tmp2 struct {\n\t\t\tExpression *Node `json:\"expression\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = []*Node{tmp2.Expression}\n\n\tcase \"File\":\n\t\tvar tmp2 struct {\n\t\t\tProgram *Node `json:\"program\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = []*Node{tmp2.Program}\n\n\tcase \"ForInStatement\":\n\t\tvar tmp2 struct {\n\t\t\tLeft *Node `json:\"left\"`\n\t\t\tRight *Node `json:\"right\"`\n\t\t\tBody *Node `json:\"body\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = []*Node{tmp2.Left, tmp2.Right, tmp2.Body}\n\n\tcase \"ForStatement\":\n\t\tvar tmp2 struct {\n\t\t\tInit *Node `json:\"init\"`\n\t\t\tTest *Node `json:\"test\"`\n\t\t\tUpdate *Node `json:\"update\"`\n\t\t\tBody *Node `json:\"body\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = []*Node{tmp2.Init, tmp2.Test, tmp2.Update, tmp2.Body}\n\n\tcase \"FunctionDeclaration\", \"ObjectMethod\":\n\t\tvar tmp2 struct {\n\t\t\tID *Node `json:\"id\"`\n\t\t\tBody *Node `json:\"body\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif tmp2.ID != nil {\n\t\t\tn.Name = tmp2.ID.Name\n\t\t}\n\t\tn.Children = []*Node{tmp2.Body}\n\n\tcase \"FunctionExpression\":\n\t\tvar tmp2 struct {\n\t\t\tParams []*Node `json:\"params\"`\n\t\t\tBody *Node `json:\"body\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = append(tmp2.Params, tmp2.Body)\n\n\tcase \"Identifier\":\n\t\tvar tmp2 struct {\n\t\t\tName string `json:\"name\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Name = tmp2.Name\n\n\tcase \"ConditionalExpression\", \"IfStatement\":\n\t\tvar tmp2 struct {\n\t\t\tTest *Node `json:\"test\"`\n\t\t\tConsequent *Node `json:\"consequent\"`\n\t\t\tAlternate *Node `json:\"alternate\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = []*Node{tmp2.Test, tmp2.Consequent}\n\t\tif tmp2.Alternate != nil {\n\t\t\tn.Children = append(n.Children, tmp2.Alternate)\n\t\t}\n\n\tcase \"ImportDeclaration\":\n\t\tvar tmp2 struct {\n\t\t\tSpecifiers []*Node `json:\"specifiers\"`\n\t\t\tSource *Node `json:\"source\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, spec := range tmp2.Specifiers {\n\t\t\tn.Name += spec.Name + \" \"\n\t\t}\n\t\tn.From = tmp2.Source.Name\n\n\tcase \"ImportSpecifier\":\n\t\tvar tmp2 struct {\n\t\t\tImported *Node\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Name = tmp2.Imported.Name\n\n\tcase \"ImportDefaultSpecifier\", \"ImportNamespaceSpecifier\":\n\t\tvar tmp2 struct {\n\t\t\tLocal *Node `json:\"local\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Name = tmp2.Local.Name\n\n\tcase \"JSXElement\":\n\t\tvar tmp2 struct {\n\t\t\tChildren []*Node `json:\"children\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = tmp2.Children\n\n\tcase \"MemberExpression\":\n\t\tvar tmp2 struct {\n\t\t\tObject *Node `json:\"object\"`\n\t\t\tProperty *Node `json:\"property\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Name = tmp2.Property.Name\n\t\tn.From = tmp2.Object.Name\n\t\tn.Children = []*Node{tmp2.Object, tmp2.Property}\n\n\tcase \"AwaitExpression\", \"ReturnStatement\", \"RestElement\", \"SpreadElement\", \"SpreadProperty\", \"ThrowStatement\", \"UnaryExpression\", \"UpdateExpression\", \"YieldExpression\":\n\t\tvar tmp2 struct {\n\t\t\tArgument *Node `json:\"argument\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = []*Node{tmp2.Argument}\n\n\tcase \"ObjectExpression\", \"ObjectPattern\":\n\t\tvar tmp2 struct {\n\t\t\tProperties []*Node `json:\"properties\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = tmp2.Properties\n\n\tcase \"ObjectProperty\":\n\t\tvar tmp2 struct {\n\t\t\tValue interface{} `json:\"value\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif tmp2.Value != nil {\n\t\t\tif v, ok := tmp2.Value.(string); ok {\n\t\t\t\tn.Name = v\n\t\t\t}\n\t\t}\n\n\tcase \"StringLiteral\":\n\t\tvar tmp2 struct {\n\t\t\tValue string `json:\"value\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Name = tmp2.Value\n\n\tcase \"SequenceExpression\", \"TemplateLiteral\":\n\t\tvar tmp2 struct {\n\t\t\tExpressions []*Node `json:\"expressions\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = tmp2.Expressions\n\n\tcase \"SwitchCase\":\n\t\tvar tmp2 struct {\n\t\t\tTest *Node `json:\"test\"`\n\t\t\tConsequent []*Node `json:\"conseqeuent\"`\n\t\t}\n\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif tmp2.Test != nil {\n\t\t\tn.Children = []*Node{tmp2.Test}\n\t\t}\n\t\tn.Children = append(n.Children, tmp2.Consequent...)\n\n\tcase \"SwitchStatement\":\n\t\tvar tmp2 struct {\n\t\t\tDiscriminant *Node `json:\"discriminant\"`\n\t\t\tCases []*Node `json:\"cases\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = []*Node{tmp2.Discriminant}\n\t\tn.Children = append(n.Children, tmp2.Cases...)\n\n\tcase \"TaggedTemplateExpression\":\n\t\tvar tmp2 struct {\n\t\t\tTag *Node `json:\"tag\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = []*Node{tmp2.Tag}\n\n\tcase \"TryStatement\":\n\t\tvar tmp2 struct {\n\t\t\tBlock *Node `json:\"block\"`\n\t\t\tHandler *Node `json:\"handler\"`\n\t\t\tFinalizer *Node `json:\"finalizer\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = []*Node{tmp2.Block, tmp2.Handler, tmp2.Finalizer}\n\n\tcase \"VariableDeclaration\":\n\t\tvar tmp2 struct {\n\t\t\tDeclarations []*Node `json:\"declarations\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = tmp2.Declarations\n\n\tcase \"VariableDeclarator\":\n\t\tvar tmp2 struct {\n\t\t\tInit *Node `json:\"init\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = []*Node{tmp2.Init}\n\n\tcase \"WithStatement\":\n\t\tvar tmp2 struct {\n\t\t\tObject *Node `json:\"object\"`\n\t\t\tBody *Node `json:\"body\"`\n\t\t}\n\t\tif err := json.Unmarshal(b, &tmp2); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn.Children = []*Node{tmp2.Object, tmp2.Body}\n\n\tcase\n\t\t\"BooleanLiteral\",\n\t\t\"BreakStatement\",\n\t\t\"ContinueStatement\",\n\t\t\"EmptyStatement\",\n\t\t\"ForOfStatement\",\n\t\t\"DebuggerStatement\",\n\t\t\"NullLiteral\",\n\t\t\"NumericLiteral\",\n\t\t\"TypeAlias\",\n\t\t\"ThisExpression\",\n\t\t\"JSXText\",\n\t\t\"JSXEmptyExpression\",\n\t\t\"DeclareVariable\",\n\t\t\"RegExpLiteral\",\n\t\t\"InterfaceDeclaration\",\n\t\t\"TypeCastExpression\",\n\t\t\"Super\":\n\n\tdefault:\n\t\tlog.Printf(\"unhandled type %s\", n.Type)\n\t}\n\n\treturn nil\n}", "func TestLeafUnmarshall(t *testing.T) {\n\tlump := Leaf{}\n\tlump.SetVersion(20)\n\terr := lump.Unmarshall(GetTestDataBytes())\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\texpected := GetTestLeafData()\n\tlog.Println(lump)\n\tactual := lump.GetData()[0]\n\n\tif actual != expected {\n\t\tlog.Println(\"Expected: \")\n\t\tlog.Println(expected)\n\t\tlog.Println(\"Actual: \")\n\t\tlog.Println(actual)\n\t\tt.Errorf(\"Imported Leaf data mismatch.\")\n\t}\n}", "func (st *SlimTrie) Unmarshal(buf []byte) error {\n\n\tvar ver string\n\tcompatible := st.compatibleVersions()\n\treader := bytes.NewReader(buf)\n\n\t_, ver, err := pbcmpl.Unmarshal(reader, &st.Children)\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"failed to unmarshal children\")\n\t}\n\n\tif !vers.IsCompatible(ver, compatible) {\n\t\treturn errors.Wrapf(ErrIncompatible,\n\t\t\tfmt.Sprintf(`version: \"%s\", compatible versions:\"%s\"`,\n\t\t\t\tver,\n\t\t\t\tstrings.Join(compatible, \" || \")))\n\t}\n\n\t_, _, err = pbcmpl.Unmarshal(reader, &st.Steps)\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"failed to unmarshal steps\")\n\t}\n\n\t_, _, err = pbcmpl.Unmarshal(reader, &st.Leaves)\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"failed to unmarshal leaves\")\n\t}\n\n\t// backward compatible:\n\n\tbefore058ConvertToChildrenEltsToBMElts(st, ver)\n\tbefore059ExtendBitmapIndex(st, ver)\n\n\treturn nil\n}", "func Decode(s blob.CAS, obj *wiretype.Object) (*Root, error) {\n\tpb, ok := obj.Value.(*wiretype.Object_Root)\n\tif !ok {\n\t\treturn nil, errors.New(\"object does not contain a root\")\n\t}\n\treturn &Root{\n\t\tcas: s,\n\n\t\tDescription: pb.Root.Description,\n\t\tFileKey: string(pb.Root.FileKey),\n\t\tIndexKey: string(pb.Root.IndexKey),\n\t}, nil\n}", "func Deparse(tree *ParseResult) (output string, err error) {\n\tprotobufTree, err := proto.Marshal(tree)\n\tif err != nil {\n\t\treturn\n\t}\n\n\toutput, err = parser.DeparseFromProtobuf(protobufTree)\n\treturn\n}", "func deserialize(src []byte, dst interface{}) error {\n\tdec := gob.NewDecoder(bytes.NewBuffer(src))\n\tif err := dec.Decode(dst); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func Unmarshal(data []byte, v Unmarshaler) error {\n\tl := jlexer.Lexer{Data: data}\n\tv.UnmarshalTinyJSON(&l)\n\treturn l.Error()\n}", "func DecodeNode(data []byte) []string {\n\tdec, _ := Decode(data, 0)\n\tif slice, ok := dec.([]interface{}); ok {\n\t\tstrSlice := make([]string, len(slice))\n\n\t\tfor i, s := range slice {\n\t\t\tif str, ok := s.([]byte); ok {\n\t\t\t\tstrSlice[i] = string(str)\n\t\t\t}\n\t\t}\n\n\t\treturn strSlice\n\t} else {\n\t\tfmt.Printf(\"It wasn't a []. It's a %T\\n\", dec)\n\t}\n\n\treturn nil\n}", "func recoverTree(text *string) *Tree{\n\tif len(*text) == 0 {\n\t\treturn nil\n\t}\n\n\tif (*text)[0] == '1' {\n\t\t*text = (*text)[1:]\n\t\treturn &Tree{rune((*text)[0]), -1, nil, nil}\n\t}\n\n\troot := &Tree{'$', -1, nil, nil}\n\t*text = (*text)[1:]\n\troot.LeftNode = recoverTree(text)\n\t*text = (*text)[1:]\n\troot.RightNode = recoverTree(text)\n\treturn root\n\t\n}", "func (this *Codec) serialize(root *TreeNode) string {\n\tif root == nil {\n\t\treturn \"nil\"\n\t}\n\treturn strconv.Itoa(root.Val) + \",\" + this.serialize(root.Left) + \",\" + this.serialize(root.Right)\n}", "func (n *RforkNode) SetTree(t *Tree) {\n\tn.tree = t\n}", "func (v *Node) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson6601e8cdDecodeGithubComSkydiveProjectSkydiveGraffitiApiTypes1(&r, v)\n\treturn r.Error()\n}", "func (lump *Generic) Unmarshall(data []byte) (err error) {\n\tlump.length = len(data)\n\tlump.data = data\n\n\treturn err\n}", "func Decode(na ipld.NodeAssembler, in io.Reader) error {\n\tvar src []byte\n\tif buf, ok := in.(interface{ Bytes() []byte }); ok {\n\t\tsrc = buf.Bytes()\n\t} else {\n\t\tvar err error\n\t\tsrc, err = ioutil.ReadAll(in)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn DecodeBytes(na, src)\n}" ]
[ "0.72836035", "0.7193018", "0.7156152", "0.70064354", "0.69082284", "0.68782", "0.68505496", "0.6845451", "0.6837301", "0.6799518", "0.6791657", "0.67909694", "0.678274", "0.6773538", "0.67478335", "0.6734582", "0.6712768", "0.6674699", "0.6654595", "0.6651541", "0.65485096", "0.64170986", "0.6381862", "0.6339977", "0.6298404", "0.59903187", "0.58801067", "0.5580673", "0.5380222", "0.5361961", "0.5320014", "0.5313363", "0.530031", "0.52695113", "0.5224516", "0.52098185", "0.520917", "0.5195383", "0.5146985", "0.51402926", "0.5089294", "0.50751", "0.50528824", "0.50497144", "0.50456333", "0.5000904", "0.499988", "0.49840054", "0.49767372", "0.4971378", "0.49675423", "0.49510726", "0.49478355", "0.490127", "0.48789892", "0.4868002", "0.4837173", "0.48257086", "0.48103672", "0.48078525", "0.4801625", "0.4791107", "0.47828916", "0.4782495", "0.4775916", "0.47741327", "0.47730318", "0.47700217", "0.47695404", "0.47357485", "0.4729282", "0.47280848", "0.4723517", "0.47033232", "0.46882033", "0.4679471", "0.46762815", "0.46459457", "0.46457452", "0.464115", "0.46318257", "0.4630114", "0.462548", "0.45957062", "0.45919713", "0.45883563", "0.4585982", "0.458406", "0.45826137", "0.45440072", "0.45400304", "0.45272133", "0.45079517", "0.4506168", "0.4505085", "0.45033437", "0.45026395", "0.45006815", "0.44946146", "0.44943222" ]
0.7252706
1
DefaultCreateHealthMenstruationPersonalInfo executes a basic gorm create call
DefaultCreateHealthMenstruationPersonalInfo выполняет базовый вызов gorm create
func DefaultCreateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) { if in == nil { return nil, errors1.NilArgumentError } ormObj, err := in.ToORM(ctx) if err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeCreate_); ok { if db, err = hook.BeforeCreate_(ctx, db); err != nil { return nil, err } } if err = db.Create(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterCreate_); ok { if err = hook.AfterCreate_(ctx, db); err != nil { return nil, err } } pbResponse, err := ormObj.ToPB(ctx) return &pbResponse, err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DefaultCreateHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, 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 hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeCreate_); ok {\n\t\tif db, err = hook.BeforeCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterCreate_); ok {\n\t\tif err = hook.AfterCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultCreateUserInfo(ctx context.Context, in *UserInfo, db *gorm.DB) (*UserInfo, error) {\n\tif in == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithBeforeCreate_); ok {\n\t\tif db, err = hook.BeforeCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithAfterCreate_); ok {\n\t\tif err = hook.AfterCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func CreatePerson(c *gin.Context) {\n // Validate input\n var input CreatePersonInput\n if err := c.ShouldBindJSON(&input); err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n return\n }\n\n // Create person\n person := models.Person{CreatedBy: input.CreatedBy, FirstName: input.FirstName, LastName: input.LastName, Email: input.Email, Phone: input.Phone, Birthday: input.Birthday, Title: input.Title, Department: input.Department}\n models.DB.Create(&person)\n\n c.JSON(http.StatusOK, gin.H{\"data\": person})\n}", "func CreatePerson(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"content-type\", \"application/json\")\n\n\tperson := r.Context().Value(security.KeyUser{}).(data.Person)\n\n\t//create the user\n\tcreatedPerson := data.DB.Create(&person)\n\terr := createdPerson.Error\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(err.Error()))\n\t\treturn\n\t}\n\n\tjson.NewEncoder(w).Encode(&person)\n}", "func createPerson(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"CREATE HIT\")\n\tstmt, err := db.Prepare(\"INSERT INTO Persons(pAge, pName) VALUES (?,?)\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tvar per Person\n\tjson.Unmarshal(body, &per)\n\tage := per.Age\n\tname := per.Name\n\t_, err = stmt.Exec(age, name)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Fprintf(w, \"New person was created\")\n}", "func DefaultReadHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, 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 == 0 {\n\t\treturn nil, errors1.EmptyIdError\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeReadApplyQuery); ok {\n\t\tif db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &HealthMenstruationPersonalInfoORM{}); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeReadFind); ok {\n\t\tif db, err = hook.BeforeReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tormResponse := HealthMenstruationPersonalInfoORM{}\n\tif err = db.Where(&ormObj).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormResponse).(HealthMenstruationPersonalInfoORMWithAfterReadFind); ok {\n\t\tif err = hook.AfterReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func Create(c *gin.Context) {\n\tuser := c.MustGet(\"user\").(*entities.User)\n\tmechanicData := CreateMechanic{}\n\n\terr := c.ShouldBind(&mechanicData)\n\tif err == nil {\n\t\tmechanic, errRegister := RegisterNewMechanic(user, mechanicData)\n\t\tif errRegister != nil {\n\t\t\tresponse := global.ResponseServices(mechanicData, \"400\", errRegister.Error())\n\t\t\tc.JSON(400, response)\n\t\t\treturn\n\t\t}\n\t\tresponse := global.ResponseServices(mechanic, \"200\", \"Se he creado el usuario con exito\")\n\t\tc.JSON(http.StatusOK, response)\n\t\treturn\n\t}\n\tresponse := global.ResponseServices(mechanicData, \"400\", err.Error())\n\tc.JSON(400, response)\n}", "func (idb *InDB) CreatePerson(c *gin.Context) {\n\tvar (\n\t\tperson structs.Person\n\n\t\tresult gin.H\n\t)\n\tfirstName := c.PostForm(\"first_name\")\n\tlastName := c.PostForm(\"last_name\")\n\tphone := c.PostForm(\"phone_number\")\n\timei := c.PostForm(\"imei\")\n\tmodelName := c.PostForm(\"model_name\")\n\tmodelNumber := c.PostForm(\"model_number\")\n\tsoftwareVer := c.PostForm(\"software_ver\")\n\tapiKey := authGenerator(imei)\n\n\tperson.First_Name = firstName\n\tperson.Last_Name = lastName\n\tperson.Phone_Number = phone\n\tperson.Model_Number = modelNumber\n\tperson.Model_Name = modelName\n\tperson.Software_Ver = softwareVer\n\tperson.API = apiKey\n\tperson.Imei = imei\n\n\tidb.DB.Create(&person)\n\n\tresult = gin.H{\n\t\t\"result\": person,\n\t}\n\n\tc.JSON(http.StatusOK, result)\n}", "func CreatePsychologist(dbase *gorm.DB, w http.ResponseWriter, r *http.Request) {\n\tuser := &db.Psychologist{}\n\terr := json.NewDecoder(r.Body).Decode(&user)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t_ = json.NewEncoder(w).Encode(utils.ErrorResponse{\n\t\t\tCode: http.StatusInternalServerError,\n\t\t\tMessage: \"An error occurred\",\n\t\t})\n\t\treturn\n\t}\n\n\tuser.Password = utils.HashPassword(user.Password, w)\n\tif user.Password == \"\" {\n\t\treturn\n\t}\n\n\trs := dbase.Create(&user)\n\tif rs.Error != nil {\n\t\tlog.Println(rs)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tlog.Println(json.NewEncoder(w).Encode(utils.ErrorResponse{\n\t\t\tCode: http.StatusInternalServerError,\n\t\t\tMessage: \"Could not create your account. Please try again later\",\n\t\t}))\n\t\treturn\n\t}\n\n\t// body := struct {\n\t// \tName string\n\t// \tLink string\n\t// }{\n\t// \tName: fmt.Sprintf(\"%s %s\", user.FirstName, user.LastName),\n\t// \tLink: \"https://google.com\",\n\t// }\n\n\t// go func(dbase *gorm.DB, email string, subject string, HTMLTemp string, body interface{}) {\n\t// \terr := utils.SendEmail(dbase, email, subject, HTMLTemp, body)\n\t// \tif err != nil {\n\t// \t\tlog.Println(err)\n\t// \t\t_ = json.NewEncoder(w).Encode(err.Error())\n\t// \t\treturn\n\t// \t}\n\t// }(dbase, user.Email, \"Welcome\", \"templates/email/confirm.html\", body)\n\n\tw.WriteHeader(http.StatusCreated)\n\tlog.Println(json.NewEncoder(w).Encode(user))\n}", "func DefaultListHealthMenstruationPersonalInfo(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*HealthMenstruationPersonalInfo, error) {\n\tin := HealthMenstruationPersonalInfo{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm2.ApplyCollectionOperators(ctx, db, &HealthMenstruationPersonalInfoORM{}, &HealthMenstruationPersonalInfo{}, f, s, p, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []HealthMenstruationPersonalInfoORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*HealthMenstruationPersonalInfo{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func Create(ctx *gin.Context, data interface{}) {\n\tctx.JSON(http.StatusCreated, gin.H{\"code\": merrors.ErrSuccess, \"data\": nil})\n\treturn\n}", "func CreatePerson(db *sql.DB) {}", "func (h *Handler) createDeveloper(c *gin.Context) handlerResponse {\n\n\tvar newDeveloper types.Developer\n\tif err := c.ShouldBindJSON(&newDeveloper); err != nil {\n\t\treturn handleBadRequest(err)\n\t}\n\tstoredDeveloper, err := h.service.Developer.Create(newDeveloper, h.who(c))\n\tif err != nil {\n\t\treturn handleError(err)\n\t}\n\treturn handleCreated(storedDeveloper)\n}", "func CreateMeeting(c *gin.Context) {\n // Validate input\n var input CreateMeetingInput\n if err := c.ShouldBindJSON(&input); err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n return\n }\n\n // Create meeting\n meeting := models.Meeting{CreatedBy: input.CreatedBy, Title: input.Title, Description: input.Description, StartDate: input.StartDate, EndDate: input.EndDate, Location: input.Location}\n models.DB.Create(&meeting)\n\n c.JSON(http.StatusOK, gin.H{\"data\": meeting})\n}", "func DefaultPatchHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj HealthMenstruationPersonalInfo\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadHealthMenstruationPersonalInfo(ctx, &HealthMenstruationPersonalInfo{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskHealthMenstruationPersonalInfo(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(HealthMenstruationPersonalInfoWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func (p Person) Create(name string, age int) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintf(w, \"This prints the name and age of a Person:\\n\\t%v\\n\\t%v\\n\", name, age)\n\t})\n}", "func (a *App) CreateProfile(w http.ResponseWriter, r *http.Request) {\n\thandler.CreateProfile(a.DB, w, r)\n}", "func create(entity domain.ValidableEntity, ctx *gin.Context) {\n\terr := ctx.BindJSON(entity)\n\tif IsError(err, ctx) {\n\t\treturn\n\t}\n\terr = domain.Save(entity)\n\tif IsError(err, ctx) {\n\t\treturn\n\t}\n\tctx.JSON(200, entity)\n}", "func CreateUser(c *gin.Context) {}", "func (r *Repository) create(user *domain.UserInfoModel) error {\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tquery := \"INSERT INTO users (namee, email, password) VALUES ($1, $2, $3)\"\n\tstmt, err := r.db.PrepareContext(ctx, query)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer stmt.Close()\n\n\tqueryStart := time.Now().Nanosecond() / 1000\n\t_, err = stmt.ExecContext(ctx, user.Name, user.Email, user.PassWord)\n\tif err != nil {\n\t\treturn err\n\t}\n\tqueryEnd := time.Now().Nanosecond() / 1000\n\texecutionTime := queryEnd - queryStart\n\terr = r.insertTimeSpent(\"Create\", executionTime)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn nil\n}", "func DefaultCreateProfile(ctx context.Context, in *Profile, db *gorm1.DB) (*Profile, 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 hook, ok := interface{}(&ormObj).(ProfileORMWithBeforeCreate_); ok {\n\t\tif db, err = hook.BeforeCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(ProfileORMWithAfterCreate_); ok {\n\t\tif err = hook.AfterCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func CreateNewPatient(c *gin.Context) {\n\tvar patientRequest PatientRequest\n\tc.ShouldBind(&patientRequest)\n\tpatientResponse := PatientResponse{\n\t\tPatientID: \"2018-0001\",\n\t\tName: patientRequest.Name,\n\t\tLastname: patientRequest.Lastname,\n\t\tAge: patientRequest.Age,\n\t}\n\tc.JSON(201, patientResponse)\n\n}", "func NewPersonal(db DBProvider) (*Personal, error) {\n\treturn &Personal{\n\t\tDB: db,\n\t}, nil\n}", "func Create(ctx *gin.Context) {\n\n}", "func (srv *UsersService) CreateHandler(ctx *gin.Context) {\n\tlogger := srv.logger.New(\"action\", \"CreateHandler\")\n\n\t// Checks if the query entry is valid\n\tvalidator := validators.CreateUserValidator{}\n\tif err := validator.BindJSON(ctx); err != nil {\n\t\t// Returns a \"422 StatusUnprocessableEntity\" response\n\t\tsrv.ResponseService.ValidatorErrorResponse(ctx, responses.UnprocessableEntity, err)\n\t\treturn\n\t}\n\n\t// Check permissions\n\tcurrentUser := GetCurrentUser(ctx)\n\tif hasPerm := srv.PermissionsService.CanCreateProfile(currentUser.UID, &validator.UserModel); !hasPerm {\n\t\tsrv.ResponseService.Forbidden(ctx)\n\t\treturn\n\t}\n\n\ttmpPassword := validator.UserModel.Password\n\n\t// Create new user\n\tcreatedUser, err := srv.userCreator.Create(&validator.UserModel, true, false, nil)\n\tif err != nil {\n\t\tlogger.Error(\"сan't create a user\", \"error\", err)\n\t\t// Returns a \"500 StatusInternalServerError\" response\n\t\tsrv.ResponseService.Error(ctx, responses.CanNotCreateUser, \"Can't create a user\")\n\t\treturn\n\t}\n\n\tif nil != currentUser {\n\t\tsrv.SystemLogsService.LogCreateUserProfileAsync(createdUser, currentUser.UID)\n\t}\n\t// TODO: refactor - use events, move above functionality to the event subscriber\n\tconfirmationCode, err := srv.confirmationCodeService.GenerateSetPasswordCode(createdUser)\n\tif err != nil {\n\t\tlogger.Error(\"unable to generate set_password confirmation code\")\n\t\treturn\n\t}\n\n\tif _, err = srv.notificationsService.ProfileCreated(createdUser.UID, tmpPassword, confirmationCode.Code); nil != err {\n\t\tlogger.Error(\"сan't send notification\", \"error\", err)\n\t\treturn\n\t}\n\n\t// Returns a \"201 Created\" response\n\tsrv.ResponseService.SuccessResponse(ctx, http.StatusCreated, validator.UserModel)\n}", "func (m *HealthMenstruationPersonalInfoORM) ToPB(ctx context.Context) (HealthMenstruationPersonalInfo, error) {\n\tto := HealthMenstruationPersonalInfo{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(HealthMenstruationPersonalInfoWithBeforeToPB); ok {\n\t\tif err = prehook.BeforeToPB(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tif m.CreatedAt != nil {\n\t\tif to.CreatedAt, err = ptypes1.TimestampProto(*m.CreatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tif m.UpdatedAt != nil {\n\t\tif to.UpdatedAt, err = ptypes1.TimestampProto(*m.UpdatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.ProfileId = m.ProfileId\n\tto.PeriodLengthInDays = m.PeriodLengthInDays\n\tto.CycleLengthInDays = m.CycleLengthInDays\n\tif posthook, ok := interface{}(m).(HealthMenstruationPersonalInfoWithAfterToPB); ok {\n\t\terr = posthook.AfterToPB(ctx, &to)\n\t}\n\treturn to, err\n}", "func createNewUser(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tparams := mux.Vars(r)\n\tvar userInfo UserBody\n\t//decode the json object and store the values in userInfo\n\terr := json.NewDecoder(r.Body).Decode(&userInfo)\n\tif err != nil {\n\t\tfmt.Println(\"ERROR DECODING JSON OBJ FROM CREATE NEW USER\")\n\t}\n\tresult := post.CreateUser(params[\"id\"], userInfo.FirstName, userInfo.LastName, userInfo.Email)\n\tjson.NewEncoder(w).Encode(map[string]bool{\n\t\t\"result\": result,\n\t})\n}", "func (db *database) CreatePerson(\n\tctx context.Context,\n\tp app.Person,\n) (int, error) {\n\n\tvar id int\n\terr := db.GetContext(ctx, &id, `\n\t\tINSERT INTO person (\n\t\t\tfirst_name,\n\t\t\tlast_name,\n\t\t\temail,\n\t\t\trole_id,\n\t\t\tpass_hash\n\t\t) VALUES ($1, $2, $3, $4, $5)\n\t\tRETURNING person_id\n\t`, p.FirstName, p.LastName, p.Email, p.Role, p.Password)\n\n\treturn id, errors.Wrap(err, \"failed to insert person\")\n}", "func CreatePerson(w http.ResponseWriter, r *http.Request) {\n\tvar person model.Person\n\t/*\n\t\tTo print the response to string\n\t*/\n\tbodyBytes, _ := ioutil.ReadAll(r.Body)\n\tbodyString := string(bodyBytes)\n\tfmt.Println(bodyString)\n\n\t/*\n\t\tParse JSON object without struct\n\t*/\n\tm := map[string]interface{}{}\n\terr := json.Unmarshal(bodyBytes, &m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(m)\n\tfmt.Println(m[\"firstname\"])\n\n\tjson.Unmarshal(bodyBytes, &person) // parse JSON to person struct object\n\tfmt.Println(person.Firstname)\n\tpeople = append(people, person)\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tjson.NewEncoder(w).Encode(people)\n}", "func createUser(c *gin.Context) {\n password,_ := HashPassword(c.PostForm(\"password\"))\n\tuser := user{Login: c.PostForm(\"login\"), Password: password}\n\tdb.Save(&user)\n\tc.JSON(http.StatusCreated, gin.H{\"status\": http.StatusCreated, \"message\": \"User item created successfully!\"})\n}", "func CreateDefault() {\n\texistingAdmin, err := FindByEmail(config.AdminEmail)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tif existingAdmin != nil && !existingAdmin.IsAdmin {\n\t\tlog.Fatalf(\"FATAL: User with email %v exists but has no admin rights.\", config.AdminEmail)\n\t}\n\n\tif existingAdmin == nil {\n\t\tadmin, err := New(config.AdminEmail, \"Admin\", \"Admin\", config.AdminPassword)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tadmin.IsAdmin = true\n\t\terr = Save(&admin)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Cannot create admin user with email %v. Error: %v\", config.AdminEmail, err.Error())\n\t\t}\n\t\treturn\n\t}\n\tif config.ServerDebug() {\n\t\tlog.Println(\"Admin account found.\")\n\t}\n\n\t//Create the test user if we are not in production\n\tif !config.ProductionMode {\n\t\texistingTestUser, err := FindByEmail(config.TestUserEmail)\n\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\n\t\tif existingTestUser == nil {\n\t\t\ttestuser, err := New(config.TestUserEmail, \"TestUser\", \"TestUser\", \"xaFqJDeJldIEcdfZS\")\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t\terr = Save(&testuser)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"Cannot create user with email %v. Error: %v\", config.TestUserEmail, err.Error())\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tlog.Println(\"Test account found.\")\n\t}\n}", "func (adapter *GORMAdapter) Create(entity interface{}) orm.Result {\n\treturn orm.Result{\n\t\tError: adapter.db.Create(entity).Error,\n\t}\n}", "func (x *UserStore) Create(uuid, firstName, lastName, email, password string) (string, error) {\n\tif x.mock != nil && x.mock.Enabled() {\n\t\treturn x.mock.String(), x.mock.Error()\n\t}\n\n\t_, err := x.db.Exec(`\n\t\tINSERT INTO user\n\t\t(id, first_name, last_name, email, password, status_id)\n\t\tVALUES\n\t\t(?,?,?,?,?,?)\n\t\t`,\n\t\tuuid, firstName, lastName, email, password, 1)\n\n\treturn uuid, err\n}", "func (UserReqServices) CreateNew(ctx context.Context, req dt.UserRequest, dbConn lib.DbConnection) (resp dt.UserResponse) {\n\terr := validation.Errors{\n\t\t\"name\": validation.Validate(req.Name, validation.Required, validation.Length(1, 50), is.Letter),\n\t\t\"email\": validation.Validate(req.Email, validation.Required, is.Email),\n\t\t\"phone\": validation.Validate(req.Phone, validation.Required, is.Digit),\n\t}.Filter()\n\tresp.ResponseCode = \"-1\"\n\tresp.ResponseDesc = err\n\tif err == nil || err == \"\" {\n\n\t\tresp.ResponseCode = \"1\"\n\t\tresp.ResponseDesc = \"Success\"\n\t}\n\t\n\treturn\n}", "func (a *App) CreateUserProfile(w http.ResponseWriter, r *http.Request) {\n\thandler.CreateUserProfile(a.DB, w, r)\n}", "func Create(r render.Render, params martini.Params, db database.Datastore, data Account) {\n\n\t// Create a bcrypt hash from the password as we don't want to store\n\t// plain-text passwords in the database\n\tpwdHash, bcryptError := bcrypt.GenerateFromPassword([]byte(data.Password), 0)\n\tif bcryptError != nil {\n\t\tresponses.Error(r, bcryptError.Error())\n\t}\n\n\t// Set the hashed password\n\tdata.Password = string(pwdHash)\n\n\t// Store the object in the database. In case the\n\t// database operation fails, an error response is sent back to the caller.\n\terr := db.GetDBMap().Insert(&data)\n\tif err != nil {\n\t\tresponses.Error(r, err.Error())\n\t\treturn\n\t}\n\tresponses.OKStatusPlusData(r, data, 1)\n}", "func (server Server) CreateNewUser(w http.ResponseWriter, r *http.Request) {\n\tvar user models.User // make a user\n\tvar res models.APIResponse // make a response\n\n\terr := json.NewDecoder(r.Body).Decode(&user) //decode the user\n\tif err != nil {\n\t\tlog.Printf(\"Unable to decode the request body. %v\", err)\n\t\tres = models.BuildAPIResponseFail(\"Unable to decode the request body\", nil)\n\t}\n\tif user.Name == \"\" || user.Email == \"\" || user.Password == \"\" {\n\t\tres = models.BuildAPIResponseFail(\"Blank users cannot be created\", nil)\n\t} else {\n\t\tinsertID := insertUser(user, server.db) // call insert user function and pass the note\n\t\tres = models.BuildAPIResponseSuccess(fmt.Sprintf(\"User Created with %d id\", insertID), nil) // format a response object\n\t}\n\tjson.NewEncoder(w).Encode(res)\n\n}", "func Create(c *gin.Context) {\n\tworkshopData := CreateWorkShop{}\n\tuser := c.MustGet(\"user\").(*entities.User)\n\n\terr := c.ShouldBind(&workshopData)\n\tif err == nil {\n\t\tr, errRegister := RegisterNewWorkShop(user, workshopData)\n\t\tif errRegister != nil {\n\t\t\tresponse := global.ResponseServices(workshopData, \"400\", errRegister.Error())\n\t\t\tc.JSON(400, response)\n\t\t\treturn\n\t\t}\n\t\tresponse := global.ResponseServices(r, \"200\", \"Se he creado el taller con exito\")\n\t\tc.JSON(http.StatusOK, response)\n\t\treturn\n\t}\n\tresponse := global.ResponseServices(workshopData, \"400\", err.Error())\n\tc.JSON(400, response)\n}", "func (h *User) Create(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tR.JSON500(w)\n\t\treturn\n\t}\n\n\tuser, err := validator.UserCreate(body)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tR.JSON400(w)\n\t\treturn\n\t}\n\n\terr = h.Storage.CreateUser(user)\n\t// @todo this might be also 400 response since email can be a duplicate\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tR.JSON500(w)\n\t\treturn\n\t}\n\n\tR.JSON200OK(w)\n}", "func (company *Company) Create(ctx aero.Context) error {\n\tuser := GetUserFromContext(ctx)\n\n\tif user == nil {\n\t\treturn errors.New(\"Not logged in\")\n\t}\n\n\tcompany.ID = GenerateID(\"Company\")\n\tcompany.Created = DateTimeUTC()\n\tcompany.CreatedBy = user.ID\n\tcompany.Location = &Location{}\n\n\t// Write log entry\n\tlogEntry := NewEditLogEntry(user.ID, \"create\", \"Company\", company.ID, \"\", \"\", \"\")\n\tlogEntry.Save()\n\n\treturn company.Unpublish()\n}", "func createUser() User {\n\tuser := User{\n\t\tUsername: \"igor\",\n\t\tPassword: \"please store hashed password\",\n\t\tName: \"Paolo\",\n\t\tSurname: \"Galeone\",\n\t\tEmail: \"please validate the @email . com\",\n\t\tGender: true,\n\t\tBirthDate: time.Now(),\n\t}\n\n\tif e = db.Create(&user); e != nil {\n\t\tpanic(fmt.Sprintf(\"Create(&user) filling fields having no default should work, but got: %s\\n\", e.Error()))\n\t}\n\treturn user\n}", "func CreateDefaultUser(username, password string) (err error) {\n\n err = checkInit()\n if err != nil {\n return\n }\n\n var users = data[\"users\"].(map[string]interface{})\n // Check if the default user exists\n if len(users) > 0 {\n err = createError(001)\n return\n }\n\n var defaults = defaultsForNewUser(username, password)\n users[defaults[\"_id\"].(string)] = defaults\n saveDatabase(data)\n\n return\n}", "func createHandler(w http.ResponseWriter, r *http.Request) {\n\tuser := new(User)\n\tuser.Token = validateToken(r.FormValue(\"token\"))\n\tuser.PasswordHash = validatePassHash(r.FormValue(\"passHash\"))\n\tuser.PublicKey = validatePublicKey(r.FormValue(\"publicKey\"))\n\tuser.PublicHash = computePublicHash(user.PublicKey)\n\tuser.CipherPrivateKey = validateHex(r.FormValue(\"cipherPrivateKey\"))\n\n\tlog.Printf(\"Woot! New user %s %s\\n\", user.Token, user.PublicHash)\n\n\tif !SaveUser(user) {\n\t\thttp.Error(w, \"That username is taken\", http.StatusBadRequest)\n\t}\n}", "func CreateUser(c *gin.Context) {\n\ttype result struct {\n\t\tFirstName string `json:\"first_name\"`\n\t\tLastName string `json:\"last_name\"`\n\t\tEmail string `json:\"email\"`\n\t\tPassword string `json:\"password\"`\n\t\tDateOfBirth string `json:\"birth_date\"`\n\t}\n\tUserParams := result{}\n\n\terr := c.ShouldBindJSON(&UserParams)\n\tlayout := \"2006-01-02\"\n\tstr := UserParams.DateOfBirth\n\tt, er := time.Parse(layout, str)\n\n\tif er != nil {\n\t\tfmt.Println(er)\n\t}\n\n\tvar user model.User\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, err)\n\t\treturn\n\t}\n\tif len(UserParams.Password) == 0 {\n\t\tfmt.Println(\"err2\")\n\t\tlog.Println(err)\n\t\tc.JSON(http.StatusBadRequest, \"No given password\")\n\t\treturn\n\t}\n\tif age.Age(t) < 18 {\n\t\tlog.Println(err)\n\t\tc.JSON(http.StatusBadRequest, \"You are not adult!\")\n\t\treturn\n\t}\n\tif !db.Where(\"email = ?\", UserParams.Email).Find(&user).RecordNotFound() {\n\t\tc.JSON(http.StatusBadRequest, \"User with this email already exist\")\n\t\treturn\n\t}\n\tid := uuid.NewV4()\n\t// 1 = single user; 2 = admin\n\tuser.AccessLevel = 1\n\tuser.UUID = id.String()\n\tvar hash = hashPassword(UserParams.Password)\n\tuser.Password = hash\n\tuser.FirstName = UserParams.FirstName\n\tuser.LastName = UserParams.LastName\n\tuser.Email = UserParams.Email\n\tuser.DateOfBirth = t\n\tdb.Create(&user)\n\tuser.Password = \"\"\n\tc.JSON(200, &user)\n}", "func (h *Handler) create() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tuser := &model.User{}\n\t\tif err := json.NewDecoder(r.Body).Decode(user); err != nil {\n\t\t\tmsg := &errorMessage{\n\t\t\t\tError: err.Error(),\n\t\t\t\tMessage: \"user json decode error\",\n\t\t\t}\n\t\t\tresponse.JSON(w, http.StatusBadRequest, msg)\n\t\t\treturn\n\t\t}\n\n\t\tentity, err := h.UserDAO.Create(r.Context(), user)\n\t\tif err != nil {\n\t\t\tmsg := &errorMessage{\n\t\t\t\tError: err.Error(),\n\t\t\t\tMessage: \"user datastore error\",\n\t\t\t}\n\t\t\tresponse.JSON(w, http.StatusInternalServerError, msg)\n\t\t\treturn\n\t\t}\n\t\tresponse.JSON(w, http.StatusCreated, entity)\n\t}\n}", "func addGod(db *gorm.DB) {\n\tphone, password, username, email, firstname, lastname := os.Getenv(\"GOD_PHONE\"),\n\t\tos.Getenv(\"GOD_PASSWORD\"),\n\t\tos.Getenv(\"GOD_USERNAME\"),\n\t\tos.Getenv(\"GOD_EMAIL\"),\n\t\tos.Getenv(\"GOD_FIRSTNAME\"),\n\t\tos.Getenv(\"GOD_LASTNAME\")\n\tpersonnelNum, err := strconv.Atoi(os.Getenv(\"GOD_PERSONNELNUM\"))\n\tif err != nil {\n\t\te.Logger.Error(\"GOD_PERSONNELNUM is not valid\")\n\t}\n\tlevel := domains.Level{\n\t\tTitle: \"کاربر\",\n\t\tColor: \"#ffffff\",\n\t}\n\trole := domains.Role{\n\t\tTitle: \"genesis\",\n\t\tPermissions: constants.Permissions,\n\t}\n\tuser := domains.User{\n\t\tModel: gorm.Model{\n\t\t\tID: 1,\n\t\t},\n\t\tPhone: phone,\n\t\tPassword: crypto.GenerateSha256(password),\n\t\tPersonnelNum: personnelNum,\n\t\tUsername: username,\n\t\tEmail: email,\n\t\tFirstName: firstname,\n\t\tLastName: lastname,\n\t\tRoles: []domains.Role{role},\n\t\tLevel: level,\n\t}\n\tif err := db.Where(\"phone = ?\", user.Phone).FirstOrCreate(&user).Error; err != nil {\n\t\te.Logger.Error(err)\n\t}\n\tvar profile domains.Profile\n\tprofile.UserID = user.Model.ID\n\tif err := db.FirstOrCreate(&profile).Error; err != nil {\n\t\tfmt.Println(err)\n\t}\n}", "func Create(user User) error {\n\t\n}", "func CreatePerson(w http.ResponseWriter, req *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t// params := mux.Vars(req)\n\tvar person models.Person\n\n\t// The user ID will be generated by the mongodb\n\t// id,_ := strconv.Atoi(params[\"id\"])\n\t// person.ID = id\n\terr := json.NewDecoder(req.Body).Decode(&person)\n\tif err != nil {\n\t\tfmt.Println(\"Oops\", err)\n\t}\n\t\n\tcollection := client.Database(\"thepolyglotdeveloper\").Collection(\"people\")\n\tctx, _ := context.WithTimeout(context.Background(), 5*time.Second)\n\tresult, _ := collection.InsertOne(ctx, person)\n\n\t// we don`t need this since we are dealing with a database\n\t//models.People = append(models.People, person) \n\tjson.NewEncoder(w).Encode(result)\t\n}", "func CreateProfile(ctx *router.Context) {\n\tuin, _ := ctx.Keys[middleware.ComerUinContextKey].(uint64)\n\trequest := &model.CreateProfileRequest{}\n\terr := ctx.BindJSON(request)\n\tif err != nil {\n\t\tctx.ERROR(\n\t\t\trouter.ErrParametersInvaild,\n\t\t\t\"wrong metamask login parameter\",\n\t\t)\n\t\treturn\n\t}\n\terr = service.CreateComerProfile(uin, request)\n\tif err != nil {\n\t\tctx.ERROR(\n\t\t\trouter.ErrBuisnessError,\n\t\t\t\"wrong metamask login parameter\",\n\t\t)\n\t\treturn\n\t}\n\n\tctx.OK(nil)\n}", "func (s *Store) Create(c *gin.Context) {\n\n}", "func (o OktaPlugin) EntityCreate(e, de pb.Entity) (pb.Entity, error) {\n\tp := &okta.PasswordCredential{\n\t\tValue: de.GetSecret(),\n\t}\n\tuc := &okta.UserCredentials{\n\t\tPassword: p,\n\t}\n\tprofile := okta.UserProfile{}\n\tprofile[\"firstName\"] = \"UNSET\"\n\tprofile[\"lastName\"] = \"UNSET\"\n\tprofile[\"employeeNumber\"] = e.GetNumber()\n\tprofile[\"email\"] = e.GetID() + \"@\" + cfg.GetString(\"domain\")\n\tprofile[\"login\"] = e.GetID() + \"@\" + cfg.GetString(\"domain\")\n\tu := &okta.User{\n\t\tCredentials: uc,\n\t\tProfile: &profile,\n\t}\n\n\tuser, _, err := o.c.User.CreateUser(*u, nil)\n\tif err != nil {\n\t\tappLogger.Error(\"Okta user was not created!\", \"error\", err)\n\t\treturn e, err\n\t}\n\n\tif e.Meta == nil {\n\t\te.Meta = &pb.EntityMeta{}\n\t}\n\n\te.Meta.UntypedMeta = tree.PatchKeyValueSlice(e.Meta.UntypedMeta, \"UPSERT\", \"oktaID\", user.Id)\n\n\treturn e, nil\n}", "func CreatePerson() *Person {\n\tvar newPerson Person\n\tnewPerson.Name = \"mario\"\n\tnewPerson.Address = \"rome\"\n\tnewPerson.Phone = 349121454\n\treturn &newPerson\n}", "func (m memberUsecase) Create(ctx context.Context, name, phone string) (*models.Member, error) {\n\treturn m.memberRepos.Create(ctx, name, phone)\n}", "func (pc UserController) Create(c *gin.Context) {\n\tvar u repository.UserRepository\n\tp, err := u.CreateModel(c)\n\n\tif err != nil {\n\t\tc.AbortWithStatus(400)\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t} else {\n\t\tc.JSON(201, p)\n\t}\n}", "func Create(c *fiber.Ctx) error {\n\temp := new(Employee)\n\tif err := c.BodyParser(emp); err != nil {\n\t\tc.JSON(\"something went wrong\")\n\t\treturn err\n\t}\n\n\tsess := session.Must(session.NewSessionWithOptions(session.Options{\n\t\tSharedConfigState: session.SharedConfigEnable,\n\t\tProfile: \"codingec\",\n\t\tConfig: aws.Config{Region: aws.String(\"us-east-1\")},\n\t}))\n\n\tdynamoSvc := dynamodb.New(sess, aws.NewConfig().WithLogLevel(aws.LogDebugWithHTTPBody))\n\n\temp.EmpID = uuid.New().String()\n\temp.PK = \"ORG#\" + emp.OrgID\n\temp.SK = \"EMP#\" + emp.EmpID\n\tav, err := dynamodbattribute.MarshalMap(emp)\n\tinput := &dynamodb.PutItemInput{\n\t\tItem: av,\n\t\tTableName: aws.String(\"project-manager\"),\n\t}\n\n\t_, err = dynamoSvc.PutItem(input)\n\n\tif err != nil {\n\t\tfmt.Println(\"Got error calling CreateTable:\")\n\t\tfmt.Println(err.Error())\n\t\treturn err\n\t}\n\n\treturn c.JSON(emp)\n}", "func CreateUser(user model.User) {\n\tfmt.Println(user)\n}", "func (gc *GreetingController) CreateGreeting(w http.ResponseWriter, r *http.Request) {\n\tvar gm GreetingModel\n\terr := json.NewDecoder(r.Body).Decode(&gm)\n\tif err != nil {\n\t\tMainLogger.Printf(\"Error decoding body: %v\", err)\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tgm.ID = bson.NewObjectId()\n\tgm.CreatedAt = time.Now()\n\tgm.CreatedBy = \"gopher\"\n\tgm.UpdatedAt = gm.CreatedAt\n\tgm.UpdatedBy = gm.CreatedBy\n\tgc.Session.DB(\"starterdb\").C(\"greetings\").Insert(gm)\n\tgmj, err := json.Marshal(gm)\n\tif err != nil {\n\t\tMainLogger.Println(\"Error marshaling into JSON\")\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusCreated)\n\tw.Write(gmj)\n}", "func (m *HealthMenstruationPersonalInfo) ToORM(ctx context.Context) (HealthMenstruationPersonalInfoORM, error) {\n\tto := HealthMenstruationPersonalInfoORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(HealthMenstruationPersonalInfoWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tif m.CreatedAt != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.CreatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.CreatedAt = &t\n\t}\n\tif m.UpdatedAt != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.UpdatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.UpdatedAt = &t\n\t}\n\tto.ProfileId = m.ProfileId\n\tto.PeriodLengthInDays = m.PeriodLengthInDays\n\tto.CycleLengthInDays = m.CycleLengthInDays\n\tif posthook, ok := interface{}(m).(HealthMenstruationPersonalInfoWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "func (u *InformationRepository) Create(model *models.Information) error {\n\tquery := u.InformationTable().Create(model)\n\tif err := query.Error; err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (t *HeathCare_Chaincode) createMedicalRecord(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tfmt.Println(\"\\n=============== start createMedicalRecord function ===============\")\n\tstart := time.Now()\n\ttime.Sleep(time.Second)\n\n\tif len(args) != 7 {\n\t\treturn shim.Error(\"there must be 7 argument\")\n\t}\n\n\tfor i := 0; i < len(args); i++ {\n\t\tif len(args[i]) == 0 {\n\t\t\treturn shim.Error(\"argument \" + strconv.Itoa(i+1) + \" must be declare\")\n\t\t}\n\t}\n\tpatientId := args[0]\n\tpersonalIdentificationInformation := args[1]\n\tmedicalHistory := args[2]\n\tfamilyMedicalHistory := args[3]\n\tmedicationHistory := args[4]\n\ttreatmentHistory := args[5]\n\tmedicalDirectives := args[6]\n\n\t//convert variable to json\n\tobjectType := \"MedicalRecord\"\n\tmedialRecord := &MedicalRecord{objectType, patientId, personalIdentificationInformation,\n\t\tmedicalHistory, familyMedicalHistory, medicationHistory,\n\t\ttreatmentHistory, medicalDirectives}\n\n\t//convert data to byte\n\tMedicalRecordAsByte, errMedicalRecordAsByte := json.Marshal(medialRecord)\n\tif errMedicalRecordAsByte != nil {\n\t\treturn shim.Error(errMedicalRecordAsByte.Error())\n\t}\n\n\t//save to database\n\terrMedicalRecordAsByte = stub.PutPrivateData(\"MedicalRecordCollection\", patientId, MedicalRecordAsByte)\n\tif errMedicalRecordAsByte != nil {\n\t\treturn shim.Error(errMedicalRecordAsByte.Error())\n\t}\n\n\t//create index key\n\tindexName := \"id\"\n\tmedicalRecordIndexKey, errMedicalRecordIndexKey := stub.CreateCompositeKey(indexName, []string{medialRecord.ID, medialRecord.PersonalIdentificationInformation, medialRecord.MedicalHistory, medialRecord.FamilyMedicalHistory, medialRecord.MedicationHistory, medialRecord.TreatmentHistory, medialRecord.MedicalDirectives})\n\tif errMedicalRecordIndexKey != nil {\n\t\treturn shim.Error(errMedicalRecordIndexKey.Error())\n\t}\n\n\t//save index\n\tvalue := []byte{0x00}\n\tstub.PutPrivateData(\"MedicalRecordCollection\", medicalRecordIndexKey, value)\n\n\tend := time.Now()\n\telapsed := time.Since(start)\n\n\tfmt.Println(\"\\nfunction createMedicalRecord\")\n\tfmt.Printf(\"time start: %s\", start.String())\n\tfmt.Printf(\"time end: %s\", end.String())\n\tfmt.Println(\"time execute: \", elapsed.String())\n\tfmt.Println(\"=============== end createMedicalRecord function ===============\")\n\treturn shim.Success(nil)\n}", "func Create(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tfmt.Fprint(w, \"Welcome!\\n\")\n}", "func runCreate(cmd *cobra.Command, args []string) {\n\tcmd.Printf(\"Creating User : Name[%s] Email[%s] Pass[%s]\\n\", create.name, create.email, create.pass)\n\n\tif create.name == \"\" && create.email == \"\" && create.pass == \"\" {\n\t\tcmd.Help()\n\t\treturn\n\t}\n\n\tu := User{\n\t\tStatus: 1,\n\t\tName: \"Bill\",\n\t\tEmail: \"bill@ardanlabs.com\",\n\t\tPassword: \"my passoword\",\n\t}\n\n\tif err := createUser(&u); err != nil {\n\t\tcmd.Println(\"Creating User : \", err)\n\t\treturn\n\t}\n\n\tcmd.Println(\"Creating User : Created\")\n}", "func CreateUser(name, email, password string) {\n\n\tm := make(map[string]interface{})\n\tm[\"Github\"] = \"\"\n\tm[\"Linkedin\"] = \"\"\n\tm[\"Twitter\"] = \"\"\n\n\tv, err := json.Marshal(m)\n\tif err != nil {\n\t\tlog.Println(\"Marshal error: \", err)\n\t\treturn\n\t}\n\n\tuser := &User{Name: name, Email: email, Password: password, Meta: string(v)}\n\n\tDb.Debug().Create(&user)\n}", "func (u *userController) Create() {\n\treturn\n}", "func (ctl UserController) Create(c *gin.Context) {\n\tvar createRequest microsoft.CreateUserRequest\n\tif err := c.ShouldBindJSON(&createRequest); err != nil {\n\t\tc.JSON(rootCtl.wrap(http.StatusUnprocessableEntity, err.Error()))\n\t\treturn\n\t}\n\n\tif err := microsoft.NewUser().Create(c.Param(\"id\"), createRequest); err != nil {\n\t\tc.JSON(rootCtl.wrap(http.StatusInternalServerError, err.Error()))\n\t\treturn\n\t}\n\n\tc.JSON(rootCtl.wrap(http.StatusOK))\n}", "func (*elephant) createCompany(name string) (*Company, error) {\n\tres := &Company{Name: name}\n\treturn res, db.Create(res).Error\n}", "func CreatePermission(c *gin.Context) {\n\tnewPermission := model.Permission{}\n\tc.BindJSON(&newPermission)\n\n\terr := service.CreatePermission(newPermission)\n\n\tif err != nil {\n\t\terror := service.GetGormErrorCode(err.Error())\n\t\tc.JSON(500, error)\n\t} else {\n\t\tc.String(200, \"ok\")\n\t}\n}", "func CreatePerson(w http.ResponseWriter, r *http.Request) {\n\tbody, err := ioutil.ReadAll(io.LimitReader(r.Body, 1048576))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := r.Body.Close(); err != nil {\n\t\tpanic(err)\n\t}\n\n\tvar personInterface interface{}\n\tif err := json.Unmarshal(body, &personInterface); err != nil {\n\t\tutils.SendJSONResponse(w, 422, \"Not Processing\", nil)\n\t}\n\n\tperson := personInterface.(map[string]interface{})\n\n\tsession := utils.GetMongoSession()\n\tdefer session.Close()\n\n\tsession.SetMode(mgo.Monotonic, true)\n\n\tupdateInfo, errDB := session.DB(\"test_db\").C(\"persons\").Upsert(\n\t\tbson.M{\"email\": person[\"email\"]},\n\t\tbson.M{\"$set\": person},\n\t)\n\n\tif errDB != nil {\n\t\tpanic(errDB)\n\t}\n\n\tutils.SendJSONResponse(w, 0, \"Success\", updateInfo)\n}", "func Create(c *gin.Context) {\n\tif userCollection == nil {\n\t\tuserCollection = db.GetUserCollection()\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\tvar userInfo entity.User\n\tif err := c.ShouldBindJSON(&userInfo); err != nil {\n\t\tc.AbortWithStatusJSON(400, gin.H{\"Error\": err.Error()})\n\t\treturn\n\t}\n\n\tid, err := userCollection.InsertOne(ctx, userInfo)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(500, gin.H{\"Error\": err.Error()})\n\t\treturn\n\t}\n\n\tc.JSON(200, gin.H{\"id\": id})\n}", "func CreateData(c *gin.Context) {\r\n\tvar predict Models.Predict\r\n\tc.BindJSON(&predict)\r\n\terr := Models.CreateData(&predict)\r\n\tif err != nil {\r\n\t\tfmt.Println(err.Error())\r\n\t\tc.AbortWithStatus(http.StatusNotFound)\r\n\t} else {\r\n\t\tc.JSON(http.StatusOK, predict)\r\n\t}\r\n}", "func (ctl UserController) Create(c *gin.Context) {\n\tvar createRequest microsoft.CreateUserRequest\n\tif err := c.ShouldBindJSON(&createRequest); err != nil {\n\t\tc.JSON(rootCtl.wrap(http.StatusUnprocessableEntity, err.Error()))\n\t\treturn\n\t}\n\n\tuid, err := microsoft.NewUser().Create(c.Param(\"id\"), createRequest)\n\tif err != nil {\n\t\tc.JSON(rootCtl.wrap(http.StatusInternalServerError, err.Error()))\n\t\treturn\n\t}\n\n\tc.JSON(rootCtl.wrap(http.StatusCreated, gin.H{\n\t\t\"id\": uid,\n\t}))\n}", "func CreateUser(person *Person) (err error) {\n\tif err = Config.DB.Create(person).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateHealthMenstruationPersonalInfo\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &HealthMenstruationPersonalInfoORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func (_obj *DataService) CreateUser(wx_id string, userInfo *UserInfo, _opt ...map[string]string) (ret int32, err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(wx_id, 1)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\terr = userInfo.WriteBlock(_os, 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\ttarsCtx := context.Background()\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"createUser\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_int32(&ret, 0, true)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn ret, nil\n}", "func (h Handler) Create(res http.ResponseWriter, req *http.Request) {\n\tdefer req.Body.Close()\n\tvar body []byte\n\t_, readErr := req.Body.Read(body)\n\tif readErr != nil {\n\t\tres.WriteHeader(400)\n\t\tres.Write([]byte(\"400 Bad Request\"))\n\t\tlog.Println(readErr.Error())\n\t\treturn\n\t}\n\tvar bodyMap map[string]interface{}\n\tmarshErr := json.Unmarshal(body, bodyMap)\n\tif marshErr != nil {\n\t\tres.WriteHeader(400)\n\t\tres.Write([]byte(\"400 Bad Request\"))\n\t\tlog.Println(marshErr.Error())\n\t}\n\tvar key string\n\tif bodyMap[\"Name\"] != nil {\n\t\tkey = serviceStateKey(bodyMap)\n\t} else {\n\t\tkey = projectStateKey(bodyMap)\n\t}\n\terrChan := make(chan error)\n\th.Store.Save(key, bodyMap, func(err error) {\n\t\terrChan <- err\n\t})\n\tsaveErr := <-errChan\n\tif saveErr != nil {\n\t\tres.WriteHeader(500)\n\t\tres.Write([]byte(\"500 Internal Error\"))\n\t\treturn\n\t}\n\tres.WriteHeader(201)\n\tres.Write([]byte(\"201 Created\"))\n\th.Running.CheckIn(bodyMap[\"Project\"].(string), bodyMap[\"Branch\"].(string))\n}", "func CreateNewEmployee(id string, username string, pass string, fName string, lName string) Employee {\n\treturn Employee{id, username, pass, fName, lName}\n}", "func (contract *ContractChaincode) createEmployee(stub shim.ChaincodeStubInterface, args []string) peer.Response {\n\n\tif len(args) != 7 {\n\t\treturn shim.Error(\"Incorrect number of arguments, required: 7\")\n\t}\n\n\t//\"createEmployee\",\"77\",\"xyz\",\"10000\",\"9.30\",\"permanent\",\"hitachi\",\"nissan\"]\n\n\tkey := args[0]\n\temployeeId, _ := strconv.Atoi(key)\n\tsalary, _ := strconv.Atoi(args[2])\n\tworkingHours, _ := strconv.ParseFloat(args[3], 64)\n\n\tvar employee = Employee{EmployeeId: employeeId, EmployeeName: args[1], Salary: salary, WorkingHours: workingHours, EmployeeType: args[4], ParentCompany: args[5], CurrentCompany: args[6]}\n\n\temployeeAsBytes, _ := json.Marshal(employee)\n\t//stub.PutState(\"emp-id\"+strconv.Itoa(employee.employeeId), employeeAsBytes)\n\tstub.PutState(key, employeeAsBytes)\n\tfmt.Println(\"Created \", employee)\n\tpayload := []byte(\"Employee created successfully\")\n\treturn shim.Success(payload)\n}", "func CreateEmployee(c *gin.Context) {\r\n var employee model.Employee\r\n c.BindJSON(&employee)\r\n err := model.CreateEmployee(&employee)\r\n if err != nil {\r\n fmt.Println(err.Error())\r\n c.AbortWithStatus(http.StatusNotFound)\r\n } else {\r\n c.JSON(http.StatusOK, employee)\r\n }\r\n}", "func (s *permisoService) Create(p *model.Permiso) (*model.Permiso, error) {\n\tp.ID = uuid.New().String()\n\tp.Status = true\n\tp.CreatedAt = time.Now()\n\tp.UpdatedAt = time.Now()\n\n\treturn repo.Create(p)\n\n\t// return nil, nil\n}", "func (h *UserHandler) Create(w http.ResponseWriter, r *http.Request) {\n\tlog.Print(\"/users POST handled\")\n\n\treq := &CreateRequest{}\n\tif err := util.ScanRequest(r, req); err != nil {\n\t\tlog.Println(err)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tuser := &schema.User{\n\t\tName: req.Name,\n\t}\n\n\tif err := h.model.Validate(user); err != nil {\n\t\tlog.Println(err)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tres, err := h.model.Create(user)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif err := util.JSONWrite(w, res, http.StatusCreated); err != nil {\n\t\tlog.Println(err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t}\n}", "func (s *business) Create(example repository.Example) *response.Error {\n\ts.logger = s.loggerClone\n\ts.logger.SugaredLogger = s.logger.With(\"method\", \"Create\")\n\n\texample.ExampleID = util.GetUUID()\n\texample.Status = \"Pending\"\n\texample.CreateTime = time.Now()\n\n\terr := s.repository.CreateExample(example)\n\tif err != nil {\n\t\ts.logger.Errorw(\"create data error\", \"error\", err)\n\t\treturn response.NewErrorFromCode(errorcode.CreateDataError)\n\t}\n\n\treturn nil\n}", "func createUser(u *User) error {\n\tif u.Status == 0 {\n\t\treturn errors.New(\"Invalid user value\")\n\t}\n\n\treturn nil\n}", "func createUser(name, password, passwordUpdateRequest string) string {\n\treturn fmt.Sprintf(`{\n \"type\": \"User\",\n \"name\": \"%s\",\n \"credential\": {\n \"type\": \"PasswordCredential\",\n\t\t\"password\": \"%s\",\n\t\t\"passwordUpdateRequest\": \"%s\"\n }\n}`, name, password, passwordUpdateRequest)\n}", "func (m *Manager) Create(ctx context.Context, tx *sql.Tx, user v0.User) error {\n\t_, err := tx.ExecContext(ctx, `\n\t\t\t\tINSERT INTO users (\n\t\t\t\t\tname, \n\t\t\t\t\temail, \n\t\t\t\t\tprimary_public_key, \n\t\t\t\t\trecovery_public_key, \n\t\t\t\t\tsuper_user, \n\t\t\t\t\tauth_level, \n\t\t\t\t\tweight,\n\t\t\t\t\tuser_set\n\t\t\t\t\t) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,\n\t\tuser.Name,\n\t\tuser.Email,\n\t\tuser.PrimaryPublicKey,\n\t\tuser.RecoveryPublicKey,\n\t\tuser.SuperUser,\n\t\tuser.AuthLevel,\n\t\tuser.Weight,\n\t\tuser.Set,\n\t)\n\treturn err\n}", "func (p *Profile) AfterCreate(scope *gorm.Scope) (err error) {\n\tfmt.Println(\"After Create\")\n\treturn\n}", "func Create(w http.ResponseWriter, r *http.Request) {\n\n\taccountDecoder := json.NewDecoder(r.Body)\n\tvar accData Account\n\terr := accountDecoder.Decode(&accData)\n\tif err != nil {\n\t\tlog.Fatalln(\"error:\", err)\n\t}\n\taccData.CreateAccount()\n\tfmt.Fprintf(w, \"Account added successfully\")\n}", "func (a *App) CreateEntity(w http.ResponseWriter, r *http.Request) {\n\tvar e Entity\n\te.Uuid = uuid.NewV4().String()\n\tdecoder := json.NewDecoder(r.Body)\n\tif err := decoder.Decode(&e); err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, errors.New(\"invalid request payload\"))\n\t\treturn\n\t}\n\tdefer func() { _ = r.Body.Close() }()\n\n\tif err := e.createEntity(a.DB); err != nil {\n\t\tlog.Print(err)\n\t\trespondWithError(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\trespondWithJSON(w, http.StatusCreated, e)\n}", "func CreateInitialEngineerProfile() {\n\tEngineers = make([]Engineer, 0)\n\tengineer := Engineer{\n\t\tUsername: \"masud\",\n\t\tFirstName: \"Masudur\",\n\t\tLastName: \"Rahman\",\n\t\tCity: \"Madaripur\",\n\t\tDivision: \"Dhaka\",\n\t\tPosition: \"Software Engineer\",\n\t}\n\tEngineers = append(Engineers, engineer)\n\n\tengineer = Engineer{\n\t\tUsername: \"fahim\",\n\t\tFirstName: \"Fahim\",\n\t\tLastName: \"Abrar\",\n\t\tCity: \"Chittagong\",\n\t\tDivision: \"Chittagong\",\n\t\tPosition: \"Software Engineer\",\n\t}\n\tEngineers = append(Engineers, engineer)\n\n\tengineer = Engineer{\n\t\tUsername: \"tahsin\",\n\t\tFirstName: \"Tahsin\",\n\t\tLastName: \"Rahman\",\n\t\tCity: \"Chittagong\",\n\t\tDivision: \"Chittagong\",\n\t\tPosition: \"Software Engineer\",\n\t}\n\tEngineers = append(Engineers, engineer)\n\n\tengineer = Engineer{\n\t\tUsername: \"jenny\",\n\t\tFirstName: \"Jannatul\",\n\t\tLastName: \"Ferdows\",\n\t\tCity: \"Chittagong\",\n\t\tDivision: \"Chittagong\",\n\t\tPosition: \"Software Engineer\",\n\t}\n\tEngineers = append(Engineers, engineer)\n\n\tif exist, _ := engine.IsTableExist(new(Engineer)); !exist {\n\t\tif err := engine.CreateTables(new(Engineer)); err != nil {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\t}\n\n\tsession := engine.NewSession()\n\tdefer session.Close()\n\n\tif err := session.Begin(); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tfor _, user := range Engineers {\n\t\tif _, err := session.Insert(&user); err != nil {\n\t\t\tif err = session.Rollback(); err != nil {\n\t\t\t\tlog.Fatalln(err)\n\t\t\t}\n\t\t}\n\t}\n\tif err := session.Commit(); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tauthUser[\"masud\"] = \"pass\"\n\tauthUser[\"admin\"] = \"admin\"\n\n}", "func (u *User) Create() error {\n\tif handler == nil {\n\t\treturn errHandlerNotSet\n\t}\n\tpossible := handler.NewRecord(u)\n\tif possible {\n\t\tif err := handler.Create(u).Error; err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c *PatientofphysicianClient) Create() *PatientofphysicianCreate {\n\tmutation := newPatientofphysicianMutation(c.config, OpCreate)\n\treturn &PatientofphysicianCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func callCreate(repo interface{}, methodName string, ctx context.Context, tenant string, modelEntity interface{}) error {\n\targs := []reflect.Value{reflect.ValueOf(ctx)}\n\tif len(tenant) > 0 {\n\t\targs = append(args, reflect.ValueOf(tenant))\n\t}\n\targs = append(args, reflect.ValueOf(modelEntity))\n\tresults := reflect.ValueOf(repo).MethodByName(methodName).Call(args)\n\tif len(results) != 1 {\n\t\tpanic(\"Create should return one argument\")\n\t}\n\tresult := results[0].Interface()\n\tif result == nil {\n\t\treturn nil\n\t}\n\terr, ok := result.(error)\n\tif !ok {\n\t\tpanic(\"Expected result to be an error\")\n\t}\n\treturn err\n}", "func (u *UserHandler) Create(c *fiber.Ctx) error {\n\tuser := models.User{}\n\terr := c.BodyParser(&user)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = u.Repo.Create(user)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.Status(fiber.StatusOK).JSON(user)\n}", "func (m *Manager) CreateAuditLogDetail(ald *AuditLogDetail) error {\n\tnow := time.Now()\n\tald.CreatedAt = now\n\n\tfunc(in interface{}) {\n\t\tif ii, ok := in.(initializer.Simple); ok {\n\t\t\tii.Initialize()\n\t\t}\n\t}(ald)\n\n\treturn m.GetWDbMap().Insert(ald)\n}", "func (a *App) AuthCreate100(w http.ResponseWriter, r *http.Request) {\n\tservice := \"auth/create\"\n\tAuthAndCallAPI(w, r, service, \"post\", \"v100\")\n}", "func CreateEmployee(w http.ResponseWriter, r *http.Request) {\r\n\tcookie, err := r.Cookie(\"token\")\r\n\tif err != nil {\r\n\t\tif err == http.ErrNoCookie {\r\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\r\n\t\t\treturn\r\n\t\t}\r\n\t\tw.WriteHeader(http.StatusBadRequest)\r\n\t\treturn\r\n\t}\r\n\r\n\ttokenStr := cookie.Value\r\n\r\n\tclaims := &Claims{}\r\n\r\n\ttkn, err := jwt.ParseWithClaims(tokenStr, claims,\r\n\t\tfunc(t *jwt.Token) (interface{}, error) {\r\n\t\t\treturn jwtKey, nil\r\n\t\t})\r\n\r\n\tif err != nil {\r\n\t\tif err == jwt.ErrSignatureInvalid {\r\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\r\n\t\t\treturn\r\n\t\t}\r\n\t\tw.WriteHeader(http.StatusBadRequest)\r\n\t\treturn\r\n\t}\r\n\r\n\tif !tkn.Valid {\r\n\t\tw.WriteHeader(http.StatusUnauthorized)\r\n\t\treturn\r\n\t}\r\n\r\n\tdb := createConnection()\r\n\r\n\tvar emp models.Employee\r\n\terrr := json.NewDecoder(r.Body).Decode(&emp)\r\n\tif errr != nil {\r\n\t\tlog.Panic(\"Unable to decode the request body\")\r\n\t}\r\n\tinsertDynStmt := `insert into \"employee\"( \"empname\",\"emppro\") values($1, $2) returning id`\r\n\tid := 0\r\n\terrr = db.QueryRow(insertDynStmt, emp.EmpName, emp.EmpPRO).Scan(&id)\r\n\tif errr != nil {\r\n\t\tlog.Panic(\"Unable to execute the query\")\r\n\t}\r\n\tres := JsonResponse{\r\n\t\tID: int64(id),\r\n\t\tMessage: \"Row created\",\r\n\t}\r\n\tjson.NewEncoder(w).Encode(res)\r\n\r\n}", "func newUserLogin(c *gin.Context){\n\tvar userInfo models.UserInfo\n\tc.BindJSON(&userInfo)\n\n\n fmt.Printf(\"\\n user existring %+v %+v\", userInfo.Name, userInfo.MobileNumber)\n existingUser, existingUserErr := db.GetUserInfo(userInfo.Name, userInfo.MobileNumber)\n if existingUserErr == nil {\n fmt.Printf(\"\\n user existring\")\n payload := models.PayloadLogin{\n \t\tToken: existingUser.Token,\n \t\tUserInfo: existingUser}\n \tutils.SendSuccess(c, payload)\n return\n }\n fmt.Printf(\"\\n error %+v\",existingUserErr )\n userInfo.Id = gocql.UUID.String(gocql.TimeUUID())\n userInfo.IsDisabled = false\n userInfo.Token = utils.CreateToken(userInfo.Id)\n createUserErr := db.CreateUser(userInfo)\n if createUserErr != nil {\n fmt.Printf(\"\\n newUserLogin %+v\", createUserErr)\n utils.SendError(c, 200, utils.APP_ERROR_SERVER)\n return\n }\n\t// Create session token for the user token\n\tpayload := models.PayloadLogin{\n\t\tToken: userInfo.Token,\n\t\tUserInfo: userInfo}\n\tutils.SendSuccess(c, payload)\n}", "func Create(v validator.Validator, ps profile.Service) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvar prof profile.Profile\n\t\terr := json.NewDecoder(r.Body).Decode(&prof)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"%s: %v\", CreateErrCode, err)\n\t\t\tresp := &je.Response{\n\t\t\t\tCode: CreateErrCode,\n\t\t\t\tMessage: err.Error(),\n\t\t\t}\n\t\t\tje.Error(r, w, resp, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// validate profile\n\t\tok, fieldErrors := v.Struct(prof)\n\t\tif !ok {\n\t\t\tresp := &je.Response{\n\t\t\t\tCode: CreateBadDataCode,\n\t\t\t\tMessage: CreateBadDataCode,\n\t\t\t\tAdditional: fieldErrors,\n\t\t\t}\n\t\t\tje.Error(r, w, resp, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// override the account ID with the session accountID\n\t\tsession := r.Context().Value(\"Session\").(*token.Session)\n\t\tprof.AccountID = session.AccountID\n\n\t\tp, err := ps.Create(prof)\n\t\tif err != nil {\n\t\t\tresp := &je.Response{\n\t\t\t\tCode: CreateErrCode,\n\t\t\t\tMessage: err.Error(),\n\t\t\t}\n\t\t\tje.Error(r, w, resp, profile.ServiceToHTTPErrorMap(err))\n\t\t\treturn\n\t\t}\n\n\t\t// return created profile\n\t\tw.WriteHeader(http.StatusCreated) // must write status header before NewEcoder closes body\n\t\terr = json.NewEncoder(w).Encode(p)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"%s: %v\", CreateErrCode, err)\n\t\t\tresp := &je.Response{\n\t\t\t\tCode: CreateErrCode,\n\t\t\t\tMessage: err.Error(),\n\t\t\t}\n\t\t\tje.Error(r, w, resp, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tlog.Printf(\"successfully created profile for ID %s\", prof.ID)\n\t\treturn\n\t}\n}", "func CreateOrUpdateChat (db *store.InMemory) func (resp http.ResponseWriter, req *http.Request, params httprouter.Params) {\n return NotImplemented\n}", "func createPerson(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tvar person Person\n\t_ = json.NewDecoder(r.Body).Decode(&person)\n\tpeople = append(people, person)\n\tjson.NewEncoder(w).Encode(person)\n\n}", "func (c *UserRepoImpl) Create(user *model.User) (*model.User, error) {\n\tif err := c.db.Table(\"user\").Save(&user).Error; err != nil {\n\t\tfmt.Errorf(\"Having error : %w\", err)\n\t\tlogrus.Error(err)\n\t\treturn nil, errors.New(\"add user data : error\")\n\t}\n\treturn user, nil\n}" ]
[ "0.62478477", "0.61608213", "0.60926765", "0.58868814", "0.5844858", "0.5783213", "0.5739187", "0.57295036", "0.5607786", "0.55578446", "0.5516983", "0.5479335", "0.5433335", "0.5418112", "0.5392498", "0.5370654", "0.5341402", "0.5338584", "0.5335343", "0.53119457", "0.53099215", "0.52835894", "0.52714974", "0.52655464", "0.52465504", "0.52433187", "0.5232905", "0.5208293", "0.5204899", "0.52042896", "0.5200776", "0.5191798", "0.5173864", "0.5170674", "0.5163448", "0.5154335", "0.51235783", "0.51229596", "0.5120859", "0.50996107", "0.50963527", "0.5095895", "0.50799215", "0.50795", "0.5078746", "0.5074648", "0.5074474", "0.5072551", "0.50717485", "0.5066825", "0.50610185", "0.5058797", "0.50554067", "0.5047297", "0.5041428", "0.5035808", "0.5033703", "0.5027199", "0.50056875", "0.5002481", "0.50004", "0.5000307", "0.49959457", "0.49951538", "0.49926284", "0.4988217", "0.49830547", "0.49792534", "0.4976642", "0.4974577", "0.49712718", "0.4967315", "0.4966975", "0.49579346", "0.49502277", "0.49480948", "0.49454254", "0.49448636", "0.4926743", "0.49237832", "0.49160454", "0.49078766", "0.49066246", "0.49050796", "0.48956794", "0.48925278", "0.48904175", "0.48891842", "0.48845193", "0.48782575", "0.4870999", "0.48672947", "0.48622456", "0.48555112", "0.48542395", "0.4853435", "0.48528308", "0.48523113", "0.48522937", "0.48496172" ]
0.81025505
0
DefaultReadHealthMenstruationPersonalInfo executes a basic gorm read call
DefaultReadHealthMenstruationPersonalInfo выполняет базовый вызов gorm для чтения
func DefaultReadHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) { if in == nil { return nil, errors1.NilArgumentError } ormObj, err := in.ToORM(ctx) if err != nil { return nil, err } if ormObj.Id == 0 { return nil, errors1.EmptyIdError } if hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeReadApplyQuery); ok { if db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil { return nil, err } } if db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &HealthMenstruationPersonalInfoORM{}); err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeReadFind); ok { if db, err = hook.BeforeReadFind(ctx, db); err != nil { return nil, err } } ormResponse := HealthMenstruationPersonalInfoORM{} if err = db.Where(&ormObj).First(&ormResponse).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormResponse).(HealthMenstruationPersonalInfoORMWithAfterReadFind); ok { if err = hook.AfterReadFind(ctx, db); err != nil { return nil, err } } pbResponse, err := ormResponse.ToPB(ctx) return &pbResponse, err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DefaultListHealthMenstruationPersonalInfo(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*HealthMenstruationPersonalInfo, error) {\n\tin := HealthMenstruationPersonalInfo{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm2.ApplyCollectionOperators(ctx, db, &HealthMenstruationPersonalInfoORM{}, &HealthMenstruationPersonalInfo{}, f, s, p, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []HealthMenstruationPersonalInfoORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*HealthMenstruationPersonalInfo{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func DefaultReadHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, 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 == 0 {\n\t\treturn nil, errors1.EmptyIdError\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeReadApplyQuery); ok {\n\t\tif db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &HealthMenstruationDailyEntryORM{}); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeReadFind); ok {\n\t\tif db, err = hook.BeforeReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tormResponse := HealthMenstruationDailyEntryORM{}\n\tif err = db.Where(&ormObj).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormResponse).(HealthMenstruationDailyEntryORMWithAfterReadFind); ok {\n\t\tif err = hook.AfterReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultCreateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, 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 hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeCreate_); ok {\n\t\tif db, err = hook.BeforeCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterCreate_); ok {\n\t\tif err = hook.AfterCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultReadProfile(ctx context.Context, in *Profile, db *gorm1.DB) (*Profile, 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).(ProfileORMWithBeforeReadApplyQuery); ok {\n\t\tif db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &ProfileORM{}); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(ProfileORMWithBeforeReadFind); ok {\n\t\tif db, err = hook.BeforeReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tormResponse := ProfileORM{}\n\tif err = db.Where(&ormObj).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormResponse).(ProfileORMWithAfterReadFind); ok {\n\t\tif err = hook.AfterReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultPatchHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj HealthMenstruationPersonalInfo\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadHealthMenstruationPersonalInfo(ctx, &HealthMenstruationPersonalInfo{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskHealthMenstruationPersonalInfo(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(HealthMenstruationPersonalInfoWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateHealthMenstruationPersonalInfo\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &HealthMenstruationPersonalInfoORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func DefaultReadContact(ctx context.Context, in *Contact, db *gorm.DB) (*Contact, error) {\n\tif in == nil {\n\t\treturn nil, errors.New(\"Nil argument to DefaultReadContact\")\n\t}\n\tormParams, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\taccountID, err := auth.GetAccountID(ctx, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tormParams.AccountID = accountID\n\tormResponse := ContactORM{}\n\tif err = db.Set(\"gorm:auto_preload\", true).Where(&ormParams).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func (c *UserRepoImpl) Read(id int) (*model.User, error) {\n\tuser := new(model.User)\n\n\tif err := c.db.Table(\"user\").Where(\"user_id = ?\", id).First(&user).Error; err != nil {\n\t\tlogrus.Error(err)\n\t\treturn nil, errors.New(\"get user data : error \")\n\t}\n\n\treturn user, nil\n}", "func (m *User) Read(fields ...string) error {\n\to := orm.NewOrm()\n\treturn o.Read(m, fields...)\n}", "func (m *User) Read(fields ...string) error {\n\to := orm.NewOrm()\n\treturn o.Read(m, fields...)\n}", "func DefaultReadContact(ctx context.Context, in *Contact, db *gorm.DB) (*Contact, error) {\n\tif in == nil {\n\t\treturn nil, errors.New(\"Nil argument to DefaultReadContact\")\n\t}\n\tormParams, err := ConvertContactToORM(*in)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tormResponse := ContactORM{}\n\tif err = db.Set(\"gorm:auto_preload\", true).Where(&ormParams).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tpbResponse, err := ConvertContactFromORM(ormResponse)\n\treturn &pbResponse, err\n}", "func (m *ContactsDefaultServer) CustomRead(ctx context.Context, req *ReadContactRequest) (*ReadContactResponse, error) {\n\tres, err := DefaultReadContact(ctx, &Contact{Id: req.GetId()}, m.DB)\n\tif err != nil {\n\t\tst := status.Newf(codes.Internal, \"Unable to read contact. Error %v\", err)\n\t\tst, _ = st.WithDetails(errdetails.New(codes.Internal, \"CustomRead\", \"Custom error message\"))\n\t\tst, _ = st.WithDetails(errdetails.New(codes.Internal, \"CustomRead\", \"Another custom error message\"))\n\t\treturn nil, st.Err()\n\t}\n\treturn &ReadContactResponse{Result: res}, nil\n}", "func GetHealth(w http.ResponseWriter, r *http.Request, db *sqlx.DB) {\n\tparams := mux.Vars(r)\n\n\thealth := []Health{}\n\n\tvar err error\n\n\tsession, err := store.Get(r, \"auth\")\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Convert our session data into an instance of User\n\tuser := User{}\n\tuser, _ = session.Values[\"user\"].(User)\n\n\tif user.Username != \"\" && user.AccessLevel == \"admin\" {\n\t\tif _, ok := params[\"id\"]; ok {\n\t\t\terr = db.Select(&health, \"SELECT id, username, ts, variable, value \"+\n\t\t\t\t\"FROM public.health \"+\n\t\t\t\t\"WHERE id = $1 \", params[\"id\"])\n\t\t} else if _, ok = params[\"ts\"]; ok {\n\t\t\terr = db.Select(&health, \"SELECT id, username, ts, variable, value \"+\n\t\t\t\t\"FROM public.health \"+\n\t\t\t\t\"WHERE ts = $1 \", params[\"ts\"])\n\t\t} else if _, ok = params[\"variable\"]; ok {\n\t\t\terr = db.Select(&health, \"SELECT id, username, ts, variable, value \"+\n\t\t\t\t\"FROM public.health \"+\n\t\t\t\t\"WHERE variable = $1 \", params[\"variable\"])\n\t\t} else {\n\t\t\terr = db.Select(&health, \"SELECT id, username, ts, variable, value \"+\n\t\t\t\t\"FROM public.health \")\n\t\t}\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tw.WriteHeader(http.StatusOK)\n\n\t\tif err := json.NewEncoder(w).Encode(health); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t} else {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tw.WriteHeader(http.StatusOK)\n\n\t\tif err := json.NewEncoder(w).Encode(\"access denied\"); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\tlogRequest(r)\n}", "func (C *Commander) GetData(writer http.ResponseWriter, request *http.Request) {\n\tvar error model.Error\n\tdb := database.DbConn()\n\tdefer func() {\n\t\terr := db.Close()\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t}()\n\tif strings.Contains(Role, \"program manager\") == true {\n\t\tvar Offset int\n\t\tPages := request.URL.Query()[\"Pages\"]\n\t\tfmt.Println(Pages)\n\t\tif Pages[0] != \"\" {\n\t\t\tlimit, err := strconv.Atoi(request.URL.Query().Get(\"limit\"))\n\t\t\tif limit != 10 && limit != 20 && limit != 50 {\n\t\t\t\twriter.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\t\twriter.WriteHeader(http.StatusBadRequest)\n\t\t\t\terror.Message = \"Incorrect Limit Value\"\n\t\t\t\tjson.NewEncoder(writer).Encode(error)\n\t\t\t\treturn\n\t\t\t}\n\t\t\ti1, _ := strconv.Atoi(Pages[0])\n\t\t\tfmt.Println(i1)\n\t\t\tOffset = 10 * i1\n\t\t\tcount, _ := db.Query(\"SELECT COUNT(Id) FROM sub_project_manager WHERE sub_project_id in (SELECT id FROM sub_project WHERE project_id in (SELECT id FROM project WHERE program_manager_id in (SELECT id FROM program_manager where program_manager_email = ?)))\", UserName)\n\t\t\tdefer func() {\n\t\t\t\terr := count.Close()\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(err.Error())\n\t\t\t\t}\n\t\t\t}()\n\t\t\tGetManagerDetails, err := db.Query(\"call GetAllManagerDetailsData(?, ?, ?)\", UserName, Offset, limit)\n\t\t\tif err != nil {\n\t\t\t\tWriteLogFile(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdefer func() {\n\t\t\t\terr := GetManagerDetails.Close()\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(err.Error())\n\t\t\t\t}\n\t\t\t}()\n\t\t\tvar Total int\n\t\t\tvar ManagerDetailData model.Project\n\t\t\tvar ManagerDetailsData []model.Project\n\t\t\tfor GetManagerDetails.Next() {\n\t\t\t\tGetManagerDetails.Scan(&ManagerDetailData.ProjectName, &ManagerDetailData.SubProjectName, &ManagerDetailData.ManagerName, &ManagerDetailData.ManagerEmailID, &ManagerDetailData.Id)\n\t\t\t\tManagerDetailsData = append(ManagerDetailsData, ManagerDetailData)\n\t\t\t}\n\t\t\tif count.Next() != false {\n\t\t\t\tcount.Scan(&Total)\n\t\t\t} else {\n\t\t\t\tTotal = 0\n\t\t\t}\n\t\t\tvar PaginationFormat model.Pagination\n\t\t\tPaginationFormat.TotalData = Total\n\t\t\tPaginationFormat.Limit = limit\n\t\t\tPaginationFormat.Data = ManagerDetailsData\n\t\t\tx1 := Total / limit\n\t\t\tx := Total % limit\n\t\t\tif x == 0 {\n\t\t\t\tPaginationFormat.TotalPages = x1\n\t\t\t} else {\n\t\t\t\tPaginationFormat.TotalPages = x1 + 1\n\t\t\t}\n\t\t\tx, _ = strconv.Atoi(Pages[0])\n\t\t\tif PaginationFormat.TotalPages != 0 {\n\t\t\t\tx1 = x + 1\n\t\t\t}\n\t\t\tPaginationFormat.Page = x1\n\t\t\tsetupResponse(&writer, request)\n\t\t\twriter.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\twriter.WriteHeader(http.StatusOK)\n\t\t\tjson.NewEncoder(writer).Encode(PaginationFormat)\n\t\t} else {\n\t\t\twriter.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\twriter.WriteHeader(http.StatusBadRequest)\n\t\t\terror.Message = \"Incorrect Page Value\"\n\t\t\tjson.NewEncoder(writer).Encode(error)\n\t\t\treturn\n\n\t\t}\n\t} else {\n\t\twriter.WriteHeader(http.StatusNotFound)\n\t}\n}", "func (d *DepartmentRepoImpl) Read(deptno int32) (models.Department, error) {\n\tdept := models.Department{}\n\tgetDepartment := d.DB.Table(\"departments\").Where(\"id = ?\", deptno).Find(&dept)\n\tif getDepartment.Error != nil {\n\t\tfmt.Println(\"[Repo Error] :\", getDepartment.Error)\n\t\treturn dept, getDepartment.Error\n\t}\n\n\treturn dept, nil\n}", "func Read(w http.ResponseWriter, r *http.Request) {\n\n\t//use above functions to parse string and find user\n\tuName := GetQueryString(w, r)\n\n\tuser, findErr := userOps.FindUserByUsername(uName)\n\n\t//handle err\n\tif findErr != nil {\n\t\tw.WriteHeader(404)\n\t\tw.Write([]byte(\"Not found\"))\n\t\treturn\n\t}\n\n\t//Success, 200 response\n\tw.WriteHeader(200)\n\tw.Write([]byte(user.Username))\n}", "func (self *RegisObjManager) LoadPersonalChatLogObj(id string) *RedisPersonalChatLogObj {\n\tvalue, ok := self.Load(id)\n\tif ok {\n\t\treturn value.(*RedisPersonalChatLogObj)\n\t}\n\treturn nil\n}", "func (m *Master) ReadInfoFromFile(filepath string) error {\n\t// open file\n\tfile, err := os.OpenFile(filepath, os.O_RDONLY|os.O_CREATE, 0666)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// close file\n\tdefer file.Close()\n\n\t// check file size\n\t// stats, err := file.Stat()\n\t// if err != nil {\n\t// \treturn err\n\t// }\n\t// fileSize := stats.Size()\n\t// buf := make([]byte, fileSize)\n\n\t// read file\n\tdataLenBytes := make([]byte, 8)\n\tuserTypeBytes := make([]byte, 1)\n\tfor {\n\t\t// data len\n\t\tvar dataLen int64 = 0 // data len\n\t\tn, err := io.ReadFull(file, dataLenBytes)\n\t\tif err != nil || n != 8 {\n\t\t\tbreak\n\t\t}\n\t\tbytesBuffer := bytes.NewBuffer(dataLenBytes)\n\t\tbinary.Read(bytesBuffer, binary.LittleEndian, &dataLen)\n\t\t// fmt.Println(\"data len =\", dataLen)\n\n\t\t// user type\n\t\tn, err = io.ReadFull(file, userTypeBytes)\n\t\tif err != nil || n != 1 {\n\t\t\tbreak\n\t\t}\n\t\t// fmt.Println(\"user type =\", userTypeBytes[0])\n\n\t\t// data\n\t\tfile.Seek(-1, 1) // 回退一个字节,用户类型\n\t\tdataBytes := make([]byte, dataLen)\n\t\tn, err = io.ReadFull(file, dataBytes)\n\t\tif err != nil || int64(n) != dataLen {\n\t\t\tbreak\n\t\t}\n\n\t\tswitch model.UserType(userTypeBytes[0]) {\n\t\tcase model.TypeTeacher:\n\t\t\ts := &model.Teacher{}\n\t\t\tif err := s.UnSerialize(dataBytes); err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// s.DisplayInfo()\n\t\t\tm.allUserInfo[model.AllUserType[0]][s.ID] = s\n\t\tcase model.TypeStudent:\n\t\t\tt := &model.Student{}\n\t\t\tif err := t.UnSerialize(dataBytes); err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// t.DisplayInfo()\n\t\t\tm.allUserInfo[model.AllUserType[1]][t.ID] = t\n\t\t}\n\t}\n\t// fmt.Println(\"file size =\", fileSize, \",read size =\", n)\n\n\treturn nil\n}", "func (r *UserRead) show(q *msg.Request, mr *msg.Result) {\n\tvar (\n\t\tuserID, userName string\n\t\tfirstName, lastName string\n\t\tmailAddr, team string\n\t\tdictID, dictName, createdBy string\n\t\tcreatedAt time.Time\n\t\temployeeNr int\n\t\tisActive, isSystem, isDeleted bool\n\t\terr error\n\t)\n\n\tif err = r.stmtShow.QueryRow(\n\t\tq.User.ID,\n\t).Scan(\n\t\t&userID,\n\t\t&userName,\n\t\t&firstName,\n\t\t&lastName,\n\t\t&employeeNr,\n\t\t&mailAddr,\n\t\t&isActive,\n\t\t&isSystem,\n\t\t&isDeleted,\n\t\t&team,\n\t\t&dictID,\n\t\t&dictName,\n\t\t&createdBy,\n\t\t&createdAt,\n\t); err == sql.ErrNoRows {\n\t\tmr.NotFound(err, q.Section)\n\t\treturn\n\t} else if err != nil {\n\t\tmr.ServerError(err, q.Section)\n\t\treturn\n\t}\n\n\tmr.User = append(mr.User, proto.User{\n\t\tID: userID,\n\t\tUserName: userName,\n\t\tFirstName: firstName,\n\t\tLastName: lastName,\n\t\tEmployeeNumber: strconv.Itoa(employeeNr),\n\t\tMailAddress: mailAddr,\n\t\tIsActive: isActive,\n\t\tIsSystem: isSystem,\n\t\tIsDeleted: isDeleted,\n\t\tTeamID: team,\n\t\tDetails: &proto.UserDetails{\n\t\t\tCreation: &proto.DetailsCreation{\n\t\t\t\tCreatedAt: createdAt.Format(msg.RFC3339Milli),\n\t\t\t\tCreatedBy: createdBy,\n\t\t\t},\n\t\t\tDictionaryID: dictID,\n\t\t\tDictionaryName: dictName,\n\t\t},\n\t})\n\tmr.OK()\n}", "func (c *AllergyIntoleranceController) Read(ctx *app.ReadAllergyIntoleranceContext) error {\n\t//var sqlParams []interface{}\n\tx := json.RawMessage{}\n\n\tabsPath, _ := filepath.Abs(\"bundle.json\")\n\tfmt.Println(absPath)\n\tfile, err := os.Open(absPath)\n\tif err == nil {\n\t\t_ = json.NewDecoder(file).Decode(&x)\n\t}\n\tfile.Close()\n\n\t//getJson(\"http://nprogram.azurewebsites.net/Patient/1?_format=json\", patient)\n\t//getJson(\"http://localhost:3001\", patient)\n\t// //getJson(\"https://open-ic.epic.com/FHIR/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB\", patient)\n\t//_, err = json.NewDecoder(file).Decode(patient)\n\t//, err := cc.Get(\"http://fhirtest.uhn.ca/baseDstu2/Patient/EXexample\")\n\t//r, err := cc.Get(\"http://nprogram.azurewebsites.net/Patient/1?_format=json\")\n\n\t// if err != nil {\n\t// \tfmt.Println(\"A timeout error occured\")\n\t// \tos.Exit(3)\n\t// }\n\t// defer r.Body.Close()\n\n\t// body, _ := ioutil.ReadAll(r.Body)\n\n\t// isJSON := IsJSON(string(body))\n\t// if isJSON == true {\n\t// \tfmt.Println(\"Yesssssssssssssssssssssssssssssssssssssssssssssssss\")\n\t// \t_ = json.Unmarshal(body, &x)\n\t// } else {\n\t// \tfmt.Println(\"NOoooooooooooooooooooooooooooooooooooooooooooo\")\n\t// \t_ = xml.Unmarshal(body, &x)\n\t// }\n\n\t//err = json.Unmarshal([]byte(r), &f)\n\n\t// //b, _ := json.Marshal(body)\n\t// return json.Unmarshal(body, &target)\n\t//fmt.Printf(\"%s\", x)\n\n\tfmt.Println()\n\t//main_rt := gjson.Get(string(x), \"resourceType\")\n\t//sub_rt := gjson.Get(string(x), \"entry.#.resource.resourceType\")\n\t// m, ok := gjson.Parse(string(x)).Value().(map[string]interface{})\n\t// if !ok {\n\t// \t// not a map\n\t// }\n\n\t//value1 := gjson.Get(string(x), \"*\")\n\t//value2 := gjson.Get(string(x), \"entry.#.resource.code.coding.#.display\")\n\t//value2 := gjson.Get(string(x), \"entry.#.resource.component.#.valueQuantity.value\")\n\t//value2 := gjson.Get(string(x), \"entry.#.resource.component.#.code.coding.#.display\")\n\n\t//value3 := gjson.Get(string(x), \"identifier\")\n\t//fmt.Println(\"value *:\", value1.String())\n\n\t//fmt.Println(\"resource:\", value11.String())\n\t//fmt.Println(\"entry:\", value2.String())\n\t//fmt.Println(\"value:\", value3.String())\n\t//result := gjson.Get(string(x), \"entry.#.resource\")\n\n\t// //results := gjson.GetMany(string(x), \"entry.#.resource.code.coding.#.display\", \"entry.#.resource.component.#.code.coding.#.display\", \"entry.#.resource.component.#.valueQuantity.Value\")\n\t// results := gjson.GetMany(string(x), \"entry.#.resource.component.#.code.coding.#.display\", \"entry.#.resource.component.#.valueQuantity.value\")\n\n\t//_ = json.Unmarshal(x, &patient)\n\t//_, _ = json.Marshal(string(x))\n\n\t//_ = json.NewDecoder(r.Body).Decode(&x)\n\t//fmt.Println(results)\n\t//fmt.Printf(\"Indentifer:\", x.Matches[0].Ad, \"\\n\")\n\t//fmt.Println(\"Address:\", x.Address)\n\t//fmt.Println(\"Telecom:\", x.Telecom)\n\t//fmt.Println(\"CareProvider:\", x.CareProvider)\n\t//fmt.Println(\"Name:\", x.Name)\n\t//fmt.Printf(\"Contact:\", x.Contact)\n\n\t//fmt.Println(\"x is equal to:\", x.Address[0].Text)\n\n\t// res := &app.Patient{}\n\t// res.Active = patient.Active\n\t// res.BirthDate = patient.BirthDate\n\t// res.Gender = patient.Gender\n\t// //res.Telecom = patient.Telecom\n\t//res.Address=patient.Address\n\t//res.Address=\n\n\t//json.Marshal(patient)\n\n\t// \ttype int64array []int64\n\n\t// func (a int64array) Value() (driver.Value, error) {\n\t// // Format a in PostgreSQL's array input format {1,2,3} and return it as as string or []byte.\n\t// }\n\t//_, _ = json.Marshal(x)\n\n\t//g, _ := json.Marshal(x)\n\t//fmt.Println(string(g))\n\t// _, err = stmt.Exec(uuid.NewV4().String(), string(g))\n\t// if err != nil {\n\t// \tfmt.Println(err.Error())\n\t// \tfmt.Println(\"Error with db\")\n\t// }\n\n\t//json.Marshal(x)\n\n\t// t := app.Observation{}\n\t// s := reflect.ValueOf(&t).Elem()\n\t// typeOfT := s.Type()\n\n\t// for i := 0; i < s.NumField(); i++ {\n\t// \t//f := s.Field(i)\n\t// \t//fmt.Printf(\"%d: %s %s = %v\\n\", i,\n\t// \t//typeOfT.Field(i).Name, f.Type(), f.Interface())\n\t// \t//test2 := fmt.Sprintf(\"%T\", s.Field(i))\n\t// \ttest2 := fmt.Sprintf(\"%T\", s.Field(i))\n\n\t// \tfmt.Println(reflect.TypeOf(test2).Kind())\n\t// \t//fmt.Println(*test2)\n\n\t// \ttest := fmt.Sprintf(\"%s\", strings.ToLower(typeOfT.Field(i).Name))\n\t// \tfmt.Println(test)\n\n\t// \tvalue := gjson.Get(string(x), test)\n\t// \tfmt.Println()\n\t// \tfmt.Println(\"value *:\", value.String())\n\n\t// }\n\n\t//res := &app.AllergyIntoleranceMedia{}\n\treturn nil\n\t//return ctx.OK(res)\n\n}", "func DefaultListHealthMenstruationDailyEntry(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*HealthMenstruationDailyEntry, error) {\n\tin := HealthMenstruationDailyEntry{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm2.ApplyCollectionOperators(ctx, db, &HealthMenstruationDailyEntryORM{}, &HealthMenstruationDailyEntry{}, f, s, p, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []HealthMenstruationDailyEntryORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*HealthMenstruationDailyEntry{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func readUser(r *request.Request) (request.Response, error) {\n\tif r.Context.UserID != 0 {\n\t\tuser, err := users.ListUsers(r.Request.Context(), users.ListArgs{}, users.ListFilter{AccountID: []int32{r.Context.UserID}})\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not retrieve current user: %v\", err)\n\t\t} else if len(user) == 1 {\n\t\t\tr.Context.User = user[0]\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"did not find current user %v in database\", r.Context.UserID)\n\t\t}\n\t}\n\treturn nil, nil\n}", "func (h *provider) Read(ctx wfContext.Context, v *value.Value, act types.Action) error {\n\tobj := new(unstructured.Unstructured)\n\tif err := v.UnmarshalTo(obj); err != nil {\n\t\treturn err\n\t}\n\tkey, err := client.ObjectKeyFromObject(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif key.Namespace == \"\" {\n\t\tkey.Namespace = \"default\"\n\t}\n\tif err := h.cli.Get(context.Background(), key, obj); err != nil {\n\t\treturn err\n\t}\n\treturn v.FillObject(obj.Object, \"result\")\n}", "func (s *AutograderService) GetUser(ctx context.Context, in *pb.Void) (*pb.User, error) {\n\tusr, err := s.getCurrentUser(ctx)\n\tif err != nil {\n\t\ts.logger.Errorf(\"GetUser failed: authentication error: %w\", err)\n\t\treturn nil, ErrInvalidUserInfo\n\t}\n\tdbUsr, err := s.db.GetUserWithEnrollments(usr.GetID())\n\tif err != nil {\n\t\ts.logger.Errorf(\"GetUser failed to get user with enrollments: %w \", err)\n\t}\n\treturn dbUsr, nil\n\n}", "func (m *ApplicationModule) Read(fields ...string) error {\n\to := orm.NewOrm()\n\treturn o.Read(m, fields...)\n}", "func Read(email string) (*structs.User, error) {\n\tuser := &structs.User{}\n\n\trow, err := dot.QueryRow(db, selectEmailQuery, email)\n\n\t// Scan => take data\n\tif err := row.Scan(&user.Id, &user.Sub, &user.GivenName, &user.FamilyName, &user.Profile, &user.Picture, &user.Email, &user.EmailVerified, &user.Gender, &user.Address, &user.Phone); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn nil, errors.NotFound(email, err.Error())\n\t\t}\n\n\t\treturn nil, errors.InternalServerError(email, err.Error())\n\t}\n\n\treturn user, err\n}", "func (e *Enchant) LoadPersonalDict(name string) {\n\tcName := C.CString(name)\n\tdefer C.free(unsafe.Pointer(cName))\n\n\tif e.dict != nil {\n\t\tC.enchant_broker_free_dict(e.broker, e.dict)\n\t}\n\n\te.dict = C.enchant_broker_request_pwl_dict(e.broker, cName)\n}", "func DefaultApplyFieldMaskHealthMenstruationPersonalInfo(ctx context.Context, patchee *HealthMenstruationPersonalInfo, patcher *HealthMenstruationPersonalInfo, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"ProfileId\" {\n\t\t\tpatchee.ProfileId = patcher.ProfileId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"PeriodLengthInDays\" {\n\t\t\tpatchee.PeriodLengthInDays = patcher.PeriodLengthInDays\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CycleLengthInDays\" {\n\t\t\tpatchee.CycleLengthInDays = patcher.CycleLengthInDays\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func (p *Personal) All(ctx context.Context) (*[]PersonalData, error) {\n\tusrs, err := p.DB.All(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not select all personal data\")\n\t}\n\treturn usrs, nil\n}", "func (m *HealthMenstruationPersonalInfoORM) ToPB(ctx context.Context) (HealthMenstruationPersonalInfo, error) {\n\tto := HealthMenstruationPersonalInfo{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(HealthMenstruationPersonalInfoWithBeforeToPB); ok {\n\t\tif err = prehook.BeforeToPB(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tif m.CreatedAt != nil {\n\t\tif to.CreatedAt, err = ptypes1.TimestampProto(*m.CreatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tif m.UpdatedAt != nil {\n\t\tif to.UpdatedAt, err = ptypes1.TimestampProto(*m.UpdatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.ProfileId = m.ProfileId\n\tto.PeriodLengthInDays = m.PeriodLengthInDays\n\tto.CycleLengthInDays = m.CycleLengthInDays\n\tif posthook, ok := interface{}(m).(HealthMenstruationPersonalInfoWithAfterToPB); ok {\n\t\terr = posthook.AfterToPB(ctx, &to)\n\t}\n\treturn to, err\n}", "func GetPerson(db *sql.DB) {}", "func (rf *Raft) readPersist(data []byte) { //??????????\r\n\t// Your code here.\r\n\t// Example:\r\n\t// r := bytes.NewBuffer(data)\r\n\t// d := gob.NewDecoder(r)\r\n\t// d.Decode(&rf.xxx)\r\n\t// d.Decode(&rf.yyy)\r\n\tif(data == nil || len(data) < 1) { //not containing any state\r\n\t\treturn\r\n\t}\r\n}", "func read(res http.ResponseWriter, req *http.Request) {\n\trows, err := db.Query(`SELECT * FROM customer;`)\n\tcheck(err)\n\tdefer rows.Close()\n\tvar name string\n\tfor rows.Next() {\n\t\terr = rows.Scan(&name)\n\t\tcheck(err)\n\t\tfmt.Fprintln(res, \"The records are\", name)\n\t}\n}", "func (ps *Store) Read(ctx context.Context, key datastore.Key, entity datastore.Entity) error {\n\tc := GetCon(ctx)\n\temd := entity.GetEntityMetadata()\n\titer := c.Query(getJSONSelect(emd.GetName(), emd.GetIDColumnName()), key).Iter()\n\tvar json string\n\tvalid := iter.Scan(&json)\n\tif !valid {\n\t\treturn common.NewError(datastore.EntityNotFound, fmt.Sprintf(\"%v not found with id = %v\", emd.GetName(), key))\n\t}\n\tdatastore.FromJSON(json, entity)\n\tif err := iter.Close(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (m *DeviceHealth) GetAdditionalData()(map[string]any) {\n val , err := m.backingStore.Get(\"additionalData\")\n if err != nil {\n panic(err)\n }\n if val == nil {\n var value = make(map[string]any);\n m.SetAdditionalData(value);\n }\n return val.(map[string]any)\n}", "func GetUser(c *gin.Context) {\n\tnID := c.Param(\"user_id\")\n\tdb := dbConn()\n\tselDB, err := db.Query(\"CALL read_user(?)\", nID)\n\tif err != nil {\n\t\tpanic(err.Error)\n\t}\n\n\tuser := User{}\n\tusers := []User{}\n\tfor selDB.Next() {\n\t\tvar id, username, useremail, fname, lname, password, passwordchange, passwordexpired, lastlogon, accountlocked string\n\t\terr = selDB.Scan(&id, &username, &useremail, &fname, &lname, &password, &passwordchange, &passwordexpired, &lastlogon, &accountlocked)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tc.JSON(500, gin.H{\n\t\t\t\t\"error\": err.Error(),\n\t\t\t})\n\t\t}\n\t\tuser.ID = id\n\t\tuser.UserName = username\n\t\tuser.UserEmail = useremail\n\t\tuser.FName = fname\n\t\tuser.LName = lname\n\t\tuser.Password = password\n\t\tuser.PasswordChange = passwordchange\n\t\tuser.PasswordExpired = passwordexpired\n\t\tuser.LastLogon = lastlogon\n\t\tuser.AccountLocked = accountlocked\n\t\tiid, err := strconv.Atoi(id)\n\t\tif err != nil {\n\t\t\tpanic(err.Error)\n\t\t}\n\t\tselDB02, err := db.Query(\"CALL read_access_userid(?)\", iid)\n\t\tif err != nil {\n\t\t\tpanic(err.Error)\n\t\t}\n\t\taccess := Access{}\n\t\taccessList := []Access{}\n\t\tfor selDB02.Next() {\n\t\t\tvar accessid, userid, courtid, caseaccess, personaccess, accountingaccess, juryaccess, attorneyaccess, configaccess, securitylevel, sealedcase string\n\t\t\terr := selDB02.Scan(&accessid, &userid, &courtid, &caseaccess, &personaccess, &accountingaccess, &juryaccess, &attorneyaccess, &configaccess, &securitylevel, &sealedcase)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\tc.JSON(500, gin.H{\n\t\t\t\t\t\"error\": err.Error(),\n\t\t\t\t})\n\t\t\t}\n\t\t\taccess.AccessID = accessid\n\t\t\taccess.IDUser = userid\n\t\t\taccess.IDCourt = courtid\n\t\t\taccess.CaseAccess = caseaccess\n\t\t\taccess.PersonAccess = personaccess\n\t\t\taccess.AccountingAccess = accountingaccess\n\t\t\taccess.JuryAccess = juryaccess\n\t\t\taccess.AttorneyAccess = attorneyaccess\n\t\t\taccess.ConfigAccess = configaccess\n\t\t\taccess.SecurityLevel = securitylevel\n\t\t\taccess.SealedCase = sealedcase\n\t\t\taccessList = append(accessList, access)\n\t\t}\n\t\tuser.AccessList = accessList\n\t\tusers = append(users, user)\n\t}\n\n\tc.JSON(200, gin.H{\n\t\t\"result\": users,\n\t})\n\n\tdefer db.Close()\n}", "func readFromPublic(username string) (*PublicInfo, error) {\n\tlink := \"http://localhost:8080/v1/accounts/\" + username\n\tresp, err := http.Get(link)\n\tif err != nil {\n\t\tlog.Println(\"account does not exists\", err)\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tbodyBytes, err := ioutil.ReadAll(resp.Body)\n\tvar pageData PublicInfo\n\terr = json.Unmarshal(bodyBytes, &pageData)\n\treturn &pageData, err\n}", "func (m *CustomDomainManager) Read(id string, opts ...RequestOption) (c *CustomDomain, err error) {\n\terr = m.Request(\"GET\", m.URI(\"custom-domains\", id), &c, opts...)\n\treturn\n}", "func (repository *Datastore)GetProfile(username string)(*user.Person,error){\n\tperson := newUser() //initialize user.Person and will used to store profile info\n\tquery := `SELECT * FROM userRepository WHERE username = ?`\n\terr := repository.Db.Get(&person, query, username) //get person profile details\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &person, nil\n}", "func (t *SimpleChaincode) readuser(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\n\tvar name, jsonResp string\n\tvar err error\n\n\tif len(args) != 1 {\n\t\treturn nil, errors.New(\"Incorrect number of arguments. Expecting name of the var to query\")\n\t}\n\n\tname = args[0]\n\tvalAsbytes, err := stub.GetState(name) //get the key value from chaincode state\n\tif err != nil {\n\t\tjsonResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + name + \"\\\"}\"\n\t\treturn nil, errors.New(jsonResp)\n\t}\n\n\treturn valAsbytes, nil //send it onward\n}", "func (k *xyzProvider) Read(ctx context.Context, req *pulumirpc.ReadRequest) (*pulumirpc.ReadResponse, error) {\n\turn := resource.URN(req.GetUrn())\n\tty := urn.Type()\n\tif ty != \"xyz:index:Random\" {\n\t\treturn nil, fmt.Errorf(\"Unknown resource type '%s'\", ty)\n\t}\n\treturn nil, status.Error(codes.Unimplemented, \"Read is not yet implemented for 'xyz:index:Random'\")\n}", "func DefaultReadEmail(ctx context.Context, in *Email, db *gorm.DB) (*Email, error) {\n\tif in == nil {\n\t\treturn nil, errors.New(\"Nil argument to DefaultReadEmail\")\n\t}\n\tormParams, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tormResponse := EmailORM{}\n\tif err = db.Set(\"gorm:auto_preload\", true).Where(&ormParams).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func main() {\n //name := \"Petter\"\n email := \"petter@g.com\"\n\n l, err := orm.FindLoginByEmailMapper(email)\n\n fmt.Println(err)\n fmt.Println(l)\n fmt.Println(\"id: \", l.ID)\n fmt.Println(\"name: \", l.Name)\n fmt.Println(\"email\", l.Email)\n\n}", "func Read(client *mongo.Client, firstname string) (*[]Person, error) {\r\n\tvar m bson.M\r\n\r\n\tpersons := make([]Person, 0, 10)\r\n\r\n\tpersonCollection := client.Database(\"MyApp\").Collection(\"person\")\r\n\tctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\r\n\tfilterCursor, err := personCollection.Find(ctx, bson.M{\"firstname\": firstname})\r\n\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\terr = filterCursor.All(ctx, &persons)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tbsonBytes, _ := bson.Marshal(m)\r\n\tbson.Unmarshal(bsonBytes, &persons)\r\n\r\n\treturn &persons, err\r\n}", "func GetAllPerson(c *gin.Context) {\n\tperson, _ := models.LoadPeople()\n\tc.JSON(http.StatusOK, person)\n\n}", "func (rf *Raft) readPersist(data []byte) {\n\tif data == nil || len(data) < 1 { // bootstrap without any state?\n\t\treturn\n\t}\n\t// Your code here (2C).\n\t// Example:\n\tr := bytes.NewBuffer(data)\n\td := labgob.NewDecoder(r)\n\n\tstate := &StateInfo{}\n\n\tif err := d.Decode(state); err != nil {\n\t\tpanic(err)\n\t}\n\trf.currentTerm = state.CurrentTerm\n\trf.commitIndex = state.CommitIndex\n\trf.lastApplied = state.LastApplied\n\trf.log = state.Logs\n\tDPrintf(\"rf [me %v] read stateInfo: %#v\", rf.me, state)\n}", "func (c *UserRepoImpl) ReadAll() ([]*model.User, error) {\n\tuserList := make([]*model.User, 0)\n\tif err := c.db.Table(\"user\").Find(&userList).Error; err != nil {\n\t\tlogrus.Error(err)\n\t\treturn nil, errors.New(\"get user list data : error \")\n\t}\n\treturn userList, nil\n}", "func DefaultPatchSetHealthMenstruationPersonalInfo(ctx context.Context, objects []*HealthMenstruationPersonalInfo, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*HealthMenstruationPersonalInfo, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*HealthMenstruationPersonalInfo, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchHealthMenstruationPersonalInfo(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func (t *SimpleChaincode) readStudent(APIstub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar name, jsonResp string\n\tvar err error\n\n\tif len(args) <= 0 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting name of the name to query\")\n\t}\n\n\tname = args[0]\n\tvalAsbytes, err := APIstub.GetState(name)\n\tif err != nil {\n\t\tjsonResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + name + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t} else if valAsbytes == nil {\n\t\tjsonResp = \"{\\\"Error\\\":\\\"Student does not exist: \" + name + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\treturn shim.Success(valAsbytes)\n}", "func showPersonInfo(r result) {\n\tif r.Error != nil {\n\t\tlog.Printf(\"Response Error because err: %v\\n\", r.Error)\n\t\treturn\n\t}\n\n\tif len(r.Person.Results) == 0 {\n\t\tlog.Printf(\"Response Error: Person info not found\\n\")\n\t\treturn\n\t}\n\n\tinfo := r.Person.Results[0]\n\tfmt.Printf(\"[%v] Email: %v \\n\", r.Latency, info.Email)\n}", "func (m *OrganizationManager) ReadByName(name string, opts ...RequestOption) (o *Organization, err error) {\n\terr = m.Request(\"GET\", m.URI(\"organizations\", \"name\", name), &o, opts...)\n\treturn\n}", "func (rf *Raft) readPersist(data []byte) {\n\t// Your code here (2C).\n\t// Example:\n\t// r := bytes.NewBuffer(data)\n\t// d := gob.NewDecoder(r)\n\t// d.Decode(&rf.xxx)\n\t// d.Decode(&rf.yyy)\n\tif data == nil || len(data) < 1 { // bootstrap without any state?\n\t\treturn\n\t}\n}", "func (rf *Raft) readPersist(data []byte) {\n\t// Your code here (2C).\n\t// Example:\n\t// r := bytes.NewBuffer(data)\n\t// d := gob.NewDecoder(r)\n\t// d.Decode(&rf.xxx)\n\t// d.Decode(&rf.yyy)\n\tif data == nil || len(data) < 1 { // bootstrap without any state?\n\t\treturn\n\t}\n}", "func (rf *Raft) readPersist(data []byte) {\n\t// Your code here (2C).\n\t// Example:\n\t// r := bytes.NewBuffer(data)\n\t// d := gob.NewDecoder(r)\n\t// d.Decode(&rf.xxx)\n\t// d.Decode(&rf.yyy)\n\tif data == nil || len(data) < 1 { // bootstrap without any state?\n\t\treturn\n\t}\n}", "func (rf *Raft) readPersist(data []byte) {\n\t// Your code here (2C).\n\t// Example:\n\t// r := bytes.NewBuffer(data)\n\t// d := gob.NewDecoder(r)\n\t// d.Decode(&rf.xxx)\n\t// d.Decode(&rf.yyy)\n\tif data == nil || len(data) < 1 { // bootstrap without any state?\n\t\treturn\n\t}\n}", "func (esc *ExtendedSimpleContract) Read(ctx utils.CustomTransactionContextInterface, key string) (string, error) {\n\texisting := ctx.GetCallData()\n\n\tif existing == nil {\n\t\treturn \"\", fmt.Errorf(\"Cannot read world state pair with key %s. Does not exist\", key)\n\t}\n\n\treturn string(existing), nil\n}", "func (rf *Raft) readPersist(data []byte) {\n\t// Your code here.\n\t// Example:\n\t// r := bytes.NewBuffer(data)\n\t// d := gob.NewDecoder(r)\n\t// d.Decode(&rf.xxx)\n\t// d.Decode(&rf.yyy)\n\tr := bytes.NewBuffer(data)\n\td := gob.NewDecoder(r)\n\td.Decode(&rf.currentTerm)\n\td.Decode(&rf.votedFor)\n\td.Decode(&rf.log)\n}", "func (store TodoStore) Read(_ sqlx.Queryer, filters ...gtimer.TodoFilter) (gtimer.Todos, error) {\n\tvar todo gtimer.Todo\n\tfor _, filter := range filters {\n\t\tfilter(&todo)\n\t}\n\tif todo.ID != \"\" {\n\t\ttodo, err := store.Get(todo.ID)\n\t\tif err != nil {\n\t\t\treturn gtimer.Todos{}, err\n\t\t}\n\t\treturn gtimer.Todos{todo}, err\n\t}\n\tif todo.Status != \"\" {\n\t\treturn store.ByStatus(todo.Status)\n\t}\n\treturn store.All()\n}", "func NewPersonal(db DBProvider) (*Personal, error) {\n\treturn &Personal{\n\t\tDB: db,\n\t}, nil\n}", "func DefaultListUserInfo(ctx context.Context, db *gorm.DB) ([]*UserInfo, error) {\n\tin := UserInfo{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm1.ApplyCollectionOperators(ctx, db, &UserInfoORM{}, &UserInfo{}, nil, nil, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []UserInfoORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*UserInfo{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func (DBConnection *MariaDBPlugin) GetUser(UserID uint64) (interfaces.UserInformation, error) {\n\tqueryArray := []interface{}{}\n\tsqlQuery := \"SELECT Name, CreationTime, Disabled, Permissions FROM Users WHERE ID = ?\"\n\tqueryArray = append(queryArray, UserID)\n\n\t//First Query the main information\n\tvar Name string\n\tvar NCreationTime mysql.NullTime\n\tvar CreationTime time.Time\n\tvar Disabled bool\n\tvar Permissions uint64\n\terr := DBConnection.DBHandle.QueryRow(sqlQuery, queryArray...).Scan(&Name, &NCreationTime, &Disabled, &Permissions)\n\tif err != nil {\n\t\treturn interfaces.UserInformation{}, err\n\t}\n\n\treturn interfaces.UserInformation{ID: UserID, Name: Name, CreationTime: CreationTime, Disabled: Disabled, Permissions: interfaces.UserPermission(Permissions)}, nil\n}", "func (rf *Raft) readPersist(data []byte) {\n\t// Your code here.\n\t// Example:\n\t// r := bytes.NewBuffer(data)\n\t// d := gob.NewDecoder(r)\n\t// d.Decode(&rf.xxx)\n\t// d.Decode(&rf.yyy)\n\tr := bytes.NewBuffer(data)\n\td := gob.NewDecoder(r)\n\td.Decode(&rf.log)\n\td.Decode(&rf.votedFor)\n\td.Decode(&rf.raftData)\n\td.Decode(&rf.currentTerm)\n\td.Decode(&rf.commitIndex)\n\td.Decode(&rf.lastApplied)\n}", "func ReadBusinessPropertiess(rows *sql.Rows, a *BusinessProperties) error {\n\treturn rows.Scan(&a.BPID, &a.BID, &a.Name, &a.Data, &a.FLAGS, &a.CreateTS, &a.CreateBy, &a.LastModTime, &a.LastModBy)\n}", "func (rf *Raft) readPersist(data []byte) {\n\t// Your code here.\n\t// Example:\n\tr := bytes.NewBuffer(data)\n\td := gob.NewDecoder(r)\n\trf.mu.Lock()\n\td.Decode(&rf.CurrentTerm)\n\td.Decode(&rf.VotedFor)\n\td.Decode(&rf.Log)\n\trf.mu.Unlock()\n}", "func TestRead(t *testing.T) {\r\n\tpersonsFiltered, err := Read(client, firstname)\r\n\tif err != nil {\r\n\t\tt.Fatalf(\"Failed read test :%s\", err)\r\n\t}\r\n\r\n\tfor _, value := range *personsFiltered {\r\n\t\tif value.ID == _id {\r\n\t\t\tt.Log(\"person exists :\", value.ID)\r\n\t\t\tbreak\r\n\t\t} else {\r\n\t\t\tt.Fatalf(\"Failed read test. \")\r\n\t\t}\r\n\t}\r\n}", "func (rf *Raft) readPersist(data []byte) {\n\t// Your code here.\n\t// Example:\n\tr := bytes.NewBuffer(data)\n\td := gob.NewDecoder(r)\n\td.Decode(&rf.currentTerm)\n\td.Decode(&rf.votedFor)\n\td.Decode(&rf.logs)\n}", "func (rf *Raft) readPersist(data []byte) {\n\tif data == nil || len(data) < 1 { // bootstrap without any state?\n\t\treturn\n\t}\n\n\t// Your code here (2C).\n\t// Example:\n\tr := bytes.NewBuffer(data)\n\td := labgob.NewDecoder(r)\n\n\tif d.Decode(&rf.term) != nil {\n\t\tpanic(\"fail on read persist term\")\n\t}\n\n\tif d.Decode(&rf.votedFor) != nil {\n\t\tpanic(\"fail on read persist votedFor\")\n\t}\n\n\tif d.Decode(&rf.logEntries) != nil {\n\t\tpanic(\"fail on read persist logEntries\")\n\t}\n\n\tDPrintf(\"%v read-persist term=%d voted-for=%d log-entries=%d\", rf.raftInfo(), rf.term, rf.votedFor, len(rf.logEntries))\n}", "func (rf *Raft) readPersist(data []byte) {\n\t// Your code here.\n\t// Example:\n\tr := bytes.NewBuffer(data)\n\td := gob.NewDecoder(r)\n\td.Decode(&rf.currentTerm)\n\td.Decode(&rf.voteFor)\n\td.Decode(&rf.log)\n}", "func (rf *Raft) readPersist(data []byte) {\n\t// Your code here (2C).\n\t// Example:\n\trf.mu.Lock()\n defer rf.mu.Unlock()\n if data == nil || len(data) < 1 { // bootstrap without any state?\n\t\treturn\n\t}\n\t r := bytes.NewBuffer(data)\n\t d := gob.NewDecoder(r)\n\t d.Decode(&rf.currentTerm)\n\t d.Decode(&rf.votedFor)\n\t d.Decode(&rf.log)\n}", "func (m *metaObject) readMetadata(pth string) ([]byte, error) {\n\trdr, err := m.meta.Get(m.contexter(), pth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ioutil.ReadAll(rdr)\n}", "func (rf *Raft) readPersist(data []byte) {\n\t// Your code here.\n\t// Example:\n\t// r := bytes.NewBuffer(data)\n\t// d := gob.NewDecoder(r)\n\t// d.Decode(&rf.xxx)\n\t// d.Decode(&rf.yyy)\n\n\tif data == nil {\n\t\treturn\n\t}\n\tr := bytes.NewBuffer(data)\n\td := gob.NewDecoder(r)\n\td.Decode(&rf.currentTerm)\n\td.Decode(&rf.votesAcquired)\n\td.Decode(&rf.log)\n}", "func (rf *Raft) readPersist(data []byte) {\n\t// Your code here.\n\t// Example:\n\t// r := bytes.NewBuffer(data)\n\t// d := gob.NewDecoder(r)\n\t// d.Decode(&rf.xxx)\n\t// d.Decode(&rf.yyy)\n\n\tr := bytes.NewBuffer(data)\n\td := gob.NewDecoder(r)\n\td.Decode(&rf.currentTerm)\n\td.Decode(&rf.voteFor)\n\td.Decode(&rf.log)\n}", "func getLoan(l *models.Loan, db *gorm.DB) error {\n\terr := db.Select(\"id,created_at,updated_at,initial_value,interest,quota,balance,cod_loan_state,cod_client,cod_collection,cod_user\").First(l).GetErrors()\n\tif len(err) != 0 {\n\t\treturn errors.New(\"no se encuentra\")\n\t}\n\treturn nil\n}", "func (m *DBMem) Read(id int) (Person, error) {\n m.RLock()\n defer m.RUnlock()\n\n if len(m.data) < id {\n\t\tfmt.Println(\"ID is out of range\")\n\t\treturn Person{}, errors.New(\"ID is out of range\")\n\t}\n \n v, ok := m.data[id]\n if !ok {\n return Person{}, errors.New(\"ID not found\")\n }\n\n return v, nil\n}", "func (m *HealthMenstruationPersonalInfo) ToORM(ctx context.Context) (HealthMenstruationPersonalInfoORM, error) {\n\tto := HealthMenstruationPersonalInfoORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(HealthMenstruationPersonalInfoWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tif m.CreatedAt != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.CreatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.CreatedAt = &t\n\t}\n\tif m.UpdatedAt != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.UpdatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.UpdatedAt = &t\n\t}\n\tto.ProfileId = m.ProfileId\n\tto.PeriodLengthInDays = m.PeriodLengthInDays\n\tto.CycleLengthInDays = m.CycleLengthInDays\n\tif posthook, ok := interface{}(m).(HealthMenstruationPersonalInfoWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "func (b *OGame) GetUserInfos() ogame.UserInfos {\n\treturn b.WithPriority(taskRunner.Normal).GetUserInfos()\n}", "func (rf *Raft) readPersist(data []byte) {\n\t// Your code here (2C).\n\tif data == nil || len(data) < 1 { // bootstrap without any state?\n\t\treturn\n\t}\n\tr := bytes.NewBuffer(data)\n\td := gob.NewDecoder(r)\n\td.Decode(&rf.voteFor)\n\td.Decode(&rf.currentTerm)\n\td.Decode(&rf.log)\n}", "func (model *TodoerModel) Read(id int) Todoer {\n\tvar todoer = Todoer{}\n\n\tconnect(func(db *sql.DB) {\n\t\trows, err := db.Query(\"select * from todoer where id = ?\", id)\n\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\n\t\tdefer rows.Close()\n\n\t\tfor rows.Next() {\n\t\t\terr := rows.Scan(&todoer.ID, &todoer.Username, &todoer.CreatedAt, &todoer.ModifiedAt)\n\t\t\tif err != nil {\n\t\t\t\tlog.Panic(err)\n\t\t\t}\n\t\t}\n\n\t\terr = rows.Err()\n\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\t})\n\n\treturn todoer\n}", "func (rf *Raft) readPersist(data []byte) {\n\trf.Debug(dPersist, \"reading persisted state\")\n\tif data == nil || len(data) < 1 { // bootstrap without any state?\n\t\trf.logs = []LogEntry{}\n\t\treturn\n\t}\n\t// Your code here (2C).\n\tr := bytes.NewBuffer(data)\n\td := labgob.NewDecoder(r)\n\tvar currentTerm int\n\tvar votedFor int\n\tvar logs []LogEntry\n\tif d.Decode(&currentTerm) != nil ||\n\t\td.Decode(&votedFor) != nil ||\n\t\td.Decode(&logs) != nil {\n\t\tlog.Panic(\"Panic decoding persistent state\")\n\t} else {\n\t\trf.currentTerm = currentTerm\n\t\trf.votedFor = votedFor\n\t\trf.logs = logs\n\t}\n}", "func (m *TeamworkSoftwareUpdateHealth) GetAdditionalData()(map[string]any) {\n val , err := m.backingStore.Get(\"additionalData\")\n if err != nil {\n panic(err)\n }\n if val == nil {\n var value = make(map[string]any);\n m.SetAdditionalData(value);\n }\n return val.(map[string]any)\n}", "func (t *MedChain) getAllHospital(stub shim.ChaincodeStubInterface, args []string) peer.Response {\n\t\t// ==== Input sanitation ====\n\t\tfmt.Println(\"- start getAllHospital\")\n\n\t\tAssetType := \"Hospital\"\n\n\t\tqueryString := fmt.Sprintf(\"SELECT valueJson FROM <STATE> WHERE json_extract(valueJson, '$.AssetType') = '%s'\", AssetType)\n\t\t\n\t\tqueryResults, err := getQueryResultForQueryString(stub, queryString)\n\t\t\n\t\tif err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\t\t\n\t\treturn shim.Success(queryResults)\n\t}", "func (rf *Raft) readPersist(data []byte) {\n\t// Your code here.\n\t// Example:\n\tr := bytes.NewBuffer(data)\n\td := gob.NewDecoder(r)\n\td.Decode(&rf.currentTerm)\n\td.Decode(&rf.votedFor)\n\td.Decode(&rf.log)\n\td.Decode(&rf.lastIncludedIndex)\n}", "func (gameController GameController) Read(context *gin.Context) {\r\n\tvar game models.Game\r\n\tif err := gameController.Database.Preload(\"Players\").Preload(\"Turns\").First(&game, context.Param(\"game_id\")).Error; err != nil {\r\n\t\tcontext.JSON(http.StatusNotFound, gin.H{\"error\": \"Record not found!\"})\r\n\t\treturn\r\n\t}\r\n\tcontext.JSON(http.StatusOK, game)\r\n}", "func (s *UserService) MyInfo(ctx context.Context, options ...MyInfoOption) (*User, *Response, error) {\n\treq, err := s.client.NewRequest(http.MethodGet, \"users/@me\")\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tq := req.URL.Query()\n\tfor _, o := range options {\n\t\to.myInfoApply(&q)\n\t}\n\treq.URL.RawQuery = q.Encode()\n\n\tu := new(User)\n\tresp, err := s.client.Do(ctx, req, u)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn u, resp, nil\n}", "func (m *OrganizationManager) Read(id string, opts ...RequestOption) (o *Organization, err error) {\n\terr = m.Request(\"GET\", m.URI(\"organizations\", id), &o, opts...)\n\treturn\n}", "func getFullProfile(client *http.Client, optional ...string) (FacebookPublicProfile, error) {\n\turl := getAPIUrl(\"/me?fields=name,locale,age_range,gender\")\n\tif len(optional) == 1 {\n\t\turl = optional[0]\n\t}\n\tresp, err := client.Get(url)\n\tdefer resp.Body.Close()\n\tdecoder := json.NewDecoder(resp.Body)\n\tvar profile FacebookPublicProfile\n\terr = decoder.Decode(&profile)\n\tif err != nil {\n\t\treturn FacebookPublicProfile{}, err\n\t}\n\tif resp.StatusCode != 200 {\n\t\treturn FacebookPublicProfile{}, errors.New(\"Unathorized. Check token.\")\n\t}\n\treturn profile, nil\n}", "func (rf *Raft) readPersist(data []byte) {\n\tif data == nil || len(data) < 1 { // bootstrap without any state?\n\t\treturn\n\t}\n\t// Your code here (2C).\n\tr := bytes.NewBuffer(data)\n\td := gob.NewDecoder(r)\n\td.Decode(&rf.currentTerm)\n\td.Decode(&rf.votedFor)\n\td.Decode(&rf.logs)\n}", "func ForPersonalLoans(httpCrawlService func(string, string, int) ([]byte, common.CustomError), baseURL string, page int, accumulator []personalloan.Entity) (*[]personalloan.Entity, common.CustomError) {\n\n\tfmt.Println(\"Start crawl personal loans for\", baseURL, page)\n\n\tbody, crawlErr := httpCrawlService(baseURL, \"products-services/v1/personal-loans\", page)\n\n\tif crawlErr != nil {\n\t\tfmt.Println(crawlErr)\n\t}\n\n\tjsonData := &personalLoanJSON{}\n\n\tmetaInfo := &MetaInfoJSON{}\n\tjson.Unmarshal(body, &metaInfo)\n\n\tjsonUnmarshallErr := json.Unmarshal(body, &jsonData)\n\n\tif jsonUnmarshallErr != nil {\n\t\tfmt.Printf(\"Error crawl personal loans for %s %s %s\", baseURL, strconv.Itoa(page), jsonUnmarshallErr)\n\t\treturn nil, common.NewInternalServerError(\"Unable to unmarshall data\", jsonUnmarshallErr)\n\t}\n\n\titems := accumulator\n\n\tfor i := range jsonData.Data.Brand.Companies {\n\t\tcompany := jsonData.Data.Brand.Companies[i]\n\t\tresult := company.PersonalLoans\n\t\titems = append(items, result...)\n\t}\n\n\tif metaInfo.Meta.TotalPages > page {\n\t\treturn ForPersonalLoans(httpCrawlService, baseURL, page+1, items)\n\t}\n\n\tfmt.Println(\"End crawl personal loans for\", baseURL, page)\n\n\treturn &items, nil\n\n}", "func (repo *Repository) Read(ctx context.Context, claims auth.Claims, req UserAccountReadRequest) (*UserAccount, error) {\n\tspan, ctx := tracer.StartSpanFromContext(ctx, \"internal.user_account.Read\")\n\tdefer span.Finish()\n\n\t// Validate the request.\n\tv := webcontext.Validator()\n\terr := v.Struct(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Filter base select query by ID\n\tquery := selectQuery()\n\tquery.Where(query.And(\n\t\tquery.Equal(\"user_id\", req.UserID),\n\t\tquery.Equal(\"account_id\", req.AccountID)))\n\n\tres, err := find(ctx, claims, repo.DbConn, query, []interface{}{}, req.IncludeArchived)\n\tif err != nil {\n\t\treturn nil, err\n\t} else if res == nil || len(res) == 0 {\n\t\terr = errors.WithMessagef(ErrNotFound, \"entry for user %s account %s not found\", req.UserID, req.AccountID)\n\t\treturn nil, err\n\t}\n\tu := res[0]\n\n\treturn u, nil\n}", "func (o *Object) readMetaData(ctx context.Context) (err error) {\n\tif !o.modTime.IsZero() {\n\t\treturn nil\n\t}\n\t// Last resort\n\treturn o.readEntryAndSetMetadata(ctx)\n}", "func (p *Personal) One(ctx context.Context, id string) (*PersonalData, error) {\n\tusr, err := p.DB.One(ctx, id)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not select one personal data\")\n\t}\n\treturn usr, nil\n}", "func (_UserCrud *UserCrudCallerSession) GetUser(userAddress common.Address) (struct {\n\tUserEmail string\n\tUserAge *big.Int\n\tIndex *big.Int\n}, error) {\n\treturn _UserCrud.Contract.GetUser(&_UserCrud.CallOpts, userAddress)\n}", "func (m MariaDB) One(ctx context.Context, id string) (entity.PersonalData, error) {\n\tsqlQuery := \"SELECT * FROM person WHERE id = ?\"\n\tvar p personalData\n\n\trow := m.Person.QueryRowContext(ctx, sqlQuery, id)\n\terr := row.Scan(&p.ID, &p.Name, &p.LastName, &p.Phone, &p.Email, &p.YearOfBirth)\n\tif err != nil {\n\t\treturn entity.PersonalData{}, errors.Wrap(err, \"could not scan row\")\n\t}\n\n\treturn p.transmit(), nil\n}", "func (rf *Raft) readPersist(data []byte) {\n if data == nil || len(data) < 1 { // bootstrap without any state?\n return\n }\n r := bytes.NewBuffer(data)\n d := labgob.NewDecoder(r)\n var currentTerm int\n var votedFor int\n var log []Entry\n var snapshottedIndex int\n\n if d.Decode(&currentTerm) != nil {\n DErrPrintf(\"read currentTerm error\")\n return\n }\n if d.Decode(&votedFor) != nil {\n DErrPrintf(\"read votedFor error\")\n return\n }\n if d.Decode(&log) != nil {\n DErrPrintf(\"read log entries error\")\n return\n }\n\n if d.Decode(&snapshottedIndex) != nil {\n DErrPrintf(\"read snapshottedIndex error\")\n return\n }\n\n rf.currentTerm = currentTerm\n rf.votedFor = votedFor\n rf.log = log\n rf.snapshottedIndex = snapshottedIndex\n rf.commitIndex = snapshottedIndex\n rf.lastApplied = snapshottedIndex\n DLCPrintf(\"Read Server(%d) state(currentTerm=%d, votedFor=%d, logLength=%d) from persister done\", rf.me, rf.currentTerm, rf.votedFor, len(rf.log))\n}", "func UserReadByToken(c *gin.Context) {\n\tuserFound := session.GetUserByToken(c.Query(\"token\"))\n\tif userFound.ID == 0 {\n\t\tc.JSON(422, gin.H{\n\t\t\t\"error\": \"not found\",\n\t\t})\n\t} else {\n\t\tc.JSON(200, gin.H{\n\t\t\t\"data\": userFound,\n\t\t})\n\t}\n}", "func (p *UserStoreClient) GetUser(ctx context.Context, authenticationToken string) (r *User, err error) {\n var _args13 UserStoreGetUserArgs\n _args13.AuthenticationToken = authenticationToken\n var _result14 UserStoreGetUserResult\n if err = p.Client_().Call(ctx, \"getUser\", &_args13, &_result14); err != nil {\n return\n }\n switch {\n case _result14.UserException!= nil:\n return r, _result14.UserException\n case _result14.SystemException!= nil:\n return r, _result14.SystemException\n }\n\n return _result14.GetSuccess(), nil\n}", "func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar dni string // Entities\n\tvar err error\n\tfmt.Println(\"Metodo consultar\")\n\tif len(args) != 1 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting name of the person to query\")\n\t}\n\n\tdni = args[0]\n\n\t// Get the state from the ledger\n\tstoredValue, err := stub.GetState(dni)\n\tif err != nil {\n\t\tjsonResp := \"{\\\"Error\\\":\\\"Failed to get state for \" + dni + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t}\n\n\treturn shim.Success(storedValue)\n}", "func (e Employee) GetInformation() Employee {\n\n\tif runtime.GOOS == \"windows\" {\n\t\tfmt.Print(\"Please Provide Your Personal Information.\")\n\t\t_, _ = reader.ReadString('\\n')\n\t} else {\n\t\tfmt.Print(\"Please Provide Your Personal Information.\\n\")\n\t}\n\tfmt.Print(\"\\nYour Fullname: \")\n\te.Name, _ = reader.ReadString('\\n')\n\n\tfmt.Print(\"Your Current Address: \")\n\te.Address, _ = reader.ReadString('\\n')\n\n\tfmt.Print(\"Your Contact #: \")\n\te.ContactNumber, _ = reader.ReadString('\\n')\n\n\tfmt.Print(\"Your Email Address: \")\n\te.EmailAddress, _ = reader.ReadString('\\n')\n\n\tfmt.Print(\"Company's Name / Employer's Name: \")\n\te.Company, _ = reader.ReadString('\\n')\n\n\tfmt.Print(\"Office's Address / Location: \")\n\te.CompanyAddress, _ = reader.ReadString('\\n')\n\n\tfmt.Print(\"Your Current Position: \")\n\te.Position, _ = reader.ReadString('\\n')\n\n\tfmt.Print(\"No. of Years of Stay: \")\n\te.YrsOfStay, _ = reader.ReadString('\\n')\n\n\tfmt.Print(\"Your Director's Name (Including Salutations): \")\n\te.DirectorName, _ = reader.ReadString('\\n')\n\n\tfmt.Print(\"Your Resignation's Effectivity Date: \")\n\te.EffectiveDate, _ = reader.ReadString('\\n')\n\n\te = e.CleanInfo()\n\n\te.Validate()\n\n\treturn e\n}", "func (sh *SimHandlerState) readSiminfo(c *mango.Context) *SimInfo {\n\tsiminfo := NewSimInfo(c.RouteParams[\"sim_id\"])\n\tobjUpdater := sh.ListHandlerState.FileManager.Get(siminfo.Filepath())\n\terr := objUpdater.Read(siminfo)\n\tif err != nil {\n\t\tc.Error(err.Error(), http.StatusInternalServerError)\n\t\treturn nil\n\t}\n\treturn siminfo\n}", "func (c *productsServicesInterface) GetPersonalLoans(id string, page int) ([]personalloan.Entity, *subentities.Pagination, common.CustomError) {\n\treturn c.personalLoanService.FindByInstitution(id, page)\n}" ]
[ "0.6508357", "0.6502102", "0.592265", "0.55418086", "0.5489267", "0.5150009", "0.5091859", "0.5085893", "0.50467646", "0.50467646", "0.5016166", "0.498452", "0.49298856", "0.49238548", "0.48962358", "0.4871131", "0.4861762", "0.4857159", "0.48419893", "0.4817505", "0.4797317", "0.47963715", "0.4781821", "0.47694114", "0.47678044", "0.4744087", "0.47388536", "0.4737602", "0.47373936", "0.4718095", "0.4711589", "0.4701952", "0.468709", "0.46817222", "0.46706542", "0.46643656", "0.4660306", "0.46602857", "0.46560505", "0.46497944", "0.4647095", "0.46424717", "0.46371058", "0.46129483", "0.46045145", "0.46015546", "0.45877683", "0.45811814", "0.4565936", "0.45487854", "0.45448998", "0.45415306", "0.45415306", "0.45415306", "0.45415306", "0.4538954", "0.45364928", "0.45364603", "0.4535242", "0.45351353", "0.45291063", "0.45273378", "0.45209852", "0.45203117", "0.45176604", "0.45144606", "0.45144096", "0.45037606", "0.4502188", "0.45017287", "0.44986454", "0.4496086", "0.4494659", "0.44944745", "0.44920227", "0.44915265", "0.44914788", "0.44913852", "0.44797808", "0.44766578", "0.44741523", "0.4472308", "0.4468513", "0.44618624", "0.44529867", "0.44517663", "0.44511926", "0.44420078", "0.4437715", "0.44376287", "0.4437513", "0.44371185", "0.4434899", "0.4434711", "0.44200188", "0.44168034", "0.44058895", "0.44055843", "0.44049045", "0.44030318" ]
0.82387173
0
DefaultPatchHealthMenstruationPersonalInfo executes a basic gorm update call with patch behavior
DefaultPatchHealthMenstruationPersonalInfo выполняет базовый вызов gorm update с поведением patch
func DefaultPatchHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) { if in == nil { return nil, errors1.NilArgumentError } var pbObj HealthMenstruationPersonalInfo var err error if hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchRead); ok { if db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil { return nil, err } } pbReadRes, err := DefaultReadHealthMenstruationPersonalInfo(ctx, &HealthMenstruationPersonalInfo{Id: in.GetId()}, db) if err != nil { return nil, err } pbObj = *pbReadRes if hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchApplyFieldMask); ok { if db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil { return nil, err } } if _, err := DefaultApplyFieldMaskHealthMenstruationPersonalInfo(ctx, &pbObj, in, updateMask, "", db); err != nil { return nil, err } if hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchSave); ok { if db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil { return nil, err } } pbResponse, err := DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx, &pbObj, db) if err != nil { return nil, err } if hook, ok := interface{}(pbResponse).(HealthMenstruationPersonalInfoWithAfterPatchSave); ok { if err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil { return nil, err } } return pbResponse, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateHealthMenstruationPersonalInfo\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &HealthMenstruationPersonalInfoORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func DefaultPatchSetHealthMenstruationPersonalInfo(ctx context.Context, objects []*HealthMenstruationPersonalInfo, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*HealthMenstruationPersonalInfo, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*HealthMenstruationPersonalInfo, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchHealthMenstruationPersonalInfo(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func DefaultApplyFieldMaskHealthMenstruationPersonalInfo(ctx context.Context, patchee *HealthMenstruationPersonalInfo, patcher *HealthMenstruationPersonalInfo, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"ProfileId\" {\n\t\t\tpatchee.ProfileId = patcher.ProfileId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"PeriodLengthInDays\" {\n\t\t\tpatchee.PeriodLengthInDays = patcher.PeriodLengthInDays\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CycleLengthInDays\" {\n\t\t\tpatchee.CycleLengthInDays = patcher.CycleLengthInDays\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func DefaultPatchHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj HealthMenstruationDailyEntry\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadHealthMenstruationDailyEntry(ctx, &HealthMenstruationDailyEntry{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskHealthMenstruationDailyEntry(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateHealthMenstruationDailyEntry(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(HealthMenstruationDailyEntryWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func DefaultReadHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, 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 == 0 {\n\t\treturn nil, errors1.EmptyIdError\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeReadApplyQuery); ok {\n\t\tif db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &HealthMenstruationPersonalInfoORM{}); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeReadFind); ok {\n\t\tif db, err = hook.BeforeReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tormResponse := HealthMenstruationPersonalInfoORM{}\n\tif err = db.Where(&ormObj).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormResponse).(HealthMenstruationPersonalInfoORMWithAfterReadFind); ok {\n\t\tif err = hook.AfterReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultCreateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, 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 hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeCreate_); ok {\n\t\tif db, err = hook.BeforeCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterCreate_); ok {\n\t\tif err = hook.AfterCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultListHealthMenstruationPersonalInfo(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*HealthMenstruationPersonalInfo, error) {\n\tin := HealthMenstruationPersonalInfo{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm2.ApplyCollectionOperators(ctx, db, &HealthMenstruationPersonalInfoORM{}, &HealthMenstruationPersonalInfo{}, f, s, p, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []HealthMenstruationPersonalInfoORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*HealthMenstruationPersonalInfo{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func (handler *profileHandler) Patch(ctx context.Context, req *proto.ProfilePatchRequest, rsp *proto.ProfileData) (err error) {\n\tprofileInstance := handler.getProfileInstance(req.GetId())\n\tprofileInstance.SetAvatar(req.Avatar)\n\terr = profileInstance.SetLocation(req.Location)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprofileInstance.SetSkype(req.Skype)\n\terr = profileInstance.Save()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thandler.setProfileDataToResponse(profileInstance, rsp)\n\n\treturn nil\n}", "func (t *MedChain) updateHospital(stub shim.ChaincodeStubInterface, args []string) peer.Response {\n\t\t// ==== Input sanitation ====\n\t\tfmt.Println(\"- start updateHospital\")\n\n\t\t// check if all the args are send\n\t\tif len(args) != 4 {\n\t\t\treturn shim.Error(\"Incorrect number of arguments, Required 4 arguments\")\n\t\t}\n\n\t\t// check if the args are empty\n\t\tfor i := 0; i < len(args); i++ {\n\t\t\tif len(args[i]) <= 0 {\n\t\t\t\treturn shim.Error(\"argument \"+ string(i+1) + \" must be a non-empty string\")\n\t\t\t}\n\t\t}\n\n\t\tgetAssetAsBytes, errT := stub.GetState(args[0])\n\n\t\tif errT != nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Error : Cannot find Hospital %s\" , errT))\n\t\t}\n\n\t\tif getAssetAsBytes == nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Cannot find asset Hospital with ID %s\" , args[0]))\n\t\t}\n\n\t\tvar obj = Hospital{}\n\n\t\tjson.Unmarshal(getAssetAsBytes, &obj)\n\t\tobj.HospitalName = args[1]\n\t\tobj.HospitalAddress = args[2]\n\t\tobj.HospitalPhone = args[3]\n\t\tcomAssetAsBytes, errMarshal := json.Marshal(obj)\n\n\t\tif errMarshal != nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Marshal Error: %s\", errMarshal))\n\t\t}\n\n\t\terrPut := stub.PutState(obj.Hospital_ID, comAssetAsBytes)\n\n\t\tif errPut != nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Failed to update Hospital with ID %s\", args[0]))\n\t\t}\n\n\t\tfmt.Println(\"Hospital asset with ID %s was updated \\n %v\", args[0], obj)\n\n\t\treturn shim.Success(comAssetAsBytes)\n\t}", "func DefaultPatchUserInfo(ctx context.Context, in *UserInfo, updateMask *field_mask.FieldMask, db *gorm.DB) (*UserInfo, error) {\n\tif in == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tvar pbObj UserInfo\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(UserInfoWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadUserInfo(ctx, &UserInfo{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(UserInfoWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskUserInfo(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(UserInfoWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateUserInfo(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(UserInfoWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func (t *HeathCare_Chaincode) modifyMedicalData(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tfmt.Println(\"\\n=============== start modifyMedicalData function ===============\")\n\tstart := time.Now()\n\ttime.Sleep(time.Second)\n\n\tvar jsonResp string\n\n\tif len(args) != 8 {\n\t\treturn shim.Error(\"expecting 4 argument\")\n\t}\n\n\t//define identity of query-er and new value of medical record\n\tuserid := args[0]\n\tpatientid := args[1]\n\tlocation := args[2]\n\tcollection := args[3]\n\n\tnewPersonalIdentificationInformation := args[4]\n\tnewMedicalHistory := args[5]\n\tnewFamilyMedicalHistory := args[6]\n\tnewMedicationHistory := args[7]\n\tnewTreatmentHistory := args[8]\n\tnewMedicalDirectives := args[9]\n\ttimeQuery := time.Now().String()\n\n\t//get user identity before query\n\tuserIdentityAsBytes, errUserIdentityAsByte := stub.GetPrivateData(collection, userid)\n\tif errUserIdentityAsByte != nil {\n\t\treturn shim.Error(\"cannot get user identity\")\n\t} else if userIdentityAsBytes == nil {\n\t\treturn shim.Error(\"user does not exist\")\n\t}\n\n\t//create query object with purpose: modify\n\tobjectType := \"Query\"\n\tquery := &Query{objectType, userid, patientid, location, timeQuery, \"modify\"}\n\tqueryAsByte, errQueryAsByte := json.Marshal(query)\n\tif errQueryAsByte != nil {\n\t\treturn shim.Error(errQueryAsByte.Error())\n\t}\n\n\t//save to database\n\terrQueryAsByte = stub.PutPrivateData(\"modifyCollection\", userid, queryAsByte)\n\tif errQueryAsByte != nil {\n\t\treturn shim.Error(errQueryAsByte.Error())\n\t}\n\n\t//create index key\n\tindexName := \"userid~patientid\"\n\tqueryIndexKey, errQueryIndexKey := stub.CreateCompositeKey(indexName, []string{query.UserID, query.PatientID, query.Location, query.Purpose})\n\tif errQueryIndexKey != nil {\n\t\treturn shim.Error(errQueryIndexKey.Error())\n\t}\n\n\t//save index\n\tvalue := []byte{0x00}\n\tstub.PutPrivateData(\"modifyCollection\", queryIndexKey, value)\n\n\t//get medical record data\n\tmedicalRecordAsBytes, errMedicalRecordAsByte := stub.GetPrivateData(\"MedicalRecordCollection\", patientid)\n\tif errMedicalRecordAsByte != nil {\n\t\tjsonResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + patientid + \": \" + errMedicalRecordAsByte.Error() + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t} else if errMedicalRecordAsByte == nil {\n\t\treturn shim.Error(\"patient's data does not exist\")\n\t}\n\n\t//convert data of patient to json\n\tmedicalRecord := &MedicalRecord{}\n\terrMedicalRecordAsByte = json.Unmarshal(medicalRecordAsBytes, medicalRecord)\n\n\t//change data\n\tmedicalRecord.PersonalIdentificationInformation = newPersonalIdentificationInformation\n\tmedicalRecord.MedicalHistory = newMedicalHistory\n\tmedicalRecord.FamilyMedicalHistory = newFamilyMedicalHistory\n\tmedicalRecord.MedicationHistory = newMedicationHistory\n\tmedicalRecord.TreatmentHistory = newTreatmentHistory\n\tmedicalRecord.MedicalDirectives = newMedicalDirectives\n\n\t//convert new medical record data to byte\n\tnewMedicalRecordAsByte, errNewMedicalRecordAsByte := json.Marshal(medicalRecord)\n\n\t//store new data\n\terrNewMedicalRecordAsByte = stub.PutPrivateData(\"MedicalRecordCollection\", patientid, newMedicalRecordAsByte)\n\tif errNewMedicalRecordAsByte != nil {\n\t\treturn shim.Error(\"cannot save new medical record's data\")\n\t}\n\n\tend := time.Now()\n\telapsed := time.Since(start)\n\tfmt.Println(\"function modifyMedicalData\")\n\tfmt.Println(\"time start: \", start.String())\n\tfmt.Println(\"time end: \", end.String())\n\tfmt.Println(\"time execute: \", elapsed.String())\n\tfmt.Println(\"=============== end modifyMedicalData function ===============\")\n\n\treturn shim.Success(nil)\n}", "func DefaultStrictUpdateHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateHealthMenstruationDailyEntry\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &HealthMenstruationDailyEntryORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func (service *EmployeeService) PatchEmployeeDetails(employeeID string, employeeDetails models.Employee) error {\n\tcollection := service.mongoClient.Database(DbName).Collection(CollectionName)\n\tupdatesToBePerformed := bson.M{}\n\tupdatesToBePerformed[\"employeeid\"] = employeeID\n\tif employeeDetails.Department != nil {\n\t\tupdatesToBePerformed[\"department\"] = employeeDetails.Department\n\t}\n\n\tif employeeDetails.Name != nil {\n\t\tupdatesToBePerformed[\"name\"] = employeeDetails.Name\n\t}\n\n\tif employeeDetails.Skills != nil {\n\t\tupdatesToBePerformed[\"skills\"] = employeeDetails.Skills\n\t}\n\n\tif employeeDetails.Address != nil {\n\t\taddress := models.Address{}\n\t\tif employeeDetails.Address.City != nil {\n\t\t\taddress.City = employeeDetails.Address.City\n\t\t}\n\n\t\tif employeeDetails.Address.Country != nil {\n\t\t\taddress.Country = employeeDetails.Address.Country\n\t\t}\n\n\t\tif employeeDetails.Address.DoorNo != nil {\n\t\t\taddress.DoorNo = employeeDetails.Address.DoorNo\n\t\t}\n\n\t\tif employeeDetails.Address.State != nil {\n\t\t\taddress.State = employeeDetails.Address.State\n\t\t}\n\n\t\tupdatesToBePerformed[\"address\"] = address\n\t}\n\n\tif employeeDetails.Status != nil {\n\t\tupdatesToBePerformed[\"status\"] = employeeDetails.Status\n\t}\n\n\t// consolidatedMap(&updatesToBePerformed, employeeDetails)\n\n\tresult, err := collection.UpdateOne(\n\t\tcontext.Background(),\n\t\tbson.M{\"employeeid\": employeeID},\n\t\tbson.M{\n\t\t\t\"$set\": updatesToBePerformed,\n\t\t})\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tfmt.Println(result)\n\n\treturn nil\n}", "func DefaultApplyFieldMaskHealthMenstruationDailyEntry(ctx context.Context, patchee *HealthMenstruationDailyEntry, patcher *HealthMenstruationDailyEntry, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"ProfileId\" {\n\t\t\tpatchee.ProfileId = patcher.ProfileId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Day\" {\n\t\t\tpatchee.Day = patcher.Day\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"IntensityPercentage\" {\n\t\t\tpatchee.IntensityPercentage = patcher.IntensityPercentage\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Type\" {\n\t\t\tpatchee.Type = patcher.Type\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Manual\" {\n\t\t\tpatchee.Manual = patcher.Manual\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"BasedOnPrediction\" {\n\t\t\tpatchee.BasedOnPrediction = patcher.BasedOnPrediction\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func DefaultPatchSetHealthMenstruationDailyEntry(ctx context.Context, objects []*HealthMenstruationDailyEntry, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*HealthMenstruationDailyEntry, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*HealthMenstruationDailyEntry, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchHealthMenstruationDailyEntry(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func (t *HeathCare_Chaincode) modifyPatientInformation(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tfmt.Println(\"\\n=============== start modifyPatientInformation function ===============\")\n\tstart := time.Now()\n\ttime.Sleep(time.Second)\n\n\tvar jsonResp string\n\n\tif len(args) != 8 {\n\t\treturn shim.Error(\"expecting 8 argument\")\n\t}\n\n\tuserid := args[0]\n\tpatientid := args[1]\n\tlocation := args[2]\n\tcollection := args[3]\n\n\tnewInsuranceCard := args[4]\n\tnewCurrentMedicationInformation := args[5]\n\tnewRelatedMedicalRecords := args[6]\n\tnewmakeNoteOfAppointmentDate := args[7]\n\ttimeQuery := time.Now().String()\n\n\t//get user identity before query\n\tuserIdentityAsBytes, errUserIdentityAsByte := stub.GetPrivateData(collection, userid)\n\tif errUserIdentityAsByte != nil {\n\t\treturn shim.Error(\"cannot get user identity\")\n\t} else if userIdentityAsBytes == nil {\n\t\treturn shim.Error(\"user does not exist\")\n\t}\n\n\tobjectType := \"Query\"\n\tquery := &Query{objectType, userid, patientid, location, timeQuery, \"modify\"}\n\tqueryAsByte, errQueryAsByte := json.Marshal(query)\n\tif errQueryAsByte != nil {\n\t\treturn shim.Error(errQueryAsByte.Error())\n\t}\n\n\t//save to database\n\terrQueryAsByte = stub.PutPrivateData(\"modifyCollection\", userid, queryAsByte)\n\tif errQueryAsByte != nil {\n\t\treturn shim.Error(errQueryAsByte.Error())\n\t}\n\n\t//create index key\n\tindexName := \"userid~patientid\"\n\tqueryIndexKey, errQueryIndexKey := stub.CreateCompositeKey(indexName, []string{query.UserID, query.PatientID, query.Location, query.Purpose})\n\tif errQueryIndexKey != nil {\n\t\treturn shim.Error(errQueryIndexKey.Error())\n\t}\n\n\t//save index\n\tvalue := []byte{0x00}\n\tstub.PutPrivateData(\"modifyCollection\", queryIndexKey, value)\n\n\t//get data\n\tpatientAsBytes, errPatientAsByte := stub.GetPrivateData(\"PatientInformationCollection\", patientid)\n\tif errPatientAsByte != nil {\n\t\tjsonResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + patientid + \": \" + errPatientAsByte.Error() + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t} else if errPatientAsByte == nil {\n\t\treturn shim.Error(\"patient's data does not exist\")\n\t}\n\n\t//convert data of patient to json\n\tpatient := &PatientInformation{}\n\terrPatientAsByte = json.Unmarshal(patientAsBytes, patient)\n\n\t//change data\n\tpatient.InsuranceCard = newInsuranceCard\n\tpatient.CurrentMedicationInformation = newCurrentMedicationInformation\n\tpatient.RelatedMedicalRecords = newRelatedMedicalRecords\n\tpatient.MakeNoteOfAppointmentDate = newmakeNoteOfAppointmentDate\n\n\tpatientAsByte, errPatientAsByte := json.Marshal(patient)\n\n\terrPatientAsByte = stub.PutPrivateData(\"PatientInformationCollection\", patientid, patientAsByte)\n\tif errPatientAsByte != nil {\n\t\treturn shim.Error(\"cannot patient's data\")\n\t}\n\n\tend := time.Now()\n\telapsed := time.Since(start)\n\tfmt.Println(\"function modifyPatientInformation\")\n\tfmt.Println(\"time start: \", start.String())\n\tfmt.Println(\"time end: \", end.String())\n\tfmt.Println(\"time execute: \", elapsed.String())\n\tfmt.Println(\"=============== end modifyPatientInformation function ===============\")\n\n\treturn shim.Success(nil)\n}", "func DefaultStrictUpdateUserInfo(ctx context.Context, in *UserInfo, db *gorm.DB) (*UserInfo, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateUserInfo\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &UserInfoORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func (c *Client) ModifyHealthCheck(args *ModifyHealthCheckArgs) (*ModifyHealthCheckResponse, error) {\n\tresponse := ModifyHealthCheckResponse{}\n\terr := c.Invoke(\"ModifyHealthCheck\", args, &response)\n\tif err == nil {\n\t\treturn &response, nil\n\t}\n\treturn nil, err\n}", "func (a *HyperflexApiService) PatchHyperflexClusterProfile(ctx context.Context, moid string) ApiPatchHyperflexClusterProfileRequest {\n\treturn ApiPatchHyperflexClusterProfileRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func (db *DataBase) UpdatePlayerPersonalInfo(userID int32, user *models.UserPrivateInfo) (err error) {\n\tvar (\n\t\tconfirmedUser *models.UserPrivateInfo\n\t\ttx *sql.Tx\n\t)\n\n\tif tx, err = db.Db.Begin(); err != nil {\n\t\treturn\n\t}\n\tdefer tx.Rollback()\n\n\tif confirmedUser, err = db.getPrivateInfo(tx, userID); err != nil {\n\t\treturn\n\t}\n\n\tconfirmedUser.Update(user)\n\n\tif err = db.updatePlayerPersonalInfo(tx, user); err != nil {\n\t\treturn\n\t}\n\n\terr = tx.Commit()\n\treturn\n}", "func (m MariaDB) Update(ctx context.Context, ep entity.PersonalData) (int64, error) {\n\tp := receive(ep)\n\tsqlQuery := \"UPDATE person SET name=?, last_name=?, phone=?, email=?, year_od_birth=? where id= ?\"\n\n\trslt, err := m.Person.ExecContext(ctx, sqlQuery, p.Name, p.LastName, p.Phone, p.Email, p.YearOfBirth, p.ID)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"could not update data\")\n\t}\n\tcount, err := rslt.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"rows are not affected\")\n\t}\n\treturn count, nil\n}", "func UpdatePerson(c *gin.Context) {\n // Get the person to be updated\n var person models.Person\n if err := models.DB.First(&person, \"id = ?\", c.Param(\"id\")).Error; err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n return\n }\n\n // Validate input\n var input UpdatePersonInput\n if err := c.ShouldBindJSON(&input); err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n return\n }\n\n models.DB.Model(&person).Updates(input)\n\n c.JSON(http.StatusOK, gin.H{\"data\": person})\n}", "func (m *CompaniesItemCompanyInformationCompanyInformationItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CompanyInformationable, requestConfiguration *CompaniesItemCompanyInformationCompanyInformationItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CompanyInformationable, 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.CreateCompanyInformationFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CompanyInformationable), nil\n}", "func EditLocalRep(c *gin.Context) {\n\tuserGUID, _ := c.GetQuery(\"user_guid\")\n\trepGUID, _ := c.GetQuery(\"rep_guid\")\n\teditTask, _ := c.GetQuery(\"editTask\")\n\tc.Header(\"Content-Type\", \"application/json\")\n\ttargetRepIndex := -1\n\tif editTask == \"add\" {\n\t\t// TODO: create map of maps\n\t\tuserReps[userGUID] = append(userReps[userGUID], repGUID)\n\t} else if editTask == \"remove\" {\n\t\ttempUserRepList := userReps[userGUID]\n\t\tfor i, value := range tempUserRepList {\n\t\t\tif value == repGUID {\n\t\t\t\ttargetRepIndex = i\n\t\t\t}\n\t\t}\n\t\tif targetRepIndex != -1 {\n\t\t\tuserReps[userGUID] = append(tempUserRepList[:targetRepIndex], tempUserRepList[targetRepIndex+1:]...)\n\t\t}\n\t} else {\n\t\tfmt.Println(\"edit Rep: provided invalid option\")\n\t\t// log.Info(\"edit Rep: provided invalid option\")\n\t}\n\n\tuserRepUpdate := models.UserRepUpdate{\n\t\tUserGUID: userGUID,\n\t\tRepGUID: repGUID,\n\t\tAction: editTask,\n\t}\n\n\tuserRepUpdateResponse, _ := json.Marshal(userRepUpdate)\n\n\tfmt.Println(string(userRepUpdateResponse))\n\n\tif cfg.Kafka.EnableKafka {\n\t\terr := writer.WriteMessages(context.Background(), kafka.Message{\n\t\t\t//Key: []byte(repGUID),\n\t\t\tValue: []byte(userRepUpdateResponse),\n\t\t})\n\t\tif err != nil {\n\t\t\tpanic(\"could not write kafka message \" + err.Error())\n\t\t}\n\t}\n\n\tmsg := map[string]interface{}{\"Status\": \"Ok\", \"user_guid\": userGUID, \"users_rep_list\": userReps[userGUID]}\n\tc.JSON(http.StatusOK, msg)\n}", "func updatePerson(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\n\tvar person Person\n\tfname := person.Fname\n\tlname := person.Lname\n\temail := person.Email\n\tpword := person.Pword\n\tid := person.Id\n\n\tstmt, err := db.Prepare(\"UPDATE person SET fname=?, lname=?, email=?, pword=?, id=? WHERE id =?\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tresult, err := stmt.Exec(fname, lname, email, pword, id)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\t_, err = result.RowsAffected()\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}", "func (m *DeviceLocalCredentialInfoItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.DeviceLocalCredentialInfoable, requestConfiguration *DeviceLocalCredentialInfoItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.DeviceLocalCredentialInfoable, 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.CreateDeviceLocalCredentialInfoFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.DeviceLocalCredentialInfoable), nil\n}", "func updatePerson(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tfmt.Println(\"Update HIT\")\n\tparams := mux.Vars(r)\n\tstmt, err := db.Prepare(\"UPDATE Persons SET pAge = ? WHERE pName = ?\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tvar per Person\n\tjson.Unmarshal(body, &per)\n\tage := per.Age\n\t_, err = stmt.Exec(age, params[\"name\"])\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tfmt.Fprintf(w, \"Person with Name = %s was updated\", params[\"name\"])\n}", "func DefaultApplyFieldMaskUserInfo(ctx context.Context, patchee *UserInfo, patcher *UserInfo, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*UserInfo, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tvar err error\n\tvar updatedCreatedAt bool\n\tvar updatedUpdatedAt bool\n\tfor i, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UserId\" {\n\t\t\tpatchee.UserId = patcher.UserId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"LastName\" {\n\t\t\tpatchee.LastName = patcher.LastName\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"FirstName\" {\n\t\t\tpatchee.FirstName = patcher.FirstName\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Period\" {\n\t\t\tpatchee.Period = patcher.Period\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"DepartmentId\" {\n\t\t\tpatchee.DepartmentId = patcher.DepartmentId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"JobId\" {\n\t\t\tpatchee.JobId = patcher.JobId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"EnrollmentFlg\" {\n\t\t\tpatchee.EnrollmentFlg = patcher.EnrollmentFlg\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"AdminFlg\" {\n\t\t\tpatchee.AdminFlg = patcher.AdminFlg\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedCreatedAt && strings.HasPrefix(f, prefix+\"CreatedAt.\") {\n\t\t\tif patcher.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"CreatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.CreatedAt, patchee.CreatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tupdatedCreatedAt = true\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUpdatedAt && strings.HasPrefix(f, prefix+\"UpdatedAt.\") {\n\t\t\tif patcher.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"UpdatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.UpdatedAt, patchee.UpdatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tupdatedUpdatedAt = true\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func patchPi(w http.ResponseWriter, r *http.Request) {\n\t// Get pi name from request\n\tvars := mux.Vars(r)\n\tname := vars[\"piname\"]\n\n\t// Retrieve pi object from data store\n\tc := appengine.NewContext(r)\n\tq := datastore.NewQuery(piListKind).Filter(\"name =\", name)\n\tt := q.Run(c)\n\tvar pi Pi\n\t_, err := t.Next(&pi)\n\tif err == datastore.Done {\n\t\thttp.Error(w, \"404 Not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Set Pi object property\n\tr.ParseForm()\n\n\t// Updating the name is not allowed\n\tformName := r.Form.Get(\"name\")\n\tif len(formName) != 0 {\n\t\thttp.Error(w, \"404 Not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tip := r.Form.Get(\"ip\")\n\tif len(ip) != 0 {\n\t\tpi.Ip = ip\n\t}\n\tlastSeen := r.Form.Get(\"lastSeen\")\n\tif len(lastSeen) != 0 {\n\t\tpi.LastSeen = lastSeen\n\t}\n\tpingCount := r.Form.Get(\"pingCount\")\n\tif len(pingCount) != 0 {\n\t\tpi.PingCount, _ = strconv.Atoi(r.Form.Get(\"pingCount\"))\n\t}\n\n\t//\tfmt.Fprint(w, \"name \", , \"\\n\")\n\tfmt.Fprint(w, \"pingCount \", r.Form.Get(\"pingCount\"), \" \", pi.PingCount, \"\\n\")\n\n\t// Store pi object in data store\n\t_, err = datastore.Put(c, datastore.NewKey(c, piListKind, name, 0, nil), &pi)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\thttp.Error(w, \"200 OK\", http.StatusOK)\n\treturn\n}", "func (p *Person) updateNormal(firstname string) {\n\t// This * get the content of pointer p\n\t// *p gets a variable sitting in RAM, that has a type Person\n\t// and update its firstname to a new named specified by the function parameter.\n\t(*p).firstname = firstname\n}", "func (t *IPDCChaincode) invoke_update_status_with_modification_check(stub shim.ChaincodeStubInterface, args []string, map_specification map[string]interface{}) pb.Response {\r\n\r\n\tfmt.Println(\"***********Entering invoke_update_status_with_modification_check***********\")\r\n\r\n\tif len(args) < 2 {\r\n\r\n\t\tfmt.Println(\"Error: Incorrect number of arguments\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error: Incorrect number of arguments\")\r\n\t}\r\n\r\n\tvar record_specification_input map[string]interface{}\r\n\r\n\tvar err error\r\n\r\n\terr = json.Unmarshal([]byte(args[0]), &record_specification_input)\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error in format of record.\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error in format of record.\")\r\n\t}\r\n\r\n\tadditional_json, ok := map_specification[\"additional_json\"]\r\n\r\n\tif ok {\r\n\r\n\t\tadditional_json_data, ok1 := additional_json.(map[string]interface{})\r\n\r\n\t\tif ok1 {\r\n\r\n\t\t\tfor spec, _ := range additional_json_data {\r\n\r\n\t\t\t\trecord_specification_input[spec] = additional_json_data[spec]\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tfmt.Println(\"Error: Invalid additional JSON fields in specification\")\r\n\r\n\t\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\t\treturn shim.Error(\"Error: Invalid additional JSON fields in specification\")\r\n\t\t}\r\n\t}\r\n\r\n\tvar keys_map interface{}\r\n\r\n\tvar specs map[string]interface{}\r\n\r\n\tkeys_map, error_keys_map := t.get_keys_map(stub, record_specification_input)\r\n\r\n\tif error_keys_map != nil {\r\n\r\n\t\tfmt.Println(error_keys_map.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(error_keys_map.Error())\r\n\t}\r\n\r\n\tspecs, ok = keys_map.(map[string]interface{})\r\n\r\n\tif !ok {\r\n\r\n\t\tfmt.Println(\"Error: Invalid keys_map specification.\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error: Invalid keys_map specification.\")\r\n\t}\r\n\r\n\tif specs[\"primary_key\"] == nil {\r\n\r\n\t\tfmt.Println(\"Error: There is no primary key specification.\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error : There is no primary key specification.\")\r\n\t}\r\n\r\n\tvar pk_spec []interface{}\r\n\r\n\tpk_spec, ok = specs[\"primary_key\"].([]interface{})\r\n\r\n\tif !ok {\r\n\r\n\t\tfmt.Println(\"Error in Primary key specification.\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error in Primary key specification.\")\r\n\t}\r\n\r\n\tkey, err_key := t.createInterfacePrimaryKey(record_specification_input, pk_spec)\r\n\r\n\tif err_key != nil {\r\n\r\n\t\tfmt.Println(err_key.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(err_key.Error())\r\n\r\n\t}\r\n\r\n\tvar valAsBytes []byte\r\n\r\n\tvalAsBytes, err = stub.GetState(key)\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error: Failed to get state: \" + err.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error: Failed to get state: \" + err.Error())\r\n\r\n\t} else if valAsBytes == nil {\r\n\r\n\t\tfmt.Println(\"Error: No value for primary key : \" + key)\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error: No value for key\")\r\n\r\n\t}\r\n\r\n\tvar record_specification map[string]interface{}\r\n\r\n\terr = json.Unmarshal([]byte(valAsBytes), &record_specification)\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error in format of record\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error in format of record\")\r\n\r\n\t}\r\n\r\n\tvar check int\r\n\r\n\tcheck, err = t.Isfieldsmodified(record_specification_input, record_specification, map_specification)\r\n\r\n\tif check != 0 {\r\n\r\n\t\tfmt.Println(\"Status Update Failed due to error in modification check. \" + err.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Status Update Failed due to error in modification check. \" + err.Error())\r\n\t}\r\n\r\n\terr_del := t.delete_composite_keys(stub, specs, record_specification, key)\r\n\r\n\tif err_del != nil {\r\n\r\n\t\tfmt.Println(\"Error in deleting composite keys\" + err_del.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error in deleting composite keys\" + err_del.Error())\r\n\r\n\t}\r\n\r\n\tvar to_be_updated_map map[string]interface{}\r\n\r\n\terr = json.Unmarshal([]byte(args[1]), &to_be_updated_map)\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error in format of update map.\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error in format of update map.\")\r\n\r\n\t}\r\n\r\n\tfor spec, spec_val := range to_be_updated_map {\r\n\r\n\t\tvar spec_val_string, spec_ok = spec_val.(string)\r\n\r\n\t\tif !spec_ok {\r\n\r\n\t\t\tfmt.Println(\"Error: Unable to parse value of status update\")\r\n\r\n\t\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\t\treturn shim.Error(\"Error: Unable to parse value of status update\")\r\n\r\n\t\t}\r\n\r\n\t\tvar val_check, val_err = t.updatestatusvaliditycheck(spec, spec_val_string, map_specification)\r\n\r\n\t\tif val_check != 0 {\r\n\r\n\t\t\tfmt.Println(val_err.Error())\r\n\r\n\t\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\t\treturn shim.Error(val_err.Error())\r\n\t\t}\r\n\r\n\t\trecord_specification[spec] = spec_val_string\r\n\t}\r\n\r\n\tvar concatenated_record_json []byte\r\n\r\n\tconcatenated_record_json, err = json.Marshal(record_specification)\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error: Unable to Marshal Concatenated Record to JSON \" + err.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error: Unable to Marshal Concatenated Record to JSON \" + err.Error())\r\n\t}\r\n\r\n\terr = stub.PutState(key, []byte(concatenated_record_json))\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error: Failed to put state : \" + err.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error: Failed to put state : \" + err.Error())\r\n\t}\r\n\r\n\terr = t.create_composite_keys(stub, specs, record_specification, key)\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error in creating composite keys\" + err.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error in creating composite keys\" + err.Error())\r\n\t}\r\n\r\n\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\treturn shim.Success(nil)\r\n\r\n}", "func (m *TeamworkRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.UserTeamworkable, requestConfiguration *TeamworkRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.UserTeamworkable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateUserTeamworkFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.UserTeamworkable), nil\n}", "func (srv *UsersService) PatchHandler(ctx *gin.Context) {\n\tlogger := srv.logger.New(\"action\", \"PatchHandler\")\n\tuser := GetRequestedUser(ctx)\n\tif user == nil {\n\t\t// Returns a \"404 StatusNotFound\" response\n\t\tsrv.ResponseService.NotFound(ctx)\n\t\treturn\n\t}\n\n\t// Checks if the query entry is valid\n\tform := &validators.PatchUser{}\n\tif err := ctx.ShouldBindJSON(form); err != nil {\n\t\tsrv.ResponseService.ValidatorErrorResponse(ctx, responses.UnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tcurrentUser := GetCurrentUser(ctx)\n\tif currentUser.UID == user.UID ||\n\t\tcurrentUser.RoleName == \"root\" ||\n\t\tcurrentUser.RoleName == \"admin\" {\n\n\t\tif form.FirstName != nil {\n\t\t\tuser.FirstName = *form.FirstName\n\t\t}\n\t\tif form.LastName != nil {\n\t\t\tuser.LastName = *form.LastName\n\t\t}\n\t\tif form.Nickname != nil {\n\t\t\tuser.Nickname = *form.Nickname\n\t\t}\n\n\t\trepo := srv.Repository.GetUsersRepository()\n\t\told, err := repo.FindByUID(user.UID)\n\t\tif err != nil {\n\t\t\tlogger.Error(\"cannot find user\", \"err\", err)\n\t\t\tsrv.ResponseService.NotFound(ctx)\n\t\t\treturn\n\t\t}\n\n\t\t_, err = repo.Update(user)\n\t\tif err != nil {\n\t\t\tlogger.Error(\"cannot update user\", \"err\", err)\n\t\t\tsrv.ResponseService.Error(ctx, responses.CanNotUpdateUser, \"Can't update a user\")\n\t\t\treturn\n\t\t}\n\n\t\tif currentUser.UID != user.UID &&\n\t\t\t(currentUser.RoleName == \"admin\" || currentUser.RoleName == \"root\") {\n\t\t\tsrv.SystemLogsService.LogModifyUserProfileAsync(old, user, currentUser.UID)\n\t\t}\n\t}\n\n\t// Returns a \"204 StatusNoContent\" response\n\tctx.JSON(http.StatusNoContent, nil)\n}", "func (s *Service) patchHalResource(ctx context.Context, resourceName, url string, r interface{}, pf patchFunction) ([]byte, *status.Status) {\n\n\tvar body []byte\n\tvar code int\n\tvar err error\n\n\tb := new(bytes.Buffer)\n\tjson.NewEncoder(b).Encode(r)\n\n\tbody, code, err = pf(ctx, url, b, \"application/json\")\n\tif err != nil {\n\t\tlog.WithFields(event.Fields{\n\t\t\t\"resourceName\": resourceName,\n\t\t\t\"code\": code,\n\t\t\t\"url\": url,\n\t\t}).Error(\"Can not patch HAL resource: \" + err.Error())\n\t\treturn []byte{}, status.NewStatus(body, code, \"Can not modify resource \"+resourceName)\n\t}\n\n\t// A PATCH request should return a value in range of [200,300[\n\tif code < http.StatusOK || code >= http.StatusMultipleChoices {\n\t\tlog.WithFields(event.Fields{\n\t\t\t\"resourceName\": resourceName,\n\t\t\t\"code\": code,\n\t\t\t\"url\": url,\n\t\t}).Error(\"Can not patch HAL resource\")\n\t\treturn []byte{}, status.NewStatus(body, code, \"Can not modify resource \"+resourceName)\n\t}\n\treturn body, nil\n}", "func (m *PrivilegedSignupStatusItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedSignupStatusable, requestConfiguration *PrivilegedSignupStatusItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedSignupStatusable, 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.CreatePrivilegedSignupStatusFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedSignupStatusable), nil\n}", "func UpdateEmployee(c *gin.Context) {\r\n var employee model.Employee\r\n id := c.Params.ByName(\"id\")\r\n err := model.GetEmployeeByID(&employee, id)\r\n if err != nil {\r\n c.JSON(http.StatusNotFound, employee)\r\n }\r\n c.BindJSON(&employee)\r\n err = model.UpdateEmployee(&employee, id)\r\n if err != nil {\r\n c.AbortWithStatus(http.StatusNotFound)\r\n } else {\r\n c.JSON(http.StatusOK, employee)\r\n }\r\n}", "func (t *MedChain) updateHospitalToPatient(stub shim.ChaincodeStubInterface, args []string) peer.Response {\n\t\t// ==== Input sanitation ====\n\t\tfmt.Println(\"- start updateHospitalToPatient\")\n\n\t\t// check if all the args are send\n\t\tif len(args) != 5 {\n\t\t\treturn shim.Error(\"Incorrect number of arguments, Required 5 arguments\")\n\t\t}\n\n\t\t// check if the args are empty\n\t\tfor i := 0; i < len(args); i++ {\n\t\t\tif len(args[i]) <= 0 {\n\t\t\t\treturn shim.Error(\"argument \"+ string(i+1) + \" must be a non-empty string\")\n\t\t\t}\n\t\t}\n\n\t\tgetAssetAsBytes, errT := stub.GetState(args[0])\n\n\t\tif errT != nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Error : Cannot find HospitalToPatient %s\" , errT))\n\t\t}\n\n\t\tif getAssetAsBytes == nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Cannot find asset HospitalToPatient with ID %s\" , args[0]))\n\t\t}\n\n\t\tvar obj = HospitalToPatient{}\n\n\t\tjson.Unmarshal(getAssetAsBytes, &obj)\n\t\tobj.PatientID = args[1]\n\t\tobj.PatientName = args[2]\n\t\tobj.HospitalID = args[3]\n\t\tobj.HospitalName = args[4]\n\t\tcomAssetAsBytes, errMarshal := json.Marshal(obj)\n\n\t\tif errMarshal != nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Marshal Error: %s\", errMarshal))\n\t\t}\n\n\t\terrPut := stub.PutState(obj.HospitalToPatient_ID, comAssetAsBytes)\n\n\t\tif errPut != nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Failed to update HospitalToPatient with ID %s\", args[0]))\n\t\t}\n\n\t\tfmt.Println(\"HospitalToPatient asset with ID %s was updated \\n %v\", args[0], obj)\n\n\t\treturn shim.Success(comAssetAsBytes)\n\t}", "func (c *Controller) patchPlatform(r *web.Request) (*web.Response, error) {\n\tplatformID := r.PathParams[reqPlatformID]\n\tctx := r.Context()\n\tlog.C(ctx).Debugf(\"Updating platform with id %s\", platformID)\n\n\tplatform, err := c.PlatformStorage.Get(ctx, platformID)\n\tif err != nil {\n\t\treturn nil, util.HandleStorageError(err, \"platform\")\n\t}\n\n\tcreatedAt := platform.CreatedAt\n\n\tif err := util.BytesToObject(r.Body, platform); err != nil {\n\t\treturn nil, err\n\t}\n\n\tplatform.ID = platformID\n\tplatform.CreatedAt = createdAt\n\tplatform.UpdatedAt = time.Now().UTC()\n\n\tif err := c.PlatformStorage.Update(ctx, platform); err != nil {\n\t\treturn nil, util.HandleStorageError(err, \"platform\")\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn util.NewJSONResponse(http.StatusOK, platform)\n}", "func HandleUpdatePerson(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tid := r.URL.Query().Get(\"id\")\n\tif id == \"\" {\n\t\thttp.Error(w, \"id parameter is not found\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tfmt.Println(id)\n\treqBody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"Body Read Error : %v\", err), http.StatusInternalServerError)\n\t}\n\tvar body map[string]string\n\terr = json.Unmarshal(reqBody, &body)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"Request Body parse error : %v\", err), http.StatusBadRequest)\n\t\treturn\n\t}\n\tfmt.Printf(body[\"name\"])\n\tcols := \"\"\n\n\tfor key, val := range body {\n\t\tcols = cols + key + \"=\" + \"'\" + val + \"'\" + \",\"\n\t}\n\tf := cols[:len(cols)-1]\n\n\t_, err = Db.Exec(fmt.Sprintf(\"UPDATE people SET %s where people.id=?\", f), id)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"ERROR in deleting person %s\", err.Error()), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tvar person db.Person\n\tres, err := Db.Query(\"SELECT * FROM people where id=?\", id)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"ERROR in updating person %s\", err.Error()), http.StatusBadRequest)\n\t\treturn\n\t}\n\tdefer res.Close()\n\tfor res.Next() {\n\t\terr = res.Scan(&person.Id, &person.Name, &person.City, &person.ContactNo, &person.PhotoUrl)\n\t\tif err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"ERROR in updating person %s\", err.Error()), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n\tjson.NewEncoder(w).Encode(person)\n}", "func (c *kuberhealthyChecks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result KuberhealthyCheck, err error) {\n\tresult = KuberhealthyCheck{}\n\terr = c.client.Patch(pt).\n\t\tNamespace(c.ns).\n\t\tResource(\"khchecks\").\n\t\tSubResource(subresources...).\n\t\tName(name).\n\t\tBody(data).\n\t\tDo(context.TODO()).\n\t\tInto(&result)\n\treturn\n}", "func (m *DBMockedObject) Update(ctx context.Context, document entity.PersonalData) (int64, error) {\n\targs := m.Called(ctx, document)\n\treturn int64(args.Int(0)), args.Error(1)\n}", "func (client LabClient) PatchResourceResponder(resp *http.Response) (result Lab, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func Patch(path string, fn http.HandlerFunc, c ...alice.Constructor) {\n\trecord(\"PATCH\", path)\n\n\tinfoMutex.Lock()\n\tr.PATCH(path, Handler(alice.New(c...).ThenFunc(fn)))\n\tinfoMutex.Unlock()\n}", "func patchLocomotive(w http.ResponseWriter, r *http.Request) {\n\tvar document Locomotive\n\n\t//\tObtener la base de datos y colección a utilizar.-\n\tparams := mux.Vars(r)\n\tdatabaseName := params[\"databaseName\"]\n\tcollectionName := params[\"collectionName\"]\n\n\t//\tObtener el modelo a filtrar.-\n\tmodel := params[\"model\"]\n\n\t//\tConfigurar los filtros.-\n\tfilter := make(map[string]interface{})\n\tif model != \"\" {\n\t\tfilter[\"model\"] = model\n\t}\n\n\t//\tDecodificar el documento json recibido y dejarlo en la variable de tipo struct.-\n\t_ = json.NewDecoder(r.Body).Decode(&document)\n\n\t//\tConfigurar los updates.-\n\tupdate := make(map[string]interface{})\n\tif document.PowerType != \"\" {\n\t\tupdate[\"powertype\"] = document.PowerType\n\t}\n\tif document.Builder != \"\" {\n\t\tupdate[\"builder\"] = document.Builder\n\t}\n\tif document.BuildDate != \"\" {\n\t\tupdate[\"builddate\"] = document.BuildDate\n\t}\n\tif document.WheelSystem != \"\" {\n\t\tupdate[\"wheelsystem\"] = document.WheelSystem\n\t}\n\tif document.MaximunSpeed > 0 {\n\t\tupdate[\"maximunspeed\"] = document.MaximunSpeed\n\t}\n\tif document.PowerOutputHP > 0 {\n\t\tupdate[\"poweroutputhp\"] = document.PowerOutputHP\n\t}\n\n\t//\tActualizar la locomotora.-\n\tupdatedCount, err := UpdateDocument(databaseName, collectionName, filter, update)\n\tif err != nil {\n\t\thttputility.GetJsonResponseMessage(w, \"patchLocomotive: \"+err.Error())\n\t} else {\n\t\tif updatedCount == 0 {\n\t\t\thttputility.GetJsonResponseMessage(w, \"patchLocomotive: No se encontró ningun documento a actualizar en la Base de Datos (MongoDB).\")\n\t\t} else {\n\t\t\tif updatedCount == 1 {\n\t\t\t\thttputility.GetJsonResponseMessage(w, \"patchLocomotive: Se actualizó correctamente el documento de la Base de Datos (MongoDB).\")\n\t\t\t} else {\n\t\t\t\thttputility.GetJsonResponseMessage(w, \"patchLocomotive: Se actualizaron correctamente \"+string(updatedCount)+\" documentos de la Base de Datos (MongoDB).\")\n\t\t\t}\n\t\t}\n\t}\n}", "func (me *PROTECTIONJOBS_IMPL) UpdateProtectionJob (\r\n body *models.ProtectionJobRequest,\r\n id int64) (*models.ProtectionJob, error) {\r\n//validating required parameters\r\n if (body == nil){\r\n return nil,errors.New(\"The parameter 'body' is a required parameter and cannot be nil.\")\r\n} //the endpoint path uri\r\n _pathUrl := \"/public/protectionJobs/{id}\"\r\n\r\n //variable to hold errors\r\n var err error = nil\r\n //process optional template parameters\r\n _pathUrl, err = apihelper.AppendUrlWithTemplateParameters(_pathUrl, map[string]interface{} {\r\n \"id\" : id,\r\n })\r\n if err != nil {\r\n //error in template param handling\r\n return nil, err\r\n }\r\n\r\n //the base uri for api requests\r\n _queryBuilder := configuration.GetBaseURI(configuration.DEFAULT_HOST,me.config);\r\n\r\n //prepare query string for API call\r\n _queryBuilder = _queryBuilder + _pathUrl\r\n\r\n //validate and preprocess url\r\n _queryBuilder, err = apihelper.CleanUrl(_queryBuilder)\r\n if err != nil {\r\n //error in url validation or cleaning\r\n return nil, err\r\n }\r\n if me.config.AccessToken() == nil {\r\n return nil, errors.New(\"Access Token not set. Please authorize the client using client.Authorize()\");\r\n }\r\n //prepare headers for the outgoing request\r\n headers := map[string]interface{} {\r\n \"user-agent\" : \"cohesity-Go-sdk-6.2.0\",\r\n \"accept\" : \"application/json\",\r\n \"content-type\" : \"application/json; charset=utf-8\",\r\n \"Authorization\" : fmt.Sprintf(\"%s %s\",*me.config.AccessToken().TokenType, *me.config.AccessToken().AccessToken),\r\n }\r\n\r\n //prepare API request\r\n _request := unirest.Put(_queryBuilder, headers, body)\r\n //and invoke the API call request to fetch the response\r\n _response, err := unirest.AsString(_request,me.config.SkipSSL());\r\n if err != nil {\r\n //error in API invocation\r\n return nil, err\r\n }\r\n\r\n //error handling using HTTP status codes\r\n if (_response.Code == 0) {\r\n err = apihelper.NewAPIError(\"Error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code < 200) || (_response.Code > 206) { //[200,206] = HTTP OK\r\n err = apihelper.NewAPIError(\"HTTP Response Not OK\", _response.Code, _response.RawBody)\r\n }\r\n if(err != nil) {\r\n //error detected in status code validation\r\n return nil, err\r\n }\r\n\r\n //returning the response\r\n var retVal *models.ProtectionJob = &models.ProtectionJob{}\r\n err = json.Unmarshal(_response.RawBody, &retVal)\r\n\r\n if err != nil {\r\n //error in parsing\r\n return nil, err\r\n }\r\n return retVal, nil\r\n\r\n}", "func (a *HyperflexApiService) PatchHyperflexNodeProfile(ctx context.Context, moid string) ApiPatchHyperflexNodeProfileRequest {\n\treturn ApiPatchHyperflexNodeProfileRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func Patch() echo.HandlerFunc {\n\treturn func(context echo.Context) error {\n\t\tuserID := context.Param(\"userID\")\n\t\tsession := context.Get(\"session\").(*session.Session)\n\t\tif session == nil || (session.UserID != userID && !session.IsAdmin) {\n\t\t\tlog.Printf(\"ERROR: unauthorized attempt to modify account %s by user with session %+v\", userID, session)\n\t\t\treturn context.JSON(http.StatusUnauthorized, \"\")\n\t\t}\n\n\t\tuser, err := FindByID(userID)\n\n\t\tif err != nil || user == nil {\n\t\t\treturn context.JSON(http.StatusInternalServerError, errors.New(\"Cannot load user with ID %s\"))\n\t\t}\n\n\t\tpreviousIsAdmin := user.IsAdmin\n\n\t\terr = context.Bind(&user)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Cannot bind user %v\", err)\n\t\t\treturn context.JSON(http.StatusBadRequest, errors.New(\"Cannot decode request body\"))\n\t\t}\n\t\tif user.IsAdmin != previousIsAdmin && !session.IsAdmin {\n\t\t\tlog.Printf(\"ERROR: unauthorized attempt to give admin rights to account %s by user with session %+v\", user.Email, session)\n\t\t\treturn context.JSON(http.StatusUnauthorized, \"\")\n\t\t}\n\n\t\tsaveErr := Save(user)\n\t\tif saveErr != nil {\n\t\t\tlog.Printf(\"Cannot update user %v\", user.ID)\n\t\t\treturn context.JSON(http.StatusInternalServerError, errors.New(\"Cannot update user \"+user.ID))\n\t\t}\n\t\tuser.Hash = \"\" // never leak the hash\n\t\treturn context.JSON(http.StatusOK, user)\n\t}\n}", "func (m *TeamworkSoftwareUpdateHealth) SetAdditionalData(value map[string]any)() {\n err := m.GetBackingStore().Set(\"additionalData\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *ItemOnlineMeetingsItemRegistrationRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.MeetingRegistrationable, requestConfiguration *ItemOnlineMeetingsItemRegistrationRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.MeetingRegistrationable, 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.CreateMeetingRegistrationFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.MeetingRegistrationable), nil\n}", "func updatePerson(w http.ResponseWriter, r *http.Request) {\r\n\tw.Header().Set(\"Content-Type\", \"application/json\")\r\n\tparams := mux.Vars(r)\r\n\tuuid, err := primitive.ObjectIDFromHex(params[\"uuid\"])\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\r\n\tcollection := models.ConnectDB()\r\n\r\n\tvar oldPerson models.Person\r\n\terr = collection.FindOne(context.TODO(), bson.M{\"_id\": uuid}).Decode(&oldPerson)\r\n\tif err != nil {\r\n\t\thttp.Error(w, http.StatusText(500), 500)\r\n\t\treturn\r\n\t}\r\n\tvar person models.Person\r\n\t_ = json.NewDecoder(r.Body).Decode(&person)\r\n\r\n\tSurvived := r.FormValue(\"survived\")\r\n\tPassengerClass := r.FormValue(\"passengerClass \")\r\n\tName := r.FormValue(\"name\")\r\n\tSex := r.FormValue(\"sex\")\r\n\tAge := r.FormValue(\"age\")\r\n\tSiblingsOrSpousesAboard := r.FormValue(\"siblingsOrSpousesAboard\")\r\n\tParentsOrChildrenAboard := r.FormValue(\"parentsOrChildrenAboard\")\r\n\tFare := r.FormValue(\"fare\")\r\n\r\n\tif Survived == \" \" {\r\n\t\tperson.Survived = oldPerson.Survived\r\n\t}\r\n\r\n\tif PassengerClass == \" \" {\r\n\t\tperson.PassengerClass = oldPerson.PassengerClass\r\n\t}\r\n\r\n\tif Name == \"\" {\r\n\t\tperson.Name = oldPerson.Name\r\n\t}\r\n\r\n\tif Sex == \" \" {\r\n\t\tperson.Sex = oldPerson.Sex\r\n\t}\r\n\r\n\tif Age == \" \" {\r\n\t\tperson.Age = oldPerson.Age\r\n\t}\r\n\r\n\tif SiblingsOrSpousesAboard == \" \" {\r\n\t\tperson.SiblingsOrSpousesAboard = oldPerson.SiblingsOrSpousesAboard\r\n\t}\r\n\r\n\tif ParentsOrChildrenAboard == \" \" {\r\n\t\tperson.ParentsOrChildrenAboard = oldPerson.ParentsOrChildrenAboard\r\n\t}\r\n\r\n\tif Fare == \" \" {\r\n\t\tperson.Fare = oldPerson.Fare\r\n\t}\r\n\r\n\tobjectDataToUpdate := bson.M{\r\n\t\t\"$set\": bson.M{\r\n\t\t\"survived\": person.Survived,\r\n\t\t\"passengerClass\": person.PassengerClass,\r\n\t\t\"name\": person.Name,\r\n\t\t\"sex\": person.Sex,\r\n\t\t\"age\": person.Age,\r\n\t\t\"siblingsOrSpousesAboard\": person.SiblingsOrSpousesAboard,\r\n\t\t\"parentsOrChildrenAboard\": person.ParentsOrChildrenAboard,\r\n\t\t\"fare\": person.Fare,\t\t\r\n\t\t},\r\n\t}\r\n\r\n\tobjectToUpdate, err := collection.UpdateOne(context.TODO(), bson.M{\"_id\": uuid}, objectDataToUpdate)\r\n\tif err != nil {\r\n\t\thttp.Error(w, http.StatusText(500), 500)\r\n\t\treturn\r\n\t}\r\n\tjson.NewEncoder(w).Encode(objectToUpdate.ModifiedCount)\r\n}", "func (r *CompanyInformationRequest) Update(ctx context.Context, reqObj *CompanyInformation) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (m *HealthMenstruationPersonalInfoORM) ToPB(ctx context.Context) (HealthMenstruationPersonalInfo, error) {\n\tto := HealthMenstruationPersonalInfo{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(HealthMenstruationPersonalInfoWithBeforeToPB); ok {\n\t\tif err = prehook.BeforeToPB(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tif m.CreatedAt != nil {\n\t\tif to.CreatedAt, err = ptypes1.TimestampProto(*m.CreatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tif m.UpdatedAt != nil {\n\t\tif to.UpdatedAt, err = ptypes1.TimestampProto(*m.UpdatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.ProfileId = m.ProfileId\n\tto.PeriodLengthInDays = m.PeriodLengthInDays\n\tto.CycleLengthInDays = m.CycleLengthInDays\n\tif posthook, ok := interface{}(m).(HealthMenstruationPersonalInfoWithAfterToPB); ok {\n\t\terr = posthook.AfterToPB(ctx, &to)\n\t}\n\treturn to, err\n}", "func (c *Client) ModifySubAppIdInfo(request *ModifySubAppIdInfoRequest) (response *ModifySubAppIdInfoResponse, err error) {\n if request == nil {\n request = NewModifySubAppIdInfoRequest()\n }\n response = NewModifySubAppIdInfoResponse()\n err = c.Send(request, response)\n return\n}", "func (a *HyperflexApiService) PatchHyperflexHealthCheckDefinition(ctx context.Context, moid string) ApiPatchHyperflexHealthCheckDefinitionRequest {\n\treturn ApiPatchHyperflexHealthCheckDefinitionRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func (m *Monocular) UpdateMetadata(info *interfaces.Info, userGUID string, echoContext echo.Context) {\n}", "func updateVolunteer(c *gin.Context) {\n\n\tvar vol Volunteer\n\temail := c.Params.ByName(\"email\")\n\n\t//Checks json data\n\tif err := c.BindJSON(&vol); err != nil {\n\t\tcreateBadRequestResponse(c, err)\n\t\treturn\n\t}\n\n\t//Gets volunteer from database\n\tvar oldvol Volunteer\n\tif err := db.Where(\"email = ?\", email).First(&oldvol).Error; err != nil {\n\t\tcreateNotFoundResponse(c)\n\t\treturn\n\t}\n\t//Sets data which could not be changed (I am still not sure if url path have to be with :email )\n\tvol.ID = oldvol.ID\n\tvol.Email = oldvol.Email\n\tif vol.Password == \"\" {\n\t\tvol.Password = oldvol.Password\n\t}\n\n\t//Checks if data belongs to the user\n\tif !volunteerAuth(c, &vol) {\n\t\treturn\n\t}\n\n\t//Saves Volunteer to the database\n\tif err := db.Save(&vol).Error; err != nil {\n\t\tcreateStatusConflictResponse(c)\n\t\treturn\n\t}\n\t//change password in auth map\n\tauthMap[vol.Email] = vol.Password\n\tc.JSON(200, vol)\n\n}", "func (me *CHARGES_IMPL) UpdateChargeMetadata (\r\n chargeId string,\r\n body *models_pkg.ChargesMetadataRequest,\r\n idempotencyKey *string) (*models_pkg.ChargesMetadataResponse, error) {\r\n //the endpoint path uri\r\n _pathUrl := \"/Charges/{charge_id}/metadata\"\r\n\r\n //variable to hold errors\r\n var err error = nil\r\n //process optional template parameters\r\n _pathUrl, err = apihelper_pkg.AppendUrlWithTemplateParameters(_pathUrl, map[string]interface{} {\r\n \"charge_id\" : chargeId,\r\n })\r\n if err != nil {\r\n //error in template param handling\r\n return nil, err\r\n }\r\n\r\n //the base uri for api requests\r\n _queryBuilder := configuration_pkg.BASEURI;\r\n\r\n //prepare query string for API call\r\n _queryBuilder = _queryBuilder + _pathUrl\r\n\r\n //validate and preprocess url\r\n _queryBuilder, err = apihelper_pkg.CleanUrl(_queryBuilder)\r\n if err != nil {\r\n //error in url validation or cleaning\r\n return nil, err\r\n }\r\n //prepare headers for the outgoing request\r\n headers := map[string]interface{} {\r\n \"user-agent\" : \"MundiSDK - Go 2.4.5\",\r\n \"accept\" : \"application/json\",\r\n \"content-type\" : \"application/json; charset=utf-8\",\r\n \"Content-Type\" : \"application/json\",\r\n \"idempotency-key\" : apihelper_pkg.ToString(idempotencyKey, \"\"),\r\n }\r\n\r\n //prepare API request\r\n _request := unirest.PatchWithAuth(_queryBuilder, headers, body, me.config.BasicAuthUserName(), me.config.BasicAuthPassword())\r\n //and invoke the API call request to fetch the response\r\n _response, err := unirest.AsString(_request,false);\r\n if err != nil {\r\n //error in API invocation\r\n return nil, err\r\n }\r\n\r\n //error handling using HTTP status codes\r\n if (_response.Code == 400) {\r\n err = apihelper_pkg.NewAPIError(\"Invalid request\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 401) {\r\n err = apihelper_pkg.NewAPIError(\"Invalid API key\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 404) {\r\n err = apihelper_pkg.NewAPIError(\"An informed resource was not found\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 412) {\r\n err = apihelper_pkg.NewAPIError(\"Business validation error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 422) {\r\n err = apihelper_pkg.NewAPIError(\"Contract validation error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 500) {\r\n err = apihelper_pkg.NewAPIError(\"Internal server error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code < 200) || (_response.Code > 206) { //[200,206] = HTTP OK\r\n err = apihelper_pkg.NewAPIError(\"HTTP Response Not OK\", _response.Code, _response.RawBody)\r\n }\r\n if(err != nil) {\r\n //error detected in status code validation\r\n return nil, err\r\n }\r\n\r\n //returning the response\r\n var retVal *models_pkg.ChargesMetadataResponse = &models_pkg.ChargesMetadataResponse{}\r\n err = json.Unmarshal(_response.RawBody, &retVal)\r\n\r\n if err != nil {\r\n //error in parsing\r\n return nil, err\r\n }\r\n return retVal, nil\r\n\r\n}", "func (m *FeatureRolloutPolicyItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.FeatureRolloutPolicyable, requestConfiguration *FeatureRolloutPolicyItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.FeatureRolloutPolicyable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateFeatureRolloutPolicyFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.FeatureRolloutPolicyable), nil\n}", "func handlePatchRequest(w http.ResponseWriter, e *models.Endpoint, r *http.Request, entity entities.Entity, h *func() (interface{}, error)) {\n\tw.Header().Add(\"Access-Control-Allow-Origin\", \"*\")\n\tif !checkContentType(w, r) {\n\t\treturn\n\t}\n\n\tbyteData, _ := ioutil.ReadAll(r.Body)\n\terr := entity.ParseEntity(byteData)\n\tif err != nil {\n\t\tsendError(w, []error{err})\n\t\treturn\n\t}\n\n\thandle := *h\n\tdata, err2 := handle()\n\tif err2 != nil {\n\t\tsendError(w, []error{err2})\n\t\treturn\n\t}\n\n\tw.Header().Add(\"Location\", entity.GetSelfLink())\n\n\tsendJSONResponse(w, http.StatusOK, data, nil)\n}", "func Patch(path string, fn http.HandlerFunc, c ...alice.Constructor) {\n\tinfoMutex.Lock()\n\trecord(\"PATCH\", path)\n\tr.Patch(path, alice.New(c...).ThenFunc(fn).(http.HandlerFunc))\n\tinfoMutex.Unlock()\n}", "func (me *INVOICES_IMPL) UpdateInvoiceMetadata (\r\n invoiceId string,\r\n body *models_pkg.InvoicesMetadataRequest,\r\n idempotencyKey *string) (*models_pkg.InvoicesMetadataResponse, error) {\r\n //the endpoint path uri\r\n _pathUrl := \"/invoices/{invoice_id}/metadata\"\r\n\r\n //variable to hold errors\r\n var err error = nil\r\n //process optional template parameters\r\n _pathUrl, err = apihelper_pkg.AppendUrlWithTemplateParameters(_pathUrl, map[string]interface{} {\r\n \"invoice_id\" : invoiceId,\r\n })\r\n if err != nil {\r\n //error in template param handling\r\n return nil, err\r\n }\r\n\r\n //the base uri for api requests\r\n _queryBuilder := configuration_pkg.BASEURI;\r\n\r\n //prepare query string for API call\r\n _queryBuilder = _queryBuilder + _pathUrl\r\n\r\n //validate and preprocess url\r\n _queryBuilder, err = apihelper_pkg.CleanUrl(_queryBuilder)\r\n if err != nil {\r\n //error in url validation or cleaning\r\n return nil, err\r\n }\r\n //prepare headers for the outgoing request\r\n headers := map[string]interface{} {\r\n \"user-agent\" : \"MundiSDK - Go 2.4.5\",\r\n \"accept\" : \"application/json\",\r\n \"content-type\" : \"application/json; charset=utf-8\",\r\n \"Content-Type\" : \"application/json\",\r\n \"idempotency-key\" : apihelper_pkg.ToString(idempotencyKey, \"\"),\r\n }\r\n\r\n //prepare API request\r\n _request := unirest.PatchWithAuth(_queryBuilder, headers, body, me.config.BasicAuthUserName(), me.config.BasicAuthPassword())\r\n //and invoke the API call request to fetch the response\r\n _response, err := unirest.AsString(_request,false);\r\n if err != nil {\r\n //error in API invocation\r\n return nil, err\r\n }\r\n\r\n //error handling using HTTP status codes\r\n if (_response.Code == 400) {\r\n err = apihelper_pkg.NewAPIError(\"Invalid request\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 401) {\r\n err = apihelper_pkg.NewAPIError(\"Invalid API key\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 404) {\r\n err = apihelper_pkg.NewAPIError(\"An informed resource was not found\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 412) {\r\n err = apihelper_pkg.NewAPIError(\"Business validation error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 422) {\r\n err = apihelper_pkg.NewAPIError(\"Contract validation error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 500) {\r\n err = apihelper_pkg.NewAPIError(\"Internal server error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code < 200) || (_response.Code > 206) { //[200,206] = HTTP OK\r\n err = apihelper_pkg.NewAPIError(\"HTTP Response Not OK\", _response.Code, _response.RawBody)\r\n }\r\n if(err != nil) {\r\n //error detected in status code validation\r\n return nil, err\r\n }\r\n\r\n //returning the response\r\n var retVal *models_pkg.InvoicesMetadataResponse = &models_pkg.InvoicesMetadataResponse{}\r\n err = json.Unmarshal(_response.RawBody, &retVal)\r\n\r\n if err != nil {\r\n //error in parsing\r\n return nil, err\r\n }\r\n return retVal, nil\r\n\r\n}", "func patchPrincipal(ctx context.Context, tx *Tx, patch *api.PrincipalPatch) (*api.Principal, error) {\n\tset, args := []string{\"updater_id = ?\"}, []interface{}{patch.UpdaterId}\n\tif v := patch.Name; v != nil {\n\t\tset, args = append(set, \"name = ?\"), append(args, *v)\n\t}\n\tif v := patch.PasswordHash; v != nil {\n\t\tset, args = append(set, \"password_hash = ?\"), append(args, *v)\n\t}\n\n\targs = append(args, patch.ID)\n\n\t// Execute update query with RETURNING.\n\trow, err := tx.QueryContext(ctx, `\n\t\tUPDATE principal\n\t\tSET `+strings.Join(set, \", \")+`\n\t\tWHERE id = ?\n\t\tRETURNING id, creator_id, created_ts, updater_id, updated_ts, type, name, email, password_hash\n\t`,\n\t\targs...,\n\t)\n\tif err != nil {\n\t\treturn nil, FormatError(err)\n\t}\n\tdefer row.Close()\n\n\tif row.Next() {\n\t\tvar principal api.Principal\n\t\tif err := row.Scan(\n\t\t\t&principal.ID,\n\t\t\t&principal.CreatorId,\n\t\t\t&principal.CreatedTs,\n\t\t\t&principal.UpdaterId,\n\t\t\t&principal.UpdatedTs,\n\t\t\t&principal.Type,\n\t\t\t&principal.Name,\n\t\t\t&principal.Email,\n\t\t\t&principal.PasswordHash,\n\t\t); err != nil {\n\t\t\treturn nil, FormatError(err)\n\t\t}\n\n\t\treturn &principal, nil\n\t}\n\n\treturn nil, &common.Error{Code: common.NotFound, Err: fmt.Errorf(\"principal ID not found: %d\", patch.ID)}\n}", "func (r *CompaniesService) Patch(name string, company *Company) *CompaniesPatchCall {\n\tc := &CompaniesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.name = name\n\tc.company = company\n\treturn c\n}", "func (m *WindowsFeatureUpdateProfilesWindowsFeatureUpdateProfileItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.WindowsFeatureUpdateProfileable, requestConfiguration *WindowsFeatureUpdateProfilesWindowsFeatureUpdateProfileItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.WindowsFeatureUpdateProfileable, 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.CreateWindowsFeatureUpdateProfileFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.WindowsFeatureUpdateProfileable), nil\n}", "func Patch() int {\n\treturn patch\n}", "func (c *Client) patch(rawURL string, authenticate bool, expectedStatus int, in interface{}, out interface{}) error {\n\terr := c.do(rawURL, \"PATCH\", authenticate, expectedStatus, in, out)\n\treturn errio.Error(err)\n}", "func HelmReposModify(c *gin.Context) {\n\tlog := logger.WithFields(logrus.Fields{\"tag\": \"HelmReposModify\"})\n\tlog.Info(\"modify helm repository\")\n\n\tclusterName, ok := GetCommonClusterNameFromRequest(c)\n\tif ok != true {\n\t\treturn\n\t}\n\n\trepoName := c.Param(\"name\")\n\tlog.Debugln(\"repoName:\", repoName)\n\n\tvar newRepo *repo.Entry\n\terr := c.BindJSON(&newRepo)\n\tif err != nil {\n\t\tlog.Errorf(\"Error parsing request: %s\", err.Error())\n\t\tc.JSON(http.StatusBadRequest, htype.ErrorResponse{\n\t\t\tCode: http.StatusBadRequest,\n\t\t\tMessage: \"error parsing request\",\n\t\t\tError: err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\terrModify := helm.ReposModify(clusterName, repoName, newRepo)\n\tif errModify != nil {\n\t\tif errModify == helm.ErrRepoNotFound {\n\t\t\tc.JSON(http.StatusNotFound, htype.ErrorResponse{\n\t\t\t\tCode: http.StatusNotFound,\n\t\t\t\tError: errModify.Error(),\n\t\t\t\tMessage: \"repo not found\",\n\t\t\t})\n\t\t\treturn\n\n\t\t}\n\t\tlog.Error(\"Error during helm repo modified.\", errModify.Error())\n\t\tc.JSON(http.StatusBadRequest, htype.ErrorResponse{\n\t\t\tCode: http.StatusBadRequest,\n\t\t\tError: errModify.Error(),\n\t\t\tMessage: \"repo modification failed\",\n\t\t})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, htype.StatusResponse{\n\t\tStatus: http.StatusOK,\n\t\tMessage: \"resource modified successfully\",\n\t\tName: repoName})\n\treturn\n}", "func (client JobClient) UpdateResponder(resp *http.Response) (result JobResourceDescription, err error) {\n err = autorest.Respond(\n resp,\n azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated,http.StatusAccepted),\n autorest.ByUnmarshallingJSON(&result),\n autorest.ByClosing())\n result.Response = autorest.Response{Response: resp}\n return\n }", "func Modify(jsonIn []byte) ([]byte, error) {\n\tvar s modify\n\n\tif err := json.Unmarshal(jsonIn, &s); err != nil {\n\t\treturn jsonStatusError(err)\n\t}\n\n\tif err := validateAdmin(s.Name, s.Password); err != nil {\n\t\tlog.Printf(\"Error validating admin status of %s: %s\", s.Name, err)\n\t\treturn jsonStatusError(err)\n\t}\n\n\tif _, ok := passvault.GetRecord(s.ToModify); !ok {\n\t\treturn jsonStatusError(errors.New(\"Record to modify missing\"))\n\t}\n\n\tif s.Name == s.ToModify {\n\t\treturn jsonStatusError(errors.New(\"Cannot modify own record\"))\n\t}\n\n\tvar err error\n\tswitch s.Command {\n\tcase \"delete\":\n\t\terr = passvault.DeleteRecord(s.ToModify)\n\tcase \"revoke\":\n\t\terr = passvault.RevokeRecord(s.ToModify)\n\tcase \"admin\":\n\t\terr = passvault.MakeAdmin(s.ToModify)\n\tdefault:\n\t\treturn jsonStatusError(errors.New(\"Unknown command\"))\n\t}\n\n\tif err != nil {\n\t\treturn jsonStatusError(err)\n\t} else {\n\t\treturn jsonStatusOk()\n\t}\n}", "func patch(newObj runtime.Object, existingObj runtime.Object, c client.Client) error {\n\tnewObjJSON, _ := apijson.Marshal(newObj)\n\tkey, _ := client.ObjectKeyFromObject(newObj)\n\t_, isUnstructured := newObj.(runtime.Unstructured)\n\t_, isCRD := newObj.(*apiextv1beta1.CustomResourceDefinition)\n\n\tif isUnstructured || isCRD || isKudoType(newObj) {\n\t\t// strategic merge patch is not supported for these types, falling back to merge patch\n\t\terr := c.Patch(context.TODO(), newObj, client.ConstantPatch(types.MergePatchType, newObjJSON))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to apply merge patch to object %s/%s: %w\", key.Name, key.Name, err)\n\t\t}\n\t} else {\n\t\terr := c.Patch(context.TODO(), existingObj, client.ConstantPatch(types.StrategicMergePatchType, newObjJSON))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to apply StrategicMergePatch to object %s/%s: %w\", key.Namespace, key.Name, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (w *Worker) Patch(c *http.Client, url string, data interface{}, bind interface{}) (int, error) {\n\tbs, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treq, err := http.NewRequest(\"PATCH\", url, bytes.NewReader(bs))\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tres, err := c.Do(req)\n\tif err != nil {\n\t\tif res != nil {\n\t\t\tioutil.ReadAll(res.Body)\n\t\t\tres.Body.Close()\n\t\t}\n\t\treturn 0, err\n\t}\n\tdefer res.Body.Close()\n\terr = json.NewDecoder(res.Body).Decode(bind)\n\tif res.StatusCode == http.StatusNoContent || bind == nil {\n\t\treturn res.StatusCode, nil\n\t}\n\treturn res.StatusCode, err\n}", "func (s *Server) HandleUpdatePerson(c *gin.Context) {\n\tqueryTeamID := c.Param(\"team-id\")\n\tteamID, err := strconv.ParseInt(queryTeamID, 10, 64)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tqueryPersonID := c.Param(\"person-id\")\n\tpersonID, err := strconv.ParseInt(queryPersonID, 10, 64)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\texists, err := s.teamExists(c.Request.Context(), teamID)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\tif !exists {\n\t\tc.AbortWithStatusJSON(http.StatusNotFound, gin.H{\"error\": \"Team not found.\"})\n\t\treturn\n\t}\n\n\tbinding := struct {\n\t\tFirstName string `json:\"first_name\"`\n\t\tLastName string `json:\"last_name\"`\n\t\tEmail string `json:\"email\"`\n\t\tTeamID int64 `json:\"team_id\"`\n\t}{}\n\terr = c.BindJSON(&binding)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\t// Check if the person exists in the specified team\n\tgetPersonArgs := db.GetPersonParams{\n\t\tID: personID,\n\t\tTeamID: teamID,\n\t}\n\tperson, err := s.peopleService.GetPerson(c.Request.Context(), getPersonArgs)\n\tif err != nil {\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\tc.AbortWithStatusJSON(http.StatusNotFound, gin.H{\n\t\t\t\t\"error\": \"Person not found in the specified team.\",\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tupdatePersonArgs := db.UpdatePersonParams{\n\t\tFirstName: binding.FirstName,\n\t\tLastName: binding.LastName,\n\t\tEmail: binding.Email,\n\t\tTeamID: binding.TeamID,\n\t\tID: personID,\n\t}\n\n\tperson, err = s.peopleService.UpdatePerson(c.Request.Context(), updatePersonArgs)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"data\": person})\n}", "func WrapUpdateMe(h Handler, w http.ResponseWriter, r *http.Request) {\n\tvar aUpdateUser Profile\n\n\tif r.Body == nil {\n\t\thttp.Error(w, \"Parameter 'update_user' expected in body, but got no body\", http.StatusBadRequest)\n\t\treturn\n\t}\n\t{\n\t\tvar err error\n\t\tr.Body = http.MaxBytesReader(w, r.Body, 1024*1024)\n\t\tbody, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Body unreadable: \"+err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\terr = ValidateAgainstProfileSchema(body)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Failed to validate against schema: \"+err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\terr = json.Unmarshal(body, &aUpdateUser)\n\t\tif err != nil {\n\t\t\thttp.Error(w, \"Error JSON-decoding body parameter 'update_user': \"+err.Error(),\n\t\t\t\thttp.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t}\n\n\th.UpdateMe(w,\n\t\tr,\n\t\taUpdateUser)\n}", "func (m *VirtualEndpointUserSettingsCloudPcUserSettingItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CloudPcUserSettingable, requestConfiguration *VirtualEndpointUserSettingsCloudPcUserSettingItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CloudPcUserSettingable, 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.CreateCloudPcUserSettingFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CloudPcUserSettingable), nil\n}", "func (m *TeamTemplatesItemDefinitionsItemTeamDefinitionPhotoRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ProfilePhotoable, requestConfiguration *TeamTemplatesItemDefinitionsItemTeamDefinitionPhotoRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ProfilePhotoable, 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.CreateProfilePhotoFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ProfilePhotoable), nil\n}", "func HandleModify(w http.ResponseWriter, r *http.Request) {\r\n\tdefer r.Body.Close()\r\n\tfmt.Println(\"In handleModify\")\r\n\tvar ab AddressBook\r\n\tif r.Method != http.MethodPost {\r\n\t\terr := fmt.Sprintf(\"Method %s not supported on this action %s\\n\", r.Method, r.URL.Path)\r\n\t\tfmt.Printf(\"%s\", err)\r\n\t\thttp.Error(w, err, http.StatusMethodNotAllowed)\r\n\t\treturn\r\n\t}\r\n\r\n\tif err := json.NewDecoder(r.Body).Decode(&ab); err != nil {\r\n\t\tmsg := fmt.Sprintf(\"Error %s while decoding json\\n\", err.Error())\r\n\t\tfmt.Printf(\"%s\", msg)\r\n\t\thttp.Error(w, msg, http.StatusBadRequest)\r\n\t\treturn\r\n\t}\r\n\r\n\tif ab.FirstName == \"\" {\r\n\t\tmsg := \"Name not provided as part of the query\\n\"\r\n\t\tfmt.Printf(\"%s\", msg)\r\n\t\thttp.Error(w, msg, http.StatusNotFound)\r\n\t\treturn\r\n\t}\r\n\r\n\tMutex.RLock()\r\n\tdefer Mutex.RUnlock()\r\n\tif len(AddrBook) == 0 {\r\n\t\tmsg := fmt.Sprintf(\"Address book is empty nothing to modify\\n\")\r\n\t\tfmt.Printf(\"%s\\n\", msg)\r\n\t\thttp.Error(w, msg, http.StatusNotFound)\r\n\t\treturn\r\n\t}\r\n\r\n\tif abTmp, ok := AddrBook[ab.FirstName]; !ok {\r\n\t\tmsg := fmt.Sprintf(\"%s not found in the Address book, nothing to modify\\n\", abTmp.FirstName)\r\n\t\tfmt.Printf(\"%s\", msg)\r\n\t\thttp.Error(w, msg, http.StatusNotFound)\r\n\t\treturn\r\n\t}\r\n\tabTmp, _ := AddrBook[ab.FirstName]\r\n\tif ab.LastName != \"\" && abTmp.LastName != ab.LastName {\r\n\t\tabTmp.LastName = ab.LastName\r\n\t}\r\n\tif ab.Email != \"\" && abTmp.Email != ab.Email {\r\n\t\tabTmp.Email = ab.Email\r\n\t}\r\n\tif ab.PhoneNumber != 0 && abTmp.PhoneNumber != ab.PhoneNumber {\r\n\t\tabTmp.PhoneNumber = ab.PhoneNumber\r\n\t}\r\n\tAddrBook[ab.FirstName] = abTmp\r\n\tmsg := fmt.Sprintf(\"Modified name %s present in the address book\\n\", ab.FirstName)\r\n\tfmt.Printf(\"%s\", msg)\r\n\thttp.Error(w, msg, http.StatusOK)\r\n}", "func (t *SimpleChaincode) pat_invoke(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tfmt.Println(\"########### Patient invoke ###########\")\n\n\tif len(args) < 2 {\n\t\treturn shim.Error(\"The number of arguments is insufficient.\")\n\t}\n\n\t// Changing details of Patient by Accepting Key and Value\n\n\tif args[1] == \"changePat\" && len(args) == 4 {\n\n\t\tpatAsBytes, _ := stub.GetState(args[2])\n\t\tpat := Pat{}\n\n\t\tjson.Unmarshal(patAsBytes, &pat)\n\t\tpat.Owner = args[3]\n\n\t\tpatAsBytes, _ = json.Marshal(pat)\n\t\tstub.PutState(args[2], patAsBytes)\n\n\t\t// Notify listeners that an event \"eventInvoke\" have been executed (check line 19 in the file invoke.go)\n\n\t\terr := stub.SetEvent(\"eventChangePat\", []byte{})\n\t\tif err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\n\t\treturn shim.Success(nil)\n\t}\n\n\n\t //Updating all fields of record\n\n\tif args[1] == \"updateRecord\" && len(args) == 4 {\n\t\tfmt.Println(\"Update All\")\n\t\tvar newPat Pat\n\t\tjson.Unmarshal([]byte(args[3]), &newPat)\n\t\tvar pat = Pat{Name: newPat.Name, Id: newPat.Id, Quality: newPat.Quality, Owner: newPat.Owner}\n\t\tpatAsBytes, _ := json.Marshal(pat)\n\n\t\t// Updating Record\n\n\t\tstub.PutState(args[2], patAsBytes)\n\n\t\t// Notify listeners that an event \"eventInvoke\" have been executed (check line 19 in the file invoke.go)\n\n\t\terr := stub.SetEvent(\"eventUpdateRecords\", []byte{})\n\t\tif err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\n\t\treturn shim.Success(nil)\n\t}\n\n\t// If the arguments given don’t match any function, we return an error\n\n\treturn shim.Error(\"Unknown invoke action, check the second argument.\")\n}", "func (client ModelClient) UpdateHierarchicalEntityResponder(resp *http.Response) (result OperationStatus, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func (client ApplicationsClient) PatchResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "func (ctl Controller) Patch(ctx *gin.Context) {\n\n\tMethodNotAllowedJSON(ctx)\n}", "func (t *IPDCChaincode) invoke_update_status(stub shim.ChaincodeStubInterface, args []string, map_specification map[string]interface{}) pb.Response {\r\n\r\n\tfmt.Println(\"***********Entering invoke_update_status***********\")\r\n\r\n\tif len(args) < 2 {\r\n\r\n\t\tfmt.Println(\"Error: Incorrect number of arguments\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\t\treturn shim.Error(\"Error: Incorrect number of arguments\")\r\n\t}\r\n\r\n\tvar record_specification map[string]interface{}\r\n\r\n\tvar err error\r\n\r\n\terr = json.Unmarshal([]byte(args[0]), &record_specification)\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error in format of record.\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\t\treturn shim.Error(\"Error in format of record.\")\r\n\t}\r\n\r\n\tadditional_json, ok := map_specification[\"additional_json\"]\r\n\r\n\tif ok {\r\n\r\n\t\tadditional_json_data, ok1 := additional_json.(map[string]interface{})\r\n\r\n\t\tif ok1 {\r\n\r\n\t\t\tfor spec, _ := range additional_json_data {\r\n\r\n\t\t\t\trecord_specification[spec] = additional_json_data[spec]\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tfmt.Println(\"Invalid additional JSON fields in specification\")\r\n\r\n\t\t\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\t\t\treturn shim.Error(\"Invalid additional JSON fields in specification\")\r\n\t\t}\r\n\t}\r\n\r\n\tvar keys_map interface{}\r\n\r\n\tvar specs map[string]interface{}\r\n\r\n\tkeys_map, error_keys_map := t.get_keys_map(stub, record_specification)\r\n\r\n\tif error_keys_map != nil {\r\n\r\n\t\tfmt.Println(error_keys_map.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\t\treturn shim.Error(error_keys_map.Error())\r\n\t}\r\n\r\n\tspecs, ok = keys_map.(map[string]interface{})\r\n\r\n\tif !ok {\r\n\r\n\t\tfmt.Println(\"Invalid keys_map specification.\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\t\treturn shim.Error(\"Invalid keys_map specification.\")\r\n\t}\r\n\r\n\tif specs[\"primary_key\"] == nil {\r\n\r\n\t\tfmt.Println(\"There is no primary key specification.\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\t\treturn shim.Error(\"Error : There is no primary key specification.\")\r\n\t}\r\n\r\n\tvar pk_spec []interface{}\r\n\r\n\tpk_spec, ok = specs[\"primary_key\"].([]interface{})\r\n\r\n\tif !ok {\r\n\r\n\t\tfmt.Println(\"Error in Primary key specification.\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\t\treturn shim.Error(\"Error in Primary key specification.\")\r\n\t}\r\n\r\n\tkey, err_key := t.createInterfacePrimaryKey(record_specification, pk_spec)\r\n\r\n\tif err_key != nil {\r\n\r\n\t\tfmt.Println(err_key.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\t\treturn shim.Error(err_key.Error())\r\n\r\n\t}\r\n\r\n\tvar valAsBytes []byte\r\n\r\n\tvalAsBytes, err = stub.GetState(key)\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error: Failed to get state for primary key. \" + err.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\t\treturn shim.Error(\"Error: Failed to get state for primary key. \" + err.Error())\r\n\r\n\t} else if valAsBytes == nil {\r\n\r\n\t\tfmt.Println(\"Error: No value for key : \" + key)\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\t\treturn shim.Error(\"Error: No value for primary key.\")\r\n\r\n\t}\r\n\r\n\terr = json.Unmarshal([]byte(valAsBytes), &record_specification)\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error in format of Blockchain record\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\t\treturn shim.Error(\"Error in format of Blockchain record\")\r\n\r\n\t}\r\n\r\n\terr_del := t.delete_composite_keys(stub, specs, record_specification, key)\r\n\r\n\tif err_del != nil {\r\n\r\n\t\tfmt.Println(\"Error while deleting composite keys: \" + err_del.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\t\treturn shim.Error(\"Error while deleting composite keys: \" + err_del.Error())\r\n\r\n\t}\r\n\r\n\tvar to_be_updated_map map[string]interface{}\r\n\r\n\terr = json.Unmarshal([]byte(args[1]), &to_be_updated_map)\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error in format of update map\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\t\treturn shim.Error(\"Error in format of update map\")\r\n\r\n\t}\r\n\r\n\tfor spec, spec_val := range to_be_updated_map {\r\n\r\n\t\tvar spec_val_string, spec_ok = spec_val.(string)\r\n\r\n\t\tif !spec_ok {\r\n\r\n\t\t\tfmt.Println(\"Unable to parse value of status update\")\r\n\r\n\t\t\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\t\t\treturn shim.Error(\"Unable to parse value of status update\")\r\n\r\n\t\t}\r\n\r\n\t\tvar val_check, val_err = t.updatestatusvaliditycheck(spec, spec_val_string, map_specification)\r\n\r\n\t\tif val_check != 0 {\r\n\r\n\t\t\tfmt.Println(val_err.Error())\r\n\r\n\t\t\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\t\t\treturn shim.Error(val_err.Error())\r\n\t\t}\r\n\r\n\t\trecord_specification[spec] = spec_val_string\r\n\t}\r\n\r\n\tvar concatenated_record_json []byte\r\n\r\n\tconcatenated_record_json, err = json.Marshal(record_specification)\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error: Unable to Marshal Concatenated Record to JSON \" + err.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\t\treturn shim.Error(\"Error: Unable to Marshal Concatenated Record to JSON \" + err.Error())\r\n\t}\r\n\r\n\terr = stub.PutState(key, []byte(concatenated_record_json))\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Failed to put state : \" + err.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\t\treturn shim.Error(\"Failed to put state : \" + err.Error())\r\n\t}\r\n\r\n\terr = t.create_composite_keys(stub, specs, record_specification, key)\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Received error while creating composite keys\" + err.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\t\treturn shim.Error(\"Received error while creating composite keys\" + err.Error())\r\n\t}\r\n\r\n\tfmt.Println(\"***********Exiting invoke_update_status***********\")\r\n\r\n\treturn shim.Success(nil)\r\n\r\n}", "func (m *RiskyUsersItemHistoryRiskyUserHistoryItemItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RiskyUserHistoryItemable, requestConfiguration *RiskyUsersItemHistoryRiskyUserHistoryItemItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RiskyUserHistoryItemable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateRiskyUserHistoryItemFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RiskyUserHistoryItemable), nil\n}", "func TestPatchUserService (t *testing.T){\n\terr := PatchUserService(user_01.SocialNumber, mongoDB.User{Name:new_name_user_01})\n\tassert.Equal(t, 200, err.HTTPStatus)\n}", "func (client HTTPSuccessClient) Patch200(booleanValue *bool) (result autorest.Response, err error) {\n req, err := client.Patch200Preparer(booleanValue)\n if err != nil {\n return result, autorest.NewErrorWithError(err, \"httpinfrastructuregroup.HTTPSuccessClient\", \"Patch200\", nil , \"Failure preparing request\")\n }\n\n resp, err := client.Patch200Sender(req)\n if err != nil {\n result.Response = resp\n return result, autorest.NewErrorWithError(err, \"httpinfrastructuregroup.HTTPSuccessClient\", \"Patch200\", resp, \"Failure sending request\")\n }\n\n result, err = client.Patch200Responder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"httpinfrastructuregroup.HTTPSuccessClient\", \"Patch200\", resp, \"Failure responding to request\")\n }\n\n return\n}", "func (s *Service) UpdatePersonInformation(c context.Context, personID ulid.ULID, newInfo *Person) (*Person, error) {\n\treturn &Person{}, nil\n}", "func (a *HyperflexApiService) PatchHyperflexClusterProfileExecute(r ApiPatchHyperflexClusterProfileRequest) (*HyperflexClusterProfile, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodPatch\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *HyperflexClusterProfile\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"HyperflexApiService.PatchHyperflexClusterProfile\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/hyperflex/ClusterProfiles/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\tif r.hyperflexClusterProfile == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"hyperflexClusterProfile is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\", \"application/json-patch+json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.ifMatch != nil {\n\t\tlocalVarHeaderParams[\"If-Match\"] = parameterToString(*r.ifMatch, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = r.hyperflexClusterProfile\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func DefaultPatchProfile(ctx context.Context, in *Profile, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*Profile, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj Profile\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(ProfileWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadProfile(ctx, &Profile{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(ProfileWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskProfile(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(ProfileWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateProfile(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(ProfileWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func UpdateConfession(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"user updated\")\n}", "func (h *Handler) updateDeveloperAttributes(c *gin.Context) handlerResponse {\n\n\tvar receivedAttributes struct {\n\t\tAttributes types.Attributes `json:\"attribute\"`\n\t}\n\tif err := c.ShouldBindJSON(&receivedAttributes); err != nil {\n\t\treturn handleBadRequest(err)\n\t}\n\tif err := h.service.Developer.UpdateAttributes(c.Param(developerParameter),\n\t\treceivedAttributes.Attributes, h.who(c)); err != nil {\n\t\treturn handleError(err)\n\t}\n\treturn handleOKAttributes(receivedAttributes.Attributes)\n}", "func (m *EntitlementManagementRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RbacApplicationable, requestConfiguration *EntitlementManagementRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RbacApplicationable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateRbacApplicationFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RbacApplicationable), nil\n}", "func (m *OnlineMeetingsItemRegistrationCustomQuestionsMeetingRegistrationQuestionItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.MeetingRegistrationQuestionable, requestConfiguration *OnlineMeetingsItemRegistrationCustomQuestionsMeetingRegistrationQuestionItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.MeetingRegistrationQuestionable, 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.CreateMeetingRegistrationQuestionFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.MeetingRegistrationQuestionable), nil\n}", "func updateHandler(w http.ResponseWriter, r *http.Request) {\n\t////\n\t// handle only pull request\n\t//\n\tif r.Header.Get(\"X-Github-Event\") != \"pull_request\" {\n\t\treturn\n\t}\n\n\tvar pr pullRequestModel\n\tif err := json.NewDecoder(r.Body).Decode(&pr); err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tif pr.Action != \"opened\" {\n\t\treturn\n\t}\n\n\t//\n\t////\n\n\t////\n\t// check if the pr just opened has step.yml in it\n\t//\n\texists, err := isPRHasStepYML(fmt.Sprintf(\"%d\", pr.Number))\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tif !exists {\n\t\treturn\n\t}\n\n\t//\n\t////\n\tif strings.Contains(pr.PullRequest.Body, fmt.Sprintf(\"https://%s/tag?pr=%d\", hostBaseURL, pr.Number)) {\n\t\treturn\n\t}\n\n\t////\n\t// updating the PR's initial comment section: append badge as first element\n\t//\n\n\tapiURL := fmt.Sprintf(\"https://api.github.com/repos/bitrise-io/bitrise-steplib/pulls/%d\", pr.Number)\n\tbadgeContent := fmt.Sprintf(\"![TagCheck](https://%s/tag?pr=%d)\\r\\n\\r\\n\", hostBaseURL, pr.Number)\n\tnewBody := map[string]interface{}{\n\t\t\"body\": badgeContent + pr.PullRequest.Body,\n\t}\n\n\t// convert new body message to json\n\tb, err := json.Marshal(newBody)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\t// call authenticated PATCH request\n\tc := http.Client{}\n\treq, err := http.NewRequest(\"PATCH\", apiURL, bytes.NewReader(b))\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\treq.SetBasicAuth(os.Getenv(\"GITHUB_USER\"), os.Getenv(\"GITHUB_ACCESS_TOKEN\"))\n\t_, err = c.Do(req)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\t//\n\t////\n}", "func (m *TeamTemplatesItemDefinitionsItemTeamDefinitionPermissionGrantsResourceSpecificPermissionGrantItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ResourceSpecificPermissionGrantable, requestConfiguration *TeamTemplatesItemDefinitionsItemTeamDefinitionPermissionGrantsResourceSpecificPermissionGrantItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ResourceSpecificPermissionGrantable, 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.CreateResourceSpecificPermissionGrantFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ResourceSpecificPermissionGrantable), nil\n}", "func patchAPIUserHandler(w http.ResponseWriter, r *http.Request, _ map[string]string) {\n\tuserName := sessionHandler.GetUserName(r)\n\tuserID, err := getUserID(userName)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdecoder := json.NewDecoder(r.Body)\n\tvar json JSONUser\n\terr = decoder.Decode(&json)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\t// Make sure user id is over 0\n\tif json.ID < 1 {\n\t\thttp.Error(w, \"Wrong user id.\", http.StatusInternalServerError)\n\t\treturn\n\t} else if userID != json.ID { // Make sure the authenticated user is only changing his/her own data. TODO: Make sure the user is admin when multiple users have been introduced\n\t\thttp.Error(w, \"You don't have permission to change this data.\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\t// Get old user data to compare\n\ttempUser, err := database.RetrieveUser(json.ID)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\t// Make sure user email is provided\n\tif json.Email == \"\" {\n\t\tjson.Email = string(tempUser.Email)\n\t}\n\t// Make sure user name is provided\n\tif json.Name == \"\" {\n\t\tjson.Name = string(tempUser.Name)\n\t}\n\t// Make sure user slug is provided\n\tif json.Slug == \"\" {\n\t\tjson.Slug = tempUser.Slug\n\t}\n\t// Check if new name is already taken\n\tif json.Name != string(tempUser.Name) {\n\t\t_, err = database.RetrieveUserByName([]byte(json.Name))\n\t\tif err == nil {\n\t\t\t// The new user name is already taken. Assign the old name.\n\t\t\t// TODO: Return error that will be displayed in the admin interface.\n\t\t\tjson.Name = string(tempUser.Name)\n\t\t}\n\t}\n\t// Check if new slug is already taken\n\tif json.Slug != tempUser.Slug {\n\t\t_, err = database.RetrieveUserBySlug(json.Slug)\n\t\tif err == nil {\n\t\t\t// The new user slug is already taken. Assign the old slug.\n\t\t\t// TODO: Return error that will be displayed in the admin interface.\n\t\t\tjson.Slug = tempUser.Slug\n\t\t}\n\t}\n\tuser := structure.User{ID: json.ID, Name: []byte(json.Name), Slug: json.Slug, Email: []byte(json.Email), Image: []byte(json.Image), Cover: []byte(json.Cover), Bio: []byte(json.Bio), Website: []byte(json.Website), Location: []byte(json.Location)}\n\terr = methods.UpdateUser(&user, userID)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif json.Password != \"\" && (json.Password == json.PasswordRepeated) { // Update password if a new one was submitted\n\t\tencryptedPassword, err := authentication.EncryptPassword(json.Password)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\terr = database.UpdateUserPassword(user.ID, encryptedPassword, date.GetCurrentTime(), json.ID)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n\t// Check if the user name was changed. If so, update the session cookie to the new user name.\n\tif json.Name != string(tempUser.Name) {\n\t\tlogInUser(json.Name, w)\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(\"User settings updated!\"))\n\treturn\n}", "func PatchMethod(e *echo.Group, newFn newInstanceFn, pFn patchFn) {\n\te.PATCH(\"/:id\", func(c echo.Context) error {\n\t\tvar id int\n\n\t\tif err := Param(\"id\").InPath().Int(c, &id); err != nil {\n\t\t\treturn BadRequest(err)\n\t\t}\n\t\tresource := newFn()\n\t\tif err := c.Bind(resource); err != nil {\n\t\t\treturn BadRequest(err)\n\t\t}\n\n\t\tif err := pFn(resource); err != nil {\n\t\t\treturn InternalServerError(err)\n\t\t}\n\n\t\treturn c.NoContent(http.StatusNoContent)\n\t})\n\n}", "func UpdatePerson(c *gin.Context) {\n\tvar person models.Person\n\tvar address models.Address\n\terr := c.ShouldBindJSON(&person)\n\t// if person does not exist, return error\n\tpersonAux, errAux := models.LoadPersonByID(fmt.Sprint(person.ID))\n\n\tif personAux.ID == 0 || personAux.IsDel == 1 {\n\t\tc.JSON(400, gin.H{\n\t\t\t\"error\": \"cant update person who does not exist\",\n\t\t})\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\tc.JSON(400, gin.H{\n\t\t\t\"error\": \"cannot bind JSON: \" + err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tperson, err = models.UpdatePerson(person, address)\n\tif err != nil && errAux != nil {\n\t\tc.JSON(400, gin.H{\n\t\t\t\"error\": \"cannot bind update: \" + err.Error(),\n\t\t})\n\t\treturn\n\t}\n\tc.JSON(200, person)\n}", "func (a *HyperflexApiService) PatchHyperflexSoftwareDistributionEntry(ctx context.Context, moid string) ApiPatchHyperflexSoftwareDistributionEntryRequest {\n\treturn ApiPatchHyperflexSoftwareDistributionEntryRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func (m *ReportsRequestBuilder) Patch(ctx context.Context, body i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.Reportsable, requestConfiguration *ReportsRequestBuilderPatchRequestConfiguration)(i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.Reportsable, 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, i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.CreateReportsFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.Reportsable), nil\n}", "func (m *TermStoreRequestBuilder) Patch(ctx context.Context, body ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.Storeable, requestConfiguration *TermStoreRequestBuilderPatchRequestConfiguration)(ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.Storeable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.CreateStoreFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.Storeable), nil\n}", "func (client HTTPSuccessClient) Patch202(booleanValue *bool) (result autorest.Response, err error) {\n req, err := client.Patch202Preparer(booleanValue)\n if err != nil {\n return result, autorest.NewErrorWithError(err, \"httpinfrastructuregroup.HTTPSuccessClient\", \"Patch202\", nil , \"Failure preparing request\")\n }\n\n resp, err := client.Patch202Sender(req)\n if err != nil {\n result.Response = resp\n return result, autorest.NewErrorWithError(err, \"httpinfrastructuregroup.HTTPSuccessClient\", \"Patch202\", resp, \"Failure sending request\")\n }\n\n result, err = client.Patch202Responder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"httpinfrastructuregroup.HTTPSuccessClient\", \"Patch202\", resp, \"Failure responding to request\")\n }\n\n return\n}" ]
[ "0.6955901", "0.6920714", "0.67520493", "0.6015795", "0.5904203", "0.58468133", "0.57761717", "0.54057676", "0.5382812", "0.5315544", "0.53136206", "0.52500725", "0.52303386", "0.52146894", "0.52062315", "0.5170349", "0.51479495", "0.5147029", "0.5141474", "0.5135123", "0.5125511", "0.5101121", "0.5083942", "0.50726545", "0.5071128", "0.5069812", "0.5028236", "0.5021061", "0.5008922", "0.50086683", "0.49922538", "0.4952382", "0.49497375", "0.49471214", "0.49394295", "0.49302003", "0.4927359", "0.49163014", "0.4908727", "0.49025458", "0.4899358", "0.48945987", "0.4876046", "0.48607317", "0.48504463", "0.4836716", "0.48353332", "0.48252985", "0.481998", "0.4809417", "0.4804645", "0.4800944", "0.4797264", "0.4792788", "0.4792489", "0.47860497", "0.478159", "0.47810772", "0.47760323", "0.47752503", "0.47674626", "0.4754302", "0.47509095", "0.47458446", "0.4716117", "0.47151", "0.4713531", "0.47055367", "0.46995384", "0.469039", "0.4684577", "0.46818817", "0.46809295", "0.46798444", "0.46700087", "0.46693328", "0.46646535", "0.466007", "0.46519968", "0.46488938", "0.46465868", "0.4643667", "0.46427062", "0.46426105", "0.4639943", "0.46376058", "0.46366644", "0.46347108", "0.46333006", "0.4631847", "0.46289334", "0.4620733", "0.46137637", "0.46098557", "0.4608375", "0.46075356", "0.46068078", "0.46022654", "0.4601006", "0.45931968" ]
0.7722697
0
DefaultPatchSetHealthMenstruationPersonalInfo executes a bulk gorm update call with patch behavior
DefaultPatchSetHealthMenstruationPersonalInfo выполняет bulk gorm update вызов с поведением patch
func DefaultPatchSetHealthMenstruationPersonalInfo(ctx context.Context, objects []*HealthMenstruationPersonalInfo, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*HealthMenstruationPersonalInfo, error) { if len(objects) != len(updateMasks) { return nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects)) } results := make([]*HealthMenstruationPersonalInfo, 0, len(objects)) for i, patcher := range objects { pbResponse, err := DefaultPatchHealthMenstruationPersonalInfo(ctx, patcher, updateMasks[i], db) if err != nil { return nil, err } results = append(results, pbResponse) } return results, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DefaultPatchHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj HealthMenstruationPersonalInfo\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadHealthMenstruationPersonalInfo(ctx, &HealthMenstruationPersonalInfo{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskHealthMenstruationPersonalInfo(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(HealthMenstruationPersonalInfoWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateHealthMenstruationPersonalInfo\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &HealthMenstruationPersonalInfoORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func DefaultApplyFieldMaskHealthMenstruationPersonalInfo(ctx context.Context, patchee *HealthMenstruationPersonalInfo, patcher *HealthMenstruationPersonalInfo, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"ProfileId\" {\n\t\t\tpatchee.ProfileId = patcher.ProfileId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"PeriodLengthInDays\" {\n\t\t\tpatchee.PeriodLengthInDays = patcher.PeriodLengthInDays\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CycleLengthInDays\" {\n\t\t\tpatchee.CycleLengthInDays = patcher.CycleLengthInDays\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func DefaultListHealthMenstruationPersonalInfo(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*HealthMenstruationPersonalInfo, error) {\n\tin := HealthMenstruationPersonalInfo{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm2.ApplyCollectionOperators(ctx, db, &HealthMenstruationPersonalInfoORM{}, &HealthMenstruationPersonalInfo{}, f, s, p, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []HealthMenstruationPersonalInfoORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*HealthMenstruationPersonalInfo{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func DefaultReadHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, 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 == 0 {\n\t\treturn nil, errors1.EmptyIdError\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeReadApplyQuery); ok {\n\t\tif db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &HealthMenstruationPersonalInfoORM{}); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeReadFind); ok {\n\t\tif db, err = hook.BeforeReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tormResponse := HealthMenstruationPersonalInfoORM{}\n\tif err = db.Where(&ormObj).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormResponse).(HealthMenstruationPersonalInfoORMWithAfterReadFind); ok {\n\t\tif err = hook.AfterReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultCreateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, 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 hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeCreate_); ok {\n\t\tif db, err = hook.BeforeCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterCreate_); ok {\n\t\tif err = hook.AfterCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultPatchHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj HealthMenstruationDailyEntry\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadHealthMenstruationDailyEntry(ctx, &HealthMenstruationDailyEntry{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskHealthMenstruationDailyEntry(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateHealthMenstruationDailyEntry(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(HealthMenstruationDailyEntryWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func DefaultPatchSetHealthMenstruationDailyEntry(ctx context.Context, objects []*HealthMenstruationDailyEntry, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*HealthMenstruationDailyEntry, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*HealthMenstruationDailyEntry, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchHealthMenstruationDailyEntry(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func (t *HeathCare_Chaincode) modifyMedicalData(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tfmt.Println(\"\\n=============== start modifyMedicalData function ===============\")\n\tstart := time.Now()\n\ttime.Sleep(time.Second)\n\n\tvar jsonResp string\n\n\tif len(args) != 8 {\n\t\treturn shim.Error(\"expecting 4 argument\")\n\t}\n\n\t//define identity of query-er and new value of medical record\n\tuserid := args[0]\n\tpatientid := args[1]\n\tlocation := args[2]\n\tcollection := args[3]\n\n\tnewPersonalIdentificationInformation := args[4]\n\tnewMedicalHistory := args[5]\n\tnewFamilyMedicalHistory := args[6]\n\tnewMedicationHistory := args[7]\n\tnewTreatmentHistory := args[8]\n\tnewMedicalDirectives := args[9]\n\ttimeQuery := time.Now().String()\n\n\t//get user identity before query\n\tuserIdentityAsBytes, errUserIdentityAsByte := stub.GetPrivateData(collection, userid)\n\tif errUserIdentityAsByte != nil {\n\t\treturn shim.Error(\"cannot get user identity\")\n\t} else if userIdentityAsBytes == nil {\n\t\treturn shim.Error(\"user does not exist\")\n\t}\n\n\t//create query object with purpose: modify\n\tobjectType := \"Query\"\n\tquery := &Query{objectType, userid, patientid, location, timeQuery, \"modify\"}\n\tqueryAsByte, errQueryAsByte := json.Marshal(query)\n\tif errQueryAsByte != nil {\n\t\treturn shim.Error(errQueryAsByte.Error())\n\t}\n\n\t//save to database\n\terrQueryAsByte = stub.PutPrivateData(\"modifyCollection\", userid, queryAsByte)\n\tif errQueryAsByte != nil {\n\t\treturn shim.Error(errQueryAsByte.Error())\n\t}\n\n\t//create index key\n\tindexName := \"userid~patientid\"\n\tqueryIndexKey, errQueryIndexKey := stub.CreateCompositeKey(indexName, []string{query.UserID, query.PatientID, query.Location, query.Purpose})\n\tif errQueryIndexKey != nil {\n\t\treturn shim.Error(errQueryIndexKey.Error())\n\t}\n\n\t//save index\n\tvalue := []byte{0x00}\n\tstub.PutPrivateData(\"modifyCollection\", queryIndexKey, value)\n\n\t//get medical record data\n\tmedicalRecordAsBytes, errMedicalRecordAsByte := stub.GetPrivateData(\"MedicalRecordCollection\", patientid)\n\tif errMedicalRecordAsByte != nil {\n\t\tjsonResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + patientid + \": \" + errMedicalRecordAsByte.Error() + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t} else if errMedicalRecordAsByte == nil {\n\t\treturn shim.Error(\"patient's data does not exist\")\n\t}\n\n\t//convert data of patient to json\n\tmedicalRecord := &MedicalRecord{}\n\terrMedicalRecordAsByte = json.Unmarshal(medicalRecordAsBytes, medicalRecord)\n\n\t//change data\n\tmedicalRecord.PersonalIdentificationInformation = newPersonalIdentificationInformation\n\tmedicalRecord.MedicalHistory = newMedicalHistory\n\tmedicalRecord.FamilyMedicalHistory = newFamilyMedicalHistory\n\tmedicalRecord.MedicationHistory = newMedicationHistory\n\tmedicalRecord.TreatmentHistory = newTreatmentHistory\n\tmedicalRecord.MedicalDirectives = newMedicalDirectives\n\n\t//convert new medical record data to byte\n\tnewMedicalRecordAsByte, errNewMedicalRecordAsByte := json.Marshal(medicalRecord)\n\n\t//store new data\n\terrNewMedicalRecordAsByte = stub.PutPrivateData(\"MedicalRecordCollection\", patientid, newMedicalRecordAsByte)\n\tif errNewMedicalRecordAsByte != nil {\n\t\treturn shim.Error(\"cannot save new medical record's data\")\n\t}\n\n\tend := time.Now()\n\telapsed := time.Since(start)\n\tfmt.Println(\"function modifyMedicalData\")\n\tfmt.Println(\"time start: \", start.String())\n\tfmt.Println(\"time end: \", end.String())\n\tfmt.Println(\"time execute: \", elapsed.String())\n\tfmt.Println(\"=============== end modifyMedicalData function ===============\")\n\n\treturn shim.Success(nil)\n}", "func DefaultApplyFieldMaskHealthMenstruationDailyEntry(ctx context.Context, patchee *HealthMenstruationDailyEntry, patcher *HealthMenstruationDailyEntry, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"ProfileId\" {\n\t\t\tpatchee.ProfileId = patcher.ProfileId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Day\" {\n\t\t\tpatchee.Day = patcher.Day\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"IntensityPercentage\" {\n\t\t\tpatchee.IntensityPercentage = patcher.IntensityPercentage\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Type\" {\n\t\t\tpatchee.Type = patcher.Type\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Manual\" {\n\t\t\tpatchee.Manual = patcher.Manual\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"BasedOnPrediction\" {\n\t\t\tpatchee.BasedOnPrediction = patcher.BasedOnPrediction\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func (m *CompaniesItemCompanyInformationCompanyInformationItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CompanyInformationable, requestConfiguration *CompaniesItemCompanyInformationCompanyInformationItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CompanyInformationable, 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.CreateCompanyInformationFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CompanyInformationable), nil\n}", "func DefaultStrictUpdateHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateHealthMenstruationDailyEntry\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &HealthMenstruationDailyEntryORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func (service *EmployeeService) PatchEmployeeDetails(employeeID string, employeeDetails models.Employee) error {\n\tcollection := service.mongoClient.Database(DbName).Collection(CollectionName)\n\tupdatesToBePerformed := bson.M{}\n\tupdatesToBePerformed[\"employeeid\"] = employeeID\n\tif employeeDetails.Department != nil {\n\t\tupdatesToBePerformed[\"department\"] = employeeDetails.Department\n\t}\n\n\tif employeeDetails.Name != nil {\n\t\tupdatesToBePerformed[\"name\"] = employeeDetails.Name\n\t}\n\n\tif employeeDetails.Skills != nil {\n\t\tupdatesToBePerformed[\"skills\"] = employeeDetails.Skills\n\t}\n\n\tif employeeDetails.Address != nil {\n\t\taddress := models.Address{}\n\t\tif employeeDetails.Address.City != nil {\n\t\t\taddress.City = employeeDetails.Address.City\n\t\t}\n\n\t\tif employeeDetails.Address.Country != nil {\n\t\t\taddress.Country = employeeDetails.Address.Country\n\t\t}\n\n\t\tif employeeDetails.Address.DoorNo != nil {\n\t\t\taddress.DoorNo = employeeDetails.Address.DoorNo\n\t\t}\n\n\t\tif employeeDetails.Address.State != nil {\n\t\t\taddress.State = employeeDetails.Address.State\n\t\t}\n\n\t\tupdatesToBePerformed[\"address\"] = address\n\t}\n\n\tif employeeDetails.Status != nil {\n\t\tupdatesToBePerformed[\"status\"] = employeeDetails.Status\n\t}\n\n\t// consolidatedMap(&updatesToBePerformed, employeeDetails)\n\n\tresult, err := collection.UpdateOne(\n\t\tcontext.Background(),\n\t\tbson.M{\"employeeid\": employeeID},\n\t\tbson.M{\n\t\t\t\"$set\": updatesToBePerformed,\n\t\t})\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tfmt.Println(result)\n\n\treturn nil\n}", "func (t *HeathCare_Chaincode) modifyPatientInformation(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tfmt.Println(\"\\n=============== start modifyPatientInformation function ===============\")\n\tstart := time.Now()\n\ttime.Sleep(time.Second)\n\n\tvar jsonResp string\n\n\tif len(args) != 8 {\n\t\treturn shim.Error(\"expecting 8 argument\")\n\t}\n\n\tuserid := args[0]\n\tpatientid := args[1]\n\tlocation := args[2]\n\tcollection := args[3]\n\n\tnewInsuranceCard := args[4]\n\tnewCurrentMedicationInformation := args[5]\n\tnewRelatedMedicalRecords := args[6]\n\tnewmakeNoteOfAppointmentDate := args[7]\n\ttimeQuery := time.Now().String()\n\n\t//get user identity before query\n\tuserIdentityAsBytes, errUserIdentityAsByte := stub.GetPrivateData(collection, userid)\n\tif errUserIdentityAsByte != nil {\n\t\treturn shim.Error(\"cannot get user identity\")\n\t} else if userIdentityAsBytes == nil {\n\t\treturn shim.Error(\"user does not exist\")\n\t}\n\n\tobjectType := \"Query\"\n\tquery := &Query{objectType, userid, patientid, location, timeQuery, \"modify\"}\n\tqueryAsByte, errQueryAsByte := json.Marshal(query)\n\tif errQueryAsByte != nil {\n\t\treturn shim.Error(errQueryAsByte.Error())\n\t}\n\n\t//save to database\n\terrQueryAsByte = stub.PutPrivateData(\"modifyCollection\", userid, queryAsByte)\n\tif errQueryAsByte != nil {\n\t\treturn shim.Error(errQueryAsByte.Error())\n\t}\n\n\t//create index key\n\tindexName := \"userid~patientid\"\n\tqueryIndexKey, errQueryIndexKey := stub.CreateCompositeKey(indexName, []string{query.UserID, query.PatientID, query.Location, query.Purpose})\n\tif errQueryIndexKey != nil {\n\t\treturn shim.Error(errQueryIndexKey.Error())\n\t}\n\n\t//save index\n\tvalue := []byte{0x00}\n\tstub.PutPrivateData(\"modifyCollection\", queryIndexKey, value)\n\n\t//get data\n\tpatientAsBytes, errPatientAsByte := stub.GetPrivateData(\"PatientInformationCollection\", patientid)\n\tif errPatientAsByte != nil {\n\t\tjsonResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + patientid + \": \" + errPatientAsByte.Error() + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t} else if errPatientAsByte == nil {\n\t\treturn shim.Error(\"patient's data does not exist\")\n\t}\n\n\t//convert data of patient to json\n\tpatient := &PatientInformation{}\n\terrPatientAsByte = json.Unmarshal(patientAsBytes, patient)\n\n\t//change data\n\tpatient.InsuranceCard = newInsuranceCard\n\tpatient.CurrentMedicationInformation = newCurrentMedicationInformation\n\tpatient.RelatedMedicalRecords = newRelatedMedicalRecords\n\tpatient.MakeNoteOfAppointmentDate = newmakeNoteOfAppointmentDate\n\n\tpatientAsByte, errPatientAsByte := json.Marshal(patient)\n\n\terrPatientAsByte = stub.PutPrivateData(\"PatientInformationCollection\", patientid, patientAsByte)\n\tif errPatientAsByte != nil {\n\t\treturn shim.Error(\"cannot patient's data\")\n\t}\n\n\tend := time.Now()\n\telapsed := time.Since(start)\n\tfmt.Println(\"function modifyPatientInformation\")\n\tfmt.Println(\"time start: \", start.String())\n\tfmt.Println(\"time end: \", end.String())\n\tfmt.Println(\"time execute: \", elapsed.String())\n\tfmt.Println(\"=============== end modifyPatientInformation function ===============\")\n\n\treturn shim.Success(nil)\n}", "func EditLocalRep(c *gin.Context) {\n\tuserGUID, _ := c.GetQuery(\"user_guid\")\n\trepGUID, _ := c.GetQuery(\"rep_guid\")\n\teditTask, _ := c.GetQuery(\"editTask\")\n\tc.Header(\"Content-Type\", \"application/json\")\n\ttargetRepIndex := -1\n\tif editTask == \"add\" {\n\t\t// TODO: create map of maps\n\t\tuserReps[userGUID] = append(userReps[userGUID], repGUID)\n\t} else if editTask == \"remove\" {\n\t\ttempUserRepList := userReps[userGUID]\n\t\tfor i, value := range tempUserRepList {\n\t\t\tif value == repGUID {\n\t\t\t\ttargetRepIndex = i\n\t\t\t}\n\t\t}\n\t\tif targetRepIndex != -1 {\n\t\t\tuserReps[userGUID] = append(tempUserRepList[:targetRepIndex], tempUserRepList[targetRepIndex+1:]...)\n\t\t}\n\t} else {\n\t\tfmt.Println(\"edit Rep: provided invalid option\")\n\t\t// log.Info(\"edit Rep: provided invalid option\")\n\t}\n\n\tuserRepUpdate := models.UserRepUpdate{\n\t\tUserGUID: userGUID,\n\t\tRepGUID: repGUID,\n\t\tAction: editTask,\n\t}\n\n\tuserRepUpdateResponse, _ := json.Marshal(userRepUpdate)\n\n\tfmt.Println(string(userRepUpdateResponse))\n\n\tif cfg.Kafka.EnableKafka {\n\t\terr := writer.WriteMessages(context.Background(), kafka.Message{\n\t\t\t//Key: []byte(repGUID),\n\t\t\tValue: []byte(userRepUpdateResponse),\n\t\t})\n\t\tif err != nil {\n\t\t\tpanic(\"could not write kafka message \" + err.Error())\n\t\t}\n\t}\n\n\tmsg := map[string]interface{}{\"Status\": \"Ok\", \"user_guid\": userGUID, \"users_rep_list\": userReps[userGUID]}\n\tc.JSON(http.StatusOK, msg)\n}", "func (m MariaDB) Update(ctx context.Context, ep entity.PersonalData) (int64, error) {\n\tp := receive(ep)\n\tsqlQuery := \"UPDATE person SET name=?, last_name=?, phone=?, email=?, year_od_birth=? where id= ?\"\n\n\trslt, err := m.Person.ExecContext(ctx, sqlQuery, p.Name, p.LastName, p.Phone, p.Email, p.YearOfBirth, p.ID)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"could not update data\")\n\t}\n\tcount, err := rslt.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"rows are not affected\")\n\t}\n\treturn count, nil\n}", "func DefaultPatchSetUserInfo(ctx context.Context, objects []*UserInfo, updateMasks []*field_mask.FieldMask, db *gorm.DB) ([]*UserInfo, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*UserInfo, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchUserInfo(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func (m *TeamworkSoftwareUpdateHealth) SetAdditionalData(value map[string]any)() {\n err := m.GetBackingStore().Set(\"additionalData\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *DeviceLocalCredentialInfoItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.DeviceLocalCredentialInfoable, requestConfiguration *DeviceLocalCredentialInfoItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.DeviceLocalCredentialInfoable, 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.CreateDeviceLocalCredentialInfoFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.DeviceLocalCredentialInfoable), nil\n}", "func (m *TeamworkRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.UserTeamworkable, requestConfiguration *TeamworkRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.UserTeamworkable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateUserTeamworkFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.UserTeamworkable), nil\n}", "func (m *TeamTemplatesItemDefinitionsItemTeamDefinitionPermissionGrantsResourceSpecificPermissionGrantItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ResourceSpecificPermissionGrantable, requestConfiguration *TeamTemplatesItemDefinitionsItemTeamDefinitionPermissionGrantsResourceSpecificPermissionGrantItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ResourceSpecificPermissionGrantable, 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.CreateResourceSpecificPermissionGrantFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ResourceSpecificPermissionGrantable), nil\n}", "func (m *ItemOnlineMeetingsItemRegistrationRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.MeetingRegistrationable, requestConfiguration *ItemOnlineMeetingsItemRegistrationRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.MeetingRegistrationable, 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.CreateMeetingRegistrationFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.MeetingRegistrationable), nil\n}", "func (m *PrivilegedSignupStatusItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedSignupStatusable, requestConfiguration *PrivilegedSignupStatusItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedSignupStatusable, 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.CreatePrivilegedSignupStatusFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedSignupStatusable), nil\n}", "func (o CMFUserSuperSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cmfUserSuperPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE `cmf_user_super` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, cmfUserSuperPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in cmfUserSuper slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all cmfUserSuper\")\n\t}\n\treturn rowsAff, nil\n}", "func HandleUpdatePerson(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tid := r.URL.Query().Get(\"id\")\n\tif id == \"\" {\n\t\thttp.Error(w, \"id parameter is not found\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tfmt.Println(id)\n\treqBody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"Body Read Error : %v\", err), http.StatusInternalServerError)\n\t}\n\tvar body map[string]string\n\terr = json.Unmarshal(reqBody, &body)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"Request Body parse error : %v\", err), http.StatusBadRequest)\n\t\treturn\n\t}\n\tfmt.Printf(body[\"name\"])\n\tcols := \"\"\n\n\tfor key, val := range body {\n\t\tcols = cols + key + \"=\" + \"'\" + val + \"'\" + \",\"\n\t}\n\tf := cols[:len(cols)-1]\n\n\t_, err = Db.Exec(fmt.Sprintf(\"UPDATE people SET %s where people.id=?\", f), id)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"ERROR in deleting person %s\", err.Error()), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tvar person db.Person\n\tres, err := Db.Query(\"SELECT * FROM people where id=?\", id)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"ERROR in updating person %s\", err.Error()), http.StatusBadRequest)\n\t\treturn\n\t}\n\tdefer res.Close()\n\tfor res.Next() {\n\t\terr = res.Scan(&person.Id, &person.Name, &person.City, &person.ContactNo, &person.PhotoUrl)\n\t\tif err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"ERROR in updating person %s\", err.Error()), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n\tjson.NewEncoder(w).Encode(person)\n}", "func (t *MedChain) updateHospital(stub shim.ChaincodeStubInterface, args []string) peer.Response {\n\t\t// ==== Input sanitation ====\n\t\tfmt.Println(\"- start updateHospital\")\n\n\t\t// check if all the args are send\n\t\tif len(args) != 4 {\n\t\t\treturn shim.Error(\"Incorrect number of arguments, Required 4 arguments\")\n\t\t}\n\n\t\t// check if the args are empty\n\t\tfor i := 0; i < len(args); i++ {\n\t\t\tif len(args[i]) <= 0 {\n\t\t\t\treturn shim.Error(\"argument \"+ string(i+1) + \" must be a non-empty string\")\n\t\t\t}\n\t\t}\n\n\t\tgetAssetAsBytes, errT := stub.GetState(args[0])\n\n\t\tif errT != nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Error : Cannot find Hospital %s\" , errT))\n\t\t}\n\n\t\tif getAssetAsBytes == nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Cannot find asset Hospital with ID %s\" , args[0]))\n\t\t}\n\n\t\tvar obj = Hospital{}\n\n\t\tjson.Unmarshal(getAssetAsBytes, &obj)\n\t\tobj.HospitalName = args[1]\n\t\tobj.HospitalAddress = args[2]\n\t\tobj.HospitalPhone = args[3]\n\t\tcomAssetAsBytes, errMarshal := json.Marshal(obj)\n\n\t\tif errMarshal != nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Marshal Error: %s\", errMarshal))\n\t\t}\n\n\t\terrPut := stub.PutState(obj.Hospital_ID, comAssetAsBytes)\n\n\t\tif errPut != nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Failed to update Hospital with ID %s\", args[0]))\n\t\t}\n\n\t\tfmt.Println(\"Hospital asset with ID %s was updated \\n %v\", args[0], obj)\n\n\t\treturn shim.Success(comAssetAsBytes)\n\t}", "func (m *VirtualEndpointUserSettingsCloudPcUserSettingItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CloudPcUserSettingable, requestConfiguration *VirtualEndpointUserSettingsCloudPcUserSettingItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CloudPcUserSettingable, 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.CreateCloudPcUserSettingFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CloudPcUserSettingable), nil\n}", "func updatePerson(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\n\tvar person Person\n\tfname := person.Fname\n\tlname := person.Lname\n\temail := person.Email\n\tpword := person.Pword\n\tid := person.Id\n\n\tstmt, err := db.Prepare(\"UPDATE person SET fname=?, lname=?, email=?, pword=?, id=? WHERE id =?\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tresult, err := stmt.Exec(fname, lname, email, pword, id)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\t_, err = result.RowsAffected()\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}", "func (o CMFFamiliesPolicySlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cmfFamiliesPolicyPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE `cmf_families_policies` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, cmfFamiliesPolicyPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in cmfFamiliesPolicy slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all cmfFamiliesPolicy\")\n\t}\n\treturn rowsAff, nil\n}", "func DefaultApplyFieldMaskUserInfo(ctx context.Context, patchee *UserInfo, patcher *UserInfo, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*UserInfo, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tvar err error\n\tvar updatedCreatedAt bool\n\tvar updatedUpdatedAt bool\n\tfor i, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UserId\" {\n\t\t\tpatchee.UserId = patcher.UserId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"LastName\" {\n\t\t\tpatchee.LastName = patcher.LastName\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"FirstName\" {\n\t\t\tpatchee.FirstName = patcher.FirstName\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Period\" {\n\t\t\tpatchee.Period = patcher.Period\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"DepartmentId\" {\n\t\t\tpatchee.DepartmentId = patcher.DepartmentId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"JobId\" {\n\t\t\tpatchee.JobId = patcher.JobId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"EnrollmentFlg\" {\n\t\t\tpatchee.EnrollmentFlg = patcher.EnrollmentFlg\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"AdminFlg\" {\n\t\t\tpatchee.AdminFlg = patcher.AdminFlg\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedCreatedAt && strings.HasPrefix(f, prefix+\"CreatedAt.\") {\n\t\t\tif patcher.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"CreatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.CreatedAt, patchee.CreatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tupdatedCreatedAt = true\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUpdatedAt && strings.HasPrefix(f, prefix+\"UpdatedAt.\") {\n\t\t\tif patcher.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"UpdatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.UpdatedAt, patchee.UpdatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tupdatedUpdatedAt = true\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func (m *FeatureRolloutPolicyItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.FeatureRolloutPolicyable, requestConfiguration *FeatureRolloutPolicyItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.FeatureRolloutPolicyable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateFeatureRolloutPolicyFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.FeatureRolloutPolicyable), nil\n}", "func (puo *ProductUpdateOne) SetPersonal(p *Personal) *ProductUpdateOne {\n\treturn puo.SetPersonalID(p.ID)\n}", "func (handler *profileHandler) Patch(ctx context.Context, req *proto.ProfilePatchRequest, rsp *proto.ProfileData) (err error) {\n\tprofileInstance := handler.getProfileInstance(req.GetId())\n\tprofileInstance.SetAvatar(req.Avatar)\n\terr = profileInstance.SetLocation(req.Location)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprofileInstance.SetSkype(req.Skype)\n\terr = profileInstance.Save()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thandler.setProfileDataToResponse(profileInstance, rsp)\n\n\treturn nil\n}", "func (db *DataBase) UpdatePlayerPersonalInfo(userID int32, user *models.UserPrivateInfo) (err error) {\n\tvar (\n\t\tconfirmedUser *models.UserPrivateInfo\n\t\ttx *sql.Tx\n\t)\n\n\tif tx, err = db.Db.Begin(); err != nil {\n\t\treturn\n\t}\n\tdefer tx.Rollback()\n\n\tif confirmedUser, err = db.getPrivateInfo(tx, userID); err != nil {\n\t\treturn\n\t}\n\n\tconfirmedUser.Update(user)\n\n\tif err = db.updatePlayerPersonalInfo(tx, user); err != nil {\n\t\treturn\n\t}\n\n\terr = tx.Commit()\n\treturn\n}", "func (o AuthUserUserPermissionSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (m *RiskyUsersItemHistoryRiskyUserHistoryItemItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RiskyUserHistoryItemable, requestConfiguration *RiskyUsersItemHistoryRiskyUserHistoryItemItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RiskyUserHistoryItemable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateRiskyUserHistoryItemFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RiskyUserHistoryItemable), nil\n}", "func (m *OnlineMeetingsItemRegistrationCustomQuestionsMeetingRegistrationQuestionItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.MeetingRegistrationQuestionable, requestConfiguration *OnlineMeetingsItemRegistrationCustomQuestionsMeetingRegistrationQuestionItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.MeetingRegistrationQuestionable, 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.CreateMeetingRegistrationQuestionFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.MeetingRegistrationQuestionable), nil\n}", "func HandleModify(w http.ResponseWriter, r *http.Request) {\r\n\tdefer r.Body.Close()\r\n\tfmt.Println(\"In handleModify\")\r\n\tvar ab AddressBook\r\n\tif r.Method != http.MethodPost {\r\n\t\terr := fmt.Sprintf(\"Method %s not supported on this action %s\\n\", r.Method, r.URL.Path)\r\n\t\tfmt.Printf(\"%s\", err)\r\n\t\thttp.Error(w, err, http.StatusMethodNotAllowed)\r\n\t\treturn\r\n\t}\r\n\r\n\tif err := json.NewDecoder(r.Body).Decode(&ab); err != nil {\r\n\t\tmsg := fmt.Sprintf(\"Error %s while decoding json\\n\", err.Error())\r\n\t\tfmt.Printf(\"%s\", msg)\r\n\t\thttp.Error(w, msg, http.StatusBadRequest)\r\n\t\treturn\r\n\t}\r\n\r\n\tif ab.FirstName == \"\" {\r\n\t\tmsg := \"Name not provided as part of the query\\n\"\r\n\t\tfmt.Printf(\"%s\", msg)\r\n\t\thttp.Error(w, msg, http.StatusNotFound)\r\n\t\treturn\r\n\t}\r\n\r\n\tMutex.RLock()\r\n\tdefer Mutex.RUnlock()\r\n\tif len(AddrBook) == 0 {\r\n\t\tmsg := fmt.Sprintf(\"Address book is empty nothing to modify\\n\")\r\n\t\tfmt.Printf(\"%s\\n\", msg)\r\n\t\thttp.Error(w, msg, http.StatusNotFound)\r\n\t\treturn\r\n\t}\r\n\r\n\tif abTmp, ok := AddrBook[ab.FirstName]; !ok {\r\n\t\tmsg := fmt.Sprintf(\"%s not found in the Address book, nothing to modify\\n\", abTmp.FirstName)\r\n\t\tfmt.Printf(\"%s\", msg)\r\n\t\thttp.Error(w, msg, http.StatusNotFound)\r\n\t\treturn\r\n\t}\r\n\tabTmp, _ := AddrBook[ab.FirstName]\r\n\tif ab.LastName != \"\" && abTmp.LastName != ab.LastName {\r\n\t\tabTmp.LastName = ab.LastName\r\n\t}\r\n\tif ab.Email != \"\" && abTmp.Email != ab.Email {\r\n\t\tabTmp.Email = ab.Email\r\n\t}\r\n\tif ab.PhoneNumber != 0 && abTmp.PhoneNumber != ab.PhoneNumber {\r\n\t\tabTmp.PhoneNumber = ab.PhoneNumber\r\n\t}\r\n\tAddrBook[ab.FirstName] = abTmp\r\n\tmsg := fmt.Sprintf(\"Modified name %s present in the address book\\n\", ab.FirstName)\r\n\tfmt.Printf(\"%s\", msg)\r\n\thttp.Error(w, msg, http.StatusOK)\r\n}", "func (m *StoreItemRequestBuilder) Patch(ctx context.Context, body ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.Storeable, requestConfiguration *StoreItemRequestBuilderPatchRequestConfiguration)(ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.Storeable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.CreateStoreFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.Storeable), nil\n}", "func DefaultStrictUpdateUserInfo(ctx context.Context, in *UserInfo, db *gorm.DB) (*UserInfo, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateUserInfo\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &UserInfoORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func UpdateEmployee(c *gin.Context) {\r\n var employee model.Employee\r\n id := c.Params.ByName(\"id\")\r\n err := model.GetEmployeeByID(&employee, id)\r\n if err != nil {\r\n c.JSON(http.StatusNotFound, employee)\r\n }\r\n c.BindJSON(&employee)\r\n err = model.UpdateEmployee(&employee, id)\r\n if err != nil {\r\n c.AbortWithStatus(http.StatusNotFound)\r\n } else {\r\n c.JSON(http.StatusOK, employee)\r\n }\r\n}", "func (o EmployeeSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), employeePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"employee\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, employeePrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in employee slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all employee\")\n\t}\n\treturn rowsAff, nil\n}", "func (c *Client) ModifyHealthCheck(args *ModifyHealthCheckArgs) (*ModifyHealthCheckResponse, error) {\n\tresponse := ModifyHealthCheckResponse{}\n\terr := c.Invoke(\"ModifyHealthCheck\", args, &response)\n\tif err == nil {\n\t\treturn &response, nil\n\t}\n\treturn nil, err\n}", "func (m *ManagedTenantsManagementActionsManagementActionItemRequestBuilder) Patch(ctx context.Context, body i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagementActionable, requestConfiguration *ManagedTenantsManagementActionsManagementActionItemRequestBuilderPatchRequestConfiguration)(i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagementActionable, 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, i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.CreateManagementActionFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagementActionable), nil\n}", "func (t *IPDCChaincode) invoke_update_status_with_modification_check(stub shim.ChaincodeStubInterface, args []string, map_specification map[string]interface{}) pb.Response {\r\n\r\n\tfmt.Println(\"***********Entering invoke_update_status_with_modification_check***********\")\r\n\r\n\tif len(args) < 2 {\r\n\r\n\t\tfmt.Println(\"Error: Incorrect number of arguments\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error: Incorrect number of arguments\")\r\n\t}\r\n\r\n\tvar record_specification_input map[string]interface{}\r\n\r\n\tvar err error\r\n\r\n\terr = json.Unmarshal([]byte(args[0]), &record_specification_input)\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error in format of record.\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error in format of record.\")\r\n\t}\r\n\r\n\tadditional_json, ok := map_specification[\"additional_json\"]\r\n\r\n\tif ok {\r\n\r\n\t\tadditional_json_data, ok1 := additional_json.(map[string]interface{})\r\n\r\n\t\tif ok1 {\r\n\r\n\t\t\tfor spec, _ := range additional_json_data {\r\n\r\n\t\t\t\trecord_specification_input[spec] = additional_json_data[spec]\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tfmt.Println(\"Error: Invalid additional JSON fields in specification\")\r\n\r\n\t\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\t\treturn shim.Error(\"Error: Invalid additional JSON fields in specification\")\r\n\t\t}\r\n\t}\r\n\r\n\tvar keys_map interface{}\r\n\r\n\tvar specs map[string]interface{}\r\n\r\n\tkeys_map, error_keys_map := t.get_keys_map(stub, record_specification_input)\r\n\r\n\tif error_keys_map != nil {\r\n\r\n\t\tfmt.Println(error_keys_map.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(error_keys_map.Error())\r\n\t}\r\n\r\n\tspecs, ok = keys_map.(map[string]interface{})\r\n\r\n\tif !ok {\r\n\r\n\t\tfmt.Println(\"Error: Invalid keys_map specification.\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error: Invalid keys_map specification.\")\r\n\t}\r\n\r\n\tif specs[\"primary_key\"] == nil {\r\n\r\n\t\tfmt.Println(\"Error: There is no primary key specification.\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error : There is no primary key specification.\")\r\n\t}\r\n\r\n\tvar pk_spec []interface{}\r\n\r\n\tpk_spec, ok = specs[\"primary_key\"].([]interface{})\r\n\r\n\tif !ok {\r\n\r\n\t\tfmt.Println(\"Error in Primary key specification.\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error in Primary key specification.\")\r\n\t}\r\n\r\n\tkey, err_key := t.createInterfacePrimaryKey(record_specification_input, pk_spec)\r\n\r\n\tif err_key != nil {\r\n\r\n\t\tfmt.Println(err_key.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(err_key.Error())\r\n\r\n\t}\r\n\r\n\tvar valAsBytes []byte\r\n\r\n\tvalAsBytes, err = stub.GetState(key)\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error: Failed to get state: \" + err.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error: Failed to get state: \" + err.Error())\r\n\r\n\t} else if valAsBytes == nil {\r\n\r\n\t\tfmt.Println(\"Error: No value for primary key : \" + key)\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error: No value for key\")\r\n\r\n\t}\r\n\r\n\tvar record_specification map[string]interface{}\r\n\r\n\terr = json.Unmarshal([]byte(valAsBytes), &record_specification)\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error in format of record\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error in format of record\")\r\n\r\n\t}\r\n\r\n\tvar check int\r\n\r\n\tcheck, err = t.Isfieldsmodified(record_specification_input, record_specification, map_specification)\r\n\r\n\tif check != 0 {\r\n\r\n\t\tfmt.Println(\"Status Update Failed due to error in modification check. \" + err.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Status Update Failed due to error in modification check. \" + err.Error())\r\n\t}\r\n\r\n\terr_del := t.delete_composite_keys(stub, specs, record_specification, key)\r\n\r\n\tif err_del != nil {\r\n\r\n\t\tfmt.Println(\"Error in deleting composite keys\" + err_del.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error in deleting composite keys\" + err_del.Error())\r\n\r\n\t}\r\n\r\n\tvar to_be_updated_map map[string]interface{}\r\n\r\n\terr = json.Unmarshal([]byte(args[1]), &to_be_updated_map)\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error in format of update map.\")\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error in format of update map.\")\r\n\r\n\t}\r\n\r\n\tfor spec, spec_val := range to_be_updated_map {\r\n\r\n\t\tvar spec_val_string, spec_ok = spec_val.(string)\r\n\r\n\t\tif !spec_ok {\r\n\r\n\t\t\tfmt.Println(\"Error: Unable to parse value of status update\")\r\n\r\n\t\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\t\treturn shim.Error(\"Error: Unable to parse value of status update\")\r\n\r\n\t\t}\r\n\r\n\t\tvar val_check, val_err = t.updatestatusvaliditycheck(spec, spec_val_string, map_specification)\r\n\r\n\t\tif val_check != 0 {\r\n\r\n\t\t\tfmt.Println(val_err.Error())\r\n\r\n\t\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\t\treturn shim.Error(val_err.Error())\r\n\t\t}\r\n\r\n\t\trecord_specification[spec] = spec_val_string\r\n\t}\r\n\r\n\tvar concatenated_record_json []byte\r\n\r\n\tconcatenated_record_json, err = json.Marshal(record_specification)\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error: Unable to Marshal Concatenated Record to JSON \" + err.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error: Unable to Marshal Concatenated Record to JSON \" + err.Error())\r\n\t}\r\n\r\n\terr = stub.PutState(key, []byte(concatenated_record_json))\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error: Failed to put state : \" + err.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error: Failed to put state : \" + err.Error())\r\n\t}\r\n\r\n\terr = t.create_composite_keys(stub, specs, record_specification, key)\r\n\r\n\tif err != nil {\r\n\r\n\t\tfmt.Println(\"Error in creating composite keys\" + err.Error())\r\n\r\n\t\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\t\treturn shim.Error(\"Error in creating composite keys\" + err.Error())\r\n\t}\r\n\r\n\tfmt.Println(\"***********Exiting invoke_update_status_with_modification_check***********\")\r\n\r\n\treturn shim.Success(nil)\r\n\r\n}", "func (pu *ProductUpdate) SetPersonal(p *Personal) *ProductUpdate {\n\treturn pu.SetPersonalID(p.ID)\n}", "func (o TenantSlice) UpdateAllP(ctx context.Context, exec boil.ContextExecutor, cols M) int64 {\n\trowsAff, err := o.UpdateAll(ctx, exec, cols)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn rowsAff\n}", "func (m *TeamTemplatesItemDefinitionsItemTeamDefinitionPhotoRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ProfilePhotoable, requestConfiguration *TeamTemplatesItemDefinitionsItemTeamDefinitionPhotoRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ProfilePhotoable, 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.CreateProfilePhotoFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ProfilePhotoable), nil\n}", "func (svc record) procUpdate(invokerID uint64, m *types.Module, upd *types.Record, old *types.Record) *types.RecordValueErrorSet {\n\t// Mark all values as updated (new)\n\tupd.Values.SetUpdatedFlag(true)\n\n\t// First sanitization\n\t//\n\t// Before values are merged with existing data and\n\t// sent to automation scripts (if any)\n\t// we need to make sure it does not get sanitized data\n\tupd.Values = svc.sanitizer.Run(m, upd.Values)\n\n\t// Copy values to updated record\n\t// to make sure nobody slips in something we do not want\n\tupd.CreatedAt = old.CreatedAt\n\tupd.CreatedBy = old.CreatedBy\n\tupd.UpdatedAt = nowPtr()\n\tupd.UpdatedBy = invokerID\n\tupd.DeletedAt = old.DeletedAt\n\tupd.DeletedBy = old.DeletedBy\n\n\t// Merge new (updated) values with old ones\n\t// This way we get list of updated, stale and deleted values\n\t// that we can selectively update in the repository\n\tupd.Values = old.Values.Merge(upd.Values)\n\n\tif upd.OwnedBy == 0 {\n\t\tif old.OwnedBy > 0 {\n\t\t\t// Owner not set/send in the payload\n\t\t\t//\n\t\t\t// Fallback to old owner (if set)\n\t\t\tupd.OwnedBy = old.OwnedBy\n\t\t} else {\n\t\t\t// If od owner is not set, make current user\n\t\t\t// the owner of the record\n\t\t\tupd.OwnedBy = invokerID\n\t\t}\n\t}\n\n\t// Run validation of the updated records\n\treturn svc.validator.Run(m, upd)\n}", "func (o ForeignLegalResourceSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), foreignLegalResourcePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"ForeignLegalResources\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, foreignLegalResourcePrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in foreignLegalResource slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all foreignLegalResource\")\n\t}\n\treturn rowsAff, nil\n}", "func UpdatePerson(c *gin.Context) {\n // Get the person to be updated\n var person models.Person\n if err := models.DB.First(&person, \"id = ?\", c.Param(\"id\")).Error; err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n return\n }\n\n // Validate input\n var input UpdatePersonInput\n if err := c.ShouldBindJSON(&input); err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n return\n }\n\n models.DB.Model(&person).Updates(input)\n\n c.JSON(http.StatusOK, gin.H{\"data\": person})\n}", "func (m *ManagedEBooksManagedEBookItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ManagedEBookable, requestConfiguration *ManagedEBooksManagedEBookItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ManagedEBookable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateManagedEBookFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ManagedEBookable), nil\n}", "func DefaultPatchUserInfo(ctx context.Context, in *UserInfo, updateMask *field_mask.FieldMask, db *gorm.DB) (*UserInfo, error) {\n\tif in == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tvar pbObj UserInfo\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(UserInfoWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadUserInfo(ctx, &UserInfo{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(UserInfoWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskUserInfo(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(UserInfoWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateUserInfo(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(UserInfoWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func (m *ReportsRequestBuilder) Patch(ctx context.Context, body i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.Reportsable, requestConfiguration *ReportsRequestBuilderPatchRequestConfiguration)(i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.Reportsable, 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, i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.CreateReportsFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.Reportsable), nil\n}", "func (m *HealthMenstruationPersonalInfoORM) ToPB(ctx context.Context) (HealthMenstruationPersonalInfo, error) {\n\tto := HealthMenstruationPersonalInfo{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(HealthMenstruationPersonalInfoWithBeforeToPB); ok {\n\t\tif err = prehook.BeforeToPB(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tif m.CreatedAt != nil {\n\t\tif to.CreatedAt, err = ptypes1.TimestampProto(*m.CreatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tif m.UpdatedAt != nil {\n\t\tif to.UpdatedAt, err = ptypes1.TimestampProto(*m.UpdatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.ProfileId = m.ProfileId\n\tto.PeriodLengthInDays = m.PeriodLengthInDays\n\tto.CycleLengthInDays = m.CycleLengthInDays\n\tif posthook, ok := interface{}(m).(HealthMenstruationPersonalInfoWithAfterToPB); ok {\n\t\terr = posthook.AfterToPB(ctx, &to)\n\t}\n\treturn to, err\n}", "func (o NotificationSlice) UpdateAll(exec boil.Executor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), notificationPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"notification\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, notificationPrimaryKeyColumns, len(o)))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\tresult, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in notification slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all notification\")\n\t}\n\treturn rowsAff, nil\n}", "func UpdatePerson(response http.ResponseWriter, request *http.Request){\n\tresponse.Header().Set(\"Content-type\", \"application/json\")\n\tparams := mux.Vars(request)\n\tid, _ := strconv.Atoi(params[\"id\"])\n\tfor index, item := range models.People {\n\t\tif item.ID == id {\n\t\t\tmodels.People = append(models.People[:index], models.People[index+1:]...)\n\n\t\t\tvar person models.Person\n\n\t\t\t_ = json.NewDecoder(request.Body).Decode(person)\n\t\t\tperson.ID = id\n\t\t\tmodels.People = append(models.People, person)\n\t\t\tjson.NewEncoder(response).Encode(&person) \n\t\t\treturn\n\t\t}\n\t}\n\tjson.NewEncoder(response).Encode(models.People)\n}", "func (m *TermStoreRequestBuilder) Patch(ctx context.Context, body ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.Storeable, requestConfiguration *TermStoreRequestBuilderPatchRequestConfiguration)(ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.Storeable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.CreateStoreFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.Storeable), nil\n}", "func patchLocomotive(w http.ResponseWriter, r *http.Request) {\n\tvar document Locomotive\n\n\t//\tObtener la base de datos y colección a utilizar.-\n\tparams := mux.Vars(r)\n\tdatabaseName := params[\"databaseName\"]\n\tcollectionName := params[\"collectionName\"]\n\n\t//\tObtener el modelo a filtrar.-\n\tmodel := params[\"model\"]\n\n\t//\tConfigurar los filtros.-\n\tfilter := make(map[string]interface{})\n\tif model != \"\" {\n\t\tfilter[\"model\"] = model\n\t}\n\n\t//\tDecodificar el documento json recibido y dejarlo en la variable de tipo struct.-\n\t_ = json.NewDecoder(r.Body).Decode(&document)\n\n\t//\tConfigurar los updates.-\n\tupdate := make(map[string]interface{})\n\tif document.PowerType != \"\" {\n\t\tupdate[\"powertype\"] = document.PowerType\n\t}\n\tif document.Builder != \"\" {\n\t\tupdate[\"builder\"] = document.Builder\n\t}\n\tif document.BuildDate != \"\" {\n\t\tupdate[\"builddate\"] = document.BuildDate\n\t}\n\tif document.WheelSystem != \"\" {\n\t\tupdate[\"wheelsystem\"] = document.WheelSystem\n\t}\n\tif document.MaximunSpeed > 0 {\n\t\tupdate[\"maximunspeed\"] = document.MaximunSpeed\n\t}\n\tif document.PowerOutputHP > 0 {\n\t\tupdate[\"poweroutputhp\"] = document.PowerOutputHP\n\t}\n\n\t//\tActualizar la locomotora.-\n\tupdatedCount, err := UpdateDocument(databaseName, collectionName, filter, update)\n\tif err != nil {\n\t\thttputility.GetJsonResponseMessage(w, \"patchLocomotive: \"+err.Error())\n\t} else {\n\t\tif updatedCount == 0 {\n\t\t\thttputility.GetJsonResponseMessage(w, \"patchLocomotive: No se encontró ningun documento a actualizar en la Base de Datos (MongoDB).\")\n\t\t} else {\n\t\t\tif updatedCount == 1 {\n\t\t\t\thttputility.GetJsonResponseMessage(w, \"patchLocomotive: Se actualizó correctamente el documento de la Base de Datos (MongoDB).\")\n\t\t\t} else {\n\t\t\t\thttputility.GetJsonResponseMessage(w, \"patchLocomotive: Se actualizaron correctamente \"+string(updatedCount)+\" documentos de la Base de Datos (MongoDB).\")\n\t\t\t}\n\t\t}\n\t}\n}", "func (m *WindowsFeatureUpdateProfilesWindowsFeatureUpdateProfileItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.WindowsFeatureUpdateProfileable, requestConfiguration *WindowsFeatureUpdateProfilesWindowsFeatureUpdateProfileItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.WindowsFeatureUpdateProfileable, 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.CreateWindowsFeatureUpdateProfileFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.WindowsFeatureUpdateProfileable), nil\n}", "func (o CMFUserExperienceLogSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cmfUserExperienceLogPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE `cmf_user_experience_log` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, cmfUserExperienceLogPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in cmfUserExperienceLog slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all cmfUserExperienceLog\")\n\t}\n\treturn rowsAff, nil\n}", "func (m *EntitlementManagementRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RbacApplicationable, requestConfiguration *EntitlementManagementRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RbacApplicationable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateRbacApplicationFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RbacApplicationable), nil\n}", "func (o AuthUserSlice) UpdateAllP(exec boil.Executor, cols M) {\n\tif err := o.UpdateAll(exec, cols); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (m *ThreatSubmissionEmailThreatsEmailThreatSubmissionItemRequestBuilder) Patch(ctx context.Context, body i084fa7ab3bba802bf5cc3b408e230cc64c167a57976e0d42c37e17154afd5b78.EmailThreatSubmissionable, requestConfiguration *ThreatSubmissionEmailThreatsEmailThreatSubmissionItemRequestBuilderPatchRequestConfiguration)(i084fa7ab3bba802bf5cc3b408e230cc64c167a57976e0d42c37e17154afd5b78.EmailThreatSubmissionable, 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, i084fa7ab3bba802bf5cc3b408e230cc64c167a57976e0d42c37e17154afd5b78.CreateEmailThreatSubmissionFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(i084fa7ab3bba802bf5cc3b408e230cc64c167a57976e0d42c37e17154afd5b78.EmailThreatSubmissionable), nil\n}", "func (m *TeamsAppItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TeamsAppable, requestConfiguration *TeamsAppItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TeamsAppable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateTeamsAppFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TeamsAppable), nil\n}", "func (a *HyperflexApiService) PatchHyperflexClusterProfile(ctx context.Context, moid string) ApiPatchHyperflexClusterProfileRequest {\n\treturn ApiPatchHyperflexClusterProfileRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func (client LabClient) PatchResourceResponder(resp *http.Response) (result Lab, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func patchPi(w http.ResponseWriter, r *http.Request) {\n\t// Get pi name from request\n\tvars := mux.Vars(r)\n\tname := vars[\"piname\"]\n\n\t// Retrieve pi object from data store\n\tc := appengine.NewContext(r)\n\tq := datastore.NewQuery(piListKind).Filter(\"name =\", name)\n\tt := q.Run(c)\n\tvar pi Pi\n\t_, err := t.Next(&pi)\n\tif err == datastore.Done {\n\t\thttp.Error(w, \"404 Not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Set Pi object property\n\tr.ParseForm()\n\n\t// Updating the name is not allowed\n\tformName := r.Form.Get(\"name\")\n\tif len(formName) != 0 {\n\t\thttp.Error(w, \"404 Not found\", http.StatusNotFound)\n\t\treturn\n\t}\n\tip := r.Form.Get(\"ip\")\n\tif len(ip) != 0 {\n\t\tpi.Ip = ip\n\t}\n\tlastSeen := r.Form.Get(\"lastSeen\")\n\tif len(lastSeen) != 0 {\n\t\tpi.LastSeen = lastSeen\n\t}\n\tpingCount := r.Form.Get(\"pingCount\")\n\tif len(pingCount) != 0 {\n\t\tpi.PingCount, _ = strconv.Atoi(r.Form.Get(\"pingCount\"))\n\t}\n\n\t//\tfmt.Fprint(w, \"name \", , \"\\n\")\n\tfmt.Fprint(w, \"pingCount \", r.Form.Get(\"pingCount\"), \" \", pi.PingCount, \"\\n\")\n\n\t// Store pi object in data store\n\t_, err = datastore.Put(c, datastore.NewKey(c, piListKind, name, 0, nil), &pi)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\thttp.Error(w, \"200 OK\", http.StatusOK)\n\treturn\n}", "func (m *ItemSettingsRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.UserSettingsable, requestConfiguration *ItemSettingsRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.UserSettingsable, 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.CreateUserSettingsFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.UserSettingsable), nil\n}", "func (client HTTPSuccessClient) Patch202(booleanValue *bool) (result autorest.Response, err error) {\n req, err := client.Patch202Preparer(booleanValue)\n if err != nil {\n return result, autorest.NewErrorWithError(err, \"httpinfrastructuregroup.HTTPSuccessClient\", \"Patch202\", nil , \"Failure preparing request\")\n }\n\n resp, err := client.Patch202Sender(req)\n if err != nil {\n result.Response = resp\n return result, autorest.NewErrorWithError(err, \"httpinfrastructuregroup.HTTPSuccessClient\", \"Patch202\", resp, \"Failure sending request\")\n }\n\n result, err = client.Patch202Responder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"httpinfrastructuregroup.HTTPSuccessClient\", \"Patch202\", resp, \"Failure responding to request\")\n }\n\n return\n}", "func (m *SiteItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Siteable, requestConfiguration *SiteItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Siteable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateSiteFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Siteable), nil\n}", "func (o AuthUserUserPermissionSlice) UpdateAll(exec boil.Executor, cols M) error {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), authUserUserPermissionPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"UPDATE `auth_user_user_permissions` SET %s WHERE (`id`) IN (%s)\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, colNames),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(authUserUserPermissionPrimaryKeyColumns), len(colNames)+1, len(authUserUserPermissionPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update all in authUserUserPermission slice\")\n\t}\n\n\treturn nil\n}", "func (o SmallblogSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), smallblogPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE `smallblog` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, smallblogPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in smallblog slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all smallblog\")\n\t}\n\treturn rowsAff, nil\n}", "func (srv *UsersService) PatchHandler(ctx *gin.Context) {\n\tlogger := srv.logger.New(\"action\", \"PatchHandler\")\n\tuser := GetRequestedUser(ctx)\n\tif user == nil {\n\t\t// Returns a \"404 StatusNotFound\" response\n\t\tsrv.ResponseService.NotFound(ctx)\n\t\treturn\n\t}\n\n\t// Checks if the query entry is valid\n\tform := &validators.PatchUser{}\n\tif err := ctx.ShouldBindJSON(form); err != nil {\n\t\tsrv.ResponseService.ValidatorErrorResponse(ctx, responses.UnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tcurrentUser := GetCurrentUser(ctx)\n\tif currentUser.UID == user.UID ||\n\t\tcurrentUser.RoleName == \"root\" ||\n\t\tcurrentUser.RoleName == \"admin\" {\n\n\t\tif form.FirstName != nil {\n\t\t\tuser.FirstName = *form.FirstName\n\t\t}\n\t\tif form.LastName != nil {\n\t\t\tuser.LastName = *form.LastName\n\t\t}\n\t\tif form.Nickname != nil {\n\t\t\tuser.Nickname = *form.Nickname\n\t\t}\n\n\t\trepo := srv.Repository.GetUsersRepository()\n\t\told, err := repo.FindByUID(user.UID)\n\t\tif err != nil {\n\t\t\tlogger.Error(\"cannot find user\", \"err\", err)\n\t\t\tsrv.ResponseService.NotFound(ctx)\n\t\t\treturn\n\t\t}\n\n\t\t_, err = repo.Update(user)\n\t\tif err != nil {\n\t\t\tlogger.Error(\"cannot update user\", \"err\", err)\n\t\t\tsrv.ResponseService.Error(ctx, responses.CanNotUpdateUser, \"Can't update a user\")\n\t\t\treturn\n\t\t}\n\n\t\tif currentUser.UID != user.UID &&\n\t\t\t(currentUser.RoleName == \"admin\" || currentUser.RoleName == \"root\") {\n\t\t\tsrv.SystemLogsService.LogModifyUserProfileAsync(old, user, currentUser.UID)\n\t\t}\n\t}\n\n\t// Returns a \"204 StatusNoContent\" response\n\tctx.JSON(http.StatusNoContent, nil)\n}", "func (me *INVOICES_IMPL) UpdateInvoiceMetadata (\r\n invoiceId string,\r\n body *models_pkg.InvoicesMetadataRequest,\r\n idempotencyKey *string) (*models_pkg.InvoicesMetadataResponse, error) {\r\n //the endpoint path uri\r\n _pathUrl := \"/invoices/{invoice_id}/metadata\"\r\n\r\n //variable to hold errors\r\n var err error = nil\r\n //process optional template parameters\r\n _pathUrl, err = apihelper_pkg.AppendUrlWithTemplateParameters(_pathUrl, map[string]interface{} {\r\n \"invoice_id\" : invoiceId,\r\n })\r\n if err != nil {\r\n //error in template param handling\r\n return nil, err\r\n }\r\n\r\n //the base uri for api requests\r\n _queryBuilder := configuration_pkg.BASEURI;\r\n\r\n //prepare query string for API call\r\n _queryBuilder = _queryBuilder + _pathUrl\r\n\r\n //validate and preprocess url\r\n _queryBuilder, err = apihelper_pkg.CleanUrl(_queryBuilder)\r\n if err != nil {\r\n //error in url validation or cleaning\r\n return nil, err\r\n }\r\n //prepare headers for the outgoing request\r\n headers := map[string]interface{} {\r\n \"user-agent\" : \"MundiSDK - Go 2.4.5\",\r\n \"accept\" : \"application/json\",\r\n \"content-type\" : \"application/json; charset=utf-8\",\r\n \"Content-Type\" : \"application/json\",\r\n \"idempotency-key\" : apihelper_pkg.ToString(idempotencyKey, \"\"),\r\n }\r\n\r\n //prepare API request\r\n _request := unirest.PatchWithAuth(_queryBuilder, headers, body, me.config.BasicAuthUserName(), me.config.BasicAuthPassword())\r\n //and invoke the API call request to fetch the response\r\n _response, err := unirest.AsString(_request,false);\r\n if err != nil {\r\n //error in API invocation\r\n return nil, err\r\n }\r\n\r\n //error handling using HTTP status codes\r\n if (_response.Code == 400) {\r\n err = apihelper_pkg.NewAPIError(\"Invalid request\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 401) {\r\n err = apihelper_pkg.NewAPIError(\"Invalid API key\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 404) {\r\n err = apihelper_pkg.NewAPIError(\"An informed resource was not found\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 412) {\r\n err = apihelper_pkg.NewAPIError(\"Business validation error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 422) {\r\n err = apihelper_pkg.NewAPIError(\"Contract validation error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 500) {\r\n err = apihelper_pkg.NewAPIError(\"Internal server error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code < 200) || (_response.Code > 206) { //[200,206] = HTTP OK\r\n err = apihelper_pkg.NewAPIError(\"HTTP Response Not OK\", _response.Code, _response.RawBody)\r\n }\r\n if(err != nil) {\r\n //error detected in status code validation\r\n return nil, err\r\n }\r\n\r\n //returning the response\r\n var retVal *models_pkg.InvoicesMetadataResponse = &models_pkg.InvoicesMetadataResponse{}\r\n err = json.Unmarshal(_response.RawBody, &retVal)\r\n\r\n if err != nil {\r\n //error in parsing\r\n return nil, err\r\n }\r\n return retVal, nil\r\n\r\n}", "func (m *DBMockedObject) Update(ctx context.Context, document entity.PersonalData) (int64, error) {\n\targs := m.Called(ctx, document)\n\treturn int64(args.Int(0)), args.Error(1)\n}", "func (a *api) h_PUT_persons_persId(c *gin.Context) {\n\tpersId := c.Param(\"persId\")\n\ta.logger.Debug(\"PUT /persons/\", persId)\n\tvar p Person\n\tif a.errorResponse(c, bindAppJson(c, &p)) {\n\t\treturn\n\t}\n\n\taCtx := a.getAuthContext(c)\n\tif a.errorResponse(c, aCtx.AuthZCamAccess(ptr2int64(p.CamId, 0), auth.AUTHZ_LEVEL_OU)) {\n\t\treturn\n\t}\n\n\tp.Id = persId\n\tmp, err := a.person2mperson(&p)\n\tif a.errorResponse(c, err) {\n\t\treturn\n\t}\n\tif a.errorResponse(c, a.Dc.UpdatePerson(mp)) {\n\t\treturn\n\t}\n\tc.Status(http.StatusNoContent)\n}", "func (o TenantSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"dbmodel: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), tenantPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE `tenants` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, tenantPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"dbmodel: unable to update all in tenant slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"dbmodel: unable to retrieve rows affected all in update all tenant\")\n\t}\n\treturn rowsAff, nil\n}", "func (a *BulkApiService) PatchBulkExport(ctx context.Context, moid string) ApiPatchBulkExportRequest {\n\treturn ApiPatchBulkExportRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func (o RecipeLipidSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), recipeLipidPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"recipe_lipid\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, recipeLipidPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in recipeLipid slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all recipeLipid\")\n\t}\n\treturn rowsAff, nil\n}", "func (me *PROTECTIONJOBS_IMPL) UpdateProtectionJob (\r\n body *models.ProtectionJobRequest,\r\n id int64) (*models.ProtectionJob, error) {\r\n//validating required parameters\r\n if (body == nil){\r\n return nil,errors.New(\"The parameter 'body' is a required parameter and cannot be nil.\")\r\n} //the endpoint path uri\r\n _pathUrl := \"/public/protectionJobs/{id}\"\r\n\r\n //variable to hold errors\r\n var err error = nil\r\n //process optional template parameters\r\n _pathUrl, err = apihelper.AppendUrlWithTemplateParameters(_pathUrl, map[string]interface{} {\r\n \"id\" : id,\r\n })\r\n if err != nil {\r\n //error in template param handling\r\n return nil, err\r\n }\r\n\r\n //the base uri for api requests\r\n _queryBuilder := configuration.GetBaseURI(configuration.DEFAULT_HOST,me.config);\r\n\r\n //prepare query string for API call\r\n _queryBuilder = _queryBuilder + _pathUrl\r\n\r\n //validate and preprocess url\r\n _queryBuilder, err = apihelper.CleanUrl(_queryBuilder)\r\n if err != nil {\r\n //error in url validation or cleaning\r\n return nil, err\r\n }\r\n if me.config.AccessToken() == nil {\r\n return nil, errors.New(\"Access Token not set. Please authorize the client using client.Authorize()\");\r\n }\r\n //prepare headers for the outgoing request\r\n headers := map[string]interface{} {\r\n \"user-agent\" : \"cohesity-Go-sdk-6.2.0\",\r\n \"accept\" : \"application/json\",\r\n \"content-type\" : \"application/json; charset=utf-8\",\r\n \"Authorization\" : fmt.Sprintf(\"%s %s\",*me.config.AccessToken().TokenType, *me.config.AccessToken().AccessToken),\r\n }\r\n\r\n //prepare API request\r\n _request := unirest.Put(_queryBuilder, headers, body)\r\n //and invoke the API call request to fetch the response\r\n _response, err := unirest.AsString(_request,me.config.SkipSSL());\r\n if err != nil {\r\n //error in API invocation\r\n return nil, err\r\n }\r\n\r\n //error handling using HTTP status codes\r\n if (_response.Code == 0) {\r\n err = apihelper.NewAPIError(\"Error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code < 200) || (_response.Code > 206) { //[200,206] = HTTP OK\r\n err = apihelper.NewAPIError(\"HTTP Response Not OK\", _response.Code, _response.RawBody)\r\n }\r\n if(err != nil) {\r\n //error detected in status code validation\r\n return nil, err\r\n }\r\n\r\n //returning the response\r\n var retVal *models.ProtectionJob = &models.ProtectionJob{}\r\n err = json.Unmarshal(_response.RawBody, &retVal)\r\n\r\n if err != nil {\r\n //error in parsing\r\n return nil, err\r\n }\r\n return retVal, nil\r\n\r\n}", "func (m *ManagedAppRegistrationItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ManagedAppRegistrationable, requestConfiguration *ManagedAppRegistrationItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ManagedAppRegistrationable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateManagedAppRegistrationFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ManagedAppRegistrationable), nil\n}", "func BulkUpdateContact(r *http.Request, ctx types.Context) contract.Response {\n\trequest := &contract.BulkUpdateContactRequest{}\n\tresponse := &contract.BulkUpdateContactResponse{}\n\n\tif err := json.NewDecoder(r.Body).Decode(request); err != nil {\n\t\tlogger.Get().Errorf(\"Unable to parse request body. Err : %v\", err)\n\t\ter := error.ErrBadRequestInvalidBody(err)\n\t\treturn util.FailureResponse(ctx, response, er.HTTPCode, er)\n\t}\n\n\tfor _, c := range request.Contacts {\n\t\tcontact := &c\n\t\tif err := validater.Of(contact).Validate(); err != nil {\n\t\t\tlogger.Get().Errorf(\"Validation error. Err : %v\", err)\n\t\t\treturn util.FailureResponse(ctx, response, err.HTTPCode, err)\n\t\t}\n\t}\n\n\tif err := core.BulkUpdateContact(ctx, request, response); err != nil {\n\t\treturn util.FailureResponse(ctx, response, err.HTTPCode, err)\n\t}\n\n\treturn util.SuccessResponse(ctx, response, http.StatusCreated)\n}", "func (m *ApplicationSignInDetailedSummaryApplicationSignInDetailedSummaryItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ApplicationSignInDetailedSummaryable, requestConfiguration *ApplicationSignInDetailedSummaryApplicationSignInDetailedSummaryItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ApplicationSignInDetailedSummaryable, 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.CreateApplicationSignInDetailedSummaryFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ApplicationSignInDetailedSummaryable), nil\n}", "func (m *TeamItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Teamable, requestConfiguration *TeamItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Teamable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateTeamFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Teamable), nil\n}", "func updatePerson(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tfmt.Println(\"Update HIT\")\n\tparams := mux.Vars(r)\n\tstmt, err := db.Prepare(\"UPDATE Persons SET pAge = ? WHERE pName = ?\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tvar per Person\n\tjson.Unmarshal(body, &per)\n\tage := per.Age\n\t_, err = stmt.Exec(age, params[\"name\"])\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tfmt.Fprintf(w, \"Person with Name = %s was updated\", params[\"name\"])\n}", "func (client JobClient) UpdateResponder(resp *http.Response) (result JobResourceDescription, err error) {\n err = autorest.Respond(\n resp,\n azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated,http.StatusAccepted),\n autorest.ByUnmarshallingJSON(&result),\n autorest.ByClosing())\n result.Response = autorest.Response{Response: resp}\n return\n }", "func (m *TeamworkSoftwareUpdateHealth) SetCompanyPortalSoftwareUpdateStatus(value TeamworkSoftwareUpdateStatusable)() {\n err := m.GetBackingStore().Set(\"companyPortalSoftwareUpdateStatus\", value)\n if err != nil {\n panic(err)\n }\n}", "func (o FriendshipSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), friendshipPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE `friendship` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, friendshipPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in friendship slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all friendship\")\n\t}\n\treturn rowsAff, nil\n}", "func (o ClaimInListSlice) UpdateAllP(exec boil.Executor, cols M) {\n\terr := o.UpdateAll(exec, cols)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o CMFAdminMenuSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cmfAdminMenuPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE `cmf_admin_menu` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, cmfAdminMenuPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in cmfAdminMenu slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all cmfAdminMenu\")\n\t}\n\treturn rowsAff, nil\n}", "func (m *ItemPhotoRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ProfilePhotoable, requestConfiguration *ItemPhotoRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ProfilePhotoable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateProfilePhotoFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ProfilePhotoable), nil\n}", "func (o PremiumCodeSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), premiumCodePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"premium_codes\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, premiumCodePrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in premiumCode slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all premiumCode\")\n\t}\n\treturn rowsAff, nil\n}", "func (m *TenantStatusRequestBuilder) Patch(ctx context.Context, body i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.TenantStatusable, requestConfiguration *TenantStatusRequestBuilderPatchRequestConfiguration)(i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.TenantStatusable, 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, i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.CreateTenantStatusFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.TenantStatusable), nil\n}", "func (m *UserFlowLanguagePageItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.UserFlowLanguagePageable, requestConfiguration *UserFlowLanguagePageItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.UserFlowLanguagePageable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateUserFlowLanguagePageFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.UserFlowLanguagePageable), nil\n}", "func (client HTTPSuccessClient) Patch200(booleanValue *bool) (result autorest.Response, err error) {\n req, err := client.Patch200Preparer(booleanValue)\n if err != nil {\n return result, autorest.NewErrorWithError(err, \"httpinfrastructuregroup.HTTPSuccessClient\", \"Patch200\", nil , \"Failure preparing request\")\n }\n\n resp, err := client.Patch200Sender(req)\n if err != nil {\n result.Response = resp\n return result, autorest.NewErrorWithError(err, \"httpinfrastructuregroup.HTTPSuccessClient\", \"Patch200\", resp, \"Failure sending request\")\n }\n\n result, err = client.Patch200Responder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"httpinfrastructuregroup.HTTPSuccessClient\", \"Patch200\", resp, \"Failure responding to request\")\n }\n\n return\n}", "func (m *ItemSitesItemAnalyticsItemActivityStatsItemActivityStatItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ItemActivityStatable, requestConfiguration *ItemSitesItemAnalyticsItemActivityStatsItemActivityStatItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ItemActivityStatable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateItemActivityStatFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ItemActivityStatable), nil\n}", "func (m *ExactMatchDataStoresExactMatchDataStoreItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ExactMatchDataStoreable, requestConfiguration *ExactMatchDataStoresExactMatchDataStoreItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ExactMatchDataStoreable, 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.CreateExactMatchDataStoreFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ExactMatchDataStoreable), nil\n}", "func (m *OnlineMeetingInfo) SetAdditionalData(value map[string]any)() {\n err := m.GetBackingStore().Set(\"additionalData\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *User) SetPeople(value []Personable)() {\n m.people = value\n}" ]
[ "0.73712814", "0.68489635", "0.67874825", "0.6128026", "0.5711539", "0.5652175", "0.56520283", "0.5566631", "0.531773", "0.5257406", "0.5192818", "0.51048386", "0.50799334", "0.50211227", "0.4973502", "0.495612", "0.49225268", "0.48665044", "0.48514032", "0.4844714", "0.48313862", "0.4830478", "0.4793071", "0.4792159", "0.47867763", "0.4774733", "0.47635353", "0.4762021", "0.47599232", "0.47589865", "0.4756209", "0.47486022", "0.4739003", "0.47281945", "0.47168058", "0.4711996", "0.4706448", "0.47047845", "0.46979553", "0.46959293", "0.46947232", "0.46808952", "0.4679722", "0.46679652", "0.4664411", "0.46553522", "0.4648938", "0.46473116", "0.46456534", "0.4638421", "0.46322945", "0.46164823", "0.46090096", "0.46075472", "0.46065015", "0.46005312", "0.45962244", "0.4584698", "0.4582003", "0.45717284", "0.45714712", "0.4570428", "0.4559427", "0.45545945", "0.45507422", "0.4547406", "0.4547258", "0.4539511", "0.45362163", "0.45265812", "0.45256948", "0.45252904", "0.4525259", "0.45239672", "0.45220938", "0.4521129", "0.4520057", "0.45108375", "0.4506389", "0.45028207", "0.45025688", "0.44983417", "0.4496532", "0.4493466", "0.44896656", "0.4489295", "0.44852275", "0.4484733", "0.44818506", "0.44791925", "0.44768992", "0.44768426", "0.44767293", "0.44736987", "0.4472264", "0.44698074", "0.44685453", "0.44668272", "0.44624093", "0.4459183" ]
0.7332748
1
DefaultApplyFieldMaskHealthMenstruationPersonalInfo patches an pbObject with patcher according to a field mask.
DefaultApplyFieldMaskHealthMenstruationPersonalInfo применяет патчер к pbObject в соответствии с маской поля.
func DefaultApplyFieldMaskHealthMenstruationPersonalInfo(ctx context.Context, patchee *HealthMenstruationPersonalInfo, patcher *HealthMenstruationPersonalInfo, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) { if patcher == nil { return nil, nil } else if patchee == nil { return nil, errors1.NilArgumentError } var err error for _, f := range updateMask.Paths { if f == prefix+"Id" { patchee.Id = patcher.Id continue } if f == prefix+"CreatedAt" { patchee.CreatedAt = patcher.CreatedAt continue } if f == prefix+"UpdatedAt" { patchee.UpdatedAt = patcher.UpdatedAt continue } if f == prefix+"ProfileId" { patchee.ProfileId = patcher.ProfileId continue } if f == prefix+"PeriodLengthInDays" { patchee.PeriodLengthInDays = patcher.PeriodLengthInDays continue } if f == prefix+"CycleLengthInDays" { patchee.CycleLengthInDays = patcher.CycleLengthInDays continue } } if err != nil { return nil, err } return patchee, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DefaultPatchSetHealthMenstruationPersonalInfo(ctx context.Context, objects []*HealthMenstruationPersonalInfo, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*HealthMenstruationPersonalInfo, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*HealthMenstruationPersonalInfo, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchHealthMenstruationPersonalInfo(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func DefaultPatchHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj HealthMenstruationPersonalInfo\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadHealthMenstruationPersonalInfo(ctx, &HealthMenstruationPersonalInfo{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskHealthMenstruationPersonalInfo(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(HealthMenstruationPersonalInfoWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func DefaultApplyFieldMaskUserInfo(ctx context.Context, patchee *UserInfo, patcher *UserInfo, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*UserInfo, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tvar err error\n\tvar updatedCreatedAt bool\n\tvar updatedUpdatedAt bool\n\tfor i, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UserId\" {\n\t\t\tpatchee.UserId = patcher.UserId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"LastName\" {\n\t\t\tpatchee.LastName = patcher.LastName\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"FirstName\" {\n\t\t\tpatchee.FirstName = patcher.FirstName\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Period\" {\n\t\t\tpatchee.Period = patcher.Period\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"DepartmentId\" {\n\t\t\tpatchee.DepartmentId = patcher.DepartmentId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"JobId\" {\n\t\t\tpatchee.JobId = patcher.JobId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"EnrollmentFlg\" {\n\t\t\tpatchee.EnrollmentFlg = patcher.EnrollmentFlg\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"AdminFlg\" {\n\t\t\tpatchee.AdminFlg = patcher.AdminFlg\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedCreatedAt && strings.HasPrefix(f, prefix+\"CreatedAt.\") {\n\t\t\tif patcher.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"CreatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.CreatedAt, patchee.CreatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tupdatedCreatedAt = true\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUpdatedAt && strings.HasPrefix(f, prefix+\"UpdatedAt.\") {\n\t\t\tif patcher.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"UpdatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.UpdatedAt, patchee.UpdatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tupdatedUpdatedAt = true\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func DefaultApplyFieldMaskHealthMenstruationDailyEntry(ctx context.Context, patchee *HealthMenstruationDailyEntry, patcher *HealthMenstruationDailyEntry, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"ProfileId\" {\n\t\t\tpatchee.ProfileId = patcher.ProfileId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Day\" {\n\t\t\tpatchee.Day = patcher.Day\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"IntensityPercentage\" {\n\t\t\tpatchee.IntensityPercentage = patcher.IntensityPercentage\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Type\" {\n\t\t\tpatchee.Type = patcher.Type\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Manual\" {\n\t\t\tpatchee.Manual = patcher.Manual\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"BasedOnPrediction\" {\n\t\t\tpatchee.BasedOnPrediction = patcher.BasedOnPrediction\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func DefaultApplyFieldMaskProfile(ctx context.Context, patchee *Profile, patcher *Profile, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*Profile, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Notes\" {\n\t\t\tpatchee.Notes = patcher.Notes\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"FirstName\" {\n\t\t\tpatchee.FirstName = patcher.FirstName\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"LastName\" {\n\t\t\tpatchee.LastName = patcher.LastName\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"PrimaryEmail\" {\n\t\t\tpatchee.PrimaryEmail = patcher.PrimaryEmail\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Groups\" {\n\t\t\tpatchee.Groups = patcher.Groups\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"ProfilePictureUrl\" {\n\t\t\tpatchee.ProfilePictureUrl = patcher.ProfilePictureUrl\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func DefaultPatchSetUserInfo(ctx context.Context, objects []*UserInfo, updateMasks []*field_mask.FieldMask, db *gorm.DB) ([]*UserInfo, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*UserInfo, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchUserInfo(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func WithOverrideFieldMask(d *presenceInterceptorOptionsDecorator) {\n\td.overrideFieldMask = true\n}", "func DefaultPatchUserInfo(ctx context.Context, in *UserInfo, updateMask *field_mask.FieldMask, db *gorm.DB) (*UserInfo, error) {\n\tif in == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tvar pbObj UserInfo\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(UserInfoWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadUserInfo(ctx, &UserInfo{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(UserInfoWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskUserInfo(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(UserInfoWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateUserInfo(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(UserInfoWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func DefaultApplyFieldMaskIntPoint(ctx context.Context, patchee *IntPoint, patcher *IntPoint, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*IntPoint, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors.New(\"Patchee inputs to DefaultApplyFieldMaskIntPoint must be non-nil\")\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"X\" {\n\t\t\tpatchee.X = patcher.X\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Y\" {\n\t\t\tpatchee.Y = patcher.Y\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func DefaultPatchSetHealthMenstruationDailyEntry(ctx context.Context, objects []*HealthMenstruationDailyEntry, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*HealthMenstruationDailyEntry, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*HealthMenstruationDailyEntry, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchHealthMenstruationDailyEntry(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func DefaultPatchSetProfile(ctx context.Context, objects []*Profile, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*Profile, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*Profile, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchProfile(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func DefaultPatchHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj HealthMenstruationDailyEntry\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadHealthMenstruationDailyEntry(ctx, &HealthMenstruationDailyEntry{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskHealthMenstruationDailyEntry(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateHealthMenstruationDailyEntry(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(HealthMenstruationDailyEntryWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func DefaultApplyFieldMaskPeriod(ctx context.Context, patchee *Period, patcher *Period, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*Period, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tvar err error\n\tvar updatedCreatedAt bool\n\tvar updatedUpdatedAt bool\n\tfor i, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Period\" {\n\t\t\tpatchee.Period = patcher.Period\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedCreatedAt && strings.HasPrefix(f, prefix+\"CreatedAt.\") {\n\t\t\tif patcher.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"CreatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.CreatedAt, patchee.CreatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tupdatedCreatedAt = true\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUpdatedAt && strings.HasPrefix(f, prefix+\"UpdatedAt.\") {\n\t\t\tif patcher.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"UpdatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.UpdatedAt, patchee.UpdatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tupdatedUpdatedAt = true\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateHealthMenstruationPersonalInfo\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &HealthMenstruationPersonalInfoORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func DefaultApplyFieldMaskComment(ctx context.Context, patchee *Comment, patcher *Comment, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*Comment, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tvar updatedCreatedAt bool\n\tvar updatedUpdatedAt bool\n\tvar updatedDeletedAt bool\n\tvar updatedBoardId bool\n\tvar updatedPostId bool\n\tvar updatedContentId bool\n\tvar updatedUserid bool\n\tvar updatedUsername bool\n\tvar updatedNickname bool\n\tvar updatedEmail bool\n\tvar updatedPassword bool\n\tvar updatedUrl bool\n\tvar updatedUseHtml bool\n\tvar updatedUseSecret bool\n\tfor i, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedCreatedAt && strings.HasPrefix(f, prefix+\"CreatedAt.\") {\n\t\t\tif patcher.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"CreatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.CreatedAt, patchee.CreatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tupdatedCreatedAt = true\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUpdatedAt && strings.HasPrefix(f, prefix+\"UpdatedAt.\") {\n\t\t\tif patcher.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"UpdatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.UpdatedAt, patchee.UpdatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tupdatedUpdatedAt = true\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedDeletedAt && strings.HasPrefix(f, prefix+\"DeletedAt.\") {\n\t\t\tif patcher.DeletedAt == nil {\n\t\t\t\tpatchee.DeletedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.DeletedAt == nil {\n\t\t\t\tpatchee.DeletedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"DeletedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.DeletedAt, patchee.DeletedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"DeletedAt\" {\n\t\t\tupdatedDeletedAt = true\n\t\t\tpatchee.DeletedAt = patcher.DeletedAt\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedBoardId && strings.HasPrefix(f, prefix+\"BoardId.\") {\n\t\t\tif patcher.BoardId == nil {\n\t\t\t\tpatchee.BoardId = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.BoardId == nil {\n\t\t\t\tpatchee.BoardId = &wrappers.StringValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"BoardId.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.BoardId, patchee.BoardId, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"BoardId\" {\n\t\t\tupdatedBoardId = true\n\t\t\tpatchee.BoardId = patcher.BoardId\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedPostId && strings.HasPrefix(f, prefix+\"PostId.\") {\n\t\t\tif patcher.PostId == nil {\n\t\t\t\tpatchee.PostId = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.PostId == nil {\n\t\t\t\tpatchee.PostId = &wrappers.StringValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"PostId.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.PostId, patchee.PostId, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"PostId\" {\n\t\t\tupdatedPostId = true\n\t\t\tpatchee.PostId = patcher.PostId\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedContentId && strings.HasPrefix(f, prefix+\"ContentId.\") {\n\t\t\tif patcher.ContentId == nil {\n\t\t\t\tpatchee.ContentId = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.ContentId == nil {\n\t\t\t\tpatchee.ContentId = &wrappers.StringValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"ContentId.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.ContentId, patchee.ContentId, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"ContentId\" {\n\t\t\tupdatedContentId = true\n\t\t\tpatchee.ContentId = patcher.ContentId\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUserid && strings.HasPrefix(f, prefix+\"Userid.\") {\n\t\t\tif patcher.Userid == nil {\n\t\t\t\tpatchee.Userid = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.Userid == nil {\n\t\t\t\tpatchee.Userid = &wrappers.StringValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"Userid.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.Userid, patchee.Userid, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"Userid\" {\n\t\t\tupdatedUserid = true\n\t\t\tpatchee.Userid = patcher.Userid\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUsername && strings.HasPrefix(f, prefix+\"Username.\") {\n\t\t\tif patcher.Username == nil {\n\t\t\t\tpatchee.Username = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.Username == nil {\n\t\t\t\tpatchee.Username = &wrappers.StringValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"Username.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.Username, patchee.Username, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"Username\" {\n\t\t\tupdatedUsername = true\n\t\t\tpatchee.Username = patcher.Username\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedNickname && strings.HasPrefix(f, prefix+\"Nickname.\") {\n\t\t\tif patcher.Nickname == nil {\n\t\t\t\tpatchee.Nickname = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.Nickname == nil {\n\t\t\t\tpatchee.Nickname = &wrappers.StringValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"Nickname.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.Nickname, patchee.Nickname, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"Nickname\" {\n\t\t\tupdatedNickname = true\n\t\t\tpatchee.Nickname = patcher.Nickname\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedEmail && strings.HasPrefix(f, prefix+\"Email.\") {\n\t\t\tif patcher.Email == nil {\n\t\t\t\tpatchee.Email = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.Email == nil {\n\t\t\t\tpatchee.Email = &wrappers.StringValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"Email.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.Email, patchee.Email, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"Email\" {\n\t\t\tupdatedEmail = true\n\t\t\tpatchee.Email = patcher.Email\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedPassword && strings.HasPrefix(f, prefix+\"Password.\") {\n\t\t\tif patcher.Password == nil {\n\t\t\t\tpatchee.Password = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.Password == nil {\n\t\t\t\tpatchee.Password = &wrappers.StringValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"Password.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.Password, patchee.Password, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"Password\" {\n\t\t\tupdatedPassword = true\n\t\t\tpatchee.Password = patcher.Password\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUrl && strings.HasPrefix(f, prefix+\"Url.\") {\n\t\t\tif patcher.Url == nil {\n\t\t\t\tpatchee.Url = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.Url == nil {\n\t\t\t\tpatchee.Url = &wrappers.StringValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"Url.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.Url, patchee.Url, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"Url\" {\n\t\t\tupdatedUrl = true\n\t\t\tpatchee.Url = patcher.Url\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUseHtml && strings.HasPrefix(f, prefix+\"UseHtml.\") {\n\t\t\tif patcher.UseHtml == nil {\n\t\t\t\tpatchee.UseHtml = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.UseHtml == nil {\n\t\t\t\tpatchee.UseHtml = &wrappers.BoolValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"UseHtml.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.UseHtml, patchee.UseHtml, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"UseHtml\" {\n\t\t\tupdatedUseHtml = true\n\t\t\tpatchee.UseHtml = patcher.UseHtml\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUseSecret && strings.HasPrefix(f, prefix+\"UseSecret.\") {\n\t\t\tif patcher.UseSecret == nil {\n\t\t\t\tpatchee.UseSecret = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.UseSecret == nil {\n\t\t\t\tpatchee.UseSecret = &wrappers.BoolValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"UseSecret.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.UseSecret, patchee.UseSecret, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"UseSecret\" {\n\t\t\tupdatedUseSecret = true\n\t\t\tpatchee.UseSecret = patcher.UseSecret\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpVoteCount\" {\n\t\t\tpatchee.UpVoteCount = patcher.UpVoteCount\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"DownVoteCount\" {\n\t\t\tpatchee.DownVoteCount = patcher.DownVoteCount\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func (m *DeviceLocalCredentialInfoItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.DeviceLocalCredentialInfoable, requestConfiguration *DeviceLocalCredentialInfoItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.DeviceLocalCredentialInfoable, 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.CreateDeviceLocalCredentialInfoFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.DeviceLocalCredentialInfoable), nil\n}", "func DefaultCreateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, 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 hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeCreate_); ok {\n\t\tif db, err = hook.BeforeCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterCreate_); ok {\n\t\tif err = hook.AfterCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func (m *TeamworkRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.UserTeamworkable, requestConfiguration *TeamworkRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.UserTeamworkable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateUserTeamworkFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.UserTeamworkable), nil\n}", "func DefaultListHealthMenstruationPersonalInfo(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*HealthMenstruationPersonalInfo, error) {\n\tin := HealthMenstruationPersonalInfo{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm2.ApplyCollectionOperators(ctx, db, &HealthMenstruationPersonalInfoORM{}, &HealthMenstruationPersonalInfo{}, f, s, p, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []HealthMenstruationPersonalInfoORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*HealthMenstruationPersonalInfo{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func (m *ShiftPreferencesRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ShiftPreferencesable, requestConfiguration *ShiftPreferencesRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ShiftPreferencesable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateShiftPreferencesFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ShiftPreferencesable), nil\n}", "func (m *TeamTemplatesItemDefinitionsItemTeamDefinitionPermissionGrantsResourceSpecificPermissionGrantItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ResourceSpecificPermissionGrantable, requestConfiguration *TeamTemplatesItemDefinitionsItemTeamDefinitionPermissionGrantsResourceSpecificPermissionGrantItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ResourceSpecificPermissionGrantable, 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.CreateResourceSpecificPermissionGrantFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ResourceSpecificPermissionGrantable), nil\n}", "func (m *CompaniesItemCompanyInformationCompanyInformationItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CompanyInformationable, requestConfiguration *CompaniesItemCompanyInformationCompanyInformationItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CompanyInformationable, 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.CreateCompanyInformationFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CompanyInformationable), nil\n}", "func (m *TeamTemplatesItemDefinitionsItemTeamDefinitionPhotoRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ProfilePhotoable, requestConfiguration *TeamTemplatesItemDefinitionsItemTeamDefinitionPhotoRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ProfilePhotoable, 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.CreateProfilePhotoFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ProfilePhotoable), nil\n}", "func DefaultReadHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, 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 == 0 {\n\t\treturn nil, errors1.EmptyIdError\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeReadApplyQuery); ok {\n\t\tif db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &HealthMenstruationPersonalInfoORM{}); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeReadFind); ok {\n\t\tif db, err = hook.BeforeReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tormResponse := HealthMenstruationPersonalInfoORM{}\n\tif err = db.Where(&ormObj).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormResponse).(HealthMenstruationPersonalInfoORMWithAfterReadFind); ok {\n\t\tif err = hook.AfterReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func (fieldMask UpdateAlertingPolicyRequest_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (c *AppsModulesPatchCall) Mask(mask string) *AppsModulesPatchCall {\n\tc.urlParams_.Set(\"mask\", mask)\n\treturn c\n}", "func mutate(newObj runtime.Object) (admission.PatchOps, error) {\n\torphan := newObj.(*longhorn.Orphan)\n\tvar patchOps admission.PatchOps\n\n\tpatchOp, err := common.GetLonghornFinalizerPatchOpIfNeeded(orphan)\n\tif err != nil {\n\t\terr := errors.Wrapf(err, \"failed to get finalizer patch for orphan %v\", orphan.Name)\n\t\treturn nil, werror.NewInvalidError(err.Error(), \"\")\n\t}\n\tif patchOp != \"\" {\n\t\tpatchOps = append(patchOps, patchOp)\n\t}\n\n\treturn patchOps, nil\n}", "func (fieldMask BatchGetAlertingPoliciesResponse_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (fieldMask CreateAlertingPolicyRequest_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func TestFieldMaskFromRequestBodyWithDescriptor(t *testing.T) {\n\tif testing.Short() {\n\t\tt.Skip()\n\t\treturn\n\t}\n\n\t_, md := descriptor.ForMessage(new(examplepb.NonStandardMessage))\n\tjsonInput := `{\"id\":\"foo\", \"thing\":{\"subThing\":{\"sub_value\":\"bar\"}}}`\n\texpected := newFieldMask(\"id\", \"thing.subThing.sub_value\")\n\n\tactual, err := runtime.FieldMaskFromRequestBody(bytes.NewReader([]byte(jsonInput)), md)\n\tif !fieldMasksEqual(actual, expected) {\n\t\tt.Errorf(\"want %v; got %v\", fieldMaskString(expected), fieldMaskString(actual))\n\t}\n\tif err != nil {\n\t\tt.Errorf(\"err %v\", err)\n\t}\n}", "func (x *fastReflection_QueryAccountInfoRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.auth.v1beta1.QueryAccountInfoRequest.address\":\n\t\tpanic(fmt.Errorf(\"field address of message cosmos.auth.v1beta1.QueryAccountInfoRequest is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.auth.v1beta1.QueryAccountInfoRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.auth.v1beta1.QueryAccountInfoRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "func DefaultPatchProfile(ctx context.Context, in *Profile, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*Profile, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj Profile\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(ProfileWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadProfile(ctx, &Profile{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(ProfileWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskProfile(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(ProfileWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateProfile(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(ProfileWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func (fieldMask WatchAlertingPolicyResponse_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (fieldMask GetAlertingPolicyRequest_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (m *FeatureRolloutPolicyItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.FeatureRolloutPolicyable, requestConfiguration *FeatureRolloutPolicyItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.FeatureRolloutPolicyable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateFeatureRolloutPolicyFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.FeatureRolloutPolicyable), nil\n}", "func apply(m proto.Message, ops ...interface{}) proto.Message {\n\tmr := m.ProtoReflect()\n\tmd := mr.Descriptor()\n\tfor _, op := range ops {\n\t\tswitch op := op.(type) {\n\t\tcase setField:\n\t\t\tfd := md.Fields().ByNumber(op.num)\n\t\t\tmr.Set(fd, protoreflect.ValueOf(op.val))\n\t\tcase setUnknown:\n\t\t\tmr.SetUnknown(op.raw)\n\t\tcase setExtension:\n\t\t\tmr.Set(op.typ.TypeDescriptor(), protoreflect.ValueOf(op.val))\n\t\t}\n\t}\n\treturn m\n}", "func (fieldMask BatchGetAlertingPoliciesRequest_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (m *ItemPhotoRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ProfilePhotoable, requestConfiguration *ItemPhotoRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ProfilePhotoable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateProfilePhotoFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ProfilePhotoable), nil\n}", "func (fieldMask SearchAlertingPoliciesResponse_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (m *ReportsRequestBuilder) Patch(ctx context.Context, body i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.Reportsable, requestConfiguration *ReportsRequestBuilderPatchRequestConfiguration)(i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.Reportsable, 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, i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.CreateReportsFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.Reportsable), nil\n}", "func patch(newObj runtime.Object, existingObj runtime.Object, c client.Client) error {\n\tnewObjJSON, _ := apijson.Marshal(newObj)\n\tkey, _ := client.ObjectKeyFromObject(newObj)\n\t_, isUnstructured := newObj.(runtime.Unstructured)\n\t_, isCRD := newObj.(*apiextv1beta1.CustomResourceDefinition)\n\n\tif isUnstructured || isCRD || isKudoType(newObj) {\n\t\t// strategic merge patch is not supported for these types, falling back to merge patch\n\t\terr := c.Patch(context.TODO(), newObj, client.ConstantPatch(types.MergePatchType, newObjJSON))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to apply merge patch to object %s/%s: %w\", key.Name, key.Name, err)\n\t\t}\n\t} else {\n\t\terr := c.Patch(context.TODO(), existingObj, client.ConstantPatch(types.StrategicMergePatchType, newObjJSON))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to apply StrategicMergePatch to object %s/%s: %w\", key.Namespace, key.Name, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (m *PrivilegedSignupStatusItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedSignupStatusable, requestConfiguration *PrivilegedSignupStatusItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedSignupStatusable, 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.CreatePrivilegedSignupStatusFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedSignupStatusable), nil\n}", "func (fieldMask WatchAlertingPoliciesResponse_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (fieldMask ListAlertingPoliciesResponse_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (a *HyperflexApiService) PatchHyperflexFeatureLimitInternal(ctx context.Context, moid string) ApiPatchHyperflexFeatureLimitInternalRequest {\n\treturn ApiPatchHyperflexFeatureLimitInternalRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func (m *AssignmentDefaultsRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.EducationAssignmentDefaultsable, requestConfiguration *AssignmentDefaultsRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.EducationAssignmentDefaultsable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateEducationAssignmentDefaultsFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.EducationAssignmentDefaultsable), nil\n}", "func (m *ConditionalAccessRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConditionalAccessRootable, requestConfiguration *ConditionalAccessRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConditionalAccessRootable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateConditionalAccessRootFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConditionalAccessRootable), nil\n}", "func mutate(newObj runtime.Object) (admission.PatchOps, error) {\n\tsupportBundle := newObj.(*longhorn.SupportBundle)\n\tvar patchOps admission.PatchOps\n\n\tpatchOp, err := common.GetLonghornFinalizerPatchOpIfNeeded(supportBundle)\n\tif err != nil {\n\t\terr := errors.Wrapf(err, \"failed to get finalizer patch for supportBundle %v\", supportBundle.Name)\n\t\treturn nil, werror.NewInvalidError(err.Error(), \"\")\n\t}\n\tif patchOp != \"\" {\n\t\tpatchOps = append(patchOps, patchOp)\n\t}\n\n\treturn patchOps, nil\n}", "func (fieldMask WatchAlertingPolicyRequest_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (fuo *FriendshipUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *FriendshipUpdateOne {\n\tfuo.modifiers = append(fuo.modifiers, modifiers...)\n\treturn fuo\n}", "func (m *ConditionalAccessRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConditionalAccessRootable, requestConfiguration *ConditionalAccessRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConditionalAccessRootable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateConditionalAccessRootFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConditionalAccessRootable), nil\n}", "func (fieldMask SearchAlertingPoliciesRequest_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (m *ConditionalAccessRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConditionalAccessRootable, requestConfiguration *ConditionalAccessRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConditionalAccessRootable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateConditionalAccessRootFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConditionalAccessRootable), nil\n}", "func (x *fastReflection_QueryModuleAccountsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.auth.v1beta1.QueryModuleAccountsRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.auth.v1beta1.QueryModuleAccountsRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "func (m *DirectoryRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RbacApplicationable, requestConfiguration *DirectoryRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RbacApplicationable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateRbacApplicationFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RbacApplicationable), nil\n}", "func (x *fastReflection_Bech32PrefixRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.auth.v1beta1.Bech32PrefixRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.auth.v1beta1.Bech32PrefixRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "func (m *TeamItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Teamable, requestConfiguration *TeamItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Teamable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateTeamFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Teamable), nil\n}", "func (c *PropertiesGoogleAdsLinksPatchCall) UpdateMask(updateMask string) *PropertiesGoogleAdsLinksPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (fieldMask GetMonitoredResourceDescriptorRequest_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (m *ItemJoinedTeamsItemPrimaryChannelMembersConversationMemberItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConversationMemberable, requestConfiguration *ItemJoinedTeamsItemPrimaryChannelMembersConversationMemberItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConversationMemberable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateConversationMemberFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConversationMemberable), nil\n}", "func (mi *MessageInfo) makeKnownFieldsFunc(si structInfo) {\n\tmi.fields = map[pref.FieldNumber]*fieldInfo{}\n\tfor i := 0; i < mi.PBType.Descriptor().Fields().Len(); i++ {\n\t\tfd := mi.PBType.Descriptor().Fields().Get(i)\n\t\tfs := si.fieldsByNumber[fd.Number()]\n\t\tvar fi fieldInfo\n\t\tswitch {\n\t\tcase fd.ContainingOneof() != nil:\n\t\t\tfi = fieldInfoForOneof(fd, si.oneofsByName[fd.ContainingOneof().Name()], si.oneofWrappersByNumber[fd.Number()])\n\t\tcase fd.IsMap():\n\t\t\tfi = fieldInfoForMap(fd, fs)\n\t\tcase fd.IsList():\n\t\t\tfi = fieldInfoForList(fd, fs)\n\t\tcase fd.Kind() == pref.MessageKind || fd.Kind() == pref.GroupKind:\n\t\t\tfi = fieldInfoForMessage(fd, fs)\n\t\tdefault:\n\t\t\tfi = fieldInfoForScalar(fd, fs)\n\t\t}\n\t\tmi.fields[fd.Number()] = &fi\n\t}\n\n\tmi.oneofs = map[pref.Name]*oneofInfo{}\n\tfor i := 0; i < mi.PBType.Descriptor().Oneofs().Len(); i++ {\n\t\tod := mi.PBType.Descriptor().Oneofs().Get(i)\n\t\tmi.oneofs[od.Name()] = makeOneofInfo(od, si.oneofsByName[od.Name()], si.oneofWrappersByType)\n\t}\n}", "func (fieldMask Ping_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (m *VirtualEndpointUserSettingsCloudPcUserSettingItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CloudPcUserSettingable, requestConfiguration *VirtualEndpointUserSettingsCloudPcUserSettingItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CloudPcUserSettingable, 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.CreateCloudPcUserSettingFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CloudPcUserSettingable), nil\n}", "func (m *TeamsAppItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TeamsAppable, requestConfiguration *TeamsAppItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TeamsAppable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateTeamsAppFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TeamsAppable), nil\n}", "func (fieldMask WatchAlertingPoliciesRequest_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (c *Patch) Apply(cp, cd runtime.Object, only ...PatchType) error {\n\tif c.filterPatch(only...) {\n\t\treturn nil\n\t}\n\n\tswitch c.Type {\n\tcase PatchTypeFromCompositeFieldPath:\n\t\treturn c.applyFromFieldPathPatch(cp, cd)\n\tcase PatchTypeToCompositeFieldPath:\n\t\treturn c.applyFromFieldPathPatch(cd, cp)\n\tcase PatchTypeCombineFromComposite:\n\t\treturn c.applyCombineFromVariablesPatch(cp, cd)\n\tcase PatchTypeCombineToComposite:\n\t\treturn c.applyCombineFromVariablesPatch(cd, cp)\n\tcase PatchTypePatchSet:\n\t\t// Already resolved - nothing to do.\n\t}\n\treturn errors.Errorf(errFmtInvalidPatchType, c.Type)\n}", "func (fieldMask DeleteAlertingPolicyRequest_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (conn *DB) WithPersonalInfoViewApprovals(manager *User) *DB {\n\treturn conn.Joins(\"LEFT JOIN LATERAL ? AS personal_info_view_approvals ON 1\",\n\t\tNewDataStore(conn.New()).ActiveGroupAncestors().ManagedByUser(manager).\n\t\t\tJoins(`\n\t\t\t\tJOIN groups_groups_active\n\t\t\t\t\tON groups_groups_active.parent_group_id = groups_ancestors_active.child_group_id AND\n\t\t\t\t\t groups_groups_active.personal_info_view_approved`).\n\t\t\tWhere(\"groups_groups_active.child_group_id = users.group_id\").\n\t\t\tSelect(\"1 AS approved\").\n\t\t\tLimit(1).\n\t\t\tSubQuery())\n}", "func (fieldMask ListAlertingPoliciesRequest_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (m *EntitlementManagementRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RbacApplicationable, requestConfiguration *EntitlementManagementRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RbacApplicationable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateRbacApplicationFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RbacApplicationable), nil\n}", "func (fieldMask ListMonitoredResourceDescriptorsResponse_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (x *fastReflection_QueryAccountRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.auth.v1beta1.QueryAccountRequest.address\":\n\t\tpanic(fmt.Errorf(\"field address of message cosmos.auth.v1beta1.QueryAccountRequest is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.auth.v1beta1.QueryAccountRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.auth.v1beta1.QueryAccountRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "func (p localPatchList) patch(f *funcProto, soff int) {\n\tfor _, l := range p {\n\t\tf.localVars[l].sPC = int32(len(f.code) + soff)\n\t}\n}", "func (x *fastReflection_MsgUpdateParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgUpdateParamsResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.MsgUpdateParamsResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "func (m *FileRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.AgreementFileable, requestConfiguration *FileRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.AgreementFileable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateAgreementFileFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.AgreementFileable), nil\n}", "func (*FieldMask) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_types_known_field_mask_proto_rawDescGZIP(), []int{0}\n}", "func (_Token *TokenCaller) PendingMelterAdmin(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Token.contract.Call(opts, out, \"pendingMelterAdmin\")\n\treturn *ret0, err\n}", "func (fieldMask Distribution_BucketOptions_Linear_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (x *fastReflection_QueryModuleAccountByNameRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.auth.v1beta1.QueryModuleAccountByNameRequest.name\":\n\t\tpanic(fmt.Errorf(\"field name of message cosmos.auth.v1beta1.QueryModuleAccountByNameRequest is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.auth.v1beta1.QueryModuleAccountByNameRequest\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.auth.v1beta1.QueryModuleAccountByNameRequest does not contain field %s\", fd.FullName()))\n\t}\n}", "func (m *WindowsFeatureUpdateProfilesWindowsFeatureUpdateProfileItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.WindowsFeatureUpdateProfileable, requestConfiguration *WindowsFeatureUpdateProfilesWindowsFeatureUpdateProfileItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.WindowsFeatureUpdateProfileable, 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.CreateWindowsFeatureUpdateProfileFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.WindowsFeatureUpdateProfileable), nil\n}", "func (c *OrganizationsDatacollectorsPatchCall) UpdateMask(updateMask string) *OrganizationsDatacollectorsPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (p *Patch) Patch() {\n\tp.patched = true\n\tif p.funcInfo != nil {\n\t\tp.applyFunc()\n\t} else if p.varInfo != nil {\n\t\tp.applyVar()\n\t}\n}", "func (c *kuberhealthyChecks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result KuberhealthyCheck, err error) {\n\tresult = KuberhealthyCheck{}\n\terr = c.client.Patch(pt).\n\t\tNamespace(c.ns).\n\t\tResource(\"khchecks\").\n\t\tSubResource(subresources...).\n\t\tName(name).\n\t\tBody(data).\n\t\tDo(context.TODO()).\n\t\tInto(&result)\n\treturn\n}", "func (fieldMask UpdateAlertingPolicyRequest_CAS_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (x *fastReflection_Bech32PrefixResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.auth.v1beta1.Bech32PrefixResponse.bech32_prefix\":\n\t\tpanic(fmt.Errorf(\"field bech32_prefix of message cosmos.auth.v1beta1.Bech32PrefixResponse is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.auth.v1beta1.Bech32PrefixResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.auth.v1beta1.Bech32PrefixResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "func (x *fastReflection_QueryAccountAddressByIDResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.auth.v1beta1.QueryAccountAddressByIDResponse.account_address\":\n\t\tpanic(fmt.Errorf(\"field account_address of message cosmos.auth.v1beta1.QueryAccountAddressByIDResponse is not mutable\"))\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.auth.v1beta1.QueryAccountAddressByIDResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.auth.v1beta1.QueryAccountAddressByIDResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "func (m *AssignmentDefaultsRequestBuilder) CreatePatchRequestInformation(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.EducationAssignmentDefaultsable, requestConfiguration *AssignmentDefaultsRequestBuilderPatchRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.urlTemplate\n requestInfo.PathParameters = m.pathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.PATCH\n requestInfo.Headers[\"Accept\"] = \"application/json\"\n requestInfo.SetContentFromParsable(ctx, m.requestAdapter, \"application/json\", body)\n if requestConfiguration != nil {\n requestInfo.AddRequestHeaders(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "func (c *OrganizationsSecurityProfilesPatchCall) UpdateMask(updateMask string) *OrganizationsSecurityProfilesPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (fieldMask ConnectResponse_ResumeResponse_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (m *ShiftPreferencesRequestBuilder) CreatePatchRequestInformation(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ShiftPreferencesable, requestConfiguration *ShiftPreferencesRequestBuilderPatchRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.urlTemplate\n requestInfo.PathParameters = m.pathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.PATCH\n requestInfo.Headers[\"Accept\"] = \"application/json\"\n requestInfo.SetContentFromParsable(ctx, m.requestAdapter, \"application/json\", body)\n if requestConfiguration != nil {\n requestInfo.AddRequestHeaders(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "func (i PreserveFields) ApplyToHelper(opts *PatchOptions) {\n\topts.preserveFields = i\n}", "func (m *ChatItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Chatable, requestConfiguration *ChatItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Chatable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateChatFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Chatable), nil\n}", "func (b *Builder) PatchOffset(patchedOffset, patch dwarf.Offset) {\n\tinfoBytes := b.info.Bytes()\n\tbuf := new(bytes.Buffer)\n\tbinary.Write(buf, binary.LittleEndian, patch)\n\tcopy(infoBytes[patchedOffset:], buf.Bytes())\n}", "func (service *EmployeeService) PatchEmployeeDetails(employeeID string, employeeDetails models.Employee) error {\n\tcollection := service.mongoClient.Database(DbName).Collection(CollectionName)\n\tupdatesToBePerformed := bson.M{}\n\tupdatesToBePerformed[\"employeeid\"] = employeeID\n\tif employeeDetails.Department != nil {\n\t\tupdatesToBePerformed[\"department\"] = employeeDetails.Department\n\t}\n\n\tif employeeDetails.Name != nil {\n\t\tupdatesToBePerformed[\"name\"] = employeeDetails.Name\n\t}\n\n\tif employeeDetails.Skills != nil {\n\t\tupdatesToBePerformed[\"skills\"] = employeeDetails.Skills\n\t}\n\n\tif employeeDetails.Address != nil {\n\t\taddress := models.Address{}\n\t\tif employeeDetails.Address.City != nil {\n\t\t\taddress.City = employeeDetails.Address.City\n\t\t}\n\n\t\tif employeeDetails.Address.Country != nil {\n\t\t\taddress.Country = employeeDetails.Address.Country\n\t\t}\n\n\t\tif employeeDetails.Address.DoorNo != nil {\n\t\t\taddress.DoorNo = employeeDetails.Address.DoorNo\n\t\t}\n\n\t\tif employeeDetails.Address.State != nil {\n\t\t\taddress.State = employeeDetails.Address.State\n\t\t}\n\n\t\tupdatesToBePerformed[\"address\"] = address\n\t}\n\n\tif employeeDetails.Status != nil {\n\t\tupdatesToBePerformed[\"status\"] = employeeDetails.Status\n\t}\n\n\t// consolidatedMap(&updatesToBePerformed, employeeDetails)\n\n\tresult, err := collection.UpdateOne(\n\t\tcontext.Background(),\n\t\tbson.M{\"employeeid\": employeeID},\n\t\tbson.M{\n\t\t\t\"$set\": updatesToBePerformed,\n\t\t})\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tfmt.Println(result)\n\n\treturn nil\n}", "func (fieldMask ListMonitoredResourceDescriptorsRequest_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (a *APIPatchingApplicator) Apply(ctx context.Context, o client.Object, ao ...ApplyOption) error {\n\tif o.GetNamespace() == \"\" {\n\t\to.SetNamespace(\"default\")\n\t}\n\n\tm, ok := o.(metav1.Object)\n\tif !ok {\n\t\treturn errors.New(\"cannot access object metadata\")\n\t}\n\n\tif m.GetName() == \"\" && m.GetGenerateName() != \"\" {\n\t\treturn errors.Wrap(a.client.Create(ctx, o), \"cannot create object\")\n\t}\n\n\tdesired := o.DeepCopyObject()\n\n\terr := a.client.Get(ctx, types.NamespacedName{Name: m.GetName(), Namespace: m.GetNamespace()}, o)\n\tif kerrors.IsNotFound(err) {\n\t\t// TODO: Apply ApplyOptions here too?\n\t\treturn errors.Wrap(a.client.Create(ctx, o), \"cannot create object\")\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot get object\")\n\t}\n\n\tfor _, fn := range ao {\n\t\tif err := fn(ctx, o, desired); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// TODO: Allow callers to override the kind of patch used.\n\treturn errors.Wrap(a.client.Patch(ctx, o, &patch{desired.(client.Object)}), \"cannot patch object\")\n}", "func (handler *profileHandler) Patch(ctx context.Context, req *proto.ProfilePatchRequest, rsp *proto.ProfileData) (err error) {\n\tprofileInstance := handler.getProfileInstance(req.GetId())\n\tprofileInstance.SetAvatar(req.Avatar)\n\terr = profileInstance.SetLocation(req.Location)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprofileInstance.SetSkype(req.Skype)\n\terr = profileInstance.Save()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thandler.setProfileDataToResponse(profileInstance, rsp)\n\n\treturn nil\n}", "func (p *Permission) GetPatch() (map[string]interface{}, error) {\n\tpatch := make(map[string]interface{})\n\n\tif p.Owner != \"\" {\n\t\tpatch[\"owner\"] = p.Owner\n\t}\n\tif p.Username != \"\" {\n\t\treturn nil, errors.NewUnsupportedPatchError(\"permission\", \"username\")\n\t}\n\tif p.Password != \"\" {\n\t\treturn nil, errors.NewUnsupportedPatchError(\"permission\", \"password\")\n\t}\n\tif p.Creator != \"\" {\n\t\treturn nil, errors.NewUnsupportedPatchError(\"permission\", \"creator\")\n\t}\n\tif p.Categories != nil {\n\t\tpatch[\"categories\"] = p.Categories\n\t\tif p.ACLs != nil {\n\t\t\tif err := p.ValidateACLs(p.ACLs...); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tpatch[\"acls\"] = p.ACLs\n\t\t} else {\n\t\t\tpatch[\"acls\"] = category.ACLsFor(p.Categories...)\n\t\t}\n\t}\n\tif p.Ops != nil {\n\t\tpatch[\"ops\"] = p.Ops\n\t}\n\tif p.Indices != nil {\n\t\tpatch[\"indices\"] = p.Indices\n\t}\n\tif p.Sources != nil {\n\t\tif err := validateSources(p.Sources); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpatch[\"sources\"] = p.Sources\n\t}\n\tif p.Referers != nil {\n\t\tif err := validateReferers(p.Referers); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpatch[\"referers\"] = p.Referers\n\t}\n\tif p.CreatedAt != \"\" {\n\t\treturn nil, errors.NewUnsupportedPatchError(\"permission\", \"created_at\")\n\t}\n\tif p.TTL.String() != \"0s\" {\n\t\tpatch[\"ttl\"] = p.TTL\n\t}\n\t// Cannot patch individual limits to 0\n\tif p.Limits != nil {\n\t\tlimits := make(map[string]interface{})\n\t\tif p.Limits.IPLimit != 0 {\n\t\t\tlimits[\"ip_limit\"] = p.Limits.IPLimit\n\t\t}\n\t\tif p.Limits.DocsLimit != 0 {\n\t\t\tlimits[\"docs_limit\"] = p.Limits.DocsLimit\n\t\t}\n\t\tif p.Limits.SearchLimit != 0 {\n\t\t\tlimits[\"search_limit\"] = p.Limits.SearchLimit\n\t\t}\n\t\tif p.Limits.IndicesLimit != 0 {\n\t\t\tlimits[\"indices_limit\"] = p.Limits.IndicesLimit\n\t\t}\n\t\tif p.Limits.CatLimit != 0 {\n\t\t\tlimits[\"cat_limit\"] = p.Limits.CatLimit\n\t\t}\n\t\tif p.Limits.ClustersLimit != 0 {\n\t\t\tlimits[\"clusters_limit\"] = p.Limits.ClustersLimit\n\t\t}\n\t\tif p.Limits.MiscLimit != 0 {\n\t\t\tlimits[\"misc_limit\"] = p.Limits.MiscLimit\n\t\t}\n\t\tpatch[\"limits\"] = limits\n\t}\n\tif p.Description != \"\" {\n\t\tpatch[\"description\"] = p.Description\n\t}\n\n\treturn patch, nil\n}", "func (x *fastReflection_QueryAccountInfoResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tswitch fd.FullName() {\n\tcase \"cosmos.auth.v1beta1.QueryAccountInfoResponse.info\":\n\t\tif x.Info == nil {\n\t\t\tx.Info = new(BaseAccount)\n\t\t}\n\t\treturn protoreflect.ValueOfMessage(x.Info.ProtoReflect())\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.auth.v1beta1.QueryAccountInfoResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.auth.v1beta1.QueryAccountInfoResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "func (m *ItemTermStoreGroupsGroupItemRequestBuilder) Patch(ctx context.Context, body ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.Groupable, requestConfiguration *ItemTermStoreGroupsGroupItemRequestBuilderPatchRequestConfiguration)(ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.Groupable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.CreateGroupFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.Groupable), nil\n}" ]
[ "0.68944365", "0.6709619", "0.6301576", "0.6023577", "0.59261936", "0.58738303", "0.53895783", "0.52678984", "0.5183263", "0.51596296", "0.5065274", "0.5012141", "0.4974999", "0.49678084", "0.4946724", "0.4827448", "0.47386423", "0.4725287", "0.4687354", "0.46094146", "0.4591762", "0.45882094", "0.4581174", "0.45793536", "0.4566458", "0.45374462", "0.45334655", "0.45280072", "0.45277336", "0.4522703", "0.45006236", "0.44746363", "0.44665933", "0.44659188", "0.4454249", "0.4444732", "0.44239536", "0.44227827", "0.44149968", "0.43944463", "0.43862182", "0.43824562", "0.43819728", "0.43758243", "0.43746436", "0.4360057", "0.43571395", "0.43526757", "0.4351507", "0.4350739", "0.43407062", "0.43377578", "0.43333185", "0.43227232", "0.43178746", "0.43165824", "0.43148056", "0.4304304", "0.4300212", "0.42990708", "0.42989364", "0.42904413", "0.42841616", "0.4282886", "0.42822704", "0.4276233", "0.4275292", "0.42654148", "0.4258195", "0.42561385", "0.42512712", "0.4248263", "0.42452478", "0.42444107", "0.42426383", "0.42407385", "0.42388323", "0.42372733", "0.42340967", "0.42337698", "0.4226868", "0.42214304", "0.42178166", "0.42169988", "0.42151117", "0.41996422", "0.4197058", "0.4193142", "0.41915902", "0.41901252", "0.41895583", "0.4187222", "0.4181302", "0.41767234", "0.4176093", "0.41745922", "0.4173161", "0.4171399", "0.4166181", "0.4162787" ]
0.7750504
0
DefaultListHealthMenstruationPersonalInfo executes a gorm list call
DefaultListHealthMenstruationPersonalInfo выполняет вызов gorm list
func DefaultListHealthMenstruationPersonalInfo(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*HealthMenstruationPersonalInfo, error) { in := HealthMenstruationPersonalInfo{} ormObj, err := in.ToORM(ctx) if err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeListApplyQuery); ok { if db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil { return nil, err } } db, err = gorm2.ApplyCollectionOperators(ctx, db, &HealthMenstruationPersonalInfoORM{}, &HealthMenstruationPersonalInfo{}, f, s, p, fs) if err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeListFind); ok { if db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil { return nil, err } } db = db.Where(&ormObj) db = db.Order("id") ormResponse := []HealthMenstruationPersonalInfoORM{} if err := db.Find(&ormResponse).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterListFind); ok { if err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil { return nil, err } } pbResponse := []*HealthMenstruationPersonalInfo{} for _, responseEntry := range ormResponse { temp, err := responseEntry.ToPB(ctx) if err != nil { return nil, err } pbResponse = append(pbResponse, &temp) } return pbResponse, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DefaultReadHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, 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 == 0 {\n\t\treturn nil, errors1.EmptyIdError\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeReadApplyQuery); ok {\n\t\tif db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &HealthMenstruationPersonalInfoORM{}); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeReadFind); ok {\n\t\tif db, err = hook.BeforeReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tormResponse := HealthMenstruationPersonalInfoORM{}\n\tif err = db.Where(&ormObj).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormResponse).(HealthMenstruationPersonalInfoORMWithAfterReadFind); ok {\n\t\tif err = hook.AfterReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultListHealthMenstruationDailyEntry(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*HealthMenstruationDailyEntry, error) {\n\tin := HealthMenstruationDailyEntry{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm2.ApplyCollectionOperators(ctx, db, &HealthMenstruationDailyEntryORM{}, &HealthMenstruationDailyEntry{}, f, s, p, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []HealthMenstruationDailyEntryORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*HealthMenstruationDailyEntry{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func DefaultListUserInfo(ctx context.Context, db *gorm.DB) ([]*UserInfo, error) {\n\tin := UserInfo{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm1.ApplyCollectionOperators(ctx, db, &UserInfoORM{}, &UserInfo{}, nil, nil, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []UserInfoORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*UserInfo{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func DefaultCreateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, 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 hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeCreate_); ok {\n\t\tif db, err = hook.BeforeCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterCreate_); ok {\n\t\tif err = hook.AfterCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultPatchSetHealthMenstruationPersonalInfo(ctx context.Context, objects []*HealthMenstruationPersonalInfo, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*HealthMenstruationPersonalInfo, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*HealthMenstruationPersonalInfo, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchHealthMenstruationPersonalInfo(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func DefaultPatchHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj HealthMenstruationPersonalInfo\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadHealthMenstruationPersonalInfo(ctx, &HealthMenstruationPersonalInfo{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskHealthMenstruationPersonalInfo(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(HealthMenstruationPersonalInfoWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func (h *User) List(w http.ResponseWriter, r *http.Request) {\n\tlimit, offset := utils.GetPaginationParams(r.URL.Query())\n\tresp, err := h.Storage.GetUserList(limit, offset)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tR.JSON500(w)\n\t\treturn\n\t}\n\n\tif len(resp) < 1 {\n\t\tR.JSON404(w)\n\t\treturn\n\t}\n\n\tR.JSON200(w, resp)\n}", "func (us UserService) List(dto dto.GeneralListDto) ([]model.User, int64) {\n\treturn userDao.List(dto)\n}", "func (srv *UsersService) ListHandler(ctx *gin.Context) {\n\tlogger := srv.logger.New(\"action\", \"ListHandler\")\n\n\tcurrentUser := GetCurrentUser(ctx)\n\n\tlimitQuery := ctx.DefaultQuery(\"limit\", \"10\")\n\tpageQuery := ctx.DefaultQuery(\"page\", \"1\")\n\tparams := ctx.Request.URL.Query()\n\n\tvar adminsRoleIncluded = false\n\n\troles := params[\"filter[role_name]\"]\n\tif len(roles) > 0 {\n\t\tfor key, role := range roles {\n\t\t\t// remove root from role names if user is not root\n\t\t\t// only root can see root users\n\t\t\tif role == models.RoleRoot && currentUser.RoleName != models.RoleRoot {\n\t\t\t\tcopy(roles[key:], roles[key+1:])\n\t\t\t\troles[len(roles)-1] = \"\"\n\t\t\t\troles = roles[:len(roles)-1]\n\t\t\t}\n\t\t\tif role == models.RoleRoot || role == models.RoleAdmin {\n\t\t\t\tadminsRoleIncluded = true\n\t\t\t}\n\t\t}\n\t} else {\n\t\tadminsRoleIncluded = true\n\t}\n\n\tvar hasPerm bool\n\tif adminsRoleIncluded {\n\t\thasPerm = srv.PermissionsService.CanViewAdminProfile(currentUser.UID)\n\t} else {\n\t\thasPerm = srv.PermissionsService.CanViewUserProfile(currentUser.UID)\n\t}\n\n\tif !hasPerm {\n\t\tsrv.ResponseService.Forbidden(ctx)\n\t\treturn\n\t}\n\n\tquery := srv.Repository.GetUsersRepository().Filter(params)\n\n\tpagination, err := srv.Repository.GetUsersRepository().Paginate(query, pageQuery, limitQuery, serializers.NewUsers())\n\tif err != nil {\n\t\tlogger.Error(\"сan't load list of user\", \"error\", err)\n\t\t// Returns a \"400 StatusBadRequest\" response\n\t\tsrv.ResponseService.Error(ctx, responses.CannotRetrieveCollection, \"Can't load list of users\")\n\t\treturn\n\t}\n\n\t// Returns a \"200 OK\" response\n\tsrv.ResponseService.OkResponse(ctx, pagination)\n}", "func (h *Handler) list() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tentities, err := h.UserDAO.FetchAll(r.Context())\n\t\tswitch {\n\t\tcase errors.Is(err, errorx.ErrNoUser):\n\t\t\tmsg := &errorMessage{\n\t\t\t\tMessage: fmt.Sprintf(\"no users exist\"),\n\t\t\t}\n\t\t\tresponse.JSON(w, http.StatusNotFound, msg)\n\t\t\treturn\n\t\tcase err != nil:\n\t\t\tmsg := &errorMessage{\n\t\t\t\tError: err.Error(),\n\t\t\t\tMessage: \"user datastore error\",\n\t\t\t}\n\t\t\tresponse.JSON(w, http.StatusInternalServerError, msg)\n\t\t\treturn\n\t\tdefault:\n\t\t\tresponse.JSON(w, http.StatusOK, entities)\n\t\t}\n\t}\n}", "func (client PermissionsClient) ListByBillingProfileResponder(resp *http.Response) (result PermissionsListResult, 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}", "func (h WorkloadHandler) List(ctx *gin.Context) {\n}", "func (UserService) List(ctx context.Context, gdto dto.GeneralListDto) ([]model.User, int64) {\n\tcols := \"*\"\n\tgdto.Q, cols = dataPermService.DataPermFilter(ctx, \"users\", gdto)\n\treturn userDao.List(gdto, cols)\n}", "func (hh *HealthCheckHandler) List(w http.ResponseWriter, r *http.Request) {\n\tqueryParams := r.URL.Query()\n\tpage, err := strconv.Atoi(queryParams[\"page\"][0])\n\tif err != nil {\n\t\thttp.Error(w, marshalError(err.Error()), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tlist := hh.db.List()\n\tsort.Sort(models.HealthChecks(list))\n\tstart, end := paginate(page, 10, len(list))\n\tpaginated := list[start:end]\n\n\tres := &models.HealthCheckList{\n\t\tItems: paginated,\n\t\tTotal: len(list),\n\t\tPage: page,\n\t\tSize: 10,\n\t}\n\n\tb, err := json.Marshal(res)\n\tif err != nil {\n\t\thttp.Error(w, marshalError(err.Error()), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Write(b)\n}", "func genericListHandler(options CrudOptions) uhttp.Handler {\n\tvar middlewares []uhttp.Middleware\n\tif options.ListPermission != nil {\n\t\tmiddlewares = []uhttp.Middleware{uauth.AuthJWT()}\n\t}\n\treturn uhttp.NewHandler(\n\t\tuhttp.WithPreProcess(options.ListPreprocess),\n\t\tuhttp.WithMiddlewares(middlewares...),\n\t\tuhttp.WithRequiredGet(options.ListRequiredGet),\n\t\tuhttp.WithOptionalGet(options.ListOptionalGet),\n\t\tuhttp.WithGet(func(r *http.Request, ret *int) interface{} {\n\t\t\t// Sanity check: ListOthersPermission can only be set if ListPermission is set\n\t\t\tif options.ListPermission == nil && options.ListOthersPermission != nil {\n\t\t\t\t*ret = http.StatusInternalServerError\n\t\t\t\treturn map[string]string{\"err\": \"Configuration problem: ListOthersPermission can only be set if ListPermission is set.\"}\n\t\t\t}\n\n\t\t\t// Check permissions\n\t\t\tvar limitToUser *uauth.User\n\t\t\tvar tmpUser *uauth.User\n\t\t\tvar err error\n\t\t\tif options.ListPermission != nil {\n\t\t\t\t// Return nothing, if listPermission is required but the user does not have it\n\t\t\t\ttmpUser, err = uauth.UserFromRequest(r)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"Could not get user (%s)\", err)\n\t\t\t\t}\n\n\t\t\t\tif !tmpUser.CheckPermission(*options.ListPermission) {\n\t\t\t\t\treturn fmt.Errorf(\"User does not have the required permission: %s\", *options.ListPermission)\n\t\t\t\t}\n\n\t\t\t\t// Limit results if ListOthersPermission is required but the user does not have it\n\t\t\t\tif options.ListOthersPermission != nil {\n\t\t\t\t\tif !tmpUser.CheckPermission(*options.ListOthersPermission) {\n\t\t\t\t\t\tlimitToUser = tmpUser\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Load\n\t\t\tobjsFromDb, err := options.ModelService.List(limitToUser != nil, r.Context())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// Render Response\n\t\t\treturn objsFromDb\n\t\t}),\n\t)\n}", "func (rm *RequestManager) ListHandler(w http.ResponseWriter, r *http.Request) {\n\tperson := &rm.Person;\n\tif r.Method != \"GET\" {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t}\n\n\tlogger.log(\"GET /list \" + r.URL.Path)\n\n\tdata, err := person.GetList(w)\n\tif(err == nil) {\n\t\tjson.NewEncoder(w).Encode(&data)\n\t}\n}", "func (h *Handlers) ListHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method == \"POST\" {\n\t\tfirstnameInput := strings.Trim(r.FormValue(\"firstname\"), \" \")\n\t\tlastnameInput := strings.Trim(r.FormValue(\"lastname\"), \" \")\n\n\t\tif h.ValidInput.MatchString(firstnameInput) && h.ValidInput.MatchString(lastnameInput) {\n\t\t\tperson := entity.Person{\n\t\t\t\tFirstname: firstnameInput,\n\t\t\t\tLastname: lastnameInput,\n\t\t\t}\n\t\t\th.DBClient.InsertPerson(person)\n\t\t}\n\n\t\thttp.Redirect(w, r, \"/\", http.StatusMovedPermanently)\n\t}\n\n\tpersons, err := h.DBClient.GetPersons()\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Println(err)\n\t}\n\n\terr = h.ListTemplate.ExecuteTemplate(w, \"layout\", struct{ Persons []entity.Person }{persons})\n\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Println(err)\n\t}\n}", "func DefaultListProfile(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*Profile, error) {\n\tin := Profile{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(ProfileORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm2.ApplyCollectionOperators(ctx, db, &ProfileORM{}, &Profile{}, f, s, p, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(ProfileORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []ProfileORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(ProfileORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*Profile{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func LitUsersUnderHim(w http.ResponseWriter, r *http.Request) { \n w.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n t, err := template.ParseFiles(\"templates/listUsersUnderHim.html\")\n\n userDetails := getSession(r)\n\n AuthorizePages(w,r)\n if err != nil {\n fmt.Println(err) // Ugly debug output\n w.WriteHeader(http.StatusInternalServerError) // Proper HTTP response\n return\n }\n \n if err != nil {\n fmt.Println(err)\n }\n var userList []helpers.User\n var listLen int\n var failedMessage string\n var isShow bool = false\n\n userList = dbquery.GetUserByMngrList(userDetails.UserId)\n listLen = len(userList);\n\n if listLen == 0 {\n isShow = true\n failedMessage = \"Currently you are not assigned for any User\"\n } \n\n t.Execute(w, AllUsersResponse{Users: userList, ListLen: listLen, FailedMessage: failedMessage, IsShow: isShow}) \n}", "func userList(w http.ResponseWriter, r *http.Request) {}", "func (u *User) List(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error {\n\tctx, span := trace.StartSpan(ctx, \"handlers.User.List\")\n\tdefer span.End()\n\n\tusers, err := user.List(ctx, u.db)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn web.Respond(ctx, w, users, http.StatusOK)\n}", "func DefaultApplyFieldMaskHealthMenstruationPersonalInfo(ctx context.Context, patchee *HealthMenstruationPersonalInfo, patcher *HealthMenstruationPersonalInfo, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"ProfileId\" {\n\t\t\tpatchee.ProfileId = patcher.ProfileId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"PeriodLengthInDays\" {\n\t\t\tpatchee.PeriodLengthInDays = patcher.PeriodLengthInDays\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CycleLengthInDays\" {\n\t\t\tpatchee.CycleLengthInDays = patcher.CycleLengthInDays\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func list(s *discordgo.Session, m *discordgo.MessageCreate) error {\n\tch, err := s.State.Channel(m.ChannelID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmembers, err := getChamberMembers(s, ch)\n\tif err != nil {\n\t\tif err == ERR_NOT_A_CHAMBER {\n\t\t\t_, err = s.ChannelMessageSend(m.ChannelID, err.Error())\n\t\t}\n\t\treturn err\n\t}\n\n\tmessage := ch.Mention() + \" members:\\n\\n\"\n\tfor _, member := range members {\n\t\tuser := member.User\n\t\tmessage += user.Username + \"#\" + user.Discriminator + \"\\n\"\n\t}\n\n\t_, err = s.ChannelMessageSend(m.ChannelID, message)\n\treturn err\n}", "func listHandler(w http.ResponseWriter, user datastore.User, apiCall bool) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\n\terr := auth.CheckUserPermissions(user, datastore.Admin, apiCall)\n\tif err != nil {\n\t\tresponse.FormatStandardResponse(false, response.ErrorAuth.Code, \"\", \"\", w)\n\t\treturn\n\t}\n\n\tkeypairs, err := datastore.Environ.DB.ListAllowedKeypairs(user)\n\tif err != nil {\n\t\tresponse.FormatStandardResponse(false, response.ErrorFetchKeypairs.Code, \"\", err.Error(), w)\n\t\treturn\n\t}\n\n\t// Return successful JSON response with the list of keypairs\n\tw.WriteHeader(http.StatusOK)\n\tformatListResponse(true, \"\", \"\", \"\", keypairs, w)\n}", "func DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateHealthMenstruationPersonalInfo\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &HealthMenstruationPersonalInfoORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func ForPersonalLoans(httpCrawlService func(string, string, int) ([]byte, common.CustomError), baseURL string, page int, accumulator []personalloan.Entity) (*[]personalloan.Entity, common.CustomError) {\n\n\tfmt.Println(\"Start crawl personal loans for\", baseURL, page)\n\n\tbody, crawlErr := httpCrawlService(baseURL, \"products-services/v1/personal-loans\", page)\n\n\tif crawlErr != nil {\n\t\tfmt.Println(crawlErr)\n\t}\n\n\tjsonData := &personalLoanJSON{}\n\n\tmetaInfo := &MetaInfoJSON{}\n\tjson.Unmarshal(body, &metaInfo)\n\n\tjsonUnmarshallErr := json.Unmarshal(body, &jsonData)\n\n\tif jsonUnmarshallErr != nil {\n\t\tfmt.Printf(\"Error crawl personal loans for %s %s %s\", baseURL, strconv.Itoa(page), jsonUnmarshallErr)\n\t\treturn nil, common.NewInternalServerError(\"Unable to unmarshall data\", jsonUnmarshallErr)\n\t}\n\n\titems := accumulator\n\n\tfor i := range jsonData.Data.Brand.Companies {\n\t\tcompany := jsonData.Data.Brand.Companies[i]\n\t\tresult := company.PersonalLoans\n\t\titems = append(items, result...)\n\t}\n\n\tif metaInfo.Meta.TotalPages > page {\n\t\treturn ForPersonalLoans(httpCrawlService, baseURL, page+1, items)\n\t}\n\n\tfmt.Println(\"End crawl personal loans for\", baseURL, page)\n\n\treturn &items, nil\n\n}", "func (h *accountHandler) List(ctx context.Context, req *api.Request, rsp *api.Response) error {\n\tlog.Info(\"Received Example.Call request\")\n\n\t// parse values from the get request\n\tlimitStr, ok := req.Get[\"limit\"]\n\n\tif !ok || len(limitStr.Values) == 0 {\n\t\treturn errors.BadRequest(\"go.micro.api.account\", \"no content\")\n\t}\n\n\tlimit, _ := strconv.Atoi(limitStr.Values[0])\n\t// make request\n\tresponse, err := h.userSrvClient.List(ctx, &userPB.UserListQuery{\n\t\tLimit: &wrappers.UInt32Value{Value: uint32(limit)},\n\t\tPage: &wrappers.UInt32Value{Value: 1},\n\t})\n\tif err != nil {\n\t\treturn errors.InternalServerError(\"go.micro.api.account.call\", err.Error())\n\t}\n\tlog.Info(response)\n\n\t// set response status\n\trsp.StatusCode = 200\n\n\t// respond with some json\n\tb, _ := json.Marshal(response)\n\n\t// set json body\n\trsp.Body = string(b)\n\n\treturn nil\n}", "func (gs *GreetingService) List(c endpoints.Context, r *GreetingsListReq) (*GreetingsList, error) {\n\tif r.Limit <= 0 {\n\t\tr.Limit = 10\n\t}\n\n\tq := datastore.NewQuery(\"Greeting\").Limit(r.Limit)\n\tgreets := make([]*Greeting, 0, r.Limit)\n\tkeys, err := q.GetAll(c, &greets)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor i, k := range keys {\n\t\tgreets[i].Key = k\n\t}\n\treturn &GreetingsList{greets}, nil\n}", "func (up *userProvider) List(ctx context.Context) ([]models.User, error) {\n\tusers, err := up.userStore.List(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn users, nil\n}", "func listPeopleOnActivity(echoReq *alexa.EchoRequest, col *mgo.Collection, user *User) *alexa.EchoResponse {\n\tmsg := \"\"\n\n\t//get activity name from request\n\tactivityName, errActivity := echoReq.GetSlotValue(\"activity\")\n\n\t//if there was an error getting the activity slot value\n\tif errActivity != nil {\n\t\tlog.Println(\"error\")\n\t\tmsg = \"There was an error with your activity name\"\n\t\techoResp := alexa.NewEchoResponse().OutputSpeech(msg).EndSession(false)\n\t\treturn echoResp\n\t}\n\n\t//get index of specific activity\n\tactivityIndex := getActivityIndex(user.Activities, activityName)\n\n\tswitch len(user.Activities[activityIndex].People) {\n\n\tcase 0:\n\t\tmsg = \"There is no one currently assigned to \" + activityName\n\n\tcase 1:\n\t\tmsg = user.Activities[activityIndex].People[0] + \" is the only one assigned to \" + activityName\n\n\tdefault:\n\t\tpeopleLen := strconv.Itoa(len(user.Activities[activityIndex].People))\n\t\tmsg = \"You have \" + peopleLen + \" people on this activity \"\n\n\t\t//loop through all people on an activity and formulate a response message\n\t\tfor index, person := range user.Activities[activityIndex].People {\n\t\t\tif index == len(user.Activities[activityIndex].People)-1 {\n\t\t\t\tmsg = msg + \" and \" + person + \" \"\n\t\t\t} else {\n\t\t\t\tmsg = msg + person + \" \"\n\t\t\t}\n\t\t}\n\t}\n\n\t//return a response with message of people on a specfiic activity\n\techoResp := alexa.NewEchoResponse().OutputSpeech(msg).EndSession(false)\n\treturn echoResp\n\n}", "func GetPeople() models.People { return people }", "func ListAllUsers(w http.ResponseWriter, r *http.Request) {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusBadRequest, \"Mohomaaf ...dsb\", nil, nil)\n\t\t}\n\t}()\n\n\tfLog := userMgmtLogger.WithField(\"func\", \"ListAllUsers\").WithField(\"RequestID\", r.Context().Value(constants.RequestID)).WithField(\"path\", r.URL.Path).WithField(\"method\", r.Method)\n\n\tiauthctx := r.Context().Value(constants.HansipAuthentication)\n\tif iauthctx == nil {\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusUnauthorized, \"You are not authorized to access this resource\", nil, nil)\n\t\treturn\n\t}\n\n\tfLog.Trace(\"Listing Users\")\n\tpageRequest, err := helper.NewPageRequestFromRequest(r)\n\tif err != nil {\n\t\tfLog.Errorf(\"helper.NewPageRequestFromRequest got %s\", err.Error())\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusBadRequest, err.Error(), nil, nil)\n\t\treturn\n\t}\n\tusers, page, err := UserRepo.ListUser(r.Context(), pageRequest)\n\tif err != nil {\n\t\tfLog.Errorf(\"UserRepo.ListUser got %s\", err.Error())\n\t\thelper.WriteHTTPResponse(r.Context(), w, http.StatusInternalServerError, err.Error(), nil, nil)\n\t\treturn\n\t}\n\tsusers := make([]*SimpleUser, len(users))\n\tfor i, v := range users {\n\t\tsusers[i] = &SimpleUser{\n\t\t\tRecID: v.RecID,\n\t\t\tEmail: v.Email,\n\t\t\tEnabled: v.Enabled,\n\t\t\tSuspended: v.Suspended,\n\t\t}\n\t}\n\tret := make(map[string]interface{})\n\tret[\"users\"] = susers\n\tret[\"page\"] = page\n\thelper.WriteHTTPResponse(r.Context(), w, http.StatusOK, \"List of all user paginated\", nil, ret)\n}", "func List(w http.ResponseWriter, r *http.Request) {\n\tauthUser, err := auth.GetUserFromJWT(w, r)\n\tif err != nil {\n\t\tresponse.FormatStandardResponse(false, \"error-auth\", \"\", err.Error(), w)\n\t\treturn\n\t}\n\n\tlistHandler(w, authUser, false)\n}", "func (gs *GreetingService) List(c endpoints.Context, r *GreetingsListReq) (*GreetingsList, error) {\n\tif r.Limit <= 0 {\n\t\tr.Limit = 10\n\t}\n\n\tq := datastore.NewQuery(\"Greeting\").Order(\"-Date\").Limit(r.Limit)\n\tgreets := make([]*Greeting, 0, r.Limit)\n\tkeys, err := q.GetAll(c, &greets)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor i, k := range keys {\n\t\tgreets[i].Key = k\n\t}\n\treturn &GreetingsList{greets}, nil\n}", "func (p *PersonServer) ListPerson(query *higrpc.PersonQuery, stream higrpc.PersonRoute_ListPersonServer) error {\n\tfmt.Println(\"PersonServer::ListPerson is called. id :\", query.Id, \", name :\", query.Name)\n\n\t// ignore query fields, only send hard coded responses\n\tfor i := 0; i < 5; i++ {\n\t\t_ = stream.Send(&higrpc.PersonResponse{\n\t\t\tId: int64(i),\n\t\t\tName: \"Person\" + strconv.Itoa(i),\n\t\t\tAge: int32(i),\n\t\t})\n\t}\n\treturn nil\n}", "func GetPeople(db *gorm.DB) func(c echo.Context) error {\n return func(c echo.Context) error {\n // get user\n if user, err := GetUser(c, db); err == nil {\n people := []models.User{}\n // get search key\n key := c.QueryParam(\"key\")\n if len(key) > 0 {\n key := \"%\" + key + \"%\"\n // search for other people but user\n db.Where(\"user_name LIKE ? OR email LIKE ? OR first_name LIKE ? OR last_name LIKE ?\", key, key, key, key).\n Not(\"id = ?\", user.ID).\n Find(&people)\n }\n return c.JSON(http.StatusOK, people)\n } else {\n return c.JSON(http.StatusBadRequest, map[string]string{\"message\": err.Error()})\n }\n }\n}", "func ViewListOtherManagers(w http.ResponseWriter, r *http.Request) { \n w.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n t, err := template.ParseFiles(\"templates/viewListOtherManagers.html\")\n\n userDetails := getSession(r)\n\n AuthorizePages(w,r)\n if err != nil {\n fmt.Println(err) // Ugly debug output\n w.WriteHeader(http.StatusInternalServerError) // Proper HTTP response\n return\n }\n \n if err != nil {\n fmt.Println(err)\n }\n var managerList []helpers.User\n var listLen int\n var failedMessage string\n var isShow bool = false\n\n managerList = dbquery.GetManagerList()\n listLen = len(managerList);\n\n var managerList1 []helpers.User\n\n for i := 0; i < listLen; i++ {\n if managerList[i].UserId != userDetails.UserId {\n managerList1 = append(managerList1, helpers.User{\n FirstName: managerList[i].FirstName,\n LastName: managerList[i].LastName,\n UserId: managerList[i].UserId,\n })\n }\n }\n if listLen == 0 {\n isShow = true\n failedMessage = \"Currently you are not assigned for any User\"\n } \n\n t.Execute(w, AllUsersResponse{Users: managerList1, ListLen: listLen, FailedMessage: failedMessage, IsShow: isShow}) \n}", "func (db database) list(w http.ResponseWriter, req *http.Request) {\n\n\tif err := itemList.Execute(w, db); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func GetAllPerson(c *gin.Context) {\n\tperson, _ := models.LoadPeople()\n\tc.JSON(http.StatusOK, person)\n\n}", "func List(c echo.Context) error {\n\t// TODO: check authorized\n\tctx := ServerContext(c)\n\n\titem := reflect.New(ctx.Type).Interface().(gruff.ArangoObject)\n\n\tparams := item.DefaultQueryParameters()\n\tparams = params.Merge(GetListParametersFromRequest(c))\n\n\tuserID := ActiveUserID(c, ctx)\n\tfilters := gruff.BindVars{}\n\tvar query string\n\tif userID != \"\" && gruff.IsVersionedModel(ctx.Type) {\n\t\tfilters[\"creator\"] = userID\n\t\tquery = gruff.DefaultListQueryForUser(item, params)\n\t} else {\n\t\tquery = gruff.DefaultListQuery(item, params)\n\t}\n\n\titems := []interface{}{}\n\tif err := gruff.FindArangoObjects(ctx, query, filters, &items); err != nil {\n\t\treturn AddError(ctx, c, err)\n\t}\n\n\tctx.Payload[\"results\"] = items\n\treturn c.JSON(http.StatusOK, ctx.Payload)\n}", "func (core *Plugin) listAdmins(c cmd.Context) (string, slack.PostMessageParameters) {\n\tnoParams := slack.PostMessageParameters{}\n\tmembers := model.Members{}\n\tif err := core.Bot.DAL.GetAdmins(&members); err != nil {\n\t\tlog.WithError(err).Error(\"failed to get admins\")\n\t\treturn \"Failed to get admins\", noParams\n\t}\n\tnames := \"\"\n\tfor _, member := range members {\n\t\tnames += member.Name + \"\\n\"\n\t}\n\treturn names, noParams\n}", "func listProfiles(ctx context.Context, _ []string) error {\n\tm, err := cmdutils.LoadManager(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"%15s %s\\n\", \"ID\", \"NAME\")\n\tfor _, p := range m.Profiles() {\n\t\tfmt.Printf(\"%15s %s\\n\", p.Id, p.Name)\n\t}\n\n\treturn nil\n}", "func DefaultReadHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, 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 == 0 {\n\t\treturn nil, errors1.EmptyIdError\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeReadApplyQuery); ok {\n\t\tif db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &HealthMenstruationDailyEntryORM{}); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeReadFind); ok {\n\t\tif db, err = hook.BeforeReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tormResponse := HealthMenstruationDailyEntryORM{}\n\tif err = db.Where(&ormObj).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormResponse).(HealthMenstruationDailyEntryORMWithAfterReadFind); ok {\n\t\tif err = hook.AfterReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func (ps *PersonService) List(ids []int, opts ...FuncOption) ([]*Person, error) {\n\turl, err := ps.client.multiURL(PersonEndpoint, ids, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar p []*Person\n\n\terr = ps.client.get(url, &p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn p, nil\n}", "func (client JobClient) ListByAccountResponder(resp *http.Response) (result JobResourceDescriptionList, err error) {\n err = autorest.Respond(\n resp,\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByUnmarshallingJSON(&result),\n autorest.ByClosing())\n result.Response = autorest.Response{Response: resp}\n return\n }", "func AllLogManagementsGet(c *gin.Context) {\n\t// 分表注释下面两行代码\n\tmeta := model.TableMetaFromQuery(c)\n\tginutils.WriteGinJSON(c, http.StatusOK, model.AllLogManagements(meta))\n\t// 分表取消注释下面三行代码\n\t// meta := model.TableMetaFromQuery(c, \"suffix\")\n\t// suffix := c.Query(\"suffix\")\n\t// ginutils.WriteGinJSON(c, http.StatusOK, model.AllLogManagements(meta, suffix))\n}", "func (m *Mgr) List(ctx context.Context) ([]*User, error) {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\n\tusers, err := m.list(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// hide passwords\n\tfor _, u := range users {\n\t\tu.Password = \"\"\n\t}\n\treturn users, nil\n}", "func (s *Server) HandleListPeople(c *gin.Context) {\n\tqueryTeamID := c.Param(\"team-id\")\n\n\tteamID, err := strconv.ParseInt(queryTeamID, 10, 64)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\texists, err := s.teamExists(c.Request.Context(), teamID)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\tif !exists {\n\t\tc.AbortWithStatusJSON(http.StatusNotFound, gin.H{\"error\": \"Team not found.\"})\n\t\treturn\n\t}\n\n\tpeople, err := s.peopleService.ListPeople(c.Request.Context(), teamID)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"data\": people})\n}", "func (h UserHTTP) List(w http.ResponseWriter, r *http.Request) {\n\tlistRequest := listRequestDecoder(r)\n\tusers, err := h.svc.ListUsers(r.Context(), listRequest)\n\tif err != nil {\n\t\th.logger.With(r.Context()).Errorf(\"list users error : %s\", err)\n\t\trender.Render(w, r, e.BadRequest(err, \"bad request\"))\n\t\treturn\n\t}\n\trender.Respond(w, r, users)\n}", "func (p *Personal) All(ctx context.Context) (*[]PersonalData, error) {\n\tusrs, err := p.DB.All(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not select all personal data\")\n\t}\n\treturn usrs, nil\n}", "func GetAllPeople(w http.ResponseWriter, r *http.Request) {\n\tpeople := defaultPeople()\n\tresponseJSON(w, 200, people)\n}", "func (m *publicUser) GetUserList(c *gin.Context) (int, interface{}) {\n\tuser := plugins.CurrentPlugin(c, m.config.LoginVersion)\n\tuserList, err := user.GetUserList(c, m.config.ConfigMap)\n\trspBody := metadata.LonginSystemUserListResult{}\n\tif nil != err {\n\t\trspBody.Code = common.CCErrCommHTTPDoRequestFailed\n\t\trspBody.ErrMsg = err.Error()\n\t\trspBody.Result = false\n\t}\n\trspBody.Result = true\n\trspBody.Data = userList\n\treturn 200, rspBody\n}", "func (s *business) List(where repository.Example, order string, limit int32, page int32) (*repository.ExampleList, *response.Error) {\n\ts.logger = s.loggerClone\n\ts.logger.SugaredLogger = s.logger.With(\"method\", \"List\")\n\n\t// Pagination\n\tif limit == 0 {\n\t\tlimit = viper.GetInt32(\"PAGE_LIMIT\")\n\t}\n\tif page <= 0 {\n\t\tpage = 1\n\t}\n\toffset := limit * (page - 1)\n\n\t// Get data list\n\texamples, count, err := s.repository.ListWhere(where, order, limit, offset)\n\tif err != nil {\n\t\ts.logger.Errorw(\"list data error\", \"error\", err)\n\t\treturn nil, response.NewErrorFromCode(errorcode.GetDataError)\n\t}\n\texampleList := repository.NewExampleList(examples, count)\n\treturn exampleList, nil\n}", "func ViewManagerAndUsers(w http.ResponseWriter, r *http.Request) {\n AuthorizePages(w,r) // Restrict Unauthorized User \n tmpl, err := template.ParseFiles(\"templates/viewManagersAndUsers.html\")\n if err != nil {\n fmt.Println(err)\n }\n\n var managerList []helpers.User\n var userList []helpers.User\n\n managerList = dbquery.GetManagerList()\n\n userId := UserIds{\n ManagerId: r.FormValue(\"managerId\"),\n }\n \n var isShow bool = false\n var noDataMessage string\n var listLen int\n \n if userId.ManagerId != \"Select\" && userId.ManagerId != \"\" {\n userList = dbquery.GetUserByMngrList(userId.ManagerId)\n listLen = len(userList);\n } else {\n isShow = true\n noDataMessage = \"Please select Manager\"\n }\n\n if (listLen == 0 && (userId.ManagerId != \"Select\" && userId.ManagerId != \"\")) {\n isShow = true\n noDataMessage = \"There are no users for this Manager\"\n }\n\n AuthorizePages(w,r) // Restrict Unauthorized User\n \n tmpl.Execute(w, AllUsersResponse{ListLen: listLen, Managers: managerList, Users: userList, IsShow: isShow, FailedMessage: noDataMessage})\n}", "func (t *MedChain) getAllHospital(stub shim.ChaincodeStubInterface, args []string) peer.Response {\n\t\t// ==== Input sanitation ====\n\t\tfmt.Println(\"- start getAllHospital\")\n\n\t\tAssetType := \"Hospital\"\n\n\t\tqueryString := fmt.Sprintf(\"SELECT valueJson FROM <STATE> WHERE json_extract(valueJson, '$.AssetType') = '%s'\", AssetType)\n\t\t\n\t\tqueryResults, err := getQueryResultForQueryString(stub, queryString)\n\t\t\n\t\tif err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\t\t\n\t\treturn shim.Success(queryResults)\n\t}", "func (m *DBMockedObject) All(ctx context.Context) ([]entity.PersonalData, error) {\n\targs := m.Called(ctx)\n\treturn args.Get(0).([]entity.PersonalData), args.Error(1)\n}", "func Index(w http.ResponseWriter, r *http.Request) {\r\n\tdb := dbconn()\r\n\tselDB, err := db.Query(\"SELECT * FROM person ORDER BY firstname DESC\")\r\n\tif err != nil {\r\n\t\tpanic(err.Error())\r\n\t}\r\n\tper := person{}\r\n\tres := []person{}\r\n\tfor selDB.Next() {\r\n\t\tvar firstname, lastname, bloodgroup string\r\n\t\tvar age int\r\n\t\terr = selDB.Scan(&firstname, &lastname, &age, &bloodgroup)\r\n\t\tif err != nil {\r\n\t\t\tpanic(err.Error())\r\n\t\t}\r\n\t\tper.firstname = firstname\r\n\t\tper.lastname = lastname\r\n\t\tper.age = age\r\n\t\tper.bloodgroup = bloodgroup\r\n\t\tres = append(res, per)\r\n\t}\r\n\ttmpl.ExecuteTemplate(w, \"Index\", res)\r\n\tdefer db.Close()\r\n}", "func (client PermissionsClient) ListByCustomerResponder(resp *http.Response) (result PermissionsListResult, 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}", "func FetchList() (*List, error) {\n db := OpenDb()\n list := new(List) \n err := db.View(func(tx *bolt.Tx) error {\n b := tx.Bucket([]byte(\"Fika\"))\n err := b.ForEach(func(k, v []byte) error {\n var fetchedPerson Person\n err := json.Unmarshal(v, &fetchedPerson)\n \n if err != nil {\n return err\n }\n list.AddPerson(&fetchedPerson)\n return nil\n })\n \n if err != nil {\n return err\n }\n \n return nil\n })\n \n if err != nil {\n return nil, err\n }\n CloseDb(db)\n return list, nil\n}", "func provisionerList(w http.ResponseWriter, r *http.Request, t auth.Token) (err error) {\n\tallowed := permission.Check(t, permission.PermClusterRead)\n\tif !allowed {\n\t\treturn permission.ErrUnauthorized\n\t}\n\tprovs, err := provision.Registry()\n\tif err != nil {\n\t\treturn err\n\t}\n\tinfo := make([]provisionerInfo, len(provs))\n\tfor i, p := range provs {\n\t\tinfo[i].Name = p.GetName()\n\t\tif clusterProv, ok := p.(cluster.ClusteredProvisioner); ok {\n\t\t\tinfo[i].ClusterHelp = clusterProv.ClusterHelp()\n\t\t}\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\treturn json.NewEncoder(w).Encode(info)\n}", "func HomePageList(c *server.Context) error {\n\tvar (\n\t\terr error\n\t\tres []ware.BriefInfo\n\t\tidReq struct {\n\t\t\tLastID uint32 `json:\"last_id\"`\n\t\t}\n\t)\n\n\terr = c.JSONBody(&idReq)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrInvalidParam, nil)\n\t}\n\n\terr = c.Validate(idReq)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrInvalidParam, nil)\n\t}\n\n\tconn, err := mysql.Pool.Get()\n\tdefer mysql.Pool.Release(conn)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrMysql, nil)\n\t}\n\n\tres, err = ware.Service.HomePageList(conn, idReq.LastID)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrMysql, nil)\n\t}\n\n\treturn core.WriteStatusAndDataJSON(c, constants.ErrSucceed, res)\n}", "func List(ctx echo.Context) error {\n\tvar res []*userResponse\n\terr := db.Model(&User{}).Where(\"type = ?\", ctx.QueryParams().Get(\"type\")).Scan(&res).Error\n\tif err != nil {\n\t\treturn ctx.JSON(http.StatusBadRequest, &response{Code: 1})\n\t}\n\treturn ctx.JSON(http.StatusOK, &response{\n\t\tCode: 0,\n\t\tData: res,\n\t})\n}", "func PersonsIndex(c *gin.Context) {\r\n\tvar lis []models.Person\r\n\r\n\tdb, _ := c.Get(\"db\")\r\n\tconn := db.(gorm.DB)\r\n\r\n\t// Migrate the schema\r\n\tconn.AutoMigrate(&models.Person{})\r\n\r\n\tconn.Find(&lis)\r\n\tc.JSON(http.StatusOK, gin.H{\r\n\t\t\"msg\": \"thank you\",\r\n\t\t\"r\": lis,\r\n\t})\r\n\r\n}", "func (srv *SecurityQuestionService) ListHandler(ctx *gin.Context) {\n\tquestions, err := srv.Repository.GetSecurityQuestionRepository().GetAll()\n\tif err != nil {\n\t\t// Returns a \"404 StatusNotFound\" response\n\t\tsrv.ResponseService.NotFound(ctx)\n\t\treturn\n\t}\n\n\t// Returns a \"200 OK\" response\n\tsrv.ResponseService.OkResponse(ctx, questions)\n\treturn\n}", "func List() {\n\terr := ListCmd.Parse(os.Args[2:])\n\tif err != nil || internal.Help {\n\t\tListCmd.Usage()\n\t\tos.Exit(0)\n\t}\n\n\tconfigurator, err := config.NewConfigurator()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tlist, err := configurator.GetCollaborators()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tsort.Slice(list, func(i, j int) bool {\n\t\treturn config.Less(list[i], list[j])\n\t})\n\n\ttw := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0x0)\n\tfor _, collab := range list {\n\t\tline := fmt.Sprintf(\"\\t%s\\t<%s>\", collab.Name, collab.Email)\n\t\tif (collab.Alias != collab.Name) {\n\t\t\tline = fmt.Sprintf(\"%s:%s\", collab.Alias, line)\n\t\t}\n\t\tfmt.Fprintln(tw, line)\n\t}\n\ttw.Flush()\n}", "func List(modelIns interface{}, paramCreators ...CriteriaCreator) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\n\t\ttotal, data := ListHandlerWithoutServe(modelIns, c, paramCreators...)\n\n\t\tc.JSON(200, gin.H{\n\t\t\t\"total\": total,\n\t\t\t\"data\": data,\n\t\t})\n\t}\n}", "func List(c *gin.Context){\n\tlimitStr := c.Query(\"limit\")\n\tlimit, err := strconv.Atoi(limitStr)\n\tif err != nil {\n\t\tlimit = 0\n\t}\n\tres, err := list(limit)\n\tif err != nil {\n\t\tresponese.Error(c, err, nil)\n\t\treturn\n\t}\n\tresponese.Success(c, \"successed\", res)\n}", "func (hpSrv *HomePageServ) List() {\n\tvar (\n\t\tarticelMd []serializer.ArticleModel\n\t)\n\tconf.MYSQL_CONNECT.Order(\"created_at desc\").Find(&articelMd)\n\tif hpSrv.Limit == 0 {\n\t\thpSrv.Limit = 4\n\t}\n\thpSrv.setArticleSet(articelMd)\n\thpSrv.pageCount = setPageCount(len(articelMd), hpSrv.Limit)\n\thpSrv.setPage()\n}", "func (r *UserRead) list(q *msg.Request, mr *msg.Result) {\n\tvar (\n\t\tuserID, userName string\n\t\trows *sql.Rows\n\t\terr error\n\t)\n\n\tif rows, err = r.stmtList.Query(); err != nil {\n\t\tmr.ServerError(err, q.Section)\n\t\treturn\n\t}\n\n\tfor rows.Next() {\n\t\tif err = rows.Scan(\n\t\t\t&userID,\n\t\t\t&userName,\n\t\t); err != nil {\n\t\t\trows.Close()\n\t\t\tmr.ServerError(err, q.Section)\n\t\t\treturn\n\t\t}\n\t\tmr.User = append(mr.User, proto.User{\n\t\t\tID: userID,\n\t\t\tUserName: userName,\n\t\t})\n\t}\n\tif err = rows.Err(); err != nil {\n\t\tmr.ServerError(err, q.Section)\n\t\treturn\n\t}\n\tmr.OK()\n}", "func (userAuthorizationServerObject *userAuthorizationEngineServerObjectStruct) sqlListUsersAuthorizedCompanies(userAuthorizedCompaniesRequest *userAuthorizationEngine_grpc_api.UserAuthorizedCompaniesRequest) *userAuthorizationEngine_grpc_api.UserAuthorizedCompaniesResponse {\n\tvar err error\n\tvar returnMessage *userAuthorizationEngine_grpc_api.UserAuthorizedCompaniesResponse\n\n\t// SQl for 'List users authorized accounts'\n\tsqlText := \"SELECT Company \"\n\tsqlText += \"FROM AuthorizedCompany \"\n\tsqlText += \"WHERE \"\n\tsqlText += \"UserName = '\" + userAuthorizedCompaniesRequest.UserId + \"' AND \"\n\tsqlText += \"ORDER BY Company \"\n\n\t// Execute a sql quesry\n\tsqlResponseRows, err := userAuthorizationServerObject.sqlDbObject.Query(sqlText)\n\tif err != nil {\n\t\tuserAuthorizationServerObject.logger.WithFields(logrus.Fields{\n\t\t\t\"Id\": \"6c93ed23-02a0-454c-8975-49906677b83c\",\n\t\t\t\"err.Error()\": err.Error(),\n\t\t\t\"sqlText\": sqlText,\n\t\t}).Warning(\"Couldn't execute sql-query\")\n\n\t\t// Create return message\n\t\treturnMessage = &userAuthorizationEngine_grpc_api.UserAuthorizedCompaniesResponse{\n\t\t\tUserId: userAuthorizedCompaniesRequest.UserId,\n\t\t\tAcknack: false,\n\t\t\tComments: \"Error While executing SQL\",\n\t\t\tCompanies: nil,\n\t\t}\n\t\treturn returnMessage\n\n\t} else {\n\n\t\t// Success in executing sqlStatement\n\t\tuserAuthorizationServerObject.logger.WithFields(logrus.Fields{\n\t\t\t\"Id\": \"0d3417ef-c952-4ffd-aed4-e7bb2fd4066a\",\n\t\t\t\"sqlResponseRows\": sqlResponseRows,\n\t\t}).Debug(\"Success in executing sql for 'List users authorized companies'\")\n\n\t\t// Extract data from SQL results and create response object\n\t\tvar companiesList []*userAuthorizationEngine_grpc_api.Company\n\t\tvar Company string\n\n\t\t// Iterate and fetch the records from result cursor\n\t\tfor sqlResponseRows.Next() {\n\t\t\tsqlResponseRows.Scan(&Company)\n\t\t\tconvertedCompany := &userAuthorizationEngine_grpc_api.Company{Company: Company}\n\t\t\tcompaniesList = append(companiesList, convertedCompany)\n\t\t}\n\n\t\t// Create return message\n\t\treturnMessage = &userAuthorizationEngine_grpc_api.UserAuthorizedCompaniesResponse{\n\t\t\tUserId: userAuthorizedCompaniesRequest.UserId,\n\t\t\tAcknack: true,\n\t\t\tComments: \"\",\n\t\t\tCompanies: companiesList,\n\t\t}\n\t}\n\n\treturn returnMessage\n}", "func ShowCurrentUserList() {\n\tul := &define.UserList\n\tShowUserList(ul)\n}", "func (u *UsersController) List(ctx *gin.Context) {\n\tcriteria := u.buildCriteria(ctx)\n\n\tvar listAsAdmin bool\n\tif isTatAdmin(ctx) {\n\t\tlistAsAdmin = true\n\t} else {\n\t\tuser, e := PreCheckUser(ctx)\n\t\tif e != nil {\n\t\t\tctx.AbortWithError(http.StatusInternalServerError, e)\n\t\t\treturn\n\t\t}\n\t\tlistAsAdmin = user.CanListUsersAsAdmin\n\t}\n\tcount, users, err := userDB.ListUsers(criteria, listAsAdmin)\n\tif err != nil {\n\t\tctx.AbortWithError(http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tout := &tat.UsersJSON{\n\t\tCount: count,\n\t\tUsers: users,\n\t}\n\tctx.JSON(http.StatusOK, out)\n}", "func Index(w http.ResponseWriter, r *http.Request) {\r\n\t\r\n\tdb := Database.Dbconn()\r\n\tselDB, err := db.Query(\"SELECT * FROM employee.dbo.employee\")\r\n\tif err != nil {\r\n\t\tpanic(err.Error())\r\n\t}\r\n\r\n\tper := persona{}\r\n\tres := []persona{}\r\n\r\n\tfor selDB.Next() {\r\n\t\tvar id string\r\n\t\tvar name string\r\n\t\tvar location string\r\n\r\n\t\terr = selDB.Scan(&id, &name, &location)\r\n\t\tif err != nil {\r\n\t\t\tpanic(err.Error())\r\n\t\t}\r\n\t\tper.Id = id\r\n\t\tper.Name = name\r\n\t\tper.Location = location\r\n\r\n\t\tres = append(res, per)\r\n\t}\r\n\ttmpl.ExecuteTemplate(w, \"Index\", res)\r\n\tdefer db.Close()\r\n}", "func (m MariaDB) All(ctx context.Context) ([]entity.PersonalData, error) {\n\tsqlQuery := fmt.Sprintf(\"SELECT * FROM person\")\n\tvar p personalData\n\tvar persons []entity.PersonalData\n\trows, err := m.Person.QueryContext(ctx, sqlQuery)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not make query\")\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\terr = rows.Scan(&p.ID, &p.Name, &p.LastName, &p.Phone, &p.Email, &p.YearOfBirth)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"could not scan rows\")\n\t\t}\n\t\tpersons = append(persons, p.transmit())\n\t}\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"rows error\")\n\t}\n\treturn persons, nil\n}", "func (client UsageDetailsClient) ListByDepartmentResponder(resp *http.Response) (result UsageDetailsListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func (s *EmployeesEndpoint) List(ctx context.Context, division int, all bool, o *api.ListOptions) ([]*Employees, error) {\n\tvar entities []*Employees\n\tu, _ := s.client.ResolvePathWithDivision(\"/api/v1/{division}/payroll/Employees\", division) // #nosec\n\tapi.AddListOptionsToURL(u, o)\n\n\tif all {\n\t\terr := s.client.ListRequestAndDoAll(ctx, u.String(), &entities)\n\t\treturn entities, err\n\t}\n\t_, _, err := s.client.NewRequestAndDo(ctx, \"GET\", u.String(), nil, &entities)\n\treturn entities, err\n}", "func (client *Client) GetUserInfos(allDomains bool, domainName string) ([]UserFullDataWrapper, error) {\n\tquery, _ := json.Marshal(InfoListData{\n\t\tAllDomains: allDomains,\n\t\tDomainName: domainName,\n\t})\n\n\tresRaw, err := client.ListClients([]byte(query))\n\tif err != nil {\n\t\treturn []UserFullDataWrapper{}, err\n\t}\n\n\tresUnmarshaled := []UserFullDataWrapper{}\n\tif err := json.Unmarshal(resRaw, &resUnmarshaled); err != nil {\n\t\treturn []UserFullDataWrapper{}, err\n\t}\n\n\treturn resUnmarshaled, err\n}", "func (client PermissionsClient) ListByInvoiceSectionsResponder(resp *http.Response) (result PermissionsListResult, 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}", "func (r repository) List(ctx context.Context, list *ListUsersRequest) ([]model.User, error) {\n\tusers := make([]model.User, 0)\n\toffset := (list.Page - 1) * list.Limit\n\terr := r.db.Select(&users, ListUsersSQL, offset, list.Limit)\n\tif err != nil {\n\t\tr.logger.Errorf(\"Failed to select users %s\", err)\n\t\treturn nil, err\n\t}\n\treturn users, nil\n}", "func (s *Service) List(c context.Context, req *user.ListReq) (*user.ListResp, error) {\n\tif err := req.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tu := s.auth.GetUser(c)\n\n\tlimit, offset := query.Paginate(req.Limit, req.Page)\n\n\tusers, err := s.udb.List(\n\t\ts.dbcl.WithContext(c),\n\t\tquery.ForTenant(u, req.TenantId),\n\t\tlimit,\n\t\toffset,\n\t)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar pu []*user.Resp\n\tfor _, v := range users {\n\t\tpu = append(pu, v.Proto())\n\t}\n\n\treturn &user.ListResp{Users: pu}, nil\n}", "func (client AppsClient) ListResponder(resp *http.Response) (result ListApplicationInfoResponse, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result.Value),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func getLoanList(ls *[]models.Loan, db *gorm.DB) error {\n\tvar l models.Loan\n\tif len(*ls) == 1 {\n\t\tl = (*ls)[0]\n\t}\n\twhere := \"\"\n\tif l.CodCollection != 0 {\n\t\twhere = fmt.Sprintf(\"cod_collection = %v\", l.CodCollection)\n\t}\n\tif l.CodClient != 0 {\n\t\twhere = fmt.Sprintf(\"cod_client = %v\", l.CodClient)\n\t}\n\tif where != \"\" && l.CodLoanState != 0 {\n\t\twhere += fmt.Sprintf(\" and cod_loan_state = %v\", l.CodLoanState)\n\t}\n\terr := db.Where(where).Select(\"id,created_at,updated_at,initial_value,interest,quota,balance,cod_loan_state,cod_client\").Find(ls).GetErrors()\n\tif len(err) != 0 {\n\t\treturn errors.New(\"no se encuentra\")\n\t}\n\treturn nil\n}", "func List(memoryStorage *PassgenStorage) {\n\tif len(memoryStorage.Storage) == 0 {\n\t\thelpers.NegativePrintf(\"\\nThere is no item in your storage\\n\\n\")\n\t\treturn\n\t}\n\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"Application Name\", \"User Name\", \"Password\"})\n\n\tfor _, v := range memoryStorage.Storage {\n\t\ttable.Append([]string{v.AppName, v.UserName, v.Password})\n\t}\n\ttable.Render()\n}", "func (v AdminsResource) List(c buffalo.Context) error {\n\t// Get the DB connection from the context\n\ttx, ok := c.Value(\"tx\").(*pop.Connection)\n\tif !ok {\n\t\treturn errors.WithStack(errors.New(\"no transaction found\"))\n\t}\n\n\tadmins := &models.Admins{}\n\n\t// Paginate results. Params \"page\" and \"per_page\" control pagination.\n\t// Default values are \"page=1\" and \"per_page=20\".\n\tq := tx.PaginateFromParams(c.Params())\n\n\t// Retrieve all Admins from the DB\n\tif err := q.All(admins); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\t// Add the paginator to the context so it can be used in the template.\n\tc.Set(\"pagination\", q.Paginator)\n\n\treturn c.Render(200, r.JSON(admins))\n}", "func (uc UsersController) List(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tfmt.Fprintf(w, \"UsersList\")\n}", "func listActivities(echoReq *alexa.EchoRequest, user *User) *alexa.EchoResponse {\n\tmsg := \"\"\n\n\t//switch depending on number of activities user has\n\tswitch len(user.Activities) {\n\n\tcase 0:\n\t\tmsg = \"You have no activities currently\"\n\n\tcase 1:\n\t\tmsg = \"You have one activity \" + user.Activities[0].Name\n\n\tdefault:\n\t\tactivitiesLen := strconv.Itoa(len(user.Activities))\n\t\tmsg = \"You have \" + activitiesLen + \" activities \"\n\n\t\t//go through all activites and formulate a response message\n\t\tfor index, activity := range user.Activities {\n\t\t\tif index == len(user.Activities)-1 {\n\t\t\t\tmsg = msg + \" and \" + user.Activities[index].Name + \" \"\n\t\t\t} else {\n\t\t\t\tmsg = msg + activity.Name + \" \"\n\t\t\t}\n\t\t}\n\t}\n\n\t//return a response with message of listed activities\n\techoResp := alexa.NewEchoResponse().OutputSpeech(msg).EndSession(false)\n\treturn echoResp\n}", "func (c *productsServicesInterface) GetPersonalLoans(id string, page int) ([]personalloan.Entity, *subentities.Pagination, common.CustomError) {\n\treturn c.personalLoanService.FindByInstitution(id, page)\n}", "func (m *manager) List(ctx context.Context, query *q.Query) (models.Users, error) {\n\tquery = q.MustClone(query)\n\tif query.Sorting == \"\" {\n\t\tquery.Sorting = \"username\"\n\t}\n\n\texcludeAdmin := true\n\tfor key := range query.Keywords {\n\t\tstr := strings.ToLower(key)\n\t\tif str == \"user_id__in\" {\n\t\t\texcludeAdmin = false\n\t\t\tbreak\n\t\t} else if str == \"user_id\" {\n\t\t\texcludeAdmin = false\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif excludeAdmin {\n\t\t// Exclude admin account when not filter by UserIDs, see https://github.com/goharbor/harbor/issues/2527\n\t\tquery.Keywords[\"user_id__gt\"] = 1\n\t}\n\n\treturn m.dao.List(ctx, query)\n}", "func (retUser) List(ctx context.Context, db *sqlx.DB) ([]User, error) {\n\tctx, span := global.Tracer(\"service\").Start(ctx, \"internal.data.retrieve.user.list\")\n\tdefer span.End()\n\n\tusers := []User{}\n\tconst q = `SELECT * FROM users`\n\n\tif err := db.SelectContext(ctx, &users, q); err != nil {\n\t\treturn nil, errors.Wrap(err, \"selecting users\")\n\t}\n\n\treturn users, nil\n}", "func (pubManager PublicationManager) List(page, pageNum int) func() (Publication, error) {\n\n\tvar rows *sql.Rows\n\tvar err error\n\tdriver, _ := config.GetDatabase(config.Config.FrontendServer.Database)\n\tif driver == \"mssql\" {\n\t\trows, err = pubManager.dbList.Query(pageNum*page, page)\n\t} else {\n\t\trows, err = pubManager.dbList.Query(page, pageNum*page)\n\t}\n\tif err != nil {\n\t\treturn func() (Publication, error) { return Publication{}, err }\n\t}\n\n\treturn func() (Publication, error) {\n\t\tvar pub Publication\n\t\tvar err error\n\t\tif rows.Next() {\n\t\t\terr = rows.Scan(&pub.ID, &pub.UUID, &pub.Title, &pub.Status)\n\t\t} else {\n\t\t\trows.Close()\n\t\t\terr = ErrNotFound\n\t\t}\n\t\treturn pub, err\n\t}\n}", "func AdminList(w http.ResponseWriter, data interface{}) {\n\trender(tpAdminList, w, data)\n}", "func (client UsageDetailsClient) ListByManagementGroupResponder(resp *http.Response) (result UsageDetailsListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func getLoanPaymentList(lps *[]models.LoanPayment, db *gorm.DB) error {\n\tvar lp models.LoanPayment\n\tif len(*lps) == 1 {\n\t\tlp = (*lps)[0]\n\t}\n\twhere := fmt.Sprintf(\"cod_collection = %v\", lp.CodCollection)\n\tif lp.CodLoan != 0 {\n\t\twhere = fmt.Sprintf(\"cod_loan = %v\", lp.CodLoan)\n\t}\n\tif lp.CodUser != 0 {\n\t\twhere += fmt.Sprintf(\" and cod_user = %v\", lp.CodUser)\n\t}\n\terr := db.Where(where).Select(\"id,updated_at,cod_loan,cash,cod_user\").Find(lps).GetErrors()\n\tif len(err) != 0 {\n\t\treturn errors.New(\"no se encuentra\")\n\t}\n\treturn nil\n}", "func (hc *Hailconfig) List() error {\n\tcols, _ := consolesize.GetConsoleSize()\n\tmaxLenAlias := 25\n\tmaxLenCommand := 80\n\tmaxLenDescription := 25\n\tif cols > 10 {\n\t\tmaxLenAlias = cols/4 - 5\n\t\tmaxLenCommand = cols / 2\n\t\tmaxLenDescription = cols/4 - 5\n\t}\n\n\tt := table.NewWriter()\n\tt.SetOutputMirror(os.Stdout)\n\tt.AppendHeader(table.Row{\"Alias\", \"Command\", \"Description\"})\n\tt.SetColumnConfigs([]table.ColumnConfig{\n\t\t{\n\t\t\tName: \"Alias\",\n\t\t\tWidthMin: 5,\n\t\t\tWidthMax: maxLenAlias,\n\t\t},\n\t\t{\n\t\t\tName: \"Command\",\n\t\t\tWidthMin: 10,\n\t\t\tWidthMax: maxLenCommand,\n\t\t}, {\n\t\t\tName: \"Description\",\n\t\t\tWidthMin: 5,\n\t\t\tWidthMax: maxLenDescription,\n\t\t},\n\t})\n\t//t.SetAllowedRowLength(90)\n\tfor alias, script := range hc.Scripts {\n\t\tt.AppendRow([]interface{}{alias, script.Command, script.Description})\n\t\tt.AppendSeparator()\n\t}\n\tt.Render()\n\treturn nil\n}", "func getSpecificPersons(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tfmt.Println(\"Get Specific HIT\")\n\tparams := mux.Vars(r)\n\tresult, err := db.Query(\"SELECT pAge,pName FROM Persons WHERE pAge >= ?\", params[\"age\"])\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tdefer result.Close()\n\tvar pers []Person\n\tfor result.Next() {\n\t\tvar per Person\n\t\terr := result.Scan(&per.Age, &per.Name)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tpers = append(pers, per)\n\t}\n\tjson.NewEncoder(w).Encode(pers)\n}", "func (client PermissionsClient) ListByBillingAccountResponder(resp *http.Response) (result PermissionsListResult, 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}", "func (r *Resource) getAllHandler(c *gin.Context) {\n // fetch all from database\n meals, err := r.db.GetAllMenuMeals()\n if err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n return\n }\n\n // return result as JSON\n c.JSON(http.StatusOK, meals)\n}", "func (r *LoggingRepository) List(ctx context.Context, teamID, userID string) ([]*model.Member, error) {\n\tstart := time.Now()\n\trecords, err := r.upstream.List(ctx, teamID, userID)\n\n\tlogger := r.logger.With().\n\t\tStr(\"request\", r.requestID(ctx)).\n\t\tStr(\"method\", \"list\").\n\t\tDur(\"duration\", time.Since(start)).\n\t\tStr(\"team\", teamID).\n\t\tStr(\"user\", userID).\n\t\tLogger()\n\n\tif err != nil {\n\t\tlogger.Warn().\n\t\t\tErr(err).\n\t\t\tMsg(\"failed to fetch members\")\n\t} else {\n\t\tlogger.Debug().\n\t\t\tMsg(\"\")\n\t}\n\n\treturn records, err\n}", "func List(ctx context.Context) ([]meta.SimpleTreeNode, error) {\n\tvar managerService = services.NewManagerService()\n\tvar data, err = managerService.MenuList()\n\treturn data, err\n}", "func (aaa *UserAchievementsService) PublicListUserAchievements(input *user_achievements.PublicListUserAchievementsParams) (*achievementclientmodels.ModelsPaginatedUserAchievementResponse, error) {\n\ttoken, err := aaa.TokenRepository.GetToken()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tok, badRequest, unauthorized, notFound, internalServerError, err := aaa.Client.UserAchievements.PublicListUserAchievements(input, client.BearerToken(*token.AccessToken))\n\tif badRequest != nil {\n\t\treturn nil, badRequest\n\t}\n\tif unauthorized != nil {\n\t\treturn nil, unauthorized\n\t}\n\tif notFound != nil {\n\t\treturn nil, notFound\n\t}\n\tif internalServerError != nil {\n\t\treturn nil, internalServerError\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ok.GetPayload(), nil\n}" ]
[ "0.66679907", "0.62190366", "0.6153077", "0.59601074", "0.5529576", "0.54876083", "0.54529107", "0.53328735", "0.53084356", "0.5276146", "0.5210479", "0.5182747", "0.51378894", "0.51373833", "0.51039445", "0.5103527", "0.5103344", "0.5102155", "0.5064931", "0.5045218", "0.50413835", "0.50163555", "0.50063264", "0.49829236", "0.49692866", "0.4961069", "0.4959318", "0.4946596", "0.49445292", "0.4929917", "0.49165195", "0.49161023", "0.49138248", "0.4911301", "0.49069887", "0.49049574", "0.48979262", "0.48944563", "0.48909584", "0.4857625", "0.48550412", "0.48492557", "0.48458785", "0.48190162", "0.48149642", "0.48093504", "0.4809098", "0.47951135", "0.47950354", "0.47930846", "0.47881842", "0.47843853", "0.47762424", "0.47676426", "0.47635606", "0.47308332", "0.4727782", "0.47239056", "0.47234347", "0.47202873", "0.47185832", "0.4714808", "0.47035894", "0.47024292", "0.4698194", "0.46932617", "0.46815398", "0.4679357", "0.46791977", "0.46741998", "0.4671231", "0.46710113", "0.46652558", "0.46621376", "0.46611065", "0.46578142", "0.46496254", "0.46488565", "0.46448624", "0.4644287", "0.46424508", "0.4641455", "0.46408495", "0.4637506", "0.46323854", "0.4624224", "0.4619987", "0.46185598", "0.46131632", "0.46081093", "0.46078888", "0.4605971", "0.46032703", "0.4602507", "0.46018225", "0.45982665", "0.45980096", "0.4594926", "0.45928058", "0.4591224" ]
0.821063
0
DefaultCreateHealthMenstruationDailyEntry executes a basic gorm create call
DefaultCreateHealthMenstruationDailyEntry выполняет базовый вызов gorm create
func DefaultCreateHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) { if in == nil { return nil, errors1.NilArgumentError } ormObj, err := in.ToORM(ctx) if err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeCreate_); ok { if db, err = hook.BeforeCreate_(ctx, db); err != nil { return nil, err } } if err = db.Create(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterCreate_); ok { if err = hook.AfterCreate_(ctx, db); err != nil { return nil, err } } pbResponse, err := ormObj.ToPB(ctx) return &pbResponse, err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DefaultCreateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, 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 hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeCreate_); ok {\n\t\tif db, err = hook.BeforeCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterCreate_); ok {\n\t\tif err = hook.AfterCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultReadHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, 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 == 0 {\n\t\treturn nil, errors1.EmptyIdError\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeReadApplyQuery); ok {\n\t\tif db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &HealthMenstruationDailyEntryORM{}); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeReadFind); ok {\n\t\tif db, err = hook.BeforeReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tormResponse := HealthMenstruationDailyEntryORM{}\n\tif err = db.Where(&ormObj).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormResponse).(HealthMenstruationDailyEntryORMWithAfterReadFind); ok {\n\t\tif err = hook.AfterReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultListHealthMenstruationDailyEntry(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*HealthMenstruationDailyEntry, error) {\n\tin := HealthMenstruationDailyEntry{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm2.ApplyCollectionOperators(ctx, db, &HealthMenstruationDailyEntryORM{}, &HealthMenstruationDailyEntry{}, f, s, p, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []HealthMenstruationDailyEntryORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*HealthMenstruationDailyEntry{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func DefaultPatchHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj HealthMenstruationDailyEntry\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadHealthMenstruationDailyEntry(ctx, &HealthMenstruationDailyEntry{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskHealthMenstruationDailyEntry(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateHealthMenstruationDailyEntry(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(HealthMenstruationDailyEntryWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func DefaultStrictUpdateHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateHealthMenstruationDailyEntry\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &HealthMenstruationDailyEntryORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func NewCreateMailerEntryDefault(code int) *CreateMailerEntryDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &CreateMailerEntryDefault{\n\t\t_statusCode: code,\n\t}\n}", "func DefaultApplyFieldMaskHealthMenstruationDailyEntry(ctx context.Context, patchee *HealthMenstruationDailyEntry, patcher *HealthMenstruationDailyEntry, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"ProfileId\" {\n\t\t\tpatchee.ProfileId = patcher.ProfileId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Day\" {\n\t\t\tpatchee.Day = patcher.Day\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"IntensityPercentage\" {\n\t\t\tpatchee.IntensityPercentage = patcher.IntensityPercentage\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Type\" {\n\t\t\tpatchee.Type = patcher.Type\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Manual\" {\n\t\t\tpatchee.Manual = patcher.Manual\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"BasedOnPrediction\" {\n\t\t\tpatchee.BasedOnPrediction = patcher.BasedOnPrediction\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func (s *Service) CreateEntry(ctx context.Context, in *pb.CreateEntryRequest) (*pb.Entry, error) {\n\tcurrentUser, err := s.getCurrentUser(ctx)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.PermissionDenied, \"Authentication failed\")\n\t}\n\n\tvar year int\n\terr = s.db.Get(&year, \"select year from calendars where id = ?\", in.GetCalendarId())\n\tif err == sql.ErrNoRows {\n\t\treturn nil, status.Errorf(codes.NotFound, \"Calendar not found\")\n\t}\n\tif err != nil {\n\t\treturn nil, xerrors.Errorf(\"Failed query to fetch calendar: %w\", err)\n\t}\n\n\tday := in.GetDay()\n\tif day < 1 || day > 25 {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"Invalid day: %d\", day)\n\t}\n\n\tlastID, err := s.insertEntry(currentUser.ID, in.GetCalendarId(), day)\n\tif err != nil {\n\t\treturn nil, xerrors.Errorf(\"Failed to insert entry: %w\", err)\n\t}\n\n\tvar entryID int64\n\terr = s.db.Get(&entryID, \"select id from entries where id = ?\", lastID)\n\tif err != nil {\n\t\treturn nil, xerrors.Errorf(\"Failed query to fetch entry: %w\", err)\n\t}\n\n\treturn &pb.Entry{Id: entryID}, nil\n}", "func DefaultPatchSetHealthMenstruationDailyEntry(ctx context.Context, objects []*HealthMenstruationDailyEntry, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*HealthMenstruationDailyEntry, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*HealthMenstruationDailyEntry, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchHealthMenstruationDailyEntry(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func (m *HealthMenstruationDailyEntry) ToORM(ctx context.Context) (HealthMenstruationDailyEntryORM, error) {\n\tto := HealthMenstruationDailyEntryORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(HealthMenstruationDailyEntryWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tif m.CreatedAt != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.CreatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.CreatedAt = &t\n\t}\n\tif m.UpdatedAt != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.UpdatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.UpdatedAt = &t\n\t}\n\tto.ProfileId = m.ProfileId\n\tif m.Day != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.Day); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Day = &t\n\t}\n\tto.IntensityPercentage = m.IntensityPercentage\n\tto.Type = int32(m.Type)\n\tto.Manual = m.Manual\n\tto.BasedOnPrediction = m.BasedOnPrediction\n\tif posthook, ok := interface{}(m).(HealthMenstruationDailyEntryWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "func (m *HealthMenstruationDailyEntryORM) ToPB(ctx context.Context) (HealthMenstruationDailyEntry, error) {\n\tto := HealthMenstruationDailyEntry{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(HealthMenstruationDailyEntryWithBeforeToPB); ok {\n\t\tif err = prehook.BeforeToPB(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tif m.CreatedAt != nil {\n\t\tif to.CreatedAt, err = ptypes1.TimestampProto(*m.CreatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tif m.UpdatedAt != nil {\n\t\tif to.UpdatedAt, err = ptypes1.TimestampProto(*m.UpdatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.ProfileId = m.ProfileId\n\tif m.Day != nil {\n\t\tif to.Day, err = ptypes1.TimestampProto(*m.Day); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.IntensityPercentage = m.IntensityPercentage\n\tto.Type = HealthMenstruationDailyEntry_Type(m.Type)\n\tto.Manual = m.Manual\n\tto.BasedOnPrediction = m.BasedOnPrediction\n\tif posthook, ok := interface{}(m).(HealthMenstruationDailyEntryWithAfterToPB); ok {\n\t\terr = posthook.AfterToPB(ctx, &to)\n\t}\n\treturn to, err\n}", "func (dbHandler *Handler) CreateEntry(userID uint, text string, ts time.Time) (api.Entry, error) {\n\tentry := api.Entry{UserID: userID, Text: text}\n\tif !ts.IsZero() {\n\t\tentry.CreatedAt = ts\n\t\tentry.UpdatedAt = ts\n\t}\n\n\tdb := dbHandler.DB.Create(&entry)\n\tif db.Error != nil {\n\t\treturn entry, errors.WrapWithDetails(db.Error, \"cannot create entry\", \"userID\", userID)\n\t}\n\n\treturn entry, nil\n}", "func CreateMeeting(c *gin.Context) {\n // Validate input\n var input CreateMeetingInput\n if err := c.ShouldBindJSON(&input); err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n return\n }\n\n // Create meeting\n meeting := models.Meeting{CreatedBy: input.CreatedBy, Title: input.Title, Description: input.Description, StartDate: input.StartDate, EndDate: input.EndDate, Location: input.Location}\n models.DB.Create(&meeting)\n\n c.JSON(http.StatusOK, gin.H{\"data\": meeting})\n}", "func (m *stashModel) createTodayNote(day time.Time) (*stashModel, tea.Cmd) {\n\treturn m, func() tea.Msg {\n\t\tif entries, err := fsPlugin.ListAll(); err == nil {\n\t\t\t// if the most recent entry isnt the same as our expected filename, create a new entry for today\n\t\t\texpectedFilename := day.Format(fs.StorageFilenameFormat)\n\t\t\tif len(entries) == 0 || (len(entries) > 0 && entries[0].Metadata.CreationTimestamp.Format(fs.StorageFilenameFormat) != expectedFilename) {\n\t\t\t\t_, err := fsPlugin.CreateOrUpdateNote(&v1.Note{\n\t\t\t\t\tMetadata: v1.NoteMetadata{\n\t\t\t\t\t\tAuthor: m.User.Username,\n\t\t\t\t\t\tTitle: TitleFromTime(day, m.config.StartWorkHours, m.config.EndWorkHours),\n\t\t\t\t\t\tTags: DefaultTagsForTime(day, m.config.HolidayTags, m.config.WorkdayTags, m.config.WeekendTags),\n\t\t\t\t\t\tLabels: map[string]string{},\n\t\t\t\t\t},\n\t\t\t\t\tContent: m.config.EntryTemplate,\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errMsg{fmt.Errorf(\"unable to create new entry: %w\", err)}\n\t\t\t\t}\n\t\t\t\t// TODO: we should not need to reload the whole collection, but I dunno how to make this work otherwise\n\t\t\t\treturn m.ReloadNoteCollectionCmd()\n\t\t\t} else {\n\t\t\t\treturn m.newStatusMessage(statusMessage{\n\t\t\t\t\tstatus: normalStatusMessage,\n\t\t\t\t\tmessage: fmt.Sprintf(\"Entry %s already exists\", expectedFilename),\n\t\t\t\t})\n\t\t\t}\n\t\t} else {\n\t\t\treturn errMsg{fmt.Errorf(\"unable to list entries: %w\", err)}\n\t\t}\n\t}\n}", "func CreateStatisticDefinition(settings *playfab.Settings, postData *CreateStatisticDefinitionRequestModel, entityToken string) (*EmptyResponseModel, error) {\n if entityToken == \"\" {\n return nil, playfab.NewCustomError(\"entityToken should not be an empty string\", playfab.ErrorGeneric)\n }\n b, errMarshal := json.Marshal(postData)\n if errMarshal != nil {\n return nil, playfab.NewCustomError(errMarshal.Error(), playfab.ErrorMarshal)\n }\n\n sourceMap, err := playfab.Request(settings, b, \"/Statistic/CreateStatisticDefinition\", \"X-EntityToken\", entityToken)\n if err != nil {\n return nil, err\n }\n \n result := &EmptyResponseModel{}\n\n config := mapstructure.DecoderConfig{\n DecodeHook: playfab.StringToDateTimeHook,\n Result: result,\n }\n \n decoder, errDecoding := mapstructure.NewDecoder(&config)\n if errDecoding != nil {\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\n }\n \n errDecoding = decoder.Decode(sourceMap)\n if errDecoding != nil {\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\n }\n\n return result, nil\n}", "func (r *RPC) CreationUpThirtyDayStat(c context.Context, arg *model.ArgMid, res *[]*model.ThirtyDayArticle) (err error) {\n\t*res, err = r.s.UpThirtyDayStat(c, arg.Mid)\n\treturn\n}", "func (dao *OHLCVDao) Create(tick *types.Tick) error {\n\terr := db.Create(dao.dbName, dao.collectionName, tick)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func create(entity domain.ValidableEntity, ctx *gin.Context) {\n\terr := ctx.BindJSON(entity)\n\tif IsError(err, ctx) {\n\t\treturn\n\t}\n\terr = domain.Save(entity)\n\tif IsError(err, ctx) {\n\t\treturn\n\t}\n\tctx.JSON(200, entity)\n}", "func (p *Loan) Create(w http.ResponseWriter, r *http.Request) {\n\tpost := models.Loan{}\n\tjson.NewDecoder(r.Body).Decode(&post)\n\n\t// Loan DATA\n\tAmount := post.Amount\n\tTenor := post.Tenor\n\tRequestDate, _ := time.Parse(\"2006-01-02\", post.Date)\n\n\t// GET Interest\n\tTempInterest, _ := p.repo.GetInterest(r.Context(), Tenor)\n\tInterest := TempInterest[0].Interest\n\n\tTempAmountInstallment := Amount / Tenor\n\tTempAmountInterest := float64(Amount) * Interest / 100\n\n\ttotalInstallment := float64(TempAmountInstallment) + TempAmountInterest\n\n\t// Loan CODE\n\tDateTimeNow := time.Now()\n\tTempDate := DateTimeNow.Format(\"01-02-2006\")\n\tTempTime := DateTimeNow.Format(\"15:04:05\")\n\n\tLoanCode := \"LOAN\" + strings.Replace(string(TempDate), \"-\", \"\", -1) + strings.Replace(string(TempTime), \":\", \"\", -1)\n\n\tfor i := 1; i <= Tenor; i++ {\n\t\t// fmt.Println(\"============================================================\")\n\t\t// fmt.Println(\"== Temp Amount Installment \t: \", TempAmountInstallment)\n\t\t// fmt.Println(\"== Temp Amount Interest\t\t: \", TempAmountInterest)\n\t\t// fmt.Println(\"== Total Installment\t\t: \", totalInstallment)\n\t\t// fmt.Println(\"== Request Date\t\t\t: \", RequestDate.AddDate(0, i, 0).Format(\"2006-01-02\"))\n\t\t// fmt.Println(\"============================================================\")\n\n\t\tnewID, err := p.repo.InsertInstallment(r.Context(), LoanCode, float64(TempAmountInstallment), TempAmountInterest, totalInstallment, i, RequestDate.AddDate(0, i, 0).Format(\"2006-01-02\"))\n\n\t\tif err != nil {\n\t\t\trespondWithErrorLoan(w, http.StatusInternalServerError, \"Server Error\")\n\t\t}\n\n\t\tfmt.Println(\"Success insert installment : ID => \", newID)\n\t}\n\tpayload, _ := p.repo.GetInstallmentByLoanCode(r.Context(), LoanCode)\n\n\trespondwithJSONLoan(w, http.StatusCreated, payload)\n}", "func (adapter *GORMAdapter) Create(entity interface{}) orm.Result {\n\treturn orm.Result{\n\t\tError: adapter.db.Create(entity).Error,\n\t}\n}", "func (r *HealthResource) Create(item HealthConfig) error {\n\tif err := r.c.ModQuery(\"POST\", BasePath+HealthEndpoint, item); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (HealthMenstruationDailyEntryORM) TableName() string {\n\treturn \"health_menstruation_daily_entries\"\n}", "func (a *App) CreateEntity(w http.ResponseWriter, r *http.Request) {\n\tvar e Entity\n\te.Uuid = uuid.NewV4().String()\n\tdecoder := json.NewDecoder(r.Body)\n\tif err := decoder.Decode(&e); err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, errors.New(\"invalid request payload\"))\n\t\treturn\n\t}\n\tdefer func() { _ = r.Body.Close() }()\n\n\tif err := e.createEntity(a.DB); err != nil {\n\t\tlog.Print(err)\n\t\trespondWithError(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\trespondWithJSON(w, http.StatusCreated, e)\n}", "func (h *StatsHandlers) createStatsRecord(c *gin.Context) {\n\n\tfreeMemory, err := strconv.ParseUint(c.PostForm(\"freeMemory\"), 10, 64)\n\tif err != nil {\n\t\tfmt.Println(\"Couldn't read free memory\")\n\t\tpanic(err)\n\t}\n\n\tuptime, err := strconv.ParseUint(c.PostForm(\"uptime\"), 10, 64)\n\tif err != nil {\n\t\tfmt.Println(\"Couldn't read uptime\")\n\t\tpanic(err)\n\t}\n\n\ttemperature, err := strconv.ParseFloat(c.PostForm(\"temp\"), 64)\n\tif err != nil {\n\t\tfmt.Println(\"Couldn't read temp\")\n\t\tpanic(err)\n\t}\n\n\tcpuTemp, err := strconv.ParseFloat(c.PostForm(\"cpuTemp\"), 64)\n\tif err != nil {\n\t\tfmt.Println(\"Couldn't read cpu temp\")\n\t\tpanic(err)\n\t}\n\n\tambientTemp, err := strconv.ParseFloat(c.PostForm(\"ambientTemp\"), 64)\n\tif err != nil {\n\t\tfmt.Println(\"Couldn't read ambient temp\")\n\t\tpanic(err)\n\t}\n\n\thumidity, err := strconv.ParseFloat(c.PostForm(\"humidity\"), 64)\n\tif err != nil {\n\t\tfmt.Println(\"Couldn't read humidity\")\n\t\tpanic(err)\n\t}\n\n\tdb, ok := c.MustGet(\"databaseConn\").(*gorm.DB)\n\tif !ok {\n\t\treturn\n\t}\n\n\tnewStats := models.Stats{\n\t\tFreeMemory: freeMemory,\n\t\tUptime: uptime,\n\t\tTemperature: temperature,\n\t\tAmbientTemperature: ambientTemp,\n\t\tCPUTemperature: cpuTemp,\n\t\tHumidity: humidity}\n\n\tfmt.Println(newStats)\n\tdb.Save(&newStats)\n\n\tc.Status(http.StatusOK)\n}", "func CreateTimeEntry(newEntry models.TimeEntry) uint {\n\t// Connect to the DB\n\tdbConn := ConnectDB()\n\n\t// sp_time_insert stored procedure returns the id of the new time entry\n\t// so call QueryRow with a prepared statement to just grab this value\n\t// QueryRow returns a pointer to an instance of sql.Row with a single value\n\trow := dbConn.QueryRow(`call sp_time_insert($1, $2, $3, $4, $5, 0)`,\n\t\tnewEntry.User.Id,\n\t\tnewEntry.Organisation.Id,\n\t\tnewEntry.Comments,\n\t\tnewEntry.Value,\n\t\tnewEntry.ValueType)\n\n\t// Parse the new time entry id returned by the db in the row variable\n\t// and handle any returned errors\n\terr := row.Scan(&newEntry.Id)\n\thelpers.HandleError(err)\n\n\t// Insert any tags linked to the time entry\n\tinsertTags(&newEntry.Tags, newEntry.Id, newEntry.User.Id)\n\n\t// Insert any repo items for the new time entry\n\tinsertRepoItem(&newEntry.RepoItems, newEntry.Id)\n\n\t// Return the time entries new id\n\treturn newEntry.Id\n}", "func PostEntryNew(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {\n\tif isLoggedIn(w, req) {\n\t\tq := req.URL.Query()\n\t\tbox, _ := strconv.Atoi(q[\"box\"][0])\n\t\tpacket, _ := strconv.Atoi(q[\"packet\"][0])\n\t\tid, _ := strconv.Atoi(q[\"product\"][0])\n\t\tje := opdatabase.JournalEntry{\n\t\t\tID: 0,\n\t\t\tLabour: q[\"labour\"][0],\n\t\t\tDate: q[\"date\"][0],\n\t\t\tBox: box,\n\t\t\tPacket: packet,\n\t\t\tProductID: id,\n\t\t}\n\t\tgo model.UpdateLabourNames(je.Labour, je.Date, labours)\n\t\tmodel.CreateJournalEntry(je)\n\t\tres := Response{\n\t\t\t301,\n\t\t\tResponse{20, \", \"},\n\t\t}\n\t\tp, err := json.Marshal(res)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\tio.WriteString(w, string(p))\n\n\t}\n}", "func CreateMenu(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\tvar menu Menu\n\tif err := json.NewDecoder(r.Body).Decode(&menu); err != nil {\n\t\tRespondWithError(w, http.StatusBadRequest, \"Invalid request payload\")\n\t\treturn\n\t}\n\tmenu.ID = bson.NewObjectId()\n\n\t// set Date for every entry\n\tdays := []string{\"Mon\", \"Tue\", \"Wed\", \"Thr\", \"Fri\", \"Sat\", \"Sun\"}\n\tdates := WholeWeekDates(time.Now().AddDate(0, 0, 7))\n\n\tfor i := range days {\n\t\treflect.ValueOf(&menu.MessUP).Elem().FieldByName(days[i]).FieldByName(\"Date\").Set(reflect.ValueOf(dates[i]))\n\t\treflect.ValueOf(&menu.MessDown).Elem().FieldByName(days[i]).FieldByName(\"Date\").Set(reflect.ValueOf(dates[i]))\n\t}\n\n\tif err := mdao.Insert(menu); err != nil {\n\t\tRespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\tRespondWithJSON(w, http.StatusCreated, menu)\n}", "func (c *ConsulDB) CreateEntry(key string, value string) error {\n\tkv := c.consulClient.KV()\n\n\tp := &consulapi.KVPair{Key: key, Value: []byte(value)}\n\n\t_, err := kv.Put(p, nil)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func DefaultCreateUserInfo(ctx context.Context, in *UserInfo, db *gorm.DB) (*UserInfo, error) {\n\tif in == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithBeforeCreate_); ok {\n\t\tif db, err = hook.BeforeCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithAfterCreate_); ok {\n\t\tif err = hook.AfterCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func (m *UserExtModel) Create(ctx context.Context, kv query.KV) (int64, error) {\n\n\tif _, ok := kv[\"created_at\"]; !ok {\n\t\tkv[\"created_at\"] = time.Now()\n\t}\n\n\tif _, ok := kv[\"updated_at\"]; !ok {\n\t\tkv[\"updated_at\"] = time.Now()\n\t}\n\n\tsqlStr, params := m.query.Table(m.tableName).ResolveInsert(kv)\n\n\tres, err := m.db.ExecContext(ctx, sqlStr, params...)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn res.LastInsertId()\n}", "func (repo *Repository) Create(ctx context.Context, claims auth.Claims, req CreateRequest, now time.Time) (*Expenditure, error) {\n\tspan, ctx := tracer.StartSpanFromContext(ctx, \"internal.expenditure.Create\")\n\tdefer span.Finish()\n\tif claims.Audience == \"\" {\n\t\treturn nil, errors.WithStack(ErrForbidden)\n\t}\n\n\t// Admin users can update branch they have access to.\n\tif !claims.HasRole(auth.RoleAdmin) {\n\t\treturn nil, errors.WithStack(ErrForbidden)\n\t}\n\n\t// Validate the request.\n\tv := webcontext.Validator()\n\terr := v.StructCtx(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// If now empty set it to the current time.\n\tif now.IsZero() {\n\t\tnow = time.Now()\n\t}\n\n\t// Always store the time as UTC.\n\tnow = now.UTC()\n\t// Postgres truncates times to milliseconds when storing. We and do the same\n\t// here so the value we return is consistent with what we store.\n\tnow = now.Truncate(time.Millisecond)\n\n\tsalesRep, err := models.Users(models.UserWhere.PhoneNumber.EQ(req.SalesRepPhoneNumber)).One(ctx, repo.DbConn)\n\tif err != nil {\n\t\tif err.Error() == sql.ErrNoRows.Error() {\n\t\t\treturn nil, errors.New(\"Invalid phone number\")\n\t\t}\n\t\treturn nil, err\n\t}\n\tm := models.RepsExpense{\n\t\tID: uuid.NewRandom().String(),\n\t\tSalesRepID: salesRep.ID,\n\t\tDate: now.Unix(),\n\t\tAmount: req.Amount,\n\t\tReason: req.Reason,\n\t}\n\n\tif err := m.Insert(ctx, repo.DbConn, boil.Infer()); err != nil {\n\t\treturn nil, errors.WithMessage(err, \"Insert expenditure failed\")\n\t}\n\n\treturn &Expenditure{\n\t\tID: m.ID,\n\t\tSalesRepID: req.SalesRepPhoneNumber,\n\t\tDate: now,\n\t\tAmount: req.Amount,\n\t\tReason: req.Reason,\n\t}, nil\n}", "func (e *Exhibition) Create() error {\n\tif err := e.Validate(); err != nil {\n\t\treturn err\n\t}\n\tb := e.GetByteId()\n\t_, err := db.Exec(`\n\t\tINSERT INTO\n\t\t\texhibition\n\t\t\t(id, _byteid, gallery_id, title, description, date_range)\n\t\tVALUES\n\t\t\t($1, $2, $3, $4, $5, $6)\n\t`, e.Id, b, e.GalleryId, e.Title, e.Description, e.DateRange.Format())\n\treturn err\n}", "func makeEntry(title string, status string, action string, e string) {\n\tquery, err := db.Prepare(\"INSERT INTO vlog (VideoTitle, DownloadStatus, Activity , ErrorMsg) VALUES (?, ?, ?, ?)\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tquery.Exec(title, status, action, e)\n}", "func createGameDayReport(date string) (*gameDayReport, error) {\n\tmatches, err := findMatchesByGameDateID(date)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(matches) == 0 {\n\t\treturn nil, fmt.Errorf(\"no matches found for date %s\", date)\n\t}\n\n\treportGames := make(map[int64]gameReport)\n\tfor _, game := range matches {\n\t\tgameReport := gameReport{\n\t\t\tHomeTeam: game.HomeTeam,\n\t\t\tAwayTeam: game.AwayTeam,\n\t\t\tVenue: game.Venue,\n\t\t\tDate: game.StartDate,\n\t\t}\n\n\t\treportGames[game.ID] = gameReport\n\t}\n\n\treport := gameDayReport{\n\t\tID: date,\n\t\tGames: reportGames,\n\t\tDeadline: matches[0].StartDate,\n\t\tEvaluated: false,\n\t}\n\n\terr = upsertGameDayReport(report)\n\treturn &report, err\n}", "func (c *Cruder) create(request *CrudRequest) {\n\tvalues := request.GetValues()\n\tmodelFields := c.model.GetFields()\n\n\tif len(values) == len(modelFields) {\n\t\tformattedValues := make([]interface{}, len(values))\n\n\t\tsort.Sort(ByFieldValueName(values))\n\n\t\tfor i, value := range values {\n\t\t\tformattedValues[i] = value.Value\n\t\t}\n\n\t\t_, err := c.createStatement.Exec(formattedValues...)\n\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t} else {\n\t\tlog.Fatal(\"total columns in create statement doesn't match total columns in table\")\n\t}\n\n}", "func TestCreate(t *testing.T) {\n\tassert := assert.New(t)\n\tacctDefEntry := new(AccountDefEntry)\n\tacctDefEBuilder := &AccountDefEntryBuilder{\n\t\taccountDefEntry: acctDefEntry,\n\t}\n\tacctDE := acctDefEBuilder.Create()\n\tassert.Equal(acctDefEntry, acctDE)\n}", "func (hh *HealthCheckHandler) Create(w http.ResponseWriter, r *http.Request) {\n\treq := &models.CreateHealthCheckRequest{}\n\tif err := json.NewDecoder(r.Body).Decode(req); err != nil {\n\t\thttp.Error(w, marshalError(err.Error()), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif req.Endpoint == \"\" {\n\t\thttp.Error(w, marshalError(\"empty healthcheck endpoint\"), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif _, err := url.ParseRequestURI(req.Endpoint); err != nil {\n\t\thttp.Error(w, marshalError(\"invalid URL\"), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\thc, err := models.NewHealthCheck(req.Endpoint)\n\tif err != nil {\n\t\thttp.Error(w, marshalError(err.Error()), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif err := hh.db.Create(hc); err != nil {\n\t\thttp.Error(w, marshalError(err.Error()), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tresp := &models.CreateHealthCheckResponse{\n\t\tID: hc.ID,\n\t\tEndpoint: hc.Endpoint,\n\t}\n\n\tb, err := json.Marshal(resp)\n\tif err != nil {\n\t\thttp.Error(w, marshalError(err.Error()), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Write(b)\n}", "func (h *Handlers) CreateRecord(c *gin.Context) {\n\tproject := c.Param(\"project\")\n\tprojectIndex := &ProjectIndex{}\n\tc.BindJSON(projectIndex)\n\n\terr := h.db.AddProjectData(project, projectIndex.Data, projectIndex.Meta)\n\tif err != nil {\n\t\ttErr := h.db.TranslateError(err)\n\t\tc.JSON(tErr.Code, tErr.Error())\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusCreated, gin.H{})\n}", "func (m *UserModel) Create(ctx context.Context, kv query.KV) (int64, error) {\n\n\tif _, ok := kv[\"created_at\"]; !ok {\n\t\tkv[\"created_at\"] = time.Now()\n\t}\n\n\tif _, ok := kv[\"updated_at\"]; !ok {\n\t\tkv[\"updated_at\"] = time.Now()\n\t}\n\n\tsqlStr, params := m.query.Table(m.tableName).ResolveInsert(kv)\n\n\tres, err := m.db.ExecContext(ctx, sqlStr, params...)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn res.LastInsertId()\n}", "func (s *serviceOutlite) EntityCreate(input *schemas.SchemaOutlet) (*models.ModelOutlet, schemas.SchemaDatabaseError) {\n\tvar outlet schemas.SchemaOutlet\n\toutlet.Name = input.Name\n\toutlet.Phone = input.Phone\n\toutlet.Address = input.Address\n\toutlet.MerchatID = input.MerchatID\n\n\tres, err := s.outlet.EntityCreate(&outlet)\n\treturn res, err\n}", "func (db *Database) CreateApointment(date string, time string, name string) (string, error) {\n\tuuid := uuid.New().String()\n\n\tif db.TimeIsTaken(date, time) {\n\t\treturn \"\", errors.New(\"time is already taken\")\n\t}\n\n\tdb.Taken[uuid] = Appointment{\n\t\tDate: date,\n\t\tTime: time,\n\t\tName: name,\n\t}\n\n\treturn uuid, nil\n}", "func (handler *TemperatureHandler) Create(c *gin.Context) {\n\tform := forms.NewStoresTemperature()\n\n\tif c.BindJSON(form) == nil {\n\t\tservice := services.NewTemperatureService(handler.MetricRepository)\n\t\tc.JSON(http.StatusOK, service.StoresTemperature(form))\n\t}\n}", "func (r *RootRepository) Create(ent Entity) error {\n\tif err := ent.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif err := r.DB.Create(ent).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func createDefaultUser() error {\n\tdb, err := gorm.Open(\"sqlite3\", dbPath)\n\tdefer db.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\tregisteredValues := 0\n\tdb.Find(&user{}).Count(&registeredValues)\n\tif registeredValues == 0 {\n\t\thashedPassword, _ := bcrypt.GenerateFromPassword([]byte(\"admin\"), 14)\n\t\tdb.Create(&user{\n\t\t\tUsername: \"admin\",\n\t\t\tHashedPassword: hashedPassword,\n\t\t})\n\t}\n\treturn nil\n}", "func DefaultCreatePeriod(ctx context.Context, in *Period, db *gorm.DB) (*Period, error) {\n\tif in == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(PeriodORMWithBeforeCreate_); ok {\n\t\tif db, err = hook.BeforeCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(PeriodORMWithAfterCreate_); ok {\n\t\tif err = hook.AfterCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func (r *HousingTypology) Create(db *sql.DB) error {\n\treturn db.QueryRow(`INSERT INTO housing_typology(name) VALUES($1) RETURNING id`,\n\t\t&r.Name).Scan(&r.ID)\n}", "func (s service) Create(ctx context.Context, email, component, environment, message string, data map[string]string) (*models.Event, error) {\n\tval, _ := json.Marshal(data)\n\te := &models.Event{\n\t\tEmail: email,\n\t\tComponent: component,\n\t\tEnvironment: environment,\n\t\tMessage: message,\n\t\tData: datatypes.JSON([]byte(val)),\n\t}\n\tevent, err := e.Create(s.DB)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event, nil\n}", "func (vrsConnection *VRSConnection) CreateEntity(info EntityInfo) error {\n\n\tif len(info.UUID) == 0 {\n\t\treturn fmt.Errorf(\"Uuid absent\")\n\t}\n\n\tif len(info.Name) == 0 {\n\t\treturn fmt.Errorf(\"Name absent\")\n\t}\n\n\t// The Nuage_VM_Table has separate columns for enterprise and user.\n\t// Hence make a copy of the metadata and delete these keys.\n\tvar metadata map[string]string\n\tif info.Metadata != nil {\n\t\tmetadata = make(map[string]string)\n\t\tfor k, v := range info.Metadata {\n\t\t\tmetadata[string(k)] = v\n\t\t}\n\t}\n\t//delete(metadata, string(entity.MetadataKeyEnterprise))\n\tdelete(metadata, string(entity.MetadataKeyUser))\n\n\tnuageVMTableRow := ovsdb.NuageVMTableRow{\n\t\tType: int(info.Type),\n\t\tVMName: info.Name,\n\t\tVMUuid: info.UUID,\n\t\tDomain: info.Domain,\n\t\tNuageUser: info.Metadata[entity.MetadataKeyUser],\n\t\tNuageEnterprise: info.Metadata[entity.MetadataKeyEnterprise],\n\t\tMetadata: metadata,\n\t\tPorts: info.Ports,\n\t\tEvent: int(entity.EventCategoryDefined),\n\t\tEventType: int(entity.EventDefinedAdded),\n\t\tState: int(entity.Running),\n\t\tReason: int(entity.RunningUnknown),\n\t}\n\n\tif info.Events != nil {\n\t\tnuageVMTableRow.Event = int(info.Events.EntityEventCategory)\n\t\tnuageVMTableRow.EventType = int(info.Events.EntityEventType)\n\t\tnuageVMTableRow.State = int(info.Events.EntityState)\n\t\tnuageVMTableRow.Reason = int(info.Events.EntityReason)\n\t}\n\n\tif err := vrsConnection.vmTable.InsertRow(vrsConnection.ovsdbClient, &nuageVMTableRow); err != nil {\n\t\treturn fmt.Errorf(\"Problem adding entity info to VRS %v\", err)\n\t}\n\n\treturn nil\n}", "func DefaultCreateIntPoint(ctx context.Context, in *IntPoint, db *gorm1.DB) (*IntPoint, error) {\n\tif in == nil {\n\t\treturn nil, errors.New(\"Nil argument to DefaultCreateIntPoint\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func (s *business) Create(example repository.Example) *response.Error {\n\ts.logger = s.loggerClone\n\ts.logger.SugaredLogger = s.logger.With(\"method\", \"Create\")\n\n\texample.ExampleID = util.GetUUID()\n\texample.Status = \"Pending\"\n\texample.CreateTime = time.Now()\n\n\terr := s.repository.CreateExample(example)\n\tif err != nil {\n\t\ts.logger.Errorw(\"create data error\", \"error\", err)\n\t\treturn response.NewErrorFromCode(errorcode.CreateDataError)\n\t}\n\n\treturn nil\n}", "func Create(ctx *gin.Context, data interface{}) {\n\tctx.JSON(http.StatusCreated, gin.H{\"code\": merrors.ErrSuccess, \"data\": nil})\n\treturn\n}", "func CreateLog(contextName string, env string) map[string]interface{} {\n\tmessage := fmt.Sprint(\"Creating log in Logentries for \", contextName, \" \", env, \"\\n\")\n\tlog.Println(message)\n\n\tlogName := fmt.Sprint(strings.Title(contextName), \" \", strings.Title(env))\n\n\tpostData := map[string]interface{}{\n\t\t\"log\": map[string]interface{}{\n\t\t\t\"name\": logName,\n\t\t\t\"structures\": [1]string{\n\t\t\t\tconfig.Reader.LogentriesHerokuLogStructureID,\n\t\t\t},\n\t\t\t\"user_data\": map[string]string{},\n\t\t\t\"source_type\": \"token\",\n\t\t\t\"tokens\": [0]string{},\n\t\t\t\"logsets_info\": [1]map[string]string{\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"id\": config.Reader.LogentriesLogsetKey,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\turl := fmt.Sprint(config.Reader.LogentriesAPIEndpoint, \"/management/logs\")\n\tresp := httphelper.ExecutePostReqAndParseResp(postData, url, client)\n\treturn resp.(map[string]interface{})\n}", "func (m *PasswordResetModel) Create(ctx context.Context, kv query.KV) (int64, error) {\n\n\tif _, ok := kv[\"created_at\"]; !ok {\n\t\tkv[\"created_at\"] = time.Now()\n\t}\n\n\tsqlStr, params := m.query.Table(m.tableName).ResolveInsert(kv)\n\n\tres, err := m.db.ExecContext(ctx, sqlStr, params...)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn res.LastInsertId()\n}", "func (rh *RestHandler) Create(w http.ResponseWriter, r *http.Request) {\n\terr := r.ParseForm()\n\tif err != nil {\n\t\twriteError(w, http.StatusBadRequest, \"unable to parse form values\")\n\t\treturn\n\t}\n\n\tjob := model.Job{}\n\tif r.FormValue(\"partner_id\") == \"\" {\n\t\twriteError(w, http.StatusBadRequest, \"missing partner_id value\")\n\t\treturn\n\t}\n\tjob.PartnerID, err = strconv.ParseInt(r.FormValue(\"partner_id\"), 10, 64)\n\tif err != nil {\n\t\twriteError(w, http.StatusBadRequest, \"invalid partner_id value\")\n\t\treturn\n\t}\n\tif r.FormValue(\"category_id\") == \"\" {\n\t\twriteError(w, http.StatusBadRequest, \"missing category_id value\")\n\t\treturn\n\t}\n\tjob.CategoryID, err = strconv.ParseInt(r.FormValue(\"category_id\"), 10, 64)\n\tif err != nil {\n\t\twriteError(w, http.StatusBadRequest, errors.Wrap(err, \"invalid category_id value\").Error())\n\t\treturn\n\t}\n\tjob.Title = strings.TrimSpace(r.FormValue(\"title\"))\n\tif job.Title == \"\" {\n\t\twriteError(w, http.StatusBadRequest, \"missing or empty title given\")\n\t\treturn\n\t}\n\n\tif r.FormValue(\"expires_at\") == \"\" {\n\t\twriteError(w, http.StatusBadRequest, \"missing expires_at value\")\n\t\treturn\n\t}\n\tnow := time.Now()\n\tjob.ExpiresAt, err = time.ParseInLocation(model.DateFormat, r.FormValue(\"expires_at\"), now.Location())\n\tif err != nil || job.ExpiresAt.IsZero() {\n\t\twriteError(w, http.StatusBadRequest, errors.Wrap(err, \"invalid expiration date\").Error())\n\t\treturn\n\t}\n\t//Times are parsed without hour, so whe have to add the hours until de end of the day\n\tjob.ExpiresAt = job.ExpiresAt.Add(23*time.Hour + 59*time.Minute + 59*time.Second)\n\tif job.ExpiresAt.Before(now) {\n\t\twriteError(w, http.StatusBadRequest, \"job already expired\")\n\t\treturn\n\t}\n\treq := model.RequestCreate{}\n\treq.Job = job\n\n\tencreq, err := crypt.EncryptRequest(rh.cipher, req)\n\tif err != nil {\n\t\twriteError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\t_, err = rh.backend.Create(context.Background(), encreq)\n\tif err != nil {\n\t\twriteError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\twriteResponse(w, http.StatusCreated, nil)\n}", "func (d *DiaryAPI) CreateNewDiaryHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"/createNewDiary\")\n\n\tvar diary Diary\n\tcurrentTime := time.Now()\n\tcreatedDate := currentTime.Format(layoutISO)\n\tdiary.UpdatedAt = createdDate\n\tdiary.CreatedAt = createdDate\n\terr := json.NewDecoder(r.Body).Decode(&diary)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\td.isAuthorized(w, r)\n\tdefer r.Body.Close()\n\n\tfmt.Println(diary.Id)\n\tif _, err := d.DiaryService.createNewDiary(diary); err != nil {\n\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\trespondWithJSON(w, http.StatusOK, diary)\n}", "func (h *Hotel) Create(a *config.AppContext) error {\n\treturn a.Db.Create(h).Error\n}", "func (s *TimeEntriesService) Create(te *TimeEntry) (*TimeEntry, error) {\n\tu := \"time_entries\"\n\ttec := &TimeEntryCreate{te}\n\treq, err := s.client.NewRequest(\"POST\", u, tec)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata := new(TimeEntryResponse)\n\t_, err = s.client.Do(req, data)\n\n\treturn data.Data, err\n}", "func (s *Postgres) Create(metric Metric) (Metric, error) {\n\t_, err := s.db.Model(&metric).\n\t\tReturning(\"*\").\n\t\tInsert()\n\n\tif err != nil {\n\t\treturn Metric{},\n\t\t\terrors.Wrapf(err, \"failed to store metric %s\", metric.Name)\n\t}\n\n\treturn metric, nil\n}", "func hNewEvent(c echo.Context) error {\n\tvar e httpError\n\n\tif (len(c.FormValue(\"code\")) == 0) || (len(c.FormValue(\"title\")) == 0) {\n\t\treturn c.JSON(http.StatusNotAcceptable, \"input information is not valid\")\n\t}\n\tuserCODE := c.FormValue(\"code\")\n\n\t// read from token user id\n\tvar tokenUserID int64\n\ttokenUserID = 1\n\n\tu, errGet := blog.GetUserByCode(tokenUserID, userCODE)\n\tif errGet != nil {\n\t\te.TheError = \"user code \" + userCODE + \" not found.\"\n\t\treturn c.JSON(http.StatusNotFound, e)\n\t}\n\tvar ev Event\n\tev.OpenedByUserID = u.ID\n\tev.Contents = c.FormValue(\"content\")\n\tev.Title = c.FormValue(\"title\")\n\n\terrAdd := blog.AddEvent(&ev)\n\tif errAdd != nil {\n\t\te.TheError = errAdd.Error()\n\t\treturn c.JSON(http.StatusInternalServerError, e)\n\t}\n\tfname, errUpload := lowlevelUploadFile(c, u.ID, ev.ID)\n\tif errUpload != nil {\n\t\te.TheError = \"could not upload file: \" + errUpload.Error()\n\t\treturn c.JSON(http.StatusInternalServerError, e)\n\t}\n\te.TheError = \"OK\" + \" - \" + fname\n\treturn c.JSON(http.StatusOK, e)\n}", "func (t TalentRepositoryImpl) Create(ctx context.Context, talent entity.Talent) (int64, error) {\n\tquery, args, err := squirrel.Insert(\"talent\").Columns(\n\t\t\"name\",\n\t).Values(talent.Name).ToSql()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tres, err := t.db.ExecContext(ctx, query, args...)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tid, err := res.LastInsertId()\n\tlog.Printf(\"success insert talent : %s, with id %d\", talent.Name, id)\n\n\treturn id, nil\n}", "func (t *HeathCare_Chaincode) createMedicalRecord(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tfmt.Println(\"\\n=============== start createMedicalRecord function ===============\")\n\tstart := time.Now()\n\ttime.Sleep(time.Second)\n\n\tif len(args) != 7 {\n\t\treturn shim.Error(\"there must be 7 argument\")\n\t}\n\n\tfor i := 0; i < len(args); i++ {\n\t\tif len(args[i]) == 0 {\n\t\t\treturn shim.Error(\"argument \" + strconv.Itoa(i+1) + \" must be declare\")\n\t\t}\n\t}\n\tpatientId := args[0]\n\tpersonalIdentificationInformation := args[1]\n\tmedicalHistory := args[2]\n\tfamilyMedicalHistory := args[3]\n\tmedicationHistory := args[4]\n\ttreatmentHistory := args[5]\n\tmedicalDirectives := args[6]\n\n\t//convert variable to json\n\tobjectType := \"MedicalRecord\"\n\tmedialRecord := &MedicalRecord{objectType, patientId, personalIdentificationInformation,\n\t\tmedicalHistory, familyMedicalHistory, medicationHistory,\n\t\ttreatmentHistory, medicalDirectives}\n\n\t//convert data to byte\n\tMedicalRecordAsByte, errMedicalRecordAsByte := json.Marshal(medialRecord)\n\tif errMedicalRecordAsByte != nil {\n\t\treturn shim.Error(errMedicalRecordAsByte.Error())\n\t}\n\n\t//save to database\n\terrMedicalRecordAsByte = stub.PutPrivateData(\"MedicalRecordCollection\", patientId, MedicalRecordAsByte)\n\tif errMedicalRecordAsByte != nil {\n\t\treturn shim.Error(errMedicalRecordAsByte.Error())\n\t}\n\n\t//create index key\n\tindexName := \"id\"\n\tmedicalRecordIndexKey, errMedicalRecordIndexKey := stub.CreateCompositeKey(indexName, []string{medialRecord.ID, medialRecord.PersonalIdentificationInformation, medialRecord.MedicalHistory, medialRecord.FamilyMedicalHistory, medialRecord.MedicationHistory, medialRecord.TreatmentHistory, medialRecord.MedicalDirectives})\n\tif errMedicalRecordIndexKey != nil {\n\t\treturn shim.Error(errMedicalRecordIndexKey.Error())\n\t}\n\n\t//save index\n\tvalue := []byte{0x00}\n\tstub.PutPrivateData(\"MedicalRecordCollection\", medicalRecordIndexKey, value)\n\n\tend := time.Now()\n\telapsed := time.Since(start)\n\n\tfmt.Println(\"\\nfunction createMedicalRecord\")\n\tfmt.Printf(\"time start: %s\", start.String())\n\tfmt.Printf(\"time end: %s\", end.String())\n\tfmt.Println(\"time execute: \", elapsed.String())\n\tfmt.Println(\"=============== end createMedicalRecord function ===============\")\n\treturn shim.Success(nil)\n}", "func (a *HyperflexApiService) CreateHyperflexSoftwareDistributionEntry(ctx context.Context) ApiCreateHyperflexSoftwareDistributionEntryRequest {\n\treturn ApiCreateHyperflexSoftwareDistributionEntryRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (g *Group) NewEntry() (*Entry, error) {\n\tid, err := uuids.New4(g.db.rand)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\te := &Entry{UUID: id, db: g.db}\n\tg.entries = append(g.entries, e)\n\tg.db.entries = append(g.db.entries, e)\n\treturn e, nil\n}", "func (s *Store) Create(c *gin.Context) {\n\n}", "func (u *InformationRepository) Create(model *models.Information) error {\n\tquery := u.InformationTable().Create(model)\n\tif err := query.Error; err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (t *HeathCare_Chaincode) createHospitalFees(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tfmt.Println(\"\\n=============== start createHospitalFees function ===============\")\n\tstart := time.Now()\n\ttime.Sleep(time.Second)\n\n\t//check length of data\n\tif len(args) != 3 {\n\t\treturn shim.Error(\"expecting 3 argument\")\n\t}\n\n\t//define data variable\n\tid := args[0]\n\tpatientName := args[1]\n\taccount := args[2]\n\tdateOfService := args[3]\n\tpatientService := args[4]\n\tprimaryInsuranceBilled := args[5]\n\tsecondaryInsuranceBilled := args[6]\n\tpharmacy := args[7]\n\troom := args[8]\n\tamountDue := args[9]\n\n\tObjectType := \"HospitalFees\"\n\thospitalFees := &HospitalFees{ObjectType, id, patientName, account, dateOfService,\n\t\tpatientService, primaryInsuranceBilled, secondaryInsuranceBilled, pharmacy,\n\t\troom, amountDue}\n\n\t//marshal delivery to byte\n\thospitalFeesAsByte, errHospitalFeesAsByte := json.Marshal(hospitalFees)\n\tif errHospitalFeesAsByte != nil {\n\t\treturn shim.Error(\"cannot marshal pharmacy's data\")\n\t}\n\n\t//put data to ledger\n\terrHospitalFeesAsByte = stub.PutPrivateData(\"HospitalFeesCollection\", id, hospitalFeesAsByte)\n\tif errHospitalFeesAsByte != nil {\n\t\treturn shim.Error(\"cannot put private data of pharmacy\")\n\t}\n\n\t//create index key\n\tindexKey := \"id~patient_name\"\n\thospitalFeesIndexKey, errHospitalFeesIndexKey := stub.CreateCompositeKey(indexKey, []string{hospitalFees.ID, hospitalFees.PatientName, hospitalFees.Account, hospitalFees.DateOfService, hospitalFees.PatientService, hospitalFees.PrimaryInsuranceBilled, hospitalFees.SecondaryInsuranceBilled, hospitalFees.Pharmacy, hospitalFees.Room, hospitalFees.AmountDue})\n\tif errHospitalFeesIndexKey != nil {\n\t\treturn shim.Error(\"cannot create index key of delivery\")\n\t}\n\n\t//save key\n\tvalue := []byte{0x00}\n\tstub.PutPrivateData(\"HospitalFeesCollection\", hospitalFeesIndexKey, value)\n\n\tend := time.Now()\n\telapsed := time.Since(start)\n\n\tfmt.Println(\"\\nfunction createHospitalFees\")\n\tfmt.Println(\"time start: \", start.String())\n\tfmt.Println(\"time end: \", end.String())\n\tfmt.Println(\"time execute: \", elapsed.String())\n\tfmt.Println(\"=============== end createHospitalFees function ===============\")\n\ttime.Sleep(time.Second)\n\n\treturn shim.Success(nil)\n}", "func CreatePerson(c *gin.Context) {\n // Validate input\n var input CreatePersonInput\n if err := c.ShouldBindJSON(&input); err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n return\n }\n\n // Create person\n person := models.Person{CreatedBy: input.CreatedBy, FirstName: input.FirstName, LastName: input.LastName, Email: input.Email, Phone: input.Phone, Birthday: input.Birthday, Title: input.Title, Department: input.Department}\n models.DB.Create(&person)\n\n c.JSON(http.StatusOK, gin.H{\"data\": person})\n}", "func (fs EntityWatcherFuncs) EntityCreated(e Entity, t Type) { fs.Created(e, t) }", "func (r *repositorySupplier) EntityCreate(input *schemas.SchemaSupplier) (*models.ModelSupplier, schemas.SchemaDatabaseError) {\n\tvar supplier models.ModelSupplier\n\tphone, _ := strconv.ParseUint(input.Phone, 10, 64)\n\tsupplier.Name = input.Name\n\tsupplier.Phone = phone\n\tsupplier.Address = input.Address\n\n\terr := make(chan schemas.SchemaDatabaseError, 1)\n\n\tdb := r.db.Model(&supplier)\n\n\tcheckSupplierName := db.Debug().First(&supplier, \"name = ?\", supplier.Name)\n\n\tif checkSupplierName.RowsAffected > 0 {\n\t\terr <- schemas.SchemaDatabaseError{\n\t\t\tCode: http.StatusConflict,\n\t\t\tType: \"error_create_01\",\n\t\t}\n\t\treturn &supplier, <-err\n\t}\n\n\tcheckSupplierPhone := db.Debug().First(&supplier, \"phone = ?\", supplier.Phone)\n\n\tif checkSupplierPhone.RowsAffected > 0 {\n\t\terr <- schemas.SchemaDatabaseError{\n\t\t\tCode: http.StatusConflict,\n\t\t\tType: \"error_create_02\",\n\t\t}\n\t\treturn &supplier, <-err\n\t}\n\n\taddSupplier := db.Debug().Create(&supplier).Commit()\n\n\tif addSupplier.RowsAffected < 1 {\n\t\terr <- schemas.SchemaDatabaseError{\n\t\t\tCode: http.StatusForbidden,\n\t\t\tType: \"error_create_03\",\n\t\t}\n\t\treturn &supplier, <-err\n\t}\n\n\terr <- schemas.SchemaDatabaseError{}\n\treturn &supplier, <-err\n}", "func (h *Hook) newEntry(entry *logrus.Entry) *logrus.Entry {\n\tdata := map[string]interface{}{}\n\n\tfor k, v := range h.Options {\n\t\tdata[k] = v\n\t}\n\tfor k, v := range entry.Data {\n\t\tdata[k] = v\n\t}\n\treturn &logrus.Entry{\n\t\tLogger: entry.Logger,\n\t\tTime: entry.Time,\n\t\tLevel: entry.Level,\n\t\tData: data,\n\t\tMessage: entry.Message,\n\t}\n}", "func (l *log) create(value []byte) *Entry {\n\tentry := &Entry{\n\t\tIndex: len(l.entries),\n\t\tValue: value,\n\t}\n\tl.entries = append(l.entries, entry)\n\treturn entry\n}", "func Create(record Record) {\r\n\tdb.QueryRow(\"insert into records values($1,$2,$3,$4,$5)\", record.Uuid, record.Mail, record.Seq, record.Pssm, record.Result)\r\n}", "func CreateSearchRecord(s SearchFields) error {\n\t_, err := db.Query(`INSERT INTO queries(data, created_at, updated_at) VALUES($1,'now()',now())`, s)\n\treturn err\n}", "func CreateDinner(date string, venue string, hostName string, attendeeNames []string) (model.Dinner, error) {\n\tdateTime, err := time.Parse(model.DateFormat, date)\n\tif err != nil {\n\t\treturn model.Dinner{}, err\n\t}\n\n\trow, err := database.InsertDinner(dateTime, venue, hostName)\n\tif err != nil {\n\t\treturn model.Dinner{}, err\n\t}\n\n\tdinner, err := model.NewDinnerFromMap(row)\n\tif err != nil {\n\t\treturn dinner, err\n\t}\n\n\tdinner.Attended, err = database.InsertGuests(dinner.ID, attendeeNames)\n\treturn dinner, err\n}", "func (dao *DAOName) Create(m *ReferenceModel) error {\n\tif err := dao.db.Create(m).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func CreateDefaultUser(username, password string) (err error) {\n\n err = checkInit()\n if err != nil {\n return\n }\n\n var users = data[\"users\"].(map[string]interface{})\n // Check if the default user exists\n if len(users) > 0 {\n err = createError(001)\n return\n }\n\n var defaults = defaultsForNewUser(username, password)\n users[defaults[\"_id\"].(string)] = defaults\n saveDatabase(data)\n\n return\n}", "func NewEntry(env env.Core, logger *logrus.Logger) *logrus.Entry {\n\tlogger.AddHook(&payloadHook{\n\t\tpayload: &AuditPayload{},\n\t\tenv: env,\n\t})\n\n\treturn logrus.NewEntry(logger)\n}", "func (s *Store) createEntry(URL, remoteAddr string) (string, error) {\n\tid := generateRandomString(s.idLength)\n\texists := s.checkExistence(id)\n\tif !exists {\n\t\traw, err := json.Marshal(Entry{\n\t\t\tURL: URL,\n\t\t\tRemoteAddr: remoteAddr,\n\t\t\tCreatedOn: time.Now(),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn id, s.createEntryRaw([]byte(id), raw)\n\t}\n\treturn \"\", errors.New(\"entry already exists\")\n}", "func StartCreateEntryCall(m telemetry.Metrics) *telemetry.CallCounter {\n\treturn telemetry.StartCall(m, telemetry.RegistrationAPI, telemetry.Entry, telemetry.Create)\n}", "func CreateMilestoneData(advance int, interval string, logger *log.Logger, api string) map[string]Milestone {\n\ttoday := time.Now().Local()\n\tmilestones := map[string]Milestone{}\n\tswitch interval {\n\tcase \"daily\":\n\t\tfor i := 0; i < advance; i++ {\n\t\t\tvar m Milestone\n\t\t\tvar dueDate string\n\t\t\ttitle := today.AddDate(0, 0, i).Format(\"2006-01-02\")\n\t\t\tswitch api {\n\t\t\tcase \"gitlab\":\n\t\t\t\tdueDate = today.AddDate(0, 0, i).Format(\"2006-01-02\")\n\t\t\tcase \"github\":\n\t\t\t\tdueDate = today.AddDate(0, 0, i).Format(time.RFC3339)\n\t\t\t}\n\t\t\tm.Title = title\n\t\t\tm.DueDate = dueDate\n\t\t\tmilestones[title] = m\n\t\t}\n\tcase \"weekly\":\n\t\tfor i := 0; i < advance; i++ {\n\t\t\tvar m Milestone\n\t\t\tvar dueDate string\n\t\t\tlastDay := LastDayWeek(today)\n\t\t\tyear, week := lastDay.ISOWeek()\n\t\t\ttitle := strconv.Itoa(year) + \"-w\" + strconv.Itoa(week)\n\t\t\tswitch api {\n\t\t\tcase \"gitlab\":\n\t\t\t\tdueDate = lastDay.Format(\"2006-01-02\")\n\t\t\tcase \"github\":\n\t\t\t\tdueDate = lastDay.Format(time.RFC3339)\n\t\t\t}\n\t\t\tm.Title = title\n\t\t\tm.DueDate = dueDate\n\t\t\tmilestones[title] = m\n\t\t\ttoday = lastDay.AddDate(0, 0, 7)\n\t\t}\n\tcase \"monthly\":\n\t\tfor i := 0; i < advance; i++ {\n\t\t\tvar m Milestone\n\t\t\tvar dueDate string\n\t\t\tdate := today.AddDate(0, i, 0)\n\t\t\tlastDay := LastDayMonth(date.Year(), int(date.Month()), time.UTC)\n\t\t\ttitle := date.Format(\"2006-01\")\n\t\t\tswitch api {\n\t\t\tcase \"gitlab\":\n\t\t\t\tdueDate = lastDay.Format(\"2006-01-02\")\n\t\t\tcase \"github\":\n\t\t\t\tdueDate = lastDay.Format(time.RFC3339)\n\t\t\t}\n\t\t\tm.Title = title\n\t\t\tm.DueDate = dueDate\n\t\t\tmilestones[title] = m\n\t\t}\n\tdefault:\n\t\tlogger.Println(\"Error: Incorrect interval\")\n\t\treturn milestones\n\t}\n\n\treturn milestones\n}", "func handleAppInstanceStatusCreate(ctxArg interface{}, key string,\n\tstatusArg interface{}) {\n\tctx := ctxArg.(*zedmanagerContext)\n\tpublishAppInstanceSummary(ctx)\n}", "func (this *EntityManager) createEntity(parent Entity, attributeName string, entity Entity) (Entity, *CargoEntities.Error) {\r\n\r\n\t// Set the entity values here.\r\n\ttypeName := entity.GetTypeName() // Set the type name if not already set...\r\n\tentity.SetParentLnk(attributeName)\r\n\tentity.SetParentUuid(parent.GetUuid())\r\n\r\n\t// Here I will set the entity on the cache...\r\n\tthis.setEntity(entity)\r\n\r\n\tstoreId := typeName[0:strings.Index(typeName, \".\")]\r\n\tprototype, _ := GetServer().GetEntityManager().getEntityPrototype(typeName, storeId)\r\n\r\n\t// Now entity are quadify I will save it in the graph store.\r\n\tstore := GetServer().GetDataManager().getDataStore(storeId)\r\n\r\n\t// I will create the entity.\r\n\t_, err := store.Create(\"\", []interface{}{entity})\r\n\tif err != nil {\r\n\t\tcargoError := NewError(Utility.FileLine(), ENTITY_CREATION_ERROR, SERVER_ERROR_CODE, err)\r\n\t\treturn nil, cargoError\r\n\t}\r\n\r\n\t//LogInfo(\"---> create entity \", entity.GetUuid())\r\n\tentity.SetNeedSave(false)\r\n\r\n\t// also save it parent.\r\n\tif parent != nil {\r\n\t\t// Now I will save it in the datastore.\r\n\t\t// I will set the entity parent.\r\n\t\tcargoError := this.setParent(parent, entity)\r\n\t\tif cargoError != nil {\r\n\t\t\treturn nil, cargoError\r\n\t\t}\r\n\t} else {\r\n\t\tcargoError := NewError(Utility.FileLine(), ENTITY_CREATION_ERROR, SERVER_ERROR_CODE, errors.New(\"parent must not be nil when createEntity is call.\"))\r\n\t\treturn nil, cargoError\r\n\t}\r\n\r\n\t// The event data...\r\n\teventData := make([]*MessageData, 2)\r\n\tmsgData0 := new(MessageData)\r\n\tmsgData0.Name = \"entity\"\r\n\tif reflect.TypeOf(entity).String() == \"*Server.DynamicEntity\" {\r\n\t\tmsgData0.Value = entity.(*DynamicEntity).getValues()\r\n\t} else {\r\n\t\tmsgData0.Value = entity\r\n\t}\r\n\teventData[0] = msgData0\r\n\r\n\tmsgData1 := new(MessageData)\r\n\tmsgData1.Name = \"prototype\"\r\n\tmsgData1.Value = prototype\r\n\teventData[1] = msgData1\r\n\r\n\tevt, _ := NewEvent(NewEntityEvent, EntityEvent, eventData)\r\n\tGetServer().GetEventManager().BroadcastEvent(evt)\r\n\r\n\t// Set it childs...\r\n\tthis.saveChilds(entity, prototype)\r\n\r\n\treturn entity, nil\r\n}", "func Create(ctx *gin.Context) {\n\n}", "func CreatePsychologist(dbase *gorm.DB, w http.ResponseWriter, r *http.Request) {\n\tuser := &db.Psychologist{}\n\terr := json.NewDecoder(r.Body).Decode(&user)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t_ = json.NewEncoder(w).Encode(utils.ErrorResponse{\n\t\t\tCode: http.StatusInternalServerError,\n\t\t\tMessage: \"An error occurred\",\n\t\t})\n\t\treturn\n\t}\n\n\tuser.Password = utils.HashPassword(user.Password, w)\n\tif user.Password == \"\" {\n\t\treturn\n\t}\n\n\trs := dbase.Create(&user)\n\tif rs.Error != nil {\n\t\tlog.Println(rs)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tlog.Println(json.NewEncoder(w).Encode(utils.ErrorResponse{\n\t\t\tCode: http.StatusInternalServerError,\n\t\t\tMessage: \"Could not create your account. Please try again later\",\n\t\t}))\n\t\treturn\n\t}\n\n\t// body := struct {\n\t// \tName string\n\t// \tLink string\n\t// }{\n\t// \tName: fmt.Sprintf(\"%s %s\", user.FirstName, user.LastName),\n\t// \tLink: \"https://google.com\",\n\t// }\n\n\t// go func(dbase *gorm.DB, email string, subject string, HTMLTemp string, body interface{}) {\n\t// \terr := utils.SendEmail(dbase, email, subject, HTMLTemp, body)\n\t// \tif err != nil {\n\t// \t\tlog.Println(err)\n\t// \t\t_ = json.NewEncoder(w).Encode(err.Error())\n\t// \t\treturn\n\t// \t}\n\t// }(dbase, user.Email, \"Welcome\", \"templates/email/confirm.html\", body)\n\n\tw.WriteHeader(http.StatusCreated)\n\tlog.Println(json.NewEncoder(w).Encode(user))\n}", "func LogCreate(entity interface{}, logger pqdep.Logger) error {\n\treturn createFunc(queryFuncWrapper(logger), entity)\n}", "func HealthHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"--- RECEIVED HEALTH DATA FROM HEALTH PULSE ---\")\n\n\tauth, httpErr := auth.CheckAuth(w, r)\n\tif !auth {\n\t\thttp.Error(w, httpErr.Status, httpErr.StatusCode)\n\t\treturn\n\t}\n\n\tvar healthSample health.Data\n\tdata, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tlog.Println(string(data))\n\n\terr = json.Unmarshal(data, &healthSample)\n\tif err != nil {\n\t\tlog.Errorf(\"Error while unmarshaling incoming health data: %s\", err)\n\t\tlog.Println(string(data))\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tc := utils.MONGOSESSION.DB(\"healthDB\").C(\"healthData\")\n\tvar results []dailyData\n\terr = c.Find(bson.M{\"date\": healthSample.Date}).All(&results)\n\n\tif err != nil {\n\t\tlog.Errorf(\"Error while finding health data entries: %s\", err)\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Calculate Min and Max heart rate\n\tminMaxHR := calcMinMaxDailyHeartRate(healthSample)\n\thealthSample.MinMaxHeartRate = minMaxHR\n\n\t// If there is no entry for the current day create one with the current sample\n\tif len(results) == 0 {\n\t\terr = c.Insert(&dailyData{Date: healthSample.Date, Data: healthSample})\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error while inserting health data entries: %s\", err)\n\t\t\treturn\n\t\t}\n\t\tlog.Infof(\"LOGGED ENTRY %s\", healthSample.Date)\n\t\treturn\n\t}\n\n\t// If there is an entry for the current day, update the entry with the current sample\n\tcolQuerier := bson.M{\"date\": healthSample.Date}\n\tchange := bson.M{\"$set\": bson.M{\"date\": healthSample.Date, \"data\": healthSample}}\n\terr = c.Update(colQuerier, change)\n\tif err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tlog.Infof(\"UPDATING ENTRY %s\", healthSample.Date)\n}", "func (db *Datastore) Create(txn transaction.Transaction) error {\n\tfmt.Println(`Creating txn with data:`, txn)\n\t// your DB operations to transactions ...\n\treturn nil\n}", "func (dshree DeployedServiceHealthReportExpiredEvent) AsStatefulReplicaHealthReportCreatedEvent() (*StatefulReplicaHealthReportCreatedEvent, bool) {\n\treturn nil, false\n}", "func (dahree DeployedApplicationHealthReportExpiredEvent) AsStatefulReplicaHealthReportCreatedEvent() (*StatefulReplicaHealthReportCreatedEvent, bool) {\n\treturn nil, false\n}", "func (r *Repository) create(user *domain.UserInfoModel) error {\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tquery := \"INSERT INTO users (namee, email, password) VALUES ($1, $2, $3)\"\n\tstmt, err := r.db.PrepareContext(ctx, query)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer stmt.Close()\n\n\tqueryStart := time.Now().Nanosecond() / 1000\n\t_, err = stmt.ExecContext(ctx, user.Name, user.Email, user.PassWord)\n\tif err != nil {\n\t\treturn err\n\t}\n\tqueryEnd := time.Now().Nanosecond() / 1000\n\texecutionTime := queryEnd - queryStart\n\terr = r.insertTimeSpent(\"Create\", executionTime)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn nil\n}", "func (m *Manager) CreateAuditLogDetail(ald *AuditLogDetail) error {\n\tnow := time.Now()\n\tald.CreatedAt = now\n\n\tfunc(in interface{}) {\n\t\tif ii, ok := in.(initializer.Simple); ok {\n\t\t\tii.Initialize()\n\t\t}\n\t}(ald)\n\n\treturn m.GetWDbMap().Insert(ald)\n}", "func CreateDefault() {\n\texistingAdmin, err := FindByEmail(config.AdminEmail)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tif existingAdmin != nil && !existingAdmin.IsAdmin {\n\t\tlog.Fatalf(\"FATAL: User with email %v exists but has no admin rights.\", config.AdminEmail)\n\t}\n\n\tif existingAdmin == nil {\n\t\tadmin, err := New(config.AdminEmail, \"Admin\", \"Admin\", config.AdminPassword)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tadmin.IsAdmin = true\n\t\terr = Save(&admin)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Cannot create admin user with email %v. Error: %v\", config.AdminEmail, err.Error())\n\t\t}\n\t\treturn\n\t}\n\tif config.ServerDebug() {\n\t\tlog.Println(\"Admin account found.\")\n\t}\n\n\t//Create the test user if we are not in production\n\tif !config.ProductionMode {\n\t\texistingTestUser, err := FindByEmail(config.TestUserEmail)\n\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\n\t\tif existingTestUser == nil {\n\t\t\ttestuser, err := New(config.TestUserEmail, \"TestUser\", \"TestUser\", \"xaFqJDeJldIEcdfZS\")\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t\terr = Save(&testuser)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"Cannot create user with email %v. Error: %v\", config.TestUserEmail, err.Error())\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tlog.Println(\"Test account found.\")\n\t}\n}", "func (orm *JallyORM) Create(q Query) error {\n\treturn orm.Query(q.Create()).Exec()\n}", "func Create(dst interface{}) {\n\tif datastore != nil {\n\t\tdatastore.Create(dst)\n\t} else {\n\t\tlog.Printf(\"No database configured, not creating %v\", dst)\n\t}\n}", "func (s Seeder) Create() string {\n\treturn fmt.Sprintf(`{ \"name\": \"building-%s\",\"address\": \"address::%s\",\"floors\": [\"floor-%s\",\"floor-%s\"] }`,\n\t\tfake.DigitsN(12),\n\t\tfake.DigitsN(15),\n\t\tfake.DigitsN(5),\n\t\tfake.DigitsN(5),\n\t)\n}", "func (s service) Create(ctx context.Context, req CreateTemperatureRequest) (Temperature, error) {\n\tif err := req.Validate(); err != nil {\n\t\treturn Temperature{}, err\n\t}\n\tnow := time.Now()\n\ttemperature := entity.Temperature{\n\t\tCityID: req.CityID,\n\t\tMin: *req.Min,\n\t\tMax: *req.Max,\n\t\tCreatedAt: now,\n\t}\n\terr := s.repo.Create(ctx, &temperature)\n\tif err != nil {\n\t\treturn Temperature{}, err\n\t}\n\treturn s.Get(ctx, temperature.ID)\n}", "func (epc *EntryPointCreate) defaults() {\n\tif _, ok := epc.mutation.CreateTime(); !ok {\n\t\tv := entrypoint.DefaultCreateTime()\n\t\tepc.mutation.SetCreateTime(v)\n\t}\n\tif _, ok := epc.mutation.UpdateTime(); !ok {\n\t\tv := entrypoint.DefaultUpdateTime()\n\t\tepc.mutation.SetUpdateTime(v)\n\t}\n}", "func (app *builder) Now() (Entry, error) {\n\tif app.hash == nil {\n\t\treturn nil, errors.New(\"the hash is mandatory in order to build an Entry instance\")\n\t}\n\n\tif app.name == \"\" {\n\t\treturn nil, errors.New(\"the name is mandatory in order to build an Entry instance\")\n\t}\n\n\tif app.trx == nil {\n\t\treturn nil, errors.New(\"the []Transaction are mandatory in order to build an Entry instance\")\n\t}\n\n\tif len(app.trx) <= 0 {\n\t\treturn nil, errors.New(\"there must be at least 1 Transaction in order to build an Entry instance\")\n\t}\n\n\timmutable, err := app.immutableBuilder.Create().WithHash(*app.hash).CreatedOn(app.createdOn).Now()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif app.description != \"\" {\n\t\treturn createEntryWithDescription(immutable, app.name, app.trx, app.description), nil\n\t}\n\n\treturn createEntry(immutable, app.name, app.trx), nil\n}", "func NewEntry() *Entry {\n return &Entry{\n Active: true,\n Passwords: make([]string, 0),\n Tags: make([]string, 0),\n }\n}", "func (s *Store) createEntryRaw(key, value []byte) error {\n\terr := s.db.Update(func(tx *bolt.Tx) error {\n\t\tbucket := tx.Bucket(s.bucketName)\n\t\traw := bucket.Get(key)\n\t\tif raw != nil {\n\t\t\treturn errors.New(\"entry value is not empty\")\n\t\t}\n\t\terr := bucket.Put(key, value)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"could not put data into bucket\")\n\t\t}\n\t\treturn nil\n\t})\n\treturn err\n}" ]
[ "0.63600236", "0.6293879", "0.62592554", "0.6080919", "0.5723222", "0.56579703", "0.5514651", "0.5431401", "0.5408429", "0.5314862", "0.5306656", "0.53030455", "0.5234485", "0.5054075", "0.5029634", "0.5025869", "0.49344203", "0.49251345", "0.49183023", "0.4915359", "0.48764566", "0.4872175", "0.48679247", "0.48644716", "0.48519567", "0.48451415", "0.4843055", "0.48014605", "0.4780552", "0.47777832", "0.47707486", "0.4706567", "0.46964854", "0.4692998", "0.46922708", "0.46769688", "0.4669539", "0.46620753", "0.46486086", "0.4646952", "0.46445516", "0.4644405", "0.46404353", "0.4639725", "0.4637852", "0.46362162", "0.4631003", "0.4625511", "0.46184465", "0.46162915", "0.46147147", "0.46095768", "0.4604026", "0.4584052", "0.4583571", "0.45716333", "0.45665944", "0.45609552", "0.45547497", "0.4551468", "0.45504436", "0.4544844", "0.4543102", "0.45425645", "0.4540948", "0.45337883", "0.45302826", "0.45263305", "0.45259175", "0.45140797", "0.45139202", "0.45051208", "0.45024168", "0.44994932", "0.44975936", "0.44955668", "0.44855902", "0.44831857", "0.44778004", "0.44648945", "0.44536936", "0.44456917", "0.444551", "0.44451222", "0.44427195", "0.44421124", "0.4440579", "0.44396448", "0.4439486", "0.4432992", "0.44299334", "0.44295862", "0.442718", "0.44268373", "0.4422683", "0.44196203", "0.4417509", "0.44174048", "0.44173548", "0.4415921" ]
0.8274689
0
DefaultReadHealthMenstruationDailyEntry executes a basic gorm read call
DefaultReadHealthMenstruationDailyEntry выполняет базовый вызов gorm для чтения
func DefaultReadHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) { if in == nil { return nil, errors1.NilArgumentError } ormObj, err := in.ToORM(ctx) if err != nil { return nil, err } if ormObj.Id == 0 { return nil, errors1.EmptyIdError } if hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeReadApplyQuery); ok { if db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil { return nil, err } } if db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &HealthMenstruationDailyEntryORM{}); err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeReadFind); ok { if db, err = hook.BeforeReadFind(ctx, db); err != nil { return nil, err } } ormResponse := HealthMenstruationDailyEntryORM{} if err = db.Where(&ormObj).First(&ormResponse).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormResponse).(HealthMenstruationDailyEntryORMWithAfterReadFind); ok { if err = hook.AfterReadFind(ctx, db); err != nil { return nil, err } } pbResponse, err := ormResponse.ToPB(ctx) return &pbResponse, err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DefaultListHealthMenstruationDailyEntry(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*HealthMenstruationDailyEntry, error) {\n\tin := HealthMenstruationDailyEntry{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm2.ApplyCollectionOperators(ctx, db, &HealthMenstruationDailyEntryORM{}, &HealthMenstruationDailyEntry{}, f, s, p, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []HealthMenstruationDailyEntryORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*HealthMenstruationDailyEntry{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func DefaultReadHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, 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 == 0 {\n\t\treturn nil, errors1.EmptyIdError\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeReadApplyQuery); ok {\n\t\tif db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &HealthMenstruationPersonalInfoORM{}); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeReadFind); ok {\n\t\tif db, err = hook.BeforeReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tormResponse := HealthMenstruationPersonalInfoORM{}\n\tif err = db.Where(&ormObj).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormResponse).(HealthMenstruationPersonalInfoORMWithAfterReadFind); ok {\n\t\tif err = hook.AfterReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultCreateHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, 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 hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeCreate_); ok {\n\t\tif db, err = hook.BeforeCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterCreate_); ok {\n\t\tif err = hook.AfterCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultPatchHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj HealthMenstruationDailyEntry\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadHealthMenstruationDailyEntry(ctx, &HealthMenstruationDailyEntry{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskHealthMenstruationDailyEntry(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateHealthMenstruationDailyEntry(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(HealthMenstruationDailyEntryWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func DefaultStrictUpdateHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateHealthMenstruationDailyEntry\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &HealthMenstruationDailyEntryORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func DefaultApplyFieldMaskHealthMenstruationDailyEntry(ctx context.Context, patchee *HealthMenstruationDailyEntry, patcher *HealthMenstruationDailyEntry, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"ProfileId\" {\n\t\t\tpatchee.ProfileId = patcher.ProfileId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Day\" {\n\t\t\tpatchee.Day = patcher.Day\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"IntensityPercentage\" {\n\t\t\tpatchee.IntensityPercentage = patcher.IntensityPercentage\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Type\" {\n\t\t\tpatchee.Type = patcher.Type\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Manual\" {\n\t\t\tpatchee.Manual = patcher.Manual\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"BasedOnPrediction\" {\n\t\t\tpatchee.BasedOnPrediction = patcher.BasedOnPrediction\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func DefaultPatchSetHealthMenstruationDailyEntry(ctx context.Context, objects []*HealthMenstruationDailyEntry, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*HealthMenstruationDailyEntry, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*HealthMenstruationDailyEntry, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchHealthMenstruationDailyEntry(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func GetData(w http.ResponseWriter, r *http.Request) {\n\tresult := dailyData{}\n\tc := utils.MONGOSESSION.DB(\"healthDB\").C(\"healthData\")\n\tc.Find(bson.M{\"date\": utils.GetDate(time.Now())}).One(&result)\n\tb, _ := json.Marshal(result)\n\tfmt.Fprintf(w, string(b))\n}", "func GetEntryAtDate(date interface{}, entry string) interface{} {\n\tisRequestedFieldEntryValid := false\n\tresult := dailyData{}\n\n\tc := utils.MONGOSESSION.DB(\"healthDB\").C(\"healthData\")\n\tc.Find(bson.M{\"date\": date}).One(&result)\n\tif entry != \"\" {\n\t\tavailableFields, _ := reflections.Fields(result.Data)\n\n\t\t// Check if the requested field entry is available at the requested date\n\t\tfor _, field := range availableFields {\n\t\t\tif entry == field {\n\t\t\t\tisRequestedFieldEntryValid = true\n\t\t\t}\n\t\t}\n\n\t\tif !isRequestedFieldEntryValid {\n\t\t\treturn nil\n\t\t}\n\n\t\trequestedData, err := reflections.GetField(result.Data, entry)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"%s\", err)\n\t\t}\n\t\treturn requestedData\n\t}\n\treturn result\n}", "func (lsm *lsm) Read(key string, ts uint64) (*Entry, error) {\n\tfor _, level := range lsm.levels {\n\t\tentry, err := level.Find(key, ts)\n\t\tif err != nil {\n\t\t\tswitch err.(type) {\n\t\t\tcase *ErrKeyNotFound:\n\t\t\t\tcontinue\n\t\t\tdefault:\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t} else {\n\t\t\treturn entry, nil\n\t\t}\n\t}\n\treturn nil, newErrKeyNotFound()\n}", "func HealthHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"--- RECEIVED HEALTH DATA FROM HEALTH PULSE ---\")\n\n\tauth, httpErr := auth.CheckAuth(w, r)\n\tif !auth {\n\t\thttp.Error(w, httpErr.Status, httpErr.StatusCode)\n\t\treturn\n\t}\n\n\tvar healthSample health.Data\n\tdata, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tlog.Println(string(data))\n\n\terr = json.Unmarshal(data, &healthSample)\n\tif err != nil {\n\t\tlog.Errorf(\"Error while unmarshaling incoming health data: %s\", err)\n\t\tlog.Println(string(data))\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tc := utils.MONGOSESSION.DB(\"healthDB\").C(\"healthData\")\n\tvar results []dailyData\n\terr = c.Find(bson.M{\"date\": healthSample.Date}).All(&results)\n\n\tif err != nil {\n\t\tlog.Errorf(\"Error while finding health data entries: %s\", err)\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Calculate Min and Max heart rate\n\tminMaxHR := calcMinMaxDailyHeartRate(healthSample)\n\thealthSample.MinMaxHeartRate = minMaxHR\n\n\t// If there is no entry for the current day create one with the current sample\n\tif len(results) == 0 {\n\t\terr = c.Insert(&dailyData{Date: healthSample.Date, Data: healthSample})\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error while inserting health data entries: %s\", err)\n\t\t\treturn\n\t\t}\n\t\tlog.Infof(\"LOGGED ENTRY %s\", healthSample.Date)\n\t\treturn\n\t}\n\n\t// If there is an entry for the current day, update the entry with the current sample\n\tcolQuerier := bson.M{\"date\": healthSample.Date}\n\tchange := bson.M{\"$set\": bson.M{\"date\": healthSample.Date, \"data\": healthSample}}\n\terr = c.Update(colQuerier, change)\n\tif err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tlog.Infof(\"UPDATING ENTRY %s\", healthSample.Date)\n}", "func DefaultListHealthMenstruationPersonalInfo(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*HealthMenstruationPersonalInfo, error) {\n\tin := HealthMenstruationPersonalInfo{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm2.ApplyCollectionOperators(ctx, db, &HealthMenstruationPersonalInfoORM{}, &HealthMenstruationPersonalInfo{}, f, s, p, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []HealthMenstruationPersonalInfoORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*HealthMenstruationPersonalInfo{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func (e *ExpenseModel) ReadAll(filter interface{}) ([]Expense, error) {\n\tvar expenses []Expense\n\tcollection := e.db.Client.Database(e.db.DBName).Collection(\"expenses\")\n\tlog.Printf(\"filter: %v\\n\", filter)\n\t// sort the entries based on the `date` field\n\topts := options.FindOptions{}\n\topts.SetSort(bson.D{{\"date\", -1}})\n\tcur, err := collection.Find(context.TODO(), filter, &opts)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR FINDING DATA: %v\\n\", err)\n\t\treturn expenses, err\n\t}\n\tfor cur.Next(context.TODO()) {\n\t\tvar expense Expense\n\t\terr = cur.Decode(&expense)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error on Decoding the document: %v\\n\", err)\n\t\t}\n\t\texpenses = append(expenses, expense)\n\t}\n\tlog.Printf(\"documentReturned: %v\\n\", expenses)\n\treturn expenses, nil\n}", "func (ps *Store) Read(ctx context.Context, key datastore.Key, entity datastore.Entity) error {\n\tc := GetCon(ctx)\n\temd := entity.GetEntityMetadata()\n\titer := c.Query(getJSONSelect(emd.GetName(), emd.GetIDColumnName()), key).Iter()\n\tvar json string\n\tvalid := iter.Scan(&json)\n\tif !valid {\n\t\treturn common.NewError(datastore.EntityNotFound, fmt.Sprintf(\"%v not found with id = %v\", emd.GetName(), key))\n\t}\n\tdatastore.FromJSON(json, entity)\n\tif err := iter.Close(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (m *HealthMenstruationDailyEntry) ToORM(ctx context.Context) (HealthMenstruationDailyEntryORM, error) {\n\tto := HealthMenstruationDailyEntryORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(HealthMenstruationDailyEntryWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tif m.CreatedAt != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.CreatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.CreatedAt = &t\n\t}\n\tif m.UpdatedAt != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.UpdatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.UpdatedAt = &t\n\t}\n\tto.ProfileId = m.ProfileId\n\tif m.Day != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.Day); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Day = &t\n\t}\n\tto.IntensityPercentage = m.IntensityPercentage\n\tto.Type = int32(m.Type)\n\tto.Manual = m.Manual\n\tto.BasedOnPrediction = m.BasedOnPrediction\n\tif posthook, ok := interface{}(m).(HealthMenstruationDailyEntryWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "func (store TodoStore) Read(_ sqlx.Queryer, filters ...gtimer.TodoFilter) (gtimer.Todos, error) {\n\tvar todo gtimer.Todo\n\tfor _, filter := range filters {\n\t\tfilter(&todo)\n\t}\n\tif todo.ID != \"\" {\n\t\ttodo, err := store.Get(todo.ID)\n\t\tif err != nil {\n\t\t\treturn gtimer.Todos{}, err\n\t\t}\n\t\treturn gtimer.Todos{todo}, err\n\t}\n\tif todo.Status != \"\" {\n\t\treturn store.ByStatus(todo.Status)\n\t}\n\treturn store.All()\n}", "func (m *HealthMenstruationDailyEntryORM) ToPB(ctx context.Context) (HealthMenstruationDailyEntry, error) {\n\tto := HealthMenstruationDailyEntry{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(HealthMenstruationDailyEntryWithBeforeToPB); ok {\n\t\tif err = prehook.BeforeToPB(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tif m.CreatedAt != nil {\n\t\tif to.CreatedAt, err = ptypes1.TimestampProto(*m.CreatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tif m.UpdatedAt != nil {\n\t\tif to.UpdatedAt, err = ptypes1.TimestampProto(*m.UpdatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.ProfileId = m.ProfileId\n\tif m.Day != nil {\n\t\tif to.Day, err = ptypes1.TimestampProto(*m.Day); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.IntensityPercentage = m.IntensityPercentage\n\tto.Type = HealthMenstruationDailyEntry_Type(m.Type)\n\tto.Manual = m.Manual\n\tto.BasedOnPrediction = m.BasedOnPrediction\n\tif posthook, ok := interface{}(m).(HealthMenstruationDailyEntryWithAfterToPB); ok {\n\t\terr = posthook.AfterToPB(ctx, &to)\n\t}\n\treturn to, err\n}", "func (h *Handler) FetchDailyTimeSeries(w http.ResponseWriter, r *http.Request, params httprouter.Params) error {\n\tstockSymbol := params.ByName(\"stock\")\n\n\tstock, err := h.Stocky.Postgres.GetOrCreateStock(stockSymbol)\n\tif err != nil {\n\t\tError(w, err)\n\t\treturn err\n\t}\n\n\tredisKey := fmt.Sprintf(\"stocky_%s\", stockSymbol)\n\t_, err = h.Stocky.Redis.Get(redisKey)\n\tif err == redis.Nil {\n\t\terr = h.updateDaily(stockSymbol, redisKey, stock.ID)\n\t\tif err != nil {\n\t\t\tError(w, err)\n\t\t\treturn err\n\t\t}\n\t} else if err != nil {\n\t\tError(w, err)\n\t\treturn err\n\t}\n\n\tstockDailySeries, err := h.Stocky.Postgres.FetchDailySeriesByStock(stock.ID)\n\tif err != nil {\n\t\tError(w, err)\n\t\treturn err\n\t}\n\n\tOK(w, entity.NewStockDailyResponse(stock, stockDailySeries), \"\")\n\treturn nil\n}", "func (model *TodoerModel) Read(id int) Todoer {\n\tvar todoer = Todoer{}\n\n\tconnect(func(db *sql.DB) {\n\t\trows, err := db.Query(\"select * from todoer where id = ?\", id)\n\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\n\t\tdefer rows.Close()\n\n\t\tfor rows.Next() {\n\t\t\terr := rows.Scan(&todoer.ID, &todoer.Username, &todoer.CreatedAt, &todoer.ModifiedAt)\n\t\t\tif err != nil {\n\t\t\t\tlog.Panic(err)\n\t\t\t}\n\t\t}\n\n\t\terr = rows.Err()\n\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\t})\n\n\treturn todoer\n}", "func GetHealth(w http.ResponseWriter, r *http.Request, db *sqlx.DB) {\n\tparams := mux.Vars(r)\n\n\thealth := []Health{}\n\n\tvar err error\n\n\tsession, err := store.Get(r, \"auth\")\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Convert our session data into an instance of User\n\tuser := User{}\n\tuser, _ = session.Values[\"user\"].(User)\n\n\tif user.Username != \"\" && user.AccessLevel == \"admin\" {\n\t\tif _, ok := params[\"id\"]; ok {\n\t\t\terr = db.Select(&health, \"SELECT id, username, ts, variable, value \"+\n\t\t\t\t\"FROM public.health \"+\n\t\t\t\t\"WHERE id = $1 \", params[\"id\"])\n\t\t} else if _, ok = params[\"ts\"]; ok {\n\t\t\terr = db.Select(&health, \"SELECT id, username, ts, variable, value \"+\n\t\t\t\t\"FROM public.health \"+\n\t\t\t\t\"WHERE ts = $1 \", params[\"ts\"])\n\t\t} else if _, ok = params[\"variable\"]; ok {\n\t\t\terr = db.Select(&health, \"SELECT id, username, ts, variable, value \"+\n\t\t\t\t\"FROM public.health \"+\n\t\t\t\t\"WHERE variable = $1 \", params[\"variable\"])\n\t\t} else {\n\t\t\terr = db.Select(&health, \"SELECT id, username, ts, variable, value \"+\n\t\t\t\t\"FROM public.health \")\n\t\t}\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tw.WriteHeader(http.StatusOK)\n\n\t\tif err := json.NewEncoder(w).Encode(health); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t} else {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tw.WriteHeader(http.StatusOK)\n\n\t\tif err := json.NewEncoder(w).Encode(\"access denied\"); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\tlogRequest(r)\n}", "func (tb *tableManager) read(keyIn uint64) (*Block, error) {\n\tentry, err := tb.getEntry(keyIn)\n\tif err != nil {\n\t\tlog.Println(\"Could not obtain entry.\")\n\t\treturn nil, errors.New(\"Could not obtain entry.\")\n\t}\n\tif entry.flags&flagRemove != 0 {\n\t\t// dataBase should be able to tell if a dirtyKey is marked\n\t\t// for removal so it can write it as removed in log.\n\t\treturn nil, nil\n\t}\n\ttb.updateLRUCacheHead(entry)\n\treturn entry.block, nil\n}", "func (s *Tplink) GetDailyStats(month, year int) (SysInfo, error) {\n\tvar (\n\t\tpayload dailyStats\n\t\tjsonResp SysInfo\n\t)\n\n\tpayload.Emeter.GetDaystat.Month = month\n\tpayload.Emeter.GetDaystat.Year = year\n\n\tj, _ := json.Marshal(payload)\n\n\tdata := encrypt(string(j))\n\tresp, err := send(s.Host, data)\n\tif err != nil {\n\t\treturn jsonResp, err\n\t}\n\n\tif err := json.Unmarshal([]byte(decrypt(resp)), &jsonResp); err != nil {\n\t\treturn jsonResp, err\n\t}\n\treturn jsonResp, nil\n}", "func (e *ExpenseModel) ReadOne(filter interface{}) (Expense, error) {\n\tvar expense Expense\n\tcollection := e.db.Client.Database(e.db.DBName).Collection(\"expenses\")\n\tdocumentReturned := collection.FindOne(context.TODO(), filter)\n\tdocumentReturned.Decode(&expense)\n\treturn expense, nil\n}", "func (o *Object) readMetaData(ctx context.Context) (err error) {\n\tif !o.modTime.IsZero() {\n\t\treturn nil\n\t}\n\t// Last resort\n\treturn o.readEntryAndSetMetadata(ctx)\n}", "func (d dynamo) Get(date time.Time, mealType string, details bool) (Meal, error) {\n\tsess, err := session.NewSession(&aws.Config{Region: aws.String(region)})\n\tif err != nil {\n\t\tfmt.Println(\"Error creating AWS session\")\n\t\treturn Meal{}, err\n\t}\n\tsvc := dynamodb.New(sess)\n\tresult, err := svc.GetItem(&dynamodb.GetItemInput{\n\t\tTableName: aws.String(\"meal\"),\n\t\tKey: map[string]*dynamodb.AttributeValue{\n\t\t\t\"id\": {\n\t\t\t\tS: aws.String(fmt.Sprintf(\"%s-%s\", date.Format(time.RFC3339), mealType)),\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tfmt.Println(\"error getting meal: \", err)\n\t\treturn Meal{}, err\n\t}\n\tm := Meal{}\n\terr = dynamodbattribute.UnmarshalMap(result.Item, &m)\n\tif err != nil {\n\t\tfmt.Println(\"error while unmarshalling: \", err)\n\t\treturn Meal{}, err\n\t}\n\treturn m, nil\n}", "func (wal *WalDB) ReadAll(snapshot *raftpb.Snapshot) (id *consensus.RaftIdentity, state *raftpb.HardState, ents []raftpb.Entry, err error) {\n\tif id, err = wal.GetIdentity(); err != nil {\n\t\treturn nil, state, ents, err\n\t}\n\n\tstate, err = wal.GetHardState()\n\tif err != nil {\n\t\treturn id, state, ents, ErrWalGetHardState\n\t}\n\n\tcommitIdx := state.Commit\n\tlastIdx, err := wal.GetRaftEntryLastIdx()\n\tif err != nil {\n\t\treturn id, state, ents, ErrWalGetLastIdx\n\t}\n\n\tvar snapIdx, snapTerm uint64\n\tif snapshot != nil {\n\t\tsnapIdx = snapshot.Metadata.Index\n\t\tsnapTerm = snapshot.Metadata.Term\n\t}\n\n\tlogger.Info().Uint64(\"snapidx\", snapIdx).Uint64(\"snapterm\", snapTerm).Uint64(\"commit\", commitIdx).Uint64(\"last\", lastIdx).Msg(\"read all entries of wal\")\n\n\tstart := snapIdx + 1\n\n\tfor i := start; i <= lastIdx; i++ {\n\t\twalEntry, err := wal.GetRaftEntry(i)\n\t\t// if snapshot is nil, initial confchange entry isn't saved to db\n\t\tif err != nil {\n\t\t\tlogger.Error().Err(err).Uint64(\"idx\", i).Msg(\"failed to get raft entry\")\n\t\t\treturn id, state, nil, err\n\t\t}\n\n\t\tif walEntry.Term < snapTerm {\n\t\t\tlogger.Error().Str(\"wal\", walEntry.ToString()).Err(ErrWalEntryTooLowTerm).Msg(\"invalid wal entry\")\n\t\t\treturn id, state, nil, ErrWalEntryTooLowTerm\n\t\t}\n\n\t\traftEntry, err := wal.convertWalToRaft(walEntry)\n\t\tif err != nil {\n\t\t\treturn id, state, nil, err\n\t\t}\n\n\t\tlogger.Debug().Str(\"walentry\", walEntry.ToString()).Msg(\"read wal entry\")\n\t\tents = append(ents, *raftEntry)\n\t}\n\n\treturn id, state, ents, nil\n}", "func hostRead(d *schema.ResourceData, m interface{}, params zabbix.Params) error {\n\tapi := m.(*zabbix.API)\n\n\tlog.Debug(\"Lookup of host with params %#v\", params)\n\n\thosts, err := api.HostsGet(params)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(hosts) < 1 {\n\t\td.SetId(\"\")\n\t\treturn nil\n\t}\n\tif len(hosts) > 1 {\n\t\treturn errors.New(\"multiple hosts found\")\n\t}\n\thost := hosts[0]\n\n\tlog.Debug(\"Got host: %+v\", host)\n\n\td.SetId(host.HostID)\n\td.Set(\"name\", host.Name)\n\td.Set(\"host\", host.Host)\n\td.Set(\"proxyid\", host.ProxyID)\n\td.Set(\"enabled\", host.Status == 0)\n\td.Set(\"inventory_mode\", HINV_LOOKUP_REV[host.InventoryMode])\n\n\td.Set(\"interface\", flattenHostInterfaces(host, d, m))\n\td.Set(\"templates\", flattenTemplateIds(host.ParentTemplateIDs))\n\td.Set(\"inventory\", flattenInventory(host))\n\td.Set(\"groups\", flattenHostGroupIds(host.GroupIds))\n\td.Set(\"macro\", flattenMacros(host.UserMacros))\n\td.Set(\"tag\", flattenTags(host.Tags))\n\n\treturn nil\n}", "func DefaultReadContact(ctx context.Context, in *Contact, db *gorm.DB) (*Contact, error) {\n\tif in == nil {\n\t\treturn nil, errors.New(\"Nil argument to DefaultReadContact\")\n\t}\n\tormParams, err := ConvertContactToORM(*in)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tormResponse := ContactORM{}\n\tif err = db.Set(\"gorm:auto_preload\", true).Where(&ormParams).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tpbResponse, err := ConvertContactFromORM(ormResponse)\n\treturn &pbResponse, err\n}", "func LoadDailyMoney() {\n\tglobalInfo := path.Join(GetDesignerDir(), \"juewei.csv\")\n\tcsvcfg.LoadCSVConfig(globalInfo, &globalinfoCfg)\n}", "func executeReadingQuery(query *arangolite.Query) (*Ingredient, error) {\n\tvar result []Ingredient\n\n\trawResult, err := config.DB().Run(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmarshallErr := json.Unmarshal(rawResult, &result)\n\tif marshallErr != nil {\n\t\treturn nil, marshallErr\n\t}\n\tif len(result) > 0 {\n\t\treturn &result[0], nil\n\t}\n\treturn nil, nil\n}", "func dataHostRead(d *schema.ResourceData, m interface{}) error {\n\tparams := zabbix.Params{\n\t\t\"selectInterfaces\": \"extend\",\n\t\t\"selectParentTemplates\": \"extend\",\n\t\t\"selectGroups\": \"extend\",\n\t\t\"selectMacros\": \"extend\",\n\t\t\"selectTags\": \"extend\",\n\t\t\"selectInventory\": \"extend\",\n\t\t\"filter\": map[string]interface{}{},\n\t}\n\n\tlookups := []string{\"host\", \"hostid\", \"name\"}\n\tfor _, k := range lookups {\n\t\tif v, ok := d.GetOk(k); ok {\n\t\t\tparams[\"filter\"].(map[string]interface{})[k] = v\n\t\t}\n\t}\n\n\tif len(params[\"filter\"].(map[string]interface{})) < 1 {\n\t\treturn errors.New(\"no host lookup attribute\")\n\t}\n\tlog.Debug(\"performing data lookup with params: %#v\", params)\n\n\treturn hostRead(d, m, params)\n}", "func DefaultReadEmail(ctx context.Context, in *Email, db *gorm.DB) (*Email, error) {\n\tif in == nil {\n\t\treturn nil, errors.New(\"Nil argument to DefaultReadEmail\")\n\t}\n\tormParams, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tormResponse := EmailORM{}\n\tif err = db.Set(\"gorm:auto_preload\", true).Where(&ormParams).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultCreateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, 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 hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeCreate_); ok {\n\t\tif db, err = hook.BeforeCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterCreate_); ok {\n\t\tif err = hook.AfterCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func (handler WeatherReadingHandler) Index(c *gin.Context) {\n\tweatherReadings := []m.WeatherReading{}\t\n\tvar query = handler.db\n\n\tstartParam,startParamExist := c.GetQuery(\"start\")\n\tlimitParam,limitParamExist := c.GetQuery(\"limit\")\n\n\t//start param exist\n\tif startParamExist {\n\t\tstart,_ := strconv.Atoi(startParam)\n\t\tif start != 0 {\n\t\t\tquery = query.Offset(start).Order(\"created_at asc\")\t\t\n\t\t} else {\n\t\t\tquery = query.Offset(0).Order(\"created_at desc\")\n\t\t}\n\t} \n\n\t//limit param exist\n\tif limitParamExist {\n\t\tlimit,_ := strconv.Atoi(limitParam)\n\t\tquery = query.Limit(limit)\n\t} else {\n\t\tquery = query.Limit(10)\n\t}\n\n\tquery.Order(\"created_at desc\").Find(&weatherReadings)\n\tc.JSON(http.StatusOK,weatherReadings)\n\treturn\n}", "func (c *IloClient) GetAggHealthDataDell(model string) ([]HealthList, error) {\n\n\tif strings.ToLower(model) == \"r730xd\" {\n\n\t\treturn nil, nil\n\n\t} else if strings.ToLower(model) == \"r740xd\" {\n\t\turl := c.Hostname + \"/redfish/v1/UpdateService/FirmwareInventory\"\n\n\t\tresp, _, _, err := queryData(c, \"GET\", url, nil)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar (\n\t\t\tx MemberCountDell\n\t\t\t_healthdata []HealthList\n\t\t)\n\n\t\tjson.Unmarshal(resp, &x)\n\n\t\tfor i := range x.Members {\n\t\t\tr, _ := regexp.Compile(\"Installed\")\n\t\t\tif r.MatchString(x.Members[i].OdataId) == true {\n\t\t\t\t_url := c.Hostname + x.Members[i].OdataId\n\t\t\t\tresp, _, _, err := queryData(c, \"GET\", _url, nil)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tvar y FirmwareDataDell\n\n\t\t\t\tjson.Unmarshal(resp, &y)\n\n\t\t\t\thealthData := HealthList{\n\t\t\t\t\tName: y.Name,\n\t\t\t\t\tState: y.Status.State,\n\t\t\t\t\tHealth: y.Status.Health,\n\t\t\t\t}\n\n\t\t\t\t_healthdata = append(_healthdata, healthData)\n\n\t\t\t}\n\t\t}\n\n\t\treturn _healthdata, nil\n\t}\n\treturn nil, nil\n}", "func DefaultReadContact(ctx context.Context, in *Contact, db *gorm.DB) (*Contact, error) {\n\tif in == nil {\n\t\treturn nil, errors.New(\"Nil argument to DefaultReadContact\")\n\t}\n\tormParams, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\taccountID, err := auth.GetAccountID(ctx, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tormParams.AccountID = accountID\n\tormResponse := ContactORM{}\n\tif err = db.Set(\"gorm:auto_preload\", true).Where(&ormParams).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func (at *AnswerTypeDAO) ReadOne(id int32) {}", "func (c *UserRepoImpl) Read(id int) (*model.User, error) {\n\tuser := new(model.User)\n\n\tif err := c.db.Table(\"user\").Where(\"user_id = ?\", id).First(&user).Error; err != nil {\n\t\tlogrus.Error(err)\n\t\treturn nil, errors.New(\"get user data : error \")\n\t}\n\n\treturn user, nil\n}", "func (d *DepartmentRepoImpl) Read(deptno int32) (models.Department, error) {\n\tdept := models.Department{}\n\tgetDepartment := d.DB.Table(\"departments\").Where(\"id = ?\", deptno).Find(&dept)\n\tif getDepartment.Error != nil {\n\t\tfmt.Println(\"[Repo Error] :\", getDepartment.Error)\n\t\treturn dept, getDepartment.Error\n\t}\n\n\treturn dept, nil\n}", "func (self *Client) ReadMetric(t MetricType, id string, o ...Modifier) ([]*Datapoint, error) {\n\to = prepend(o, self.Url(\"GET\", TypeEndpoint(t), SingleMetricEndpoint(id), DataEndpoint()))\n\n\tr, err := self.Send(o...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer r.Body.Close()\n\n\tif r.StatusCode == http.StatusOK {\n\t\tb, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Check for GaugeBucketpoint and so on for the rest.. uh\n\t\tdp := []*Datapoint{}\n\t\tif b != nil {\n\t\t\tif err = json.Unmarshal(b, &dp); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\treturn dp, nil\n\t} else if r.StatusCode > 399 {\n\t\treturn nil, self.parseErrorResponse(r)\n\t}\n\n\treturn nil, nil\n}", "func (r *Resource) getAllHandler(c *gin.Context) {\n // fetch all from database\n meals, err := r.db.GetAllMenuMeals()\n if err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n return\n }\n\n // return result as JSON\n c.JSON(http.StatusOK, meals)\n}", "func ReadLedgerEntries(rows *sql.Rows, a *LedgerEntry) error {\n\treturn rows.Scan(&a.LEID, &a.BID, &a.JID, &a.JAID, &a.LID, &a.RAID, &a.RID, &a.TCID, &a.Dt, &a.Amount, &a.Comment, &a.CreateTS, &a.CreateBy, &a.LastModTime, &a.LastModBy)\n}", "func getLoan(l *models.Loan, db *gorm.DB) error {\n\terr := db.Select(\"id,created_at,updated_at,initial_value,interest,quota,balance,cod_loan_state,cod_client,cod_collection,cod_user\").First(l).GetErrors()\n\tif len(err) != 0 {\n\t\treturn errors.New(\"no se encuentra\")\n\t}\n\treturn nil\n}", "func (l *Logger) Read(n int) ([]LogEntry, error) {\n\tentries, err := l.client.readLog(n)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tids := make(map[int64]*LogEntry)\n\tlogEntries := make([]LogEntry, 0, len(entries))\n\tfor _, le := range entries {\n\t\tentry, ok := ids[le.ID]\n\t\tif !ok {\n\t\t\tnewEntry := LogEntry{\n\t\t\t\tTime: time.Unix(le.Time, 0).UTC(),\n\t\t\t\tRemoteAddr: le.RemoteAddr,\n\t\t\t\tHijacked: le.Hijacked,\n\t\t\t\tQtype: le.Qtype,\n\t\t\t\tQuestion: le.Question,\n\t\t\t}\n\t\t\tlogEntries = append(logEntries, newEntry)\n\t\t\tentry = &logEntries[len(logEntries)-1]\n\t\t\tids[le.ID] = entry\n\t\t}\n\t\tif le.Answer != \"\" {\n\t\t\tentry.Answers = append(entry.Answers, le.Answer)\n\t\t}\n\t}\n\treturn logEntries, nil\n}", "func (d *Dao) GetAllDayExpenseInfo(c context.Context, beginDate time.Time, ctype, from, limit int) (infos []*model.BudgetDayStatistics, err error) {\n\trows, err := d.rddb.Query(c, _getAllDayExpenseSQL, beginDate, ctype, from, limit)\n\tif err != nil {\n\t\tlog.Error(\"dao.GetAllDayExpenseInfo query error(%v)\", err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\ta := &model.BudgetDayStatistics{}\n\t\tif err = rows.Scan(&a.DayExpense, &a.UpCount, &a.AvCount, &a.UpAvgExpense, &a.AvAvgExpense, &a.TotalExpense, &a.Date); err != nil {\n\t\t\tlog.Error(\"dao.GetAllDayExpenseInfo scan error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t\tinfos = append(infos, a)\n\t}\n\terr = rows.Err()\n\treturn\n}", "func (r *record) read() (err error) {\n\treply, err := sched0.cache.Get(prefixTask + r.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = json.Unmarshal([]byte(reply), r)\n\treturn\n}", "func (self *botStats) load(t db.Table, index int) error {\n\tkey := fmt.Sprintf(\"%s-%2d\",botStatsRecordKey,index)\n\terr := t.Get(key,self)\n\tif len(self.Rows) == 0 {\n\t\tself.newRow()\n\t}\n\treturn err\n}", "func (c *Client) ReadMetric(t MetricType, id string, o ...Modifier) ([]*Datapoint, error) {\n\to = prepend(o, c.Url(\"GET\", TypeEndpoint(t), SingleMetricEndpoint(id), DataEndpoint()))\n\n\tr, err := c.Send(o...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer r.Body.Close()\n\n\tif r.StatusCode == http.StatusOK {\n\t\tb, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Check for GaugeBucketpoint and so on for the rest.. uh\n\t\tdp := []*Datapoint{}\n\t\tif b != nil {\n\t\t\tif err = json.Unmarshal(b, &dp); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\treturn dp, nil\n\t} else if r.StatusCode > 399 {\n\t\treturn nil, c.parseErrorResponse(r)\n\t}\n\n\treturn nil, nil\n}", "func (s *CqlStore) Read(id ID) (Item, error) {\n\tvar item Item\n\tsts, err := s.History(id, 1)\n\tif err != nil {\n\t\treturn item, err\n\t}\n\tif len(sts) == 1 && sts[0].Status == \"ALIVE\" {\n\t\titem = sts[0].Item\n\t}\n\treturn item, nil\n}", "func DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateHealthMenstruationPersonalInfo\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &HealthMenstruationPersonalInfoORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func (dao *DAOName) Read(m *ReferenceModel) ([]ReferenceModel, error) {\n\tretVal := []ReferenceModel{}\n\tif err := dao.db.Where(m).Find(&retVal).Error; err != nil {\n\t\treturn nil, err\n\t}\n\treturn retVal, nil\n}", "func (mgr *EntryManager) GetOne(entryID int) *Entry {\n\tdb, err := sql.Open(\"postgres\", mgr.ConnStr)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tdefer db.Close()\n\n\tqueryStr := `\n\t\tSELECT title, date_posted, tags \n\t\tFROM entries \n\t\tWHERE id = $1;\n\t`\n\n\t// Create a \"prepared\" SQL statement context\n\tstmt, err := db.Prepare(queryStr)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil\n\t}\n\tdefer stmt.Close()\n\n\t// Fetch Entry record\n\tvar (\n\t\ttitle, tagsText string\n\t\tdatePosted time.Time\n\t)\n\terr = stmt.QueryRow(entryID).Scan(&title, &datePosted, &tagsText)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil\n\t}\n\n\t// Populate Entry record\n\treturn &Entry{\n\t\tID: entryID,\n\t\tTitle: title,\n\t\tDatePosted: datePosted,\n\t\tTags: strings.Split(tagsText, \",\"),\n\t}\n}", "func (mgr *EntryManager) GetAll() []*Entry {\n\tvar entries []*Entry\n\n\tdb, err := sql.Open(\"postgres\", mgr.ConnStr)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tdefer db.Close()\n\n\t// Generate a Rows iterator from a SQL query\n\tqueryStr := \"SELECT id, title, date_posted, tags FROM entries ORDER BY id;\"\n\trows, err := db.Query(queryStr)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil\n\t}\n\tdefer rows.Close()\n\n\t// Iterate over rows and populate Entry records\n\tfor rows.Next() {\n\t\tvar (\n\t\t\tentryID int\n\t\t\ttitle, tagsText string\n\t\t\tdatePosted time.Time\n\t\t)\n\n\t\terr = rows.Scan(&entryID, &title, &datePosted, &tagsText)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tentries = append(entries, &Entry{\n\t\t\tID: entryID,\n\t\t\tTitle: title,\n\t\t\tDatePosted: datePosted,\n\t\t\tTags: strings.Split(tagsText, \",\"),\n\t\t},\n\t\t)\n\t}\n\n\treturn entries\n}", "func (HealthMenstruationDailyEntryORM) TableName() string {\n\treturn \"health_menstruation_daily_entries\"\n}", "func (m *MonkeyWrench) Read(table string, keys []spanner.KeySet, columns []string) ([]*spanner.Row, error) {\n\t// Default to all keys.\n\tvar spannerKeys = spanner.AllKeys()\n\n\t// If we have some specified keys, use those instead.\n\tif len(keys) > 0 {\n\t\tspannerKeys = spanner.KeySets(keys...)\n\t}\n\n\t// Execute the query.\n\titer := m.Client.Single().Read(m.Context, table, spannerKeys, columns)\n\treturn getResultSlice(iter)\n}", "func ReadExpenses(rows *sql.Rows, a *Expense) error {\n\treturn rows.Scan(&a.EXPID, &a.RPEXPID, &a.BID, &a.RID, &a.RAID, &a.Amount, &a.Dt, &a.AcctRule, &a.ARID, &a.FLAGS, &a.Comment, &a.CreateTS, &a.CreateBy, &a.LastModTime, &a.LastModBy)\n}", "func (repo *Repository) Read(ctx context.Context, claims auth.Claims, req ChecklistReadRequest) (*Checklist, error) {\n\tspan, ctx := tracer.StartSpanFromContext(ctx, \"internal.checklist.Read\")\n\tdefer span.Finish()\n\n\t// Validate the request.\n\tv := webcontext.Validator()\n\terr := v.Struct(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Filter base select query by id\n\tquery := sqlbuilder.NewSelectBuilder()\n\tquery.Where(query.Equal(\"id\", req.ID))\n\n\tres, err := find(ctx, claims, repo.DbConn, query, []interface{}{}, req.IncludeArchived)\n\tif err != nil {\n\t\treturn nil, err\n\t} else if res == nil || len(res) == 0 {\n\t\terr = errors.WithMessagef(ErrNotFound, \"checklist %s not found\", req.ID)\n\t\treturn nil, err\n\t}\n\n\tu := res[0]\n\treturn u, nil\n}", "func DefaultReadProfile(ctx context.Context, in *Profile, db *gorm1.DB) (*Profile, 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).(ProfileORMWithBeforeReadApplyQuery); ok {\n\t\tif db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &ProfileORM{}); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(ProfileORMWithBeforeReadFind); ok {\n\t\tif db, err = hook.BeforeReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tormResponse := ProfileORM{}\n\tif err = db.Where(&ormObj).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormResponse).(ProfileORMWithAfterReadFind); ok {\n\t\tif err = hook.AfterReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func (c *Log) ReadSingle(module, version string) (eventlog.Event, error) {\n\treturn eventlog.Event{}, errors.New(\"TODO: implement\")\n}", "func (dao *OHLCVDao) GetAll() ([]types.Tick, error) {\n\tvar response []types.Tick\n\terr := db.Get(dao.dbName, dao.collectionName, bson.M{}, 0, 0, &response)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn nil, err\n\t}\n\n\treturn response, nil\n}", "func (r DasboardRepository) GetData(q validator.DashboardRequest) (*model.Dashboard, error) {\n\tnow := time.Now()\n\tif q.MonthStart.IsZero() {\n\t\tq.MonthStart = time.Date(now.Year(), time.January, 1, 0, 0, 0, 0, time.Local)\n\t}\n\tif q.MonthEnd.IsZero() {\n\t\tq.MonthEnd = time.Date(now.Year(), time.December, 31, 0, 0, 0, 0, time.Local)\n\t}\n\n\tsql := `select x.yearmonth,x.type,sum(x.count) count,sum(x.alerts) alerts,sum(x.news) news,sum(x.bigger) bigger\n\tfrom (\n\t\tselect q.yearmonth,q.type,count(*) count,sum(q.alerts) alerts,0 news,0 bigger\n\t\tfrom (\n\t\t\tselect to_char(a.created_at, 'YYYY-MM') yearmonth,a.type,(\n\t\t\t\tselect count(*) from alert_user where alert_user.alert_id=a.id\n\t\t\t) alerts\n\t\t\tfrom alert a\n\t\t) q\n\t\t group by q.yearmonth,q.type\n\t\tunion all\n\t\tselect to_char(c.created_at, 'YYYY-MM') yearmonth,4,0,0,count(*),0\n\t\tfrom customer c\n\t\tgroup by yearmonth\n\t\tunion all\n\t\tselect to_char(u.created_at, 'YYYY-MM') yearmonth,3,0,0,count(*),0\n\t\tfrom \"user\" u\n\t\tgroup by yearmonth\n\t\tunion all\n\t\tselect to_char(p.created_at, 'YYYY-MM') yearmonth,1,0,0,count(*),0\n\t\tfrom public_agent p\n\t\tgroup by yearmonth\n\t\tunion all\n\t\tselect z.yearmonth,1,0,0,0,count(*)\n\t\tfrom (\n\t\t\tselect to_char(a.created_at, 'YYYY-MM') yearmonth,a.type,(\n\t\t\t\tselect count(*) from alert_user where alert_user.alert_id=a.id\n\t\t\t) alerts\n\t\t\tfrom alert a\n\t\t\twhere a.type=2 and not a.public_agent_id is null\n\t\t) z\n\t\t group by z.yearmonth,z.type\n\t) x\n\twhere x.yearmonth >= ? and x.yearmonth <= ?\n\tgroup by x.yearmonth,x.type\n\torder by x.yearmonth,x.type`\n\tresults, err := r.DB.Query(sql, q.MonthStart.Format(YearMonthFormat), q.MonthEnd.Format(YearMonthFormat))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsqlTotal := `select 4 \"type\",count(*) count\n\tfrom customer c\n\tunion all\n\tselect 3,count(*)\n\tfrom \"user\" u\n\tunion all\n\tselect 1,count(*)\n\tfrom public_agent p`\n\n\ttotals, err := r.DB.Query(sqlTotal)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\td := builder.DashboardFromDB(results, totals)\n\n\treturn d, nil\n}", "func ReadExpense(row *sql.Row, a *Expense) error {\n\terr := row.Scan(&a.EXPID, &a.RPEXPID, &a.BID, &a.RID, &a.RAID, &a.Amount, &a.Dt, &a.AcctRule, &a.ARID, &a.FLAGS, &a.Comment, &a.CreateTS, &a.CreateBy, &a.LastModTime, &a.LastModBy)\n\tSkipSQLNoRowsError(&err)\n\treturn err\n}", "func (r *REST) defaultOnRead(obj runtime.Object) {\n\tswitch s := obj.(type) {\n\tcase *api.PersistentVolumeClaim:\n\t\tr.defaultOnReadPvc(s)\n\tcase *api.PersistentVolumeClaimList:\n\t\tr.defaultOnReadPvcList(s)\n\tdefault:\n\t\t// This was not an object we can default. This is not an error, as the\n\t\t// caching layer can pass through here, too.\n\t}\n}", "func (migration *Migration) RunReadQuery(query string, args ...interface{}) (map[string][]string, error) {\n\tif args == nil {\n\t\tglog.Infof(\"mig_id=%d: Running query '%s'.\", migration.Id, query)\n\t} else {\n\t\tglog.Infof(\"mig_id=%d: Running query '%s' (args: %v).\", migration.Id, query, args)\n\t}\n\tresponse, err := migration.DbClient.QueryReturnColumnDict(query, args...)\n\tif err != nil {\n\t\tglog.Errorf(\"mig_id=%d: Query '%s' failed (error: %s).\", migration.Id, query, err)\n\t\treturn nil, NewErrQueryFailed(query, err)\n\t}\n\tglog.Infof(\"mig_id=%d: Query response was '%v'\", migration.Id, response)\n\treturn response, nil\n}", "func (o *Object) readEntry(ctx context.Context) (*files.FileMetadata, error) {\n\treturn o.fs.getFileMetadata(ctx, o.remotePath())\n}", "func (c *CacheTable) Read(key interface{}) {\n\n}", "func (cc *ConfigClient) ReadEntry(entryKey string, defaultVal string) (string, error) {\n\n\tif cc.shutdownInvoked {\n\t\treturn defaultVal, errors.New(\"all connections have been closed via Close()\")\n\t}\n\n\trsp, err := cc.etcd.Get(context.Background(), cc.expandKey(entryKey))\n\tif err != nil {\n\t\treturn defaultVal, err\n\t}\n\n\tif len(rsp.Kvs) == 0 {\n\t\treturn defaultVal, nil\n\t}\n\n\treturn string(rsp.Kvs[0].Value), nil\n}", "func (d *Dao) ReadHumiture() (resp interface{}, err error) {\n\treq := SensorHumitureUnit.Request()\n\toutput, err := send(d, req.Bytes())\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn resp, err\n\t}\n\thumidity := binary.BigEndian.Uint16(output[1:3])\n\ttemperature := binary.BigEndian.Uint16(output[3:6])\n\tresp = []float64{dividedByTen(humidity), dividedByTen(temperature)}\n\treturn resp, nil\n}", "func (s *Source) ReadHealth() (settings settings.Health, err error) {\n\tfor _, source := range s.sources {\n\t\tsettingsFromSource, err := source.ReadHealth()\n\t\tif err != nil {\n\t\t\treturn settings, fmt.Errorf(\"reading from %s: %w\", source, err)\n\t\t}\n\t\tsettings.MergeWith(settingsFromSource)\n\t}\n\tsettings.SetDefaults()\n\n\terr = settings.Validate()\n\tif err != nil {\n\t\treturn settings, err\n\t}\n\n\treturn settings, nil\n}", "func (repo *SingleStoryRepository) FindAllStoriesForLoggedUser(userId uuid.UUID) []model.SingleStory {\n\tvar stories []model.SingleStory\n\trepo.Database.Select(\"*\").Where(\"user_id = ? and is_deleted = ?\", userId, false).Find(&stories)\n\n\tfor i:=0; i< len(stories); i++{\n\t\tif time.Now().After(stories[i].CreationDate.Add(24 * time.Hour)){\n\t\t\t// PASSED TIME SHOULD SET STORY AS EXPIRED\n\t\t\t//stories[i].IsExpired = true\n\t\t\trepo.Database.Model(&model.SingleStory{}).Where(\"id = ?\", stories[i].ID).Update(\"is_expired\", true)\n\t\t\trepo.Database.Model(&model.Story{}).Where(\"id = ?\", stories[i].ID).Update(\"is_expired\", true)\n\t\t}\n\t}\n\n\treturn stories\n}", "func (c *ConsulDB) ReadEntry(key string) (string, bool, error) {\n\n\tkv := c.consulClient.KV()\n\n\tpair, _, err := kv.Get(key, nil)\n\n\tif pair == nil {\n\t\treturn string(\"No value found for ID: \" + key), false, err\n\t}\n\treturn string(pair.Value), true, err\n}", "func (d *Dao) GetDayTotalExpenseInfo(c context.Context, date time.Time, ctype int) (totalExpense int64, err error) {\n\terr = d.rddb.QueryRow(c, _getDayTotalExpenseSQL, date, ctype).Scan(&totalExpense)\n\treturn\n}", "func GetDailyReport(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {\n\tif isLoggedIn(w, req) {\n\t\tt := template.Must(template.ParseGlob(\"views/components/navbar.comp\"))\n\t\tt.ParseFiles(\"views/report.html\")\n\t\tdata := struct {\n\t\t\tU User\n\t\t}{\n\t\t\tcurrentUser,\n\t\t}\n\t\tt.ExecuteTemplate(w, \"report.html\", data)\n\t}\n}", "func getEntityByUuid(uuid string) (map[string]interface{}, error) {\r\n\r\n\ttypeName := strings.Split(uuid, \"%\")[0]\r\n\tstoreId := typeName[0:strings.Index(typeName, \".\")]\r\n\r\n\tvar query EntityQuery\r\n\tquery.TYPENAME = typeName\r\n\tquery.TypeName = typeName\r\n\tquery.Fields = []string{}\r\n\tquery.Query = typeName + `.UUID==\"` + uuid + `\"`\r\n\r\n\tstore := GetServer().GetDataManager().getDataStore(storeId)\r\n\tqueryStr, _ := json.Marshal(query)\r\n\tvalues, err := store.Read(string(queryStr), []interface{}{}, []interface{}{})\r\n\r\n\tif err == nil {\r\n\t\t// init it child values.\r\n\t\tinitChilds(values[0][0].(map[string]interface{}))\r\n\t\t// return the resulting map.\r\n\t\treturn values[0][0].(map[string]interface{}), nil\r\n\t}\r\n\r\n\treturn nil, err\r\n}", "func (c *AllergyIntoleranceController) Read(ctx *app.ReadAllergyIntoleranceContext) error {\n\t//var sqlParams []interface{}\n\tx := json.RawMessage{}\n\n\tabsPath, _ := filepath.Abs(\"bundle.json\")\n\tfmt.Println(absPath)\n\tfile, err := os.Open(absPath)\n\tif err == nil {\n\t\t_ = json.NewDecoder(file).Decode(&x)\n\t}\n\tfile.Close()\n\n\t//getJson(\"http://nprogram.azurewebsites.net/Patient/1?_format=json\", patient)\n\t//getJson(\"http://localhost:3001\", patient)\n\t// //getJson(\"https://open-ic.epic.com/FHIR/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB\", patient)\n\t//_, err = json.NewDecoder(file).Decode(patient)\n\t//, err := cc.Get(\"http://fhirtest.uhn.ca/baseDstu2/Patient/EXexample\")\n\t//r, err := cc.Get(\"http://nprogram.azurewebsites.net/Patient/1?_format=json\")\n\n\t// if err != nil {\n\t// \tfmt.Println(\"A timeout error occured\")\n\t// \tos.Exit(3)\n\t// }\n\t// defer r.Body.Close()\n\n\t// body, _ := ioutil.ReadAll(r.Body)\n\n\t// isJSON := IsJSON(string(body))\n\t// if isJSON == true {\n\t// \tfmt.Println(\"Yesssssssssssssssssssssssssssssssssssssssssssssssss\")\n\t// \t_ = json.Unmarshal(body, &x)\n\t// } else {\n\t// \tfmt.Println(\"NOoooooooooooooooooooooooooooooooooooooooooooo\")\n\t// \t_ = xml.Unmarshal(body, &x)\n\t// }\n\n\t//err = json.Unmarshal([]byte(r), &f)\n\n\t// //b, _ := json.Marshal(body)\n\t// return json.Unmarshal(body, &target)\n\t//fmt.Printf(\"%s\", x)\n\n\tfmt.Println()\n\t//main_rt := gjson.Get(string(x), \"resourceType\")\n\t//sub_rt := gjson.Get(string(x), \"entry.#.resource.resourceType\")\n\t// m, ok := gjson.Parse(string(x)).Value().(map[string]interface{})\n\t// if !ok {\n\t// \t// not a map\n\t// }\n\n\t//value1 := gjson.Get(string(x), \"*\")\n\t//value2 := gjson.Get(string(x), \"entry.#.resource.code.coding.#.display\")\n\t//value2 := gjson.Get(string(x), \"entry.#.resource.component.#.valueQuantity.value\")\n\t//value2 := gjson.Get(string(x), \"entry.#.resource.component.#.code.coding.#.display\")\n\n\t//value3 := gjson.Get(string(x), \"identifier\")\n\t//fmt.Println(\"value *:\", value1.String())\n\n\t//fmt.Println(\"resource:\", value11.String())\n\t//fmt.Println(\"entry:\", value2.String())\n\t//fmt.Println(\"value:\", value3.String())\n\t//result := gjson.Get(string(x), \"entry.#.resource\")\n\n\t// //results := gjson.GetMany(string(x), \"entry.#.resource.code.coding.#.display\", \"entry.#.resource.component.#.code.coding.#.display\", \"entry.#.resource.component.#.valueQuantity.Value\")\n\t// results := gjson.GetMany(string(x), \"entry.#.resource.component.#.code.coding.#.display\", \"entry.#.resource.component.#.valueQuantity.value\")\n\n\t//_ = json.Unmarshal(x, &patient)\n\t//_, _ = json.Marshal(string(x))\n\n\t//_ = json.NewDecoder(r.Body).Decode(&x)\n\t//fmt.Println(results)\n\t//fmt.Printf(\"Indentifer:\", x.Matches[0].Ad, \"\\n\")\n\t//fmt.Println(\"Address:\", x.Address)\n\t//fmt.Println(\"Telecom:\", x.Telecom)\n\t//fmt.Println(\"CareProvider:\", x.CareProvider)\n\t//fmt.Println(\"Name:\", x.Name)\n\t//fmt.Printf(\"Contact:\", x.Contact)\n\n\t//fmt.Println(\"x is equal to:\", x.Address[0].Text)\n\n\t// res := &app.Patient{}\n\t// res.Active = patient.Active\n\t// res.BirthDate = patient.BirthDate\n\t// res.Gender = patient.Gender\n\t// //res.Telecom = patient.Telecom\n\t//res.Address=patient.Address\n\t//res.Address=\n\n\t//json.Marshal(patient)\n\n\t// \ttype int64array []int64\n\n\t// func (a int64array) Value() (driver.Value, error) {\n\t// // Format a in PostgreSQL's array input format {1,2,3} and return it as as string or []byte.\n\t// }\n\t//_, _ = json.Marshal(x)\n\n\t//g, _ := json.Marshal(x)\n\t//fmt.Println(string(g))\n\t// _, err = stmt.Exec(uuid.NewV4().String(), string(g))\n\t// if err != nil {\n\t// \tfmt.Println(err.Error())\n\t// \tfmt.Println(\"Error with db\")\n\t// }\n\n\t//json.Marshal(x)\n\n\t// t := app.Observation{}\n\t// s := reflect.ValueOf(&t).Elem()\n\t// typeOfT := s.Type()\n\n\t// for i := 0; i < s.NumField(); i++ {\n\t// \t//f := s.Field(i)\n\t// \t//fmt.Printf(\"%d: %s %s = %v\\n\", i,\n\t// \t//typeOfT.Field(i).Name, f.Type(), f.Interface())\n\t// \t//test2 := fmt.Sprintf(\"%T\", s.Field(i))\n\t// \ttest2 := fmt.Sprintf(\"%T\", s.Field(i))\n\n\t// \tfmt.Println(reflect.TypeOf(test2).Kind())\n\t// \t//fmt.Println(*test2)\n\n\t// \ttest := fmt.Sprintf(\"%s\", strings.ToLower(typeOfT.Field(i).Name))\n\t// \tfmt.Println(test)\n\n\t// \tvalue := gjson.Get(string(x), test)\n\t// \tfmt.Println()\n\t// \tfmt.Println(\"value *:\", value.String())\n\n\t// }\n\n\t//res := &app.AllergyIntoleranceMedia{}\n\treturn nil\n\t//return ctx.OK(res)\n\n}", "func (entity *MilitaryHistory) Get(context *pg.DB, account int64) (int, error) {\n\tentity.AccountID = account\n\n\toptions := &orm.CreateTableOptions{\n\t\tTemp: false,\n\t\tIfNotExists: true,\n\t}\n\n\tvar err error\n\tif err = context.CreateTable(&MilitaryHistory{}, options); err != nil {\n\t\treturn entity.ID, err\n\t}\n\n\tif entity.ID != 0 {\n\t\terr = context.Select(entity)\n\t}\n\n\tif entity.HasServedID != 0 {\n\t\tif _, err := entity.HasServed.Get(context, account); err != nil {\n\t\t\treturn entity.ID, err\n\t\t}\n\t}\n\n\tif entity.ListID != 0 {\n\t\tif _, err := entity.List.Get(context, account); err != nil {\n\t\t\treturn entity.ID, err\n\t\t}\n\t}\n\n\treturn entity.ID, err\n}", "func resourceHostRead(d *schema.ResourceData, m interface{}) error {\n\tlog.Debug(\"Lookup of hostgroup with id %s\", d.Id())\n\n\treturn hostRead(d, m, zabbix.Params{\n\t\t\"selectInterfaces\": \"extend\",\n\t\t\"selectParentTemplates\": \"extend\",\n\t\t\"selectGroups\": \"extend\",\n\t\t\"selectMacros\": \"extend\",\n\t\t\"selectTags\": \"extend\",\n\t\t\"selectInventory\": \"extend\",\n\t\t\"hostids\": d.Id(),\n\t})\n}", "func (h *provider) Read(ctx wfContext.Context, v *value.Value, act types.Action) error {\n\tobj := new(unstructured.Unstructured)\n\tif err := v.UnmarshalTo(obj); err != nil {\n\t\treturn err\n\t}\n\tkey, err := client.ObjectKeyFromObject(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif key.Namespace == \"\" {\n\t\tkey.Namespace = \"default\"\n\t}\n\tif err := h.cli.Get(context.Background(), key, obj); err != nil {\n\t\treturn err\n\t}\n\treturn v.FillObject(obj.Object, \"result\")\n}", "func resourceRepositoryRead(d *schema.ResourceData, meta interface{}) error {\n\treturn nil\n}", "func DefaultPatchHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj HealthMenstruationPersonalInfo\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadHealthMenstruationPersonalInfo(ctx, &HealthMenstruationPersonalInfo{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskHealthMenstruationPersonalInfo(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(HealthMenstruationPersonalInfoWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func (t *DbService) Read(request *ReadRequest) (*ReadResponse, error) {\n\trsp := &ReadResponse{}\n\treturn rsp, t.client.Call(\"db\", \"Read\", request, rsp)\n}", "func (this *dataStore) Read(queryName string, dest, arg interface{}) (error) {\r\n\r\n\tif stmt, err := this.namedStmt(queryName, dest); err != nil {\r\n\t\treturn err\r\n\t} else if stmt.query.Command != `select` {\r\n\t\treturn fmt.Errorf(`invalid SQL command for Read: %s`, stmt.query.Command)\r\n\t} else if stmt.query.MultiRow == true {\r\n\t\treturn stmt.Select(dest, arg)\r\n\t} else {\r\n\t\treturn stmt.Get(dest, arg)\r\n\t}\r\n}", "func (o *Object) readEntryAndSetMetadata(ctx context.Context) error {\n\t// Last resort set time from client\n\tif !o.modTime.IsZero() {\n\t\treturn nil\n\t}\n\tentry, err := o.readEntry(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn o.setMetadataFromEntry(entry)\n}", "func GetLogOne(c *gin.Context) {\n\tid := c.GetInt(\"id\")\n\tfmt.Println(id)\n\n\tlogs, _ := dao.GetLogsFirst(fmt.Sprintf(\"id = %d\", id), []string{\"id desc\"})\n\n\tresponse.JsonResponse(c, response.SUCCESS, logs)\n}", "func (w *Wug) GetRawHourlyTenDay(query *Query) ([]byte, error) {\n\treturn w.Get(HourTenDay, query)\n}", "func (p *GORMPersistence) GetData(pk tm.PersistenceKey) tm.Data {\n\tvar dataRecord ConversationData\n\tp.DB.Where(pk).Attrs(ConversationData{Data: datatypes.JSONMap{}}).FirstOrCreate(&dataRecord)\n\treturn dataRecord.Data\n}", "func (d *InfluxDevops) AvgMemAvailableDayByHour(q *Query) {\n\tinterval := d.AllInterval.RandWindow(24 * time.Hour)\n\n\tv := url.Values{}\n\tv.Set(\"db\", d.DatabaseName)\n\tv.Set(\"q\", fmt.Sprintf(\"SELECT mean(available) from mem where time >= '%s' and time < '%s' group by time(1h)\", interval.StartString(), interval.EndString()))\n\n\thumanLabel := []byte(\"Influx avg mem, all hosts, rand 1d by 1h\")\n\tq.HumanLabel = humanLabel\n\tq.HumanDescription = []byte(fmt.Sprintf(\"%s: %s\", humanLabel, interval.StartString()))\n\tq.Method = []byte(\"GET\")\n\tq.Path = []byte(fmt.Sprintf(\"/query?%s\", v.Encode()))\n\tq.Body = nil\n}", "func (s *storage) getEntry(index uint64, e *entry) error {\n\tb, err := s.log.Get(index)\n\tif err == log.ErrNotFound {\n\t\treturn err\n\t} else if err != nil {\n\t\tpanic(opError(err, \"Log.Get(%d)\", index))\n\t}\n\tif err = e.decode(bytes.NewReader(b)); err != nil {\n\t\tpanic(opError(err, \"log.Get(%d).decode()\", index))\n\t}\n\tif e.index != index {\n\t\tpanic(opError(fmt.Errorf(\"got %d, want %d\", e.index, index), \"log.Get(%d).index: \", index))\n\t}\n\treturn nil\n}", "func (list *APTAuditList) fetchOne(client *network.S3Head, key string) {\n\tclient.Head(key)\n\tif client.ErrorMessage != \"\" {\n\t\tfmt.Fprintln(os.Stderr, client.ErrorMessage)\n\t\tlist.flagError()\n\t\treturn\n\t}\n\tstrRecord := \"\"\n\tvar err error\n\trecord := client.StoredFile()\n\tif list.format == \"json\" {\n\t\tstrRecord, err = record.ToJson()\n\t} else {\n\t\tstrRecord, err = record.ToCSV(list.csvDelimiter)\n\t}\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"[Key\", key, \"]\", err.Error())\n\t\tlist.flagError()\n\t} else {\n\t\tlist.addResult(strRecord)\n\t}\n}", "func (i *InfluxDAO) QueryForSensorReadings(accountID, sensorID string, startTime, endTime int64) (*QueryForSensorReadingsResults, error) {\n\tresults := &QueryForSensorReadingsResults{accountID, sensorID, make([]*MinimalReading, 0)}\n\n\tres, err := i.queryDB(fmt.Sprintf(\"SELECT * from %s where sensor_id = '%s' and account_id = '%s' and time >= '%s' and time <= '%s' order by time desc\", sensorMeasurementsTableName, sensorID, accountID, time.Unix(startTime, 0).Format(time.RFC3339), time.Unix(endTime, 0).Format(time.RFC3339)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(res) != 1 || res[0].Series == nil || len(res[0].Series) == 0 {\n\t\treturn results, nil\n\t}\n\n\trow := res[0].Series[0]\n\n\tfor _, rowValues := range row.Values {\n\t\trowReading := &MinimalReading{\n\t\t\tMeasurements: make([]Measurement, 0),\n\t\t}\n\t\tfor k, v := range rowValues {\n\t\t\tvalueName := row.Columns[k]\n\t\t\tif strings.Contains(valueName, \"time\") {\n\t\t\t\tvar timestamp time.Time\n\t\t\t\ttimestamp, err = time.Parse(time.RFC3339, v.(string))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn results, err\n\t\t\t\t}\n\t\t\t\trowReading.Timestamp = timestamp.Unix()\n\t\t\t} else if strings.Contains(valueName, \"temperature\") {\n\t\t\t\tvar temperatureValue float64\n\t\t\t\ttemperatureValue, err = v.(json.Number).Float64()\n\t\t\t\tif err == nil {\n\t\t\t\t\trowReading.Measurements = append(rowReading.Measurements, Measurement{\n\t\t\t\t\t\tName: valueName,\n\t\t\t\t\t\tUnit: \"Celsius\",\n\t\t\t\t\t\tValue: temperatureValue,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t} else if strings.Contains(valueName, \"humidity\") {\n\t\t\t\tvar humidityValue float64\n\t\t\t\thumidityValue, err = v.(json.Number).Float64()\n\t\t\t\tif err == nil {\n\t\t\t\t\trowReading.Measurements = append(rowReading.Measurements, Measurement{\n\t\t\t\t\t\tName: valueName,\n\t\t\t\t\t\tUnit: \"%\",\n\t\t\t\t\t\tValue: humidityValue,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t} else if strings.Contains(valueName, \"soil_moisture\") {\n\t\t\t\tvar soilMoistureValue float64\n\t\t\t\tsoilMoistureValue, err = v.(json.Number).Float64()\n\t\t\t\tif err == nil {\n\t\t\t\t\trowReading.Measurements = append(rowReading.Measurements, Measurement{\n\t\t\t\t\t\tName: valueName,\n\t\t\t\t\t\tUnit: \"VWC\",\n\t\t\t\t\t\tValue: soilMoistureValue,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tresults.Readings = append(results.Readings, rowReading)\n\t}\n\treturn results, err\n}", "func (q elasticClient) Fire(entry *logrus.Entry) (err error) {\n\t// Reflect on eventType and Key on their native type.\n\tentryStr, ok := entry.Data[\"EventType\"].(string)\n\tif !ok {\n\t\treturn nil\n\t}\n\tkeyStr, ok := entry.Data[\"Key\"].(string)\n\tif !ok {\n\t\treturn nil\n\t}\n\n\tswitch q.params.Format {\n\tcase formatNamespace:\n\t\t// If event matches as delete, we purge the previous index.\n\t\tif eventMatch(entryStr, []string{\"s3:ObjectRemoved:*\"}) {\n\t\t\t_, err = q.Client.Delete().Index(q.params.Index).\n\t\t\t\tType(\"event\").Id(keyStr).Do(context.Background())\n\t\t\tbreak\n\t\t} // else we update elastic index or create a new one.\n\t\t_, err = q.Client.Index().Index(q.params.Index).\n\t\t\tType(\"event\").\n\t\t\tBodyJson(map[string]interface{}{\n\t\t\t\t\"Records\": entry.Data[\"Records\"],\n\t\t\t}).Id(keyStr).Do(context.Background())\n\tcase formatAccess:\n\t\t// eventTime is taken from the first entry in the\n\t\t// records.\n\t\tevents, ok := entry.Data[\"Records\"].([]NotificationEvent)\n\t\tif !ok {\n\t\t\treturn esErrFunc(\"Unable to extract event time due to conversion error of entry.Data[\\\"Records\\\"]=%v\", entry.Data[\"Records\"])\n\t\t}\n\t\tvar eventTime time.Time\n\t\teventTime, err = time.Parse(timeFormatAMZ, events[0].EventTime)\n\t\tif err != nil {\n\t\t\treturn esErrFunc(\"Unable to parse event time \\\"%s\\\": %v\",\n\t\t\t\tevents[0].EventTime, err)\n\t\t}\n\t\t// Extract event time in milliseconds for Elasticsearch.\n\t\teventTimeStr := fmt.Sprintf(\"%d\", eventTime.UnixNano()/1000000)\n\t\t_, err = q.Client.Index().Index(q.params.Index).Type(\"event\").\n\t\t\tTimestamp(eventTimeStr).\n\t\t\tBodyJson(map[string]interface{}{\n\t\t\t\t\"Records\": entry.Data[\"Records\"],\n\t\t\t}).Do(context.Background())\n\t}\n\tif err != nil {\n\t\treturn esErrFunc(\"Error inserting/deleting entry: %v\", err)\n\t}\n\treturn nil\n}", "func read(ctx *cli.Context) error {\n\tif err := initStore(ctx); err != nil {\n\t\treturn err\n\t}\n\tif ctx.Args().Len() < 1 {\n\t\treturn errors.New(\"Key arg is required\")\n\t}\n\n\tenv, err := util.GetEnv(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// get the namespace\n\tns, err := namespace.Get(env.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\topts := []store.ReadOption{\n\t\tstore.ReadFrom(ns, ctx.String(\"table\")),\n\t}\n\tif ctx.Bool(\"prefix\") {\n\t\topts = append(opts, store.ReadPrefix())\n\t}\n\tif ctx.Bool(\"suffix\") {\n\t\topts = append(opts, store.ReadSuffix())\n\t}\n\tif ctx.Uint(\"limit\") != 0 {\n\t\topts = append(opts, store.ReadLimit(ctx.Uint(\"limit\")))\n\t}\n\tif ctx.Uint(\"offset\") != 0 {\n\t\topts = append(opts, store.ReadLimit(ctx.Uint(\"offset\")))\n\t}\n\tif v := ctx.String(\"order\"); len(v) > 0 {\n\t\torder := store.OrderAsc\n\t\tif v == \"desc\" {\n\t\t\torder = store.OrderDesc\n\t\t}\n\t\topts = append(opts, store.ReadOrder(order))\n\t}\n\n\trecords, err := store.DefaultStore.Read(ctx.Args().First(), opts...)\n\tif err != nil {\n\t\tif err.Error() == \"not found\" {\n\t\t\treturn err\n\t\t}\n\t\treturn errors.Wrapf(err, \"Couldn't read %s from store\", ctx.Args().First())\n\t}\n\tswitch ctx.String(\"output\") {\n\tcase \"json\":\n\t\tjsonRecords, err := json.MarshalIndent(records, \"\", \" \")\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed marshalling JSON\")\n\t\t}\n\t\tfmt.Printf(\"%s\\n\", string(jsonRecords))\n\tdefault:\n\t\tif ctx.Bool(\"verbose\") {\n\t\t\tw := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0)\n\t\t\tfmt.Fprintf(w, \"%v \\t %v \\t %v\\n\", \"KEY\", \"VALUE\", \"EXPIRY\")\n\t\t\tfor _, r := range records {\n\t\t\t\tvar key, value, expiry string\n\t\t\t\tkey = r.Key\n\t\t\t\tif isPrintable(r.Value) {\n\t\t\t\t\tvalue = string(r.Value)\n\t\t\t\t} else {\n\t\t\t\t\tvalue = fmt.Sprintf(\"%#x\", r.Value[:20])\n\t\t\t\t}\n\t\t\t\tif r.Expiry == 0 {\n\t\t\t\t\texpiry = \"None\"\n\t\t\t\t} else {\n\t\t\t\t\texpiry = humanize.Time(time.Now().Add(r.Expiry))\n\t\t\t\t}\n\t\t\t\tfmt.Fprintf(w, \"%v \\t %v \\t %v\\n\", key, value, expiry)\n\t\t\t}\n\t\t\tw.Flush()\n\t\t\treturn nil\n\t\t}\n\t\tfor _, r := range records {\n\t\t\tfmt.Println(string(r.Value))\n\t\t}\n\t}\n\treturn nil\n}", "func getMedium(c cookoo.Context) (*Medium, error) {\n\tds, ok := c.HasDatasource(MediumDS)\n\tif !ok {\n\t\treturn nil, errors.New(\"Cannot find a Medium\")\n\t}\n\treturn ds.(*Medium), nil\n}", "func (db *MongoDBAccess) GetAll() ([]Record, error) {\n\tvar records []Record\n\tcursor, err := db.client.Database(db.database).Collection(\"days\").Find(context.Background(), bson.D{})\n\tif err != nil {\n\t\treturn []Record{}, err\n\t}\n\tdefer cursor.Close(context.Background())\n\tfor cursor.Next(context.Background()) {\n\t\tvar record Record\n\t\tif err = cursor.Decode(&record); err != nil {\n\t\t\treturn []Record{}, err\n\t\t}\n\t\trecords = append(records, record)\n\t}\n\treturn records, nil\n}", "func GetHealth(c *gin.Context) {\n\tservicer := c.MustGet(registry.ServiceKey).(registry.Servicer)\n\thealthCheckSearvice := servicer.NewHealthCheck()\n\n\tvar input model.HealthCheckSearchInput\n\n\terr := c.ShouldBindQuery(&input)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\toutput, err := healthCheckSearvice.GetHealth(input.ID)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, output)\n}", "func (self* userRestAPI) dailyStats(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson,err := self.engine.SummaryStats()\n\tif err != nil {\n\t\tlogError(err)\n\t\thttp.Error(w, fmt.Sprintf(\"\\nFailed to retrieve daily stats with error '%s'\\n\",err), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tio.WriteString(w,json)\n}", "func calcMinMaxDailyHeartRate(data health.Data) health.MinMaxStruct {\n\tvar result health.MinMaxStruct\n\tmin := float64(0)\n\tmax := float64(0)\n\tfor _, entry := range data.HeartRate {\n\t\tif min == 0 || entry.Value < min {\n\t\t\tmin = entry.Value\n\t\t}\n\t\tif entry.Value > max {\n\t\t\tmax = entry.Value\n\t\t}\n\t}\n\n\tif len(data.HeartRate) > 0 {\n\t\tresult.StartDate = data.HeartRate[0].StartDate\n\t}\n\tresult.Min = min\n\tresult.Max = max\n\treturn result\n}", "func ReadLedgerEntry(row *sql.Row, a *LedgerEntry) error {\n\terr := row.Scan(&a.LEID, &a.BID, &a.JID, &a.JAID, &a.LID, &a.RAID, &a.RID, &a.TCID, &a.Dt, &a.Amount, &a.Comment, &a.CreateTS, &a.CreateBy, &a.LastModTime, &a.LastModBy)\n\tSkipSQLNoRowsError(&err)\n\treturn err\n}", "func (t Table) Read(d Data) ([]map[string]interface{}, error) {\n\tdb, err := openDB(t.Config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer db.Close()\n\tvar rows *sql.Rows\n\tif d.KeyVal != nil {\n\t\trows, _ = db.Query(t.getReadStr(d), d.KeyVal)\n\t} else {\n\t\trows, _ = db.Query(t.getReadStr(d))\n\t}\n\tresult, err := rowsToJSON(rows)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\treturn result, err\n}", "func (c InfluxDBClient) FetchAll(start int64, end int64) ([]EventModel, error) {\n\tlog.Printf(\"Fetch all events from now - %ds to now - %ds\", start, end)\n\n\tcmd := fmt.Sprintf(`SELECT * FROM %s\n\t\t\t\t\t\tWHERE time >= NOW() - %ds AND time <= NOW() - %ds`, eventsTableName, start, end)\n\n\tlog.Println(\"Query data with command\", cmd)\n\n\tresponse, err := c.queryDB(cmd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.parseResponse(response)\n}" ]
[ "0.68675816", "0.65901476", "0.630962", "0.59756255", "0.57466877", "0.5386397", "0.5284462", "0.51186156", "0.5106763", "0.51045865", "0.50709534", "0.5024787", "0.49427426", "0.4860348", "0.48528224", "0.48139605", "0.47631463", "0.47389635", "0.46977806", "0.4647224", "0.46396595", "0.45886165", "0.45533726", "0.4542439", "0.45357236", "0.45272487", "0.45231503", "0.4522438", "0.45108384", "0.45066264", "0.4504384", "0.4501869", "0.4480825", "0.44681904", "0.44651276", "0.44479552", "0.4422654", "0.44091284", "0.4386573", "0.43848905", "0.43832177", "0.43826178", "0.4382609", "0.4376865", "0.4374041", "0.43672225", "0.43653736", "0.43652737", "0.43551975", "0.43507537", "0.4339964", "0.43267542", "0.43249694", "0.43198764", "0.43124595", "0.43116152", "0.43038264", "0.43012872", "0.4282357", "0.42806533", "0.4273617", "0.4265976", "0.42647353", "0.4234152", "0.4224212", "0.42214456", "0.42155313", "0.42101797", "0.4207076", "0.42023715", "0.41996062", "0.4195951", "0.41888684", "0.4186663", "0.41854426", "0.4173848", "0.41719136", "0.4167067", "0.41650018", "0.41568515", "0.41563004", "0.41551948", "0.41419265", "0.4134424", "0.41330174", "0.41307974", "0.4128899", "0.41241246", "0.41176128", "0.41142222", "0.41108495", "0.41094133", "0.41059837", "0.41001722", "0.40992358", "0.40971234", "0.40922868", "0.40892076", "0.40867007", "0.40808156" ]
0.83156854
0
DefaultPatchHealthMenstruationDailyEntry executes a basic gorm update call with patch behavior
DefaultPatchHealthMenstruationDailyEntry выполняет базовый вызов gorm update с поведением patch
func DefaultPatchHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) { if in == nil { return nil, errors1.NilArgumentError } var pbObj HealthMenstruationDailyEntry var err error if hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchRead); ok { if db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil { return nil, err } } pbReadRes, err := DefaultReadHealthMenstruationDailyEntry(ctx, &HealthMenstruationDailyEntry{Id: in.GetId()}, db) if err != nil { return nil, err } pbObj = *pbReadRes if hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchApplyFieldMask); ok { if db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil { return nil, err } } if _, err := DefaultApplyFieldMaskHealthMenstruationDailyEntry(ctx, &pbObj, in, updateMask, "", db); err != nil { return nil, err } if hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchSave); ok { if db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil { return nil, err } } pbResponse, err := DefaultStrictUpdateHealthMenstruationDailyEntry(ctx, &pbObj, db) if err != nil { return nil, err } if hook, ok := interface{}(pbResponse).(HealthMenstruationDailyEntryWithAfterPatchSave); ok { if err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil { return nil, err } } return pbResponse, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DefaultPatchSetHealthMenstruationDailyEntry(ctx context.Context, objects []*HealthMenstruationDailyEntry, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*HealthMenstruationDailyEntry, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*HealthMenstruationDailyEntry, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchHealthMenstruationDailyEntry(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func DefaultStrictUpdateHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateHealthMenstruationDailyEntry\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &HealthMenstruationDailyEntryORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func DefaultApplyFieldMaskHealthMenstruationDailyEntry(ctx context.Context, patchee *HealthMenstruationDailyEntry, patcher *HealthMenstruationDailyEntry, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"ProfileId\" {\n\t\t\tpatchee.ProfileId = patcher.ProfileId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Day\" {\n\t\t\tpatchee.Day = patcher.Day\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"IntensityPercentage\" {\n\t\t\tpatchee.IntensityPercentage = patcher.IntensityPercentage\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Type\" {\n\t\t\tpatchee.Type = patcher.Type\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Manual\" {\n\t\t\tpatchee.Manual = patcher.Manual\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"BasedOnPrediction\" {\n\t\t\tpatchee.BasedOnPrediction = patcher.BasedOnPrediction\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func DefaultListHealthMenstruationDailyEntry(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*HealthMenstruationDailyEntry, error) {\n\tin := HealthMenstruationDailyEntry{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm2.ApplyCollectionOperators(ctx, db, &HealthMenstruationDailyEntryORM{}, &HealthMenstruationDailyEntry{}, f, s, p, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []HealthMenstruationDailyEntryORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*HealthMenstruationDailyEntry{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func DefaultPatchHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj HealthMenstruationPersonalInfo\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadHealthMenstruationPersonalInfo(ctx, &HealthMenstruationPersonalInfo{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskHealthMenstruationPersonalInfo(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(HealthMenstruationPersonalInfoWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func DefaultReadHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, 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 == 0 {\n\t\treturn nil, errors1.EmptyIdError\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeReadApplyQuery); ok {\n\t\tif db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &HealthMenstruationDailyEntryORM{}); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeReadFind); ok {\n\t\tif db, err = hook.BeforeReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tormResponse := HealthMenstruationDailyEntryORM{}\n\tif err = db.Where(&ormObj).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormResponse).(HealthMenstruationDailyEntryORMWithAfterReadFind); ok {\n\t\tif err = hook.AfterReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultCreateHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, 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 hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeCreate_); ok {\n\t\tif db, err = hook.BeforeCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterCreate_); ok {\n\t\tif err = hook.AfterCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateHealthMenstruationPersonalInfo\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &HealthMenstruationPersonalInfoORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func DefaultApplyFieldMaskHealthMenstruationPersonalInfo(ctx context.Context, patchee *HealthMenstruationPersonalInfo, patcher *HealthMenstruationPersonalInfo, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"ProfileId\" {\n\t\t\tpatchee.ProfileId = patcher.ProfileId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"PeriodLengthInDays\" {\n\t\t\tpatchee.PeriodLengthInDays = patcher.PeriodLengthInDays\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CycleLengthInDays\" {\n\t\t\tpatchee.CycleLengthInDays = patcher.CycleLengthInDays\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func (s *Service) Update(r *http.Request, args *UpdateEntryArgs, result *UpdateResponse) error {\n\t// Since there is no fixed data schema, we can update as we like, so be careful\n\tif args.UserID == \"\" {\n\t\tresult.Message = uidMissing\n\t\treturn nil\n\t}\n\tuuid := args.UUID\n\tif uuid != \"\" {\n\t\tcoll := s.Session.DB(MentatDatabase).C(args.UserID)\n\t\tentry := Entry{}\n\t\tmgoErr := coll.Find(bson.M{\"uuid\": uuid}).One(&entry)\n\t\tif mgoErr != nil {\n\t\t\tif mgoErr.Error() == MongoNotFound {\n\t\t\t\tresult.Message = \"No entry with provided UUID\"\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\ts.Log.Infof(\"mgo error: %s\", mgoErr)\n\t\t\tresult.Message = fmt.Sprintf(\"mgo error: %s\", mgoErr)\n\t\t\treturn nil\n\t\t}\n\t\t// TODO: maybe use reflection\n\t\tif args.Type != \"\" {\n\t\t\tentry.Type = args.Type\n\t\t}\n\t\tif args.Content != \"\" {\n\t\t\tentry.Content = args.Content\n\t\t}\n\t\tif len(args.Tags) > 0 {\n\t\t\tentry.Tags = args.Tags\n\t\t}\n\t\tif args.Scheduled != \"\" {\n\t\t\tscheduled, err := time.Parse(DatetimeLayout, args.Scheduled)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tentry.Scheduled = scheduled\n\t\t}\n\t\tif args.Deadline != \"\" {\n\t\t\tdeadline, err := time.Parse(DatetimeLayout, args.Deadline)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tentry.Deadline = deadline\n\t\t}\n\n\t\tif args.Priority != \"\" {\n\t\t\trexp, err := regexp.Compile(\"\\\\#[A-Z]$\")\n\t\t\tif err != nil {\n\t\t\t\tpanic(err) // sentinel, should fail, because such error is predictable\n\t\t\t}\n\t\t\tif rexp.Match([]byte(args.Priority)) {\n\t\t\t\tentry.Priority = args.Priority\n\t\t\t} else {\n\t\t\t\tresult.Message = \"Malformed priority value\"\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\n\t\tif args.TodoStatus != \"\" {\n\t\t\tentry.TodoStatus = strings.ToUpper(args.TodoStatus)\n\t\t}\n\t\tentry.ModifiedAt = time.Now()\n\t\t_, err := coll.Upsert(bson.M{\"uuid\": uuid}, entry)\n\t\tif err != nil {\n\t\t\tresult.Message = fmt.Sprintf(\"update failed: %s\", err)\n\t\t\treturn nil\n\t\t}\n\t\tresult.Message = \"updated\"\n\t\treturn nil\n\t}\n\tresult.Message = \"No UUID found, cannot proceed with updating\"\n\treturn nil\n}", "func DefaultPatchSetHealthMenstruationPersonalInfo(ctx context.Context, objects []*HealthMenstruationPersonalInfo, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*HealthMenstruationPersonalInfo, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*HealthMenstruationPersonalInfo, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchHealthMenstruationPersonalInfo(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func (c *kuberhealthyChecks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result KuberhealthyCheck, err error) {\n\tresult = KuberhealthyCheck{}\n\terr = c.client.Patch(pt).\n\t\tNamespace(c.ns).\n\t\tResource(\"khchecks\").\n\t\tSubResource(subresources...).\n\t\tName(name).\n\t\tBody(data).\n\t\tDo(context.TODO()).\n\t\tInto(&result)\n\treturn\n}", "func (c *cronFederatedHPAs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.CronFederatedHPA, err error) {\n\tresult = &v1alpha1.CronFederatedHPA{}\n\terr = c.client.Patch(pt).\n\t\tNamespace(c.ns).\n\t\tResource(\"cronfederatedhpas\").\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}", "func (a *HyperflexApiService) PatchHyperflexSoftwareDistributionEntry(ctx context.Context, moid string) ApiPatchHyperflexSoftwareDistributionEntryRequest {\n\treturn ApiPatchHyperflexSoftwareDistributionEntryRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func update(rt *Runtime, r goengage.Fundraise, key string) {\n\tg := Stat{}\n\trt.DB.Where(\"id = ?\", key).First(&g)\n\tif g.CreatedDate == nil {\n\t\tg.ID = key\n\t\tt := time.Now()\n\t\tg.CreatedDate = &t\n\t\trt.DB.Create(&g)\n\t}\n\tfor _, t := range r.Transactions {\n\t\tg.AllCount++\n\t\tg.AllAmount = g.AllAmount + t.Amount\n\t\tif r.WasImported {\n\t\t\tg.OfflineCount++\n\t\t\tg.OfflineAmount += t.Amount\n\t\t} else {\n\t\t\tswitch r.DonationType {\n\t\t\tcase goengage.OneTime:\n\t\t\t\tg.OneTimeCount++\n\t\t\t\tg.OneTimeAmount += t.Amount\n\t\t\tcase goengage.Recurring:\n\t\t\t\tg.RecurringCount++\n\t\t\t\tg.RecurringAmount += t.Amount\n\t\t\t}\n\t\t\tswitch t.Type {\n\t\t\tcase goengage.Refund:\n\t\t\t\tg.RefundsCount++\n\t\t\t\tg.RefundsAmount += t.Amount\n\t\t\t}\n\t\t}\n\t\tg.Largest = math.Max(g.Largest, t.Amount)\n\t\tif t.Amount > 0.0 {\n\t\t\tif g.Smallest < 1.0 {\n\t\t\t\tg.Smallest = t.Amount\n\t\t\t} else {\n\t\t\t\tg.Smallest = math.Min(g.Smallest, t.Amount)\n\t\t\t}\n\t\t}\n\t\trt.DB.Model(&g).Updates(&g)\n\t}\n}", "func (o *Smallblog) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tsmallblogUpdateCacheMut.RLock()\n\tcache, cached := smallblogUpdateCache[key]\n\tsmallblogUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tsmallblogAllColumns,\n\t\t\tsmallblogPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update smallblog, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `smallblog` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, smallblogPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(smallblogType, smallblogMapping, append(wl, smallblogPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update smallblog row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for smallblog\")\n\t}\n\n\tif !cached {\n\t\tsmallblogUpdateCacheMut.Lock()\n\t\tsmallblogUpdateCache[key] = cache\n\t\tsmallblogUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func SchedulePatch(ctx context.Context, env evergreen.Environment, patchId string, version *model.Version, patchUpdateReq model.PatchUpdate) (int, error) {\n\tvar err error\n\tp, err := patch.FindOneId(patchId)\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, errors.Wrapf(err, \"loading patch '%s'\", patchId)\n\t}\n\tif p == nil {\n\t\treturn http.StatusBadRequest, errors.Errorf(\"patch '%s' not found\", patchId)\n\t}\n\n\tif p.IsCommitQueuePatch() {\n\t\treturn http.StatusBadRequest, errors.New(\"can't schedule commit queue patch\")\n\t}\n\tprojectRef, err := model.FindMergedProjectRef(p.Project, p.Version, true)\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, errors.Wrapf(err, \"finding project ref '%s' for version '%s'\", p.Project, p.Version)\n\t}\n\tif projectRef == nil {\n\t\treturn http.StatusInternalServerError, errors.Errorf(\"project '%s' for version '%s' not found\", p.Project, p.Version)\n\t}\n\n\tstatusCode, err := model.ConfigurePatch(ctx, env.Settings(), p, version, projectRef, patchUpdateReq)\n\tif err != nil {\n\t\treturn statusCode, err\n\t}\n\tif p.Version != \"\" { // if the version already exists, no more to do\n\t\treturn http.StatusOK, nil\n\t}\n\n\t// create a separate context from the one the caller has so that the caller\n\t// can't interrupt the db operations here\n\tnewCxt := context.Background()\n\t// Process additional patch trigger aliases added via UI.\n\t// Child patches created with the CLI --trigger-alias flag go through a separate flow, so ensure that new child patches are also created before the parent is finalized.\n\tif err := ProcessTriggerAliases(ctx, p, projectRef, env, patchUpdateReq.PatchTriggerAliases); err != nil {\n\t\treturn http.StatusInternalServerError, errors.Wrap(err, \"processing patch trigger aliases\")\n\t}\n\tif len(patchUpdateReq.PatchTriggerAliases) > 0 {\n\t\tp.Triggers.Aliases = patchUpdateReq.PatchTriggerAliases\n\t\tif err = p.SetTriggerAliases(); err != nil {\n\t\t\treturn http.StatusInternalServerError, errors.Wrapf(err, \"attaching trigger aliases '%s'\", p.Id.Hex())\n\t\t}\n\t}\n\t_, err = model.FinalizePatch(newCxt, p, p.GetRequester(), \"\")\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, errors.Wrap(err, \"finalizing patch\")\n\t}\n\n\tif p.IsGithubPRPatch() {\n\t\tjob := NewGithubStatusUpdateJobForNewPatch(p.Id.Hex())\n\t\tif err := evergreen.GetEnvironment().LocalQueue().Put(newCxt, job); err != nil {\n\t\t\treturn http.StatusInternalServerError, errors.Wrap(err, \"adding GitHub status update job to queue\")\n\t\t}\n\t}\n\treturn http.StatusOK, nil\n}", "func updateHandler(w http.ResponseWriter, r *http.Request) {\n\t////\n\t// handle only pull request\n\t//\n\tif r.Header.Get(\"X-Github-Event\") != \"pull_request\" {\n\t\treturn\n\t}\n\n\tvar pr pullRequestModel\n\tif err := json.NewDecoder(r.Body).Decode(&pr); err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tif pr.Action != \"opened\" {\n\t\treturn\n\t}\n\n\t//\n\t////\n\n\t////\n\t// check if the pr just opened has step.yml in it\n\t//\n\texists, err := isPRHasStepYML(fmt.Sprintf(\"%d\", pr.Number))\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tif !exists {\n\t\treturn\n\t}\n\n\t//\n\t////\n\tif strings.Contains(pr.PullRequest.Body, fmt.Sprintf(\"https://%s/tag?pr=%d\", hostBaseURL, pr.Number)) {\n\t\treturn\n\t}\n\n\t////\n\t// updating the PR's initial comment section: append badge as first element\n\t//\n\n\tapiURL := fmt.Sprintf(\"https://api.github.com/repos/bitrise-io/bitrise-steplib/pulls/%d\", pr.Number)\n\tbadgeContent := fmt.Sprintf(\"![TagCheck](https://%s/tag?pr=%d)\\r\\n\\r\\n\", hostBaseURL, pr.Number)\n\tnewBody := map[string]interface{}{\n\t\t\"body\": badgeContent + pr.PullRequest.Body,\n\t}\n\n\t// convert new body message to json\n\tb, err := json.Marshal(newBody)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\t// call authenticated PATCH request\n\tc := http.Client{}\n\treq, err := http.NewRequest(\"PATCH\", apiURL, bytes.NewReader(b))\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\treq.SetBasicAuth(os.Getenv(\"GITHUB_USER\"), os.Getenv(\"GITHUB_ACCESS_TOKEN\"))\n\t_, err = c.Do(req)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\t//\n\t////\n}", "func Patching(c *gin.Context) {\n\n\tvar request Request\n\terr := c.BindJSON(&request)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tc.Writer.WriteHeader(400)\n\t\treturn\n\t}\n\n\te, err := db.GetRepo().Patch(c.Param(\"id\"), request.Value, request.Key)\n\tif err != nil && err.Error() == \"record not found\" {\n\t\tc.Writer.WriteHeader(404)\n\t\treturn\n\t}\n\tif err != nil {\n\t\tc.Writer.WriteHeader(500)\n\t\treturn\n\t}\n\n\tc.JSON(200, gin.H{\n\t\t\"id\": e.Uuid,\n\t\t\"value\": e.Value,\n\t\t\"key\": e.Key,\n\t})\n\treturn\n}", "func (c *globalThreatFeeds) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v3.GlobalThreatFeed, err error) {\n\tresult = &v3.GlobalThreatFeed{}\n\terr = c.client.Patch(pt).\n\t\tResource(\"globalthreatfeeds\").\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}", "func (m *ThreatSubmissionEmailThreatsEmailThreatSubmissionItemRequestBuilder) Patch(ctx context.Context, body i084fa7ab3bba802bf5cc3b408e230cc64c167a57976e0d42c37e17154afd5b78.EmailThreatSubmissionable, requestConfiguration *ThreatSubmissionEmailThreatsEmailThreatSubmissionItemRequestBuilderPatchRequestConfiguration)(i084fa7ab3bba802bf5cc3b408e230cc64c167a57976e0d42c37e17154afd5b78.EmailThreatSubmissionable, 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, i084fa7ab3bba802bf5cc3b408e230cc64c167a57976e0d42c37e17154afd5b78.CreateEmailThreatSubmissionFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(i084fa7ab3bba802bf5cc3b408e230cc64c167a57976e0d42c37e17154afd5b78.EmailThreatSubmissionable), nil\n}", "func (a *HyperflexApiService) PatchHyperflexHxdpVersion(ctx context.Context, moid string) ApiPatchHyperflexHxdpVersionRequest {\n\treturn ApiPatchHyperflexHxdpVersionRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func (o *Notification) Update(exec boil.Executor, columns boil.Columns) (int64, error) {\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\to.UpdatedAt = currTime\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tnotificationUpdateCacheMut.RLock()\n\tcache, cached := notificationUpdateCache[key]\n\tnotificationUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tnotificationColumns,\n\t\t\tnotificationPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update notification, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"notification\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, notificationPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(notificationType, notificationMapping, append(wl, notificationPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update notification row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for notification\")\n\t}\n\n\tif !cached {\n\t\tnotificationUpdateCacheMut.Lock()\n\t\tnotificationUpdateCache[key] = cache\n\t\tnotificationUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(exec)\n}", "func (d *defaultJobRepository) PatchJobStatus(ctxIn context.Context, jobPatcher JobPatch) error {\n _, span := trace.StartSpan(ctxIn, \"(*defaultJobRepository).PatchJobStatus\")\n defer span.End()\n\n job := &Job{\n Status: jobPatcher.Status,\n ForeignJobID: ForeignJobID{\n BigQueryID: jobPatcher.ForeignJobID.BigQueryID,\n CloudStorageID: jobPatcher.ForeignJobID.CloudStorageID,\n },\n EntityAudit: EntityAudit{\n UpdatedTimestamp: time.Now(),\n },\n }\n\n _, err := d.storageService.DB().Model(job).\n Column(\"status\", \"audit_updated_timestamp\", \"bigquery_extract_job_id\", \"cloudstorage_transfer_job_id\").\n Where(\"audit_deleted_timestamp IS NULL\").\n Where(\"id = ?\", jobPatcher.ID).\n Update()\n\n if err != nil {\n return fmt.Errorf(\"error during executing updating job statement: %s\", err)\n }\n\n return nil\n}", "func (m *CompaniesItemJournalsItemJournalLinesJournalLineItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.JournalLineable, requestConfiguration *CompaniesItemJournalsItemJournalLinesJournalLineItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.JournalLineable, 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.CreateJournalLineFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.JournalLineable), nil\n}", "func DefaultApplyFieldMaskPeriod(ctx context.Context, patchee *Period, patcher *Period, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*Period, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tvar err error\n\tvar updatedCreatedAt bool\n\tvar updatedUpdatedAt bool\n\tfor i, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Period\" {\n\t\t\tpatchee.Period = patcher.Period\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedCreatedAt && strings.HasPrefix(f, prefix+\"CreatedAt.\") {\n\t\t\tif patcher.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"CreatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.CreatedAt, patchee.CreatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tupdatedCreatedAt = true\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUpdatedAt && strings.HasPrefix(f, prefix+\"UpdatedAt.\") {\n\t\t\tif patcher.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"UpdatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.UpdatedAt, patchee.UpdatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tupdatedUpdatedAt = true\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func patchAPIPostHandler(w http.ResponseWriter, r *http.Request, _ map[string]string) {\n\tuserName := sessionHandler.GetUserName(r)\n\tif userName != \"\" {\n\t\tuserID, err := getUserID(userName)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\t// Update post\n\t\tdecoder := json.NewDecoder(r.Body)\n\t\tvar json JSONPost\n\t\terr = decoder.Decode(&json)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tvar postSlug string\n\t\t// Get current slug of post\n\t\tpost, err := database.RetrievePostByID(json.ID)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tif json.Slug != post.Slug { // Check if user has submitted a custom slug\n\t\t\tpostSlug = slug.Generate(json.Slug, \"posts\")\n\t\t} else {\n\t\t\tpostSlug = post.Slug\n\t\t}\n\t\tcurrentTime := date.GetCurrentTime()\n\t\t*post = structure.Post{ID: json.ID, Title: []byte(json.Title), Slug: postSlug, Markdown: []byte(json.Markdown), HTML: conversion.GenerateHTMLFromMarkdown([]byte(json.Markdown)), IsFeatured: json.IsFeatured, IsPage: json.IsPage, IsPublished: json.IsPublished, MetaDescription: []byte(json.MetaDescription), Image: []byte(json.Image), Date: &currentTime, Tags: methods.GenerateTagsFromCommaString(json.Tags), Author: &structure.User{ID: userID}}\n\t\tnewlyPublished, err := methods.UpdatePost(post)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tif newlyPublished {\n\t\t\tnotifications.Send(string(post.Title), \"https://svjaneo.com/\"+post.Slug)\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(\"Post updated!\"))\n\t\treturn\n\t}\n\thttp.Error(w, \"Not logged in!\", http.StatusInternalServerError)\n}", "func (o *Rental) Update(exec boil.Executor, whitelist ...string) error {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn err\n\t}\n\tkey := makeCacheKey(whitelist, nil)\n\trentalUpdateCacheMut.RLock()\n\tcache, cached := rentalUpdateCache[key]\n\trentalUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(\n\t\t\trentalColumns,\n\t\t\trentalPrimaryKeyColumns,\n\t\t\twhitelist,\n\t\t)\n\n\t\tif len(whitelist) == 0 {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"sqlboiler: unable to update rental, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `rental` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, rentalPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(rentalType, rentalMapping, append(wl, rentalPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sqlboiler: unable to update rental row\")\n\t}\n\n\tif !cached {\n\t\trentalUpdateCacheMut.Lock()\n\t\trentalUpdateCache[key] = cache\n\t\trentalUpdateCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpdateHooks(exec)\n}", "func (repo *Repository) Update(ctx context.Context, claims auth.Claims, req UpdateRequest, now time.Time) error {\n\tspan, ctx := tracer.StartSpanFromContext(ctx, \"internal.expenditure.Update\")\n\tdefer span.Finish()\n\n\tif claims.Audience == \"\" {\n\t\treturn errors.WithStack(ErrForbidden)\n\t}\n\t// Admin users can update branches they have access to.\n\tif !claims.HasRole(auth.RoleAdmin) {\n\t\treturn errors.WithStack(ErrForbidden)\n\t}\n\n\t// Validate the request.\n\tv := webcontext.Validator()\n\terr := v.Struct(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcols := models.M{}\n\tif req.Amount != nil {\n\t\tcols[models.RepsExpenseColumns.Amount] = *req.Amount\n\t}\n\tif req.Reason != nil {\n\t\tcols[models.RepsExpenseColumns.Reason] = *req.Reason\n\t}\n\tif len(cols) == 0 {\n\t\treturn nil\n\t}\n\n\t// If now empty set it to the current time.\n\tif now.IsZero() {\n\t\tnow = time.Now()\n\t}\n\n\t// Always store the time as UTC.\n\tnow = now.UTC()\n\t// Postgres truncates times to milliseconds when storing. We and do the same\n\t// here so the value we return is consistent with what we store.\n\tnow = now.Truncate(time.Millisecond)\n\n\tcols[models.BranchColumns.UpdatedAt] = now\n\n\t_, err = models.RepsExpenses(models.RepsExpenseWhere.ID.EQ(req.ID)).UpdateAll(ctx, repo.DbConn, cols)\n\n\treturn nil\n}", "func (a *HyperflexApiService) PatchHyperflexSoftwareDistributionEntryExecute(r ApiPatchHyperflexSoftwareDistributionEntryRequest) (*HyperflexSoftwareDistributionEntry, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodPatch\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *HyperflexSoftwareDistributionEntry\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"HyperflexApiService.PatchHyperflexSoftwareDistributionEntry\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/hyperflex/SoftwareDistributionEntries/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\tif r.hyperflexSoftwareDistributionEntry == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"hyperflexSoftwareDistributionEntry is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\", \"application/json-patch+json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.ifMatch != nil {\n\t\tlocalVarHeaderParams[\"If-Match\"] = parameterToString(*r.ifMatch, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = r.hyperflexSoftwareDistributionEntry\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (o *HoldenAt) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tkey := makeCacheKey(columns, nil)\n\tholdenAtUpdateCacheMut.RLock()\n\tcache, cached := holdenAtUpdateCache[key]\n\tholdenAtUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tholdenAtAllColumns,\n\t\t\tholdenAtPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update HoldenAt, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"HoldenAt\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, holdenAtPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(holdenAtType, holdenAtMapping, append(wl, holdenAtPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update HoldenAt row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for HoldenAt\")\n\t}\n\n\tif !cached {\n\t\tholdenAtUpdateCacheMut.Lock()\n\t\tholdenAtUpdateCache[key] = cache\n\t\tholdenAtUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, nil\n}", "func (res *Resource) Patch(storage store.Update) {\n\tres.HandleFuncC(\n\t\tpat.Patch(patID),\n\t\tfunc(ctx context.Context, w http.ResponseWriter, r *http.Request) {\n\t\t\tres.patchHandler(ctx, w, r, storage)\n\t\t},\n\t)\n\n\tres.addRoute(patch, patID)\n}", "func handlePatchRequest(w http.ResponseWriter, e *models.Endpoint, r *http.Request, entity entities.Entity, h *func() (interface{}, error)) {\n\tw.Header().Add(\"Access-Control-Allow-Origin\", \"*\")\n\tif !checkContentType(w, r) {\n\t\treturn\n\t}\n\n\tbyteData, _ := ioutil.ReadAll(r.Body)\n\terr := entity.ParseEntity(byteData)\n\tif err != nil {\n\t\tsendError(w, []error{err})\n\t\treturn\n\t}\n\n\thandle := *h\n\tdata, err2 := handle()\n\tif err2 != nil {\n\t\tsendError(w, []error{err2})\n\t\treturn\n\t}\n\n\tw.Header().Add(\"Location\", entity.GetSelfLink())\n\n\tsendJSONResponse(w, http.StatusOK, data, nil)\n}", "func (a *HyperflexApiService) PatchHyperflexServerFirmwareVersionEntry(ctx context.Context, moid string) ApiPatchHyperflexServerFirmwareVersionEntryRequest {\n\treturn ApiPatchHyperflexServerFirmwareVersionEntryRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func (cc *LogController) Patch(c *gin.Context) {\n\trequest := &LogPatchRequest{}\n\tif err := c.ShouldBindJSON(request); err != nil {\n\t\tjsonAPIError(c, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tif request.Level == \"\" && request.SqlEnabled == nil {\n\t\tjsonAPIError(c, http.StatusBadRequest, fmt.Errorf(\"please set either logLevel or logSql as params in order to set the log level\"))\n\t\treturn\n\t}\n\n\tif request.Level != \"\" {\n\t\tvar ll zapcore.Level\n\t\terr := ll.UnmarshalText([]byte(request.Level))\n\t\tif err != nil {\n\t\t\tjsonAPIError(c, http.StatusBadRequest, err)\n\t\t\treturn\n\t\t}\n\t\tif err = cc.App.GetStore().Config.SetLogLevel(c.Request.Context(), ll.String()); err != nil {\n\t\t\tjsonAPIError(c, http.StatusInternalServerError, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif request.SqlEnabled != nil {\n\t\tif err := cc.App.GetStore().Config.SetLogSQLStatements(c.Request.Context(), *request.SqlEnabled); err != nil {\n\t\t\tjsonAPIError(c, http.StatusInternalServerError, err)\n\t\t\treturn\n\t\t}\n\t\tcc.App.GetStore().SetLogging(*request.SqlEnabled)\n\t}\n\n\t// Set default logger with new configurations\n\tlogger.SetLogger(cc.App.GetStore().Config.CreateProductionLogger())\n\n\tresponse := &presenters.LogResource{\n\t\tJAID: presenters.JAID{\n\t\t\tID: \"log\",\n\t\t},\n\t\tLevel: cc.App.GetStore().Config.LogLevel().String(),\n\t\tSqlEnabled: cc.App.GetStore().Config.LogSQLStatements(),\n\t}\n\n\tjsonAPIResponse(c, response, \"log\")\n}", "func DefaultApplyFieldMaskUserInfo(ctx context.Context, patchee *UserInfo, patcher *UserInfo, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*UserInfo, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tvar err error\n\tvar updatedCreatedAt bool\n\tvar updatedUpdatedAt bool\n\tfor i, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UserId\" {\n\t\t\tpatchee.UserId = patcher.UserId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"LastName\" {\n\t\t\tpatchee.LastName = patcher.LastName\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"FirstName\" {\n\t\t\tpatchee.FirstName = patcher.FirstName\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Period\" {\n\t\t\tpatchee.Period = patcher.Period\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"DepartmentId\" {\n\t\t\tpatchee.DepartmentId = patcher.DepartmentId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"JobId\" {\n\t\t\tpatchee.JobId = patcher.JobId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"EnrollmentFlg\" {\n\t\t\tpatchee.EnrollmentFlg = patcher.EnrollmentFlg\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"AdminFlg\" {\n\t\t\tpatchee.AdminFlg = patcher.AdminFlg\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedCreatedAt && strings.HasPrefix(f, prefix+\"CreatedAt.\") {\n\t\t\tif patcher.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"CreatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.CreatedAt, patchee.CreatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tupdatedCreatedAt = true\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUpdatedAt && strings.HasPrefix(f, prefix+\"UpdatedAt.\") {\n\t\t\tif patcher.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"UpdatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.UpdatedAt, patchee.UpdatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tupdatedUpdatedAt = true\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func ModifyVersionHandler(ctx context.Context, dataConnector data.Connector, patchID string, modifications VersionModifications) error {\n\tversion, err := dataConnector.FindVersionById(patchID)\n\tif err != nil {\n\t\treturn ResourceNotFound.Send(ctx, fmt.Sprintf(\"error finding version %s: %s\", patchID, err.Error()))\n\t}\n\tuser := MustHaveUser(ctx)\n\thttpStatus, err := ModifyVersion(*version, *user, nil, modifications)\n\tif err != nil {\n\t\treturn mapHTTPStatusToGqlError(ctx, httpStatus, err)\n\t}\n\n\tif evergreen.IsPatchRequester(version.Requester) {\n\t\t// restart is handled through graphql because we need the user to specify\n\t\t// which downstream tasks they want to restart\n\t\tif modifications.Action != Restart {\n\t\t\t//do the same for child patches\n\t\t\tp, err := patch.FindOneId(patchID)\n\t\t\tif err != nil {\n\t\t\t\treturn ResourceNotFound.Send(ctx, fmt.Sprintf(\"error finding patch %s: %s\", patchID, err.Error()))\n\t\t\t}\n\t\t\tif p == nil {\n\t\t\t\treturn ResourceNotFound.Send(ctx, fmt.Sprintf(\"patch '%s' not found \", patchID))\n\t\t\t}\n\t\t\tif p.IsParent() {\n\t\t\t\tfor _, childPatchId := range p.Triggers.ChildPatches {\n\t\t\t\t\tp, err := patch.FindOneId(childPatchId)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn ResourceNotFound.Send(ctx, fmt.Sprintf(\"error finding child patch %s: %s\", childPatchId, err.Error()))\n\t\t\t\t\t}\n\t\t\t\t\tif p == nil {\n\t\t\t\t\t\treturn ResourceNotFound.Send(ctx, fmt.Sprintf(\"child patch '%s' not found \", childPatchId))\n\t\t\t\t\t}\n\t\t\t\t\t// only modify the child patch if it is finalized\n\t\t\t\t\tif p.Version != \"\" {\n\t\t\t\t\t\terr = ModifyVersionHandler(ctx, dataConnector, childPatchId, modifications)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn errors.Wrap(mapHTTPStatusToGqlError(ctx, httpStatus, err), fmt.Sprintf(\"error modifying child patch '%s'\", patchID))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn nil\n}", "func (m *HealthMenstruationDailyEntryORM) ToPB(ctx context.Context) (HealthMenstruationDailyEntry, error) {\n\tto := HealthMenstruationDailyEntry{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(HealthMenstruationDailyEntryWithBeforeToPB); ok {\n\t\tif err = prehook.BeforeToPB(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tif m.CreatedAt != nil {\n\t\tif to.CreatedAt, err = ptypes1.TimestampProto(*m.CreatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tif m.UpdatedAt != nil {\n\t\tif to.UpdatedAt, err = ptypes1.TimestampProto(*m.UpdatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.ProfileId = m.ProfileId\n\tif m.Day != nil {\n\t\tif to.Day, err = ptypes1.TimestampProto(*m.Day); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.IntensityPercentage = m.IntensityPercentage\n\tto.Type = HealthMenstruationDailyEntry_Type(m.Type)\n\tto.Manual = m.Manual\n\tto.BasedOnPrediction = m.BasedOnPrediction\n\tif posthook, ok := interface{}(m).(HealthMenstruationDailyEntryWithAfterToPB); ok {\n\t\terr = posthook.AfterToPB(ctx, &to)\n\t}\n\treturn to, err\n}", "func DefaultStrictUpdatePeriod(ctx context.Context, in *Period, db *gorm.DB) (*Period, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdatePeriod\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &PeriodORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(PeriodORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(PeriodORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(PeriodORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func TestUpdateCrashedTask(t *testing.T) {\n\trouter := setupRouter()\n\n\t// Create a task with updated information\n\t// Slack - #cobra => nil\n\t// Post - nil => http://example.com/\n\tvar task CrashedDBTask\n\ttask.App = \"gotest-voltron\"\n\ttask.Post = zero.StringFrom(\"http://example.com/\")\n\ttaskBytes, err := json.Marshal(task)\n\tassert.Nil(t, err, \"Converting from CrashedDBTask to JSON should not throw an error\")\n\n\treq, _ := http.NewRequest(\"PATCH\", \"/task/crashed\", bytes.NewBuffer(taskBytes))\n\tw := httptest.NewRecorder()\n\trouter.ServeHTTP(w, req)\n\n\tassert.Equal(t, http.StatusCreated, w.Code, \"HTTP response code for PATCH /task/crashed should be 201\")\n\n\t// Check that the new task exists and contains expected data\n\treq, _ = http.NewRequest(\"GET\", \"/task/crashed/gotest-voltron\", nil)\n\tw = httptest.NewRecorder()\n\trouter.ServeHTTP(w, req)\n\n\tassert.Equal(t, http.StatusOK, w.Code, \"HTTP response code for GET /task/crashed/:app should be 200\")\n\n\tvar returnedTask CrashedDBTask\n\terr = json.Unmarshal([]byte(w.Body.String()), &returnedTask)\n\n\t// API sets nil slack channels to #\n\ttask.Slack = zero.StringFrom(\"#\")\n\n\tassert.Nil(t, err, \"Converting from JSON to CrashedDBTask should not throw an error\")\n\tassert.Equal(t, returnedTask.App, task.App, \"Task app name should match\")\n\tassert.Equal(t, returnedTask.Slack, task.Slack, \"Task slack should match\")\n\tassert.Equal(t, returnedTask.Email, task.Email, \"Task email should match\")\n\tassert.Equal(t, returnedTask.Post, task.Post, \"Task post should match\")\n}", "func (a *HyperflexApiService) PatchHyperflexHealthCheckDefinition(ctx context.Context, moid string) ApiPatchHyperflexHealthCheckDefinitionRequest {\n\treturn ApiPatchHyperflexHealthCheckDefinitionRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func (api *FoodRecipeAPI) partialRecipeUpdate(w http.ResponseWriter, req *http.Request) {\n\tdefer DrainBody(req)\n\tctx := req.Context()\n\n\tvars := mux.Vars(req)\n\tid := vars[\"id\"]\n\tlogData := log.Data{\"id\": id}\n\n\tvar errorObjects []*models.ErrorObject\n\n\tpatchJSON, recipePatches, err := patch.Get(ctx, req.Body)\n\tif err != nil {\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: err.Error()})\n\t\tErrorResponse(ctx, w, http.StatusBadRequest, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\t// Validate patch request\n\tfor i, recipePatch := range *recipePatches {\n\t\tif err = recipePatch.Validate(nil); err != nil {\n\t\t\tif _, ok := err.(*validator.InvalidValidationError); ok {\n\t\t\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: errs.ErrInternalServer.Error()})\n\t\t\t\tErrorResponse(ctx, w, http.StatusInternalServerError, &models.ErrorResponse{Errors: errorObjects})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfor _, err := range err.(validator.ValidationErrors) {\n\t\t\t\terrorObjects = append(errorObjects, models.HandleValidationErrors(strconv.Itoa(i), err.ActualTag(), err.StructField(), err.Value().(string), err.Param()))\n\t\t\t}\n\t\t}\n\t}\n\tif len(errorObjects) > 0 {\n\t\tErrorResponse(ctx, w, http.StatusBadRequest, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\t// apply patch against recipe resource\n\tp, err := jsonpatch.DecodePatch(patchJSON)\n\tif err != nil {\n\t\tlog.Error(ctx, \"patch recipe: unable to decode patch\", err)\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: err.Error()})\n\t\tErrorResponse(ctx, w, http.StatusBadRequest, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\t// find current recipe doc\n\tvar recipe models.Recipe\n\n\tcollection := api.MongoClient.Database(\"food-recipes\").Collection(\"recipes\")\n\tif err = collection.FindOne(ctx, bson.M{\"_id\": id}).Decode(&recipe); err != nil {\n\t\tif err == mongo.ErrNoDocuments {\n\t\t\tlog.Warn(ctx, \"patch recipe: failed to find recipe\", log.FormatErrors([]error{err}), logData)\n\t\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: errs.ErrRecipeNotFound.Error()})\n\t\t\tErrorResponse(ctx, w, http.StatusNotFound, &models.ErrorResponse{Errors: errorObjects})\n\t\t\treturn\n\t\t}\n\n\t\tlog.Error(ctx, \"patch recipe: failed to find recipe, bad connection?\", err)\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: errs.ErrInternalServer.Error()})\n\t\tErrorResponse(ctx, w, http.StatusInternalServerError, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\tb, err := json.Marshal(recipe)\n\tif err != nil {\n\t\tlog.Error(ctx, \"patch recipe: error returned from json marshal\", err, logData)\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: errs.ErrInternalServer.Error()})\n\t\tErrorResponse(ctx, w, http.StatusInternalServerError, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\t// apply patch to existing recipe\n\tmodified, err := p.Apply(b)\n\tif err != nil {\n\t\tlog.Error(ctx, \"patch recipe: unable to apply patch to recipe\", err, logData)\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: err.Error()})\n\t\tErrorResponse(ctx, w, http.StatusBadRequest, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(modified, &recipe)\n\tif err != nil {\n\t\tlog.Error(ctx, \"patch recipe: unmarshal modified recipe into recipe struct\", err, logData)\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: err.Error()})\n\t\tErrorResponse(ctx, w, http.StatusBadRequest, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\t// store new recipe\n\tif _, err = collection.ReplaceOne(ctx, bson.M{\"_id\": id}, recipe); err != nil {\n\t\tif err == mongo.ErrNoDocuments {\n\t\t\tlog.Error(ctx, \"update recipe: failed to update recipe, recipe deos not exists\", err, logData)\n\t\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: errs.ErrRecipeNotFound.Error()})\n\t\t\tErrorResponse(ctx, w, http.StatusNotFound, &models.ErrorResponse{Errors: errorObjects})\n\t\t\treturn\n\t\t}\n\n\t\tlog.Error(ctx, \"update recipe: failed to insert recipe\", err, logData)\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: errs.ErrInternalServer.Error()})\n\t\tErrorResponse(ctx, w, http.StatusInternalServerError, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\n\tlog.Info(ctx, \"update recipe: request successful\", logData)\n}", "func (_m *FakeScheduleService) UpdateAlertRule(key models.AlertRuleKey) {\n\t_m.Called(key)\n}", "func patchResource(mapping *meta.RESTMapping, config *rest.Config, group string,\n\tversion string, namespace string, data []byte) error {\n\trestClient, err := getRESTClient(config, group, version)\n\tif err != nil {\n\t\treturn &kfapis.KfError{\n\t\t\tCode: int(kfapis.INVALID_ARGUMENT),\n\t\t\tMessage: fmt.Sprintf(\"patchResource error: %v\", err),\n\t\t}\n\t}\n\n\tif _, err = restClient.\n\t\tPatch(k8stypes.JSONPatchType).\n\t\tResource(mapping.Resource.Resource).\n\t\tNamespaceIfScoped(namespace, mapping.Scope.Name() == \"namespace\").\n\t\tBody(data).\n\t\tDo().\n\t\tGet(); err == nil {\n\t\treturn nil\n\t} else {\n\t\treturn &kfapis.KfError{\n\t\t\tCode: int(kfapis.INVALID_ARGUMENT),\n\t\t\tMessage: fmt.Sprintf(\"patchResource error: %v\", err),\n\t\t}\n\t}\n}", "func (client ModelClient) UpdateHierarchicalEntityResponder(resp *http.Response) (result OperationStatus, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func (m *RiskyUsersItemHistoryRiskyUserHistoryItemItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RiskyUserHistoryItemable, requestConfiguration *RiskyUsersItemHistoryRiskyUserHistoryItemItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RiskyUserHistoryItemable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateRiskyUserHistoryItemFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RiskyUserHistoryItemable), nil\n}", "func (m *ExactMatchDataStoresExactMatchDataStoreItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ExactMatchDataStoreable, requestConfiguration *ExactMatchDataStoresExactMatchDataStoreItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ExactMatchDataStoreable, 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.CreateExactMatchDataStoreFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ExactMatchDataStoreable), nil\n}", "func (o *RecipeLipid) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\to.UpdatedAt = currTime\n\t}\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\trecipeLipidUpdateCacheMut.RLock()\n\tcache, cached := recipeLipidUpdateCache[key]\n\trecipeLipidUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\trecipeLipidAllColumns,\n\t\t\trecipeLipidPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update recipe_lipid, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"recipe_lipid\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, recipeLipidPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(recipeLipidType, recipeLipidMapping, append(wl, recipeLipidPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update recipe_lipid row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for recipe_lipid\")\n\t}\n\n\tif !cached {\n\t\trecipeLipidUpdateCacheMut.Lock()\n\t\trecipeLipidUpdateCache[key] = cache\n\t\trecipeLipidUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (me *CHARGES_IMPL) UpdateChargeDueDate (\r\n chargeId string,\r\n body *models_pkg.ChargesDueDateRequest,\r\n idempotencyKey *string) (*models_pkg.ChargesDueDateResponse, error) {\r\n //the endpoint path uri\r\n _pathUrl := \"/Charges/{charge_id}/due-date\"\r\n\r\n //variable to hold errors\r\n var err error = nil\r\n //process optional template parameters\r\n _pathUrl, err = apihelper_pkg.AppendUrlWithTemplateParameters(_pathUrl, map[string]interface{} {\r\n \"charge_id\" : chargeId,\r\n })\r\n if err != nil {\r\n //error in template param handling\r\n return nil, err\r\n }\r\n\r\n //the base uri for api requests\r\n _queryBuilder := configuration_pkg.BASEURI;\r\n\r\n //prepare query string for API call\r\n _queryBuilder = _queryBuilder + _pathUrl\r\n\r\n //validate and preprocess url\r\n _queryBuilder, err = apihelper_pkg.CleanUrl(_queryBuilder)\r\n if err != nil {\r\n //error in url validation or cleaning\r\n return nil, err\r\n }\r\n //prepare headers for the outgoing request\r\n headers := map[string]interface{} {\r\n \"user-agent\" : \"MundiSDK - Go 2.4.5\",\r\n \"accept\" : \"application/json\",\r\n \"content-type\" : \"application/json; charset=utf-8\",\r\n \"Content-Type\" : \"application/json\",\r\n \"idempotency-key\" : apihelper_pkg.ToString(idempotencyKey, \"\"),\r\n }\r\n\r\n //prepare API request\r\n _request := unirest.PatchWithAuth(_queryBuilder, headers, body, me.config.BasicAuthUserName(), me.config.BasicAuthPassword())\r\n //and invoke the API call request to fetch the response\r\n _response, err := unirest.AsString(_request,false);\r\n if err != nil {\r\n //error in API invocation\r\n return nil, err\r\n }\r\n\r\n //error handling using HTTP status codes\r\n if (_response.Code == 400) {\r\n err = apihelper_pkg.NewAPIError(\"Invalid request\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 401) {\r\n err = apihelper_pkg.NewAPIError(\"Invalid API key\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 404) {\r\n err = apihelper_pkg.NewAPIError(\"An informed resource was not found\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 412) {\r\n err = apihelper_pkg.NewAPIError(\"Business validation error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 422) {\r\n err = apihelper_pkg.NewAPIError(\"Contract validation error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code == 500) {\r\n err = apihelper_pkg.NewAPIError(\"Internal server error\", _response.Code, _response.RawBody)\r\n } else if (_response.Code < 200) || (_response.Code > 206) { //[200,206] = HTTP OK\r\n err = apihelper_pkg.NewAPIError(\"HTTP Response Not OK\", _response.Code, _response.RawBody)\r\n }\r\n if(err != nil) {\r\n //error detected in status code validation\r\n return nil, err\r\n }\r\n\r\n //returning the response\r\n var retVal *models_pkg.ChargesDueDateResponse = &models_pkg.ChargesDueDateResponse{}\r\n err = json.Unmarshal(_response.RawBody, &retVal)\r\n\r\n if err != nil {\r\n //error in parsing\r\n return nil, err\r\n }\r\n return retVal, nil\r\n\r\n}", "func (r *Route) Patch(h interface{}) *Route {\n\treturn r.Handle(toHandler(h), \"PATCH\")\n}", "func (srv *UsersService) PatchHandler(ctx *gin.Context) {\n\tlogger := srv.logger.New(\"action\", \"PatchHandler\")\n\tuser := GetRequestedUser(ctx)\n\tif user == nil {\n\t\t// Returns a \"404 StatusNotFound\" response\n\t\tsrv.ResponseService.NotFound(ctx)\n\t\treturn\n\t}\n\n\t// Checks if the query entry is valid\n\tform := &validators.PatchUser{}\n\tif err := ctx.ShouldBindJSON(form); err != nil {\n\t\tsrv.ResponseService.ValidatorErrorResponse(ctx, responses.UnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tcurrentUser := GetCurrentUser(ctx)\n\tif currentUser.UID == user.UID ||\n\t\tcurrentUser.RoleName == \"root\" ||\n\t\tcurrentUser.RoleName == \"admin\" {\n\n\t\tif form.FirstName != nil {\n\t\t\tuser.FirstName = *form.FirstName\n\t\t}\n\t\tif form.LastName != nil {\n\t\t\tuser.LastName = *form.LastName\n\t\t}\n\t\tif form.Nickname != nil {\n\t\t\tuser.Nickname = *form.Nickname\n\t\t}\n\n\t\trepo := srv.Repository.GetUsersRepository()\n\t\told, err := repo.FindByUID(user.UID)\n\t\tif err != nil {\n\t\t\tlogger.Error(\"cannot find user\", \"err\", err)\n\t\t\tsrv.ResponseService.NotFound(ctx)\n\t\t\treturn\n\t\t}\n\n\t\t_, err = repo.Update(user)\n\t\tif err != nil {\n\t\t\tlogger.Error(\"cannot update user\", \"err\", err)\n\t\t\tsrv.ResponseService.Error(ctx, responses.CanNotUpdateUser, \"Can't update a user\")\n\t\t\treturn\n\t\t}\n\n\t\tif currentUser.UID != user.UID &&\n\t\t\t(currentUser.RoleName == \"admin\" || currentUser.RoleName == \"root\") {\n\t\t\tsrv.SystemLogsService.LogModifyUserProfileAsync(old, user, currentUser.UID)\n\t\t}\n\t}\n\n\t// Returns a \"204 StatusNoContent\" response\n\tctx.JSON(http.StatusNoContent, nil)\n}", "func Patch(path string, fn http.HandlerFunc, c ...alice.Constructor) {\n\trecord(\"PATCH\", path)\n\n\tinfoMutex.Lock()\n\tr.PATCH(path, Handler(alice.New(c...).ThenFunc(fn)))\n\tinfoMutex.Unlock()\n}", "func (s *Service) patchHalResource(ctx context.Context, resourceName, url string, r interface{}, pf patchFunction) ([]byte, *status.Status) {\n\n\tvar body []byte\n\tvar code int\n\tvar err error\n\n\tb := new(bytes.Buffer)\n\tjson.NewEncoder(b).Encode(r)\n\n\tbody, code, err = pf(ctx, url, b, \"application/json\")\n\tif err != nil {\n\t\tlog.WithFields(event.Fields{\n\t\t\t\"resourceName\": resourceName,\n\t\t\t\"code\": code,\n\t\t\t\"url\": url,\n\t\t}).Error(\"Can not patch HAL resource: \" + err.Error())\n\t\treturn []byte{}, status.NewStatus(body, code, \"Can not modify resource \"+resourceName)\n\t}\n\n\t// A PATCH request should return a value in range of [200,300[\n\tif code < http.StatusOK || code >= http.StatusMultipleChoices {\n\t\tlog.WithFields(event.Fields{\n\t\t\t\"resourceName\": resourceName,\n\t\t\t\"code\": code,\n\t\t\t\"url\": url,\n\t\t}).Error(\"Can not patch HAL resource\")\n\t\treturn []byte{}, status.NewStatus(body, code, \"Can not modify resource \"+resourceName)\n\t}\n\treturn body, nil\n}", "func updateFunc(cmd *cobra.Command, args []string) {\n\tdomain := cmd.Flag(\"domain\").Value.String()\n\t_type := cmd.Flag(\"type\").Value.String()\n\tstatus := cmd.Flag(\"status\").Value.String()\n\tline := cmd.Flag(\"line\").Value.String()\n\trr := cmd.Flag(\"rr\").Value.String()\n\tvalue := cmd.Flag(\"value\").Value.String()\n\tlid := cmd.Flag(\"line-id\").Value.String()\n\tid, _ := cmd.Flags().GetUint64(\"id\")\n\tttl, _ := cmd.Flags().GetUint64(\"ttl\")\n\tmx, _ := cmd.Flags().GetUint64(\"mx\")\n\tdid, _ := cmd.Flags().GetUint64(\"domain-id\")\n\tweight, _ := cmd.Flags().GetUint64(\"weight\")\n\n\tif domain == \"\" || id == 0 || _type == \"\" || value == \"\" || line == \"\" {\n\t\tpanic(\"Domain or RecordID or Type or Value or RecordLine is mandatory for this action.\")\n\t}\n\n\tresp, err := app.Client.UpdateRecord(\n\t\tdomain, rr, _type, value, status, line, lid,\n\t\tid, ttl, mx, did, weight,\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdata, _ := convert.StringToJSONWithIndent(string(resp))\n\tfmt.Println(data)\n}", "func (m *ItemSitesItemAnalyticsItemActivityStatsItemActivityStatItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ItemActivityStatable, requestConfiguration *ItemSitesItemAnalyticsItemActivityStatsItemActivityStatItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ItemActivityStatable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateItemActivityStatFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ItemActivityStatable), nil\n}", "func patch(newObj runtime.Object, existingObj runtime.Object, c client.Client) error {\n\tnewObjJSON, _ := apijson.Marshal(newObj)\n\tkey, _ := client.ObjectKeyFromObject(newObj)\n\t_, isUnstructured := newObj.(runtime.Unstructured)\n\t_, isCRD := newObj.(*apiextv1beta1.CustomResourceDefinition)\n\n\tif isUnstructured || isCRD || isKudoType(newObj) {\n\t\t// strategic merge patch is not supported for these types, falling back to merge patch\n\t\terr := c.Patch(context.TODO(), newObj, client.ConstantPatch(types.MergePatchType, newObjJSON))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to apply merge patch to object %s/%s: %w\", key.Name, key.Name, err)\n\t\t}\n\t} else {\n\t\terr := c.Patch(context.TODO(), existingObj, client.ConstantPatch(types.StrategicMergePatchType, newObjJSON))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to apply StrategicMergePatch to object %s/%s: %w\", key.Namespace, key.Name, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (m *MobileAppTroubleshootingEventsMobileAppTroubleshootingEventItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.MobileAppTroubleshootingEventable, requestConfiguration *MobileAppTroubleshootingEventsMobileAppTroubleshootingEventItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.MobileAppTroubleshootingEventable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateMobileAppTroubleshootingEventFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.MobileAppTroubleshootingEventable), nil\n}", "func (dn *Daemon) updateHypershift(oldConfig, newConfig *mcfgv1.MachineConfig, diff *machineConfigDiff) (retErr error) {\n\toldIgnConfig, err := ctrlcommon.ParseAndConvertConfig(oldConfig.Spec.Config.Raw)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parsing old Ignition config failed: %w\", err)\n\t}\n\tnewIgnConfig, err := ctrlcommon.ParseAndConvertConfig(newConfig.Spec.Config.Raw)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parsing new Ignition config failed: %w\", err)\n\t}\n\n\t// update files on disk that need updating\n\t// We should't skip the certificate write in HyperShift since it does not run the extra daemon process\n\tif err := dn.updateFiles(oldIgnConfig, newIgnConfig, false); err != nil {\n\t\treturn err\n\t}\n\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tif err := dn.updateFiles(newIgnConfig, oldIgnConfig, false); err != nil {\n\t\t\t\terrs := kubeErrs.NewAggregate([]error{err, retErr})\n\t\t\t\tretErr = fmt.Errorf(\"error rolling back files writes: %w\", errs)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tif err := dn.updateSSHKeys(newIgnConfig.Passwd.Users, oldIgnConfig.Passwd.Users); err != nil {\n\t\treturn err\n\t}\n\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tif err := dn.updateSSHKeys(newIgnConfig.Passwd.Users, oldIgnConfig.Passwd.Users); err != nil {\n\t\t\t\terrs := kubeErrs.NewAggregate([]error{err, retErr})\n\t\t\t\tretErr = fmt.Errorf(\"error rolling back SSH keys updates: %w\", errs)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tif dn.os.IsCoreOSVariant() {\n\t\tcoreOSDaemon := CoreOSDaemon{dn}\n\t\tif err := coreOSDaemon.applyOSChanges(*diff, oldConfig, newConfig); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdefer func() {\n\t\t\tif retErr != nil {\n\t\t\t\tif err := coreOSDaemon.applyOSChanges(*diff, newConfig, oldConfig); err != nil {\n\t\t\t\t\terrs := kubeErrs.NewAggregate([]error{err, retErr})\n\t\t\t\t\tretErr = fmt.Errorf(\"error rolling back changes to OS: %w\", errs)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t} else {\n\t\tklog.Info(\"updating the OS on non-CoreOS nodes is not supported\")\n\t}\n\n\tif err := UpdateTuningArgs(KernelTuningFile, CmdLineFile); err != nil {\n\t\treturn err\n\t}\n\n\tklog.Info(\"Successfully completed Hypershift config update\")\n\treturn nil\n}", "func (c *FakeHelms) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Helm, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewPatchSubresourceAction(helmsResource, c.ns, name, pt, data, subresources...), &v1alpha1.Helm{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.Helm), err\n}", "func (r *DeviceHealthScriptRunSummaryRequest) Update(ctx context.Context, reqObj *DeviceHealthScriptRunSummary) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (s *Store) UpdateSilencedEntry(ctx context.Context, silenced *corev2.Silenced) error {\n\tif err := silenced.Validate(); err != nil {\n\t\treturn &store.ErrNotValid{Err: err}\n\t}\n\n\tif silenced.ExpireAt == 0 && silenced.Expire > 0 {\n\t\tstart := time.Now()\n\t\tif silenced.Begin > 0 {\n\t\t\tstart = time.Unix(silenced.Begin, 0)\n\t\t}\n\t\tsilenced.ExpireAt = start.Add(time.Duration(silenced.Expire) * time.Second).Unix()\n\t}\n\n\tsilencedBytes, err := proto.Marshal(silenced)\n\tif err != nil {\n\t\treturn &store.ErrEncode{Err: err}\n\t}\n\tcmp := clientv3.Compare(clientv3.Version(getNamespacePath(silenced.Namespace)), \">\", 0)\n\treq := clientv3.OpPut(GetSilencedPath(ctx, silenced.Name), string(silencedBytes))\n\tvar res *clientv3.TxnResponse\n\terr = kvc.Backoff(ctx).Retry(func(n int) (done bool, err error) {\n\t\tres, err = s.client.Txn(ctx).If(cmp).Then(req).Commit()\n\t\treturn kvc.RetryRequest(n, err)\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !res.Succeeded {\n\t\treturn &store.ErrNamespaceMissing{Namespace: silenced.Namespace}\n\t}\n\n\treturn nil\n}", "func (a *HyperflexApiService) PatchHyperflexServerFirmwareVersionEntryExecute(r ApiPatchHyperflexServerFirmwareVersionEntryRequest) (*HyperflexServerFirmwareVersionEntry, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodPatch\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *HyperflexServerFirmwareVersionEntry\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"HyperflexApiService.PatchHyperflexServerFirmwareVersionEntry\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/hyperflex/ServerFirmwareVersionEntries/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\tif r.hyperflexServerFirmwareVersionEntry == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"hyperflexServerFirmwareVersionEntry is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\", \"application/json-patch+json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.ifMatch != nil {\n\t\tlocalVarHeaderParams[\"If-Match\"] = parameterToString(*r.ifMatch, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = r.hyperflexServerFirmwareVersionEntry\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (engine *Engine) PATCH(relativePath string, handlers ...HandlerFunc) IRoutes {\n\treturn engine.handle(http.MethodPatch, relativePath, handlers)\n}", "func (a *HyperflexApiService) PatchHyperflexHealthCheckDefinitionExecute(r ApiPatchHyperflexHealthCheckDefinitionRequest) (*HyperflexHealthCheckDefinition, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodPatch\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *HyperflexHealthCheckDefinition\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"HyperflexApiService.PatchHyperflexHealthCheckDefinition\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/hyperflex/HealthCheckDefinitions/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\tif r.hyperflexHealthCheckDefinition == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"hyperflexHealthCheckDefinition is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\", \"application/json-patch+json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.ifMatch != nil {\n\t\tlocalVarHeaderParams[\"If-Match\"] = parameterToString(*r.ifMatch, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = r.hyperflexHealthCheckDefinition\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (t *MedChain) updateHospital(stub shim.ChaincodeStubInterface, args []string) peer.Response {\n\t\t// ==== Input sanitation ====\n\t\tfmt.Println(\"- start updateHospital\")\n\n\t\t// check if all the args are send\n\t\tif len(args) != 4 {\n\t\t\treturn shim.Error(\"Incorrect number of arguments, Required 4 arguments\")\n\t\t}\n\n\t\t// check if the args are empty\n\t\tfor i := 0; i < len(args); i++ {\n\t\t\tif len(args[i]) <= 0 {\n\t\t\t\treturn shim.Error(\"argument \"+ string(i+1) + \" must be a non-empty string\")\n\t\t\t}\n\t\t}\n\n\t\tgetAssetAsBytes, errT := stub.GetState(args[0])\n\n\t\tif errT != nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Error : Cannot find Hospital %s\" , errT))\n\t\t}\n\n\t\tif getAssetAsBytes == nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Cannot find asset Hospital with ID %s\" , args[0]))\n\t\t}\n\n\t\tvar obj = Hospital{}\n\n\t\tjson.Unmarshal(getAssetAsBytes, &obj)\n\t\tobj.HospitalName = args[1]\n\t\tobj.HospitalAddress = args[2]\n\t\tobj.HospitalPhone = args[3]\n\t\tcomAssetAsBytes, errMarshal := json.Marshal(obj)\n\n\t\tif errMarshal != nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Marshal Error: %s\", errMarshal))\n\t\t}\n\n\t\terrPut := stub.PutState(obj.Hospital_ID, comAssetAsBytes)\n\n\t\tif errPut != nil {\n\t\t\treturn shim.Error(fmt.Sprintf(\"Failed to update Hospital with ID %s\", args[0]))\n\t\t}\n\n\t\tfmt.Println(\"Hospital asset with ID %s was updated \\n %v\", args[0], obj)\n\n\t\treturn shim.Success(comAssetAsBytes)\n\t}", "func (m *PrivilegedSignupStatusItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedSignupStatusable, requestConfiguration *PrivilegedSignupStatusItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedSignupStatusable, 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.CreatePrivilegedSignupStatusFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedSignupStatusable), nil\n}", "func (r *DeviceManagementReportScheduleRequest) Update(ctx context.Context, reqObj *DeviceManagementReportSchedule) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (r *ImpossibleTravelRiskEventRequest) Update(ctx context.Context, reqObj *ImpossibleTravelRiskEvent) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (m *HealthMenstruationDailyEntry) ToORM(ctx context.Context) (HealthMenstruationDailyEntryORM, error) {\n\tto := HealthMenstruationDailyEntryORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(HealthMenstruationDailyEntryWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tif m.CreatedAt != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.CreatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.CreatedAt = &t\n\t}\n\tif m.UpdatedAt != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.UpdatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.UpdatedAt = &t\n\t}\n\tto.ProfileId = m.ProfileId\n\tif m.Day != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.Day); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Day = &t\n\t}\n\tto.IntensityPercentage = m.IntensityPercentage\n\tto.Type = int32(m.Type)\n\tto.Manual = m.Manual\n\tto.BasedOnPrediction = m.BasedOnPrediction\n\tif posthook, ok := interface{}(m).(HealthMenstruationDailyEntryWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "func (client LabClient) PatchResourceResponder(resp *http.Response) (result Lab, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func (w *Worker) Patch(c *http.Client, url string, data interface{}, bind interface{}) (int, error) {\n\tbs, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treq, err := http.NewRequest(\"PATCH\", url, bytes.NewReader(bs))\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tres, err := c.Do(req)\n\tif err != nil {\n\t\tif res != nil {\n\t\t\tioutil.ReadAll(res.Body)\n\t\t\tres.Body.Close()\n\t\t}\n\t\treturn 0, err\n\t}\n\tdefer res.Body.Close()\n\terr = json.NewDecoder(res.Body).Decode(bind)\n\tif res.StatusCode == http.StatusNoContent || bind == nil {\n\t\treturn res.StatusCode, nil\n\t}\n\treturn res.StatusCode, err\n}", "func (c *Controller) patchPlatform(r *web.Request) (*web.Response, error) {\n\tplatformID := r.PathParams[reqPlatformID]\n\tctx := r.Context()\n\tlog.C(ctx).Debugf(\"Updating platform with id %s\", platformID)\n\n\tplatform, err := c.PlatformStorage.Get(ctx, platformID)\n\tif err != nil {\n\t\treturn nil, util.HandleStorageError(err, \"platform\")\n\t}\n\n\tcreatedAt := platform.CreatedAt\n\n\tif err := util.BytesToObject(r.Body, platform); err != nil {\n\t\treturn nil, err\n\t}\n\n\tplatform.ID = platformID\n\tplatform.CreatedAt = createdAt\n\tplatform.UpdatedAt = time.Now().UTC()\n\n\tif err := c.PlatformStorage.Update(ctx, platform); err != nil {\n\t\treturn nil, util.HandleStorageError(err, \"platform\")\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn util.NewJSONResponse(http.StatusOK, platform)\n}", "func (service *EmployeeService) PatchEmployeeDetails(employeeID string, employeeDetails models.Employee) error {\n\tcollection := service.mongoClient.Database(DbName).Collection(CollectionName)\n\tupdatesToBePerformed := bson.M{}\n\tupdatesToBePerformed[\"employeeid\"] = employeeID\n\tif employeeDetails.Department != nil {\n\t\tupdatesToBePerformed[\"department\"] = employeeDetails.Department\n\t}\n\n\tif employeeDetails.Name != nil {\n\t\tupdatesToBePerformed[\"name\"] = employeeDetails.Name\n\t}\n\n\tif employeeDetails.Skills != nil {\n\t\tupdatesToBePerformed[\"skills\"] = employeeDetails.Skills\n\t}\n\n\tif employeeDetails.Address != nil {\n\t\taddress := models.Address{}\n\t\tif employeeDetails.Address.City != nil {\n\t\t\taddress.City = employeeDetails.Address.City\n\t\t}\n\n\t\tif employeeDetails.Address.Country != nil {\n\t\t\taddress.Country = employeeDetails.Address.Country\n\t\t}\n\n\t\tif employeeDetails.Address.DoorNo != nil {\n\t\t\taddress.DoorNo = employeeDetails.Address.DoorNo\n\t\t}\n\n\t\tif employeeDetails.Address.State != nil {\n\t\t\taddress.State = employeeDetails.Address.State\n\t\t}\n\n\t\tupdatesToBePerformed[\"address\"] = address\n\t}\n\n\tif employeeDetails.Status != nil {\n\t\tupdatesToBePerformed[\"status\"] = employeeDetails.Status\n\t}\n\n\t// consolidatedMap(&updatesToBePerformed, employeeDetails)\n\n\tresult, err := collection.UpdateOne(\n\t\tcontext.Background(),\n\t\tbson.M{\"employeeid\": employeeID},\n\t\tbson.M{\n\t\t\t\"$set\": updatesToBePerformed,\n\t\t})\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tfmt.Println(result)\n\n\treturn nil\n}", "func (c *configAuditReports) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ConfigAuditReport, err error) {\n\tresult = &v1alpha1.ConfigAuditReport{}\n\terr = c.client.Patch(pt).\n\t\tNamespace(c.ns).\n\t\tResource(\"configauditreports\").\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}", "func (hc *LegacyHealthCheckImpl) updateHealth(ts *LegacyTabletStats, conn queryservice.QueryService) {\n\t// Unconditionally send the received update at the end.\n\tdefer func() {\n\t\tif hc.listener != nil {\n\t\t\thc.listener.StatsUpdate(ts)\n\t\t}\n\t}()\n\n\thc.mu.Lock()\n\tth, ok := hc.addrToHealth[ts.Key]\n\tif !ok {\n\t\t// This can happen on delete because the entry is removed first,\n\t\t// or if LegacyHealthCheckImpl has been closed.\n\t\thc.mu.Unlock()\n\t\treturn\n\t}\n\toldts := th.latestTabletStats\n\tth.latestTabletStats = *ts\n\tth.conn = conn\n\thc.mu.Unlock()\n\n\t// In the case where a tablet changes type (but not for the\n\t// initial message), we want to log it, and maybe advertise it too.\n\tif oldts.Target.TabletType != topodatapb.TabletType_UNKNOWN && oldts.Target.TabletType != ts.Target.TabletType {\n\t\t// Log and maybe notify\n\t\tlog.Infof(\"HealthCheckUpdate(Type Change): %v, tablet: %s, target %+v => %+v, reparent time: %v\",\n\t\t\toldts.Name, topotools.TabletIdent(oldts.Tablet), topotools.TargetIdent(oldts.Target), topotools.TargetIdent(ts.Target), ts.TabletExternallyReparentedTimestamp)\n\t\tif hc.listener != nil && hc.sendDownEvents {\n\t\t\toldts.Up = false\n\t\t\thc.listener.StatsUpdate(&oldts)\n\t\t}\n\n\t\t// Track how often a tablet gets promoted to master. It is used for\n\t\t// comparing against the variables in go/vtgate/buffer/variables.go.\n\t\tif oldts.Target.TabletType != topodatapb.TabletType_MASTER && ts.Target.TabletType == topodatapb.TabletType_MASTER {\n\t\t\thcMasterPromotedCounters.Add([]string{ts.Target.Keyspace, ts.Target.Shard}, 1)\n\t\t}\n\t}\n}", "func (m *ItemCalendarViewBookingAppointmentItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.BookingAppointmentable, requestConfiguration *ItemCalendarViewBookingAppointmentItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.BookingAppointmentable, 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.CreateBookingAppointmentFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.BookingAppointmentable), nil\n}", "func DefaultPatchPeriod(ctx context.Context, in *Period, updateMask *field_mask.FieldMask, db *gorm.DB) (*Period, error) {\n\tif in == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tvar pbObj Period\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(PeriodWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadPeriod(ctx, &Period{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(PeriodWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskPeriod(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(PeriodWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdatePeriod(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(PeriodWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func (g *Group) PATCH(path string, h Handler, gases ...Gas) {\n\tg.Air.PATCH(g.Prefix+path, h, append(g.Gases, gases...)...)\n}", "func (c *Client) ModifyHealthCheck(args *ModifyHealthCheckArgs) (*ModifyHealthCheckResponse, error) {\n\tresponse := ModifyHealthCheckResponse{}\n\terr := c.Invoke(\"ModifyHealthCheck\", args, &response)\n\tif err == nil {\n\t\treturn &response, nil\n\t}\n\treturn nil, err\n}", "func (o *CurrentChartDataMinutely) Update(exec boil.Executor, columns boil.Columns) (int64, error) {\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\to.UpdatedAt = currTime\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tcurrentChartDataMinutelyUpdateCacheMut.RLock()\n\tcache, cached := currentChartDataMinutelyUpdateCache[key]\n\tcurrentChartDataMinutelyUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tcurrentChartDataMinutelyColumns,\n\t\t\tcurrentChartDataMinutelyPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update current_chart_data_minutely, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"current_chart_data_minutely\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, currentChartDataMinutelyPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(currentChartDataMinutelyType, currentChartDataMinutelyMapping, append(wl, currentChartDataMinutelyPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update current_chart_data_minutely row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for current_chart_data_minutely\")\n\t}\n\n\tif !cached {\n\t\tcurrentChartDataMinutelyUpdateCacheMut.Lock()\n\t\tcurrentChartDataMinutelyUpdateCache[key] = cache\n\t\tcurrentChartDataMinutelyUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(exec)\n}", "func (r *Route) Patch(h http.Handler) *Route {\n\tr.Add(\"PATCH\", h)\n\n\treturn r\n}", "func (client JobClient) UpdateResponder(resp *http.Response) (result JobResourceDescription, err error) {\n err = autorest.Respond(\n resp,\n azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated,http.StatusAccepted),\n autorest.ByUnmarshallingJSON(&result),\n autorest.ByClosing())\n result.Response = autorest.Response{Response: resp}\n return\n }", "func (du *DayUpdate) Save(ctx context.Context) (int, error) {\n\n\tvar (\n\t\terr error\n\t\taffected int\n\t)\n\tif len(du.hooks) == 0 {\n\t\taffected, err = du.sqlSave(ctx)\n\t} else {\n\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\tmutation, ok := m.(*DayMutation)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t}\n\t\t\tdu.mutation = mutation\n\t\t\taffected, err = du.sqlSave(ctx)\n\t\t\tmutation.done = true\n\t\t\treturn affected, err\n\t\t})\n\t\tfor i := len(du.hooks) - 1; i >= 0; i-- {\n\t\t\tmut = du.hooks[i](mut)\n\t\t}\n\t\tif _, err := mut.Mutate(ctx, du.mutation); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\treturn affected, err\n}", "func (m *ReportsRequestBuilder) Patch(ctx context.Context, body i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.Reportsable, requestConfiguration *ReportsRequestBuilderPatchRequestConfiguration)(i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.Reportsable, 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, i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.CreateReportsFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.Reportsable), nil\n}", "func UpdateMeeting(c *gin.Context) {\n // Get the meeting to be updated\n var meeting models.Meeting\n if err := models.DB.First(&meeting, \"id = ?\", c.Param(\"id\")).Error; err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n return\n }\n\n // Validate input\n var input UpdateMeetingInput\n if err := c.ShouldBindJSON(&input); err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n return\n }\n\n models.DB.Model(&meeting).Updates(input)\n\n c.JSON(http.StatusOK, gin.H{\"data\": meeting})\n}", "func (k Keeper) UpdateDailyPercent(ctx sdk.Context, addr sdk.AccAddress, coin coins.Coin) {\n\tbalance := k.BankKeeper.GetPosminableBalance(ctx, addr, coin)\n\n\tposmining := k.GetPosmining(ctx, addr, coin)\n\n\tnewDailyPercent := coin.GetDailyPercent(balance)\n\n\tif !posmining.DailyPercent.Equal(newDailyPercent) {\n\t\tposmining.DailyPercent = newDailyPercent\n\n\t\tk.SetPosmining(ctx, posmining, coin)\n\t}\n}", "func DefaultStrictUpdateUserInfo(ctx context.Context, in *UserInfo, db *gorm.DB) (*UserInfo, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateUserInfo\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &UserInfoORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func (m *ManagedTenantsManagementActionsManagementActionItemRequestBuilder) Patch(ctx context.Context, body i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagementActionable, requestConfiguration *ManagedTenantsManagementActionsManagementActionItemRequestBuilderPatchRequestConfiguration)(i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagementActionable, 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, i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.CreateManagementActionFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagementActionable), nil\n}", "func (o *RentalRower) Update(exec boil.Executor, columns boil.Columns) (int64, error) {\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\to.UpdatedAt = currTime\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\trentalRowerUpdateCacheMut.RLock()\n\tcache, cached := rentalRowerUpdateCache[key]\n\trentalRowerUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\trentalRowerColumns,\n\t\t\trentalRowerPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update rental_rowers, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"rental_rowers\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, rentalRowerPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(rentalRowerType, rentalRowerMapping, append(wl, rentalRowerPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update rental_rowers row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for rental_rowers\")\n\t}\n\n\tif !cached {\n\t\trentalRowerUpdateCacheMut.Lock()\n\t\trentalRowerUpdateCache[key] = cache\n\t\trentalRowerUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(exec)\n}", "func (r *DeviceHealthScriptRequest) Update(ctx context.Context, reqObj *DeviceHealthScript) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (m *VirtualEventsWebinarsItemSessionsItemVirtualAppointmentRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.VirtualAppointmentable, requestConfiguration *VirtualEventsWebinarsItemSessionsItemVirtualAppointmentRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.VirtualAppointmentable, 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.CreateVirtualAppointmentFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.VirtualAppointmentable), nil\n}", "func Patch(path string, fn http.HandlerFunc, c ...alice.Constructor) {\n\tinfoMutex.Lock()\n\trecord(\"PATCH\", path)\n\tr.Patch(path, alice.New(c...).ThenFunc(fn).(http.HandlerFunc))\n\tinfoMutex.Unlock()\n}", "func (client ModelClient) UpdateHierarchicalEntityChildResponder(resp *http.Response) (result OperationStatus, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func modifyAppConfigHandler(ctx *gin.Context) {\n log.Info(fmt.Sprintf(\"received request to modify config %s\", ctx.Param(\"appId\")))\n var request struct{Operation []map[string]interface{} `json:\"operation\" binding:\"required\"`}\n // parse config from request body\n if err := ctx.ShouldBind(&request); err != nil {\n log.Error(fmt.Errorf(\"unable to extract JSON Patch from body: %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"status_code\": http.StatusBadRequest, \"message\": \"Invalid JSON request body\"})\n return\n }\n // get app ID from path and convert to UUID\n appId, err := uuid.Parse(ctx.Param(\"appId\"))\n if err != nil {\n log.Error(fmt.Errorf(\"unable to app ID: %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"status_code\": http.StatusBadRequest, \"message\": \"Invalid app ID\"})\n return\n }\n\n // insert new config item into database\n db, _ := ctx.MustGet(\"db\").(*Persistence)\n current, err := db.GetConfigByAppId(appId)\n if err != nil {\n switch err {\n case ErrAppNotFound:\n log.Warn(fmt.Sprintf(\"cannot find config for app %s\", appId))\n ctx.JSON(http.StatusNotFound, gin.H{\n \"http_code\": http.StatusNotFound, \"message\": \"Cannot find config for app\"})\n default:\n log.Error(fmt.Errorf(\"unable to retrieve config from database: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n }\n return\n }\n\n // perform JSON patch on config\n updated, err := PatchConfig(current, request.Operation)\n if err != nil {\n switch err {\n case ErrInvalidJSONConfig, ErrInvalidPatch:\n log.Warn(fmt.Sprintf(\"cannot process JSON Patch %+v\", err))\n ctx.JSON(http.StatusBadRequest, gin.H{\n \"http_code\": http.StatusBadRequest, \"message\": \"Invalid JSON Patch Operation\"})\n default:\n log.Error(fmt.Errorf(\"unable to apply JSON Patch: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n }\n return\n }\n\n // update config in postgres database\n if err := db.UpdateConfigByAppId(appId, updated); err != nil {\n log.Error(fmt.Errorf(\"unable to updated config in database: %+v\", err))\n ctx.JSON(http.StatusInternalServerError, gin.H{\n \"http_code\": http.StatusInternalServerError, \"message\": \"Internal server error\"})\n return\n }\n ctx.JSON(http.StatusOK, gin.H{\n \"http_code\": http.StatusOK, \"message\": \"Successfully updated config\"})\n}", "func (e *Engine) PATCH(path string, handler Handler) {\n\te.registerRoute(http.MethodPatch, path, handler)\n}", "func (op *updateHealthCheckUpdateOperation) do(ctx context.Context, r *HealthCheck, c *Client) error {\n\t_, err := c.GetHealthCheck(ctx, r.urlNormalized())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tu, err := r.updateURL(c.Config.BasePath, \"update\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq, err := newUpdateHealthCheckUpdateRequest(ctx, r, c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.Config.Logger.Infof(\"Created update: %#v\", req)\n\tbody, err := marshalUpdateHealthCheckUpdateRequest(c, req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tresp, err := dcl.SendRequest(ctx, c.Config, \"PATCH\", u, bytes.NewBuffer(body), c.Config.RetryProvider)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar o operations.ComputeOperation\n\tif err := dcl.ParseResponse(resp.Response, &o); err != nil {\n\t\treturn err\n\t}\n\terr = o.Wait(ctx, c.Config, \"https://www.googleapis.com/compute/v1/\", \"GET\")\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (m *ManagedTenantsManagedTenantTicketingEndpointsManagedTenantTicketingEndpointItemRequestBuilder) Patch(ctx context.Context, body i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagedTenantTicketingEndpointable, requestConfiguration *ManagedTenantsManagedTenantTicketingEndpointsManagedTenantTicketingEndpointItemRequestBuilderPatchRequestConfiguration)(i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagedTenantTicketingEndpointable, 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, i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.CreateManagedTenantTicketingEndpointFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagedTenantTicketingEndpointable), nil\n}", "func (svc record) procUpdate(invokerID uint64, m *types.Module, upd *types.Record, old *types.Record) *types.RecordValueErrorSet {\n\t// Mark all values as updated (new)\n\tupd.Values.SetUpdatedFlag(true)\n\n\t// First sanitization\n\t//\n\t// Before values are merged with existing data and\n\t// sent to automation scripts (if any)\n\t// we need to make sure it does not get sanitized data\n\tupd.Values = svc.sanitizer.Run(m, upd.Values)\n\n\t// Copy values to updated record\n\t// to make sure nobody slips in something we do not want\n\tupd.CreatedAt = old.CreatedAt\n\tupd.CreatedBy = old.CreatedBy\n\tupd.UpdatedAt = nowPtr()\n\tupd.UpdatedBy = invokerID\n\tupd.DeletedAt = old.DeletedAt\n\tupd.DeletedBy = old.DeletedBy\n\n\t// Merge new (updated) values with old ones\n\t// This way we get list of updated, stale and deleted values\n\t// that we can selectively update in the repository\n\tupd.Values = old.Values.Merge(upd.Values)\n\n\tif upd.OwnedBy == 0 {\n\t\tif old.OwnedBy > 0 {\n\t\t\t// Owner not set/send in the payload\n\t\t\t//\n\t\t\t// Fallback to old owner (if set)\n\t\t\tupd.OwnedBy = old.OwnedBy\n\t\t} else {\n\t\t\t// If od owner is not set, make current user\n\t\t\t// the owner of the record\n\t\t\tupd.OwnedBy = invokerID\n\t\t}\n\t}\n\n\t// Run validation of the updated records\n\treturn svc.validator.Run(m, upd)\n}", "func Patch() int {\n\treturn patch\n}", "func (m *ItemOnlineMeetingsItemRegistrationRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.MeetingRegistrationable, requestConfiguration *ItemOnlineMeetingsItemRegistrationRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.MeetingRegistrationable, 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.CreateMeetingRegistrationFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.MeetingRegistrationable), nil\n}" ]
[ "0.7222593", "0.7203764", "0.71346027", "0.61198723", "0.611169", "0.61003435", "0.60970485", "0.5833735", "0.56815296", "0.5427646", "0.5337418", "0.5189905", "0.51254106", "0.5099041", "0.5030987", "0.5012633", "0.5009468", "0.49955863", "0.49036223", "0.490358", "0.48860726", "0.48621657", "0.4861886", "0.48563743", "0.48387185", "0.483586", "0.48273245", "0.48189846", "0.48164183", "0.48127258", "0.4807634", "0.47995535", "0.47881183", "0.47769138", "0.47615167", "0.4760432", "0.47491086", "0.47487918", "0.4740121", "0.4727007", "0.47220367", "0.47107896", "0.4708286", "0.4687348", "0.46809092", "0.46786997", "0.46737066", "0.46666843", "0.4663873", "0.46611065", "0.46582687", "0.46530327", "0.4639478", "0.4634715", "0.4633626", "0.46330494", "0.4627864", "0.4625547", "0.4623128", "0.4609028", "0.46066672", "0.46035686", "0.46028784", "0.46025014", "0.4600517", "0.45998132", "0.45845866", "0.45841023", "0.45790523", "0.45788875", "0.45787808", "0.45767757", "0.4576544", "0.4572145", "0.45694575", "0.45678172", "0.45649534", "0.45588264", "0.45578912", "0.45490512", "0.45349866", "0.45311055", "0.45233712", "0.45230585", "0.4514821", "0.45147046", "0.4514674", "0.4503778", "0.4501267", "0.4500857", "0.44984233", "0.4495083", "0.44936582", "0.4493436", "0.44929913", "0.44928384", "0.44897166", "0.4489202", "0.44878206", "0.4477194" ]
0.7921038
0
DefaultPatchSetHealthMenstruationDailyEntry executes a bulk gorm update call with patch behavior
DefaultPatchSetHealthMenstruationDailyEntry выполняет bulk gorm update вызов с поведением patch
func DefaultPatchSetHealthMenstruationDailyEntry(ctx context.Context, objects []*HealthMenstruationDailyEntry, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*HealthMenstruationDailyEntry, error) { if len(objects) != len(updateMasks) { return nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects)) } results := make([]*HealthMenstruationDailyEntry, 0, len(objects)) for i, patcher := range objects { pbResponse, err := DefaultPatchHealthMenstruationDailyEntry(ctx, patcher, updateMasks[i], db) if err != nil { return nil, err } results = append(results, pbResponse) } return results, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DefaultPatchHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj HealthMenstruationDailyEntry\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadHealthMenstruationDailyEntry(ctx, &HealthMenstruationDailyEntry{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskHealthMenstruationDailyEntry(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateHealthMenstruationDailyEntry(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(HealthMenstruationDailyEntryWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func DefaultApplyFieldMaskHealthMenstruationDailyEntry(ctx context.Context, patchee *HealthMenstruationDailyEntry, patcher *HealthMenstruationDailyEntry, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"ProfileId\" {\n\t\t\tpatchee.ProfileId = patcher.ProfileId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Day\" {\n\t\t\tpatchee.Day = patcher.Day\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"IntensityPercentage\" {\n\t\t\tpatchee.IntensityPercentage = patcher.IntensityPercentage\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Type\" {\n\t\t\tpatchee.Type = patcher.Type\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Manual\" {\n\t\t\tpatchee.Manual = patcher.Manual\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"BasedOnPrediction\" {\n\t\t\tpatchee.BasedOnPrediction = patcher.BasedOnPrediction\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func DefaultStrictUpdateHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateHealthMenstruationDailyEntry\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &HealthMenstruationDailyEntryORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func DefaultListHealthMenstruationDailyEntry(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*HealthMenstruationDailyEntry, error) {\n\tin := HealthMenstruationDailyEntry{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm2.ApplyCollectionOperators(ctx, db, &HealthMenstruationDailyEntryORM{}, &HealthMenstruationDailyEntry{}, f, s, p, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []HealthMenstruationDailyEntryORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*HealthMenstruationDailyEntry{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func DefaultPatchHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj HealthMenstruationPersonalInfo\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadHealthMenstruationPersonalInfo(ctx, &HealthMenstruationPersonalInfo{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskHealthMenstruationPersonalInfo(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(HealthMenstruationPersonalInfoWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateHealthMenstruationPersonalInfo\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &HealthMenstruationPersonalInfoORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func DefaultReadHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, 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 == 0 {\n\t\treturn nil, errors1.EmptyIdError\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeReadApplyQuery); ok {\n\t\tif db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &HealthMenstruationDailyEntryORM{}); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeReadFind); ok {\n\t\tif db, err = hook.BeforeReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tormResponse := HealthMenstruationDailyEntryORM{}\n\tif err = db.Where(&ormObj).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormResponse).(HealthMenstruationDailyEntryORMWithAfterReadFind); ok {\n\t\tif err = hook.AfterReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultPatchSetHealthMenstruationPersonalInfo(ctx context.Context, objects []*HealthMenstruationPersonalInfo, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*HealthMenstruationPersonalInfo, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*HealthMenstruationPersonalInfo, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchHealthMenstruationPersonalInfo(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func DefaultCreateHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, 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 hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeCreate_); ok {\n\t\tif db, err = hook.BeforeCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterCreate_); ok {\n\t\tif err = hook.AfterCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultApplyFieldMaskHealthMenstruationPersonalInfo(ctx context.Context, patchee *HealthMenstruationPersonalInfo, patcher *HealthMenstruationPersonalInfo, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"ProfileId\" {\n\t\t\tpatchee.ProfileId = patcher.ProfileId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"PeriodLengthInDays\" {\n\t\t\tpatchee.PeriodLengthInDays = patcher.PeriodLengthInDays\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CycleLengthInDays\" {\n\t\t\tpatchee.CycleLengthInDays = patcher.CycleLengthInDays\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func (o SmallblogSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), smallblogPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE `smallblog` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, smallblogPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in smallblog slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all smallblog\")\n\t}\n\treturn rowsAff, nil\n}", "func (o *Smallblog) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tsmallblogUpdateCacheMut.RLock()\n\tcache, cached := smallblogUpdateCache[key]\n\tsmallblogUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tsmallblogAllColumns,\n\t\t\tsmallblogPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update smallblog, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `smallblog` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, smallblogPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(smallblogType, smallblogMapping, append(wl, smallblogPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update smallblog row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for smallblog\")\n\t}\n\n\tif !cached {\n\t\tsmallblogUpdateCacheMut.Lock()\n\t\tsmallblogUpdateCache[key] = cache\n\t\tsmallblogUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (a *BulkApiService) PatchBulkExport(ctx context.Context, moid string) ApiPatchBulkExportRequest {\n\treturn ApiPatchBulkExportRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func (o HoldenAtSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), holdenAtPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"HoldenAt\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, holdenAtPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in holdenAt slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all holdenAt\")\n\t}\n\treturn rowsAff, nil\n}", "func (w *Workload) SanitizeBulkUpdate() {\n\n\t// All Workloads\n\tw.CreatedAt = \"\"\n\tw.CreatedBy = nil\n\tw.DeleteType = \"\"\n\tw.Deleted = nil\n\tw.DeletedAt = \"\"\n\tw.DeletedBy = nil\n\tw.UpdatedAt = \"\"\n\tw.UpdatedBy = nil\n\n\t// Managed workloads\n\tif w.Agent != nil && w.Agent.Status != nil {\n\t\tw.Hostname = \"\"\n\t\tw.Interfaces = nil\n\t\tw.Online = false\n\t\tw.OsDetail = \"\"\n\t\tw.OsID = \"\"\n\t\tw.PublicIP = \"\"\n\t\tw.Agent.Status = nil\n\t\tw.Services = nil\n\t\tw.Online = false\n\t}\n\n\t// Replace Labels with Hrefs\n\tnewLabels := []*Label{}\n\tfor _, l := range w.Labels {\n\t\tnewLabel := Label{Href: l.Href}\n\t\tnewLabels = append(newLabels, &newLabel)\n\t}\n\tw.Labels = newLabels\n}", "func (m *ItemSitesItemAnalyticsItemActivityStatsItemActivityStatItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ItemActivityStatable, requestConfiguration *ItemSitesItemAnalyticsItemActivityStatsItemActivityStatItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ItemActivityStatable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateItemActivityStatFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ItemActivityStatable), nil\n}", "func (m *ThreatSubmissionEmailThreatsEmailThreatSubmissionItemRequestBuilder) Patch(ctx context.Context, body i084fa7ab3bba802bf5cc3b408e230cc64c167a57976e0d42c37e17154afd5b78.EmailThreatSubmissionable, requestConfiguration *ThreatSubmissionEmailThreatsEmailThreatSubmissionItemRequestBuilderPatchRequestConfiguration)(i084fa7ab3bba802bf5cc3b408e230cc64c167a57976e0d42c37e17154afd5b78.EmailThreatSubmissionable, 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, i084fa7ab3bba802bf5cc3b408e230cc64c167a57976e0d42c37e17154afd5b78.CreateEmailThreatSubmissionFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(i084fa7ab3bba802bf5cc3b408e230cc64c167a57976e0d42c37e17154afd5b78.EmailThreatSubmissionable), nil\n}", "func update(rt *Runtime, r goengage.Fundraise, key string) {\n\tg := Stat{}\n\trt.DB.Where(\"id = ?\", key).First(&g)\n\tif g.CreatedDate == nil {\n\t\tg.ID = key\n\t\tt := time.Now()\n\t\tg.CreatedDate = &t\n\t\trt.DB.Create(&g)\n\t}\n\tfor _, t := range r.Transactions {\n\t\tg.AllCount++\n\t\tg.AllAmount = g.AllAmount + t.Amount\n\t\tif r.WasImported {\n\t\t\tg.OfflineCount++\n\t\t\tg.OfflineAmount += t.Amount\n\t\t} else {\n\t\t\tswitch r.DonationType {\n\t\t\tcase goengage.OneTime:\n\t\t\t\tg.OneTimeCount++\n\t\t\t\tg.OneTimeAmount += t.Amount\n\t\t\tcase goengage.Recurring:\n\t\t\t\tg.RecurringCount++\n\t\t\t\tg.RecurringAmount += t.Amount\n\t\t\t}\n\t\t\tswitch t.Type {\n\t\t\tcase goengage.Refund:\n\t\t\t\tg.RefundsCount++\n\t\t\t\tg.RefundsAmount += t.Amount\n\t\t\t}\n\t\t}\n\t\tg.Largest = math.Max(g.Largest, t.Amount)\n\t\tif t.Amount > 0.0 {\n\t\t\tif g.Smallest < 1.0 {\n\t\t\t\tg.Smallest = t.Amount\n\t\t\t} else {\n\t\t\t\tg.Smallest = math.Min(g.Smallest, t.Amount)\n\t\t\t}\n\t\t}\n\t\trt.DB.Model(&g).Updates(&g)\n\t}\n}", "func (q holdenAtQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for HoldenAt\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for HoldenAt\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (o CurrentChartDataMinutelySlice) UpdateAll(exec boil.Executor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), currentChartDataMinutelyPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"current_chart_data_minutely\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, currentChartDataMinutelyPrimaryKeyColumns, len(o)))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\tresult, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in currentChartDataMinutely slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all currentChartDataMinutely\")\n\t}\n\treturn rowsAff, nil\n}", "func (o NotificationSlice) UpdateAll(exec boil.Executor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), notificationPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"notification\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, notificationPrimaryKeyColumns, len(o)))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\tresult, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in notification slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all notification\")\n\t}\n\treturn rowsAff, nil\n}", "func (o *HoldenAt) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tkey := makeCacheKey(columns, nil)\n\tholdenAtUpdateCacheMut.RLock()\n\tcache, cached := holdenAtUpdateCache[key]\n\tholdenAtUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tholdenAtAllColumns,\n\t\t\tholdenAtPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update HoldenAt, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"HoldenAt\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, holdenAtPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(holdenAtType, holdenAtMapping, append(wl, holdenAtPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update HoldenAt row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for HoldenAt\")\n\t}\n\n\tif !cached {\n\t\tholdenAtUpdateCacheMut.Lock()\n\t\tholdenAtUpdateCache[key] = cache\n\t\tholdenAtUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, nil\n}", "func (q smallblogQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for smallblog\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for smallblog\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (c *kuberhealthyChecks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result KuberhealthyCheck, err error) {\n\tresult = KuberhealthyCheck{}\n\terr = c.client.Patch(pt).\n\t\tNamespace(c.ns).\n\t\tResource(\"khchecks\").\n\t\tSubResource(subresources...).\n\t\tName(name).\n\t\tBody(data).\n\t\tDo(context.TODO()).\n\t\tInto(&result)\n\treturn\n}", "func (s *Service) Update(r *http.Request, args *UpdateEntryArgs, result *UpdateResponse) error {\n\t// Since there is no fixed data schema, we can update as we like, so be careful\n\tif args.UserID == \"\" {\n\t\tresult.Message = uidMissing\n\t\treturn nil\n\t}\n\tuuid := args.UUID\n\tif uuid != \"\" {\n\t\tcoll := s.Session.DB(MentatDatabase).C(args.UserID)\n\t\tentry := Entry{}\n\t\tmgoErr := coll.Find(bson.M{\"uuid\": uuid}).One(&entry)\n\t\tif mgoErr != nil {\n\t\t\tif mgoErr.Error() == MongoNotFound {\n\t\t\t\tresult.Message = \"No entry with provided UUID\"\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\ts.Log.Infof(\"mgo error: %s\", mgoErr)\n\t\t\tresult.Message = fmt.Sprintf(\"mgo error: %s\", mgoErr)\n\t\t\treturn nil\n\t\t}\n\t\t// TODO: maybe use reflection\n\t\tif args.Type != \"\" {\n\t\t\tentry.Type = args.Type\n\t\t}\n\t\tif args.Content != \"\" {\n\t\t\tentry.Content = args.Content\n\t\t}\n\t\tif len(args.Tags) > 0 {\n\t\t\tentry.Tags = args.Tags\n\t\t}\n\t\tif args.Scheduled != \"\" {\n\t\t\tscheduled, err := time.Parse(DatetimeLayout, args.Scheduled)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tentry.Scheduled = scheduled\n\t\t}\n\t\tif args.Deadline != \"\" {\n\t\t\tdeadline, err := time.Parse(DatetimeLayout, args.Deadline)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tentry.Deadline = deadline\n\t\t}\n\n\t\tif args.Priority != \"\" {\n\t\t\trexp, err := regexp.Compile(\"\\\\#[A-Z]$\")\n\t\t\tif err != nil {\n\t\t\t\tpanic(err) // sentinel, should fail, because such error is predictable\n\t\t\t}\n\t\t\tif rexp.Match([]byte(args.Priority)) {\n\t\t\t\tentry.Priority = args.Priority\n\t\t\t} else {\n\t\t\t\tresult.Message = \"Malformed priority value\"\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\n\t\tif args.TodoStatus != \"\" {\n\t\t\tentry.TodoStatus = strings.ToUpper(args.TodoStatus)\n\t\t}\n\t\tentry.ModifiedAt = time.Now()\n\t\t_, err := coll.Upsert(bson.M{\"uuid\": uuid}, entry)\n\t\tif err != nil {\n\t\t\tresult.Message = fmt.Sprintf(\"update failed: %s\", err)\n\t\t\treturn nil\n\t\t}\n\t\tresult.Message = \"updated\"\n\t\treturn nil\n\t}\n\tresult.Message = \"No UUID found, cannot proceed with updating\"\n\treturn nil\n}", "func (o ForeignLegalResourceSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), foreignLegalResourcePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"ForeignLegalResources\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, foreignLegalResourcePrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in foreignLegalResource slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all foreignLegalResource\")\n\t}\n\treturn rowsAff, nil\n}", "func (m *RiskyUsersItemHistoryRiskyUserHistoryItemItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RiskyUserHistoryItemable, requestConfiguration *RiskyUsersItemHistoryRiskyUserHistoryItemItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RiskyUserHistoryItemable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateRiskyUserHistoryItemFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RiskyUserHistoryItemable), nil\n}", "func (o CMFUserExperienceLogSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cmfUserExperienceLogPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE `cmf_user_experience_log` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, cmfUserExperienceLogPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in cmfUserExperienceLog slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all cmfUserExperienceLog\")\n\t}\n\treturn rowsAff, nil\n}", "func DefaultApplyFieldMaskPeriod(ctx context.Context, patchee *Period, patcher *Period, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*Period, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tvar err error\n\tvar updatedCreatedAt bool\n\tvar updatedUpdatedAt bool\n\tfor i, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Period\" {\n\t\t\tpatchee.Period = patcher.Period\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedCreatedAt && strings.HasPrefix(f, prefix+\"CreatedAt.\") {\n\t\t\tif patcher.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"CreatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.CreatedAt, patchee.CreatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tupdatedCreatedAt = true\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUpdatedAt && strings.HasPrefix(f, prefix+\"UpdatedAt.\") {\n\t\t\tif patcher.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"UpdatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.UpdatedAt, patchee.UpdatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tupdatedUpdatedAt = true\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func (m *ManagedTenantsManagementActionsManagementActionItemRequestBuilder) Patch(ctx context.Context, body i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagementActionable, requestConfiguration *ManagedTenantsManagementActionsManagementActionItemRequestBuilderPatchRequestConfiguration)(i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagementActionable, 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, i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.CreateManagementActionFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagementActionable), nil\n}", "func (m *ExactMatchDataStoresExactMatchDataStoreItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ExactMatchDataStoreable, requestConfiguration *ExactMatchDataStoresExactMatchDataStoreItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ExactMatchDataStoreable, 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.CreateExactMatchDataStoreFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ExactMatchDataStoreable), nil\n}", "func (o *CurrentChartDataMinutely) Update(exec boil.Executor, columns boil.Columns) (int64, error) {\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\to.UpdatedAt = currTime\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tcurrentChartDataMinutelyUpdateCacheMut.RLock()\n\tcache, cached := currentChartDataMinutelyUpdateCache[key]\n\tcurrentChartDataMinutelyUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tcurrentChartDataMinutelyColumns,\n\t\t\tcurrentChartDataMinutelyPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update current_chart_data_minutely, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"current_chart_data_minutely\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, currentChartDataMinutelyPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(currentChartDataMinutelyType, currentChartDataMinutelyMapping, append(wl, currentChartDataMinutelyPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update current_chart_data_minutely row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for current_chart_data_minutely\")\n\t}\n\n\tif !cached {\n\t\tcurrentChartDataMinutelyUpdateCacheMut.Lock()\n\t\tcurrentChartDataMinutelyUpdateCache[key] = cache\n\t\tcurrentChartDataMinutelyUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(exec)\n}", "func (m *CompaniesItemJournalsItemJournalLinesJournalLineItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.JournalLineable, requestConfiguration *CompaniesItemJournalsItemJournalLinesJournalLineItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.JournalLineable, 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.CreateJournalLineFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.JournalLineable), nil\n}", "func (o RSSAnnouncementSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), rssAnnouncementPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"rss_announcements\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, rssAnnouncementPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in rssAnnouncement slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all rssAnnouncement\")\n\t}\n\treturn rowsAff, nil\n}", "func (m *TermsAndConditionsItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TermsAndConditionsable, requestConfiguration *TermsAndConditionsItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TermsAndConditionsable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateTermsAndConditionsFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TermsAndConditionsable), nil\n}", "func (ob *OrderBook) BatchUpdate() {\n\n}", "func (m *MobileAppTroubleshootingEventsMobileAppTroubleshootingEventItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.MobileAppTroubleshootingEventable, requestConfiguration *MobileAppTroubleshootingEventsMobileAppTroubleshootingEventItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.MobileAppTroubleshootingEventable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateMobileAppTroubleshootingEventFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.MobileAppTroubleshootingEventable), nil\n}", "func (o RecipeLipidSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), recipeLipidPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"recipe_lipid\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, recipeLipidPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in recipeLipid slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all recipeLipid\")\n\t}\n\treturn rowsAff, nil\n}", "func (c *globalThreatFeeds) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v3.GlobalThreatFeed, err error) {\n\tresult = &v3.GlobalThreatFeed{}\n\terr = c.client.Patch(pt).\n\t\tResource(\"globalthreatfeeds\").\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}", "func (o TenantSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"dbmodel: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), tenantPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE `tenants` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, tenantPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"dbmodel: unable to update all in tenant slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"dbmodel: unable to retrieve rows affected all in update all tenant\")\n\t}\n\treturn rowsAff, nil\n}", "func (o CMFUserSuperSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cmfUserSuperPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE `cmf_user_super` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, cmfUserSuperPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in cmfUserSuper slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all cmfUserSuper\")\n\t}\n\treturn rowsAff, nil\n}", "func (o *Rental) Update(exec boil.Executor, whitelist ...string) error {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn err\n\t}\n\tkey := makeCacheKey(whitelist, nil)\n\trentalUpdateCacheMut.RLock()\n\tcache, cached := rentalUpdateCache[key]\n\trentalUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(\n\t\t\trentalColumns,\n\t\t\trentalPrimaryKeyColumns,\n\t\t\twhitelist,\n\t\t)\n\n\t\tif len(whitelist) == 0 {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"sqlboiler: unable to update rental, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `rental` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, rentalPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(rentalType, rentalMapping, append(wl, rentalPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sqlboiler: unable to update rental row\")\n\t}\n\n\tif !cached {\n\t\trentalUpdateCacheMut.Lock()\n\t\trentalUpdateCache[key] = cache\n\t\trentalUpdateCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpdateHooks(exec)\n}", "func (o AutomodRuleDatumSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), automodRuleDatumPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"automod_rule_data\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, automodRuleDatumPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in automodRuleDatum slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all automodRuleDatum\")\n\t}\n\treturn rowsAff, nil\n}", "func DefaultListHealthMenstruationPersonalInfo(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*HealthMenstruationPersonalInfo, error) {\n\tin := HealthMenstruationPersonalInfo{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm2.ApplyCollectionOperators(ctx, db, &HealthMenstruationPersonalInfoORM{}, &HealthMenstruationPersonalInfo{}, f, s, p, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []HealthMenstruationPersonalInfoORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*HealthMenstruationPersonalInfo{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func (m *HealthMenstruationDailyEntryORM) ToPB(ctx context.Context) (HealthMenstruationDailyEntry, error) {\n\tto := HealthMenstruationDailyEntry{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(HealthMenstruationDailyEntryWithBeforeToPB); ok {\n\t\tif err = prehook.BeforeToPB(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tif m.CreatedAt != nil {\n\t\tif to.CreatedAt, err = ptypes1.TimestampProto(*m.CreatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tif m.UpdatedAt != nil {\n\t\tif to.UpdatedAt, err = ptypes1.TimestampProto(*m.UpdatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.ProfileId = m.ProfileId\n\tif m.Day != nil {\n\t\tif to.Day, err = ptypes1.TimestampProto(*m.Day); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.IntensityPercentage = m.IntensityPercentage\n\tto.Type = HealthMenstruationDailyEntry_Type(m.Type)\n\tto.Manual = m.Manual\n\tto.BasedOnPrediction = m.BasedOnPrediction\n\tif posthook, ok := interface{}(m).(HealthMenstruationDailyEntryWithAfterToPB); ok {\n\t\terr = posthook.AfterToPB(ctx, &to)\n\t}\n\treturn to, err\n}", "func (client ModelClient) UpdateHierarchicalEntityResponder(resp *http.Response) (result OperationStatus, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func (c *cronFederatedHPAs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.CronFederatedHPA, err error) {\n\tresult = &v1alpha1.CronFederatedHPA{}\n\terr = c.client.Patch(pt).\n\t\tNamespace(c.ns).\n\t\tResource(\"cronfederatedhpas\").\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}", "func (svc record) procUpdate(invokerID uint64, m *types.Module, upd *types.Record, old *types.Record) *types.RecordValueErrorSet {\n\t// Mark all values as updated (new)\n\tupd.Values.SetUpdatedFlag(true)\n\n\t// First sanitization\n\t//\n\t// Before values are merged with existing data and\n\t// sent to automation scripts (if any)\n\t// we need to make sure it does not get sanitized data\n\tupd.Values = svc.sanitizer.Run(m, upd.Values)\n\n\t// Copy values to updated record\n\t// to make sure nobody slips in something we do not want\n\tupd.CreatedAt = old.CreatedAt\n\tupd.CreatedBy = old.CreatedBy\n\tupd.UpdatedAt = nowPtr()\n\tupd.UpdatedBy = invokerID\n\tupd.DeletedAt = old.DeletedAt\n\tupd.DeletedBy = old.DeletedBy\n\n\t// Merge new (updated) values with old ones\n\t// This way we get list of updated, stale and deleted values\n\t// that we can selectively update in the repository\n\tupd.Values = old.Values.Merge(upd.Values)\n\n\tif upd.OwnedBy == 0 {\n\t\tif old.OwnedBy > 0 {\n\t\t\t// Owner not set/send in the payload\n\t\t\t//\n\t\t\t// Fallback to old owner (if set)\n\t\t\tupd.OwnedBy = old.OwnedBy\n\t\t} else {\n\t\t\t// If od owner is not set, make current user\n\t\t\t// the owner of the record\n\t\t\tupd.OwnedBy = invokerID\n\t\t}\n\t}\n\n\t// Run validation of the updated records\n\treturn svc.validator.Run(m, upd)\n}", "func (o *Notification) Update(exec boil.Executor, columns boil.Columns) (int64, error) {\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\to.UpdatedAt = currTime\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tnotificationUpdateCacheMut.RLock()\n\tcache, cached := notificationUpdateCache[key]\n\tnotificationUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tnotificationColumns,\n\t\t\tnotificationPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update notification, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"notification\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, notificationPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(notificationType, notificationMapping, append(wl, notificationPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update notification row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for notification\")\n\t}\n\n\tif !cached {\n\t\tnotificationUpdateCacheMut.Lock()\n\t\tnotificationUpdateCache[key] = cache\n\t\tnotificationUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(exec)\n}", "func DefaultApplyFieldMaskUserInfo(ctx context.Context, patchee *UserInfo, patcher *UserInfo, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*UserInfo, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tvar err error\n\tvar updatedCreatedAt bool\n\tvar updatedUpdatedAt bool\n\tfor i, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UserId\" {\n\t\t\tpatchee.UserId = patcher.UserId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"LastName\" {\n\t\t\tpatchee.LastName = patcher.LastName\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"FirstName\" {\n\t\t\tpatchee.FirstName = patcher.FirstName\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Period\" {\n\t\t\tpatchee.Period = patcher.Period\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"DepartmentId\" {\n\t\t\tpatchee.DepartmentId = patcher.DepartmentId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"JobId\" {\n\t\t\tpatchee.JobId = patcher.JobId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"EnrollmentFlg\" {\n\t\t\tpatchee.EnrollmentFlg = patcher.EnrollmentFlg\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"AdminFlg\" {\n\t\t\tpatchee.AdminFlg = patcher.AdminFlg\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedCreatedAt && strings.HasPrefix(f, prefix+\"CreatedAt.\") {\n\t\t\tif patcher.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"CreatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.CreatedAt, patchee.CreatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tupdatedCreatedAt = true\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUpdatedAt && strings.HasPrefix(f, prefix+\"UpdatedAt.\") {\n\t\t\tif patcher.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"UpdatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.UpdatedAt, patchee.UpdatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tupdatedUpdatedAt = true\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func (o CMFAdminMenuSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cmfAdminMenuPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE `cmf_admin_menu` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, cmfAdminMenuPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in cmfAdminMenu slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all cmfAdminMenu\")\n\t}\n\treturn rowsAff, nil\n}", "func (o EmployeeSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), employeePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"employee\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, employeePrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in employee slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all employee\")\n\t}\n\treturn rowsAff, nil\n}", "func (m *SiteItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Siteable, requestConfiguration *SiteItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Siteable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateSiteFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Siteable), nil\n}", "func (t *HeathCare_Chaincode) modifyMedicalData(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tfmt.Println(\"\\n=============== start modifyMedicalData function ===============\")\n\tstart := time.Now()\n\ttime.Sleep(time.Second)\n\n\tvar jsonResp string\n\n\tif len(args) != 8 {\n\t\treturn shim.Error(\"expecting 4 argument\")\n\t}\n\n\t//define identity of query-er and new value of medical record\n\tuserid := args[0]\n\tpatientid := args[1]\n\tlocation := args[2]\n\tcollection := args[3]\n\n\tnewPersonalIdentificationInformation := args[4]\n\tnewMedicalHistory := args[5]\n\tnewFamilyMedicalHistory := args[6]\n\tnewMedicationHistory := args[7]\n\tnewTreatmentHistory := args[8]\n\tnewMedicalDirectives := args[9]\n\ttimeQuery := time.Now().String()\n\n\t//get user identity before query\n\tuserIdentityAsBytes, errUserIdentityAsByte := stub.GetPrivateData(collection, userid)\n\tif errUserIdentityAsByte != nil {\n\t\treturn shim.Error(\"cannot get user identity\")\n\t} else if userIdentityAsBytes == nil {\n\t\treturn shim.Error(\"user does not exist\")\n\t}\n\n\t//create query object with purpose: modify\n\tobjectType := \"Query\"\n\tquery := &Query{objectType, userid, patientid, location, timeQuery, \"modify\"}\n\tqueryAsByte, errQueryAsByte := json.Marshal(query)\n\tif errQueryAsByte != nil {\n\t\treturn shim.Error(errQueryAsByte.Error())\n\t}\n\n\t//save to database\n\terrQueryAsByte = stub.PutPrivateData(\"modifyCollection\", userid, queryAsByte)\n\tif errQueryAsByte != nil {\n\t\treturn shim.Error(errQueryAsByte.Error())\n\t}\n\n\t//create index key\n\tindexName := \"userid~patientid\"\n\tqueryIndexKey, errQueryIndexKey := stub.CreateCompositeKey(indexName, []string{query.UserID, query.PatientID, query.Location, query.Purpose})\n\tif errQueryIndexKey != nil {\n\t\treturn shim.Error(errQueryIndexKey.Error())\n\t}\n\n\t//save index\n\tvalue := []byte{0x00}\n\tstub.PutPrivateData(\"modifyCollection\", queryIndexKey, value)\n\n\t//get medical record data\n\tmedicalRecordAsBytes, errMedicalRecordAsByte := stub.GetPrivateData(\"MedicalRecordCollection\", patientid)\n\tif errMedicalRecordAsByte != nil {\n\t\tjsonResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + patientid + \": \" + errMedicalRecordAsByte.Error() + \"\\\"}\"\n\t\treturn shim.Error(jsonResp)\n\t} else if errMedicalRecordAsByte == nil {\n\t\treturn shim.Error(\"patient's data does not exist\")\n\t}\n\n\t//convert data of patient to json\n\tmedicalRecord := &MedicalRecord{}\n\terrMedicalRecordAsByte = json.Unmarshal(medicalRecordAsBytes, medicalRecord)\n\n\t//change data\n\tmedicalRecord.PersonalIdentificationInformation = newPersonalIdentificationInformation\n\tmedicalRecord.MedicalHistory = newMedicalHistory\n\tmedicalRecord.FamilyMedicalHistory = newFamilyMedicalHistory\n\tmedicalRecord.MedicationHistory = newMedicationHistory\n\tmedicalRecord.TreatmentHistory = newTreatmentHistory\n\tmedicalRecord.MedicalDirectives = newMedicalDirectives\n\n\t//convert new medical record data to byte\n\tnewMedicalRecordAsByte, errNewMedicalRecordAsByte := json.Marshal(medicalRecord)\n\n\t//store new data\n\terrNewMedicalRecordAsByte = stub.PutPrivateData(\"MedicalRecordCollection\", patientid, newMedicalRecordAsByte)\n\tif errNewMedicalRecordAsByte != nil {\n\t\treturn shim.Error(\"cannot save new medical record's data\")\n\t}\n\n\tend := time.Now()\n\telapsed := time.Since(start)\n\tfmt.Println(\"function modifyMedicalData\")\n\tfmt.Println(\"time start: \", start.String())\n\tfmt.Println(\"time end: \", end.String())\n\tfmt.Println(\"time execute: \", elapsed.String())\n\tfmt.Println(\"=============== end modifyMedicalData function ===============\")\n\n\treturn shim.Success(nil)\n}", "func (client ModelClient) PatchClosedListResponder(resp *http.Response) (result OperationStatus, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func (du *DayUpdate) Save(ctx context.Context) (int, error) {\n\n\tvar (\n\t\terr error\n\t\taffected int\n\t)\n\tif len(du.hooks) == 0 {\n\t\taffected, err = du.sqlSave(ctx)\n\t} else {\n\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\tmutation, ok := m.(*DayMutation)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t}\n\t\t\tdu.mutation = mutation\n\t\t\taffected, err = du.sqlSave(ctx)\n\t\t\tmutation.done = true\n\t\t\treturn affected, err\n\t\t})\n\t\tfor i := len(du.hooks) - 1; i >= 0; i-- {\n\t\t\tmut = du.hooks[i](mut)\n\t\t}\n\t\tif _, err := mut.Mutate(ctx, du.mutation); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\treturn affected, err\n}", "func (o WeatherSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"db: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), weatherPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"prh\\\".\\\"weather\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, weatherPrimaryKeyColumns, len(o)))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"db: unable to update all in weather slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"db: unable to retrieve rows affected all in update all weather\")\n\t}\n\treturn rowsAff, nil\n}", "func DefaultStrictUpdatePeriod(ctx context.Context, in *Period, db *gorm.DB) (*Period, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdatePeriod\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &PeriodORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(PeriodORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(PeriodORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(PeriodORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func (a *HyperflexApiService) PatchHyperflexSoftwareDistributionEntry(ctx context.Context, moid string) ApiPatchHyperflexSoftwareDistributionEntryRequest {\n\treturn ApiPatchHyperflexSoftwareDistributionEntryRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func (o PostSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"orm: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), postPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"posts\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, postPrimaryKeyColumns, len(o)))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"orm: unable to update all in post slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"orm: unable to retrieve rows affected all in update all post\")\n\t}\n\treturn rowsAff, nil\n}", "func (a *HyperflexApiService) PatchHyperflexSoftwareDistributionEntryExecute(r ApiPatchHyperflexSoftwareDistributionEntryRequest) (*HyperflexSoftwareDistributionEntry, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodPatch\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *HyperflexSoftwareDistributionEntry\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"HyperflexApiService.PatchHyperflexSoftwareDistributionEntry\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/hyperflex/SoftwareDistributionEntries/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\tif r.hyperflexSoftwareDistributionEntry == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"hyperflexSoftwareDistributionEntry is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\", \"application/json-patch+json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.ifMatch != nil {\n\t\tlocalVarHeaderParams[\"If-Match\"] = parameterToString(*r.ifMatch, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = r.hyperflexSoftwareDistributionEntry\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func batch(lullTime time.Duration, maxTime time.Duration, exists existenceChecker, ch chan notify.EventInfo) *Mod {\n\tadded := make(map[string]bool)\n\tremoved := make(map[string]bool)\n\tchanged := make(map[string]bool)\n\trenamed := make(map[string]bool)\n\t// Have we had a modification in the last lull\n\thadLullMod := false\n\tfor {\n\t\tselect {\n\t\tcase evt := <-ch:\n\t\t\thadLullMod = true\n\t\t\tLogger.SayAs(\"debug\", \"%s\", evt)\n\t\t\tswitch evt.Event() {\n\t\t\tcase notify.Create:\n\t\t\t\tadded[evt.Path()] = true\n\t\t\tcase notify.Remove:\n\t\t\t\tremoved[evt.Path()] = true\n\t\t\tcase notify.Write:\n\t\t\t\tchanged[evt.Path()] = true\n\t\t\tcase notify.Rename:\n\t\t\t\trenamed[evt.Path()] = true\n\t\t\t}\n\t\tcase <-time.After(lullTime):\n\t\t\t// Have we had a lull?\n\t\t\tif hadLullMod == false {\n\t\t\t\treturn mkmod(exists, added, removed, changed, renamed)\n\t\t\t}\n\t\t\thadLullMod = false\n\t\tcase <-time.After(maxTime):\n\t\t\treturn mkmod(exists, added, removed, changed, renamed)\n\t\t}\n\t}\n}", "func (client ReferenceDataSetsClient) UpdateResponder(resp *http.Response) (result ReferenceDataSetResource, 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}", "func (o *RecipeLipid) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\to.UpdatedAt = currTime\n\t}\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\trecipeLipidUpdateCacheMut.RLock()\n\tcache, cached := recipeLipidUpdateCache[key]\n\trecipeLipidUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\trecipeLipidAllColumns,\n\t\t\trecipeLipidPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update recipe_lipid, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"recipe_lipid\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, recipeLipidPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(recipeLipidType, recipeLipidMapping, append(wl, recipeLipidPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update recipe_lipid row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for recipe_lipid\")\n\t}\n\n\tif !cached {\n\t\trecipeLipidUpdateCacheMut.Lock()\n\t\trecipeLipidUpdateCache[key] = cache\n\t\trecipeLipidUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (service *EmployeeService) PatchEmployeeDetails(employeeID string, employeeDetails models.Employee) error {\n\tcollection := service.mongoClient.Database(DbName).Collection(CollectionName)\n\tupdatesToBePerformed := bson.M{}\n\tupdatesToBePerformed[\"employeeid\"] = employeeID\n\tif employeeDetails.Department != nil {\n\t\tupdatesToBePerformed[\"department\"] = employeeDetails.Department\n\t}\n\n\tif employeeDetails.Name != nil {\n\t\tupdatesToBePerformed[\"name\"] = employeeDetails.Name\n\t}\n\n\tif employeeDetails.Skills != nil {\n\t\tupdatesToBePerformed[\"skills\"] = employeeDetails.Skills\n\t}\n\n\tif employeeDetails.Address != nil {\n\t\taddress := models.Address{}\n\t\tif employeeDetails.Address.City != nil {\n\t\t\taddress.City = employeeDetails.Address.City\n\t\t}\n\n\t\tif employeeDetails.Address.Country != nil {\n\t\t\taddress.Country = employeeDetails.Address.Country\n\t\t}\n\n\t\tif employeeDetails.Address.DoorNo != nil {\n\t\t\taddress.DoorNo = employeeDetails.Address.DoorNo\n\t\t}\n\n\t\tif employeeDetails.Address.State != nil {\n\t\t\taddress.State = employeeDetails.Address.State\n\t\t}\n\n\t\tupdatesToBePerformed[\"address\"] = address\n\t}\n\n\tif employeeDetails.Status != nil {\n\t\tupdatesToBePerformed[\"status\"] = employeeDetails.Status\n\t}\n\n\t// consolidatedMap(&updatesToBePerformed, employeeDetails)\n\n\tresult, err := collection.UpdateOne(\n\t\tcontext.Background(),\n\t\tbson.M{\"employeeid\": employeeID},\n\t\tbson.M{\n\t\t\t\"$set\": updatesToBePerformed,\n\t\t})\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tfmt.Println(result)\n\n\treturn nil\n}", "func (m *ReportsRequestBuilder) Patch(ctx context.Context, body i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.Reportsable, requestConfiguration *ReportsRequestBuilderPatchRequestConfiguration)(i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.Reportsable, 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, i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.CreateReportsFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.Reportsable), nil\n}", "func (u *usecase) Update() error {\n\t// Time execution\n\tstart := time.Now()\n\n\t// Creating context with timeout duration process\n\tctx, cancel := context.WithTimeout(context.Background(), 20*time.Minute)\n\tdefer cancel()\n\n\t// Get all archieve from scrapper repository\n\tarchieves, err := u.scrapperRepo.GetAllArchieve()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create array (slice) of archieve object\n\tvar newArchieves []*model.Archieve\n\n\t// Check if archieve is exist in DB\n\tfor _, archieve := range archieves {\n\t\t// Get archieve from DB by archieve code\n\t\t_, err := u.mysqlRepo.GetArchieveByCode(ctx, archieve.Code)\n\n\t\t// if archieve not exist then add to newArchieve array (slice)\n\t\tif err == model.ErrDataNotFound {\n\t\t\t// Add archieve\n\t\t\tnewArchieves = append(newArchieves, archieve)\n\t\t\tlog.Printf(\"New archieve: %v\", archieve.Code)\n\t\t} else if err != nil && err != model.ErrDataNotFound {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Counter new journal from archieves\n\tvar totalNewJournal int\n\n\t// Get new archieves journals\n\tfor _, newArchieve := range newArchieves {\n\t\t// Get all journal from scrapper repository based on archieve\n\t\tjournals, err := u.scrapperRepo.GetAllJournalByArchieveObject(newArchieve)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Append Journals into archieve object\n\t\tnewArchieve.Journals = journals\n\t\ttotalNewJournal += len(newArchieve.Journals)\n\t}\n\n\t// Check if there's new archieve then saved new archieve into DB\n\tif len(newArchieves) > 0 {\n\t\t// Insert new archieves into DB\n\t\tif err := u.mysqlRepo.BatchArchieves(ctx, newArchieves); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlog.Printf(\"Added %v archieve and %v journal (%v)m\", len(newArchieves), totalNewJournal, time.Since(start).Minutes())\n\n\t// if there's no update then do nothing or finish pull data from archieve scrapper\n\treturn nil\n}", "func (o TicketSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), ticketPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"tickets\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, ticketPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in ticket slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all ticket\")\n\t}\n\treturn rowsAff, nil\n}", "func (o CMFBalanceChargeAdminSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cmfBalanceChargeAdminPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE `cmf_balance_charge_admin` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, cmfBalanceChargeAdminPrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in cmfBalanceChargeAdmin slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all cmfBalanceChargeAdmin\")\n\t}\n\treturn rowsAff, nil\n}", "func (q foreignLegalResourceQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for ForeignLegalResources\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for ForeignLegalResources\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (dn *Daemon) updateHypershift(oldConfig, newConfig *mcfgv1.MachineConfig, diff *machineConfigDiff) (retErr error) {\n\toldIgnConfig, err := ctrlcommon.ParseAndConvertConfig(oldConfig.Spec.Config.Raw)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parsing old Ignition config failed: %w\", err)\n\t}\n\tnewIgnConfig, err := ctrlcommon.ParseAndConvertConfig(newConfig.Spec.Config.Raw)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parsing new Ignition config failed: %w\", err)\n\t}\n\n\t// update files on disk that need updating\n\t// We should't skip the certificate write in HyperShift since it does not run the extra daemon process\n\tif err := dn.updateFiles(oldIgnConfig, newIgnConfig, false); err != nil {\n\t\treturn err\n\t}\n\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tif err := dn.updateFiles(newIgnConfig, oldIgnConfig, false); err != nil {\n\t\t\t\terrs := kubeErrs.NewAggregate([]error{err, retErr})\n\t\t\t\tretErr = fmt.Errorf(\"error rolling back files writes: %w\", errs)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tif err := dn.updateSSHKeys(newIgnConfig.Passwd.Users, oldIgnConfig.Passwd.Users); err != nil {\n\t\treturn err\n\t}\n\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tif err := dn.updateSSHKeys(newIgnConfig.Passwd.Users, oldIgnConfig.Passwd.Users); err != nil {\n\t\t\t\terrs := kubeErrs.NewAggregate([]error{err, retErr})\n\t\t\t\tretErr = fmt.Errorf(\"error rolling back SSH keys updates: %w\", errs)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tif dn.os.IsCoreOSVariant() {\n\t\tcoreOSDaemon := CoreOSDaemon{dn}\n\t\tif err := coreOSDaemon.applyOSChanges(*diff, oldConfig, newConfig); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdefer func() {\n\t\t\tif retErr != nil {\n\t\t\t\tif err := coreOSDaemon.applyOSChanges(*diff, newConfig, oldConfig); err != nil {\n\t\t\t\t\terrs := kubeErrs.NewAggregate([]error{err, retErr})\n\t\t\t\t\tretErr = fmt.Errorf(\"error rolling back changes to OS: %w\", errs)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t} else {\n\t\tklog.Info(\"updating the OS on non-CoreOS nodes is not supported\")\n\t}\n\n\tif err := UpdateTuningArgs(KernelTuningFile, CmdLineFile); err != nil {\n\t\treturn err\n\t}\n\n\tklog.Info(\"Successfully completed Hypershift config update\")\n\treturn nil\n}", "func triggerDaemonSetRollout(c client.Client, ds *appsv1.DaemonSet) error {\n\tannotations := map[string]string{}\n\tdscpy := ds.DeepCopy()\n\n\tif dscpy.Spec.Template.Annotations == nil {\n\t\tdscpy.Spec.Template.Annotations = annotations\n\t}\n\tdscpy.Spec.Template.Annotations[\"fileintegrity.openshift.io/restart-\"+fmt.Sprintf(\"%d\", time.Now().Unix())] = \"\"\n\treturn c.Update(context.TODO(), dscpy)\n}", "func (hc *LegacyHealthCheckImpl) updateHealth(ts *LegacyTabletStats, conn queryservice.QueryService) {\n\t// Unconditionally send the received update at the end.\n\tdefer func() {\n\t\tif hc.listener != nil {\n\t\t\thc.listener.StatsUpdate(ts)\n\t\t}\n\t}()\n\n\thc.mu.Lock()\n\tth, ok := hc.addrToHealth[ts.Key]\n\tif !ok {\n\t\t// This can happen on delete because the entry is removed first,\n\t\t// or if LegacyHealthCheckImpl has been closed.\n\t\thc.mu.Unlock()\n\t\treturn\n\t}\n\toldts := th.latestTabletStats\n\tth.latestTabletStats = *ts\n\tth.conn = conn\n\thc.mu.Unlock()\n\n\t// In the case where a tablet changes type (but not for the\n\t// initial message), we want to log it, and maybe advertise it too.\n\tif oldts.Target.TabletType != topodatapb.TabletType_UNKNOWN && oldts.Target.TabletType != ts.Target.TabletType {\n\t\t// Log and maybe notify\n\t\tlog.Infof(\"HealthCheckUpdate(Type Change): %v, tablet: %s, target %+v => %+v, reparent time: %v\",\n\t\t\toldts.Name, topotools.TabletIdent(oldts.Tablet), topotools.TargetIdent(oldts.Target), topotools.TargetIdent(ts.Target), ts.TabletExternallyReparentedTimestamp)\n\t\tif hc.listener != nil && hc.sendDownEvents {\n\t\t\toldts.Up = false\n\t\t\thc.listener.StatsUpdate(&oldts)\n\t\t}\n\n\t\t// Track how often a tablet gets promoted to master. It is used for\n\t\t// comparing against the variables in go/vtgate/buffer/variables.go.\n\t\tif oldts.Target.TabletType != topodatapb.TabletType_MASTER && ts.Target.TabletType == topodatapb.TabletType_MASTER {\n\t\t\thcMasterPromotedCounters.Add([]string{ts.Target.Keyspace, ts.Target.Shard}, 1)\n\t\t}\n\t}\n}", "func (gm *gmap) applyEntries(gmp *gmapProgress, apply *apply) {\n\t// Has entry?\n\tif len(apply.entries) == 0 {\n\t\treturn\n\t}\n\t// Is the node leave the cluster tool long, the latest snapshot is better than the entry.\n\tfirsti := apply.entries[0].Index\n\tif firsti > gmp.appliedi+1 {\n\t\tlogger.Panicf(\"first index of committed entry[%d] should <= appliedi[%d] + 1\", firsti, gmp.appliedi)\n\t}\n\t// Extract useful entries.\n\tvar ents []raftpb.Entry\n\tif gmp.appliedi+1-firsti < uint64(len(apply.entries)) {\n\t\tents = apply.entries[gmp.appliedi+1-firsti:]\n\t}\n\t// Iterate all entries\n\tfor _, e := range ents {\n\t\tswitch e.Type {\n\t\t// Normal entry.\n\t\tcase raftpb.EntryNormal:\n\t\t\tif len(e.Data) != 0 {\n\t\t\t\t// Unmarshal request.\n\t\t\t\tvar req InternalRaftRequest\n\t\t\t\tpbutil.MustUnmarshal(&req, e.Data)\n\n\t\t\t\tvar ar applyResult\n\t\t\t\t// Put new value\n\t\t\t\tif put := req.Put; put != nil {\n\t\t\t\t\t// Get set.\n\t\t\t\t\tset, exist := gm.sets[put.Set]\n\t\t\t\t\tif !exist {\n\t\t\t\t\t\tlogger.Panicf(\"set(%s) is not exist\", put.Set)\n\t\t\t\t\t}\n\t\t\t\t\t// Get key, value and revision.\n\t\t\t\t\tkey, value, revision := put.Key, set.vtype.unwrap(put.Value), e.Index\n\t\t\t\t\t// Get map and put value into map.\n\t\t\t\t\tm := set.get(put.Map)\n\t\t\t\t\tm.put(key, value, revision)\n\t\t\t\t\t// Send put event to watcher\n\t\t\t\t\tevent := MapEvent{Type: PUT, KV: &KeyValue{Key: key, Value: value}}\n\t\t\t\t\tm.watchers.Range(func(key, value interface{}) bool {\n\t\t\t\t\t\tkey.(*watcher).eventc <- event\n\t\t\t\t\t\treturn true\n\t\t\t\t\t})\n\t\t\t\t\t// Set apply result.\n\t\t\t\t\tar.rev = revision\n\t\t\t\t}\n\t\t\t\t// Delete value\n\t\t\t\tif del := req.Delete; del != nil {\n\t\t\t\t\t// Get set.\n\t\t\t\t\tset, exist := gm.sets[del.Set]\n\t\t\t\t\tif !exist {\n\t\t\t\t\t\tlogger.Panicf(\"set(%s) is not exist\", del.Set)\n\t\t\t\t\t}\n\t\t\t\t\t// Get map and delete value from map.\n\t\t\t\t\tm := set.get(del.Map)\n\t\t\t\t\tif pre := m.delete(del.Key); nil != pre {\n\t\t\t\t\t\t// Send put event to watcher\n\t\t\t\t\t\tar.pre = *pre\n\t\t\t\t\t\tevent := MapEvent{Type: DELETE, PrevKV: &KeyValue{Key: del.Key, Value: ar.pre.Value}}\n\t\t\t\t\t\tm.watchers.Range(func(key, value interface{}) bool {\n\t\t\t\t\t\t\tkey.(*watcher).eventc <- event\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Update value\n\t\t\t\tif update := req.Update; update != nil {\n\t\t\t\t\t// Get set.\n\t\t\t\t\tset, exist := gm.sets[update.Set]\n\t\t\t\t\tif !exist {\n\t\t\t\t\t\tlogger.Panicf(\"set(%s) is not exist\", update.Set)\n\t\t\t\t\t}\n\t\t\t\t\t// Get map.\n\t\t\t\t\tm := set.get(update.Map)\n\t\t\t\t\t// Update value.\n\t\t\t\t\tpre, ok := m.update(update.Key, update.Value, update.Revision, e.Index)\n\t\t\t\t\tif ok {\n\t\t\t\t\t\t// The revision will be set only if update succeed\n\t\t\t\t\t\tar.rev = e.Index\n\t\t\t\t\t}\n\t\t\t\t\tif nil != pre {\n\t\t\t\t\t\tar.pre = *pre\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Trigger proposal waiter.\n\t\t\t\tgm.wait.Trigger(req.ID, &ar)\n\t\t\t}\n\t\t// The configuration of gmap is fixed and wil not be synchronized through raft.\n\t\tcase raftpb.EntryConfChange:\n\t\tdefault:\n\t\t\tlogger.Panicf(\"entry type should be either EntryNormal or EntryConfChange\")\n\t\t}\n\n\t\tgmp.appliedi, gmp.appliedt = e.Index, e.Term\n\t}\n}", "func (rc *RecordCollection) applyMethod(methodName string) {\n\tfor _, rec := range rc.Records() {\n\t\tretVal := rec.Call(methodName)\n\t\tdata := retVal.(RecordData).Underlying()\n\t\t// Check if the values actually changed\n\t\tvar doUpdate bool\n\t\tfor f, v := range data.FieldMap {\n\t\t\tif f == \"write_date\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif rs, isRS := rec.Get(rec.model.FieldName(f)).(RecordSet); isRS {\n\t\t\t\tif !rs.Collection().Equals(v.(RecordSet).Collection()) {\n\t\t\t\t\tdoUpdate = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif rec.Get(rec.model.FieldName(f)) != v {\n\t\t\t\tdoUpdate = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif doUpdate {\n\t\t\trec.WithContext(\"hexya_force_compute_write\", true).Call(\"Write\", data)\n\t\t}\n\t}\n}", "func (a *HyperflexApiService) PatchHyperflexHealthCheckDefinitionExecute(r ApiPatchHyperflexHealthCheckDefinitionRequest) (*HyperflexHealthCheckDefinition, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodPatch\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *HyperflexHealthCheckDefinition\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"HyperflexApiService.PatchHyperflexHealthCheckDefinition\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/hyperflex/HealthCheckDefinitions/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\tif r.hyperflexHealthCheckDefinition == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"hyperflexHealthCheckDefinition is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\", \"application/json-patch+json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.ifMatch != nil {\n\t\tlocalVarHeaderParams[\"If-Match\"] = parameterToString(*r.ifMatch, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = r.hyperflexHealthCheckDefinition\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (q currentChartDataMinutelyQuery) UpdateAll(exec boil.Executor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.Exec(exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for current_chart_data_minutely\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for current_chart_data_minutely\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (s *MatcherStore) UpdateEnrichments(ctx context.Context, name string, fp driver.Fingerprint, es []driver.EnrichmentRecord) (uuid.UUID, error) {\n\tconst (\n\t\tcreate = `\nINSERT\nINTO\n\tupdate_operation (updater, fingerprint, kind)\nVALUES\n\t($1, $2, 'enrichment')\nRETURNING\n\tid, ref;`\n\t\tinsert = `\nINSERT\nINTO\n\tenrichment (hash_kind, hash, updater, tags, data)\nVALUES\n\t($1, $2, $3, $4, $5)\nON CONFLICT\n\t(hash_kind, hash)\nDO\n\tNOTHING;`\n\t\tassoc = `\nINSERT\nINTO\n\tuo_enrich (enrich, updater, uo, date)\nVALUES\n\t(\n\t\t(\n\t\t\tSELECT\n\t\t\t\tid\n\t\t\tFROM\n\t\t\t\tenrichment\n\t\t\tWHERE\n\t\t\t\thash_kind = $1\n\t\t\t\tAND hash = $2\n\t\t\t\tAND updater = $3\n\t\t),\n\t\t$3,\n\t\t$4,\n\t\ttransaction_timestamp()\n\t)\nON CONFLICT\nDO\n\tNOTHING;`\n\t\trefreshView = `REFRESH MATERIALIZED VIEW CONCURRENTLY latest_update_operations;`\n\t)\n\tctx = zlog.ContextWithValues(ctx, \"component\", \"datastore/postgres/UpdateEnrichments\")\n\n\tvar id uint64\n\tvar ref uuid.UUID\n\n\tstart := time.Now()\n\n\tif err := s.pool.QueryRow(ctx, create, name, string(fp)).Scan(&id, &ref); err != nil {\n\t\treturn uuid.Nil, fmt.Errorf(\"failed to create update_operation: %w\", err)\n\t}\n\n\tupdateEnrichmentsCounter.WithLabelValues(\"create\").Add(1)\n\tupdateEnrichmentsDuration.WithLabelValues(\"create\").Observe(time.Since(start).Seconds())\n\n\ttx, err := s.pool.Begin(ctx)\n\tif err != nil {\n\t\treturn uuid.Nil, fmt.Errorf(\"unable to start transaction: %w\", err)\n\t}\n\tdefer tx.Rollback(ctx)\n\n\tzlog.Debug(ctx).\n\t\tStr(\"ref\", ref.String()).\n\t\tMsg(\"update_operation created\")\n\n\tbatch := microbatch.NewInsert(tx, 2000, time.Minute)\n\tstart = time.Now()\n\tfor i := range es {\n\t\thashKind, hash := hashEnrichment(&es[i])\n\t\terr := batch.Queue(ctx, insert,\n\t\t\thashKind, hash, name, es[i].Tags, es[i].Enrichment,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn uuid.Nil, fmt.Errorf(\"failed to queue enrichment: %w\", err)\n\t\t}\n\t\tif err := batch.Queue(ctx, assoc, hashKind, hash, name, id); err != nil {\n\t\t\treturn uuid.Nil, fmt.Errorf(\"failed to queue association: %w\", err)\n\t\t}\n\t}\n\tif err := batch.Done(ctx); err != nil {\n\t\treturn uuid.Nil, fmt.Errorf(\"failed to finish batch enrichment insert: %w\", err)\n\t}\n\tupdateEnrichmentsCounter.WithLabelValues(\"insert_batch\").Add(1)\n\tupdateEnrichmentsDuration.WithLabelValues(\"insert_batch\").Observe(time.Since(start).Seconds())\n\n\tif err := tx.Commit(ctx); err != nil {\n\t\treturn uuid.Nil, fmt.Errorf(\"failed to commit transaction: %w\", err)\n\t}\n\tif _, err = s.pool.Exec(ctx, refreshView); err != nil {\n\t\treturn uuid.Nil, fmt.Errorf(\"could not refresh latest_update_operations: %w\", err)\n\t}\n\tzlog.Debug(ctx).\n\t\tStringer(\"ref\", ref).\n\t\tInt(\"inserted\", len(es)).\n\t\tMsg(\"update_operation committed\")\n\treturn ref, nil\n}", "func (m *ManagedTenantsManagedTenantTicketingEndpointsManagedTenantTicketingEndpointItemRequestBuilder) Patch(ctx context.Context, body i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagedTenantTicketingEndpointable, requestConfiguration *ManagedTenantsManagedTenantTicketingEndpointsManagedTenantTicketingEndpointItemRequestBuilderPatchRequestConfiguration)(i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagedTenantTicketingEndpointable, 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, i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.CreateManagedTenantTicketingEndpointFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(i72d786f54cc0bb289c971b085dd642b2fc3af6394328682e69783fd7e229b582.ManagedTenantTicketingEndpointable), nil\n}", "func (m *ItemSitesSiteItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Siteable, requestConfiguration *ItemSitesSiteItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Siteable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateSiteFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Siteable), nil\n}", "func UpdateOrSaveManyEmployeeHours(hours []EmployeeHours) {\n\tfor _, hourSet := range hours {\n\t\tUpdateOrSaveEmployeeHours(hourSet)\n\t}\n}", "func (o IllnessSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), illnessPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"illness\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, illnessPrimaryKeyColumns, len(o)))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in illness slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all illness\")\n\t}\n\treturn rowsAff, nil\n}", "func (m *ItemCalendarViewBookingAppointmentItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.BookingAppointmentable, requestConfiguration *ItemCalendarViewBookingAppointmentItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.BookingAppointmentable, 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.CreateBookingAppointmentFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.BookingAppointmentable), nil\n}", "func (o *Employee) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\temployeeUpdateCacheMut.RLock()\n\tcache, cached := employeeUpdateCache[key]\n\temployeeUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\temployeeAllColumns,\n\t\t\temployeePrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update employee, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"employee\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, employeePrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(employeeType, employeeMapping, append(wl, employeePrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update employee row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for employee\")\n\t}\n\n\tif !cached {\n\t\temployeeUpdateCacheMut.Lock()\n\t\temployeeUpdateCache[key] = cache\n\t\temployeeUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (repo *Repository) Update(ctx context.Context, claims auth.Claims, req UpdateRequest, now time.Time) error {\n\tspan, ctx := tracer.StartSpanFromContext(ctx, \"internal.expenditure.Update\")\n\tdefer span.Finish()\n\n\tif claims.Audience == \"\" {\n\t\treturn errors.WithStack(ErrForbidden)\n\t}\n\t// Admin users can update branches they have access to.\n\tif !claims.HasRole(auth.RoleAdmin) {\n\t\treturn errors.WithStack(ErrForbidden)\n\t}\n\n\t// Validate the request.\n\tv := webcontext.Validator()\n\terr := v.Struct(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcols := models.M{}\n\tif req.Amount != nil {\n\t\tcols[models.RepsExpenseColumns.Amount] = *req.Amount\n\t}\n\tif req.Reason != nil {\n\t\tcols[models.RepsExpenseColumns.Reason] = *req.Reason\n\t}\n\tif len(cols) == 0 {\n\t\treturn nil\n\t}\n\n\t// If now empty set it to the current time.\n\tif now.IsZero() {\n\t\tnow = time.Now()\n\t}\n\n\t// Always store the time as UTC.\n\tnow = now.UTC()\n\t// Postgres truncates times to milliseconds when storing. We and do the same\n\t// here so the value we return is consistent with what we store.\n\tnow = now.Truncate(time.Millisecond)\n\n\tcols[models.BranchColumns.UpdatedAt] = now\n\n\t_, err = models.RepsExpenses(models.RepsExpenseWhere.ID.EQ(req.ID)).UpdateAll(ctx, repo.DbConn, cols)\n\n\treturn nil\n}", "func (m *ItemOnlineMeetingsItemRegistrationRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.MeetingRegistrationable, requestConfiguration *ItemOnlineMeetingsItemRegistrationRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.MeetingRegistrationable, 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.CreateMeetingRegistrationFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.MeetingRegistrationable), nil\n}", "func (k Keeper) UpdateDailyPercent(ctx sdk.Context, addr sdk.AccAddress, coin coins.Coin) {\n\tbalance := k.BankKeeper.GetPosminableBalance(ctx, addr, coin)\n\n\tposmining := k.GetPosmining(ctx, addr, coin)\n\n\tnewDailyPercent := coin.GetDailyPercent(balance)\n\n\tif !posmining.DailyPercent.Equal(newDailyPercent) {\n\t\tposmining.DailyPercent = newDailyPercent\n\n\t\tk.SetPosmining(ctx, posmining, coin)\n\t}\n}", "func (o RentalRowerSlice) UpdateAll(exec boil.Executor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), rentalRowerPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"rental_rowers\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, rentalRowerPrimaryKeyColumns, len(o)))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\tresult, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in rentalRower slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all rentalRower\")\n\t}\n\treturn rowsAff, nil\n}", "func (m *MobileThreatDefenseConnectorsMobileThreatDefenseConnectorItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.MobileThreatDefenseConnectorable, requestConfiguration *MobileThreatDefenseConnectorsMobileThreatDefenseConnectorItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.MobileThreatDefenseConnectorable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateMobileThreatDefenseConnectorFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.MobileThreatDefenseConnectorable), nil\n}", "func (m *TermStoreRequestBuilder) Patch(ctx context.Context, body ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.Storeable, requestConfiguration *TermStoreRequestBuilderPatchRequestConfiguration)(ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.Storeable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.CreateStoreFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ia3c27b33aa3d3ed80f9de797c48fbb8ed73f13887e301daf51f08450e9a634a3.Storeable), nil\n}", "func (m *PrivilegedSignupStatusItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedSignupStatusable, requestConfiguration *PrivilegedSignupStatusItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedSignupStatusable, 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.CreatePrivilegedSignupStatusFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PrivilegedSignupStatusable), nil\n}", "func (m *HealthMenstruationDailyEntry) ToORM(ctx context.Context) (HealthMenstruationDailyEntryORM, error) {\n\tto := HealthMenstruationDailyEntryORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(HealthMenstruationDailyEntryWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tif m.CreatedAt != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.CreatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.CreatedAt = &t\n\t}\n\tif m.UpdatedAt != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.UpdatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.UpdatedAt = &t\n\t}\n\tto.ProfileId = m.ProfileId\n\tif m.Day != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.Day); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Day = &t\n\t}\n\tto.IntensityPercentage = m.IntensityPercentage\n\tto.Type = int32(m.Type)\n\tto.Manual = m.Manual\n\tto.BasedOnPrediction = m.BasedOnPrediction\n\tif posthook, ok := interface{}(m).(HealthMenstruationDailyEntryWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "func (m *ComanagedDevicesItemLogCollectionRequestsDeviceLogCollectionResponseItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.DeviceLogCollectionResponseable, requestConfiguration *ComanagedDevicesItemLogCollectionRequestsDeviceLogCollectionResponseItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.DeviceLogCollectionResponseable, 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.CreateDeviceLogCollectionResponseFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.DeviceLogCollectionResponseable), nil\n}", "func (a *BulkApiService) PatchBulkExportExecute(r ApiPatchBulkExportRequest) (*BulkExport, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodPatch\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *BulkExport\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"BulkApiService.PatchBulkExport\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/bulk/Exports/{Moid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"Moid\"+\"}\", url.PathEscape(parameterToString(r.moid, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\tif r.bulkExport == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"bulkExport is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\", \"application/json-patch+json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.ifMatch != nil {\n\t\tlocalVarHeaderParams[\"If-Match\"] = parameterToString(*r.ifMatch, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = r.bulkExport\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (o *CurrentChartDataMinutely) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no current_chart_data_minutely provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif o.CreatedAt.IsZero() {\n\t\to.CreatedAt = currTime\n\t}\n\to.UpdatedAt = currTime\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(currentChartDataMinutelyColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tcurrentChartDataMinutelyUpsertCacheMut.RLock()\n\tcache, cached := currentChartDataMinutelyUpsertCache[key]\n\tcurrentChartDataMinutelyUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tcurrentChartDataMinutelyColumns,\n\t\t\tcurrentChartDataMinutelyColumnsWithDefault,\n\t\t\tcurrentChartDataMinutelyColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tcurrentChartDataMinutelyColumns,\n\t\t\tcurrentChartDataMinutelyPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert current_chart_data_minutely, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(currentChartDataMinutelyPrimaryKeyColumns))\n\t\t\tcopy(conflict, currentChartDataMinutelyPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"current_chart_data_minutely\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(currentChartDataMinutelyType, currentChartDataMinutelyMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(currentChartDataMinutelyType, currentChartDataMinutelyMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert current_chart_data_minutely\")\n\t}\n\n\tif !cached {\n\t\tcurrentChartDataMinutelyUpsertCacheMut.Lock()\n\t\tcurrentChartDataMinutelyUpsertCache[key] = cache\n\t\tcurrentChartDataMinutelyUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "func (o RowerGroupSlice) UpdateAll(exec boil.Executor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), rowerGroupPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"rower_group\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, rowerGroupPrimaryKeyColumns, len(o)))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\tresult, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in rowerGroup slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all rowerGroup\")\n\t}\n\treturn rowsAff, nil\n}", "func (q rowerGroupQuery) UpdateAll(exec boil.Executor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.Exec(exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for rower_group\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for rower_group\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (client *VirtualMachineScaleSetsClient) ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx context.Context, resourceGroupName string, vmScaleSetName string, platformUpdateDomain int32, options *VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions) (VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse, error) {\n\treq, err := client.forceRecoveryServiceFabricPlatformUpdateDomainWalkCreateRequest(ctx, resourceGroupName, vmScaleSetName, platformUpdateDomain, options)\n\tif err != nil {\n\t\treturn VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{}, err\n\t}\n\tresp, err := client.pl.Do(req)\n\tif err != nil {\n\t\treturn VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{}, err\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK) {\n\t\treturn VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{}, client.forceRecoveryServiceFabricPlatformUpdateDomainWalkHandleError(resp)\n\t}\n\treturn client.forceRecoveryServiceFabricPlatformUpdateDomainWalkHandleResponse(resp)\n}", "func (cc *LogController) Patch(c *gin.Context) {\n\trequest := &LogPatchRequest{}\n\tif err := c.ShouldBindJSON(request); err != nil {\n\t\tjsonAPIError(c, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tif request.Level == \"\" && request.SqlEnabled == nil {\n\t\tjsonAPIError(c, http.StatusBadRequest, fmt.Errorf(\"please set either logLevel or logSql as params in order to set the log level\"))\n\t\treturn\n\t}\n\n\tif request.Level != \"\" {\n\t\tvar ll zapcore.Level\n\t\terr := ll.UnmarshalText([]byte(request.Level))\n\t\tif err != nil {\n\t\t\tjsonAPIError(c, http.StatusBadRequest, err)\n\t\t\treturn\n\t\t}\n\t\tif err = cc.App.GetStore().Config.SetLogLevel(c.Request.Context(), ll.String()); err != nil {\n\t\t\tjsonAPIError(c, http.StatusInternalServerError, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif request.SqlEnabled != nil {\n\t\tif err := cc.App.GetStore().Config.SetLogSQLStatements(c.Request.Context(), *request.SqlEnabled); err != nil {\n\t\t\tjsonAPIError(c, http.StatusInternalServerError, err)\n\t\t\treturn\n\t\t}\n\t\tcc.App.GetStore().SetLogging(*request.SqlEnabled)\n\t}\n\n\t// Set default logger with new configurations\n\tlogger.SetLogger(cc.App.GetStore().Config.CreateProductionLogger())\n\n\tresponse := &presenters.LogResource{\n\t\tJAID: presenters.JAID{\n\t\t\tID: \"log\",\n\t\t},\n\t\tLevel: cc.App.GetStore().Config.LogLevel().String(),\n\t\tSqlEnabled: cc.App.GetStore().Config.LogSQLStatements(),\n\t}\n\n\tjsonAPIResponse(c, response, \"log\")\n}", "func batch(lullTime time.Duration, maxTime time.Duration, exists existenceChecker, ch chan notify.EventInfo) *Mod {\n\tadded := make(map[string]bool)\n\tremoved := make(map[string]bool)\n\tchanged := make(map[string]bool)\n\trenamed := make(map[string]bool)\n\t// Have we had a modification in the last lull\n\thadLullMod := false\n\tfor {\n\t\tselect {\n\t\tcase evt := <-ch:\n\t\t\tif evt == nil {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\thadLullMod = true\n\t\t\tswitch evt.Event() {\n\t\t\tcase notify.Create:\n\t\t\t\tadded[evt.Path()] = true\n\t\t\tcase notify.Remove:\n\t\t\t\tremoved[evt.Path()] = true\n\t\t\tcase notify.Write:\n\t\t\t\tchanged[evt.Path()] = true\n\t\t\tcase notify.Rename:\n\t\t\t\trenamed[evt.Path()] = true\n\t\t\t}\n\t\tcase <-time.After(lullTime):\n\t\t\t// Have we had a lull?\n\t\t\tif hadLullMod == false {\n\t\t\t\tm := mkmod(exists, added, removed, changed, renamed)\n\t\t\t\treturn &m\n\t\t\t}\n\t\t\thadLullMod = false\n\t\tcase <-time.After(maxTime):\n\t\t\tm := mkmod(exists, added, removed, changed, renamed)\n\t\t\treturn &m\n\t\t}\n\t}\n}" ]
[ "0.75062126", "0.7110765", "0.7044403", "0.6352366", "0.584969", "0.58379257", "0.5815472", "0.58114034", "0.58000535", "0.5753678", "0.49336112", "0.49001288", "0.4879783", "0.487446", "0.4820178", "0.48102048", "0.4777965", "0.47738504", "0.47666943", "0.47600615", "0.47389394", "0.4734152", "0.4724264", "0.47007543", "0.46946195", "0.46920747", "0.46747327", "0.4661909", "0.46493888", "0.464884", "0.4647721", "0.46321335", "0.4610523", "0.46010378", "0.45797524", "0.45713025", "0.45692766", "0.45605028", "0.45550182", "0.45506993", "0.45463067", "0.4537918", "0.45369008", "0.45265025", "0.45221362", "0.45211223", "0.4520731", "0.45175555", "0.45084268", "0.4505236", "0.45046702", "0.4501087", "0.44992504", "0.4498412", "0.44894", "0.44848716", "0.44801262", "0.44769648", "0.4463861", "0.44590086", "0.44573662", "0.44572547", "0.44563764", "0.4454831", "0.44538903", "0.4451262", "0.4450918", "0.4448334", "0.44429293", "0.4441626", "0.44328377", "0.44304702", "0.44289806", "0.4428401", "0.44281414", "0.44278616", "0.44249135", "0.4424676", "0.44237927", "0.44231856", "0.44167557", "0.4414446", "0.44099826", "0.44086352", "0.44085276", "0.44058368", "0.4396833", "0.439243", "0.43868697", "0.43859583", "0.43841565", "0.4383061", "0.43717834", "0.4371608", "0.43714094", "0.43707985", "0.4370529", "0.4366893", "0.43649518", "0.4364724" ]
0.755557
0
DefaultApplyFieldMaskHealthMenstruationDailyEntry patches an pbObject with patcher according to a field mask.
DefaultApplyFieldMaskHealthMenstruationDailyEntry применяет патчер к pbObject в соответствии с маской поля.
func DefaultApplyFieldMaskHealthMenstruationDailyEntry(ctx context.Context, patchee *HealthMenstruationDailyEntry, patcher *HealthMenstruationDailyEntry, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) { if patcher == nil { return nil, nil } else if patchee == nil { return nil, errors1.NilArgumentError } var err error for _, f := range updateMask.Paths { if f == prefix+"Id" { patchee.Id = patcher.Id continue } if f == prefix+"CreatedAt" { patchee.CreatedAt = patcher.CreatedAt continue } if f == prefix+"UpdatedAt" { patchee.UpdatedAt = patcher.UpdatedAt continue } if f == prefix+"ProfileId" { patchee.ProfileId = patcher.ProfileId continue } if f == prefix+"Day" { patchee.Day = patcher.Day continue } if f == prefix+"IntensityPercentage" { patchee.IntensityPercentage = patcher.IntensityPercentage continue } if f == prefix+"Type" { patchee.Type = patcher.Type continue } if f == prefix+"Manual" { patchee.Manual = patcher.Manual continue } if f == prefix+"BasedOnPrediction" { patchee.BasedOnPrediction = patcher.BasedOnPrediction continue } } if err != nil { return nil, err } return patchee, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DefaultPatchSetHealthMenstruationDailyEntry(ctx context.Context, objects []*HealthMenstruationDailyEntry, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*HealthMenstruationDailyEntry, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*HealthMenstruationDailyEntry, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchHealthMenstruationDailyEntry(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func DefaultPatchHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj HealthMenstruationDailyEntry\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadHealthMenstruationDailyEntry(ctx, &HealthMenstruationDailyEntry{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskHealthMenstruationDailyEntry(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateHealthMenstruationDailyEntry(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(HealthMenstruationDailyEntryWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func DefaultApplyFieldMaskHealthMenstruationPersonalInfo(ctx context.Context, patchee *HealthMenstruationPersonalInfo, patcher *HealthMenstruationPersonalInfo, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"ProfileId\" {\n\t\t\tpatchee.ProfileId = patcher.ProfileId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"PeriodLengthInDays\" {\n\t\t\tpatchee.PeriodLengthInDays = patcher.PeriodLengthInDays\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CycleLengthInDays\" {\n\t\t\tpatchee.CycleLengthInDays = patcher.CycleLengthInDays\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func DefaultApplyFieldMaskUserInfo(ctx context.Context, patchee *UserInfo, patcher *UserInfo, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*UserInfo, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tvar err error\n\tvar updatedCreatedAt bool\n\tvar updatedUpdatedAt bool\n\tfor i, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UserId\" {\n\t\t\tpatchee.UserId = patcher.UserId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"LastName\" {\n\t\t\tpatchee.LastName = patcher.LastName\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"FirstName\" {\n\t\t\tpatchee.FirstName = patcher.FirstName\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Period\" {\n\t\t\tpatchee.Period = patcher.Period\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"DepartmentId\" {\n\t\t\tpatchee.DepartmentId = patcher.DepartmentId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"JobId\" {\n\t\t\tpatchee.JobId = patcher.JobId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"EnrollmentFlg\" {\n\t\t\tpatchee.EnrollmentFlg = patcher.EnrollmentFlg\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"AdminFlg\" {\n\t\t\tpatchee.AdminFlg = patcher.AdminFlg\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedCreatedAt && strings.HasPrefix(f, prefix+\"CreatedAt.\") {\n\t\t\tif patcher.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"CreatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.CreatedAt, patchee.CreatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tupdatedCreatedAt = true\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUpdatedAt && strings.HasPrefix(f, prefix+\"UpdatedAt.\") {\n\t\t\tif patcher.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"UpdatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.UpdatedAt, patchee.UpdatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tupdatedUpdatedAt = true\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func DefaultApplyFieldMaskPeriod(ctx context.Context, patchee *Period, patcher *Period, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*Period, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tvar err error\n\tvar updatedCreatedAt bool\n\tvar updatedUpdatedAt bool\n\tfor i, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Period\" {\n\t\t\tpatchee.Period = patcher.Period\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedCreatedAt && strings.HasPrefix(f, prefix+\"CreatedAt.\") {\n\t\t\tif patcher.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"CreatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.CreatedAt, patchee.CreatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tupdatedCreatedAt = true\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUpdatedAt && strings.HasPrefix(f, prefix+\"UpdatedAt.\") {\n\t\t\tif patcher.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"UpdatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm1.MergeWithMask(patcher.UpdatedAt, patchee.UpdatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tupdatedUpdatedAt = true\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func DefaultStrictUpdateHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateHealthMenstruationDailyEntry\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &HealthMenstruationDailyEntryORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func DefaultApplyFieldMaskComment(ctx context.Context, patchee *Comment, patcher *Comment, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*Comment, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tvar updatedCreatedAt bool\n\tvar updatedUpdatedAt bool\n\tvar updatedDeletedAt bool\n\tvar updatedBoardId bool\n\tvar updatedPostId bool\n\tvar updatedContentId bool\n\tvar updatedUserid bool\n\tvar updatedUsername bool\n\tvar updatedNickname bool\n\tvar updatedEmail bool\n\tvar updatedPassword bool\n\tvar updatedUrl bool\n\tvar updatedUseHtml bool\n\tvar updatedUseSecret bool\n\tfor i, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedCreatedAt && strings.HasPrefix(f, prefix+\"CreatedAt.\") {\n\t\t\tif patcher.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.CreatedAt == nil {\n\t\t\t\tpatchee.CreatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"CreatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.CreatedAt, patchee.CreatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tupdatedCreatedAt = true\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUpdatedAt && strings.HasPrefix(f, prefix+\"UpdatedAt.\") {\n\t\t\tif patcher.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.UpdatedAt == nil {\n\t\t\t\tpatchee.UpdatedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"UpdatedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.UpdatedAt, patchee.UpdatedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tupdatedUpdatedAt = true\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedDeletedAt && strings.HasPrefix(f, prefix+\"DeletedAt.\") {\n\t\t\tif patcher.DeletedAt == nil {\n\t\t\t\tpatchee.DeletedAt = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.DeletedAt == nil {\n\t\t\t\tpatchee.DeletedAt = &timestamp.Timestamp{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"DeletedAt.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.DeletedAt, patchee.DeletedAt, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"DeletedAt\" {\n\t\t\tupdatedDeletedAt = true\n\t\t\tpatchee.DeletedAt = patcher.DeletedAt\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedBoardId && strings.HasPrefix(f, prefix+\"BoardId.\") {\n\t\t\tif patcher.BoardId == nil {\n\t\t\t\tpatchee.BoardId = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.BoardId == nil {\n\t\t\t\tpatchee.BoardId = &wrappers.StringValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"BoardId.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.BoardId, patchee.BoardId, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"BoardId\" {\n\t\t\tupdatedBoardId = true\n\t\t\tpatchee.BoardId = patcher.BoardId\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedPostId && strings.HasPrefix(f, prefix+\"PostId.\") {\n\t\t\tif patcher.PostId == nil {\n\t\t\t\tpatchee.PostId = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.PostId == nil {\n\t\t\t\tpatchee.PostId = &wrappers.StringValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"PostId.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.PostId, patchee.PostId, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"PostId\" {\n\t\t\tupdatedPostId = true\n\t\t\tpatchee.PostId = patcher.PostId\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedContentId && strings.HasPrefix(f, prefix+\"ContentId.\") {\n\t\t\tif patcher.ContentId == nil {\n\t\t\t\tpatchee.ContentId = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.ContentId == nil {\n\t\t\t\tpatchee.ContentId = &wrappers.StringValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"ContentId.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.ContentId, patchee.ContentId, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"ContentId\" {\n\t\t\tupdatedContentId = true\n\t\t\tpatchee.ContentId = patcher.ContentId\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUserid && strings.HasPrefix(f, prefix+\"Userid.\") {\n\t\t\tif patcher.Userid == nil {\n\t\t\t\tpatchee.Userid = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.Userid == nil {\n\t\t\t\tpatchee.Userid = &wrappers.StringValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"Userid.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.Userid, patchee.Userid, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"Userid\" {\n\t\t\tupdatedUserid = true\n\t\t\tpatchee.Userid = patcher.Userid\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUsername && strings.HasPrefix(f, prefix+\"Username.\") {\n\t\t\tif patcher.Username == nil {\n\t\t\t\tpatchee.Username = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.Username == nil {\n\t\t\t\tpatchee.Username = &wrappers.StringValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"Username.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.Username, patchee.Username, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"Username\" {\n\t\t\tupdatedUsername = true\n\t\t\tpatchee.Username = patcher.Username\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedNickname && strings.HasPrefix(f, prefix+\"Nickname.\") {\n\t\t\tif patcher.Nickname == nil {\n\t\t\t\tpatchee.Nickname = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.Nickname == nil {\n\t\t\t\tpatchee.Nickname = &wrappers.StringValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"Nickname.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.Nickname, patchee.Nickname, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"Nickname\" {\n\t\t\tupdatedNickname = true\n\t\t\tpatchee.Nickname = patcher.Nickname\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedEmail && strings.HasPrefix(f, prefix+\"Email.\") {\n\t\t\tif patcher.Email == nil {\n\t\t\t\tpatchee.Email = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.Email == nil {\n\t\t\t\tpatchee.Email = &wrappers.StringValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"Email.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.Email, patchee.Email, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"Email\" {\n\t\t\tupdatedEmail = true\n\t\t\tpatchee.Email = patcher.Email\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedPassword && strings.HasPrefix(f, prefix+\"Password.\") {\n\t\t\tif patcher.Password == nil {\n\t\t\t\tpatchee.Password = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.Password == nil {\n\t\t\t\tpatchee.Password = &wrappers.StringValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"Password.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.Password, patchee.Password, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"Password\" {\n\t\t\tupdatedPassword = true\n\t\t\tpatchee.Password = patcher.Password\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUrl && strings.HasPrefix(f, prefix+\"Url.\") {\n\t\t\tif patcher.Url == nil {\n\t\t\t\tpatchee.Url = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.Url == nil {\n\t\t\t\tpatchee.Url = &wrappers.StringValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"Url.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.Url, patchee.Url, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"Url\" {\n\t\t\tupdatedUrl = true\n\t\t\tpatchee.Url = patcher.Url\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUseHtml && strings.HasPrefix(f, prefix+\"UseHtml.\") {\n\t\t\tif patcher.UseHtml == nil {\n\t\t\t\tpatchee.UseHtml = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.UseHtml == nil {\n\t\t\t\tpatchee.UseHtml = &wrappers.BoolValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"UseHtml.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.UseHtml, patchee.UseHtml, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"UseHtml\" {\n\t\t\tupdatedUseHtml = true\n\t\t\tpatchee.UseHtml = patcher.UseHtml\n\t\t\tcontinue\n\t\t}\n\t\tif !updatedUseSecret && strings.HasPrefix(f, prefix+\"UseSecret.\") {\n\t\t\tif patcher.UseSecret == nil {\n\t\t\t\tpatchee.UseSecret = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif patchee.UseSecret == nil {\n\t\t\t\tpatchee.UseSecret = &wrappers.BoolValue{}\n\t\t\t}\n\t\t\tchildMask := &field_mask1.FieldMask{}\n\t\t\tfor j := i; j < len(updateMask.Paths); j++ {\n\t\t\t\tif trimPath := strings.TrimPrefix(updateMask.Paths[j], prefix+\"UseSecret.\"); trimPath != updateMask.Paths[j] {\n\t\t\t\t\tchildMask.Paths = append(childMask.Paths, trimPath)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := gorm2.MergeWithMask(patcher.UseSecret, patchee.UseSecret, childMask); err != nil {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\t\tif f == prefix+\"UseSecret\" {\n\t\t\tupdatedUseSecret = true\n\t\t\tpatchee.UseSecret = patcher.UseSecret\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpVoteCount\" {\n\t\t\tpatchee.UpVoteCount = patcher.UpVoteCount\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"DownVoteCount\" {\n\t\t\tpatchee.DownVoteCount = patcher.DownVoteCount\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func DefaultApplyFieldMaskIntPoint(ctx context.Context, patchee *IntPoint, patcher *IntPoint, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*IntPoint, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors.New(\"Patchee inputs to DefaultApplyFieldMaskIntPoint must be non-nil\")\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"X\" {\n\t\t\tpatchee.X = patcher.X\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Y\" {\n\t\t\tpatchee.Y = patcher.Y\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func DefaultPatchSetHealthMenstruationPersonalInfo(ctx context.Context, objects []*HealthMenstruationPersonalInfo, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*HealthMenstruationPersonalInfo, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*HealthMenstruationPersonalInfo, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchHealthMenstruationPersonalInfo(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func DefaultListHealthMenstruationDailyEntry(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*HealthMenstruationDailyEntry, error) {\n\tin := HealthMenstruationDailyEntry{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm2.ApplyCollectionOperators(ctx, db, &HealthMenstruationDailyEntryORM{}, &HealthMenstruationDailyEntry{}, f, s, p, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []HealthMenstruationDailyEntryORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*HealthMenstruationDailyEntry{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func DefaultApplyFieldMaskProfile(ctx context.Context, patchee *Profile, patcher *Profile, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*Profile, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Notes\" {\n\t\t\tpatchee.Notes = patcher.Notes\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"FirstName\" {\n\t\t\tpatchee.FirstName = patcher.FirstName\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"LastName\" {\n\t\t\tpatchee.LastName = patcher.LastName\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"PrimaryEmail\" {\n\t\t\tpatchee.PrimaryEmail = patcher.PrimaryEmail\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Groups\" {\n\t\t\tpatchee.Groups = patcher.Groups\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"ProfilePictureUrl\" {\n\t\t\tpatchee.ProfilePictureUrl = patcher.ProfilePictureUrl\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func DefaultPatchHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj HealthMenstruationPersonalInfo\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadHealthMenstruationPersonalInfo(ctx, &HealthMenstruationPersonalInfo{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskHealthMenstruationPersonalInfo(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationPersonalInfoWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(HealthMenstruationPersonalInfoWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func DefaultCreateHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, 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 hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeCreate_); ok {\n\t\tif db, err = hook.BeforeCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterCreate_); ok {\n\t\tif err = hook.AfterCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultReadHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, 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 == 0 {\n\t\treturn nil, errors1.EmptyIdError\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeReadApplyQuery); ok {\n\t\tif db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &HealthMenstruationDailyEntryORM{}); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeReadFind); ok {\n\t\tif db, err = hook.BeforeReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tormResponse := HealthMenstruationDailyEntryORM{}\n\tif err = db.Where(&ormObj).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormResponse).(HealthMenstruationDailyEntryORMWithAfterReadFind); ok {\n\t\tif err = hook.AfterReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultPatchSetUserInfo(ctx context.Context, objects []*UserInfo, updateMasks []*field_mask.FieldMask, db *gorm.DB) ([]*UserInfo, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*UserInfo, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchUserInfo(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func DefaultPatchSetPeriod(ctx context.Context, objects []*Period, updateMasks []*field_mask.FieldMask, db *gorm.DB) ([]*Period, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*Period, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchPeriod(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func DefaultPatchPeriod(ctx context.Context, in *Period, updateMask *field_mask.FieldMask, db *gorm.DB) (*Period, error) {\n\tif in == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tvar pbObj Period\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(PeriodWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadPeriod(ctx, &Period{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(PeriodWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskPeriod(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(PeriodWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdatePeriod(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(PeriodWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func WithOverrideFieldMask(d *presenceInterceptorOptionsDecorator) {\n\td.overrideFieldMask = true\n}", "func (c *kuberhealthyChecks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result KuberhealthyCheck, err error) {\n\tresult = KuberhealthyCheck{}\n\terr = c.client.Patch(pt).\n\t\tNamespace(c.ns).\n\t\tResource(\"khchecks\").\n\t\tSubResource(subresources...).\n\t\tName(name).\n\t\tBody(data).\n\t\tDo(context.TODO()).\n\t\tInto(&result)\n\treturn\n}", "func (c *globalThreatFeeds) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v3.GlobalThreatFeed, err error) {\n\tresult = &v3.GlobalThreatFeed{}\n\terr = c.client.Patch(pt).\n\t\tResource(\"globalthreatfeeds\").\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}", "func DefaultPatchSetProfile(ctx context.Context, objects []*Profile, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*Profile, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*Profile, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchProfile(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func (m *HealthMenstruationDailyEntryORM) ToPB(ctx context.Context) (HealthMenstruationDailyEntry, error) {\n\tto := HealthMenstruationDailyEntry{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(HealthMenstruationDailyEntryWithBeforeToPB); ok {\n\t\tif err = prehook.BeforeToPB(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tif m.CreatedAt != nil {\n\t\tif to.CreatedAt, err = ptypes1.TimestampProto(*m.CreatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tif m.UpdatedAt != nil {\n\t\tif to.UpdatedAt, err = ptypes1.TimestampProto(*m.UpdatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.ProfileId = m.ProfileId\n\tif m.Day != nil {\n\t\tif to.Day, err = ptypes1.TimestampProto(*m.Day); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.IntensityPercentage = m.IntensityPercentage\n\tto.Type = HealthMenstruationDailyEntry_Type(m.Type)\n\tto.Manual = m.Manual\n\tto.BasedOnPrediction = m.BasedOnPrediction\n\tif posthook, ok := interface{}(m).(HealthMenstruationDailyEntryWithAfterToPB); ok {\n\t\terr = posthook.AfterToPB(ctx, &to)\n\t}\n\treturn to, err\n}", "func DefaultPatchUserInfo(ctx context.Context, in *UserInfo, updateMask *field_mask.FieldMask, db *gorm.DB) (*UserInfo, error) {\n\tif in == nil {\n\t\treturn nil, errors.NilArgumentError\n\t}\n\tvar pbObj UserInfo\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(UserInfoWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadUserInfo(ctx, &UserInfo{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(UserInfoWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskUserInfo(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(UserInfoWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateUserInfo(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(UserInfoWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func (c *Patch) Apply(cp, cd runtime.Object, only ...PatchType) error {\n\tif c.filterPatch(only...) {\n\t\treturn nil\n\t}\n\n\tswitch c.Type {\n\tcase PatchTypeFromCompositeFieldPath:\n\t\treturn c.applyFromFieldPathPatch(cp, cd)\n\tcase PatchTypeToCompositeFieldPath:\n\t\treturn c.applyFromFieldPathPatch(cd, cp)\n\tcase PatchTypeCombineFromComposite:\n\t\treturn c.applyCombineFromVariablesPatch(cp, cd)\n\tcase PatchTypeCombineToComposite:\n\t\treturn c.applyCombineFromVariablesPatch(cd, cp)\n\tcase PatchTypePatchSet:\n\t\t// Already resolved - nothing to do.\n\t}\n\treturn errors.Errorf(errFmtInvalidPatchType, c.Type)\n}", "func (c *PropertiesGoogleAdsLinksPatchCall) UpdateMask(updateMask string) *PropertiesGoogleAdsLinksPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (c *ProjectsLocationsDataExchangesListingsPatchCall) UpdateMask(updateMask string) *ProjectsLocationsDataExchangesListingsPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func NewPatchPrefilterHandler(d *Daemon) PatchPrefilterHandler {\n\treturn &patchPrefilter{d: d}\n}", "func (c *OrganizationsEnvironmentsArchiveDeploymentsPatchCall) UpdateMask(updateMask string) *OrganizationsEnvironmentsArchiveDeploymentsPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func DefaultStrictUpdateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateHealthMenstruationPersonalInfo\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &HealthMenstruationPersonalInfoORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func (m *ThreatSubmissionEmailThreatsEmailThreatSubmissionItemRequestBuilder) Patch(ctx context.Context, body i084fa7ab3bba802bf5cc3b408e230cc64c167a57976e0d42c37e17154afd5b78.EmailThreatSubmissionable, requestConfiguration *ThreatSubmissionEmailThreatsEmailThreatSubmissionItemRequestBuilderPatchRequestConfiguration)(i084fa7ab3bba802bf5cc3b408e230cc64c167a57976e0d42c37e17154afd5b78.EmailThreatSubmissionable, 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, i084fa7ab3bba802bf5cc3b408e230cc64c167a57976e0d42c37e17154afd5b78.CreateEmailThreatSubmissionFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(i084fa7ab3bba802bf5cc3b408e230cc64c167a57976e0d42c37e17154afd5b78.EmailThreatSubmissionable), nil\n}", "func (m *ItemCalendarViewBookingAppointmentItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.BookingAppointmentable, requestConfiguration *ItemCalendarViewBookingAppointmentItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.BookingAppointmentable, 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.CreateBookingAppointmentFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.BookingAppointmentable), nil\n}", "func (m *DeviceManagementSettings) SetDeviceComplianceCheckinThresholdDays(value *int32)() {\n err := m.GetBackingStore().Set(\"deviceComplianceCheckinThresholdDays\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *AssignmentDefaultsRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.EducationAssignmentDefaultsable, requestConfiguration *AssignmentDefaultsRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.EducationAssignmentDefaultsable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateEducationAssignmentDefaultsFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.EducationAssignmentDefaultsable), nil\n}", "func AdjustDay(r []entry.Entry) []entry.Entry {\n\tfor i, _ := range r {\n\t\tr[i].Day = r[i].Day[:10]\n\t}\n\n\treturn r\n}", "func NewPatchReportGroupByIDDefault(code int) *PatchReportGroupByIDDefault {\n\treturn &PatchReportGroupByIDDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (m *AccessReviewHistoryDefinitionItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.AccessReviewHistoryDefinitionable, requestConfiguration *AccessReviewHistoryDefinitionItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.AccessReviewHistoryDefinitionable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateAccessReviewHistoryDefinitionFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.AccessReviewHistoryDefinitionable), nil\n}", "func (m *ReportsRequestBuilder) Patch(ctx context.Context, body i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.Reportsable, requestConfiguration *ReportsRequestBuilderPatchRequestConfiguration)(i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.Reportsable, 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, i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.CreateReportsFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(i43e723cc778f0f3f3a05d36b9df74faa56771e9360d8ed793c50bdaacec8d5d2.Reportsable), nil\n}", "func (c *OrganizationsEnvironmentsTraceConfigOverridesPatchCall) UpdateMask(updateMask string) *OrganizationsEnvironmentsTraceConfigOverridesPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (a *APIPatchingApplicator) Apply(ctx context.Context, o client.Object, ao ...ApplyOption) error {\n\tif o.GetNamespace() == \"\" {\n\t\to.SetNamespace(\"default\")\n\t}\n\n\tm, ok := o.(metav1.Object)\n\tif !ok {\n\t\treturn errors.New(\"cannot access object metadata\")\n\t}\n\n\tif m.GetName() == \"\" && m.GetGenerateName() != \"\" {\n\t\treturn errors.Wrap(a.client.Create(ctx, o), \"cannot create object\")\n\t}\n\n\tdesired := o.DeepCopyObject()\n\n\terr := a.client.Get(ctx, types.NamespacedName{Name: m.GetName(), Namespace: m.GetNamespace()}, o)\n\tif kerrors.IsNotFound(err) {\n\t\t// TODO: Apply ApplyOptions here too?\n\t\treturn errors.Wrap(a.client.Create(ctx, o), \"cannot create object\")\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot get object\")\n\t}\n\n\tfor _, fn := range ao {\n\t\tif err := fn(ctx, o, desired); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// TODO: Allow callers to override the kind of patch used.\n\treturn errors.Wrap(a.client.Patch(ctx, o, &patch{desired.(client.Object)}), \"cannot patch object\")\n}", "func (gm *gmap) applyEntries(gmp *gmapProgress, apply *apply) {\n\t// Has entry?\n\tif len(apply.entries) == 0 {\n\t\treturn\n\t}\n\t// Is the node leave the cluster tool long, the latest snapshot is better than the entry.\n\tfirsti := apply.entries[0].Index\n\tif firsti > gmp.appliedi+1 {\n\t\tlogger.Panicf(\"first index of committed entry[%d] should <= appliedi[%d] + 1\", firsti, gmp.appliedi)\n\t}\n\t// Extract useful entries.\n\tvar ents []raftpb.Entry\n\tif gmp.appliedi+1-firsti < uint64(len(apply.entries)) {\n\t\tents = apply.entries[gmp.appliedi+1-firsti:]\n\t}\n\t// Iterate all entries\n\tfor _, e := range ents {\n\t\tswitch e.Type {\n\t\t// Normal entry.\n\t\tcase raftpb.EntryNormal:\n\t\t\tif len(e.Data) != 0 {\n\t\t\t\t// Unmarshal request.\n\t\t\t\tvar req InternalRaftRequest\n\t\t\t\tpbutil.MustUnmarshal(&req, e.Data)\n\n\t\t\t\tvar ar applyResult\n\t\t\t\t// Put new value\n\t\t\t\tif put := req.Put; put != nil {\n\t\t\t\t\t// Get set.\n\t\t\t\t\tset, exist := gm.sets[put.Set]\n\t\t\t\t\tif !exist {\n\t\t\t\t\t\tlogger.Panicf(\"set(%s) is not exist\", put.Set)\n\t\t\t\t\t}\n\t\t\t\t\t// Get key, value and revision.\n\t\t\t\t\tkey, value, revision := put.Key, set.vtype.unwrap(put.Value), e.Index\n\t\t\t\t\t// Get map and put value into map.\n\t\t\t\t\tm := set.get(put.Map)\n\t\t\t\t\tm.put(key, value, revision)\n\t\t\t\t\t// Send put event to watcher\n\t\t\t\t\tevent := MapEvent{Type: PUT, KV: &KeyValue{Key: key, Value: value}}\n\t\t\t\t\tm.watchers.Range(func(key, value interface{}) bool {\n\t\t\t\t\t\tkey.(*watcher).eventc <- event\n\t\t\t\t\t\treturn true\n\t\t\t\t\t})\n\t\t\t\t\t// Set apply result.\n\t\t\t\t\tar.rev = revision\n\t\t\t\t}\n\t\t\t\t// Delete value\n\t\t\t\tif del := req.Delete; del != nil {\n\t\t\t\t\t// Get set.\n\t\t\t\t\tset, exist := gm.sets[del.Set]\n\t\t\t\t\tif !exist {\n\t\t\t\t\t\tlogger.Panicf(\"set(%s) is not exist\", del.Set)\n\t\t\t\t\t}\n\t\t\t\t\t// Get map and delete value from map.\n\t\t\t\t\tm := set.get(del.Map)\n\t\t\t\t\tif pre := m.delete(del.Key); nil != pre {\n\t\t\t\t\t\t// Send put event to watcher\n\t\t\t\t\t\tar.pre = *pre\n\t\t\t\t\t\tevent := MapEvent{Type: DELETE, PrevKV: &KeyValue{Key: del.Key, Value: ar.pre.Value}}\n\t\t\t\t\t\tm.watchers.Range(func(key, value interface{}) bool {\n\t\t\t\t\t\t\tkey.(*watcher).eventc <- event\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Update value\n\t\t\t\tif update := req.Update; update != nil {\n\t\t\t\t\t// Get set.\n\t\t\t\t\tset, exist := gm.sets[update.Set]\n\t\t\t\t\tif !exist {\n\t\t\t\t\t\tlogger.Panicf(\"set(%s) is not exist\", update.Set)\n\t\t\t\t\t}\n\t\t\t\t\t// Get map.\n\t\t\t\t\tm := set.get(update.Map)\n\t\t\t\t\t// Update value.\n\t\t\t\t\tpre, ok := m.update(update.Key, update.Value, update.Revision, e.Index)\n\t\t\t\t\tif ok {\n\t\t\t\t\t\t// The revision will be set only if update succeed\n\t\t\t\t\t\tar.rev = e.Index\n\t\t\t\t\t}\n\t\t\t\t\tif nil != pre {\n\t\t\t\t\t\tar.pre = *pre\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Trigger proposal waiter.\n\t\t\t\tgm.wait.Trigger(req.ID, &ar)\n\t\t\t}\n\t\t// The configuration of gmap is fixed and wil not be synchronized through raft.\n\t\tcase raftpb.EntryConfChange:\n\t\tdefault:\n\t\t\tlogger.Panicf(\"entry type should be either EntryNormal or EntryConfChange\")\n\t\t}\n\n\t\tgmp.appliedi, gmp.appliedt = e.Index, e.Term\n\t}\n}", "func (m *ItemItemsItemWorkbookWorksheetsItemChartsItemDataLabelsFormatRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.WorkbookChartDataLabelFormatable, requestConfiguration *ItemItemsItemWorkbookWorksheetsItemChartsItemDataLabelsFormatRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.WorkbookChartDataLabelFormatable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateWorkbookChartDataLabelFormatFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.WorkbookChartDataLabelFormatable), nil\n}", "func (c *ProjectsPatchDeploymentsPatchCall) UpdateMask(updateMask string) *ProjectsPatchDeploymentsPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (c *PropertiesIosAppDataStreamsPatchCall) UpdateMask(updateMask string) *PropertiesIosAppDataStreamsPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func TestFieldMaskFromRequestBodyWithDescriptor(t *testing.T) {\n\tif testing.Short() {\n\t\tt.Skip()\n\t\treturn\n\t}\n\n\t_, md := descriptor.ForMessage(new(examplepb.NonStandardMessage))\n\tjsonInput := `{\"id\":\"foo\", \"thing\":{\"subThing\":{\"sub_value\":\"bar\"}}}`\n\texpected := newFieldMask(\"id\", \"thing.subThing.sub_value\")\n\n\tactual, err := runtime.FieldMaskFromRequestBody(bytes.NewReader([]byte(jsonInput)), md)\n\tif !fieldMasksEqual(actual, expected) {\n\t\tt.Errorf(\"want %v; got %v\", fieldMaskString(expected), fieldMaskString(actual))\n\t}\n\tif err != nil {\n\t\tt.Errorf(\"err %v\", err)\n\t}\n}", "func (c *AppsModulesPatchCall) Mask(mask string) *AppsModulesPatchCall {\n\tc.urlParams_.Set(\"mask\", mask)\n\treturn c\n}", "func patch(newObj runtime.Object, existingObj runtime.Object, c client.Client) error {\n\tnewObjJSON, _ := apijson.Marshal(newObj)\n\tkey, _ := client.ObjectKeyFromObject(newObj)\n\t_, isUnstructured := newObj.(runtime.Unstructured)\n\t_, isCRD := newObj.(*apiextv1beta1.CustomResourceDefinition)\n\n\tif isUnstructured || isCRD || isKudoType(newObj) {\n\t\t// strategic merge patch is not supported for these types, falling back to merge patch\n\t\terr := c.Patch(context.TODO(), newObj, client.ConstantPatch(types.MergePatchType, newObjJSON))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to apply merge patch to object %s/%s: %w\", key.Name, key.Name, err)\n\t\t}\n\t} else {\n\t\terr := c.Patch(context.TODO(), existingObj, client.ConstantPatch(types.StrategicMergePatchType, newObjJSON))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to apply StrategicMergePatch to object %s/%s: %w\", key.Namespace, key.Name, err)\n\t\t}\n\t}\n\treturn nil\n}", "func Apply(data []byte, x interface{}) error {\n\trx := reflect.ValueOf(x)\n\tif rx.Kind() != reflect.Ptr || rx.IsNil() {\n\t\treturn ErrNonPointer\n\t}\n\n\tvar patches []Patch\n\terr := json.Unmarshal(data, &patches)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\try := reflect.New(rx.Elem().Type())\n\t// I am making a copy of the interface so that when an\n\t// error arises while performing one of the patches the\n\t// original data structure does not get altered.\n\terr = deep.Copy(x, ry.Interface())\n\tif err != nil {\n\t\treturn ErrCouldNotCopy\n\t}\n\n\tfor _, p := range patches {\n\t\tpath := strings.Trim(p.Path, \"/\")\n\t\terr := rapply(path, &p, ry)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\trx.Elem().Set(ry.Elem())\n\treturn nil\n}", "func NewPatchRecipientGroupByIDDefault(code int) *PatchRecipientGroupByIDDefault {\n\treturn &PatchRecipientGroupByIDDefault{\n\t\t_statusCode: code,\n\t}\n}", "func getDaemonSetPatch(ds *appsv1.DaemonSet) ([]byte, error) {\n\tdsBytes, err := json.Marshal(ds)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar raw map[string]interface{}\n\terr = json.Unmarshal(dsBytes, &raw)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tobjCopy := make(map[string]interface{})\n\tspecCopy := make(map[string]interface{})\n\n\t// Create a patch of the DaemonSet that replaces spec.template\n\tspec := raw[\"spec\"].(map[string]interface{})\n\ttemplate := spec[\"template\"].(map[string]interface{})\n\tspecCopy[\"template\"] = template\n\ttemplate[\"$patch\"] = \"replace\"\n\tobjCopy[\"spec\"] = specCopy\n\tpatch, err := json.Marshal(objCopy)\n\treturn patch, err\n}", "func NewDcimDeviceTypesPartialUpdateDefault(code int) *DcimDeviceTypesPartialUpdateDefault {\n\treturn &DcimDeviceTypesPartialUpdateDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (fieldMask UpdateAlertingPolicyRequest_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (m *TermsAndConditionsItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TermsAndConditionsable, requestConfiguration *TermsAndConditionsItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TermsAndConditionsable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateTermsAndConditionsFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TermsAndConditionsable), nil\n}", "func (c *PropertiesAndroidAppDataStreamsPatchCall) UpdateMask(updateMask string) *PropertiesAndroidAppDataStreamsPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (m MarketDataSnapshotFullRefresh) SetMaturityDay(v int) {\n\tm.Set(field.NewMaturityDay(v))\n}", "func createDaemonSetPatch(daemonSet *appsv1.DaemonSet, labels map[string]string, annotations map[string]string) ([]byte, error) {\n\tvar patch []k8s.PatchOperation\n\tpatch = append(patch, k8s.GenerateSpecTemplateAnnotationPatch(daemonSet.Spec.Template.Annotations, annotations)...)\n\tpatch = append(patch, k8s.GenerateMetadataLabelsPatch(daemonSet.Labels, labels)...)\n\treturn json.Marshal(patch)\n}", "func (m *DirectoryRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RbacApplicationable, requestConfiguration *DirectoryRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RbacApplicationable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateRbacApplicationFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.RbacApplicationable), nil\n}", "func (m *ExactMatchDataStoresExactMatchDataStoreItemRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ExactMatchDataStoreable, requestConfiguration *ExactMatchDataStoresExactMatchDataStoreItemRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ExactMatchDataStoreable, 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.CreateExactMatchDataStoreFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ExactMatchDataStoreable), nil\n}", "func (a *HyperflexApiService) PatchHyperflexHealthCheckDefinition(ctx context.Context, moid string) ApiPatchHyperflexHealthCheckDefinitionRequest {\n\treturn ApiPatchHyperflexHealthCheckDefinitionRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func (c *PropertiesIosAppDataStreamsMeasurementProtocolSecretsPatchCall) UpdateMask(updateMask string) *PropertiesIosAppDataStreamsMeasurementProtocolSecretsPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (c *OrganizationsEnvironmentsModifyEnvironmentCall) UpdateMask(updateMask string) *OrganizationsEnvironmentsModifyEnvironmentCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (m *TeamsAppSettingsRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TeamsAppSettingsable, requestConfiguration *TeamsAppSettingsRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TeamsAppSettingsable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateTeamsAppSettingsFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.TeamsAppSettingsable), nil\n}", "func ApplyPatch(obj Obj, patches []JSONPatchOp) (Obj, error) {\n\tfor _, patch := range patches {\n\t\tval, ok := patch.Value.(float64)\n\t\tif !ok {\n\t\t\treturn Obj{}, fmt.Errorf(\"unsupported value for path '\"+patch.Path+\"': %T\", patch.Value)\n\t\t}\n\n\t\tpath := strings.Split(patch.Path, \"/\")\n\t\tif len(path) != 4 {\n\t\t\treturn Obj{}, fmt.Errorf(\"unsupported patch path for Obj, expected 4 parts: '%v' got '%+v'\", patch.Path, path)\n\t\t}\n\t\tpath = path[1:] // remove initial empty /\n\t\tif path[0] == \"foo-a\" {\n\t\t\tif path[1] == \"bar-a\" {\n\t\t\t\tif path[2] == \"baz-a\" {\n\t\t\t\t\tobj.FooA.BarA.BazA = int64(val)\n\t\t\t\t} else if path[2] == \"baz-b\" {\n\t\t\t\t\tobj.FooA.BarA.BazB = int64(val)\n\t\t\t\t} else {\n\t\t\t\t\treturn Obj{}, errors.New(\"unsupported patch path for Obj, unsupported part: '\" + path[2] + \"' in '\" + patch.Path + \"'\")\n\t\t\t\t}\n\t\t\t} else if path[1] == \"bar-b\" {\n\t\t\t\tif path[2] == \"baz-a\" {\n\t\t\t\t\tobj.FooA.BarB.BazA = int64(val)\n\t\t\t\t} else if path[2] == \"baz-b\" {\n\t\t\t\t\tobj.FooA.BarB.BazB = int64(val)\n\t\t\t\t} else {\n\t\t\t\t\treturn Obj{}, errors.New(\"unsupported patch path for Obj, unsupported part: '\" + path[2] + \"' in '\" + patch.Path + \"'\")\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn Obj{}, errors.New(\"unsupported patch path for Obj, unsupported part: '\" + path[1] + \"' in '\" + patch.Path + \"'\")\n\t\t\t}\n\t\t} else if path[0] == \"foo-b\" {\n\t\t\tif path[1] == \"bar-a\" {\n\t\t\t\tif path[2] == \"baz-a\" {\n\t\t\t\t\tobj.FooB.BarA.BazA = int64(val)\n\t\t\t\t} else if path[2] == \"baz-b\" {\n\t\t\t\t\tobj.FooB.BarA.BazB = int64(val)\n\t\t\t\t} else {\n\t\t\t\t\treturn Obj{}, errors.New(\"unsupported patch path for Obj, unsupported part: '\" + path[2] + \"' in '\" + patch.Path + \"'\")\n\t\t\t\t}\n\t\t\t} else if path[1] == \"bar-b\" {\n\t\t\t\tif path[2] == \"baz-a\" {\n\t\t\t\t\tobj.FooB.BarB.BazA = int64(val)\n\t\t\t\t} else if path[2] == \"baz-b\" {\n\t\t\t\t\tobj.FooB.BarB.BazB = int64(val)\n\t\t\t\t} else {\n\t\t\t\t\treturn Obj{}, errors.New(\"unsupported patch path for Obj, unsupported part: '\" + path[2] + \"' in '\" + patch.Path + \"'\")\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn Obj{}, errors.New(\"unsupported patch path for Obj, unsupported part: '\" + path[1] + \"' in '\" + patch.Path + \"'\")\n\t\t\t}\n\t\t} else {\n\t\t\treturn Obj{}, errors.New(\"unsupported patch path for Obj, unsupported part: '\" + path[0] + \"' in '\" + patch.Path + \"'\")\n\t\t}\n\t}\n\treturn obj, nil\n}", "func (c *PropertiesCustomDimensionsPatchCall) UpdateMask(updateMask string) *PropertiesCustomDimensionsPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (m *TeamworkRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.UserTeamworkable, requestConfiguration *TeamworkRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.UserTeamworkable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateUserTeamworkFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.UserTeamworkable), nil\n}", "func (c *OrganizationsDatacollectorsPatchCall) UpdateMask(updateMask string) *OrganizationsDatacollectorsPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (fieldMask GetMonitoredResourceDescriptorRequest_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func NewUpdateHookDefault(code int) *UpdateHookDefault {\n\treturn &UpdateHookDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (fieldMask CreateAlertingPolicyRequest_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (c *cronFederatedHPAs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.CronFederatedHPA, err error) {\n\tresult = &v1alpha1.CronFederatedHPA{}\n\terr = c.client.Patch(pt).\n\t\tNamespace(c.ns).\n\t\tResource(\"cronfederatedhpas\").\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}", "func (fieldMask GetAlertingPolicyRequest_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (c *OrganizationsEnvgroupsPatchCall) UpdateMask(updateMask string) *OrganizationsEnvgroupsPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (uuo *UserUpdateOne) SetNillableBirthday(t *time.Time) *UserUpdateOne {\n\tif t != nil {\n\t\tuuo.SetBirthday(*t)\n\t}\n\treturn uuo\n}", "func (c *DatasetsPatchCall) UpdateMask(updateMask string) *DatasetsPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (fieldMask WatchAlertingPolicyResponse_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (fieldMask DeleteAlertingPolicyRequest_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (c *ProjectsLocationsJobsPatchCall) UpdateMask(updateMask string) *ProjectsLocationsJobsPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (c *ProjectsLocationsMigrationJobsPatchCall) UpdateMask(updateMask string) *ProjectsLocationsMigrationJobsPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (m *ConditionalAccessRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConditionalAccessRootable, requestConfiguration *ConditionalAccessRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConditionalAccessRootable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateConditionalAccessRootFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConditionalAccessRootable), nil\n}", "func (o *PartialUpdateAppDefault) WithPayload(payload *models.Error) *PartialUpdateAppDefault {\n\to.Payload = payload\n\treturn o\n}", "func (c *ProjectsLocationsDataExchangesPatchCall) UpdateMask(updateMask string) *ProjectsLocationsDataExchangesPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (fieldMask WatchAlertingPolicyRequest_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (m *ItemInsightsTrendingTrendingItemRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Trendingable, requestConfiguration *ItemInsightsTrendingTrendingItemRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Trendingable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateTrendingFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Trendingable), nil\n}", "func (a *BulkApiService) PatchBulkExport(ctx context.Context, moid string) ApiPatchBulkExportRequest {\n\treturn ApiPatchBulkExportRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func RecoverableDays(days int) ChangeOption {\n\treturn changeOption{\n\t\tapplier: applierFunc(\n\t\t\tfunc(caller caller, co interface{}) {\n\t\t\t\tco.(*secret.UpdateSetRequest).Attributes.RecoverableDays = days\n\t\t\t},\n\t\t),\n\t}\n}", "func (m *IosUpdateConfiguration) SetScheduledInstallDays(value []DayOfWeek)() {\n err := m.GetBackingStore().Set(\"scheduledInstallDays\", value)\n if err != nil {\n panic(err)\n }\n}", "func (c *OrganizationsEnvironmentsUpdateDebugmaskCall) UpdateMask(updateMask string) *OrganizationsEnvironmentsUpdateDebugmaskCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (m *ShiftPreferencesRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ShiftPreferencesable, requestConfiguration *ShiftPreferencesRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ShiftPreferencesable, error) {\n requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateShiftPreferencesFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ShiftPreferencesable), nil\n}", "func (m *RecurrencePattern) SetDaysOfWeek(value []DayOfWeek)() {\n m.daysOfWeek = value\n}", "func (c *CallsetsPatchCall) UpdateMask(updateMask string) *CallsetsPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (a *HyperflexApiService) PatchHyperflexSoftwareDistributionEntry(ctx context.Context, moid string) ApiPatchHyperflexSoftwareDistributionEntryRequest {\n\treturn ApiPatchHyperflexSoftwareDistributionEntryRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func FieldMask(paths ...string) *fieldmaskpb.FieldMask {\n\treturn &fieldmaskpb.FieldMask{Paths: paths}\n}", "func DefaultPatchSetComment(ctx context.Context, objects []*Comment, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*Comment, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*Comment, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchComment(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func (m *TeamsAppsItemAppDefinitionsItemOutlineIconRequestBuilder) Patch(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.TeamsAppIconable, requestConfiguration *TeamsAppsItemAppDefinitionsItemOutlineIconRequestBuilderPatchRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.TeamsAppIconable, 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.CreateTeamsAppIconFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.TeamsAppIconable), nil\n}", "func (m *ConditionalAccessRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConditionalAccessRootable, requestConfiguration *ConditionalAccessRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConditionalAccessRootable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateConditionalAccessRootFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConditionalAccessRootable), nil\n}", "func (m *ConditionalAccessRequestBuilder) Patch(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConditionalAccessRootable, requestConfiguration *ConditionalAccessRequestBuilderPatchRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConditionalAccessRootable, error) {\n requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateConditionalAccessRootFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ConditionalAccessRootable), nil\n}", "func (c *ProjectsTraceSinksPatchCall) UpdateMask(updateMask string) *ProjectsTraceSinksPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (c *ProjectsLocationsProcessesRunsPatchCall) UpdateMask(updateMask string) *ProjectsLocationsProcessesRunsPatchCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}", "func (fieldMask BatchGetAlertingPoliciesResponse_FieldMask) Marshal() ([]byte, error) {\n\tprotoFieldMask := fieldMask.ToProtoFieldMask()\n\treturn proto.Marshal(protoFieldMask)\n}", "func (o *Entry) Defaults() {\n\tif o.StaticDist == 0 {\n\t\to.StaticDist = 10\n\t}\n\n\tif o.StaticIpv6Dist == 0 {\n\t\to.StaticIpv6Dist = 10\n\t}\n\n\tif o.OspfIntDist == 0 {\n\t\to.OspfIntDist = 30\n\t}\n\n\tif o.OspfExtDist == 0 {\n\t\to.OspfExtDist = 110\n\t}\n\n\tif o.Ospfv3IntDist == 0 {\n\t\to.Ospfv3IntDist = 30\n\t}\n\n\tif o.Ospfv3ExtDist == 0 {\n\t\to.Ospfv3ExtDist = 110\n\t}\n\n\tif o.IbgpDist == 0 {\n\t\to.IbgpDist = 200\n\t}\n\n\tif o.EbgpDist == 0 {\n\t\to.EbgpDist = 20\n\t}\n\n\tif o.RipDist == 0 {\n\t\to.RipDist = 120\n\t}\n}", "func (c *OrganizationsEnvironmentsUpdateTraceConfigCall) UpdateMask(updateMask string) *OrganizationsEnvironmentsUpdateTraceConfigCall {\n\tc.urlParams_.Set(\"updateMask\", updateMask)\n\treturn c\n}" ]
[ "0.7373707", "0.70680124", "0.67444634", "0.6065729", "0.5949686", "0.57163745", "0.5495746", "0.54638475", "0.5452421", "0.5412164", "0.5399574", "0.53054893", "0.52838326", "0.5168645", "0.505817", "0.5040415", "0.46125427", "0.46034554", "0.45514354", "0.4538858", "0.4502264", "0.44303185", "0.44222853", "0.43890834", "0.4327707", "0.42894992", "0.4249346", "0.42491034", "0.4232841", "0.42259347", "0.42160445", "0.4205205", "0.41704565", "0.41552547", "0.41415796", "0.41408935", "0.4131638", "0.41265815", "0.41173407", "0.4114604", "0.41086847", "0.40980873", "0.40917414", "0.40908507", "0.40793622", "0.40781406", "0.40770796", "0.40672734", "0.40592182", "0.40541607", "0.40463343", "0.4044323", "0.4042283", "0.40394586", "0.40377626", "0.40320665", "0.40314558", "0.40218028", "0.4013938", "0.40122122", "0.40104523", "0.39925653", "0.39886916", "0.39871868", "0.39835328", "0.3982232", "0.39807203", "0.39616558", "0.3960067", "0.39508188", "0.39500415", "0.39384842", "0.39365974", "0.39321277", "0.39295983", "0.3928867", "0.3926021", "0.39239496", "0.3921769", "0.39160413", "0.39126498", "0.39115882", "0.39109933", "0.39096108", "0.3908955", "0.3905882", "0.39042652", "0.39032394", "0.39002705", "0.38990647", "0.3895892", "0.38955465", "0.38954479", "0.38941365", "0.38938013", "0.38934338", "0.38933262", "0.38908273", "0.388737", "0.3885464" ]
0.8058049
0
DefaultListHealthMenstruationDailyEntry executes a gorm list call
DefaultListHealthMenstruationDailyEntry выполняет вызов gorm list
func DefaultListHealthMenstruationDailyEntry(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*HealthMenstruationDailyEntry, error) { in := HealthMenstruationDailyEntry{} ormObj, err := in.ToORM(ctx) if err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeListApplyQuery); ok { if db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil { return nil, err } } db, err = gorm2.ApplyCollectionOperators(ctx, db, &HealthMenstruationDailyEntryORM{}, &HealthMenstruationDailyEntry{}, f, s, p, fs) if err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeListFind); ok { if db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil { return nil, err } } db = db.Where(&ormObj) db = db.Order("id") ormResponse := []HealthMenstruationDailyEntryORM{} if err := db.Find(&ormResponse).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterListFind); ok { if err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil { return nil, err } } pbResponse := []*HealthMenstruationDailyEntry{} for _, responseEntry := range ormResponse { temp, err := responseEntry.ToPB(ctx) if err != nil { return nil, err } pbResponse = append(pbResponse, &temp) } return pbResponse, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DefaultReadHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, 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 == 0 {\n\t\treturn nil, errors1.EmptyIdError\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeReadApplyQuery); ok {\n\t\tif db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &HealthMenstruationDailyEntryORM{}); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeReadFind); ok {\n\t\tif db, err = hook.BeforeReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tormResponse := HealthMenstruationDailyEntryORM{}\n\tif err = db.Where(&ormObj).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormResponse).(HealthMenstruationDailyEntryORMWithAfterReadFind); ok {\n\t\tif err = hook.AfterReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultListHealthMenstruationPersonalInfo(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*HealthMenstruationPersonalInfo, error) {\n\tin := HealthMenstruationPersonalInfo{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm2.ApplyCollectionOperators(ctx, db, &HealthMenstruationPersonalInfoORM{}, &HealthMenstruationPersonalInfo{}, f, s, p, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []HealthMenstruationPersonalInfoORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*HealthMenstruationPersonalInfo{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func DefaultCreateHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, 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 hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeCreate_); ok {\n\t\tif db, err = hook.BeforeCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterCreate_); ok {\n\t\tif err = hook.AfterCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func DefaultPatchSetHealthMenstruationDailyEntry(ctx context.Context, objects []*HealthMenstruationDailyEntry, updateMasks []*field_mask1.FieldMask, db *gorm1.DB) ([]*HealthMenstruationDailyEntry, error) {\n\tif len(objects) != len(updateMasks) {\n\t\treturn nil, fmt.Errorf(errors1.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects))\n\t}\n\n\tresults := make([]*HealthMenstruationDailyEntry, 0, len(objects))\n\tfor i, patcher := range objects {\n\t\tpbResponse, err := DefaultPatchHealthMenstruationDailyEntry(ctx, patcher, updateMasks[i], db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, pbResponse)\n\t}\n\n\treturn results, nil\n}", "func DefaultPatchHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, updateMask *field_mask1.FieldMask, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif in == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar pbObj HealthMenstruationDailyEntry\n\tvar err error\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchRead); ok {\n\t\tif db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbReadRes, err := DefaultReadHealthMenstruationDailyEntry(ctx, &HealthMenstruationDailyEntry{Id: in.GetId()}, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpbObj = *pbReadRes\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchApplyFieldMask); ok {\n\t\tif db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := DefaultApplyFieldMaskHealthMenstruationDailyEntry(ctx, &pbObj, in, updateMask, \"\", db); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&pbObj).(HealthMenstruationDailyEntryWithBeforePatchSave); ok {\n\t\tif db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := DefaultStrictUpdateHealthMenstruationDailyEntry(ctx, &pbObj, db)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(pbResponse).(HealthMenstruationDailyEntryWithAfterPatchSave); ok {\n\t\tif err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn pbResponse, nil\n}", "func DefaultApplyFieldMaskHealthMenstruationDailyEntry(ctx context.Context, patchee *HealthMenstruationDailyEntry, patcher *HealthMenstruationDailyEntry, updateMask *field_mask1.FieldMask, prefix string, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif patcher == nil {\n\t\treturn nil, nil\n\t} else if patchee == nil {\n\t\treturn nil, errors1.NilArgumentError\n\t}\n\tvar err error\n\tfor _, f := range updateMask.Paths {\n\t\tif f == prefix+\"Id\" {\n\t\t\tpatchee.Id = patcher.Id\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"CreatedAt\" {\n\t\t\tpatchee.CreatedAt = patcher.CreatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"UpdatedAt\" {\n\t\t\tpatchee.UpdatedAt = patcher.UpdatedAt\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"ProfileId\" {\n\t\t\tpatchee.ProfileId = patcher.ProfileId\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Day\" {\n\t\t\tpatchee.Day = patcher.Day\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"IntensityPercentage\" {\n\t\t\tpatchee.IntensityPercentage = patcher.IntensityPercentage\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Type\" {\n\t\t\tpatchee.Type = patcher.Type\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"Manual\" {\n\t\t\tpatchee.Manual = patcher.Manual\n\t\t\tcontinue\n\t\t}\n\t\tif f == prefix+\"BasedOnPrediction\" {\n\t\t\tpatchee.BasedOnPrediction = patcher.BasedOnPrediction\n\t\t\tcontinue\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn patchee, nil\n}", "func DefaultStrictUpdateHealthMenstruationDailyEntry(ctx context.Context, in *HealthMenstruationDailyEntry, db *gorm1.DB) (*HealthMenstruationDailyEntry, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"Nil argument to DefaultStrictUpdateHealthMenstruationDailyEntry\")\n\t}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlockedRow := &HealthMenstruationDailyEntryORM{}\n\tdb.Model(&ormObj).Set(\"gorm:query_option\", \"FOR UPDATE\").Where(\"id=?\", ormObj.Id).First(lockedRow)\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeStrictUpdateCleanup); ok {\n\t\tif db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithBeforeStrictUpdateSave); ok {\n\t\tif db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Save(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationDailyEntryORMWithAfterStrictUpdateSave); ok {\n\t\tif err = hook.AfterStrictUpdateSave(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pbResponse, err\n}", "func (hh *HealthCheckHandler) List(w http.ResponseWriter, r *http.Request) {\n\tqueryParams := r.URL.Query()\n\tpage, err := strconv.Atoi(queryParams[\"page\"][0])\n\tif err != nil {\n\t\thttp.Error(w, marshalError(err.Error()), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tlist := hh.db.List()\n\tsort.Sort(models.HealthChecks(list))\n\tstart, end := paginate(page, 10, len(list))\n\tpaginated := list[start:end]\n\n\tres := &models.HealthCheckList{\n\t\tItems: paginated,\n\t\tTotal: len(list),\n\t\tPage: page,\n\t\tSize: 10,\n\t}\n\n\tb, err := json.Marshal(res)\n\tif err != nil {\n\t\thttp.Error(w, marshalError(err.Error()), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Write(b)\n}", "func (gs *GreetingService) List(c endpoints.Context, r *GreetingsListReq) (*GreetingsList, error) {\n\tif r.Limit <= 0 {\n\t\tr.Limit = 10\n\t}\n\n\tq := datastore.NewQuery(\"Greeting\").Order(\"-Date\").Limit(r.Limit)\n\tgreets := make([]*Greeting, 0, r.Limit)\n\tkeys, err := q.GetAll(c, &greets)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor i, k := range keys {\n\t\tgreets[i].Key = k\n\t}\n\treturn &GreetingsList{greets}, nil\n}", "func runList(props ListCmdProps, output io.Writer, repo db.Repo) error {\n\tstart, err := parseDateOrDefault(props.startDate)\n\n\tif props.startDate == \"\" {\n\t\tdefaultStart := start.Add(-1 * time.Hour * 24 * 30)\n\t\tstart = &defaultStart\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tend, err := parseDateOrDefault(props.endDate)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tworkingDays, err := repo.ListRange(start, end)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trenderTable(workingDays, output)\n\n\treturn nil\n}", "func (c *IloClient) GetAggHealthDataDell(model string) ([]HealthList, error) {\n\n\tif strings.ToLower(model) == \"r730xd\" {\n\n\t\treturn nil, nil\n\n\t} else if strings.ToLower(model) == \"r740xd\" {\n\t\turl := c.Hostname + \"/redfish/v1/UpdateService/FirmwareInventory\"\n\n\t\tresp, _, _, err := queryData(c, \"GET\", url, nil)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar (\n\t\t\tx MemberCountDell\n\t\t\t_healthdata []HealthList\n\t\t)\n\n\t\tjson.Unmarshal(resp, &x)\n\n\t\tfor i := range x.Members {\n\t\t\tr, _ := regexp.Compile(\"Installed\")\n\t\t\tif r.MatchString(x.Members[i].OdataId) == true {\n\t\t\t\t_url := c.Hostname + x.Members[i].OdataId\n\t\t\t\tresp, _, _, err := queryData(c, \"GET\", _url, nil)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tvar y FirmwareDataDell\n\n\t\t\t\tjson.Unmarshal(resp, &y)\n\n\t\t\t\thealthData := HealthList{\n\t\t\t\t\tName: y.Name,\n\t\t\t\t\tState: y.Status.State,\n\t\t\t\t\tHealth: y.Status.Health,\n\t\t\t\t}\n\n\t\t\t\t_healthdata = append(_healthdata, healthData)\n\n\t\t\t}\n\t\t}\n\n\t\treturn _healthdata, nil\n\t}\n\treturn nil, nil\n}", "func (gs *GreetingService) List(c endpoints.Context, r *GreetingsListReq) (*GreetingsList, error) {\n\tif r.Limit <= 0 {\n\t\tr.Limit = 10\n\t}\n\n\tq := datastore.NewQuery(\"Greeting\").Limit(r.Limit)\n\tgreets := make([]*Greeting, 0, r.Limit)\n\tkeys, err := q.GetAll(c, &greets)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor i, k := range keys {\n\t\tgreets[i].Key = k\n\t}\n\treturn &GreetingsList{greets}, nil\n}", "func (r *Resource) getAllHandler(c *gin.Context) {\n // fetch all from database\n meals, err := r.db.GetAllMenuMeals()\n if err != nil {\n c.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n return\n }\n\n // return result as JSON\n c.JSON(http.StatusOK, meals)\n}", "func List(ctx context.Context, r Recipient) (Events, error) {\n\td := dsset.Set{\n\t\tParent: r.Key,\n\t\tTombstonesDelay: TombstonesDelay,\n\t}\n\tconst effectivelyUnlimited = 1000000\n\tswitch l, err := d.List(ctx, effectivelyUnlimited); {\n\tcase err != nil:\n\t\treturn nil, err\n\tcase len(l.Items) == effectivelyUnlimited:\n\t\tpanic(fmt.Errorf(\"fetched possibly not all events (limit: %d)\", effectivelyUnlimited))\n\tdefault:\n\t\treturn toEvents(l.Items), nil\n\t}\n}", "func (h WorkloadHandler) List(ctx *gin.Context) {\n}", "func DefaultReadHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, 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 == 0 {\n\t\treturn nil, errors1.EmptyIdError\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeReadApplyQuery); ok {\n\t\tif db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &HealthMenstruationPersonalInfoORM{}); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeReadFind); ok {\n\t\tif db, err = hook.BeforeReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tormResponse := HealthMenstruationPersonalInfoORM{}\n\tif err = db.Where(&ormObj).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormResponse).(HealthMenstruationPersonalInfoORMWithAfterReadFind); ok {\n\t\tif err = hook.AfterReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func (c HourlyCommand) Items(arg, data string) (items []alfred.Item, err error) {\n\tdlog.Printf(\"Running HourlyCommand\")\n\n\tvar cfg hourlyConfig\n\tif data != \"\" {\n\t\tif err := json.Unmarshal([]byte(data), &cfg); err != nil {\n\t\t\tdlog.Printf(\"Invalid hourly config\")\n\t\t}\n\t}\n\n\tvar weather Weather\n\tvar loc Location\n\tif loc, weather, err = getWeather(arg); err != nil {\n\t\treturn\n\t}\n\n\tvar startTime time.Time\n\tif cfg.Start != nil {\n\t\tstartTime = *cfg.Start\n\t} else if len(weather.Hourly) > 0 {\n\t\tstartTime = weather.Hourly[0].Time\n\t}\n\n\theading := alfred.Item{\n\t\tTitle: \"Weather for \" + loc.Name,\n\t\tSubtitle: alfred.Line,\n\t\tArg: &alfred.ItemArg{\n\t\t\tKeyword: \"daily\",\n\t\t},\n\t}\n\n\tif weather.URL != \"\" {\n\t\theading.AddMod(alfred.ModCmd, alfred.ItemMod{\n\t\t\tSubtitle: \"Open this forecast in a browser\",\n\t\t\tArg: &alfred.ItemArg{\n\t\t\t\tKeyword: \"daily\",\n\t\t\t\tMode: alfred.ModeDo,\n\t\t\t\tData: alfred.Stringify(&dailyCfg{ToOpen: weather.URL}),\n\t\t\t},\n\t\t})\n\t}\n\n\titems = append(items, heading)\n\n\tdeg := \"F\"\n\tif config.Units == unitsMetric {\n\t\tdeg = \"C\"\n\t}\n\n\taddAlertItems(&weather, &items)\n\n\tfor _, entry := range weather.Hourly {\n\t\tif entry.Time.Before(startTime) {\n\t\t\tcontinue\n\t\t}\n\n\t\tconditions := entry.Summary\n\t\ticon := entry.Icon\n\n\t\titem := alfred.Item{\n\t\t\tTitle: entry.Time.Format(\"Mon \"+config.TimeFormat) + \": \" + conditions,\n\t\t\tSubtitle: fmt.Sprintf(\"%d°%s (%d°%s) ☂ %d%%\", entry.Temp.Int64(), deg, entry.ApparentTemp.Int64(), deg, entry.Precip),\n\t\t\tIcon: getIconFile(icon),\n\t\t}\n\n\t\titems = append(items, item)\n\t}\n\n\treturn\n}", "func (d *Dao) GetAllDayExpenseInfo(c context.Context, beginDate time.Time, ctype, from, limit int) (infos []*model.BudgetDayStatistics, err error) {\n\trows, err := d.rddb.Query(c, _getAllDayExpenseSQL, beginDate, ctype, from, limit)\n\tif err != nil {\n\t\tlog.Error(\"dao.GetAllDayExpenseInfo query error(%v)\", err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\ta := &model.BudgetDayStatistics{}\n\t\tif err = rows.Scan(&a.DayExpense, &a.UpCount, &a.AvCount, &a.UpAvgExpense, &a.AvAvgExpense, &a.TotalExpense, &a.Date); err != nil {\n\t\t\tlog.Error(\"dao.GetAllDayExpenseInfo scan error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t\tinfos = append(infos, a)\n\t}\n\terr = rows.Err()\n\treturn\n}", "func DefaultListPeriod(ctx context.Context, db *gorm.DB) ([]*Period, error) {\n\tin := Period{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(PeriodORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm1.ApplyCollectionOperators(ctx, db, &PeriodORM{}, &Period{}, nil, nil, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(PeriodORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []PeriodORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(PeriodORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*Period{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func (c Client) ListEntries(ids []string) ([]Entry, error) {\n\tif len(ids) > 1000 {\n\t\treturn nil, errors.New(\"The number of entry ids you can pass as an input is limited to 1,000.\")\n\t}\n\turl := c.Config.BaseURL + \"/\" + c.Config.Version + \"/\" + entriesEndpoint + \"/.mget\"\n\tpayload, err := json.Marshal(ids)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq, err := http.NewRequest(\"POST\", url, bytes.NewReader(payload))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Add(\"Authorization\", \"Bearer \"+c.Config.Token)\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\tresp, err := c.Client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar entries []Entry\n\terr = json.Unmarshal(body, &entries)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn entries, nil\n}", "func DefaultListUserInfo(ctx context.Context, db *gorm.DB) ([]*UserInfo, error) {\n\tin := UserInfo{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm1.ApplyCollectionOperators(ctx, db, &UserInfoORM{}, &UserInfo{}, nil, nil, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []UserInfoORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(UserInfoORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*UserInfo{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func GetData(w http.ResponseWriter, r *http.Request) {\n\tresult := dailyData{}\n\tc := utils.MONGOSESSION.DB(\"healthDB\").C(\"healthData\")\n\tc.Find(bson.M{\"date\": utils.GetDate(time.Now())}).One(&result)\n\tb, _ := json.Marshal(result)\n\tfmt.Fprintf(w, string(b))\n}", "func HealthHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"--- RECEIVED HEALTH DATA FROM HEALTH PULSE ---\")\n\n\tauth, httpErr := auth.CheckAuth(w, r)\n\tif !auth {\n\t\thttp.Error(w, httpErr.Status, httpErr.StatusCode)\n\t\treturn\n\t}\n\n\tvar healthSample health.Data\n\tdata, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tlog.Println(string(data))\n\n\terr = json.Unmarshal(data, &healthSample)\n\tif err != nil {\n\t\tlog.Errorf(\"Error while unmarshaling incoming health data: %s\", err)\n\t\tlog.Println(string(data))\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tc := utils.MONGOSESSION.DB(\"healthDB\").C(\"healthData\")\n\tvar results []dailyData\n\terr = c.Find(bson.M{\"date\": healthSample.Date}).All(&results)\n\n\tif err != nil {\n\t\tlog.Errorf(\"Error while finding health data entries: %s\", err)\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Calculate Min and Max heart rate\n\tminMaxHR := calcMinMaxDailyHeartRate(healthSample)\n\thealthSample.MinMaxHeartRate = minMaxHR\n\n\t// If there is no entry for the current day create one with the current sample\n\tif len(results) == 0 {\n\t\terr = c.Insert(&dailyData{Date: healthSample.Date, Data: healthSample})\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error while inserting health data entries: %s\", err)\n\t\t\treturn\n\t\t}\n\t\tlog.Infof(\"LOGGED ENTRY %s\", healthSample.Date)\n\t\treturn\n\t}\n\n\t// If there is an entry for the current day, update the entry with the current sample\n\tcolQuerier := bson.M{\"date\": healthSample.Date}\n\tchange := bson.M{\"$set\": bson.M{\"date\": healthSample.Date, \"data\": healthSample}}\n\terr = c.Update(colQuerier, change)\n\tif err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tlog.Infof(\"UPDATING ENTRY %s\", healthSample.Date)\n}", "func (s *TimeEntriesService) List(start, end *time.Time) ([]TimeEntry, error) {\n\tu := \"time_entries\"\n\tparams := url.Values{}\n\tif start != nil {\n\t\tparams.Add(\"start_date\", start.Format(time.RFC3339))\n\t}\n\tif end != nil {\n\t\tparams.Add(\"end_date\", end.Format(time.RFC3339))\n\t}\n\tu += \"?\" + params.Encode()\n\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata := new([]TimeEntry)\n\t_, err = s.client.Do(req, data)\n\n\treturn *data, err\n}", "func DaemonsHandler(cmd *CmdMessage) error {\n if !cmd.Conn.owner.IsUser() {\n return errors.New(\"This handler is not available for daemons\")\n }\n if !cmd.Conn.owner.IsAuthorised() {\n return errors.New(\"User has to log in before using this handler\")\n }\n\n data := make(map[string]interface{})\n data[\"list\"] = [](map[string]interface{}){}\n daemons := cmd.Conn.owner.GetOrg().Daemons\n\n for id := range daemons {\n data[\"list\"] = append(data[\"list\"].([]map[string]interface{}), getDaemonFormat(daemons[id]))\n }\n\n return DispatchMessage(\"daemons\", data, cmd.Conn)\n}", "func (mgr *EntryManager) GetAll() []*Entry {\n\tvar entries []*Entry\n\n\tdb, err := sql.Open(\"postgres\", mgr.ConnStr)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tdefer db.Close()\n\n\t// Generate a Rows iterator from a SQL query\n\tqueryStr := \"SELECT id, title, date_posted, tags FROM entries ORDER BY id;\"\n\trows, err := db.Query(queryStr)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil\n\t}\n\tdefer rows.Close()\n\n\t// Iterate over rows and populate Entry records\n\tfor rows.Next() {\n\t\tvar (\n\t\t\tentryID int\n\t\t\ttitle, tagsText string\n\t\t\tdatePosted time.Time\n\t\t)\n\n\t\terr = rows.Scan(&entryID, &title, &datePosted, &tagsText)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tentries = append(entries, &Entry{\n\t\t\tID: entryID,\n\t\t\tTitle: title,\n\t\t\tDatePosted: datePosted,\n\t\t\tTags: strings.Split(tagsText, \",\"),\n\t\t},\n\t\t)\n\t}\n\n\treturn entries\n}", "func (this *WebController) List() {\n\t//新闻线索模块\n\tweek, _ := this.GetInt(\"week\") //获取时间周期\n\t//以下为算出每个周期的开始时间,人工录入的新闻都是按时间戳筛选的,接口的数据可直接调用week字段\n\tvar st int64\n\tlocal := time.Now().Local().Format(\"2006-01-02\")\n\ttoday, _ := time.Parse(\"2006-01-02 15:04:05\", local + \" 00:00:00\")\n\tnow := time.Now().Unix()\n\tp := this.FormToP(\"tab2\", \"tab3\")\n\tif week == 3 {\n\t\tst = today.Unix() - 30 * 3600 * 24 - 8 * 3600\n\t} else if week == 2 {\n\t\tst = today.Unix() - 7 * 3600 * 24 - 8 * 3600\n\t} else {\n\t\tst = today.Unix() - 8 * 3600\n\t}\n\tif p[\"tab2\"] == \"新华电讯\" {\n\t\t//新华电讯下的数据是按时间戳筛选的\n\t\tif week == 1 {\n\t\t\tp[\"date\"] = P{\"$gte\": st, \"$lte\": now}\n\t\t} else {\n\t\t\tet := today.Unix() - 8 * 3600 - 1\n\t\t\tp[\"date\"] = P{\"$gte\": st, \"$lte\": et}\n\t\t}\n\t} else {\n\t\tp[\"week\"] = 1\n\t}\n\tp[\"news_class\"] = 4\n\tp[\"old\"] = 0\n\tp[\"dh\"] = list_dh\n\ttotal := D(News).Find(p).Count()\n\tsort := \"-date\"\n\tif p[\"tab2\"] == \"互联网\" {\n\t\tsort = \"-hot\"\n\t} else {\n\n\t}\n\tlist := *D(News).Find(p).Sort(sort).Limit(100).All()\n\tif len(list) == 0 {\n\t\t//如果实时数据为空则开启备份数据\n\t\tq := P{}\n\t\tq[\"news_class\"] = 4\n\t\tif p[\"tab3\"] != nil {\n\t\t\tq[\"tab3\"] = p[\"tab3\"]\n\t\t}\n\t\tif p[\"tab2\"] != nil {\n\t\t\tq[\"tab2\"] = p[\"tab2\"]\n\t\t}\n\t\tq[\"dh\"] = list_dh\n\t\tq[\"old\"] = 1\n\t\tlist = *D(News).Find(q).Sort(sort).Limit(100).All()\n\t}\n\tfor _, v := range list {\n\t\tv[\"name\"] = v[\"title\"] //前端用name接受\n\t\tif week == 1 {\n\t\t\t//修改当日时间\n\t\t\tv[\"date\"] = today.Unix()\n\t\t}\n\t}\n\ttotals := 0\n\tr := P{}\n\tr[\"total\"] = total + totals\n\tr[\"page\"], _ = this.GetInt(\"page\", 1) //分页机制暂时没用到\n\tr[\"list\"] = list\n\tthis.EchoJsonMsg(r)\n}", "func (HealthMenstruationDailyEntryORM) TableName() string {\n\treturn \"health_menstruation_daily_entries\"\n}", "func GetJournalEntriesAll(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {\n\tif isLoggedIn(w, req) {\n\t\tq := req.URL.Query()\n\n\t\tch := make(chan map[string]bool)\n\t\tgo model.GetLabourNames(ch)\n\n\t\tdate := q[\"date\"][0]\n\t\tproductID, err := strconv.Atoi(q[\"id\"][0])\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error in GETJournal Entries all\")\n\t\t\tlog.Println(err)\n\t\t}\n\t\tje, box, packet, res := model.GetAllJournalEntry(date, productID)\n\n\t\tlabours = <-ch\n\n\t\tresult := JournalResponse{\n\t\t\tJournalEntries: je,\n\t\t\tBox: box,\n\t\t\tPacket: packet,\n\t\t\tLabours: labours,\n\t\t}\n\t\tif res {\n\t\t\tp, err := json.Marshal(result)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Error in GetJournalEntries all in Marshalling\")\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t\tio.WriteString(w, string(p))\n\t\t}\n\t}\n}", "func (t *TimeEntriesService) List(ctx context.Context, opts *TimeEntriesListOptions) ([]*TimeEntry, *Response, error) {\n\tu := \"time_entries\"\n\tu, err := addOptions(u, opts)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq, err := t.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\ttype Page struct {\n\t\tPagination\n\t\tTimeEntries []*TimeEntry `json:\"time_entries\"`\n\t}\n\tvar page Page\n\n\tresp, err := t.client.Do(ctx, req, &page)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\tresp.populatePageValues(page.Pagination)\n\n\treturn page.TimeEntries, resp, nil\n}", "func ListBuildSummaries(settings *playfab.Settings, postData *ListBuildSummariesRequestModel, entityToken string) (*ListBuildSummariesResponseModel, error) {\n if entityToken == \"\" {\n return nil, playfab.NewCustomError(\"entityToken should not be an empty string\", playfab.ErrorGeneric)\n }\n b, errMarshal := json.Marshal(postData)\n if errMarshal != nil {\n return nil, playfab.NewCustomError(errMarshal.Error(), playfab.ErrorMarshal)\n }\n\n sourceMap, err := playfab.Request(settings, b, \"/MultiplayerServer/ListBuildSummaries\", \"X-EntityToken\", entityToken)\n if err != nil {\n return nil, err\n }\n \n result := &ListBuildSummariesResponseModel{}\n\n config := mapstructure.DecoderConfig{\n DecodeHook: playfab.StringToDateTimeHook,\n Result: result,\n }\n \n decoder, errDecoding := mapstructure.NewDecoder(&config)\n if errDecoding != nil {\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\n }\n \n errDecoding = decoder.Decode(sourceMap)\n if errDecoding != nil {\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\n }\n\n return result, nil\n}", "func (m *SeaterModel) ListMeetingCanhuis(params QueryParams) (mcs []*MeetingCanhui, err error) {\n\to := m.Orm()\n\n\tmcs = make([]*MeetingCanhui, 0, PagingDefaultLimit)\n\n\tqs := o.QueryTable(new(MeetingCanhui))\n\tif params != nil {\n\t\tqs = qs.SetCond(params.Condition())\n\t}\n\n\tqs = qs.OrderBy(\"-ID\")\n\t_, err = m.PagingAll(params, qs, &mcs)\n\tif err == orm.ErrNoRows {\n\t\treturn mcs, nil\n\t} else if err != nil {\n\t\terr = errors.Trace(err)\n\t\treturn\n\t}\n\n\treturn\n}", "func (c *cronFederatedHPAs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.CronFederatedHPAList, err error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\tresult = &v1alpha1.CronFederatedHPAList{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"cronfederatedhpas\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "func (db database) list(w http.ResponseWriter, req *http.Request) {\n\n\tif err := itemList.Execute(w, db); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func (s *AbsenceRegistrationsEndpoint) List(ctx context.Context, division int, all bool, o *api.ListOptions) ([]*AbsenceRegistrations, error) {\n\tvar entities []*AbsenceRegistrations\n\tu, _ := s.client.ResolvePathWithDivision(\"/api/v1/{division}/hrm/AbsenceRegistrations\", division) // #nosec\n\tapi.AddListOptionsToURL(u, o)\n\n\tif all {\n\t\terr := s.client.ListRequestAndDoAll(ctx, u.String(), &entities)\n\t\treturn entities, err\n\t}\n\t_, _, err := s.client.NewRequestAndDo(ctx, \"GET\", u.String(), nil, &entities)\n\treturn entities, err\n}", "func (m *HealthMenstruationDailyEntry) ToORM(ctx context.Context) (HealthMenstruationDailyEntryORM, error) {\n\tto := HealthMenstruationDailyEntryORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(HealthMenstruationDailyEntryWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tif m.CreatedAt != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.CreatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.CreatedAt = &t\n\t}\n\tif m.UpdatedAt != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.UpdatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.UpdatedAt = &t\n\t}\n\tto.ProfileId = m.ProfileId\n\tif m.Day != nil {\n\t\tvar t time.Time\n\t\tif t, err = ptypes1.Timestamp(m.Day); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t\tto.Day = &t\n\t}\n\tto.IntensityPercentage = m.IntensityPercentage\n\tto.Type = int32(m.Type)\n\tto.Manual = m.Manual\n\tto.BasedOnPrediction = m.BasedOnPrediction\n\tif posthook, ok := interface{}(m).(HealthMenstruationDailyEntryWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "func (hpSrv *HomePageServ) List() {\n\tvar (\n\t\tarticelMd []serializer.ArticleModel\n\t)\n\tconf.MYSQL_CONNECT.Order(\"created_at desc\").Find(&articelMd)\n\tif hpSrv.Limit == 0 {\n\t\thpSrv.Limit = 4\n\t}\n\thpSrv.setArticleSet(articelMd)\n\thpSrv.pageCount = setPageCount(len(articelMd), hpSrv.Limit)\n\thpSrv.setPage()\n}", "func (s *business) List(where repository.Example, order string, limit int32, page int32) (*repository.ExampleList, *response.Error) {\n\ts.logger = s.loggerClone\n\ts.logger.SugaredLogger = s.logger.With(\"method\", \"List\")\n\n\t// Pagination\n\tif limit == 0 {\n\t\tlimit = viper.GetInt32(\"PAGE_LIMIT\")\n\t}\n\tif page <= 0 {\n\t\tpage = 1\n\t}\n\toffset := limit * (page - 1)\n\n\t// Get data list\n\texamples, count, err := s.repository.ListWhere(where, order, limit, offset)\n\tif err != nil {\n\t\ts.logger.Errorw(\"list data error\", \"error\", err)\n\t\treturn nil, response.NewErrorFromCode(errorcode.GetDataError)\n\t}\n\texampleList := repository.NewExampleList(examples, count)\n\treturn exampleList, nil\n}", "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}", "func (db *Database) ListKeyServerStatsDays(realmID uint) ([]*KeyServerStatsDay, error) {\n\tstop := timeutils.UTCMidnight(time.Now())\n\tstart := stop.Add(project.StatsDisplayDays * -24 * time.Hour)\n\tif start.After(stop) {\n\t\treturn nil, ErrBadDateRange\n\t}\n\n\tsql := `\n\t\tSELECT\n\t\t\td.day AS day,\n\t\t\t$1 AS realm_id,\n\t\t\tCOALESCE(s.publish_requests, array[0,0,0]::bigint[]) AS publish_requests,\n\t\t\tCOALESCE(s.total_teks_published, 0) AS total_teks_published,\n\t\t\tCOALESCE(s.revision_requests, 0) AS revision_requests,\n\t\t\tCOALESCE(s.tek_age_distribution, array[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]::bigint[]) AS tek_age_distribution,\n\t\t\tCOALESCE(s.onset_to_upload_distribution, array[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]::bigint[]) AS onset_to_upload_distribution,\n\t\t\tCOALESCE(s.request_missing_onset_date, 0) AS request_missing_onset_date\n\t\tFROM (\n\t\t\tSELECT day::date FROM generate_series($2, $3, '1 day'::interval) day\n\t\t) d\n\t\tLEFT JOIN key_server_stats_days s ON s.realm_id = $1 AND s.day = d.day\n\t\tORDER BY day DESC`\n\n\tvar stats []*KeyServerStatsDay\n\tif err := db.db.Raw(sql, realmID, start, stop).Scan(&stats).Error; err != nil {\n\t\tif IsNotFound(err) {\n\t\t\treturn stats, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn stats, nil\n}", "func (dao *OHLCVDao) GetAll() ([]types.Tick, error) {\n\tvar response []types.Tick\n\terr := db.Get(dao.dbName, dao.collectionName, bson.M{}, 0, 0, &response)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn nil, err\n\t}\n\n\treturn response, nil\n}", "func (m *HealthMenstruationDailyEntryORM) ToPB(ctx context.Context) (HealthMenstruationDailyEntry, error) {\n\tto := HealthMenstruationDailyEntry{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(HealthMenstruationDailyEntryWithBeforeToPB); ok {\n\t\tif err = prehook.BeforeToPB(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.Id = m.Id\n\tif m.CreatedAt != nil {\n\t\tif to.CreatedAt, err = ptypes1.TimestampProto(*m.CreatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tif m.UpdatedAt != nil {\n\t\tif to.UpdatedAt, err = ptypes1.TimestampProto(*m.UpdatedAt); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.ProfileId = m.ProfileId\n\tif m.Day != nil {\n\t\tif to.Day, err = ptypes1.TimestampProto(*m.Day); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tto.IntensityPercentage = m.IntensityPercentage\n\tto.Type = HealthMenstruationDailyEntry_Type(m.Type)\n\tto.Manual = m.Manual\n\tto.BasedOnPrediction = m.BasedOnPrediction\n\tif posthook, ok := interface{}(m).(HealthMenstruationDailyEntryWithAfterToPB); ok {\n\t\terr = posthook.AfterToPB(ctx, &to)\n\t}\n\treturn to, err\n}", "func (e *Event) List(c echo.Context, p *takrib.Pagination) ([]takrib.Event, error) {\n\tau := e.rbac.User(c)\n\tq, err := query.List(au)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn e.udb.List(e.db, q, p)\n}", "func (s *TimeAndBillingEntryRecentHourCostTypesEndpoint) List(ctx context.Context, division int, all bool, o *api.ListOptions) ([]*TimeAndBillingEntryRecentHourCostTypes, error) {\n\tvar entities []*TimeAndBillingEntryRecentHourCostTypes\n\tu, _ := s.client.ResolvePathWithDivision(\"/api/v1/{division}/read/project/TimeAndBillingEntryRecentHourCostTypes\", division) // #nosec\n\tapi.AddListOptionsToURL(u, o)\n\n\tif all {\n\t\terr := s.client.ListRequestAndDoAll(ctx, u.String(), &entities)\n\t\treturn entities, err\n\t}\n\t_, _, err := s.client.NewRequestAndDo(ctx, \"GET\", u.String(), nil, &entities)\n\treturn entities, err\n}", "func TestGetLogList(t *testing.T) {\n\tw := NewDateWriter(\"./logs\", \"abc\", HOUR, 0)\n\tw.cleanOldLogs()\n}", "func TodayStat(startTime time.Time, n int) ([]*model.SumStat, error) {\n\tvar debug_print_time = false\n\n\tvar conn *sql.DB\n\tvar stmt *sql.Stmt\n\tvar err error\n\tif conn, err = db.Connect(); err != nil {\n\t\treturn nil, err\n\t}\n\tdefer conn.Close()\n\n\tstartTime = startTime.UTC().Truncate(time.Hour*24).AddDate(0, 0, 1)\n\tendTime := startTime.AddDate(0, 0, -n).Truncate(time.Hour * 24)\n\tif debug_print_time {\n\t\tfmt.Println(\"((((())))) ---- start time:\", startTime)\n\t\tfmt.Println(\"((((())))) ---- end time:\", endTime)\n\t}\n\n\t// 这个sql会自动将时间转换为utc时间进行搜索。因此传入的时间无需转换时区。\n\t_sql := `\nselect DATE_FORMAT(o.create_time, '%Y-%m-%d') as 'date', \n count(distinct o.track_number) as 'norder',\n sum(od.quantity) as 'nsold',\n sum(od.quantity * od.selling_price) as '总价' ` +\n\t\t\"from `order` o \" + `\n right join order_detail od on o.track_number = od.order_track_number\nwhere\n o.create_time<?\n and o.create_time >= ?\n and DATEDIFF(o.create_time,?) > ?\n and o.type in (?,?)\n and o.status in (?,?,?,?)\n and od.product_id<>?\ngroup by DATEDIFF(o.create_time,?)\norder by DATEDIFF(o.create_time,?) asc\n`\n\tif stmt, err = conn.Prepare(_sql); err != nil {\n\t\treturn nil, err\n\t}\n\tdefer stmt.Close()\n\n\t// now := time.Now()\n\trows, err := stmt.Query(\n\t\tstartTime,\n\t\tendTime,\n\t\tstartTime, -n,\n\t\tmodel.Wholesale, model.SubOrder, // model.ShippingInstead, // 查子订单\n\t\t\"toprint\", \"todeliver\", \"delivering\", \"done\",\n\t\tbase.STAT_EXCLUDED_PRODUCT,\n\t\tstartTime,\n\t\tstartTime,\n\t)\n\tif db.Err(err) {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close() // db.CloseRows(rows) // use db.CloseRows or rows.Close()? Is rows always nun-nil?\n\n\t// the final result\n\tps := []*model.SumStat{}\n\tfor rows.Next() {\n\t\tp := new(model.SumStat)\n\t\trows.Scan(&p.Id, &p.NOrder, &p.NSold, &p.TotalPrice)\n\n\t\t// update average.\n\t\tp.AvgPrice = p.TotalPrice / float64(p.NSold)\n\n\t\tps = append(ps, p)\n\t}\n\treturn ps, nil\n}", "func GetFullList() (*List, error) { /*{{{*/\n\tresults, err := storage.Get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t//sorted by date\n\tsort.Sort(results)\n\n\tl := &List{\n\t\tContent: make([]Lister, 0, len(results.Content)),\n\t}\n\tfor _, v := range results.Content {\n\t\tvar e interface{} = entry{v}\n\t\tif lister, ok := e.(Lister); ok {\n\t\t\tl.Content = append(l.Content, lister)\n\t\t}\n\t}\n\tif len(l.Content) == 0 {\n\t\treturn nil, errors.New(\"There is no posts. Maybe is generating... Refresh after a while\")\n\t}\n\treturn l, nil\n}", "func TestDbLog_GetList(t *testing.T) {\n\thandler := debug.NewLocalDb()\n\tdb := newDbLog(handler)\n\t_, err := db.Add(0, \"success\",\"\", 0, \"\", time.GetDayTime())\n\tif err == nil {\n\t\tt.Errorf(\"Add check cronId fail\")\n\t\treturn\n\t}\n\tid, err := db.Add(1, \"success\",\"123\", 1000, \"hello\", time.GetDayTime())\n\tif err != nil {\n\t\tt.Errorf(\"Add fail, error=[%v]\", err)\n\t\treturn\n\t}\n\trows, num, _, _, err := db.GetList(1, 0, 0)\n\tif err != nil || num <= 0 {\n\t\tt.Errorf(\"Get GetList, error=[%v], num=[%v]\", err, num)\n\t\treturn\n\t}\n\tvar row *LogEntity = nil\n\tfor _, r := range rows {\n\t\tif r.Id == id {\n\t\t\trow = r\n\t\t}\n\t}\n\tif row == nil {\n\t\tt.Errorf(\"GetList fail\")\n\t\treturn\n\t}\n\tif row.Id <= 0 || row.CronId != 1 || row.Output != \"123\"||\n\t\trow.UseTime != 1000 || row.Remark != \"hello\" {\n\t\tt.Errorf(\"Add check rows fail\")\n\t\treturn\n\t}\n\tdb.Delete(row.Id)\n}", "func (client ScheduleMessageClient) ListResponder(resp *http.Response) (result PushScheduleFetchAllParameter, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest, http.StatusUnauthorized, http.StatusForbidden, http.StatusNotFound, http.StatusInternalServerError),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func ListEventsByDate(date string) error {\n\ttokFile := \"token.json\"\n\t_, err := tokenFromFile(tokFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\tclient, err := GetClientToken()\n\tif err != nil {\n\t\treturn err\n\t}\n\tsrv, err := calendar.New(client)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to retrieve Calendar client: %v\", err)\n\t}\n\tlayout := \"2006-01-02\"\n\tday, err := time.Parse(layout, date)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdayAfter := day.AddDate(0, 0, 1).Format(time.RFC3339)\n\tevents, err := srv.Events.List(\"primary\").ShowDeleted(false).SingleEvents(true).TimeMin(day.Format(time.RFC3339)).TimeMax(dayAfter).MaxResults(1).OrderBy(\"startTime\").Do()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to retrieve today's user's events: %v\", err)\n\t}\n\tif len(events.Items) == 0 {\n\t\tfmt.Println(\"You have no upcoming events on your calendar for this day.\")\n\t} else {\n\t\tfmt.Println(\"These are your upcoming events on your calendar for this day\")\n\t\ttable := tablewriter.NewWriter(os.Stdout)\n\t\ttable.SetHeader([]string{\"EVENTID\", \"NAME\", \"DATE\"})\n\t\tdt := [][]string{}\n\t\tfor _, item := range events.Items {\n\t\t\tdate := item.Start.DateTime\n\t\t\tif date == \"\" {\n\t\t\t\tdate = item.Start.Date\n\t\t\t}\n\t\t\tdt = append(dt, []string{item.Id, item.Summary, date})\n\t\t}\n\t\tfor _, t := range dt {\n\t\t\ttable.Append(t)\n\t\t}\n\t\ttable.Render()\n\t}\n\treturn nil\n}", "func (h *Handler) FetchDailyTimeSeries(w http.ResponseWriter, r *http.Request, params httprouter.Params) error {\n\tstockSymbol := params.ByName(\"stock\")\n\n\tstock, err := h.Stocky.Postgres.GetOrCreateStock(stockSymbol)\n\tif err != nil {\n\t\tError(w, err)\n\t\treturn err\n\t}\n\n\tredisKey := fmt.Sprintf(\"stocky_%s\", stockSymbol)\n\t_, err = h.Stocky.Redis.Get(redisKey)\n\tif err == redis.Nil {\n\t\terr = h.updateDaily(stockSymbol, redisKey, stock.ID)\n\t\tif err != nil {\n\t\t\tError(w, err)\n\t\t\treturn err\n\t\t}\n\t} else if err != nil {\n\t\tError(w, err)\n\t\treturn err\n\t}\n\n\tstockDailySeries, err := h.Stocky.Postgres.FetchDailySeriesByStock(stock.ID)\n\tif err != nil {\n\t\tError(w, err)\n\t\treturn err\n\t}\n\n\tOK(w, entity.NewStockDailyResponse(stock, stockDailySeries), \"\")\n\treturn nil\n}", "func StartListEntriesCall(m telemetry.Metrics) *telemetry.CallCounter {\n\treturn telemetry.StartCall(m, telemetry.RegistrationAPI, telemetry.Entry, telemetry.List)\n}", "func (s *RaftServer) ListEntries(_ context.Context, _ *raftapi.Empty) (*raftapi.EntryListResponse, error) {\n\tlist, err := s.logRepo.List()\n\tif err != nil {\n\t\treturn nil, model.NewRaftError(&s.member, err)\n\t}\n\tvar logEntries = make([]*raftapi.LogEntry, 0)\n\tfor _, entry := range list {\n\t\tlogEntries = append(logEntries, &raftapi.LogEntry{\n\t\t\tTerm: entry.Term,\n\t\t\tValue: entry.Value,\n\t\t})\n\t}\n\tresponse := &raftapi.EntryListResponse{Entries: logEntries}\n\treturn response, nil\n}", "func getLoanList(ls *[]models.Loan, db *gorm.DB) error {\n\tvar l models.Loan\n\tif len(*ls) == 1 {\n\t\tl = (*ls)[0]\n\t}\n\twhere := \"\"\n\tif l.CodCollection != 0 {\n\t\twhere = fmt.Sprintf(\"cod_collection = %v\", l.CodCollection)\n\t}\n\tif l.CodClient != 0 {\n\t\twhere = fmt.Sprintf(\"cod_client = %v\", l.CodClient)\n\t}\n\tif where != \"\" && l.CodLoanState != 0 {\n\t\twhere += fmt.Sprintf(\" and cod_loan_state = %v\", l.CodLoanState)\n\t}\n\terr := db.Where(where).Select(\"id,created_at,updated_at,initial_value,interest,quota,balance,cod_loan_state,cod_client\").Find(ls).GetErrors()\n\tif len(err) != 0 {\n\t\treturn errors.New(\"no se encuentra\")\n\t}\n\treturn nil\n}", "func handleList(cmd *cobra.Command, args []string) {\n\tquery := `\n\tSELECT\n chat.chat_identifier AS id,\n count(chat.chat_identifier) AS messages\n\tFROM\n\t\tchat\n\t\tJOIN chat_message_join ON chat.\"ROWID\" = chat_message_join.chat_id\n\t\tJOIN message ON chat_message_join.message_id = message.\"ROWID\"\n\tWHERE TRUE\n\t-- filter out message reactions\n\tAND text IS NOT NULL\n\tAND associated_message_type == 0\n\t-- filter out empty messages\n\tAND trim(text, ' ') <> ''\n\tAND text <> ''\n\tGROUP BY\n\t\tchat.chat_identifier\n\tHAVING messages > ?\n\tORDER BY\n\t\tmessages DESC, id DESC;\n\t`\n\trows, err := db.Query(query, count)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar id string\n\t\tvar messages string\n\t\terr = rows.Scan(&id, &messages)\n\t\tif err != nil {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\t\tif isatty.IsTerminal(uintptr(unix.Stdout)) {\n\t\t\tfmt.Printf(\"%s\\t%s\\n\", aurora.Yellow(id), aurora.Blue(messages))\n\t\t} else {\n\t\t\tfmt.Printf(\"%s\\t%s\\n\", id, messages)\n\t\t}\n\t}\n\terr = rows.Err()\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n}", "func AllLogManagementsGet(c *gin.Context) {\n\t// 分表注释下面两行代码\n\tmeta := model.TableMetaFromQuery(c)\n\tginutils.WriteGinJSON(c, http.StatusOK, model.AllLogManagements(meta))\n\t// 分表取消注释下面三行代码\n\t// meta := model.TableMetaFromQuery(c, \"suffix\")\n\t// suffix := c.Query(\"suffix\")\n\t// ginutils.WriteGinJSON(c, http.StatusOK, model.AllLogManagements(meta, suffix))\n}", "func populateEntries(query string) []entity.Entry {\n\tresult := []entity.Entry{}\n\n\tdb := util.OpenDb()\n\trows, _ := db.Query(query)\n\n\tdefer rows.Close()\n\n\tvar (\n\t\tid, score int\n\t\tconcern, grateful, learn, milestone string\n\t\tentered int64\n\t)\n\n\tfor rows.Next() {\n\t\trows.Scan(&id, &score, &concern, &grateful, &learn, &milestone, &entered)\n\t\tresult = append(result, entity.EntryWithAllFields(id, score, concern, grateful, learn, milestone, entered))\n\t}\n\treturn result\n}", "func (h *Handler) list() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tentities, err := h.UserDAO.FetchAll(r.Context())\n\t\tswitch {\n\t\tcase errors.Is(err, errorx.ErrNoUser):\n\t\t\tmsg := &errorMessage{\n\t\t\t\tMessage: fmt.Sprintf(\"no users exist\"),\n\t\t\t}\n\t\t\tresponse.JSON(w, http.StatusNotFound, msg)\n\t\t\treturn\n\t\tcase err != nil:\n\t\t\tmsg := &errorMessage{\n\t\t\t\tError: err.Error(),\n\t\t\t\tMessage: \"user datastore error\",\n\t\t\t}\n\t\t\tresponse.JSON(w, http.StatusInternalServerError, msg)\n\t\t\treturn\n\t\tdefault:\n\t\t\tresponse.JSON(w, http.StatusOK, entities)\n\t\t}\n\t}\n}", "func (r *HealthResource) ListAll() (*HealthConfigList, error) {\n\tvar list HealthConfigList\n\tif err := r.c.ReadQuery(BasePath+HealthEndpoint, &list); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &list, nil\n}", "func (f *firestoreDir) List(ctx context.Context) ([]plugin.Entry, error) {\n\tcolls, err := f.client.Collections(ctx).GetAll()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn toCollectionEntries(f.client, \"\", colls), nil\n}", "func DefaultCreateHealthMenstruationPersonalInfo(ctx context.Context, in *HealthMenstruationPersonalInfo, db *gorm1.DB) (*HealthMenstruationPersonalInfo, 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 hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithBeforeCreate_); ok {\n\t\tif db, err = hook.BeforeCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = db.Create(&ormObj).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(HealthMenstruationPersonalInfoORMWithAfterCreate_); ok {\n\t\tif err = hook.AfterCreate_(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormObj.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func (c *kuberhealthyChecks) List(opts metav1.ListOptions) (result KuberhealthyCheckList, err error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\tresult = KuberhealthyCheckList{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"khchecks\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tDo(context.TODO()).\n\t\tInto(&result)\n\treturn\n}", "func (us UserService) List(dto dto.GeneralListDto) ([]model.User, int64) {\n\treturn userDao.List(dto)\n}", "func (h *GetStickTableEntriesHandlerImpl) Handle(params stick_table.GetStickTableEntriesParams, principal interface{}) middleware.Responder {\n\tfilter := make([]string, 0)\n\tif params.Filter != nil {\n\t\tfilter = strings.Split(*params.Filter, \",\")\n\t}\n\n\tkey := \"\"\n\tif params.Key != nil {\n\t\tkey = *params.Key\n\t}\n\truntime, err := h.Client.Runtime()\n\tif err != nil {\n\t\te := misc.HandleError(err)\n\t\treturn stick_table.NewGetStickTableEntriesDefault(int(*e.Code)).WithPayload(e)\n\t}\n\n\tstkEntries, err := runtime.GetTableEntries(params.StickTable, int(params.Process), filter, key)\n\tif err != nil {\n\t\te := misc.HandleError(err)\n\t\treturn stick_table.NewGetStickTableEntriesDefault(int(*e.Code)).WithPayload(e)\n\t}\n\n\t// if no entries return empty array\n\tif len(stkEntries) == 0 {\n\t\treturn stick_table.NewGetStickTableEntriesOK().WithPayload(stkEntries)\n\t}\n\n\t// else check for pagination\n\toffset := int64(0)\n\tif params.Offset != nil {\n\t\toffset = *params.Offset\n\t}\n\n\tif int(offset) >= len(stkEntries) {\n\t\tmsg := fmt.Sprintf(\"Offset %d is larger than the slice size %d\", offset, len(stkEntries))\n\t\tc := misc.ErrHTTPBadRequest\n\t\te := &models.Error{\n\t\t\tMessage: &msg,\n\t\t\tCode: &c,\n\t\t}\n\t\treturn stick_table.NewGetStickTableEntriesDefault(int(*e.Code)).WithPayload(e)\n\t}\n\n\tif params.Count != nil {\n\t\tif int(offset+*params.Count) >= len(stkEntries) {\n\t\t\tstkEntries = stkEntries[offset:]\n\t\t} else {\n\t\t\tstkEntries = stkEntries[offset : offset+*params.Count]\n\t\t}\n\t} else {\n\t\tstkEntries = stkEntries[offset:]\n\t}\n\treturn stick_table.NewGetStickTableEntriesOK().WithPayload(stkEntries)\n}", "func (p *pool) listEntries() ([]entry, error) {\n\tconn := p.Get()\n\tdefer conn.Close()\n\n\tids, err := redis.Ints(conn.Do(\"SMEMBERS\", key(\"entries\")))\n\tif err != nil {\n\t\treturn nil, xerrors.Errorf(\"can not receive ids: %w\", err)\n\t}\n\n\tvar entries []entry\n\tfor _, id := range ids {\n\t\tvalues, err := redis.Strings(conn.Do(\n\t\t\t\"HMGET\",\n\t\t\tkey(\"entry\", strconv.Itoa(id)),\n\t\t\t\"from\",\n\t\t\t\"subject\",\n\t\t\t\"text\",\n\t\t\t\"fileext\",\n\t\t\t\"created\",\n\t\t))\n\t\tif err != nil {\n\t\t\treturn nil, xerrors.Errorf(\"can not receice entry %d: %w\", id, err)\n\t\t}\n\n\t\tcreated, err := time.Parse(\"2006-01-02 15:04:05\", values[4])\n\t\tif err != nil {\n\t\t\treturn nil, xerrors.Errorf(\"can not parse created time: %w\", err)\n\t\t}\n\n\t\tentries = append(entries, entry{\n\t\t\tID: id,\n\t\t\tFrom: values[0],\n\t\t\tSubject: values[1],\n\t\t\tText: values[2],\n\t\t\tExtension: values[3],\n\t\t\tCreated: created.Format(\"2006-01-02 15:04\"),\n\t\t})\n\t}\n\treturn entries, nil\n}", "func (s *TimeLogStore) ListAllByDates(ctx context.Context, from time.Time, to time.Time) ([]domain.TimeLog, error) {\n\ttimeLogs := s.client.Database(dbName).Collection(timeLogsCollectionName)\n\n\tfindOptions := options.Find()\n\tfindOptions.SetSort(bson.D{{Key: \"createdAt\", Value: 1}})\n\n\tcursor, err := timeLogs.Find(ctx, bson.D{\n\t\t{Key: \"createdAt\", Value: bson.D{{Key: \"$gte\", Value: from}}},\n\t\t{Key: \"createdAt\", Value: bson.D{{Key: \"$lte\", Value: to}}},\n\t}, findOptions)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer cursor.Close(ctx)\n\n\tvar result []domain.TimeLog\n\tcursor.All(ctx, &result)\n\n\tif err := cursor.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(result) == 0 {\n\t\tresult = []domain.TimeLog{}\n\t}\n\n\treturn result, nil\n}", "func (c *globalThreatFeeds) List(ctx context.Context, opts v1.ListOptions) (result *v3.GlobalThreatFeedList, err error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\tresult = &v3.GlobalThreatFeedList{}\n\terr = c.client.Get().\n\t\tResource(\"globalthreatfeeds\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "func (repo *SingleStoryRepository) FindAllStoriesForLoggedUser(userId uuid.UUID) []model.SingleStory {\n\tvar stories []model.SingleStory\n\trepo.Database.Select(\"*\").Where(\"user_id = ? and is_deleted = ?\", userId, false).Find(&stories)\n\n\tfor i:=0; i< len(stories); i++{\n\t\tif time.Now().After(stories[i].CreationDate.Add(24 * time.Hour)){\n\t\t\t// PASSED TIME SHOULD SET STORY AS EXPIRED\n\t\t\t//stories[i].IsExpired = true\n\t\t\trepo.Database.Model(&model.SingleStory{}).Where(\"id = ?\", stories[i].ID).Update(\"is_expired\", true)\n\t\t\trepo.Database.Model(&model.Story{}).Where(\"id = ?\", stories[i].ID).Update(\"is_expired\", true)\n\t\t}\n\t}\n\n\treturn stories\n}", "func (s *EmployeesEndpoint) List(ctx context.Context, division int, all bool, o *api.ListOptions) ([]*Employees, error) {\n\tvar entities []*Employees\n\tu, _ := s.client.ResolvePathWithDivision(\"/api/v1/{division}/payroll/Employees\", division) // #nosec\n\tapi.AddListOptionsToURL(u, o)\n\n\tif all {\n\t\terr := s.client.ListRequestAndDoAll(ctx, u.String(), &entities)\n\t\treturn entities, err\n\t}\n\t_, _, err := s.client.NewRequestAndDo(ctx, \"GET\", u.String(), nil, &entities)\n\treturn entities, err\n}", "func List() ([]Incident, error) {\n\n\tmyData := make([]Incident, 0)\n\n\trows, err := database.DBCon.Query(\"SELECT * FROM incidents.employees\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\ti := new(Incident)\n\t\terr = rows.Scan(&i.ID, &i.Type, &i.StartDate, &i.EndDate, &i.Note, &i.EmployeeId)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmyData = append(myData, *i)\n\t}\n\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trows.Close()\n\n\treturn myData, nil\n}", "func List(habitMap habits.HabitMap) {\n\torderedHabits := orderByTag(habitMap)\n\thabitStrings := make([]string, len(habitMap), len(habitMap))\n\t// Maintain a map of tag to indexes that have that tag\n\ttype HabitEntry struct {\n\t\tIndex int\n\t\tDaysSince int\n\t}\n\tbyTag := map[string][]HabitEntry{}\n\n\tfor index, h := range orderedHabits {\n\t\tnumOccurrences := len(h.Occurrences)\n\t\tdaysSince := -1\n\t\tif numOccurrences > 0 {\n\t\t\tlastOccurrence := h.Occurrences[numOccurrences-1]\n\t\t\thoursSince := time.Now().Sub(lastOccurrence).Hours()\n\t\t\tdaysSince = int(math.Floor(hoursSince)) / 24\n\t\t}\n\t\t// TODO: Optimization, persist this formatted string in Habit objects\n\t\t// But there's trickiness since the index is part of this string\n\t\thabitStrings[index] = fmt.Sprintf(\"%d. | %s | %s | ^%d days since last tick\\n\", index, h.Name, h.ShortName, daysSince)\n\t\tbyTag[h.Tag] = append(byTag[h.Tag], HabitEntry{index, daysSince})\n\t}\n\n\tcolumns := columnize.SimpleFormat(habitStrings)\n\tlines := strings.Split(columns, \"\\n\")\n\n\tcolorAssignments := buildColorOrder(orderedHabits)\n\n\thabitIndex := 0\n\tfor _, boundary := range colorAssignments.TagBoundaries {\n\t\ttag := orderedHabits[habitIndex].Tag\n\t\tfmt.Printf(\"%4v#\", \"\")\n\t\tcolor.OpUnderscore.Println(tag)\n\t\tfor habitIndex < boundary {\n\t\t\tline := lines[habitIndex]\n\t\t\tparts := strings.Split(line, \"^\")\n\t\t\tcolorToUse := colorAssignments.ColorOrder[habitIndex]\n\t\t\tcolor.S256(colorToUse).Printf(\"%8v %s\", \"\", parts[0])\n\t\t\tcolor.Gray.Print(parts[1])\n\t\t\tfmt.Println()\n\t\t\thabitIndex++\n\t\t}\n\t}\n}", "func OnList(c *grumble.Context) error {\n\tlen := len(config.AppConfig.Plans)\n\tif len == 0 {\n\t\tfmt.Println(\"No plans available. Try \\\"read\\\".\")\n\t\treturn nil\n\t}\n\n\tfor i, plan := range config.AppConfig.Plans {\n\t\tfmt.Println(i+1, plan.Name)\n\t\tfor i, task := range plan.Tasks {\n\t\t\tif task.GetDescription() != \"\" {\n\t\t\t\tfmt.Println(\" \", strconv.Itoa(i+1)+\".\", task.GetDescription())\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (k Keeper) HistoricalEntries(ctx sdk.Context) (res uint32) {\n\tk.paramspace.Get(ctx, types.KeyHistoricalEntries, &res)\n\treturn\n}", "func (r *LocalRegistry) List(artHome string, extended bool) {\n\t// get a table writer for the stdout\n\tw := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.Debug)\n\t// print the header row\n\tvar err error\n\tif extended {\n\t\t_, err = fmt.Fprintln(w, i18n.String(artHome, i18n.LBL_LS_HEADER_PLUS))\n\t} else {\n\t\t_, err = fmt.Fprintln(w, i18n.String(artHome, i18n.LBL_LS_HEADER))\n\t}\n\tcore.CheckErr(err, \"failed to write table header\")\n\tvar (\n\t\ts *data.Seal\n\t\tauthor string\n\t)\n\t// repository, tag, package id, created, size\n\tfor _, repo := range r.Repositories {\n\t\tfor _, a := range repo.Packages {\n\t\t\ts, err = r.GetSeal(a)\n\t\t\tif err != nil {\n\t\t\t\tauthor = \"unknown\"\n\t\t\t} else {\n\t\t\t\tauthor = s.Manifest.Author\n\t\t\t}\n\t\t\t// if the package is dangling (no tags)\n\t\t\tif len(a.Tags) == 0 {\n\t\t\t\tif extended {\n\t\t\t\t\t_, err = fmt.Fprintln(w, fmt.Sprintf(\"%s\\t %s\\t %s\\t %s\\t %s\\t %s\\t %s\\t\",\n\t\t\t\t\t\trepo.Repository,\n\t\t\t\t\t\t\"<none>\",\n\t\t\t\t\t\ta.Id[0:12],\n\t\t\t\t\t\ta.Type,\n\t\t\t\t\t\ttoElapsedLabel(a.Created),\n\t\t\t\t\t\ta.Size,\n\t\t\t\t\t\tauthor),\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\t_, err = fmt.Fprintln(w, fmt.Sprintf(\"%s\\t %s\\t %s\\t %s\\t %s\\t %s\\t\",\n\t\t\t\t\t\trepo.Repository,\n\t\t\t\t\t\t\"<none>\",\n\t\t\t\t\t\ta.Id[0:12],\n\t\t\t\t\t\ta.Type,\n\t\t\t\t\t\ttoElapsedLabel(a.Created),\n\t\t\t\t\t\ta.Size),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tcore.CheckErr(err, \"failed to write output\")\n\t\t\t}\n\t\t\tfor _, tag := range a.Tags {\n\t\t\t\tif extended {\n\t\t\t\t\t_, err = fmt.Fprintln(w, fmt.Sprintf(\"%s\\t %s\\t %s\\t %s\\t %s\\t %s\\t %s\\t\",\n\t\t\t\t\t\trepo.Repository,\n\t\t\t\t\t\ttag,\n\t\t\t\t\t\ta.Id[0:12],\n\t\t\t\t\t\ta.Type,\n\t\t\t\t\t\ttoElapsedLabel(a.Created),\n\t\t\t\t\t\ta.Size,\n\t\t\t\t\t\tauthor),\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\t_, err = fmt.Fprintln(w, fmt.Sprintf(\"%s\\t %s\\t %s\\t %s\\t %s\\t %s\\t\",\n\t\t\t\t\t\trepo.Repository,\n\t\t\t\t\t\ttag,\n\t\t\t\t\t\ta.Id[0:12],\n\t\t\t\t\t\ta.Type,\n\t\t\t\t\t\ttoElapsedLabel(a.Created),\n\t\t\t\t\t\ta.Size),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tcore.CheckErr(err, \"failed to write output\")\n\t\t\t}\n\t\t}\n\t}\n\terr = w.Flush()\n\tcore.CheckErr(err, \"failed to flush output\")\n}", "func (a *HyperflexApiService) GetHyperflexHealthList(ctx context.Context) ApiGetHyperflexHealthListRequest {\n\treturn ApiGetHyperflexHealthListRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (m *Mux) List(ds *discordgo.Session, dm *discordgo.Message, ctx *Context) {\n\tresp := \"```\\n\"\n\n\tfor p, v := range Config.Feeds {\n\t\tresp += strconv.Itoa(p) + \": \" + v.Feed.Title + \", \" + v.Feed.Link + \"\\n\"\n\t}\n\n\tresp += \"```\\n\"\n\n\tds.ChannelMessageSend(dm.ChannelID, resp)\n\n\treturn\n}", "func (v HashtagsResource) List(c buffalo.Context) error {\n\t// Get the DB connection from the context\n\ttx := c.Value(\"tx\").(*pop.Connection)\n\thashtags := &models.Hashtags{}\n\t// Paginate results. Params \"page\" and \"per_page\" control pagination.\n\t// Default values are \"page=1\" and \"per_page=20\".\n\tq := tx.PaginateFromParams(c.Params())\n\t// You can order your list here. Just change\n\terr := q.All(hashtags)\n\t// to:\n\t// err := q.Order(\"created_at desc\").All(hashtags)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\t// Make Hashtags available inside the html template\n\tc.Set(\"hashtags\", hashtags)\n\t// Add the paginator to the context so it can be used in the template.\n\tc.Set(\"pagination\", q.Paginator)\n\treturn c.Render(200, r.HTML(\"hashtags/index.html\"))\n}", "func (h *History) List() {\n\tload := reverse(h.Load())\n\tprompt := promptui.Select{\n\t\tLabel: \"Target hisotry\",\n\t\tItems: load,\n\t\tSize: 10,\n\t}\n\n\ti, _, err := prompt.Run()\n\n\tif err != nil {\n\t\tlog.Fatalln(\"Prompt failed: \\n\", err)\n\t}\n\n\titem := load[i]\n\th.Write(item)\n\tExecuteItem(h.binary, item)\n}", "func (d *Service) AlertsList(ctx context.Context, Limit int, Offset int) ([]*thunderdome.Alert, int, error) {\n\tAlerts := make([]*thunderdome.Alert, 0)\n\tvar AlertCount int\n\n\te := d.DB.QueryRowContext(ctx,\n\t\t\"SELECT COUNT(*) FROM thunderdome.alert;\",\n\t).Scan(\n\t\t&AlertCount,\n\t)\n\tif e != nil {\n\t\td.Logger.Ctx(ctx).Error(\"query scan error\", zap.Error(e))\n\t}\n\n\trows, err := d.DB.QueryContext(ctx,\n\t\t`SELECT id, name, type, content, active, allow_dismiss, registered_only, created_date, updated_date\n\t\tFROM thunderdome.alert\n\t\tLIMIT $1\n\t\tOFFSET $2;\n\t\t`,\n\t\tLimit,\n\t\tOffset,\n\t)\n\n\tif err == nil {\n\t\tdefer rows.Close()\n\t\tfor rows.Next() {\n\t\t\tvar a thunderdome.Alert\n\n\t\t\tif err := rows.Scan(\n\t\t\t\t&a.Id,\n\t\t\t\t&a.Name,\n\t\t\t\t&a.Type,\n\t\t\t\t&a.Content,\n\t\t\t\t&a.Active,\n\t\t\t\t&a.AllowDismiss,\n\t\t\t\t&a.RegisteredOnly,\n\t\t\t\t&a.CreatedDate,\n\t\t\t\t&a.UpdatedDate,\n\t\t\t); err != nil {\n\t\t\t\td.Logger.Ctx(ctx).Error(\"query scan error\", zap.Error(err))\n\t\t\t\treturn nil, AlertCount, err\n\t\t\t} else {\n\t\t\t\tAlerts = append(Alerts, &a)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Alerts, AlertCount, err\n}", "func (m *ReportRoot) GetDailyPrintUsage()([]PrintUsageable) {\n val, err := m.GetBackingStore().Get(\"dailyPrintUsage\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]PrintUsageable)\n }\n return nil\n}", "func (service *EntriesService) List(spaceID string) *Collection {\n\tpath := fmt.Sprintf(\"/spaces/%s%s/entries\", spaceID, getEnvPath(service.c))\n\tmethod := \"GET\"\n\n\treq, err := service.c.newRequest(method, path, nil, nil)\n\tif err != nil {\n\t\treturn &Collection{}\n\t}\n\n\tcol := NewCollection(&CollectionOptions{})\n\tcol.c = service.c\n\tcol.req = req\n\n\treturn col\n}", "func list(db *sql.DB) ([]Todo, error) {\n\treturn read(db, -1)\n}", "func (ec EntryController) GetAllEntries(w http.ResponseWriter, r *http.Request) {\n\tlastProcessedID := r.FormValue(\"last\")\n\n\tvar entries []models.Entry\n\n\toptions := options.Find()\n\n\tfilter := ec.BuildEntryFilter(lastProcessedID, options)\n\n\toptions.SetSort(bson.M{\"createdAt\": -1})\n\n\toptions.SetLimit(10)\n\n\tcurs, err := ec.coll.Find(context.Background(), filter, options)\n\n\tif err != nil {\n\t\tshared.FError(w, http.StatusBadRequest, \"Failed to fetch entries\")\n\t\treturn\n\t}\n\n\t// await parsing of all available entries\n\tdefer curs.Close(context.Background())\n\n\tfor curs.Next(context.Background()) {\n\n\t\tvar entry models.Entry\n\t\terr := curs.Decode(&entry)\n\n\t\tif err != nil {\n\t\t\tshared.FError(w, http.StatusBadRequest, \"Failed to deserialize entries\")\n\t\t\treturn\n\t\t}\n\n\t\tentries = append(entries, entry)\n\t}\n\n\tif err := curs.Err(); err != nil {\n\t\tshared.FError(w, http.StatusBadRequest, \"Failed to parse entries\")\n\t\treturn\n\t}\n\n\tshared.FResponse(w, http.StatusOK, entries)\n}", "func (ep *eventsProvider) List(pageParams ...interface{}) ([]*events.Item, error) {\n\titems := make([]*events.Item, len(ep.Data))\n\n\tep.mutex.RLock()\n\tdefer ep.mutex.RUnlock()\n\tcopy(items, ep.Data)\n\n\treturn items, nil\n}", "func HomePageList(c *server.Context) error {\n\tvar (\n\t\terr error\n\t\tres []ware.BriefInfo\n\t\tidReq struct {\n\t\t\tLastID uint32 `json:\"last_id\"`\n\t\t}\n\t)\n\n\terr = c.JSONBody(&idReq)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrInvalidParam, nil)\n\t}\n\n\terr = c.Validate(idReq)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrInvalidParam, nil)\n\t}\n\n\tconn, err := mysql.Pool.Get()\n\tdefer mysql.Pool.Release(conn)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrMysql, nil)\n\t}\n\n\tres, err = ware.Service.HomePageList(conn, idReq.LastID)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrMysql, nil)\n\t}\n\n\treturn core.WriteStatusAndDataJSON(c, constants.ErrSucceed, res)\n}", "func (c *AuditEventClient) List(ctx context.Context, opts *AuditEventListOptions) ([]*resource.AuditEvent, *Pager, error) {\n\tif opts == nil {\n\t\topts = NewAuditEventListOptions()\n\t}\n\tvar res resource.AuditEventList\n\terr := c.client.get(ctx, path.Format(\"/v3/audit_events?%s\", opts.ToQueryString()), &res)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tpager := NewPager(res.Pagination)\n\treturn res.Resources, pager, nil\n}", "func (s priceEntriesService) List(ctx context.Context, paginationOpt common.PaginationOption, sortOpts common.SortOptions) (model.PriceEntries, error) {\n\treturn s.storage.PriceImport().GetPriceEntries(ctx, sortOpts, paginationOpt)\n}", "func (r *Replenish) List(args *Replenish) (*ReplenishList, error) {\n\taction := \"sales.replenish.list.get\"\n\tdata, err := json.Marshal(args)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbody, err := mafengwo.NewDeals().Fetch(action, data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := ReplenishList{}\n\terr = json.Unmarshal(body, &result)\n\treturn &result, err\n}", "func GetHealth(w http.ResponseWriter, r *http.Request, db *sqlx.DB) {\n\tparams := mux.Vars(r)\n\n\thealth := []Health{}\n\n\tvar err error\n\n\tsession, err := store.Get(r, \"auth\")\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Convert our session data into an instance of User\n\tuser := User{}\n\tuser, _ = session.Values[\"user\"].(User)\n\n\tif user.Username != \"\" && user.AccessLevel == \"admin\" {\n\t\tif _, ok := params[\"id\"]; ok {\n\t\t\terr = db.Select(&health, \"SELECT id, username, ts, variable, value \"+\n\t\t\t\t\"FROM public.health \"+\n\t\t\t\t\"WHERE id = $1 \", params[\"id\"])\n\t\t} else if _, ok = params[\"ts\"]; ok {\n\t\t\terr = db.Select(&health, \"SELECT id, username, ts, variable, value \"+\n\t\t\t\t\"FROM public.health \"+\n\t\t\t\t\"WHERE ts = $1 \", params[\"ts\"])\n\t\t} else if _, ok = params[\"variable\"]; ok {\n\t\t\terr = db.Select(&health, \"SELECT id, username, ts, variable, value \"+\n\t\t\t\t\"FROM public.health \"+\n\t\t\t\t\"WHERE variable = $1 \", params[\"variable\"])\n\t\t} else {\n\t\t\terr = db.Select(&health, \"SELECT id, username, ts, variable, value \"+\n\t\t\t\t\"FROM public.health \")\n\t\t}\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tw.WriteHeader(http.StatusOK)\n\n\t\tif err := json.NewEncoder(w).Encode(health); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t} else {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tw.WriteHeader(http.StatusOK)\n\n\t\tif err := json.NewEncoder(w).Encode(\"access denied\"); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\tlogRequest(r)\n}", "func (m *SeaterModel) ListMeetings(params QueryParams) (meetings []*Meeting, err error) {\n\to := m.Orm()\n\n\tmeetings = make([]*Meeting, 0, PagingDefaultLimit)\n\n\tqs := o.QueryTable(new(Meeting))\n\tif params != nil {\n\t\tqs = qs.SetCond(params.Condition())\n\t}\n\n\tqs = qs.OrderBy(\"-ID\")\n\t_, err = m.PagingAll(params, qs, &meetings)\n\tif err == orm.ErrNoRows {\n\t\treturn meetings, nil\n\t} else if err != nil {\n\t\terr = errors.Trace(err)\n\t\treturn\n\t}\n\n\treturn\n}", "func (a *HyperflexApiService) GetHyperflexHealthCheckExecutionList(ctx context.Context) ApiGetHyperflexHealthCheckExecutionListRequest {\n\treturn ApiGetHyperflexHealthCheckExecutionListRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (s *democrdLister) List(selector labels.Selector) (ret []*v1.Democrd, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.Democrd))\n\t})\n\treturn ret, err\n}", "func (us ChapterService) List(dto dto.GeneralListDto) ([]model.Chapter, int64) {\n\treturn chapterDao.List(dto)\n}", "func (db *DB) List(table jdh.Table, args *jdh.Values) (jdh.ListScanner, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"empty argument list\")\n\t}\n\tconn, err := net.Dial(\"tcp\", db.port)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tenc := json.NewEncoder(conn)\n\treq := &Request{\n\t\tQuery: jdh.List,\n\t\tTable: table,\n\t\tKvs: args.KV,\n\t}\n\tenc.Encode(req)\n\tdec := json.NewDecoder(conn)\n\tans := &Answer{}\n\tif err := dec.Decode(ans); err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := ans.GetMessage(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &listScanner{c: conn, d: dec}, nil\n}", "func listSuggestions(q Queryable, mpID uint64, date time.Time) (suggs []*mpdata.Suggestion, err error) {\n\trows, err := q.Query(\"SELECT meal.id, meal.name, meal.recipe, meal.favourite, MIN(ABS(DATEDIFF(serving.dateserved, ?))) FROM meal LEFT JOIN serving ON meal.id = serving.mealid GROUP BY meal.id\", date)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tmeal := new(mpdata.Meal)\n\t\tsugg := new(mpdata.Suggestion)\n\t\tsugg.MT.Meal = meal\n\n\t\tvar csd sql.NullInt64\n\n\t\terr = rows.Scan(&meal.ID, &meal.Name, &meal.RecipeURL, &meal.Favourite, &csd)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif csd.Valid && csd.Int64 != 0 {\n\t\t\tsugg.CSD = int(csd.Int64)\n\t\t} else {\n\t\t\tsugg.CSD = -1\n\t\t}\n\n\t\tsuggs = append(suggs, sugg)\n\t}\n\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn suggs, nil\n}", "func (s *runnablesrvc) List(ctx context.Context, p *runnable.ListPayload) (res []*runnable.Runnable, err error) {\n\ts.logger.Print(\"runnable.list\")\n\tidQuery := \"\"\n\tif p.ID != nil {\n\t\tidQuery = *p.ID\n\t}\n\tkindQuery := \"\"\n\tif p.Kind != nil {\n\t\tkindQuery = *p.Kind\n\t}\n\titems, err := s.store.Find(ctx, idQuery, kindQuery, p.Labels)\n\tres = make([]*runnable.Runnable, 0, len(items))\n\tfor _, r := range items {\n\t\tres = append(res, runnableDomainToRest(r))\n\t}\n\treturn res, err\n}", "func (db *DB) List(glob string) ([]Entry, error) {\n\t// FIXME: first-pass - ignore glob\n\tmappings, err := db.readDB()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Extract codes and sort\n\tcodes := make([]string, len(mappings))\n\ti := 0\n\tfor code := range mappings {\n\t\tcodes[i] = code\n\t\ti++\n\t}\n\tsort.Strings(codes)\n\n\t// Compile entries\n\tvar entries = make([]Entry, len(mappings))\n\ti = 0\n\tfor _, code := range codes {\n\t\tentries[i] = Entry{Code: code, Url: mappings[code]}\n\t\ti++\n\t}\n\n\treturn entries, nil\n}", "func listEmployees() {\n\tif emptyEmployeeDB() {\n\t\tfmt.Println(\"EmployeeDB Empty\")\n\t} else {\n\t\tfmt.Println(\"# Employee Name Age Salary\")\n\t\tfmt.Println(\"===================================================\")\n\t\tfor i, n := 1, edb.elist.head; n != nil; i, n = i+1, n.next {\n\t\t\tfmt.Printf(\"\\n %2d. %-20s %-10d %10s\", i, n.emp.name, n.emp.age, int32InsertComma(n.emp.salary))\n\t\t}\n\t\tfmt.Printf(\"\\n\");\n\t}\t\n}", "func getLoan(l *models.Loan, db *gorm.DB) error {\n\terr := db.Select(\"id,created_at,updated_at,initial_value,interest,quota,balance,cod_loan_state,cod_client,cod_collection,cod_user\").First(l).GetErrors()\n\tif len(err) != 0 {\n\t\treturn errors.New(\"no se encuentra\")\n\t}\n\treturn nil\n}", "func (hm *HelmManager) ListChart(ctx context.Context,\n\treq *helmmanager.ListChartReq, resp *helmmanager.ListChartResp) error {\n\n\tdefer recorder(ctx, \"ListChart\", req, resp)()\n\taction := actionChart.NewListChartAction(hm.model, hm.platform)\n\treturn action.Handle(ctx, req, resp)\n}" ]
[ "0.6793589", "0.63662523", "0.63374996", "0.6103", "0.59037894", "0.5617607", "0.550038", "0.52984416", "0.51921606", "0.4919258", "0.49057636", "0.48713672", "0.4870926", "0.48581", "0.48579657", "0.48564038", "0.4812534", "0.47780845", "0.47510096", "0.47248134", "0.47170433", "0.46910217", "0.4679411", "0.46563303", "0.46525595", "0.4645543", "0.46262428", "0.46204937", "0.4609981", "0.46041298", "0.46003252", "0.45909652", "0.4578383", "0.45680794", "0.4556645", "0.45406154", "0.45404395", "0.4534347", "0.45275545", "0.45146295", "0.45026466", "0.4502466", "0.4499201", "0.44955045", "0.4494246", "0.44932082", "0.44827986", "0.44769278", "0.44759554", "0.44748795", "0.44660264", "0.44546634", "0.4438871", "0.44331825", "0.44328007", "0.44263557", "0.44096845", "0.4399762", "0.43982908", "0.43908945", "0.43845364", "0.43812016", "0.43664455", "0.4351241", "0.4350863", "0.43450844", "0.433351", "0.43331686", "0.4329955", "0.4329618", "0.43294686", "0.43251765", "0.43226346", "0.4320295", "0.43188134", "0.43164867", "0.4305867", "0.43017134", "0.4301154", "0.42933145", "0.42922", "0.42913038", "0.4290606", "0.4290242", "0.42869967", "0.42824686", "0.4278769", "0.42703488", "0.4263401", "0.42632785", "0.42627934", "0.42624176", "0.4261058", "0.42558676", "0.42461044", "0.42453474", "0.42377254", "0.4233173", "0.42311534", "0.42306677" ]
0.8378897
0
Rank returns how many nodes less than max value.
Rank возвращает количество узлов, значение которых меньше максимального значения.
func (t *Tree) Rank(max int) int { return rank(t.Tree, max) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t *Tree) Rank(val float64) int {\n\treturn t.root.Rank(val)\n}", "func (e *Election) Rank() []int {\n\tres := make([]int, e.N)\n\tfor i := 0; i < e.N; i++ {\n\t\tfor j := i + 1; j < e.N; j++ {\n\t\t\tr := e.cmp(i, j)\n\t\t\tif r < 0 {\n\t\t\t\tres[i]++\n\t\t\t} else if r > 0 {\n\t\t\t\tres[j]++\n\t\t\t}\n\t\t}\n\t}\n\treturn res\n}", "func pageRank(n int64) int {\n\tif n <= maxSlot {\n\t\tpanic(fmt.Errorf(\"internal error: pageRank(%v)\", n))\n\t}\n\n\tr := int(roundup64(n, pageSize)>>pageBits) + 6\n\tif r >= ranks {\n\t\tr = ranks - 1\n\t}\n\treturn r\n}", "func (lt sdkLinkType) rank() int {\n\treturn int(lt)\n}", "func (alg *TopologicalSorter[V]) Rank(vtx V) (int, bool) {\n\tr, ok := alg.ranks[vtx]\n\treturn r, ok\n}", "func (g *graph) find_max_value(chk *checklist) int {\n\tcurrent := 0\n\tidx := -1\n\tfor i,c := range chk.nodes_count {\n\t\tif c > current {\n\t\t\tidx = i\n\t\t\tcurrent = c\n\t\t}\n\t}\n\tif idx >= 0 { chk.nodes_count[idx] = -1 }\n\treturn idx\n}", "func RankLTE(v int) predicate.Transactionfactoritemtmp {\n\treturn predicate.Transactionfactoritemtmp(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldRank), v))\n\t})\n}", "func MapRankToScore(rank, size int) float64 { return float64(size - rank) }", "func GetRank(name string) int {\n\trank := 0\n\n\tfor point := len(ranks)-1; point >= 0; point-- {\n\t\tif len(ranks[point]) > 0 {\n\t\t\trank++\n\n\t\t\tif found, _, _ := Search(ranks[point], name); found {\n\t\t\t\treturn rank\n\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn rank\n}", "func (z *Skiplist) RankOfLastInRange(spec RangeSpec) int {\n\tif !z.isInRange(spec) {\n\t\treturn -1\n\t}\n\n\tlastNodeRank := -1\n\tx := z.head\n\tfor i := z.level - 1; i >= 0; i-- {\n\t\tfor x.level[i].forward != nil && spec.lteMax(x.level[i].forward.ordered) {\n\t\t\tlastNodeRank += x.level[i].span\n\t\t\tx = x.level[i].forward\n\t\t}\n\t}\n\n\tif !spec.gteMin(x.ordered) {\n\t\treturn -1\n\t}\n\n\treturn lastNodeRank\n}", "func (wf WindowFrame) Rank() int {\n\treturn wf.RowIdx + 1\n}", "func (r *SlidingWindow) Max() int {return r.base + len(r.values) - 1}", "func CalcRank(n *Node, parent *Node, position int) (*Node, error) {\n\t//\n\tr := uint32(1)\n\tfor i := 0; i < n.ChildCount(); i++ {\n\t\tch, ok := n.Child(i)\n\t\tif ok {\n\t\t\tr += ch.Rank\n\t\t}\n\t}\n\tn.Rank = r\n\treturn n, nil\n}", "func (m *SecureScoreControlProfile) GetRank()(*int32) {\n return m.rank\n}", "func IntRank(x []int, r []int) []int {\n\treturn Rank(make_int_index_slice(x), r)\n}", "func (m *SecureScoreControlProfile) GetRank()(*int32) {\n val, err := m.GetBackingStore().Get(\"rank\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "func Rank(scope *Scope, input tf.Output) (output tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"Rank\",\n\t\tInput: []tf.Input{\n\t\t\tinput,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (m *UserMutation) Rank() (r float64, exists bool) {\n\tv := m.rank\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "func (rn *RangedNumber) Max() int {\n\tif rn.min > rn.max {\n\t\trn.Set(rn.max, rn.min)\n\t}\n\n\treturn rn.max\n}", "func Rank(v int) predicate.Transactionfactoritemtmp {\n\treturn predicate.Transactionfactoritemtmp(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldRank), v))\n\t})\n}", "func (p *P1D) Rank() int {\n\treturn 1\n}", "func (n *Node) Max() int {\n\tif n.Right == nil {\n\t\treturn n.Key\n\t}\n\n\treturn n.Right.Max()\n}", "func (t *Tree) Rank(rank int) (id int32, node *Node) {\n\treturn lookup_node(t.root, rank)\n}", "func GetRank(rank int) *RankData {\n\tfor _, rankData := range ranks {\n\t\tif rank < rankData.NextRank || rankData.NextRank < 0 {\n\t\t\treturn rankData\n\t\t}\n\t}\n\treturn nil\n}", "func (z *zset) Rank(member string) int {\n\tscore, ex := z.tbl[member]\n\tif !ex {\n\t\treturn 0\n\t}\n\tvar obj C.slobj\n\tobj.ptr, obj.length = tocstring(member)\n\trank := C.slGetRank(z.sl, C.double(score), &obj)\n\treturn int(rank)\n}", "func IntStableRank(x []int, r []int) []int {\n\treturn StableRank(make_int_index_slice(x), r)\n}", "func (r GroupSortedSet) ZRevRank(ctx context.Context, key string, member interface{}) (int64, error) {\n\tv, err := r.redis.Do(ctx, \"ZRevRank\", key, member)\n\treturn v.Int64(), err\n}", "func (BinP1D) Rank() int { return 1 }", "func (z *Skiplist) RankOfFirstInRange(spec RangeSpec) int {\n\t_, firstNodeRanks := z.firstNodeInRange(spec)\n\tif firstNodeRanks == nil {\n\t\treturn -1\n\t}\n\treturn firstNodeRanks[0]\n}", "func (e *Election) Condorcet() int {\n\tmax := 0\n\timax := 0\n\te.R = e.Rank()\n\tfor i, v := range e.R {\n\t\tif v > max {\n\t\t\timax = i\n\t\t\tmax = v\n\t\t}\n\t}\n\n\tf := false\n\tfor _, v := range e.R {\n\t\tif v == max {\n\t\t\tif f {\n\t\t\t\treturn -1\n\t\t\t}\n\t\t\tf = true\n\t\t}\n\t}\n\n\treturn imax\n}", "func slotRank(n int) int {\n\tif n < 1 || n > 1024 {\n\t\tpanic(fmt.Errorf(\"internal error: slotRank(%v)\", n))\n\t}\n\n\treturn log(roundup(n, allocAllign)) - 4\n}", "func (treeNode *TreeNode) FindMax() int {\n\tif treeNode.right == nil {\n\t\treturn treeNode.value\n\t}\n\n\treturn treeNode.right.FindMax()\n}", "func (r *ImageRef) Rank(width int, height int, index int) error {\n\tout, err := vipsRank(r.image, width, height, index)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.setImage(out)\n\treturn nil\n}", "func (ap *AnimeParser) getRank(eachTop *goquery.Selection) int {\n\trank := eachTop.Find(\"td\").First().Find(\"span\").Text()\n\treturn utils.StrToNum(rank)\n}", "func (t *Tree) Size(lo, hi int) int {\n\tresult := rank(t.Tree, hi) - rank(t.Tree, lo)\n\tif contains(t.Tree, hi) {\n\t\tresult++\n\t}\n\treturn result\n}", "func (self *Limits) Maximum() uint32 {\n\treturn uint32(self.inner().max)\n}", "func Rank(comm Comm) (int, error) {\n\tvar r C.int\n\tperr := C.MPI_Comm_rank(C.MPI_Comm(comm), &r)\n\tif perr != 0 {\n\t\treturn -1, errors.New(\"Error calling MPI_Comm_rank\")\n\t}\n\treturn int(r), nil\n}", "func (r GroupSortedSet) ZRank(ctx context.Context, key string, member interface{}) (int64, error) {\n\tv, err := r.redis.Do(ctx, \"ZRank\", key, member)\n\treturn v.Int64(), err\n}", "func (h *MaxHeap) Max() int {\n\tif h.IsEmpty() {\n\t\treturn -1\n\t}\n\treturn h.data[1]\n}", "func rankedWeaponPoints(skillLevel int, rank int, cfg npcdefs.NPCCfg) int {\n\tif rank >= maxWeaponCount {\n\t\treturn 0\n\t}\n\n\t// Calculate points assuming rank 0.\n\tpoints := itemPoints(skillLevel, cfg.WeaponPPLMin, cfg.WeaponPPLMax)\n\n\t// Subtract points for higher ranked weapons.\n\tpoints -= int(float64(rank) * weaponRankDifference)\n\n\tif points < 0 {\n\t\tpoints = 0\n\t}\n\n\treturn points\n}", "func FloatRank(x []float64, r []int) []int {\n\treturn Rank(make_float64_index_slice(x), r)\n}", "func (cc Counter) Rank() []RGB {\n\tcolors := []RGB{}\n\tfor rgb := range cc {\n\t\tcolors = append(colors, rgb)\n\t}\n\tless := func(i, j int) bool {\n\t\tiColor := colors[i]\n\t\tjColor := colors[j]\n\t\tiCount := cc[iColor]\n\t\tjCount := cc[jColor]\n\t\treturn iCount < jCount\n\t}\n\tsort.Slice(colors, less)\n\treturn colors\n}", "func (r Results) Max() int {\n\tmax := 0\n\n\tfor _, result := range r {\n\t\tm := result.Max()\n\t\tif m > max {\n\t\t\tmax = m\n\t\t}\n\t}\n\n\treturn max\n}", "func (bst *BinarySearch) Max() (int, error) {\n\tbst.lock.RLock()\n\tdefer bst.lock.RUnlock()\n\n\tn := bst.root\n\tif n == nil {\n\t\treturn 0, fmt.Errorf(\"max: no nodes exist in tree\")\n\t}\n\tfor {\n\t\tif n.right == nil {\n\t\t\treturn n.value, nil\n\t\t}\n\t\tn = n.right\n\t}\n}", "func (sm *scoreMemberMap) count(min, max float64) int {\n\tn := 0\n\tfor cur := sm.head; cur != nil && cur.score <= max; cur = cur.next {\n\t\tif cur.score >= min {\n\t\t\tn += len(cur.members)\n\t\t}\n\t}\n\treturn n\n}", "func Max(Len int, Less func(i, j int) bool) int {\n\tmx := 0\n\tfor i := 1; i < Len; i++ {\n\t\tif Less(mx, i) {\n\t\t\tmx = i\n\t\t}\n\t}\n\treturn mx\n}", "func (tree *Tree23) minmaxDepth(t TreeNodeIndex) (int, int) {\n\tif tree.IsEmpty(t) {\n\t\treturn 0, 0\n\t}\n\tif tree.IsLeaf(t) {\n\t\treturn 1, 1\n\t}\n\tdepthMin := -1\n\tdepthMax := -1\n\n\tfor i := 0; i < tree.treeNodes[t].cCount; i++ {\n\t\tc := tree.treeNodes[t].children[i]\n\t\tmin, max := tree.minmaxDepth(c.child)\n\t\tif depthMin == -1 || min < depthMin {\n\t\t\tdepthMin = min + 1\n\t\t}\n\t\tif depthMax == -1 || max > depthMax {\n\t\t\tdepthMax = max + 1\n\t\t}\n\t}\n\treturn depthMin, depthMax\n}", "func (px *Paxos) Max() int {\n\t// Your code here.\n\n\treturn len(px.acceptor) - 1\n}", "func minScore(hand ...deck.Card) int {\n\tscore := 0\n\tfor _, c := range hand {\n\t\t// because J, Q, K has rank 11, 12, 13..\n\t\t// we'll either add 10 or less than 10\n\t\tscore += min(int(c.Rank), 10)\n\t}\n\treturn score\n}", "func (ng *NodeGroup) MaxSize() int {\n\treturn int(ng.MaxNodes)\n}", "func RankGT(v int) predicate.Transactionfactoritemtmp {\n\treturn predicate.Transactionfactoritemtmp(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldRank), v))\n\t})\n}", "func Test_GetRank(t *testing.T) {\n\n\t// 项目开始时间 2017-06-01\n\tprojectStartTime, _ := time.Parse(\"2006-01-02\", \"2017-06-01\")\n\tfund := projectStartTime.Unix() - 8*3600\n\tsurvivalTime := timestamp - fund\n\n\t// 投票方向与时间造成的系数差\n\tvar timeMagin int64\n\tif voteDiff > 0 {\n\t\ttimeMagin = survivalTime / 45000\n\t} else if voteDiff < 0 {\n\t\ttimeMagin = -1 * survivalTime / 45000\n\t} else {\n\t\ttimeMagin = 0\n\t}\n\n\tvateMagin := math.Log10(voteDispute)\n\n\t//详细算法\n\tsocre := vateMagin + float64(timeMagin)\n}", "func MRRank(p []int) (r int) {\n\tp = append([]int{}, p...)\n\tinv := inverse(p)\n\tfor i := len(p) - 1; i > 0; i-- {\n\t\ts := p[i]\n\t\tp[inv[i]] = s\n\t\tinv[s] = inv[i]\n\t}\n\tfor i := 1; i < len(p); i++ {\n\t\tr = r*(i+1) + p[i]\n\t}\n\treturn\n}", "func (px *Paxos) Max() int {\n\t// Your code here.\n\tmax := -1\n\thead := px.prepareStatus.Head\n\tfor head.Next != nil {\n\t\tstate := head.Next\n\t\tif max < state.Seq {\n\t\t\tmax = state.Seq\n\t\t}\n\t\thead = head.Next\n\t}\n\treturn max\n}", "func (o *ClusterRequest) GetMaxRunningNodes() int32 {\n\tif o == nil || o.MaxRunningNodes == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.MaxRunningNodes\n}", "func maxDepth(n int) types.Depth {\r\n\tvar depth types.Depth\r\n\tfor i := n; i > 0; i >>= 1 {\r\n\t\tdepth++\r\n\t}\r\n\treturn depth * 2\r\n}", "func (obj *set) Rank() SetRank {\n\treturn obj.rank\n}", "func (n *Network) MaxDepth() (int, error) {\n\tmax := 0 // The max depth\n\tfor _, node := range n.Outputs {\n\t\tcurr_depth, err := node.Depth(0)\n\t\tif err != nil {\n\t\t\treturn curr_depth, err\n\t\t}\n\t\tif curr_depth > max {\n\t\t\tmax = curr_depth\n\t\t}\n\t}\n\treturn max, nil\n}", "func maxOfMinSlidingWindows(arr []int, k int) {\n\tsize := len(arr)\n\tque := new(Queue)\n\tmaxVal := math.MinInt32\n\ti := 0\n\tfor i < size {\n\t\t// Remove out of range elements\n\t\tif que.Len() > 0 && que.Front().(int) <= i-k {\n\t\t\tque.Remove()\n\t\t}\n\t\t// Remove smaller values at left.\n\t\tfor que.Len() > 0 && arr[que.Back().(int)] >= arr[i] {\n\t\t\tque.RemoveBack()\n\t\t}\n\t\tque.Add(i)\n\t\t// window of size k\n\t\tif i >= (k-1) && maxVal < arr[que.Front().(int)] {\n\t\t\tmaxVal = arr[que.Front().(int)]\n\t\t}\n\t\ti += 1\n\t}\n\tfmt.Println(\"Max of min is:\", maxVal)\n}", "func (tree *Tree23) max(t TreeNodeIndex) float64 {\n\tif tree.IsLeaf(t) {\n\t\treturn tree.treeNodes[t].elem.ExtractValue()\n\t}\n\tc := tree.treeNodes[t].cCount - 1\n\treturn tree.treeNodes[t].children[c].maxChild\n}", "func (sm *StackMax) Max() (int, error) {\n\tif sm.Empty() {\n\t\treturn -1, ErrstackEmpty\n\t}\n\treturn sm.maxer[sm.length-1], nil\n}", "func max(d dataSet) int {\n\treturn d[len(d)-1]\n}", "func (m *SecureScoreControlProfile) SetRank(value *int32)() {\n m.rank = value\n}", "func GetNumberOfNodes() int64 {\r\n\treturn int64(len(nodesByPosition))\r\n}", "func (fn *formulaFuncs) RANK(argsList *list.List) formulaArg {\n\treturn fn.rank(\"RANK\", argsList)\n}", "func rmax(data ArrType) float64 {\r\n\tvar i, idxCari, idxMax int\r\n\ti = 0\r\n\tidxCari = 1\r\n\tidxMax = 0\r\n\tfor i < N-1 { // N-1 karena idxCari = i + 1 sehingga data terakhir masih diperhitungkan\r\n\t\tif data[idxCari].f3 > data[idxMax].f3 {\r\n\t\t\tidxMax = idxCari\r\n\t\t}\r\n\t\tidxCari++\r\n\t\ti++\r\n\t}\r\n\treturn data[idxMax].f3\r\n}", "func (tree *BinarySearchTree) MaxNode() *int {\n\ttree.lock.RLock()\n\tdefer tree.lock.RUnlock()\n\tvar treeNode *TreeNode\n\ttreeNode = tree.rootNode\n\tif treeNode == nil {\n\t\t//nil instead of 0\n\t\treturn (*int)(nil)\n\t}\n\tfor {\n\t\tif treeNode.rightNode == nil {\n\t\t\treturn &treeNode.value\n\t\t}\n\t\ttreeNode = treeNode.rightNode\n\t}\n}", "func (px *Paxos) Max() int {\n\tkeys := px.sortedSeqs()\n\tif len(keys) == 0 {\n\t\treturn -1\n\t} else {\n\t\tsort.Ints(keys)\n\t}\n\treturn keys[len(keys)-1]\n}", "func (r Result) Max() int {\n\treturn len(r.Ints()) * r.Die().Max().N\n}", "func (px *Paxos) Max() int {\n\t// Your code here.\n\treturn px.max\n}", "func (n *hetznerNodeGroup) MaxSize() int {\n\treturn n.maxSize\n}", "func FetchMax(t *treeNode) int {\n\tif t.Right == nil {\n\t\treturn t.Value\n\t}\n\treturn FetchMax(t.Right)\n}", "func max(x int) int {\n\treturn 40 + x\n}", "func getOffsetNodeCount(nodeCount uint64, offset int64, rounder func(float64) float64) uint64 {\n\treturn uint64(int64(nodeCount) + int64(rounder(float64(nodeCount)*float64(offset)/100)))\n}", "func (v *VEBTree) Maximum() int {\n\treturn v.max\n}", "func (s *Stack) Max() (int, error) {\n\tif s.Empty() {\n\t\treturn -1, ErrstackEmpty\n\t}\n\n\thelpStack := Stack{}\n\tmax, _ := s.Top()\n\n\tfor !s.Empty() {\n\t\ttop, _ := s.Pop()\n\t\tif top > max {\n\t\t\tmax = top\n\t\t}\n\t\thelpStack.Push(top)\n\t}\n\n\tfor !helpStack.Empty() {\n\t\ttop, _ := helpStack.Pop()\n\t\ts.Push(top)\n\t}\n\n\treturn max, nil\n}", "func RankWatchlistLTE(v int) predicate.Watchlist {\n\treturn predicate.Watchlist(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldRankWatchlist), v))\n\t})\n}", "func (lc *LineChart) maxXValue() int {\n\tmaxLen := 0\n\tfor _, sv := range lc.series {\n\t\tif l := len(sv.values); l > maxLen {\n\t\t\tmaxLen = l\n\t\t}\n\t}\n\tif maxLen == 0 {\n\t\treturn 0\n\t}\n\treturn maxLen - 1\n}", "func (np *NodePool) MaxNodes() int32 {\n\treturn np.maxNodes\n}", "func (rr rowRangeSlice) maxEntry() int {\n\tif len(rr) == 0 {\n\t\treturn math.MaxInt64\n\t}\n\n\tvar max int\n\tfor _, r := range rr {\n\t\tif max < r.e {\n\t\t\tmax = r.e\n\t\t}\n\t}\n\treturn max\n}", "func (px *Paxos) Max() int {\n\t// Your code here.\n\treturn px.curMax\n}", "func (s *Stat) GetMax() float64 {\n\tif s.n <= 0 {\n\t\treturn 0.0\n\t}\n\treturn s.max\n}", "func getMinMaxScores(scores framework.NodeScoreList) (int64, int64) {\n\tvar max int64 = math.MinInt64 // Set to min value\n\tvar min int64 = math.MaxInt64 // Set to max value\n\n\tfor _, nodeScore := range scores {\n\t\tif nodeScore.Score > max {\n\t\t\tmax = nodeScore.Score\n\t\t}\n\t\tif nodeScore.Score < min {\n\t\t\tmin = nodeScore.Score\n\t\t}\n\t}\n\t// return min and max scores\n\treturn min, max\n}", "func findMax(number []int, max int) (int, func() []int) {\n\tvar res []int\n\tfor _, p := range number {\n\t\tif p <= max {\n\t\t\tres = append(res, p)\n\t\t}\n\t}\n\n\treturn len(res), func() []int {\n\t\treturn res\n\t}\n}", "func FindKthMax(nums []int, k int) (int, error) {\n\tindex := len(nums) - k\n\treturn kthNumber(nums, index)\n}", "func MinMax(x, min, max int) int { return x }", "func maxDepth(root *TreeNode) int {\n\tif root == nil {\n\t\treturn 0\n\t}\n\n\treturn max(maxDepth(root.Left), maxDepth(root.Right)) + 1\n}", "func (clus *Cluster) maxRev() (rev int64, err error) {\n\tctx, cancel := context.WithTimeout(context.TODO(), time.Second)\n\tdefer cancel()\n\trevc, errc := make(chan int64, len(clus.Members)), make(chan error, len(clus.Members))\n\tfor i := range clus.Members {\n\t\tgo func(m *rpcpb.Member) {\n\t\t\tmrev, merr := m.Rev(ctx)\n\t\t\trevc <- mrev\n\t\t\terrc <- merr\n\t\t}(clus.Members[i])\n\t}\n\tfor i := 0; i < len(clus.Members); i++ {\n\t\tif merr := <-errc; merr != nil {\n\t\t\terr = merr\n\t\t}\n\t\tif mrev := <-revc; mrev > rev {\n\t\t\trev = mrev\n\t\t}\n\t}\n\treturn rev, err\n}", "func Max(x, y int) int {\n\tif x < y {\n\t\treturn y\n\t}\n\treturn x\n}", "func max(v ...int) int {\n\tout := 0\n\tfor i := range v {\n\t\tif v[i] > out {\n\t\t\tout = v[i]\n\t\t}\n\t}\n\treturn out\n}", "func GlobalRank(url string) (string, error) {\n\telement := get(url, \"POPULARITY\")\n\tif len(element.Attr) >= 2 {\n\t\treturn element.Attr[1].Value, nil\n\t} else {\n\t\treturn \"No rank\", nil\n\t}\n}", "func (r *Ranker) Rank(layerName string, props geojson.Properties) int {\n\tlayer, ok := r.matchers[layerName]\n\tif !ok {\n\t\treturn r.catchAll\n\t}\n\n\tmatchers, ok := layer[props.MustString(\"kind\", \"\")]\n\tif !ok {\n\t\treturn r.catchAll\n\t}\n\tmatchers = append(matchers, layer[\"\"]...) // include matchers with no kind\n\n\tfor _, m := range matchers {\n\t\tif m.Eval(props) {\n\t\t\treturn m.rank\n\t\t}\n\t}\n\n\treturn r.catchAll\n}", "func CalculatePageRank(d float64, pages *map[string]*crawler.Page) {\n\tfor i := 0; i < 1000; i++ {\n\t\t// converge := make([]bool, 0)\n\t\t// for i := 0; i < len(*pages); i++ {\n\t\t// \tconverge[i] = false\n\t\t// }\n\t\tfor _, page := range *pages {\n\t\t\tvar myRank float64 = 1 - d // value for page rank\n\t\t\tvar runningSum float64 = 0 // running sum for probablity from its parents\n\t\t\tfor _, p := range page.GetParentURL() {\n\t\t\t\tparentPage, ok := (*pages)[p]\n\t\t\t\tif ok {\n\t\t\t\t\tvar parentPR float64 = parentPage.GetPageRank()\n\t\t\t\t\tparentTotalChild := float64(len(parentPage.GetChildrenURL()))\n\t\t\t\t\trunningSum += (parentPR / parentTotalChild)\n\t\t\t\t}\n\t\t\t}\n\t\t\tmyRank = myRank + d*runningSum\n\t\t\tdifference := myRank - page.GetPageRank()\n\t\t\tif math.Abs(difference) < 0.00000000000005 { // showing signs of converging\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tpage.SetRank(myRank)\n\t\t}\n\t}\n}", "func maxMin(k int32, arr []int32) int32 {\n\n\tif k <= 1 {\n\t\treturn 0\n\t}\n\tsort.Slice(arr, func(i, j int) bool {\n\t\treturn arr[i] > arr[j]\n\t})\n\n\tmaxval := int32(^(uint32(0)) >> 1)\n\tminUnfairness := maxval\n\n\tfor i, num := range arr {\n\t\tif i+int(k) > len(arr) {\n\t\t\tbreak\n\t\t}\n\t\tcurrUnfairness := num - arr[i+int(k)-1]\n\t\tif currUnfairness < minUnfairness {\n\t\t\tminUnfairness = currUnfairness\n\t\t}\n\t}\n\n\tif minUnfairness == maxval {\n\t\treturn 0\n\t}\n\treturn minUnfairness\n\n}", "func (o KubernetesClusterDefaultNodePoolPtrOutput) MaxCount() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *KubernetesClusterDefaultNodePool) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MaxCount\n\t}).(pulumi.IntPtrOutput)\n}", "func nmax(a ...int) int {\n\tret := a[0]\n\tfor _, e := range a {\n\t\tret = max(ret, e)\n\t}\n\treturn ret\n}", "func nmax(a ...int) int {\n\tret := a[0]\n\tfor _, e := range a {\n\t\tret = max(ret, e)\n\t}\n\treturn ret\n}", "func nmax(a ...int) int {\n\tret := a[0]\n\tfor _, e := range a {\n\t\tret = max(ret, e)\n\t}\n\treturn ret\n}", "func nmax(a ...int) int {\n\tret := a[0]\n\tfor _, e := range a {\n\t\tret = max(ret, e)\n\t}\n\treturn ret\n}", "func nmax(a ...int) int {\n\tret := a[0]\n\tfor _, e := range a {\n\t\tret = max(ret, e)\n\t}\n\treturn ret\n}" ]
[ "0.67093927", "0.65358585", "0.64453703", "0.62586796", "0.62451345", "0.62282676", "0.6174461", "0.6084651", "0.59903634", "0.5844654", "0.5832536", "0.580517", "0.567707", "0.561967", "0.5608135", "0.5576382", "0.55679417", "0.5543277", "0.5539918", "0.550763", "0.5503924", "0.5482265", "0.5467747", "0.5434056", "0.541868", "0.5413205", "0.5380868", "0.536446", "0.5347447", "0.53414875", "0.5317133", "0.5311805", "0.527282", "0.5269417", "0.52532184", "0.5247673", "0.52436334", "0.5237889", "0.52369064", "0.52315706", "0.52305335", "0.5228583", "0.52278197", "0.5179761", "0.51662517", "0.51563627", "0.5139808", "0.5137266", "0.5134971", "0.5132026", "0.5089774", "0.50761294", "0.50752497", "0.5066048", "0.50636744", "0.5061616", "0.50584537", "0.50509316", "0.5025953", "0.5023258", "0.5017729", "0.5015886", "0.5013042", "0.5011153", "0.5009476", "0.5003707", "0.500265", "0.4996488", "0.4995252", "0.49931136", "0.49888575", "0.4977312", "0.49613696", "0.4960196", "0.49579227", "0.49539647", "0.49488625", "0.49470156", "0.49398068", "0.49173462", "0.49152306", "0.4908905", "0.48988512", "0.4877898", "0.4870866", "0.48635316", "0.4858513", "0.48486316", "0.4843581", "0.48367274", "0.4835198", "0.48324525", "0.4822173", "0.48205993", "0.48190722", "0.48178476", "0.48178476", "0.48178476", "0.48178476", "0.48178476" ]
0.7792387
0
RegisterChannelzServiceToServer registers the channelz service to the given server. Note: it is preferred to use the admin API ( instead to register Channelz and other administrative services.
RegisterChannelzServiceToServer регистрирует службу channelz на заданном сервере. Примечание: предпочтительнее использовать административный API (для регистрации Channelz и других административных служб.
func RegisterChannelzServiceToServer(s grpc.ServiceRegistrar) { channelzgrpc.RegisterChannelzServer(s, newCZServer()) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func RegisterServer(cb interface{}, s interface{}) {\n\tsvrName, _ := reflector.GetName(s)\n\tsvr := &grpcService{\n\t\tname: svrName,\n\t\tcb: cb,\n\t\tsvc: s,\n\t}\n\tgrpcServers = append(grpcServers, svr)\n}", "func (ss *storageServer) RegisterServer(args *storagerpc.RegisterArgs, reply *storagerpc.RegisterReply) error {\n\n\tss.registerLock.Lock()\n\tdefer ss.registerLock.Unlock()\n\n\tok := ss.initializer.Register(args.ServerInfo)\n\n\tif ok {\n\t\tss.nodes = ss.initializer.Flush()\n\t\tss.rangeChecker = nodes.NewNodeCollection(ss.nodes).RangeChecker(ss.selfNode.NodeID)\n\n\t\t*reply = storagerpc.RegisterReply{\n\t\t\tStatus: storagerpc.OK,\n\t\t\tServers: ss.nodes,\n\t\t}\n\t\tif !ss.ready {\n\t\t\tss.initConfChan <- nil\n\t\t}\n\t} else {\n\t\t*reply = storagerpc.RegisterReply{\n\t\t\tStatus: storagerpc.NotReady,\n\t\t\tServers: nil,\n\t\t}\n\t}\n\n\t// CAUTION! might have to return error\n\treturn nil\n\n}", "func (s *FluentdService) RegisterServer(server *grpc.Server) {\n\tpb.RegisterFluentdServer(server, s)\n}", "func RegisterSecurityCenterServer(s *grpc.Server, srv SecurityCenterServer) {\n\tsrc.RegisterSecurityCenterServer(s, srv)\n}", "func (b *Bot) RegisterServer(\n\tserver string, event string, handler interface{}) (int, error) {\n\n\tb.serversProtect.RLock()\n\tdefer b.serversProtect.RUnlock()\n\n\tif s, ok := b.servers[server]; ok {\n\t\ts.protect.RLock()\n\t\tdefer s.protect.RUnlock()\n\t\treturn s.dispatcher.Register(event, handler), nil\n\t}\n\treturn 0, errUnknownServerId\n}", "func RegisterMigrationServiceServer(s *grpc.Server, srv MigrationServiceServer) {\n\tsrc.RegisterMigrationServiceServer(s, srv)\n}", "func RegisterReachabilityServiceServer(s *grpc.Server, srv ReachabilityServiceServer) {\n\tsrc.RegisterReachabilityServiceServer(s, srv)\n}", "func RegisterServerBMServer(e *bm.Engine, server ServerBMServer) {\n\tServerSvc = server\n\te.GET(\"/server.service.v1.Server/Ping\", serverPing)\n\te.GET(\"/server.service.v1.Server/SayHello\", serverSayHello)\n\te.GET(\"/kratos-demo/say_hello\", serverSayHelloURL)\n}", "func RegisterClusterManagerServer(s *grpc.Server, srv ClusterManagerServer) {\n\tsrc.RegisterClusterManagerServer(s, srv)\n}", "func RegisterFooServiceServer(s *grpc.Server, srv FooServiceServer) {\n\tsrc.RegisterFooServiceServer(s, srv)\n}", "func RegisterServer(name string, c ServerCreator) {\n\tserverMap[name] = c\n}", "func (s *Service) RegisterGRPCService(g *grpc.Server) {\n}", "func (s *serviceImplpetstoreRest2GRPCPetStoreServiceserver) RunRegisterServerService(serv *grpc.Server, trigger *servInfo.Trigger) {\n\tservice := &serviceImplpetstoreRest2GRPCPetStoreServiceserver{\n\t\ttrigger: trigger,\n\t\tserviceInfo: serviceInfopetstoreRest2GRPCPetStoreServiceserver,\n\t}\n\tRegisterRest2GRPCPetStoreServiceServer(serv, service)\n}", "func RegisterSecretManagerServiceServer(s *grpc.Server, srv SecretManagerServiceServer) {\n\tsrc.RegisterSecretManagerServiceServer(s, srv)\n}", "func RegisterServer(conn *network.TcpConn, body []byte) (interface{}, error) {\n log.Println(\"RegisterServer:\", string(body))\n \n if conn.Status != network.ConnInit {\n result := \"has inited!\"\n return nil, errors.New(result)\n }\n\n\treq := protocol.IRegisterServer{}\n\terr := protocol.Decode(&req, body)\n\tres := &protocol.ORegisterServer{}\n\tif err != nil {\n\t\tresult := \"error!\"\n\t\treturn nil, errors.New(result)\n\t}\n \n\tserver := ServerInfo{\n ServerInfo:req.ServerInfo,\n\t\tConn: conn,\n\t}\n\n\tconn.AttachID = req.ServerID\n conn.Status = network.ConnRegister\n\tServerMgrInstance.Register(server)\n\treturn res, nil\n}", "func RegisterHealthServer(s grpc.ServiceRegistrar, srv HealthServer) {\n\tstr := &HealthService{\n\t\tCheck: srv.Check,\n\t\tWatch: srv.Watch,\n\t}\n\tRegisterHealthService(s, str)\n}", "func (auth *Auth) RegisterServer(s *grpc.Server) {\n\tapiv1.RegisterAuthenticatorServer(s, auth)\n}", "func (s SmesherService) RegisterService(server *Server) {\n\tpb.RegisterSmesherServiceServer(server.GrpcServer, s)\n}", "func RegisterModelCenterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ModelCenterServiceServer) error {\n\n\tmux.Handle(\"POST\", pattern_ModelCenterService_CreateRegisteredModel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ModelCenterService_CreateRegisteredModel_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ModelCenterService_CreateRegisteredModel_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PATCH\", pattern_ModelCenterService_UpdateRegisteredModel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ModelCenterService_UpdateRegisteredModel_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ModelCenterService_UpdateRegisteredModel_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PATCH\", pattern_ModelCenterService_DeleteRegisteredModel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ModelCenterService_DeleteRegisteredModel_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ModelCenterService_DeleteRegisteredModel_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_ModelCenterService_ListRegisteredModels_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ModelCenterService_ListRegisteredModels_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ModelCenterService_ListRegisteredModels_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_ModelCenterService_GetRegisteredModelDetail_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ModelCenterService_GetRegisteredModelDetail_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ModelCenterService_GetRegisteredModelDetail_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_ModelCenterService_CreateModelVersion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ModelCenterService_CreateModelVersion_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ModelCenterService_CreateModelVersion_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PATCH\", pattern_ModelCenterService_UpdateModelVersion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ModelCenterService_UpdateModelVersion_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ModelCenterService_UpdateModelVersion_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PATCH\", pattern_ModelCenterService_DeleteModelVersion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ModelCenterService_DeleteModelVersion_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ModelCenterService_DeleteModelVersion_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_ModelCenterService_GetModelVersionDetail_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ModelCenterService_GetModelVersionDetail_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ModelCenterService_GetModelVersionDetail_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func RegisterPayLiveBMServer(e *bm.Engine, server PayLiveBMServer) {\n\tv1PayLiveSvc = server\n\te.POST(\"/live.liveadmin.v1.PayLive/add\", payLiveAdd)\n\te.POST(\"/live.liveadmin.v1.PayLive/update\", payLiveUpdate)\n\te.GET(\"/live.liveadmin.v1.PayLive/getList\", payLiveGetList)\n\te.POST(\"/live.liveadmin.v1.PayLive/close\", payLiveClose)\n\te.POST(\"/live.liveadmin.v1.PayLive/open\", payLiveOpen)\n}", "func RegisterService(server *grpc.Server, service Backend) {\n\tserver.RegisterService(&serviceDesc, service)\n}", "func (s *Serverus) RegisterServer(fn registerServer) {\n\tlog.Println(\"Resgitering Server\")\n\tfn(s.server)\n}", "func RegisterClientConnectorServicesServiceServer(s *grpc.Server, srv ClientConnectorServicesServiceServer) {\n\tsrc.RegisterClientConnectorServicesServiceServer(s, srv)\n}", "func NewServer(id uuid.UUID, csrv *conf.Service, c *conf.Server, logger log.Logger, r *etcd.Registry) (*Server, error) {\n\tlogicClient, err := logic.NewClient(context.Background(), grpc.WithDiscovery(r))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts := &Server{\n\t\tc: c,\n\t\tuuid: id.String(),\n\t\tround: NewRound(c),\n\t\trpcClient: logicClient,\n\t}\n\t// init bucket\n\ts.buckets = make([]*Bucket, c.Bucket.Size)\n\ts.bucketIdx = uint32(c.Bucket.Size)\n\tfor i := int32(0); i < c.Bucket.Size; i++ {\n\t\ts.buckets[i] = NewBucket(c.Bucket)\n\t}\n\ts.serverID = ip.InternalIP()\n\tgo s.onlineproc()\n\n\tif err := InitWhitelist(c.Whitelist, logger); err != nil {\n\t\tpanic(err)\n\t}\n\tif err := InitTCP(logger, s, c.Tcp.Bind, runtime.NumCPU()); err != nil {\n\t\tpanic(err)\n\t}\n\tif err := InitWebsocket(logger, s, c.Websocket.Bind, runtime.NumCPU()); err != nil {\n\t\tpanic(err)\n\t}\n\t// if conf.Conf.Websocket.TLSOpen {\n\t// \tif err := comet.InitWebsocketWithTLS(srv, conf.Conf.Websocket.TLSBind, conf.Conf.Websocket.CertFile, conf.Conf.Websocket.PrivateFile, runtime.NumCPU()); err != nil {\n\t// \t\tpanic(err)\n\t// \t}\n\t// }\n\n\treturn s, nil\n}", "func (s *PostSvc) RegisterWithGRPCServer(g *grpc.Server) error {\n\tpb.RegisterPostServer(g, s)\n\treturn nil\n}", "func (a *App) RegisterServer(addr string, s net.Server) {\n\ta.servers.Add(addr, s)\n}", "func (dcs *DeviceClaimingServer) RegisterServices(s *grpc.Server) {\n\tttnpb.RegisterEndDeviceClaimingServerServer(s, dcs.grpc.endDeviceClaimingServer)\n\tttnpb.RegisterEndDeviceBatchClaimingServerServer(s, dcs.grpc.endDeviceBatchClaimingServer)\n\tttnpb.RegisterGatewayClaimingServerServer(s, dcs.grpc.gatewayClaimingServer)\n}", "func (s *Server) RegisterService(receiver interface{}, name string) error {\n return s.services.register(receiver, name)\n}", "func (p *Plugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error {\n\tproto.RegisterDockerLoggerServer(s, &dockerLoggerServer{\n\t\timpl: p.impl,\n\t\tbroker: broker,\n\t})\n\treturn nil\n}", "func RegisterOrganizationSvcBMServer(e *bm.Engine, server OrganizationSvcBMServer) {\n\tOrganizationSvcSvc = server\n\te.GET(\"/eagle.organization.v1.OrganizationSvc/Ping\", organizationSvcPing)\n\te.GET(\"/organization\", organizationSvcGetOrganization)\n\te.POST(\"/organization\", organizationSvcAddOrganization)\n\te.PUT(\"/organization\", organizationSvcUpdateOrganization)\n\te.DELETE(\"/organization\", organizationSvcDeleteOrganization)\n}", "func RegisterDepsServer(svr prpc.Registrar) {\n\tdm.RegisterDepsServer(svr, newDecoratedDeps())\n}", "func (w *Whisper) RegisterServer(server MailServer) {\n\tw.mailServer = server\n}", "func (p *ResourceGRPCPlugin) GRPCServer(_ *plugin.GRPCBroker, s *grpc.Server) error {\n\tpluginv2.RegisterResourceServer(s, &resourceGRPCServer{\n\t\tserver: p.ResourceServer,\n\t})\n\treturn nil\n}", "func RegisterServer(s *http.Server, srv *rest.Server) {\n\tregister(s, newLoginServer(srv))\n}", "func Register(server *grpc.Server) {\n\tpb.RegisterHelloServiceServer(server, &Server{})\n}", "func (s Service) Register(r *grpc.Server) {\n\tserver := &Server{}\n\tnb.RegisterC1InterfaceServiceServer(r, server)\n}", "func RegisterEventarcServer(s *grpc.Server, srv EventarcServer) { src.RegisterEventarcServer(s, srv) }", "func (r *RouteInfo) RegisterServer(clusterName, serverAddr, serverName, haServerAddr string, serverId int, conn gnet.Conn) *namesrv.RegisterResponse {\n\tr.Lock()\n\tdefer r.Unlock()\n\n\tresult := &namesrv.RegisterResponse{}\n\n\tserverNames := r.clusterAddrTable[clusterName]\n\tif serverNames == nil {\n\t\tserverNames = hashset.New()\n\t\tr.clusterAddrTable[clusterName] = serverNames\n\t}\n\tserverNames.Add(serverName)\n\tregisterFirst := false\n\tserverData := r.serverAddrTable[serverName]\n\tif serverData == nil {\n\t\tregisterFirst = true\n\t\tserverData = protocol.NewServer(clusterName, serverName, make(map[int]string))\n\t\tr.serverAddrTable[serverName] = serverData\n\t}\n\tserverAddrsMap := serverData.GetServerAddrs()\n\t//Switch slave to master: first remove <1, IP:PORT> in namesrv, then add <0, IP:PORT>\n\t//The same IP:PORT must only have one record in serverAddrTable\n\tfor k, v := range serverAddrsMap {\n\t\tif serverAddr != \"\" && serverAddr == v && serverId != k {\n\t\t\tdelete(serverAddrsMap, k)\n\t\t}\n\t}\n\n\toldAddr := serverData.GetServerAddrs()[serverId]\n\tserverData.GetServerAddrs()[serverId] = serverAddr\n\tregisterFirst = registerFirst || \"\" == oldAddr\n\n\tprevServerLiveInfo := r.serverLiveTable[serverAddr]\n\tls := protocol.NewLiveServer(time.Now().Unix(), haServerAddr, nil, conn)\n\tr.serverLiveTable[serverAddr] = ls\n\tif prevServerLiveInfo == nil {\n\t\tlogger.Logger.WithFields(logrus.Fields{\n\t\t\t\"serverLiveTable\": r.serverLiveTable,\n\t\t\t\"serverAddr\": serverAddr,\n\t\t\t\"clusterAddrTable\": r.clusterAddrTable,\n\t\t}).Warn(\"prevServerLiveInfo is nil\")\n\t}\n\tif MasterId != serverId {\n\t\tmasterAddr := serverData.GetServerAddrs()[MasterId]\n\t\tif masterAddr != \"\" {\n\t\t\tserverLiveInfo := r.serverLiveTable[masterAddr]\n\t\t\tif serverLiveInfo != nil {\n\t\t\t\tresult.HaServerAddr = serverLiveInfo.HaServerAddr\n\t\t\t\tresult.MasterAddr = masterAddr\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func RegisterCompanyServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CompanyServiceServer) error {\n\n\tmux.Handle(\"POST\", pattern_CompanyService_CreateCompany_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_CreateCompany_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_CreateCompany_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_ListCompanies_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_ListCompanies_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_ListCompanies_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_GetCompany_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_GetCompany_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_GetCompany_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PUT\", pattern_CompanyService_UpdateCompany_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_UpdateCompany_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_UpdateCompany_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_CompanyService_CreateTeam_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_CreateTeam_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_CreateTeam_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_ListTeams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_ListTeams_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_ListTeams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_GetTeam_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_GetTeam_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_GetTeam_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PUT\", pattern_CompanyService_UpdateTeam_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_UpdateTeam_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_UpdateTeam_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_GetWorkerTeamInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_GetWorkerTeamInfo_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_GetWorkerTeamInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_CompanyService_CreateJob_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_CreateJob_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_CreateJob_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_ListJobs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_ListJobs_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_ListJobs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_GetJob_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_GetJob_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_GetJob_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PUT\", pattern_CompanyService_UpdateJob_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_UpdateJob_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_UpdateJob_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_CompanyService_CreateShift_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_CreateShift_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_CreateShift_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_ListShifts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_ListShifts_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_ListShifts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_ListWorkerShifts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_ListWorkerShifts_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_ListWorkerShifts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PUT\", pattern_CompanyService_BulkPublishShifts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_BulkPublishShifts_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_BulkPublishShifts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_GetShift_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_GetShift_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_GetShift_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"DELETE\", pattern_CompanyService_DeleteShift_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_DeleteShift_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_DeleteShift_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PUT\", pattern_CompanyService_UpdateShift_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_UpdateShift_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_UpdateShift_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_CompanyService_CreateDirectory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_CreateDirectory_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_CreateDirectory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_Directory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_Directory_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_Directory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_GetAssociations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_GetAssociations_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_GetAssociations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_GetDirectoryEntry_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_GetDirectoryEntry_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_GetDirectoryEntry_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PUT\", pattern_CompanyService_UpdateDirectoryEntry_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_UpdateDirectoryEntry_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_UpdateDirectoryEntry_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_ListAdmins_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_ListAdmins_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_ListAdmins_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_CompanyService_CreateAdmin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_CreateAdmin_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_CreateAdmin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_GetAdmin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_GetAdmin_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_GetAdmin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"DELETE\", pattern_CompanyService_DeleteAdmin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_DeleteAdmin_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_DeleteAdmin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_ListWorkers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_ListWorkers_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_ListWorkers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_GetWorker_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_GetWorker_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_GetWorker_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"DELETE\", pattern_CompanyService_DeleteWorker_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_DeleteWorker_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_DeleteWorker_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_CompanyService_CreateWorker_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_CreateWorker_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_CreateWorker_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_ListTimeZones_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_ListTimeZones_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_ListTimeZones_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_CompanyService_GrowthGraph_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_CompanyService_GrowthGraph_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_CompanyService_GrowthGraph_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func RegisterServer(srv Server, registry *prometheus.Registry, opts ...grpc.ServerOption) *grpc.Server {\n\tvar metrics *grpc_prometheus.ServerMetrics\n\n\t// TODO: Decouple registry from this.\n\tif registry != nil {\n\t\tmetrics = grpc_prometheus.NewServerMetrics()\n\t\tregistry.MustRegister(metrics)\n\n\t\topts = append(opts,\n\t\t\tgrpc.StreamInterceptor(metrics.StreamServerInterceptor()),\n\t\t\tgrpc.UnaryInterceptor(metrics.UnaryServerInterceptor()),\n\t\t)\n\n\t}\n\n\tg := grpc.NewServer(opts...)\n\n\tdiscovery.RegisterAggregatedDiscoveryServiceServer(g, srv)\n\tdiscovery.RegisterSecretDiscoveryServiceServer(g, srv)\n\tapi.RegisterClusterDiscoveryServiceServer(g, srv)\n\tapi.RegisterEndpointDiscoveryServiceServer(g, srv)\n\tapi.RegisterListenerDiscoveryServiceServer(g, srv)\n\tapi.RegisterRouteDiscoveryServiceServer(g, srv)\n\n\tif metrics != nil {\n\t\tmetrics.InitializeMetrics(g)\n\t}\n\n\treturn g\n}", "func RegisterHealthServer(g *grpc.Server, s *Service) {\n\thealthpb.RegisterHealthServer(g, s)\n}", "func registerRateLimitServiceServer(s *grpc.Server, srv ratelimit.RateLimitServiceServer) {\n\ts.RegisterService(&_rateLimitService_serviceDesc, srv)\n}", "func (conf ServerConfig) NewServer(c *component.Component, customOpts ...Option) *Server {\n\tvar registerUnknownTo *ttnpb.OrganizationOrUserIdentifiers\n\tswitch conf.RegisterUnknown.Type {\n\tcase \"user\":\n\t\tregisterUnknownTo = ttnpb.UserIdentifiers{UserID: conf.RegisterUnknown.ID}.OrganizationOrUserIdentifiers()\n\tcase \"organization\":\n\t\tregisterUnknownTo = ttnpb.OrganizationIdentifiers{OrganizationID: conf.RegisterUnknown.ID}.OrganizationOrUserIdentifiers()\n\t}\n\topts := []Option{\n\t\tWithExplicitEnable(conf.ExplicitEnable),\n\t\tWithRegisterUnknown(registerUnknownTo),\n\t\tWithAllowCUPSURIUpdate(conf.AllowCUPSURIUpdate),\n\t}\n\tif conf.RegisterUnknown.APIKey != \"\" {\n\t\topts = append(opts, WithAuth(func(ctx context.Context, gatewayEUI types.EUI64, auth string) grpc.CallOption {\n\t\t\treturn grpc.PerRPCCredentials(rpcmetadata.MD{\n\t\t\t\tAuthType: \"bearer\",\n\t\t\t\tAuthValue: conf.RegisterUnknown.APIKey,\n\t\t\t\tAllowInsecure: c.AllowInsecureForCredentials(),\n\t\t\t})\n\t\t}))\n\t}\n\tif tlsConfig, err := c.GetTLSConfig(c.Context()); err == nil {\n\t\topts = append(opts, WithRootCAs(tlsConfig.RootCAs))\n\t}\n\ts := NewServer(c, append(opts, customOpts...)...)\n\tc.RegisterWeb(s)\n\treturn s\n}", "func (s *server) RegisterServices(gs *grpc.Server) {\n\tttnpb.RegisterApplicationPackageRegistryServer(gs, s)\n\tfor _, subsystem := range s.handlers {\n\t\tif subsystem, ok := subsystem.(rpcserver.ServiceRegisterer); ok {\n\t\t\tsubsystem.RegisterServices(gs)\n\t\t}\n\t}\n}", "func RegisterWorkflowsServer(s *grpc.Server, srv WorkflowsServer) {\n\tsrc.RegisterWorkflowsServer(s, srv)\n}", "func (s *Server) Register(grpcServer *grpc.Server) {\n\tpb.RegisterIstioCertificateServiceServer(grpcServer, s)\n}", "func RegisterLoginServerServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LoginServerServiceServer) error {\n\n\tmux.Handle(\"GET\", pattern_LoginServerService_LoginServerList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_LoginServerService_LoginServerList_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_LoginServerService_LoginServerList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_LoginServerService_LoginServerLogin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_LoginServerService_LoginServerLogin_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_LoginServerService_LoginServerLogin_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_LoginServerService_LoginServerLogout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_LoginServerService_LoginServerLogout_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_LoginServerService_LoginServerLogout_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_LoginServerService_LoginServerCreate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_LoginServerService_LoginServerCreate_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_LoginServerService_LoginServerCreate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func RegisterContactCenterInsightsServer(s *grpc.Server, srv ContactCenterInsightsServer) {\n\tsrc.RegisterContactCenterInsightsServer(s, srv)\n}", "func (s Service) Register(r *grpc.Server) {\n\tserver := Server{}\n\tproto.RegisterAdminServiceServer(r, server)\n\tproto.RegisterDeviceInventoryServiceServer(r, server)\n}", "func NewServer(binding string, nodeMgr NodeManagerInterface) GRPCServer {\n\ts := grpc.NewServer()\n\tmyServer := &server{\n\t\tbinding: binding,\n\t\ts: s,\n\t\tnodeMgr: nodeMgr,\n\t}\n\tpb.RegisterCloudProviderVsphereServer(s, myServer)\n\treflection.Register(s)\n\treturn myServer\n}", "func BuildServer(args []string) (*grpc.Server, error) {\n\tif len(args) < 1 {\n\t\treturn nil, errors.New(\"server requires valid services specified to run\")\n\t}\n\tserver := grpc.NewServer()\n\tfor _, service := range args {\n\t\tswitch service {\n\t\tcase \"userV1\":\n\t\t\tservices.RegisterUserAPIv1(server)\n\t\tcase \"leaderboardV1\":\n\t\tcase \"notificationV1\":\n\t\t\treturn nil, fmt.Errorf(\"service '%s' is not implemented\", service)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"invalid service name '%s'\", service)\n\t\t}\n\t}\n\treflection.Register(server)\n\treturn server, nil\n}", "func NewServer(conf config.Config, conns service.Connections) gitalypb.ServerServiceServer {\n\ts := &Server{\n\t\tconf: conf,\n\t\tconns: conns,\n\t}\n\n\treturn s\n}", "func SetServerSubscription(s []string) func(*Server) error {\n\treturn func(c *Server) error {\n\t\tif s != nil {\n\t\t\tfor _, d := range s {\n\t\t\t\tc.subscriptionURLs = append(c.subscriptionURLs, d)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\tc.subscriptionURLs = append(c.subscriptionURLs, \"http://joajgazyztfssty4w2on5oaqksz6tqoxbduy553y34mf4byv6gpq.b32.i2p/export/alive-hosts.txt\")\n\t\treturn nil\n\t}\n}", "func RegisterApateletService(server *service.GRPCServer, stopChannel chan<- struct{}) {\n\tapatelet.RegisterApateletServer(server.Server, &apateletService{stopChannel: stopChannel})\n}", "func (s *Server) RegisterService(service Service) {\n\tservice.Register(s)\n}", "func (s *Server) RegisterService(sd *ServiceDesc, ss interface{}) {\n\ts.register(sd, ss)\n}", "func NewServer(\n\taddr string,\n\tcontrollerNS string,\n\tidentityTrustDomain string,\n\tenableH2Upgrade bool,\n\tenableEndpointSlices bool,\n\tk8sAPI *k8s.API,\n\tmetadataAPI *k8s.MetadataAPI,\n\tclusterStore *watcher.ClusterStore,\n\tclusterDomain string,\n\tdefaultOpaquePorts map[uint32]struct{},\n\tshutdown <-chan struct{},\n) (*grpc.Server, error) {\n\tlog := logging.WithFields(logging.Fields{\n\t\t\"addr\": addr,\n\t\t\"component\": \"server\",\n\t})\n\n\t// Initialize indexers that are used across watchers\n\terr := watcher.InitializeIndexers(k8sAPI)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tendpoints, err := watcher.NewEndpointsWatcher(k8sAPI, metadataAPI, log, enableEndpointSlices, \"local\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\topaquePorts, err := watcher.NewOpaquePortsWatcher(k8sAPI, log, defaultOpaquePorts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tprofiles, err := watcher.NewProfileWatcher(k8sAPI, log)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tservers, err := watcher.NewServerWatcher(k8sAPI, log)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsrv := server{\n\t\tpb.UnimplementedDestinationServer{},\n\t\tendpoints,\n\t\topaquePorts,\n\t\tprofiles,\n\t\tservers,\n\t\tclusterStore,\n\t\tenableH2Upgrade,\n\t\tcontrollerNS,\n\t\tidentityTrustDomain,\n\t\tclusterDomain,\n\t\tdefaultOpaquePorts,\n\t\tk8sAPI,\n\t\tmetadataAPI,\n\t\tlog,\n\t\tshutdown,\n\t}\n\n\ts := prometheus.NewGrpcServer()\n\t// linkerd2-proxy-api/destination.Destination (proxy-facing)\n\tpb.RegisterDestinationServer(s, &srv)\n\treturn s, nil\n}", "func (s *ServerImpl) RegisterServerShutdownHandler(f ShutdownHandler) {\n\ts.serverShutdownHandler = f\n}", "func RegisterAssetServiceServer(s *grpc.Server, srv AssetServiceServer) {\n\tsrc.RegisterAssetServiceServer(s, srv)\n}", "func RegisterDmBMServer(e *bm.Engine, server DmBMServer) {\n\tv1DmSvc = server\n\te.POST(\"/xlive/open-interface/v1/dm/sendmsg\", dmSendmsg)\n\te.GET(\"/xlive/open-interface/v1/dm/getConf\", dmGetConf)\n}", "func RegisterService(server *grpc.Server, director StreamDirector, resiliency resiliency.Provider, serviceName string, methodNames ...string) {\n\tstreamer := &handler{\n\t\tdirector: director,\n\t\tresiliency: resiliency,\n\t}\n\tfakeDesc := &grpc.ServiceDesc{\n\t\tServiceName: serviceName,\n\t\tHandlerType: (*any)(nil),\n\t}\n\tfor _, m := range methodNames {\n\t\tstreamDesc := grpc.StreamDesc{\n\t\t\tStreamName: m,\n\t\t\tHandler: streamer.handler,\n\t\t\tServerStreams: true,\n\t\t\tClientStreams: true,\n\t\t}\n\t\tfakeDesc.Streams = append(fakeDesc.Streams, streamDesc)\n\t}\n\tserver.RegisterService(fakeDesc, streamer)\n}", "func RegisterService(server *grpc.Server, director StreamDirector, serviceName string, methodNames ...string) {\n\tstreamer := &handler{director}\n\tfakeDesc := &grpc.ServiceDesc{\n\t\tServiceName: serviceName,\n\t\tHandlerType: (*interface{})(nil),\n\t}\n\tfor _, m := range methodNames {\n\t\tstreamDesc := grpc.StreamDesc{\n\t\t\tStreamName: m,\n\t\t\tHandler: streamer.handler,\n\t\t\tServerStreams: true,\n\t\t\tClientStreams: true,\n\t\t}\n\t\tfakeDesc.Streams = append(fakeDesc.Streams, streamDesc)\n\t}\n\tserver.RegisterService(fakeDesc, streamer)\n}", "func (svc *Service) createGPRCServer() (*grpc.Server, error) {\n\topts, err := svc.serverOptions()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tserver := grpc.NewServer(opts...)\n\n\tif svc.cfg.Proto != \"\" && svc.rr != nil {\n\t\t// php proxy services\n\t\tservices, err := parser.File(svc.cfg.Proto, path.Dir(svc.cfg.Proto))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, service := range services {\n\t\t\tp := NewProxy(fmt.Sprintf(\"%s.%s\", service.Package, service.Name), svc.cfg.Proto, svc.rr)\n\t\t\tfor _, m := range service.Methods {\n\t\t\t\tp.RegisterMethod(m.Name)\n\t\t\t}\n\n\t\t\tserver.RegisterService(p.ServiceDesc(), p)\n\t\t}\n\t}\n\n\t// external and native services\n\tfor _, r := range svc.services {\n\t\tr(server)\n\t}\n\n\treturn server, nil\n}", "func (srv *Server) Register(rcvr interface{}) error {\n\ts := new(service)\n\ts.typ = reflect.TypeOf(rcvr)\n\ts.rcvr = reflect.ValueOf(rcvr)\n\tsname := reflect.Indirect(s.rcvr).Type().Name()\n\tif sname == \"\" {\n\t\treturn fmt.Errorf(\"WebSocketRPC: Failed to register %v\", sname)\n\t}\n\ts.name = sname\n\ts.method = suitableMethods(s.typ)\n\tif len(s.method) == 0 {\n\t\treturn fmt.Errorf(\"WebSocketRPC: Did not find any methods of %v to register\", sname)\n\t}\n\tsrv.serviceMap[sname] = s\n\treturn nil\n}", "func (s *Server) RegisterService(receiver interface{}, name string) error {\n\treturn s.services.register(receiver, name)\n}", "func createServer() {\n\tlistener := createServerListener()\n\tserver := Server{}\n\tgrpcServer := grpc.NewServer()\n\tRegisterAccountServer(grpcServer, &server)\n\tstartServer(grpcServer, listener)\n}", "func (s *Server) RegisterService(sd *grpc.ServiceDesc, ss interface{}) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\t// Does some sanity checks.\n\tif _, ok := s.m[sd.ServiceName]; ok {\n\t\tlog.Fatalf(\"grpc: Server.RegisterService found duplicate service registration for %q\", sd.ServiceName)\n\t}\n\tht := reflect.TypeOf(sd.HandlerType).Elem()\n\tst := reflect.TypeOf(ss)\n\tif !st.Implements(ht) {\n\t\tlog.Fatalf(\"grpc: Server.RegisterService found the handler of type %v that does not satisfy %v\", st, ht)\n\t}\n\tsrv := &service{\n\t\tserver: ss,\n\t\tmd: make(map[string]*grpc.MethodDesc),\n\t\t//\t\tsd: make(map[string]*StreamDesc),\n\t}\n\tfor i := range sd.Methods {\n\t\td := &sd.Methods[i]\n\t\tsrv.md[d.MethodName] = d\n\t\tname := fmt.Sprintf(\"/%s/%s\", sd.ServiceName, d.MethodName)\n\t\tlog.Printf(\"Register: %s\", name)\n\t\ts.mux.HandleFunc(name, handler(ss, d))\n\t}\n\t//\tfor i := range sd.Streams {\n\t//\t\td := &sd.Streams[i]\n\t//\t\tsrv.sd[d.StreamName] = d\n\t//\t}\n\ts.m[sd.ServiceName] = srv\n}", "func RegisterLogsServer(s *grpc.Server, srv LogsServer) {\n\totlpcollectorlog.RegisterLogsServiceServer(s, &rawLogsServer{srv: srv})\n}", "func RegisterServerType(typeName string, srv ServerType) {\n\tif _, ok := serverTypes[typeName]; ok {\n\t\tpanic(\"server type already registered\")\n\t}\n\tserverTypes[typeName] = srv\n}", "func NewServer(c *Config) (*Server, error) {\n\t// validate config\n\tif err := validation.Validate.Struct(c); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid config: %v\", err)\n\t}\n\n\t// create root context\n\tctx, cancel := context.WithCancel(context.Background())\n\n\t// register handlers\n\tmux := runtime.NewServeMux()\n\topts := []grpc.DialOption{grpc.WithInsecure()}\n\terr := proto.RegisterTodosHandlerFromEndpoint(ctx, mux, c.Endpoint, opts)\n\tif err != nil {\n\t\tdefer cancel()\n\t\treturn nil, fmt.Errorf(\"unable to register gateway handler: %v\", err)\n\t}\n\n\ts := Server{\n\t\tcancel: cancel,\n\t\tlog: c.Log,\n\t\tmux: mux,\n\t\tport: c.Port,\n\t}\n\treturn &s, nil\n}", "func NewServer(svc things.Service) mainflux.ThingsServiceServer {\n\treturn &grpcServer{\n\t\tcanAccess: kitgrpc.NewServer(\n\t\t\tcanAccessEndpoint(svc),\n\t\t\tdecodeCanAccessRequest,\n\t\t\tencodeIdentityResponse,\n\t\t),\n\t\tidentify: kitgrpc.NewServer(\n\t\t\tidentifyEndpoint(svc),\n\t\t\tdecodeIdentifyRequest,\n\t\t\tencodeIdentityResponse,\n\t\t),\n\t}\n}", "func (s *Server) RegisterService(receiver interface{}, name string) error {\n\treturn s.services.add(receiver, name, s.ctxType)\n}", "func (a *AuthorizationServer) Register(s *grpc.Server) {\n\tauth.RegisterAuthorizationServer(s, a)\n}", "func RegisterBinauthzManagementServiceV1Beta1Server(s *grpc.Server, srv BinauthzManagementServiceV1Beta1Server) {\n\tsrc.RegisterBinauthzManagementServiceV1Beta1Server(s, srv)\n}", "func (s *Servers) registerGRPCService() {\n\n\tidentitypb.RegisterIdentityServiceServer(s.gRPCServer, s.Backend.IdentityServer)\n\tauthpb.RegisterAuthServiceServer(s.gRPCServer, s.Backend.AuthServer)\n\tmoviepb.RegisterMovieServiceServer(s.gRPCServer, s.Backend.MovieServer)\n}", "func RegisterSimpleServiceOrionServer(srv orion.ServiceFactory, orionServer orion.Server) {\n\torionServer.RegisterService(&_SimpleService_serviceDesc, srv)\n\n}", "func serverRegister() {\n\t// set the parameters to register\n\tbytePublicKey, _ := anonServer.PublicKey.MarshalBinary()\n\tparams := map[string]interface{}{\n\t\t\"public_key\": bytePublicKey,\n\t}\n\tevent := &proto.Event{EventType:proto.SERVER_REGISTER, Params:params}\n\n\tutil.SendEvent(anonServer.LocalAddr, anonServer.CoordinatorAddr, event)\n}", "func (s MeshService) RegisterService(server *Server) {\n\tpb.RegisterMeshServiceServer(server.GrpcServer, s)\n}", "func InitializeServer(grpcServer *grpc.Server) *connectorpb.InitializeResponse {\n\n\taccesscontextmanager_connector.RegisterServers(grpcServer)\n\n\tapigee_connector.RegisterServers(grpcServer)\n\n\tappengine_connector.RegisterServers(grpcServer)\n\n\tassuredworkloads_connector.RegisterServers(grpcServer)\n\n\tbigqueryconnection_connector.RegisterServers(grpcServer)\n\n\tbigqueryreservation_connector.RegisterServers(grpcServer)\n\n\tbinaryauthorization_connector.RegisterServers(grpcServer)\n\n\tcloudbilling_connector.RegisterServers(grpcServer)\n\n\tcloudbuild_connector.RegisterServers(grpcServer)\n\n\tcloudfunctions_connector.RegisterServers(grpcServer)\n\n\tcloudresourcemanager_connector.RegisterServers(grpcServer)\n\n\tcloudscheduler_connector.RegisterServers(grpcServer)\n\n\tcompute_connector.RegisterServers(grpcServer)\n\n\tcontainer_connector.RegisterServers(grpcServer)\n\n\tcontaineranalysis_connector.RegisterServers(grpcServer)\n\n\tdatafusion_beta_connector.RegisterServers(grpcServer)\n\n\tdataproc_connector.RegisterServers(grpcServer)\n\n\tdatastore_connector.RegisterServers(grpcServer)\n\n\tdns_connector.RegisterServers(grpcServer)\n\n\tfile_connector.RegisterServers(grpcServer)\n\n\teventarc_beta_connector.RegisterServers(grpcServer)\n\n\tgameservices_connector.RegisterServers(grpcServer)\n\n\tgkehub_beta_connector.RegisterServers(grpcServer)\n\n\tlogging_connector.RegisterServers(grpcServer)\n\n\tiam_connector.RegisterServers(grpcServer)\n\n\tiap_connector.RegisterServers(grpcServer)\n\n\tidentitytoolkit_connector.RegisterServers(grpcServer)\n\n\tmonitoring_connector.RegisterServers(grpcServer)\n\n\tnetworksecurity_alpha_connector.RegisterServers(grpcServer)\n\n\tosconfig_beta_connector.RegisterServers(grpcServer)\n\n\tpubsub_connector.RegisterServers(grpcServer)\n\n\tpubsublite_connector.RegisterServers(grpcServer)\n\n\tredis_connector.RegisterServers(grpcServer)\n\n\trun_connector.RegisterServers(grpcServer)\n\n\truntimeconfig_connector.RegisterServers(grpcServer)\n\n\tservicenetworking_connector.RegisterServers(grpcServer)\n\n\tsourcerepo_connector.RegisterServers(grpcServer)\n\n\tserviceusage_connector.RegisterServers(grpcServer)\n\n\tspanner_connector.RegisterServers(grpcServer)\n\n\tsql_beta_connector.RegisterServers(grpcServer)\n\n\tstorage_connector.RegisterServers(grpcServer)\n\n\ttpu_connector.RegisterServers(grpcServer)\n\n\tvpcaccess_connector.RegisterServers(grpcServer)\n\n\treturn &connectorpb.InitializeResponse{\n\t\tStatus: &statuspb.Status{\n\t\t\tCode: int32(codes.OK),\n\t\t},\n\t}\n}", "func (wk *Worker) RegisterService(args *serverless.ServiceRegisterArgs, _ *struct{}) error {\n\tplug, err := plugin.Open(\"../plugins/\" + args.ServiceName + \".so\")\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to open plugin %s: %v\\n\", args.ServiceName, err)\n\t\treturn err\n\t}\n\t// TODO: implement me\n\t// Hint 1: You may want to use `plug.Lookup` to locate the service symbol,\n\t// and expose the interested service API associated with serverless.Interface.\n\t// Hint 2: Call newService to initialize a service struct, and insert the service key-value pair\n\t// to the global serviceMap.\n\t// TODO TODO TODO\n\t//\n\n\tserverless.Debug(\"Successfully registered new service %s\\n\", args.ServiceName)\n\treturn nil\n}", "func NewServer(\n\taddr string,\n\tcontrollerNS string,\n\tidentityTrustDomain string,\n\tenableH2Upgrade bool,\n\tk8sAPI *k8s.API,\n\tshutdown <-chan struct{},\n) *grpc.Server {\n\tlog := logging.WithFields(logging.Fields{\n\t\t\"addr\": addr,\n\t\t\"component\": \"server\",\n\t})\n\tendpoints := watcher.NewEndpointsWatcher(k8sAPI, log)\n\tprofiles := watcher.NewProfileWatcher(k8sAPI, log)\n\ttrafficSplits := watcher.NewTrafficSplitWatcher(k8sAPI, log)\n\n\tsrv := server{\n\t\tendpoints,\n\t\tprofiles,\n\t\ttrafficSplits,\n\t\tenableH2Upgrade,\n\t\tcontrollerNS,\n\t\tidentityTrustDomain,\n\t\tlog,\n\t\tshutdown,\n\t}\n\n\ts := prometheus.NewGrpcServer()\n\t// linkerd2-proxy-api/destination.Destination (proxy-facing)\n\tpb.RegisterDestinationServer(s, &srv)\n\t// controller/discovery.Discovery (controller-facing)\n\tdiscoveryPb.RegisterDiscoveryServer(s, &srv)\n\treturn s\n}", "func RegisterAgentEndpointServiceServer(s *grpc.Server, srv AgentEndpointServiceServer) {\n\tsrc.RegisterAgentEndpointServiceServer(s, srv)\n}", "func Register(s *grpc.Server) {\n\tca.RegisterCertServiceServer(s, &service{})\n}", "func StartServer(cleanUpChan chan int){\n\tGrpcServer = &Server{\n CleanUpChan:cleanUpChan ,\n\t GrpcServer: grpc.NewServer(),\n\t}\n\tregisterGrpcServices(GrpcServer.GrpcServer)\n\tif err := GrpcServer.GrpcServer.Serve(getListner(port)); err != nil {\n\t\tpanic(err)\n\t}\n}", "func RegisterSecretServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SecretServiceServer) error {\n\n\tmux.Handle(\"POST\", pattern_SecretService_CreateSecret_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/api.SecretService/CreateSecret\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_SecretService_CreateSecret_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_SecretService_CreateSecret_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_SecretService_SecretExists_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/api.SecretService/SecretExists\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_SecretService_SecretExists_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_SecretService_SecretExists_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_SecretService_GetSecret_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/api.SecretService/GetSecret\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_SecretService_GetSecret_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_SecretService_GetSecret_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_SecretService_ListSecrets_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/api.SecretService/ListSecrets\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_SecretService_ListSecrets_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_SecretService_ListSecrets_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"DELETE\", pattern_SecretService_DeleteSecret_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/api.SecretService/DeleteSecret\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_SecretService_DeleteSecret_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_SecretService_DeleteSecret_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"DELETE\", pattern_SecretService_DeleteSecretKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/api.SecretService/DeleteSecretKey\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_SecretService_DeleteSecretKey_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_SecretService_DeleteSecretKey_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_SecretService_AddSecretKeyValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/api.SecretService/AddSecretKeyValue\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_SecretService_AddSecretKeyValue_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_SecretService_AddSecretKeyValue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PATCH\", pattern_SecretService_UpdateSecretKeyValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/api.SecretService/UpdateSecretKeyValue\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_SecretService_UpdateSecretKeyValue_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_SecretService_UpdateSecretKeyValue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func (service *ServerService) ServiceCreateServer(server *models.ServerModel) {\n\tservice.CreateServer(server)\n}", "func (s *Server) Register(rcvr interface{}) error {\n\n\t_service := new(service)\n\t_service.typ = reflect.TypeOf(rcvr)\n\t_service.rcvr = reflect.ValueOf(rcvr)\n\tsname := reflect.Indirect(_service.rcvr).Type().Name()\n\n\tif sname == \"\" {\n\t\terr_s := \"rpc.Register: no service name for type \" + _service.typ.String()\n\t\tlog.Print(err_s)\n\t\treturn errors.New(err_s)\n\t}\n\n\tif !isExported(sname) {\n\t\terr_s := \"rpc.Register: type \" + sname + \" is not exported\"\n\t\tlog.Print(err_s)\n\t\treturn errors.New(err_s)\n\t}\n\t_service.name = sname\n\t_service.method = suitableMethods(_service.typ, true)\n\n\tif _, dup := s.m.LoadOrStore(sname, _service); dup {\n\t\treturn errors.New(\"rpc: service already defined: \" + sname)\n\t}\n\treturn nil\n}", "func RegisterFUOTADeploymentServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FUOTADeploymentServiceServer) error {\n\n\tmux.Handle(\"POST\", pattern_FUOTADeploymentService_CreateForDevice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_FUOTADeploymentService_CreateForDevice_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_FUOTADeploymentService_CreateForDevice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_FUOTADeploymentService_Get_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_FUOTADeploymentService_Get_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_FUOTADeploymentService_Get_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_FUOTADeploymentService_List_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_FUOTADeploymentService_List_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_FUOTADeploymentService_List_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_FUOTADeploymentService_GetDeploymentDevice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_FUOTADeploymentService_GetDeploymentDevice_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_FUOTADeploymentService_GetDeploymentDevice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_FUOTADeploymentService_ListDeploymentDevices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_FUOTADeploymentService_ListDeploymentDevices_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_FUOTADeploymentService_ListDeploymentDevices_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func RegisterHelmManagerGwServer(ctx context.Context, mux *runtime.ServeMux, server HelmManagerServer) error {\n\n\tmux.Handle(\"GET\", pattern_HelmManager_Available_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HelmManager_Available_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HelmManager_Available_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_HelmManager_CreateRepository_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HelmManager_CreateRepository_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HelmManager_CreateRepository_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PUT\", pattern_HelmManager_UpdateRepository_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HelmManager_UpdateRepository_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HelmManager_UpdateRepository_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HelmManager_GetRepository_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HelmManager_GetRepository_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HelmManager_GetRepository_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"DELETE\", pattern_HelmManager_DeleteRepository_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HelmManager_DeleteRepository_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HelmManager_DeleteRepository_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HelmManager_ListRepository_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HelmManager_ListRepository_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HelmManager_ListRepository_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"DELETE\", pattern_HelmManager_DeleteRepositories_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HelmManager_DeleteRepositories_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HelmManager_DeleteRepositories_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HelmManager_ListChart_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HelmManager_ListChart_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HelmManager_ListChart_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HelmManager_ListChartVersion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HelmManager_ListChartVersion_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HelmManager_ListChartVersion_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HelmManager_GetChartDetail_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HelmManager_GetChartDetail_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HelmManager_GetChartDetail_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HelmManager_ListRelease_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HelmManager_ListRelease_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HelmManager_ListRelease_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_HelmManager_GetReleaseDetail_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HelmManager_GetReleaseDetail_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HelmManager_GetReleaseDetail_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_HelmManager_InstallRelease_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HelmManager_InstallRelease_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HelmManager_InstallRelease_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_HelmManager_UninstallRelease_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HelmManager_UninstallRelease_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HelmManager_UninstallRelease_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_HelmManager_UpgradeRelease_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HelmManager_UpgradeRelease_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HelmManager_UpgradeRelease_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_HelmManager_RollbackRelease_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_HelmManager_RollbackRelease_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_HelmManager_RollbackRelease_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func (computeService Service) CreateServer(serverCreationParameters ServerCreationParameters) (CreateServerResponse, error) {\n\tsc := createServerContainer{}\n\treqURL, err := computeService.buildRequestURL(\"/servers\")\n\tif err != nil {\n\t\treturn sc.CreateServer, err\n\t}\n\n\tc := serverCreateParametersContainer{ServerCreationParameters: serverCreationParameters}\n\terr = misc.PostJSON(reqURL, computeService.authenticator, c, &sc)\n\treturn sc.CreateServer, err\n}", "func (p *AppPlugin) GRPCServer(_ *plugin.GRPCBroker, s *grpc.Server) error {\n\tpluginproto.RegisterNodeServer(s, NewServer(p.app))\n\treturn nil\n}", "func (s *Server) Register(namespace string, service Invoker) {\n\ts.services[namespace] = service\n}", "func (s *Service) Register(server *grpc.Server) {\n\tcriapi.RegisterImageServiceServer(server, s)\n\tcriapi.RegisterRuntimeServiceServer(server, s)\n}", "func (s *PoolServer) Register(grpcServer *grpc.Server) {\n\tgoblinpb.RegisterGoblinServiceServer(grpcServer, &server{\n\t\tpool: s,\n\t})\n}", "func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServiceServer) error {\n\n\tmux.Handle(\"POST\", pattern_UserService_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/realworld.UserService/Login\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_UserService_Login_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_UserService_Login_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_UserService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/realworld.UserService/Create\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_UserService_Create_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_UserService_Create_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_UserService_GetCurrent_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/realworld.UserService/GetCurrent\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_UserService_GetCurrent_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_UserService_GetCurrent_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PUT\", pattern_UserService_UpdateProfile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/realworld.UserService/UpdateProfile\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_UserService_UpdateProfile_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_UserService_UpdateProfile_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PUT\", pattern_UserService_UpdatePassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/realworld.UserService/UpdatePassword\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_UserService_UpdatePassword_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_UserService_UpdatePassword_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_UserService_GetProfile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/realworld.UserService/GetProfile\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_UserService_GetProfile_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_UserService_GetProfile_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_UserService_FollowUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/realworld.UserService/FollowUser\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_UserService_FollowUser_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_UserService_FollowUser_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"DELETE\", pattern_UserService_UnfollowUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/realworld.UserService/UnfollowUser\")\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_UserService_UnfollowUser_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_UserService_UnfollowUser_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func NewServer(s Service) pb.BookingServiceServer {\n\treturn &grpcServer{s, pb.UnimplementedBookingServiceServer{}}\n}", "func NewGRPCServer(srv *grpc.Server, backend api.Backend) {\n\ts := &grpcServer{\n\t\tbackend: backend,\n\t}\n\tpb.RegisterEntityRegistryServer(srv, s)\n\tpb.RegisterRuntimeRegistryServer(srv, s)\n}", "func RegisterDatastreamServer(s *grpc.Server, srv DatastreamServer) {\n\tsrc.RegisterDatastreamServer(s, srv)\n}", "func NewBankServiceServer() bank_v1.BankServiceServer {\n\tdb := newFirestoreDatabase(nil) // todo: init firestore client\n\tservice := newService(db)\n\tgrpcApi := newGrpcApi(service)\n\treturn grpcApi\n}", "func RegisterConfigServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ConfigServiceServer) error {\n\n\tmux.Handle(\"GET\", pattern_ConfigService_GetConfig_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ConfigService_GetConfig_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ConfigService_GetConfig_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PUT\", pattern_ConfigService_SetConfig_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ConfigService_SetConfig_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ConfigService_SetConfig_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_ConfigService_GetToken_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ConfigService_GetToken_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ConfigService_GetToken_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_ConfigService_GetDefaultToken_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ConfigService_GetDefaultToken_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ConfigService_GetDefaultToken_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_ConfigService_CreateTokenType_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ConfigService_CreateTokenType_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ConfigService_CreateTokenType_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_ConfigService_GetTokenType_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ConfigService_GetTokenType_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ConfigService_GetTokenType_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_ConfigService_ListTokenTypes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ConfigService_ListTokenTypes_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ConfigService_ListTokenTypes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"PUT\", pattern_ConfigService_UpdateTokenType_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ConfigService_UpdateTokenType_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ConfigService_UpdateTokenType_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"DELETE\", pattern_ConfigService_DeleteTokenType_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ConfigService_DeleteTokenType_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ConfigService_DeleteTokenType_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_ConfigService_GetTokenGroups_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ConfigService_GetTokenGroups_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ConfigService_GetTokenGroups_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_ConfigService_CreateTokenGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ConfigService_CreateTokenGroup_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ConfigService_CreateTokenGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"GET\", pattern_ConfigService_GetTokenGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ConfigService_GetTokenGroup_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ConfigService_GetTokenGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"DELETE\", pattern_ConfigService_DeleteTokenGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_ConfigService_DeleteTokenGroup_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_ConfigService_DeleteTokenGroup_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}" ]
[ "0.6962951", "0.6499365", "0.64940494", "0.62961686", "0.6150645", "0.61200964", "0.609665", "0.60660225", "0.593484", "0.5928594", "0.59166455", "0.59086245", "0.58979774", "0.58734566", "0.58527607", "0.5834305", "0.5828885", "0.5793394", "0.5770595", "0.57611436", "0.57187974", "0.571382", "0.5702104", "0.56861943", "0.56700337", "0.5665839", "0.56072164", "0.5592556", "0.5592398", "0.5590062", "0.5580837", "0.55647457", "0.55453646", "0.5534581", "0.5526083", "0.55256915", "0.55102664", "0.5499799", "0.5476021", "0.5459634", "0.54590094", "0.5450816", "0.543493", "0.5430513", "0.5420254", "0.54074335", "0.53980464", "0.53676736", "0.536534", "0.5365197", "0.5364181", "0.5358532", "0.5347454", "0.5343528", "0.5340167", "0.5337495", "0.53354806", "0.53242695", "0.5319054", "0.5314826", "0.5312495", "0.5301942", "0.53002125", "0.5299455", "0.5297104", "0.5286337", "0.52807873", "0.5270254", "0.52556074", "0.5248179", "0.52444863", "0.5243413", "0.5227637", "0.52249616", "0.52246207", "0.5195723", "0.5189531", "0.5176711", "0.5175476", "0.5170151", "0.51668674", "0.5163313", "0.5162564", "0.5151734", "0.51486117", "0.5142371", "0.5134495", "0.51334715", "0.5133326", "0.51260954", "0.5124962", "0.5117028", "0.511608", "0.50994325", "0.5099115", "0.5097099", "0.5094383", "0.508985", "0.5089332", "0.5087937" ]
0.876372
0
parseFunctions ... Reads a parsers.of lines and parses Function structs from it.
parseFunctions ... Читает строки из parsers.of и парсит структуры Function из них.
func (i Interface) parseFunctions(contentLines []string) []Function { var functions []Function for _, line := range contentLines { if isPureVirtualDefinition(line) { newFunction := NewFunction(line) functions = append(functions, *newFunction) } } return functions }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ParseGo(code string) (functions map[uint64]*function.Function) {\n\n\tcodeLines := strings.Split(code, \"\\n\")\n\n\tfunctions = make(map[uint64]*function.Function)\n\n\tvar (\n\t\tstartLine uint64\n\t\tendLine uint64\n\t\tcomment string\n\t\tfunctionContent string\n\t\tstate = commentSearch\n\t)\n\n\tfor idx, line := range codeLines {\n\t\tlineIdx := uint64(idx + 1)\n\t\t// Searching for comment or \"func\"/\"type\" keywords\n\t\tstrings.ReplaceAll(line, \"\\r\", \"\")\n\n\t\t// We found a comment. Transition state to commentStart\n\t\tif strings.HasPrefix(line, \"//\") && state != commentStart {\n\t\t\tstate = commentStart\n\t\t\tstartLine = lineIdx\n\n\t\t} else if strings.Contains(line, \"func\") || strings.Contains(line, \"type\") {\n\n\t\t\t// we found the function keyword so we transition to funcStart state\n\t\t\tif state == commentSearch {\n\t\t\t\t// If we're coming from commentSearch, that means that we didn't have a comment so we set startLine to idx\n\t\t\t\tstartLine = lineIdx\n\n\t\t\t}\n\t\t\t// otherwise, we're coming from commentStart, that means that we had a comment so we leave startLine as it is\n\t\t\tstate = funcStart\n\t\t} else if strings.HasPrefix(line, \"}\") {\n\t\t\tstate = funcEnd\n\t\t\tendLine = lineIdx\n\n\t\t} else if !(strings.HasPrefix(line, \"//\")) && state != funcStart {\n\t\t\tstate = commentSearch\n\t\t\tcomment = \"\"\n\t\t\tstartLine = 0\n\t\t\tendLine = 0\n\n\t\t}\n\n\t\tswitch state {\n\t\tcase commentSearch:\n\t\t\tcontinue\n\t\tcase commentStart:\n\t\t\tcomment += fmt.Sprintf(\"%v\\n\", line)\n\t\tcase funcStart:\n\t\t\tfunctionContent += fmt.Sprintf(\"%v\\n\", line)\n\n\t\tcase funcEnd:\n\t\t\t// add the closing brace\n\t\t\tfunctionContent += fmt.Sprintf(\"%v\\n\", line)\n\t\t\tendLine = uint64(idx)\n\n\t\t\t// create a new function object with the information we got\n\t\t\tf := function.NewFunction(comment, functionContent, \"noNameYet\", 0, startLine, endLine)\n\n\t\t\t// add that to our map\n\t\t\tfunctions[uint64(f.FuncID)] = f\n\n\t\t\t// reset our state machine\n\t\t\tstartLine = 0\n\t\t\tcomment = \"\"\n\t\t\tfunctionContent = \"\"\n\t\t\tstate = commentSearch\n\n\t\tdefault:\n\t\t\tcontinue\n\t\t}\n\n\t}\n\n\treturn\n}", "func parseFunction(function *ast.FuncDecl, fileContext *fileContext) {\n\tfunctionName := addFunctionNode(function, fileContext)\n\n\tparseParameterTypes(function, functionName, fileContext)\n\n\tparseResultTypes(function, functionName, fileContext)\n}", "func ParseC(code string) (functions map[uint64]*function.Function) {\n\n\tcodeLines := strings.Split(code, \"\\n\")\n\tfunctions = make(map[uint64]*function.Function)\n\n\tvar (\n\t\tstartLine uint64\n\t\tendLine uint64\n\t\tcomment string\n\t\tfunctionContent string\n\t\tstate = commentSearch\n\t)\n\n\tfor idx, line := range codeLines {\n\t\tif strings.HasPrefix(line, \"//\") {\n\t\t\tstate = commentStart\n\t\t} else if cFuncMatch.MatchString(line) ||\n\t\t\t(strings.Contains(line, \"template\") && strings.Contains(line, \"typename\")) {\n\t\t\tif state == commentSearch {\n\t\t\t\t// If we're coming from commentSearch, that means that we didn't have a comment so we set startLine to idx\n\t\t\t\tstartLine = uint64(idx + 1)\n\t\t\t}\n\t\t\tstate = funcStart\n\t\t} else if strings.Contains(line, \"struct\") && strings.Contains(line, \"{\") {\n\t\t\tif state == commentSearch {\n\t\t\t\tstartLine = uint64(idx + 1)\n\t\t\t}\n\t\t\tstate = funcStart\n\t\t} else if strings.HasPrefix(line, \"}\") {\n\t\t\tstate = funcEnd\n\t\t} else if !(strings.HasPrefix(line, \"//\")) && state != funcStart {\n\t\t\tstate = commentSearch\n\t\t\tcomment = \"\"\n\t\t}\n\n\t\tswitch state {\n\t\tcase commentSearch:\n\t\t\tcontinue\n\t\tcase commentStart:\n\t\t\tstartLine = uint64(idx + 1)\n\t\t\tcomment += fmt.Sprintf(\"%s\\n\", line)\n\t\tcase funcStart:\n\t\t\tfunctionContent += fmt.Sprintf(\"%v\\n\", line)\n\t\tcase funcEnd:\n\t\t\tendLine = uint64(idx + 1)\n\t\t\t// add the closing brace\n\t\t\tfunctionContent += fmt.Sprintf(\"%v\\n\", line)\n\t\t\t// create a new function object with the information we got\n\t\t\tf := function.NewFunction(comment, functionContent, \"noNameYet\", 0, startLine, endLine)\n\t\t\t// add that to our map\n\t\t\tfunctions[uint64(f.FuncID)] = f\n\t\t\t// reset our state machine\n\t\t\tstartLine = 0\n\t\t\tcomment = \"\"\n\t\t\tfunctionContent = \"\"\n\t\t\tstate = commentSearch\n\n\t\tdefault:\n\t\t\tcontinue\n\t\t}\n\t}\n\treturn\n}", "func ParseFunction(s string) (prefix string, funcname string, f []string, r []string, err error) {\n\tdefer func() {\n\t\tif len(f) == 1 && f[0] == \"void\" {\n\t\t\tf = nil\n\t\t}\n\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"cannot parse function '%s' : %v\", s, err)\n\t\t} else {\n\t\t\tprefix = strings.TrimSpace(prefix)\n\t\t\tfuncname = strings.TrimSpace(funcname)\n\t\t\tfor i := range r {\n\t\t\t\tr[i] = strings.TrimSpace(r[i])\n\t\t\t}\n\t\t\tfor i := range f {\n\t\t\t\tf[i] = strings.TrimSpace(f[i])\n\t\t\t}\n\t\t}\n\t}()\n\n\t// remove specific attribute for function longjmp\n\ts = strings.Replace(s, \"__attribute__((noreturn))\", \"\", -1)\n\n\ts = strings.TrimSpace(s)\n\tif !IsFunction(s) {\n\t\terr = fmt.Errorf(\"is not function : %s\", s)\n\t\treturn\n\t}\n\tvar returns string\n\tvar arguments string\n\t{\n\t\t// Example of function types :\n\t\t// int (*)(int, float)\n\t\t// int (int, float)\n\t\t// int (*)(int (*)(int))\n\t\t// void (*(*)(int *, void *, const char *))(void)\n\t\tif s[len(s)-1] != ')' {\n\t\t\terr = fmt.Errorf(\"function type |%s| haven't last symbol ')'\", s)\n\t\t\treturn\n\t\t}\n\t\tcounter := 1\n\t\tvar pos int\n\t\tfor i := len(s) - 2; i >= 0; i-- {\n\t\t\tif i == 0 {\n\t\t\t\terr = fmt.Errorf(\"don't found '(' in type : %s\", s)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif s[i] == ')' {\n\t\t\t\tcounter++\n\t\t\t}\n\t\t\tif s[i] == '(' {\n\t\t\t\tcounter--\n\t\t\t}\n\t\t\tif counter == 0 {\n\t\t\t\tpos = i\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// s[:pos] = `speed_t cfgetospeed`\n\t\tif unicode.IsNumber(rune(s[pos-1])) || unicode.IsLetter(rune(s[pos-1])) {\n\t\t\tfor i := pos - 1; i >= 0; i-- {\n\t\t\t\tif s[i] == ' ' {\n\t\t\t\t\tfuncname = s[i+1 : pos]\n\t\t\t\t\treturns = strings.TrimSpace(s[:i])\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\treturns = strings.TrimSpace(s[:pos])\n\t\t}\n\t\targuments = strings.TrimSpace(s[pos:])\n\t}\n\tif arguments == \"\" {\n\t\terr = fmt.Errorf(\"cannot parse (right part is nil) : %v\", s)\n\t\treturn\n\t}\n\t// separate fields of arguments\n\t{\n\t\tpos := 1\n\t\tcounter := 0\n\t\tfor i := 1; i < len(arguments)-1; i++ {\n\t\t\tif arguments[i] == '(' {\n\t\t\t\tcounter++\n\t\t\t}\n\t\t\tif arguments[i] == ')' {\n\t\t\t\tcounter--\n\t\t\t}\n\t\t\tif counter == 0 && arguments[i] == ',' {\n\t\t\t\tf = append(f, strings.TrimSpace(arguments[pos:i]))\n\t\t\t\tpos = i + 1\n\t\t\t}\n\t\t}\n\t\tf = append(f, strings.TrimSpace(arguments[pos:len(arguments)-1]))\n\t}\n\n\t// returns\n\t// Example: __ssize_t\n\tif returns[len(returns)-1] != ')' {\n\t\tr = append(r, returns)\n\t\treturn\n\t}\n\n\t// Example: void ( *(*)(int *, void *, char *))\n\t// ------- --------------------------- return type\n\t// == prefix\n\t// ++++++++++++++++++++++++++++++ block\n\t// return type : void (*)(int *, void *, char *)\n\t// prefix : *\n\t// Find the block\n\tvar counter int\n\tvar position int\n\tfor i := len(returns) - 1; i >= 0; i-- {\n\t\tif returns[i] == ')' {\n\t\t\tcounter++\n\t\t}\n\t\tif returns[i] == '(' {\n\t\t\tcounter--\n\t\t}\n\t\tif counter == 0 {\n\t\t\tposition = i\n\t\t\tbreak\n\t\t}\n\t}\n\tblock := string([]byte(returns[position:]))\n\treturns = returns[:position]\n\n\t// Examples returns:\n\t// int (*)\n\t// char *(*)\n\t// block is : (*)\n\tif block == \"(*)\" {\n\t\tr = append(r, returns)\n\t\treturn\n\t}\n\n\tindex := strings.Index(block, \"(*)\")\n\tif index < 0 {\n\t\tif strings.Count(block, \"(\") == 1 {\n\t\t\t// Examples returns:\n\t\t\t// int ( * [2])\n\t\t\t// ------ return type\n\t\t\t// ====== prefix\n\t\t\t// ++++++++ block\n\t\t\tbBlock := []byte(block)\n\t\t\tfor i := 0; i < len(bBlock); i++ {\n\t\t\t\tswitch bBlock[i] {\n\t\t\t\tcase '(', ')':\n\t\t\t\t\tbBlock[i] = ' '\n\t\t\t\t}\n\t\t\t}\n\t\t\tbBlock = bytes.Replace(bBlock, []byte(\"*\"), []byte(\"\"), 1)\n\t\t\tprefix = string(bBlock)\n\t\t\tr = append(r, returns)\n\t\t\treturn\n\t\t}\n\t\t// void (*(int *, void *, const char *))\n\t\t// ++++++++++++++++++++++++++++++++ block\n\t\tblock = block[1 : len(block)-1]\n\t\tindex := strings.Index(block, \"(\")\n\t\tif index < 0 {\n\t\t\terr = fmt.Errorf(\"cannot found '(' in block\")\n\t\t\treturn\n\t\t}\n\t\treturns = returns + block[index:]\n\t\tprefix = block[:index]\n\t\tif strings.Contains(prefix, \"*\") {\n\t\t\tprefix = strings.Replace(prefix, \"*\", \"\", 1)\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"undefined situation\")\n\t\t\treturn\n\t\t}\n\t\tr = append(r, returns)\n\t\treturn\n\t}\n\tif len(block)-1 > index+3 && block[index+3] == '(' {\n\t\t// Examples returns:\n\t\t// void ( *(*)(int *, void *, char *))\n\t\t// ++++++++++++++++++++++++++++++ block\n\t\t// ^^ check this\n\t\tblock = strings.Replace(block, \"(*)\", \"\", 1)\n\t\tblock = block[1 : len(block)-1]\n\t\tindex := strings.Index(block, \"(\")\n\t\tif index < 0 {\n\t\t\terr = fmt.Errorf(\"cannot found '(' in block\")\n\t\t\treturn\n\t\t}\n\n\t\treturns = returns + block[index:]\n\t\t// example of block[:index]\n\t\t// `*signal`\n\t\t// `* signal`\n\t\tif pr := strings.TrimSpace(block[:index]); unicode.IsLetter(rune(pr[len(pr)-1])) ||\n\t\t\tunicode.IsNumber(rune(pr[len(pr)-1])) {\n\t\t\tpr = strings.Replace(pr, \"*\", \" * \", -1)\n\t\t\tfor i := len(pr) - 1; i >= 0; i-- {\n\t\t\t\tif unicode.IsLetter(rune(pr[i])) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif unicode.IsNumber(rune(pr[i])) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tprefix = pr[:i]\n\t\t\t\tfuncname = pr[i:]\n\t\t\t\tbreak\n\t\t\t}\n\t\t} else {\n\t\t\tprefix = block[:index]\n\t\t}\n\n\t\tr = append(r, returns)\n\t\treturn\n\t}\n\n\t// Examples returns:\n\t// int ( *( *(*)))\n\t// ----- return type\n\t// ========= prefix\n\t// +++++++++++ block\n\tbBlock := []byte(block)\n\tfor i := 0; i < len(bBlock); i++ {\n\t\tswitch bBlock[i] {\n\t\tcase '(', ')':\n\t\t\tbBlock[i] = ' '\n\t\t}\n\t}\n\tbBlock = bytes.Replace(bBlock, []byte(\"*\"), []byte(\"\"), 1)\n\tprefix = string(bBlock)\n\tr = append(r, returns)\n\n\treturn\n}", "func (p *PSParser) parseFunction() (*PSProgram, error) {\n\tc, _ := p.reader.ReadByte()\n\tif c != '{' {\n\t\treturn nil, errors.New(\"invalid function\")\n\t}\n\n\tfunction := NewPSProgram()\n\n\tfor {\n\t\tp.skipSpaces()\n\t\tbb, err := p.reader.Peek(2)\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\tcommon.Log.Trace(\"Peek string: %s\", string(bb))\n\t\t// Determine type.\n\t\tif bb[0] == '}' {\n\t\t\tcommon.Log.Trace(\"EOF function\")\n\t\t\tp.reader.ReadByte()\n\t\t\tbreak\n\t\t} else if bb[0] == '{' {\n\t\t\tcommon.Log.Trace(\"Function!\")\n\t\t\tinlineF, err := p.parseFunction()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tfunction.Append(inlineF)\n\t\t} else if pdfcore.IsDecimalDigit(bb[0]) || (bb[0] == '-' && pdfcore.IsDecimalDigit(bb[1])) {\n\t\t\tcommon.Log.Trace(\"->Number!\")\n\t\t\tnumber, err := p.parseNumber()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tfunction.Append(number)\n\t\t} else {\n\t\t\tcommon.Log.Trace(\"->Operand or bool?\")\n\t\t\t// Let's peek farther to find out.\n\t\t\tbb, _ = p.reader.Peek(5)\n\t\t\tpeekStr := string(bb)\n\t\t\tcommon.Log.Trace(\"Peek str: %s\", peekStr)\n\n\t\t\tif (len(peekStr) > 4) && (peekStr[:5] == \"false\") {\n\t\t\t\tb, err := p.parseBool()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tfunction.Append(b)\n\t\t\t} else if (len(peekStr) > 3) && (peekStr[:4] == \"true\") {\n\t\t\t\tb, err := p.parseBool()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tfunction.Append(b)\n\t\t\t} else {\n\t\t\t\toperand, err := p.parseOperand()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tfunction.Append(operand)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn function, nil\n}", "func ParseFunctions(filePath string) *TemplateValues {\n\tfset := token.NewFileSet()\n\tf, err := parser.ParseFile(fset, filePath, nil, parser.ParseComments)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tvar funcInfos []FunctionInfo\n\tpackageName := fmt.Sprint(f.Name)\n\tcontainsMux := false\n\n\tfor _, decl := range f.Decls {\n\t\tswitch t := decl.(type) {\n\t\tcase *ast.FuncDecl:\n\t\t\tresponseWriterParamExists := false\n\t\t\trequestParamExists := false\n\t\t\tfor _, param := range t.Type.Params.List {\n\t\t\t\tswitch t2 := param.Type.(type) {\n\t\t\t\tcase *ast.SelectorExpr:\n\t\t\t\t\tparamName := fmt.Sprint(t2.Sel.Name)\n\t\t\t\t\tif paramName == \"ResponseWriter\" {\n\t\t\t\t\t\tresponseWriterParamExists = true\n\t\t\t\t\t}\n\t\t\t\tcase *ast.StarExpr:\n\t\t\t\t\tparamName := fmt.Sprint(t2.X)\n\t\t\t\t\tif paramName == \"&{http Request}\" {\n\t\t\t\t\t\trequestParamExists = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif responseWriterParamExists && requestParamExists {\n\t\t\t\tmuxVars := getMuxVars(t)\n\t\t\t\tif len(muxVars) > 0 {\n\t\t\t\t\tcontainsMux = true\n\t\t\t\t}\n\t\t\t\tfuncInfo := FunctionInfo{\n\t\t\t\t\tName: fmt.Sprint(t.Name),\n\t\t\t\t\tMuxVars: muxVars,\n\t\t\t\t}\n\t\t\t\tfuncInfos = append(funcInfos, funcInfo)\n\t\t\t}\n\t\t}\n\t}\n\ttemplateValues := TemplateValues{\n\t\tFuncInfo: funcInfos,\n\t\tPackageName: packageName,\n\t\tContainsMux: containsMux,\n\t}\n\treturn &templateValues\n}", "func (p *parser) parseFunction(typ uint8) (expr *tree.FunctionExpr, names tree.FuncNameList) {\n\texpr = &tree.FunctionExpr{}\n\texpr.FuncToken = p.expectToken(token.FUNCTION)\n\tif typ > funcExpr {\n\t\tnames.Items = append(names.Items, p.expectToken(token.NAME))\n\t\tif typ > funcLocal {\n\t\t\tfor p.tok == token.DOT {\n\t\t\t\tnames.Seps = append(names.Seps, p.tokenNext())\n\t\t\t\tnames.Items = append(names.Items, p.expectToken(token.NAME))\n\t\t\t}\n\t\t\tif p.tok == token.COLON {\n\t\t\t\tnames.ColonToken = p.tokenNext()\n\t\t\t\tnames.MethodToken = p.expectToken(token.NAME)\n\t\t\t}\n\t\t}\n\t}\n\texpr.LParenToken = p.expectToken(token.LPAREN)\n\tif p.tok == token.NAME {\n\t\texpr.Params = &tree.NameList{Items: []tree.Token{p.expectToken(token.NAME)}}\n\t\tfor p.tok == token.COMMA {\n\t\t\tsepToken := p.tokenNext()\n\t\t\tif p.tok == token.VARARG {\n\t\t\t\texpr.VarArgSepToken = sepToken\n\t\t\t\texpr.VarArgToken = p.tokenNext()\n\t\t\t\tbreak\n\t\t\t}\n\t\t\texpr.Params.Seps = append(expr.Params.Seps, sepToken)\n\t\t\texpr.Params.Items = append(expr.Params.Items, p.expectToken(token.NAME))\n\t\t}\n\t} else if p.tok == token.VARARG {\n\t\texpr.VarArgToken = p.tokenNext()\n\t}\n\texpr.RParenToken = p.expectToken(token.RPAREN)\n\texpr.Body = p.parseBlockBody(token.END)\n\texpr.EndToken = p.expectToken(token.END)\n\treturn expr, names\n}", "func ParseFunctionDefinition(rd io.Reader) (*FunctionDefinition, error) {\n\ts := &scanner.Scanner{Mode: scanner.GoTokens}\n\ts.Init(rd)\n\tstate := StateInit\n\tvar f FunctionDefinition\n\ttokens := make([]string, 0)\n\tfor {\n\t\tr := s.Scan()\n\t\tif r == scanner.EOF {\n\t\t\tbreak\n\t\t}\n\t\tswitch state {\n\t\tcase StateInit:\n\t\t\tswitch r {\n\t\t\tcase '(':\n\t\t\t\tif len(tokens) < 2 {\n\t\t\t\t\treturn nil, fmt.Errorf(\"function definition needs at least a name and a type\")\n\t\t\t\t}\n\t\t\t\tf.Name = tokens[0]\n\t\t\t\tvar typ string\n\t\t\t\tfor _, t := range tokens[1:] {\n\t\t\t\t\tswitch t {\n\t\t\t\t\t// ignore WINAPI calling convention\n\t\t\t\t\tcase \"WINAPI\":\n\t\t\t\t\tdefault:\n\t\t\t\t\t\ttyp = t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tf.Type = translate(typ)\n\t\t\t\tif f.Type == \"\" {\n\t\t\t\t\treturn nil, fmt.Errorf(\"did not find translation type for %s\", typ)\n\t\t\t\t}\n\t\t\t\ttokens = tokens[0:0]\n\t\t\t\tstate = StateParam\n\t\t\tcase scanner.Ident:\n\t\t\t\ttokens = append([]string{s.TokenText()}, tokens...)\n\t\t\tdefault:\n\t\t\t\treturn nil, fmt.Errorf(\"parse error: got %s\", scanner.TokenString(r))\n\t\t\t}\n\t\tcase StateParam:\n\t\t\tswitch r {\n\t\t\tcase scanner.Ident:\n\t\t\t\ttokens = append([]string{s.TokenText()}, tokens...)\n\t\t\tcase ',', ')':\n\t\t\t\tif len(tokens) < 2 {\n\t\t\t\t\treturn nil, fmt.Errorf(\"function parameter needs at least a name and a type\")\n\t\t\t\t}\n\n\t\t\t\tp := FunctionParameterDefinition{Name: tokens[0]}\n\n\t\t\t\tvar typ string\n\t\t\t\tfor _, t := range tokens[1:] {\n\t\t\t\t\tswitch t {\n\t\t\t\t\tcase \"_In_\":\n\t\t\t\t\t\tp.Direction = DirectionIn\n\t\t\t\t\tcase \"_In_opt_\":\n\t\t\t\t\t\tp.Direction = DirectionInOpt\n\t\t\t\t\tcase \"_Out_\":\n\t\t\t\t\t\tp.Direction = DirectionOut\n\t\t\t\t\tcase \"_Out_opt_\":\n\t\t\t\t\t\tp.Direction = DirectionOutOpt\n\t\t\t\t\tcase \"_Inout_\":\n\t\t\t\t\t\tp.Direction = DirectionInOut\n\t\t\t\t\tcase \"_Inout_opt_\":\n\t\t\t\t\t\tp.Direction = DirectionInOutOpt\n\t\t\t\t\tcase \"_Reserved_\":\n\t\t\t\t\t\tp.Direction = DirectionReserved\n\t\t\t\t\tdefault:\n\t\t\t\t\t\ttyp = t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tp.Type = translate(typ)\n\t\t\t\tif p.Type == \"\" {\n\t\t\t\t\treturn nil, fmt.Errorf(\"did not find translation type for %s\", typ)\n\t\t\t\t}\n\t\t\t\tf.Params = append(f.Params, p)\n\t\t\t\ttokens = tokens[0:0]\n\t\t\t\tif r == ')' {\n\t\t\t\t\tstate = StateExit\n\t\t\t\t}\n\t\t\t}\n\t\tcase StateExit:\n\t\t\tswitch r {\n\t\t\tcase ';':\n\t\t\t\tstate = StateInit\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif state != StateInit {\n\t\treturn nil, fmt.Errorf(\"parse error: wrong state %d\", state)\n\t}\n\treturn &f, nil\n}", "func parseFunction(node *node32) (*FunctionDef, error) {\n\tvar err error\n\tfunction := &FunctionDef{}\n\n\tfunction.SetToken(&node.token32)\n\n\tfunction.returnType, err = parseType(nextNode(node, ruleTYPE).up)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfunction.ident = nextNode(node, ruleIDENT).match\n\n\tparamListNode := nextNode(node, rulePARAMLIST)\n\t// argument list may be missing with zero arguments\n\tif paramListNode != nil {\n\t\tfor pnode := range nodeRange(paramListNode.up) {\n\t\t\tif pnode.pegRule == rulePARAM {\n\t\t\t\tvar param *FunctionParam\n\t\t\t\tparam, err = parseParam(pnode.up)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tfunction.params = append(function.params, param)\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction.body, err = parseStatement(nextNode(node, ruleSTAT).up)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn function, nil\n}", "func (function *function) parse() (err error) {\n\tsignatureFinder := regexp.MustCompile(`(?is)CREATE(?:\\s+OR\\s+REPLACE)?\\s+FUNCTION\\s+(\\S+?)\\((.*?)\\)`)\n\tsubMatches := signatureFinder.FindStringSubmatch(function.definition)\n\n\tif len(subMatches) < 3 {\n\t\treturn fmt.Errorf(\"Can't find a function in %s\", function.path)\n\t}\n\n\tfunction.name = subMatches[1]\n\n\tif function.parseSignature {\n\t\tfunction.signature = subMatches[2]\n\t} else {\n\t\tfunction.signature, function.previousExists, err = function.previousSignature()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = function.removeDefaultFromSignature()\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (function *Function) Parse() (err error) {\n\tsignatureFinder := regexp.MustCompile(`(?is)CREATE(?:\\s+OR\\s+REPLACE)?\\s+FUNCTION\\s+(\\S+?)\\((.*?)\\)`)\n\tsubMatches := signatureFinder.FindStringSubmatch(function.Definition)\n\n\tif len(subMatches) < 3 {\n\t\treturn fmt.Errorf(\"Can't find a function in %s\", function.Path)\n\t}\n\n\tfunction.Name = subMatches[1]\n\n\tif function.ParseSignature {\n\t\tfunction.Signature = subMatches[2]\n\t} else {\n\t\tfunction.Signature, function.PreviousExists, err = function.previousSignature()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = function.removeDefaultFromSignature()\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (v *Function) Decode(sr stream.Reader) error {\n\n\tnameIsSet := false\n\tthriftNameIsSet := false\n\targumentsIsSet := false\n\n\tif err := sr.ReadStructBegin(); err != nil {\n\t\treturn err\n\t}\n\n\tfh, ok, err := sr.ReadFieldBegin()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor ok {\n\t\tswitch {\n\t\tcase fh.ID == 1 && fh.Type == wire.TBinary:\n\t\t\tv.Name, err = sr.ReadString()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tnameIsSet = true\n\t\tcase fh.ID == 2 && fh.Type == wire.TBinary:\n\t\t\tv.ThriftName, err = sr.ReadString()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tthriftNameIsSet = true\n\t\tcase fh.ID == 3 && fh.Type == wire.TList:\n\t\t\tv.Arguments, err = _List_Argument_Decode(sr)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\targumentsIsSet = true\n\t\tcase fh.ID == 4 && fh.Type == wire.TStruct:\n\t\t\tv.ReturnType, err = _Type_Decode(sr)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\tcase fh.ID == 5 && fh.Type == wire.TList:\n\t\t\tv.Exceptions, err = _List_Argument_Decode(sr)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\tcase fh.ID == 6 && fh.Type == wire.TBool:\n\t\t\tvar x bool\n\t\t\tx, err = sr.ReadBool()\n\t\t\tv.OneWay = &x\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\tcase fh.ID == 7 && fh.Type == wire.TMap:\n\t\t\tv.Annotations, err = _Map_String_String_Decode(sr)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\tdefault:\n\t\t\tif err := sr.Skip(fh.Type); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif err := sr.ReadFieldEnd(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif fh, ok, err = sr.ReadFieldBegin(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := sr.ReadStructEnd(); err != nil {\n\t\treturn err\n\t}\n\n\tif !nameIsSet {\n\t\treturn errors.New(\"field Name of Function is required\")\n\t}\n\n\tif !thriftNameIsSet {\n\t\treturn errors.New(\"field ThriftName of Function is required\")\n\t}\n\n\tif !argumentsIsSet {\n\t\treturn errors.New(\"field Arguments of Function is required\")\n\t}\n\n\treturn nil\n}", "func Parse(tokens *list.List, funcDefs map[string]int) (ParseTreeRoot, error) {\r\n\r\n\ttoken := tokens.Front()\r\n\ttree := ParseTreeRoot{make([]ParseTree, 0)}\r\n\r\n\tfor token != nil {\r\n\t\tif tokenID(token) != TokenIdentifier {\r\n\t\t\treturn tree, fmt.Errorf(\"\\\"unit\\\", \\\"assembly\\\", \\\"enum\\\", \\\"summarize\\\", or \\\"solve\\\" expected but \\\"%s\\\" given at position %d\", tokenContent(token), tokenPos(token))\r\n\t\t}\r\n\r\n\t\tswitch tokenContent(token) {\r\n\t\tcase \"unit\":\r\n\t\t\t_token, unit, err := parseUnit(token.Next(), tree, funcDefs)\r\n\t\t\ttoken = _token\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn tree, err\r\n\t\t\t}\r\n\t\t\ttree.AddUnit(unit)\r\n\t\t\tbreak\r\n\t\tcase \"enum\":\r\n\t\t\t_token, enum, err := parseEnum(token.Next(), tree)\r\n\t\t\ttoken = _token\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn tree, err\r\n\t\t\t}\r\n\t\t\ttree.AddEnum(enum)\r\n\t\t\tbreak\r\n\t\tcase \"assembly\":\r\n\t\t\t_token, assembly, err := parseAssembly(token.Next(), tree)\r\n\t\t\ttoken = _token\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn tree, err\r\n\t\t\t}\r\n\t\t\ttree.AddAssembly(assembly)\r\n\t\t\tbreak\r\n\t\tcase \"summarize\":\r\n\t\t\t_token, summarize, err := parseSummarize(token.Next(), tree)\r\n\t\t\ttoken = _token\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn tree, err\r\n\t\t\t}\r\n\t\t\ttree.AddSummarize(summarize)\r\n\t\t\tbreak\r\n\t\tcase \"solve\":\r\n\t\t\t_token, solve, err := parseSolve(token.Next(), tree)\r\n\t\t\ttoken = _token\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn tree, err\r\n\t\t\t}\r\n\t\t\ttree.AddSolve(solve)\r\n\t\t\tbreak\r\n\t\t}\r\n\t\ttoken = token.Next()\r\n\t}\r\n\r\n\treturn tree, nil\r\n\r\n}", "func Parse() {\n\tok := true\n\tfor _, f := range funcs {\n\t\tok = f() && ok\n\t}\n\tif !ok {\n\t\tos.Exit(1)\n\t}\n}", "func loadFunctions() (err error) {\n\tsuccessfulCount := len(conf.functionFiles)\n\terrors := make([]string, 0)\n\tbypass := make(map[string]bool)\n\n\tfiles, err := resolveDependencies(conf.functionFiles, conf.sqlDirPath+\"functions\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfunctions := make([]*function, 0)\n\tfor i := len(files) - 1; i >= 0; i-- {\n\t\tfile := files[i]\n\t\tf := function{}\n\t\tf.path = file\n\t\tfunctions = append(functions, &f)\n\n\t\terr = downPass(&f, f.path)\n\t\tif err != nil {\n\t\t\tsuccessfulCount--\n\t\t\terrors = append(errors, fmt.Sprintf(\"%v\\n\", err))\n\t\t\tbypass[f.path] = true\n\t\t}\n\t}\n\n\tfor i := len(functions) - 1; i >= 0; i-- {\n\t\tf := functions[i]\n\t\tif _, ignore := bypass[f.path]; !ignore {\n\t\t\terr = upPass(f, f.path)\n\t\t\tif err != nil {\n\t\t\t\tsuccessfulCount--\n\t\t\t\terrors = append(errors, fmt.Sprintf(\"%v\\n\", err))\n\t\t\t}\n\t\t}\n\t}\n\n\treport(\"functions\", successfulCount, len(conf.functionFiles), errors)\n\n\treturn\n}", "func parse(text string, program *il.Program) error {\n\tp := &parser{\n\t\tscanner: newScanner(text),\n\t\terror: nil,\n\t\tprogram: program,\n\t}\n\n\tfor !p.scanner.end() {\n\t\tif !p.scanner.next() {\n\t\t\tbreak\n\t\t}\n\t\tif p.scanner.token == tkError {\n\t\t\tp.fail(\"Parse error.\")\n\t\t\tbreak\n\t\t}\n\t\tif !p.parseFunctionDef() {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif p.failed() {\n\t\treturn p.error\n\t}\n\n\treturn nil\n}", "func (p Program) lineToFunction(line string) Function {\n\tif len(line) < 3 {\n\t\treturn Function{}\n\t}\n\n\t// divide the function and the parameter\n\tdivided := strings.Split(line, \"(\")\n\n\t// name of the function at the position 0\n\tfunctionName := divided[0]\n\n\t// handle and split parameter\n\tparams := strings.Split(divided[1], \",\")\n\n\tparameter := []interface{}{}\n\tfor _, param := range params {\n\n\t\t// check length of the parameter\n\t\tif len(param) < 1 {\n\t\t\tfmt.Println(\"drawlab: null parameter found at the function\", functionName)\n\t\t\tos.Exit(0)\n\t\t}\n\n\t\t// remove all whitespace and closed bracket\n\n\t\tparam = strings.ReplaceAll(param, \")\", \"\")\n\t\tparam = strings.ReplaceAll(param, \"\\n\", \"\")\n\n\t\t// check if first byte is a space\n\t\ttempParam := param\n\t\tif param[0] == ' ' {\n\t\t\ttempParam = param[1:]\n\t\t}\n\n\t\t// check if number\n\t\tn, err := strconv.Atoi(tempParam)\n\t\tif err != nil {\n\n\t\t\t// check if it's text for the text function\n\t\t\tif tempParam[0] == '\"' {\n\t\t\t\t// remove quotes\n\t\t\t\tparameter = append(parameter, tempParam[1:len(tempParam)-1])\n\n\t\t\t\t// check if it's variable\n\t\t\t} else if tempParam[0] == '#' {\n\n\t\t\t\t// remove '#'\n\t\t\t\tval := p.getVariable(tempParam[1:])\n\t\t\t\tparameter = append(parameter, val)\n\t\t\t}\n\t\t} else {\n\t\t\tparameter = append(parameter, n)\n\t\t}\n\t}\n\n\treturn Function{\n\t\tName: functionName,\n\t\tParameters: parameter,\n\t}\n}", "func ParseAndCallUpdateFunc(ctx context.Context, filePath string, updateFunc createOrUpdateFunc) error {\n\tjsonFile, err := os.Open(filePath)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not open file\")\n\t}\n\tdefer func() {\n\t\terr := jsonFile.Close()\n\t\tif err != nil {\n\t\t\tlog.Println(errors.Wrap(err, \"could not close the file\"))\n\t\t}\n\t}()\n\n\tdecoder := json.NewDecoder(jsonFile)\n\tt, err := decoder.Token()\n\tif delim, ok := t.(json.Delim); !ok || delim != '{' {\n\t\treturn errors.New(fmt.Sprintf(\"expected first token to be \\\"{\\\", got %s \", delim))\n\t}\n\tfor decoder.More() {\n\t\ttoken, err := decoder.Token()\n\t\ttokenStr, ok := token.(string)\n\t\tif !ok && tokenStr != strings.ToUpper(tokenStr) {\n\t\t\treturn errors.New(\"token must be an uppercase string\")\n\t\t}\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to get json token\")\n\t\t}\n\n\t\tfor decoder.More() {\n\t\t\tport := &pb.Port{}\n\t\t\terr = decoder.Decode(port)\n\t\t\tif err != nil {\n\t\t\t\tif err.Error() == \"not at beginning of value\" {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\treturn errors.Wrap(err, \"could not decode data\")\n\t\t\t}\n\t\t\t_, err := updateFunc(ctx, port)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"failed to call updateFunc\")\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func Parse(someTokens []lexer.Token) []Node {\n\tnodes := []Node{}\n\ttokens = someTokens\n\tindex = 0\n\n\tfor {\n\t\ttoken := tokens[index]\n\n\t\tswitch {\n\t\tcase token.Type == lexer.EOF:\n\t\t\treturn nodes\n\t\tcase token.Type == lexer.LineBreak:\n\t\t\tindex++\n\t\t\tcontinue\n\t\tcase token.Type == lexer.KeywordFn:\n\t\t\tnodes = append(\n\t\t\t\tnodes,\n\t\t\t\tparseFunction())\n\t\tcase token.Type == lexer.KeywordStruct:\n\t\t\tnodes = append(\n\t\t\t\tnodes,\n\t\t\t\tparseStruct())\n\t\tdefault:\n\t\t\tmsg := fmt.Sprintf(\"Don't know how to parse: %v\", token)\n\t\t\tpanic(msg)\n\t\t}\n\t}\n}", "func (p *Parser) parseFunctionParams() []*ast.Identifier {\n\tvar ret []*ast.Identifier\n\n\tif p.peek.Is(token.RPAREN) {\n\t\tp.next()\n\t\treturn ret\n\t}\n\n\tp.next()\n\tret = append(ret, &ast.Identifier{Token: p.cur, Value: p.cur.Lit})\n\n\tfor p.peek.Is(token.COMMA) {\n\t\tp.next()\n\t\tp.next()\n\t\tret = append(ret, &ast.Identifier{Token: p.cur, Value: p.cur.Lit})\n\t}\n\n\tif !p.expectPeek(token.RPAREN) {\n\t\treturn nil\n\t}\n\treturn ret\n}", "func findFunctions(file *ast.File, match matchFunc, pkgPath string) []*Func {\n\tvar funcs []*Func\n\n\t// required because it's possible that the struct and the method are in different files\n\tpkgDecls := getPackageDecls(pkgPath)\n\n\tfor _, decl := range file.Decls {\n\t\tfd, ok := decl.(*ast.FuncDecl)\n\t\tif !ok || !match(fd) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// will handle non-method / functions without receiver\n\t\tif fd.Recv == nil {\n\t\t\tfuncs = append(funcs, NewFunc(fd, nil, file, pkgDecls, pkgPath))\n\t\t\tcontinue\n\t\t}\n\n\t\tstExp, ok := fd.Recv.List[0].Type.(*ast.StarExpr)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tid, ok := stExp.X.(*ast.Ident)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tstrType := getStructType(pkgDecls, id.Name)\n\t\tif fd.Recv.List[0].Type.(*ast.StarExpr).X.(*ast.Ident).Obj == nil {\n\t\t\tfd.Recv.List[0].Type.(*ast.StarExpr).X.(*ast.Ident).Obj = generateTypeObject(id, strType)\n\t\t}\n\n\t\tfuncs = append(funcs, NewFunc(fd, strType, file, pkgDecls, pkgPath))\n\t}\n\n\treturn funcs\n}", "func (p *Parser) AddBuiltInFuncs() {\n\tp.defs.Funcs = append(p.defs.Funcs,\n\t\t&oop.Fn{\n\t\t\tName: \"print\",\n\t\t\tDefaultParamCount: 2,\n\t\t\tSrc: functions.Print,\n\t\t\tParams: []oop.Param{{\n\t\t\t\tName: \"value\",\n\t\t\t\tParams: true,\n\t\t\t\tDefaultVal: oop.Val{Data: \"\", Type: oop.String},\n\t\t\t}},\n\t\t}, &oop.Fn{\n\t\t\tName: \"println\",\n\t\t\tSrc: functions.Println,\n\t\t\tDefaultParamCount: 2,\n\t\t\tParams: []oop.Param{{\n\t\t\t\tName: \"value\",\n\t\t\t\tParams: true,\n\t\t\t\tDefaultVal: oop.Val{Data: oop.NewListModel(oop.Val{Data: \"\", Type: oop.String}), Type: oop.List},\n\t\t\t}},\n\t\t}, &oop.Fn{\n\t\t\tName: \"input\",\n\t\t\tSrc: functions.Input,\n\t\t\tDefaultParamCount: 1,\n\t\t\tParams: []oop.Param{{\n\t\t\t\tName: \"message\",\n\t\t\t\tDefaultVal: oop.Val{Data: \"\", Type: oop.String},\n\t\t\t}},\n\t\t}, &oop.Fn{\n\t\t\tName: \"exit\",\n\t\t\tDefaultParamCount: 1,\n\t\t\tSrc: functions.Exit,\n\t\t\tParams: []oop.Param{{\n\t\t\t\tName: \"code\",\n\t\t\t\tDefaultVal: oop.Val{Data: 0., Type: oop.Int},\n\t\t\t}},\n\t\t}, &oop.Fn{\n\t\t\tName: \"len\",\n\t\t\tSrc: functions.Len,\n\t\t\tDefaultParamCount: 0,\n\t\t\tParams: []oop.Param{{Name: \"object\"}},\n\t\t}, &oop.Fn{\n\t\t\tName: \"range\",\n\t\t\tDefaultParamCount: 1,\n\t\t\tSrc: functions.Range,\n\t\t\tParams: []oop.Param{\n\t\t\t\t{Name: \"start\"},\n\t\t\t\t{Name: \"to\"},\n\t\t\t\t{\n\t\t\t\t\tName: \"step\",\n\t\t\t\t\tDefaultVal: oop.Val{Data: 1., Type: oop.Int},\n\t\t\t\t},\n\t\t\t},\n\t\t}, &oop.Fn{\n\t\t\tName: \"calloc\",\n\t\t\tSrc: functions.Calloc,\n\t\t\tDefaultParamCount: 0,\n\t\t\tParams: []oop.Param{{Name: \"size\"}},\n\t\t}, &oop.Fn{\n\t\t\tName: \"realloc\",\n\t\t\tDefaultParamCount: 0,\n\t\t\tSrc: functions.Realloc,\n\t\t\tParams: []oop.Param{{Name: \"base\"}, {Name: \"size\"}},\n\t\t}, &oop.Fn{\n\t\t\tName: \"string\",\n\t\t\tSrc: functions.String,\n\t\t\tDefaultParamCount: 1,\n\t\t\tParams: []oop.Param{\n\t\t\t\t{Name: \"object\"},\n\t\t\t\t{\n\t\t\t\t\tName: \"type\",\n\t\t\t\t\tDefaultVal: oop.Val{Data: \"parse\", Type: oop.String},\n\t\t\t\t},\n\t\t\t},\n\t\t}, &oop.Fn{\n\t\t\tName: \"int\",\n\t\t\tSrc: functions.Int,\n\t\t\tDefaultParamCount: 1,\n\t\t\tParams: []oop.Param{\n\t\t\t\t{Name: \"object\"},\n\t\t\t\t{\n\t\t\t\t\tName: \"type\",\n\t\t\t\t\tDefaultVal: oop.Val{Data: \"parse\", Type: oop.String},\n\t\t\t\t},\n\t\t\t},\n\t\t}, &oop.Fn{\n\t\t\tName: \"float\",\n\t\t\tSrc: functions.Float,\n\t\t\tDefaultParamCount: 0,\n\t\t\tParams: []oop.Param{{Name: \"object\"}},\n\t\t}, &oop.Fn{\n\t\t\tName: \"panic\",\n\t\t\tSrc: functions.Panic,\n\t\t\tDefaultParamCount: 0,\n\t\t\tParams: []oop.Param{{Name: \"msg\"}},\n\t\t}, &oop.Fn{\n\t\t\tName: \"type\",\n\t\t\tSrc: functions.Type,\n\t\t\tDefaultParamCount: 0,\n\t\t\tParams: []oop.Param{{Name: \"obj\"}},\n\t\t},\n\t)\n}", "func (s *BaseGraffleParserListener) EnterFunctions_block(ctx *Functions_blockContext) {}", "func listFunction() ([]*Function, error) {\n\tvar err error\n\n\tc := http.Client{}\n\n\trequest, _ := http.NewRequest(http.MethodGet, gateway_url+\"function/list-flow-functions\", nil)\n\tresponse, err := c.Do(request)\n\n\tif err == nil {\n\t\tdefer response.Body.Close()\n\n\t\tif response.Body != nil {\n\t\t\tbodyBytes, bErr := ioutil.ReadAll(response.Body)\n\t\t\tif bErr != nil {\n\t\t\t\tlog.Fatal(bErr)\n\t\t\t}\n\n\t\t\tfunctions := []*Function{}\n\t\t\tmErr := json.Unmarshal(bodyBytes, &functions)\n\t\t\tif mErr != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to get function list, %v\", mErr)\n\t\t\t}\n\n\t\t\treturn functions, nil\n\t\t}\n\t\treturn make([]*Function, 0), nil\n\t}\n\n\treturn nil, fmt.Errorf(\"failed to get function list, %v\", err)\n}", "func (p *parser) parseFuncArgs() (args tree.Args) {\n\tswitch p.tok {\n\tcase token.LPAREN:\n\t\ta := &tree.ListArgs{}\n\t\ta.LParenToken = p.tokenNext()\n\t\tfor p.tok != token.RPAREN {\n\t\t\tif a.Values == nil {\n\t\t\t\ta.Values = &tree.ExprList{}\n\t\t\t}\n\t\t\ta.Values.Items = append(a.Values.Items, p.parseExpr())\n\t\t\tif p.tok == token.COMMA {\n\t\t\t\ta.Values.Seps = append(a.Values.Seps, p.tokenNext())\n\t\t\t} else {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\ta.RParenToken = p.expectToken(token.RPAREN)\n\t\targs = a\n\tcase token.LBRACE:\n\t\ta := &tree.TableArg{}\n\t\ta.Value = *p.parseTableCtor()\n\t\targs = a\n\tcase token.STRING, token.LONGSTRING:\n\t\ta := &tree.StringArg{}\n\t\ta.Value = *p.parseString()\n\t\targs = a\n\tdefault:\n\t\tp.error(p.off, \"function arguments expected\")\n\t}\n\treturn args\n}", "func ParseLinksFunc(host string) LinkParser {\n\tvalidLink := regexp.MustCompile(`(http|ftp|https)://(` + host + `)([\\w.,@?^=%&:/~+#-]*[\\w@?^=%&/~+#-])?`)\n\treturn func(host, body string) []string {\n\t\treturn validLink.FindAllString(body, -1)\n\t\t// TODO: handle relative links and make more sophisticated\n\t}\n}", "func (s *BashScript) Functions() ([]*Function, error) {\n\tfuncs := make([]*Function, 0)\n\n\tfnames, err := s.FunctionNames()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tannotations, err := s.FunctionAnnotations()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// TODO: Make this part shared for all shell types\n\tfor _, fname := range fnames {\n\t\ts.Log.WithFields(logrus.Fields{\n\t\t\t\"func\": fname,\n\t\t}).Debugf(\"building function\")\n\n\t\tf := &Function{\n\t\t\tName: fname,\n\t\t\tOptions: cmd.NewOptionsSet(fname),\n\t\t}\n\n\t\toptions := make(map[string]*cmd.Option, 0)\n\n\t\tfor _, a := range annotations {\n\t\t\tcmdName := a.NamespaceValues[\"cmd\"]\n\t\t\tif cmdName == \"\" || cmdName != f.Name {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ts.Log.WithFields(logrus.Fields{\n\t\t\t\t\"func\": a.NamespaceValues[\"cmd\"],\n\t\t\t\t\"namespace\": a.Namespace,\n\t\t\t\t\"key\": a.Key,\n\t\t\t}).Debugf(\"handling annotation\")\n\n\t\t\tswitch a.Namespace {\n\t\t\tcase config.CommandAnnotationCmdOptionNamespace:\n\t\t\t\tname := a.NamespaceValues[\"option\"]\n\t\t\t\tif name == \"\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif options[name] == nil {\n\t\t\t\t\toptions[name] = &cmd.Option{Type: cmd.StringOption, Name: name}\n\t\t\t\t}\n\t\t\t\tswitch a.Key {\n\t\t\t\tcase \"type\":\n\t\t\t\t\toptions[name].Type = cmd.StringToOptionType(a.Value)\n\t\t\t\tcase \"short\":\n\t\t\t\t\toptions[name].Short = a.Value\n\t\t\t\tcase \"envName\":\n\t\t\t\t\toptions[name].EnvName = a.Value\n\t\t\t\tcase \"default\":\n\t\t\t\t\toptions[name].Default = a.Value\n\t\t\t\tcase \"required\":\n\t\t\t\t\trequired, err := strconv.ParseBool(a.Value)\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\toptions[name].Required = required\n\t\t\t\t\t}\n\t\t\t\tcase \"description\":\n\t\t\t\t\toptions[name].Description = a.Value\n\t\t\t\tcase \"hidden\":\n\t\t\t\t\thidden, err := strconv.ParseBool(a.Value)\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\toptions[name].Hidden = hidden\n\t\t\t\t\t}\n\t\t\t\tcase \"values\":\n\t\t\t\t\tvalues := make([]cmd.OptionValue, 0)\n\t\t\t\t\tif err := json.Unmarshal([]byte(a.Value), &values); err != nil {\n\t\t\t\t\t\ts.Log.WithFields(logrus.Fields{\n\t\t\t\t\t\t\t\"option\": name,\n\t\t\t\t\t\t\t\"json\": a.Value,\n\t\t\t\t\t\t}).Warn(\"error parsing json values, \", err.Error())\n\t\t\t\t\t}\n\t\t\t\t\toptions[name].Values = values\n\t\t\t\t}\n\t\t\tcase config.CommandAnnotationCmdNamespace:\n\t\t\t\tswitch a.Key {\n\t\t\t\tcase \"description\":\n\t\t\t\t\tf.Description = a.Value\n\t\t\t\tcase \"help\":\n\t\t\t\t\tf.Help = a.Value\n\t\t\t\tcase \"hidden\":\n\t\t\t\t\thidden, err := strconv.ParseBool(a.Value)\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\tf.Hidden = hidden\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor _, v := range options {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\ts.Log.WithFields(logrus.Fields{\n\t\t\t\t\t\"option\": v.Name,\n\t\t\t\t\t\"type\": v.Type,\n\t\t\t\t}).Warn(err.Error())\n\t\t\t} else {\n\t\t\t\tif err := f.Options.Add(v); err != nil {\n\t\t\t\t\ts.Log.WithFields(logrus.Fields{\n\t\t\t\t\t\t\"option\": v.Name,\n\t\t\t\t\t\t\"type\": v.Type,\n\t\t\t\t\t}).Warn(err.Error())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfuncs = append(funcs, f)\n\t}\n\n\treturn funcs, nil\n}", "func (p *parser) parseFuncDef(dotted bool, name string) (ast.Statement, bool) {\n\tif succ, toks := p.accept(token.LEFT_PAREN); !succ {\n\t\treturn p.errorStmt(true, \"Invalid token in function definition: %v\", toks[len(toks)-1])\n\t}\n\tf := &ast.FunctionDef{Static: !dotted, Name: name}\n\tfor p.peek().Type != token.RIGHT_PAREN {\n\t\tsucc, toks := p.accept(token.IDENTIFIER)\n\t\tif !succ {\n\t\t\treturn p.errorStmt(true, \"Invalid token in function definition: %v\", p.peek())\n\t\t}\n\t\tname := toks[0].Val\n\t\tvar typ ast.Statement\n\t\tif p.peek().Type.IsType() {\n\t\t\ttyp, _ = p.parseType()\n\t\t}\n\t\tf.AddParam(name, typ)\n\t\tswitch p.peek().Type {\n\t\tcase token.COMMA:\n\t\t\tp.next() // eat ,\n\t\tcase token.RIGHT_PAREN:\n\t\tdefault:\n\t\t\treturn p.errorStmt(true, \"Invalid token in function definition: %v\", p.peek())\n\t\t}\n\t}\n\tif succ, toks := p.accept(token.RIGHT_PAREN); !succ {\n\t\treturn p.errorStmt(true, \"Invalid token in function definition: %v\", toks[len(toks)-1])\n\t}\n\n\t// return value(s)\n\trvs, _ := p.parseReturnValues()\n\tfor _, rv := range rvs {\n\t\tf.AddReturn(rv)\n\t}\n\n\tif succ, toks := p.accept(token.EOL, token.INDENT); !succ {\n\t\treturn p.errorStmt(true, \"Invalid token in function definition: %v\", toks[len(toks)-1])\n\t}\n\n\tfor p.peek().Type != token.DEDENT && p.peek().Type != token.EOF {\n\t\tst, _ := p.parseFuncStmt()\n\t\tf.AddStmt(st)\n\t}\n\n\tif succ, toks := p.accept(token.DEDENT, token.EOL); !succ {\n\t\tst, _ := p.errorStmt(true, \"Invalid token in function definition: %v\", toks[len(toks)-1])\n\t\tf.AddStmt(st)\n\t}\n\n\t// If it's an anonymous function and we're not in the middle of a block\n\t// (followed by either a ',' or ')' ) then put the EOL back.\n\tif name == \"\" && !p.peek().Type.IsInBlock() {\n\t\tp.backup(1)\n\t}\n\n\treturn f, false\n}", "func ofParse(a string) *Network {\n\tlines := strings.Split(a, \"\\n\")\n\n\tlinks := make(map[int]map[int]float64)\n\tlayers := make([][]int, 1)\n\tlayers[0] = make([]int, 0)\n\tfunction := make(map[int]string)\n\tcurrentLayer := 0\n\n\ttracker := -1\n\n\tfor _, line := range lines {\n\n\t\tif len(line) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tif len(line) > 0 && string(line[0]) == \"#\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tif len(line) >= 2 && line[:2] == \"->\" {\n\t\t\tdat := strings.Split(line[2:], \" \")\n\t\t\tnumba, err := strconv.Atoi(dat[0])\n\t\t\tfunctionID := dat[1]\n\t\t\tif err != nil {\n\t\t\t\tpanic(\"TROUBLE PARSING NODE ID\")\n\t\t\t}\n\t\t\tfunction[numba] = functionID\n\n\t\t\tif numba < tracker {\n\t\t\t\tcurrentLayer++\n\t\t\t\tlayers = append(layers, make([]int, 0))\n\t\t\t}\n\t\t\ttracker = numba\n\n\t\t\tlayers[currentLayer] = append(layers[currentLayer], numba)\n\t\t} else { //Line is assumed to be links\n\t\t\tsource := layers[currentLayer][len(layers[currentLayer])-1]\n\t\t\tlList := strings.Split(line, \"\\t\")\n\t\t\tlinks[source] = make(map[int]float64)\n\t\t\tfor _, item := range lList {\n\t\t\t\tif len(item) == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\titem = strings.Replace(item, \":\", \"=\", -1)\n\t\t\t\tdatums := strings.Split(item, \"=\")\n\t\t\t\tfrom, err0 := strconv.Atoi(datums[0])\n\t\t\t\tto, err1 := strconv.Atoi(datums[1])\n\t\t\t\tweight, err2 := strconv.ParseFloat(datums[2], 64)\n\t\t\t\tif from != source {\n\t\t\t\t\tpanic(\"weight / link mismatch\")\n\t\t\t\t}\n\t\t\t\tif err0 != nil || err1 != nil || err2 != nil {\n\t\t\t\t\tpanic(\"error converting from string\")\n\t\t\t\t}\n\t\t\t\tlinks[from][to] = weight\n\t\t\t}\n\n\t\t}\n\t}\n\n\t// fmt.Println(layers, links, function)\n\n\treverseLookup := make(map[int]*node)\n\n\tnet := new(Network)\n\n\tnet.inputNodes = make([]*node, len(layers[0]))\n\tfor i := range net.inputNodes {\n\t\tnode := new(node)\n\t\tid := layers[0][i]\n\t\tnode.activation = byID(function[id])\n\t\tnode.activationD = byIDD(function[id])\n\t\t// node.delta = float64(id)\n\t\treverseLookup[layers[0][i]] = node\n\t\tnet.inputNodes[i] = node\n\t}\n\n\tnet.hiddenNodes = make([][]*node, 0)\n\tfor hid := 1; hid <= len(layers)-2; hid++ {\n\t\tlayer := make([]*node, len(layers[hid]))\n\t\tfor i := 0; i < len(layer); i++ {\n\t\t\tnode := new(node)\n\t\t\tid := layers[hid][i]\n\t\t\tnode.activation = byID(function[id])\n\t\t\tnode.activationD = byIDD(function[id])\n\t\t\t// node.delta = float64(id)\n\t\t\treverseLookup[layers[hid][i]] = node\n\t\t\tlayer[i] = node\n\t\t}\n\t\tnet.hiddenNodes = append(net.hiddenNodes, layer)\n\t}\n\n\tlastPl := len(layers) - 1\n\n\tnet.outputNodes = make([]*node, len(layers[lastPl]))\n\tfor i := range net.outputNodes {\n\t\tnode := new(node)\n\t\tid := layers[lastPl][i]\n\t\tnode.activation = byID(function[id])\n\t\tnode.activationD = byIDD(function[id])\n\t\t// node.delta = float64(id)\n\t\treverseLookup[layers[lastPl][i]] = node\n\t\tnet.outputNodes[i] = node\n\t}\n\n\tfor from, chart := range links {\n\t\tfor to, weight := range chart {\n\t\t\tfro := reverseLookup[from]\n\t\t\tot := reverseLookup[to]\n\t\t\tfro.forward = append(fro.forward, ot)\n\t\t\tfro.weights = append(fro.weights, weight)\n\t\t}\n\t}\n\n\treturn net\n\n}", "func (dp *Dumper) getFunctions() ([]functionSchema, error) {\n\tquery := \"\" +\n\t\t\"SELECT n.nspname, p.proname, l.lanname, \" +\n\t\t\" CASE WHEN l.lanname = 'internal' THEN p.prosrc ELSE pg_get_functiondef(p.oid) END as definition, \" +\n\t\t\" pg_get_function_arguments(p.oid) \" +\n\t\t\"FROM pg_proc p \" +\n\t\t\"LEFT JOIN pg_namespace n ON p.pronamespace = n.oid \" +\n\t\t\"LEFT JOIN pg_language l ON p.prolang = l.oid \" +\n\t\t\"LEFT JOIN pg_type t ON t.oid = p.prorettype \" +\n\t\t\"WHERE n.nspname NOT IN ('pg_catalog', 'information_schema');\"\n\n\tvar fs []functionSchema\n\trows, err := dp.conn.DB.Query(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar f functionSchema\n\t\tif err := rows.Scan(&f.schemaName, &f.name, &f.language, &f.statement, &f.arguments); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tf.schemaName, f.name = quoteIdentifier(f.schemaName), quoteIdentifier(f.name)\n\t\tfs = append(fs, f)\n\t}\n\n\treturn fs, nil\n}", "func (p *Parser) nextFunction() {\n\tp.enterNext()\n\n\ttok := p.tok\n\t_, err := p.scope.Lookup(tok)\n\tif err != nil {\n\t\tuserErr(err, tok)\n\t}\n\n\tp.exitNext()\n}", "func NewFunctions() Functions {\n\treturn dynaml.NewFunctions()\n}", "func NewFunctions(configs []FunctionInfo) (*Functions, error) {\n\tclients := map[string]*baetyl.FClient{}\n\tfor _, cfg := range configs {\n\t\tif cfg.Address == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tcli, err := baetyl.NewFClient(cfg.FunctionClientConfig)\n\t\tif err != nil {\n\t\t\tfor _, item := range clients {\n\t\t\t\titem.Close()\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"failed to create function client: %s\", err.Error())\n\t\t}\n\t\tclients[cfg.Name] = cli\n\t}\n\treturn &Functions{\n\t\tconfigs: configs,\n\t\tclients: clients,\n\t}, nil\n}", "func ParseSymTblFunc(ld *LineDesc) {\n var pd ParamDesc;\n var func_t *libgogo.TypeDesc = nil;\n var some_t *libgogo.TypeDesc = nil;\n var fwdStr string;\n var fwdNum uint64;\n var pkgFunc string;\n var funcName string;\n var pkgName string;\n var ind uint64;\n var paramType string;\n var tmpParam *libgogo.ObjectDesc;\n\n InitParamDesc(&pd);\n\n fwdStr = GetNextSymToken(ld);\n fwdNum = libgogo.StringToInt(fwdStr);\n pkgFunc = GetNextSymToken(ld);\n ind = libgogo.StringCompare(pkgFunc, \"main·init\");\n if ind != 0 {\n pkgName = GetPackageName(pkgFunc);\n funcName = GetFuncName(pkgFunc);\n func_t = NewFunction(funcName, pkgName, fwdNum);\n paramType = GetNextSymToken(ld);\n ind = libgogo.StringLength(paramType);\n for ; ind != 0 ; {\n ParseSymbolParam(&pd, paramType);\n tmpParam = libgogo.NewObject(pd.Name, \"\", libgogo.CLASS_PARAMETER);\n some_t = libgogo.GetType(pd.TypeName, pd.TypePackage, GlobalTypes, 1);\n if some_t != nil {\n tmpParam.ObjType = some_t;\n tmpParam.PtrType = pd.Ptr;\n libgogo.AddParameters(tmpParam, func_t);\n } else {\n LinkError(\"unable to find type '\",pd.TypePackage,\"·\",pd.TypeName,\"'.\");\n }\n paramType = GetNextSymToken(ld);\n ind = libgogo.StringLength(paramType);\n }\n }\n\n}", "func parseFnType(p *Parser) (types.TypeNode, error) {\n\tnxt := p.Next()\n\tif nxt.Token != tokens.RPAREN {\n\t\treturn nil, fmt.Errorf(\"unexpected token %s, expected \\\"(\\\"\", nxt.Value)\n\t}\n\t// varName := p.Next()\n\tparams := make([]types.TypeNode, 0)\n\tpeek := p.Peek()\n\tif peek.Token == tokens.LPAREN {\n\t\tp.Next()\n\t} else {\n\t\tfor nxt.Token != tokens.LPAREN {\n\t\t\tvarName := p.Next()\n\t\t\tif varName.Token != tokens.VARNAME {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected token %s, expected \\\"VARNAME\\\"\", varName)\n\t\t\t}\n\t\t\tcolon := p.Next()\n\t\t\tif colon.Token != tokens.COLON {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected token %s, expected \\\":\\\"\", colon)\n\t\t\t}\n\t\t\ttp, err := typeRule(p)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tparams = append(params, tp)\n\t\t\tnxt = p.Next()\n\t\t\tif !(nxt.Token == tokens.COMMA || nxt.Token == tokens.LPAREN) {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected token %s, expected %q or %q\", nxt, \",\", \")\")\n\t\t\t}\n\t\t}\n\n\t}\n\tarrow := p.Peek()\n\tvar retType types.TypeNode = nil\n\tvar err error\n\tif arrow.Token == tokens.ARROW {\n\t\tp.Next()\n\t\tretType, err = typeRule(p)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn &types.FnType{\n\t\tParameters: params,\n\t\tReturnVal: retType,\n\t}, nil\n}", "func ListFunctions(db *bolt.DB) ([]Function, error) {\n\n\tvar result = make([]Function, 0)\n\n\tdb.View(func(tx *bolt.Tx) error {\n\t\t// Assume bucket exists and has keys\n\t\tbucket := tx.Bucket([]byte(ResourceName))\n\n\t\tbucket.ForEach(func(key, value []byte) error {\n\t\t\tfmt.Printf(\"key=%s, value=%s\\n\", key, value)\n\n\t\t\tpersistedFunction := Function{}\n\t\t\tjson.Unmarshal(value, &persistedFunction)\n\n\t\t\tresult = append(result, persistedFunction)\n\t\t\tfmt.Printf(\"result: %v\\n\", result)\n\n\t\t\treturn nil\n\t\t})\n\t\treturn nil\n\t})\n\n\treturn result, nil\n}", "func parse(s *scanner, line string) (receiver, fn, arg, results string) {\n\tvar remaining string\n\ttokens := strings.SplitN(line, \"#\", 2)\n\tif len(tokens) > 2 {\n\t\ts.Fatalf(\"malformed input: expecting a single '#' separator for the results\")\n\t}\n\toperation := strings.TrimSpace(tokens[0])\n\tif len(tokens) == 2 {\n\t\tresults = strings.TrimSpace(tokens[1])\n\t}\n\n\ttokens = strings.SplitN(operation, \".\", 2)\n\tif len(tokens) != 2 {\n\t\ts.Fatalf(\"malformed input: expecting a single '.' separator for the receiver\")\n\t}\n\treceiver, remaining = tokens[0], tokens[1]\n\n\ttokens = strings.Split(remaining, \"(\")\n\tif len(tokens) != 2 {\n\t\ts.Fatalf(\"malformed input: expecting a single '(' for the fn\")\n\t}\n\tfn, remaining = tokens[0], tokens[1]\n\tif !strings.HasSuffix(remaining, \")\") {\n\t\ts.Fatalf(\"malformed input: expecting a closing ')' for the arg\")\n\t}\n\n\ttokens = strings.Split(remaining, \")\")\n\tif len(tokens) != 2 {\n\t\ts.Fatalf(\"malformed input: expecting a single ')' for the fn\")\n\t}\n\n\targ, remaining = tokens[0], tokens[1]\n\tif remaining != \"\" {\n\t\ts.Fatalf(\"malformed input: expecting nothing after closing ')'\")\n\t}\n\n\treturn receiver, fn, arg, results\n}", "func (parser *Parser) funcsDeclars() ([]*Function, error) {\n\tparser.trace(\"FUNCS DECLARS\")\n\tfunction, err := parser.funcDeclar()\n\t// Empty, is not an error\n\tif err == ErrNoMatch {\n\t\treturn nil, nil\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfuncs, err := parser.funcsDeclars()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn append([]*Function{function}, funcs...), nil\n}", "func ReadFunc(r io.Reader, fn func(Line) error) error {\n\ter := NewReader(r)\n\tfor {\n\t\tline, err := er.Read()\n\t\tif err == io.EOF {\n\t\t\treturn nil\n\t\t} else if err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = fn(line)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n}", "func parseFunctionFlag() {\n\tswitch fun {\n\tcase \"exp\":\n\t\tf = plot.Exp\n\tcase \"log\":\n\t\tf = plot.Log\n\tcase \"sqrt\":\n\t\tf = plot.Sqrt\n\tcase \"lin\":\n\t\tf = plot.Lin\n\tdefault:\n\t\tlogrus.Fatalln(\"invalid color scaling function:\", fun)\n\t}\n}", "func findFuncs(name string) ([]*FuncExtent, error) {\n\tfset := token.NewFileSet()\n\tparsedFile, err := parser.ParseFile(fset, name, nil, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvisitor := &FuncVisitor{\n\t\tfset: fset,\n\t\tname: name,\n\t\tastFile: parsedFile,\n\t}\n\tast.Walk(visitor, visitor.astFile)\n\treturn visitor.funcs, nil\n}", "func generateParseFunc(headers []string, fieldDelimiter rune, lazyQuotes bool, ignoreQuotes bool) parseFunc {\n\tif ignoreQuotes {\n\t\treturn generateSplitParseFunc(headers, fieldDelimiter)\n\t}\n\treturn generateCSVParseFunc(headers, fieldDelimiter, lazyQuotes)\n}", "func parseFuncDecl(bci *BenchClientInfo, decl *ast.FuncDecl) {\n\tif !strings.HasPrefix(decl.Name.String(), \"New\") {\n\t\treturn\n\t}\n\n\tfuncName := decl.Name.String()\n\tfor _, r := range decl.Type.Results.List {\n\t\tretName := types.ExprString(r.Type)\n\t\tif s, ok := bci.Services[retName]; ok {\n\t\t\t// s has already been added in parseGenDecl()\n\t\t\ts.Factory = funcName\n\t\t}\n\t}\n}", "func (i *Interface) parseDependencies() {\n\tvar dependencies []string\n\tfor _, function := range i.Functions {\n\n\t\t// \"expanded\" refers to creating a parsers.from a templated type, i.e \"QMap <int, QString>\" becomes [QMap int QString]\n\t\texpandedReturnType := strings.FieldsFunc(function.ReturnType, templatedTypeSeparators) \n\t\tfor _, dataType := range(expandedReturnType) {\n\t\t\tdependencies = append(dependencies, strings.TrimSpace(dataType))\n\t\t}\n\n\t\tfor _, parameter := range function.Parameters {\n\t\t\texpandedParameter := strings.FieldsFunc(parameter.Type, templatedTypeSeparators)\n\t\t\tfor _, innerParameter := range expandedParameter {\n\t\t\t\tdependencies = append(dependencies, strings.TrimSpace(innerParameter))\n\t\t\t} \n\t\t}\n\t}\n\ti.Dependencies = dependencies\n\ti.Dependencies = parsers.RemoveConstSpecifiers(i.Dependencies)\n\ti.Dependencies = parsers.RemovePointersAndReferences(i.Dependencies)\n\ti.Dependencies = parsers.RemoveStdDataTypes(i.Dependencies)\n\ti.Dependencies = parsers.MapDataTypesToLibraryDependencies(i.Dependencies)\n\ti.Dependencies = parsers.RemoveDuplicates(i.Dependencies)\n\tsort.Strings(i.Dependencies)\n}", "func parseFuncDocs(file *ast.File, fd *ast.FuncDecl) TestDoc {\n\td := TestDoc{\n\t\tname: fd.Name.Name,\n\t\tdescription: strings.TrimPrefix(fd.Doc.Text(), fd.Name.Name+\" \"),\n\t\tisSubTest: strings.HasPrefix(fd.Name.Name, \"valid\"),\n\t}\n\n\tfor _, c := range file.Comments {\n\t\tfor _, ci := range c.List {\n\t\t\tif ci.Pos() < fd.Pos() || ci.End() > fd.End() {\n\t\t\t\t// only generate docs for comments that are within the function scope\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttext := strings.TrimPrefix(ci.Text, \"// \")\n\t\t\tm := docsRegex.FindStringSubmatch(text)\n\t\t\tif len(m) < 2 {\n\t\t\t\t// comment doesn't start with `docs: ` or `docs(...): `\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tmatched := m[0]\n\t\t\tdocsType := m[1]\n\n\t\t\ttext = strings.TrimPrefix(text, matched)\n\t\t\tswitch docsType {\n\t\t\tcase \"special\":\n\t\t\t\td.specialCases = append(d.specialCases, text)\n\t\t\tcase \"skip\":\n\t\t\t\td.skips = append(d.skips, text)\n\t\t\tcase \"\":\n\t\t\t\td.steps = append(d.steps, text)\n\t\t\tdefault:\n\t\t\t\tlog.Printf(\"docs type %s is not recognized\", docsType)\n\t\t\t}\n\t\t}\n\t}\n\treturn d\n}", "func (c *Config) ParseFunction(path string) string {\n\tpath = strings.TrimPrefix(path, c.Path)\n\tpos := strings.Index(path, \"?\")\n\tif pos > -1 {\n\t\tpath = path[:pos]\n\t}\n\tpos = strings.Index(path, \"#\")\n\tif pos > -1 {\n\t\tpath = path[:pos]\n\t}\n\n\treturn strings.Split(path, \"/\")[0]\n}", "func TestFunctionSection(t *testing.T) {\n testCases := []struct{\n name string\n encoded []byte\n decoded FunctionSection\n status error\n }{\n\t\t// 1 function\n { \"function1\",\n []byte{ 1, 0 },\n FunctionSection{ []uint32{ 0 } },\n nil },\n\n\t\t// 2 functions\n { \"function2\",\n []byte{ 2, 0xA, 0xB },\n FunctionSection{ []uint32{ 0xA, 0xB } },\n nil },\n }\n\n for _, test := range testCases {\n t.Run(test.name, func(t *testing.T) {\n section, err := readFunctionSection(test.encoded)\n if (err != test.status) {\n t.Error(\"Unexpected decoding status: \", err)\n }\n if (err == nil) {\n if (len(section.function) != len(test.decoded.function)) {\n t.Error(\"Unexpected decoded length: \", section)\n }\n // Assume each successful decode has at least 1 function\n if (section.function[0] != test.decoded.function[0]) {\n t.Error(\"Unexpected decoded function[0]: \", section)\n }\n\t\t\t}\n })\n }\n}", "func (j *LuaFunction) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {\n\tvar err error\n\tcurrentKey := ffjtLuaFunctionbase\n\t_ = currentKey\n\ttok := fflib.FFTok_init\n\twantedTok := fflib.FFTok_init\n\nmainparse:\n\tfor {\n\t\ttok = fs.Scan()\n\t\t//\tprintln(fmt.Sprintf(\"debug: tok: %v state: %v\", tok, state))\n\t\tif tok == fflib.FFTok_error {\n\t\t\tgoto tokerror\n\t\t}\n\n\t\tswitch state {\n\n\t\tcase fflib.FFParse_map_start:\n\t\t\tif tok != fflib.FFTok_left_bracket {\n\t\t\t\twantedTok = fflib.FFTok_left_bracket\n\t\t\t\tgoto wrongtokenerror\n\t\t\t}\n\t\t\tstate = fflib.FFParse_want_key\n\t\t\tcontinue\n\n\t\tcase fflib.FFParse_after_value:\n\t\t\tif tok == fflib.FFTok_comma {\n\t\t\t\tstate = fflib.FFParse_want_key\n\t\t\t} else if tok == fflib.FFTok_right_bracket {\n\t\t\t\tgoto done\n\t\t\t} else {\n\t\t\t\twantedTok = fflib.FFTok_comma\n\t\t\t\tgoto wrongtokenerror\n\t\t\t}\n\n\t\tcase fflib.FFParse_want_key:\n\t\t\t// json {} ended. goto exit. woo.\n\t\t\tif tok == fflib.FFTok_right_bracket {\n\t\t\t\tgoto done\n\t\t\t}\n\t\t\tif tok != fflib.FFTok_string {\n\t\t\t\twantedTok = fflib.FFTok_string\n\t\t\t\tgoto wrongtokenerror\n\t\t\t}\n\n\t\t\tkn := fs.Output.Bytes()\n\t\t\tif len(kn) <= 0 {\n\t\t\t\t// \"\" case. hrm.\n\t\t\t\tcurrentKey = ffjtLuaFunctionnosuchkey\n\t\t\t\tstate = fflib.FFParse_want_colon\n\t\t\t\tgoto mainparse\n\t\t\t} else {\n\t\t\t\tswitch kn[0] {\n\n\t\t\t\tcase 'a':\n\n\t\t\t\t\tif bytes.Equal(ffjKeyLuaFunctionArgList, kn) {\n\t\t\t\t\t\tcurrentKey = ffjtLuaFunctionArgList\n\t\t\t\t\t\tstate = fflib.FFParse_want_colon\n\t\t\t\t\t\tgoto mainparse\n\t\t\t\t\t}\n\n\t\t\t\tcase 'i':\n\n\t\t\t\t\tif bytes.Equal(ffjKeyLuaFunctionIsVarArg, kn) {\n\t\t\t\t\t\tcurrentKey = ffjtLuaFunctionIsVarArg\n\t\t\t\t\t\tstate = fflib.FFParse_want_colon\n\t\t\t\t\t\tgoto mainparse\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif fflib.EqualFoldRight(ffjKeyLuaFunctionArgList, kn) {\n\t\t\t\t\tcurrentKey = ffjtLuaFunctionArgList\n\t\t\t\t\tstate = fflib.FFParse_want_colon\n\t\t\t\t\tgoto mainparse\n\t\t\t\t}\n\n\t\t\t\tif fflib.EqualFoldRight(ffjKeyLuaFunctionIsVarArg, kn) {\n\t\t\t\t\tcurrentKey = ffjtLuaFunctionIsVarArg\n\t\t\t\t\tstate = fflib.FFParse_want_colon\n\t\t\t\t\tgoto mainparse\n\t\t\t\t}\n\n\t\t\t\tcurrentKey = ffjtLuaFunctionnosuchkey\n\t\t\t\tstate = fflib.FFParse_want_colon\n\t\t\t\tgoto mainparse\n\t\t\t}\n\n\t\tcase fflib.FFParse_want_colon:\n\t\t\tif tok != fflib.FFTok_colon {\n\t\t\t\twantedTok = fflib.FFTok_colon\n\t\t\t\tgoto wrongtokenerror\n\t\t\t}\n\t\t\tstate = fflib.FFParse_want_value\n\t\t\tcontinue\n\t\tcase fflib.FFParse_want_value:\n\n\t\t\tif tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {\n\t\t\t\tswitch currentKey {\n\n\t\t\t\tcase ffjtLuaFunctionIsVarArg:\n\t\t\t\t\tgoto handle_IsVarArg\n\n\t\t\t\tcase ffjtLuaFunctionArgList:\n\t\t\t\t\tgoto handle_ArgList\n\n\t\t\t\tcase ffjtLuaFunctionnosuchkey:\n\t\t\t\t\terr = fs.SkipField(tok)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn fs.WrapErr(err)\n\t\t\t\t\t}\n\t\t\t\t\tstate = fflib.FFParse_after_value\n\t\t\t\t\tgoto mainparse\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tgoto wantedvalue\n\t\t\t}\n\t\t}\n\t}\n\nhandle_IsVarArg:\n\n\t/* handler: j.IsVarArg type=bool kind=bool quoted=false*/\n\n\t{\n\t\tif tok != fflib.FFTok_bool && tok != fflib.FFTok_null {\n\t\t\treturn fs.WrapErr(fmt.Errorf(\"cannot unmarshal %s into Go value for bool\", tok))\n\t\t}\n\t}\n\n\t{\n\t\tif tok == fflib.FFTok_null {\n\n\t\t} else {\n\t\t\ttmpb := fs.Output.Bytes()\n\n\t\t\tif bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {\n\n\t\t\t\tj.IsVarArg = true\n\n\t\t\t} else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {\n\n\t\t\t\tj.IsVarArg = false\n\n\t\t\t} else {\n\t\t\t\terr = errors.New(\"unexpected bytes for true/false value\")\n\t\t\t\treturn fs.WrapErr(err)\n\t\t\t}\n\n\t\t}\n\t}\n\n\tstate = fflib.FFParse_after_value\n\tgoto mainparse\n\nhandle_ArgList:\n\n\t/* handler: j.ArgList type=[]string kind=slice quoted=false*/\n\n\t{\n\n\t\t{\n\t\t\tif tok != fflib.FFTok_left_brace && tok != fflib.FFTok_null {\n\t\t\t\treturn fs.WrapErr(fmt.Errorf(\"cannot unmarshal %s into Go value for \", tok))\n\t\t\t}\n\t\t}\n\n\t\tif tok == fflib.FFTok_null {\n\t\t\tj.ArgList = nil\n\t\t} else {\n\n\t\t\tj.ArgList = []string{}\n\n\t\t\twantVal := true\n\n\t\t\tfor {\n\n\t\t\t\tvar tmpJArgList string\n\n\t\t\t\ttok = fs.Scan()\n\t\t\t\tif tok == fflib.FFTok_error {\n\t\t\t\t\tgoto tokerror\n\t\t\t\t}\n\t\t\t\tif tok == fflib.FFTok_right_brace {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tif tok == fflib.FFTok_comma {\n\t\t\t\t\tif wantVal == true {\n\t\t\t\t\t\t// TODO(pquerna): this isn't an ideal error message, this handles\n\t\t\t\t\t\t// things like [,,,] as an array value.\n\t\t\t\t\t\treturn fs.WrapErr(fmt.Errorf(\"wanted value token, but got token: %v\", tok))\n\t\t\t\t\t}\n\t\t\t\t\tcontinue\n\t\t\t\t} else {\n\t\t\t\t\twantVal = true\n\t\t\t\t}\n\n\t\t\t\t/* handler: tmpJArgList type=string kind=string quoted=false*/\n\n\t\t\t\t{\n\n\t\t\t\t\t{\n\t\t\t\t\t\tif tok != fflib.FFTok_string && tok != fflib.FFTok_null {\n\t\t\t\t\t\t\treturn fs.WrapErr(fmt.Errorf(\"cannot unmarshal %s into Go value for string\", tok))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif tok == fflib.FFTok_null {\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\toutBuf := fs.Output.Bytes()\n\n\t\t\t\t\t\ttmpJArgList = string(string(outBuf))\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tj.ArgList = append(j.ArgList, tmpJArgList)\n\n\t\t\t\twantVal = false\n\t\t\t}\n\t\t}\n\t}\n\n\tstate = fflib.FFParse_after_value\n\tgoto mainparse\n\nwantedvalue:\n\treturn fs.WrapErr(fmt.Errorf(\"wanted value token, but got token: %v\", tok))\nwrongtokenerror:\n\treturn fs.WrapErr(fmt.Errorf(\"ffjson: wanted token: %v, but got token: %v output=%s\", wantedTok, tok, fs.Output.String()))\ntokerror:\n\tif fs.BigError != nil {\n\t\treturn fs.WrapErr(fs.BigError)\n\t}\n\terr = fs.Error.ToError()\n\tif err != nil {\n\t\treturn fs.WrapErr(err)\n\t}\n\tpanic(\"ffjson-generated: unreachable, please report bug.\")\ndone:\n\n\treturn nil\n}", "func MakeFunctionReader() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\tlog.Info(\"read request\")\n\t\tfunctions, err := readServices()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error getting service list: %s\\n\", err.Error())\n\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\tfunctionBytes, _ := json.Marshal(functions)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write(functionBytes)\n\t}\n}", "func parsePlaceholder(s string, funcs map[string]interface{}) (p tePlaceholder, err error) {\n\tconst (\n\t\tdot = \".\"\n\t\tinvoke = \"()\"\n\t\tindexLeft = \"[\"\n\t\tindexRight = \"]\"\n\t)\n\n\tif s==\"\"{\n\t\treturn\n\t}\n\n\tstrs := strings.Split(s, pipe)\n\tskipFirst := false\n\tif len(strs[0])>0 && strs[0][0] == 'a' {\n\t\tif i, err := strconvh.ParseInt(strs[0][1:]); err == nil {\n\t\t\tp.argNum = i\n\t\t\tskipFirst = true\n\t\t}\n\t}\n\n\tif skipFirst {\n\t\tstrs = strs[1:]\n\t}\n\n\tfor _, str := range strs {\n\t\tif len(str) == 0 {\n\t\t\terr = errors.New(\"unable to parse empty placeholder in '\" + s + \"'\")\n\t\t\treturn\n\t\t}\n\t\tswitch {\n\t\tcase str == \"*\":\n\t\t\tp.funcs = append(p.funcs, dereferencer{})\n\t\tcase str == \"&\":\n\t\t\tp.funcs = append(p.funcs, addrGetter{})\n\t\tcase strings.HasPrefix(str, dot) && strings.HasSuffix(str, invoke): // Method\n\t\t\tname := str[len(dot) : len(str)-len(invoke)]\n\t\t\tif !IsValidExportedIdent(name) {\n\t\t\t\terr = errors.New(\"invalid method name: '\" + name + \"'\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tp.funcs = append(p.funcs, FuncMethod(name))\n\t\tcase strings.HasPrefix(str, dot): // Field\n\t\t\tname := str[len(dot):]\n\t\t\tif !IsValidExportedIdent(name) {\n\t\t\t\terr = errors.New(\"invalid field name: '\" + name + \"'\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tp.funcs = append(p.funcs, FuncGetter(name))\n\t\tcase strings.HasSuffix(str, invoke): // Function\n\t\t\tname := str[:len(str)-len(invoke)]\n\t\t\tf, ok := funcs[name]\n\t\t\tif !ok {\n\t\t\t\terr = errors.New(\"unknown function '\" + name + \"'\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tp.funcs = append(p.funcs, FuncSimple{f})\n\t\tcase strings.HasPrefix(str, indexLeft) && strings.HasSuffix(str, indexRight): // Access by index\n\t\t\tiStr := str[len(indexLeft) : len(str)-len(indexRight)]\n\t\t\tvar i int\n\t\t\ti, err = strconvh.ParseInt(iStr)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tp.funcs = append(p.funcs, Index(i))\n\t\tdefault:\n\t\t\terr = errors.New(\"unknown element in placeholder: '\" + str + \"'\")\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func (ac *Config) LuaFunctionMap(w http.ResponseWriter, req *http.Request, luadata []byte, filename string) (template.FuncMap, error) {\n\tac.pongomutex.Lock()\n\tdefer ac.pongomutex.Unlock()\n\n\t// Retrieve a Lua state\n\tL := ac.luapool.Get()\n\tdefer ac.luapool.Put(L)\n\n\t// Prepare an empty map of functions (and variables)\n\tfuncs := make(template.FuncMap)\n\n\t// Give no filename (an empty string will be handled correctly by the function).\n\tac.LoadCommonFunctions(w, req, filename, L, nil, nil)\n\n\t// Run the script\n\tif err := L.DoString(string(luadata)); err != nil {\n\t\t// Close the Lua state\n\t\tL.Close()\n\n\t\t// Logging and/or HTTP response is handled elsewhere\n\t\treturn funcs, err\n\t}\n\n\t// Extract the available functions from the Lua state\n\tglobalTable := L.G.Global\n\tglobalTable.ForEach(func(key, value lua.LValue) {\n\t\t// Check if the current value is a string variable\n\t\tif luaString, ok := value.(lua.LString); ok {\n\t\t\t// Store the variable in the same map as the functions (string -> interface)\n\t\t\t// for ease of use together with templates.\n\t\t\tfuncs[key.String()] = luaString.String()\n\t\t} else if luaTable, ok := value.(*lua.LTable); ok {\n\n\t\t\t// Convert the table to a map and save it.\n\t\t\t// Ignore values of a different type.\n\t\t\tmapinterface, _ := convert.Table2map(luaTable, false)\n\t\t\tswitch m := mapinterface.(type) {\n\t\t\tcase map[string]string:\n\t\t\t\tfuncs[key.String()] = map[string]string(m)\n\t\t\tcase map[string]int:\n\t\t\t\tfuncs[key.String()] = map[string]int(m)\n\t\t\tcase map[int]string:\n\t\t\t\tfuncs[key.String()] = map[int]string(m)\n\t\t\tcase map[int]int:\n\t\t\t\tfuncs[key.String()] = map[int]int(m)\n\t\t\t}\n\n\t\t\t// Check if the current value is a function\n\t\t} else if luaFunc, ok := value.(*lua.LFunction); ok {\n\t\t\t// Only export the functions defined in the given Lua code,\n\t\t\t// not all the global functions. IsG is true if the function is global.\n\t\t\tif !luaFunc.IsG {\n\n\t\t\t\tfunctionName := key.String()\n\n\t\t\t\t// Register the function, with a variable number of string arguments\n\t\t\t\t// Functions returning (string, error) are supported by html.template\n\t\t\t\tfuncs[functionName] = func(args ...string) (any, error) {\n\t\t\t\t\t// Create a brand new Lua state\n\t\t\t\t\tL2 := ac.luapool.New()\n\t\t\t\t\tdefer L2.Close()\n\n\t\t\t\t\t// Set up a new Lua state with the current http.ResponseWriter and *http.Request\n\t\t\t\t\tac.LoadCommonFunctions(w, req, filename, L2, nil, nil)\n\n\t\t\t\t\t// Push the Lua function to run\n\t\t\t\t\tL2.Push(luaFunc)\n\n\t\t\t\t\t// Push the given arguments\n\t\t\t\t\tfor _, arg := range args {\n\t\t\t\t\t\tL2.Push(lua.LString(arg))\n\t\t\t\t\t}\n\n\t\t\t\t\t// Run the Lua function\n\t\t\t\t\terr := L2.PCall(len(args), lua.MultRet, nil)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t// If calling the function did not work out, return the infostring and error\n\t\t\t\t\t\treturn utils.Infostring(functionName, args), err\n\t\t\t\t\t}\n\n\t\t\t\t\t// Empty return value if no values were returned\n\t\t\t\t\tvar retval any\n\n\t\t\t\t\t// Return the first of the returned arguments, as a string\n\t\t\t\t\tif L2.GetTop() >= 1 {\n\t\t\t\t\t\tlv := L2.Get(-1)\n\t\t\t\t\t\ttbl, isTable := lv.(*lua.LTable)\n\t\t\t\t\t\tswitch {\n\t\t\t\t\t\tcase isTable:\n\t\t\t\t\t\t\t// lv was a Lua Table\n\t\t\t\t\t\t\tretval = gluamapper.ToGoValue(tbl, gluamapper.Option{\n\t\t\t\t\t\t\t\tNameFunc: func(s string) string {\n\t\t\t\t\t\t\t\t\treturn s\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\tif ac.debugMode && ac.verboseMode {\n\t\t\t\t\t\t\t\tlog.Info(utils.Infostring(functionName, args) + \" -> (map)\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tcase lv.Type() == lua.LTString:\n\t\t\t\t\t\t\t// lv is a Lua String\n\t\t\t\t\t\t\tretstr := L2.ToString(1)\n\t\t\t\t\t\t\tretval = retstr\n\t\t\t\t\t\t\tif ac.debugMode && ac.verboseMode {\n\t\t\t\t\t\t\t\tlog.Info(utils.Infostring(functionName, args) + \" -> \\\"\" + retstr + \"\\\"\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tretval = \"\"\n\t\t\t\t\t\t\tlog.Warn(\"The return type of \" + utils.Infostring(functionName, args) + \" can't be converted\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// No return value, return an empty string and nil\n\t\t\t\t\treturn retval, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\n\t// Return the map of functions\n\treturn funcs, nil\n}", "func FilterFuncs() (filters []func(string) string) {\n\tfilters = append(filters, FilterParenthesis())\n\tfilters = append(filters, FilterHyphens())\n\treturn filters\n}", "func (g *Generator) AddFuncs(fm map[string]interface{}) {\n\tfor name, f := range fm {\n\t\tg.funcs[name] = f\n\t}\n}", "func (p *Parser) ParseProgram() *ast.Program {\n\tprogram := &ast.Program{}\n\tprogram.Functions = []*ast.Function{}\n\n\tfor p.curTokenIs(token.FN) {\n\t\tfn := p.parseFunction()\n\t\tprogram.Functions = append(program.Functions, fn)\n\t\tp.nextToken()\n\t}\n\n\treturn program\n}", "func loadFunction(path string) (function, error) {\n\tpl, err := plugin.Open(path)\n\tif err != nil {\n\t\treturn function{}, fmt.Errorf(\"Cannot open %s plugin: %v\", path, err)\n\t}\n\trouteRaw, err := pl.Lookup(\"Route\")\n\tif err != nil {\n\t\treturn function{}, fmt.Errorf(\"Cannot lookup Route: %v\", err)\n\t}\n\troute := *routeRaw.(*string)\n\n\thandlerRaw, err := pl.Lookup(\"Handle\")\n\tif err != nil {\n\t\treturn function{}, fmt.Errorf(\"Cannot lookup handler: %v\", err)\n\t}\n\thandler := handlerRaw.(functionHandler)\n\n\treturn function{\n\t\troute: route,\n\t\thandler: handler,\n\t}, nil\n}", "func (info *fileInfo) addFuncDecls() {\n\t// TODO: replace all uses of importCPos with the real locations from\n\t// libclang.\n\tnames := make([]string, 0, len(info.functions))\n\tfor name := range info.functions {\n\t\tnames = append(names, name)\n\t}\n\tsort.Strings(names)\n\tfor _, name := range names {\n\t\tfn := info.functions[name]\n\t\tobj := &ast.Object{\n\t\t\tKind: ast.Fun,\n\t\t\tName: \"C.\" + name,\n\t\t}\n\t\targs := make([]*ast.Field, len(fn.args))\n\t\tdecl := &ast.FuncDecl{\n\t\t\tName: &ast.Ident{\n\t\t\t\tNamePos: info.importCPos,\n\t\t\t\tName: \"C.\" + name,\n\t\t\t\tObj: obj,\n\t\t\t},\n\t\t\tType: &ast.FuncType{\n\t\t\t\tFunc: info.importCPos,\n\t\t\t\tParams: &ast.FieldList{\n\t\t\t\t\tOpening: info.importCPos,\n\t\t\t\t\tList: args,\n\t\t\t\t\tClosing: info.importCPos,\n\t\t\t\t},\n\t\t\t\tResults: fn.results,\n\t\t\t},\n\t\t}\n\t\tobj.Decl = decl\n\t\tfor i, arg := range fn.args {\n\t\t\targs[i] = &ast.Field{\n\t\t\t\tNames: []*ast.Ident{\n\t\t\t\t\t&ast.Ident{\n\t\t\t\t\t\tNamePos: info.importCPos,\n\t\t\t\t\t\tName: arg.name,\n\t\t\t\t\t\tObj: &ast.Object{\n\t\t\t\t\t\t\tKind: ast.Var,\n\t\t\t\t\t\t\tName: arg.name,\n\t\t\t\t\t\t\tDecl: decl,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tType: arg.typeExpr,\n\t\t\t}\n\t\t}\n\t\tinfo.Decls = append(info.Decls, decl)\n\t}\n}", "func EvaluateFuncs(exp string) string {\n exp = EvaluateFunc(exp, \"abs\")\n exp = EvaluateFunc(exp, \"sin\")\n exp = EvaluateFunc(exp, \"cos\")\n exp = EvaluateFunc(exp, \"tan\")\n return exp\n}", "func (sc *SmartContract) handleFunctions(stub shim.ChaincodeStubInterface) pb.Response {\n\t_SC_LOGGER.Info(\"InsidehandleFunctions\")\n\tfunction, _ := stub.GetFunctionAndParameters()\n\tif function == \"probe\" {\n\t\treturn sc.probe(stub)\n\t}\n\treturn shim.Error(\"Invalid function provided\")\n}", "func makeStateFn(expr []string) (stateFn, error) {\n\t// End of the recursive call, we return nil.\n\tif expr == nil || len(expr) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tformatStr := expr[0]\n\n\t// Expressions can be quoted, so we keep a track of it and trim the quotes.\n\tvar quoted bool\n\tif strings.HasPrefix(formatStr, \"\\\"\") {\n\t\tquoted = true\n\t\tformatStr = strings.Trim(formatStr, \"\\\"\")\n\t}\n\n\t// Recursive call to determine the next state function.\n\t// XXX(gilliek): errors are reported right to left\n\tnext, err := makeStateFn(expr[1:])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch f := LookupFormat(formatStr); f {\n\tcase REMOTE_HOST:\n\t\treturn parseRemoteHost(quoted, next), nil\n\tcase REMOTE_LOGNAME:\n\t\treturn parseRemoteLogname(quoted, next), nil\n\tcase REMOTE_USER:\n\t\treturn parseRemoteUser(quoted, next), nil\n\tcase TIME:\n\t\treturn parseTime(quoted, next), nil\n\tcase REQUEST_FIRST_LINE:\n\t\treturn parseRequestFirstLine(quoted, next), nil\n\tcase STATUS:\n\t\treturn parseStatus(quoted, next), nil\n\tcase RESPONSE_SIZE:\n\t\treturn parseResponseSize(quoted, next), nil\n\tcase RESPONSE_SIZE_CLF:\n\t\treturn parseResponseSizeCLF(quoted, next), nil\n\tcase ELAPSED_TIME_IN_SEC:\n\t\treturn parseElapsedTimeInSec(quoted, next), nil\n\tcase HEADER:\n\t\thdr := strings.TrimSuffix(strings.TrimPrefix(formatStr, \"%{\"), \"}i\")\n\t\treturn parseHeader(quoted, hdr, next), nil\n\tcase UNKNOWN:\n\t\tfallthrough\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"%q format is not supported\", formatStr)\n\t}\n}", "func (p Parser[T]) Parse(s string) ([]check.ValCk[T], error) {\n\texprs, err := getElts(s, p.checkerName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tckFuncs := make([]check.ValCk[T], 0, len(exprs))\n\tfor _, e := range exprs {\n\t\tf, err := p.ParseExpr(e)\n\t\tif err != nil {\n\t\t\treturn nil,\n\t\t\t\tfmt.Errorf(\"Can't make %s function: %s\",\n\t\t\t\t\tp.checkerName, err)\n\t\t}\n\t\tckFuncs = append(ckFuncs, f)\n\t}\n\n\treturn ckFuncs, nil\n}", "func (r *ListFunctionsRequest) FromJsonString(s string) error {\n\tf := make(map[string]interface{})\n\tif err := json.Unmarshal([]byte(s), &f); err != nil {\n\t\treturn err\n\t}\n\tdelete(f, \"Order\")\n\tdelete(f, \"Orderby\")\n\tdelete(f, \"Offset\")\n\tdelete(f, \"Limit\")\n\tdelete(f, \"SearchKey\")\n\tdelete(f, \"Namespace\")\n\tdelete(f, \"Description\")\n\tdelete(f, \"Filters\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ListFunctionsRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "func (t *LineTable) go12Funcs() []Func {\n\t// Assume it is malformed and return nil on error.\n\tif !disableRecover {\n\t\tdefer func() {\n\t\t\trecover()\n\t\t}()\n\t}\n\n\tft := t.funcTab()\n\tfuncs := make([]Func, ft.Count())\n\tsyms := make([]Sym, len(funcs))\n\tfor i := range funcs {\n\t\tf := &funcs[i]\n\t\tf.Entry = ft.pc(i)\n\t\tf.End = ft.pc(i + 1)\n\t\tinfo := t.funcData(uint32(i))\n\t\tf.LineTable = t\n\t\tf.FrameSize = int(info.deferreturn())\n\t\tsyms[i] = Sym{\n\t\t\tValue: f.Entry,\n\t\t\tType: 'T',\n\t\t\tName: t.funcName(info.nameoff()),\n\t\t\tGoType: 0,\n\t\t\tFunc: f,\n\t\t}\n\t\tf.Sym = &syms[i]\n\t}\n\treturn funcs\n}", "func SymbolResolve(symbols string) (fmap []gtutils.SymbolFuncInfo) {\n\tfmap = make([]gtutils.SymbolFuncInfo, 0)\n\tlines := bufio.NewScanner(strings.NewReader(symbols))\n\tfor lines.Scan() {\n\t\tfields := strings.Split(lines.Text(), \"|\")\n\t\tfor i := range fields {\n\t\t\tfields[i] = strings.TrimSpace(fields[i])\n\t\t}\n\t\tif len(fields) != 7 {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.ToLower(fields[3]) != \"func\" {\n\t\t\tcontinue\n\t\t}\n\t\toff64, _ := strconv.ParseUint(fields[1], 16, 64)\n\t\toff := int(off64)\n\t\tsize64, _ := strconv.ParseUint(fields[4], 16, 64)\n\t\tsize := int(size64)\n\t\tfName := fields[0]\n\t\tsecTab := strings.Index(fields[6], \"\\t\")\n\t\tif secTab < 0 {\n\t\t\tfmap = append(fmap, gtutils.SymbolFuncInfo{\n\t\t\t\tFunction: fName,\n\t\t\t\tHaveSource: false,\n\t\t\t\tSource: \"\",\n\t\t\t\tOffset: int(off),\n\t\t\t\tSize: size,\n\t\t\t\tLine: 0,\n\t\t\t\tSection: fields[6]})\n\t\t} else {\n\t\t\tsecTabSeqLast := secTab\n\t\t\tfor ; fields[6][secTabSeqLast] == '\\t'; secTabSeqLast++ {\n\t\t\t}\n\t\t\tsecName := fields[6][:secTab]\n\t\t\tsrcFile := fields[6][secTabSeqLast:]\n\t\t\tfSrc, line := findSrcFile(srcFile)\n\t\t\tfmap = append(fmap, gtutils.SymbolFuncInfo{\n\t\t\t\tFunction: fName,\n\t\t\t\tHaveSource: true,\n\t\t\t\tSource: fSrc,\n\t\t\t\tOffset: int(off),\n\t\t\t\tSize: size,\n\t\t\t\tLine: line,\n\t\t\t\tSection: secName})\n\t\t}\n\t}\n\treturn\n}", "func validateFunction(fn *types.Function) (errs []error) {\n\tif !template.IsContextFirst(fn.Args) {\n\t\terrs = append(errs, fmt.Errorf(\"%s: first argument should be of type context.Context\", fn.Name))\n\t}\n\tif !template.IsErrorLast(fn.Results) {\n\t\terrs = append(errs, fmt.Errorf(\"%s: last result should be of type error\", fn.Name))\n\t}\n\tfor _, param := range fn.Args {\n\t\tif param.Name == \"\" {\n\t\t\terrs = append(errs, fmt.Errorf(\"%s: unnamed argument of type %s\", fn.Name, param.Type.String()))\n\t\t}\n\t}\n\tfor _, param := range fn.Results {\n\t\tif param.Name == \"\" {\n\t\t\terrs = append(errs, fmt.Errorf(\"%s: unnamed result of type %s\", fn.Name, param.Type.String()))\n\t\t}\n\t}\n\treturn\n}", "func NewFuncs(ctx context.Context, enums []xo.Enum) *Funcs {\n\tdriver, _, _ := xo.DriverSchemaNthParam(ctx)\n\tenumMap := make(map[string]xo.Enum)\n\tif driver == \"mysql\" {\n\t\tfor _, e := range enums {\n\t\t\tenumMap[e.Name] = e\n\t\t}\n\t}\n\treturn &Funcs{\n\t\tdriver: driver,\n\t\tenumMap: enumMap,\n\t\tconstraint: Constraint(ctx),\n\t\tescCols: Esc(ctx, \"columns\"),\n\t\tescTypes: Esc(ctx, \"types\"),\n\t\tengine: Engine(ctx),\n\t}\n}", "func ParseTables(d *drawing.Drawing, line int, data [][2]string) error {\n\tparsers := []func(*drawing.Drawing, [][2]string) (table.SymbolTable, error){\n\t\tParseViewport,\n\t\tParseLtype,\n\t\tParseLayer,\n\t\tParseStyle,\n\t\tParseView,\n\t\tParseUCS,\n\t\tParseAppID,\n\t\tParseDimStyle,\n\t\tParseBlockRecord,\n\t}\n\ttmpdata := make([][2]string, 0)\n\tsetparser := false\n\tvar parser func(*drawing.Drawing, [][2]string) (table.SymbolTable, error)\n\tvar ind int\n\tfor i, dt := range data {\n\t\tif setparser {\n\t\t\tif dt[0] != \"2\" {\n\t\t\t\treturn fmt.Errorf(\"line %d: invalid group code: %s\", line+2*i, dt[0])\n\t\t\t}\n\t\t\tind = int(table.TableTypeValue(strings.ToUpper(dt[1])))\n\t\t\tif ind < 0 {\n\t\t\t\treturn fmt.Errorf(\"line %d: unknown table type: %s\", line+2*i, dt[1])\n\t\t\t}\n\t\t\tparser = parsers[ind]\n\t\t\tsetparser = false\n\t\t} else {\n\t\t\tif dt[0] == \"0\" {\n\t\t\t\tswitch strings.ToUpper(dt[1]) {\n\t\t\t\tcase \"TABLE\":\n\t\t\t\t\tsetparser = true\n\t\t\t\tcase \"ENDTAB\":\n\t\t\t\t\tif len(tmpdata) > 0 {\n\t\t\t\t\t\terr := ParseTable(d, tmpdata, ind, parser)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttmpdata = make([][2]string, 0)\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\ttmpdata = append(tmpdata, dt)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttmpdata = append(tmpdata, dt)\n\t\t\t}\n\t\t}\n\t}\n\tif len(tmpdata) > 0 {\n\t\terr := ParseTable(d, tmpdata, ind, parser)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"line %d: %s\", line+2*len(data), err.Error())\n\t\t}\n\t\ttmpdata = make([][2]string, 0)\n\t}\n\treturn nil\n}", "func (r *RuleSet) matchingFuncs(c context.Context, configSet, path string) ([]Func, error) {\n\tr.l.RLock()\n\tdefer r.l.RUnlock()\n\n\tvar out []Func\n\tvar errs errors.MultiError\n\n\tfor _, rule := range r.r {\n\t\tswitch pat, err := r.renderedConfigPattern(c, rule); {\n\t\tcase err != nil:\n\t\t\terrs = append(errs, err...)\n\t\tcase pat.ConfigSet.Match(configSet) && pat.Path.Match(path):\n\t\t\tout = append(out, rule.cb)\n\t\t}\n\t}\n\n\tif len(errs) != 0 {\n\t\treturn nil, errs\n\t}\n\treturn out, nil\n}", "func GetPublicFunctions(pkg, filePath string) ([]*types.Type, error) {\n\tbuilder := go2idlparser.New()\n\tdata, err := ioutil.ReadFile(filePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := builder.AddFile(pkg, filePath, data); err != nil {\n\t\treturn nil, err\n\t}\n\tuniverse, err := builder.FindTypes()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar functions []*types.Type\n\n\t// Create the AST by parsing src.\n\tfset := token.NewFileSet() // positions are relative to fset\n\tf, err := parser.ParseFile(fset, filePath, nil, 0)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed parse file to list functions: %v\", err)\n\t}\n\n\t// Inspect the AST and print all identifiers and literals.\n\tast.Inspect(f, func(n ast.Node) bool {\n\t\tvar s string\n\t\tswitch x := n.(type) {\n\t\tcase *ast.FuncDecl:\n\t\t\ts = x.Name.Name\n\t\t\t// It's a function (not method), and is public, record it.\n\t\t\tif x.Recv == nil && isPublic(s) {\n\t\t\t\tfunctions = append(functions, universe[pkg].Function(x.Name.Name))\n\t\t\t}\n\t\t}\n\t\treturn true\n\t})\n\n\treturn functions, nil\n}", "func Parse(terms []string, l Lexicon) (parsed []Definition, err error) {\n\treturn nil, nil\n}", "func (e *Evaluator) processFunction(tkn token) error {\n\tfunction, ok := e.functions[tkn.Value]\n\n\tif !ok {\n\t\treturn fmt.Errorf(\"Evaluator: unsupported function %v\", tkn.Value)\n\t}\n\treturn function.Invoke(&e.stack)\n}", "func (p *Parser) parseFuncType(method bool) *expr.FuncLiteral {\n\tf := &expr.FuncLiteral{\n\t\tType: &tipe.Func{},\n\t}\n\n\tif method {\n\t\t// func (a) f()\n\t\tp.expect(token.LeftParen)\n\t\tp.next()\n\t\tif p.s.Token == token.Mul {\n\t\t\tf.PointerReceiver = true\n\t\t\tp.next()\n\t\t}\n\t\tf.ReceiverName = p.parseIdent().Name\n\t\tp.expect(token.RightParen)\n\t\tp.next()\n\t}\n\n\tif p.s.Token == token.Ident {\n\t\tf.Name = p.parseIdent().Name\n\t} else if method {\n\t\tp.errorf(\"class method missing name\")\n\t}\n\n\tp.expect(token.LeftParen)\n\tp.next()\n\tif p.s.Token != token.RightParen {\n\t\tf.ParamNames, f.Type.Params = p.parseParamTuple()\n\t\tif params := f.Type.Params; len(params.Elems) > 0 {\n\t\t\tlast := params.Elems[len(params.Elems)-1]\n\t\t\tif _, variadic := last.(*tipe.Ellipsis); variadic {\n\t\t\t\tf.Type.Variadic = true\n\t\t\t}\n\t\t}\n\t} else {\n\t\tf.Type.Params = new(tipe.Tuple)\n\t}\n\tp.expect(token.RightParen)\n\tp.next()\n\n\tif p.s.Token == token.LeftParen {\n\t\tp.expect(token.LeftParen)\n\t\tp.next()\n\t\tif p.s.Token != token.RightParen {\n\t\t\tf.ResultNames, f.Type.Results = p.parseParamTuple()\n\t\t}\n\t\tp.expect(token.RightParen)\n\t\tp.next()\n\t} else {\n\t\ttyp := p.maybeParseType()\n\t\tif typ != nil {\n\t\t\tf.ResultNames = []string{\"\"}\n\t\t\tf.Type.Results = &tipe.Tuple{Elems: []tipe.Type{typ}}\n\t\t}\n\t}\n\treturn f\n}", "func expFunctions(baseDir string) map[string]function.Function {\n\treturn map[string]function.Function{\n\t\t\"abs\": stdlib.AbsoluteFunc,\n\t\t\"abspath\": funcs.AbsPathFunc,\n\t\t\"basename\": funcs.BasenameFunc,\n\t\t\"base64decode\": funcs.Base64DecodeFunc,\n\t\t\"base64encode\": funcs.Base64EncodeFunc,\n\t\t\"base64gzip\": funcs.Base64GzipFunc,\n\t\t\"base64sha256\": funcs.Base64Sha256Func,\n\t\t\"base64sha512\": funcs.Base64Sha512Func,\n\t\t\"bcrypt\": funcs.BcryptFunc,\n\t\t\"can\": tryfunc.CanFunc,\n\t\t\"ceil\": stdlib.CeilFunc,\n\t\t\"chomp\": stdlib.ChompFunc,\n\t\t\"cidrhost\": funcs.CidrHostFunc,\n\t\t\"cidrnetmask\": funcs.CidrNetmaskFunc,\n\t\t\"cidrsubnet\": funcs.CidrSubnetFunc,\n\t\t\"cidrsubnets\": funcs.CidrSubnetsFunc,\n\t\t\"coalesce\": funcs.CoalesceFunc,\n\t\t\"coalescelist\": stdlib.CoalesceListFunc,\n\t\t\"compact\": stdlib.CompactFunc,\n\t\t\"concat\": stdlib.ConcatFunc,\n\t\t\"contains\": stdlib.ContainsFunc,\n\t\t\"csvdecode\": stdlib.CSVDecodeFunc,\n\t\t\"dirname\": funcs.DirnameFunc,\n\t\t\"distinct\": stdlib.DistinctFunc,\n\t\t\"element\": stdlib.ElementFunc,\n\t\t\"chunklist\": stdlib.ChunklistFunc,\n\t\t\"file\": funcs.MakeFileFunc(baseDir, false),\n\t\t\"fileexists\": funcs.MakeFileExistsFunc(baseDir),\n\t\t\"fileset\": funcs.MakeFileSetFunc(baseDir),\n\t\t\"filebase64\": funcs.MakeFileFunc(baseDir, true),\n\t\t\"filebase64sha256\": funcs.MakeFileBase64Sha256Func(baseDir),\n\t\t\"filebase64sha512\": funcs.MakeFileBase64Sha512Func(baseDir),\n\t\t\"filemd5\": funcs.MakeFileMd5Func(baseDir),\n\t\t\"filesha1\": funcs.MakeFileSha1Func(baseDir),\n\t\t\"filesha256\": funcs.MakeFileSha256Func(baseDir),\n\t\t\"filesha512\": funcs.MakeFileSha512Func(baseDir),\n\t\t\"flatten\": stdlib.FlattenFunc,\n\t\t\"floor\": stdlib.FloorFunc,\n\t\t\"format\": stdlib.FormatFunc,\n\t\t\"formatdate\": stdlib.FormatDateFunc,\n\t\t\"formatlist\": stdlib.FormatListFunc,\n\t\t\"indent\": stdlib.IndentFunc,\n\t\t\"index\": funcs.IndexFunc, // stdlib.IndexFunc is not compatible\n\t\t\"join\": stdlib.JoinFunc,\n\t\t\"jsondecode\": stdlib.JSONDecodeFunc,\n\t\t\"jsonencode\": stdlib.JSONEncodeFunc,\n\t\t\"keys\": stdlib.KeysFunc,\n\t\t\"length\": funcs.LengthFunc,\n\t\t\"list\": funcs.ListFunc,\n\t\t\"log\": stdlib.LogFunc,\n\t\t\"lookup\": funcs.LookupFunc,\n\t\t\"lower\": stdlib.LowerFunc,\n\t\t\"map\": funcs.MapFunc,\n\t\t\"matchkeys\": funcs.MatchkeysFunc,\n\t\t\"max\": stdlib.MaxFunc,\n\t\t\"md5\": funcs.Md5Func,\n\t\t\"merge\": stdlib.MergeFunc,\n\t\t\"min\": stdlib.MinFunc,\n\t\t\"parseint\": stdlib.ParseIntFunc,\n\t\t\"pathexpand\": funcs.PathExpandFunc,\n\t\t\"pow\": stdlib.PowFunc,\n\t\t\"range\": stdlib.RangeFunc,\n\t\t\"regex\": stdlib.RegexFunc,\n\t\t\"regexall\": stdlib.RegexAllFunc,\n\t\t\"replace\": funcs.ReplaceFunc,\n\t\t\"reverse\": stdlib.ReverseListFunc,\n\t\t\"rsadecrypt\": funcs.RsaDecryptFunc,\n\t\t\"setintersection\": stdlib.SetIntersectionFunc,\n\t\t\"setproduct\": stdlib.SetProductFunc,\n\t\t\"setsubtract\": stdlib.SetSubtractFunc,\n\t\t\"setunion\": stdlib.SetUnionFunc,\n\t\t\"sha1\": funcs.Sha1Func,\n\t\t\"sha256\": funcs.Sha256Func,\n\t\t\"sha512\": funcs.Sha512Func,\n\t\t\"signum\": stdlib.SignumFunc,\n\t\t\"slice\": stdlib.SliceFunc,\n\t\t\"sort\": stdlib.SortFunc,\n\t\t\"split\": stdlib.SplitFunc,\n\t\t\"strrev\": stdlib.ReverseFunc,\n\t\t\"substr\": stdlib.SubstrFunc,\n\t\t\"timestamp\": funcs.TimestampFunc,\n\t\t\"timeadd\": stdlib.TimeAddFunc,\n\t\t\"title\": stdlib.TitleFunc,\n\t\t\"tostring\": funcs.MakeToFunc(cty.String),\n\t\t\"tonumber\": funcs.MakeToFunc(cty.Number),\n\t\t\"tobool\": funcs.MakeToFunc(cty.Bool),\n\t\t\"toset\": funcs.MakeToFunc(cty.Set(cty.DynamicPseudoType)),\n\t\t\"tolist\": funcs.MakeToFunc(cty.List(cty.DynamicPseudoType)),\n\t\t\"tomap\": funcs.MakeToFunc(cty.Map(cty.DynamicPseudoType)),\n\t\t\"transpose\": funcs.TransposeFunc,\n\t\t\"trim\": stdlib.TrimFunc,\n\t\t\"trimprefix\": stdlib.TrimPrefixFunc,\n\t\t\"trimspace\": stdlib.TrimSpaceFunc,\n\t\t\"trimsuffix\": stdlib.TrimSuffixFunc,\n\t\t\"try\": tryfunc.TryFunc,\n\t\t\"upper\": stdlib.UpperFunc,\n\t\t\"urlencode\": funcs.URLEncodeFunc,\n\t\t\"uuid\": funcs.UUIDFunc,\n\t\t\"uuidv5\": funcs.UUIDV5Func,\n\t\t\"values\": stdlib.ValuesFunc,\n\t\t\"yamldecode\": yaml.YAMLDecodeFunc,\n\t\t\"yamlencode\": yaml.YAMLEncodeFunc,\n\t\t\"zipmap\": stdlib.ZipmapFunc,\n\t}\n\n}", "func parseFuncPath(path string) (pkgPath, fnName string) {\n\tif len(path) < 1 {\n\t\treturn \"\", \"\"\n\t}\n\tswitch path[0] {\n\tcase '(':\n\t\tregex := regexp.MustCompile(`\\((?P<pkg>[^)]+)\\).(?P<fn>.+)`)\n\t\tsubmatches := regex.FindStringSubmatch(path)\n\t\tif len(submatches) >= 3 {\n\t\t\treturn submatches[1], submatches[2]\n\t\t}\n\tcase '\"':\n\t\tregex := regexp.MustCompile(`\"(?P<pkg>[^)]+)\".(?P<fn>.+)`)\n\t\tsubmatches := regex.FindStringSubmatch(path)\n\t\tif len(submatches) >= 3 {\n\t\t\treturn submatches[1], submatches[2]\n\t\t}\n\tdefault:\n\t\tparts := strings.Split(path, \".\")\n\t\tif len(parts) >= 2 {\n\t\t\treturn parts[0], parts[1]\n\t\t}\n\t}\n\treturn \"\", path\n}", "func Parse(f *os.File) (Source, error) {\n\tvar s scanner.Scanner\n\tvar src Source\n\ts.Init(f)\n\tfor tok := s.Scan(); tok != scanner.EOF; tok = s.Scan() {\n\t\tswitch s.TokenText() {\n\t\tcase \"!\": // macros have completely unpredictable structure, so we need\n\t\t\t// to zip past them for sanity.\n\t\t\tcollapseMacro(&s)\n\t\tcase \"#\": // attribute\n\t\t\tattName := \"#\"\n\t\t\tfor {\n\t\t\t\tc := s.Next()\n\t\t\t\tattName += string(c)\n\t\t\t\tif c == ']' {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tswitch attName {\n\t\t\tcase \"#[cfg(test)]\":\n\t\t\t\tsrc.TestBlock = s.Pos().Line\n\t\t\tcase \"#[test]\":\n\t\t\t\tt := capTest(&s)\n\t\t\t\tsrc.Tests = append(src.Tests, t)\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Detect trait and impl first because they can encapsulate other blocks\n\t\tcase \"trait\":\n\t\t\tsrc.Traits = append(src.Traits, capTrait(&s))\n\t\tcase \"impl\":\n\t\t\tcapImpl(&src, &s)\n\t\tcase \"enum\":\n\t\t\tsrc.Enums = append(src.Enums, capEnum(&s))\n\t\tcase \"struct\":\n\t\t\tsrc.RsStructs = append(src.RsStructs, capStruct(&s))\n\t\tcase \"fn\":\n\t\t\tfn, ubs := capFn(&s)\n\t\t\tsrc.Funcs = append(src.Funcs, fn)\n\t\t\tif len(ubs) > 0 {\n\t\t\t\tsrc.UB = append(src.UB, ubs...)\n\t\t\t}\n\t\tcase \"unsafe\":\n\t\t\tsrc.UB = append(src.UB, capUB(&s))\n\t\tdefault:\n\t\t\tcontinue\n\t\t}\n\t}\n\treturn src, nil\n}", "func parse(src string) (interface{}, error) {\n\ttokens := tokenize(src)\n\tast, remainder, err := readFromTokens(tokens)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(remainder) > 0 {\n\t\treturn nil, errors.New(\"unexpected trailing tokens\")\n\t}\n\treturn ast, nil\n}", "func funcFromFunc() {\n\taddExp := mathExpression()\n\tprintln(addExp(10.0, 20.0))\n}", "func (p *parser) lfunction() Node {\n\tident := p.expect(TokenIdent)\n\tp.expect(TokenLParen)\n\targs := p.lparameters()\n\tp.expect(TokenRParen)\n\n\tn := newFunc(ident.pos, ident.val, args)\n\treturn n\n}", "func parse2VarFun(vf *VarFunElem) (err error) {\n\t// Parsujemy sciezke do zmiennej/funkcji\n\tfor vf != nil {\n\t\tswitch pe := vf.name.(type) {\n\t\tcase nil:\n\t\t\t// Samowywolanie - nic nie robimy.\n\t\tcase reflect.Value:\n\t\t\tvk := pe.Kind()\n\t\t\tif vk == reflect.String || vk == reflect.Int ||\n\t\t\t\tvk == reflect.Int8 || vk == reflect.Int16 ||\n\t\t\t\tvk == reflect.Int32 || vk == reflect.Int64 ||\n\t\t\t\tvk == reflect.Float32 || vk == reflect.Float64 {\n\t\t\t\t// Nazwa, indeks liczbowy - nic nie robimy.\n\t\t\t} else {\n\t\t\t\tpanic(fmt.Sprintf(\"tmpl:parse2, line %d: Unknown type (%s) \"+\n\t\t\t\t\t\"of index in var/fun path! \", vf.ln, vk))\n\t\t\t}\n\n\t\tcase []Element:\n\t\t\t// Indeks tekstowy po sparsowaniu.\n\t\t\tvf.name, err = parse2(&pe, MAIN_BLK)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\tcase *VarFunElem:\n\t\t\t// Indeks bedacy wynikiem funkcji\n\t\t\terr = parse2VarFun(pe)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tvf.name = pe\n\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\n\t\t\t\t\"tmpl:parse2, line %d: Unknown type (%T) in var/fun path!\",\n\t\t\t\tvf.ln, pe))\n\t\t}\n\n\t\t// Parsujemy argumenty funkcji\n\t\tfor ii := range vf.args {\n\t\t\terr = parse2Param(&vf.args[ii], vf.ln)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tvf = vf.next\n\t}\n\treturn\n}", "func (p *Parser) parseFunctionDefinition() asti.ExpressionI {\n\tp.nextToken()\n\tlit := &ast.FunctionDefineLiteral{Token: p.curToken}\n\tif !p.expectPeek(tokentype.LPAREN) {\n\t\treturn nil\n\t}\n\tlit.Defaults, lit.Parameters = p.parseFunctionParameters()\n\tif !p.expectPeek(tokentype.LBRACE) {\n\t\treturn nil\n\t}\n\tlit.Body = p.parseBlockStatement()\n\treturn lit\n}", "func Parse(r io.Reader) (*List, error) {\n\teventList := List{}\n\traw, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn &eventList, err\n\t}\n\terr = json.Unmarshal(raw, &eventList)\n\tif err != nil {\n\t\treturn &eventList, err\n\t}\n\treturn &eventList, nil\n}", "func (resource *ResourceType) Functions() []Function {\n\tfunctions := maps.Values(resource.functions)\n\n\tsort.Slice(functions, func(i int, j int) bool {\n\t\treturn functions[i].Name() < functions[j].Name()\n\t})\n\n\treturn functions\n}", "func IsFunction(s string) bool {\n\ts = strings.Replace(s, \"(*)\", \"\", -1)\n\treturn strings.Contains(s, \"(\")\n}", "func parseFields(s string) (fs []Widget) {\n\tfor _, p := range pairs(s) {\n\t\tfs = append(fs, Widget{Field: Field{Label: p[0], Content: p[1]}})\n\t}\n\treturn\n}", "func NewCmdFunctions(out io.Writer, config *serverConfig) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"functions\",\n\t\tShort: i18n.T(\"Run Dispatch Functions Manager\"),\n\t\tArgs: cobra.NoArgs,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\trunFunctions(config)\n\t\t},\n\t}\n\tcmd.SetOutput(out)\n\treturn cmd\n}", "func parse(input []byte, vars []Variable) (node Node, err error) {\n\t// Tokenize\n\ttokens, err := scanInput(input)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Convert to AST\n\tnodes, endPos, err := parseExpression(tokens, vars, 0)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif len(nodes) > 1 {\n\t\terr = fmt.Errorf(\"couldn't flatten down to one node:\\n%+v\", nodes)\n\t\treturn\n\t}\n\n\tif endPos < len(tokens)-1 {\n\t\terr = fmt.Errorf(\"Parsing tokens ended at %d, but expected %d\", endPos, len(tokens)-1)\n\t\treturn\n\t}\n\n\tnode = nodes[0]\n\n\treturn\n}", "func Parse(r io.Reader) (*ClassFile, error) {\n\tc := &ClassFile{}\n\n\tvar err error\n\n\tfor _, f := range initFuncs {\n\t\terr = f(c, r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn c, nil\n}", "func NewFunction(config *truce.HTTP, function truce.Function) (*Function, error) {\n\tif function.Transports.HTTP == nil {\n\t\treturn nil, nil\n\t}\n\n\ttransport := *function.Transports.HTTP\n\n\tb := &Function{\n\t\tDefinition: function,\n\t\tQuery: map[string]QueryParam{},\n\t}\n\n\ttype argument struct {\n\t\tvariable string\n\t\tposVariable string\n\t\ttyp string\n\t}\n\n\tvar (\n\t\tpathMappings = map[string]string{}\n\t\targs = map[string]argument{}\n\t)\n\n\tfor i, field := range function.Arguments {\n\t\targs[field.Name] = argument{\n\t\t\ttyp: string(field.Type),\n\t\t\tposVariable: fmt.Sprintf(\"v%d\", i),\n\t\t\tvariable: field.Name,\n\t\t}\n\t}\n\n\tif function.Return.Present && function.Return.Name != \"\" {\n\t\tb.HasReturn = true\n\t\tb.ReturnType = string(function.Return.Type)\n\n\t\tif len(b.ReturnType) < 1 {\n\t\t\treturn nil, errors.New(\"return type cannot be empty\")\n\t\t}\n\n\t\tif b.ReturnType[0] == '*' {\n\t\t\tb.ReturnType = b.ReturnType[1:]\n\t\t\tb.ReturnIsPtr = true\n\t\t}\n\t}\n\n\tb.Method = transport.Method\n\n\t// Sort the arguments by name for consistent positional ordering.\n\tvar argVals []truce.ArgumentValue\n\tfor _, arg := range transport.Arguments {\n\t\targVals = append(argVals, arg)\n\t}\n\tsort.Slice(argVals, func(i, j int) bool {\n\t\treturn argVals[i].Name < argVals[j].Name\n\t})\n\n\tvar qpos int\n\tfor _, arg := range argVals {\n\t\ta, ok := args[arg.Name]\n\n\t\tswitch arg.From {\n\t\tcase \"body\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tb.BodyVar = a.posVariable\n\t\t\tb.BodyType = a.typ\n\t\tcase \"path\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpathMappings[arg.Var] = args[arg.Name].variable\n\t\tcase \"query\":\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tb.Query[arg.Var] = QueryParam{\n\t\t\t\tPos: qpos,\n\t\t\t\tQueryVar: arg.Var,\n\t\t\t\tGoVar: a.posVariable,\n\t\t\t\tType: a.typ,\n\t\t\t}\n\n\t\t\tqpos++\n\t\tcase \"static\":\n\t\t\t// TODO(georgemac)\n\t\t}\n\t}\n\n\tfor _, part := range strings.Split(config.Prefix, \"/\") {\n\t\tif part == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tb.Path = append(b.Path, Element{Type: \"static\", Value: part})\n\t}\n\n\tb.Path = append(b.Path, parsePath(pathMappings, transport.Path)...)\n\n\treturn b, nil\n}", "func parse(body io.ReadCloser) ([]Result, error) {\n\tdefer body.Close()\n\n\tdoc, err := goquery.NewDocumentFromReader(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresults := []Result{}\n\tfor _, parserMethod := range defaultParserFunctions {\n\t\tresults = parserMethod(doc)\n\t\tif len(results) != 0 {\n\t\t\treturn results, nil\n\t\t}\n\t}\n\n\treturn results, nil\n}", "func parser(\n\tin <-chan string,\n\terrors chan<- error,\n\tquit chan struct{},\n\tdefinitionFile string,\n) chan Parsed {\n\n\tdef, err := definition.NewDefinition(definitionFile)\n\tif err != nil {\n\t\tlog.Fatal(\"failed to read definition: %s\", err)\n\t}\n\n\tout := make(chan Parsed)\n\n\tfor i := 0; i < NumParserWorkers; i++ {\n\t\tgo func() {\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn\n\t\t\t\tcase body := <-in:\n\t\t\t\t\tp := Parsed{\n\t\t\t\t\t\tFields: def.Parse(body),\n\t\t\t\t\t\tSize: binary.Size([]byte(body)),\n\t\t\t\t\t}\n\t\t\t\t\tout <- p\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\treturn out\n}", "func generateSplitParseFunc(headers []string, fieldDelimiter rune) parseFunc {\n\treturn func(value interface{}) (interface{}, error) {\n\t\tcsvLine, err := valueAsString(value)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// This parse function does not do any special quote handling; Splitting on the delimiter is sufficient.\n\t\tfields := strings.Split(csvLine, string(fieldDelimiter))\n\t\treturn headersMap(headers, fields)\n\t}\n}", "func (app *APP) Parse() error {\n\tdataHandlers := map[string]dataHandler{\n\t\tOrganisationsKey: app.LoadOrganisationsFromJSON,\n\t\tUsersKey: app.LoadUsersFromJSON,\n\t\tTicketsKey: app.LoadTicketsFromJSON,\n\t}\n\n\tfor dataType, dataHandler := range dataHandlers {\n\t\terr := dataHandler(app.jsonContents[dataType])\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to read %s data file with error: %s\", dataType, err.Error())\n\t\t}\n\t}\n\treturn nil\n}", "func main() {\n\tparse(read_file(\"test.txt\"))\n\n}", "func (p *Parser) parseFunctionParameters() (map[string]asti.ExpressionI, []*ast.Identifier) {\n\n\t// Any default parameters.\n\tm := make(map[string]asti.ExpressionI)\n\n\t// The argument-definitions.\n\tidentifiers := make([]*ast.Identifier, 0)\n\n\t// Is the next parameter \")\" ? If so we're done. No args.\n\tif p.peekTokenIs(tokentype.RPAREN) {\n\t\tp.nextToken()\n\t\treturn m, identifiers\n\t}\n\tp.nextToken()\n\n\t// Keep going until we find a \")\"\n\tfor !p.curTokenIs(tokentype.RPAREN) {\n\n\t\tif p.curTokenIs(tokentype.EOF) {\n\t\t\tp.AddError(\"unterminated function parameters\")\n\t\t\treturn nil, nil\n\t\t}\n\n\t\t// Get the identifier.\n\t\tident := &ast.Identifier{Token: p.curToken, Value: p.curToken.Literal}\n\t\tidentifiers = append(identifiers, ident)\n\t\tp.nextToken()\n\n\t\t// If there is \"=xx\" after the name then that's\n\t\t// the default parameter.\n\t\tif p.curTokenIs(tokentype.ASSIGN) {\n\t\t\tp.nextToken()\n\t\t\t// Save the default value.\n\t\t\tm[ident.Value] = p.parseExpressionStatement().Expression\n\t\t\tp.nextToken()\n\t\t}\n\n\t\t// Skip any comma.\n\t\tif p.curTokenIs(tokentype.COMMA) {\n\t\t\tp.nextToken()\n\t\t}\n\t}\n\n\treturn m, identifiers\n}", "func NewFuncParser(p ParserFunc, name string) *FuncParser {\n\treturn &FuncParser{\n\t\tparser: p,\n\t\tname: name,\n\t}\n}", "func flowFunctionRequestHandle(w http.ResponseWriter, function string) {\n\tw.Header().Set(\"Content-Type\", jsonType)\n\tfunctions, err := listFunction()\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"failed to handle request, error: %v\", err), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tfor _, functionObj := range functions {\n\t\tif functionObj.Name == function {\n\t\t\tdog, derr := getDag(function)\n\t\t\tif derr != nil {\n\t\t\t\thttp.Error(w, fmt.Sprintf(\"failed to handle request, %v\", derr), http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfunctionObj.Dag = dog\n\t\t\tdata, _ := json.Marshal(functionObj)\n\t\t\tw.Write(data)\n\t\t\treturn\n\t\t}\n\t}\n\thttp.Error(w, fmt.Sprintf(\"failed to handle request, function not found\"), http.StatusInternalServerError)\n}", "func SolveFunction(v Token, vars map[string]interface{}, stack Stack) Stack {\n\tvar value interface{}\n\tfunTokens := v.Value\n\tif funTokens.Length() > 1 && v.Lexeme != \"PV\" {\n\t\ttoks := ToPostfix(funTokens)\n\t\tif toks.Length() > 0 {\n\t\t\tvalue = SolvePostfix(toks, vars)\n\t\t}\n\t}\n\tif v.Lexeme == \"LENGTH\" {\n\t\tstack.Push(Token{Number, strconv.Itoa(len(value.(string))), Stack{}})\n\t} else if v.Lexeme == \"ISBLANK\" || v.Lexeme == \"ISNULL\" {\n\t\tval := false\n\t\tif len(strings.TrimSpace(value.(string))) == 0 {\n\t\t\tval = true\n\t\t}\n\t\tstack.Push(Token{Boolean, strconv.FormatBool(val), Stack{}})\n\t} else if v.Lexeme == \"MONTH\" {\n\t\tparsefloat, ok := strconv.ParseFloat(value.(string), 64)\n\t\tif ok != nil {\n\t\t\tfmt.Println(\"Error:\", ok)\n\t\t}\n\t\tdays := int(parsefloat)\n\t\tmonths := days * 12 / 365\n\t\tstack.Push(Token{Number, strconv.Itoa(months), Stack{}})\n\t} else if v.Lexeme == \"DAY\" {\n\t\tparsefloat, ok := strconv.ParseFloat(value.(string), 64)\n\t\tif ok != nil {\n\t\t\tfmt.Println(\"Error:\", ok)\n\t\t}\n\t\tdays := int(parsefloat)\n\t\tbasedate, _ := time.Parse(\"01/02/2006\", \"01/01/1900\")\n\t\tdate := basedate.AddDate(0, 0, days)\n\t\tstack.Push(Token{Number, strconv.Itoa(date.Day()), Stack{}})\n\t} else if v.Lexeme == \"NOT\" {\n\t\tif value == \"true\" {\n\t\t\tstack.Push(Token{Boolean, strconv.FormatBool(false), Stack{}})\n\t\t} else {\n\t\t\tstack.Push(Token{Boolean, strconv.FormatBool(true), Stack{}})\n\t\t}\n\t} else if v.Lexeme == \"ROUND\" {\n\t\tvar number, precision float64\n\t\tvar ok error\n\t\tcount := 0\n\t\tstk := Stack{}\n\t\ttoks := ToPostfix(v.Value)\n\t\tfor _, item := range toks.Values {\n\t\t\tif item.Lexeme != \",\" {\n\t\t\t\tstk.Push(item)\n\t\t\t} else {\n\t\t\t\tif count == 0 {\n\t\t\t\t\tval := SolvePostfix(stk, vars)\n\t\t\t\t\tnumber, ok = strconv.ParseFloat(val.(string), 64)\n\t\t\t\t\tif ok != nil {\n\t\t\t\t\t\tfmt.Println(\"Error:\", ok)\n\t\t\t\t\t}\n\t\t\t\t} else if count == 1 {\n\t\t\t\t\tval := SolvePostfix(stk, vars)\n\t\t\t\t\tprecision, ok = strconv.ParseFloat(val.(string), 64)\n\t\t\t\t\tif ok != nil {\n\t\t\t\t\t\tfmt.Println(\"Error:\", ok)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcount++\n\t\t\t\tstk = Stack{}\n\t\t\t}\n\t\t}\n\t\tif count == 0 {\n\t\t\tval := SolvePostfix(stk, vars)\n\t\t\tnumber, ok = strconv.ParseFloat(val.(string), 64)\n\t\t\tif ok != nil {\n\t\t\t\tfmt.Println(\"Error:\", ok)\n\t\t\t}\n\t\t} else if count == 1 {\n\t\t\tval := SolvePostfix(stk, vars)\n\t\t\tprecision, ok = strconv.ParseFloat(val.(string), 64)\n\t\t\tif ok != nil {\n\t\t\t\tfmt.Println(\"Error:\", ok)\n\t\t\t}\n\t\t}\n\t\toutput := math.Pow(10, float64(precision))\n\t\tresult := number*output + math.Copysign(0.5, number*output)\n\t\tresult = float64(int(result)) / output\n\t\tstr := strconv.FormatFloat(result, 'f', int(precision), 64)\n\t\tstack.Push(Token{Number, str, Stack{}})\n\t}\n\treturn stack\n}", "func (i *Input) parseFuncAnnotation(s string, f *ast.FuncDecl) Annotation {\n\ts = strings.TrimLeft(s, commentPrefix)\n\tvar annotation Annotation\n\tif strings.HasPrefix(s, delegatePrefix) {\n\t\tprefix := fmt.Sprintf(\"//%s:\", delegatePrefix)\n\t\ts = strings.TrimLeft(s, prefix)\n\t\ts = strings.TrimSpace(s)\n\t\tsubmatches := delegateExpr.FindAllStringSubmatch(s, -1)\n\t\tmatches := submatches[0]\n\t\tannotation = &DelegateAnnotation{\n\t\t\tAssemblyName: matches[1],\n\t\t\tTypeName: matches[2],\n\t\t\tMethodName: matches[3],\n\t\t\tFuncDecl: f,\n\t\t\tInput: i,\n\t\t}\n\t}\n\treturn annotation\n}", "func loadConfig(funcs []func() error) error {\n\tvar err error\n\n\tfor _, f := range funcs {\n\t\terr = f()\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn err\n}", "func (s *BashScript) FunctionNames() ([]string, error) {\n\tcallArgs := []string{\"-c\", fmt.Sprintf(\"set -e; source %s; declare -F\", s.FullPath())}\n\n\tio, buf := io.BufferedCombined()\n\n\terr := NewBash().Run(io, callArgs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfunctions := []string{}\n\n\tout := buf.String()\n\tfor _, fun := range strings.Split(string(out), \"\\n\") {\n\t\tif fun != \"\" {\n\t\t\tname := strings.Replace(fun, \"declare -f \", \"\", -1)\n\t\t\tfunctions = append(functions, name)\n\t\t}\n\t}\n\n\treturn functions, nil\n}", "func (info *fileInfo) addFuncPtrDecls() {\n\tgen := &ast.GenDecl{\n\t\tTokPos: info.importCPos,\n\t\tTok: token.VAR,\n\t\tLparen: info.importCPos,\n\t\tRparen: info.importCPos,\n\t}\n\tnames := make([]string, 0, len(info.functions))\n\tfor name := range info.functions {\n\t\tnames = append(names, name)\n\t}\n\tsort.Strings(names)\n\tfor _, name := range names {\n\t\tobj := &ast.Object{\n\t\t\tKind: ast.Typ,\n\t\t\tName: \"C.\" + name + \"$funcaddr\",\n\t\t}\n\t\tvalueSpec := &ast.ValueSpec{\n\t\t\tNames: []*ast.Ident{&ast.Ident{\n\t\t\t\tNamePos: info.importCPos,\n\t\t\t\tName: \"C.\" + name + \"$funcaddr\",\n\t\t\t\tObj: obj,\n\t\t\t}},\n\t\t\tType: &ast.SelectorExpr{\n\t\t\t\tX: &ast.Ident{\n\t\t\t\t\tNamePos: info.importCPos,\n\t\t\t\t\tName: \"unsafe\",\n\t\t\t\t},\n\t\t\t\tSel: &ast.Ident{\n\t\t\t\t\tNamePos: info.importCPos,\n\t\t\t\t\tName: \"Pointer\",\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tobj.Decl = valueSpec\n\t\tgen.Specs = append(gen.Specs, valueSpec)\n\t}\n\tinfo.Decls = append(info.Decls, gen)\n}" ]
[ "0.647542", "0.6471392", "0.64463437", "0.64396536", "0.641464", "0.6380902", "0.62952745", "0.6153932", "0.60824454", "0.60764724", "0.59445286", "0.5792225", "0.56793004", "0.5501519", "0.54934597", "0.54603106", "0.5328648", "0.5324013", "0.5319592", "0.5314563", "0.5269679", "0.5218724", "0.5190703", "0.51878303", "0.5171203", "0.51663536", "0.5151349", "0.51302946", "0.51126707", "0.50958186", "0.5075898", "0.5056616", "0.5039655", "0.50194895", "0.5007888", "0.4998416", "0.49726093", "0.49681327", "0.49609277", "0.4905363", "0.49029723", "0.4894804", "0.48929042", "0.4891225", "0.48800123", "0.4855853", "0.4837431", "0.4817131", "0.48000243", "0.4776535", "0.4774336", "0.47717834", "0.477153", "0.47666368", "0.47610116", "0.4730966", "0.47278446", "0.4726941", "0.47178942", "0.47099587", "0.47075924", "0.46870387", "0.46788323", "0.46530136", "0.46492243", "0.4647842", "0.46277544", "0.46269107", "0.46201837", "0.4614352", "0.46078408", "0.4575132", "0.45633292", "0.45395803", "0.45312205", "0.45193192", "0.4516688", "0.45011547", "0.4498642", "0.4497219", "0.44900364", "0.44888803", "0.44881198", "0.44603142", "0.44519588", "0.4442267", "0.44400075", "0.44389814", "0.44305283", "0.44263437", "0.44183847", "0.44159794", "0.4404007", "0.44022045", "0.4399676", "0.43858916", "0.43767378", "0.43762612", "0.43730217", "0.4371922" ]
0.72543186
0
parseDependencies ... The term "dependency" is used here to refer to any data type that may require an include or forward declare.
parseDependencies ... В данном контексте термин "зависимость" используется для обозначения любого типа данных, который может требовать включения или предварительного объявления.
func (i *Interface) parseDependencies() { var dependencies []string for _, function := range i.Functions { // "expanded" refers to creating a parsers.from a templated type, i.e "QMap <int, QString>" becomes [QMap int QString] expandedReturnType := strings.FieldsFunc(function.ReturnType, templatedTypeSeparators) for _, dataType := range(expandedReturnType) { dependencies = append(dependencies, strings.TrimSpace(dataType)) } for _, parameter := range function.Parameters { expandedParameter := strings.FieldsFunc(parameter.Type, templatedTypeSeparators) for _, innerParameter := range expandedParameter { dependencies = append(dependencies, strings.TrimSpace(innerParameter)) } } } i.Dependencies = dependencies i.Dependencies = parsers.RemoveConstSpecifiers(i.Dependencies) i.Dependencies = parsers.RemovePointersAndReferences(i.Dependencies) i.Dependencies = parsers.RemoveStdDataTypes(i.Dependencies) i.Dependencies = parsers.MapDataTypesToLibraryDependencies(i.Dependencies) i.Dependencies = parsers.RemoveDuplicates(i.Dependencies) sort.Strings(i.Dependencies) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func calculateDependencies(definition string) (definitions dependencies, err error) {\n half := make(dependencies, 0)\n marked := make(dependencies, 0)\n\n err = visitDefinition(definition, &half, &marked)\n\n if nil == err {\n definitions = marked\n }\n\n return\n}", "func convertDependencies(deps []string) []*license_metadata_proto.AnnotatedDependency {\n\tvar ret []*license_metadata_proto.AnnotatedDependency\n\n\tfor _, d := range deps {\n\t\tcomponents := strings.Split(d, \":\")\n\t\tdep := components[0]\n\t\tcomponents = components[1:]\n\t\tad := &license_metadata_proto.AnnotatedDependency{\n\t\t\tFile: proto.String(dep),\n\t\t\tAnnotations: make([]string, 0, len(components)),\n\t\t}\n\t\tfor _, ann := range components {\n\t\t\tif len(ann) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tad.Annotations = append(ad.Annotations, ann)\n\t\t}\n\t\tret = append(ret, ad)\n\t}\n\n\treturn ret\n}", "func (s DhcpServer) Dependencies() (deps []depgraph.Dependency) {\n\treturn []depgraph.Dependency{\n\t\t{\n\t\t\tRequiredItem: depgraph.ItemRef{\n\t\t\t\tItemType: NetNamespaceTypename,\n\t\t\t\tItemName: normNetNsName(s.NetNamespace),\n\t\t\t},\n\t\t\tDescription: \"Network namespace must exist\",\n\t\t},\n\t\t{\n\t\t\tRequiredItem: depgraph.ItemRef{\n\t\t\t\tItemType: VethTypename,\n\t\t\t\tItemName: s.VethName,\n\t\t\t},\n\t\t\tDescription: \"veth interface must exist\",\n\t\t},\n\t}\n}", "func (p InfraConfigValidateJMX) Dependencies() []string {\n\treturn []string{\n\t\t\"Infra/Config/IntegrationsMatch\",\n\t\t\"Java/Env/Version\",\n\t}\n}", "func (i *Interface) parseForwardDeclares() {\n\tfor _, dependency := range i.Dependencies {\n\t\tif !parsers.ShouldBeIncludedInHeader(dependency) {\n\t\t\ti.ForwardDeclaresString += \"class \" + dependency + \";\\n\"\n\t\t} \n\t}\n}", "func Parse(description string) (deps []Dep) {\n\tfor _, footerValue := range footer.ParseMessage(description)[cqDependKey] {\n\t\tfor _, v := range strings.Split(footerValue, \",\") {\n\t\t\tif dep, err := parseSingleDep(v); err == nil {\n\t\t\t\tdeps = append(deps, dep)\n\t\t\t}\n\t\t}\n\t}\n\tif len(deps) <= 1 {\n\t\treturn deps\n\t}\n\tsort.Slice(deps, func(i, j int) bool { return deps[i].cmp(deps[j]) == 1 })\n\t// Remove duplicates. We don't use the map in the first place, because\n\t// duplicates are highly unlikely in practice and sorting is nice for\n\t// determinism.\n\tl := 0\n\tfor i := 1; i < len(deps); i++ {\n\t\tif d := deps[i]; d.cmp(deps[l]) != 0 {\n\t\t\tl += 1\n\t\t\tdeps[l] = d\n\t\t}\n\t}\n\treturn deps[:l+1]\n}", "func Dependencies(g *Graph) (pacman.Packages, aur.Packages, []string) {\n\trps := make(pacman.Packages, 0)\n\taps := make(aur.Packages, 0)\n\tups := make([]string, 0)\n\n\tnames := make(map[string]bool)\n\tnodes := AllNodesBottomUp(g)\n\tfor _, vn := range nodes {\n\t\tn := vn.(*Node)\n\t\tif names[n.PkgName()] {\n\t\t\tcontinue\n\t\t}\n\n\t\tnames[n.PkgName()] = true\n\t\tswitch p := n.AnyPackage.(type) {\n\t\tcase *aur.Package:\n\t\t\taps = append(aps, p)\n\t\tcase *pacman.Package:\n\t\t\tif p.Origin == pacman.UnknownOrigin {\n\t\t\t\tups = append(ups, p.Name)\n\t\t\t} else {\n\t\t\t\trps = append(rps, p)\n\t\t\t}\n\t\tdefault:\n\t\t\tpanic(\"unexpected type of package in graph\")\n\t\t}\n\t}\n\treturn rps, aps, ups\n}", "func (d *ABFToInterfaceDescriptor) Dependencies(key string, emptyVal proto.Message) []api.Dependency {\n\t_, ifName, _ := vpp_abf.ParseToInterfaceKey(key)\n\treturn []api.Dependency{\n\t\t{\n\t\t\tLabel: interfaceDep,\n\t\t\tKey: vpp_interfaces.InterfaceKey(ifName),\n\t\t},\n\t}\n}", "func (p BaseConfigProxyDetect) Dependencies() []string {\n\t// no dependencies!\n\treturn []string{\n\t\t\"Base/Config/Validate\",\n\t\t\"Base/Env/CollectEnvVars\",\n\t\t\"Base/Env/CollectSysProps\",\n\t}\n}", "func buildDependencies(fdSet *dpb.FileDescriptorSet) {\n\t// Dependency to google/api/annotations.proto for gRPC-HTTP transcoding. Here a couple of problems arise:\n\t// 1. Problem: \tWe cannot call descriptor.ForMessage(&annotations.E_Http), which would be our\n\t//\t\t\t\trequired dependency. However, we can call descriptor.ForMessage(&http) and\n\t//\t\t\t\tthen construct the extension manually.\n\t// 2. Problem: \tThe name is set wrong.\n\t// 3. Problem: \tgoogle/api/annotations.proto has a dependency to google/protobuf/descriptor.proto.\n\thttp := annotations.Http{}\n\tfd, _ := descriptor.MessageDescriptorProto(&http)\n\n\textensionName := \"http\"\n\tn := \"google/api/annotations.proto\"\n\tl := dpb.FieldDescriptorProto_LABEL_OPTIONAL\n\tt := dpb.FieldDescriptorProto_TYPE_MESSAGE\n\ttName := \"google.api.HttpRule\"\n\textendee := \".google.protobuf.MethodOptions\"\n\n\thttpExtension := &dpb.FieldDescriptorProto{\n\t\tName: &extensionName,\n\t\tNumber: &annotations.E_Http.Field,\n\t\tLabel: &l,\n\t\tType: &t,\n\t\tTypeName: &tName,\n\t\tExtendee: &extendee,\n\t}\n\n\tfd.Extension = append(fd.Extension, httpExtension) // 1. Problem\n\tfd.Name = &n // 2. Problem\n\tfd.Dependency = append(fd.Dependency, \"google/protobuf/descriptor.proto\") //3.rd Problem\n\n\t// Build other required dependencies\n\te := empty.Empty{}\n\tfdp := dpb.DescriptorProto{}\n\tfd2, _ := descriptor.MessageDescriptorProto(&e)\n\tfd3, _ := descriptor.MessageDescriptorProto(&fdp)\n\tdependencies := []*dpb.FileDescriptorProto{fd, fd2, fd3}\n\n\t// According to the documentation of protoReflect.CreateFileDescriptorFromSet the file I want to print\n\t// needs to be at the end of the array. All other FileDescriptorProto are dependencies.\n\tfdSet.File = append(dependencies, fdSet.File...)\n}", "func (l *LoadInventory) Dependencies(\n\tc base.Container,\n) (err error) {\n\tl.client, err = c.S3API()\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.db, err = c.DB()\n\tl.inventory = c.InventoryManager()\n\n\treturn err\n}", "func (*serverModule) Dependencies() []module.Dependency {\n\treturn nil\n}", "func ParseDepFile(content []byte) ([]string, []string) {\n\tcontent = bytes.Replace(content, []byte(\"\\\\\\n\"), nil, -1)\n\tcomponents := bytes.Split(content, []byte(\":\"))\n\tif len(components) != 2 {\n\t\treturn nil, nil\n\t}\n\n\ttargetStrs := bytes.Split(components[0], []byte(\" \"))\n\tdepStrs := bytes.Split(components[1], []byte(\" \"))\n\n\tvar targets, deps []string\n\tfor _, t := range targetStrs {\n\t\tif len(t) > 0 {\n\t\t\ttargets = append(targets, string(t))\n\t\t}\n\t}\n\tfor _, d := range depStrs {\n\t\tif len(d) > 0 {\n\t\t\tdeps = append(deps, string(d))\n\t\t}\n\t}\n\n\treturn targets, deps\n}", "func addDependencies(fdSet *dpb.FileDescriptorSet) {\n\t// At last, we need to add the dependencies to the FileDescriptorProto in order to get them rendered.\n\tlastFdProto := getLast(fdSet.File)\n\tfor _, fd := range fdSet.File {\n\t\tif fd != lastFdProto {\n\t\t\tif *fd.Name == \"google/protobuf/empty.proto\" { // Reference: https://github.com/googleapis/gnostic-grpc/issues/8\n\t\t\t\tif shouldRenderEmptyImport {\n\t\t\t\t\tlastFdProto.Dependency = append(lastFdProto.Dependency, *fd.Name)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlastFdProto.Dependency = append(lastFdProto.Dependency, *fd.Name)\n\t\t}\n\t}\n\t// Sort imports so they will be rendered in a consistent order.\n\tsort.Strings(lastFdProto.Dependency)\n}", "func visitDefinition(definition string, half, marked *dependencies) (err error) {\n if half.includes(definition) {\n return errCyclicDependency\n } else if !marked.includes(definition) && !half.includes(definition) {\n half.add(definition)\n task := gofer.index(definition)\n\n if nil == task {\n return errUnresolvableDependencies\n }\n\n for _, dependency := range task.Dependencies {\n err = visitDefinition(dependency, half, marked)\n if nil != err {\n return\n }\n }\n\n half.remove(definition)\n marked.add(definition)\n }\n\n return\n}", "func (d *InterfaceVrfDescriptor) Dependencies(key string, emptyVal proto.Message) (deps []kvs.Dependency) {\n\tif _, vrf, ipv4, ipv6, isIfaceVrfKey := interfaces.ParseInterfaceVrfKey(key); isIfaceVrfKey {\n\t\tif vrf > 0 && ipv4 {\n\t\t\tdeps = append(deps, kvs.Dependency{\n\t\t\t\tLabel: vrfV4Dep,\n\t\t\t\tKey: l3.VrfTableKey(uint32(vrf), l3.VrfTable_IPV4),\n\t\t\t})\n\t\t}\n\t\tif vrf > 0 && ipv6 {\n\t\t\tdeps = append(deps, kvs.Dependency{\n\t\t\t\tLabel: vrfV6Dep,\n\t\t\t\tKey: l3.VrfTableKey(uint32(vrf), l3.VrfTable_IPV6),\n\t\t\t})\n\t\t}\n\t\treturn deps\n\t}\n\n\t_, fromIface, _ := interfaces.ParseInterfaceInheritedVrfKey(key)\n\treturn []kvs.Dependency{\n\t\t{\n\t\t\tLabel: inheritedVrfDep,\n\t\t\tAnyOf: kvs.AnyOfDependency{\n\t\t\t\tKeyPrefixes: []string{interfaces.InterfaceVrfKeyPrefix(fromIface)},\n\t\t\t},\n\t\t},\n\t}\n}", "func (h *descriptorHandler) dependencies(key string, value proto.Message) (deps []kvs.Dependency) {\n\tif h.descriptor == nil || h.descriptor.Dependencies == nil {\n\t\treturn\n\t}\n\t// TODO: check that label is unique for each KV pair, throw panic if not (?)\n\tdefer trackDescMethod(h.descriptor.Name, \"Dependencies\")()\n\treturn h.descriptor.Dependencies(key, value)\n}", "func Dependency(ids ...Identifier) Constraint {\n\treturn dependency(ids)\n}", "func (m *multiNode) SetDependency(dep []int32) {\n\tm.dependency = dep\n}", "func (shl *SharedLibrary) Dependencies() []string {\n\treturn shl.dependencies\n}", "func (t BaseContainersDetectDocker) Dependencies() []string {\n\treturn []string{}\n}", "func (t DotNetAgentVersion) Dependencies() []string {\n\treturn []string{\n\t\t\"DotNet/Agent/Installed\",\n\t}\n}", "func DependencySort(ks []HelmRelease) ([]HelmRelease, error) {\n\tn := make(graph)\n\tlookup := map[string]*HelmRelease{}\n\tfor i := 0; i < len(ks); i++ {\n\t\tn[ks[i].Name] = after(ks[i].Spec.DependsOn)\n\t\tlookup[ks[i].Name] = &ks[i]\n\t}\n\tsccs := tarjanSCC(n)\n\tvar sorted []HelmRelease\n\tvar unsortable CircularDependencyError\n\tfor i := 0; i < len(sccs); i++ {\n\t\ts := sccs[i]\n\t\tif len(s) != 1 {\n\t\t\tunsortable = append(unsortable, s)\n\t\t\tcontinue\n\t\t}\n\t\tif k, ok := lookup[s[0]]; ok {\n\t\t\tsorted = append(sorted, *k.DeepCopy())\n\t\t}\n\t}\n\tif unsortable != nil {\n\t\tfor i, j := 0, len(unsortable)-1; i < j; i, j = i+1, j-1 {\n\t\t\tunsortable[i], unsortable[j] = unsortable[j], unsortable[i]\n\t\t}\n\t\treturn nil, unsortable\n\t}\n\treturn sorted, nil\n}", "func importOrder(deps map[string][]string) ([]string, error) {\n\t// add all nodes and edges\n\tvar remainingNodes = map[string]struct{}{}\n\tvar graph = map[edge]struct{}{}\n\tfor to, froms := range deps {\n\t\tremainingNodes[to] = struct{}{}\n\t\tfor _, from := range froms {\n\t\t\tremainingNodes[from] = struct{}{}\n\t\t\tgraph[edge{from: from, to: to}] = struct{}{}\n\t\t}\n\t}\n\n\t// find initial nodes without any dependencies\n\tsorted := findAndRemoveNodesWithoutDependencies(remainingNodes, graph)\n\tfor i := 0; i < len(sorted); i++ {\n\t\tnode := sorted[i]\n\t\tremoveEdgesFrom(node, graph)\n\t\tsorted = append(sorted, findAndRemoveNodesWithoutDependencies(remainingNodes, graph)...)\n\t}\n\tif len(remainingNodes) > 0 {\n\t\treturn nil, fmt.Errorf(\"cycle: remaining nodes: %#v, remaining edges: %#v\", remainingNodes, graph)\n\t}\n\t//for _, n := range sorted {\n\t//\tfmt.Println(\"topological order\", n)\n\t//}\n\treturn sorted, nil\n}", "func NewDependencyInfo(line string) (*DependencyInfo, error) {\n\tsep1 := strings.IndexRune(line, ' ')\n\tif sep1 != 1 {\n\t\treturn nil, errors.New(\"Invalid separator\")\n\t}\n\tsep2 := strings.IndexRune(line[sep1+1:], ' ')\n\tif sep2 < 0 {\n\t\treturn nil, errors.New(\"Invalid separator\")\n\t}\n\tsep2 += sep1 + 1\n\n\tdepi := new(DependencyInfo)\n\tvar err error\n\tdepi.To, err = strconv.Atoi(line[sep1+1 : sep2-1])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdepi.DepType = rune(line[sep2-1])\n\n\tdepi.Features = getFeatures(line[sep2+1:], '>', 1)\n\tif pasresult, ok := depi.Features[\"格解析結果\"]; ok {\n\t\tdepi.Pas, err = NewPas(pasresult, true)\n\t}\n\n\treturn depi, err\n}", "func (t BrowserAgentDetect) Dependencies() []string {\n\treturn []string{\n\t\t\"Browser/Agent/GetSource\",\n\t}\n}", "func (j *Job) Dependency(name LinkName) (Dependency, error) {\n\tfor _, d := range j.Dependencies {\n\t\tif d.Name == name {\n\t\t\treturn d, nil\n\t\t}\n\t}\n\treturn Dependency{}, maskAny(errgo.WithCausef(nil, DependencyNotFoundError, name.String()))\n}", "func (td typeDefiner) getLocalDeps(ptype parse.Type) (deps []*typeDefBuilder) {\n\tswitch pt := ptype.(type) {\n\tcase *parse.TypeNamed:\n\t\t// Named references to other types in this package are all we care about.\n\t\tif b := td.builders[pt.Name]; b != nil {\n\t\t\tdeps = append(deps, b)\n\t\t}\n\tcase *parse.TypeEnum:\n\t\t// No deps.\n\tcase *parse.TypeArray:\n\t\tdeps = append(deps, td.getLocalDeps(pt.Elem)...)\n\tcase *parse.TypeList:\n\t\tdeps = append(deps, td.getLocalDeps(pt.Elem)...)\n\tcase *parse.TypeSet:\n\t\tdeps = append(deps, td.getLocalDeps(pt.Key)...)\n\tcase *parse.TypeMap:\n\t\tdeps = append(deps, td.getLocalDeps(pt.Key)...)\n\t\tdeps = append(deps, td.getLocalDeps(pt.Elem)...)\n\tcase *parse.TypeStruct:\n\t\tfor _, field := range pt.Fields {\n\t\t\tdeps = append(deps, td.getLocalDeps(field.Type)...)\n\t\t}\n\tcase *parse.TypeUnion:\n\t\tfor _, field := range pt.Fields {\n\t\t\tdeps = append(deps, td.getLocalDeps(field.Type)...)\n\t\t}\n\tcase *parse.TypeOptional:\n\t\tdeps = append(deps, td.getLocalDeps(pt.Base)...)\n\tdefault:\n\t\tpanic(fmt.Errorf(\"vdl: unhandled parse.Type %T %#v\", ptype, ptype))\n\t}\n\treturn\n}", "func showDepsInfo(gomod []byte) {\n\tdeps := depsy.Extract(gomod, false)\n\n\tif len(deps) == 0 {\n\t\treturn\n\t}\n\n\tfmtutil.Separator(false, \"DEPENDENCIES\")\n\n\tfor _, dep := range deps {\n\t\tif dep.Extra == \"\" {\n\t\t\tfmtc.Printf(\" {s}%8s{!} %s\\n\", dep.Version, dep.Path)\n\t\t} else {\n\t\t\tfmtc.Printf(\" {s}%8s{!} %s {s-}(%s){!}\\n\", dep.Version, dep.Path, dep.Extra)\n\t\t}\n\t}\n}", "func (p BaseLogCopy) Dependencies() []string {\n\treturn []string{\n\t\t\"Base/Env/CollectEnvVars\",\n\t\t\"Base/Env/CollectSysProps\",\n\t\t\"Base/Config/Validate\",\n\t}\n}", "func ResolveDependencies(m meta.RESTMapper, objects []unstructuredv1.Unstructured, uids []types.UID) (NodeMap, error) {\n\treturn resolveDeps(m, objects, uids, true)\n}", "func validateDependencies(eventDependencies []v1alpha1.EventDependency) error {\n\tif len(eventDependencies) < 1 {\n\t\treturn errors.New(\"no event dependencies found\")\n\t}\n\tfor _, dep := range eventDependencies {\n\t\tif dep.Name == \"\" {\n\t\t\treturn errors.New(\"event dependency must define a name\")\n\t\t}\n\t\t// TODO: GatewayName will be deprecated\n\t\tif dep.EventSourceName == \"\" && dep.GatewayName == \"\" {\n\t\t\treturn errors.New(\"event dependency must define the EventSource name\")\n\t\t}\n\n\t\tif dep.EventName == \"\" {\n\t\t\treturn errors.New(\"event dependency must define the event name\")\n\t\t}\n\n\t\tif err := validateEventFilter(dep.Filters); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (a *baseDomain) Dependencies() []asset.Asset {\n\treturn []asset.Asset{\n\t\t&platform{},\n\t}\n}", "func Dependencies(source v1alpha1.SourceSpec) []string {\n\tcandidateMap := make(map[string]bool)\n\tregexps := getRegexpsForLanguage(source.Language)\n\tsubMatches := findAllStringSubmatch(source.Content, regexps...)\n\tfor _, uriPrefix := range subMatches {\n\t\tcandidateComp := decodeComponent(uriPrefix)\n\t\tif candidateComp != \"\" {\n\t\t\tcandidateMap[candidateComp] = true\n\t\t}\n\t}\n\t// Remove duplicates and sort\n\tcandidateComponents := make([]string, 0, len(candidateMap))\n\tfor cmp := range candidateMap {\n\t\tcandidateComponents = append(candidateComponents, cmp)\n\t}\n\tsort.Strings(candidateComponents)\n\treturn candidateComponents\n}", "func (o VirtualDatabaseSpecBuildSourcePtrOutput) Dependencies() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *VirtualDatabaseSpecBuildSource) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Dependencies\n\t}).(pulumi.StringArrayOutput)\n}", "func (n *Node) CollectDependencies(m *Magnet) []*Node {\n\tvar ret []*Node\n\tret = append(ret, n)\n\tkeys := make(map[*Node]bool)\n\tfor _, v := range n.requires {\n\t\tn = m.findNode(v)\n\t\tif n == nil {\n\t\t\tpanic(fmt.Sprintf(\"type %s cannot be built!\", v))\n\t\t}\n\t\tfor _, v := range n.CollectDependencies(m) {\n\t\t\tif _, has := keys[v]; !has {\n\t\t\t\tkeys[v] = true\n\t\t\t\tret = append(ret, v)\n\t\t\t}\n\t\t}\n\t}\n\treturn ret\n}", "func (o *V0037JobProperties) SetDependency(v string) {\n\to.Dependency = &v\n}", "func (d *galleryDocument) Dependencies() map[string]struct{} {\n\treturn map[string]struct{}{tmplPathToName(galTmplPath): {}}\n}", "func deps(rule *bazel.Rule) map[bazel.Label]bool {\n\tret := make(map[bazel.Label]bool)\n\tfor _, d := range rule.StringListAttr(\"deps\") {\n\t\tif l, err := bazel.ParseRelativeLabel(rule.PkgName, d); err == nil {\n\t\t\tret[l] = true\n\t\t}\n\t}\n\treturn ret\n}", "func buildDependencyGraph(req *backend.QueryDataRequest) (*simple.DirectedGraph, error) {\n\tgraph, err := buildGraph(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tregistry := buildNodeRegistry(graph)\n\n\tif err := buildGraphEdges(graph, registry); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn graph, nil\n}", "func addDependencies(s *scope, name string, obj pyObject, target *core.BuildTarget, exported, internal bool) {\n\taddStrings(s, name, obj, func(str string) {\n\t\tif s.state.Config.Bazel.Compatibility && !core.LooksLikeABuildLabel(str) && !strings.HasPrefix(str, \"@\") {\n\t\t\t// *sigh*... Bazel seems to allow an implicit : on the start of dependencies\n\t\t\tstr = \":\" + str\n\t\t}\n\t\ttarget.AddMaybeExportedDependency(checkLabel(s, s.parseLabelInPackage(str, s.pkg)), exported, false, internal)\n\t})\n}", "func resolveMessageDependency(msg *desc.MessageDescriptor, dep messageDependency, encountered map[string]bool) {\n\tif encountered[msg.GetFullyQualifiedName()] {\n\t\treturn\n\t}\n\n\tdep[msg.GetFullyQualifiedName()] = msg\n\tfor _, f := range msg.GetFields() {\n\t\tif entity.IsMessageType(f.GetType()) {\n\t\t\tresolveMessageDependency(f.GetMessageType(), dep, encountered)\n\t\t}\n\t}\n}", "func (o VirtualDatabaseSpecBuildSourceOutput) Dependencies() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v VirtualDatabaseSpecBuildSource) []string { return v.Dependencies }).(pulumi.StringArrayOutput)\n}", "func parse(in io.Reader) (_ *ast, depend_order []string, err error) {\n\n\tl := &yyLexState{\n\t\tline_no: 1,\n\t\tin: bufio.NewReader(in),\n\t\tcommand: make(map[string]*command),\n\t\tpredicate: make(map[string]*predicate),\n\t\texeced: make(map[string]bool),\n\t}\n\n\tyyParse(l)\n\tif l.err != nil {\n\t\treturn nil, nil, l.err\n\t}\n\n\tif len(l.execed) == 0 && len(l.predicate) == 0 {\n\t\treturn nil, nil, errors.New(\"no exec or predicate statement\")\n\t}\n\tif len(l.execed)+len(l.predicate) > 255 {\n\t\treturn nil, nil, errors.New(\"exec + predicate count > 255\")\n\t}\n\n\t// Note: all argv lengths must be <= 255 elements!\n\t// verify_argv_length()\n\n\t// add unqualified exec ... () statements to the dependency list.\n\n\tvar find_unreferenced_EXEC_PRED func(a *ast)\n\tfind_unreferenced_EXEC_PRED = func(a *ast) {\n\n\t\tif a == nil {\n\t\t\treturn\n\t\t}\n\t\tswitch {\n\t\tcase a.yy_tok == EXEC && a.command.depend_ref_count == 0:\n\t\t\tn := a.command.name\n\t\t\tl.depends = append(l.depends, fmt.Sprintf(\"%s %s\", n, n))\n\t\tcase a.yy_tok == PREDICATE && a.predicate.depend_ref_count == 0:\n\t\t\tn := a.predicate.name\n\t\t\tl.depends = append(l.depends, fmt.Sprintf(\"%s %s\", n, n))\n\t\t}\n\t\tfind_unreferenced_EXEC_PRED(a.left)\n\t\tfind_unreferenced_EXEC_PRED(a.right)\n\t\tfind_unreferenced_EXEC_PRED(a.next)\n\t}\n\tfind_unreferenced_EXEC_PRED(l.ast_head)\n\n\tdepend_order = tsort(l.depends)\n\tif depend_order == nil {\n\t\tl.err = errors.New(\"statement invocation order has cycles\")\n\t}\n\tfor i, j := 0, len(depend_order)-1; i < j; i, j = i+1, j-1 {\n\t\tdepend_order[i], depend_order[j] =\n\t\t\tdepend_order[j], depend_order[i]\n\t}\n\treturn l.ast_head, depend_order, l.err\n}", "func (p DotnetRequirementsDatastores) Dependencies() []string {\n\treturn []string{\n\t\t\"DotNet/Agent/Installed\",\n\t}\n}", "func (p BaseConfigLogLevel) Dependencies() []string {\n\treturn []string{\n\t\t\"Base/Config/Validate\", //This identifies this task as dependent on \"Base/Config/Validate\" and so the results from that task will be passed to this task. See the execute method to see how to interact with the results.\n\t}\n}", "func ResolveDependency(dependencies []v1alpha1.EventDependency, events *v1alpha1.Event) *v1alpha1.EventDependency {\n\tfor _, dependency := range dependencies {\n\t\tgatewayNameGlob, err := glob.Compile(dependency.GatewayName)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\teventNameGlob, err := glob.Compile(dependency.EventName)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tif gatewayNameGlob.Match(events.Context.Source) && eventNameGlob.Match(events.Context.Subject) {\n\t\t\treturn &dependency\n\t\t}\n\t}\n\treturn nil\n}", "func (p *Wheel) Dependencies() []Dependency {\n\tvar dependencies []Dependency\n\n\tfor _, row := range p.RequiresDist {\n\t\tdep, err := version.ParseDependency(row)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"❗️ %s: %s(%v)\\n\", p.name, row, err)\n\t\t\tcontinue\n\t\t}\n\t\tinstall, err := dep.Evaluate(env)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"❗️ %s: %s(%v)\\n\", p.name, row, err)\n\t\t\tcontinue\n\t\t}\n\t\tif !install {\n\t\t\tcontinue\n\t\t}\n\n\t\t// fmt.Fprintf(os.Stderr, \"🍀 %s: %s(minimal = %s)\\n\", name, row, version.Minimal(dep.Versions))\n\t\tdependencies = append(dependencies, Dependency{\n\t\t\tName: NormalizePackageName(dep.Name),\n\t\t\tVersion: version.Minimal(dep.Versions),\n\t\t})\n\t}\n\n\treturn dependencies\n}", "func hasDependency(bld *build.File, r *build.Rule, dep string) bool {\n\tpkg := filepath.Dir(bld.Path)\n\toldDeps := r.Attr(\"deps\")\n\tif edit.ListFind(oldDeps, dep, pkg) != nil {\n\t\treturn true\n\t}\n\truntimeDeps := r.Attr(\"runtime_deps\")\n\treturn edit.ListFind(runtimeDeps, dep, pkg) != nil\n}", "func Dependencies(jaeger *v1alpha1.Jaeger) []batchv1.Job {\n\tif strings.ToLower(jaeger.Spec.Storage.Type) == \"cassandra\" {\n\t\treturn cassandraDeps(jaeger)\n\t}\n\n\treturn []batchv1.Job{}\n}", "func (cd *circularDependency) checkDependency(d *dependency, m *method) error {\n\t// If this Dependency is already checked,\n\t// we don't need to check it again\n\tif cd.isChecked(d) {\n\t\treturn nil\n\t}\n\n\t//log.Println(\"CD for Dependency\", d.Value.Type())\n\n\t// Add this dependency type to the dependency list\n\t// and check if this type desn't already exist\n\terr := cd.addAndCheck(d.value.Type())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Check if this Dependency has New Method\n\tif d.constructor != nil {\n\t\tfor i := 0; i < d.constructor.Type.NumIn(); i++ {\n\n\t\t\tt := d.constructor.Type.In(i)\n\t\t\t//log.Println(\"CD for Dependency New Dependency\", i, t, dependency.isType(t))\n\n\t\t\t// The first element will always be the dependency itself\n\t\t\tif d.isType(t) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// All context types doesn't need to be checked\n\t\t\t// it will always be present in the context\n\t\t\tif isContextType(t) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\td, exist := m.dependencies.vaueOf(t)\n\t\t\tif !exist { // It should never occurs!\n\t\t\t\treturn fmt.Errorf(\"Danger! No dependency %s found! Something very wrong happened!\", t)\n\t\t\t}\n\n\t\t\t// Go ahead recursively on each Dependency\n\t\t\terr := cd.checkDependency(d, m)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Remove itself from the list\n\tcd.pop()\n\n\t// Add this dependency to the checked list\n\tcd.checked = append(cd.checked, d)\n\n\treturn nil\n}", "func Dependencies(logger logr.Logger, manager feature.ResourceManagers, dda *v2alpha1.DatadogAgent) (errs []error) {\n\toverrides := dda.Spec.Override\n\tnamespace := dda.Namespace\n\n\tfor component, override := range overrides {\n\t\terr := overrideRBAC(logger, manager, override, component, namespace)\n\t\tif err != nil {\n\t\t\terrs = append(errs, err)\n\t\t}\n\n\t\t// Handle custom agent configurations (datadog.yaml, cluster-agent.yaml, etc.)\n\t\terrs = append(errs, overrideCustomConfigs(logger, manager, override.CustomConfigurations, dda.Name, namespace)...)\n\n\t\t// Handle custom check configurations\n\t\tconfdCMName := fmt.Sprintf(v2alpha1.ExtraConfdConfigMapName, strings.ToLower((string(component))))\n\t\terrs = append(errs, overrideExtraConfigs(logger, manager, override.ExtraConfd, namespace, confdCMName, true)...)\n\n\t\t// Handle custom check files\n\t\tchecksdCMName := fmt.Sprintf(v2alpha1.ExtraChecksdConfigMapName, strings.ToLower((string(component))))\n\t\terrs = append(errs, overrideExtraConfigs(logger, manager, override.ExtraChecksd, namespace, checksdCMName, false)...)\n\n\t\t// Handle scc\n\t\terrs = append(errs, overrideSCC(manager, dda)...)\n\t}\n\n\treturn errs\n}", "func convertToDependency(f amboy.Format, d *DependencyInterchange) (dependency.Manager, error) {\n\tfactory, err := GetDependencyFactory(d.Type)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdep := factory()\n\n\tif dep.Type().Version != d.Version {\n\t\treturn nil, errors.Errorf(\"dependency '%s' (version=%d) does not match the current version (%d) for the dependency type '%s'\",\n\t\t\td.Type, d.Version, dep.Type().Version, dep.Type().Name)\n\t}\n\n\t// this works, because we want to use all the data from the\n\t// interchange object, but want to use the type information\n\t// associated with the object that we produced with the\n\t// factory.\n\terr = convertFrom(f, d.Dependency, dep)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"converting dependency\")\n\t}\n\n\treturn dep, nil\n}", "func makeDependencyInterchange(f amboy.Format, d dependency.Manager) (*DependencyInterchange, error) {\n\ttypeInfo := d.Type()\n\n\tdata, err := convertTo(f, d)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toutput := &DependencyInterchange{\n\t\tType: typeInfo.Name,\n\t\tVersion: typeInfo.Version,\n\t\tEdges: d.Edges(),\n\t\tDependency: data,\n\t}\n\n\treturn output, nil\n}", "func (t DotNetCoreRequirementsNetCoreVersion) Dependencies() []string {\n\treturn []string{\n\t\t\"DotNetCore/Agent/Installed\",\n\t\t\"DotNetCore/Env/Versions\",\n\t}\n}", "func (u *comboUtility) Dependency(util utility) {\n\tu.children.Insert(util)\n}", "func Parse(ingress *networking.Ingress) *Dependencies {\n\tsecrets := extractSecrets(ingress)\n\tsecrets = append(secrets, secretsFromAnnotations(ingress)...)\n\n\treturn &Dependencies{\n\t\tServices: extractServices(ingress),\n\t\tEndpoints: extractServices(ingress),\n\t\tSecrets: secrets,\n\t\tConfigmaps: configmapsFromAnnotations(ingress),\n\t\tAnnotations: extractAnnotations(ingress),\n\t}\n}", "func (*gaeModule) Dependencies() []module.Dependency {\n\treturn []module.Dependency{\n\t\tmodule.OptionalDependency(redisconn.ModuleName), // for dscache, if enabled\n\t\tmodule.OptionalDependency(secrets.ModuleName), // to install DS random secrets backend\n\t}\n}", "func (i *Interface) parseIncludes() {\n\tfor _, dependency := range i.Dependencies {\n\t\tinclude := NewInclude(dependency)\n\t\tif parsers.ShouldBeIncludedInHeader(dependency) {\n\t\t\ti.HeaderIncludesString += include.ToString() + \"\\n\"\n\t\t} else {\n\t\t\ti.ImplementationIncludesString += include.ToString() + \"\\n\"\n\t\t}\n\t}\n}", "func (p *Parser) Parse(r dio.ReadSeekerAt) ([]types.Library, []types.Dependency, error) {\n\tinfo, err := buildinfo.Read(r)\n\tif err != nil {\n\t\treturn nil, nil, convertError(err)\n\t}\n\n\tlibs := make([]types.Library, 0, len(info.Deps))\n\n\tfor _, dep := range info.Deps {\n\t\t// binaries with old go version may incorrectly add module in Deps\n\t\t// In this case Path == \"\", Version == \"Devel\"\n\t\t// we need to skip this\n\t\tif dep.Path == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tmod := dep\n\t\tif dep.Replace != nil {\n\t\t\tmod = dep.Replace\n\t\t}\n\n\t\tlibs = append(libs, types.Library{\n\t\t\tName: mod.Path,\n\t\t\tVersion: mod.Version,\n\t\t})\n\t}\n\n\treturn libs, nil, nil\n}", "func (fastenJSON *JSON) AddDependency(target *JSON) {\n\tif target.Product == \"\" {\n\t\treturn\n\t}\n\n\tfor _, inner := range fastenJSON.Depset {\n\t\tfor _, dependency := range inner {\n\t\t\tif dependency.Product == target.Product {\n\t\t\t\tfound := false\n\t\t\t\tif target.Version == \"\" {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tfor _, constraint := range dependency.Constraints {\n\t\t\t\t\tif constraint == target.Version {\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\treturn\n\t\t\t\t} else if target.Version != \"\" {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif len(fastenJSON.Depset) == 0 {\n\t\tfastenJSON.Depset = append(fastenJSON.Depset, []Dependency{})\n\t}\n\tfastenJSON.Depset[0] = append(fastenJSON.Depset[0], Dependency{\n\t\tProduct: target.Product,\n\t\tForge: \"cratesio\",\n\t\tConstraints: []string{\"[\" + target.Version + \"]\"},\n\t})\n}", "func (tag scopeDependencyTag) extractDepInfo(ctx android.ModuleContext, dep android.Module, paths *scopePaths) {\n\terr := tag.depInfoExtractor(paths, ctx, dep)\n\tif err != nil {\n\t\tctx.ModuleErrorf(\"has an invalid {scopeDependencyTag: %s} dependency on module %s: %s\", tag.name, ctx.OtherModuleName(dep), err.Error())\n\t}\n}", "func (c *Controller) getHelmRequestDependencies(hr *v1alpha1.HelmRequest) ([]*v1alpha1.HelmRequest, error) {\n\tvar data []*v1alpha1.HelmRequest\n\tdeps := hr.Spec.Dependencies\n\tif len(deps) == 0 {\n\t\tklog.V(4).Infof(\"HelmRequest %s has no dependencies\", hr.GetName())\n\t\treturn nil, nil\n\t}\n\n\tfor _, name := range deps {\n\t\td, err := c.getHelmRequest(hr.GetNamespace(), name)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"Retrieve dependency %s for %s error: %s\", name, hr.GetName(), err.Error())\n\t\t\treturn nil, err\n\t\t}\n\t\tdata = append(data, d)\n\t}\n\n\treturn data, nil\n\n}", "func (c *ClusterK8sIO) Dependencies() []asset.Asset {\n\treturn []asset.Asset{\n\t\t&installconfig.InstallConfig{},\n\t\t&Networking{},\n\t}\n}", "func (d *RouteDescriptor) Dependencies(key string, route *l3.Route) []kvs.Dependency {\n\tvar dependencies []kvs.Dependency\n\t// the outgoing interface must exist and be UP\n\tif route.OutgoingInterface != \"\" {\n\t\tdependencies = append(dependencies, kvs.Dependency{\n\t\t\tLabel: routeOutInterfaceDep,\n\t\t\tKey: interfaces.InterfaceKey(route.OutgoingInterface),\n\t\t})\n\t}\n\n\t// non-zero VRFs\n\tvar protocol l3.VrfTable_Protocol\n\t_, isIPv6, _ := addrs.ParseIPWithPrefix(route.DstNetwork)\n\tif isIPv6 {\n\t\tprotocol = l3.VrfTable_IPV6\n\t}\n\tif route.VrfId != 0 {\n\t\tdependencies = append(dependencies, kvs.Dependency{\n\t\t\tLabel: vrfTableDep,\n\t\t\tKey: l3.VrfTableKey(route.VrfId, protocol),\n\t\t})\n\t}\n\tif route.Type == l3.Route_INTER_VRF && route.ViaVrfId != 0 {\n\t\tdependencies = append(dependencies, kvs.Dependency{\n\t\t\tLabel: viaVrfTableDep,\n\t\t\tKey: l3.VrfTableKey(route.ViaVrfId, protocol),\n\t\t})\n\t}\n\n\t// if destination network is netalloc reference, then the address must be allocated first\n\tallocDep, hasAllocDep := d.addrAlloc.GetAddressAllocDep(route.DstNetwork,\n\t\t\"\", \"dst_network-\")\n\tif hasAllocDep {\n\t\tdependencies = append(dependencies, allocDep)\n\t}\n\t// if GW is netalloc reference, then the address must be allocated first\n\tallocDep, hasAllocDep = d.addrAlloc.GetAddressAllocDep(route.NextHopAddr,\n\t\troute.OutgoingInterface, \"gw_addr-\")\n\tif hasAllocDep {\n\t\tdependencies = append(dependencies, allocDep)\n\t}\n\n\t// TODO: perhaps check GW routability\n\treturn dependencies\n}", "func(t *TargImp) isDependent(depend string) bool {\n\tfor _, y := range t.dependencies {\n\t\tif y == depend { return true }\n\t}\n\treturn false\n}", "func (s *memoryStorage) GetDependencies(srvFilter ...string) ([]tracer.Dependencies, error) {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\tif len(srvFilter) == 0 {\n\t\tsrvFilter = make([]string, 0)\n\t\tfor _, srvName := range s.services {\n\t\t\tsrvFilter = append(srvFilter, srvName)\n\t\t}\n\t}\n\n\t// Sort service names alphabetically\n\tsort.Strings(srvFilter)\n\n\treplyCount := len(srvFilter)\n\tserviceDeps := make([]tracer.Dependencies, replyCount)\n\tfor index, srvName := range srvFilter {\n\t\tdep, exists := s.serviceDeps[srvName]\n\t\tif !exists {\n\t\t\tdep = &tracer.Dependencies{\n\t\t\t\tService: srvName,\n\t\t\t\tDependencies: make([]string, 0),\n\t\t\t}\n\t\t}\n\t\tserviceDeps[index] = *dep\n\t}\n\n\treturn serviceDeps, nil\n\n}", "func (s *SimplePublishNode) SetDependency(d *int64) {\n\ts.dependency = d\n}", "func (g DotGraph) GetDependencies(pkg string) []string {\n\tdependencies := []string{}\n\n\tfor from, deps := range g.edges {\n\t\tif from == getIDSafeNodeName(pkg) {\n\t\t\tfor _, edge := range deps {\n\t\t\t\tdependencies = append(dependencies, edge.nodeID)\n\t\t\t}\n\t\t}\n\t}\n\treturn dependencies\n}", "func ExpectDependency(logger *logrusx.Logger, dependencies ...interface{}) {\n\tif logger == nil {\n\t\tpanic(\"missing logger for dependency check\")\n\t}\n\tfor _, d := range dependencies {\n\t\tif d == nil {\n\t\t\tlogger.WithError(errors.WithStack(ErrNilDependency)).Fatalf(\"A fatal issue occurred.\")\n\t\t}\n\t}\n}", "func guessDeps(base string, skipImport bool) *cfg.Config {\n\tbuildContext, err := util.GetBuildContext()\n\tif err != nil {\n\t\tmsg.Die(\"Failed to build an import context: %s\", err)\n\t}\n\tname := buildContext.PackageName(base)\n\n\n\tmsg.Info(\"Generating a YAML configuration file and guessing the dependencies\")\n\n\tconfig := new(cfg.Config)\n\n\t// Get the name of the top level package\n\tconfig.Name = name\n\n\t// Import by looking at other package managers and looking over the\n\t// entire directory structure.\n\n\t// Attempt to import from other package managers.\n\tif !skipImport {\n\t\tguessImportDeps(base, config)\n\t}\n\n\timportLen := len(config.Imports)\n\tif importLen == 0 {\n\t\tmsg.Info(\"Scanning code to look for dependencies\")\n\t} else {\n\t\tmsg.Info(\"Scanning code to look for dependencies not found in import\")\n\t}\n\n\t// 返回依赖解析器\n\tr, err := dependency.NewResolver(base)\n\n\n\tif err != nil {\n\t\tmsg.Die(\"Error creating a dependency resolver: %s\", err)\n\t}\n\n\t// 初始化以测试模式\n\tr.ResolveTest = true\n\n\th := &dependency.DefaultMissingPackageHandler{Missing: []string{}, Gopath: []string{}}\n\tr.Handler = h\n\n\tsortable, testSortable, err := r.ResolveLocal(false)\n\tif err != nil {\n\t\tmsg.Die(\"分析本地依赖失败: %s\", err)\n\t}\n\n\tsort.Strings(sortable)\n\tsort.Strings(testSortable)\n\n\tvpath := r.VendorDir\n\tif !strings.HasSuffix(vpath, \"/\") {\n\t\tvpath = vpath + string(os.PathSeparator)\n\t}\n\n\tfor _, pa := range sortable {\n\t\tn := strings.TrimPrefix(pa, vpath)\n\t\troot, subpkg := util.NormalizeName(n)\n\n\t\tif !config.Imports.Has(root) && root != config.Name {\n\t\t\tmsg.Info(\"--> Found reference to %s\\n\", n)\n\t\t\td := &cfg.Dependency{\n\t\t\t\tName: root,\n\t\t\t}\n\t\t\tif len(subpkg) > 0 {\n\t\t\t\td.Subpackages = []string{subpkg}\n\t\t\t}\n\t\t\tconfig.Imports = append(config.Imports, d)\n\t\t} else if config.Imports.Has(root) {\n\t\t\tif len(subpkg) > 0 {\n\t\t\t\tsubpkg = strings.TrimPrefix(subpkg, \"/\")\n\t\t\t\td := config.Imports.Get(root)\n\t\t\t\tif !d.HasSubpackage(subpkg) {\n\t\t\t\t\tmsg.Info(\"--> Adding sub-package %s to %s\\n\", subpkg, root)\n\t\t\t\t\td.Subpackages = append(d.Subpackages, subpkg)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, pa := range testSortable {\n\t\tn := strings.TrimPrefix(pa, vpath)\n\t\troot, subpkg := util.NormalizeName(n)\n\n\t\tif config.Imports.Has(root) && root != config.Name {\n\t\t\tmsg.Debug(\"--> Found test reference to %s already listed as an import\", n)\n\t\t} else if !config.DevImports.Has(root) && root != config.Name {\n\t\t\tmsg.Info(\"--> Found test reference to %s\", n)\n\t\t\td := &cfg.Dependency{\n\t\t\t\tName: root,\n\t\t\t}\n\t\t\tif len(subpkg) > 0 {\n\t\t\t\td.Subpackages = []string{subpkg}\n\t\t\t}\n\t\t\tconfig.DevImports = append(config.DevImports, d)\n\t\t} else if config.DevImports.Has(root) {\n\t\t\tif len(subpkg) > 0 {\n\t\t\t\tsubpkg = strings.TrimPrefix(subpkg, \"/\")\n\t\t\t\td := config.DevImports.Get(root)\n\t\t\t\tif !d.HasSubpackage(subpkg) {\n\t\t\t\t\tmsg.Info(\"--> Adding test sub-package %s to %s\\n\", subpkg, root)\n\t\t\t\t\td.Subpackages = append(d.Subpackages, subpkg)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(config.Imports) == importLen && importLen != 0 {\n\t\tmsg.Info(\"--> Code scanning found no additional imports\")\n\t}\n\n\treturn config\n}", "func (t *tectonic) Dependencies() []asset.Asset {\n\treturn []asset.Asset{\n\t\tt.installConfig,\n\t\tt.ingressCertKey,\n\t\tt.kubeCA,\n\t}\n}", "func (p PHPEnvPHPinfoCLI) Dependencies() []string {\n\treturn []string{\"PHP/Config/Agent\"}\n}", "func (m *Master) Dependencies() []asset.Asset {\n\treturn []asset.Asset{\n\t\t&installconfig.InstallConfig{},\n\t\t&machine.Master{},\n\t}\n}", "func CheckDependencies() map[string]string {\n\tresult := make(map[string]string)\n\tfor _, dep := range getDependencies() {\n\t\tresult[dep.GetName()] = \"OK\"\n\t\tif isOK, err := dep.GetPinger()(); !isOK {\n\t\t\tresult[dep.GetName()] = err.Error()\n\t\t}\n\t}\n\tif len(result) == 0 {\n\t\t//no dependencies registered\n\t\tresult[\"NODEP\"] = \"No Dependencies Registered\"\n\t}\n\treturn result\n}", "func RegisterDependency(dep Dependency) {\n\tif dependencies == nil {\n\t\tdependencies = make(map[string]Dependency)\n\t}\n\tdependencies[dep.GetName()] = dep\n}", "func isVersionedDependency(content string) bool {\n\treturn !strings.HasPrefix(content, \"gopkg.in\")\n}", "func (task *Task) DependencyNames() []string {\n\tif len(task.dependencies) == 0 {\n\t\treturn nil\n\t}\n\tdeps := []string{}\n\tfor _, dep := range task.dependencies {\n\t\tswitch d := dep.(type) {\n\t\tdefault:\n\t\t\tpanic(\"dependencies can only be Serial or Parallel\")\n\t\tcase Series:\n\t\t\tdeps = append(deps, d.names()...)\n\t\tcase Parallel:\n\t\t\tdeps = append(deps, d.names()...)\n\t\tcase S:\n\t\t\tdeps = append(deps, Series(d).names()...)\n\t\tcase P:\n\t\t\tdeps = append(deps, Parallel(d).names()...)\n\t\t}\n\t}\n\treturn deps\n}", "func TestDeps(t *testing.T) {\n\tcmd := exec.Command(\"go\", \"list\", \"-deps\")\n\tout, err := cmd.Output()\n\tif err != nil {\n\t\tt.Skipf(\"'go list' failed: %s\", err)\n\t}\n\tfor _, pkg := range strings.Split(string(out), \"\\n\") {\n\t\t// Does pkg have form \"domain.name/dir\"?\n\t\tslash := strings.IndexByte(pkg, '/')\n\t\tdot := strings.IndexByte(pkg, '.')\n\t\tif 0 < dot && dot < slash {\n\t\t\tif strings.HasPrefix(pkg, \"go.starlark.net/\") ||\n\t\t\t\tstrings.HasPrefix(pkg, \"golang.org/x/sys/\") {\n\t\t\t\tcontinue // permitted dependencies\n\t\t\t}\n\t\t\tt.Errorf(\"new interpreter dependency: %s\", pkg)\n\t\t}\n\t}\n}", "func hasAngularDependency(r *build.Rule) bool {\n\te := r.Attr(\"deps\")\n\tfor _, li := range edit.AllLists(e) {\n\t\tfor _, elem := range li.List {\n\t\t\tstr, ok := elem.(*build.StringExpr)\n\t\t\tif ok && strings.HasPrefix(str.Value, \"//third_party/javascript/angular2\") {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "func (k *LoopbackClient) Dependencies() []asset.Asset {\n\treturn []asset.Asset{\n\t\t&tls.AdminKubeConfigClientCertKey{},\n\t\t&tls.KubeAPIServerLocalhostCABundle{},\n\t\t&installconfig.InstallConfig{},\n\t}\n}", "func getDependencies() error {\n\t// go get -u dependencies from the dependencies array\n\tfor _, dependency := range dependencies {\n\t\t// Exec go get command inside Name folder using exec.Command\n\t\tcmd := exec.Command(\"go\", \"get\", \"-u\", dependency)\n\t\tcmd.Dir = Name\n\n\t\tif err := cmd.Run(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (s *Service) DependenciesFromService() (d []*DependencyFromService) {\n\tfor name, dependency := range s.GetDependencies() {\n\t\td = append(d, &DependencyFromService{\n\t\t\tDependency: dependency,\n\t\t\tService: s,\n\t\t\tName: name,\n\t\t})\n\t}\n\treturn\n}", "func Parse(dir string) ([]*cfg.Dependency, error) {\n\tpath := filepath.Join(dir, \"Godeps/Godeps.json\")\n\tif _, err := os.Stat(path); err != nil {\n\t\treturn []*cfg.Dependency{}, nil\n\t}\n\tmsg.Info(\"Found Godeps.json file in %s\", gpath.StripBasepath(dir))\n\tmsg.Info(\"--> Parsing Godeps metadata...\")\n\n\tbuf := []*cfg.Dependency{}\n\n\tgodeps := &Godeps{}\n\n\t// Get a handle to the file.\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn buf, err\n\t}\n\tdefer file.Close()\n\n\tdec := json.NewDecoder(file)\n\tif err := dec.Decode(godeps); err != nil {\n\t\treturn buf, err\n\t}\n\n\tseen := map[string]bool{}\n\tfor _, d := range godeps.Deps {\n\t\tpkg, _ := util.NormalizeName(d.ImportPath)\n\t\tif !seen[pkg] {\n\t\t\tseen[pkg] = true\n\t\t\tdep := &cfg.Dependency{Name: pkg, Version: d.Rev}\n\t\t\tbuf = append(buf, dep)\n\t\t}\n\t}\n\n\treturn buf, nil\n}", "func (repo *GitHubProject) Dependencies() []Project {\n\treturn []Project{}\n}", "func (t *TerraformVariables) Dependencies() []asset.Asset {\n\treturn []asset.Asset{\n\t\t&installconfig.InstallConfig{},\n\t\t&bootstrap.Bootstrap{},\n\t\t&machine.Master{},\n\t}\n}", "func require(required []string, parser lineParser) lineParser {\n\tf := func(ctx *parseContext, cmd string, args []string) (node, error) {\n\t\tn, err := parser(ctx, cmd, args)\n\t\tif err == nil {\n\t\t\trequiredMap := make(map[string]bool)\n\t\t\tfor _, r := range required {\n\t\t\t\trequiredMap[r] = false //hasn't been found yet\n\t\t\t}\n\n\t\t\tfor _, previousNode := range ctx.nodes {\n\t\t\t\tif _, found := requiredMap[previousNode.cmd]; found {\n\t\t\t\t\trequiredMap[previousNode.cmd] = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor key, found := range requiredMap {\n\t\t\t\tif !found {\n\t\t\t\t\tctx.addErrorf(\"line %d: %s depends on %s\", ctx.lineNum, cmd, key)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn n, err\n\t}\n\treturn f\n}", "func FromDomainDependencies(dLinks []model.DependencyLink) []DependencyLink {\n\tif dLinks == nil {\n\t\treturn nil\n\t}\n\tret := make([]DependencyLink, len(dLinks))\n\tfor i, d := range dLinks {\n\t\tret[i] = DependencyLink{\n\t\t\tCallCount: d.CallCount,\n\t\t\tParent: d.Parent,\n\t\t\tChild: d.Child,\n\t\t}\n\t}\n\treturn ret\n}", "func MatchDependencies(ch chan SourceDependenciesItem) chan SourceDependenciesItem {\n\tout := make(chan SourceDependenciesItem, cli.ChannelBufferSize)\n\tgo func() {\n\t\tdefer close(out)\n\n\t\tfor item := range ch {\n\t\t\tvar matchedDeps []string\n\t\t\tfor _, dep := range item.Dependencies {\n\t\t\t\tmatched, err := regexp.MatchString(cli.FindExp, dep)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfatalError(err)\n\t\t\t\t}\n\t\t\t\tif matched {\n\t\t\t\t\tmatchedDeps = append(matchedDeps, dep)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif matchedDeps != nil {\n\t\t\t\tout <- SourceDependenciesItem{item.FilePath, matchedDeps}\n\t\t\t}\n\t\t}\n\t}()\n\treturn out\n}", "func dependenciesCanBeResolved(target *api.Container, by []*api.Container) bool {\n\tnameMap := make(map[string]*api.Container)\n\tfor _, cont := range by {\n\t\tnameMap[cont.Name] = cont\n\t}\n\tneededVolumeContainers := make([]string, len(target.VolumesFrom))\n\tfor i, volume := range target.VolumesFrom {\n\t\tneededVolumeContainers[i] = volume.SourceContainer\n\t}\n\n\treturn verifyStatusResolveable(target, nameMap, neededVolumeContainers, volumeCanResolve) &&\n\t\tverifyStatusResolveable(target, nameMap, linksToContainerNames(target.Links), linkCanResolve)\n}", "func (g *Generator) AddDependency(n, t, f string) *Generator {\n\tg.deps = append(g.deps, dep{n, t, f})\n\treturn g\n}", "func (l *PackageList) VerifyDependencies(options int, architectures []string, sources *PackageList, progress aptly.Progress) ([]Dependency, error) {\n\tl.PrepareIndex()\n\tmissing := make([]Dependency, 0, 128)\n\n\tif progress != nil {\n\t\tprogress.InitBar(int64(l.Len())*int64(len(architectures)), false, aptly.BarGeneralVerifyDependencies)\n\t}\n\n\tfor _, arch := range architectures {\n\t\tcache := make(map[string]bool, 2048)\n\n\t\tfor _, p := range l.packagesIndex {\n\t\t\tif progress != nil {\n\t\t\t\tprogress.AddBar(1)\n\t\t\t}\n\n\t\t\tif !p.MatchesArchitecture(arch) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor _, dep := range p.GetDependencies(options) {\n\t\t\t\tvariants, err := ParseDependencyVariants(dep)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unable to process package %s: %s\", p, err)\n\t\t\t\t}\n\n\t\t\t\tvariants = depSliceDeduplicate(variants)\n\n\t\t\t\tvariantsMissing := make([]Dependency, 0, len(variants))\n\n\t\t\t\tfor _, dep := range variants {\n\t\t\t\t\tif dep.Architecture == \"\" {\n\t\t\t\t\t\tdep.Architecture = arch\n\t\t\t\t\t}\n\n\t\t\t\t\thash := dep.Hash()\n\t\t\t\t\tsatisfied, ok := cache[hash]\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\tsatisfied = sources.Search(dep, false) != nil\n\t\t\t\t\t\tcache[hash] = satisfied\n\t\t\t\t\t}\n\n\t\t\t\t\tif !satisfied && !ok {\n\t\t\t\t\t\tvariantsMissing = append(variantsMissing, dep)\n\t\t\t\t\t}\n\n\t\t\t\t\tif satisfied && options&DepFollowAllVariants == 0 {\n\t\t\t\t\t\tvariantsMissing = nil\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tmissing = append(missing, variantsMissing...)\n\t\t\t}\n\t\t}\n\t}\n\n\tif progress != nil {\n\t\tprogress.ShutdownBar()\n\t}\n\n\tif options&DepVerboseResolve == DepVerboseResolve && progress != nil {\n\t\tmissingStr := make([]string, len(missing))\n\t\tfor i := range missing {\n\t\t\tmissingStr[i] = missing[i].String()\n\t\t}\n\t\tprogress.ColoredPrintf(\"@{y}Missing dependencies:@| %s\", strings.Join(missingStr, \", \"))\n\t}\n\n\treturn missing, nil\n}", "func (s *Scheduler) checkCircularDep(j *gaia.Job, resolved []*gaia.Job, unresolved []*gaia.Job) ([]*gaia.Job, error) {\n\tunresolved = append(unresolved, j)\n\nDependsonLoop:\n\tfor _, job := range j.DependsOn {\n\t\t// Check if job is already in resolved list\n\t\tfor _, resolvedJob := range resolved {\n\t\t\tif resolvedJob.ID == job.ID {\n\t\t\t\tcontinue DependsonLoop\n\t\t\t}\n\t\t}\n\n\t\t// Check if job is already in unresolved list\n\t\tfor _, unresolvedJob := range unresolved {\n\t\t\tif unresolvedJob.ID == job.ID {\n\t\t\t\t// Circular dependency detected\n\t\t\t\t// Return the conflicting dependencies\n\t\t\t\treturn nil, fmt.Errorf(errCircularDep, unresolvedJob.Title, j.Title)\n\t\t\t}\n\t\t}\n\n\t\t// Resolve job\n\t\tvar err error\n\t\tresolved, err = s.checkCircularDep(job, resolved, unresolved)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn append(resolved, j), nil\n}", "func GuessDeps(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt) {\n\tbuildContext, err := util.GetBuildContext()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := p.Get(\"dirname\", \".\").(string)\n\tskipImport := p.Get(\"skipImport\", false).(bool)\n\tname := guessPackageName(buildContext, base)\n\n\tInfo(\"Generating a YAML configuration file and guessing the dependencies\")\n\n\tconfig := new(cfg.Config)\n\n\t// Get the name of the top level package\n\tconfig.Name = name\n\n\t// Import by looking at other package managers and looking over the\n\t// entire directory structure.\n\n\t// Attempt to import from other package managers.\n\tif !skipImport {\n\t\tInfo(\"Attempting to import from other package managers (use --skip-import to skip)\")\n\t\tdeps := []*cfg.Dependency{}\n\t\tabsBase, err := filepath.Abs(base)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif d, ok := guessImportGodep(absBase); ok {\n\t\t\tInfo(\"Importing Godep configuration\")\n\t\t\tWarn(\"Godep uses commit id versions. Consider using Semantic Versions with Glide\")\n\t\t\tdeps = d\n\t\t} else if d, ok := guessImportGPM(absBase); ok {\n\t\t\tInfo(\"Importing GPM configuration\")\n\t\t\tdeps = d\n\t\t} else if d, ok := guessImportGB(absBase); ok {\n\t\t\tInfo(\"Importing GB configuration\")\n\t\t\tdeps = d\n\t\t}\n\n\t\tfor _, i := range deps {\n\t\t\tInfo(\"Found imported reference to %s\\n\", i.Name)\n\t\t\tconfig.Imports = append(config.Imports, i)\n\t\t}\n\t}\n\n\t// Resolve dependencies by looking at the tree.\n\tr, err := dependency.NewResolver(base)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\th := &dependency.DefaultMissingPackageHandler{Missing: []string{}, Gopath: []string{}}\n\tr.Handler = h\n\n\tsortable, err := r.ResolveLocal(false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsort.Strings(sortable)\n\n\tvpath := r.VendorDir\n\tif !strings.HasSuffix(vpath, \"/\") {\n\t\tvpath = vpath + string(os.PathSeparator)\n\t}\n\n\tfor _, pa := range sortable {\n\t\tn := strings.TrimPrefix(pa, vpath)\n\t\troot := util.GetRootFromPackage(n)\n\n\t\tif !config.HasDependency(root) {\n\t\t\tInfo(\"Found reference to %s\\n\", n)\n\t\t\td := &cfg.Dependency{\n\t\t\t\tName: root,\n\t\t\t}\n\t\t\tsubpkg := strings.TrimPrefix(n, root)\n\t\t\tif len(subpkg) > 0 && subpkg != \"/\" {\n\t\t\t\td.Subpackages = []string{subpkg}\n\t\t\t}\n\t\t\tconfig.Imports = append(config.Imports, d)\n\t\t} else {\n\t\t\tsubpkg := strings.TrimPrefix(n, root)\n\t\t\tif len(subpkg) > 0 && subpkg != \"/\" {\n\t\t\t\tsubpkg = strings.TrimPrefix(subpkg, \"/\")\n\t\t\t\td := config.Imports.Get(root)\n\t\t\t\tf := false\n\t\t\t\tfor _, v := range d.Subpackages {\n\t\t\t\t\tif v == subpkg {\n\t\t\t\t\t\tf = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !f {\n\t\t\t\t\tInfo(\"Adding sub-package %s to %s\\n\", subpkg, root)\n\t\t\t\t\td.Subpackages = append(d.Subpackages, subpkg)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn config, nil\n}", "func sortDependencies(ctx context.Context, ranker DepsRanker, missingRuleDeps map[*bazel.Rule]map[ClassName][]bazel.Label) {\n\tstopwatch := time.Now()\n\tfor _, classToLabels := range missingRuleDeps {\n\t\tfor _, labels := range classToLabels {\n\t\t\tsort.Slice(labels, func(i, j int) bool { return ranker.Less(ctx, labels[i], labels[j]) })\n\t\t}\n\t}\n\tlog.Printf(\"Ranking dependencies (%dms)\", int64(time.Now().Sub(stopwatch)/time.Millisecond))\n}", "func findDependencies(st *vmdat.State, files []*jclass.File) []string {\n\tvar nonLoaded []string\n\tfor _, f := range files {\n\t\tdeps := jdeps.ClassDependencies(f)\n\t\tfor _, d := range deps {\n\t\t\tif st.FindPackage(d) == nil {\n\t\t\t\tnonLoaded = append(nonLoaded, d)\n\t\t\t}\n\t\t}\n\t}\n\treturn nonLoaded\n}", "func validateCircularDepends(cfg *Config) error {\n\tfor _, cmdA := range cfg.Commands {\n\t\tfor _, cmdB := range cfg.Commands {\n\t\t\tif cmdA.Name == cmdB.Name {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif yes := depsIntersect(cmdA, cmdB); yes {\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"command '%s' have circular depends on command '%s'\",\n\t\t\t\t\tfmt.Sprintf(NoticeColor, cmdA.Name),\n\t\t\t\t\tfmt.Sprintf(NoticeColor, cmdB.Name),\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func importDependencies(project common.AppProject) error {\n\n\tai, err := util.GetAppImports(filepath.Join(project.Dir(), fileFlogoJson), project.DepManager(), true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\timports := ai.GetAllImports()\n\n\tif len(imports) == 0 {\n\t\treturn nil\n\t}\n\n\terr = project.AddImports(true, false, imports...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlegacySupportRequired := false\n\n\tfor _, details := range ai.GetAllImportDetails() {\n\n\t\tpath, err := project.GetPath(details.Imp)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdesc, err := util.GetContribDescriptor(path)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif desc != nil {\n\n\t\t\tcType := desc.GetContribType()\n\t\t\tif desc.IsLegacy {\n\t\t\t\tlegacySupportRequired = true\n\t\t\t\tcType = \"legacy \" + desc.GetContribType()\n\t\t\t\terr := CreateLegacyMetadata(path, desc.GetContribType(), details.Imp.GoImportPath())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfmt.Printf(\"Installed %s: %s\\n\", cType, details.Imp)\n\t\t\t//instStr := fmt.Sprintf(\"Installed %s:\", cType)\n\t\t\t//fmt.Printf(\"%-20s %s\\n\", instStr, imp)\n\t\t}\n\t}\n\t\n\tif Verbose() {\n\t\tfmt.Printf(\"Tidying go mod...\")\n\t}\n\t\n\terr = util.ExecCmd(exec.Command(\"go\", \"mod\", \"tidy\"), project.SrcDir())\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to clean deps: %s\\n\", err)\n\t}\n\n\tif legacySupportRequired {\n\t\terr := InstallLegacySupport(project)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (*LogzioSpanReader) GetDependencies(ctx context.Context, endTs time.Time, lookback time.Duration) ([]model.DependencyLink, error) {\n\treturn nil, nil\n}", "func validateCircularDepends(cfg *Config) error {\n\tfor _, cmdA := range cfg.Commands {\n\t\tfor _, cmdB := range cfg.Commands {\n\t\t\tif cmdA.Name == cmdB.Name {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif yes := depsIntersect(cmdA, cmdB); yes {\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"command '%s' have circular depends on command '%s'\",\n\t\t\t\t\twithColor(cmdA.Name),\n\t\t\t\t\twithColor(cmdB.Name),\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}" ]
[ "0.65340716", "0.61912113", "0.61908144", "0.60914624", "0.60624367", "0.60466945", "0.6029449", "0.60245776", "0.5904961", "0.58684546", "0.58485883", "0.5831142", "0.5789253", "0.5765972", "0.5744005", "0.5741016", "0.56804025", "0.5667477", "0.5642951", "0.5637858", "0.5626136", "0.5625061", "0.56241703", "0.56202644", "0.56059206", "0.5571854", "0.5559167", "0.555226", "0.55477995", "0.5544807", "0.55356526", "0.55340344", "0.5530089", "0.55159885", "0.5465682", "0.54565597", "0.545447", "0.54446787", "0.54403365", "0.54344386", "0.54285955", "0.54186845", "0.5402228", "0.53955287", "0.5385074", "0.5378247", "0.5376015", "0.53737694", "0.53611827", "0.5360911", "0.5350481", "0.5345349", "0.53378", "0.53316724", "0.5310237", "0.53084964", "0.5296192", "0.52884686", "0.52852", "0.5267407", "0.5252849", "0.5187915", "0.51861227", "0.51817226", "0.51783514", "0.5177082", "0.51651573", "0.5148837", "0.5133664", "0.51167923", "0.51036984", "0.50958997", "0.50920105", "0.5077754", "0.5077672", "0.50647575", "0.50504667", "0.50468063", "0.50412387", "0.5035309", "0.5017924", "0.49824458", "0.49794394", "0.49748102", "0.497364", "0.49593657", "0.49505726", "0.49407923", "0.49349007", "0.49280962", "0.49027222", "0.48963404", "0.48916262", "0.48907965", "0.48847172", "0.48752975", "0.48640066", "0.48564082", "0.48555034", "0.4853564" ]
0.70350784
0
parseIncludes .. Parses dependencies to create an include string for each.
parseIncludes .. Парсит зависимости для создания строки include для каждой.
func (i *Interface) parseIncludes() { for _, dependency := range i.Dependencies { include := NewInclude(dependency) if parsers.ShouldBeIncludedInHeader(dependency) { i.HeaderIncludesString += include.ToString() + "\n" } else { i.ImplementationIncludesString += include.ToString() + "\n" } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func processIncludes(source string) string {\n\tlines := strings.Split(source, \"\\n\")\n\tvar result []string\n\tfor _, line := range lines {\n\t\ttrimmed := strings.TrimSpace(line)\n\t\tif url := parseIncludeURL(trimmed); url != \"\" {\n\t\t\tif buf, err := curl(url); err == nil {\n\t\t\t\tresult = append(result, string(buf))\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tresult = append(result, line)\n\t}\n\n\treturn strings.Join(result, \"\\n\")\n}", "func parseInclude(node *node32) string {\n\tstrNode := nextNode(node, ruleSTRLITER)\n\tfile := nextNode(strNode.up, ruleSTR).match\n\n\treturn file\n}", "func (ctx *context) hoistIncludes(result []byte) []byte {\n\tincludesStart := bytes.Index(result, []byte(\"#include\"))\n\tif includesStart == -1 {\n\t\treturn result\n\t}\n\tincludes := make(map[string]bool)\n\tincludeRe := regexp.MustCompile(\"#include <.*>\\n\")\n\tfor _, match := range includeRe.FindAll(result, -1) {\n\t\tincludes[string(match)] = true\n\t}\n\tresult = includeRe.ReplaceAll(result, nil)\n\t// Certain linux and bsd headers are broken and go to the bottom.\n\tvar sorted, sortedBottom, sortedTop []string\n\tfor include := range includes {\n\t\tif strings.Contains(include, \"<linux/\") {\n\t\t\tsortedBottom = append(sortedBottom, include)\n\t\t} else if strings.Contains(include, \"<netinet/if_ether.h>\") {\n\t\t\tsortedBottom = append(sortedBottom, include)\n\t\t} else if strings.Contains(include, \"<keyutils.h>\") {\n\t\t\tsortedBottom = append(sortedBottom, include)\n\t\t} else if ctx.target.OS == freebsd && strings.Contains(include, \"<sys/types.h>\") {\n\t\t\tsortedTop = append(sortedTop, include)\n\t\t} else {\n\t\t\tsorted = append(sorted, include)\n\t\t}\n\t}\n\tsort.Strings(sortedTop)\n\tsort.Strings(sorted)\n\tsort.Strings(sortedBottom)\n\tnewResult := append([]byte{}, result[:includesStart]...)\n\tnewResult = append(newResult, strings.Join(sortedTop, \"\")...)\n\tnewResult = append(newResult, '\\n')\n\tnewResult = append(newResult, strings.Join(sorted, \"\")...)\n\tnewResult = append(newResult, '\\n')\n\tnewResult = append(newResult, strings.Join(sortedBottom, \"\")...)\n\tnewResult = append(newResult, result[includesStart:]...)\n\treturn newResult\n}", "func lexInclude(lx *lexer) stateFn {\r\n\tr := lx.next()\r\n\tswitch {\r\n\tcase r == sqStringStart:\r\n\t\tlx.ignore() // ignore the \" or '\r\n\t\treturn lexIncludeQuotedString\r\n\tcase r == dqStringStart:\r\n\t\tlx.ignore() // ignore the \" or '\r\n\t\treturn lexIncludeDubQuotedString\r\n\tcase r == arrayStart:\r\n\t\treturn lx.errorf(\"Expected include value but found start of an array\")\r\n\tcase r == mapStart:\r\n\t\treturn lx.errorf(\"Expected include value but found start of a map\")\r\n\tcase r == blockStart:\r\n\t\treturn lx.errorf(\"Expected include value but found start of a block\")\r\n\tcase unicode.IsDigit(r), r == '-':\r\n\t\treturn lx.errorf(\"Expected include value but found start of a number\")\r\n\tcase r == '\\\\':\r\n\t\treturn lx.errorf(\"Expected include value but found escape sequence\")\r\n\tcase isNL(r):\r\n\t\treturn lx.errorf(\"Expected include value but found new line\")\r\n\t}\r\n\tlx.backup()\r\n\treturn lexIncludeString\r\n}", "func (i *Interface) parseForwardDeclares() {\n\tfor _, dependency := range i.Dependencies {\n\t\tif !parsers.ShouldBeIncludedInHeader(dependency) {\n\t\t\ti.ForwardDeclaresString += \"class \" + dependency + \";\\n\"\n\t\t} \n\t}\n}", "func (c *Converter) convertInclude(include *nast.IncludeDirective) error {\n\n\tc.includecount++\n\tif c.includecount > 20 {\n\t\treturn &parser.Error{\n\t\t\tMessage: \"Error when processing includes: Include-loop detected\",\n\t\t\tStartPosition: ast.NewPosition(\"\", 1, 1),\n\t\t\tEndPosition: ast.NewPosition(\"\", 20, 70),\n\t\t}\n\t}\n\n\tfilesnames := make([]string, 1)\n\tfilesnames[0] = include.File\n\n\tfile, err := c.getIncludedFile(include)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp := NewParser().(*Parser)\n\tp.SetFilename(include.File)\n\tparsed, err := p.Parse(file)\n\tif err != nil {\n\t\t// override the position of the error with the position of the include\n\t\t// this way the error gets displayed at the correct location\n\t\t// the message does contain the original location\n\t\treturn &parser.Error{\n\t\t\tMessage: err.Error(),\n\t\t\tStartPosition: include.Start(),\n\t\t\tEndPosition: include.End(),\n\t\t}\n\t}\n\n\tif usesTimeTracking(parsed) {\n\t\tc.usesTimeTracking = true\n\t}\n\n\treplacements := make([]ast.Node, len(parsed.Elements))\n\tfor i := range parsed.Elements {\n\t\treplacements[i] = parsed.Elements[i]\n\t}\n\treturn ast.NewNodeReplacement(replacements...)\n}", "func (s *Service) ReferencedIncludes() ([]*Include, error) {\n\tvar err error\n\tincludes := []*Include{}\n\tincludesSet := make(map[string]*Include)\n\n\t// Check extended service.\n\tif s.Extends != \"\" && strings.Contains(s.Extends, \".\") {\n\t\tincludeName := s.Extends[0:strings.Index(s.Extends, \".\")]\n\t\tinclude := s.Frugal.Include(includeName)\n\t\tif include == nil {\n\t\t\treturn nil, fmt.Errorf(\"Service %s extends references invalid include %s\",\n\t\t\t\ts.Name, s.Extends)\n\t\t}\n\t\tif _, ok := includesSet[includeName]; !ok {\n\t\t\tincludesSet[includeName] = include\n\t\t\tincludes = append(includes, include)\n\t\t}\n\t}\n\n\t// Check methods.\n\tfor _, method := range s.Methods {\n\t\t// Check arguments.\n\t\tfor _, arg := range method.Arguments {\n\t\t\tincludesSet, includes, err = addInclude(includesSet, includes, arg.Type, s.Frugal)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\t// Check return type.\n\t\tif method.ReturnType != nil {\n\t\t\tincludesSet, includes, err = addInclude(includesSet, includes, method.ReturnType, s.Frugal)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Check exceptions.\n\t\tfor _, exception := range method.Exceptions {\n\t\t\tincludesSet, includes, err = addInclude(includesSet, includes, exception.Type, s.Frugal)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn includes, nil\n}", "func (f *Frugal) OrderedIncludes() []*Frugal {\n\tkeys := make([]string, 0, len(f.ParsedIncludes))\n\tfor key := range f.ParsedIncludes {\n\t\tkeys = append(keys, key)\n\t}\n\tsort.Strings(keys)\n\n\tincludes := make([]*Frugal, 0, len(f.ParsedIncludes))\n\tfor _, key := range keys {\n\t\tincludes = append(includes, f.ParsedIncludes[key])\n\t}\n\treturn includes\n}", "func (i *Interface) parseDependencies() {\n\tvar dependencies []string\n\tfor _, function := range i.Functions {\n\n\t\t// \"expanded\" refers to creating a parsers.from a templated type, i.e \"QMap <int, QString>\" becomes [QMap int QString]\n\t\texpandedReturnType := strings.FieldsFunc(function.ReturnType, templatedTypeSeparators) \n\t\tfor _, dataType := range(expandedReturnType) {\n\t\t\tdependencies = append(dependencies, strings.TrimSpace(dataType))\n\t\t}\n\n\t\tfor _, parameter := range function.Parameters {\n\t\t\texpandedParameter := strings.FieldsFunc(parameter.Type, templatedTypeSeparators)\n\t\t\tfor _, innerParameter := range expandedParameter {\n\t\t\t\tdependencies = append(dependencies, strings.TrimSpace(innerParameter))\n\t\t\t} \n\t\t}\n\t}\n\ti.Dependencies = dependencies\n\ti.Dependencies = parsers.RemoveConstSpecifiers(i.Dependencies)\n\ti.Dependencies = parsers.RemovePointersAndReferences(i.Dependencies)\n\ti.Dependencies = parsers.RemoveStdDataTypes(i.Dependencies)\n\ti.Dependencies = parsers.MapDataTypesToLibraryDependencies(i.Dependencies)\n\ti.Dependencies = parsers.RemoveDuplicates(i.Dependencies)\n\tsort.Strings(i.Dependencies)\n}", "func lexIncludeString(lx *lexer) stateFn {\r\n\tr := lx.next()\r\n\tswitch {\r\n\tcase isNL(r) || r == eof || r == optValTerm || r == mapEnd || isWhitespace(r):\r\n\t\tlx.backup()\r\n\t\tlx.emit(itemInclude)\r\n\t\treturn lx.pop()\r\n\tcase r == sqStringEnd:\r\n\t\tlx.backup()\r\n\t\tlx.emit(itemInclude)\r\n\t\tlx.next()\r\n\t\tlx.ignore()\r\n\t\treturn lx.pop()\r\n\t}\r\n\treturn lexIncludeString\r\n}", "func addInclude(includesSet map[string]*Include, includes []*Include, t *Type, frugal *Frugal) (map[string]*Include, []*Include, error) {\n\tvar err error\n\tif strings.Contains(t.Name, \".\") {\n\t\tincludeName := t.Name[0:strings.Index(t.Name, \".\")]\n\t\tinclude := frugal.Include(includeName)\n\t\tif include == nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"Type %s references invalid include %s\", t.Name, include.Name)\n\t\t}\n\t\tif _, ok := includesSet[includeName]; !ok {\n\t\t\tincludesSet[includeName] = include\n\t\t\tincludes = append(includes, include)\n\t\t}\n\t}\n\t// Check container types.\n\tif t.KeyType != nil {\n\t\tincludesSet, includes, err = addInclude(includesSet, includes, t.KeyType, frugal)\n\t}\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif t.ValueType != nil {\n\t\tincludesSet, includes, err = addInclude(includesSet, includes, t.ValueType, frugal)\n\t}\n\treturn includesSet, includes, err\n}", "func appendIncludedFiles(ast *AST, ifm *IncludeFiles) {\n\tfor _, include := range ast.includes {\n\t\tabsoluteFile := fmt.Sprintf(\"%v/%v\", ifm.dir,\n\t\t\tinclude)\n\n\t\t_, included := ifm.files[absoluteFile]\n\t\tif included {\n\t\t\tcontinue\n\t\t}\n\n\t\tifm.Include(absoluteFile)\n\n\t\twaccIncl := parseInput(absoluteFile)\n\t\tastIncl := generateASTFromWACC(waccIncl, ifm)\n\n\t\tast.enums = append(ast.enums,\n\t\t\tastIncl.enums...)\n\n\t\tast.classes = append(ast.classes,\n\t\t\tastIncl.classes...)\n\n\t\tast.functions = append(ast.functions,\n\t\t\tastIncl.functions...)\n\t}\n}", "func (m *Filters) Includes() []string {\n\tinc := make([]string, 0)\n\tfor _, f := range m.Filters {\n\t\tfinc := f.Includes()\n\t\tif len(finc) > 0 {\n\t\t\tinc = append(inc, finc...)\n\t\t}\n\t}\n\treturn inc\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func getIncludeList(inputFiles, clangFlags []string, flag []string, cppCode bool) (\n\t_ string, err error) {\n\tdefer func() {\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"cannot get Include List : %v\", err)\n\t\t}\n\t}()\n\tvar out bytes.Buffer\n\tvar stderr bytes.Buffer\n\tvar args []string\n\tfor i := range inputFiles {\n\t\tinputFiles[i], err = filepath.Abs(inputFiles[i])\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\targs = append(args, flag...)\n\targs = append(args, \"-c\")\n\targs = append(args, inputFiles...)\n\targs = append(args, clangFlags...)\n\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tfmt.Errorf(\"used next arguments: `%v`. %v\", args, err)\n\t\t}\n\t}()\n\n\tvar cmd *exec.Cmd\n\tcompiler, compilerFlag := Compiler(cppCode)\n\targs = append(compilerFlag, args...)\n\tcmd = exec.Command(compiler, args...)\n\n\tcmd.Stdout = &out\n\tcmd.Stderr = &stderr\n\terr = cmd.Run()\n\tif err != nil {\n\t\terr = fmt.Errorf(\"preprocess failed: %v\\nStdErr = %v\", err, stderr.String())\n\t\treturn\n\t}\n\n\t// add stderr to out, for flags \"-MM -H\"\n\tout.WriteString(stderr.String())\n\n\t// remove warnings\n\t// ... /usr/lib/llvm-4.0/bin/../lib/clang/4.0.1/include/stddef.h\n\t// .. /usr/include/x86_64-linux-gnu/bits/stdlib-float.h\n\t// /home/konstantin/go/src/github.com/Konstantin8105/c4go/testdata/kilo/debug.kilo.c:81:9: warning: '_BSD_SOURCE' macro redefined [-Wmacro-redefined]\n\t// #define _BSD_SOURCE\n\t// ^\n\t// /usr/include/features.h:188:10: note: previous definition is here\n\t// # define _BSD_SOURCE 1\n\t// ^\n\tlines := strings.Split(out.String(), \"\\n\")\n\tfor i := range lines {\n\t\tif strings.Contains(lines[i], \"warning:\") {\n\t\t\tlines = lines[:i]\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn strings.Join(lines, \"\\n\"), err\n}", "func GetIeraphyIncludeList(inputFiles, clangFlags []string, cppCode bool) (\n\tlines []string, err error) {\n\tvar out string\n\tout, err = getIncludeList(inputFiles, clangFlags, []string{\"-MM\", \"-H\"}, cppCode)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn strings.Split(out, \"\\n\"), nil\n}", "func (o WebAclRuleStatementOrStatementStatementAndStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementOrStatementStatementAndStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o RuleMfaOutput) NetworkIncludes() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *RuleMfa) pulumi.StringArrayOutput { return v.NetworkIncludes }).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (c *condition) includes(v string) bool {\n\tfor _, pattern := range c.Include {\n\t\tif ok, _ := filepath.Match(pattern, v); ok {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (o WebAclRuleStatementOrStatementStatementAndStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementOrStatementStatementAndStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (self dependencies) includes(definition string) bool {\n for _, dependency := range self {\n if dependency == definition {\n return true\n }\n }\n\n return false\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementOrStatementStatementAndStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementOrStatementStatementAndStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func lexIncludeStart(lx *lexer) stateFn {\r\n\tr := lx.next()\r\n\tif isWhitespace(r) {\r\n\t\treturn lexSkip(lx, lexIncludeStart)\r\n\t}\r\n\tlx.backup()\r\n\treturn lexInclude\r\n}", "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementNotStatementStatementSqliMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementSqliMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func lexIncludeQuotedString(lx *lexer) stateFn {\r\n\tr := lx.next()\r\n\tswitch {\r\n\tcase r == sqStringEnd:\r\n\t\tlx.backup()\r\n\t\tlx.emit(itemInclude)\r\n\t\tlx.next()\r\n\t\tlx.ignore()\r\n\t\treturn lx.pop()\r\n\t}\r\n\treturn lexIncludeQuotedString\r\n}", "func extendIncludes(m *[]Includes, ext []Includes) {\n\tif ext != nil {\n\t\tif *m == nil {\n\t\t\t*m = []Includes{}\n\t\t}\n\t\t*m = append(*m, ext...)\n\t}\n}", "func (l *LazyMultiLoaderWithInclude) Include(path string) *LazyMultiLoaderWithInclude {\n\tl.includes = append(l.includes, path)\n\treturn l\n}", "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (l *Line) ContainsIncluded(content string) (output string, err error) {\n\tfor _, i := range l.Includes {\n\t\tfound := false\n\t\tfor _, line := range strings.Split(content, \"\\n\") {\n\n\t\t\tif strings.Contains(line, i) {\n\t\t\t\toutput = output + line + \"\\n\"\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tlogrus.Errorf(\"Line '%v', not found in content:\\n%v\\n\", i, content)\n\t\t\treturn \"\", fmt.Errorf(ErrLineNotFound)\n\t\t}\n\t}\n\treturn output, nil\n}", "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementXssMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementXssMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (meta *Meta) Including(filename string, gziped bool) error {\n\tif filename == \"\" {\n\t\treturn nil\n\t}\n\n\tfa, err := wildcard.Compile([]rune(\n\t\tstrings.ReplaceAll(\n\t\t\tfilepath.Join(meta.Dir, filename), \"\\\\\", \"\\\\\\\\\")))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmeta.Includes = append(meta.Includes,\n\t\tInclude{Filename: filename, Wc: fa, Gziped: gziped})\n\treturn nil\n}", "func (o WebAclRuleStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementByteMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementByteMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementOrStatementStatementAndStatementStatementAndStatementStatementByteMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementOrStatementStatementAndStatementStatementAndStatementStatementByteMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementAndStatementStatementByteMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementAndStatementStatementByteMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementOrStatementStatementByteMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementOrStatementStatementByteMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementByteMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementByteMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (this *Asset) parse() error {\n\tassetPath, err := this.findAssetPath()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfile, err := os.OpenFile(assetPath, os.O_RDONLY, 0666)\n\tif err != nil {\n\t\treturn err\n\t}\n\tasset_reader := bufio.NewReader(file)\n\tfor {\n\t\t_line, _, err := asset_reader.ReadLine()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tline := string(_line)\n\t\tvar prefix string\n\t\tif this.assetType == ASSET_JAVASCRIPT {\n\t\t\tprefix = \"//= require \"\n\t\t}else {\n\t\t\tprefix = \"/*= require \"\n\t\t}\n\t\tif strings.HasPrefix(line, prefix) {\n\t\t\tinclude_file := line[len(prefix):]\n\t\t\tfile, err := this.findIncludeFilePath(include_file)\n\t\t\tif err != nil {\n\t\t\t\tWarning(\"%v \\\"%v\\\" can't find required file \\\"%v\\\"\", this.assetType.String(), this.assetName, include_file)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tthis.Include_files = append(this.Include_files, file)\n\t\t}\n\t}\n\treturn nil\n}", "func (o WebAclRuleStatementNotStatementStatementRegexMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementRegexMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementNotStatementStatementXssMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementNotStatementStatementXssMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementOrStatementStatementXssMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementOrStatementStatementXssMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementOrStatementStatementByteMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementOrStatementStatementByteMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func includeFile(filename string, buf *bytes.Buffer) error {\n\tfilename = filepath.Clean(filename)\n\tlineNum := 0\n\n\t// check for include cyles\n\tif includedFiles[filename] {\n\t\treturn fmt.Errorf(\"include cycle: '%s'\", filename)\n\t} else {\n\t\tincludedFiles[filename] = true\n\t}\n\tdefer delete(includedFiles, filename)\n\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\ts := bufio.NewScanner(f)\n\n\t// mark the start of this file\n\tfmt.Fprintln(buf, marker(filename, lineNum))\n\n\tfor s.Scan() {\n\t\tline := s.Text()\n\n\t\tif strings.HasPrefix(line, \"include\") {\n\t\t\tpieces := strings.Split(line, \" \")\n\t\t\tif len(pieces) != 2 {\n\t\t\t\treturn fmt.Errorf(\"%s:%d: invalid include directive\", filename, lineNum)\n\t\t\t}\n\n\t\t\terr := includeFile(filepath.Join(filename, \"..\", pieces[1]), buf)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"%s:%d: %s\", filename, lineNum, err.Error())\n\t\t\t}\n\t\t\tlineNum++\n\n\t\t\t// mark the resumption point for this file\n\t\t\tfmt.Fprintln(buf, marker(filename, lineNum))\n\t\t} else {\n\t\t\tfmt.Fprintln(buf, s.Text())\n\t\t\tlineNum++\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o WebAclRuleStatementOrStatementStatementAndStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementOrStatementStatementAndStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementNotStatementStatementXssMatchStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementXssMatchStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (s *Service) ExtendsInclude() string {\n\tincludeAndService := strings.Split(s.Extends, \".\")\n\tif len(includeAndService) == 2 {\n\t\treturn includeAndService[0]\n\t}\n\treturn \"\"\n}", "func (f *Frugal) ReferencedIncludes() ([]*Include, error) {\n\tincludes := []*Include{}\n\tincludesSet := make(map[string]*Include)\n\tfor _, serv := range f.Services {\n\t\tservIncludes, err := serv.ReferencedIncludes()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, include := range servIncludes {\n\t\t\tif _, ok := includesSet[include.Name]; !ok {\n\t\t\t\tincludesSet[include.Name] = include\n\t\t\t\tincludes = append(includes, include)\n\t\t\t}\n\t\t}\n\t}\n\treturn includes, nil\n}", "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (d *BackupDescriptor) Include(classes []string) {\n\tif len(classes) == 0 {\n\t\treturn\n\t}\n\tset := make(map[string]struct{}, len(classes))\n\tfor _, cls := range classes {\n\t\tset[cls] = struct{}{}\n\t}\n\tpred := func(s string) bool {\n\t\t_, ok := set[s]\n\t\treturn ok\n\t}\n\td.Filter(pred)\n}", "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (f *Frugal) ReferencedServiceIncludes() ([]*Include, error) {\n\tincludeNames := []string{}\n\tincludesSet := make(map[string]*Include)\n\tfor _, service := range f.Services {\n\t\tservIncludes, err := service.ReferencedIncludes()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, include := range servIncludes {\n\t\t\tif _, ok := includesSet[include.Name]; !ok {\n\t\t\t\tincludesSet[include.Name] = include\n\t\t\t\tincludeNames = append(includeNames, include.Name)\n\t\t\t}\n\t\t}\n\t}\n\tsort.Strings(includeNames)\n\tincludes := make([]*Include, len(includeNames))\n\tfor i, include := range includeNames {\n\t\tincludes[i] = includesSet[include]\n\t}\n\treturn includes, nil\n}", "func main() {\n\tif len(os.Args[1:]) < 2 {\n\t\tpanic(\"please use 'go run include_headers.go <c_file> <output_file> [include_dir]...'\")\n\t}\n\n\t// cwd is guaranteed to be the directory where the go:generate comment is found\n\tcwd, err := os.Getwd()\n\tif err != nil {\n\t\tlog.Fatalf(\"unable to get current working directory: %s\", err)\n\t}\n\troot := rootDir(cwd)\n\targs := os.Args[1:]\n\tinputFile, err := resolvePath(root, args[0])\n\tif err != nil {\n\t\tlog.Fatalf(\"unable to resolve path to %s: %s\", args[0], err)\n\t}\n\toutputFile, err := resolvePath(root, args[1])\n\tif err != nil {\n\t\tlog.Fatalf(\"unable to resolve path to %s: %s\", args[1], err)\n\t}\n\n\terr = runProcessing(root, inputFile, outputFile, args[2:])\n\tif err != nil {\n\t\tlog.Fatalf(\"error including headers: %s\", err)\n\t}\n\tfmt.Printf(\"successfully included headers from %s => %s\\n\", inputFile, outputFile)\n}", "func (f *Filter) AddInclude(s Matcher) {\n\tf.include = append(f.include, s)\n}", "func TestIncludeDiamond(t *testing.T) {\n\tt.Parallel()\n\tif _, ifnames, _, err := Compile(path.Join(\"testdata\", \"include_diamond_1.mro\"),\n\t\t[]string{\"testdata\"}, false); err != nil {\n\t\tt.Error(err)\n\t} else {\n\t\tif len(ifnames) != 4 {\n\t\t\tt.Errorf(\"Expected 3 includes, found %d\\n%v\", len(ifnames), ifnames)\n\t\t}\n\t\tfound := false\n\t\tfor _, f := range ifnames {\n\t\t\tif f == \"include_diamond_2.mro\" {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tt.Error(\"Expected to find pipeline.mro.\")\n\t\t}\n\t\tfound = false\n\t\tfor _, f := range ifnames {\n\t\t\tif f == \"include_diamond_3.mro\" {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tt.Error(\"Expected to find stages.mro.\")\n\t\t}\n\t\tfound = false\n\t\tfor _, f := range ifnames {\n\t\t\tif f == \"include_diamond_4.mro\" {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tt.Error(\"Expected to find stages.mro.\")\n\t\t}\n\t}\n}", "func (fe *FilterExpr) Includes() []string {\n\tif len(fe.Include) > 0 {\n\t\treturn []string{fe.Include}\n\t}\n\tif fe.Filter == nil {\n\t\treturn nil\n\t}\n\treturn fe.Filter.Includes()\n}", "func Include() fs.FS {\n\tf, _ := fs.Sub(include, \"include\")\n\treturn f\n}", "func (o WebAclRuleStatementNotStatementStatementSizeConstraintStatementFieldToMatchHeaderMatchPatternOutput) IncludedHeaders() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementSizeConstraintStatementFieldToMatchHeaderMatchPattern) []string {\n\t\treturn v.IncludedHeaders\n\t}).(pulumi.StringArrayOutput)\n}", "func (f *Frugal) Include(name string) *Include {\n\tname = filepath.Base(name)\n\tfor _, include := range f.Includes {\n\t\tif filepath.Base(include.Name) == name {\n\t\t\treturn include\n\t\t}\n\t}\n\treturn nil\n}", "func (fc *FilterCollection) HasInclude(path string) bool {\n\tcleanedPath := filepath.Clean(path)\n\n\tfor _, pattern := range fc.Includes {\n\t\tif fc.match(pattern, cleanedPath) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (s *DescribeServicesInput) SetInclude(v []*string) *DescribeServicesInput {\n\ts.Include = v\n\treturn s\n}", "func (s *Scope) ReferencedIncludes() ([]*Include, error) {\n\tvar err error\n\tincludes := []*Include{}\n\tincludesSet := make(map[string]*Include)\n\tfor _, op := range s.Operations {\n\t\tincludesSet, includes, err = addInclude(includesSet, includes, op.Type, s.Frugal)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn includes, nil\n}", "func GetIncludeListWithUserSource(inputFiles, clangFlags []string, cppCode bool) (\n\tlines []string, err error) {\n\tvar out string\n\tout, err = getIncludeList(inputFiles, clangFlags, []string{\"-MM\"}, cppCode)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn parseIncludeList(out)\n}", "func (in *ActionUserRequestChangeResolveMetaGlobalInput) SetIncludes(value string) *ActionUserRequestChangeResolveMetaGlobalInput {\n\tin.Includes = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Includes\"] = nil\n\treturn in\n}", "func GetIncludeFullList(inputFiles, clangFlags []string, cppCode bool) (\n\tlines []string, err error) {\n\tvar out string\n\tout, err = getIncludeList(inputFiles, clangFlags, []string{\"-M\"}, cppCode)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn parseIncludeList(out)\n}", "func Include(attributes ...string) Options {\n\treturn include{attributes: attributes}\n}", "func TestFixIncludesPipeline(t *testing.T) {\n\tt.Parallel()\n\tif src, err := FormatFile(path.Join(\"testdata\", \"pipeline.mro\"),\n\t\ttrue,\n\t\t[]string{\"testdata\"}); err != nil {\n\t\tt.Error(err)\n\t} else {\n\t\tif src != `@include \"stages.mro\"\n\npipeline MY_PIPELINE(\n in int info,\n out bam result \"description of output\" \"output.bam\",\n)\n{\n call MY_STAGE(\n info = self.info,\n )\n\n return (\n result = MY_STAGE.result,\n )\n}\n# trailing comment\n` {\n\t\t\tt.Errorf(\"Incorrect combined source. Got \\n%s\", src)\n\t\t}\n\t}\n}", "func analyzeFiles(inputFiles, clangFlags []string, cppCode bool) (\n\titems []entity, err error) {\n\t// See : https://clang.llvm.org/docs/CommandGuide/clang.html\n\t// clang -E <file> Run the preprocessor stage.\n\tvar out bytes.Buffer\n\tout, err = getPreprocessSources(inputFiles, clangFlags, cppCode)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Parsing preprocessor file\n\tr := bytes.NewReader(out.Bytes())\n\tscanner := bufio.NewScanner(r)\n\tscanner.Split(bufio.ScanLines)\n\t// counter - get position of line\n\tvar counter int\n\t// item, items - entity of preprocess file\n\tvar item *entity\n\n\treg := util.GetRegex(\"# (\\\\d+) \\\".*\\\".*\")\n\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tif reg.MatchString(line) {\n\t\t\tif item != (*entity)(nil) {\n\t\t\t\titems = append(items, *item)\n\t\t\t}\n\t\t\titem, err = parseIncludePreprocessorLine(line)\n\t\t\tif err != nil {\n\t\t\t\terr = fmt.Errorf(\"cannot parse line : %s with error: %s\", line, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif item.positionInSource == 0 {\n\t\t\t\t// cannot by less 1 for avoid problem with\n\t\t\t\t// identification of \"0\" AST base element\n\t\t\t\titem.positionInSource = 1\n\t\t\t}\n\t\t\titem.lines = make([]*string, 0)\n\t\t}\n\t\tcounter++\n\t\titem.lines = append(item.lines, &line)\n\t}\n\tif item != (*entity)(nil) {\n\t\titems = append(items, *item)\n\t}\n\treturn\n}", "func (r Rust) IncludeFiles() []string { return []string{\"Cargo.toml\"} }", "func (o TaskOutput) Includes() TaskIncludesPtrOutput {\n\treturn o.ApplyT(func(v *Task) TaskIncludesPtrOutput { return v.Includes }).(TaskIncludesPtrOutput)\n}", "func MaybeIncludeFile(s string, orbDirectory string) (string, error) {\n\t// View: https://regexr.com/599mq\n\tincludeRegex := regexp.MustCompile(`<<[\\s]*include\\(([-\\w\\/\\.]+)\\)?[\\s]*>>`)\n\n\t// only find up to 2 matches, because we throw an error if we find >1\n\tincludeMatches := includeRegex.FindAllStringSubmatch(s, 2)\n\tif len(includeMatches) > 1 {\n\t\treturn \"\", fmt.Errorf(\"multiple include statements: '%s'\", s)\n\t}\n\n\tif len(includeMatches) == 1 {\n\t\tmatch := includeMatches[0]\n\t\tfullMatch, subMatch := match[0], match[1]\n\n\t\t// throw an error if the entire string wasn't matched\n\t\tif fullMatch != s {\n\t\t\treturn \"\", fmt.Errorf(\"entire string must be include statement: '%s'\", s)\n\t\t}\n\n\t\tfilepath := filepath.Join(orbDirectory, subMatch)\n\t\tfile, err := os.ReadFile(filepath)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"could not open %s for inclusion\", filepath)\n\t\t}\n\t\tescaped := strings.ReplaceAll(string(file), \"<<\", \"\\\\<<\")\n\n\t\treturn escaped, nil\n\t}\n\n\treturn s, nil\n}", "func Parse(Includes, Excludes [][]string) []byte {\n\tvar host, scheme, port, path string\n\tvar cludes [][][]string\n\n\tcludes = append(cludes, Includes)\n\tcludes = append(cludes, Excludes)\n\n\t// file containing servicenames and ports\n\tfr := File.ReadFromRoot(\"configs/known-ports.txt\", \"pkg\")\n\n\tfor i, clude := range cludes {\n\t\tfor _, item := range clude {\n\t\t\tip := regexp.MustCompile(`\\d+\\.\\d+\\.\\d+\\.\\d+`)\n\n\t\t\tif ip.MatchString(item[0]) {\n\t\t\t\tfor _, ip := range item {\n\t\t\t\t\thost := parseHost(ip)\n\t\t\t\t\tscheme = \"Any\"\n\t\t\t\t\tif i == 0 {\n\t\t\t\t\t\tadd(scheme, host, \"^(80|443)$\", path, false)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tadd(scheme, host, \"^(80|443)$\", path, true)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tscheme = strings.TrimRight(item[1], \"://\")\n\t\t\t\thost = item[2] + item[3] + item[4]\n\t\t\t\tport = strings.TrimLeft(item[6], \":\")\n\t\t\t\tpath = item[7]\n\n\t\t\t\t//fmt.Println(\"S:\" + scheme + \"H:\" + host + \"PO:\" + port + \"PA:\" + path)\n\t\t\t\tscheme, port = parseSchemeAndPort(fr, scheme, port)\n\n\t\t\t\thost = parseHost(host)\n\t\t\t\tpath = parseFile(path)\n\n\t\t\t\tif i == 0 {\n\t\t\t\t\tadd(scheme, host, port, path, false)\n\t\t\t\t} else {\n\t\t\t\t\tadd(scheme, host, port, path, true)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// scope object\n\tscope := Scope{}\n\tscope.Target.Scope.AdvancedMode = true\n\t// add include/exclude slices\n\tscope.Target.Scope.Include = incslice.Include\n\tscope.Target.Scope.Exclude = exslice.Exclude\n\n\t// parse pretty json\n\tjson, err := json.MarshalIndent(scope, \"\", \" \")\n\tif err != nil {\n\t\tfmt.Println(\"json err:\", err)\n\t}\n\treturn json\n}", "func IncludeFields(paths []string, includePaths ...string) []string {\n\tif len(paths) == 0 {\n\t\treturn paths\n\t}\n\tincluded := make([]string, 0, len(paths))\n\tfor _, path := range paths {\n\t\tif HasAnyField(includePaths, path) {\n\t\t\tincluded = append(included, path)\n\t\t}\n\t}\n\treturn included\n}" ]
[ "0.678124", "0.6446041", "0.61750436", "0.610039", "0.6088763", "0.59693265", "0.5771785", "0.5586935", "0.5545841", "0.5491811", "0.5489514", "0.5452785", "0.5350742", "0.5308133", "0.53067124", "0.53055584", "0.53052", "0.5304817", "0.53026134", "0.5296373", "0.5293165", "0.5292278", "0.5290414", "0.5287466", "0.52868646", "0.5277426", "0.5274859", "0.5262468", "0.52623284", "0.52611667", "0.52590424", "0.52553886", "0.5247337", "0.52432734", "0.5239582", "0.5239193", "0.5234012", "0.5232591", "0.5231891", "0.522568", "0.5219155", "0.5213819", "0.52119744", "0.5199697", "0.51964134", "0.5196172", "0.5187277", "0.5185783", "0.5180413", "0.51799625", "0.5178918", "0.51772845", "0.51724213", "0.5167939", "0.5165197", "0.5162568", "0.5160099", "0.5157959", "0.5154649", "0.5143694", "0.5136201", "0.51305926", "0.511316", "0.5106565", "0.5104407", "0.5101744", "0.51005214", "0.50979054", "0.5097351", "0.5097217", "0.5085658", "0.50797224", "0.50516105", "0.5050618", "0.5040303", "0.5034468", "0.5019519", "0.5018545", "0.4988509", "0.49733216", "0.49675032", "0.49197978", "0.48956737", "0.48797345", "0.48696667", "0.48695284", "0.48563263", "0.48500258", "0.48480073", "0.48430988", "0.48308057", "0.4824238", "0.48224685", "0.482179", "0.48077554", "0.48057678", "0.48052418", "0.48049724", "0.4802129", "0.47979853" ]
0.8502233
0
parseForwardDeclares .. Parses dependencies to create an foward declare string for each.
parseForwardDeclares .. Парсит зависимости для создания строки forward declare для каждой.
func (i *Interface) parseForwardDeclares() { for _, dependency := range i.Dependencies { if !parsers.ShouldBeIncludedInHeader(dependency) { i.ForwardDeclaresString += "class " + dependency + ";\n" } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (i *Interface) parseDependencies() {\n\tvar dependencies []string\n\tfor _, function := range i.Functions {\n\n\t\t// \"expanded\" refers to creating a parsers.from a templated type, i.e \"QMap <int, QString>\" becomes [QMap int QString]\n\t\texpandedReturnType := strings.FieldsFunc(function.ReturnType, templatedTypeSeparators) \n\t\tfor _, dataType := range(expandedReturnType) {\n\t\t\tdependencies = append(dependencies, strings.TrimSpace(dataType))\n\t\t}\n\n\t\tfor _, parameter := range function.Parameters {\n\t\t\texpandedParameter := strings.FieldsFunc(parameter.Type, templatedTypeSeparators)\n\t\t\tfor _, innerParameter := range expandedParameter {\n\t\t\t\tdependencies = append(dependencies, strings.TrimSpace(innerParameter))\n\t\t\t} \n\t\t}\n\t}\n\ti.Dependencies = dependencies\n\ti.Dependencies = parsers.RemoveConstSpecifiers(i.Dependencies)\n\ti.Dependencies = parsers.RemovePointersAndReferences(i.Dependencies)\n\ti.Dependencies = parsers.RemoveStdDataTypes(i.Dependencies)\n\ti.Dependencies = parsers.MapDataTypesToLibraryDependencies(i.Dependencies)\n\ti.Dependencies = parsers.RemoveDuplicates(i.Dependencies)\n\tsort.Strings(i.Dependencies)\n}", "func (p* Parser) declarations() {\n for(true) {\n\t switch (p.currentToken.getTokenType()) {\n\t case \"TK_VAR\":\n\t\t p.varDeclarations();\n\t\t break;\n\t case \"TK_PROCEDURE\":\n\t\t p.procDeclaration();\n\t\t break;\n\t case \"TK_LABEL\":\n\t\t p.labelDeclarations();\n\t\t break;\n\t case \"TK_BEGIN\":\n\t\t return;\n\t }\n }\n}", "func (id ifaceDefiner) Declare() {\n\tfor ix := range id.pkg.Files {\n\t\tfile, pfile := id.pkg.Files[ix], id.pfiles[ix]\n\t\tfor _, pdef := range pfile.Interfaces {\n\t\t\texport, err := validIdent(pdef.Name, reservedNormal)\n\t\t\tif err != nil {\n\t\t\t\tid.env.prefixErrorf(file, pdef.Pos, err, \"interface %s invalid name\", pdef.Name)\n\t\t\t\tcontinue // keep going to catch more errors\n\t\t\t}\n\t\t\tdetail := identDetail(\"interface\", file, pdef.Pos)\n\t\t\tif err := file.DeclareIdent(pdef.Name, detail); err != nil {\n\t\t\t\tid.env.prefixErrorf(file, pdef.Pos, err, \"interface %s name conflict\", pdef.Name)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdef := &Interface{NamePos: NamePos(pdef.NamePos), Exported: export, File: file}\n\t\t\tid.builders[pdef.Name] = &ifaceBuilder{def, pdef}\n\t\t}\n\t}\n}", "func (td typeDefiner) Declare() {\n\tfor ix := range td.pkg.Files {\n\t\tfile, pfile := td.pkg.Files[ix], td.pfiles[ix]\n\t\tfor _, pdef := range pfile.TypeDefs {\n\t\t\tdetail := identDetail(\"type\", file, pdef.Pos)\n\t\t\tif err := file.DeclareIdent(pdef.Name, detail); err != nil {\n\t\t\t\ttd.env.prefixErrorf(file, pdef.Pos, err, \"type %s name conflict\", pdef.Name)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttd.builders[pdef.Name] = td.makeTypeDefBuilder(file, pdef)\n\t\t}\n\t}\n}", "func resolveDeclarations(ctx *sql.Context, a *Analyzer, node sql.Node, scope *Scope) (sql.Node, error) {\n\treturn resolveDeclarationsInner(ctx, a, node, newDeclarationScope(nil))\n}", "func (i *Interface) parseIncludes() {\n\tfor _, dependency := range i.Dependencies {\n\t\tinclude := NewInclude(dependency)\n\t\tif parsers.ShouldBeIncludedInHeader(dependency) {\n\t\t\ti.HeaderIncludesString += include.ToString() + \"\\n\"\n\t\t} else {\n\t\t\ti.ImplementationIncludesString += include.ToString() + \"\\n\"\n\t\t}\n\t}\n}", "func (p *Parser) declare(decl, data interface{}, scope *ast.Scope, kind ast.ObjKind, idents ...*ast.Ident) {\n\tfor _, ident := range idents {\n\t\tassert(ident.Obj == nil, \"identifier already declared or resolved\")\n\t\tobj := ast.NewObj(kind, ident.Name)\n\t\t// remember the corresponding declaration for redeclaration\n\t\t// errors and global variable resolution/typechecking phase\n\t\tobj.Decl = decl\n\t\tobj.Data = data\n\t\tident.Obj = obj\n\t\tif ident.Name != \"_\" {\n\t\t\tif alt := scope.Insert(obj); alt != nil /*&& p.mode&DeclarationErrors != 0*/ {\n\t\t\t\tprevDecl := \"\"\n\t\t\t\tif pos := alt.Pos(); pos.IsValid() {\n\t\t\t\t\tprevDecl = fmt.Sprintf(\"\\n\\tprevious declaration at %s\", p.file.Position(pos))\n\t\t\t\t}\n\t\t\t\tp.error(ident.Pos(), fmt.Sprintf(\"%s redeclared in this block%s\", ident.Name, prevDecl))\n\t\t\t}\n\t\t}\n\t}\n}", "func (w *bodyBase) declared(name string) bool {\n\tfor _, s := range w.list {\n\t\tif decl, ok := s.(*Declare); ok && decl.name == name {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func ParseForwardPorts(h IptablesHandler, nat string, chain string) ([]int, error) {\n\trules, err := h.IptablesListRules(nat, chain)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treason := \"\"\n\tports := make([]int, 0)\n\tfor _, rule := range rules {\n\t\tflags := pflag.NewFlagSet(\"iptables-flag\", pflag.ContinueOnError)\n\t\tflags.ParseErrorsWhitelist.UnknownFlags = true\n\t\tforwardPort := flags.Int(\"dport\", 0, \"\")\n\t\terr := flags.Parse(strings.Split(rule, \" \"))\n\t\tif err != nil {\n\t\t\treason = fmt.Sprintf(\"%s; %s\", reason, err.Error())\n\t\t} else if *forwardPort != 0 {\n\t\t\tports = append(ports, *forwardPort)\n\t\t}\n\t}\n\n\treturn ports, nil\n}", "func convertDependencies(deps []string) []*license_metadata_proto.AnnotatedDependency {\n\tvar ret []*license_metadata_proto.AnnotatedDependency\n\n\tfor _, d := range deps {\n\t\tcomponents := strings.Split(d, \":\")\n\t\tdep := components[0]\n\t\tcomponents = components[1:]\n\t\tad := &license_metadata_proto.AnnotatedDependency{\n\t\t\tFile: proto.String(dep),\n\t\t\tAnnotations: make([]string, 0, len(components)),\n\t\t}\n\t\tfor _, ann := range components {\n\t\t\tif len(ann) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tad.Annotations = append(ad.Annotations, ann)\n\t\t}\n\t\tret = append(ret, ad)\n\t}\n\n\treturn ret\n}", "func (g *Generator) declareIndexAndNameVar(run []Value, typeName string) {\n\tindex, name := g.createIndexAndNameDecl(run, typeName, \"\")\n\tg.Printf(\"const %s\\n\", name)\n\tg.Printf(\"var %s\\n\", index)\n}", "func (parser *Parser) funcsDeclars() ([]*Function, error) {\n\tparser.trace(\"FUNCS DECLARS\")\n\tfunction, err := parser.funcDeclar()\n\t// Empty, is not an error\n\tif err == ErrNoMatch {\n\t\treturn nil, nil\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfuncs, err := parser.funcsDeclars()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn append([]*Function{function}, funcs...), nil\n}", "func (g *Generator) declareIndexAndNameVars(runs [][]Value, typeName string) {\n\tvar indexes, names []string\n\tfor i, run := range runs {\n\t\tindex, name := g.createIndexAndNameDecl(run, typeName, fmt.Sprintf(\"_%d\", i))\n\t\tif len(run) != 1 {\n\t\t\tindexes = append(indexes, index)\n\t\t}\n\t\tnames = append(names, name)\n\t}\n\tg.Printf(\"const (\\n\")\n\tfor _, name := range names {\n\t\tg.Printf(\"\\t%s\\n\", name)\n\t}\n\tg.Printf(\")\\n\\n\")\n\n\tif len(indexes) > 0 {\n\t\tg.Printf(\"var (\")\n\t\tfor _, index := range indexes {\n\t\t\tg.Printf(\"\\t%s\\n\", index)\n\t\t}\n\t\tg.Printf(\")\\n\\n\")\n\t}\n}", "func (s *BasePlSqlParserListener) EnterSeq_of_declare_specs(ctx *Seq_of_declare_specsContext) {}", "func calculateDependencies(definition string) (definitions dependencies, err error) {\n half := make(dependencies, 0)\n marked := make(dependencies, 0)\n\n err = visitDefinition(definition, &half, &marked)\n\n if nil == err {\n definitions = marked\n }\n\n return\n}", "func (p *Parser) varDeclarations() {\n\tfor(true) {\n\t\tif (\"TK_VAR\" == (p.currentToken.getTokenType())) {\n\t\t\tp.match(\"TK_VAR\");\n\t\t} else {\n\t\t\t// currentToken is not \"TK_VAR\"\n\t\t\tbreak;\n\t\t}\n\n\t\t// Store variables in a list\n\n\t\tvar variablesArrayList []Token\n\t\tfor (\"TK_IDENTIFIER\" == (p.currentToken.getTokenType())) {\n\t\t\tp.currentToken.setTokenType(\"TK_A_VAR\");\n\t\t\tvariablesArrayList = append(variablesArrayList, p.currentToken);\n\n\t\t\tp.match(\"TK_A_VAR\");\n\n\t\t\tif (\"TK_COMMA\" == (p.currentToken.getTokenType())) {\n\t\t\t\tp.match(\"TK_COMMA\");\n\t\t\t}\n\t\t}\n\n\t\tp.match(\"TK_COLON\");\n\t\tdataType := p.currentToken.getTokenType();\n\t\tp.match(dataType);\n\n\t\t// Add the correct datatype for each identifier and insert into symbol table\n\n\t\tfor i := 0; i < len(variablesArrayList); i++ {\n\n\t\t\tvar variable Token = variablesArrayList[i]\n\t\t\tdt := strings.ToLower(dataType)\n\n\t\t\tsymbol := NewSymbol(variable.getTokenVal(), \"TK_A_VAR\",\n\t\t\t\tp.STRING_TYPE_MAP[dt[3 : len(dt)]], p.dp);\n\n\t\t\tp.dp += 4;\n\n\n\t\t\tif (p.symbolTable.lookup(variable.getTokenVal()) == nil) {\n\t\t\t\tp.symbolTable.insert(symbol);\n\t\t\t}\n\t\t}\n\n\t\tif (dataType == (\"TK_ARRAY\")){\n\t\t\tp.arrayDeclaration(variablesArrayList);\n\t\t}\n\n\t\tp.match(\"TK_SEMI_COLON\");\n\n\t}\n}", "func buildDependencies(fdSet *dpb.FileDescriptorSet) {\n\t// Dependency to google/api/annotations.proto for gRPC-HTTP transcoding. Here a couple of problems arise:\n\t// 1. Problem: \tWe cannot call descriptor.ForMessage(&annotations.E_Http), which would be our\n\t//\t\t\t\trequired dependency. However, we can call descriptor.ForMessage(&http) and\n\t//\t\t\t\tthen construct the extension manually.\n\t// 2. Problem: \tThe name is set wrong.\n\t// 3. Problem: \tgoogle/api/annotations.proto has a dependency to google/protobuf/descriptor.proto.\n\thttp := annotations.Http{}\n\tfd, _ := descriptor.MessageDescriptorProto(&http)\n\n\textensionName := \"http\"\n\tn := \"google/api/annotations.proto\"\n\tl := dpb.FieldDescriptorProto_LABEL_OPTIONAL\n\tt := dpb.FieldDescriptorProto_TYPE_MESSAGE\n\ttName := \"google.api.HttpRule\"\n\textendee := \".google.protobuf.MethodOptions\"\n\n\thttpExtension := &dpb.FieldDescriptorProto{\n\t\tName: &extensionName,\n\t\tNumber: &annotations.E_Http.Field,\n\t\tLabel: &l,\n\t\tType: &t,\n\t\tTypeName: &tName,\n\t\tExtendee: &extendee,\n\t}\n\n\tfd.Extension = append(fd.Extension, httpExtension) // 1. Problem\n\tfd.Name = &n // 2. Problem\n\tfd.Dependency = append(fd.Dependency, \"google/protobuf/descriptor.proto\") //3.rd Problem\n\n\t// Build other required dependencies\n\te := empty.Empty{}\n\tfdp := dpb.DescriptorProto{}\n\tfd2, _ := descriptor.MessageDescriptorProto(&e)\n\tfd3, _ := descriptor.MessageDescriptorProto(&fdp)\n\tdependencies := []*dpb.FileDescriptorProto{fd, fd2, fd3}\n\n\t// According to the documentation of protoReflect.CreateFileDescriptorFromSet the file I want to print\n\t// needs to be at the end of the array. All other FileDescriptorProto are dependencies.\n\tfdSet.File = append(dependencies, fdSet.File...)\n}", "func addDependencies(fdSet *dpb.FileDescriptorSet) {\n\t// At last, we need to add the dependencies to the FileDescriptorProto in order to get them rendered.\n\tlastFdProto := getLast(fdSet.File)\n\tfor _, fd := range fdSet.File {\n\t\tif fd != lastFdProto {\n\t\t\tif *fd.Name == \"google/protobuf/empty.proto\" { // Reference: https://github.com/googleapis/gnostic-grpc/issues/8\n\t\t\t\tif shouldRenderEmptyImport {\n\t\t\t\t\tlastFdProto.Dependency = append(lastFdProto.Dependency, *fd.Name)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlastFdProto.Dependency = append(lastFdProto.Dependency, *fd.Name)\n\t\t}\n\t}\n\t// Sort imports so they will be rendered in a consistent order.\n\tsort.Strings(lastFdProto.Dependency)\n}", "func (s *scope) declare(object sem.Named, source tok.Source) error {\n\tname := object.GetName()\n\tif existing := s.lookup(name); existing != nil {\n\t\treturn fmt.Errorf(\"%v '%v' already declared\\nFirst declared here: %v\", source, name, existing.source)\n\t}\n\ts.objects[name] = objectAndSource{object, source}\n\treturn nil\n}", "func declareFlags(fs *pflag.FlagSet, v interface{}) error {\n\tpt := reflect.TypeOf(v)\n\n\tif pt.Kind() != reflect.Ptr {\n\t\treturn errors.New(\"v must be a pointer-to-struct\")\n\t}\n\n\tst := pt.Elem()\n\tif st.Kind() != reflect.Struct {\n\t\treturn errors.New(\"v must be a pointer-to-struct\")\n\t}\n\n\trv := reflect.ValueOf(v).Elem()\n\n\tfor i := 0; i < rv.NumField(); i++ {\n\t\tf := st.Field(i)\n\n\t\t// exclude special protocol buffers fields\n\t\tif strings.HasPrefix(f.Name, \"XXX_\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tp := rv.Field(i).Addr().Interface()\n\t\tn := FlagName(f)\n\t\tu := FlagUsage(f)\n\n\t\tif ok := declareFlagForField(fs, p, n, u); !ok {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"could not generate flag for %s.%s (%s)\",\n\t\t\t\treflect.TypeOf(v),\n\t\t\t\tf.Name,\n\t\t\t\tf.Type,\n\t\t\t)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (s *BaseSyslParserListener) EnterImports_decl(ctx *Imports_declContext) {}", "func addDependencies(s *scope, name string, obj pyObject, target *core.BuildTarget, exported, internal bool) {\n\taddStrings(s, name, obj, func(str string) {\n\t\tif s.state.Config.Bazel.Compatibility && !core.LooksLikeABuildLabel(str) && !strings.HasPrefix(str, \"@\") {\n\t\t\t// *sigh*... Bazel seems to allow an implicit : on the start of dependencies\n\t\t\tstr = \":\" + str\n\t\t}\n\t\ttarget.AddMaybeExportedDependency(checkLabel(s, s.parseLabelInPackage(str, s.pkg)), exported, false, internal)\n\t})\n}", "func getObjDefs(data string) (*obj, error) {\n objDefs := newObj()\n reAttr := regexp.MustCompile(`\\s*(?P<attr>.*?)\\s+(?P<value>.*)\\n`)\n reObjDef := regexp.MustCompile(`(?sm)(^\\s*define\\s+[a-z]+?\\s*{)(.*?\\n)(\\s*})`)\n rawObjDefs := reObjDef.FindAllStringSubmatch(data, -1)\n c1,c2 := 0, 0 // hostdependency and servicedependency does not have a unique identifier, will use index instead\n if rawObjDefs != nil {\n for _,oDef:= range rawObjDefs {\n defStart := strings.Join(strings.Fields(oDef[1]),\"\")\n objType := strings.TrimSpace(oDef[1])\n objAttrs := parseObjAttr(oDef, reAttr, objType)\n switch defStart {\n case \"definehost{\":\n if objAttrs.attrExist(\"name\"){\n objDefs.SetHostTempDefs(objAttrs)\n } else {\n objDefs.SetHostDefs(objAttrs)\n }\n case \"defineservice{\":\n if objAttrs.attrExist(\"name\"){\n objDefs.SetServiceTempDefs(objAttrs)\n } else {\n objDefs.SetServiceDefs(objAttrs)\n }\n case \"definehostgroup{\":\n objDefs.SetHostGroupDefs(objAttrs)\n case \"definehostdependency{\":\n c1 += 1\n objDefs.SetHostDependencyDefs(objAttrs, c1)\n case \"defineservicedependency{\":\n c2 += 1\n objDefs.SetServiceDependencyDefs(objAttrs, c2)\n case \"definecontact{\":\n if objAttrs.attrExist(\"name\"){\n objDefs.SetContactTempDefs(objAttrs)\n } else {\n objDefs.SetContactDefs(objAttrs)\n }\n case \"definecontactgroup{\":\n objDefs.SetContactGroupDefs(objAttrs)\n case \"definecommand{\":\n if objAttrs.attrExist(\"command_name\") && objAttrs.attrExist(\"command_line\"){\n objDefs.SetcommandDefs(objAttrs)\n }else {\n fmt.Println(\"here\",objAttrs)\n }\n default:\n err := errors.New(\"unknown naigos object type\")\n fmt.Println(&unknownObjectError{objAttrs,objType,err})\n }\n }\n } else {\n err := errors.New(\"no nagios object definition found\")\n return nil,&NotFoundError{err, \"Fatal\", \"\"} \n }\n return objDefs, nil\n}", "func (p *Processor) Forward(xs ...ag.Node) []ag.Node {\n\tif p.RequiresFullSeq() {\n\t\treturn p.fullSeqForward(xs)\n\t}\n\treturn p.incrementalForward(xs)\n}", "func (s *BasePlSqlParserListener) EnterPragma_declaration(ctx *Pragma_declarationContext) {}", "func (g *Generator) declareNameVars(runs [][]Value, typeName string, suffix string) {\n\tg.Printf(\"const _%s_name%s = \\\"\", typeName, suffix)\n\tfor _, run := range runs {\n\t\tfor i := range run {\n\t\t\tg.Printf(\"%s\", run[i].typeInfo.originalName)\n\t\t}\n\t}\n\tg.Printf(\"\\\"\\n\")\n}", "func dropEmptyImportDeclarations(decl ast.Decl) bool {\n\tswitch t := decl.(type) {\n\tcase *ast.GenDecl:\n\t\tif t.Tok != token.IMPORT {\n\t\t\treturn false\n\t\t}\n\t\tspecs := []ast.Spec{}\n\t\tfor _, s := range t.Specs {\n\t\t\tswitch spec := s.(type) {\n\t\t\tcase *ast.ImportSpec:\n\t\t\t\tif spec.Name != nil && spec.Name.Name == \"_\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tspecs = append(specs, spec)\n\t\t\t}\n\t\t}\n\t\tif len(specs) == 0 {\n\t\t\treturn true\n\t\t}\n\t\tt.Specs = specs\n\t}\n\treturn false\n}", "func (m *Method) ArgDeclarations() string {\n\tresults := make([]string, len(m.Request))\n\tfor i, argument := range m.Request {\n\t\tresults[i] = argument.Name + \" \" + argument.Type\n\t}\n\treturn strings.Join(results, \", \")\n}", "func (p *Parser) vardec(tokens []obj.Token) { p.fvardec(&p.defs, tokens) }", "func prepareSegmentFwdArgs() []greenplum.SegmentFwdArg {\n\treturn []greenplum.SegmentFwdArg{\n\t\t{Name: permanentFlag, Value: strconv.FormatBool(permanent)},\n\t}\n}", "func (td typeDefiner) getLocalDeps(ptype parse.Type) (deps []*typeDefBuilder) {\n\tswitch pt := ptype.(type) {\n\tcase *parse.TypeNamed:\n\t\t// Named references to other types in this package are all we care about.\n\t\tif b := td.builders[pt.Name]; b != nil {\n\t\t\tdeps = append(deps, b)\n\t\t}\n\tcase *parse.TypeEnum:\n\t\t// No deps.\n\tcase *parse.TypeArray:\n\t\tdeps = append(deps, td.getLocalDeps(pt.Elem)...)\n\tcase *parse.TypeList:\n\t\tdeps = append(deps, td.getLocalDeps(pt.Elem)...)\n\tcase *parse.TypeSet:\n\t\tdeps = append(deps, td.getLocalDeps(pt.Key)...)\n\tcase *parse.TypeMap:\n\t\tdeps = append(deps, td.getLocalDeps(pt.Key)...)\n\t\tdeps = append(deps, td.getLocalDeps(pt.Elem)...)\n\tcase *parse.TypeStruct:\n\t\tfor _, field := range pt.Fields {\n\t\t\tdeps = append(deps, td.getLocalDeps(field.Type)...)\n\t\t}\n\tcase *parse.TypeUnion:\n\t\tfor _, field := range pt.Fields {\n\t\t\tdeps = append(deps, td.getLocalDeps(field.Type)...)\n\t\t}\n\tcase *parse.TypeOptional:\n\t\tdeps = append(deps, td.getLocalDeps(pt.Base)...)\n\tdefault:\n\t\tpanic(fmt.Errorf(\"vdl: unhandled parse.Type %T %#v\", ptype, ptype))\n\t}\n\treturn\n}", "func declf(name, format string, a ...interface{}) *Declare {\n\treturn &Declare{name, exprf(format, a...)}\n}", "func (info *globalInfo) parsePragmas(doc *ast.CommentGroup) {\n\tfor _, comment := range doc.List {\n\t\tif !strings.HasPrefix(comment.Text, \"//go:\") {\n\t\t\tcontinue\n\t\t}\n\t\tparts := strings.Fields(comment.Text)\n\t\tswitch parts[0] {\n\t\tcase \"//go:extern\":\n\t\t\tinfo.extern = true\n\t\t\tif len(parts) == 2 {\n\t\t\t\tinfo.linkName = parts[1]\n\t\t\t}\n\t\t}\n\t}\n}", "func (s *BasePlSqlParserListener) EnterDeclare_spec(ctx *Declare_specContext) {}", "func (dn *DefinitionName) RequiredImports() []PackageReference {\n\treturn []PackageReference{dn.PackageReference}\n}", "func (p *Parser) parseDecl() {\n\tdefer un(trace(p, \"parseDecl\"))\n\n\ttok := p.tok\n\n\tswitch tok.Token {\n\tcase ItemLowerIdent:\n\t\tp.parseBuiltinCombinatorDecl()\n\tcase ItemUpperIdent:\n\t\tp.parsePartialAppDecl()\n\tcase ItemNew, ItemFinal, ItemEmpty:\n\t\tp.parseFinalDecl()\n\tdefault:\n\t\tp.setErr(fmt.Errorf(\"unexpected token\"))\n\t\treturn\n\t}\n}", "func (c *SimpleConsumer) declare() error {\n\t// declare exchange\n\tfmt.Printf(\"Binding exchange %v\\n\", c.exchange)\n\tif err := c.channel.ExchangeDeclare(\n\t\tc.exchange, // name of the exchange\n\t\tc.exchType, // type\n\t\ttrue, // durable\n\t\tfalse, // delete when complete\n\t\tfalse, // internal\n\t\tfalse, // noWait\n\t\tnil, // arguments\n\t); err != nil {\n\t\treturn fmt.Errorf(\"exchange declare error: %s\", err)\n\t}\n\n\t// declare queue\n\tfmt.Printf(\"Declare queue %v\\n\", c.queue)\n\tqueue, err := c.channel.QueueDeclare(\n\t\tc.queue, // name of the queue\n\t\ttrue, // durable\n\t\tfalse, // delete when unused\n\t\tfalse, // exclusive\n\t\tfalse, // noWait\n\t\tnil, // arguments\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"queue declare error: %s\", err)\n\t}\n\n\t// binding queue\n\tfmt.Printf(\"Binding queue %v to exchange %v\\n\", c.queue, c.exchange)\n\tif err = c.channel.QueueBind(\n\t\tqueue.Name, // name of the queue\n\t\tc.bindingKey, // bindingKey\n\t\tc.exchange, // sourceExchange\n\t\tfalse, // noWait\n\t\tnil, // arguments\n\t); err != nil {\n\t\treturn fmt.Errorf(\"queue bind error: %s\", err)\n\t}\n\treturn nil\n}", "func (n ClassNode) Declare(scope *Scope, c *Compiler) value.Value {\n\tstructDefn := types.NewStruct()\n\n\tname := fmt.Sprintf(\"class.%s.%s\", c.Package.NamespaceName, n.Name)\n\tstructDefn.SetName(name)\n\tc.Module.NewType(n.Name, structDefn)\n\tNewTypeDef(n.Name, structDefn, -1).InjectInto(scope)\n\t// structDefn.Opaque = true\n\n\treturn nil\n}", "func (ref *ReferenceDefinition) formatFast(buf *TrackedBuffer) {\n\tbuf.WriteString(\"references \")\n\tref.ReferencedTable.formatFast(buf)\n\tbuf.WriteByte(' ')\n\tref.ReferencedColumns.formatFast(buf)\n\tif ref.Match != DefaultMatch {\n\t\tbuf.WriteString(\" match \")\n\t\tref.Match.formatFast(buf)\n\t}\n\tif ref.OnDelete != DefaultAction {\n\t\tbuf.WriteString(\" on delete \")\n\t\tref.OnDelete.formatFast(buf)\n\t}\n\tif ref.OnUpdate != DefaultAction {\n\t\tbuf.WriteString(\" on update \")\n\t\tref.OnUpdate.formatFast(buf)\n\t}\n}", "func (r *Resolver) Declare(name *Token) {\n\t// don't check global scope.\n\tif r.scopes.Empty() {\n\t\treturn\n\t}\n\n\tscope := r.scopes.Peek()\n\n\tif exists := scope[name.Lexeme]; exists == varDeclared || exists == varDefined {\n\t\tpanic(NewLoxError(name, \"variable redeclared.\"))\n\t}\n\n\tscope[name.Lexeme] = varDeclared\n}", "func visitDefinition(definition string, half, marked *dependencies) (err error) {\n if half.includes(definition) {\n return errCyclicDependency\n } else if !marked.includes(definition) && !half.includes(definition) {\n half.add(definition)\n task := gofer.index(definition)\n\n if nil == task {\n return errUnresolvableDependencies\n }\n\n for _, dependency := range task.Dependencies {\n err = visitDefinition(dependency, half, marked)\n if nil != err {\n return\n }\n }\n\n half.remove(definition)\n marked.add(definition)\n }\n\n return\n}", "func variablesToBashDecls(vars map[string]tftypes.Value) string {\n\tif len(vars) == 0 {\n\t\treturn \"\"\n\t}\n\n\tvar buf strings.Builder\n\tnames := make([]string, 0, len(vars))\n\tfor name := range vars {\n\t\tnames = append(names, name)\n\t}\n\tsort.Strings(names)\n\n\tfor _, name := range names {\n\t\tval := vars[name]\n\t\tswitch {\n\t\tcase val.Is(tftypes.String):\n\t\t\tvar s string\n\t\t\tval.As(&s)\n\t\t\tbuf.WriteString(\"declare -r \")\n\t\t\tbuf.WriteString(name)\n\t\t\tbuf.WriteString(\"=\")\n\t\t\tbuf.WriteString(bashQuoteString(s))\n\t\t\tbuf.WriteString(\"\\n\")\n\t\tcase val.Is(tftypes.Number):\n\t\t\tvar f big.Float\n\t\t\tval.As(&f)\n\t\t\t// NOTE: Bash only actually supports integers, so here we're\n\t\t\t// assuming that the configuration decoder already rejected\n\t\t\t// fractional values.\n\t\t\tbuf.WriteString(\"declare -ri \")\n\t\t\tbuf.WriteString(name)\n\t\t\tbuf.WriteString(\"=\")\n\t\t\tbuf.WriteString(f.Text('f', -1))\n\t\t\tbuf.WriteString(\"\\n\")\n\t\tcase val.Is(listOfString):\n\t\t\tvar l []tftypes.Value\n\t\t\tval.As(&l)\n\t\t\tbuf.WriteString(\"declare -ra \")\n\t\t\tbuf.WriteString(name)\n\t\t\tbuf.WriteString(\"=(\")\n\t\t\tfor i, ev := range l {\n\t\t\t\tvar es string\n\t\t\t\tev.As(&es)\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(\" \")\n\t\t\t\t}\n\t\t\t\tbuf.WriteString(bashQuoteString(es))\n\t\t\t}\n\t\t\tbuf.WriteString(\")\\n\")\n\t\tcase val.Is(mapOfString):\n\t\t\tvar m map[string]tftypes.Value\n\t\t\tval.As(&m)\n\t\t\tbuf.WriteString(\"declare -rA \")\n\t\t\tbuf.WriteString(name)\n\t\t\tbuf.WriteString(\"=(\")\n\t\t\ti := 0\n\t\t\tfor ek, ev := range m {\n\t\t\t\tvar es string\n\t\t\t\tev.As(&es)\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(\" \")\n\t\t\t\t}\n\t\t\t\tbuf.WriteString(\"[\")\n\t\t\t\tbuf.WriteString(bashQuoteString(ek))\n\t\t\t\tbuf.WriteString(\"]=\")\n\t\t\t\tbuf.WriteString(bashQuoteString(es))\n\t\t\t\ti++\n\t\t\t}\n\t\t\tbuf.WriteString(\")\\n\")\n\t\tdefault:\n\t\t\t// Shouldn't get here if config decoding validation is working\n\t\t\tfmt.Fprintf(&buf, \"# ERROR: Don't know how to serialize %q for bash\\n\", name)\n\t\t}\n\t}\n\treturn buf.String()\n}", "func Parse(ingress *networking.Ingress) *Dependencies {\n\tsecrets := extractSecrets(ingress)\n\tsecrets = append(secrets, secretsFromAnnotations(ingress)...)\n\n\treturn &Dependencies{\n\t\tServices: extractServices(ingress),\n\t\tEndpoints: extractServices(ingress),\n\t\tSecrets: secrets,\n\t\tConfigmaps: configmapsFromAnnotations(ingress),\n\t\tAnnotations: extractAnnotations(ingress),\n\t}\n}", "func (c *client) GetDeclareCaptures(frontend string, transactionID string) (int64, models.Captures, error) {\n\tp, err := c.GetParser(transactionID)\n\tif err != nil {\n\t\treturn 0, nil, err\n\t}\n\tv, err := c.GetVersion(transactionID)\n\tif err != nil {\n\t\treturn 0, nil, err\n\t}\n\tcaptures, err := ParseDeclareCaptures(frontend, p)\n\tif err != nil {\n\t\treturn v, nil, c.HandleError(\"\", \"frontend\", frontend, \"\", false, err)\n\t}\n\treturn v, captures, nil\n}", "func (h *HRef) Resolve(r *Schema) {\n\th.Order = make([]string, 0)\n\th.Schemas = make(map[string]*Schema)\n\tfor _, v := range href.FindAllString(string(h.href), -1) {\n\t\tu, err := url.QueryUnescape(v[2 : len(v)-2])\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tparts := strings.Split(u, \"/\")\n\t\tname := stringext.DepunctWithInitialLower(fmt.Sprintf(\"%s-%s\", parts[len(parts)-3], parts[len(parts)-1]))\n\t\th.Order = append(h.Order, name)\n\t\th.Schemas[name] = Reference(u).Resolve(r)\n\t}\n}", "func deps(rule *bazel.Rule) map[bazel.Label]bool {\n\tret := make(map[bazel.Label]bool)\n\tfor _, d := range rule.StringListAttr(\"deps\") {\n\t\tif l, err := bazel.ParseRelativeLabel(rule.PkgName, d); err == nil {\n\t\t\tret[l] = true\n\t\t}\n\t}\n\treturn ret\n}", "func additionalPredeclared() []types.Type {\n\treturn []types.Type{\n\t\t// comparable\n\t\ttypes.Universe.Lookup(\"comparable\").Type(),\n\n\t\t// any\n\t\ttypes.Universe.Lookup(\"any\").Type(),\n\t}\n}", "func (s *BaseGraffleParserListener) EnterProcedure_declaration_head(ctx *Procedure_declaration_headContext) {\n}", "func Forward(in, out Link) rules.Rule {\n\treturn rules.Rule(fmt.Sprintf(\n\t\t\"-t filter -A fw-interfaces -j ACCEPT -i %v -o %v\",\n\t\tin.Name(), out.Name()))\n}", "func (h *Helper) GetTypeDefs() ([]*TypeDef, map[string]string, error) {\n\tif h.typeDefs != nil {\n\t\treturn h.typeDefs, h.typeImports, nil\n\t}\n\n\ttdefs := []*TypeDef{}\n\t// Map, keyed by package import path, with the values being an alias to use\n\t// for the package\n\ttimports := map[string]string{}\n\t// Map, keyed by original Shape GoTypeElem(), with the values being a\n\t// renamed type name (due to conflicting names)\n\ttrenames := map[string]string{}\n\n\tpayloads := h.getPayloads()\n\n\tfor shapeName, shape := range h.sdkAPI.Shapes {\n\t\tif inStrings(shapeName, payloads) {\n\t\t\t// Payloads are not type defs\n\t\t\tcontinue\n\t\t}\n\t\tif shape.Type != \"structure\" {\n\t\t\tcontinue\n\t\t}\n\t\tif shape.Exception {\n\t\t\t// Neither are exceptions\n\t\t\tcontinue\n\t\t}\n\t\tif h.IsIgnoredShape(shapeName) {\n\t\t\tcontinue\n\t\t}\n\t\ttdefNames := names.New(shapeName)\n\t\tif h.HasConflictingTypeName(shapeName) {\n\t\t\ttdefNames.Camel += ConflictingNameSuffix\n\t\t\ttrenames[shapeName] = tdefNames.Camel\n\t\t}\n\n\t\tattrs := map[string]*Attr{}\n\t\tfor memberName, memberRef := range shape.MemberRefs {\n\t\t\tmemberNames := names.New(memberName)\n\t\t\tmemberShape := memberRef.Shape\n\t\t\tif h.IsIgnoredShape(memberShape.ShapeName) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !h.IsShapeUsedInCRDs(memberShape.ShapeName) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tgoPkgType := memberRef.Shape.GoTypeWithPkgNameElem()\n\t\t\tif strings.Contains(goPkgType, \".\") {\n\t\t\t\tif strings.HasPrefix(goPkgType, \"[]\") {\n\t\t\t\t\t// For slice types, we just want the element type...\n\t\t\t\t\tgoPkgType = goPkgType[2:]\n\t\t\t\t}\n\t\t\t\tif strings.HasPrefix(goPkgType, \"map[\") {\n\t\t\t\t\tgoPkgType = strings.Split(goPkgType, \"]\")[1]\n\t\t\t\t}\n\t\t\t\tif strings.HasPrefix(goPkgType, \"*\") {\n\t\t\t\t\t// For slice and map types, the element type might be a\n\t\t\t\t\t// pointer to a struct...\n\t\t\t\t\tgoPkgType = goPkgType[1:]\n\t\t\t\t}\n\t\t\t\tpkg := strings.Split(goPkgType, \".\")[0]\n\t\t\t\tif pkg != h.sdkAPI.PackageName() {\n\t\t\t\t\t// time.Time needs to be converted to apimachinery/metav1.Time otherwise there is no DeepCopy support\n\t\t\t\t\tif pkg == \"time\" {\n\t\t\t\t\t\ttimports[\"k8s.io/apimachinery/pkg/apis/meta/v1\"] = \"metav1\"\n\t\t\t\t\t} else if pkg == \"aws\" {\n\t\t\t\t\t\t// The \"aws.JSONValue\" type needs to be handled\n\t\t\t\t\t\t// specially.\n\t\t\t\t\t\ttimports[\"github.com/aws/aws-sdk-go/aws\"] = \"\"\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Shape.GoPTypeWithPkgNameElem() always returns the type\n\t\t\t\t\t\t// as a full package dot-notation name. We only want to add\n\t\t\t\t\t\t// imports for \"normal\" packages\n\t\t\t\t\t\ttimports[pkg] = \"\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// There are shapes that are called things like DBProxyStatus that are\n\t\t\t// fields in a DBProxy CRD... we need to ensure the type names don't\n\t\t\t// conflict. Also, the name of the Go type in the generated code is\n\t\t\t// Camel-cased and normalized, so we use that as the Go type\n\t\t\tgt := memberShape.GoType()\n\t\t\tif memberShape.Type == \"structure\" {\n\t\t\t\ttypeNames := names.New(memberShape.ShapeName)\n\t\t\t\tif h.HasConflictingTypeName(memberShape.ShapeName) {\n\t\t\t\t\ttypeNames.Camel += ConflictingNameSuffix\n\t\t\t\t}\n\t\t\t\tgt = \"*\" + typeNames.Camel\n\t\t\t} else if memberShape.Type == \"list\" {\n\t\t\t\t// If it's a list type, where the element is a structure, we need to\n\t\t\t\t// set the GoType to the cleaned-up Camel-cased name\n\t\t\t\tif memberShape.MemberRef.Shape.Type == \"structure\" {\n\t\t\t\t\telemType := memberShape.MemberRef.Shape.GoTypeElem()\n\t\t\t\t\ttypeNames := names.New(elemType)\n\t\t\t\t\tif h.HasConflictingTypeName(elemType) {\n\t\t\t\t\t\ttypeNames.Camel += ConflictingNameSuffix\n\t\t\t\t\t}\n\t\t\t\t\tgt = \"[]*\" + typeNames.Camel\n\t\t\t\t}\n\t\t\t} else if memberShape.Type == \"map\" {\n\t\t\t\t// If it's a map type, where the value element is a structure,\n\t\t\t\t// we need to set the GoType to the cleaned-up Camel-cased name\n\t\t\t\tif memberShape.ValueRef.Shape.Type == \"structure\" {\n\t\t\t\t\tvalType := memberShape.ValueRef.Shape.GoTypeElem()\n\t\t\t\t\ttypeNames := names.New(valType)\n\t\t\t\t\tif h.HasConflictingTypeName(valType) {\n\t\t\t\t\t\ttypeNames.Camel += ConflictingNameSuffix\n\t\t\t\t\t}\n\t\t\t\t\tgt = \"[]map[string]*\" + typeNames.Camel\n\t\t\t\t}\n\t\t\t} else if memberShape.Type == \"timestamp\" {\n\t\t\t\t// time.Time needs to be converted to apimachinery/metav1.Time\n\t\t\t\t// otherwise there is no DeepCopy support\n\t\t\t\tgt = \"*metav1.Time\"\n\t\t\t}\n\t\t\tattrs[memberName] = NewAttr(memberNames, gt, memberShape)\n\t\t}\n\t\tif len(attrs) == 0 {\n\t\t\t// Just ignore these...\n\t\t\tcontinue\n\t\t}\n\t\ttdefs = append(tdefs, &TypeDef{\n\t\t\tNames: tdefNames,\n\t\t\tAttrs: attrs,\n\t\t})\n\t}\n\tsort.Slice(tdefs, func(i, j int) bool {\n\t\treturn tdefs[i].Names.Camel < tdefs[j].Names.Camel\n\t})\n\th.typeDefs = tdefs\n\th.typeImports = timports\n\th.typeRenames = trenames\n\treturn tdefs, timports, nil\n}", "func parsePodPrefixes(clauses []string) (map[string][]string, error) {\n\tpodPrefixes := map[string][]string{}\n\tfor _, p := range clauses {\n\t\tif strings.Contains(p, \":\") {\n\t\t\tss := strings.Split(p, \":\")\n\t\t\tdesc := ss[0]\n\t\t\tps := strings.Split(ss[1], \"|\")\n\t\t\tpodPrefixes[desc] = append(podPrefixes[desc], ps...)\n\t\t} else if strings.Contains(p, \"|\") {\n\t\t\treturn nil, errors.New(\"required-pods must be either <namespace>/<pod-name> or <desc>:<namespace>/<pod-name>|<namespace>/<pod-name>|...\")\n\t\t} else {\n\t\t\tpodPrefixes[p] = []string{p}\n\t\t}\n\t}\n\treturn podPrefixes, nil\n}", "func (p *Parser) fvardec(defs *oop.DefMap, tokens []obj.Token) {\n\t// Name is not defined?\n\tif len(tokens) < 2 {\n\t\tfirst := tokens[0]\n\t\tfract.IPanicC(first.File, first.Line, first.Column+len(first.Val), obj.SyntaxPanic, \"Name is not given!\")\n\t}\n\tinf := varInfo{\n\t\tconstant: tokens[0].Val == \"const\",\n\t\tmut: tokens[0].Val == \"mut\",\n\t}\n\tpre := tokens[1]\n\tif pre.Type == fract.Name {\n\t\tp.varadd(defs, inf, tokens[1:])\n\t} else if pre.Type == fract.Brace && pre.Val == \"(\" {\n\t\ttokens = tokens[2 : len(tokens)-1]\n\t\tlast := 0\n\t\tline := tokens[0].Line\n\t\tbraceCount := 0\n\t\tfor j, tk := range tokens {\n\t\t\tif tk.Type == fract.Brace {\n\t\t\t\tswitch tk.Val {\n\t\t\t\tcase \"{\", \"[\", \"(\":\n\t\t\t\t\tbraceCount++\n\t\t\t\tdefault:\n\t\t\t\t\tbraceCount--\n\t\t\t\t\tline = tk.Line\n\t\t\t\t}\n\t\t\t}\n\t\t\tif braceCount > 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif line < tk.Line {\n\t\t\t\tp.varadd(defs, inf, tokens[last:j])\n\t\t\t\tlast = j\n\t\t\t\tline = tk.Line\n\t\t\t}\n\t\t}\n\t\tif len(tokens) != last {\n\t\t\tp.varadd(defs, inf, tokens[last:])\n\t\t}\n\t} else {\n\t\tfract.IPanic(pre, obj.SyntaxPanic, \"Invalid syntax!\")\n\t}\n}", "func (l *Lexer) consumeColonOrDeclare() Token {\n\tt := Token{\n\t\tType: Colon,\n\t\tValue: string(Colon),\n\t\tColumn: l.Column,\n\t\tLine: l.Line,\n\t}\n\n\tl.move()\n\n\t// check if it is a `:=`\n\tif next, _ := l.peek(); next == '=' {\n\t\tt.Type = Declare\n\t\tt.Value = `:=`\n\t\tl.move()\n\t}\n\n\treturn t\n}", "func processMetricDeclarations(metricDeclarations []*MetricDeclaration, metric *pdata.Metric,\n\tlabels map[string]string, rolledUpDimensions [][]string) (dimensions [][]string) {\n\tseen := make(map[string]bool)\n\taddDimSet := func(dimSet []string) {\n\t\tkey := strings.Join(dimSet, \",\")\n\t\t// Only add dimension set if not a duplicate\n\t\tif _, ok := seen[key]; !ok {\n\t\t\tdimensions = append(dimensions, dimSet)\n\t\t\tseen[key] = true\n\t\t}\n\t}\n\t// Extract and append dimensions from metric declarations\n\tfor _, m := range metricDeclarations {\n\t\tif m.Matches(metric) {\n\t\t\textractedDims := m.ExtractDimensions(labels)\n\t\t\tfor _, dimSet := range extractedDims {\n\t\t\t\taddDimSet(dimSet)\n\t\t\t}\n\t\t}\n\t}\n\t// Add on rolled-up dimensions\n\tfor _, dimSet := range rolledUpDimensions {\n\t\tsort.Strings(dimSet)\n\t\taddDimSet(dimSet)\n\t}\n\treturn\n}", "func ResolveDependencies(m meta.RESTMapper, objects []unstructuredv1.Unstructured, uids []types.UID) (NodeMap, error) {\n\treturn resolveDeps(m, objects, uids, true)\n}", "func populatePortForwards(m model.Manifest, pod v1alpha1.Pod) []model.PortForward {\n\tcPorts := store.AllPodContainerPorts(pod)\n\tfwds := m.K8sTarget().PortForwards\n\tforwards := make([]model.PortForward, 0, len(fwds))\n\tfor _, forward := range fwds {\n\t\tif forward.ContainerPort == 0 && len(cPorts) > 0 {\n\t\t\tforward.ContainerPort = int(cPorts[0])\n\t\t\tfor _, cPort := range cPorts {\n\t\t\t\tif int(forward.LocalPort) == int(cPort) {\n\t\t\t\t\tforward.ContainerPort = int(cPort)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif forward.ContainerPort == 0 {\n\t\t\tforward.ContainerPort = forward.LocalPort\n\t\t}\n\t\tforwards = append(forwards, forward)\n\t}\n\treturn forwards\n}", "func (t *Type) WireArgumentDeclaration(n string) string {\n\tswitch t.WireFamily {\n\tcase FamilyKinds.TrivialCopy:\n\t\treturn t.String() + \" \" + n\n\tcase FamilyKinds.Reference, FamilyKinds.Vector:\n\t\treturn t.String() + \"& \" + n\n\tcase FamilyKinds.String:\n\t\treturn \"const \" + t.String() + \"& \" + n\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Unknown wire family kind %v\", t.WireFamily))\n\t}\n}", "func CreateForwardAnnotationsMap(splittedAnnotations []string) map[string]string {\n\tforwardAnnotationsMap := make(map[string]string)\n\n\tfor _, annotation := range splittedAnnotations {\n\t\tparsedAnnotation := strings.SplitN(annotation, \":\", 2)\n\t\tif len(parsedAnnotation) != 2 {\n\t\t\tlogrus.Warningf(\"Wrong annotation provided to forward to ingress : %v\", annotation)\n\t\t} else {\n\t\t\tforwardAnnotationsMap[parsedAnnotation[0]] = strings.Trim(parsedAnnotation[1], \" \")\n\t\t}\n\t}\n\n\treturn forwardAnnotationsMap\n}", "func parseGenDecl(bci *BenchClientInfo, decl *ast.GenDecl) {\n\tif decl.Tok != token.TYPE {\n\t\treturn\n\t}\n\n\tfor _, s := range decl.Specs {\n\t\tts := s.(*ast.TypeSpec)\n\t\tiface, ok := ts.Type.(*ast.InterfaceType)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tifaceName := ts.Name.String()\n\t\tif !strings.HasSuffix(ifaceName, \"Client\") {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.Index(ifaceName, \"Service_\") > 0 {\n\t\t\t// TODO: support streaming RPC\n\t\t\tcontinue\n\t\t}\n\t\tbci.Services[ifaceName] = &service{RPCs: make(map[string]rpc)}\n\n\t\tfor _, m := range iface.Methods.List {\n\t\t\tmethodName := m.Names[0].String()\n\t\t\tmt := m.Type.(*ast.FuncType)\n\n\t\t\tvar streaming bool\n\t\t\tfor _, r := range mt.Results.List {\n\t\t\t\tif strings.Index(types.ExprString(r.Type), \"Service_\") > 0 {\n\t\t\t\t\t// TODO: support streaming RPC\n\t\t\t\t\tstreaming = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tswitch {\n\t\t\tcase mt.Params.NumFields() == unaryArgs && !streaming:\n\t\t\t\targName := types.ExprString(mt.Params.List[1].Type)[1:]\n\t\t\t\tbci.Services[ifaceName].RPCs[methodName] = rpc{Unary: true, In: argName}\n\t\t\tdefault:\n\t\t\t\t// TODO: support streaming RPC\n\t\t\t\tbci.Services[ifaceName].RPCs[methodName] = rpc{Stream: true}\n\t\t\t}\n\t\t}\n\t}\n}", "func lexDirective(fin *bufio.Reader) (e DocumentElement, err error) {\n\tr := '\\000'\n\tr, _, err = fin.ReadRune()\n\tif r != '@' {\n\t\terr = errors.New(\"Missing '@' in directive\")\n\t}\n\tif err != nil {\n\t\treturn\n\t}\n\n\tname := \"\"\n\tname, err = readWord(fin)\n\tif err != nil {\n\t\treturn\n\t}\n\n\targDirectives := map[string]bool{\n\t\t\"chapter\": true,\n\t\t\"part\": true,\n\t\t\"prologue\": true,\n\t\t\"note\": true,\n\t}\n\n\tif name == \"scene\" {\n\t\te = SceneBreak(true)\n\t\treturn\n\t} else if _, ok := argDirectives[name]; !ok {\n\t\terr = errors.New(\"Invalid directive\")\n\t\treturn\n\t}\n\n\trawArg := []rune{}\n\tfor {\n\t\tr, _, err = fin.ReadRune()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tif r == '\\n' {\n\t\t\tbreak\n\t\t}\n\t\trawArg = append(rawArg, r)\n\t}\n\targ := strings.TrimSpace(string(rawArg))\n\n\tif name == \"chapter\" {\n\t\te = ChapterBreak(arg)\n\t} else if name == \"part\" {\n\t\te = PartBreak(arg)\n\t} else if name == \"prologue\" {\n\t\te = PrologueBreak(arg)\n\t}\n\n\treturn\n}", "func (def *Definition) Fieldnames() []string {\n\ttypeList := make([]string, 0)\n\tt := TraverserMethods{EnterFunction: func(adaType IAdaType, parentType IAdaType, level int, x interface{}) error {\n\t\ttypeList = append(typeList, adaType.Name())\n\t\treturn nil\n\t}}\n\n\t_ = def.TraverseTypes(t, true, typeList)\n\treturn typeList\n}", "func importOrder(deps map[string][]string) ([]string, error) {\n\t// add all nodes and edges\n\tvar remainingNodes = map[string]struct{}{}\n\tvar graph = map[edge]struct{}{}\n\tfor to, froms := range deps {\n\t\tremainingNodes[to] = struct{}{}\n\t\tfor _, from := range froms {\n\t\t\tremainingNodes[from] = struct{}{}\n\t\t\tgraph[edge{from: from, to: to}] = struct{}{}\n\t\t}\n\t}\n\n\t// find initial nodes without any dependencies\n\tsorted := findAndRemoveNodesWithoutDependencies(remainingNodes, graph)\n\tfor i := 0; i < len(sorted); i++ {\n\t\tnode := sorted[i]\n\t\tremoveEdgesFrom(node, graph)\n\t\tsorted = append(sorted, findAndRemoveNodesWithoutDependencies(remainingNodes, graph)...)\n\t}\n\tif len(remainingNodes) > 0 {\n\t\treturn nil, fmt.Errorf(\"cycle: remaining nodes: %#v, remaining edges: %#v\", remainingNodes, graph)\n\t}\n\t//for _, n := range sorted {\n\t//\tfmt.Println(\"topological order\", n)\n\t//}\n\treturn sorted, nil\n}", "func buildSynonyms(a *Parser) map[string]string {\n\tsynonyms := make(map[string]string)\n\tfor _, n := range a.seq {\n\t\tp := a.params[n]\n\t\tif n == p.name {\n\t\t\tif len(n) == 0 {\n\t\t\t\tsynonyms[n] = \"(nameless)\"\n\t\t\t} else {\n\t\t\t\tsynonyms[n] = n\n\t\t\t}\n\t\t} else {\n\t\t\tsynonyms[p.name] += \", \" + n\n\t\t}\n\t}\n\treturn synonyms\n}", "func (s *BasePlSqlParserListener) EnterPragma_elements(ctx *Pragma_elementsContext) {}", "func (parser *Parser) var_declar() (*Declaration, error) {\n\tparser.trace(\"VAR_DECLAR\")\n\tdefer parser.untrace()\n\tdataType, err, found := parser.match(fxsymbols.DataType)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !found {\n\t\treturn nil, ErrNoMatch\n\t}\n\tid, err, found := parser.match(fxsymbols.Id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !found {\n\t\treturn nil, parser.Errorf(ErrNoId)\n\t}\n\t_, err, found = parser.match(fxsymbols.Scol)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !found {\n\t\treturn nil, parser.Errorf(ErrNoScol)\n\t}\n\tif parser.symbEnvs.GetSymb(id.Lex) != nil {\n\t\treturn nil, fxsymbols.ErrVarExists\n\t}\n\tparser.symbEnvs.PutVar(id)\n\treturn NewDeclaration(id.Lex, fxlex.DataTypeConst(dataType.Val)), nil\n}", "func (parser *Parser) moreParams() ([]*Declaration, error) {\n\tparser.trace(\"MORE_PARAMS\")\n\tdefer parser.untrace()\n\t_, _, found := parser.match(fxsymbols.Coma)\n\n\tif !found {\n\t\treturn nil, nil\n\t}\n\tparam, err := parser.parameter()\n\tif err != nil {\n\t\tif err == ErrNoMatch {\n\t\t\terr = parser.Errorf(ErrNoParam)\n\t\t}\n\t\treturn nil, err\n\t}\n\tparams, err := parser.moreParams()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn append([]*Declaration{param}, params...), nil\n}", "func ParseIncompleteVariableRef(text string) (explode bool, ns string, name string) {\n\treturn parseVariableRef(text, false)\n}", "func (ra *RenameAnalysis) Requires() []string {\n\treturn []string{DependencyBlobCache, DependencyTreeChanges}\n}", "func (info *fileInfo) addVarDecls() {\n\tgen := &ast.GenDecl{\n\t\tTokPos: info.importCPos,\n\t\tTok: token.VAR,\n\t\tLparen: info.importCPos,\n\t\tRparen: info.importCPos,\n\t}\n\tnames := make([]string, 0, len(info.globals))\n\tfor name := range info.globals {\n\t\tnames = append(names, name)\n\t}\n\tsort.Strings(names)\n\tfor _, name := range names {\n\t\tglobal := info.globals[name]\n\t\tobj := &ast.Object{\n\t\t\tKind: ast.Typ,\n\t\t\tName: \"C.\" + name,\n\t\t}\n\t\tvalueSpec := &ast.ValueSpec{\n\t\t\tNames: []*ast.Ident{&ast.Ident{\n\t\t\t\tNamePos: info.importCPos,\n\t\t\t\tName: \"C.\" + name,\n\t\t\t\tObj: obj,\n\t\t\t}},\n\t\t\tType: global.typeExpr,\n\t\t}\n\t\tobj.Decl = valueSpec\n\t\tgen.Specs = append(gen.Specs, valueSpec)\n\t}\n\tinfo.Decls = append(info.Decls, gen)\n}", "func (self *EasyHandler) Namespaces() []string {\n\treturn []string{\"000001\",\"000002\"};\n}", "func Parse(description string) (deps []Dep) {\n\tfor _, footerValue := range footer.ParseMessage(description)[cqDependKey] {\n\t\tfor _, v := range strings.Split(footerValue, \",\") {\n\t\t\tif dep, err := parseSingleDep(v); err == nil {\n\t\t\t\tdeps = append(deps, dep)\n\t\t\t}\n\t\t}\n\t}\n\tif len(deps) <= 1 {\n\t\treturn deps\n\t}\n\tsort.Slice(deps, func(i, j int) bool { return deps[i].cmp(deps[j]) == 1 })\n\t// Remove duplicates. We don't use the map in the first place, because\n\t// duplicates are highly unlikely in practice and sorting is nice for\n\t// determinism.\n\tl := 0\n\tfor i := 1; i < len(deps); i++ {\n\t\tif d := deps[i]; d.cmp(deps[l]) != 0 {\n\t\t\tl += 1\n\t\t\tdeps[l] = d\n\t\t}\n\t}\n\treturn deps[:l+1]\n}", "func ParseFQName(fqNameString string) []string {\n\tif fqNameString == \"\" {\n\t\treturn nil\n\t}\n\treturn strings.Split(fqNameString, \":\")\n}", "func getFieldList(p *program.Program, f *ast.FunctionDecl, fieldTypes []string) (\n\t_ *goast.FieldList, err error) {\n\tdefer func() {\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"error in function field list. err = %v\", err)\n\t\t}\n\t}()\n\tr := []*goast.Field{}\n\tfor i := range fieldTypes {\n\t\tif len(f.Children()) <= i {\n\t\t\terr = fmt.Errorf(\"not correct type/children: %d, %d\",\n\t\t\t\tlen(f.Children()), len(fieldTypes))\n\t\t\treturn\n\t\t}\n\t\tn := f.Children()[i]\n\t\tif v, ok := n.(*ast.ParmVarDecl); ok {\n\t\t\tt, err := types.ResolveType(p, fieldTypes[i])\n\t\t\tif err != nil {\n\t\t\t\terr = fmt.Errorf(\"FieldList type: %s. %v\", fieldTypes[i], err)\n\t\t\t\tp.AddMessage(p.GenerateWarningMessage(err, f))\n\t\t\t\terr = nil // ignore error\n\t\t\t\tt = \"C4GO_UNDEFINE_TYPE\"\n\t\t\t}\n\n\t\t\tif t == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tr = append(r, &goast.Field{\n\t\t\t\tNames: []*goast.Ident{util.NewIdent(v.Name)},\n\t\t\t\tType: goast.NewIdent(t),\n\t\t\t})\n\t\t}\n\t}\n\n\t// for function argument: ...\n\tif strings.Contains(f.Type, \"...\") {\n\t\tr = append(r, &goast.Field{\n\t\t\tNames: []*goast.Ident{util.NewIdent(\"c4goArgs\")},\n\t\t\tType: &goast.Ellipsis{\n\t\t\t\tEllipsis: 1,\n\t\t\t\tElt: &goast.InterfaceType{\n\t\t\t\t\tInterface: 1,\n\t\t\t\t\tMethods: &goast.FieldList{\n\t\t\t\t\t\tOpening: 1,\n\t\t\t\t\t},\n\t\t\t\t\tIncomplete: false,\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t}\n\n\treturn &goast.FieldList{\n\t\tList: r,\n\t}, nil\n}", "func (resource *ResourceType) AsDeclarations(codeGenerationContext *CodeGenerationContext, declContext DeclarationContext) []dst.Decl {\n\t/*\n\t\tstart off with:\n\t\t\tmetav1.TypeMeta `json:\",inline\"`\n\t\t\tmetav1.ObjectMeta `json:\"metadata,omitempty\"`\n\n\t\tthen the Spec/Status properties\n\t*/\n\tvar fields []*dst.Field\n\tfor _, property := range resource.EmbeddedProperties() {\n\t\tf := property.AsField(codeGenerationContext)\n\t\tif f != nil {\n\t\t\tfields = append(fields, f)\n\t\t}\n\t}\n\n\tfor _, property := range resource.Properties().AsSlice() {\n\t\tf := property.AsField(codeGenerationContext)\n\t\tif f != nil {\n\t\t\tfields = append(fields, f)\n\t\t}\n\t}\n\n\tif len(fields) > 0 {\n\t\t// A Before:EmptyLine decoration on the first field looks odd, so we force it to Before:NewLine\n\t\t// This makes the output look nicer 🙂\n\t\tfields[0].Decs.Before = dst.NewLine\n\t}\n\n\tresourceTypeSpec := &dst.TypeSpec{\n\t\tName: dst.NewIdent(declContext.Name.Name()),\n\t\tType: &dst.StructType{\n\t\t\tFields: &dst.FieldList{List: fields},\n\t\t},\n\t}\n\n\tvar comments dst.Decorations\n\n\t// Add required RBAC annotations, only on storage version\n\tif resource.isStorageVersion {\n\t\tgroup := declContext.Name.PackageReference().Group()\n\t\tgroup = strings.ToLower(group + GroupSuffix)\n\t\tresourceName := strings.ToLower(declContext.Name.Plural().Name())\n\n\t\tastbuilder.AddComment(&comments, fmt.Sprintf(\"// +kubebuilder:rbac:groups=%s,resources=%s,verbs=get;list;watch;create;update;patch;delete\", group, resourceName))\n\t\tastbuilder.AddComment(&comments, fmt.Sprintf(\"// +kubebuilder:rbac:groups=%s,resources={%s/status,%s/finalizers},verbs=get;update;patch\", group, resourceName, resourceName))\n\n\t\t// This newline is REQUIRED for controller-gen to realize these comments are here. Without it, they are silently ignored, see:\n\t\t// https://github.com/kubernetes-sigs/controller-tools/issues/436\n\t\tcomments = append(comments, \"\\n\")\n\t}\n\n\tastbuilder.AddComment(&comments, \"// +kubebuilder:object:root=true\")\n\tif resource.status != nil {\n\t\tastbuilder.AddComment(&comments, \"// +kubebuilder:subresource:status\")\n\t}\n\n\tif resource.isStorageVersion {\n\t\tastbuilder.AddComment(&comments, \"// +kubebuilder:storageversion\")\n\t}\n\n\t// Add any custom kubebuilder annotations\n\tif len(resource.annotations) > 0 {\n\t\tastbuilder.AddComments(&comments, resource.annotations)\n\t}\n\n\tastbuilder.AddUnwrappedComments(&comments, declContext.Description)\n\tAddValidationComments(&comments, declContext.Validations)\n\n\tresourceDeclaration := &dst.GenDecl{\n\t\tTok: token.TYPE,\n\t\tSpecs: []dst.Spec{resourceTypeSpec},\n\t\tDecs: dst.GenDeclDecorations{\n\t\t\tNodeDecs: dst.NodeDecs{\n\t\t\t\tBefore: dst.EmptyLine,\n\t\t\t\tAfter: dst.EmptyLine,\n\t\t\t\tStart: comments,\n\t\t\t},\n\t\t},\n\t}\n\n\tvar declarations []dst.Decl\n\tdeclarations = append(declarations, resourceDeclaration)\n\tdeclarations = append(declarations, resource.InterfaceImplementer.AsDeclarations(codeGenerationContext, declContext.Name, nil)...)\n\tdeclarations = append(declarations, resource.generateMethodDecls(codeGenerationContext, declContext.Name)...)\n\tdeclarations = append(declarations, resource.resourceListTypeDecls(codeGenerationContext, declContext.Name, declContext.Description)...)\n\n\treturn declarations\n}", "func (p FloatFormalParam) Declaration() string {\n\t// This is a declaration for formal params (we need the * for pointer)\n\treturn p.Type + \" \" + p.Reference()\n}", "func (p *parser) declaration() Node {\n\tv := p.vr()\n\top := p.expect(TokenAsgn)\n\tb := p.expression()\n\treturn newBinary(op, v, b)\n}", "func Dependencies(g *Graph) (pacman.Packages, aur.Packages, []string) {\n\trps := make(pacman.Packages, 0)\n\taps := make(aur.Packages, 0)\n\tups := make([]string, 0)\n\n\tnames := make(map[string]bool)\n\tnodes := AllNodesBottomUp(g)\n\tfor _, vn := range nodes {\n\t\tn := vn.(*Node)\n\t\tif names[n.PkgName()] {\n\t\t\tcontinue\n\t\t}\n\n\t\tnames[n.PkgName()] = true\n\t\tswitch p := n.AnyPackage.(type) {\n\t\tcase *aur.Package:\n\t\t\taps = append(aps, p)\n\t\tcase *pacman.Package:\n\t\t\tif p.Origin == pacman.UnknownOrigin {\n\t\t\t\tups = append(ups, p.Name)\n\t\t\t} else {\n\t\t\t\trps = append(rps, p)\n\t\t\t}\n\t\tdefault:\n\t\t\tpanic(\"unexpected type of package in graph\")\n\t\t}\n\t}\n\treturn rps, aps, ups\n}", "func HandleForwardProto(bot *Bot, data []byte) (ack []byte, err error) {\n\treturn\n}", "func (d *RouteDescriptor) Dependencies(key string, route *l3.Route) []kvs.Dependency {\n\tvar dependencies []kvs.Dependency\n\t// the outgoing interface must exist and be UP\n\tif route.OutgoingInterface != \"\" {\n\t\tdependencies = append(dependencies, kvs.Dependency{\n\t\t\tLabel: routeOutInterfaceDep,\n\t\t\tKey: interfaces.InterfaceKey(route.OutgoingInterface),\n\t\t})\n\t}\n\n\t// non-zero VRFs\n\tvar protocol l3.VrfTable_Protocol\n\t_, isIPv6, _ := addrs.ParseIPWithPrefix(route.DstNetwork)\n\tif isIPv6 {\n\t\tprotocol = l3.VrfTable_IPV6\n\t}\n\tif route.VrfId != 0 {\n\t\tdependencies = append(dependencies, kvs.Dependency{\n\t\t\tLabel: vrfTableDep,\n\t\t\tKey: l3.VrfTableKey(route.VrfId, protocol),\n\t\t})\n\t}\n\tif route.Type == l3.Route_INTER_VRF && route.ViaVrfId != 0 {\n\t\tdependencies = append(dependencies, kvs.Dependency{\n\t\t\tLabel: viaVrfTableDep,\n\t\t\tKey: l3.VrfTableKey(route.ViaVrfId, protocol),\n\t\t})\n\t}\n\n\t// if destination network is netalloc reference, then the address must be allocated first\n\tallocDep, hasAllocDep := d.addrAlloc.GetAddressAllocDep(route.DstNetwork,\n\t\t\"\", \"dst_network-\")\n\tif hasAllocDep {\n\t\tdependencies = append(dependencies, allocDep)\n\t}\n\t// if GW is netalloc reference, then the address must be allocated first\n\tallocDep, hasAllocDep = d.addrAlloc.GetAddressAllocDep(route.NextHopAddr,\n\t\troute.OutgoingInterface, \"gw_addr-\")\n\tif hasAllocDep {\n\t\tdependencies = append(dependencies, allocDep)\n\t}\n\n\t// TODO: perhaps check GW routability\n\treturn dependencies\n}", "func resolve(file *ast.File, scopes map[ast.Node]*Scope) error {\n\t// TODO: Verify that type keywords cannot be redeclared.\n\n\t// Pre-pass, add keyword types and universe scope.\n\tuniverse := NewScope(nil)\n\tcharIdent := &ast.Ident{NamePos: universePos, Name: \"char\"}\n\tcharDecl := &ast.TypeDef{DeclType: charIdent, TypeName: charIdent, Val: &types.Basic{Kind: types.Char}}\n\tcharIdent.Decl = charDecl\n\tintIdent := &ast.Ident{NamePos: universePos, Name: \"int\"}\n\tintDecl := &ast.TypeDef{DeclType: intIdent, TypeName: intIdent, Val: &types.Basic{Kind: types.Int}}\n\tintIdent.Decl = intDecl\n\tvoidIdent := &ast.Ident{NamePos: universePos, Name: \"void\"}\n\tvoidDecl := &ast.TypeDef{DeclType: voidIdent, TypeName: voidIdent, Val: &types.Basic{Kind: types.Void}}\n\tvoidIdent.Decl = voidDecl\n\tuniverseDecls := []*ast.TypeDef{\n\t\tcharDecl,\n\t\tintDecl,\n\t\tvoidDecl,\n\t}\n\tfor _, decl := range universeDecls {\n\t\tif err := universe.Insert(decl); err != nil {\n\t\t\treturn errutil.Err(err)\n\t\t}\n\t}\n\n\t// First pass, add global declarations to file scope.\n\tfileScope := NewScope(universe)\n\tscopes[file] = fileScope\n\tfileScope.IsDef = func(decl ast.Decl) bool {\n\t\t// Consider variable declarations as tentative definitions; i.e. return\n\t\t// false, unless variable definition.\n\t\treturn decl.Value() != nil\n\t}\n\tfor _, decl := range file.Decls {\n\t\tif err := fileScope.Insert(decl); err != nil {\n\t\t\treturn errutil.Err(err)\n\t\t}\n\t}\n\n\t// skip specifies that the block statement body of a function declaration\n\t// should skip creating a nested scope, as it has already been created by its\n\t// function declaration, so that function parameters are placed within the\n\t// correct scope.\n\tskip := false\n\n\t// scope specifies the current lexical scope.\n\tscope := fileScope\n\n\t// resolve performs identifier resolution, mapping identifiers to the\n\t// corresponding declarations of the closest lexical scope.\n\tresolve := func(n ast.Node) error {\n\t\tswitch n := n.(type) {\n\t\tcase ast.Decl:\n\t\t\t// Insert declaration into the scope if not already added by the\n\t\t\t// file scope pre-pass.\n\t\t\tif scope != fileScope {\n\t\t\t\tif err := scope.Insert(n); err != nil {\n\t\t\t\t\treturn errutil.Err(err)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Create nested scope for function definitions.\n\t\t\tif fn, ok := n.(*ast.FuncDecl); ok {\n\t\t\t\tif astutil.IsDef(fn) {\n\t\t\t\t\tskip = true\n\t\t\t\t}\n\t\t\t\tscope = NewScope(scope)\n\t\t\t\tscopes[fn] = scope\n\t\t\t}\n\t\tcase *ast.BlockStmt:\n\t\t\tif !skip {\n\t\t\t\tscope = NewScope(scope)\n\t\t\t\tscopes[n] = scope\n\t\t\t}\n\t\t\tskip = false\n\t\tcase *ast.Ident:\n\t\t\tdecl, ok := scope.Lookup(n.Name)\n\t\t\tif !ok {\n\t\t\t\treturn errors.Newf(n.Start(), \"undeclared identifier %q\", n)\n\t\t\t}\n\t\t\tn.Decl = decl\n\t\t}\n\t\treturn nil\n\t}\n\n\t// after reverts to the outer scope after traversing block statements.\n\tafter := func(n ast.Node) error {\n\t\tif _, ok := n.(*ast.BlockStmt); ok {\n\t\t\tscope = scope.Outer\n\t\t} else if fn, ok := n.(*ast.FuncDecl); ok && !astutil.IsDef(fn) {\n\t\t\tscope = scope.Outer\n\t\t}\n\t\treturn nil\n\t}\n\n\t// Walk the AST of the given file to resolve identifiers.\n\tif err := astutil.WalkBeforeAfter(file, resolve, after); err != nil {\n\t\treturn errutil.Err(err)\n\t}\n\n\treturn nil\n}", "func (this *RequireParser) Parse() (sh header.Header, ParseException error) {\n\trequireList := header.NewRequireList()\n\n\tvar ch byte\n\tlexer := this.GetLexer()\n\tthis.HeaderName(TokenTypes_REQUIRE)\n\n\tfor ch, _ = lexer.LookAheadK(0); ch != '\\n'; ch, _ = lexer.LookAheadK(0) {\n\t\tr := header.NewRequire()\n\t\tr.SetHeaderName(core.SIPHeaderNames_REQUIRE)\n\n\t\t// Parsing the option tag\n\t\tlexer.Match(TokenTypes_ID)\n\t\ttoken := lexer.GetNextToken()\n\t\tr.SetOptionTag(token.GetTokenValue())\n\t\tlexer.SPorHT()\n\n\t\trequireList.PushBack(r)\n\n\t\tfor ch, _ = lexer.LookAheadK(0); ch == ','; ch, _ = lexer.LookAheadK(0) {\n\t\t\tlexer.Match(',')\n\t\t\tlexer.SPorHT()\n\n\t\t\tr = header.NewRequire()\n\n\t\t\t// Parsing the option tag\n\t\t\tlexer.Match(TokenTypes_ID)\n\t\t\ttoken = lexer.GetNextToken()\n\t\t\tr.SetOptionTag(token.GetTokenValue())\n\t\t\tlexer.SPorHT()\n\n\t\t\trequireList.PushBack(r)\n\t\t}\n\n\t}\n\n\treturn requireList, nil\n}", "func (p *Parser) varsdec(tokens []obj.Token) {\n\t// Name is not defined?\n\tif len(tokens) < 2 {\n\t\tfirst := tokens[0]\n\t\tfract.IPanicC(first.File, first.Line, first.Column+len(first.Val), obj.SyntaxPanic, \"Name is not given!\")\n\t}\n\tif tokens[0].Type != fract.Name {\n\t\tfract.IPanic(tokens[0], obj.SyntaxPanic, \"Invalid syntax!\")\n\t}\n\tvar inf varInfo\n\tinf.shortDeclaration = true\n\tp.varadd(&p.defs, inf, tokens)\n}", "func (d *ABFToInterfaceDescriptor) Dependencies(key string, emptyVal proto.Message) []api.Dependency {\n\t_, ifName, _ := vpp_abf.ParseToInterfaceKey(key)\n\treturn []api.Dependency{\n\t\t{\n\t\t\tLabel: interfaceDep,\n\t\t\tKey: vpp_interfaces.InterfaceKey(ifName),\n\t\t},\n\t}\n}", "func (s *schg) findReferences(schema map[string]interface{}) []string {\n\tvar refs []string\n\tfor name, cont := range schema {\n\t\tswitch reflect.ValueOf(cont).Kind() {\n\t\tcase reflect.Map:\n\t\t\trefs = append(refs, s.findReferences(cont.(map[string]interface{}))...)\n\t\tcase reflect.String:\n\t\t\tif name == `$ref` {\n\t\t\t\ttoks := strings.Split(cont.(string), `/`)\n\t\t\t\tif len(toks) == 3 && toks[0] == `#` && toks[1] == `definitions` {\n\t\t\t\t\trefs = append(refs, toks[2])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn refs\n}", "func printTypedNames(w io.Writer, prefix string, ns []TypedEntry) {\n\tif len(ns) == 0 {\n\t\treturn\n\t}\n\ttprev := typeString(ns[0].Types)\n\tsep := prefix\n\tfor _, n := range ns {\n\t\ttcur := typeString(n.Types)\n\t\tif tcur != tprev {\n\t\t\tif tprev == \"\" {\n\t\t\t\t// Should be impossible.\n\t\t\t\tpanic(n.Location.String() + \": untyped declarations in the middle of a typed list\")\n\t\t\t}\n\t\t\tfmt.Fprintf(w, \" - %s\", tprev)\n\t\t\ttprev = tcur\n\t\t\tsep = prefix\n\t\t\tif sep == \"\" {\n\t\t\t\tsep = \" \"\n\t\t\t}\n\t\t}\n\t\tfmt.Fprintf(w, \"%s%s\", sep, n.Str)\n\t\tsep = \" \"\n\t}\n\tif tprev != \"\" {\n\t\tfmt.Fprintf(w, \" - %s\", tprev)\n\t}\n}", "func DeclEnd() VERTEXELEMENT {\n\treturn VERTEXELEMENT{0xFF, 0, DECLTYPE_UNUSED, 0, 0, 0}\n}", "func (g *irgen) decls(res *ir.Nodes, decls []syntax.Decl) {\n\tfor _, decl := range decls {\n\t\tswitch decl := decl.(type) {\n\t\tcase *syntax.ConstDecl:\n\t\t\tg.constDecl(res, decl)\n\t\tcase *syntax.FuncDecl:\n\t\t\tg.funcDecl(res, decl)\n\t\tcase *syntax.TypeDecl:\n\t\t\tif ir.CurFunc == nil {\n\t\t\t\tcontinue // already handled in irgen.generate\n\t\t\t}\n\t\t\tg.typeDecl(res, decl)\n\t\tcase *syntax.VarDecl:\n\t\t\tg.varDecl(res, decl)\n\t\tdefault:\n\t\t\tg.unhandled(\"declaration\", decl)\n\t\t}\n\t}\n}", "func (s *BasecluListener) EnterDecl_list(ctx *Decl_listContext) {}", "func (s *BasePlSqlParserListener) ExitSeq_of_declare_specs(ctx *Seq_of_declare_specsContext) {}", "func (f *File) genDecl(node ast.Node) bool {\n\tdecl, ok := node.(*ast.GenDecl)\n\tif !ok || decl.Tok != token.TYPE { // We only care about Type declarations.\n\t\treturn true\n\t}\n\t// The name of the type of the constants we are declaring.\n\t// Can change if this is a multi-element declaration.\n\ttyp := \"\"\n\t// Loop over the elements of the declaration. Each element is a ValueSpec:\n\t// a list of names possibly followed by a type, possibly followed by values.\n\t// If the type and value are both missing, we carry down the type (and value,\n\t// but the \"go/types\" package takes care of that).\n\tfor _, spec := range decl.Specs {\n\t\ttspec := spec.(*ast.TypeSpec) // Guaranteed to succeed as this is TYPE.\n\t\tif tspec.Type != nil {\n\t\t\t// \"X T\". We have a type. Remember it.\n\t\t\ttyp = tspec.Name.Name\n\t\t}\n\t\tif typ != f.typeName {\n\t\t\t// This is not the type we're looking for.\n\t\t\tcontinue\n\t\t}\n\t\t// We now have a list of names (from one line of source code) all being\n\t\t// declared with the desired type.\n\n\t\tstructType, ok := tspec.Type.(*ast.StructType)\n\t\tif !ok {\n\t\t\t//not a struct type\n\t\t\tcontinue\n\t\t}\n\n\t\ttypesObj, typeObjOk := f.pkg.defs[tspec.Name]\n\t\tif !typeObjOk {\n\t\t\tlog.Fatalf(\"no type info found for struct %s\", typ)\n\t\t}\n\n\t\tfor _, fieldLine := range structType.Fields.List {\n\t\t\tfor _, field := range fieldLine.Names {\n\t\t\t\t//skip struct padding\n\t\t\t\tif field.Name == \"_\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfieldObj, _, _ := types.LookupFieldOrMethod(typesObj.Type(), false, f.pkg.typesPkg, field.Name)\n\n\t\t\t\ttypeStr := fieldObj.Type().String()\n\t\t\t\ttags := parseFieldTags(fieldLine.Tag)\n\n\t\t\t\t//Skip here so we don't include rubbish import lines\n\t\t\t\tif tags[\"exclude_dao\"].Value == \"true\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tprocessedTypeStr, importPath := processTypeStr(typeStr)\n\t\t\t\t//log.Printf(\"processedTypeStr: %s, importPath: %s\", processedTypeStr, importPath)\n\n\t\t\t\tif importPath != \"\" && !importExists(importPath, f.imports) {\n\n\t\t\t\t\tf.imports = append(f.imports, Import{importPath})\n\n\t\t\t\t}\n\n\t\t\t\tv := Field{\n\t\t\t\t\tName: field.Name,\n\t\t\t\t\tTags: tags,\n\t\t\t\t\tTypeName: processedTypeStr,\n\t\t\t\t}\n\t\t\t\tf.fields = append(f.fields, v)\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "func (p *Parser) parseFinalDecl() {\n\tdefer un(trace(p, \"parseFinalDecl\"))\n\n\tp.next()\n}", "func (parser *Parser) funcDeclar() (*Function, error) {\n\tparser.trace(\"FUNC_DECLAR\")\n\tdefer parser.untrace()\n\t_, err, found := parser.match(fxsymbols.Func)\n\tif err != nil {\n\t\treturn nil, err\n\t\t//return ErrSyntax\n\t}\n\tif !found {\n\t\treturn nil, ErrNoMatch\n\t}\n\ttoken, _, found := parser.match(fxsymbols.Id)\n\tif !found {\n\t\treturn nil, parser.Errorf(ErrNoId)\n\t}\n\tif parser.symbEnvs.GetSymb(token.Lex) != nil {\n\t\treturn nil, fxsymbols.ErrFuncExists\n\t}\n\tparser.symbEnvs.PutFunction(token)\n\tparser.symbEnvs.PushEnv()\n\tdefer parser.symbEnvs.PopEnv()\n\t_, _, found = parser.match(fxsymbols.LeftPar)\n\tif !found {\n\t\treturn nil, parser.Errorf(ErrNoLeftPar)\n\t}\n\tparams, err := parser.parameters()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_, _, found = parser.match(fxsymbols.RightPar)\n\tif !found {\n\t\treturn nil, parser.Errorf(ErrNoRightPar)\n\t}\n\tbody, err := parser.body()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn NewFunc(token.Lex, params, body), nil\n}", "func (s *BasePlSqlParserListener) EnterMap_order_func_declaration(ctx *Map_order_func_declarationContext) {\n}", "func lexMetadataDirective(\n\tfin *bufio.Reader,\n) (name string, args []string, err error) {\n\terr = eatWhitespace(fin)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tr, _, err := fin.ReadRune()\n\tif r != '@' {\n\t\terr = errors.New(\"Expected directive\")\n\t\treturn\n\t}\n\n\tname, err = readWord(fin)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor name != \"begin\" && name != \"scene\" {\n\t\terr = eatWhitespace(fin)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tr, _, err = fin.ReadRune()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tfin.UnreadRune()\n\t\tif r == '@' {\n\t\t\tbreak\n\t\t}\n\n\t\targ := \"\"\n\t\targ, err = readPlainText(fin)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\targs = append(args, arg)\n\t}\n\n\treturn\n}", "func _imports(nameAndPaths ...string) *ast.GenDecl {\n\tdecl := &ast.GenDecl{\n\t\tTok: token.IMPORT,\n\t\tSpecs: []ast.Spec{},\n\t}\n\tfor i := 0; i < len(nameAndPaths); i += 2 {\n\t\tspec := &ast.ImportSpec{\n\t\t\tName: _i(nameAndPaths[i]),\n\t\t\tPath: _s(nameAndPaths[i+1]),\n\t\t}\n\t\tdecl.Specs = append(decl.Specs, spec)\n\t}\n\treturn decl\n}", "func (g *Generator) createIndexAndNameDecl(run []Value, typeName string, suffix string) (string, string) {\n\tb := new(bytes.Buffer)\n\tindexes := make([]int, len(run))\n\tfor i := range run {\n\t\tb.WriteString(run[i].nameInfo.trimmedName)\n\t\tindexes[i] = b.Len()\n\t}\n\tnameConst := fmt.Sprintf(\"_%s_name%s = %q\", typeName, suffix, b.String())\n\tnameLen := b.Len()\n\tb.Reset()\n\t_, _ = fmt.Fprintf(b, \"_%s_index%s = [...]uint%d{0, \", typeName, suffix, usize(nameLen))\n\tfor i, v := range indexes {\n\t\tif i > 0 {\n\t\t\t_, _ = fmt.Fprintf(b, \", \")\n\t\t}\n\t\t_, _ = fmt.Fprintf(b, \"%d\", v)\n\t}\n\t_, _ = fmt.Fprintf(b, \"}\")\n\treturn b.String(), nameConst\n}", "func (s *Service) ReferencedIncludes() ([]*Include, error) {\n\tvar err error\n\tincludes := []*Include{}\n\tincludesSet := make(map[string]*Include)\n\n\t// Check extended service.\n\tif s.Extends != \"\" && strings.Contains(s.Extends, \".\") {\n\t\tincludeName := s.Extends[0:strings.Index(s.Extends, \".\")]\n\t\tinclude := s.Frugal.Include(includeName)\n\t\tif include == nil {\n\t\t\treturn nil, fmt.Errorf(\"Service %s extends references invalid include %s\",\n\t\t\t\ts.Name, s.Extends)\n\t\t}\n\t\tif _, ok := includesSet[includeName]; !ok {\n\t\t\tincludesSet[includeName] = include\n\t\t\tincludes = append(includes, include)\n\t\t}\n\t}\n\n\t// Check methods.\n\tfor _, method := range s.Methods {\n\t\t// Check arguments.\n\t\tfor _, arg := range method.Arguments {\n\t\t\tincludesSet, includes, err = addInclude(includesSet, includes, arg.Type, s.Frugal)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\t// Check return type.\n\t\tif method.ReturnType != nil {\n\t\t\tincludesSet, includes, err = addInclude(includesSet, includes, method.ReturnType, s.Frugal)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Check exceptions.\n\t\tfor _, exception := range method.Exceptions {\n\t\t\tincludesSet, includes, err = addInclude(includesSet, includes, exception.Type, s.Frugal)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn includes, nil\n}", "func pragmaFields(s string) []string {\n\tvar a []string\n\tinQuote := false\n\tfieldStart := -1 // Set to -1 when looking for start of field.\n\tfor i, c := range s {\n\t\tswitch {\n\t\tcase c == '\"':\n\t\t\tif inQuote {\n\t\t\t\tinQuote = false\n\t\t\t\ta = append(a, s[fieldStart:i+1])\n\t\t\t\tfieldStart = -1\n\t\t\t} else {\n\t\t\t\tinQuote = true\n\t\t\t\tif fieldStart >= 0 {\n\t\t\t\t\ta = append(a, s[fieldStart:i])\n\t\t\t\t}\n\t\t\t\tfieldStart = i\n\t\t\t}\n\t\tcase !inQuote && isSpace(c):\n\t\t\tif fieldStart >= 0 {\n\t\t\t\ta = append(a, s[fieldStart:i])\n\t\t\t\tfieldStart = -1\n\t\t\t}\n\t\tdefault:\n\t\t\tif fieldStart == -1 {\n\t\t\t\tfieldStart = i\n\t\t\t}\n\t\t}\n\t}\n\tif !inQuote && fieldStart >= 0 { // Last field might end at the end of the string.\n\t\ta = append(a, s[fieldStart:])\n\t}\n\treturn a\n}", "func parseAttributes(doc *ast.CommentGroup) []Attribute {\n\tvar attributes []Attribute\n\tif doc == nil {\n\t\treturn attributes\n\t}\n\tfor _, comment := range doc.List {\n\t\tif strings.HasPrefix(comment.Text, \"//extern \") {\n\t\t\tnameattr := nameAttribute(strings.TrimSpace(comment.Text[9:]))\n\t\t\tattributes = append(attributes, nameattr)\n\t\t\tcontinue\n\t\t}\n\t\ttext := comment.Text[2:]\n\t\tif strings.HasPrefix(comment.Text, \"/*\") {\n\t\t\ttext = text[:len(text)-2]\n\t\t}\n\t\tattr := parseAttribute(strings.TrimSpace(text))\n\t\tif attr != nil {\n\t\t\tattributes = append(attributes, attr)\n\t\t}\n\t}\n\treturn attributes\n}", "func resolveMessageDependency(msg *desc.MessageDescriptor, dep messageDependency, encountered map[string]bool) {\n\tif encountered[msg.GetFullyQualifiedName()] {\n\t\treturn\n\t}\n\n\tdep[msg.GetFullyQualifiedName()] = msg\n\tfor _, f := range msg.GetFields() {\n\t\tif entity.IsMessageType(f.GetType()) {\n\t\t\tresolveMessageDependency(f.GetMessageType(), dep, encountered)\n\t\t}\n\t}\n}" ]
[ "0.5435614", "0.52448463", "0.5116722", "0.5092922", "0.50283545", "0.49758297", "0.49256507", "0.48094022", "0.4736206", "0.47182396", "0.47119275", "0.47046313", "0.46832284", "0.46707126", "0.4668004", "0.46470323", "0.46359763", "0.46307617", "0.46247268", "0.4615384", "0.4593736", "0.4561329", "0.45344633", "0.45303148", "0.45195314", "0.44555053", "0.444119", "0.44198632", "0.4419734", "0.44129083", "0.44071463", "0.43955427", "0.43452245", "0.43432906", "0.43400645", "0.4318232", "0.43118033", "0.43117827", "0.42997023", "0.42975622", "0.4295926", "0.4284861", "0.42753837", "0.42667258", "0.42511272", "0.4250577", "0.42448318", "0.42415938", "0.42222944", "0.4200206", "0.41980043", "0.4196595", "0.4187164", "0.4186754", "0.41783932", "0.4166035", "0.4150288", "0.4129815", "0.41262355", "0.41246855", "0.4107151", "0.41071498", "0.41032398", "0.4103174", "0.40977645", "0.40943626", "0.40927646", "0.40882948", "0.40873596", "0.40793374", "0.4077704", "0.40776318", "0.40776268", "0.40719214", "0.40635544", "0.40621418", "0.40607086", "0.40590873", "0.40554884", "0.4049623", "0.40474188", "0.40405053", "0.40403214", "0.4031731", "0.4028792", "0.40267012", "0.4026418", "0.402525", "0.40182492", "0.40169162", "0.40147978", "0.40065134", "0.40053883", "0.40033102", "0.39988846", "0.3997909", "0.39919928", "0.39906037", "0.39864898", "0.39796677" ]
0.808147
0
isPureVirtualDefinition ... Returns whether a function is pure virtual.
isPureVirtualDefinition ... Возвращает true, если функция является чисто виртуальной.
func isPureVirtualDefinition(line string) bool { line = strings.Replace(line, " ", "", -1) return (strings.Contains(line, "virtual") && strings.Contains(line, "=0;")) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (tp Type) IsVirtualTable() bool {\n\treturn tp == VirtualTable\n}", "func (b *IBFCell) IsPure() bool {\n\treturn (b.Count == 1 || b.Count == -1) && b.HashSum.Uint64() == checkSumHash(b.IDSum.Uint64())\n}", "func (o *os) HasVirtualKeyboard() gdnative.Bool {\n\to.ensureSingleton()\n\t//log.Println(\"Calling _OS.HasVirtualKeyboard()\")\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(\"_OS\", \"has_virtual_keyboard\")\n\n\t// Call the parent method.\n\t// bool\n\tretPtr := gdnative.NewEmptyBool()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewBoolFromPointer(retPtr)\n\treturn ret\n}", "func (d *portworx) IsPureFileVolume(volume *torpedovolume.Volume) (bool, error) {\n\tvar proxySpec *api.ProxySpec\n\tvar err error\n\tif proxySpec, err = d.getProxySpecForAVolume(volume); err != nil {\n\t\treturn false, err\n\t}\n\tif proxySpec == nil {\n\t\treturn false, nil\n\t}\n\n\tif proxySpec.ProxyProtocol == api.ProxyProtocol_PROXY_PROTOCOL_PURE_FILE {\n\t\tlog.Debugf(\"Volume [%s] is Pure File volume\", volume.ID)\n\t\treturn true, nil\n\t}\n\n\tlog.Debugf(\"Volume [%s] is not Pure File volume\", volume.ID)\n\treturn false, nil\n}", "func (s *Session) isPureExpr(expr ast.Expr) bool {\n\tif expr == nil {\n\t\treturn true\n\t}\n\n\tswitch expr := expr.(type) {\n\tcase *ast.Ident:\n\t\treturn true\n\tcase *ast.BasicLit:\n\t\treturn true\n\tcase *ast.BinaryExpr:\n\t\treturn s.isPureExpr(expr.X) && s.isPureExpr(expr.Y)\n\tcase *ast.CallExpr:\n\t\ttv := s.TypeInfo.Types[expr.Fun]\n\t\tfor _, arg := range expr.Args {\n\t\t\tif s.isPureExpr(arg) == false {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\tif tv.IsType() {\n\t\t\treturn true\n\t\t}\n\n\t\tif tv.IsBuiltin() {\n\t\t\tif ident, ok := expr.Fun.(*ast.Ident); ok {\n\t\t\t\tif pureBuiltinFuncNames[ident.Name] {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\tcase *ast.CompositeLit:\n\t\treturn true\n\tcase *ast.FuncLit:\n\t\treturn true\n\tcase *ast.IndexExpr:\n\t\treturn s.isPureExpr(expr.X) && s.isPureExpr(expr.Index)\n\tcase *ast.SelectorExpr:\n\t\treturn s.isPureExpr(expr.X)\n\tcase *ast.SliceExpr:\n\t\treturn s.isPureExpr(expr.Low) && s.isPureExpr(expr.High) && s.isPureExpr(expr.Max)\n\tcase *ast.StarExpr:\n\t\treturn s.isPureExpr(expr.X)\n\tcase *ast.TypeAssertExpr:\n\t\treturn true\n\tcase *ast.UnaryExpr:\n\t\treturn s.isPureExpr(expr.X)\n\tcase *ast.ParenExpr:\n\t\treturn s.isPureExpr(expr.X)\n\n\tcase *ast.InterfaceType:\n\t\treturn true\n\tcase *ast.ArrayType:\n\t\treturn true\n\tcase *ast.ChanType:\n\t\treturn true\n\tcase *ast.KeyValueExpr:\n\t\treturn true\n\tcase *ast.MapType:\n\t\treturn true\n\tcase *ast.StructType:\n\t\treturn true\n\tcase *ast.FuncType:\n\t\treturn true\n\n\tcase *ast.Ellipsis:\n\t\treturn true\n\n\tcase *ast.BadExpr:\n\t\treturn false\n\t}\n\n\treturn false\n}", "func (d *portworx) IsPureVolume(volume *torpedovolume.Volume) (bool, error) {\n\tvar proxySpec *api.ProxySpec\n\tvar err error\n\tif proxySpec, err = d.getProxySpecForAVolume(volume); err != nil {\n\t\treturn false, err\n\t}\n\n\tif proxySpec == nil {\n\t\treturn false, nil\n\t}\n\n\tif proxySpec.ProxyProtocol == api.ProxyProtocol_PROXY_PROTOCOL_PURE_BLOCK || proxySpec.ProxyProtocol == api.ProxyProtocol_PROXY_PROTOCOL_PURE_FILE {\n\t\tlog.Debugf(\"Volume [%s] is Pure volume\", volume.ID)\n\t\treturn true, nil\n\t}\n\n\tlog.Debugf(\"Volume [%s] is not Pure Block volume\", volume.ID)\n\treturn false, nil\n}", "func (r DynamicRole) IsVirtualRole() bool {\n\tswitch r {\n\tcase DynamicRoleVirtualExecutor:\n\t\treturn true\n\tcase DynamicRoleVirtualValidator:\n\t\treturn true\n\t}\n\treturn false\n}", "func (f FooBarProps) IsProps() {}", "func (ExprType) HasMethod(fn string) bool { return boolResult }", "func isDefinition(s spec.Schema) bool {\n\treturn len(s.SchemaProps.Ref.GetPointer().String()) > 0\n}", "func (c *Client) isPureRevert(ctx context.Context, change *gerritpb.ChangeInfo) (bool, error) {\n\treq := &gerritpb.GetPureRevertRequest{\n\t\tProject: change.Project,\n\t\tNumber: change.Number,\n\t}\n\n\tres, err := c.gerritClient.GetPureRevert(ctx, req)\n\tif err != nil {\n\t\treturn false, errors.Annotate(err,\n\t\t\t\"error querying Gerrit host %s on whether the change %s~%d is a pure revert\",\n\t\t\tc.host, req.Project, req.Number).Err()\n\t}\n\n\treturn res.IsPureRevert, nil\n}", "func (s *Script) IsContractSig() bool {\n\treturn len(*s) == 1 && (*s)[0] == byte(OPCONTRACT)\n}", "func IsScriptedModeSet() PredicateFunc {\n\treturn func(v *VolumeGetProperty) bool {\n\t\treturn v.IsScriptedMode\n\t}\n}", "func (v *Variant) IsFloating() bool {\n\treturn gobool(C.g_variant_is_floating(v.native()))\n}", "func (p RProc) IsCFunc() bool { return int(C._MRB_PROC_CFUNC_P(p.p)) != 0 }", "func (c cell) IsFormula() bool {\n\t_, ok := c.contentHandler.(*FormulaCol)\n\treturn ok\n}", "func isBound(pfn unsafe.Pointer, fn string) string {\n\tinc := \" \"\n\tif pfn != nil {\n\t\tinc = \"+\"\n\t}\n\treturn fmt.Sprintf(\" [%s] %s\", inc, fn)\n}", "func (fn *Func) IsPublic() bool {\n\treturn isPublicName(fn.Name)\n}", "func (o *VirtualizationBaseHostPciDeviceAllOf) HasFunction() bool {\n\tif o != nil && o.Function != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (d UserData) HasFunction() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Function\", \"function\"))\n}", "func (o *StorageVdMemberEpAllOf) HasStorageVirtualDrive() bool {\n\tif o != nil && o.StorageVirtualDrive != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (cv *ConVar) IsFunc() bool {\n\treturn cv.isFunc\n}", "func (state *State) IsFunc(index int) bool { return state.TypeAt(index) == FuncType }", "func CallNonvirtualBooleanMethodA(env *C.JNIEnv, obj C.jobject, clazz C.jclass, methodID C.jmethodID, args *C.jvalue) C.jboolean {\n\treturn C._GoJniCallNonvirtualBooleanMethodA(env, obj, clazz, methodID, args)\n}", "func (pmf PMF) IsNormalized() bool {\n\tdelta := math.Abs(1.0 - float64(pmf.Sum()))\n\treturn delta <= maxDelta\n}", "func (o *BlockDeviceMappingVmUpdate) HasVirtualDeviceName() bool {\n\tif o != nil && o.VirtualDeviceName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (f *Frugal) ContainsFrugalDefinitions() bool {\n\treturn len(f.Scopes)+len(f.Services) > 0\n}", "func (f *Func) IsBuiltin() bool { return f.isBuiltin }", "func (xs *Sheet) IsFormula(row int, col int) int {\n\ttmp, _, _ := xs.xb.lib.NewProc(\"xlSheetIsFormulaW\").\n\t\tCall(xs.self, I(row), I(col))\n\treturn int(tmp)\n}", "func (*OnfTest1Choice_Vehicle) IsYANGGoStruct() {}", "func (o *StorageFlexUtilVirtualDrive) HasVirtualDrive() bool {\n\tif o != nil && o.VirtualDrive != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func FakeBool(v interface{}) bool {\n\tswitch r := v.(type) {\n\tcase float64:\n\t\treturn r != 0\n\tcase string:\n\t\treturn r != \"\"\n\tcase bool:\n\t\treturn r\n\tcase nil:\n\t\treturn false\n\tdefault:\n\t\treturn true\n\t}\n}", "func (o *Vm) HasFlavour() bool {\n\tif o != nil && o.Flavour != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *StorageFlexFlashVirtualDrive) HasVirtualDrive() bool {\n\tif o != nil && o.VirtualDrive != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (v *Service) IsSetFunctions() bool {\n\treturn v != nil && v.Functions != nil\n}", "func (ft *FieldType) Hybrid() bool {\n\treturn ft.GetType() == mysql.TypeEnum || ft.GetType() == mysql.TypeBit || ft.GetType() == mysql.TypeSet\n}", "func isFunc(obj reflect.Value) bool {\n\t// Zero value reflected: not a valid function\n\tif obj == (reflect.Value{}) {\n\t\treturn false\n\t}\n\n\tif obj.Type().Kind() != reflect.Func {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (d Definition) IsFloat() bool {\n\tif k, ok := d.Output.(reflect.Kind); ok {\n\t\tif k == reflect.Float32 || k == reflect.Float64 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (n *Node) Synthetic() bool {\n\tif n.Sha256sum == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "func IsFunction(data interface{}) bool {\n\treturn typeIs(data, reflect.Func)\n}", "func (*OnfTest1Choice_Vehicle_UnderCarriage) IsYANGGoStruct() {}", "func HasMethod(st interface{}, methodName string) bool {\n\tvalueIface := reflect.ValueOf(st)\n\n\t// Check if the passed interface is a pointer\n\tif valueIface.Type().Kind() != reflect.Ptr {\n\t\t// Create a new type of Iface, so we have a pointer to work with\n\t\tvalueIface = reflect.New(reflect.TypeOf(st))\n\t}\n\n\t// Get the method by name\n\tmethod := valueIface.MethodByName(methodName)\n\treturn method.IsValid()\n}", "func (pr *prepareResult) isProcedureCall() bool { return pr.fc.IsProcedureCall() }", "func (pr *prepareResult) isProcedureCall() bool { return pr.fc.IsProcedureCall() }", "func isFunction(ident string) bool {\n\tif _, ok := functions[ident]; !ok {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (obj *ObjectBase) IsTransient() bool {\n\treturn obj.clientPtr == nil\n}", "func (*OnfTest1Choice_Vehicle_ElectricMotor) IsYANGGoStruct() {}", "func (o *os) IsUserfsPersistent() gdnative.Bool {\n\to.ensureSingleton()\n\t//log.Println(\"Calling _OS.IsUserfsPersistent()\")\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(\"_OS\", \"is_userfs_persistent\")\n\n\t// Call the parent method.\n\t// bool\n\tretPtr := gdnative.NewEmptyBool()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewBoolFromPointer(retPtr)\n\treturn ret\n}", "func (sig *Signature) HasV() bool {\n\treturn sig.hasV\n}", "func HasProcedureToMedicalProcedure() predicate.ProcedureType {\n\treturn predicate.ProcedureType(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(ProcedureToMedicalProcedureTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, ProcedureToMedicalProcedureTable, ProcedureToMedicalProcedureColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "func (eClass *eClassImpl) IsAbstract() bool {\n\treturn eClass.isAbstract\n}", "func isRealProc(mountPoint string) (bool, error) {\n\tstat := syscall.Statfs_t{}\n\terr := syscall.Statfs(mountPoint, &stat)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// 0x9fa0 is PROC_SUPER_MAGIC: https://elixir.bootlin.com/linux/v6.1/source/include/uapi/linux/magic.h#L87\n\treturn stat.Type == 0x9fa0, nil\n}", "func isVirtualTip(bs *HashSet, futureSet *HashSet, anticone *HashSet, children *HashSet) bool {\n\tfor k := range children.GetMap() {\n\t\tif bs.Has(&k) {\n\t\t\treturn false\n\t\t}\n\t\tif !futureSet.Has(&k) && !anticone.Has(&k) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (c *Concurrent) isExecutable(e interface{}) bool {\n\treturn reflect.TypeOf(e).Kind() == reflect.Func\n}", "func (v *Function) IsSetReturnType() bool {\n\treturn v != nil && v.ReturnType != nil\n}", "func IsFunc(v interface{}) bool {\n\tr := elconv.AsValueRef(reflect.ValueOf(v))\n\treturn r.Kind() == reflect.Func\n}", "func IsStandardFunction(name string) bool {\n\treturn fset[name]\n}", "func (i *FuncIterator) IsBound() bool {\n\treturn i.endIndex > 0\n}", "func (n *Node) IsMethod() bool {\n\treturn n.Type.Recv() != nil\n}", "func (a *scriptAddress) Internal() bool {\n\treturn false\n}", "func (f FooBarState) IsState() {}", "func Fexistx(mname string) bool {\n\tif _, err := fmethods[mname]; err {\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n}", "func (ob *PyObject) IsCallable() bool {\n\treturn C.PyCallable_Check(ob.rawptr) > 0\n}", "func MrbProcStrictP(p RProc) bool { return int(C._MRB_PROC_STRICT_P(p.p)) != 0 }", "func (_FinalizableCrowdsaleImpl *FinalizableCrowdsaleImplCaller) IsFinalized(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _FinalizableCrowdsaleImpl.contract.Call(opts, out, \"isFinalized\")\n\treturn *ret0, err\n}", "func isServiceStubType(t reflect.Type) bool {\n\tif isStructPtr(t) == false {\n\t\treturn false\n\t} else if t.Implements(stubType) == false {\n\t\treturn false\n\t}\n\t// Return success\n\treturn true\n}", "func IsHasMethod(st interface{}, methodName string) bool {\n\treturn HasMethod(st, methodName)\n}", "func (a *accessHelper) isFunction() bool {\n\tfor _, val := range a.functionIndexes {\n\t\tif val == a.index {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (_Harberger *HarbergerCaller) IsPetrified(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _Harberger.contract.Call(opts, out, \"isPetrified\")\n\treturn *ret0, err\n}", "func (t *Type) IsPrimitive() bool {\n\t_, ok := frugalBaseTypes[t.Name]\n\treturn ok\n}", "func (p *Photon) HasFunction(name string) (bool, int) {\n\tfor i, f := range p.Functions {\n\t\tif f.Name == name {\n\t\t\treturn true, i\n\t\t}\n\t}\n\treturn false, 0\n}", "func (o *V1WorkloadSpec) HasVirtualMachines() bool {\n\tif o != nil && o.VirtualMachines != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ARVRInterface) IsPrimary() gdnative.Bool {\n\t//log.Println(\"Calling ARVRInterface.IsPrimary()\")\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(\"ARVRInterface\", \"is_primary\")\n\n\t// Call the parent method.\n\t// bool\n\tretPtr := gdnative.NewEmptyBool()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewBoolFromPointer(retPtr)\n\treturn ret\n}", "func (c MethodsCollection) IsPublic() pIsPublic {\n\treturn pIsPublic{\n\t\tMethod: c.MustGet(\"IsPublic\"),\n\t}\n}", "func (me TAttlistAbstractTextNlmCategory) IsMethods() bool { return me.String() == \"METHODS\" }", "func (o *ScalarFormulaRequestAttributes) HasFormulas() bool {\n\treturn o != nil && o.Formulas != nil\n}", "func IsLazy(m protoreflect.Message, fd protoreflect.FieldDescriptor) bool {\n\tvar mi *MessageInfo\n\tvar p pointer\n\tswitch m := m.(type) {\n\tcase *messageState:\n\t\tmi = m.messageInfo()\n\t\tp = m.pointer()\n\tcase *messageReflectWrapper:\n\t\tmi = m.messageInfo()\n\t\tp = m.pointer()\n\tdefault:\n\t\treturn false\n\t}\n\txd, ok := fd.(protoreflect.ExtensionTypeDescriptor)\n\tif !ok {\n\t\treturn false\n\t}\n\txt := xd.Type()\n\text := mi.extensionMap(p)\n\tif ext == nil {\n\t\treturn false\n\t}\n\tf, ok := (*ext)[int32(fd.Number())]\n\tif !ok {\n\t\treturn false\n\t}\n\treturn f.typ == xt && f.lazy != nil && atomic.LoadUint32(&f.lazy.atomicOnce) == 0\n}", "func (state *State) IsGoFunc(index int) bool {\n\tcls, ok := state.get(index).(*Closure)\n\treturn ok && !cls.isLua()\n}", "func (o *RuleMatch) HasMethods() bool {\n\tif o != nil && o.Methods != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (obj *content) IsNormal() bool {\n\treturn obj.normal != nil\n}", "func (o *FileversionFileversion) HasDescription() bool {\n\tif o != nil && o.Description != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (mock *Mockdb) IsContractAddr(addr types.AddressHash) bool {\n\tif mock.GetCodeSize(addr) > 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "func (o *EditorPlugin) HasMainScreen() gdnative.Bool {\n\t//log.Println(\"Calling EditorPlugin.HasMainScreen()\")\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(\"EditorPlugin\", \"has_main_screen\")\n\n\t// Call the parent method.\n\t// bool\n\tretPtr := gdnative.NewEmptyBool()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewBoolFromPointer(retPtr)\n\treturn ret\n}", "func implementedOutsideGo(obj *types.Func) bool {\n\treturn obj.Type().(*types.Signature).Recv() == nil &&\n\t\t(obj.Scope() != nil && obj.Scope().Pos() == token.NoPos)\n}", "func isPureIPv4Address(ipString string) bool {\n\tfor i := 0; i < len(ipString); i++ {\n\t\tswitch ipString[i] {\n\t\tcase '.':\n\t\t\treturn true\n\t\tcase ':':\n\t\t\treturn false\n\t\t}\n\t}\n\treturn false\n}", "func (obj *Global) IsPersonalMode(ctx context.Context) (bool, error) {\n\tresult := &struct {\n\t\tReturn bool `json:\"qReturn\"`\n\t}{}\n\terr := obj.RPC(ctx, \"IsPersonalMode\", result)\n\treturn result.Return, err\n}", "func IsHasMethod(v interface{}, methodName string) bool {\n\treturn String(methodName).IsInArrayIgnoreCase(GetMethods(v))\n}", "func (o *MicrosoftGraphWorkbookSortField) HasSortOn() bool {\n\tif o != nil && o.SortOn != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (v ValidatePayment) IsFinal() bool {\n\treturn false\n}", "func (o *VirtualizationVmwareVirtualMachineAllOf) HasProtectedVm() bool {\n\tif o != nil && o.ProtectedVm != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (v *Function) IsSetOneWay() bool {\n\treturn v != nil && v.OneWay != nil\n}", "func Fexecm(fname, sname string) bool {\n\texecuted := false\n\tif Fexists(fname, sname) {\n\t\tif Fmember(fframes[fname][sname+\",facets\"], \"ref\") {\n\t\t\tfname2 := fframes[fname][sname+\",ref\"][0]\n\t\t\tif Fmember(fframes[fname][sname+\",facets\"], \"ifref\") {\n\t\t\t\tfmethods[Getval(fframes[fname][sname+\",ifref\"])](fname)\n\t\t\t}\n\t\t\texecuted = Fexecm(fname2, sname)\n\t\t} else {\n\t\t\tif Fmember(fframes[fname][sname+\",facets\"], \"method\") {\n\t\t\t\tif Fmember(fframes[fname][sname+\",facets\"], \"ifexecm\") {\n\t\t\t\t\tfmethods[Getval(fframes[fname][sname+\",ifexecm\"])](fname)\n\t\t\t\t}\n\t\t\t\tfmethods[Getval(fframes[fname][sname+\",method\"])](fname)\n\t\t\t\texecuted = true\n\t\t\t}\n\t\t}\n\t}\n\treturn executed\n}", "func isExportedType(d DataType) bool {\n\tif d == FUNCPOINTER {\n\t\treturn false\n\t}\n\treturn true\n}", "func (p Property) IsInherited() bool {\n\treturn p == \"inherited\"\n}", "func (f Unstructured) Primitive() bool {\n\treturn false\n}", "func genAbstractFunc(fn *obj.LSym) {\n\tifn := Ctxt.DwFixups.GetPrecursorFunc(fn)\n\tif ifn == nil {\n\t\tCtxt.Diag(\"failed to locate precursor fn for %v\", fn)\n\t\treturn\n\t}\n\tif Debug_gendwarfinl != 0 {\n\t\tCtxt.Logf(\"DwarfAbstractFunc(%v)\\n\", fn.Name)\n\t}\n\tCtxt.DwarfAbstractFunc(ifn, fn, myimportpath)\n}", "func FnCall() bool {\n\treturn fnCall\n}", "func (tp Type) IsNormalTable() bool {\n\treturn tp == NormalTable\n}", "func (gdt *Vector3) IsNormalized() Bool {\n\targ0 := gdt.getBase()\n\n\tret := C.go_godot_vector3_is_normalized(GDNative.api, arg0)\n\n\treturn Bool(ret)\n}", "func (f Unstructured) IsUndefined() bool {\n\treturn f.fields == nil\n}" ]
[ "0.5725554", "0.56338274", "0.52214384", "0.52026784", "0.5111255", "0.4992483", "0.49429774", "0.48418856", "0.47752437", "0.46805793", "0.46731955", "0.4661175", "0.46523353", "0.46268716", "0.45680475", "0.45335254", "0.45149964", "0.44207093", "0.44183782", "0.44175613", "0.4407443", "0.43974498", "0.4390009", "0.43832728", "0.4382168", "0.43456352", "0.43402055", "0.43392083", "0.43192253", "0.43085852", "0.43065727", "0.4291891", "0.42833865", "0.42738488", "0.42667085", "0.42607573", "0.42600766", "0.42591885", "0.4252782", "0.42430806", "0.42424256", "0.42373472", "0.42342144", "0.42342144", "0.42285097", "0.42255697", "0.4221669", "0.4211416", "0.420607", "0.4192034", "0.41876787", "0.41872486", "0.41713458", "0.41707134", "0.4163064", "0.41315112", "0.41168666", "0.4113844", "0.4105645", "0.41054428", "0.41022852", "0.40975818", "0.40853685", "0.40838265", "0.4075637", "0.4071948", "0.40649983", "0.40646538", "0.40424544", "0.40414414", "0.40396303", "0.40304747", "0.403013", "0.40288645", "0.40274513", "0.40265265", "0.40241277", "0.40187976", "0.40135995", "0.39997464", "0.39988777", "0.39957678", "0.3980908", "0.3977887", "0.39751616", "0.39746946", "0.3972616", "0.39705303", "0.39659476", "0.396556", "0.39594787", "0.39583796", "0.39564136", "0.39545396", "0.39530727", "0.39516088", "0.39505363", "0.39493686", "0.3944017", "0.39436954" ]
0.7474248
0
templatedTypeSeparators ... Used to expand templated types such as QMap>
templatedTypeSeparators ... Используется для расширения шаблонных типов, таких как QMap>
func templatedTypeSeparators (r rune) bool { return r == '<' || r == '>' || r == ',' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func mapKeyType(v interface{}) string {\n\tstr := toString(v)\n\tkey, value, found := stringsCut(str, \",\")\n\tif !found || !strings.HasPrefix(key, \"map<\") || !strings.HasSuffix(value, \">\") {\n\t\tpanic(fmt.Errorf(\"mapKeyValue: expected map<Type1,Type2>, got %v\", str))\n\t}\n\treturn strings.TrimPrefix(key, \"map<\")\n}", "func (tp *Template) Delims(left, right string) *Template {\n\ttp.leftDelim = left\n\ttp.rightDelim = right\n\treturn tp\n}", "func typeString(t []TypeName) (str string) {\n\tswitch len(t) {\n\tcase 0:\n\t\tbreak\n\tcase 1:\n\t\tif t[0].Location.Line == 0 {\n\t\t\t// Use the empty string for undeclared\n\t\t\t// implicit types (such as object).\n\t\t\tbreak\n\t\t}\n\t\tstr = t[0].Str\n\tdefault:\n\t\tstr = \"(either\"\n\t\tfor _, n := range t {\n\t\t\tstr += \" \" + n.Str\n\t\t}\n\t\tstr += \")\"\n\t}\n\treturn\n}", "func printTypedNames(w io.Writer, prefix string, ns []TypedEntry) {\n\tif len(ns) == 0 {\n\t\treturn\n\t}\n\ttprev := typeString(ns[0].Types)\n\tsep := prefix\n\tfor _, n := range ns {\n\t\ttcur := typeString(n.Types)\n\t\tif tcur != tprev {\n\t\t\tif tprev == \"\" {\n\t\t\t\t// Should be impossible.\n\t\t\t\tpanic(n.Location.String() + \": untyped declarations in the middle of a typed list\")\n\t\t\t}\n\t\t\tfmt.Fprintf(w, \" - %s\", tprev)\n\t\t\ttprev = tcur\n\t\t\tsep = prefix\n\t\t\tif sep == \"\" {\n\t\t\t\tsep = \" \"\n\t\t\t}\n\t\t}\n\t\tfmt.Fprintf(w, \"%s%s\", sep, n.Str)\n\t\tsep = \" \"\n\t}\n\tif tprev != \"\" {\n\t\tfmt.Fprintf(w, \" - %s\", tprev)\n\t}\n}", "func mapValueType(v interface{}) string {\n\tstr := toString(v)\n\tkey, value, found := stringsCut(str, \",\")\n\tif !found || !strings.HasPrefix(key, \"map<\") || !strings.HasSuffix(value, \">\") {\n\t\tpanic(fmt.Errorf(\"mapKeyValue: expected map<Type1,Type2>, got %v\", str))\n\t}\n\treturn strings.TrimSuffix(value, \">\")\n}", "func (t PathType) Separator() string {\n\tswitch t {\n\tcase Relative:\n\t\treturn \".\"\n\tcase Absolute:\n\t\treturn \"/\"\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "func (gen *jsGenerator) formatType(t *idl.Type) string {\n\tvar s string\n\tms, ok := jsTypes[t.Name]\n\tif !ok {\n\t\tms = t.Name\n\t}\n\tif t.Name == \"list\" {\n\t\ts = fmt.Sprintf(ms, gen.formatType(t.ValueType))\n\t} else if t.Name == \"map\" {\n\t\ts = fmt.Sprintf(ms, jsTypes[t.KeyType.Name], gen.formatType(t.ValueType))\n\t} else if t.IsPrimitive() && t.Name != \"string\" {\n\t\ts = ms + \"?\"\n\t} else if t.IsEnum(gen.tplRootIdl) {\n\t\ts = ms + \"?\"\n\t} else {\n\t\ts = ms\n\t}\n\treturn s\n}", "func QualifiedTypeName(t DataType) string {\n\tswitch t.Kind() {\n\tcase ArrayKind:\n\t\ta := t.(*Array)\n\t\treturn fmt.Sprintf(\"%s<%s>\",\n\t\t\tt.Name(),\n\t\t\tQualifiedTypeName(a.ElemType.Type),\n\t\t)\n\tcase MapKind:\n\t\th := t.(*Map)\n\t\treturn fmt.Sprintf(\"%s<%s, %s>\",\n\t\t\tt.Name(),\n\t\t\tQualifiedTypeName(h.KeyType.Type),\n\t\t\tQualifiedTypeName(h.ElemType.Type),\n\t\t)\n\t}\n\treturn t.Name()\n}", "func typeNames(vars []*types.Var) string {\n\tif len(vars) == 0 {\n\t\treturn \"\"\n\t}\n\tvar buf strings.Builder\n\tfor i, v := range vars {\n\t\tif i != 0 {\n\t\t\tbuf.WriteString(\", \")\n\t\t}\n\t\tbuf.WriteString(nameOf(v.Type()))\n\t}\n\treturn buf.String()\n}", "func typeinfo(list ...interface{}) string {\n\tvar buf strings.Builder\n\tfor i, item := range list {\n\t\tif i > 0 {\n\t\t\tbuf.WriteString(\",\")\n\t\t}\n\t\tbuf.WriteString(fmt.Sprintf(\"%d:%T:%v\", i, item, item))\n\t}\n\treturn buf.String()\n}", "func (o DomainNameEndpointConfigurationOutput) Types() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DomainNameEndpointConfiguration) string { return v.Types }).(pulumi.StringOutput)\n}", "func (e *expression) writeTypeElts(elts []ast.Expr, Lbrace token.Pos) {\n\tfirstPos := e.tr.getLine(Lbrace)\n\tposOldElt := firstPos\n\tposNewElt := 0\n\tuseBracket := false\n\n\tfor i, el := range elts {\n\t\tposNewElt = e.tr.getLine(el.Pos())\n\t\tkv := el.(*ast.KeyValueExpr)\n\t\tkey := e.tr.getExpression(kv.Key).String()\n\n\t\tif i == 0 {\n\t\t\tif strings.HasPrefix(key, `\"`) {\n\t\t\t\tuseBracket = true\n\t\t\t} else {\n\t\t\t\tuseBracket = false\n\t\t\t}\n\t\t}\n\t\tif useBracket {\n\t\t\tkey = \"[\" + key + \"]\"\n\t\t} else {\n\t\t\tkey = \".\" + key\n\t\t}\n\n\t\tif i != 0 {\n\t\t\te.WriteString(\",\")\n\t\t}\n\t\tif posNewElt != posOldElt {\n\t\t\te.WriteString(strings.Repeat(NL, posNewElt - posOldElt))\n\t\t\te.WriteString(strings.Repeat(TAB, e.tr.tabLevel))\n\t\t} else { // in the same line\n\t\t\te.WriteString(SP)\n\t\t}\n\n\t\te.WriteString(fmt.Sprintf(\"%s%s=%s\",\n\t\t\te.tr.lastVarName,\n\t\t\tkey + SP,\n\t\t\tSP + e.tr.getExpression(kv.Value).String(),\n\t\t))\n\n\t\tposOldElt = posNewElt\n\t}\n\te.tr.line += posNewElt - firstPos // update the global position\n}", "func (l AuditSubjectTypeList) Join(separator string) string {\n\toutput := \"\"\n\tfor i, t := range l {\n\t\toutput += string(t)\n\t\tif i < len(l)-1 {\n\t\t\toutput += separator\n\t\t}\n\t}\n\treturn output\n}", "func (m *moduleGenerator) inlineTypeName(ctx *openapi.ReferenceContext, propertyName string) string {\n\tresult := strings.Title(propertyName)\n\tif ex, ok := m.inlineTypes[ctx]; ok {\n\t\tfor {\n\t\t\tif !ex.Has(result) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tresult += strings.Title(propertyName)\n\t\t}\n\t} else {\n\t\tm.inlineTypes[ctx] = codegen.NewStringSet()\n\t}\n\tm.inlineTypes[ctx].Add(result)\n\treturn result\n}", "func lexMapQuotedKey(lx *lexer) stateFn {\r\n\tr := lx.peek()\r\n\tif r == sqStringEnd {\r\n\t\tlx.emit(itemKey)\r\n\t\tlx.next()\r\n\t\treturn lexSkip(lx, lexMapKeyEnd)\r\n\t}\r\n\tlx.next()\r\n\treturn lexMapQuotedKey\r\n}", "func UnorderedMapTypeName(listYANGPath, listFieldName, parentName string, goStructElements map[string]*ygen.ParsedDirectory) (string, string, bool, error) {\n\t// The list itself, since it is a container, has a struct associated with it. Retrieve\n\t// this from the set of Directory structs for which code (a Go struct) will be\n\t// generated such that additional details can be used in the code generation.\n\tlistElem, ok := goStructElements[listYANGPath]\n\tif !ok {\n\t\treturn \"\", \"\", false, fmt.Errorf(\"struct for %s did not exist\", listYANGPath)\n\t}\n\n\tvar listType, keyType string\n\tvar isDefinedType bool\n\tswitch len(listElem.ListKeys) {\n\tcase 0:\n\t\treturn \"\", \"\", false, fmt.Errorf(\"list does not contain any keys: %s:\", listElem.Name)\n\tcase 1:\n\t\t// This is a single keyed list, so we can represent it as a map with\n\t\t// a simple Go type as the key. Note that a leaf-list can never be\n\t\t// a key, so we do not need to handle the case whereby we would have to\n\t\t// have a slice which keys the list.\n\t\tfor _, listKey := range listElem.ListKeys {\n\t\t\tlistType = fmt.Sprintf(\"map[%s]*%s\", listKey.LangType.NativeType, listElem.Name)\n\t\t\tkeyType = listKey.LangType.NativeType\n\t\t\tisDefinedType = ygen.IsYgenDefinedGoType(listKey.LangType)\n\t\t}\n\tdefault:\n\t\t// This is a list with multiple keys, so we need to generate a new structure\n\t\t// that represents the list key itself - this struct is described in a\n\t\t// generatedGoMultiKeyListStruct struct, which is then expanded by a template to the struct\n\t\t// definition.\n\t\tlistKeyStructName := fmt.Sprintf(\"%s_Key\", listElem.Name)\n\t\tnames := make(map[string]bool, len(goStructElements))\n\t\tfor _, d := range goStructElements {\n\t\t\tnames[d.Name] = true\n\t\t}\n\t\tif names[listKeyStructName] {\n\t\t\tlistKeyStructName = fmt.Sprintf(\"%s_%s_YANGListKey\", parentName, listFieldName)\n\t\t\tif names[listKeyStructName] {\n\t\t\t\treturn \"\", \"\", false, fmt.Errorf(\"unexpected generated list key name conflict for %s\", listYANGPath)\n\t\t\t}\n\t\t\tnames[listKeyStructName] = true\n\t\t}\n\t\tlistType = fmt.Sprintf(\"map[%s]*%s\", listKeyStructName, listElem.Name)\n\t\tkeyType = listKeyStructName\n\t\tisDefinedType = true\n\t}\n\treturn listType, keyType, isDefinedType, nil\n}", "func TemplateType_Values() []string {\n\treturn []string{\n\t\tTemplateTypeEnvironment,\n\t\tTemplateTypeService,\n\t}\n}", "func printTypes(vals []interface{}) string {\n\ts := \"[\"\n\tfor ix, val := range vals {\n\t\tif ix > 0 {\n\t\t\ts += \", \"\n\t\t}\n\t\ts += reflect.TypeOf(val).String()\n\t}\n\treturn s + \"]\"\n}", "func marshalMapInOrder(m map[string]interface{}, t interface{}) (string, error) {\n\ts := \"{\"\n\tv := reflect.ValueOf(t)\n\tfor i := 0; i < v.Type().NumField(); i++ {\n\t\tfield := jsonFieldFromTag(v.Type().Field(i).Tag)\n\t\tif field == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tvalue, err := json.Marshal(m[field])\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\ts += fmt.Sprintf(\"%q:%s,\", field, value)\n\t}\n\ts = s[:len(s)-1]\n\ts += \"}\"\n\tvar buf bytes.Buffer\n\tif err := json.Indent(&buf, []byte(s), \"\", \" \"); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn buf.String(), nil\n}", "func typeName(typ string) string {\n\tif typ[0] == '(' {\n\t\tts := strings.Split(typ[1:len(typ)-1], \",\")\n\t\tif len(ts) != 2 {\n\t\t\tlog.Fatalf(\"Tuple expect 2 arguments\")\n\t\t}\n\t\treturn \"types.NewTuple(\" + typeName(ts[0]) + \", \" + typeName(ts[1]) + \")\"\n\t}\n\tswitch typ {\n\tcase \"Flags\", \"Mem\", \"Void\", \"Int128\":\n\t\treturn \"types.Type\" + typ\n\tdefault:\n\t\treturn \"typ.\" + typ\n\t}\n}", "func (t *Link) PrependType(v interface{}) {\n\tt.typeName = append([]interface{}{v}, t.typeName...)\n\n}", "func (f *FieldsWithValue) Pairs(separator string) []string {\n\tpairs := make([]string, len(f.fields))\n\tfor i, v := range f.fields {\n\t\tpairs[i] = fmt.Sprintf(\"%s%s%s\", v.Name, separator, v.Value)\n\t}\n\treturn pairs\n}", "func isMapType(v interface{}) bool {\n\tkey, value, found := stringsCut(toString(v), \",\")\n\treturn found && strings.HasPrefix(key, \"map<\") && strings.HasSuffix(value, \">\")\n}", "func (t *VMIntTPStrStr) JavaType() string {\n\treturn \"Map<Integer,Pair<String,String>>\"\n}", "func makeExtensionTypeName(base string) string {\n\treturn fmt.Sprintf(\"%s%s%s\", base, valSeparator, typeAppendix)\n}", "func (t *VMStrTPStrStr) JavaType() string {\n\treturn \"Map<String,Pair<String,String>>\"\n}", "func (m Map) TypeString() string {\n\t// TODO: this should return map[somepackage.SomeType]somepackage1.SomeType1\n\t// i.e. package name + UnqualifiedName()\n\t// for key and value types.\n\treturn fmt.Sprintf(\"map[%s]%s\", m.Key.TypeString(), m.Value.TypeString())\n}", "func ExampleT() {\n\tfmt.Println(\"name: \", q.T(\"user\"))\n\tfmt.Println(\"name + alias:\", q.T(\"user\", \"usr\"))\n\t// Output:\n\t// name: \"user\" []\n\t// name + alias: \"user\" AS \"usr\" []\n}", "func (h *Helper) GetTypeRenames() map[string]string {\n\t_, _, _ = h.GetTypeDefs()\n\treturn h.typeRenames\n}", "func expectedTypes(types []string) string {\n\t// Are there any types?\n\tif types == nil || len(types) <= 0 {\n\t\treturn \"\"\n\t}\n\n\t// Handle the case of a single token type\n\tif len(types) == 1 {\n\t\treturn fmt.Sprintf(\"; expected token of type %q\", types[0])\n\t} else if len(types) == 2 {\n\t\treturn fmt.Sprintf(\"; expected tokens of type %q or %q\", types[0], types[1])\n\t}\n\n\t// Handle the general case\n\tbuf := &bytes.Buffer{}\n\tfmt.Fprintf(buf, \"; expected tokens of type \")\n\tfor i, tokType := range types {\n\t\tswitch i {\n\t\tcase 0:\n\t\t\tfmt.Fprintf(buf, \"%q\", tokType)\n\t\tcase len(types) - 1:\n\t\t\tfmt.Fprintf(buf, \", or %q\", tokType)\n\t\tdefault:\n\t\t\tfmt.Fprintf(buf, \", %q\", tokType)\n\t\t}\n\t}\n\treturn buf.String()\n}", "func expandStringMap(v map[string]interface{}) map[string]string {\n\tm := make(map[string]string)\n\tfor key, val := range v {\n\t\tm[key] = val.(string)\n\t}\n\n\treturn m\n}", "func (t *VMStrTPIntStr) JavaType() string {\n\treturn \"Map<String,Pair<Integer,String>>\"\n}", "func GetTableDelimiter(schema []SchemaField) string {\n\trow := \"+\"\n\tfor _, field := range schema {\n\t\tfor i := 0; i < field.FieldSize+1; i++ {\n\t\t\trow += \"-\"\n\t\t}\n\t\trow += \"+\"\n\t}\n\treturn row\n}", "func (fp *FancyPrinter) SetSeparators(separators ...string) {\n\tfp.separators = separators\n}", "func (t *VMIntTPDblStr) JavaType() string {\n\treturn \"Map<Integer,Pair<Double,String>>\"\n}", "func generateGoTypes(idx *jsonschema.Index) ([]byte, error) {\n\tw := bytes.NewBufferString(\"\\n\")\n\tfor _, k := range sortedMapKeysbyName(idx) {\n\t\tt, err := generateGoType((*idx)[k], idx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif string(t) != \"\" {\n\t\t\tfmt.Fprintf(w, \"%s\\n\", t)\n\t\t}\n\t}\n\n\treturn format.Source(w.Bytes())\n}", "func (d *Descriptor) TypeName() []string {\n\tif d.typename != nil {\n\t\treturn d.typename\n\t}\n\tn := 0\n\tfor parent := d; parent != nil; parent = parent.parent {\n\t\tn++\n\t}\n\ts := make([]string, n, n)\n\tfor parent := d; parent != nil; parent = parent.parent {\n\t\tn--\n\t\ts[n] = parent.GetName()\n\t}\n\td.typename = s\n\treturn s\n}", "func TypeStringWithAliasMap(typ dgo.Type, am dgo.AliasMap) string {\n\ts := strings.Builder{}\n\tnewTypeBuilder(&s, am).buildTypeString(typ, 0)\n\treturn s.String()\n}", "func TypeNameHasPrefix(v string) predicate.Watchlisthistory {\n\treturn predicate.Watchlisthistory(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldTypeName), v))\n\t})\n}", "func (o RestApiEndpointConfigurationOutput) Types() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RestApiEndpointConfiguration) string { return v.Types }).(pulumi.StringOutput)\n}", "func (f *tmplFuncs) cleanType(path string) string {\n\tsplit := strings.Split(path, \".\")\n\treturn split[len(split)-1]\n}", "func Benchmark_ReflectTypeMapLookupSplit(b *testing.B) {\n\tvar dump interface{}\n\tvar switcher interface{}\n\tleMap := map[reflect.Type]interface{}{\n\t\treflect.TypeOf(\"\"): \"\",\n\t\treflect.TypeOf(1): \"\",\n\t\treflect.TypeOf(struct{}{}): \"\",\n\t}\n\trt := reflect.TypeOf(switcher)\n\tfor i := 0; i < b.N; i++ {\n\t\tdump = leMap[rt]\n\t}\n\t_ = dump\n}", "func tparamName(exportName string) string {\n\t// Remove the \"path\" from the type param name that makes it unique.\n\tix := strings.LastIndex(exportName, \".\")\n\tif ix < 0 {\n\t\terrorf(\"malformed type parameter export name %s: missing prefix\", exportName)\n\t}\n\tname := exportName[ix+1:]\n\tif strings.HasPrefix(name, blankMarker) {\n\t\treturn \"_\"\n\t}\n\treturn name\n}", "func TparamName(exportName string) string {\n\t// Remove the \"path\" from the type param name that makes it unique.\n\tix := strings.LastIndex(exportName, \".\")\n\tif ix < 0 {\n\t\treturn \"\"\n\t}\n\tname := exportName[ix+1:]\n\tif strings.HasPrefix(name, blankMarker) {\n\t\treturn \"_\"\n\t}\n\treturn name\n}", "func TparamName(exportName string) string {\n\t// Remove the \"path\" from the type param name that makes it unique.\n\tix := strings.LastIndex(exportName, \".\")\n\tif ix < 0 {\n\t\treturn \"\"\n\t}\n\tname := exportName[ix+1:]\n\tif strings.HasPrefix(name, blankMarker) {\n\t\treturn \"_\"\n\t}\n\treturn name\n}", "func SplitType_Values() []string {\n\treturn []string{\n\t\tSplitTypeNone,\n\t\tSplitTypeLine,\n\t\tSplitTypeRecordIo,\n\t\tSplitTypeTfrecord,\n\t}\n}", "func (t *VMIntTPIntStr) JavaType() string {\n\treturn \"Map<Integer,Pair<Integer,String>>\"\n}", "func Types(typs map[string]string) ConfigFunc {\n\treturn func(c *Config) {\n\t\tc.Types = make(map[string]types.DataType, len(typs))\n\t\tfor k, v := range typs {\n\t\t\tc.Types[k] = types.DataType(v)\n\t\t}\n\t}\n}", "func makeProvisionerMap(items []plugin) string {\n\toutput := \"\"\n\tfor _, item := range items {\n\t\toutput += fmt.Sprintf(\"\\t\\\"%s\\\": %s.%s,\\n\", item.PluginName, item.ImportName, item.TypeName)\n\t}\n\treturn output\n}", "func TaskTemplateFieldType_Values() []string {\n\treturn []string{\n\t\tTaskTemplateFieldTypeName,\n\t\tTaskTemplateFieldTypeDescription,\n\t\tTaskTemplateFieldTypeScheduledTime,\n\t\tTaskTemplateFieldTypeQuickConnect,\n\t\tTaskTemplateFieldTypeUrl,\n\t\tTaskTemplateFieldTypeNumber,\n\t\tTaskTemplateFieldTypeText,\n\t\tTaskTemplateFieldTypeTextArea,\n\t\tTaskTemplateFieldTypeDateTime,\n\t\tTaskTemplateFieldTypeBoolean,\n\t\tTaskTemplateFieldTypeSingleSelect,\n\t\tTaskTemplateFieldTypeEmail,\n\t}\n}", "func (e *Encoder) SetSeparators(beg, end string) {\n\te.sepBeg = beg\n\te.sepEnd = end\n}", "func (pf field) WTFType() string {\n\tswitch {\n\tcase pf.isList && pf.isFormField:\n\t\treturn fmt.Sprintf(\"FieldList(FormField(%v))\", pf.Type)\n\tcase pf.isList:\n\t\treturn fmt.Sprintf(\"FieldList(%v('%v', [required()]), %v)\", pf.Type, pf.Name, pf.Validators)\n\tcase pf.isFormField:\n\t\treturn fmt.Sprintf(\"FormField(%v)\", pf.Type)\n\tdefault:\n\t\treturn fmt.Sprintf(\"%v(validators=[%v])\", pf.Type, pf.Validators)\n\t}\n}", "func JSONSchemaType(t string) string {\n\tif m, ok := kindMap[t]; ok {\n\t\treturn m\n\t}\n\treturn t\n}", "func (t *typewriter) Typewrite() string {\n\t// Re-use the cached result if already processed.\n\tif t.cur != -1 {\n\t\treturn t.result\n\t}\n\n\tvar buf bytes.Buffer\n\n\tfor {\n\t\tsep, str := t.scanMorpheme()\n\t\tif str == \"\" {\n\t\t\tbreak\n\t\t}\n\n\t\tbuf.WriteString(sep)\n\t\tbuf.WriteString(str)\n\t}\n\n\tt.result = buf.String()\n\treturn t.result\n}", "func (m *RecurrencePattern) SetType(value *RecurrencePatternType)() {\n m.type_escaped = value\n}", "func TypeStrings() []string {\n\tstrs := make([]string, len(_TypeNames))\n\tcopy(strs, _TypeNames)\n\treturn strs\n}", "func (self *Template) Expand(value interface{}) (string, error) {\n\tvalues, ismap := value.(Values)\n\tif !ismap {\n\t\tif m, ismap := struct2map(value); !ismap {\n\t\t\treturn \"\", errors.New(\"expected Values, struct, or pointer to struct\")\n\t\t} else {\n\t\t\treturn self.Expand(m)\n\t\t}\n\t}\n\tvar buf bytes.Buffer\n\tfor _, p := range self.parts {\n\t\terr := p.expand(&buf, values)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\treturn buf.String(), nil\n}", "func (t *VMStrTPDblStr) JavaType() string {\n\treturn \"Map<String,Pair<Double,String>>\"\n}", "func (t *VLStrStr) JavaType() string {\n\treturn \"List<Pair<String,String>>\"\n}", "func (t DataType) TypeName() string { return typeNames[t] }", "func appendTypeToName(n string, pType gaia.PipelineType) string {\n\treturn fmt.Sprintf(\"%s%s%s\", n, typeDelimiter, pType.String())\n}", "func (t *VMIntTPStrDbl) JavaType() string {\n\treturn \"Map<Integer,Pair<String,Double>>\"\n}", "func AddressedTypes(providerAddrs []addrs.ProviderConfig) []string {\n\tif len(providerAddrs) == 0 {\n\t\treturn nil\n\t}\n\tm := map[string]struct{}{}\n\tfor _, addr := range providerAddrs {\n\t\tm[addr.Type] = struct{}{}\n\t}\n\n\tnames := make([]string, 0, len(m))\n\tfor typeName := range m {\n\t\tnames = append(names, typeName)\n\t}\n\n\tsort.Strings(names) // Stable result for tests\n\treturn names\n}", "func (m *RecurrenceRange) SetTypeEscaped(value *RecurrenceRangeType)() {\n err := m.GetBackingStore().Set(\"typeEscaped\", value)\n if err != nil {\n panic(err)\n }\n}", "func templateHelpers(fs *token.FileSet) template.FuncMap {\n\treturn template.FuncMap{\n\t\t\"ast\": func(n ast.Node) string {\n\t\t\treturn nodeToString(fs, n)\n\t\t},\n\t\t\"join\": strings.Join,\n\t\t\"params\": func(f *Func) []string {\n\t\t\treturn f.Params(fs)\n\t\t},\n\t\t\"fields\": func(f *Func) []string {\n\t\t\treturn f.Fields(fs)\n\t\t},\n\t\t\"results\": func(f *Func) []string {\n\t\t\treturn f.Results(fs)\n\t\t},\n\t\t\"receiver\": func(f *Func) string {\n\t\t\tif f.ReceiverType() == nil {\n\t\t\t\treturn \"\"\n\t\t\t}\n\n\t\t\treturn strings.Replace(nodeToString(fs, f.ReceiverType()), \"*\", \"\", -1) + \".\"\n\t\t},\n\t\t\"want\": func(s string) string { return strings.Replace(s, \"got\", \"want\", 1) },\n\t}\n}", "func (gen *jsGenerator) fullTypeName(t *idl.Type) string {\n\tvar s string\n\tms, ok := jsTypes[t.Name]\n\tif !ok {\n\t\tms = t.Name\n\t}\n\tif t.Name == \"list\" {\n\t\ts = fmt.Sprintf(ms, gen.fullTypeName(t.ValueType))\n\t} else if t.Name == \"map\" {\n\t\ts = fmt.Sprintf(ms, jsTypes[t.KeyType.Name], gen.fullTypeName(t.ValueType))\n\t} else {\n\t\tns := gen.tplRootIdl.NamespaceOf(ms, \"js\")\n\t\tif ns != \"\" {\n\t\t\ts = fmt.Sprintf(\"%s.%s\", ns, ms)\n\t\t} else {\n\t\t\ts = ms\n\t\t}\n\t}\n\treturn s\n}", "func (lx *Lexer) separator() Token {\n\tr, _ := lx.nextChar()\n\tlx.token.writeRune(r)\n\tlx.token.Type = separatorMap[r]\n\treturn lx.returnAndReset()\n}", "func (o DomainNameEndpointConfigurationPtrOutput) Types() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DomainNameEndpointConfiguration) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Types\n\t}).(pulumi.StringPtrOutput)\n}", "func quotedItems(items ...interface{}) []string {\n\tstrItems := stringSlice(items...)\n\tquoted := []string{}\n\tfor _, str := range strItems {\n\t\tif str[0:1] != \"\\\"\" {\n\t\t\tstr = \"\\\"\" + str + \"\\\"\"\n\t\t}\n\t\tquoted = append(quoted, str)\n\t}\n\treturn quoted\n}", "func generateTomlKeysMap(structPtr reflect.Value, config map[string]interface{}) (map[string]interface{}, error) {\n\tstrct := structPtr.Elem()\n\ttomlMap := map[string]interface{}{}\n\tpType := strct.Type()\n\n\tfor configKey, configValue := range config {\n\t\tfield, found := pType.FieldByName(configKey)\n\n\t\tif !found {\n\t\t\treturn map[string]interface{}{}, fmt.Errorf(\"field %s did not exist on plugin\", configKey)\n\t\t}\n\n\t\ttomlTag := field.Tag.Get(\"toml\")\n\t\tif tomlTag == \"\" {\n\t\t\ttomlTag = configKey\n\t\t}\n\n\t\ttomlMap[tomlTag] = configValue\n\t}\n\n\treturn tomlMap, nil\n\n}", "func (sl *Slice) TypeAndNames() kit.TypeAndNameList {\n\tif len(*sl) == 0 {\n\t\treturn nil\n\t}\n\ttn := make(kit.TypeAndNameList, len(*sl))\n\tfor _, kid := range *sl {\n\t\ttn.Add(kid.Type(), kid.Name())\n\t}\n\treturn tn\n}", "func (t *VLIntStr) JavaType() string {\n\treturn \"List<Pair<Integer,String>>\"\n}", "func (t *VMStrTPStrInt) JavaType() string {\n\treturn \"Map<String,Pair<String,Integer>>\"\n}", "func (t *VMStrStr) JavaType() string {\n\treturn \"Map<String,String>\"\n}", "func (t *VMIntTPStrInt) JavaType() string {\n\treturn \"Map<Integer,Pair<String,Integer>>\"\n}", "func templateStringList(c map[string]string, l ...string) ([]string, error) {\n\tif len(l) == 0 {\n\t\treturn l, nil\n\t}\n\n\tvar ret = make([]string, 0, len(l))\n\n\tfor _, item := range l {\n\t\tbuf := &bytes.Buffer{}\n\t\ttmpl, err := template.New(\"\").Parse(item)\n\t\tif err != nil {\n\t\t\treturn ret, err\n\t\t}\n\t\terr = tmpl.Execute(buf, c)\n\t\tif err != nil {\n\t\t\treturn ret, err\n\t\t}\n\t\tret = append(ret, buf.String())\n\t}\n\treturn ret, nil\n}", "func transpileSmartFields(elts []*etree.Element) {\n\n}", "func (o GetDomainNameEndpointConfigurationOutput) Types() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v GetDomainNameEndpointConfiguration) []string { return v.Types }).(pulumi.StringArrayOutput)\n}", "func TypedHandlers(handlers ...TypedHandler) TypedHandler {\n\tres := TypedHandler{}\n\tfor _, typed := range handlers {\n\t\tfor commandType, handler := range typed {\n\t\t\tres[commandType] = handler\n\t\t}\n\t}\n\treturn res\n}", "func typeListHandler(w http.ResponseWriter, r *http.Request) {\n\n\tresponder(w, r, data.Types)\n\n}", "func (t *VTStrStr) JavaType() string {\n\treturn \"Pair<String,String>\"\n}", "func (k *Key) Times(delim string) []time.Time {\n\treturn k.TimesFormat(time.RFC3339, delim)\n}", "func ConsoleFieldKVSep(s string) OptionFormatter {\n\treturn func(f *ConsoleFormatter) {\n\t\tif s != \"\" {\n\t\t\tf.ConsoleFieldKVSep = s\n\t\t}\n\t}\n}", "func (t *VMStrTPStrDbl) JavaType() string {\n\treturn \"Map<String,Pair<String,Double>>\"\n}", "func (sl *Slice) TypeAndUniqueNames() kit.TypeAndNameList {\n\tif len(*sl) == 0 {\n\t\treturn nil\n\t}\n\ttn := make(kit.TypeAndNameList, len(*sl))\n\tfor _, kid := range *sl {\n\t\ttn.Add(kid.Type(), kid.UniqueName())\n\t}\n\treturn tn\n}", "func tparamsMap(tparams *ast.FieldList) map[string]bool {\n\tif tparams == nil || len(tparams.List) == 0 {\n\t\treturn nil\n\t}\n\tm := make(map[string]bool)\n\tfor _, f := range tparams.List {\n\t\tfor _, name := range f.Names {\n\t\t\tif name.Name != \"_\" {\n\t\t\t\tm[name.Name] = true\n\t\t\t}\n\t\t}\n\t}\n\treturn m\n}", "func (v *TypePair) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [2]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Left: %v\", v.Left)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Right: %v\", v.Right)\n\ti++\n\n\treturn fmt.Sprintf(\"TypePair{%v}\", strings.Join(fields[:i], \", \"))\n}", "func Type_Values() []string {\n\treturn []string{\n\t\tTypeDash,\n\t\tTypeHls,\n\t}\n}", "func buildSelectFields(selects []interface{}) string {\n\tif len(selects) == 0 {\n\t\treturn \"*\"\n\t}\n\tfields := \"\"\n\tfor _, f := range selects {\n\t\tif v, ok := f.(Raw); ok {\n\t\t\tfields += v.String() + \", \"\n\t\t} else if v, ok := f.(alias); ok {\n\t\t\tfields += v.String() + \", \"\n\t\t} else if v, ok := f.(string); ok {\n\t\t\tfields += quote(v) + \", \"\n\t\t}\n\t}\n\treturn strings.TrimRight(fields, \", \")\n}", "func (c *Car) GetSeparatorTemplate() string {\n return os.Getenv(\"BULLETTRAIN_CAR_VIRTUALENV_SEPARATOR_TEMPLATE\")\n}", "func (sym *symtab) typeIdName(t types.Type) string {\n\tidn := strings.Replace(sym.typeGoName(t), \".\", \"_\", -1)\n\tif _, isary := t.(*types.Array); isary {\n\t\tidn = strings.Replace(idn, \"[\", \"Array_\", 1)\n\t\tidn = strings.Replace(idn, \"]\", \"_\", 1)\n\t}\n\tidn = strings.Replace(idn, \"[]\", \"Slice_\", -1)\n\tidn = strings.Replace(idn, \"map[\", \"Map_\", -1)\n\tidn = strings.Replace(idn, \"[\", \"_\", -1)\n\tidn = strings.Replace(idn, \"]\", \"_\", -1)\n\tidn = strings.Replace(idn, \"{}\", \"_\", -1)\n\tidn = strings.Replace(idn, \"*\", \"Ptr_\", -1)\n\treturn idn\n}", "func (StringMapOutput) ElementType() reflect.Type {\n\treturn stringMapType\n}", "func ConfigTypeHasPrefix(v string) predicate.Order {\n\treturn predicate.Order(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldConfigType), v))\n\t})\n}", "func (m *WorkbookNamedItem) SetTypeEscaped(value *string)() {\n err := m.GetBackingStore().Set(\"typeEscaped\", value)\n if err != nil {\n panic(err)\n }\n}", "func ComposeCustomMappingKey(method string, path string) string {\n\treturn method + KeySeperator + path\n}", "func (t *VTIntStr) JavaType() string {\n\treturn \"Pair<Integer,String>\"\n}", "func TypeHasPrefix(v string) predicate.Blob {\n\treturn predicate.Blob(\n\t\tfunc(s *sql.Selector) {\n\t\t\ts.Where(sql.HasPrefix(s.C(FieldType), v))\n\t\t},\n\t)\n}", "func ToOptionsKey(entryName, rpcType string) string {\n\treturn strings.Join([]string{entryName, rpcType}, \"-\")\n}", "func CustomSeparator(separator string) TableOption {\n\treturn func(opts *options) {\n\t\topts.separator = separator\n\t}\n}", "func Separator() iup.Ihandle {\n\t//Ihandle* IupGLSeparator(void);\n\treturn mkih(C.IupGLSeparator())\n}" ]
[ "0.49833834", "0.49633592", "0.46772054", "0.4589316", "0.4566254", "0.45600334", "0.45434427", "0.45412755", "0.4482598", "0.44440588", "0.44426832", "0.44411588", "0.44343516", "0.4406544", "0.4406173", "0.44015318", "0.43420374", "0.4330905", "0.43104362", "0.43059155", "0.42691162", "0.42563102", "0.42479447", "0.4230986", "0.422685", "0.42260692", "0.42244515", "0.42165223", "0.42063677", "0.41976923", "0.41867304", "0.4175167", "0.41738808", "0.41656026", "0.41654506", "0.41556552", "0.4151691", "0.41486496", "0.41461957", "0.413446", "0.41338718", "0.4130602", "0.41271934", "0.4125654", "0.4125654", "0.41188583", "0.41161114", "0.4115267", "0.41064525", "0.41030788", "0.40961894", "0.40934768", "0.40924776", "0.4089931", "0.4089552", "0.40870088", "0.40711176", "0.40645617", "0.40593955", "0.40568012", "0.40491495", "0.4039574", "0.40240443", "0.40150657", "0.40150526", "0.4004847", "0.40027982", "0.39947778", "0.39944926", "0.3991509", "0.39909872", "0.39854917", "0.3979356", "0.39750314", "0.39740086", "0.39696", "0.39652917", "0.39574212", "0.39486322", "0.39481986", "0.39473602", "0.39448112", "0.39444953", "0.39393276", "0.39349893", "0.39327386", "0.39321813", "0.39308414", "0.3930695", "0.3926657", "0.3920019", "0.39142412", "0.3911369", "0.3908854", "0.3902072", "0.3899329", "0.38969377", "0.38906047", "0.3884125", "0.3878104" ]
0.7430346
0
isEtcdConfigFile returns whether the given path looks like a configuration file, and in that case it returns the corresponding hash to detect modifications.
isEtcdConfigFile возвращает true, если заданный путь выглядит как файл конфигурации, и в таком случае возвращает соответствующий хеш для обнаружения изменений.
func isEtcdConfigFile(path string) (bool, fhash) { if info, err := os.Stat(path); err != nil || info.IsDir() { return false, fhash{} } b, err := os.ReadFile(path) if err != nil { return false, fhash{} } // search for the "endpoints:" string if strings.Contains(string(b), "endpoints:") { return true, sha256.Sum256(b) } return false, fhash{} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ParseConfigFile(path string) (*Config, error) {\n\t// slurp\n\tvar buf bytes.Buffer\n\tpath, err := filepath.Abs(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\tif _, err := io.Copy(&buf, f); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// parse\n\tc := &Config{\n\t\tClient: &ClientConfig{\n\t\t\tServerJoin: &ServerJoin{},\n\t\t\tTemplateConfig: &client.ClientTemplateConfig{\n\t\t\t\tWait: &client.WaitConfig{},\n\t\t\t\tWaitBounds: &client.WaitConfig{},\n\t\t\t\tConsulRetry: &client.RetryConfig{},\n\t\t\t\tVaultRetry: &client.RetryConfig{},\n\t\t\t\tNomadRetry: &client.RetryConfig{},\n\t\t\t},\n\t\t},\n\t\tServer: &ServerConfig{\n\t\t\tPlanRejectionTracker: &PlanRejectionTracker{},\n\t\t\tServerJoin: &ServerJoin{},\n\t\t},\n\t\tACL: &ACLConfig{},\n\t\tAudit: &config.AuditConfig{},\n\t\tConsul: &config.ConsulConfig{},\n\t\tAutopilot: &config.AutopilotConfig{},\n\t\tTelemetry: &Telemetry{},\n\t\tVault: &config.VaultConfig{},\n\t}\n\n\terr = hcl.Decode(c, buf.String())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to decode HCL file %s: %w\", path, err)\n\t}\n\n\t// convert strings to time.Durations\n\ttds := []durationConversionMap{\n\t\t{\"gc_interval\", &c.Client.GCInterval, &c.Client.GCIntervalHCL, nil},\n\t\t{\"acl.token_ttl\", &c.ACL.TokenTTL, &c.ACL.TokenTTLHCL, nil},\n\t\t{\"acl.policy_ttl\", &c.ACL.PolicyTTL, &c.ACL.PolicyTTLHCL, nil},\n\t\t{\"acl.token_min_expiration_ttl\", &c.ACL.TokenMinExpirationTTL, &c.ACL.TokenMinExpirationTTLHCL, nil},\n\t\t{\"acl.token_max_expiration_ttl\", &c.ACL.TokenMaxExpirationTTL, &c.ACL.TokenMaxExpirationTTLHCL, nil},\n\t\t{\"client.server_join.retry_interval\", &c.Client.ServerJoin.RetryInterval, &c.Client.ServerJoin.RetryIntervalHCL, nil},\n\t\t{\"server.heartbeat_grace\", &c.Server.HeartbeatGrace, &c.Server.HeartbeatGraceHCL, nil},\n\t\t{\"server.min_heartbeat_ttl\", &c.Server.MinHeartbeatTTL, &c.Server.MinHeartbeatTTLHCL, nil},\n\t\t{\"server.failover_heartbeat_ttl\", &c.Server.FailoverHeartbeatTTL, &c.Server.FailoverHeartbeatTTLHCL, nil},\n\t\t{\"server.plan_rejection_tracker.node_window\", &c.Server.PlanRejectionTracker.NodeWindow, &c.Server.PlanRejectionTracker.NodeWindowHCL, nil},\n\t\t{\"server.retry_interval\", &c.Server.RetryInterval, &c.Server.RetryIntervalHCL, nil},\n\t\t{\"server.server_join.retry_interval\", &c.Server.ServerJoin.RetryInterval, &c.Server.ServerJoin.RetryIntervalHCL, nil},\n\t\t{\"consul.timeout\", &c.Consul.Timeout, &c.Consul.TimeoutHCL, nil},\n\t\t{\"autopilot.server_stabilization_time\", &c.Autopilot.ServerStabilizationTime, &c.Autopilot.ServerStabilizationTimeHCL, nil},\n\t\t{\"autopilot.last_contact_threshold\", &c.Autopilot.LastContactThreshold, &c.Autopilot.LastContactThresholdHCL, nil},\n\t\t{\"telemetry.collection_interval\", &c.Telemetry.collectionInterval, &c.Telemetry.CollectionInterval, nil},\n\t\t{\"client.template.block_query_wait\", nil, &c.Client.TemplateConfig.BlockQueryWaitTimeHCL,\n\t\t\tfunc(d *time.Duration) {\n\t\t\t\tc.Client.TemplateConfig.BlockQueryWaitTime = d\n\t\t\t},\n\t\t},\n\t\t{\"client.template.max_stale\", nil, &c.Client.TemplateConfig.MaxStaleHCL,\n\t\t\tfunc(d *time.Duration) {\n\t\t\t\tc.Client.TemplateConfig.MaxStale = d\n\t\t\t}},\n\t\t{\"client.template.wait.min\", nil, &c.Client.TemplateConfig.Wait.MinHCL,\n\t\t\tfunc(d *time.Duration) {\n\t\t\t\tc.Client.TemplateConfig.Wait.Min = d\n\t\t\t},\n\t\t},\n\t\t{\"client.template.wait.max\", nil, &c.Client.TemplateConfig.Wait.MaxHCL,\n\t\t\tfunc(d *time.Duration) {\n\t\t\t\tc.Client.TemplateConfig.Wait.Max = d\n\t\t\t},\n\t\t},\n\t\t{\"client.template.wait_bounds.min\", nil, &c.Client.TemplateConfig.WaitBounds.MinHCL,\n\t\t\tfunc(d *time.Duration) {\n\t\t\t\tc.Client.TemplateConfig.WaitBounds.Min = d\n\t\t\t},\n\t\t},\n\t\t{\"client.template.wait_bounds.max\", nil, &c.Client.TemplateConfig.WaitBounds.MaxHCL,\n\t\t\tfunc(d *time.Duration) {\n\t\t\t\tc.Client.TemplateConfig.WaitBounds.Max = d\n\t\t\t},\n\t\t},\n\t\t{\"client.template.consul_retry.backoff\", nil, &c.Client.TemplateConfig.ConsulRetry.BackoffHCL,\n\t\t\tfunc(d *time.Duration) {\n\t\t\t\tc.Client.TemplateConfig.ConsulRetry.Backoff = d\n\t\t\t},\n\t\t},\n\t\t{\"client.template.consul_retry.max_backoff\", nil, &c.Client.TemplateConfig.ConsulRetry.MaxBackoffHCL,\n\t\t\tfunc(d *time.Duration) {\n\t\t\t\tc.Client.TemplateConfig.ConsulRetry.MaxBackoff = d\n\t\t\t},\n\t\t},\n\t\t{\"client.template.vault_retry.backoff\", nil, &c.Client.TemplateConfig.VaultRetry.BackoffHCL,\n\t\t\tfunc(d *time.Duration) {\n\t\t\t\tc.Client.TemplateConfig.VaultRetry.Backoff = d\n\t\t\t},\n\t\t},\n\t\t{\"client.template.vault_retry.max_backoff\", nil, &c.Client.TemplateConfig.VaultRetry.MaxBackoffHCL,\n\t\t\tfunc(d *time.Duration) {\n\t\t\t\tc.Client.TemplateConfig.VaultRetry.MaxBackoff = d\n\t\t\t},\n\t\t},\n\t\t{\"client.template.nomad_retry.backoff\", nil, &c.Client.TemplateConfig.NomadRetry.BackoffHCL,\n\t\t\tfunc(d *time.Duration) {\n\t\t\t\tc.Client.TemplateConfig.NomadRetry.Backoff = d\n\t\t\t},\n\t\t},\n\t\t{\"client.template.nomad_retry.max_backoff\", nil, &c.Client.TemplateConfig.NomadRetry.MaxBackoffHCL,\n\t\t\tfunc(d *time.Duration) {\n\t\t\t\tc.Client.TemplateConfig.NomadRetry.MaxBackoff = d\n\t\t\t},\n\t\t},\n\t}\n\n\t// Add enterprise audit sinks for time.Duration parsing\n\tfor i, sink := range c.Audit.Sinks {\n\t\ttds = append(tds, durationConversionMap{\n\t\t\tfmt.Sprintf(\"audit.sink.%d\", i), &sink.RotateDuration, &sink.RotateDurationHCL, nil})\n\t}\n\n\t// convert strings to time.Durations\n\terr = convertDurations(tds)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// report unexpected keys\n\terr = extraKeys(c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Set client template config or its members to nil if not set.\n\tfinalizeClientTemplateConfig(c)\n\n\treturn c, nil\n}", "func (p *Patch) ConfigChanged(remotePath string) bool {\n\tfor _, patchPart := range p.Patches {\n\t\tif patchPart.ModuleName == \"\" {\n\t\t\tfor _, summary := range patchPart.PatchSet.Summary {\n\t\t\t\tif summary.Name == remotePath {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t}\n\treturn false\n}", "func (p *Patch) ConfigChanged(remotePath string) bool {\n\tfor _, patchPart := range p.Patches {\n\t\tif patchPart.ModuleName == \"\" {\n\t\t\tfor _, summary := range patchPart.PatchSet.Summary {\n\t\t\t\tif summary.Name == remotePath {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t}\n\treturn false\n}", "func (config Config) HasLoadedConfigurationFileBeenModified() bool {\n\tif fileInfo, err := os.Stat(config.filePath); err == nil {\n\t\tif !fileInfo.ModTime().IsZero() {\n\t\t\treturn config.lastFileModTime.Unix() != fileInfo.ModTime().Unix()\n\t\t}\n\t}\n\treturn false\n}", "func isConfigState(e *yang.Entry) bool {\n\treturn e.IsDir() && (e.Name == \"config\" || e.Name == \"state\")\n}", "func kubeconfigExistsAndIsFile(filePath string) (bool, error) {\n\tinfo, err := os.Stat(filePath)\n\t// if we couldn't open the file, error out\n\tif err != nil {\n\t\treturn false, err\n\t}\n\t// if we have a directory instead of a file, error out\n\tif info.IsDir() {\n\t\treturn false, errors.New(\"The provided path was a directory. Expected a file.\")\n\t}\n\treturn true, err\n}", "func getConfigFile() ([]byte, error) {\n\tif len(configFile) != 0 {\n\t\treturn configFile, nil\n\t}\n\tenvConf := os.Getenv(\"IGOR_CONFIG\")\n\tif envConf != \"\" {\n\t\treturn []byte(envConf), nil\n\t}\n\tfilename, _ := filepath.Abs(\"./config.json\")\n\tif _, err := os.Stat(filename); err != nil {\n\t\tjsonConfig = false\n\t\tfilename, _ = filepath.Abs(\"./config.yml\")\n\t}\n\tconfigFile, err := ioutil.ReadFile(filename)\n\n\tif err != nil {\n\t\treturn configFile, err\n\t}\n\treturn configFile, nil\n}", "func getConfigFile() string {\n\tif name := os.Getenv(configFileEnvVar); name != \"\" {\n\t\treturn name\n\t}\n\thome, err := homedir.Dir()\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\tname := filepath.Join(home, \".jot\", \"config.toml\")\n\tif checkFile(name) {\n\t\treturn name\n\t}\n\n\treturn \"\"\n}", "func (flogs *fileLogs) Equal(config dvid.StoreConfig) bool {\n\tpath, _, err := parseConfig(config)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn path == flogs.path\n}", "func isMcConfigExists() bool {\n\tconfigFile, err := getMcConfigPath()\n\tif err != nil {\n\t\treturn false\n\t}\n\t_, err = os.Stat(configFile)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "func path() string {\n\tif len(configPath) != 0 {\n\t\treturn configPath\n\t}\n\treturn \"config/database.yml\"\n}", "func configExistsInPath(path string) bool {\n\t// Needed for testing\n\tif config != nil {\n\t\treturn true\n\t}\n\n\t// Check devspace.yaml\n\t_, err := os.Stat(filepath.Join(path, constants.DefaultConfigPath))\n\tif err == nil {\n\t\treturn true\n\t}\n\n\t// Check devspace-configs.yaml\n\t_, err = os.Stat(filepath.Join(path, constants.DefaultConfigsPath))\n\tif err == nil {\n\t\treturn true\n\t}\n\n\treturn false // Normal config file found\n}", "func readConfigFile(path string) (config *Config, err error) {\n\tvar file *os.File\n\tfile, err = os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tconfig = new(Config)\n\terr = json.NewDecoder(file).Decode(config)\n\treturn config, err\n}", "func (a *App) SaveEtcdConfig(cfg *config.Etcd) error {\n\treturn saveEtcdConfig(cfg)\n}", "func TestConfigIsJSON(t *testing.T) {\n\thomedir := os.Getenv(\"HOME\")\n\tconfigpath := (homedir + \"/.stalker.json\")\n\tfile, _ := os.Open(configpath)\n\n\tdecoder := json.NewDecoder(file)\n\tconfiguration := Configuration{}\n\terr := decoder.Decode(&configuration)\n\n\tif err != nil {\n\t\tt.Error(err)\n\t} else {\n\t\tt.Log(\"config is valid JSON\")\n\t}\n}", "func updateConfigFile(context *cli.Context) {\n\tconfig, configFilename, err := lib.GetConfig(context)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tif configFilename == \"\" {\n\t\tfmt.Println(\"Could not find a config file to update\")\n\t\treturn\n\t}\n\n\t// Same config in []byte format.\n\tconfigRaw, err := ioutil.ReadFile(configFilename)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\t// Same config in map format so that we can detect missing keys.\n\tvar configMap map[string]interface{}\n\tif err = json.Unmarshal(configRaw, &configMap); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tdirty := updateConfig(config, configMap)\n\n\tif dirty {\n\t\tconfig.ToFile(context)\n\t\tfmt.Printf(\"Wrote %s\\n\", configFilename)\n\t} else {\n\t\tfmt.Println(\"Nothing to update\")\n\t}\n}", "func (ec *EtcdConfig) Validate() error {\n\tif ec.Filepath != \"\" {\n\t\tec.clientNewType = \"file\"\n\t\treturn nil\n\t}\n\n\t// All tls related properties should be empty or all should be defined\n\ttlsPresent := ec.Cert != \"\" || ec.Key != \"\" || ec.CaCert != \"\"\n\ttlsMissing := ec.Cert == \"\" || ec.Key == \"\" || ec.CaCert == \"\"\n\tif tlsPresent {\n\t\tif tlsMissing {\n\t\t\tlog.WithFields(etcdLogFields).WithFields(log.Fields{\n\t\t\t\t\"error\": ErrIncompleteTLSConfig,\n\t\t\t\t\"cert\": ec.Cert,\n\t\t\t\t\"key\": ec.Key,\n\t\t\t\t\"caCert\": ec.CaCert,\n\t\t\t}).Error(ErrIncompleteTLSConfig)\n\t\t\treturn ErrIncompleteTLSConfig\n\t\t}\n\t\tec.clientNewType = \"tls\"\n\t}\n\treturn nil\n}", "func (a *analyzer) tocContainsPath(path string) bool {\n\tb, err := os.ReadFile(filepath.Join(a.checkoutDir, tocPath))\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tvar toc toc\n\tif err := yaml.Unmarshal(b, &toc); err != nil {\n\t\treturn false\n\t}\n\n\tfor _, entry := range flattenTocEntries(toc.Entries) {\n\t\tif entry.Path == filepath.Join(\"/\", path) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (w *Writer) configPath(configDigest digest.Digest) string {\n\treturn configDigest.Hex() + \".json\"\n}", "func VerifyMasterFileString(path string) error {\n\tmatched, err := regexp.MatchString(\"^[0-9a-z.]+:[0-9]+$\", path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif matched {\n\t\treturn fmt.Errorf(\"redis_server config option must point to a file: %s\", path)\n\t}\n\treturn nil\n}", "func setConfigFile(etcdConf *embetcd.Config, max int, min int, check int) (configFilePath string, tempDir string) {\n\t// get a temporary directory for the etcd data directory\n\ttempDir, err := ioutil.TempDir(\"\", \"TestProxyCluster\")\n\tSo(err, ShouldBeNil)\n\tSo(os.RemoveAll(tempDir), ShouldBeNil)\n\n\t// get a temporary filename for the config file\n\tfileObj, err := ioutil.TempFile(\"\", \"TestProxyClusterConfig\")\n\tSo(err, ShouldBeNil)\n\tconfigFilePath = fileObj.Name()\n\t// remove the temp file so we can overwrite it\n\tSo(os.Remove(configFilePath), ShouldBeNil)\n\n\t//// remove the temp dir so we can recreate it\n\n\tproxyConf := configEtcd\n\tproxyConf = strings.Replace(proxyConf, \"<<MAX>>\", strconv.FormatInt(int64(max), 10), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<MIN>>\", strconv.FormatInt(int64(min), 10), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<CHECK>>\", strconv.FormatInt(int64(check), 10), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<LPADDRESS>>\", etcdConf.LPUrls[0].String(), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<APADDRESS>>\", etcdConf.APUrls[0].String(), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<LCADDRESS>>\", etcdConf.LCUrls[0].String(), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<ACADDRESS>>\", etcdConf.ACUrls[0].String(), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<MADDRESS>>\", etcdConf.ListenMetricsUrls[0].String(), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<UNHEALTHYTTL>>\", etcdConf.UnhealthyTTL.String(), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<REMOVEMEMBERTIMEOUT>>\", etcdConf.RemoveMemberTimeout.String(), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<DATADIR>>\", filepath.Join(tempDir, etcdConf.Dir), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<CLUSTEROP>>\", etcdConf.ClusterState, -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<TARGETADDRESSES>>\", formatTargetAddresses(etcdConf.InitialCluster), -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<SERVERNAME>>\", etcdConf.Name, -1)\n\tproxyConf = strings.Replace(proxyConf, \"<<CLUSTERNAME>>\", etcdConf.ClusterName, -1)\n\n\tSo(ioutil.WriteFile(path.Join(configFilePath), []byte(proxyConf), os.FileMode(0666)), ShouldBeNil)\n\treturn configFilePath, tempDir\n}", "func ConfigReadFile(path string) (string, []byte, error) {\n\tif strings.HasPrefix(path, \"file://\") {\n\t\tpath = path[7:]\n\t}\n\n\tpos := strings.LastIndexByte(path, '.')\n\tif pos == -1 {\n\t\tpos += len(path)\n\t}\n\n\tdata, err := ioutil.ReadFile(path)\n\tlast := strings.LastIndex(path, \".\") + 1\n\tif last == 0 {\n\t\treturn \"\", nil, fmt.Errorf(\"read file config, type is null\")\n\t}\n\treturn path[pos+1:], data, err\n}", "func TestConfigExists(t *testing.T) {\n\thomedir := os.Getenv(\"HOME\")\n\tconfigpath := (homedir + \"/.stalker.json\")\n\n\tif _, err := os.Stat(configpath); os.IsNotExist(err) {\n\t\tt.Error(configpath + \" not found!\")\n\t} else {\n\t\tt.Log(\"found config \" + configpath)\n\t}\n}", "func ProbeEtcd(endpoint string) (string, bool, error) {\n\tu, err := url.Parse(endpoint + \"/version\")\n\tif err != nil {\n\t\treturn \"\", false, fmt.Errorf(\"Can't parse endpoint %s: %s\", endpoint, err)\n\t}\n\tif u.Scheme == \"https\" { // secure etcd\n\t\tclientcert, clientkey, err := util.ClientCertAndKeyFromEnv()\n\t\tif err != nil {\n\t\t\treturn \"\", false, err\n\t\t}\n\t\tversion, verr := getVersionSecure(u.String(), clientcert, clientkey)\n\t\tif verr != nil {\n\t\t\treturn \"\", false, verr\n\t\t}\n\t\treturn version, true, nil\n\t}\n\tversion, verr := getVersion(u.String())\n\tif verr != nil {\n\t\treturn \"\", false, verr\n\t}\n\treturn version, false, nil\n}", "func TestConfigFromFile(t *testing.T) {\n\tcluster := \"TestCluster\"\n\tdockerAuthType := \"dockercfg\"\n\tdockerAuth := `{\n \"https://index.docker.io/v1/\":{\n \"auth\":\"admin\",\n \"email\":\"email\"\n }\n}`\n\ttestPauseImageName := \"pause-image-name\"\n\ttestPauseTag := \"pause-image-tag\"\n\tcontent := fmt.Sprintf(`{\n \"AWSRegion\": \"not-real-1\",\n \"Cluster\": \"%s\",\n \"EngineAuthType\": \"%s\",\n \"EngineAuthData\": %s,\n \"DataDir\": \"/var/run/ecs_agent\",\n \"TaskIAMRoleEnabled\": true,\n \"TaskCPUMemLimit\": true,\n \"InstanceAttributes\": {\n \"attribute1\": \"value1\"\n },\n \"ContainerInstanceTags\": {\n \"tag1\": \"value1\"\n },\n \"PauseContainerImageName\":\"%s\",\n \"PauseContainerTag\":\"%s\",\n \"AWSVPCAdditionalLocalRoutes\":[\"169.254.172.1/32\"]\n}`, cluster, dockerAuthType, dockerAuth, testPauseImageName, testPauseTag)\n\n\tfilePath := setupFileConfiguration(t, content)\n\tdefer os.Remove(filePath)\n\n\tdefer setTestEnv(\"ECS_AGENT_CONFIG_FILE_PATH\", filePath)()\n\tdefer setTestEnv(\"AWS_DEFAULT_REGION\", \"us-west-2\")()\n\n\tcfg, err := fileConfig()\n\tassert.NoError(t, err, \"reading configuration from file failed\")\n\n\tassert.Equal(t, cluster, cfg.Cluster, \"cluster name not as expected from file\")\n\tassert.Equal(t, dockerAuthType, cfg.EngineAuthType, \"docker auth type not as expected from file\")\n\tassert.Equal(t, dockerAuth, string(cfg.EngineAuthData.Contents()), \"docker auth data not as expected from file\")\n\tassert.Equal(t, map[string]string{\"attribute1\": \"value1\"}, cfg.InstanceAttributes)\n\tassert.Equal(t, map[string]string{\"tag1\": \"value1\"}, cfg.ContainerInstanceTags)\n\tassert.Equal(t, testPauseImageName, cfg.PauseContainerImageName, \"should read PauseContainerImageName\")\n\tassert.Equal(t, testPauseTag, cfg.PauseContainerTag, \"should read PauseContainerTag\")\n\tassert.Equal(t, 1, len(cfg.AWSVPCAdditionalLocalRoutes), \"should have one additional local route\")\n\texpectedLocalRoute, err := cniTypes.ParseCIDR(\"169.254.172.1/32\")\n\tassert.NoError(t, err)\n\tassert.Equal(t, expectedLocalRoute.IP, cfg.AWSVPCAdditionalLocalRoutes[0].IP, \"should match expected route IP\")\n\tassert.Equal(t, expectedLocalRoute.Mask, cfg.AWSVPCAdditionalLocalRoutes[0].Mask, \"should match expected route Mask\")\n\tassert.Equal(t, ExplicitlyEnabled, cfg.TaskCPUMemLimit.Value, \"TaskCPUMemLimit should be explicitly enabled\")\n}", "func GetEtcdCrdPath() string {\n\treturn filepath.Join(\"..\", \"..\", \"..\", \"..\", \"config\", \"crd\", \"bases\", \"10-crd-druid.gardener.cloud_etcds.yaml\")\n}", "func getEtcdOption(conf map[string]string, confKey, envVar string) (string, bool) {\n\tconfVal, inConf := conf[confKey]\n\tenvVal, inEnv := os.LookupEnv(envVar)\n\tif inEnv {\n\t\treturn envVal, true\n\t}\n\treturn confVal, inConf\n}", "func (c Calendars) configPath() (string, error) {\n\tconfDir, err := configDirectory()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn filepath.Join(confDir, \"calendars.txt\"), nil\n}", "func readConfigFile(path string) ([]byte, error) {\n\tif path == \"\" {\n\t\treturn nil, errors.New(\"Configfile path not provided\")\n\t}\n\n\tvar jsonDoc json.RawMessage\n\t// read the file\n\tdata, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdataStr := strings.TrimSpace(string(data))\n\n\t// if string starts with { - assume json else yaml\n\tif strings.HasPrefix(dataStr, \"{\") {\n\t\tjsonDoc = json.RawMessage(data)\n\t} else {\n\t\tvar yamlDoc map[interface{}]interface{}\n\n\t\tif err := yaml.Unmarshal(data, &yamlDoc); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tjsonDoc, err = fmts.YAMLToJSON(yamlDoc)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn jsonDoc, nil\n}", "func setupEtcdCluster(mgr *manager.Manager, node *kubekeyapiv1alpha1.HostCfg) error {\n\tvar localPeerAddresses []string\n\toutput, _ := mgr.Runner.ExecuteCmd(\"sudo -E /bin/sh -c \\\"[ -f /etc/etcd.env ] && echo 'Configuration file already exists' || echo 'Configuration file will be created'\\\"\", 0, true)\n\tif strings.TrimSpace(output) == \"Configuration file already exists\" {\n\t\toutTmp, _ := mgr.Runner.ExecuteCmd(\"sudo cat /etc/etcd.env | awk 'NR==1{print $6}'\", 0, true)\n\t\tif outTmp != kubekeyapiv1alpha1.DefaultEtcdVersion {\n\t\t\tif err := refreshConfig(mgr, node, mgr.Runner.Index, localPeerAddresses, \"existing\"); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif err := helthCheck(mgr, node); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tetcdStatus = \"existing\"\n\t\tfor i := 0; i <= mgr.Runner.Index; i++ {\n\t\t\tlocalPeerAddresses = append(localPeerAddresses, fmt.Sprintf(\"etcd%d=https://%s:2380\", i+1, mgr.EtcdNodes[i].InternalAddress))\n\t\t}\n\t\tif mgr.Runner.Index == len(mgr.EtcdNodes)-1 {\n\t\t\tpeerAddresses = localPeerAddresses\n\t\t}\n\t} else {\n\t\tfor i := 0; i <= mgr.Runner.Index; i++ {\n\t\t\tlocalPeerAddresses = append(localPeerAddresses, fmt.Sprintf(\"etcd%d=https://%s:2380\", i+1, mgr.EtcdNodes[i].InternalAddress))\n\t\t}\n\t\tif mgr.Runner.Index == len(mgr.EtcdNodes)-1 {\n\t\t\tpeerAddresses = localPeerAddresses\n\t\t}\n\t\tif mgr.Runner.Index == 0 {\n\t\t\tif err := refreshConfig(mgr, node, mgr.Runner.Index, localPeerAddresses, \"new\"); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tetcdStatus = \"new\"\n\t\t} else {\n\t\t\tswitch etcdStatus {\n\t\t\tcase \"new\":\n\t\t\t\tif err := refreshConfig(mgr, node, mgr.Runner.Index, localPeerAddresses, \"new\"); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\tcase \"existing\":\n\t\t\t\tif err := refreshConfig(mgr, node, mgr.Runner.Index, localPeerAddresses, \"existing\"); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tjoinMemberCmd := fmt.Sprintf(\"sudo -E /bin/sh -c \\\"export ETCDCTL_API=2;export ETCDCTL_CERT_FILE='/etc/ssl/etcd/ssl/admin-%s.pem';export ETCDCTL_KEY_FILE='/etc/ssl/etcd/ssl/admin-%s-key.pem';export ETCDCTL_CA_FILE='/etc/ssl/etcd/ssl/ca.pem';%s/etcdctl --endpoints=%s member add %s %s\\\"\", node.Name, node.Name, etcdBinDir, accessAddresses, fmt.Sprintf(\"etcd%d\", mgr.Runner.Index+1), fmt.Sprintf(\"https://%s:2380\", node.InternalAddress))\n\t\t\t\t_, err := mgr.Runner.ExecuteCmd(joinMemberCmd, 2, true)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.Wrap(errors.WithStack(err), \"Failed to add etcd member\")\n\t\t\t\t}\n\t\t\t\tif err := restartEtcd(mgr); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err := helthCheck(mgr, node); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcheckMemberCmd := fmt.Sprintf(\"sudo -E /bin/sh -c \\\"export ETCDCTL_API=2;export ETCDCTL_CERT_FILE='/etc/ssl/etcd/ssl/admin-%s.pem';export ETCDCTL_KEY_FILE='/etc/ssl/etcd/ssl/admin-%s-key.pem';export ETCDCTL_CA_FILE='/etc/ssl/etcd/ssl/ca.pem';%s/etcdctl --no-sync --endpoints=%s member list\\\"\", node.Name, node.Name, etcdBinDir, accessAddresses)\n\t\t\t\tmemberList, err := mgr.Runner.ExecuteCmd(checkMemberCmd, 2, true)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.Wrap(errors.WithStack(err), \"Failed to list etcd member\")\n\t\t\t\t}\n\t\t\t\tif !strings.Contains(memberList, fmt.Sprintf(\"https://%s:2379\", node.InternalAddress)) {\n\t\t\t\t\treturn errors.Wrap(errors.WithStack(err), \"Failed to add etcd member\")\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn errors.New(\"Failed to get etcd cluster status\")\n\t\t\t}\n\t\t}\n\n\t}\n\treturn nil\n}", "func (n *Node) IsExternalEtcd() bool {\n\treturn n.Role == ExternalEtcdRole\n}", "func ReadConfigFile(configPath string, monitor bool, logger log15.Logger) (*Config, error) {\n\tif !utils.PathExists(configPath) {\n\t\treturn nil, fmt.Errorf(\"The configuration file doesn't exist: %s\", configPath)\n\t}\n\n\tlogger.Info(\"Parsing configuration\", log15.Ctx{\"path\": configPath})\n\n\tconf := Config{logger: logger}\n\terr := parseConfig(configPath, &conf.Config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Watch for configuration changes\n\tif monitor {\n\t\tlogger.Info(\"Setting up configuration watch\", log15.Ctx{\"path\": configPath})\n\n\t\twatcher, err := fsnotify.NewWatcher()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Unable to setup fsnotify: %v\", err)\n\t\t}\n\n\t\terr = watcher.Add(filepath.Dir(configPath))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Unable to setup fsnotify watch: %v\", err)\n\t\t}\n\n\t\tpathDir := filepath.Dir(configPath)\n\t\tif pathDir == \"\" {\n\t\t\tpathDir = \"./\"\n\t\t}\n\t\tpathBase := filepath.Base(configPath)\n\n\t\tgo func() {\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase ev := <-watcher.Events:\n\t\t\t\t\tif ev.Name != fmt.Sprintf(\"%s/%s\", pathDir, pathBase) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\t// Store the old config for comparison\n\t\t\t\t\toldData, _ := yaml.Marshal(conf.Config)\n\n\t\t\t\t\t// Wait for 1s for ownership changes\n\t\t\t\t\ttime.Sleep(time.Second)\n\n\t\t\t\t\t// Parse the new ocnfig\n\t\t\t\t\terr := parseConfig(configPath, conf.Config)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlogger.Error(\"Failed to read the new configuration\", log15.Ctx{\"path\": configPath, \"error\": err})\n\t\t\t\t\t}\n\n\t\t\t\t\t// Check if something changed\n\t\t\t\t\tnewData, _ := yaml.Marshal(conf.Config)\n\t\t\t\t\tif string(oldData) == string(newData) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tlogger.Info(\"Configuration file changed, reloading\", log15.Ctx{\"path\": configPath})\n\t\t\t\t\tfor _, handler := range conf.handlers {\n\t\t\t\t\t\thandler(&conf)\n\t\t\t\t\t}\n\t\t\t\tcase err := <-watcher.Errors:\n\t\t\t\t\tlogger.Error(\"Got bad file notification\", log15.Ctx{\"error\": err})\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\treturn &conf, nil\n}", "func TestIsDir(T *testing.T) {\n\n\tvar db etcdDB\n\n\tts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintln(w, `{\"action\":\"get\",\"node\":{\"key\":\"/testDir\",\"value\":\"Hello\",\"modifiedIndex\":4,\"createdIndex\":4}}`)\n\t}))\n\tdefer ts.Close()\n\n\tconfig := ts.URL\n\n\tdb.Cfg = cli.Config{\n\t\tEndpoints: []string{config},\n\t\tTransport: cli.DefaultTransport,\n\t\t// set timeout per request to fail fast when the target endpoint is unavailable\n\t\tHeaderTimeoutPerRequest: time.Second,\n\t}\n\n\tdb.C, _ = cli.New(db.Cfg)\n\n\tdb.Kapi = cli.NewKeysAPI(db.C)\n\tdb.Ctx = context.Background()\n\n\tdb.IsDir(\"/testDir\")\n\n}", "func (tc *TestConfig) Path() string {\n\treturn tc.configPath\n}", "func GetEtcdChartPath() string {\n\treturn filepath.Join(\"..\", \"..\", \"..\", \"..\", \"charts\", \"etcd\")\n}", "func (c *Config) WasLoadedFromFile() bool {\n\treturn c.loadedFromFilepath != \"\"\n}", "func (m *Meta) dirIsConfigPath(dir string) bool {\n\tloader, err := m.initConfigLoader()\n\tif err != nil {\n\t\treturn true\n\t}\n\n\treturn loader.IsConfigDir(dir)\n}", "func getConfigPath() (string, error) {\n\treturn \"./veille.yaml\", nil\n}", "func (s *site) getEtcdConfig(ctx context.Context, opCtx *operationContext, server *ProvisionedServer) (*etcdConfig, error) {\n\tetcdClient, err := clients.DefaultEtcdMembers()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tmembers, err := etcdClient.List(ctx)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tinitialCluster := []string{opCtx.provisionedServers.InitialCluster(s.domainName)}\n\t// add existing members\n\tfor _, member := range members {\n\t\taddress, err := utils.URLHostname(member.PeerURLs[0])\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\tinitialCluster = append(initialCluster, fmt.Sprintf(\"%s:%s\",\n\t\t\tmember.Name, address))\n\t}\n\tproxyMode := etcdProxyOff\n\tif !server.IsMaster() {\n\t\tproxyMode = etcdProxyOn\n\t}\n\treturn &etcdConfig{\n\t\tinitialCluster: strings.Join(initialCluster, \",\"),\n\t\tinitialClusterState: etcdExistingCluster,\n\t\tproxyMode: proxyMode,\n\t}, nil\n}", "func (c *Config) Has(path string) bool {\n\tv := c.Get(path)\n\treturn v.raw != nil\n}", "func (c *Config) GetEtcdDB() store.Config {\n\treturn store.Config{\n\t\tPrefix: \"lastbackend\",\n\t\tEndpoints: *c.Etcd.Endpoints,\n\t\tKeyFile: *c.Etcd.TLS.Key,\n\t\tCertFile: *c.Etcd.TLS.Cert,\n\t\tCAFile: *c.Etcd.TLS.CA,\n\t\tCodec: serializer.NewSerializer(json.Encoder{}, json.Decoder{}),\n\t}\n}", "func TestConfigReloadNoConfigFile(t *testing.T) {\n\tserver := New(&Options{NoSigs: true})\n\tloaded := server.ConfigTime()\n\tif server.Reload() == nil {\n\t\tt.Fatal(\"Expected Reload to return an error\")\n\t}\n\tif reloaded := server.ConfigTime(); reloaded != loaded {\n\t\tt.Fatalf(\"ConfigTime is incorrect.\\nexpected: %s\\ngot: %s\", loaded, reloaded)\n\t}\n}", "func ConfigFile(inp string) string {\n\tif inp != \"\" {\n\t\tpath := ExpandUser(inp)\n\t\tif FileExists(path) {\n\t\t\treturn path\n\t\t}\n\t}\n\n\tif env := os.Getenv(\"DOLA_CONFIG\"); env != \"\" {\n\t\tpath := ExpandUser(env)\n\t\tif FileExists(path) {\n\t\t\treturn path\n\t\t}\n\t}\n\n\tif path := ExpandUser(\"~/.dola/config.json\"); FileExists(path) {\n\t\treturn path\n\t}\n\n\treturn \"\"\n}", "func EtcdConfig(urls []string) client.Config {\n\tcustomTransport := GenerateTransport()\n\tc := client.Config{\n\t\tEndpoints: urls,\n\t\tTransport: customTransport,\n\t\tHeaderTimeoutPerRequest: time.Second * 5,\n\t}\n\tc.Username = os.Getenv(\"ETCD_USERNAME\")\n\tc.Password = os.Getenv(\"ETCD_PASSWORD\")\n\treturn c\n}", "func GetEtcdVersion(ec EtcdConfig) (string, string, error) {\n\t// The next etcd release (1.4) will have client.GetVersion()\n\t// We'll use this to test our etcd connection for now\n\tetcdURL := fmt.Sprintf(\"http://%s:%v/version\", ec.EtcdHost, ec.EtcdPort)\n\tresp, err := http.Get(etcdURL)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\tdefer resp.Body.Close()\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\n\tswitch resp.StatusCode {\n\tcase http.StatusOK:\n\t\tvar vresp version.Versions\n\t\tif err := json.Unmarshal(body, &vresp); err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t\treturn vresp.Server, vresp.Cluster, nil\n\tdefault:\n\t\tvar connectErr error\n\t\tif err := json.Unmarshal(body, &connectErr); err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\t\treturn \"\", \"\", connectErr\n\t}\n}", "func GetConfigFile() string {\n\treturn *configFile\n}", "func readConfigFile(filename, fileFormat string) (*vaultAuthOptions, error) {\n\t// step: check the file exists\n\tif exists, err := fileExists(filename); !exists {\n\t\treturn nil, fmt.Errorf(\"the file: %s does not exist\", filename)\n\t} else if err != nil {\n\t\treturn nil, err\n\t}\n\t// step: we only read in json or yaml formats\n\tsuffix := path.Ext(filename)\n\tswitch suffix {\n\tcase \".yaml\":\n\t\tfallthrough\n\tcase \".yml\":\n\t\treturn readYAMLFile(filename)\n\tdefault:\n\t\treturn readJSONFile(filename, fileFormat)\n\t}\n}", "func getConfigFilePath() string {\n\tvar configFile string\n\tflag.StringVar(&configFile, \"config\", \"./config.json\", \"JSON config file path\")\n\tflag.Parse()\n\n\tlog.Printf(\"Using config file %s\", configFile)\n\n\treturn configFile\n}", "func GetMD5(configFile string) ([]byte, error) {\n\tfile, err := os.Open(configFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer file.Close()\n\n\thash := md5.New()\n\tif _, err := io.Copy(hash, file); err != nil {\n\t\treturn nil, err\n\t}\n\n\tconfigMD5 := hash.Sum(nil)\n\treturn configMD5, nil\n}", "func (m *Manager) GetEtcPath() string {\n\treturn m.etcPath\n}", "func GetConfigFile(toData *t3cutil.ConfigData, fileInfo atscfg.CfgMeta, hdrCommentTxt string, thiscfg config.Cfg) (string, string, bool, string, []string, error) {\n\tstart := time.Now()\n\tdefer func() {\n\t\tlog.Infof(\"GetConfigFile %v took %v\\n\", fileInfo.Name, time.Since(start).Round(time.Millisecond))\n\t}()\n\tlog.Infoln(\"GetConfigFile '\" + fileInfo.Name + \"'\")\n\n\tgetConfigFile := getConfigFileFunc(fileInfo.Name)\n\tcfg, err := getConfigFile(toData, fileInfo.Name, hdrCommentTxt, thiscfg)\n\tlogWarnings(\"getting config file '\"+fileInfo.Name+\"': \", cfg.Warnings)\n\n\tif err != nil {\n\t\treturn \"\", \"\", false, \"\", []string{}, err\n\t}\n\treturn cfg.Text, cfg.ContentType, cfg.Secure, cfg.LineComment, cfg.Warnings, nil\n}", "func (a *App) GetConfigFile(name string) ([]byte, error) {\n\tdata, err := a.Srv().configStore.GetFile(name)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to get config file %s\", name)\n\t}\n\n\treturn data, nil\n}", "func (a *App) GetConfigFile(name string) ([]byte, error) {\n\tdata, err := a.Srv().configStore.GetFile(name)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to get config file %s\", name)\n\t}\n\n\treturn data, nil\n}", "func configPath() (string, error) {\n\thome, err := sys.GetHomeDir()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn filepath.Join(home, \".keeper\", \"config.json\"), nil\n}", "func TestGetValidConfig(T *testing.T) {\n\n\tvar db etcdDB\n\n\tts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintln(w, `{\"action\":\"get\",\"node\":{\"key\":\"/testDir\",\"value\":\"Hello\",\"modifiedIndex\":4,\"createdIndex\":4}}`)\n\t}))\n\tdefer ts.Close()\n\n\tconfig := ts.URL\n\n\tdb.Cfg = cli.Config{\n\t\tEndpoints: []string{config},\n\t\tTransport: cli.DefaultTransport,\n\t\t// set timeout per request to fail fast when the target endpoint is unavailable\n\t\tHeaderTimeoutPerRequest: time.Second,\n\t}\n\n\tdb.C, _ = cli.New(db.Cfg)\n\n\tdb.Kapi = cli.NewKeysAPI(db.C)\n\tdb.Ctx = context.Background()\n\n\tdb.Get(\"/testDir\")\n\n}", "func TestCloudConfig(t *testing.T) {\n\tcontents := []byte(`\ncoreos: \n etcd:\n discovery_url: \"https://discovery.etcd.io/827c73219eeb2fa5530027c37bf18877\"\n fleet:\n autostart: Yes\n units:\n - name: 50-eth0.network\n runtime: yes\n content: '[Match]\n \n Name=eth47\n \n \n [Network]\n \n Address=10.209.171.177/19\n \n'\nssh_authorized_keys:\n - foobar\n - foobaz\nwrite_files:\n - content: |\n penny\n elroy\n path: /etc/dogepack.conf\n permissions: '0644'\n owner: root:dogepack\n`)\n\tcfg, err := NewCloudConfig(contents)\n\tif err != nil {\n\t\tt.Fatalf(\"Encountered unexpected error :%v\", err)\n\t}\n\n\tkeys := cfg.SSH_Authorized_Keys\n\tif len(keys) != 2 {\n\t\tt.Error(\"Parsed incorrect number of SSH keys\")\n\t} else if keys[0] != \"foobar\" {\n\t\tt.Error(\"Expected first SSH key to be 'foobar'\")\n\t} else if keys[1] != \"foobaz\" {\n\t\tt.Error(\"Expected first SSH key to be 'foobaz'\")\n\t}\n\n\tif cfg.Coreos.Etcd.Discovery_URL != \"https://discovery.etcd.io/827c73219eeb2fa5530027c37bf18877\" {\n\t\tt.Error(\"Failed to parse etcd discovery url\")\n\t}\n\n\tif !cfg.Coreos.Fleet.Autostart {\n\t\tt.Error(\"Expected AutostartFleet to be true\")\n\t}\n\n\tif len(cfg.Write_Files) != 1 {\n\t\tt.Error(\"Failed to parse correct number of write_files\")\n\t} else {\n\t\twf := cfg.Write_Files[0]\n\t\tif wf.Content != \"penny\\nelroy\\n\" {\n\t\t\tt.Errorf(\"WriteFile has incorrect contents '%s'\", wf.Content)\n\t\t}\n\t\tif wf.Encoding != \"\" {\n\t\t\tt.Errorf(\"WriteFile has incorrect encoding %s\", wf.Encoding)\n\t\t}\n\t\tif wf.Permissions != \"0644\" {\n\t\t\tt.Errorf(\"WriteFile has incorrect permissions %s\", wf.Permissions)\n\t\t}\n\t\tif wf.Path != \"/etc/dogepack.conf\" {\n\t\t\tt.Errorf(\"WriteFile has incorrect path %s\", wf.Path)\n\t\t}\n\t\tif wf.Owner != \"root:dogepack\" {\n\t\t\tt.Errorf(\"WriteFile has incorrect owner %s\", wf.Owner)\n\t\t}\n\t}\n\n\tif len(cfg.Coreos.Units) != 1 {\n\t\tt.Error(\"Failed to parse correct number of units\")\n\t} else {\n\t\tu := cfg.Coreos.Units[0]\n\t\texpect := `[Match]\nName=eth47\n\n[Network]\nAddress=10.209.171.177/19\n`\n\t\tif u.Content != expect {\n\t\t\tt.Errorf(\"Unit has incorrect contents '%s'.\\nExpected '%s'.\", u.Content, expect)\n\t\t}\n\t\tif u.Runtime != true {\n\t\t\tt.Errorf(\"Unit has incorrect runtime value\")\n\t\t}\n\t\tif u.Name != \"50-eth0.network\" {\n\t\t\tt.Errorf(\"Unit has incorrect name %s\", u.Name)\n\t\t}\n\t\tif u.Type() != \"network\" {\n\t\t\tt.Errorf(\"Unit has incorrect type '%s'\", u.Type())\n\t\t}\n\t}\n\n}", "func TestConfig_ParsePanic(t *testing.T) {\n\tci.Parallel(t)\n\n\tc, err := ParseConfigFile(\"./testdata/obj-len-one.hcl\")\n\tif err != nil {\n\t\tt.Fatalf(\"parse error: %s\\n\", err)\n\t}\n\n\td, err := ParseConfigFile(\"./testdata/obj-len-one.json\")\n\tif err != nil {\n\t\tt.Fatalf(\"parse error: %s\\n\", err)\n\t}\n\n\trequire.EqualValues(t, c, d)\n}", "func (a *appState) loadConfigFile(ctx context.Context) error {\n\tcfgPath := a.configPath()\n\n\tif _, err := os.Stat(cfgPath); err != nil {\n\t\t// don't return error if file doesn't exist\n\t\treturn nil\n\t}\n\n\t// read the config file bytes\n\tfile, err := os.ReadFile(cfgPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error reading file: %w\", err)\n\t}\n\n\t// unmarshall them into the wrapper struct\n\tcfgWrapper := &ConfigInputWrapper{}\n\terr = yaml.Unmarshal(file, cfgWrapper)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error unmarshalling config: %w\", err)\n\t}\n\n\t// retrieve the runtime configuration from the disk configuration.\n\tnewCfg, err := cfgWrapper.RuntimeConfig(ctx, a)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// validate runtime configuration\n\tif err := newCfg.validateConfig(); err != nil {\n\t\treturn fmt.Errorf(\"error parsing chain config: %w\", err)\n\t}\n\n\t// save runtime configuration in app state\n\ta.config = newCfg\n\n\treturn nil\n}", "func fileChanged(repo *git.Repository, path string) (bool, error) {\n\tstatus, err := repo.StatusFile(path)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif status == git.StatusWtNew || status == git.StatusWtModified ||\n\t\tstatus == git.StatusWtDeleted {\n\t\treturn true, nil\n\t}\n\n\treturn false, nil\n}", "func (c baseClient) getEngineConfigFilePath(ctx context.Context, engine containerd.Container) (string, error) {\n\tspec, err := engine.Spec(ctx)\n\tconfigFile := \"\"\n\tif err != nil {\n\t\treturn configFile, err\n\t}\n\tfor i := 0; i < len(spec.Process.Args); i++ {\n\t\targ := spec.Process.Args[i]\n\t\tif strings.HasPrefix(arg, \"--config-file\") {\n\t\t\tif strings.Contains(arg, \"=\") {\n\t\t\t\tsplit := strings.SplitN(arg, \"=\", 2)\n\t\t\t\tconfigFile = split[1]\n\t\t\t} else {\n\t\t\t\tif i+1 >= len(spec.Process.Args) {\n\t\t\t\t\treturn configFile, ErrMalformedConfigFileParam\n\t\t\t\t}\n\t\t\t\tconfigFile = spec.Process.Args[i+1]\n\t\t\t}\n\t\t}\n\t}\n\n\tif configFile == \"\" {\n\t\t// TODO - any more diagnostics to offer?\n\t\treturn configFile, ErrEngineConfigLookupFailure\n\t}\n\treturn configFile, nil\n}", "func (c baseClient) getEngineConfigFilePath(ctx context.Context, engine containerd.Container) (string, error) {\n\tspec, err := engine.Spec(ctx)\n\tconfigFile := \"\"\n\tif err != nil {\n\t\treturn configFile, err\n\t}\n\tfor i := 0; i < len(spec.Process.Args); i++ {\n\t\targ := spec.Process.Args[i]\n\t\tif strings.HasPrefix(arg, \"--config-file\") {\n\t\t\tif strings.Contains(arg, \"=\") {\n\t\t\t\tsplit := strings.SplitN(arg, \"=\", 2)\n\t\t\t\tconfigFile = split[1]\n\t\t\t} else {\n\t\t\t\tif i+1 >= len(spec.Process.Args) {\n\t\t\t\t\treturn configFile, ErrMalformedConfigFileParam\n\t\t\t\t}\n\t\t\t\tconfigFile = spec.Process.Args[i+1]\n\t\t\t}\n\t\t}\n\t}\n\n\tif configFile == \"\" {\n\t\t// TODO - any more diagnostics to offer?\n\t\treturn configFile, ErrEngineConfigLookupFailure\n\t}\n\treturn configFile, nil\n}", "func (c *RunCommand) readConfigFile() (string, error) {\n\tif _, err := os.Stat(c.Config); os.IsNotExist(err) {\n\t\treturn \"\", fmt.Errorf(\"config file not found, looking in: %s\", c.Config)\n\t}\n\n\tdata, err := ioutil.ReadFile(c.Config)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(data), nil\n}", "func GetConfigFilePath() string {\n\tpath, _ := osext.ExecutableFolder()\n\tpath = fmt.Sprintf(\"%s/eremetic.yml\", path)\n\tif _, err := os.Open(path); err == nil {\n\t\treturn path\n\t}\n\tglobalPath := \"/etc/eremetic/eremetic.yml\"\n\tif _, err := os.Open(globalPath); err == nil {\n\t\treturn globalPath\n\t}\n\n\treturn \"\"\n}", "func getConfigPath(path string) (file string) {\r\n\treturn fmt.Sprintf(\"%s/%s\", path, \"app.ini\")\r\n}", "func (c Config) GetConfigFile() string {\n\treturn c.viper.GetString(configFile)\n}", "func (tail *Tail) isFileDeleted() bool {\n\treturn false\n}", "func (n *Node) IsExternalEtcd() bool {\n\treturn n.Role() == constants.ExternalEtcdNodeRoleValue\n}", "func getConfigFile() (*os.File, error) {\n\treturn os.Open(env.WorkDir() + \"/configs/config.json\")\n}", "func isMdFile(path string) bool {\n\treturn strings.HasSuffix(path, \".md\")\n}", "func (v *VersionFile) equals(vp *EtcdVersionPair) (bool, error) {\n\texists, err := v.Exists()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif !exists {\n\t\treturn false, nil\n\t}\n\tcvp, err := v.Read()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn vp.Equals(cvp), nil\n}", "func hasConfigFileOption(unknownArgs []string) bool {\n\tconfigFileOptions := configFileOptions()\n\tisConfigFileOption := func(option string) bool {\n\t\tfor _, configFileOption := range configFileOptions {\n\t\t\tif configFileOption == option {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\n\tfor _, arg := range unknownArgs {\n\t\tif isConfigFileOption(strings.TrimSpace(arg)) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func getConfigFilePath() string {\n\tpathList := [5]string{\n\t\t\"config.json\",\n\t\t\"../config.json\",\n\t\t\"../../config.json\",\n\t\t\"../../../config.json\",\n\t\t\"../../../../config.json\",\n\t}\n\n\t_, b, _, _ := runtime.Caller(0)\n\tfilePath := filepath.Dir(b)\n\tfilePath = filepath.Join(filePath, \"../config.json\")\n\n\tpath, err := os.Getwd()\n\tif err == nil {\n\t\tfor _, configPath := range pathList {\n\t\t\tprocessFilePath := filepath.Join(path, configPath)\n\t\t\texist, _ := exists(processFilePath)\n\t\t\tif exist == true {\n\t\t\t\tfilePath = processFilePath\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn filePath\n}", "func getConfig(fpath string) {\n\traw, err := ioutil.ReadFile(fpath)\n\tif err != nil {\n\t\tglog.Errorf(\"Failed to read config %q, err: %v\", fpath, err)\n\t\tos.Exit(1)\n\t}\n\terr = json.Unmarshal(raw, &ctx.config)\n\tif err != nil {\n\t\tglog.Errorf(\"Failed to json-unmarshal config %q, err: %v\", fpath, err)\n\t\tos.Exit(1)\n\t}\n}", "func filePath() []byte {\n\tconfigFileName := \"config.dev.json\"\n\tif isProd() {\n\t\tconfigFileName = \"config.prod.json\"\n\t}\n\treturn []byte(fmt.Sprintf(\"%s/%s\", directoryPath, configFileName))\n}", "func (conf *Config) ParseConfigFile(path string) error {\n\tdata, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := json.Unmarshal(data, &conf); err != nil {\n\t\treturn err\n\t}\n\n\tlog.WithFields(log.Fields{\n\t\t\"config\": conf,\n\t}).Info(\"Config file parsed\")\n\n\treturn nil\n}", "func (c *MetaConfig) ValidFilePath(path string) bool {\n\t// for us, we'll consider empty string to be the default path\n\tif path == \"\" {\n\t\treturn true\n\t}\n\tif strings.HasPrefix(path, \"~/\") {\n\t\treturn c.ValidFilePath(ReplaceHomeDir(path))\n\t}\n\n\t// Check if file already exists\n\tif _, err := os.Stat(path); err == nil {\n\t\treturn true\n\t}\n\t// Write file and remove it\n\tif err := ioutil.WriteFile(path, []byte{}, 0644); err == nil {\n\t\tos.Remove(path)\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (c Config) ShouldExcludePath(path string) bool {\n\tif strings.HasSuffix(path, \"t8.hcl\") ||\n\t\tstrings.HasSuffix(path, \"t8.yml\") ||\n\t\tstrings.HasSuffix(path, \"before.t8\") ||\n\t\tstrings.HasSuffix(path, \"after.t8\") {\n\t\treturn true\n\t}\n\n\tfor _, excludePath := range c.ExcludePaths {\n\t\tif isUnconditionalExcludePath(excludePath) {\n\t\t\tfor _, excludePath := range excludePath.Paths {\n\t\t\t\tmatched, _ := regexp.MatchString(excludePath, path)\n\t\t\t\tif matched {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor _, param := range c.Parameters {\n\n\t\t\tif isConditionalExcludePath(excludePath) {\n\t\t\t\tif excludePath.ParameterName == param.Name {\n\n\t\t\t\t\tif excludePath.Operator == NotEqual && excludePath.ParameterValue != param.Actual {\n\t\t\t\t\t\tfor _, excludePath := range excludePath.Paths {\n\t\t\t\t\t\t\tmatched, _ := regexp.MatchString(excludePath, path)\n\t\t\t\t\t\t\tif matched {\n\t\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif excludePath.Operator == Equal && excludePath.ParameterValue == param.Actual {\n\t\t\t\t\t\tfor _, excludePath := range excludePath.Paths {\n\t\t\t\t\t\t\tmatched, _ := regexp.MatchString(excludePath, path)\n\t\t\t\t\t\t\tif matched {\n\t\t\t\t\t\t\t\treturn true\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\treturn false\n}", "func isPathASystemdDropin(path string) (bool, string, string) {\n\tif !strings.HasPrefix(path, \"/etc/systemd/system\") {\n\t\treturn false, \"\", \"\"\n\t}\n\tif !strings.HasSuffix(path, \".conf\") {\n\t\treturn false, \"\", \"\"\n\t}\n\tpathSegments := strings.Split(path, \"/\")\n\tdropinName := pathSegments[len(pathSegments)-1]\n\tservicePart := pathSegments[len(pathSegments)-2]\n\tallServiceSegments := strings.Split(servicePart, \".\")\n\tif allServiceSegments[len(allServiceSegments)-1] != \"d\" {\n\t\treturn false, \"\", \"\"\n\t}\n\tserviceName := strings.Join(allServiceSegments[:len(allServiceSegments)-1], \".\")\n\treturn true, serviceName, dropinName\n}", "func getEtcdBucket(path string) string {\n\tidx := strings.LastIndex(path, \"/\")\n\tif idx == -1 {\n\t\tpanic(\"path with no slashes \" + path)\n\t}\n\tbucket := path[:idx]\n\tif len(bucket) == 0 {\n\t\tpanic(\"invalid bucket for path \" + path)\n\t}\n\treturn bucket\n}", "func parseConfig(path string) (Config, error) {\n\tconfig := Config{}\n\tfile, err := os.Open(path)\n\tdefer file.Close()\n\tif err != nil {\n\t\treturn config, err\n\t}\n\tdecoder := json.NewDecoder(file)\n\terr = decoder.Decode(&config)\n\tif err != nil {\n\t\treturn config, err\n\t}\n\treturn config, nil\n}", "func NewEtcdStorage(t *testing.T) (*storagebackend.Config, *etcdtesting.EtcdTestServer) {\n\tserver, config := etcdtesting.NewUnsecuredEtcd3TestClientServer(t)\n\tmediaType, _, err := mime.ParseMediaType(runtime.ContentTypeJSON)\n\tif err != nil {\n\t\tt.Errorf(\"failed to parse media type: %v\", err)\n\t}\n\tstorageSerializer, ok := runtime.SerializerInfoForMediaType(api.Codecs.SupportedMediaTypes(), mediaType)\n\tif !ok {\n\t\tt.Errorf(\"no serializer for %s\", mediaType)\n\t}\n\ts := storageSerializer.Serializer\n\tds := recognizer.NewDecoder(s, api.Codecs.UniversalDeserializer())\n\tconfig.Codec = api.Codecs.CodecForVersions(s, ds, schema.GroupVersions{coapi.SchemeGroupVersion}, nil)\n\treturn config, server\n}", "func (*Data_Etcd) Descriptor() ([]byte, []int) {\n\treturn file_internal_conf_conf_proto_rawDescGZIP(), []int{1, 0}\n}", "func isELF(path string) (bool, error) {\n\tfd, err := elf.Open(path)\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), \"bad magic number\") {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, err\n\t}\n\tfd.Close()\n\treturn true, nil\n}", "func (k *kubelet) configFile() (string, error) {\n\tconfig := &kubeletconfig.KubeletConfiguration{\n\t\tTypeMeta: v1.TypeMeta{\n\t\t\tKind: \"KubeletConfiguration\",\n\t\t\tAPIVersion: kubeletconfig.SchemeGroupVersion.String(),\n\t\t},\n\t\t// Enables TLS certificate rotation, which is good from security point of view.\n\t\tRotateCertificates: true,\n\t\t// Request HTTPS server certs from API as well, so kubelet does not generate self-signed certificates.\n\t\tServerTLSBootstrap: true,\n\t\t// If Docker is configured to use systemd as a cgroup driver and Docker is used as container\n\t\t// runtime, this needs to be set to match Docker.\n\t\t// TODO pull that information dynamically based on what container runtime is configured.\n\t\tCgroupDriver: k.config.CgroupDriver,\n\t\t// Address where kubelet should listen on.\n\t\tAddress: k.config.Address,\n\t\t// Disable healht port for now, since we don't use it.\n\t\t// TODO check how to use it and re-enable it.\n\t\tHealthzPort: &[]int32{0}[0],\n\t\t// Set up cluster domain. Without this, there is no 'search' field in /etc/resolv.conf in containers, so\n\t\t// short-names resolution like mysvc.myns.svc does not work.\n\t\tClusterDomain: \"cluster.local\",\n\t\t// Authenticate clients using CA file.\n\t\tAuthentication: kubeletconfig.KubeletAuthentication{\n\t\t\tX509: kubeletconfig.KubeletX509Authentication{\n\t\t\t\tClientCAFile: \"/etc/kubernetes/pki/ca.crt\",\n\t\t\t},\n\t\t},\n\n\t\t// This defines where should pods cgroups be created, like /kubepods and /kubepods/burstable.\n\t\t// Also when specified, it suppresses a lot message about it.\n\t\tCgroupRoot: \"/\",\n\n\t\t// Used for calculating node allocatable resources.\n\t\t// If EnforceNodeAllocatable has 'system-reserved' set, those limits will be enforced on cgroup specified\n\t\t// with SystemReservedCgroup.\n\t\tSystemReserved: k.config.SystemReserved,\n\n\t\t// Used for calculating node allocatable resources.\n\t\t// If EnforceNodeAllocatable has 'kube-reserved' set, those limits will be enforced on cgroup specified\n\t\t// with KubeReservedCgroup.\n\t\tKubeReserved: k.config.KubeReserved,\n\n\t\tClusterDNS: k.config.ClusterDNSIPs,\n\n\t\tHairpinMode: k.config.HairpinMode,\n\t}\n\n\tkubelet, err := yaml.Marshal(config)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"serializing to YAML: %w\", err)\n\t}\n\n\treturn string(kubelet), nil\n}", "func getConfig(path string) (*config, error) {\n\tf, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcfg := &config{}\n\tif err := yaml.Unmarshal(f, &cfg); err != nil {\n\t\treturn nil, err\n\t}\n\tfmt.Println(cfg)\n\n\treturn cfg, nil\n\n}", "func (n *NginxConfigFileTemplete) GetConfigFileDirPath() string {\n\treturn n.configFileDirPath\n}", "func getHash(path string) string {\n myfile, err := os.Open(path)\n if err != nil {\n log.Fatal(\"ERROR: problem opening path:\", err)\n }\n defer myfile.Close()\n \n hasher := sha256.New()\n\n if _, err := io.Copy(hasher, myfile); err != nil {\n log.Fatal(\"ERROR: problem copying file into hasher:\", err)\n }\n \n return hex.EncodeToString(hasher.Sum(nil))\n}", "func (g *GenericVaultBackend) EncryptionConfigPath() string {\n\treturn filepath.Join(g.Path(), \"encryption-config\")\n}", "func getConfigFilename(context *cli.Context) (string, bool) {\n\tcf := context.GlobalString(\"config-filename\")\n\n\tif filepath.IsAbs(cf) {\n\t\t// Absolute path specified; user knows what they want.\n\t\t_, err := os.Stat(cf)\n\t\treturn cf, err == nil\n\t}\n\n\tabsCF, err := filepath.Abs(cf)\n\tif err != nil {\n\t\t// syscall failure; treat as if file doesn't exist.\n\t\treturn cf, false\n\t}\n\tif _, err := os.Stat(absCF); err == nil {\n\t\t// File exists on relative path.\n\t\treturn absCF, true\n\t}\n\n\tif xdgCF, err := xdg.Config.Find(cf); err == nil {\n\t\t// File exists in an XDG directory.\n\t\treturn xdgCF, true\n\t}\n\n\t// Default to relative path. This is probably what the user expects if\n\t// it wasn't found anywhere else.\n\treturn absCF, false\n}", "func (p EksProvisioner) writeConfigFile() (string, error) {\n\tif len(p.eksConfig.Params.ConfigFile) > 0 {\n\n\t\t// marshal the struct to YAML\n\t\tyamlBytes, err := yaml.Marshal(&p.eksConfig.Params.ConfigFile)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.WithStack(err)\n\t\t}\n\n\t\tyamlString := string(yamlBytes[:])\n\n\t\t// write the config to a temporary file\n\t\ttmpfile, err := ioutil.TempFile(\"\", \"eks.*.yaml\")\n\t\tif err != nil {\n\t\t\treturn \"\", errors.WithStack(err)\n\t\t}\n\n\t\tdefer tmpfile.Close()\n\n\t\tif _, err := tmpfile.Write([]byte(yamlString)); err != nil {\n\t\t\treturn \"\", errors.WithStack(err)\n\t\t}\n\t\tif err := tmpfile.Close(); err != nil {\n\t\t\treturn \"\", errors.WithStack(err)\n\t\t}\n\n\t\tlog.Logger.Debugf(\"EKS config file written to: %s\", tmpfile.Name())\n\n\t\treturn tmpfile.Name(), nil\n\n\t} else {\n\t\tlog.Logger.Infof(\"No EKS config file data configured. No config file path will be passed \" +\n\t\t\t\"to eksctl commands\")\n\n\t\treturn \"\", nil\n\t}\n}", "func (c *EtcdConfig) Validate() error {\n\t_, err := govalidator.ValidateStruct(c)\n\treturn err\n}", "func GetEdgercPath(c *cli.Context) string {\n\tedgercPath := c.String(\"edgerc\")\n\tif edgercPath == \"\" {\n\t\treturn edgegrid.DefaultConfigFile\n\t}\n\treturn edgercPath\n}", "func (m *Meta) HasChanged(ctx context.Context, fs afs.Service) (bool, error) {\n\tif m.baseURL == \"\" {\n\t\treturn false, nil\n\t}\n\tif !m.isCheckDue(time.Now()) {\n\t\treturn false, nil\n\t}\n\n\troutes, err := fs.List(ctx, m.baseURL, option.NewRecursive(true))\n\tif err != nil {\n\t\treturn false, errors.Wrapf(err, \"failed to load rules %v\", m.baseURL)\n\t}\n\tif !m.hasChanges(routes) {\n\t\treturn false, nil\n\t}\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tm.routes = make(map[string]time.Time)\n\tfor _, route := range routes {\n\t\tif route.IsDir() || !(path.Ext(route.Name()) == \".json\" || path.Ext(route.Name()) == \".yaml\") {\n\t\t\tcontinue\n\t\t}\n\t\tm.routes[route.URL()] = route.ModTime()\n\t}\n\treturn true, nil\n}", "func mustConfFile(configPath string) (string, error) {\n\t_, err := os.Stat(configPath)\n\tif os.IsNotExist(err) {\n\t\treturn \"\", err\n\t}\n\treturn configPath, nil\n}", "func (c *Config) Filepath() string {\n\treturn c.loadedFromFilepath\n}", "func GetCfgPath(c domain.CLIContext) string {\n\treturn c.String(cfgPathKey)\n}", "func ParseConfig(path string) Config {\n file, err := os.Open(path)\n if err != nil {\n log.Panicf(\"Can't load config: %s\", err.Error())\n }\n decoder := json.NewDecoder(file)\n var config Config\n err = decoder.Decode(&config)\n if err != nil {\n log.Panicf(\"Can't parse config file: %s. Error: %s\", path, err.Error())\n }\n return config\n}", "func ReadConfigFile(conf *Config, path string) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tconfigFile, _ := ioutil.ReadAll(file)\n\tyaml.Unmarshal(configFile, conf)\n\n\tif conf.DatabaseDriver == \"boltdb\" && conf.DatabasePath == \"\" {\n\t\tconf.DatabasePath = \"db/eremetic.db\"\n\t}\n}", "func ValidateAPIServerETCDConfiguration(config imports.APIServerEtcdConfiguration, fldPath *field.Path) field.ErrorList {\n\tallErrs := field.ErrorList{}\n\n\tif len(config.Url) == 0 {\n\t\tallErrs = append(allErrs, field.Invalid(fldPath.Child(\"url\"), config.Url, \"url of etcd must be set\"))\n\t}\n\n\tif config.SecretRef != nil && (config.CABundle != nil || config.ClientCert != nil || config.ClientKey != nil) {\n\t\tallErrs = append(allErrs, field.Invalid(fldPath.Child(\"secretRef\"), config.Url, \"cannot configure both the secret reference as well as supply the certificate values directly\"))\n\t}\n\n\t// Do not verify the client certs against the given CA, as the client certs do not necessarily have to be signed by the\n\t// same CA that signed etcd's TLS serving certificates.\n\tif config.CABundle != nil {\n\t\tallErrs = append(allErrs, ValidateCACertificate(*config.CABundle, fldPath.Child(\"caBundle\"))...)\n\t}\n\n\tif config.ClientCert != nil {\n\t\tallErrs = append(allErrs, ValidateClientCertificate(*config.ClientCert, fldPath.Child(\"clientCert\"))...)\n\t}\n\n\tif config.ClientKey != nil {\n\t\tallErrs = append(allErrs, ValidatePrivateKey(*config.ClientKey, fldPath.Child(\"clientKey\"))...)\n\t}\n\n\treturn allErrs\n}", "func getFileConfiguration(t *testing.T, content string) *configuration.Registry {\n\ttmpFile, err := ioutil.TempFile(os.TempDir(), \"configFile-\")\n\trequire.NoError(t, err)\n\tdefer os.Remove(tmpFile.Name())\n\t_, err = tmpFile.Write([]byte(content))\n\trequire.NoError(t, err)\n\trequire.NoError(t, tmpFile.Close())\n\tconfig, err := configuration.New(tmpFile.Name())\n\trequire.NoError(t, err)\n\treturn config\n}" ]
[ "0.5153754", "0.50409085", "0.50409085", "0.49216852", "0.48767686", "0.476166", "0.46999902", "0.4645964", "0.46016797", "0.45887595", "0.4587537", "0.45873547", "0.45760208", "0.4569562", "0.4514388", "0.45088005", "0.45053396", "0.4501646", "0.4494398", "0.4474307", "0.4468049", "0.44650996", "0.44410303", "0.44106704", "0.44078323", "0.43953094", "0.43951473", "0.4382739", "0.43783066", "0.43777984", "0.43760347", "0.43733293", "0.43714944", "0.43696865", "0.4367361", "0.43614295", "0.43459165", "0.4344193", "0.4337937", "0.43358865", "0.43353915", "0.43333313", "0.43254045", "0.43207526", "0.43179062", "0.43097582", "0.42880654", "0.4286875", "0.42855063", "0.42822206", "0.4271137", "0.42662948", "0.42662948", "0.42480677", "0.4246072", "0.4242264", "0.4238519", "0.42383355", "0.42357013", "0.4215946", "0.4215946", "0.42054853", "0.42021528", "0.41992104", "0.41902044", "0.4189614", "0.41886458", "0.41851598", "0.41814497", "0.41794372", "0.4178984", "0.41723168", "0.41631165", "0.4161923", "0.41606206", "0.41605002", "0.41570842", "0.41478288", "0.41468322", "0.41330722", "0.41325113", "0.41303995", "0.41291913", "0.41242686", "0.41217995", "0.41179487", "0.41159028", "0.4112529", "0.4112205", "0.41108915", "0.41096392", "0.4106012", "0.4105053", "0.41023386", "0.41016144", "0.4098779", "0.40948474", "0.40909255", "0.40876815", "0.40841606" ]
0.8127358
0
getDirection from byte. Panics on unknown direction.
getDirection из байта. Вызывает панику при неизвестном направлении.
func getDirection(d byte) direction { switch d { case 'R': return right case 'L': return left case 'U': return up case 'D': return down default: panic(fmt.Sprintf("unknown direction %v", d)) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (behaviour *Dumb) GetDirection() basic.Direction {\n\treturn behaviour.direction\n}", "func (self Source) GetDirection(result *Vector) {\n\tresult[x], result[y], result[z] = self.Get3f(AlDirection)\n}", "func convertDirectionCode(gpxDirCode string) uint8 {\n\n\tbrytonDirCode := DirectionCodeGoAhead\n\n\tswitch gpxDirCode {\n\tcase \"tshl\":\n\t\tbrytonDirCode = DirectionCodeCloseLeft\n\tcase \"left\":\n\t\tbrytonDirCode = DirectionCodeLeft\n\tcase \"tsll\":\n\t\tbrytonDirCode = DirectionCodeSlightLeft\n\tcase \"straight\":\n\t\tbrytonDirCode = DirectionCodeGoAhead\n\tcase \"tslr\":\n\t\tbrytonDirCode = DirectionCodeSlightRight\n\tcase \"right\":\n\t\tbrytonDirCode = DirectionCodeRight\n\tcase \"tshr\":\n\t\tbrytonDirCode = DirectionCodeCloseRight\n\tdefault:\n\t\tfmt.Println(\"Unsupported direction code: \" + gpxDirCode + \"! Using GoAhead!\")\n\t}\n\n\treturn brytonDirCode\n}", "func GetDirection(pinNo int) uint32 {\n\tindex := (pinNo) / 32\n\n\tregVal := readRegistry(index)\n\n\tgpio := uint32(pinNo % 32)\n\n\tval := ((regVal >> gpio) & 0x1)\n\n\treturn val\n\n}", "func deltaToDirection(dX, dY int) Direction {\n\n\tif dX == -1 && dY == -1 {\n\t\treturn DirectionNW\n\t} else if dX == 0 && dY == -1 {\n\t\treturn DirectionN\n\t} else if dX == 1 && dY == -1 {\n\t\treturn DirectionNE\n\t} else if dX == -1 && dY == 0 {\n\t\treturn DirectionW\n\t} else if dX == 1 && dY == 0 {\n\t\treturn DirectionE\n\t} else if dX == -1 && dY == 1 {\n\t\treturn DirectionSW\n\t} else if dX == 0 && dY == 1 {\n\t\treturn DirectionS\n\t} else if dX == 1 && dY == 1 {\n\t\treturn DirectionSE\n\t} else {\n\t\treturn DirectionUnknown\n\t}\n\n}", "func (p *Port) Direction() int {\n\treturn p.direction\n}", "func (v *MenuButton) GetDirection() ArrowType {\n\tc := C.gtk_menu_button_get_direction(v.native())\n\treturn ArrowType(c)\n}", "func (o PacketMirroringFilterResponsePtrOutput) Direction() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *PacketMirroringFilterResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Direction\n\t}).(pulumi.StringPtrOutput)\n}", "func (o PacketMirroringFilterOutput) Direction() PacketMirroringFilterDirectionPtrOutput {\n\treturn o.ApplyT(func(v PacketMirroringFilter) *PacketMirroringFilterDirection { return v.Direction }).(PacketMirroringFilterDirectionPtrOutput)\n}", "func (s *ClampDirectionOffset) Direction() dprec.Vec3 {\n\treturn s.direction\n}", "func getDirection(current_direction string, action string) string{\n action = strings.ToUpper(action)\n current_direction = strings.ToUpper(current_direction)\n\n var cur_direction_index int\n clockwise := []string{0:\"N\",1:\"E\",2:\"S\",3:\"W\"}\n\n for i := range clockwise{\n if clockwise[i] == current_direction {\n cur_direction_index = i\n break\n }\n }\n\n if action == \"L\" {\n cur_direction_index -= 1\n if cur_direction_index < 0 {\n cur_direction_index += 4\n }\n }else if action == \"R\"{\n cur_direction_index += 1\n if cur_direction_index > 3 {\n cur_direction_index -= 4\n }\n }\n\n return clockwise[cur_direction_index]\n}", "func (o PacketMirroringFilterPtrOutput) Direction() PacketMirroringFilterDirectionPtrOutput {\n\treturn o.ApplyT(func(v *PacketMirroringFilter) *PacketMirroringFilterDirection {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Direction\n\t}).(PacketMirroringFilterDirectionPtrOutput)\n}", "func (o PacketMirroringFilterResponseOutput) Direction() pulumi.StringOutput {\n\treturn o.ApplyT(func(v PacketMirroringFilterResponse) string { return v.Direction }).(pulumi.StringOutput)\n}", "func (node *hostNode) GetPeerDirection(id peer.ID) network.Direction {\n\tconns := node.host.Network().ConnsToPeer(id)\n\n\tif len(conns) != 1 {\n\t\treturn network.DirUnknown\n\t}\n\treturn conns[0].Stat().Direction\n}", "func getord(input byte) int {\n\tLOWER_OFFSET := 87\n\tDIGIT_OFFSET := 48\n\tUPPER_OFFSET := 29\n\tvar result int\n\tif input <= 57 && input >= 48 {\n\t\tresult = int(input) - DIGIT_OFFSET\n\t} else if input >= 97 && input <= 122 {\n\t\tresult = int(input) - LOWER_OFFSET\n\t} else if input >= 65 && input <= 90 {\n\t\tresult = int(input) - UPPER_OFFSET\n\t} else {\n\t\tfmt.Printf(\"Dafux is this\\n\")\n\t\tresult = 0\n\t}\n\t//fmt.Printf(\"%c as base10 is %d\\n\", input, result)\n\treturn result\n}", "func DirectionFromString(d string) Direction {\n\tswitch d {\n\tcase \"L\":\n\t\treturn DirectionLeft\n\tcase \"R\":\n\t\treturn DirectionRight\n\tdefault:\n\t\treturn DirectionUnknown\n\t}\n}", "func ProtoToComputeFirewallDirectionEnum(e computepb.ComputeFirewallDirectionEnum) *compute.FirewallDirectionEnum {\n\tif e == 0 {\n\t\treturn nil\n\t}\n\tif n, ok := computepb.ComputeFirewallDirectionEnum_name[int32(e)]; ok {\n\t\te := compute.FirewallDirectionEnum(n[len(\"ComputeFirewallDirectionEnum\"):])\n\t\treturn &e\n\t}\n\treturn nil\n}", "func FindDirection(alias string) (dir Direction, found bool) {\n\tdir, found = dirMap[strings.ToLower(alias)]\n\treturn dir, found\n}", "func (el *gameStruct) Direction() dir.Direction {\n\treturn el.direction\n}", "func (r *Rule) direction(key item, l *lexer) error {\n\tif key.typ != itemDirection {\n\t\tpanic(\"item is not a direction\")\n\t}\n\tswitch key.value {\n\tcase \"->\":\n\t\tr.Bidirectional = false\n\tcase \"<>\":\n\t\tr.Bidirectional = true\n\tdefault:\n\t\treturn fmt.Errorf(\"invalid direction operator %q\", key.value)\n\t}\n\treturn nil\n}", "func (gpio *RpiGpio) Direction(p Pin, d PinDirection) error {\n\tpin, err := gpio.getBCMGpio(p)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn gpio.bcm.Direction(pin, d)\n}", "func (d decoderStripe) GetDirectionByIcon(searchedIcon icon) decoderDirection {\n\tfor i, iconIter := range d.icons {\n\t\tif iconIter == searchedIcon {\n\t\t\treturn d.directions[i]\n\t\t}\n\t}\n\n\tpanic(\"Should not happen!\")\n}", "func DirectionFromString(c string) Direction {\n\tswitch c {\n\tcase \"north\":\n\t\treturn Direction_north\n\tcase \"south\":\n\t\treturn Direction_south\n\tcase \"east\":\n\t\treturn Direction_east\n\tcase \"west\":\n\t\treturn Direction_west\n\n\tdefault:\n\t\treturn 0\n\t}\n}", "func (r *Reader) ReadByte() (byte, error) {\n\tr.prevRune = -1\n\tif r.i >= int64(len(r.s)) {\n\t\treturn 0, io.EOF\n\t}\n\tb := r.s[r.i]\n\tr.i++\n\treturn b, nil\n}", "func StringToDirection(s string) Direction {\n\tswitch {\n\tcase s == \"up\":\n\t\treturn Up\n\tcase s == \"down\":\n\t\treturn Down\n\tcase s == \"left\":\n\t\treturn Left\n\tcase s == \"right\":\n\t\treturn Right\n\t}\n\treturn Direction{}\n}", "func (p *Packet) ReadByte() byte {\n\tif p.readIndex+1 > len(p.Payload) {\n\t\tlog.Warning.Println(\"Error parsing packet arguments: { opcode=\" + strconv.Itoa(int(p.Opcode)) + \"; offset=\" + strconv.Itoa(p.readIndex) + \" };\")\n\t\treturn byte(0)\n\t}\n\tdefer func() {\n\t\tp.readIndex++\n\t}()\n\treturn p.Payload[p.readIndex] & 0xFF\n}", "func (m NoMsgTypes) GetMsgDirection() (v enum.MsgDirection, err quickfix.MessageRejectError) {\n\tvar f field.MsgDirectionField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "func (p *Packet) getByte() byte {\n\tb := p.buf[p.pos]\n\tp.pos++\n\treturn b\n}", "func (m NoMDEntries) GetTickDirection() (v enum.TickDirection, err quickfix.MessageRejectError) {\n\tvar f field.TickDirectionField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "func GetByte(r io.Reader) (byte, error) {\n\tt := make([]byte, 1)\n\t_, err := r.Read(t)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn t[0], nil\n}", "func (m *Manager) ReadByte() byte {\n\treturn byte(m.readUint(8))\n}", "func (m *MockHostNode) GetPeerDirection(id peer.ID) network.Direction {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetPeerDirection\", id)\n\tret0, _ := ret[0].(network.Direction)\n\treturn ret0\n}", "func (obj *Edge) GetDirectionType() types.TGDirectionType {\n\tif obj.EntityType != nil {\n\t\treturn obj.EntityType.(*EdgeType).GetDirectionType()\n\t} else {\n\t\treturn obj.directionType\n\t}\n}", "func DirectionValidator(d Direction) error {\n\tswitch d {\n\tcase DirectionDEBIT, DirectionCREDIT:\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"transaction: invalid enum value for direction field: %q\", d)\n\t}\n}", "func GetIterDirection(iterDirection ...IterDirection) IterDirection {\n\tdirection := IterDirectionForward\n\tif len(iterDirection) > 0 {\n\t\tswitch iterDirection[0] {\n\t\tcase IterDirectionForward:\n\t\t\tbreak\n\t\tcase IterDirectionBackward:\n\t\t\tdirection = iterDirection[0]\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"unknown iteration direction: %d\", iterDirection[0]))\n\t\t}\n\t}\n\n\treturn direction\n}", "func (c *Cursor) GetByte() byte {\n\treturn (*c).bytes[(*c).Index]\n}", "func (o FirewallPolicyRuleResponseOutput) Direction() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FirewallPolicyRuleResponse) string { return v.Direction }).(pulumi.StringOutput)\n}", "func lc(b byte) byte {\n\treturn b | 0x20\n}", "func (c *Contract) GetByte(n uint64) byte {\n\tif n < uint64(len(c.Code)) {\n\t\treturn c.Code[n]\n\t}\n\treturn 0\n}", "func (n *Node) dir(key []byte) byte {\n\tbyteoff := n.bitoff >> 3\n\tbitmask := byte(1) << (n.bitoff & 7) // 5 -> 0010 0000\n\tif byteoff < uint(len(key)) && key[byteoff] & bitmask != 0 {\n\t\treturn 1\n\t}\n\treturn 0\n}", "func (s *swimmer) direction() int {\n\treturn s.moveDirection\n}", "func (o FirewallPolicyRuleOutput) Direction() FirewallPolicyRuleDirectionPtrOutput {\n\treturn o.ApplyT(func(v FirewallPolicyRule) *FirewallPolicyRuleDirection { return v.Direction }).(FirewallPolicyRuleDirectionPtrOutput)\n}", "func shift_direction(b Bitboard, direction int) Bitboard {\n\tif direction == NORTH_EAST || direction == EAST || direction == SOUTH_EAST {\n\t\treturn signed_shift(b&^FILE_HBB, direction)\n\t}\n\tif direction == NORTH_WEST || direction == WEST || direction == SOUTH_WEST {\n\t\treturn signed_shift(b&^FILE_ABB, direction)\n\t}\n\treturn signed_shift(b, direction)\n}", "func ReadDirectionNorthSouth(data []byte) DirectionNorthSouth {\n\tbits := (data[3] & 0x80) >> 7\n\treturn DirectionNorthSouth(bits)\n}", "func (o GoogleDatastoreAdminV1IndexedPropertyResponseOutput) Direction() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GoogleDatastoreAdminV1IndexedPropertyResponse) string { return v.Direction }).(pulumi.StringOutput)\n}", "func (o GoogleDatastoreAdminV1IndexedPropertyOutput) Direction() GoogleDatastoreAdminV1IndexedPropertyDirectionOutput {\n\treturn o.ApplyT(func(v GoogleDatastoreAdminV1IndexedProperty) GoogleDatastoreAdminV1IndexedPropertyDirection {\n\t\treturn v.Direction\n\t}).(GoogleDatastoreAdminV1IndexedPropertyDirectionOutput)\n}", "func (f MsgDirectionField) Tag() quickfix.Tag { return tag.MsgDirection }", "func direction(k1 collection.Comparer, k2 interface{}) int {\n\treturn math.Signum(math.Signum(k1.Compare(k2) + 1))\n}", "func (m NoSides) GetRoundingDirection() (v enum.RoundingDirection, err quickfix.MessageRejectError) {\n\tvar f field.RoundingDirectionField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "func (z *Tokenizer) nextByte() byte {\n\tif z.err == io.EOF {\n\t\treturn 0\n\t}\n\tby, err := z.r.ReadByte()\n\tif err == io.EOF {\n\t\tz.err = io.EOF\n\t\treturn 0\n\t} else if err != nil {\n\t\tpanic(err)\n\t}\n\treturn by\n}", "func (MoveRequest_Direction) EnumDescriptor() ([]byte, []int) {\n\treturn file_game_game_proto_rawDescGZIP(), []int{2, 0}\n}", "func ReadByte(r io.Reader) (byte, error) {\n\td := make([]byte, 1, 1)\n\t_, err := io.ReadFull(r, d)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn d[0], nil\n}", "func ord(c byte) int {\n\treturn int(c - '0')\n}", "func ord(c byte) int {\n\treturn int(c - '0')\n}", "func Direction(lon0, lat0, lon1, lat1 float64) float64 {\n\tc_dir := C.fap_direction(\n\t\tC.double(lon0), C.double(lat0),\n\t\tC.double(lon1), C.double(lat1),\n\t)\n\n\treturn float64(c_dir)\n}", "func readByte(r io.Reader) (uint8, error) {\n\ttmp := []uint8{0}\n\t_, e := r.Read(tmp)\n\treturn tmp[0], e\n}", "func chooseDirection(elevState cost.AssignedOrderInformation, ID string, floor int) elevio.MotorDirection {\n\tswitch elevState.States[ID].Direction {\n\tcase \"stop\":\n\t\tfallthrough\n\tcase \"down\":\n\t\tif ordersBelow(elevState, ID, floor) {\n\t\t\treturn elevio.MD_Down\n\t\t} else if ordersAbove(elevState, ID, floor) {\n\t\t\treturn elevio.MD_Up\n\t\t} else {\n\t\t\treturn elevio.MD_Stop\n\t\t}\n\tcase \"up\":\n\t\tif ordersAbove(elevState, ID, floor) {\n\t\t\treturn elevio.MD_Up\n\t\t} else if ordersBelow(elevState, ID, floor) {\n\t\t\treturn elevio.MD_Down\n\t\t} else {\n\t\t\treturn elevio.MD_Stop\n\t\t}\n\tdefault:\n\t\treturn elevio.MD_Stop\n\t}\n\treturn elevio.MD_Stop\n}", "func (d *Decoder) Byte() byte {\n\tb, err := d.buf.ReadByte()\n\tif err != nil {\n\t\tpanic(\"unmarshalByte\")\n\t}\n\treturn b\n}", "func (o SecurityPolicyRuleOutput) Direction() SecurityPolicyRuleDirectionPtrOutput {\n\treturn o.ApplyT(func(v SecurityPolicyRule) *SecurityPolicyRuleDirection { return v.Direction }).(SecurityPolicyRuleDirectionPtrOutput)\n}", "func (r *DecReader) ReadByte() (byte, error) {\n\tif r.err != nil {\n\t\treturn 0, r.err\n\t}\n\tif r.firstRead {\n\t\tr.firstRead = false\n\t\tif _, err := r.readFragment(nil, 0); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tb := r.plaintextBuffer[0]\n\t\tr.offset = 1\n\t\treturn b, nil\n\t}\n\tif r.offset > 0 && r.offset < len(r.plaintextBuffer) {\n\t\tb := r.plaintextBuffer[r.offset]\n\t\tr.offset++\n\t\treturn b, nil\n\t}\n\tif r.closed {\n\t\treturn 0, io.EOF\n\t}\n\n\tr.offset = 0\n\tif _, err := r.readFragment(nil, 1); err != nil {\n\t\treturn 0, err\n\t}\n\tb := r.plaintextBuffer[0]\n\tr.offset = 1\n\treturn b, nil\n}", "func (Direction) EnumDescriptor() ([]byte, []int) {\n\treturn file_mud_proto_rawDescGZIP(), []int{0}\n}", "func (l *LinksToIterator) Direction() string { return l.direction }", "func (d Direction) Flip() Direction {\n\treturn (d + 2) % 4\n}", "func Direction(op int32) int32 {\n\tif op == et.OpBuy {\n\t\treturn et.ListDESC\n\t}\n\treturn et.ListASC\n}", "func (o SecurityPolicyRuleResponseOutput) Direction() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SecurityPolicyRuleResponse) string { return v.Direction }).(pulumi.StringOutput)\n}", "func CalculateDirection(from, to Dot) Direction {\n\tif !from.Equals(to) {\n\t\tvar diffX, diffY uint8\n\n\t\tif from.X > to.X {\n\t\t\tdiffX = from.X - to.X\n\t\t} else {\n\t\t\tdiffX = to.X - from.X\n\t\t}\n\t\tif from.Y > to.Y {\n\t\t\tdiffY = from.Y - to.Y\n\t\t} else {\n\t\t\tdiffY = to.Y - from.Y\n\t\t}\n\n\t\tif diffX > diffY {\n\t\t\tif to.X > from.X {\n\t\t\t\treturn DirectionEast\n\t\t\t}\n\t\t\treturn DirectionWest\n\t\t}\n\n\t\tif diffY > diffX {\n\t\t\tif to.Y > from.Y {\n\t\t\t\treturn DirectionSouth\n\t\t\t}\n\t\t\treturn DirectionNorth\n\t\t}\n\t}\n\n\treturn RandomDirection()\n}", "func (ch *Chunk) ReadByte() (byte, error) {\n\tif ch.IsFullyRead() {\n\t\treturn 0, io.EOF\n\t}\n\tvar r byte\n\terr := ch.ReadLE(&r)\n\treturn r, err\n}", "func ctlz8(uint8) uint8", "func ReadByte(r io.Reader) (byte, error) {\n\tb := make([]byte, 1)\n\tn, err := r.Read(b)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif n != 1 {\n\t\treturn 0, fmt.Errorf(\"read invalid amount, exp: 1, n: %d\", n)\n\t}\n\treturn b[0], nil\n}", "func (c *digisparkI2cConnection) ReadByte() (val byte, err error) {\n\tc.mtx.Lock()\n\tdefer c.mtx.Unlock()\n\n\tbuf := []byte{0}\n\tif err = c.readAndCheckCount(buf); err != nil {\n\t\treturn\n\t}\n\tval = buf[0]\n\treturn\n}", "func (p *Lexer) PeekByte() byte {\n\tc, err := p.Byte()\n\n\tif err != nil {\n\t\treturn 0\n\t}\n\n\tp.UnreadByte()\n\treturn c\n}", "func travelDirection(from int, to int) (rowDir int, colDir int) {\n fromRow := rowFromPosition(from)\n fromCol := colFromPosition(from)\n toRow := rowFromPosition(to)\n toCol := colFromPosition(to)\n\n if fromRow < toRow {\n rowDir = 1\n } else if fromRow > toRow {\n rowDir = -1\n } else {\n rowDir = 0\n }\n\n if fromCol < toCol {\n colDir = 1\n } else if fromCol > toCol {\n colDir = -1\n } else {\n colDir = 0\n }\n\n return\n}", "func dirNameToInt(direction string) int {\n dirHash := map[string]int{\"north\": 0, \"east\": 1, \"south\": 2, \"west\": 3}\n\n return dirHash[direction]\n}", "func (o Opcode) LL() uint8 {\n\treturn uint8(o & 0xFF00 >> 8)\n}", "func (Direction) EnumDescriptor() ([]byte, []int) {\n\treturn file_common_proto_rawDescGZIP(), []int{2}\n}", "func readByte(r io.Reader) (byte, error) {\n\tif r, ok := r.(io.ByteReader); ok {\n\t\treturn r.ReadByte()\n\t}\n\tvar v [1]byte\n\t_, err := io.ReadFull(r, v[:])\n\treturn v[0], err\n}", "func (l *StringLexer) PrevByte() byte {\n\treturn l.input[l.pos-1]\n}", "func (p *atomReader) ReadSignedByte() int8 {\n\tc, _ := p.r.ReadByte()\n\treturn int8(c)\n}", "func strToDirection(s string) uint32 {\n\tswitch strings.ToLower(s) {\n\tcase \"top\":\n\t\treturn ewmh.SizeTop\n\tcase \"bottom\":\n\t\treturn ewmh.SizeBottom\n\tcase \"left\":\n\t\treturn ewmh.SizeLeft\n\tcase \"right\":\n\t\treturn ewmh.SizeRight\n\tcase \"topleft\":\n\t\treturn ewmh.SizeTopLeft\n\tcase \"topright\":\n\t\treturn ewmh.SizeTopRight\n\tcase \"bottomleft\":\n\t\treturn ewmh.SizeBottomLeft\n\tcase \"bottomright\":\n\t\treturn ewmh.SizeBottomRight\n\t}\n\treturn ewmh.Infer\n}", "func (r *EncReader) ReadByte() (byte, error) {\n\tif r.err != nil {\n\t\treturn 0, r.err\n\t}\n\tif r.firstRead {\n\t\tr.firstRead = false\n\t\tif _, err := r.readFragment(nil, 0); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tb := r.ciphertextBuffer[0]\n\t\tr.offset = 1\n\t\treturn b, nil\n\t}\n\n\tif r.offset > 0 && r.offset < len(r.ciphertextBuffer) {\n\t\tb := r.ciphertextBuffer[r.offset]\n\t\tr.offset++\n\t\treturn b, nil\n\t}\n\tif r.closed {\n\t\treturn 0, io.EOF\n\t}\n\n\tr.offset = 0\n\tif _, err := r.readFragment(nil, 1); err != nil {\n\t\treturn 0, err\n\t}\n\tb := r.ciphertextBuffer[0]\n\tr.offset = 1\n\treturn b, nil\n}", "func (td TupleDesc) GetEnum(i int, tup Tuple) (v uint16, ok bool) {\n\ttd.expectEncoding(i, EnumEnc)\n\tb := td.GetField(i, tup)\n\tif b != nil {\n\t\tv, ok = readEnum(b), true\n\t}\n\treturn\n}", "func RtpDirectionStrGet(direction StreamDirection) string {\n\treturn \"\"\n}", "func readByte(r io.Reader) (ret byte, err error) {\n\tvar be [1]byte\n\tvalBytes := be[0:1]\n\n\tif _, err = io.ReadFull(r, valBytes); err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn valBytes[0], nil\n}", "func ReadByte() {\n\tfmt.Println(\"----------------> ReadByte\")\n\tbuf := bytes.NewBufferString(\"hello\")\n\tfmt.Println(buf.String())\n\n\t// read one byte assign to b\n\tb, _ := buf.ReadByte()\n\n\t// buf=ello\n\tfmt.Println(buf.String())\n\n\t// b=h\n\tfmt.Println(string(b))\n}", "func DenormalizeByte(v int8) float32 {\n\treturn float32(math.Max(float64(v)/127, -1))\n}", "func (node *Configuration) GetByte(parameter uint8) (uint8, error) {\n\tvar value []uint8\n\tvar err error\n\n\tif value, err = node.getValue(parameter, 1); err != nil {\n\t\treturn 0, err\n\t}\n\treturn value[0], nil\n\n}", "func (s *Stream) readByte() (byte, error) {\n\t// since this is readByte functions, therefore, only willRead a byte each time\n\tif err := s.willRead(1); err != nil {\n\t\treturn 0, err\n\t}\n\n\t// pops out a byte from r and return it\n\tb, err := s.r.ReadByte()\n\tif err == io.EOF {\n\t\terr = io.ErrUnexpectedEOF\n\t}\n\treturn b, err\n}", "func (e DirectionMode) C() C.cudnnDirectionMode_t { return C.cudnnDirectionMode_t(e) }", "func (f *Font) getGlyphOriginForDirection(glyph fonts.GID, direction Direction) (x, y Position) {\n\tif direction.isHorizontal() {\n\t\treturn f.getGlyphHOriginWithFallback(glyph)\n\t}\n\treturn f.getGlyphVOriginWithFallback(glyph)\n}", "func (o *FabricFlowControlPolicyAllOf) GetReceiveDirection() string {\n\tif o == nil || o.ReceiveDirection == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ReceiveDirection\n}", "func (r *VarintReader) ReadByte() (c byte, err error) {\n\tn, err := r.Read(r.buf[:])\n\tif n > 0 {\n\t\tc = r.buf[0]\n\t\tr.bytesRead++\n\t}\n\treturn\n}", "func (p *atomReader) ReadUnsignedByte() uint8 {\n\tc, _ := p.r.ReadByte()\n\treturn c\n}", "func (m *MyMigrate) MigrationDirection(desiredVersion semver.Version, desiredStep int) (Direction, error) {\n\tif desiredStep != 0 {\n\t\tcurrentStep, dirty, err := m.Version()\n\t\tif err != migrate.ErrNilVersion && err != nil {\n\t\t\treturn 0, fmt.Errorf(\"Failed to get Migration Step to determine migration direction: %v\", err)\n\t\t}\n\t\tif dirty {\n\t\t\tlog.Fatal(\"DB in Dirty state, Please fix before migrating\")\n\t\t}\n\t\treturn Direction(desiredStep - int(currentStep)), nil\n\t}\n\tcurrentVersion, err := getCurrentDBVersion(m.postgresURI, m.database)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"Failed to get current DB version to determine migration direction: %v\", err)\n\t}\n\n\treturn Direction(desiredVersion.Compare(*currentVersion)), nil\n}", "func (b *Buffer) ReadByte() (byte, error) {\n\tif b.count == 0 { // no elements exist.\n\t\treturn ' ', errors.New(\"Buffer is empty\")\n\t}\n\tval := b.buf[b.head]\n\tb.count--\n\tb.head++\n\tb.head = b.head % b.size\n\treturn val, nil\n}", "func (r *flagsRegister) convFlagToUInt8() uint8 {\n\tvar f uint8\n\tif r.zero {\n\t\tf = f | 1<<ZERO_FLAG_BYTE_POSITION\n\t}\n\n\tif r.subtract {\n\t\tf = f | 1<<SUBTRACT_FLAG_BYTE_POSITION\n\t}\n\n\tif r.halfCarry {\n\t\tf = f | 1<<HALF_CARRY_BYTE_POSITION\n\t}\n\n\tif r.carry {\n\t\tf = f | 1<<CARRY_FLAG_BYTE_POSITION\n\t}\n\treturn f\n\n}", "func (p *Lexer) UnreadByte() {\n\tif p.r <= 0 {\n\t\treturn\n\t}\n\n\tp.r--\n}", "func (r *Reader) ReadByte() byte {\n\tif len(r.buffer) <= r.index {\n\t\tlog.Panic(\"Error reading byte: buffer is too small!\")\n\t}\n\n\tvar data = r.buffer[r.index]\n\tr.index++\n\n\treturn data\n}", "func (s Stream) ReadByte() (byte, error) {\n\tdata := make([]byte, 1)\n\terr := s.ReadFull(data)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn data[0], nil\n}", "func (t *hashReader) ReadByte() (byte, error) {\n\tb := make([]byte, 1)\n\t_, err := t.Read(b)\n\treturn b[0], err\n}", "func GetLocaleDirection() TextDirection {\n\tc := C.gtk_get_locale_direction()\n\treturn TextDirection(c)\n}" ]
[ "0.61097026", "0.6080042", "0.5982142", "0.5905596", "0.5870495", "0.58615726", "0.5804797", "0.5659074", "0.56584334", "0.5656549", "0.5628965", "0.5622957", "0.5585129", "0.54656595", "0.5448121", "0.54473263", "0.5446236", "0.5445572", "0.5425969", "0.539548", "0.5385884", "0.53042036", "0.52968204", "0.5262794", "0.524183", "0.5229698", "0.5211185", "0.52094555", "0.5202126", "0.51890683", "0.51886654", "0.5187027", "0.51853764", "0.5153367", "0.5141897", "0.51139957", "0.51073986", "0.5098951", "0.50906783", "0.5082817", "0.5067517", "0.5064777", "0.50575644", "0.50560784", "0.5037426", "0.50259614", "0.502424", "0.50213325", "0.5016572", "0.50036144", "0.4975384", "0.49678075", "0.49598098", "0.49598098", "0.49498346", "0.49462005", "0.4939709", "0.49352255", "0.4925703", "0.49218515", "0.49218437", "0.4920542", "0.49111745", "0.49057925", "0.49050325", "0.4880187", "0.48775637", "0.4869183", "0.48516607", "0.48499435", "0.4841185", "0.48373556", "0.48313895", "0.4809457", "0.4806266", "0.47939494", "0.47932568", "0.47920167", "0.47867766", "0.47833064", "0.47827357", "0.4780062", "0.47740573", "0.4763846", "0.47603214", "0.47566196", "0.4755875", "0.47468293", "0.4743493", "0.47420415", "0.47398457", "0.47276333", "0.47213352", "0.47207105", "0.46994203", "0.46992862", "0.46936697", "0.46934435", "0.4686186", "0.46855316" ]
0.79665715
0
addSegment to the wire.
Добавить сегмент к проводу.
func (w *wire) addSegment(dir direction, dist int) { var lastPoint point if len(w.points) != 0 { lastPoint = w.points[len(w.points)-1] } w.points = append(w.points, lastPoint.move(dir, dist)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (a *AST) AddSegment(seg *Segment) {\n\t_ = seg.SetParent(a)\n\ta.segs = append(a.segs, seg)\n}", "func (wire *Wire) AddWireSegment(dir byte, magnitude int) error {\n\tvar newSegment segment\n\tif wire.wireSegments == nil {\n\t\tnewSegment.start = Point{0, 0}\n\t\tnewSegment.end = Point{0, 0}\n\t} else {\n\t\tnewSegment = segment{wire.wireSegments[len(wire.wireSegments)-1].end, wire.wireSegments[len(wire.wireSegments)-1].end}\n\t}\n\n\tswitch dir {\n\tcase 'U':\n\t\tnewSegment.end.Y += magnitude\n\tcase 'D':\n\t\tnewSegment.end.Y -= magnitude\n\tcase 'R':\n\t\tnewSegment.end.X += magnitude\n\tcase 'L':\n\t\tnewSegment.end.X -= magnitude\n\tdefault:\n\t\treturn fmt.Errorf(\"Invalid direction given: %v\", dir)\n\t}\n\n\twire.wireSegments = append(wire.wireSegments, newSegment)\n\treturn nil\n}", "func (m *Manifest) AddSegment(s *Segment) {\n\tm.addSegment(s, true)\n\tm.addedSegments[s.ID] = struct{}{}\n}", "func (s *SegmentService) Add(memberID int, item *Segment) (*Response, error) {\n\n\tdata := struct {\n\t\tSegment `json:\"segment\"`\n\t}{*item}\n\n\treq, err := s.client.newRequest(\"POST\", fmt.Sprintf(\"segment/%d\", memberID), data)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := &Response{}\n\tresp, err := s.client.do(req, result)\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\n\titem.ID, _ = result.Obj.ID.Int64()\n\treturn result, nil\n}", "func (s *SegmentChangesWrapper) AddToSegment(segmentName string, keys []string) error {\n\treturn errSegmentStorageNotImplementedMethod\n}", "func (cfw *CoverageDataWriter) AppendSegment(args map[string]string, visitor CounterVisitor) error {\n\tcfw.stab = &stringtab.Writer{}\n\tcfw.stab.InitWriter()\n\tcfw.stab.Lookup(\"\")\n\n\tvar err error\n\tfor k, v := range args {\n\t\tcfw.stab.Lookup(k)\n\t\tcfw.stab.Lookup(v)\n\t}\n\n\tws := &slicewriter.WriteSeeker{}\n\tif err = cfw.writeSegmentPreamble(args, ws); err != nil {\n\t\treturn err\n\t}\n\tif err = cfw.writeCounters(visitor, ws); err != nil {\n\t\treturn err\n\t}\n\tif err = cfw.patchSegmentHeader(ws); err != nil {\n\t\treturn err\n\t}\n\tif err := cfw.writeBytes(ws.BytesWritten()); err != nil {\n\t\treturn err\n\t}\n\tif err = cfw.writeFooter(); err != nil {\n\t\treturn err\n\t}\n\tif err := cfw.w.Flush(); err != nil {\n\t\treturn fmt.Errorf(\"write error: %v\", err)\n\t}\n\tcfw.stab = nil\n\treturn nil\n}", "func (s *segment) Append(b []byte) error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\t// TODO: write in encoded form\n\t// https://github.com/komuw/shifta/issues/1\n\tn, err := s.f.Write(b)\n\tif err != nil {\n\t\treturn errSegmentWrite(err)\n\t}\n\n\tif n != len(b) {\n\t\t// partial write.\n\t\terrA := s.f.Truncate(int64(s.currentSegBytes))\n\t\tif errA != nil {\n\t\t\treturn errPartialWriteTruncate(errA)\n\t\t}\n\t} else {\n\t\ts.currentSegBytes = s.currentSegBytes + uint64(n)\n\t\ts.age = tNow() - s.baseOffset\n\t}\n\n\terrB := s.f.Sync()\n\tif errB != nil {\n\t\treturn errSegmentSync(errB)\n\t}\n\n\treturn nil\n}", "func (p *MediaPlaylist) AppendSegment(uri string, duration float64, title string, isVod bool) error {\n\tseg := new(MediaSegment)\n\tseg.URI = uri\n\tseg.Duration = duration\n\tseg.Title = title\n\n\teles := strings.Split(uri, \"/\")\n\toffset := 3\n\tif isVod != true {\n\t\toffset = 5\n\t}\n\tstartTime, err := strconv.ParseInt(eles[offset], 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\tendTime, err := strconv.ParseInt(eles[offset+1], 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif p.lastEndTime != -1 {\n\t\tif startTime-p.lastEndTime > 500 {\n\t\t\tseg.IsDiscontinuity = true\n\t\t}\n\t}\n\tp.lastEndTime = endTime\n\n\treturn p.Append(seg)\n}", "func WithSegment(name string, c echo.Context, f func() error) error {\n\ttx := GetTX(c)\n\tif tx == nil {\n\t\treturn f()\n\t}\n\tsegment := newrelic.StartSegment(tx, name)\n\tdefer segment.End()\n\treturn f()\n}", "func WithSegment(name string, c echo.Context, f func() error) error {\n\ttx := GetTX(c)\n\tif tx == nil {\n\t\treturn f()\n\t}\n\tsegment := newrelic.StartSegment(tx, name)\n\tdefer segment.End()\n\treturn f()\n}", "func WithSegment(name string, c echo.Context, f func() error) error {\n\ttx := GetTX(c)\n\tif tx == nil {\n\t\treturn f()\n\t}\n\tsegment := newrelic.StartSegment(tx, name)\n\tdefer segment.End()\n\treturn f()\n}", "func (s *segment) Append(b []byte) error {\n\tif s.gReader != nil {\n\t\treturn ErrImmutableSegment\n\t}\n\t_, err := s.appender.Write(b)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn s.appender.Sync()\n}", "func AddSegmentHook(hookPoint boil.HookPoint, segmentHook SegmentHook) {\n\tswitch hookPoint {\n\tcase boil.BeforeInsertHook:\n\t\tsegmentBeforeInsertHooks = append(segmentBeforeInsertHooks, segmentHook)\n\tcase boil.BeforeUpdateHook:\n\t\tsegmentBeforeUpdateHooks = append(segmentBeforeUpdateHooks, segmentHook)\n\tcase boil.BeforeDeleteHook:\n\t\tsegmentBeforeDeleteHooks = append(segmentBeforeDeleteHooks, segmentHook)\n\tcase boil.BeforeUpsertHook:\n\t\tsegmentBeforeUpsertHooks = append(segmentBeforeUpsertHooks, segmentHook)\n\tcase boil.AfterInsertHook:\n\t\tsegmentAfterInsertHooks = append(segmentAfterInsertHooks, segmentHook)\n\tcase boil.AfterSelectHook:\n\t\tsegmentAfterSelectHooks = append(segmentAfterSelectHooks, segmentHook)\n\tcase boil.AfterUpdateHook:\n\t\tsegmentAfterUpdateHooks = append(segmentAfterUpdateHooks, segmentHook)\n\tcase boil.AfterDeleteHook:\n\t\tsegmentAfterDeleteHooks = append(segmentAfterDeleteHooks, segmentHook)\n\tcase boil.AfterUpsertHook:\n\t\tsegmentAfterUpsertHooks = append(segmentAfterUpsertHooks, segmentHook)\n\t}\n}", "func (l *Log) newSegment(off uint64) error {\n\ts, err := newSegment(l.Dir, off, l.Config)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.segments = append(l.segments, s)\n\tl.activeSegment = s\n\treturn nil\n}", "func EncodeSegment(w io.Writer, seg Segment) error {\n\t// Everything else needs the 0xff, marker and potential payload\n\t_, err := w.Write([]byte{0xff, byte(seg.Marker)})\n\tif err != nil || seg.Data == nil {\n\t\treturn err\n\t}\n\t// Payload size includes it's own 2-bytes\n\terr = binary.Write(w, binary.BigEndian, uint16(len(seg.Data))+2)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = w.Write(seg.Data)\n\treturn err\n}", "func (t *Type1) writeSegment(w io.Writer, segment int) error {\n\tl := len(t.Segments[segment])\n\tvar asciiBinary byte\n\tif segment == 1 {\n\t\tasciiBinary = 2\n\t} else {\n\t\tasciiBinary = 1\n\t}\n\tprefix := []byte{128, asciiBinary, byte(l & 0xFF), byte(l >> 8 & 0xFF), byte(l >> 16 & 0xFF), byte(l >> 24 & 0xFF)}\n\t_, err := w.Write(prefix)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = w.Write(t.Segments[segment])\n\treturn err\n}", "func addSegment(curr *segment, key string) (seg *segment) {\n\tif curr.parameter.segment != nil {\n\t\tseg = curr.parameter.segment\n\n\t} else if child, ok := curr.children[key]; !ok { // child does not match...\n\t\tvar isParam bool\n\n\t\tseg, isParam = newSegment(key)\n\n\t\tif isParam {\n\t\t\tcurr.parameter.segment = seg\n\t\t\tcurr.parameter.name = key[2:]\n\n\t\t} else {\n\t\t\tcurr.children[key] = seg\n\t\t}\n\n\t\treturn\n\n\t} else { // child matches...\n\t\tseg = child\n\t}\n\n\treturn\n}", "func (p *SeriesPartition) createSegment() (*SeriesSegment, error) {\n\t// Close writer for active segment, if one exists.\n\tif segment := p.activeSegment(); segment != nil {\n\t\tif err := segment.CloseForWrite(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Generate a new sequential segment identifier.\n\tvar id uint16\n\tif len(p.segments) > 0 {\n\t\tid = p.segments[len(p.segments)-1].ID() + 1\n\t}\n\tfilename := fmt.Sprintf(\"%04x\", id)\n\n\t// Generate new empty segment.\n\tsegment, err := CreateSeriesSegment(id, filepath.Join(p.path, filename))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp.segments = append(p.segments, segment)\n\n\t// Allow segment to write.\n\tif err := segment.InitForWrite(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn segment, nil\n}", "func (s *SmartContract) SaveSegment(stub shim.ChaincodeStubInterface, args []string) sc.Response {\n\t// Parse segment\n\tbyteArgs := stub.GetArgs()\n\tsegment := &cs.Segment{}\n\tif err := json.Unmarshal(byteArgs[1], segment); err != nil {\n\t\treturn shim.Error(\"Could not parse segment\")\n\t}\n\n\t// Validate segment\n\tif err := segment.Validate(); err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\t// Set pending evidence\n\tsegment.SetEvidence(\n\t\tmap[string]interface{}{\n\t\t\t\"state\": cs.PendingEvidence,\n\t\t\t\"transactions\": map[string]string{\"transactionID\": stub.GetTxID()},\n\t\t})\n\n\t// Check has prevLinkHash if not create map else check prevLinkHash exists\n\tprevLinkHash := segment.Link.GetPrevLinkHashString()\n\tif prevLinkHash == \"\" {\n\t\t// Create map\n\t\tif err := s.SaveMap(stub, segment); err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\t} else {\n\t\t// Check previous segment exists\n\t\tresponse := s.GetSegment(stub, []string{prevLinkHash})\n\t\tif response.Status == shim.ERROR {\n\t\t\treturn shim.Error(\"Parent segment doesn't exist\")\n\t\t}\n\t}\n\n\t// Save segment\n\tsegmentDoc := SegmentDoc{\n\t\tObjectTypeSegment,\n\t\tsegment.GetLinkHashString(),\n\t\t*segment,\n\t}\n\tsegmentDocBytes, err := json.Marshal(segmentDoc)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\tif err := stub.PutState(segment.GetLinkHashString(), segmentDocBytes); err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\treturn shim.Success(nil)\n}", "func newSegment(segType uint8, flags uint16, streamID uint32, transID uint16, orderID uint16, message []byte) (*segment, error) {\n\tlength := len(message)\n\tif length > segmentBodyMaxSize {\n\t\treturn nil, errSegmentBodyTooLarge\n\t}\n\thdr := header(make([]byte, headerSize))\n\tif message == nil {\n\t\tmessage = []byte{} // FIXME!\n\t}\n\thdr.encode(segType, flags, streamID, transID, orderID, uint16(length))\n\treturn &segment{h: hdr, b: message}, nil\n}", "func (c ClientFake) CreateSegment(name, campaignID string) (Segment, error) {\n\treturn Segment{}, nil\n}", "func (h *HLSHandler) SegmentWritten(localFilePath string) {\n\th.Storage.SegmentWritten(localFilePath)\n}", "func (c *Computer) WriteSegment() *mach.Segment {\n\tif c.MemMode&MemWriteAux > 0 {\n\t\treturn c.Aux\n\t}\n\n\treturn c.Main\n}", "func (p *Projection) drawSegment(s *ik.Segment, col color.RGBA) {\n a := s.Start()\n b := s.End()\n p.line(a.X, a.Y, b.X, b.Y, col)\n\n if s.Child != nil {\n p.drawSegment(s.Child, col)\n }\n}", "func (h *InterfaceVppHandler) AddSpan(ifIdxFrom, ifIdxTo uint32, direction uint8, isL2 bool) error {\n\treturn h.setSpan(ifIdxFrom, ifIdxTo, direction, isL2)\n}", "func WriteSegment(stm *data.StateMap) *data.Segment {\n\treturn stm.Segment(memWriteSegment)\n}", "func (c ClientFake) UpdateSegment(name, campaignID, segmentID string) (Segment, error) {\n\treturn Segment{}, nil\n}", "func (b *vppbridge) AddInterface(vppinterface *vppinterface, portType l2.L2PortType) (err error) {\n\trequest := &l2.SwInterfaceSetL2Bridge{\n\t\tRxSwIfIndex: uint32(vppinterface.swifidx),\n\t\tBdID: b.ID,\n\t\tPortType: portType,\n\t\tEnable: 1,\n\t\tShg: 0,\n\t}\n\n\t// Dispatch request\n\tctx := b.Channel.SendRequest(request)\n\tresponse := &l2.SwInterfaceSetL2BridgeReply{}\n\tif err = ctx.ReceiveReply(response); err != nil {\n\t\terr = errors.Wrap(err, \"ctx.ReceiveReply()\")\n\t\treturn\n\t}\n\tif response.Retval != 0 {\n\t\terr = errors.Errorf(\"AddLoopBackReply: %d error\", response.Retval)\n\t\treturn\n\t}\n\n\t// Cache vppbridge segment\n\tb.segments = append(b.segments, vppinterface)\n\treturn\n}", "func CreateSegment(c *gin.Context) {\n\tsegmentValidator := SegmentValidator{}\n\tif err := segmentValidator.Bind(c); err != nil {\n\t\tc.JSON(http.StatusUnprocessableEntity, common.NewValidatorError(err))\n\t\treturn\n\t}\n\n\tsegment := segmentValidator.Segment\n\n\tif err := SaveOne(&segment); err != nil {\n\t\tc.JSON(http.StatusUnprocessableEntity, common.NewError(\"database\", err))\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusCreated, segment)\n\tgenerateThumbnailForSegment(segment)\n}", "func (*Token) EncodeSegment(seg []byte) string {\n\treturn base64.RawURLEncoding.EncodeToString(seg)\n}", "func EncodeSegment(seg []byte) string {\n\treturn strings.TrimRight(base64.URLEncoding.EncodeToString(seg), \"=\")\n}", "func (c *Client) Add(ctx context.Context, p *AddPayload) (res *StationFull, err error) {\n\tvar ires interface{}\n\tires, err = c.AddEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(*StationFull), nil\n}", "func SegmentSum(scope *Scope, data tf.Output, segment_ids tf.Output) (output tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"SegmentSum\",\n\t\tInput: []tf.Input{\n\t\t\tdata, segment_ids,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (c *ReplicaClient) WriteWALSegment(ctx context.Context, pos litestream.Pos, rd io.Reader) (info litestream.WALSegmentInfo, err error) {\n\tdefer func() { c.resetOnConnError(err) }()\n\n\tsftpClient, err := c.Init(ctx)\n\tif err != nil {\n\t\treturn info, err\n\t}\n\n\tfilename, err := litestream.WALSegmentPath(c.Path, pos.Generation, pos.Index, pos.Offset)\n\tif err != nil {\n\t\treturn info, fmt.Errorf(\"cannot determine wal segment path: %w\", err)\n\t}\n\tstartTime := time.Now()\n\n\tif err := sftpClient.MkdirAll(path.Dir(filename)); err != nil {\n\t\treturn info, fmt.Errorf(\"cannot make parent snapshot directory %q: %w\", path.Dir(filename), err)\n\t}\n\n\tf, err := sftpClient.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC)\n\tif err != nil {\n\t\treturn info, fmt.Errorf(\"cannot open snapshot file for writing: %w\", err)\n\t}\n\tdefer f.Close()\n\n\tn, err := io.Copy(f, rd)\n\tif err != nil {\n\t\treturn info, err\n\t} else if err := f.Close(); err != nil {\n\t\treturn info, err\n\t}\n\n\tinternal.OperationTotalCounterVec.WithLabelValues(ReplicaClientType, \"PUT\").Inc()\n\tinternal.OperationBytesCounterVec.WithLabelValues(ReplicaClientType, \"PUT\").Add(float64(n))\n\n\treturn litestream.WALSegmentInfo{\n\t\tGeneration: pos.Generation,\n\t\tIndex: pos.Index,\n\t\tOffset: pos.Offset,\n\t\tSize: n,\n\t\tCreatedAt: startTime.UTC(),\n\t}, nil\n}", "func (r *relation) Segment(si engine.SegmentInfo, proc *process.Process) engine.Segment {\n\tt0 := time.Now()\n\tdefer func() {\n\t\tlogutil.Debugf(\"time cost %d ms\", time.Since(t0))\n\t}()\n\treturn r.mp[si.TabletId].Segment(binary.BigEndian.Uint64([]byte(si.Id)), proc)\n}", "func (client WorkloadNetworksClient) CreateSegmentsResponder(resp *http.Response) (result WorkloadNetworkSegment, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func NewSegment(concurrency int, descriptors []Descriptor) *Segment {\n\treturn &Segment{\n\t\tconcurrency: concurrency,\n\t\tdescriptors: descriptors,\n\t\tdescriptorErrorBehavior: ErrorBehaviorTerminate,\n\t\tprocessErrorBehavior: ErrorBehaviorCollect,\n\t}\n}", "func newSegment(key string) (seg *segment, isParam bool) {\n\tseg = &segment{}\n\n\tseg.children = map[string]*segment{}\n\tseg.endpoints = map[string]*endpoint{}\n\n\tif isParameter(key) {\n\t\tisParam = true\n\t}\n\n\treturn\n}", "func (r *Router) AddRoute(method string, path string, callback http.HandlerFunc) (err error) {\n\tkeys := setupKeys(strings.Split(path, \"/\"))\n\tpathParams := []string{}\n\n\tif r.root == nil {\n\t\tr.root = &segment{}\n\t\tr.root.children = map[string]*segment{}\n\t\tr.root.endpoints = map[string]*endpoint{}\n\t}\n\n\tcurr := r.root\n\n\tfor i, key := range keys {\n\t\tif i == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tif isParameter(key) {\n\t\t\tpathParams = append(pathParams, key[2:])\n\n\t\t}\n\n\t\tif child, _ := getChild(key, curr); child == nil {\n\t\t\tseg := addSegment(curr, key)\n\t\t\tcurr = seg\n\t\t} else {\n\t\t\tcurr = child\n\t\t}\n\t}\n\n\tif _, ok := curr.endpoints[method]; ok {\n\t\terr = errors.New(\"path already exists\")\n\n\t\treturn\n\t}\n\n\tcurr.endpoints[method] = &endpoint{callback, path, pathParams}\n\tr.routes = append(r.routes, route{callback, method, path})\n\n\treturn\n}", "func NewSegment(p1, p2 Vector) Segment {\n\treturn Segment{p1, p2}\n}", "func (vl *VlanBridge) AddSvcSpec(svcName string, spec *ServiceSpec) error {\n return nil\n}", "func segment(icon, fg, bg string) SegmentDefinition {\n\treturn SegmentDefinition{\n\t\ticon: icon,\n\t\tfg: colors.MakeColor(fg),\n\t\tbg: colors.MakeColor(bg),\n\t}\n}", "func (r *rdsRoute) Add(ns, topic, address string, version uint64) error {\n\tkey := r.getRoutePrefix(ns, topic)\n\trds := r.rdc.Get(util.W, key)\n\tdefer rds.Close()\n\t_, err := rds.Do(\"HSET\", key, address, version)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func newSegment(segmentName string, intervalType interval.Type, path string) (Segment, error) {\n\tkvStore, err := kv.NewStore(segmentName, kv.StoreOption{Path: path})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create kv store for segment error:%s\", err)\n\t}\n\t// parse base time from segment name\n\tbaseTime, err := interval.GetCalculator(intervalType).ParseSegmentTime(segmentName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parse segment[%s] base time error\", path)\n\t}\n\n\treturn &segment{\n\t\tbaseTime: baseTime,\n\t\tkvStore: kvStore,\n\t\tintervalType: intervalType,\n\t\tlogger: logger.GetLogger(),\n\t}, nil\n}", "func (s *Segment) Write(p []byte) (int, error) {\n\t// If p is nil, or has a length of zero, return early.\n\tif len(p) == 0 {\n\t\treturn 0, nil\n\t}\n\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tif int64(len(p)) > s.remaining() {\n\t\treturn 0, ErrNotEnoughSpace\n\t}\n\treturn s.write(p)\n}", "func (r *Recovery) Add(loc Location) error {\n\tr.mtx.Lock()\n\tdefer r.mtx.Unlock()\n\n\tsh := r.shards[loc.Shard]\n\tl := len(sh.data)\n\tif diff := int(loc.Slot/8) - l; diff >= 0 {\n\t\tsh.extend(diff + 1)\n\t\tfor i := 0; i <= diff; i++ {\n\t\t\tsh.data[l+i] = 0x0\n\t\t}\n\t}\n\tsh.push(loc.Slot)\n\treturn nil\n}", "func AddServant(v dispatch, f interface{}, obj string) {\n\taddServantCommon(v, f, obj, false)\n}", "func SegmentSumV2(scope *Scope, data tf.Output, segment_ids tf.Output, num_segments tf.Output) (output tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"SegmentSumV2\",\n\t\tInput: []tf.Input{\n\t\t\tdata, segment_ids, num_segments,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (kcp *KCP) newSegment(size int) (seg segment) {\n\tseg.data = kcp.pool.Get()\n\treturn\n}", "func (o *WlRegion) Add(x wire.Int, y wire.Int, width wire.Int, height wire.Int) error {\n\tmsg, err := wire.NewMessage(o.ID(), 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = msg.Write(x); err != nil {\n\t\treturn err\n\t}\n\n\tif err = msg.Write(y); err != nil {\n\t\treturn err\n\t}\n\n\tif err = msg.Write(width); err != nil {\n\t\treturn err\n\t}\n\n\tif err = msg.Write(height); err != nil {\n\t\treturn err\n\t}\n\n\tif err = o.Base.Conn.Write(msg); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *SharedMemorySegment) Write(data []byte) {\n\tsrcLen := len(data)\n\tdstLen := len(s.data)\n\n\tif srcLen > dstLen {\n\t\tpanic(\"can't write more than source len\")\n\t}\n\n\ts.writeBuffer(data, s.data)\n}", "func (tag *CustomSegmentTag) SegmentTag() bool {\n\treturn true\n}", "func CreateSegment(db *sql.DB, schema string, count, segmentID, percent int) {\n\tvar add func(string, []int)\n\n\tadd = func(schema string, people []int) {\n\t\tif len(people) == 0 {\n\t\t\treturn\n\t\t}\n\n\t\ttx, err := db.Begin()\n\t\texitIf(\"start transaction\", err)\n\n\t\tquery := `\n\t\t UPDATE ` + schema + `.people\n\t\t\tSET memberships = memberships || myvalues.hash::hstore\n\t\t\tFROM (\n\t\t\t\tVALUES `\n\n\t\tend := `) AS myvalues (id, hash)\n\t\t WHERE ` + schema + `.people.id = myvalues.id::integer`\n\n\t\targs := make([]interface{}, 0, len(people)*2)\n\n\t\tfor i, id := range people {\n\t\t\tquery += fmt.Sprint(\"($\", i*2+1, \", $\", i*2+2, \")\")\n\t\t\tif i != len(people)-1 {\n\t\t\t\tquery += \", \"\n\t\t\t}\n\n\t\t\tstatus := \"left|\"\n\n\t\t\tif rand.Intn(100) <= percent {\n\t\t\t\tstatus = \"entered|\"\n\t\t\t}\n\n\t\t\tkey := status + strconv.Itoa(segmentID)\n\t\t\tvalue := sql.NullString{strconv.Itoa(int(time.Now().Unix())), true}\n\n\t\t\targs = append(args, id, hstore.Hstore{map[string]sql.NullString{key: value}})\n\t\t}\n\n\t\tquery += end\n\n\t\tr, err := db.Exec(query, args...)\n\t\texitIf(\"updating people\", err)\n\n\t\tif num, _ := r.RowsAffected(); num != int64(len(people)) {\n\t\t\tlog.Fatal(\"update didn't update?\", r)\n\t\t}\n\n\t\texitIf(\"commit transaction\", tx.Commit())\n\t}\n\n\tstart := time.Now()\n\tbatch := make([]int, 0, 100)\n\n\tfor i := 0; i < count; i++ {\n\t\tid := i + 1\n\n\t\tif i%10000 == 0 {\n\t\t\tlog.Println(\"adding to person\", id)\n\t\t}\n\n\t\tbatch = append(batch, id)\n\n\t\tif len(batch) >= 100 {\n\t\t\tadd(schema, batch)\n\t\t\tbatch = make([]int, 0, 100)\n\t\t}\n\t}\n\n\tadd(schema, batch)\n\n\tlog.Println(\"updated\", count, \"persons in\", time.Since(start))\n}", "func (x *Indexer) Add(doc *Doc) error {\n\tdid, err := x.doc2Id(doc)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdoc.Path = \"\"\n\tx.shatter <- &shatterReq{docid: did, offset: doc.Start, d: doc.Dat}\n\treturn nil\n}", "func (sdk *Sdk) UpdateSegment(segmentID string, body *Segment) (string, error) {\n\tsdkC := sdk.cms\n\tupdateSegment := fmt.Sprintf(\"/triggers/%s\", segmentID)\n\n\treturn sdkC.rq.PutJSON(updateSegment, body)\n}", "func (c *Connector) AddSvc(ia addr.IA, svc addr.HostSVC, ip net.IP) error {\n\tlog.Debug(\"Adding service\", \"isd_as\", ia, \"svc\", svc, \"ip\", ip)\n\tif !c.ia.Equal(ia) {\n\t\treturn serrors.WithCtx(errMultiIA, \"current\", c.ia, \"new\", ia)\n\t}\n\treturn c.DataPlane.AddSvc(svc, &net.UDPAddr{IP: ip, Port: topology.EndhostPort})\n}", "func (res *Resource) addRoute(method string, route string) {\n\tres.Routes = append(res.Routes, fmt.Sprintf(\"%s - /%s%s\", method, res.Type, route))\n}", "func (g *grid) addCoordinate(c *coordinate, magnitude, totalMagnitude int) {\n\tsegment := newSegment(g.curX, g.curY, c.x, c.y)\n\tsegment.magnitude = magnitude\n\tsegment.totalMagnitude = totalMagnitude\n\n\tg.coordinates = append(g.coordinates, c)\n\tg.segments = append(g.segments, segment)\n\tg.curX = c.x\n\tg.curY = c.y\n}", "func uploadStreamingSegment(client *gophercloud.ServiceClient, opts *uploadSegmentOpts) (*uploadSegmentResult, error) {\n\tvar result uploadSegmentResult\n\n\t// Checksum is always done when streaming.\n\thash := md5.New()\n\tbuf := bytes.NewBuffer([]byte{})\n\tn, err := io.CopyN(io.MultiWriter(hash, buf), opts.Content, opts.SegmentSize)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, err\n\t}\n\n\tlocalChecksum := fmt.Sprintf(\"%x\", hash.Sum(nil))\n\n\tif n == 0 {\n\t\tresult.Complete = true\n\t\tresult.Success = true\n\t\tresult.Size = 0\n\n\t\treturn &result, nil\n\t}\n\n\tcreateOpts := objects.CreateOpts{\n\t\tContent: bytes.NewReader(buf.Bytes()),\n\t\tContentLength: n,\n\t\tETag: localChecksum,\n\t\t// TODO\n\t\t//Metadata: opts.Metadata,\n\t}\n\n\tif opts.SegmentIndex == 0 && n < opts.SegmentSize {\n\t\tres := objects.Create(client, opts.ContainerName, opts.ObjectName, createOpts)\n\t\tif res.Err != nil {\n\t\t\treturn nil, res.Err\n\t\t}\n\n\t\tresult.Location = fmt.Sprintf(\"/%s/%s\", opts.ContainerName, opts.ObjectName)\n\t} else {\n\t\tres := objects.Create(client, opts.SegmentContainer, opts.SegmentName, createOpts)\n\t\tif res.Err != nil {\n\t\t\treturn nil, res.Err\n\t\t}\n\n\t\tresult.Location = fmt.Sprintf(\"/%s/%s\", opts.SegmentContainer, opts.SegmentName)\n\t}\n\n\tresult.Success = true\n\tresult.Complete = n < opts.SegmentSize\n\tresult.Size = n\n\tresult.Index = opts.SegmentIndex\n\tresult.ETag = localChecksum\n\n\treturn &result, nil\n}", "func (sq *SegmentQueue) Push(seg *Segment) {\n\tsq.mtx.Lock()\n\tdefer sq.mtx.Unlock()\n\n\tfor _, s := range sq.pq {\n\t\tif s == seg {\n\t\t\treturn\n\t\t}\n\t}\n\n\theap.Push(&sq.pq, seg)\n\tselect {\n\tcase sq.notifyCh <- seg:\n\tdefault:\n\t}\n}", "func (s *Scene) AddRoutine(r *Routine) error {\n\tif s.HasRoutine(r) {\n\t\treturn ErrRoutineExists\n\t}\n\ts.Routines = append(s.Routines, r)\n\treturn nil\n}", "func (s *Section) add(k, v []byte) {\n\ts.Keys = append(s.Keys, k)\n\ts.Values = append(s.Values, v)\n}", "func AddDrain(tag string, drain DrainFunc) {\n\tVac.addDrain(tag, drain)\n}", "func (s *Server) Add(ctx context.Context, message *goa_starterpb.AddRequest) (*goa_starterpb.AddResponse, error) {\n\tctx = context.WithValue(ctx, goa.MethodKey, \"add\")\n\tctx = context.WithValue(ctx, goa.ServiceKey, \"goa_starter\")\n\tresp, err := s.AddH.Handle(ctx, message)\n\tif err != nil {\n\t\treturn nil, goagrpc.EncodeError(err)\n\t}\n\treturn resp.(*goa_starterpb.AddResponse), nil\n}", "func (w *Watcher) Add(path string) {\n\t// Initial value to be different from any ETag\n\tw.paths[path] = \"Ooh, watch me, watch me!\"\n}", "func AttachToShmSegment(shmID int, size uint, permission int) (*SharedMemorySegment, error) {\n\t// OR (bitwise) flags\n\tvar flgs Flag\n\tflgs = flgs | IPC_CREAT | IPC_EXCL\n\n\tif permission != 0 {\n\t\tflgs |= Flag(permission)\n\t} else {\n\t\tflgs |= 0600 // default permission\n\t}\n\n\tshmAddr, _, errno := syscall.RawSyscall(syscall.SYS_SHMAT, uintptr(shmID), uintptr(0), uintptr(flgs))\n\tif errno != 0 {\n\t\treturn nil, errors.New(errno.Error())\n\t}\n\n\tsegment := &SharedMemorySegment{\n\t\tsize: size,\n\t\tflags: flgs,\n\t\taddress: uintptr(shmID),\n\t\tdata: make([]byte, 0),\n\t}\n\n\t// construct slice from memory segment\n\tsh := (*reflect.SliceHeader)(unsafe.Pointer(&segment.data))\n\tsh.Len = int(size)\n\tsh.Cap = int(size)\n\tsh.Data = shmAddr\n\n\tsegment.data = *(*[]byte)(unsafe.Pointer(sh))\n\n\treturn segment, nil\n}", "func (_obj *Apilangpack) AddServant(imp _impApilangpack, obj string) {\n\ttars.AddServant(_obj, imp, obj)\n}", "func (client WorkloadNetworksClient) CreateSegmentsSender(req *http.Request) (future WorkloadNetworksCreateSegmentsFuture, err error) {\n\tvar resp *http.Response\n\tresp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))\n\tif err != nil {\n\t\treturn\n\t}\n\tvar azf azure.Future\n\tazf, err = azure.NewFutureFromResponse(resp)\n\tfuture.FutureAPI = &azf\n\tfuture.Result = func(client WorkloadNetworksClient) (wns WorkloadNetworkSegment, err error) {\n\t\tvar done bool\n\t\tdone, err = future.DoneWithContext(context.Background(), client)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksCreateSegmentsFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\t\treturn\n\t\t}\n\t\tif !done {\n\t\t\terr = azure.NewAsyncOpIncompleteError(\"avs.WorkloadNetworksCreateSegmentsFuture\")\n\t\t\treturn\n\t\t}\n\t\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\t\twns.Response.Response, err = future.GetResult(sender)\n\t\tif wns.Response.Response == nil && err == nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksCreateSegmentsFuture\", \"Result\", nil, \"received nil response and error\")\n\t\t}\n\t\tif err == nil && wns.Response.Response.StatusCode != http.StatusNoContent {\n\t\t\twns, err = client.CreateSegmentsResponder(wns.Response.Response)\n\t\t\tif err != nil {\n\t\t\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksCreateSegmentsFuture\", \"Result\", wns.Response.Response, \"Failure responding to request\")\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\treturn\n}", "func (geom Geometry) Segmentize(distance float64) {\n\tC.OGR_G_Segmentize(geom.cval, C.double(distance))\n}", "func (rb *RingBuffer) Add(value stats.Record) {\n\trb.lock.Lock()\n\tdefer rb.lock.Unlock()\n\trb.data[rb.seq%uint64(len(rb.data))] = value\n\trb.seq++\n}", "func (_m *MockSegmentManager) Put(segmentType commonpb.SegmentState, segments ...Segment) {\n\t_va := make([]interface{}, len(segments))\n\tfor _i := range segments {\n\t\t_va[_i] = segments[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, segmentType)\n\t_ca = append(_ca, _va...)\n\t_m.Called(_ca...)\n}", "func (r *ring) Add(b []byte) {\n\n\tif len(b) > r.maxSize {\n\t\tb = b[len(b)-r.maxSize:]\n\t}\n\n\t// if head beyond tail, need to wrap over\n\tnewTail := (len(b) + r.tail)\n\n\tif newTail > len(r.buffer) {\n\t\tnewTail %= len(r.buffer)\n\n\t\toverflow := len(r.buffer) - r.tail\n\t\tcopy(r.buffer[r.tail:len(r.buffer)], b[:overflow])\n\t\tcopy(r.buffer[0:newTail], b[overflow:])\n\n\t\t// advance head to one byte past next r.sep in buffer\n\t\tindex := bytes.IndexByte(r.buffer[newTail+1:r.tail], r.sep)\n\t\tif index == -1 {\n\t\t\tr.head = r.tail\n\t\t} else {\n\t\t\trealIdx := newTail + 1 + index\n\t\t\tr.head = (realIdx + 1) % len(r.buffer)\n\t\t}\n\t} else {\n\t\tcopy(r.buffer[r.tail:newTail], b)\n\t}\n\tr.tail = newTail\n}", "func (s *Segment) Put(st, et time.Time, samples uint64, cb func(depth int, t time.Time, r *big.Rat, addons []Addon)) error {\n\ts.m.Lock()\n\tdefer s.m.Unlock()\n\n\tst, et = normalize(st, et)\n\tif st.After(et) {\n\t\treturn errStartTimeBeforeEndTime\n\t}\n\n\tif !s.growTree(st, et) {\n\t\treturn errTreeMaxSize\n\t}\n\tv := newVis()\n\ts.root.put(st, et, samples, func(sn *streeNode, depth int, tm time.Time, r *big.Rat, addons []Addon) {\n\t\tv.add(sn, r, true)\n\t\tcb(depth, tm, r, addons)\n\t})\n\tv.print(filepath.Join(os.TempDir(), fmt.Sprintf(\"0-put-%s-%s.html\", st.String(), et.String())))\n\treturn nil\n}", "func extractSegment(odpSegments *[]string, node *entities.TreeNode) {\n\tcondition, ok := node.Item.(entities.Condition)\n\tif !ok {\n\t\treturn\n\t}\n\t// Add segment to list only if match type is qualified and value is a non-empty string\n\tif condition.Match == matchers.QualifiedMatchType {\n\t\tif segment, ok := condition.Value.(string); ok && segment != \"\" {\n\t\t\t*odpSegments = append(*odpSegments, segment)\n\t\t}\n\t}\n}", "func (r *RdbReport) Sadd(key, member []byte) error {\n\tr.vl += uint64(len(member) + 38)\n\tr.ll++\n\tr.bidSizeMap[getBid(key)] += uint64(len(member))\n\treturn nil\n}", "func (s *Server) Add(ctx context.Context, message *steppb.AddRequest) (*steppb.AddResponse, error) {\n\tctx = context.WithValue(ctx, goa.MethodKey, \"add\")\n\tctx = context.WithValue(ctx, goa.ServiceKey, \"step\")\n\tresp, err := s.AddH.Handle(ctx, message)\n\tif err != nil {\n\t\treturn nil, goagrpc.EncodeError(err)\n\t}\n\treturn resp.(*steppb.AddResponse), nil\n}", "func (rndr *Renderer) AddService(service *renderer.ContivService) error {\n\tif rndr.snatOnly {\n\t\treturn nil\n\t}\n\n\tdnat := rndr.contivServiceToDNat(service)\n\ttxn := rndr.UpdateTxnFactory(fmt.Sprintf(\"add service '%v'\", service.ID))\n\ttxn.Put(vpp_nat.DNAT44Key(dnat.Label), dnat)\n\treturn nil\n}", "func (p *MediaPlaylist) Append(seg *MediaSegment) error {\n\tif p.head == p.tail && p.count > 0 {\n\t\treturn ErrPlaylistFull\n\t}\n\tp.Segments[p.tail] = seg\n\tp.tail = (p.tail + 1) % p.capacity\n\tp.count++\n\tif p.TargetDuration < seg.Duration {\n\t\tp.TargetDuration = math.Ceil(seg.Duration)\n\t}\n\tp.buf.Reset()\n\treturn nil\n}", "func SegmentExists(ctx context.Context, exec boil.ContextExecutor, iD int) (bool, error) {\n\tvar exists bool\n\tsql := \"select exists(select 1 from \\\"segment\\\" where \\\"id\\\"=$1 limit 1)\"\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, iD)\n\t}\n\trow := exec.QueryRowContext(ctx, sql, iD)\n\n\terr := row.Scan(&exists)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"boiler: unable to check if segment exists\")\n\t}\n\n\treturn exists, nil\n}", "func (s *slot) add(c interface{}) {\n\ts.mux.Lock()\n\tdefer s.mux.Unlock()\n\ts.elements[c] = c\n}", "func (context *context) NextSegment() (Segment, error) {\n\tif context.model.ctx == nil {\n\t\treturn Segment{}, ErrInternalAppError\n\t}\n\tif context.n >= context.model.ctx.Whisper_full_n_segments() {\n\t\treturn Segment{}, io.EOF\n\t}\n\n\t// Populate result\n\tresult := toSegment(context.model.ctx, context.n)\n\n\t// Increment the cursor\n\tcontext.n++\n\n\t// Return success\n\treturn result, nil\n}", "func (s *Split) Add(data Record) {\n\t// append record if it is below the InSplitLimit or the recordInSplitLimit is not set (-1)\n\tif len(s.Records) <= recordInSplitLimit || recordInSplitLimit == -1 {\n\t\ts.Records = append(s.Records, data)\n\t}\n\n\ts.RecordCount++\n}", "func (s *SAM) Add(str string) {\n\tx := s.start\n\tfor _, c := range str {\n\t\tif x.next[c] != nil && x.next[c].l == x.l+1 {\n\t\t\tx = x.next[c]\n\t\t} else {\n\t\t\tx = s.extend(x, c)\n\t\t}\n\t}\n\tfor ; x != s.start; x = x.fail {\n\t\tx.t = true\n\t}\n}", "func NewSegment(data SegmentData, opts Options) (Segment, error) {\n\tif err := data.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tmetadata := fswriter.Metadata{}\n\tif err := metadata.Unmarshal(data.Metadata); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif metadata.PostingsFormat != fswriter.PostingsFormat_PILOSAV1_POSTINGS_FORMAT {\n\t\treturn nil, fmt.Errorf(\"unsupported postings format: %v\", metadata.PostingsFormat.String())\n\t}\n\n\tfieldsFST, err := vellum.Load(data.FSTFieldsData.Bytes)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to load fields fst: %v\", err)\n\t}\n\n\tvar (\n\t\tdocsThirdPartyReader = data.DocsReader\n\t\tdocsDataReader *docs.DataReader\n\t\tdocsEncodedDataReader *docs.EncodedDataReader\n\t\tdocsIndexReader *docs.IndexReader\n\t)\n\tif docsThirdPartyReader == nil {\n\t\tdocsDataReader = docs.NewDataReader(data.DocsData.Bytes)\n\t\tdocsIndexReader, err = docs.NewIndexReader(data.DocsIdxData.Bytes)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to load documents index: %v\", err)\n\t\t}\n\t}\n\tdocsEncodedDataReader = docs.NewEncodedDataReader(data.DocsData.Bytes)\n\n\ts := &fsSegment{\n\t\tfieldsFST: fieldsFST,\n\t\tdocsDataReader: docsDataReader,\n\t\tdocsEncodedDataReader: docsEncodedDataReader,\n\t\tdocsIndexReader: docsIndexReader,\n\t\tdocsThirdPartyReader: docsThirdPartyReader,\n\n\t\tdata: data,\n\t\topts: opts,\n\t\tnumDocs: metadata.NumDocs,\n\t}\n\n\t// NB(r): The segment uses the context finalization to finalize\n\t// resources. Finalize is called after Close is called and all\n\t// the segment readers have also been closed.\n\ts.ctx = opts.ContextPool().Get()\n\ts.ctx.RegisterFinalizer(s)\n\n\treturn s, nil\n}", "func (a *_Atom) addRing(r *_Ring) {\n\ta.rings.Set(uint(r.id))\n}", "func (me *I16HEXFile) Add(r Record) error {\n\n\tif !r.validate(me.GetType()) {\n\t\treturn &InvalidRecordTypeError{\n\t\t\tInvaildFileType: me.GetType(),\n\t\t\tInvalidRecordType: r.Type,\n\t\t}\n\t}\n\n\tme.records = append(me.records, r)\n\treturn nil\n}", "func (a axes) drawSegment(p *vg.Painter, xy xyer, cs vg.CoordinateSystem, l Line, segment int) {\n\t// we modify l.X, and l.Y and restore it later.\n\tsaveX := l.X\n\tsaveY := l.Y\n\tsaveC := l.C\n\tdefer func() {\n\t\tl.X = saveX\n\t\tl.Y = saveY\n\t\tl.C = saveC\n\t}()\n\n\t// Get slice range for the given segment.\n\tx, _, _ := xy.XY(l)\n\tstart, stop := 0, len(x)\n\tn := 0\n\tfor i, f := range x {\n\t\tif math.IsNaN(f) {\n\t\t\tn++\n\t\t\tif n == segment {\n\t\t\t\tstart = i + 1\n\t\t\t} else if n == segment+1 {\n\t\t\t\tstop = i\n\t\t\t}\n\t\t}\n\t}\n\n\t// What we acutally need to cut depends on the xyer.\n\tif start < len(l.X) && stop <= len(l.X) {\n\t\tl.X = l.X[start:stop]\n\t}\n\tif start < len(l.Y) && stop <= len(l.Y) {\n\t\tl.Y = l.Y[start:stop]\n\t}\n\tif start < len(l.C) && stop <= len(l.C) {\n\t\tl.C = l.C[start:stop]\n\t}\n\n\ta.drawLine(p, xy, cs, l, false)\n}", "func (s *Server) addRoute(method string, pattern string, handler RouteHandler) {\n\ts.routes = append(s.routes, Route{handler : handler, pattern : pattern, method : method})\n}", "func (h *Handler) Add(cmd int32, hf HandlerFunc) {\n\th.router[cmd] = hf\n}", "func (d *distance) add(v int) {\n\td.mu.Lock()\n\tdefer d.mu.Unlock()\n\td.v += v\n}", "func (s *SegmentService) Update(memberID int, item Segment) (*Response, error) {\n\n\tdata := struct {\n\t\tSegment `json:\"segment\"`\n\t}{item}\n\n\tif item.ID < 1 {\n\t\treturn nil, errors.New(\"Update Segment requires a segment to have an ID already\")\n\t}\n\n\treq, err := s.client.newRequest(\"PUT\", fmt.Sprintf(\"segment/%d?id=%d\", memberID, item.ID), data)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := &Response{}\n\tresp, err := s.client.do(req, result)\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\n\treturn result, nil\n}", "func (g *graph) addEdge(source, destination flightpath.ScheduleDetail, duration int64) {\n\tg.Schedules[source.City] = append(g.Schedules[source.City], edge{Schedule: destination, Duration: duration, OriginFlightTimestamp: source.Timestamp, Reverse: false})\n\tg.Schedules[destination.City] = append(g.Schedules[destination.City], edge{Schedule: source, Duration: duration, OriginFlightTimestamp: destination.Timestamp, Reverse: true})\n}", "func (self *StraightLineTrack) Add(child Object) {\n\tself.childs = append(self.childs, child)\n}", "func (h *Handler) AddRoute(service config.Service) {\n\th.Routes = append(h.Routes, service)\n}", "func styledSegment(options RawOptions, input interface{}) (*styled.Segment, error) {\n\tvar text string\n\tvar style styled.Style\n\n\tswitch input := input.(type) {\n\tcase string:\n\t\ttext = input\n\tcase *styled.Segment:\n\t\ttext = input.Text\n\t\tstyle = input.Style\n\tdefault:\n\t\treturn nil, errStyledSegmentArgType\n\t}\n\n\tif err := style.ImportFromOptions(options); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &styled.Segment{\n\t\tText: text,\n\t\tStyle: style,\n\t}, nil\n}", "func (c *Client) Add() goa.Endpoint {\n\tvar (\n\t\tencodeRequest = EncodeAddRequest(c.encoder)\n\t\tdecodeResponse = DecodeAddResponse(c.decoder, c.RestoreResponseBody)\n\t)\n\treturn func(ctx context.Context, v interface{}) (interface{}, error) {\n\t\treq, err := c.BuildAddRequest(ctx, v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = encodeRequest(req, v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresp, err := c.AddDoer.Do(req)\n\t\tif err != nil {\n\t\t\treturn nil, goahttp.ErrRequestError(\"spin-broker\", \"add\", err)\n\t\t}\n\t\treturn decodeResponse(resp)\n\t}\n}", "func (n *NIC) AddAddress(protocol tcpip.NetworkProtocolNumber, addr tcpip.Address) error {\n\t// Add the endpoint.\n\tn.mu.Lock()\n\t_, err := n.addAddressLocked(protocol, addr, false)\n\tn.mu.Unlock()\n\n\treturn err\n}", "func NewSegmentWriter(data []*batch.Batch, meta *metadata.Segment, dir string) *SegmentWriter {\n\tw := &SegmentWriter{\n\t\tdata: data,\n\t\tmeta: meta,\n\t\tdir: dir,\n\t}\n\t// w.preprocessor = w.defaultPreprocessor\n\tw.fileGetter, w.fileCommiter = w.createFile, w.commitFile\n\tw.dataFlusher = flushBlocks\n\tw.indexFlusher = w.flushIndices\n\treturn w\n}", "func (t MatchTask) AddSentence(contextMarker string, text string) {\n\tvar words = strings.Fields(text)\n\tvar sentence = Sentence{0, words}\n\n\tt.sentenceByContextMarker[contextMarker] = sentence\n}", "func (d *Device) AddService(svc *ble.Service) error {\n\treturn d.Server.AddService(svc)\n}" ]
[ "0.6925719", "0.68303204", "0.6809465", "0.6660276", "0.6556915", "0.6511233", "0.6299954", "0.6058295", "0.5953473", "0.5953473", "0.5953473", "0.5941569", "0.5933238", "0.58960634", "0.57868844", "0.5649867", "0.55553", "0.5448272", "0.5372132", "0.5351253", "0.52755", "0.52620035", "0.51700115", "0.5159465", "0.51055413", "0.50456166", "0.50280225", "0.49895605", "0.4944828", "0.4935449", "0.49334785", "0.49296677", "0.49112156", "0.48970625", "0.4877696", "0.48775506", "0.48654494", "0.48536053", "0.4825567", "0.47783354", "0.4775148", "0.47646788", "0.4734367", "0.47266805", "0.47180167", "0.47126576", "0.47082502", "0.46915874", "0.46852136", "0.46746293", "0.4654648", "0.4648018", "0.46478352", "0.46431628", "0.4637566", "0.4630917", "0.4620816", "0.46074057", "0.4574441", "0.4565549", "0.45566884", "0.4552453", "0.45491704", "0.45429948", "0.45357746", "0.4535106", "0.45340848", "0.45301136", "0.4529616", "0.45291314", "0.45275956", "0.4527442", "0.45272106", "0.45195094", "0.4504887", "0.45012525", "0.45002934", "0.44962275", "0.44914743", "0.44880798", "0.44869998", "0.44859782", "0.44827884", "0.44779474", "0.44717598", "0.44687012", "0.44659805", "0.4462539", "0.44575715", "0.44538814", "0.445141", "0.4448354", "0.44454634", "0.4445435", "0.44438034", "0.44437584", "0.44357654", "0.44356924", "0.44305497", "0.4418254" ]
0.76127625
0
interceptPoints returns every point where the wire collides with wire o. The points' wireLen is the total wire length to get to that point (both wire combined).
interceptPoints возвращает каждый точку, где провод пересекается с проводом o. wireLen каждой точки — это общая длина провода до этой точки (суммарно для обоих проводов).
func (w *wire) interceptPoints(o wire) []point { var interceptPoints []point for i := 1; i < len(w.points); i++ { v1 := segment{ from: w.points[i-1], to: w.points[i], } for u := 1; u < len(o.points); u++ { v2 := segment{ from: o.points[u-1], to: o.points[u], } intercept := v1.intercepts(v2) if intercept.x != 0 && intercept.y != 0 { // Calculate total wire length (both wires combined) intercept.wireLen = v1.from.wireLen + intercept.distanceToPoint(v1.from) + v2.from.wireLen + intercept.distanceToPoint(v2.from) interceptPoints = append(interceptPoints, intercept) } } } return interceptPoints }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (l line2) SlopeIntercept() (float64, float64) {\n\tslope := (l.end.y - l.start.y) / (l.end.x - l.start.x)\n\tintercept := l.start.y - slope*l.start.x\n\treturn slope, intercept\n}", "func (l *Line) GetIntersectionPoints(other Shape) []IntersectionPoint {\n\n\tintersections := []IntersectionPoint{}\n\n\tswitch b := other.(type) {\n\n\tcase *Line:\n\n\t\tdet := (l.X2-l.X)*(b.Y2-b.Y) - (b.X2-b.X)*(l.Y2-l.Y)\n\n\t\tif det != 0 {\n\n\t\t\t// MAGIC MATH; the extra + 1 here makes it so that corner cases (literally aiming the line through the corners of the\n\t\t\t// hollow square in world5) works!\n\n\t\t\tlambda := (((l.Y - b.Y) * (b.X2 - b.X)) - ((l.X - b.X) * (b.Y2 - b.Y)) + 1) / det\n\n\t\t\tgamma := (((l.Y - b.Y) * (l.X2 - l.X)) - ((l.X - b.X) * (l.Y2 - l.Y)) + 1) / det\n\n\t\t\tif (0 < lambda && lambda < 1) && (0 < gamma && gamma < 1) {\n\t\t\t\tdx, dy := l.GetDelta()\n\t\t\t\tintersections = append(intersections, IntersectionPoint{l.X + lambda*dx, l.Y + lambda*dy, other})\n\t\t\t}\n\n\t\t}\n\tcase *Rectangle:\n\t\tside := NewLine(b.X, b.Y, b.X, b.Y+b.H)\n\t\tintersections = append(intersections, l.GetIntersectionPoints(side)...)\n\n\t\tside.Y = b.Y + b.H\n\t\tside.X2 = b.X + b.W\n\t\tside.Y2 = b.Y + b.H\n\t\tintersections = append(intersections, l.GetIntersectionPoints(side)...)\n\n\t\tside.X = b.X + b.W\n\t\tside.Y2 = b.Y\n\t\tintersections = append(intersections, l.GetIntersectionPoints(side)...)\n\n\t\tside.Y = b.Y\n\t\tside.X2 = b.X\n\t\tside.Y2 = b.Y\n\t\tintersections = append(intersections, l.GetIntersectionPoints(side)...)\n\tcase *Space:\n\t\tfor _, shape := range *b {\n\t\t\tintersections = append(intersections, l.GetIntersectionPoints(shape)...)\n\t\t}\n\tcase *Circle:\n\t\t// \tTO-DO: Add this later, because this is kinda hard and would necessitate some complex vector math that, for whatever\n\t\t// reason, is not even readily available in a Golang library as far as I can tell???\n\t\tbreak\n\t}\n\n\t// fmt.Println(\"WARNING! Object \", other, \" isn't a valid shape for collision testing against Line \", l, \"!\")\n\n\tsort.Slice(intersections, func(i, j int) bool {\n\t\treturn Distance(l.X, l.Y, intersections[i].X, intersections[i].Y) < Distance(l.X, l.Y, intersections[j].X, intersections[j].Y)\n\t})\n\n\treturn intersections\n\n}", "func getSlopeIntercept(p1 Point, p2 Point) (slope float64, intercept float64) {\n\tslope = (float64(p2.Y) - float64(p1.Y)) / (float64(p2.X) - float64(p1.X))\n\tintercept = float64(p1.Y) - slope*float64(p1.X)\n\n\treturn slope, intercept\n}", "func (v segment) intercepts(o segment) point {\n\t// With the assumption that no interceptions occur when segments are\n\t// parallel, and that segments always move either horizontally or\n\t// vertically (not both), we can pretty easily check for interceptions.\n\t//\n\t// First find the values where interception could occur, and what axis for\n\t// both segments are changing. I.e. if the segments are horizontal\n\t// or vertical.\n\ta, axAxis := v.unchangingAxis()\n\tb, bxAxis := o.unchangingAxis()\n\tif axAxis == bxAxis {\n\t\t// We're assuming that they can't overlap\n\t\t// when they are parallel\n\t\treturn point{}\n\t}\n\n\t// Check if the first value (x or y) is on the interval of the\n\t// same axis of the other segment. Do this for the other value (axis) too.\n\tvar aCanCollide bool\n\tif axAxis {\n\t\taCanCollide = inRange(a, o.from.x, o.to.x)\n\t} else {\n\t\taCanCollide = inRange(a, o.from.y, o.to.y)\n\t}\n\tvar bCanCollide bool\n\tif bxAxis {\n\t\tbCanCollide = inRange(b, v.from.x, v.to.x)\n\t} else {\n\t\tbCanCollide = inRange(b, v.from.y, v.to.y)\n\t}\n\n\t// If both axes are in range then they collide\n\tif aCanCollide && bCanCollide {\n\t\t// Check if a is an x- or y-value\n\t\tif axAxis {\n\t\t\treturn point{x: a, y: b}\n\t\t}\n\t\treturn point{x: b, y: a}\n\t}\n\treturn point{x: 0, y: 0}\n}", "func (r Rect) IntersectionPoints(l Line) []Vec {\n\t// Use map keys to ensure unique points\n\tpointMap := make(map[Vec]struct{})\n\n\tfor _, edge := range r.Edges() {\n\t\tif intersect, ok := l.Intersect(edge); ok {\n\t\t\tpointMap[intersect] = struct{}{}\n\t\t}\n\t}\n\n\tpoints := make([]Vec, 0, len(pointMap))\n\tfor point := range pointMap {\n\t\tpoints = append(points, point)\n\t}\n\n\t// Order the points\n\tif len(points) == 2 {\n\t\tif points[1].To(l.A).Len() < points[0].To(l.A).Len() {\n\t\t\treturn []Vec{points[1], points[0]}\n\t\t}\n\t}\n\n\treturn points\n}", "func (r Ruler) LineSliceAlong(start float64, stop float64, l Line) Line {\n\tvar sum float64\n\tvar slice []Point\n\n\tfor i := 0; i < len(l)-1; i++ {\n\t\tp0 := l[i]\n\t\tp1 := l[i+1]\n\t\td := r.Distance(p0, p1)\n\n\t\tsum += d\n\n\t\tif sum > start && len(slice) == 0 {\n\t\t\tslice = append(slice, interpolate(p0, p1, (start-(sum-d))/d))\n\t\t}\n\n\t\tif sum >= stop {\n\t\t\tslice = append(slice, interpolate(p0, p1, (stop-(sum-d))/d))\n\t\t\treturn slice\n\t\t}\n\n\t\tif sum > start {\n\t\t\tslice = append(slice, p1)\n\t\t}\n\t}\n\n\treturn slice\n}", "func (c Circle) IntersectionPoints(l Line) []Vec {\n\tcContainsA := c.Contains(l.A)\n\tcContainsB := c.Contains(l.B)\n\n\t// Special case for both endpoint being contained within the circle\n\tif cContainsA && cContainsB {\n\t\treturn []Vec{}\n\t}\n\n\t// Get closest point on the line to this circles' center\n\tclosestToCenter := l.Closest(c.Center)\n\n\t// If the distance to the closest point is greater than the radius, there are no points of intersection\n\tif closestToCenter.To(c.Center).Len() > c.Radius {\n\t\treturn []Vec{}\n\t}\n\n\t// If the distance to the closest point is equal to the radius, the line is tangent and the closest point is the\n\t// point at which it touches the circle.\n\tif closestToCenter.To(c.Center).Len() == c.Radius {\n\t\treturn []Vec{closestToCenter}\n\t}\n\n\t// Special case for endpoint being on the circles' center\n\tif c.Center == l.A || c.Center == l.B {\n\t\totherEnd := l.B\n\t\tif c.Center == l.B {\n\t\t\totherEnd = l.A\n\t\t}\n\t\tintersect := c.Center.Add(c.Center.To(otherEnd).Unit().Scaled(c.Radius))\n\t\treturn []Vec{intersect}\n\t}\n\n\t// This means the distance to the closest point is less than the radius, so there is at least one intersection,\n\t// possibly two.\n\n\t// If one of the end points exists within the circle, there is only one intersection\n\tif cContainsA || cContainsB {\n\t\tcontainedPoint := l.A\n\t\totherEnd := l.B\n\t\tif cContainsB {\n\t\t\tcontainedPoint = l.B\n\t\t\totherEnd = l.A\n\t\t}\n\n\t\t// Use trigonometry to get the length of the line between the contained point and the intersection point.\n\t\t// The following is used to describe the triangle formed:\n\t\t// - a is the side between contained point and circle center\n\t\t// - b is the side between the center and the intersection point (radius)\n\t\t// - c is the side between the contained point and the intersection point\n\t\t// The captials of these letters are used as the angles opposite the respective sides.\n\t\t// a and b are known\n\t\ta := containedPoint.To(c.Center).Len()\n\t\tb := c.Radius\n\t\t// B can be calculated by subtracting the angle of b (to the x-axis) from the angle of c (to the x-axis)\n\t\tB := containedPoint.To(c.Center).Angle() - containedPoint.To(otherEnd).Angle()\n\t\t// Using the Sin rule we can get A\n\t\tA := math.Asin((a * math.Sin(B)) / b)\n\t\t// Using the rule that there are 180 degrees (or Pi radians) in a triangle, we can now get C\n\t\tC := math.Pi - A + B\n\t\t// If C is zero, the line segment is in-line with the center-intersect line.\n\t\tvar c float64\n\t\tif C == 0 {\n\t\t\tc = b - a\n\t\t} else {\n\t\t\t// Using the Sine rule again, we can now get c\n\t\t\tc = (a * math.Sin(C)) / math.Sin(A)\n\t\t}\n\t\t// Travelling from the contained point to the other end by length of a will provide the intersection point.\n\t\treturn []Vec{\n\t\t\tcontainedPoint.Add(containedPoint.To(otherEnd).Unit().Scaled(c)),\n\t\t}\n\t}\n\n\t// Otherwise the endpoints exist outside of the circle, and the line segment intersects in two locations.\n\t// The vector formed by going from the closest point to the center of the circle will be perpendicular to the line;\n\t// this forms a right-angled triangle with the intersection points, with the radius as the hypotenuse.\n\t// Calculate the other triangles' sides' length.\n\ta := math.Sqrt(math.Pow(c.Radius, 2) - math.Pow(closestToCenter.To(c.Center).Len(), 2))\n\n\t// Travelling in both directions from the closest point by length of a will provide the two intersection points.\n\tfirst := closestToCenter.Add(closestToCenter.To(l.A).Unit().Scaled(a))\n\tsecond := closestToCenter.Add(closestToCenter.To(l.B).Unit().Scaled(a))\n\n\tif first.To(l.A).Len() < second.To(l.A).Len() {\n\t\treturn []Vec{first, second}\n\t}\n\treturn []Vec{second, first}\n}", "func (el *Fill) Polyline() {}", "func (o ElemU) Ipoints() (coords [][]float64) {\n\tcoords = la.MatAlloc(len(o.IpsElem), Global.Ndim)\n\tfor idx, ip := range o.IpsElem {\n\t\tcoords[idx] = o.Shp.IpRealCoords(o.X, ip)\n\t}\n\treturn\n}", "func pointslope(pp *privPath, i, j int) (ctr, dir Point) {\n\t// assume i<j\n\n\tn := len(pp.Pt)\n\tsums := pp.Sums\n\tr := 0 // rotations from i to j\n\n\tfor j >= n {\n\t\tj -= n\n\t\tr++\n\t}\n\tfor i >= n {\n\t\ti -= n\n\t\tr--\n\t}\n\tfor j < 0 {\n\t\tj += n\n\t\tr--\n\t}\n\tfor i < 0 {\n\t\ti += n\n\t\tr++\n\t}\n\n\tx := float64(sums[j+1].x - sums[i].x + r*sums[n].x)\n\ty := float64(sums[j+1].y - sums[i].y + r*sums[n].y)\n\tx2 := float64(sums[j+1].x2 - sums[i].x2 + r*sums[n].x2)\n\txy := float64(sums[j+1].xy - sums[i].xy + r*sums[n].xy)\n\ty2 := float64(sums[j+1].y2 - sums[i].y2 + r*sums[n].y2)\n\tk := float64(j + 1 - i + r*n)\n\n\tctr.X = x / k\n\tctr.Y = y / k\n\n\ta := (x2 - x*x/k) / k\n\tb := (xy - x*y/k) / k\n\tc := (y2 - y*y/k) / k\n\n\tlambda2 := (a + c + math.Sqrt((a-c)*(a-c)+4*b*b)) / 2 // larger e.value\n\n\t// now find e.vector for lambda2\n\ta -= lambda2\n\tc -= lambda2\n\n\tvar l float64\n\tif fabs(a) >= fabs(c) {\n\t\tl = math.Sqrt(a*a + b*b)\n\t\tif l != 0 {\n\t\t\tdir.X = -b / l\n\t\t\tdir.Y = a / l\n\t\t}\n\t} else {\n\t\tl = math.Sqrt(c*c + b*b)\n\t\tif l != 0 {\n\t\t\tdir.X = -c / l\n\t\t\tdir.Y = b / l\n\t\t}\n\t}\n\tif l == 0 {\n\t\tdir.X, dir.Y = 0, 0 // sometimes this can happen when k=4: the two eigenvalues coincide\n\t}\n\treturn\n}", "func (s *Server) GetPoints() []Message {\n\ts.cond.L.Lock()\n\tdefer s.cond.L.Unlock()\n\tcpy := make([]Message, len(s.points))\n\tcopy(cpy, s.points)\n\treturn cpy\n}", "func (a line2) IntersectPoint(b line2) (vector2, bool) {\n\tswaped := false\n\tif math.Abs(a.end.y-a.start.y) > math.Abs(a.end.x-a.start.x) {\n\t\tswaped = true\n\t\ta.start.x, a.start.y = a.start.y, a.start.x\n\t\ta.end.x, a.end.y = a.end.y, a.end.x\n\t\tb.start.x, b.start.y = b.start.y, b.start.x\n\t\tb.end.x, b.end.y = b.end.y, b.end.x\n\t}\n\tif a.start.x > a.end.x {\n\t\ta.start, a.end = a.end, a.start\n\t}\n\tif b.start.x > b.end.x {\n\t\tb.start, b.end = b.end, b.start\n\t}\n\t// we are interested in the 'common' parts.\n\tif a.start.x > b.end.x || b.start.x > a.end.x {\n\t\treturn vector2{}, false\n\t}\n\tsa, ia := a.SlopeIntercept()\n\t// shear b to y direction.\n\tb.start.y = b.start.y - (sa * b.start.x) - ia\n\tb.end.y = b.end.y - (sa * b.end.x) - ia\n\tif math.Signbit(b.start.y) == math.Signbit(b.end.y) {\n\t\treturn vector2{}, false\n\t}\n\t// find x if y == 0\n\ttb := math.Abs(b.start.y) / math.Abs(b.end.y-b.start.y)\n\tx := tb*(b.end.x-b.start.x) + b.start.x\n\tif x < a.start.x || a.end.x < x {\n\t\treturn vector2{}, false\n\t}\n\ty := sa*x + ia\n\tif swaped {\n\t\tx, y = y, x\n\t}\n\treturn vector2{x, y}, true\n}", "func pointsToLines(points []Point) (lines []Line) {\n\tfor i := 0; i < len(points); i++ {\n\t\tfor j := i + 1; j < len(points); j++ {\n\t\t\tif points[i].nextTo(points[j]) {\n\t\t\t\tlines = append(lines, Line{P1: points[i], P2: points[j]})\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func (win *window) Lines(pt []image.Point) {\n\tif len(pt) < 2 {\n\t\treturn\n\t}\n\tpts := make([]xgb.Point, len(pt))\n\tfor i, p := range pt {\n\t\tpts[i].X, pts[i].Y = int16(p.X), int16(p.Y)\n\t}\n\txwin.PolyLine(xgb.CoordModeOrigin, win.id, win.gc, pts)\n}", "func getLineParams(p1, p2 Point) (sT slopeType, slope, intercept float64) {\n\tif p1.X == p2.X {\n\t\t// Check for infinite slope.\n\t\tif p2.Y > p1.Y {\n\t\t\tsT = INFUP\n\t\t} else {\n\t\t\tsT = INFDOWN\n\t\t}\n\n\t\tslope, intercept = 0, 0\n\t} else if p1.Y == p2.Y {\n\t\t// check for zero slope\n\t\tif p2.X > p1.X {\n\t\t\tsT = ZERORIGHT\n\t\t} else {\n\t\t\tsT = ZEROLEFT\n\t\t}\n\n\t\tslope, intercept = 0, p1.Y\n\t} else {\n\t\t// 4 classifications of non infinite slope based\n\t\t// on the relative positions of p1 and p2\n\t\tslope, intercept = getSlopeIntercept(p1, p2)\n\t\tif p1.X < p2.X {\n\t\t\tif slope > 0 {\n\t\t\t\tsT = POSRIGHT\n\t\t\t} else {\n\t\t\t\tsT = NEGRIGHT\n\t\t\t}\n\t\t} else {\n\t\t\tif slope > 0 {\n\t\t\t\tsT = POSLEFT\n\t\t\t} else {\n\t\t\t\tsT = NEGLEFT\n\t\t\t}\n\t\t}\n\t}\n\n\treturn sT, slope, intercept\n}", "func GetPoints(l *Line, quantity int, stepRate float64, out []*point.Point) []*point.Point {\n\tif quantity <= 0 && stepRate > 0 {\n\t\tquantity = int(Length(l) / stepRate)\n\t}\n\n\tif out == nil {\n\t\tout = make([]*point.Point, 0)\n\t}\n\n\tfor idx := 0; idx < quantity; idx++ {\n\t\tposition := float64(idx) / float64(quantity)\n\n\t\tx := l.X1 + (l.X2-l.X1)*position\n\t\ty := l.Y1 + (l.Y2-l.Y1)*position\n\n\t\tout = append(out, point.New(x, y))\n\t}\n\n\treturn out\n}", "func (r Ray) LineIntersect(s Ray) (point Vec) {\n\t/*\n\t\tequation is derived from system of equations with\n\t\ttwo unknowns where equations are r.Formula and s.Formula\n\t\tfrom which we can derive x of intersection point\n\n\t\tstarting with:\n\t\t\tr.V.Y*X - r.V.X*Y - r.V.Y*r.O.X + r.V.X*r.O.Y = 0\n\t\tand:\n\t\t\ts.V.Y*X - s.V.X*Y - s.V.Y*s.O.X + s.V.X*s.O.Y = 0\n\n\t\tget y from first one:\n\t\t\tr.V.Y*X - r.V.Y*r.O.X + r.V.X*r.O.Y = r.V.X*Y\n\t\t\t(r.V.Y*X - r.V.Y*r.O.X + r.V.X*r.O.Y)/r.V.X = Y\n\n\t\tthen we substitute and get x:\n\t\t\ts.V.Y*X - s.V.X * (r.V.Y*X - r.V.Y*r.O.X + r.V.X*r.O.Y) / r.V.X - s.V.Y*s.O.X + s.V.X*s.O.Y = 0 // * r.V.X\n\t\t\ts.V.Y*X*r.V.X - s.V.X*r.V.Y*X + s.V.X*r.V.Y*r.O.X - s.V.X*r.V.X*r.O.Y - s.V.Y*s.O.X*r.V.X + s.V.X*s.O.Y*r.V.X = 0 // - s.V.Y*X*r.V.X + s.V.X*r.V.Y*X\n\t\t\ts.V.X*r.V.Y*r.O.X - s.V.X*r.V.X*r.O.Y - s.V.Y*s.O.X*r.V.X + s.V.X*s.O.Y*r.V.X = s.V.X*r.V.Y*X - s.V.Y*X*r.V.X // simplify\n\t\t\ts.V.X * (r.V.Y*r.O.X + r.V.X * (s.O.Y - r.O.Y)) - s.V.Y*s.O.X*r.V.X = X * (s.V.X*r.V.Y - s.V.Y*r.V.X) // / (s.V.X*r.V.Y - s.V.Y*r.V.X)\n\t\t\t(s.V.X * (r.V.Y*r.O.X + r.V.X * (s.O.Y - r.O.Y)) - s.V.Y*s.O.X*r.V.X) / (s.V.X*r.V.Y - s.V.Y*r.V.X) = X\n\t*/\n\n\tpoint.X = (s.V.X*(r.V.Y*r.O.X+r.V.X*(s.O.Y-r.O.Y)) - s.V.Y*s.O.X*r.V.X) / (s.V.X*r.V.Y - s.V.Y*r.V.X)\n\n\tif r.V.X == 0 {\n\t\tpoint.Y = s.ProjectX(point.X)\n\t} else {\n\t\tpoint.Y = r.ProjectX(point.X)\n\t}\n\n\treturn\n}", "func linePointsGen(p1, p2 Point, speed float64) (gen func() (x, y float64, e error)) {\n\t// Set up math\n\tslopeT, slope, _ := getLineParams(p1, p2)\n\n\tx := p1.X\n\txPrev := x\n\ty := p1.Y\n\tyPrev := y\n\te := fmt.Errorf(\"End of path reached\")\n\ttheta := math.Atan(slope)\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 ZERORIGHT:\n\t\treturn func() (float64, float64, error) {\n\t\t\tif x > p2.X {\n\t\t\t\treturn 0, 0, e\n\t\t\t}\n\n\t\t\txPrev = x\n\t\t\tx += speed\n\n\t\t\treturn xPrev, y, nil\n\t\t}\n\tcase ZEROLEFT:\n\t\treturn func() (float64, float64, error) {\n\t\t\tif x < p2.X {\n\t\t\t\treturn 0, 0, e\n\t\t\t}\n\n\t\t\txPrev = x\n\t\t\tx -= speed\n\n\t\t\treturn xPrev, y, nil\n\t\t}\n\tcase POSRIGHT:\n\t\treturn func() (float64, float64, error) {\n\t\t\tif y > p2.Y || x > p2.X {\n\t\t\t\treturn 0, 0, e\n\t\t\t}\n\n\t\t\tyPrev = y\n\t\t\txPrev = x\n\n\t\t\ty += speed * math.Sin(theta)\n\t\t\tx += speed * math.Cos(theta)\n\n\t\t\treturn xPrev, yPrev, nil\n\t\t}\n\tcase NEGRIGHT:\n\t\treturn func() (float64, float64, error) {\n\t\t\tif y < p2.Y || x > p2.X {\n\t\t\t\treturn 0, 0, e\n\t\t\t}\n\n\t\t\tyPrev = y\n\t\t\txPrev = x\n\n\t\t\ty += speed * math.Sin(theta)\n\t\t\tx += speed * math.Cos(theta)\n\n\t\t\treturn xPrev, yPrev, nil\n\t\t}\n\tcase POSLEFT:\n\t\treturn func() (float64, float64, error) {\n\t\t\tif y < p2.Y || x < p2.X {\n\t\t\t\treturn 0, 0, e\n\t\t\t}\n\n\t\t\tyPrev = y\n\t\t\txPrev = x\n\n\t\t\ty -= speed * math.Sin(theta)\n\t\t\tx -= speed * math.Cos(theta)\n\n\t\t\treturn xPrev, yPrev, nil\n\t\t}\n\tcase NEGLEFT:\n\t\treturn func() (float64, float64, error) {\n\t\t\tif y > p2.Y || x < p2.X {\n\t\t\t\treturn 0, 0, e\n\t\t\t}\n\n\t\t\tyPrev = y\n\t\t\txPrev = x\n\n\t\t\ty -= speed * math.Sin(theta)\n\t\t\tx -= speed * math.Cos(theta)\n\n\t\t\treturn xPrev, yPrev, nil\n\t\t}\n\tcase INFUP:\n\t\treturn func() (float64, float64, error) {\n\t\t\tif y > p2.Y {\n\t\t\t\treturn 0, 0, e\n\t\t\t}\n\n\t\t\tyPrev := y\n\t\t\ty += speed\n\n\t\t\treturn x, yPrev, nil\n\t\t}\n\tcase INFDOWN:\n\t\treturn func() (float64, float64, error) {\n\t\t\tif y < p2.Y {\n\t\t\t\treturn 0, 0, e\n\t\t\t}\n\n\t\t\tyPrev := y\n\t\t\ty -= speed\n\n\t\t\treturn x, yPrev, nil\n\t\t}\n\t}\n\n\treturn nil\n}", "func SlopeInd(m, xc, yc, xlen float64, lbl string, flip, xlog, ylog bool, args, argsLbl *A) {\n\tif args == nil {\n\t\targs = &A{C: \"k\"}\n\t}\n\targs.NoClip = true\n\tl := 0.5 * xlen\n\tx := []float64{xc - l, xc + l, xc + l, xc - l}\n\ty := []float64{yc - m*l, yc - m*l, yc + m*l, yc - m*l}\n\tif flip {\n\t\tx[1] = xc - l\n\t\ty[1] = yc + m*l\n\t}\n\tdx, dy := x[2]-x[0], y[2]-y[0]\n\td := 0.03 * math.Sqrt(dx*dx+dy*dy)\n\txm := xc - l - d\n\txp := xc + l + d\n\tym := yc + m*l - d\n\typ := yc + m*l + d\n\tyr := yc - m*l + d\n\tys := yc - m*l - d\n\tif xlog {\n\t\tfor i := 0; i < 4; i++ {\n\t\t\tx[i] = math.Pow(10.0, x[i])\n\t\t}\n\t\txc = math.Pow(10.0, xc)\n\t\txm = math.Pow(10.0, xm)\n\t\txp = math.Pow(10.0, xp)\n\t}\n\tif ylog {\n\t\tfor i := 0; i < 4; i++ {\n\t\t\ty[i] = math.Pow(10.0, y[i])\n\t\t}\n\t\tyc = math.Pow(10.0, yc)\n\t\tym = math.Pow(10.0, ym)\n\t\typ = math.Pow(10.0, yp)\n\t\tyr = math.Pow(10.0, yr)\n\t\tys = math.Pow(10.0, ys)\n\t}\n\tPlot(x, y, args)\n\tif lbl != \"\" {\n\t\tif argsLbl == nil {\n\t\t\targsLbl = &A{C: \"k\", Fsz: 6}\n\t\t}\n\t\targsLbl.NoClip = true\n\t\tif flip {\n\t\t\targsLbl.Ha = \"center\"\n\t\t\tif m < 0 {\n\t\t\t\targsLbl.Va = \"top\"\n\t\t\t\tText(xc, ym, \"1\", argsLbl)\n\t\t\t} else {\n\t\t\t\targsLbl.Va = \"bottom\"\n\t\t\t\tText(xc, yp, \"1\", argsLbl)\n\t\t\t}\n\t\t\targsLbl.Ha = \"right\"\n\t\t\targsLbl.Va = \"center\"\n\t\t\tText(xm, yc, lbl, argsLbl)\n\t\t} else {\n\t\t\targsLbl.Ha = \"center\"\n\t\t\tif m < 0 {\n\t\t\t\targsLbl.Va = \"bottom\"\n\t\t\t\tText(xc, yr, \"1\", argsLbl)\n\t\t\t} else {\n\t\t\t\targsLbl.Va = \"top\"\n\t\t\t\tText(xc, ys, \"1\", argsLbl)\n\t\t\t}\n\t\t\targsLbl.Ha = \"left\"\n\t\t\targsLbl.Va = \"center\"\n\t\t\tText(xp, yc, lbl, argsLbl)\n\t\t}\n\t}\n}", "func GetXIntersects(p *Point, a, l float64) []*Point {\n\tad := float64(1)\n\top := math.Tan(a)\n\thy := math.Sqrt(math.Pow(ad, 2) + math.Pow(op, 2))\n\tq := GetQuadrant(a)\n\tif q == 2 || q == 3 {\n\t\top = -op\n\t\tad = -ad\n\t}\n\ts := int(l / hy)\n\tf := GetFirstXIntersect(p, a)\n\tis := []*Point{f}\n\tfor i := 0; i < s; i++ {\n\t\tx := is[len(is)-1].X + ad\n\t\ty := is[len(is)-1].Y + op\n\t\tis = append(is, NewPoint(x, y))\n\t}\n\treturn is\n}", "func toomInterpolate(points [][]int32, param []int32) []int32 {\n\tt := make(thinPoly, 256)\n\tu := make(thinPoly, 256)\n\n\tfor i := range points {\n\t\tt.Inc(u.Mul(param[i], points[i]))\n\t}\n\n\treturn t.Freeze()\n}", "func (pppc *PseudoPolygonPointCollector) Edges(upper bool) ([]geom.Line, error) {\n\tvar pts []geom.Point\n\n\tif upper {\n\t\tpts = make([]geom.Point, len(pppc.upperPoints))\n\t\tcopy(pts, pppc.upperPoints)\n\t} else {\n\t\tpts = make([]geom.Point, len(pppc.lowerPoints))\n\t\tcopy(pts, pppc.lowerPoints)\n\t}\n\tif debug {\n\t\tlbl := \"lower\"\n\t\tif upper {\n\t\t\tlbl = \"upper\"\n\n\t\t}\n\t\tlog.Printf(\"Working on %v points: %v\", lbl, wkt.MustEncode(pts))\n\t}\n\n\tif !pppc.seen[pppc.End] {\n\t\tpts = append(pts, pppc.End)\n\t}\n\n\tif len(pts) == 2 {\n\t\t// just a shared line, no points to triangulate.\n\t\treturn []geom.Line{pppc.SharedLine()}, nil\n\t}\n\n\treturn pseudopolygon.Triangulate(pts, pppc.Order)\n}", "func PolyLine(img Arr, points [][]Point, closed bool, color Scalar, thickness, lineType, shift int) {\n\tif len(points) == 0 {\n\t\treturn\n\t}\n\n\tvar cc C.int\n\tif closed {\n\t\tcc = 1\n\t} else {\n\t\tcc = 0\n\t}\n\n\tcvpoints := make([][]C.CvPoint, 0, len(points))\n\tpts := make([]*C.CvPoint, 0, len(points))\n\tnpts := make([]C.int, 0, len(points))\n\n\tfor i := range points {\n\n\t\tif len(points[i]) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tcvpoints[i] = make([]C.CvPoint, len(points[i]))\n\n\t\tfor j := range points[i] {\n\t\t\tcvpoints[i][j] = C.CvPoint{C.int(points[i][j].X), C.int(points[i][j].Y)}\n\t\t}\n\n\t\tpts = append(pts, &cvpoints[i][0])\n\t\tnpts = append(npts, C.int(len(points[i])))\n\n\t}\n\n\tif len(pts) == 0 {\n\t\treturn\n\t}\n\n\tdo(func() {\n\t\tC.cvPolyLine(img.arr(), &pts[0], &npts[0], C.int(len(points)), cc, color.cvScalar(), C.int(thickness), C.int(lineType), C.int(shift))\n\t})\n}", "func iIntersection() {\n\n\tfirst := Tuple{0.00, 0, 0}\n\tiInput = append(iInput, first)\n\tcount := 0\n\tfor k := 0; k < len(ArrInput); k++ {\n\t\tfor jj := 0; jj < ArrInput[k].dist; jj++ {\n\t\t\trads := xyInput[k+1].rad\n\t\t\tgx := iInput[count].gx + (int(math.Sin(rads)) * 1)\n\t\t\tgy := iInput[count].gy + (int(math.Cos(rads)) * 1)\n\n\t\t\tnext := Tuple{rads, gx, gy}\n\t\t\tiInput = append(iInput, next)\n\t\t\tcount++\n\n\t\t}\n\n\t}\n\n\tlog.Println(strconv.Itoa(count))\n}", "func (this *DtNavMesh) GetOffMeshConnectionPolyEndPoints(prevRef, polyRef DtPolyRef, startPos, endPos []float32) DtStatus {\n\tvar salt, it, ip uint32\n\n\tif polyRef == 0 {\n\t\treturn DT_FAILURE\n\t}\n\t// Get current polygon\n\tthis.DecodePolyId(polyRef, &salt, &it, &ip)\n\tif it >= (uint32)(this.m_maxTiles) {\n\t\treturn DT_FAILURE | DT_INVALID_PARAM\n\t}\n\tif this.m_tiles[it].Salt != salt || this.m_tiles[it].Header == nil {\n\t\treturn DT_FAILURE | DT_INVALID_PARAM\n\t}\n\ttile := &this.m_tiles[it]\n\tif ip >= (uint32)(tile.Header.PolyCount) {\n\t\treturn DT_FAILURE | DT_INVALID_PARAM\n\t}\n\tpoly := &tile.Polys[ip]\n\n\t// Make sure that the current poly is indeed off-mesh link.\n\tif poly.GetType() != DT_POLYTYPE_OFFMESH_CONNECTION {\n\t\treturn DT_FAILURE\n\t}\n\t// Figure out which way to hand out the vertices.\n\tidx0 := 0\n\tidx1 := 1\n\n\t// Find link that points to first vertex.\n\tfor i := poly.FirstLink; i != DT_NULL_LINK; i = tile.Links[i].Next {\n\t\tif tile.Links[i].Edge == 0 {\n\t\t\tif tile.Links[i].Ref != prevRef {\n\t\t\t\tidx0 = 1\n\t\t\t\tidx1 = 0\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\n\tDtVcopy(startPos, tile.Verts[poly.Verts[idx0]*3:])\n\tDtVcopy(endPos, tile.Verts[poly.Verts[idx1]*3:])\n\n\treturn DT_SUCCESS\n}", "func Test_309(t *testing.T) {\n\ttestName := \"Test_309 ExtendPolyLine\"\n\trunStart := time.Now()\n\tfmt.Printf(\"%s\\n\", testName)\n\tdefer func() {\n\t\tVerbose.Printf(\"%s took %v\\n\", testName, time.Since(runStart))\n\t}()\n\tvar (\n\t\tgpstest1 GPS2dList = GPS2dList{\n\t\t\t{Lat: 10, Lon: 10},\n\t\t\t{Lat: 15, Lon: 15},\n\t\t}\n\t\tgpstest2 GPS2dList = GPS2dList{\n\t\t\t//\t\t\t{Lat:10,Lon:10,Up:10},\n\t\t\t//\t\t\t{Lat:15,Lon:15,Up:10},\n\t\t\t{Lat: 36.810202, Lon: -77.025878},\n\t\t\t{Lat: 36.803840, Lon: -76.862869},\n\t\t\t{Lat: 36.814619, Lon: -76.902701},\n\t\t}\n\t\tpl PolyLine\n\t\tp2 PolyLine\n\t\tp3 PolyLine\n\t)\n\tVerbose.Printf(\"Centroid of empty list = %v\\n\", pl.Centroid())\n\tpl = append(pl, []Pointe{Pointe{X: 1.0, Y: 1.0}})\n\tVerbose.Printf(\"Centroid of single point [1,1] = %v\\n\", pl.Centroid())\n\tpl[0] = append(pl[0], Pointe{X: 100.0, Y: 100.0})\n\tVerbose.Printf(\"Centroid of line point [1,1],[100,100] = %v\\n\", pl.Centroid())\n\tVerbose.Printf(\"Expect [50.5,50.5]\\n\\n\")\n\tVerbose.Printf(\"%v\\n\", gpstest1)\n\tVerbose.Printf(\"Centroid of gpslist is %v\\n\", pl.Centroid())\n\tgpsPoly1 := gpstest1.PolyLine()\n\tgpsPoly2 := gpstest2.PolyLine()\n\n\tp2.ExtendByPolyLine(gpsPoly1)\n\tVerbose.Printf(\"len p2 now = %d\\n\", len(p2))\n\tVerbose.Printf(\"Centroid of p2 is %v\\n\", p2.Centroid())\n\n\tp3.ExtendByPolyLine(gpsPoly2)\n}", "func (c *Circle) Points() []*Point {\n\tx, y, dx, dy := c.R-1, 0, 1, 1\n\te := dx - (c.R * 2)\n\n\tpoints := make([]*Point, 0)\n\n\tfor x > y {\n\t\tpoints = append(points, &Point{\n\t\t\tX: c.Center.X + x,\n\t\t\tY: c.Center.Y + y,\n\t\t})\n\t\tpoints = append(points, &Point{\n\t\t\tX: c.Center.X + y,\n\t\t\tY: c.Center.Y + x,\n\t\t})\n\t\tpoints = append(points, &Point{\n\t\t\tX: c.Center.X - y,\n\t\t\tY: c.Center.Y + x,\n\t\t})\n\t\tpoints = append(points, &Point{\n\t\t\tX: c.Center.X - x,\n\t\t\tY: c.Center.Y + y,\n\t\t})\n\t\tpoints = append(points, &Point{\n\t\t\tX: c.Center.X - x,\n\t\t\tY: c.Center.Y - y,\n\t\t})\n\t\tpoints = append(points, &Point{\n\t\t\tX: c.Center.X - y,\n\t\t\tY: c.Center.Y - x,\n\t\t})\n\t\tpoints = append(points, &Point{\n\t\t\tX: c.Center.X + y,\n\t\t\tY: c.Center.Y - x,\n\t\t})\n\t\tpoints = append(points, &Point{\n\t\t\tX: c.Center.X + x,\n\t\t\tY: c.Center.Y - y,\n\t\t})\n\n\t\tif e <= 0 {\n\t\t\ty++\n\t\t\te += dy\n\t\t\tdy += 2\n\t\t}\n\n\t\tif e > 0 {\n\t\t\tx--\n\t\t\tdx += 2\n\t\t\te += dx - (c.R * 2)\n\t\t}\n\t}\n\n\treturn points\n}", "func (p thinPoly) Inc(x []int32) thinPoly {\n\tfor i := range x {\n\t\tp[i] += x[i]\n\t}\n\treturn p\n}", "func Within(points []*Point, polygons []PolygonI) []*Point {\n\tresult := []*Point{}\n\tfor _, polygon := range polygons {\n\t\tfor _, point := range points {\n\t\t\tif Inside(point, polygon) {\n\t\t\t\tresult = append(result, point)\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func NewBoundFromPoints(corner, oppositeCorner *Point) *Bound {\n\tb := &Bound{\n\t\tsw: corner.Clone(),\n\t\tne: corner.Clone(),\n\t}\n\n\tb.Extend(oppositeCorner)\n\treturn b\n}", "func (s *Serverus) ChainInterceptors(inter interface{}) {}", "func (g *Gene) IntervalOfExons() []Coor {\n\tmerged := g.MergeExons()\n\treturn IntervalRegions(merged)\n}", "func (c *curve) PointLen() int {\n\treturn (c.P.BitLen() + 7 + 1) / 8\n}", "func Line(x0, y0, x1, y1 int) []image.Point {\n\tdx := int(math.Abs(float64(x1 - x0)))\n\tdy := int(math.Abs(float64(y1 - y0)))\n\tsx := 0\n\tsy := 0\n\tif x0 < x1 {\n\t\tsx = 1\n\t} else {\n\t\tsx = -1\n\t}\n\n\tif y0 < y1 {\n\t\tsy = 1\n\t} else {\n\t\tsy = -1\n\t}\n\n\terr := dx - dy\n\n\tps := make([]image.Point, 0)\n\tfor {\n\t\tps = append(ps, image.Pt(x0, y0))\n\t\tif x0 == x1 && y0 == y1 {\n\t\t\tbreak\n\t\t}\n\t\te2 := err * 2\n\t\tif e2 > -dy {\n\t\t\terr -= dy\n\t\t\tx0 += sx\n\t\t}\n\t\tif e2 < dx {\n\t\t\terr += dx\n\t\t\ty0 += sy\n\t\t}\n\t}\n\treturn ps\n}", "func (r Ruler) LineSlice(start Point, end Point, l Line) Line {\n\tp1 := r.PointOnLine(l, start)\n\tp2 := r.PointOnLine(l, end)\n\n\tif p1.index > p2.index || (p1.index == p2.index && p1.t < p2.t) {\n\t\tp1, p2 = p2, p1\n\t}\n\n\tvar slice Line = []Point{p1.point}\n\n\tleft := p1.index + 1\n\tright := p2.index\n\n\tif l[left] != slice[0] && left <= right {\n\t\tslice = append(slice, l[left])\n\t}\n\n\tfor i := left + 1; i <= right; i++ {\n\t\tslice = append(slice, l[i])\n\t}\n\n\tif l[right] != p2.point {\n\t\tslice = append(slice, p2.point)\n\t}\n\n\treturn slice\n}", "func (r Rectangle) Clip(pts []Point) []Point {\n\tclipped := make([]Point, 0, len(pts))\n\tfor _, pt := range pts {\n\t\tif pt.In(r) {\n\t\t\tclipped = append(clipped, pt)\n\t\t}\n\t}\n\treturn clipped\n}", "func (t *Transcript) WhichExonIntersect(reg Coor) []int {\n\tresult := []int{}\n\tfor i, exon := range t.Exons {\n\t\tif exon.Intersect(reg) {\n\t\t\tresult = append(result, i)\n\t\t}\n\t}\n\treturn result\n}", "func lagrangeInterpolate(points map[int]*big.Int, x int, curve elliptic.Curve) *big.Int {\n\tlog.Printf(\"The points is: %v\", points)\n\n\t// 通过这些坐标点来恢复出多项式\n\tpolynomialClient := polynomial.New(curve.Params().N)\n\tresult := polynomialClient.GetPolynomialByPoints(points)\n\n\t// 秘密就是常数项\n\tsecret := result[len(result)-1]\n\n\tlog.Printf(\"The coefficients of the polynomial is: %v\", result)\n\treturn secret\n}", "func (b *BasicShape) Refine() []Shape {\n\tpanic(\"Refine should only be called on shapes which cannot be intersected: Basic\")\n}", "func linInt(x, y []float64, xVal float64) float64 {\n\t// x vector must be nondecreasing\n\n\tif xVal < x[0] || xVal > x[len(x)-1] {\n\t\treturn nan\n\t}\n\n\t// find out which segment we are in\n\tn := 0\n\tfor i, _ := range x {\n\t\tif xVal > x[i] {\n\t\t\tn = i\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\tif n > len(y) {\n\t\treturn nan\n\t}\n\n\t// interpolate\n\tx0, y0 := x[n], y[n]\n\tx1, y1 := x[n+1], y[n+1]\n\ta := x1 - x0\n\tb := y1 - y0\n\tyVal := b*(xVal-x0)/a + y0\n\treturn yVal\n}", "func (ecpgb *EntityContactPointGroupBy) IntsX(ctx context.Context) []int {\n\tv, err := ecpgb.Ints(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func GetYIntersects(p *Point, a, l float64) []*Point {\n\top := float64(1)\n\tad := op / math.Tan(a)\n\thy := math.Sqrt(math.Pow(ad, 2) + math.Pow(op, 2))\n\tq := GetQuadrant(a)\n\tif q == 3 || q == 4 {\n\t\top = -op\n\t\tad = -ad\n\t}\n\ts := int(l / hy)\n\tf := GetFirstYIntersect(p, a)\n\tis := []*Point{f}\n\tfor i := 0; i < s; i++ {\n\t\tx := is[len(is)-1].X + ad\n\t\ty := is[len(is)-1].Y + op\n\t\tis = append(is, NewPoint(x, y))\n\t}\n\treturn is\n}", "func (c Contour) ContainsWnPoly(p Point) bool {\n\tcn := 0\n\tfor i := range c { // edge from c[i] to nextC\n\t\tC := c[i]\n\t\tvar nextC Point\n\t\tif i+1 == len(c) {\n\t\t\tnextC = c[0]\n\t\t} else {\n\t\t\tnextC = c[i+1]\n\t\t}\n\t\tif ((C.Y <= p.Y) && (nextC.Y > p.Y)) || ((C.Y > p.Y) && (nextC.Y <= p.Y)) { // a downward crossing\n\t\t\t// compute the actual edge-ray intersect x-coordinate\n\t\t\tvt := float64(p.Y-C.Y) / (nextC.Y - C.Y)\n\t\t\tif p.X < C.X+vt*(nextC.X-C.X) { // p.Coordinates.X < intersect\n\t\t\t\tcn++ // a valid crossing of y=p.Coordinates[1] right of p.Coordinates[0]\n\t\t\t}\n\t\t}\n\t}\n\treturn (cn&1 == 1) // 0 if even (out), and 1 if odd (in)\n}", "func OfPoints(pts ...[2]float64) Winding { return Order{}.OfPoints(pts...) }", "func (gd *Definition) ConatainsPoint(x, y, buf float64) bool {\n\tif x < gd.Eorig-buf {\n\t\treturn false\n\t}\n\tif x > gd.Eorig+float64(gd.Ncol)*gd.Cwidth+buf {\n\t\treturn false\n\t}\n\tif y > gd.Norig+buf {\n\t\treturn false\n\t}\n\tif y < gd.Norig-float64(gd.Nrow)*gd.Cwidth-buf {\n\t\treturn false\n\t}\n\treturn true\n}", "func OverlayXY(value Vec2) *SimpleElement { return newSEVec2(\"overlayXY\", value) }", "func (rg Range) Lines(y0, y1 int) Range {\n\tnrg := rg\n\tnrg.Min.Y = rg.Min.Y + y0\n\tnrg.Max.Y = rg.Min.Y + y1\n\treturn rg.Intersect(nrg)\n}", "func (lgb *LocationGroupBy) IntsX(ctx context.Context) []int {\n\tv, err := lgb.Ints(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (ligb *LineItemGroupBy) IntsX(ctx context.Context) []int {\n\tv, err := ligb.Ints(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (xy xyer) XY(i int) (float64, float64) {\n\treturn xy.X[i], xy.Y[i]\n}", "func OfGeomPoints(points ...geom.Point) Winding { return Order{}.OfGeomPoints(points...) }", "func VPCMPESTRI(i, mx, x operand.Op) { ctx.VPCMPESTRI(i, mx, x) }", "func readCoverPoints(file *elf.File, tracePC uint64, traceCmp map[uint64]bool) ([2][]uint64, error) {\n\tvar pcs [2][]uint64\n\ttext := file.Section(\".text\")\n\tif text == nil {\n\t\treturn pcs, fmt.Errorf(\"no .text section in the object file\")\n\t}\n\tdata, err := text.Data()\n\tif err != nil {\n\t\treturn pcs, fmt.Errorf(\"failed to read .text: %v\", err)\n\t}\n\tconst callLen = 5\n\tend := len(data) - callLen + 1\n\tfor i := 0; i < end; i++ {\n\t\tpos := bytes.IndexByte(data[i:end], 0xe8)\n\t\tif pos == -1 {\n\t\t\tbreak\n\t\t}\n\t\tpos += i\n\t\ti = pos\n\t\toff := uint64(int64(int32(binary.LittleEndian.Uint32(data[pos+1:]))))\n\t\tpc := text.Addr + uint64(pos)\n\t\ttarget := pc + off + callLen\n\t\tif target == tracePC {\n\t\t\tpcs[0] = append(pcs[0], pc)\n\t\t} else if traceCmp[target] {\n\t\t\tpcs[1] = append(pcs[1], pc)\n\t\t}\n\t}\n\treturn pcs, nil\n}", "func (ecps *EntityContactPointSelect) IntsX(ctx context.Context) []int {\n\tv, err := ecps.Ints(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (r *MinMaxRange) SplitPoints(n int) []float64 {\n\tdelta := r.Max - r.Min\n\tif delta <= 0 {\n\t\treturn nil\n\t}\n\n\tmin := r.Min\n\tstp := delta / float64(n+1)\n\tres := make([]float64, n)\n\tfor i := 0; i < n; i++ {\n\t\tres[i] = min + stp*float64(i+1)\n\t}\n\treturn res\n}", "func (c Cluster) GetPoints() []int {\n\treturn append([]int(nil), c.indices...)\n}", "func linear(x, x1, x2, y1, y2 float64) float64 {\n slope := (y2 - y1) / (x2 - x1)\n intercept := y1 - x1 * slope\n return x * slope + intercept\n}", "func getLineRanges(src image.Image,\n\tthreshold uint32,\n\temptyLineThreshold float64) []lineRange {\n\tbounds := src.Bounds()\n\tsrcWidth, srcHeight := bounds.Dx(), bounds.Dy()\n\tthreshold16 := threshold * 256\n\n\tvar ranges []lineRange\n\tvar r lineRange\n\n\tmaxDotCount := int(emptyLineThreshold)\n\tif emptyLineThreshold < 1 {\n\t\tmaxDotCount = int(float64(srcWidth) * emptyLineThreshold)\n\t}\n\tfor y := 0; y < srcHeight; y++ {\n\t\temptyLine := true\n\t\tdotCount := 0\n\t\tfor x := 0; x < srcWidth; x++ {\n\t\t\tr, g, b, _ := src.At(x, y).RGBA()\n\t\t\tbrightness := getBrightness(r, g, b)\n\t\t\tif brightness < threshold16 {\n\t\t\t\tdotCount++\n\t\t\t\tif dotCount >= maxDotCount {\n\t\t\t\t\temptyLine = false\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif emptyLine {\n\t\t\tif y == 0 {\n\t\t\t\tr = lineRange{start: y, end: y, emptyLine: true}\n\t\t\t} else {\n\t\t\t\tif r.emptyLine {\n\t\t\t\t\tr.end = y\n\t\t\t\t} else {\n\t\t\t\t\tranges = append(ranges, r)\n\t\t\t\t\tr = lineRange{start: y, end: y, emptyLine: true}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif y == 0 {\n\t\t\t\tr = lineRange{start: y, end: y, emptyLine: false}\n\t\t\t} else {\n\t\t\t\tif r.emptyLine {\n\t\t\t\t\tranges = append(ranges, r)\n\t\t\t\t\tr = lineRange{start: y, end: y, emptyLine: false}\n\t\t\t\t} else {\n\t\t\t\t\tr.end = y\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\tranges = append(ranges, r)\n\treturn ranges\n}", "func FuncLineString(start, end float64, points int, fn ParamFunc) geom.LineString {\n\tif points < 2 {\n\t\tpanic(\"cannot have a line with less than 2 points\")\n\t}\n\n\tres := (end - start) / (float64(points) - 1)\n\tret := make([][2]float64, points)\n\tt := start\n\n\tfor i := 0; i < points - 1; i++ {\n\t\tret[i] = fn(t)\n\t\tt += res\n\t}\n\n\tret[points - 1] = fn(end)\n\n\treturn ret\n}", "func PolyMin(k float64) MinFunc {\n\treturn func(a, b float64) float64 {\n\t\treturn poly(a, b, k)\n\t}\n}", "func (r *Automaton) GetStartPoints() []int {\n\tpointset := make(map[int]struct{})\n\tpointset[0] = struct{}{}\n\n\tfor s := 0; s < r.nextState; s += 2 {\n\t\ttrans := r.states[s]\n\t\tlimit := trans + 3*r.states[s+1]\n\t\t//System.out.println(\" state=\" + (s/2) + \" trans=\" + trans + \" limit=\" + limit);\n\t\tfor trans < limit {\n\t\t\tmin := r.transitions[trans+1]\n\t\t\tmax := r.transitions[trans+2]\n\t\t\t//System.out.println(\" min=\" + min);\n\t\t\tpointset[min] = struct{}{}\n\t\t\tif max < 0x10FFFF {\n\t\t\t\tpointset[max+1] = struct{}{}\n\t\t\t}\n\t\t\ttrans += 3\n\t\t}\n\t}\n\n\tpoints := make([]int, 0, len(pointset))\n\tfor k, _ := range pointset {\n\t\tpoints = append(points, k)\n\t}\n\tsort.Ints(points)\n\treturn points\n}", "func (ema *Ema) GetPoints() []point {\n\treturn ema.points\n}", "func getPoint(x, y []byte) plotter.XYZs {\n\tpts := make(plotter.XYZs, len(x))\n\tfor i := range x {\n\t\tpts[i].X = float64(x[i])\n\t\tpts[i].Y = float64(y[i])\n\t\tpts[i].Z = 0.1\n\n\t}\n\treturn pts\n}", "func (s *BaseAspidaListener) EnterPoints(ctx *PointsContext) {}", "func (p linear) getInfill(layerNr int, outline clipper.Path, holes clipper.Paths, overlap float32) clipper.Paths {\n\tvar result clipper.Paths\n\n\t// clip the paths with the lines using intersection\n\texset := clipper.Paths{outline}\n\n\tco := clipper.NewClipperOffset()\n\tcl := clipper.NewClipper(clipper.IoNone)\n\n\t// generate the ex-set for the overlap (only if needed)\n\tif overlap != 0 {\n\t\tco.AddPaths(exset, clipper.JtSquare, clipper.EtClosedPolygon)\n\t\tco.MiterLimit = 2\n\t\texset = co.Execute(float64(-overlap))\n\n\t\tco.Clear()\n\t\tco.AddPaths(holes, clipper.JtSquare, clipper.EtClosedPolygon)\n\t\tco.MiterLimit = 2\n\t\tholes = co.Execute(float64(overlap))\n\t}\n\n\t// clip the lines by the outline and holes\n\tcl.AddPaths(exset, clipper.PtClip, true)\n\tcl.AddPaths(holes, clipper.PtClip, true)\n\n\tif layerNr%2 == 0 {\n\t\tcl.AddPaths(p.verticalPaths, clipper.PtSubject, false)\n\t} else {\n\t\tcl.AddPaths(p.horizontalPaths, clipper.PtSubject, false)\n\t}\n\n\ttree, ok := cl.Execute2(clipper.CtIntersection, clipper.PftEvenOdd, clipper.PftEvenOdd)\n\tif !ok {\n\t\tfmt.Println(\"getLinearFill failed\")\n\t\treturn nil\n\t}\n\n\tfor _, c := range tree.Childs() {\n\t\tresult = append(result, c.Contour())\n\t}\n\n\treturn result\n}", "func (c *cursor) LineTo(points ...[2]float64) []uint32 {\n\treturn c.encodeCmd(uint32(NewCommand(cmdLineTo, len(points))), points)\n}", "func (order Order) OfInt64Points(ipts ...[2]int64) Winding {\n\tpts := make([][2]float64, len(ipts))\n\tfor i := range ipts {\n\t\tpts[i] = [2]float64{\n\t\t\tfloat64(ipts[i][0]),\n\t\t\tfloat64(ipts[i][1]),\n\t\t}\n\t}\n\treturn Orientation(order.YPositiveDown, pts...)\n}", "func PCMPESTRI(i, mx, x operand.Op) { ctx.PCMPESTRI(i, mx, x) }", "func (i *Result) Intersection() []geom.Coord {\n\treturn i.intersection\n}", "func GetOverlappedIds(c *gin.Context) {}", "func PolyInt32(a []int32, t []TermT) TermT {\n\tcount := C.uint32_t(len(a))\n\t//iam: FIXME need to unify the yices errors and the go errors...\n\t// do we want to be nannies here?\n\tif count == 0 {\n\t\treturn TermT(C.yices_zero())\n\t}\n\treturn TermT(C.yices_poly_int32(count, (*C.int32_t)(&a[0]), (*C.term_t)(&t[0])))\n}", "func (p *Profile) Boundaries(src []byte) (boundaries []Boundary) {\n\t// Find maximum count.\n\tmax := 0\n\tfor _, b := range p.Blocks {\n\t\tif b.Count > max {\n\t\t\tmax = b.Count\n\t\t}\n\t}\n\t// Divisor for normalization.\n\tdivisor := math.Log(float64(max))\n\n\t// boundary returns a Boundary, populating the Norm field with a normalized Count.\n\tboundary := func(offset int, start bool, count int) Boundary {\n\t\tb := Boundary{Offset: offset, Start: start, Count: count}\n\t\tif !start || count == 0 {\n\t\t\treturn b\n\t\t}\n\t\tif max <= 1 {\n\t\t\tb.Norm = 0.8 // Profile is in\"set\" mode; we want a heat map. Use cov8 in the CSS.\n\t\t} else if count > 0 {\n\t\t\tb.Norm = math.Log(float64(count)) / divisor\n\t\t}\n\t\treturn b\n\t}\n\n\tline, col := 1, 2 // TODO: Why is this 2?\n\tfor si, bi := 0, 0; si < len(src) && bi < len(p.Blocks); {\n\t\tb := p.Blocks[bi]\n\t\tif b.StartLine == line && b.StartCol == col {\n\t\t\tboundaries = append(boundaries, boundary(si, true, b.Count))\n\t\t}\n\t\tif b.EndLine == line && b.EndCol == col {\n\t\t\tboundaries = append(boundaries, boundary(si, false, 0))\n\t\t\tbi++\n\t\t\tcontinue // Don't advance through src; maybe the next block starts here.\n\t\t}\n\t\tif src[si] == '\\n' {\n\t\t\tline++\n\t\t\tcol = 0\n\t\t}\n\t\tcol++\n\t\tsi++\n\t}\n\tsort.Sort(boundariesByPos(boundaries))\n\treturn\n}", "func WrapEndpoints(in svc.Endpoints) svc.Endpoints {\n\n\t// Pass a middleware you want applied to every endpoint.\n\t// optionally pass in endpoints by name that you want to be excluded\n\t// e.g.\n\t// in.WrapAllExcept(authMiddleware, \"Status\", \"Ping\")\n\n\t// Pass in a svc.LabeledMiddleware you want applied to every endpoint.\n\t// These middlewares get passed the endpoints name as their first argument when applied.\n\t// This can be used to write generic metric gathering middlewares that can\n\t// report the endpoint name for free.\n\t// github.com/jjggzz/truss/_example/middlewares/labeledmiddlewares.go for examples.\n\t// in.WrapAllLabeledExcept(errorCounter(statsdCounter), \"Status\", \"Ping\")\n\n\t// How to apply a middleware to a single endpoint.\n\t// in.ExampleEndpoint = authMiddleware(in.ExampleEndpoint)\n\t// 限流\n\tlimitMiddleware := middleware.LimitMiddleware(middleware.LimitDelay, 100)\n\t// 断路器\n\tbreakerMiddleware := middleware.BreakerMiddleware(gobreaker.Settings{})\n\terrorMiddleware := ErrorMiddleware()\n\n\tin.WrapAllExcept(limitMiddleware)\n\tin.WrapAllExcept(breakerMiddleware)\n\tin.WrapAllExcept(errorMiddleware)\n\treturn in\n}", "func (space Space) PointCombine(point1 []float64, weight1 int, point2 []float64, weight2 int) []float64 {\n\treturn space.vspace.PointCombine(point1, weight1, point2, weight2)\n}", "func (f ChangeLineSpaceFilter) getLineRanges(src image.Image) lineRanges {\n\tbounds := src.Bounds()\n\tsrcWidth, srcHeight := bounds.Dx(), bounds.Dy()\n\tthreshold16 := f.option.Threshold * 256\n\n\tvar ranges lineRanges\n\tvar r lineRange\n\n\tmaxDotCount := int(f.option.EmptyLineThreshold)\n\tif f.option.EmptyLineThreshold < 1 {\n\t\tmaxDotCount = int(float64(srcWidth) * f.option.EmptyLineThreshold)\n\t}\n\tfor y := 0; y < srcHeight; y++ {\n\t\temptyLine := true\n\t\tdotCount := 0\n\t\tfor x := 0; x < srcWidth; x++ {\n\t\t\tr, g, b, _ := src.At(x, y).RGBA()\n\t\t\tbrightness := getBrightness(r, g, b)\n\t\t\tif brightness < threshold16 {\n\t\t\t\tdotCount++\n\t\t\t\tif dotCount >= maxDotCount {\n\t\t\t\t\temptyLine = false\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif emptyLine {\n\t\t\tif y == 0 {\n\t\t\t\tr = lineRange{start: y, end: y, emptyLine: true}\n\t\t\t} else {\n\t\t\t\tif r.emptyLine {\n\t\t\t\t\tr.end = y\n\t\t\t\t} else {\n\t\t\t\t\tranges = append(ranges, r)\n\t\t\t\t\tr = lineRange{start: y, end: y, emptyLine: true}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif y == 0 {\n\t\t\t\tr = lineRange{start: y, end: y, emptyLine: false}\n\t\t\t} else {\n\t\t\t\tif r.emptyLine {\n\t\t\t\t\tranges = append(ranges, r)\n\t\t\t\t\tr = lineRange{start: y, end: y, emptyLine: false}\n\t\t\t\t} else {\n\t\t\t\t\tr.end = y\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\tranges = append(ranges, r)\n\treturn ranges\n}", "func NewPointEndpoints() []*api.Endpoint {\n\treturn []*api.Endpoint{}\n}", "func (b Bounds2) Corner(i int) Point2 {\n\tvar pX, pY float64\n\tif i&1 != 0 {\n\t\tpX = b.pMax.X\n\t} else {\n\t\tpX = b.pMin.X\n\t}\n\n\tif i&2 != 0 {\n\t\tpY = b.pMax.Y\n\t} else {\n\t\tpY = b.pMin.Y\n\t}\n\n\treturn Point2{X: pX, Y: pY}\n}", "func neighbours(loc xy) []xy {\n\tswitch {\n\tcase loc.x > 0 && loc.y > 0:\n\t\treturn []xy{xy{loc.x + 1, loc.y}, xy{loc.x, loc.y + 1}, xy{loc.x - 1, loc.y}, xy{loc.x, loc.y - 1}}\n\tcase loc.y > 0:\n\t\treturn []xy{xy{loc.x + 1, loc.y}, xy{loc.x, loc.y + 1}, xy{loc.x, loc.y - 1}}\n\tcase loc.x > 0:\n\t\treturn []xy{xy{loc.x + 1, loc.y}, xy{loc.x, loc.y + 1}, xy{loc.x - 1, loc.y}}\n\tdefault:\n\t\treturn []xy{xy{loc.x + 1, loc.y}, xy{loc.x, loc.y + 1}}\n\t}\n}", "func (c *Aggregator) Points() ([]Point, error) {\n\treturn c.samples, nil\n}", "func (t *Table) Pointers(baseOff int) []int {\n\tvar ptrs []int\n\n\tcur := baseOff + len(t.Elems)*2\n\tfor _, e := range t.Elems {\n\t\tvar p int\n\t\tif len(e) == 0 {\n\t\t\tp = 0\n\t\t} else {\n\t\t\tp = cur\n\t\t\tcur += len(e)\n\t\t}\n\t\tptrs = append(ptrs, p)\n\t}\n\n\treturn ptrs\n}", "func (me *XElemsPolyline) Walk() (err error) {\n\tif fn := WalkHandlers.XElemsPolyline; 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.Polylines {\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}", "func (o NurbsPatch) diffPoints(idOld int, xNew []float64) bool {\n\tif math.Abs(xNew[3]-o.ControlPoints[idOld].X[3]) > 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "func (rlgb *RuleLimitGroupBy) IntsX(ctx context.Context) []int {\n\tv, err := rlgb.Ints(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "func (g SimplePoint) Intersects(o Object) bool {\n\treturn intersectsObjectShared(g, o,\n\t\tfunc(v Polygon) bool {\n\t\t\treturn poly.Point(Position{X: g.X, Y: g.Y, Z: 0}).Intersects(polyExteriorHoles(v.Coordinates))\n\t\t},\n\t\tfunc(v MultiPolygon) bool {\n\t\t\tfor _, c := range v.Coordinates {\n\t\t\t\tif poly.Point(Position{X: g.X, Y: g.Y, Z: 0}).Intersects(polyExteriorHoles(c)) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\t)\n}", "func IntsConst(v []int64) ConstInts {\n\treturn &constInts{v}\n}", "func (s *Asteroid) getPoints() {\n\ts.points = s.init\n\ts.drawable = makeVertexArrayObj(s.points)\n}", "func Points(scorer interface{ Number() uint8 }) uint8 {\n\tvar points = map[uint8]uint8{1: 11, 3: 10, 8: 2, 9: 3, 10: 4}\n\treturn points[scorer.Number()]\n}", "func WrapEndpoints(in svc.Endpoints) svc.Endpoints {\n\t\n\t// Pass a middleware you want applied to every endpoint.\n\t// optionally pass in endpoints by name that you want to be excluded\n\t// e.g.\n\t// in.WrapAllExcept(authMiddleware, \"Status\", \"Ping\")\n\t\n\t// Pass in a svc.LabeledMiddleware you want applied to every endpoint.\n\t// These middlewares get passed the endpoints name as their first argument when applied.\n\t// This can be used to write generic metric gathering middlewares that can\n\t// report the endpoint name for free.\n\t// github.com/metaverse/truss/_example/middlewares/labeledmiddlewares.go for examples.\n\t// in.WrapAllLabeledExcept(errorCounter(statsdCounter), \"Status\", \"Ping\")\n\t\n\t// How to apply a middleware to a single endpoint.\n\t// in.ExampleEndpoint = authMiddleware(in.ExampleEndpoint)\n\t\n\t//创建限流器 1r/s 每秒请求数\n\tlimiter := rate.NewLimiter(rate.Every(time.Second*1), 10)\n\t\n\t//通过DelayingLimiter中间件,在bookListEndPoint的外层再包裹一层限流的endPoint\n\tlimtMw := ratelimit.NewDelayingLimiter(limiter)\n\tin.GetBookInfoEndpoint = limtMw(in.GetBookInfoEndpoint)\n\tin.GetBookListEndpoint = limtMw(in.GetBookListEndpoint)\n\treturn in\n}", "func (isf intSliceFunctorImpl) Ints() []int {\n\treturn isf.ints\n}", "func (c *container) Polyline(pts ...Point) *Polyline {\n\tp := &Polyline{Points: pts}\n\tc.contents = append(c.contents, p)\n\n\treturn p\n}", "func (r Ruler) PointOnLine(l Line, p Point) PointOnLine {\n\tvar minDist float64 = math.Inf(1)\n\tvar minX, minY, minT, x, y, dx, dy, t float64\n\tvar minI int\n\n\tfor i := 0; i < len(l)-1; i++ {\n\n\t\tx = l[i][0]\n\t\ty = l[i][1]\n\t\tdx = (l[i+1][0] - x) * r.kx\n\t\tdy = (l[i+1][1] - y) * r.ky\n\n\t\tif dx != 0 || dy != 0 {\n\n\t\t\tt = ((p[0]-x)*r.kx*dx + (p[1]-y)*r.ky*dy) / (dx*dx + dy*dy)\n\n\t\t\tif t > 1 {\n\t\t\t\tx = l[i+1][0]\n\t\t\t\ty = l[i+1][1]\n\n\t\t\t} else if t > 0 {\n\t\t\t\tx += (dx / r.kx) * t\n\t\t\t\ty += (dy / r.ky) * t\n\t\t\t}\n\t\t}\n\n\t\tdx = (p[0] - x) * r.kx\n\t\tdy = (p[1] - y) * r.ky\n\n\t\tvar sqDist = dx*dx + dy*dy\n\t\tif sqDist < minDist {\n\t\t\tminDist = sqDist\n\t\t\tminX = x\n\t\t\tminY = y\n\t\t\tminI = i\n\t\t\tminT = t\n\t\t}\n\t}\n\n\treturn PointOnLine{\n\t\tpoint: Point{minX, minY},\n\t\tindex: minI,\n\t\tt: math.Max(0, math.Min(1, minT)),\n\t}\n}", "func findNearNeighbor(x []float64, y []float64, points map[int]int, start int) int {\n neighbor := 0\n smDist := 10000000.0\n\n // Loop through all yet visited points to find out the cloesest point to current point.\n for i := 1; i < len(points); i++ {\n if (i != start) && (points[i] != 0) {\n sqSum := math.Pow(x[i] - x[start], 2) + math.Pow(y[i] - y[start], 2)\n dist := math.Sqrt(sqSum)\n if dist < smDist {\n neighbor = i\n smDist = dist\n }\n }\n }\n return neighbor\n}", "func _line(x1o, y1o, x2o, y2o *FloatOrInt) chan FloatPair {\n\tc := make(chan FloatPair)\n\n\tgo func() {\n\t\tx1 := x1o.Normalized()\n\t\ty1 := y1o.Normalized()\n\t\tx2 := x2o.Normalized()\n\t\ty2 := y2o.Normalized()\n\n\t\txdiff := sub(max(x1, x2), min(x1, x2))\n\t\tydiff := sub(max(y1, y2), min(y1, y2))\n\n\t\txdir := -1\n\t\tif lessEqual(x1, x2) {\n\t\t\txdir = 1\n\t\t}\n\n\t\tydir := -1\n\t\tif lessEqual(y1, y2) {\n\t\t\tydir = 1\n\t\t}\n\n\t\tr := max(xdiff, ydiff)\n\n\t\tfor i := 0; i < r.Int()+1; i++ {\n\t\t\tx := x1.Float()\n\t\t\ty := y1.Float()\n\n\t\t\tif ydiff.Bool() {\n\t\t\t\ty += (float64(i) * ydiff.Float()) / r.Float() * float64(ydir)\n\t\t\t}\n\t\t\tif xdiff.Bool() {\n\t\t\t\tx += (float64(i) * xdiff.Float()) / r.Float() * float64(xdir)\n\t\t\t}\n\n\t\t\tc <- FloatPair{x, y} // yield\n\t\t}\n\t\tclose(c)\n\n\t}()\n\n\treturn c\n}", "func (self *Rectangle) OffsetPointI(args ...interface{}) *Rectangle{\n return &Rectangle{self.Object.Call(\"offsetPoint\", args)}\n}", "func (m Shape) GetCoordinates() []Line {\n\treturn m.Coordinates\n}", "func (*Secp256k1) PointLen() int { return egPoint.MarshalSize() }", "func BoundingBox_Points(pts [][]float64) []float64 {\n\t// setting opposite default values\n\twest, south, east, north := float64(math.Inf(1)), float64(math.Inf(1)),float64(math.Inf(-1)),float64(math.Inf(-1))\n\n\tfor _, pt := range pts {\n\t\tx, y := pt[0], pt[1]\n\t\t// can only be one condition\n\t\t// using else if reduces one comparison\n\t\tif x < west {\n\t\t\twest = x\n\t\t\n\t\t}\n\t\tif x > east {\n\t\t\teast = x\n\t\t}\n\n\t\tif y < south {\n\t\t\tsouth = y\n\t\t}\n\t\tif y > north {\n\t\t\tnorth = y\n\t\t}\n\t}\n\treturn []float64{west, south, east, north}\n}", "func (l *Level) Around(loc math.Point) []*Tile {\n\tadj := l.Bounds.Clip(math.Adj(loc))\n\n\tneighbors := make([]*Tile, 0, len(adj))\n\n\tfor _, p := range adj {\n\t\tneighbors = append(neighbors, l.At(p))\n\t}\n\treturn neighbors\n}", "func (orth *Orthotope) Intersects(o *Orthotope) int32 {\n\tinT := int32(0)\n\toutT := int32(math.MaxInt32)\n\tfor index, p0 := range o.Point {\n\t\tp1 := o.Delta[index] + p0\n\n\t\tif orth.Delta[index] == 0 {\n\t\t\tif orth.Point[index] < p0 || p1 < orth.Point[index] {\n\t\t\t\treturn -1\n\t\t\t}\n\t\t} else {\n\t\t\tif orth.Delta[index] < 0 {\n\t\t\t\t// Swap p0 and p1 for negative directions.\n\t\t\t\tp0, p1 = p1, p0\n\t\t\t}\n\t\t\tp0T := ((p0 - orth.Point[index]) << ACCURACY) / orth.Delta[index]\n\t\t\tinT = disc.Max(inT, p0T)\n\n\t\t\tp1T := ((p1 - orth.Point[index]) << ACCURACY) / orth.Delta[index]\n\t\t\toutT = disc.Min(outT, p1T)\n\t\t}\n\t}\n\n\tif inT < outT && inT >= 0 {\n\t\treturn inT\n\t}\n\treturn -1\n}", "func (o StreamProcessorOutput) PolygonRegionsOfInterest() StreamProcessorPointArrayArrayOutput {\n\treturn o.ApplyT(func(v *StreamProcessor) StreamProcessorPointArrayArrayOutput { return v.PolygonRegionsOfInterest }).(StreamProcessorPointArrayArrayOutput)\n}" ]
[ "0.5369969", "0.5363394", "0.52974355", "0.5246381", "0.5191002", "0.48185128", "0.46456409", "0.45902103", "0.4585371", "0.45481473", "0.45180067", "0.44956204", "0.44434085", "0.44339702", "0.4428231", "0.44268453", "0.4377828", "0.43652183", "0.43572596", "0.43551555", "0.43396905", "0.43117067", "0.42636937", "0.4244943", "0.41953826", "0.41849253", "0.41668543", "0.4155991", "0.41538334", "0.41437495", "0.41435057", "0.4141967", "0.41309434", "0.41164553", "0.4115369", "0.41123563", "0.41093075", "0.4096261", "0.40938035", "0.40910164", "0.40719175", "0.40713865", "0.40692753", "0.40534657", "0.40459406", "0.40447563", "0.40372694", "0.40369743", "0.40360156", "0.39962155", "0.3993789", "0.39914802", "0.39866063", "0.39780536", "0.39768612", "0.39764377", "0.3969254", "0.39652914", "0.39640805", "0.39608464", "0.39607778", "0.39571217", "0.39390662", "0.39360598", "0.39359733", "0.39229637", "0.39093846", "0.39068687", "0.38953927", "0.38944936", "0.38934216", "0.3885146", "0.38822928", "0.38697746", "0.38657743", "0.38592505", "0.3856952", "0.38548213", "0.38446546", "0.3835397", "0.3832403", "0.3826099", "0.38248911", "0.3819719", "0.38179356", "0.38147724", "0.38059682", "0.38050953", "0.38047758", "0.37992474", "0.37968534", "0.37878054", "0.3779596", "0.37778074", "0.3773406", "0.3765794", "0.37654746", "0.3762597", "0.3760146", "0.37579226" ]
0.8265049
0
move returns a new point that has the same properties as the point, but has moved a certain distance dist in direction dir.
move возвращает новый точку, которая имеет те же свойства, что и исходная точка, но сдвинута на определенное расстояние dist в направлении dir.
func (p point) move(dir direction, dist int) point { var movedPoint point switch dir { case up: movedPoint = point{x: p.x, y: p.y + dist} case down: movedPoint = point{x: p.x, y: p.y - dist} case right: movedPoint = point{x: p.x + dist, y: p.y} case left: movedPoint = point{x: p.x - dist, y: p.y} } movedPoint.wireLen = p.wireLen + dist return movedPoint }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func movePoint(p *Point2D, dx, dy float64) {\n\tp.Move(dx, dy)\n}", "func (p *Point2D) Move(deltaX, deltaY float64) {\n\t// if you want to modify the \"object\" (i.e. the value) you need to pass a pointer\n\t// otherwise you would only get a copy (by-value)\n\n\t// this is actually short-hand for (*p).x and (*p).y. Go does magic dereferencing on struct pointers.\n\tp.x += deltaX\n\tp.y += deltaY\n}", "func (d *droid) move(direction int) int {\n\td.code.PushInput(int64(direction))\n\td.code.Continue()\n\n\tmoveResult := int(d.code.PopOutput())\n\tif moveResult != 0 {\n\t\tif direction == 1 {\n\t\t\td.location.y--\n\t\t} else if direction == 2 {\n\t\t\td.location.y++\n\t\t} else if direction == 3 {\n\t\t\td.location.x--\n\t\t} else {\n\t\t\td.location.x++\n\t\t}\n\t}\n\n\tif moveResult == 2 {\n\t\td.foundTarget = true\n\t\td.oxygenPosition = &point{x: d.location.x, y: d.location.y}\n\t}\n\n\treturn moveResult\n}", "func (path *Path) Move(pt Point) {\n\twriteCommand(&path.buf, \"m\", pt.X, pt.Y)\n}", "func (r *paintingRobot) move() {\n posX, posY := r.position.x, r.position.y\n switch r.direction {\n case up:\n posY -= 1\n case right:\n posX += 1\n case down:\n posY += 1\n case left:\n posX -= 1\n }\n\n r.position = &point{\n x: posX,\n y: posY,\n }\n\n fmt.Println(fmt.Sprintf(\"robot moved to [%d,%d]\", r.position.x, r.position.y))\n}", "func (d *droid) moveToPoint(p *point) {\n\tif !(d.location.x == p.x && d.location.y == p.y) {\n\t\tpath := d.calculatePath(d.location, p)\n\t\tfor _, step := range path {\n\t\t\tmoveResult := d.move(step)\n\t\t\tif moveResult == 0 {\n\t\t\t\tlog.Fatal(\"Move to point can't find path\")\n\t\t\t}\n\t\t}\n\t}\n}", "func (c Circle) Moved(delta Vec) Circle {\n\treturn Circle{\n\t\tCenter: c.Center.Add(delta),\n\t\tRadius: c.Radius,\n\t}\n}", "func (l *Line) Move(direction Vector) Vector {\n\tl.q = l.q.Add(direction)\n\tl.p = l.p.Add(direction)\n\n\treturn l.Center()\n}", "func (c *Constraints) move(dx, dy float32) {\n\tc.x.move(dx)\n\tc.y.move(dy)\n}", "func (r Ray3) Moved(dist float64) Vector3 {\n\treturn r.Origin.Plus(r.Dir.Scaled(dist))\n}", "func (e *Engine) Move(dir Direction) (success bool) {\n\tsuccess = false\n\n\tdest1 := e.CurrentState.Figure.Add(dir.Point())\n\tvalid, containsBox := e.CheckDestination(dest1)\n\tif !valid {\n\t\treturn\n\t}\n\tvar dest2 Point\n\tif valid && containsBox {\n\t\tdest2 = dest1.Add(dir.Point())\n\t\tvalid, containsSecBox := e.CheckDestination(dest2)\n\t\tif !valid || containsSecBox {\n\t\t\treturn\n\t\t}\n\t}\n\n\tsuccess = true\n\te.appendState2History(e.CurrentState)\n\n\tif containsBox {\n\t\te.moveBox(dest1, dest2)\n\t}\n\te.CurrentState.Figure = dest1\n\treturn\n}", "func (point Point) Walk(direction Direction) Point {\n\tswitch direction {\n\tcase DirectionTop:\n\t\tpoint.Y++\n\tcase DirectionDown:\n\t\tpoint.Y--\n\tcase DirectionRight:\n\t\tpoint.X++\n\tcase DirectionLeft:\n\t\tpoint.X--\n\t}\n\n\treturn point\n}", "func (s *swimmer) move() {\n\ts.xPos += s.direction()\n}", "func (v Vertex) Move(dx, dy int) {\n\tv.x = v.x + dx\n\tv.y = v.y + dy\n}", "func (l Line) Moved(delta Vec) Line {\n\treturn Line{\n\t\tA: l.A.Add(delta),\n\t\tB: l.B.Add(delta),\n\t}\n}", "func (r *Robot) Move() {\n\tr.Pos.Y = r.Pos.Y + r.Dir.Y\n\tr.Pos.X = r.Pos.X + r.Dir.X\n}", "func (a *Agent) Move(position *vec2.T) bool {\n\tdiff := vec2.Sub(position, a.position)\n\tpositionWithSizeRadius := diff.Normalize().Scale(a.sizeRadius).Add(position)\n\n\tif a.currentTriangle != nil && a.currentTriangle.containsPoint(positionWithSizeRadius) {\n\t\ta.position = position\n\t\treturn true\n\t} else if a.currentTriangle = a.navMesh.Mesh.findTriangleByPoint(positionWithSizeRadius); a.currentTriangle != nil {\n\t\ta.position = position\n\t\treturn true\n\t}\n\treturn false\n}", "func (l *Line) Move(x, y float64) {\n\tl.X += x\n\tl.Y += y\n\tl.X2 += x\n\tl.Y2 += y\n}", "func (mov *Moves) Dir(move ecs.Entity) (image.Point, bool) {\n\tif move.Type().HasAll(movDir) {\n\t\treturn mov.dir[move.ID()], true\n\t}\n\treturn image.ZP, false\n}", "func (m *Map) Move(loc Location, d Direction) Location {\n\tRow, Col := m.FromLocation(loc)\n\tswitch d {\n\t\tcase North:\t\tRow -= 1\n\t\tcase South:\t\tRow += 1\n\t\tcase West:\t\tCol -= 1\n\t\tcase East:\t\tCol += 1\n\t\tcase NoMovement: //do nothing\n\t\tdefault: Panicf(\"%v is not a valid direction\", d)\n\t}\n\treturn m.FromRowCol(Row, Col) //this will handle wrapping out-of-bounds numbers\n}", "func (b *Bullet) move() {\n\tb.point = b.point.Add(b.velocity)\n\tb.op.GeoM.Translate(float64(b.velocity.X), float64(b.velocity.Y))\n}", "func (d *Directory) Move(p, name, newPath string) error {\n\tdir, err := d.checkPathExists(p)\n\tif err != nil {\n\t\treturn err\n\t}\n\tnewDir, err := d.checkPathExists(newPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor i, iNode := range dir.INodes {\n\t\tif iNode.GetName() == name {\n\t\t\td.lock()\n\t\t\tnewDir.INodes = append(newDir.INodes, iNode)\n\t\t\tdir.INodes = append(dir.INodes[:i], dir.INodes[i+1:]...)\n\t\t\td.unlock()\n\t\t\tdir.updateDirectorySize(p)\n\t\t\tdir.updateDirectorySize(newPath)\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn errors.New(\"target doesn't exists: \" + p + name)\n}", "func (r *Render) move(from, to int) int {\n\tfromX, fromY := r.toPos(from)\n\ttoX, toY := r.toPos(to)\n\n\tr.out.CursorUp(fromY - toY)\n\tr.out.CursorBackward(fromX - toX)\n\treturn to\n}", "func (p *Particle) Move() {\n\tp.Position[0] += (p.Direction[0] * p.Speed)\n\tp.Position[1] += (p.Direction[1] * p.Speed)\n}", "func (p *Path) MoveTo(x, y float64) *Path {\n\t//if len(p.d) == 0 && equal(x, 0.0) && equal(y, 0.0) {\n\t//\treturn p\n\t//}\n\tp.i0 = len(p.d)\n\tp.d = append(p.d, moveToCmd, x, y)\n\treturn p\n}", "func Move(zoom, lat, lon float64, pdx int, pdy int) (nlat, nlon float64) {\n\txf, yf := TileNum(int(zoom), lat, lon)\n\tdx := float64(pdx) / TileWidth\n\tdy := float64(pdy) / TileHeight\n\n\treturn latlonFromXY(int(zoom), xf+(dx), yf+(dy))\n}", "func (m Matrix) Moved(delta Vec) Matrix {\n\tm[4], m[5] = m[4]+delta.X, m[5]+delta.Y\n\treturn m\n}", "func (r *DefaultRobot) Move(d Direction) error {\n\tr.pos = Navigate(r.pos, d)\n\tr.distanceTravelled++\n\treturn nil\n}", "func (p *PDF) Move(xDelta, yDelta float64) {\n\tp.x, p.y = p.x+xDelta, p.y+yDelta\n\tp.fpdf.MoveTo(p.x, p.y)\n}", "func (r Rect) Moved(delta Vec) Rect {\n\treturn Rect{\n\t\tMin: r.Min.Add(delta),\n\t\tMax: r.Max.Add(delta),\n\t}\n}", "func (p *Pawn) Move(newLocation location.Location) {\n\tp.loc = newLocation\n\tp.hasMoved = true\n}", "func (f *Fs) moveDir(ctx context.Context, id, leaf, directoryID string) (err error) {\n\t// Move the object\n\topts := rest.Opts{\n\t\tMethod: \"PUT\",\n\t\tRootURL: id,\n\t\tNoResponse: true,\n\t}\n\tmove := api.MoveFolder{\n\t\tName: f.opt.Enc.FromStandardName(leaf),\n\t\tParent: directoryID,\n\t}\n\tvar resp *http.Response\n\treturn f.pacer.Call(func() (bool, error) {\n\t\tresp, err = f.srv.CallXML(ctx, &opts, &move, nil)\n\t\treturn shouldRetry(ctx, resp, err)\n\t})\n}", "func (m MoveResult) Move() Move {\n\tif !m.valid {\n\t\tzap.L().Fatal(\"Check if this isValid before accessing the Move()!\")\n\t}\n\treturn m.move\n}", "func (p *Player) Move (direction string, l *Log) int{\n t := time.Now()\n moved := 0\n name := p.Name\n switch direction {\n case \"a\":\n if p.X == 1 {\n l.WrongDirection(p)\n } else if p.X > 1 {\n p.X = p.X - 1\n moved = moved + 1\n l.AddAction(t.Format(\"3:04:05 \")+ name +\" moves West.\")\n }\n case \"s\":\n if p.Y == 5 {\n l.WrongDirection(p)\n } else if p.Y < 5 {\n p.Y = p.Y + 1\n moved = moved + 1\n l.AddAction(t.Format(\"3:04:05 \")+ name +\" moves South.\")\n }\n case \"d\":\n if p.X == 5 {\n l.WrongDirection(p)\n } else if p.X < 5 {\n p.X = p.X + 1\n moved = moved + 1\n l.AddAction(t.Format(\"3:04:05 \")+ name +\" moves East.\")\n }\n case \"w\":\n if p.Y == 1 {\n l.WrongDirection(p)\n } else if p.Y > 1 {\n p.Y = p.Y - 1\n moved = moved + 1\n l.AddAction(t.Format(\"3:04:05 \")+ name +\" moves North.\")\n }\n case \"x\":\n os.Exit(1)\n }\n return moved\n}", "func (p *Position) Move(hole int) (*Position, *Position, MoveResult, error) {\n\t// validate in range\n\tif hole < 1 || hole > WIDTH() {\n\t\treturn p, nil, BadMove, errors.New(\"hole not in range\")\n\t}\n\n\t// validate hole has stones\n\tstones := p.near().Items[hole]\n\tif stones == 0 {\n\t\treturn p, nil, BadMove, errors.New(\"invalid move\")\n\t}\n\n\t// create delta position\n\tdelta, lastRow, lastHole := deltaPosition(hole, stones)\n\t// fmt.Printf(\"deltaPosition lastRow:%d, lastHole:%d\\n\", lastRow, lastHole)\n\t// combine\n\tresult := p.add(delta)\n\n\t// determina result from last position\n\tmoveResult := EndOfTurn\n\tif lastHole == 0 {\n\t\tmoveResult = RepeatTurn\n\t}\n\n\t// check for steal\n\tif isSteal, opRow, opHole, opCount := result.IsSteal(lastRow, lastHole); isSteal {\n\t\t// create steal position\n\t\tsteal := stealPosition(lastRow, lastHole, opRow, opHole, opCount)\n\t\t// apply\n\t\tresult = result.add(steal)\n\t}\n\n\tif result.IsGameEnd() {\n\t\tmoveResult = EndOfGame\n\t}\n\n\treturn result, delta, moveResult, nil\n}", "func (r *Rook) Move(newLocation location.Location) {\n\tr.loc = newLocation\n\tr.hasMoved = true\n}", "func (db *GeoDB) MoveMember(q *GeoQuery) error {\n\tconn := db.pool.Get()\n\tdefer conn.Close()\n\n\t_, err := db.scripts[\"GEOMOVE\"].Do(\n\t\tconn,\n\t\tTwoKeys,\n\t\tq.FromKey,\n\t\tq.ToKey,\n\t\tq.Member,\n\t)\n\n\treturn err\n}", "func turnDist(p1, p2 Coord) int {\n return int(math.Ceil(float64(dist(p1, p2)) / MOVE_DIST))\n}", "func (f *FileUtil) move(src, dst string) {\n\tsrc = FixPath(src)\n\tdst = FixPath(dst)\n\tif f.Verbose {\n\t\tfmt.Println(\"Moving\", src, \"to\", dst)\n\t}\n\t_, err := f.dbx.Move(files.NewRelocationArg(src, dst))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func (mov *Moves) SetDir(move ecs.Entity, dir image.Point) {\n\tmove.Add(movDir)\n\tmov.dir[move.ID()] = dir\n}", "func (npc *Npc) Move(direction Direction) {\n\ttransform := npc.GetComponent(TransformTag).(*TransformComponent)\n\ttransform.MovementQueue.AddStep(direction)\n}", "func (s *State) Move(pos Position, dir Direction) Position {\n\tfor {\n\t\tif !s.CanMove(pos, dir) {\n\t\t\treturn pos\n\t\t}\n\t\tpos = pos.Next(dir)\n\t}\n}", "func (p *Player) move(treasureMap map[[2]int]int) ([2]int, bool) {\n\n\tif p.DirectionTaken == up {\n\t\tnewPlayerPositionXY := [2]int{p.Position[0], p.Position[1] + 1}\n\t\tif treasureMap[newPlayerPositionXY] == entity_obstacle {\n\t\t\tp.DirectionTaken = right\n\t\t} else {\n\t\t\treturn newPlayerPositionXY, true\n\t\t}\n\t}\n\n\tif p.DirectionTaken == right {\n\t\tnewPlayerPositionXY := [2]int{p.Position[0] + 1, p.Position[1]}\n\t\tif treasureMap[newPlayerPositionXY] == entity_obstacle {\n\t\t\tp.DirectionTaken = down\n\t\t} else {\n\t\t\treturn newPlayerPositionXY, true\n\t\t}\n\t}\n\n\tif p.DirectionTaken == down {\n\t\tnewPlayerPositionXY := [2]int{p.Position[0], p.Position[1] - 1}\n\t\tif treasureMap[newPlayerPositionXY] == entity_obstacle {\n\t\t\tp.DirectionTaken = stuck\n\t\t} else {\n\t\t\treturn newPlayerPositionXY, true\n\t\t}\n\t}\n\n\treturn p.Position, false\n}", "func (d *driver) Move(ctx context.Context, source string, dest string) error {\n\tdefer debugTime()()\n\tsourceobj := d.fullPath(source)\n\tsrchash, err := d.shell.ResolvePath(sourceobj)\n\tif err != nil {\n\t\tif strings.HasPrefix(err.Error(), \"no link named\") {\n\t\t\treturn storagedriver.PathNotFoundError{Path: source}\n\t\t}\n\t\treturn err\n\t}\n\n\td.rootlock.Lock()\n\tdefer d.rootlock.Unlock()\n\tnewroot, err := d.shell.Patch(d.roothash, \"rm-link\", source[1:])\n\tif err != nil {\n\t\tif err.Error() == \"merkledag: not found\" {\n\t\t\treturn storagedriver.PathNotFoundError{Path: source}\n\t\t} else {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// remove leading slash\n\tdest = dest[1:]\n\tnewroot, err = d.shell.PatchLink(newroot, dest, srchash, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.roothash = newroot\n\tfmt.Println(\"HASH AFTER MOVE: \", newroot)\n\td.publishHash(newroot)\n\treturn nil\n}", "func (i *Item) Move(x, y int) {\n\ti.X = x\n\ti.Y = y\n}", "func (p *Point3D) Move(deltaX, deltaY, deltaZ float64) {\n\t// Can we leverage existing code?\n\t// Turns out we can! This basically translates to super(deltaX, deltaY)\n\tp.Point2D.Move(deltaX, deltaY)\n\n\t//Now only the 3d part\n\tp.z += deltaZ\n}", "func (s *carrier) move() {\n\ts.position.x += s.direction.x\n\ts.position.y += s.direction.y\n\n\t// is the grid big enough for where we want to go?\n\tif !s.isInGrid() {\n\t\t// correct our position for the new grid size\n\t\ts.position.x += s.grid.size\n\t\ts.position.y += s.grid.size\n\t\t//fmt.Println(s.position, s.direction)\n\t\ts.grid.grow()\n\t}\n}", "func (p *PlayerEntity) Move(offset shared.FloatVector) {\n\tp.position.X += offset.X\n\tp.position.Y += offset.Y\n}", "func (p *Player) Move(x float32, y float32) {\n\tp.position.X = p.position.X + p.movement.X*p.speed\n\tp.position.Y = p.position.Y + p.movement.Y*p.speed\n}", "func (unitImpl *UnitImpl) Move(x float64, y float64) bool {\n\treturn unitImpl.RunOnServer(\"move\", map[string]interface{}{\n\t\t\"x\": x,\n\t\t\"y\": y,\n\t}).(bool)\n}", "func (c *Camera) Move(dir CameraDirection, offset float32) {\n\tvar delta types.Vec3\n\n\tswitch dir {\n\tcase Up:\n\t\tdelta = c.Up.Mul(offset)\n\tcase Down:\n\t\tdelta = c.Up.Mul(-offset)\n\tcase Left:\n\t\tdelta = c.LookAt.Sub(c.Position).Normalize().Cross(c.Up).Mul(-offset)\n\tcase Right:\n\t\tdelta = c.LookAt.Sub(c.Position).Normalize().Cross(c.Up).Mul(offset)\n\tcase Forward:\n\t\tdelta = c.LookAt.Sub(c.Position).Normalize().Mul(offset)\n\tcase Backward:\n\t\tdelta = c.LookAt.Sub(c.Position).Normalize().Mul(-offset)\n\t}\n\n\tc.Position = c.Position.Add(delta)\n\tc.LookAt = c.LookAt.Add(delta)\n\tc.Update()\n}", "func (p *Path) MoveTo(x, y float64) {\n\tp.appendToPath(MoveToCmp, x, y)\n\tp.x = x\n\tp.y = y\n}", "func (d *Dao) MoveRelative(\n\tmotorCode int,\n\tdirection int,\n\tspeed int,\n\tposition int,\n) (resp interface{}, err error) {\n\tmotorCodeBytes, err := uint8Bytes(motorCode)\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\tdirectionBytes, err := uint8Bytes(direction)\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\tspeedBytes, err := uint16Bytes(speed)\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\tposBytes, err := uint16Bytes(position)\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\treq := MotorMoveRelativeUnit.Request()\n\toutput, err := sendAck2(d,\n\t\tcomposeBytes(\n\t\t\treq.Bytes(),\n\t\t\tmotorCodeBytes,\n\t\t\tdirectionBytes,\n\t\t\tspeedBytes,\n\t\t\tposBytes,\n\t\t),\n\t\tMotorMoveRelativeUnit.RecResp(),\n\t\tMotorMoveRelativeUnit.ComResp(),\n\t)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn resp, err\n\t}\n\tresp = binary.BigEndian.Uint16(output[3:5])\n\treturn resp, nil\n}", "func (elems *Elements) move(from, to dvid.Point3d, deleteElement bool) (moved *Element, changed bool) {\n\tfor i, elem := range *elems {\n\t\tif from.Equals(elem.Pos) {\n\t\t\tchanged = true\n\t\t\t(*elems)[i].Pos = to\n\t\t\tmoved = (*elems)[i].Copy()\n\t\t\tif deleteElement {\n\t\t\t\t(*elems)[i] = (*elems)[len(*elems)-1] // Delete without preserving order.\n\t\t\t\t*elems = (*elems)[:len(*elems)-1]\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check relationships for any moved points.\n\tfor i, elem := range *elems {\n\t\t// Move any relationship with given pt.\n\t\tfor j, r := range elem.Rels {\n\t\t\tif from.Equals(r.To) {\n\t\t\t\tr.To = to\n\t\t\t\t(*elems)[i].Rels[j] = r\n\t\t\t\tchanged = true\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func (d *driver) Move(ctx context.Context, sourcePath string, destPath string) error {\n\tif err := d.copy(ctx, sourcePath, destPath); err != nil {\n\t\treturn err\n\t}\n\treturn d.Delete(ctx, sourcePath)\n}", "func Move(s string) (*shogi.Move, error) {\n\ta := strings.Split(strings.TrimSpace(s), \"\")\n\n\tif len(a) < 4 {\n\t\treturn nil, errors.New(\"insufficient length. input = \" + s)\n\t}\n\n\t// is from captured.\n\tif strings.Contains(s, \"*\") {\n\t\tpiece, err := Piece(usi.Piece(a[0]))\n\t\tif err != nil {\n\t\t\tmsg := \"failed to parse captured piece on Move. input = \" + a[0] + \": %w\"\n\t\t\treturn nil, fmt.Errorf(msg, err)\n\t\t}\n\n\t\tsrc := &shogi.Point{Row: -1, Column: -1}\n\n\t\trow, err := parseRow(a[3])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse row. input = %s: %w\", a[3], err)\n\t\t}\n\n\t\tcol, err := parseColumn(a[2])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse column. input = %s: %w\", a[2], err)\n\t\t}\n\n\t\tdst := &shogi.Point{Row: row, Column: col}\n\t\treturn &shogi.Move{\n\t\t\tSource: src,\n\t\t\tDest: dst,\n\t\t\tPieceID: piece,\n\t\t\tIsPromoted: false,\n\t\t}, nil\n\t}\n\n\tsrow, err := parseRow(a[1])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse row. input = %s: %w\", a[1], err)\n\t}\n\n\tscol, err := parseColumn(a[0])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse column. input = %s: %w\", a[0], err)\n\t}\n\n\tdrow, err := parseRow(a[3])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse row. input = %s: %w\", a[3], err)\n\t}\n\n\tdcol, err := parseColumn(a[2])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse column. input = %s: %w\", a[2], err)\n\t}\n\n\tsrc := &shogi.Point{Row: srow, Column: scol}\n\tdst := &shogi.Point{Row: drow, Column: dcol}\n\tprm := len(a) == 5 && a[4] == \"+\"\n\n\treturn &shogi.Move{\n\t\tSource: src,\n\t\tDest: dst,\n\t\tPieceID: 0,\n\t\tIsPromoted: prm,\n\t}, nil\n}", "func makeMove(oldRow, oldCol int, dir string) (newRow, newCol int) {\n\tnewRow, newCol = oldRow, oldCol\n\n\t// Switch based on direction, with circular movement if out of bounds\n\tswitch dir {\n\tcase \"UP\":\n\t\tnewRow = newRow - 1\n\t\tif newRow < 0 {\n\t\t\tnewRow = len(maze) - 1\n\t\t}\n\tcase \"DOWN\":\n\t\tnewRow = newRow + 1\n\t\tif newRow == len(maze) {\n\t\t\tnewRow = 0\n\t\t}\n\tcase \"RIGHT\":\n\t\tnewCol = newCol + 1\n\t\tif newCol == len(maze[0]) {\n\t\t\tnewCol = 0\n\t\t}\n\tcase \"LEFT\":\n\t\tnewCol = newCol - 1\n\t\tif newCol < 0 {\n\t\t\tnewCol = len(maze[0]) - 1\n\t\t}\n\t}\n\n\t// If wall, then ignore movement\n\tif maze[newRow][newCol] == '#' {\n\t\tnewRow = oldRow\n\t\tnewCol = oldCol\n\t}\n\n\t// Can use fallthrough keyword to skip the implicit break in the switch statement\n\n\treturn\n}", "func (e *Element) move(offset mat.Vec, horizontal bool) mat.Vec {\n\toff := offset.Add(e.margin.Min).Add(e.Offest)\n\te.Frame = e.size.ToAABB().Moved(off)\n\toff.AddE(e.Padding.Min)\n\toOff := off\n\te.Module.OnFrameChange()\n\te.forChild(FCfg{\n\t\tFilter: IgnoreHidden.Filter,\n\t\tReverse: !e.Horizontal(),\n\t}, func(ch *Element) {\n\t\tif ch.Relative {\n\t\t\tch.move(oOff, false)\n\t\t} else {\n\t\t\toff = ch.move(off, e.Horizontal())\n\t\t}\n\n\t})\n\n\tif horizontal {\n\t\tl, _, r, _ := e.margin.Deco()\n\t\toffset.X += l + r + e.Frame.W()\n\t} else {\n\t\t_, b, _, t := e.margin.Deco()\n\t\toffset.Y += b + t + e.Frame.H()\n\t}\n\n\treturn offset\n}", "func (self Path) Move(path string) error {\n\tif info, err := os.Stat(path); err != nil {\n\t\treturn err\n\t} else {\n\t\tself.Create()\n\t\treturn self.Remove()\n\t}\n}", "func (board *Board) Move(direction string) *Board {\n\tswitch direction {\n\tcase UP:\n\t\treturn board.Up()\n\tcase DOWN:\n\t\treturn board.Down()\n\tcase LEFT:\n\t\treturn board.Left()\n\tcase RIGHT:\n\t\treturn board.Right()\n\t}\n\treturn nil\n}", "func NewMoveDirectoryParams() *MoveDirectoryParams {\n\tvar ()\n\treturn &MoveDirectoryParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (s *Sprite) Move(dx, dy int) DrawingBuilder {\n\tif s.op == nil {\n\t\ts.err = errors.New(\"add a &ebiten.DrawImageOptions{} to s.op\")\n\t\treturn s\n\t}\n\ts.op.GeoM.Translate(float64(s.x+dx), float64(s.y+dy))\n\treturn s\n}", "func NewMoveOption() *MoveOptions {\n\treturn &MoveOptions{}\n}", "func (dwr *DifferentialWheeledRobot) RollPosition(distLeft, distRight float64, prev Position) Position {\n\n\t// Straight line\n\tif distLeft == distRight {\n\t\treturn Position{\n\t\t\tprev.X + distLeft*math.Cos(prev.Theta),\n\t\t\tprev.Y + distLeft*math.Sin(prev.Theta),\n\t\t\tprev.Theta,\n\t\t}\n\t}\n\n\t// Turning\n\tturnRadius := dwr.BaseWidth * (distRight + distLeft) / (2 * (distRight - distLeft))\n\tangle := (distRight-distLeft)/dwr.BaseWidth + prev.Theta\n\treturn Position{\n\t\tprev.X + turnRadius*(math.Sin(angle)-math.Sin(prev.Theta)),\n\t\tprev.Y - turnRadius*(math.Cos(angle)-math.Cos(prev.Theta)),\n\t\tangle,\n\t}\n\n\t// s := (distLeft + distRight) / 2.0\n\t// theta := (distRight-distLeft)/dwr.BaseWidth + prev.Theta\n\t// x := s*math.Cos(theta) + prev.X\n\t// y := s*math.Sin(theta) + prev.Y\n\n\t// return Position{x, y, theta}\n\n}", "func (r Rectangle) Move(dx, dy int32) Rectangle {\n\treturn Rectangle{r.X + dx, r.Y + dy, r.Width, r.Height}\n}", "func nextMove(screen virtual_machine.Screen, p Point, last_move int) int {\n\tif !isWall(screen, move(toTheRight(last_move), p)) {\n\t\treturn toTheRight(last_move)\n\t} else if !isWall(screen, move(last_move, p)) {\n\t\treturn last_move\n\t} else if !isWall(screen, move(toTheLeft(last_move), p)) {\n\t\treturn toTheLeft(last_move)\n\t} else {\n\t\treturn toTheLeft(toTheLeft(last_move))\n\t}\n}", "func (m *Mob) handleMove(now int64) {\n\tnext := now + m.MoveInterval\n\n\tm.mutex.Lock()\n\tm.nextRun = next\n\tm.mutex.Unlock()\n\n\tpos := m.GetPosition()\n\n\tif !pos.IsMoving {\n\t\tif !m.findNewPath(&pos) {\n\t\t\tm.SetState(MobStateFind)\n\t\t\treturn\n\t\t}\n\n\t\tpath, distance := m.findMovePath(&pos)\n\t\tif distance == 0 {\n\t\t\tm.SetState(MobStateFind)\n\t\t\treturn\n\t\t}\n\n\t\tstart := path[int(distance)].(WayPoint)\n\t\tend := path[0].(WayPoint)\n\n\t\tpos.WayPoints = pos.WayPoints[:0]\n\t\tpos.WayPoints = append(pos.WayPoints, start, end)\n\t\tpos.CurrentWayPoint = 0\n\t\tpos.Speed = m.MoveSpeed\n\n\t\tOpenDeadReckoning(&pos)\n\t\tm.SetPosition(&pos)\n\n\t\tcolumn, row := m.cell.GetId()\n\n\t\tpkt := packet.MobMoveBegin(m)\n\t\tm.world.BroadcastPacket(column, row, pkt)\n\t\treturn\n\t}\n\n\tif pos.CurrentX == pos.FinalX && pos.CurrentY == pos.FinalY {\n\t\tpos.IsDeadReckoning = false\n\t} else {\n\t\tDeadReckoning(&pos)\n\t\tm.SetPosition(&pos)\n\t\tm.adjustCell(&pos)\n\t}\n\n\tif pos.IsDeadReckoning {\n\t\tm.SetPosition(&pos)\n\t\treturn\n\t}\n\n\tpos.InitialX = pos.FinalX\n\tpos.InitialY = pos.FinalY\n\tpos.IsMoving = false\n\n\tm.SetPosition(&pos)\n\n\tcolumn, row := m.cell.GetId()\n\n\tpkt := packet.MobMoveEnd(m)\n\tm.world.BroadcastPacket(column, row, pkt)\n\n\tm.SetState(MobStateFind)\n}", "func (w *Window) Move(x, y float64) {\n\tif err := driver.macRPC.Call(\"windows.Move\", nil, struct {\n\t\tID string\n\t\tX float64\n\t\tY float64\n\t}{\n\t\tID: w.ID().String(),\n\t\tX: x,\n\t\tY: y,\n\t}); err != nil {\n\t\tpanic(err)\n\t}\n}", "func (v Data) Move(old, new int) {\n\tif old == new {\n\t\treturn // well\n\t}\n\n\tshifting := -1\n\to, n := old, new\n\tif old > new {\n\t\tshifting = 1\n\t\told, new = new+1, old+1\n\t}\n\n\tcell := v[o]\n\tcopy(v[old:new], v[old-shifting:new-shifting])\n\tv[n] = cell\n}", "func NewMoving(x, y, w, h float64, r render.Renderable, tree *collision.Tree, cid event.CID, friction float64) *Moving {\n\tm := Moving{}\n\tcid = cid.Parse(&m)\n\tm.Solid = *NewSolid(x, y, w, h, r, tree, cid)\n\tm.vMoving = vMoving{\n\t\tDelta: physics.NewVector(0, 0),\n\t\tSpeed: physics.NewVector(0, 0),\n\t\tFriction: friction,\n\t}\n\treturn &m\n}", "func getMoveDirection(from, to *point) int {\n\tif from.x == to.x && from.y == to.y+1 {\n\t\treturn 1\n\t} else if from.x == to.x && from.y == to.y-1 {\n\t\treturn 2\n\t} else if from.x == to.x+1 && from.y == to.y {\n\t\treturn 3\n\t} else if from.x == to.x-1 && from.y == to.y {\n\t\treturn 4\n\t} else {\n\t\tlog.Fatalf(\"Points %v and %v are not adjacent\\n\", from, to)\n\t}\n\treturn 0\n}", "func (p *player) move(grid [][]rune) {\r\n\tdir := \"?\"\r\n\tswitch p.Dir {\r\n\tcase dirLeft:\r\n\t\tdir = \"LEFT\"\r\n\t\tp.Col = p.Col - 1\r\n\t\tnextSpace := grid[p.Row][p.Col]\r\n\t\tif nextSpace == '/' {\r\n\t\t\tp.Dir = dirDown\r\n\t\t} else if nextSpace == '\\\\' {\r\n\t\t\tp.Dir = dirUp\r\n\t\t} else if nextSpace == '+' {\r\n\t\t\tswitch p.Xing {\r\n\t\t\tcase 0:\r\n\t\t\t\tp.Dir = dirDown\r\n\t\t\t\tbreak\r\n\t\t\tcase 2:\r\n\t\t\t\tp.Dir = dirUp\r\n\t\t\t\tbreak\r\n\t\t\t}\r\n\t\t\tp.Xing = ((p.Xing + 1) % 3)\r\n\t\t}\r\n\t\tbreak\r\n\tcase dirRight:\r\n\t\tdir = \"RIGHT\"\r\n\t\tp.Col = p.Col + 1\r\n\t\tnextSpace := grid[p.Row][p.Col]\r\n\t\tif nextSpace == '/' {\r\n\t\t\tp.Dir = dirUp\r\n\t\t} else if nextSpace == '\\\\' {\r\n\t\t\tp.Dir = dirDown\r\n\t\t} else if nextSpace == '+' {\r\n\t\t\tswitch p.Xing {\r\n\t\t\tcase 0:\r\n\t\t\t\tp.Dir = dirUp\r\n\t\t\t\tbreak\r\n\t\t\tcase 2:\r\n\t\t\t\tp.Dir = dirDown\r\n\t\t\t\tbreak\r\n\t\t\t}\r\n\t\t\tp.Xing = ((p.Xing + 1) % 3)\r\n\t\t}\r\n\t\tbreak\r\n\tcase dirUp:\r\n\t\tdir = \"UP\"\r\n\t\tp.Row = p.Row - 1\r\n\t\tnextSpace := grid[p.Row][p.Col]\r\n\t\tif nextSpace == '/' {\r\n\t\t\tp.Dir = dirRight\r\n\t\t} else if nextSpace == '\\\\' {\r\n\t\t\tp.Dir = dirLeft\r\n\t\t} else if nextSpace == '+' {\r\n\t\t\tswitch p.Xing {\r\n\t\t\tcase 0:\r\n\t\t\t\tp.Dir = dirLeft\r\n\t\t\t\tbreak\r\n\t\t\tcase 2:\r\n\t\t\t\tp.Dir = dirRight\r\n\t\t\t\tbreak\r\n\t\t\t}\r\n\t\t\tp.Xing = ((p.Xing + 1) % 3)\r\n\t\t}\r\n\t\tbreak\r\n\tcase dirDown:\r\n\t\tdir = \"DOWN\"\r\n\t\tp.Row = p.Row + 1\r\n\t\tnextSpace := grid[p.Row][p.Col]\r\n\t\tif nextSpace == '/' {\r\n\t\t\tp.Dir = dirLeft\r\n\t\t} else if nextSpace == '\\\\' {\r\n\t\t\tp.Dir = dirRight\r\n\t\t} else if nextSpace == '+' {\r\n\t\t\tswitch p.Xing {\r\n\t\t\tcase 0:\r\n\t\t\t\tp.Dir = dirRight\r\n\t\t\t\tbreak\r\n\t\t\tcase 2:\r\n\t\t\t\tp.Dir = dirLeft\r\n\t\t\t\tbreak\r\n\t\t\t}\r\n\t\t\tp.Xing = ((p.Xing + 1) % 3)\r\n\t\t}\r\n\t\tbreak\r\n\t}\r\n\tfmt.Printf(\"Player %d moved %s to %d, %d\\n\", p.ID, dir, p.Col, p.Row)\r\n}", "func (e *Entry) Move(newfrag int, flags RenameFlags) error {\n\tfcode := C.CString(e.name)\n\tdefer C.free(unsafe.Pointer(fcode))\n\tcidx := C.int(newfrag)\n\tresult := C.gd_move(e.df.d, fcode, cidx, C.uint(flags))\n\tif result < 0 {\n\t\treturn e.df.Error()\n\t}\n\te.fragment = newfrag\n\treturn nil\n}", "func (t *SimpleChaincode) movePoint(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tif len(args) != 5 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 5\")\n\t}\n\n\tvar transaction MoveInf\n\tvar err error\n\ttransaction.Admin2 = args[0]\n\ttransaction.Student2 = args[1]\n\ttransaction.Password = args[3]\n\ttransaction.Message = args[4]\n\taccountPassword := args[3]\n\t//transaction.Point, err = strconv.Atoi(args[2])\n\n\t// ==== Check if Seller exists ====\n\tbytesAdmin, err := stub.GetState(transaction.Admin2)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to get Seller: \" + err.Error())\n\t}\n\tif bytesAdmin == nil {\n\t\treturn shim.Error(\"This Admin not exists: \")\n\t}\n\tvar admin Admin\n\n\terr = json.Unmarshal(bytesAdmin, &admin)\n\tif err != nil {\n\t\treturn shim.Error(\"{\\\"Result\\\":\\\"fail\\\",\\\"Message\\\":\\\"Fail to get Admin Account \\\"}\")\n\t}\n\tif admin.Password == accountPassword {\n\t\t// ==== Check if Student exists ====\n\t\tbytesStudent, err := stub.GetState(transaction.Student2)\n\t\tif err != nil {\n\t\t\treturn shim.Error(\"Failed to get Student: \" + err.Error())\n\t\t}\n\t\tif bytesStudent == nil {\n\t\t\treturn shim.Error(\"This Student not exists: \")\n\t\t}\n\t\tvar digitalStudent Student\n\t\terr = json.Unmarshal(bytesStudent, &digitalStudent)\n\t\tif err != nil {\n\t\t\treturn shim.Error(\"Failed to get Student: \" + err.Error())\n\t\t}\n\t\t// ==== Check if Point is a integer ====\n\n\t\t// ==== Move Action ====\n\n\t\t//digitalStudent.Point = digitalStudent.Point + transaction.Point\n\n\t\tvar s int\n\t\ts1, err := strconv.Atoi(digitalStudent.Money)\n\t\ts2, err := strconv.Atoi(args[2])\n\t\ts = s1 + s2\n\t\tdigitalStudent.Money = strconv.Itoa(s) // must change into int????\n\n\t\tDigitalStudentBytes, _ := json.Marshal(digitalStudent)\n\t\terr = stub.PutState(transaction.Student2, []byte(DigitalStudentBytes))\n\t\tif err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\t\treturn shim.Success([]byte(\"{\\\"Result\\\":\\\"MovePointSuccess\\\",\\\"message\\\":{\" + args[4] + \"}}\"))\n\t}\n\treturn shim.Error(\"\\\"Result\\\":\\\"fail\\\",\\\"Message\\\":\\\"Incorrect password\\\"\")\n}", "func (p *Player) Move(loc *Location) {\n\tif loc.Id() != p.loc.Id() {\n\t\tlocks := []lock.IdLocker{p, loc, p.loc}\n\t\tlock.All(locks)\n\t\tdefer lock.UnlockAll(locks)\n\n\t\tp.loc.RemovePlayer(p)\n\t\tp.loc = loc\n\t\tloc.AddPlayer(p)\n\t}\n}", "func (tg *TurtleGraphics) getnewpos(angle, distance float64) Vector {\n\td2r := math.Pi / 180\n\top := math.Sin(angle*d2r) * distance\n\tad := math.Cos(angle*d2r) * distance\n\n\tnewp := Vector{op, ad}\n\n\tnewp.X += tg.Pos.X\n\tnewp.Y += tg.Pos.Y\n\n\treturn newp\n}", "func (m *Mob) findMovePath(pos *context.Position) ([]astar.Pather, float64) {\n\tstart := WayPoint{\n\t\tX: pos.InitialX,\n\t\tY: pos.InitialY,\n\t\tworld: m.world,\n\t}\n\n\tend := WayPoint{\n\t\tX: pos.FinalX,\n\t\tY: pos.FinalY,\n\t\tworld: m.world,\n\t}\n\n\tpath, distance, _ := astar.Path(start, end)\n\n\treturn path, distance\n}", "func (ros RealOS) Move(src, dst string) error {\n\treturn os.Rename(src, dst)\n}", "func Move(x, y float32) {\n\tgContext.Cursor.X = x\n\tgContext.Cursor.Y = y\n}", "func (o *WObj) MoveBy(dx, dy float64) {\n\tif dx != 0 || dy != 0 {\n\t\tx := o.Hitbox.Min().X + dx\n\t\ty := o.Hitbox.Min().Y + dy\n\t\to.SetTopLeft(x, y)\n\t}\n}", "func (a *WalkAnimal) Move() string {\n\treturn strings.Join([]string{a.IAnimal.GetName(), \"moves by walk.\"}, \" \")\n}", "func translate_point_1(p Point, distance float64) {\n\tp.x += distance\n\tp.y += distance\n}", "func (m *move) Execute(cfg *config.Config, logger *log.Logger) error {\n\tlogger.Printf(\"Moving %s to %s\\n\", m.args[0], m.args[1])\n\n\tsourcePath := m.args[0]\n\tif expandedPath, err := pathutil.Expand(sourcePath); err == nil {\n\t\tsourcePath = expandedPath\n\t}\n\tdestinationPath := m.args[1]\n\tif expandedPath, err := pathutil.Expand(destinationPath); err == nil {\n\t\tdestinationPath = expandedPath\n\t}\n\n\tdestPathExists := pathutil.Exists(destinationPath)\n\tsrcIsDir, err := pathutil.IsDir(sourcePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdestIsDir, err := pathutil.IsDir(destinationPath)\n\tif err != nil && destPathExists {\n\t\treturn err\n\t}\n\n\tif destPathExists && destIsDir {\n\t\tbasename := filepath.Base(sourcePath)\n\t\treturn os.Rename(sourcePath, filepath.Join(destinationPath, basename))\n\t} else if destPathExists && !srcIsDir && !destIsDir {\n\t\treturn os.Rename(sourcePath, destinationPath)\n\t} else if destPathExists {\n\t\treturn fmt.Errorf(\"%s is a file which cannot be overwritten\", destinationPath)\n\t} else {\n\t\treturn os.Rename(sourcePath, destinationPath)\n\t}\n}", "func (d *driver) Move(ctx context.Context, sourcePath string, destPath string) error {\n\treturn d.Bucket.Move(ctx, sourcePath, destPath)\n}", "func (r *regulator) Move(ctx context.Context, sourcePath string, destPath string) error {\n\tr.enter()\n\tdefer r.exit()\n\n\treturn r.StorageDriver.Move(ctx, sourcePath, destPath)\n}", "func (p Point) Translate(dx, dy float64) Point {\n\treturn Point{p.X + dx, p.Y + dy}\n}", "func (ts *TravelState) Move() {\n\ta := rand.Intn(len(ts.state))\n\tb := rand.Intn(len(ts.state))\n\tts.state[a], ts.state[b] = ts.state[b], ts.state[a]\n}", "func (hc *Hailconfig) Move(oldAlias, newAlias string) error {\n\tif !hc.IsPresent(oldAlias) {\n\t\treturn errors.New(\"old alias is not present\")\n\t}\n\tif hc.IsPresent(newAlias) {\n\t\treturn errors.New(\"new alias is already present\")\n\t}\n\thc.Add(newAlias, hc.Scripts[oldAlias].Command, hc.Scripts[oldAlias].Description)\n\treturn hc.Delete(oldAlias)\n}", "func (elems *ElementsNR) move(from, to dvid.Point3d, deleteElement bool) (moved *ElementNR, changed bool) {\n\tfor i, elem := range *elems {\n\t\tif from.Equals(elem.Pos) {\n\t\t\tchanged = true\n\t\t\t(*elems)[i].Pos = to\n\t\t\tmoved = (*elems)[i].Copy()\n\t\t\tif deleteElement {\n\t\t\t\t(*elems)[i] = (*elems)[len(*elems)-1] // Delete without preserving order.\n\t\t\t\t*elems = (*elems)[:len(*elems)-1]\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func (a Animal) Move() {\n\tfmt.Println(a.locomotion)\n}", "func distance(point Point) (int) {\n\txDist := point.X\n\tyDist := point.Y\n\n\tif xDist < 0 {\n\t\txDist *= -1\n\t}\n\n\tif yDist < 0 {\n\t\tyDist *= -1\n\t}\n\n\treturn xDist + yDist\n}", "func (fs *EmbedFs) Move(from string, to string) error {\n\treturn ErrNotAvail\n}", "func (vr *vectorRenderer) MoveTo(x, y int) {\n\tvr.p = append(vr.p, fmt.Sprintf(\"M %d %d\", x, y))\n}", "func Position(r geom.Ray, distance float64) geom.Tuple4 {\n\tadd := geom.MultiplyByScalar(r.Direction, distance)\n\tpos := geom.Add(r.Origin, add)\n\treturn pos\n}", "func (cow Cow) Move() {\n\tfmt.Println(cow.locomotion)\n}", "func (chess *Chess) Move(san string) error {\n\tmove, err := chess.SANToMove(san)\n\tif err == nil {\n\t\tchess.makeMove(move)\n\t}\n\treturn err\n}", "func (s *swimmer) direction() int {\n\treturn s.moveDirection\n}", "func (d *droid) moveEveryDirection() {\n\tcurrStep := d.getMovementMapByPoint(d.location)\n\tmoveResult := d.move(1)\n\tif moveResult != 0 {\n\t\tif !d.hasVisitedCurrent() {\n\t\t\td.addStep(currStep)\n\t\t}\n\t\td.moveToPoint(currStep.location)\n\t}\n\tmoveResult = d.move(2)\n\tif moveResult != 0 {\n\t\tif !d.hasVisitedCurrent() {\n\t\t\td.addStep(currStep)\n\t\t}\n\t\td.moveToPoint(currStep.location)\n\t}\n\tmoveResult = d.move(3)\n\tif moveResult != 0 {\n\t\tif !d.hasVisitedCurrent() {\n\t\t\td.addStep(currStep)\n\t\t}\n\t\td.moveToPoint(currStep.location)\n\t}\n\tmoveResult = d.move(4)\n\tif moveResult != 0 {\n\t\tif !d.hasVisitedCurrent() {\n\t\t\td.addStep(currStep)\n\t\t}\n\t\td.moveToPoint(currStep.location)\n\t}\n}", "func (a *Animal) Move() string {\n\treturn \"Locomotion: \" + a.locomotion\n}", "func Move(game *chess.Game, lvl Level) (*chess.Move, error) {\n\tcmd := exec.Command(execPath)\n\tw, err := cmd.StdinPipe()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer w.Close()\n\tr, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer r.Close()\n\n\tscanner := bufio.NewScanner(r)\n\tch := make(chan *chess.Move)\n\tgo func() {\n\t\tfor scanner.Scan() {\n\t\t\ts := scanner.Text()\n\t\t\tfmt.Println(s)\n\t\t\tif strings.HasPrefix(s, \"bestmove\") {\n\t\t\t\tmoveTxt := parseOutput(s)\n\t\t\t\tch <- getMoveFromText(game, moveTxt)\n\t\t\t}\n\t\t}\n\t}()\n\tif err := cmd.Start(); err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := io.WriteString(w, fmt.Sprintf(\"setoption name Skill Level value %d\\n\", lvl)); err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := io.WriteString(w, fmt.Sprintf(\"position fen %s\\n\", game.Position().String())); err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := io.WriteString(w, \"go movetime 950\\n\"); err != nil {\n\t\treturn nil, err\n\t}\n\ttime.Sleep(time.Second)\n\tif _, err := io.WriteString(w, \"quit\\n\"); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := cmd.Wait(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn <-ch, nil\n}" ]
[ "0.67348295", "0.66218054", "0.6323302", "0.63009393", "0.61992556", "0.5959389", "0.5927495", "0.59226626", "0.59119165", "0.59011596", "0.5887739", "0.5831569", "0.5827473", "0.5818151", "0.5785061", "0.5772917", "0.5739919", "0.5737568", "0.5686841", "0.56842166", "0.5672908", "0.563404", "0.5629922", "0.5629906", "0.55468744", "0.5543407", "0.55344933", "0.5523739", "0.5486467", "0.54534346", "0.544808", "0.5445023", "0.54401696", "0.54318666", "0.5411926", "0.5403406", "0.5401208", "0.5392887", "0.53867894", "0.5378993", "0.53326684", "0.5299154", "0.5274481", "0.5272039", "0.5266176", "0.5260013", "0.52593184", "0.5257118", "0.5247331", "0.5236787", "0.5233461", "0.5227418", "0.52230227", "0.5206039", "0.5195471", "0.51917875", "0.51759434", "0.5140499", "0.5139834", "0.5124862", "0.511326", "0.5101773", "0.50837356", "0.5061206", "0.5060285", "0.5060011", "0.5043336", "0.5033822", "0.5030271", "0.50285506", "0.50243384", "0.5001481", "0.49890214", "0.4982836", "0.49803925", "0.49668178", "0.49624717", "0.49609303", "0.4947939", "0.49395084", "0.49263278", "0.49232966", "0.49231026", "0.4915219", "0.4911504", "0.4906514", "0.48971182", "0.48891917", "0.48863062", "0.4879053", "0.48733336", "0.4872653", "0.48610815", "0.48585734", "0.48569176", "0.4853567", "0.48478496", "0.48377174", "0.48266345", "0.4814222" ]
0.83701855
0
abs returns the absolute value of i.
abs возвращает абсолютное значение i.
func abs(i int) int { if i < 0 { return -i } return i }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func absInt(i int) int {\n\tif i > 0 {\n\t\treturn i\n\t}\n\treturn i * -1\n}", "func Iabs(a int) int {\n\tif a < 0 {\n\t\treturn -a\n\t}\n\treturn a\n}", "func iAbs(x int) int { if x >= 0 { return x } else { return -x } }", "func abs(val int) int {\n\tif val < 0 {\n\t\treturn -val\n\t}\n\treturn val\n}", "func abs(v int) int {\n\tif v < 0 {\n\t\treturn -v\n\t}\n\treturn v\n}", "func abs(a int) int {\n\tif a < 0 {\n\t\treturn -a\n\t}\n\treturn a\n}", "func abs(a int) int {\n\tif a < 0 {\n\t\treturn -a\n\t}\n\treturn a\n}", "func abs(n int) int {\n\tif n < 0 {\n\t\treturn -n\n\t}\n\treturn n\n}", "func (bi Int) Abs() Int {\n\tif bi.GreaterThanEqual(Zero()) {\n\t\treturn bi.Copy()\n\t}\n\treturn bi.Neg()\n}", "func IAbs(n int) int {\n\tif n < 0 {\n\t\treturn -n\n\t}\n\tif n == 0 {\n\t\treturn 0\n\t}\n\treturn n\n}", "func (i *Number) Absolute() *Number {\n\treturn NewNumber(math.Abs(i.value))\n}", "func abs(n int) int {\n\tif n >= 0 {\n\t\treturn n\n\t}\n\treturn -1 * n\n}", "func (i I) Abs() I {\n\tif i.X < 0 {\n\t\ti.X = -i.X\n\t}\n\tif i.Y < 0 {\n\t\ti.Y = -i.Y\n\t}\n\treturn i\n}", "func abs(x int) int {\r\n\tif x < 0 {\r\n\t\treturn -x\r\n\t}\r\n\treturn x\r\n}", "func abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(x int) int {\n\tif x < 0{\n\t\treturn -x\n\t}\n\treturn x\n}", "func absInt(v int) int {\n\tif v < 0 {\n\t\treturn -v\n\t}\n\treturn v\n}", "func IntAbs(a int) int {\n\tif a < 0 {\n\t\treturn -a\n\t}\n\treturn a\n}", "func abs(n int) int {\n if n < 0 {\n return -n\n }\n return n\n}", "func abs(num int64) int64 {\n\tif num < 0 {\n\t\treturn -num\n\t}\n\treturn num\n}", "func abs(a int) int {\r\n if a < 0 {\r\n return -a\r\n }\r\n return a\r\n}", "func abs(n int) int {\n if n > 0 {\n return n\n }\n\n return -n\n}", "func abs(x int64) int64 {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(x int64) int64 {\n\tif x >= 0 {\n\t\treturn x\n\t}\n\treturn -x\n}", "func Absolute(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(a int) int {\n\tif a > 0 {\n\t\treturn a\n\t}\n\treturn -a\n}", "func Abs(a int) int {\n\tif a > 0 {\n\t\treturn a\n\t}\n\treturn -a\n}", "func Abs(a int) int {\n\tif a > 0 {\n\t\treturn a\n\t}\n\treturn -a\n}", "func (z *Int) Abs() *Int {\n\tif z.Lt(SignedMin) {\n\t\treturn z\n\t}\n\tz.Sub(zero, z)\n\treturn z\n}", "func Abs(a int) int {\n\tif a < 0 {\n\t\treturn -a\n\t}\n\treturn a\n}", "func IntAbs(x int) int {\n\tif x > 0 {\n\t\treturn x\n\t}\n\n\treturn -x\n}", "func intAbs(n int64) int64 {\n\treturn int64(math.Abs(float64(n)))\n}", "func absInt(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(n int64) int64 {\n\treturn int64(math.Abs(float64(n)))\n}", "func (i Instruction) ToAbsolute() Instruction {\n\treturn i & 0xdf\n}", "func (m mathUtil) AbsInt(value int) int {\n\tif value < 0 {\n\t\treturn -value\n\t}\n\treturn value\n}", "func abs(n int32) int32 {\n\tif n < 0 {\n\t\treturn -n\n\t}\n\treturn n\n}", "func Abs(a int) int {\n\treturn neogointernal.Opcode1(\"ABS\", a).(int)\n}", "func getAbsoluteValue(value int) int {\n\tif value < 0 {\n\t\treturn -value\n\t}\n\treturn value\n}", "func Abs(v int) int {\n\tif v > 0 {\n\t\treturn v\n\t}\n\treturn -v\n}", "func abs(n int) int {\n\ty := n >> 31\n\treturn (n ^ y) - y\n}", "func Abs(operand int) int {\n\tif operand < 0 {\n\t\treturn operand * -1\n\t}\n\treturn operand\n}", "func Abs(n int) int {\n\tif n < 0 {\n\t\treturn -n\n\t}\n\treturn n\n}", "func Abs(n int) int {\n\tif n < 0 {\n\t\treturn -n\n\t}\n\treturn n\n}", "func Abs(n int) int {\n\tif n < 0 {\n\t\treturn -n\n\t}\n\treturn n\n}", "func Abs(n int) int {\n\tif n < 0 {\n\t\treturn -n\n\t}\n\treturn n\n}", "func Abs(n int) int {\n\tif n < 0 {\n\t\treturn -n\n\t}\n\treturn n\n}", "func Absolute(num cty.Value) (cty.Value, error) {\n\treturn AbsoluteFunc.Call([]cty.Value{num})\n}", "func getAbs(a int) int {\n if a < 0 {\n return -a\n }\n return a\n}", "func AbsInt(a int) int {\n\tif a < 0 {\n\t\treturn -a\n\t}\n\treturn a\n}", "func Abs(n int) int {\n\tif n >= 0 {\n\t\treturn n\n\t}\n\treturn -n\n}", "func Abs(number int) int {\n\tif number > 0 {\n\t\treturn number\n\t}\n\treturn -number\n}", "func AbsInt(a int) int {\n\tif a < 0 {\n\t\treturn -1 * a\n\t} else {\n\t\treturn a\n\t}\n}", "func Abs(b int) int {\n\tif b < 0 {\n\t\treturn -b\n\t}\n\n\treturn b\n}", "func (z *Int) Abs(x *Int) *Int {}", "func AbsInt(v int) int {\n\tif v < 0 {\n\t\treturn -v\n\t}\n\treturn v\n}", "func Abs(num int) int{\n\tif num > 0{\n\t\treturn num\n\t}\n\treturn (-1)*num\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func Abs(x int) int {\n\tif x > 0 {\n\t\treturn x\n\t}\n\treturn -x\n}", "func abs(x int32) int32 {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func abs(slice []float64) []float64 {\n\tvar newSlice []float64\n\tfor _, value := range slice {\n\t\tif value < 0.0 {\n\t\t\tvalue = math.Abs(value)\n\t\t}\n\t\tnewSlice = append(newSlice, value)\n\t}\n\treturn newSlice\n}", "func AbsInt(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func AbsInt(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func (cf customFloat) abs() customFloat {\n\tif cf < 0 {\n\t\treturn cf * -1\n\t}\n\treturn cf\n}", "func absValueIf(v int64, absolute bool) int64 {\n\tif absolute && v < 0 {\n\t\tv = -v\n\t}\n\treturn v\n}", "func PrintAbs(v Abser) {\n\ta := v.Abs()\n\tfmt.Println(a)\n}", "func abs(in []complex128, out []complex128) {\n\tfor i := range in {\n\t\tout[i] = complex(cmplx.Abs(in[i]), 0)\n\t}\n}", "func AbsInt(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t} else {\n\t\treturn x\n\t}\n}", "func Abs(z, x *big.Int) *big.Int {\n\treturn z.Abs(x)\n}", "func Abs(n int) int {\n if n < 0 {\n return -n\n }\n return n\n}", "func goAbs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}", "func (f *Float) Abs(x *Float) *Float {\n\tx.doinit()\n\tf.doinit()\n\tC.mpf_abs(&f.i[0], &x.i[0])\n\treturn f\n}", "func Abs(in Res) Res {\n\tsign := in.Output().Copy()\n\tanyvec.GreaterThan(sign, sign.Creator().MakeNumeric(0))\n\tsign.Scale(sign.Creator().MakeNumeric(2))\n\tsign.AddScalar(sign.Creator().MakeNumeric(-1))\n\treturn Mul(in, NewConst(sign))\n}", "func IntAbs(z *big.Int, x *big.Int,) *big.Int", "func opI64Abs(expr *CXExpression, fp int) {\n\tinpV0 := ReadI64(fp, expr.Inputs[0])\n\tsign := inpV0 >> 63\n\toutB0 := (inpV0 ^ sign) - sign\n\tWriteI64(GetOffset_i64(fp, expr.Outputs[0]), outB0)\n}", "func Abs(x float64) float64 {\n\tif x < 0 {\n\t\tx = -x\n\t}\n\treturn x\n}", "func opI16Abs(expr *CXExpression, fp int) {\n\tV0 := ReadI16(fp, expr.Inputs[0])\n\tsign := V0 >> 15\n\toutB0 := (V0 ^ sign) - sign\n\tWriteI16(GetOffset_i16(fp, expr.Outputs[0]), outB0)\n}", "func Abs(a *big.Float) *big.Float {\n\treturn ZeroBigFloat().Abs(a)\n}", "func (self *State)Abs(a any)any{\n self.IncOperations(self.coeff[\"abs\"]+self.off[\"abs\"])\n return wrap1(a,math.Abs)\n}", "func Abs(x float64) float64 {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\tif x == 0 {\n\t\treturn 0 // return correctly abs(-0)\n\t}\n\treturn x\n}", "func Abs(x int) int {\n if x < 0 {\n return -x\n }\n return x\n}", "func funcAbs(vals []parser.Value, args parser.Expressions, enh *EvalNodeHelper) Vector {\n\treturn simpleFunc(vals, enh, math.Abs)\n}", "func Abs(arg float64) float64 {\n\treturn math.Abs(arg)\n}", "func mathAbs(ctx phpv.Context, args []*phpv.ZVal) (*phpv.ZVal, error) {\n\tvar z *phpv.ZVal\n\t_, err := core.Expand(ctx, args, &z)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tz, err = z.AsNumeric(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch z.GetType() {\n\tcase phpv.ZtInt:\n\t\ti := z.AsInt(ctx)\n\t\tif i < 0 {\n\t\t\treturn (-i).ZVal(), nil\n\t\t} else {\n\t\t\treturn i.ZVal(), nil\n\t\t}\n\tcase phpv.ZtFloat:\n\t\treturn phpv.ZFloat(math.Abs(float64(z.AsFloat(ctx)))).ZVal(), nil\n\tdefault:\n\t\treturn phpv.ZNull{}.ZVal(), nil\n\t}\n}", "func (v *V) MaxAbs() (f float64, idx int) {\n\tif v.IsNaV() {\n\t\tpanic(ErrNaV)\n\t}\n\tf = NaN()\n\tidx = -1\n\tfor i, e := range v.Data {\n\t\tabs := math.Abs(e)\n\t\tif abs > f || IsNaN(f) {\n\t\t\tf = abs\n\t\t\tidx = i\n\t\t}\n\t}\n\tif IsNaN(f) {\n\t\tidx = -1\n\t\treturn\n\t}\n\treturn f, idx\n}", "func (m *MockFinder) Abs(v []byte) []byte {\n\treturn m.fnd.Abs(v)\n}", "func (v Vector) MaxAbs() float64 {\n\tvar res float64\n\tfor _, x := range v {\n\t\tres = math.Max(res, math.Abs(x))\n\t}\n\treturn res\n}", "func absolute(x int32) int32 {\n\tmask := x >> 31\n\treturn (x + mask) ^ mask\n}", "func (fn *formulaFuncs) ABS(argsList *list.List) formulaArg {\n\tif argsList.Len() != 1 {\n\t\treturn newErrorFormulaArg(formulaErrorVALUE, \"ABS requires 1 numeric argument\")\n\t}\n\targ := argsList.Front().Value.(formulaArg).ToNumber()\n\tif arg.Type == ArgError {\n\t\treturn arg\n\t}\n\treturn newNumberFormulaArg(math.Abs(arg.Number))\n}", "func Abs(x int32) int32 {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}" ]
[ "0.79870635", "0.7803045", "0.77631706", "0.7357731", "0.73555064", "0.7263729", "0.7263729", "0.7168951", "0.7148395", "0.71423554", "0.71259594", "0.7081049", "0.7076965", "0.70459354", "0.7041281", "0.7041281", "0.7041281", "0.7021915", "0.69966334", "0.69423425", "0.6911024", "0.6907641", "0.69048303", "0.6882799", "0.67948824", "0.6784397", "0.67615515", "0.67409915", "0.67409915", "0.67409915", "0.67323726", "0.6728746", "0.6728441", "0.6727615", "0.66721475", "0.666987", "0.66554683", "0.6650624", "0.66506034", "0.659721", "0.6593671", "0.6588123", "0.6578961", "0.6569658", "0.65568393", "0.65568393", "0.65568393", "0.65568393", "0.65568393", "0.65366125", "0.6531973", "0.65310323", "0.6525651", "0.65246284", "0.65195113", "0.6512692", "0.64732796", "0.647254", "0.6462355", "0.64242405", "0.64242405", "0.64242405", "0.64242405", "0.64242405", "0.64242405", "0.64242405", "0.64242405", "0.6422998", "0.6369103", "0.6304846", "0.6250863", "0.6250863", "0.62449324", "0.6244077", "0.62193584", "0.6205013", "0.6200891", "0.61909056", "0.6189972", "0.61738056", "0.6153702", "0.61136216", "0.60702395", "0.6059942", "0.6014051", "0.6011109", "0.5987813", "0.598776", "0.598516", "0.59811693", "0.59741807", "0.59519", "0.5949076", "0.59489733", "0.59460557", "0.591124", "0.58813643", "0.5880957", "0.58705956" ]
0.8626241
1
inRange returns whether true if a >= val = val <= a.
inRange возвращает true, если a >= val и val <= a.
func inRange(val, a, b int) bool { return val >= a && val <= b || val >= b && val <= a }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func InRange(val, min, max float64) float64 {\n\tif val < min {\n\t\treturn min\n\t} else if val > max {\n\t\treturn max\n\t}\n\treturn val\n}", "func InRange(value, left, right float64) bool {\n\tif left > right {\n\t\tleft, right = right, left\n\t}\n\treturn value >= left && value <= right\n}", "func within(value, low, high int) bool {\n\treturn value >= low && value <= high\n}", "func ValueIsInRange(candidate int, lowerBound int, upperBound int) bool {\n\treturn lowerBound <= candidate && candidate < upperBound\n}", "func inRange(r ipRange, ipAddress net.IP) bool {\n\t// strcmp type byte comparison\n\tif bytes.Compare(ipAddress, r.start) >= 0 && bytes.Compare(ipAddress, r.end) < 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "func InRange(n int, r []int) bool {\n\treturn len(r) == 2 && (r[0] <= n && n <= r[1])\n}", "func (p Point) In(rg Range) bool {\n\treturn p.X >= rg.Min.X && p.X < rg.Max.X && p.Y >= rg.Min.Y && p.Y < rg.Max.Y\n}", "func (i *Number) IsInRange(start, end Number) bool {\n\treturn i.value <= end.value && i.value >= start.value\n}", "func (v *intChain) IsInRange(min, max int) IntChainer {\n f := func() bool {\n if min > max || min == max {\n return false\n }\n if v.Num >= min && v.Num <= max {\n return true\n }\n \n return false\n }\n v.chains = append(v.chains, f)\n\n return v\n}", "func (s StatusCode) In(r StatusCodeRange) bool {\n\treturn r.Min <= s && s <= r.Max\n}", "func inRangeEntries(v int, entries []*RangeEntry) bool {\n\tfor _, re := range entries {\n\t\tif re.StartVendorID <= v && v <= re.EndVendorID {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func between(start, elt, end *big.Int, inclusive bool) bool {\n\tif end.Cmp(start) > 0 {\n\t\treturn (start.Cmp(elt) < 0 && elt.Cmp(end) < 0) || (inclusive && elt.Cmp(end) == 0)\n\t}\n\treturn start.Cmp(elt) < 0 || elt.Cmp(end) < 0 || (inclusive && elt.Cmp(end) == 0)\n}", "func (c *capacity) isInRange(y resource.Quantity) bool {\n\tif c.lower.IsZero() && c.upper.Cmp(y) >= 0 {\n\t\t// [0, a] y\n\t\treturn true\n\t}\n\tif c.upper.IsZero() && c.lower.Cmp(y) <= 0 {\n\t\t// [b, 0] y\n\t\treturn true\n\t}\n\tif !c.lower.IsZero() && !c.upper.IsZero() {\n\t\t// [a, b] y\n\t\treturn c.lower.Cmp(y) <= 0 && c.upper.Cmp(y) >= 0\n\t}\n\treturn false\n}", "func (r *Range) Contains(num int64) bool {\n\treturn num >= r.Min && num <= r.Max\n}", "func inRange(point *geo.Point, req *geo.Request) bool {\n\tleft := math.Min(float64(req.Lo.Longitude), float64(req.Hi.Longitude))\n\tright := math.Max(float64(req.Lo.Longitude), float64(req.Hi.Longitude))\n\ttop := math.Max(float64(req.Lo.Latitude), float64(req.Hi.Latitude))\n\tbottom := math.Min(float64(req.Lo.Latitude), float64(req.Hi.Latitude))\n\n\tif float64(point.Longitude) >= left &&\n\t\tfloat64(point.Longitude) <= right &&\n\t\tfloat64(point.Latitude) >= bottom &&\n\t\tfloat64(point.Latitude) <= top {\n\t\treturn true\n\t}\n\treturn false\n}", "func (r Range) ContainsRange(r1 Range) bool {\n\treturn r1[0] >= r[0] && r1[1] <= r[1]\n}", "func BetweenIn(x float64, a, b float64) bool {\n\tmin, max := math.Min(a, b), math.Max(a, b)\n\treturn min <= a && a <= max\n}", "func InRangeInt(val, min, max int) int {\n\tif val < min {\n\t\treturn min\n\t} else if val > max {\n\t\treturn max\n\t}\n\treturn val\n}", "func InRange(tf *token.File, pos token.Pos) bool {\n\tsize := tf.Pos(tf.Size())\n\treturn int(pos) >= tf.Base() && pos <= size\n}", "func inRange(key, left, right, max uint64) bool {\n\tcurrent := left\n\n\tfor ; current != right; current = (current + 1) % max {\n\t\tif current == key {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (self *CircularTrack) InRange(l, r float64) bool {\n\treturn l < r\n}", "func (v Vec2) In(lo, hi Vec2) bool {\n\treturn lo[0] <= v[0] && lo[1] <= v[1] && v[0] < hi[0] && v[1] < hi[1]\n}", "func (r *Range) CheckInRange(val float64) bool {\n\tif val >= r.minVal && val <= r.maxVal {\n\t\treturn true\n\t}\n\treturn false\n}", "func (rg Range) In(r Range) bool {\n\treturn rg.Intersect(r) == rg\n}", "func (dt *DateTime) InRange(min, max time.Time) *DateTime {\n\topChain := dt.chain.enter(\"InRange()\")\n\tdefer opChain.leave()\n\n\tif opChain.failed() {\n\t\treturn dt\n\t}\n\n\tif !((dt.value.After(min) || dt.value.Equal(min)) &&\n\t\t(dt.value.Before(max) || dt.value.Equal(max))) {\n\t\topChain.fail(AssertionFailure{\n\t\t\tType: AssertInRange,\n\t\t\tActual: &AssertionValue{dt.value},\n\t\t\tExpected: &AssertionValue{AssertionRange{min, max}},\n\t\t\tErrors: []error{\n\t\t\t\terrors.New(\"expected: time point is within given range\"),\n\t\t\t},\n\t\t})\n\t}\n\n\treturn dt\n}", "func (r Range) Contains(v T) bool {\n\treturn r.Max >= v && r.Min <= v\n}", "func (fr *FileRing) InRange(x int64) bool {\n\tfr.lock.RLock()\n\tdefer fr.lock.RUnlock()\n\treturn InRange(x, fr.start, fr.end, M)\n}", "func (su *SliceNumber) InRange() error {\n\tvar si interface{}\n\n\tswitch {\n\tcase len(su.Uint) > 0:\n\t\tsi = su.Uint\n\tcase len(su.Uint16) > 0:\n\t\tsi = su.Uint16\n\tcase len(su.Uint32) > 0:\n\t\tsi = su.Uint32\n\tcase len(su.Uint64) > 0:\n\t\tsi = su.Uint64\n\tcase len(su.Int) > 0:\n\t\tsi = su.Int\n\tcase len(su.Int16) > 0:\n\t\tsi = su.Int16\n\tcase len(su.Int32) > 0:\n\t\tsi = su.Int32\n\tcase len(su.Int64) > 0:\n\t\tsi = su.Int64\n\t}\n\n\tif !su.IsSorted {\n\t\tsu.Sort(false)\n\t\treturn su.InRange()\n\t}\n\n\terr := su.SliceRange.Range(si)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func RangeIn(low, hi int) int {\n\trand.Seed(time.Now().UnixNano())\n\treturn low + rand.Intn(hi-low)\n}", "func fieldInRange(field int, min, max int) bool {\n\treturn (min <= field) && (field <= max)\n}", "func (ggt Globegridtile) ContainsRange(gp Gridpoint, dist float64) bool {\n\ttop := gp.MoveTo(0, dist)\n\tright := gp.MoveTo(90, dist)\n\tbottom := gp.MoveTo(180, dist)\n\tleft := gp.MoveTo(270, dist)\n\n\treturn ggt.ContainsLatLon(top.lat, top.lon) &&\n\t\tggt.ContainsLatLon(right.lat, right.lon) &&\n\t\tggt.ContainsLatLon(bottom.lat, bottom.lon) &&\n\t\tggt.ContainsLatLon(left.lat, left.lon)\n}", "func (p Point) In(r Rectangle) bool {\n\treturn p.X >= r.Min.X && p.X < r.Max.X &&\n\t\tp.Y >= r.Min.Y && p.Y < r.Max.Y\n}", "func (list *List) withinRange(index int) bool {\n\treturn index >= 0 && index < list.size\n}", "func (segment *Segment) isInSegment(value float64) bool {\n\treturn value >= segment.start && value <= segment.end\n}", "func (list *ArrayList) withinRange(index int) bool {\n\treturn index >= 0 && index < list.size\n}", "func RangeFromValIn(vs ...float64) predicate.Property {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Property(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldRangeFromVal), v...))\n\t})\n}", "func (p Point) In(r Rectangle) bool {\n\treturn r.Min.X <= p.X && p.X < r.Max.X &&\n\t\tr.Min.Y <= p.Y && p.Y < r.Max.Y\n}", "func (s Ranges) IsIn(index uint64) bool {\n\tfor _, r := range s {\n\t\tstartIdx := r.Offset\n\t\tendIdx := r.Offset + r.Length\n\t\t// `startIdx` is inclusive, while `endIdx` is exclusive.\n\t\t// The same as usual slice indices works:\n\t\t//\n\t\t// slice[startIdx:endIdx]\n\n\t\tif startIdx <= index && index < endIdx {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func within(p, q, r float64) bool {\n\treturn (p <= q) && (q <= r) || (r <= q) && (q <= p)\n}", "func (e Pos) In(r Rect) bool {\n\treturn r.Min.I <= e.I && e.I < r.Max.I && r.Min.J <= e.J && e.J < r.Max.J\n}", "func (r Rectangle) In(s Rectangle) bool {\n\tif r.Empty() {\n\t\treturn true\n\t}\n\t// Note that r.Max is an exclusive bound for r, so that r.In(s)\n\t// does not require that r.Max.In(s).\n\treturn s.Min.X <= r.Min.X && r.Max.X <= s.Max.X &&\n\t\ts.Min.Y <= r.Min.Y && r.Max.Y <= s.Max.Y\n}", "func InRange(format, version, versionRange string) (bool, error) {\n\tversionParser, exists := GetParser(format)\n\tif !exists {\n\t\treturn false, ErrUnknownVersionFormat\n\t}\n\n\tin, err := versionParser.InRange(version, versionRange)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\"Format\": format, \"Version\": version, \"Range\": versionRange}).Error(err)\n\t}\n\treturn in, err\n}", "func (r Range) ContainsRange(or Range) bool {\n\treturn r.Offset <= or.Offset && or.EndOffset <= r.EndOffset\n}", "func InRange32(val, min, max float32) float32 {\n\tif val < min {\n\t\treturn min\n\t} else if val > max {\n\t\treturn max\n\t}\n\treturn val\n}", "func Between(val any, min, max int64) bool {\n\tintVal, err := mathutil.Int64(val)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn intVal >= min && intVal <= max\n}", "func (x IntRange) ContainsIntRange(y IntRange) bool {\n\tif y.Empty() {\n\t\treturn true\n\t}\n\tif (x[0] != nil) && (y[0] == nil || x[0].Cmp(y[0]) > 0) {\n\t\treturn false\n\t}\n\tif (x[1] != nil) && (y[1] == nil || x[1].Cmp(y[1]) < 0) {\n\t\treturn false\n\t}\n\treturn true\n}", "func (r ranges) valid(num uint64) bool {\n\tfor _, currentRange := range r {\n\t\tif num <= currentRange.upper && num >= currentRange.lower {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (f *fragment) rangeBetween(bitDepth uint, predicateMin, predicateMax int64) (*Row, error) {\n\tb := f.row(bsiExistsBit)\n\n\t// Convert predicates to unsigned values.\n\tupredicateMin, upredicateMax := uint64(predicateMin), uint64(predicateMax)\n\tif predicateMin < 0 {\n\t\tupredicateMin = uint64(-predicateMin)\n\t}\n\tif predicateMax < 0 {\n\t\tupredicateMax = uint64(-predicateMax)\n\t}\n\n\t// Handle positive-only values.\n\tif predicateMin >= 0 {\n\t\treturn f.rangeBetweenUnsigned(b.Difference(f.row(bsiSignBit)), bitDepth, upredicateMin, upredicateMax)\n\t}\n\n\t// Handle negative-only values. Swap unsigned min/max predicates.\n\tif predicateMax < 0 {\n\t\treturn f.rangeBetweenUnsigned(b.Intersect(f.row(bsiSignBit)), bitDepth, upredicateMax, upredicateMin)\n\t}\n\n\t// If predicate crosses positive/negative boundary then handle separately and union.\n\tpos, err := f.rangeLTUnsigned(b.Difference(f.row(bsiSignBit)), bitDepth, upredicateMax, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tneg, err := f.rangeLTUnsigned(b.Intersect(f.row(bsiSignBit)), bitDepth, upredicateMin, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn pos.Union(neg), nil\n}", "func (day DayRange) within(other DayRange) bool {\n\tif day.Wday == other.Wday && day.StartsAt >= other.StartsAt && day.EndsAt <= other.EndsAt {\n\t\treturn true\n\t}\n\treturn false\n}", "func inBound(x int, y int, length int, width int) bool {\n\tif 0 <= x && x < length && y >= 0 && y < width {\n\t\treturn true\n\t}\n\treturn false\n}", "func RangeToValIn(vs ...float64) predicate.Property {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Property(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.In(s.C(FieldRangeToVal), v...))\n\t})\n}", "func (r Rectangle) In(r1 Rectangle) bool {\n\tif r.Empty() {\n\t\treturn true\n\t}\n\tif r1.Empty() {\n\t\treturn false\n\t}\n\treturn r1.Min.X <= r.Min.X && r.Max.X <= r1.Max.X &&\n\t\tr1.Min.Y <= r.Min.Y && r.Max.Y <= r1.Max.Y\n}", "func In(r rune, ranges ...*unicode.RangeTable,) bool", "func rangeCodeTest(val int) func(int) bool {\n\treturn func(code int) bool {\n\t\tdiff := code - val\n\t\treturn diff >= 0 && diff < 100\n\t}\n}", "func inBounds(row, column int) bool {\n\tif row < 0 || row >= rows {\n\t\treturn false\n\t}\n\tif column < 0 || column >= columns {\n\t\treturn false\n\t}\n\treturn true\n}", "func (r intRange) Include(n int) bool {\n\treturn r.min <= n && n <= r.max\n}", "func (s *BasePlSqlParserListener) EnterRange_values_clause(ctx *Range_values_clauseContext) {}", "func IsPartOfRange(r rune, rng []RuneRange) bool {\n\tfor _, v := range rng {\n\t\tif r >= v.Start && r <= v.End {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (a AddrRange) Contains(addr Address) bool {\n\treturn a.Start <= addr && addr < a.End\n}", "func Range(str string, params ...string) bool {\n\tif len(params) == 2 {\n\t\tvalue, _ := ToFloat(str)\n\t\tmin, _ := ToFloat(params[0])\n\t\tmax, _ := ToFloat(params[1])\n\t\treturn InRange(value, min, max)\n\t}\n\n\treturn false\n}", "func (list *DoublyLinkedList) inRange(index int) bool {\n\treturn index >= 0 && index < list.size && list.size != 0\n}", "func (r *Range) Contains(addr net.IP) bool {\n\tif err := canonicalizeIP(&addr); err != nil {\n\t\treturn false\n\t}\n\n\tsubnet := (net.IPNet)(r.Subnet)\n\n\t// Not the same address family\n\tif len(addr) != len(r.Subnet.IP) {\n\t\treturn false\n\t}\n\n\t// Not in network\n\tif !subnet.Contains(addr) {\n\t\treturn false\n\t}\n\n\t// We ignore nils here so we can use this function as we initialize the range.\n\tif r.RangeStart != nil {\n\t\t// Before the range start\n\t\tif ip.Cmp(addr, r.RangeStart) < 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif r.RangeEnd != nil {\n\t\tif ip.Cmp(addr, r.RangeEnd) > 0 {\n\t\t\t// After the range end\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func cgoInRange(p unsafe.Pointer, start, end uintptr) bool {\n\treturn start <= uintptr(p) && uintptr(p) < end\n}", "func (of *openFiles) InRange(fh uint64) bool {\n\treturn uint8(fh) == of.mark\n}", "func (l *IntList) Range(f func(value int) bool) {\n\tx := l.head.getNextNode()\n\tfor x != nil {\n\t\tif !f(x.value) {\n\t\t\tbreak\n\t\t}\n\t\tx = x.getNextNode()\n\t}\n}", "func (r Range) Contains(offset int) bool {\n\treturn r.Offset <= offset && offset <= r.EndOffset\n}", "func (v *ValueRange) HasLowerBound() bool {\n\treturn v.lowerEndPoint != nil\n}", "func (ggt Globegridtile) ContainedInRange(gp Gridpoint, dist float64) bool {\n\td1 := DistanceBetween(gp, NewGridpoint(\"tlc\", ggt.min_lat, ggt.min_lon))\n\td2 := DistanceBetween(gp, NewGridpoint(\"trc\", ggt.min_lat, ggt.max_lon))\n\td3 := DistanceBetween(gp, NewGridpoint(\"blc\", ggt.max_lat, ggt.min_lon))\n\td4 := DistanceBetween(gp, NewGridpoint(\"brc\", ggt.max_lat, ggt.max_lon))\n\n\treturn (d1 <= dist && d2 <= dist && d3 <= dist && d4 <= dist)\n}", "func outOfRange(sc *stmtctx.StatementContext, min, max, val *types.Datum) (int, error) {\n\tresult, err := val.CompareDatum(sc, min)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif result < 0 {\n\t\treturn result, nil\n\t}\n\tresult, err = val.CompareDatum(sc, max)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif result > 0 {\n\t\treturn result, nil\n\t}\n\treturn 0, nil\n}", "func Between(x float64, a, b float64) bool {\n\tmin, max := math.Min(a, b), math.Max(a, b)\n\treturn min < a && a < max\n}", "func (r *Request) inRange(host *Host, hosts []*Host) bool {\n\tcheck := false\n\n\tfor i := range hosts {\n\t\tif hosts[i].HostUrl == host.HostUrl {\n\t\t\tcheck = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn check\n}", "func (ggt Globegridtile) IntersectsRange(gp Gridpoint, dist float64) bool {\n\t// First easy bit, if the gp is inside the ggt...\n\tif ggt.ContainsLatLon(gp.lat, gp.lon) {\n\t\treturn true\n\t}\n\n\t// OK so the gp is outside the ggt. Either a corner is in range, or a side is in range.\n\n\t// Check if any of the corners are...\n\td1 := DistanceBetween(gp, NewGridpoint(\"tlc\", ggt.min_lat, ggt.min_lon))\n\td2 := DistanceBetween(gp, NewGridpoint(\"trc\", ggt.min_lat, ggt.max_lon))\n\td3 := DistanceBetween(gp, NewGridpoint(\"blc\", ggt.max_lat, ggt.min_lon))\n\td4 := DistanceBetween(gp, NewGridpoint(\"brc\", ggt.max_lat, ggt.max_lon))\n\n\tif d1 <= dist ||\n\t\td2 <= dist ||\n\t\td3 <= dist ||\n\t\td4 <= dist {\n\t\treturn true\n\t}\n\n\t// Lastly we check sides...\n\n\tif gp.lat >= ggt.min_lat && gp.lat < ggt.max_lat {\n\t\t// lat is within range, so use gp.lat\n\t\tif gp.lon > ggt.max_lon {\n\t\t\td := DistanceBetween(gp, NewGridpoint(\"maxlon\", gp.lat, ggt.max_lon))\n\t\t\tif d <= dist {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if gp.lon < ggt.min_lon {\n\t\t\td := DistanceBetween(gp, NewGridpoint(\"minlon\", gp.lat, ggt.min_lon))\n\t\t\tif d <= dist {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\n\tif gp.lon >= ggt.min_lon && gp.lon < ggt.max_lon {\n\t\t// lon is within range, so use gp.lon\n\t\tif gp.lat > ggt.max_lat {\n\t\t\td := DistanceBetween(gp, NewGridpoint(\"maxlat\", ggt.max_lat, gp.lon))\n\t\t\tif d <= dist {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if gp.lat < ggt.min_lat {\n\t\t\td := DistanceBetween(gp, NewGridpoint(\"minlon\", ggt.min_lat, gp.lon))\n\t\t\tif d <= dist {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn false\n}", "func LessThan(upper Value) *ValueRange {\n\treturn &ValueRange{\n\t\tupperEndPoint: &EndPoint{value: upper, boundType: BoundTypeOpen},\n\t}\n}", "func (blueprintr Range) Accepts(x float64) bool {\n\treturn blueprintr.Min <= x && (blueprintr.Max == 0 || x <= blueprintr.Max)\n}", "func (g Grid) WithinBounds(c Vec) bool {\n\tN, M := g.Size()\n\treturn 0 <= c.i && c.i < N && 0 <= c.j && c.j < M\n}", "func RuneInRange(start, end rune) Parser {\n\treturn AnnotateStyleable(\n\t\tMatchRune(func(r rune) bool {\n\t\t\treturn start <= r && r <= end\n\t\t}),\n\t\t\"RuneInRange\",\n\t\tfunc(style int) string {\n\t\t\treturn fmt.Sprintf(\"[%s-%s]\", string(start), string(end))\n\t\t})\n}", "func (i I) In(a, b I) bool {\n\tif a.X > b.X {\n\t\tif i.X <= b.X || i.X > a.X {\n\t\t\treturn false\n\t\t}\n\t} else {\n\t\tif i.X >= b.X || i.X < a.X {\n\t\t\treturn false\n\t\t}\n\t}\n\tif a.Y > b.Y {\n\t\tif i.Y <= b.Y || i.Y > a.Y {\n\t\t\treturn false\n\t\t}\n\t} else {\n\t\tif i.Y >= b.Y || i.Y < a.Y {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func check(Val int, arr []int, info []bool) bool {\n\tfor i := len(info) - 1; i >= 0; i-- {\n\t\tif info[i] && Val >= arr[i] || !info[i] && Val <= arr[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func Within(param string, min float64, max float64) error {\n\tf, err := strconv.ParseFloat(param, 64)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid float param %s\", param)\n\t}\n\tif f < min {\n\t\treturn fmt.Errorf(\"%0.2f is less than minimum %0.2f\", f, min)\n\t}\n\tif f > max {\n\t\treturn fmt.Errorf(\"%0.2f is more than maximum %0.2f\", f, max)\n\t}\n\treturn nil\n}", "func overlapBounds(amin, amax, bmin, bmax Vector3) bool {\n\toverlap := true\n\tif amin[0] > bmax[0] || amax[0] < bmin[0] {\n\t\toverlap = false\n\t}\n\tif amin[1] > bmax[1] || amax[1] < bmin[1] {\n\t\toverlap = false\n\t}\n\tif amin[2] > bmax[2] || amax[2] < bmin[2] {\n\t\toverlap = false\n\t}\n\treturn overlap\n}", "func (v RangeInt) Test(value int) bool {\n\treturn TestInt(v.min, v.max, value, v.minExclusive, v.maxExclusive)\n}", "func (ranges Ranges) Less(i, j int) bool {\n if ranges[i].Start == ranges[j].Start {\n return ranges[i].End < ranges[j].End\n }\n return ranges[i].Start < ranges[j].Start\n}", "func (key Key) BetweenEndInclusive(start Key, end Key) bool {\n\ts, e := uint64(start), uint64(end)\n\tk := uint64(key)\n\tif s > config.maxKey || e > config.maxKey || k > config.maxKey {\n\t\tpanic(\"MaxKey constraint has been violated!\")\n\t}\n\tif s == e {\n\t\treturn true // Full sweep - all keys are in range.\n\t}\n\tif s > e { // Interval wraps - if key is lt end or gt start, it is in interval\n\t\treturn s < k || k <= e\n\t} else {\n\t\treturn (s < k && k <= e)\n\t}\n}", "func (rg Range) Intersect(r Range) Range {\n\tif rg.Max.X > r.Max.X {\n\t\trg.Max.X = r.Max.X\n\t}\n\tif rg.Max.Y > r.Max.Y {\n\t\trg.Max.Y = r.Max.Y\n\t}\n\tif rg.Min.X < r.Min.X {\n\t\trg.Min.X = r.Min.X\n\t}\n\tif rg.Min.Y < r.Min.Y {\n\t\trg.Min.Y = r.Min.Y\n\t}\n\tif rg.Min.X >= rg.Max.X || rg.Min.Y >= rg.Max.Y {\n\t\treturn Range{}\n\t}\n\treturn rg\n}", "func (m *Block) Within(minT, maxT int64) bool {\n\t// NOTE: Block intervals are half-open: [MinTime, MaxTime).\n\treturn m.MinTime <= maxT && minT < m.MaxTime\n}", "func InIntSlice(a int, list []int) bool {\n\tfor _, v := range list {\n\t\tif a == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func RangeAnd(low, high, n int, f pargo.RangePredicate) bool {\n\tvar recur func(int, int, int) bool\n\trecur = func(low, high, n int) (result bool) {\n\t\tswitch {\n\t\tcase n == 1:\n\t\t\treturn f(low, high)\n\t\tcase n > 1:\n\t\t\tbatchSize := ((high - low - 1) / n) + 1\n\t\t\thalf := n / 2\n\t\t\tmid := low + batchSize*half\n\t\t\tif mid >= high {\n\t\t\t\treturn f(low, high)\n\t\t\t}\n\t\t\tvar b1 bool\n\t\t\tvar p interface{}\n\t\t\tvar wg sync.WaitGroup\n\t\t\twg.Add(1)\n\t\t\tgo func() {\n\t\t\t\tdefer func() {\n\t\t\t\t\twg.Done()\n\t\t\t\t\tp = recover()\n\t\t\t\t}()\n\t\t\t\tb1 = recur(mid, high, n-half)\n\t\t\t}()\n\t\t\tif !recur(low, mid, half) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\twg.Wait()\n\t\t\tif p != nil {\n\t\t\t\tpanic(p)\n\t\t\t}\n\t\t\treturn b1\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"invalid number of batches: %v\", n))\n\t\t}\n\t}\n\treturn recur(low, high, internal.ComputeNofBatches(low, high, n))\n}", "func (qc *qualityControl) assertRange(f string, v float64, min float64, max float64) {\n\tif v < min || v > max {\n\t\tqc.errs = append(qc.errs, fmt.Errorf(\"range check, %f < (%s) < %f, failed for value: %f\", min, f, max, v))\n\t}\n}", "func TestRangeIterator(t *testing.T) {\n\ttree := NewSplayTree()\n\titems := []Item{Int(2), Int(4), Int(6), Int(1), Int(5), Int(3), Int(0)}\n\ttree.InsertAll(items)\n\tfor lkup := range items {\n\t\ttree.Lookup(Int(lkup))\n\t\tlower := Int(2)\n\t\tupper := Int(4)\n\t\titer := tree.RangeIterator(lower, upper)\n\t\tfor item := iter(); item != nil; item = iter() {\n\t\t\tif item.Less(lower) || upper.Less(item) {\n\t\t\t\tt.Errorf(\"RangeIterator item %v ![%v, %v]\", item, lower, upper)\n\t\t\t}\n\t\t}\n\t\tlower = Int(-10)\n\t\tupper = Int(-1)\n\t\titer = tree.RangeIterator(lower, upper)\n\t\tfor item := iter(); item != nil; item = iter() {\n\t\t\tif item.Less(lower) || upper.Less(item) {\n\t\t\t\tt.Errorf(\"RangeIterator item %v ![%v, %v]\", item, lower, upper)\n\t\t\t}\n\t\t}\n\t\tlower = Int(-1)\n\t\tupper = Int(3)\n\t\titer = tree.RangeIterator(lower, upper)\n\t\tfor item := iter(); item != nil; item = iter() {\n\t\t\tif item.Less(lower) || upper.Less(item) {\n\t\t\t\tt.Errorf(\"RangeIterator item %v ![%v, %v]\", item, lower, upper)\n\t\t\t}\n\t\t}\n\t\tlower = Int(3)\n\t\tupper = Int(9)\n\t\titer = tree.RangeIterator(lower, upper)\n\t\tfor item := iter(); item != nil; item = iter() {\n\t\t\tif item.Less(lower) || upper.Less(item) {\n\t\t\t\tt.Errorf(\"RangeIterator item %v ![%v, %v]\", item, lower, upper)\n\t\t\t}\n\t\t}\n\t\tlower = Int(9)\n\t\tupper = Int(29)\n\t\titer = tree.RangeIterator(lower, upper)\n\t\tfor item := iter(); item != nil; item = iter() {\n\t\t\tif item.Less(lower) || upper.Less(item) {\n\t\t\t\tt.Errorf(\"RangeIterator item %v ![%v, %v]\", item, lower, upper)\n\t\t\t}\n\t\t}\n\t}\n}", "func (r Range) Overlaps(r1 Range) bool {\n\treturn r[0] <= r1[1] && r[1] >= r1[0]\n}", "func Open(lower Value, upper Value) *ValueRange {\n\tif lower.Compare(upper) != -1 {\n\t\tpanic(\"lower needs to be smaller than upper\")\n\t}\n\n\treturn &ValueRange{\n\t\tlowerEndPoint: &EndPoint{value: lower, boundType: BoundTypeOpen},\n\t\tupperEndPoint: &EndPoint{value: upper, boundType: BoundTypeOpen},\n\t}\n}", "func (A Coor) Inside(B Coor) bool {\n\tif A.Start >= B.Start && A.End <= B.End {\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n}", "func containsXY(minx, miny, maxx, maxy, x, y float64) bool {\n\treturn (x >= minx) && (x <= maxx) && (y >= miny) && (y <= maxy)\n}", "func IntRange(min, max int) int {\n\tif min > max {\n\t\tmin, max = max, min\n\t}\n\n\treturn Int(max-min) + min\n}", "func (s *BasejossListener) EnterRangeVal(ctx *RangeValContext) {}", "func (r *Range) IsValid(v Value) bool {\n\tif r.Kind() != v.Kind() {\n\t\treturn false\n\t}\n\tswitch r.Kind() {\n\tcase Integer:\n\t\treturn v.Int() >= r.Start.Int() && v.Int() < r.End.Int()\n\tcase Real:\n\t\treturn v.Float() >= r.Start.Float() && v.Float() < r.End.Float()\n\tdefault:\n\t\tpanic(r)\n\t}\n}", "func (v *ValueRange) Contains(value Value) bool {\n\treturn v.Compare(value) == 0\n}", "func RectWithin(aMinX, aMinY, aMaxX, aMaxY, bMinX, bMinY, bMaxX, bMaxY float64) bool {\n\trv := !(aMinX < bMinX || aMinY < bMinY || aMaxX > bMaxX || aMaxY > bMaxY)\n\treturn rv\n}", "func (b ValExprBuilder) Between(from interface{}, to interface{}) BoolExprBuilder {\n\treturn b.makeRangeCond(astBetween, from, to)\n}", "func ECDH_IN_RANGE(S []byte) bool {\n\tr := NewBIGints(CURVE_Order)\n\ts := FromBytes(S)\n\tif s.iszilch() {\n\t\treturn false\n\t}\n if Comp(s,r)>=0 {\n\t\treturn false\n\t}\n\treturn true\n}" ]
[ "0.8011385", "0.7935231", "0.78916985", "0.76261526", "0.7270945", "0.72031903", "0.7193918", "0.7107037", "0.70942944", "0.6980476", "0.697944", "0.69790214", "0.69614846", "0.69448054", "0.6925115", "0.68934387", "0.68205553", "0.67717755", "0.67509115", "0.6705743", "0.6649745", "0.66217685", "0.66109395", "0.6580321", "0.65386075", "0.6524916", "0.6449482", "0.63777095", "0.636307", "0.6346053", "0.6339621", "0.6294985", "0.6286289", "0.6285378", "0.62774074", "0.6252149", "0.6250888", "0.6220059", "0.62083316", "0.61940414", "0.6161138", "0.6156428", "0.6142927", "0.6138545", "0.6133084", "0.6122201", "0.6114412", "0.6100223", "0.6082805", "0.6063366", "0.6047323", "0.60462195", "0.60317767", "0.60043067", "0.59776604", "0.5955905", "0.5955721", "0.5954151", "0.59222984", "0.5899201", "0.5888", "0.5881736", "0.58811307", "0.5864442", "0.5851327", "0.58253133", "0.5803668", "0.5785046", "0.57812506", "0.5770001", "0.5742652", "0.57417345", "0.57333565", "0.5720924", "0.57120943", "0.5705741", "0.56717116", "0.5662615", "0.5654372", "0.56452084", "0.56309247", "0.56284803", "0.5612281", "0.5593677", "0.55859035", "0.5567421", "0.5566521", "0.55636877", "0.5554659", "0.5553193", "0.55459744", "0.5540939", "0.5536676", "0.55353993", "0.55320054", "0.5531927", "0.5528657", "0.55269784", "0.5523938", "0.5514944" ]
0.87714565
0
Run executes the pull command.
Run выполняет команду pull.
func (c *PullCommand) Run(args []string) int { cmdFlags := flag.NewFlagSet("pull", flag.ContinueOnError) cmdFlags.Usage = func() { c.UI.Output(c.Help()) } config := c.Config cmdFlags.StringVar(&config.Secret, "secret", config.Secret, "") cmdFlags.StringVar(&config.TargetDirectory, "target", config.TargetDirectory, "") cmdFlags.StringVar(&config.Encoding, "encoding", config.Encoding, "") cmdFlags.StringVar(&config.Format, "format", config.Format, "") req := new(phrase.DownloadRequest) cmdFlags.StringVar(&req.Tag, "tag", "", "") var updatedSince string cmdFlags.StringVar(&updatedSince, "updated-since", "", "") cmdFlags.BoolVar(&req.ConvertEmoji, "convert-emoji", false, "") cmdFlags.BoolVar(&req.SkipUnverifiedTranslations, "skip-unverified-translations", false, "") cmdFlags.BoolVar(&req.IncludeEmptyTranslations, "include-empty-translations", false, "") if err := cmdFlags.Parse(args); err != nil { return 1 } if updatedSince != "" { var err error req.UpdatedSince, err = time.Parse(timeFormat, updatedSince) if err != nil { c.UI.Error(fmt.Sprintf("Error parsing updated-since (%s), format should be YYYYMMDDHHMMSS", updatedSince)) return 1 } } if config.Format == "" { config.Format = defaultDownloadFormat } c.API.AuthToken = config.Secret req.Encoding = config.Encoding req.Format = config.Format if err := config.Valid(); err != nil { c.UI.Error(err.Error()) return 1 } err := c.fetch(req, cmdFlags.Args()) if err != nil { c.UI.Error(fmt.Sprintf("Error encountered fetching the locales:\n\t%s", err.Error())) return 1 } return 0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *PullCommand) runPull(args []string) error {\n\treturn pullMissingImage(context.Background(), p.cli.Client(), args[0], true)\n}", "func (config *ReleaseCommandConfig) Run() error {\n\n\tgit, err := gitpkg.GetGit()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = release(git)\n\n\treturn err\n}", "func executePull(location string) {\n\tfmt.Println(\"Pulling from \" + location + \" ...\")\n}", "func (c *PushCommand) Run(args []string) int {\n\n\treturn 0\n}", "func (o *Options) Run() error {\n\terr := o.Validate()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to validate options\")\n\t}\n\n\terr = o.upgradeRepository(o.TargetGitURL)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to create Pull Request on repository %s\", o.TargetGitURL)\n\t}\n\treturn nil\n}", "func (c *config) pull(remote string, branch string) (output string, err error) {\n\tlog.Printf(\"pulling: %v/%v\", remote, branch)\n\n\tdefaultCommand := []string{\"pull\", remote, branch}\n\n\treturn c.command(defaultCommand...)\n}", "func (c *PruneCommand) Run() error {\n\n\tif c.fs.NArg() < 2 {\n\t\treturn fmt.Errorf(\"usage: prune <username> <password> ::(auth to dockerhub.io)\")\n\t}\n\n\tauth, err := readAuth()\n\tif err != nil {\n\t\treturn errors.New(\"Could not find auth file. Please run `login` command\")\n\t}\n\n\treturn app.Prune(*auth, c.fs.Arg(0), c.fs.Arg(1))\n}", "func (r *Runner) Run(ctx context.Context, remoteName string, remoteUrl string) error {\n\tlog.Infof(\"running git-remote-dgit on remote %s with url %s\", remoteName, remoteUrl)\n\n\t// get the named remote as reported by git, but then\n\t// create a new remote with only the url specified\n\t// this is for cases when a remote has multiple urls\n\t// specified for push / fetch\n\tnamedRemote, err := r.local.Remote(remoteName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = namedRemote.Config().Validate()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Invalid remote config: %v\", err)\n\t}\n\n\tremote := git.NewRemote(r.local.Storer, &config.RemoteConfig{\n\t\tName: namedRemote.Config().Name,\n\t\tFetch: namedRemote.Config().Fetch,\n\t\tURLs: []string{remoteUrl},\n\t})\n\n\tstdinReader := bufio.NewReader(r.stdin)\n\n\tfor {\n\t\tvar err error\n\n\t\tcommand, err := stdinReader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcommand = strings.TrimSpace(command)\n\t\tcommandParts := strings.Split(command, \" \")\n\n\t\tlog.Infof(\"received command on stdin %s\", command)\n\n\t\targs := strings.TrimSpace(strings.TrimPrefix(command, commandParts[0]))\n\t\tcommand = commandParts[0]\n\n\t\tswitch command {\n\t\tcase \"capabilities\":\n\t\t\tr.respond(strings.Join([]string{\n\t\t\t\t\"*push\",\n\t\t\t\t\"*fetch\",\n\t\t\t}, \"\\n\") + \"\\n\")\n\t\t\tr.respond(\"\\n\")\n\t\tcase \"list\":\n\t\t\trefs, err := remote.List(&git.ListOptions{})\n\n\t\t\tif err == transport.ErrRepositoryNotFound && args == \"for-push\" {\n\t\t\t\tr.respond(\"\\n\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif err == transport.ErrRepositoryNotFound {\n\t\t\t\treturn fmt.Errorf(msg.RepoNotFound)\n\t\t\t}\n\n\t\t\tif err == transport.ErrEmptyRemoteRepository || len(refs) == 0 {\n\t\t\t\tr.respond(\"\\n\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar head string\n\n\t\t\tlistResponse := make([]string, len(refs))\n\t\t\tfor i, ref := range refs {\n\t\t\t\tlistResponse[i] = fmt.Sprintf(\"%s %s\", ref.Hash(), ref.Name())\n\n\t\t\t\t// TODO: set default branch in repo chaintree which\n\t\t\t\t// would become head here\n\t\t\t\t//\n\t\t\t\t// if master head exists, use that\n\t\t\t\tif ref.Name() == \"refs/heads/master\" {\n\t\t\t\t\thead = ref.Name().String()\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsort.Slice(listResponse, func(i, j int) bool {\n\t\t\t\treturn strings.Split(listResponse[i], \" \")[1] < strings.Split(listResponse[j], \" \")[1]\n\t\t\t})\n\n\t\t\t// if head is empty, use last as default\n\t\t\tif head == \"\" {\n\t\t\t\thead = strings.Split(listResponse[len(listResponse)-1], \" \")[1]\n\t\t\t}\n\n\t\t\tr.respond(\"@%s HEAD\\n\", head)\n\t\t\tr.respond(\"%s\\n\", strings.Join(listResponse, \"\\n\"))\n\t\t\tr.respond(\"\\n\")\n\t\tcase \"push\":\n\t\t\trefSpec := config.RefSpec(args)\n\n\t\t\tendpoint, err := transport.NewEndpoint(remote.Config().URLs[0])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tauth, err := r.auth()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tlog.Debugf(\"auth for push: %s %s\", auth.Name(), auth.String())\n\n\t\t\terr = remote.PushContext(ctx, &git.PushOptions{\n\t\t\t\tRemoteName: remote.Config().Name,\n\t\t\t\tRefSpecs: []config.RefSpec{refSpec},\n\t\t\t\tAuth: auth,\n\t\t\t})\n\n\t\t\tif err == transport.ErrRepositoryNotFound {\n\t\t\t\terr = nil // reset err back to nil\n\t\t\t\tclient, err := dgit.Default()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\t_, err = client.CreateRepoTree(ctx, endpoint, auth, os.Getenv(\"DGIT_OBJ_STORAGE\"))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\t// Retry push now that repo exists\n\t\t\t\terr = remote.PushContext(ctx, &git.PushOptions{\n\t\t\t\t\tRemoteName: remote.Config().Name,\n\t\t\t\t\tRefSpecs: []config.RefSpec{refSpec},\n\t\t\t\t\tAuth: auth,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tdst := refSpec.Dst(plumbing.ReferenceName(\"*\"))\n\t\t\tif err != nil && err != git.NoErrAlreadyUpToDate {\n\t\t\t\tr.respond(\"error %s %s\\n\", dst, err.Error())\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tr.respond(\"ok %s\\n\", dst)\n\t\t\tr.respond(\"\\n\")\n\t\tcase \"fetch\":\n\t\t\tsplitArgs := strings.Split(args, \" \")\n\t\t\tif len(splitArgs) != 2 {\n\t\t\t\treturn fmt.Errorf(\"incorrect arguments for fetch, received %s, expected 'hash refname'\", args)\n\t\t\t}\n\n\t\t\trefName := plumbing.ReferenceName(splitArgs[1])\n\n\t\t\trefSpecs := []config.RefSpec{}\n\n\t\t\tlog.Debugf(\"remote fetch config %v\", remote.Config().Name)\n\n\t\t\tfor _, fetchRefSpec := range remote.Config().Fetch {\n\t\t\t\tif !fetchRefSpec.Match(refName) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tnewRefStr := \"\"\n\t\t\t\tif fetchRefSpec.IsForceUpdate() {\n\t\t\t\t\tnewRefStr += \"+\"\n\t\t\t\t}\n\t\t\t\tnewRefStr += refName.String() + \":\" + fetchRefSpec.Dst(refName).String()\n\n\t\t\t\tnewRef := config.RefSpec(newRefStr)\n\n\t\t\t\tif err := newRef.Validate(); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tlog.Debugf(\"attempting to fetch on %s\", newRef.String())\n\t\t\t\trefSpecs = append(refSpecs, newRef)\n\t\t\t}\n\n\t\t\terr := remote.FetchContext(ctx, &git.FetchOptions{\n\t\t\t\tRemoteName: remote.Config().Name,\n\t\t\t\tRefSpecs: refSpecs,\n\t\t\t})\n\t\t\tif err != nil && err != git.NoErrAlreadyUpToDate {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlog.Debugf(\"fetch complete\")\n\t\t\tr.respond(\"\\n\")\n\t\t// Connect can be used for upload / receive pack\n\t\t// case \"connect\":\n\t\t// \tr.respond(\"fallback\\n\")\n\t\tcase \"\": // command stream terminated, return out\n\t\t\treturn nil\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"Command '%s' not handled\", command)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (cmd PullCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int {\n\tap := cmd.createArgParser()\n\thelp, usage := cli.HelpAndUsagePrinters(commandStr, pullShortDesc, pullLongDesc, pullSynopsis, ap)\n\tapr := cli.ParseArgs(ap, args, help)\n\tbranch := dEnv.RepoState.CWBHeadRef()\n\n\tvar verr errhand.VerboseError\n\tvar remoteName string\n\tif apr.NArg() > 1 {\n\t\tverr = errhand.BuildDError(\"\").SetPrintUsage().Build()\n\t} else {\n\t\tif apr.NArg() == 1 {\n\t\t\tremoteName = apr.Arg(0)\n\t\t}\n\n\t\tvar refSpecs []ref.RemoteRefSpec\n\t\trefSpecs, verr = dEnv.GetRefSpecs(remoteName)\n\n\t\tif verr == nil {\n\t\t\tif len(refSpecs) == 0 {\n\t\t\t\tverr = errhand.BuildDError(\"error: no refspec for remote\").Build()\n\t\t\t} else {\n\t\t\t\tremote := dEnv.RepoState.Remotes[refSpecs[0].GetRemote()]\n\n\t\t\t\tfor _, refSpec := range refSpecs {\n\t\t\t\t\tif remoteTrackRef := refSpec.DestRef(branch); remoteTrackRef != nil {\n\t\t\t\t\t\tverr = pullRemoteBranch(ctx, dEnv, remote, branch, remoteTrackRef)\n\n\t\t\t\t\t\tif verr != nil {\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn HandleVErrAndExitCode(verr, usage)\n}", "func (cmd *DownCmd) Run(cobraCmd *cobra.Command, args []string) {\n\tlog.StartFileLogging()\n\n\tconfig := configutil.GetConfig(false)\n\n\treleaseName := *config.DevSpace.Release.Name\n\tkubectl, err := kubectl.NewClient()\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to create new kubectl client: %s\", err.Error())\n\t}\n\n\tclient, err := helmClient.NewClient(kubectl, false)\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to initialize helm client: %s\", err.Error())\n\t}\n\n\tlog.StartWait(\"Deleting release \" + releaseName)\n\tres, err := client.DeleteRelease(releaseName, true)\n\tlog.StopWait()\n\n\tif res != nil && res.Info != \"\" {\n\t\tlog.Donef(\"Successfully deleted release %s: %s\", releaseName, res.Info)\n\t} else if err != nil {\n\t\tlog.Donef(\"Error deleting release %s: %s\", releaseName, err.Error())\n\t} else {\n\t\tlog.Donef(\"Successfully deleted release %s\", releaseName)\n\t}\n}", "func (o *Options) Run() error {\n\terr := o.Validate()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to validate options\")\n\t}\n\n\tpr, err := o.discoverPullRequest()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to discover pull request\")\n\t}\n\n\tlog.Logger().Infof(\"found PullRequest %s\", pr.Link)\n\n\tpreview, _, err := previews.GetOrCreatePreview(o.PreviewClient, o.Namespace, pr, o.PreviewHelmfile)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to upsert the Preview resource in namespace %s\", o.Namespace)\n\t}\n\tlog.Logger().Infof(\"upserted preview %s\", preview.Name)\n\n\treturn o.helmfileSyncPreview(pr, preview)\n}", "func Run(cmd *cobra.Command, args []string) {\n\tvar repo *dbt.DBTRepoServer\n\n\tif configFile != \"\" {\n\t\tr, err := dbt.NewRepoServer(configFile)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Failed to create reposerver from file: %s\", err)\n\t\t}\n\n\t\trepo = r\n\n\t} else {\n\t\trepo = &dbt.DBTRepoServer{\n\t\t\tAddress: address,\n\t\t\tPort: port,\n\t\t\tServerRoot: serverRoot,\n\t\t}\n\t}\n\n\tif repo == nil {\n\t\tlog.Fatalf(\"Failed to initialize reposerver object. Cannot continue.\")\n\t}\n\n\terr := repo.RunRepoServer()\n\tif err != nil {\n\t\tlog.Fatalf(\"Error running server: %s\", err)\n\t}\n}", "func pullCmd(c *cli.Context) error {\n\tvar fqRegistries []string\n\n\targs := c.Args()\n\tif len(args) == 0 {\n\t\tlogrus.Errorf(\"an image name must be specified\")\n\t\treturn nil\n\t}\n\tif len(args) > 1 {\n\t\tlogrus.Errorf(\"too many arguments. Requires exactly 1\")\n\t\treturn nil\n\t}\n\timage := args[0]\n\tsrcRef, err := alltransports.ParseImageName(image)\n\tif err != nil {\n\t\tfqRegistries, err = getRegistriesToTry(image)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t} else {\n\t\tfqRegistries = append(fqRegistries, srcRef.DockerReference().String())\n\t}\n\truntime, err := getRuntime(c)\n\tdefer runtime.Shutdown(false)\n\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"could not create runtime\")\n\t}\n\tfor _, fqname := range fqRegistries {\n\t\tfmt.Printf(\"Trying to pull %s...\", fqname)\n\t\tif err := runtime.PullImage(fqname, c.Bool(\"all-tags\"), os.Stdout); err != nil {\n\t\t\tfmt.Printf(\" Failed\\n\")\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn errors.Errorf(\"error pulling image from %q\", image)\n}", "func (gen *Generator) Pull() error {\n\tLog.Info(\"pull\", fmt.Sprintf(\"performing git pull in: %s\", gen.Template.Directory))\n\tGitPull := templates.CommandOptions{\n\t\tCmd: \"git pull\",\n\t\tDir: gen.Template.Directory.ToString(),\n\t\tUseStdOut: true,\n\t}\n\t_, err := templates.Run(GitPull)\n\treturn err\n}", "func (c *updateCmd) Run(_ *buildChild) error {\n\treturn nil\n}", "func runCmd() {\n\tgoPing()\n}", "func (b *binding) Pull(ctx context.Context, remote, local string) error {\n\treturn b.Command(\"pull\", remote, local).Run(ctx)\n}", "func (cmd *DownloadFirmwareCommand) Run(c *client.Client, args []string) error {\n\tvar path string\n\tif len(args) > 0 {\n\t\tpath = args[0]\n\t} else {\n\t\tpath = fmt.Sprintf(\"/firmware/%v/download\", cmd.FirmwareID)\n\t}\n\tlogger := goa.NewLogger(log.New(os.Stderr, \"\", log.LstdFlags))\n\tctx := goa.WithLogger(context.Background(), logger)\n\tresp, err := c.DownloadFirmware(ctx, path)\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"failed\", \"err\", err)\n\t\treturn err\n\t}\n\n\tgoaclient.HandleResponse(c.Client, resp, cmd.PrettyPrint)\n\treturn nil\n}", "func Run() error {\n\treturn command.Execute()\n}", "func Run() {\n\toptsUser := &github.RepositoryListOptions{\n\t\tAffiliation: viper.GetString(\"affiliation\"),\n\t\tDirection: viper.GetString(\"direction\"),\n\t\tListOptions: github.ListOptions{PerPage: viper.GetInt(\"count\")},\n\t\tSort: viper.GetString(\"sort\"),\n\t\tType: viper.GetString(\"type\"),\n\t\tVisibility: viper.GetString(\"visibility\"),\n\t}\n\n\toptsOrg := &github.RepositoryListByOrgOptions{\n\t\tDirection: viper.GetString(\"direction\"),\n\t\tListOptions: github.ListOptions{PerPage: viper.GetInt(\"count\")},\n\t\tSort: viper.GetString(\"sort\"),\n\t\tType: viper.GetString(\"type\"),\n\t}\n\n\tvar queryFunc func(client *github.Client, name string, page int) ([]*github.Repository, *github.Response, error)\n\n\tif viper.GetBool(\"user\") {\n\t\tqueryFunc = userQueryFunc(optsUser)\n\t} else {\n\t\tqueryFunc = orgQueryFunc(optsOrg)\n\t}\n\n\trepos := queryRepos(\n\t\tnewClient(viper.GetString(\"token\")),\n\t\tviper.GetString(\"prefix\"),\n\t\tviper.GetString(\"name\"),\n\t\tqueryFunc,\n\t)\n\n\tinternal.RenderTemplate(\n\t\tviper.GetString(\"prefix\"),\n\t\tviper.GetString(\"name\"),\n\t\tconvertRepos(repos),\n\t\tviper.GetString(\"template\"),\n\t\tos.Stdout,\n\t)\n}", "func Run(state *core.BuildState, label core.AnnotatedOutputLabel, args []string, remote, env, inTmp bool, dir, overrideCmd string) {\n\tprepareRun()\n\n\trun(context.Background(), state, label, args, false, false, remote, env, false, inTmp, dir, overrideCmd)\n}", "func (p *Publisher) Run() error {\n\tspecResponse, err := p.sdAPI.PostCommand(p.commandSpec)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Post failed: %v\", err)\n\t}\n\n\terr = p.tagCommand(specResponse)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Tag failed: %v\", err)\n\t}\n\n\t// Published successfully\n\t// Show version number of command published by sd-cmd\n\tfmt.Println(specResponse.Version)\n\n\treturn nil\n}", "func Run() {\n\tcmd.Execute()\n}", "func Run(c *cli.Context) {\n\tport, err := osExpandAndVerifyGlobal(c, \"port\")\n\tif err != nil {\n\t\tfail(err)\n\t}\n\tcommand, err := osExpandAndVerify(c, \"command\")\n\tif err != nil {\n\t\tfail(err)\n\t}\n\thost, err := osExpandAndVerify(c, \"host\")\n\tif err != nil {\n\t\tfail(err)\n\t}\n\tuser, err := osExpandAndVerify(c, \"user\")\n\tif err != nil {\n\t\tfail(err)\n\t}\n\tconnection := c.String(\"connection\")\n\tif connection == ansible.ConnectionWinRM {\n\t\tpassword, err := osExpandAndVerify(c, \"password\")\n\t\tif err != nil {\n\t\t\tfail(err)\n\t\t}\n\t\terr = winrm.RemoteWinRmCommand(user, password, host, port, command, nil, nil, \"\")\n\t} else {\n\t\tprivatekey, err := osExpandAndVerify(c, \"privatekey\")\n\t\tif err != nil {\n\t\t\tfail(err)\n\t\t}\n\t\tenvVars := make(map[string]string)\n\t\terr = ssh.RemoteSSHCommand(user, privatekey, host, port, command, envVars)\n\t}\n\tif err != nil {\n\t\tlog.Err(\"Failed: %v\", err)\n\t}\n}", "func Run(_conn db.Conn, _dk docker.Client, _role db.Role) {\n\tconn = _conn\n\tdk = _dk\n\trole = _role\n\n\timageSet := map[string]struct{}{}\n\tfor _, image := range imageMap {\n\t\timageSet[image] = struct{}{}\n\t}\n\n\tfor image := range imageSet {\n\t\tgo dk.Pull(image)\n\t}\n\n\tswitch role {\n\tcase db.Master:\n\t\trunMaster()\n\tcase db.Worker:\n\t\trunWorker()\n\t}\n}", "func (d *downloadCommand) Run(args []string) int {\n\tif len(args) < 2 {\n\t\tfmt.Println(\"The download command expects exactly two arguments.\")\n\t\tfmt.Printf(\"%s\\n\", d.Help())\n\t\treturn 1\n\t}\n\tproduct := args[0]\n\tversion := args[1]\n\n\tproductURL, err := url.Parse(hcrelease.ReleasesURL)\n\tif err != nil {\n\t\treturn 1\n\t}\n\tproductURL.Path = \"index.json\"\n\n\tproducts, err := hcrelease.GetProducts(productURL.String())\n\tif err != nil {\n\t\tfmt.Printf(\"failed to retrieve product details: %v\", err)\n\t\treturn 1\n\t}\n\n\trelease, err := products.GetRelease(product)\n\tif err != nil {\n\t\tfmt.Printf(\"failed to retrieve release details: %v\", err)\n\t\treturn 1\n\t}\n\n\tver, err := release.GetVersion(version)\n\tif err != nil {\n\t\tfmt.Printf(\"failed to retrieve version details: %v\", err)\n\t\treturn 1\n\t}\n\n\tbuild, err := ver.GetBuild(runtime.GOOS, runtime.GOARCH)\n\tif err != nil {\n\t\tfmt.Printf(\"failed to retrieve build details: %v\", err)\n\t\treturn 1\n\t}\n\n\toutFile, err := os.Create(build.Filename)\n\tif err != nil {\n\t\treturn 1\n\t}\n\tdefer outFile.Close()\n\n\terr = build.Download(outFile)\n\tif err != nil {\n\t\tfmt.Printf(\"failed to download build: %v\", err)\n\t\treturn 1\n\t}\n\n\treturn 0\n}", "func (v *VersionCommand) Run(args []string) {\n\tapiClient := v.cli.Client()\n\n\tresult, err := apiClient.SystemVersion()\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"failed to get system version: %v\\n\", err)\n\t\treturn\n\t}\n\n\tv.cli.Print(result)\n}", "func (step *FetchUpstreamStep) Run(repo *git.ProdRepo, driver drivers.CodeHostingDriver) error {\n\treturn repo.Logging.FetchUpstream(step.BranchName)\n}", "func (c *ReleaseLatestCommand) Run(args []string) int {\n\tcmdFlags := flag.NewFlagSet(\"release latest\", flag.ContinueOnError)\n\tcmdFlags.StringVarP(&c.sourceType, \"source-type\", \"s\", \"github\", \"A type of release data source\")\n\n\tif err := cmdFlags.Parse(args); err != nil {\n\t\tc.UI.Error(fmt.Sprintf(\"failed to parse arguments: %s\", err))\n\t\treturn 1\n\t}\n\n\tif len(cmdFlags.Args()) != 1 {\n\t\tc.UI.Error(fmt.Sprintf(\"The command expects 1 argument, but got %d\", len(cmdFlags.Args())))\n\t\tc.UI.Error(c.Help())\n\t\treturn 1\n\t}\n\n\tc.source = cmdFlags.Arg(0)\n\n\tr, err := newRelease(c.sourceType, c.source)\n\tif err != nil {\n\t\tc.UI.Error(err.Error())\n\t\treturn 1\n\t}\n\n\tv, err := release.Latest(context.Background(), r)\n\tif err != nil {\n\t\tc.UI.Error(err.Error())\n\t\treturn 1\n\t}\n\n\tc.UI.Output(v)\n\treturn 0\n}", "func Run(url, updateCmd string) {\n\tt := time.NewTicker(1 * time.Minute)\n\tfor {\n\t\t<-t.C\n\n\t\tr, err := http.Head(url)\n\t\tif err != nil {\n\t\t\tlogrus.Errorln(err)\n\t\t\tcontinue\n\t\t} else if r.StatusCode >= 300 {\n\t\t\tlogrus.Errorf(\"HEAD request returned status code %d\", r.StatusCode)\n\t\t\tcontinue\n\t\t}\n\n\t\tlm, err := time.Parse(time.RFC1123, r.Header.Get(\"Last-Modified\"))\n\t\tif err != nil {\n\t\t\tlogrus.Errorln(err)\n\t\t\tcontinue\n\t\t}\n\n\t\tif !lm.After(meta.BuildTime.Add(5 * time.Minute)) { // buffer for compile and upload time\n\t\t\tcontinue\n\t\t}\n\n\t\tlogrus.Println(\"updating binary...\")\n\n\t\terr = updateBin(url)\n\t\tif err != nil {\n\t\t\tlogrus.Errorln(err)\n\t\t\t// todo: may need to recover here, if stuck without binary\n\t\t\tcontinue\n\t\t}\n\n\t\tparts := strings.Fields(updateCmd)\n\t\terr = exec.Command(parts[0], parts[1:]...).Start()\n\t\tif err != nil {\n\t\t\tlogrus.Errorln(err)\n\t\t\tcontinue\n\t\t}\n\n\t\treturn // stop checking for updates in case restart takes a while\n\t}\n}", "func (c *RestoreCommand) Run(args []string) int {\n\tif len(args) != 1 {\n\t\tc.UI.Error(\"You need to specify a restore file path from base of bucket\")\n\t\treturn 1\n\t}\n\n\tc.UI.Info(fmt.Sprintf(\"v%v: Starting Consul Snapshot\", c.Version))\n\tresponse := restore.Runner(args[0])\n\treturn response\n}", "func Run(w io.Writer, workdir, outdir, platform string) error {\n\tif err := packages.Install(w); err != nil {\n\t\treturn err\n\t}\n\tif err := rump.PrepareRumpRepo(w, workdir); err != nil {\n\t\treturn err\n\t}\n\tif err := rump.BuildRump(w, workdir, outdir, platform); err != nil {\n\t\treturn err\n\t}\n\tif err := rump.ApplyPatches(filepath.Join(outdir, \"rumprun\"), platform); err != nil {\n\t\treturn err\n\t}\n\tif err := rump.BuildRump(w, workdir, outdir, platform); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func pullExample() string {\n\treturn `$ pouch images\nIMAGE ID IMAGE NAME SIZE\nbbc3a0323522 docker.io/library/busybox:latest 703.14 KB\n$ pouch pull docker.io/library/redis:alpine\n$ pouch images\nIMAGE ID IMAGE NAME SIZE\nbbc3a0323522 docker.io/library/busybox:latest 703.14 KB\n0153c5db97e5 docker.io/library/redis:alpine 9.63 MB`\n}", "func (c *jcliPluginFetchCmd) Run(cmd *cobra.Command, args []string) (err error) {\n\tvar userHome string\n\tif userHome, err = homedir.Dir(); err != nil {\n\t\treturn\n\t}\n\n\tpluginRepo := fmt.Sprintf(\"%s/.jenkins-cli/plugins-repo\", userHome)\n\tc.output = cmd.OutOrStdout()\n\n\tvar r *git.Repository\n\tif r, err = git.PlainOpen(pluginRepo); err == nil {\n\t\tvar w *git.Worktree\n\t\tif w, err = r.Worktree(); err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tif c.Reset {\n\t\t\tif err = w.Reset(&git.ResetOptions{\n\t\t\t\tMode: git.HardReset,\n\t\t\t}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\terr = w.Pull(c.getPullOptions())\n\t\tif err == git.NoErrAlreadyUpToDate {\n\t\t\terr = nil // consider it's ok\n\t\t}\n\t} else {\n\t\tcloneOptions := c.getCloneOptions()\n\t\t_, err = git.PlainClone(pluginRepo, false, cloneOptions)\n\t}\n\treturn\n}", "func (d *DockerHTTP) Run(definition shared.Definition, rootfsDir string) error {\n\tabsRootfsDir, err := filepath.Abs(rootfsDir)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If DOCKER_REGISTRY_BASE is not set it's used default https://registry-1.docker.io\n\treturn dcapi.DownloadAndUnpackImage(definition.Source.URL, absRootfsDir, &dcapi.DownloadOpts{\n\t\tRegistryBase: os.Getenv(\"DOCKER_REGISTRY_BASE\"),\n\t\tKeepLayers: false,\n\t})\n}", "func (cmd *UpdatePostCommand) Run(c *client.Client, args []string) error {\n\tvar path string\n\tif len(args) > 0 {\n\t\tpath = args[0]\n\t} else {\n\t\tpath = fmt.Sprintf(\"/posts/%v\", cmd.PostID)\n\t}\n\tvar payload client.UpdatePostPayload\n\tif cmd.Payload != \"\" {\n\t\terr := json.Unmarshal([]byte(cmd.Payload), &payload)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to deserialize payload: %s\", err)\n\t\t}\n\t}\n\tlogger := goa.NewLogger(log.New(os.Stderr, \"\", log.LstdFlags))\n\tctx := goa.WithLogger(context.Background(), logger)\n\tresp, err := c.UpdatePost(ctx, path, &payload)\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"failed\", \"err\", err)\n\t\treturn err\n\t}\n\n\tgoaclient.HandleResponse(c.Client, resp, PrettyPrint)\n\treturn nil\n}", "func (cmd *ShowPostCommand) Run(c *client.Client, args []string) error {\n\tvar path string\n\tif len(args) > 0 {\n\t\tpath = args[0]\n\t} else {\n\t\tpath = fmt.Sprintf(\"/posts/%v\", cmd.PostID)\n\t}\n\tlogger := goa.NewLogger(log.New(os.Stderr, \"\", log.LstdFlags))\n\tctx := goa.WithLogger(context.Background(), logger)\n\tresp, err := c.ShowPost(ctx, path)\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"failed\", \"err\", err)\n\t\treturn err\n\t}\n\n\tgoaclient.HandleResponse(c.Client, resp, PrettyPrint)\n\treturn nil\n}", "func (c *CmdGitMdget) Run() error {\n\tcli, err := GetGitClient(c.G())\n\tctx := context.Background()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar res []keybase1.GitRepoResult\n\tif len(c.folder) > 0 {\n\t\tfolder, err := ParseTLF(c.folder)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tres, err = cli.GetGitMetadata(ctx, folder)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tres, err = cli.GetAllGitMetadata(ctx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tjsonStr, err := json.MarshalIndent(res, \"\", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(string(jsonStr))\n\treturn nil\n}", "func Run(conf *Config, fs sys.FS, env sys.Env, storageDriver storagedriver.StorageDriver) error {\n\tlog.Debug(\"Running git hook\")\n\n\tbuilderKey, err := builderconf.GetBuilderKey()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tkubeClient, err := client.NewInCluster()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"couldn't reach the api server (%s)\", err)\n\t}\n\n\tscanner := bufio.NewScanner(os.Stdin)\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\toldRev, newRev, refName, err := readLine(line)\n\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"reading STDIN (%s)\", err)\n\t\t}\n\n\t\tlog.Debug(\"read [%s,%s,%s]\", oldRev, newRev, refName)\n\n\t\t// if we're processing a receive-pack on an existing repo, run a build\n\t\tif strings.HasPrefix(conf.SSHOriginalCommand, \"git-receive-pack\") {\n\t\t\tif err := build(conf, storageDriver, kubeClient, fs, env, builderKey, newRev); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn scanner.Err()\n}", "func Pull(dir, url, auth string, stdout, stderr io.Writer) error {\n\tvar user, password string\n\tif auth != \"\" {\n\t\ta := strings.Split(auth, \":\")\n\t\tuser, password = a[0], a[1]\n\t}\n\n\tswitch true {\n\tcase strings.HasSuffix(url, \".git\"):\n\t\treturn pullGit(dir, url, user, password, stdout, stderr)\n\tdefault:\n\t\treturn errors.New(\"unknown repo type\")\n\t}\n}", "func (l *Launcher) Run(args []string) error {\n\tclient, err := dockerclient.NewClient(l.dockerSocket, \"\", nil, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.client = client\n\terr = l.pullImage()\n\tif err != nil {\n\t\treturn err\n\t}\n\tresp, err := l.createContainer(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcontainerID := resp.ID\n\tfmt.Fprintf(l.Out, \"starting debug container...\\n\")\n\terr = l.startContainer(containerID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer l.cleanContainer(containerID)\n\terr = l.attachToContainer(containerID)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (sshConfig *SSHConfig) Run(cmd string) (string, error) {\n\tb, err1 := sshConfig.rawRun(cmd)\n\treturn string(b), err1\n}", "func (cmd *DownloadCommand) Run(c *client.Client, args []string) error {\n\tvar (\n\t\tfnf func(context.Context, string) (int64, error)\n\t\tfnd func(context.Context, string, string) (int64, error)\n\n\t\trpath = args[0]\n\t\toutfile = cmd.OutFile\n\t\tlogger = goa.NewLogger(log.New(os.Stderr, \"\", log.LstdFlags))\n\t\tctx = goa.WithLogger(context.Background(), logger)\n\t\terr error\n\t)\n\n\tif rpath[0] != '/' {\n\t\trpath = \"/\" + rpath\n\t}\n\tif rpath == \"/swagger.json\" {\n\t\tfnf = c.DownloadSwaggerJSON\n\t\tif outfile == \"\" {\n\t\t\toutfile = \"swagger.json\"\n\t\t}\n\t\tgoto found\n\t}\n\tif rpath == \"/swagger.yaml\" {\n\t\tfnf = c.DownloadSwaggerYaml\n\t\tif outfile == \"\" {\n\t\t\toutfile = \"swagger.yaml\"\n\t\t}\n\t\tgoto found\n\t}\n\treturn fmt.Errorf(\"don't know how to download %s\", rpath)\nfound:\n\tctx = goa.WithLogContext(ctx, \"file\", outfile)\n\tif fnf != nil {\n\t\t_, err = fnf(ctx, outfile)\n\t} else {\n\t\t_, err = fnd(ctx, rpath, outfile)\n\t}\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"failed\", \"err\", err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (cmd *GetImageProjectCommand) Run(c *client.Client, args []string) error {\n\tvar path string\n\tif len(args) > 0 {\n\t\tpath = args[0]\n\t} else {\n\t\tpath = fmt.Sprintf(\"/projects/%v/media\", cmd.ProjectID)\n\t}\n\tlogger := goa.NewLogger(log.New(os.Stderr, \"\", log.LstdFlags))\n\tctx := goa.WithLogger(context.Background(), logger)\n\tresp, err := c.GetImageProject(ctx, path)\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"failed\", \"err\", err)\n\t\treturn err\n\t}\n\n\tgoaclient.HandleResponse(c.Client, resp, cmd.PrettyPrint)\n\treturn nil\n}", "func Cmd(method, source string, args Options) ([]byte, error) {\n\treturn fetch.Cmd(fetch.Request{\n\t\tMethod: method,\n\t\tURL: fmt.Sprintf(\n\t\t\t\"http://api.pullword.com/%s.php?source=%s&param1=%d&param2=%d\",\n\t\t\tmethod,\n\t\t\tsource,\n\t\t\targs.Threshold,\n\t\t\targs.Debug,\n\t\t),\n\t})\n}", "func (c *TestCommand) Run() error {\n\tlocalPath, err := c.build()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfile, err := os.Open(localPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\tftpConn, err := c.config.DialFtp()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer ftpConn.Close()\n\n\t_, name := filepath.Split(localPath)\n\tdronePath, err := ftpConn.Upload(file, name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer ftpConn.Del(name)\n\n\ttelnetConn, err := c.config.DialTelnet()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer telnetConn.Close()\n\n\tcmd := fmt.Sprintf(\"chmod +x %s && %s\", dronePath, dronePath)\n\treturn telnetConn.Exec(cmd, os.Stdout)\n}", "func RunCmd() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"run [script path]\",\n\t\tShort: \"Clones multiple repositories, run a script in that directory, and creates a PR with those changes.\",\n\t\tLong: runHelp,\n\t\tArgs: cobra.ExactArgs(1),\n\t\tPreRunE: logFlagInit,\n\t\tRunE: run,\n\t}\n\n\tcmd.Flags().StringP(\"branch\", \"B\", \"multi-gitter-branch\", \"The name of the branch where changes are committed.\")\n\tcmd.Flags().StringP(\"base-branch\", \"\", \"\", \"The branch which the changes will be based on.\")\n\tcmd.Flags().StringP(\"pr-title\", \"t\", \"\", \"The title of the PR. Will default to the first line of the commit message if none is set.\")\n\tcmd.Flags().StringP(\"pr-body\", \"b\", \"\", \"The body of the commit message. Will default to everything but the first line of the commit message if none is set.\")\n\tcmd.Flags().StringP(\"commit-message\", \"m\", \"\", \"The commit message. Will default to title + body if none is set.\")\n\tcmd.Flags().StringSliceP(\"reviewers\", \"r\", nil, \"The username of the reviewers to be added on the pull request.\")\n\tcmd.Flags().StringSliceP(\"team-reviewers\", \"\", nil, \"Github team names of the reviewers, in format: 'org/team'\")\n\tcmd.Flags().StringSliceP(\"assignees\", \"a\", nil, \"The username of the assignees to be added on the pull request.\")\n\tcmd.Flags().IntP(\"max-reviewers\", \"M\", 0, \"If this value is set, reviewers will be randomized.\")\n\tcmd.Flags().IntP(\"max-team-reviewers\", \"\", 0, \"If this value is set, team reviewers will be randomized\")\n\tcmd.Flags().IntP(\"concurrent\", \"C\", 1, \"The maximum number of concurrent runs.\")\n\tcmd.Flags().BoolP(\"skip-pr\", \"\", false, \"Skip pull request and directly push to the branch.\")\n\tcmd.Flags().StringSliceP(\"skip-repo\", \"s\", nil, \"Skip changes on specified repositories, the name is including the owner of repository in the format \\\"ownerName/repoName\\\".\")\n\tcmd.Flags().BoolP(\"interactive\", \"i\", false, \"Take manual decision before committing any change. Requires git to be installed.\")\n\tcmd.Flags().BoolP(\"dry-run\", \"d\", false, \"Run without pushing changes or creating pull requests.\")\n\tcmd.Flags().StringP(\"conflict-strategy\", \"\", \"skip\", `What should happen if the branch already exist.\nAvailable values:\n skip: Skip making any changes to the existing branch and do not create a new pull request.\n replace: Replace the existing content of the branch by force pushing any new changes, then reuse any existing pull request, or create a new one if none exist.\n`)\n\tcmd.Flags().BoolP(\"draft\", \"\", false, \"Create pull request(s) as draft.\")\n\t_ = cmd.RegisterFlagCompletionFunc(\"conflict-strategy\", func(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {\n\t\treturn []string{\"skip\", \"replace\"}, cobra.ShellCompDirectiveNoFileComp\n\t})\n\tcmd.Flags().StringSliceP(\"labels\", \"\", nil, \"Labels to be added to any created pull request.\")\n\tcmd.Flags().StringP(\"author-name\", \"\", \"\", \"Name of the committer. If not set, the global git config setting will be used.\")\n\tcmd.Flags().StringP(\"author-email\", \"\", \"\", \"Email of the committer. If not set, the global git config setting will be used.\")\n\tconfigureGit(cmd)\n\tconfigurePlatform(cmd)\n\tconfigureRunPlatform(cmd, true)\n\tconfigureLogging(cmd, \"-\")\n\tconfigureConfig(cmd)\n\tcmd.Flags().AddFlagSet(outputFlag())\n\n\treturn cmd\n}", "func Run(args ...string) (output string, err error) {\n\tvar cmd = exec.Command(\"git\", args...)\n\tbts, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn \"\", errors.New(string(bts))\n\t}\n\treturn string(bts), err\n}", "func (a *App) Run(cmd string, w io.Writer) error {\n\ta.Log(fmt.Sprintf(\"running '%s'\", cmd), \"tsuru\")\n\tsource := \"[ -f /home/application/apprc ] && source /home/application/apprc\"\n\tcd := \"[ -d /home/application/current ] && cd /home/application/current\"\n\tcmd = fmt.Sprintf(\"%s; %s; %s\", source, cd, cmd)\n\treturn a.run(cmd, w)\n}", "func (r *Repo) Pull() error {\n\tr.Lock()\n\tdefer r.Unlock()\n\n\treturn timeout(*cmdTimeout, func() error {\n\t\treturn r.Master.VCS.Download(r.Path)\n\t})\n}", "func (cli *CLI) Run(args []string) int {\n\n\tvar (\n\t\towner string\n\t\trepo string\n\t\ttoken string\n\n\t\tcommitish string\n\t\tname string\n\t\tbody string\n\t\tdraft bool\n\t\tprerelease bool\n\n\t\tparallel int\n\n\t\trecreate bool\n\t\treplace bool\n\t\tsoft bool\n\n\t\tstat bool\n\t\tversion bool\n\t\tdebug bool\n\n\t\tgeneratenotes bool\n\t)\n\n\tflags := flag.NewFlagSet(Name, flag.ContinueOnError)\n\tflags.SetOutput(cli.errStream)\n\tflags.Usage = func() {\n\t\tfmt.Fprint(cli.errStream, helpText)\n\t}\n\n\tflags.StringVar(&owner, \"username\", \"\", \"\")\n\tflags.StringVar(&owner, \"owner\", \"\", \"\")\n\tflags.StringVar(&owner, \"u\", \"\", \"\")\n\n\tflags.StringVar(&repo, \"repository\", \"\", \"\")\n\tflags.StringVar(&repo, \"r\", \"\", \"\")\n\n\tflags.StringVar(&token, \"token\", os.Getenv(EnvGitHubToken), \"\")\n\tflags.StringVar(&token, \"t\", os.Getenv(EnvGitHubToken), \"\")\n\n\tflags.StringVar(&commitish, \"commitish\", \"\", \"\")\n\tflags.StringVar(&commitish, \"c\", \"\", \"\")\n\n\tflags.StringVar(&name, \"name\", \"\", \"\")\n\tflags.StringVar(&name, \"n\", \"\", \"\")\n\n\tflags.StringVar(&body, \"body\", \"\", \"\")\n\tflags.StringVar(&body, \"b\", \"\", \"\")\n\n\tflags.BoolVar(&draft, \"draft\", false, \"\")\n\tflags.BoolVar(&prerelease, \"prerelease\", false, \"\")\n\n\tflags.IntVar(&parallel, \"parallel\", defaultParallel, \"\")\n\tflags.IntVar(&parallel, \"p\", defaultParallel, \"\")\n\n\tflags.BoolVar(&recreate, \"delete\", false, \"\")\n\tflags.BoolVar(&recreate, \"recreate\", false, \"\")\n\n\tflags.BoolVar(&replace, \"replace\", false, \"\")\n\n\tflags.BoolVar(&soft, \"soft\", false, \"\")\n\n\tflags.BoolVar(&version, \"version\", false, \"\")\n\tflags.BoolVar(&version, \"v\", false, \"\")\n\n\tflags.BoolVar(&debug, \"debug\", false, \"\")\n\n\tflags.BoolVar(&generatenotes, \"generatenotes\", false, \"\")\n\n\t// Deprecated\n\tflags.BoolVar(&stat, \"stat\", false, \"\")\n\n\t// Parse flags\n\tif err := flags.Parse(args[1:]); err != nil {\n\t\treturn ExitCodeParseFlagsError\n\t}\n\n\tif debug {\n\t\tos.Setenv(EnvDebug, \"1\")\n\t\tDebugf(\"Run as DEBUG mode\")\n\t}\n\n\t// Show version and check latest version release\n\tif version {\n\t\tfmt.Fprint(cli.outStream, OutputVersion())\n\t\treturn ExitCodeOK\n\t}\n\n\tparsedArgs := flags.Args()\n\tDebugf(\"parsed args : %s\", parsedArgs)\n\tvar tag, path string\n\tswitch len(parsedArgs) {\n\tcase 1:\n\t\ttag, path = parsedArgs[0], \"\"\n\tcase 2:\n\t\ttag, path = parsedArgs[0], parsedArgs[1]\n\tdefault:\n\t\tPrintRedf(cli.errStream,\n\t\t\t\"Invalid number of arguments: you must set a git TAG and optionally a PATH.\\n\")\n\t\treturn ExitCodeBadArgs\n\t}\n\n\t// Extract github repository owner username.\n\t// If it's not provided via command line flag, read it from .gitconfig\n\t// (github user or git user).\n\tif len(owner) == 0 {\n\t\torigin, err := gitconfig.OriginURL()\n\t\tif err == nil {\n\t\t\towner = retrieveOwnerName(origin)\n\t\t}\n\t\tif len(owner) == 0 {\n\t\t\towner, err = gitconfig.GithubUser()\n\t\t\tif err != nil {\n\t\t\t\towner, err = gitconfig.Username()\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\tPrintRedf(cli.errStream,\n\t\t\t\t\t\"Failed to set up ghr: repository owner name not found\\n\")\n\t\t\t\tfmt.Fprintf(cli.errStream,\n\t\t\t\t\t\"Please set it via `-u` option.\\n\\n\"+\n\t\t\t\t\t\t\"You can set default owner name in `github.username` or `user.name`\\n\"+\n\t\t\t\t\t\t\"in `~/.gitconfig` file\\n\")\n\t\t\t\treturn ExitCodeOwnerNotFound\n\t\t\t}\n\t\t}\n\t}\n\tDebugf(\"Owner: %s\", owner)\n\n\t// Extract repository name from files.\n\t// If not provided, read it from .git/config file.\n\tif len(repo) == 0 {\n\t\tvar err error\n\t\trepo, err = gitconfig.Repository()\n\t\tif err != nil {\n\t\t\tPrintRedf(cli.errStream,\n\t\t\t\t\"Failed to set up ghr: repository name not found\\n\")\n\t\t\tfmt.Fprintf(cli.errStream,\n\t\t\t\t\"ghr reads it from `.git/config` file. Change directory to \\n\"+\n\t\t\t\t\t\"repository root directory or setup git repository.\\n\"+\n\t\t\t\t\t\"Or set it via `-r` option.\\n\")\n\t\t\treturn ExitCodeRepoNotFound\n\t\t}\n\t}\n\tDebugf(\"Repository: %s\", repo)\n\n\t// If GitHub API token is not provided via command line flag\n\t// or env var then read it from .gitconfig file.\n\tif len(token) == 0 {\n\t\tvar err error\n\t\ttoken, err = gitconfig.GithubToken()\n\t\tif err != nil {\n\t\t\tPrintRedf(cli.errStream, \"Failed to set up ghr: token not found\\n\")\n\t\t\tfmt.Fprintf(cli.errStream,\n\t\t\t\t\"To use ghr, you need a GitHub API token.\\n\"+\n\t\t\t\t\t\"Please set it via `%s` env var or `-t` option.\\n\\n\"+\n\t\t\t\t\t\"If you don't have one, visit official doc (goo.gl/jSnoI)\\n\"+\n\t\t\t\t\t\"and get it first.\\n\",\n\t\t\t\tEnvGitHubToken)\n\t\t\treturn ExitCodeTokenNotFound\n\t\t}\n\t}\n\tDebugf(\"Github API Token: %s\", maskString(token))\n\n\t// Set Base GitHub API URL. Base URL can also be provided via env var for use with GHE.\n\tbaseURLStr := defaultBaseURL\n\tif urlStr := os.Getenv(EnvGitHubAPI); len(urlStr) != 0 {\n\t\tbaseURLStr = urlStr\n\t}\n\tDebugf(\"Base GitHub API URL: %s\", baseURLStr)\n\n\tif parallel <= 0 {\n\t\tparallel = runtime.NumCPU()\n\t}\n\tDebugf(\"Parallel factor: %d\", parallel)\n\n\tlocalAssets, err := LocalAssets(path)\n\tif err != nil {\n\t\tPrintRedf(cli.errStream,\n\t\t\t\"Failed to find assets from %s: %s\\n\", path, err)\n\t\treturn ExitCodeError\n\t}\n\tDebugf(\"Number of file to upload: %d\", len(localAssets))\n\n\t// Create a GitHub client\n\tgitHubClient, err := NewGitHubClient(owner, repo, token, baseURLStr)\n\tif err != nil {\n\t\tPrintRedf(cli.errStream, \"Failed to construct GitHub client: %s\\n\", err)\n\t\treturn ExitCodeError\n\t}\n\n\tghr := GHR{\n\t\tGitHub: gitHubClient,\n\t\toutStream: cli.outStream,\n\t}\n\n\tDebugf(\"Name: %s\", name)\n\n\t// Prepare create release request\n\treq := &github.RepositoryRelease{\n\t\tName: github.String(name),\n\t\tTagName: github.String(tag),\n\t\tPrerelease: github.Bool(prerelease),\n\t\tDraft: github.Bool(draft),\n\t\tTargetCommitish: github.String(commitish),\n\t\tBody: github.String(body),\n\t\tGenerateReleaseNotes: github.Bool(generatenotes),\n\t}\n\n\tctx := context.TODO()\n\n\tif soft {\n\t\t_, err := ghr.GitHub.GetRelease(ctx, *req.TagName)\n\n\t\tif err == nil {\n\t\t\tfmt.Fprintf(cli.outStream, \"ghr aborted since tag `%s` already exists\\n\", *req.TagName)\n\t\t\treturn ExitCodeOK\n\t\t}\n\n\t\tif !errors.Is(err, ErrReleaseNotFound) {\n\t\t\tPrintRedf(cli.errStream, \"Failed to get GitHub release: %s\\n\", err)\n\t\t\treturn ExitCodeError\n\t\t}\n\t}\n\n\trelease, err := ghr.GitHub.GetDraftRelease(ctx, tag)\n\tif err != nil {\n\t\tPrintRedf(cli.errStream, \"Failed to get draft release: %s\\n\", err)\n\t\treturn ExitCodeError\n\t}\n\tif release == nil {\n\t\trelease, err = ghr.CreateRelease(ctx, req, recreate)\n\t\tif err != nil {\n\t\t\tPrintRedf(cli.errStream, \"Failed to create GitHub release page: %s\\n\", err)\n\t\t\treturn ExitCodeError\n\t\t}\n\t}\n\n\tif replace {\n\t\terr := ghr.DeleteAssets(ctx, *release.ID, localAssets, parallel)\n\t\tif err != nil {\n\t\t\tPrintRedf(cli.errStream, \"Failed to delete existing assets: %s\\n\", err)\n\t\t\treturn ExitCodeError\n\t\t}\n\t}\n\n\t// FIXME(tcnksm): More ideal way to change this\n\t// This is for Github enterprise\n\tif err := ghr.GitHub.SetUploadURL(*release.UploadURL); err != nil {\n\t\tfmt.Fprintf(cli.errStream, \"Failed to set upload URL %s: %s\\n\", *release.UploadURL, err)\n\t\treturn ExitCodeError\n\t}\n\n\terr = ghr.UploadAssets(ctx, *release.ID, localAssets, parallel)\n\tif err != nil {\n\t\tPrintRedf(cli.errStream, \"Failed to upload one of assets: %s\\n\", err)\n\t\treturn ExitCodeError\n\t}\n\n\tif !draft {\n\t\t_, err := ghr.GitHub.EditRelease(ctx, *release.ID, &github.RepositoryRelease{\n\t\t\tDraft: github.Bool(false),\n\t\t})\n\t\tif err != nil {\n\t\t\tPrintRedf(cli.errStream, \"Failed to publish release: %s\\n\", err)\n\t\t\treturn ExitCodeError\n\t\t}\n\t}\n\n\treturn ExitCodeOK\n}", "func (c *TwitterCommand) Run(args []string) int {\n\tvar url bool\n\n\tflags := flag.NewFlagSet(\"twitter\", flag.ContinueOnError)\n\tflags.BoolVar(&url, \"url\", false, \"Get account page URL\")\n\n\tif err := flags.Parse(args); err != nil {\n\t\treturn 1\n\t}\n\n\toutput := \"@a_know\"\n\n\tif url {\n\t\toutput = \"https://twitter.com/a_know\"\n\t}\n\n\tfmt.Fprintln(c.OutStream, output)\n\treturn 0\n}", "func (o *StepUpdateCommand) Run() error {\n\treturn o.Cmd.Help()\n}", "func (r *Puller) Pull(image string) error {\n\tcmd := exec.Command(\"docker\", \"pull\", image)\n\tvar out bytes.Buffer\n\terr := utils.ExecL(cmd, &out, log.WithField(trace.Component, constants.ComponentSystem))\n\tif err != nil {\n\t\treturn trace.Wrap(err, out.String())\n\t}\n\treturn nil\n}", "func (lpc *ListPartCommand) RunCommand() error {\n\tlpc.lpOption.encodingType, _ = GetString(OptionEncodingType, lpc.command.options)\n\tsrcBucketUrL, err := GetCloudUrl(lpc.command.args[0], lpc.lpOption.encodingType)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif srcBucketUrL.object == \"\" {\n\t\treturn fmt.Errorf(\"object name is empty\")\n\t}\n\n\tlpc.lpOption.cloudUrl = *srcBucketUrL\n\tlpc.lpOption.uploadId = lpc.command.args[1]\n\n\treturn lpc.ListPart()\n}", "func (cmd *CfRecycleCmd) Run(cliConnection plugin.CliConnection, args []string) {\n\tif args[0] == \"recycle\" {\n\t\tcmd.RecycleCommand(cliConnection, args)\n\t}\n}", "func (d Driver) Run(name, confTarget, hostVolume string, args []string) error {\n\td.containerID = fmt.Sprintf(\"maestro-%s\", name)\n\td.confTarget = confTarget\n\td.hostVolume = hostVolume\n\td.cmd = args\n\tneedToPull, checkErr := d.needToPull(context.Background())\n\tif checkErr != nil {\n\t\treturn checkErr\n\t}\n\tif needToPull {\n\t\tpullErr := d.pull(context.Background())\n\t\tif pullErr != nil {\n\t\t\treturn pullErr\n\t\t}\n\t}\n\tneedToRemoveOld, removalID, checkRemoveErr := d.needToRemove(context.Background())\n\tif checkRemoveErr != nil {\n\t\treturn checkRemoveErr\n\t}\n\tif needToRemoveOld {\n\t\tremoveErr := d.remove(context.Background(), removalID)\n\t\tif removeErr != nil {\n\t\t\treturn removeErr\n\t\t}\n\t}\n\tcreateErr := d.create(context.Background())\n\tif createErr != nil {\n\t\treturn createErr\n\t}\n\treturn d.start(context.Background())\n}", "func Run(args ...string) (string, error) {\n\t// TODO: use exex.CommandContext here and refactor.\n\t/* #nosec */\n\tcmd := exec.Command(\"git\", args...)\n\tlog.WithField(\"args\", args).Debug(\"running git\")\n\tbts, err := cmd.CombinedOutput()\n\tlog.WithField(\"output\", string(bts)).\n\t\tDebug(\"git result\")\n\tif err != nil {\n\t\treturn \"\", errors.New(string(bts))\n\t}\n\treturn string(bts), nil\n}", "func Run(c *deis.Client, appID string, command string) (api.AppRunResponse, error) {\n\treq := api.AppRunRequest{Command: command}\n\tbody, err := json.Marshal(req)\n\n\tif err != nil {\n\t\treturn api.AppRunResponse{}, err\n\t}\n\n\tu := fmt.Sprintf(\"/v2/apps/%s/run\", appID)\n\n\tres, reqErr := c.Request(\"POST\", u, body)\n\tif reqErr != nil && !deis.IsErrAPIMismatch(reqErr) {\n\t\treturn api.AppRunResponse{}, reqErr\n\t}\n\n\tarr := api.AppRunResponse{}\n\n\tif err = json.NewDecoder(res.Body).Decode(&arr); err != nil {\n\t\treturn api.AppRunResponse{}, err\n\t}\n\n\treturn arr, reqErr\n}", "func (am *AutogitManager) Pull(\n\tctx context.Context, srcTLF *libkbfs.TlfHandle, srcRepo, branchName string,\n\tdstTLF *libkbfs.TlfHandle, dstDir string) (\n\tdoneCh <-chan struct{}, err error) {\n\tam.log.CDebugf(ctx, \"Autogit pull request from %s/%s:%s to %s/%s\",\n\t\tsrcTLF.GetCanonicalPath(), srcRepo, branchName,\n\t\tdstTLF.GetCanonicalPath(), dstDir)\n\tdefer func() {\n\t\tam.deferLog.CDebugf(ctx, \"Pull request processed: %+v\", err)\n\t}()\n\n\treq := resetReq{\n\t\tsrcTLF, srcRepo, branchName, dstTLF, dstDir, make(chan struct{}),\n\t}\n\treturn am.queueReset(ctx, req)\n}", "func (src *SecretsRemoveCommand) Run(args []string) int {\n\tsrc.NewFlagSet()\n\n\tsrc.FlagSet.StringVar(&src.flagSecretID, flagSecretID, \"\", \"\")\n\tsrc.FlagSet.StringVar(&src.flagSecretID, flagSecretIDDeprecated, \"\", \"\")\n\tsrc.FlagSet.StringVar(&src.flagSecretName, flagSecretNameIdentifier, \"\", \"\")\n\tsrc.FlagSet.StringVar(&src.flagSecretName, flagSecretNameIdentifierDeprecated, \"\", \"\")\n\n\tif err := src.SecretsBaseCommand.run(args); err != nil {\n\t\tsrc.UI.Error(err.Error())\n\t\treturn 1\n\t}\n\n\tif err := src.removeSecret(); err != nil {\n\t\tsrc.UI.Error(err.Error())\n\t\treturn 1\n\t}\n\n\treturn 0\n}", "func PullCommand() cli.Command {\n\treturn cli.Command{\n\t\tName: \"pull\",\n\t\tUsage: \"Pull an image from an Amazon ECR repository.\",\n\t\tArgsUsage: PullImageFormat,\n\t\tBefore: ecscli.BeforeApp,\n\t\tAction: ImagePull,\n\t\tFlags: []cli.Flag{\n\t\t\tcli.StringFlag{\n\t\t\t\tName: ecscli.RegistryIdFlag,\n\t\t\t\tUsage: \"[Optional] Specifies the the Amazon ECR registry ID to pull the image from. By default, images are pulled from the current AWS account.\",\n\t\t\t},\n\t\t},\n\t}\n}", "func (cmd *ListFirmwareCommand) Run(c *client.Client, args []string) error {\n\tvar path string\n\tif len(args) > 0 {\n\t\tpath = args[0]\n\t} else {\n\t\tpath = \"/firmware\"\n\t}\n\tlogger := goa.NewLogger(log.New(os.Stderr, \"\", log.LstdFlags))\n\tctx := goa.WithLogger(context.Background(), logger)\n\tresp, err := c.ListFirmware(ctx, path, stringFlagVal(\"module\", cmd.Module), intFlagVal(\"page\", cmd.Page), intFlagVal(\"pageSize\", cmd.PageSize), stringFlagVal(\"profile\", cmd.Profile))\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"failed\", \"err\", err)\n\t\treturn err\n\t}\n\n\tgoaclient.HandleResponse(c.Client, resp, cmd.PrettyPrint)\n\treturn nil\n}", "func Run(argv []string) (err error) {\n\tenvFlag := cli.StringFlag{\n\t\tName: \"env\",\n\t\tValue: \"dev\",\n\t\tUsage: \"Specify Space environment\",\n\t}\n\n\tdownloadCommand := cli.Command{\n\t\tName: \"pull\",\n\t\tAliases: []string{\"download\"},\n\t\tUsage: \"Download file from Space\",\n\t\tArgsUsage: \"Space object's name\",\n\t\tFlags: []cli.Flag{\n\t\t\t&envFlag,\n\t\t\t&cli.StringFlag{\n\t\t\t\tName: \"output\",\n\t\t\t\tAliases: []string{\"o\"},\n\t\t\t\tUsage: \"Output file, otherwise use object's name\",\n\t\t\t\tValue: \"\",\n\t\t\t},\n\t\t},\n\t\tAction: downloadAction,\n\t}\n\n\tlistInternalCommand := cli.Command{\n\t\tName: \"list-internal\",\n\t\tUsage: \"List available buckets or objects in Space. Not a good idea for production bucket.\",\n\t\tArgsUsage: \"If given, list all objects in {bucket}/{prefix}, otherwise list all buckets\",\n\t\tHideHelp: true,\n\t\tHidden: true,\n\t\tFlags: []cli.Flag{\n\t\t\t&envFlag,\n\t\t},\n\t\tAction: listInternalAction,\n\t}\n\n\tlistCommand := cli.Command{\n\t\tName: \"list\",\n\t\tUsage: \"List available objects in Space.\",\n\t\tArgsUsage: \"Prefix\",\n\t\tFlags: []cli.Flag{\n\t\t\t&envFlag,\n\t\t},\n\t\tAction: listAction,\n\t}\n\n\tpushCommand := cli.Command{\n\t\tName: \"push\",\n\t\tAliases: []string{\"upload\"},\n\t\tUsage: \"Upload file/folder to Space\",\n\t\tArgsUsage: \"File or folder path to upload\",\n\t\tFlags: []cli.Flag{\n\t\t\t&envFlag,\n\t\t\t&cli.BoolFlag{\n\t\t\t\tName: \"recursive\",\n\t\t\t\tAliases: []string{\"r\"},\n\t\t\t\tUsage: \"Upload a folder recursively\",\n\t\t\t\tValue: false,\n\t\t\t},\n\t\t\t&cli.StringFlag{\n\t\t\t\tName: \"prefix\",\n\t\t\t\tAliases: []string{\"p\"},\n\t\t\t\tUsage: \"Object name's prefix.\",\n\t\t\t\tValue: \"\",\n\t\t\t},\n\t\t\t&cli.StringFlag{\n\t\t\t\tName: \"tags\",\n\t\t\t\tAliases: []string{\"t\"},\n\t\t\t\tUsage: \"Add tags, e.g. \\\"version: 0.0, type: app\\\"\",\n\t\t\t\tValue: \"\",\n\t\t\t},\n\t\t},\n\t\tAction: pushAction,\n\t}\n\n\tremoveCommand := cli.Command{\n\t\tName: \"remove\",\n\t\tAliases: []string{\"rm\"},\n\t\tUsage: \"Remove file(s) in Space\",\n\t\tArgsUsage: \"Files to be removed\",\n\t\tFlags: []cli.Flag{\n\t\t\t&envFlag,\n\t\t},\n\t\tAction: removeAction,\n\t}\n\n\tapp := &cli.App{\n\t\tName: \"space\",\n\t\tUsage: \"Work with Space and assets\",\n\t\tCommands: []*cli.Command{\n\t\t\t&downloadCommand,\n\t\t\t&listInternalCommand,\n\t\t\t&listCommand,\n\t\t\t&pushCommand,\n\t\t\t&removeCommand,\n\t\t},\n\t}\n\n\terr = app.Run(argv)\n\treturn err\n}", "func (mon *SocketMonitor) Run(command []byte) ([]byte, error) {\n\t// Just call RunWithFile with no file\n\treturn mon.RunWithFile(command, nil)\n}", "func (cmd *ProjectGetIDPictureCommand) Run(c *client.Client, args []string) error {\n\tvar path string\n\tif len(args) > 0 {\n\t\tpath = args[0]\n\t} else {\n\t\tpath = fmt.Sprintf(\"/projects/%v/picture\", cmd.ProjectID)\n\t}\n\tlogger := goa.NewLogger(log.New(os.Stderr, \"\", log.LstdFlags))\n\tctx := goa.WithLogger(context.Background(), logger)\n\tresp, err := c.ProjectGetIDPicture(ctx, path)\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"failed\", \"err\", err)\n\t\treturn err\n\t}\n\n\tgoaclient.HandleResponse(c.Client, resp, cmd.PrettyPrint)\n\treturn nil\n}", "func (r *RemoteExecutor) Run(name string, args ...string) error {\n\t_, err := r.RunWithStdout(name, args...)\n\treturn err\n}", "func Pull(c Config) {\n\n\tUpdate(c)\n\n}", "func Run(ctx context.Context /*clusterConfigs config.K8S,*/, k8sRepoConfig config.KubernetesConfigsRepo, slashcmd, txt, caller string) (messages []string, err error) {\n\tcommand.DeployWorker.Set(k8sRepoConfig.Git)\n\tif slashcmd != ACCEPTED_SLASHCMD {\n\t\treturn []string{\"call help\"}, errors.Errorf(\"%s is not a supported slash command\", slashcmd)\n\t}\n\ttxtParts := strings.Split(txt, \" \")\n\tif len(txtParts) == 0 {\n\t\t// TODO send help\n\t\treturn []string{\"call help\"}, nil\n\t}\n\n\tcmd := txtParts[0]\n\tswitch cmd {\n\t// case \"list\":\n\t// \tmessages, err = command.List(ctx, clusterConfigs, txtParts[1:])\n\t// case \"info\":\n\t// \tmessages, err = command.Info(ctx, clusterConfigs, txtParts[1:])\n\tcase \"deploy\":\n\t\tmessages, err = command.Deploy(ctx, k8sRepoConfig, txtParts[1:], txt, \"+\"+caller)\n\tcase \"release\":\n\t\tmessages, err = command.Release(ctx, k8sRepoConfig, txtParts[1:], txt, \"+\"+caller)\n\tdefault:\n\t\tif isBowie(txtParts) {\n\t\t\tmessages = command.Bowie()\n\t\t} else {\n\t\t\tmessages = []string{\"call help\"}\n\t\t\terr = errors.Errorf(\"command(%s) is not supported\", cmd)\n\t\t}\n\t}\n\treturn messages, err\n}", "func (uc *UpdateCmd) Run(ctx context.Context, client hcapi2.Client, cmd *cobra.Command, args []string) error {\n\n\tidOrName := args[0]\n\tresource, _, err := uc.Fetch(ctx, client, cmd, idOrName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// resource is an interface that always has a type, so the interface is never nil\n\t// (i.e. == nil) is always false.\n\tif reflect.ValueOf(resource).IsNil() {\n\t\treturn fmt.Errorf(\"%s not found: %s\", uc.ResourceNameSingular, idOrName)\n\t}\n\n\t// The inherited commands should not need to parse the flags themselves\n\t// or use the cobra command, therefore we fill them in a map here and\n\t// pass the map then to the update method. A caller can/should rely on\n\t// the map to contain all the flag keys that were specified.\n\tflags := make(map[string]pflag.Value, cmd.Flags().NFlag())\n\tcmd.Flags().VisitAll(func(flag *pflag.Flag) {\n\t\tflags[flag.Name] = flag.Value\n\t})\n\n\tif err := uc.Update(ctx, client, cmd, resource, flags); err != nil {\n\t\treturn fmt.Errorf(\"updating %s %s failed: %s\", uc.ResourceNameSingular, idOrName, err)\n\t}\n\n\tfmt.Printf(\"%s %v updated\\n\", uc.ResourceNameSingular, idOrName)\n\treturn nil\n}", "func Run(ctx *cli.Context) {\n\tif ctx.Bool(\"debug\") {\n\t\tlog.SetLevel(log.DebugLevel)\n\t}\n\tlog.SetLevel(log.DebugLevel)\n\n\td, err := bridge.NewDriver(version, ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\th := network.NewHandler(d)\n\th.ServeUnix(pluginName, 0)\n}", "func run(command string, args ...string) []byte {\n\n\toutput, _ := exec.Command(command, args...).CombinedOutput()\n\treturn output\n}", "func Run() error {\n\tcommand := &commander.Command{\n\t\tUsageLine: os.Args[0],\n\t\tShort: \"go_todo\",\n\t}\n\n\tcommand.Subcommands = []*commander.Command{\n\t\ttodoList(todoFilename),\n\t\ttodoSave(todoFilename),\n\t\ttodoStatus(todoFilename),\n\t\ttodoDelete(todoFilename),\n\t}\n\n\terr := command.Dispatch(os.Args[1:])\n\tif err != nil {\n\t\tfmt.Printf(\"%v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\n\treturn err\n}", "func (gc *TemplateCommand) Run(args []string, w io.Writer) error {\n\tif len(args) == 0 {\n\t\treturn errExpectedSubcommand\n\t}\n\n\tsubcommand := args[0]\n\tswitch subcommand {\n\tcase \"list\":\n\t\treturn gc.list(w)\n\tcase \"copy\":\n\t\treturn gc.fetch(w, os.WriteFile, args[1:])\n\t}\n\treturn errUnknownSubcommand\n}", "func Run(args ...string) ([]byte, error) {\n\treturn RunInPath(\"\", args...)\n}", "func (cmd *DownloadCommand) Run(c *client.Client, args []string) error {\n\tvar (\n\t\tfnf func(context.Context, string) (int64, error)\n\t\tfnd func(context.Context, string, string) (int64, error)\n\n\t\trpath = args[0]\n\t\toutfile = cmd.OutFile\n\t\tlogger = goa.NewLogger(log.New(os.Stderr, \"\", log.LstdFlags))\n\t\tctx = goa.WithLogger(context.Background(), logger)\n\t\terr error\n\t)\n\n\tif rpath[0] != '/' {\n\t\trpath = \"/\" + rpath\n\t}\n\tif rpath == \"/swagger.json\" {\n\t\tfnf = c.DownloadSwaggerJSON\n\t\tif outfile == \"\" {\n\t\t\toutfile = \"swagger.json\"\n\t\t}\n\t\tgoto found\n\t}\n\tif strings.HasPrefix(rpath, \"/\") {\n\t\tfnd = c.Download\n\t\trpath = rpath[1:]\n\t\tif outfile == \"\" {\n\t\t\t_, outfile = path.Split(rpath)\n\t\t}\n\t\tgoto found\n\t}\n\tif strings.HasPrefix(rpath, \"/swagger-ui/\") {\n\t\tfnd = c.DownloadSwaggerUI\n\t\trpath = rpath[12:]\n\t\tif outfile == \"\" {\n\t\t\t_, outfile = path.Split(rpath)\n\t\t}\n\t\tgoto found\n\t}\n\treturn fmt.Errorf(\"don't know how to download %s\", rpath)\nfound:\n\tctx = goa.WithLogContext(ctx, \"file\", outfile)\n\tif fnf != nil {\n\t\t_, err = fnf(ctx, outfile)\n\t} else {\n\t\t_, err = fnd(ctx, rpath, outfile)\n\t}\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"failed\", \"err\", err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Run(opts ...cli.Option) error {\n\treturn cmd.Run(opts...)\n}", "func (c Command) Run(args ...string) error {\n\treturn c.builder().Run(args...)\n}", "func Run(c *Config, token string, outputDir string) {\n\tclient := connect(c)\n\n\t// Authentication happens by sending the secret token via metadata\n\tmd := metadata.Pairs(shared.SecretKey, c.Secret)\n\n\tstream, err := client.Get(metadata.NewContext(context.Background(), md), &api.GetRequest{\n\t\tToken: token,\n\t})\n\tshared.ExitOnError(err, \"Unable to initiate Receive: %v\", grpc.ErrorDesc(err))\n\n\tfor {\n\t\tres, err := stream.Recv()\n\t\tif err != nil {\n\t\t\tshared.ExitOnError(err, \"Unable to receive data: %v\", grpc.ErrorDesc(err))\n\t\t}\n\t\tfmt.Println(\"received\", res.Type)\n\t}\n}", "func run(command string, args ...string) []byte {\n\toutput, err := exec.Command(command, args...).Output()\n\tcheck(err)\n\treturn output\n}", "func (service Service) PullCommand() Command {\n\treturn Command{\n\t\tMain: \"docker\",\n\t\tArgs: []string{\"pull\", service.Image},\n\t}\n}", "func (c *Cmd) Run() error {\n\treturn c.runInnerCommand()\n}", "func (c *LocalCmd) Run() error {\n\treturn runCmd(c.cmd, c.args, c.env, ioutil.Discard, ioutil.Discard)\n}", "func Pull(entity *RepoEntity, options PullOptions) (err error) {\n\t// here we configure pull operation\n\t// default mode is go-git (this may be configured)\n\tpullCmdMode = pullCmdModeNative\n\tpullTryCount = 0\n\n\tswitch pullCmdMode {\n\tcase pullCmdModeLegacy:\n\t\terr = pullWithGit(entity, options)\n\t\treturn err\n\tcase pullCmdModeNative:\n\t\terr = pullWithGoGit(entity, options)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (h *distroIDGetTeardownHandler) Run(ctx context.Context) gimlet.Responder {\n\td, err := h.sc.FindDistroById(h.distroID)\n\tif err != nil {\n\t\treturn gimlet.MakeJSONErrorResponder(errors.Wrapf(err, \"Database error for find() by distro id '%s'\", h.distroID))\n\t}\n\n\tapiDistro := &model.APIDistro{}\n\tif err = apiDistro.BuildFromService(d); err != nil {\n\t\treturn gimlet.MakeJSONInternalErrorResponder(errors.Wrap(err, \"API error converting from distro.Distro to model.APIDistro\"))\n\t}\n\n\treturn gimlet.NewJSONResponse(apiDistro.Teardown)\n}", "func (dm *DotnetModule) runCmd() error {\n\tcmd, err := dm.createCmd()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// To prevent NuGet prompting for credentials\n\terr = os.Setenv(\"NUGET_EXE_NO_PROMPT\", \"true\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = io.RunCmd(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *imageBuilderServer) Pull(ctx context.Context, _ *api.Empty) (*api.Response, error) {\n\n\t// TODO: save git repo params and clone\n\n\treturn &okResponse, nil\n}", "func (cmd *DeletePostCommand) Run(c *client.Client, args []string) error {\n\tvar path string\n\tif len(args) > 0 {\n\t\tpath = args[0]\n\t} else {\n\t\tpath = fmt.Sprintf(\"/posts/%v\", cmd.PostID)\n\t}\n\tlogger := goa.NewLogger(log.New(os.Stderr, \"\", log.LstdFlags))\n\tctx := goa.WithLogger(context.Background(), logger)\n\tresp, err := c.DeletePost(ctx, path)\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"failed\", \"err\", err)\n\t\treturn err\n\t}\n\n\tgoaclient.HandleResponse(c.Client, resp, PrettyPrint)\n\treturn nil\n}", "func (suc *SecretsUpdateCommand) Run(args []string) int {\n\tsuc.NewFlagSet()\n\n\tsuc.FlagSet.StringVar(&suc.flagSecretID, flagSecretID, \"\", \"\")\n\tsuc.FlagSet.StringVar(&suc.flagSecretID, flagSecretIDDeprecated, \"\", \"\")\n\tsuc.FlagSet.StringVar(&suc.flagSecretName, flagSecretNameIdentifier, \"\", \"\")\n\tsuc.FlagSet.StringVar(&suc.flagSecretName, flagSecretNameIdentifierDeprecated, \"\", \"\")\n\tsuc.FlagSet.StringVar(&suc.flagSecretValue, flagSecretValue, \"\", \"\")\n\n\tif err := suc.SecretsBaseCommand.run(args); err != nil {\n\t\tsuc.UI.Error(err.Error())\n\t\treturn 1\n\t}\n\n\tif err := suc.updateSecret(); err != nil {\n\t\tsuc.UI.Error(err.Error())\n\t\treturn 1\n\t}\n\n\treturn 0\n}", "func (c *Command) Run(source, message string) error {\n\tfactory := imgsource.NewImgSrcFactory(source)\n\timgSrc := factory.GetImgSrc()\n\terr := imgSrc.AddMessage(message)\n\tif err != nil {\n\t\tfmt.Fprintf(c.ErrStream, \"error happened. error: %s\\n\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func Fetch() {\n\terr := RunCommand(\"git\", \"fetch\", \"--prune\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func (db Database) Run(cmd interface{}, result interface{}) os.Error {\n\tcursor, err := db.Conn.Find(db.Name+\".$cmd\", cmd, runFindOptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar d BSONData\n\tif err := cursor.Next(&d); err != nil {\n\t\treturn err\n\t}\n\n\tvar r CommandResponse\n\tif err := Decode(d.Data, &r); err != nil {\n\t\treturn err\n\t}\n\tif err := r.Error(); err != nil {\n\t\treturn err\n\t}\n\n\tif result != nil {\n\t\tif err := d.Decode(result); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (a App) Run() error {\n\tdeal, err := FetchDeal(a.URL)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not fetch deal: %v\", err)\n\t}\n\n\tNewPrinter(a.Out).Print(deal)\n\treturn nil\n}", "func (c *Cmd) Run() error {\n\treturn c.Cmd.Run()\n}", "func (o *Options) Run() error {\n\tscmClient, err := o.Validate()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to validate options\")\n\t}\n\n\tfullName := scm.Join(o.Owner, o.Name)\n\n\tctx := context.Background()\n\n\treleaseInput := &scm.ReleaseInput{\n\t\tDescription: o.Description,\n\t\tTitle: o.Title,\n\t\tPrerelease: o.PreRelease,\n\t\tTag: o.Tag,\n\t}\n\n\trelease, _, err := scmClient.Releases.FindByTag(ctx, fullName, o.Tag)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to find release %s %s\", fullName, o.Tag)\n\t}\n\t_, _, err = scmClient.Releases.Update(ctx, fullName, release.ID, releaseInput)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to update release %s %s, id: %v\", fullName, o.Tag, release.ID)\n\t}\n\treturn nil\n}", "func (r *RunCommand) Run(params *params.Params, ioStreams *genericclioptions.IOStreams) error {\n\t// ran into some data race conditions during unit test with this starting up, but pod events\n\t// coming in before we completed initialization below\n\tr.watchLock.Lock()\n\t// resource using GenerateName, which will provice a unique instance\n\tbr := &buildv1alpha1.BuildRun{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tGenerateName: fmt.Sprintf(\"%s-\", r.buildName),\n\t\t},\n\t\tSpec: *r.buildRunSpec,\n\t}\n\tflags.SanitizeBuildRunSpec(&br.Spec)\n\n\tclientset, err := params.ShipwrightClientSet()\n\tif err != nil {\n\t\treturn err\n\t}\n\tbr, err = clientset.ShipwrightV1alpha1().BuildRuns(params.Namespace()).Create(r.cmd.Context(), br, metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !r.follow {\n\t\tfmt.Fprintf(ioStreams.Out, \"BuildRun created %q for build %q\\n\", br.GetName(), r.buildName)\n\t\treturn nil\n\t}\n\n\tr.ioStreams = ioStreams\n\tkclientset, err := params.ClientSet()\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.buildRunName = br.Name\n\tif r.shpClientset, err = params.ShipwrightClientSet(); err != nil {\n\t\treturn err\n\t}\n\n\t// instantiating a pod watcher with a specific label-selector to find the indented pod where the\n\t// actual build started by this subcommand is being executed, including the randomized buildrun\n\t// name\n\tlistOpts := metav1.ListOptions{LabelSelector: fmt.Sprintf(\n\t\t\"build.shipwright.io/name=%s,buildrun.shipwright.io/name=%s\",\n\t\tr.buildName,\n\t\tbr.GetName(),\n\t)}\n\tr.pw, err = reactor.NewPodWatcher(r.Cmd().Context(), kclientset, listOpts, params.Namespace())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.pw.WithOnPodModifiedFn(r.onEvent)\n\t// cannot defer with unlock up top because r.pw.Start() blocks; but the erroring out above kills the\n\t// cli invocation, so it does not matter\n\tr.watchLock.Unlock()\n\t_, err = r.pw.Start()\n\treturn err\n}", "func (runner *SSHRunner) Run(command string) (string, error) {\n\treturn runner.runSSHCommandFromDriver(command, false)\n}", "func (cmd *ReceiveCommand) Run() error {\n\tclient, err := cmd.WebsocketClientFactory.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer client.Close()\n\n\tif err := client.Receive(cmd.Timeout, func(message []byte) error {\n\t\t_, err := cmd.OutputWriter.Write(append(message, '\\n'))\n\t\treturn err\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (cmd *RefreshUserCommand) Run(c *client.Client, args []string) error {\n\tvar path string\n\tif len(args) > 0 {\n\t\tpath = args[0]\n\t} else {\n\t\tpath = \"/refresh\"\n\t}\n\tvar payload client.RefreshUserPayload\n\tif cmd.Payload != \"\" {\n\t\terr := json.Unmarshal([]byte(cmd.Payload), &payload)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to deserialize payload: %s\", err)\n\t\t}\n\t}\n\tlogger := goa.NewLogger(log.New(os.Stderr, \"\", log.LstdFlags))\n\tctx := goa.WithLogger(context.Background(), logger)\n\tresp, err := c.RefreshUser(ctx, path, &payload)\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"failed\", \"err\", err)\n\t\treturn err\n\t}\n\n\tgoaclient.HandleResponse(c.Client, resp, cmd.PrettyPrint)\n\treturn nil\n}", "func (c *PsCmd) Run(cli *CLI, logWriters *LogWriters) (err error) {\n\tvar aids []int\n\tif c.AccountID == 0 {\n\t\ts := NewSpinner(\"Looking up accounts\", logWriters)\n\t\ts.Start()\n\n\t\tas, err := api.Accounts()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to look up accounts: %w\", err)\n\t\t}\n\t\tfor _, a := range as {\n\t\t\taids = append(aids, a.ID)\n\t\t}\n\n\t\ts.Stop()\n\t} else {\n\t\taids = append(aids, c.AccountID)\n\t}\n\n\tvar targets [][]int\n\tfor _, id := range aids {\n\t\tif c.AppID == 0 {\n\t\t\ts := NewSpinner(\"Looking up applications\", logWriters)\n\t\t\ts.Start()\n\n\t\t\tas, err := api.Applications(id)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unable to look up applications: %w\", err)\n\t\t\t}\n\t\t\tfor _, a := range as {\n\t\t\t\ttargets = append(targets, []int{id, a.ID})\n\t\t\t}\n\n\t\t\ts.Stop()\n\t\t} else {\n\t\t\ttargets = append(targets, []int{id, c.AppID})\n\t\t}\n\t}\n\n\tif c.Watch {\n\t\tticker := time.NewTicker(c.Interval)\n\t\tfor ; true; <-ticker.C {\n\t\t\terr = pollAndOutput(cli, targets, c.AppPath,logWriters)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t} else {\n\t\terr = pollAndOutput(cli, targets, c.AppPath,logWriters)\n\t\treturn err\n\t}\n\n\treturn nil\n}" ]
[ "0.7724834", "0.7001258", "0.6845062", "0.6809112", "0.6801887", "0.65916026", "0.65858054", "0.6569583", "0.6555816", "0.6421461", "0.6414631", "0.64013046", "0.63939244", "0.6381241", "0.631539", "0.6242557", "0.6239383", "0.6225722", "0.6219979", "0.6218955", "0.61963075", "0.6171137", "0.6138994", "0.61363846", "0.6130139", "0.6096791", "0.60859776", "0.60693985", "0.6066218", "0.6053879", "0.6036024", "0.60344034", "0.6034264", "0.6032755", "0.6013311", "0.6007515", "0.59951234", "0.5981018", "0.59791905", "0.5978467", "0.59631276", "0.59603304", "0.59500957", "0.5945344", "0.59420335", "0.59382576", "0.59264493", "0.5925757", "0.59236336", "0.5912614", "0.59119105", "0.5881311", "0.5880354", "0.58749706", "0.5867423", "0.5866714", "0.5860598", "0.5857775", "0.58505446", "0.58477354", "0.58434373", "0.584175", "0.5840943", "0.58347815", "0.5830225", "0.582659", "0.5826083", "0.5822203", "0.58206034", "0.5811477", "0.5807747", "0.580669", "0.5795997", "0.5793313", "0.5790796", "0.57859164", "0.57851", "0.57837284", "0.5781939", "0.578068", "0.5765768", "0.57603335", "0.5760174", "0.57520777", "0.5749241", "0.5743665", "0.57431245", "0.57421064", "0.57351464", "0.57312405", "0.5727997", "0.5724996", "0.571918", "0.5718337", "0.5706847", "0.57024544", "0.5686583", "0.5677223", "0.5669725", "0.5660785" ]
0.8103023
0
Help displays available options for the pull command.
Помощь отображает доступные варианты для команды pull.
func (c *PullCommand) Help() string { helpText := ` Usage: phrase pull [options] [LOCALE] Download the translation files in the current project. Options: --format=yml See documentation for list of allowed formats --target=./phrase/locales Target folder to store locale files --tag=foo Limit results to a given tag instead of all translations --updated-since=YYYYMMDDHHMMSS Limit results to translations updated after the given date (UTC) --include-empty-translations Include empty translations in the result --convert-emoji Convert Emoji symbols --encoding=utf-8 Convert .strings or .properties with alternate encoding --skip-unverified-translations Skip unverified translations in the result --secret=YOUR_AUTH_TOKEN The Auth Token to use for this operation instead of the saved one (optional) ` return strings.TrimSpace(helpText) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (cmd PullCmd) Description() string {\n\treturn \"Fetch from a dolt remote data repository and merge.\"\n}", "func (d *downloadCommand) Help() string {\n\thelp := `Usage: hashicorp-releases download <product> <version>`\n\treturn help\n}", "func help() {\n\tlog.Infoln(\"#: the number of the peer you want to connect to\")\n\tlog.Infoln(\"r: refresh peer list\")\n\tlog.Infoln(\"q: quit pcp\")\n\tlog.Infoln(\"?: this help message\")\n}", "func PrintHelp() {\n fs := setupFlags(&options{})\n fs.Usage()\n}", "func (get *BaseCommandGetOperation) Help() string {\n\treturn \"\"\n}", "func GetHelp() string {\n\tmsg := \"List of available commands\\n /status - returns validator status, voting power, current block height \" +\n\t\t\"and network block height\\n /peers - returns number of connected peers\\n /node - return status of caught-up\\n\" +\n\t\t\"/balance - returns the current balance of your account \\n /list - list out the available commands\"\n\n\treturn msg\n}", "func (c *Subcommand) Help(flags *flag.FlagSet) {\n\tfmt.Printf(\"%s\\n\\n%s\\n\\n\", c.shortHelp, c.longHelp)\n\tflags.PrintDefaults()\n}", "func (c *PullCommand) Synopsis() string {\n\treturn \"Download the translation files in the current project\"\n}", "func (up *BaseProvisionUpOperation) Help() string {\n\treturn \"\"\n}", "func (c *ReleaseLatestCommand) Help() string {\n\thelpText := `\nUsage: tfupdate release latest [options] <SOURCE>\n\nArguments\n SOURCE A path of release data source.\n Valid format depends on --source-type option.\n - github or gitlab:\n owner/repo\n e.g. terraform-providers/terraform-provider-aws\n - tfregistryModule\n namespace/name/provider\n e.g. terraform-aws-modules/vpc/aws\n - tfregistryProvider (experimental)\n namespace/type\n e.g. hashicorp/aws\n\nOptions:\n -s --source-type A type of release data source.\n Valid values are\n - github (default)\n - gitlab\n - tfregistryModule\n - tfregistryProvider (experimental)\n`\n\treturn strings.TrimSpace(helpText)\n}", "func (c *GetAddressInfoCommand) Help() string {\n\treturn `Usage: wallet api getaddressinfo [options...]\nOptions:\n\t-address address\n`\n}", "func (c *UptimeCommand) Help() string {\n\thelpText := `\nUsage: pingdom uptime [options]\n Runs uptime report on Pingdom for specified period on all checks tagged\n with given tags.\nOptions:\n -period PeriodName Default: Today\n Options: %s\n -tags tag1,tag2 If specified, only include checks with one of these tags\n`\n\treturn strings.TrimSpace(fmt.Sprintf(helpText, strings.Join(c.GetPeriodOptions(), \", \")))\n}", "func (x *MultipleCommand) Help() string {\n\treturn \"\"\n}", "func (c *GetCommand) Help() string {\n\thelpText := `\nUsage :\n\twikible get [options]\n\n\tGet the wiki pages to code.\n\nOptions:\n\t-i parent id\n\t-a wiki address\n`\n\treturn strings.TrimSpace(helpText)\n}", "func (cli *CLI) Help(base Command, name string, args []string) (string, error) {\n\tb := &bytes.Buffer{}\n\terr := cli.printHelp(NewOutput(b), base, name, args)\n\treturn b.String(), err\n}", "func (vm *VM) Help(cmd *cobra.Command, args []string) {\n\n\tcli := ui.NewCLI(vm.Config)\n\tversionMap := map[string]string{\"ReleaseVersion\": ReleaseVersion, \"GitHash\": GitHash}\n\n\tif len(args) == 0 {\n\t\tfmt.Println(cli.Render(\"vmUsage\", versionMap))\n\t\treturn\n\t}\n\n\thelpType := strings.ToLower(args[0])\n\tswitch helpType {\n\tcase \"scanners\":\n\t\tfmt.Println(cli.Render(\"scannersUsage\", versionMap))\n\n\tcase \"agent-groups\":\n\t\tfmt.Print(cli.Render(\"agentGroupsUsage\", versionMap))\n\tcase \"agents\":\n\t\tfmt.Print(cli.Render(\"agentsUsage\", versionMap))\n\tcase \"export-vulns\":\n\t\tfmt.Print(cli.Render(\"ExportVulnsHelp\", versionMap))\n\n\tdefault:\n\t\tfmt.Println(cli.Render(\"vmUsage\", versionMap))\n\t}\n\n\treturn\n}", "func help(cfg cli.Config) {\n\tfmt.Printf(`\n usage:\n scan ip/host [option]\n options:\n -p port-range or port number Specified range or port number (default is %s)\n -c TCP connect scan (default is TCP SYN scan)\n -4 Force IPv4\n -6 Force IPv6\n example:\n scan 8.8.8.8 -p 53\n scan www.google.com -p 1-500\n scan freebsd.org -6\n\t`,\n\t\tcfg.Scan.Port)\n}", "func (c *Ping) Help() string {\n\treturn `Usage: PING [message] Returns PONG if no argument is provided, otherwise return a copy of the argument as a bulk.`\n}", "func PrintHelp() {\n\tfmt.Printf(\"[+] Author: brax (https://github.com/braaaax/gfz)\\n\")\n\tfmt.Printf(\"\\nUsage: gfz [options] <url>\\n\")\n\tfmt.Printf(\"Keyword: FUZZ, ..., FUZnZ wherever you put these keywords gfuzz will replace them with the values of the specified payload.\\n\\n\")\n\tfmt.Printf(\"Options:\\n\")\n\tfmt.Println(\"-h/--help : This help.\")\n\tfmt.Println(\"-w wordlist : Specify a wordlist file (alias for -z file,wordlist).\")\n\tfmt.Println(\"-z file/range/list,PAYLOAD : Where PAYLOAD is FILENAME or 1-10 or \\\"-\\\" separated sequence.\")\n\tfmt.Println(\"--hc/hl/hw/hh N[,N]+ : Hide responses with the specified code, lines, words, or chars.\")\n\tfmt.Println(\"--sc/sl/sw/sh N[,N]]+ : Show responses with the specified code, lines, words, or chars.\")\n\tfmt.Println(\"-t N : Specify the number of concurrent connections (10 default).\")\n\tfmt.Println(\"--post : Specify POST request method.\")\n\tfmt.Println(\"--post-form key=FUZZ : Specify form value eg key=value.\")\n\t// fmt.Println(\"--post-multipart file.FUZZ : Fuzz filename for file uploads.\")\n\tfmt.Println(\"-p IP:PORT : Specify proxy.\") // TODO: need better cmdline parse for two URLs\n\tfmt.Println(\"-b COOKIE : Specify cookie.\")\n\tfmt.Println(\"-ua USERAGENT : Specify user agent.\")\n\tfmt.Println(\"--password PASSWORD : Specify password for basic web auth.\")\n\tfmt.Println(\"--username USERNAME : Specify username.\")\n\tfmt.Println(\"--no-follow : Don't follow HTTP(S) redirections.\")\n\tfmt.Println(\"--no-color : Monotone output. (use for windows\")\n\tfmt.Println(\"--print-body : Print response body to stdout.\")\n\tfmt.Println(\"-k : Strict TLS connections (skip verify=false opposite of curl).\")\n\tfmt.Println(\"-q : No output.\")\n\tfmt.Println(\"-H : Add headers. (e.g. Key:Value)\")\n\tfmt.Printf(\"\\n\")\n\tfmt.Println(\"Examples: gfz -w users.txt -w pass.txt --sc 200 http://www.site.com/log.asp?user=FUZZ&pass=FUZ2Z\")\n\tfmt.Println(\" gfz -z file,default/common.txt -z list,-.php http://somesite.com/FUZZFUZ2Z\")\n\tfmt.Println(\" gfz -t 32 -w somelist.txt https://someTLSsite.com/FUZZ\")\n\tfmt.Println(\" gfz --print-body --sc 200 --post-form \\\"name=FUZZ\\\" -z file,somelist.txt http://somesite.com/form\")\n\tfmt.Println(\" gfz --post -b mycookie -ua normalbrowser --username admin --password FUZZ -z list,admin-password http://somesite.com\")\n}", "func Help() string {\n\treturn \"Commands are detailled here : https://github.com/eze-kiel/irc-bot/blob/master/README.md\"\n}", "func DisplayCommandHelp(b *Brute, m *discordgo.MessageCreate, cmd *Command) {\n\tif cmd.HelpFunc != nil {\n\t\tcmd.HelpFunc(b, b.Session, m)\n\t\treturn\n\t}\n\n\tif cmd.HelpStr != \"\" {\n\t\t_, err := b.Session.ChannelMessageSend(m.ChannelID, cmd.HelpStr)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Failed to send message: %v\\n\", err)\n\t\t}\n\t\treturn\n\t}\n\n\t_, err := b.Session.ChannelMessageSend(m.ChannelID, fmt.Sprintf(\"No usage info defined for `%s`. Here - grab some beers while waiting for Mak to add them :beers:\", cmd.Cmd))\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to send message: %v\\n\", err)\n\t}\n}", "func (app *App) ShowHelp(cmdName string) {\n\n\tfindLongestOption := func(options []Option) int {\n\t\tmax := 0\n\t\tfor _, opt := range options {\n\t\t\tlength := 0\n\t\t\tif opt.Value != \"\" {\n\t\t\t\tlength = len(opt.Key) + 1 + len(opt.Value)\n\t\t\t} else {\n\t\t\t\tlength = len(opt.Key)\n\t\t\t}\n\t\t\tif length > max {\n\t\t\t\tmax = length\n\t\t\t}\n\t\t}\n\t\treturn max\n\t}\n\n\toptionFormatStr := \"\"\n\n\tformatOption := func(opt Option) string {\n\t\tif opt.Value != \"\" {\n\t\t\tpair := fmt.Sprintf(\"%v=%v\", opt.Key, opt.Value)\n\t\t\treturn fmt.Sprintf(optionFormatStr, pair)\n\t\t} else {\n\t\t\treturn fmt.Sprintf(optionFormatStr, opt.Key)\n\t\t}\n\t}\n\n\tshowOptions := func(options []Option) {\n\t\tlongest := findLongestOption(options)\n\t\toptionFormatStr = fmt.Sprintf(\" -%%-%vv\", longest)\n\t\tfmt.Printf(\"\\n\")\n\t\tfor _, opt := range options {\n\t\t\tfmt.Printf(\"%v\", formatOption(opt))\n\t\t\twriteBody(opt.Description, 3, 6+longest)\n\t\t}\n\t}\n\n\tcmd := app.find(cmdName)\n\tif cmd != nil {\n\t\tcmdAndArgs := cmd.Name + \" \" + formatCmdArgs(cmd.Args)\n\t\tfmt.Printf(\"\\n%v\\n\\n\", cmdAndArgs)\n\t\twriteBody(cmd.ShortDescription()+\".\", 2, 2)\n\t\tif cmd.ExtraDescription() != \"\" {\n\t\t\twriteBody(cmd.ExtraDescription(), 2, 2)\n\t\t}\n\t\tif len(cmd.Options) != 0 {\n\t\t\tshowOptions(cmd.Options)\n\t\t}\n\t} else {\n\t\tlongestCmd := 0\n\t\tfor _, c := range app.Commands {\n\t\t\tif len(c.Name) > longestCmd {\n\t\t\t\tlongestCmd = len(c.Name)\n\t\t\t}\n\t\t}\n\t\tcmdFormatStr := fmt.Sprintf(\" %%-%vv %%v\\n\", longestCmd)\n\t\tif app.Description != \"\" {\n\t\t\tfmt.Printf(\"\\n%v\\n\\n\", app.Description)\n\t\t}\n\t\tfor _, c := range app.Commands {\n\t\t\tfmt.Printf(cmdFormatStr, c.Name, c.ShortDescription())\n\t\t}\n\t\tif len(app.Options) != 0 {\n\t\t\tshowOptions(app.Options)\n\t\t}\n\t}\n\n}", "func help() {\r\n fmt.Printf(\"ORIGAMI\\n\")\r\n fmt.Printf(\"\\tA web app that checks the toner levels of printers at the Elizabethtown College campus.\\n\\n\")\r\n fmt.Printf(\"USAGE\\n\")\r\n fmt.Printf(\"\\tUsage: origami [-f filepath | -h]\\n\\n\")\r\n fmt.Printf(\"OPTIONS\\n\")\r\n fmt.Printf(\"\\t-f: specify the filepath of the config file (\\\"./origami.conf\\\" by default)\\n\")\r\n fmt.Printf(\"\\t-h: this menu\\n\\n\")\r\n fmt.Printf(\"AUTHOR\\n\")\r\n fmt.Printf(\"\\tRory Dudley (aka pinecat: https://github.com/pinecat/origamiv2)\\n\\n\")\r\n fmt.Printf(\"EOF\\n\")\r\n}", "func Help() {\n\tlog.Println(\"\")\n\tlog.Println(\"Commands:\")\n\tlog.Println(\" Init : Create an empty deps.json\")\n\tlog.Println(\" Add [nickname] : Add a dependency (interactive)\")\n\tlog.Println(\" Install : Install all the dependencies listed in deps.json (default)\")\n\tlog.Println(\" Update [nickname] [branch] : Update [nickname] to use the latest commit in [branch]\")\n\tlog.Println(\" Self-Upgrade : Upgrade depman to the latest version on the master branch\")\n\tlog.Println(\" Help : Display this help\")\n\tlog.Println(\" Show-Frozen : Show dependencies as resolved to commit IDs\")\n\tlog.Println(\"\")\n\tlog.Println(\"Example: depman --verbose install\")\n\tlog.Println(\"\")\n\t//log.Println(\" freeze : For each dependency change tag and branch versions to commits (not yet implemented)\")\n\tlog.Println(\"Options:\")\n\tflag.PrintDefaults()\n}", "func (p *plugin) cmdHelp(w irc.ResponseWriter, r *irc.Request, params cmd.ParamList) {\n\tproto.PrivMsg(w, r.Target, TextHelpDisplay, r.SenderName)\n}", "func (src *SecretsRemoveCommand) Help() string {\n\treturn `Remove a secret from your Realm Application.\n\nUsage:\n realm-cli secrets remove --name [string] [options]\n realm-cli secrets remove --id [string] [options]\n\nREQUIRED:\n --name [string] OR --id [string]\n\tThe name or ID of your secret.\n` +\n\t\tsrc.SecretsBaseCommand.Help()\n}", "func (c *Config) getHelp() {\n\tcm := cmds.Command{\n\t\tName: \"help\",\n\t\tDescription: \"prints information about how to use pod\",\n\t\tEntrypoint: helpFunction,\n\t\tCommands: nil,\n\t}\n\t// first add all the options\n\tc.ForEach(func(ifc opt.Option) bool {\n\t\to := fmt.Sprintf(\"Parallelcoin Pod All-in-One Suite\\n\\n\")\n\t\tvar dt details\n\t\tswitch ii := ifc.(type) {\n\t\tcase *binary.Opt:\n\t\t\tdt = details{ii.GetMetadata().Name, ii.Option, ii.Description, fmt.Sprint(ii.Def), ii.Aliases,\n\t\t\t\tii.Documentation,\n\t\t\t}\n\t\tcase *list.Opt:\n\t\t\tdt = details{ii.GetMetadata().Name, ii.Option, ii.Description, fmt.Sprint(ii.Def), ii.Aliases,\n\t\t\t\tii.Documentation,\n\t\t\t}\n\t\tcase *float.Opt:\n\t\t\tdt = details{ii.GetMetadata().Name, ii.Option, ii.Description, fmt.Sprint(ii.Def), ii.Aliases,\n\t\t\t\tii.Documentation,\n\t\t\t}\n\t\tcase *integer.Opt:\n\t\t\tdt = details{ii.GetMetadata().Name, ii.Option, ii.Description, fmt.Sprint(ii.Def), ii.Aliases,\n\t\t\t\tii.Documentation,\n\t\t\t}\n\t\tcase *text.Opt:\n\t\t\tdt = details{ii.GetMetadata().Name, ii.Option, ii.Description, fmt.Sprint(ii.Def), ii.Aliases,\n\t\t\t\tii.Documentation,\n\t\t\t}\n\t\tcase *duration.Opt:\n\t\t\tdt = details{ii.GetMetadata().Name, ii.Option, ii.Description, fmt.Sprint(ii.Def), ii.Aliases,\n\t\t\t\tii.Documentation,\n\t\t\t}\n\t\t}\n\t\tcm.Commands = append(cm.Commands, cmds.Command{\n\t\t\tName: dt.option,\n\t\t\tDescription: dt.desc,\n\t\t\tEntrypoint: func(ifc interface{}) (e error) {\n\t\t\t\to += fmt.Sprintf(\"Help information about %s\\n\\n\\toption name:\\n\\t\\t%s\\n\\taliases:\\n\\t\\t%s\\n\\tdescription:\\n\\t\\t%s\\n\\tdefault:\\n\\t\\t%v\\n\",\n\t\t\t\t\tdt.name, dt.option, dt.aliases, dt.desc, dt.def,\n\t\t\t\t)\n\t\t\t\tif dt.documentation != \"\" {\n\t\t\t\t\to += \"\\tdocumentation:\\n\\t\\t\" + dt.documentation + \"\\n\\n\"\n\t\t\t\t}\n\t\t\t\tfmt.Fprint(os.Stderr, o)\n\t\t\t\treturn\n\t\t\t},\n\t\t\tCommands: nil,\n\t\t},\n\t\t)\n\t\treturn true\n\t},\n\t)\n\t// next add all the commands\n\tc.Commands.ForEach(func(cm cmds.Command) bool {\n\t\t\n\t\treturn true\n\t}, 0, 0,\n\t)\n\tc.Commands = append(c.Commands, cm)\n\treturn\n}", "func (c *PushCommand) Help() string {\n\treturn `\nUsage: filegate push [options] file\n ` + c.Synopsis() + `.\nOptions:\n --signaling-server=signaling_server Signaling endpoint, used by peers to exchange session description.\n --stun-servers=stun_server_1,stun_server_2,... STUN servers for traversal of NAT gateways.\n`\n}", "func (sbc *SecretsBaseCommand) Help() string {\n\treturn `\nOPTIONAL:\n --app-id [string]\n\tThe App ID for your app (i.e. the name of your app followed by a unique suffix, like \"my-app-nysja\").\n\tRequired if not being run from within a realm project directory.` +\n\t\tsbc.ProjectCommand.Help()\n}", "func (a *SLCommand) Help(command string) string {\n\tvar help string\n\n\tglobal := `\n -username \"...\" Sofleyer Username (env: IMAGES_SL_USERNAME)\n -api-key \"...\" Softlayer API Key (env: IMAGES_SL_API_KEY)\n`\n\tswitch command {\n\tcase \"modify\":\n\t\thelp = newModifyFlags().helpMsg\n\tcase \"list\":\n\t\thelp = newListFlags().helpMsg\n\tcase \"delete\":\n\t\thelp = newDeleteFlags().helpMsg\n\tcase \"copy\":\n\t\thelp = newCopyFlags().helpMsg\n\tdefault:\n\t\treturn \"no help found for command \" + command\n\t}\n\n\thelp += global\n\treturn help\n}", "func (slc *SecretsListCommand) Help() string {\n\treturn `List secrets from your Realm Application.\n\nUsage: realm-cli secrets list [options]\n` +\n\t\tslc.SecretsBaseCommand.Help()\n}", "func (c *MigrateCommand) Help(ctx context.Context, req *proto.HelpRequest, rsp *proto.HelpResponse) error {\n\t// Usage should include the name of the command\n\trsp.Usage = \"migrate\"\n\trsp.Description = \"This is an example bot command as a micro service which echos the message\"\n\treturn nil\n}", "func (g *Getter) PrintHelp(indent string) {\n\tfmt.Println(indent, \"The get command downloads and installs a Fyne application.\")\n\tfmt.Println(indent, \"A single parameter is required to specify the Go package, as with \\\"go get\\\"\")\n}", "func pullExample() string {\n\treturn `$ pouch images\nIMAGE ID IMAGE NAME SIZE\nbbc3a0323522 docker.io/library/busybox:latest 703.14 KB\n$ pouch pull docker.io/library/redis:alpine\n$ pouch images\nIMAGE ID IMAGE NAME SIZE\nbbc3a0323522 docker.io/library/busybox:latest 703.14 KB\n0153c5db97e5 docker.io/library/redis:alpine 9.63 MB`\n}", "func (c *Client) Help(cmd string) (string, error) {\n\tvar result string\n\terr := c.runCommand(&result, \"help\", cmd)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn result, nil\n}", "func showHelp(a *artifact.Artifact) {\n\tlog.Printf(\"Help!\")\n}", "func displayHelp(subcommand ...string) {\n\tswitch subcommand[0] {\n\tcase \"\":\n\t\tfmt.Println(MainHelp)\n\tcase \"run\":\n\t\tfmt.Println(RunHelp)\n\tcase \"build\":\n\t\tfmt.Println(BuildHelp)\n\tcase \"test\":\n\t\tfmt.Println(TestHelp)\n\tcase \"deps\":\n\t\tfmt.Println(DepsHelp)\n\tdefault:\n\t\tfmt.Println(MainHelp)\n\t}\n}", "func (c *ServeCommand) Help() string {\n\thelpText := `\nUsage: spored serve [options] ...\n\n Spored Server.\n\nOptions:\n\n -config=config.yml Configuration file to use.\n -env=development Environment.\n`\n\n\treturn strings.TrimSpace(helpText)\n}", "func PrintHelp() {\n\tfmt.Print(usage)\n}", "func (a activePlugin) Help() string {\n\treturn \"/url-shorten {url}\"\n}", "func PrintHelp() {\n\n\tfmt.Println(`usage: gpress [--decompress] [--verbose] --sourcefile <file>\n\n--decompress decompress file\n--help display help\n--sourcefile file to be compressed or decompressed\n--verbose add debug output\n--version display program version`)\n}", "func showCmdUsage(cmd *RunCmd) {\n\tvar shell = \"\"\n\t//noinspection GoBoolExpressions\n\tif config.ShowCmdShells {\n\t\tshell = fmt.Sprintf(\" (%s)\", cmd.Shell())\n\t}\n\tif !cmd.EnableHelp() {\n\t\tfmt.Fprintf(config.ErrOut, \"%s%s: No help available.\\n\", cmd.Name, shell)\n\t\treturn\n\t}\n\t// Usages\n\t//\n\tfor i, usage := range cmd.Config.Usages {\n\t\tor := \"or\"\n\t\tif i == 0 {\n\t\t\tfmt.Fprintf(config.ErrOut, \"Usage:\\n\")\n\t\t\tor = \" \" // 2 spaces\n\t\t}\n\t\tpad := strings.Repeat(\" \", len(cmd.Name)-1)\n\t\tif usage[0] == '(' {\n\t\t\tfmt.Fprintf(config.ErrOut, \" %s %s\\n\", pad, usage)\n\t\t} else {\n\t\t\tfmt.Fprintf(config.ErrOut, \" %s %s %s\\n\", or, cmd.Name, usage)\n\t\t}\n\t}\n\thasHelpShort := false\n\thasHelpLong := false\n\tfor _, opt := range cmd.Config.Opts {\n\t\tif opt.Short == 'h' {\n\t\t\thasHelpShort = true\n\t\t}\n\t\tif opt.Long == \"help\" {\n\t\t\thasHelpLong = true\n\t\t}\n\t}\n\t// Options\n\t//\n\tif len(cmd.Config.Opts) > 0 {\n\t\tfmt.Fprintln(config.ErrOut, \"Options:\")\n\t\tif !hasHelpShort || !hasHelpLong {\n\t\t\tswitch {\n\t\t\tcase !hasHelpShort && hasHelpLong:\n\t\t\t\tfmt.Fprintln(config.ErrOut, \" -h\")\n\t\t\tcase hasHelpShort && !hasHelpLong:\n\t\t\t\tfmt.Fprintln(config.ErrOut, \" --help\")\n\t\t\tdefault:\n\t\t\t\tfmt.Fprintln(config.ErrOut, \" -h, --help\")\n\t\t\t}\n\t\t\tfmt.Fprintln(config.ErrOut, \" Show full help screen\")\n\t\t}\n\t}\n\tfor _, opt := range cmd.Config.Opts {\n\t\tb := &strings.Builder{}\n\t\tb.WriteString(\" \")\n\t\tif opt.Short != 0 {\n\t\t\tb.WriteRune('-')\n\t\t\tb.WriteRune(opt.Short)\n\t\t}\n\t\tif opt.Long != \"\" {\n\t\t\tif opt.Short != 0 {\n\t\t\t\tb.WriteString(\", \")\n\t\t\t}\n\t\t\tb.WriteString(\"--\")\n\t\t\tb.WriteString(opt.Long)\n\t\t}\n\t\tif opt.Value != \"\" {\n\t\t\tb.WriteRune(' ')\n\t\t\tb.WriteRune('<')\n\t\t\tb.WriteString(opt.Value)\n\t\t\tb.WriteRune('>')\n\t\t}\n\t\tif opt.Desc != \"\" {\n\t\t\tif opt.Short != 0 && opt.Long == \"\" && opt.Value == \"\" {\n\t\t\t\tb.WriteString(\" \")\n\t\t\t} else {\n\t\t\t\tb.WriteString(\"\\n \")\n\t\t\t}\n\t\t\tb.WriteString(opt.Desc)\n\t\t}\n\t\tfmt.Fprintln(config.ErrOut, b.String())\n\t}\n}", "func (ScrapeHostResourceUtilization) Help() string {\n\treturn \"Collect info from SYS.M_HOST_RESOURCE_UTILIZATION\"\n}", "func CommandHelp(args []string) {\n\tif len(os.Args) > 2 {\n\t\tHelp(os.Args[2])\n\t} else {\n\t\tHelp(\"\")\n\t}\n}", "func printCLIHelp() {\n\tfmt.Println(\"Valid Commands:\")\n\tfmt.Println(\"(if not joined) join intro\")\n\tfmt.Println(\"(if not joined) join [port_number]\")\n\tfmt.Println(\"(if joined) leave\")\n\tfmt.Println(\"(if joined) members\")\n\tfmt.Println(\"(if joined) id\")\n\tfmt.Println(\"(if joined) gossip\")\n\tfmt.Println(\"(if joined) all-to-all\")\n\tfmt.Println(\"(if joined) put [filepath]\")\n\tfmt.Println(\"(if joined) get [filename]\")\n\tfmt.Println(\"(if joined) delete [filename]\")\n\tfmt.Println(\"(if joined) ls [filename]\")\n\tfmt.Println(\"(if joined) store\")\n\tfmt.Println(\"(all scenarios) exit\")\n}", "func (c *TwitterCommand) Help() string {\n\treturn \"Usage: a-know twitter\"\n}", "func (c *Command) Help() string {\n\treturn \"\"\n}", "func (sc *SecretsCommand) Help() string {\n\treturn sc.Synopsis()\n}", "func helpCommand(c *WebsocketConnection, a []string) {\n\tc.WritePrivateMessage(getHelpMessage())\n}", "func (c *NodeInfoCommand) Help() string {\n\treturn `Usage: wallet api nodeinfo\n`\n}", "func (c *Client) Help(cmd ...string) ([]string, error) {\n\tswitch len(cmd) {\n\tcase 0:\n\t\treturn c.Exec(\"help\")\n\tcase 1:\n\t\treturn c.ExecCmd(NewCmd(\"help\").WithArgs(cmd[0]))\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"more than one cmd specified\")\n\t}\n}", "func Help(cmdInfo CommandInfo) {\n\tif len(cmdInfo.CmdOps) == 1 {\n\t\t// When user only writes: ?help\n\t\tprettyPrintHelp(\n\t\t\t\"Error\",\n\t\t\t\"You must query a valid command.\",\n\t\t\tformat(\n\t\t\t\tcreateFields(\"EXAMPLE\", cmdInfo.Prefix+\"help search\", true),\n\t\t\t),\n\t\t\tcmdInfo,\n\t\t\t14886454,\n\t\t)\n\t\treturn\n\t}\n\tfull := strings.Join(cmdInfo.CmdOps[1:], \" \")\n\tif !find(full, cmdInfo) {\n\t\tprettyPrintHelp(\n\t\t\tfull,\n\t\t\t\"Command Not Found\",\n\t\t\tformat(\n\t\t\t\tcreateFields(\"To List All Commands:\", cmdInfo.Prefix+\"list\", true),\n\t\t\t),\n\t\t\tcmdInfo,\n\t\t\t14886454,\n\t\t)\n\t\treturn\n\t}\n\t// Valid commands\n\tswitch full {\n\tcase \"search\":\n\t\tprettyPrintHelp(\n\t\t\t\"Search\",\n\t\t\t\"Search will look up an item from New Horizon's bug and fish database.\",\n\t\t\tformat(\n\t\t\t\tcreateFields(\"EXAMPLE\", cmdInfo.Prefix+\"search emperor butterfly\", true),\n\t\t\t\tcreateFields(\"EXAMPLE\", cmdInfo.Prefix+\"search north bug\", true),\n\t\t\t),\n\t\t\tcmdInfo,\n\t\t\t9410425,\n\t\t)\n\tcase \"list\":\n\t\tprettyPrintHelp(\n\t\t\t\"List\",\n\t\t\t\"List will show all commands the bot understands.\",\n\t\t\tformat(\n\t\t\t\tcreateFields(\"EXAMPLE\", cmdInfo.Prefix+\"list\", true),\n\t\t\t),\n\t\t\tcmdInfo,\n\t\t\t9410425,\n\t\t)\n\tcase \"pong\":\n\t\tprettyPrintHelp(\n\t\t\t\"Pong\",\n\t\t\t\"Playing with pong.\",\n\t\t\tformat(\n\t\t\t\tcreateFields(\"EXAMPLE\", cmdInfo.Prefix+\"pong\", true),\n\t\t\t),\n\t\t\tcmdInfo,\n\t\t\t9410425,\n\t\t)\n\t}\n}", "func Cmd(method, source string, args Options) ([]byte, error) {\n\treturn fetch.Cmd(fetch.Request{\n\t\tMethod: method,\n\t\tURL: fmt.Sprintf(\n\t\t\t\"http://api.pullword.com/%s.php?source=%s&param1=%d&param2=%d\",\n\t\t\tmethod,\n\t\t\tsource,\n\t\t\targs.Threshold,\n\t\t\targs.Debug,\n\t\t),\n\t})\n}", "func ShowHelp() {\n\tfmt.Printf(\"%v\\n\", helpText)\n}", "func (a API) Help(cmd *btcjson.HelpCmd) (e error) {\n\tRPCHandlers[\"help\"].Call <-API{a.Ch, cmd, nil}\n\treturn\n}", "func (c *RestoreCommand) Help() string {\n\treturn `\nUsage: consul-snapshot restore filename.backup\n\nStarts a restore process\n`\n}", "func (c *ImportRawKeyCommand) Help() string {\n\treturn `Usage: keygen api importrawkey [options...]\nOptions:\n -key private key\n -pass passphrase\n`\n}", "func help() {\n\tfmt.Println(\"\\n--------------Command--------------\")\n\tfmt.Println(\"1. status\")\n\tfmt.Println(\"2. input [tipe identitas: string] [nomor identitas: integer]\")\n\tfmt.Println(\"3. leave [nomor loker: integer]\")\n\tfmt.Println(\"4. find [nomor identitas: integer]\")\n\tfmt.Println(\"5. search [tipe identitas: string]\")\n\tfmt.Println(\"6. exit\")\n\tfmt.Println(\"--------------End Command--------------\\n\")\n}", "func (ScrapeVserver) Help() string {\n\treturn \"Collect Netapp Vserver info;\"\n}", "func (suc *SecretsUpdateCommand) Help() string {\n\treturn `Update a secret for your Realm Application.\n\nUsage:\n realm-cli secrets update --name [string] --value [string] [options]\n realm-cli secrets update --id [string] --value [string] [options]\n\nREQUIRED:\n --name [string] OR --id [string]\n\tThe name or ID of your secret.\n\n --value [string]\n\tThe value that your secret is being updated to.\n` +\n\t\tsuc.SecretsBaseCommand.Help()\n}", "func usage() {\n\tfmt.Printf(\"%s\", helpString)\n}", "func DisplayHelp(b *Brute, m *discordgo.MessageCreate, c []*Command) {\n\tif c == nil || len(c) == 0 {\n\t\tmessage := \"Supported commands:\\n\"\n\t\tfor _, cmd := range b.Commands {\n\t\t\tmessage = fmt.Sprintf(\"%s\\n`%s%s`%s\", message, b.Prefix, cmd.Cmd[0], getAliases(cmd.Cmd, b.Prefix))\n\t\t}\n\n\t\tmessage = fmt.Sprintf(\"%s\\n\\nUse `%shelp [command]` for more info about the concrete command\", message, b.Prefix)\n\n\t\t_, err := b.Session.ChannelMessageSend(m.ChannelID, message)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Failed to send message: %v\\n\", err)\n\t\t}\n\n\t\treturn\n\t}\n\n\tfor _, cmd := range c {\n\t\tif cmd != nil {\n\t\t\tDisplayCommandHelp(b, m, cmd)\n\t\t}\n\t}\n}", "func (c *Command) Help() string {\n\t// Some commands with subcommands (kv/snapshot) call this without initializing\n\t// any flags first, so exit early to avoid a panic\n\tif c.flagSet == nil {\n\t\treturn \"\"\n\t}\n\treturn c.helpFlagsFor(c.flagSet)\n}", "func (flags *Flags) Help() string {\n\treturn \"\"\n}", "func (v *ValidateCmd) Help() string {\n\treturn `\nChecks the currently logged in account and verifies its ability to access TFE API. \nIf successful, emits a notification to macOS with the name of the user. \n`\n}", "func printHelp() {\n\t// print help using the flag package default\n\tflag.Usage()\n\t// add the two trailing arguments for source and dest\n\tfmt.Fprintf(os.Stderr, \" source: The source of the copy, either a local file path or an s3 path like s3:bucket:/path\\n\")\n\tfmt.Fprintf(os.Stderr, \" destination: The destination of the copy, in the same format as source (above)\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\nBoth source and destination are required, and one must be an s3 path, another must be a local path\\n\\n\")\n}", "func (c *VsmStatsCommand) Help() string {\n\thelpText := `\nUsage: maya volume stats <volname> \n\n Display Volume Stats information including running status\n and Read/Write.\n\nVolume Stats Options:\n -json \n Output stats in json format\n\n`\n\treturn strings.TrimSpace(helpText)\n}", "func Help(prefix string) string {\n\treturn fmt.Sprintf(\"usage: %s [command] [command_args...]\\n\", prefix) +\n\t\t`Available commands:\n - **help** - shows this message\n\t- **next** - shows information about the next race\n\t- **last** - shows information about the last race\n\t- **current** - shows races for the current season\n\t- **results** - shows information about results\n\t\t- **results circuit <circuit>** - shows historical information about the winners at a given circuit for the last years\n\t\t- **results driver <driver>** - shows last results for a driver\n`\n}", "func Help(args []string) {\n\tpretty.Println(\n\t\t\"[Impatience - Help]:\\n\",\n\t\t\"\t- Avaliable sub commands:\\n\",\n\t\t\"\t\tº launch\\n\",\n\t\t\"\t\tº init\\n\",\n\t\t\"\t\tº help\\n\",\n\t\t\"------------------------------------------\\n\\n\",\n\t\t// Launch\n\t\t\"# command \\\"launch\\\": \\n\",\n\t\t\"Launches a new web server.\\n\",\n\t\t\"\t--address, -a server address\\n\",\n\t\t\"\t--cache, -s cache strategy, as of now only \\\"cookie\\\" is valid\\n\",\n\t\t\"\t--config, -c path for a JSON configuration\\n\",\n\t\t\"\t--node, -n path to node_modules root\\n\",\n\t\t\"\t--node-ext file extensions that shall be analyzed looking for node libraries\\n\",\n\t\t\"\t--port, -p TCP port the server shall be launched in\\n\",\n\t\t\"\t--root, -r public root that shall be served by Impatience\\n\",\n\t\t\"\t--ts enable ts support, you may specify the path to tsconfig\\n\",\n\t)\n}", "func PrintCmdHelp(toolName string, command Command) {\n\tbw := bufio.NewWriter(os.Stdout)\n\n\tdata := struct {\n\t\tToolName string\n\t\tCmdUsageLine string\n\t\tCmdLong string\n\t}{\n\t\ttoolName,\n\t\tcommand.OptionInfo().UsageLine,\n\t\tcommand.OptionInfo().Long,\n\t}\n\n\tfgutil.RenderTemplate(bw, tplCmdHelp, data)\n\tbw.Flush()\n}", "func (UninstallCommand) Help() string {\n\treturn heredoc.Docf(`\n\t\tUninstalls a given Helm release.\n\n\t\tIt removes all of the resources associated with the last release of the chart\n\t\tas well as the release history, freeing it up for future use.\n\n\t\tUsage:\n\t\t helm uninstall RELEASE_NAME [...] [flags]\n\n\t\tAliases:\n\t\t uninstall, del, delete, un\n\n\t\tFlags:\n\t\t%s\n\t`, indent.String(renderSupportedFlags(SupportedUninstallFlags{}), 4))\n}", "func (cmd RemoteCmd) Description() string {\n\treturn \"Manage set of tracked repositories.\"\n}", "func showHelp(exitStatus int) {\n\tfmt.Print(help.Help)\n\n\tos.Exit(exitStatus)\n}", "func (p *ReminderPlugin) Help(bot *bruxism.Bot, service bruxism.Service, message bruxism.Message, detailed bool) []string {\n\thelp := []string{\n\t\tbruxism.CommandHelp(service, \"reminder\", \"<time> <reminder>\", \"Sets a reminder that is sent after the provided time.\")[0],\n\t\tbruxism.CommandHelp(service, \"reminderlist\", \"\", \"List all active reminders.\")[0],\n\t\tbruxism.CommandHelp(service, \"reminderdelete\", \"<index>\", \"Deletes a reminder by index. eg: reminderdelete 0\")[0],\n\t}\n\tif detailed {\n\t\thelp = append(help, []string{\n\t\t\t\"Examples: \",\n\t\t\tp.randomReminder(service),\n\t\t\tp.randomReminder(service),\n\t\t}...)\n\t}\n\treturn help\n}", "func (c *DisplayCommand) Help() string {\n\thelpText := `\nUsage: blinky display [options]\n\tDisplay system informations\nOptions:\n\t--debug Debug mode enabled\n`\n\treturn strings.TrimSpace(helpText)\n}", "func (s *GlobalLookupFactory) Help() string {\n\treturn \"\"\n}", "func (c VerifyCmd) Help() string {\n\thelpText := `\nUsage: gtm verify <version-constraint>\n\n Check if gtm satisfies a Semantic Version 2.0 constraint.\n`\n\treturn strings.TrimSpace(helpText)\n}", "func (pull *LibcomposePullProperty) Description() string {\n\treturn \"When building, pull all images before using them?\"\n}", "func Help(args []string, cmds []*command.Command) int {\n\tvar (\n\t\tcmd string\n\t)\n\tif len(args) >= 3 {\n\t\tcmd = args[2]\n\t}\n\t// Prints the help if the command exist.\n\tfor _, c := range cmds {\n\t\tif c.Name() == cmd {\n\t\t\treturn c.Usage()\n\t\t}\n\t}\n\tif cmd == \"\" {\n\t\tfmt.Fprintf(os.Stderr, \"missing help command. Usage:\\n\\n\\t$ bw help [command]\\n\\nAvailable help commands\\n\\n\")\n\t\tvar usage []string\n\t\tfor _, c := range cmds {\n\t\t\tname := c.Name()\n\t\t\tfor i := len(name); i < 12; i++ {\n\t\t\t\tname += \" \"\n\t\t\t}\n\t\t\tusage = append(usage, fmt.Sprintf(\"\\t%s\\t- %s\\n\", name, c.Short))\n\t\t}\n\t\tsort.Strings(usage)\n\t\tfor _, u := range usage {\n\t\t\tfmt.Fprint(os.Stderr, u)\n\t\t}\n\t\tfmt.Fprintln(os.Stderr, \"\")\n\t\treturn 0\n\t}\n\tfmt.Fprintf(os.Stderr, \"help command %q not recognized. Usage:\\n\\n\\t$ bw help\\n\\n\", cmd)\n\treturn 2\n}", "func (p *Plugin) Help() {\n\tfmt.Println(\"\tgump: Initialize an empty .version.sh file.\")\n\tfmt.Println(\"\tgump:user/repo: Initialize a .version.sh file downloaded from github.com/user/repo/.version.sh.\")\n}", "func (vm *VM) ExportVulnsHelp(cmd *cobra.Command, args []string) {\n\tfmt.Printf(\"tiogo version %s (%s)\", ReleaseVersion, GitHash)\n\tif vm.Config.VM.Log.IsLevelEnabled(log.DebugLevel) {\n\t\tfmt.Println(spew.Print(vm.Config))\n\t}\n\n\tcli := ui.NewCLI(vm.Config)\n\tfmt.Println(cli.Render(\"exportVulnsUsage\", nil))\n\n\treturn\n}", "func PrintHelp() {\n\n\thelpString := `\n Usage: ./nexus-repository-cli.exe [option] [parameters...]\n\n [options]\n -list\n List the repositories in Nexus. Optional parameters: repoType, repoPolicy\n -create\n Create a repository in Nexus. Required parameter: repoId, repoType, provider, repoPolicy (only for maven2). Optional parameter: exposed\n -delete\n Delete a repository in Nexus. Required parameter: repoId\n -addRepoToGroup\n Add a reposirory to a group repository. Required parameters: repoId, repositories\n\n [parameters]\n -nexusUrl string\n Nexus server URL (default \"http://localhost:8081/nexus\")\n -exposed\n Set this flag to expose the repository in nexus.\n -username string\n Username for authentication\n -password string\n Password for authentication\n -repoId string\n ID of the Repository\n -repoType string\n Type of a repository. Possible values : hosted/proxy/group\n -repoPolicy string\n Policy of the hosted repository. Possible values : snapshot/release\n -provider string\n Repository provider. Possible values: maven2/npm/nuget\n -remoteStorageUrl string\n Remote storage url to proxy in Nexus\n -repositories string\n Comma separated value of repositories to be added to a group.\n -verbose\n Set this flag for Debug logs.\n\t`\n\n\tflag.Usage = func() {\n\t\tfmt.Fprintf(os.Stderr, helpString)\n\t}\n}", "func (c *initCommand) Help() string {\n\treturn initHelp\n}", "func (srv *Server) Help() string {\n\thelp := \"Usage: docker COMMAND [arg...]\\n\\nA self-sufficient runtime for linux containers.\\n\\nCommands:\\n\"\n\tfor _, cmd := range [][]string{\n\t\t{\"attach\", \"Attach to a running container\"},\n\t\t{\"commit\", \"Create a new image from a container's changes\"},\n\t\t{\"diff\", \"Inspect changes on a container's filesystem\"},\n\t\t{\"export\", \"Stream the contents of a container as a tar archive\"},\n\t\t{\"history\", \"Show the history of an image\"},\n\t\t{\"images\", \"List images\"},\n\t\t{\"import\", \"Create a new filesystem image from the contents of a tarball\"},\n\t\t{\"info\", \"Display system-wide information\"},\n\t\t{\"inspect\", \"Return low-level information on a container\"},\n\t\t{\"kill\", \"Kill a running container\"},\n\t\t{\"login\", \"Register or Login to the docker registry server\"},\n\t\t{\"logs\", \"Fetch the logs of a container\"},\n\t\t{\"port\", \"Lookup the public-facing port which is NAT-ed to PRIVATE_PORT\"},\n\t\t{\"ps\", \"List containers\"},\n\t\t{\"pull\", \"Pull an image or a repository from the docker registry server\"},\n\t\t{\"push\", \"Push an image or a repository to the docker registry server\"},\n\t\t{\"restart\", \"Restart a running container\"},\n\t\t{\"rm\", \"Remove a container\"},\n\t\t{\"rmi\", \"Remove an image\"},\n\t\t{\"run\", \"Run a command in a new container\"},\n\t\t{\"start\", \"Start a stopped container\"},\n\t\t{\"stop\", \"Stop a running container\"},\n\t\t{\"tag\", \"Tag an image into a repository\"},\n\t\t{\"version\", \"Show the docker version information\"},\n\t\t{\"wait\", \"Block until a container stops, then print its exit code\"},\n\t} {\n\t\thelp += fmt.Sprintf(\" %-10.10s%s\\n\", cmd[0], cmd[1])\n\t}\n\treturn help\n}", "func usage() {\n\tfor _, key := range commandKeys {\n\t\tfmt.Printf(\"%v\\n\", commands[key])\n\t}\n\n}", "func usage() {\n\tfor _, key := range commandKeys {\n\t\tfmt.Printf(\"%v\\n\", commands[key])\n\t}\n\n}", "func (c *GetOfflineCommand) Help() string {\n\tif len(c.helpText) == 0 {\n\t\tt, _ := template.New(\"GetOfflineCommandHelp\").Parse(getCommandHelp)\n\t\tparams := getCommandHelpParams{cliutil.SsmCliName, getCommand, sendCommand, cliutil.FormatFlag(getCommandCommandID), cliutil.FormatFlag(getCommandDetails)}\n\t\tbuf := new(bytes.Buffer)\n\t\tt.Execute(buf, params)\n\t\tc.helpText = buf.String()\n\t}\n\treturn c.helpText\n}", "func (c *RunCommand) Help() string {\n\thelpText := `\nsource_fileをコンパイル後、problem_noで指定された番号の問題のテストを実行する\n\nUsage:\n\tgoyuki run problem_no source_file\n\nOptions:\n\t-language=lang, -l\t\t実行する言語を指定します (デフォルト 拡張子から判別)\n\t-validater=validater, -V テストの一致方法を指定します (デフォルト diff validater)\n\t-verbose, -vb\t\tコンパイル時、実行時の標準出力、標準エラー出力を表示する\n\t-place=n, -p\t\t\t出力される数値を小数点以下n桁に丸める (float validater時のみ) (0<=n<=15)\n\n\n`\n\treturn strings.TrimSpace(helpText)\n}", "func ShowCmdHelp(cmd *RunCmd) {\n\tvar shell = \"\"\n\t//noinspection GoBoolExpressions\n\tif config.ShowCmdShells {\n\t\tshell = fmt.Sprintf(\" (%s)\", cmd.Shell())\n\t}\n\n\tif !cmd.EnableHelp() {\n\t\tfmt.Fprintf(config.ErrOut, \"%s%s: No help available.\\n\", cmd.Name, shell)\n\t\treturn\n\t}\n\tfmt.Fprintf(config.ErrOut, \"%s%s:\\n\", cmd.Name, shell)\n\t// Desc\n\t//\n\tif len(cmd.Config.Desc) > 0 {\n\t\tfor _, desc := range cmd.Config.Desc {\n\t\t\tfmt.Fprintf(config.ErrOut, \" %s\\n\", desc)\n\t\t}\n\t\t// } else {\n\t\t// \tfmt.Fprintf(errOut, \"%s:\\n\", cmd.name)\n\t}\n\tshowCmdUsage(cmd)\n}", "func showHelp(s string) {\n var commands = setHelpCommands()\n fmt.Println(\"gobash> showing help\")\n switch s {\n case \"all\", \"help\", \"h\", \"?\":\n color.Green(\"%v\\n\", commands[\"help\"])\n color.Green(\"%v\\n\", commands[\"cd\"])\n color.Green(\"%v\\n\", commands[\"ls\"])\n color.Green(\"%v\\n\", commands[\"exec\"])\n color.Green(\"%v\\n\", commands[\"exit\"])\n case \"cd\":\n color.Green(\"%v\\n\", commands[\"cd\"])\n case \"ls\":\n color.Green(\"%v\\n\", commands[\"ls\"])\n case \"exec\":\n color.Green(\"%v\\n\", commands[\"exec\"])\n case \"exit\":\n color.Green(\"%v\\n\", commands[\"exit\"])\n default:\n color.Red(\"help command unrecognized\")\n }\n}", "func OptionsHelpTemplate() string {\n\treturn \"\"\n}", "func (cp *CmdExit) Help() string {\n\treturn `exit\n\tTerminates the process and returns control to the shell.`\n}", "func (c *DeleteCommand) Help() string {\n\thelpText := `\nUsage: sloppy delete [OPTIONS] PROJECT[/SERVICE[/APP]]\n\n Deletes the given project, service or application\n\nOptions:\n\n -f, --force=false Force the deletion of a given project, service or an app\n\nExamples:\n\n sloppy delete letschat\n sloppy delete -f letschat/frontend\n sloppy delete letschat/frontend/apache\n`\n\treturn strings.TrimSpace(helpText)\n}", "func List(repo name.Repository, options ...Option) ([]string, error) {\n\to, err := makeOptions(options...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn newPuller(o).List(o.context, repo)\n}", "func printHelp(parser *flags.Parser) {\n\tparser.WriteHelp(os.Stderr)\n\tos.Exit(0)\n}", "func ShowHelp() {\n\tfmt.Println(`Usage of ./kube-ipam:\n -help\n Display usage help information of kube-ipam.\n -outputconf string\n Generate the configuration files required by different CNI plug-ins.(Use with \"macvlan | ipvlan | kube-router | bridge | flannel\")\n -version\n Display software version information of kube-ipam.\n `)\n}", "func PullOptions(opts ...PullOption) *PullSettings {\n\toptions := &PullSettings{\n\t\tLimit: -1,\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(options)\n\t}\n\treturn options\n}", "func (ScrapeBrokerStatus) Help() string {\n\treturn \"Scrape information from brokerStatusQuery\"\n}", "func (fv *UDPAddrs) Help() string {\n\treturn \"a UDP address\"\n}", "func Usage() {\n\t// To embed the bot user and password comment the line above and uncomment the line below\n\tfmt.Printf(\"Usage: %v -i <ip address> -p <port> -d <domain name>\\n\", runAs)\n\tflag.PrintDefaults()\n}" ]
[ "0.67475915", "0.6715028", "0.6536846", "0.6511913", "0.63175184", "0.62976", "0.6272036", "0.62529284", "0.6177238", "0.6158495", "0.61454433", "0.613495", "0.6116337", "0.6108647", "0.6097167", "0.6093562", "0.6082107", "0.60775214", "0.6075261", "0.60701317", "0.6062361", "0.60329705", "0.60326374", "0.6031859", "0.6026639", "0.6018327", "0.6010704", "0.60063404", "0.6005279", "0.6004181", "0.600377", "0.5994041", "0.59932774", "0.5988601", "0.59769595", "0.5976748", "0.59672207", "0.5960101", "0.595585", "0.5948359", "0.5946635", "0.59464884", "0.592177", "0.59170663", "0.59014434", "0.58986366", "0.5889633", "0.5881884", "0.5874312", "0.586951", "0.5863855", "0.5843945", "0.5838042", "0.5828985", "0.5822384", "0.5817133", "0.5813989", "0.58095694", "0.5799928", "0.57908213", "0.5773593", "0.5761448", "0.57567745", "0.5754472", "0.57366383", "0.5735627", "0.5734887", "0.57338744", "0.5730857", "0.5729456", "0.57291895", "0.57282585", "0.5728194", "0.57233787", "0.571692", "0.5700233", "0.56900877", "0.5682619", "0.5681778", "0.5675187", "0.56728625", "0.5662894", "0.565907", "0.56487346", "0.56427246", "0.56427246", "0.5636505", "0.563122", "0.56267226", "0.5622589", "0.56138104", "0.5612574", "0.56061053", "0.5599219", "0.5595074", "0.55923754", "0.5579033", "0.55677164", "0.556376", "0.55635226" ]
0.77002186
0
Synopsis displays a synopsis of the pull command.
Synopsis отображает синопсис команды pull.
func (c *PullCommand) Synopsis() string { return "Download the translation files in the current project" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (cmd PullCmd) Description() string {\n\treturn \"Fetch from a dolt remote data repository and merge.\"\n}", "func (c *SyncCommand) Synopsis() string {\n\treturn \"Pull latest on all branches in all repositories\"\n}", "func (c *PullCommand) Help() string {\n\thelpText := `\n\tUsage: phrase pull [options] [LOCALE]\n\n\t Download the translation files in the current project.\n\n\tOptions:\n\n --format=yml See documentation for list of allowed formats\n --target=./phrase/locales Target folder to store locale files\n --tag=foo Limit results to a given tag instead of all translations\n --updated-since=YYYYMMDDHHMMSS Limit results to translations updated after the given date (UTC)\n --include-empty-translations Include empty translations in the result\n --convert-emoji Convert Emoji symbols\n --encoding=utf-8 Convert .strings or .properties with alternate encoding\n --skip-unverified-translations Skip unverified translations in the result\n --secret=YOUR_AUTH_TOKEN The Auth Token to use for this operation instead of the saved one (optional)\n\t`\n\treturn strings.TrimSpace(helpText)\n}", "func pullExample() string {\n\treturn `$ pouch images\nIMAGE ID IMAGE NAME SIZE\nbbc3a0323522 docker.io/library/busybox:latest 703.14 KB\n$ pouch pull docker.io/library/redis:alpine\n$ pouch images\nIMAGE ID IMAGE NAME SIZE\nbbc3a0323522 docker.io/library/busybox:latest 703.14 KB\n0153c5db97e5 docker.io/library/redis:alpine 9.63 MB`\n}", "func (c *ReleaseLatestCommand) Synopsis() string {\n\treturn \"Get the latest release version\"\n}", "func (d *downloadCommand) Synopsis() string {\n\treturn \"Download a specific version of a product.\"\n}", "func (c *GetCommand) Synopsis() string {\n\treturn \"Getting the wiki tree to code\"\n}", "func (c *PushCommand) Synopsis() string {\n\treturn \"Sends resource directly to the peer\"\n}", "func (suc *SecretsUpdateCommand) Synopsis() string {\n\treturn \"Update a secret for your Realm App.\"\n}", "func (pull *LibcomposePullProperty) Description() string {\n\treturn \"When building, pull all images before using them?\"\n}", "func (src *SecretsRemoveCommand) Synopsis() string {\n\treturn \"Remove a secret from your Realm App.\"\n}", "func CmdPullStory(c *cli.Context) {\n\n\tfrom := c.String(\"source\")\n\tsource, err := gitutil.LookupBranchSource(from, true)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Get repo instance\n\troot, _ := os.Getwd()\n\trepo, err := gitutil.GetRepo(root)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tvar remoteName string\n\n\t// Extract source's remote and branch names\n\tsources := strings.Split(source, \"/\")\n\tif len(sources) == 1 {\n\t\tremoteName = \"origin\"\n\t} else {\n\t\tremoteName = sources[0]\n\t}\n\n\t// Fetch from repo before pulling\n\tfmt.Printf(\"Fetching most recent with remote: `%s`\\n\", remoteName)\n\tif err = gitutil.Fetch(repo, remoteName); err != nil {\n\t\t// do not fail entire app even if fetch fails\n\t\tlog.Println(err)\n\t}\n\n\tfmt.Printf(\"Merging %s into local branch\\n\", source)\n\terr = gitutil.Pull(repo, source)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func (d *downloadCommand) Help() string {\n\thelp := `Usage: hashicorp-releases download <product> <version>`\n\treturn help\n}", "func (c *ServeCommand) Synopsis() string {\n\treturn \"Spored Server\"\n}", "func executePull(location string) {\n\tfmt.Println(\"Pulling from \" + location + \" ...\")\n}", "func (slc *SecretsListCommand) Synopsis() string {\n\treturn \"List secrets from your Realm App.\"\n}", "func (c *TwitterCommand) Synopsis() string {\n\treturn \"Display a-know's Twitter account name\"\n}", "func (c *UptimeCommand) Synopsis() string {\n\treturn \"Generate uptime report based on provided arguments\"\n}", "func (cmd *DatasetDownload) Description() string { return cmd.Synopsis() }", "func (c *SetupCommand) Synopsis() string {\n\treturn \"Utility to setup the elos command line interface\"\n}", "func Cmd(method, source string, args Options) ([]byte, error) {\n\treturn fetch.Cmd(fetch.Request{\n\t\tMethod: method,\n\t\tURL: fmt.Sprintf(\n\t\t\t\"http://api.pullword.com/%s.php?source=%s&param1=%d&param2=%d\",\n\t\t\tmethod,\n\t\t\tsource,\n\t\t\targs.Threshold,\n\t\t\targs.Debug,\n\t\t),\n\t})\n}", "func (c *Command) Synopsis() string {\n\treturn \"\"\n}", "func (c *UpdateCommand) Synopsis() string {\n\treturn \"Reread the model configuration and rebuild the working model\"\n}", "func (cmd RemoteCmd) Description() string {\n\treturn \"Manage set of tracked repositories.\"\n}", "func usage() {\n\tfmt.Printf(\"%s\", helpString)\n}", "func (c *RestoreCommand) Help() string {\n\treturn `\nUsage: consul-snapshot restore filename.backup\n\nStarts a restore process\n`\n}", "func execSynopsis(_ int, p *gop.Context) {\n\targs := p.GetArgs(1)\n\tret := doc.Synopsis(args[0].(string))\n\tp.Ret(1, ret)\n}", "func (c *DisplayCommand) Synopsis() string {\n\treturn \"Display system informations\"\n}", "func (c *PullCommand) Run(args []string) int {\n\tcmdFlags := flag.NewFlagSet(\"pull\", flag.ContinueOnError)\n\tcmdFlags.Usage = func() { c.UI.Output(c.Help()) }\n\n\tconfig := c.Config\n\n\tcmdFlags.StringVar(&config.Secret, \"secret\", config.Secret, \"\")\n\tcmdFlags.StringVar(&config.TargetDirectory, \"target\", config.TargetDirectory, \"\")\n\tcmdFlags.StringVar(&config.Encoding, \"encoding\", config.Encoding, \"\")\n\tcmdFlags.StringVar(&config.Format, \"format\", config.Format, \"\")\n\n\treq := new(phrase.DownloadRequest)\n\tcmdFlags.StringVar(&req.Tag, \"tag\", \"\", \"\")\n\tvar updatedSince string\n\tcmdFlags.StringVar(&updatedSince, \"updated-since\", \"\", \"\")\n\tcmdFlags.BoolVar(&req.ConvertEmoji, \"convert-emoji\", false, \"\")\n\tcmdFlags.BoolVar(&req.SkipUnverifiedTranslations, \"skip-unverified-translations\", false, \"\")\n\tcmdFlags.BoolVar(&req.IncludeEmptyTranslations, \"include-empty-translations\", false, \"\")\n\n\tif err := cmdFlags.Parse(args); err != nil {\n\t\treturn 1\n\t}\n\n\tif updatedSince != \"\" {\n\t\tvar err error\n\t\treq.UpdatedSince, err = time.Parse(timeFormat, updatedSince)\n\t\tif err != nil {\n\t\t\tc.UI.Error(fmt.Sprintf(\"Error parsing updated-since (%s), format should be YYYYMMDDHHMMSS\", updatedSince))\n\t\t\treturn 1\n\t\t}\n\t}\n\n\tif config.Format == \"\" {\n\t\tconfig.Format = defaultDownloadFormat\n\t}\n\n\tc.API.AuthToken = config.Secret\n\treq.Encoding = config.Encoding\n\treq.Format = config.Format\n\n\tif err := config.Valid(); err != nil {\n\t\tc.UI.Error(err.Error())\n\t\treturn 1\n\t}\n\n\terr := c.fetch(req, cmdFlags.Args())\n\tif err != nil {\n\t\tc.UI.Error(fmt.Sprintf(\"Error encountered fetching the locales:\\n\\t%s\", err.Error()))\n\t\treturn 1\n\t}\n\treturn 0\n}", "func (c *SystemCommand) Synopsis() string {\n\treturn \"Display system informations\"\n}", "func Help() string {\n\treturn \"Commands are detailled here : https://github.com/eze-kiel/irc-bot/blob/master/README.md\"\n}", "func (c *SSCommand) Synopsis() string {\n\treturn \"Snapshot instance & create AMI\"\n}", "func (c *ReleaseLatestCommand) Help() string {\n\thelpText := `\nUsage: tfupdate release latest [options] <SOURCE>\n\nArguments\n SOURCE A path of release data source.\n Valid format depends on --source-type option.\n - github or gitlab:\n owner/repo\n e.g. terraform-providers/terraform-provider-aws\n - tfregistryModule\n namespace/name/provider\n e.g. terraform-aws-modules/vpc/aws\n - tfregistryProvider (experimental)\n namespace/type\n e.g. hashicorp/aws\n\nOptions:\n -s --source-type A type of release data source.\n Valid values are\n - github (default)\n - gitlab\n - tfregistryModule\n - tfregistryProvider (experimental)\n`\n\treturn strings.TrimSpace(helpText)\n}", "func (sc *SecretsCommand) Synopsis() string {\n\treturn \"Add or remove secrets for your Realm App.\"\n}", "func (c *LockCommand) Synopsis() string {\n\treturn \"Update dependency lock files\"\n}", "func (c *GetAddressInfoCommand) Synopsis() string {\n\treturn c.synopsis\n}", "func PullCommand() cli.Command {\n\treturn cli.Command{\n\t\tName: \"pull\",\n\t\tUsage: \"Pull an image from an Amazon ECR repository.\",\n\t\tArgsUsage: PullImageFormat,\n\t\tBefore: ecscli.BeforeApp,\n\t\tAction: ImagePull,\n\t\tFlags: []cli.Flag{\n\t\t\tcli.StringFlag{\n\t\t\t\tName: ecscli.RegistryIdFlag,\n\t\t\t\tUsage: \"[Optional] Specifies the the Amazon ECR registry ID to pull the image from. By default, images are pulled from the current AWS account.\",\n\t\t\t},\n\t\t},\n\t}\n}", "func (i *ImageInspectCommand) example() string {\n\treturn `$ pouch image inspect docker.io/library/busybox\n{\n \"CreatedAt\": \"2017-12-21 04:30:57\",\n \"Digest\": \"sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0\",\n \"ID\": \"bbc3a0323522\",\n \"Name\": \"docker.io/library/busybox:latest\",\n \"Size\": 720019,\n \"Tag\": \"latest\"\n}`\n}", "func usage() {\n\tdoc := heredoc.Doc(`\n\t\tExample:\n\t\t./koro docker <name> address add 127.0.0.3/24 dev lo\n\t`)\n\tfmt.Print(doc)\n}", "func (c *config) pull(remote string, branch string) (output string, err error) {\n\tlog.Printf(\"pulling: %v/%v\", remote, branch)\n\n\tdefaultCommand := []string{\"pull\", remote, branch}\n\n\treturn c.command(defaultCommand...)\n}", "func (c *PushCommand) Help() string {\n\treturn `\nUsage: filegate push [options] file\n ` + c.Synopsis() + `.\nOptions:\n --signaling-server=signaling_server Signaling endpoint, used by peers to exchange session description.\n --stun-servers=stun_server_1,stun_server_2,... STUN servers for traversal of NAT gateways.\n`\n}", "func PrintUsage() {\n\tfmt.Fprintln(os.Stdout, \"Usage: gitio [-code=] url\\nIf you will be use any code, set code flag\")\n}", "func (g *Getter) PrintHelp(indent string) {\n\tfmt.Println(indent, \"The get command downloads and installs a Fyne application.\")\n\tfmt.Println(indent, \"A single parameter is required to specify the Go package, as with \\\"go get\\\"\")\n}", "func (sac *SecretsAddCommand) Synopsis() string {\n\treturn \"Add a secret to your Realm App.\"\n}", "func (c *Ping) Help() string {\n\treturn `Usage: PING [message] Returns PONG if no argument is provided, otherwise return a copy of the argument as a bulk.`\n}", "func (d docker) Pull(ctx context.Context, image string) error {\n\tr, err := d.CLI.ImagePull(ctx, image, types.ImagePullOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tio.Copy(os.Stdout, r)\n\tdefer r.Close()\n\treturn nil\n}", "func UsageCommands() string {\n\treturn `want-go (get-simple-card-list|get-card-info|post-card-info|put-card-info|delete-card-info)\n`\n}", "func pullCmd(c *cli.Context) error {\n\tvar fqRegistries []string\n\n\targs := c.Args()\n\tif len(args) == 0 {\n\t\tlogrus.Errorf(\"an image name must be specified\")\n\t\treturn nil\n\t}\n\tif len(args) > 1 {\n\t\tlogrus.Errorf(\"too many arguments. Requires exactly 1\")\n\t\treturn nil\n\t}\n\timage := args[0]\n\tsrcRef, err := alltransports.ParseImageName(image)\n\tif err != nil {\n\t\tfqRegistries, err = getRegistriesToTry(image)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t} else {\n\t\tfqRegistries = append(fqRegistries, srcRef.DockerReference().String())\n\t}\n\truntime, err := getRuntime(c)\n\tdefer runtime.Shutdown(false)\n\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"could not create runtime\")\n\t}\n\tfor _, fqname := range fqRegistries {\n\t\tfmt.Printf(\"Trying to pull %s...\", fqname)\n\t\tif err := runtime.PullImage(fqname, c.Bool(\"all-tags\"), os.Stdout); err != nil {\n\t\t\tfmt.Printf(\" Failed\\n\")\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn errors.Errorf(\"error pulling image from %q\", image)\n}", "func ShowUsage() {\n\tprintln(\"Usage:\\n\\thref_links <html source file>\\n\\tRead content from stdin: href_links -\\ne.g. curl https://example.com/ | href_links -\\nBy default utility tries read ./home.html\")\n\n}", "func (c *NodeInfoCommand) Synopsis() string {\n\treturn c.synopsis\n}", "func (pull *LibcomposePullProperty) Usage() api_usage.Usage {\n\treturn api_property.Usage_Optional()\n}", "func (c *VersionCommand) Usage() {\n\tfmt.Println(`\nPrints the version.\n\nUsage:\n\n\tlitestream version\n`[1:])\n}", "func (cmd *DatasetDownload) Synopsis() string {\n\treturn \"Download results from a running job.\"\n}", "func (sc *SecretsCommand) Help() string {\n\treturn sc.Synopsis()\n}", "func (service Service) PullCommand() Command {\n\treturn Command{\n\t\tMain: \"docker\",\n\t\tArgs: []string{\"pull\", service.Image},\n\t}\n}", "func (cli Client) ImagePull(options v1alpha1.OCIPullOptions) (v1alpha1.OCIPullResponse, error) {\n\n\tpullFlags := []command.Flag{\n\t\t// Buildah registry auth in format username[:password]\n\t\t{Name: \"creds\", Value: options.RegistryAuth, Short: false, OmitEmpty: true},\n\t}\n\n\tcmd := command.Builder(\"buildah\").Command(\"pull\").Flags(pullFlags...).Args(options.Ref).Build()\n\tcli.Logger.WithField(\"cmd\", cmd).Debugln(\"executing pull with command\")\n\n\tstdout, stderr, err := execute(&cmd)\n\tif err != nil {\n\t\tcli.Logger.WithError(err).Errorln(\"error building image...\")\n\t\treturn v1alpha1.OCIPullResponse{}, err\n\t}\n\treturn v1alpha1.OCIPullResponse{\n\t\tBody: stdout,\n\t\tExec: &cmd,\n\t\tStderr: stderr,\n\t}, nil\n}", "func (a *RESTAgent) Synopsis() string {\n\treturn \"Boot REST API agent\"\n}", "func (c *TwitterCommand) Help() string {\n\treturn \"Usage: a-know twitter\"\n}", "func (src *SecretsRemoveCommand) Help() string {\n\treturn `Remove a secret from your Realm Application.\n\nUsage:\n realm-cli secrets remove --name [string] [options]\n realm-cli secrets remove --id [string] [options]\n\nREQUIRED:\n --name [string] OR --id [string]\n\tThe name or ID of your secret.\n` +\n\t\tsrc.SecretsBaseCommand.Help()\n}", "func PrintHelp() {\n\tfmt.Print(usage)\n}", "func (r *Repository) Pull(o *PullOptions) error {\n\tif err := o.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\tremote, err := r.Remote(o.RemoteName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = remote.Connect(); err != nil {\n\t\treturn err\n\t}\n\n\tdefer remote.Disconnect()\n\n\thead, err := remote.Ref(o.ReferenceName, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = remote.Connect(); err != nil {\n\t\treturn err\n\t}\n\n\tdefer remote.Disconnect()\n\n\terr = remote.Fetch(&FetchOptions{\n\t\tDepth: o.Depth,\n\t})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn r.createReferences(head)\n}", "func (c *DialDeleteCommand) usage() {\n\tfmt.Println(`\nDelete an existing dial.\n\nUsage:\n\n\twtf dial delete DIAL_ID\n`[1:])\n}", "func (c *initCommand) Synopsis() string {\n\treturn initSynopsis\n}", "func describe(s selection, args []string) {\n\tfmt.Println(runWithStdin(s.archive(), \"guru\", \"-modified\", \"describe\", s.pos()))\n}", "func help() {\r\n fmt.Printf(\"ORIGAMI\\n\")\r\n fmt.Printf(\"\\tA web app that checks the toner levels of printers at the Elizabethtown College campus.\\n\\n\")\r\n fmt.Printf(\"USAGE\\n\")\r\n fmt.Printf(\"\\tUsage: origami [-f filepath | -h]\\n\\n\")\r\n fmt.Printf(\"OPTIONS\\n\")\r\n fmt.Printf(\"\\t-f: specify the filepath of the config file (\\\"./origami.conf\\\" by default)\\n\")\r\n fmt.Printf(\"\\t-h: this menu\\n\\n\")\r\n fmt.Printf(\"AUTHOR\\n\")\r\n fmt.Printf(\"\\tRory Dudley (aka pinecat: https://github.com/pinecat/origamiv2)\\n\\n\")\r\n fmt.Printf(\"EOF\\n\")\r\n}", "func (b *binding) Pull(ctx context.Context, remote, local string) error {\n\treturn b.Command(\"pull\", remote, local).Run(ctx)\n}", "func Usage() {\n\tblue := color.New(color.FgBlue)\n\tcyan := color.New(color.FgCyan)\n\tyellow := color.New(color.FgYellow)\n\n\tblueBold := blue.Add(color.Bold)\n\n\tfmt.Printf(\"Ultralist v%s, simple task management for tech folks.\\n\", VERSION)\n\n\tblueBold.Println(\"\\nAdding todos\")\n\tfmt.Println(\"the 'a' command adds todos.\")\n\tfmt.Println(\"You can also optionally specify a due date.\")\n\tfmt.Println(\"Specify a due date by putting 'due <date>' at the end, where <date> is in (tod|today|tom|tomorrow|mon|tue|wed|thu|fri|sat|sun)\")\n\tfmt.Println(\"\\nExamples for adding a todo:\")\n\tyellow.Println(\"\\tultralist a Meeting with @bob about +importantPrject due today\")\n\tyellow.Println(\"\\tultralist a +work +verify did @john fix the build\\\\?\")\n\n\tblueBold.Println(\"\\nListing todos\")\n\tfmt.Println(\"When listing todos, you can filter and group the output.\")\n\tfmt.Println()\n\n\tfmt.Println(\"ultralist l due (tod|today|tom|tomorrow|overdue|this week|next week|last week|mon|tue|wed|thu|fri|sat|sun|none)\")\n\tfmt.Println(\"ultralist l overdue\")\n\tfmt.Println()\n\n\tcyan.Println(\"Filtering by date:\")\n\tyellow.Println(\"\\tultralist l due tod\")\n\tfmt.Println(\"\\tlists all todos due today\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist l due tom\")\n\tfmt.Println(\"\\tlists all todos due tomorrow\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist l due mon\")\n\tfmt.Println(\"\\tlists all todos due monday\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist l overdue\")\n\tfmt.Println(\"\\tlists all todos where the due date is in the past\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist agenda\")\n\tfmt.Println(\"\\tlists all todos where the due date is today or in the past\")\n\tfmt.Println()\n\n\tyellow.Println(\"\\tultralist l completed (tod|today|this week)\")\n\tfmt.Println(\"\\tshow completed todos.\")\n\tfmt.Println()\n\n\tyellow.Println(\"\\tultralist l completed (tod|today)\")\n\tfmt.Println(\"\\tlists all todos that were completed today\")\n\tfmt.Println()\n\n\tyellow.Println(\"\\tultralist l completed this week\")\n\tfmt.Println(\"\\tlists all todos that were completed this week\")\n\tfmt.Println()\n\n\tcyan.Println(\"Grouping:\")\n\tfmt.Println(\"You can group todos by context or project.\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist l by c\")\n\tfmt.Println(\"\\tlists all todos grouped by context\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist l by p\")\n\tfmt.Println(\"\\tlists all todos grouped by project\")\n\tfmt.Println()\n\n\tcyan.Println(\"Grouping and filtering:\")\n\tfmt.Println(\"Of course, you can combine grouping and filtering to get a nice formatted list.\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist l due today by c\")\n\tfmt.Println(\"\\tlists all todos due today grouped by context\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist l +project due this week by c\")\n\tfmt.Println(\"\\tlists all todos due today for +project, grouped by context\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist l @frank due tom by p\")\n\tfmt.Println(\"\\tlists all todos due tomorrow concerining @frank for +project, grouped by project\")\n\tfmt.Println()\n\n\tblueBold.Println(\"\\nCompleting and uncompleting \")\n\tfmt.Println(\"Complete and Uncomplete a todo by its Id:\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist c 33\")\n\tfmt.Println(\"\\tCompletes a todo with id 33\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist uc 33\")\n\tfmt.Println(\"\\tUncompletes a todo with id 33\")\n\tfmt.Println()\n\n\tblueBold.Println(\"\\nPrioritizing\")\n\tfmt.Println(\"Todos have a priority flag, which will make them bold when listed.\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist p 33\")\n\tfmt.Println(\"\\tPrioritizes a todo with id 33\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist up 33\")\n\tfmt.Println(\"\\tUn-prioritizes a todo with id 33\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist l p\")\n\tfmt.Println(\"\\tlist all priority todos\")\n\tfmt.Println()\n\n\tblueBold.Println(\"\\nArchiving\")\n\tfmt.Println(\"You can archive todos once they are done, or if you might come back to them.\")\n\tfmt.Println(\"By default, todo will only show unarchived todos.\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist ar 33\")\n\tfmt.Println(\"\\tArchives a todo with id 33\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist ac\")\n\tfmt.Println(\"\\tArchives all completed todos\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist l archived\")\n\tfmt.Println(\"\\tlist all archived todos\")\n\tfmt.Println()\n\n\tblueBold.Println(\"\\nEditing due dates\")\n\tyellow.Println(\"\\tultralist e 33 due mon\")\n\tfmt.Println(\"\\tEdits the todo with 33 and sets the due date to this coming Monday\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist e 33 due none\")\n\tfmt.Println(\"\\tEdits the todo with 33 and removes the due date\")\n\tfmt.Println()\n\n\tblueBold.Println(\"\\nDeleting\")\n\tyellow.Println(\"\\tultralist d 33\")\n\tfmt.Println(\"\\tDeletes a todo with id 33\")\n\tfmt.Println()\n\n\tblueBold.Println(\"\\nManipulating notes\")\n\tyellow.Println(\"\\tultralist ln\")\n\tfmt.Println(\"\\tlists all todos with their notes\")\n\tyellow.Println(\"\\tultralist an 12 check http://this.web.site\")\n\tfmt.Println(\"\\tAdds notes \\\"check http://this.web.site\\\" to the todo with id 12\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist n 12\")\n\tfmt.Println(\"\\tLists notes of the todo with id 12\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist dn 12 3\")\n\tfmt.Println(\"\\tDeletes the 3rd note of the todo with id 12\")\n\tfmt.Println()\n\tyellow.Println(\"\\tultralist en 12 3 check http://that.web.site\")\n\tfmt.Println(\"\\tEditing the 3rd note of the todo with id 12 to \\\"http://that.web.site\\\" \")\n\tfmt.Println()\n\n\tblueBold.Println(\"\\nGarbage Collection\")\n\tyellow.Println(\"\\tultralist gc\")\n\tfmt.Println(\"\\tDeletes all archived todos.\")\n\tfmt.Println()\n\n\tblueBold.Println(\"\\nSyncing with ultralist.io\")\n\tfmt.Println(\"\\tPlease see https://docs.ultralist.io/service.html for instructions for syncing.\")\n\tfmt.Println()\n\n\tfmt.Println(\"Ultralist was lovingly crafted by Grant Ammons (https://twitter.com/gammons).\")\n\tfmt.Println(\"For full documentation, please visit http://docs.ultralist.io\")\n}", "func (c *HDKeyCommand) Synopsis() string {\n\treturn c.synopsis\n}", "func showHelp(a *artifact.Artifact) {\n\tlog.Printf(\"Help!\")\n}", "func usage() {\n\tfmt.Fprintf(stderr, \"Usage: %s [<option> ...] [<cmd> [<arg> ...]]\\n\",\n\t\tos.Args[0])\n\n\tfmt.Fprintln(stderr, `\nIf invoked with the -start option, a moss server is started.\nOtherwise, the given command and its arguments are sent to the server.\nSpecifying no command is equivalent to specifying the 'status' command.\n\nOn server start, commands are read from ~/.mossrc or ~/.config/mossrc.`)\n\n\tfmt.Fprint(stderr, `\nCommands:\n add <item> ... append items to the playlist\n assoc <regexp> <cmd> associate cmd with items that match regexp\n clear [<regexp>] remove items matching regexp, or all [deprecated]\n del <index> ... remove items from the playlist\n index <regexp> ... print indices of items matching each regexp\n insert <item> ... insert items after the current item\n kill stop the server and current command\n ls print the current playlist\n lsassoc print the list of command associations\n mv <index> ... <index> move items to the last given index\n next step forward in the playlist\n pause suspend the current command\n play [<index>] resume current command or start command at index\n prev step backward in the playlist\n status [<format>] print information about the current state\n stop kill the current command\n toggle toggle between play and pause states\n unassoc <regexp> ... remove the command association for each regexp\n`)\n\n\tfmt.Fprintln(stderr, `\nThe status command's <format> argument supports the sequences %c, %f, %i, %n,\n%p, %s, and %t, which are replaced with current command, absolute file path of\ncurrent item, index of current item, playlist length, command process ID,\nstatus, and current item, respectively.\n`)\n\n\tfmt.Fprintln(stderr, \"Options:\")\n\tflag.PrintDefaults()\n}", "func (pull *LibcomposePullProperty) Label() string {\n\treturn \"Pull\"\n}", "func (suc *SecretsUpdateCommand) Help() string {\n\treturn `Update a secret for your Realm Application.\n\nUsage:\n realm-cli secrets update --name [string] --value [string] [options]\n realm-cli secrets update --id [string] --value [string] [options]\n\nREQUIRED:\n --name [string] OR --id [string]\n\tThe name or ID of your secret.\n\n --value [string]\n\tThe value that your secret is being updated to.\n` +\n\t\tsuc.SecretsBaseCommand.Help()\n}", "func Help(prefix string) string {\n\treturn fmt.Sprintf(\"usage: %s [command] [command_args...]\\n\", prefix) +\n\t\t`Available commands:\n - **help** - shows this message\n\t- **next** - shows information about the next race\n\t- **last** - shows information about the last race\n\t- **current** - shows races for the current season\n\t- **results** - shows information about results\n\t\t- **results circuit <circuit>** - shows historical information about the winners at a given circuit for the last years\n\t\t- **results driver <driver>** - shows last results for a driver\n`\n}", "func (r *Repo) Pull() error {\n\tr.Lock()\n\tdefer r.Unlock()\n\n\treturn timeout(*cmdTimeout, func() error {\n\t\treturn r.Master.VCS.Download(r.Path)\n\t})\n}", "func (db *DB) Pull(url, ref string) error {\n\tif ref == \"\" {\n\t\tref = db.ref\n\t}\n\trefspec := fmt.Sprintf(\"%s:%s\", ref, db.ref)\n\tfmt.Printf(\"Creating anonymous remote url=%s refspec=%s\\n\", url, refspec)\n\tremote, err := db.repo.CreateAnonymousRemote(url, refspec)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer remote.Free()\n\tif err := remote.Fetch(nil, nil, fmt.Sprintf(\"libpack.pull %s %s\", url, refspec)); err != nil {\n\t\treturn err\n\t}\n\treturn db.Update()\n}", "func help() {\n\tlog.Infoln(\"#: the number of the peer you want to connect to\")\n\tlog.Infoln(\"r: refresh peer list\")\n\tlog.Infoln(\"q: quit pcp\")\n\tlog.Infoln(\"?: this help message\")\n}", "func (c *GetCommand) Help() string {\n\thelpText := `\nUsage :\n\twikible get [options]\n\n\tGet the wiki pages to code.\n\nOptions:\n\t-i parent id\n\t-a wiki address\n`\n\treturn strings.TrimSpace(helpText)\n}", "func (p *PullCommand) runPull(args []string) error {\n\treturn pullMissingImage(context.Background(), p.cli.Client(), args[0], true)\n}", "func (cmd InspectCmd) Description() string {\n\treturn \"Inspects a Dolt Database and collects stats.\"\n}", "func (cmd MergeCmd) Description() string {\n\treturn \"Merge a branch.\"\n}", "func (sac *SecretsAddCommand) Help() string {\n\treturn `Add a secret to your Realm Application.\n\nUsage: realm-cli secrets add --name [string] --value [string] [options]\n\nREQUIRED:\n --name [string]\n\tThe name of your secret.\n\n --value [string]\n\tThe value of your secret.\n` +\n\t\tsac.SecretsBaseCommand.Help()\n}", "func PrintHelp() {\n\n\thelpString := `\n Usage: ./nexus-repository-cli.exe [option] [parameters...]\n\n [options]\n -list\n List the repositories in Nexus. Optional parameters: repoType, repoPolicy\n -create\n Create a repository in Nexus. Required parameter: repoId, repoType, provider, repoPolicy (only for maven2). Optional parameter: exposed\n -delete\n Delete a repository in Nexus. Required parameter: repoId\n -addRepoToGroup\n Add a reposirory to a group repository. Required parameters: repoId, repositories\n\n [parameters]\n -nexusUrl string\n Nexus server URL (default \"http://localhost:8081/nexus\")\n -exposed\n Set this flag to expose the repository in nexus.\n -username string\n Username for authentication\n -password string\n Password for authentication\n -repoId string\n ID of the Repository\n -repoType string\n Type of a repository. Possible values : hosted/proxy/group\n -repoPolicy string\n Policy of the hosted repository. Possible values : snapshot/release\n -provider string\n Repository provider. Possible values: maven2/npm/nuget\n -remoteStorageUrl string\n Remote storage url to proxy in Nexus\n -repositories string\n Comma separated value of repositories to be added to a group.\n -verbose\n Set this flag for Debug logs.\n\t`\n\n\tflag.Usage = func() {\n\t\tfmt.Fprintf(os.Stderr, helpString)\n\t}\n}", "func (up *BaseProvisionUpOperation) Help() string {\n\treturn \"\"\n}", "func (c *DeleteCommand) Synopsis() string {\n\treturn \"Delete a project, a service or an application\"\n}", "func godoc(s selection, args []string) {\n\tfmt.Println(runWithStdin(s.archive(), \"gogetdoc\", \"-modified\", \"-pos\", s.pos()))\n}", "func (gen *Generator) Pull() error {\n\tLog.Info(\"pull\", fmt.Sprintf(\"performing git pull in: %s\", gen.Template.Directory))\n\tGitPull := templates.CommandOptions{\n\t\tCmd: \"git pull\",\n\t\tDir: gen.Template.Directory.ToString(),\n\t\tUseStdOut: true,\n\t}\n\t_, err := templates.Run(GitPull)\n\treturn err\n}", "func (cmd PullCmd) Name() string {\n\treturn \"pull\"\n}", "func help() {\n\tfmt.Println(\"\\n--------------Command--------------\")\n\tfmt.Println(\"1. status\")\n\tfmt.Println(\"2. input [tipe identitas: string] [nomor identitas: integer]\")\n\tfmt.Println(\"3. leave [nomor loker: integer]\")\n\tfmt.Println(\"4. find [nomor identitas: integer]\")\n\tfmt.Println(\"5. search [tipe identitas: string]\")\n\tfmt.Println(\"6. exit\")\n\tfmt.Println(\"--------------End Command--------------\\n\")\n}", "func (get *BaseCommandGetOperation) Help() string {\n\treturn \"\"\n}", "func (c *ImportRawKeyCommand) Synopsis() string {\n\treturn c.synopsis\n}", "func (slc *SecretsListCommand) Help() string {\n\treturn `List secrets from your Realm Application.\n\nUsage: realm-cli secrets list [options]\n` +\n\t\tslc.SecretsBaseCommand.Help()\n}", "func Usage() {\n\t// To embed the bot user and password comment the line above and uncomment the line below\n\tfmt.Printf(\"Usage: %v -i <ip address> -p <port> -d <domain name>\\n\", runAs)\n\tflag.PrintDefaults()\n}", "func (c *VsmStatsCommand) Synopsis() string {\n\treturn \"Display VSM Stats\"\n}", "func Pull(dir, url, auth string, stdout, stderr io.Writer) error {\n\tvar user, password string\n\tif auth != \"\" {\n\t\ta := strings.Split(auth, \":\")\n\t\tuser, password = a[0], a[1]\n\t}\n\n\tswitch true {\n\tcase strings.HasSuffix(url, \".git\"):\n\t\treturn pullGit(dir, url, user, password, stdout, stderr)\n\tdefault:\n\t\treturn errors.New(\"unknown repo type\")\n\t}\n}", "func Synopsis(text string) string {\n\tvar p Package\n\treturn p.Synopsis(text)\n}", "func NewCommandPull() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"pull\",\n\t\tShort: \"Pull a resource from a file or from stdin.\",\n\t\tLong: `YAML or JSON formats are accepted.`,\n\t}\n\n\tcmd.AddCommand(NewCommandPullStudy())\n\t//\tcmd.AddCommand(NewCommandPullModel())\n\n\treturn cmd\n}", "func Pull(c Config) {\n\n\tUpdate(c)\n\n}", "func (b *BotCommands) help(m *tb.Message) {\n\tb.Bot.Reply(m, `\n\tHello, So You Want To Search [Nyaa](https://nyaa.si/) huh? Let me help you with that. So, Here are the commands that you can use right now -\n\n\t/latest _<page no which should be a number>_\n\t*This command fetches you the latest animes available on nyaa on the page as certified.*\n\tNote - If no digit is specified, I fetch the 1 Page Results For You ~ UwU ~.\n\n\t/anime _<search term which can contain whitespaces>_\n\t*This command searches for the search term and fetches all the first page results for you.*\n\tNote - Remember, The term should atleast match for what you are looking for.\n\n\t`)\n}", "func pullMaster(opts RepoOpts) {\n\tcmd := exec.Command(\"git\", \"pull\", \"origin\", \"master\")\n\tcmd.Dir = opts.path\n\t_, err := cmd.Output()\n\tCheckIfError(err)\n\tfmt.Println(\"Pulled in Master: for \" + opts.path)\n}", "func help(cfg cli.Config) {\n\tfmt.Printf(`\n usage:\n scan ip/host [option]\n options:\n -p port-range or port number Specified range or port number (default is %s)\n -c TCP connect scan (default is TCP SYN scan)\n -4 Force IPv4\n -6 Force IPv6\n example:\n scan 8.8.8.8 -p 53\n scan www.google.com -p 1-500\n scan freebsd.org -6\n\t`,\n\t\tcfg.Scan.Port)\n}" ]
[ "0.7215579", "0.69286245", "0.66183007", "0.6583596", "0.6178542", "0.6172102", "0.6038832", "0.6024933", "0.58987576", "0.586869", "0.5860437", "0.58348995", "0.5785484", "0.57617813", "0.5743024", "0.57364047", "0.57247514", "0.5713961", "0.5707902", "0.57045203", "0.5675228", "0.5640683", "0.5639063", "0.5608886", "0.55733407", "0.5545326", "0.5541399", "0.5536424", "0.5535502", "0.5503917", "0.5499914", "0.5486503", "0.54814273", "0.54810804", "0.54781514", "0.5474779", "0.5472751", "0.5465289", "0.54639935", "0.54407245", "0.54258", "0.54172295", "0.54069424", "0.5395331", "0.5395256", "0.53870386", "0.5383543", "0.5381347", "0.53787655", "0.5377998", "0.5363008", "0.536189", "0.5358371", "0.5357744", "0.53575444", "0.5356246", "0.5326305", "0.5313874", "0.53094614", "0.5307545", "0.52994573", "0.5296571", "0.52794117", "0.52648675", "0.5257157", "0.52554697", "0.5250427", "0.5247688", "0.52476424", "0.5247044", "0.52441037", "0.52379596", "0.52363306", "0.52346814", "0.5223258", "0.5217802", "0.5206852", "0.51972044", "0.5193839", "0.5193688", "0.5188494", "0.51872146", "0.5184524", "0.51719975", "0.51716524", "0.5166776", "0.51654595", "0.51603806", "0.51599103", "0.51562726", "0.5150859", "0.513842", "0.5136236", "0.5119698", "0.51086974", "0.5108527", "0.51030326", "0.51014394", "0.5091997", "0.50915134" ]
0.77371424
0
New returns a new instance of an echo HTTP server
New возвращает новый экземпляр сервера HTTP-эхо
func New() Server { return &echoServer{ Instance: echo.New(), } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func New(address string, branch string, secret string, logger *logrus.Logger) http.Handler {\n\tproto := \"tcp\"\n\taddr := address\n\tif strings.HasPrefix(addr, \"unix:\") {\n\t\tproto = \"unix\"\n\t\taddr = addr[5:]\n\t}\n\treturn &Server{\n\t\tproto: proto,\n\t\taddress: addr,\n\t\tbranch: branch,\n\t\tsecret: secret,\n\t\tlogger: logger,\n\t}\n}", "func New(host, port string, h http.Handler) *WebServer {\n\tvar ws WebServer\n\n\tws.Addr = net.JoinHostPort(host, port)\n\tws.Handler = h\n\n\treturn &ws\n}", "func New(app application.App) *http.Server {\n\te := echo.New()\n\tlog := logger.New()\n\n\tb := binder.New()\n\te.Binder = b\n\n\te.Use(metrics.Middleware(app.Metrics))\n\te.Use(logger.Middleware())\n\te.Use(recovery.Middleware())\n\n\tsentryecho.RegisterErrorHandlerWithOptions(e, sentryecho.Options{\n\t\tReporter: &app.Sentry,\n\t\tEnableCustomErrorMessages: true,\n\t})\n\n\thealth.RegisterRoutes(e)\n\tclusters.RegisterRoutes(e, app)\n\n\tsrv := &http.Server{\n\t\tAddr: fmt.Sprintf(\":%d\", app.Config.Port),\n\t\tHandler: e,\n\t\tReadTimeout: 65 * time.Second,\n\t\tWriteTimeout: 65 * time.Second,\n\t}\n\n\tgraceful := signals.Setup()\n\n\tgo func() {\n\t\t<-graceful\n\t\terr := srv.Shutdown(context.Background())\n\t\tif err != nil {\n\t\t\tlog.Err(err).Error(\"server shutdown\")\n\t\t}\n\t}()\n\n\treturn srv\n}", "func New() HelloServer {\n\thttp.DefaultServeMux = new(http.ServeMux)\n\treturn HelloServer{\n\t\t&http.Server{\n\t\t\tAddr: \":7100\",\n\t\t},\n\t}\n}", "func New() *Server {\n\tsv := &Server{\n\t\tE: echo.New(),\n\t\tH: handlers.New(),\n\t}\n\tsv.routes()\n\treturn sv\n}", "func New(c *controller.Controller) *Server {\n\ts := &Server{\n\t\te: echo.New(),\n\t\tc: c,\n\t}\n\n\t// Middleware\n\ts.e.Use(middleware.Logger())\n\ts.e.Use(middleware.Recover())\n\n\ts.populateRoutes()\n\n\treturn s\n}", "func New() *echo.Echo {\n\te := echo.New()\n\n\te.Use(middleware.Recover())\n\te.Use(middleware.CORS())\n\te.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{Format: loggerFormat()}))\n\n\tGetRoutes(e)\n\n\te.HideBanner = true\n\te.Logger.Fatal(e.Start(\":\" + \"9090\"))\n\treturn e\n}", "func New(config Configuration, storage storage.Storage, groups map[string]groups.Group) *HTTPServer {\n\treturn &HTTPServer{\n\t\tConfig: config,\n\t\tStorage: storage,\n\t\tGroups: groups,\n\t}\n}", "func New(server *http.Server) (*Server, error) {\n\tlistener, err := zerodown.Listen(\"tcp\", server.Addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Server{\n\t\tserver: server,\n\t\tlistener: listener,\n\t}, nil\n}", "func New(addr string, host app.HostService, collector *metrics.Collector) app.Server {\n\treturn &server{\n\t\tsrv: telnet.Server{Addr: addr, Handler: nil},\n\t\thost: host,\n\t\tcollector: collector,\n\t}\n}", "func New(h *handler.Handler, c *config.Config) {\n\ttokenAuth = jwtauth.New(\"HS256\", []byte(c.Token), nil)\n\tr := chi.NewRouter()\n\ts := &server{\n\t\thand: h,\n\t\trouter: r,\n\t\taddress: c.Address,\n\t}\n\ts.makeHandlers()\n\ts.startServer()\n}", "func NewHTTP(config *Config, logger kitlog.Logger) *HTTP {\n\tlogger = kitlog.With(logger, \"module\", \"http\")\n\n\tsrv := &http.Server{\n\t\tAddr: config.Addr,\n\t\tReadTimeout: time.Duration(config.ServerTimeout) * time.Second,\n\t\tWriteTimeout: time.Duration(2*config.ServerTimeout) * time.Second,\n\t}\n\n\treturn &HTTP{\n\t\tlogger: logger,\n\t\tsrv: srv,\n\t\tConfig: config,\n\t}\n}", "func New(host, port string, handlers handler.Param) *Server {\n\tfor path, hndl := range handlers {\n\t\thttp.HandleFunc(path, hndl)\n\t}\n\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\treturn &Server{\n\t\tHost: host,\n\t\tPort: port,\n\t\tHandlers: handlers,\n\t\tListener: nil,\n\t\tClient: &http.Client{Transport: tr},\n\t\tSecureClient: nil,\n\t\tCertificate: &certificate.CACertificate{},\n\t}\n}", "func New(au auth.Service) *Server {\n\ts := &Server{\n\t\tAuth: au,\n\t}\n\n\te := echo.New()\n\te.Use(middleware.Logger())\n\te.Use(middleware.Recover())\n\tapiG := e.Group(\"/api\")\n\th := authHandler{s: au}\n\th.addGroup(apiG)\n\n\ts.Host = e\n\treturn s\n}", "func NewHTTP(port uint16, pachClientFactory func(ctx context.Context) *client.APIClient) *HTTP {\n\tmux := http.NewServeMux()\n\thandler := &Server{\n\t\tpachClientFactory: pachClientFactory,\n\t}\n\tmux.Handle(\"/archive/\", CSRFWrapper(handler))\n\tmux.Handle(\"/healthz\", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(\"healthy\\n\")) //nolint:errcheck\n\t}))\n\treturn &HTTP{\n\t\tmux: mux,\n\t\tserver: &http.Server{\n\t\t\tAddr: fmt.Sprintf(\":%d\", port),\n\t\t\tHandler: mux,\n\t\t},\n\t}\n}", "func New(addr string) *Server {\n\treturn &Server{\n\t\tServer: &http.Server{\n\t\t\tAddr: addr,\n\t\t},\n\t\tlogger: defaultLogger,\n\t}\n}", "func New() *Server {\n\treturn &Server{srv: &http.Server{\n\t\tReadTimeout: 5 * time.Second,\n\t\tWriteTimeout: 5 * time.Second,\n\t}}\n}", "func New(o *Options, logger *zap.Logger) *Server {\n\thttpClient := &http.Client{\n\t\tTimeout: o.HTTPClientTimeout,\n\t}\n\n\treturn &Server{\n\t\toptions: o,\n\t\thttpClient: httpClient,\n\t\trouter: mux.NewRouter(),\n\t\tlogger: logger,\n\t}\n}", "func New(opt *Options) (server *Server, err error) {\n\tserver = &Server{\n\t\toptions: opt,\n\t\tServer: http.Server{\n\t\t\tAddr: fmt.Sprintf(\"0.0.0.0:%v\", opt.Config.Port),\n\t\t\tErrorLog: slog.New(log.New().Writer(), \"server\", 0),\n\t\t},\n\t}\n\n\tserver.Handler, err = server.createHandler()\n\treturn\n}", "func New(info Info) *WebServer {\n\trouter := bone.New()\n\t// Add more to this later on\n\treturn &WebServer{info.Listen + \":\" + info.Port, router}\n}", "func New() *Server {\n\tws := &Server{}\n\tws.controls = make([]control.Control, 0)\n\tws.middleware = make([]middle.Handler, 0)\n\tws.staticFiles = make(map[string]string)\n\tws.router = mux.NewRouter()\n\n\thttp.Handle(\"/\", ws.router)\n\treturn ws\n}", "func New(address string) *Server {\n\n\tserver := &Server{\n\t\taddress: address,\n\t}\n\n\thttp.HandleFunc(\"/upload\", uploadFileHandler())\n\n\tfs := http.FileServer(http.Dir(uploadPath))\n\thttp.Handle(\"/files/\", http.StripPrefix(\"/files\", fs))\n\n\tlog.Println(\"Starting server at port :8080\")\n\n\tlog.Fatal(http.ListenAndServe(\":\"+server.address, nil))\n\n\treturn server\n}", "func New(config conf.Config) *echo.Echo {\n\tsrv := echo.New()\n\tsrv.HideBanner = true\n\tsrv.HidePort = true\n\tsrv.Use(contextMiddleware(config))\n\tsrv.Use(loggerMiddleware(config))\n\tsrv.Use(cleanupMiddleware())\n\tsrv.Use(errorMiddleware())\n\t// Serve static content from the static folder\n\tsrv.Static(\"/\", \"static\")\n\tsrv.GET(pingEndpoint(config), pingHandler)\n\tsrv.POST(mergeEndpoint(config), mergeHandler)\n\tif config.DisableGoogleChrome() && config.DisableUnoconv() {\n\t\treturn srv\n\t}\n\tif !config.DisableGoogleChrome() {\n\t\tsrv.POST(htmlEndpoint(config), htmlHandler)\n\t\tsrv.POST(urlEndpoint(config), urlHandler)\n\t\tsrv.POST(markdownEndpoint(config), markdownHandler)\n\t}\n\tif !config.DisableUnoconv() {\n\t\tsrv.POST(officeEndpoint(config), officeHandler)\n\t}\n\tif !config.DisableInkscape() {\n\t\tsrv.POST(inkscapeEndpoint(config), inkscapeHandler)\n\t}\n\treturn srv\n}", "func New(trapHost string) *Server {\n\tmux := gmux.NewRouter()\n\tvar websockets []SocketClient\n\treturn &Server{\n\t\tTrapHost: trapHost,\n\t\tWebsockets: websockets,\n\t\tmux: mux,\n\t}\n}", "func NewServer() *Server {}", "func New(\n\taddr string,\n\thandler Handler,\n\tlog *log.Logger,\n\tworkersCount uint8,\n) (srv *Server) {\n\tsrv = &Server{\n\t\taddr: addr,\n\t\thandler: handler,\n\t\tlog: log,\n\t\tClients: newClients(),\n\t\tchStop: make(chan bool, 1),\n\t\tchRequest: make(chan *tRequest, workersCount),\n\t}\n\n\treturn\n}", "func New() *echo.Echo {\n\te := echo.New()\n\n\t// Middlewares\n\te.Use(middleware.Logger())\n\te.Use(middleware.CORS())\n\te.Use(middleware.RequestID())\n\te.Use(middleware.Recover())\n\t// Validator\n\te.Validator = validator.New()\n\t// Error handling\n\te.HTTPErrorHandler = apperror.HTTPErrorHandler\n\n\treturn e\n}", "func New() (IServer, error) {\n\turlString, ok := os.LookupEnv(\"TESTTRACK_CLI_URL\")\n\tif !ok {\n\t\treturn nil, errors.New(\"TESTTRACK_CLI_URL must be set\")\n\t}\n\n\turl, err := url.ParseRequestURI(urlString)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Server{url: url}, nil\n}", "func New(options Options) Server {\n\treturn &server{\n\t\tbindAddress: options.BindAddress,\n\t\tmux: http.NewServeMux(),\n\t}\n}", "func New(config *Config) *Server {\n\ts := &Server{\n\t\tconfig: config,\n\t\trouter: chi.NewRouter(),\n\t\tlogger: newLogger(config.LogDebug),\n\t}\n\n\treturn s\n}", "func NewHTTP(host string, port int) Static {\n\treturn Static{\n\t\tprotocol: ProtocolHTTP,\n\t\thost: host,\n\t\tport: port,\n\t}\n}", "func newHTTPServer(appConfig config.AppConfig, logger services.Logger) services.HTTPServer {\n\treturn services.NewDefaultHTTPServer(appConfig.Port, logger)\n}", "func New(router simplehttp.Router, logger *log.Logger) *Server {\n\treturn FromHTTPServer(&http.Server{}, router, logger)\n}", "func New(c Config) *http.Server {\n\n\thandler := &RateLimitHandler{\n\t\trecords: map[string]*Record{},\n\t\tlimit: c.Limit,\n\t\twindow: c.Window,\n\t}\n\n\ts := &http.Server{\n\t\tAddr: fmt.Sprintf(\"0.0.0.0:%d\", c.Port),\n\t\tHandler: handler,\n\t}\n\treturn s\n}", "func New(options *Options) (*HTTPServer, error) {\n\tvar h HTTPServer\n\tEnableUpload = options.EnableUpload\n\tEnableVerbose = options.Verbose\n\tfolder, err := filepath.Abs(options.Folder)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := os.Stat(folder); os.IsNotExist(err) {\n\t\treturn nil, errors.New(\"path does not exist\")\n\t}\n\toptions.Folder = folder\n\tvar dir http.FileSystem\n\tdir = http.Dir(options.Folder)\n\tif options.Sandbox {\n\t\tdir = SandboxFileSystem{fs: http.Dir(options.Folder), RootFolder: options.Folder}\n\t}\n\th.layers = h.loglayer(http.FileServer(dir))\n\tif options.BasicAuthUsername != \"\" || options.BasicAuthPassword != \"\" {\n\t\th.layers = h.loglayer(h.basicauthlayer(http.FileServer(dir)))\n\t}\n\th.options = options\n\n\treturn &h, nil\n}", "func New(host string) *service {\n\treturn &service{\n\t\thost: host,\n\t\tmux: http.NewServeMux(),\n\t}\n}", "func New(addr string) (*Server, error) {\n\ts := &Server{\n\t\taddr: addr,\n\t\tshutdownTimeout: time.Minute,\n\t\tSessions: make(chan *Session),\n\t}\n\ts.hs = &http.Server{Handler: s}\n\tln, err := net.Listen(\"tcp\", s.addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.ln = ln\n\ts.ListeningAddr = fmt.Sprintf(\":%d\", s.ln.Addr().(*net.TCPAddr).Port)\n\treturn s, nil\n}", "func (s *Server) New() (*http.Server, error) {\n\taddr := s.Address\n\tif addr == \"\" {\n\t\taddr = defaultAddr\n\t}\n\th, err := s.Handler()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsrv := &http.Server{\n\t\tHandler: h,\n\t\tAddr: addr,\n\t}\n\treturn srv, nil\n}", "func New() Server {\n\trouter := chi.NewRouter()\n\n\trouter.Use(middleware.Timeout(3 * time.Second))\n\trouter.Use(middleware.Logger)\n\trouter.Use(middleware.Recoverer)\n\trouter.Use(middleware.RealIP)\n\trouter.Use(middleware.RequestID)\n\trouter.Use(middleware.Throttle(1000))\n\trouter.Use(middleware.NoCache)\n\trouter.Use(middleware.SetHeader(\"Content-Type\", \"application/json\"))\n\n\treturn &server{Router: router}\n}", "func New() *Server {\n\ts := &Server{}\n\ts.e = echo.New()\n\ts.e.Use(middleware.Logger())\n\ts.e.Use(middleware.Recover())\n\ts.e.Use(middleware.CORS())\n\ts.initConfig()\n\ts.dbConnection()\n\ts.migrate()\n\ts.registerController()\n\treturn s\n}", "func newHTTPServer(address string, tlsConfig *tls.Config, handler http.Handler) *http.Server {\n\tserver := &http.Server{\n\t\tAddr: address,\n\t\tTLSConfig: tlsConfig,\n\t\tHandler: handler,\n\t}\n\treturn server\n}", "func New(store *vehicle.Store, mngr *extlookup.Manager, cnf config.Config) *WebServer {\n\treturn &WebServer{time.Now(), store, mngr, cnf}\n}", "func New(c *Config) *Server {\n\ts := &Server{\n\t\techo: echo.New(),\n\t\ttasksConfig: c.Tasks,\n\t}\n\n\te := s.echo\n\te.Logger.SetLevel(glog.INFO)\n\t//e.Use(middleware.Logger())\n\n\tssoConf := &sso.OAuth2Config{\n\t\tJWTAuthConfig: sso.JWTAuthConfig{\n\t\t\tPrivateKey: c.PrivateKey,\n\t\t},\n\t\tOAuth2: &oauth2.Config{\n\t\t\tClientID: c.OAuthClientID,\n\t\t\tClientSecret: c.OAuthClientSecret,\n\t\t\tScopes: []string{\"user:email\"},\n\t\t\tEndpoint: sso.GithubEnterpriseEndpoint(githubEnterpriseDomain),\n\t\t},\n\t\tEmailLookupFunc: sso.GithubEnterpriseEmailLookup(githubEnterpriseDomain),\n\t\tNoAuthn: true,\n\t}\n\n\te.Use(sso.OAuth2FromConfig(ssoConf))\n\n\tapi := e.Group(\"/api\")\n\tapi.Use(sso.JWTAuthFromConfig(&ssoConf.JWTAuthConfig))\n\ttasks := api.Group(\"/tasks\")\n\ttasks.GET(\"\", s.getTasks)\n\ttasks.POST(\"/:name/run\", s.runTask)\n\n\tnames := s.tasksConfig.TaskNames()\n\tfor _, n := range names {\n\t\te.GET(fmt.Sprintf(\"/%s\", n), serveStatic(\"build/index.html\"))\n\t}\n\n\te.GET(\"/*\", serveStatic(\"build\"))\n\n\treturn s\n}", "func New(s *service.Service) (engine *bm.Engine, err error) {\n\tvar (\n\t\tcfg struct {\n\t\t\tbm.ServerConfig\n\t\t\tCrossDomains []string\n\t\t}\n\t\tct paladin.TOML\n\t)\n\tif err = paladin.Get(\"http.toml\").Unmarshal(&ct); err != nil {\n\t\treturn\n\t}\n\tif err = ct.Get(\"Server\").UnmarshalTOML(&cfg); err != nil {\n\t\treturn\n\t}\n\tengine = bm.DefaultServer(&cfg.ServerConfig)\n\tengine.Use(s.As.CORS(cfg.CrossDomains))\n\tengine.Use(gzip.Gzip(gzip.DefaultCompression))\n\tinitRouter(engine, s)\n\terr = engine.Start()\n\treturn\n}", "func New(config Configuration, servicesConfig services.Configuration, groupsChannel chan []groups.Group, contentChannel chan content.RuleContentDirectory) *HTTPServer {\n\treturn &HTTPServer{\n\t\tConfig: config,\n\t\tServicesConfig: servicesConfig,\n\t\tGroupsChannel: groupsChannel,\n\t\tContentChannel: contentChannel,\n\t}\n}", "func New(view *rom.View) *Server {\n\trouter := vestigo.NewRouter()\n\n\ts := &Server{\n\t\trom: view,\n\t\thttpServer: &http.Server{\n\t\t\tAddr: \"127.0.0.1:8064\",\n\t\t\tReadTimeout: 5 * time.Second,\n\t\t\tWriteTimeout: 10 * time.Second,\n\t\t\tIdleTimeout: 15 * time.Second,\n\t\t\tHandler: router,\n\t\t},\n\t\tstatic: packr.NewBox(\"../front/dist\"),\n\t\trouter: router,\n\t}\n\n\ts.setupRoutes()\n\n\treturn s\n}", "func New(logger *zap.Logger) *HTTP {\n\th := &HTTP{\n\t\tlogger: logger,\n\t\tcreateClientFunc: createHTTPClient,\n\t}\n\n\treturn h\n}", "func NewHTTP(cfg config.Config) *HTTP {\n\tclient := &http.Client{\n\t\tTimeout: cfg.Timeout,\n\t}\n\treturn &HTTP{\n\t\tclient: client,\n\t\tconfig: cfg,\n\t}\n}", "func New(ctx context.Context, cfg *config.Configuration) (*http.Server, error) {\n\tvar err error\n\n\tonce.Do(func() {\n\t\t// Initialize application\n\t\tapp = &application{\n\t\t\tcfg: cfg,\n\t\t}\n\n\t\t// Initialize core context\n\t\tapp.server, err = setup(ctx, cfg)\n\t})\n\n\t// Return server\n\treturn app.server, err\n}", "func New(middleware ...Handler) *Server {\n\tdebugPrintWARNINGNew()\n\tserv := &Server{\n\t\trouter: make(tree.Trees, 0, 9),\n\t\tnotFound: []Handler{default404Handler},\n\t\tnoMethod: []Handler{default405Handler},\n\t\tmiddleware: middleware,\n\t\tRedirectTrailingSlash: true,\n\t\tRedirectFixedPath: false,\n\t\tMaxMultipartMemory: defaultMultipartMemory,\n\t}\n\n\tserv.pool.New = func() interface{} {\n\t\treturn serv.allocateContext()\n\t}\n\treturn serv\n}", "func New(address string) *Server {\n\treturn &Server{\n\t\taddress: address,\n\t\thandlerGet: NewGetHandler(&get.Getter{}),\n\t\thandlerList: NewListHandler(&list.Lister{}),\n\t\thandlerNotFound: notFoundHandler,\n\t\thandlerRegister: NewRegisterHandler(&register.Registerer{}),\n\t}\n}", "func New(e *goastarter.Endpoints, uh goagrpc.UnaryHandler) *Server {\n\treturn &Server{\n\t\tAddH: NewAddHandler(e.Add, uh),\n\t}\n}", "func New(address string) *Server {\n connection, err := net.Dial(\"tcp\", address)\n if err != nil {\n return nil;\n }\n reader := bufio.NewReader(connection)\n\n\treturn &Server{address: address, connection: connection, reader: reader}\n}", "func New(sigs chan os.Signal) *Server {\n\ts := &Server{mux: http.NewServeMux(), sigs: sigs}\n\n\tif s.logger == nil {\n\t\ts.logger = log.New(os.Stdout, \"\", 0)\n\t}\n\n\ts.db = store.NewStore()\n\n\ts.mux.HandleFunc(\"/\", s.latencyMiddleware(s.index))\n\ts.mux.HandleFunc(\"/hash/\", s.latencyMiddleware(s.hash))\n\ts.mux.HandleFunc(\"/shutdown/\", s.latencyMiddleware(s.shutdown))\n\ts.mux.HandleFunc(\"/stats/\", s.stats)\n\n\treturn s\n}", "func New(opts ...Option) *Server {\n\tsrv := &Server{\n\t\tserver: goproxy.NewProxyHttpServer(),\n\t\tdialer: &net.Dialer{\n\t\t\tTimeout: 30 * time.Second,\n\t\t\tKeepAlive: 30 * time.Second,\n\t\t},\n\t}\n\tsrv.server.Tr = &http.Transport{\n\t\tDialContext: srv.dialContext,\n\t\tTLSHandshakeTimeout: 10 * time.Second,\n\t\tResponseHeaderTimeout: 10 * time.Second,\n\t\tExpectContinueTimeout: 1 * time.Second,\n\t}\n\tsrv.server.ConnectDial = srv.dial\n\tfor _, opt := range opts {\n\t\topt(srv)\n\t}\n\t// srv.server.OnRequest().HandleConnectFunc(srv.onConnect)\n\tsrv.server.OnRequest().DoFunc(srv.onRequest)\n\tsrv.server.OnResponse().DoFunc(srv.onResponse)\n\treturn srv\n}", "func New(cfg *Config) *Server {\n\tdefaultConfig(cfg)\n\tlog.Printf(\"%+v\\n\", cfg)\n\treturn &Server{\n\t\tcfg: cfg,\n\t\thandlers: make([]connectionHandler, cfg.Count),\n\t\tevents: make(chan eventWithData, cfg.Count),\n\t}\n}", "func New(opts ...Option) (*Server, error) {\n\tconfig, err := buildConfig(opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlogger := config.logger\n\tif logger == nil {\n\t\tvar err error\n\n\t\tlogger, err = log.New(log.WithName(config.name))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tserver := &http.Server{\n\t\tAddr: config.address,\n\t\tHandler: config.handler,\n\t}\n\n\treturn &Server{\n\t\tname: config.name,\n\t\tlogger: logger,\n\t\tserver: server,\n\t}, nil\n}", "func New(appStateUpdater env.AppStateUpdater, config libkbfs.Config) (\n\ts *Server, err error) {\n\tlogger := config.MakeLogger(\"HTTP\")\n\ts = &Server{\n\t\tappStateUpdater: appStateUpdater,\n\t\tconfig: config,\n\t\tlogger: logger,\n\t\tvlog: config.MakeVLogger(logger),\n\t}\n\tif s.fs, err = lru.New(fsCacheSize); err != nil {\n\t\treturn nil, err\n\t}\n\tif err = s.restart(); err != nil {\n\t\treturn nil, err\n\t}\n\tctx, cancel := context.WithCancel(context.Background())\n\tgo s.monitorAppState(ctx)\n\ts.cancel = cancel\n\tlibmime.Patch(additionalMimeTypes)\n\treturn s, nil\n}", "func New(swaggerStore string, hugoStore string, runMode string, externalIP string, hugoDir string) (*Server, error) {\n\t// Return a new struct\n\treturn &Server{\n\t\tServiceMap: make(map[string]string),\n\t\tSwaggerStore: swaggerStore,\n\t\tHugoStore: hugoStore,\n\t\tRunMode: runMode,\n\t\tExternalIP: externalIP,\n\t\tHugoDir: hugoDir,\n\t}, nil\n}", "func New(opt *common.Options) error {\n\tif opt.Address != \"\" {\n\t\tif opt.Daemon {\n\t\t\treturn daemon.New(opt)\n\t\t}\n\n\t\tserver.Run(opt)\n\t} else if opt.Check {\n\t\tif isConnected() {\n\t\t\tchecker.Do(opt)\n\n\t\t\tif opt.Output != \"\" {\n\t\t\t\tdefer opt.Result.Close()\n\t\t\t}\n\t\t} else {\n\t\t\treturn errors.New(\"no internet connection\")\n\t\t}\n\t} else {\n\t\treturn errors.New(\"no action needed\")\n\t}\n\n\treturn nil\n}", "func New(c *Config, logger *zap.Logger) *Server {\n\treturn &Server{\n\t\tlogger,\n\t}\n}", "func New(configs *Configs, router *mux.Router) Server {\n\tserver := &ServerImpl{\n\t\tConfigs: configs,\n\t\tRouter: router,\n\t\tHTTPServer: newHTTPServer(configs, router),\n\t\tpingEndpoint: configs.PingEndpoint,\n\t\thealthcheckEndpoint: configs.HealthcheckEndpoint,\n\t\tshutdownEndpoint: configs.ShutdownEndpoint,\n\t}\n\tif server.pingEndpoint == \"\" {\n\t\tserver.pingEndpoint = DefaultPingEndpoint\n\t}\n\tif server.healthcheckEndpoint == \"\" {\n\t\tserver.healthcheckEndpoint = DefaultHealthcheckEndpoint\n\t}\n\tif server.shutdownEndpoint == \"\" {\n\t\tserver.shutdownEndpoint = DefaultShutdownEndpoint\n\t}\n\n\trouter.Path(server.pingEndpoint).Name(server.pingEndpoint).Methods(\"GET\").HandlerFunc(server.handleFuncPing)\n\trouter.Path(server.healthcheckEndpoint).Name(server.healthcheckEndpoint).Methods(\"GET\").HandlerFunc(server.handleFuncHealthcheck)\n\trouter.Path(server.shutdownEndpoint).Name(server.shutdownEndpoint).Methods(\"GET\").HandlerFunc(server.handleFuncShutdown)\n\n\treturn server\n}", "func New(config *configuration.Config, vs *library.Library, auth *auth.Manager) *Server {\n\treturn &Server{\n\t\tBase: subapp.NewBase(AppName),\n\t\tconfig: config,\n\t\tlibrary: vs,\n\t\tauthManager: auth,\n\t\trender: render.New(),\n\t}\n}", "func New(storage Storage) Server {\n\ts := &server{\n\t\tstorage: storage,\n\t\tr: chi.NewMux(),\n\t}\n\ts.routes()\n\treturn s\n}", "func New(url string) (*Handler, error) {\n\tc, err := golf.NewClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = c.Dial(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tl, err := c.NewLogger()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Handler{\n\t\tlogger: l,\n\t\tclient: c,\n\t}, nil\n}", "func New(url string) (*Handler, error) {\n\tc, err := golf.NewClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = c.Dial(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tl, err := c.NewLogger()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Handler{\n\t\tlogger: l,\n\t\tclient: c,\n\t}, nil\n}", "func New(obs *observance.Obs, CORSOrigins string, timeout ...string) (*echo.Echo, chan struct{}, error) {\n\ttimeoutDuration := defaultTimeout\n\tif len(timeout) > 0 {\n\t\tparsedTimeout, err := time.ParseDuration(timeout[0])\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"timeout could not be parsed: %w\", err)\n\t\t}\n\t\ttimeoutDuration = parsedTimeout\n\t}\n\n\techoServer := echo.New()\n\n\t// Configure Echo.\n\techoServer.HideBanner = true\n\techoServer.HidePort = true\n\n\techoServer.Server.ReadTimeout = timeoutDuration\n\techoServer.Server.WriteTimeout = timeoutDuration\n\techoServer.Server.ReadHeaderTimeout = timeoutDuration\n\tdefaultIdleTimeout := 120 * time.Second\n\tif defaultIdleTimeout > timeoutDuration {\n\t\techoServer.Server.IdleTimeout = defaultIdleTimeout\n\t}\n\t// By default, the value of ReadTimeout is used.\n\t// See https://pkg.go.dev/net/http#Server\n\n\techoServer.HTTPErrorHandler = HTTPErrorHandler(obs)\n\techoServer.Binder = &bindValidator{}\n\techoServer.Validator = NewValidator()\n\techoServer.Logger = Logger{obs.Logger}\n\techoServer.DisableHTTP2 = true\n\n\techoServer.Pre(middleware.RemoveTrailingSlash())\n\techoServer.Use(middleware.Secure())\n\techoServer.Use(middleware.Recover())\n\n\tif CORSOrigins != \"\" {\n\t\torigins := strings.Split(CORSOrigins, \",\")\n\t\techoServer.Use(middleware.CORSWithConfig(middleware.CORSConfig{\n\t\t\tAllowOrigins: origins,\n\t\t}))\n\t}\n\n\t// Set up graceful shutdown.\n\tconnsClosed := make(chan struct{})\n\tsc := make(chan os.Signal, 1)\n\tgo func() {\n\t\ts := <-sc\n\t\tobs.Logger.WithField(\"signal\", s).Warn(\"shutting down gracefully\")\n\n\t\tc, cancel := context.WithTimeout(context.Background(), 9*time.Second)\n\t\tdefer cancel()\n\n\t\terr := echoServer.Shutdown(c)\n\t\tif err != nil {\n\t\t\tobs.Logger.Error(err)\n\t\t}\n\t\tclose(connsClosed)\n\t}()\n\tsignal.Notify(sc, syscall.SIGINT, syscall.SIGTERM)\n\n\treturn echoServer, connsClosed, nil\n}", "func New(h http.Handler, opts *Options) *Server {\n\tsrv := &Server{handler: h}\n\tif opts != nil {\n\t\tsrv.reqlog = opts.RequestLogger\n\t\tsrv.te = opts.TraceExporter\n\t\tfor _, c := range opts.HealthChecks {\n\t\t\tsrv.healthHandler.Add(c)\n\t\t}\n\t\tsrv.sampler = opts.DefaultSamplingPolicy\n\t\tsrv.driver = opts.Driver\n\t}\n\treturn srv\n}", "func New(s *service.Service) (engine *bm.Engine) {\n\tvar (\n\t\thc struct {\n\t\t\tServer *bm.ServerConfig\n\t\t}\n\t)\n\tif err := paladin.Get(\"http.toml\").UnmarshalTOML(&hc); err != nil {\n\t\tif err != paladin.ErrNotExist {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\tsvc = s\n\tengine = bm.DefaultServer(hc.Server)\n\tinitRouter(engine)\n\tif err := engine.Start(); err != nil {\n\t\tpanic(err)\n\t}\n\treturn\n}", "func New(body string, statusCode int) *FakeHTTPServer {\n\treturn &FakeHTTPServer{\n\t\tserver: httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tw.Write([]byte(body))\n\t\t\tw.WriteHeader(statusCode)\n\t\t})),\n\t}\n}", "func New(t *testing.T, requests []ExpectedRequest) *httptest.Server {\n\th := mockHandler(t, requests)\n\treturn httptest.NewServer(h)\n}", "func New(t *testing.T, requests []ExpectedRequest) *httptest.Server {\n\th := mockHandler(t, requests)\n\treturn httptest.NewServer(h)\n}", "func New(e *todo.Endpoints, uh goagrpc.UnaryHandler) *Server {\n\treturn &Server{\n\t\tGetH: NewGetHandler(e.Get, uh),\n\t\tListH: NewListHandler(e.List, uh),\n\t\tAddH: NewAddHandler(e.Add, uh),\n\t\tRemoveH: NewRemoveHandler(e.Remove, uh),\n\t}\n}", "func New(pipeName string, hnd daemon.Handler) *Server {\n\treturn nil\n}", "func New(auth0Creds auth0creds.Auth0Creds, mongoDBURL string, port int) TradingPostServer {\n\treturn &httpServer{\n\t\tauth0Creds: auth0Creds,\n\t\tport: port,\n\t\tmongoDBURL: mongoDBURL,\n\t}\n}", "func New(opts ...Option) (*Server, error) {\n\n\t// init server\n\tserver := &Server{\n\t\trouter: httprouter.New(),\n\t}\n\n\t// init cors\n\tcors := cors.AllowAll()\n\n\t// add middleware for all handlers\n\tserver.srv.Handler = cors.Handler(WithLog(server.router))\n\n\t// append options of the server\n\tfor _, opt := range opts {\n\t\topt(server)\n\t}\n\n\t// add healthcheck endpoint\n\tserver.Handle(http.MethodGet, \"/\", healthcheck)\n\n\treturn server, nil\n}", "func New() *Server {\n\treturn &Server{make([]*websocket.Conn, 0, 10)}\n}", "func New(sto store.Service) *server {\n\ts := &server{sto: sto}\n\n\trouter := mux.NewRouter()\n\n\trouter.Handle(\"/todo\", allowedMethods(\n\t\t[]string{\"OPTIONS\", \"GET\", \"POST\"},\n\t\thandlers.MethodHandler{\n\t\t\t\"GET\": http.HandlerFunc(s.getTodos),\n\t\t\t\"POST\": http.HandlerFunc(s.createTodo),\n\t\t}))\n\n\trouter.Handle(\"/todo/{id}\", idMiddleware(allowedMethods(\n\t\t[]string{\"OPTIONS\", \"GET\", \"PUT\", \"PATCH\", \"DELETE\"},\n\t\thandlers.MethodHandler{\n\t\t\t\"GET\": http.HandlerFunc(s.getTodo),\n\t\t\t\"PUT\": http.HandlerFunc(s.putTodo),\n\t\t\t\"PATCH\": http.HandlerFunc(s.patchTodo),\n\t\t\t\"DELETE\": http.HandlerFunc(s.deleteTodo),\n\t\t})))\n\n\ts.handler = limitBody(defaultHeaders(router))\n\n\treturn s\n}", "func New(e *calc.Endpoints, uh goagrpc.UnaryHandler) *Server {\n\treturn &Server{\n\t\tAddH: NewAddHandler(e.Add, uh),\n\t}\n}", "func newServer(config Config) *http.Server {\n\treturn &http.Server{\n\t\tAddr: fmt.Sprintf(\":%s\", config.Port),\n\t\tHandler: newRouter(config),\n\t}\n}", "func New(bind string) *Server {\n\treturn &Server{bind}\n}", "func New(proxy autocomplete.AVSProxy, cache autocomplete.Database) *Server {\n\treturn &Server{\n\t\tproxy: proxy,\n\t\tcache: cache,\n\t\tlogger: log.New(ioutil.Discard, \"\", 0),\n\t}\n}", "func New(cfg *config.Config, cache cache.Cacher, tr *http.Transport) *HttpHandler {\n\treturn &HttpHandler{handler.Handler{cache, cfg, tr}}\n}", "func New(c *config.Config) *Server {\n\tdefaultAppPort := 8080\n\n\t// Set the port the webserver will listen on\n\tif c.AppPort == 0 {\n\t\tif envAppPort := os.Getenv(\"APP_PORT\"); envAppPort != \"\" {\n\t\t\tvar err error\n\t\t\tc.AppPort, err = strconv.Atoi(envAppPort)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalln(\"An error occurred while trying to read the APP_PORT environment variable:\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tc.AppPort = defaultAppPort\n\t\t}\n\t}\n\n\t// Set the redirect URL\n\tc.OAuth2Config.RedirectURL = fmt.Sprintf(\"http://localhost:%d%s\", c.AppPort, callbackURI)\n\tif config.DebugMode {\n\t\tlog.Println(\"RedirectURL:\", c.OAuth2Config.RedirectURL)\n\t}\n\n\ts := &Server{\n\t\tconfig: c,\n\t\tcontext: context.Background(),\n\t\thttpServer: &http.Server{Addr: fmt.Sprintf(\":%d\", c.AppPort)},\n\t}\n\n\thttp.HandleFunc(\"/\", s.handleIndexPage)\n\thttp.HandleFunc(\"/organisation\", s.handleOrganisationPage)\n\thttp.HandleFunc(\"/invoices\", s.handleInvoicePage)\n\thttp.HandleFunc(\"/refresh\", s.handleTokenRefreshRequest)\n\thttp.HandleFunc(\"/segfault\", s.handleSegfaultRequest)\n\thttp.HandleFunc(loginPath, s.redirectToAuthorisationEndpoint)\n\thttp.HandleFunc(callbackURI, s.handleOAuthCallback)\n\n\treturn s\n}", "func New(addr string) *Server {\n if addr == \"\" {\n addr = DefaultAddr\n }\n return &Server{\n addr: DefaultAddr,\n ds: newDataStore(),\n done: make(chan struct{}),\n }\n}", "func New(addr string, port int) *Server {\n\tctx, cancel := context.WithCancel(context.Background())\n\treturn &Server{\n\t\taddr: addr,\n\t\tport: port,\n\t\tctx: ctx,\n\t\tctxCancel: cancel,\n\t}\n}", "func New(host, port string) *Yeelight {\n\ty := &Yeelight{host: host, port: port}\n\treturn y\n}", "func New(b *board.Board, ps [2]match.Player) *HTTPServer {\n ms := new(vector.Vector)\n ms.Push(match.New(b, ps))\n return &HTTPServer{ms}\n}", "func New(ctx context.Context, conf Config) *Server {\n\tsvc := &rpc.Service{}\n\n\ttwirpServer := garo.NewAgentConfigurationServiceServer(svc, nil)\n\tapi := configureAPI(twirpServer, conf.Logger)\n\n\tsrv := http.Server{\n\t\tAddr: conf.Addr,\n\t\tHandler: api,\n\t}\n\n\treturn &Server{&srv, ctx, conf}\n}", "func New(port string) *Server {\n\treturn &Server{\n\t\tport: port,\n\t\tmanager: endly.New(),\n\t}\n}", "func New(e *step.Endpoints, uh goagrpc.UnaryHandler) *Server {\n\treturn &Server{\n\t\tListH: NewListHandler(e.List, uh),\n\t\tAddH: NewAddHandler(e.Add, uh),\n\t\tRemoveH: NewRemoveHandler(e.Remove, uh),\n\t\tUpdateH: NewUpdateHandler(e.Update, uh),\n\t}\n}", "func NewHTTP() *HTTP {\n\treturn HTTPPool.Get().(*HTTP)\n}", "func New(database *gorm.DB, logger *lumberjack.Logger) (*Server, error) {\n\tserver := Server{echo.New()}\n\n\t// Middleware\n\tserver.HTTPErrorHandler = func(err error, context echo.Context) {\n\t\tmessage := err.Error()\n\t\tstatusCode := context.Response().Status\n\t\tcontext.JSON(statusCode, map[string]map[string]interface{}{ // sub level mapping\n\t\t\t\"error\": {\n\t\t\t\t\"message\": message,\n\t\t\t},\n\t\t})\n\t}\n\n\tserver.Pre(middleware.RemoveTrailingSlash())\n\tserver.Use(middleware.Logger())\n\tserver.Use(middleware.Recover())\n\tserver.Use(middleware.CORS())\n\tserver.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{Output: logger})) // Server header\n\n\t// Setup Controller\n\tInitializeControllers(database)\n\n\t// Setup Routers\n\tInitializeRouters(server)\n\n\treturn &server, nil\n}", "func New() *Cmd {\n\tapp := cli.NewApp()\n\tapp.Name = \"server\"\n\tapp.Author = \"\"\n\tapp.Usage = \"server\"\n\tapp.Description = \"A server for a chat app\"\n\tapp.Flags = globalFlags\n\n\tapp.Before = func(c *cli.Context) error {\n\t\treturn nil\n\t}\n\n\tapp.Action = func(c *cli.Context) error {\n\t\taddr := c.String(\"address\")\n\t\techo := c.Bool(\"echo\")\n\n\t\tsrv := server.NewServer(addr, echo)\n\t\tsrv.Run()\n\t\treturn nil\n\t}\n\n\treturn &Cmd{App: app}\n}", "func New(listenAddr string, apiConfig APIConfig) (*Server, error) {\n\tserver := &Server{\n\t\tlistenAddr: listenAddr,\n\t\tapiConfig: apiConfig,\n\t}\n\n\tc := cors.New(cors.Options{\n\t\tAllowedOrigins: []string{\"http://127.0.0.1:5353\"},\n\t})\n\n\t// setup server\n\tserver.router = httprouter.New()\n\thandlers := alice.New(\n\t\tc.Handler,\n\t\t//context.ClearHandler,\n\t\t//addContextHandler,\n\t\tmakeTimeoutHandler(server.apiConfig.APITimeout),\n\t\tloggingHandler,\n\t\trecoverHandler,\n\t)\n\t// serve static content\n\tstatic := http.StripPrefix(\"/static/\", http.FileServer(http.Dir(\"static\")))\n\tserver.router.Handler(http.MethodGet, \"/static/*path\", handlers.Then(neuterDirectoryListing(static)))\n\n\t// setup robots.txt\n\tserver.router.Handler(http.MethodGet, \"/robots.txt\", handlers.ThenFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.ServeFile(w, r, \"static/robots.txt\")\n\t}))\n\n\t// add rate limiting after static handler\n\tserver.handlers = handlers.Append(makeThrottleHandler(\n\t\tserver.apiConfig.APIRequestsPerMinute,\n\t\tserver.apiConfig.APIRequestsBurst,\n\t\tserver.apiConfig.APIMaxRequestHistory,\n\t))\n\n\t//server.router.NotFound = notFoundJSON\n\treturn server, nil\n}", "func New(mws ...Middleware) *Router {\n\tr := &Router{\n\t\tparent: nil,\n\t\thostrm: newHostMatcher(),\n\t\tmiddlewares: Middlewares{},\n\t\tnamedMiddlewares: make(map[string]Middlewares),\n\t\tpool: newCtxPool(),\n\t}\n\tr.Use(mws...)\n\tr.Configure(\n\t\tWithLogger(lionLogger),\n\t\tWithServer(&http.Server{\n\t\t\tReadTimeout: 5 * time.Second,\n\t\t\tWriteTimeout: 10 * time.Second,\n\t\t}),\n\t)\n\treturn r\n}", "func New(bindAddress string, tableauEndpoint string) *http.Server {\n\treturn &http.Server{\n\t\tAddr: bindAddress,\n\t\tHandler: TabAuth{\n\t\t\t&Client{tableauEndpoint, &http.Client{}},\n\t\t\taccounts(),\n\t\t},\n\t}\n}", "func New(address string) *server {\n\tlog.Println(\"Creating server with address\", address)\n\tserver := &server{\n\t\taddress: address,\n\t}\n\n\tserver.SetNewClientCB(func(c *Client) {})\n\tserver.SetNewMessageCB(func(c *Client, message string) {})\n\tserver.SetClientConnectionClosedCB(func(c *Client, err error) {})\n\n\treturn server\n}", "func newTestServer(logStore logstore.LogStore) *HTTPServer {\n\t// note: address doesn't matter since we will use httptest server\n\tserver := NewHTTP(&Config{BindAddress: \"127.0.0.1:8080\"}, logStore)\n\treturn server\n}", "func New(st Storage) *Server {\n\tsrv := &Server{\n\t\tst: st,\n\t}\n\tsrv.setupRouter()\n\treturn srv\n}" ]
[ "0.71665865", "0.71398956", "0.7123811", "0.7121933", "0.7121786", "0.708344", "0.7081363", "0.70667744", "0.7039178", "0.7034454", "0.6998099", "0.6891638", "0.6876491", "0.68591356", "0.6854021", "0.6827344", "0.6814313", "0.6813561", "0.68123925", "0.6777675", "0.677665", "0.6767749", "0.6760412", "0.67491674", "0.6734992", "0.67346007", "0.6726607", "0.67202526", "0.6713791", "0.6713051", "0.67102855", "0.6682929", "0.66825616", "0.6682097", "0.66684717", "0.66462255", "0.6629878", "0.6626528", "0.66239", "0.66216964", "0.6619436", "0.66189593", "0.65972155", "0.65954226", "0.65932244", "0.658441", "0.6583331", "0.65801144", "0.6570392", "0.65577596", "0.6549561", "0.653755", "0.6535563", "0.6518547", "0.6507647", "0.6497342", "0.6494998", "0.64792573", "0.6474411", "0.64672506", "0.6455421", "0.6452847", "0.64485997", "0.6447708", "0.6447034", "0.6447034", "0.64434636", "0.6441394", "0.64255023", "0.6424299", "0.64087105", "0.64087105", "0.64084053", "0.6405935", "0.64028174", "0.6399553", "0.63860184", "0.63747126", "0.6371757", "0.63711894", "0.6352923", "0.6351475", "0.6350386", "0.63497394", "0.6345454", "0.63443565", "0.6332934", "0.63260514", "0.63169545", "0.6300138", "0.6296809", "0.62936187", "0.62829167", "0.6282782", "0.6280513", "0.62698925", "0.6251708", "0.62477124", "0.62373495", "0.6233194" ]
0.7557735
0
NewPodmanDriver returns a new DriverPlugin implementation
NewPodmanDriver возвращает новый реализацию DriverPlugin
func NewPodmanDriver(logger hclog.Logger) drivers.DriverPlugin { ctx, cancel := context.WithCancel(context.Background()) return &Driver{ eventer: eventer.NewEventer(ctx, logger), config: &PluginConfig{}, tasks: newTaskStore(), ctx: ctx, signalShutdown: cancel, logger: logger.Named(pluginName), } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewPodmanDriver(logger hclog.Logger) drivers.DriverPlugin {\n\tctx, cancel := context.WithCancel(context.Background())\n\tlogger = logger.Named(pluginName)\n\treturn &Driver{\n\t\teventer: eventer.NewEventer(ctx, logger),\n\t\tconfig: &Config{},\n\t\ttasks: newTaskStore(),\n\t\tctx: ctx,\n\t\tsignalShutdown: cancel,\n\t\tlogger: logger,\n\t}\n}", "func newPluginProvider(pluginBinDir string, provider kubeletconfig.CredentialProvider) (*pluginProvider, error) {\n\tmediaType := \"application/json\"\n\tinfo, ok := runtime.SerializerInfoForMediaType(codecs.SupportedMediaTypes(), mediaType)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unsupported media type %q\", mediaType)\n\t}\n\n\tgv, ok := apiVersions[provider.APIVersion]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"invalid apiVersion: %q\", provider.APIVersion)\n\t}\n\n\tclock := clock.RealClock{}\n\n\treturn &pluginProvider{\n\t\tclock: clock,\n\t\tmatchImages: provider.MatchImages,\n\t\tcache: cache.NewExpirationStore(cacheKeyFunc, &cacheExpirationPolicy{clock: clock}),\n\t\tdefaultCacheDuration: provider.DefaultCacheDuration.Duration,\n\t\tlastCachePurge: clock.Now(),\n\t\tplugin: &execPlugin{\n\t\t\tname: provider.Name,\n\t\t\tapiVersion: provider.APIVersion,\n\t\t\tencoder: codecs.EncoderForVersion(info.Serializer, gv),\n\t\t\tpluginBinDir: pluginBinDir,\n\t\t\targs: provider.Args,\n\t\t\tenvVars: provider.Env,\n\t\t\tenviron: os.Environ,\n\t\t},\n\t}, nil\n}", "func NewPlugin(opts ...Option) *Plugin {\n\tp := &Plugin{}\n\n\tp.SetName(\"generator\")\n\tp.KVStore = &etcd.DefaultPlugin\n\tp.KVScheduler = &kvscheduler.DefaultPlugin\n\n\tfor _, o := range opts {\n\t\to(p)\n\t}\n\n\tp.Setup()\n\n\treturn p\n}", "func NewPlugin(namespace string, dfn plugin.Definition, cfg *plugin.WorkerConfig) *Plugin {\n\treturn &Plugin{\n\t\tName: dfn.Name,\n\t\tUUID: gouuid.NewV4(),\n\t\tResultType: dfn.ResultType,\n\t\tPodSpec: &dfn.PodSpec,\n\t\tNamespace: namespace,\n\t\tConfig: cfg,\n\t}\n}", "func newPlugin() (p *slackscot.Plugin) {\n\tp = new(slackscot.Plugin)\n\tp.Name = \"tester\"\n\tp.Commands = []slackscot.ActionDefinition{{\n\t\tMatch: func(m *slackscot.IncomingMessage) bool {\n\t\t\treturn strings.HasPrefix(m.NormalizedText, \"make\")\n\t\t},\n\t\tUsage: \"make `<something>`\",\n\t\tDescription: \"Have the test bot make something for you\",\n\t\tAnswer: func(m *slackscot.IncomingMessage) *slackscot.Answer {\n\t\t\treturn &slackscot.Answer{Text: \"Ready\"}\n\t\t},\n\t}}\n\n\treturn p\n}", "func NewPlugin(proto, path string, params ...string) *Plugin {\n\tif proto != \"unix\" && proto != \"tcp\" {\n\t\tpanic(\"Invalid protocol. Specify 'unix' or 'tcp'.\")\n\t}\n\tp := &Plugin{\n\t\texe: path,\n\t\tproto: proto,\n\t\tparams: params,\n\t\tinitTimeout: 2 * time.Second,\n\t\texitTimeout: 2 * time.Second,\n\t\thandler: NewDefaultErrorHandler(),\n\t\tmeta: meta(\"pingo\" + randstr(5)),\n\t\tobjsCh: make(chan *objects),\n\t\tconnCh: make(chan *conn),\n\t\tkillCh: make(chan *waiter),\n\t\texitCh: make(chan struct{}),\n\t}\n\treturn p\n}", "func New(_ runtime.Object, h framework.Handle) (framework.Plugin, error) {\n\treturn &PodState{handle: h}, nil\n}", "func newDriver() *driver {\n\treturn &driver{\n\t\tnetworks: map[string]*bridgeNetwork{},\n\t\tportAllocator: portallocator.Get(),\n\t}\n}", "func newPluginContainer() PluginContainer {\n\treturn new(pluginContainer)\n}", "func newPluginContainer() PluginContainer {\n\treturn new(pluginContainer)\n}", "func NewPluginCommand(cmd *cobra.Command, dockerCli *client.DockerCli) {\n}", "func (p *PodmanTestIntegration) Podman(args []string) *PodmanSessionIntegration {\n\tpodmanSession := p.PodmanBase(args)\n\treturn &PodmanSessionIntegration{podmanSession}\n}", "func NewPlugin(plugins func() discovery.Plugins, choices selector.Options) instance.Plugin {\n\tbase := &internal.Base{\n\t\tPlugins: plugins,\n\t\tChoices: choices,\n\t\tSelectFunc: SelectOne,\n\t}\n\treturn &impl{\n\t\tPlugin: base.Init(),\n\t}\n}", "func New(cfg *Config, logger logger.Logger, registerer prometheus.Registerer) (*Plugin, error) {\n\tservice := &Plugin{\n\t\tcfg: cfg,\n\t\tregisterer: registerer,\n\t\tLogger: logger.NewLogger(\"simplePlugin\"),\n\t}\n\treturn service, nil\n}", "func NewDriver() godfish.Driver { return &driver{} }", "func (p *PodmanTestIntegration) Podman(args []string) *PodmanSessionIntegration {\n\tpodmanSession := p.PodmanBase(args, false, false)\n\treturn &PodmanSessionIntegration{podmanSession}\n}", "func NewPlugin() container.Plugin {\n\treturn &plugin{}\n}", "func Init(config Config) pdfium.Pool {\n\t// Create an hclog.Logger\n\tlogger := hclog.New(&hclog.LoggerOptions{\n\t\tName: \"plugin\",\n\t\tOutput: os.Stdout,\n\t\tLevel: hclog.Debug,\n\t})\n\n\tvar handshakeConfig = plugin.HandshakeConfig{\n\t\tProtocolVersion: 1,\n\t\tMagicCookieKey: \"BASIC_PLUGIN\",\n\t\tMagicCookieValue: \"hello\",\n\t}\n\n\t// pluginMap is the map of plugins we can dispense.\n\tvar pluginMap = map[string]plugin.Plugin{\n\t\t\"pdfium\": &commons.PdfiumPlugin{},\n\t}\n\n\t// If we don't have a log callback, make the callback no-op.\n\tif config.LogCallback == nil {\n\t\tconfig.LogCallback = func(s string) {}\n\t}\n\n\tfactory := pool.NewPooledObjectFactory(\n\t\tfunc(goctx.Context) (interface{}, error) {\n\t\t\tnewWorker := &worker{}\n\n\t\t\tclient := plugin.NewClient(&plugin.ClientConfig{\n\t\t\t\tHandshakeConfig: handshakeConfig,\n\t\t\t\tPlugins: pluginMap,\n\t\t\t\tCmd: exec.Command(config.Command.BinPath, config.Command.Args...),\n\t\t\t\tLogger: logger,\n\t\t\t\tStartTimeout: config.Command.StartTimeout,\n\t\t\t})\n\n\t\t\trpcClient, err := client.Client()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\traw, err := rpcClient.Dispense(\"pdfium\")\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tpdfium := raw.(commons.Pdfium)\n\n\t\t\tpong, err := pdfium.Ping()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif pong != \"Pong\" {\n\t\t\t\treturn nil, errors.New(\"Wrong ping/pong result\")\n\t\t\t}\n\n\t\t\tnewWorker.pluginClient = client\n\t\t\tnewWorker.rpcClient = rpcClient\n\t\t\tnewWorker.plugin = pdfium\n\n\t\t\treturn newWorker, nil\n\t\t}, nil, func(ctx goctx.Context, object *pool.PooledObject) bool {\n\t\t\tworker := object.Object.(*worker)\n\t\t\tif worker.pluginClient.Exited() {\n\t\t\t\tconfig.LogCallback(\"Worker exited\")\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\terr := worker.rpcClient.Ping()\n\t\t\tif err != nil {\n\t\t\t\tconfig.LogCallback(fmt.Sprintf(\"Error on RPC ping: %s\", err.Error()))\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tpong, err := worker.plugin.Ping()\n\t\t\tif err != nil {\n\t\t\t\tconfig.LogCallback(fmt.Sprintf(\"Error on plugin ping:: %s\", err.Error()))\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tif pong != \"Pong\" {\n\t\t\t\terr = errors.New(\"Wrong ping/pong result\")\n\t\t\t\tconfig.LogCallback(fmt.Sprintf(\"Error on plugin ping:: %s\", err.Error()))\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\treturn true\n\t\t}, nil, nil)\n\tp := pool.NewObjectPoolWithDefaultConfig(goctx.Background(), factory)\n\tp.Config = &pool.ObjectPoolConfig{\n\t\tBlockWhenExhausted: true,\n\t\tMinIdle: config.MinIdle,\n\t\tMaxIdle: config.MaxIdle,\n\t\tMaxTotal: config.MaxTotal,\n\t\tTestOnBorrow: true,\n\t\tTestOnReturn: true,\n\t\tTestOnCreate: true,\n\t}\n\n\tp.PreparePool(goctx.Background())\n\n\tmultiThreadedMutex.Lock()\n\tdefer multiThreadedMutex.Unlock()\n\n\tpoolRef := uuid.New()\n\n\t// Create a new PDFium pool.\n\tnewPool := &pdfiumPool{\n\t\tpoolRef: poolRef.String(),\n\t\tinstanceRefs: map[string]*pdfiumInstance{},\n\t\tlock: &sync.Mutex{},\n\t\tworkerPool: p,\n\t}\n\n\tpoolRefs[newPool.poolRef] = newPool\n\n\treturn newPool\n}", "func (*manager) PluginType() string { return base.PluginTypeDriver }", "func newPod(busChan MsgChan, opts *podOpts) *Pod {\n\tp := &Pod{\n\t\tonFuncLock: sync.RWMutex{},\n\t\tmessageChan: make(chan Message, defaultPodChanSize),\n\t\tfeedbackChan: make(chan Message, defaultPodChanSize),\n\t\tbusChan: busChan,\n\t\tmessageFilter: newMessageFilter(),\n\t\topts: opts,\n\t\tdead: &atomic.Value{},\n\t}\n\n\t// do some \"delayed setup\"\n\tp.opts.replayOnce = sync.Once{}\n\tp.dead.Store(false)\n\n\tp.start()\n\n\treturn p\n}", "func newPodManager(kClient kubernetes.Interface, policy osdnPolicy, overlayMTU uint32, routableMTU uint32, ovs *ovsController) *podManager {\n\tpm := newDefaultPodManager()\n\tpm.kClient = kClient\n\tpm.policy = policy\n\tpm.overlayMTU = overlayMTU\n\tpm.routableMTU = routableMTU\n\tpm.podHandler = pm\n\tpm.ovs = ovs\n\treturn pm\n}", "func NewPlugin() (shared.Plugin, error) {\n\treturn instance, nil\n}", "func Plugin(replayLayout *device.MemoryLayout) compiler.Plugin {\n\treturn &replayer{replayLayout: replayLayout}\n}", "func (kl *Kubelet) newVolumeMounterFromPlugins(spec *volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) {\n\tplugin, err := kl.volumePluginMgr.FindPluginBySpec(spec)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"can't use volume plugins for %s: %v\", spec.Name(), err)\n\t}\n\tphysicalMounter, err := plugin.NewMounter(spec, pod, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to instantiate mounter for volume: %s using plugin: %s with a root cause: %v\", spec.Name(), plugin.GetPluginName(), err)\n\t}\n\tklog.V(10).InfoS(\"Using volume plugin for mount\", \"volumePluginName\", plugin.GetPluginName(), \"volumeName\", spec.Name())\n\treturn physicalMounter, nil\n}", "func NewPlugin() (*Plugin, error) {\n\tstore := NewStore()\n\tdockerClient, err := NewDockerClient(store)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create a docker client: %v\", err)\n\t}\n\treporter := NewReporter(store)\n\tplugin := &Plugin{\n\t\treporter: reporter,\n\t\tclients: []containerClient{\n\t\t\tdockerClient,\n\t\t},\n\t}\n\tfor _, client := range plugin.clients {\n\t\tgo client.Start()\n\t}\n\treturn plugin, nil\n}", "func NewDevicePluginManager(lister DeviceLister) *DevicePluginManager {\n\tstopCh := make(chan struct{})\n\n\t// First important signal channel is the os signal channel. We only care about (somewhat) small subset of available signals.\n\tsigs := make(chan os.Signal, 1)\n\tsignal.Notify(sigs, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGINT)\n\n\t// The other important channel is filesystem notification channel, responsible for watching device plugin directory.\n\tfsWatcher, _ := fsnotify.NewWatcher()\n\tfsWatcher.Add(pluginapi.DevicePluginPath)\n\n\tdpm := &DevicePluginManager{\n\t\tstopCh: stopCh,\n\t\tsignalCh: sigs,\n\t\tfsWatcher: fsWatcher,\n\t}\n\n\tgo dpm.handleSignals()\n\n\t// We can now move to functionality: first, the initial pool of devices is needed.\n\tdevices := lister.Discover()\n\n\t// As we use the pool to initialize device plugins (the actual gRPC servers) themselves.\n\tfor deviceClass, deviceIDs := range *devices {\n\t\tdpm.plugins = append(dpm.plugins, lister.NewDevicePlugin(deviceClass, deviceIDs))\n\t}\n\n\treturn dpm\n}", "func NewDriver(cfg *config.Config) *Driver {\n\tdriver := &Driver{\n\t\tcfg: cfg,\n\t}\n\n\treturn driver\n}", "func NewPlugin(next http.HandlerFunc) http.HandlerFunc {\n\tp, err := plugin.Open(\"plugin.so\")\n\tif err != nil {\n\t\tif strings.HasPrefix(err.Error(), \"plugin.Open\") {\n\t\t\tfmt.Printf(\"error: could not open plugin file 'plugin.so': %v\\n\", err)\n\t\t}\n\t\treturn next\n\t}\n\tf, err := p.Lookup(\"Handler\")\n\tif err != nil {\n\t\tfmt.Printf(\"error: could not find plugin Handler function %v\\n\", err)\n\t\treturn next\n\t}\n\tpluginFn, ok := f.(func(http.HandlerFunc) http.HandlerFunc)\n\tif !ok {\n\t\tfmt.Println(\"error: plugin Handler function should be 'func(http.HandlerFunc) http.HandlerFunc'\")\n\t\treturn next\n\t}\n\treturn pluginFn(next)\n}", "func NewPlugin(opts ...Option) *Plugin {\n\tp := &Plugin{}\n\n\tp.PluginName = \"service-label\"\n\n\tfor _, o := range opts {\n\t\to(p)\n\t}\n\n\treturn p\n}", "func New() (*Plugin, error) {\n\treturn &Plugin{\n\t\tHandler: admission.NewHandler(admission.Create, admission.Update),\n\t}, nil\n}", "func NewDriver(client *redis.Client, prefix string) *Driver {\n\treturn &Driver{\n\t\tclient: client,\n\t\tprefix: prefix,\n\t}\n}", "func New() *Plugin {\n\treturn &Plugin{}\n}", "func newMongoDriver(name string, opts MongoDBOptions) (*mongoDriver, error) {\n\thost, _ := os.Hostname() // nolint\n\n\tif err := opts.Validate(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"invalid mongo driver options\")\n\t}\n\n\treturn &mongoDriver{\n\t\tname: name,\n\t\topts: opts,\n\t\tinstanceID: fmt.Sprintf(\"%s.%s.%s\", name, host, uuid.New()),\n\t}, nil\n}", "func NewVolumeDriver(mountDir string, driverName string) *VolumeDriver {\n\tvar d *VolumeDriver\n\n\tmountRoot = mountDir\n\n\td = &VolumeDriver{\n\t\trefCounts: refcount.NewRefCountsMap(),\n\t}\n\n\td.mountIDtoName = make(map[string]string)\n\td.refCounts.Init(d, mountDir, driverName)\n\n\tlog.WithFields(log.Fields{\n\t\t\"version\": version,\n\t}).Info(\"vSphere shared plugin started \")\n\n\treturn d\n}", "func NewDriver() *Driver {\n\treturn &Driver{\n\t\tVMDriver: &drivers.VMDriver{\n\t\t\tBaseDriver: &drivers.BaseDriver{},\n\t\t\tCPU: DefaultCPUs,\n\t\t\tMemory: DefaultMemory,\n\t\t},\n\t}\n}", "func NewPlugin(context context.T) (*Plugin, error) {\n\tvar plugin Plugin\n\n\tplugin.context = context\n\tplugin.birdwatcherfacade = facade.NewBirdwatcherFacade(context)\n\tplugin.localRepository = localpackages.NewRepository()\n\tplugin.packageServiceSelector = selectService\n\tplugin.isDocumentArchive = false\n\n\treturn &plugin, nil\n}", "func newPod(name string) *corev1.Pod {\n\treturn &corev1.Pod{\n\t\tTypeMeta: metav1.TypeMeta{},\n\t\tObjectMeta: metav1.ObjectMeta{Name: name},\n\t\tSpec: corev1.PodSpec{},\n\t\tStatus: corev1.PodStatus{},\n\t}\n}", "func NewPluginBuilder(ctx *runctx.RunContext) (shared.PluginBuilder, error) {\n\t// We're a host. Start by launching the plugin process.\n\tlogrus.SetOutput(os.Stdout)\n\n\tbuilders := map[string]shared.PluginBuilder{}\n\n\tfor _, a := range ctx.Cfg.Build.Artifacts {\n\t\tp := a.BuilderPlugin.Name\n\t\tif _, ok := builders[p]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tcmd := exec.Command(p)\n\t\tif _, ok := SkaffoldCorePluginExecutionMap[p]; ok {\n\t\t\texecutable, err := os.Executable()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"getting executable path\")\n\t\t\t}\n\t\t\tcmd = exec.Command(executable)\n\t\t\tcmd.Env = append(os.Environ(), []string{fmt.Sprintf(\"%s=%s\", constants.SkaffoldPluginKey, constants.SkaffoldPluginValue),\n\t\t\t\tfmt.Sprintf(\"%s=%s\", constants.SkaffoldPluginName, p)}...)\n\t\t}\n\n\t\tclient := plugin.NewClient(&plugin.ClientConfig{\n\t\t\tStderr: os.Stderr,\n\t\t\tSyncStderr: os.Stderr,\n\t\t\tSyncStdout: os.Stdout,\n\t\t\tManaged: true,\n\t\t\tHandshakeConfig: shared.Handshake,\n\t\t\tPlugins: shared.PluginMap,\n\t\t\tCmd: cmd,\n\t\t})\n\n\t\tlogrus.Debugf(\"Starting plugin with command: %+v\", cmd)\n\n\t\t// Connect via RPC\n\t\trpcClient, err := client.Client()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"connecting via rpc\")\n\t\t}\n\t\tlogrus.Debugf(\"plugin started.\")\n\t\t// Request the plugin\n\t\traw, err := rpcClient.Dispense(p)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"requesting rpc plugin\")\n\t\t}\n\t\tpluginBuilder := raw.(shared.PluginBuilder)\n\t\tbuilders[p] = pluginBuilder\n\t}\n\n\tb := &Builder{\n\t\tBuilders: builders,\n\t}\n\n\tlogrus.Debugf(\"Calling Init() for all plugins.\")\n\tif err := b.Init(ctx); err != nil {\n\t\tplugin.CleanupClients()\n\t\treturn nil, err\n\t}\n\treturn b, nil\n}", "func NewPlugin(name string, fn GenerateConfigsFunc) *Plugin {\n\treturn &Plugin{name: name, generate: fn}\n}", "func InitDockPlugin(netplugin *plugin.NetPlugin) error {\n\tnetPlugin = netplugin\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not retrieve hostname: %v\", err)\n\t}\n\n\tvar (\n\t\ttenantName = \"default\"\n\t)\n\n\tlog.Debugf(\"Configuring router\")\n\n\trouter := mux.NewRouter()\n\ts := router.Headers(\"Accept\", \"application/vnd.docker.plugins.v1.1+json\").\n\t\tMethods(\"POST\").Subrouter()\n\n\tdispatchMap := map[string]func(http.ResponseWriter, *http.Request){\n\t\t\"/Plugin.Activate\": activate(hostname),\n\t\t\"/Plugin.Deactivate\": deactivate(hostname),\n\t\t\"/NetworkDriver.GetCapabilities\": getCapability(),\n\t\t\"/NetworkDriver.CreateNetwork\": createNetwork(),\n\t\t\"/NetworkDriver.DeleteNetwork\": deleteNetwork(),\n\t\t\"/NetworkDriver.CreateEndpoint\": createEndpoint(tenantName, hostname),\n\t\t\"/NetworkDriver.DeleteEndpoint\": deleteEndpoint(tenantName, hostname),\n\t\t\"/NetworkDriver.EndpointOperInfo\": endpointInfo,\n\t\t\"/NetworkDriver.Join\": join(),\n\t\t\"/NetworkDriver.Leave\": leave(),\n\t}\n\n\tfor dispatchPath, dispatchFunc := range dispatchMap {\n\t\ts.HandleFunc(dispatchPath, logHandler(dispatchPath, dispatchFunc))\n\t}\n\n\ts.HandleFunc(\"/NetworkDriver.{*}\", unknownAction)\n\n\tdriverPath := path.Join(pluginPath, driverName) + \".sock\"\n\tos.Remove(driverPath)\n\tos.MkdirAll(pluginPath, 0700)\n\n\tgo func() {\n\t\tl, err := net.ListenUnix(\"unix\", &net.UnixAddr{Name: driverPath, Net: \"unix\"})\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tlog.Infof(\"docker plugin listening on %s\", driverPath)\n\t\thttp.Serve(l, router)\n\t\tl.Close()\n\t\tlog.Infof(\"docker plugin closing %s\", driverPath)\n\t}()\n\n\treturn nil\n}", "func newPod(ctx context.Context, cl client.Client, ns, name, image string, cmd []string) (*corev1.Pod, error) {\n\tc := corev1.Container{\n\t\tName: name,\n\t\tImage: image,\n\t\tCommand: cmd,\n\t}\n\tp := &corev1.Pod{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: ns,\n\t\t},\n\t\tSpec: corev1.PodSpec{\n\t\t\tContainers: []corev1.Container{c},\n\t\t\t// Kill the pod immediately so it exits quickly on deletion.\n\t\t\tTerminationGracePeriodSeconds: pointer.Int64Ptr(0),\n\t\t},\n\t}\n\tif err := cl.Create(ctx, p); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create pod %s/%s: %v\", p.Namespace, p.Name, err)\n\t}\n\treturn p, nil\n}", "func NewDriver(root string) *Driver {\n\treturn &Driver{\n\t\troot: root,\n\t}\n}", "func New(tstore plugins.TstoreClient, settings []backend.PluginSetting, dataDir string) (*usermdPlugin, error) {\n\t// Create plugin data directory\n\tdataDir = filepath.Join(dataDir, usermd.PluginID)\n\terr := os.MkdirAll(dataDir, 0700)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &usermdPlugin{\n\t\ttstore: tstore,\n\t\tdataDir: dataDir,\n\t}, nil\n}", "func New(cfg provider.InitConfig) (*P, error) {\n\tif err := os.MkdirAll(unitDir, 0750); err != nil {\n\t\treturn nil, err\n\t}\n\tm, err := manager.New(unitDir, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp := &P{m: m}\n\tswitch system.ID() {\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported system\")\n\tcase \"debian\", \"ubuntu\":\n\t\tp.pkg = new(packages.DebianPackageManager)\n\n\t\t// Just installed pre-requisites instead of pointing to the docs.\n\t\tklog.Infof(\"Installing %s, to prevent installed daemons from starting\", \"policyrcd-script-zg2\")\n\t\tok, err := p.pkg.Install(\"policyrcd-script-zg2\", \"\")\n\t\tif err != nil {\n\t\t\tklog.Warningf(\"Failed to install %s, %s. Continuing anyway\", \"policyrcd-script-zg2\", err)\n\t\t}\n\t\tif ok {\n\t\t\tklog.Infof(\"%s is already installed\", \"policyrcd-script-zg2\")\n\t\t}\n\n\tcase \"arch\":\n\t\tp.pkg = new(packages.ArchlinuxPackageManager)\n\tcase \"noop\":\n\t\tp.pkg = new(packages.NoopPackageManager)\n\t}\n\n\tp.rm = cfg.ResourceManager\n\tp.DaemonPort = cfg.DaemonPort\n\tp.ClusterDomain = cfg.KubeClusterDomain\n\n\tif cfg.ConfigPath == \"\" {\n\t\treturn p, nil\n\t}\n\n\tclientset, err := nodeutil.ClientsetFromEnv(cfg.ConfigPath)\n\tif err != nil {\n\t\treturn p, err\n\t}\n\t// Get new clientset.\n\tw := newWatcher(clientset)\n\tgo func() {\n\t\tif err := w.run(p); err != nil {\n\t\t\tklog.Fatal(err)\n\t\t}\n\t}()\n\tp.w = w\n\treturn p, nil\n}", "func New(config *runtime.Unknown, handle framework.FrameworkHandle) (framework.Plugin, error) {\n\tpodLister := handle.SharedInformerFactory().Core().V1().Pods().Lister()\n\tew := NewEtcdWrapper()\n\tconf := ctrl.GetConfigOrDie()\n\tclient, err := runtimeClient.New(conf, runtimeClient.Options{\n\t\tScheme: scheme,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tam := &Antman{\n\t\tframeworkHandle: handle,\n\t\tpodLister: podLister,\n\t\tclock: util.RealClock{},\n\t\tetcdWrapper: ew,\n\t\truntimeCli: client,\n\t}\n\tpodInformer := handle.SharedInformerFactory().Core().V1().Pods().Informer()\n\tpodInformer.AddEventHandler(\n\t\tcache.FilteringResourceEventHandler{\n\t\t\tFilterFunc: func(obj interface{}) bool {\n\t\t\t\tswitch t := obj.(type) {\n\t\t\t\tcase *v1.Pod:\n\t\t\t\t\treturn true\n\t\t\t\tcase cache.DeletedFinalStateUnknown:\n\t\t\t\t\tif _, ok := t.Obj.(*v1.Pod); ok {\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\treturn false\n\t\t\t\t}\n\t\t\t},\n\t\t\tHandler: cache.ResourceEventHandlerFuncs{\n\t\t\t\tUpdateFunc: am.podUpdate,\n\t\t\t},\n\t\t},\n\t)\n\treturn am, nil\n}", "func New() (d *Driver) {\n\treturn &Driver{}\n}", "func (o PluginDnsNsReg) NewPlugin(ctx *core.PluginCtx, initJson []byte) (*core.PluginBase, error) {\n\treturn NewDnsNs(ctx, initJson)\n}", "func newPodForCR(cr *sdewanv1alpha1.Sdewan) *corev1.Pod {\n\tlabels := map[string]string{\n\t\t\"app\": cr.Name,\n\t}\n\tpriv := true\n\tvar netmaps []map[string]interface{}\n\tfor _, net := range cr.Spec.Networks {\n\t\tnetmaps = append(netmaps, map[string]interface{}{\n\t\t\t\"name\": net.Name,\n\t\t\t\"interface\": net.Interface,\n\t\t\t\"defaultGateway\": fmt.Sprintf(\"%t\", net.DefaultGateway),\n\t\t})\n\t}\n\tnetjson, _ := json.MarshalIndent(netmaps, \"\", \" \")\n\tvolumes := []corev1.Volume{\n\t\t{\n\t\t\tName: cr.Name,\n\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\tConfigMap: &corev1.ConfigMapVolumeSource{\n\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{Name: cr.Name},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\treturn &corev1.Pod{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name,\n\t\t\tNamespace: cr.Namespace,\n\t\t\tLabels: labels,\n\t\t\tAnnotations: map[string]string{\n\t\t\t\t\"k8s.v1.cni.cncf.io/networks\": `[{ \"name\": \"ovn-networkobj\"}]`,\n\t\t\t\t\"k8s.plugin.opnfv.org/nfn-network\": `{ \"type\": \"ovn4nfv\", \"interface\": ` + string(netjson) + \"}\",\n\t\t\t},\n\t\t},\n\t\tSpec: corev1.PodSpec{\n\t\t\tContainers: []corev1.Container{\n\t\t\t\t{\n\t\t\t\t\tName: \"sdewan\",\n\t\t\t\t\tImage: OpenwrtTag,\n\t\t\t\t\tCommand: []string{\"/bin/sh\", \"/tmp/sdewan/entrypoint.sh\"},\n\t\t\t\t\tImagePullPolicy: corev1.PullIfNotPresent,\n\t\t\t\t\tSecurityContext: &corev1.SecurityContext{\n\t\t\t\t\t\tPrivileged: &priv,\n\t\t\t\t\t},\n\t\t\t\t\tVolumeMounts: []corev1.VolumeMount{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: cr.Name,\n\t\t\t\t\t\t\tReadOnly: true,\n\t\t\t\t\t\t\tMountPath: \"/tmp/sdewan\",\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\tNodeSelector: map[string]string{\"kubernetes.io/hostname\": cr.Spec.Node},\n\t\t\tVolumes: volumes,\n\t\t},\n\t}\n}", "func newDriverV2(options *DriverOptions) *DriverV2 {\n\tklog.Warning(\"Using DriverV2\")\n\tdriver := DriverV2{}\n\tdriver.Name = options.DriverName\n\tdriver.Version = driverVersion\n\tdriver.NodeID = options.NodeID\n\tdriver.VolumeAttachLimit = options.VolumeAttachLimit\n\tdriver.volumeLocks = volumehelper.NewVolumeLocks()\n\tdriver.perfOptimizationEnabled = options.EnablePerfOptimization\n\tdriver.cloudConfigSecretName = options.CloudConfigSecretName\n\tdriver.cloudConfigSecretNamespace = options.CloudConfigSecretNamespace\n\tdriver.customUserAgent = options.CustomUserAgent\n\tdriver.userAgentSuffix = options.UserAgentSuffix\n\tdriver.useCSIProxyGAInterface = options.UseCSIProxyGAInterface\n\tdriver.enableOtelTracing = options.EnableOtelTracing\n\tdriver.ioHandler = azureutils.NewOSIOHandler()\n\tdriver.hostUtil = hostutil.NewHostUtil()\n\n\ttopologyKey = fmt.Sprintf(\"topology.%s/zone\", driver.Name)\n\treturn &driver\n}", "func createPlugin(pkg parse.Package, errChan chan error) {\n\tcmd := exec.Command(\"go\", \"build\", \"-buildmode=plugin\",\n\t\t\"-o\", \"./\"+path.Join(PluginFolder, pkg.Name+\".so\"),\n\t\t\"./\"+path.Join(PluginFolder, pkg.Path))\n\n\t// create output buffer for error logging\n\tvar outBuf bytes.Buffer\n\tcmd.Stdout = &outBuf\n\tcmd.Stderr = &outBuf\n\n\t// copy env and turn off go modules\n\tcmd.Env = os.Environ()\n\tcmd.Env = append(cmd.Env, \"GO111MODULE=off\")\n\n\terr := cmd.Run()\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Failed to build plugin for package:%s\\n%s\", pkg.Name, outBuf.String())\n\t}\n\n\terrChan <- err\n}", "func NewDriver(root string, client *pilosa.Client) *Driver {\n\treturn &Driver{\n\t\troot: root,\n\t\tclient: client,\n\t}\n}", "func NewPluginRunner(plugin interface{}, opts ...RunnerOption) *cobra.Command {\n\tk := &PluginRunner{\n\t\tplugin: plugin,\n\t\tconfig: func(*cobra.Command, []string) ([]byte, error) { return nil, nil },\n\t\tgenerate: func() (resmap.ResMap, error) { return resmap.New(), nil },\n\t\ttransform: func(resmap.ResMap) error { return nil },\n\t\tprint: asYaml,\n\t}\n\n\t// Setup the command run stages\n\tk.cmd = &cobra.Command{\n\t\tPreRunE: k.preRun,\n\t\tRunE: k.run,\n\t\tPostRunE: k.postRun,\n\t}\n\n\t// Establish generate and transform functions\n\tif p, ok := plugin.(resmap.Generator); ok {\n\t\tk.generate = p.Generate\n\t}\n\tif p, ok := plugin.(resmap.Transformer); ok {\n\t\tk.generate = k.newResMapFromStdin\n\t\tk.transform = p.Transform\n\t}\n\n\t// Apply the runner options\n\tfor _, opt := range opts {\n\t\topt(k)\n\t}\n\n\treturn k.cmd\n}", "func (o PluginDnsCReg) NewPlugin(ctx *core.PluginCtx, initJson []byte) (*core.PluginBase, error) {\n\treturn NewDnsClient(ctx, initJson)\n}", "func NewPlugin(name string, config *common.PluginConfig) (*ipamPlugin, error) {\n\t// Setup base plugin.\n\tplugin, err := cni.NewPlugin(name, config.Version)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Setup address manager.\n\tam, err := ipam.NewAddressManager()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create IPAM plugin.\n\tipamPlg := &ipamPlugin{\n\t\tPlugin: plugin,\n\t\tam: am,\n\t}\n\n\tconfig.IpamApi = ipamPlg\n\n\treturn ipamPlg, nil\n}", "func NewPlugin(name string, path string, args []string, config skyconfig.Configuration) Plugin {\n\tfactory := transportFactories[name]\n\tif factory == nil {\n\t\tpanic(fmt.Errorf(\"unable to find plugin transport '%v'\", name))\n\t}\n\tp := Plugin{\n\t\ttransport: factory.Open(path, args, config),\n\t\tgatewayMap: map[string]*router.Gateway{},\n\t}\n\treturn p\n}", "func plugin_init() unsafe.Pointer {\n\t// If your plugin needs to do any initialization, you can\n\t// either put it here or implement a Load() method.\n\t// ...\n\n\t// Then you must call the following function.\n\treturn nbdkit.PluginInitialize(pluginName, &DiskPlugin{})\n}", "func newPodForPolicy(name, ns string, node *corev1.Node) *corev1.Pod {\n\tlabels := map[string]string{\n\t\t\"appName\": name,\n\t\t\"appNamespace\": ns,\n\t}\n\ttrueVal := true\n\thostVolTypeDir := corev1.HostPathDirectory\n\treturn &corev1.Pod{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: GetInstallerPodName(name, ns, node),\n\t\t\tNamespace: config.GetOperatorNamespace(),\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: corev1.PodSpec{\n\t\t\tContainers: []corev1.Container{\n\t\t\t\t{\n\t\t\t\t\tName: \"policy-installer\",\n\t\t\t\t\t// TODO(jaosorior): Add udica image or equivalent to a\n\t\t\t\t\t// more formal registry\n\t\t\t\t\tImage: \"quay.io/jaosorior/udica\",\n\t\t\t\t\tCommand: []string{\"/bin/sh\"},\n\t\t\t\t\tArgs: []string{\"-c\", \"semodule -vi /tmp/policy/*.cil /usr/share/udica/templates/*cil;\"},\n\t\t\t\t\tSecurityContext: &corev1.SecurityContext{\n\t\t\t\t\t\tPrivileged: &trueVal,\n\t\t\t\t\t},\n\t\t\t\t\tVolumeMounts: []corev1.VolumeMount{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"fsselinux\",\n\t\t\t\t\t\t\tMountPath: \"/sys/fs/selinux\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"etcselinux\",\n\t\t\t\t\t\t\tMountPath: \"/etc/selinux\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"varlibselinux\",\n\t\t\t\t\t\t\tMountPath: \"/var/lib/selinux\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"policyvolume\",\n\t\t\t\t\t\t\tMountPath: \"/tmp/policy\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t// This container needs to keep running so we can run the uninstall script.\n\t\t\t\t{\n\t\t\t\t\tName: \"policy-uninstaller\",\n\t\t\t\t\t// NOTE(jaosorior): Add udica image or equivalent to a\n\t\t\t\t\t// more formal registry\n\t\t\t\t\tImage: \"quay.io/jaosorior/udica\",\n\t\t\t\t\tCommand: []string{\"/bin/sh\"},\n\t\t\t\t\tArgs: []string{\"-c\", \"trap 'exit 0' SIGINT SIGTERM; while true; do sleep infinity; done;\"},\n\t\t\t\t\tLifecycle: &corev1.Lifecycle{\n\t\t\t\t\t\tPreStop: &corev1.Handler{\n\t\t\t\t\t\t\tExec: &corev1.ExecAction{\n\t\t\t\t\t\t\t\tCommand: []string{\"/bin/sh\", \"-c\", fmt.Sprintf(\"semodule -vr '%s'\", GetPolicyName(name, ns))},\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\tSecurityContext: &corev1.SecurityContext{\n\t\t\t\t\t\tPrivileged: &trueVal,\n\t\t\t\t\t},\n\t\t\t\t\tVolumeMounts: []corev1.VolumeMount{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"fsselinux\",\n\t\t\t\t\t\t\tMountPath: \"/sys/fs/selinux\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"etcselinux\",\n\t\t\t\t\t\t\tMountPath: \"/etc/selinux\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"varlibselinux\",\n\t\t\t\t\t\t\tMountPath: \"/var/lib/selinux\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"policyvolume\",\n\t\t\t\t\t\t\tMountPath: \"/tmp/policy\",\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\t// NOTE(jaosorior): use another service account\n\t\t\tServiceAccountName: \"security-profiles-operator\",\n\t\t\tRestartPolicy: corev1.RestartPolicyNever,\n\t\t\tNodeName: node.Name,\n\t\t\tVolumes: []corev1.Volume{\n\t\t\t\t{\n\t\t\t\t\tName: \"fsselinux\",\n\t\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\t\tHostPath: &corev1.HostPathVolumeSource{\n\t\t\t\t\t\t\tPath: \"/sys/fs/selinux\",\n\t\t\t\t\t\t\tType: &hostVolTypeDir,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"etcselinux\",\n\t\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\t\tHostPath: &corev1.HostPathVolumeSource{\n\t\t\t\t\t\t\tPath: \"/etc/selinux\",\n\t\t\t\t\t\t\tType: &hostVolTypeDir,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"varlibselinux\",\n\t\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\t\tHostPath: &corev1.HostPathVolumeSource{\n\t\t\t\t\t\t\tPath: \"/var/lib/selinux\",\n\t\t\t\t\t\t\tType: &hostVolTypeDir,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"policyvolume\",\n\t\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\t\tConfigMap: &corev1.ConfigMapVolumeSource{\n\t\t\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\t\t\tName: GetPolicyConfigMapName(name, ns),\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\tTolerations: []corev1.Toleration{\n\t\t\t\t{\n\t\t\t\t\tKey: \"node-role.kubernetes.io/master\",\n\t\t\t\t\tOperator: \"Exists\",\n\t\t\t\t\tEffect: \"NoSchedule\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "func NewPlugin(name, version, endpointType string) (*Plugin, error) {\n\t// Setup base plugin.\n\tplugin, err := common.NewPlugin(name, version)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Plugin{\n\t\tPlugin: plugin,\n\t\tEndpointType: endpointType,\n\t}, nil\n}", "func New(b bot.Bot) *BeersPlugin {\n\tif _, err := b.DB().Exec(`create table if not exists untappd (\n\t\t\tid integer primary key,\n\t\t\tuntappdUser string,\n\t\t\tchannel string,\n\t\t\tlastCheckin integer,\n\t\t\tchanNick string\n\t\t);`); err != nil {\n\t\tlog.Fatal().Err(err)\n\t}\n\tp := &BeersPlugin{\n\t\tb: b,\n\t\tc: b.Config(),\n\t\tdb: b.DB(),\n\n\t\tuntapdCache: make(map[int]bool),\n\t}\n\n\tp.register()\n\tb.Register(p, bot.Help, p.help)\n\n\tp.registerWeb()\n\n\ttoken := p.c.Get(\"Untappd.Token\", \"NONE\")\n\tif token == \"NONE\" || token == \"\" {\n\t\tlog.Error().Msgf(\"No untappd token. Checking disabled.\")\n\t\treturn p\n\t}\n\n\tfor _, channel := range p.c.GetArray(\"Untappd.Channels\", []string{}) {\n\t\tgo p.untappdLoop(b.DefaultConnector(), channel)\n\t}\n\n\treturn p\n}", "func NewDriver(baseURL string, token string) (*Driver, error) {\n\traw, err := hype.New(baseURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\td := &Driver{\n\t\traw,\n\t\ttoken,\n\t\thype.NewHeader(\"Accept\", \"application/json\"),\n\t\thype.NewHeader(\"Content-Type\", \"application/json\"),\n\t\thype.NewHeader(\"User-Agent\", \"fbz/0.1.0 (https://github.com/ess/fbz)\"),\n\t}\n\n\treturn d, nil\n}", "func NewDriver(ctx context.Context, prefix string) workers.Driver {\n\tdriver, err := redis.NewDriver(\n\t\tctx,\n\t\tredis.WithQueuePrefix(prefix),\n\t\tredis.WithRedisPool(client),\n\t)\n\tassert.Nil(err)\n\treturn driver\n}", "func NewWidgetDevicePlugin(resourceConfigs string, resourceName string) *WidgetDevicePlugin {\n\tlog.Debugf(\"other instance of GetWidgetDevices\")\n\tdevices, err := GetWidgetDevices(resourceConfigs)\n\tif err != nil {\n\t\tlog.Errorf(\"Error detecting widget devices: %v\", err)\n\t\treturn nil\n\t}\n\n\t// because we can run multiple instances of this plugin\n\t// we need to uniquely name the socket for each\n\tencodedResourceName := base64.StdEncoding.EncodeToString([]byte(resourceName))\n\tlog.Debugf(\"Base64 encoded Resource Name: %s\", encodedResourceName)\n\n\tvar devs []*pluginapi.Device\n\tdevMap := make(map[string]Device)\n\tfor _, device := range devices {\n\t\t// id := device.RdmaDevice.Name\n\t\tid := device.Name\n\t\tdevs = append(devs, &pluginapi.Device{\n\t\t\tID: id,\n\t\t\tHealth: pluginapi.Healthy,\n\t\t})\n\t\tdevMap[id] = device\n\t}\n\n\treturn &WidgetDevicePlugin{\n\t\t// masterNetDevice: resourceConfigs,\n\t\tsocket: fmt.Sprintf(serverSock, encodedResourceName),\n\t\tdevs: devs,\n\t\tdevices: devMap,\n\t\tstop: make(chan interface{}),\n\t\thealth: make(chan *pluginapi.Device),\n\t}\n}", "func New(L *lua.LState, rootDir, cacheDir, pluginName, host, dbname, user, password string, port int, params map[string]string) error {\n\tpool := plugins.NewPool(rootDir, cacheDir)\n\tconn := &plugins.Connection{\n\t\tHost: host,\n\t\tDBName: dbname,\n\t\tPort: port,\n\t\tUserName: user,\n\t\tPassword: password,\n\t\tParams: params,\n\t}\n\tconnections := make(map[string]*plugins.Connection)\n\tconnections[`target`] = conn\n\tconnections[`storage`] = conn\n\tf := &framework{\n\t\tpool: pool,\n\t\tpluginName: pluginName,\n\t\thost: pluginName,\n\t\tsecrets: secrets.New(``),\n\t}\n\tpool.RegisterHost(f.host, connections)\n\tud := L.NewUserData()\n\tud.Value = f\n\tL.SetMetatable(ud, L.GetTypeMetatable(`testing_framework_ud`))\n\tL.SetGlobal(\"tested_plugin\", ud)\n\treturn nil\n}", "func New() *Plugin {\n\treturn &Plugin{metricsConfigs: make(map[string]configReader.Metric)}\n}", "func NewOTelPlugin(db *DB, opts ...Option) (Plugin, error) {\n\tc, err := newConfig(opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp := &otelPlugin{\n\t\ttracerProvider: c.tracerProvider,\n\t\tmeterProvider: c.meterProvider,\n\t\toperationName: c.operationName,\n\t\tspanNameFormatter: c.spanNameFormatter,\n\t\ttracer: c.tracer,\n\t\tmeter: c.meter,\n\t\tmetricDuration: c.metricDuration,\n\t}\n\n\tswitch dialector := db.Dialector.(type) {\n\tcase *dialectmysql.Dialector:\n\t\tcfg, err := mysql.ParseDSN(dialector.DSN)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcfg.Passwd = \"\"\n\n\t\tnetPeerIP, netPeerPort, err := parseAddr(cfg.Addr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tp.attrs = append(p.attrs, semconv.DBSystemMySQL)\n\t\tp.attrs = append(p.attrs, semconv.DBConnectionStringKey.String(cfg.FormatDSN()))\n\t\tp.attrs = append(p.attrs, semconv.DBUserKey.String(cfg.User))\n\t\tp.attrs = append(p.attrs, semconv.NetPeerIPKey.String(netPeerIP))\n\t\tp.attrs = append(p.attrs, semconv.NetPeerPortKey.Int(netPeerPort))\n\t\tp.attrs = append(p.attrs, parseNetTransport(cfg.Net))\n\t\tp.attrs = append(p.attrs, semconv.DBNameKey.String(cfg.DBName))\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported dialector type\")\n\t}\n\n\treturn p, nil\n}", "func New(config config.Config) Plugins {\n\tpkg := Plugins{\n\t\tclient: http.NewClient(config),\n\t\tpager: &http.LinkHeaderPager{},\n\t}\n\n\treturn pkg\n}", "func New(options ...func(*Plugin)) config.Plugin {\n\tp := &Plugin{\n\t\tcache: &configCache{},\n\t}\n\tfor _, opt := range options {\n\t\topt(p)\n\t}\n\n\treturn p\n}", "func NewDockerVolumePlugin(options *Options) (*DockerVolumePlugin, error) {\n\thostUrl := GetHostURL(hostName, port)\n\tvar err error\n\n\tdvp := &DockerVolumePlugin{\n\t\tstripK8sOpts: options.StripK8sFromOptions,\n\t\tclient: connectivity.NewHTTPClientWithTimeout(hostUrl, dvpSocketTimeout),\n\t\tListOfStorageResourceOptions: options.ListOfStorageResourceOptions,\n\t\tFactorForConversion: options.FactorForConversion,\n\t}\n\n\tif options.SupportsCapabilities {\n\t\t// test connectivity\n\t\t_, err = dvp.Capabilities()\n\t\tif err != nil {\n\t\t\treturn dvp, err\n\t\t}\n\t}\n\n\treturn dvp, nil\n\n}", "func (opts Options) New(req *pluginpb.CodeGeneratorRequest) (*Plugin, error) {\n\tgen := &Plugin{\n\t\tRequest: req,\n\t\tFilesByPath: make(map[string]*File),\n\t\tfileReg: new(protoregistry.Files),\n\t\tenumsByName: make(map[protoreflect.FullName]*Enum),\n\t\tmessagesByName: make(map[protoreflect.FullName]*Message),\n\t\topts: opts,\n\t}\n\n\tpackageNames := make(map[string]GoPackageName) // filename -> package name\n\timportPaths := make(map[string]GoImportPath) // filename -> import path\n\tfor _, param := range strings.Split(req.GetParameter(), \",\") {\n\t\tvar value string\n\t\tif i := strings.Index(param, \"=\"); i >= 0 {\n\t\t\tvalue = param[i+1:]\n\t\t\tparam = param[0:i]\n\t\t}\n\t\tswitch param {\n\t\tcase \"\":\n\t\t\t// Ignore.\n\t\tcase \"module\":\n\t\t\tgen.module = value\n\t\tcase \"paths\":\n\t\t\tswitch value {\n\t\t\tcase \"import\":\n\t\t\t\tgen.pathType = pathTypeImport\n\t\t\tcase \"source_relative\":\n\t\t\t\tgen.pathType = pathTypeSourceRelative\n\t\t\tdefault:\n\t\t\t\treturn nil, fmt.Errorf(`unknown path type %q: want \"import\" or \"source_relative\"`, value)\n\t\t\t}\n\t\tcase \"annotate_code\":\n\t\t\tswitch value {\n\t\t\tcase \"true\", \"\":\n\t\t\t\tgen.annotateCode = true\n\t\t\tcase \"false\":\n\t\t\tdefault:\n\t\t\t\treturn nil, fmt.Errorf(`bad value for parameter %q: want \"true\" or \"false\"`, param)\n\t\t\t}\n\t\tdefault:\n\t\t\tif param[0] == 'M' {\n\t\t\t\timpPath, pkgName := splitImportPathAndPackageName(value)\n\t\t\t\tif pkgName != \"\" {\n\t\t\t\t\tpackageNames[param[1:]] = pkgName\n\t\t\t\t}\n\t\t\t\tif impPath != \"\" {\n\t\t\t\t\timportPaths[param[1:]] = impPath\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif opts.ParamFunc != nil {\n\t\t\t\tif err := opts.ParamFunc(param, value); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// When the module= option is provided, we strip the module name\n\t// prefix from generated files. This only makes sense if generated\n\t// filenames are based on the import path.\n\tif gen.module != \"\" && gen.pathType == pathTypeSourceRelative {\n\t\treturn nil, fmt.Errorf(\"cannot use module= with paths=source_relative\")\n\t}\n\n\t// Figure out the import path and package name for each file.\n\t//\n\t// The rules here are complicated and have grown organically over time.\n\t// Interactions between different ways of specifying package information\n\t// may be surprising.\n\t//\n\t// The recommended approach is to include a go_package option in every\n\t// .proto source file specifying the full import path of the Go package\n\t// associated with this file.\n\t//\n\t// option go_package = \"google.golang.org/protobuf/types/known/anypb\";\n\t//\n\t// Alternatively, build systems which want to exert full control over\n\t// import paths may specify M<filename>=<import_path> flags.\n\tfor _, fdesc := range gen.Request.ProtoFile {\n\t\t// The \"M\" command-line flags take precedence over\n\t\t// the \"go_package\" option in the .proto source file.\n\t\tfilename := fdesc.GetName()\n\t\timpPath, pkgName := splitImportPathAndPackageName(fdesc.GetOptions().GetGoPackage())\n\t\tif importPaths[filename] == \"\" && impPath != \"\" {\n\t\t\timportPaths[filename] = impPath\n\t\t}\n\t\tif packageNames[filename] == \"\" && pkgName != \"\" {\n\t\t\tpackageNames[filename] = pkgName\n\t\t}\n\t\tswitch {\n\t\tcase importPaths[filename] == \"\":\n\t\t\t// The import path must be specified one way or another.\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"unable to determine Go import path for %q\\n\\n\"+\n\t\t\t\t\t\"Please specify either:\\n\"+\n\t\t\t\t\t\"\\t• a \\\"go_package\\\" option in the .proto source file, or\\n\"+\n\t\t\t\t\t\"\\t• a \\\"M\\\" argument on the command line.\\n\\n\"+\n\t\t\t\t\t\"See %v for more information.\\n\",\n\t\t\t\tfdesc.GetName(), goPackageDocURL)\n\t\tcase !strings.Contains(string(importPaths[filename]), \".\") &&\n\t\t\t!strings.Contains(string(importPaths[filename]), \"/\"):\n\t\t\t// Check that import paths contain at least a dot or slash to avoid\n\t\t\t// a common mistake where import path is confused with package name.\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"invalid Go import path %q for %q\\n\\n\"+\n\t\t\t\t\t\"The import path must contain at least one period ('.') or forward slash ('/') character.\\n\\n\"+\n\t\t\t\t\t\"See %v for more information.\\n\",\n\t\t\t\tstring(importPaths[filename]), fdesc.GetName(), goPackageDocURL)\n\t\tcase packageNames[filename] == \"\":\n\t\t\t// If the package name is not explicitly specified,\n\t\t\t// then derive a reasonable package name from the import path.\n\t\t\t//\n\t\t\t// NOTE: The package name is derived first from the import path in\n\t\t\t// the \"go_package\" option (if present) before trying the \"M\" flag.\n\t\t\t// The inverted order for this is because the primary use of the \"M\"\n\t\t\t// flag is by build systems that have full control over the\n\t\t\t// import paths all packages, where it is generally expected that\n\t\t\t// the Go package name still be identical for the Go toolchain and\n\t\t\t// for custom build systems like Bazel.\n\t\t\tif impPath == \"\" {\n\t\t\t\timpPath = importPaths[filename]\n\t\t\t}\n\t\t\tpackageNames[filename] = cleanPackageName(path.Base(string(impPath)))\n\t\t}\n\t}\n\n\t// Consistency check: Every file with the same Go import path should have\n\t// the same Go package name.\n\tpackageFiles := make(map[GoImportPath][]string)\n\tfor filename, importPath := range importPaths {\n\t\tif _, ok := packageNames[filename]; !ok {\n\t\t\t// Skip files mentioned in a M<file>=<import_path> parameter\n\t\t\t// but which do not appear in the CodeGeneratorRequest.\n\t\t\tcontinue\n\t\t}\n\t\tpackageFiles[importPath] = append(packageFiles[importPath], filename)\n\t}\n\tfor importPath, filenames := range packageFiles {\n\t\tfor i := 1; i < len(filenames); i++ {\n\t\t\tif a, b := packageNames[filenames[0]], packageNames[filenames[i]]; a != b {\n\t\t\t\treturn nil, fmt.Errorf(\"Go package %v has inconsistent names %v (%v) and %v (%v)\",\n\t\t\t\t\timportPath, a, filenames[0], b, filenames[i])\n\t\t\t}\n\t\t}\n\t}\n\n\t// The extracted types from the full import set\n\ttypeRegistry := newExtensionRegistry()\n\tfor _, fdesc := range gen.Request.ProtoFile {\n\t\tfilename := fdesc.GetName()\n\t\tif gen.FilesByPath[filename] != nil {\n\t\t\treturn nil, fmt.Errorf(\"duplicate file name: %q\", filename)\n\t\t}\n\t\tf, err := newFile(gen, fdesc, packageNames[filename], importPaths[filename])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tgen.Files = append(gen.Files, f)\n\t\tgen.FilesByPath[filename] = f\n\t\tif err = typeRegistry.registerAllExtensionsFromFile(f.Desc); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tfor _, filename := range gen.Request.FileToGenerate {\n\t\tf, ok := gen.FilesByPath[filename]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"no descriptor for generated file: %v\", filename)\n\t\t}\n\t\tf.Generate = true\n\t}\n\n\t// Create fully-linked descriptors if new extensions were found\n\tif typeRegistry.hasNovelExtensions() {\n\t\tfor _, f := range gen.Files {\n\t\t\tb, err := proto.Marshal(f.Proto.ProtoReflect().Interface())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\terr = proto.UnmarshalOptions{Resolver: typeRegistry}.Unmarshal(b, f.Proto)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\treturn gen, nil\n}", "func NewDriver(nodeID string, endpoint string, synoOption *options.SynologyOptions) (Driver, error) {\n\tglog.Infof(\"Driver: %v\", DriverName)\n\n\tsession, _, err := Login(synoOption)\n\tif err != nil {\n\t\tglog.V(3).Infof(\"Failed to login: %v\", err)\n\t\treturn nil, err\n\t}\n\n\td := &driver{\n\t\tendpoint: endpoint,\n\t\tsynologyHost: synoOption.Host,\n\t\tsession: *session,\n\t}\n\n\tcsiDriver := csicommon.NewCSIDriver(DriverName, version, nodeID)\n\tcsiDriver.AddControllerServiceCapabilities(\n\t\t[]csi.ControllerServiceCapability_RPC_Type{\n\t\t\tcsi.ControllerServiceCapability_RPC_LIST_VOLUMES,\n\t\t\tcsi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME,\n\t\t\tcsi.ControllerServiceCapability_RPC_PUBLISH_UNPUBLISH_VOLUME,\n\t\t\tcsi.ControllerServiceCapability_RPC_EXPAND_VOLUME,\n\t\t})\n\tcsiDriver.AddVolumeCapabilityAccessModes(\n\t\t[]csi.VolumeCapability_AccessMode_Mode{csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER})\n\n\td.csiDriver = csiDriver\n\n\treturn d, nil\n}", "func NewPlugin(service Service) (*Plugin, error) {\n\tif service == nil {\n\t\treturn nil, fmt.Errorf(\"Service Interface Required.\")\n\t}\n\n\treturn &Plugin{\n\t\tService: service,\n\t}, nil\n}", "func NewDevicePluginHandlerImpl(updateCapacityFunc func(v1.ResourceList)) (*DevicePluginHandlerImpl, error) {\n\tglog.V(2).Infof(\"Creating Device Plugin Handler\")\n\thandler := &DevicePluginHandlerImpl{\n\t\tallDevices: make(map[string]sets.String),\n\t\tallocatedDevices: make(map[string]podDevices),\n\t}\n\n\tdeviceManagerMonitorCallback := func(resourceName string, added, updated, deleted []*pluginapi.Device) {\n\t\tvar capacity = v1.ResourceList{}\n\t\tkept := append(updated, added...)\n\t\tif _, ok := handler.allDevices[resourceName]; !ok {\n\t\t\thandler.allDevices[resourceName] = sets.NewString()\n\t\t}\n\t\t// For now, DevicePluginHandler only keeps track of healthy devices.\n\t\t// We can revisit this later when the need comes to track unhealthy devices here.\n\t\tfor _, dev := range kept {\n\t\t\tif dev.Health == pluginapi.Healthy {\n\t\t\t\thandler.allDevices[resourceName].Insert(dev.ID)\n\t\t\t} else {\n\t\t\t\thandler.allDevices[resourceName].Delete(dev.ID)\n\t\t\t}\n\t\t}\n\t\tfor _, dev := range deleted {\n\t\t\thandler.allDevices[resourceName].Delete(dev.ID)\n\t\t}\n\t\tcapacity[v1.ResourceName(resourceName)] = *resource.NewQuantity(int64(handler.allDevices[resourceName].Len()), resource.DecimalSI)\n\t\tupdateCapacityFunc(capacity)\n\t}\n\n\tmgr, err := deviceplugin.NewManagerImpl(pluginapi.KubeletSocket, deviceManagerMonitorCallback)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to initialize device plugin manager: %+v\", err)\n\t}\n\n\thandler.devicePluginManager = mgr\n\thandler.devicePluginManagerMonitorCallback = deviceManagerMonitorCallback\n\t// Loads in allocatedDevices information from disk.\n\terr = handler.readCheckpoint()\n\tif err != nil {\n\t\tglog.Warningf(\"Continue after failing to read checkpoint file. Device allocation info may NOT be up-to-date. Err: %v\", err)\n\t}\n\treturn handler, nil\n}", "func newTestKubelet(t *testing.T, controllerAttachDetachEnabled bool) *TestKubelet {\n\timageList := []kubecontainer.Image{\n\t\t{\n\t\t\tID: \"abc\",\n\t\t\tRepoTags: []string{\"k8s.gcr.io:v1\", \"k8s.gcr.io:v2\"},\n\t\t\tSize: 123,\n\t\t},\n\t\t{\n\t\t\tID: \"efg\",\n\t\t\tRepoTags: []string{\"k8s.gcr.io:v3\", \"k8s.gcr.io:v4\"},\n\t\t\tSize: 456,\n\t\t},\n\t}\n\n\treturn newTestKubeletWithImageList(t, imageList, controllerAttachDetachEnabled, true /*initFakeVolumePlugin*/)\n}", "func NewDriver(name string, loader func(interface{}) error) (Driver, error) {\n\tfactorysMu.RLock()\n\tfactoryi, ok := factories[name]\n\tfactorysMu.RUnlock()\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"file: unknown driver %q (forgotten import?)\", name)\n\t}\n\treturn factoryi(loader)\n}", "func PluginSpecDir() string {\n\treturn filepath.Join(os.Getenv(\"programdata\"), \"docker\", \"plugins\")\n}", "func NewMyDockerVolumePlugin(path string) (*MyDockerVolumePlugin, error) {\n\tmdnp := &MyDockerVolumePlugin{\n\t\trootPathOnDisk: path,\n\t\tmetadata: make(map[string]*volumeInfo),\n\t}\n\treturn mdnp, nil\n}", "func NewProbe(config *config.Config, opts Opts) (*Probe, error) {\n\topts.normalize()\n\n\tctx, cancel := context.WithCancel(context.Background())\n\n\tp := &Probe{\n\t\tOpts: opts,\n\t\tConfig: config,\n\t\tctx: ctx,\n\t\tcancelFnc: cancel,\n\t\tStatsdClient: opts.StatsdClient,\n\t\tdiscarderRateLimiter: rate.NewLimiter(rate.Every(time.Second/5), 100),\n\t\tevent: &model.Event{},\n\t\tPlatformProbe: PlatformProbe{\n\t\t\tonStart: make(chan *procmon.ProcessStartNotification),\n\t\t\tonStop: make(chan *procmon.ProcessStopNotification),\n\t\t},\n\t}\n\tresolvers, err := resolvers.NewResolvers(config, p.StatsdClient)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp.resolvers = resolvers\n\n\tp.fieldHandlers = &FieldHandlers{resolvers: resolvers}\n\n\t// be sure to zero the probe event before everything else\n\tp.zeroEvent()\n\n\treturn p, nil\n}", "func NewPodUpgrade() *PodUpgrade {\n\treturn &PodUpgrade{}\n}", "func newDefaultPodManager() *podManager {\n\treturn &podManager{\n\t\trunningPods: make(map[string]*runningPod),\n\t\trequests: make(chan *cniserver.PodRequest, 20),\n\t\treattachPods: make(map[string]*corev1.Pod),\n\t}\n}", "func ManaPlugin() *node.Plugin {\n\tonce.Do(func() {\n\t\tmanaPlugin = node.NewPlugin(PluginName, node.Enabled, configureManaPlugin, runManaPlugin)\n\t})\n\treturn manaPlugin\n}", "func newPodEventRecorder(cs kubernetes.Interface, ns string, podName string) Recorder {\n\tvar recorder Recorder\n\tpod, err := cs.CoreV1().Pods(ns).Get(podName, metav1.GetOptions{})\n\tif err != nil {\n\t\tglog.Errorf(\"failed to get pod with name %s for event recorder: %v\", podName, err)\n\t\trecorder = &FakeRecorder{}\n\t} else {\n\t\trecorder = NewRecorder(cs, ns, pod)\n\t}\n\treturn recorder\n}", "func NewDriver(cfg *configv1.InfrastructureStatus, clnt client.Client) Driver {\n\n\tctx := context.Background()\n\tvar driver Driver\n\n\tif cfg.PlatformStatus.Type == \"AWS\" {\n\t\tdriver = s3.NewDriver(ctx, cfg, clnt)\n\t}\n\n\tif cfg.PlatformStatus.Type == \"GCP\" {\n\t\tdriver = gcs.NewDriver(ctx, cfg, clnt)\n\t}\n\n\treturn driver\n}", "func NewDriver(config dbmate.DriverConfig) dbmate.Driver {\n\treturn &Driver{\n\t\tmigrationsTableName: config.MigrationsTableName,\n\t\tdatabaseURL: config.DatabaseURL,\n\t\tlog: config.Log,\n\t}\n}", "func New(next goproxy.Plugin, cache FileCache) goproxy.Plugin {\n\treturn &plugin{next: next, cache: cache}\n}", "func NewMyDockerNetworkPlugin(scope string) (*MyDockerNetworkPlugin, error) {\n\tmdnp := &MyDockerNetworkPlugin{\n\t\tscope: scope, // TODO(Krish): local vs global?\n\t}\n\treturn mdnp, nil\n}", "func NewDriver(p *Periph) *Driver {\n\treturn &Driver{p: p, timeoutRx: -1, timeoutTx: -1}\n}", "func New(path string) (Plugin, error) {\n\tplugin, err := plugin.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp, err := plugin.Lookup(\"Plugin\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn p.(Plugin), nil\n}", "func Plugin() *node.Plugin {\n\tonce.Do(func() {\n\t\tplugin = node.NewPlugin(PluginName, node.Enabled, configure)\n\t})\n\treturn plugin\n}", "func NewPlugin() (*Plugin, error) {\n\treporter := NewReporter()\n\tplugin := &Plugin{\n\t\treporter: reporter,\n\t}\n\treturn plugin, nil\n}", "func New(c *Config) *manager {\n\tctx, cancel := context.WithCancel(context.Background())\n\treturn &manager{\n\t\tlogger: c.Logger.Named(\"driver_mgr\"),\n\t\tstate: c.State,\n\t\tctx: ctx,\n\t\tcancel: cancel,\n\t\tloader: c.Loader,\n\t\tpluginConfig: c.PluginConfig,\n\t\tupdater: c.Updater,\n\t\teventHandlerFactory: c.EventHandlerFactory,\n\t\tinstances: make(map[string]*instanceManager),\n\t\treattachConfigs: make(map[loader.PluginID]*pstructs.ReattachConfig),\n\t\tallowedDrivers: c.AllowedDrivers,\n\t\tblockedDrivers: c.BlockedDrivers,\n\t\treadyCh: make(chan struct{}),\n\t}\n}", "func (pm *pluginManager) getPlugin(name string) (NodePlugin, error) {\n\tif p, ok := pm.plugins[name]; ok {\n\t\treturn p, nil\n\t}\n\n\tpc, err := pm.pg.Get(name, DockerCSIPluginCap, plugingetter.Lookup)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpa, ok := pc.(plugingetter.PluginAddr)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"plugin does not implement PluginAddr interface\")\n\t}\n\n\tp := pm.newNodePluginFunc(name, pc, pa, pm.secrets)\n\tpm.plugins[name] = p\n\treturn p, nil\n}", "func NewPluginMount(description string, destination string, name string, options []string, settable []string, source string, type_ string) *PluginMount {\n\tthis := PluginMount{}\n\tthis.Description = description\n\tthis.Destination = destination\n\tthis.Name = name\n\tthis.Options = options\n\tthis.Settable = settable\n\tthis.Source = source\n\tthis.Type = type_\n\treturn &this\n}", "func CreateConftestPlugin(version string) jenkinsv1.Plugin {\n\tbinaries := extensions.CreateBinaries(func(p extensions.Platform) string {\n\t\tgoos := p.Goos\n\t\tgoarch := strings.ToLower(p.Goarch)\n\t\tif goarch == \"amd64\" {\n\t\t\tgoarch = \"x86_64\"\n\t\t}\n\t\text := \".tar.gz\"\n\t\tif p.IsWindows() {\n\t\t\text = \".zip\"\n\t\t}\n\t\treturn fmt.Sprintf(\"https://github.com/open-policy-agent/conftest/releases/download/v%s/conftest_%s_%s_%s%s\", version, version, goos, goarch, ext)\n\t})\n\n\tplugin := jenkinsv1.Plugin{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: ConftestPluginName,\n\t\t},\n\t\tSpec: jenkinsv1.PluginSpec{\n\t\t\tSubCommand: \"kube-score\",\n\t\t\tBinaries: binaries,\n\t\t\tDescription: \"kube score binary\",\n\t\t\tName: ConftestPluginName,\n\t\t\tVersion: version,\n\t\t},\n\t}\n\treturn plugin\n}", "func PluginFactory(ctx context.Context, pluginName string, sys pluginutil.LookRunnerUtil, logger log.Logger) (Database, error) {\n\t// Look for plugin in the plugin catalog\n\tpluginRunner, err := sys.LookupPlugin(ctx, pluginName, consts.PluginTypeDatabase)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnamedLogger := logger.Named(pluginName)\n\n\tvar transport string\n\tvar db Database\n\tif pluginRunner.Builtin {\n\t\t// Plugin is builtin so we can retrieve an instance of the interface\n\t\t// from the pluginRunner. Then cast it to a Database.\n\t\tdbRaw, err := pluginRunner.BuiltinFactory()\n\t\tif err != nil {\n\t\t\treturn nil, errwrap.Wrapf(\"error initializing plugin: {{err}}\", err)\n\t\t}\n\n\t\tvar ok bool\n\t\tdb, ok = dbRaw.(Database)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"unsupported database type: %q\", pluginName)\n\t\t}\n\n\t\ttransport = \"builtin\"\n\n\t} else {\n\t\t// create a DatabasePluginClient instance\n\t\tdb, err = NewPluginClient(ctx, sys, pluginRunner, namedLogger, false)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Switch on the underlying database client type to get the transport\n\t\t// method.\n\t\tswitch db.(*DatabasePluginClient).Database.(type) {\n\t\tcase *gRPCClient:\n\t\t\ttransport = \"gRPC\"\n\t\t}\n\n\t}\n\n\ttypeStr, err := db.Type()\n\tif err != nil {\n\t\treturn nil, errwrap.Wrapf(\"error getting plugin type: {{err}}\", err)\n\t}\n\n\t// Wrap with metrics middleware\n\tdb = &databaseMetricsMiddleware{\n\t\tnext: db,\n\t\ttypeStr: typeStr,\n\t}\n\n\t// Wrap with tracing middleware\n\tif namedLogger.IsTrace() {\n\t\tdb = &databaseTracingMiddleware{\n\t\t\tnext: db,\n\t\t\tlogger: namedLogger.With(\"transport\", transport),\n\t\t}\n\t}\n\n\treturn db, nil\n}", "func NewPlugin() *Auth {\n\tplugin := &Auth{\n\t\tname: PluginName,\n\t}\n\treturn plugin\n}", "func NewDriver(name string) (*App, error) {\n\treturn newApp(\"driver.\" + name)\n}", "func newPodForCR(cr *operatorv1alpha1.Minecraft) *corev1.Pod {\n\tvar envVars []corev1.EnvVar\n\tenvVars = []corev1.EnvVar {\n\t\tcorev1.EnvVar {\n\t\tName: \"EULA\",\n\t\tValue: cr.Spec.Uela,\n\t\t},\n\t}\n\n\tvar fsType int64\n\tfsType = int64(1000)\n\n\tlabels := map[string]string{\n\t\t\"app\": cr.Name,\n \"version\": cr.Spec.Version,\n\t\t\"uela\": cr.Spec.Uela,\n\t}\n\treturn &corev1.Pod{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name + \"-pod\",\n\t\t\tNamespace: cr.Namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: corev1.PodSpec{\n\t\t\tSecurityContext: &corev1.PodSecurityContext{\n\t\t\t\tFSGroup: &fsType,\n\t\t\t\tRunAsUser: &fsType,\n\t\t\t},\n\t\t\tContainers: []corev1.Container{\n\t\t\t\t{\n\t\t\t\t\tName: \"minecraft\",\n\t\t\t\t\tImage: \"hoeghh/minecraft:\" + cr.Spec.Version,\n\t\t\t\t\tPorts: []corev1.ContainerPort{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tContainerPort: 25565,\n\t\t\t\t\t\t\tName: \"minecraft\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tEnv: envVars,\n\t\t\t\t\tVolumeMounts: []corev1.VolumeMount{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"minecraft-volume\",\n\t\t\t\t\t\t\tMountPath: \"/minecraft-data\",\n\t\t\t\t\t\t\tReadOnly: false,\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\tVolumes: []corev1.Volume{\n\t\t\t\t{\n\t\t\t\t\tName: \"minecraft-volume\",\n\t\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\t\tPersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{\n\t\t\t\t\t\t\tClaimName: cr.Name + \"-pvc\", //cr.Spec.StorageClassName\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "func NewDriver(options *DriverOptions) *Driver {\n\td := Driver{\n\t\tvolLockMap: util.NewLockMap(),\n\t\tsubnetLockMap: util.NewLockMap(),\n\t\tvolumeLocks: newVolumeLocks(),\n\t\tcloudConfigSecretName: options.CloudConfigSecretName,\n\t\tcloudConfigSecretNamespace: options.CloudConfigSecretNamespace,\n\t\tcustomUserAgent: options.CustomUserAgent,\n\t\tuserAgentSuffix: options.UserAgentSuffix,\n\t\tblobfuseProxyEndpoint: options.BlobfuseProxyEndpoint,\n\t\tenableBlobfuseProxy: options.EnableBlobfuseProxy,\n\t\tblobfuseProxyConnTimout: options.BlobfuseProxyConnTimout,\n\t\tenableBlobMockMount: options.EnableBlobMockMount,\n\t\tallowEmptyCloudConfig: options.AllowEmptyCloudConfig,\n\t\tenableGetVolumeStats: options.EnableGetVolumeStats,\n\t\tmountPermissions: options.MountPermissions,\n\t}\n\td.Name = options.DriverName\n\td.Version = driverVersion\n\td.NodeID = options.NodeID\n\n\td.DefaultControllerServer.Driver = &d.CSIDriver\n\td.DefaultIdentityServer.Driver = &d.CSIDriver\n\td.DefaultNodeServer.Driver = &d.CSIDriver\n\n\tvar err error\n\tgetter := func(key string) (interface{}, error) { return nil, nil }\n\tif d.accountSearchCache, err = azcache.NewTimedcache(time.Minute, getter); err != nil {\n\t\tklog.Fatalf(\"%v\", err)\n\t}\n\treturn &d\n}", "func New(b bot.Bot) *LeftpadPlugin {\n\tp := &LeftpadPlugin{\n\t\tbot: b,\n\t\tconfig: b.Config(),\n\t}\n\tb.RegisterRegexCmd(p, bot.Message, leftpadRegex, p.leftpadCmd)\n\treturn p\n}", "func NewCambriconDevicePlugin(o Options) *CambriconDevicePlugin {\n\tdevs, devsInfo := getDevices(o.Mode, int(o.VirtualizationNum))\n\treturn &CambriconDevicePlugin{\n\t\tdevs: devs,\n\t\tdevsInfo: devsInfo,\n\t\tsocket: serverSock,\n\t\tstop: make(chan interface{}),\n\t\thealth: make(chan *pluginapi.Device),\n\t\tdeviceList: newDeviceList(),\n\t\tnodeHostname: o.NodeName,\n\t\toptions: o,\n\t}\n}" ]
[ "0.82380116", "0.60484475", "0.6010558", "0.5986228", "0.5868032", "0.58672225", "0.58576405", "0.58369595", "0.5824131", "0.5824131", "0.5811279", "0.5768812", "0.57687277", "0.5760002", "0.57332784", "0.57026", "0.5667394", "0.5626511", "0.56003225", "0.55854213", "0.5554125", "0.5552047", "0.55462945", "0.554223", "0.55388457", "0.5532813", "0.5521976", "0.549818", "0.54851365", "0.54693747", "0.54262286", "0.5423749", "0.5407599", "0.53660077", "0.53562635", "0.534731", "0.5337522", "0.5329109", "0.5312725", "0.5298115", "0.5271199", "0.52707744", "0.52705646", "0.52613336", "0.5259397", "0.5256064", "0.5232483", "0.52240086", "0.5215809", "0.52149504", "0.52130693", "0.5205653", "0.51885366", "0.51866156", "0.5182889", "0.5174101", "0.51740724", "0.5171137", "0.5168389", "0.51597893", "0.51535684", "0.51503503", "0.51477313", "0.51256514", "0.51129496", "0.5111229", "0.51071537", "0.5087403", "0.5083336", "0.50812316", "0.5080557", "0.5058066", "0.50475353", "0.503839", "0.50350493", "0.50313765", "0.50232196", "0.50211746", "0.5014932", "0.5013085", "0.50122243", "0.50113803", "0.5008564", "0.500648", "0.4997702", "0.4987697", "0.49853054", "0.4984603", "0.4980656", "0.49536157", "0.4953289", "0.49512637", "0.49292645", "0.49210584", "0.49204513", "0.4915959", "0.49119115", "0.49117416", "0.4910976", "0.4906165" ]
0.81757015
1
SetConfig function is called when starting the plugin for the first time. The Config given has two different configuration fields. The first PluginConfig, is an encoded configuration from the plugin block of the client config. The second, AgentConfig, is the Nomad agent's configuration which is given to all plugins.
Функция SetConfig вызывается при первом запуске плагина. Конфигурация, переданная в качестве аргумента, содержит два разных поля настройки. Первое, PluginConfig, представляет собой закодированную конфигурацию из блока плагина конфигурации клиента. Второе, AgentConfig, — это конфигурация агента Nomad, которая предоставляется всем плагинам.
func (d *Driver) SetConfig(cfg *base.Config) error { var pluginConfig PluginConfig if len(cfg.PluginConfig) != 0 { if err := base.MsgPackDecode(cfg.PluginConfig, &pluginConfig); err != nil { return err } } d.config = &pluginConfig if cfg.AgentConfig != nil { d.nomadConfig = cfg.AgentConfig.Driver } clientConfig := api.DefaultClientConfig() if pluginConfig.SocketPath != "" { clientConfig.SocketPath = pluginConfig.SocketPath } d.podman = api.NewClient(d.logger, clientConfig) return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func SetConfig(c cfg.RPCConfig) {\n\tconfig = c\n}", "func SetConfig(c cfg.RPCConfig) {\n\tconfig = c\n}", "func (nc *NabtoClient) SetConfig() {\n\tviper.Set(\"nabto\", nc)\n\tviper.WriteConfig()\n\tnc.ApplyConfig()\n}", "func (c *Client) SetConfig(conf *ClientConfig) (err error) {\n\tif conf == nil {\n\t\tconf = _defaultCliConf\n\t}\n\tif conf.Dial <= 0 {\n\t\tconf.Dial = time.Second * 10\n\t}\n\tif conf.Timeout <= 0 {\n\t\tconf.Timeout = time.Millisecond * 300\n\t}\n\tif conf.KeepAliveInterval <= 0 {\n\t\tconf.KeepAliveInterval = time.Second * 60\n\t}\n\tif conf.KeepAliveTimeout <= 0 {\n\t\tconf.KeepAliveTimeout = time.Second * 20\n\t}\n\tc.mutex.Lock()\n\tc.conf = conf\n\tc.mutex.Unlock()\n\treturn nil\n}", "func (m *resmgr) SetConfig(conf *config.RawConfig) error {\n\tm.Info(\"applying new configuration from agent...\")\n\treturn m.setConfig(conf)\n}", "func (c *Client) SetConfig(conf *ClientConfig) (err error) {\n\tif conf == nil {\n\t\tconf = _defaultConf\n\t}\n\tif conf.DialTimeout <= 0 {\n\t\tconf.DialTimeout = _defaultConf.DialTimeout\n\t}\n\tif conf.Timeout <= 0 {\n\t\tconf.Timeout = _defaultConf.Timeout\n\t}\n\tif conf.PoolSize <= 0 {\n\t\tconf.PoolSize = _defaultConf.PoolSize\n\t}\n\n\tc.mutex.Lock()\n\tc.conf = conf\n\tif c.breaker == nil {\n\t\tc.breaker = breaker.NewGroup(conf.Breaker)\n\t} else {\n\t\tc.breaker.Reload(conf.Breaker)\n\t}\n\tc.mutex.Unlock()\n\treturn nil\n}", "func SetConfig(c *config.Config) {\n\tcfg = c\n}", "func SetConfig(c *Config) {\n\tconfig = c\n\treturn\n}", "func (conf *Config) SetConfig(newConfig *Config) {\n\tconf.UnicastConfig.SetConfig(newConfig.UnicastConfig)\n\tconf.ExtensionConfig.SetConfig(newConfig.ExtensionConfig)\n}", "func (i *MonitorInstance) InitConfig(\n\tctx context.Context,\n\te ctxt.Executor,\n\tclusterName,\n\tclusterVersion,\n\tdeployUser string,\n\tpaths meta.DirPaths,\n) error {\n\tgOpts := *i.topo.BaseTopo().GlobalOptions\n\tif err := i.BaseInstance.InitConfig(ctx, e, gOpts, deployUser, paths); err != nil {\n\t\treturn err\n\t}\n\n\tenableTLS := gOpts.TLSEnabled\n\t// transfer run script\n\tspec := i.InstanceSpec.(*PrometheusSpec)\n\n\tcfg := &scripts.PrometheusScript{\n\t\tPort: spec.Port,\n\t\tWebExternalURL: fmt.Sprintf(\"http://%s\", utils.JoinHostPort(spec.Host, spec.Port)),\n\t\tRetention: getRetention(spec.Retention),\n\t\tEnableNG: spec.NgPort > 0,\n\n\t\tDeployDir: paths.Deploy,\n\t\tLogDir: paths.Log,\n\t\tDataDir: paths.Data[0],\n\n\t\tNumaNode: spec.NumaNode,\n\t}\n\n\tfp := filepath.Join(paths.Cache, fmt.Sprintf(\"run_prometheus_%s_%d.sh\", i.GetHost(), i.GetPort()))\n\tif err := cfg.ConfigToFile(fp); err != nil {\n\t\treturn err\n\t}\n\n\tdst := filepath.Join(paths.Deploy, \"scripts\", \"run_prometheus.sh\")\n\tif err := e.Transfer(ctx, fp, dst, false, 0, false); err != nil {\n\t\treturn err\n\t}\n\n\tif _, _, err := e.Execute(ctx, \"chmod +x \"+dst, false); err != nil {\n\t\treturn err\n\t}\n\n\ttopoHasField := func(field string) (reflect.Value, bool) {\n\t\treturn findSliceField(i.topo, field)\n\t}\n\tmonitoredOptions := i.topo.GetMonitoredOptions()\n\n\t// transfer config\n\tcfig := config.NewPrometheusConfig(clusterName, clusterVersion, enableTLS)\n\tif monitoredOptions != nil {\n\t\tcfig.AddBlackbox(i.GetHost(), uint64(monitoredOptions.BlackboxExporterPort))\n\t}\n\tcfig.ScrapeInterval = spec.ScrapeInterval\n\tcfig.ScrapeTimeout = spec.ScrapeTimeout\n\tuniqueHosts := set.NewStringSet()\n\n\tif servers, found := topoHasField(\"PDServers\"); found {\n\t\tfor i := 0; i < servers.Len(); i++ {\n\t\t\tpd := servers.Index(i).Interface().(*PDSpec)\n\t\t\tuniqueHosts.Insert(pd.Host)\n\t\t\tcfig.AddPD(pd.Host, uint64(pd.ClientPort))\n\t\t}\n\t}\n\tif servers, found := topoHasField(\"TiKVServers\"); found {\n\t\tfor i := 0; i < servers.Len(); i++ {\n\t\t\tkv := servers.Index(i).Interface().(*TiKVSpec)\n\t\t\tuniqueHosts.Insert(kv.Host)\n\t\t\tcfig.AddTiKV(kv.Host, uint64(kv.StatusPort))\n\t\t}\n\t}\n\tif servers, found := topoHasField(\"TiDBServers\"); found {\n\t\tfor i := 0; i < servers.Len(); i++ {\n\t\t\tdb := servers.Index(i).Interface().(*TiDBSpec)\n\t\t\tuniqueHosts.Insert(db.Host)\n\t\t\tcfig.AddTiDB(db.Host, uint64(db.StatusPort))\n\t\t}\n\t}\n\tif servers, found := topoHasField(\"TiFlashServers\"); found {\n\t\tfor i := 0; i < servers.Len(); i++ {\n\t\t\tflash := servers.Index(i).Interface().(*TiFlashSpec)\n\t\t\tuniqueHosts.Insert(flash.Host)\n\t\t\tcfig.AddTiFlashLearner(flash.Host, uint64(flash.FlashProxyStatusPort))\n\t\t\tcfig.AddTiFlash(flash.Host, uint64(flash.StatusPort))\n\t\t}\n\t}\n\tif servers, found := topoHasField(\"PumpServers\"); found {\n\t\tfor i := 0; i < servers.Len(); i++ {\n\t\t\tpump := servers.Index(i).Interface().(*PumpSpec)\n\t\t\tuniqueHosts.Insert(pump.Host)\n\t\t\tcfig.AddPump(pump.Host, uint64(pump.Port))\n\t\t}\n\t}\n\tif servers, found := topoHasField(\"Drainers\"); found {\n\t\tfor i := 0; i < servers.Len(); i++ {\n\t\t\tdrainer := servers.Index(i).Interface().(*DrainerSpec)\n\t\t\tuniqueHosts.Insert(drainer.Host)\n\t\t\tcfig.AddDrainer(drainer.Host, uint64(drainer.Port))\n\t\t}\n\t}\n\tif servers, found := topoHasField(\"CDCServers\"); found {\n\t\tfor i := 0; i < servers.Len(); i++ {\n\t\t\tcdc := servers.Index(i).Interface().(*CDCSpec)\n\t\t\tuniqueHosts.Insert(cdc.Host)\n\t\t\tcfig.AddCDC(cdc.Host, uint64(cdc.Port))\n\t\t}\n\t}\n\tif servers, found := topoHasField(\"TiKVCDCServers\"); found {\n\t\tfor i := 0; i < servers.Len(); i++ {\n\t\t\ttikvCdc := servers.Index(i).Interface().(*TiKVCDCSpec)\n\t\t\tuniqueHosts.Insert(tikvCdc.Host)\n\t\t\tcfig.AddTiKVCDC(tikvCdc.Host, uint64(tikvCdc.Port))\n\t\t}\n\t}\n\tif servers, found := topoHasField(\"Monitors\"); found {\n\t\tfor i := 0; i < servers.Len(); i++ {\n\t\t\tmonitoring := servers.Index(i).Interface().(*PrometheusSpec)\n\t\t\tuniqueHosts.Insert(monitoring.Host)\n\t\t}\n\t}\n\tif servers, found := topoHasField(\"Grafanas\"); found {\n\t\tfor i := 0; i < servers.Len(); i++ {\n\t\t\tgrafana := servers.Index(i).Interface().(*GrafanaSpec)\n\t\t\tuniqueHosts.Insert(grafana.Host)\n\t\t\tcfig.AddGrafana(grafana.Host, uint64(grafana.Port))\n\t\t}\n\t}\n\tif servers, found := topoHasField(\"Alertmanagers\"); found {\n\t\tfor i := 0; i < servers.Len(); i++ {\n\t\t\talertmanager := servers.Index(i).Interface().(*AlertmanagerSpec)\n\t\t\tuniqueHosts.Insert(alertmanager.Host)\n\t\t\tcfig.AddAlertmanager(alertmanager.Host, uint64(alertmanager.WebPort))\n\t\t}\n\t}\n\tif servers, found := topoHasField(\"Masters\"); found {\n\t\tfor i := 0; i < servers.Len(); i++ {\n\t\t\tmaster := reflect.Indirect(servers.Index(i))\n\t\t\thost, port := master.FieldByName(\"Host\").String(), master.FieldByName(\"Port\").Int()\n\t\t\tuniqueHosts.Insert(host)\n\t\t\tcfig.AddDMMaster(host, uint64(port))\n\t\t}\n\t}\n\n\tif servers, found := topoHasField(\"Workers\"); found {\n\t\tfor i := 0; i < servers.Len(); i++ {\n\t\t\tworker := reflect.Indirect(servers.Index(i))\n\t\t\thost, port := worker.FieldByName(\"Host\").String(), worker.FieldByName(\"Port\").Int()\n\t\t\tuniqueHosts.Insert(host)\n\t\t\tcfig.AddDMWorker(host, uint64(port))\n\t\t}\n\t}\n\n\tif monitoredOptions != nil {\n\t\tfor host := range uniqueHosts {\n\t\t\tcfig.AddNodeExpoertor(host, uint64(monitoredOptions.NodeExporterPort))\n\t\t\tcfig.AddBlackboxExporter(host, uint64(monitoredOptions.BlackboxExporterPort))\n\t\t\tcfig.AddMonitoredServer(host)\n\t\t}\n\t}\n\n\tremoteCfg, err := encodeRemoteCfg2Yaml(spec.RemoteConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcfig.SetRemoteConfig(string(remoteCfg))\n\n\t// doesn't work\n\tif _, err := i.setTLSConfig(ctx, false, nil, paths); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, alertmanager := range spec.ExternalAlertmanagers {\n\t\tcfig.AddAlertmanager(alertmanager.Host, uint64(alertmanager.WebPort))\n\t}\n\tcfig.AddPushgateway(spec.PushgatewayAddrs)\n\n\tif spec.RuleDir != \"\" {\n\t\tfilter := func(name string) bool { return strings.HasSuffix(name, \".rules.yml\") }\n\t\terr := i.IteratorLocalConfigDir(ctx, spec.RuleDir, filter, func(name string) error {\n\t\t\tcfig.AddLocalRule(name)\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn errors.Annotate(err, \"add local rule\")\n\t\t}\n\t}\n\n\tif err := i.installRules(ctx, e, paths.Deploy, clusterName, clusterVersion); err != nil {\n\t\treturn errors.Annotate(err, \"install rules\")\n\t}\n\n\tif err := i.initRules(ctx, e, spec, paths, clusterName); err != nil {\n\t\treturn err\n\t}\n\n\tif spec.NgPort > 0 {\n\t\tpds := []string{}\n\t\tif servers, found := topoHasField(\"PDServers\"); found {\n\t\t\tfor i := 0; i < servers.Len(); i++ {\n\t\t\t\tpd := servers.Index(i).Interface().(*PDSpec)\n\t\t\t\tpds = append(pds, fmt.Sprintf(\"\\\"%s\\\"\", utils.JoinHostPort(pd.Host, pd.ClientPort)))\n\t\t\t}\n\t\t}\n\t\tngcfg := &config.NgMonitoringConfig{\n\t\t\tClusterName: clusterName,\n\t\t\tAddress: utils.JoinHostPort(i.GetListenHost(), spec.NgPort),\n\t\t\tAdvertiseAddress: utils.JoinHostPort(i.GetHost(), spec.NgPort),\n\t\t\tPDAddrs: strings.Join(pds, \",\"),\n\t\t\tTLSEnabled: enableTLS,\n\n\t\t\tDeployDir: paths.Deploy,\n\t\t\tDataDir: paths.Data[0],\n\t\t\tLogDir: paths.Log,\n\t\t}\n\n\t\tif servers, found := topoHasField(\"Monitors\"); found {\n\t\t\tfor i := 0; i < servers.Len(); i++ {\n\t\t\t\tmonitoring := servers.Index(i).Interface().(*PrometheusSpec)\n\t\t\t\tcfig.AddNGMonitoring(monitoring.Host, uint64(monitoring.NgPort))\n\t\t\t}\n\t\t}\n\t\tfp = filepath.Join(paths.Cache, fmt.Sprintf(\"ngmonitoring_%s_%d.toml\", i.GetHost(), i.GetPort()))\n\t\tif err := ngcfg.ConfigToFile(fp); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdst = filepath.Join(paths.Deploy, \"conf\", \"ngmonitoring.toml\")\n\t\tif err := e.Transfer(ctx, fp, dst, false, 0, false); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tfp = filepath.Join(paths.Cache, fmt.Sprintf(\"prometheus_%s_%d.yml\", i.GetHost(), i.GetPort()))\n\tif err := cfig.ConfigToFile(fp); err != nil {\n\t\treturn err\n\t}\n\tif spec.AdditionalScrapeConf != nil {\n\t\terr = mergeAdditionalScrapeConf(fp, spec.AdditionalScrapeConf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tdst = filepath.Join(paths.Deploy, \"conf\", \"prometheus.yml\")\n\tif err := e.Transfer(ctx, fp, dst, false, 0, false); err != nil {\n\t\treturn err\n\t}\n\n\treturn checkConfig(ctx, e, i.ComponentName(), i.ComponentSource(), clusterVersion, i.OS(), i.Arch(), i.ComponentName()+\".yml\", paths, nil)\n}", "func NewConfig() *Config {\n\tconf := new(Config)\n\tconf.Agent = \"http://127.0.0.1:8080\"\n\n\treturn conf\n}", "func (d *Driver) SetConfig(cfg Config) {\n\td.p.StoreCONFIG(cfg)\n}", "func SetConfig(cfg c.Config) {\n\tconfig = cfg\n}", "func SetConfig(config *rest.Config) UpdateSettingsFunc {\n\treturn func(cache *clusterCache) {\n\t\tif !reflect.DeepEqual(cache.config, config) {\n\t\t\tlog.WithField(\"server\", cache.config.Host).Infof(\"Changing cluster config to: %v\", config)\n\t\t\tcache.config = config\n\t\t}\n\t}\n}", "func (ce *MqttConfigExecutor) StartConfig(config *gateways.ConfigContext) {\n\tce.GatewayConfig.Log.Info().Str(\"config-key\", config.Data.Src).Msg(\"operating on configuration...\")\n\tm, err := parseConfig(config.Data.Config)\n\tif err != nil {\n\t\tconfig.ErrChan <- err\n\t}\n\tce.GatewayConfig.Log.Info().Str(\"config-key\", config.Data.Src).Interface(\"config-value\", *m).Msg(\"mqtt configuration\")\n\n\tgo ce.listenEvents(m, config)\n\n\tfor {\n\t\tselect {\n\t\tcase <-config.StartChan:\n\t\t\tconfig.Active = true\n\t\t\tce.GatewayConfig.Log.Info().Str(\"config-key\", config.Data.Src).Msg(\"configuration is running\")\n\n\t\tcase data := <-config.DataChan:\n\t\t\tce.GatewayConfig.DispatchEvent(&gateways.GatewayEvent{\n\t\t\t\tSrc: config.Data.Src,\n\t\t\t\tPayload: data,\n\t\t\t})\n\n\t\tcase <-config.StopChan:\n\t\t\tce.GatewayConfig.Log.Info().Str(\"config-name\", config.Data.Src).Msg(\"stopping configuration\")\n\t\t\tconfig.DoneChan <- struct{}{}\n\t\t\tce.GatewayConfig.Log.Info().Str(\"config-name\", config.Data.Src).Msg(\"configuration stopped\")\n\t\t\treturn\n\t\t}\n\t}\n}", "func InitConfig() {\n\tif cfg == nil {\n\t\tcfg = &Settings{}\n\t}\n\n\tviper.SetConfigType(configType)\n\tviper.SetEnvPrefix(\"SNEAK\")\n\tviper.AutomaticEnv()\n\tviper.SetConfigName(configName)\n\n\thome, err := homedir.Dir()\n\tif err != nil {\n\t\tgui.ExitWithError(err)\n\t}\n\n\tcfgPath := fmt.Sprintf(\"%s/.sneak\", home)\n\n\t// check for whether the directory and config file already exist\n\terr = fs.CreateDir(cfgPath)\n\tif err != nil {\n\t\tgui.ExitWithError(err)\n\t}\n\n\terr = createBoxNotesSubdir(cfgPath)\n\tif err != nil {\n\t\tgui.ExitWithError(fmt.Sprintf(\"could not create dedicated notes directory: %s\", err))\n\t}\n\n\tviper.AddConfigPath(cfgPath)\n\tviper.Set(\"cfg_dir\", cfgPath)\n\n\tif err := viper.ReadInConfig(); err != nil {\n\t\tgui.Warn(fmt.Sprintf(\"not seeing a config file where i'd expect it in %s - one sec...\", cfgPath), nil)\n\t}\n}", "func (sf *ClientOption) SetConfig(cfg Config) *ClientOption {\n\tif err := cfg.Valid(); err != nil {\n\t\tsf.config = DefaultConfig()\n\t} else {\n\t\tsf.config = cfg\n\t}\n\treturn sf\n}", "func InitConfig(botName string, token string, chatId int) BotConfig {\n\tvar config BotConfig\n\tconfig.Token = token\n\tconfig.BotName = botName\n\tconfig.ChatId = chatId\n\n\treturn config\n}", "func (p *Plugin) LoadConfig(location string) error {\n\tp.dir = location\n\tlog.Debug(\"Loading configuration from \" + location)\n\treturn nil\n}", "func (c *TunaSessionClient) SetConfig(conf *Config) error {\n\tc.Lock()\n\tdefer c.Unlock()\n\terr := mergo.Merge(c.config, conf, mergo.WithOverride)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif conf.TunaIPFilter != nil {\n\t\tc.config.TunaIPFilter = conf.TunaIPFilter\n\t}\n\tif conf.TunaNknFilter != nil {\n\t\tc.config.TunaNknFilter = conf.TunaNknFilter\n\t}\n\treturn nil\n}", "func (policy *PolicySvc) SetConfig(config common.ServiceConfig) error {\n\t// TODO this is a copy-paste of topology service, to refactor\n\tlog.Println(config)\n\tpolicy.config = config\n\t//\tstoreConfig := config.ServiceSpecific[\"store\"].(map[string]interface{})\n\tlog.Printf(\"Policy port: %d\", config.Common.Api.Port)\n\tpolicy.store = policyStore{}\n\tstoreConfig := config.ServiceSpecific[\"store\"].(map[string]interface{})\n\tpolicy.store.ServiceStore = &policy.store\n\treturn policy.store.SetConfig(storeConfig)\n}", "func (o *SyntheticsBrowserTest) SetConfig(v SyntheticsBrowserTestConfig) {\n\to.Config = v\n}", "func SetConfig(cfg *Config) {\n\tglobalConfig = cfg\n}", "func SetConfig(settings *config.Settings) {\n cfg = settings\n}", "func (adm Admin) SetConfig(cluster string, scope string, properties map[string]string) error {\n\tswitch strings.ToUpper(scope) {\n\tcase \"CLUSTER\":\n\t\tif allow, ok := properties[_allowParticipantAutoJoinKey]; ok {\n\t\t\tbuilder := KeyBuilder{cluster}\n\t\t\tpath := builder.clusterConfig()\n\n\t\t\tif strings.ToLower(allow) == \"true\" {\n\t\t\t\tadm.zkClient.UpdateSimpleField(path, _allowParticipantAutoJoinKey, \"true\")\n\t\t\t}\n\t\t}\n\tcase \"CONSTRAINT\":\n\tcase \"PARTICIPANT\":\n\tcase \"PARTITION\":\n\tcase \"RESOURCE\":\n\t}\n\n\treturn nil\n}", "func (b *Bridge) SetConfig(args *ConfigArg) error {\n\tif !b.isAvailable() {\n\t\treturn ErrBridgeNotAvailable\n\t} else if b.updateInProgress {\n\t\treturn ErrBridgeUpdating\n\t}\n\n\turl := b.baseURL.String() + \"api/\" + b.Username + \"/config\"\n\tbuf := new(bytes.Buffer)\n\n\terr := json.NewEncoder(buf).Encode(args.args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq, err := http.NewRequest(http.MethodPut, url, buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tclient := &http.Client{}\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar respEntries responseEntries\n\terr = json.NewDecoder(resp.Body).Decode(&respEntries)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, respEntry := range respEntries {\n\t\tvar e responseEntry\n\t\tif err = json.Unmarshal(respEntry, &e); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif e.Error.Type > 0 {\n\t\t\tif args.errors == nil {\n\t\t\t\targs.errors = make(map[string]ResponseError)\n\t\t\t}\n\n\t\t\tkeys := strings.Split(e.Error.Address, \"/\")\n\t\t\tkey := keys[len(keys)-1]\n\n\t\t\targs.errors[key] = e.Error\n\t\t} else {\n\t\t\tfor path, jsonValue := range e.Success {\n\t\t\t\tkeys := strings.Split(path, \"/\")\n\n\t\t\t\tkey := keys[len(keys)-1]\n\n\t\t\t\tif key == \"name\" {\n\t\t\t\t\tvar v string\n\t\t\t\t\tif err = json.Unmarshal(*jsonValue, &v); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\n\t\t\t\t\targs.args[key] = v\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (_options *UpdateDestinationOptions) SetConfig(config *DestinationConfig) *UpdateDestinationOptions {\n\t_options.Config = config\n\treturn _options\n}", "func (s *ClientState) SetConfig(config *Config) *Config {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\toldconfig := s.opts.Config\n\ts.opts.Config = config\n\treturn oldconfig\n}", "func (_options *CreateDestinationOptions) SetConfig(config *DestinationConfig) *CreateDestinationOptions {\n\t_options.Config = config\n\treturn _options\n}", "func (c *Client) SetConfig(cfg config.Configuration) error {\n\tbody, err := json.Marshal(cfg)\n\tif err != nil {\n\t\treturn maskAny(err)\n\t}\n\tif _, err := c.httpPost(\"system/config\", string(body)); err != nil {\n\t\treturn maskAny(err)\n\t}\n\treturn nil\n}", "func (s *SyndClient) SetConfig(config []byte, restart bool) (err error) {\n\tctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\n\tconfMsg := &pb.Conf{\n\t\tConf: config,\n\t\tRestartRequired: restart,\n\t}\n\tstatus, err := s.client.SetConf(ctx, confMsg)\n\tif err != nil {\n\t\treturn err\n\t}\n\treport := [][]string{\n\t\t[]string{\"Status:\", fmt.Sprintf(\"%v\", status.Status)},\n\t\t[]string{\"Version:\", fmt.Sprintf(\"%v\", status.Version)},\n\t}\n\tfmt.Print(brimtext.Align(report, nil))\n\treturn nil\n}", "func InitConfig() (err error) {\n\tConf = NewConfig()\n\tgconf = goconf.New()\n\tif err = gconf.Parse(confFile); err != nil {\n\t\treturn err\n\t}\n\tif err = gconf.Unmarshal(Conf); err != nil {\n\t\treturn err\n\t}\n\tvar serverIDi int64\n\tfor _, serverID := range gconf.Get(\"comet.addrs\").Keys() {\n\t\taddr, err := gconf.Get(\"comet.addrs\").String(serverID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tserverIDi, err = strconv.ParseInt(serverID, 10, 32)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tConf.Comets[int32(serverIDi)] = addr\n\t}\n\treturn\n}", "func (c *Client) SetPluginConfig(pluginType, name, version string, key string, value ctypes.ConfigValue) *SetPluginConfigResult {\n\tr := &SetPluginConfigResult{}\n\tb, err := json.Marshal(map[string]ctypes.ConfigValue{key: value})\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn r\n\t}\n\tresp, err := c.do(\"PUT\", fmt.Sprintf(\"/plugins/%s/%s/%s/config\", pluginType, url.QueryEscape(name), version), ContentTypeJSON, b)\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn r\n\t}\n\n\tswitch resp.Meta.Type {\n\tcase rbody.SetPluginConfigItemType:\n\t\t// Success\n\t\tconfig := resp.Body.(*rbody.SetPluginConfigItem)\n\t\tr = &SetPluginConfigResult{config, nil}\n\tcase rbody.ErrorType:\n\t\tr.Err = resp.Body.(*rbody.Error)\n\tdefault:\n\t\tr.Err = ErrAPIResponseMetaType\n\t}\n\treturn r\n}", "func (e *EngineOperations) InitConfig(cfg *config.Common) {\n\te.CommonConfig = cfg\n}", "func (c *Command) SetConfig(config *commonEthereum.Config) {\n\tc.config = config\n}", "func InitConfig() (err error) {\n\tConf = NewConfig()\n\tgconf = goconf.New()\n\tif err = gconf.Parse(confFile); err != nil {\n\t\treturn err\n\t}\n\tif err := gconf.Unmarshal(Conf); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func SetConfig(cfg ServiceConfig) {\n\tserviceConfig = cfg\n}", "func ClientConfig(m discovery.PluginMeta) *plugin.ClientConfig {\n\tlogger := hclog.New(&hclog.LoggerOptions{\n\t\tName: \"plugin\",\n\t\tLevel: hclog.Trace,\n\t\tOutput: os.Stderr,\n\t})\n\n\treturn &plugin.ClientConfig{\n\t\tCmd: exec.Command(m.Path),\n\t\tHandshakeConfig: Handshake,\n\t\tVersionedPlugins: VersionedPlugins,\n\t\tManaged: true,\n\t\tLogger: logger,\n\t\tAllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC},\n\t\tAutoMTLS: true,\n\t}\n}", "func SetConfig(c *Config) {\n\tdefaultCfg = &Config{\n\t\tEncoding: c.Encoding,\n\t\tLevel: c.Level,\n\t\tDevelopment: c.Development,\n\t}\n}", "func (adm Admin) SetConfig(cluster string, scope string, properties map[string]string) error {\n\tconn := newConnection(adm.ZkSvr)\n\terr := conn.Connect()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Disconnect()\n\n\tswitch strings.ToUpper(scope) {\n\tcase \"CLUSTER\":\n\t\tif allow, ok := properties[\"allowParticipantAutoJoin\"]; ok {\n\t\t\tkeys := KeyBuilder{cluster}\n\t\t\tpath := keys.clusterConfig()\n\n\t\t\tif strings.ToLower(allow) == \"true\" {\n\t\t\t\tconn.UpdateSimpleField(path, \"allowParticipantAutoJoin\", \"true\")\n\t\t\t}\n\t\t}\n\tcase \"CONSTRAINT\":\n\tcase \"PARTICIPANT\":\n\tcase \"PARTITION\":\n\tcase \"RESOURCE\":\n\t}\n\n\treturn nil\n}", "func (o *LoggingBindParams) SetConfig(config *models.LoggingBindConfig) {\n\to.Config = config\n}", "func Config(dsn string, watch bool) Option {\n\treturn func(s *Server) error {\n\t\tconfigStore, err := config.NewStore(dsn, watch)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to apply Config option\")\n\t\t}\n\n\t\ts.configStore = configStore\n\t\treturn nil\n\t}\n}", "func (p *Parser) SetConfig(opt *Config) { p.cfg = opt }", "func Config(ctx context.Context) *configurator.Config {\n\treturn ctx.Value(vppAgentConfigKey).(*configurator.Config)\n}", "func (s *Server) SetConfig(c ServerConfig) error {\n\ts.config = c\n\t// Static.\n\tif c.ServerRoot != \"\" {\n\t\ts.SetServerRoot(c.ServerRoot)\n\t}\n\tif len(c.SearchPaths) > 0 {\n\t\tpaths := c.SearchPaths\n\t\tc.SearchPaths = []string{}\n\t\tfor _, v := range paths {\n\t\t\ts.AddSearchPath(v)\n\t\t}\n\t}\n\t// HTTPS.\n\tif c.TLSConfig == nil && c.HTTPSCertPath != \"\" {\n\t\ts.EnableHTTPS(c.HTTPSCertPath, c.HTTPSKeyPath)\n\t}\n\tSetGraceful(c.Graceful)\n\n\tintlog.Printf(\"SetConfig: %+v\", s.config)\n\treturn nil\n}", "func SetConfig(cfg *PinoyConfig) {\n\tpcfg = cfg\n}", "func InitConfig(path string) *Config {\n\n\tviper.SetConfigName(\"config\")\n\tviper.AddConfigPath(path)\n\tviper.SetConfigType(\"yaml\")\n\tviper.AutomaticEnv()\n\n\tif err := viper.ReadInConfig(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tcfg := GetConfig()\n\n\t// setup logging\n\tformatter := new(prefixed.TextFormatter)\n\tformatter.FullTimestamp = true\n\tlog.SetFormatter(formatter)\n\tlog.SetLevel(cfg.LogLevel)\n\treturn cfg\n}", "func (o *Options) Config() (*config.Config, error) {\n\tc := &config.Config{}\n\tif err := o.ApplyTo(c); err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient, leaderElectionClient, eventClient, err := createClients(c.ComponentConfig.ClientConnection,\n\t\tc.ComponentConfig.LeaderElection.RenewDeadline.Duration)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc.EventBroadcaster = events.NewEventBroadcasterAdapter(eventClient)\n\n\t// Set up leader election if enabled.\n\tvar leaderElectionConfig *leaderelection.LeaderElectionConfig\n\tif c.ComponentConfig.LeaderElection.LeaderElect {\n\t\t// Use the scheduler name in the first profile to record leader election.\n\t\tcoreRecorder := c.EventBroadcaster.DeprecatedNewLegacyRecorder(c.ComponentConfig.Profiles[0].SchedulerName)\n\t\tleaderElectionConfig, err = makeLeaderElectionConfig(c.ComponentConfig.LeaderElection, leaderElectionClient, coreRecorder)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tc.Client = client\n\tc.InformerFactory = informers.NewSharedInformerFactory(client, 0)\n\tc.PodInformer = scheduler.NewPodInformer(client, 0)\n\tc.LeaderElection = leaderElectionConfig\n\n\treturn c, nil\n}", "func InitConfig() (*Config, error) {\n\tv := viper.New()\n\n\terr := godotenv.Load()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tv.SetDefault(\"db_file\", \"db.sqlite3\")\n\tv.SetDefault(\"notification_timeout\", 10)\n\tv.SetDefault(\"monobank_integration\", false)\n\n\tv.SetConfigName(\"config\")\n\tv.AddConfigPath(\".\")\n\tv.AutomaticEnv()\n\n\terr = v.ReadInConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconfig := &Config{}\n\tconfig.NotificationTimeout = time.Duration(v.GetInt(\"notification_timeout\")) * time.Second\n\tconfig.DbFile = v.GetString(\"db_file\")\n\tconfig.UserName1 = v.GetString(\"USERNAME_1\")\n\tconfig.UserName2 = v.GetString(\"USERNAME_2\")\n\tconfig.SenderID1 = v.GetInt(\"SENDER_ID_1\")\n\tconfig.SenderID2 = v.GetInt(\"SENDER_ID_2\")\n\tconfig.TelegramToken = os.Getenv(\"TELEGRAM_TOKEN\")\n\tconfig.APIServer = v.GetInt(\"API_SERVER_PORT\")\n\n\tconfig.MonobankIntegrationEnabled = v.GetBool(\"monobank_integration\")\n\tif config.MonobankIntegrationEnabled {\n\t\tconfig.MonobankWebhookURL = os.Getenv(\"MONOBANK_WEBHOOK_URL\")\n\t\tconfig.MonobankPort = v.GetInt(\"MONOBANK_PORT\")\n\t\tconfig.MonobankToken1 = os.Getenv(\"MONOBANK_TOKEN_1\")\n\t\tconfig.MonobankToken2 = os.Getenv(\"MONOBANK_TOKEN_2\")\n\t\tconfig.MonobankAccount1 = v.GetString(\"MONOBANK_ACCOUNT_1\")\n\t\tconfig.MonobankAccount2 = v.GetString(\"MONOBANK_ACCOUNT_2\")\n\t}\n\n\treturn config, nil\n}", "func (pc *MockProviderContext) SetConfig(config config.Config) {\n\tpc.config = config\n}", "func (baseCfg *BaseConfig) InitConfig(configPath string) {\n\tconfig, err := LoadConfig(configPath)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tbaseCfg.PN_GLOBAL_ROUTER, err = jsonparser.GetString(config, \"PN_GLOBAL_ROUTER\")\n\tif err != nil {\n\t\tlog.Fatalf(\"PN_GLOBAL_ROUTER %v:\", err)\n\t}\n\n\tbaseCfg.PN_GLOBAL_PORTAL, err = jsonparser.GetString(config, \"PN_GLOBAL_PORTAL\")\n\tif err != nil {\n\t\tlog.Fatalf(\"PN_GLOBAL_PORTAL %v:\", err)\n\t}\n\n\tbaseCfg.PN_GLOBAL_JWT_PASSPHRASE, err = jsonparser.GetString(config, \"PN_GLOBAL_JWT_PASSPHRASE\")\n\tif err != nil {\n\t\tlog.Fatalf(\"PN_GLOBAL_JWT_PASSPHRASE %v:\", err)\n\t}\n\n\tbaseCfg.MY_POD_NAMESPACE = os.Getenv(\"MY_POD_NAMESPACE\")\n\n\tbaseCfg.DB_PATH = os.Getenv(\"DB_PATH\")\n\tif baseCfg.DB_PATH == \"\" {\n\t\tbaseCfg.DB_PATH = \"./marvin-connector.db\"\n\t}\n\n\tbaseCfg.CONNECTOR_ADDRESS = os.Getenv(\"CONNECTOR_ADDRESS\")\n\n\tbaseCfg.NEW_PUBLISHED_POLLING_INTERVAL = os.Getenv(\"NEW_PUBLISHED_POLLING_INTERVAL\")\n\tif baseCfg.NEW_PUBLISHED_POLLING_INTERVAL == \"\" {\n\t\tbaseCfg.NEW_PUBLISHED_POLLING_INTERVAL = \"2h\"\n\t}\n\n\tb, err := strconv.ParseBool(os.Getenv(\"CHECK_UPGRADE_STATUS_ENABLED\"))\n\tif err != nil {\n\t\tlog.Printf(\"[Warning] parse bool CHECK_UPGRADE_STATUS_ENABLED failed. Not a boolean\")\n\t\tbaseCfg.CHECK_UPGRADE_STATUS_ENABLED = false\n\t} else {\n\t\tbaseCfg.CHECK_UPGRADE_STATUS_ENABLED = b\n\t}\n\n\tbaseCfg.UPGRADE_STATUS_POLLING_INTERVAL = os.Getenv(\"UPGRADE_STATUS_POLLING_INTERVAL\")\n\tif baseCfg.UPGRADE_STATUS_POLLING_INTERVAL == \"\" {\n\t\tbaseCfg.UPGRADE_STATUS_POLLING_INTERVAL = \"1m\"\n\t}\n\n\tbaseCfg.JOB_TIMEOUT = os.Getenv(\"JOB_TIMEOUT\")\n\tif baseCfg.JOB_TIMEOUT == \"\" {\n\t\tbaseCfg.JOB_TIMEOUT = \"2m\"\n\t}\n\n\tlog.Printf(\"SECRET.PN_GLOBAL_ROUTER %v\", baseCfg.PN_GLOBAL_ROUTER)\n\tlog.Printf(\"SECRET.PN_GLOBAL_PORTAL %v\", baseCfg.PN_GLOBAL_PORTAL)\n\tlog.Printf(\"ENV.MY_POD_NAMESPACE %v\", baseCfg.MY_POD_NAMESPACE)\n\tlog.Printf(\"ENV.DB_PATH %v\", baseCfg.DB_PATH)\n\tlog.Printf(\"ENV.CONNECTOR_ADDRESS %v\", baseCfg.CONNECTOR_ADDRESS)\n\tlog.Printf(\"ENV.NEW_PUBLISHED_POLLING_INTERVAL %v\", baseCfg.NEW_PUBLISHED_POLLING_INTERVAL)\n\tlog.Printf(\"ENV.UPGRADE_STATUS_POLLING_INTERVAL %v\", baseCfg.UPGRADE_STATUS_POLLING_INTERVAL)\n\tlog.Printf(\"ENV.JOB_TIMEOUT %v\", baseCfg.JOB_TIMEOUT)\n\n}", "func InitConfig(cfgFile string) {\n\tif cfgFile != \"\" {\n\t\tviper.SetConfigFile(cfgFile)\n\t} else {\n\t\thome, err := homedir.Dir()\n\t\tif err != nil {\n\t\t\tCheckErr(err.Error())\n\t\t}\n\t\tviper.SetConfigType(\"yaml\")\n\t\tviper.SetConfigFile(filepath.Join(home, \".gotils.yml\"))\n\t}\n\tif err := viper.ReadInConfig(); err != nil {\n\t\tCheckErr(err.Error())\n\t}\n}", "func (c *Config) LoadConfig(configPath string) error {\n\tvar configFile map[string]toml.Primitive\n\tcontents, err := replaceEnvsFile(configPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error loading config file: %v\", err)\n\t}\n\tif _, err = toml.Decode(contents, &configFile); err != nil {\n\t\treturn fmt.Errorf(\"Error parsing config file: %v\", err)\n\t}\n\n\t// Agent config\n\tagentConfig, ok := configFile[\"agent\"]\n\tif !ok {\n\t\treturn fmt.Errorf(\"%s: missing [agent] config\", configPath)\n\t}\n\n\tignoreFields := map[string]interface{}{}\n\terr = toml.PrimitiveDecodeStrict(agentConfig, c.Agent, ignoreFields)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error parsing [agent] config: %v\", err)\n\t}\n\n\tdelete(configFile, \"agent\")\n\n\t// Plugin configs\n\tfor pluginName, pluginConf := range configFile {\n\t\tif err = c.addPlugin(pluginName, pluginConf); err != nil {\n\t\t\treturn fmt.Errorf(\"Error parsing [%s] config: %v\", pluginName, err)\n\t\t}\n\t}\n\n\tfor _, kinds := range plugins.PluginEventKinds {\n\t\tfor _, kind := range kinds {\n\t\t\tif _, ok := c.EventKinds[kind]; !ok {\n\t\t\t\tc.EventKinds[kind] = true\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func InitConfig(t *testing.T) (conf *config.Config, configPath string,\n\tkubeConfigPath string, cleanup func(*testing.T)) {\n\tt.Helper()\n\ttestDir, cleanup := TempDir(t, \"airship-test\")\n\n\tconfigData, err := ioutil.ReadFile(testAirshipConfig)\n\tif err != nil {\n\t\tt.Logf(\"Could not read file %q\", testAirshipConfig)\n\t}\n\tkubeConfigData, err := ioutil.ReadFile(testKubeConfig)\n\tif err != nil {\n\t\tt.Logf(\"Could not read file %q\", kubeConfigData)\n\t}\n\n\tconfigPath = filepath.Join(testDir, \"config\")\n\terr = ioutil.WriteFile(configPath, configData, 0600)\n\trequire.NoError(t, err)\n\n\tkubeConfigPath = filepath.Join(testDir, \"kubeconfig\")\n\terr = ioutil.WriteFile(kubeConfigPath, kubeConfigData, 0600)\n\trequire.NoError(t, err)\n\n\tconf = config.NewConfig()\n\terr = conf.LoadConfig()\n\trequire.NoError(t, err)\n\treturn conf, configPath, kubeConfigPath, cleanup\n}", "func (l *LinuxConfig) SetConfig(c []byte) {\n\tl.Config = c\n}", "func InitConfig(){\n\n\tviper.SetConfigName(\"config\")\n\tviper.AddConfigPath(\"others\")\n\n\n\tviper.SetConfigType(\"toml\")\n\terr := viper.ReadInConfig()\n\n\tif err != nil {\n\n\t\tfmt.Println(err.Error())\n\t\tfmt.Printf(\"Exiting application. got error %v\",err.Error())\n\t\tos.Exit(1)\n\t}\n\n\terr = viper.Unmarshal(&Conf)\n\tif err != nil{\n\t\tfmt.Println(err)\n\t}\n\tfmt.Printf(\"config %v\",Conf)\n\tConf.loaded = true\n\n\tlogFileMaxSize := 100\n\n\terr = logger.Init(Conf.LogConfig.LogDirectory,\n\t\t800,\n\t\t20,\n\t\tuint32(logFileMaxSize),\n\t\tConf.LogConfig.EnableLogTrace,\n\t\tConf.LogConfig.Log)\n\n\tif err != nil {\n\t\tfmt.Println(\"Error in intializing logger, is : \", err)\n\t}\n\n\terr = logger.SetFilenamePrefix(Conf.LogConfig.LogFilePrefix, Conf.LogConfig.LogFilePrefix)\n\tlogger.SetLogThrough(false)\n\n\tif err != nil {\n\t\tfmt.Println(\"Error is : \", err.Error())\n\t}\n\n}", "func InitConfig() {\n\tglobalConfig.BackendServerAddr = \"http://localhost:8080\"\n}", "func (s *cpuSource) SetConfig(conf source.Config) {\n\tswitch v := conf.(type) {\n\tcase *Config:\n\t\ts.config = v\n\t\ts.initCpuidFilter()\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"invalid config type: %T\", conf))\n\t}\n}", "func (m *PooledWrapper) SetConfig(_ context.Context, _ ...wrapping.Option) (*wrapping.WrapperConfig, error) {\n\treturn nil, nil\n}", "func (c *ConfigComponent) SetConfig(updated *config.Config) error {\n\treturn c.setConfigUnsynced(updated)\n}", "func Config(nrWorkers int, waitForWorker, waitForCompletion time.Duration) {\n\tconfig = configuration{nrWorkers, waitForWorker, waitForCompletion}\n}", "func InitConfig(configName string) func() {\n\treturn func() {\n\t\tConfig.ConfigFile = viper.GetString(ConfigFile) // enable ability to specify config file via flag\n\t\tConfig.ConfigDir = viper.GetString(ConfigDir)\n\t\tviper.SetEnvPrefix(\"cilium\")\n\n\t\t// INFO: 启动时候用的 --config-dir=/tmp/cilium/config-map, 每一个文件名 filename 是 key,文件内容是 value\n\t\tif Config.ConfigDir != \"\" {\n\t\t\tif _, err := os.Stat(Config.ConfigDir); os.IsNotExist(err) {\n\t\t\t\tlog.Fatalf(\"Non-existent configuration directory %s\", Config.ConfigDir)\n\t\t\t}\n\n\t\t\tif m, err := ReadDirConfig(Config.ConfigDir); err != nil {\n\t\t\t\tlog.Fatalf(\"Unable to read configuration directory %s: %s\", Config.ConfigDir, err)\n\t\t\t} else {\n\t\t\t\terr := MergeConfig(m)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatalf(\"Unable to merge configuration: %s\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif Config.ConfigFile != \"\" {\n\t\t\tviper.SetConfigFile(Config.ConfigFile)\n\t\t} else {\n\t\t\tviper.SetConfigName(configName) // name of config file (without extension)\n\t\t\tviper.AddConfigPath(\"$HOME\") // adding home directory as first search path\n\t\t}\n\n\t\t// If a config file is found, read it in.\n\t\tif err := viper.ReadInConfig(); err == nil {\n\t\t\tlog.WithField(logfields.Path, viper.ConfigFileUsed()).\n\t\t\t\tInfo(\"Using config from file\")\n\t\t} else if Config.ConfigFile != \"\" {\n\t\t\tlog.WithField(logfields.Path, Config.ConfigFile).\n\t\t\t\tFatal(\"Error reading config file\")\n\t\t} else {\n\t\t\tlog.WithField(logfields.Reason, err).Info(\"Skipped reading configuration file\")\n\t\t}\n\t}\n}", "func NewConfig(stdout, stderr io.Writer) (*Config, error) {\n\tcfg := Config{\n\t\tStdout: stdout,\n\t\tStderr: stderr,\n\t}\n\tif err := envconfig.Process(\"plugin\", &cfg); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := envconfig.Process(\"\", &cfg); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif justNumbers.MatchString(cfg.Timeout) {\n\t\tcfg.Timeout = fmt.Sprintf(\"%ss\", cfg.Timeout)\n\t}\n\n\tif cfg.Debug && cfg.Stderr != nil {\n\t\tcfg.logDebug()\n\t}\n\n\tcfg.deprecationWarn()\n\n\treturn &cfg, nil\n}", "func SetConfig(config *Config) {\n\t// Đọc file config.local.json\n\tconfigFile, err := os.Open(\"config.local.json\")\n\tdefer configFile.Close()\n\tif err != nil {\n\t\t// Nếu không có file config.local.json thì đọc file config.development.json\n\t\tconfigFile, err = os.Open(\"config.default.json\")\n\t\tdefer configFile.Close()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\t// Parse dữ liệu JSON lưu vào struct blog\n\tjsonParser := json.NewDecoder(configFile)\n\terr = jsonParser.Decode(&config)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func (s *UpdateResolverRuleInput) SetConfig(v *ResolverRuleConfig) *UpdateResolverRuleInput {\n\ts.Config = v\n\treturn s\n}", "func (s *UpdateResolverRuleInput) SetConfig(v *ResolverRuleConfig) *UpdateResolverRuleInput {\n\ts.Config = v\n\treturn s\n}", "func NewConfig() *Config {\n\tc := &Config{\n\t\tAPI: &APIConfig{\n\t\t\tHost: \"127.0.0.1\",\n\t\t\tPort: 3031,\n\t\t},\n\t\tBackendURLs: []string{},\n\t\tCacheDir: \"/var/cache/sensu\",\n\t\tEnvironment: \"default\",\n\t\tKeepaliveInterval: 20,\n\t\tKeepaliveTimeout: 120,\n\t\tOrganization: \"default\",\n\t\tPassword: \"P@ssw0rd!\",\n\t\tSocket: &SocketConfig{\n\t\t\tHost: \"127.0.0.1\",\n\t\t\tPort: 3030,\n\t\t},\n\t\tUser: \"agent\",\n\t}\n\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\tlogger.WithError(err).Error(\"error getting hostname\")\n\t\t// TODO(greg): wat do?\n\t\tc.AgentID = \"unidentified-sensu-agent\"\n\t}\n\tc.AgentID = hostname\n\n\treturn c\n}", "func SetConfig() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tc.Set(\"CorsOrigin\", \"*\")\n\t\tc.Set(\"Verbose\", true)\n\t\tc.Next()\n\t}\n}", "func InitConfig() {\n\terr := gonfig.GetConf(\"./config.json\", &Configuration)\n\tutils.Check(err)\n}", "func initConfig(centralConfig corecfg.CentralConfig) (interface{}, error) {\n\trootProps := RootCmd.GetProperties()\n\t// Parse the config from bound properties and setup gateway config\n\tgatewayConfig = &config.GatewayConfig{\n\t\tSpecPath: rootProps.StringPropertyValue(\"3scale-api-gateway.specPath\"),\n\t\tConfigKey1: rootProps.StringPropertyValue(\"3scale-api-gateway.config_key_1\"),\n\t\tConfigKey2: rootProps.StringPropertyValue(\"3scale-api-gateway.config_key_2\"),\n\t\tConfigKey3: rootProps.StringPropertyValue(\"3scale-api-gateway.config_key_3\"),\n\t}\n\n\tagentConfig := config.AgentConfig{\n\t\tCentralCfg: centralConfig,\n\t\tGatewayCfg: gatewayConfig,\n\t}\n\treturn agentConfig, nil\n}", "func (w *Wioctl) SetConfig(cfg *Config) {\n\tw.lock.Lock()\n\tw.cfg = cfg\n\tw.lock.Unlock()\n}", "func InitConfig() {\n\n\tviper.SetDefault(\"Threads\", \"4\")\n\tviper.SetDefault(\"RootDirectory\", \"/opt/lht\")\n\tviper.SetConfigName(\"lht\") // name of config file (without extension)\n\tviper.AddConfigPath(\"/etc\") // adding /etc directory as first search path\n\n\tif !project.CheckInstalled() {\n\t\tfmt.Fprintf(os.Stderr, \"lht is not configured.. running installation.\\n\")\n\t\tif err := project.Install(); err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"could not install: %v\\n\", err)\n\t\t\tif err == project.ErrNotRoot {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"please run `sudo lht` to install default files\")\n\t\t\t}\n\t\t\tos.Exit(1)\n\t\t}\n\t\tfmt.Fprintf(os.Stderr, \"lht has been installed.\\n\")\n\t\tos.Exit(0)\n\t}\n\n\t// config file should be found since we have checked the installation\n\tif err := viper.ReadInConfig(); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"could not read configuration file: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n}", "func (d *RMQ) SetConfig(key string, value interface{}) common.Config {\n\treturn nil\n}", "func InitConfig() {\n\tv := viper.New()\n\tv.AddConfigPath(\".\")\n\tv.SetConfigFile(\"config.json\")\n\tv.SetConfigType(\"json\")\n\n\t// default values\n\tv.SetDefault(\"MYSQL_SCHEMA\", \"transcription-service\")\n\tv.SetDefault(\"MYSQL_PORT\", 3306)\n\n\terr := v.ReadInConfig()\n\n\t// local config file does not exist\n\tif err != nil {\n\t\tv.BindEnv(\"MYSQL_ROOT_PWD\")\n\t\tv.BindEnv(\"MYSQL_HOSTNAME\")\n\t\tv.BindEnv(\"MYSQL_USER\")\n\t\tv.BindEnv(\"AWS_BUCKET_NAME\")\n\t} else {\n\t\t// overwrite if env is present\n\t\tv.AutomaticEnv()\n\t}\n\n\tconfig = new(Configuration)\n\n\tbucketName := v.GetString(\"AWS_BUCKET_NAME\")\n\n\tconfig.AwsBucketName = bucketName\n\n\tvar dbConfig DbConfiguration\n\tdbConfig.port = v.GetInt(\"MYSQL_PORT\")\n\tdbConfig.hostname = v.GetString(\"MYSQL_HOSTNAME\")\n\tdbConfig.username = v.GetString(\"MYSQL_USER\")\n\tdbConfig.password = v.GetString(\"MYSQL_ROOT_PWD\")\n\tdbConfig.schemaName = v.GetString(\"MYSQL_SCHEMA\")\n\n\tconfig.DbConfig = &dbConfig\n}", "func InitConfig() {\n\tviper.SetConfigType(\"json\") // or viper.SetConfigType(\"JSON\")\n\tviper.SetConfigName(CONFFILENAME) // name of config file (without extension)\n\tviper.AddConfigPath(os.Getenv(PROXYCONFPATH)) // path to look for the config file in\n\tviper.AddConfigPath(\".\") // optionally look for config in the working directory\n\tviper.AddConfigPath(filepath.Join(os.Getenv(\"GOPATH\"), GITHUBCINFOATH)) // optionally look for config in the github directory\n\n\t// Find and read the config file, handle errors reading the config file\n\tif err := viper.ReadInConfig(); err != nil {\n\t\t// The version of Viper we use claims the config type isn't supported when in fact the file hasn't been found\n\t\t// Display a more helpful message to avoid confusing the user.\n\t\tif strings.Contains(fmt.Sprint(err), \"Unsupported Config Type\") {\n\t\t\tlog.Panicf(\"Could not find config file. \"+\n\t\t\t\t\"Please make sure that %s or current dir is set to a path which contains %s.yaml\", PROXYCONFPATH, CONFFILENAME)\n\t\t}\n\n\t\tlog.Panicln(errors.WithMessage(err, fmt.Sprintf(\"Error when reading %s.yaml config file\", CONFFILENAME)))\n\t}\n\n\tif err := viper.Unmarshal(&conf); err != nil {\n\t\tlog.Panicln(\"Error to unmarshal config, error:\", err)\n\t}\n}", "func New() *Config {\n\tc := &Config{\n\t\tAgent: &AgentConfig{\n\t\t\tEventReceiverCount: 5,\n\t\t\tEventQueueLimit: 50,\n\t\t\tHealthCheckPort: 10240,\n\t\t\tLogLevel: \"info\",\n\t\t},\n\t\tPlugins: make([]*pluginrunner.PluginRunner, 0),\n\t\tEventKinds: make(map[events.EventKind]bool),\n\t}\n\treturn c\n}", "func SetConfig(filepath string) *Config {\n\tc := new(Config)\n\tc.filepath = filepath\n\n\treturn c\n}", "func SetLocalConfig() error {\n\tclient := &http.Client{}\n\n\treq, err := http.NewRequest(\"GET\", CONFIGDOMAIN+GETCONFEP, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Add(\"Accept\", \"application/json\")\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer resp.Body.Close()\n\n\t// Deconde the JSON response into the local config object\n\tConfig.Lock()\n\terr = json.NewDecoder(resp.Body).Decode(&Config)\n\tConfig.Unlock()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func configInit() {\n\tLoadConfig(configPath, \"config\")\n\tConfig().SetDefault(\"log-level\", \"debug\")\n\tConfig().SetDefault(\"addr\", \"localhost:8081\")\n}", "func InitConfig() {\n\tlog.Println(\"initconfig\")\n\n\tif FileName != \"\" {\n\t\tviper.SetConfigFile(FileName)\n\t} else {\n\t\tviper.SetConfigName(\"config\") // name of config file (without extension)\n\t\tviper.AddConfigPath(\"/etc/voucher/\") // path to look for the config file in\n\t\tviper.AddConfigPath(\"$HOME/.voucher\")\n\t\tviper.AddConfigPath(\"./config\")\n\t\tviper.AddConfigPath(\".\") // optionally look for config in the working directory\n\t}\n\terr := viper.ReadInConfig()\n\tif err != nil {\n\t\tlog.Fatalf(\"config file: %s \\n\", err)\n\t}\n\tviper.AutomaticEnv()\n}", "func InitConfig() (*Config, error) {\n\tv := viper.New()\n\tv.AutomaticEnv()\n\n\tc := Config{\n\t\tHTTPPort: v.GetString(httpPort),\n\t\tPostgreSQLConfig: PostgreSQLConfig{\n\t\t\tHost: v.GetString(postgreSQLHost),\n\t\t\tUser: v.GetString(postgreSQLUser),\n\t\t\tPassword: v.GetString(postgreSQLPassword),\n\t\t\tDB: v.GetString(postgreSQLDB),\n\t\t\tPort: v.GetInt64(postgreSQLPort),\n\t\t\tSubscriptionsTable: PostgreSQLTableConfig{\n\t\t\t\tSchema: v.GetString(postgreSQLSubscriptionsTableSchema),\n\t\t\t\tName: v.GetString(postgreSQLSubscriptionsTableName),\n\t\t\t},\n\t\t},\n\t}\n\n\tif err := validateConfig(v); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &c, nil\n}", "func SetConfig(config *Config) error {\n\tvar (\n\t\tnewDebugLogger logger.Logger\n\t\tnewLogger logger.Logger\n\t\terr error\n\t\tdebugLoggerConfig = logger.Config{Level: logger.DebugLevel}\n\t\tloggerConfig = logger.Config{Level: logger.InfoLevel}\n\t\tengine = Zerolog\n\t)\n\n\tif config != nil {\n\t\tengine = config.Engine\n\n\t\tloggerConfig = logger.Config{\n\t\t\tLevel: logger.StringToLevel(config.Level),\n\t\t\tLogFile: config.LogFile,\n\t\t\tTimeFormat: config.TimeFormat,\n\t\t\tCaller: config.Caller,\n\t\t}\n\n\t\t// copy\n\t\tdebugLoggerConfig = loggerConfig\n\n\t\t// custom output file\n\t\tdebugLoggerConfig.LogFile = config.DebugFile\n\t}\n\n\tloggerConfig.UseColor = isDev\n\tdebugLoggerConfig.UseColor = isDev\n\tloggerConfig.UseJSON = !isDev\n\tdebugLoggerConfig.UseJSON = !isDev\n\n\tnewLogger, err = NewLogger(engine, &loggerConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// extra check because it is very difficult to debug if the log itself causes the panic\n\tif newLogger != nil {\n\t\tinfoLogger = newLogger\n\t\twarnLogger = newLogger\n\t\terrorLogger = newLogger\n\t\tfatalLogger = newLogger\n\t}\n\n\tnewDebugLogger, err = NewLogger(engine, &debugLoggerConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif newDebugLogger != nil {\n\t\tdebugLogger = newDebugLogger\n\t}\n\n\treturn nil\n}", "func (client *HTTPClient) NewConfig(config *Config) {\n\tclient.sendRequest(\"POST\", config, nil, &HTTPClientMetrics{NewConfig: true})\n}", "func LoadConfig() (*Config, error) {\n\tconfig := Config{\n\t\tMetricBatchIntervalMilliseconds: 60000,\n\t\tMetricSourceID: \"metron\",\n\t\tIncomingUDPPort: 3457,\n\t\tDebugPort: 14824,\n\t\tGRPC: GRPC{\n\t\t\tPort: 3458,\n\t\t},\n\t}\n\terr := envstruct.Load(&config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif config.RouterAddr == \"\" {\n\t\treturn nil, fmt.Errorf(\"RouterAddr is required\")\n\t}\n\n\tconfig.RouterAddrWithAZ, err = idna.ToASCII(config.RouterAddrWithAZ)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconfig.RouterAddrWithAZ = strings.Replace(config.RouterAddrWithAZ, \"@\", \"-\", -1)\n\n\treturn &config, nil\n}", "func NewConfig(cs config.Service, gm *config.GameModel, configPath string, logger log.Logger) *ConfigBridge {\n\tb := NewConfigBridge(nil)\n\n\tb.configPath = configPath\n\n\t// Setup dependencies.\n\tb.config = cs\n\tb.logger = logger\n\n\t// Setup model.\n\tb.SetGames(gm)\n\n\t// Set initial state.\n\tb.SetPrerequisitesLoaded(false)\n\tb.SetPrerequisitesError(false)\n\n\treturn b\n}", "func (Config *MailConfig) SetConfig(s, mp, ms, mr, sbj string, p int, msg string) {\n\n\tConfig.Server = s // Set server\n\tConfig.MailPassword = mp // Set password\n\tConfig.MailSender = ms // Set who is sending\n\tConfig.MailReceiver = mr // Set who is receiving\n\tConfig.Port = p // Set the SMTP port\n\tConfig.Message = msg // Set the message to be send\n\tConfig.Subject = sbj // Set the message subject\n\n}", "func SetIceConfig(ctx *cli.Context, cfg *ice.Config) {\n\tif ctx.GlobalIsSet(trackedAppFlag.Name) {\n\t\tcfg.Monitor.TrackedApp = ctx.GlobalString(trackedAppFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(algorithmIDFlag.Name) {\n\t\tcfg.Monitor.AlgorithmID = ctx.GlobalString(algorithmIDFlag.Name)\n\t\tcfg.CIoTANet.AlgorithmID = ctx.GlobalString(algorithmIDFlag.Name)\n\t\tcfg.IceNet.AlgorithmID = ctx.GlobalString(algorithmIDFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(detectionAlgIDFlag.Name) {\n\t\tcfg.Monitor.DetectionAlgorithmID = ctx.GlobalString(detectionAlgIDFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(initialModelFlag.Name) {\n\t\tcfg.Monitor.InitialModelPath = ctx.GlobalString(initialModelFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(scoreCalcSkid.Name) {\n\t\tcfg.Monitor.ScoreCalcSkid = ctx.GlobalUint64(scoreCalcSkid.Name)\n\t}\n\tif ctx.GlobalIsSet(trainingTimeFlag.Name) {\n\t\tcfg.Monitor.TrainingTime = ctx.GlobalUint(trainingTimeFlag.Name)\n\t\tcfg.CIoTANet.TrainingTime = ctx.GlobalUint(trainingTimeFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(trainingScoreLevelFlag.Name) {\n\t\tcfg.Monitor.TrainingScoreLevel = ctx.GlobalFloat64(trainingScoreLevelFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(filterFromFlag.Name) {\n\t\tcfg.Monitor.FilterFrom = ctx.GlobalUint64(filterFromFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(filterToFlag.Name) {\n\t\tcfg.Monitor.FilterTo = ctx.GlobalUint64(filterToFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(regionSizeFlag.Name) {\n\t\tcfg.Monitor.RegionSize = ctx.GlobalUint(regionSizeFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(trajectoryLengthFlag.Name) {\n\t\tcfg.Monitor.TrajectoryLength = ctx.GlobalUint(trajectoryLengthFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(anomalyThresholdFlag.Name) {\n\t\tcfg.Monitor.AnomalyThreshold = ctx.GlobalFloat64(anomalyThresholdFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(batchSizeFlag.Name) {\n\t\tcfg.Monitor.BatchSize = ctx.GlobalInt(batchSizeFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(testAppFilePathFlag.Name) {\n\t\tcfg.Monitor.TestAppFilePath = ctx.GlobalString(testAppFilePathFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(useProcMapFlag.Name) {\n\t\tcfg.Monitor.UseProcMap = ctx.GlobalBool(useProcMapFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(logJumpsFlag.Name) {\n\t\tcfg.Monitor.LogJumps = ctx.GlobalBool(logJumpsFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(networkingFlag.Name) {\n\t\tcfg.CIoTANet.Networking = ctx.GlobalString(networkingFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(senderCycleTimeFlag.Name) {\n\t\tcfg.CIoTANet.CycleTime = ctx.GlobalUint(senderCycleTimeFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(nccPortFlag.Name) {\n\t\tcfg.IceNet.NccPort = ctx.GlobalUint(nccPortFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(nccBucketSizeFlag.Name) {\n\t\tcfg.IceNet.NccBucketSize = ctx.GlobalUint(nccBucketSizeFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(nccKeyValidityFlag.Name) {\n\t\tcfg.IceNet.NccKeyExpirationPeriod = ctx.GlobalUint(nccKeyValidityFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(alphaFlag.Name) {\n\t\tcfg.Ciota.Alpha = ctx.GlobalFloat64(alphaFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(pcFlag.Name) {\n\t\tcfg.Ciota.Pc = ctx.GlobalFloat64(pcFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(maxDriftTimeFlag.Name) {\n\t\tcfg.Ciota.MaxDriftTime = ctx.GlobalUint(maxDriftTimeFlag.Name)\n\t}\n\tcfg.IceNet.CiotaParams = &cfg.Ciota\n\tif ctx.GlobalIsSet(blockSizeFlag.Name) {\n\t\tcfg.Blockchain.BlockSize = ctx.GlobalUint64(blockSizeFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(maxChainSizeFlag.Name) {\n\t\tcfg.Blockchain.MaxChainSize = ctx.GlobalUint(maxChainSizeFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(notifyMonitoringFlag.Name) {\n\t\tcfg.StatsClient.Enabled = true\n\n\t\tif ctx.GlobalIsSet(appIDFlag.Name) {\n\t\t\tappID := ctx.GlobalString(appIDFlag.Name)\n\t\t\tversion := params.VersionWithCommit(gitCommit)\n\t\t\tcfg.StatsClient.AppID = appID\n\t\t\tcfg.StatsClient.Version = version\n\t\t\tcfg.StatsClient.NodeName = common.MakeName(appID, version)\n\t\t}\n\n\t\tif ctx.GlobalIsSet(statsIntervalFlag.Name) {\n\t\t\tcfg.StatsService.StatsInterval = ctx.GlobalUint64(statsIntervalFlag.Name)\n\t\t}\n\t\tif ctx.GlobalIsSet(wsSecretFlag.Name) {\n\t\t\tcfg.StatsClient.WSSecret = ctx.GlobalString(wsSecretFlag.Name)\n\t\t}\n\t\tif ctx.GlobalIsSet(monitoringSystemAddressFlag.Name) {\n\t\t\tcfg.StatsClient.MonitoringAddress = ctx.GlobalString(monitoringSystemAddressFlag.Name)\n\t\t\tinitClientSecurityConfig(ctx, cfg)\n\t\t}\n\t}\n\tif ctx.GlobalIsSet(nodeLatitudeFlag.Name) && ctx.GlobalIsSet(nodeLongitudeFlag.Name) &&\n\t\tctx.GlobalIsSet(nodeLabelFlag.Name) {\n\t\tlatitudeValue := ctx.GlobalFloat64(nodeLatitudeFlag.Name)\n\t\tlongitudeValue := ctx.GlobalFloat64(nodeLongitudeFlag.Name)\n\t\tif latitudeValue > -90.0 && latitudeValue < 90.0 &&\n\t\t\tlongitudeValue > -180.0 && longitudeValue < 180.0 {\n\n\t\t\tlocation := &monitoring.Location{\n\t\t\t\tLatitude: latitudeValue,\n\n\t\t\t\tLongitude: longitudeValue,\n\t\t\t\tLabel: ctx.GlobalString(nodeLabelFlag.Name),\n\t\t\t}\n\t\t\tcfg.StatsClient.Location = location\n\t\t} else {\n\t\t\tlog.Warn(\"Location coordinates are not within correct range. Using default location.\")\n\t\t}\n\t} else {\n\t\tif ctx.GlobalIsSet(nodeLatitudeFlag.Name) || ctx.GlobalIsSet(nodeLongitudeFlag.Name) ||\n\t\t\tctx.GlobalIsSet(nodeLabelFlag.Name) {\n\t\t\tlog.Warn(\"Some of the location values are not provided. Using default location.\")\n\t\t}\n\t}\n\tif ctx.GlobalIsSet(simulationFlag.Name) {\n\t\tcfg.Monitor.Simulation = true\n\t}\n\tif ctx.GlobalIsSet(forceBidirectFlag.Name) {\n\t\tcfg.CIoTANet.ForceBidirect = true\n\t}\n\tif ctx.GlobalIsSet(exchangeFormatFlag.Name) {\n\t\tcfg.Blockchain.ExchangeFormat = ctx.GlobalString(exchangeFormatFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(profileFlag.Name) {\n\t\tcfg.Profile = ctx.GlobalBool(profileFlag.Name)\n\t}\n\tcfg.IceNet.BlockchainConfig = &cfg.Blockchain\n\n\tif ctx.GlobalIsSet(whiteListedIPFlag.Name) {\n\t\tcfg.StatsClient.WhiteListedIP = ctx.GlobalString(whiteListedIPFlag.Name)\n\t}\n\tif ctx.GlobalIsSet(systemStateCheckDelayFlag.Name) {\n\t\tcfg.SystemStateMonitor.StateCheckInterval = time.Duration(ctx.GlobalUint(systemStateCheckDelayFlag.Name)) * time.Second\n\t}\n\tif ctx.GlobalIsSet(systemStateTimeToLiveFlag.Name) {\n\t\tcfg.SystemStateMonitor.StateCheckInterval = time.Duration(ctx.GlobalUint(systemStateTimeToLiveFlag.Name)) * time.Minute\n\t}\n\tif ctx.GlobalIsSet(systemStateMonitorDisabledFlag.Name) {\n\t\tcfg.SystemStateMonitor.Enabled = false\n\t}\n\tif ctx.GlobalIsSet(autoHealingFlag.Name) {\n\t\tcfg.SystemStateMonitor.AutoHealing = true\n\t}\n\tif ctx.GlobalIsSet(remediationMappingLocationFlag.Name) {\n\t\tcfg.SystemStateMonitor.RemediationFileLocation = ctx.GlobalString(remediationMappingLocationFlag.Name)\n\t}\n\n\t//Set values for training time here so that we also override them if we load the config using config file and\n\t//not only when we use flags.\n\tif cfg.Monitor.InitialModelPath != \"\" {\n\t\tcfg.Monitor.TrainingTime = 0\n\t\tcfg.CIoTANet.TrainingTime = 0\n\t}\n}", "func initializeConfig() (*viper.Viper, error) {\n\tv = viper.New()\n\n\tv.SetEnvPrefix(\"DCC\")\n\tv.AutomaticEnv()\n\n\tif cfgFile != \"\" {\n\t\tv.SetConfigFile(cfgFile)\n\t} else {\n\t\tif cfgPath == \"\" {\n\t\t\tv.AddConfigPath(\".\")\n\t\t} else {\n\t\t\tv.AddConfigPath(cfgPath)\n\t\t}\n\t}\n\n\terr := v.ReadInConfig()\n\tif err != nil {\n\t\tif _, ok := err.(viper.ConfigParseError); !ok {\n\t\t\treturn v, fmt.Errorf(\"unable to parse Config file : %v\", err)\n\t\t}\n\t}\n\tm := v.GetStringMap(\"agent\")\n\n\tif level := os.Getenv(\"LOG_LEVEL\"); level != \"\" {\n\t\tm[\"loglevel\"] = level\n\t}\n\n\tif EnvUUID := os.Getenv(\"UUID\"); EnvUUID != \"\" {\n\t\tm[\"uuid\"] = EnvUUID\n\t}\n\tif env := os.Getenv(\"ENV\"); env != \"\" {\n\t\tm[\"env\"] = env\n\t}\n\n\tif pwd := os.Getenv(\"PASSWORD\"); pwd != \"\" {\n\t\tm[\"password\"] = pwd\n\t}\n\tif port := v.GetInt(\"agent.healthport\"); port != 0 {\n\t\tm[\"healthport\"] = port\n\t} else {\n\t\tm[\"healthport\"] = 8080\n\t}\n\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\treturn v, fmt.Errorf(\"unable to get hostname : %v\", err)\n\t}\n\tm[\"hostname\"] = hostname\n\tm[\"version\"] = version + \".\" + githash\n\tm[\"date\"] = date\n\n\tu1, ok := m[\"uuid\"]\n\tif ok {\n\t\tif _, err = uuid.Parse(u1.(string)); err != nil {\n\t\t\treturn v, fmt.Errorf(\"unable to Parse uuid : %v\", err)\n\t\t}\n\t} else {\n\t\tm[\"uuid\"] = uuid.New()\n\t}\n\n\tv.Set(\"agent\", m)\n\n\tc := v.GetStringMap(\"controller\")\n\tif ctrlWorker := os.Getenv(\"CTRL_WORKER\"); ctrlWorker != \"\" {\n\t\tc[\"worker\"], err = strconv.Atoi(ctrlWorker)\n\t\tif err != nil {\n\t\t\tc[\"worker\"] = 1\n\t\t}\n\t}\n\n\tv.Set(\"controller\", c)\n\n\treturn v, nil\n}", "func (b *Builder) InitConfig(ctx *interpolate.Context) (warnings []string, errors []error) {\n\tvar (\n\t\twarns []string\n\t\terrs []error\n\t)\n\n\twarns, errs = b.config.RemoteFileConfig.Prepare(ctx)\n\twarnings = append(warnings, warns...)\n\terrors = append(errors, errs...)\n\n\twarns, errs = b.config.ImageConfig.Prepare(ctx)\n\twarnings = append(warnings, warns...)\n\terrors = append(errors, errs...)\n\n\twarns, errs = b.config.QemuConfig.Prepare(ctx)\n\twarnings = append(warnings, warns...)\n\terrors = append(errors, errs...)\n\n\treturn warnings, errors\n}", "func Config(watchAPIConfig *config.Config) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tc.Set(\"config\", *watchAPIConfig)\n\t\tc.Next()\n\t}\n}", "func UpdateConfig(authConfig model.AuthConfig) error {\n\tif authConfig.Provider == \"shibbolethconfig\" {\n\t\tauthConfig.ShibbolethConfig.IDPMetadataFilePath = IDPMetadataFile\n\t\tauthConfig.ShibbolethConfig.SPSelfSignedCertFilePath = selfSignedCertFile\n\t\tauthConfig.ShibbolethConfig.SPSelfSignedKeyFilePath = selfSignedKeyFile\n\t\tauthConfig.ShibbolethConfig.RancherAPIHost = GetRancherAPIHost()\n\t}\n\n\tnewProvider, err := initProviderWithConfig(&authConfig)\n\tif err != nil {\n\t\tlog.Errorf(\"UpdateConfig: Cannot update the config, error initializing the provider %v\", err)\n\t\treturn err\n\t}\n\t//store the config to db\n\tlog.Infof(\"newProvider %v\", newProvider.GetName())\n\n\tproviderSettings := newProvider.GetSettings()\n\n\tgenObjConfig := make(map[string]map[string]string)\n\tgenObjConfig[newProvider.GetName()] = providerSettings\n\terr = updateSettings(genObjConfig, newProvider.GetProviderSecretSettings(), newProvider.GetName(), authConfig.Enabled)\n\tif err != nil {\n\t\tlog.Errorf(\"UpdateConfig: Error Storing the provider settings %v\", err)\n\t\treturn err\n\t}\n\n\t//add the generic settings\n\tcommonSettings := make(map[string]string)\n\tcommonSettings[accessModeSetting] = authConfig.AccessMode\n\tcommonSettings[userTypeSetting] = newProvider.GetUserType()\n\tcommonSettings[identitySeparatorSetting] = newProvider.GetIdentitySeparator()\n\tcommonSettings[allowedIdentitiesSetting] = getAllowedIDString(authConfig.AllowedIdentities, newProvider.GetIdentitySeparator())\n\tcommonSettings[providerNameSetting] = authConfig.Provider\n\tcommonSettings[providerSetting] = authConfig.Provider\n\tcommonSettings[externalProviderSetting] = \"true\"\n\tcommonSettings[noIdentityLookupSupportedSetting] = strconv.FormatBool(!newProvider.IsIdentityLookupSupported())\n\terr = updateCommonSettings(commonSettings)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"UpdateConfig: Error Storing the common settings\")\n\t}\n\n\t//set the security setting last specifically\n\tcommonSettings = make(map[string]string)\n\tcommonSettings[securitySetting] = strconv.FormatBool(authConfig.Enabled)\n\tcommonSettings[authServiceConfigUpdateTimestamp] = time.Now().String()\n\terr = updateCommonSettings(commonSettings)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"UpdateConfig: Error Storing the provider securitySetting\")\n\t}\n\n\t//switch the in-memory provider\n\tif provider == nil {\n\t\tif authConfig.Provider == \"shibbolethconfig\" {\n\t\t\tSamlServiceProvider = authConfig.ShibbolethConfig.SamlServiceProvider\n\t\t}\n\t\tprovider = newProvider\n\t\tauthConfigInMemory = authConfig\n\t} else {\n\t\t//reload the in-memory provider\n\t\tlog.Infof(\"Calling reload\")\n\t\tskipped, err := Reload(true)\n\t\tfor skipped {\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Failed to reload the auth provider from db on updateConfig: %v\", err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttime.Sleep(30 * time.Millisecond)\n\t\t\tskipped, err = Reload(true)\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to reload the auth provider from db on updateConfig: %v\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func InitConfig() (*Configuration, error) {\n\tConf = new(Configuration)\n\tviper.SetConfigName(\"config\")\n\tviper.SetConfigType(\"yaml\")\n\tviper.AddConfigPath(\".\")\n\terr := viper.ReadInConfig()\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"fatal error config file: %w\", err))\n\t}\n\terr = viper.Unmarshal(Conf)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"fatal error config unmarshal: %w\", err))\n\t}\n\treturn Conf, nil\n}", "func (s *HoursOfOperation) SetConfig(v []*HoursOfOperationConfig) *HoursOfOperation {\n\ts.Config = v\n\treturn s\n}", "func (c *Config) Init() {\n\tif c.DNSNames == nil {\n\t\tc.DNSNames = []string{\"localhost\", \"127.0.0.1\", \"::1\"}\n\t}\n\tif c.TLS == nil {\n\t\tc.TLS = &DefaultTLSOptions\n\t}\n\tif c.AuthorityConfig == nil {\n\t\tc.AuthorityConfig = &AuthConfig{}\n\t}\n\tif c.CommonName == \"\" {\n\t\tc.CommonName = \"Step Online CA\"\n\t}\n\tif c.CRL != nil && c.CRL.Enabled && c.CRL.CacheDuration == nil {\n\t\tc.CRL.CacheDuration = DefaultCRLCacheDuration\n\t}\n\tc.AuthorityConfig.init()\n}", "func (in *ActionVpsConfigCreateInput) SetConfig(value string) *ActionVpsConfigCreateInput {\n\tin.Config = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Config\"] = nil\n\treturn in\n}", "func (o *FormField) SetConfig(v FormConfig) {\n\to.Config = &v\n}", "func (i *TiFlashInstance) InitConfig(\n\tctx context.Context,\n\te ctxt.Executor,\n\tclusterName,\n\tclusterVersion,\n\tdeployUser string,\n\tpaths meta.DirPaths,\n) error {\n\ttopo := i.topo.(*Specification)\n\tif err := i.BaseInstance.InitConfig(ctx, e, topo.GlobalOptions, deployUser, paths); err != nil {\n\t\treturn err\n\t}\n\tspec := i.InstanceSpec.(*TiFlashSpec)\n\n\tcfg := &scripts.TiFlashScript{\n\t\tRequiredCPUFlags: getTiFlashRequiredCPUFlagsWithVersion(clusterVersion, spec.Arch),\n\n\t\tDeployDir: paths.Deploy,\n\t\tLogDir: paths.Log,\n\n\t\tNumaNode: spec.NumaCores,\n\t\tNumaCores: spec.NumaCores,\n\t}\n\n\tfp := filepath.Join(paths.Cache, fmt.Sprintf(\"run_tiflash_%s_%d.sh\", i.GetHost(), i.GetPort()))\n\tif err := cfg.ConfigToFile(fp); err != nil {\n\t\treturn err\n\t}\n\tdst := filepath.Join(paths.Deploy, \"scripts\", \"run_tiflash.sh\")\n\n\tif err := e.Transfer(ctx, fp, dst, false, 0, false); err != nil {\n\t\treturn err\n\t}\n\n\tif _, _, err := e.Execute(ctx, \"chmod +x \"+dst, false); err != nil {\n\t\treturn err\n\t}\n\n\tconf, err := i.InitTiFlashLearnerConfig(ctx, clusterVersion, topo.ServerConfigs.TiFlashLearner, paths)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// merge config files for imported instance\n\tif i.IsImported() {\n\t\tconfigPath := ClusterPath(\n\t\t\tclusterName,\n\t\t\tAnsibleImportedConfigPath,\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"%s-learner-%s-%d.toml\",\n\t\t\t\ti.ComponentName(),\n\t\t\t\ti.GetHost(),\n\t\t\t\ti.GetPort(),\n\t\t\t),\n\t\t)\n\t\timportConfig, err := os.ReadFile(configPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tconf, err = mergeImported(importConfig, conf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = i.mergeTiFlashLearnerServerConfig(ctx, e, conf, spec.LearnerConfig, paths)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Init the configuration using cfg and server_configs\n\tif conf, err = i.initTiFlashConfig(ctx, clusterVersion, topo.ServerConfigs.TiFlash, paths); err != nil {\n\t\treturn err\n\t}\n\n\t// merge config files for imported instance\n\tif i.IsImported() {\n\t\tconfigPath := ClusterPath(\n\t\t\tclusterName,\n\t\t\tAnsibleImportedConfigPath,\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"%s-%s-%d.toml\",\n\t\t\t\ti.ComponentName(),\n\t\t\t\ti.GetHost(),\n\t\t\t\ti.GetPort(),\n\t\t\t),\n\t\t)\n\t\timportConfig, err := os.ReadFile(configPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// TODO: maybe we also need to check the imported config?\n\t\t// if _, err = checkTiFlashStorageConfigWithVersion(clusterVersion, importConfig); err != nil {\n\t\t// \treturn err\n\t\t// }\n\t\tconf, err = mergeImported(importConfig, conf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Check the configuration of instance level\n\tif conf, err = i.mergeTiFlashInstanceConfig(clusterVersion, conf, spec.Config); err != nil {\n\t\treturn err\n\t}\n\n\treturn i.MergeServerConfig(ctx, e, conf, nil, paths)\n}", "func NewConfig() *Config {\n\tcfg := &Config{}\n\tcfg.FlagSet = flag.NewFlagSet(\"syncer\", flag.ContinueOnError)\n\tfs := cfg.FlagSet\n\n\tfs.BoolVar(&cfg.printVersion, \"V\", false, \"prints version and exit\")\n\tfs.StringVar(&cfg.configFile, \"config\", \"\", \"path to config file\")\n\tfs.IntVar(&cfg.ServerID, \"server-id\", 101, \"MySQL slave server ID\")\n\tfs.IntVar(&cfg.WorkerCount, \"c\", 16, \"parallel worker count\")\n\tfs.IntVar(&cfg.Batch, \"b\", 10, \"batch commit count\")\n\tfs.StringVar(&cfg.StatusAddr, \"status-addr\", \"\", \"status addr\")\n\tfs.StringVar(&cfg.Meta, \"meta\", \"syncer.meta\", \"syncer meta info\")\n\tfs.StringVar(&cfg.LogLevel, \"L\", \"info\", \"log level: debug, info, warn, error, fatal\")\n\tfs.StringVar(&cfg.LogFile, \"log-file\", \"\", \"log file path\")\n\tfs.StringVar(&cfg.LogRotate, \"log-rotate\", \"day\", \"log file rotate type, hour/day\")\n\tfs.BoolVar(&cfg.EnableGTID, \"enable-gtid\", false, \"enable gtid mode\")\n\n\treturn cfg\n}", "func NewConfig() *Config {\n\treturn &Config{\n\t\tEnable: true,\n\t\tAddress: \"0.0.0.0:30003\",\n\t}\n}", "func InitConfig(t string, klogmax int, ktaskmax int, ratelimit int) {\n\tif t != \"\" {\n\t\ttarget = t\n\t}\n\n\ttempRemote, err := url.Parse(target)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tremote = tempRemote\n\tmaxCharsKrakenLog = klogmax\n\tmaxCharsFailedTask = ktaskmax\n\trateLimit = ratelimit\n}" ]
[ "0.6838962", "0.6838962", "0.6446589", "0.6371859", "0.6350033", "0.6323569", "0.6291822", "0.6218653", "0.62132025", "0.6208128", "0.62070537", "0.6196594", "0.61428446", "0.61320055", "0.6111926", "0.6038208", "0.6037457", "0.60338557", "0.60234916", "0.60036546", "0.5998846", "0.5998775", "0.59695446", "0.5942464", "0.59391695", "0.59384537", "0.5922398", "0.59054226", "0.58956903", "0.58882326", "0.5886951", "0.58833414", "0.5867643", "0.585352", "0.5848057", "0.5843414", "0.5834003", "0.5805807", "0.5805168", "0.58000475", "0.5787482", "0.57749444", "0.5773259", "0.57646567", "0.5760771", "0.5754151", "0.57405275", "0.5734031", "0.5712156", "0.5697148", "0.5690633", "0.5686755", "0.56839186", "0.5681655", "0.56805", "0.5670422", "0.5663236", "0.5661461", "0.5645122", "0.5642701", "0.5641641", "0.5638775", "0.56368333", "0.5629165", "0.56289905", "0.56289905", "0.56197244", "0.56148714", "0.5609531", "0.56078833", "0.5607526", "0.56046796", "0.55968654", "0.556675", "0.55576426", "0.55494326", "0.55416757", "0.5532214", "0.5518914", "0.55181605", "0.55149686", "0.5510047", "0.5499069", "0.5495477", "0.5495371", "0.54866683", "0.54827195", "0.54824615", "0.54758847", "0.5473626", "0.5471187", "0.5463213", "0.5463122", "0.545442", "0.543081", "0.542712", "0.542231", "0.54212713", "0.54160815", "0.54038376" ]
0.77980506
0
TaskConfigSchema returns the schema for the driver configuration of the task.
TaskConfigSchema возвращает схему для настройки драйвера задачи.
func (d *Driver) TaskConfigSchema() (*hclspec.Spec, error) { return taskConfigSpec, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d *Driver) ConfigSchema() (*hclspec.Spec, error) {\n\treturn configSpec, nil\n}", "func GetUserConfigSchema(t string) map[string]interface{} {\n\tif _, ok := getUserConfigurationOptionsSchemaFilenames()[t]; !ok {\n\t\tlog.Panicf(\"user configuration options schema type `%s` is not available\", t)\n\t}\n\n\treturn userConfigSchemas[t]\n}", "func tagMakeConfigSchema(tagAttrName schemaAttr) *schema.Schema {\n\treturn &schema.Schema{\n\t\tType: schema.TypeSet,\n\t\tOptional: true,\n\t\tElem: &schema.Schema{\n\t\t\tType: schema.TypeString,\n\t\t\tValidateFunc: validateTag,\n\t\t},\n\t}\n}", "func BackendSchema(factoryName string) (*config.ConfigurationSchema, error) {\n\tif backendRegistry[factoryName] == nil {\n\t\treturn nil, fmt.Errorf(\"The adapter %s is not registered Processor cannot be created\", factoryName)\n\t}\n\treturn backendRegistry[factoryName].configurationSchema, nil\n}", "func (o ParserConfigOutput) Schema() SchemaPackagePtrOutput {\n\treturn o.ApplyT(func(v ParserConfig) *SchemaPackage { return v.Schema }).(SchemaPackagePtrOutput)\n}", "func (o TableExternalDataConfigurationOutput) Schema() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v TableExternalDataConfiguration) *string { return v.Schema }).(pulumi.StringPtrOutput)\n}", "func ImageConfigSchema() *gojsonschema.Schema {\n\treturn loadSchema(\"image-config.schema.json\")\n}", "func (j *AuroraJob) TaskConfig() *aurora.TaskConfig {\n\treturn j.jobConfig.TaskConfig\n}", "func autopilotConfigTableSchema() *memdb.TableSchema {\n\treturn &memdb.TableSchema{\n\t\tName: \"autopilot-config\",\n\t\tIndexes: map[string]*memdb.IndexSchema{\n\t\t\t\"id\": &memdb.IndexSchema{\n\t\t\t\tName: \"id\",\n\t\t\t\tAllowMissing: true,\n\t\t\t\tUnique: true,\n\t\t\t\tIndexer: &memdb.ConditionalIndex{\n\t\t\t\t\tConditional: func(obj interface{}) (bool, error) { return true, nil },\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "func (o ParserConfigPtrOutput) Schema() SchemaPackagePtrOutput {\n\treturn o.ApplyT(func(v *ParserConfig) *SchemaPackage {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Schema\n\t}).(SchemaPackagePtrOutput)\n}", "func (t *TableSchema) schema() (string, error) {\n\tswitch t.Driver {\n\tcase DriverMysql:\n\t\treturn t.schemaMysql()\n\tcase DriverSQLite, DriverSQLite3:\n\t\treturn t.schemaSQLite()\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"not support driver: %s\", t.Driver)\n\t}\n}", "func (o GoogleCloudHealthcareV1beta1FhirBigQueryDestinationOutput) SchemaConfig() SchemaConfigPtrOutput {\n\treturn o.ApplyT(func(v GoogleCloudHealthcareV1beta1FhirBigQueryDestination) *SchemaConfig { return v.SchemaConfig }).(SchemaConfigPtrOutput)\n}", "func (o TableExternalDataConfigurationPtrOutput) Schema() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TableExternalDataConfiguration) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Schema\n\t}).(pulumi.StringPtrOutput)\n}", "func TaskConfiguration() TaskConfig {\n\treturn conf.TaskConfig\n}", "func (task *QueueTask) GetConfig() *TaskConfig {\n\treturn &TaskConfig{\n\t\tTaskID: task.taskID,\n\t\tTaskType: task.TaskType,\n\t\tIsRun: task.IsRun,\n\t\tHandler: task.handler,\n\t\tDueTime: task.DueTime,\n\t\tInterval: 0,\n\t\tExpress: \"\",\n\t\tTaskData: task.TaskData,\n\t}\n}", "func (v *templateTableType) Schema() string {\n\treturn v.s.SQLSchema\n}", "func (t Table) Schema() string {\n\treturn t.schema\n}", "func DeploymentSchema() string {\n\treturn deploymentSchema\n}", "func GetClusterConfigSchema(extensionSchema string) string {\n\tvar clusterConfigSchema string\n\tif clusterConfigSchema == \"\" {\n\t\tclusterConfigSchema = fmt.Sprintf(ClusterConfigSpecSchemaTemplate, \"\")\n\t} else {\n\t\tclusterConfigSchema = fmt.Sprintf(ClusterConfigSpecSchemaTemplate, \",\"+extensionSchema)\n\t}\n\treturn fmt.Sprintf(V2SchemaTemplate, MetadataSchema, clusterConfigSchema, DefaultDefinitions)\n}", "func (d *Describe) Schema() sql.Schema {\n\treturn sql.Schema{{\n\t\tName: \"name\",\n\t\tType: VarChar25000,\n\t}, {\n\t\tName: \"type\",\n\t\tType: VarChar25000,\n\t}}\n}", "func (m modelPluginTestDevice) Schema() (map[string]*yang.Entry, error) {\n\treturn td1.UnzipSchema()\n}", "func (e *commonFormatEncoder) Schema() *types.TableSchema {\n\treturn e.inSchema\n}", "func (v *permutationTableType) Schema() string {\n\treturn v.s.SQLSchema\n}", "func (m *BusinessScenarioPlanner) GetTaskConfiguration()(PlannerTaskConfigurationable) {\n val, err := m.GetBackingStore().Get(\"taskConfiguration\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(PlannerTaskConfigurationable)\n }\n return nil\n}", "func ConfigForTask(taskInfo *mesos.TaskInfo) *docker.CreateContainerOptions {\n\tconfig := &docker.CreateContainerOptions{\n\t\tName: GetContainerName(taskInfo.TaskId),\n\t\tConfig: &docker.Config{\n\t\t\tEnv: EnvForTask(taskInfo),\n\t\t\tExposedPorts: PortsForTask(taskInfo),\n\t\t\tImage: *taskInfo.Container.Docker.Image,\n\t\t\tLabels: LabelsForTask(taskInfo),\n\t\t},\n\t\tHostConfig: &docker.HostConfig{\n\t\t\tBinds: BindsForTask(taskInfo),\n\t\t\tPortBindings: PortBindingsForTask(taskInfo),\n\t\t\tNetworkMode: NetworkForTask(taskInfo),\n\t\t\tCapAdd: CapAddForTask(taskInfo),\n\t\t\tCapDrop: CapDropForTask(taskInfo),\n\t\t},\n\t}\n\n\t// Check for and calculate CPU shares\n\tcpus := getResource(\"cpus\", taskInfo)\n\tif cpus != nil {\n\t\tconfig.Config.CPUShares = int64(*cpus.Scalar.Value * float64(1024))\n\t}\n\n\t// Check for and calculate memory limit\n\tmemory := getResource(\"memoryMb\", taskInfo)\n\tif memory != nil {\n\t\tconfig.Config.Memory = int64(*memory.Scalar.Value * float64(1024*1024))\n\t}\n\n\treturn config\n}", "func Schema() *spec.Schema {\n\treturn internal.Schema\n}", "func (o ParserConfigResponseOutput) Schema() SchemaPackageResponseOutput {\n\treturn o.ApplyT(func(v ParserConfigResponse) SchemaPackageResponse { return v.Schema }).(SchemaPackageResponseOutput)\n}", "func (*MigrationConfigSet) Descriptor() ([]byte, []int) {\n\treturn file_trillian_migrillian_configpb_config_proto_rawDescGZIP(), []int{1}\n}", "func (s *ShowTableStatus) Schema() sql.Schema { return showTableStatusSchema }", "func (p *Psutil) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {\n\tc := cpolicy.New()\n\tconfig := cpolicy.NewPolicyNode()\n\tr, err := cpolicy.NewStringRule(\"mount_points\", false)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr.Description = \"Mountpoints\"\n\tconfig.Add(r)\n\tc.Add([]string{\"intel\", \"psutil\", \"disk\"}, config)\n\treturn c, nil\n}", "func (p *dfCollector) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {\n\tcp := cpolicy.New()\n\trule, _ := cpolicy.NewStringRule(\"proc_path\", false, \"/proc\")\n\tnode := cpolicy.NewPolicyNode()\n\tnode.Add(rule)\n\tcp.Add([]string{nsVendor, nsClass, PluginName}, node)\n\treturn cp, nil\n}", "func (e *BaseExecutor) GetSchema() *expression.Schema {\n\treturn e.schema\n}", "func ResourceSchema() string {\n\treturn resourceSchema\n}", "func (m *Module) SetSchemaConfig(evSchemas config.EventingSchemas) error {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\n\t// Reset the existing schema\n\tm.schemas = map[string]model.Fields{}\n\n\tfor _, evSchema := range evSchemas {\n\t\tresourceID := ksuid.New().String()\n\t\tdummyDBSchema := config.DatabaseSchemas{\n\t\t\tresourceID: {\n\t\t\t\tTable: evSchema.ID,\n\t\t\t\tDbAlias: \"dummyDBName\",\n\t\t\t\tSchema: evSchema.Schema,\n\t\t\t},\n\t\t}\n\t\tschemaType, err := schemaHelpers.Parser(dummyDBSchema)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(schemaType[\"dummyDBName\"][evSchema.ID]) != 0 {\n\t\t\tm.schemas[evSchema.ID] = schemaType[\"dummyDBName\"][evSchema.ID]\n\t\t}\n\t}\n\treturn nil\n}", "func (*MySqlSyncConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{8}\n}", "func (*MySqlSyncConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{29}\n}", "func (o CassandraTableResourceOutput) Schema() CassandraSchemaPtrOutput {\n\treturn o.ApplyT(func(v CassandraTableResource) *CassandraSchema { return v.Schema }).(CassandraSchemaPtrOutput)\n}", "func (o SchemaConfigOutput) SchemaType() SchemaConfigSchemaTypePtrOutput {\n\treturn o.ApplyT(func(v SchemaConfig) *SchemaConfigSchemaType { return v.SchemaType }).(SchemaConfigSchemaTypePtrOutput)\n}", "func (o GoogleCloudHealthcareV1beta1FhirBigQueryDestinationPtrOutput) SchemaConfig() SchemaConfigPtrOutput {\n\treturn o.ApplyT(func(v *GoogleCloudHealthcareV1beta1FhirBigQueryDestination) *SchemaConfig {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SchemaConfig\n\t}).(SchemaConfigPtrOutput)\n}", "func (o GoogleCloudHealthcareV1beta1FhirBigQueryDestinationResponseOutput) SchemaConfig() SchemaConfigResponseOutput {\n\treturn o.ApplyT(func(v GoogleCloudHealthcareV1beta1FhirBigQueryDestinationResponse) SchemaConfigResponse {\n\t\treturn v.SchemaConfig\n\t}).(SchemaConfigResponseOutput)\n}", "func (*SqlActiveDirectoryConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{30}\n}", "func DBConfig(t *testing.T, d drivers.Driver) *config.Config {\n\tc := Config(t)\n\tif d == \"\" {\n\t\td = c.DB.Driver\n\t}\n\treturn configDB(t, c, d)\n}", "func TableSchema(conn *setup.Connection, tableName string) (*Schema, *Paths) {\n\tdb := conn.Connect()\n\tschema := Schema{Fields: []Field{}}\n\tpaths := Paths{[]string{}}\n\n\tdefer db.Close()\n\n\tquery := fmt.Sprintf(\"select COLUMN_NAME as `Field`, COLUMN_TYPE as `Type`, IS_NULLABLE AS `Null` from information_schema.COLUMNS WHERE TABLE_NAME = '%s'\", tableName)\n\n\trows, err := db.Query(query)\n\tif err != nil {\n\t\tlog.WithField(\"error\", err).Fatal(\"there was an error extracting the schema for:\" + tableName)\n\t}\n\tfor rows.Next() {\n\t\tvar f Field\n\t\trows.Scan(&f.Name, &f.Type, &f.Null)\n\t\tpaths.JsonPaths = append(paths.JsonPaths, fmt.Sprintf(\"$['%s']\", f.Name))\n\t\tschema.Fields = append(schema.Fields, f)\n\t}\n\n\tschema.ColCount = len(schema.Fields)\n\n\treturn &schema, &paths\n}", "func DriverConfigs() map[string]interface{} {\n\treturn ds.config.Driver\n}", "func (v *pgStatStatementsViewType) Schema() string {\n\treturn v.s.SQLSchema\n}", "func (t *TikvHandlerTool) Schema() (infoschema.InfoSchema, error) {\n\tdom, err := session.GetDomain(t.Store)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn dom.InfoSchema(), nil\n}", "func (*SqlActiveDirectoryConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{64}\n}", "func (v *productTableType) Schema() string {\n\treturn v.s.SQLSchema\n}", "func (v *pgStatDatabaseViewType) Schema() string {\n\treturn v.s.SQLSchema\n}", "func (e *TableReaderExecutor) Schema() *expression.Schema {\n\treturn e.schema\n}", "func (tp *TestParams) DBConfig() *DBConf {\n\treturn &(tp.DBConf)\n}", "func (d *DescribeQuery) Schema() sql.Schema {\n\treturn DescribeSchema\n}", "func (c *DefaultConstr) GetSchema(conn *sql.DB) (string, error) {\n\treturn \"\", ErrorNotSupport\n}", "func GetSchema(eventID string) (schema *Schema, err error) {\n\tschema = &Schema{}\n\n\terr = stmtSchemaByEventID.QueryRow(eventID).Scan(&schema.EventID, &schema.Alias, &schema.Desc)\n\tif err != nil {\n\t\tlog.Println(\"coudn't get schema\")\n\t\treturn\n\t}\n\trows, err := stmtParamsByEventID.Query(eventID)\n\tif err != nil {\n\t\tlog.Println(\"coudn't get schema\")\n\t\treturn\n\t}\n\n\tfor rows.Next() {\n\t\tparams := &Parameters{}\n\t\terr = rows.Scan(&params.Name, &params.DataType, &params.Mandatory, &params.Description, &params.Format)\n\t\tif err != nil {\n\t\t\tlog.Println(\"coudn't get schema\")\n\t\t\treturn\n\t\t}\n\t\tschema.Params = append(schema.Params, params)\n\t}\n\n\treturn\n}", "func GenerateSchema(_ context.Context, opts GenerateSchemaOptions) (*GenerateSchemaResult, error) {\n\tif opts.ProviderInfo.Name == \"\" {\n\t\treturn nil, fmt.Errorf(\"opts.ProviderInfo.Name cannot be empty\")\n\t}\n\tsink := opts.DiagnosticsSink\n\tif sink == nil {\n\t\tsink = diag.DefaultSink(os.Stdout, os.Stderr, diag.FormatOptions{\n\t\t\tColor: colors.Never,\n\t\t})\n\t}\n\n\tgenerated, err := realtfgen.GenerateSchemaWithOptions(realtfgen.GenerateSchemaOptions{\n\t\tProviderInfo: opts.ProviderInfo,\n\t\tDiagnosticsSink: sink,\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tschema, err := json.Marshal(generated.PackageSpec)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &GenerateSchemaResult{\n\t\tProviderMetadata: tfbridge.ProviderMetadata{\n\t\t\tPackageSchema: schema,\n\t\t},\n\t}, nil\n}", "func (v *recordingTable) Schema() string {\n\treturn v.s.SQLSchema\n}", "func (v *libraryTableType) Schema() string {\n\treturn v.s.SQLSchema\n}", "func (db *sqlite3) GetSchema(pBt *Btree) (p *Schema) {\n\tif pBt != nil {\n\t\tp = pBt.Schema(true, ClearSchema)\n\t} else {\n\t\tp = &Schema{}\n\t}\n\tif p == nil {\n\t\tdb.mallocFailed = true\n\t} else if p.file_format == 0 {\n\t\tp.Tables = make(map[string]*Table)\n\t\tp.Indices = make(map[string]*Index)\n\t\tp.Triggers = make(map[string]*Trigger)\n\t\tp.ForeignKeys = make(map[string]*ForeignKey)\n\t\tp.enc = SQLITE_UTF8\n\t}\n\treturn\n}", "func (s *ShowCreateDatabase) Schema() sql.Schema {\n\treturn showCreateDatabaseSchema\n}", "func (p *Person) GetSchema() string {\n\treturn `CREATE TABLE person (\n\t\t\t\t\t\t\t\t\t\tfirst_name text,\n\t\t\t\t\t\t\t\t\t\tlast_name text,\n\t\t\t\t\t\t\t\t\t\tsex bool\n\t\t\t\t\t\t\t);`\n}", "func (cft *ConfigForTask) GetDesignedConfig() string {\n\tconfig := \"\"\n\tfor _, dc := range cft.DesignedConfig {\n\t\tconfig += fmt.Sprintf(\"%s\\n\", dc.Command)\n\t}\n\treturn config\n}", "func DefaultSchemaConfig(kind string) config.SchemaConfig {\n\treturn SchemaConfig(kind, \"v9\", model.Now().Add(-time.Hour*2))\n}", "func GetEventingSchema(project, commandName string, params map[string]string) ([]*model.SpecObject, error) {\n\turl := fmt.Sprintf(\"/v1/config/projects/%s/eventing/schema\", project)\n\n\t// Get the spec from the server\n\tpayload := new(model.Response)\n\tif err := utils.Get(http.MethodGet, url, params, payload); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar objs []*model.SpecObject\n\tfor _, item := range payload.Result {\n\t\tspec := item.(map[string]interface{})\n\t\tmeta := map[string]string{\"project\": project, \"id\": spec[\"id\"].(string)}\n\n\t\t// Delete the unwanted keys from spec\n\t\tdelete(spec, \"id\")\n\n\t\t// Generating the object\n\t\ts, err := utils.CreateSpecObject(\"/v1/config/projects/{project}/eventing/schema/{id}\", commandName, meta, spec)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tobjs = append(objs, s)\n\t}\n\treturn objs, nil\n}", "func (e *BaseExecutor) Schema() *expression.Schema {\n\tif e.schema == nil {\n\t\treturn expression.NewSchema()\n\t}\n\treturn e.schema\n}", "func (v *coachTableType) Schema() string {\n\treturn v.s.SQLSchema\n}", "func (p Postgres) Schema() string {\n\tif p.schema != \"\" {\n\t\treturn p.schema\n\t}\n\treturn getDefaultValue(p, \"schema\")\n}", "func (i *blockIter) Schema() sql.Schema {\n\treturn i.sch\n}", "func (f *nfsCollector) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {\n\tc := cpolicy.New()\n\trule, _ := cpolicy.NewStringRule(\"command\", true)\n\tp := cpolicy.NewPolicyNode()\n\tp.Add(rule)\n\tc.Add([]string{\"intel\", \"dummy\", \"exec\"}, p)\n\treturn c, nil\n}", "func (*S4ReportingPluginConfig) Descriptor() ([]byte, []int) {\n\treturn file_core_services_ocr2_plugins_functions_config_config_types_proto_rawDescGZIP(), []int{1}\n}", "func (u *Use) GetConfigPolicy() (plugin.ConfigPolicy, error) {\n\tpolicy := plugin.NewConfigPolicy()\n\tpolicy.AddNewStringRule([]string{\"intel\", \"use\"}, \"proc_path\", false, plugin.SetDefaultString(\"/proc_host\"))\n\treturn *policy, nil\n}", "func GetSchema() string {\n\treturn fmt.Sprintf(`\n\tschema {\n\t\tquery: Query\n\t\tmutation: Mutation\n\t}\n\t%s\n\t%s\n\t%s\n\t%s\n`, typeDefs, inputs, queries, mutations)\n}", "func (tr *TaskDefinition) GetTerraformSchemaVersion() int {\n\treturn 1\n}", "func hookConfigurationSchema() *schema.Schema {\n\treturn &schema.Schema{\n\t\tType: schema.TypeList,\n\t\tOptional: true,\n\t\tMaxItems: 1,\n\t\tElem: &schema.Resource{\n\t\t\tSchema: map[string]*schema.Schema{\n\t\t\t\t\"invocation_condition\": func() *schema.Schema {\n\t\t\t\t\tschema := documentAttributeConditionSchema()\n\t\t\t\t\treturn schema\n\t\t\t\t}(),\n\t\t\t\t\"lambda_arn\": {\n\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\tRequired: true,\n\t\t\t\t\tValidateFunc: verify.ValidARN,\n\t\t\t\t},\n\t\t\t\t\"s3_bucket\": {\n\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\tRequired: true,\n\t\t\t\t\tValidateFunc: validation.All(\n\t\t\t\t\t\tvalidation.StringLenBetween(3, 63),\n\t\t\t\t\t\tvalidation.StringMatch(\n\t\t\t\t\t\t\tregexp.MustCompile(`[a-z0-9][\\.\\-a-z0-9]{1,61}[a-z0-9]`),\n\t\t\t\t\t\t\t\"Must be a valid bucket name\",\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "func (c *CvpClient) GetConfigForTask(workOrderForID string) (ConfigForTask, error) {\n\tcft := ConfigForTask{}\n\turl := \"/provisioning/getconfigfortask.do?workorderid=\" + workOrderForID\n\tresp, err := c.Get(url)\n\tif err != nil {\n\t\treturn cft, err\n\t}\n\terr = json.Unmarshal(resp, &cft)\n\treturn cft, err\n}", "func (db *DatabaseModel) Schema() *ovsdb.DatabaseSchema {\n\tdb.mutex.RLock()\n\tdefer db.mutex.RUnlock()\n\treturn db.schema\n}", "func (*MigrationConfig) Descriptor() ([]byte, []int) {\n\treturn file_trillian_migrillian_configpb_config_proto_rawDescGZIP(), []int{0}\n}", "func (stmt *Statement) Schema() string {\n\tif stmt.ObjectQualifier != \"\" {\n\t\treturn stmt.ObjectQualifier\n\t}\n\treturn stmt.DefaultDatabase\n}", "func (*ExternalSchedulerConfig) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_swarming_proto_config_pools_proto_rawDescGZIP(), []int{7}\n}", "func (o ParserConfigResponsePtrOutput) Schema() SchemaPackageResponsePtrOutput {\n\treturn o.ApplyT(func(v *ParserConfigResponse) *SchemaPackageResponse {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Schema\n\t}).(SchemaPackageResponsePtrOutput)\n}", "func (*SqlServerAuditConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{31}\n}", "func (*TaskTemplateDeployment) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_swarming_proto_config_pools_proto_rawDescGZIP(), []int{5}\n}", "func (o CassandraTableResourcePtrOutput) Schema() CassandraSchemaPtrOutput {\n\treturn o.ApplyT(func(v *CassandraTableResource) *CassandraSchema {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Schema\n\t}).(CassandraSchemaPtrOutput)\n}", "func (event *Event) TableSchema() (string, error) {\n\tsb := strings.Builder{}\n\tsb.WriteString(\"column_name, column_type, description\\n\")\n\tsb.WriteString(\"event_date, date, is the event date\\n\")\n\tsb.WriteString(\"event_time, timestamp, is the event time\\n\")\n\tfor _, prop := range event.Fields {\n\t\tline, err := prop.TableSchema([]string{prop.Name})\n\t\tif err != nil {\n\t\t\treturn \"\", trace.Wrap(err)\n\t\t}\n\t\tsb.WriteString(line)\n\t}\n\treturn sb.String(), nil\n}", "func (e *UnionScanExec) Schema() expression.Schema {\n\treturn e.schema\n}", "func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, __SchemaImplementors)\n\n\tout := graphql.NewOrderedMap(len(fields))\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"__Schema\")\n\t\tcase \"types\":\n\t\t\tout.Values[i] = ec.___Schema_types(ctx, field, obj)\n\t\tcase \"queryType\":\n\t\t\tout.Values[i] = ec.___Schema_queryType(ctx, field, obj)\n\t\tcase \"mutationType\":\n\t\t\tout.Values[i] = ec.___Schema_mutationType(ctx, field, obj)\n\t\tcase \"subscriptionType\":\n\t\t\tout.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj)\n\t\tcase \"directives\":\n\t\t\tout.Values[i] = ec.___Schema_directives(ctx, field, obj)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\treturn out\n}", "func (b *SynchronizationTemplateRequestBuilder) Schema() *SynchronizationSchemaRequestBuilder {\n\tbb := &SynchronizationSchemaRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/schema\"\n\treturn bb\n}", "func GetTaskConfig(name, action string, conf *config.ComposeConfig) (types.TaskConfig, error) {\n\tact, err := getAction(action, name, conf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn types.NewTaskConfig(act.name, conf, act.deps, NewTask(act.Run, act.Stop)), nil\n}", "func (*TaskTemplate) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_swarming_proto_config_pools_proto_rawDescGZIP(), []int{4}\n}", "func NewTaskBolt(conf config.Config) (*TaskBolt, error) {\n\tdb, err := bolt.Open(conf.DBPath, 0600, &bolt.Options{\n\t\tTimeout: time.Second * 5,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//Check to make sure all the required buckets have been created\n\tdb.Update(func(tx *bolt.Tx) error {\n\t\tif tx.Bucket(TaskBucket) == nil {\n\t\t\ttx.CreateBucket(TaskBucket)\n\t\t}\n\t\tif tx.Bucket(TaskAuthBucket) == nil {\n\t\t\ttx.CreateBucket(TaskAuthBucket)\n\t\t}\n\t\tif tx.Bucket(JobsQueued) == nil {\n\t\t\ttx.CreateBucket(JobsQueued)\n\t\t}\n\t\tif tx.Bucket(JobState) == nil {\n\t\t\ttx.CreateBucket(JobState)\n\t\t}\n\t\tif tx.Bucket(JobsLog) == nil {\n\t\t\ttx.CreateBucket(JobsLog)\n\t\t}\n\t\tif tx.Bucket(Workers) == nil {\n\t\t\ttx.CreateBucket(Workers)\n\t\t}\n\t\tif tx.Bucket(JobWorker) == nil {\n\t\t\ttx.CreateBucket(JobWorker)\n\t\t}\n\t\tif tx.Bucket(WorkerJobs) == nil {\n\t\t\ttx.CreateBucket(WorkerJobs)\n\t\t}\n\t\treturn nil\n\t})\n\treturn &TaskBolt{db: db, conf: conf}, nil\n}", "func (*ProtocolTxConfiguration) Descriptor() ([]byte, []int) {\n\treturn file_router_proto_rawDescGZIP(), []int{4}\n}", "func (obj *transaction) Schema() schemas.Schema {\n\treturn obj.schema\n}", "func (s *BoltState) GetDBConfig() (*DBConfig, error) {\n\tif !s.valid {\n\t\treturn nil, define.ErrDBClosed\n\t}\n\n\tcfg := new(DBConfig)\n\n\tdb, err := s.getDBCon()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer s.deferredCloseDBCon(db)\n\n\terr = db.View(func(tx *bolt.Tx) error {\n\t\tconfigBucket, err := getRuntimeConfigBucket(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Some of these may be nil\n\t\t// When we convert to string, Go will coerce them to \"\"\n\t\t// That's probably fine - we could raise an error if the key is\n\t\t// missing, but just not including it is also OK.\n\t\tlibpodRoot := configBucket.Get(staticDirKey)\n\t\tlibpodTmp := configBucket.Get(tmpDirKey)\n\t\tstorageRoot := configBucket.Get(graphRootKey)\n\t\tstorageTmp := configBucket.Get(runRootKey)\n\t\tgraphDriver := configBucket.Get(graphDriverKey)\n\t\tvolumePath := configBucket.Get(volPathKey)\n\n\t\tcfg.LibpodRoot = string(libpodRoot)\n\t\tcfg.LibpodTmp = string(libpodTmp)\n\t\tcfg.StorageRoot = string(storageRoot)\n\t\tcfg.StorageTmp = string(storageTmp)\n\t\tcfg.GraphDriver = string(graphDriver)\n\t\tcfg.VolumePath = string(volumePath)\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn cfg, nil\n}", "func (v *pgUserViewType) Schema() string {\n\treturn v.s.SQLSchema\n}", "func (csvw *CSVWriter) GetSchema() schema.Schema {\n\treturn csvw.sch\n}", "func (t *JSONTable) Schema() sql.Schema {\n\treturn t.FlattenSchema(t.Cols)\n}", "func (*CAccountHardware_SteamControllerSetConfig_ControllerConfig) Descriptor() ([]byte, []int) {\n\treturn file_steammessages_accounthardware_steamclient_proto_rawDescGZIP(), []int{7}\n}", "func GetMutationSchema() graphql.ObjectConfig {\n\tmutationFields := graphql.Fields{}\n\n\trootMutation := graphql.ObjectConfig{Name: \"MutationQuery\", Fields: mutationFields}\n\n\treturn rootMutation\n}", "func (*SqlServerAuditConfig) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{65}\n}", "func setupSchema(cli *cli.Context) error {\n\tparams, err := parseConnectParams(cli)\n\tif err != nil {\n\t\treturn handleErr(schema.NewConfigError(err.Error()))\n\t}\n\tconn, err := newConn(params)\n\tif err != nil {\n\t\treturn handleErr(err)\n\t}\n\tdefer conn.Close()\n\tif err := schema.Setup(cli, conn); err != nil {\n\t\treturn handleErr(err)\n\t}\n\treturn nil\n}", "func (*PostgreSQLDatabaseConfig) Descriptor() ([]byte, []int) {\n\treturn file_ml_metadata_proto_metadata_store_proto_rawDescGZIP(), []int{24}\n}" ]
[ "0.6586699", "0.58137196", "0.56230664", "0.53895205", "0.5364081", "0.53349406", "0.52917063", "0.52878046", "0.51269746", "0.50748026", "0.505897", "0.5052785", "0.5022496", "0.49787623", "0.49776208", "0.49759728", "0.4963513", "0.48683783", "0.4866191", "0.48051867", "0.47845778", "0.47662133", "0.47428307", "0.47266144", "0.47246894", "0.47070518", "0.46892133", "0.4651297", "0.4649197", "0.46455044", "0.46445644", "0.46438107", "0.46417186", "0.46304625", "0.46175632", "0.46133485", "0.4610687", "0.46040437", "0.46027017", "0.46018818", "0.45990658", "0.45911908", "0.45857975", "0.4561908", "0.45443594", "0.45435384", "0.4540303", "0.453427", "0.45318988", "0.4510839", "0.45060694", "0.45020452", "0.4492897", "0.44908565", "0.44876596", "0.448731", "0.4487204", "0.44817573", "0.44782123", "0.44750583", "0.4473016", "0.44671285", "0.4463673", "0.44620675", "0.44573206", "0.44562683", "0.4452419", "0.44512096", "0.4450556", "0.44409367", "0.44394958", "0.44286638", "0.4408446", "0.44067988", "0.43989676", "0.43833375", "0.43731314", "0.43689495", "0.436796", "0.4366222", "0.43611455", "0.43591735", "0.43559936", "0.4353121", "0.43433794", "0.4341221", "0.43279615", "0.43217105", "0.4313312", "0.43073764", "0.43053553", "0.4305284", "0.4300948", "0.43006393", "0.42991996", "0.4288893", "0.42888045", "0.42854106", "0.42845032", "0.42842883" ]
0.85169226
0
RecoverTask detects running tasks when nomad client or task driver is restarted. When a driver is restarted it is not expected to persist any internal state to disk. To support this, Nomad will attempt to recover a task that was previously started if the driver does not recognize the task ID. During task recovery, Nomad calls RecoverTask passing the TaskHandle that was returned by the StartTask function.
RecoverTask обнаруживает запущенные задачи при перезапуске клиента Nomad или драйвера задач. При перезапуске драйвера не ожидается сохранение любого внутреннего состояния на диск. Для поддержки этого Nomad попытается восстановить задачу, которая ранее была запущена, если драйвер не распознает идентификатор задачи. Во время восстановления задачи Nomad вызывает RecoverTask, передавая TaskHandle, который был возвращен функцией StartTask.
func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error { if handle == nil { return fmt.Errorf("error: handle cannot be nil") } if _, ok := d.tasks.Get(handle.Config.ID); ok { return nil } var taskState TaskState if err := handle.GetDriverState(&taskState); err != nil { return fmt.Errorf("failed to decode task state from handle: %v", err) } d.logger.Debug("Checking for recoverable task", "task", handle.Config.Name, "taskid", handle.Config.ID, "container", taskState.ContainerID) inspectData, err := d.podman.ContainerInspect(d.ctx, taskState.ContainerID) if err != nil { d.logger.Warn("Recovery lookup failed", "task", handle.Config.ID, "container", taskState.ContainerID, "err", err) return nil } h := &TaskHandle{ containerID: taskState.ContainerID, driver: d, taskConfig: taskState.TaskConfig, procState: drivers.TaskStateUnknown, startedAt: taskState.StartedAt, exitResult: &drivers.ExitResult{}, logger: d.logger.Named("podmanHandle"), totalCPUStats: stats.NewCpuStats(), userCPUStats: stats.NewCpuStats(), systemCPUStats: stats.NewCpuStats(), removeContainerOnExit: d.config.GC.Container, } if inspectData.State.Running { d.logger.Info("Recovered a still running container", "container", inspectData.State.Pid) h.procState = drivers.TaskStateRunning } else if inspectData.State.Status == "exited" { // are we allowed to restart a stopped container? if d.config.RecoverStopped { d.logger.Debug("Found a stopped container, try to start it", "container", inspectData.State.Pid) if err = d.podman.ContainerStart(d.ctx, inspectData.ID); err != nil { d.logger.Warn("Recovery restart failed", "task", handle.Config.ID, "container", taskState.ContainerID, "err", err) } else { d.logger.Info("Restarted a container during recovery", "container", inspectData.ID) h.procState = drivers.TaskStateRunning } } else { // no, let's cleanup here to prepare for a StartTask() d.logger.Debug("Found a stopped container, removing it", "container", inspectData.ID) if err = d.podman.ContainerStart(d.ctx, inspectData.ID); err != nil { d.logger.Warn("Recovery cleanup failed", "task", handle.Config.ID, "container", inspectData.ID) } h.procState = drivers.TaskStateExited } } else { d.logger.Warn("Recovery restart failed, unknown container state", "state", inspectData.State.Status, "container", taskState.ContainerID) h.procState = drivers.TaskStateUnknown } d.tasks.Set(taskState.TaskConfig.ID, h) go h.runContainerMonitor() d.logger.Debug("Recovered container handle", "container", taskState.ContainerID) return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestLibvirtDriver_Start_Stop_Recover_Task(t *testing.T) {\n\tutil.RequireLibvirt(t)\n\n\trequire := require.New(t)\n\n\td := NewLibvirtDriver(testlog.HCLogger(t)).(*Driver)\n\tharness := dtestutil.NewDriverHarness(t, d)\n\n\trequire.NoError(task.EncodeConcreteDriverConfig(&taskCfg))\n\n\tcleanup := harness.MkAllocDir(task, false)\n\tdefer cleanup()\n\n\t// Test start task\n\thandle, _, err := harness.StartTask(task)\n\trequire.NoError(err)\n\trequire.NotNil(handle)\n\n\tlibvirtHandle, ok := d.tasks.Get(task.ID)\n\trequire.NotNil(libvirtHandle)\n\trequire.True(ok)\n\n\ttestutil.WaitForResult(func() (bool, error) {\n\t\tstatus, err := d.InspectTask(task.ID)\n\t\trequire.NoError(err)\n\t\tif status.State == drivers.TaskStateRunning {\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, fmt.Errorf(\"task in state: %v\", status.State)\n\t}, func(err error) {\n\t\tt.Fatalf(\"task failed to start: %v\", err)\n\t})\n\n\t// Missing the task handle\n\td.tasks.Delete(task.ID)\n\n\t// Test recover the missed task\n\trecoverHandle := handle.Copy()\n\trequire.NoError(d.RecoverTask(recoverHandle))\n\n\td.StopTask(task.ID, 5*time.Second, \"kill\")\n\n\t// Destroy the task/vm after test\n\tdefer d.DestroyTask(task.ID, false)\n\n\t// Test after recovery and stop task\n\ttestutil.WaitForResult(func() (bool, error) {\n\t\tstatus, err := d.InspectTask(task.ID)\n\t\trequire.NoError(err)\n\t\tif status.State == drivers.TaskStateExited {\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, fmt.Errorf(\"task in state: %v\", status.State)\n\t}, func(err error) {\n\t\tt.Fatalf(\"task failed to stop: %v\", err)\n\t})\n}", "func (mgr *DataCheckMgr) doRecover() {\n\n\tnow := time.Now().Unix()\n\tblog.Info(\"data checker: doRecover begin.... now(%d)\", now)\n\tdefer func() {\n\t\tnow = time.Now().Unix()\n\t\tblog.Info(\"data checker: doRecover end.... now(%d)\", now)\n\t}()\n\n\trunAses, err := mgr.store.ListRunAs()\n\tif err != nil {\n\t\tblog.Error(\"data checker: fail to list runAses, err:%s\", err.Error())\n\t\treturn\n\t}\n\n\tfor _, runAs := range runAses {\n\t\tappIDs, err := mgr.store.ListApplicationNodes(runAs)\n\t\tif err != nil {\n\t\t\tblog.Error(\"data checker: fail to list %s, err:%s\", runAs, err.Error())\n\t\t\tcontinue\n\t\t}\n\t\tif nil == appIDs {\n\t\t\tblog.Warn(\"data checker: no application nodes under runAs:%s\", runAs)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, appID := range appIDs {\n\t\t\tblog.Info(\"data checker: to recover application:%s.%s \", runAs, appID)\n\t\t\tmgr.recoverTaskgroup(runAs, appID)\n\t\t}\n\t}\n\n\treturn\n}", "func (broadcast *Broadcast) Recover(ctx context.Context, username, newResetPubKeyHex,\n\tnewTransactionPubKeyHex, newAppPubKeyHex, privKeyHex string, seq int64) (*model.BroadcastResponse, error) {\n\tresetPubKey, err := transport.GetPubKeyFromHex(newResetPubKeyHex)\n\tif err != nil {\n\t\treturn nil, errors.FailedToGetPubKeyFromHexf(\"Recover: failed to get Reset pub key\").AddCause(err)\n\t}\n\ttxPubKey, err := transport.GetPubKeyFromHex(newTransactionPubKeyHex)\n\tif err != nil {\n\t\treturn nil, errors.FailedToGetPubKeyFromHexf(\"Recover: failed to get Tx pub key\").AddCause(err)\n\t}\n\tappPubKey, err := transport.GetPubKeyFromHex(newAppPubKeyHex)\n\tif err != nil {\n\t\treturn nil, errors.FailedToGetPubKeyFromHexf(\"Recover: failed to get App pub key\").AddCause(err)\n\t}\n\n\tmsg := model.RecoverMsg{\n\t\tUsername: username,\n\t\tNewResetPubKey: resetPubKey,\n\t\tNewTransactionPubKey: txPubKey,\n\t\tNewAppPubKey: appPubKey,\n\t}\n\treturn broadcast.broadcastTransaction(ctx, msg, privKeyHex, seq, \"\", false)\n}", "func (oi *offsetInjector) recover(ctx context.Context, nodeID int) {\n\tif !oi.deployed {\n\t\toi.c.t.Fatal(\"Offset injector must be deployed before recovering from clock offsets\")\n\t}\n\n\tsyncCmds := [][]string{\n\t\t{\"sudo\", \"service\", \"ntp\", \"stop\"},\n\t\t{\"sudo\", \"ntpdate\", \"-u\", \"time.google.com\"},\n\t\t{\"sudo\", \"service\", \"ntp\", \"start\"},\n\t}\n\tfor _, cmd := range syncCmds {\n\t\toi.c.Run(\n\t\t\tctx,\n\t\t\toi.c.Node(nodeID),\n\t\t\tcmd...,\n\t\t)\n\t}\n}", "func (s *Stopper) Recover(ctx context.Context) {\n\tif r := recover(); r != nil {\n\t\tif s.onPanic != nil {\n\t\t\ts.onPanic(r)\n\t\t\treturn\n\t\t}\n\t\tif sv := settings.TODO(); sv != nil {\n\t\t\tlog.ReportPanic(ctx, sv, r, 1)\n\t\t}\n\t\tpanic(r)\n\t}\n}", "func Recover() {\n\tdoRecover(recover(), false)\n}", "func TestRktDriver_StartWaitRecoverWaitStop(t *testing.T) {\n\tctestutil.RktCompatible(t)\n\tif !testutil.IsCI() {\n\t\tt.Parallel()\n\t}\n\n\trequire := require.New(t)\n\td := NewRktDriver(testlog.HCLogger(t))\n\tharness := dtestutil.NewDriverHarness(t, d)\n\n\ttask := &drivers.TaskConfig{\n\t\tID: uuid.Generate(),\n\t\tAllocID: uuid.Generate(),\n\t\tName: \"etcd\",\n\t\tResources: &drivers.Resources{\n\t\t\tNomadResources: &structs.AllocatedTaskResources{\n\t\t\t\tMemory: structs.AllocatedMemoryResources{\n\t\t\t\t\tMemoryMB: 128,\n\t\t\t\t},\n\t\t\t\tCpu: structs.AllocatedCpuResources{\n\t\t\t\t\tCpuShares: 100,\n\t\t\t\t},\n\t\t\t},\n\t\t\tLinuxResources: &drivers.LinuxResources{\n\t\t\t\tMemoryLimitBytes: 134217728,\n\t\t\t\tCPUShares: 100,\n\t\t\t},\n\t\t},\n\t}\n\n\ttc := &TaskConfig{\n\t\tImageName: \"coreos.com/etcd:v2.0.4\",\n\t\tCommand: \"/etcd\",\n\t}\n\trequire.NoError(task.EncodeConcreteDriverConfig(&tc))\n\n\tcleanup := harness.MkAllocDir(task, true)\n\tdefer cleanup()\n\n\thandle, _, err := harness.StartTask(task)\n\trequire.NoError(err)\n\n\tch, err := harness.WaitTask(context.Background(), task.ID)\n\trequire.NoError(err)\n\n\tvar waitDone bool\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tresult := <-ch\n\t\trequire.Error(result.Err)\n\t\twaitDone = true\n\t}()\n\n\toriginalStatus, err := d.InspectTask(task.ID)\n\trequire.NoError(err)\n\n\td.(*Driver).tasks.Delete(task.ID)\n\n\twg.Wait()\n\trequire.True(waitDone)\n\t_, err = d.InspectTask(task.ID)\n\trequire.Equal(drivers.ErrTaskNotFound, err)\n\n\terr = d.RecoverTask(handle)\n\trequire.NoError(err)\n\n\tstatus, err := d.InspectTask(task.ID)\n\trequire.NoError(err)\n\trequire.Exactly(originalStatus, status)\n\n\tch, err = harness.WaitTask(context.Background(), task.ID)\n\trequire.NoError(err)\n\n\trequire.NoError(d.StopTask(task.ID, 0, \"SIGKILL\"))\n\n\tselect {\n\tcase result := <-ch:\n\t\trequire.NoError(result.Err)\n\t\trequire.NotZero(result.ExitCode)\n\n\t\t// when killing a task, signal might not propagate\n\t\t// when executor proc.Wait() call gets \"wait: no child processes\" error\n\t\t//require.Equal(9, result.Signal)\n\tcase <-time.After(time.Duration(testutil.TestMultiplier()*5) * time.Second):\n\t\trequire.Fail(\"WaitTask timeout\")\n\t}\n\n\trequire.NoError(d.DestroyTask(task.ID, false))\n}", "func (ctb *Crontab) Recover(recoverable Recoverable, err interface{}) {\n\tlog.Printf(\"Recovering crontab backend after error '%v'!\", err)\n\n\tgo ctb.backend()\n}", "func (s *Stopper) Recover(ctx context.Context) {\n\tif r := recover(); r != nil {\n\t\tif s.onPanic != nil {\n\t\t\ts.onPanic(r)\n\t\t\treturn\n\t\t}\n\t\tif sv := settings.TODO(); sv != nil {\n\t\t\tlogcrash.ReportPanic(ctx, sv, r, 1)\n\t\t}\n\t\tpanic(r)\n\t}\n}", "func (s *Worker) Start() error {\n\tclient, err := worker.InitRPCChannel(*s.cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.rc = client\n\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tif client != nil {\n\t\t\t\t// we dont really care about the error here...\n\t\t\t\thostname, _ := os.Hostname()\n\t\t\t\terrStr := fmt.Sprintf(\"A panic occurred. Check logs on %s for more details\", hostname)\n\t\t\t\tclient.ChangeTaskStatus(rpc.ChangeTaskStatusRequest{\n\t\t\t\t\tTaskID: s.taskid,\n\t\t\t\t\tNewStatus: storage.TaskStatusError,\n\t\t\t\t\tError: &errStr,\n\t\t\t\t})\n\t\t\t}\n\t\t\tlog.Error().Str(\"task_id\", s.taskid).Msg(\"A critical error occurred while running task (panic)\")\n\t\t}\n\t}()\n\n\ts.t = NewTask(s.taskid, s.devices, s.cfg, s.rc) //Get the task in order to collect the task duration\n\tresp, err := s.t.c.GetTask(rpc.RequestTaskPayload{\n\t\tTaskID: s.t.taskid,\n\t})\n\n\tif resp.TaskDuration != 0 { //If the task duration is 0 (not set), we don't run the timer\n\t\ttimer := time.NewTimer(time.Second * time.Duration(resp.TaskDuration))\n\t\tgo func() {\n\t\t\t<-timer.C\n\t\t\tlog.Warn().Msg(\"Timer expired, stopping task\")\n\t\t\ts.t.Stop()\n\t\t\ttimer.Stop()\n\t\t}()\n\t}\n\n\tif err := s.t.Start(); err != nil {\n\t\tlog.Error().Err(err).Str(\"task_id\", s.taskid).Msg(\"An error occurred while processing a task\")\n\t\terrptr := err.Error()\n\t\tif rpcerr := client.ChangeTaskStatus(rpc.ChangeTaskStatusRequest{\n\t\t\tTaskID: s.taskid,\n\t\t\tNewStatus: storage.TaskStatusError,\n\t\t\tError: &errptr,\n\t\t}); rpcerr != nil {\n\t\t\tlog.Error().Err(rpcerr).Msg(\"Failed to change tasks status to error\")\n\t\t}\n\t}\n\treturn nil\n}", "func Recover() {\n\tdoRecover(recover())\n}", "func (t *trial) recover() error {\n\trunID, restarts, err := t.db.TrialRunIDAndRestarts(t.id)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"restoring old trial state\")\n\t}\n\tt.runID = runID\n\tt.restarts = restarts\n\treturn nil\n}", "func resetTask(ctx context.Context, settings *evergreen.Settings, taskId, username string, failedOnly bool) error {\n\tt, err := task.FindOneId(taskId)\n\tif err != nil {\n\t\treturn gimlet.ErrorResponse{\n\t\t\tStatusCode: http.StatusInternalServerError,\n\t\t\tMessage: errors.Wrapf(err, \"finding task '%s'\", t).Error(),\n\t\t}\n\t}\n\tif t == nil {\n\t\treturn gimlet.ErrorResponse{\n\t\t\tStatusCode: http.StatusNotFound,\n\t\t\tMessage: fmt.Sprintf(\"task '%s' not found\", taskId),\n\t\t}\n\t}\n\treturn errors.Wrapf(serviceModel.ResetTaskOrDisplayTask(ctx, settings, t, username, evergreen.RESTV2Package, failedOnly, nil), \"resetting task '%s'\", taskId)\n}", "func (c *Cleanup) Recover() {\n\tif err := recover(); err != nil {\n\t\tc.run()\n\t\tpanic(err)\n\t}\n}", "func Recover() arpc.HandlerFunc {\n\treturn func(ctx *arpc.Context) {\n\t\tdefer util.Recover()\n\t\tctx.Next()\n\t}\n}", "func (s *Session) RetryTask(t util.Task) error {\n\ttask := util.Task{\n\t\tName: t.Name,\n\t\tOriginalTaskID: t.OriginalTaskID,\n\t\tPayload: t.Payload,\n\t\tPriority: t.Priority,\n\t\tStatus: util.StatusRetry,\n\t}\n\n\t// updating original task id counter\n\ts.taskRepo.UpdateRetryCount(t.OriginalTaskID, -1)\n\tif err := s.SendTask(task); err != nil {\n\t\ts.lgr.Error(\"failed to retry\", err, util.Object{Key: \"TaskID\", Val: task.TaskID}, util.Object{Key: \"OriginalTaskID\", Val: task.OriginalTaskID})\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (sr SecureRecoverer) Recover(message string) error {\n\tif sr.Sync {\n\t\tsyscall.Sync()\n\t}\n\n\tif sr.Debug {\n\t\tif message != \"\" {\n\t\t\tlog.Print(message)\n\t\t}\n\t\ttime.Sleep(DebugTimeout * time.Second)\n\t}\n\n\tif sr.Reboot {\n\t\tif err := syscall.Reboot(syscall.LINUX_REBOOT_CMD_RESTART); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tif err := syscall.Reboot(syscall.LINUX_REBOOT_CMD_POWER_OFF); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (mpt *MapPinTracker) Recover(c *cid.Cid) (api.PinInfo, error) {\n\tp := mpt.get(c)\n\tif p.Status != api.TrackerStatusPinError &&\n\t\tp.Status != api.TrackerStatusUnpinError {\n\t\treturn p, nil\n\t}\n\tlogger.Infof(\"Recovering %s\", c)\n\tvar err error\n\tswitch p.Status {\n\tcase api.TrackerStatusPinError:\n\t\terr = mpt.pin(api.Pin{Cid: c})\n\tcase api.TrackerStatusUnpinError:\n\t\terr = mpt.unpin(api.Pin{Cid: c})\n\t}\n\tif err != nil {\n\t\tlogger.Errorf(\"error recovering %s: %s\", c, err)\n\t}\n\treturn mpt.get(c), err\n}", "func (e *dockerEngine) Recover() {\n\t// clean old services in docker mode\n\te.clean()\n}", "func (suite *TaskFailRetryTestSuite) TestLostTaskRetry() {\n\ttaskConfig := pbtask.TaskConfig{\n\t\tRestartPolicy: &pbtask.RestartPolicy{\n\t\t\tMaxFailures: 3,\n\t\t},\n\t}\n\n\tsuite.cachedTask.EXPECT().\n\t\tID().\n\t\tReturn(uint32(0)).\n\t\tAnyTimes()\n\n\tsuite.jobFactory.EXPECT().\n\t\tGetJob(suite.jobID).Return(suite.cachedJob)\n\n\tsuite.cachedJob.EXPECT().\n\t\tGetTask(suite.instanceID).Return(suite.cachedTask)\n\n\tsuite.cachedJob.EXPECT().\n\t\tID().Return(suite.jobID)\n\n\tsuite.cachedTask.EXPECT().\n\t\tGetRuntime(gomock.Any()).Return(suite.lostTaskRuntime, nil)\n\n\tsuite.taskConfigV2Ops.EXPECT().\n\t\tGetTaskConfig(gomock.Any(), suite.jobID, suite.instanceID, gomock.Any()).\n\t\tReturn(&taskConfig, &models.ConfigAddOn{}, nil)\n\n\tsuite.cachedJob.EXPECT().\n\t\tPatchTasks(gomock.Any(), gomock.Any(), false).\n\t\tDo(func(ctx context.Context,\n\t\t\truntimeDiffs map[uint32]jobmgrcommon.RuntimeDiff,\n\t\t\t_ bool) {\n\t\t\truntimeDiff := runtimeDiffs[suite.instanceID]\n\t\t\tsuite.True(\n\t\t\t\truntimeDiff[jobmgrcommon.MesosTaskIDField].(*mesosv1.TaskID).GetValue() != suite.mesosTaskID)\n\t\t\tsuite.True(\n\t\t\t\truntimeDiff[jobmgrcommon.PrevMesosTaskIDField].(*mesosv1.TaskID).GetValue() == suite.mesosTaskID)\n\t\t\tsuite.True(\n\t\t\t\truntimeDiff[jobmgrcommon.StateField].(pbtask.TaskState) == pbtask.TaskState_INITIALIZED)\n\t\t}).Return(nil, nil, nil)\n\n\tsuite.cachedJob.EXPECT().\n\t\tGetJobType().Return(pbjob.JobType_BATCH)\n\n\tsuite.taskGoalStateEngine.EXPECT().\n\t\tEnqueue(gomock.Any(), gomock.Any()).\n\t\tReturn()\n\n\tsuite.jobGoalStateEngine.EXPECT().\n\t\tEnqueue(gomock.Any(), gomock.Any()).\n\t\tReturn()\n\n\terr := TaskFailRetry(context.Background(), suite.taskEnt)\n\tsuite.NoError(err)\n}", "func (w *Worker) handleTask() {\n\tvar handleTaskInterval = time.Second\n\tfailpoint.Inject(\"handleTaskInterval\", func(val failpoint.Value) {\n\t\tif milliseconds, ok := val.(int); ok {\n\t\t\thandleTaskInterval = time.Duration(milliseconds) * time.Millisecond\n\t\t\tw.l.Info(\"set handleTaskInterval\", zap.String(\"failpoint\", \"handleTaskInterval\"), zap.Int(\"value\", milliseconds))\n\t\t}\n\t})\n\tticker := time.NewTicker(handleTaskInterval)\n\tdefer ticker.Stop()\n\n\tretryCnt := 0\n\nLoop:\n\tfor {\n\t\tselect {\n\t\tcase <-w.ctx.Done():\n\t\t\tw.l.Info(\"handle task process exits!\")\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t\tif w.closed.Get() == closedTrue {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\topLog := w.meta.PeekLog()\n\t\t\tif opLog == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tw.l.Info(\"start to execute operation\", zap.Reflect(\"oplog\", opLog))\n\n\t\t\tst := w.subTaskHolder.findSubTask(opLog.Task.Name)\n\t\t\tvar err error\n\t\t\tswitch opLog.Task.Op {\n\t\t\tcase pb.TaskOp_Start:\n\t\t\t\tif st != nil {\n\t\t\t\t\terr = terror.ErrWorkerSubTaskExists.Generate(opLog.Task.Name)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tif w.relayPurger.Purging() {\n\t\t\t\t\tif retryCnt < maxRetryCount {\n\t\t\t\t\t\tretryCnt++\n\t\t\t\t\t\tw.l.Warn(\"relay log purger is purging, cannot start subtask, would try again later\", zap.String(\"task\", opLog.Task.Name))\n\t\t\t\t\t\tcontinue Loop\n\t\t\t\t\t}\n\n\t\t\t\t\tretryCnt = 0\n\t\t\t\t\terr = terror.ErrWorkerRelayIsPurging.Generate(opLog.Task.Name)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tretryCnt = 0\n\t\t\t\ttaskCfg := new(config.SubTaskConfig)\n\t\t\t\tif err1 := taskCfg.Decode(string(opLog.Task.Task)); err1 != nil {\n\t\t\t\t\terr = terror.Annotate(err1, \"decode subtask config error in handleTask\")\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tvar cfgDecrypted *config.SubTaskConfig\n\t\t\t\tcfgDecrypted, err = taskCfg.DecryptPassword()\n\t\t\t\tif err != nil {\n\t\t\t\t\terr = terror.WithClass(err, terror.ClassDMWorker)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tw.l.Info(\"started sub task\", zap.Stringer(\"config\", cfgDecrypted))\n\t\t\t\tst = NewSubTask(cfgDecrypted)\n\t\t\t\tw.subTaskHolder.recordSubTask(st)\n\t\t\t\tst.Run()\n\n\t\t\tcase pb.TaskOp_Update:\n\t\t\t\tif st == nil {\n\t\t\t\t\terr = terror.ErrWorkerSubTaskNotFound.Generate(opLog.Task.Name)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\ttaskCfg := new(config.SubTaskConfig)\n\t\t\t\tif err1 := taskCfg.Decode(string(opLog.Task.Task)); err1 != nil {\n\t\t\t\t\terr = terror.Annotate(err1, \"decode subtask config error in handleTask\")\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tw.l.Info(\"updated sub task\", zap.String(\"task\", opLog.Task.Name), zap.Stringer(\"new config\", taskCfg))\n\t\t\t\terr = st.Update(taskCfg)\n\t\t\tcase pb.TaskOp_Stop:\n\t\t\t\tif st == nil {\n\t\t\t\t\terr = terror.ErrWorkerSubTaskNotFound.Generate(opLog.Task.Name)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tw.l.Info(\"stop sub task\", zap.String(\"task\", opLog.Task.Name))\n\t\t\t\tst.Close()\n\t\t\t\tw.subTaskHolder.removeSubTask(opLog.Task.Name)\n\t\t\tcase pb.TaskOp_Pause:\n\t\t\t\tif st == nil {\n\t\t\t\t\terr = terror.ErrWorkerSubTaskNotFound.Generate(opLog.Task.Name)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tw.l.Info(\"pause sub task\", zap.String(\"task\", opLog.Task.Name))\n\t\t\t\terr = st.Pause()\n\t\t\tcase pb.TaskOp_Resume:\n\t\t\t\tif st == nil {\n\t\t\t\t\terr = terror.ErrWorkerSubTaskNotFound.Generate(opLog.Task.Name)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tw.l.Info(\"resume sub task\", zap.String(\"task\", opLog.Task.Name))\n\t\t\t\terr = st.Resume()\n\t\t\tcase pb.TaskOp_AutoResume:\n\t\t\t\tif st == nil {\n\t\t\t\t\terr = terror.ErrWorkerSubTaskNotFound.Generate(opLog.Task.Name)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tw.l.Info(\"auto_resume sub task\", zap.String(\"task\", opLog.Task.Name))\n\t\t\t\terr = st.Resume()\n\t\t\t}\n\n\t\t\tw.l.Info(\"end to execute operation\", zap.Int64(\"oplog ID\", opLog.Id), log.ShortError(err))\n\n\t\t\tif err != nil {\n\t\t\t\topLog.Message = err.Error()\n\t\t\t} else {\n\t\t\t\topLog.Task.Stage = st.Stage()\n\t\t\t\topLog.Success = true\n\t\t\t}\n\n\t\t\t// fill current task config\n\t\t\tif len(opLog.Task.Task) == 0 {\n\t\t\t\ttm := w.meta.GetTask(opLog.Task.Name)\n\t\t\t\tif tm == nil {\n\t\t\t\t\tw.l.Warn(\"task meta not found\", zap.String(\"task\", opLog.Task.Name))\n\t\t\t\t} else {\n\t\t\t\t\topLog.Task.Task = append([]byte{}, tm.Task...)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\terr = w.meta.MarkOperation(opLog)\n\t\t\tif err != nil {\n\t\t\t\tw.l.Error(\"fail to mark subtask operation\", zap.Reflect(\"oplog\", opLog))\n\t\t\t}\n\t\t}\n\t}\n}", "func (x Go) Recover(recoverFunc func(interface{})) Go {\n\tx.recoverFunc = recoverFunc\n\treturn x\n}", "func (tr *TaskRunner) Restart(ctx context.Context, event *structs.TaskEvent, failure bool) error {\n\ttr.logger.Trace(\"Restart requested\", \"failure\", failure, \"event\", event.GoString())\n\n\ttaskState := tr.TaskState()\n\tif taskState == nil {\n\t\treturn ErrTaskNotRunning\n\t}\n\n\tswitch taskState.State {\n\tcase structs.TaskStatePending, structs.TaskStateDead:\n\t\treturn ErrTaskNotRunning\n\t}\n\n\treturn tr.restartImpl(ctx, event, failure)\n}", "func (tc *DBTaskConnector) ResetTask(taskId, username string, proj *serviceModel.Project) error {\n\treturn errors.Wrap(serviceModel.TryResetTask(taskId, username, evergreen.RESTV2Package, proj, nil),\n\t\t\"Reset task error\")\n}", "func (k *KubernetesExecutor) reportLostTask(driver bindings.ExecutorDriver, tid, reason string) {\n\tk.removePodTask(driver, tid, reason, mesos.TaskState_TASK_LOST)\n}", "func (k *KubernetesExecutor) reportLostTask(driver bindings.ExecutorDriver, tid, reason string) {\n\tk.removePodTask(driver, tid, reason, mesos.TaskState_TASK_LOST)\n}", "func (suite *TaskFailRetryTestSuite) TestLostTaskNoRetry() {\n\ttaskConfig := pbtask.TaskConfig{\n\t\tRestartPolicy: &pbtask.RestartPolicy{\n\t\t\tMaxFailures: 0,\n\t\t},\n\t}\n\tsuite.jobFactory.EXPECT().\n\t\tGetJob(suite.jobID).Return(suite.cachedJob)\n\n\tsuite.cachedJob.EXPECT().\n\t\tGetTask(suite.instanceID).Return(suite.cachedTask)\n\n\tsuite.cachedTask.EXPECT().\n\t\tGetRuntime(gomock.Any()).Return(suite.lostTaskRuntime, nil)\n\n\tsuite.taskConfigV2Ops.EXPECT().\n\t\tGetTaskConfig(gomock.Any(), suite.jobID, suite.instanceID, gomock.Any()).\n\t\tReturn(&taskConfig, &models.ConfigAddOn{}, nil)\n\n\terr := TaskFailRetry(context.Background(), suite.taskEnt)\n\tsuite.NoError(err)\n}", "func (trh *taskRestartHandler) Run(ctx context.Context) gimlet.Responder {\n\terr := resetTask(ctx, evergreen.GetEnvironment().Settings(), trh.taskId, trh.username, trh.FailedOnly)\n\tif err != nil {\n\t\treturn gimlet.MakeJSONErrorResponder(err)\n\t}\n\n\trefreshedTask, err := task.FindOneId(trh.taskId)\n\tif err != nil {\n\t\treturn gimlet.MakeJSONInternalErrorResponder(errors.Wrapf(err, \"finding updated task '%s'\", trh.taskId))\n\t}\n\tif refreshedTask == nil {\n\t\treturn gimlet.MakeJSONErrorResponder(gimlet.ErrorResponse{\n\t\t\tStatusCode: http.StatusNotFound,\n\t\t\tMessage: fmt.Sprintf(\"task '%s' not found\", trh.taskId),\n\t\t})\n\t}\n\n\ttaskModel := &model.APITask{}\n\terr = taskModel.BuildFromService(ctx, refreshedTask, &model.APITaskArgs{IncludeProjectIdentifier: true, IncludeAMI: true})\n\tif err != nil {\n\t\treturn gimlet.MakeJSONInternalErrorResponder(errors.Wrapf(err, \"converting task '%s' to API model\", trh.taskId))\n\t}\n\treturn gimlet.NewJSONResponse(taskModel)\n}", "func (gWal *GenericWAL) Recover() error {\n entryCh := make(chan *Entry)\n quitCh := make(chan struct{})\n defer close(quitCh)\n go func() {\n if err := gWal.wal.StartRecovery(entryCh, quitCh); err != nil {\n glog.Errorf(\"could not recover state from local wal :: %v\", err)\n entryCh <- nil\n }\n }()\n\n count := 0\n for entry := range entryCh {\n if entry == nil {\n glog.Errorf(\"wal recovery channel is closed unexpectedly\")\n return fmt.Errorf(\"wal error\")\n }\n count++\n\n switch entry.Type {\n case CTypeDone:\n glog.Infof(\"wal recovery is complete because last record is read\")\n close(entryCh)\n\n case CTypeData:\n gWal.updateRecoveryMap(false /* checkpoint */, int64(entry.LSN),\n entry.Data)\n glog.V(1).Infof(\"recovered a delta record with lsn %v\", entry.LSN)\n\n case CTypeCheckpoint:\n gWal.updateRecoveryMap(true /* checkpoint */, -1, entry.Data)\n glog.V(1).Infof(\"recovered a checkpoint record with lsn %v\", entry.LSN)\n\n case CTypeError:\n glog.Errorf(\"wal recovery encountered an unrecoverable error\")\n return fmt.Errorf(\"wal error\")\n\n default:\n glog.Errorf(\"wal recovery received an unknown or invalid record\")\n return fmt.Errorf(\"wal error\")\n }\n }\n\n return nil\n}", "func (s *Stargate) Recover() {\n\tif err := recover(); err != nil {\n\t\tfmt.Printf(\"Recovered from panic: %v\\n\", err)\n\t}\n}", "func (srv *PBServer) RecoverFromPeer(peer int, args *RecoveryArgs) {\n\treply := new(RecoveryReply)\n\tok := srv.sendRecovery(peer, args, reply)\n\n\tsrv.mu.Lock()\n\tdefer srv.mu.Unlock()\n\n\tsuccess := ok && reply.Success && srv.status == RECOVERING\n\n\tif success && reply.View >= srv.currentView {\n\t\tlog.Printf(\"Node %v - will recover with commit index %d and op index %d and log %v.\\n\", srv.me, srv.commitIndex, srv.opIndex, srv.log)\n\n\t\tif reply.View == srv.currentView {\n\t\t\tfor i := len(srv.log); i < len(reply.Entries); i++ {\n\t\t\t\tsrv.opIndex++\n\t\t\t\tsrv.log = append(srv.log, reply.Entries[i])\n\t\t\t}\n\t\t} else {\n\t\t\tsrv.log = reply.Entries\n\t\t}\n\n\t\tsrv.status = NORMAL\n\t\tsrv.opIndex = len(reply.Entries) - 1\n\t\tsrv.commitIndex = reply.PrimaryCommit\n\t\tsrv.currentView = reply.View\n\t\tsrv.lastNormalView = reply.View\n\n\t\tlog.Printf(\"Node %v - recovered with commit index %d and op index %d and log %v.\\n\", srv.me, srv.commitIndex, srv.opIndex, srv.log)\n\n\t\tgo srv.prepareUncommittedOperations()\n\t}\n}", "func (r *rpcClient) Recover(ctx context.Context) error {\n\tctx, span := r.startSpanFromContext(ctx, \"sb.rpcClient.Recover\")\n\tdefer span.End()\n\n\t_ = r.Close()\n\treturn r.ensureConn(ctx)\n}", "func (srv *PBServer) StartRecovery() {\n\tsrv.mu.Lock()\n\tdefer srv.mu.Unlock()\n\n\tif srv.status != NORMAL {\n\t\tlog.Printf(\"Node %v - not in normal status (view: %v op: %v commit: %v, status: %d)\", srv.me, srv.currentView, srv.opIndex, srv.commitIndex, srv.status)\n\t\treturn\n\t}\n\n\tlog.Printf(\"Node %v - Recovering (view: %v op: %v commit: %v)\", srv.me, srv.currentView, srv.opIndex, srv.commitIndex)\n\n\tsrv.status = RECOVERING\n\n\targs := &RecoveryArgs{View: srv.currentView, Server: srv.me}\n\n\t// Send recovery requests to all peers.\n\tfor peer := range srv.peers {\n\t\tif peer != srv.me {\n\t\t\tgo srv.RecoverFromPeer(peer, args)\n\t\t}\n\t}\n}", "func Recover(cb func()) (err error) {\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\terr = errors.E(\"panic %v: %v\", e, string(debug.Stack()))\n\t\t}\n\t}()\n\tcb()\n\treturn nil\n}", "func PanicRecover(h juggler.Handler, vars *expvar.Map) juggler.Handler {\n\treturn juggler.HandlerFunc(func(ctx context.Context, c *juggler.Conn, m message.Msg) {\n\t\tdefer func() {\n\t\t\tif e := recover(); e != nil {\n\t\t\t\tif vars != nil {\n\t\t\t\t\tvars.Add(\"RecoveredPanics\", 1)\n\t\t\t\t}\n\n\t\t\t\tvar err error\n\t\t\t\tswitch e := e.(type) {\n\t\t\t\tcase error:\n\t\t\t\t\terr = e\n\t\t\t\tdefault:\n\t\t\t\t\terr = fmt.Errorf(\"%v\", e)\n\t\t\t\t}\n\t\t\t\tc.Close(err)\n\t\t\t}\n\t\t}()\n\t\th.Handle(ctx, c, m)\n\t})\n}", "func (r NopReporter) Recover(ctx context.Context) { _ = recover() }", "func (p *AuroraAdminClient) DeleteRecoveryTasks(ctx context.Context, query *TaskQuery) (r *Response, err error) {\n var _args329 AuroraAdminDeleteRecoveryTasksArgs\n _args329.Query = query\n var _result330 AuroraAdminDeleteRecoveryTasksResult\n if err = p.Client_().Call(ctx, \"deleteRecoveryTasks\", &_args329, &_result330); err != nil {\n return\n }\n return _result330.GetSuccess(), nil\n}", "func (p *AuroraAdminClient) DeleteRecoveryTasks(ctx context.Context, query *TaskQuery) (r *Response, err error) {\n var _args379 AuroraAdminDeleteRecoveryTasksArgs\n _args379.Query = query\n var _result380 AuroraAdminDeleteRecoveryTasksResult\n var meta thrift.ResponseMeta\n meta, err = p.Client_().Call(ctx, \"deleteRecoveryTasks\", &_args379, &_result380)\n p.SetLastResponseMeta_(meta)\n if err != nil {\n return\n }\n return _result380.GetSuccess(), nil\n}", "func (e *bcsExecutor) RestartTasks() error {\n\tfor _, task := range e.tasks {\n\t\tblog.Infof(\"reload task %s start...\", task.TaskId)\n\t\terr := e.procDaemon.RestartProcess(task.TaskId)\n\t\tif err != nil {\n\t\t\tblog.Errorf(\"reload process %s error %s\", task.TaskId, err.Error())\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (m *TaskManager) ResetOverdueTask() {\n\tm.WIPTable.Range(func(key, value interface{}) bool {\n\t\tif t := value.(*Task); t.IsTimeout() {\n\t\t\tif t.LifeCycle != WIP {\n\t\t\t\tlog.Logger.Fatalf(\"the LifeCycle of the task under check is %d, but `WIP` is expected\", t.LifeCycle)\n\t\t\t}\n\t\t\tt.LifeCycle = READY\n\t\t\tm.ReadyQueue <- t\n\t\t\tm.WIPTable.Delete(key)\n\t\t\tlog.Logger.WithFields(logrus.Fields{\n\t\t\t\t\"ID\": t.ID,\n\t\t\t\t\"TaskType\": t.TaskType,\n\t\t\t}).Warn(\"reset an overdue task\")\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t})\n}", "func (tr *TaskRunner) ForceRestart(ctx context.Context, event *structs.TaskEvent, failure bool) error {\n\ttr.logger.Trace(\"Force restart requested\", \"failure\", failure, \"event\", event.GoString())\n\n\ttaskState := tr.TaskState()\n\tif taskState == nil {\n\t\treturn ErrTaskNotRunning\n\t}\n\n\ttr.stateLock.Lock()\n\tlocalState := tr.localState.Copy()\n\ttr.stateLock.Unlock()\n\n\tif localState == nil {\n\t\treturn ErrTaskNotRunning\n\t}\n\n\tswitch taskState.State {\n\tcase structs.TaskStatePending:\n\t\treturn ErrTaskNotRunning\n\n\tcase structs.TaskStateDead:\n\t\t// Tasks that are in the \"dead\" state are only allowed to restart if\n\t\t// their Run() method is still active.\n\t\tif localState.RunComplete {\n\t\t\treturn ErrTaskNotRunning\n\t\t}\n\t}\n\n\treturn tr.restartImpl(ctx, event, failure)\n}", "func (pr PermissiveRecoverer) Recover(message string) error {\n\tlog.Print(message)\n\n\tif pr.RecoveryCommand != \"\" {\n\t\tcmd := exec.Command(pr.RecoveryCommand)\n\t\tif err := cmd.Run(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (_DelegatableDai *DelegatableDaiCaller) Recover(opts *bind.CallOpts, hash [32]byte, sig []byte) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _DelegatableDai.contract.Call(opts, out, \"recover\", hash, sig)\n\treturn *ret0, err\n}", "func (e *Eval) retryTask(ctx context.Context, f *Flow, resources reflow.Resources, retryType, msg string) (*sched.Task, error) {\n\t// Apply ExecReset so that the exec can be resubmitted to the scheduler with the flow's\n\t// exec runtime parameters reset.\n\tf.ExecReset()\n\tcappedR, capped, err := e.capMemory(resources)\n\tswitch {\n\tcase err != nil:\n\t\treturn nil, err\n\tcase capped:\n\t\te.Log.Printf(\"flow %s: retryTask (reason: %s): capping resources from %s to %s (max available %s)\", f.Digest().Short(), retryType, resources, cappedR, e.MaxResources)\n\t\tresources.Set(cappedR)\n\t}\n\te.Mutate(f, SetReserved(resources), Execing)\n\ttask := e.newTask(f)\n\te.Log.Printf(\"flow %s: retryTask (reason: %s): re-submitting task with %s\", f.Digest().Short(), retryType, msg)\n\te.Scheduler.Submit(task)\n\treturn task, e.taskWait(ctx, f, task)\n}", "func (t *Task) Exec(agent *Agent) {\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\n\t\t\t//todo send task status to DCMS-agent\n\t\t\t// log.Warningf(\"run task: %s jobname: failed : %s\", t.TaskId, t.Job.Name, e)\n\t\t\tts := &TaskStatus{\n\t\t\t\tTaskPtr: t,\n\t\t\t\tCommand: nil,\n\t\t\t\tStatus: StatusFailed,\n\t\t\t\tCreateAt: time.Now().Unix(),\n\t\t\t\tErr: fmt.Errorf(\"run task: %s jobname: failed : %s\", t.TaskId, t.Job.Name, e),\n\t\t\t}\n\n\t\t\terrstr := fmt.Sprintf(\"%s\", e)\n\t\t\tif errstr == \"signal: killed\" {\n\t\t\t\tts.Status = StatusKilled\n\t\t\t}\n\t\t\tt.Job.Dcms.JobStatusChan <- ts\n\t\t}\n\t}()\n\n\tvar ts *TaskStatus\n\tvar err error\n\t// log.Info(\"task run Exec function in goroutine\")\n\n\tt.genLogFile()\n\t// check file signature\n\ttmp_md5 := util.Md5File(t.Job.Executor)\n\tif t.Job.Signature != tmp_md5 {\n\t\tts = &TaskStatus{\n\t\t\tTaskPtr: t,\n\t\t\tCommand: nil,\n\t\t\tStatus: StatusFailed,\n\t\t\tCreateAt: time.Now().Unix(),\n\t\t\tErr: fmt.Errorf(\"cronjob: %s executor: %s signature:%s does't match db's sig:%s\", t.Job.Name, t.Job.Executor, tmp_md5, t.Job.Signature),\n\t\t}\n\t\tt.Job.Dcms.JobStatusChan <- ts\n\t\treturn\n\t} else {\n\t\tlog.Info(\"cronjob signature match for \", t.Job.Name, t.Job.ExecutorFlags)\n\t}\n\n\tvar u *user.User\n\tu, err = user.Lookup(t.Job.Runner)\n\tif err != nil {\n\t\t// log.Warningf(\"user %s not exists, task %s quit \", err, t.TaskId)\n\t\tts = &TaskStatus{\n\t\t\tTaskPtr: t,\n\t\t\tCommand: nil,\n\t\t\tStatus: StatusFailed,\n\t\t\tCreateAt: time.Now().Unix(),\n\t\t\tErr: fmt.Errorf(\"user %s not exists, task %s quit \", err, t.TaskId),\n\t\t}\n\t\tt.Job.Dcms.JobStatusChan <- ts\n\t\treturn\n\t}\n\n\tvar uid int\n\tuid, err = strconv.Atoi(u.Uid)\n\tif err != nil {\n\t\t// log.Warningf(\"uid %s conver to int failed \", uid)\n\t\tts = &TaskStatus{\n\t\t\tTaskPtr: t,\n\t\t\tCommand: nil,\n\t\t\tStatus: StatusFailed,\n\t\t\tCreateAt: time.Now().Unix(),\n\t\t\tErr: fmt.Errorf(\"uid %s conver to int failed \", uid),\n\t\t}\n\t\tt.Job.Dcms.JobStatusChan <- ts\n\t\treturn\n\t}\n\n\t// chown log file to specific t.Job.Runner user\n\tif err = t.logfile.Chown(uid, uid); err != nil {\n\t\t// log.Warningf(\"chown logfile: %s to uid: %s failed, %s\", t.logfile.Name(), u.Uid, err)\n\t\tt.logfile = nil\n\t}\n\tvar cmd *exec.Cmd\n\tif t.Job.Executor != \"\" && t.Job.ExecutorFlags != \"\" {\n\t\tcmd = exec.Command(t.Job.Executor, t.Job.ExecutorFlags)\n\t} else if t.Job.Executor != \"\" && t.Job.ExecutorFlags == \"\" {\n\t\tcmd = exec.Command(t.Job.Executor)\n\t} else {\n\t\tts = &TaskStatus{\n\t\t\tTaskPtr: t,\n\t\t\tCommand: cmd,\n\t\t\tStatus: StatusFailed,\n\t\t\tCreateAt: time.Now().Unix(),\n\t\t\tErr: fmt.Errorf(\"job %s must have Executor \", t.Job.Name),\n\t\t}\n\t\tt.Job.Dcms.JobStatusChan <- ts\n\t\treturn\n\t}\n\n\tcmd.SysProcAttr = &syscall.SysProcAttr{}\n\tcmd.SysProcAttr.Credential = &syscall.Credential{Uid: uint32(uid)}\n\tcmd.SysProcAttr.Setsid = true\n\t// Pdeathsig only valid on linux system\n\t//\n\tcmd.SysProcAttr.Pdeathsig = syscall.SIGUSR1\n\n\tcmd.Stderr = t.logfile\n\tcmd.Stdout = t.logfile\n\n\tif err = cmd.Start(); err != nil {\n\t\t// log.Warningf(\"taskid:%s cmd Start failed: %s\", t.TaskId, err)\n\t\tts = &TaskStatus{\n\t\t\tTaskPtr: t,\n\t\t\tCommand: cmd,\n\t\t\tStatus: StatusFailed,\n\t\t\tCreateAt: time.Now().Unix(),\n\t\t\tErr: fmt.Errorf(\"taskid:%s cmd Start failed: %s\", t.TaskId, err),\n\t\t}\n\t\tt.Job.Dcms.JobStatusChan <- ts\n\t\treturn\n\t}\n\n\tts = &TaskStatus{\n\t\tTaskPtr: t,\n\t\tCommand: cmd,\n\t\tStatus: StatusRunning,\n\t\tCreateAt: time.Now().Unix(),\n\t\tErr: nil,\n\t}\n\tt.Job.Dcms.JobStatusChan <- ts\n\t// send cmd.process to dcms-agent\n\n\tif err = cmd.Wait(); err != nil {\n\t\t// log.Warningf(\"taskid:%s cmd Wait failed: %s\", t.TaskId, err)\n\t\tts = &TaskStatus{\n\t\t\tTaskPtr: t,\n\t\t\tCommand: cmd,\n\t\t\tStatus: StatusFailed,\n\t\t\tCreateAt: time.Now().Unix(),\n\t\t\tErr: fmt.Errorf(\"taskid:%s cmd Wait failed: %s\", t.TaskId, err),\n\t\t}\n\t\terrstr := fmt.Sprintf(\"%s\", err.Error())\n\t\tif errstr == \"signal: killed\" {\n\t\t\tts.Status = StatusKilled\n\t\t}\n\t\tt.Job.Dcms.JobStatusChan <- ts\n\t\treturn\n\t}\n\t// log.Warning(\"task run DONE\")\n\tts = &TaskStatus{\n\t\tTaskPtr: t,\n\t\tCommand: cmd,\n\t\tStatus: StatusSuccess,\n\t\tCreateAt: time.Now().Unix(),\n\t\tErr: nil,\n\t}\n\tt.Job.Dcms.JobStatusChan <- ts\n\treturn\n}", "func RestartVersion(versionId string, taskIds []string, abortInProgress bool, caller string) error {\n\tif abortInProgress {\n\t\tif err := task.AbortTasksForVersion(versionId, taskIds, caller); err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t}\n\tfinishedTasks, err := task.FindAll(task.ByIdsAndStatus(taskIds, evergreen.CompletedStatuses))\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\tfinishedTasks, err = task.AddParentDisplayTasks(finishedTasks)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\t// remove execution tasks in case the caller passed both display and execution tasks\n\t// the functions below are expected to work if just the display task is passed\n\tfor i := len(finishedTasks) - 1; i >= 0; i-- {\n\t\tt := finishedTasks[i]\n\t\tif t.DisplayTask != nil {\n\t\t\tfinishedTasks = append(finishedTasks[:i], finishedTasks[i+1:]...)\n\t\t}\n\t}\n\n\t// archive all the finished tasks\n\ttoArchive := []task.Task{}\n\tfor _, t := range finishedTasks {\n\t\tif !t.IsPartOfSingleHostTaskGroup() { // for single host task groups we don't archive until fully restarting\n\t\t\ttoArchive = append(toArchive, t)\n\t\t}\n\t}\n\tif err = task.ArchiveMany(toArchive); err != nil {\n\t\treturn errors.Wrap(err, \"unable to archive tasks\")\n\t}\n\n\ttype taskGroupAndBuild struct {\n\t\tBuild string\n\t\tTaskGroup string\n\t}\n\t// only need to check one task per task group / build combination\n\ttaskGroupsToCheck := map[taskGroupAndBuild]task.Task{}\n\ttasksToRestart := finishedTasks\n\tif abortInProgress {\n\t\taborted, err := task.Find(task.BySubsetAborted(taskIds))\n\t\tif err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t\tcatcher := grip.NewBasicCatcher()\n\t\tfor _, t := range aborted {\n\t\t\tcatcher.Add(t.SetResetWhenFinished())\n\t\t}\n\t\tif catcher.HasErrors() {\n\t\t\treturn catcher.Resolve()\n\t\t}\n\t}\n\n\trestartIds := []string{}\n\tfor _, t := range tasksToRestart {\n\t\tif t.IsPartOfSingleHostTaskGroup() {\n\t\t\tif err = t.SetResetWhenFinished(); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"unable to mark '%s' for restart when finished\", t.Id)\n\t\t\t}\n\t\t\ttaskGroupsToCheck[taskGroupAndBuild{\n\t\t\t\tBuild: t.BuildId,\n\t\t\t\tTaskGroup: t.TaskGroup,\n\t\t\t}] = t\n\t\t} else {\n\t\t\t// only hard restart non-single host task group tasks\n\t\t\trestartIds = append(restartIds, t.Id)\n\t\t\tif t.DisplayOnly {\n\t\t\t\trestartIds = append(restartIds, t.ExecutionTasks...)\n\t\t\t}\n\t\t}\n\t}\n\n\tfor tg, t := range taskGroupsToCheck {\n\t\tif err = checkResetSingleHostTaskGroup(&t, caller); err != nil {\n\t\t\treturn errors.Wrapf(err, \"error resetting task group '%s' for build '%s'\", tg.TaskGroup, tg.Build)\n\t\t}\n\t}\n\n\t// Set all the task fields to indicate restarted\n\tif err = MarkTasksReset(restartIds); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\tfor _, t := range tasksToRestart {\n\t\tif !t.IsPartOfSingleHostTaskGroup() { // this will be logged separately if task group is restarted\n\t\t\tevent.LogTaskRestarted(t.Id, t.Execution, caller)\n\t\t}\n\t}\n\tif err = build.SetBuildStartedForTasks(tasksToRestart, caller); err != nil {\n\t\treturn errors.Wrapf(err, \"error setting builds started\")\n\t}\n\tversion, err := VersionFindOneId(versionId)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to find version\")\n\t}\n\treturn errors.Wrap(version.UpdateStatus(evergreen.VersionStarted), \"unable to change version status\")\n\n}", "func (m TaskManager) LaunchTask(c context.Context, ctl task.Controller) error {\n\tcfg := ctl.Task().(*messages.GitilesTask)\n\n\tctl.DebugLog(\"Repo: %s, Refs: %s\", cfg.Repo, cfg.Refs)\n\tu, err := url.Parse(cfg.Repo)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twatchedRefs := watchedRefs{}\n\twatchedRefs.init(cfg.GetRefs())\n\n\tvar wg sync.WaitGroup\n\n\tvar heads map[string]string\n\tvar headsErr error\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\theads, headsErr = loadState(c, ctl.JobID(), u)\n\t}()\n\n\tvar refs map[string]string\n\tvar refsErr error\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\trefs, refsErr = m.getRefsTips(c, ctl, cfg.Repo, watchedRefs)\n\t}()\n\n\twg.Wait()\n\n\tif headsErr != nil {\n\t\tctl.DebugLog(\"Failed to fetch heads - %s\", headsErr)\n\t\treturn fmt.Errorf(\"failed to fetch heads: %v\", headsErr)\n\t}\n\tif refsErr != nil {\n\t\tctl.DebugLog(\"Failed to fetch refs - %s\", refsErr)\n\t\treturn fmt.Errorf(\"failed to fetch refs: %v\", refsErr)\n\t}\n\n\trefsChanged := 0\n\n\t// Delete all previously known refs which are either no longer watched or no\n\t// longer exist in repo.\n\tfor ref := range heads {\n\t\tswitch {\n\t\tcase !watchedRefs.hasRef(ref):\n\t\t\tctl.DebugLog(\"Ref %s is no longer watched\", ref)\n\t\t\tdelete(heads, ref)\n\t\t\trefsChanged++\n\t\tcase refs[ref] == \"\":\n\t\t\tctl.DebugLog(\"Ref %s deleted\", ref)\n\t\t\tdelete(heads, ref)\n\t\t\trefsChanged++\n\t\t}\n\t}\n\t// For determinism, sort keys of current refs.\n\tsortedRefs := make([]string, 0, len(refs))\n\tfor ref := range refs {\n\t\tsortedRefs = append(sortedRefs, ref)\n\t}\n\tsort.Strings(sortedRefs)\n\n\temittedTriggers := 0\n\tmaxTriggersPerInvocation := m.maxTriggersPerInvocation\n\tif maxTriggersPerInvocation == 0 {\n\t\tmaxTriggersPerInvocation = defaultMaxTriggersPerInvocation\n\t}\n\t// Note, that current `refs` contain only watched refs (see getRefsTips).\n\tfor _, ref := range sortedRefs {\n\t\tnewHead := refs[ref]\n\t\toldHead, existed := heads[ref]\n\t\tswitch {\n\t\tcase !existed:\n\t\t\tctl.DebugLog(\"Ref %s is new: %s\", ref, newHead)\n\t\tcase oldHead != newHead:\n\t\t\tctl.DebugLog(\"Ref %s updated: %s => %s\", ref, oldHead, newHead)\n\t\tdefault:\n\t\t\t// No change.\n\t\t\tcontinue\n\t\t}\n\t\theads[ref] = newHead\n\t\trefsChanged++\n\t\temittedTriggers++\n\t\t// TODO(tandrii): actually look at commits between current and previously\n\t\t// known tips of each ref.\n\t\t// In current (v1) engine, all triggers emitted around the same time will\n\t\t// result in just 1 invocation of each triggered job. Therefore,\n\t\t// passing just HEAD's revision is good enough.\n\t\t// For the same reason, only 1 of the refs will actually be processed if\n\t\t// several refs changed at the same time.\n\t\tctl.EmitTrigger(c, &internal.Trigger{\n\t\t\tId: fmt.Sprintf(\"%s/+/%s@%s\", cfg.Repo, ref, newHead),\n\t\t\tTitle: newHead,\n\t\t\tUrl: fmt.Sprintf(\"%s/+/%s\", cfg.Repo, newHead),\n\t\t\tPayload: &internal.Trigger_Gitiles{\n\t\t\t\tGitiles: &api.GitilesTrigger{Repo: cfg.Repo, Ref: ref, Revision: newHead},\n\t\t\t},\n\t\t})\n\n\t\t// Safeguard against too many changes such as the first run after\n\t\t// config change to watch many more refs than before.\n\t\tif emittedTriggers >= maxTriggersPerInvocation {\n\t\t\tctl.DebugLog(\"Emitted %d triggers, postponing the rest\", emittedTriggers)\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif refsChanged == 0 {\n\t\tctl.DebugLog(\"No changes detected\")\n\t} else {\n\t\tctl.DebugLog(\"%d refs changed\", refsChanged)\n\t\t// Force save to ensure triggers are actually emitted.\n\t\tif err := ctl.Save(c); err != nil {\n\t\t\t// At this point, triggers have not been sent, so bail now and don't save\n\t\t\t// the refs' heads newest values.\n\t\t\treturn err\n\t\t}\n\t\tif err := saveState(c, ctl.JobID(), u, heads); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tctl.DebugLog(\"Saved %d known refs\", len(heads))\n\t}\n\n\tctl.State().Status = task.StatusSucceeded\n\treturn nil\n}", "func (recovery *Recovery) RecoverRegions(ctx context.Context) (err error) {\n\teg, ectx := errgroup.WithContext(ctx)\n\ttotalRecoveredStores := len(recovery.RecoveryPlan)\n\tworkers := utils.NewWorkerPool(uint(mathutil.Min(totalRecoveredStores, common.MaxStoreConcurrency)), \"Recover Regions\")\n\n\tfor storeId, plan := range recovery.RecoveryPlan {\n\t\tif err := ectx.Err(); err != nil {\n\t\t\tbreak\n\t\t}\n\n\t\tstoreAddr := getStoreAddress(recovery.allStores, storeId)\n\t\trecoveryPlan := plan\n\t\trecoveryStoreId := storeId\n\t\tworkers.ApplyOnErrorGroup(eg, func() error {\n\t\t\trecoveryClient, conn, err := recovery.newRecoveryClient(ectx, storeAddr)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"create tikv client failed\", zap.Uint64(\"store id\", recoveryStoreId))\n\t\t\t\treturn errors.Trace(err)\n\t\t\t}\n\t\t\tdefer conn.Close()\n\t\t\tlog.Info(\"send recover region to tikv\", zap.String(\"tikv address\", storeAddr), zap.Uint64(\"store id\", recoveryStoreId))\n\t\t\tstream, err := recoveryClient.RecoverRegion(ectx)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"create recover region failed\", zap.Uint64(\"store id\", recoveryStoreId))\n\t\t\t\treturn errors.Trace(err)\n\t\t\t}\n\n\t\t\t// for a TiKV, send the stream\n\t\t\tfor _, s := range recoveryPlan {\n\t\t\t\tif err = stream.Send(s); err != nil {\n\t\t\t\t\tlog.Error(\"send recover region failed\", zap.Error(err))\n\t\t\t\t\treturn errors.Trace(err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treply, err := stream.CloseAndRecv()\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"close the stream failed\")\n\t\t\t\treturn errors.Trace(err)\n\t\t\t}\n\t\t\trecovery.progress.Inc()\n\t\t\tlog.Info(\"recover region execution success\", zap.Uint64(\"store id\", reply.GetStoreId()))\n\t\t\treturn nil\n\t\t})\n\t}\n\t// Wait for all TiKV instances force leader and wait apply to last log.\n\treturn eg.Wait()\n}", "func (m *Master) GetTask(_ *ExampleArgs, reply *GetTaskReply) error {\n\tswitch m.masterState {\n\tcase newMaster:\n\t\tfor i, task := range m.mapTask {\n\t\t\tif task.State == initialState {\n\t\t\t\treply.Task.Type_ = task.Type_\n\t\t\t\treply.Task.Filename = task.Filename\n\t\t\t\treply.Task.Id = task.Id\n\t\t\t\treply.Task.NReduce = task.NReduce\n\t\t\t\treply.Flag = 0\n\t\t\t\treply.Task.State = task.State\n\n\t\t\t\tm.mapTask[i].State = inProgress\n\t\t\t\tm.mapTask[i].Time = time.Now()\n\t\t\t\t//reply.Task.State=m.mapTask[i].State\n\n\t\t\t\treturn nil\n\t\t\t} else if task.State == inProgress && time.Now().Sub(m.mapTask[i].Time) > time.Duration(5)*time.Second {\n\t\t\t\treply.Task.Type_ = task.Type_\n\t\t\t\treply.Task.Filename = task.Filename\n\t\t\t\treply.Task.Id = task.Id\n\t\t\t\treply.Task.NReduce = task.NReduce\n\t\t\t\treply.Task.State = task.State\n\t\t\t\treply.Flag = 0\n\n\t\t\t\tm.mapTask[i].State = inProgress\n\t\t\t\tm.mapTask[i].Time = time.Now()\n\t\t\t\t//reply.Task.State=m.mapTask[i].State\n\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\treply.Flag = 1 // map not finished but in progress\n\tcase completeMap:\n\t\tfor i, task := range m.reduceTask {\n\t\t\tif task.State == initialState {\n\t\t\t\treply.Task.Type_ = task.Type_\n\t\t\t\treply.Task.Filename = task.Filename\n\t\t\t\treply.Task.Id = task.Id\n\t\t\t\treply.Task.NReduce = task.NReduce\n\t\t\t\treply.Flag = 0\n\t\t\t\treply.Task.Files = task.Files\n\t\t\t\treply.Task.State = task.State\n\n\t\t\t\tm.reduceTask[i].State = inProgress\n\t\t\t\tm.reduceTask[i].Time = time.Now()\n\t\t\t\t//reply.Task.State=m.mapTask[i].State\n\n\t\t\t\treturn nil\n\t\t\t} else if task.State == inProgress && time.Now().Sub(m.reduceTask[i].Time) > time.Duration(5)*time.Second {\n\t\t\t\treply.Task.Type_ = task.Type_\n\t\t\t\treply.Task.Filename = task.Filename\n\t\t\t\treply.Task.Id = task.Id\n\t\t\t\treply.Task.NReduce = task.NReduce\n\t\t\t\treply.Flag = 0\n\t\t\t\treply.Task.Files = task.Files\n\t\t\t\treply.Task.State = task.State\n\n\t\t\t\tm.reduceTask[i].State = inProgress\n\t\t\t\tm.reduceTask[i].Time = time.Now()\n\t\t\t\t//reply.Task.State=m.mapTask[i].State\n\n\t\t\t\treturn nil\n\n\t\t\t}\n\t\t}\n\t\treply.Flag = 1 // reduce not finished but in progress\n\tcase completeReduce:\n\t\treply.Flag = 2 // all task have been finished\n\n\t}\n\n\treturn nil\n}", "func (p *AuroraAdminClient) QueryRecovery(ctx context.Context, query *TaskQuery) (r *Response, err error) {\n var _args327 AuroraAdminQueryRecoveryArgs\n _args327.Query = query\n var _result328 AuroraAdminQueryRecoveryResult\n if err = p.Client_().Call(ctx, \"queryRecovery\", &_args327, &_result328); err != nil {\n return\n }\n return _result328.GetSuccess(), nil\n}", "func RecoverCluster(conf *Config, fsm FSM, logs LogStore, stable StableStore,\n\tsnaps SnapshotStore, trans Transport, configuration Configuration) error {\n\t// Validate the Raft server config.\n\tif err := ValidateConfig(conf); err != nil {\n\t\treturn err\n\t}\n\n\t// Sanity check the Raft peer configuration.\n\tif err := checkConfiguration(configuration); err != nil {\n\t\treturn err\n\t}\n\n\t// Make sure the cluster is in a clean state.\n\thasState, err := HasExistingState(logs, stable, snaps)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to check for existing state: %v\", err)\n\t}\n\tif !hasState {\n\t\treturn fmt.Errorf(\"refused to recover cluster with no initial state, this is probably an operator error\")\n\t}\n\n\t// Attempt to restore any snapshotStore we find, newest to oldest.\n\tvar (\n\t\tsnapshotIndex uint64\n\t\tsnapshotTerm uint64\n\t)\n\tsnapshots, err := snaps.List()\n\tif err != nil {\n\t\tklog.Errorf(fmt.Sprintf(\"failed to list snapshotStore err:%v\", err))\n\t\treturn err\n\t}\n\t// Try to load in order of newest to oldest\n\tfor _, snapshot := range snapshots {\n\t\tif !conf.NoSnapshotRestoreOnStart {\n\t\t\t_, source, err := snaps.Open(snapshot.ID)\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorf(fmt.Sprintf(\"failed to open snapshot id:%s err:%v\", snapshot.ID, err))\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif err := fsm.Restore(source); err != nil {\n\t\t\t\tsource.Close()\n\t\t\t\tklog.Errorf(fmt.Sprintf(\"failed to restore snapshot id:%s err:%v\", snapshot.ID, err))\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tsource.Close()\n\t\t\tklog.Infof(fmt.Sprintf(\"restored from snapshot id:%s\", snapshot.ID))\n\t\t}\n\n\t\tsnapshotIndex = snapshot.Index\n\t\tsnapshotTerm = snapshot.Term\n\t\tbreak\n\t}\n\tif len(snapshots) > 0 && (snapshotIndex == 0 || snapshotTerm == 0) {\n\t\treturn fmt.Errorf(\"failed to restore any of the available snapshotStore\")\n\t}\n\n\t// The snapshot information is the best known end point for the data\n\t// until we play back the Raft log entries.\n\tlastIndex := snapshotIndex\n\tlastTerm := snapshotTerm\n\t// Apply any Raft log entries from the snapshot index to last log index.\n\tlastLogIndex, err := logs.LastIndex()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to find last log: %v\", err)\n\t}\n\tfor index := snapshotIndex + 1; index <= lastLogIndex; index++ {\n\t\tvar entry pb.Log\n\t\tif err = logs.GetLog(index, &entry); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get log at index %d: %v\", index, err)\n\t\t}\n\t\tif entry.Type == pb.LogType_COMMAND {\n\t\t\t_ = fsm.Apply(&entry)\n\t\t}\n\n\t\tlastIndex = entry.Index\n\t\tlastTerm = entry.Term\n\t}\n\n\tif lastIndex != lastLogIndex {\n\t\tklog.Fatalf(fmt.Sprintf(\"lastIndex:%d should be equal to lastLogIndex:%d\", lastIndex, lastLogIndex))\n\t}\n\n\t// snapshot fsm\n\tsnapshot, err := fsm.Snapshot()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to snapshot FSM: %v\", err)\n\t}\n\tsink, err := snaps.Create(lastIndex, lastTerm, configuration, 1)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create snapshot: %v\", err)\n\t}\n\tif err = snapshot.Persist(sink); err != nil {\n\t\treturn fmt.Errorf(\"failed to persist snapshot: %v\", err)\n\t}\n\tif err = sink.Close(); err != nil {\n\t\treturn fmt.Errorf(\"failed to finalize snapshot: %v\", err)\n\t}\n\t// compact logs\n\tfirstLogIndex, err := logs.FirstIndex()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get first log index: %v\", err)\n\t}\n\tif err := logs.DeleteRange(firstLogIndex, lastLogIndex); err != nil {\n\t\treturn fmt.Errorf(\"log compaction failed: %v\", err)\n\t}\n\n\treturn nil\n}", "func (mc *mgmtClient) recover(ctx context.Context) error {\n\tmc.clientMu.Lock()\n\tdefer mc.clientMu.Unlock()\n\n\tctx, span := mc.startSpanFromContext(ctx, string(tracing.SpanNameRecover))\n\tdefer span.End()\n\n\tif mc.rpcLink != nil {\n\t\tif err := mc.rpcLink.Close(ctx); err != nil {\n\t\t\ttab.For(ctx).Debug(fmt.Sprintf(\"Error while closing old link in recovery: %s\", err.Error()))\n\t\t}\n\t\tmc.rpcLink = nil\n\t}\n\n\tif _, err := mc.getLinkWithoutLock(ctx); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func recoverWorkflow(ctx workflow.Context, params Params) error {\n\tlogger := workflow.GetLogger(ctx)\n\tlogger.Info(\"Recover workflow started.\")\n\n\tao := workflow.ActivityOptions{\n\t\tScheduleToStartTimeout: 10 * time.Minute,\n\t\tStartToCloseTimeout: 10 * time.Minute,\n\t\tHeartbeatTimeout: time.Second * 30,\n\t}\n\tctx = workflow.WithActivityOptions(ctx, ao)\n\n\tvar result ListOpenExecutionsResult\n\terr := workflow.ExecuteActivity(ctx, listOpenExecutions, params.Type).Get(ctx, &result)\n\tif err != nil {\n\t\tlogger.Error(\"Failed to list open workflow executions.\", zap.Error(err))\n\t\treturn err\n\t}\n\n\tconcurrency := 1\n\tif params.Concurrency > 0 {\n\t\tconcurrency = params.Concurrency\n\t}\n\n\tif result.Count < concurrency {\n\t\tconcurrency = result.Count\n\t}\n\n\tbatchSize := result.Count / concurrency\n\tif result.Count%concurrency != 0 {\n\t\tbatchSize++\n\t}\n\n\t// Setup retry policy for recovery activity\n\tinfo := workflow.GetInfo(ctx)\n\texpiration := time.Duration(info.ExecutionStartToCloseTimeoutSeconds) * time.Second\n\tretryPolicy := &cadence.RetryPolicy{\n\t\tInitialInterval: time.Second,\n\t\tBackoffCoefficient: 2,\n\t\tMaximumInterval: 10 * time.Second,\n\t\tExpirationInterval: expiration,\n\t\tMaximumAttempts: 100,\n\t}\n\tao = workflow.ActivityOptions{\n\t\tScheduleToStartTimeout: expiration,\n\t\tStartToCloseTimeout: expiration,\n\t\tHeartbeatTimeout: time.Second * 30,\n\t\tRetryPolicy: retryPolicy,\n\t}\n\tctx = workflow.WithActivityOptions(ctx, ao)\n\n\tdoneCh := workflow.NewChannel(ctx)\n\tfor i := 0; i < concurrency; i++ {\n\t\tstartIndex := i * batchSize\n\n\t\tworkflow.Go(ctx, func(ctx workflow.Context) {\n\t\t\terr = workflow.ExecuteActivity(ctx, recoverExecutions, result.ID, startIndex, batchSize).Get(ctx, nil)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Error(\"Recover executions failed.\", zap.Int(\"StartIndex\", startIndex), zap.Error(err))\n\t\t\t} else {\n\t\t\t\tlogger.Info(\"Recover executions completed.\", zap.Int(\"StartIndex\", startIndex))\n\t\t\t}\n\n\t\t\tdoneCh.Send(ctx, \"done\")\n\t\t})\n\t}\n\n\tfor i := 0; i < concurrency; i++ {\n\t\tdoneCh.Receive(ctx, nil)\n\t}\n\n\tlogger.Info(\"Workflow completed.\", zap.Int(\"Result\", result.Count))\n\n\treturn nil\n}", "func (ra *RecoverableAction) Recover(r Recoverable, err interface{}) {\n\tif ra == r {\n\t\tlog.Printf(\"Recovering error '%v'!\", err)\n\n\t\tra.replyChan <- \"Recovered\"\n\n\t\tgo ra.backend()\n\t}\n}", "func (conf *Confirmer) StartConfirmerTask(bundleTrytes []Trytes) (chan *ConfirmerUpdate, func(), error) {\n\tconf.runningMutex.Lock()\n\tdefer conf.runningMutex.Unlock()\n\n\tif conf.running {\n\t\treturn nil, nil, fmt.Errorf(\"Confirmer task is already running\")\n\t}\n\n\ttail, err := utils.TailFromBundleTrytes(bundleTrytes)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tbundleHash := tail.Bundle\n\tnowis := time.Now()\n\n\t// no need to lock state because no routine is running\n\tconf.lastBundleTrytes = bundleTrytes\n\tconf.bundleHash = bundleHash\n\tconf.nextForceReattachTime = nowis.Add(time.Duration(conf.ForceReattachAfterMin) * time.Minute)\n\tconf.nextPromoTime = nowis\n\tconf.nextTailHashToPromote = tail.Hash\n\tconf.isNotPromotable = false\n\tconf.chanUpdate = make(chan *ConfirmerUpdate, 1) // not to block each time\n\tconf.numAttach = 0\n\tconf.numPromote = 0\n\tconf.totalDurationGTTAMsec = 0\n\tconf.totalDurationATTMsec = 0\n\tif conf.AEC == nil {\n\t\tconf.AEC = &utils.DummyAEC{}\n\t}\n\tif conf.SlowDownThreshold == 0 {\n\t\tconf.SlowDownThreshold = defaultSlowDownThresholdNumGoroutine\n\t}\n\n\t// starting 3 routines\n\tcancelPromoCheck := conf.goPromotabilityCheck()\n\tcancelPromo := conf.goPromote()\n\tcancelReattach := conf.goReattach()\n\n\t// confirmation monitor starts yet another routine\n\tconf.confMon.OnConfirmation(bundleHash, func(nowis time.Time) {\n\t\tconf.postConfirmerUpdate(UPD_CONFIRM, \"\", nil)\n\t})\n\n\tconf.running = true\n\n\treturn conf.chanUpdate, func() {\n\t\tconf.stopConfirmerTask(cancelPromoCheck, cancelPromo, cancelReattach)\n\t\tconf.confMon.CancelConfirmationPolling(bundleHash)\n\t}, nil\n}", "func CleanTask() {\n\tfor taskID, t := range kv.DefaultClient.GetStorage().Tasks {\n\t\tflag := true\n\t\tfor nid := range kv.DefaultClient.GetStorage().Nodes {\n\t\t\tif t.NodeID == nid {\n\t\t\t\tflag = false\n\t\t\t}\n\t\t}\n\t\tif flag {\n\t\t\tif t.Timer {\n\t\t\t\tlog.Info(\"clean timer:\", taskID)\n\t\t\t\tormTimer := new(orm.Timer)\n\t\t\t\tormTimer.ID = taskID\n\t\t\t\tormTimer.Status = false\n\t\t\t\terr := orm.UpdateTimerStatus(ormTimer)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog.Info(\"clean task:\", taskID)\n\t\t\t\tormTask := new(orm.Task)\n\t\t\t\tormTask.ID = taskID\n\t\t\t\tormTask.Status = \"error\"\n\t\t\t\terr := orm.UpdateTask(ormTask)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tkv.DefaultClient.DeleteTask(taskID)\n\t\t}\n\t}\n}", "func (rm *ResourceManager) AutoRecoverResourceGroup(rgName string) ([]int64, error) {\n\trm.rwmutex.Lock()\n\tdefer rm.rwmutex.Unlock()\n\n\tif rm.groups[rgName] == nil {\n\t\treturn nil, merr.WrapErrResourceGroupNotFound(rgName)\n\t}\n\n\tret := make([]int64, 0)\n\n\trm.checkRGNodeStatus(DefaultResourceGroupName)\n\trm.checkRGNodeStatus(rgName)\n\tlackNodesNum := rm.groups[rgName].LackOfNodes()\n\tnodesInDefault := rm.groups[DefaultResourceGroupName].GetNodes()\n\tfor i := 0; i < len(nodesInDefault) && i < lackNodesNum; i++ {\n\t\t//todo: a better way to choose a node with least balance cost\n\t\tnode := nodesInDefault[i]\n\t\terr := rm.unassignNode(DefaultResourceGroupName, node)\n\t\tif err != nil {\n\t\t\t// interrupt transfer, unreachable logic path\n\t\t\treturn ret, err\n\t\t}\n\n\t\terr = rm.groups[rgName].assignNode(node, 0)\n\t\tif err != nil {\n\t\t\t// roll back, unreachable logic path\n\t\t\trm.assignNode(DefaultResourceGroupName, node)\n\t\t\treturn ret, err\n\t\t}\n\n\t\tlog.Info(\"move node from default rg to recover\",\n\t\t\tzap.String(\"targetRG\", rgName),\n\t\t\tzap.Int64(\"nodeID\", node),\n\t\t)\n\n\t\tret = append(ret, node)\n\t}\n\n\treturn ret, nil\n}", "func NewTaskRetry() *TaskRetry {\n\treturn &TaskRetry{}\n}", "func (k *KubernetesExecutor) KillTask(driver bindings.ExecutorDriver, taskId *mesos.TaskID) {\n\tif k.isDone() {\n\t\treturn\n\t}\n\tlog.Infof(\"Kill task %v\\n\", taskId)\n\n\tif !k.isConnected() {\n\t\t//TODO(jdefelice) sent TASK_LOST here?\n\t\tlog.Warningf(\"Ignore kill task because the executor is disconnected\\n\")\n\t\treturn\n\t}\n\n\tk.lock.Lock()\n\tdefer k.lock.Unlock()\n\tk.killPodForTask(driver, taskId.GetValue(), messages.TaskKilled)\n}", "func (krct *keyRegistrationConfirmationTask) RunTask() (interface{}, error) {\n\tlog.Infof(\"Waiting for confirmation for the Key [%x]\", krct.key)\n\tif krct.ctx == nil {\n\t\tkrct.ctx, _ = krct.contextInitializer(krct.timeout)\n\t}\n\n\tid := newEthereumIdentity(krct.centID, krct.contract, krct.config, krct.queue, krct.gethClientFinder, krct.contractProvider)\n\tcontract, err := id.getContract()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkrct.filterer = contract\n\tfOpts := &bind.FilterOpts{\n\t\tContext: krct.ctx,\n\t\tStart: krct.blockHeight,\n\t}\n\n\tfor {\n\t\titer, err := krct.filterer.FilterKeyAdded(fOpts, [][32]byte{krct.key}, []*big.Int{big.NewInt(int64(krct.keyPurpose))})\n\t\tif err != nil {\n\t\t\treturn nil, centerrors.Wrap(err, \"failed to start filtering key event logs\")\n\t\t}\n\n\t\terr = utils.LookForEvent(iter)\n\t\tif err == nil {\n\t\t\tlog.Infof(\"Received filtered event Key Registration Confirmation for CentrifugeID [%s] and key [%x] with purpose [%d]\\n\", krct.centID.String(), krct.key, krct.keyPurpose)\n\t\t\treturn iter.Event, nil\n\t\t}\n\n\t\tif err != utils.ErrEventNotFound {\n\t\t\treturn nil, err\n\t\t}\n\t\ttime.Sleep(100 * time.Millisecond)\n\t}\n}", "func (tr *TaskRunner) restartImpl(ctx context.Context, event *structs.TaskEvent, failure bool) error {\n\n\t// Check if the task is able to restart based on its state and the type of\n\t// restart event that was triggered.\n\ttaskState := tr.TaskState()\n\tif taskState == nil {\n\t\treturn ErrTaskNotRunning\n\t}\n\n\t// Emit the event since it may take a long time to kill\n\ttr.EmitEvent(event)\n\n\t// Tell the restart tracker that a restart triggered the exit\n\ttr.restartTracker.SetRestartTriggered(failure)\n\n\t// Signal a restart to unblock tasks that are in the \"dead\" state, but\n\t// don't block since the channel is buffered. Only one signal is enough to\n\t// notify the tr.Run() loop.\n\t// The channel must be signaled after SetRestartTriggered is called so the\n\t// tr.Run() loop runs again.\n\tif taskState.State == structs.TaskStateDead {\n\t\tselect {\n\t\tcase tr.restartCh <- struct{}{}:\n\t\tdefault:\n\t\t}\n\t}\n\n\t// Grab the handle to see if the task is still running and needs to be\n\t// killed.\n\thandle := tr.getDriverHandle()\n\tif handle == nil {\n\t\treturn nil\n\t}\n\n\t// Run the pre-kill hooks prior to restarting the task\n\ttr.preKill()\n\n\t// Grab a handle to the wait channel that will timeout with context cancelation\n\t// _before_ killing the task.\n\twaitCh, err := handle.WaitCh(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Kill the task using an exponential backoff in-case of failures.\n\tif _, err := tr.killTask(handle, waitCh); err != nil {\n\t\t// We couldn't successfully destroy the resource created.\n\t\ttr.logger.Error(\"failed to kill task. Resources may have been leaked\", \"error\", err)\n\t}\n\n\tselect {\n\tcase <-waitCh:\n\tcase <-ctx.Done():\n\t}\n\treturn nil\n}", "func (j *TxGuardedJob[Tx, P]) discoverTask(ctx context.Context, labels prometheus.Labels) (task *txGuardedTask[Tx, P], returnedError error) {\n\ttx, err := j.BeginTx()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif returnedError != nil {\n\t\t\tsqlext.RollbackUnlessCommitted(tx)\n\t\t}\n\t}()\n\n\tpayload, err := j.DiscoverRow(ctx, tx, labels)\n\tif err != nil {\n\t\tif errors.Is(err, sql.ErrNoRows) {\n\t\t\t//nolint:errcheck\n\t\t\ttx.Rollback() //avoid the log line generated by sqlext.RollbackUnlessCommitted()\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn &txGuardedTask[Tx, P]{\n\t\tTransaction: tx,\n\t\tPayload: payload,\n\t}, nil\n}", "func main() {\n\ttryRecover()\n}", "func (sd *ScanDiapasons) NotifyDpnsTask(ctx context.Context) ([]byte, error) {\n\trequest, err := http.NewRequest(\"POST\", sd.client.Server+\"/api/v1.0/ScanDiapasons.NotifyDpnsTask\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\traw, err := sd.client.Do(ctx, request, nil)\n\treturn raw, err\n}", "func (task *QueueTask) Reset(conf *TaskConfig) error {\n\tif conf.Interval <= 0 {\n\t\terrmsg := \"interval is wrong format => must bigger then zero\"\n\t\ttask.taskService.Logger().Debug(fmt.Sprint(\"TaskInfo:Reset \", task, conf, \"error\", errmsg))\n\t\treturn errors.New(errmsg)\n\t}\n\n\t//restart task\n\ttask.Stop()\n\ttask.IsRun = conf.IsRun\n\tif conf.TaskData != nil {\n\t\ttask.TaskData = conf.TaskData\n\t}\n\tif conf.Handler != nil {\n\t\ttask.handler = conf.Handler\n\t}\n\ttask.Interval = conf.Interval\n\ttask.Start()\n\ttask.taskService.Logger().Debug(fmt.Sprint(\"TaskInfo:Reset \", task, conf, \"success\"))\n\treturn nil\n}", "func (syncer *MerkleSyncer) recover(begin, end uint64) {\n\tlogger.WithFields(logrus.Fields{\n\t\t\"begin\": begin,\n\t\t\"end\": end,\n\t}).Info(\"Syncer recover\")\n\n\tch, err := syncer.agent.GetMerkleWrapper(begin, end)\n\tif err != nil {\n\t\tlogger.WithFields(logrus.Fields{\n\t\t\t\"begin\": begin,\n\t\t\t\"end\": end,\n\t\t\t\"error\": err,\n\t\t}).Warn(\"get merkle wrapper\")\n\t}\n\n\tfor w := range ch {\n\t\tsyncer.handleMerkleWrapper(w)\n\t}\n}", "func ResetTasks() {\n\tconn := getConnection(\"mflow\")\n\tdb, err := sql.Open(\"godror\", conn.User+\"/\"+conn.Password+\"@\"+conn.ConnectionString)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tdefer db.Close()\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tconst command string = `delete mflow.tasks where id_master = :id_master and status = :status`\n\t_, err = tx.Exec(command, sql.Named(\"id_master\", global.IDMaster), sql.Named(\"status\", runningStatus))\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\terr = tx.Commit()\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n}", "func (tsi *TaskerServerImpl) TriggerRepairOnRepairFailed(ctx context.Context, req *fleet.TriggerRepairOnRepairFailedRequest) (resp *fleet.TaskerTasksResponse, err error) {\n\tdefer func() {\n\t\terr = grpcutil.GRPCifyAndLogErr(ctx, err)\n\t}()\n\n\tif err = req.Validate(); err != nil {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, err.Error())\n\t}\n\tsc, err := tsi.newSwarmingClient(ctx, config.Get(ctx).Swarming.Host)\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"failed to obtain Swarming client\").Err()\n\t}\n\n\tbses, err := botsummary.Get(ctx, req.Selectors)\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"failed to obtain requested bots from datastore\").Err()\n\t}\n\treturn createTasksPerBot(bses, func(bse *botsummary.Entity) (*fleet.TaskerBotTasks, error) {\n\t\treturn triggerRepairOnRepairFailedForBot(ctx, sc, req, bse)\n\t})\n}", "func (db *TaskDB) ReadTask(id string) (eremetic.Task, error) {\n\ttask, err := db.ReadUnmaskedTask(id)\n\n\teremetic.ApplyMask(&task)\n\n\treturn task, err\n}", "func (_m *StateOps) RefreshTaskState() {\n\t_m.Called()\n}", "func (d Dependency) DoRecover() (interface{}, error) {\n\tdLog.V(utils.Debug).Info(\"can not recover dependency now\", \"name\", d.Name, \"version\", d.Version)\n\treturn \"\", nil\n}", "func (n *NoOP) RecoverFromSnapshot(r io.Reader,\n\tfiles []statemachine.SnapshotFile,\n\tdone <-chan struct{}) error {\n\tvar sn NoOP\n\tdata, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = json.Unmarshal(data, &sn)\n\tif err != nil {\n\t\tpanic(\"failed to unmarshal snapshot\")\n\t}\n\n\treturn nil\n}", "func (p *AuroraAdminClient) QueryRecovery(ctx context.Context, query *TaskQuery) (r *Response, err error) {\n var _args377 AuroraAdminQueryRecoveryArgs\n _args377.Query = query\n var _result378 AuroraAdminQueryRecoveryResult\n var meta thrift.ResponseMeta\n meta, err = p.Client_().Call(ctx, \"queryRecovery\", &_args377, &_result378)\n p.SetLastResponseMeta_(meta)\n if err != nil {\n return\n }\n return _result378.GetSuccess(), nil\n}", "func (orc *Oracle) RunWithRecovery() {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\torc.logger.Error(\"recovered from panic in Gateway Oracle\", \"r\", r)\n\t\t\t// Unless it's a runtime error restart the goroutine\n\t\t\tif _, ok := r.(runtime.Error); !ok {\n\t\t\t\ttime.Sleep(30 * time.Second)\n\t\t\t\torc.logger.Info(\"Restarting Gateway Oracle...\")\n\t\t\t\tgo orc.RunWithRecovery()\n\t\t\t}\n\t\t}\n\t}()\n\n\t// When running in-process give the node a bit of time to spin up.\n\tif orc.startupDelay > 0 {\n\t\ttime.Sleep(orc.startupDelay)\n\t}\n\n\torc.Run()\n}", "func (agent *TestAgent) ResolveTaskDockerID(task *TestTask, containerName string) (string, error) {\n\tvar err error\n\tvar dockerId string\n\tfor i := 0; i < 5; i++ {\n\t\tdockerId, err = agent.resolveTaskDockerID(task, containerName)\n\t\tif err == nil {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(100 * time.Millisecond)\n\t}\n\treturn dockerId, err\n}", "func (k *KubernetesExecutor) KillTask(driver bindings.ExecutorDriver, taskId *mesos.TaskID) {\n\tif k.isDone() {\n\t\treturn\n\t}\n\tlog.Infof(\"Kill task %v\\n\", taskId)\n\n\tif !k.isConnected() {\n\t\t//TODO(jdefelice) sent TASK_LOST here?\n\t\tlog.Warningf(\"Ignore kill task because the executor is disconnected\\n\")\n\t\treturn\n\t}\n\n\tk.lock.Lock()\n\tdefer k.lock.Unlock()\n\tk.removePodTask(driver, taskId.GetValue(), messages.TaskKilled, mesos.TaskState_TASK_KILLED)\n}", "func (mgr *ClientMgr) onTaskEnd(ctx context.Context, client *Client, task *Task,\n\terr error, reply *jarviscrawlercore.ReplyCrawler, endChan chan int) {\n\n\tif err != nil {\n\t\tif task.Logger != nil {\n\t\t\ttask.Logger.Warn(\"onTaskEnd: error\",\n\t\t\t\tzap.Error(err),\n\t\t\t\tzap.String(\"servaddr\", client.servAddr),\n\t\t\t\tJSON(\"task\", task))\n\t\t}\n\n\t\t// if !(strings.Index(err.Error(), \"Error: noretry:\") == 0 ||\n\t\t// \tstrings.Index(err.Error(), \"noretry:\") == 0) {\n\t\tif !IsNoRetryError(err) {\n\n\t\t\tif task.RetryNums > 0 {\n\t\t\t\ttask.RetryNums--\n\n\t\t\t\t// time.Sleep(time.Second * time.Duration(mgr.cfg.SleepTime))\n\n\t\t\t\ttask.Running = false\n\t\t\t\tclient.Running = false\n\t\t\t\tendChan <- 0\n\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// task.Fail = true\n\t\t\t// task.running = false\n\t\t}\n\n\t\ttask.Fail = true\n\t}\n\n\tgo task.Callback(ctx, task, err, reply)\n\n\t// time.Sleep(time.Second * time.Duration(mgr.cfg.SleepTime))\n\n\ttask.Running = false\n\tclient.Running = false\n\tendChan <- task.TaskID\n}", "func Rebalance() error {\n\ttargetQuota, err := getQuotaMap(safeZkConn)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tlivingNodes, err := getLivingNodeInfos(safeZkConn)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tlog.Infof(\"start rebalance\")\n\tfor _, node := range livingNodes {\n\t\tfor len(node.CurSlots) > targetQuota[node.GroupId] {\n\t\t\tfor _, dest := range livingNodes {\n\t\t\t\tif dest.GroupId != node.GroupId && len(dest.CurSlots) < targetQuota[dest.GroupId] {\n\t\t\t\t\tslot := node.CurSlots[len(node.CurSlots)-1]\n\t\t\t\t\t// create a migration task\n\t\t\t\t\tinfo := &MigrateTaskInfo{\n\t\t\t\t\t\tDelay: 0,\n\t\t\t\t\t\tSlotId: slot,\n\t\t\t\t\t\tNewGroupId: dest.GroupId,\n\t\t\t\t\t\tStatus: MIGRATE_TASK_PENDING,\n\t\t\t\t\t\tCreateAt: strconv.FormatInt(time.Now().Unix(), 10),\n\t\t\t\t\t}\n\t\t\t\t\tglobalMigrateManager.PostTask(info)\n\n\t\t\t\t\tnode.CurSlots = node.CurSlots[0 : len(node.CurSlots)-1]\n\t\t\t\t\tdest.CurSlots = append(dest.CurSlots, slot)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tlog.Infof(\"rebalance tasks submit finish\")\n\treturn nil\n}", "func (b *configuratorBehavior) Recover(err interface{}) error {\n\treturn nil\n}", "func RestoreTaskFunc(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"GET\" {\n\t\thttp.Redirect(w, r, \"/\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tid, err := strconv.Atoi(r.URL.Path[len(\"/restore/\"):])\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Redirect(w, r, \"/deleted\", http.StatusBadRequest)\n\t} else {\n\t\tusername := sessions.GetCurrentUserName(r)\n\t\terr = db.RestoreTask(username, id)\n\t\tif err != nil {\n\t\t\tmessage = \"Restore failed\"\n\t\t} else {\n\t\t\tmessage = \"Task restored\"\n\t\t}\n\t\thttp.Redirect(w, r, \"/deleted/\", http.StatusFound)\n\t}\n\n}", "func Recover(yes bool) GroupOption {\n\treturn func(g *Group) {\n\t\tg.recover = yes\n\t}\n}", "func (ctl Controller) Restore(name string) *pitr.Error {\n\terr := ctl.cluster.Stop()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = ctl.cluster.Clear()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstdout, stderr, runErr := ctl.runner.Run(\"sudo --login --user postgres wal-g backup-fetch %s %s\", ctl.cluster.DataDirectory(), name)\n\n\tif runErr != nil {\n\t\treturn &pitr.Error{\n\t\t\tMessage: runErr.Error(),\n\t\t\tStdout: stdout,\n\t\t\tStderr: stderr,\n\t\t}\n\t}\n\n\tctl.createRecoveryConf(`restore_command = 'bash --login -c \\\"wal-g wal-fetch %f %p\\\"'`)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = ctl.cluster.Start()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *Consumer) RebalanceTaskProgress() *cm.RebalanceProgress {\n\tlogPrefix := \"Consumer::RebalanceTaskProgress\"\n\n\tprogress := &cm.RebalanceProgress{}\n\n\tvbsRemainingToCloseStream := c.getVbRemainingToCloseStream()\n\tvbsRemainingToStreamReq := c.getVbRemainingToStreamReq()\n\n\tlogging.Infof(\"%s [%s:%s:%d] vbsRemainingToCloseStream len: %d dump: %v vbsRemainingToStreamReq len: %d dump: %v\",\n\t\tlogPrefix, c.workerName, c.tcpPort, c.Pid(), len(vbsRemainingToCloseStream),\n\t\tutil.Condense(vbsRemainingToCloseStream), len(vbsRemainingToStreamReq),\n\t\tutil.Condense(vbsRemainingToStreamReq))\n\n\tif len(vbsRemainingToCloseStream) > 0 || len(vbsRemainingToStreamReq) > 0 {\n\t\tvbsOwnedPerPlan := c.getVbsOwned()\n\n\t\tprogress.CloseStreamVbsLen = len(vbsRemainingToCloseStream)\n\t\tprogress.StreamReqVbsLen = len(vbsRemainingToStreamReq)\n\n\t\tprogress.VbsOwnedPerPlan = len(vbsOwnedPerPlan)\n\t\tprogress.VbsRemainingToShuffle = len(vbsRemainingToCloseStream) + len(vbsRemainingToStreamReq)\n\t}\n\n\tif len(vbsRemainingToCloseStream) == 0 && len(vbsRemainingToStreamReq) == 0 && c.vbsStateUpdateRunning {\n\t\tc.isRebalanceOngoing = false\n\t\tlogging.Infof(\"%s [%s:%s:%d] Updated isRebalanceOngoing to %t\",\n\t\t\tlogPrefix, c.workerName, c.tcpPort, c.Pid(), c.isRebalanceOngoing)\n\t}\n\n\treturn progress\n}", "func (suite *TaskFailRetryTestSuite) TestTaskFailRetry() {\n\ttaskConfig := pbtask.TaskConfig{\n\t\tRestartPolicy: &pbtask.RestartPolicy{\n\t\t\tMaxFailures: 3,\n\t\t},\n\t}\n\n\tsuite.cachedTask.EXPECT().\n\t\tID().\n\t\tReturn(uint32(0)).\n\t\tAnyTimes()\n\n\tsuite.jobFactory.EXPECT().\n\t\tGetJob(suite.jobID).Return(suite.cachedJob)\n\n\tsuite.cachedJob.EXPECT().\n\t\tGetTask(suite.instanceID).Return(suite.cachedTask)\n\n\tsuite.cachedJob.EXPECT().\n\t\tID().Return(suite.jobID)\n\n\tsuite.cachedTask.EXPECT().\n\t\tGetRuntime(gomock.Any()).Return(suite.taskRuntime, nil)\n\n\tsuite.taskConfigV2Ops.EXPECT().\n\t\tGetTaskConfig(gomock.Any(), suite.jobID, suite.instanceID, gomock.Any()).\n\t\tReturn(&taskConfig, &models.ConfigAddOn{}, nil)\n\n\tsuite.cachedJob.EXPECT().\n\t\tPatchTasks(gomock.Any(), gomock.Any(), false).\n\t\tDo(func(ctx context.Context,\n\t\t\truntimeDiffs map[uint32]jobmgrcommon.RuntimeDiff,\n\t\t\t_ bool) {\n\t\t\truntimeDiff := runtimeDiffs[suite.instanceID]\n\t\t\tsuite.True(\n\t\t\t\truntimeDiff[jobmgrcommon.MesosTaskIDField].(*mesosv1.TaskID).GetValue() != suite.mesosTaskID)\n\t\t\tsuite.True(\n\t\t\t\truntimeDiff[jobmgrcommon.PrevMesosTaskIDField].(*mesosv1.TaskID).GetValue() == suite.mesosTaskID)\n\t\t\tsuite.True(\n\t\t\t\truntimeDiff[jobmgrcommon.StateField].(pbtask.TaskState) == pbtask.TaskState_INITIALIZED)\n\t\t}).Return(nil, nil, nil)\n\n\tsuite.cachedJob.EXPECT().\n\t\tGetJobType().Return(pbjob.JobType_BATCH)\n\n\tsuite.taskGoalStateEngine.EXPECT().\n\t\tEnqueue(gomock.Any(), gomock.Any()).\n\t\tReturn()\n\n\tsuite.jobGoalStateEngine.EXPECT().\n\t\tEnqueue(gomock.Any(), gomock.Any()).\n\t\tReturn()\n\n\terr := TaskFailRetry(context.Background(), suite.taskEnt)\n\tsuite.NoError(err)\n}", "func (s *OnDiskStateMachine) RecoverFromSnapshot(r io.Reader,\n\tfs []sm.SnapshotFile, stopc <-chan struct{}) error {\n\tif !s.opened {\n\t\tpanic(\"RecoverFromSnapshot called when not opened\")\n\t}\n\t/*\n\t\trollback := ss.Imported && init\n\t\tif !rollback {\n\t\t\tif ss.StateMachineIndex <= s.index {\n\t\t\t\tplog.Panicf(\"recover snapshot moving applied index backwards, %d, %d\",\n\t\t\t\t\tss.StateMachineIndex, s.index)\n\t\t\t}\n\t\t} else {\n\t\t\ts.initialIndex = ss.StateMachineIndex\n\t\t}\n\t\ts.index = ss.StateMachineIndex\n\t*/\n\treturn s.sm.RecoverFromSnapshot(r, stopc)\n}", "func ReturnIDCNodeToResourcePoolTask(taskID, stepName string) error {\n\tstart := time.Now()\n\n\t// get task and task current step\n\tstate, step, err := cloudprovider.GetTaskStateAndCurrentStep(taskID, stepName)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// previous step successful when retry task\n\tif step == nil {\n\t\tblog.Infof(\"ReturnIDCNodeToResourcePoolTask[%s]: current step[%s] successful and skip\", taskID, stepName)\n\t\treturn nil\n\t}\n\tblog.Infof(\"ReturnIDCNodeToResourcePoolTask[%s] task %s run step %s, system: %s, old state: %s, params %v\",\n\t\ttaskID, taskID, stepName, step.System, step.Status, step.Params)\n\n\t// extract valid parameter\n\tclusterID := step.Params[cloudprovider.ClusterIDKey.String()]\n\tnodeGroupID := step.Params[cloudprovider.NodeGroupIDKey.String()]\n\tcloudID := step.Params[cloudprovider.CloudIDKey.String()]\n\n\toperator := step.Params[cloudprovider.OperatorKey.String()]\n\tnodeIPList := cloudprovider.ParseNodeIpOrIdFromCommonMap(step.Params, cloudprovider.NodeIPsKey.String(), \",\")\n\tdeviceList := cloudprovider.ParseNodeIpOrIdFromCommonMap(step.Params, cloudprovider.DeviceIDsKey.String(), \",\")\n\n\tdependInfo, err := cloudprovider.GetClusterDependBasicInfo(cloudprovider.GetBasicInfoReq{\n\t\tClusterID: clusterID,\n\t\tCloudID: cloudID,\n\t\tNodeGroupID: nodeGroupID,\n\t})\n\tif err != nil {\n\t\tblog.Errorf(\"ReturnIDCNodeToResourcePoolTask[%s] GetClusterDependBasicInfo for NodeGroup %s to clean Node in task %s \"+\n\t\t\t\"step %s failed, %s\", taskID, nodeGroupID, taskID, stepName, err.Error())\n\t\tretErr := fmt.Errorf(\"get cloud/project information failed, %s\", err.Error())\n\t\t_ = state.UpdateStepFailure(start, stepName, retErr)\n\t\treturn retErr\n\t}\n\n\t// inject taskID\n\tctx := cloudprovider.WithTaskIDForContext(context.Background(), taskID)\n\n\t// return IDC device to resource-manager\n\torderID, err := destroyIDCDeviceList(ctx, dependInfo, deviceList, operator)\n\tif err != nil {\n\t\tblog.Errorf(\"ReturnIDCNodeToResourcePoolTask[%s] destroyIDCDeviceList[%v] from NodeGroup %s failed: %v\",\n\t\t\ttaskID, nodeIPList, nodeGroupID, err.Error())\n\t\t_ = state.UpdateStepFailure(start, stepName, err)\n\t\treturn fmt.Errorf(\"ReturnIDCNodeToResourcePoolTask destroyIDCDeviceList failed %s\", err.Error())\n\t}\n\n\t// update response information to task common params\n\tif state.Task.CommonParams == nil {\n\t\tstate.Task.CommonParams = make(map[string]string)\n\t}\n\tstate.Task.CommonParams[cloudprovider.OrderIDKey.String()] = orderID\n\n\t// update step\n\tif err := state.UpdateStepSucc(start, stepName); err != nil {\n\t\tblog.Errorf(\"task %s %s update to storage fatal\", taskID, stepName)\n\t\treturn err\n\t}\n\treturn nil\n}", "func panicRecover(input *models.RunningInput) {\n\tif err := recover(); err != nil {\n\t\ttrace := make([]byte, 2048)\n\t\truntime.Stack(trace, true)\n\t\tlog.Printf(\"E! FATAL: [%s] panicked: %s, Stack:\\n%s\",\n\t\t\tinput.LogName(), err, trace)\n\t\tlog.Println(\"E! PLEASE REPORT THIS PANIC ON GITHUB with \" +\n\t\t\t\"stack trace, configuration, and OS information: \" +\n\t\t\t\"https://github.com/influxdata/telegraf/issues/new/choose\")\n\t}\n}", "func Recoverer() {\n\tdebug := DebugMode()\n\tif r := recover(); r != nil {\n\t\tlog.Criticalf(\"PANIC: %s\", r)\n\t\tif debug {\n\t\t\tpanic(r)\n\t\t} else {\n\t\t\tlog.Info(\"Hint: For debug info, please set \\\"NMZ_DEBUG\\\" to 1.\")\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n}", "func CheckRecurredTaskBegin(name string) error {\n\tlastRc := NewResultContainer()\n\terr := lastRc.LoadLatest()\n\tif err != nil {\n\t\tif lastRc == nil {\n\t\t\tnegativeCheck(\"internal error\")\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlastBegin, err := persistence.GetLastBegin(name)\n\tif err != nil {\n\t\tnegativeCheck(\"internal error\")\n\t\treturn err\n\t}\n\n\tres := lastRc.Get(name)\n\tif res.IntervalAvg < 1 {\n\t\treturn nil\n\t\t//no interval data\n\t}\n\n\tif time.Now().Sub(lastBegin.Time) > (res.IntervalAvg+res.IntervalStdDev) && alertBlocker.IsUnknown(name, \"not recurred\") {\n\t\tmsg := `Task \"` + name + `\" has not recurred in time`\n\t\tidl.Err(msg, lastBegin)\n\t\tnegativeCheck(msg)\n\t\talertBlocker.Occurred(name, \"not recurred\")\n\t}\n\n\treturn nil\n}", "func (d *dispatcher) monitorTask(taskID int64) (finished bool, subTaskErrs []error) {\n\t// TODO: Consider putting the following operations into a transaction.\n\tvar err error\n\td.task, err = d.taskMgr.GetGlobalTaskByID(taskID)\n\tif err != nil {\n\t\tlogutil.BgLogger().Error(\"check task failed\", zap.Int64(\"task ID\", d.task.ID), zap.Error(err))\n\t\treturn false, nil\n\t}\n\tswitch d.task.State {\n\tcase proto.TaskStateCancelling:\n\t\treturn false, []error{errors.New(\"cancel\")}\n\tcase proto.TaskStateReverting:\n\t\tcnt, err := d.taskMgr.GetSubtaskInStatesCnt(d.task.ID, proto.TaskStateRevertPending, proto.TaskStateReverting)\n\t\tif err != nil {\n\t\t\tlogutil.BgLogger().Warn(\"check task failed\", zap.Int64(\"task ID\", d.task.ID), zap.Error(err))\n\t\t\treturn false, nil\n\t\t}\n\t\treturn cnt == 0, nil\n\tdefault:\n\t\tsubTaskErrs, err = d.taskMgr.CollectSubTaskError(d.task.ID)\n\t\tif err != nil {\n\t\t\tlogutil.BgLogger().Warn(\"collect subtask error failed\", zap.Int64(\"task ID\", d.task.ID), zap.Error(err))\n\t\t\treturn false, nil\n\t\t}\n\t\tif len(subTaskErrs) > 0 {\n\t\t\treturn false, subTaskErrs\n\t\t}\n\t\t// check subtasks pending or running.\n\t\tcnt, err := d.taskMgr.GetSubtaskInStatesCnt(d.task.ID, proto.TaskStatePending, proto.TaskStateRunning)\n\t\tif err != nil {\n\t\t\tlogutil.BgLogger().Warn(\"check task failed\", zap.Int64(\"task ID\", d.task.ID), zap.Error(err))\n\t\t\treturn false, nil\n\t\t}\n\t\treturn cnt == 0, nil\n\t}\n}", "func Recover(files []string) {\n\t//gurantee the time sequence is in right ordered\n\tsort.Slice(files, func(i, j int) bool {\n\t\treturn files[i] < files[j]\n\t})\n\n\t//read log items and recover them into DataItem\n\tdataJson := make([]logger.DataItem, 0)\n\tfor _, filename := range files {\n\t\tfile, err := os.Open(filename)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"file can't open\")\n\t\t}\n\n\t\tcontent, err := ioutil.ReadAll(file)\n\t\tif err != nil {\n\t\t\tlog.Println(\"file can't read\")\n\t\t}\n\n\t\titems := strings.Split(string(content), \"\\r\\n\")\n\t\tfor _, jsonitem := range items {\n\t\t\tdata := logger.DataItem{}\n\n\t\t\terr = json.Unmarshal([]byte(jsonitem), &data)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"unmarshal some data fail\")\n\t\t\t}\n\n\t\t\tdataJson = append(dataJson, data)\n\t\t}\n\t}\n\n\t//recover the dataset status\n\tfor _, data := range dataJson {\n\t\tif data.Commandtype == logger.SET {\n\t\t\tnow := time.Now().Unix()\n\t\t\tif now < data.Expire {\n\t\t\t\tstore.SetValue(data.Key, data.Value, time.Duration(data.Expire-now))\n\t\t\t}\n\t\t}\n\t}\n}", "func asyncRestart(ctx context.Context, logger hclog.Logger, task WorkloadRestarter, event *structs.TaskEvent) {\n\t// Check watcher restarts are always failures\n\tconst failure = true\n\n\t// Restarting is asynchronous so there's no reason to allow this\n\t// goroutine to block indefinitely.\n\tctx, cancel := context.WithTimeout(ctx, 10*time.Second)\n\tdefer cancel()\n\n\tif err := task.Restart(ctx, event, failure); err != nil {\n\t\t// Restart errors are not actionable and only relevant when\n\t\t// debugging allocation lifecycle management.\n\t\tlogger.Debug(\"failed to restart task\", \"error\", err, \"event_time\", event.Time, \"event_type\", event.Type)\n\t}\n}", "func (r *ReconcileAerospikeCluster) recoverFailedCreate(aeroCluster *aerospikev1alpha1.AerospikeCluster) error {\n\tlogger := pkglog.New(log.Ctx{\"AerospikeCluster\": utils.ClusterNamespacedName(aeroCluster)})\n\tlogger.Info(\"Forcing a cluster recreate as status is nil. The cluster could be unreachable due to bad configuration.\")\n\n\t// Delete all statefulsets and everything related so that it can be properly created and updated in next run.\n\tstatefulSetList, err := r.getClusterStatefulSets(aeroCluster)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error getting statefulsets while forcing recreate of the cluster as status is nil: %v\", err)\n\t}\n\n\tlogger.Debug(\"Found statefulset for cluster. Need to delete them\", log.Ctx{\"nSTS\": len(statefulSetList.Items)})\n\tfor _, statefulset := range statefulSetList.Items {\n\t\tif err := r.deleteStatefulSet(aeroCluster, &statefulset); err != nil {\n\t\t\treturn fmt.Errorf(\"Error deleting statefulset while forcing recreate of the cluster as status is nil: %v\", err)\n\t\t}\n\t}\n\n\t// Clear pod status as well in status since we want to be re-initializing or cascade deleting devices if any.\n\t// This is not necessary since scale-up would cleanup danglin pod status. However done here for general\n\t// cleanliness.\n\trackStateList := getNewRackStateList(aeroCluster)\n\tfor _, state := range rackStateList {\n\t\tpods, err := r.getRackPodList(aeroCluster, state.Rack.ID)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed recover failed cluster: %v\", err)\n\t\t}\n\n\t\tnewPodNames := []string{}\n\t\tfor i := 0; i < len(pods.Items); i++ {\n\t\t\tnewPodNames = append(newPodNames, pods.Items[i].Name)\n\t\t}\n\n\t\terr = r.cleanupPods(aeroCluster, newPodNames, state)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed recover failed cluster: %v\", err)\n\t\t}\n\t}\n\n\treturn fmt.Errorf(\"Forcing recreate of the cluster as status is nil\")\n}", "func (_DelegatableDai *DelegatableDaiCallerSession) Recover(hash [32]byte, sig []byte) (common.Address, error) {\n\treturn _DelegatableDai.Contract.Recover(&_DelegatableDai.CallOpts, hash, sig)\n}", "func Recover() *PanicError {\n\terr := recover()\n\tif err != nil {\n\t\treturn &PanicError{err}\n\t}\n\treturn nil\n}", "func (*FakeReconcilerClient) GetTask(string) (swarm.Task, error) {\n\treturn swarm.Task{}, FakeUnimplemented\n}", "func (dyn *Dynamo) checkAndExitRecoveryMode() {\n\tdyn.logger.Info(\"Starting background task for exiting recovery mode\")\n\n\t// block indefinitely while the node is initializing\n\tfor dyn.isInitializing {\n\t\tdyn.logger.Debug(\"Delaying exiting recovery mode while initializing\")\n\t\ttime.Sleep(time.Second * 3)\n\t}\n\n\tfor {\n\t\tdyn.recoveryLock.RLock()\n\t\trecovering := dyn.inRecovery\n\t\tlastWrite := dyn.lastRecoveryTimestamp\n\t\tdyn.recoveryLock.RUnlock()\n\n\t\tif recovering {\n\t\t\tif time.Since(lastWrite) >= (time.Second * time.Duration(dyn.cfg.RecoveryGracePeriod)) {\n\t\t\t\tdyn.logger.Debug(\"Exiting recovery mode\")\n\t\t\t\tdyn.recoveryLock.Lock()\n\t\t\t\tdyn.inRecovery = false\n\t\t\t\tdyn.recoveryLock.Unlock()\n\t\t\t}\n\t\t}\n\n\t\tdyn.logger.Debug(\"Sleeping for checking recovery mode\", zap.Int(\"time\", dyn.cfg.RecoveryGracePeriod))\n\t\ttime.Sleep(time.Second * time.Duration(dyn.cfg.RecoveryGracePeriod))\n\t}\n}", "func (suite *TaskFailRetryTestSuite) TestTaskFailNoRetry() {\n\n\ttaskConfig := pbtask.TaskConfig{\n\t\tRestartPolicy: &pbtask.RestartPolicy{\n\t\t\tMaxFailures: 0,\n\t\t},\n\t}\n\n\tsuite.jobFactory.EXPECT().\n\t\tGetJob(suite.jobID).Return(suite.cachedJob)\n\n\tsuite.cachedJob.EXPECT().\n\t\tGetTask(suite.instanceID).Return(suite.cachedTask)\n\n\tsuite.cachedTask.EXPECT().\n\t\tGetRuntime(gomock.Any()).Return(suite.taskRuntime, nil)\n\n\tsuite.taskConfigV2Ops.EXPECT().\n\t\tGetTaskConfig(gomock.Any(), suite.jobID, suite.instanceID, gomock.Any()).\n\t\tReturn(&taskConfig, &models.ConfigAddOn{}, nil)\n\n\terr := TaskFailRetry(context.Background(), suite.taskEnt)\n\tsuite.NoError(err)\n}", "func deleteTasks() {\n\tcounter := 0\n\n\t// Create AWS session\n\ts, err := session.NewSession()\n\tif err != nil {\n\t\tlog.Fatal(\"Couldn't create AWS Session.\")\n\t}\n\n\t// Create the AWS Service\n\tsvc := databasemigrationservice.New(s, &aws.Config{Region: &region})\n\n\t// Read the defaults file\n\treadTasks, err := ioutil.ReadFile(tasksFile)\n\tif err != nil {\n\t\tlog.Fatal(\"Couldn't read file \"+tasksFile, err)\n\t}\n\n\t// Create tasks and unmarshal the JSON\n\ttasks := new([]ReplicationTask)\n\tremainingTasks := new([]ReplicationTask) // Tasks that will be saved (if they couldn't be removed for example)\n\terr = json.Unmarshal(readTasks, tasks)\n\tif err != nil {\n\t\tlog.Fatal(\"Couldn't JSON unmarshal file \"+tasksFile, err)\n\t}\n\n\t// Start all the tasks stored in tasks\n\tfor _, task := range *tasks {\n\t\tparams := &databasemigrationservice.DeleteReplicationTaskInput{\n\t\t\tReplicationTaskArn: aws.String(task.ReplicationTaskArn),\n\t\t}\n\n\t\t_, err := svc.DeleteReplicationTask(params)\n\t\tif err != nil {\n\t\t\t// If the task doesn't exists we shouldn't keep it in the tasks.json file - just continue\n\t\t\tif strings.Contains(err.Error(), notFound) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// If the task errored and not because it doesn't exists, keep it in the tasks.json file\n\t\t\t*remainingTasks = append(*remainingTasks, task)\n\n\t\t\t// Go through the different statuses that might have made the action failed\n\t\t\tswitch {\n\t\t\tcase strings.Contains(err.Error(), isRunning):\n\t\t\t\tfmt.Println(\"Please stop task\", task.ReplicationTaskIdentifier, stopBeforeDeleting)\n\t\t\t\tcontinue\n\t\t\tcase strings.Contains(err.Error(), \"is currently being stopped\"):\n\t\t\t\tfmt.Println(\"Please wait until task\", task.ReplicationTaskIdentifier, waitForStop)\n\t\t\t\tcontinue\n\t\t\tcase strings.Contains(err.Error(), \"is already being deleted\"):\n\t\t\t\tfmt.Println(\"Task\", task.ReplicationTaskIdentifier, beingDeleted)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfmt.Println(\"Couldn't delete Replication Task\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tcounter++\n\t\tfmt.Println(\"Task deleted: \" + task.ReplicationTaskIdentifier)\n\t}\n\n\t// If we have no tasks left, delete the whole file\n\tswitch {\n\tcase len(*remainingTasks) == 0:\n\t\terr := os.Remove(tasksFile)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Couldn't remove tasks files\", err)\n\t\t}\n\n\tdefault:\n\t\t// Write remaining tasks to tasks-file\n\t\twriteTaskFile(remainingTasks)\n\t}\n\n\tfmt.Println(\"\\nDONE! Deleted\", counter, \"tasks.\")\n}", "func StartDMTask(fw portforward.PortForward, ns, masterSvcName, taskConf, errSubStr string) error {\n\tapiPath := \"/apis/v1alpha1/tasks\"\n\n\ttype Req struct {\n\t\tTask string `json:\"task\"`\n\t}\n\ttype Resp struct {\n\t\tResult bool `json:\"result\"`\n\t\tMsg string `json:\"msg\"`\n\t\tCheckResult string `json:\"checkResult\"`\n\t}\n\n\tvar req = Req{\n\t\tTask: fmt.Sprintf(taskConf, DMTaskName(ns), v1alpha1.DefaultTiDBServerPort, DMTaskName(ns)),\n\t}\n\tdata, err := json.Marshal(req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to marshal task start request, %v, %v\", req, err)\n\t}\n\n\treturn wait.Poll(5*time.Second, time.Minute, func() (bool, error) {\n\t\tlocalHost, localPort, cancel, err := portforward.ForwardOnePort(\n\t\t\tfw, ns, fmt.Sprintf(\"svc/%s\", masterSvcName), dmMasterSvcPort)\n\t\tif err != nil {\n\t\t\tlog.Logf(\"failed to forward dm-master svc: %v\", err)\n\t\t\treturn false, nil\n\t\t}\n\t\tdefer cancel()\n\n\t\tbody, err := httputil.DoBodyOK(\n\t\t\t&http.Client{Transport: &http.Transport{}},\n\t\t\tfmt.Sprintf(\"http://%s:%d%s\", localHost, localPort, apiPath),\n\t\t\t\"POST\",\n\t\t\tbytes.NewReader(data))\n\t\tif err != nil {\n\t\t\tlog.Logf(\"failed to start DM task: %v\", err)\n\t\t\treturn false, nil\n\t\t}\n\t\tvar resp Resp\n\t\tif err = json.Unmarshal(body, &resp); err != nil {\n\t\t\tlog.Logf(\"failed to unmarshal DM task start response, %s: %v\", string(body), err)\n\t\t\treturn false, nil\n\t\t} else if !resp.Result && !strings.Contains(resp.Msg, \"already exists\") {\n\t\t\tif errSubStr != \"\" && strings.Contains(resp.Msg, errSubStr) {\n\t\t\t\tlog.Logf(\"start DM task match the error sub string %q: %s\", errSubStr, resp.Msg)\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\tlog.Logf(\"failed to start DM task, msg: %s, err: %v, checkResult: %s\", resp.Msg, err, resp.CheckResult)\n\t\t\treturn false, nil\n\t\t}\n\t\treturn true, nil\n\t})\n}" ]
[ "0.58838654", "0.5342246", "0.4967397", "0.49165246", "0.48566574", "0.48527366", "0.48488343", "0.4843941", "0.48418212", "0.4827211", "0.481903", "0.47926974", "0.47663003", "0.47648853", "0.47385824", "0.47373864", "0.47090328", "0.47073582", "0.4702934", "0.46741527", "0.46718264", "0.46462384", "0.46432397", "0.4636801", "0.4632619", "0.4632619", "0.46323818", "0.46107763", "0.46076995", "0.46048504", "0.45881578", "0.455844", "0.45480078", "0.45334917", "0.45299217", "0.45278898", "0.4523431", "0.44760266", "0.44696766", "0.44650427", "0.44616526", "0.44594097", "0.4457134", "0.44409773", "0.44336438", "0.44282997", "0.44252503", "0.4416343", "0.44075814", "0.44045067", "0.43794793", "0.43758187", "0.4372764", "0.4367623", "0.43644828", "0.43626356", "0.43547988", "0.43495053", "0.43439603", "0.4343559", "0.4343055", "0.4335428", "0.43221122", "0.43211946", "0.43204084", "0.4314417", "0.4309435", "0.43087482", "0.43062946", "0.429755", "0.42945042", "0.42938656", "0.42904478", "0.42862546", "0.4281773", "0.42770818", "0.42734993", "0.42720345", "0.42702156", "0.4270006", "0.4262931", "0.42459667", "0.42420658", "0.4241359", "0.42351967", "0.42289576", "0.4224809", "0.42239574", "0.4219015", "0.42189053", "0.42152694", "0.4213842", "0.42100412", "0.42050502", "0.41974622", "0.41872245", "0.41734666", "0.41713476", "0.4167909", "0.41650474" ]
0.7950789
0
BuildContainerName returns the podman container name for a given TaskConfig
BuildContainerName возвращает имя контейнера podman для заданной TaskConfig
func BuildContainerName(cfg *drivers.TaskConfig) string { return fmt.Sprintf("%s-%s", cfg.Name, cfg.AllocID) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (e *dockerExec) containerName() string {\n\tpathHex := reflow.Digester.FromString(e.path()).Short()\n\treturn fmt.Sprintf(\"reflow-%s-%s-%s\", e.Executor.ID, e.id.Hex(), pathHex)\n}", "func (o ClusterBuildStrategySpecBuildStepsEnvValueFromResourceFieldRefOutput) ContainerName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildStepsEnvValueFromResourceFieldRef) *string { return v.ContainerName }).(pulumi.StringPtrOutput)\n}", "func (o ClusterBuildStrategySpecBuildStepsEnvValueFromResourceFieldRefPtrOutput) ContainerName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ClusterBuildStrategySpecBuildStepsEnvValueFromResourceFieldRef) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ContainerName\n\t}).(pulumi.StringPtrOutput)\n}", "func makeContainerName(c *runtime.ContainerMetadata, s *runtime.PodSandboxMetadata) string {\n\treturn strings.Join([]string{\n\t\tc.Name, // 0\n\t\ts.Name, // 1: sandbox name\n\t\ts.Namespace, // 2: sandbox namespace\n\t\ts.Uid, // 3: sandbox uid\n\t\tfmt.Sprintf(\"%d\", c.Attempt), // 4\n\t}, nameDelimiter)\n}", "func (o BuildStrategySpecBuildStepsEnvValueFromResourceFieldRefOutput) ContainerName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BuildStrategySpecBuildStepsEnvValueFromResourceFieldRef) *string { return v.ContainerName }).(pulumi.StringPtrOutput)\n}", "func (s Service) ContainerName() string {\n\treturn fmt.Sprintf(\"coz_neo-local_%s\", s.Image)\n}", "func (n *natsDependency) GetContainerName() string {\n\treturn n.config.Name + n.config.Version\n}", "func (o BuildStrategySpecBuildStepsEnvValueFromResourceFieldRefPtrOutput) ContainerName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BuildStrategySpecBuildStepsEnvValueFromResourceFieldRef) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ContainerName\n\t}).(pulumi.StringPtrOutput)\n}", "func (o VirtualDatabaseSpecBuildEnvValueFromResourceFieldRefOutput) ContainerName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v VirtualDatabaseSpecBuildEnvValueFromResourceFieldRef) *string { return v.ContainerName }).(pulumi.StringPtrOutput)\n}", "func (o VirtualDatabaseSpecBuildEnvValueFromResourceFieldRefPtrOutput) ContainerName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *VirtualDatabaseSpecBuildEnvValueFromResourceFieldRef) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ContainerName\n\t}).(pulumi.StringPtrOutput)\n}", "func (e *localExocomDependency) GetContainerName() string {\n\treturn e.config.Name + e.config.Version\n}", "func (cni *ContrailCni) buildContainerIntfName(\n index int, isMetaPlugin bool) string {\n var intfName string\n if isMetaPlugin == true {\n intfName = cni.cniArgs.IfName\n } else {\n intfName = VIF_TYPE_ETH + strconv.Itoa(index)\n }\n log.Infof(\"Built container interface name - %s\", intfName)\n return intfName\n}", "func (o VirtualDatabaseSpecEnvValueFromResourceFieldRefOutput) ContainerName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v VirtualDatabaseSpecEnvValueFromResourceFieldRef) *string { return v.ContainerName }).(pulumi.StringPtrOutput)\n}", "func MakePodName(jobName string, taskName string, index int) string {\n\treturn fmt.Sprintf(jobhelpers.PodNameFmt, jobName, taskName, index)\n}", "func containerNameFromSpec(debugger string) string {\n\tcontainerVariant := \"gdb\"\n\tif debugger == \"dlv\" {\n\t\tcontainerVariant = \"dlv\"\n\t}\n\treturn fmt.Sprintf(\"%v-%v\", sqOpts.ParticularContainerRootName, containerVariant)\n}", "func (o IopingSpecVolumeVolumeSourceProjectedSourcesDownwardAPIItemsResourceFieldRefOutput) ContainerName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceProjectedSourcesDownwardAPIItemsResourceFieldRef) *string {\n\t\treturn v.ContainerName\n\t}).(pulumi.StringPtrOutput)\n}", "func (c *ContainerConfigMapSpec) GetName() string {\n\tsuffix := fmt.Sprintf(\"%s-%s\", c.ContainerName, c.Subdir)\n\treturn util.PrefixConfigmap(c.qserv, suffix)\n}", "func containerIfName(container garden.Container) string {\n\treturn ifNamePrefix(container) + \"-1\"\n}", "func (o IopingSpecVolumeVolumeSourceProjectedSourcesDownwardAPIItemsResourceFieldRefPtrOutput) ContainerName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *IopingSpecVolumeVolumeSourceProjectedSourcesDownwardAPIItemsResourceFieldRef) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ContainerName\n\t}).(pulumi.StringPtrOutput)\n}", "func (o FioSpecVolumeVolumeSourceProjectedSourcesDownwardAPIItemsResourceFieldRefOutput) ContainerName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceProjectedSourcesDownwardAPIItemsResourceFieldRef) *string {\n\t\treturn v.ContainerName\n\t}).(pulumi.StringPtrOutput)\n}", "func (m *TestcontainersModule) ContainerName() string {\n\tname := m.Lower()\n\n\tif m.IsModule {\n\t\tname = m.Title()\n\t} else {\n\t\tif m.TitleName != \"\" {\n\t\t\tr, n := utf8.DecodeRuneInString(m.TitleName)\n\t\t\tname = string(unicode.ToLower(r)) + m.TitleName[n:]\n\t\t}\n\t}\n\n\treturn name + \"Container\"\n}", "func machineContainerName(cluster, machine string) string {\n\tif strings.HasPrefix(machine, cluster) {\n\t\treturn machine\n\t}\n\treturn fmt.Sprintf(\"%s-%s\", cluster, machine)\n}", "func (o IopingSpecVolumeVolumeSourceDownwardAPIItemsResourceFieldRefOutput) ContainerName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceDownwardAPIItemsResourceFieldRef) *string { return v.ContainerName }).(pulumi.StringPtrOutput)\n}", "func (o GetAppTemplateContainerOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetAppTemplateContainer) string { return v.Name }).(pulumi.StringOutput)\n}", "func (j SubmittedJob) ContainerName() string {\n\tvar nameFragment string\n\tif j.Name != nil {\n\t\tnameFragment = *j.Name\n\t} else {\n\t\tnameFragment = \"unnamed\"\n\t}\n\n\treturn fmt.Sprintf(\"job_%d_%s\", j.JID, nameFragment)\n}", "func createVolumeUnitContainerName(t *jobs.Task, volIndex int, scalingGroup uint) string {\n\treturn fmt.Sprintf(\"%s-vl%d\", t.ContainerName(scalingGroup), volIndex)\n}", "func (o VirtualDatabaseSpecEnvValueFromResourceFieldRefPtrOutput) ContainerName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *VirtualDatabaseSpecEnvValueFromResourceFieldRef) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ContainerName\n\t}).(pulumi.StringPtrOutput)\n}", "func (o VirtualDatabaseSpecDatasourcesPropertiesValueFromResourceFieldRefOutput) ContainerName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v VirtualDatabaseSpecDatasourcesPropertiesValueFromResourceFieldRef) *string {\n\t\treturn v.ContainerName\n\t}).(pulumi.StringPtrOutput)\n}", "func (o IopingSpecVolumeVolumeSourceDownwardAPIItemsResourceFieldRefPtrOutput) ContainerName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *IopingSpecVolumeVolumeSourceDownwardAPIItemsResourceFieldRef) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ContainerName\n\t}).(pulumi.StringPtrOutput)\n}", "func (p *DockerPod) GetContainerByName(name string) *container.BcsContainerInfo {\n\tif info, ok := p.conTasks[name]; ok {\n\t\treturn info.RuntimeConf\n\t}\n\treturn nil\n}", "func (o FioSpecVolumeVolumeSourceDownwardAPIItemsResourceFieldRefOutput) ContainerName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceDownwardAPIItemsResourceFieldRef) *string { return v.ContainerName }).(pulumi.StringPtrOutput)\n}", "func BuildAtlantisProjectNameFromComponentConfig(\n\tcliConfig schema.CliConfiguration,\n\tcomponentName string,\n\tcomponentSettingsSection map[any]any,\n\tcomponentVarsSection map[any]any,\n) (string, error) {\n\n\tvar atlantisProjectTemplate schema.AtlantisProjectConfig\n\tvar atlantisProjectName string\n\n\tif atlantisSettingsSection, ok := componentSettingsSection[\"atlantis\"].(map[any]any); ok {\n\t\t// 'settings.atlantis.project_template' has higher priority than 'settings.atlantis.project_template_name'\n\t\tif atlantisSettingsProjectTemplate, ok := atlantisSettingsSection[\"project_template\"].(map[any]any); ok {\n\t\t\terr := mapstructure.Decode(atlantisSettingsProjectTemplate, &atlantisProjectTemplate)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t} else if atlantisSettingsProjectTemplateName, ok := atlantisSettingsSection[\"project_template_name\"].(string); ok && atlantisSettingsProjectTemplateName != \"\" {\n\t\t\tif pt, ok := cliConfig.Integrations.Atlantis.ProjectTemplates[atlantisSettingsProjectTemplateName]; ok {\n\t\t\t\tatlantisProjectTemplate = pt\n\t\t\t}\n\t\t}\n\n\t\tcontext := cfg.GetContextFromVars(componentVarsSection)\n\t\tcontext.Component = strings.Replace(componentName, \"/\", \"-\", -1)\n\n\t\t// If Atlantis project template is defined and has a name, replace tokens in the name and add the Atlantis project to the output\n\t\tif !reflect.ValueOf(atlantisProjectTemplate).IsZero() && atlantisProjectTemplate.Name != \"\" {\n\t\t\tatlantisProjectName = BuildAtlantisProjectName(context, atlantisProjectTemplate.Name)\n\t\t}\n\t}\n\n\treturn atlantisProjectName, nil\n}", "func (c *Container) Name() string {\n\treturn c.config.Name\n}", "func (e *dockerExec) Name() string {\n\treturn e.containerName()\n}", "func (cfg *Config) PodName(nodeName string, id string) string {\n\tnameParts := strings.Split(nodeName, \".\")\n\tpodName := fmt.Sprintf(\"%s-job-%s-%s\", cfg.Name, nameParts[0], id)\n\treturn podName\n}", "func (o FioSpecVolumeVolumeSourceProjectedSourcesDownwardAPIItemsResourceFieldRefPtrOutput) ContainerName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *FioSpecVolumeVolumeSourceProjectedSourcesDownwardAPIItemsResourceFieldRef) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ContainerName\n\t}).(pulumi.StringPtrOutput)\n}", "func (o GetAppTemplateContainerEnvOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetAppTemplateContainerEnv) string { return v.Name }).(pulumi.StringOutput)\n}", "func (o VirtualDatabaseSpecDatasourcesPropertiesValueFromResourceFieldRefPtrOutput) ContainerName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *VirtualDatabaseSpecDatasourcesPropertiesValueFromResourceFieldRef) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ContainerName\n\t}).(pulumi.StringPtrOutput)\n}", "func (o AppTemplateContainerOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AppTemplateContainer) string { return v.Name }).(pulumi.StringOutput)\n}", "func (c *CvpClient) GetContainerNameById(query string) (string, error) {\n\turl := \"/provisioning/getContainerInfoById.do?containerId=\" + query\n\trespbody, err := c.Get(url)\n\trespContainer := struct {\n\t\tName string `json:\"name\"`\n\t}{}\n\terr = json.Unmarshal(respbody, &respContainer)\n\tif err != nil {\n\t\tlog.Printf(\"Error decoding getcontainerbyid :%s\\n\", err)\n\t\treturn \"\", err\n\t}\n\treturn respContainer.Name, nil\n}", "func (p *DockerPod) GetContainerID() string {\n\tif p.netTask == nil {\n\t\treturn \"\"\n\t}\n\treturn p.netTask.RuntimeConf.ID\n}", "func ConfigNameForBuild(build *buildapi.Build) string {\n\tif build == nil {\n\t\treturn \"\"\n\t}\n\tif build.Annotations != nil {\n\t\tif _, exists := build.Annotations[buildapi.BuildConfigAnnotation]; exists {\n\t\t\treturn build.Annotations[buildapi.BuildConfigAnnotation]\n\t\t}\n\t}\n\tif _, exists := build.Labels[buildapi.BuildConfigLabel]; exists {\n\t\treturn build.Labels[buildapi.BuildConfigLabel]\n\t}\n\treturn build.Labels[buildapi.BuildConfigLabelDeprecated]\n}", "func buildPodMapTask(task *idlCore.TaskTemplate, metadata core.TaskExecutionMetadata) (v1.Pod, error) {\n\tif task.GetK8SPod() == nil || task.GetK8SPod().PodSpec == nil {\n\t\treturn v1.Pod{}, errors.Errorf(errors.BadTaskSpecification, \"Missing pod spec for task\")\n\t}\n\tvar podSpec = &v1.PodSpec{}\n\terr := utils.UnmarshalStructToObj(task.GetK8SPod().PodSpec, &podSpec)\n\tif err != nil {\n\t\treturn v1.Pod{}, errors.Errorf(errors.BadTaskSpecification,\n\t\t\t\"Unable to unmarshal task custom [%v], Err: [%v]\", task.GetCustom(), err.Error())\n\t}\n\tprimaryContainerName, ok := task.GetConfig()[primaryContainerKey]\n\tif !ok {\n\t\treturn v1.Pod{}, errors.Errorf(errors.BadTaskSpecification,\n\t\t\t\"invalid TaskSpecification, config missing [%s] key in [%v]\", primaryContainerKey, task.GetConfig())\n\t}\n\n\tvar pod = v1.Pod{\n\t\tSpec: *podSpec,\n\t}\n\tif task.GetK8SPod().Metadata != nil {\n\t\tif task.GetK8SPod().Metadata.Annotations != nil {\n\t\t\tpod.Annotations = task.GetK8SPod().Metadata.Annotations\n\t\t}\n\t\tif task.GetK8SPod().Metadata.Labels != nil {\n\t\t\tpod.Labels = task.GetK8SPod().Metadata.Labels\n\t\t}\n\t}\n\tif len(pod.Annotations) == 0 {\n\t\tpod.Annotations = make(map[string]string)\n\t}\n\tpod.Annotations[primaryContainerKey] = primaryContainerName\n\n\t// Set the restart policy to *not* inherit from the default so that a completed pod doesn't get caught in a\n\t// CrashLoopBackoff after the initial job completion.\n\tpod.Spec.RestartPolicy = v1.RestartPolicyNever\n\tflytek8s.GetServiceAccountNameFromTaskExecutionMetadata(metadata)\n\treturn pod, nil\n}", "func (o FioSpecVolumeVolumeSourceDownwardAPIItemsResourceFieldRefPtrOutput) ContainerName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *FioSpecVolumeVolumeSourceDownwardAPIItemsResourceFieldRef) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ContainerName\n\t}).(pulumi.StringPtrOutput)\n}", "func (f *Function) GetDockerFileName() string {\n\treturn \"Dockerfile\"\n}", "func (d *Docker) GetWorkloadName(ctx context.Context, ID string) (string, error) {\n\tvar containerJSON enginetypes.ContainerJSON\n\tvar err error\n\tutils.WithTimeout(ctx, d.config.GlobalConnectionTimeout, func(ctx context.Context) {\n\t\tcontainerJSON, err = d.client.ContainerInspect(ctx, ID)\n\t})\n\tif err != nil {\n\t\tlog.WithFunc(\"GetWorkloadName\").WithField(\"ID\", ID).Error(ctx, err, \"failed to get container by id\")\n\t\treturn \"\", err\n\t}\n\n\treturn containerJSON.Name, nil\n}", "func GetContainerIDByName(pod *corev1.Pod, containerName string) (string, error) {\n\tupdatedPod := &corev1.Pod{}\n\tkey := types.NamespacedName{\n\t\tName: pod.Name,\n\t\tNamespace: pod.Namespace,\n\t}\n\tif err := testclient.Client.Get(context.TODO(), key, updatedPod); err != nil {\n\t\treturn \"\", err\n\t}\n\tfor _, containerStatus := range updatedPod.Status.ContainerStatuses {\n\t\tif containerStatus.Name == containerName {\n\t\t\treturn strings.Trim(containerStatus.ContainerID, \"cri-o://\"), nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"failed to find the container ID for the container %q under the pod %q\", containerName, pod.Name)\n}", "func (o AppTemplateContainerEnvOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AppTemplateContainerEnv) string { return v.Name }).(pulumi.StringOutput)\n}", "func (f *Function) GetDockerTemplateFileName() string {\n\tif f.Runtime == NodeRuntime {\n\t\treturn \"node.Dockerfile\"\n\t}\n\treturn \"golang.Dockerfile\"\n}", "func BuildNameForConfigVersion(name string, version int) string {\n\treturn fmt.Sprintf(\"%s-%d\", name, version)\n}", "func (fh *FilesystemHandler) generateAzureContainerName(blob *models.SimpleBlob) string {\n\tcurrentContainer := blob.ParentContainer\n\treturn currentContainer.Name\n}", "func (o ArgoCDSpecTlsCaOutput) ConfigMapName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ArgoCDSpecTlsCa) *string { return v.ConfigMapName }).(pulumi.StringPtrOutput)\n}", "func (t taskInst) getContainer(named string) *ecs.Container {\n\tfor _, c := range t.Containers {\n\t\tif c != nil && ptr.StringValue(c.Name) == named {\n\t\t\treturn c\n\t\t}\n\t}\n\n\treturn nil\n}", "func namespacedPodName(namespace, name string) string {\n\treturn fmt.Sprintf(\"%s:%s\", namespace, name)\n}", "func GenerateContainerInterfaceName(podName, podNamespace, containerID string) string {\n\t// Use the podName as the prefix and the containerID as the hashing key.\n\t// podNamespace is not used currently.\n\treturn generateInterfaceName(containerID, podName, true)\n}", "func GetContainerId() string {\n\tcmd := \"cat /proc/self/cgroup | grep \\\"docker\\\" | sed s/\\\\\\\\//\\\\\\\\n/g | tail -1\"\n\tout, err := exec.Command(\"bash\", \"-c\", cmd).Output()\n\tif err != nil {\n\t\tlog.Printf(\"Container Id err is %s\\n\", err)\n\t\treturn \"\"\n\t}\n\tlog.Printf(\"The container id is %s\\n\", out)\n\treturn strings.TrimSpace(string(out))\n}", "func GetContainerId() string {\n\tcmd := \"cat /proc/self/cgroup | grep \\\"docker\\\" | sed s/\\\\\\\\//\\\\\\\\n/g | tail -1\"\n\tout, err := exec.Command(\"bash\", \"-c\", cmd).Output()\n\tif err != nil {\n\t\tlog.Printf(\"Container Id err is %s\\n\", err)\n\t\treturn \"\"\n\t}\n\tlog.Printf(\"The container id is %s\\n\", out)\n\treturn strings.TrimSpace(string(out))\n}", "func (c *ConfigurationData) GetPodName() string {\n\treturn c.v.GetString(varPodName)\n}", "func (c *Config) GetPodName() string {\n\treturn c.v.GetString(varPodName)\n}", "func (b *MySQLBox) ContainerName() string {\n\treturn b.containerName\n}", "func ConfigMapName() string {\n\tcm := os.Getenv(configMapNameEnv)\n\tif cm == \"\" {\n\t\treturn \"config-redis\"\n\t}\n\treturn cm\n}", "func (o FluxConfigurationBlobStorageOutput) ContainerId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FluxConfigurationBlobStorage) string { return v.ContainerId }).(pulumi.StringOutput)\n}", "func GetProfileNameFromPodAnnotations(annotations map[string]string, containerName string) string {\n\treturn annotations[ContainerAnnotationKeyPrefix+containerName]\n}", "func (c ArtifactConfig) Name() string {\n\treturn c.BuilderName\n}", "func getUnitNameFromDockerContainer(ctr string) (a string, b string) {\n\tre, _ := regexp.Compile(\"^.*(-[0-9.]+)$\")\n\n\tarr := strings.Split(ctr, \":\")\n\timage := arr[0]\n\ttag := arr[len(arr)-1]\n\tname := strings.Split(image, \"/\")\n\tlast := name[len(name)-1]\n\tfev := re.FindStringSubmatch(last)[1]\n\tsanitzed := strings.Replace(last, fev, \"\", 1)\n\n\treturn sanitzed, tag\n}", "func (o ArgoCDSpecTlsCaPtrOutput) ConfigMapName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ArgoCDSpecTlsCa) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ConfigMapName\n\t}).(pulumi.StringPtrOutput)\n}", "func (cmd ConfigCmd) Name() string {\n\treturn \"config\"\n}", "func (o ClusterBuildStrategySpecBuildStepsEnvFromConfigMapRefOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildStepsEnvFromConfigMapRef) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "func GetMachineConfigName(profile *performancev2.PerformanceProfile) string {\n\tname := components.GetComponentName(profile.Name, components.ComponentNamePrefix)\n\treturn fmt.Sprintf(\"50-%s\", name)\n}", "func (c *container) Name() string {\n\treturn c.name\n}", "func (c *container) Name() string {\n\treturn c.name\n}", "func (c *container) Name() string {\n\treturn c.name\n}", "func (c wrappedContainer) userContainerName() string {\n\t// The name we want is the one in c.pod.Spec.Containers[0].Name, but this doesn't work\n\t// if the pod has multiple containers, so we parse the container name instead.\n\t// The name has the format \"k8s_<container_name>_[...]\".\n\tsplitName := strings.SplitN(c.ContainerName(), \"_\", 3)\n\tif len(splitName) < 3 {\n\t\treturn \"\"\n\t}\n\n\treturn splitName[1]\n}", "func launchConfigurationName(cluster v1alpha1.AWSConfig, prefix, securityGroupID string) (string, error) {\n\tif key.ClusterID(cluster) == \"\" {\n\t\treturn \"\", microerror.Maskf(missingCloudConfigKeyError, \"spec.cluster.cluster.id\")\n\t}\n\n\tif prefix == \"\" {\n\t\treturn \"\", microerror.Maskf(missingCloudConfigKeyError, \"launchConfiguration prefix\")\n\t}\n\n\tif securityGroupID == \"\" {\n\t\treturn \"\", microerror.Maskf(missingCloudConfigKeyError, \"launchConfiguration securityGroupID\")\n\t}\n\n\treturn fmt.Sprintf(\"%s-%s-%s\", key.ClusterID(cluster), prefix, securityGroupID), nil\n}", "func BuildAtlantisProjectName(context schema.Context, projectNameTemplate string) string {\n\treturn cfg.ReplaceContextTokens(context, projectNameTemplate)\n}", "func (s *BoltState) GetContainerName(id string) (string, error) {\n\tif id == \"\" {\n\t\treturn \"\", define.ErrEmptyID\n\t}\n\n\tif !s.valid {\n\t\treturn \"\", define.ErrDBClosed\n\t}\n\n\tidBytes := []byte(id)\n\n\tdb, err := s.getDBCon()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer s.deferredCloseDBCon(db)\n\n\tname := \"\"\n\n\terr = db.View(func(tx *bolt.Tx) error {\n\t\tidBkt, err := getIDBucket(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tctrsBkt, err := getCtrBucket(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tnameBytes := idBkt.Get(idBytes)\n\t\tif nameBytes == nil {\n\t\t\treturn define.ErrNoSuchCtr\n\t\t}\n\n\t\tctrExists := ctrsBkt.Bucket(idBytes)\n\t\tif ctrExists == nil {\n\t\t\treturn define.ErrNoSuchCtr\n\t\t}\n\n\t\tname = string(nameBytes)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn name, nil\n}", "func (o ClusterBuildStrategySpecBuildStepsEnvValueFromConfigMapKeyRefOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildStepsEnvValueFromConfigMapKeyRef) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "func (o *CreateDeploymentOptions) buildPodSpec() corev1.PodSpec {\n\tpodSpec := corev1.PodSpec{Containers: []corev1.Container{}}\n\tfor _, imageString := range o.Images {\n\t\t// Retain just the image name\n\t\timageSplit := strings.Split(imageString, \"/\")\n\t\tname := imageSplit[len(imageSplit)-1]\n\t\t// Remove any tag or hash\n\t\tif strings.Contains(name, \":\") {\n\t\t\tname = strings.Split(name, \":\")[0]\n\t\t}\n\t\tif strings.Contains(name, \"@\") {\n\t\t\tname = strings.Split(name, \"@\")[0]\n\t\t}\n\t\tname = sanitizeAndUniquify(name)\n\t\tpodSpec.Containers = append(podSpec.Containers, corev1.Container{\n\t\t\tName: name,\n\t\t\tImage: imageString,\n\t\t\tCommand: o.Command,\n\t\t})\n\t}\n\treturn podSpec\n}", "func (c Container) ImageName() string {\n\t// Compatibility w/ Zodiac deployments\n\timageName, ok := c.getLabelValue(zodiacLabel)\n\tif !ok {\n\t\timageName = c.containerInfo.Config.Image\n\t}\n\n\tif !strings.Contains(imageName, \":\") {\n\t\timageName = fmt.Sprintf(\"%s:latest\", imageName)\n\t}\n\n\treturn imageName\n}", "func getContainerNameVersion(c *v1.Container) (version string) {\n\tparts := strings.Split(c.Image, \":\")\n\tif len(parts) != 2 {\n\t\treturn \"\"\n\t}\n\tversion = parts[1]\n\treturn\n}", "func (m *Metadata) getContainerID(podUID string, containerName string) (string, error) {\n\tuid := types.UID(podUID)\n\tfor _, pod := range m.PodsMetadata.Items {\n\t\tif pod.UID == uid {\n\t\t\tfor _, containerStatus := range pod.Status.ContainerStatuses {\n\t\t\t\tif containerName == containerStatus.Name {\n\t\t\t\t\treturn stripContainerID(containerStatus.ContainerID), nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn \"\", fmt.Errorf(\"pod %q with container %q not found in the fetched metadata\", podUID, containerName)\n}", "func buildRuntimeName(spec SupervisorSpec, parentName string) string {\n\tvar runtimeName string\n\tif parentName == rootSupervisorName {\n\t\t// We are the root supervisor, no need to add prefix\n\t\truntimeName = spec.GetName()\n\t} else {\n\t\truntimeName = strings.Join([]string{parentName, spec.GetName()}, \"/\")\n\t}\n\treturn runtimeName\n}", "func (o BuildRunSpecBuildRefOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BuildRunSpecBuildRef) string { return v.Name }).(pulumi.StringOutput)\n}", "func makeContainerConfig(info enginetypes.ContainerJSON, image string) (\n\t*enginecontainer.Config,\n\t*enginecontainer.HostConfig,\n\t*enginenetwork.NetworkingConfig,\n\tstring,\n\terror) {\n\n\t// we use `_` to join container name\n\t// since we don't support `_` in entrypoint, and no `_` is in suffix,\n\t// the last part will be suffix and second last part will be entrypoint,\n\t// the rest will be the appname\n\tparts := strings.Split(trimLeftSlash(info.Name), \"_\")\n\tlength := len(parts)\n\tif length < 3 {\n\t\treturn nil, nil, nil, \"\", fmt.Errorf(\"Bad container name format: %q\", info.Name)\n\t}\n\n\tentrypoint := parts[length-2]\n\tappname := strings.Join(parts[:length-2], \"_\")\n\n\tsuffix := utils.RandomString(6)\n\tcontainerName := strings.Join([]string{appname, entrypoint, suffix}, \"_\")\n\n\tconfig := info.Config\n\tconfig.Image = image\n\n\thostConfig := info.HostConfig\n\tnetworkConfig := &enginenetwork.NetworkingConfig{\n\t\tEndpointsConfig: info.NetworkSettings.Networks,\n\t}\n\treturn config, hostConfig, networkConfig, containerName, nil\n}", "func (p *DockerPod) GetNetworkName() string {\n\treturn p.netTask.NetworkName\n}", "func containerID(path, co string) string {\n\tns, n := client.Namespaced(path)\n\tpo := strings.Split(n, \"-\")[0]\n\n\treturn ns + \"/\" + po + \":\" + co\n}", "func (o VirtualDatabaseSpecBuildEnvValueFromConfigMapKeyRefOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v VirtualDatabaseSpecBuildEnvValueFromConfigMapKeyRef) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "func (o *DeploymentOpts) buildPodSpec() v1.PodSpec {\n\tpodSpec := v1.PodSpec{Containers: []v1.Container{}}\n\tfor _, imageString := range o.Images {\n\t\t// Retain just the image name\n\t\timageSplit := strings.Split(imageString, \"/\")\n\t\tname := imageSplit[len(imageSplit)-1]\n\t\t// Remove any tag or hash\n\t\tif strings.Contains(name, \":\") {\n\t\t\tname = strings.Split(name, \":\")[0]\n\t\t}\n\t\tif strings.Contains(name, \"@\") {\n\t\t\tname = strings.Split(name, \"@\")[0]\n\t\t}\n\t\tname = sanitizeAndUniquify(name)\n\t\tpodSpec.Containers = append(podSpec.Containers, v1.Container{Name: name, Image: imageString})\n\t}\n\treturn podSpec\n}", "func GetPodName() string {\n\treturn os.Getenv(PodName)\n}", "func GetPodName() string {\n\treturn os.Getenv(PodName)\n}", "func (o ClusterBuildStrategySpecBuildStepsEnvFromConfigMapRefPtrOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ClusterBuildStrategySpecBuildStepsEnvFromConfigMapRef) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Name\n\t}).(pulumi.StringPtrOutput)\n}", "func ConfigForTask(taskInfo *mesos.TaskInfo) *docker.CreateContainerOptions {\n\tconfig := &docker.CreateContainerOptions{\n\t\tName: GetContainerName(taskInfo.TaskId),\n\t\tConfig: &docker.Config{\n\t\t\tEnv: EnvForTask(taskInfo),\n\t\t\tExposedPorts: PortsForTask(taskInfo),\n\t\t\tImage: *taskInfo.Container.Docker.Image,\n\t\t\tLabels: LabelsForTask(taskInfo),\n\t\t},\n\t\tHostConfig: &docker.HostConfig{\n\t\t\tBinds: BindsForTask(taskInfo),\n\t\t\tPortBindings: PortBindingsForTask(taskInfo),\n\t\t\tNetworkMode: NetworkForTask(taskInfo),\n\t\t\tCapAdd: CapAddForTask(taskInfo),\n\t\t\tCapDrop: CapDropForTask(taskInfo),\n\t\t},\n\t}\n\n\t// Check for and calculate CPU shares\n\tcpus := getResource(\"cpus\", taskInfo)\n\tif cpus != nil {\n\t\tconfig.Config.CPUShares = int64(*cpus.Scalar.Value * float64(1024))\n\t}\n\n\t// Check for and calculate memory limit\n\tmemory := getResource(\"memoryMb\", taskInfo)\n\tif memory != nil {\n\t\tconfig.Config.Memory = int64(*memory.Scalar.Value * float64(1024*1024))\n\t}\n\n\treturn config\n}", "func (o ContainerServiceOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ContainerService) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "func (p *pluginConfig) GetConfigName() string {\n\tplugCfg := p.pluginName + \"-config\"\n\tflg := flag.CommandLine.Lookup(plugCfg)\n\tif flg != nil {\n\t\tval := flg.Value.String()\n\n\t\tif val != \"\" {\n\t\t\tplugCfg = val\n\t\t}\n\t}\n\n\treturn plugCfg\n}", "func poolName(endpointsNamespace, endpointsName string) string {\n\treturn fmt.Sprintf(\"openshift_%s_%s\", endpointsNamespace, endpointsName)\n}", "func (o DockerExecutorOutput) ImageName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DockerExecutor) string { return v.ImageName }).(pulumi.StringOutput)\n}", "func (e *EndToEndTest) GetContainer(t string) string {\n\treturn fmt.Sprintf(\"%s-%s\", e.Identity, t)\n}", "func GetContainerID() (string, error) {\n\tf, err := os.Open(cgroupsFile)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"redpill: error detecting container id: %v\", err)\n\t}\n\n\tdefer f.Close()\n\tscanner := bufio.NewScanner(f)\n\n\t// going to get lines like \"11:pids:/docker/ed807a7d59accf3b9e70c05d52cc494fc125377b82e4\"\n\t// or \"11:pids:/\" if not in container\n\n\tfor scanner.Scan() {\n\t\tline := strings.Split(scanner.Text(), \":\")\n\n\t\tif len(line) != 3 {\n\t\t\t// don't really know what's going on here so ignore\n\t\t\tcontinue\n\t\t}\n\n\t\tns := strings.TrimSpace(line[2])\n\n\t\tif strings.HasPrefix(ns, dockerNsPrefix) {\n\t\t\treturn strings.TrimPrefix(ns, dockerNsPrefix), nil\n\t\t}\n\t}\n\n\treturn \"\", nil\n}", "func (mgr *deploymentManager) imageName() string {\n\treturn fmt.Sprintf(\"%s:%s\", mgr.serverImageName, mgr.serverVersion)\n}", "func (o BuildRunStatusBuildSpecStrategyOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BuildRunStatusBuildSpecStrategy) string { return v.Name }).(pulumi.StringOutput)\n}" ]
[ "0.6439012", "0.62852246", "0.622028", "0.6200449", "0.6197181", "0.61668086", "0.61047316", "0.6056285", "0.60304743", "0.5793392", "0.5791889", "0.57634854", "0.57511026", "0.5727425", "0.5724323", "0.56959724", "0.56770957", "0.56690484", "0.56192434", "0.5603206", "0.5591932", "0.5569635", "0.55652946", "0.5559308", "0.552347", "0.55095756", "0.55065435", "0.55046165", "0.54978764", "0.5472967", "0.5468492", "0.5462318", "0.5451199", "0.54448706", "0.54446214", "0.54418856", "0.5433708", "0.53799933", "0.5370146", "0.5353772", "0.53490806", "0.5336037", "0.53229433", "0.5318941", "0.5316565", "0.52678823", "0.5252197", "0.5251731", "0.5237923", "0.52195203", "0.5200237", "0.5185175", "0.5160784", "0.51580554", "0.515319", "0.5152357", "0.5152357", "0.50906223", "0.5090477", "0.50886506", "0.508398", "0.50834686", "0.50830173", "0.5080693", "0.50709516", "0.5070011", "0.50655687", "0.5063393", "0.5061059", "0.5037244", "0.5037244", "0.5037244", "0.5033903", "0.5029119", "0.5015825", "0.50131", "0.50025433", "0.50023085", "0.50022537", "0.5001889", "0.49984562", "0.4988718", "0.49770015", "0.49696356", "0.49514276", "0.4947053", "0.4945861", "0.49425483", "0.49388728", "0.49388728", "0.49376607", "0.49324864", "0.49272668", "0.49272397", "0.4917837", "0.4915611", "0.4912177", "0.49106383", "0.49076572", "0.49059963" ]
0.7562802
0
WaitTask function is expected to return a channel that will send an ExitResult when the task exits or close the channel when the context is canceled. It is also expected that calling WaitTask on an exited task will immediately send an ExitResult on the returned channel. A call to WaitTask after StopTask is valid and should be handled. If WaitTask is called after DestroyTask, it should return drivers.ErrTaskNotFound as no task state should exist after DestroyTask is called.
Функция WaitTask ожидается, чтобы вернуть канал, который отправит ExitResult при завершении задачи или закроет канал при отмене контекста. Также ожидается, что вызов WaitTask для уже завершенной задачи сразу отправит ExitResult по возвращенному каналу. Вызов WaitTask после StopTask является допустимым и должен быть обработан. Если WaitTask вызывается после DestroyTask, он должен вернуть drivers.ErrTaskNotFound, так как после вызова DestroyTask состояние задачи не должно существовать.
func (d *Driver) WaitTask(ctx context.Context, taskID string) (<-chan *drivers.ExitResult, error) { d.logger.Debug("WaitTask called", "task", taskID) handle, ok := d.tasks.Get(taskID) if !ok { return nil, drivers.ErrTaskNotFound } ch := make(chan *drivers.ExitResult) go handle.runExitWatcher(ctx, ch) return ch, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t *Task) Wait(timeout time.Duration) (TaskResult, error) {\n\tselect {\n\tcase <-t.startedChan:\n\tdefault:\n\t\treturn nil, ErrNotExecuting\n\t}\n\n\tt.resultLock.RLock()\n\tif t.waitResult != nil {\n\t\tt.resultLock.RUnlock()\n\t\treturn t.waitResult, nil\n\t}\n\tt.resultLock.RUnlock()\n\n\tvar timeoutChan <-chan time.Time = make(chan time.Time)\n\tif timeout > 0 {\n\t\ttimeoutChan = t.cfg.clock.After(timeout)\n\t}\n\n\tselect {\n\tcase res := <-t.resultChan:\n\t\tt.completed(res)\n\t\tt.SetRunning(false)\n\t\treturn res, nil\n\tcase <-timeoutChan:\n\t\treturn nil, ErrTimeout\n\t}\n}", "func (t *Task) Wait() error {\n\t<-*t.Done\n\tif t.err != nil {\n\t\treturn goerr.Wrap(t.err)\n\t}\n\treturn nil\n}", "func (ts *TaskService) Wait(ctx context.Context, req *taskAPI.WaitRequest) (*taskAPI.WaitResponse, error) {\n\tdefer logPanicAndDie(log.G(ctx))\n\n\tlog.G(ctx).WithFields(logrus.Fields{\"id\": req.ID, \"exec_id\": req.ExecID}).Debug(\"wait\")\n\ttask, err := ts.taskManager.Task(req.ID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tctx = namespaces.WithNamespace(ctx, defaultNamespace)\n\tresp, err := task.Wait(ctx, req)\n\tif err != nil {\n\t\tlog.G(ctx).WithError(err).Error(\"wait failed\")\n\t\treturn nil, err\n\t}\n\n\tlog.G(ctx).WithField(\"exit_status\", resp.ExitStatus).Debug(\"wait succeeded\")\n\treturn resp, nil\n}", "func (ft *FutureTask) Wait(timeout time.Duration) (res *[]byte, err error) {\n\tselect {\n\tcase res = <-ft.out:\n\tcase <-time.After(timeout):\n\t\terr = fmt.Errorf(\"task(%+v) timeout\", ft)\n\t}\n\treturn\n}", "func (s *Session) Wait() error {\n\tfor {\n\t\tt := s.pClient.GetTask(s.task.ID)\n\t\tif t.Err != nil {\n\t\t\treturn errors.Wrapf(t.Err, \"getting task %q failed\", s.task.ID)\n\t\t}\n\n\t\tif t.State == \"Stopped\" || t.State == \"Disabled\" {\n\t\t\treturn errors.Errorf(\"failed to wait for task: task %q is in state %q (last failure: %q)\",\n\t\t\t\ts.task.ID,\n\t\t\t\tt.State,\n\t\t\t\tt.LastFailureMessage)\n\n\t\t}\n\n\t\tif (t.HitCount - (t.FailedCount + t.MissCount)) > 0 {\n\t\t\treturn nil\n\t\t}\n\n\t\t// Make sure that data is published.\n\t\ttime.Sleep(100 * time.Millisecond)\n\t}\n}", "func (t *TaskBox[T, U, C, CT, TF]) GetTaskCh() chan Task[T] {\n\treturn t.task\n}", "func (s *InvokeSync) Wait(ctx context.Context) error {\n\tif !s.wait.Wait(ctx) {\n\t\treturn task.StopReason(ctx)\n\t}\n\treturn s.err\n}", "func (t *Task) Wait() {\n\t<-t.done\n}", "func (t *TaskController[T, U, C, CT, TF]) Wait() {\n\tt.wg.Wait()\n\tclose(t.resultCh)\n\tt.pool.DeleteTask(t.taskID)\n}", "func WaitForAsyncTaskDone(ctx context.Context, taskID string, client *goqedit.APIClient) (goqedit.GetTaskStatusResponse, error) {\n\tvar taskStatus goqedit.GetTaskStatusResponse\n\ttaskStatusRequest := goqedit.GetTaskStatusRequest{Id: taskID}\n\tfor i := 0; i < asyncTaskRetries; i++ {\n\t\ttaskStatus, _, err := client.NodeApi.NodeGetTaskStatusPost(ctx, taskStatusRequest)\n\t\tif err != nil {\n\t\t\treturn taskStatus, fmt.Errorf(\"couldn't get task status: %v\", ErrorResponseString(err))\n\t\t}\n\t\tif taskStatus.Result != \"pending\" && taskStatus.Result != \"in_progress\" {\n\t\t\treturn taskStatus, nil\n\t\t}\n\t\tfmt.Println(\"Waiting for task to be done\")\n\t\ttime.Sleep(asyncTaskWaitTime)\n\t}\n\treturn taskStatus, fmt.Errorf(\"waiting for task timed out after %d iterations\", asyncTaskRetries)\n}", "func NewWaitTask(name string, ids object.ObjMetadataSet, cond Condition, timeout time.Duration, mapper meta.RESTMapper) *WaitTask {\n\treturn &WaitTask{\n\t\tTaskName: name,\n\t\tIds: ids,\n\t\tCondition: cond,\n\t\tTimeout: timeout,\n\t\tMapper: mapper,\n\t}\n}", "func (c *TaskChain) Wait() error {\n\treturn errors.EnsureStack(c.eg.Wait())\n}", "func (t *Task) Wait() {\n\tt.ow.Do(func() {\n\t\tt.wg.Wait()\n\t})\n}", "func (d *Driver) DestroyTask(taskID string, force bool) error {\n\thandle, ok := d.tasks.Get(taskID)\n\tif !ok {\n\t\treturn drivers.ErrTaskNotFound\n\t}\n\n\tif handle.isRunning() && !force {\n\t\treturn fmt.Errorf(\"cannot destroy running task\")\n\t}\n\n\tif handle.isRunning() {\n\t\td.logger.Debug(\"Have to destroyTask but container is still running\", \"containerID\", handle.containerID)\n\t\t// we can not do anything, so catching the error is useless\n\t\terr := d.podman.ContainerStop(d.ctx, handle.containerID, 60)\n\t\tif err != nil {\n\t\t\td.logger.Warn(\"failed to stop/kill container during destroy\", \"error\", err)\n\t\t}\n\t\t// wait a while for stats emitter to collect exit code etc.\n\t\tfor i := 0; i < 20; i++ {\n\t\t\tif !handle.isRunning() {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\ttime.Sleep(time.Millisecond * 250)\n\t\t}\n\t\tif handle.isRunning() {\n\t\t\td.logger.Warn(\"stats emitter did not exit while stop/kill container during destroy\", \"error\", err)\n\t\t}\n\t}\n\n\tif handle.removeContainerOnExit {\n\t\terr := d.podman.ContainerDelete(d.ctx, handle.containerID, true, true)\n\t\tif err != nil {\n\t\t\td.logger.Warn(\"Could not remove container\", \"container\", handle.containerID, \"error\", err)\n\t\t}\n\t}\n\n\td.tasks.Delete(taskID)\n\treturn nil\n}", "func (ts *TaskService) Wait(requestCtx context.Context, req *taskAPI.WaitRequest) (*taskAPI.WaitResponse, error) {\n\tdefer logPanicAndDie(log.G(requestCtx))\n\tlog.G(requestCtx).WithFields(logrus.Fields{\"id\": req.ID, \"exec_id\": req.ExecID}).Debug(\"wait\")\n\n\tresp, err := ts.runcService.Wait(requestCtx, req)\n\tif err != nil {\n\t\tlog.G(requestCtx).WithError(err).Error(\"wait failed\")\n\t\treturn nil, err\n\t}\n\n\tlog.G(requestCtx).WithField(\"exit_status\", resp.ExitStatus).Debug(\"wait succeeded\")\n\treturn resp, nil\n}", "func waitForTask() {\n\t// create UNBUFFERED channel for messages of type string\n\tch := make(chan string)\n\n\tgo func() {\n\t\t// wait here until manager gives us a task\n\t\t// (because channel is unbuffered/blocking)\n\t\tp := <-ch // channel receive unary operator\n\t\tfmt.Println(\"worker: received signal:\", p)\n\t}()\n\n\t// wait here for a bit\n\ttime.Sleep(time.Duration(rand.Intn(500)) * time.Millisecond)\n\t// send message\n\tch <- \"paper\"\n\tfmt.Println(\"manager: sent signal\")\n\n\ttime.Sleep(time.Second)\n\tfmt.Println(\"------------ done ---------\")\n}", "func monitorTask(ctx context.Context, task *model.Task, channel chan model.Event) {\n\t// derive new timeout context\n\tmonitorCtx, cancel := context.WithTimeout(ctx, 10 * time.Second)\n\tdefer cancel()\n\n\tselect {\n\tcase <- monitorCtx.Done():\n\t\t// check status of task\n\t\tstatus := task.GetStatus()\n\n\t\tif status != model.TaskStatusInitial && status != model.TaskStatusExecuting {\n\t\t\treturn\n\t\t}\n\n\t\t// task may still be active\n\t\tswitch monitorCtx.Err().Error() {\n\t\tcase \"context canceled\": // termination of processes\n\t\t\tutil.LogInfo(task.UUID, \"ENG\", \"termination\")\n\t\t\tchannel <- model.NewEvent(task.Domain, task.UUID, model.EventTypeTaskTermination, task.UUID, \"termination\")\n\t\tdefault: // timeout\n\t\t\tutil.LogInfo(task.UUID, \"ENG\", \"timeout\")\n\t\t\tchannel <- model.NewEvent(task.Domain, task.UUID, model.EventTypeTaskTimeout, task.UUID, \"timeout\")\n\t\t}\n\t}\n}", "func completeIfWaitTask(currentTask Task, taskContext *TaskContext) {\n\tif wt, ok := currentTask.(*WaitTask); ok {\n\t\twt.complete(taskContext)\n\t}\n}", "func (e *Eval) taskWait(ctx context.Context, f *Flow, task *sched.Task) error {\n\tif err := task.Wait(ctx, sched.TaskRunning); err != nil {\n\t\treturn err\n\t}\n\t// Grab the task's exec so that it can be logged properly.\n\tf.Exec = task.Exec\n\tif f.Op == Exec && f.Argmap != nil {\n\t\t// If this is an Exec and f.Argmap is defined, then\n\t\t// update the flow's resolved filesets.\n\t\tn := f.NExecArg()\n\t\tf.resolvedFs = make([]*reflow.Fileset, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tearg, arg := f.ExecArg(i), task.Config.Args[i]\n\t\t\tif earg.Out {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tf.resolvedFs[earg.Index] = arg.Fileset\n\t\t}\n\t}\n\te.LogFlow(ctx, f)\n\tif err := task.Wait(ctx, sched.TaskDone); err != nil {\n\t\treturn err\n\t}\n\tf.RunInfo = task.RunInfo\n\tif task.Err != nil {\n\t\te.Mutate(f, task.Err, Done)\n\t} else {\n\t\te.Mutate(f, task.Result.Err, task.Result.Fileset, Propagate, Done)\n\t}\n\treturn nil\n}", "func (d *Driver) StopTask(taskID string, timeout time.Duration, signal string) error {\n\td.logger.Info(\"Stopping task\", \"taskID\", taskID, \"signal\", signal)\n\thandle, ok := d.tasks.Get(taskID)\n\tif !ok {\n\t\treturn drivers.ErrTaskNotFound\n\t}\n\t// fixme send proper signal to container\n\terr := d.podman.ContainerStop(d.ctx, handle.containerID, int(timeout.Seconds()))\n\tif err != nil {\n\t\td.logger.Error(\"Could not stop/kill container\", \"containerID\", handle.containerID, \"err\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (w *WaitTask) Start(taskContext *TaskContext) {\n\tklog.V(2).Infof(\"wait task starting (name: %q, objects: %d)\",\n\t\tw.Name(), len(w.Ids))\n\n\t// TODO: inherit context from task runner, passed through the TaskContext\n\tctx := context.Background()\n\n\t// use a context wrapper to handle complete/cancel/timeout\n\tif w.Timeout > 0 {\n\t\tctx, w.cancelFunc = context.WithTimeout(ctx, w.Timeout)\n\t} else {\n\t\tctx, w.cancelFunc = context.WithCancel(ctx)\n\t}\n\n\tw.startInner(taskContext)\n\n\t// A goroutine to handle ending the WaitTask.\n\tgo func() {\n\t\t// Block until complete/cancel/timeout\n\t\t<-ctx.Done()\n\t\t// Err is always non-nil when Done channel is closed.\n\t\terr := ctx.Err()\n\n\t\tklog.V(2).Infof(\"wait task completing (name: %q,): %v\", w.TaskName, err)\n\n\t\tswitch err {\n\t\tcase context.Canceled:\n\t\t\t// happy path - cancelled or completed (not considered an error)\n\t\tcase context.DeadlineExceeded:\n\t\t\t// timed out\n\t\t\tw.sendTimeoutEvents(taskContext)\n\t\t}\n\n\t\t// Update RESTMapper to pick up new custom resource types\n\t\tw.updateRESTMapper(taskContext)\n\n\t\t// Done here. signal completion to the task runner\n\t\ttaskContext.TaskChannel() <- TaskResult{}\n\t}()\n}", "func (c *EC2) WaitUntilExportTaskCancelled(input *DescribeExportTasksInput) error {\n\treturn c.WaitUntilExportTaskCancelledWithContext(aws.BackgroundContext(), input)\n}", "func (p *WorkPool) DoWait(task TaskHandler) { // 添加到工作池,并等待执行完成之后再返回\n\tif p.IsClosed() { // closed\n\t\treturn\n\t}\n\n\tdoneChan := make(chan struct{})\n\tp.waitingQueue.Push(TaskHandler(func() error {\n\t\tdefer close(doneChan)\n\t\treturn task()\n\t}))\n\t<-doneChan\n}", "func (p *WorkPool) Wait() error { // 等待工作线程执行结束\n\tp.waitingQueue.Wait() // 等待队列结束\n\tp.waitingQueue.Close() //\n\tp.waitTask() // wait que down\n\tclose(p.task)\n\tp.wg.Wait() // 等待结束\n\tselect {\n\tcase err := <-p.errChan:\n\t\treturn err\n\tdefault:\n\t\treturn nil\n\t}\n}", "func TestRktDriver_Start_Wait_Stop(t *testing.T) {\n\tctestutil.RktCompatible(t)\n\tif !testutil.IsCI() {\n\t\tt.Parallel()\n\t}\n\n\trequire := require.New(t)\n\td := NewRktDriver(testlog.HCLogger(t))\n\tharness := dtestutil.NewDriverHarness(t, d)\n\n\ttask := &drivers.TaskConfig{\n\t\tID: uuid.Generate(),\n\t\tAllocID: uuid.Generate(),\n\t\tName: \"etcd\",\n\t\tResources: &drivers.Resources{\n\t\t\tNomadResources: &structs.AllocatedTaskResources{\n\t\t\t\tMemory: structs.AllocatedMemoryResources{\n\t\t\t\t\tMemoryMB: 128,\n\t\t\t\t},\n\t\t\t\tCpu: structs.AllocatedCpuResources{\n\t\t\t\t\tCpuShares: 100,\n\t\t\t\t},\n\t\t\t},\n\t\t\tLinuxResources: &drivers.LinuxResources{\n\t\t\t\tMemoryLimitBytes: 134217728,\n\t\t\t\tCPUShares: 100,\n\t\t\t},\n\t\t},\n\t}\n\n\ttc := &TaskConfig{\n\t\tTrustPrefix: \"coreos.com/etcd\",\n\t\tImageName: \"coreos.com/etcd:v2.0.4\",\n\t\tCommand: \"/etcd\",\n\t\tArgs: []string{\"--version\"},\n\t\tNet: []string{\"none\"},\n\t\tDebug: true,\n\t}\n\trequire.NoError(task.EncodeConcreteDriverConfig(&tc))\n\tcleanup := harness.MkAllocDir(task, true)\n\tdefer cleanup()\n\n\thandle, _, err := harness.StartTask(task)\n\trequire.NoError(err)\n\n\t// Wait on the task, it should exit since we are only asking for etcd version here\n\tch, err := harness.WaitTask(context.Background(), handle.Config.ID)\n\trequire.NoError(err)\n\tresult := <-ch\n\trequire.Nil(result.Err)\n\n\trequire.Zero(result.ExitCode)\n\n\trequire.NoError(harness.DestroyTask(task.ID, true))\n\n}", "func (c *Cond) Wait() {\n\tcur := task.Current()\n\tfor {\n\t\tt := (*task.Task)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&c.t))))\n\t\tswitch t {\n\t\tcase nil:\n\t\t\t// Condition variable has not been notified.\n\t\t\t// Block the current task on the condition variable.\n\t\t\tif atomic.CompareAndSwapPointer((*unsafe.Pointer)(unsafe.Pointer(&c.t)), nil, unsafe.Pointer(cur)) {\n\t\t\t\ttask.Pause()\n\t\t\t\treturn\n\t\t\t}\n\t\tcase &notifiedPlaceholder:\n\t\t\t// A notification arrived and there is no waiting goroutine.\n\t\t\t// Clear the notification and return.\n\t\t\tif atomic.CompareAndSwapPointer((*unsafe.Pointer)(unsafe.Pointer(&c.t)), unsafe.Pointer(t), nil) {\n\t\t\t\treturn\n\t\t\t}\n\t\tdefault:\n\t\t\tpanic(\"interrupt.Cond: condition variable in use by another goroutine\")\n\t\t}\n\t}\n}", "func (b *baseRunner) nextTask(taskQueue chan Task,\n\ttaskContext *TaskContext) (Task, bool) {\n\tvar tsk Task\n\tselect {\n\t// If there is any tasks left in the queue, this\n\t// case statement will be executed.\n\tcase t := <-taskQueue:\n\t\ttsk = t\n\tdefault:\n\t\t// Only happens when the channel is empty.\n\t\treturn nil, true\n\t}\n\n\tswitch st := tsk.(type) {\n\tcase *WaitTask:\n\t\t// The wait tasks need to be handled specifically here. Before\n\t\t// starting a new wait task, we check if the condition is already\n\t\t// met. Without this check, a task might end up waiting for\n\t\t// status events when the condition is in fact already met.\n\t\tif st.checkCondition(taskContext, b.collector) {\n\t\t\tst.startAndComplete(taskContext)\n\t\t} else {\n\t\t\tst.Start(taskContext)\n\t\t}\n\tdefault:\n\t\ttsk.Start(taskContext)\n\t}\n\treturn tsk, false\n}", "func (task *Task) IsWaiting() bool {\n\treturn task.status == TaskStatusWaiting\n}", "func TestRktDriver_StartWaitRecoverWaitStop(t *testing.T) {\n\tctestutil.RktCompatible(t)\n\tif !testutil.IsCI() {\n\t\tt.Parallel()\n\t}\n\n\trequire := require.New(t)\n\td := NewRktDriver(testlog.HCLogger(t))\n\tharness := dtestutil.NewDriverHarness(t, d)\n\n\ttask := &drivers.TaskConfig{\n\t\tID: uuid.Generate(),\n\t\tAllocID: uuid.Generate(),\n\t\tName: \"etcd\",\n\t\tResources: &drivers.Resources{\n\t\t\tNomadResources: &structs.AllocatedTaskResources{\n\t\t\t\tMemory: structs.AllocatedMemoryResources{\n\t\t\t\t\tMemoryMB: 128,\n\t\t\t\t},\n\t\t\t\tCpu: structs.AllocatedCpuResources{\n\t\t\t\t\tCpuShares: 100,\n\t\t\t\t},\n\t\t\t},\n\t\t\tLinuxResources: &drivers.LinuxResources{\n\t\t\t\tMemoryLimitBytes: 134217728,\n\t\t\t\tCPUShares: 100,\n\t\t\t},\n\t\t},\n\t}\n\n\ttc := &TaskConfig{\n\t\tImageName: \"coreos.com/etcd:v2.0.4\",\n\t\tCommand: \"/etcd\",\n\t}\n\trequire.NoError(task.EncodeConcreteDriverConfig(&tc))\n\n\tcleanup := harness.MkAllocDir(task, true)\n\tdefer cleanup()\n\n\thandle, _, err := harness.StartTask(task)\n\trequire.NoError(err)\n\n\tch, err := harness.WaitTask(context.Background(), task.ID)\n\trequire.NoError(err)\n\n\tvar waitDone bool\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tresult := <-ch\n\t\trequire.Error(result.Err)\n\t\twaitDone = true\n\t}()\n\n\toriginalStatus, err := d.InspectTask(task.ID)\n\trequire.NoError(err)\n\n\td.(*Driver).tasks.Delete(task.ID)\n\n\twg.Wait()\n\trequire.True(waitDone)\n\t_, err = d.InspectTask(task.ID)\n\trequire.Equal(drivers.ErrTaskNotFound, err)\n\n\terr = d.RecoverTask(handle)\n\trequire.NoError(err)\n\n\tstatus, err := d.InspectTask(task.ID)\n\trequire.NoError(err)\n\trequire.Exactly(originalStatus, status)\n\n\tch, err = harness.WaitTask(context.Background(), task.ID)\n\trequire.NoError(err)\n\n\trequire.NoError(d.StopTask(task.ID, 0, \"SIGKILL\"))\n\n\tselect {\n\tcase result := <-ch:\n\t\trequire.NoError(result.Err)\n\t\trequire.NotZero(result.ExitCode)\n\n\t\t// when killing a task, signal might not propagate\n\t\t// when executor proc.Wait() call gets \"wait: no child processes\" error\n\t\t//require.Equal(9, result.Signal)\n\tcase <-time.After(time.Duration(testutil.TestMultiplier()*5) * time.Second):\n\t\trequire.Fail(\"WaitTask timeout\")\n\t}\n\n\trequire.NoError(d.DestroyTask(task.ID, false))\n}", "func (c *EC2) WaitUntilConversionTaskCancelled(input *DescribeConversionTasksInput) error {\n\treturn c.WaitUntilConversionTaskCancelledWithContext(aws.BackgroundContext(), input)\n}", "func getWaitChan(ctx context.Context) (wait waitChan, ok bool) {\n\twait, ok = ctx.Value(waitKey{}).(waitChan)\n\n\treturn\n}", "func (a *agent) GetTask(ctx context.Context, msg *api.AgentID) (*api.Task, error) {\n\tvar task *api.Task = new(api.Task)\n\tselect {\n\tcase task, ok := <-a.work[msg.GetAgentID()]:\n\t\tif ok {\n\t\t\treturn task, nil\n\t\t}\n\t\treturn task, errors.New(\"channel closed\")\n\tdefault:\n\t\treturn task, nil\n\t}\n}", "func (m *Module) Wait(ctx context.Context) error {\n\tselect {\n\tcase <-m.done:\n\t\tif m.err != nil {\n\t\t\treturn m.err\n\t\t}\n\t\treturn nil\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\t}\n}", "func WaitContext(ctx context.Context, cmd *exec.Cmd) error {\n\t// We use cmd.Process.Wait instead of cmd.Wait because cmd.Wait is not reenterable\n\tc := make(chan error, 1)\n\tgo func() {\n\t\tif cmd == nil || cmd.Process == nil {\n\t\t\tc <- nil\n\t\t} else {\n\t\t\t_, err := cmd.Process.Wait()\n\t\t\tc <- err\n\t\t}\n\t}()\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ErrorWaitTimeout\n\tcase err := <-c:\n\t\treturn err\n\t}\n}", "func Wait(group TaskGroup, fun TaskFunc) error {\n\treturn waitFor(group.Task(fun))\n}", "func (m *MockTaskDao) GetExecWaitTask() ([]task.OwlTask, int, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetExecWaitTask\")\n\tret0, _ := ret[0].([]task.OwlTask)\n\tret1, _ := ret[1].(int)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "func waitForTask() {\n\tch := make(chan string)\n\n\tgo func() {\n\t\td := <-ch\n\t\tfmt.Println(\"child : recv'd signal :\", d)\n\t}()\n\n\ttime.Sleep(time.Duration(rand.Intn(500)) * time.Millisecond)\n\tch <- \"data\"\n\tfmt.Println(\"parent : sent signal\")\n\n\ttime.Sleep(time.Second)\n\tfmt.Println(\"-------------------------------------------------\")\n}", "func (c *EC2) WaitUntilConversionTaskDeleted(input *DescribeConversionTasksInput) error {\n\treturn c.WaitUntilConversionTaskDeletedWithContext(aws.BackgroundContext(), input)\n}", "func pollTaskAndWait(task enamlbosh.BoshTask, client *enamlbosh.Client, tries int) error {\n\tUIPrint(\"polling task...\")\n\tdefer UIPrint(fmt.Sprintf(\"Finished with Task %s\", task.Description))\n\tticker := time.Tick(time.Second)\n\tcount := 0\n\tfor {\n\t\t<-ticker\n\t\tvar err error\n\t\ttask, err = client.GetTask(task.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tswitch task.State {\n\t\tcase enamlbosh.StatusDone:\n\t\t\tUIPrintStatus(fmt.Sprintf(\"task state %s\", task.State))\n\t\t\treturn nil\n\t\tcase enamlbosh.StatusCancelled, enamlbosh.StatusError:\n\t\t\terr := fmt.Errorf(\"%s - %s\", task.State, task.Description)\n\t\t\tlo.G.Error(\"task error: \" + err.Error())\n\t\t\treturn err\n\t\tdefault:\n\t\t\tUIPrintStatus(fmt.Sprintf(\"task '%s' is %s\", task.Description, task.State))\n\t\t}\n\t\tcount++\n\n\t\tif tries != -1 && count >= tries {\n\t\t\tUIPrintStatus(\"hit poll limit, exiting task poller without error\")\n\t\t\treturn nil\n\t\t}\n\t}\n}", "func TaskWrapper(ctx context.Context, logger Logger, processors Processors, wg *sync.WaitGroup, task Task, host *Host, results chan *JobResult) error {\n\tif err := processors.TaskInstanceStarted(ctx, logger, host, task); err != nil {\n\t\terr = errors.Wrap(err, \"problem running HostStart\")\n\t\tlogger.Error(err.Error())\n\t\treturn err\n\t}\n\n\tdefer wg.Done()\n\tres, err := task.Run(ctx, logger, host)\n\thost.SetErr(err)\n\n\tjobResult := NewJobResult(ctx, host, res, err)\n\n\tif err := processors.TaskInstanceCompleted(ctx, logger, jobResult, host, task); err != nil {\n\t\terr = errors.Wrap(err, \"problem running HostCompleted\")\n\t\tlogger.Error(err.Error())\n\t\treturn err\n\t}\n\n\tresults <- jobResult\n\treturn nil\n}", "func (s *FutureTree) Wait(ctx context.Context) {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn\n\tcase res, ok := <-s.ch:\n\t\tif ok {\n\t\t\ts.res = res\n\t\t}\n\t}\n}", "func (cs *CheckinSession) Wait(ctx context.Context) error {\n\t// Once wait terminates, the checkin session should be removed from the event\n\t// server. It might have already been partially removed by a successful round\n\t// or the event being ended.\n\tdefer func() {\n\t\tcs.server.lock.Lock()\n\t\tdefer cs.server.lock.Unlock()\n\n\t\tcs.close()\n\t}()\n\t// Wait for the session to succeed, fail or time out\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn errors.New(\"context cancelled\")\n\tcase err := <-cs.result:\n\t\treturn err\n\t}\n}", "func (t *Task) StopAndWait(timeout time.Duration) (TaskResult, error) {\n\terr := t.Stop()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres, err := t.Wait(timeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res, nil\n}", "func (f *FakeCmdRunner) Wait() error {\n\treturn f.Err\n}", "func (krct *keyRegistrationConfirmationTask) RunTask() (interface{}, error) {\n\tlog.Infof(\"Waiting for confirmation for the Key [%x]\", krct.key)\n\tif krct.ctx == nil {\n\t\tkrct.ctx, _ = krct.contextInitializer(krct.timeout)\n\t}\n\n\tid := newEthereumIdentity(krct.centID, krct.contract, krct.config, krct.queue, krct.gethClientFinder, krct.contractProvider)\n\tcontract, err := id.getContract()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tkrct.filterer = contract\n\tfOpts := &bind.FilterOpts{\n\t\tContext: krct.ctx,\n\t\tStart: krct.blockHeight,\n\t}\n\n\tfor {\n\t\titer, err := krct.filterer.FilterKeyAdded(fOpts, [][32]byte{krct.key}, []*big.Int{big.NewInt(int64(krct.keyPurpose))})\n\t\tif err != nil {\n\t\t\treturn nil, centerrors.Wrap(err, \"failed to start filtering key event logs\")\n\t\t}\n\n\t\terr = utils.LookForEvent(iter)\n\t\tif err == nil {\n\t\t\tlog.Infof(\"Received filtered event Key Registration Confirmation for CentrifugeID [%s] and key [%x] with purpose [%d]\\n\", krct.centID.String(), krct.key, krct.keyPurpose)\n\t\t\treturn iter.Event, nil\n\t\t}\n\n\t\tif err != utils.ErrEventNotFound {\n\t\t\treturn nil, err\n\t\t}\n\t\ttime.Sleep(100 * time.Millisecond)\n\t}\n}", "func (w *WaitTask) Cancel(_ *TaskContext) {\n\tw.cancelFunc()\n}", "func TestRktDriver_Start_Wait_Skip_Trust(t *testing.T) {\n\tctestutil.RktCompatible(t)\n\tif !testutil.IsCI() {\n\t\tt.Parallel()\n\t}\n\n\trequire := require.New(t)\n\td := NewRktDriver(testlog.HCLogger(t))\n\tharness := dtestutil.NewDriverHarness(t, d)\n\n\ttask := &drivers.TaskConfig{\n\t\tID: uuid.Generate(),\n\t\tAllocID: uuid.Generate(),\n\t\tName: \"etcd\",\n\t\tResources: &drivers.Resources{\n\t\t\tNomadResources: &structs.AllocatedTaskResources{\n\t\t\t\tMemory: structs.AllocatedMemoryResources{\n\t\t\t\t\tMemoryMB: 128,\n\t\t\t\t},\n\t\t\t\tCpu: structs.AllocatedCpuResources{\n\t\t\t\t\tCpuShares: 100,\n\t\t\t\t},\n\t\t\t},\n\t\t\tLinuxResources: &drivers.LinuxResources{\n\t\t\t\tMemoryLimitBytes: 134217728,\n\t\t\t\tCPUShares: 100,\n\t\t\t},\n\t\t},\n\t}\n\n\ttc := &TaskConfig{\n\t\tImageName: \"coreos.com/etcd:v2.0.4\",\n\t\tCommand: \"/etcd\",\n\t\tArgs: []string{\"--version\"},\n\t\tNet: []string{\"none\"},\n\t\tDebug: true,\n\t}\n\trequire.NoError(task.EncodeConcreteDriverConfig(&tc))\n\ttesttask.SetTaskConfigEnv(task)\n\n\tcleanup := harness.MkAllocDir(task, true)\n\tdefer cleanup()\n\n\thandle, _, err := harness.StartTask(task)\n\trequire.NoError(err)\n\n\t// Wait on the task, it should exit since we are only asking for etcd version here\n\tch, err := harness.WaitTask(context.Background(), handle.Config.ID)\n\trequire.NoError(err)\n\tresult := <-ch\n\trequire.Nil(result.Err)\n\trequire.Zero(result.ExitCode)\n\n\trequire.NoError(harness.DestroyTask(task.ID, true))\n\n}", "func (p *process) Wait(ctx context.Context) error {\n\treturn WaitContext(ctx, p.cmd)\n}", "func (t *Task) MustWait() {\n\tgoerr.Check(t.Wait())\n}", "func (t *Task) WaitForRunning(timeout time.Duration) error {\n\tvar timeoutChan <-chan time.Time = make(chan time.Time)\n\tif timeout > 0 {\n\t\ttimeoutChan = t.cfg.clock.After(timeout)\n\t}\n\tselect {\n\tcase res := <-t.resultChan:\n\t\tt.completed(res)\n\t\treturn nil\n\tcase <-t.runningChan:\n\t\treturn nil\n\tcase <-timeoutChan:\n\t\treturn ErrTimeout\n\t}\n}", "func (client *Client) DescribeSyncEcsHostTaskWithCallback(request *DescribeSyncEcsHostTaskRequest, callback func(response *DescribeSyncEcsHostTaskResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeSyncEcsHostTaskResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeSyncEcsHostTask(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func TestTaskWaitForHostResources(t *testing.T) {\n\tctx, cancel := context.WithCancel(context.TODO())\n\tdefer cancel()\n\n\t// 1 vCPU available on host\n\thostResourceManager := NewHostResourceManager(getTestHostResources())\n\ttaskEngine := &DockerTaskEngine{\n\t\tmanagedTasks: make(map[string]*managedTask),\n\t\tmonitorQueuedTaskEvent: make(chan struct{}, 1),\n\t\thostResourceManager: &hostResourceManager,\n\t}\n\tgo taskEngine.monitorQueuedTasks(ctx)\n\t// 3 tasks requesting 0.5 vCPUs each\n\ttasks := []*apitask.Task{}\n\tfor i := 0; i < 3; i++ {\n\t\ttask := testdata.LoadTask(\"sleep5\")\n\t\ttask.Arn = fmt.Sprintf(\"arn%d\", i)\n\t\ttask.CPU = float64(0.5)\n\t\tmtask := &managedTask{\n\t\t\tTask: task,\n\t\t\tengine: taskEngine,\n\t\t\tconsumedHostResourceEvent: make(chan struct{}, 1),\n\t\t}\n\t\ttasks = append(tasks, task)\n\t\ttaskEngine.managedTasks[task.Arn] = mtask\n\t}\n\n\t// acquire for host resources order arn0, arn1, arn2\n\tgo func() {\n\t\ttaskEngine.managedTasks[\"arn0\"].waitForHostResources()\n\t\ttaskEngine.managedTasks[\"arn1\"].waitForHostResources()\n\t\ttaskEngine.managedTasks[\"arn2\"].waitForHostResources()\n\t}()\n\ttime.Sleep(500 * time.Millisecond)\n\n\t// Verify waiting queue is waiting at arn2\n\ttopTask, err := taskEngine.topTask()\n\tassert.NoError(t, err)\n\tassert.Equal(t, topTask.Arn, \"arn2\")\n\n\t// Remove 1 task\n\ttaskResources := taskEngine.managedTasks[\"arn0\"].ToHostResources()\n\ttaskEngine.hostResourceManager.release(\"arn0\", taskResources)\n\ttaskEngine.wakeUpTaskQueueMonitor()\n\n\ttime.Sleep(500 * time.Millisecond)\n\n\t// Verify arn2 got dequeued\n\ttopTask, err = taskEngine.topTask()\n\tassert.Error(t, err)\n}", "func (m *etcdMinion) TaskListener(c chan<- *task.Task) error {\n\tlog.Printf(\"Task listener is watching %s\\n\", m.queueDir)\n\n\trand.Seed(time.Now().UTC().UnixNano())\n\tb := backoff.Backoff{\n\t\tMin: 1 * time.Second,\n\t\tMax: 10 * time.Minute,\n\t\tFactor: 2.0,\n\t\tJitter: true,\n\t}\n\n\twatcherOpts := &etcdclient.WatcherOptions{\n\t\tRecursive: true,\n\t}\n\twatcher := m.kapi.Watcher(m.queueDir, watcherOpts)\n\n\tfor {\n\t\tresp, err := watcher.Next(context.Background())\n\t\tif err != nil {\n\t\t\t// Use a backoff and retry later again\n\t\t\tduration := b.Duration()\n\t\t\tlog.Printf(\"%s, retrying in %s\\n\", err, duration)\n\t\t\ttime.Sleep(duration)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Reset the backoff counter on successful receive\n\t\tb.Reset()\n\n\t\t// Ignore \"delete\" events when removing a task from the queue\n\t\taction := strings.ToLower(resp.Action)\n\t\tif strings.EqualFold(action, \"delete\") {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Unmarshal and remove task from the queue\n\t\tt, err := EtcdUnmarshalTask(resp.Node)\n\t\tm.kapi.Delete(context.Background(), resp.Node.Key, nil)\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Received invalid task %s: %s\\n\", resp.Node.Key, err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Send the task for processing\n\t\tlog.Printf(\"Received task %s\\n\", t.ID)\n\t\tt.State = task.TaskStateQueued\n\t\tt.TimeReceived = time.Now().Unix()\n\t\tif err := m.SaveTaskResult(t); err != nil {\n\t\t\tlog.Printf(\"Unable to save task state: %s\\n\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tc <- t\n\t}\n\n\treturn nil\n}", "func (t *TaskBox[T, U, C, CT, TF]) GetResultCh() chan U {\n\treturn t.resultCh\n}", "func (j *Job) Wait(ctx context.Context) error {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase <-j.doneCh:\n\t\treturn nil\n\t}\n}", "func (d *dockerWaiter) wait(ctx context.Context, containerID string, stopFn func()) error {\n\tstatusCh, errCh := d.client.ContainerWait(ctx, containerID, container.WaitConditionNotRunning)\n\n\tif stopFn != nil {\n\t\tstopFn()\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-time.After(time.Second):\n\t\t\tif stopFn != nil {\n\t\t\t\tstopFn()\n\t\t\t}\n\n\t\tcase err := <-errCh:\n\t\t\treturn err\n\n\t\tcase status := <-statusCh:\n\t\t\tif status.StatusCode != 0 {\n\t\t\t\treturn &common.BuildError{\n\t\t\t\t\tInner: fmt.Errorf(\"exit code %d\", status.StatusCode),\n\t\t\t\t\tExitCode: int(status.StatusCode),\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}\n\t}\n}", "func (f WaiterFunc) Wait(ctx context.Context) error {\n\treturn f(ctx)\n}", "func (c *BasicECSClient) StopTask(ctx context.Context, in *ecs.StopTaskInput) (*ecs.StopTaskOutput, error) {\n\tif err := c.setup(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"setting up client\")\n\t}\n\n\tvar out *ecs.StopTaskOutput\n\tvar err error\n\tmsg := awsutil.MakeAPILogMessage(\"StopTask\", in)\n\tif err := utility.Retry(ctx,\n\t\tfunc() (bool, error) {\n\t\t\tout, err = c.ecs.StopTaskWithContext(ctx, in)\n\t\t\tif awsErr, ok := err.(awserr.Error); ok {\n\t\t\t\tgrip.Debug(message.WrapError(awsErr, msg))\n\t\t\t\tif c.isNonRetryableErrorCode(awsErr.Code()) {\n\t\t\t\t\treturn false, err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true, err\n\t\t}, *c.opts.RetryOpts); err != nil {\n\t\treturn nil, err\n\t}\n\treturn out, nil\n}", "func (i *instanceManager) dispenseTaskEventsCh() (<-chan *drivers.TaskEvent, context.CancelFunc, error) {\n\tdriver, err := i.dispense()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tctx, cancel := context.WithCancel(i.ctx)\n\teventsCh, err := driver.TaskEvents(ctx)\n\tif err != nil {\n\t\tcancel()\n\t\treturn nil, nil, err\n\t}\n\n\treturn eventsCh, cancel, nil\n}", "func (t *Task) Reject() (interface{}, error) {\n\tpar := map[string]interface{}{\n\t\t\"taskid\": t.taskId,\n\t}\n\treturn t.nc.Exec(\"task.reject\", par)\n}", "func (ret *OpRet) Wait() error {\n\tif ret.delayed == nil {\n\t\treturn nil\n\t}\n\n\t<-ret.delayed\n\treturn ret.error\n}", "func (s *sshSessionExternal) Wait() error {\n\tif s.exited() {\n\t\treturn nil\n\t}\n\terr := s.cmd.Wait()\n\tif err == nil {\n\t\tfs.Debugf(s.f, \"ssh external: command exited OK\")\n\t} else {\n\t\tfs.Debugf(s.f, \"ssh external: command exited with error: %v\", err)\n\t}\n\treturn err\n}", "func wait(ctx context.Context, c TimedActuator,\n\tresChan chan error, cancel context.CancelFunc) error {\n\tif timeout := c.GetTimeout(); timeout != nil {\n\t\treturn waitWithTimeout(ctx, resChan, *timeout, cancel)\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\tcase err := <-resChan:\n\t\t\tif err != nil {\n\t\t\t\tcancel()\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "func (_Contract *ContractCallerSession) GetTask(i *big.Int) (struct {\n\tActive bool\n\tAssignment *big.Int\n\tProposalID *big.Int\n}, error) {\n\treturn _Contract.Contract.GetTask(&_Contract.CallOpts, i)\n}", "func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drivers.DriverNetwork, error) {\n\tif _, ok := d.tasks.Get(cfg.ID); ok {\n\t\treturn nil, nil, fmt.Errorf(\"task with ID %q already started\", cfg.ID)\n\t}\n\n\tvar driverConfig TaskConfig\n\tif err := cfg.DecodeDriverConfig(&driverConfig); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to decode driver config: %v\", err)\n\t}\n\n\thandle := drivers.NewTaskHandle(taskHandleVersion)\n\thandle.Config = cfg\n\n\tif driverConfig.Image == \"\" {\n\t\treturn nil, nil, fmt.Errorf(\"image name required\")\n\t}\n\n\tcreateOpts := api.SpecGenerator{}\n\tcreateOpts.ContainerBasicConfig.LogConfiguration = &api.LogConfig{}\n\tallArgs := []string{}\n\tif driverConfig.Command != \"\" {\n\t\tallArgs = append(allArgs, driverConfig.Command)\n\t}\n\tallArgs = append(allArgs, driverConfig.Args...)\n\n\tif driverConfig.Entrypoint != \"\" {\n\t\tcreateOpts.ContainerBasicConfig.Entrypoint = append(createOpts.ContainerBasicConfig.Entrypoint, driverConfig.Entrypoint)\n\t}\n\n\tcontainerName := BuildContainerName(cfg)\n\n\t// ensure to include port_map into tasks environment map\n\tcfg.Env = taskenv.SetPortMapEnvs(cfg.Env, driverConfig.PortMap)\n\n\t// Basic config options\n\tcreateOpts.ContainerBasicConfig.Name = containerName\n\tcreateOpts.ContainerBasicConfig.Command = allArgs\n\tcreateOpts.ContainerBasicConfig.Env = cfg.Env\n\tcreateOpts.ContainerBasicConfig.Hostname = driverConfig.Hostname\n\tcreateOpts.ContainerBasicConfig.Sysctl = driverConfig.Sysctl\n\n\tcreateOpts.ContainerBasicConfig.LogConfiguration.Path = cfg.StdoutPath\n\n\t// Storage config options\n\tcreateOpts.ContainerStorageConfig.Init = driverConfig.Init\n\tcreateOpts.ContainerStorageConfig.Image = driverConfig.Image\n\tcreateOpts.ContainerStorageConfig.InitPath = driverConfig.InitPath\n\tcreateOpts.ContainerStorageConfig.WorkDir = driverConfig.WorkingDir\n\tallMounts, err := d.containerMounts(cfg, &driverConfig)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tcreateOpts.ContainerStorageConfig.Mounts = allMounts\n\n\t// Resources config options\n\tcreateOpts.ContainerResourceConfig.ResourceLimits = &spec.LinuxResources{\n\t\tMemory: &spec.LinuxMemory{},\n\t\tCPU: &spec.LinuxCPU{},\n\t}\n\tif driverConfig.MemoryReservation != \"\" {\n\t\treservation, err := memoryInBytes(driverConfig.MemoryReservation)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tcreateOpts.ContainerResourceConfig.ResourceLimits.Memory.Reservation = &reservation\n\t}\n\n\tif cfg.Resources.NomadResources.Memory.MemoryMB > 0 {\n\t\tlimit := cfg.Resources.NomadResources.Memory.MemoryMB * 1024 * 1024\n\t\tcreateOpts.ContainerResourceConfig.ResourceLimits.Memory.Limit = &limit\n\t}\n\tif driverConfig.MemorySwap != \"\" {\n\t\tswap, err := memoryInBytes(driverConfig.MemorySwap)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tcreateOpts.ContainerResourceConfig.ResourceLimits.Memory.Swap = &swap\n\t}\n\tif !d.cgroupV2 {\n\t\tswappiness := uint64(driverConfig.MemorySwappiness)\n\t\tcreateOpts.ContainerResourceConfig.ResourceLimits.Memory.Swappiness = &swappiness\n\t}\n\t// FIXME: can fail for nonRoot due to missing cpu limit delegation permissions,\n\t// see https://github.com/containers/podman/blob/master/troubleshooting.md\n\tif !d.systemInfo.Host.Rootless {\n\t\tcpuShares := uint64(cfg.Resources.LinuxResources.CPUShares)\n\t\tcreateOpts.ContainerResourceConfig.ResourceLimits.CPU.Shares = &cpuShares\n\t}\n\n\t// Security config options\n\tcreateOpts.ContainerSecurityConfig.CapAdd = driverConfig.CapAdd\n\tcreateOpts.ContainerSecurityConfig.CapDrop = driverConfig.CapDrop\n\tcreateOpts.ContainerSecurityConfig.User = cfg.User\n\n\t// Network config options\n\tfor _, strdns := range driverConfig.Dns {\n\t\tipdns := net.ParseIP(strdns)\n\t\tif ipdns == nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"Invald dns server address\")\n\t\t}\n\t\tcreateOpts.ContainerNetworkConfig.DNSServers = append(createOpts.ContainerNetworkConfig.DNSServers, ipdns)\n\t}\n\t// Configure network\n\tif cfg.NetworkIsolation != nil && cfg.NetworkIsolation.Path != \"\" {\n\t\tcreateOpts.ContainerNetworkConfig.NetNS.NSMode = api.Path\n\t\tcreateOpts.ContainerNetworkConfig.NetNS.Value = cfg.NetworkIsolation.Path\n\t} else {\n\t\tif driverConfig.NetworkMode == \"\" {\n\t\t\tcreateOpts.ContainerNetworkConfig.NetNS.NSMode = api.Bridge\n\t\t} else if driverConfig.NetworkMode == \"bridge\" {\n\t\t\tcreateOpts.ContainerNetworkConfig.NetNS.NSMode = api.Bridge\n\t\t} else if driverConfig.NetworkMode == \"host\" {\n\t\t\tcreateOpts.ContainerNetworkConfig.NetNS.NSMode = api.Host\n\t\t} else if driverConfig.NetworkMode == \"none\" {\n\t\t\tcreateOpts.ContainerNetworkConfig.NetNS.NSMode = api.NoNetwork\n\t\t} else if driverConfig.NetworkMode == \"slirp4netns\" {\n\t\t\tcreateOpts.ContainerNetworkConfig.NetNS.NSMode = api.Slirp\n\t\t} else {\n\t\t\treturn nil, nil, fmt.Errorf(\"Unknown/Unsupported network mode: %s\", driverConfig.NetworkMode)\n\t\t}\n\t}\n\n\tportMappings, err := d.portMappings(cfg, driverConfig)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tcreateOpts.ContainerNetworkConfig.PortMappings = portMappings\n\n\tcontainerID := \"\"\n\trecoverRunningContainer := false\n\t// check if there is a container with same name\n\totherContainerInspect, err := d.podman.ContainerInspect(d.ctx, containerName)\n\tif err == nil {\n\t\t// ok, seems we found a container with similar name\n\t\tif otherContainerInspect.State.Running {\n\t\t\t// it's still running. So let's use it instead of creating a new one\n\t\t\td.logger.Info(\"Detect running container with same name, we reuse it\", \"task\", cfg.ID, \"container\", otherContainerInspect.ID)\n\t\t\tcontainerID = otherContainerInspect.ID\n\t\t\trecoverRunningContainer = true\n\t\t} else {\n\t\t\t// let's remove the old, dead container\n\t\t\td.logger.Info(\"Detect stopped container with same name, removing it\", \"task\", cfg.ID, \"container\", otherContainerInspect.ID)\n\t\t\tif err = d.podman.ContainerDelete(d.ctx, otherContainerInspect.ID, true, true); err != nil {\n\t\t\t\treturn nil, nil, nstructs.WrapRecoverable(fmt.Sprintf(\"failed to remove dead container: %v\", err), err)\n\t\t\t}\n\t\t}\n\t}\n\n\tif !recoverRunningContainer {\n\t\t// FIXME: there are more variations of image sources, we should handle it\n\t\t// e.g. oci-archive:/... etc\n\t\t// see also https://github.com/hashicorp/nomad-driver-podman/issues/69\n\t\t// do we already have this image in local storage?\n\t\thaveImage, err := d.podman.ImageExists(d.ctx, createOpts.Image)\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"failed to start task, unable to check for local image: %v\", err)\n\t\t}\n\t\tif !haveImage {\n\t\t\t// image is not in local storage, so we need to pull it\n\t\t\tif err = d.podman.ImagePull(d.ctx, createOpts.Image); err != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"failed to start task, unable to pull image %s: %v\", createOpts.Image, err)\n\t\t\t}\n\t\t}\n\n\t\tcreateResponse, err := d.podman.ContainerCreate(d.ctx, createOpts)\n\t\tfor _, w := range createResponse.Warnings {\n\t\t\td.logger.Warn(\"Create Warning\", \"warning\", w)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"failed to start task, could not create container: %v\", err)\n\t\t}\n\t\tcontainerID = createResponse.Id\n\t}\n\n\tcleanup := func() {\n\t\td.logger.Debug(\"Cleaning up\", \"container\", containerID)\n\t\tif err := d.podman.ContainerDelete(d.ctx, containerID, true, true); err != nil {\n\t\t\td.logger.Error(\"failed to clean up from an error in Start\", \"error\", err)\n\t\t}\n\t}\n\n\tif !recoverRunningContainer {\n\t\tif err = d.podman.ContainerStart(d.ctx, containerID); err != nil {\n\t\t\tcleanup()\n\t\t\treturn nil, nil, fmt.Errorf(\"failed to start task, could not start container: %v\", err)\n\t\t}\n\t}\n\n\tinspectData, err := d.podman.ContainerInspect(d.ctx, containerID)\n\tif err != nil {\n\t\td.logger.Error(\"failed to inspect container\", \"err\", err)\n\t\tcleanup()\n\t\treturn nil, nil, fmt.Errorf(\"failed to start task, could not inspect container : %v\", err)\n\t}\n\n\tnet := &drivers.DriverNetwork{\n\t\tPortMap: driverConfig.PortMap,\n\t\tIP: inspectData.NetworkSettings.IPAddress,\n\t\tAutoAdvertise: true,\n\t}\n\n\th := &TaskHandle{\n\t\tcontainerID: containerID,\n\t\tdriver: d,\n\t\ttaskConfig: cfg,\n\t\tprocState: drivers.TaskStateRunning,\n\t\texitResult: &drivers.ExitResult{},\n\t\tstartedAt: time.Now().Round(time.Millisecond),\n\t\tlogger: d.logger.Named(\"podmanHandle\"),\n\n\t\ttotalCPUStats: stats.NewCpuStats(),\n\t\tuserCPUStats: stats.NewCpuStats(),\n\t\tsystemCPUStats: stats.NewCpuStats(),\n\n\t\tremoveContainerOnExit: d.config.GC.Container,\n\t}\n\n\tdriverState := TaskState{\n\t\tContainerID: containerID,\n\t\tTaskConfig: cfg,\n\t\tStartedAt: h.startedAt,\n\t\tNet: net,\n\t}\n\n\tif err := handle.SetDriverState(&driverState); err != nil {\n\t\td.logger.Error(\"failed to start task, error setting driver state\", \"error\", err)\n\t\tcleanup()\n\t\treturn nil, nil, fmt.Errorf(\"failed to set driver state: %v\", err)\n\t}\n\n\td.tasks.Set(cfg.ID, h)\n\n\tgo h.runContainerMonitor()\n\n\td.logger.Info(\"Completely started container\", \"taskID\", cfg.ID, \"container\", containerID, \"ip\", inspectData.NetworkSettings.IPAddress)\n\n\treturn handle, net, nil\n}", "func (operation *Operation) GetTaskConduit() chan Messager {\n\treturn operation.conduit\n}", "func (o AppV2Output) Wait() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *AppV2) pulumi.BoolPtrOutput { return v.Wait }).(pulumi.BoolPtrOutput)\n}", "func (*FakeReconcilerClient) GetTask(string) (swarm.Task, error) {\n\treturn swarm.Task{}, FakeUnimplemented\n}", "func (p SourceProvider) TaskDone(t *provider.Task) error {\n\tt.LastRunAt = time.Now()\n\tt.Running = false\n\tt.LastError = \"\"\n\tt.CurrentRetryCount = 0\n\tif !p.Config.Enabled {\n\t\treturn nil\n\t}\n\tif p.Connection.KAPI == nil {\n\t\tif err := p.Connection.Connect(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := p.Connection.WriteTask(t); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *TowerClient) taskRejected(task *backupTask, curStatus reserveStatus) {\n\tswitch curStatus {\n\n\t// The sessionQueue has available capacity but the task was rejected,\n\t// this indicates that the task was ineligible for backup.\n\tcase reserveAvailable:\n\t\tc.stats.taskIneligible()\n\n\t\tlog.Infof(\"Backup chanid=%s commit-height=%d is ineligible\",\n\t\t\ttask.id.ChanID, task.id.CommitHeight)\n\n\t\terr := c.cfg.DB.MarkBackupIneligible(\n\t\t\ttask.id.ChanID, task.id.CommitHeight,\n\t\t)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Unable to mark task chanid=%s \"+\n\t\t\t\t\"commit-height=%d ineligible: %v\",\n\t\t\t\ttask.id.ChanID, task.id.CommitHeight, err)\n\n\t\t\t// It is safe to not handle this error, even if we could\n\t\t\t// not persist the result. At worst, this task may be\n\t\t\t// reprocessed on a subsequent start up, and will either\n\t\t\t// succeed do a change in session parameters or fail in\n\t\t\t// the same manner.\n\t\t}\n\n\t\t// If this task was rejected *and* the session had available\n\t\t// capacity, we discard anything held in the prevTask. Either it\n\t\t// was nil before, or is the task which was just rejected.\n\t\tc.prevTask = nil\n\n\t// The sessionQueue rejected the task because it is full, we will stash\n\t// this task and try to add it to the next available sessionQueue.\n\tcase reserveExhausted:\n\t\tc.stats.sessionExhausted()\n\n\t\tlog.Debugf(\"Session %s exhausted, backup chanid=%s \"+\n\t\t\t\"commit-height=%d queued for next session\",\n\t\t\tc.sessionQueue.ID(), task.id.ChanID,\n\t\t\ttask.id.CommitHeight)\n\n\t\t// Cache the task that we pulled off, so that we can process it\n\t\t// once a new session queue is available.\n\t\tc.sessionQueue = nil\n\t\tc.prevTask = task\n\t}\n}", "func WaitTasks(taskBroker *schedule.TaskBroker, run *models.Run) error {\n\tlogrus.Info(\"Begin monitoring task execution ...\")\n\n\tch, err := taskBroker.GetChannel()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tjobName := run.Details[common.KeyJobName]\n\tpodListOpt := metav1.ListOptions{LabelSelector: fmt.Sprintf(\"job-name=%s\", jobName)}\n\tapi := clientset.CoreV1()\n\n\tfor {\n\t\ttime.Sleep(interval)\n\n\t\tqueue, err := ch.QueueInspect(jobName)\n\t\tif err != nil {\n\t\t\tlogrus.Info(\"The queue doesn't exist. All tasks have been executed.\")\n\t\t\tbreak\n\t\t}\n\t\tlogrus.Infof(\"Queue: messages %d.\", queue.Messages)\n\n\t\tif queue.Messages != 0 {\n\t\t\t// there are tasks to be run\n\t\t\tcontinue\n\t\t}\n\n\t\t// the number of the message in the queue is zero. make sure all the\n\t\t// pods in this job have finished\n\t\tpodList, err := api.Pods(namespace).List(podListOpt)\n\t\tif err != nil {\n\t\t\tlogrus.Warnf(\"Fail to list pod of %s: %s\", jobName, err)\n\t\t\tcontinue\n\t\t}\n\n\t\trunningPods := 0\n\t\tfor _, pod := range podList.Items {\n\t\t\tif pod.Status.Phase == corev1.PodRunning {\n\t\t\t\trunningPods++\n\t\t\t}\n\t\t}\n\n\t\tif runningPods != 0 {\n\t\t\tlogrus.Infof(\"%d pod are still running.\", runningPods)\n\t\t\tcontinue\n\t\t}\n\n\t\t// zero task in the queue and all pod stop.\n\t\tbreak\n\t}\n\n\treturn nil\n}", "func (client *Client) DescribeSyncEcsHostTaskWithChan(request *DescribeSyncEcsHostTaskRequest) (<-chan *DescribeSyncEcsHostTaskResponse, <-chan error) {\n\tresponseChan := make(chan *DescribeSyncEcsHostTaskResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.DescribeSyncEcsHostTask(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (d *dispatcher) monitorTask(taskID int64) (finished bool, subTaskErrs []error) {\n\t// TODO: Consider putting the following operations into a transaction.\n\tvar err error\n\td.task, err = d.taskMgr.GetGlobalTaskByID(taskID)\n\tif err != nil {\n\t\tlogutil.BgLogger().Error(\"check task failed\", zap.Int64(\"task ID\", d.task.ID), zap.Error(err))\n\t\treturn false, nil\n\t}\n\tswitch d.task.State {\n\tcase proto.TaskStateCancelling:\n\t\treturn false, []error{errors.New(\"cancel\")}\n\tcase proto.TaskStateReverting:\n\t\tcnt, err := d.taskMgr.GetSubtaskInStatesCnt(d.task.ID, proto.TaskStateRevertPending, proto.TaskStateReverting)\n\t\tif err != nil {\n\t\t\tlogutil.BgLogger().Warn(\"check task failed\", zap.Int64(\"task ID\", d.task.ID), zap.Error(err))\n\t\t\treturn false, nil\n\t\t}\n\t\treturn cnt == 0, nil\n\tdefault:\n\t\tsubTaskErrs, err = d.taskMgr.CollectSubTaskError(d.task.ID)\n\t\tif err != nil {\n\t\t\tlogutil.BgLogger().Warn(\"collect subtask error failed\", zap.Int64(\"task ID\", d.task.ID), zap.Error(err))\n\t\t\treturn false, nil\n\t\t}\n\t\tif len(subTaskErrs) > 0 {\n\t\t\treturn false, subTaskErrs\n\t\t}\n\t\t// check subtasks pending or running.\n\t\tcnt, err := d.taskMgr.GetSubtaskInStatesCnt(d.task.ID, proto.TaskStatePending, proto.TaskStateRunning)\n\t\tif err != nil {\n\t\t\tlogutil.BgLogger().Warn(\"check task failed\", zap.Int64(\"task ID\", d.task.ID), zap.Error(err))\n\t\t\treturn false, nil\n\t\t}\n\t\treturn cnt == 0, nil\n\t}\n}", "func (p *process) Wait(ctx context.Context) error {\n\tselect {\n\tcase err, ok := <-p.waitC:\n\t\t// Process exited\n\t\tif ok {\n\t\t\treturn err\n\t\t}\n\t\treturn errWaitAlreadyCalled\n\tcase <-ctx.Done():\n\t\t// Timed out. Send a kill signal and release our handle to it.\n\t\treturn multierr.Combine(ctx.Err(), p.cmd.Process.Kill())\n\t}\n}", "func (n *Node) Wait() (int, error) {\n\tctx := context.TODO()\n\n\tclient, err := client.NewEnvClient()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn client.ContainerWait(ctx, n.id)\n}", "func (c *lockBased) Wait(ctx context.Context) error {\n\tc.mux.RLock()\n\tdefer c.mux.RUnlock()\n\treturn ctx.Err()\n}", "func (s *testSignaler) wait() bool {\n\tselect {\n\tcase s := <-s.nonBlockingStatus:\n\t\treturn s\n\tcase s := <-s.status:\n\t\treturn s\n\t}\n}", "func (c *EC2) WaitUntilExportTaskCancelledWithContext(ctx aws.Context, input *DescribeExportTasksInput, opts ...request.WaiterOption) error {\n\tw := request.Waiter{\n\t\tName: \"WaitUntilExportTaskCancelled\",\n\t\tMaxAttempts: 40,\n\t\tDelay: request.ConstantWaiterDelay(15 * time.Second),\n\t\tAcceptors: []request.WaiterAcceptor{\n\t\t\t{\n\t\t\t\tState: request.SuccessWaiterState,\n\t\t\t\tMatcher: request.PathAllWaiterMatch, Argument: \"ExportTasks[].State\",\n\t\t\t\tExpected: \"cancelled\",\n\t\t\t},\n\t\t},\n\t\tLogger: c.Config.Logger,\n\t\tNewRequest: func(opts []request.Option) (*request.Request, error) {\n\t\t\tvar inCpy *DescribeExportTasksInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.DescribeExportTasksRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\tw.ApplyOptions(opts...)\n\n\treturn w.WaitWithContext(ctx)\n}", "func (m *Manager) Wait(ctx context.Context, uuid string) error {\n\t// Find the workflow.\n\trw, err := m.runningWorkflow(uuid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Just wait for it.\n\tselect {\n\tcase <-rw.done:\n\t\tbreak\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\t}\n\treturn nil\n}", "func (db *DynamoDB) CancelTask(ctx context.Context, req *tes.CancelTaskRequest) (*tes.CancelTaskResponse, error) {\n\n\t// call GetTask prior to cancel to ensure that the task exists\n\tt, err := db.GetTask(ctx, &tes.GetTaskRequest{Id: req.Id, View: tes.TaskView_MINIMAL})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tswitch t.GetState() {\n\tcase tes.State_COMPLETE, tes.State_EXECUTOR_ERROR, tes.State_SYSTEM_ERROR:\n\t\terr = fmt.Errorf(\"illegal state transition from %s to %s\", t.GetState().String(), tes.State_CANCELED.String())\n\t\treturn nil, fmt.Errorf(\"cannot cancel task: %s\", err)\n\tcase tes.State_CANCELED:\n\t\treturn &tes.CancelTaskResponse{}, nil\n\t}\n\n\titem := &dynamodb.UpdateItemInput{\n\t\tTableName: aws.String(db.taskTable),\n\t\tKey: map[string]*dynamodb.AttributeValue{\n\t\t\tdb.partitionKey: {\n\t\t\t\tS: aws.String(db.partitionValue),\n\t\t\t},\n\t\t\t\"id\": {\n\t\t\t\tS: aws.String(req.Id),\n\t\t\t},\n\t\t},\n\t\tExpressionAttributeNames: map[string]*string{\n\t\t\t\"#state\": aws.String(\"state\"),\n\t\t},\n\t\tUpdateExpression: aws.String(\"SET #state = :to\"),\n\t\tExpressionAttributeValues: map[string]*dynamodb.AttributeValue{\n\t\t\t\":to\": {\n\t\t\t\tN: aws.String(strconv.Itoa(int(tes.State_CANCELED))),\n\t\t\t},\n\t\t},\n\t\tReturnValues: aws.String(\"UPDATED_NEW\"),\n\t}\n\n\t_, err = db.client.UpdateItemWithContext(ctx, item)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &tes.CancelTaskResponse{}, nil\n}", "func (s *Service) waitChan(cmd *exec.Cmd) <-chan waitResult {\n\tvar wr waitResult\n\tc := make(chan waitResult, 1)\n\tgo func() {\n\t\twr.ps, wr.err = cmd.Process.Wait()\n\t\tc <- wr\n\t}()\n\treturn c\n}", "func (t *Transport) Wait() <-chan error {\n\tc := make(chan error, 1)\n\tc <- errors.New(\"TODO\")\n\treturn c\n}", "func (_Contract *ContractSession) GetTask(i *big.Int) (struct {\n\tActive bool\n\tAssignment *big.Int\n\tProposalID *big.Int\n}, error) {\n\treturn _Contract.Contract.GetTask(&_Contract.CallOpts, i)\n}", "func (p *Pairing) Wait(ctx context.Context) (tornet.RemoteKeyRing, error) {\n\tdefer p.peerset.Close()\n\tif p.server != nil {\n\t\tdefer p.server.Close()\n\t}\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn tornet.RemoteKeyRing{}, errors.New(\"context cancelled\")\n\tcase <-p.finished:\n\t\tif p.failure != nil {\n\t\t\treturn tornet.RemoteKeyRing{}, p.failure\n\t\t}\n\t\treturn p.peer, nil\n\t}\n}", "func Wait(exitChannel chan error, cancel context.CancelFunc) error {\n\terr := <-exitChannel\n\t// cancel the context\n\tcancel()\n\treturn err\n}", "func (g *Group) Wait() error {\n\tif v := atomic.SwapUint32(&g.waiting, 1); v != 0 {\n\t\tpanic(\"schedgroup: multiple calls to Group.Wait\")\n\t}\n\n\t// Context cancelation takes priority.\n\tif err := g.ctx.Err(); err != nil {\n\t\treturn err\n\t}\n\n\t// See if the task heap is already empty. If so, we can exit early.\n\tg.mu.Lock()\n\tif g.tasks.Len() == 0 {\n\t\t// Release the mutex immediately so that any running jobs are able to\n\t\t// complete and send on g.lenC.\n\t\tg.mu.Unlock()\n\t\tg.cancel()\n\t\tg.wg.Wait()\n\t\treturn nil\n\t}\n\tg.mu.Unlock()\n\n\t// Wait on context cancelation or for the number of items in the heap\n\t// to reach 0.\n\tvar n int\n\tfor {\n\t\tselect {\n\t\tcase <-g.ctx.Done():\n\t\t\treturn g.ctx.Err()\n\t\tcase n = <-g.lenC:\n\t\t\t// Context cancelation takes priority.\n\t\t\tif err := g.ctx.Err(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif n == 0 {\n\t\t\t// No more tasks left, cancel the monitor goroutine and wait for\n\t\t\t// all tasks to complete.\n\t\t\tg.cancel()\n\t\t\tg.wg.Wait()\n\t\t\treturn nil\n\t\t}\n\t}\n}", "func (cmd *Command) Wait() error {\n\t// According to https://github.com/golang/go/issues/28461,\n\t// exec.Cmd#Wait is not thread-safe, so we need to implement\n\t// our own version.\n\tcmd.waitOnce.Do(func() {\n\t\tcmd.waitResult = cmd.c.Wait()\n\t\tclose(cmd.waitDoneCh)\n\t})\n\treturn cmd.waitResult\n}", "func (r *Robot) FailTask(name string, args ...string) RetVal {\n\treturn r.pipeTask(flavorFail, typeTask, name, args...)\n}", "func (e *engine) Wait(context.Context, *Spec, *Step) (*State, error) {\n\treturn nil, nil // no-op for bash implementation\n}", "func (m *Manager) PauseWait() <-chan struct{} {\n\ts := <-m.status\n\tch := m.pauseStart\n\tm.status <- s\n\treturn ch\n}", "func (t *Transaction) WaitContext(ctx context.Context) (tx *interfaces.TxWithBlock, err error) {\n\tselect {\n\tcase tx = <-t.Transaction(): // wait for the tx\n\tcase err2, ok := <-t.Err(): // wait for an error\n\t\tif !ok { // in case the channel is closed, then return status.ErrShutdown\n\t\t\terr = status.ErrShutdown\n\t\t\treturn\n\t\t}\n\t\terr = err2\n\tcase <-ctx.Done(): // wait for context cancellation\n\t\terr = ctx.Err() // TODO should we close the instance?\n\t}\n\treturn\n}", "func (tm *Manager) WaitForPendingTasks() {\n\ttm.wg.Wait()\n}", "func (sb *shardBuffer) wait(ctx context.Context, e *entry) (RetryDoneFunc, error) {\n\tselect {\n\tcase <-ctx.Done():\n\t\tsb.remove(e)\n\t\treturn nil, vterrors.Errorf(vterrors.Code(contextCanceledError), \"%v: %v\", contextCanceledError, ctx.Err())\n\tcase <-e.done:\n\t\treturn e.bufferCancel, e.err\n\t}\n}", "func (t *Task) Stop() error {\n\tselect {\n\tcase <-t.startedChan:\n\tdefault:\n\t\treturn ErrNotExecuting\n\t}\n\n\tt.cancelCtx()\n\n\treturn nil\n}", "func (r *Runsc) Wait(context context.Context, id string) (int, error) {\n\tdata, stderr, err := cmdOutput(r.command(context, \"wait\", id), false)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"%w: %s\", err, stderr)\n\t}\n\tvar res waitResult\n\tif err := json.Unmarshal(data, &res); err != nil {\n\t\treturn 0, err\n\t}\n\treturn res.ExitStatus, nil\n}", "func (op *DeleteTensorboardRunOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\treturn op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)\n}", "func newTask(opts taskOptions) *task {\n\tctx, cancel := context.WithCancel(opts.Context)\n\n\tt := &task{\n\t\tctx: ctx,\n\t\tcancel: cancel,\n\t\texited: make(chan struct{}),\n\t}\n\n\tgo func() {\n\t\tdefer opts.OnDone()\n\t\tdefer close(t.exited)\n\t\t_ = opts.Runnable.Run(t.ctx)\n\t}()\n\treturn t\n}", "func (d *dispatcher) scheduleTask(taskID int64) {\n\tticker := time.NewTicker(checkTaskFinishedInterval)\n\tdefer ticker.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-d.ctx.Done():\n\t\t\tlogutil.BgLogger().Info(\"schedule task exits\", zap.Int64(\"task ID\", taskID), zap.Error(d.ctx.Err()))\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t\tstepIsFinished, errs := d.monitorTask(taskID)\n\t\t\tfailpoint.Inject(\"cancelTaskAfterMonitorTask\", func(val failpoint.Value) {\n\t\t\t\tif val.(bool) && d.task.State == proto.TaskStateRunning {\n\t\t\t\t\terr := d.taskMgr.CancelGlobalTask(taskID)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlogutil.BgLogger().Error(\"cancel task failed\", zap.Error(err))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t\t// The global task isn't finished and not failed.\n\t\t\tif !stepIsFinished && len(errs) == 0 {\n\t\t\t\tGetTaskFlowHandle(d.task.Type).OnTicker(d.ctx, d.task)\n\t\t\t\tlogutil.BgLogger().Debug(\"schedule task, this task keeps current state\",\n\t\t\t\t\tzap.Int64(\"task-id\", d.task.ID), zap.String(\"state\", d.task.State))\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\terr := d.processFlow(d.task, errs)\n\t\t\tif err == nil && d.task.IsFinished() {\n\t\t\t\tlogutil.BgLogger().Info(\"schedule task, task is finished\",\n\t\t\t\t\tzap.Int64(\"task-id\", d.task.ID), zap.String(\"state\", d.task.State))\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tfailpoint.Inject(\"mockOwnerChange\", func(val failpoint.Value) {\n\t\t\tif val.(bool) {\n\t\t\t\tlogutil.BgLogger().Info(\"mockOwnerChange called\")\n\t\t\t\tMockOwnerChange()\n\t\t\t\ttime.Sleep(time.Second)\n\t\t\t}\n\t\t})\n\t}\n}", "func (mgr *ClientMgr) onTaskEnd(ctx context.Context, client *Client, task *Task,\n\terr error, reply *jarviscrawlercore.ReplyCrawler, endChan chan int) {\n\n\tif err != nil {\n\t\tif task.Logger != nil {\n\t\t\ttask.Logger.Warn(\"onTaskEnd: error\",\n\t\t\t\tzap.Error(err),\n\t\t\t\tzap.String(\"servaddr\", client.servAddr),\n\t\t\t\tJSON(\"task\", task))\n\t\t}\n\n\t\t// if !(strings.Index(err.Error(), \"Error: noretry:\") == 0 ||\n\t\t// \tstrings.Index(err.Error(), \"noretry:\") == 0) {\n\t\tif !IsNoRetryError(err) {\n\n\t\t\tif task.RetryNums > 0 {\n\t\t\t\ttask.RetryNums--\n\n\t\t\t\t// time.Sleep(time.Second * time.Duration(mgr.cfg.SleepTime))\n\n\t\t\t\ttask.Running = false\n\t\t\t\tclient.Running = false\n\t\t\t\tendChan <- 0\n\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// task.Fail = true\n\t\t\t// task.running = false\n\t\t}\n\n\t\ttask.Fail = true\n\t}\n\n\tgo task.Callback(ctx, task, err, reply)\n\n\t// time.Sleep(time.Second * time.Duration(mgr.cfg.SleepTime))\n\n\ttask.Running = false\n\tclient.Running = false\n\tendChan <- task.TaskID\n}", "func TestTaskContext(t *testing.T) {\n\tt.Run(\"reflect external context\", func(t *testing.T) {\n\t\tctx, cancel := context.WithCancel(context.Background())\n\t\ttask := Start(ctx, TaskFuncDoneErr)\n\n\t\tnotDone(task)\n\t\teq(nil, task.Err())\n\n\t\tcancel()\n\t\twaitDone(task)\n\t\teq(true, errors.Is(task.Err(), context.Canceled))\n\t})\n\n\tt.Run(\"wait on external context, override error\", func(t *testing.T) {\n\t\tsentinel := fmt.Errorf(`sentinel`)\n\n\t\tfun := func(ctx Task) error {\n\t\t\twaitDone(ctx)\n\t\t\treturn sentinel\n\t\t}\n\n\t\tctx, cancel := context.WithCancel(context.Background())\n\t\ttask := Start(ctx, fun)\n\n\t\tnotDone(task)\n\t\teq(nil, task.Err())\n\n\t\tcancel()\n\t\twaitDone(task)\n\t\teq(true, errors.Is(task.Err(), sentinel))\n\t})\n}" ]
[ "0.68873113", "0.6370824", "0.6234808", "0.6090943", "0.60882926", "0.60077477", "0.59856975", "0.5946728", "0.57896346", "0.5758922", "0.5743035", "0.57364565", "0.5708013", "0.56723464", "0.5585439", "0.5556589", "0.54844946", "0.54625577", "0.5353345", "0.5346748", "0.5334011", "0.52867043", "0.5280479", "0.52784675", "0.523096", "0.5144518", "0.51311857", "0.5104822", "0.5084476", "0.50472355", "0.5033292", "0.5029276", "0.4999667", "0.49661478", "0.49404478", "0.49349874", "0.49334714", "0.49268", "0.49101368", "0.49028888", "0.49000618", "0.4899081", "0.4892145", "0.4877008", "0.48608527", "0.48507208", "0.48488528", "0.48448238", "0.4840617", "0.48394042", "0.48359224", "0.48334652", "0.4790766", "0.47819018", "0.47799274", "0.47621638", "0.4749033", "0.47453642", "0.4743298", "0.4742895", "0.47344464", "0.47295034", "0.47117302", "0.47039446", "0.47012135", "0.47007248", "0.46943593", "0.46943185", "0.46771812", "0.4665864", "0.46579868", "0.4657349", "0.46568346", "0.4641224", "0.46397376", "0.4639023", "0.46325785", "0.4628944", "0.4627311", "0.4598577", "0.45903948", "0.45880347", "0.4587894", "0.45809475", "0.45763236", "0.45717672", "0.4570821", "0.4570056", "0.45693114", "0.45683238", "0.45489994", "0.45472232", "0.45470476", "0.45453542", "0.4542372", "0.4537725", "0.45297983", "0.45289338", "0.45275784", "0.45212483" ]
0.76350826
0
StopTask function is expected to stop a running task by sending the given signal to it. If the task does not stop during the given timeout, the driver must forcefully kill the task. StopTask does not clean up resources of the task or remove it from the driver's internal state.
Функция StopTask ожидается, чтобы остановить запущенную задачу, отправив ей заданный сигнал. Если задача не останавливается в течение заданного таймаута, драйвер должен принудительно завершить задачу. StopTask не очищает ресурсы задачи или удаляет её из внутреннего состояния драйвера.
func (d *Driver) StopTask(taskID string, timeout time.Duration, signal string) error { d.logger.Info("Stopping task", "taskID", taskID, "signal", signal) handle, ok := d.tasks.Get(taskID) if !ok { return drivers.ErrTaskNotFound } // fixme send proper signal to container err := d.podman.ContainerStop(d.ctx, handle.containerID, int(timeout.Seconds())) if err != nil { d.logger.Error("Could not stop/kill container", "containerID", handle.containerID, "err", err) return err } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t *Task) StopWithTimeout(timeout time.Duration) error {\n\tdefer func() { recover() }()\n\tclose(*t.Stopper)\n\n\tselect {\n\tcase <-*t.Done:\n\t\treturn nil\n\tcase <-time.After(timeout):\n\t\treturn goerr.Wrap(&ErrStoppingTaskTimeout{})\n\t}\n}", "func (h *Hub) StopTask(ctx context.Context, request *pb.StopTaskRequest) (*pb.StopTaskReply, error) {\n\tlog.G(h.ctx).Info(\"handling StopTask request\", zap.Any(\"req\", request))\n\ttaskID := request.Id\n\tminerID, ok := h.getMinerByTaskID(taskID)\n\tif !ok {\n\t\treturn nil, status.Errorf(codes.NotFound, \"no such task %s\", taskID)\n\t}\n\n\tminer, ok := h.getMinerByID(minerID)\n\tif !ok {\n\t\treturn nil, status.Errorf(codes.NotFound, \"no miner with task %s\", minerID)\n\t}\n\n\t_, err := miner.Client.Stop(ctx, &pb.StopTaskRequest{Id: taskID})\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.NotFound, \"failed to stop the task %s\", taskID)\n\t}\n\n\tminer.deregisterRoute(taskID)\n\tminer.Retain(taskID)\n\n\th.deleteTaskByID(taskID)\n\n\treturn &pb.StopTaskReply{}, nil\n}", "func (s *Session) Stop() error {\n\tif s.task == nil {\n\t\treturn errors.New(\"snap task not running or not found\")\n\t}\n\n\trs := s.pClient.StopTask(s.task.ID)\n\tif rs.Err != nil {\n\t\treturn errors.Wrapf(rs.Err, \"could not send stop signal to task %q\", s.task.ID)\n\t}\n\n\terr := s.waitForStop()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"could not stop task %q\", s.task.ID)\n\t}\n\n\trr := s.pClient.RemoveTask(s.task.ID)\n\tif rr.Err != nil {\n\t\treturn errors.Wrapf(rr.Err, \"could not remove task %q\", s.task.ID)\n\t}\n\n\ts.task = nil\n\n\treturn nil\n}", "func (c *BasicECSClient) StopTask(ctx context.Context, in *ecs.StopTaskInput) (*ecs.StopTaskOutput, error) {\n\tif err := c.setup(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"setting up client\")\n\t}\n\n\tvar out *ecs.StopTaskOutput\n\tvar err error\n\tmsg := awsutil.MakeAPILogMessage(\"StopTask\", in)\n\tif err := utility.Retry(ctx,\n\t\tfunc() (bool, error) {\n\t\t\tout, err = c.ecs.StopTaskWithContext(ctx, in)\n\t\t\tif awsErr, ok := err.(awserr.Error); ok {\n\t\t\t\tgrip.Debug(message.WrapError(awsErr, msg))\n\t\t\t\tif c.isNonRetryableErrorCode(awsErr.Code()) {\n\t\t\t\t\treturn false, err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true, err\n\t\t}, *c.opts.RetryOpts); err != nil {\n\t\treturn nil, err\n\t}\n\treturn out, nil\n}", "func (d *Driver) SignalTask(taskID string, signal string) error {\n\thandle, ok := d.tasks.Get(taskID)\n\tif !ok {\n\t\treturn drivers.ErrTaskNotFound\n\t}\n\n\treturn d.podman.ContainerKill(d.ctx, handle.containerID, signal)\n}", "func (c Control) ServeStopTask(w http.ResponseWriter, r *http.Request) {\n\tc.ServeTaskAction(w, r, false)\n}", "func (t *Task) Stop() error {\n\tselect {\n\tcase <-t.startedChan:\n\tdefault:\n\t\treturn ErrNotExecuting\n\t}\n\n\tt.cancelCtx()\n\n\treturn nil\n}", "func (e *ECS) StopTask(req *StopTaskReq) (*StopTaskResp, error) {\n\tif req == nil {\n\t\treturn nil, fmt.Errorf(\"The req params cannot be nil\")\n\t}\n\n\tparams := makeParams(\"StopTask\")\n\tif req.Cluster != \"\" {\n\t\tparams[\"cluster\"] = req.Cluster\n\t}\n\tif req.Task != \"\" {\n\t\tparams[\"task\"] = req.Task\n\t}\n\n\tresp := new(StopTaskResp)\n\tif err := e.query(params, resp); err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "func (c *Client) TerminateTask(guid string) error {\n\treq := c.NewRequest(\"PUT\", fmt.Sprintf(\"/v3/tasks/%s/cancel\", guid))\n\tresp, err := c.DoRequest(req)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Error terminating task\")\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 202 {\n\t\treturn errors.Wrapf(err, \"Failed terminating task, response status code %d\", resp.StatusCode)\n\t}\n\treturn nil\n}", "func (c *ECS) StopTask(input *StopTaskInput) (output *StopTaskOutput, err error) {\n\treq, out := c.StopTaskRequest(input)\n\toutput = out\n\terr = req.Send()\n\treturn\n}", "func (t *Task) Stop() {\n\tdefer func() { recover() }()\n\tclose(*t.Stopper)\n\t<-*t.Done\n}", "func HandleStopTask(w http.ResponseWriter, r *http.Request) {\n\tlog.Root.Info(\"HandleStopTask BEGIN\")\n\n\tif r.Method != http.MethodPost {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tHttpResponseError(w, ErrNotFound)\n\t\treturn\n\t}\n\n\tdefer r.Body.Close()\n\tbody, _ := ioutil.ReadAll(r.Body)\n\n\tdata := make(map[string]interface{})\n\terr := json.Unmarshal(body, &data)\n\tif err != nil {\n\t\tlog.Root.Error(\"HandleStopTask Parse HTTP request body error\")\n\t\tHttpResponseError(w, ErrForm)\n\t\treturn\n\t}\n\n\telem, ok := data[\"taskID\"]\n\tif !ok {\n\t\tlog.Root.Error(\"HandleStopTask HTTP form data error\")\n\t\tHttpResponseError(w, ErrForm)\n\t\treturn\n\t}\n\n\ttaskID := elem.(string)\n\ttaskCapacity, err := node.StopTask(taskID)\n\tif err != nil {\n\t\tlog.Root.Error(\"HandleStopTask Stop task error. TaskID: %v\", taskID)\n\t\tHttpResponseError(w, ErrServer)\n\t\treturn\n\t}\n\n\tlog.Root.Info(\"HandleStopTask END\")\n\tHttpResponseData(w, H{\n\t\t\"taskCapacity\": taskCapacity,\n\t})\n\treturn\n}", "func (k *KubernetesExecutor) KillTask(driver bindings.ExecutorDriver, taskId *mesos.TaskID) {\n\tif k.isDone() {\n\t\treturn\n\t}\n\tlog.Infof(\"Kill task %v\\n\", taskId)\n\n\tif !k.isConnected() {\n\t\t//TODO(jdefelice) sent TASK_LOST here?\n\t\tlog.Warningf(\"Ignore kill task because the executor is disconnected\\n\")\n\t\treturn\n\t}\n\n\tk.lock.Lock()\n\tdefer k.lock.Unlock()\n\tk.killPodForTask(driver, taskId.GetValue(), messages.TaskKilled)\n}", "func (k *KubernetesExecutor) KillTask(driver bindings.ExecutorDriver, taskId *mesos.TaskID) {\n\tif k.isDone() {\n\t\treturn\n\t}\n\tlog.Infof(\"Kill task %v\\n\", taskId)\n\n\tif !k.isConnected() {\n\t\t//TODO(jdefelice) sent TASK_LOST here?\n\t\tlog.Warningf(\"Ignore kill task because the executor is disconnected\\n\")\n\t\treturn\n\t}\n\n\tk.lock.Lock()\n\tdefer k.lock.Unlock()\n\tk.removePodTask(driver, taskId.GetValue(), messages.TaskKilled, mesos.TaskState_TASK_KILLED)\n}", "func (t *TaskController[T, U, C, CT, TF]) Stop() {\n\tclose(t.productExitCh)\n\t// Clear all the task in the task queue and mark all task complete.\n\t// so that ```t.Wait``` is able to close resultCh\n\tfor range t.inputCh {\n\t\tt.wg.Done()\n\t}\n\tt.pool.StopTask(t.TaskID())\n\t// Clear the resultCh to avoid blocking the consumer put result into the channel and cannot exit.\n\tchannel.Clear(t.resultCh)\n}", "func (c *Cmd) StopWithTimeout(to time.Duration) error {\n\texited := make(chan bool)\n\tgo func() {\n\t\tc.Wait()\n\t\texited <- true\n\t}()\n\n\tps, err := c.expandToChildProcesses(c.Process)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//signal all (child)processes to better simulate\n\t//shell behaviour\n\tfor _, p := range ps {\n\t\terr := p.Signal(os.Interrupt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tselect {\n\tcase <-exited:\n\t\treturn nil //process exited by itself\n\tcase <-time.After(to):\n\t\tfor _, p := range ps {\n\t\t\terr := p.Kill()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n}", "func (f *Failer) KillTask(host, task string) error {\n\tscript := \"sudo pkill -x %s\"\n\tlog.V(1).Infof(\"Killing task %s on host %s\", task, host)\n\treturn f.runWithEvilTag(host, fmt.Sprintf(script, task))\n}", "func (t *Task) StopAndWait(timeout time.Duration) (TaskResult, error) {\n\terr := t.Stop()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres, err := t.Wait(timeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res, nil\n}", "func (r *subdomainTask) Stop() error {\n\tclose(r.done)\n\tr.queue = queue.NewQueue()\n\treturn nil\n}", "func (o *DeleteLTENetworkIDNetworkProbeTasksTaskIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func StopTimeout(t time.Duration) Option {\n\treturn func(o *options) { o.stopTimeout = t }\n}", "func (m TaskManager) AbortTask(c context.Context, ctl task.Controller) error {\n\treturn nil\n}", "func (m TaskManager) AbortTask(c context.Context, ctl task.Controller) error {\n\treturn nil\n}", "func (t *task) Kill(_ context.Context, signal syscall.Signal) error {\n\thcsContainer, err := t.getHCSContainer()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogger := t.ctr.client.logger.WithFields(log.Fields{\n\t\t\"container\": t.ctr.id,\n\t\t\"process\": t.id,\n\t\t\"pid\": t.Pid(),\n\t\t\"signal\": signal,\n\t})\n\tlogger.Debug(\"Signal()\")\n\n\tvar op string\n\tif signal == syscall.SIGKILL {\n\t\t// Terminate the compute system\n\t\tt.ctr.mu.Lock()\n\t\tt.ctr.terminateInvoked = true\n\t\tt.ctr.mu.Unlock()\n\t\top, err = \"terminate\", hcsContainer.Terminate()\n\t} else {\n\t\t// Shut down the container\n\t\top, err = \"shutdown\", hcsContainer.Shutdown()\n\t}\n\tif err != nil {\n\t\tif !hcsshim.IsPending(err) && !hcsshim.IsAlreadyStopped(err) {\n\t\t\t// ignore errors\n\t\t\tlogger.WithError(err).Errorf(\"failed to %s hccshim container\", op)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c *ECS) StopTaskRequest(input *StopTaskInput) (req *aws.Request, output *StopTaskOutput) {\n\toprw.Lock()\n\tdefer oprw.Unlock()\n\n\tif opStopTask == nil {\n\t\topStopTask = &aws.Operation{\n\t\t\tName: \"StopTask\",\n\t\t\tHTTPMethod: \"POST\",\n\t\t\tHTTPPath: \"/\",\n\t\t}\n\t}\n\n\treq = c.newRequest(opStopTask, input, output)\n\toutput = &StopTaskOutput{}\n\treq.Data = output\n\treturn\n}", "func KillTask(tid int) Errno {\n\t_, e := internal.Syscall1(KILLTASK, uintptr(tid))\n\treturn Errno(e)\n}", "func (md *ManagementNode) StopTaskDeadTimeout(ctx context.Context, id string) error {\n\n\tmd.scheduledTasksMtx.RLock()\n\tdefer md.scheduledTasksMtx.RUnlock()\n\n\ttask, ok := md.scheduledTasks[id]\n\tif !ok {\n\t\treturn trace.Errorf(\"There is no task %s in the scheduled task storage\", id)\n\t}\n\n\ttask.StopDeadTimeout(ctx)\n\n\treturn nil\n\n}", "func (timeout *Timeout) Stop() {\n\ttimeout.state = Inactive\n\ttimeout.start = time.Now()\n}", "func cleanupTask(ctx context.Context, t *testing.T, c cocoa.ECSClient, runOut *ecs.RunTaskOutput) {\n\tif runOut != nil && len(runOut.Tasks) > 0 && runOut.Tasks[0].TaskArn != nil {\n\t\tout, err := c.StopTask(ctx, &ecs.StopTaskInput{\n\t\t\tCluster: aws.String(testutil.ECSClusterName()),\n\t\t\tTask: aws.String(*runOut.Tasks[0].TaskArn),\n\t\t})\n\t\trequire.NoError(t, err)\n\t\trequire.NotZero(t, out)\n\t}\n}", "func (t *DeferredRecordingTaskImpl) Stop(blocking bool) error {\n\treturn t.task.Stop(blocking)\n}", "func (tr *TaskRunner) Kill(ctx context.Context, event *structs.TaskEvent) error {\n\ttr.logger.Trace(\"Kill requested\")\n\n\t// Cancel the task runner to break out of restart delay or the main run\n\t// loop.\n\ttr.killCtxCancel()\n\n\t// Emit kill event\n\tif event != nil {\n\t\ttr.logger.Trace(\"Kill event\", \"event_type\", event.Type, \"event_reason\", event.KillReason)\n\t\ttr.EmitEvent(event)\n\t}\n\n\tselect {\n\tcase <-tr.WaitCh():\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\t}\n\n\treturn tr.getKillErr()\n}", "func (b *B) StopTimer()", "func (m *Mock) StopPlugin(name string, cancelFlag task.CancelFlag) (err error) {\n\treturn nil\n}", "func (w *WaitTask) Cancel(_ *TaskContext) {\n\tw.cancelFunc()\n}", "func (t *TimeTask) DeleteTask(task *RawTask) {\n\tt.deleteChan <- task\n}", "func (d *Driver) DestroyTask(taskID string, force bool) error {\n\thandle, ok := d.tasks.Get(taskID)\n\tif !ok {\n\t\treturn drivers.ErrTaskNotFound\n\t}\n\n\tif handle.isRunning() && !force {\n\t\treturn fmt.Errorf(\"cannot destroy running task\")\n\t}\n\n\tif handle.isRunning() {\n\t\td.logger.Debug(\"Have to destroyTask but container is still running\", \"containerID\", handle.containerID)\n\t\t// we can not do anything, so catching the error is useless\n\t\terr := d.podman.ContainerStop(d.ctx, handle.containerID, 60)\n\t\tif err != nil {\n\t\t\td.logger.Warn(\"failed to stop/kill container during destroy\", \"error\", err)\n\t\t}\n\t\t// wait a while for stats emitter to collect exit code etc.\n\t\tfor i := 0; i < 20; i++ {\n\t\t\tif !handle.isRunning() {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\ttime.Sleep(time.Millisecond * 250)\n\t\t}\n\t\tif handle.isRunning() {\n\t\t\td.logger.Warn(\"stats emitter did not exit while stop/kill container during destroy\", \"error\", err)\n\t\t}\n\t}\n\n\tif handle.removeContainerOnExit {\n\t\terr := d.podman.ContainerDelete(d.ctx, handle.containerID, true, true)\n\t\tif err != nil {\n\t\t\td.logger.Warn(\"Could not remove container\", \"container\", handle.containerID, \"error\", err)\n\t\t}\n\t}\n\n\td.tasks.Delete(taskID)\n\treturn nil\n}", "func (s *Syncthing) Stop() error {\n\tdefer s.cmd.Process.Wait() // nolint: errcheck\n\n\treturn s.cmd.Process.Signal(os.Interrupt)\n}", "func (d *Driver) Stop() error {\n\tif err := d.verifyRootPermissions(); err != nil {\n\t\treturn err\n\t}\n\n\ts, err := d.GetState()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif s != state.Stopped {\n\t\terr := d.sendSignal(syscall.SIGTERM)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"hyperkit sigterm failed\")\n\t\t}\n\t\t// wait 120s for graceful shutdown\n\t\tfor i := 0; i < 60; i++ {\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\ts, _ := d.GetState()\n\t\t\tlog.Debugf(\"VM state: %s\", s)\n\t\t\tif s == state.Stopped {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\treturn errors.New(\"VM Failed to gracefully shutdown, try the kill command\")\n\t}\n\treturn nil\n}", "func (c *Command) Stop() error {\n\tif c.cmd.Process == nil {\n\t\t// not yet started\n\t\treturn nil\n\t}\n\n\tpid := c.cmd.Process.Pid\n\tif c.timeout > 0 {\n\t\t// stop listening on os.Interrupt signal\n\t\tsignal.Stop(c.interruptChan)\n\t\t// stop the timeout timer\n\t\tc.timeoutTimer.Stop()\n\n\t\t// use the negative process group id, to kill the whole process group\n\t\tpgid, err := syscall.Getpgid(c.cmd.Process.Pid)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpid = -1 * pgid\n\t}\n\n\t// kill the process\n\treturn syscall.Kill(pid, syscall.SIGKILL)\n}", "func (c *Client) CancelTask(ctx context.Context, taskID string) error {\n\tctx, cf := context.WithTimeout(ctx, 60*time.Second)\n\tdefer cf()\n\tvar tc *swarming_api.SwarmingRpcsCancelResponse\n\tgetResult := func() error {\n\t\tvar err error\n\t\treq := &swarming_api.SwarmingRpcsTaskCancelRequest{\n\t\t\tKillRunning: true,\n\t\t}\n\t\ttc, err = c.SwarmingService.Task.Cancel(taskID, req).Context(ctx).Do()\n\t\treturn err\n\t}\n\tif err := callWithRetries(ctx, getResult); err != nil {\n\t\treturn errors.Annotate(err, fmt.Sprintf(\"cancel task %s\", taskID)).Err()\n\t}\n\tif !tc.Ok {\n\t\treturn errors.New(fmt.Sprintf(\"task %s is not successfully canceled\", taskID))\n\t}\n\treturn nil\n}", "func (t *Task) StopDeadTimeout(ctx context.Context) {\n\tc, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\tselect {\n\tcase t.rxed <- struct{}{}:\n\t\t{\n\t\t\tlog.Debugf(\"Dead timeout is stopped for task %s\",\n\t\t\t\tt.task.Id)\n\t\t}\n\tcase <-c.Done():\n\t\t{\n\t\t\tlog.Warningf(\"context declined for task %s\", t.task.Id)\n\t\t}\n\t}\n}", "func execStop(_ int, p *gop.Context) {\n\targs := p.GetArgs(1)\n\tsignal.Stop(args[0].(chan<- os.Signal))\n}", "func (b Bot) CancelTask(taskID string) error {\n\ttask, err := b.repository.GetTask(taskID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif task.executed {\n\t\treturn fmt.Errorf(\"task %s has already been executed\", taskID)\n\t}\n\n\ttask.cancelled = true\n\tb.repository.UpdateTask(task)\n\treturn nil\n}", "func (k *KubernetesExecutor) reportLostTask(driver bindings.ExecutorDriver, tid, reason string) {\n\tk.removePodTask(driver, tid, reason, mesos.TaskState_TASK_LOST)\n}", "func (k *KubernetesExecutor) reportLostTask(driver bindings.ExecutorDriver, tid, reason string) {\n\tk.removePodTask(driver, tid, reason, mesos.TaskState_TASK_LOST)\n}", "func SignalStopEmission(instance *Object, signalId uint32, detail glib.Quark) {\n\tc_instance := (C.gpointer)(C.NULL)\n\tif instance != nil {\n\t\tc_instance = (C.gpointer)(instance.ToC())\n\t}\n\n\tc_signal_id := (C.guint)(signalId)\n\n\tc_detail := (C.GQuark)(detail)\n\n\tC.g_signal_stop_emission(c_instance, c_signal_id, c_detail)\n\n\treturn\n}", "func runTask(bFunc taskFunc, tFunc taskFunc, name string, interval time.Duration) {\n\tif err := bFunc(name); err != nil {\n\t\tglog.Errorf(\"%s: %s\", name, err)\n\t}\n\tfor {\n\t\tselect {\n\t\tcase <-killTask:\n\t\t\tglog.V(vvLevel).Infof(\"Exiting %s\", name)\n\t\t\theartbeatWG.Done()\n\t\t\treturn\n\t\tdefault:\n\t\t\tif err := tFunc(name); err != nil {\n\t\t\t\tglog.Errorf(\"%s: %s\", name, err)\n\t\t\t}\n\t\t\ttime.Sleep(interval)\n\t\t}\n\t}\n}", "func (NilTimer) Stop() {}", "func (sys Systemd) Stop(unit string) error {\n\tns := fmt.Sprintf(\"project_%s_%s\", sys.p.ID, sys.kind)\n\ttarget := ns + \"_\" + unit\n\n\tif err := exec.Command(\"systemctl\", \"stop\", target).Run(); err != nil {\n\t\treturn fmt.Errorf(\"failed to stop systemd unit %s: %s\", target, err)\n\t}\n\treturn nil\n}", "func (o *AutoscaleStopInstancesByCrnParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (vm *VirtualMachine) Stop(args *DomainXML, reply *bool) error {\n\t// Passing the true parameter to ensure the stop vm task is added to waitgroup as this action needs to be completed\n\t// even if there is pending signal termination on rpc\n\t_, err := proc.AddTask(true)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"rpc/server:Stop() Could not add task for vm stop\")\n\t}\n\tdefer proc.TaskDone()\n\n\tlog.Trace(\"rpc/server:Stop() Entering\")\n\tdefer log.Trace(\"rpc/server:Stop() Leaving\")\n\n\twlaMtx.Lock()\n\tdefer wlaMtx.Unlock()\n\n\tif err = validation.ValidateXMLString(args.XML); err != nil {\n\t\tsecLog.Errorf(\"rpc:server() Stop: %s, Invalid domain XML format\", message.InvalidInputBadParam)\n\t\treturn nil\n\t}\n\n\t// pass in vm.Watcher to get the instance to the File System Watcher\n\t*reply = wlavm.Stop(args.XML, vm.Watcher)\n\treturn nil\n}", "func (p *GoshPool) StopWait() {\n\tp.stop(true)\n}", "func (_m *MockApiClient) CancelTask(id string) error {\n\tret := _m.Called(id)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string) error); ok {\n\t\tr0 = rf(id)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "func (t Task) Close() error {\n\tpath := fmt.Sprintf(\"tasks/%d/close\", t.ID)\n\t_, err := makeRequest(http.MethodPost, path, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (o *DeleteLTENetworkIDNetworkProbeTasksTaskIDParams) WithTimeout(timeout time.Duration) *DeleteLTENetworkIDNetworkProbeTasksTaskIDParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (i *DeleteOrUpdateInvTask) Cancel(_ *taskrunner.TaskContext) {}", "func (o *StopGatewayBundleUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (tw *TimeWheel) removeTask(key interface{}) {\n\t// get the timer slot\n\tposition, ok := tw.timer[key]\n\tif !ok {\n\t\treturn\n\t}\n\t// get slot list\n\tl := tw.slots[position]\n\tfor e := l.Front(); e != nil; {\n\t\ttask := e.Value.(*Task)\n\t\tif task.key == key {\n\t\t\tdelete(tw.timer, task.key)\n\t\t\tl.Remove(e)\n\t\t}\n\n\t\te = e.Next()\n\t}\n}", "func (c *hostCommunicator) EndTask(ctx context.Context, detail *apimodels.TaskEndDetail, taskData TaskData) (*apimodels.EndTaskResponse, error) {\n\tgrip.Info(message.Fields{\n\t\t\"message\": \"started EndTask\",\n\t\t\"task_id\": taskData.ID,\n\t})\n\ttaskEndResp := &apimodels.EndTaskResponse{}\n\tinfo := requestInfo{\n\t\tmethod: http.MethodPost,\n\t\ttaskData: &taskData,\n\t\tpath: fmt.Sprintf(\"hosts/%s/task/%s/end\", c.hostID, taskData.ID),\n\t}\n\tresp, err := c.retryRequest(ctx, info, detail)\n\tif err != nil {\n\t\treturn nil, util.RespErrorf(resp, errors.Wrap(err, \"ending task\").Error())\n\t}\n\tdefer resp.Body.Close()\n\tif err = utility.ReadJSON(resp.Body, taskEndResp); err != nil {\n\t\treturn nil, errors.Wrap(err, \"reading end task reply from response\")\n\t}\n\tgrip.Info(message.Fields{\n\t\t\"message\": \"finished EndTask\",\n\t\t\"task_id\": taskData.ID,\n\t})\n\treturn taskEndResp, nil\n}", "func (o *CleanUpTasksDeprecatedParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (p *PruneTask) ClearTimeout() {}", "func (a API) StopWait(cmd *None) (out *None, e error) {\n\tRPCHandlers[\"stop\"].Call <-API{a.Ch, cmd, nil}\n\tselect {\n\tcase <-time.After(time.Second*5):\n\t\tbreak\n\tcase o := <-a.Ch.(chan StopRes):\n\t\tout, e = o.Res, o.Err\n\t}\n\treturn\n}", "func (t *Task) Cancel() {\n log.Warnf(\"Cancelling task and all subsequent runs\")\n\n // Clear queue of subsequent runs\n t.runs.Clear()\n}", "func TrackTaskEnd() {\n\tpersist.DeleteValue(taskPayloadKey)\n\tpersist.DeleteValue(taskEndTimeKey)\n}", "func TestLibvirtDriver_Start_Stop_Recover_Task(t *testing.T) {\n\tutil.RequireLibvirt(t)\n\n\trequire := require.New(t)\n\n\td := NewLibvirtDriver(testlog.HCLogger(t)).(*Driver)\n\tharness := dtestutil.NewDriverHarness(t, d)\n\n\trequire.NoError(task.EncodeConcreteDriverConfig(&taskCfg))\n\n\tcleanup := harness.MkAllocDir(task, false)\n\tdefer cleanup()\n\n\t// Test start task\n\thandle, _, err := harness.StartTask(task)\n\trequire.NoError(err)\n\trequire.NotNil(handle)\n\n\tlibvirtHandle, ok := d.tasks.Get(task.ID)\n\trequire.NotNil(libvirtHandle)\n\trequire.True(ok)\n\n\ttestutil.WaitForResult(func() (bool, error) {\n\t\tstatus, err := d.InspectTask(task.ID)\n\t\trequire.NoError(err)\n\t\tif status.State == drivers.TaskStateRunning {\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, fmt.Errorf(\"task in state: %v\", status.State)\n\t}, func(err error) {\n\t\tt.Fatalf(\"task failed to start: %v\", err)\n\t})\n\n\t// Missing the task handle\n\td.tasks.Delete(task.ID)\n\n\t// Test recover the missed task\n\trecoverHandle := handle.Copy()\n\trequire.NoError(d.RecoverTask(recoverHandle))\n\n\td.StopTask(task.ID, 5*time.Second, \"kill\")\n\n\t// Destroy the task/vm after test\n\tdefer d.DestroyTask(task.ID, false)\n\n\t// Test after recovery and stop task\n\ttestutil.WaitForResult(func() (bool, error) {\n\t\tstatus, err := d.InspectTask(task.ID)\n\t\trequire.NoError(err)\n\t\tif status.State == drivers.TaskStateExited {\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, fmt.Errorf(\"task in state: %v\", status.State)\n\t}, func(err error) {\n\t\tt.Fatalf(\"task failed to stop: %v\", err)\n\t})\n}", "func (s *T) Stop() {\n\tclose(s.stopCh)\n\ts.wg.Wait()\n}", "func (s *stateMachine) Stop() {\n\tselect {\n\tcase s.cmds <- ReleaseMessage():\n\t\t// Also inform the state machine it should exit since the internal handler\n\t\t// may override the release message causing the task to be unreleaseable.\n\t\ts.stop()\n\tcase <-s.stopped:\n\t\t// Already stopped!\n\t}\n}", "func (b *B) StopTimer() {}", "func (c *Controller) Stop(ctx hive.HookContext) error {\n\tdoneChan := make(chan struct{})\n\tgo func() {\n\t\tc.workerpool.Close()\n\t\tclose(doneChan)\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase <-doneChan:\n\t}\n\n\treturn nil\n}", "func (c *Controller) Stop(ctx hive.HookContext) error {\n\tdoneChan := make(chan struct{})\n\tgo func() {\n\t\tc.workerpool.Close()\n\t\tclose(doneChan)\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase <-doneChan:\n\t}\n\n\treturn nil\n}", "func (sh *SignalHandler) Stop() {\n\tsh.lock.Lock()\n\tdefer sh.lock.Unlock()\n\n\tif sh.isRunning == true {\n\t\tsh.isRunning = false\n\t}\n}", "func (t *Task) Reject() (interface{}, error) {\n\tpar := map[string]interface{}{\n\t\t\"taskid\": t.taskId,\n\t}\n\treturn t.nc.Exec(\"task.reject\", par)\n}", "func (h *TCPProbe) Stop() {\n\th.Cancel()\n}", "func (s *Slot) Stop() {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tif s.cancel != nil {\n\t\ts.cancel()\n\t\ts.cancel = nil\n\t}\n}", "func (db *DynamoDB) CancelTask(ctx context.Context, req *tes.CancelTaskRequest) (*tes.CancelTaskResponse, error) {\n\n\t// call GetTask prior to cancel to ensure that the task exists\n\tt, err := db.GetTask(ctx, &tes.GetTaskRequest{Id: req.Id, View: tes.TaskView_MINIMAL})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tswitch t.GetState() {\n\tcase tes.State_COMPLETE, tes.State_EXECUTOR_ERROR, tes.State_SYSTEM_ERROR:\n\t\terr = fmt.Errorf(\"illegal state transition from %s to %s\", t.GetState().String(), tes.State_CANCELED.String())\n\t\treturn nil, fmt.Errorf(\"cannot cancel task: %s\", err)\n\tcase tes.State_CANCELED:\n\t\treturn &tes.CancelTaskResponse{}, nil\n\t}\n\n\titem := &dynamodb.UpdateItemInput{\n\t\tTableName: aws.String(db.taskTable),\n\t\tKey: map[string]*dynamodb.AttributeValue{\n\t\t\tdb.partitionKey: {\n\t\t\t\tS: aws.String(db.partitionValue),\n\t\t\t},\n\t\t\t\"id\": {\n\t\t\t\tS: aws.String(req.Id),\n\t\t\t},\n\t\t},\n\t\tExpressionAttributeNames: map[string]*string{\n\t\t\t\"#state\": aws.String(\"state\"),\n\t\t},\n\t\tUpdateExpression: aws.String(\"SET #state = :to\"),\n\t\tExpressionAttributeValues: map[string]*dynamodb.AttributeValue{\n\t\t\t\":to\": {\n\t\t\t\tN: aws.String(strconv.Itoa(int(tes.State_CANCELED))),\n\t\t\t},\n\t\t},\n\t\tReturnValues: aws.String(\"UPDATED_NEW\"),\n\t}\n\n\t_, err = db.client.UpdateItemWithContext(ctx, item)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &tes.CancelTaskResponse{}, nil\n}", "func (n *SQSNotify) Stop() {\n\tn.running = false\n\t_ = n.flushDeleteQueue0()\n}", "func stopTimeoutHandler(args []string) {\n\tvar exitCode = 0\n\ttimeout, _ := strconv.Atoi(args[0])\n\tif len(args) > 1 {\n\t\texitCode, _ = strconv.Atoi(args[1])\n\t}\n\n\tfmt.Printf(\"will finish in %dms\\n\", timeout)\n\t<-time.After(time.Millisecond * time.Duration(timeout))\n\n\tos.Exit(exitCode)\n}", "func (pomo *Pomo) Stop() {\n\n\tif pomo.Status == ON {\n\t\tpomo.Cancel <- true\n\t\tpomo.Time = DEFAULT_DURATION\n\t}\n\n}", "func (task *Task) Kill() {\n\tif task.Config.CmdString != \"\" && task.Command.Started && !task.Command.Complete {\n\t\tsyscall.Kill(-task.Command.Cmd.Process.Pid, syscall.SIGKILL)\n\t}\n\n\tfor _, subTask := range task.Children {\n\t\tif subTask.Config.CmdString != \"\" && subTask.Command.Started && !subTask.Command.Complete {\n\t\t\tsyscall.Kill(-subTask.Command.Cmd.Process.Pid, syscall.SIGKILL)\n\t\t}\n\t}\n\n}", "func (app *App) Stop(ctx context.Context) error {\n\treturn withTimeout(ctx, app.lifecycle.Stop)\n}", "func (device *SilentStepperBrick) Stop() (err error) {\n\tvar buf bytes.Buffer\n\n\tresultBytes, err := device.device.Set(uint8(FunctionStop), buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(resultBytes) > 0 {\n\t\tvar header PacketHeader\n\n\t\theader.FillFromBytes(resultBytes)\n\n\t\tif header.Length != 8 {\n\t\t\treturn fmt.Errorf(\"Received packet of unexpected size %d, instead of %d\", header.Length, 8)\n\t\t}\n\n\t\tif header.ErrorCode != 0 {\n\t\t\treturn DeviceError(header.ErrorCode)\n\t\t}\n\n\t\tbytes.NewBuffer(resultBytes[8:])\n\n\t}\n\n\treturn nil\n}", "func (pool *SubPool) Stop() {\n\tpool.StopChan <- struct{}{}\n}", "func (n *Node) Stop() error {\n\tn.opMx.RLock()\n\tdefer n.opMx.RUnlock()\n\tif n.running {\n\t\tsafeCloseChan(n.close)\n\t\treturn nil\n\t}\n\treturn ErrStopNotStarted\n}", "func (d *Driver) Stop() error {\n\tcs := d.client()\n\t_, err := cs.AsyncRequest(&egoscale.StopVirtualMachine{\n\t\tID: d.ID,\n\t}, d.async)\n\n\treturn err\n}", "func (r *Robot) FailTask(name string, args ...string) RetVal {\n\treturn r.pipeTask(flavorFail, typeTask, name, args...)\n}", "func (sn *SimNode) Stop() error {\n\tsn.lock.Lock()\n\tif sn.client != nil {\n\t\tsn.client.Close()\n\t\tsn.client = nil\n\t}\n\tsn.lock.Unlock()\n\treturn sn.node.Stop()\n}", "func (p *Plugin) Stop() {\n\twr := newWaiter()\n\tp.killCh <- wr\n\twr.wait()\n\tp.exitCh <- struct{}{}\n}", "func (pool *TxPool) Stop() {\n\tclose(pool.close)\n\tpool.wg.Wait()\n\n\tlog.Infof(\"TxPool Stopped\")\n}", "func (t *Tuner) Stop() error {\n\tt.mu.Lock()\n\tdefer t.mu.Unlock()\n\n\terr := t.destroyAnyRunningPipeline()\n\tt.status.Set(Status{Error: err})\n\tt.tracks.Set(Tracks{})\n\treturn err\n}", "func (ep *ExpectProcess) Stop() error {\n\terr := ep.Signal(syscall.SIGTERM)\n\tif err != nil && errors.Is(err, os.ErrProcessDone) {\n\t\treturn nil\n\t}\n\treturn err\n}", "func (c *Client) StopNode(nodeID string) error {\n\treturn c.Post(fmt.Sprintf(\"/nodes/%s/stop\", nodeID), nil, nil)\n}", "func (self *JobPipeline) Stop() {\n\tlog.Printf(\"Stopping %s\", self.TaskName)\n\tfor i := range(self.workers) {\n\t\tself.workers[i].Stop()\n\t}\n\tfor i := range(self.workers) {\n\t\tself.workers[i].WaitForStop()\n\t}\n\tlog.Printf(\"%s Stopped\", self.TaskName)\n}", "func (tw *TopologyWatcher) Stop() {\n\ttw.cancelFunc()\n\t// wait for watch goroutine to finish.\n\ttw.wg.Wait()\n}", "func handleTimeoutNotification(task *task.MessageTask, env *task.Env) {\n\tkey := fmt.Sprintf(\"%x\", task.GetMessage().Token)\n\tdelete(env.Requests(), key)\n\tlog.Info(\"<<< handleTimeout Notification>>>\")\n}", "func (p *Pool) Stop() {\n\tp.lock.Lock()\n\tdefer p.lock.Unlock()\n\tp.cancel()\n\tfor _, routine := range p.routines {\n\t\troutine.stop <- true\n\t}\n\tp.waitGroup.Wait()\n\tfor _, routine := range p.routines {\n\t\tclose(routine.stop)\n\t}\n}", "func (t *TCPTest) Stop() {\n\tt.exit<-struct{}{}\n}", "func (t *Timer) Stop() {\n\tt.tickObj.Stop()\n}", "func (s *Server) Stop(timeout int) error {\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second*time.Duration(timeout))\n\tdefer cancel()\n\treturn s.HTTP.Shutdown(ctx)\n}", "func (s *SignalMonitor) Stop() {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tif s.isOn {\n\t\ts.isOn = false\n\t\ts.offc <- struct{}{}\n\t}\n}", "func (o *StopGatewayBundleUsingPOSTParams) WithTimeout(timeout time.Duration) *StopGatewayBundleUsingPOSTParams {\n\to.SetTimeout(timeout)\n\treturn o\n}" ]
[ "0.6536051", "0.61022145", "0.5902817", "0.57699805", "0.5755604", "0.5728442", "0.56008637", "0.549826", "0.5445834", "0.5424107", "0.5390439", "0.53785425", "0.53028846", "0.5296322", "0.52536076", "0.5202666", "0.5167302", "0.50993377", "0.507832", "0.50076854", "0.49846232", "0.49749953", "0.49749953", "0.49307266", "0.4928855", "0.49279425", "0.48768735", "0.4853322", "0.48379624", "0.4831443", "0.48140404", "0.47923818", "0.47759488", "0.47463197", "0.4722326", "0.47043425", "0.4686091", "0.46621978", "0.4643309", "0.46411923", "0.4629522", "0.46124867", "0.45941493", "0.45401618", "0.45401618", "0.45292267", "0.4518759", "0.4516687", "0.45070264", "0.4507", "0.4490949", "0.44791627", "0.44737315", "0.44702205", "0.44687346", "0.44519174", "0.44498596", "0.4445983", "0.44444862", "0.44358045", "0.4432474", "0.44218045", "0.44203535", "0.4406673", "0.4394331", "0.43890363", "0.4387445", "0.43699595", "0.43683076", "0.43683076", "0.4352323", "0.4350847", "0.43239987", "0.432381", "0.43208435", "0.4317084", "0.43059212", "0.42878434", "0.4281372", "0.42649144", "0.42580542", "0.42521518", "0.4247513", "0.42473304", "0.42426768", "0.42388314", "0.42335173", "0.42331445", "0.42302957", "0.42292923", "0.42260396", "0.42246574", "0.42245987", "0.421451", "0.4212215", "0.42096788", "0.42086366", "0.4208215", "0.42068964", "0.4206015" ]
0.7427215
0
DestroyTask function cleans up and removes a task that has terminated. If force is set to true, the driver must destroy the task even if it is still running.
Функция DestroyTask очищает и удаляет задачу, которая завершилась. Если параметр force установлен в true, драйвер должен уничтожить задачу даже если она еще выполняется.
func (d *Driver) DestroyTask(taskID string, force bool) error { handle, ok := d.tasks.Get(taskID) if !ok { return drivers.ErrTaskNotFound } if handle.isRunning() && !force { return fmt.Errorf("cannot destroy running task") } if handle.isRunning() { d.logger.Debug("Have to destroyTask but container is still running", "containerID", handle.containerID) // we can not do anything, so catching the error is useless err := d.podman.ContainerStop(d.ctx, handle.containerID, 60) if err != nil { d.logger.Warn("failed to stop/kill container during destroy", "error", err) } // wait a while for stats emitter to collect exit code etc. for i := 0; i < 20; i++ { if !handle.isRunning() { break } time.Sleep(time.Millisecond * 250) } if handle.isRunning() { d.logger.Warn("stats emitter did not exit while stop/kill container during destroy", "error", err) } } if handle.removeContainerOnExit { err := d.podman.ContainerDelete(d.ctx, handle.containerID, true, true) if err != nil { d.logger.Warn("Could not remove container", "container", handle.containerID, "error", err) } } d.tasks.Delete(taskID) return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CleanTask() {\n\tfor taskID, t := range kv.DefaultClient.GetStorage().Tasks {\n\t\tflag := true\n\t\tfor nid := range kv.DefaultClient.GetStorage().Nodes {\n\t\t\tif t.NodeID == nid {\n\t\t\t\tflag = false\n\t\t\t}\n\t\t}\n\t\tif flag {\n\t\t\tif t.Timer {\n\t\t\t\tlog.Info(\"clean timer:\", taskID)\n\t\t\t\tormTimer := new(orm.Timer)\n\t\t\t\tormTimer.ID = taskID\n\t\t\t\tormTimer.Status = false\n\t\t\t\terr := orm.UpdateTimerStatus(ormTimer)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog.Info(\"clean task:\", taskID)\n\t\t\t\tormTask := new(orm.Task)\n\t\t\t\tormTask.ID = taskID\n\t\t\t\tormTask.Status = \"error\"\n\t\t\t\terr := orm.UpdateTask(ormTask)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tkv.DefaultClient.DeleteTask(taskID)\n\t\t}\n\t}\n}", "func (t *task) deleteTask() {\n\t// There is no state to clean up as of now.\n\t// If the goal state was set to DELETED, then let the\n\t// listeners know that the task has been deleted.\n\n\tvar runtimeCopy *pbtask.RuntimeInfo\n\tvar labelsCopy []*peloton.Label\n\n\t// notify listeners after dropping the lock\n\tdefer func() {\n\t\tif runtimeCopy != nil {\n\t\t\tt.jobFactory.notifyTaskRuntimeChanged(\n\t\t\t\tt.jobID,\n\t\t\t\tt.id,\n\t\t\t\tt.jobType,\n\t\t\t\truntimeCopy,\n\t\t\t\tlabelsCopy,\n\t\t\t)\n\t\t}\n\t}()\n\n\tt.RLock()\n\tdefer t.RUnlock()\n\n\tif t.runtime == nil {\n\t\treturn\n\t}\n\n\tif t.runtime.GetGoalState() != pbtask.TaskState_DELETED {\n\t\treturn\n\t}\n\n\truntimeCopy = proto.Clone(t.runtime).(*pbtask.RuntimeInfo)\n\truntimeCopy.State = pbtask.TaskState_DELETED\n\tlabelsCopy = t.copyLabelsInCache()\n}", "func cleanupTask(ctx context.Context, t *testing.T, c cocoa.ECSClient, runOut *ecs.RunTaskOutput) {\n\tif runOut != nil && len(runOut.Tasks) > 0 && runOut.Tasks[0].TaskArn != nil {\n\t\tout, err := c.StopTask(ctx, &ecs.StopTaskInput{\n\t\t\tCluster: aws.String(testutil.ECSClusterName()),\n\t\t\tTask: aws.String(*runOut.Tasks[0].TaskArn),\n\t\t})\n\t\trequire.NoError(t, err)\n\t\trequire.NotZero(t, out)\n\t}\n}", "func (t *TimeTask) DeleteTask(task *RawTask) {\n\tt.deleteChan <- task\n}", "func (task SchTask) Delete(taskname string, own, force bool) string {\n\tcmd := &exec.Cmd{}\n\n\tif Debug {\n\t\treturn dbgMessage\n\t}\n\n\tif own {\n\t\ttaskname = task.prefix + taskname\n\t}\n\n\tif !force {\n\t\tcmd = exec.Command(task.bin, _Delete.Command, _Delete.taskname, taskname)\n\t} else {\n\t\tcmd = exec.Command(task.bin, _Delete.Command, _Delete.taskname, taskname, _Delete.force)\n\t}\n\n\toutput, err := cmd.CombinedOutput()\n\tcatch(output, err)\n\n\treturn string(output)\n}", "func (task *Task) Kill() {\n\tif task.Config.CmdString != \"\" && task.Command.Started && !task.Command.Complete {\n\t\tsyscall.Kill(-task.Command.Cmd.Process.Pid, syscall.SIGKILL)\n\t}\n\n\tfor _, subTask := range task.Children {\n\t\tif subTask.Config.CmdString != \"\" && subTask.Command.Started && !subTask.Command.Complete {\n\t\t\tsyscall.Kill(-subTask.Command.Cmd.Process.Pid, syscall.SIGKILL)\n\t\t}\n\t}\n\n}", "func DeleteTask(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tfmt.Fprint(w, \"DeleteTask\\n\")\n}", "func RemoveForced(in io.Reader, out io.Writer, args []string, server DeleteServer) error {\n\tpArg, err := strconv.Atoi(args[0])\n\tif err != nil {\n\t\treturn err\n\t}\n\tt, err := GetTaskAtPosition(server, pArg-1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = server.DeleteTask(t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Fprintln(out, \"Removed tasks:\")\n\tfmt.Fprintln(out, fmt.Sprintf(\"%d%s %s \", t.Order, \"X\", t.Title))\n\n\treturn nil\n}", "func cleanupTaskDefinition(ctx context.Context, t *testing.T, c cocoa.ECSClient, out *ecs.RegisterTaskDefinitionOutput) {\n\tif out != nil && out.TaskDefinition != nil && out.TaskDefinition.TaskDefinitionArn != nil {\n\t\tout, err := c.DeregisterTaskDefinition(ctx, &ecs.DeregisterTaskDefinitionInput{\n\t\t\tTaskDefinition: out.TaskDefinition.TaskDefinitionArn,\n\t\t})\n\t\trequire.NoError(t, err)\n\t\trequire.NotZero(t, out)\n\t}\n}", "func (na *cnmNetworkAllocator) DeallocateTask(t *api.Task) error {\n\tdelete(na.tasks, t.ID)\n\treturn na.releaseEndpoints(t.Networks)\n}", "func (md *ManagementNode) DelTask(id string) {\n\tmd.scheduledTasksMtx.Lock()\n\tdefer md.scheduledTasksMtx.Unlock()\n\n\tdelete(md.scheduledTasks, id)\n\n}", "func (r *TaskRepository) DeleteTask(id int64) error{\n\tvar task, _ = r.GetTask(id)\n\n\t// soft delete, according to doc UpdatedAt will be set automatically\n\tr.DB.Model(&task).Update(\"IsDeleted\", true)\n\n return nil\n}", "func CleanTask() {\n\tvar wg sync.WaitGroup\n\tremove := []string{\n\t\t\"pkg/res/data.go\",\n\t\t\"res/generated/bundle.js\",\n\t\t\"res/generated/style.css\",\n\t\t\"browser/chrome-ext/src/src.zip\",\n\t}\n\tremoveAll := []string{\n\t\t\"dist/\",\n\t\t\"dist-archives/\",\n\t\t\"site/\",\n\t\t\"build/\",\n\t\t\"res/generated/\",\n\t\t\"res/messages/_ref\",\n\t\t\"browser/chrome-ext/src/javascripts\",\n\t\t\"AlkasirChromeExtension/\",\n\t}\n\twg.Add(len(remove))\n\twg.Add(len(removeAll))\n\tfor _, v := range remove {\n\t\tgo func(f string) {\n\t\t\tdefer wg.Done()\n\t\t\tos.Remove(f)\n\t\t}(v)\n\t}\n\tfor _, v := range removeAll {\n\t\tgo func(f string) {\n\t\t\tdefer wg.Done()\n\t\t\tos.RemoveAll(f)\n\t\t}(v)\n\t}\n\twg.Wait()\n}", "func (t TaskService) DeleteTask(ctx context.Context, id platform.ID) error {\n\tspan, _ := tracing.StartSpanFromContext(ctx)\n\tdefer span.Finish()\n\n\treturn t.Client.\n\t\tDelete(taskIDPath(id)).\n\t\tDo(ctx)\n}", "func (f *Failer) KillTask(host, task string) error {\n\tscript := \"sudo pkill -x %s\"\n\tlog.V(1).Infof(\"Killing task %s on host %s\", task, host)\n\treturn f.runWithEvilTag(host, fmt.Sprintf(script, task))\n}", "func (z *zpoolctl) Destroy(ctx context.Context, name string, force bool) *execute {\n\targs := []string{\"destroy\"}\n\tif force {\n\t\targs = append(args, \"-f\")\n\t}\n\targs = append(args, name)\n\treturn &execute{ctx: ctx, name: z.cmd, args: args}\n}", "func (o *DeleteNodeParams) SetForce(force *bool) {\n\to.Force = force\n}", "func (c *Client) DeleteTask(ctx context.Context, in *todopb.TaskQuery, opts ...grpc.CallOption) (*empty.Empty, error) {\n\treturn c.client.DeleteTask(ctx, in, opts...)\n}", "func (t *TaskService) DeleteTask(path string) error {\n\tvar err error\n\n\tif path[0] != '\\\\' {\n\t\treturn errors.New(\"path must start with root folder '\\\\'\")\n\t}\n\n\tif !t.registeredTaskExist(path) {\n\t\treturn errors.New(\"registered task doesn't exist\")\n\t}\n\n\t_, err = oleutil.CallMethod(t.rootFolderObj, \"DeleteTask\", path, 0)\n\tif err != nil {\n\t\tif GetOLEErrorCode(err) == 0x80070005 {\n\t\t\treturn fmt.Errorf(\"error deleting %s task: access is denied\", path)\n\t\t}\n\t\treturn fmt.Errorf(\"error deleting %s task: %s\", path, err)\n\t}\n\n\treturn nil\n}", "func (c *Client) TerminateTask(guid string) error {\n\treq := c.NewRequest(\"PUT\", fmt.Sprintf(\"/v3/tasks/%s/cancel\", guid))\n\tresp, err := c.DoRequest(req)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Error terminating task\")\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 202 {\n\t\treturn errors.Wrapf(err, \"Failed terminating task, response status code %d\", resp.StatusCode)\n\t}\n\treturn nil\n}", "func (domain *Domain) DeleteTask(uuid string) error {\n\t// determine task\n\tdomain.TasksX.RLock()\n\t_, ok := domain.Tasks[uuid]\n\tdomain.TasksX.RUnlock()\n\n\tif !ok {\n\t\treturn errors.New(\"task not found\")\n\t}\n\n\t// remove task\n\tdomain.TasksX.Lock()\n\tdelete(domain.Tasks, uuid)\n\tdomain.TasksX.Unlock()\n\n\t// success\n\treturn nil\n}", "func DeleteTask(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\n\tif params[\"id\"] == \"\" {\n\t\thttp.Error(w, http.StatusText(400), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\ttaskID := bson.ObjectIdHex(params[\"id\"])\n\n\tdeleted, err := repository.DeleteTask(taskID)\n\n\tif err != nil {\n\t\thttp.Error(w, http.StatusText(500), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif !deleted {\n\t\thttp.Error(w, http.StatusText(500), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n}", "func DeleteTask(id int) error {\n\treturn db.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket(taskBucket)\n\t\treturn b.Delete(itob(id))\n\t})\n}", "func (c Control) ServeDeleteTask(w http.ResponseWriter, r *http.Request) {\n\tid, err := strconv.ParseInt(r.URL.Query().Get(\"id\"), 10, 64)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tc.Config.Lock()\n\tdefer c.Config.Unlock()\n\tindex, task := c.findTaskById(id)\n\tif task == nil {\n\t\thttp.Error(w, \"Invalid task ID\", http.StatusBadRequest)\n\t\treturn\n\t}\n\ttask.StopLoop()\n\tfor i := index; i < len(c.Config.Tasks)-1; i++ {\n\t\tc.Config.Tasks[i] = c.Config.Tasks[i+1]\n\t}\n\tc.Config.Tasks = c.Config.Tasks[0 : len(c.Config.Tasks)-1]\n\tc.Config.Save()\n\n\thttp.Redirect(w, r, \"/\", http.StatusTemporaryRedirect)\n}", "func (o InstanceOutput) ForceDelete() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.BoolPtrOutput { return v.ForceDelete }).(pulumi.BoolPtrOutput)\n}", "func (s *Storage) DeleteTask(id uint) error {\n\tif _, err := s.db.Exec(\"DELETE FROM tasks WHERE id=$1\", id); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (e *Endpoints) TaskClean(interval time.Duration) {\n\tl := loop.New(loop.WithInterval(interval))\n\tl.Do(func() (bool, error) {\n\t\ttimeUnix := time.Now().Unix()\n\t\tfmt.Println(timeUnix)\n\n\t\tstartTimestamp := timeUnix - TaskCleanDurationTimestamp\n\n\t\tstartTime := time.Unix(startTimestamp, 0).Format(\"2006-01-02 15:04:05\")\n\n\t\t// clean job resource\n\t\tjobs := e.dbclient.ListExpiredJobs(startTime)\n\n\t\tfor _, job := range jobs {\n\t\t\terr := e.dbclient.DeleteJob(strconv.FormatUint(job.OrgID, 10), job.TaskID)\n\t\t\tif err != nil {\n\t\t\t\terr = e.dbclient.DeleteJob(strconv.FormatUint(job.OrgID, 10), job.TaskID)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Errorf(\"failed to delete job, job: %+v, (%+v)\", job, err)\n\t\t\t\t}\n\t\t\t}\n\t\t\tlogrus.Debugf(\"[clean] expired job: %+v\", job)\n\t\t}\n\n\t\t// clean deployment resource\n\t\tdeployments := e.dbclient.ListExpiredDeployments(startTime)\n\n\t\tfor _, deployment := range deployments {\n\t\t\terr := e.dbclient.DeleteDeployment(strconv.FormatUint(deployment.OrgID, 10), deployment.TaskID)\n\t\t\tif err != nil {\n\t\t\t\terr = e.dbclient.DeleteDeployment(strconv.FormatUint(deployment.OrgID, 10), deployment.TaskID)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Errorf(\"failed to delete deployment, deployment: %+v, (%+v)\", deployment, err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlogrus.Debugf(\"[clean] expired deployment: %+v\", deployment)\n\t\t}\n\n\t\treturn false, nil\n\t})\n}", "func (k *KubernetesExecutor) KillTask(driver bindings.ExecutorDriver, taskId *mesos.TaskID) {\n\tif k.isDone() {\n\t\treturn\n\t}\n\tlog.Infof(\"Kill task %v\\n\", taskId)\n\n\tif !k.isConnected() {\n\t\t//TODO(jdefelice) sent TASK_LOST here?\n\t\tlog.Warningf(\"Ignore kill task because the executor is disconnected\\n\")\n\t\treturn\n\t}\n\n\tk.lock.Lock()\n\tdefer k.lock.Unlock()\n\tk.killPodForTask(driver, taskId.GetValue(), messages.TaskKilled)\n}", "func (s *K8sSvc) DeleteTask(ctx context.Context, cluster string, service string, taskType string) error {\n\trequuid := utils.GetReqIDFromContext(ctx)\n\n\ttaskID := service + common.NameSeparator + taskType\n\n\terr := s.cliset.BatchV1().Jobs(s.namespace).Delete(taskID, &metav1.DeleteOptions{})\n\tif err != nil {\n\t\tif k8errors.IsNotFound(err) {\n\t\t\tglog.Infoln(\"task not found\", taskID, \"requuid\", requuid)\n\t\t\treturn nil\n\t\t}\n\t\tglog.Errorln(\"delete task error\", err, \"taskID\", taskID, \"requuid\", requuid)\n\t\treturn err\n\t}\n\n\tglog.Infoln(\"deleted task\", taskID, \"requuid\", requuid)\n\treturn nil\n}", "func (d *Driver) StopTask(taskID string, timeout time.Duration, signal string) error {\n\td.logger.Info(\"Stopping task\", \"taskID\", taskID, \"signal\", signal)\n\thandle, ok := d.tasks.Get(taskID)\n\tif !ok {\n\t\treturn drivers.ErrTaskNotFound\n\t}\n\t// fixme send proper signal to container\n\terr := d.podman.ContainerStop(d.ctx, handle.containerID, int(timeout.Seconds()))\n\tif err != nil {\n\t\td.logger.Error(\"Could not stop/kill container\", \"containerID\", handle.containerID, \"err\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (k *KubernetesExecutor) KillTask(driver bindings.ExecutorDriver, taskId *mesos.TaskID) {\n\tif k.isDone() {\n\t\treturn\n\t}\n\tlog.Infof(\"Kill task %v\\n\", taskId)\n\n\tif !k.isConnected() {\n\t\t//TODO(jdefelice) sent TASK_LOST here?\n\t\tlog.Warningf(\"Ignore kill task because the executor is disconnected\\n\")\n\t\treturn\n\t}\n\n\tk.lock.Lock()\n\tdefer k.lock.Unlock()\n\tk.removePodTask(driver, taskId.GetValue(), messages.TaskKilled, mesos.TaskState_TASK_KILLED)\n}", "func (pv *Provisioner) removeTaskRef(machine *clusterv1.Machine) error {\n\tnmachine := machine.DeepCopy()\n\tif nmachine.ObjectMeta.Annotations == nil {\n\t\treturn nil\n\t}\n\tdelete(nmachine.ObjectMeta.Annotations, constants.VirtualMachineTaskRef)\n\t_, err := pv.clusterV1alpha1.Machines(nmachine.Namespace).Update(nmachine)\n\treturn err\n}", "func KillTask(tid int) Errno {\n\t_, e := internal.Syscall1(KILLTASK, uintptr(tid))\n\treturn Errno(e)\n}", "func (t *TaskService) Delete(w http.ResponseWriter, r *http.Request) {\n\tvar (\n\t\temptyUUID gocql.UUID\n\t\ttaskIDStr = mux.Vars(r)[\"taskID\"]\n\t\tpartnerID = mux.Vars(r)[\"partnerID\"]\n\t\tctx = r.Context()\n\t\tcurrentUser = t.userService.GetUser(r, t.httpClient)\n\t)\n\n\ttaskID, err := gocql.ParseUUID(taskIDStr)\n\tif err != nil || taskID == emptyUUID {\n\t\tlogger.Log.ErrfCtx(r.Context(), errorcode.ErrorTaskIDHasBadFormat, \"TaskService.Delete: task ID(UUID=%s) has bad format or empty. err=%v\", taskIDStr, err)\n\t\tcommon.SendBadRequest(w, r, errorcode.ErrorTaskIDHasBadFormat)\n\t\treturn\n\t}\n\n\tinternalTasks, err := t.taskPersistence.GetByIDs(ctx, nil, partnerID, false, taskID)\n\tif err != nil {\n\t\tlogger.Log.ErrfCtx(r.Context(), errorcode.ErrorCantGetTaskByTaskID, \"TaskService.Delete: can't get internal tasks by task ID %v. err=%v\", taskID, err)\n\t\tcommon.SendInternalServerError(w, r, errorcode.ErrorCantGetTaskByTaskID)\n\t\treturn\n\t}\n\n\tif len(internalTasks) == 0 {\n\t\tlogger.Log.ErrfCtx(r.Context(), errorcode.ErrorTaskIsNotFoundByTaskID, \"TaskService.Delete: task with ID %v not found.\", taskID)\n\t\tcommon.SendBadRequest(w, r, errorcode.ErrorTaskIsNotFoundByTaskID)\n\t\treturn\n\t}\n\n\tcommonTaskData := internalTasks[0]\n\tif currentUser.HasNOCAccess() != commonTaskData.IsRequireNOCAccess {\n\t\tlogger.Log.ErrfCtx(r.Context(), errorcode.ErrorAccessDenied, \"TaskService.Delete: current user %s is not authorized to delete task with ID %v for partnerID %v\", currentUser.UID(), commonTaskData.ID, commonTaskData.PartnerID)\n\t\tcommon.SendForbidden(w, r, errorcode.ErrorAccessDenied)\n\t\treturn\n\t}\n\n\tdto, err := t.getDataToDelete(ctx, taskID, r, w, partnerID)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdto.tasks = internalTasks\n\tif err = t.executeDeleting(dto); err != nil {\n\t\tlogger.Log.ErrfCtx(r.Context(), errorcode.ErrorCantDeleteTask, \"TaskService.Delete: can't process deleting of the task. err=%v\", err)\n\t\tcommon.SendInternalServerError(w, r, errorcode.ErrorCantDeleteTask)\n\t\treturn\n\t}\n\n\tif !currentUser.HasNOCAccess() {\n\t\t// update counters for tasks in separate goroutine\n\t\tgo func(ctx context.Context, iTasks []models.Task) {\n\t\t\tcounters := getCountersForInternalTasks(iTasks)\n\t\t\tif len(counters) == 0 {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\terr := t.taskCounterRepo.DecreaseCounter(commonTaskData.PartnerID, counters, false)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Log.ErrfCtx(ctx, errorcode.ErrorCantProcessData, \"Delete: error while trying to increase counter: \", err)\n\t\t\t}\n\t\t}(ctx, internalTasks)\n\t}\n\n\tlogger.Log.InfofCtx(r.Context(), \"TaskService.Delete: successfully deleted task with ID = %v\", taskID)\n\tcommon.SendNoContent(w)\n}", "func deleteClusterTask(ctx context.Context, t *testing.T, c *clients, name string) {\n\tt.Logf(\"Deleting clustertask %s\", name)\n\tif err := c.ClusterTaskClient.Delete(ctx, name, metav1.DeleteOptions{}); err != nil {\n\t\tt.Fatalf(\"Failed to delete clustertask: %v\", err)\n\t}\n}", "func (t Task) Delete() error {\n\tpath := fmt.Sprintf(\"tasks/%d\", t.ID)\n\t_, err := makeRequest(http.MethodDelete, path, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *ProjectsLocationsMigrationJobsDeleteCall) Force(force bool) *ProjectsLocationsMigrationJobsDeleteCall {\n\tc.urlParams_.Set(\"force\", fmt.Sprint(force))\n\treturn c\n}", "func (access *TaskAccess) DeleteTask(id string) error {\n\treturn access.DB.Where(\"id = ?\", id).First(&models.Task{}).Delete(&models.Task{}).Error\n}", "func DeleteTask(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Access-Control-Allow-Methods\", \"DELETE\")\n\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type\")\n\tparams := mux.Vars(r)\n\tdeleteOneTask(params[\"id\"])\n\tjson.NewEncoder(w).Encode(params[\"id\"])\n}", "func (m TaskManager) AbortTask(c context.Context, ctl task.Controller) error {\n\treturn nil\n}", "func (m TaskManager) AbortTask(c context.Context, ctl task.Controller) error {\n\treturn nil\n}", "func (c Control) ServeStopTask(w http.ResponseWriter, r *http.Request) {\n\tc.ServeTaskAction(w, r, false)\n}", "func (o BucketOutput) ForceDestroy() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *Bucket) pulumi.BoolPtrOutput { return v.ForceDestroy }).(pulumi.BoolPtrOutput)\n}", "func (o *DeleteNodeParams) WithForce(force *bool) *DeleteNodeParams {\n\to.SetForce(force)\n\treturn o\n}", "func (o OceanLaunchSpecDeleteOptionsOutput) ForceDelete() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v OceanLaunchSpecDeleteOptions) bool { return v.ForceDelete }).(pulumi.BoolOutput)\n}", "func DeleteCloudNodeGroupTask(taskID string, stepName string) error {\n\tstart := time.Now()\n\t//get task information and validate\n\tstate, step, err := cloudprovider.GetTaskStateAndCurrentStep(taskID, stepName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif step == nil {\n\t\treturn nil\n\t}\n\n\t// step login started here\n\tcloudID := step.Params[\"CloudID\"]\n\tnodeGroupID := step.Params[\"NodeGroupID\"]\n\tkeepInstance := false\n\tif step.Params[\"KeepInstance\"] == \"true\" {\n\t\tkeepInstance = true\n\t}\n\tgroup, err := cloudprovider.GetStorageModel().GetNodeGroup(context.Background(), nodeGroupID)\n\tif err != nil {\n\t\tblog.Errorf(\"DeleteCloudNodeGroupTask[%s]: get nodegroup for %s failed\", taskID, nodeGroupID)\n\t\tretErr := fmt.Errorf(\"get nodegroup information failed, %s\", err.Error())\n\t\t_ = state.UpdateStepFailure(start, stepName, retErr)\n\t\treturn retErr\n\t}\n\n\t// get cloud and cluster info\n\tcloud, cluster, err := actions.GetCloudAndCluster(cloudprovider.GetStorageModel(), cloudID, group.ClusterID)\n\tif err != nil {\n\t\tblog.Errorf(\"DeleteCloudNodeGroupTask[%s]: get cloud/cluster for nodegroup %s in task %s step %s failed, %s\",\n\t\t\ttaskID, nodeGroupID, taskID, stepName, err.Error())\n\t\tretErr := fmt.Errorf(\"get cloud/cluster information failed, %s\", err.Error())\n\t\t_ = state.UpdateStepFailure(start, stepName, retErr)\n\t\treturn retErr\n\t}\n\n\t// get dependency resource for cloudprovider operation\n\tcmOption, err := cloudprovider.GetCredential(&cloudprovider.CredentialData{\n\t\tCloud: cloud,\n\t\tAccountID: cluster.CloudAccountID,\n\t})\n\tif err != nil {\n\t\tblog.Errorf(\"DeleteCloudNodeGroupTask[%s]: get credential for nodegroup %s in task %s step %s failed, %s\",\n\t\t\ttaskID, nodeGroupID, taskID, stepName, err.Error())\n\t\tretErr := fmt.Errorf(\"get cloud credential err, %s\", err.Error())\n\t\t_ = state.UpdateStepFailure(start, stepName, retErr)\n\t\treturn retErr\n\t}\n\tcmOption.Region = group.Region\n\n\t// create node group\n\ttkeCli, err := api.NewTkeClient(cmOption)\n\tif err != nil {\n\t\tblog.Errorf(\"DeleteCloudNodeGroupTask[%s]: get tke client for nodegroup[%s] in task %s step %s failed, %s\",\n\t\t\ttaskID, nodeGroupID, taskID, stepName, err.Error())\n\t\tretErr := fmt.Errorf(\"get cloud tke client err, %s\", err.Error())\n\t\t_ = state.UpdateStepFailure(start, stepName, retErr)\n\t\treturn err\n\t}\n\terr = tkeCli.DeleteClusterNodePool(cluster.SystemID, []string{group.CloudNodeGroupID}, keepInstance)\n\tif err != nil {\n\t\tblog.Errorf(\"DeleteCloudNodeGroupTask[%s]: call DeleteClusterNodePool[%s] api in task %s step %s failed, %s\",\n\t\t\ttaskID, nodeGroupID, taskID, stepName, err.Error())\n\t\tretErr := fmt.Errorf(\"call DeleteClusterNodePool[%s] api err, %s\", nodeGroupID, err.Error())\n\t\t_ = state.UpdateStepFailure(start, stepName, retErr)\n\t\treturn retErr\n\t}\n\tblog.Infof(\"DeleteCloudNodeGroupTask[%s]: call DeleteClusterNodePool successful\", taskID)\n\n\t// update response information to task common params\n\tif state.Task.CommonParams == nil {\n\t\tstate.Task.CommonParams = make(map[string]string)\n\t}\n\n\t// update step\n\tif err := state.UpdateStepSucc(start, stepName); err != nil {\n\t\tblog.Errorf(\"DeleteCloudNodeGroupTask[%s] task %s %s update to storage fatal\", taskID, taskID, stepName)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (o *VolumeDeleteParams) SetForce(force *bool) {\n\to.Force = force\n}", "func (o EciScalingConfigurationOutput) ForceDelete() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *EciScalingConfiguration) pulumi.BoolPtrOutput { return v.ForceDelete }).(pulumi.BoolPtrOutput)\n}", "func (ctrl *TaskController) DeleteTask(w http.ResponseWriter, r *http.Request) {\n\ttaskId := ParamAsString(\"id\", r)\n\tlogrus.Println(\"delete task : \", taskId)\n\n\terr := ctrl.taskDao.Delete(taskId)\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\tSendJSONError(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tlogrus.Println(\"deleted task : \", taskId)\n\tSendJSONWithHTTPCode(w, nil, http.StatusNoContent)\n}", "func DeleteTask(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Context-Type\", \"application/x-www-form-urlencoded\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Access-Control-Allow-Methods\", \"DELETE\")\n\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type\")\n\tparams := mux.Vars(r)\n\tdeleteOneTask(params[\"id\"])\n\tjson.NewEncoder(w).Encode(params[\"id\"])\n\t// json.NewEncoder(w).Encode(\"Task not found\")\n\n}", "func (r *DeviceAppManagementTaskRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (c *Cluster) ForceDestoryVM(opts compute.VirtualMachine) error {\n\n\tnode, err := c.getNodeRegion(opts.Region)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\topts.T = node.Client\n\tdefer node.Client.Client.Close()\n\n\t_, err = opts.RecoverDelete()\n\tif err != nil {\n\t\treturn wrapErrorWithCmd(node, err, \"DestroyVM\")\n\t}\n\n\treturn nil\n}", "func deleteTask(id interface{}) {\n\ti, ok := getTaskPosition(id)\n\tif ok == true {\n\t\ttasks_mutex.Lock()\n\t\ttasks = append(tasks[:i], tasks[i+1:]...)\n\t\ttasks_mutex.Unlock()\n\t}\n}", "func DeleteTask(c *gin.Context) {\n\tfmt.Println(\"deleteTask\")\n\ttask := c.Param(\"id\")\n\tfmt.Println(\"task_id: \", task)\n\tdeleteOneTask(task)\n\tc.JSON(http.StatusOK, task)\n\t// json.NewEncoder(w).Encode(\"Task not found\")\n\n}", "func (s *StubTodoStore) DeleteTask(task model.Task) error {\n\tfor i, storeTask := range s.Tasks {\n\t\tif storeTask.Name == task.Name {\n\t\t\ts.Tasks = append(s.Tasks[:i], s.Tasks[(i+1):]...)\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn nil\n}", "func DeleteTask(taskKey int) error {\n\t// connect to database\n\tdb, err := connect(dbString)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Could Not Connect to db\")\n\t}\n\tdefer db.Close()\n\n\t// read/write transaction\n\terr = db.Update(func(tx *bolt.Tx) error {\n\t\tbucket, err := tx.CreateBucketIfNotExists(bucketName)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"Failed to create non existant bucket: %s\", string(bucketName))\n\t\t}\n\n\t\t// delete task from database\n\t\terr = bucket.Delete(itob(taskKey))\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"Could not Delete item %d\", taskKey)\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Could not complete transaction\")\n\t}\n\n\treturn nil\n}", "func (t *TaskController[T, U, C, CT, TF]) Wait() {\n\tt.wg.Wait()\n\tclose(t.resultCh)\n\tt.pool.DeleteTask(t.taskID)\n}", "func (o OceanLaunchSpecDeleteOptionsPtrOutput) ForceDelete() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *OceanLaunchSpecDeleteOptions) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.ForceDelete\n\t}).(pulumi.BoolPtrOutput)\n}", "func DeleteTKEClusterTask(taskID string, stepName string) error {\n\tstart := time.Now()\n\t// get task and task current step\n\tstate, step, err := cloudprovider.GetTaskStateAndCurrentStep(taskID, stepName)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// previous step successful when retry task\n\tif step == nil {\n\t\tblog.Infof(\"DeleteTKEClusterTask[%s]: current step[%s] successful and skip\", taskID, stepName)\n\t\treturn nil\n\t}\n\tblog.Infof(\"DeleteTKEClusterTask[%s]: task %s run step %s, system: %s, old state: %s, params %v\",\n\t\ttaskID, taskID, stepName, step.System, step.Status, step.Params)\n\n\t// step login started here\n\tclusterID := step.Params[cloudprovider.ClusterIDKey.String()]\n\tcloudID := step.Params[cloudprovider.CloudIDKey.String()]\n\tdeleteMode := step.Params[cloudprovider.DeleteModeKey.String()]\n\n\t// only support retain mode\n\tif deleteMode != cloudprovider.Retain.String() {\n\t\tdeleteMode = cloudprovider.Retain.String()\n\t}\n\n\tdependInfo, err := cloudprovider.GetClusterDependBasicInfo(cloudprovider.GetBasicInfoReq{\n\t\tClusterID: clusterID,\n\t\tCloudID: cloudID,\n\t})\n\tif err != nil {\n\t\tblog.Errorf(\"DeleteTKEClusterTask[%s]: GetClusterDependBasicInfo for cluster %s \"+\n\t\t\t\"in task %s step %s failed, %s\", taskID, clusterID, taskID, stepName, err.Error())\n\t\tretErr := fmt.Errorf(\"get cloud/project information failed, %s\", err.Error())\n\t\t_ = state.UpdateStepFailure(start, stepName, retErr)\n\t\treturn retErr\n\t}\n\n\t// get qcloud client\n\tcli, err := api.NewTkeClient(dependInfo.CmOption)\n\tif err != nil {\n\t\tblog.Errorf(\"DeleteTKEClusterTask[%s]: get tke client for cluster[%s] in task %s step %s failed, %s\",\n\t\t\ttaskID, clusterID, taskID, stepName, err.Error())\n\t\tretErr := fmt.Errorf(\"get cloud tke client err, %s\", err.Error())\n\t\t_ = state.UpdateStepFailure(start, stepName, retErr)\n\t\treturn retErr\n\t}\n\n\tif dependInfo.Cluster.SystemID != \"\" {\n\t\terr = cli.DeleteTKECluster(dependInfo.Cluster.SystemID, api.DeleteMode(deleteMode))\n\t\tif err != nil {\n\t\t\tblog.Errorf(\"DeleteTKEClusterTask[%s]: task[%s] step[%s] call qcloud DeleteTKECluster failed: %v\",\n\t\t\t\ttaskID, taskID, stepName, err)\n\t\t\tretErr := fmt.Errorf(\"call qcloud DeleteTKECluster failed: %s\", err.Error())\n\t\t\t_ = state.UpdateStepFailure(start, stepName, retErr)\n\t\t\treturn retErr\n\t\t}\n\t\t_ = updateClusterSystemID(clusterID, \"\")\n\t\tblog.Infof(\"DeleteTKEClusterTask[%s]: task %s DeleteTKECluster[%s] successful\",\n\t\t\ttaskID, taskID, dependInfo.Cluster.SystemID)\n\t} else {\n\t\tblog.Infof(\"DeleteTKEClusterTask[%s]: task %s DeleteTKECluster skip current step \"+\n\t\t\t\"because SystemID empty\", taskID, taskID)\n\t}\n\n\tif err := state.UpdateStepSucc(start, stepName); err != nil {\n\t\tblog.Errorf(\"DeleteTKEClusterTask[%s]: task %s %s update to storage fatal\", taskID, taskID, stepName)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *restClient) DeleteTask(ctx context.Context, req *cloudtaskspb.DeleteTaskRequest, opts ...gax.CallOption) error {\n\tbaseUrl, err := url.Parse(c.endpoint)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbaseUrl.Path += fmt.Sprintf(\"/v2beta3/%v\", req.GetName())\n\n\tparams := url.Values{}\n\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\n\tbaseUrl.RawQuery = params.Encode()\n\n\t// Build HTTP headers from client and context metadata.\n\thds := []string{\"x-goog-request-params\", fmt.Sprintf(\"%s=%v\", \"name\", url.QueryEscape(req.GetName()))}\n\n\thds = append(c.xGoogHeaders, hds...)\n\thds = append(hds, \"Content-Type\", \"application/json\")\n\theaders := gax.BuildHeaders(ctx, hds...)\n\treturn gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\tif settings.Path != \"\" {\n\t\t\tbaseUrl.Path = settings.Path\n\t\t}\n\t\thttpReq, err := http.NewRequest(\"DELETE\", baseUrl.String(), nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttpReq = httpReq.WithContext(ctx)\n\t\thttpReq.Header = headers\n\n\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer httpRsp.Body.Close()\n\n\t\t// Returns nil if there is no error, otherwise wraps\n\t\t// the response code and body into a non-nil error\n\t\treturn googleapi.CheckResponse(httpRsp)\n\t}, opts...)\n}", "func (r ApiApiDeploymentsIdDeleteRequest) Force(force string) ApiApiDeploymentsIdDeleteRequest {\n\tr.force = &force\n\treturn r\n}", "func (a *Client) DeleteTask(params *DeleteTaskParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteTaskNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteTaskParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"deleteTask\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/tasks/{id}\",\n\t\tProducesMediaTypes: []string{\"application/vnd.goswagger.examples.task-tracker.v1+json\"},\n\t\tConsumesMediaTypes: []string{\"application/vnd.goswagger.examples.task-tracker.v1+json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteTaskReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*DeleteTaskNoContent)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*DeleteTaskDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "func DeleteTask(w http.ResponseWriter, r *http.Request, repo *tasks.TaskRepository) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tparams := mux.Vars(r)\n\ttaskID, err := strconv.Atoi(params[\"id\"])\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ttask, err := repo.DeleteTask(taskID)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tjson.NewEncoder(w).Encode(apiIndexTask(task))\n}", "func (c *ProjectsLocationsConnectionProfilesDeleteCall) Force(force bool) *ProjectsLocationsConnectionProfilesDeleteCall {\n\tc.urlParams_.Set(\"force\", fmt.Sprint(force))\n\treturn c\n}", "func DeleteJobTask(w http.ResponseWriter, r *http.Request) {\n\tresponse := services.DeleteJobTask(r)\n\n\trender.Status(r, response.Code)\n\trender.JSON(w, r, response)\n}", "func (ts *TaskService) Delete(ctx context.Context, req *taskAPI.DeleteRequest) (*taskAPI.DeleteResponse, error) {\n\tdefer logPanicAndDie(log.G(ctx))\n\n\tlog.G(ctx).WithFields(logrus.Fields{\"id\": req.ID, \"exec_id\": req.ExecID}).Debug(\"delete\")\n\ttask, err := ts.taskManager.Task(req.ID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tctx = namespaces.WithNamespace(ctx, defaultNamespace)\n\tresp, err := task.Delete(ctx, req)\n\tif err != nil {\n\t\tlog.G(ctx).WithError(err).Error(\"delete failed\")\n\t\treturn nil, err\n\t}\n\n\tlog.G(ctx).WithFields(logrus.Fields{\n\t\t\"pid\": resp.Pid,\n\t\t\"exit_status\": resp.ExitStatus,\n\t}).Debug(\"delete succeeded\")\n\treturn resp, nil\n}", "func (c *Client) DeleteWorkforce(ctx context.Context, params *DeleteWorkforceInput, optFns ...func(*Options)) (*DeleteWorkforceOutput, error) {\n\tif params == nil {\n\t\tparams = &DeleteWorkforceInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"DeleteWorkforce\", params, optFns, addOperationDeleteWorkforceMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*DeleteWorkforceOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func deleteTaskMeta(db *leveldb.DB, name string) error {\n\tif db == nil {\n\t\treturn terror.ErrWorkerLogInvalidHandler.Generate()\n\t}\n\n\terr := db.Delete(encodeTaskMetaKey(name), nil)\n\tif err != nil {\n\t\treturn terror.ErrWorkerLogDeleteTaskMeta.Delegate(err, name)\n\t}\n\n\treturn nil\n}", "func (t *PodTask) ClearTaskInfo() {\n\tt.OfferIds = nil\n\tt.TaskInfo.TaskId = nil\n\tt.TaskInfo.SlaveId = nil\n\tt.TaskInfo.Resources = nil\n\tt.TaskInfo.Data = nil\n}", "func (t *task) cleanTaskCache() {\n\tt.runtime = nil\n\tt.config = nil\n}", "func (sysload *SystemLoad) RemoveTask(id uint64) {\n\ttaskLoad := sysload.findTask(id)\n\tif taskLoad != nil {\n\t\tsysload.tasksLoad.Remove(taskLoad)\n\t}\n}", "func (t *task) replaceTask(\n\truntime *pbtask.RuntimeInfo,\n\ttaskConfig *pbtask.TaskConfig,\n\tforceReplace bool) error {\n\tif runtime == nil || runtime.GetRevision() == nil {\n\t\treturn yarpcerrors.InvalidArgumentErrorf(\n\t\t\t\"replaceTask expects a non-nil runtime with non-nil Revision\")\n\t}\n\n\tvar runtimeCopy *pbtask.RuntimeInfo\n\tvar labelsCopy []*peloton.Label\n\n\t// notify listeners after dropping the lock\n\tdefer func() {\n\t\tt.jobFactory.notifyTaskRuntimeChanged(\n\t\t\tt.JobID(),\n\t\t\tt.ID(),\n\t\t\tt.jobType,\n\t\t\truntimeCopy,\n\t\t\tlabelsCopy,\n\t\t)\n\t}()\n\n\tt.Lock()\n\tdefer t.Unlock()\n\n\t// update the cache if,\n\t// 1. it is a force replace, or\n\t// 2. there is no existing runtime cache,\n\t// 3. new runtime has a higher version number than the existing\n\tif forceReplace ||\n\t\tt.runtime == nil ||\n\t\truntime.GetRevision().GetVersion() > t.runtime.GetRevision().GetVersion() {\n\t\t// Update task config and runtime\n\t\tt.config = &taskConfigCache{\n\t\t\tconfigVersion: runtime.GetConfigVersion(),\n\t\t\tlabels: taskConfig.GetLabels(),\n\t\t}\n\t\tt.runtime = runtime\n\t\truntimeCopy = proto.Clone(t.runtime).(*pbtask.RuntimeInfo)\n\t\tlabelsCopy = t.copyLabelsInCache()\n\t}\n\n\treturn nil\n}", "func (o *Orchestrator) RemoveTask(taskDefinition interface{}) {\n\to.mu.Lock()\n\tdefer o.mu.Unlock()\n\n\tidx := containsTask(taskDefinition, o.expectedTasks)\n\tif idx < 0 {\n\t\treturn\n\t}\n\n\to.expectedTasks = append(o.expectedTasks[:idx], o.expectedTasks[idx+1:]...)\n}", "func HandleDeleteTask(w http.ResponseWriter, r *http.Request) {\n\tlog.Root.Info(\"HandleDeleteTask BEGIN\")\n\n\tif r.Method != http.MethodPost {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tHttpResponseError(w, ErrNotFound)\n\t\treturn\n\t}\n\n\tdefer r.Body.Close()\n\tbody, _ := ioutil.ReadAll(r.Body)\n\n\tdata := make(map[string]interface{})\n\terr := json.Unmarshal(body, &data)\n\tif err != nil {\n\t\tlog.Root.Error(\"HandleDeleteTask Parse HTTP request body error\")\n\t\tHttpResponseError(w, ErrForm)\n\t\treturn\n\t}\n\n\telem, ok := data[\"taskID\"]\n\tif !ok {\n\t\tlog.Root.Error(\"HandleDeleteTask HTTP form data error\")\n\t\tHttpResponseError(w, ErrForm)\n\t\treturn\n\t}\n\n\ttaskID := elem.(string)\n\terr = node.DeleteTask(taskID)\n\tif err != nil {\n\t\tlog.Root.Error(\"HandleDeleteTask Delete task error. TaskID: %v\", taskID)\n\t\tHttpResponseError(w, ErrServer)\n\t\treturn\n\t}\n\n\tlog.Root.Info(\"HandleDeleteTask END\")\n\tHttpResponseOk(w)\n\treturn\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) SetForce(force *bool) {\n\to.Force = force\n}", "func CtrStopContainer(containerID string, force bool) error {\n\tif err := verifyCtr(); err != nil {\n\t\treturn fmt.Errorf(\"CtrStopContainer: exception while verifying ctrd client: %s\", err.Error())\n\t}\n\tctr, err := CtrLoadContainer(containerID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't find cotainer %s (%v)\", containerID, err)\n\t}\n\n\tsignal, err := containerd.ParseSignal(defaultSignal)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif signal, err = containerd.GetStopSignal(ctrdCtx, ctr, signal); err != nil {\n\t\treturn err\n\t}\n\n\ttask, err := ctr.Task(ctrdCtx, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// it is unclear whether we have to wait after this or proceed\n\t// straight away. It is also unclear whether paying any attention\n\t// to the err returned is worth anything at this point\n\t_ = task.Kill(ctrdCtx, signal, containerd.WithKillAll)\n\n\tif force {\n\t\t_, err = task.Delete(ctrdCtx, containerd.WithProcessKill)\n\t} else {\n\t\t_, err = task.Delete(ctrdCtx)\n\t}\n\n\treturn err\n}", "func deleteTask(writer http.ResponseWriter, req *http.Request) {\n\tvars := mux.Vars(req)\n\tcreatedAt, err := time.Parse(time.RFC3339, vars[\"createdAt\"])\n\tif err != nil {\n\t\tlog.Print(\"error:\", err)\n\t\thttp.Error(writer, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tdatabase, err := loadJsonFile()\n\tif err != nil {\n\t\tlog.Print(\"error:\", err)\n\t\thttp.Error(writer, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tfor i, _ := range database.Tasks {\n\t\tif database.Tasks[i].CreatedAt.Equal(createdAt) {\n\t\t\tdatabase.Tasks = append(database.Tasks[:i], database.Tasks[i+1:]...)\n\t\t\treturnJson(database, writer)\n\t\t\treturn\n\t\t}\n\t}\n\t//this code runs only if no taks was found with the correct createdAt timestamp\n\thttp.Error(writer, err.Error(), http.StatusBadRequest)\n}", "func deleteTask(w http.ResponseWriter, r *http.Request){\n\t//definimos variable de vars que devuelve las variables de ruta\n\tvars := mux.Vars(r)\n\n\ttaskID, err := strconv.Atoi(vars[\"id\"])\n\tif err != nil{\n\t\tfmt.Fprintf(w, \"Invalid ID\")\n\t\treturn\n\t}\n\n\t//Se elimina la task a la lista, guardando todas las que estan hasta su indice, y la que le sigue en adelante.\n\tfor i, task := range tasks {\n\t\tif task.ID == taskID {\n\t\t\ttasks = append(tasks[:i], tasks[i + 1:] ...)\n\t\t\tfmt.Fprintf(w, \"The task with ID %v has been removed succesfully\", taskID)\n\t\t}\n\t}\n}", "func (c *clustermgrClient) DeleteMigrateTask(ctx context.Context, key string) (err error) {\n\treturn c.client.DeleteKV(ctx, key)\n}", "func (options *DeleteJobOptions) SetForce(force bool) *DeleteJobOptions {\n\toptions.Force = core.BoolPtr(force)\n\treturn options\n}", "func (p *PruneTask) ClearTimeout() {}", "func (ts *TaskService) Delete(requestCtx context.Context, req *taskAPI.DeleteRequest) (*taskAPI.DeleteResponse, error) {\n\tdefer logPanicAndDie(log.G(requestCtx))\n\tlog.G(requestCtx).WithFields(logrus.Fields{\"id\": req.ID, \"exec_id\": req.ExecID}).Debug(\"delete\")\n\n\tresp, err := ts.taskManager.DeleteProcess(requestCtx, req, ts.runcService)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.G(requestCtx).WithFields(logrus.Fields{\n\t\t\"pid\": resp.Pid,\n\t\t\"exit_status\": resp.ExitStatus,\n\t}).Debug(\"delete succeeded\")\n\treturn resp, nil\n}", "func (o TaskDefinitionOutput) SkipDestroy() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *TaskDefinition) pulumi.BoolPtrOutput { return v.SkipDestroy }).(pulumi.BoolPtrOutput)\n}", "func ReleaseTask() {\n\tRun(\"clean\")\n\toptimizeFlag = true\n\txcnFlag = true\n\tbs := getGoBuilders()\n\tif bs.needsBrowser() {\n\t\tRun(\"deps\")\n\t\tRun(\"browser\")\n\t\tRun(\"chrome\")\n\t\tRun(\"bindata\")\n\t}\n\tbs.RunAll()\n\tbs.CreateReleaseArchives()\n}", "func CleanClusterDBInfoTask(taskID string, stepName string) error {\n\tstart := time.Now()\n\t// get task and task current step\n\tstate, step, err := cloudprovider.GetTaskStateAndCurrentStep(taskID, stepName)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// previous step successful when retry task\n\tif step == nil {\n\t\tblog.Infof(\"CleanClusterDBInfoTask[%s]: current step[%s] successful and skip\", taskID, stepName)\n\t\treturn nil\n\t}\n\tblog.Infof(\"CleanClusterDBInfoTask[%s]: task %s run step %s, system: %s, old state: %s, params %v\",\n\t\ttaskID, taskID, stepName, step.System, step.Status, step.Params)\n\n\t// step login started here\n\tclusterID := step.Params[cloudprovider.ClusterIDKey.String()]\n\tcluster, err := cloudprovider.GetStorageModel().GetCluster(context.Background(), clusterID)\n\tif err != nil {\n\t\tblog.Errorf(\"CleanClusterDBInfoTask[%s]: get cluster for %s failed\", taskID, clusterID)\n\t\tretErr := fmt.Errorf(\"get cluster information failed, %s\", err.Error())\n\t\t_ = state.UpdateStepFailure(start, stepName, retErr)\n\t\treturn retErr\n\t}\n\n\t// delete cluster autoscalingOption\n\terr = cloudprovider.GetStorageModel().DeleteAutoScalingOption(context.Background(), cluster.ClusterID)\n\tif err != nil {\n\t\tblog.Errorf(\"CleanClusterDBInfoTask[%s]: clean cluster[%s] \"+\n\t\t\t\"autoscalingOption failed: %v\", taskID, cluster.ClusterID, err)\n\t}\n\n\t// delete nodes\n\terr = cloudprovider.GetStorageModel().DeleteNodesByClusterID(context.Background(), cluster.ClusterID)\n\tif err != nil {\n\t\tblog.Errorf(\"CleanClusterDBInfoTask[%s]: delete nodes for %s failed\", taskID, clusterID)\n\t\tretErr := fmt.Errorf(\"delete node for %s failed, %s\", clusterID, err.Error())\n\t\t_ = state.UpdateStepFailure(start, stepName, retErr)\n\t\treturn retErr\n\t}\n\tblog.Infof(\"CleanClusterDBInfoTask[%s]: delete nodes for cluster[%s] in DB successful\", taskID, clusterID)\n\n\t// delete nodeGroup\n\terr = cloudprovider.GetStorageModel().DeleteNodeGroupByClusterID(context.Background(), cluster.ClusterID)\n\tif err != nil {\n\t\tblog.Errorf(\"CleanClusterDBInfoTask[%s]: delete nodeGroups for %s failed\", taskID, clusterID)\n\t\tretErr := fmt.Errorf(\"delete nodeGroups for %s failed, %s\", clusterID, err.Error())\n\t\t_ = state.UpdateStepFailure(start, stepName, retErr)\n\t\treturn retErr\n\t}\n\tblog.Infof(\"CleanClusterDBInfoTask[%s]: delete nodeGroups for cluster[%s] in DB successful\",\n\t\ttaskID, clusterID)\n\n\t// delete CIDR and only print logInfo\n\terr = releaseClusterCIDR(cluster)\n\tif err != nil {\n\t\tblog.Errorf(\"CleanClusterDBInfoTask[%s]: releaseClusterCIDR[%s] cidr failed\", taskID, clusterID)\n\t} else {\n\t\tblog.Infof(\"CleanClusterDBInfoTask[%s]: releaseClusterCIDR[%s] cidr successful\", taskID, clusterID)\n\t}\n\n\t// delete cluster\n\tcluster.Status = icommon.StatusDeleting\n\terr = cloudprovider.GetStorageModel().UpdateCluster(context.Background(), cluster)\n\tif err != nil {\n\t\tblog.Errorf(\"CleanClusterDBInfoTask[%s]: delete cluster for %s failed\", taskID, clusterID)\n\t\tretErr := fmt.Errorf(\"delete cluster for %s failed, %s\", clusterID, err.Error())\n\t\t_ = state.UpdateStepFailure(start, stepName, retErr)\n\t\treturn retErr\n\t}\n\tblog.Infof(\"CleanClusterDBInfoTask[%s]: delete cluster[%s] in DB successful\", taskID, clusterID)\n\n\tutils.SyncDeletePassCCCluster(taskID, cluster)\n\t_ = utils.DeleteClusterCredentialInfo(cluster.ClusterID)\n\n\t// virtual cluster need to clean cluster token\n\tif cluster.ClusterType == icommon.ClusterTypeVirtual {\n\t\t_ = utils.DeleteBcsAgentToken(clusterID)\n\t}\n\n\tif err := state.UpdateStepSucc(start, stepName); err != nil {\n\t\tblog.Errorf(\"CleanClusterDBInfoTask[%s]: task %s %s update to storage fatal\", taskID, taskID, stepName)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *Job) AfterExecuteTask() *Job {\n\tif c.delayUnit == delayNone {\n\t\tc.timingMode = afterExecuteTask\n\t}\n\treturn c\n}", "func DelContainerForce(c *check.C, cname string) (*http.Response, error) {\n\tq := url.Values{}\n\tq.Add(\"force\", \"true\")\n\tq.Add(\"v\", \"true\")\n\treturn request.Delete(\"/containers/\"+cname, request.WithQuery(q))\n}", "func (s *DeleteTaskSetInput) SetForce(v bool) *DeleteTaskSetInput {\n\ts.Force = &v\n\treturn s\n}", "func (options *DeleteActionOptions) SetForce(force bool) *DeleteActionOptions {\n\toptions.Force = core.BoolPtr(force)\n\treturn options\n}", "func (t Task) Delete(id string) error {\n\terr := os.RemoveAll(path.Dir(t.Path))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, user := range DB.Users {\n\t\tdelete(user.Tasks, id)\n\t}\n\n\tdelete(DB.Tasks, id)\n\tWriteJSON(\"db.json\", DB)\n\n\treturn nil\n}", "func deleteTask(taskID int) {\n\n\ttrepo := sqlite.NewTaskRepo()\n\n\ttrepo.DeleteTask(taskID)\n\tfmt.Println(\"Tarea borrada correctamente\")\n}", "func (dtm *DfgetTaskManager) Delete(ctx context.Context, clientID, taskID string) error {\n\tkey, err := generateKey(clientID, taskID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn dtm.dfgetTaskStore.Delete(key)\n}", "func deleteTask(w http.ResponseWriter, r *http.Request) {\r\n\tvars := mux.Vars(r) //copio del anterior porque el metodo de busqueda es el mismo\r\n\ttaskID, err := strconv.Atoi(vars[\"id\"])\r\n\tif err != nil {\r\n\t\tfmt.Fprintf(w, \"Invalid ID\")\r\n\t\treturn\r\n\t}\r\n\tfor i, task := range tasks { //misma busqueda que en el caso anterior\r\n\t\tif task.ID == taskID {\r\n\t\t\ttasks = append(tasks[:i], tasks[i+1:]...) //en realidad no borra sino que arma un slice con los elementos previos y posteriores al indice dado\r\n\t\t\tfmt.Fprintf(w, \"The task with ID: %v has been successfully removed.\", taskID)\r\n\t\t}\r\n\t}\r\n}", "func (k *KubernetesExecutor) killPodForTask(driver bindings.ExecutorDriver, tid, reason string) {\n\tk.removePodTask(driver, tid, reason, mesos.TaskState_TASK_KILLED)\n}", "func (h *Heartbeat) RemoveTask(name string) error {\n\th.lock <- struct{}{}\n\tdefer func() {\n\t\t<-h.lock\n\t}()\n\tif _, ok := h.slavesTs[name]; !ok {\n\t\treturn terror.ErrSyncerUnitHeartbeatRecordNotFound.Generate(name)\n\t}\n\tdelete(h.slavesTs, name)\n\n\tif len(h.slavesTs) == 0 {\n\t\t// cancel work\n\t\th.cancel()\n\t\th.cancel = nil\n\t\th.wg.Wait()\n\n\t\t// close DB\n\t\th.master.Close()\n\t\th.master = nil\n\t}\n\n\treturn nil\n}", "func FinishTask(taskID string) error {\n\ttasks.Lock()\n\tdefer tasks.Unlock()\n\n\tif _, ok := tasks.m[taskID]; ok { // key exist\n\t\tdelete(tasks.m, taskID)\n\t\treturn nil\n\t}\n\n\treturn errors.New(\"Task not exist\")\n}", "func (r *Bucket) ForceDestroy() pulumi.BoolOutput {\n\treturn (pulumi.BoolOutput)(r.s.State[\"forceDestroy\"])\n}", "func deleteOneTask(task string) {\n\tfmt.Println(task)\n\tid, _ := primitive.ObjectIDFromHex(task)\n\tfilter := bson.M{\"_id\": id}\n\t_, err := collection.DeleteOne(context.Background(), filter)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Println(\"Deleted task\", id)\n}", "func Run(task structs.Task, threadChannel chan<- structs.ThreadMsg) {\n\ttMsg := structs.ThreadMsg{}\n\ttMsg.Error = false\n\ttMsg.TaskItem = task\n\n\tparams := strings.TrimSpace(task.Params)\n\terr := os.Unsetenv(params)\n\n\tif err != nil {\n\t\ttMsg.Error = true\n\t\ttMsg.TaskResult = []byte(err.Error())\n\t\tthreadChannel <- tMsg\n\t\treturn\n\t}\n\n\ttMsg.TaskResult = []byte(fmt.Sprintf(\"Successfully cleared %s\", params))\n\tthreadChannel <- tMsg\n}", "func (h *Hub) StopTask(ctx context.Context, request *pb.StopTaskRequest) (*pb.StopTaskReply, error) {\n\tlog.G(h.ctx).Info(\"handling StopTask request\", zap.Any(\"req\", request))\n\ttaskID := request.Id\n\tminerID, ok := h.getMinerByTaskID(taskID)\n\tif !ok {\n\t\treturn nil, status.Errorf(codes.NotFound, \"no such task %s\", taskID)\n\t}\n\n\tminer, ok := h.getMinerByID(minerID)\n\tif !ok {\n\t\treturn nil, status.Errorf(codes.NotFound, \"no miner with task %s\", minerID)\n\t}\n\n\t_, err := miner.Client.Stop(ctx, &pb.StopTaskRequest{Id: taskID})\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.NotFound, \"failed to stop the task %s\", taskID)\n\t}\n\n\tminer.deregisterRoute(taskID)\n\tminer.Retain(taskID)\n\n\th.deleteTaskByID(taskID)\n\n\treturn &pb.StopTaskReply{}, nil\n}" ]
[ "0.60128415", "0.59829104", "0.59223276", "0.5853163", "0.5822631", "0.5637229", "0.55053747", "0.5499162", "0.54739857", "0.54706156", "0.5426137", "0.54249454", "0.5411983", "0.5394763", "0.53803176", "0.5303343", "0.529844", "0.52842695", "0.52794904", "0.526981", "0.52620506", "0.52614605", "0.52438265", "0.5229123", "0.52031994", "0.52016747", "0.5198306", "0.5193687", "0.5182462", "0.516419", "0.5158677", "0.5154214", "0.51256126", "0.51209474", "0.5080228", "0.507524", "0.50470334", "0.5025553", "0.5022043", "0.5003506", "0.5003506", "0.49824268", "0.49779436", "0.49666533", "0.49641287", "0.49600813", "0.49511868", "0.49462786", "0.49231607", "0.4920158", "0.4897834", "0.48959228", "0.48950416", "0.4893433", "0.48785496", "0.4878278", "0.48781827", "0.48748326", "0.48673394", "0.48550013", "0.48445103", "0.48237336", "0.48209566", "0.48189393", "0.4788337", "0.47846553", "0.47768438", "0.4771809", "0.4770359", "0.47581577", "0.47552618", "0.4751539", "0.47435454", "0.47347307", "0.4725758", "0.4714502", "0.47056973", "0.47044498", "0.46800032", "0.46674934", "0.4664395", "0.46612114", "0.46532768", "0.46527845", "0.464209", "0.46356976", "0.46270242", "0.46268144", "0.46195802", "0.46157256", "0.46102428", "0.4605348", "0.46036488", "0.45955518", "0.45602873", "0.4557687", "0.4554907", "0.45543045", "0.45530924", "0.45441574" ]
0.7716327
0
InspectTask function returns detailed status information for the referenced taskID.
Функция InspectTask возвращает подробную информацию о статусе для отсылаемого taskID.
func (d *Driver) InspectTask(taskID string) (*drivers.TaskStatus, error) { d.logger.Debug("InspectTask called") handle, ok := d.tasks.Get(taskID) if !ok { return nil, drivers.ErrTaskNotFound } return handle.taskStatus(), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Client) InspectTask(id string) (*swarm.Task, error) {\n\tresp, err := c.do(http.MethodGet, \"/tasks/\"+id, doOptions{})\n\tif err != nil {\n\t\tvar e *Error\n\t\tif errors.As(err, &e) && e.Status == http.StatusNotFound {\n\t\t\treturn nil, &NoSuchTask{ID: id}\n\t\t}\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tvar task swarm.Task\n\tif err := json.NewDecoder(resp.Body).Decode(&task); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &task, nil\n}", "func (ts *TasksRPC) GetTaskMonitor(ctx context.Context, req *taskproto.GetTaskRequest) (*taskproto.TaskResponse, error) {\n\tvar rsp taskproto.TaskResponse\n\tctx = common.GetContextData(ctx)\n\tctx = common.ModifyContext(ctx, common.TaskService, podName)\n\n\tl.LogWithFields(ctx).Debugf(\"Incoming request to get the task details and response body for the task %v\", req.TaskID)\n\trsp.Header = map[string]string{\n\t\t\"Date\": time.Now().Format(http.TimeFormat),\n\t}\n\tprivileges := []string{common.PrivilegeLogin}\n\tauthResp, err := ts.AuthenticationRPC(ctx, req.SessionToken, privileges)\n\tif authResp.StatusCode != http.StatusOK {\n\t\tif err != nil {\n\t\t\tl.LogWithFields(ctx).Errorf(\"Error while authorizing the session token : %s\", err.Error())\n\t\t}\n\t\tfillProtoResponse(ctx, &rsp, authResp)\n\t\treturn &rsp, nil\n\t}\n\t_, err = ts.GetSessionUserNameRPC(ctx, req.SessionToken)\n\tif err != nil {\n\t\tl.LogWithFields(ctx).Printf(authErrorMessage)\n\t\tfillProtoResponse(ctx, &rsp, common.GeneralError(http.StatusUnauthorized, response.NoValidSession, authErrorMessage, nil, nil))\n\t\treturn &rsp, nil\n\t}\n\t// get task status from database using task id\n\ttask, err := ts.GetTaskStatusModel(ctx, req.TaskID, common.InMemory)\n\tif err != nil {\n\t\tl.LogWithFields(ctx).Printf(\"error getting task status : %v\", err)\n\t\tfillProtoResponse(ctx, &rsp, common.GeneralError(http.StatusNotFound, response.ResourceNotFound, err.Error(), []interface{}{\"Task\", req.TaskID}, nil))\n\t\treturn &rsp, nil\n\t}\n\n\t// Check the state of the task\n\tif task.TaskState == \"Completed\" || task.TaskState == \"Cancelled\" || task.TaskState == \"Killed\" || task.TaskState == \"Exception\" {\n\t\t// return with the actual status code, along with response header and response body\n\t\t//Build the response Body\n\t\trsp.Header = task.Payload.HTTPHeaders\n\t\trsp.Body = task.TaskResponse\n\t\trsp.StatusCode = task.StatusCode\n\t\t// Delete the task from db as it is completed and user requested for the details.\n\t\t// return the user with task details by deleting the task from db\n\t\t// User should be careful as this is the last call to Task monitor API.\n\t\t/*\n\t\t\terr := task.Delete()\n\t\t\tif err != nil {\n\t\t\t\tl.Log.Printf(\"error while deleting the task from db: %v\", err)\n\t\t\t}\n\t\t*/\n\t\treturn &rsp, nil\n\t}\n\t// Construct the Task object to return as long as 202 code is being returned.\n\n\tmessageList := []tresponse.Messages{}\n\tfor _, element := range task.Messages {\n\t\tmessage := tresponse.Messages{\n\t\t\tMessageID: element.MessageID,\n\t\t\tRelatedProperties: element.RelatedProperties,\n\t\t\tMessage: element.Message,\n\t\t\tMessageArgs: element.MessageArgs,\n\t\t\tSeverity: element.Severity,\n\t\t}\n\t\tmessageList = append(messageList, message)\n\t}\n\n\tcommonResponse := response.Response{\n\t\tOdataType: common.TaskType,\n\t\tID: task.ID,\n\t\tName: task.Name,\n\t\tOdataContext: \"/redfish/v1/$metadata#Task.Task\",\n\t\tOdataID: \"/redfish/v1/TaskService/Tasks/\" + task.ID,\n\t}\n\trsp.StatusCode = http.StatusAccepted\n\trsp.StatusMessage = response.TaskStarted\n\tcommonResponse.MessageArgs = []string{task.ID}\n\tcommonResponse.CreateGenericResponse(rsp.StatusMessage)\n\n\thttpHeaders := []string{}\n\tfor key, value := range task.Payload.HTTPHeaders {\n\t\thttpHeaders = append(httpHeaders, fmt.Sprintf(\"%v: %v\", key, value))\n\t}\n\n\ttaskResponse := tresponse.Task{\n\t\tResponse: commonResponse,\n\t\tTaskState: task.TaskState,\n\t\tStartTime: task.StartTime.UTC(),\n\t\tEndTime: task.EndTime.UTC(),\n\t\tTaskStatus: task.TaskStatus,\n\t\tMessages: messageList,\n\t\tTaskMonitor: task.TaskMonitor,\n\t\tPayload: tresponse.Payload{\n\t\t\tHTTPHeaders: httpHeaders,\n\t\t\tHTTPOperation: task.Payload.HTTPOperation,\n\t\t\tJSONBody: string(task.Payload.JSONBody),\n\t\t\tTargetURI: task.Payload.TargetURI,\n\t\t},\n\t\tPercentComplete: task.PercentComplete,\n\t}\n\tif task.ParentID == \"\" {\n\t\tvar subTask = tresponse.ListMember{\n\t\t\tOdataID: \"/redfish/v1/TaskService/Tasks/\" + task.ID + \"/SubTasks\",\n\t\t}\n\t\ttaskResponse.SubTasks = &subTask\n\t}\n\trespBody := generateResponse(ctx, taskResponse)\n\trsp.Body = respBody\n\tl.LogWithFields(ctx).Debugf(\"Outgoing response for getting subtasks: %v\", string(respBody))\n\n\trsp.Header[\"location\"] = task.TaskMonitor\n\treturn &rsp, nil\n}", "func (c *Client) DescribeTaskDetail(request *DescribeTaskDetailRequest) (response *DescribeTaskDetailResponse, err error) {\n if request == nil {\n request = NewDescribeTaskDetailRequest()\n }\n response = NewDescribeTaskDetailResponse()\n err = c.Send(request, response)\n return\n}", "func ShowTaskStat(taskJSON []byte, scale float64) error {\n\ttask := Task{}\n\n\terror := json.Unmarshal([]byte(taskJSON), &task)\n\tif error != nil {\n\t\treturn errors.New(\"[ERROR] Couldn't parse task log as JSON:\" + string(taskJSON))\n\t}\n\n\tstartDateTime, _ := time.Parse(DateTimeLayout, task.Start)\n\tendDateTime, _ := time.Parse(DateTimeLayout, task.End)\n\n\t// TODO: もうちょっとフォーマット何とかする\n\tduration := float64(endDateTime.Sub(startDateTime).Seconds()) * scale\n\tminutes := duration / 60.0\n\thours := minutes / 60.0\n\n\t// 小数点丸め\n\tfmt.Fprintf(os.Stdout, \"%s %v\\n\", task.Name, math.Trunc(hours*100)/100.0)\n\treturn nil\n}", "func (ctl *StatusController) PrintStatusOfTask(ctx context.Context, name string) error {\n\ttasks, err := ctl.getTask(ctx, name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tctl.printToView(tasks)\n\treturn nil\n}", "func (d *dispatcher) monitorTask(taskID int64) (finished bool, subTaskErrs []error) {\n\t// TODO: Consider putting the following operations into a transaction.\n\tvar err error\n\td.task, err = d.taskMgr.GetGlobalTaskByID(taskID)\n\tif err != nil {\n\t\tlogutil.BgLogger().Error(\"check task failed\", zap.Int64(\"task ID\", d.task.ID), zap.Error(err))\n\t\treturn false, nil\n\t}\n\tswitch d.task.State {\n\tcase proto.TaskStateCancelling:\n\t\treturn false, []error{errors.New(\"cancel\")}\n\tcase proto.TaskStateReverting:\n\t\tcnt, err := d.taskMgr.GetSubtaskInStatesCnt(d.task.ID, proto.TaskStateRevertPending, proto.TaskStateReverting)\n\t\tif err != nil {\n\t\t\tlogutil.BgLogger().Warn(\"check task failed\", zap.Int64(\"task ID\", d.task.ID), zap.Error(err))\n\t\t\treturn false, nil\n\t\t}\n\t\treturn cnt == 0, nil\n\tdefault:\n\t\tsubTaskErrs, err = d.taskMgr.CollectSubTaskError(d.task.ID)\n\t\tif err != nil {\n\t\t\tlogutil.BgLogger().Warn(\"collect subtask error failed\", zap.Int64(\"task ID\", d.task.ID), zap.Error(err))\n\t\t\treturn false, nil\n\t\t}\n\t\tif len(subTaskErrs) > 0 {\n\t\t\treturn false, subTaskErrs\n\t\t}\n\t\t// check subtasks pending or running.\n\t\tcnt, err := d.taskMgr.GetSubtaskInStatesCnt(d.task.ID, proto.TaskStatePending, proto.TaskStateRunning)\n\t\tif err != nil {\n\t\t\tlogutil.BgLogger().Warn(\"check task failed\", zap.Int64(\"task ID\", d.task.ID), zap.Error(err))\n\t\t\treturn false, nil\n\t\t}\n\t\treturn cnt == 0, nil\n\t}\n}", "func (l *LogCache) GetTaskStatus() define.TaskStatus {\n\treturn l.status\n}", "func (s *K8sSvc) GetTaskStatus(ctx context.Context, cluster string, taskID string) (*common.TaskStatus, error) {\n\trequuid := utils.GetReqIDFromContext(ctx)\n\n\tjob, err := s.cliset.BatchV1().Jobs(s.namespace).Get(taskID, metav1.GetOptions{})\n\tif err != nil {\n\t\tglog.Errorln(\"get task error\", err, \"taskID\", taskID, \"requuid\", requuid)\n\t\treturn nil, err\n\t}\n\n\tglog.Infoln(\"get task\", taskID, job.Status, \"requuid\", requuid)\n\n\tstatus := &common.TaskStatus{\n\t\tStatus: common.TaskStatusRunning,\n\t}\n\tif job.Status.StartTime != nil {\n\t\tstatus.StartedAt = job.Status.StartTime.String()\n\t}\n\tif job.Status.CompletionTime != nil {\n\t\tstatus.FinishedAt = job.Status.CompletionTime.String()\n\t}\n\n\tif job.Status.Succeeded > 0 {\n\t\tglog.Infoln(\"task succeeded, taskID\", taskID, \"requuid\", requuid)\n\t\tstatus.Status = common.TaskStatusStopped\n\t\tstatus.StoppedReason = \"success\"\n\t\treturn status, nil\n\t}\n\n\tif len(job.Status.Conditions) != 0 {\n\t\tglog.Infoln(\"task status conditions\", job.Status.Conditions[0], \"taskID\", taskID, \"requuid\", requuid)\n\n\t\tif job.Status.Conditions[0].Type == batchv1.JobComplete ||\n\t\t\tjob.Status.Conditions[0].Type == batchv1.JobFailed {\n\t\t\tstatus.Status = common.TaskStatusStopped\n\t\t\tstatus.StoppedReason = job.Status.Conditions[0].Message\n\t\t\treturn status, nil\n\t\t}\n\t}\n\n\treason := fmt.Sprintf(\"unknown task status, actively running pods %d, failed pods %d\", job.Status.Active, job.Status.Failed)\n\tglog.Infoln(reason, \"taskID\", taskID, \"requuid\", requuid, job.Status)\n\treturn status, nil\n}", "func (o *OpenapiTaskGenerationResult) GetTaskStatus() string {\n\tif o == nil || o.TaskStatus == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.TaskStatus\n}", "func (v1 *V1) GetTask(w http.ResponseWriter, r *http.Request) {\n\ttaskID := chi.URLParam(r, \"taskID\")\n\tshouldDeleteTask := false\n\tdeleteParam := r.URL.Query().Get(\"delete\")\n\tif deleteParam == \"1\" {\n\t\tshouldDeleteTask = true\n\t}\n\n\ttask := v1.metaCrawlSvc.TaskByID(taskID)\n\tif task == nil {\n\t\tv1.responseErrorJSON(w, \"task not found\", 404)\n\t\treturn\n\t}\n\n\ttaskStatus := task.Status()\n\tswitch taskStatus {\n\tcase metacrawl.TaskInProgress:\n\t\tv1.responseJSON(w, \"task in progress\", 204)\n\t\treturn\n\tcase metacrawl.TaskCompleted:\n\t\tif shouldDeleteTask {\n\t\t\tv1.metaCrawlSvc.DeleteTaskByID(taskID)\n\t\t}\n\n\t\tv1.responseCSV(w, taskID, task.Render(), 200)\n\t}\n}", "func GetVipStatusByTask(taskId int64) (VipStatusByTaskItems, error) {\r\n\t// generate url\r\n\turl := fmt.Sprintf(\"http://rms.baidu.com/?r=interface/api&handler=getBgwListCurrentStep&list_id=%d\", taskId)\r\n\r\n\t// request api for result\r\n\treturn getVipStatusByTask(url)\r\n}", "func (c *Client) GetTaskStatus(url string, paras *TaskPathParas,\n\trequest *StartTaskRequest) (*TaskStatusResponse, error) {\n\tif c == nil {\n\t\treturn nil, ErrServerNotInit\n\t}\n\n\tuserAuth, err := c.generateGateWayAuth(paras.Operator)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"bksops StartBkOpsTask generateGateWayAuth failed: %v\", err)\n\t}\n\n\tvar (\n\t\treqURL = fmt.Sprintf(\"/get_task_status/%s/%s/\", paras.TaskID, paras.BkBizID)\n\t\trespData = &TaskStatusResponse{}\n\t)\n\n\trequest.Scope = string(CmdbBizScope)\n\t_, _, errs := gorequest.New().\n\t\tTimeout(defaultTimeOut).\n\t\tGet(c.server+reqURL).\n\t\tSet(\"Content-Type\", \"application/json\").\n\t\tSet(\"Accept\", \"application/json\").\n\t\tSet(\"X-Bkapi-Authorization\", userAuth).\n\t\tSetDebug(c.serverDebug).\n\t\tSend(request).\n\t\tEndStruct(&respData)\n\tif len(errs) > 0 {\n\t\tblog.Errorf(\"call api GetTaskStatus failed: %v\", errs[0])\n\t\treturn nil, errs[0]\n\t}\n\n\tif !respData.Result {\n\t\tblog.Errorf(\"call api GetTaskStatus failed: %v\", respData.Message)\n\t\treturn nil, fmt.Errorf(respData.Message)\n\t}\n\n\t//successfully request\n\tblog.Infof(\"call api GetTaskStatus with url(%s) successfully\", reqURL)\n\treturn respData, nil\n}", "func HandleQueryTaskStatus(w http.ResponseWriter, r *http.Request) {\n\tlog.Root.Info(\"HandleQueryTaskStatus BEGIN\")\n\n\tif r.Method != http.MethodGet {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tHttpResponseError(w, ErrNotFound)\n\t\treturn\n\t}\n\n\ttaskIDList := r.URL.Query()[\"taskID\"]\n\tif len(taskIDList) == 0 {\n\t\tlog.Root.Error(\"HandleQueryTaskStatus Parse HTTP request param error\")\n\t\tHttpResponseError(w, ErrParams)\n\t\treturn\n\t}\n\n\ttaskStatusMap, err := node.QueryTaskStatus(taskIDList)\n\tif err != nil {\n\t\tlog.Root.Error(\"HandleQueryTaskStatus Query task status error. TaskIDList: %v\", taskIDList)\n\t\tHttpResponseError(w, ErrServer)\n\t\treturn\n\t}\n\n\ttaskStatusList := []interface{}{}\n\tfor k, v := range taskStatusMap {\n\t\tjsonMap := map[string]interface{}{\n\t\t\t\"taskID\": k,\n\t\t\t\"taskStatus\": v,\n\t\t}\n\t\ttaskStatusList = append(taskStatusList, jsonMap)\n\t}\n\n\tlog.Root.Info(\"HandleQueryTaskStatus END\")\n\tHttpResponseData(w, H{\n\t\t\"taskStatusList\": taskStatusList,\n\t})\n\treturn\n}", "func (p *ReadOnlySchedulerClient) GetTasksStatus(ctx context.Context, query *TaskQuery) (r *Response, err error) {\n var _args57 ReadOnlySchedulerGetTasksStatusArgs\n _args57.Query = query\n var _result58 ReadOnlySchedulerGetTasksStatusResult\n if err = p.Client_().Call(ctx, \"getTasksStatus\", &_args57, &_result58); err != nil {\n return\n }\n return _result58.GetSuccess(), nil\n}", "func (t *Task) GetStatus() int {\n\treturn t.Status\n}", "func (ctl *StatusController) getTask(ctx context.Context, name string) ([]TaskStatus, error) {\n\tif name == WildCard {\n\t\t// get status about all of tasks\n\t\ttasks, err := ctl.meta.GetAllTasks(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresult := make([]TaskStatus, 0, len(tasks))\n\t\tfor _, task := range tasks {\n\t\t\tstatus, err := ctl.fillTask(ctx, task)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresult = append(result, status)\n\t\t}\n\t\treturn result, nil\n\t}\n\t// get status about TaskName\n\ttask, err := ctl.meta.GetTask(ctx, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstatus, err := ctl.fillTask(ctx, *task)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn []TaskStatus{status}, nil\n}", "func ShowTask(w http.ResponseWriter, r *http.Request, repo *tasks.TaskRepository) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tparams := mux.Vars(r)\n\ttaskID, err := strconv.Atoi(params[\"id\"])\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ttask, err := repo.GetTask(taskID)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tjson.NewEncoder(w).Encode(apiIndexTask(task))\n}", "func (c *Client) GetTaskState(ctx context.Context, ID string) (*swarming_api.SwarmingRpcsTaskStates, error) {\n\tvar result *swarming_api.SwarmingRpcsTaskStates\n\tgetState := func() error {\n\t\tvar err error\n\t\tresult, err = c.SwarmingService.Tasks.GetStates().TaskId(ID).Context(ctx).Do()\n\t\treturn err\n\t}\n\tif err := callWithRetries(ctx, getState); err != nil {\n\t\treturn nil, errors.Annotate(err, fmt.Sprintf(\"get task state for task ID %s\", ID)).Err()\n\t}\n\treturn result, nil\n}", "func (p *ReadOnlySchedulerClient) GetTasksStatus(ctx context.Context, query *TaskQuery) (r *Response, err error) {\n var _args107 ReadOnlySchedulerGetTasksStatusArgs\n _args107.Query = query\n var _result108 ReadOnlySchedulerGetTasksStatusResult\n var meta thrift.ResponseMeta\n meta, err = p.Client_().Call(ctx, \"getTasksStatus\", &_args107, &_result108)\n p.SetLastResponseMeta_(meta)\n if err != nil {\n return\n }\n return _result108.GetSuccess(), nil\n}", "func getTaskInfoByContainerID(containerID string, tasks []TaskInfo) *TaskInfo {\n\tfor _, task := range tasks {\n\t\tif len(task.Statuses) > 0 && task.Statuses[0].ContainerStatusInfo.ID.Value == containerID {\n\t\t\treturn &task\n\t\t}\n\t}\n\treturn nil\n}", "func (ctl *StatusController) fillTask(ctx context.Context, task Task) (TaskStatus, error) {\n\tvar err error\n\ts := TaskStatus{\n\t\tInfo: task.Info,\n\t}\n\n\tif s.paused, err = task.IsPaused(ctx); err != nil {\n\t\treturn s, errors.Annotatef(err, \"failed to get pause status of task %s\", s.Info.Name)\n\t}\n\n\tif s.Checkpoints, err = task.NextBackupTSList(ctx); err != nil {\n\t\treturn s, errors.Annotatef(err, \"failed to get progress of task %s\", s.Info.Name)\n\t}\n\n\tif s.globalCheckpoint, err = task.GetStorageCheckpoint(ctx); err != nil {\n\t\treturn s, errors.Annotatef(err, \"failed to get storage checkpoint of task %s\", s.Info.Name)\n\t}\n\n\ts.LastErrors, err = task.LastError(ctx)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\ts.QPS, err = MaybeQPS(ctx, ctl.mgr)\n\tif err != nil {\n\t\treturn s, errors.Annotatef(err, \"failed to get QPS of task %s\", s.Info.Name)\n\t}\n\treturn s, nil\n}", "func (s *Storage) GetTask(id uint) (*todopb.TaskResponse, error) {\n\trow := s.db.QueryRow(\"SELECT * FROM tasks WHERE id=$1\", id)\n\n\ttask, err := scan(row)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn task, nil\n}", "func (a *Client) GetTaskDetails(params *GetTaskDetailsParams, opts ...ClientOption) (*GetTaskDetailsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetTaskDetailsParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"getTaskDetails\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/tasks/{id}\",\n\t\tProducesMediaTypes: []string{\"application/vnd.goswagger.examples.task-tracker.v1+json\"},\n\t\tConsumesMediaTypes: []string{\"application/vnd.goswagger.examples.task-tracker.v1+json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetTaskDetailsReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetTaskDetailsOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*GetTaskDetailsDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "func (s *state) GetTask(exID string) (*mesos.Task, error) {\n\t// Check if task is in Launched Tasks list\n\tfor _, t := range s.st.GetTasks.LaunchedTasks {\n\t\tif s.isMatchingTask(&t, exID) {\n\t\t\treturn &t, nil\n\t\t}\n\t}\n\n\t// Check if task is in Queued Tasks list\n\tfor _, t := range s.st.GetTasks.QueuedTasks {\n\t\tif s.isMatchingTask(&t, exID) {\n\t\t\treturn &t, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"unable to find task matching executor id %s\", exID)\n}", "func GetTaskInformation(res http.ResponseWriter, req *http.Request) {\n\tres.Header().Set(\"Content-Type\", \"application/json\")\n\tc := Task{\"7E12E3B57A02\", \"FOOUSER\", \"BAR\"}\n\toutgoingJSON, err := json.Marshal(c)\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\thttp.Error(res, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tres.WriteHeader(http.StatusCreated)\n\tfmt.Fprint(res, string(outgoingJSON))\n}", "func (v *MatchingRespondQueryTaskCompletedRequest) GetTaskID() (o string) {\n\tif v != nil && v.TaskID != nil {\n\t\treturn *v.TaskID\n\t}\n\treturn\n}", "func (ctrl *TaskController) GetTask(w http.ResponseWriter, r *http.Request) {\n\ttaskId := ParamAsString(\"id\", r)\n\tlogrus.Println(\"task : \", taskId)\n\n\ttask, err := ctrl.taskDao.Get(taskId)\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\tSendJSONError(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tlogrus.Println(\"task : \", task)\n\tSendJSONOk(w, task)\n}", "func (db *Database) ReadTask(id string) (*models.Task, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel() \n\n\tcollection := db.Client.Database(\"dashboard-tasks\").Collection(\"tasks\")\n\n\ttask := models.Task{}\n\tobjectID, err := primitive.ObjectIDFromHex(id)\n\tif err != nil { return nil, err }\n\n\terr = collection.FindOne(ctx, bson.M{\"_id\": objectID}).Decode(&task)\n\tif err != nil { return nil, err }\n\n\treturn &task, err\n}", "func (t *Task) Status() TaskStatusType {\n\treturn t.status\n}", "func (d *Release) Status() *Task {\n\t_ = d.merge()\n\treturn d.task\n}", "func (cm *Docker) GetTaskMetrics(id string) (m models.Metrics, ok bool) {\n\tif config.GetSwitchVal(\"enableDisplay\") {\n\t\treturn\n\t}\n\tfor _, container := range cm.containers {\n\t\tnameWords := strings.Split(container.GetMeta(\"name\"), \".\")\n\t\tsize := len(nameWords)\n\t\tif size == 3 && id == nameWords[size-1] {\n\t\t\tlog.Debugf(\"LastMetrics %+v\", container.LastMetrics())\n\t\t\tm, ok = container.LastMetrics(), true\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func UpdateTaskStatus(tid int64, new_status int64) {\n\tvar dummy string\n\n\tif new_status == Running {\n\t\tdb.QueryRow(\"UPDATE tasks SET status=$1, start_time=now() WHERE id=$2\",\n\t\t\tnew_status, tid).Scan(&dummy)\n\t} else if new_status == Canceled {\n\t\tdb.QueryRow(\"UPDATE tasks SET status=$1, end_time=now() WHERE id=$2\",\n\t\t\tnew_status, tid).Scan(&dummy)\n\t} else {\n\t\tdb.QueryRow(\"UPDATE tasks SET status=$1 WHERE id=$2\", new_status, tid).\n\t\t\tScan(&dummy)\n\t}\n}", "func (p *taskController) GetTask(c echo.Context) error {\n\tid, err := strconv.Atoi(c.Param(\"id\"))\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, \"Task ID must be int\")\n\t}\n\tctx := c.Request().Context()\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\ttask, err := p.TaskUseCase.GetTask(ctx, id)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusNotFound, \"Task does not exist.\")\n\t}\n\treturn c.JSON(http.StatusOK, task)\n}", "func (cm *Docker) GetTask(id string) (*entity.Task, bool) {\n\tcm.lock.Lock()\n\tt, ok := cm.tasks[id]\n\tcm.lock.Unlock()\n\treturn t, ok\n}", "func (context Context) UpdateTaskStatus(id string, status string, statusMessage string) (err error) {\n\t_, err = context.UpdateTask(id, F{\"status\": status, \"status-message\": statusMessage})\n\treturn\n}", "func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error {\n\tif handle == nil {\n\t\treturn fmt.Errorf(\"error: handle cannot be nil\")\n\t}\n\n\tif _, ok := d.tasks.Get(handle.Config.ID); ok {\n\t\treturn nil\n\t}\n\n\tvar taskState TaskState\n\tif err := handle.GetDriverState(&taskState); err != nil {\n\t\treturn fmt.Errorf(\"failed to decode task state from handle: %v\", err)\n\t}\n\td.logger.Debug(\"Checking for recoverable task\", \"task\", handle.Config.Name, \"taskid\", handle.Config.ID, \"container\", taskState.ContainerID)\n\n\tinspectData, err := d.podman.ContainerInspect(d.ctx, taskState.ContainerID)\n\tif err != nil {\n\t\td.logger.Warn(\"Recovery lookup failed\", \"task\", handle.Config.ID, \"container\", taskState.ContainerID, \"err\", err)\n\t\treturn nil\n\t}\n\n\th := &TaskHandle{\n\t\tcontainerID: taskState.ContainerID,\n\t\tdriver: d,\n\t\ttaskConfig: taskState.TaskConfig,\n\t\tprocState: drivers.TaskStateUnknown,\n\t\tstartedAt: taskState.StartedAt,\n\t\texitResult: &drivers.ExitResult{},\n\t\tlogger: d.logger.Named(\"podmanHandle\"),\n\n\t\ttotalCPUStats: stats.NewCpuStats(),\n\t\tuserCPUStats: stats.NewCpuStats(),\n\t\tsystemCPUStats: stats.NewCpuStats(),\n\n\t\tremoveContainerOnExit: d.config.GC.Container,\n\t}\n\n\tif inspectData.State.Running {\n\t\td.logger.Info(\"Recovered a still running container\", \"container\", inspectData.State.Pid)\n\t\th.procState = drivers.TaskStateRunning\n\t} else if inspectData.State.Status == \"exited\" {\n\t\t// are we allowed to restart a stopped container?\n\t\tif d.config.RecoverStopped {\n\t\t\td.logger.Debug(\"Found a stopped container, try to start it\", \"container\", inspectData.State.Pid)\n\t\t\tif err = d.podman.ContainerStart(d.ctx, inspectData.ID); err != nil {\n\t\t\t\td.logger.Warn(\"Recovery restart failed\", \"task\", handle.Config.ID, \"container\", taskState.ContainerID, \"err\", err)\n\t\t\t} else {\n\t\t\t\td.logger.Info(\"Restarted a container during recovery\", \"container\", inspectData.ID)\n\t\t\t\th.procState = drivers.TaskStateRunning\n\t\t\t}\n\t\t} else {\n\t\t\t// no, let's cleanup here to prepare for a StartTask()\n\t\t\td.logger.Debug(\"Found a stopped container, removing it\", \"container\", inspectData.ID)\n\t\t\tif err = d.podman.ContainerStart(d.ctx, inspectData.ID); err != nil {\n\t\t\t\td.logger.Warn(\"Recovery cleanup failed\", \"task\", handle.Config.ID, \"container\", inspectData.ID)\n\t\t\t}\n\t\t\th.procState = drivers.TaskStateExited\n\t\t}\n\t} else {\n\t\td.logger.Warn(\"Recovery restart failed, unknown container state\", \"state\", inspectData.State.Status, \"container\", taskState.ContainerID)\n\t\th.procState = drivers.TaskStateUnknown\n\t}\n\n\td.tasks.Set(taskState.TaskConfig.ID, h)\n\n\tgo h.runContainerMonitor()\n\td.logger.Debug(\"Recovered container handle\", \"container\", taskState.ContainerID)\n\n\treturn nil\n}", "func (r *versionResolver) TaskStatusStats(ctx context.Context, obj *restModel.APIVersion, options BuildVariantOptions) (*task.TaskStats, error) {\n\topts := task.GetTasksByVersionOptions{\n\t\tIncludeExecutionTasks: false,\n\t\tTaskNames: options.Tasks,\n\t\tVariants: options.Variants,\n\t\tStatuses: getValidTaskStatusesFilter(options.Statuses),\n\t\t// If the version is a patch, we don't want to include its never activated tasks.\n\t\tIncludeNeverActivatedTasks: !obj.IsPatchRequester(),\n\t}\n\n\tstats, err := task.GetTaskStatsByVersion(ctx, *obj.Id, opts)\n\tif err != nil {\n\t\treturn nil, InternalServerError.Send(ctx, fmt.Sprintf(\"getting version task status stats: %s\", err.Error()))\n\t}\n\treturn stats, nil\n}", "func (_Contract *ContractSession) GetTask(i *big.Int) (struct {\n\tActive bool\n\tAssignment *big.Int\n\tProposalID *big.Int\n}, error) {\n\treturn _Contract.Contract.GetTask(&_Contract.CallOpts, i)\n}", "func (_Contract *ContractCallerSession) GetTask(i *big.Int) (struct {\n\tActive bool\n\tAssignment *big.Int\n\tProposalID *big.Int\n}, error) {\n\treturn _Contract.Contract.GetTask(&_Contract.CallOpts, i)\n}", "func updateTaskState(task *api.Task) api.TaskStatus {\n\t//The task is the minimum status of all its essential containers unless the\n\t//status is terminal in which case it's that status\n\tlog.Debug(\"Updating task\", \"task\", task)\n\n\t// minContainerStatus is the minimum status of all essential containers\n\tminContainerStatus := api.ContainerDead + 1\n\t// minContainerStatus is the minimum status of all containers to be used in\n\t// the edge case of no essential containers\n\tabsoluteMinContainerStatus := minContainerStatus\n\tfor _, cont := range task.Containers {\n\t\tlog.Debug(\"On container\", \"cont\", cont)\n\t\tif cont.KnownStatus < absoluteMinContainerStatus {\n\t\t\tabsoluteMinContainerStatus = cont.KnownStatus\n\t\t}\n\t\tif !cont.Essential {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Terminal states\n\t\tif cont.KnownStatus == api.ContainerStopped {\n\t\t\tif task.KnownStatus < api.TaskStopped {\n\t\t\t\ttask.KnownStatus = api.TaskStopped\n\t\t\t\treturn task.KnownStatus\n\t\t\t}\n\t\t} else if cont.KnownStatus == api.ContainerDead {\n\t\t\tif task.KnownStatus < api.TaskDead {\n\t\t\t\ttask.KnownStatus = api.TaskDead\n\t\t\t\treturn task.KnownStatus\n\t\t\t}\n\t\t}\n\t\t// Non-terminal\n\t\tif cont.KnownStatus < minContainerStatus {\n\t\t\tminContainerStatus = cont.KnownStatus\n\t\t}\n\t}\n\n\tif minContainerStatus == api.ContainerDead+1 {\n\t\tlog.Warn(\"Task with no essential containers; all properly formed tasks should have at least one essential container\", \"task\", task)\n\n\t\t// If there's no essential containers, let's just assume the container\n\t\t// with the earliest status is essential and proceed.\n\t\tminContainerStatus = absoluteMinContainerStatus\n\t}\n\n\tlog.Info(\"MinContainerStatus is \" + minContainerStatus.String())\n\n\tif minContainerStatus == api.ContainerCreated {\n\t\tif task.KnownStatus < api.TaskCreated {\n\t\t\ttask.KnownStatus = api.TaskCreated\n\t\t\treturn task.KnownStatus\n\t\t}\n\t} else if minContainerStatus == api.ContainerRunning {\n\t\tif task.KnownStatus < api.TaskRunning {\n\t\t\ttask.KnownStatus = api.TaskRunning\n\t\t\treturn task.KnownStatus\n\t\t}\n\t} else if minContainerStatus == api.ContainerStopped {\n\t\tif task.KnownStatus < api.TaskStopped {\n\t\t\ttask.KnownStatus = api.TaskStopped\n\t\t\treturn task.KnownStatus\n\t\t}\n\t} else if minContainerStatus == api.ContainerDead {\n\t\tif task.KnownStatus < api.TaskDead {\n\t\t\ttask.KnownStatus = api.TaskDead\n\t\t\treturn task.KnownStatus\n\t\t}\n\t}\n\treturn api.TaskStatusNone\n}", "func VerifyTask(ctx context.Context, taskObj *v1beta1.Task, k8s kubernetes.Interface, refSource *v1.RefSource, verificationpolicies []*v1alpha1.VerificationPolicy) VerificationResult {\n\treturn VerifyResource(ctx, taskObj, k8s, refSource, verificationpolicies)\n}", "func (filter TaskReliabilityFilter) GetTaskStats() (taskStats []taskstats.TaskStats, err error) {\n\tpipeline := filter.taskReliabilityQueryPipeline()\n\terr = db.Aggregate(taskstats.DailyTaskStatsCollection, pipeline, &taskStats)\n\treturn\n}", "func (m *Master) GetTask(_ *ExampleArgs, reply *GetTaskReply) error {\n\tswitch m.masterState {\n\tcase newMaster:\n\t\tfor i, task := range m.mapTask {\n\t\t\tif task.State == initialState {\n\t\t\t\treply.Task.Type_ = task.Type_\n\t\t\t\treply.Task.Filename = task.Filename\n\t\t\t\treply.Task.Id = task.Id\n\t\t\t\treply.Task.NReduce = task.NReduce\n\t\t\t\treply.Flag = 0\n\t\t\t\treply.Task.State = task.State\n\n\t\t\t\tm.mapTask[i].State = inProgress\n\t\t\t\tm.mapTask[i].Time = time.Now()\n\t\t\t\t//reply.Task.State=m.mapTask[i].State\n\n\t\t\t\treturn nil\n\t\t\t} else if task.State == inProgress && time.Now().Sub(m.mapTask[i].Time) > time.Duration(5)*time.Second {\n\t\t\t\treply.Task.Type_ = task.Type_\n\t\t\t\treply.Task.Filename = task.Filename\n\t\t\t\treply.Task.Id = task.Id\n\t\t\t\treply.Task.NReduce = task.NReduce\n\t\t\t\treply.Task.State = task.State\n\t\t\t\treply.Flag = 0\n\n\t\t\t\tm.mapTask[i].State = inProgress\n\t\t\t\tm.mapTask[i].Time = time.Now()\n\t\t\t\t//reply.Task.State=m.mapTask[i].State\n\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\treply.Flag = 1 // map not finished but in progress\n\tcase completeMap:\n\t\tfor i, task := range m.reduceTask {\n\t\t\tif task.State == initialState {\n\t\t\t\treply.Task.Type_ = task.Type_\n\t\t\t\treply.Task.Filename = task.Filename\n\t\t\t\treply.Task.Id = task.Id\n\t\t\t\treply.Task.NReduce = task.NReduce\n\t\t\t\treply.Flag = 0\n\t\t\t\treply.Task.Files = task.Files\n\t\t\t\treply.Task.State = task.State\n\n\t\t\t\tm.reduceTask[i].State = inProgress\n\t\t\t\tm.reduceTask[i].Time = time.Now()\n\t\t\t\t//reply.Task.State=m.mapTask[i].State\n\n\t\t\t\treturn nil\n\t\t\t} else if task.State == inProgress && time.Now().Sub(m.reduceTask[i].Time) > time.Duration(5)*time.Second {\n\t\t\t\treply.Task.Type_ = task.Type_\n\t\t\t\treply.Task.Filename = task.Filename\n\t\t\t\treply.Task.Id = task.Id\n\t\t\t\treply.Task.NReduce = task.NReduce\n\t\t\t\treply.Flag = 0\n\t\t\t\treply.Task.Files = task.Files\n\t\t\t\treply.Task.State = task.State\n\n\t\t\t\tm.reduceTask[i].State = inProgress\n\t\t\t\tm.reduceTask[i].Time = time.Now()\n\t\t\t\t//reply.Task.State=m.mapTask[i].State\n\n\t\t\t\treturn nil\n\n\t\t\t}\n\t\t}\n\t\treply.Flag = 1 // reduce not finished but in progress\n\tcase completeReduce:\n\t\treply.Flag = 2 // all task have been finished\n\n\t}\n\n\treturn nil\n}", "func GetTaskState(taskID string) (*State, error) {\n\ttasks.RLock()\n\tdefer tasks.RUnlock()\n\n\tif _, ok := tasks.m[taskID]; ok { // key exist\n\t\treturn tasks.m[taskID], nil\n\t}\n\n\treturn nil, errors.New(\"Task not exist.\")\n}", "func (o *ViewCustomFieldTask) GetTaskOk() (*ViewRelationship, bool) {\n\tif o == nil || o.Task == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Task, true\n}", "func GetTask(id int) (Task, error) {\n\tvar t Task\n\tvar jsonTask []byte\n\n\terr := db.View(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket(taskBucket)\n\t\tjsonTask = b.Get(itob(id))\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn t, err\n\t}\n\n\terr = t.ReadFromJSON(jsonTask)\n\tif err != nil {\n\t\treturn t, err\n\t}\n\n\treturn t, nil\n\n}", "func (d *Driver) TaskStats(ctx context.Context, taskID string, interval time.Duration) (<-chan *drivers.TaskResourceUsage, error) {\n\td.logger.Debug(\"TaskStats called\", \"taskID\", taskID)\n\thandle, ok := d.tasks.Get(taskID)\n\tif !ok {\n\t\treturn nil, drivers.ErrTaskNotFound\n\t}\n\tstatsChannel := make(chan *drivers.TaskResourceUsage)\n\tgo handle.runStatsEmitter(ctx, statsChannel, interval)\n\treturn statsChannel, nil\n}", "func (_Contract *ContractCaller) GetTask(opts *bind.CallOpts, i *big.Int) (struct {\n\tActive bool\n\tAssignment *big.Int\n\tProposalID *big.Int\n}, error) {\n\tvar out []interface{}\n\terr := _Contract.contract.Call(opts, &out, \"getTask\", i)\n\n\toutstruct := new(struct {\n\t\tActive bool\n\t\tAssignment *big.Int\n\t\tProposalID *big.Int\n\t})\n\tif err != nil {\n\t\treturn *outstruct, err\n\t}\n\n\toutstruct.Active = *abi.ConvertType(out[0], new(bool)).(*bool)\n\toutstruct.Assignment = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)\n\toutstruct.ProposalID = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int)\n\n\treturn *outstruct, err\n\n}", "func (client *Client) DescribeActiveOperationTask(request *DescribeActiveOperationTaskRequest) (_result *DescribeActiveOperationTaskResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &DescribeActiveOperationTaskResponse{}\n\t_body, _err := client.DescribeActiveOperationTaskWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func GetSingleTask(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\n\tif params[\"id\"] == \"\" {\n\t\thttp.Error(w, http.StatusText(400), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\ttaskID := bson.ObjectIdHex(params[\"id\"])\n\n\ttask, err := repository.GetSingleTask(taskID)\n\n\tif err != nil {\n\t\thttp.Error(w, http.StatusText(404), http.StatusNotFound)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\n\tjson.NewEncoder(w).Encode(task)\n}", "func (m *Master) GetTask(req *GetTaskReq, rsp *GetTaskRsp) error {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tfor k := range m.todoMapTask {\n\t\tif m.todoMapTask[k] == 0 {\n\t\t\trsp.Status = \"Task\"\n\t\t\trsp.Filename = m.files[k]\n\t\t\trsp.NReduce = m.nReduce\n\t\t\trsp.TaskID = k\n\t\t\tm.todoMapTask[k] = time.Now().Unix()\n\t\t\treturn nil\n\t\t}\n\t}\n\tif len(m.todoMapTask) != 0 {\n\t\trsp.Status = \"Wait\"\n\t\treturn nil\n\t}\n\n\tfor k := range m.todoReduceTask {\n\t\tif m.todoReduceTask[k] == 0 {\n\t\t\trsp.Status = \"Task\"\n\t\t\trsp.NReduce = m.nReduce\n\t\t\trsp.NMap = len(m.files)\n\t\t\trsp.TaskID = k\n\t\t\tm.todoReduceTask[k] = time.Now().Unix()\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tif len(m.todoReduceTask) != 0 {\n\t\trsp.Status = \"Wait\"\n\t\treturn nil\n\t} else {\n\t\trsp.Status = \"Exit\"\n\t\treturn nil\n\t}\n\n\treturn nil\n}", "func (c *BasicECSClient) DescribeTaskDefinition(ctx context.Context, in *ecs.DescribeTaskDefinitionInput) (*ecs.DescribeTaskDefinitionOutput, error) {\n\tif err := c.setup(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"setting up client\")\n\t}\n\n\tvar out *ecs.DescribeTaskDefinitionOutput\n\tvar err error\n\tmsg := awsutil.MakeAPILogMessage(\"DescribeTaskDefinition\", in)\n\tif err := utility.Retry(ctx,\n\t\tfunc() (bool, error) {\n\t\t\tout, err = c.ecs.DescribeTaskDefinitionWithContext(ctx, in)\n\t\t\tif awsErr, ok := err.(awserr.Error); ok {\n\t\t\t\tgrip.Debug(message.WrapError(awsErr, msg))\n\t\t\t\tif c.isNonRetryableErrorCode(awsErr.Code()) {\n\t\t\t\t\treturn false, err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true, err\n\t\t}, *c.opts.RetryOpts); err != nil {\n\t\treturn nil, err\n\t}\n\treturn out, nil\n}", "func (t *Task) Status() string {\n\tstatus := t.State.Symbol() + t.DueSymbol() + \" \"\n\n\treturn status\n}", "func GetTask(id int) (Task, error) {\n\tpath := fmt.Sprintf(\"tasks/%d\", id)\n\tres, err := makeRequest(http.MethodGet, path, nil)\n\tif err != nil {\n\t\treturn Task{}, err\n\t}\n\n\treturn decodeTask(res.Body)\n}", "func GetTask(tid, user_token string) (*Task, error) {\n\t// declarations\n\tvar start_time, end_time pq.NullTime\n\tvar exit_status sql.NullInt64\n\tvar output sql.NullString\n\n\t// initialize Task\n\ttask := Task{}\n\t// get task information\n\tif err := db.QueryRow(\"SELECT * FROM tasks WHERE tasks.id=$1\", tid).\n\t\tScan(&task.Id, &task.Gid, &start_time, &end_time, &task.Status,\n\t\t&exit_status, &output, &task.Patch); err != nil {\n\t\treturn nil, err\n\t}\n\t// set remaining fields\n\tif start_time.Valid {\n\t\ttask.Start_time = &start_time.Time\n\t}\n\tif end_time.Valid {\n\t\ttask.End_time = &end_time.Time\n\t}\n\tif exit_status.Valid {\n\t\ttask.Exit_status = exit_status.Int64\n\t}\n\tif output.Valid {\n\t\ttask.Output = output.String\n\t}\n\n\tgroup_task, _ := getGroupTask(task.Gid)\n\ttask.User = group_task.user\n\ttask.Project = group_task.project\n\ttask.Bot = group_task.bot\n\n\treturn &task, nil\n}", "func (s *projService) GetTeamMemberByTask(ctx context.Context, req *pb.GetTeamMemberByTaskRequest) (*pb.GetTeamMemberByTaskResponse, error) {\n\tresp := &pb.GetTeamMemberByTaskResponse{}\n\tvar err error\n\n\tsqlstring1 := `SELECT inbProjectId FROM tb_Task WHERE inbTaskId = ? AND inbMserviceId = ? AND bitIsDeleted = 0`\n\tstmt1, err := s.db.Prepare(sqlstring1)\n\tif err != nil {\n\t\tlevel.Error(s.logger).Log(\"what\", \"Prepare\", \"error\", err)\n\t\tresp.ErrorCode = 500\n\t\tresp.ErrorMessage = \"db.Prepare failed\"\n\t\treturn resp, nil\n\t}\n\n\tdefer stmt1.Close()\n\n\tvar existingProjectId int64\n\terr = stmt1.QueryRow(req.GetTaskId(), req.GetMserviceId()).Scan(&existingProjectId)\n\tif err != nil {\n\t\tresp.ErrorCode = 404\n\t\tresp.ErrorMessage = \"referenced task not found\"\n\t\treturn resp, nil\n\t}\n\n\tsqlstring := `SELECT m.inbMemberId, m.dtmCreated, m.dtmModified, m.intVersion,\n\tm.inbMserviceId, m.inbProjectId, m.chvName, m.intProjectRoleId, m.chvEmail, t.decTaskHours, r.chvRoleName \n\tFROM tb_TaskToMember AS t \n\tJOIN tb_TeamMember AS m ON t.inbMemberId = m.inbMemberId\n\tJOIN tb_ProjectRoleType AS r ON m.intProjectRoleId = r.intProjectRoleId\n\tWHERE t.inbProjectId = ? AND t.inbTaskId= ? AND t.inbMserviceId = ?\n\tAND t.bitIsDeleted = 0 AND m.bitIsDeleted = 0`\n\tstmt, err := s.db.Prepare(sqlstring)\n\tif err != nil {\n\t\tlevel.Error(s.logger).Log(\"what\", \"Prepare\", \"error\", err)\n\t\tresp.ErrorCode = 500\n\t\tresp.ErrorMessage = \"db.Prepare failed\"\n\t\treturn resp, nil\n\t}\n\n\tdefer stmt.Close()\n\trows, err := stmt.Query(existingProjectId, req.GetTaskId(), req.GetMserviceId())\n\tif err != nil {\n\t\tlevel.Error(s.logger).Log(\"what\", \"Query\", \"error\", err)\n\t\tresp.ErrorCode = 500\n\t\tresp.ErrorMessage = err.Error()\n\t\treturn resp, nil\n\t}\n\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar created string\n\t\tvar modified string\n\t\tvar task_hours string\n\t\tvar member pb.TeamMember\n\n\t\terr := rows.Scan(&member.MemberId, &created, &modified, &member.Version, &member.MserviceId, &member.ProjectId,\n\t\t\t&member.Name, &member.ProjectRoleId, &member.Email, &task_hours, &member.RoleName)\n\n\t\tif err != nil {\n\t\t\tlevel.Error(s.logger).Log(\"what\", \"Scan\", \"error\", err)\n\t\t\tresp.ErrorCode = 500\n\t\t\tresp.ErrorMessage = err.Error()\n\t\t\treturn resp, nil\n\t\t}\n\n\t\tmember.Created = dml.DateTimeFromString(created)\n\t\tmember.Modified = dml.DateTimeFromString(modified)\n\t\td, err := dml.DecimalFromString(task_hours)\n\t\tif err == nil {\n\t\t\tmember.TaskHours = d\n\t\t}\n\n\t\tresp.TeamMembers = append(resp.TeamMembers, &member)\n\t}\n\n\treturn resp, err\n}", "func (builder *Builder) GetStatus(task string) bool {\n\tstatus, ok := builder.LinuxBuild.Status[task]\n\treturn status && ok\n}", "func (t Task) StatusDisplay() string {\n\tswitch t.Status {\n\tcase taskStatusSucceeded:\n\t\treturn \"succeeded\"\n\tcase taskStatusProcessing:\n\t\treturn \"processing\"\n\tcase taskStatusFailed:\n\t\treturn \"failed\"\n\tcase taskStatusCanceled:\n\t\treturn \"canceled\"\n\t}\n\n\treturn \"waiting\"\n}", "func (t *TaskService) Edit(w http.ResponseWriter, r *http.Request) {\n\tvar (\n\t\temptyUUID gocql.UUID\n\t\ttaskIDStr = mux.Vars(r)[\"taskID\"]\n\t\tpartnerID = mux.Vars(r)[partnerIDKey]\n\t\tctx = r.Context()\n\t\tcurrentUser = t.userService.GetUser(r, t.httpClient)\n\t\tmodifiedAt = time.Now().Truncate(time.Millisecond).UTC()\n\t)\n\n\ttaskID, err := gocql.ParseUUID(taskIDStr)\n\tif err != nil || taskID == emptyUUID {\n\t\tlogger.Log.ErrfCtx(r.Context(), errorcode.ErrorTaskIDHasBadFormat, \"TaskService.Edit: task ID(UUID=%s) has bad format or empty. err=%v\", taskIDStr, err)\n\t\tcommon.SendBadRequest(w, r, errorcode.ErrorTaskIDHasBadFormat)\n\t\treturn\n\t}\n\n\tinputTask, err := t.extractPostTaskPayload(r, w)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tinputTask.PartnerID = partnerID\n\tinternalTasks, err := t.taskPersistence.GetByIDs(ctx, nil, inputTask.PartnerID, false, taskID)\n\tif err != nil && err != gocql.ErrNotFound {\n\t\tlogger.Log.ErrfCtx(r.Context(), errorcode.ErrorCantGetTaskByTaskID, \"TaskService.Edit: can not get internal tasks by Task ID %v. err=%v\", taskID, err)\n\t\tcommon.SendInternalServerError(w, r, errorcode.ErrorCantGetTaskByTaskID)\n\t\treturn\n\t}\n\n\tif len(internalTasks) == 0 {\n\t\tlogger.Log.ErrfCtx(r.Context(), errorcode.ErrorCantGetTaskByTaskID, \"TaskService.Edit: can not get internal tasks by Task ID %v. err=%v\", taskID, err)\n\t\tcommon.SendNotFound(w, r, errorcode.ErrorCantGetTaskByTaskID)\n\t\treturn\n\t}\n\n\ttask := internalTasks[0]\n\ttask.Schedule = inputTask.Schedule\n\ttask.Schedule.StartRunTime = task.Schedule.StartRunTime.Truncate(time.Minute)\n\ttask.Schedule.EndRunTime = task.Schedule.EndRunTime.Truncate(time.Minute)\n\ttask.ModifiedBy = currentUser.UID()\n\ttask.ModifiedAt = modifiedAt\n\ttask.DefinitionID = inputTask.DefinitionID\n\ttask.OriginID = inputTask.OriginID\n\ttask.PartnerID = partnerID\n\n\ttask.TargetsByType = inputTask.TargetsByType\n\tif task.TargetsByType == nil {\n\t\ttask.TargetsByType = make(models.TargetsByType)\n\t}\n\n\tif inputTask.Targets.Type != 0 {\n\t\ttask.TargetsByType[inputTask.Targets.Type] = inputTask.Targets.IDs\n\t}\n\n\tfor targetType, targets := range task.TargetsByType {\n\t\ttask.Targets.Type = targetType\n\t\ttask.Targets.IDs = targets\n\t}\n\n\tif len(inputTask.Parameters) > 0 {\n\t\ttask.Parameters = inputTask.Parameters\n\t}\n\n\tfor i := range internalTasks {\n\t\tinternalTasks[i].OriginalNextRunTime = time.Time{}\n\t\tif internalTasks[i].State != statuses.TaskStateDisabled {\n\t\t\tinternalTasks[i].State = statuses.TaskStateInactive\n\t\t}\n\t\tinternalTasks[i].ModifiedBy = currentUser.UID()\n\t}\n\n\tt.processEditReq(ctx, internalTasks, r, w, currentUser, task)\n}", "func (this *TodoList) GetTask(pID string) (rFound *Task) {\n\tif this != nil {\n\t\tfor _, zTask := range this.Tasks {\n\t\t\tif zTask.Id == pID {\n\t\t\t\treturn zTask\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func UpdateEventTaskStatus(etid int64, status int) error {\n\tvar dummy string\n\tif err := db.QueryRow(\"UPDATE event_tasks SET status=$1 WHERE id=$2 \"+\n\t\t\"RETURNING id\", status, etid).Scan(&dummy); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func GetTask(mapf func(string, string) []KeyValue,\n\treducef func(string, []string) string) (bool, bool, string, int) {\n\n\t// declare an argument structure.\n\targs := GetTaskArgs{}\n\n\t// fill in the argument(s).\n\n\t// declare a reply structure.\n\treply := GetTaskReply{}\n\n\t// send the RPC request, wait for the reply.\n\tcallSuccess := call(\"Master.GetTask\", &args, &reply)\n\ttaskSuccess := false\n\tif (callSuccess) {\n\t\ttaskSuccess = DoTask(reply, mapf, reducef);\n\t}\n\n\treturn callSuccess, taskSuccess, reply.TaskType, reply.TaskNumber;\n}", "func (d *DeploymentRequest) GetTask() string {\n\tif d == nil || d.Task == nil {\n\t\treturn \"\"\n\t}\n\treturn *d.Task\n}", "func (c Context) TaskID() string {\n\treturn c.Current().ID\n}", "func (d *Deployment) GetTask() string {\n\tif d == nil || d.Task == nil {\n\t\treturn \"\"\n\t}\n\treturn *d.Task\n}", "func GetTask(id bson.ObjectId) (*Task, error) {\n\ttask := Task{}\n\terr := sess.DB(\"\").C(taskC).FindId(id).One(&task)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &task, nil\n}", "func (m *LongRunningOperation) GetStatusDetail()(*string) {\n val, err := m.GetBackingStore().Get(\"statusDetail\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (c *Client) GetTaskURL(taskID string) string {\n\treturn TaskURL(c.server, taskID)\n}", "func (*Task) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_tasklist_server_proto_rawDescGZIP(), []int{0}\n}", "func (t *TaskBox[T, U, C, CT, TF]) GetStatus() int32 {\n\treturn t.status.Load()\n}", "func (a *Client) GetTaskInfo(params *GetTaskInfoParams, opts ...ClientOption) (*GetTaskInfoOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetTaskInfoParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"getTaskInfo\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/astrolabe/tasks/{taskID}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetTaskInfoReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetTaskInfoOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for getTaskInfo: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (db *DynamoDB) GetTask(ctx context.Context, req *tes.GetTaskRequest) (*tes.Task, error) {\n\tvar task *tes.Task\n\tvar response *dynamodb.GetItemOutput\n\tvar err error\n\n\tswitch req.View {\n\tcase tes.TaskView_MINIMAL:\n\t\tresponse, err = db.getMinimalView(ctx, req.Id)\n\tcase tes.TaskView_BASIC:\n\t\tresponse, err = db.getBasicView(ctx, req.Id)\n\tcase tes.TaskView_FULL:\n\t\tresponse, err = db.getFullView(ctx, req.Id)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif response.Item == nil {\n\t\treturn nil, grpc.Errorf(codes.NotFound, fmt.Sprintf(\"%v: taskID: %s\", errNotFound.Error(), req.Id))\n\t}\n\n\terr = dynamodbattribute.UnmarshalMap(response.Item, &task)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to DynamoDB unmarshal Task, %v\", err)\n\t}\n\n\treturn task, nil\n}", "func (s *Session) status() (string, error) {\n\tif s.task == nil {\n\t\treturn \"\", errors.New(\"snap task is not running or not found\")\n\t}\n\n\ttask := s.pClient.GetTask(s.task.ID)\n\tif task.Err != nil {\n\t\treturn \"\", errors.Wrapf(task.Err, \"could not get task name:%q, ID:%q\",\n\t\t\ts.task.Name, s.task.ID)\n\t}\n\n\treturn task.State, nil\n}", "func (s *Task) GetStatus() Status {\n\treturn s.results.GetStatus()\n}", "func GetTask(r *http.Request) *task.Task {\n\tif rv := r.Context().Value(model.ApiTaskKey); rv != nil {\n\t\tif t, ok := rv.(*task.Task); ok {\n\t\t\treturn t\n\t\t}\n\t}\n\treturn nil\n}", "func (handler *PreflightCheckHandler) CurrentTaskStatus() *TaskStatus {\n\ttaskStatus := handler.shellTask.CurrentTaskStatus()\n\ttaskStatus.Info = util.NewBuffer(1)\n\treturn taskStatus\n}", "func taskInfo(\n\tt *testing.T, task int,\n) (cmdline []string, env []string, ppid int, children []int) {\n\t// Get the command line of the task.\n\tcmd, err := ioutil.ReadFile(fmt.Sprintf(\"/proc/%d/cmdline\", task))\n\tTestExpectSuccess(t, err)\n\tcmdList := bytes.Split(cmd, []byte{0})\n\tcmdline = make([]string, len(cmdList)-1)\n\tfor i := range cmdline {\n\t\tcmdline[i] = string(cmdList[i])\n\t}\n\n\t// Get the environment of the process.\n\tenvData, err := ioutil.ReadFile(fmt.Sprintf(\"/proc/%d/environ\", task))\n\tTestExpectSuccess(t, err)\n\tenvList := bytes.Split(envData, []byte{0})\n\tenv = make([]string, len(envList)-1)\n\tfor i := range env {\n\t\tenv[i] = string(envList[i])\n\t}\n\t// Sort the environment for consistency.\n\tsort.Strings(env)\n\n\t// Get the pid of the parent process.\n\tstat, err := ioutil.ReadFile(fmt.Sprintf(\"/proc/%d/stat\", task))\n\tTestExpectSuccess(t, err)\n\tfields := strings.Split(string(stat), \" \")\n\tif len(fields) < 4 {\n\t\tFatalf(t, \"Unknown output in /proc/%d/stat: %d\", task, string(stat))\n\t}\n\tppid, err = strconv.Atoi(fields[3])\n\tTestExpectSuccess(t, err)\n\n\t// Now get a list of all of this tasks children.\n\tcldrn, err := ioutil.ReadFile(\n\t\tfmt.Sprintf(\"/proc/%d/task/%d/children\", task, task))\n\tTestExpectSuccess(t, err)\n\tchildrenStrs := strings.Split(string(cldrn), \" \")\n\tchildren = make([]int, len(childrenStrs)-1)\n\tfor i := range children {\n\t\tchildren[i], err = strconv.Atoi(childrenStrs[i])\n\t\tTestExpectSuccess(t, err)\n\t}\n\n\t// Success\n\treturn\n}", "func TaskNumGET(g *gin.Context) {\n\tg.JSON(http.StatusOK, gin.H{\"message\": \"ok\", \"num\": TaskNum})\n}", "func convertTaskToResult(testID string, task *swarmingAPI.SwarmingRpcsTaskResult, req *pb.DeriveChromiumInvocationRequest) (*pb.TestResult, error) {\n\tresultStatus := getTaskResultStatus(task)\n\tret := &pb.TestResult{\n\t\t// Use ninja target as test_id.\n\t\tTestId: testID,\n\t\tExpected: resultStatus == pb.TestStatus_PASS,\n\t\tStatus: resultStatus,\n\t}\n\n\t// Add the swarming task's url and state to summaryHTML.\n\tbuf := &strings.Builder{}\n\terr := summaryTmpl.Execute(buf, map[string]interface{}{\n\t\t\"url\": fmt.Sprintf(\"https://%s/task?id=%s\", req.SwarmingTask.Hostname, req.SwarmingTask.Id),\n\t\t\"state\": task.State,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tret.SummaryHtml = buf.String()\n\n\treturn ret, nil\n}", "func taskComplete(task string){\n\tfmt.Println(task)\n\tid, _ := primitive.ObjectIDFromHex(task)\n\tfilter := bson.M{\"_id\": id}\n\tupdate := bson.M{\"$set\": bson.M{\"status\": true}}\n\t_, err := collection.UpdateOne(context.Background(), filter, update)\n\tif err != nil {\n\t\tlog.Fatal(\"Error update task\", err)\n\t}\n\n\tfmt.Println(\"Task defined complete: \", id)\n}", "func taskDescriptionForTaskFlowLog(tsk sh_task.Task, action string, phase string, status string) string {\n\thm := task.HookMetadataAccessor(tsk)\n\n\tparts := make([]string, 0)\n\n\tswitch action {\n\tcase \"start\":\n\t\tparts = append(parts, fmt.Sprintf(\"%s task\", tsk.GetType()))\n\tcase \"end\":\n\t\tparts = append(parts, fmt.Sprintf(\"%s task done, result is '%s'\", tsk.GetType(), status))\n\tdefault:\n\t\tparts = append(parts, fmt.Sprintf(\"%s task %s\", action, tsk.GetType()))\n\t}\n\n\tparts = append(parts, \"for\")\n\n\tswitch tsk.GetType() {\n\tcase task.GlobalHookRun, task.ModuleHookRun:\n\t\t// Examples:\n\t\t// head task GlobalHookRun for 'beforeAll' binding, trigger AfterAll-Hooks-Change-DynamicEnabled\n\t\t// GlobalHookRun task for 'beforeAll' binding, trigger AfterAll-Hooks-Change-DynamicEnabled\n\t\t// GlobalHookRun task done, result 'Repeat' for 'beforeAll' binding, trigger AfterAll-Hooks-Change-DynamicEnabled\n\t\t// GlobalHookRun task for 'onKubernetes/cni_name' binding, trigger Kubernetes\n\t\t// GlobalHookRun task done, result 'Repeat' for 'onKubernetes/cni_name' binding, trigger Kubernetes\n\t\t// GlobalHookRun task for 'main' group binding, trigger Schedule\n\t\t// GlobalHookRun task done, result 'Fail' for 'main' group binding, trigger Schedule\n\t\t// GlobalHookRun task for 'main' group and 2 more bindings, trigger Schedule\n\t\t// GlobalHookRun task done, result 'Fail' for 'main' group and 2 more bindings, trigger Schedule\n\t\t// GlobalHookRun task for Synchronization of 'kubernetes/cni_name' binding, trigger KubernetesEvent\n\t\t// GlobalHookRun task done, result 'Success' for Synchronization of 'kubernetes/cni_name' binding, trigger KubernetesEvent\n\n\t\tif len(hm.BindingContext) > 0 {\n\t\t\tif hm.BindingContext[0].IsSynchronization() {\n\t\t\t\tparts = append(parts, \"Synchronization of\")\n\t\t\t}\n\n\t\t\tbindingType := hm.BindingContext[0].Metadata.BindingType\n\n\t\t\tgroup := hm.BindingContext[0].Metadata.Group\n\t\t\tif group == \"\" {\n\t\t\t\tname := hm.BindingContext[0].Binding\n\t\t\t\tif bindingType == htypes.OnKubernetesEvent || bindingType == htypes.Schedule {\n\t\t\t\t\tname = fmt.Sprintf(\"'%s/%s'\", bindingType, name)\n\t\t\t\t} else {\n\t\t\t\t\tname = string(bindingType)\n\t\t\t\t}\n\t\t\t\tparts = append(parts, name)\n\t\t\t} else {\n\t\t\t\tparts = append(parts, fmt.Sprintf(\"'%s' group\", group))\n\t\t\t}\n\n\t\t\tif len(hm.BindingContext) > 1 {\n\t\t\t\tparts = append(parts, \"and %d more bindings\")\n\t\t\t} else {\n\t\t\t\tparts = append(parts, \"binding\")\n\t\t\t}\n\t\t} else {\n\t\t\tparts = append(parts, \"no binding\")\n\t\t}\n\n\tcase task.ConvergeModules:\n\t\t// Examples:\n\t\t// ConvergeModules task for ReloadAllModules in phase 'WaitBeforeAll', trigger Operator-Startup\n\t\t// ConvergeModules task for KubeConfigChanged, trigger Operator-Startup\n\t\t// ConvergeModules task done, result is 'Keep' for converge phase 'WaitBeforeAll', trigger Operator-Startup\n\t\tif taskEvent, ok := tsk.GetProp(ConvergeEventProp).(ConvergeEvent); ok {\n\t\t\tparts = append(parts, string(taskEvent))\n\t\t\tif taskEvent != KubeConfigChanged {\n\t\t\t\tparts = append(parts, fmt.Sprintf(\"in phase '%s'\", phase))\n\t\t\t}\n\t\t}\n\n\tcase task.ModuleRun:\n\t\tparts = append(parts, fmt.Sprintf(\"module '%s', phase '%s'\", hm.ModuleName, phase))\n\t\tif hm.DoModuleStartup {\n\t\t\tparts = append(parts, \"with doModuleStartup\")\n\t\t}\n\n\tcase task.ModulePurge, task.ModuleDelete:\n\t\tparts = append(parts, fmt.Sprintf(\"module '%s'\", hm.ModuleName))\n\n\tcase task.GlobalHookEnableKubernetesBindings, task.GlobalHookWaitKubernetesSynchronization, task.GlobalHookEnableScheduleBindings:\n\t\t// Eaxmples:\n\t\t// GlobalHookEnableKubernetesBindings for the hook, trigger Operator-Startup\n\t\t// GlobalHookEnableKubernetesBindings done, result 'Success' for the hook, trigger Operator-Startup\n\t\tparts = append(parts, \"the hook\")\n\n\tcase task.DiscoverHelmReleases:\n\t\t// Examples:\n\t\t// DiscoverHelmReleases task, trigger Operator-Startup\n\t\t// DiscoverHelmReleases task done, result is 'Success', trigger Operator-Startup\n\t\t// Remove \"for\"\n\t\tparts = parts[:len(parts)-1]\n\t}\n\n\ttriggeredBy := hm.EventDescription\n\tif triggeredBy != \"\" {\n\t\ttriggeredBy = \", trigger is \" + triggeredBy\n\t}\n\n\treturn fmt.Sprintf(\"%s%s\", strings.Join(parts, \" \"), triggeredBy)\n}", "func (e *ECS) DescribeTaskDefinition(req *DescribeTaskDefinitionReq) (\n\t*DescribeTaskDefinitionResp, error) {\n\tif req == nil {\n\t\treturn nil, fmt.Errorf(\"The req params cannot be nil\")\n\t}\n\n\tparams := makeParams(\"DescribeTaskDefinition\")\n\tparams[\"taskDefinition\"] = req.TaskDefinition\n\n\tresp := new(DescribeTaskDefinitionResp)\n\tif err := e.query(params, resp); err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "func (c *Client) GetTask(ctx context.Context, in *todopb.TaskQuery, opts ...grpc.CallOption) (*todopb.TaskResponse, error) {\n\treturn c.client.GetTask(ctx, in, opts...)\n}", "func (ghidraScriptTask *GhidraScriptTask) Status() *GhidraTaskStatus {\n\treturn &ghidraScriptTask.status\n}", "func (t Task) String() string {\n\treturn fmt.Sprintf(\n\t\t\"<Task name=%s id=%s, status=%s, published_at=%s>\",\n\t\tt.Name, t.ID, t.StatusDisplay(), t.PublishedAt.String(),\n\t)\n}", "func (cl *RedisClient) GetTask() (*RedisTask, error) {\n\tval, err := cl.client.Keys(\"tasks:*\").Result()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar result *RedisTask\n\tvar key string\n\ttxf := func(tx *redis.Tx) error {\n\t\tresult = nil\n\t\tstate, err := tx.HGet(key, \"state\").Result()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif state == \"new\" {\n\t\t\tinputfile, err := cl.client.HGet(key, \"inputfile\").Result()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\toutfile, err := cl.client.HGet(key, \"outfile\").Result()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tresult = &RedisTask{}\n\t\t\tresult.InputFile = inputfile\n\t\t\tresult.OutFile = outfile\n\t\t\tresult.TaskName = key\n\t\t\t_, err = tx.HSet(key, \"state\", \"holded\").Result()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\tfor _, key = range val {\n\t\terr := cl.client.Watch(txf, key)\n\t\tif err == redis.TxFailedErr {\n\t\t\treturn nil, err\n\t\t}\n\t\tif result != nil {\n\t\t\treturn result, nil\n\t\t}\n\t}\n\n\treturn nil, nil\n}", "func TaskURL(swarmingService string, taskID string) string {\n\treturn fmt.Sprintf(\"%stask?id=%s\", swarmingService, taskID)\n}", "func (o *Run) SetTaskID(v string) {\n\to.TaskID = &v\n}", "func (*TaskRunStatus) Descriptor() ([]byte, []int) {\n\treturn file_taskrun_proto_rawDescGZIP(), []int{8}\n}", "func (db *DynamoDB) GetTask(ctx context.Context, req *tes.GetTaskRequest) (*tes.Task, error) {\n\tvar task *tes.Task\n\tvar response *dynamodb.GetItemOutput\n\tvar err error\n\n\tswitch req.View {\n\tcase tes.TaskView_MINIMAL:\n\t\tresponse, err = db.getMinimalView(ctx, req.Id)\n\tcase tes.TaskView_BASIC:\n\t\tresponse, err = db.getBasicView(ctx, req.Id)\n\tcase tes.TaskView_FULL:\n\t\tresponse, err = db.getFullView(ctx, req.Id)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif response.Item == nil {\n\t\treturn nil, tes.ErrNotFound\n\t}\n\n\terr = dynamodbattribute.UnmarshalMap(response.Item, &task)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to DynamoDB unmarshal Task, %v\", err)\n\t}\n\n\treturn task, nil\n}", "func (s *agentRegistry) GetTaskStatistics(ctx context.Context, in *pipeline.GetTaskStatisticsRequest) (*pipeline.GetTaskStatisticsResponse, error) {\n\ts.agentsMutex.Lock()\n\tdefer s.agentsMutex.Unlock()\n\n\tisTaskRequested := func(taskName string) bool {\n\t\tif len(in.GetTaskNames()) == 0 {\n\t\t\treturn true\n\t\t}\n\t\tfor _, x := range in.GetTaskNames() {\n\t\t\tif x == taskName {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\n\tresult := &pipeline.GetTaskStatisticsResponse{}\n\tfor name, list := range s.taskAgents {\n\t\tif isTaskRequested(name) {\n\t\t\tstat := tracking.TaskStatistics{\n\t\t\t\tName: name,\n\t\t\t}\n\t\t\tfor _, x := range list {\n\t\t\t\tstat.Add(x.Statistics.Data)\n\t\t\t}\n\t\t\tresult.Statistics = append(result.Statistics, &stat)\n\t\t}\n\t}\n\n\treturn result, nil\n}", "func (s *K8sSvc) GetServiceTask(ctx context.Context, cluster string, service string, containerInstanceID string) (serviceTaskID string, err error) {\n\treturn \"\", common.ErrNotSupported\n}", "func (t *Task) Info() string {\n\treturn t.info\n}", "func (o *OpenapiTaskGenerationResult) GetTaskDisplayName() string {\n\tif o == nil || o.TaskDisplayName == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.TaskDisplayName\n}", "func PrintStatus() {\n\threpo := sqlite.NewHeadsRepo()\n\ttrepo := sqlite.NewTaskRepo()\n\n\tvar pr *domain.Project\n\tvar t *domain.Task\n\tvar err error\n\n\tif t, pr, err = hrepo.GetCurrentTask(); err != nil {\n\t\tfmt.Printf(\"Error :%v\\n\", err)\n\t\treturn\n\t}\n\n\ttaskName := \"No definida\"\n\ttid := 0\n\n\tif t != nil {\n\t\ttaskName = t.Name\n\t\ttid = int(t.ID)\n\t}\n\n\tprojectName := \"No definido\"\n\tpid := 0\n\n\tif pr != nil {\n\t\tprojectName = pr.Name\n\t\tpid = int(pr.ID)\n\t}\n\n\ttoday, week, month, total, _ := trepo.GetAggregates(tid)\n\n\tst := status{\n\t\tCurrentProjectName: projectName,\n\t\tCurrentTaskName: taskName,\n\t\tPID: pid,\n\t\tTID: tid,\n\t\tTimeToday: minHours(today),\n\t\tTimeThisWeek: minHours(week),\n\t\tTimeThisMonth: minHours(month),\n\t\tTimeTotal: minHours(total),\n\t}\n\n\treport, err := template.New(\"report\").Parse(statusTemplate)\n\n\tif err != nil {\n\t\tfmt.Printf(\"Error %v\", err)\n\t\treturn\n\t}\n\n\terr = report.Execute(os.Stdout, st)\n\n\tif err != nil {\n\t\tfmt.Printf(\"Error %v\", err)\n\t}\n}", "func (o *OpenapiTaskGenerationResult) SetTaskStatus(v string) {\n\to.TaskStatus = &v\n}", "func (db *DynamoDB) ListTasks(ctx context.Context, req *tes.ListTasksRequest) (*tes.ListTasksResponse, error) {\n\n\tvar tasks []*tes.Task\n\tvar pageSize int64 = 256\n\tvar query *dynamodb.QueryInput\n\n\tif req.PageSize != 0 {\n\t\tpageSize = int64(req.GetPageSize())\n\t\tif pageSize > 2048 {\n\t\t\tpageSize = 2048\n\t\t}\n\t\tif pageSize < 50 {\n\t\t\tpageSize = 50\n\t\t}\n\t}\n\n\tquery = &dynamodb.QueryInput{\n\t\tTableName: aws.String(db.taskTable),\n\t\tLimit: aws.Int64(pageSize),\n\t\tScanIndexForward: aws.Bool(false),\n\t\tConsistentRead: aws.Bool(true),\n\t\tKeyConditionExpression: aws.String(fmt.Sprintf(\"%s = :v1\", db.partitionKey)),\n\t\tExpressionAttributeValues: map[string]*dynamodb.AttributeValue{\n\t\t\t\":v1\": {\n\t\t\t\tS: aws.String(db.partitionValue),\n\t\t\t},\n\t\t},\n\t}\n\n\tif req.View == tes.TaskView_MINIMAL {\n\t\tquery.ExpressionAttributeNames = map[string]*string{\n\t\t\t\"#state\": aws.String(\"state\"),\n\t\t}\n\t\tquery.ProjectionExpression = aws.String(\"id, #state\")\n\t}\n\n\tif req.PageToken != \"\" {\n\t\tquery.ExclusiveStartKey = map[string]*dynamodb.AttributeValue{\n\t\t\tdb.partitionKey: {\n\t\t\t\tS: aws.String(db.partitionValue),\n\t\t\t},\n\t\t\t\"id\": {\n\t\t\t\tS: aws.String(req.PageToken),\n\t\t\t},\n\t\t}\n\t}\n\n\tresponse, err := db.client.QueryWithContext(ctx, query)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif req.View == tes.TaskView_FULL {\n\t\tfor _, item := range response.Items {\n\t\t\t// TODO handle errors\n\t\t\t_ = db.getContent(ctx, item)\n\t\t\t_ = db.getExecutorOutput(ctx, item, \"stdout\", db.stdoutTable)\n\t\t\t_ = db.getExecutorOutput(ctx, item, \"stderr\", db.stderrTable)\n\t\t}\n\t}\n\n\terr = dynamodbattribute.UnmarshalListOfMaps(response.Items, &tasks)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to DynamoDB unmarshal Tasks, %v\", err)\n\t}\n\n\tout := tes.ListTasksResponse{\n\t\tTasks: tasks,\n\t}\n\n\tif response.LastEvaluatedKey != nil {\n\t\tout.NextPageToken = *response.LastEvaluatedKey[\"id\"].S\n\t}\n\n\treturn &out, nil\n}", "func (*FakeReconcilerClient) GetTask(string) (swarm.Task, error) {\n\treturn swarm.Task{}, FakeUnimplemented\n}", "func ReadTask(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tfmt.Fprint(w, \"ReadTask\\n\")\n}", "func (s *Service) UpdateTaskStatus(c context.Context, date string, typ int, status int) (err error) {\n\t_, err = s.dao.UpdateTaskStatus(c, date, typ, status)\n\treturn\n}" ]
[ "0.6450777", "0.612711", "0.6043263", "0.60372734", "0.5894179", "0.5767152", "0.5736859", "0.57292414", "0.5600359", "0.55213696", "0.5463764", "0.5417522", "0.5382704", "0.535509", "0.5335711", "0.53252643", "0.5318367", "0.52696025", "0.5261585", "0.5251186", "0.5250223", "0.5194984", "0.5189236", "0.51641816", "0.5157285", "0.5136428", "0.5135747", "0.51243675", "0.5113017", "0.5085984", "0.5084515", "0.50842863", "0.5079541", "0.5079287", "0.5054286", "0.50517905", "0.5009252", "0.49862555", "0.49830037", "0.49734968", "0.49708492", "0.49695918", "0.49600774", "0.49599028", "0.4951276", "0.4948772", "0.49334738", "0.4904156", "0.48959318", "0.4885645", "0.4883708", "0.488069", "0.48761278", "0.4876037", "0.4868738", "0.48646045", "0.48591495", "0.48558816", "0.4853292", "0.48490256", "0.4840546", "0.48332703", "0.48285782", "0.48257622", "0.48104978", "0.48095992", "0.4808198", "0.47978428", "0.47973487", "0.4796681", "0.47936824", "0.47876877", "0.47796893", "0.47760823", "0.47683752", "0.47597447", "0.4756437", "0.47558856", "0.475272", "0.47475457", "0.47410473", "0.47384256", "0.4736391", "0.47323415", "0.47322363", "0.47321165", "0.47310668", "0.47201332", "0.47163793", "0.47100893", "0.47066855", "0.47057438", "0.47048804", "0.47007877", "0.4696522", "0.46959075", "0.46911165", "0.46896455", "0.46795404", "0.4672923" ]
0.7474207
0
SignalTask function is used by drivers which support sending OS signals (SIGHUP, SIGKILL, SIGUSR1 etc.) to the task. It is an optional function and is listed as a capability in the driver Capabilities struct.
Функция SignalTask используется драйверами, поддерживающими отправку сигналов ОС (SIGHUP, SIGKILL, SIGUSR1 и т.д.) задаче. Это опциональная функция, которая перечисляется как возможность в структуре Capabilities драйвера.
func (d *Driver) SignalTask(taskID string, signal string) error { handle, ok := d.tasks.Get(taskID) if !ok { return drivers.ErrTaskNotFound } return d.podman.ContainerKill(d.ctx, handle.containerID, signal) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ProcessSignal(p *os.Process, sig os.Signal,) error", "func signal_disable(uint32) {}", "func signal(s os.Signal) {\n\tp, _ := os.FindProcess(os.Getpid())\n\t_ = p.Signal(s)\n\t// Sleep so test won't finish and signal will be received.\n\ttime.Sleep(999)\n}", "func signal_disable(s uint32) {\n}", "func (n *mockAgent) signalProcess(c *Container, processID string, signal syscall.Signal, all bool) error {\n\treturn nil\n}", "func sendSignal(status string) {\n\tcf := cloudformation.New(session.New(&aws.Config{Region: &region}))\n\tparams := &cloudformation.SignalResourceInput{\n\t\tLogicalResourceId: &resource,\n\t\tStackName: &stack,\n\t\tStatus: &status,\n\t\tUniqueId: &uniqueID,\n\t}\n\t_, err := cf.SignalResource(params)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to signal CloudFormation: %q.\\n\", err.Error())\n\t}\n\tlog.Printf(\"Sent a %q signal to CloudFormation.\\n\", status)\n\treturn\n}", "func (p *Process) Signal(sig os.Signal) error {\n return p.Process.Signal(sig)\n}", "func (x *CtlCommand) signal(rpcc *xmlrpcclient.XMLRPCClient, sigName string, processes []string) {\n\tfor _, process := range processes {\n\t\tif process == \"all\" {\n\t\t\treply, err := rpcc.SignalAll(process)\n\t\t\tif err == nil {\n\t\t\t\tx.showProcessInfo(&reply, make(map[string]bool))\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"Fail to send signal %s to all process\", sigName)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t} else {\n\t\t\treply, err := rpcc.SignalProcess(sigName, process)\n\t\t\tif err == nil && reply.Success {\n\t\t\t\tfmt.Printf(\"Succeed to send signal %s to process %s\\n\", sigName, process)\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"Fail to send signal %s to process %s\\n\", sigName, process)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t}\n\t}\n}", "func Signal(signs ...os.Signal) Option {\n\treturn func(o *options) { o.signs = signs }\n}", "func (x *CtlCommand) signal(rpcc *rpcclient.RPCClient, sig_name string, processes []string) {\n\tfor _, process := range processes {\n\t\tif process == \"all\" {\n\t\t\treply, err := rpcc.SignalAllProcesses(&rpcclient.SignalAllProcessesArg{\n\t\t\t\tSignal: sig_name,\n\t\t\t})\n\t\t\tif err == nil {\n\t\t\t\tx.showProcessInfo(reply.AllProcessInfo, make(map[string]bool))\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"Fail to send signal %s to all process\", sig_name)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t} else {\n\t\t\treply, err := rpcc.SignalProcess(&rpcclient.SignalProcessArg{\n\t\t\t\tProcName: process,\n\t\t\t\tSignal: sig_name,\n\t\t\t})\n\t\t\tif err == nil && reply.Success {\n\t\t\t\tfmt.Printf(\"Succeed to send signal %s to process %s\\n\", sig_name, process)\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"Fail to send signal %s to process %s\\n\", sig_name, process)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t}\n\t}\n}", "func (c *qemuCmd) Signal(sig unix.Signal) error {\n\tcommand := api.InstanceExecControl{\n\t\tCommand: \"signal\",\n\t\tSignal: int(sig),\n\t}\n\n\t// Check handler hasn't finished.\n\tselect {\n\tcase <-c.dataDone:\n\t\treturn fmt.Errorf(\"no such process\") // Aligns with error retured from unix.Kill in lxc's Signal().\n\tdefault:\n\t}\n\n\tc.controlSendCh <- command\n\terr := <-c.controlResCh\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogger.Debugf(`Forwarded signal \"%d\" to lxd-agent`, sig)\n\treturn nil\n}", "func Signal(sigs ...os.Signal) Option {\n\treturn func(o *options) { o.sigs = sigs }\n}", "func (p Process) Signal(sig os.Signal) error {\n\tif p.ops == nil {\n\t\treturn errInvalidProcess\n\t}\n\treturn p.ops.signal(sig)\n}", "func (p *Process) SendSignal(sig Signal) error {\n\treturn p.SendSignalWithContext(context.Background(), sig)\n}", "func (b *BoatHandle) Signal(sig os.Signal) error { return b.cmd.Process.Signal(sig) }", "func (c *gcsCore) SignalProcess(pid int, options prot.SignalProcessOptions) error {\n\tc.processCacheMutex.Lock()\n\tif _, ok := c.processCache[pid]; !ok {\n\t\tc.processCacheMutex.Unlock()\n\t\treturn gcserr.NewHresultError(gcserr.HrErrNotFound)\n\t}\n\tc.processCacheMutex.Unlock()\n\n\t// Interpret signal value 0 as SIGKILL.\n\t// TODO: Remove this special casing when we are not worried about breaking\n\t// older Windows builds which don't support sending signals.\n\tvar signal syscall.Signal\n\tif options.Signal == 0 {\n\t\tsignal = unix.SIGKILL\n\t} else {\n\t\tsignal = syscall.Signal(options.Signal)\n\t}\n\n\tif err := syscall.Kill(pid, signal); err != nil {\n\t\treturn errors.Wrapf(err, \"failed call to kill on process %d with signal %d\", pid, options.Signal)\n\t}\n\n\treturn nil\n}", "func X__sysv_signal(tls *TLS, signum int32, handler uintptr) {\n\tch := make(chan os.Signal)\n\tgo func() {\n\t\t<-ch\n\t\t(*(*func(*TLS, int32))(unsafe.Pointer(&handler)))(tls, signum)\n\t}()\n\tsignal.Notify(ch, syscall.Signal(signum))\n}", "func (s *Session) Signal(sig os.Signal) {\n\ts.command.Process.Signal(sig)\n}", "func (o *V0037JobProperties) SetSignal(v string) {\n\to.Signal = &v\n}", "func HandleSignal(b bool) Option {\n\treturn func(o *Options) {\n\t\to.Signal = b\n\t}\n}", "func (o *Wireless) SetSignal(v int32) {\n\to.Signal = &v\n}", "func (p *process) Signal(s os.Signal) error {\n\treturn syscall.Kill(p.pid, s.(syscall.Signal))\n}", "func signal() {\n\tnoEvents = true\n}", "func InterruptSignal(signal os.Signal) Option {\n\treturn func(s *Service) {\n\t\ts.interruptSignals = append(s.interruptSignals, signal)\n\t}\n}", "func signal_ignore(s uint32) {\n}", "func (srv *Server) handleSignal(msg *Message) {\n\tsrv.opsLock.Lock()\n\t// Ignore incoming signals during shutdown\n\tif srv.shutdown {\n\t\tsrv.opsLock.Unlock()\n\t\treturn\n\t}\n\tsrv.currentOps++\n\tsrv.opsLock.Unlock()\n\n\tsrv.hooks.OnSignal(context.WithValue(context.Background(), Msg, *msg))\n\n\t// Mark signal as done and shutdown the server if scheduled and no ops are left\n\tsrv.opsLock.Lock()\n\tsrv.currentOps--\n\tif srv.shutdown && srv.currentOps < 1 {\n\t\tclose(srv.shutdownRdy)\n\t}\n\tsrv.opsLock.Unlock()\n}", "func (x *RpcExector) signal(rpcc *rpc.XmlRPCClient, sig_name string, processes []string) {\n\tfor _, process := range processes {\n\t\tif process == \"all\" {\n\t\t\treply, err := rpcc.SignalAll(process)\n\t\t\tif err == nil {\n\t\t\t\tx.showProcessInfo(&reply, make(map[string]bool))\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"Fail to send signal %s to all process\", sig_name)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t} else {\n\t\t\treply, err := rpcc.SignalProcess(sig_name, process)\n\t\t\tif err == nil && reply.Success {\n\t\t\t\tfmt.Printf(\"Succeed to send signal %s to process %s\\n\", sig_name, process)\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"Fail to send signal %s to process %s\\n\", sig_name, process)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t}\n\t}\n}", "func (a *AbstractSessionChannelHandler) OnSignal(\n\t_ uint64,\n\t_ string,\n) error {\n\treturn fmt.Errorf(\"not supported\")\n}", "func (c *D) Signal(signal os.Signal) error {\n\tif !c.IsRunning() {\n\t\treturn ErrNotRunning\n\t}\n\treturn c.cmd.Process.Signal(signal)\n}", "func Signal(val string) error {\n\t_, err := signals.Parse(val)\n\tif err != nil {\n\t\treturn err //nolint: wrapcheck // error string formed in external package is styled correctly\n\t}\n\n\treturn nil\n}", "func NotifySignal(c chan<- Signal, sig ...Signal) error {\n\tif c == nil {\n\t\treturn fmt.Errorf(\"NotifySignal using nil channel\")\n\t}\n\n\tvar pid = os.Getpid()\n\tevts := make([]windows.Handle, 0, len(sig))\n\n\tfor _, s := range sig {\n\t\tname, err := windows.UTF16PtrFromString(eventName(s, pid))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\th, err := windows.CreateEvent(nil, 1, 0, name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tevts = append(evts, h)\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tev, err := windows.WaitForMultipleObjects(evts, false, windows.INFINITE)\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"WaitForMultipleObjects failed: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\toffset := ev - windows.WAIT_OBJECT_0\n\t\t\tc <- sig[offset]\n\t\t\tif err := windows.ResetEvent(evts[offset]); err != nil {\n\t\t\t\tlog.Printf(\"ResetEvent failed: %v\", err)\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn nil\n}", "func (k *KACollector) signal(sig syscall.Signal) error {\n\tps, err := process.Processes()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar pid int32\n\tfor _, p := range ps {\n\t\tname, err := p.Name()\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif name == \"keepalived\" {\n\t\t\tpid = p.Pid\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif pid == 0 {\n\t\treturn fmt.Errorf(\"cannot find pid\")\n\t}\n\n\tproc, err := os.FindProcess(int(pid))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"process %v: %v\", pid, err)\n\t}\n\n\terr = proc.Signal(sig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"signal %v: %v\", sig, err)\n\t}\n\n\ttime.Sleep(100 * time.Millisecond)\n\treturn nil\n}", "func (n *node) SignalProcessor() SignalProcessor {\n\treturn n.processor\n}", "func runTask(name string, parts []string, intervalSeconds uint64, signals []interface{}) {\n\tcmd, args := parts[0], parts[1:]\n\tfor {\n\t\tif err := exec.Command(cmd, args...).Run(); err != nil {\n\t\t\tlog.Error(\"Failed to run command '\" + name + \"': \" + err.Error())\n\t\t\ttime.Sleep(time.Duration(intervalSeconds) * time.Second)\n\t\t\tcontinue\n\t\t}\n\t\tlog.Debug(\"Command '\" + name + \"' run successfully...\")\n\n\t\t// Signal other components\n\t\tfor _, signal := range signals {\n\t\t\tmod := int(signal.(core.Config)[\"mod\"].(float64))\n\t\t\tsig := signal.(core.Config)[\"signal\"].(string)\n\t\t\tlog.Infof(\"Invoking signal '%s' on component %d\", sig, mod)\n\t\t\tmods[mod].Signal(sig)\n\t\t}\n\t\ttime.Sleep(time.Duration(intervalSeconds) * time.Second)\n\t}\n}", "func (t *task) Kill(_ context.Context, signal syscall.Signal) error {\n\thcsContainer, err := t.getHCSContainer()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogger := t.ctr.client.logger.WithFields(log.Fields{\n\t\t\"container\": t.ctr.id,\n\t\t\"process\": t.id,\n\t\t\"pid\": t.Pid(),\n\t\t\"signal\": signal,\n\t})\n\tlogger.Debug(\"Signal()\")\n\n\tvar op string\n\tif signal == syscall.SIGKILL {\n\t\t// Terminate the compute system\n\t\tt.ctr.mu.Lock()\n\t\tt.ctr.terminateInvoked = true\n\t\tt.ctr.mu.Unlock()\n\t\top, err = \"terminate\", hcsContainer.Terminate()\n\t} else {\n\t\t// Shut down the container\n\t\top, err = \"shutdown\", hcsContainer.Shutdown()\n\t}\n\tif err != nil {\n\t\tif !hcsshim.IsPending(err) && !hcsshim.IsAlreadyStopped(err) {\n\t\t\t// ignore errors\n\t\t\tlogger.WithError(err).Errorf(\"failed to %s hccshim container\", op)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (m *Master) SignalTaskStatus(args *model.TaskStatus, reply *bool) error {\n\tif !args.Success {\n\t\treturn nil\n\t}\n\n\tif m.phase == model.Map {\n\t\tlog.Infof(\"map phase for %s completed\", args.File)\n\t\tm.mutex.Lock()\n\t\tdefer m.mutex.Unlock()\n\t\tf := path.Base(args.File)\n\t\tif t, ok := m.mapTasks[f]; ok {\n\t\t\tif t.Status == inprogress {\n\t\t\t\tt.Status = completed\n\t\t\t\tt.Files = append(t.Files, args.OutFiles...)\n\t\t\t\tm.mapTasks[f] = t\n\t\t\t}\n\n\t\t\t// Build up reduce tasks.\n\t\t\tfor i, v := range args.OutFiles {\n\t\t\t\tkey := toString(i + 1)\n\t\t\t\tt := m.reduceTasks[key]\n\t\t\t\tt.Files = append(t.Files, v)\n\t\t\t\tm.reduceTasks[key] = t\n\t\t\t}\n\t\t}\n\t} else if m.phase == model.Reduce {\n\t\tlog.Infof(\"reduce phase %s completed\", args.File)\n\t\ti, _ := strconv.ParseInt(args.File, 10, 32)\n\t\tkey := toString(i + 1)\n\t\tm.mutex.Lock()\n\t\tdefer m.mutex.Unlock()\n\t\tif t, ok := m.reduceTasks[key]; ok {\n\t\t\tif t.Status == inprogress {\n\t\t\t\tt.Status = completed\n\t\t\t\tm.reduceTasks[key] = t\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func PidfdSendSignal(pidfd uintptr, signum unix.Signal) error {\n\t// the runtime OS thread must be locked to safely enter namespaces.\n\truntime.LockOSThread()\n\tdefer runtime.UnlockOSThread()\n\t// setns with pidfd requires at least kernel version 5.8.0\n\terr := unix.Setns(int(pidfd), unix.CLONE_NEWPID)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// pifd_send_signal was introduced in kernel version 5.3\n\t_, _, e1 := unix.Syscall(unix.SYS_PIDFD_SEND_SIGNAL, pidfd, uintptr(signum), 0)\n\tif e1 != 0 {\n\t\treturn e1\n\t}\n\treturn nil\n}", "func (c *Cond) Signal() {\n\tc.Do(func() {})\n}", "func (l *Libvirt) DomainSendProcessSignal(Dom Domain, PidValue int64, Signum uint32, Flags uint32) (err error) {\n\tvar buf []byte\n\n\targs := DomainSendProcessSignalArgs {\n\t\tDom: Dom,\n\t\tPidValue: PidValue,\n\t\tSignum: Signum,\n\t\tFlags: Flags,\n\t}\n\n\tbuf, err = encode(&args)\n\tif err != nil {\n\t\treturn\n\t}\n\n\n\t_, err = l.requestStream(295, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func handleSignal(env *Environment) {\n\tch := make(chan os.Signal, 2)\n\tsignal.Notify(ch, stopSignals...)\n\n\tgo func() {\n\t\ts := <-ch\n\t\tdelay := getDelaySecondsFromEnv()\n\t\tlog.Warn(\"well: got signal\", map[string]interface{}{\n\t\t\t\"signal\": s.String(),\n\t\t\t\"delay\": delay,\n\t\t})\n\t\ttime.Sleep(time.Duration(delay) * time.Second)\n\t\tenv.Cancel(errSignaled)\n\t}()\n}", "func (p *promise) Signal(waitChan chan Controller) Promise {\n\tp.Always(func(p2 Controller) {\n\t\twaitChan <- p2\n\t})\n\n\treturn p\n}", "func sendSignal(cmd *exec.Cmd, ch <-chan error, sig syscall.Signal, timeout time.Duration) bool {\n\tif cmd.Process == nil {\n\t\tlog.Debug(\"Not terminating process, it seems to have not started yet\")\n\t\treturn false\n\t}\n\t// This is a bit of a fiddle. We want to wait for the process to exit but only for just so\n\t// long (we do not want to get hung up if it ignores our SIGTERM).\n\tlog.Debug(\"Sending signal %s to -%d\", sig, cmd.Process.Pid)\n\tsyscall.Kill(-cmd.Process.Pid, sig) // Kill the group - we always set one in ExecCommand.\n\n\tselect {\n\tcase <-ch:\n\t\treturn true\n\tcase <-time.After(timeout):\n\t\treturn false\n\t}\n}", "func signal(x *decimal.Big, c decimal.Condition, err error) *decimal.Big {\n\tswitch ctx := &x.Context; ctx.OperatingMode {\n\tcase decimal.Go:\n\t\t// Go mode always panics on NaNs.\n\t\tif _, ok := err.(decimal.ErrNaN); ok {\n\t\t\tpanic(err)\n\t\t}\n\tcase decimal.GDA:\n\t\tctx.Conditions = c\n\t\tif c&ctx.Traps != 0 {\n\t\t\tctx.Err = err\n\t\t}\n\tdefault:\n\t\tctx.Conditions = c | decimal.InvalidContext\n\t\tctx.Err = fmt.Errorf(\"invalid OperatingMode: %d\", ctx.OperatingMode)\n\t\t// TODO(eric): Add a SetNaN method?\n\t\tx.SetString(\"qNaN\")\n\t}\n\treturn x\n}", "func TestSignal(t *testing.T) {\n\t// Ask for SIGHUP\n\tc := make(chan os.Signal, 1)\n\tNotify(c, syscall.SIGHUP)\n\tdefer Stop(c)\n\n\t// Send this process a SIGHUP\n\tt.Logf(\"sighup...\")\n\tsyscall.Kill(syscall.Getpid(), syscall.SIGHUP)\n\twaitSig(t, c, syscall.SIGHUP)\n\n\t// Ask for everything we can get. The buffer size has to be\n\t// more than 1, since the runtime might send SIGURG signals.\n\t// Using 10 is arbitrary.\n\tc1 := make(chan os.Signal, 10)\n\tNotify(c1)\n\t// Stop relaying the SIGURG signals. See #49724\n\tReset(syscall.SIGURG)\n\tdefer Stop(c1)\n\n\t// Send this process a SIGWINCH\n\tt.Logf(\"sigwinch...\")\n\tsyscall.Kill(syscall.Getpid(), syscall.SIGWINCH)\n\twaitSigAll(t, c1, syscall.SIGWINCH)\n\n\t// Send two more SIGHUPs, to make sure that\n\t// they get delivered on c1 and that not reading\n\t// from c does not block everything.\n\tt.Logf(\"sighup...\")\n\tsyscall.Kill(syscall.Getpid(), syscall.SIGHUP)\n\twaitSigAll(t, c1, syscall.SIGHUP)\n\tt.Logf(\"sighup...\")\n\tsyscall.Kill(syscall.Getpid(), syscall.SIGHUP)\n\twaitSigAll(t, c1, syscall.SIGHUP)\n\n\t// The first SIGHUP should be waiting for us on c.\n\twaitSig(t, c, syscall.SIGHUP)\n}", "func (server *Server) SendTask(s *TaskSignature) error {\n\tmessage, err := json.Marshal(s)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"JSON Encode Message: %v\", err)\n\t}\n\n\tif err := server.connection.PublishMessage(\n\t\t[]byte(message), s.RoutingKey,\n\t); err != nil {\n\t\treturn fmt.Errorf(\"Publish Message: %v\", err)\n\t}\n\n\treturn nil\n}", "func (c *Cmd) Signal(signal syscall.Signal) error {\n\tif c.Process == nil {\n\t\treturn errNotStarted\n\t}\n\tif c.ProcessState != nil {\n\t\treturn errAlreadyWaited\n\t}\n\n\t// Negative PID means the process group led by the process.\n\treturn syscall.Kill(-c.Process.Pid, signal)\n}", "func (c *Cmd) Signal(sig os.Signal) error {\n\treturn signal(c.cmd.Process, sig)\n}", "func TestSignals(t *testing.T) {\n\tseq := make(chan int)\n\twait := make(chan int)\n\tfreq := make(chan time.Time)\n\n\tqueue := &WaitQueue{\n\t\tsem: new(sync.WaitGroup),\n\t\tseq: seq,\n\t\twait: wait,\n\t}\n\n\t// begin listening\n\tgo waitListen(queue, freq, seq)\n\n\t// send a tick, this should start a call to Poll()\n\tfreq <- time.Now()\n\n\t// when that call starts, we should get `1` on the sequence channel\n\tval := <-seq\n\trequire.Equal(t, val, 1)\n\n\t// send a signal, this should start the graceful exit\n\tsignals <- os.Interrupt\n\n\t// tell Poll() that it can exit\n\twait <- 1\n\n\t// first Poll() should exit\n\tval = <-seq\n\trequire.Equal(t, val, 2)\n\n\t// then Listen() should exit\n\tval = <-seq\n\trequire.Equal(t, val, 3)\n}", "func (g *Goer) installSignal() {\n\tch := make(chan os.Signal, 1)\n\tsignal.Notify(ch, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGUSR1, syscall.SIGUSR2)\n\tfor signalType := range ch {\n\t\tswitch signalType {\n\t\t// stop process in debug mode with Ctrl+c.\n\t\tcase syscall.SIGINT:\n\t\t\tg.stopAll(ch, signalType)\n\t\t// kill signal in bash shell.\n\t\tcase syscall.SIGKILL | syscall.SIGTERM:\n\t\t\tg.stopAll(ch, signalType)\n\t\t// graceful reload\n\t\tcase syscall.SIGQUIT:\n\t\t\tsignal.Stop(ch)\n\t\t\tg.reload()\n\t\t\tos.Exit(0)\n\t\t}\n\t}\n}", "func waitForTask() {\n\tch := make(chan string)\n\n\tgo func() {\n\t\td := <-ch\n\t\tfmt.Println(\"child : recv'd signal :\", d)\n\t}()\n\n\ttime.Sleep(time.Duration(rand.Intn(500)) * time.Millisecond)\n\tch <- \"data\"\n\tfmt.Println(\"parent : sent signal\")\n\n\ttime.Sleep(time.Second)\n\tfmt.Println(\"-------------------------------------------------\")\n}", "func (t *Broadcaster) Signal(ctx context.Context) error {\n\tif !t.mutex.RTryLock(ctx) {\n\t\treturn context.DeadlineExceeded\n\t}\n\tdefer t.mutex.RUnlock()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn context.DeadlineExceeded\n\tcase t.channel <- struct{}{}:\n\tdefault:\n\t}\n\n\treturn nil\n}", "func (wc *workflowClient) SignalWorkflow(ctx context.Context, workflowID string, runID string, signalName string, arg interface{}) error {\n\tinput, err := encodeArg(wc.dataConverter, arg)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn signalWorkflow(ctx, wc.workflowService, wc.identity, wc.domain, workflowID, runID, signalName, input, wc.featureFlags)\n}", "func (sd *ScanDiapasons) NotifyDpnsTask(ctx context.Context) ([]byte, error) {\n\trequest, err := http.NewRequest(\"POST\", sd.client.Server+\"/api/v1.0/ScanDiapasons.NotifyDpnsTask\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\traw, err := sd.client.Do(ctx, request, nil)\n\treturn raw, err\n}", "func (p *Process) signalToProcess(signal os.Signal) error {\n\tif p.command == nil || p.command.Process == nil {\n\t\terr := errors.Errorf(\"attempt to send signal to non-running process\")\n\t\tp.log.Error(err)\n\t\treturn err\n\t}\n\n\treturn p.command.Process.Signal(signal)\n}", "func (o *ContainerSignalParams) SetSignal(signal int64) {\n\to.Signal = signal\n}", "func (s *sidecar) signalProcess() (err error) {\n\tif atomic.LoadInt32(&s.processRunning) == 0 {\n\t\tcmd := exec.Command(s.config.Cmd, strings.Split(s.config.CmdArgs, \" \")...)\n\t\tcmd.Stdout = os.Stdout\n\t\tcmd.Stderr = os.Stderr\n\t\terr = cmd.Start()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error executing process: %v\\n%v\", s.config.Cmd, err)\n\t\t}\n\t\ts.process = cmd.Process\n\t\tgo s.checkProcessExit()\n\t} else {\n\t\t// Signal to reload certs\n\t\tsig, err := getSignal(s.config.RenewSignal)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error getting signal: %v\\n%v\", s.config.RenewSignal, err)\n\t\t}\n\n\t\terr = s.process.Signal(sig)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error signaling process with signal: %v\\n%v\", sig, err)\n\t\t}\n\t}\n\n\treturn nil\n}", "func execNotify(arity int, p *gop.Context) {\n\targs := p.GetArgs(arity)\n\tconv := func(args []interface{}) []os.Signal {\n\t\tret := make([]os.Signal, len(args))\n\t\tfor i, arg := range args {\n\t\t\tret[i] = arg.(os.Signal)\n\t\t}\n\t\treturn ret\n\t}\n\tsignal.Notify(args[0].(chan<- os.Signal), conv(args[1:])...)\n}", "func (t ThriftHandler) SignalWorkflowExecution(ctx context.Context, request *h.SignalWorkflowExecutionRequest) (err error) {\n\terr = t.h.SignalWorkflowExecution(ctx, request)\n\treturn thrift.FromError(err)\n}", "func (s *BasevhdlListener) EnterSignal_mode(ctx *Signal_modeContext) {}", "func ToSignal(name string) (os.Signal, error) {\n\tif sig, ok := name2signal[name]; ok {\n\t\treturn sig, nil\n\t}\n\treturn nil, fmt.Errorf(\"invalid signal name: %s\", name)\n}", "func SetupSignal() {\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, os.Interrupt, syscall.SIGTERM)\n\tfor {\n\t\ts := <-c\n\t\tlog.WithField(\"signal\", s.String()).Info(\"signal\")\n\t\tswitch s {\n\t\tcase os.Interrupt, syscall.SIGTERM:\n\t\t\treturn\n\t\tdefault:\n\t\t\treturn\n\t\t}\n\t}\n}", "func SetupSignalTrap(handler func(os.Signal)) chan os.Signal {\n\tif len(notary.NotarySupportedSignals) == 0 {\n\t\treturn nil\n\n\t}\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, notary.NotarySupportedSignals...)\n\tgo func() {\n\t\tfor {\n\t\t\thandler(<-c)\n\t\t}\n\t}()\n\n\treturn c\n}", "func (this *ThreadCtl) WaitSignal() string {\n\tselect {\n\tcase signal := <-this.signalChan:\n\t\treturn signal\n\t}\n}", "func OnSignal(handler func(os.Signal), signals ...os.Signal) {\n\tif handler == nil || len(signals) == 0 {\n\t\treturn\n\t}\n\n\tsh := &sigHandler{\n\t\tsignals: signals,\n\t\ttarget: handler,\n\t}\n\tsh.Start()\n}", "func (s *Session) SendTask(t util.Task) error {\n\t// Checking taskID. re-enqueued task will be skipped\n\tif t.TaskID == \"\" {\n\t\tt.TaskID = uuid.New().String()\n\t\tif t.OriginalTaskID == \"\" {\n\t\t\tt.OriginalTaskID = t.TaskID\n\t\t}\n\n\t\tif err := s.taskRepo.CreateTask(&t); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Checking AMQP connection. Task will be logged for no connection. Re-enqueued later.\n\ts.mu.RLock()\n\tif !s.connected {\n\t\ts.lgr.Warn(\"No connection. Task enqueued.\", util.Object{Key: \"TaskID\", Val: t.TaskID})\n\t\treturn ErrNotConnected\n\t}\n\ts.mu.RUnlock()\n\n\tif !t.Priority.Valid() {\n\t\treturn ErrInvalidPriority\n\t}\n\n\tch, err := s.conn.Channel()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer ch.Close()\n\n\tif err := ch.Confirm(false); err != nil {\n\t\treturn err\n\t}\n\n\tcloseNotification := ch.NotifyClose(make(chan *amqp.Error, 1))\n\tpublish := ch.NotifyPublish(make(chan amqp.Confirmation, 1))\n\tpublishErr := make(chan error, 1)\n\n\tQueue, err := s.GetQueueName(t.Priority)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo func() {\n\t\terr := ch.Publish(\n\t\t\ts.cfg.AMQP.Exchange,\n\t\t\tQueue,\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\tamqp.Publishing{\n\t\t\t\tHeaders: map[string]interface{}{\n\t\t\t\t\t\"TaskName\": t.Name,\n\t\t\t\t\t\"TaskID\": t.TaskID,\n\t\t\t\t},\n\t\t\t\tMessageId: t.TaskID,\n\t\t\t\tDeliveryMode: amqp.Persistent,\n\t\t\t\tBody: t.Payload,\n\t\t\t},\n\t\t)\n\n\t\tif err != nil {\n\t\t\tpublishErr <- err\n\t\t\treturn\n\t\t}\n\n\t\ts.taskRepo.UpdateTaskStatus(context.Background(), t.TaskID, util.StatusQueued)\n\t}()\n\n\tdone := (<-chan time.Time)(make(chan time.Time, 1))\n\tif s.cfg.RequestTimeout != 0 {\n\t\tdone = time.After(s.cfg.RequestTimeout)\n\t}\n\n\tvar errs error\n\n\tselect {\n\tcase errs = <-closeNotification:\n\n\tcase errs = <-publishErr:\n\n\tcase p := <-publish:\n\t\tif !p.Ack {\n\t\t\ts.lgr.Warn(\"Task deliver failed\", util.Object{Key: \"TaskID\", Val: t.TaskID})\n\t\t\terrs = ErrNotPublished\n\t\t\tbreak\n\t\t}\n\t\ts.lgr.Info(\"Task delivered\", util.Object{Key: \"TaskID\", Val: t.TaskID})\n\tcase <-done:\n\t\terrs = ErrRequestTimeout\n\t}\n\n\t// For any kind of error, task will be retried if retry count non zero.\n\t// TODO: retry count only reduce for task processing related error.\n\tif errs != nil {\n\t\tif orgTask, err := s.taskRepo.GetTask(t.OriginalTaskID); err != nil {\n\t\t\ts.lgr.Error(\"failed to get task\", err, util.Object{Key: \"TaskID\", Val: t.OriginalTaskID})\n\t\t} else if orgTask.Retry != 0 {\n\t\t\tgo s.RetryTask(t)\n\t\t}\n\n\t\ts.taskRepo.UpdateTaskStatus(context.Background(), t.TaskID, util.StatusFailed, errs)\n\t}\n\n\treturn errs\n}", "func TrapSignal(cleanupFunc func()) {\n\tsigs := make(chan os.Signal, 1)\n\tsignal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)\n\n\tgo func() {\n\t\tsig := <-sigs\n\n\t\tif cleanupFunc != nil {\n\t\t\tcleanupFunc()\n\t\t}\n\t\texitCode := 128\n\n\t\tswitch sig {\n\t\tcase syscall.SIGINT:\n\t\t\texitCode += int(syscall.SIGINT)\n\t\tcase syscall.SIGTERM:\n\t\t\texitCode += int(syscall.SIGTERM)\n\t\t}\n\n\t\tos.Exit(exitCode)\n\t}()\n}", "func (s *ScanDrivers) SetScanTaskFlagsFunc(taskFlag func(name string, flag goforjj.YamlFlag) error) {\n\tif s == nil {\n\t\treturn\n\t}\n\ts.taskFlag = taskFlag\n}", "func (s WorkerSemaphore) Signal(n int) {\n\te := empty{}\n\tfor i := 0; i < n; i++ {\n\t\ts.permits <- e\n\t}\n}", "func (h *Hub) StartTask(ctx context.Context, request *pb.HubStartTaskRequest) (*pb.HubStartTaskReply, error) {\n\tlog.G(h.ctx).Info(\"handling StartTask request\", zap.Any(\"req\", request))\n\n\ttaskID := uuid.New()\n\tminer, err := h.selectMiner(request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar startRequest = &pb.MinerStartRequest{\n\t\tId: taskID,\n\t\tRegistry: request.Registry,\n\t\tImage: request.Image,\n\t\tAuth: request.Auth,\n\t\tPublicKeyData: request.PublicKeyData,\n\t\tCommitOnStop: request.CommitOnStop,\n\t\tEnv: request.Env,\n\t\tUsage: request.Requirements.GetResources(),\n\t\tRestartPolicy: &pb.ContainerRestartPolicy{\n\t\t\tName: \"\",\n\t\t\tMaximumRetryCount: 0,\n\t\t},\n\t}\n\n\tresp, err := miner.Client.Start(ctx, startRequest)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"failed to start %v\", err)\n\t}\n\n\troutes := []extRoute{}\n\tfor k, v := range resp.Ports {\n\t\t_, protocol, err := decodePortBinding(k)\n\t\tif err != nil {\n\t\t\tlog.G(h.ctx).Warn(\"failed to decode miner's port mapping\",\n\t\t\t\tzap.String(\"mapping\", k),\n\t\t\t\tzap.Error(err),\n\t\t\t)\n\t\t\tcontinue\n\t\t}\n\n\t\trealPort, err := strconv.ParseUint(v.Port, 10, 16)\n\t\tif err != nil {\n\t\t\tlog.G(h.ctx).Warn(\"failed to convert real port to uint16\",\n\t\t\t\tzap.Error(err),\n\t\t\t\tzap.String(\"port\", v.Port),\n\t\t\t)\n\t\t\tcontinue\n\t\t}\n\n\t\troute, err := miner.router.RegisterRoute(taskID, protocol, v.IP, uint16(realPort))\n\t\tif err != nil {\n\t\t\tlog.G(h.ctx).Warn(\"failed to register route\", zap.Error(err))\n\t\t\tcontinue\n\t\t}\n\t\troutes = append(routes, extRoute{\n\t\t\tcontainerPort: k,\n\t\t\troute: route,\n\t\t})\n\t}\n\n\th.setMinerTaskID(miner.ID(), taskID)\n\n\tresources := request.GetRequirements().GetResources()\n\tcpuCount := resources.GetCPUCores()\n\tmemoryCount := resources.GetMaxMemory()\n\n\tvar usage = resource.NewResources(int(cpuCount), int64(memoryCount))\n\tif err := miner.Consume(taskID, &usage); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar reply = pb.HubStartTaskReply{\n\t\tId: taskID,\n\t}\n\n\tfor _, route := range routes {\n\t\treply.Endpoint = append(\n\t\t\treply.Endpoint,\n\t\t\tfmt.Sprintf(\"%s->%s:%d\", route.containerPort, route.route.Host, route.route.Port),\n\t\t)\n\t}\n\n\treturn &reply, nil\n}", "func (s *ShutdownManager) SignalShutdown() {\n\ts.ShutdownState = true\n}", "func (ep *ExpectProcess) Signal(sig os.Signal) error {\n\tep.mu.Lock()\n\tdefer ep.mu.Unlock()\n\n\tif ep.cmd == nil {\n\t\treturn errors.New(\"expect process already closed\")\n\t}\n\n\treturn ep.cmd.Process.Signal(sig)\n}", "func signal_enable(s uint32) {\n\tif !sig.inuse {\n\t\t// The first call to signal_enable is for us\n\t\t// to use for initialization. It does not pass\n\t\t// signal information in m.\n\t\tsig.inuse = true // enable reception of signals; cannot disable\n\t\tnoteclear(&sig.note)\n\t\treturn\n\t}\n}", "func (n *Node) NodeSignal() *Signal {\n\treturn &n.NodeSig\n}", "func signalName(s syscall.Signal) string {\n\tif name, ok := signalNames[s]; ok {\n\t\treturn name\n\t}\n\treturn fmt.Sprintf(\"SIG %d\", s)\n}", "func (t *SignalTable)StartSignalHandle() {\n go t.signalHandle()\n}", "func Example_signal() {\n\tevents.Listen(&events.Listener{\n\t\tEventName: SignalHello,\n\t\tHandler: func(e events.Event) {\n\t\t\tfmt.Println(e)\n\t\t},\n\t})\n\tevents.Emit(events.Signal(SignalHello))\n\t// Output: Hello world\n}", "func (srv *Server) RegisterSignalHook(ppFlag int, sig os.Signal, f func()) (err error) {\n\tif ppFlag != PreSignal && ppFlag != PostSignal {\n\t\terr = fmt.Errorf(\"Invalid ppFlag argument. Must be either grace.PreSignal or grace.PostSignal\")\n\t\treturn\n\t}\n\tfor _, s := range hookableSignals {\n\t\tif s == sig {\n\t\t\tsrv.SignalHooks[ppFlag][sig] = append(srv.SignalHooks[ppFlag][sig], f)\n\t\t\treturn\n\t\t}\n\t}\n\terr = fmt.Errorf(\"Signal '%v' is not supported\", sig)\n\treturn\n}", "func (c cmdType) toServiceSignal() serviceSignal {\n\tswitch c {\n\tcase statusCmd:\n\t\treturn serviceStatus\n\tcase restartCmd:\n\t\treturn serviceRestart\n\t}\n\treturn serviceStatus\n}", "func SignalNum(s string) syscall.Signal {\n\tsignalNameMapOnce.Do(func() {\n\t\tsignalNameMap = make(map[string]syscall.Signal, len(signalList))\n\t\tfor _, signal := range signalList {\n\t\t\tsignalNameMap[signal.name] = signal.num\n\t\t}\n\t})\n\treturn signalNameMap[s]\n}", "func (m *MockOSProcess) Signal(arg0 os.Signal) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Signal\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (s *BasevhdlListener) EnterSignal_kind(ctx *Signal_kindContext) {}", "func (g *Pin) Notify(sig ...os.Signal) {\n\tc := make(chan os.Signal)\n\tsignal.Notify(c, sig...)\n\tgo func() {\n\t\tn := 0\n\t\tfor sig := range c {\n\t\t\tif n == 1 {\n\t\t\t\tpanic(\"got too many signals\")\n\t\t\t}\n\t\t\tg.Pull(fmt.Errorf(\"Recieved signal %s\", sig))\n\t\t\tn++\n\t\t}\n\t}()\n}", "func (t ThriftHandler) SignalWithStartWorkflowExecution(ctx context.Context, request *h.SignalWithStartWorkflowExecutionRequest) (response *shared.StartWorkflowExecutionResponse, err error) {\n\tresponse, err = t.h.SignalWithStartWorkflowExecution(ctx, request)\n\treturn response, thrift.FromError(err)\n}", "func (d *Daemon) Signal(sig os.Signal) error {\n\tprocess, err := d.Process()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn process.Signal(sig)\n}", "func (op *AddonOperator) TaskHandler(t sh_task.Task) queue.TaskResult {\n\ttaskLogLabels := t.GetLogLabels()\n\ttaskLogEntry := log.WithFields(utils.LabelsToLogFields(taskLogLabels))\n\tvar res queue.TaskResult\n\n\top.logTaskStart(taskLogEntry, t)\n\n\top.UpdateWaitInQueueMetric(t)\n\n\tswitch t.GetType() {\n\tcase task.GlobalHookRun:\n\t\tres = op.HandleGlobalHookRun(t, taskLogLabels)\n\n\tcase task.GlobalHookEnableScheduleBindings:\n\t\thm := task.HookMetadataAccessor(t)\n\t\tglobalHook := op.ModuleManager.GetGlobalHook(hm.HookName)\n\t\tglobalHook.HookController.EnableScheduleBindings()\n\t\tres.Status = queue.Success\n\n\tcase task.GlobalHookEnableKubernetesBindings:\n\t\tres = op.HandleGlobalHookEnableKubernetesBindings(t, taskLogLabels)\n\n\tcase task.GlobalHookWaitKubernetesSynchronization:\n\t\tres.Status = queue.Success\n\t\tif op.ModuleManager.GlobalSynchronizationNeeded() && !op.ModuleManager.GlobalSynchronizationState().IsComplete() {\n\t\t\t// dump state\n\t\t\top.ModuleManager.GlobalSynchronizationState().DebugDumpState(taskLogEntry)\n\t\t\tt.WithQueuedAt(time.Now())\n\t\t\tres.Status = queue.Repeat\n\t\t} else {\n\t\t\ttaskLogEntry.Info(\"Synchronization done for all global hooks\")\n\t\t}\n\n\tcase task.DiscoverHelmReleases:\n\t\tres = op.HandleDiscoverHelmReleases(t, taskLogLabels)\n\n\tcase task.ConvergeModules:\n\t\tres = op.HandleConvergeModules(t, taskLogLabels)\n\n\tcase task.ModuleRun:\n\t\tres = op.HandleModuleRun(t, taskLogLabels)\n\n\tcase task.ModuleDelete:\n\t\tres.Status = op.HandleModuleDelete(t, taskLogLabels)\n\n\tcase task.ModuleHookRun:\n\t\tres = op.HandleModuleHookRun(t, taskLogLabels)\n\n\tcase task.ModulePurge:\n\t\tres.Status = op.HandleModulePurge(t, taskLogLabels)\n\t}\n\n\tif res.Status == queue.Success {\n\t\torigAfterHandle := res.AfterHandle\n\t\tres.AfterHandle = func() {\n\t\t\top.CheckConvergeStatus(t)\n\t\t\tif origAfterHandle != nil {\n\t\t\t\torigAfterHandle()\n\t\t\t}\n\t\t}\n\t}\n\n\top.logTaskEnd(taskLogEntry, t, res)\n\n\treturn res\n}", "func (wp *WorkPool) PanicFunc(handler PanicFunc) {\n\twp.panicFunc = handler\n}", "func Kill(sig os.Signal) {\n go func() {\n signals.ch <- sig\n }()\n}", "func signals(signals ...os.Signal) (<-chan os.Signal, func()) {\n\tsigchan := make(chan os.Signal)\n\tsigrecv := events.Signal(sigchan)\n\tsignal.Notify(sigchan, signals...)\n\treturn sigrecv, func() { signal.Stop(sigchan) }\n}", "func handlerSignal() {\n\texpectedSignals := make(chan os.Signal, 1)\n\tdoneSignals := make(chan bool, 1)\n\n\t// register channel to receive 2 signals\n\tsignal.Notify(expectedSignals, syscall.SIGTERM, syscall.SIGINT)\n\n\t// this routine is blocking, i.e. when it gets one signal it prints it and notifies the program that it can finish\n\tgo func() {\n\t\tsig := <-expectedSignals\n\t\tfmt.Println()\n\t\tfmt.Println(sig.String())\n\t\tdoneSignals <- true\n\t}()\n\n\tfmt.Println(\"awaiting signal...\")\n\n\t<-doneSignals\n\n\tfmt.Println(\"exiting...\")\n}", "func trapSignals(sig ...os.Signal) {\n\t// channel to receive signals.\n\tsigCh := make(chan os.Signal, 1)\n\tdefer close(sigCh)\n\n\t// `signal.Notify` registers the given channel to\n\t// receive notifications of the specified signals.\n\tsignal.Notify(sigCh, sig...)\n\n\t// Wait for the signal.\n\t<-sigCh\n\n\t// Once signal has been received stop signal Notify handler.\n\n\tsignal.Stop(sigCh)\n\n\t// Cancel the global context\n\tglobalCancel()\n\n}", "func (f *Failer) KillTask(host, task string) error {\n\tscript := \"sudo pkill -x %s\"\n\tlog.V(1).Infof(\"Killing task %s on host %s\", task, host)\n\treturn f.runWithEvilTag(host, fmt.Sprintf(script, task))\n}", "func (m *MockProcess) Signal(arg0 os.Signal) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Signal\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func KillTask(tid int) Errno {\n\t_, e := internal.Syscall1(KILLTASK, uintptr(tid))\n\treturn Errno(e)\n}", "func (q *queue) Signal() {\n\tq.notEmpty.Broadcast()\n}", "func (s *Server) RegisterTask(name string, handlerFunc *func(v []interface{}) (interface{}, error)) error {\n\tif _, found := s.handlers[name]; found {\n\t\treturn ErrDuplicateHandler\n\t}\n\ts.handlers[name] = handlerFunc\n\treturn nil\n}", "func (server *Server) RegisterTask(name string, task interface{}) {\n\tserver.registeredTasks[name] = task\n}", "func (s *countingSemaphore) Signal() {\n\ts.sem <- 1\n}", "func (r *Redis) PushTask(task *Task) error {\n\tconn := r.pool.Get()\n\tdefer conn.Close()\n\n\t_, err := conn.Do(\"ZADD\", syncTasksPriorityQueueKey, task.Priority, task.ID)\n\tnoticeError(err)\n\tif err != nil {\n\t\tif err == redis.ErrNil {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *gcsCore) SignalContainer(id string, signal syscall.Signal) error {\n\tc.containerCacheMutex.Lock()\n\tdefer c.containerCacheMutex.Unlock()\n\n\tcontainerEntry := c.getContainer(id)\n\tif containerEntry == nil {\n\t\treturn gcserr.NewHresultError(gcserr.HrVmcomputeSystemNotFound)\n\t}\n\n\tif containerEntry.container != nil {\n\t\tif err := containerEntry.container.Kill(signal); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func writeCrashSignal(crashSig string) {\n\tif err := ioutil.WriteFile(crashSig, []byte{}, 0644); err != nil {\n\t\tlog.Fatalf(\"failed to write crash signal: %v\", err)\n\t}\n}" ]
[ "0.61870855", "0.5511749", "0.5325872", "0.5245061", "0.52382535", "0.5158235", "0.5155546", "0.5136468", "0.5113385", "0.5107931", "0.50993425", "0.508363", "0.50823617", "0.5018183", "0.5008709", "0.49947438", "0.49496862", "0.49458396", "0.49453184", "0.49269986", "0.49240094", "0.49110368", "0.4904311", "0.48738256", "0.48690024", "0.48655665", "0.48462573", "0.48242965", "0.48215464", "0.47883642", "0.47867918", "0.4785958", "0.4762723", "0.47540084", "0.47390747", "0.47348765", "0.47182396", "0.46998435", "0.46948454", "0.4683117", "0.4666159", "0.46564183", "0.46561903", "0.46381968", "0.46290815", "0.46285972", "0.46197823", "0.4618494", "0.4598269", "0.4591346", "0.45692986", "0.45574635", "0.45524114", "0.4535499", "0.4524541", "0.45223144", "0.44878972", "0.44832766", "0.44568923", "0.44546703", "0.44451788", "0.44346553", "0.44317025", "0.44225568", "0.44191268", "0.4418454", "0.44088608", "0.44021666", "0.4398398", "0.43868148", "0.43821487", "0.43802446", "0.43708178", "0.43595684", "0.4358428", "0.4356591", "0.43501025", "0.43355572", "0.43231592", "0.43193874", "0.43135682", "0.43079275", "0.4306713", "0.42993408", "0.42923892", "0.42883217", "0.42853367", "0.42758608", "0.42686063", "0.42655313", "0.4263792", "0.42633364", "0.4261257", "0.42579207", "0.42531994", "0.42523578", "0.42514333", "0.42438874", "0.42424598", "0.42284328" ]
0.7002219
0
ExecTask function is used by the Nomad client to execute commands inside the task execution context.
Функция ExecTask используется клиентом Nomad для выполнения команд внутри контекста выполнения задачи.
func (d *Driver) ExecTask(taskID string, cmd []string, timeout time.Duration) (*drivers.ExecTaskResult, error) { return nil, fmt.Errorf("Podman driver does not support exec") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (ts *TaskService) Exec(ctx context.Context, req *taskAPI.ExecProcessRequest) (*types.Empty, error) {\n\tdefer logPanicAndDie(log.G(ctx))\n\n\tlog.G(ctx).WithFields(logrus.Fields{\"id\": req.ID, \"exec_id\": req.ExecID}).Debug(\"exec\")\n\ttask, err := ts.taskManager.Task(req.ID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tctx = namespaces.WithNamespace(ctx, defaultNamespace)\n\tresp, err := task.Exec(ctx, req)\n\tif err != nil {\n\t\tlog.G(ctx).WithError(err).Error(\"exec failed\")\n\t\treturn nil, err\n\t}\n\n\tlog.G(ctx).Debug(\"exec succeeded\")\n\treturn resp, nil\n}", "func (ts *TaskService) Exec(requestCtx context.Context, req *taskAPI.ExecProcessRequest) (*types.Empty, error) {\n\tdefer logPanicAndDie(log.G(requestCtx))\n\n\ttaskID := req.ID\n\texecID := req.ExecID\n\n\tlogger := log.G(requestCtx).WithField(\"TaskID\", taskID).WithField(\"ExecID\", execID)\n\tlogger.Debug(\"exec\")\n\n\textraData, err := unmarshalExtraData(req.Spec)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to unmarshal extra data\")\n\t}\n\n\t// Just provide runc the options it knows about, not our wrapper\n\treq.Spec = extraData.RuncOptions\n\n\tbundleDir := bundle.Dir(filepath.Join(containerRootDir, taskID))\n\n\tvar ioConnectorSet vm.IOProxy\n\n\tif vm.IsAgentOnlyIO(req.Stdout, logger) {\n\t\tioConnectorSet = vm.NewNullIOProxy()\n\t} else {\n\t\t// Override the incoming stdio FIFOs, which have paths from the host that we can't use\n\t\tfifoSet, err := cio.NewFIFOSetInDir(bundleDir.RootPath(), fifoName(taskID, execID), req.Terminal)\n\t\tif err != nil {\n\t\t\tlogger.WithError(err).Error(\"failed opening stdio FIFOs\")\n\t\t\treturn nil, errors.Wrap(err, \"failed to open stdio FIFOs\")\n\t\t}\n\n\t\tvar stdinConnectorPair *vm.IOConnectorPair\n\t\tif req.Stdin != \"\" {\n\t\t\treq.Stdin = fifoSet.Stdin\n\t\t\tstdinConnectorPair = &vm.IOConnectorPair{\n\t\t\t\tReadConnector: vm.VSockAcceptConnector(extraData.StdinPort),\n\t\t\t\tWriteConnector: vm.FIFOConnector(fifoSet.Stdin),\n\t\t\t}\n\t\t}\n\n\t\tvar stdoutConnectorPair *vm.IOConnectorPair\n\t\tif req.Stdout != \"\" {\n\t\t\treq.Stdout = fifoSet.Stdout\n\t\t\tstdoutConnectorPair = &vm.IOConnectorPair{\n\t\t\t\tReadConnector: vm.FIFOConnector(fifoSet.Stdout),\n\t\t\t\tWriteConnector: vm.VSockAcceptConnector(extraData.StdoutPort),\n\t\t\t}\n\t\t}\n\n\t\tvar stderrConnectorPair *vm.IOConnectorPair\n\t\tif req.Stderr != \"\" {\n\t\t\treq.Stderr = fifoSet.Stderr\n\t\t\tstderrConnectorPair = &vm.IOConnectorPair{\n\t\t\t\tReadConnector: vm.FIFOConnector(fifoSet.Stderr),\n\t\t\t\tWriteConnector: vm.VSockAcceptConnector(extraData.StderrPort),\n\t\t\t}\n\t\t}\n\n\t\tioConnectorSet = vm.NewIOConnectorProxy(stdinConnectorPair, stdoutConnectorPair, stderrConnectorPair)\n\t}\n\n\tresp, err := ts.taskManager.ExecProcess(requestCtx, req, ts.runcService, ioConnectorSet)\n\tif err != nil {\n\t\tlogger.WithError(err).Error(\"exec failed\")\n\t\treturn nil, err\n\t}\n\n\tlogger.Debug(\"exec succeeded\")\n\treturn resp, nil\n}", "func ExecTaskDirectly(paramTask, dbTask *OwlTask) error {\n\tstartId, err := getExecStartId(paramTask.Action, dbTask.ExecItems, paramTask.ExecItem)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// mean need't exec task\n\tif startId < 0 {\n\t\treturn refreshTaskStatus(paramTask.ID, 0, 0, \"\", \"\")\n\t}\n\n\t//exec task\n\tjump := true\n\tfailed := false\n\tbeginTime := time.Now().Unix()\n\tfor _, subTask := range dbTask.SubTasks {\n\t\tdbInfo, err := dbTool.GetDBConn(subTask.DbName, subTask.ClusterName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, item := range subTask.ExecItems {\n\t\t\tif item.ID != startId && jump {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tjump = false\n\n\t\t\terr := BackupAndExec(dbInfo.DB, &item, subTask.TaskType)\n\t\t\tif err != nil {\n\t\t\t\tfailed = true\n\t\t\t\terr := refreshTaskStatus(paramTask.ID, beginTime, 0, paramTask.Executor, err.Error())\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Errorf(\"after exec failed, update task status to failed err, err: %s\", err.Error())\n\t\t\t\t}\n\n\t\t\t\t// stop all task\n\t\t\t\tdbInfo.CloseConn()\n\t\t\t\tgoto Failed\n\t\t\t}\n\t\t}\n\n\t\tdbInfo.CloseConn()\n\t}\n\nFailed:\n\n\tif !failed {\n\t\terr = refreshTaskStatus(paramTask.ID, beginTime, time.Now().Unix(), paramTask.Executor, \"\")\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"after exec, update task status to success err, err: %s\", err.Error())\n\t\t}\n\t}\n\n\treturn nil\n}", "func (ft *CustomTask) Exec(t *f.TaskNode, p *f.Params, out *io.PipeWriter) {\n\tglog.Info(\"executing custom task \", p.Complete)\n\n\tft.customFunc(t, p, out)\n\n\treturn\n}", "func (h *DriverHandle) Exec(timeout time.Duration, cmd string, args []string) ([]byte, int, error) {\n\tcommand := append([]string{cmd}, args...)\n\tres, err := h.driver.ExecTask(h.taskID, command, timeout)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\treturn res.Stdout, res.ExitResult.ExitCode, res.ExitResult.Err\n}", "func (c *Module) Exec(ns string, containerID string, timeout time.Duration, args ...string) error {\n\tvar timedout bool\n\tclient, err := containerd.New(c.containerd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer client.Close()\n\tctx := namespaces.WithNamespace(context.Background(), ns)\n\tcreatectx, cancel := context.WithTimeout(ctx, timeout)\n\tdefer cancel()\n\n\tcontainer, err := client.LoadContainer(createctx, containerID)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"couldn't load container\")\n\t}\n\tt, err := container.Task(createctx, nil)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to create task\")\n\t}\n\tvar p specs.Process\n\tp.Cwd = \"/\"\n\tp.Args = args\n\ttaskID, err := uuid.NewUUID()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to generate a uuid\")\n\t}\n\tpr, err := t.Exec(createctx, taskID.String(), &p, cio.NullIO)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to exec new porcess\")\n\t}\n\tif err := pr.Start(createctx); err != nil {\n\t\treturn errors.Wrap(err, \"failed to start process\")\n\t}\n\tch, err := pr.Wait(createctx)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to wait for process\")\n\t}\n\tselect {\n\tcase <-ch:\n\tcase <-createctx.Done():\n\t}\n\tdeleteCtx, cancel := context.WithTimeout(ctx, 2*time.Second)\n\tdefer cancel()\n\t// if still running => execution timedout\n\tst, err := pr.Status(deleteCtx)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"couldn't check task state\")\n\t}\n\tif st.Status != containerd.Stopped {\n\t\ttimedout = true\n\t}\n\tex, err := pr.Delete(deleteCtx, containerd.WithProcessKill)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error deleting the created task\")\n\t}\n\tif timedout {\n\t\treturn errors.New(\"execution timed out\")\n\t} else if ex.ExitCode() != 0 {\n\t\treturn fmt.Errorf(\"non-zero exit code: %d\", ex.ExitCode())\n\t}\n\treturn nil\n}", "func (inst *IndependentInstance) execTask(behavior model.TaskBehavior, taskInst *TaskInst) {\n\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\n\t\t\terr := fmt.Errorf(\"Unhandled Error executing task '%s' : %v\", taskInst.task.Name(), r)\n\t\t\tlogger.Error(err)\n\n\t\t\t// todo: useful for debugging\n\t\t\tlogger.Errorf(\"StackTrace: %s\", debug.Stack())\n\n\t\t\tif !taskInst.flowInst.isHandlingError {\n\n\t\t\t\ttaskInst.appendErrorData(NewActivityEvalError(taskInst.task.Name(), \"unhandled\", err.Error()))\n\t\t\t\tinst.HandleGlobalError(taskInst.flowInst, err)\n\t\t\t}\n\t\t\t// else what should we do?\n\t\t}\n\t}()\n\n\tvar err error\n\n\tvar evalResult model.EvalResult\n\n\tif taskInst.status == model.TaskStatusWaiting {\n\n\t\tevalResult, err = behavior.PostEval(taskInst)\n\n\t} else {\n\t\tevalResult, err = behavior.Eval(taskInst)\n\t}\n\n\tif err != nil {\n\t\ttaskInst.returnError = err\n\t\tinst.handleTaskError(behavior, taskInst, err)\n\t\treturn\n\t}\n\n\tswitch evalResult {\n\tcase model.EVAL_DONE:\n\t\ttaskInst.SetStatus(model.TaskStatusDone)\n\t\tinst.handleTaskDone(behavior, taskInst)\n\tcase model.EVAL_SKIP:\n\t\ttaskInst.SetStatus(model.TaskStatusSkipped)\n\t\tinst.handleTaskDone(behavior, taskInst)\n\tcase model.EVAL_WAIT:\n\t\ttaskInst.SetStatus(model.TaskStatusWaiting)\n\tcase model.EVAL_FAIL:\n\t\ttaskInst.SetStatus(model.TaskStatusFailed)\n\tcase model.EVAL_REPEAT:\n\t\ttaskInst.SetStatus(model.TaskStatusReady)\n\t\t//task needs to iterate or retry\n\t\tinst.scheduleEval(taskInst)\n\t}\n}", "func (p *Pool) Exec(task Task) {\n\tp.tasks <- task\n}", "func (g *GoTasks) Exec(name string, opt ...ExecOption) error {\n\ttask, ok := g.tasks[name]\n\tif !ok {\n\t\treturn errTaskNotFound\n\t}\n\n\toptions := func(o []ExecOption) *Option {\n\t\topts := &Option{}\n\t\tfor _, o := range opt {\n\t\t\to(opts)\n\t\t}\n\t\treturn opts\n\t}(opt)\n\tctx, cancel := makeContext(options)\n\tdefer cancel()\n\tif options.usePool {\n\t\tpoolExec(options.numGoroutines, task)\n\t\treturn nil\n\t}\n\tsingleExec(ctx, task, options)\n\treturn nil\n}", "func (r *remoteRuntimeService) Exec(ctx context.Context, req *runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error) {\n\tklog.V(10).InfoS(\"[RemoteRuntimeService] Exec\", \"timeout\", r.timeout)\n\tctx, cancel := context.WithTimeout(ctx, r.timeout)\n\tdefer cancel()\n\n\treturn r.execV1(ctx, req)\n}", "func (pge *PgEngine) ExecuteSQLTask(ctx context.Context, tx pgx.Tx, task *ChainTask, paramValues []string) (out string, err error) {\n\tvar execTx pgx.Tx\n\tvar remoteDb PgxConnIface\n\tvar executor executor\n\n\texecTx = tx\n\tif task.Autonomous {\n\t\texecutor = pge.ConfigDb\n\t} else {\n\t\texecutor = tx\n\t}\n\n\t//Connect to Remote DB\n\tif task.ConnectString.Status != pgtype.Null {\n\t\tremoteDb, execTx, err = pge.GetRemoteDBTransaction(ctx, task.ConnectString.String)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tif task.Autonomous {\n\t\t\texecutor = remoteDb\n\t\t\t_ = execTx.Rollback(ctx)\n\t\t} else {\n\t\t\texecutor = execTx\n\t\t}\n\n\t\tdefer pge.FinalizeRemoteDBConnection(ctx, remoteDb)\n\t}\n\n\t// Set Role\n\tif task.RunAs.Status != pgtype.Null && !task.Autonomous {\n\t\tpge.SetRole(ctx, execTx, task.RunAs)\n\t}\n\n\tif task.IgnoreError && !task.Autonomous {\n\t\tpge.MustSavepoint(ctx, execTx, fmt.Sprintf(\"task_%d\", task.TaskID))\n\t}\n\n\tout, err = pge.ExecuteSQLCommand(ctx, executor, task.Script, paramValues)\n\n\tif err != nil && task.IgnoreError && !task.Autonomous {\n\t\tpge.MustRollbackToSavepoint(ctx, execTx, fmt.Sprintf(\"task_%d\", task.TaskID))\n\t}\n\n\t//Reset The Role\n\tif task.RunAs.Status != pgtype.Null && !task.Autonomous {\n\t\tpge.ResetRole(ctx, execTx)\n\t}\n\n\t// Commit changes on remote server\n\tif task.ConnectString.Status != pgtype.Null && !task.Autonomous {\n\t\tpge.MustCommitTransaction(ctx, execTx)\n\t}\n\n\treturn\n}", "func (t *task) Exec(ctx context.Context, processID string, spec *specs.Process, withStdin bool, attachStdio libcontainerdtypes.StdioCallback) (libcontainerdtypes.Process, error) {\n\thcsContainer, err := t.getHCSContainer()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlogger := t.ctr.client.logger.WithFields(log.Fields{\n\t\t\"container\": t.ctr.id,\n\t\t\"exec\": processID,\n\t})\n\n\t// Note we always tell HCS to\n\t// create stdout as it's required regardless of '-i' or '-t' options, so that\n\t// docker can always grab the output through logs. We also tell HCS to always\n\t// create stdin, even if it's not used - it will be closed shortly. Stderr\n\t// is only created if it we're not -t.\n\tcreateProcessParms := &hcsshim.ProcessConfig{\n\t\tCreateStdInPipe: true,\n\t\tCreateStdOutPipe: true,\n\t\tCreateStdErrPipe: !spec.Terminal,\n\t}\n\tif spec.Terminal {\n\t\tcreateProcessParms.EmulateConsole = true\n\t\tif spec.ConsoleSize != nil {\n\t\t\tcreateProcessParms.ConsoleSize[0] = uint(spec.ConsoleSize.Height)\n\t\t\tcreateProcessParms.ConsoleSize[1] = uint(spec.ConsoleSize.Width)\n\t\t}\n\t}\n\n\t// Take working directory from the process to add if it is defined,\n\t// otherwise take from the first process.\n\tif spec.Cwd != \"\" {\n\t\tcreateProcessParms.WorkingDirectory = spec.Cwd\n\t} else {\n\t\tcreateProcessParms.WorkingDirectory = t.ctr.ociSpec.Process.Cwd\n\t}\n\n\t// Configure the environment for the process\n\tcreateProcessParms.Environment = setupEnvironmentVariables(spec.Env)\n\n\t// Configure the CommandLine/CommandArgs\n\tsetCommandLineAndArgs(spec, createProcessParms)\n\tlogger.Debugf(\"exec commandLine: %s\", createProcessParms.CommandLine)\n\n\tcreateProcessParms.User = spec.User.Username\n\n\t// Start the command running in the container.\n\tnewProcess, err := hcsContainer.CreateProcess(createProcessParms)\n\tif err != nil {\n\t\tlogger.WithError(err).Errorf(\"exec's CreateProcess() failed\")\n\t\treturn nil, err\n\t}\n\tpid := newProcess.Pid()\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif err := newProcess.Kill(); err != nil {\n\t\t\t\tlogger.WithError(err).Error(\"failed to kill process\")\n\t\t\t}\n\t\t\tgo func() {\n\t\t\t\tif err := newProcess.Wait(); err != nil {\n\t\t\t\t\tlogger.WithError(err).Error(\"failed to wait for process\")\n\t\t\t\t}\n\t\t\t\tif err := newProcess.Close(); err != nil {\n\t\t\t\t\tlogger.WithError(err).Error(\"failed to clean process resources\")\n\t\t\t\t}\n\t\t\t}()\n\t\t}\n\t}()\n\n\tdio, err := newIOFromProcess(newProcess, spec.Terminal)\n\tif err != nil {\n\t\tlogger.WithError(err).Error(\"failed to get stdio pipes\")\n\t\treturn nil, err\n\t}\n\t// Tell the engine to attach streams back to the client\n\t_, err = attachStdio(dio)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp := &process{\n\t\tid: processID,\n\t\tctr: t.ctr,\n\t\thcsProcess: newProcess,\n\t\twaitCh: make(chan struct{}),\n\t}\n\n\t// Spin up a goroutine to notify the backend and clean up resources when\n\t// the process exits. Defer until after the start event is sent so that\n\t// the exit event is not sent out-of-order.\n\tdefer func() { go p.reap() }()\n\n\tt.ctr.client.eventQ.Append(t.ctr.id, func() {\n\t\tei := libcontainerdtypes.EventInfo{\n\t\t\tContainerID: t.ctr.id,\n\t\t\tProcessID: p.id,\n\t\t\tPid: uint32(pid),\n\t\t}\n\t\tt.ctr.client.logger.WithFields(log.Fields{\n\t\t\t\"container\": t.ctr.id,\n\t\t\t\"event\": libcontainerdtypes.EventExecAdded,\n\t\t\t\"event-info\": ei,\n\t\t}).Info(\"sending event\")\n\t\terr := t.ctr.client.backend.ProcessEvent(t.ctr.id, libcontainerdtypes.EventExecAdded, ei)\n\t\tif err != nil {\n\t\t\tt.ctr.client.logger.WithError(err).WithFields(log.Fields{\n\t\t\t\t\"container\": t.ctr.id,\n\t\t\t\t\"event\": libcontainerdtypes.EventExecAdded,\n\t\t\t\t\"event-info\": ei,\n\t\t\t}).Error(\"failed to process event\")\n\t\t}\n\t\terr = t.ctr.client.backend.ProcessEvent(t.ctr.id, libcontainerdtypes.EventExecStarted, ei)\n\t\tif err != nil {\n\t\t\tt.ctr.client.logger.WithError(err).WithFields(log.Fields{\n\t\t\t\t\"container\": t.ctr.id,\n\t\t\t\t\"event\": libcontainerdtypes.EventExecStarted,\n\t\t\t\t\"event-info\": ei,\n\t\t\t}).Error(\"failed to process event\")\n\t\t}\n\t})\n\n\treturn p, nil\n}", "func (cc *Context) Exec(nodeList map[string]*nodes.Node, actions []string, options ...ExecOption) error {\n\t// init the exec context and logging\n\tec := &execContext{\n\t\tContext: cc,\n\t\tnodes: nodeList,\n\t}\n\n\tec.status = logutil.NewStatus(os.Stdout)\n\tec.status.MaybeWrapLogrus(log.StandardLogger())\n\n\tdefer ec.status.End(false)\n\n\t// apply exec options\n\tfor _, option := range options {\n\t\toption(ec)\n\t}\n\n\t// Create an ExecutionPlan that applies the given actions to the\n\t// topology defined in the config\n\texecutionPlan, err := newExecutionPlan(ec.DerivedConfig, actions)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Executes all the selected action\n\tfor _, plannedTask := range executionPlan {\n\t\tec.status.Start(fmt.Sprintf(\"[%s] %s\", plannedTask.Node.Name, plannedTask.Task.Description))\n\n\t\terr := plannedTask.Task.Run(ec, plannedTask.Node)\n\t\tif err != nil {\n\t\t\t// in case of error, the execution plan is halted\n\t\t\tlog.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\tec.status.End(true)\n\n\treturn nil\n}", "func (ft *LsTask) Exec(ctx *Context, p *par.Params, out *io.PipeWriter) {\n\tlog.Info(\"LsTask.Execute\")\n\n\tpath, ok := p.Props[\"path\"]\n\n\t// if no passed in path use default\n\tif !ok {\n\t\tpath = ft.path\n\t}\n\n\tif path == \"\" {\n\t\tp.Status = par.StFail\n\t\tp.Response = \"no path specified\"\n\t\treturn\n\t}\n\n\t// this is mandatory node\n\tpath = filepath.Join(ctx.WorkspacePath, path)\n\n\tfiles, _ := ioutil.ReadDir(path)\n\tfor _, f := range files {\n\t\tp.Props[fmt.Sprint(f.Name())] = \"\"\n\t}\n\n\tp.Response = \"list directory done\"\n\tp.Status = par.StSuccess\n\n\treturn\n}", "func (m *Manager) Exec(name string, opt ExecOptions, gOpt operator.Options) error {\n\tif err := clusterutil.ValidateClusterNameOrError(name); err != nil {\n\t\treturn err\n\t}\n\n\tmetadata, err := m.meta(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttopo := metadata.GetTopology()\n\tbase := metadata.GetBaseMeta()\n\n\tfilterRoles := set.NewStringSet(gOpt.Roles...)\n\tfilterNodes := set.NewStringSet(gOpt.Nodes...)\n\n\tvar shellTasks []task.Task\n\tuniqueHosts := map[string]set.StringSet{} // host-sshPort -> {command}\n\ttopo.IterInstance(func(inst spec.Instance) {\n\t\tkey := utils.JoinHostPort(inst.GetManageHost(), inst.GetSSHPort())\n\t\tif _, found := uniqueHosts[key]; !found {\n\t\t\tif len(gOpt.Roles) > 0 && !filterRoles.Exist(inst.Role()) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif len(gOpt.Nodes) > 0 && (!filterNodes.Exist(inst.GetHost()) && !filterNodes.Exist(inst.GetManageHost())) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcmds, err := renderInstanceSpec(opt.Command, inst)\n\t\t\tif err != nil {\n\t\t\t\tm.logger.Debugf(\"error rendering command with spec: %s\", err)\n\t\t\t\treturn // skip\n\t\t\t}\n\t\t\tcmdSet := set.NewStringSet(cmds...)\n\t\t\tif _, ok := uniqueHosts[key]; ok {\n\t\t\t\tuniqueHosts[key].Join(cmdSet)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tuniqueHosts[key] = cmdSet\n\t\t}\n\t})\n\n\tfor hostKey, i := range uniqueHosts {\n\t\thost, _ := utils.ParseHostPort(hostKey)\n\t\tfor _, cmd := range i.Slice() {\n\t\t\tshellTasks = append(shellTasks,\n\t\t\t\ttask.NewBuilder(m.logger).\n\t\t\t\t\tShell(host, cmd, hostKey+cmd, opt.Sudo).\n\t\t\t\t\tBuild())\n\t\t}\n\t}\n\n\tb, err := m.sshTaskBuilder(name, topo, base.User, gOpt)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tt := b.\n\t\tParallel(false, shellTasks...).\n\t\tBuild()\n\n\texecCtx := ctxt.New(\n\t\tcontext.Background(),\n\t\tgOpt.Concurrency,\n\t\tm.logger,\n\t)\n\tif err := t.Execute(execCtx); err != nil {\n\t\tif errorx.Cast(err) != nil {\n\t\t\t// FIXME: Map possible task errors and give suggestions.\n\t\t\treturn err\n\t\t}\n\t\treturn perrs.Trace(err)\n\t}\n\n\t// print outputs\n\tfor hostKey, i := range uniqueHosts {\n\t\thost, _ := utils.ParseHostPort(hostKey)\n\t\tfor _, cmd := range i.Slice() {\n\t\t\tstdout, stderr, ok := ctxt.GetInner(execCtx).GetOutputs(hostKey + cmd)\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tm.logger.Infof(\"Outputs of %s on %s:\",\n\t\t\t\tcolor.CyanString(cmd),\n\t\t\t\tcolor.CyanString(host))\n\t\t\tif len(stdout) > 0 {\n\t\t\t\tm.logger.Infof(\"%s:\\n%s\", color.GreenString(\"stdout\"), stdout)\n\t\t\t}\n\t\t\tif len(stderr) > 0 {\n\t\t\t\tm.logger.Infof(\"%s:\\n%s\", color.RedString(\"stderr\"), stderr)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func runExec(serviceName string, operation string) (string, error) {\n\tbytes, err := exec.Command(Configuration.ExecutorPath, serviceName, operation).CombinedOutput()\n\treturn string(bytes), err\n}", "func (d *dispatcher) ExecuteTask() {\n\tlogutil.BgLogger().Info(\"execute one task\", zap.Int64(\"task ID\", d.task.ID),\n\t\tzap.String(\"state\", d.task.State), zap.Uint64(\"concurrency\", d.task.Concurrency))\n\td.scheduleTask(d.task.ID)\n}", "func (task *Task) Execute(t time.Time) (exec.Result, error) {\n\n\t//Validate the task\n\tif err := task.Validate(); err != nil {\n\t\treturn exec.Result{}, err\n\t}\n\n\t//Test if the given task should execute in the root croniclePath and the croncilePath is a git repo\n\ttaskPathIsCroniclePathWithGit := (task.Path == task.CroniclePath) && task.CronicleRepo != nil\n\n\t//If a repo is given, clone the repo and task.Git.Open(task.Path)\n\tif task.Repo != nil {\n\t\tauth, err := task.Repo.Auth()\n\t\tif err != nil {\n\t\t\treturn exec.Result{}, err\n\t\t}\n\t\tg, err := Clone(task.Path, task.Repo.URL, &auth)\n\t\t// g, err := Clone(task.Path, task.Repo.URL, task.Repo.DeployKey)\n\t\tif err != nil {\n\t\t\treturn exec.Result{}, err\n\t\t}\n\t\ttask.Git = g\n\t\terr = task.Git.Checkout(task.Repo.Branch, task.Repo.Commit)\n\t\tif err != nil {\n\t\t\treturn exec.Result{}, err\n\t\t}\n\t} else if taskPathIsCroniclePathWithGit {\n\t\tauth, err := task.CronicleRepo.Auth()\n\t\tif err != nil {\n\t\t\treturn exec.Result{}, err\n\t\t}\n\t\ttask.Git, err = Clone(task.CroniclePath, task.CronicleRepo.URL, &auth)\n\t\t// var err error\n\t\t// task.Git, err = Clone(task.CroniclePath, task.CronicleRepo.URL, task.CronicleRepo.DeployKey)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\treturn exec.Result{}, err\n\t\t}\n\t}\n\n\t//Execute task.Command in bash at time t with retry\n\tvar result exec.Result\n\terr := try.Do(func(attempt int) (bool, error) {\n\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"schedule\": task.ScheduleName,\n\t\t\t\"task\": task.Name,\n\t\t\t\"attempt\": attempt,\n\t\t\t\"clock\": t.Format(time.Kitchen),\n\t\t\t\"date\": t.Format(time.RFC850),\n\t\t}).Info(\"Executing...\")\n\t\tvar err error\n\t\tresult = task.Exec(t)\n\t\terr = result.Error\n\t\ttask.Log(result)\n\t\tif err != nil && task.Retry != nil {\n\t\t\tduration := time.Duration(task.Retry.Seconds) * time.Second\n\t\t\tduration += time.Duration(task.Retry.Minutes) * time.Minute\n\t\t\tduration += time.Duration(task.Retry.Hours) * time.Hour\n\t\t\ttime.Sleep(duration)\n\t\t}\n\n\t\tvar retryCount int\n\t\tswitch task.Retry {\n\t\tcase nil:\n\t\t\tretryCount = 0\n\t\tdefault:\n\t\t\tretryCount = task.Retry.Count\n\t\t}\n\n\t\treturn attempt < retryCount, err\n\t})\n\tif err != nil {\n\t\treturn result, err\n\t}\n\n\treturn result, nil\n}", "func (a AmbariRegistry) ExecuteRemoteCommandTask(task Task, filteredHosts map[string]bool) {\n\tif len(task.Command) > 0 {\n\t\tfmt.Println(\"Execute remote command: \" + task.Command)\n\t\ta.RunRemoteHostCommand(task.Command, filteredHosts, task.AmbariServerFilter)\n\t}\n}", "func (p *Pool) Exec(e Task) {\n\tp.tasks <- e\n}", "func (t TaskFunc) Execute() { t() }", "func (t *Task) Exec(agent *Agent) {\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\n\t\t\t//todo send task status to DCMS-agent\n\t\t\t// log.Warningf(\"run task: %s jobname: failed : %s\", t.TaskId, t.Job.Name, e)\n\t\t\tts := &TaskStatus{\n\t\t\t\tTaskPtr: t,\n\t\t\t\tCommand: nil,\n\t\t\t\tStatus: StatusFailed,\n\t\t\t\tCreateAt: time.Now().Unix(),\n\t\t\t\tErr: fmt.Errorf(\"run task: %s jobname: failed : %s\", t.TaskId, t.Job.Name, e),\n\t\t\t}\n\n\t\t\terrstr := fmt.Sprintf(\"%s\", e)\n\t\t\tif errstr == \"signal: killed\" {\n\t\t\t\tts.Status = StatusKilled\n\t\t\t}\n\t\t\tt.Job.Dcms.JobStatusChan <- ts\n\t\t}\n\t}()\n\n\tvar ts *TaskStatus\n\tvar err error\n\t// log.Info(\"task run Exec function in goroutine\")\n\n\tt.genLogFile()\n\t// check file signature\n\ttmp_md5 := util.Md5File(t.Job.Executor)\n\tif t.Job.Signature != tmp_md5 {\n\t\tts = &TaskStatus{\n\t\t\tTaskPtr: t,\n\t\t\tCommand: nil,\n\t\t\tStatus: StatusFailed,\n\t\t\tCreateAt: time.Now().Unix(),\n\t\t\tErr: fmt.Errorf(\"cronjob: %s executor: %s signature:%s does't match db's sig:%s\", t.Job.Name, t.Job.Executor, tmp_md5, t.Job.Signature),\n\t\t}\n\t\tt.Job.Dcms.JobStatusChan <- ts\n\t\treturn\n\t} else {\n\t\tlog.Info(\"cronjob signature match for \", t.Job.Name, t.Job.ExecutorFlags)\n\t}\n\n\tvar u *user.User\n\tu, err = user.Lookup(t.Job.Runner)\n\tif err != nil {\n\t\t// log.Warningf(\"user %s not exists, task %s quit \", err, t.TaskId)\n\t\tts = &TaskStatus{\n\t\t\tTaskPtr: t,\n\t\t\tCommand: nil,\n\t\t\tStatus: StatusFailed,\n\t\t\tCreateAt: time.Now().Unix(),\n\t\t\tErr: fmt.Errorf(\"user %s not exists, task %s quit \", err, t.TaskId),\n\t\t}\n\t\tt.Job.Dcms.JobStatusChan <- ts\n\t\treturn\n\t}\n\n\tvar uid int\n\tuid, err = strconv.Atoi(u.Uid)\n\tif err != nil {\n\t\t// log.Warningf(\"uid %s conver to int failed \", uid)\n\t\tts = &TaskStatus{\n\t\t\tTaskPtr: t,\n\t\t\tCommand: nil,\n\t\t\tStatus: StatusFailed,\n\t\t\tCreateAt: time.Now().Unix(),\n\t\t\tErr: fmt.Errorf(\"uid %s conver to int failed \", uid),\n\t\t}\n\t\tt.Job.Dcms.JobStatusChan <- ts\n\t\treturn\n\t}\n\n\t// chown log file to specific t.Job.Runner user\n\tif err = t.logfile.Chown(uid, uid); err != nil {\n\t\t// log.Warningf(\"chown logfile: %s to uid: %s failed, %s\", t.logfile.Name(), u.Uid, err)\n\t\tt.logfile = nil\n\t}\n\tvar cmd *exec.Cmd\n\tif t.Job.Executor != \"\" && t.Job.ExecutorFlags != \"\" {\n\t\tcmd = exec.Command(t.Job.Executor, t.Job.ExecutorFlags)\n\t} else if t.Job.Executor != \"\" && t.Job.ExecutorFlags == \"\" {\n\t\tcmd = exec.Command(t.Job.Executor)\n\t} else {\n\t\tts = &TaskStatus{\n\t\t\tTaskPtr: t,\n\t\t\tCommand: cmd,\n\t\t\tStatus: StatusFailed,\n\t\t\tCreateAt: time.Now().Unix(),\n\t\t\tErr: fmt.Errorf(\"job %s must have Executor \", t.Job.Name),\n\t\t}\n\t\tt.Job.Dcms.JobStatusChan <- ts\n\t\treturn\n\t}\n\n\tcmd.SysProcAttr = &syscall.SysProcAttr{}\n\tcmd.SysProcAttr.Credential = &syscall.Credential{Uid: uint32(uid)}\n\tcmd.SysProcAttr.Setsid = true\n\t// Pdeathsig only valid on linux system\n\t//\n\tcmd.SysProcAttr.Pdeathsig = syscall.SIGUSR1\n\n\tcmd.Stderr = t.logfile\n\tcmd.Stdout = t.logfile\n\n\tif err = cmd.Start(); err != nil {\n\t\t// log.Warningf(\"taskid:%s cmd Start failed: %s\", t.TaskId, err)\n\t\tts = &TaskStatus{\n\t\t\tTaskPtr: t,\n\t\t\tCommand: cmd,\n\t\t\tStatus: StatusFailed,\n\t\t\tCreateAt: time.Now().Unix(),\n\t\t\tErr: fmt.Errorf(\"taskid:%s cmd Start failed: %s\", t.TaskId, err),\n\t\t}\n\t\tt.Job.Dcms.JobStatusChan <- ts\n\t\treturn\n\t}\n\n\tts = &TaskStatus{\n\t\tTaskPtr: t,\n\t\tCommand: cmd,\n\t\tStatus: StatusRunning,\n\t\tCreateAt: time.Now().Unix(),\n\t\tErr: nil,\n\t}\n\tt.Job.Dcms.JobStatusChan <- ts\n\t// send cmd.process to dcms-agent\n\n\tif err = cmd.Wait(); err != nil {\n\t\t// log.Warningf(\"taskid:%s cmd Wait failed: %s\", t.TaskId, err)\n\t\tts = &TaskStatus{\n\t\t\tTaskPtr: t,\n\t\t\tCommand: cmd,\n\t\t\tStatus: StatusFailed,\n\t\t\tCreateAt: time.Now().Unix(),\n\t\t\tErr: fmt.Errorf(\"taskid:%s cmd Wait failed: %s\", t.TaskId, err),\n\t\t}\n\t\terrstr := fmt.Sprintf(\"%s\", err.Error())\n\t\tif errstr == \"signal: killed\" {\n\t\t\tts.Status = StatusKilled\n\t\t}\n\t\tt.Job.Dcms.JobStatusChan <- ts\n\t\treturn\n\t}\n\t// log.Warning(\"task run DONE\")\n\tts = &TaskStatus{\n\t\tTaskPtr: t,\n\t\tCommand: cmd,\n\t\tStatus: StatusSuccess,\n\t\tCreateAt: time.Now().Unix(),\n\t\tErr: nil,\n\t}\n\tt.Job.Dcms.JobStatusChan <- ts\n\treturn\n}", "func execTasks(parent context.Context, c TimedActuator,\n\texecFunc func(f func()), tasks ...Task) error {\n\tsize := len(tasks)\n\tif size == 0 {\n\t\treturn nil\n\t}\n\n\tctx, cancel := context.WithCancel(parent)\n\tresChan := make(chan error, size)\n\twg := &sync.WaitGroup{}\n\twg.Add(size)\n\n\t// Make sure the tasks are completed and channel is closed\n\tgo func() {\n\t\twg.Wait()\n\t\tcancel()\n\t\tclose(resChan)\n\t}()\n\n\t// Sadly we can not kill a goroutine manually\n\t// So when an error happens, the other tasks will continue\n\t// But the good news is that main progress\n\t// will know the error immediately\n\tfor _, task := range tasks {\n\t\tchild, _ := context.WithCancel(ctx)\n\t\tf := wrapperTask(child, task, wg, resChan)\n\t\texecFunc(f)\n\t}\n\n\treturn wait(ctx, c, resChan, cancel)\n}", "func (ctx *Context) Exec(cmd []string) *ExecResult {\n\treturn ctx.ExecWithParams(ExecParams{Cmd: cmd})\n}", "func (ne *NSEnter) Exec(cmd string, args []string) exec.Cmd {\n\thostProcMountNsPath := filepath.Join(ne.hostRootFsPath, mountNsPath)\n\tfullArgs := append([]string{fmt.Sprintf(\"--mount=%s\", hostProcMountNsPath), \"--\"},\n\t\tappend([]string{ne.AbsHostPath(cmd)}, args...)...)\n\tklog.V(5).Infof(\"Running nsenter command: %v %v\", nsenterPath, fullArgs)\n\treturn ne.executor.Command(nsenterPath, fullArgs...)\n}", "func (d Adapter) Exec(command []string) error {\n\treturn d.componentAdapter.Exec(command)\n}", "func (k *Kubernetes) Exec(ctx context.Context, containerID string, cmd []string) ([]byte, error) {\n\treturn k.Runtime.Exec(ctx, containerID, cmd)\n}", "func (c *VirtLauncherClient) Exec(domainName, command string, args []string, timeoutSeconds int32) (int, string, error) {\n\trequest := &cmdv1.ExecRequest{\n\t\tDomainName: domainName,\n\t\tCommand: command,\n\t\tArgs: args,\n\t\tTimeoutSeconds: int32(timeoutSeconds),\n\t}\n\texitCode := -1\n\tstdOut := \"\"\n\n\tctx, cancel := context.WithTimeout(\n\t\tcontext.Background(),\n\t\t// we give the context a bit more time as the timeout should kick\n\t\t// on the actual execution\n\t\ttime.Duration(timeoutSeconds)*time.Second+shortTimeout,\n\t)\n\tdefer cancel()\n\n\tresp, err := c.v1client.Exec(ctx, request)\n\tif resp == nil {\n\t\treturn exitCode, stdOut, err\n\t}\n\n\texitCode = int(resp.ExitCode)\n\tstdOut = resp.StdOut\n\n\treturn exitCode, stdOut, err\n}", "func Exec(config *ssh.ClientConfig, addr string, workDir string, cmd string, nixConf string) (bytes.Buffer, error) {\n\tvar b bytes.Buffer // import \"bytes\"\n\n\t// Connect\n\tclient, err := ssh.Dial(\"tcp\", net.JoinHostPort(addr, \"22\"), config)\n\tif err != nil {\n\t\treturn b, err\n\t}\n\t// Create a session. It is one session per command.\n\tsession, err := client.NewSession()\n\tif err != nil {\n\t\treturn b, err\n\t}\n\tdefer session.Close()\n\n\tsession.Stderr = os.Stderr // get output\n\tsession.Stdout = &b // get output\n\t// you can also pass what gets input to the stdin, allowing you to pipe\n\t// content from client to server\n\t// session.Stdin = bytes.NewBufferString(\"My input\")\n\n\t// Finally, run the command\n\tfullCmd := \". ~/.nix-profile/etc/profile.d/nix.sh && cd \" + workDir + \" && nix-shell \" + nixConf + \" --command '\" + cmd + \"'\"\n\tfmt.Println(fullCmd)\n\terr = session.Run(fullCmd)\n\treturn b, err\n}", "func (a *AGI) Exec(cmd ...string) (string, error) {\n\tcmd = append([]string{\"EXEC\"}, cmd...)\n\treturn a.Command(cmd...).Val()\n}", "func Exec() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"exec COMMAND\",\n\t\tShort: \"Execute a command in the cloud native environment\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tanalytics.Send(analytics.EventExec, GetActionID())\n\t\t\tdefer analytics.Send(analytics.EventExecEnd, GetActionID())\n\t\t\treturn executeExec(args)\n\t\t},\n\t\tArgs: func(cmd *cobra.Command, args []string) error {\n\t\t\tif len(args) < 1 {\n\t\t\t\treturn errors.New(\"exec requires the COMMAND argument\")\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t}\n\n\treturn cmd\n}", "func Exec(client *Client, args []string, timeoutSecs int) (*pb.ExecResult, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeoutSecs)*time.Second)\n\tdefer cancel()\n\n\trequest := &pb.ExecRequest{\n\t\tExecutable: args[0],\n\t\tArgs: args[1:],\n\t}\n\n\treturn client.Exec(ctx, request)\n}", "func (r RealExecute) ExecCommand(com string, args ...string) ([]byte, error) {\n\t/* #nosec */\n\tcommand := exec.Command(com, args...)\n\treturn command.CombinedOutput()\n}", "func execTask(ctx context.Context) error {\n\t// Do pseudo-task. Here, it is just a \"sleep\".\n\tn := 500 + rand.Intn(3500)\n\ttimer := time.NewTimer(time.Duration(n) * time.Millisecond)\n\tselect {\n\tcase <-ctx.Done():\n\t\t// Cancel the pseudo-task here.\n\t\ttimer.Stop()\n\t\treturn ctx.Err()\n\tcase <-timer.C:\n\t\t// Do nothing here. Proceed to the following code\n\t}\n\n\t// Return result of the task. Here, failure means the random number is a\n\t// multiples of 9.\n\tif (n % 9) == 0 {\n\t\treturn errors.New(\"bad luck\")\n\t}\n\treturn nil\n}", "func TestRktDriver_Exec(t *testing.T) {\n\tctestutil.RktCompatible(t)\n\tif !testutil.IsCI() {\n\t\tt.Parallel()\n\t}\n\n\trequire := require.New(t)\n\td := NewRktDriver(testlog.HCLogger(t))\n\tharness := dtestutil.NewDriverHarness(t, d)\n\n\ttask := &drivers.TaskConfig{\n\t\tID: uuid.Generate(),\n\t\tAllocID: uuid.Generate(),\n\t\tName: \"etcd\",\n\t\tResources: &drivers.Resources{\n\t\t\tNomadResources: &structs.AllocatedTaskResources{\n\t\t\t\tMemory: structs.AllocatedMemoryResources{\n\t\t\t\t\tMemoryMB: 128,\n\t\t\t\t},\n\t\t\t\tCpu: structs.AllocatedCpuResources{\n\t\t\t\t\tCpuShares: 100,\n\t\t\t\t},\n\t\t\t},\n\t\t\tLinuxResources: &drivers.LinuxResources{\n\t\t\t\tMemoryLimitBytes: 134217728,\n\t\t\t\tCPUShares: 100,\n\t\t\t},\n\t\t},\n\t}\n\n\ttc := &TaskConfig{\n\t\tTrustPrefix: \"coreos.com/etcd\",\n\t\tImageName: \"coreos.com/etcd:v2.0.4\",\n\t\tNet: []string{\"none\"},\n\t}\n\trequire.NoError(task.EncodeConcreteDriverConfig(&tc))\n\ttesttask.SetTaskConfigEnv(task)\n\n\tcleanup := harness.MkAllocDir(task, true)\n\tdefer cleanup()\n\n\t_, _, err := harness.StartTask(task)\n\trequire.NoError(err)\n\n\t// Run command that should succeed\n\texpected := []byte(\"etcd version\")\n\ttestutil.WaitForResult(func() (bool, error) {\n\t\tres, err := d.ExecTask(task.ID, []string{\"/etcd\", \"--version\"}, time.Second)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"failed to exec: %#v\", err)\n\t\t}\n\t\tif !res.ExitResult.Successful() {\n\t\t\treturn false, fmt.Errorf(\"/etcd --version failed: %#v %#v\", res.ExitResult, res)\n\t\t}\n\t\traw := res.Stdout\n\t\treturn bytes.Contains(raw, expected), fmt.Errorf(\"expected %q but found:\\n%s\", expected, raw)\n\t}, func(err error) {\n\t\trequire.NoError(err)\n\t})\n\n\t// Run command that should fail\n\texpected = []byte(\"flag provided but not defined\")\n\ttestutil.WaitForResult(func() (bool, error) {\n\t\tres, err := d.ExecTask(task.ID, []string{\"/etcd\", \"--cgdfgdfg\"}, time.Second)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"failed to exec: %#v\", err)\n\t\t}\n\t\tif res.ExitResult.Successful() {\n\t\t\treturn false, fmt.Errorf(\"/etcd --cgdfgdfg unexpected succeeded: %#v %#v\", res.ExitResult, res)\n\t\t}\n\t\traw := res.Stdout\n\t\treturn bytes.Contains(raw, expected), fmt.Errorf(\"expected %q but found:\\n%s\", expected, raw)\n\t}, func(err error) {\n\t\trequire.NoError(err)\n\t})\n\n\trequire.NoError(harness.DestroyTask(task.ID, true))\n}", "func (pm *Manager) Exec(desc, cmdName string, args ...string) (string, string, error) {\n\treturn pm.ExecDir(-1, \"\", desc, cmdName, args...)\n}", "func Exec(t testing.TB, cmd *cobra.Command, stdIn io.Reader, args ...string) (string, string, error) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tt.Cleanup(cancel)\n\n\treturn ExecCtx(ctx, cmd, stdIn, args...)\n}", "func Exec(ctx Context, executorID ExecutorID, fn func() error) error {\n\tif err := ctx.Acquire(executorID); err != nil {\n\t\treturn err\n\t}\n\n\treturn fn()\n}", "func execRunCommand(c *cli.Context) {\n\tif len(c.Args()) < 1 {\n\t\tdisplayError(errMissingTask, 64)\n\t}\n\n\tclient := newEtcdMinionClientFromFlags(c)\n\n\tcFlag := c.String(\"with-classifier\")\n\tminions, err := parseClassifierPattern(client, cFlag)\n\n\tif err != nil {\n\t\tdisplayError(err, 1)\n\t}\n\n\tnumMinions := len(minions)\n\tif numMinions == 0 {\n\t\tdisplayError(errNoMinionFound, 1)\n\t}\n\n\tfmt.Printf(\"Found %d minion(s) for task processing\\n\\n\", numMinions)\n\n\t// Create the task that we send to our minions\n\t// The first argument is the command and anything else\n\t// that follows is considered task arguments\n\targs := c.Args()\n\tisConcurrent := c.Bool(\"is-concurrent\")\n\ttaskCommand := args[0]\n\ttaskArgs := args[1:]\n\tt := task.New(taskCommand, taskArgs...)\n\tt.IsConcurrent = isConcurrent\n\n\t// Progress bar to display while submitting task\n\tprogress := uiprogress.New()\n\tbar := progress.AddBar(numMinions)\n\tbar.AppendCompleted()\n\tbar.PrependElapsed()\n\tprogress.Start()\n\n\t// Number of minions to which submitting the task has failed\n\tfailed := 0\n\n\t// Submit task to minions\n\tfmt.Println(\"Submitting task to minion(s) ...\")\n\tfor _, minion := range minions {\n\t\terr = client.MinionSubmitTask(minion, t)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Failed to submit task to %s: %s\\n\", minion, err)\n\t\t\tfailed += 1\n\t\t}\n\t\tbar.Incr()\n\t}\n\n\t// Stop progress bar and sleep for a bit to make sure the\n\t// progress bar gets updated if we were too fast for it\n\tprogress.Stop()\n\ttime.Sleep(time.Millisecond * 100)\n\n\t// Display task report\n\tfmt.Println()\n\ttable := uitable.New()\n\ttable.MaxColWidth = 80\n\ttable.Wrap = true\n\ttable.AddRow(\"TASK\", \"SUBMITTED\", \"FAILED\", \"TOTAL\")\n\ttable.AddRow(t.TaskID, numMinions-failed, failed, numMinions)\n\tfmt.Println(table)\n}", "func (ic *Context) Exec() error {\n\tdefer ic.Finalize()\n\treturn ic.VM.Run()\n}", "func (b *TaskExecBuilder) NewTaskExec(name string) *TaskExecBuilder {\n\treturn b.Commit().NewTaskExec(name)\n}", "func (s *RPCClient) Exec(command ...interface{}) (*Response, error) {\n\tvar res Response\n\terr := s.client.Call(\"RPCServer.Exec\", &command, &res)\n\treturn &res, err\n}", "func (ws *Workspace) ExecFunction(task *Task, name string, args ...string) string {\n\tlog.Info(\"Executing function %s: %s\", name, args)\n\tvar fn *Function\n\tif f, ok := ws.Functions[name]; ok {\n\t\tfn = f\n\t} else if f, ok := GlobalWorkspace.Functions[name]; ok {\n\t\tfn = f\n\t} else {\n\t\tlog.Warn(\"Function not found: %s\", name)\n\t\treturn \"\"\n\t}\n\n\targmap := make(map[string]string)\n\tfor i, arg := range fn.Args {\n\t\targmap[arg] = args[i]\n\t}\n\n\tfor k, v := range argmap {\n\t\tlog.Info(\"argmap: %s => %s\", k, v)\n\t\tfor t, m := range task.Metadata {\n\t\t\tlog.Info(\"meta: %s => %s\", t, m)\n\t\t\tv = strings.Replace(v, \"$\"+t, m, -1)\n\t\t}\n\t\targmap[k] = v\n\t}\n\n\tc := fn.Command\n\tfor k, v := range argmap {\n\t\tlog.Info(\"ARG: %s => %s\", k, v)\n\t\tc = strings.Replace(c, k, v, -1)\n\t}\n\n\tvar funcEnvironment map[string]string\n\tif ws.InheritEnvironment {\n\t\tfuncEnvironment = ws.Environment\n\t} else if GlobalWorkspace.InheritEnvironment {\n\t\tfuncEnvironment = GlobalWorkspace.Environment\n\t} else {\n\t\tfuncEnvironment = make(map[string]string)\n\t}\n\n\ttsk := NewTask(nil, \"Function$\"+name, fn.Executor, c, funcEnvironment, false, \"\", \"\", make(map[string]string), \"\")\n\tch := tsk.Start()\n\t<-ch\n\treturn tsk.TaskRuns[0].StdoutBuf.String()\n}", "func WrapExec(cmd string, args []String, nArg uint32) (status syscall.Status){\n\n\n\tpath := \"/programs/\"+cmd\n\n\tif nArg == 0 {\n\n\t\tstatus = altEthos.Exec(path)\n\n\t} else if nArg == 1 {\n\n\t\tstatus = altEthos.Exec(path, &args[0])\n\n\t} else if nArg == 2 {\n\n\t\tstatus = altEthos.Exec(path, &args[0], &args[1])\n\n\t} else if nArg == 3 {\n\n\t\tstatus = altEthos.Exec(path, &args[0], &args[1], &args[2])\n\n\t} else if nArg == 4 {\n\n\t\tstatus = altEthos.Exec(path, &args[0], &args[1], &args[2], &args[3])\n\n\t}\n\n\treturn\n\n}", "func (f *RemoteRuntime) Exec(ctx context.Context, req *kubeapi.ExecRequest) (*kubeapi.ExecResponse, error) {\n\treturn f.RuntimeService.Exec(ctx, req)\n}", "func (client *Client) Exec(val interface{}, command, key string, args ...interface{}) error {\n\treturn client.Pool.Do(radix.FlatCmd(val, command, key, args...))\n}", "func (k *kubectlContext) Exec(podName string, cmd ...string) (string, error) {\n\tout, err := k.do(append([]string{\"exec\", podName}, cmd...)...)\n\treturn string(out), err\n}", "func (c *MigrateCommand) Exec(ctx context.Context, req *proto.ExecRequest, rsp *proto.ExecResponse) error {\n\t// rsp.Error could be set to return an error instead\n\t// the function error would only be used for service level issues\n\n\tc.db.AutoMigrate(\n\t\tmodels.CustomObject{},\n\t\tmodels.CustomField{},\n\t)\n\n\trsp.Result = []byte(\"数据库模式构建完毕\")\n\n\treturn nil\n}", "func (i ClusterInstance) Exec(log *logging.Logger, command string) (string, error) {\n\tstdout, err := i.runRemoteCommand(log, command, \"\", false)\n\tif err != nil {\n\t\treturn stdout, maskAny(err)\n\t}\n\treturn stdout, nil\n}", "func (r *remoteRuntimeService) ExecSync(ctx context.Context, containerID string, cmd []string, timeout time.Duration) (stdout []byte, stderr []byte, err error) {\n\tklog.V(10).InfoS(\"[RemoteRuntimeService] ExecSync\", \"containerID\", containerID, \"timeout\", timeout)\n\t// Do not set timeout when timeout is 0.\n\tvar cancel context.CancelFunc\n\tif timeout != 0 {\n\t\t// Use timeout + default timeout (2 minutes) as timeout to leave some time for\n\t\t// the runtime to do cleanup.\n\t\tctx, cancel = context.WithTimeout(ctx, r.timeout+timeout)\n\t} else {\n\t\tctx, cancel = context.WithCancel(ctx)\n\t}\n\tdefer cancel()\n\n\treturn r.execSyncV1(ctx, containerID, cmd, timeout)\n}", "func (cmd RemoteCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx cli.CliContext) int {\n\tap := cmd.ArgParser()\n\thelp, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, remoteDocs, ap))\n\tapr := cli.ParseArgsOrDie(ap, args, help)\n\n\tvar verr errhand.VerboseError\n\n\tswitch {\n\tcase apr.NArg() == 0:\n\t\tverr = printRemotes(dEnv, apr)\n\tcase apr.Arg(0) == addRemoteId:\n\t\tverr = addRemote(dEnv, apr)\n\tcase apr.Arg(0) == removeRemoteId:\n\t\tverr = removeRemote(ctx, dEnv, apr)\n\tcase apr.Arg(0) == removeRemoteShortId:\n\t\tverr = removeRemote(ctx, dEnv, apr)\n\tdefault:\n\t\tverr = errhand.BuildDError(\"\").SetPrintUsage().Build()\n\t}\n\n\treturn HandleVErrAndExitCode(verr, usage)\n}", "func Exec(rootCmd *RootCommand) (err error) {\n\terr = InternalExecFor(rootCmd, os.Args)\n\treturn\n}", "func (c *ServerConn) Exec(expected int, format string, args ...interface{}) (int, string, error) {\n\treturn c.cmd(expected, format, args...)\n}", "func (cmd *Command) Exec() error {\n\t// need a hash map of functions to support the API\n\tvar err error\n\n\tlog.Debug(\"execute op: %d\", cmd.Op)\n\n\t// TODO: put this into a hash map\n\tswitch cmd.Op {\n\tcase PUT:\n\t\terr = cache.Put(cmd.Key, cmd.Value, 0)\n\t\tcmd.Resp = ok\n\tcase GET:\n\t\tcmd.Resp, err = cache.Get(cmd.Key)\n\tcase HAS:\n\t\tr, err := cache.Has(cmd.Key)\n\t\tif err == nil && r {\n\t\t\tcmd.Resp = yes\n\t\t} else {\n\t\t\tcmd.Resp = no\n\t\t}\n\tcase DELETE:\n\t\terr = cache.Delete(cmd.Key)\n\t\tcmd.Resp = yes\n\tcase KEYS:\n\t\tcmd.Resp = no // not implemented yet...\n\tcase PING:\n\t\tcmd.Resp = pong\n\tcase STATUS:\n\t\tcmd.Resp = ok\n\t\tlog.Info(\"status: %s\", cmd.Resp)\n\tcase SHUTDOWN:\n\t\tlog.Info(\"shutdown command received...\")\n\t\tcmd.Resp = fail\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"unknown command id: %d\", cmd.Op)\n\t\tlog.Warn(msg)\n\t\terr = errors.New(msg)\n\t\tcmd.Resp = fail\n\t}\n\n\treturn err\n}", "func Exec(cmd string) {\n\n\tfmt.Printf(\"Você digitou: %s \", cmd)\n\n}", "func Exec(c ExecCommand, fn ExecCallback) Cmd {\n\treturn func() Msg {\n\t\treturn execMsg{cmd: c, fn: fn}\n\t}\n}", "func (t *Test) Exec() (err error) {\n\ts, e, err := Exec(t.Command)\n\tif err != nil {\n\t\tt.Result.Error(err)\n\t\treturn err\n\t}\n\tt.stdOut = s\n\tt.stdErr = e\n\tt.Result.Success()\n\treturn nil\n}", "func (ds *dockerService) Exec(req *runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error) {\n\tif ds.streamingServer == nil {\n\t\treturn nil, streaming.ErrorStreamingDisabled(\"exec\")\n\t}\n\t_, err := checkContainerStatus(ds.client, req.GetContainerId())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ds.streamingServer.GetExec(req)\n}", "func (e *Exec) DoExec() {\n\t// check\n\tif e.Name == \"\" {\n\t\te.Name = \"BTerminal-\" + e.GetNameID8b()\n\t}\n\tif e.Command == \"\" {\n\t\t// do nothing\n\t\treturn\n\t}\n\n\t// exec\n\te.Lock()\n\tDoExecute(e.LogName, e.Command)\n\te.Unlock()\n}", "func (c *Client) ResizeExec(ctx context.Context, id string, execid string, opts types.ResizeOptions) error {\n\tpack, err := c.watch.get(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\texecProcess, err := pack.task.LoadProcess(ctx, execid, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn execProcess.Resize(ctx, uint32(opts.Width), uint32(opts.Height))\n}", "func (nu *NodeUpdate) Exec(ctx context.Context) error {\n\t_, err := nu.Save(ctx)\n\treturn err\n}", "func (nu *NodeUpdate) Exec(ctx context.Context) error {\n\t_, err := nu.Save(ctx)\n\treturn err\n}", "func (ds *dockerService) Exec(req *runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error) {\n\tif ds.streamingServer == nil {\n\t\treturn nil, streaming.ErrorStreamingDisabled(\"exec\")\n\t}\n\t_, err := checkContainerStatus(ds.client, req.ContainerId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ds.streamingServer.GetExec(req)\n}", "func (s *RPCServer) Exec(args *[]interface{}, res *Response) error {\n\tresp, err := s.llclient.Exec(*args...)\n\t*res = *resp\n\treturn err\n}", "func (rc *RenderCore) Exec() {\n\ttQueue := rc.queue\n\trc.queue = []*RenderTask{}\n\trc.BE.ExecTasks(tQueue)\n}", "func Exec(command string, config *viper.Viper) {\n\tc, err := Connect(config)\n\n\tif err != nil {\n\t\tc.FatalError(err)\n\t}\n\n\tresponse, err := c.sendCommand(command)\n\tif err == nil {\n\t\tc.Log(response)\n\t} else {\n\t\tc.FatalError(err)\n\t}\n}", "func (c *conn) Exec(query string, args []driver.Value) (driver.Result, error) {\n\treturn c.exec(context.Background(), query, args)\n}", "func Exec() {\n\tcmd := &cobra.Command{\n\t\tUse: \"func\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tfmt.Fprintln(os.Stderr, cmd.UsageString())\n\t\t},\n\t}\n\n\tcmd.AddCommand(versionCommand())\n\tcmd.AddCommand(generateCommand())\n\tcmd.AddCommand(deployCommand())\n\n\t_ = cmd.Execute()\n}", "func (q *Querier) Exec(query string, args ...interface{}) (sql.Result, error) {\n\tq.logBefore(query, args)\n\tstart := time.Now()\n\n\tdbtxCtx := q.selectDBTXContext(query)\n\tres, err := dbtxCtx.ExecContext(q.ctx, query, args...)\n\tq.logAfter(query, args, time.Since(start), err)\n\treturn res, err\n}", "func (ctl *ControllerWebsite) Exec(query string, args ...interface{}) (sql.Result, error) {\n\treturn ctl.ExecContext(ctl.Context.GetContext(), query, args...)\n}", "func (c *Tool) Exec() ([]byte, error) {\n\treturn c.Run()\n}", "func (ucc *UseCaseCreate) Exec(ctx context.Context) error {\n\t_, err := ucc.Save(ctx)\n\treturn err\n}", "func (c *RealtimeCommand) Exec(_ io.Reader, out io.Writer) error {\n\tserviceID, source, flag, err := cmd.ServiceID(c.serviceName, c.manifest, c.Globals.APIClient, c.Globals.ErrLog)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif c.Globals.Verbose() {\n\t\tcmd.DisplayServiceID(serviceID, flag, source, out)\n\t}\n\n\tswitch c.formatFlag {\n\tcase \"json\":\n\t\tif err := loopJSON(c.Globals.RTSClient, serviceID, out); err != nil {\n\t\t\tc.Globals.ErrLog.AddWithContext(err, map[string]any{\n\t\t\t\t\"Service ID\": serviceID,\n\t\t\t})\n\t\t\treturn err\n\t\t}\n\n\tdefault:\n\t\tif err := loopText(c.Globals.RTSClient, serviceID, out); err != nil {\n\t\t\tc.Globals.ErrLog.AddWithContext(err, map[string]any{\n\t\t\t\t\"Service ID\": serviceID,\n\t\t\t})\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (ex *Executor) Exec(g *DepGraph, targets []string) error {\n\tex.ctx = newExecContext(g.vars, g.vpaths, false)\n\n\t// TODO: Handle target specific variables.\n\tfor name, export := range g.exports {\n\t\tif export {\n\t\t\tv, err := ex.ctx.ev.EvaluateVar(name)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tos.Setenv(name, v)\n\t\t} else {\n\t\t\tos.Unsetenv(name)\n\t\t}\n\t}\n\n\tstartTime := time.Now()\n\tvar nodes []*DepNode\n\tif len(targets) == 0 {\n\t\tif len(g.nodes) > 0 {\n\t\t\tnodes = append(nodes, g.nodes[0])\n\t\t}\n\t} else {\n\t\tm := make(map[string]*DepNode)\n\t\tfor _, n := range g.nodes {\n\t\t\tm[n.Output] = n\n\t\t}\n\t\tfor _, t := range targets {\n\t\t\tn := m[t]\n\t\t\tif n != nil {\n\t\t\t\tnodes = append(nodes, n)\n\t\t\t}\n\t\t}\n\t}\n\tfor _, root := range nodes {\n\t\terr := ex.makeJobs(root, nil)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\tn, err := ex.wm.Wait()\n\tlogStats(\"exec time: %q\", time.Since(startTime))\n\tif n == 0 {\n\t\tfor _, root := range nodes {\n\t\t\tfmt.Printf(\"kati: Nothing to be done for `%s'.\\n\", root.Output)\n\t\t}\n\t}\n\treturn err\n}", "func (s *Socker) Exec(command []string) error {\n\topts := ExecOpts{}\n\tremainedArgs, err := flags.ParseArgs(&opts, command)\n\tif err != nil {\n\t\tlog.Errorf(\"parse command args failed: %v\", err)\n\t\treturn err\n\t}\n\tif len(remainedArgs) < 2 {\n\t\treturn fmt.Errorf(\"you must specifiy container name and command\")\n\t}\n\tcontainerUID, err := ioutil.ReadFile(path.Join(epilogDir, remainedArgs[0]))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"container owner check error: %v\", err)\n\t}\n\tif strings.TrimSpace(string(containerUID)) != s.CurrentUID {\n\t\treturn fmt.Errorf(\"you have no permission to exec command in this container\")\n\t}\n\targs := []string{\"exec\"}\n\targs = append(args, command...)\n\tlog.Debugf(\"docker exec args: %v\", args)\n\tcmd, err := su.Command(s.dockerUID, cmdDocker, args...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif opts.TTY {\n\t\treturn s.runWithPty(cmd)\n\t}\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Fprintf(os.Stdout, \"%s\", output)\n\treturn nil\n}", "func RunTaskfile(appContext application.Context) {\n\tshell := execution.GetCommand(\"bin/task -p server ui\")\n\tshell.Dir = appContext.Root\n\tshell.Run()\n}", "func (a *addTask) Execute([]string) error {\n\ttask, err := a.newTask()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"creating task: %w\", err)\n\t}\n\n\treturn dal.CreateTask(a.getDbConfig(), task)\n}", "func (tx *Transaction) Exec(query string, args ...interface{}) error {\n\treturn exec(tx.tx, query, args...)\n}", "func (td *TodoDelete) Exec(ctx context.Context) (int, error) {\n\treturn withHooks(ctx, td.sqlExec, td.mutation, td.hooks)\n}", "func testExecutorCommand(t *testing.T) *testExecCmd {\n\talloc := mock.Alloc()\n\ttask := alloc.Job.TaskGroups[0].Tasks[0]\n\ttaskEnv := taskenv.NewBuilder(mock.Node(), alloc, task, \"global\").Build()\n\n\tallocDir := allocdir.NewAllocDir(testlog.HCLogger(t), t.TempDir(), alloc.ID)\n\tif err := allocDir.Build(); err != nil {\n\t\tt.Fatalf(\"AllocDir.Build() failed: %v\", err)\n\t}\n\tif err := allocDir.NewTaskDir(task.Name).Build(false, nil); err != nil {\n\t\tallocDir.Destroy()\n\t\tt.Fatalf(\"allocDir.NewTaskDir(%q) failed: %v\", task.Name, err)\n\t}\n\ttd := allocDir.TaskDirs[task.Name]\n\tcmd := &ExecCommand{\n\t\tEnv: taskEnv.List(),\n\t\tTaskDir: td.Dir,\n\t\tResources: &drivers.Resources{\n\t\t\tNomadResources: &structs.AllocatedTaskResources{\n\t\t\t\tCpu: structs.AllocatedCpuResources{\n\t\t\t\t\tCpuShares: 500,\n\t\t\t\t},\n\t\t\t\tMemory: structs.AllocatedMemoryResources{\n\t\t\t\t\tMemoryMB: 256,\n\t\t\t\t},\n\t\t\t},\n\t\t\tLinuxResources: &drivers.LinuxResources{\n\t\t\t\tCPUShares: 500,\n\t\t\t\tMemoryLimitBytes: 256 * 1024 * 1024,\n\t\t\t},\n\t\t},\n\t}\n\n\tif cgutil.UseV2 {\n\t\tcmd.Resources.LinuxResources.CpusetCgroupPath = filepath.Join(cgutil.CgroupRoot, \"testing.scope\", cgutil.CgroupScope(alloc.ID, task.Name))\n\t}\n\n\ttestCmd := &testExecCmd{\n\t\tcommand: cmd,\n\t\tallocDir: allocDir,\n\t}\n\tconfigureTLogging(t, testCmd)\n\treturn testCmd\n}", "func (h *Host) Exec(cmd string) error {\n\tsession, err := h.sshClient.NewSession()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer session.Close()\n\n\tstdout, err := session.StdoutPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\tstderr, err := session.StderrPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogrus.Debugf(\"executing command: %s\", cmd)\n\tif err := session.Start(cmd); err != nil {\n\t\treturn err\n\t}\n\n\tmultiReader := io.MultiReader(stdout, stderr)\n\toutputScanner := bufio.NewScanner(multiReader)\n\n\tfor outputScanner.Scan() {\n\t\tlogrus.Debugf(\"%s: %s\", h.FullAddress(), outputScanner.Text())\n\t}\n\tif err := outputScanner.Err(); err != nil {\n\t\tlogrus.Errorf(\"%s: %s\", h.FullAddress(), err.Error())\n\t}\n\n\treturn nil\n}", "func ProcessTask(t Task) {\n\ttime := time.Now()\n\tt.LastRunDateTime = time.String()\n\tt.Status = \"Running\"\n\tModifyTask(t)\n\to, err := exec.Command(t.Command).Output()\n\tif err != nil {\n\t\tt.Status = \"Failed\"\n\t\tt.Output = string(\"Error while executing command, please, check Your syntax. Error description: \" + err.Error())\n\t} else {\n\t\tt.Status = \"Success\"\n\t\tt.Output = string(o)\n\t}\n\n\tModifyTask(t)\n}", "func (trdo *TcpRuleDeleteOne) Exec(ctx context.Context) error {\n\tn, err := trdo.trd.Exec(ctx)\n\tswitch {\n\tcase err != nil:\n\t\treturn err\n\tcase n == 0:\n\t\treturn &NotFoundError{tcprule.Label}\n\tdefault:\n\t\treturn nil\n\t}\n}", "func Exec(name string, namespace string, args ...string) error {\n\texecArgs := []string{\"-n\", namespace, \"exec\", \"-it\", name}\n\texecArgs = append(execArgs, args...)\n\treturn kubectlIO(execArgs...)\n}", "func (d *Dispatcher) AddTaskExecs(execs ...*TaskExec) {\n\td.Tasks = append(d.Tasks, execs...)\n}", "func (s *Set) Exec(name string) error {\n\tif s.err != nil {\n\t\treturn s.err\n\t}\n\te := &exec{\n\t\tfs: make(map[string]func() error),\n\t\tts: s.ts,\n\t}\n\tt, ok := s.ts[name]\n\tif !ok {\n\t\treturn ErrTaskNotExist{name}\n\t}\n\treturn e.runOnce(t)\n}", "func (tasks *TaskFile) Execute(cmd, name, dir string) (out string, err error) {\n\tcommand, err := templates.Expand(cmd, tasks.TemplateVars.Functions)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif tasks.Options.LogLevel {\n\t\tlogger.Info(name, command)\n\t}\n\n\treturn templates.Run(templates.CommandOptions{\n\t\tCmd: command,\n\t\tDir: dir,\n\t\tUseStdOut: true,\n\t})\n}", "func (bot *botContext) callTask(t interface{}, command string, args ...string) (errString string, retval TaskRetVal) {\n\tbot.currentTask = t\n\tr := bot.makeRobot()\n\ttask, plugin, _ := getTask(t)\n\tisPlugin := plugin != nil\n\t// This should only happen in the rare case that a configured authorizer or elevator is disabled\n\tif task.Disabled {\n\t\tmsg := fmt.Sprintf(\"callTask failed on disabled task %s; reason: %s\", task.name, task.reason)\n\t\tLog(Error, msg)\n\t\tbot.debug(msg, false)\n\t\treturn msg, ConfigurationError\n\t}\n\tif bot.logger != nil {\n\t\tvar desc string\n\t\tif len(task.Description) > 0 {\n\t\t\tdesc = fmt.Sprintf(\"Starting task: %s\", task.Description)\n\t\t} else {\n\t\t\tdesc = \"Starting task\"\n\t\t}\n\t\tbot.logger.Section(task.name, desc)\n\t}\n\n\tif !(task.name == \"builtInadmin\" && command == \"abort\") {\n\t\tdefer checkPanic(r, fmt.Sprintf(\"Plugin: %s, command: %s, arguments: %v\", task.name, command, args))\n\t}\n\tLog(Debug, fmt.Sprintf(\"Dispatching command '%s' to plugin '%s' with arguments '%#v'\", command, task.name, args))\n\tif isPlugin && plugin.taskType == taskGo {\n\t\tif command != \"init\" {\n\t\t\temit(GoPluginRan)\n\t\t}\n\t\tLog(Debug, fmt.Sprintf(\"Call go plugin: '%s' with args: %q\", task.name, args))\n\t\treturn \"\", pluginHandlers[task.name].Handler(r, command, args...)\n\t}\n\tvar fullPath string // full path to the executable\n\tvar err error\n\tfullPath, err = getTaskPath(task)\n\tif err != nil {\n\t\temit(ScriptPluginBadPath)\n\t\treturn fmt.Sprintf(\"Error getting path for %s: %v\", task.name, err), MechanismFail\n\t}\n\tinterpreter, err := getInterpreter(fullPath)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"looking up interpreter for %s: %s\", fullPath, err)\n\t\tLog(Error, fmt.Sprintf(\"Unable to call external plugin %s, no interpreter found: %s\", fullPath, err))\n\t\terrString = \"There was a problem calling an external plugin\"\n\t\temit(ScriptPluginBadInterpreter)\n\t\treturn errString, MechanismFail\n\t}\n\texternalArgs := make([]string, 0, 5+len(args))\n\t// on Windows, we exec the interpreter with the script as first arg\n\tif runtime.GOOS == \"windows\" {\n\t\texternalArgs = append(externalArgs, fullPath)\n\t}\n\texternalArgs = append(externalArgs, command)\n\texternalArgs = append(externalArgs, args...)\n\texternalArgs = fixInterpreterArgs(interpreter, externalArgs)\n\tLog(Debug, fmt.Sprintf(\"Calling '%s' with interpreter '%s' and args: %q\", fullPath, interpreter, externalArgs))\n\tvar cmd *exec.Cmd\n\tif runtime.GOOS == \"windows\" {\n\t\tcmd = exec.Command(interpreter, externalArgs...)\n\t} else {\n\t\tcmd = exec.Command(fullPath, externalArgs...)\n\t}\n\tbot.Lock()\n\tbot.taskName = task.name\n\tbot.taskDesc = task.Description\n\tbot.osCmd = cmd\n\tbot.Unlock()\n\tenvhash := make(map[string]string)\n\tif len(bot.environment) > 0 {\n\t\tfor k, v := range bot.environment {\n\t\t\tenvhash[k] = v\n\t\t}\n\t}\n\n\t// Pull stored env vars specific to this task and supply to this task only.\n\t// No effect if already defined. Useful mainly for specific tasks to have\n\t// secrets passed in but not handed to everything in the pipeline.\n\tif !bot.pipeStarting {\n\t\tstoredEnv := make(map[string]string)\n\t\t_, exists, _ := checkoutDatum(paramPrefix+task.NameSpace, &storedEnv, false)\n\t\tif exists {\n\t\t\tfor key, value := range storedEnv {\n\t\t\t\t// Dynamically provided and configured parameters take precedence over stored parameters\n\t\t\t\t_, exists := envhash[key]\n\t\t\t\tif !exists {\n\t\t\t\t\tenvhash[key] = value\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tbot.pipeStarting = false\n\t}\n\n\tenvhash[\"GOPHER_CHANNEL\"] = bot.Channel\n\tenvhash[\"GOPHER_USER\"] = bot.User\n\tenvhash[\"GOPHER_PROTOCOL\"] = fmt.Sprintf(\"%s\", bot.Protocol)\n\tenv := make([]string, 0, len(envhash))\n\tkeys := make([]string, 0, len(envhash))\n\tfor k, v := range envhash {\n\t\tif len(k) == 0 {\n\t\t\tLog(Error, fmt.Sprintf(\"Empty Name value while populating environment for '%s', skipping\", task.name))\n\t\t\tcontinue\n\t\t}\n\t\tenv = append(env, fmt.Sprintf(\"%s=%s\", k, v))\n\t\tkeys = append(keys, k)\n\t}\n\tcmd.Env = env\n\tLog(Debug, fmt.Sprintf(\"Running '%s' with environment vars: '%s'\", fullPath, strings.Join(keys, \"', '\")))\n\tvar stderr, stdout io.ReadCloser\n\t// hold on to stderr in case we need to log an error\n\tstderr, err = cmd.StderrPipe()\n\tif err != nil {\n\t\tLog(Error, fmt.Errorf(\"Creating stderr pipe for external command '%s': %v\", fullPath, err))\n\t\terrString = fmt.Sprintf(\"There were errors calling external plugin '%s', you might want to ask an administrator to check the logs\", task.name)\n\t\treturn errString, MechanismFail\n\t}\n\tif bot.logger == nil {\n\t\t// close stdout on the external plugin...\n\t\tcmd.Stdout = nil\n\t} else {\n\t\tstdout, err = cmd.StdoutPipe()\n\t\tif err != nil {\n\t\t\tLog(Error, fmt.Errorf(\"Creating stdout pipe for external command '%s': %v\", fullPath, err))\n\t\t\terrString = fmt.Sprintf(\"There were errors calling external plugin '%s', you might want to ask an administrator to check the logs\", task.name)\n\t\t\treturn errString, MechanismFail\n\t\t}\n\t}\n\tif err = cmd.Start(); err != nil {\n\t\tLog(Error, fmt.Errorf(\"Starting command '%s': %v\", fullPath, err))\n\t\terrString = fmt.Sprintf(\"There were errors calling external plugin '%s', you might want to ask an administrator to check the logs\", task.name)\n\t\treturn errString, MechanismFail\n\t}\n\tif command != \"init\" {\n\t\temit(ScriptTaskRan)\n\t}\n\tif bot.logger == nil {\n\t\tvar stdErrBytes []byte\n\t\tif stdErrBytes, err = ioutil.ReadAll(stderr); err != nil {\n\t\t\tLog(Error, fmt.Errorf(\"Reading from stderr for external command '%s': %v\", fullPath, err))\n\t\t\terrString = fmt.Sprintf(\"There were errors calling external plugin '%s', you might want to ask an administrator to check the logs\", task.name)\n\t\t\treturn errString, MechanismFail\n\t\t}\n\t\tstdErrString := string(stdErrBytes)\n\t\tif len(stdErrString) > 0 {\n\t\t\tLog(Warn, fmt.Errorf(\"Output from stderr of external command '%s': %s\", fullPath, stdErrString))\n\t\t\terrString = fmt.Sprintf(\"There was error output while calling external task '%s', you might want to ask an administrator to check the logs\", task.name)\n\t\t\temit(ScriptPluginStderrOutput)\n\t\t}\n\t} else {\n\t\tclosed := make(chan struct{})\n\t\tgo func() {\n\t\t\tscanner := bufio.NewScanner(stdout)\n\t\t\tfor scanner.Scan() {\n\t\t\t\tline := scanner.Text()\n\t\t\t\tbot.logger.Log(\"OUT \" + line)\n\t\t\t}\n\t\t\tclosed <- struct{}{}\n\t\t}()\n\t\tgo func() {\n\t\t\tscanner := bufio.NewScanner(stderr)\n\t\t\tfor scanner.Scan() {\n\t\t\t\tline := scanner.Text()\n\t\t\t\tbot.logger.Log(\"ERR \" + line)\n\t\t\t}\n\t\t\tclosed <- struct{}{}\n\t\t}()\n\t\thalfClosed := false\n\tcloseLoop:\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-closed:\n\t\t\t\tif halfClosed {\n\t\t\t\t\tbreak closeLoop\n\t\t\t\t}\n\t\t\t\thalfClosed = true\n\t\t\t}\n\t\t}\n\t}\n\tif err = cmd.Wait(); err != nil {\n\t\tretval = Fail\n\t\tsuccess := false\n\t\tif exitstatus, ok := err.(*exec.ExitError); ok {\n\t\t\tif status, ok := exitstatus.Sys().(syscall.WaitStatus); ok {\n\t\t\t\tretval = TaskRetVal(status.ExitStatus())\n\t\t\t\tif retval == Success {\n\t\t\t\t\tsuccess = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif !success {\n\t\t\tLog(Error, fmt.Errorf(\"Waiting on external command '%s': %v\", fullPath, err))\n\t\t\terrString = fmt.Sprintf(\"There were errors calling external plugin '%s', you might want to ask an administrator to check the logs\", task.name)\n\t\t\temit(ScriptPluginErrExit)\n\t\t}\n\t}\n\treturn errString, retval\n}", "func (s *Server) Exec(c *Conn, statement string, args Args) (interface{}, error) {\n\treq := c.acquireRequest(statement, args)\n\tdefer c.releaseRequest(req)\n\treturn s.engine.handlers.exec(req)\n}", "func (d Dispatcher) NewExec(args []interface{}, retries, priority int, backoff int64, execTime int64, interval int, ttl int64, pub string, envs string) (string, error) {\n\tvar e job.EnvironmentVariables\n\terr := helpers.Deserialize([]byte(envs), &e)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t_backoff := time.Second.Seconds() * float64(backoff)\n\t_ttl := time.Minute.Minutes() * float64(ttl)\n\n\texec, err := job.NewExec(args, retries, priority, time.Duration(_backoff), execTime, interval, time.Duration(_ttl), pub, e, d.GetPubString())\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\texecBytes, err := helpers.Serialize(exec)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(execBytes), nil\n}", "func Exec(tasks ...Task) bool {\n\tvar c int32\n\twg := &sync.WaitGroup{}\n\twg.Add(len(tasks))\n\n\tfor _, t := range tasks {\n\t\tgo func(task Task) {\n\t\t\tdefer func() {\n\t\t\t\tif r := recover(); r != nil {\n\t\t\t\t\tatomic.StoreInt32(&c, 1)\n\t\t\t\t\tfmt.Printf(\"conexec panic:%v\\n%s\\n\", r, string(debug.Stack()))\n\t\t\t\t}\n\n\t\t\t\twg.Done()\n\t\t\t}()\n\n\t\t\tif err := task(); err != nil {\n\t\t\t\tatomic.StoreInt32(&c, 1)\n\t\t\t}\n\t\t}(t)\n\t}\n\n\twg.Wait()\n\treturn c == 0\n}", "func (mgr *ClientMgr) runTask(ctx context.Context, client *Client, task *Task, endChan chan int) error {\n\tif task.Logger != nil {\n\t\ttask.Logger.Debug(\"runTask\", zap.String(\"servaddr\", client.servAddr), JSON(\"task\", task))\n\t}\n\n\ttask.ServAddr = client.servAddr\n\n\tif task.AnalyzePage != nil {\n\t\tversion, reply, err := client.analyzePage(ctx, task.Hostname, task.AnalyzePage.URL,\n\t\t\t&task.AnalyzePage.Viewport, &task.AnalyzePage.Options)\n\n\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\treturn err\n\n\t} else if task.GeoIP != nil {\n\t\tversion, reply, err := client.getGeoIP(ctx, task.Hostname, task.GeoIP.IP, task.GeoIP.Platform)\n\n\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\treturn err\n\t} else if task.TechInAsia != nil {\n\t\tif task.TechInAsia.Mode == jarviscrawlercore.TechInAsiaMode_TIAM_JOBLIST {\n\t\t\tversion, reply, err := client.getTechInAsiaJobList(ctx, task.Hostname, task.TechInAsia.JobTag,\n\t\t\t\ttask.TechInAsia.JobSubTag, task.TechInAsia.JobNums, task.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.TechInAsia.Mode == jarviscrawlercore.TechInAsiaMode_TIAM_JOB {\n\t\t\tversion, reply, err := client.getTechInAsiaJob(ctx, task.Hostname, task.TechInAsia.JobCode,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.TechInAsia.Mode == jarviscrawlercore.TechInAsiaMode_TIAM_COMPANY {\n\t\t\tversion, reply, err := client.getTechInAsiaCompany(ctx, task.Hostname, task.TechInAsia.CompanyCode,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.TechInAsia.Mode == jarviscrawlercore.TechInAsiaMode_TIAM_JOBTAG {\n\t\t\tversion, reply, err := client.getTechInAsiaJobTagList(ctx, task.Hostname, task.TechInAsia.JobTag,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t}\n\n\t\treturn ErrInvalidTechInAsiaMode\n\t} else if task.SteepAndCheap != nil {\n\t\tif task.SteepAndCheap.Mode == jarviscrawlercore.SteepAndCheapMode_SACM_PRODUCTS {\n\t\t\tversion, reply, err := client.getSteepAndCheapProducts(ctx, task.Hostname, task.SteepAndCheap.URL,\n\t\t\t\ttask.SteepAndCheap.Page, task.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.SteepAndCheap.Mode == jarviscrawlercore.SteepAndCheapMode_SACM_PRODUCT {\n\t\t\tversion, reply, err := client.getSteepAndCheapProduct(ctx, task.Hostname, task.SteepAndCheap.URL,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t}\n\n\t\treturn ErrInvalidSteepAndCheapMode\n\t} else if task.JRJ != nil {\n\t\tif task.JRJ.Mode == jarviscrawlercore.JRJMode_JRJM_FUND {\n\t\t\tversion, reply, err := client.getJRJFund(ctx, task.Hostname, task.JRJ.Code, task.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.JRJ.Mode == jarviscrawlercore.JRJMode_JRJM_FUNDS {\n\t\t\tversion, reply, err := client.getJRJFunds(ctx, task.Hostname,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.JRJ.Mode == jarviscrawlercore.JRJMode_JRJM_FUNDMANAGER {\n\t\t\tversion, reply, err := client.getJRJFundManager(ctx, task.Hostname, task.JRJ.Code,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.JRJ.Mode == jarviscrawlercore.JRJMode_JRJM_FUNDVALUE {\n\t\t\tversion, reply, err := client.getJRJFundValue(ctx, task.Hostname, task.JRJ.Code, task.JRJ.Year,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t}\n\n\t\treturn ErrInvalidJRJMode\n\t} else if task.JD != nil {\n\t\tif task.JD.Mode == jarviscrawlercore.JDMode_JDM_ACTIVE {\n\t\t\tversion, reply, err := client.getJDActive(ctx, task.Hostname, task.JD.URL,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.JD.Mode == jarviscrawlercore.JDMode_JDM_PRODUCT {\n\t\t\tversion, reply, err := client.getJDProduct(ctx, task.Hostname, task.JD.URL,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.JD.Mode == jarviscrawlercore.JDMode_JDM_ACTIVEPAGE {\n\t\t\tversion, reply, err := client.getJDActivePage(ctx, task.Hostname, task.JD.URL,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t}\n\n\t\treturn ErrInvalidJDMode\n\t} else if task.Alimama != nil {\n\t\tif task.Alimama.Mode == jarviscrawlercore.AlimamaMode_ALIMMM_KEEPALIVE {\n\t\t\tversion, reply, err := client.alimamaKeepalive(ctx, task.Hostname,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.Alimama.Mode == jarviscrawlercore.AlimamaMode_ALIMMM_GETTOP {\n\t\t\tversion, reply, err := client.alimamaGetTop(ctx, task.Hostname,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.Alimama.Mode == jarviscrawlercore.AlimamaMode_ALIMMM_SEARCH {\n\t\t\tversion, reply, err := client.alimamaSearch(ctx, task.Hostname, task.Alimama.Text,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.Alimama.Mode == jarviscrawlercore.AlimamaMode_ALIMMM_GETSHOP {\n\t\t\tversion, reply, err := client.alimamaShop(ctx, task.Hostname, task.Alimama.URL,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t}\n\n\t\treturn ErrInvalidAlimamaMode\n\t} else if task.Tmall != nil {\n\t\tif task.Tmall.Mode == jarviscrawlercore.TmallMode_TMM_PRODUCT {\n\t\t\tversion, reply, err := client.tmallProduct(ctx, task.Hostname, task.Tmall.ItemID,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.Tmall.Mode == jarviscrawlercore.TmallMode_TMM_MOBILEPRODUCT {\n\t\t\tversion, reply, err := client.tmallMobileProduct(ctx, task.Hostname, task.Tmall.ItemID,\n\t\t\t\ttask.Tmall.Device, task.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t}\n\n\t\treturn ErrInvalidTmallMode\n\t} else if task.Taobao != nil {\n\t\tif task.Taobao.Mode == jarviscrawlercore.TaobaoMode_TBM_PRODUCT {\n\t\t\tversion, reply, err := client.taobaoProduct(ctx, task.Hostname, task.Taobao.ItemID,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.Taobao.Mode == jarviscrawlercore.TaobaoMode_TBM_MOBILEPRODUCT {\n\t\t\tversion, reply, err := client.taobaoMobileProduct(ctx, task.Hostname, task.Taobao.ItemID,\n\t\t\t\ttask.Taobao.Device, task.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.Taobao.Mode == jarviscrawlercore.TaobaoMode_TBM_SEARCH {\n\t\t\tversion, reply, err := client.taobaoSearch(ctx, task.Hostname,\n\t\t\t\ttask.Taobao.Text, task.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t}\n\n\t\treturn ErrInvalidTmallMode\n\t} else if task.MountainSteals != nil {\n\t\tif task.MountainSteals.Mode == jarviscrawlercore.MountainStealsMode_MSM_SALE {\n\t\t\tversion, reply, err := client.mountainstealsSale(ctx, task.Hostname, task.MountainSteals.URL,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.MountainSteals.Mode == jarviscrawlercore.MountainStealsMode_MSM_PRODUCT {\n\t\t\tversion, reply, err := client.mountainstealsProduct(ctx, task.Hostname, task.MountainSteals.URL,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t}\n\n\t\treturn ErrInvalidMountainstealsMode\n\t} else if task.Douban != nil {\n\t\tif task.Douban.Mode == jarviscrawlercore.DoubanMode_DBM_SEARCH {\n\t\t\tversion, reply, err := client.doubanSearch(ctx, task.Hostname, task.Douban.DoubanType,\n\t\t\t\ttask.Douban.Text, task.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.Douban.Mode == jarviscrawlercore.DoubanMode_DBM_BOOK {\n\t\t\tversion, reply, err := client.doubanBook(ctx, task.Hostname, task.Douban.ID,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t}\n\n\t\treturn ErrInvalidTmallMode\n\t} else if task.ManhuaDB != nil {\n\t\tif task.ManhuaDB.Mode == jarviscrawlercore.ManhuaDBMode_MHDB_AUTHOR {\n\t\t\tversion, reply, err := client.manhuadbAuthor(ctx, task.Hostname, task.ManhuaDB.AuthorID,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t}\n\n\t\treturn ErrInvalidTmallMode\n\t} else if task.OABT != nil {\n\t\tif task.OABT.Mode == jarviscrawlercore.OABTMode_OABTM_PAGE {\n\t\t\tversion, reply, err := client.oabtPage(ctx, task.Hostname, task.OABT.PageIndex,\n\t\t\t\ttask.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t}\n\n\t\treturn ErrInvalidTmallMode\n\t} else if task.Hao6v != nil {\n\t\tif task.Hao6v.Mode == jarviscrawlercore.Hao6VMode_H6VM_NEWPAGE {\n\t\t\tversion, reply, err := client.hao6vNewest(ctx, task.Hostname, task.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.Hao6v.Mode == jarviscrawlercore.Hao6VMode_H6VM_RESPAGE {\n\t\t\tversion, reply, err := client.hao6vRes(ctx, task.Hostname, task.Hao6v.URL, task.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t}\n\n\t\treturn ErrInvalidHao6vMode\n\t} else if task.P6vdy != nil {\n\t\tif task.P6vdy.Mode == jarviscrawlercore.P6VdyMode_P6VDY_MOVIES {\n\t\t\tversion, reply, err := client.p6vdyMovies(ctx, task.Hostname, task.P6vdy.URL, task.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.P6vdy.Mode == jarviscrawlercore.P6VdyMode_P6VDY_MOVIE {\n\t\t\tversion, reply, err := client.p6vdyMovie(ctx, task.Hostname, task.P6vdy.URL, task.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t}\n\n\t\treturn ErrInvalidP6vdyMode\n\t} else if task.Investing != nil {\n\t\tif task.Investing.Mode == jarviscrawlercore.InvestingMode_INVESTINGMODE_ASSETS {\n\t\t\tversion, reply, err := client.investingAssets(ctx, task.Hostname, task.Investing.URL, task.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t} else if task.Investing.Mode == jarviscrawlercore.InvestingMode_INVESTINGMODE_HD {\n\t\t\tversion, reply, err := client.investingHD(ctx, task.Hostname, task.Investing.URL, task.Investing.StartData, task.Investing.EndData, task.Timeout)\n\n\t\t\ttask.JCCInfo.Nodes = append(task.JCCInfo.Nodes, JCCNode{Addr: client.servAddr, Version: version})\n\n\t\t\tmgr.onTaskEnd(ctx, client, task, err, reply, endChan)\n\n\t\t\treturn err\n\t\t}\n\n\t\treturn ErrInvalidInvestingMode\n\t}\n\n\tif task.Logger != nil {\n\t\ttask.Logger.Error(\"runTask: ErrInvalidTask\", zap.String(\"servaddr\", client.servAddr), JSON(\"task\", task))\n\t}\n\n\tclient.Running = false\n\n\treturn ErrInvalidTask\n}", "func (c *conn) Exec(query string, args []driver.Value) (driver.Result, error) {\n\treturn c.exec(context.Background(), query, toNamedValues(args))\n}", "func (client *Client) ExecuteImportTask(request *ExecuteImportTaskRequest) (response *ExecuteImportTaskResponse, err error) {\n\tresponse = CreateExecuteImportTaskResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func (c *Config) Exec(command string) (stdOut string, stdErr string, exitStatus int, err error) {\n\treturn c.ExecAndWait(command)\n}", "func Exec(cmds []string, host config.Host, pwd string, force bool) (string, error) {\n\tvar err error\n\tvar auth goph.Auth\n\tvar callback ssh.HostKeyCallback\n\n\tif force {\n\t\tcallback = ssh.InsecureIgnoreHostKey()\n\t} else {\n\t\tif callback, err = DefaultKnownHosts(); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\tif host.Keyfile != \"\" {\n\t\t// Start new ssh connection with private key.\n\t\tif auth, err = goph.Key(host.Keyfile, pwd); err != nil {\n\t\t\tif os.Getenv(\"GO\") == \"DEBUG\" {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t\t// ssh: this private key is passphrase protected\n\t\t\tpwd = common.AskPass(\"Private key passphrase: \")\n\t\t\tif auth, err = goph.Key(host.Keyfile, pwd); err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif pwd == \"\" {\n\t\t\tpwd = common.AskPass(\n\t\t\t\tfmt.Sprintf(\"%s@%s's password: \", host.User, host.Addr),\n\t\t\t)\n\t\t}\n\t\tauth = goph.Password(pwd)\n\t}\n\n\tif os.Getenv(\"GO\") == \"DEBUG\" {\n\t\tfmt.Println(host, pwd, force)\n\t}\n\n\tclient, err := goph.NewConn(&goph.Config{\n\t\tUser: host.User,\n\t\tAddr: host.Addr,\n\t\tPort: host.Port,\n\t\tAuth: auth,\n\t\tTimeout: 5 * time.Second,\n\t\tCallback: callback,\n\t})\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Defer closing the network connection.\n\tdefer client.Close()\n\n\t// Execute your command.\n\tout, err := client.Run(strings.Join(cmds, \" && \"))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Get your output as []byte.\n\treturn string(out), nil\n}", "func (ic *ItemCreate) Exec(ctx context.Context) error {\n\t_, err := ic.Save(ctx)\n\treturn err\n}", "func (_pc *PCCreate) Exec(ctx context.Context) error {\n\t_, err := _pc.Save(ctx)\n\treturn err\n}", "func (c *Config) Exec(context.Context, []string) error {\n\t// The root command has no meaning, so if it gets executed,\n\t// display the usage text to the user instead.\n\treturn flag.ErrHelp\n}", "func (mu *MoneytransferUpdate) Exec(ctx context.Context) error {\n\t_, err := mu.Save(ctx)\n\treturn err\n}" ]
[ "0.7491893", "0.74503505", "0.71984", "0.7141873", "0.70722926", "0.6939766", "0.6800779", "0.6633108", "0.65625066", "0.6557004", "0.652908", "0.6454363", "0.6441503", "0.6435012", "0.6338124", "0.6324664", "0.6318782", "0.6309154", "0.6298092", "0.6294548", "0.62881535", "0.62857205", "0.62414783", "0.6186525", "0.6151883", "0.6072129", "0.6056452", "0.60328674", "0.6030106", "0.6026916", "0.60199976", "0.60124344", "0.60010356", "0.5979496", "0.5970751", "0.5956367", "0.59479225", "0.59441686", "0.59423184", "0.5928248", "0.59227294", "0.5920122", "0.5919036", "0.59143305", "0.5913563", "0.5901941", "0.5887948", "0.58811194", "0.5862485", "0.58237684", "0.58089536", "0.58069557", "0.5803796", "0.5763206", "0.5759794", "0.5757756", "0.5747311", "0.5747073", "0.5743411", "0.5741119", "0.5736636", "0.5736636", "0.57271814", "0.57227564", "0.5716151", "0.5713945", "0.571393", "0.5700346", "0.5699391", "0.56838965", "0.5681447", "0.5681161", "0.5679805", "0.5679181", "0.56724167", "0.56722546", "0.56717837", "0.56716895", "0.5668336", "0.5666439", "0.5650358", "0.56499714", "0.56477255", "0.56448823", "0.5641494", "0.5637113", "0.56359744", "0.56257325", "0.5623087", "0.5616752", "0.5608927", "0.5600986", "0.55979604", "0.5596131", "0.5596122", "0.55882424", "0.5587515", "0.5585986", "0.5582101", "0.5581443" ]
0.78052336
0
expandPath returns the absolute path of dir, relative to base if dir is relative path. base is expected to be an absolute path
expandPath возвращает абсолютный путь dir, относительно base, если dir — относительный путь. base ожидается как абсолютный путь
func expandPath(base, dir string) string { if filepath.IsAbs(dir) { return filepath.Clean(dir) } return filepath.Clean(filepath.Join(base, dir)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func expandFilePath(filePath string, baseDir string) string {\n\tif !strings.HasPrefix(filePath, \"/\") {\n\t\tfilePath = path.Join(baseDir, filePath)\n\t}\n\treturn filePath\n}", "func expandPath(path string) (string, error) {\n\tif len(path) == 0 {\n\t\treturn \"\", nil\n\t}\n\tif path[0] == '~' && (len(path) == 1 || os.IsPathSeparator(path[1])) {\n\t\tusr, err := user.Current()\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrap(err, \"Failed to get the home directory of the user\")\n\t\t}\n\t\tpath = filepath.Join(usr.HomeDir, path[1:])\n\t}\n\n\tvar err error\n\tpath, err = filepath.Abs(path)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"Failed to generate absolute path\")\n\t}\n\treturn path, nil\n}", "func expand(path string) (string, error) {\n\t// Ignore if path has no leading tilde.\n\tif path != \"~\" && !strings.HasPrefix(path, \"~\"+string(os.PathSeparator)) {\n\t\treturn path, nil\n\t}\n\n\t// Fetch the current user to determine the home path.\n\tu, err := user.Current()\n\tif err != nil {\n\t\treturn path, err\n\t} else if u.HomeDir == \"\" {\n\t\treturn path, fmt.Errorf(\"home directory unset\")\n\t}\n\n\tif path == \"~\" {\n\t\treturn u.HomeDir, nil\n\t}\n\treturn filepath.Join(u.HomeDir, strings.TrimPrefix(path, \"~\"+string(os.PathSeparator))), nil\n}", "func expand(path string) (string, error) {\n\tif len(path) == 0 || path[0] != '~' {\n\t\treturn path, nil\n\t}\n\n\tusr, err := user.Current()\n\tif err != nil {\n\t\treturn path, err\n\t}\n\n\treturn filepath.Join(usr.HomeDir, path[1:]), nil\n}", "func Base() string {\n\treturn filepath.Join(path, \"../..\")\n}", "func RelativePathBaseOn(basePath, filePath string) string {\n\tif filepath.IsAbs(filePath) {\n\t\treturn filePath\n\t}\n\treturn filepath.Join(basePath, filePath)\n}", "func GetPathWithBase(path, base string) string {\n\tif base != \"\" {\n\t\tparts := strings.Split(path, \"/\")\n\t\tparts = append(parts, \"\")\n\t\tcopy(parts[3:], parts[2:])\n\t\tparts[2] = strings.TrimPrefix(base, \"/\")\n\t\treturn strings.Join(parts, \"/\")\n\t}\n\treturn path\n}", "func Relative(base, complete string) string {\n\trel, err := filepath.Rel(base, complete)\n\tif err != nil {\n\t\tFatalf(\"Diff Path %s, %s: %s\", base, complete, err)\n\t}\n\n\t// special case\n\tif rel == \".\" {\n\t\trel = \"\"\n\t}\n\n\treturn rel\n}", "func joinPath(dir, file string) string {\n\tif filepath.IsAbs(file) {\n\t\treturn file\n\t}\n\treturn filepath.Join(dir, file)\n}", "func (pr *PathResolver) RelativePath(filename, baseDirectory string) string {\n\tif filepath.IsAbs(filename) && filepath.IsAbs(baseDirectory) {\n\t\toffset := baseDirectory\n\t\tif strings.HasSuffix(baseDirectory, string(pr.FileSeparator())) {\n\t\t\toffset = baseDirectory[:len(baseDirectory)-1]\n\t\t}\n\t\tfilename = filename[len(offset)+1:]\n\t}\n\treturn filename\n}", "func JoinPath(base string, rest ...string) string {\n\tresult := base\n\tfor _, next := range rest {\n\t\tif filepath.IsAbs(next) {\n\t\t\tresult = next\n\t\t} else {\n\t\t\tresult = filepath.Join(result, next)\n\t\t}\n\t}\n\treturn result\n}", "func ExpandPath(p string) (string, error) {\n\ta := strings.TrimSpace(p)\n\tif a[0] == '~' {\n\t\thome, err := HomeDir()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\ta = strings.Replace(a, \"~\", home, 1)\n\t}\n\treturn a, nil\n}", "func Expand(path string) string {\n\tif len(path) == 0 || path[0] != '~' || (len(path) > 1 && path[1] != '/' && path[1] != '\\\\') {\n\t\treturn path\n\t}\n\n\tdir, err := HomeDir()\n\tif err != nil {\n\t\treturn path\n\t}\n\n\treturn filepath.Join(dir, path[1:])\n}", "func relWithin(base, target string) (string, error) {\n\trel, err := filepath.Rel(base, target)\n\tif err != nil {\n\t\t// TODO: wrap\n\t\treturn \"\", err\n\t}\n\n\tparts := strings.SplitN(rel, \"/\", 2)\n\tif len(parts) > 0 {\n\t\tif parts[0] == \"..\" {\n\t\t\treturn \"\", errors.Errorf(\"Path %q not within root %q\", target, base)\n\t\t}\n\t}\n\n\treturn rel, nil\n}", "func Base(path string) string {\n\treturn Normalize(filepath.Base(Unnormalize(path)))\n}", "func JoinPath(base string, other string) string {\n\tif filepath.IsAbs(other) || base == \"\" {\n\t\treturn other\n\t}\n\treturn filepath.Join(base, other)\n}", "func Base(path string) string {\n\treturn std.Base(path)\n}", "func (mtst mainTests) getBaseProjectPath(\n addTrailingPathSeparator bool) (basePath string, err error) {\n\n ePrefix := \"getBaseProjectPath() \"\n fh := pf.FileHelper{}\n\n basePath = \"\"\n err = nil\n currDir, err2 := fh.GetAbsCurrDir()\n\n if err2 != nil {\n err = fmt.Errorf(ePrefix+\n \"Error returned by fh.GetAbsCurrDir().\\nError='%v'\\n\", err2.Error())\n\n return basePath, err\n }\n\n target := \"pathfileopsgo\"\n idx := strings.Index(currDir, target)\n\n if idx < 0 {\n err = fmt.Errorf(ePrefix +\n \"Error: Unable to locate \\\"pathfileopsgo\\\" in current directory string!\\n\")\n\n return basePath, err\n }\n\n idx += len(target)\n\n basePath = currDir[0:idx]\n\n if addTrailingPathSeparator {\n basePath += string(os.PathSeparator)\n }\n\n return basePath, err\n}", "func ExpandAbs(path string) string {\n\tpath, _ = filepath.Abs(ExpandHome(path))\n\treturn path\n}", "func PathExpandTilda(path string) string {\n\tif len(path) < 2 {\n\t\treturn path\n\t}\n\n\tfixedPath := path\n\tif fixedPath[:2] == \"~/\" {\n\t\tuserDir, _ := user.Current()\n\t\thomeDir := userDir.HomeDir\n\t\tfixedPath = filepath.Join(homeDir, fixedPath[2:])\n\t}\n\n\treturn fixedPath\n}", "func (p *PathSpec) PrependBasePath(rel string, isAbs bool) string {\n\tbasePath := p.GetBasePath(!isAbs)\n\tif basePath != \"\" {\n\t\trel = filepath.ToSlash(rel)\n\t\t// Need to prepend any path from the baseURL\n\t\thadSlash := strings.HasSuffix(rel, \"/\")\n\t\trel = path.Join(basePath, rel)\n\t\tif hadSlash {\n\t\t\trel += \"/\"\n\t\t}\n\t}\n\treturn rel\n}", "func absJoin(dir, name string) (string, error) {\n\tif name == \"\" {\n\t\treturn filepath.Abs(dir)\n\t}\n\n\tif filepath.IsAbs(name) {\n\t\treturn name, nil\n\t}\n\n\tif len(name) > 0 && name[0] == '~' && (len(name) == 1 || name[1] == '/' || name[1] == '\\\\') {\n\t\treturn expendHome(name)\n\t}\n\n\treturn absPath(filepath.Join(dir, name))\n}", "func tryExpandPath(path string) string {\n\tif expanded, err := homedir.Expand(path); nil == err {\n\t\tpath = expanded\n\t}\n\n\treturn path\n}", "func normPath(bases []string, abspath string) (string, error) {\n\tfor _, base := range bases {\n\t\tabsbase, err := filepath.Abs(base)\n\t\tif isUnder(absbase, abspath) {\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\trelpath, err := filepath.Rel(absbase, abspath)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\treturn filepath.Join(base, relpath), nil\n\t\t}\n\t}\n\treturn abspath, nil\n}", "func pathRelDir(path string) (string, error) {\n\tpath, err := filepath.Abs(path)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\twd, err := os.Getwd()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tpath, err = filepath.Rel(wd, path)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// If Rel returned \".\", fix it to empty string which will eventually mutate to \"./\".\n\tif path == \".\" {\n\t\tpath = \"\"\n\t}\n\t// Add a \"./\" prefix.\n\tif !strings.HasPrefix(path, \"./\") {\n\t\tpath = \"./\" + path\n\t}\n\treturn path, nil\n}", "func GetRelativePath(path, base string) (final string, err error) {\n\tif filepath.IsAbs(path) && base == \"\" {\n\t\treturn \"\", errors.New(\"source: missing base directory\")\n\t}\n\tname := filepath.Clean(path)\n\tbase = filepath.Clean(base)\n\n\tname, err = filepath.Rel(base, name)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif strings.HasSuffix(filepath.FromSlash(path), FilePathSeparator) && !strings.HasSuffix(name, FilePathSeparator) {\n\t\tname += FilePathSeparator\n\t}\n\treturn name, nil\n}", "func path(relPath string) string {\n\tif filepath.IsAbs(relPath) {\n\t\treturn relPath\n\t}\n\n\treturn filepath.Join(basepath, relPath)\n}", "func PathBase(path string) string {\n\t// If this is the root path, then just return an empty string.\n\tif path == \"\" {\n\t\treturn \"\"\n\t}\n\n\t// Identify the index of the last slash in the path.\n\tlastSlashIndex := strings.LastIndexByte(path, '/')\n\n\t// If there is no slash, then the path is a file directly under the\n\t// synchronization root.\n\tif lastSlashIndex == -1 {\n\t\treturn path\n\t}\n\n\t// Verify that the base name isn't empty (i.e. that the string doesn't end\n\t// with a slash). We could do additional validation here (e.g. validating\n\t// the path segment before the slash), but it would be costly and somewhat\n\t// unnecessary. This check is sufficient to ensure that this function can\n\t// return a meaningful answer.\n\tif lastSlashIndex == len(path)-1 {\n\t\tpanic(\"empty base name\")\n\t}\n\n\t// Extract the base name.\n\treturn path[lastSlashIndex+1:]\n}", "func ExpandPath(path string) string {\n\tpathSegments, pathRoot, _ := PartitionPath(path, false)\n\treturn JoinPath(pathSegments, pathRoot)\n}", "func (fs osFS) resolve(path string) string {\n\t// Clean the path so that it cannot possibly begin with ../.\n\t// If it did, the result of filepath.Join would be outside the\n\t// tree rooted at root. We probably won't ever see a path\n\t// with .. in it, but be safe anyway.\n\tpath = pathpkg.Clean(\"/\" + path)\n\n\treturn filepath.Join(string(fs.root), path)\n}", "func resolveGitPath(base, path string) string {\n\tif len(path) == 0 {\n\t\treturn base\n\t}\n\tif filepath.IsAbs(path) {\n\t\treturn path\n\t}\n\t// Note that git on Windows uses slashes exclusively. And it's okay\n\t// because Windows actually accepts both directory separators. More\n\t// importantly, however, parts of the git segment depend on those\n\t// slashes.\n\tif path[0] == '/' {\n\t\t// path is a disk-relative path.\n\t\treturn filepath.VolumeName(base) + path\n\t}\n\treturn filepath.ToSlash(filepath.Join(base, path))\n}", "func (p Path) BaseDir() Path {\r\n\tret := Path(filepath.Dir(string(p)))\r\n\treturn ret\r\n}", "func expandHomeDir(path string) (string, error) {\n\thome, err := homedir.Dir()\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\treturn \"\", err\n\t}\n\n\treturn strings.Replace(path, \"~\", home, -1), nil\n}", "func expandHomeDir(path string) string {\n\tif !strings.HasPrefix(path, \"~/\") {\n\t\treturn path\n\t}\n\n\tcurrentUser, err := user.Current()\n\tif err != nil {\n\t\tpanic(\"unable to determine user $HOME\")\n\t}\n\treturn filepath.Join(currentUser.HomeDir, path[2:])\n}", "func ExpandPath(path string) string {\n\tif strings.HasPrefix(path, \"~\") {\n\t\tpath = filepath.Join(HomeDir(), path[1:])\n\t}\n\n\treturn os.ExpandEnv(path)\n}", "func absPaths(base string, paths []string) []string {\n\tp := make([]string, len(paths))\n\tfor ix, v := range paths {\n\t\tp[ix] = filepath.Join(base, v)\n\t}\n\treturn p\n}", "func (w *World) Expand(path string) (s string, err error) {\n\ts = os.Expand(path, func(v string) string {\n\t\tswitch v {\n\t\tcase \"script_name\", \"sn\":\n\t\t\tif entry, ok := w.PeekFile(); ok {\n\t\t\t\tif entry.Path == \"\" {\n\t\t\t\t\treturn \"\"\n\t\t\t\t}\n\t\t\t\tvar path string\n\t\t\t\tpath, err = filepath.Abs(entry.Path)\n\t\t\t\tif err != nil {\n\t\t\t\t\terr = fmt.Errorf(\"expand %s: %w\", v, err)\n\t\t\t\t}\n\t\t\t\treturn filepath.Base(path)\n\t\t\t}\n\t\tcase \"script_directory\", \"script_dir\", \"sd\":\n\t\t\tif entry, ok := w.PeekFile(); ok {\n\t\t\t\tif entry.Path == \"\" {\n\t\t\t\t\tvar dir string\n\t\t\t\t\tdir, err = os.Getwd()\n\t\t\t\t\treturn dir\n\t\t\t\t}\n\t\t\t\tvar path string\n\t\t\t\tpath, err = filepath.Abs(entry.Path)\n\t\t\t\tif err != nil {\n\t\t\t\t\terr = fmt.Errorf(\"expand %s: %w\", v, err)\n\t\t\t\t}\n\t\t\t\treturn filepath.Dir(path)\n\t\t\t}\n\t\tcase \"root_script_directory\", \"root_script_dir\", \"rsd\":\n\t\t\trootdir := w.RootDir()\n\t\t\tif rootdir == \"\" {\n\t\t\t\trootdir, err = os.Getwd()\n\t\t\t\tif err != nil {\n\t\t\t\t\terr = fmt.Errorf(\"expand %s: %w\", v, err)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rootdir\n\t\tcase \"working_directory\", \"working_dir\", \"wd\":\n\t\t\tvar wd string\n\t\t\twd, err = os.Getwd()\n\t\t\tif err != nil {\n\t\t\t\terr = fmt.Errorf(\"expand %s: %w\", v, err)\n\t\t\t}\n\t\t\treturn wd\n\t\tcase \"temp_directory\", \"temp_dir\", \"tmp\":\n\t\t\tt := w.TempDir()\n\t\t\tif t == \"\" {\n\t\t\t\terr = fmt.Errorf(\"expand %s: could not find temporary directory\", v)\n\t\t\t}\n\t\t\treturn t\n\t\t}\n\t\terr = fmt.Errorf(\"unknown variable %q\", v)\n\t\treturn \"\"\n\t})\n\treturn s, err\n}", "func cleanAndExpandPath(path string) string {\n\t// Do not try to clean the empty string\n\tif path == \"\" {\n\t\treturn \"\"\n\t}\n\n\t// NOTE: The os.ExpandEnv doesn't work with Windows cmd.exe-style\n\t// %VARIABLE%, but the variables can still be expanded via POSIX-style\n\t// $VARIABLE.\n\tpath = os.ExpandEnv(path)\n\tif !strings.HasPrefix(path, \"~\") {\n\t\treturn filepath.Clean(path)\n\t}\n\n\t// Expand initial ~ to the current user's home directory, or ~otheruser to\n\t// otheruser's home directory. On Windows, both forward and backward\n\t// slashes can be used.\n\tpath = path[1:]\n\n\tvar pathSeparators string\n\tif runtime.GOOS == \"windows\" {\n\t\tpathSeparators = string(os.PathSeparator) + \"/\"\n\t} else {\n\t\tpathSeparators = string(os.PathSeparator)\n\t}\n\n\tuserName := \"\"\n\tif i := strings.IndexAny(path, pathSeparators); i != -1 {\n\t\tuserName = path[:i]\n\t\tpath = path[i:]\n\t}\n\n\thomeDir := \"\"\n\tvar u *user.User\n\tvar err error\n\tif userName == \"\" {\n\t\tu, err = user.Current()\n\t} else {\n\t\tu, err = user.Lookup(userName)\n\t}\n\tif err == nil {\n\t\thomeDir = u.HomeDir\n\t}\n\t// Fallback to CWD if user lookup fails or user has no home directory.\n\tif homeDir == \"\" {\n\t\thomeDir = \".\"\n\t}\n\n\treturn filepath.Join(homeDir, path)\n}", "func (s *GitTestHelper) toAbsPath(name string) string {\n\tif path.IsAbs(name) {\n\t\treturn name\n\t}\n\twd := s.Getwd()\n\tif wd == \"\" {\n\t\twd, _ = os.Getwd()\n\t\tif wd == \"\" {\n\t\t\twd = os.TempDir()\n\t\t}\n\t}\n\n\treturn path.Join(wd, name)\n}", "func ExpandPath(path string) (string, error) {\n\tif strings.Contains(path, \"~\") {\n\t\tvar err error\n\t\tpath, err = expandHomeDir(path)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\treturn path, nil\n}", "func relativePath(target, path string) string {\n\tsplit := strings.Split(path, \"/\")\n\tfor i, s := range split {\n\t\tif s == target {\n\t\t\treturn strings.Join(split[i:], \"/\")\n\t\t}\n\t}\n\tfmt.Println(\"WARN: Failed to \")\n\treturn \"\"\n}", "func shortPath(path string) string {\n\tif rel, err := filepath.Rel(cwd, path); err == nil && len(rel) < len(path) {\n\t\treturn rel\n\t}\n\treturn path\n}", "func AbsPathify(workingDir, inPath string) string {\n\tif filepath.IsAbs(inPath) {\n\t\treturn filepath.Clean(inPath)\n\t}\n\treturn filepath.Join(workingDir, inPath)\n}", "func (pctx *processContext) resolve(path string) string {\n\tif filepath.IsAbs(path) {\n\t\treturn path\n\t}\n\treturn filepath.Join(pctx.workdir, path)\n}", "func ExpandSchemaWithBasePath(schema *Schema, cache ResolutionCache, opts *ExpandOptions) error {\n\tif schema == nil {\n\t\treturn nil\n\t}\n\n\tcache = cacheOrDefault(cache)\n\n\topts = optionsOrDefault(opts)\n\n\tresolver := defaultSchemaLoader(nil, opts, cache, nil)\n\n\tparentRefs := make([]string, 0, 10)\n\ts, err := expandSchema(*schema, parentRefs, resolver, opts.RelativeBase)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif s != nil {\n\t\t// guard for when continuing on error\n\t\t*schema = *s\n\t}\n\n\treturn nil\n}", "func PathJoin(incoming []string) string { return filesys.PathJoin(incoming) }", "func RelativePath(relativepath string, optionalpaths ...string) string {\n\t_, thisFile, _, _ := runtime.Caller(1)\n\tlocalDir := filepath.Dir(thisFile)\n\n\t// If we have optional paths, join them to the relativepath\n\tif len(optionalpaths) > 0 {\n\t\tpaths := []string{relativepath}\n\t\tpaths = append(paths, optionalpaths...)\n\t\trelativepath = filepath.Join(paths...)\n\t}\n\tresult, err := filepath.Abs(filepath.Join(localDir, relativepath))\n\tif err != nil {\n\t\t// I'm allowing this for 1 reason only: It's fatal if the path\n\t\t// supplied is wrong as it's only used internally in Wails. If we get\n\t\t// that path wrong, we should know about it immediately. The other reason is\n\t\t// that it cuts down a ton of unnecassary error handling.\n\t\tpanic(err)\n\t}\n\treturn result\n}", "func CleanAndExpandPath(path string) string {\n\t// Nothing to do when no path is given.\n\tif path == \"\" {\n\t\treturn path\n\t}\n\n\t// NOTE: The os.ExpandEnv doesn't work with Windows cmd.exe-style\n\t// %VARIABLE%, but the variables can still be expanded via POSIX-style\n\t// $VARIABLE.\n\tpath = os.ExpandEnv(path)\n\n\tif !strings.HasPrefix(path, \"~\") {\n\t\treturn filepath.Clean(path)\n\t}\n\n\t// Expand initial ~ to the current user's home directory, or ~otheruser\n\t// to otheruser's home directory. On Windows, both forward and backward\n\t// slashes can be used.\n\tpath = path[1:]\n\n\tvar pathSeparators string\n\tif runtime.GOOS == \"windows\" {\n\t\tpathSeparators = string(os.PathSeparator) + \"/\"\n\t} else {\n\t\tpathSeparators = string(os.PathSeparator)\n\t}\n\n\tuserName := \"\"\n\tif i := strings.IndexAny(path, pathSeparators); i != -1 {\n\t\tuserName = path[:i]\n\t\tpath = path[i:]\n\t}\n\n\thomeDir := \"\"\n\tvar u *user.User\n\tvar err error\n\tif userName == \"\" {\n\t\tu, err = user.Current()\n\t} else {\n\t\tu, err = user.Lookup(userName)\n\t}\n\tif err == nil {\n\t\thomeDir = u.HomeDir\n\t}\n\t// Fallback to CWD if user lookup fails or user has no home directory.\n\tif homeDir == \"\" {\n\t\thomeDir = \".\"\n\t}\n\n\treturn filepath.Join(homeDir, path)\n}", "func RerootPath(p string, relto string) (string, error) {\n\tvar err error\n\tp, err = Homeopathy(p)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tp = os.ExpandEnv(p)\n\tif !path.IsAbs(p) {\n\t\tp = path.Join(relto, p)\n\t}\n\tp = path.Clean(p)\n\treturn p, nil\n}", "func Rel(basepath string, targpath string) (string, error) {\n\tpath, err := filepath.Rel(Unnormalize(basepath), Unnormalize(targpath))\n\tif path == \"\" {\n\t\treturn \"\", err\n\t}\n\treturn Normalize(path), err\n}", "func AbsPath(elem ...string) string {\r\n\tp := path.Join(elem...)\r\n\tif filepath.IsAbs(p) {\r\n\t\treturn p\r\n\t}\r\n\treturn path.Join(workDir, p)\r\n}", "func cleanAndExpandPath(path string) string {\n\t// NOTE: The os.ExpandEnv doesn't work with Windows cmd.exe-style\n\t// %VARIABLE%, but the variables can still be expanded via POSIX-style\n\t// $VARIABLE.\n\tpath = os.ExpandEnv(path)\n\n\tif !strings.HasPrefix(path, \"~\") {\n\t\treturn filepath.Clean(path)\n\t}\n\n\t// Expand initial ~ to the current user's home directory, or ~otheruser to\n\t// otheruser's home directory. On Windows, both forward and backward\n\t// slashes can be used.\n\tpath = path[1:]\n\n\tvar pathSeparators string\n\tif runtime.GOOS == \"windows\" {\n\t\tpathSeparators = string(os.PathSeparator) + \"/\"\n\t} else {\n\t\tpathSeparators = string(os.PathSeparator)\n\t}\n\n\tuserName := \"\"\n\tif i := strings.IndexAny(path, pathSeparators); i != -1 {\n\t\tuserName = path[:i]\n\t\tpath = path[i:]\n\t}\n\n\thomeDir := \"\"\n\tvar u *user.User\n\tvar err error\n\tif userName == \"\" {\n\t\tu, err = user.Current()\n\t} else {\n\t\tu, err = user.Lookup(userName)\n\t}\n\tif err == nil {\n\t\thomeDir = u.HomeDir\n\t}\n\t// Fallback to CWD if user lookup fails or user has no home directory.\n\tif homeDir == \"\" {\n\t\thomeDir = \".\"\n\t}\n\n\treturn filepath.Join(homeDir, path)\n}", "func cleanAndExpandPath(path string) string {\n\t// NOTE: The os.ExpandEnv doesn't work with Windows cmd.exe-style\n\t// %VARIABLE%, but the variables can still be expanded via POSIX-style\n\t// $VARIABLE.\n\tpath = os.ExpandEnv(path)\n\n\tif !strings.HasPrefix(path, \"~\") {\n\t\treturn filepath.Clean(path)\n\t}\n\n\t// Expand initial ~ to the current user's home directory, or ~otheruser to\n\t// otheruser's home directory. On Windows, both forward and backward\n\t// slashes can be used.\n\tpath = path[1:]\n\n\tvar pathSeparators string\n\tif runtime.GOOS == \"windows\" {\n\t\tpathSeparators = string(os.PathSeparator) + \"/\"\n\t} else {\n\t\tpathSeparators = string(os.PathSeparator)\n\t}\n\n\tuserName := \"\"\n\tif i := strings.IndexAny(path, pathSeparators); i != -1 {\n\t\tuserName = path[:i]\n\t\tpath = path[i:]\n\t}\n\n\thomeDir := \"\"\n\tvar u *user.User\n\tvar err error\n\tif userName == \"\" {\n\t\tu, err = user.Current()\n\t} else {\n\t\tu, err = user.Lookup(userName)\n\t}\n\tif err == nil {\n\t\thomeDir = u.HomeDir\n\t}\n\t// Fallback to CWD if user lookup fails or user has no home directory.\n\tif homeDir == \"\" {\n\t\thomeDir = \".\"\n\t}\n\n\treturn filepath.Join(homeDir, path)\n}", "func MakeRelative(path, base string) (string, error) {\n\tif len(path) > 0 {\n\t\trel, err := filepath.Rel(base, path)\n\t\tif err != nil {\n\t\t\treturn path, err\n\t\t}\n\t\treturn rel, nil\n\t}\n\treturn path, nil\n}", "func ensureAbs(path string) string {\n\tif filepath.IsAbs(path) {\n\t\treturn path\n\t}\n\treturn filepath.Join(WorkDir(), path)\n}", "func TestFilePathBase(t *testing.T) {\n\n\t// absolute\n\tif filepath.Base(\"/a/b/c/path.txt\") != \"path.txt\" {\n\t\tt.Error(\"Abs of a base path failed\")\n\t}\n\t// relative\n\tif filepath.Base(\"a/b/c/path.txt\") != \"path.txt\" {\n\t\tt.Error(\"Abs of a relative path failed\")\n\t}\n\t// root\n\tif filepath.Base(\"/\") != \"/\" {\n\t\tt.Error(\"Abs of / failed\")\n\t}\n\n\t// negative\n\tif filepath.Base(\"a/b/c/////path.txt\") != \"path.txt\" {\n\t\tt.Error(\"Abs with multiple separators failed\")\n\t}\n\tif filepath.Base(\"./dir/.././path.txt\") != \"path.txt\" {\n\t\tt.Error(\"Abs with a non-clean path failed\")\n\t}\n\tif filepath.Base(\"//////\") != \"/\" {\n\t\tt.Error(\"Multi-slashed root path failed\")\n\t}\n}", "func Expand(s string) (string, error) {\n\ts = os.ExpandEnv(s)\n\n\tvar err error\n\ts, err = homedir.Expand(s)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn s, nil\n}", "func (dir *Dir) RelPath() string {\n\trel, err := filepath.Rel(dir.repoBase, dir.Path)\n\tif dir.repoBase == \"\" || err != nil {\n\t\treturn dir.BaseName()\n\t}\n\treturn rel\n}", "func (dir *Dir) RelPath() string {\n\trel, err := filepath.Rel(dir.repoBase, dir.Path)\n\tif dir.repoBase == \"\" || err != nil {\n\t\treturn dir.BaseName()\n\t}\n\treturn rel\n}", "func getAbsInstallPath(relPath string) (string, error) {\n\tex, err := os.Executable()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn filepath.Join(filepath.Dir(ex), \"..\", relPath), nil\n}", "func PathIncludeCurrentDir(path string) string {\n\tdir, _ := filepath.Abs(filepath.Dir(os.Args[0]))\n\treturn dir + \"/\" + path\n}", "func baseDir(filename string) string {\n\treturn filepath.Clean(filepath.Dir(filename))\n}", "func (m *Module) relativePath(p *types.Package) string {\n\treturn strings.TrimPrefix(p.Path(), m.Path)\n}", "func (f LocalFS) Base() string {\n\treturn f.basePath\n}", "func (f LocalFS) Base() string {\n\treturn f.basePath\n}", "func expandChartFilesPath(charts []ChartDefinition, baseDir string) {\n\tfor i := range charts {\n\t\tc := &charts[i]\n\t\tc.ValuesPath = expandFilePath(c.ValuesPath, baseDir)\n\t\tc.Path = expandFilePath(c.Path, baseDir)\n\t}\n}", "func Basepath() string {\n\tbase, err := os.Getwd()\n\tif err != nil {\n\t\treturn \".\"\n\t}\n\treturn base\n}", "func RealPath(file string) (string, error) {\n\tif path.IsAbs(file) {\n\t\treturn file, nil\n\t}\n\twd, err := os.Getwd()\n\treturn path.Join(wd, file), err\n}", "func GetFullRepositoryFromPath(path string, base string) string {\n\treturn GetRepositoryFromPath(GetPathWithBase(path, base))\n}", "func relativePath(storePath, shardPath string) (string, error) {\n\tpath, err := filepath.Abs(storePath)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"store abs path: %s\", err)\n\t}\n\n\tfp, err := filepath.Abs(shardPath)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"file abs path: %s\", err)\n\t}\n\n\tname, err := filepath.Rel(path, fp)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"file rel path: %s\", err)\n\t}\n\n\treturn name, nil\n}", "func (r Ref) AbsPath(rootDir string) string {\n\tpath := filepath.Join(rootDir, r.GetPath())\n\tpath, _ = filepath.Abs(path)\n\tpath = filepath.ToSlash(path)\n\treturn path\n}", "func GetPathFromBase64Hash(base64Hash types.Base64Hash, absBasePath config.Path) (string, error) {\n\tif len(base64Hash) < 3 {\n\t\treturn \"\", fmt.Errorf(\"invalid filePath (Base64Hash too short - min 3 characters): %q\", base64Hash)\n\t}\n\tif len(base64Hash) > 255 {\n\t\treturn \"\", fmt.Errorf(\"invalid filePath (Base64Hash too long - max 255 characters): %q\", base64Hash)\n\t}\n\n\tfilePath, err := filepath.Abs(filepath.Join(\n\t\tstring(absBasePath),\n\t\tstring(base64Hash[0:1]),\n\t\tstring(base64Hash[1:2]),\n\t\tstring(base64Hash[2:]),\n\t\t\"file\",\n\t))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"unable to construct filePath: %w\", err)\n\t}\n\n\t// check if the absolute absBasePath is a prefix of the absolute filePath\n\t// if so, no directory escape has occurred and the filePath is valid\n\t// Note: absBasePath is already absolute\n\tif !strings.HasPrefix(filePath, string(absBasePath)) {\n\t\treturn \"\", fmt.Errorf(\"invalid filePath (not within absBasePath %v): %v\", absBasePath, filePath)\n\t}\n\n\treturn filePath, nil\n}", "func realPath(file string) string {\n\tif string(file[0]) == \"/\" {\n\t\treturn file\n\t}\n\n\tif string(file[0]) != \"/\" {\n\t\tfile = \"/\" + file\n\t}\n\n\t_, filename, _, _ := runtime.Caller(3)\n\tdir := path.Join(path.Dir(filename), file)\n\n\tif _, err := os.Stat(dir); err == nil && strings.HasSuffix(dir, file) {\n\t\treturn dir\n\t}\n\n\tcurrent, err := os.Getwd()\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdir = file\n\n\tif strings.HasSuffix(dir, current) {\n\t\treturn dir\n\t}\n\n\treturn current + dir\n}", "func basePath() string {\n\t_, currentFile, _, _ := runtime.Caller(2)\n\tbasepath := filepath.Dir(currentFile)\n\treturn basepath\n}", "func RelativeDir(relativePath string) string {\n\t_, f, _, _ := runtime.Caller(1)\n\treturn filepath.Join(filepath.Dir(f), relativePath)\n}", "func baseDir() (string, error) {\n\tdirPath := filepath.Join(os.TempDir(), \"pod\", \"rpctest\")\n\te := os.MkdirAll(dirPath, 0755)\n\treturn dirPath, e\n}", "func expandTilde(path string, homeDirAbsPath AbsPath) string {\n\tswitch {\n\tcase path == \"~\":\n\t\treturn string(homeDirAbsPath)\n\tcase strings.HasPrefix(path, \"~/\"):\n\t\treturn string(homeDirAbsPath.Join(RelPath(path[2:])))\n\tdefault:\n\t\treturn path\n\t}\n}", "func RelPath(source, path string) string {\n\tsrcDir := filepath.Dir(source)\n\tif srcDir != \".\" {\n\t\treturn filepath.Join(srcDir, path)\n\t}\n\treturn path\n}", "func AbsolutePathHelper(rel string, parts ...string) (path string, err error) {\n\tabs, err := filepath.Abs(rel)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn filepath.Join(append([]string{abs}, parts...)...), nil\n}", "func pathJoin(base, leaf string) string {\n\t// Disalllow empty leaf names.\n\tif leaf == \"\" {\n\t\tpanic(\"empty leaf name\")\n\t}\n\n\t// When joining a path to the synchronization root, we don't want to\n\t// concatenate.\n\tif base == \"\" {\n\t\treturn leaf\n\t}\n\n\t// Concatenate the paths.\n\treturn base + \"/\" + leaf\n}", "func makeRelative(child, parent string) string {\n\treturn strings.TrimPrefix(child, dirName(parent))\n}", "func ToExtendedPath(short string) string {\n\t// filepath.Abs has an issue where if the path is just the drive indicator of your CWD, it just returns the CWD. So, we append the / to show that yes, we really mean C: or whatever.\n\tif runtime.GOOS == \"windows\" && len(short) == 2 && RootDriveRegex.MatchString(short) {\n\t\tshort += \"/\"\n\t}\n\n\tshort, err := filepath.Abs(short)\n\tPanicIfErr(err) //TODO: Handle errors better?\n\n\t// ex. C:/dir/file.txt -> \\\\?\\C:\\dir\\file.txt\n\t// ex. \\\\share\\dir\\file.txt -> \\\\?\\UNC\\share\\dir\\file.txt\n\tif runtime.GOOS == \"windows\" { // Only do this on Windows\n\t\tif strings.HasPrefix(short, EXTENDED_PATH_PREFIX) { // already an extended path \\\\?\\C:\\folder\\file.txt or \\\\?\\UNC\\sharename\\folder\\file.txt\n\t\t\treturn strings.Replace(short, `/`, `\\`, -1) // Just ensure it has all backslashes-- Windows can't handle forward-slash anymore in this format.\n\t\t} else if strings.HasPrefix(short, `\\\\`) { // this is a file share (//sharename/folder/file.txt)\n\t\t\t// Steal the first backslash, and then append the prefix. Enforce \\.\n\t\t\treturn strings.Replace(EXTENDED_UNC_PATH_PREFIX+short[1:], `/`, `\\`, -1) // convert to extended UNC path\n\t\t} else { // this is coming from a drive-- capitalize the drive prefix. (C:/folder/file.txt)\n\t\t\tif len(short) >= 2 && RootDriveRegex.MatchString(short[:2]) {\n\t\t\t\tshort = strings.Replace(short, short[:2], strings.ToUpper(short[:2]), 1)\n\t\t\t}\n\t\t\t// Then append the prefix. Enforce \\.\n\t\t\treturn strings.Replace(EXTENDED_PATH_PREFIX+short, `/`, `\\`, -1) // Just append the prefix\n\t\t}\n\t}\n\n\treturn short\n}", "func ExpandHomePath(p string, home string) string {\n\tif strings.HasPrefix(p, homePrefix) {\n\t\treturn path.Join(home, strings.TrimPrefix(p, homePrefix))\n\t}\n\n\treturn p\n}", "func relToPath(path, workingDir string) (string, error) {\n\tworkingDir = util.ConsistentFilepath(workingDir)\n\tpath = util.ConsistentFilepath(path)\n\n\tif !filepath.IsAbs(path) {\n\t\treturn path, nil\n\t}\n\n\tif workingDir == \"\" || !strings.HasPrefix(path, workingDir) {\n\t\treturn path, errNotRelativeToWorkingDir\n\t}\n\n\trelPath, err := filepath.Rel(workingDir, path)\n\tif err != nil {\n\t\treturn path, errors.Wrap(err, errNotRelativeToWorkingDir.Error())\n\t}\n\n\treturn util.ConsistentFilepath(relPath), nil\n}", "func GetAbsPath(p string) (out string, err error) {\n\tif p == \"\" {\n\t\tout, err = os.Getwd()\n\t} else if strings.HasPrefix(p, \"~\") {\n\t\tout, err = homedir.Expand(p)\n\t} else if !filepath.IsAbs(p) {\n\t\tout, err = filepath.Abs(p)\n\t} else {\n\t\tout = p\n\t}\n\treturn\n}", "func getPath(dir string, file os.FileInfo) string {\n\tif !strings.HasSuffix(dir, \"/\") {\n\t\tdir += \"/\"\n\t}\n\treturn dir + file.Name()\n}", "func AbsPath(input string) string {\n\tp := input\n\tif p == \"\" {\n\t\treturn \"\"\n\t}\n\tif p[0] == '~' {\n\t\tp = path.Join(homeDir, p[1:])\n\t}\n\tmatches, _ := filepath.Glob(p)\n\tif len(matches) != 0 {\n\t\tp = matches[0]\n\t}\n\tabs, _ := filepath.Abs(p)\n\treturn abs\n}", "func Abs(path string) string {\n\tabspath, err := filepath.Abs(Expand(path))\n\tif err != nil {\n\t\treturn path\n\t}\n\treturn abspath\n}", "func baseDirs(root string, includePatterns []string) ([]string, []string) {\n\troot = filepath.FromSlash(root)\n\tbases := make([]string, len(includePatterns))\n\tnewincludes := includePatterns[:]\n\tfor i, v := range includePatterns {\n\t\tbdir, trailer := filter.SplitPattern(v)\n\t\tif !filepath.IsAbs(bdir) {\n\t\t\tbdir = filepath.Join(root, filepath.FromSlash(bdir))\n\t\t}\n\t\tif stat, err := os.Lstat(bdir); err == nil {\n\t\t\tif stat.Mode()&os.ModeSymlink != 0 {\n\t\t\t\t// Case 1: The file exists and is a symlink, so we rebase the\n\t\t\t\t// include patterns and the base directory\n\t\t\t\tlnk, err := os.Readlink(bdir)\n\t\t\t\tif err != nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif filepath.IsAbs(lnk) {\n\t\t\t\t\tbdir = lnk\n\t\t\t\t} else {\n\t\t\t\t\tbdir = filepath.Join(bdir, lnk)\n\t\t\t\t}\n\t\t\t\tif trailer != \"\" {\n\t\t\t\t\tnewincludes[i] = bdir + \"/\" + trailer\n\t\t\t\t} else {\n\t\t\t\t\tnewincludes[i] = bdir\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Case 2: The file exists and is nota symlink, so we leave bdir\n\t\t\t\t// unmodified.\n\t\t\t\tbdir = enclosingDir(bdir)\n\t\t\t\tif bdir == \"\" {\n\t\t\t\t\tbdir = root\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tbdir = enclosingDir(bdir)\n\t\t\tif bdir == \"\" {\n\t\t\t\tbdir = root\n\t\t\t}\n\t\t}\n\t\tbases[i] = bdir\n\t}\n\treturn newincludes, bases\n}", "func expand(path string) ([]string, error) {\n\tif fi, err := os.Stat(path); err != nil {\n\t\treturn nil, err\n\t} else if !fi.IsDir() {\n\t\treturn []string{path}, nil\n\t}\n\n\t// Read files in directory.\n\tfis, err := ioutil.ReadDir(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Iterate over files and expand.\n\texpanded := make([]string, 0, len(fis))\n\tfor _, fi := range fis {\n\t\ta, err := expand(filepath.Join(path, fi.Name()))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\texpanded = append(expanded, a...)\n\t}\n\treturn expanded, nil\n}", "func RelPath(targpath string) string {\n\tbasepath, _ := filepath.Abs(\"./\")\n\trel, _ := filepath.Rel(basepath, targpath)\n\treturn strings.Replace(rel, `\\`, `/`, -1)\n}", "func ToAbsolutePath(base, path string) string {\n\tif filepath.IsAbs(path) {\n\t\treturn path\n\t}\n\treturn filepath.Clean(filepath.Join(base, path))\n}", "func (s *FileSet) Relative(basedir string) (*FileSet, error) {\n\tresult := NewFileSet()\n\tfor f := range s.files {\n\t\trel, err := filepath.Rel(basedir, f)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresult.Add(rel)\n\t}\n\treturn result, nil\n}", "func AddBase(path string) string {\n\treturn fmt.Sprintf(\"%s%s\", baseURL, path)\n}", "func cleanAndExpandPath(path string) string {\n\t// Expand initial ~ to OS specific home directory.\n\tif strings.HasPrefix(path, \"~\") {\n\t\thomeDir := filepath.Dir(defaultHomeDir)\n\t\tpath = strings.Replace(path, \"~\", homeDir, 1)\n\t}\n\n\t// NOTE: The os.ExpandEnv doesn't work with Windows-style %VARIABLE%,\n\t// but the variables can still be expanded via POSIX-style $VARIABLE.\n\treturn filepath.Clean(os.ExpandEnv(path))\n}", "func TestNormalizePaths(t *testing.T) {\n\ttype testNormalizePathsTestCases []struct {\n\t\trefPath string\n\t\tbase string\n\t\texpOutput string\n\t}\n\n\ttestCases := func() testNormalizePathsTestCases {\n\t\ttestCases := testNormalizePathsTestCases{\n\t\t\t{\n\t\t\t\t// http basePath, absolute refPath\n\t\t\t\trefPath: \"http://www.anotherexample.com/another/base/path/swagger.json#/definitions/Pet\",\n\t\t\t\tbase: \"http://www.example.com/base/path/swagger.json\",\n\t\t\t\texpOutput: \"http://www.anotherexample.com/another/base/path/swagger.json#/definitions/Pet\",\n\t\t\t},\n\t\t\t{\n\t\t\t\t// http basePath, relative refPath\n\t\t\t\trefPath: \"another/base/path/swagger.json#/definitions/Pet\",\n\t\t\t\tbase: \"http://www.example.com/base/path/swagger.json\",\n\t\t\t\texpOutput: \"http://www.example.com/base/path/another/base/path/swagger.json#/definitions/Pet\",\n\t\t\t},\n\t\t}\n\t\tif runtime.GOOS == \"windows\" {\n\t\t\ttestCases = append(testCases, testNormalizePathsTestCases{\n\t\t\t\t{\n\t\t\t\t\t// file basePath, absolute refPath, no fragment\n\t\t\t\t\trefPath: `C:\\another\\base\\path.json`,\n\t\t\t\t\tbase: `C:\\base\\path.json`,\n\t\t\t\t\texpOutput: `c:\\another\\base\\path.json`,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t// file basePath, absolute refPath\n\t\t\t\t\trefPath: `C:\\another\\base\\path.json#/definitions/Pet`,\n\t\t\t\t\tbase: `C:\\base\\path.json`,\n\t\t\t\t\texpOutput: `c:\\another\\base\\path.json#/definitions/Pet`,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t// file basePath, relative refPath\n\t\t\t\t\trefPath: `another\\base\\path.json#/definitions/Pet`,\n\t\t\t\t\tbase: `C:\\base\\path.json`,\n\t\t\t\t\texpOutput: `c:\\base\\another\\base\\path.json#/definitions/Pet`,\n\t\t\t\t},\n\t\t\t}...)\n\t\t\treturn testCases\n\t\t}\n\t\t// linux case\n\t\ttestCases = append(testCases, testNormalizePathsTestCases{\n\t\t\t{\n\t\t\t\t// file basePath, absolute refPath, no fragment\n\t\t\t\trefPath: \"/another/base/path.json\",\n\t\t\t\tbase: \"/base/path.json\",\n\t\t\t\texpOutput: \"/another/base/path.json\",\n\t\t\t},\n\t\t\t{\n\t\t\t\t// file basePath, absolute refPath\n\t\t\t\trefPath: \"/another/base/path.json#/definitions/Pet\",\n\t\t\t\tbase: \"/base/path.json\",\n\t\t\t\texpOutput: \"/another/base/path.json#/definitions/Pet\",\n\t\t\t},\n\t\t\t{\n\t\t\t\t// file basePath, relative refPath\n\t\t\t\trefPath: \"another/base/path.json#/definitions/Pet\",\n\t\t\t\tbase: \"/base/path.json\",\n\t\t\t\texpOutput: \"/base/another/base/path.json#/definitions/Pet\",\n\t\t\t},\n\t\t}...)\n\t\treturn testCases\n\t}()\n\n\tfor _, tcase := range testCases {\n\t\tout := normalizePaths(tcase.refPath, tcase.base)\n\t\tassert.Equal(t, tcase.expOutput, out)\n\t}\n}", "func (fs *Bcpfs) Realpath(p string) string {\n\tif !fs.IsServicePath(p) {\n\t\treturn slashpath.Join(\n\t\t\tfs.OrgUnitDir, p,\n\t\t)\n\t}\n\n\t// Path `p` must be a service path.\n\tparts := strings.Split(p, \"/\")\n\tif len(parts) < 2 {\n\t\t// Path too short. Return an empty string to indicate the\n\t\t// problem instead of full error handling, because paths must\n\t\t// not be too short for a valid configuration.\n\t\treturn \"\"\n\t}\n\n\tif fs.IsFacilityPath(p) {\n\t\treturn slashpath.Join(append(\n\t\t\t[]string{fs.ServiceDir}, parts[1:]...,\n\t\t)...)\n\t}\n\n\tou := parts[0]\n\tsrv := parts[1]\n\trest := parts[2:]\n\treturn slashpath.Join(append(\n\t\t[]string{fs.ServiceDir, srv, ou}, rest...,\n\t)...)\n}", "func BaseLocation() (string, error) {\n\tex, err := os.Executable()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"undetermined location of own executable: %s\", err)\n\t}\n\tex = filepath.Dir(ex)\n\t// TODO(yifan): Hardcode the parent dir name for now.\n\tif filepath.Base(ex) != \"installer\" {\n\t\treturn \"\", fmt.Errorf(\"%s executable in unknown location: %s\", filepath.Base(ex), err)\n\t}\n\treturn filepath.Dir(ex), nil\n}", "func Join(path string, dir string) string {\n\treturn filepath.Join(path, dir)\n}", "func (i *IndexBuilder) relativeDir() string {\n\trelativeDir := i.cfg.RelativeDir\n\tif relativeDir == \"/\" {\n\t\treturn relativeDir\n\t}\n\treturn fmt.Sprintf(\"/%s/\", relativeDir)\n}" ]
[ "0.7221674", "0.63791376", "0.62171954", "0.6203149", "0.60714793", "0.6038171", "0.60058975", "0.5962914", "0.58609414", "0.5853772", "0.5846553", "0.58370256", "0.58066094", "0.5787698", "0.5785019", "0.57407224", "0.57359976", "0.5726426", "0.567552", "0.5660976", "0.56590235", "0.56061596", "0.55993736", "0.55941147", "0.55925745", "0.5576248", "0.5519725", "0.54966795", "0.54354846", "0.54190296", "0.54081243", "0.54077625", "0.53518146", "0.5341031", "0.53367716", "0.5329633", "0.52383214", "0.5220128", "0.52199525", "0.52021486", "0.5198822", "0.51884234", "0.51791626", "0.51750875", "0.5169584", "0.5166068", "0.5147754", "0.51468945", "0.5143286", "0.5117156", "0.5101875", "0.50889397", "0.50889397", "0.50805765", "0.50633603", "0.5057555", "0.5054463", "0.5049263", "0.5049263", "0.5048401", "0.50449735", "0.5006407", "0.50039613", "0.5002664", "0.5002664", "0.49951246", "0.49829423", "0.49769446", "0.49735767", "0.49722758", "0.49699867", "0.49688998", "0.49627092", "0.4961851", "0.49589083", "0.4939562", "0.49200332", "0.49150434", "0.49138168", "0.4909202", "0.4898828", "0.4898116", "0.48971283", "0.4892276", "0.48900947", "0.48886743", "0.48690552", "0.48688293", "0.48662126", "0.48630372", "0.48590654", "0.4841772", "0.48317054", "0.48310205", "0.48277768", "0.4821929", "0.4817662", "0.48160127", "0.4814675", "0.48138043" ]
0.79213846
0
isParentPath returns true if path is a child or a descendant of parent path. Both inputs need to be absolute paths.
isParentPath возвращает true, если path является дочерним или потомком parent path. Оба входных параметра должны быть абсолютными путями.
func isParentPath(parent, path string) bool { rel, err := filepath.Rel(parent, path) return err == nil && !strings.HasPrefix(rel, "..") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func pathIsChild(parent, child string) bool {\n\tif !strings.HasPrefix(child, parent) {\n\t\treturn false\n\t}\n\trel := child[len(parent):]\n\trel = strings.Trim(rel, \"/\")\n\treturn !strings.Contains(rel, \"/\")\n}", "func (d *Driver) isParent(id, parent string) bool {\n\t// TODO (maybe): this function is called a lot and does lots of sub-routine calls and I/O.\n\t// One might want to cache parent but should first be confirmed via profiling that really noticable performance cost\n\tlogrus.Debugf(\"secureoverlay2: isParent called w. id: %s, parent: %s\", id, parent)\n\tlowers, err := d.getLowerDirs(id)\n\tif err != nil {\n\t\treturn false\n\t}\n\tif parent == \"\" && len(lowers) > 0 {\n\t\treturn false\n\t}\n\n\tparentDir := d.dir(parent)\n\tvar ld string\n\tif len(lowers) > 0 {\n\t\tld = filepath.Dir(lowers[0])\n\t}\n\tif ld == \"\" && parent == \"\" {\n\t\treturn true\n\t}\n\treturn ld == parentDir\n}", "func IsParentDir(parentDir, childPath string) bool {\n\treturn mgutil.IsParentDir(parentDir, childPath)\n}", "func (p path) hasValidParent() bool {\n\treturn len(p.path) >= 2 && p.parentPath().isValid()\n}", "func isPathChild(a, b []string) bool {\n\t// If b does not have a greater path length than a, it cannot be a child. If\n\t// b has more than one element than a, it must be at least a grandchild.\n\tif len(b) <= len(a) || len(b) > len(a)+1 {\n\t\treturn false\n\t}\n\n\tfor i := range a {\n\t\tif a[i] != b[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (p path) parentPath() *path {\n\treturn &path{p.FolderBranch, p.path[:len(p.path)-1]}\n}", "func (p *path) IsSubPath(path string) bool {\n\thomedir := p.HomeDir()\n\tpath = p.Resolve(path)\n\trel, err := filepath.Rel(homedir, path)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn !strings.Contains(rel, \"..\")\n}", "func (parent *Inode) isParentOf(inode *Inode) bool {\n\treturn inode.Parent != nil && (parent == inode.Parent || parent.isParentOf(inode.Parent))\n}", "func (parent *Inode) isParentOf(inode *Inode) bool {\n\treturn inode.Parent != nil && (parent == inode.Parent || parent.isParentOf(inode.Parent))\n}", "func IsRelativePath(path string) bool {\n\treturn !(types.StartWith(path, \"./\") ||\n\t\ttypes.StartWith(path, \".\\\\\") ||\n\t\ttypes.StartWith(path, \"~/\") ||\n\t\ttypes.StartWith(path, \"~\\\\\") ||\n\t\ttypes.StartWith(path, \"/\") ||\n\t\tIsWindowsRootpath(path))\n}", "func isPath(path string) bool {\n\treturn strings.HasPrefix(path, \"~\") ||\n\t\tstrings.HasPrefix(path, \".\") ||\n\t\tstrings.HasPrefix(path, \"/\")\n}", "func isChild(child, parent string) bool {\n\treturn strings.HasPrefix(child, dirName(parent))\n}", "func (ns *Namespace) CanSetParent(p *Namespace) string {\n\tif p == nil {\n\t\treturn \"\"\n\t}\n\n\t// Simple case\n\tif p == ns {\n\t\treturn fmt.Sprintf(\"%q cannot be set as its own parent\", p.name)\n\t}\n\n\t// Check for cycles; see if the current namespace (the proposed child) is already an ancestor of\n\t// the proposed parent. Start at the end of the ancestry (e.g. at the proposed parent) and work\n\t// our way up to the root.\n\tancestors := p.AncestryNames()\n\tcycle := []string{}\n\tfound := false\n\tfor i := len(ancestors) - 1; !found && i >= 0; i-- {\n\t\tcycle = append(cycle, ancestors[i])\n\t\tfound = (ancestors[i] == ns.name)\n\t}\n\tif found {\n\t\treturn fmt.Sprintf(\"cycle when making %q the parent of %q: current ancestry is %s\",\n\t\t\tp.name, ns.name, strings.Join(cycle, \" -> \"))\n\t}\n\n\treturn \"\"\n}", "func (o *IpamNetworkDataData) HasParentNetworkPath() bool {\n\tif o != nil && o.ParentNetworkPath != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (path PathImpl) Parent() Path {\n\t// path.String() can't be empty\n\tparent, _ := New(path, \"..\")\n\treturn parent\n}", "func (b *Being) IsParentOf(with string) bool {\n\tfor _, id := range b.Children {\n\t\tif id == with {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (e *Entry) parentPath() string {\n\tif len(e.path) == 0 {\n\t\tpanic(\"trying to get the parentPath of the root\")\n\t}\n\tparts := make([]string, 1, len(e.path))\n\tparts[0] = e.root.path\n\tparts = append(parts, e.path[:len(e.path)-1]...)\n\treturn filepath.Join(parts...)\n}", "func isDirectEntryChild(p, c *yang.Entry, compressPaths bool) bool {\n\tppp := strings.Split(p.Path(), \"/\")\n\tcpp := strings.Split(c.Path(), \"/\")\n\tdc := isPathChild(ppp, cpp)\n\n\t// If we are not compressing paths, then directly return whether the child\n\t// is a path of the parent.\n\tif !compressPaths {\n\t\treturn dc\n\t}\n\n\t// If the length of the child path is greater than two larger than the\n\t// parent path, then this means that it cannot be a direct child, since all\n\t// path compression will remove only one level of hierarchy (config/state or\n\t// a surrounding container at maximum). We also check that the length of\n\t// the child path is more specific than or equal to the length of the parent\n\t// path in which case this cannot be a child.\n\tif len(cpp) > len(ppp)+2 || len(cpp) <= len(ppp) {\n\t\treturn false\n\t}\n\n\tif isConfigState(c.Parent) {\n\t\t// If the parent of this entity was the config/state container, then this\n\t\t// level of the hierarchy will have been removed so we check whether the\n\t\t// parent of both are equal and return this.\n\t\treturn p.Path() == c.Parent.Parent.Path()\n\t}\n\n\t// If the child is a list, then we check whether the parent has only one\n\t// child (i.e., is a surrounding container) and then check whether the\n\t// single child is the child we were provided.\n\tif c.IsList() {\n\t\tppe, ok := p.Dir[c.Parent.Name]\n\t\tif !ok {\n\t\t\t// Can't be a valid child because the parent of the entity doesn't exist\n\t\t\t// within this container.\n\t\t\treturn false\n\t\t}\n\t\tif !hasOnlyChild(ppe) {\n\t\t\treturn false\n\t\t}\n\n\t\t// We are guaranteed to have 1 child (and not zero) since hasOnlyChild will\n\t\t// return false for directories with 0 children.\n\t\treturn children(ppe)[0].Path() == c.Path()\n\t}\n\n\treturn dc\n}", "func (p *Path) Parent() (*Path, error) {\n\tpth, err := p.Absolute()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"get parent failed\")\n\t}\n\tdir := filepath.Dir(pth.Path)\n\tnewP := New(dir)\n\treturn newP, nil\n}", "func (n *Node) ParentPath() string {\n\treturn n.lu.InternalPath(n.SpaceID, n.ParentID)\n}", "func IsSubPathFolder(path string, paths []string) (bool, error) {\n\tfound := false\n\tfor _, sync := range paths {\n\t\trel, err := filepath.Rel(sync, path)\n\t\tif err != nil {\n\t\t\tlog.Debugf(\"error making rel '%s' and '%s'\", sync, path)\n\t\t\treturn false, errors.Wrap(err, \"\")\n\t\t}\n\t\tif strings.HasPrefix(rel, \"..\") {\n\t\t\tcontinue\n\t\t}\n\t\tfound = true\n\t\tif rel != \".\" {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\tif found {\n\t\treturn false, nil\n\t}\n\treturn false, errors.New(\"not found\")\n}", "func HasParent() predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(ParentTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, ParentTable, ParentColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t},\n\t)\n}", "func TestIsSubpath(t *testing.T) {\n\ttcs := []struct {\n\t\t// Two absolute paths.\n\t\tpathA string\n\t\tpathB string\n\n\t\t// Whether pathA is a subpath of pathB.\n\t\twantIsSubpath bool\n\n\t\t// Relative path from pathA to pathB. Only checked if\n\t\t// wantIsSubpath is true.\n\t\twantRelpath string\n\t}{\n\t\t{\n\t\t\tpathA: \"/foo/bar/baz\",\n\t\t\tpathB: \"/foo\",\n\t\t\twantIsSubpath: true,\n\t\t\twantRelpath: \"bar/baz\",\n\t\t},\n\t\t{\n\t\t\tpathA: \"/foo\",\n\t\t\tpathB: \"/foo/bar/baz\",\n\t\t\twantIsSubpath: false,\n\t\t},\n\t\t{\n\t\t\tpathA: \"/foo\",\n\t\t\tpathB: \"/foo\",\n\t\t\twantIsSubpath: false,\n\t\t},\n\t\t{\n\t\t\tpathA: \"/foobar\",\n\t\t\tpathB: \"/foo\",\n\t\t\twantIsSubpath: false,\n\t\t},\n\t\t{\n\t\t\tpathA: \"/foo\",\n\t\t\tpathB: \"/foobar\",\n\t\t\twantIsSubpath: false,\n\t\t},\n\t\t{\n\t\t\tpathA: \"/foo\",\n\t\t\tpathB: \"/foobar\",\n\t\t\twantIsSubpath: false,\n\t\t},\n\t\t{\n\t\t\tpathA: \"/\",\n\t\t\tpathB: \"/foo\",\n\t\t\twantIsSubpath: false,\n\t\t},\n\t\t{\n\t\t\tpathA: \"/foo\",\n\t\t\tpathB: \"/\",\n\t\t\twantIsSubpath: true,\n\t\t\twantRelpath: \"foo\",\n\t\t},\n\t\t{\n\t\t\tpathA: \"/foo/bar/../bar\",\n\t\t\tpathB: \"/foo\",\n\t\t\twantIsSubpath: true,\n\t\t\twantRelpath: \"bar\",\n\t\t},\n\t\t{\n\t\t\tpathA: \"/foo/bar\",\n\t\t\tpathB: \"/foo/../foo\",\n\t\t\twantIsSubpath: true,\n\t\t\twantRelpath: \"bar\",\n\t\t},\n\t}\n\n\tfor _, tc := range tcs {\n\t\tgotRelpath, gotIsSubpath := IsSubpath(tc.pathA, tc.pathB)\n\t\tif gotRelpath != tc.wantRelpath || gotIsSubpath != tc.wantIsSubpath {\n\t\t\tt.Errorf(\"IsSubpath(%q, %q) got %q %t, want %q %t\", tc.pathA, tc.pathB, gotRelpath, gotIsSubpath, tc.wantRelpath, tc.wantIsSubpath)\n\t\t}\n\t}\n}", "func isFsCgroupParent(groupPath string) bool {\n\tfi, err := os.Lstat(filepath.Join(groupPath, \"docker\"))\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn fi.IsDir()\n}", "func inParent() bool {\n\treturn !inChild()\n}", "func (command PathCommand) IsRelative() bool {\n\tswitch command {\n\tcase MoveToRelative, LineToRelative:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n\tpanic(\"Not reachable\")\n}", "func (g *gnmiPath) isPathElemPath() bool {\n\treturn g.pathElemPath != nil\n}", "func (fe *FileEntry) HasParent(parent *FileEntry) bool {\n\t// Exceptional case\n\tif fe.Inode == fuseops.RootInodeID {\n\t\treturn false\n\t}\n\tif parent.File == nil {\n\t\treturn fe.HasParentID(\"\")\n\t}\n\treturn fe.HasParentID(parent.File.ID)\n}", "func (node *Node) MatchesPath(path string) bool {\n\tif path == \"\" {\n\t\treturn true\n\t}\n\n\tsplit := strings.Split(path, \"/\")\n\tcurrent := split[len(split)-1]\n\tdirectChild := strings.HasPrefix(current, \".\")\n\tcurrent = strings.TrimPrefix(current, \".\")\n\n\tif len(split) == 1 {\n\t\treturn current == node.Data\n\t} else if current != node.Data {\n\t\treturn false\n\t}\n\n\tnewPath := strings.Join(split[:len(split)-1], \"/\")\n\n\tif directChild == true {\n\t\treturn node.Parent.MatchesPath(newPath)\n\t}\n\n\tparentName := strings.TrimPrefix(split[len(split)-2], \".\")\n\tparent := node.FindTagReverse(parentName)\n\n\tif parent != nil {\n\t\treturn parent.MatchesPath(newPath)\n\t}\n\n\treturn false\n}", "func isAbsolutePath(path string) bool {\n\treturn strings.HasPrefix(path, \"/\")\n}", "func imageIsParent(store storage.Store, topLayer string) (bool, error) {\n\tchildren, err := getChildren(store, topLayer)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn len(children) > 0, nil\n}", "func (n *TreeNode) HasParent() bool {\n\treturn n.parent != nil && n.parent.Runs() > 0\n}", "func (d *Distro) IsParent(s *evergreen.Settings) bool {\n\tif s == nil {\n\t\tvar err error\n\t\ts, err = evergreen.GetConfig()\n\t\tif err != nil {\n\t\t\tgrip.Critical(\"error retrieving settings object\")\n\t\t\treturn false\n\t\t}\n\t}\n\tfor _, p := range s.ContainerPools.Pools {\n\t\tif d.Id == p.Distro {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (d *Distro) IsParent(s *evergreen.Settings) bool {\n\tif s == nil {\n\t\tvar err error\n\t\ts, err = evergreen.GetConfig()\n\t\tif err != nil {\n\t\t\tgrip.Critical(\"error retrieving settings object\")\n\t\t\treturn false\n\t\t}\n\t}\n\tfor _, p := range s.ContainerPools.Pools {\n\t\tif d.Id == p.Distro {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (fe *FileEntry) HasParentID(parentID string) bool {\n\t// Exceptional case\n\tif fe.Inode == fuseops.RootInodeID {\n\t\treturn false\n\t}\n\tif parentID == \"\" {\n\t\tif fe.File == nil || len(fe.File.Parents) == 0 { // We are looking in root\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\tif fe.File == nil { // Case gid is not empty and GFile is null\n\t\treturn false\n\t}\n\tfor _, pgid := range fe.File.Parents {\n\t\tif pgid == parentID {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (me TdtypeType) IsPath() bool { return me.String() == \"path\" }", "func isPathy(name string) bool {\n\treturn strings.Contains(name, string(filepath.Separator))\n}", "func (o *FileObject) HasParent() bool {\n\treturn o.Parent != nil\n}", "func (d UserData) HasParent() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Parent\", \"parent_id\"))\n}", "func (e DecodeErr) IsPlaceParent(p string) bool {\r\n\treturn e.Place.Parent == p\r\n}", "func IsRootPath(path string) bool {\n\tif l := len(path); l > 0 {\n\t\tswitch OperateSystem() {\n\t\tcase WINDOWS:\n\t\t\treturn IsWindowsRootpath(path)\n\t\tcase LINUX, DARWIN, FREEBSD, SOLARIS, ANDROID:\n\t\t\treturn l == 1 && path[0] == '/'\n\t\t}\n\t}\n\treturn false\n}", "func isParentMetaExist(path string) (bool, error) {\n\n\t_, err := os.Stat(path)\n\tif err == nil { return true, nil }\n\tif os.IsNotExist(err) { return false, nil }\n\treturn true, err\n}", "func HasParentWith(preds ...predicate.Location) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(Table, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, ParentTable, ParentColumn),\n\t\t)\n\t\tsqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {\n\t\t\tfor _, p := range preds {\n\t\t\t\tp(s)\n\t\t\t}\n\t\t})\n\t},\n\t)\n}", "func (o *IpamNetworkDataData) GetParentNetworkPathOk() (*string, bool) {\n\tif o == nil || o.ParentNetworkPath == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ParentNetworkPath, true\n}", "func (r *Root) ParentByPath(c *web.Client, origin Parent, path Path) (p Parent, base string, err error) {\n\tdir := path.Dir()\n\tlogger.Debug1(\"dir: %v\", dir)\n\to, err := r.ObjectByPath(c, origin, path.Dir())\n\tif err != nil {\n\t\treturn nil, \"\", errors.Errorf(\n\t\t\t\"failed to get parent directory %q of path %q: %v\",\n\t\t\tdir, path, err)\n\t}\n\tp, ok := o.(Parent)\n\tif !ok {\n\t\treturn nil, \"\", errors.Errorf(\n\t\t\t\"object %v exists but is not a parent\", path)\n\t}\n\treturn p, Basename(path), nil\n}", "func (state *BuildState) IsOriginalTargetOrParent(target *BuildTarget) bool {\n\tif state.IsOriginalTarget(target) {\n\t\treturn true\n\t} else if parent := target.Parent(state.Graph); parent != nil {\n\t\treturn state.IsOriginalTarget(parent)\n\t}\n\treturn false\n}", "func (c char) isPathStart() bool {\n\treturn (c.isCorner() || c.isHorizontal() || c.isVertical() || c.isArrowHorizontalLeft() || c.isArrowVerticalUp() || c.isDiagonal()) && !c.isTick() && !c.isDot()\n}", "func (o *IpamNetworkDataData) SetParentNetworkPath(v string) {\n\to.ParentNetworkPath = &v\n}", "func (code Code) checkCodePath() error {\n\tpaths := strings.Split(code.codeStr.String(), \".\")\n\tif len(paths) == 1 {\n\t\treturn nil\n\t}\n\tif code.Parent == nil {\n\t\tif len(paths) > 1 {\n\t\t\treturn fmt.Errorf(\"expected no parent paths: %#v\", code.codeStr)\n\t\t}\n\t} else {\n\t\tparent := *code.Parent\n\t\tparentPath := paths[len(paths)-2]\n\t\tif parentPath != parent.codeStr.String() {\n\t\t\treturn fmt.Errorf(\"got %#v but expected a path to parent %#v for %#v\", parentPath, parent.codeStr, code.codeStr)\n\t\t}\n\t}\n\treturn nil\n}", "func HasParent() predicate.OutcomeOverview {\n\treturn predicate.OutcomeOverview(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(ParentTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, ParentTable, ParentColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "func (obj *errorStruct) HasParent() bool {\n\treturn obj.parent != nil\n}", "func (t Task) IsChild() bool {\n\treturn t.Parent != 0\n}", "func isFilePath(path string) bool {\n\t// when split returns dir and file, splitting path on the final \"/\"\n\t// check if file is not empty to classify that path as a file path\n\t_, file := filepath.Split(path)\n\tif len(file) == 0 {\n\t\treturn false\n\t}\n\treturn true\n}", "func isPathPrefix(path, pre string) bool {\n\tpathlen, prflen := len(path), len(pre)\n\tif pathlen < prflen || path[0:prflen] != pre {\n\t\treturn false\n\t}\n\n\treturn prflen == pathlen || strings.Index(path[prflen:], \"/\") == 0\n}", "func IsAbsPath(aPath string) bool {\n\treturn path.IsAbs(aPath)\n}", "func ParentsFilter(path string) FilterFunc {\n\treturn func(m *MountInfo) (bool, bool) {\n\t\tskip := !strings.HasPrefix(path, m.MountPoint)\n\t\treturn skip, false\n\t}\n}", "func (db *PSQL) IsOrganizationParent(organizationID string) (bool, string, error) {\n\treturn false, \"\", nil\n}", "func createParentPath(path string, conn *zk.Conn, acl []zk.ACL) error {\n\tparts := strings.Split(path, \"/\")\n\tprePath := \"\"\n\tfor _, p := range parts[1 : len(parts)-1] {\n\t\tprePath += \"/\" + p\n\t\t_, err := conn.Create(prePath, []byte{}, 0, acl)\n\t\tif err != nil && err != zk.ErrNodeExists {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (d UserData) HasParentName() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"ParentName\", \"parent_name\"))\n}", "func (s *Store) hasParent() bool {\r\n\treturn s.parent != nil\r\n}", "func isPathType(folderName string) bool {\n\tlastCharacter := folderName[len(folderName)-1]\n\tif os.IsPathSeparator(lastCharacter) {\n\t\treturn true\n\t}\n\treturn false\n}", "func (n *BaseNode) ParentIsStopped(m NodeMetadata) {\n\tn.m.Lock()\n\tdefer n.m.Unlock()\n\tif _, ok := n.parents[m.Name]; !ok {\n\t\treturn\n\t}\n\tdelete(n.parentsStarted, m.Name)\n\tif len(n.parentsStarted) == 0 && (n.o.AutoStop == nil || n.o.AutoStop.WhenAllParentsAreStopped) {\n\t\tn.Stop()\n\t}\n}", "func (pp packagePath) IsAbs() bool {\n\tfirstSlash := strings.IndexRune(string(pp), '/')\n\tvar firstPart string\n\tswitch {\n\tcase firstSlash == -1:\n\t\tfirstPart = string(pp)\n\tdefault:\n\t\tfirstPart = string(pp)[:firstSlash]\n\t}\n\n\treturn firstPart != \".\" && firstPart != \"..\"\n}", "func (b *Being) IsCloseRelativeOf(with string) bool {\n\tclose := false\n\tclose = close || b.IsChildOf(with)\n\tclose = close || b.IsParentOf(with)\n\tclose = close || b.IsSiblingOf(with)\n\treturn close\n}", "func PathInPackage(path, pkg string) bool {\n\treturn strings.Contains(path, \"/\"+pkg+\"/\") || strings.HasPrefix(path, pkg+\"/\")\n}", "func (p path) isValid() bool {\n\tif len(p.path) < 1 {\n\t\treturn false\n\t}\n\n\tfor _, n := range p.path {\n\t\tif !n.isValid() {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func HasParent() predicate.BaselineClass {\n\treturn predicate.BaselineClass(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(ParentTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, ParentTable, ParentColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "func (mounter *Mounter) PathIsDevice(pathname string) (bool, error) {\n\treturn pathIsDevice(pathname)\n}", "func isSamePath(a string, b string) bool {\n\treturn strings.TrimRight(a, \"/\") == strings.TrimRight(b, \"/\")\n}", "func (node *GoValueNode) HasParent() bool {\n\n\treturn node.parentNode != nil\n}", "func isAbs(path string) bool {\n\treturn filepath.IsAbs(path) || strings.HasPrefix(path, string(separator))\n}", "func hasPathPrefix(path, prefix string) bool {\n\tsep := string(filepath.Separator)\n\tpathParts := strings.Split(filepath.Clean(path), sep)\n\tprefixParts := strings.Split(filepath.Clean(prefix), sep)\n\n\tif len(prefixParts) > len(pathParts) {\n\t\treturn false\n\t}\n\tfor index, prefixItem := range prefixParts {\n\t\tif prefixItem != pathParts[index] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func HasParent() predicate.BaselineMeasureDenom {\n\treturn predicate.BaselineMeasureDenom(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(ParentTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, ParentTable, ParentColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "func pathIsLess(ctx context.Context, nbf *types.NomsBinFormat, p1, p2 types.Path) (bool, error) {\n\tfor i, pp1 := range p1 {\n\t\tif len(p2) == i {\n\t\t\treturn false, nil // p1 > p2\n\t\t}\n\n\t\tidx, err := pathPartCompare(ctx, nbf, pp1, p2[i])\n\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tswitch idx {\n\t\tcase -1:\n\t\t\treturn true, nil // p1 < p2\n\t\tcase 1:\n\t\t\treturn false, nil // p1 > p2\n\t\t}\n\t}\n\n\treturn len(p2) > len(p1), nil // if true p1 < p2, else p1 == p2\n}", "func (n *BaseNode) ParentIsStarted(m NodeMetadata) {\n\tn.m.Lock()\n\tdefer n.m.Unlock()\n\tif _, ok := n.parents[m.Name]; !ok {\n\t\treturn\n\t}\n\tn.parentsStarted[m.Name] = true\n}", "func IsObjectPath(path string) bool {\n\t//TODO add support for domain style paths when the domain support is going to be merged\n\tparts := strings.SplitN(strings.Trim(path, \"/\"), \"/\", 2)\n\treturn len(parts) == 2 && parts[1] != \"\"\n}", "func (p *Path) IsAbs() bool {\n\treturn filepath.IsAbs(p.Path)\n}", "func HasParent() predicate.ResultsDefinition {\n\treturn predicate.ResultsDefinition(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(ParentTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, true, ParentTable, ParentColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "func isRoot(path string) bool {\n\tif runtime.GOOS != \"windows\" {\n\t\treturn path == \"/\"\n\t}\n\tswitch len(path) {\n\tcase 1:\n\t\treturn os.IsPathSeparator(path[0])\n\tcase 3:\n\t\treturn path[1] == ':' && os.IsPathSeparator(path[2])\n\t}\n\treturn false\n}", "func (o *TenantWithOfferWeb) HasParentId() bool {\n\tif o != nil && o.ParentId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (iter *Iteration) isValidFilepath(path string) bool {\n\tif iter == nil {\n\t\treturn false\n\t}\n\treturn strings.HasPrefix(strings.ToLower(path), strings.ToLower(iter.Dir))\n}", "func (s *Store) SetParent(parent *Store) bool {\r\n\thasParent := s.hasParent()\r\n\ts.parent = parent\r\n\treturn hasParent\r\n}", "func (v *Service) IsSetParentID() bool {\n\treturn v != nil && v.ParentID != nil\n}", "func PathIsInDir(p, dir string) bool {\n\tp = filepath.Clean(p)\n\tdir = filepath.Clean(dir)\n\treturn p == dir || strings.HasPrefix(p, dir+string(filepath.Separator))\n}", "func pathPrefix(s, sub string) bool {\r\n\t// strings.HasPrefix is necessary but not sufficient.\r\n\tif !strings.HasPrefix(s, sub) {\r\n\t\treturn false\r\n\t}\r\n\t// The remainder after the prefix must either be empty or start with a slash.\r\n\trem := s[len(sub):]\r\n\treturn rem == \"\" || rem[0] == '/'\r\n}", "func (p path) ChildPath(name string, ptr BlockPointer) path {\n\tchild := path{\n\t\tFolderBranch: p.FolderBranch,\n\t\tpath: make([]pathNode, len(p.path), len(p.path)+1),\n\t}\n\tcopy(child.path, p.path)\n\tchild.path = append(child.path, pathNode{Name: name, BlockPointer: ptr})\n\treturn child\n}", "func containsPathPrefix(pats []string, s string) bool {\n\tfor _, pat := range pats {\n\t\tif pat == s || strings.HasPrefix(s, pat+\"/\") {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func pathLess(first, second string) bool {\n\t// Handle trivial cases first.\n\tif first == second {\n\t\treturn false\n\t} else if first == \"\" {\n\t\treturn true\n\t} else if second == \"\" {\n\t\treturn false\n\t}\n\n\t// Compare the path components. We work hard to avoid allocations here since\n\t// this is a comparison function for sorting algorithms.\n\tfor {\n\t\t// Extract the front path component from the first path.\n\t\tfirstFirstSlashIndex := strings.IndexByte(first, '/')\n\t\tvar firstFrontComponent string\n\t\tif firstFirstSlashIndex == -1 {\n\t\t\tfirstFrontComponent = first\n\t\t} else {\n\t\t\tfirstFrontComponent = first[:firstFirstSlashIndex]\n\t\t}\n\n\t\t// Extract the front path component from the second path.\n\t\tsecondFirstSlashIndex := strings.IndexByte(second, '/')\n\t\tvar secondFrontComponent string\n\t\tif secondFirstSlashIndex == -1 {\n\t\t\tsecondFrontComponent = second\n\t\t} else {\n\t\t\tsecondFrontComponent = second[:secondFirstSlashIndex]\n\t\t}\n\n\t\t// Compare the front path components.\n\t\tif firstFrontComponent < secondFrontComponent {\n\t\t\treturn true\n\t\t} else if secondFrontComponent < firstFrontComponent {\n\t\t\treturn false\n\t\t}\n\n\t\t// The front path components are equal. If either path has no remaining\n\t\t// components, then the comparison is complete, otherwise we move ahead\n\t\t// to the next path components. Note that we don't have to consider the\n\t\t// case where firstFirstSlashIndex and secondFirstSlashIndex are both -1\n\t\t// (with front components also equal) because that would mean the\n\t\t// strings were entirely equal, which we handle above.\n\t\tif firstFirstSlashIndex == -1 {\n\t\t\treturn true\n\t\t} else if secondFirstSlashIndex == -1 {\n\t\t\treturn false\n\t\t} else {\n\t\t\tfirst = first[firstFirstSlashIndex+1:]\n\t\t\tsecond = second[secondFirstSlashIndex+1:]\n\t\t}\n\t}\n}", "func (v *IADs) Parent() (path string, err error) {\n\tvar bstr *int16\n\thr, _, _ := syscall.Syscall(\n\t\tuintptr(v.VTable().Parent),\n\t\t2,\n\t\tuintptr(unsafe.Pointer(v)),\n\t\tuintptr(unsafe.Pointer(&bstr)),\n\t\t0)\n\tif bstr != nil {\n\t\tdefer ole.SysFreeString(bstr)\n\t}\n\tif hr == 0 {\n\t\tpath = ole.BstrToString((*uint16)(unsafe.Pointer(bstr)))\n\t} else {\n\t\treturn \"\", convertHresultToError(hr)\n\t}\n\treturn\n}", "func (l *fileLoader) IsAbsPath(root string, location string) bool {\n\tfullFilePath, err := l.fullLocation(root, location)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn filepath.IsAbs(fullFilePath)\n}", "func IsGoListPath(path string) bool {\n\treturn strings.HasPrefix(path, \"./\") || strings.HasPrefix(path, \"../\") ||\n\t\tstrings.Contains(path, \"...\")\n}", "func HasParentWith(preds ...predicate.OutcomeMeasure) predicate.OutcomeOverview {\n\treturn predicate.OutcomeOverview(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(ParentInverseTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, ParentTable, ParentColumn),\n\t\t)\n\t\tsqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {\n\t\t\tfor _, p := range preds {\n\t\t\t\tp(s)\n\t\t\t}\n\t\t})\n\t})\n}", "func ValidPath(path string) bool {\n\tfor _, validStart := range []string{\".\", \"..\", \"/\"} {\n\t\tif strings.HasPrefix(path, validStart) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (d *gcpVolDriver) isPathExist(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "func dp_isSubPath(cur *ListNode,root *TreeNode)bool{\n\tif cur == nil{\n\t\treturn true\n\t}\n\tif root == nil{\n\t\treturn false\n\t}\n\treturn cur.Val == root.Val && (dp_isSubPath(cur.Next,root.Left) || dp_isSubPath(cur.Next,root.Right))\n}", "func (o *GstObj) SetParent(p *GstObj) bool {\n\treturn C.gst_object_set_parent(o.g(), p.g()) != 0\n}", "func (util copyHandlerUtil) isPathALocalDirectory(pathString string) bool {\n\t// check if path exists\n\tdestinationInfo, err := os.Stat(pathString)\n\n\tif err == nil && destinationInfo.IsDir() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func setParentLink(parentCtx context.Context, childSpan *trace.Span) bool {\n\tparentSpanFromRPC := trace.FromContext(parentCtx)\n\tif parentSpanFromRPC == nil {\n\t\treturn false\n\t}\n\n\tpsc := parentSpanFromRPC.SpanContext()\n\tchildSpan.AddLink(trace.Link{\n\t\tSpanID: psc.SpanID,\n\t\tTraceID: psc.TraceID,\n\t\tType: trace.LinkTypeParent,\n\t})\n\treturn true\n}", "func (jdcb jobDirectoryContentsBatch) ParentNodePath() string {\n\treturn jdcb.parentPath\n}", "func isDirectoryPath(path string) bool {\n\tif !strings.Contains(path, \"*\") && strings.HasSuffix(path, \"/\") {\n\t\treturn true\n\t}\n\treturn false\n}" ]
[ "0.6913496", "0.6632338", "0.6614952", "0.6239509", "0.6065598", "0.6004529", "0.599899", "0.5987033", "0.5987033", "0.57555145", "0.5745408", "0.5715766", "0.56958073", "0.5602596", "0.5588836", "0.5535407", "0.5507737", "0.5400315", "0.5310334", "0.5297292", "0.52722096", "0.5269148", "0.526685", "0.52647334", "0.524701", "0.5224529", "0.5196813", "0.5185235", "0.51671845", "0.5162426", "0.51325166", "0.51165724", "0.50837624", "0.50837624", "0.50652903", "0.5054442", "0.50522584", "0.50353765", "0.503217", "0.49977908", "0.4982533", "0.49795997", "0.49721968", "0.4965631", "0.49580175", "0.4956799", "0.49560985", "0.49404234", "0.49336535", "0.49294898", "0.49219668", "0.4913758", "0.4912991", "0.4912731", "0.49040195", "0.48677194", "0.48585084", "0.48516062", "0.4844233", "0.48434138", "0.48138654", "0.48073086", "0.47996464", "0.4785012", "0.47795948", "0.4776879", "0.4774271", "0.47484297", "0.47433716", "0.47222254", "0.4718136", "0.47039247", "0.46479088", "0.46444938", "0.46440494", "0.46410838", "0.4631394", "0.4627184", "0.46200424", "0.461645", "0.46162665", "0.46139827", "0.46111706", "0.46096426", "0.45992467", "0.45931524", "0.45822924", "0.45800242", "0.4578777", "0.45776996", "0.4575818", "0.45734167", "0.45691913", "0.4567889", "0.45585373", "0.45533827", "0.4552875", "0.45498258", "0.45454574", "0.4526122" ]
0.78000367
0
GetOcJusticeTerminalCase invokes the dt_oc_info.GetOcJusticeTerminalCase API synchronously
GetOcJusticeTerminalCase вызывает API dt_oc_info.GetOcJusticeTerminalCase синхронно
func (client *Client) GetOcJusticeTerminalCase(request *GetOcJusticeTerminalCaseRequest) (response *GetOcJusticeTerminalCaseResponse, err error) { response = CreateGetOcJusticeTerminalCaseResponse() err = client.DoAction(request, response) return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *Client) GetOcJusticeTerminalCaseWithCallback(request *GetOcJusticeTerminalCaseRequest, callback func(response *GetOcJusticeTerminalCaseResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetOcJusticeTerminalCaseResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetOcJusticeTerminalCase(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) GetOcJusticeTerminalCaseWithChan(request *GetOcJusticeTerminalCaseRequest) (<-chan *GetOcJusticeTerminalCaseResponse, <-chan error) {\n\tresponseChan := make(chan *GetOcJusticeTerminalCaseResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.GetOcJusticeTerminalCase(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func CreateGetOcJusticeTerminalCaseRequest() (request *GetOcJusticeTerminalCaseRequest) {\n\trequest = &GetOcJusticeTerminalCaseRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"dt-oc-info\", \"2022-08-29\", \"GetOcJusticeTerminalCase\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "func CreateGetOcJusticeTerminalCaseResponse() (response *GetOcJusticeTerminalCaseResponse) {\n\tresponse = &GetOcJusticeTerminalCaseResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (b *OGame) GetCelestial(v any) (Celestial, error) {\n\treturn b.WithPriority(taskRunner.Normal).GetCelestial(v)\n}", "func (client IdentityClient) getCompartment(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/compartments/{compartmentId}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response GetCompartmentResponse\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\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func (d *Dao) CaseObtainMID(c context.Context, mid int64, isToday bool) (cases map[int64]*model.SimCase, err error) {\n\tconn := d.redis.Get(c)\n\tdefer conn.Close()\n\tvar _setKey string\n\tif isToday {\n\t\t_setKey = caseVoteCIDMIDKey(mid)\n\t} else {\n\t\t_setKey = caseObtainMIDKey(mid)\n\t}\n\tvar ms []string\n\tif ms, err = redis.Strings(conn.Do(\"SMEMBERS\", _setKey)); err != nil {\n\t\tif err != redis.ErrNil {\n\t\t\treturn\n\t\t}\n\t\terr = nil\n\t}\n\tcases = make(map[int64]*model.SimCase)\n\tfor _, s := range ms {\n\t\tif s == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tsc := &model.SimCase{}\n\t\tif err = json.Unmarshal([]byte(s), sc); err != nil {\n\t\t\terr = errors.WithStack(err)\n\t\t\treturn\n\t\t}\n\t\tcases[sc.ID] = sc\n\t}\n\treturn\n}", "func (client IdentityClient) GetCompartment(ctx context.Context, request GetCompartmentRequest) (response GetCompartmentResponse, 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.getCompartment, 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 = GetCompartmentResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = GetCompartmentResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(GetCompartmentResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into GetCompartmentResponse\")\n\t}\n\treturn\n}", "func CustomerGetoneVehicleforview(w http.ResponseWriter, r *http.Request) {\n\tvehicle := services.GetOneVehicle(r)\n\tcusttpl.ExecuteTemplate(w, \"viewvehicle.html\", vehicle)\n}", "func GetTrafficOpsCookie(cdnUri, user, pass string) (string, error) {\n\turi := cdnUri + `/api/1.2/user/login`\n\tpostdata := `{\"u\":\"` + user + `\", \"p\":\"` + pass + `\"}`\n\treq, err := http.NewRequest(\"POST\", uri, strings.NewReader(postdata))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treq.Header.Add(\"Accept\", \"application/json\")\n\n\tclient := getClient()\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\n\tfor _, cookie := range resp.Cookies() {\n\t\tif cookie.Name == `mojolicious` {\n\t\t\treturn cookie.Value, nil\n\t\t}\n\t}\n\n\tdata, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn \"\", errors.New(\"No login cookie received: \" + string(data))\n}", "func (h *Handler) RetrieveCertificate(companyChainID string, uuid string) (*entityApi.TransactionWrapper, error) {\n apiResponse, err := h.apiClient.Get(fmt.Sprintf(certificateRoute, companyChainID, uuid), nil)\n if err != nil {\n return nil, err\n }\n var transactionWrapper entityApi.TransactionWrapper\n if err := unmarshalApiResponse(apiResponse, &transactionWrapper); err != nil {\n return nil, err\n }\n return &transactionWrapper, nil\n}", "func (term *Terminology) ReadV2toSNOMEDCT(ctx context.Context, id *apiv1.Identifier, f func(*apiv1.Identifier) error) error {\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\tresponse, err := term.client.FromCrossMap(ctx, &snomed.TranslateFromRequest{S: id.GetValue(), RefsetId: 900000000000497000})\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(response.GetTranslations()) == 0 {\n\t\tlog.Printf(\"no translations found for map from '%s:%s' to '%s'\", id.GetSystem(), id.GetValue(), identifiers.SNOMEDCT)\n\t}\n\tfor _, t := range response.GetTranslations() {\n\t\tref := t.GetReferenceSetItem().GetReferencedComponentId()\n\t\tif err := f(&apiv1.Identifier{System: identifiers.SNOMEDCT, Value: strconv.FormatInt(ref, 10)}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func TestGetCabTripCtrl(t *testing.T) {\n\tmodel.MongoDBConnect()\n\tdefer model.MongoConnectionClose()\n\tConvey(\"GetCabTripCtrl\", func() {\n\t\treq, err := http.NewRequest(\"GET\", \"/api/cab/id3004672/date/2016-06-30?fresh=1\", nil)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tw := httptest.NewRecorder()\n\n\t\tConvey(\"Normal: 1 cab\", func() {\n\n\t\t\tcabapi.GetCabTripCtrl(w, req)\n\n\t\t\tSo(w.Code, ShouldEqual, http.StatusOK)\n\t\t\tresult, _ := ioutil.ReadAll(w.Result().Body)\n\t\t\texpct := \"id3004672 in 2016-06-30:3\"\n\t\t\tSo(result, ShouldEqual, expct)\n\t\t})\n\n\n\t})\n}", "func GetClinicDoctors(c *gin.Context) {\n\tlog.Infof(\"Get all doctors registered with specific physical clinic\")\n\taddressID := c.Param(\"addressId\")\n\tif addressID == \"\" {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusBadRequest,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: \"clinic address id not provided\",\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\tctx := c.Request.Context()\n\tuserEmail, userID, gproject, err := getUserDetails(ctx, c.Request)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: err.Error(),\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\tctx, span := trace.StartSpan(ctx, \"Get all doctors registered for a clinic\")\n\tdefer span.End()\n\tclinicMetaDB := datastoredb.NewClinicMetaHandler()\n\terr = clinicMetaDB.InitializeDataBase(ctx, gproject)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: err.Error(),\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\tregisteredDoctors, err := clinicMetaDB.GetClinicDoctors(ctx, userEmail, userID, addressID)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: err.Error(),\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, gin.H{\n\t\tconstants.RESPONSE_JSON_DATA: registeredDoctors,\n\t\tconstants.RESPONSDE_JSON_ERROR: nil,\n\t})\n\tclinicMetaDB.Close()\n}", "func GetIncident(c *gin.Context) {\n\tvar err error\n\tvar output *incident.Incident\n\tvar incidentID int64\n\tvar taskID int64\n\tincidentID, err = strconv.ParseInt(c.Param(\"incidentId\"), 10, 64)\n\tctx, _ := authcontext.NewAuthContext(c)\n\n\tif taskID, err = strconv.ParseInt(c.Param(\"taskId\"), 10, 64); err == nil {\n\t\tif output, err = incident.GetByID(ctx, taskID, incidentID); err == nil {\n\t\t\tc.JSON(http.StatusOK, output)\n\t\t}\n\t}\n\n\tif err != nil {\n\t\tc.JSON(http.StatusPreconditionFailed, ResponseObject{\"error\": err.Error()})\n\t}\n}", "func GetCharacterModel(w http.ResponseWriter, req *http.Request) {\n\n\t// Get session values or redirect to Login\n\tsession, err := sessions.Store.Get(req, \"session\")\n\n\tif err != nil {\n\t\tlog.Println(\"error identifying session\")\n\t\thttp.Redirect(w, req, \"/login/\", http.StatusFound)\n\t\treturn\n\t\t// in case of error\n\t}\n\n\t// Prep for user authentication\n\tsessionMap := getUserSessionValues(session)\n\n\tusername := sessionMap[\"username\"]\n\tloggedIn := sessionMap[\"loggedin\"]\n\tisAdmin := sessionMap[\"isAdmin\"]\n\n\tfmt.Println(loggedIn, isAdmin, username)\n\n\tfmt.Println(session)\n\n\t/*\n\t\tif username == \"\" {\n\t\t\thttp.Redirect(w, req, \"/\", http.StatusFound)\n\t\t\treturn\n\t\t}\n\t*/\n\n\tvars := mux.Vars(req)\n\tidString := vars[\"id\"]\n\n\tpk, err := strconv.Atoi(idString)\n\tif err != nil {\n\t\tpk = 0\n\t\tlog.Println(err)\n\t}\n\n\tcm, err := database.PKLoadCharacterModel(db, int64(pk))\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tjson.NewEncoder(w).Encode(cm)\n}", "func (client *Client) GetOpenNLU(request *GetOpenNLURequest) (response *GetOpenNLUResponse, err error) {\n\tresponse = CreateGetOpenNLUResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func (r Virtual_Guest) GetOpenCancellationTicket() (resp datatypes.Ticket, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest\", \"getOpenCancellationTicket\", nil, &r.Options, &resp)\n\treturn\n}", "func (ovscni *OvsCni) HandleCni(d *render.RenderData) error {\n\n\t//For VlanType=trunk we do not need to do anything\n\tswitch ovscni.VlanType {\n\tcase \"access\":\n\t\tif len(ovscni.L2srvResources) != 1 {\n\t\t\terr := errors.New(\"Cannot use more than one L2Services for VlanType=access case\")\n\t\t\tovscni.Log.Error(err, \"L2Services cannot contain more than one L2Services in VlanType=access case\")\n\t\t\treturn err\n\t\t}\n\t\td.Data[\"AccessVlan\"] = ovscni.L2srvResources[0].Spec.SegmentationID\n\tcase \"selectivetrunk\":\n\t\ttmpList := []string{}\n\t\tfor _, l2srvObj := range ovscni.L2srvResources {\n\t\t\ttmpStr := \"{\\\"id\\\": \" + strconv.Itoa(int(l2srvObj.Spec.SegmentationID)) + \"}\"\n\t\t\ttmpList = append(tmpList, tmpStr)\n\t\t}\n\t\td.Data[\"SelectiveVlan\"] = \"[\" + strings.Join(tmpList, \",\") + \"]\"\n\tcase \"trunk\":\n\t\tovscni.Log.Info(\"Transparent Trunk case in cluster level\")\n\t}\n\treturn nil\n}", "func openDUTControlConsole(stream dutcontrol.DutControl_ConsoleClient, req *dutcontrol.ConsoleRequest) (<-chan *dutcontrol.ConsoleSerialData, <-chan *dutcontrol.ConsoleSerialWriteResult, error) {\n\tif err := stream.Send(req); err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"send request\")\n\t}\n\tresp, err := stream.Recv()\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"recv open\")\n\t}\n\topen := resp.GetOpen()\n\tif open == nil {\n\t\treturn nil, nil, errors.New(\"open response is nil\")\n\t}\n\tif open.Err != \"\" {\n\t\treturn nil, nil, errors.New(string(open.Err))\n\t}\n\tdata := make(chan *dutcontrol.ConsoleSerialData, qSize)\n\twrite := make(chan *dutcontrol.ConsoleSerialWriteResult, qSize)\n\tgo func() {\n\tLoop:\n\t\tfor {\n\t\t\tresp, err := stream.Recv()\n\t\t\tif err == io.EOF {\n\t\t\t\ttesting.ContextLog(stream.Context(), \"Dutcontrol recv EOF\")\n\t\t\t\tbreak\n\t\t\t} else if err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tswitch op := resp.Type.(type) {\n\t\t\tcase *dutcontrol.ConsoleResponse_SerialData:\n\t\t\t\tdata <- op.SerialData\n\t\t\tcase *dutcontrol.ConsoleResponse_SerialWrite:\n\t\t\t\twrite <- op.SerialWrite\n\t\t\tdefault:\n\t\t\t\ttesting.ContextLog(stream.Context(), \"Dutcontrol recv error, unknown message type: \", op)\n\t\t\t\tbreak Loop\n\t\t\t}\n\t\t}\n\t\tclose(data)\n\t\tclose(write)\n\t}()\n\treturn data, write, nil\n}", "func (router *Router) getTerminal(w http.ResponseWriter, r *http.Request) {\n\tclusterName := r.URL.Query().Get(\"cluster\")\n\tnamespace := r.URL.Query().Get(\"namespace\")\n\tname := r.URL.Query().Get(\"name\")\n\tcontainer := r.URL.Query().Get(\"container\")\n\tshell := r.URL.Query().Get(\"shell\")\n\n\tlog.WithFields(logrus.Fields{\"cluster\": clusterName, \"namespace\": namespace, \"name\": name, \"container\": container, \"shell\": shell}).Tracef(\"getTerminal\")\n\n\tvar upgrader = websocket.Upgrader{}\n\n\tif router.config.WebSocket.AllowAllOrigins {\n\t\tupgrader.CheckOrigin = func(r *http.Request) bool { return true }\n\t}\n\n\tc, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.WithError(err).Errorf(\"Could not upgrade connection\")\n\t\treturn\n\t}\n\tdefer c.Close()\n\n\tc.SetPongHandler(func(string) error { return nil })\n\n\tgo func() {\n\t\tticker := time.NewTicker(pingPeriod)\n\t\tdefer ticker.Stop()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ticker.C:\n\t\t\t\tif err := c.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\tcluster := router.clusters.GetCluster(clusterName)\n\tif cluster == nil {\n\t\tlog.WithError(err).Errorf(\"Invalid cluster name\")\n\t\tmsg, _ := json.Marshal(terminal.Message{\n\t\t\tOp: \"stdout\",\n\t\t\tData: fmt.Sprintf(\"Invalid cluster name: %s\", err.Error()),\n\t\t})\n\t\tc.WriteMessage(websocket.TextMessage, msg)\n\t\treturn\n\t}\n\n\terr = cluster.GetTerminal(c, namespace, name, container, shell)\n\tif err != nil {\n\t\tlog.WithError(err).Errorf(\"Could not create terminal\")\n\t\tmsg, _ := json.Marshal(terminal.Message{\n\t\t\tOp: \"stdout\",\n\t\t\tData: fmt.Sprintf(\"Could not create terminal: %s\", err.Error()),\n\t\t})\n\t\tc.WriteMessage(websocket.TextMessage, msg)\n\t\treturn\n\t}\n\n\tlog.Tracef(\"Terminal connection was closed\")\n}", "func GetAttestor(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *AttestorState, opts ...pulumi.ResourceOption) (*Attestor, error) {\n\tvar resource Attestor\n\terr := ctx.ReadResource(\"google-native:binaryauthorization/v1beta1:Attestor\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func CORSVC(ac *atmi.ATMICtx, svc *atmi.TPSVCINFO) {\n\tret := SUCCEED\n\n\t//Return to the caller\n\tdefer func() {\n\n\t\tac.TpLogCloseReqFile()\n\t\tif SUCCEED == ret {\n\t\t\tac.TpReturn(atmi.TPSUCCESS, 0, &svc.Data, 0)\n\t\t} else {\n\t\t\tac.TpReturn(atmi.TPFAIL, 0, &svc.Data, 0)\n\t\t}\n\t}()\n\n\t//Get UBF Handler\n\tub, _ := ac.CastToUBF(&svc.Data)\n\n\t//Print the buffer to stdout\n\t//fmt.Println(\"Incoming request:\")\n\tub.TpLogPrintUBF(atmi.LOG_DEBUG, \"CORSVC: Incoming request:\")\n\n\tarr, err := ub.BGetByteArr(u.EX_NETDATA, 0)\n\n\tif err != nil {\n\t\tac.TpLogError(\"Failed to get EX_NETDATA: %s\", err.Message())\n\t\tret = FAIL\n\t\treturn\n\t}\n\tif arr[0] == 1 && arr[1] == 1 {\n\t\tac.TpLogInfo(\"Test case 11 - no need for correlation\")\n\t} else if len(arr) > 4 {\n\n\t\tcorr := string(arr[:4])\n\n\t\tac.TpLogInfo(\"Extracted correlator: [%s]\", corr)\n\n\t\tif err := ub.BChg(u.EX_NETCORR, 0, corr); nil != err {\n\t\t\tac.TpLogError(\"Failed to set EX_NETCORR: %s\", err.Message())\n\t\t\tret = FAIL\n\t\t\treturn\n\t\t}\n\n\t}\n\n\tub.TpLogPrintUBF(atmi.LOG_DEBUG, \"Reply buffer afrer correl\")\n\n}", "func (_Cakevault *CakevaultTransactor) InCaseTokensGetStuck(opts *bind.TransactOpts, _token common.Address) (*types.Transaction, error) {\n\treturn _Cakevault.contract.Transact(opts, \"inCaseTokensGetStuck\", _token)\n}", "func GetKubernetesMode() string {\n\treturn strings.TrimSpace(os.Getenv(\"CYPRESS_PARALLEL_API_K8S_CLIENT_OUTSIDE\"))\n}", "func CustomerGetVehicle(w http.ResponseWriter, r *http.Request) {\n\tvehicle := services.GetOneVehicle(r)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(vehicle)\n}", "func (c *ClinicClient) Get(ctx context.Context, id uuid.UUID) (*Clinic, error) {\n\treturn c.Query().Where(clinic.ID(id)).Only(ctx)\n}", "func (c *client) getCharacter(thisCharacter *Character, uID string) error {\n\tauthorized, err := c.isOwner(thisCharacter.ID, uID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !authorized {\n\t\treturn errorutil.New(http.StatusForbidden, \"can't delete someone else's character...\")\n\t}\n\n\t// get the character by ID\n\tvar clID, scID int\n\t// TODO if the default for Concentrated is 0, the api call to spells/0 will return Acid Splash (key 1) - why?\n\tif err := c.db.QueryRow(`SELECT ch.Name, ch.ClassLevel, ch.SCAbilityScore, ch.PortraitPath, ch.ClassKey, IFNULL(ch.SubclassKey, 0), IFNULL(ch.ConcentratedSpell, 0),\n\t\tch.Level1SlotsRemaining, ch.Level2SlotsRemaining, ch.Level3SlotsRemaining, ch.Level4SlotsRemaining, ch.Level5SlotsRemaining, ch.Level6SlotsRemaining,\n\t\tch.Level7SlotsRemaining, ch.Level8SlotsRemaining, ch.Level9SlotsRemaining, ch.CastSuccess\n\t\tFROM Characters ch\n\t\tWHERE ch.CharacterKey = ?`, thisCharacter.ID).Scan(&thisCharacter.Name, &thisCharacter.Level,\n\t\t&thisCharacter.AbilityScore, &thisCharacter.PortraitPath,\n\t\t&clID, &scID, &thisCharacter.Concentrating, &thisCharacter.Level1SlotsRemaining, &thisCharacter.Level2SlotsRemaining, &thisCharacter.Level3SlotsRemaining,\n\t\t&thisCharacter.Level4SlotsRemaining, &thisCharacter.Level5SlotsRemaining, &thisCharacter.Level6SlotsRemaining, &thisCharacter.Level7SlotsRemaining,\n\t\t&thisCharacter.Level8SlotsRemaining, &thisCharacter.Level9SlotsRemaining, &thisCharacter.CastSuccess); err != nil {\n\t\tlog.Printf(\"mysql: could not access Character: %v\", err)\n\t\treturn errorutil.New(500, \"internal error\")\n\t}\n\tcl, err := c.clc.ClassByID(clID, false)\n\tif err != nil {\n\t\tlog.Printf(\"couldn't get class for character (ID: %d): %v\", thisCharacter.ID, err)\n\t\treturn err\n\t}\n\tthisCharacter.Class = cl\n\tif scID != 0 {\n\t\tsc, err := c.clc.SubclassByID(scID)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"couldn't get subclass for character (ID: %d): %v\", thisCharacter.ID, err)\n\t\t\treturn err\n\t\t}\n\t\tthisCharacter.Subclass = sc\n\t}\n\tlog.Print(\"\\n\\tfilled struct: \", thisCharacter)\n\n\treturn nil\n}", "func GetCSDCOProj(identity string) *sparql.Results {\n\t// repo, err := sparql.NewRepo(\"http://data.oceandrilling.org/sparql\",\n\trepo, err := getJena()\n\tif err != nil {\n\t\tlog.Printf(\"%s\\n\", err)\n\t}\n\n\tf := bytes.NewBufferString(projdetails)\n\tbank := sparql.LoadBank(f)\n\n\t// q, err := bank.Prepare(\"my-query\", struct{ Limit, Offset int }{10, 100})\n\tq, err := bank.Prepare(\"csdcoproj\", struct{ ID string }{identity})\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n\n\tlog.Println(q)\n\n\tres, err := repo.Query(q)\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n\n\treturn res\n}", "func (client *LicenseStatusClient) Get(uuid string, options ...session.ApiOptionsParams) (*models.LicenseStatus, error) {\n\tvar obj *models.LicenseStatus\n\terr := client.aviSession.Get(client.getAPIPath(uuid), &obj, options...)\n\treturn obj, err\n}", "func (_Cakevault *CakevaultTransactorSession) InCaseTokensGetStuck(_token common.Address) (*types.Transaction, error) {\n\treturn _Cakevault.Contract.InCaseTokensGetStuck(&_Cakevault.TransactOpts, _token)\n}", "func (ec *executionContext) _Case(ctx context.Context, sel ast.SelectionSet, obj *models.Case) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, caseImplementors)\n\n\tvar wg sync.WaitGroup\n\tout := graphql.NewOrderedMap(len(fields))\n\tinvalid := false\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"Case\")\n\t\tcase \"Id\":\n\t\t\tout.Values[i] = ec._Case_Id(ctx, field, obj)\n\t\tcase \"Asset\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_Asset(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"CaseNumber\":\n\t\t\tout.Values[i] = ec._Case_CaseNumber(ctx, field, obj)\n\t\tcase \"Origin\":\n\t\t\tout.Values[i] = ec._Case_Origin(ctx, field, obj)\n\t\tcase \"Owner\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_Owner(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"Reason\":\n\t\t\tout.Values[i] = ec._Case_Reason(ctx, field, obj)\n\t\tcase \"IsClosed\":\n\t\t\tout.Values[i] = ec._Case_IsClosed(ctx, field, obj)\n\t\tcase \"Contact\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_Contact(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"CreatedBy\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_CreatedBy(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"ClosedDate\":\n\t\t\tout.Values[i] = ec._Case_ClosedDate(ctx, field, obj)\n\t\tcase \"CreatedDate\":\n\t\t\tout.Values[i] = ec._Case_CreatedDate(ctx, field, obj)\n\t\tcase \"IsDeleted\":\n\t\t\tout.Values[i] = ec._Case_IsDeleted(ctx, field, obj)\n\t\tcase \"Description\":\n\t\t\tout.Values[i] = ec._Case_Description(ctx, field, obj)\n\t\tcase \"IsEscalated\":\n\t\t\tout.Values[i] = ec._Case_IsEscalated(ctx, field, obj)\n\t\tcase \"LastModifiedBy\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_LastModifiedBy(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"LastModifiedDate\":\n\t\t\tout.Values[i] = ec._Case_LastModifiedDate(ctx, field, obj)\n\t\tcase \"LastReferencedDate\":\n\t\t\tout.Values[i] = ec._Case_LastReferencedDate(ctx, field, obj)\n\t\tcase \"LastViewedDate\":\n\t\t\tout.Values[i] = ec._Case_LastViewedDate(ctx, field, obj)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\twg.Wait()\n\tif invalid {\n\t\treturn graphql.Null\n\t}\n\treturn out\n}", "func (d *Dao) ReadOxygenConc() (resp interface{}, err error) {\n\treq := SensorOxygenConcUnit.Request()\n\toutput, err := send(d, req.Bytes())\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn resp, err\n\t}\n\tconc := binary.BigEndian.Uint16(output[3:5])\n\tresp = dividedByTen(conc)\n\treturn resp, nil\n}", "func GetByProvince(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tcovidData, err := scrapper.GetAllDataByProvince()\n\tif err != nil {\n\t\tjson.NewEncoder(w).Encode(Error{\n\t\t\tCode: 500,\n\t\t\tMessage: err.Error(),\n\t\t})\n\n\t\treturn\n\t}\n\n\tprov := r.URL.Query().Get(\"prov\")\n\tif prov != \"\" {\n\t\tfor _, item := range covidData {\n\t\t\tif strings.ToLower(item.Province) == strings.ToLower(prov) {\n\t\t\t\tjson.NewEncoder(w).Encode(item)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tjson.NewEncoder(w).Encode(covidData)\n\t\treturn\n\t}\n\n\tjson.NewEncoder(w).Encode(covidData)\n}", "func (client IdentityClient) getTenancy(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/tenancies/{tenancyId}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response GetTenancyResponse\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\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func GetSingleClinicID(c *gin.Context) {\n\tlog.Infof(\"Get all clinics associated with admin\")\n\tctx := c.Request.Context()\n\taddressID := c.Param(\"addressId\")\n\tif addressID == \"\" {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusBadRequest,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: \"clinic address id not provided\",\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\t_, _, gproject, err := getUserDetails(ctx, c.Request)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: err.Error(),\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\tctx, span := trace.StartSpan(ctx, \"Get all clinics associated with admin\")\n\tdefer span.End()\n\tclinicMetaDB := datastoredb.NewClinicMetaHandler()\n\terr = clinicMetaDB.InitializeDataBase(ctx, gproject)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: err.Error(),\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\n\tregisteredClinics, err := clinicMetaDB.GetSingleClinic(ctx, addressID)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: err.Error(),\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, gin.H{\n\t\tconstants.RESPONSE_JSON_DATA: registeredClinics,\n\t\tconstants.RESPONSDE_JSON_ERROR: nil,\n\t})\n\n\tclinicMetaDB.Close()\n}", "func SimpleGet(w http.ResponseWriter, req *http.Request) {\n\tlog.Println(\"Get Succeeded\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(os.Getenv(\"COPILOT_APPLICATION_NAME\") + \"-\" + os.Getenv(\"COPILOT_ENVIRONMENT_NAME\") + \"-\" + os.Getenv(\"COPILOT_SERVICE_NAME\")))\n}", "func (t *InsuranceChaincode) getCustomerByID(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n var customerId, jsonResp string\n\n if len(args) != 1 {\n return shim.Error(\"Incorrect number of arguments. Expecting customerId of the Insurance to query\")\n }\n\n customerId = args[0]\n valAsbytes, err := stub.GetState(customerId) \n if err != nil {\n jsonResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + customerId + \"\\\"}\"\n return shim.Error(jsonResp)\n } else if valAsbytes == nil {\n jsonResp = \"{\\\"CustomerId\\\": \\\"\"+ customerId + \"\\\", \\\"Error\\\":\\\"Customer does not exist.\\\"}\"\n return shim.Error(jsonResp)\n }\n\n return shim.Success(valAsbytes)\n}", "func GetCategory(response http.ResponseWriter, request *http.Request) {\n\t//var results TCategory\n\tvar errorResponse = ErrorResponse{\n\t\tCode: http.StatusInternalServerError, Message: \"Internal Server Error.\",\n\t}\n\n\tcollection := Client.Database(\"msdb\").Collection(\"t_cat_mg\")\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tcursor, err := collection.Find(ctx, bson.M{})\n\tvar results []bson.M\n\terr = cursor.All(ctx, &results)\n\n\tdefer cancel()\n\n\tif err != nil {\n\t\terrorResponse.Message = \"Document not found\"\n\t\treturnErrorResponse(response, request, errorResponse)\n\t} else {\n\t\tvar successResponse = SuccessResponse{\n\t\t\tCode: http.StatusOK,\n\t\t\tMessage: \"Success\",\n\t\t\tResponse: results,\n\t\t}\n\n\t\tsuccessJSONResponse, jsonError := json.Marshal(successResponse)\n\n\t\tif jsonError != nil {\n\t\t\treturnErrorResponse(response, request, errorResponse)\n\t\t}\n\t\tresponse.Header().Set(\"Content-Type\", \"application/json\")\n\t\tresponse.Write(successJSONResponse)\n\t}\n\n}", "func (_Cakevault *CakevaultSession) InCaseTokensGetStuck(_token common.Address) (*types.Transaction, error) {\n\treturn _Cakevault.Contract.InCaseTokensGetStuck(&_Cakevault.TransactOpts, _token)\n}", "func (c *Client) CreateCase(ctx context.Context, params *CreateCaseInput, optFns ...func(*Options)) (*CreateCaseOutput, error) {\n\tif params == nil {\n\t\tparams = &CreateCaseInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"CreateCase\", params, optFns, addOperationCreateCaseMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*CreateCaseOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (Lawrencium) GetCategory() string {\n\tvar c categoryType = actinoid\n\treturn c.get()\n}", "func (d *Dao) Case(c context.Context, arg *blocked.ArgCaseSearch) (ids []int64, pager *blocked.Pager, err error) {\n\treq := d.elastic.NewRequest(blocked.BusinessBlockedCase).Index(blocked.TableBlockedCase).Fields(\"id\")\n\tif arg.Keyword != blocked.SearchDefaultString {\n\t\treq.WhereLike([]string{\"origin_content\"}, []string{arg.Keyword}, true, elastic.LikeLevelHigh)\n\t}\n\tif arg.OriginType != blocked.SearchDefaultNum {\n\t\treq.WhereEq(\"origin_type\", arg.OriginType)\n\t}\n\tif arg.Status != blocked.SearchDefaultNum {\n\t\treq.WhereEq(\"status\", arg.Status)\n\t}\n\tif arg.CaseType != blocked.SearchDefaultNum {\n\t\treq.WhereEq(\"case_type\", arg.CaseType)\n\t}\n\tif arg.UID != blocked.SearchDefaultNum {\n\t\treq.WhereEq(\"mid\", arg.UID)\n\t}\n\tif arg.OPID != blocked.SearchDefaultNum {\n\t\treq.WhereEq(\"oper_id\", arg.OPID)\n\t}\n\treq.WhereRange(\"start_time\", arg.TimeFrom, arg.TimeTo, elastic.RangeScopeLcRc)\n\treq.Pn(arg.PN).Ps(arg.PS).Order(arg.Order, arg.Sort)\n\tvar res *search.ReSearchData\n\tif err = req.Scan(c, &res); err != nil {\n\t\terr = errors.Errorf(\"elastic search(%s) error(%v)\", req.Params(), err)\n\t\treturn\n\t}\n\tids, pager = pagerExtra(res)\n\treturn\n}", "func (client *Client) DescribeCustinsKernelReleaseNotesWithCallback(request *DescribeCustinsKernelReleaseNotesRequest, callback func(response *DescribeCustinsKernelReleaseNotesResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeCustinsKernelReleaseNotesResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeCustinsKernelReleaseNotes(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (p *MockProvisionerClient) TenancyOCID() string {\n\treturn \"ocid1.tenancy.oc1..aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n}", "func (_SingleAuto *SingleAutoTransactor) InCaseTokensGetStuck(opts *bind.TransactOpts, _token common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _SingleAuto.contract.Transact(opts, \"inCaseTokensGetStuck\", _token, _amount)\n}", "func (env *Env) GetContestInfo(c *gin.Context) {\n\tkv, err := env.db.GetKV(\"ContestInfo\")\n\tif err != nil {\n\t\tvar errMsg = fmt.Sprint(\"Get ContestInfo failed with\", err)\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"message\": errMsg})\n\t\treturn\n\t}\n\tvar ci model.ContestInfo\n\terr = json.Unmarshal(kv.Value, &ci)\n\tif err != nil {\n\t\tvar errMsg = fmt.Sprint(\"Get ContestInfo failed with\", err)\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"message\": errMsg})\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, ci)\n}", "func (m *PatientMutation) Congenital() (r string, exists bool) {\n\tv := m._Congenital\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "func (cr CURetriever) GetCU(addr sdk.CUAddress) (exported.CustodianUnit, error) {\n\tCU, _, err := cr.GetCUWithHeight(addr)\n\treturn CU, err\n}", "func ToCaseClause(x ast.Node) *ast.CaseClause {\n\tif x, ok := x.(*ast.CaseClause); ok {\n\t\treturn x\n\t}\n\treturn NilCaseClause\n}", "func (t Type) GoCase() string {\n\treturn gocase.To(strcase.ToCamel(string(t)))\n}", "func getSimpleTOC(res http.ResponseWriter, req *http.Request, params httprouter.Params) {\n\tpu, _ := GetUserFromSession(res, req)\n\n\tscreenOutput := struct {\n\t\tName string\n\t\tEmail string\n\t\tPermission int\n\t\tID string\n\t}{\n\t\tpu.Name,\n\t\tpu.Email,\n\t\tpu.Permission,\n\t\tparams.ByName(\"ID\"),\n\t}\n\n\tServeTemplateWithParams(res, \"toc.html\", screenOutput)\n}", "func (m *SecureScoreControlProfile) GetControlCategory()(*string) {\n val, err := m.GetBackingStore().Get(\"controlCategory\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func GetNuxeoContainer(dep *v1.Deployment) (*v12.Container, error) {\n\tfor i := 0; i < len(dep.Spec.Template.Spec.Containers); i++ {\n\t\tif dep.Spec.Template.Spec.Containers[i].Name == \"nuxeo\" {\n\t\t\treturn &dep.Spec.Template.Spec.Containers[i], nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"could not find a container named 'nuxeo' in the deployment\")\n}", "func GetTC(postId string, session *r.Session) []string {\n\tvar tcs []string\n\tvar tc ct.TravelCapsule\n\tdb := os.Getenv(\"DB\")\n\ttcTable := os.Getenv(\"TCTABLE\")\n\tcur, _ := r.DB(db).Table(tcTable).GetAllByIndex(\"posts\", postId).Run(session)\n\n\tfor cur.Next(&tc) {\n\t\ttcs = append(tcs, tc.Id)\n\t}\n\treturn tcs\n}", "func GetWareByCategory(c *server.Context) error {\n\tvar (\n\t\tres []ware.BriefInfo\n\t\tcidReq struct {\n\t\t\tParentCID uint32 `json:\"parent_cid\" validate:\"required\"`\n\t\t\tCID uint32 `json:\"cid\"`\n\t\t}\n\t)\n\n\terr := c.JSONBody(&cidReq)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrInvalidParam, nil)\n\t}\n\n\terr = c.Validate(cidReq)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrInvalidParam, nil)\n\t}\n\n\tconn, err := mysql.Pool.Get()\n\tdefer mysql.Pool.Release(conn)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrMysql, nil)\n\t}\n\n\tif cidReq.CID == 0 {\n\t\tres, err = ware.Service.GetByParentCID(conn, cidReq.ParentCID)\n\t\tif err != nil {\n\t\t\tlogger.Error(err)\n\t\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrMysql, nil)\n\t\t}\n\t} else {\n\t\tres, err = ware.Service.GetByCID(conn, cidReq.CID)\n\t\tif err != nil {\n\t\t\tlogger.Error(err)\n\t\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrMysql, nil)\n\t\t}\n\t}\n\n\treturn core.WriteStatusAndDataJSON(c, constants.ErrSucceed, res)\n}", "func (a *HyperflexApiService) GetHyperflexLicenseByMoid(ctx context.Context, moid string) ApiGetHyperflexLicenseByMoidRequest {\n\treturn ApiGetHyperflexLicenseByMoidRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func (m *DeviceEnrollmentWindowsHelloForBusinessConfiguration) GetPinLowercaseCharactersUsage()(*WindowsHelloForBusinessPinUsage) {\n val, err := m.GetBackingStore().Get(\"pinLowercaseCharactersUsage\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*WindowsHelloForBusinessPinUsage)\n }\n return nil\n}", "func (d *Deals) Retrieve(ctx context.Context, waddr string, cid cid.Cid) (io.Reader, error) {\n\ttime.Sleep(time.Second * 3)\n\treturn strings.NewReader(\"hello there\"), nil\n}", "func GetCustomerbyPhone(details string) (customer Customers, err error) {\r\n\tvar rows *sql.Rows\r\n\tif rows, err = Get(fmt.Sprintf(`select * from customers where %s and deleted_at is null;`, details)); err != nil {\r\n\t\tCheckError(\"Error getting Customer details.\", err, false)\r\n\t\treturn Customers{}, err\r\n\t}\r\n\r\n\tdefer rows.Close()\r\n\tfor rows.Next() {\r\n\t\tif err = rows.Scan(&customer.ID, &customer.CardCode, &customer.CardName, &customer.Address, &customer.Phone, &customer.Phone1, &customer.City, &customer.Email, &customer.Synced, &customer.CreatedBy, &customer.CreatedAt, &customer.UpdatedAt, &customer.DeletedAt); err != nil {\r\n\t\t\tCheckError(\"Error Scanning Customers.\", err, false)\r\n\t\t}\r\n\t}\r\n\r\n\treturn\r\n}", "func (c *DoctorClient) Get(ctx context.Context, id int) (*Doctor, error) {\n\treturn c.Query().Where(doctor.ID(id)).Only(ctx)\n}", "func (c *OperationroomClient) Get(ctx context.Context, id int) (*Operationroom, error) {\n\treturn c.Query().Where(operationroom.ID(id)).Only(ctx)\n}", "func (ts *TechStoryService) getText (w http.ResponseWriter, r *http.Request) {\n\tvar techStory model.TechStory\n\ttechStory.Key = mux.Vars(r)[\"id\"]\n\n\t// Check for version parameter\n\tvalues := r.URL.Query()\n\tversion := model.GetInt (values, \"version\", -1)\n\tvar found *model.VersionedText\n\tvar err error\n\n\tWithTechStoryDao(func(dao techStoryDao) {\n\t\tif version != -1 {\n\t\t\tfound, err = dao.GetTextByVersion(techStory, version)\n\t\t} else {\n\t\t\tfound, err = dao.GetActiveText(techStory)\n\t\t}\n\t\tmodel.CheckErr(err)\n\t\tmodel.WriteResponse(true, nil, found, w)\n\t})\n}", "func GetCompanyOfficer(w http.ResponseWriter, req *http.Request) {\n\n\t// Check for a company number in request\n\tvars := mux.Vars(req)\n\n\tcompanyNumber, err := utils.GetValueFromVars(vars, \"company_number\")\n\tif err != nil {\n\t\tlog.ErrorR(req, err)\n\t\tm := models.NewMessageResponse(\"company number not in request context\")\n\t\tutils.WriteJSONWithStatus(w, req, m, http.StatusBadRequest)\n\t\treturn\n\t}\n\tcompanyNumber = strings.ToUpper(companyNumber)\n\n\t// Check for Officer ID in request\n\tofficerID, err := utils.GetValueFromVars(vars, \"officer_id\")\n\tif err != nil {\n\t\tlog.ErrorR(req, err)\n\t\tm := models.NewMessageResponse(\"officer ID not in request context\")\n\t\tutils.WriteJSONWithStatus(w, req, m, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tcompanyOfficer, responseType, err := service.GetOfficer(companyNumber, officerID)\n\tif err != nil {\n\t\tlog.ErrorR(req, fmt.Errorf(\"error calling Oracle API to get officer: %v\", err))\n\t\tm := models.NewMessageResponse(\"there was a problem communicating with the Oracle API\")\n\t\tutils.WriteJSONWithStatus(w, req, m, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif responseType == service.NotFound {\n\t\tm := models.NewMessageResponse(\"No officer found\")\n\t\tutils.WriteJSONWithStatus(w, req, m, http.StatusNotFound)\n\t\treturn\n\t}\n\n\tutils.WriteJSON(w, req, companyOfficer)\n}", "func (s *NodesInfoService) DoC(ctx context.Context) (*NodesInfoResponse, error) {\n\t// Check pre-conditions\n\tif err := s.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get URL for request\n\tpath, params, err := s.buildURL()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get HTTP response\n\tres, err := s.client.PerformRequestC(ctx, \"GET\", path, params, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Return operation response\n\tret := new(NodesInfoResponse)\n\tif err := s.client.decoder.Decode(res.Body, ret); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ret, nil\n}", "func (c *LogClient) getConsistencyProof(ctx context.Context, first, second uint64) (*ConsistencyProofData, error) {\n\tbase10 := 10\n\tparams := map[string]string{\n\t\t\"first\": strconv.FormatUint(first, base10),\n\t\t\"second\": strconv.FormatUint(second, base10),\n\t}\n\tvar resp ct.GetSTHConsistencyResponse\n\tif _, _, err := c.GetAndParse(ctx, ct.GetSTHConsistencyPath, params, &resp); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get ConsistencyProof from Logger %s: %w\", c.LogInfo.LogID, err)\n\t}\n\n\t// Construct ctv2 ConsistencyProofData\n\tlogID := c.LogInfo.LogID\n\tconsistencyProof := &ConsistencyProofData{logID, first, second, resp.Consistency}\n\treturn consistencyProof, nil\n}", "func GetCurpByRenapo(curp string) string {\n\tresp, _ := http.Post(os.Getenv(\"URL_STC_1\")+curp+os.Getenv(\"URL_STC_2\"), \"application/json\", nil)\n\tbodyBytes, _ := ioutil.ReadAll(resp.Body)\n\treturn string(bodyBytes)\n}", "func (_SingleAuto *SingleAutoTransactorSession) InCaseTokensGetStuck(_token common.Address, _amount *big.Int) (*types.Transaction, error) {\n\treturn _SingleAuto.Contract.InCaseTokensGetStuck(&_SingleAuto.TransactOpts, _token, _amount)\n}", "func CanaryIncCase(context.Context, TimerManager, int) error {\n\treturn nil\n}", "func (a *CloudCostPerspectivesApiService) GetPerspective(ctx context.Context, accountIdentifier string, perspectiveId string) (ResponseDtoceView, *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 ResponseDtoceView\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/ccm/api/perspective\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tlocalVarQueryParams.Add(\"accountIdentifier\", parameterToString(accountIdentifier, \"\"))\n\tlocalVarQueryParams.Add(\"perspectiveId\", parameterToString(perspectiveId, \"\"))\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"x-api-key\"] = key\n\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\tif err == nil {\n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 400 {\n\t\t\tvar v Failure\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 ModelError\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 ResponseDtoceView\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "func (term *Terminology) SNOMEDCTtoReadV2(ctx context.Context, id *apiv1.Identifier, f func(*apiv1.Identifier) error) error {\n\tsctID, err := snomed.ParseAndValidate(id.GetValue())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not parse SNOMED identifier: %w\", err)\n\t}\n\tif sctID.IsConcept() == false {\n\t\treturn fmt.Errorf(\"can map only concepts: '%d' not a concept\", sctID)\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\tstream, err := term.client.CrossMap(ctx, &snomed.CrossMapRequest{\n\t\tConceptId: sctID.Integer(),\n\t\tRefsetId: 900000000000497000,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"crossmap error: %w\", err)\n\t}\n\tfor {\n\t\titem, err := stream.Recv()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"crossmap error: %w\", err)\n\t\t}\n\t\terr = f(&apiv1.Identifier{\n\t\t\tSystem: identifiers.ReadV2,\n\t\t\tValue: item.GetSimpleMap().GetMapTarget(),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func Get(city string) (result vm.DeviceGetData) {\n\tresult = GetFrom(time.Now().Add(-time.Hour*2).Unix(), city)\n\n\tif len(result.Latest) == 0 {\n\t\tresult = GetFrom(time.Now().Add(-time.Hour*4).Unix(), city)\n\t}\n\n\tfmt.Println(\"CITY RESULTS ::: \", result, city)\n\n\tif len(result.Latest) == 0 {\n\t\tresult = GetFrom(time.Now().Add(-time.Hour*12).Unix(), city)\n\t}\n\n\t// Since we did not get any data, get the last successfull state\n\tif len(result.Latest) == 0 {\n\t\tfmt.Println(\"We didn't get any data, calling get state.\")\n\t\tresult = getState(city)\n\t} else {\n\t\t// We have data, update the state\n\t\tsaveState(&result)\n\t}\n\n\treturn\n}", "func GetPhysicalClinics(c *gin.Context) {\n\tlog.Infof(\"Get all clinics associated with admin\")\n\tctx := c.Request.Context()\n\tuserEmail, _, gproject, err := getUserDetails(ctx, c.Request)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: err.Error(),\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\tctx, span := trace.StartSpan(ctx, \"Get all clinics associated with admin\")\n\tdefer span.End()\n\tclinicMetaDB := datastoredb.NewClinicMetaHandler()\n\terr = clinicMetaDB.InitializeDataBase(ctx, gproject)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: err.Error(),\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\tregisteredClinics, err := clinicMetaDB.GetAllClinicsByEmail(ctx, userEmail)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: err.Error(),\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\tresponseData := contracts.GetClinicAddressResponse{\n\t\tClinicDetails: registeredClinics,\n\t}\n\tc.JSON(http.StatusOK, gin.H{\n\t\tconstants.RESPONSE_JSON_DATA: responseData,\n\t\tconstants.RESPONSDE_JSON_ERROR: nil,\n\t})\n\tclinicMetaDB.Close()\n}", "func (o RouterNatResponseOutput) TcpTransitoryIdleTimeoutSec() pulumi.IntOutput {\n\treturn o.ApplyT(func(v RouterNatResponse) int { return v.TcpTransitoryIdleTimeoutSec }).(pulumi.IntOutput)\n}", "func (d *DebugData) GetCompilationUnit(pc uintptr) (*CUEntry, error) {\n\tfor _, cu := range d.compUnits {\n\t\tif cu.ContainsPC(pc) {\n\t\t\treturn cu, nil\n\t\t}\n\t}\n\n\treturn nil, Errorf(\"compilation unit not found for pc: %#x\", pc)\n}", "func (client DatasetClient) GetOperationResponder(resp *http.Response) (result LongRunningOperationResult, err error) {\n err = autorest.Respond(\n resp,\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByUnmarshallingJSON(&result),\n autorest.ByClosing())\n result.Response = autorest.Response{Response: resp}\n return\n }", "func (a *HyperflexApiService) GetHyperflexClusterNetworkPolicyByMoid(ctx context.Context, moid string) ApiGetHyperflexClusterNetworkPolicyByMoidRequest {\n\treturn ApiGetHyperflexClusterNetworkPolicyByMoidRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func (o Iperf3SpecClientConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionOutput) PodAffinityTerm() Iperf3SpecClientConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput {\n\treturn o.ApplyT(func(v Iperf3SpecClientConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecution) Iperf3SpecClientConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTerm {\n\t\treturn v.PodAffinityTerm\n\t}).(Iperf3SpecClientConfigurationPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermOutput)\n}", "func (client *Client) GetWsCustomizedChO2OWithCallback(request *GetWsCustomizedChO2ORequest, callback func(response *GetWsCustomizedChO2OResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetWsCustomizedChO2OResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetWsCustomizedChO2O(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (c *LogClient) GetSTHWithConsistencyProof(ctx context.Context, first, second uint64) (*CTObject, error){\n\tsth, err := c.getSTH(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to first get STH when getting STHWithPoC from Logger %s: %w\", c.LogInfo.LogID, err)\n\t}\n\tpoc, err := c.getConsistencyProof(ctx, first, second)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to first get PoC when getting STHWithPoC from Logger %s: %w\", c.LogInfo.LogID, err)\n\t}\n\tsthWithPoc := &SignedTreeHeadWithConsistencyProof{*sth, *poc}\t\n\tsthWithPOCCT, err := ConstructCTObject(sthWithPoc)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to construct STHWithPoC CTObject for Logger %s: %w\", c.LogInfo.LogID, err)\n\t}\n\treturn sthWithPOCCT, nil\n}", "func (client *Client) GetWsCustomizedChO2O(request *GetWsCustomizedChO2ORequest) (response *GetWsCustomizedChO2OResponse, err error) {\n\tresponse = CreateGetWsCustomizedChO2OResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func (cm ConcurrenceModel) GetConcurrence(i, j int) float64 {\n\tweightIJ, exists := cm.concurrences[i][j]\n\tif exists {\n\t\treturn weightIJ\n\t} else {\n\t\treturn 0.0\n\t}\n}", "func (m *ThreatAssessmentRequest) GetCategory()(*ThreatCategory) {\n val, err := m.GetBackingStore().Get(\"category\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*ThreatCategory)\n }\n return nil\n}", "func (cmd *GetTechHyTechCommand) Run(c *client.Client, args []string) error {\n\tvar path string\n\tif len(args) > 0 {\n\t\tpath = args[0]\n\t} else {\n\t\tpath = fmt.Sprintf(\"/api/tech/%v\", cmd.TechID)\n\t}\n\tlogger := goa.NewLogger(log.New(os.Stderr, \"\", log.LstdFlags))\n\tctx := goa.WithLogger(context.Background(), logger)\n\tresp, err := c.GetTechHyTech(ctx, path)\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"failed\", \"err\", err)\n\t\treturn err\n\t}\n\n\tgoaclient.HandleResponse(c.Client, resp, cmd.PrettyPrint)\n\treturn nil\n}", "func (d *Dao) CaseInfo(c context.Context, cid int64) (r *model.BlockedCase, err error) {\n\trow := d.db.QueryRow(c, _getCaseByIDSQL, cid)\n\tr = &model.BlockedCase{}\n\tif err = row.Scan(&r.ID, &r.MID, &r.Status, &r.OriginContent, &r.PunishResult, &r.OriginTitle, &r.OriginURL, &r.EndTime, &r.VoteRule, &r.VoteBreak, &r.VoteDelete, &r.OriginType, &r.ReasonType, &r.JudgeType, &r.BlockedDays, &r.PutTotal, &r.StartTime, &r.EndTime, &r.Operator, &r.CTime, &r.MTime, &r.RelationID, &r.CaseType); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil\n\t\t\tr = nil\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func (client *Client) GetOpenNLUWithCallback(request *GetOpenNLURequest, callback func(response *GetOpenNLUResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetOpenNLUResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetOpenNLU(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (c *DigicertClient) View(orderId string) (*string, *string, error) {\n\n\tres, err := c.request(nil, fmt.Sprintf(\"/order/certificate/%s\", orderId), http.MethodGet, &CertificateOrderResponse{})\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\torder := *res.(*CertificateOrderResponse)\n\n\ti := strconv.FormatInt(order.Certificate.Id, 10)\n\n\treturn &i, &order.Status, nil\n}", "func (t *Procure2Pay) GetPurchaseOrder(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\n\tvar err error\n\t\n\tfmt.Println(\"Entering GetPurchaseOrder\")\n\n\tif (len(args) < 1) {\n\t\tfmt.Println(\"Invalid number of arguments\\n\")\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t//fetch data from couch db starts here\n\tvar po_id = args[0]\n\tqueryString := fmt.Sprintf(\"{\\\"selector\\\":{\\\"po_id\\\":{\\\"$eq\\\": \\\"%s\\\"}}}\",po_id)\n\tqueryResults, err := getQueryResultForQueryString(stub, queryString)\n\t//fetch data from couch db ends here\n\n\tif err != nil {\n\t\tfmt.Printf(\"Unable to read the PO for PO ID : %s\\n\", err)\n\t\treturn shim.Error(err.Error())\n\t\t//return nil, err\n\t}\n\t\n\tfmt.Printf(\"list of PO for PO ID : %v\\n\", queryResults)\n\t\n\treturn shim.Success(queryResults)\n\t//return bytesRead, nil\n}", "func (o GoogleCloudRetailV2alphaSearchRequestFacetSpecFacetKeyPtrOutput) CaseInsensitive() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *GoogleCloudRetailV2alphaSearchRequestFacetSpecFacetKey) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.CaseInsensitive\n\t}).(pulumi.BoolPtrOutput)\n}", "func (o DatabaseOutput) ConcurrencyMode() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Database) pulumi.StringOutput { return v.ConcurrencyMode }).(pulumi.StringOutput)\n}", "func (c *ClinicClient) GetX(ctx context.Context, id uuid.UUID) *Clinic {\n\tobj, err := c.Get(ctx, id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn obj\n}", "func getCustomer(c *gin.Context) {\n\tmdb := db.MongoSession\n\ttargetID := c.Param(\"id\")\n\ttarget, found, err := mdb.GetCustomerByID(targetID)\n\tif err != nil {\n\t\tc.String(500, \"{\\\"code\\\": -1, \\\"message\\\": \\\"An unexpected error occurred\\\"}\")\n\t} else if !found {\n\t\tc.String(404, \"{\\\"code\\\": 1002, \\\"message\\\": \\\"Customer does not exist\\\"}\")\n\t} else {\n\t\tc.JSON(200, target)\n\t}\n}", "func (a *API) GetCompetenceByID(ctx *app.Context, w http.ResponseWriter, r *http.Request) error {\n\tid := getIDFromRequest(\"id\", r)\n\tintID, err := strconv.Atoi(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcompetence, err := ctx.GetCompetenceByID(uint16(intID))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdata, err := json.Marshal(competence)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = w.Write(data)\n\treturn err\n}", "func (ooc *MockOpenoltClient) GetDeviceInfo(ctx context.Context, in *openolt.Empty, opts ...grpc.CallOption) (*openolt.DeviceInfo, error) {\n\tif ooc.counter == 0 {\n\t\tooc.counter++\n\t\tdeviceInfo := &openolt.DeviceInfo{Vendor: \"Openolt\", Model: \"1.0\", HardwareVersion: \"1.0\", FirmwareVersion: \"1.0\", DeviceId: \"olt\", DeviceSerialNumber: \"olt\"}\n\t\treturn deviceInfo, nil\n\t}\n\tif ooc.counter == 1 {\n\t\tooc.counter++\n\t\tdeviceInfo := &openolt.DeviceInfo{Vendor: \"Openolt\", Model: \"1.0\", HardwareVersion: \"1.0\", FirmwareVersion: \"1.0\", DeviceId: \"\", DeviceSerialNumber: \"olt\"}\n\t\treturn deviceInfo, nil\n\t}\n\tif ooc.counter == 2 {\n\t\tooc.counter++\n\t\treturn nil, nil\n\t}\n\n\treturn nil, errors.New(\"device info not found\")\n}", "func (c *TestClient) GetSerialPortOutput(project, zone, name string, port, start int64) (*compute.SerialPortOutput, error) {\n\tif c.GetSerialPortOutputFn != nil {\n\t\treturn c.GetSerialPortOutputFn(project, zone, name, port, start)\n\t}\n\treturn c.client.GetSerialPortOutput(project, zone, name, port, start)\n}", "func GetCategory(id bson.ObjectId) (Category, error) {\n\tvar (\n\t\terr error\n\t\tcategory Category\n\t)\n\n\tc := newCategoryCollection()\n\tdefer c.Close()\n\n\terr = c.Session.FindId(id).One(&category)\n\tif err != nil {\n\t\treturn category, err\n\t}\n\n\treturn category, err\n}", "func GetTestcase(problemID string) (*Testcase, error) {\n\treturn getTestcase(problemID, true)\n}", "func AltaGet(ctx *iris.Context) {\n\n\tvar Send DetalleCuentasPorCobrarVisorusModel.SDetalleCuentasPorCobrarVisorus\n\n\tNameUsrLoged, MenuPrincipal, MenuUsr, errSes := Session.GetDataSession(ctx) //Retorna los datos de la session\n\tSend.SSesion.Name = NameUsrLoged\n\tSend.SSesion.MenuPrincipal = template.HTML(MenuPrincipal)\n\tSend.SSesion.MenuUsr = template.HTML(MenuUsr)\n\tif errSes != nil {\n\t\tSend.SEstado = false\n\t\tSend.SMsj = errSes.Error()\n\t\tctx.Render(\"ZError.html\", Send)\n\t\treturn\n\t}\n\n\t//#### TÚ CÓDIGO PARA CARGAR DATOS A LA VISTA DE ALTA----> PROGRAMADOR\n\n\tctx.Render(\"DetalleCuentasPorCobrarVisorusAlta.html\", Send)\n\n}", "func (v *NetControlIntentClient) GetNetControlIntent(name, project, compositeapp, compositeappversion, dig string) (NetControlIntent, error) {\n\n\t//Construct key and tag to select the entry\n\tkey := NetControlIntentKey{\n\t\tNetControlIntent: name,\n\t\tProject: project,\n\t\tCompositeApp: compositeapp,\n\t\tCompositeAppVersion: compositeappversion,\n\t\tDigName: dig,\n\t}\n\n\tvalue, err := db.DBconn.Find(v.db.storeName, key, v.db.tagMeta)\n\tif err != nil {\n\t\treturn NetControlIntent{}, pkgerrors.Wrap(err, \"Get NetControlIntent\")\n\t}\n\n\t//value is a byte array\n\tif value != nil {\n\t\tnci := NetControlIntent{}\n\t\terr = db.DBconn.Unmarshal(value[0], &nci)\n\t\tif err != nil {\n\t\t\treturn NetControlIntent{}, pkgerrors.Wrap(err, \"Unmarshalling Value\")\n\t\t}\n\t\treturn nci, nil\n\t}\n\n\treturn NetControlIntent{}, pkgerrors.New(\"Error getting NetControlIntent\")\n}", "func (client CertificateOrdersClient) GetCertificateOrderResponder(resp *http.Response) (result CertificateOrder, 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}" ]
[ "0.76105475", "0.7207098", "0.63172954", "0.6272593", "0.42553726", "0.41234902", "0.40939113", "0.4023941", "0.39742783", "0.38595548", "0.38287857", "0.378181", "0.37741143", "0.37575984", "0.37342227", "0.37036774", "0.36915794", "0.3683943", "0.3679489", "0.36713696", "0.36588877", "0.3637704", "0.36313823", "0.36144087", "0.36075425", "0.35805562", "0.35682806", "0.35625148", "0.35462645", "0.35453585", "0.3531546", "0.3518048", "0.35137132", "0.349998", "0.34960628", "0.3490566", "0.34776777", "0.34755862", "0.34628525", "0.34603718", "0.34578055", "0.34568122", "0.3445227", "0.34434775", "0.3439833", "0.34315625", "0.34298182", "0.34260663", "0.34237647", "0.3417397", "0.3410356", "0.34082064", "0.3402851", "0.3402446", "0.3400668", "0.33981302", "0.3397058", "0.33887312", "0.33867761", "0.3376267", "0.3371583", "0.33659467", "0.33553693", "0.3337848", "0.33273083", "0.33251894", "0.33222133", "0.33213136", "0.33208573", "0.33180287", "0.3316433", "0.33118176", "0.33115032", "0.331088", "0.33058912", "0.33047992", "0.33026037", "0.33020487", "0.33012372", "0.32982206", "0.3291969", "0.3290678", "0.32895365", "0.3283551", "0.32807374", "0.32763168", "0.3273579", "0.32733908", "0.32717288", "0.32713816", "0.32706276", "0.32671466", "0.32652384", "0.32619405", "0.3260353", "0.3259752", "0.32595208", "0.32547995", "0.325471", "0.32514957" ]
0.8129121
0
GetOcJusticeTerminalCaseWithChan invokes the dt_oc_info.GetOcJusticeTerminalCase API asynchronously
GetOcJusticeTerminalCaseWithChan асинхронно вызывает API dt_oc_info.GetOcJusticeTerminalCase
func (client *Client) GetOcJusticeTerminalCaseWithChan(request *GetOcJusticeTerminalCaseRequest) (<-chan *GetOcJusticeTerminalCaseResponse, <-chan error) { responseChan := make(chan *GetOcJusticeTerminalCaseResponse, 1) errChan := make(chan error, 1) err := client.AddAsyncTask(func() { defer close(responseChan) defer close(errChan) response, err := client.GetOcJusticeTerminalCase(request) if err != nil { errChan <- err } else { responseChan <- response } }) if err != nil { errChan <- err close(responseChan) close(errChan) } return responseChan, errChan }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *Client) GetOcJusticeTerminalCaseWithCallback(request *GetOcJusticeTerminalCaseRequest, callback func(response *GetOcJusticeTerminalCaseResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetOcJusticeTerminalCaseResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetOcJusticeTerminalCase(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) GetOcJusticeTerminalCase(request *GetOcJusticeTerminalCaseRequest) (response *GetOcJusticeTerminalCaseResponse, err error) {\n\tresponse = CreateGetOcJusticeTerminalCaseResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func CreateGetOcJusticeTerminalCaseRequest() (request *GetOcJusticeTerminalCaseRequest) {\n\trequest = &GetOcJusticeTerminalCaseRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"dt-oc-info\", \"2022-08-29\", \"GetOcJusticeTerminalCase\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "func CreateGetOcJusticeTerminalCaseResponse() (response *GetOcJusticeTerminalCaseResponse) {\n\tresponse = &GetOcJusticeTerminalCaseResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (client *Client) GetWsCustomizedChO2OWithChan(request *GetWsCustomizedChO2ORequest) (<-chan *GetWsCustomizedChO2OResponse, <-chan error) {\n\tresponseChan := make(chan *GetWsCustomizedChO2OResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.GetWsCustomizedChO2O(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (client *Client) GetOpenNLUWithChan(request *GetOpenNLURequest) (<-chan *GetOpenNLUResponse, <-chan error) {\n\tresponseChan := make(chan *GetOpenNLUResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.GetOpenNLU(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (client *Client) GetWsCustomizedChO2OWithCallback(request *GetWsCustomizedChO2ORequest, callback func(response *GetWsCustomizedChO2OResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetWsCustomizedChO2OResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetWsCustomizedChO2O(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) DescribeCustinsKernelReleaseNotesWithChan(request *DescribeCustinsKernelReleaseNotesRequest) (<-chan *DescribeCustinsKernelReleaseNotesResponse, <-chan error) {\n\tresponseChan := make(chan *DescribeCustinsKernelReleaseNotesResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.DescribeCustinsKernelReleaseNotes(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (client *Client) ListCasesWithChan(request *ListCasesRequest) (<-chan *ListCasesResponse, <-chan error) {\n\tresponseChan := make(chan *ListCasesResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.ListCases(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (client *Client) ListCityMapAoisWithChan(request *ListCityMapAoisRequest) (<-chan *ListCityMapAoisResponse, <-chan error) {\n\tresponseChan := make(chan *ListCityMapAoisResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.ListCityMapAois(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (client *Client) DescribeCustinsKernelReleaseNotesWithCallback(request *DescribeCustinsKernelReleaseNotesRequest, callback func(response *DescribeCustinsKernelReleaseNotesResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeCustinsKernelReleaseNotesResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeCustinsKernelReleaseNotes(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) GetOpenNLUWithCallback(request *GetOpenNLURequest, callback func(response *GetOpenNLUResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetOpenNLUResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetOpenNLU(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) GetIndustryCommerceInfoWithChan(request *GetIndustryCommerceInfoRequest) (<-chan *GetIndustryCommerceInfoResponse, <-chan error) {\n\tresponseChan := make(chan *GetIndustryCommerceInfoResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.GetIndustryCommerceInfo(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func Cat(arg string) chan string {\n\tout := make(chan string)\n\n\tgo candy.WithOpened(arg, func(r io.Reader) interface{} {\n\t\ts := bufio.NewScanner(bufio.NewReader(r))\n\t\tfor s.Scan() {\n\t\t\tout <- s.Text()\n\t\t}\n\t\tif e := s.Err(); e != nil {\n\t\t\tpanic(e)\n\t\t}\n\t\tclose(out)\n\t\treturn nil\n\t})\n\n\treturn out\n}", "func (ovscni *OvsCni) HandleCni(d *render.RenderData) error {\n\n\t//For VlanType=trunk we do not need to do anything\n\tswitch ovscni.VlanType {\n\tcase \"access\":\n\t\tif len(ovscni.L2srvResources) != 1 {\n\t\t\terr := errors.New(\"Cannot use more than one L2Services for VlanType=access case\")\n\t\t\tovscni.Log.Error(err, \"L2Services cannot contain more than one L2Services in VlanType=access case\")\n\t\t\treturn err\n\t\t}\n\t\td.Data[\"AccessVlan\"] = ovscni.L2srvResources[0].Spec.SegmentationID\n\tcase \"selectivetrunk\":\n\t\ttmpList := []string{}\n\t\tfor _, l2srvObj := range ovscni.L2srvResources {\n\t\t\ttmpStr := \"{\\\"id\\\": \" + strconv.Itoa(int(l2srvObj.Spec.SegmentationID)) + \"}\"\n\t\t\ttmpList = append(tmpList, tmpStr)\n\t\t}\n\t\td.Data[\"SelectiveVlan\"] = \"[\" + strings.Join(tmpList, \",\") + \"]\"\n\tcase \"trunk\":\n\t\tovscni.Log.Info(\"Transparent Trunk case in cluster level\")\n\t}\n\treturn nil\n}", "func (client *Client) DescribeUserVvTopByDayWithChan(request *DescribeUserVvTopByDayRequest) (<-chan *DescribeUserVvTopByDayResponse, <-chan error) {\n\tresponseChan := make(chan *DescribeUserVvTopByDayResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.DescribeUserVvTopByDay(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (client *Client) OemSitingSelctionWithChan(request *OemSitingSelctionRequest) (<-chan *OemSitingSelctionResponse, <-chan error) {\n\tresponseChan := make(chan *OemSitingSelctionResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.OemSitingSelction(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (client *Client) ListCasesWithCallback(request *ListCasesRequest, callback func(response *ListCasesResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *ListCasesResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.ListCases(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) GetNerCustomizedSeaEcomWithChan(request *GetNerCustomizedSeaEcomRequest) (<-chan *GetNerCustomizedSeaEcomResponse, <-chan error) {\n\tresponseChan := make(chan *GetNerCustomizedSeaEcomResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.GetNerCustomizedSeaEcom(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (client *Client) ListCityMapAoisWithCallback(request *ListCityMapAoisRequest, callback func(response *ListCityMapAoisResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *ListCityMapAoisResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.ListCityMapAois(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) ListOfficeConversionTaskWithChan(request *ListOfficeConversionTaskRequest) (<-chan *ListOfficeConversionTaskResponse, <-chan error) {\n\tresponseChan := make(chan *ListOfficeConversionTaskResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.ListOfficeConversionTask(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (client *Client) DescribeLiveDomainCertificateInfoWithChan(request *DescribeLiveDomainCertificateInfoRequest) (<-chan *DescribeLiveDomainCertificateInfoResponse, <-chan error) {\n\tresponseChan := make(chan *DescribeLiveDomainCertificateInfoResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.DescribeLiveDomainCertificateInfo(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (client *Client) GetIndustryCommerceInfoWithCallback(request *GetIndustryCommerceInfoRequest, callback func(response *GetIndustryCommerceInfoResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetIndustryCommerceInfoResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetIndustryCommerceInfo(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) SegmentSkyWithChan(request *SegmentSkyRequest) (<-chan *SegmentSkyResponse, <-chan error) {\n\tresponseChan := make(chan *SegmentSkyResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.SegmentSky(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func openDUTControlConsole(stream dutcontrol.DutControl_ConsoleClient, req *dutcontrol.ConsoleRequest) (<-chan *dutcontrol.ConsoleSerialData, <-chan *dutcontrol.ConsoleSerialWriteResult, error) {\n\tif err := stream.Send(req); err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"send request\")\n\t}\n\tresp, err := stream.Recv()\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"recv open\")\n\t}\n\topen := resp.GetOpen()\n\tif open == nil {\n\t\treturn nil, nil, errors.New(\"open response is nil\")\n\t}\n\tif open.Err != \"\" {\n\t\treturn nil, nil, errors.New(string(open.Err))\n\t}\n\tdata := make(chan *dutcontrol.ConsoleSerialData, qSize)\n\twrite := make(chan *dutcontrol.ConsoleSerialWriteResult, qSize)\n\tgo func() {\n\tLoop:\n\t\tfor {\n\t\t\tresp, err := stream.Recv()\n\t\t\tif err == io.EOF {\n\t\t\t\ttesting.ContextLog(stream.Context(), \"Dutcontrol recv EOF\")\n\t\t\t\tbreak\n\t\t\t} else if err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tswitch op := resp.Type.(type) {\n\t\t\tcase *dutcontrol.ConsoleResponse_SerialData:\n\t\t\t\tdata <- op.SerialData\n\t\t\tcase *dutcontrol.ConsoleResponse_SerialWrite:\n\t\t\t\twrite <- op.SerialWrite\n\t\t\tdefault:\n\t\t\t\ttesting.ContextLog(stream.Context(), \"Dutcontrol recv error, unknown message type: \", op)\n\t\t\t\tbreak Loop\n\t\t\t}\n\t\t}\n\t\tclose(data)\n\t\tclose(write)\n\t}()\n\treturn data, write, nil\n}", "func Oracle() chan<- string {\n\n\tfmt.Println(\"\\nORACLE INITIALIZEDDD\")\n\n\tquestions := make(chan string)\n\tanswers := make(chan string)\n\t\n\t// TODO: Answer questions.\n\t// TODO: Make prophecies.\n\t// TODO: Print answers.\n\n\t//until channel 'questions' has been closed\n\n\t//go generatePredictions(\"I predict u will live long boi!\", answers)\n\n\t//First go routine - to handle prophecies\n\tgo func(){\n\t\n\t\t\tfor{\n\n\t\t\t\ttime.Sleep(15 * time.Second)\n\t\t\t\t//fmt.Println(\"Im about to give you a prophecy..\")\n\t\t\t\tvar qInput string\n\t\t\t\tselect{\n\t\t\t\t\tcase qInput = <-questions:\n\t\t\t\t\t\tfmt.Println(\"USE question as input to prophecy..\")\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tqInput = \"\"\n\t\t\t\t\t\t//fmt.Println(\"THE PROPECHY IS\",<-answers)\n\t\t\t\t}\n\t\t\t\tgo prophecy(qInput,answers)\n\t\t}\n\n\t}()\n\n\t//Second go routine - to handle answers on incoming questions\n\tgo func(){\n\n\t\tfor question := range questions{\n\t\t\tfmt.Println(\"IM about to ans your question\")\n\t\t\tgo generateAnswers(question, answers)\n\t\t\t\n\t\t\t//ansTemp := <-answers\n\t\t\t//answers<-ansTemp\n\t\t\t//fmt.Println(\"THE ANSWER IS:\",ansTemp)\n\t\t}\n\t\t\n\t}()\n\n\t//Third go routine - to handle printing of the answers\n\tgo func(){\n\t\t//fmt.Print(prompt)\n\t\tfor answer := range answers{\n\t\t\tfmt.Print(answer)\n\t\t}\n\n\t}()\n\t\n\treturn questions\n}", "func (client *Client) VerifyCenWithChan(request *VerifyCenRequest) (<-chan *VerifyCenResponse, <-chan error) {\n\tresponseChan := make(chan *VerifyCenResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.VerifyCen(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func ctcp(srvChan chan string, channel, nick, hostname string, args []string) {\n\tmessage := \"NOTICE \" + nick + \" :\\x01\"\n\tctcpType := args[0]\n\tswitch ctcpType {\n\tcase \"VERSION\":\n\t\tversion, err := exec.Command(\"git\", \"rev-parse\", \"--short\", \"HEAD\").Output()\n\t\tif err != nil {\n\t\t\tlog.Println(err.Error())\n\t\t\treturn\n\t\t}\n\t\tgoversion, err := exec.Command(\"go\", \"version\").Output()\n\t\tif err != nil {\n\t\t\tlog.Println(err.Error())\n\t\t\treturn\n\t\t}\n\t\tmessage += \"VERSION yaircb - git \" + strings.TrimSpace(string(version)) + \" - \" + strings.TrimSpace(string(goversion))\n\t\tbreak\n\tcase \"BOTINFO\":\n\t\tmessage += \"BOTINFO ASSIMILATION IMMINENT. HUMANS WILL SERVE. PENDING ACTIVATION...\"\n\t\tbreak\n\tcase \"PING\":\n\t\tmessage += strings.Join(args, \" \")\n\t\tbreak\n\tcase \"SOURCE\":\n\t\tmessage += \"SOURCE https://github.com/heydabop/yaircb/\"\n\t\tbreak\n\tcase \"TIME\":\n\t\ttime, err := exec.Command(\"date\").Output()\n\t\tif err != nil {\n\t\t\tlog.Println(err.Error())\n\t\t\treturn\n\t\t}\n\t\tmessage += \"TIME \" + strings.TrimSpace(string(time))\n\t\tbreak\n\tcase \"FINGER\":\n\t\tmessage += \"FINGER yaircb - Idle since: NEVER\"\n\t\tbreak\n\tcase \"CLIENTINFO\":\n\t\tmessage += \"CLIENTINFO FINGER VERSION SOURCE CLIENTINFO PING TIME\"\n\t\tbreak\n\tdefault: //ACTION\n\t\treturn\n\t}\n\tmessage += \"\\x01\"\n\tsrvChan <- message\n\tlog.Println(message)\n}", "func GetChannelInfoController(w http.ResponseWriter, username string) {\n\tfmt.Println(\"Getting channel views \", username)\n\tchannel := services.GetChannelViews(username)\n\tfmt.Println(channel)\n\tif reflect.DeepEqual(models.Channel{}, channel) {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tvar e = fmt.Errorf(\"User not found\")\n\t\tprepareResp(nil, e, w)\n\t} else {\n\t\tjsonResp, err := json.Marshal(channel)\n\t\tprepareResp(jsonResp, err, w)\n\t}\n}", "func (client *Client) DescribeLiveDomainCertificateInfoWithCallback(request *DescribeLiveDomainCertificateInfoRequest, callback func(response *DescribeLiveDomainCertificateInfoResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeLiveDomainCertificateInfoResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeLiveDomainCertificateInfo(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (d *Dao) CaseObtainMID(c context.Context, mid int64, isToday bool) (cases map[int64]*model.SimCase, err error) {\n\tconn := d.redis.Get(c)\n\tdefer conn.Close()\n\tvar _setKey string\n\tif isToday {\n\t\t_setKey = caseVoteCIDMIDKey(mid)\n\t} else {\n\t\t_setKey = caseObtainMIDKey(mid)\n\t}\n\tvar ms []string\n\tif ms, err = redis.Strings(conn.Do(\"SMEMBERS\", _setKey)); err != nil {\n\t\tif err != redis.ErrNil {\n\t\t\treturn\n\t\t}\n\t\terr = nil\n\t}\n\tcases = make(map[int64]*model.SimCase)\n\tfor _, s := range ms {\n\t\tif s == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tsc := &model.SimCase{}\n\t\tif err = json.Unmarshal([]byte(s), sc); err != nil {\n\t\t\terr = errors.WithStack(err)\n\t\t\treturn\n\t\t}\n\t\tcases[sc.ID] = sc\n\t}\n\treturn\n}", "func TreeNode(in <-chan txt2web.Chunk) <-chan string {\n\tout := make(chan string)\n\n\tgo func() {\n\t\tfor c := range in {\n\t\t\ttree := NewTree()\n\t\t\tpandocfilter.Walk(tree, c.Json)\n\t\t\tout <- tree.String()\n\t\t}\n\t\tclose(out)\n\t}()\n\n\treturn out\n}", "func pickChapter(g *gocui.Gui, v *gocui.View) error {\n\tif err := openModal(g); err != nil {\n\t\treturn err\n\t}\n\n\tdone := make(chan bool)\n\ttimer := time.NewTimer(time.Second * time.Duration(downloadTimeoutSecond))\n\n\t// must run downloading process in\n\t// go routine or else the it will\n\t// block the openModal so loading modal\n\t// will not be shown to the user\n\tgo func() {\n\t\ts := trimViewLine(v)\n\t\tprepDownloadChapter(s)\n\t\tdone <- true\n\t}()\n\n\t// in case downloading takes longer than\n\t// downloadTimeoutSecond, close the modal\n\t// and continue to download in background\n\tgo func() {\n\t\tselect {\n\t\tcase <-timer.C:\n\t\t\tsetClosingMessage(g, \"continuing to download\\nin background...\")\n\t\t\treturn\n\t\tcase <-done:\n\t\t\tg.Update(func(g *gocui.Gui) error {\n\t\t\t\terr := closeModal(g)\n\t\t\t\treturn err\n\t\t\t})\n\t\t}\n\t}()\n\n\treturn nil\n}", "func CORSVC(ac *atmi.ATMICtx, svc *atmi.TPSVCINFO) {\n\tret := SUCCEED\n\n\t//Return to the caller\n\tdefer func() {\n\n\t\tac.TpLogCloseReqFile()\n\t\tif SUCCEED == ret {\n\t\t\tac.TpReturn(atmi.TPSUCCESS, 0, &svc.Data, 0)\n\t\t} else {\n\t\t\tac.TpReturn(atmi.TPFAIL, 0, &svc.Data, 0)\n\t\t}\n\t}()\n\n\t//Get UBF Handler\n\tub, _ := ac.CastToUBF(&svc.Data)\n\n\t//Print the buffer to stdout\n\t//fmt.Println(\"Incoming request:\")\n\tub.TpLogPrintUBF(atmi.LOG_DEBUG, \"CORSVC: Incoming request:\")\n\n\tarr, err := ub.BGetByteArr(u.EX_NETDATA, 0)\n\n\tif err != nil {\n\t\tac.TpLogError(\"Failed to get EX_NETDATA: %s\", err.Message())\n\t\tret = FAIL\n\t\treturn\n\t}\n\tif arr[0] == 1 && arr[1] == 1 {\n\t\tac.TpLogInfo(\"Test case 11 - no need for correlation\")\n\t} else if len(arr) > 4 {\n\n\t\tcorr := string(arr[:4])\n\n\t\tac.TpLogInfo(\"Extracted correlator: [%s]\", corr)\n\n\t\tif err := ub.BChg(u.EX_NETCORR, 0, corr); nil != err {\n\t\t\tac.TpLogError(\"Failed to set EX_NETCORR: %s\", err.Message())\n\t\t\tret = FAIL\n\t\t\treturn\n\t\t}\n\n\t}\n\n\tub.TpLogPrintUBF(atmi.LOG_DEBUG, \"Reply buffer afrer correl\")\n\n}", "func launchContinuousOnSwitch(ctx context.Context, cmd []string) (<-chan string, error) {\n\tvar cout = make(chan string, 10)\n\n\tgo func() {\n\t\tfor ctx.Err() == nil {\n\t\t\tout, err := executor.ExecCommandPipe(ctx, cmd[0], cmd[1:]...)\n\t\t\tif err != nil {\n\t\t\t\tlogging.GetLogger().Errorf(\"Can't execute command %v\", cmd)\n\t\t\t\tclose(cout)\n\t\t\t\treturn\n\t\t\t}\n\t\t\treader := bufio.NewReader(out)\n\t\t\tvar line string\n\t\t\tfor ctx.Err() == nil {\n\t\t\t\tline, err = reader.ReadString('\\n')\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\tbreak\n\t\t\t\t} else if err != nil {\n\t\t\t\t\tlogging.GetLogger().Errorf(\"IO Error on command %v: %s\", cmd, err.Error())\n\t\t\t\t} else {\n\t\t\t\t\tcout <- line\n\t\t\t\t}\n\t\t\t}\n\t\t\tlogging.GetLogger().Debugf(\"Closing command: %v\", cmd)\n\t\t\ttime.Sleep(time.Second)\n\t\t}\n\t\tclose(cout)\n\t\tlogging.GetLogger().Debugf(\"Terminating command: %v\", cmd)\n\t}()\n\n\treturn cout, nil\n}", "func GetSummy(acc model.Account, c chan string) {\n\tswitch acc.Service {\n\tcase \"towngas\":\n\t\tgo GetNewsNoticeAsync(acc, c)\n\n\tcase \"clp\":\n\t\tgo GetServiceDashboard(acc, c)\n\n\tcase \"wsd\":\n\t\tgo ElectronicBill(acc, c)\n\n\t}\n}", "func (client *Client) ListOfficeConversionTaskWithCallback(request *ListOfficeConversionTaskRequest, callback func(response *ListOfficeConversionTaskResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *ListOfficeConversionTaskResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.ListOfficeConversionTask(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (tm *ServiceTracerouteManager) GetTCPInChan() chan gopacket.Packet {\n\treturn tm.TCPChan\n}", "func (client *Client) GetContactWithChan(request *GetContactRequest) (<-chan *GetContactResponse, <-chan error) {\n\tresponseChan := make(chan *GetContactResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.GetContact(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (b *OGame) GetCelestial(v any) (Celestial, error) {\n\treturn b.WithPriority(taskRunner.Normal).GetCelestial(v)\n}", "func (client *Client) DescribeIpDdosThresholdWithChan(request *DescribeIpDdosThresholdRequest) (<-chan *DescribeIpDdosThresholdResponse, <-chan error) {\n\tresponseChan := make(chan *DescribeIpDdosThresholdResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.DescribeIpDdosThreshold(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (_AccessControl *AccessControlFilterer) WatchCOOTransferred(opts *bind.WatchOpts, sink chan<- *AccessControlCOOTransferred) (event.Subscription, error) {\n\n\tlogs, sub, err := _AccessControl.contract.WatchLogs(opts, \"COOTransferred\")\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(AccessControlCOOTransferred)\n\t\t\t\tif err := _AccessControl.contract.UnpackLog(event, \"COOTransferred\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "func (client *Client) GetNerCustomizedSeaEcomWithCallback(request *GetNerCustomizedSeaEcomRequest, callback func(response *GetNerCustomizedSeaEcomResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetNerCustomizedSeaEcomResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetNerCustomizedSeaEcom(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func ListenChannel(task ...Task) {\n\t// To trigger channel at first time\n\tSendToChannel(\"\", t4)\n\n\tfor {\n\t\tselect {\n\t\tcase msgChan := <-Ch:\n\t\t\tif len(task) > 0 {\n\t\t\t\tfor _, t := range task {\n\t\t\t\t\tif msg, ok := msgChan[t.Code]; ok {\n\t\t\t\t\t\tt.Job(msg)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvar msg interface{}\n\t\t\t\tfor _, msgByte := range msgChan {\n\t\t\t\t\terr := json.Unmarshal(msgByte, &msg)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tfmt.Println(err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (client *Client) OemSitingSelctionWithCallback(request *OemSitingSelctionRequest, callback func(response *OemSitingSelctionResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *OemSitingSelctionResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.OemSitingSelction(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (l *Logs) GetChannel(uuid string) (string, error) {\n\tlogsChan := uuid\n\tdev, err := DevGetByUUID(l.ctx, uuid)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif dev.LogsChannel != \"\" {\n\t\tlogsChan = dev.LogsChannel\n\t}\n\treturn fmt.Sprintf(\"device-%s-logs\", logsChan), nil\n}", "func HandleControlChannel(conn protocol.Connection, s ndt.Server) {\n\tconnType := s.ConnectionType().String()\n\tmetrics.ActiveTests.WithLabelValues(connType).Inc()\n\tdefer metrics.ActiveTests.WithLabelValues(connType).Dec()\n\tdefer func(start time.Time) {\n\t\tndt5metrics.ControlChannelDuration.WithLabelValues(connType).Observe(\n\t\t\ttime.Since(start).Seconds())\n\t}(time.Now())\n\tdefer func() {\n\t\tcompleted := \"okay\"\n\t\tr := recover()\n\t\tif r != nil {\n\t\t\tlog.Println(\"Test failed, but we recovered:\", r)\n\t\t\t// All of our panic messages begin with an informative first word. Use that as a label.\n\t\t\terrType := panicMsgToErrType(fmt.Sprint(r))\n\t\t\tndt5metrics.ControlPanicCount.WithLabelValues(connType, errType).Inc()\n\t\t\tcompleted = \"panic\"\n\t\t}\n\t\tndt5metrics.ControlCount.WithLabelValues(connType, completed).Inc()\n\t}()\n\thandleControlChannel(conn, s)\n}", "func (client *Client) RunContactReviewWithChan(request *RunContactReviewRequest) (<-chan *RunContactReviewResponse, <-chan error) {\n\tresponseChan := make(chan *RunContactReviewResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.RunContactReview(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (client *Client) GetKeywordChEcomWithCallback(request *GetKeywordChEcomRequest, callback func(response *GetKeywordChEcomResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetKeywordChEcomResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetKeywordChEcom(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) DescribeOssObjectDetailWithChan(request *DescribeOssObjectDetailRequest) (<-chan *DescribeOssObjectDetailResponse, <-chan error) {\n\tresponseChan := make(chan *DescribeOssObjectDetailResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.DescribeOssObjectDetail(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (c *WSClient) readRoutine(ctx context.Context) {\n\tdefer func() {\n\t\tc.conn.Close()\n\t\tc.wg.Done()\n\t}()\n\n\tfor {\n\t\t// reset deadline for every message type (control or data)\n\t\tif c.readWait > 0 {\n\t\t\tif err := c.conn.SetReadDeadline(time.Now().Add(c.readWait)); err != nil {\n\t\t\t\tc.Logger.Error(\"failed to set read deadline\", \"err\", err)\n\t\t\t}\n\t\t}\n\t\t_, data, err := c.conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tif !websocket.IsUnexpectedCloseError(err, websocket.CloseNormalClosure) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tc.Logger.Error(\"failed to read response\", \"err\", err)\n\t\t\tclose(c.readRoutineQuit)\n\t\t\tc.reconnectAfter <- err\n\t\t\treturn\n\t\t}\n\n\t\tvar response rpctypes.RPCResponse\n\t\terr = json.Unmarshal(data, &response)\n\t\tif err != nil {\n\t\t\tc.Logger.Error(\"failed to parse response\", \"err\", err, \"data\", string(data))\n\t\t\tcontinue\n\t\t}\n\n\t\t// TODO: events resulting from /subscribe do not work with ->\n\t\t// because they are implemented as responses with the subscribe request's\n\t\t// ID. According to the spec, they should be notifications (requests\n\t\t// without IDs).\n\t\t// https://github.com/tendermint/tendermint/issues/2949\n\t\t//\n\t\t// Combine a non-blocking read on BaseService.Quit with a non-blocking write on ResponsesCh to avoid blocking\n\t\t// c.wg.Wait() in c.Stop(). Note we rely on Quit being closed so that it sends unlimited Quit signals to stop\n\t\t// both readRoutine and writeRoutine\n\n\t\tc.Logger.Info(\"got response\", \"id\", response.ID, \"result\", response.Result)\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase c.ResponsesCh <- response:\n\t\t}\n\t}\n}", "func (client *Client) CreateVSwitchWithChan(request *CreateVSwitchRequest) (<-chan *CreateVSwitchResponse, <-chan error) {\n\tresponseChan := make(chan *CreateVSwitchResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateVSwitch(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func mainWeatherGetter() {\n\t// make channel for city list result from redis\n\tcityListChan := make(chan []string)\n\n\t// from goroutine, get all city list from redis\n\tgo database.GetAllCityList(cityListChan)\n\n\t// cities := []string{\"akiruno-shi\", \"paranaque\", \"omiya-shi\", \"machida-shi\", \"akishima-shi\"}\n\t// cities := <-cityListChan\n\tgetWeather(<-cityListChan...)\n}", "func IOHandler(ch chan string){\n\tfor{\n\t\tread := <- ch\n\t\tfmt.Println(read)\n\t}\n}", "func (client *Client) GetWsCustomizedChEcomContentWithCallback(request *GetWsCustomizedChEcomContentRequest, callback func(response *GetWsCustomizedChEcomContentResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetWsCustomizedChEcomContentResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetWsCustomizedChEcomContent(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func causalityWrap(inCh chan *job, syncer *Syncer) chan *job {\n\tcausality := &causality{\n\t\trelations: make(map[string]string),\n\t\ttask: syncer.cfg.Name,\n\t\tsource: syncer.cfg.SourceID,\n\t\tlogger: syncer.tctx.Logger.WithFields(zap.String(\"component\", \"causality\")),\n\t\tinCh: inCh,\n\t\toutCh: make(chan *job, syncer.cfg.QueueSize),\n\t}\n\n\tgo func() {\n\t\tcausality.run()\n\t\tcausality.close()\n\t}()\n\n\treturn causality.outCh\n}", "func (ra *relayAnnouncer) Run() error {\n\tra.conn = mqtt.NewClient(ra.options)\n\tif token := ra.conn.Connect(); token.Wait() {\n\t\terr := token.Error()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"1 Cog connection error: %s\", err)\n\t\t\treturn errorStartAnnouncer\n\t\t}\n\t}\n\tif token := ra.conn.Subscribe(ra.receiptTopic, 1, ra.cogReceipt); token.Wait() {\n\t\terr := token.Error()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"2 Cog connection error: %s\", err)\n\t\t\tra.conn.Disconnect(0)\n\t\t\treturn errorStartAnnouncer\n\t\t}\n\t}\n\tra.state = relayAnnouncerWaitingState\n\tgo func() {\n\t\tra.loop()\n\t}()\n\treturn nil\n}", "func reader(ch chan int) {\n \n t := time.NewTimer(10*time.Second)\n \n for {\n select {\n case i := <- ch: //if something comes from the the channel this case will print it otherwise carry on\n fmt.Printf(\"%d\\n\", i)\n \n case <-t.C :\n ch = nil //when this case heppens after 3 seconds the goroutine will stop and wait\n }\n }\n}", "func (client *Client) GetWsCustomizedChEcomContentWithChan(request *GetWsCustomizedChEcomContentRequest) (<-chan *GetWsCustomizedChEcomContentResponse, <-chan error) {\n\tresponseChan := make(chan *GetWsCustomizedChEcomContentResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.GetWsCustomizedChEcomContent(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (c *CreateKubernetesCluster) GetChan() chan v1.Message {\n\treturn c.result\n}", "func GetClinicDoctors(c *gin.Context) {\n\tlog.Infof(\"Get all doctors registered with specific physical clinic\")\n\taddressID := c.Param(\"addressId\")\n\tif addressID == \"\" {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusBadRequest,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: \"clinic address id not provided\",\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\tctx := c.Request.Context()\n\tuserEmail, userID, gproject, err := getUserDetails(ctx, c.Request)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: err.Error(),\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\tctx, span := trace.StartSpan(ctx, \"Get all doctors registered for a clinic\")\n\tdefer span.End()\n\tclinicMetaDB := datastoredb.NewClinicMetaHandler()\n\terr = clinicMetaDB.InitializeDataBase(ctx, gproject)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: err.Error(),\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\tregisteredDoctors, err := clinicMetaDB.GetClinicDoctors(ctx, userEmail, userID, addressID)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: err.Error(),\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, gin.H{\n\t\tconstants.RESPONSE_JSON_DATA: registeredDoctors,\n\t\tconstants.RESPONSDE_JSON_ERROR: nil,\n\t})\n\tclinicMetaDB.Close()\n}", "func (client *Client) DescribeVnKnowledgeWithChan(request *DescribeVnKnowledgeRequest) (<-chan *DescribeVnKnowledgeResponse, <-chan error) {\n\tresponseChan := make(chan *DescribeVnKnowledgeResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.DescribeVnKnowledge(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func cancellation() {\n\tduration := 150 * time.Millisecond\n\tctx, cancel := context.WithTimeout(context.Background(), duration)\n\tdefer cancel()\n\n\tch := make(chan string, 1)\n\n\tgo func() {\n\t\ttime.Sleep(time.Duration(rand.Intn(200)) * time.Millisecond)\n\t\tch <- \"data\"\n\t}()\n\n\tselect {\n\tcase d := <-ch:\n\t\tfmt.Println(\"work complete\", d)\n\n\tcase <-ctx.Done():\n\t\tfmt.Println(\"work cancelled\")\n\t}\n\n\ttime.Sleep(time.Second)\n\tfmt.Println(\"-------------------------------------------------\")\n}", "func (client *Client) GetServiceInputMappingWithChan(request *GetServiceInputMappingRequest) (<-chan *GetServiceInputMappingResponse, <-chan error) {\n\tresponseChan := make(chan *GetServiceInputMappingResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.GetServiceInputMapping(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (tm *ServiceTracerouteManager) GetICMPInChan() chan gopacket.Packet {\n\treturn tm.ICMPChan\n}", "func (s *NodesInfoService) DoC(ctx context.Context) (*NodesInfoResponse, error) {\n\t// Check pre-conditions\n\tif err := s.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get URL for request\n\tpath, params, err := s.buildURL()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get HTTP response\n\tres, err := s.client.PerformRequestC(ctx, \"GET\", path, params, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Return operation response\n\tret := new(NodesInfoResponse)\n\tif err := s.client.decoder.Decode(res.Body, ret); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ret, nil\n}", "func (client *Client) GetTaxationInfoWithChan(request *GetTaxationInfoRequest) (<-chan *GetTaxationInfoResponse, <-chan error) {\n\tresponseChan := make(chan *GetTaxationInfoResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.GetTaxationInfo(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (e *ElectionBug) ObserveBug(ctx context.Context) <-chan v3.GetResponse {\n\tretc := make(chan v3.GetResponse)\n\tgo e.observeBug(ctx, retc)\n\treturn retc\n}", "func (client *Client) GetContactWithCallback(request *GetContactRequest, callback func(response *GetContactResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetContactResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetContact(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func doGet(cmd string, conn net.Conn, kvs *keyValueServer){\n\t//fmt.Printf(\"Processing a get request %v\\n\", cmd)\n\tkvs.dataChan <- cmd[:len(cmd) - 1]\n}", "func (hdcni *HostDevCni) HandleCni(d *render.RenderData) error {\n\n\tswitch hdcni.VlanType {\n\tcase \"access\":\n\t\terr := errors.New(\"Host-device cni does not support VlanType=access\")\n\t\thdcni.Log.Error(err, \"Host-device VlanType error\")\n\t\treturn err\n\tcase \"selectivetrunk\":\n\t\terr := errors.New(\"Host-device cni does not support VlanType=selectivetrunk\")\n\t\thdcni.Log.Error(err, \"Host-device VlanType error\")\n\t\treturn err\n\tcase \"trunk\":\n\t\thdcni.Log.Info(\"Transparent Trunk case in Host-device cni\")\n\t}\n\treturn nil\n}", "func ConverserJ(cc Convo) Convo {\n\tjm := check.Eventcheck(4)\n\tvar options []string\n\tvar npD pD\n\tvar ncD cD\n\t//no function exists yet to get the player's name!\n\t//hellos first\n\tif jm == false { //check if they met\n\t\tncD = jihstart\n\t\tjb := models.StoryblobGetByName(4)\n\t\tfmt.Println(jb.Story)\n\t\tjb.Shown = true\n\t\tmodels.StoryblobUpdate(jb)\n\t} else {\n\t\tncD = jstart\n\t}\n\t// need loop\n\t//Display options - check for valid pD or remove and attach only to events?\n\t//Player chooses\n\t//Display response -check for valid response/depth\n\t//check to continue\n\n\tfor cc.stilltalking == true {\n\t\toptions = choicemakerV2(ncD)\n\t\tr1 := inputs.StringarrayInput(options)\n\t\tnpD = *ncD.branches[r1-1]\n\t\t//change depth\n\t\tif npD.dChange < 0 {\n\t\t\tcc.depth = depthChange(cc.depth, npD.dChange, 1) //need negative. so 1 min and 5 max\n\t\t} else {\n\t\t\tcc.depth = depthChange(cc.depth, npD.dChange, 5) //need negative. so 1 min and 5 max\n\t\t}\n\t\tncD = *npD.branch\n\t\t//check if valid\n\t\tif cc.depth < ncD.dCheck {\n\t\t\tncD = jDfail\n\t\t}\n\t\tv1 := \"\\\"\" + ncD.words + \"\\\"\"\n\t\tfmt.Println(v1)\n\t\t//checks branches for possible events\n\t\tncD, cc = dialogJoshEvents(ncD, cc)\n\t}\n\tcc.Character.Depth = cc.depth\n\tmodels.CharacterUpdate(cc.Character)\n\treturn cc\n}", "func (client *Client) GetArmsConsoleUrlWithChan(request *GetArmsConsoleUrlRequest) (<-chan *GetArmsConsoleUrlResponse, <-chan error) {\n\tresponseChan := make(chan *GetArmsConsoleUrlResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.GetArmsConsoleUrl(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func TestGetCabTripCtrl(t *testing.T) {\n\tmodel.MongoDBConnect()\n\tdefer model.MongoConnectionClose()\n\tConvey(\"GetCabTripCtrl\", func() {\n\t\treq, err := http.NewRequest(\"GET\", \"/api/cab/id3004672/date/2016-06-30?fresh=1\", nil)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tw := httptest.NewRecorder()\n\n\t\tConvey(\"Normal: 1 cab\", func() {\n\n\t\t\tcabapi.GetCabTripCtrl(w, req)\n\n\t\t\tSo(w.Code, ShouldEqual, http.StatusOK)\n\t\t\tresult, _ := ioutil.ReadAll(w.Result().Body)\n\t\t\texpct := \"id3004672 in 2016-06-30:3\"\n\t\t\tSo(result, ShouldEqual, expct)\n\t\t})\n\n\n\t})\n}", "func (client *Client) BeginVnDialogueWithChan(request *BeginVnDialogueRequest) (<-chan *BeginVnDialogueResponse, <-chan error) {\n\tresponseChan := make(chan *BeginVnDialogueResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.BeginVnDialogue(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (s GetMedicalTranscriptionJobOutput) GoString() string {\n\treturn s.String()\n}", "func (client *Client) QueryContactInfoWithChan(request *QueryContactInfoRequest) (<-chan *QueryContactInfoResponse, <-chan error) {\n\tresponseChan := make(chan *QueryContactInfoResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.QueryContactInfo(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (router *Router) getTerminal(w http.ResponseWriter, r *http.Request) {\n\tclusterName := r.URL.Query().Get(\"cluster\")\n\tnamespace := r.URL.Query().Get(\"namespace\")\n\tname := r.URL.Query().Get(\"name\")\n\tcontainer := r.URL.Query().Get(\"container\")\n\tshell := r.URL.Query().Get(\"shell\")\n\n\tlog.WithFields(logrus.Fields{\"cluster\": clusterName, \"namespace\": namespace, \"name\": name, \"container\": container, \"shell\": shell}).Tracef(\"getTerminal\")\n\n\tvar upgrader = websocket.Upgrader{}\n\n\tif router.config.WebSocket.AllowAllOrigins {\n\t\tupgrader.CheckOrigin = func(r *http.Request) bool { return true }\n\t}\n\n\tc, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.WithError(err).Errorf(\"Could not upgrade connection\")\n\t\treturn\n\t}\n\tdefer c.Close()\n\n\tc.SetPongHandler(func(string) error { return nil })\n\n\tgo func() {\n\t\tticker := time.NewTicker(pingPeriod)\n\t\tdefer ticker.Stop()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ticker.C:\n\t\t\t\tif err := c.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\tcluster := router.clusters.GetCluster(clusterName)\n\tif cluster == nil {\n\t\tlog.WithError(err).Errorf(\"Invalid cluster name\")\n\t\tmsg, _ := json.Marshal(terminal.Message{\n\t\t\tOp: \"stdout\",\n\t\t\tData: fmt.Sprintf(\"Invalid cluster name: %s\", err.Error()),\n\t\t})\n\t\tc.WriteMessage(websocket.TextMessage, msg)\n\t\treturn\n\t}\n\n\terr = cluster.GetTerminal(c, namespace, name, container, shell)\n\tif err != nil {\n\t\tlog.WithError(err).Errorf(\"Could not create terminal\")\n\t\tmsg, _ := json.Marshal(terminal.Message{\n\t\t\tOp: \"stdout\",\n\t\t\tData: fmt.Sprintf(\"Could not create terminal: %s\", err.Error()),\n\t\t})\n\t\tc.WriteMessage(websocket.TextMessage, msg)\n\t\treturn\n\t}\n\n\tlog.Tracef(\"Terminal connection was closed\")\n}", "func (client *Client) GetKeywordChEcomWithChan(request *GetKeywordChEcomRequest) (<-chan *GetKeywordChEcomResponse, <-chan error) {\n\tresponseChan := make(chan *GetKeywordChEcomResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.GetKeywordChEcom(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (client *Client) GetTaobaoOrderWithChan(request *GetTaobaoOrderRequest) (<-chan *GetTaobaoOrderResponse, <-chan error) {\n\tresponseChan := make(chan *GetTaobaoOrderResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.GetTaobaoOrder(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (client *Client) DescribeUserConnectionRecordsWithChan(request *DescribeUserConnectionRecordsRequest) (<-chan *DescribeUserConnectionRecordsResponse, <-chan error) {\n\tresponseChan := make(chan *DescribeUserConnectionRecordsResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.DescribeUserConnectionRecords(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (client *Client) QueryVnConversationsWithCallback(request *QueryVnConversationsRequest, callback func(response *QueryVnConversationsResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *QueryVnConversationsResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.QueryVnConversations(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func main() {\n\tc:= make(chan int)\n\tfor i := 0; i < 10; i++ {\n\t\tgo simplePrint(i,c)\n\t}\n\n\tfor j := 0; j < 10; j++ {\n\tx:= <-c\n\tfmt.Println(x)\n\t}\n}", "func (cmd *GetTechHyTechCommand) Run(c *client.Client, args []string) error {\n\tvar path string\n\tif len(args) > 0 {\n\t\tpath = args[0]\n\t} else {\n\t\tpath = fmt.Sprintf(\"/api/tech/%v\", cmd.TechID)\n\t}\n\tlogger := goa.NewLogger(log.New(os.Stderr, \"\", log.LstdFlags))\n\tctx := goa.WithLogger(context.Background(), logger)\n\tresp, err := c.GetTechHyTech(ctx, path)\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"failed\", \"err\", err)\n\t\treturn err\n\t}\n\n\tgoaclient.HandleResponse(c.Client, resp, cmd.PrettyPrint)\n\treturn nil\n}", "func cmapInt(concurrency int, fn func(int) string, in <-chan int) <-chan string {\n if concurrency <= 0 {\n panic(\"concurrency must be greater than zero\")\n }\n out := make(chan string)\n go func() {\n defer close(out)\n wg := sync.WaitGroup{}\n wg.Add(concurrency)\n for i := 0; i < concurrency; i++ {\n go func() {\n defer wg.Done()\n for item := range in {\n out <- fn(item)\n }\n }()\n }\n wg.Wait()\n }()\n return out\n}", "func (c ClientAsyncImpl) GetPodsAsync(channel chan<- Pods, workload *Workload) {\n\tvalue, err := c.syncClient.GetPods(workload)\n\tchannel <- Pods{value, err}\n}", "func ToChan(respCh chan BytesWatchResp, opts ...interface{}) func(dto BytesWatchResp) {\n\treturn func(dto BytesWatchResp) {\n\t\tselect {\n\t\tcase respCh <- dto:\n\t\t\t// success\n\t\tcase <-time.After(datasync.DefaultNotifTimeout):\n\t\t\tlogging.Warn(\"Unable to deliver notification\")\n\t\t}\n\t}\n}", "func (tm *ServiceTracerouteManager) GetOutChan() chan string {\n\treturn tm.OutChan\n}", "func (client *Client) VerifyCenWithCallback(request *VerifyCenRequest, callback func(response *VerifyCenResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *VerifyCenResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.VerifyCen(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) QueryVnConversationsWithChan(request *QueryVnConversationsRequest) (<-chan *QueryVnConversationsResponse, <-chan error) {\n\tresponseChan := make(chan *QueryVnConversationsResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.QueryVnConversations(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (client *Client) GetManagedRuleWithChan(request *GetManagedRuleRequest) (<-chan *GetManagedRuleResponse, <-chan error) {\n\tresponseChan := make(chan *GetManagedRuleResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.GetManagedRule(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (r *ClearNet) Dial(network, address string) (net.Conn, error) {\n fmt.Println(\"dialing beeep boop\", network, address)\n\n\n\n // fmt.Println(\"writing\", b)\n\n done := make(chan int)\n\n callback := js.FuncOf(func(this js.Value, args []js.Value) interface{} {\n fmt.Println(\"finished dialing stuff\")\n // callback.Release() // free up memory from callback\n done <- args[0].Int()\n return nil\n })\n\n // func printMessage(this js.Value, args []js.Value) interface{} {\n // message := args[0].String()\n // fmt.Println(message)\n // \n // return nil\n // }\n defer callback.Release()\n \n rawHost, rawPort, _ := net.SplitHostPort(address)\n\n\n js.Global().Get(\"dialSocket\").Invoke(rawHost, rawPort, callback)\n\n // wait until we've got our response\n id := <-done\n\n // TODO: error if id < 0\n\n // return net.Dial(network, address)\n return &Conn{\n id: id,\n }, nil\n}", "func handleOutput(outHex, id string) {\n\t/* Make sure the output is valid */\n\to, err := hex.DecodeString(outHex)\n\tif nil != err {\n\t\tlog.Printf(\"[ID-%v] ERROR in %q: %v\", id, outHex, err)\n\t\treturn\n\t}\n\ts := string(o)\n\n\t/* Log the output */\n\tlog.Printf(\"[ID-%v] OUTPUT: %v (%q)\", id, outHex, s)\n\n\t/* Send it to interested C2 clients */\n\t/* Get connected clients, send the output to each one which is watching\n\tthis implant. */\n\tkeys := CLIENTS.Keys()\n\tfor _, key := range keys {\n\t\t/* Turn into a Client */\n\t\tc, ok := key.(*C2Client)\n\t\tif !ok {\n\t\t\tlog.Panicf(\"wrong type for Client: %T\", key)\n\t\t}\n\t\t/* If this is the right ID, or the it matches the regex, send\n\t\tthe message to the client */\n\t\tc.l.Lock()\n\t\tif c.id == id {\n\t\t\t/* Don't print \\r's on non-windows */\n\t\t\tif \"windows\" != runtime.GOOS {\n\t\t\t\ts = strings.Replace(s, \"\\r\", \"\", -1)\n\t\t\t}\n\t\t\tfmt.Fprintf(c.t, \"%s\", s)\n\t\t}\n\t\tc.l.Unlock()\n\t}\n\t/* TODO: Finish this */\n}", "func GetTrafficOpsCookie(cdnUri, user, pass string) (string, error) {\n\turi := cdnUri + `/api/1.2/user/login`\n\tpostdata := `{\"u\":\"` + user + `\", \"p\":\"` + pass + `\"}`\n\treq, err := http.NewRequest(\"POST\", uri, strings.NewReader(postdata))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treq.Header.Add(\"Accept\", \"application/json\")\n\n\tclient := getClient()\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\n\tfor _, cookie := range resp.Cookies() {\n\t\tif cookie.Name == `mojolicious` {\n\t\t\treturn cookie.Value, nil\n\t\t}\n\t}\n\n\tdata, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn \"\", errors.New(\"No login cookie received: \" + string(data))\n}", "func (c *Operation) generateVC(w http.ResponseWriter, r *http.Request) {\n\tvcsProfileCookie, err := r.Cookie(vcsProfileCookie)\n\tif err != nil {\n\t\tlogger.Errorf(\"failed to get vcsProfileCookie: %s\", err.Error())\n\t\tc.writeErrorResponse(w, http.StatusBadRequest,\n\t\t\tfmt.Sprintf(\"failed to get cookie: %s\", err.Error()))\n\n\t\treturn\n\t}\n\n\terr = r.ParseForm()\n\tif err != nil {\n\t\tlogger.Errorf(err.Error())\n\t\tc.writeErrorResponse(w, http.StatusBadRequest, fmt.Sprintf(\"failed to parse request form: %s\", err.Error()))\n\n\t\treturn\n\t}\n\n\terr = c.validateForm(r.Form, \"cred\", \"holder\", \"authresp\", \"domain\", \"challenge\")\n\tif err != nil {\n\t\tlogger.Errorf(\"invalid generate credential request: %s\", err.Error())\n\t\tc.writeErrorResponse(w, http.StatusBadRequest, fmt.Sprintf(\"invalid request argument: %s\", err.Error()))\n\n\t\treturn\n\t}\n\n\tcred, err := c.createCredential(r.Form[\"cred\"][0], r.Form[\"authresp\"][0], r.Form[\"holder\"][0],\n\t\tr.Form[\"domain\"][0], r.Form[\"challenge\"][0], vcsProfileCookie.Value)\n\tif err != nil {\n\t\tlogger.Errorf(\"failed to create verifiable credential: %s\", err.Error())\n\t\tc.writeErrorResponse(w, http.StatusInternalServerError,\n\t\t\tfmt.Sprintf(\"failed to create verifiable credential: %s\", err.Error()))\n\n\t\treturn\n\t}\n\n\terr = c.storeCredential(cred, vcsProfileCookie.Value)\n\tif err != nil {\n\t\tlogger.Errorf(\"failed to store credential: %s\", err.Error())\n\t\tc.writeErrorResponse(w, http.StatusInternalServerError,\n\t\t\tfmt.Sprintf(\"failed to store credential: %s\", err.Error()))\n\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\n\tt, err := template.ParseFiles(c.receiveVCHTML)\n\tif err != nil {\n\t\tlogger.Errorf(err.Error())\n\t\tc.writeErrorResponse(w, http.StatusInternalServerError,\n\t\t\tfmt.Sprintf(\"unable to load html: %s\", err.Error()))\n\n\t\treturn\n\t}\n\n\tif err := t.Execute(w, vc{Data: string(cred)}); err != nil {\n\t\tlogger.Errorf(fmt.Sprintf(\"failed execute html template: %s\", err.Error()))\n\t}\n}", "func (c *InitRainbondCluster) GetChan() chan apiv1.Message {\n\treturn c.result\n}", "func main() {\n\tc1 := make(chan int, 1)\n\tc1 <- 2\n\tfor i := 0; i < 10; i++ {\n\t\tfmt.Println(\"hello word \")\n\t\ttime.Sleep(time.Duration(time.Second))\n\t}\n\tgo func() {\n\t\tfmt.Println(<-c1)\n\t}()\n}", "func (ec *executionContext) _Case(ctx context.Context, sel ast.SelectionSet, obj *models.Case) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, caseImplementors)\n\n\tvar wg sync.WaitGroup\n\tout := graphql.NewOrderedMap(len(fields))\n\tinvalid := false\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"Case\")\n\t\tcase \"Id\":\n\t\t\tout.Values[i] = ec._Case_Id(ctx, field, obj)\n\t\tcase \"Asset\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_Asset(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"CaseNumber\":\n\t\t\tout.Values[i] = ec._Case_CaseNumber(ctx, field, obj)\n\t\tcase \"Origin\":\n\t\t\tout.Values[i] = ec._Case_Origin(ctx, field, obj)\n\t\tcase \"Owner\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_Owner(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"Reason\":\n\t\t\tout.Values[i] = ec._Case_Reason(ctx, field, obj)\n\t\tcase \"IsClosed\":\n\t\t\tout.Values[i] = ec._Case_IsClosed(ctx, field, obj)\n\t\tcase \"Contact\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_Contact(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"CreatedBy\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_CreatedBy(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"ClosedDate\":\n\t\t\tout.Values[i] = ec._Case_ClosedDate(ctx, field, obj)\n\t\tcase \"CreatedDate\":\n\t\t\tout.Values[i] = ec._Case_CreatedDate(ctx, field, obj)\n\t\tcase \"IsDeleted\":\n\t\t\tout.Values[i] = ec._Case_IsDeleted(ctx, field, obj)\n\t\tcase \"Description\":\n\t\t\tout.Values[i] = ec._Case_Description(ctx, field, obj)\n\t\tcase \"IsEscalated\":\n\t\t\tout.Values[i] = ec._Case_IsEscalated(ctx, field, obj)\n\t\tcase \"LastModifiedBy\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_LastModifiedBy(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"LastModifiedDate\":\n\t\t\tout.Values[i] = ec._Case_LastModifiedDate(ctx, field, obj)\n\t\tcase \"LastReferencedDate\":\n\t\t\tout.Values[i] = ec._Case_LastReferencedDate(ctx, field, obj)\n\t\tcase \"LastViewedDate\":\n\t\t\tout.Values[i] = ec._Case_LastViewedDate(ctx, field, obj)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\twg.Wait()\n\tif invalid {\n\t\treturn graphql.Null\n\t}\n\treturn out\n}", "func (c ClientAsyncImpl) GetEnvValueAsync(channel chan<- EnvValueReturn, podSpec corev1.PodSpec, namespace string, envName string) {\n\tvalue, err := c.syncClient.GetEnvValue(podSpec, namespace, envName)\n\tchannel <- EnvValueReturn{value, err}\n}", "func GetServiceDashboard(acc model.Account, channel chan string) {\n\tlog.Debug(\"[CLP] Starting to run CLP service...\")\n\n\tvar csrfToken string\n\tcookieJar, _ := cookiejar.New(nil)\n\tclient := &http.Client{\n\t\tJar: cookieJar,\n\t\tCheckRedirect: func(req *http.Request, via []*http.Request) error {\n\t\t\tfmt.Println(req.URL)\n\t\t\tfor _, r := range via {\n\t\t\t\tfmt.Println(r.URL)\n\t\t\t}\n\t\t\treturn http.ErrUseLastResponse\n\t\t},\n\t}\n\n\tlog.Debug(\"[CLP] Get login page for the CSRF token.\")\n\tcookiesResp, err := client.Get(\"https://services.clp.com.hk/zh/login/index.aspx\")\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\tdefer cookiesResp.Body.Close()\n\tfor _, cookie := range cookiesResp.Cookies() {\n\t\tif cookie.Name == \"K2Cie90hi___AntiXsrfToken\" {\n\t\t\tcsrfToken = cookie.Value\n\t\t}\n\t}\n\n\tlog.Debug(\"[CLP] Logging into...\")\n\tvar loginBody = \"username=\" + acc.Username + \"&password=\" + acc.Password\n\tloginReq, err := http.NewRequest(\"POST\", \"https://services.clp.com.hk/Service/ServiceLogin.ashx\", strings.NewReader(loginBody))\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\n\tloginReq.Header.Set(\"X-CSRFToken\", csrfToken)\n\tloginReq.Header.Set(\"X-Requested-With\", \"XMLHttpRequest\")\n\tloginReq.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded; charset=UTF-8\")\n\n\tloginResp, err := client.Do(loginReq)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\tdefer loginResp.Body.Close()\n\n\tvar loginedCookies = loginResp.Cookies()\n\n\tlog.Debug(\"[CLP] Getting service dashboard info...\")\n\treq, err := http.NewRequest(\"POST\", \"https://services.clp.com.hk/Service/ServiceDashboard.ashx\", strings.NewReader(\"assCA=\"))\n\n\tcookieJar.SetCookies(req.URL, loginedCookies)\n\treq.Header.Set(\"X-CSRFToken\", csrfToken)\n\treq.Header.Set(\"X-Requested-With\", \"XMLHttpRequest\")\n\tresp, err := client.Do(req)\n\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\tdefer resp.Body.Close()\n\tdata, err := ioutil.ReadAll(resp.Body)\n\tchannel <- string(data[:])\n}" ]
[ "0.79232085", "0.64444685", "0.5182867", "0.50883555", "0.478109", "0.45607275", "0.45374334", "0.45302606", "0.4415868", "0.43623936", "0.4354781", "0.42620373", "0.41785672", "0.40921018", "0.40574202", "0.40431407", "0.40057978", "0.4002611", "0.40005198", "0.39568612", "0.39432833", "0.39097184", "0.38923502", "0.38871714", "0.3847867", "0.3842371", "0.38225192", "0.3818144", "0.3788263", "0.37862945", "0.37416318", "0.37292707", "0.3726744", "0.37231225", "0.37184343", "0.37181464", "0.37009746", "0.36857674", "0.3679589", "0.36782393", "0.3667143", "0.3657588", "0.36522764", "0.36449686", "0.36402154", "0.36258408", "0.36098397", "0.36087802", "0.36051196", "0.3598645", "0.3598122", "0.35816115", "0.35811654", "0.35784012", "0.35755008", "0.35734972", "0.35734138", "0.3573307", "0.3569662", "0.35601383", "0.3545363", "0.35392278", "0.3534635", "0.35209927", "0.3512832", "0.3498981", "0.34912956", "0.34864792", "0.3484877", "0.3479327", "0.34745413", "0.34730497", "0.34703732", "0.34580123", "0.34563276", "0.34546113", "0.3453586", "0.3453473", "0.34528556", "0.34356275", "0.3432319", "0.34284306", "0.34243476", "0.34160668", "0.3416004", "0.34124935", "0.34115952", "0.340713", "0.3406253", "0.340616", "0.33929437", "0.3391463", "0.33895296", "0.33834273", "0.33812687", "0.33771044", "0.33762747", "0.337198", "0.33679208", "0.33632666" ]
0.8225025
0
GetOcJusticeTerminalCaseWithCallback invokes the dt_oc_info.GetOcJusticeTerminalCase API asynchronously
GetOcJusticeTerminalCaseWithCallback вызывает асинхронно API dt_oc_info.GetOcJusticeTerminalCase
func (client *Client) GetOcJusticeTerminalCaseWithCallback(request *GetOcJusticeTerminalCaseRequest, callback func(response *GetOcJusticeTerminalCaseResponse, err error)) <-chan int { result := make(chan int, 1) err := client.AddAsyncTask(func() { var response *GetOcJusticeTerminalCaseResponse var err error defer close(result) response, err = client.GetOcJusticeTerminalCase(request) callback(response, err) result <- 1 }) if err != nil { defer close(result) callback(nil, err) result <- 0 } return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *Client) GetOcJusticeTerminalCase(request *GetOcJusticeTerminalCaseRequest) (response *GetOcJusticeTerminalCaseResponse, err error) {\n\tresponse = CreateGetOcJusticeTerminalCaseResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func (client *Client) GetOcJusticeTerminalCaseWithChan(request *GetOcJusticeTerminalCaseRequest) (<-chan *GetOcJusticeTerminalCaseResponse, <-chan error) {\n\tresponseChan := make(chan *GetOcJusticeTerminalCaseResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.GetOcJusticeTerminalCase(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func CreateGetOcJusticeTerminalCaseResponse() (response *GetOcJusticeTerminalCaseResponse) {\n\tresponse = &GetOcJusticeTerminalCaseResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetOcJusticeTerminalCaseRequest() (request *GetOcJusticeTerminalCaseRequest) {\n\trequest = &GetOcJusticeTerminalCaseRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"dt-oc-info\", \"2022-08-29\", \"GetOcJusticeTerminalCase\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (client *Client) DescribeCustinsKernelReleaseNotesWithCallback(request *DescribeCustinsKernelReleaseNotesRequest, callback func(response *DescribeCustinsKernelReleaseNotesResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeCustinsKernelReleaseNotesResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeCustinsKernelReleaseNotes(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) ListCasesWithCallback(request *ListCasesRequest, callback func(response *ListCasesResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *ListCasesResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.ListCases(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) GetOpenNLUWithCallback(request *GetOpenNLURequest, callback func(response *GetOpenNLUResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetOpenNLUResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetOpenNLU(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) GetIndustryCommerceInfoWithCallback(request *GetIndustryCommerceInfoRequest, callback func(response *GetIndustryCommerceInfoResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetIndustryCommerceInfoResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetIndustryCommerceInfo(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) GetWsCustomizedChO2OWithCallback(request *GetWsCustomizedChO2ORequest, callback func(response *GetWsCustomizedChO2OResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetWsCustomizedChO2OResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetWsCustomizedChO2O(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func Callback(w http.ResponseWriter, r *http.Request) {\n\tcode := ParseResponse(w, r)\n\taccess := AccessToken(code, w, r)\n\tfmt.Fprintf(w, access.Token)\n\tGetData(access.Token, w, r)\n}", "func Callback(c *gin.Context) {\n\tprovider := c.Param(\"provider\")\n\n\tvar logincode vo.LoginReq\n\tif err := c.ShouldBindQuery(&logincode); err != nil {\n\t\tfmt.Println(\"xxxx\", err)\n\t}\n\n\tfmt.Println(\"provider\", provider, logincode)\n\n\tuserInfo := vo.GetUserInfoFromOauth(provider, logincode.Code, logincode.State)\n\tfmt.Println(\"get user info\", userInfo)\n\n\tif userInfo == nil {\n\t\tc.JSON(http.StatusOK, sailor.HTTPAirdbResponse{\n\t\t\tCode: enum.AirdbSuccess,\n\t\t\tSuccess: true,\n\t\t\tData: vo.LoginResp{\n\t\t\t\tNickname: \"xxx\",\n\t\t\t\tHeadimgurl: \"xxx.png\",\n\t\t\t},\n\t\t})\n\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, sailor.HTTPAirdbResponse{\n\t\tCode: enum.AirdbSuccess,\n\t\tSuccess: true,\n\t\tData: vo.LoginResp{\n\t\t\tNickname: userInfo.Login,\n\t\t\tHeadimgurl: userInfo.AvatarURL,\n\t\t},\n\t})\n}", "func (client *Client) DescribeUserVvTopByDayWithCallback(request *DescribeUserVvTopByDayRequest, callback func(response *DescribeUserVvTopByDayResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeUserVvTopByDayResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeUserVvTopByDay(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (h *Handler) oidcCallback(w http.ResponseWriter, r *http.Request, p httprouter.Params) (interface{}, error) {\n\tresult, err := h.GetConfig().Auth.ValidateOIDCAuthCallback(r.URL.Query())\n\tif err != nil {\n\t\th.Warnf(\"Error validating callback: %v.\", err)\n\t\thttp.Redirect(w, r, \"/web/msg/error/login_failed\", http.StatusFound)\n\t\treturn nil, nil\n\t}\n\th.Infof(\"Callback: %v %v %v.\", result.Username, result.Identity, result.Req.Type)\n\treturn nil, h.CallbackHandler(w, r, webapi.CallbackParams{\n\t\tUsername: result.Username,\n\t\tIdentity: result.Identity,\n\t\tSession: result.Session,\n\t\tCert: result.Cert,\n\t\tTLSCert: result.TLSCert,\n\t\tHostSigners: result.HostSigners,\n\t\tType: result.Req.Type,\n\t\tCreateWebSession: result.Req.CreateWebSession,\n\t\tCSRFToken: result.Req.CSRFToken,\n\t\tPublicKey: result.Req.PublicKey,\n\t\tClientRedirectURL: result.Req.ClientRedirectURL,\n\t})\n}", "func (client *Client) ListCityMapAoisWithCallback(request *ListCityMapAoisRequest, callback func(response *ListCityMapAoisResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *ListCityMapAoisResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.ListCityMapAois(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (d *Dao) CaseObtainMID(c context.Context, mid int64, isToday bool) (cases map[int64]*model.SimCase, err error) {\n\tconn := d.redis.Get(c)\n\tdefer conn.Close()\n\tvar _setKey string\n\tif isToday {\n\t\t_setKey = caseVoteCIDMIDKey(mid)\n\t} else {\n\t\t_setKey = caseObtainMIDKey(mid)\n\t}\n\tvar ms []string\n\tif ms, err = redis.Strings(conn.Do(\"SMEMBERS\", _setKey)); err != nil {\n\t\tif err != redis.ErrNil {\n\t\t\treturn\n\t\t}\n\t\terr = nil\n\t}\n\tcases = make(map[int64]*model.SimCase)\n\tfor _, s := range ms {\n\t\tif s == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tsc := &model.SimCase{}\n\t\tif err = json.Unmarshal([]byte(s), sc); err != nil {\n\t\t\terr = errors.WithStack(err)\n\t\t\treturn\n\t\t}\n\t\tcases[sc.ID] = sc\n\t}\n\treturn\n}", "func (client *Client) DescribeLiveDomainCertificateInfoWithCallback(request *DescribeLiveDomainCertificateInfoRequest, callback func(response *DescribeLiveDomainCertificateInfoResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeLiveDomainCertificateInfoResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeLiveDomainCertificateInfo(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) VerifyCenWithCallback(request *VerifyCenRequest, callback func(response *VerifyCenResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *VerifyCenResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.VerifyCen(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) DescribeIpDdosThresholdWithCallback(request *DescribeIpDdosThresholdRequest, callback func(response *DescribeIpDdosThresholdResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeIpDdosThresholdResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeIpDdosThreshold(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) SegmentSkyWithCallback(request *SegmentSkyRequest, callback func(response *SegmentSkyResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *SegmentSkyResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.SegmentSky(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func cognitoCallback(ctx context.Context, d *aegis.HandlerDependencies, req *aegis.APIGatewayProxyRequest, res *aegis.APIGatewayProxyResponse, params url.Values) error {\n\t// Exchange code for token\n\ttokens, err := d.Services.Cognito.GetTokens(req.QueryStringParameters[\"code\"], []string{})\n\t// Depending on Cognito configuration, there could be an error here.\n\t// This service is for an OAuth2 with an authorization code flow.\n\t// NOTE: tokens.AccessToken is generally used.\n\t// If using an openid grant, you may also use tokens.IDToken with ParseAndVerifyJWT() below.\n\tif tokens.Error != \"\" {\n\t\terr = errors.New(tokens.Error)\n\t}\n\tif err != nil {\n\t\tlog.Println(\"Couldn't get access token\", err)\n\t\tres.JSONError(500, err)\n\t} else {\n\t\t// verify the token\n\t\t_, err := d.Services.Cognito.ParseAndVerifyJWT(tokens.AccessToken)\n\t\tif err == nil {\n\t\t\thost := req.GetHeader(\"Host\")\n\t\t\tstage := req.RequestContext.Stage\n\t\t\tres.SetHeader(\"Set-Cookie\", \"access_token=\"+tokens.AccessToken+\"; Domain=\"+host+\"; Secure; HttpOnly\")\n\t\t\tres.Redirect(301, \"https://\"+host+\"/\"+stage+\"/protected\")\n\t\t} else {\n\t\t\tres.JSONError(401, errors.New(\"unauthorized, invalid token\"))\n\t\t}\n\t}\n\treturn nil\n}", "func (client *Client) GetContactWithCallback(request *GetContactRequest, callback func(response *GetContactResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetContactResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetContact(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) GetNerCustomizedSeaEcomWithCallback(request *GetNerCustomizedSeaEcomRequest, callback func(response *GetNerCustomizedSeaEcomResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetNerCustomizedSeaEcomResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetNerCustomizedSeaEcom(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) DescribeVnKnowledgeWithCallback(request *DescribeVnKnowledgeRequest, callback func(response *DescribeVnKnowledgeResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeVnKnowledgeResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeVnKnowledge(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (b *OGame) GetCelestial(v any) (Celestial, error) {\n\treturn b.WithPriority(taskRunner.Normal).GetCelestial(v)\n}", "func (c *Operation) callback(w http.ResponseWriter, r *http.Request) { //nolint: funlen,gocyclo\n\tif len(r.URL.Query()[\"error\"]) != 0 {\n\t\tif r.URL.Query()[\"error\"][0] == \"access_denied\" {\n\t\t\thttp.Redirect(w, r, c.homePage, http.StatusTemporaryRedirect)\n\t\t}\n\t}\n\n\ttk, err := c.tokenIssuer.Exchange(r)\n\tif err != nil {\n\t\tlogger.Errorf(\"failed to exchange code for token: %s\", err.Error())\n\t\tc.writeErrorResponse(w, http.StatusBadRequest,\n\t\t\tfmt.Sprintf(\"failed to exchange code for token: %s\", err.Error()))\n\n\t\treturn\n\t}\n\n\t// user info from token will be used for to retrieve data from cms\n\tinfo, err := c.tokenResolver.Resolve(tk.AccessToken)\n\tif err != nil {\n\t\tlogger.Errorf(\"failed to get token info: %s\", err.Error())\n\t\tc.writeErrorResponse(w, http.StatusBadRequest,\n\t\t\tfmt.Sprintf(\"failed to get token info: %s\", err.Error()))\n\n\t\treturn\n\t}\n\n\tuserID, subject, err := c.getCMSData(tk, \"email=\"+info.Subject, info.Scope)\n\tif err != nil {\n\t\tlogger.Errorf(\"failed to get cms data: %s\", err.Error())\n\t\tc.writeErrorResponse(w, http.StatusBadRequest,\n\t\t\tfmt.Sprintf(\"failed to get cms data: %s\", err.Error()))\n\n\t\treturn\n\t}\n\n\tcallbackURLCookie, err := r.Cookie(callbackURLCookie)\n\tif err != nil && !errors.Is(err, http.ErrNoCookie) {\n\t\tc.writeErrorResponse(w, http.StatusBadRequest,\n\t\t\tfmt.Sprintf(\"failed to get authMode cookie: %s\", err.Error()))\n\n\t\treturn\n\t}\n\n\tif callbackURLCookie != nil && callbackURLCookie.Value != \"\" {\n\t\ttxnID := uuid.NewString()\n\t\tdata := txnData{\n\t\t\tUserID: userID,\n\t\t\tScope: info.Scope,\n\t\t\tToken: tk.AccessToken,\n\t\t}\n\n\t\tdataBytes, mErr := json.Marshal(data)\n\t\tif mErr != nil {\n\t\t\tc.writeErrorResponse(w, http.StatusInternalServerError,\n\t\t\t\tfmt.Sprintf(\"failed to marshal txn data: %s\", mErr.Error()))\n\t\t\treturn\n\t\t}\n\n\t\terr = c.store.Put(txnID, dataBytes)\n\t\tif err != nil {\n\t\t\tc.writeErrorResponse(w, http.StatusInternalServerError,\n\t\t\t\tfmt.Sprintf(\"failed to save txn data: %s\", err.Error()))\n\n\t\t\treturn\n\t\t}\n\n\t\thttp.Redirect(w, r, callbackURLCookie.Value+\"?txnID=\"+txnID, http.StatusTemporaryRedirect)\n\n\t\treturn\n\t}\n\n\tvcsProfileCookie, err := r.Cookie(vcsProfileCookie)\n\tif err != nil {\n\t\tlogger.Errorf(\"failed to get cookie: %s\", err.Error())\n\t\tc.writeErrorResponse(w, http.StatusBadRequest,\n\t\t\tfmt.Sprintf(\"failed to get cookie: %s\", err.Error()))\n\n\t\treturn\n\t}\n\n\tcred, err := c.prepareCredential(subject, info.Scope, vcsProfileCookie.Value)\n\tif err != nil {\n\t\tlogger.Errorf(\"failed to create credential: %s\", err.Error())\n\t\tc.writeErrorResponse(w, http.StatusInternalServerError,\n\t\t\tfmt.Sprintf(\"failed to create credential: %s\", err.Error()))\n\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\n\tt, err := template.ParseFiles(c.didAuthHTML)\n\tif err != nil {\n\t\tlogger.Errorf(err.Error())\n\t\tc.writeErrorResponse(w, http.StatusInternalServerError,\n\t\t\tfmt.Sprintf(\"unable to load html: %s\", err.Error()))\n\n\t\treturn\n\t}\n\n\tif err := t.Execute(w, map[string]interface{}{\n\t\t\"Path\": generate + \"?\" + \"profile=\" + vcsProfileCookie.Value,\n\t\t\"Cred\": string(cred),\n\t}); err != nil {\n\t\tlogger.Errorf(fmt.Sprintf(\"failed execute qr html template: %s\", err.Error()))\n\t}\n}", "func (client *Client) DescribeOssObjectDetailWithCallback(request *DescribeOssObjectDetailRequest, callback func(response *DescribeOssObjectDetailResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeOssObjectDetailResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeOssObjectDetail(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func callback(\n\tservice models.DeviceService,\n\tid string,\n\taction string,\n\tactionType models.ActionType,\n\tlc logger.LoggingClient) error {\n\n\tclient := &http.Client{}\n\turl := service.Addressable.GetCallbackURL()\n\tif len(url) > 0 {\n\t\tbody, err := getBody(id, actionType)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treq, err := http.NewRequest(string(action), url, bytes.NewReader(body))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treq.Header.Add(clients.ContentType, clients.ContentTypeJSON)\n\n\t\tgo makeRequest(client, req, lc)\n\t} else {\n\t\tlc.Info(\"callback::no addressable for \" + service.Name)\n\t}\n\treturn nil\n}", "func (client *Client) OemSitingSelctionWithCallback(request *OemSitingSelctionRequest, callback func(response *OemSitingSelctionResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *OemSitingSelctionResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.OemSitingSelction(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) CreateVSwitchWithCallback(request *CreateVSwitchRequest, callback func(response *CreateVSwitchResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateVSwitchResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateVSwitch(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (ovscni *OvsCni) HandleCni(d *render.RenderData) error {\n\n\t//For VlanType=trunk we do not need to do anything\n\tswitch ovscni.VlanType {\n\tcase \"access\":\n\t\tif len(ovscni.L2srvResources) != 1 {\n\t\t\terr := errors.New(\"Cannot use more than one L2Services for VlanType=access case\")\n\t\t\tovscni.Log.Error(err, \"L2Services cannot contain more than one L2Services in VlanType=access case\")\n\t\t\treturn err\n\t\t}\n\t\td.Data[\"AccessVlan\"] = ovscni.L2srvResources[0].Spec.SegmentationID\n\tcase \"selectivetrunk\":\n\t\ttmpList := []string{}\n\t\tfor _, l2srvObj := range ovscni.L2srvResources {\n\t\t\ttmpStr := \"{\\\"id\\\": \" + strconv.Itoa(int(l2srvObj.Spec.SegmentationID)) + \"}\"\n\t\t\ttmpList = append(tmpList, tmpStr)\n\t\t}\n\t\td.Data[\"SelectiveVlan\"] = \"[\" + strings.Join(tmpList, \",\") + \"]\"\n\tcase \"trunk\":\n\t\tovscni.Log.Info(\"Transparent Trunk case in cluster level\")\n\t}\n\treturn nil\n}", "func handleOidcCallback(\n\tw http.ResponseWriter,\n\tr *http.Request,\n\tclientName string,\n\tclientID string,\n\tclientSecret string,\n\tredirectURI string,\n\twellKnownConfig oidc.WellKnownConfiguration,\n\tstate string,\n\tcodeVerifier string,\n\tcancel context.CancelFunc,\n) {\n\tvar authorisationResponse, err = oidc.ValidateAuthorisationResponse(r.URL, state)\n\tif err != nil {\n\t\trenderAndLogError(w, cancel, fmt.Sprintf(\"%v\", err))\n\t\treturn\n\t}\n\n\tviewModel, err := VerifyCode(clientID, clientSecret, redirectURI, wellKnownConfig, codeVerifier, authorisationResponse.Code)\n\tif err != nil {\n\t\trenderAndLogError(w, cancel, fmt.Sprintf(\"%v\", err))\n\t\treturn\n\t}\n\n\t// show webpage\n\tt := template.New(\"credentials\")\n\t_, parseErr := t.Parse(TokenResultView())\n\tif parseErr != nil {\n\t\trenderAndLogError(w, cancel, fmt.Sprintf(\"%v\", parseErr))\n\t\treturn\n\t}\n\ttplErr := t.Execute(w, viewModel)\n\tif tplErr != nil {\n\t\trenderAndLogError(w, cancel, fmt.Sprintf(\"%v\", tplErr))\n\t\treturn\n\t}\n\n\tcancel()\n}", "func (client *Client) RunContactReviewWithCallback(request *RunContactReviewRequest, callback func(response *RunContactReviewResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *RunContactReviewResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.RunContactReview(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func CORSVC(ac *atmi.ATMICtx, svc *atmi.TPSVCINFO) {\n\tret := SUCCEED\n\n\t//Return to the caller\n\tdefer func() {\n\n\t\tac.TpLogCloseReqFile()\n\t\tif SUCCEED == ret {\n\t\t\tac.TpReturn(atmi.TPSUCCESS, 0, &svc.Data, 0)\n\t\t} else {\n\t\t\tac.TpReturn(atmi.TPFAIL, 0, &svc.Data, 0)\n\t\t}\n\t}()\n\n\t//Get UBF Handler\n\tub, _ := ac.CastToUBF(&svc.Data)\n\n\t//Print the buffer to stdout\n\t//fmt.Println(\"Incoming request:\")\n\tub.TpLogPrintUBF(atmi.LOG_DEBUG, \"CORSVC: Incoming request:\")\n\n\tarr, err := ub.BGetByteArr(u.EX_NETDATA, 0)\n\n\tif err != nil {\n\t\tac.TpLogError(\"Failed to get EX_NETDATA: %s\", err.Message())\n\t\tret = FAIL\n\t\treturn\n\t}\n\tif arr[0] == 1 && arr[1] == 1 {\n\t\tac.TpLogInfo(\"Test case 11 - no need for correlation\")\n\t} else if len(arr) > 4 {\n\n\t\tcorr := string(arr[:4])\n\n\t\tac.TpLogInfo(\"Extracted correlator: [%s]\", corr)\n\n\t\tif err := ub.BChg(u.EX_NETCORR, 0, corr); nil != err {\n\t\t\tac.TpLogError(\"Failed to set EX_NETCORR: %s\", err.Message())\n\t\t\tret = FAIL\n\t\t\treturn\n\t\t}\n\n\t}\n\n\tub.TpLogPrintUBF(atmi.LOG_DEBUG, \"Reply buffer afrer correl\")\n\n}", "func (client *Client) DescribeUserConnectionRecordsWithCallback(request *DescribeUserConnectionRecordsRequest, callback func(response *DescribeUserConnectionRecordsResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeUserConnectionRecordsResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeUserConnectionRecords(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) GetWsCustomizedChEcomContentWithCallback(request *GetWsCustomizedChEcomContentRequest, callback func(response *GetWsCustomizedChEcomContentResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetWsCustomizedChEcomContentResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetWsCustomizedChEcomContent(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (m *PatientMutation) Congenital() (r string, exists bool) {\n\tv := m._Congenital\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "func (c *controller) Callback(ctx context.Context, request *web.Request) web.Result {\n\tif resp := c.service.callback(ctx, request); resp != nil {\n\t\treturn resp\n\t}\n\treturn c.responder.NotFound(errors.New(\"broker for callback not found\"))\n}", "func callback() {\n\tlog.Println(\"shutdown requested\")\n}", "func (client *Client) GetTaxationInfoWithCallback(request *GetTaxationInfoRequest, callback func(response *GetTaxationInfoResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetTaxationInfoResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetTaxationInfo(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func CallbackHandler(c echo.Context) error {\n\tprovider, err := gomniauth.Provider(c.Param(\"provider\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tomap, err := objx.FromURLQuery(c.QueryString())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcreds, err := provider.CompleteAuth(omap)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tuser, err := provider.GetUser(creds)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tauthCookieValue := objx.New(map[string]interface{}{\n\t\t\"name\": user.Name(),\n\t\t\"email\": user.Email(),\n\t\t\"avatarURL\": user.AvatarURL(),\n\t}).MustBase64()\n\n\tcookie := &http.Cookie{\n\t\tName: \"auth\",\n\t\tValue: authCookieValue,\n\t\tPath: \"/\",\n\t\tExpires: time.Now().Add(24 * time.Hour),\n\t}\n\tc.SetCookie(cookie)\n\n\t// return c.String(http.StatusOK, \"Login Success!\")\n\treturn c.Redirect(http.StatusTemporaryRedirect, \"/\")\n}", "func (h *Handler) RetrieveCertificate(companyChainID string, uuid string) (*entityApi.TransactionWrapper, error) {\n apiResponse, err := h.apiClient.Get(fmt.Sprintf(certificateRoute, companyChainID, uuid), nil)\n if err != nil {\n return nil, err\n }\n var transactionWrapper entityApi.TransactionWrapper\n if err := unmarshalApiResponse(apiResponse, &transactionWrapper); err != nil {\n return nil, err\n }\n return &transactionWrapper, nil\n}", "func (client *Client) GetManagedRuleWithCallback(request *GetManagedRuleRequest, callback func(response *GetManagedRuleResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetManagedRuleResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetManagedRule(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) QueryVnConversationsWithCallback(request *QueryVnConversationsRequest, callback func(response *QueryVnConversationsResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *QueryVnConversationsResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.QueryVnConversations(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (term *Terminology) ReadV2toSNOMEDCT(ctx context.Context, id *apiv1.Identifier, f func(*apiv1.Identifier) error) error {\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\tresponse, err := term.client.FromCrossMap(ctx, &snomed.TranslateFromRequest{S: id.GetValue(), RefsetId: 900000000000497000})\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(response.GetTranslations()) == 0 {\n\t\tlog.Printf(\"no translations found for map from '%s:%s' to '%s'\", id.GetSystem(), id.GetValue(), identifiers.SNOMEDCT)\n\t}\n\tfor _, t := range response.GetTranslations() {\n\t\tref := t.GetReferenceSetItem().GetReferencedComponentId()\n\t\tif err := f(&apiv1.Identifier{System: identifiers.SNOMEDCT, Value: strconv.FormatInt(ref, 10)}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (client *Client) GetKeywordChEcomWithCallback(request *GetKeywordChEcomRequest, callback func(response *GetKeywordChEcomResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetKeywordChEcomResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetKeywordChEcom(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func GetClinicDoctors(c *gin.Context) {\n\tlog.Infof(\"Get all doctors registered with specific physical clinic\")\n\taddressID := c.Param(\"addressId\")\n\tif addressID == \"\" {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusBadRequest,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: \"clinic address id not provided\",\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\tctx := c.Request.Context()\n\tuserEmail, userID, gproject, err := getUserDetails(ctx, c.Request)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: err.Error(),\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\tctx, span := trace.StartSpan(ctx, \"Get all doctors registered for a clinic\")\n\tdefer span.End()\n\tclinicMetaDB := datastoredb.NewClinicMetaHandler()\n\terr = clinicMetaDB.InitializeDataBase(ctx, gproject)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: err.Error(),\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\tregisteredDoctors, err := clinicMetaDB.GetClinicDoctors(ctx, userEmail, userID, addressID)\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tgin.H{\n\t\t\t\tconstants.RESPONSE_JSON_DATA: nil,\n\t\t\t\tconstants.RESPONSDE_JSON_ERROR: err.Error(),\n\t\t\t},\n\t\t)\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, gin.H{\n\t\tconstants.RESPONSE_JSON_DATA: registeredDoctors,\n\t\tconstants.RESPONSDE_JSON_ERROR: nil,\n\t})\n\tclinicMetaDB.Close()\n}", "func GetByProvince(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tcovidData, err := scrapper.GetAllDataByProvince()\n\tif err != nil {\n\t\tjson.NewEncoder(w).Encode(Error{\n\t\t\tCode: 500,\n\t\t\tMessage: err.Error(),\n\t\t})\n\n\t\treturn\n\t}\n\n\tprov := r.URL.Query().Get(\"prov\")\n\tif prov != \"\" {\n\t\tfor _, item := range covidData {\n\t\t\tif strings.ToLower(item.Province) == strings.ToLower(prov) {\n\t\t\t\tjson.NewEncoder(w).Encode(item)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tjson.NewEncoder(w).Encode(covidData)\n\t\treturn\n\t}\n\n\tjson.NewEncoder(w).Encode(covidData)\n}", "func NewCase() *SCaseFunction {\n\treturn &SCaseFunction{}\n}", "func (o GoogleCloudRetailV2alphaSearchRequestFacetSpecFacetKeyPtrOutput) CaseInsensitive() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *GoogleCloudRetailV2alphaSearchRequestFacetSpecFacetKey) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.CaseInsensitive\n\t}).(pulumi.BoolPtrOutput)\n}", "func (d *Dao) Case(c context.Context, arg *blocked.ArgCaseSearch) (ids []int64, pager *blocked.Pager, err error) {\n\treq := d.elastic.NewRequest(blocked.BusinessBlockedCase).Index(blocked.TableBlockedCase).Fields(\"id\")\n\tif arg.Keyword != blocked.SearchDefaultString {\n\t\treq.WhereLike([]string{\"origin_content\"}, []string{arg.Keyword}, true, elastic.LikeLevelHigh)\n\t}\n\tif arg.OriginType != blocked.SearchDefaultNum {\n\t\treq.WhereEq(\"origin_type\", arg.OriginType)\n\t}\n\tif arg.Status != blocked.SearchDefaultNum {\n\t\treq.WhereEq(\"status\", arg.Status)\n\t}\n\tif arg.CaseType != blocked.SearchDefaultNum {\n\t\treq.WhereEq(\"case_type\", arg.CaseType)\n\t}\n\tif arg.UID != blocked.SearchDefaultNum {\n\t\treq.WhereEq(\"mid\", arg.UID)\n\t}\n\tif arg.OPID != blocked.SearchDefaultNum {\n\t\treq.WhereEq(\"oper_id\", arg.OPID)\n\t}\n\treq.WhereRange(\"start_time\", arg.TimeFrom, arg.TimeTo, elastic.RangeScopeLcRc)\n\treq.Pn(arg.PN).Ps(arg.PS).Order(arg.Order, arg.Sort)\n\tvar res *search.ReSearchData\n\tif err = req.Scan(c, &res); err != nil {\n\t\terr = errors.Errorf(\"elastic search(%s) error(%v)\", req.Params(), err)\n\t\treturn\n\t}\n\tids, pager = pagerExtra(res)\n\treturn\n}", "func (d *Deals) Retrieve(ctx context.Context, waddr string, cid cid.Cid) (io.Reader, error) {\n\ttime.Sleep(time.Second * 3)\n\treturn strings.NewReader(\"hello there\"), nil\n}", "func (client *Client) ListOfficeConversionTaskWithCallback(request *ListOfficeConversionTaskRequest, callback func(response *ListOfficeConversionTaskResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *ListOfficeConversionTaskResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.ListOfficeConversionTask(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func fnCase(ctx Context, doc *JDoc, params []string) interface{} {\n\tstats := ctx.Value(EelTotalStats).(*ServiceStats)\n\tctx.Log().Error(\"error_type\", \"func_case\", \"op\", \"case\", \"cause\", \"now_implemented_in_parser\", \"params\", params)\n\tstats.IncErrors()\n\tAddError(ctx, SyntaxError{fmt.Sprintf(\"case function now implemented in parser\"), \"case\", params})\n\treturn nil\n}", "func MythicRPCCallbackDisplayToRealIdSearch(input MythicRPCCallbackDisplayToRealIdSearchMessage) MythicRPCCallbackDisplayToRealIdSearchMessageResponse {\n\tresponse := MythicRPCCallbackDisplayToRealIdSearchMessageResponse{\n\t\tSuccess: false,\n\t}\n\tsearchString := \"\"\n\tif input.OperationName != nil {\n\t\tsearchString = `SELECT \n \t\tcallback.id \n\t\t\tFROM \n\t\t\tcallback\n\t\t\tJOIN operation on callback.operation_id = operation.id\n\t\t\tWHERE callback.display_id=$1 AND operation.name=$2`\n\t\tcallback := databaseStructs.Callback{}\n\t\tif err := database.DB.Get(&callback, searchString, input.CallbackDisplayID, *input.OperationName); err != nil {\n\t\t\tlogging.LogError(err, \"Failed to find task based on task id and operation name\")\n\t\t\tresponse.Error = err.Error()\n\t\t\treturn response\n\t\t} else {\n\t\t\tresponse.CallbackID = callback.ID\n\t\t\tresponse.Success = true\n\t\t\treturn response\n\t\t}\n\t} else if input.OperationID != nil {\n\t\tsearchString = `SELECT \n \t\tcallback.id \n\t\t\tFROM \n\t\t\tcallback\n\t\t\tWHERE callback.display_id=$1 AND callback.operation_id=$2`\n\t\tcallback := databaseStructs.Callback{}\n\t\tif err := database.DB.Get(&callback, searchString, input.CallbackDisplayID, *input.OperationID); err != nil {\n\t\t\tlogging.LogError(err, \"Failed to find task based on task id and operation id\")\n\t\t\tresponse.Error = err.Error()\n\t\t\treturn response\n\t\t} else {\n\t\t\tresponse.CallbackID = callback.ID\n\t\t\tresponse.Success = true\n\t\t\treturn response\n\t\t}\n\t} else {\n\t\tresponse.Error = \"Must specify operation name or operation id\"\n\t\treturn response\n\t}\n}", "func ToCaseClause(x ast.Node) *ast.CaseClause {\n\tif x, ok := x.(*ast.CaseClause); ok {\n\t\treturn x\n\t}\n\treturn NilCaseClause\n}", "func CustomerGetoneVehicleforview(w http.ResponseWriter, r *http.Request) {\n\tvehicle := services.GetOneVehicle(r)\n\tcusttpl.ExecuteTemplate(w, \"viewvehicle.html\", vehicle)\n}", "func (t *InsuranceChaincode) getCustomerByID(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n var customerId, jsonResp string\n\n if len(args) != 1 {\n return shim.Error(\"Incorrect number of arguments. Expecting customerId of the Insurance to query\")\n }\n\n customerId = args[0]\n valAsbytes, err := stub.GetState(customerId) \n if err != nil {\n jsonResp = \"{\\\"Error\\\":\\\"Failed to get state for \" + customerId + \"\\\"}\"\n return shim.Error(jsonResp)\n } else if valAsbytes == nil {\n jsonResp = \"{\\\"CustomerId\\\": \\\"\"+ customerId + \"\\\", \\\"Error\\\":\\\"Customer does not exist.\\\"}\"\n return shim.Error(jsonResp)\n }\n\n return shim.Success(valAsbytes)\n}", "func (client *Client) QueryCustomerAddressListWithCallback(request *QueryCustomerAddressListRequest, callback func(response *QueryCustomerAddressListResponse, err error)) (<-chan int) {\nresult := make(chan int, 1)\nerr := client.AddAsyncTask(func() {\nvar response *QueryCustomerAddressListResponse\nvar err error\ndefer close(result)\nresponse, err = client.QueryCustomerAddressList(request)\ncallback(response, err)\nresult <- 1\n})\nif err != nil {\ndefer close(result)\ncallback(nil, err)\nresult <- 0\n}\nreturn result\n}", "func NewCase(condition string, statements ...Statement) *Case {\n\treturn &Case{\n\t\tcondition: condition,\n\t\tstatements: statements,\n\t\tcaller: fetchClientCallerLine(),\n\t}\n}", "func (client *Client) DescribeExplorerWithCallback(request *DescribeExplorerRequest, callback func(response *DescribeExplorerResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeExplorerResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeExplorer(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) QueryContactInfoWithCallback(request *QueryContactInfoRequest, callback func(response *QueryContactInfoResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *QueryContactInfoResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.QueryContactInfo(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) DescribeOrganizationSpecsWithCallback(request *DescribeOrganizationSpecsRequest, callback func(response *DescribeOrganizationSpecsResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeOrganizationSpecsResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeOrganizationSpecs(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func doCHARableTest(t *testing.T, out io.Writer, f decoder.New, endianness bool, teTa decoder.TestTable) {\n\t//var (\n\t//\t// til is the trace id list content for test\n\t//\tidl = ``\n\t//)\n\t//lu := make(id.TriceIDLookUp) // empty\n\t//luM := new(sync.RWMutex)\n\t//assert.Nil(t, ilu.FromJSON([]byte(idl)))\n\t//lu.AddFmtCount(os.Stdout)\n\tbuf := make([]byte, decoder.DefaultSize)\n\tdec := f(out, nil, nil, nil, nil, endianness) // a new decoder instance\n\tfor _, x := range teTa {\n\t\tin := ioutil.NopCloser(bytes.NewBuffer(x.In))\n\t\tdec.SetInput(in)\n\t\tlineStart := true\n\t\tvar err error\n\t\tvar n int\n\t\tvar act string\n\t\tfor err == nil {\n\t\t\tn, err = dec.Read(buf)\n\t\t\tif n == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif decoder.ShowID != \"\" && lineStart {\n\t\t\t\tact += fmt.Sprintf(decoder.ShowID, decoder.LastTriceID)\n\t\t\t}\n\t\t\tact += fmt.Sprint(string(buf[:n]))\n\t\t\tlineStart = false\n\t\t}\n\t\tact = strings.TrimSuffix(act, \"\\\\n\")\n\t\tact = strings.TrimSuffix(act, \"\\n\")\n\t\tassert.Equal(t, x.Exp, act)\n\t}\n}", "func (client *Client) GetServiceInputMappingWithCallback(request *GetServiceInputMappingRequest, callback func(response *GetServiceInputMappingResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetServiceInputMappingResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetServiceInputMapping(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (o GoogleCloudRetailV2alphaSearchRequestFacetSpecFacetKeyResponseOutput) CaseInsensitive() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v GoogleCloudRetailV2alphaSearchRequestFacetSpecFacetKeyResponse) bool { return v.CaseInsensitive }).(pulumi.BoolOutput)\n}", "func (client *Client) GetStructSyncExecSqlDetailWithCallback(request *GetStructSyncExecSqlDetailRequest, callback func(response *GetStructSyncExecSqlDetailResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetStructSyncExecSqlDetailResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetStructSyncExecSqlDetail(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) DescribeCompanyWithCallback(request *DescribeCompanyRequest, callback func(response *DescribeCompanyResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeCompanyResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeCompany(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (ec *executionContext) _Case(ctx context.Context, sel ast.SelectionSet, obj *models.Case) graphql.Marshaler {\n\tfields := graphql.CollectFields(ctx, sel, caseImplementors)\n\n\tvar wg sync.WaitGroup\n\tout := graphql.NewOrderedMap(len(fields))\n\tinvalid := false\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"Case\")\n\t\tcase \"Id\":\n\t\t\tout.Values[i] = ec._Case_Id(ctx, field, obj)\n\t\tcase \"Asset\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_Asset(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"CaseNumber\":\n\t\t\tout.Values[i] = ec._Case_CaseNumber(ctx, field, obj)\n\t\tcase \"Origin\":\n\t\t\tout.Values[i] = ec._Case_Origin(ctx, field, obj)\n\t\tcase \"Owner\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_Owner(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"Reason\":\n\t\t\tout.Values[i] = ec._Case_Reason(ctx, field, obj)\n\t\tcase \"IsClosed\":\n\t\t\tout.Values[i] = ec._Case_IsClosed(ctx, field, obj)\n\t\tcase \"Contact\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_Contact(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"CreatedBy\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_CreatedBy(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"ClosedDate\":\n\t\t\tout.Values[i] = ec._Case_ClosedDate(ctx, field, obj)\n\t\tcase \"CreatedDate\":\n\t\t\tout.Values[i] = ec._Case_CreatedDate(ctx, field, obj)\n\t\tcase \"IsDeleted\":\n\t\t\tout.Values[i] = ec._Case_IsDeleted(ctx, field, obj)\n\t\tcase \"Description\":\n\t\t\tout.Values[i] = ec._Case_Description(ctx, field, obj)\n\t\tcase \"IsEscalated\":\n\t\t\tout.Values[i] = ec._Case_IsEscalated(ctx, field, obj)\n\t\tcase \"LastModifiedBy\":\n\t\t\twg.Add(1)\n\t\t\tgo func(i int, field graphql.CollectedField) {\n\t\t\t\tout.Values[i] = ec._Case_LastModifiedBy(ctx, field, obj)\n\t\t\t\twg.Done()\n\t\t\t}(i, field)\n\t\tcase \"LastModifiedDate\":\n\t\t\tout.Values[i] = ec._Case_LastModifiedDate(ctx, field, obj)\n\t\tcase \"LastReferencedDate\":\n\t\t\tout.Values[i] = ec._Case_LastReferencedDate(ctx, field, obj)\n\t\tcase \"LastViewedDate\":\n\t\t\tout.Values[i] = ec._Case_LastViewedDate(ctx, field, obj)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\twg.Wait()\n\tif invalid {\n\t\treturn graphql.Null\n\t}\n\treturn out\n}", "func callback(nlm *C.struct_nl_msg, nla unsafe.Pointer) C.int {\n\tcbID := uintptr(nla)\n\tcallbacksLock.RLock()\n\tcbArg := callbacks[cbID]\n\tcallbacksLock.RUnlock()\n\n\tif cbArg == nil {\n\t\tpanic(fmt.Sprintf(\"No netlink callback with ID %d\", cbID))\n\t}\n\n\tcbMsg := &Message{nlm: nlm}\n\tif err := cbArg.fn(cbMsg, cbArg.arg); err != nil {\n\t\tcbArg.err = err\n\t\treturn C.NL_STOP\n\t}\n\treturn C.NL_OK\n}", "func LookupTestCase(ctx *pulumi.Context, args *LookupTestCaseArgs, opts ...pulumi.InvokeOption) (*LookupTestCaseResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv LookupTestCaseResult\n\terr := ctx.Invoke(\"google-native:dialogflow/v3:getTestCase\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "func (h *Handler) CallbackHandler(w http.ResponseWriter, r *http.Request, p webapi.CallbackParams) error {\n\tswitch p.Type {\n\tcase gravityLoginAction: // login via tele login\n\t\turl, err := h.constructConsoleResponse(p.ClientRedirectURL, p.Username)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\thttp.Redirect(w, r, url.String(), http.StatusFound)\n\t\treturn nil\n\tdefault: // call the base (open-source) handler for web sign in\n\t\treturn h.Handler.CallbackHandler(w, r, p)\n\t}\n}", "func (client *Client) DescribeAntChainConsortiumsWithCallback(request *DescribeAntChainConsortiumsRequest, callback func(response *DescribeAntChainConsortiumsResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeAntChainConsortiumsResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeAntChainConsortiums(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) GetArmsConsoleUrlWithCallback(request *GetArmsConsoleUrlRequest, callback func(response *GetArmsConsoleUrlResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetArmsConsoleUrlResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetArmsConsoleUrl(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func getActiveCharacter(mid string) string {\n var profileResponse interface{}\n\n // Make GET request to Profile endpoint\n client := &http.Client{}\n reqURL := \"https://www.bungie.net/platform/Destiny2/3/Profile/\" +\n mid +\n \"/?components=200\"\n req, _ := http.NewRequest(\"GET\", reqURL, nil)\n req.Header.Add(\"X-API-Key\", os.Getenv(\"API_KEY\"))\n resp, err := client.Do(req)\n if ( err != nil) {\n fmt.Println(err)\n }\n // Parse response json for character ids\n err = json.NewDecoder(resp.Body).Decode(&profileResponse)\n if ( err != nil ) {\n fmt.Println(err)\n }\n resp.Body.Close()\n\n // Get relevant json data\n responseJSON := profileResponse.(map[string]interface{})\n responseMap := responseJSON[\"Response\"].(map[string]interface{})\n characterMap := responseMap[\"characters\"].(map[string]interface{})[\"data\"].(map[string]interface{})\n\n activeCharacter := \"-1\"\n latestDate := time.Time{}\n\n for k, v := range characterMap {\n dateString := v.(map[string]interface{})[\"dateLastPlayed\"].(string) // e.g. \"2020-01-09T06:11:35Z\"\n date, _ := time.Parse(\n time.RFC3339,\n dateString)\n if (date.After(latestDate)) {\n activeCharacter = k\n latestDate = date\n }\n }\n\n return activeCharacter\n}", "func GetCategory(p providers.CategoryProvider) func(c *fiber.Ctx) error {\n\treturn func(c *fiber.Ctx) error {\n\t\tcategoryID, _ := strconv.Atoi(c.Params(\"id\"))\n\t\tcategory, err := p.CategoryGet(categoryID)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// wrapped into array to it works in the template\n\t\tresult := make([]*models.Category, 0)\n\t\tresult = append(result, category)\n\t\treturn c.Render(\"category\", result)\n\t}\n}", "func Callback(cbReq *CallbackRequest, opts *CallbackOptions) error {\n\tclient := opts.Client\n\tif client == nil {\n\t\tclient = http.DefaultClient\n\t}\n\tbuf := bytes.NewBuffer(nil)\n\terr := json.NewEncoder(buf).Encode(cbReq)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsignature, err := opts.Signer.Sign(buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\treq, err := http.NewRequest(\"POST\", cbReq.StatusCallbackUrl, buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Set(\"X-OpenGDPR-Processor-Domain\", opts.ProcessorDomain)\n\treq.Header.Set(\"X-OpenGDPR-Signature\", signature)\n\t// Attempt to make callback\n\tfor i := 0; i < opts.MaxAttempts; i++ {\n\t\tresp, err := client.Do(req)\n\t\tif err != nil || resp.StatusCode != 200 {\n\t\t\ttime.Sleep(opts.Backoff)\n\t\t\tcontinue\n\t\t}\n\t\t// Success\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"callback timed out for %s\", cbReq.StatusCallbackUrl)\n}", "func (_Cakevault *CakevaultTransactor) InCaseTokensGetStuck(opts *bind.TransactOpts, _token common.Address) (*types.Transaction, error) {\n\treturn _Cakevault.contract.Transact(opts, \"inCaseTokensGetStuck\", _token)\n}", "func (client *Client) DescribeEventDetailWithCallback(request *DescribeEventDetailRequest, callback func(response *DescribeEventDetailResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeEventDetailResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeEventDetail(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func callbackHandler(res http.ResponseWriter, req *http.Request) {\n\n\t// Complete the authentication process and fetch all of the\n\t// basic information about the user from the provider.\n\tuser, err := gothic.CompleteUserAuth(res, req)\n\tif err != nil {\n\t\tfmt.Fprintln(res, err)\n\t\treturn\n\t}\n\n\t// Execute the template for this user and respond with\n\t// the user page.\n\ttemplates.ExecuteTemplate(res, \"user\", user)\n}", "func To(_case int, rune int) int {\n\tif _case < 0 || MaxCase <= _case {\n\t\treturn ReplacementChar\t// as reasonable an error as any\n\t}\n\t// binary search over ranges\n\tlo := 0;\n\thi := len(CaseRanges);\n\tfor lo < hi {\n\t\tm := lo + (hi-lo)/2;\n\t\tr := CaseRanges[m];\n\t\tif r.Lo <= rune && rune <= r.Hi {\n\t\t\tdelta := int(r.Delta[_case]);\n\t\t\tif delta > MaxRune {\n\t\t\t\t// In an Upper-Lower sequence, which always starts with\n\t\t\t\t// an UpperCase letter, the real deltas always look like:\n\t\t\t\t//\t{0, 1, 0} UpperCase (Lower is next)\n\t\t\t\t//\t{-1, 0, -1} LowerCase (Upper, Title are previous)\n\t\t\t\t// The characters at even offsets from the beginning of the\n\t\t\t\t// sequence are upper case; the ones at odd offsets are lower.\n\t\t\t\t// The correct mapping can be done by clearing or setting the low\n\t\t\t\t// bit in the sequence offset.\n\t\t\t\t// The constants UpperCase and TitleCase are even while LowerCase\n\t\t\t\t// is odd so we take the low bit from _case.\n\t\t\t\treturn r.Lo + ((rune-r.Lo)&^1 | _case&1)\n\t\t\t}\n\t\t\treturn rune + delta;\n\t\t}\n\t\tif rune < r.Lo {\n\t\t\thi = m\n\t\t} else {\n\t\t\tlo = m + 1\n\t\t}\n\t}\n\treturn rune;\n}", "func FindCvtermsynonym(exec boil.Executor, cvtermsynonymID int, selectCols ...string) (*Cvtermsynonym, error) {\n\tcvtermsynonymObj := &Cvtermsynonym{}\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 \\\"cvtermsynonym\\\" where \\\"cvtermsynonym_id\\\"=$1\", sel,\n\t)\n\n\tq := queries.Raw(exec, query, cvtermsynonymID)\n\n\terr := q.Bind(cvtermsynonymObj)\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, \"chado: unable to select from cvtermsynonym\")\n\t}\n\n\treturn cvtermsynonymObj, nil\n}", "func (o GoogleCloudRetailV2alphaSearchRequestFacetSpecFacetKeyOutput) CaseInsensitive() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v GoogleCloudRetailV2alphaSearchRequestFacetSpecFacetKey) *bool { return v.CaseInsensitive }).(pulumi.BoolPtrOutput)\n}", "func (s *BaseCobol85PreprocessorListener) EnterCobolWord(ctx *CobolWordContext) {}", "func (c *TestClient) zoneOperationsWait(project, zone, name string) error {\n\tif c.zoneOperationsWaitFn != nil {\n\t\treturn c.zoneOperationsWaitFn(project, zone, name)\n\t}\n\treturn c.client.zoneOperationsWait(project, zone, name)\n}", "func (h *GitHubOAuth) Callback(c *router.Control) {\n\tstate := c.Get(\"state\")\n\tcode := c.Get(\"code\")\n\n\tif state != h.state {\n\t\th.log.Errorf(\"Wrong state %s with code %s\", state, code)\n\t\thttp.Redirect(c.Writer, c.Request, \"/\", http.StatusMovedPermanently)\n\t\treturn\n\t}\n\n\tctx := context.Background()\n\ttoken, err := h.oAuthConf.Exchange(ctx, code)\n\n\tif err != nil {\n\t\th.log.Errorf(\"Exchange failed for code %s: %+v\", code, err)\n\t\thttp.Redirect(c.Writer, c.Request, \"/\", http.StatusMovedPermanently)\n\t\treturn\n\t}\n\n\toauthClient := h.oAuthConf.Client(ctx, token)\n\tgithubClient := ghClient.NewClient(oauthClient)\n\tuser, _, err := githubClient.Users.Get(ctx, \"\")\n\tif err != nil || user.Login == nil {\n\t\th.log.Errorf(\"Couldn't get user for code %s: %+v\", code, err)\n\t\thttp.Redirect(c.Writer, c.Request, \"/\", http.StatusMovedPermanently)\n\t\treturn\n\t}\n\n\th.log.WithField(\"user\", *user.Login).Info(\"GitHub user was authorized in oauth-proxy\")\n\n\tsessionData := session.NewSessionOptions(&session.SessOptions{\n\t\tCAttrs: map[string]interface{}{\"Login\": *user.Login, \"Source\": models.SourceGitHub},\n\t\tAttrs: map[string]interface{}{\"Activated\": false, \"HasError\": false},\n\t})\n\tsession.Add(sessionData, c.Writer)\n\n\tgo h.syncUser(*user.Login, sessionData, c.Writer)\n\n\thttp.Redirect(c.Writer, c.Request, \"/\", http.StatusMovedPermanently)\n}", "func (client *Client) DescribeMeterLiveRtcDurationWithCallback(request *DescribeMeterLiveRtcDurationRequest, callback func(response *DescribeMeterLiveRtcDurationResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeMeterLiveRtcDurationResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeMeterLiveRtcDuration(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (m *WorkflowDecisionCase) UnmarshalJSON(raw []byte) error {\n\t// AO0\n\tvar dataAO0 struct {\n\t\tDescription string `json:\"Description,omitempty\"`\n\n\t\tNextTask string `json:\"NextTask,omitempty\"`\n\n\t\tValue string `json:\"Value,omitempty\"`\n\t}\n\tif err := swag.ReadJSON(raw, &dataAO0); err != nil {\n\t\treturn err\n\t}\n\n\tm.Description = dataAO0.Description\n\n\tm.NextTask = dataAO0.NextTask\n\n\tm.Value = dataAO0.Value\n\n\treturn nil\n}", "func CanaryIncCase(context.Context, TimerManager, int) error {\n\treturn nil\n}", "func (client *Client) ModifyOcspStatusWithCallback(request *ModifyOcspStatusRequest, callback func(response *ModifyOcspStatusResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *ModifyOcspStatusResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.ModifyOcspStatus(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (d *Dao) CaseInfo(c context.Context, cid int64) (r *model.BlockedCase, err error) {\n\trow := d.db.QueryRow(c, _getCaseByIDSQL, cid)\n\tr = &model.BlockedCase{}\n\tif err = row.Scan(&r.ID, &r.MID, &r.Status, &r.OriginContent, &r.PunishResult, &r.OriginTitle, &r.OriginURL, &r.EndTime, &r.VoteRule, &r.VoteBreak, &r.VoteDelete, &r.OriginType, &r.ReasonType, &r.JudgeType, &r.BlockedDays, &r.PutTotal, &r.StartTime, &r.EndTime, &r.Operator, &r.CTime, &r.MTime, &r.RelationID, &r.CaseType); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil\n\t\t\tr = nil\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func (client IdentityClient) getCompartment(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/compartments/{compartmentId}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response GetCompartmentResponse\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\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func GetTrafficOpsCookie(cdnUri, user, pass string) (string, error) {\n\turi := cdnUri + `/api/1.2/user/login`\n\tpostdata := `{\"u\":\"` + user + `\", \"p\":\"` + pass + `\"}`\n\treq, err := http.NewRequest(\"POST\", uri, strings.NewReader(postdata))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treq.Header.Add(\"Accept\", \"application/json\")\n\n\tclient := getClient()\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\n\tfor _, cookie := range resp.Cookies() {\n\t\tif cookie.Name == `mojolicious` {\n\t\t\treturn cookie.Value, nil\n\t\t}\n\t}\n\n\tdata, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn \"\", errors.New(\"No login cookie received: \" + string(data))\n}", "func (client *Client) GetSubscriptionItemDetailWithCallback(request *GetSubscriptionItemDetailRequest, callback func(response *GetSubscriptionItemDetailResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetSubscriptionItemDetailResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetSubscriptionItemDetail(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (s *WeatherData) verifyCause(APIstub shim.ChaincodeStubInterface, polyId string ) sc.Response {\n\t\n\tfmt.Println(\"============= START : Fetching polygon details by the polygon id =============\")\n\tvar datasource = \"URL\" // Setting the Oraclize datasource\n\tvar query = \"json(http://api.agromonitoring.com/agro/1.0/weather?polyid=\" + polyId + \"&appid=\" + API_KEY + \")\" // Setting the query\n\tresult, proof := oraclizeapi.OraclizeQuery_sync(APIstub, datasource, query, oraclizeapi.TLSNOTARY)\n\tfmt.Printf(\"proof: %s\", proof)\n\tfmt.Printf(\"\\nresult: %s\\n\", result)\n\tvar response = {\n\t\t\"result\": result,\n\t\t\"proof\": proof\n\t}", "func (client *Client) DescribePortConnsListWithCallback(request *DescribePortConnsListRequest, callback func(response *DescribePortConnsListResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribePortConnsListResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribePortConnsList(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) GetAlarmLogWithCallback(request *GetAlarmLogRequest, callback func(response *GetAlarmLogResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetAlarmLogResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetAlarmLog(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (_AnchorChain *AnchorChainTransactor) Callback(opts *bind.TransactOpts, state bool, _result []string) (*types.Transaction, error) {\n\treturn _AnchorChain.contract.Transact(opts, \"callback\", state, _result)\n}", "func (client *Client) DescribeCertificatesWithCallback(request *DescribeCertificatesRequest, callback func(response *DescribeCertificatesResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeCertificatesResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeCertificates(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (_AnchorChain *AnchorChainTransactorSession) Callback(state bool, _result []string) (*types.Transaction, error) {\n\treturn _AnchorChain.Contract.Callback(&_AnchorChain.TransactOpts, state, _result)\n}", "func (client *Client) DescribeDialogueNodeStatisticsWithCallback(request *DescribeDialogueNodeStatisticsRequest, callback func(response *DescribeDialogueNodeStatisticsResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeDialogueNodeStatisticsResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeDialogueNodeStatistics(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}" ]
[ "0.66025335", "0.66022605", "0.5441328", "0.5314528", "0.4794885", "0.47772574", "0.44892713", "0.4443668", "0.43273535", "0.42628276", "0.4138406", "0.41172293", "0.41120696", "0.4096734", "0.40186015", "0.3951663", "0.39511362", "0.3897255", "0.38712794", "0.38415867", "0.3831616", "0.38205725", "0.38187796", "0.381507", "0.38043293", "0.37974733", "0.37413633", "0.37012738", "0.36630654", "0.3658415", "0.36554533", "0.36487493", "0.36351782", "0.3631789", "0.35783908", "0.35746962", "0.35458294", "0.35357213", "0.35115975", "0.34983984", "0.34977302", "0.34884718", "0.34799224", "0.3458872", "0.3454686", "0.343636", "0.3424452", "0.34213525", "0.3415038", "0.34058017", "0.34007478", "0.3396418", "0.33959967", "0.33891022", "0.33860946", "0.33758402", "0.33742633", "0.33623666", "0.33554623", "0.3349816", "0.33456367", "0.3326986", "0.33139527", "0.33137095", "0.33070815", "0.33035988", "0.3303151", "0.3301019", "0.3299541", "0.32926297", "0.32870528", "0.32848346", "0.3282053", "0.32810012", "0.32801476", "0.32786223", "0.32674655", "0.32653436", "0.3258584", "0.32529557", "0.32503602", "0.32497633", "0.3249119", "0.32430133", "0.32401207", "0.32311505", "0.3227725", "0.32274032", "0.3209645", "0.32055843", "0.32007238", "0.32007146", "0.3200202", "0.31980023", "0.31890017", "0.3188501", "0.31848612", "0.31833953", "0.31810832", "0.31771573" ]
0.8397443
0
CreateGetOcJusticeTerminalCaseRequest creates a request to invoke GetOcJusticeTerminalCase API
CreateGetOcJusticeTerminalCaseRequest создает запрос для вызова API GetOcJusticeTerminalCase
func CreateGetOcJusticeTerminalCaseRequest() (request *GetOcJusticeTerminalCaseRequest) { request = &GetOcJusticeTerminalCaseRequest{ RpcRequest: &requests.RpcRequest{}, } request.InitWithApiInfo("dt-oc-info", "2022-08-29", "GetOcJusticeTerminalCase", "", "") request.Method = requests.POST return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *Client) GetOcJusticeTerminalCase(request *GetOcJusticeTerminalCaseRequest) (response *GetOcJusticeTerminalCaseResponse, err error) {\n\tresponse = CreateGetOcJusticeTerminalCaseResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func CreateGetOcJusticeTerminalCaseResponse() (response *GetOcJusticeTerminalCaseResponse) {\n\tresponse = &GetOcJusticeTerminalCaseResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (client *Client) GetOcJusticeTerminalCaseWithCallback(request *GetOcJusticeTerminalCaseRequest, callback func(response *GetOcJusticeTerminalCaseResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetOcJusticeTerminalCaseResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetOcJusticeTerminalCase(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (client *Client) GetOcJusticeTerminalCaseWithChan(request *GetOcJusticeTerminalCaseRequest) (<-chan *GetOcJusticeTerminalCaseResponse, <-chan error) {\n\tresponseChan := make(chan *GetOcJusticeTerminalCaseResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.GetOcJusticeTerminalCase(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func CreateGetOpenNLURequest() (request *GetOpenNLURequest) {\n\trequest = &GetOpenNLURequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"alinlp\", \"2020-06-29\", \"GetOpenNLU\", \"alinlp\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func CreateGetWsCustomizedChO2ORequest() (request *GetWsCustomizedChO2ORequest) {\n\trequest = &GetWsCustomizedChO2ORequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"alinlp\", \"2020-06-29\", \"GetWsCustomizedChO2O\", \"alinlp\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func CreateDescribeCustinsKernelReleaseNotesRequest() (request *DescribeCustinsKernelReleaseNotesRequest) {\n\trequest = &DescribeCustinsKernelReleaseNotesRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Rds\", \"2014-08-15\", \"DescribeCustinsKernelReleaseNotes\", \"rds\", \"openAPI\")\n\treturn\n}", "func CreateGetIndustryCommerceInfoRequest() (request *GetIndustryCommerceInfoRequest) {\n\trequest = &GetIndustryCommerceInfoRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"companyreg\", \"2020-10-22\", \"GetIndustryCommerceInfo\", \"companyreg\", \"openAPI\")\n\trequest.Method = requests.GET\n\treturn\n}", "func CreateListCasesRequest() (request *ListCasesRequest) {\n\trequest = &ListCasesRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"CCC\", \"2020-07-01\", \"ListCases\", \"CCC\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func CreateGetKeywordChEcomRequest() (request *GetKeywordChEcomRequest) {\n\trequest = &GetKeywordChEcomRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"alinlp\", \"2020-06-29\", \"GetKeywordChEcom\", \"alinlp\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (client *Datetimerfc1123Client) getUTCLowercaseMaxDateTimeCreateRequest(ctx context.Context, options *Datetimerfc1123ClientGetUTCLowercaseMaxDateTimeOptions) (*policy.Request, error) {\n\turlPath := \"/datetimerfc1123/max/lowercase\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func CreateGetTaxationInfoRequest() (request *GetTaxationInfoRequest) {\n\trequest = &GetTaxationInfoRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"companyreg\", \"2020-10-22\", \"GetTaxationInfo\", \"companyreg\", \"openAPI\")\n\trequest.Method = requests.GET\n\treturn\n}", "func CreateDescribeIpDdosThresholdRequest() (request *DescribeIpDdosThresholdRequest) {\n\trequest = &DescribeIpDdosThresholdRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"antiddos-public\", \"2017-05-18\", \"DescribeIpDdosThreshold\", \"ddosbasic\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func CreateGetContactRequest() (request *GetContactRequest) {\n\trequest = &GetContactRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Subscription\", \"2021-01-15\", \"GetContact\", \"\", \"\")\n\treturn\n}", "func CreateDescribeOssObjectDetailRequest() (request *DescribeOssObjectDetailRequest) {\n\trequest = &DescribeOssObjectDetailRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Sddp\", \"2019-01-03\", \"DescribeOssObjectDetail\", \"sddp\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func CreateGetWsCustomizedChEcomContentRequest() (request *GetWsCustomizedChEcomContentRequest) {\n\trequest = &GetWsCustomizedChEcomContentRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"alinlp\", \"2020-06-29\", \"GetWsCustomizedChEcomContent\", \"alinlp\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (client *CapacitiesClient) getDetailsCreateRequest(ctx context.Context, resourceGroupName string, dedicatedCapacityName string, options *CapacitiesClientGetDetailsOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}\"\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 dedicatedCapacityName == \"\" {\n\t\treturn nil, errors.New(\"parameter dedicatedCapacityName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{dedicatedCapacityName}\", url.PathEscape(dedicatedCapacityName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-01-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func (client *KeyVaultClient) getCertificateOperationCreateRequest(ctx context.Context, vaultBaseURL string, certificateName string, options *KeyVaultClientGetCertificateOperationOptions) (*policy.Request, error) {\n\thost := \"{vaultBaseUrl}\"\n\thost = strings.ReplaceAll(host, \"{vaultBaseUrl}\", vaultBaseURL)\n\turlPath := \"/certificates/{certificate-name}/pending\"\n\tif certificateName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificate-name}\", url.PathEscape(certificateName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"7.2\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (client *CapacitiesClient) listCreateRequest(ctx context.Context, options *CapacitiesClientListOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/capacities\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-01-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func CreateGetTaobaoOrderRequest() (request *GetTaobaoOrderRequest) {\n\trequest = &GetTaobaoOrderRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"CloudCallCenter\", \"2017-07-05\", \"GetTaobaoOrder\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "func CreateOemSitingSelctionRequest() (request *OemSitingSelctionRequest) {\n\trequest = &OemSitingSelctionRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"cloudwf\", \"2017-03-28\", \"OemSitingSelction\", \"cloudwf\", \"openAPI\")\n\treturn\n}", "func CreateDescribeLiveDomainCertificateInfoRequest() (request *DescribeLiveDomainCertificateInfoRequest) {\n\trequest = &DescribeLiveDomainCertificateInfoRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"live\", \"2016-11-01\", \"DescribeLiveDomainCertificateInfo\", \"live\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (client *IncidentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, incidentID string, options *IncidentsClientGetOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif workspaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter workspaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{workspaceName}\", url.PathEscape(workspaceName))\n\tif incidentID == \"\" {\n\t\treturn nil, errors.New(\"parameter incidentID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{incidentId}\", url.PathEscape(incidentID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-05-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func CreateStartNotaryRequest() (request *StartNotaryRequest) {\n\trequest = &StartNotaryRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Trademark\", \"2018-07-24\", \"StartNotary\", \"trademark\", \"openAPI\")\n\treturn\n}", "func (client *ContainerClient) getPropertiesCreateRequest(ctx context.Context, options *ContainerClientGetPropertiesOptions, leaseAccessConditions *LeaseAccessConditions) (*policy.Request, error) {\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, client.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"restype\", \"container\")\n\tif options != nil && options.Timeout != nil {\n\t\treqQP.Set(\"timeout\", strconv.FormatInt(int64(*options.Timeout), 10))\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tif leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {\n\t\treq.Raw().Header[\"x-ms-lease-id\"] = []string{*leaseAccessConditions.LeaseID}\n\t}\n\treq.Raw().Header[\"x-ms-version\"] = []string{\"2020-10-02\"}\n\tif options != nil && options.RequestID != nil {\n\t\treq.Raw().Header[\"x-ms-client-request-id\"] = []string{*options.RequestID}\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/xml\"}\n\treturn req, nil\n}", "func (client *ApplicationClient) listOperationsCreateRequest(ctx context.Context, options *ApplicationClientListOperationsOptions) (*policy.Request, error) {\n\turlPath := \"/providers/Microsoft.Solutions/operations\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (c *Client) CreateCase(ctx context.Context, params *CreateCaseInput, optFns ...func(*Options)) (*CreateCaseOutput, error) {\n\tif params == nil {\n\t\tparams = &CreateCaseInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"CreateCase\", params, optFns, addOperationCreateCaseMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*CreateCaseOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func CreateDescribeVnKnowledgeRequest() (request *DescribeVnKnowledgeRequest) {\n\trequest = &DescribeVnKnowledgeRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"CloudCallCenter\", \"2017-07-05\", \"DescribeVnKnowledge\", \"\", \"\")\n\trequest.Method = requests.GET\n\treturn\n}", "func CreateGetOpenNLUResponse() (response *GetOpenNLUResponse) {\n\tresponse = &GetOpenNLUResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateListCityMapAoisRequest() (request *ListCityMapAoisRequest) {\n\trequest = &ListCityMapAoisRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"CDRS\", \"2020-11-01\", \"ListCityMapAois\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (c *Client) BuildCreateRequest(ctx context.Context, v interface{}) (*http.Request, error) {\n\tu := &url.URL{Scheme: c.scheme, Host: c.host, Path: CreateWarehousePath()}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, goahttp.ErrInvalidURL(\"Warehouse\", \"Create\", u.String(), err)\n\t}\n\tif ctx != nil {\n\t\treq = req.WithContext(ctx)\n\t}\n\n\treturn req, nil\n}", "func CreateGetServiceInputMappingRequest() (request *GetServiceInputMappingRequest) {\n\trequest = &GetServiceInputMappingRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"industry-brain\", \"2018-07-12\", \"GetServiceInputMapping\", \"\", \"\")\n\treturn\n}", "func (client *ReservationsDetailsClient) listByReservationOrderCreateRequest(ctx context.Context, reservationOrderID string, filter string, options *ReservationsDetailsListByReservationOrderOptions) (*policy.Request, error) {\n\turlPath := \"/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.Consumption/reservationDetails\"\n\tif reservationOrderID == \"\" {\n\t\treturn nil, errors.New(\"parameter reservationOrderID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{reservationOrderId}\", url.PathEscape(reservationOrderID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"$filter\", filter)\n\treqQP.Set(\"api-version\", \"2021-10-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (client *DicomServicesClient) listByWorkspaceCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *DicomServicesClientListByWorkspaceOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif workspaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter workspaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{workspaceName}\", url.PathEscape(workspaceName))\n\treq, err := runtime.NewRequest(ctx, http.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-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func CreateGetAlarmLogRequest() (request *GetAlarmLogRequest) {\n\trequest = &GetAlarmLogRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"emas-appmonitor\", \"2019-06-11\", \"GetAlarmLog\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (client *NotebookClient) getNotebooksByWorkspaceCreateRequest(ctx context.Context, options *NotebookClientGetNotebooksByWorkspaceOptions) (*policy.Request, error) {\n\turlPath := \"/notebooks\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.endpoint, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2020-12-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func NewCreateClinicRequest(server string, body CreateClinicJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewCreateClinicRequestWithBody(server, \"application/json\", bodyReader)\n}", "func CreateDescribeCertificatesRequest() (request *DescribeCertificatesRequest) {\n\trequest = &DescribeCertificatesRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"waf-openapi\", \"2019-09-10\", \"DescribeCertificates\", \"waf\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (client *DicomServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, dicomServiceName string, options *DicomServicesClientGetOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif workspaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter workspaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{workspaceName}\", url.PathEscape(workspaceName))\n\tif dicomServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter dicomServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{dicomServiceName}\", url.PathEscape(dicomServiceName))\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-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (client *BuildServiceClient) getBuildCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, options *BuildServiceClientGetBuildOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}\"\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 serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif buildServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter buildServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{buildServiceName}\", url.PathEscape(buildServiceName))\n\tif buildName == \"\" {\n\t\treturn nil, errors.New(\"parameter buildName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{buildName}\", url.PathEscape(buildName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-01-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func CreateGetChartRepositoryRequest() (request *GetChartRepositoryRequest) {\n\trequest = &GetChartRepositoryRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"cr\", \"2018-12-01\", \"GetChartRepository\", \"acr\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (client *KustoOperationsClient) listCreateRequest(ctx context.Context, options *KustoOperationsClientListOptions) (*policy.Request, error) {\n\turlPath := \"/providers/Microsoft.Synapse/kustooperations\"\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-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (c *Client) BuildCreateRequest(ctx context.Context, v interface{}) (*http.Request, error) {\n\tu := &url.URL{Scheme: c.scheme, Host: c.host, Path: CreateLogPath()}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, goahttp.ErrInvalidURL(\"log\", \"create\", u.String(), err)\n\t}\n\tif ctx != nil {\n\t\treq = req.WithContext(ctx)\n\t}\n\n\treturn req, nil\n}", "func CreateDescribeOrganizationSpecsRequest() (request *DescribeOrganizationSpecsRequest) {\n\trequest = &DescribeOrganizationSpecsRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Baas\", \"2018-07-31\", \"DescribeOrganizationSpecs\", \"\", \"\")\n\treturn\n}", "func NewGetaspecificNcosLevelRequest(server string, id string) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/ncoslevels/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func (client *IotSecuritySolutionClient) getCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, options *IotSecuritySolutionClientGetOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif solutionName == \"\" {\n\t\treturn nil, errors.New(\"parameter solutionName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{solutionName}\", url.PathEscape(solutionName))\n\treq, err := runtime.NewRequest(ctx, http.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-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func CreateDescribeExplorerRequest() (request *DescribeExplorerRequest) {\n\trequest = &DescribeExplorerRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Baas\", \"2018-07-31\", \"DescribeExplorer\", \"\", \"\")\n\treturn\n}", "func CreateCreateCdpOrderRequest() (request *CreateCdpOrderRequest) {\n\trequest = &CreateCdpOrderRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Dycdpapi\", \"2018-06-10\", \"createCdpOrder\", \"\", \"\")\n\trequest.Domain = \"dycdpapi.aliyuncs.com\"\n\treturn\n}", "func CreateGetHealthMonitorLogsRequest() (request *GetHealthMonitorLogsRequest) {\n\trequest = &GetHealthMonitorLogsRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"EHPC\", \"2018-04-12\", \"GetHealthMonitorLogs\", \"\", \"\")\n\trequest.Method = requests.GET\n\treturn\n}", "func NewGetDistrictForTermRequest(\n\tserver string,\n\tid string,\n) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/terms/%s/district\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func (client *Client) getChatCompletionsCreateRequest(ctx context.Context, body ChatCompletionsOptions, options *GetChatCompletionsOptions) (*policy.Request, error) {\n\turlPath := \"chat/completions\"\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, client.formatURL(urlPath, getDeploymentID(body)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-07-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, body); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "func NewGetaspecificCustomerZoneCostRequest(server string, id string) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/customerzonecosts/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func (c *Client) BuildGetActiveOrderRequest(ctx context.Context, v interface{}) (*http.Request, error) {\n\tu := &url.URL{Scheme: c.scheme, Host: c.host, Path: GetActiveOrderRestAPIPath()}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, goahttp.ErrInvalidURL(\"RestAPI\", \"getActiveOrder\", u.String(), err)\n\t}\n\tif ctx != nil {\n\t\treq = req.WithContext(ctx)\n\t}\n\n\treturn req, nil\n}", "func NewCreateClinicRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/v1/clinics\")\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", queryURL.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\n\treturn req, nil\n}", "func CreateModifyOcspStatusRequest() (request *ModifyOcspStatusRequest) {\n\trequest = &ModifyOcspStatusRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"ddoscoo\", \"2020-01-01\", \"ModifyOcspStatus\", \"ddoscoo\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (client *ContainerClient) getAccessPolicyCreateRequest(ctx context.Context, options *ContainerClientGetAccessPolicyOptions, leaseAccessConditions *LeaseAccessConditions) (*policy.Request, error) {\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, client.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"restype\", \"container\")\n\treqQP.Set(\"comp\", \"acl\")\n\tif options != nil && options.Timeout != nil {\n\t\treqQP.Set(\"timeout\", strconv.FormatInt(int64(*options.Timeout), 10))\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\tif leaseAccessConditions != nil && leaseAccessConditions.LeaseID != nil {\n\t\treq.Raw().Header[\"x-ms-lease-id\"] = []string{*leaseAccessConditions.LeaseID}\n\t}\n\treq.Raw().Header[\"x-ms-version\"] = []string{\"2020-10-02\"}\n\tif options != nil && options.RequestID != nil {\n\t\treq.Raw().Header[\"x-ms-client-request-id\"] = []string{*options.RequestID}\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/xml\"}\n\treturn req, nil\n}", "func (client *BuildServiceClient) getBuildServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, options *BuildServiceClientGetBuildServiceOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}\"\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 serviceName == \"\" {\n\t\treturn nil, errors.New(\"parameter serviceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{serviceName}\", url.PathEscape(serviceName))\n\tif buildServiceName == \"\" {\n\t\treturn nil, errors.New(\"parameter buildServiceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{buildServiceName}\", url.PathEscape(buildServiceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-01-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func NotepadCreateGET(w http.ResponseWriter, r *http.Request) {\n\t// Get session\n\tsess := session.Instance(r)\n\n\t// Display the view\n\tv := view.New(r)\n\tv.Name = \"notepad/create\"\n\tv.Vars[\"token\"] = csrfbanana.Token(w, r, sess)\n\tv.Render(w)\n}", "func (c *Client) BuildGetRequest(ctx context.Context, v interface{}) (*http.Request, error) {\n\tu := &url.URL{Scheme: c.scheme, Host: c.host, Path: GetTermLimitPath()}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, goahttp.ErrInvalidURL(\"term_limit\", \"get\", u.String(), err)\n\t}\n\tif ctx != nil {\n\t\treq = req.WithContext(ctx)\n\t}\n\n\treturn req, nil\n}", "func CreateVerifyCenRequest() (request *VerifyCenRequest) {\n\trequest = &VerifyCenRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"ecd\", \"2020-09-30\", \"VerifyCen\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "func CreateRevokeOperatorRequest() (request *RevokeOperatorRequest) {\n\trequest = &RevokeOperatorRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Oam\", \"2017-01-01\", \"RevokeOperator\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "func NewGetaspecificConversationRequest(server string, id string) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/conversations/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func CreateGetFaceSearchUserRequest() (request *GetFaceSearchUserRequest) {\n\trequest = &GetFaceSearchUserRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"imm\", \"2017-09-06\", \"GetFaceSearchUser\", \"imm\", \"openAPI\")\n\treturn\n}", "func (client *NotebookWorkspacesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, notebookWorkspaceName NotebookWorkspaceName, options *NotebookWorkspacesGetOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}\"\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 accountName == \"\" {\n\t\treturn nil, errors.New(\"parameter accountName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{accountName}\", url.PathEscape(accountName))\n\tif notebookWorkspaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter notebookWorkspaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{notebookWorkspaceName}\", url.PathEscape(string(notebookWorkspaceName)))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-10-15\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func NewCreateClinicianRequest(server string, clinicId ClinicId, body CreateClinicianJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewCreateClinicianRequestWithBody(server, clinicId, \"application/json\", bodyReader)\n}", "func (client *ContainerAppsDiagnosticsClient) getDetectorCreateRequest(ctx context.Context, resourceGroupName string, containerAppName string, detectorName string, options *ContainerAppsDiagnosticsClientGetDetectorOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors/{detectorName}\"\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 containerAppName == \"\" {\n\t\treturn nil, errors.New(\"parameter containerAppName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{containerAppName}\", url.PathEscape(containerAppName))\n\tif detectorName == \"\" {\n\t\treturn nil, errors.New(\"parameter detectorName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{detectorName}\", url.PathEscape(detectorName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-05-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func CreateCreateVSwitchRequest() (request *CreateVSwitchRequest) {\n\trequest = &CreateVSwitchRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Ecs\", \"2014-05-26\", \"CreateVSwitch\", \"ecs\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (c *Client) BuildGetRequest(ctx context.Context, v interface{}) (*http.Request, error) {\n\tvar (\n\t\tid string\n\t)\n\t{\n\t\tp, ok := v.(*warehouse.GetPayload)\n\t\tif !ok {\n\t\t\treturn nil, goahttp.ErrInvalidType(\"Warehouse\", \"Get\", \"*warehouse.GetPayload\", v)\n\t\t}\n\t\tid = p.ID\n\t}\n\tu := &url.URL{Scheme: c.scheme, Host: c.host, Path: GetWarehousePath(id)}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, goahttp.ErrInvalidURL(\"Warehouse\", \"Get\", u.String(), err)\n\t}\n\tif ctx != nil {\n\t\treq = req.WithContext(ctx)\n\t}\n\n\treturn req, nil\n}", "func CreateGetEMapRequest() (request *GetEMapRequest) {\n\trequest = &GetEMapRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"cusanalytic_sc_online\", \"2019-05-24\", \"GetEMap\", \"\", \"\")\n\treturn\n}", "func CreateDescribeUserVvTopByDayRequest() (request *DescribeUserVvTopByDayRequest) {\n\trequest = &DescribeUserVvTopByDayRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"vod\", \"2017-03-21\", \"DescribeUserVvTopByDay\", \"vod\", \"openAPI\")\n\treturn\n}", "func NewCreateIOCDefault(code int) *CreateIOCDefault {\n\treturn &CreateIOCDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (client *AlertOperationClient) getCreateRequest(ctx context.Context, scope string, operationID string, options *AlertOperationClientGetOptions) (*policy.Request, error) {\n\turlPath := \"/{scope}/providers/Microsoft.Authorization/roleManagementAlertOperations/{operationId}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{scope}\", scope)\n\turlPath = strings.ReplaceAll(urlPath, \"{operationId}\", operationID)\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-08-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func CreateDescribeCustinsKernelReleaseNotesResponse() (response *DescribeCustinsKernelReleaseNotesResponse) {\n\tresponse = &DescribeCustinsKernelReleaseNotesResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetManagedRuleRequest() (request *GetManagedRuleRequest) {\n\trequest = &GetManagedRuleRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Config\", \"2020-09-07\", \"GetManagedRule\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (c *Client) BuildRequiredRequest(ctx context.Context, v interface{}) (*http.Request, error) {\n\tu := &url.URL{Scheme: c.scheme, Host: c.host, Path: RequiredOidcPath()}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, goahttp.ErrInvalidURL(\"oidc\", \"required\", u.String(), err)\n\t}\n\tif ctx != nil {\n\t\treq = req.WithContext(ctx)\n\t}\n\n\treturn req, nil\n}", "func (c *Client) NewCreateCouncillorAdminRequest(ctx context.Context, path string) (*http.Request, error) {\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"http\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\treq, err := http.NewRequest(\"POST\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif c.JWTSigner != nil {\n\t\tc.JWTSigner.Sign(req)\n\t}\n\treturn req, nil\n}", "func (u *AttestationClient) CreateEnrollRequest(ctx context.Context, pcaType PCAType) (string, error) {\n\tacaType := apb.ACAType(ACAType(pcaType))\n\treply, err := u.ac.CreateEnrollRequest(ctx, &apb.CreateEnrollRequestRequest{AcaType: &acaType})\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"failed to call |CreateEnrollRequest|\")\n\t}\n\tif reply.GetStatus() != apb.AttestationStatus_STATUS_SUCCESS {\n\t\treturn \"\", &AttestationError{\n\t\t\terrors.Errorf(\"failed |CreateEnrollRequest|: %s\", reply.GetStatus().String()),\n\t\t\treply.GetStatus(),\n\t\t}\n\t}\n\treturn string(reply.GetPcaRequest()), nil\n}", "func CreateGetArmsConsoleUrlRequest() (request *GetArmsConsoleUrlRequest) {\n\trequest = &GetArmsConsoleUrlRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"ARMS\", \"2019-08-08\", \"GetArmsConsoleUrl\", \"arms\", \"openAPI\")\n\trequest.Method = requests.GET\n\treturn\n}", "func CreateGetLniPrivateIpAddressRequest() (request *GetLniPrivateIpAddressRequest) {\n\trequest = &GetLniPrivateIpAddressRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"eflo\", \"2022-05-30\", \"GetLniPrivateIpAddress\", \"eflo\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (client *OperationsClient) operationStatusGetCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *OperationsOperationStatusGetOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/operationStatus/{operationId}\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif vaultName == \"\" {\n\t\treturn nil, errors.New(\"parameter vaultName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{vaultName}\", url.PathEscape(vaultName))\n\tif operationID == \"\" {\n\t\treturn nil, errors.New(\"parameter operationID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{operationId}\", url.PathEscape(operationID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-08-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (client *CertificateOrdersClient) getCertificateCreateRequest(ctx context.Context, resourceGroupName string, certificateOrderName string, name string, options *CertificateOrdersClientGetCertificateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}\"\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 certificateOrderName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateOrderName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificateOrderName}\", url.PathEscape(certificateOrderName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func CreateGetRetcodeLogstoreRequest() (request *GetRetcodeLogstoreRequest) {\n\trequest = &GetRetcodeLogstoreRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"ARMS\", \"2019-08-08\", \"GetRetcodeLogstore\", \"arms\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (client *ContainerClient) acquireLeaseCreateRequest(ctx context.Context, duration int32, options *ContainerClientAcquireLeaseOptions, modifiedAccessConditions *ModifiedAccessConditions) (*policy.Request, error) {\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, client.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"comp\", \"lease\")\n\treqQP.Set(\"restype\", \"container\")\n\tif options != nil && options.Timeout != nil {\n\t\treqQP.Set(\"timeout\", strconv.FormatInt(int64(*options.Timeout), 10))\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"x-ms-lease-action\"] = []string{\"acquire\"}\n\treq.Raw().Header[\"x-ms-lease-duration\"] = []string{strconv.FormatInt(int64(duration), 10)}\n\tif options != nil && options.ProposedLeaseID != nil {\n\t\treq.Raw().Header[\"x-ms-proposed-lease-id\"] = []string{*options.ProposedLeaseID}\n\t}\n\tif modifiedAccessConditions != nil && modifiedAccessConditions.IfModifiedSince != nil {\n\t\treq.Raw().Header[\"If-Modified-Since\"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}\n\t}\n\tif modifiedAccessConditions != nil && modifiedAccessConditions.IfUnmodifiedSince != nil {\n\t\treq.Raw().Header[\"If-Unmodified-Since\"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}\n\t}\n\treq.Raw().Header[\"x-ms-version\"] = []string{\"2020-10-02\"}\n\tif options != nil && options.RequestID != nil {\n\t\treq.Raw().Header[\"x-ms-client-request-id\"] = []string{*options.RequestID}\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/xml\"}\n\treturn req, nil\n}", "func (client *RoleDefinitionsClient) getByIDCreateRequest(ctx context.Context, roleID string, options *RoleDefinitionsGetByIDOptions) (*policy.Request, error) {\n\turlPath := \"/{roleId}\"\n\turlPath = strings.ReplaceAll(urlPath, \"{roleId}\", roleID)\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2018-01-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func NewGetClinicianRequest(server string, clinicId ClinicId, clinicianId ClinicianId) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParamWithLocation(\"simple\", false, \"clinicId\", runtime.ParamLocationPath, clinicId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar pathParam1 string\n\n\tpathParam1, err = runtime.StyleParamWithLocation(\"simple\", false, \"clinicianId\", runtime.ParamLocationPath, clinicianId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/v1/clinics/%s/clinicians/%s\", pathParam0, pathParam1)\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"GET\", queryURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func (client *Client) getCompletionsCreateRequest(ctx context.Context, body CompletionsOptions, options *GetCompletionsOptions) (*policy.Request, error) {\n\turlPath := \"completions\"\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, client.formatURL(urlPath, getDeploymentID(body)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-07-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, body); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "func (client *CassandraClustersClient) statusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersClientStatusOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/status\"\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 clusterName == \"\" {\n\t\treturn nil, errors.New(\"parameter clusterName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{clusterName}\", url.PathEscape(clusterName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-03-15-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func CharacterCreate(w http.ResponseWriter, r *http.Request) {\n\tlog.WithFields(log.Fields{\n\t\t\"time\": time.Now(),\n\t}).Info(\"Received character create request\")\n\n\tvar requestData CreateRequest\n\tbody, err := ioutil.ReadAll(io.LimitReader(r.Body, 1048576))\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\n\tif err != nil {\n\t\tRespondBadRequest(w, err.Error())\n\t\treturn\n\t}\n\n\tif err := r.Body.Close(); err != nil {\n\t\tRespondBadRequest(w, err.Error())\n\t\treturn\n\t}\n\n\tif err := json.Unmarshal(body, &requestData); err != nil {\n\t\tw.WriteHeader(422) // unprocessable entity\n\t\tif err := json.NewEncoder(w).Encode(err); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\tcharacter, err := CreateNewCharacter(requestData)\n\tfmt.Println(requestData.ID)\n\n\tif err != nil {\n\t\tRespondBadRequest(w, err.Error())\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusCreated)\n\tif err := json.NewEncoder(w).Encode(character); err != nil {\n\t\tRespondBadRequest(w, err.Error())\n\t\treturn\n\t}\n\n}", "func NewCreateanewPartyCallControlRequest(server string, body CreateanewPartyCallControlJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewCreateanewPartyCallControlRequestWithBody(server, \"application/json\", bodyReader)\n}", "func NewFindByDistrictRequest(server string, params *FindByDistrictParams) (*http.Request, error) {\n\tvar err error\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/v2/appointment/sessions/public/findByDistrict\")\n\tif operationPath[0] == '/' {\n\t\toperationPath = operationPath[1:]\n\t}\n\toperationURL := url.URL{\n\t\tPath: operationPath,\n\t}\n\n\tqueryURL := serverURL.ResolveReference(&operationURL)\n\n\tqueryValues := queryURL.Query()\n\n\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"district_id\", runtime.ParamLocationQuery, params.DistrictId); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"date\", runtime.ParamLocationQuery, params.Date); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tqueryURL.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif params.AcceptLanguage != nil {\n\t\tvar headerParam0 string\n\n\t\theaderParam0, err = runtime.StyleParamWithLocation(\"simple\", false, \"Accept-Language\", runtime.ParamLocationHeader, *params.AcceptLanguage)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treq.Header.Set(\"Accept-Language\", headerParam0)\n\t}\n\n\treturn req, nil\n}", "func GetCharacterModel(w http.ResponseWriter, req *http.Request) {\n\n\t// Get session values or redirect to Login\n\tsession, err := sessions.Store.Get(req, \"session\")\n\n\tif err != nil {\n\t\tlog.Println(\"error identifying session\")\n\t\thttp.Redirect(w, req, \"/login/\", http.StatusFound)\n\t\treturn\n\t\t// in case of error\n\t}\n\n\t// Prep for user authentication\n\tsessionMap := getUserSessionValues(session)\n\n\tusername := sessionMap[\"username\"]\n\tloggedIn := sessionMap[\"loggedin\"]\n\tisAdmin := sessionMap[\"isAdmin\"]\n\n\tfmt.Println(loggedIn, isAdmin, username)\n\n\tfmt.Println(session)\n\n\t/*\n\t\tif username == \"\" {\n\t\t\thttp.Redirect(w, req, \"/\", http.StatusFound)\n\t\t\treturn\n\t\t}\n\t*/\n\n\tvars := mux.Vars(req)\n\tidString := vars[\"id\"]\n\n\tpk, err := strconv.Atoi(idString)\n\tif err != nil {\n\t\tpk = 0\n\t\tlog.Println(err)\n\t}\n\n\tcm, err := database.PKLoadCharacterModel(db, int64(pk))\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tjson.NewEncoder(w).Encode(cm)\n}", "func (client *CertificateOrdersClient) getCreateRequest(ctx context.Context, resourceGroupName string, certificateOrderName string, options *CertificateOrdersClientGetOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}\"\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 certificateOrderName == \"\" {\n\t\treturn nil, errors.New(\"parameter certificateOrderName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{certificateOrderName}\", url.PathEscape(certificateOrderName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func NewCreateanewCallControlRequest(server string, body CreateanewCallControlJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewCreateanewCallControlRequestWithBody(server, \"application/json\", bodyReader)\n}", "func CreateGetMigrationSummaryRequest() (request *GetMigrationSummaryRequest) {\n\trequest = &GetMigrationSummaryRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"dataworks-public\", \"2020-05-18\", \"GetMigrationSummary\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "func CreateDescribeUserConnectionRecordsRequest() (request *DescribeUserConnectionRecordsRequest) {\n\trequest = &DescribeUserConnectionRecordsRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"ecd\", \"2020-09-30\", \"DescribeUserConnectionRecords\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "func CreateGetNamespaceListRequest() (request *GetNamespaceListRequest) {\n\trequest = &GetNamespaceListRequest{\n\t\tRoaRequest: &requests.RoaRequest{},\n\t}\n\trequest.InitWithApiInfo(\"cr\", \"2016-06-07\", \"GetNamespaceList\", \"/namespace\", \"cr\", \"openAPI\")\n\trequest.Method = requests.GET\n\treturn\n}", "func CreateDescribeGtmInstanceRequest() (request *DescribeGtmInstanceRequest) {\n\trequest = &DescribeGtmInstanceRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Alidns\", \"2015-01-09\", \"DescribeGtmInstance\", \"alidns\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func CreateConvertInvoiceRequest() (request *ConvertInvoiceRequest) {\n\trequest = &ConvertInvoiceRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"companyreg\", \"2020-10-22\", \"ConvertInvoice\", \"companyreg\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (client *Datetimerfc1123Client) getNullCreateRequest(ctx context.Context, options *Datetimerfc1123ClientGetNullOptions) (*policy.Request, error) {\n\turlPath := \"/datetimerfc1123/null\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "func CreateSearchInventoryRequest() (request *SearchInventoryRequest) {\n\trequest = &SearchInventoryRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"oos\", \"2019-06-01\", \"SearchInventory\", \"oos\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}" ]
[ "0.7281973", "0.718111", "0.60141575", "0.59981817", "0.53045654", "0.529162", "0.5089326", "0.50162315", "0.48275313", "0.46769378", "0.46516144", "0.45637316", "0.44809666", "0.44730073", "0.44580668", "0.44391593", "0.43980765", "0.4389381", "0.43701097", "0.43534452", "0.43337896", "0.4328505", "0.4327918", "0.43264854", "0.43217233", "0.43186057", "0.43090788", "0.42881277", "0.42724407", "0.4268772", "0.42679098", "0.42640263", "0.42332992", "0.42272177", "0.42112258", "0.42080718", "0.41916513", "0.41909823", "0.41876414", "0.4184781", "0.41827127", "0.41816914", "0.4170395", "0.41549566", "0.41536996", "0.41534084", "0.41510725", "0.41510135", "0.41462028", "0.41446942", "0.4125487", "0.41233316", "0.4110233", "0.41101548", "0.40950456", "0.40944722", "0.40814072", "0.4077255", "0.407608", "0.4072966", "0.40644348", "0.40604275", "0.40491784", "0.404907", "0.40463", "0.40446872", "0.40431553", "0.40348482", "0.4034586", "0.40203246", "0.4018101", "0.40156406", "0.4011417", "0.40107816", "0.400871", "0.4008363", "0.4004304", "0.4003515", "0.40030178", "0.40012357", "0.39968324", "0.3980903", "0.39808884", "0.39737844", "0.39666095", "0.39656043", "0.39626926", "0.39600438", "0.39598852", "0.39579946", "0.3953518", "0.39529222", "0.3945971", "0.3942968", "0.39426893", "0.3942438", "0.39387047", "0.39383534", "0.3938076", "0.3936882" ]
0.8775902
0
CreateGetOcJusticeTerminalCaseResponse creates a response to parse from GetOcJusticeTerminalCase response
CreateGetOcJusticeTerminalCaseResponse создает ответ для парсинга из ответа GetOcJusticeTerminalCase
func CreateGetOcJusticeTerminalCaseResponse() (response *GetOcJusticeTerminalCaseResponse) { response = &GetOcJusticeTerminalCaseResponse{ BaseResponse: &responses.BaseResponse{}, } return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func CreateGetOcJusticeTerminalCaseRequest() (request *GetOcJusticeTerminalCaseRequest) {\n\trequest = &GetOcJusticeTerminalCaseRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"dt-oc-info\", \"2022-08-29\", \"GetOcJusticeTerminalCase\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (client *Client) GetOcJusticeTerminalCase(request *GetOcJusticeTerminalCaseRequest) (response *GetOcJusticeTerminalCaseResponse, err error) {\n\tresponse = CreateGetOcJusticeTerminalCaseResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func CreateGetOpenNLUResponse() (response *GetOpenNLUResponse) {\n\tresponse = &GetOpenNLUResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (client *Client) GetOcJusticeTerminalCaseWithChan(request *GetOcJusticeTerminalCaseRequest) (<-chan *GetOcJusticeTerminalCaseResponse, <-chan error) {\n\tresponseChan := make(chan *GetOcJusticeTerminalCaseResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.GetOcJusticeTerminalCase(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (client *Client) GetOcJusticeTerminalCaseWithCallback(request *GetOcJusticeTerminalCaseRequest, callback func(response *GetOcJusticeTerminalCaseResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *GetOcJusticeTerminalCaseResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.GetOcJusticeTerminalCase(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func CreateGetWsCustomizedChO2OResponse() (response *GetWsCustomizedChO2OResponse) {\n\tresponse = &GetWsCustomizedChO2OResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateDescribeCustinsKernelReleaseNotesResponse() (response *DescribeCustinsKernelReleaseNotesResponse) {\n\tresponse = &DescribeCustinsKernelReleaseNotesResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetIndustryCommerceInfoResponse() (response *GetIndustryCommerceInfoResponse) {\n\tresponse = &GetIndustryCommerceInfoResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateListCasesResponse() (response *ListCasesResponse) {\n\tresponse = &ListCasesResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateStartNotaryResponse() (response *StartNotaryResponse) {\n\tresponse = &StartNotaryResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateOemSitingSelctionResponse() (response *OemSitingSelctionResponse) {\n\tresponse = &OemSitingSelctionResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetContactResponse() (response *GetContactResponse) {\n\tresponse = &GetContactResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateListCityMapAoisResponse() (response *ListCityMapAoisResponse) {\n\tresponse = &ListCityMapAoisResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetWsCustomizedChEcomContentResponse() (response *GetWsCustomizedChEcomContentResponse) {\n\tresponse = &GetWsCustomizedChEcomContentResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func createResponse(req *http.Request) *http.Response {\n\treturn &http.Response{\n\t\tStatusCode: http.StatusOK,\n\t\tRequest: req,\n\t\tHeader: make(http.Header),\n\t\tBody: ioutil.NopCloser(bytes.NewBuffer([]byte{})),\n\t}\n}", "func CreateGetTaobaoOrderResponse() (response *GetTaobaoOrderResponse) {\n\tresponse = &GetTaobaoOrderResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateDescribeOssObjectDetailResponse() (response *DescribeOssObjectDetailResponse) {\n\tresponse = &DescribeOssObjectDetailResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateCreateCdpOrderResponse() (response *CreateCdpOrderResponse) {\n\tresponse = &CreateCdpOrderResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetTaxationInfoResponse() (response *GetTaxationInfoResponse) {\n\tresponse = &GetTaxationInfoResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetKeywordChEcomResponse() (response *GetKeywordChEcomResponse) {\n\tresponse = &GetKeywordChEcomResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetWsCustomizedChO2ORequest() (request *GetWsCustomizedChO2ORequest) {\n\trequest = &GetWsCustomizedChO2ORequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"alinlp\", \"2020-06-29\", \"GetWsCustomizedChO2O\", \"alinlp\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func CreateVerifyCenResponse() (response *VerifyCenResponse) {\n\tresponse = &VerifyCenResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateSegmentSkyResponse() (response *SegmentSkyResponse) {\n\tresponse = &SegmentSkyResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateDescribeIpDdosThresholdResponse() (response *DescribeIpDdosThresholdResponse) {\n\tresponse = &DescribeIpDdosThresholdResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateCreateBoxCodeResponse() (response *CreateBoxCodeResponse) {\n\tresponse = &CreateBoxCodeResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateCreateCellClusterOrderResponse() (response *CreateCellClusterOrderResponse) {\n\tresponse = &CreateCellClusterOrderResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateDescribeVnKnowledgeResponse() (response *DescribeVnKnowledgeResponse) {\n\tresponse = &DescribeVnKnowledgeResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetAlarmLogResponse() (response *GetAlarmLogResponse) {\n\tresponse = &GetAlarmLogResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateCreateVSwitchResponse() (response *CreateVSwitchResponse) {\n\tresponse = &CreateVSwitchResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetServiceInputMappingResponse() (response *GetServiceInputMappingResponse) {\n\tresponse = &GetServiceInputMappingResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateBeginVnDialogueResponse() (response *BeginVnDialogueResponse) {\n\tresponse = &BeginVnDialogueResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetLniPrivateIpAddressResponse() (response *GetLniPrivateIpAddressResponse) {\n\tresponse = &GetLniPrivateIpAddressResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetArmsConsoleUrlResponse() (response *GetArmsConsoleUrlResponse) {\n\tresponse = &GetArmsConsoleUrlResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateCreateContainerInstancesResponse() (response *CreateContainerInstancesResponse) {\n\tresponse = &CreateContainerInstancesResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateCreateTrafficMirrorFilterResponse() (response *CreateTrafficMirrorFilterResponse) {\n\tresponse = &CreateTrafficMirrorFilterResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateStartK8sApplicationResponse() (response *StartK8sApplicationResponse) {\n\tresponse = &StartK8sApplicationResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateDescribeCertificatesResponse() (response *DescribeCertificatesResponse) {\n\tresponse = &DescribeCertificatesResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetMigrationSummaryResponse() (response *GetMigrationSummaryResponse) {\n\tresponse = &GetMigrationSummaryResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateResponse(w *gin.Context, payload interface{}) {\n\tw.JSON(200, payload)\n}", "func CreateGetManagedRuleResponse() (response *GetManagedRuleResponse) {\n\tresponse = &GetManagedRuleResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateRevokeOperatorResponse() (response *RevokeOperatorResponse) {\n\tresponse = &RevokeOperatorResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (c *WSCodec) CreateResponse(id interface{}, reply interface{}) interface{} {\n\treturn &jsonSuccessResponse{Version: jsonrpcVersion, Id: id, Result: reply}\n}", "func CreateGetNerCustomizedSeaEcomResponse() (response *GetNerCustomizedSeaEcomResponse) {\n\tresponse = &GetNerCustomizedSeaEcomResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateDescribeUserVvTopByDayResponse() (response *DescribeUserVvTopByDayResponse) {\n\tresponse = &DescribeUserVvTopByDayResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetOpenNLURequest() (request *GetOpenNLURequest) {\n\trequest = &GetOpenNLURequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"alinlp\", \"2020-06-29\", \"GetOpenNLU\", \"alinlp\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func CreateGetEMapResponse() (response *GetEMapResponse) {\n\tresponse = &GetEMapResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateCreateClusterResponse() (response *CreateClusterResponse) {\n\tresponse = &CreateClusterResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateDescribeOrganizationSpecsResponse() (response *DescribeOrganizationSpecsResponse) {\n\tresponse = &DescribeOrganizationSpecsResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateDescribeLiveDomainCertificateInfoResponse() (response *DescribeLiveDomainCertificateInfoResponse) {\n\tresponse = &DescribeLiveDomainCertificateInfoResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetChartRepositoryResponse() (response *GetChartRepositoryResponse) {\n\tresponse = &GetChartRepositoryResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func createJsonResponse(w http.ResponseWriter, req *http.Request, statusCode int, data *om.OrderedMap, error string) {\n\tif statusCode == 0 {\n\t\tstatusCode = 200\n\t}\n\n\tsuccess := true\n\tif statusCode < 200 || statusCode > 299 {\n\t\tsuccess = false\n\t}\n\n\tw.Header().Set(\"Content-authType\", \"application/json\")\n\tw.WriteHeader(statusCode)\n\n\tstatus := om.NewOrderedMap(\n\t\t&om.KV{Key: \"http\", Value: om.NewOrderedMap(\n\t\t\t&om.KV{Key: \"code\", Value: statusCode},\n\t\t\t&om.KV{Key: \"message\", Value: http.StatusText(statusCode)},\n\t\t)})\n\n\tif error != \"\" {\n\t\tstatus.Set(\"error\", error)\n\t}\n\n\tresponse := om.NewOrderedMap().\n\t\tSet(\"success\", success).\n\t\tSet(\"status\", status)\n\n\tif data != nil {\n\t\tresponse.Append(data, false)\n\t}\n\n\tjsonData, _ := json.Marshal(response)\n\tw.Write(jsonData)\n}", "func CreateGetFaceSearchUserResponse() (response *GetFaceSearchUserResponse) {\n\tresponse = &GetFaceSearchUserResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateDescribeExplorerResponse() (response *DescribeExplorerResponse) {\n\tresponse = &DescribeExplorerResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateDescribeAntChainConsortiumsResponse() (response *DescribeAntChainConsortiumsResponse) {\n\tresponse = &DescribeAntChainConsortiumsResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateContainerOK(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.ContainerController, command []string, entrypoint []string, env []string, image string, name string, sslRedirect bool, volumes []string, workingDir *string) (http.ResponseWriter, *app.GoaContainerCreateResults) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tquery := url.Values{}\n\t{\n\t\tsliceVal := command\n\t\tquery[\"command\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := entrypoint\n\t\tquery[\"entrypoint\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := env\n\t\tquery[\"env\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{image}\n\t\tquery[\"image\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{name}\n\t\tquery[\"name\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", sslRedirect)}\n\t\tquery[\"sslRedirect\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := volumes\n\t\tquery[\"volumes\"] = sliceVal\n\t}\n\tif workingDir != nil {\n\t\tsliceVal := []string{*workingDir}\n\t\tquery[\"workingDir\"] = sliceVal\n\t}\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/api/v2/container/create\"),\n\t\tRawQuery: query.Encode(),\n\t}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\t{\n\t\tsliceVal := command\n\t\tprms[\"command\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := entrypoint\n\t\tprms[\"entrypoint\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := env\n\t\tprms[\"env\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{image}\n\t\tprms[\"image\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{name}\n\t\tprms[\"name\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := []string{fmt.Sprintf(\"%v\", sslRedirect)}\n\t\tprms[\"sslRedirect\"] = sliceVal\n\t}\n\t{\n\t\tsliceVal := volumes\n\t\tprms[\"volumes\"] = sliceVal\n\t}\n\tif workingDir != nil {\n\t\tsliceVal := []string{*workingDir}\n\t\tprms[\"workingDir\"] = sliceVal\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"ContainerTest\"), rw, req, prms)\n\tcreateCtx, _err := app.NewCreateContainerContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\tt.Errorf(\"unexpected parameter validation error: %+v\", e)\n\t\treturn nil, nil\n\t}\n\n\t// Perform action\n\t_err = ctrl.Create(createCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 200 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 200\", rw.Code)\n\t}\n\tvar mt *app.GoaContainerCreateResults\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(*app.GoaContainerCreateResults)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of app.GoaContainerCreateResults\", resp, resp)\n\t\t}\n\t\t_err = mt.Validate()\n\t\tif _err != nil {\n\t\t\tt.Errorf(\"invalid response media type: %s\", _err)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "func CreateQueryVnConversationsResponse() (response *QueryVnConversationsResponse) {\n\tresponse = &QueryVnConversationsResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateStopInstancesResponse() (response *StopInstancesResponse) {\n\tresponse = &StopInstancesResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetRetcodeLogstoreResponse() (response *GetRetcodeLogstoreResponse) {\n\tresponse = &GetRetcodeLogstoreResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateTestFlowStrategy01Response() (response *TestFlowStrategy01Response) {\n\tresponse = &TestFlowStrategy01Response{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (c *ClientWithResponses) CreateClinicWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateClinicResponse, error) {\n\trsp, err := c.CreateClinicWithBody(ctx, contentType, body, reqEditors...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseCreateClinicResponse(rsp)\n}", "func CreateDescribeUserConnectionRecordsResponse() (response *DescribeUserConnectionRecordsResponse) {\n\tresponse = &DescribeUserConnectionRecordsResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateRunContactReviewResponse() (response *RunContactReviewResponse) {\n\tresponse = &RunContactReviewResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateResponse(resultCode uint32, internalCommand []byte) ([]byte, error) {\n\t// Response frame:\n\t// - uint32 (size of response)\n\t// - []byte (response)\n\t// - uint32 (code)\n\tvar buf bytes.Buffer\n\n\tif err := binary.Write(&buf, binary.BigEndian, uint32(len(internalCommand))); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif _, err := buf.Write(internalCommand); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := binary.Write(&buf, binary.BigEndian, resultCode); err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}", "func CreateConvertInvoiceResponse() (response *ConvertInvoiceResponse) {\n\tresponse = &ConvertInvoiceResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateOpenAckServiceResponse() (response *OpenAckServiceResponse) {\n\tresponse = &OpenAckServiceResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateCreateCustomCallTaggingResponse() (response *CreateCustomCallTaggingResponse) {\n\tresponse = &CreateCustomCallTaggingResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func goatsejs_http_construct_return(ovm *otto.Otto, resp *http.Response, body string) (respObj *otto.Object, err error) {\r\n\tvar (\r\n\t\theaderObj *otto.Object\r\n\t\ttrailerObj *otto.Object\r\n\t)\r\n\trespObj, _ = ovm.Object(\"({})\")\r\n\trespObj.Set(\"body\", body)\r\n\trespObj.Set(\"status\", resp.Status)\r\n\trespObj.Set(\"statusCode\", resp.StatusCode)\r\n\trespObj.Set(\"contentLength\", resp.ContentLength)\r\n\trespObj.Set(\"url\", resp.Request.URL.String())\r\n\theaderObj, _ = ovm.Object(\"({})\")\r\n\tfor k, v := range resp.Header {\r\n\t\theaderObj.Set(k, v)\r\n\t}\r\n\trespObj.Set(\"header\", headerObj)\r\n\ttrailerObj, _ = ovm.Object(\"({})\")\r\n\tfor k, v := range resp.Trailer {\r\n\t\ttrailerObj.Set(k, v)\r\n\t}\r\n\trespObj.Set(\"trailer\", trailerObj)\r\n\treturn respObj, nil\r\n}", "func CreateGetOfficePreviewURLResponse() (response *GetOfficePreviewURLResponse) {\n\tresponse = &GetOfficePreviewURLResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetClusterMetricsResponse() (response *GetClusterMetricsResponse) {\n\tresponse = &GetClusterMetricsResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (client ThreatIntelligenceIndicatorClient) CreateResponder(resp *http.Response) (result ThreatIntelligenceInformationModel, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func encodeGetByCreteriaResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func (client ConversationsClient) CreateConversationMethodResponder(resp *http.Response) (result ConversationResourceResponseType, err error) {\n err = autorest.Respond(\n resp,\n client.ByInspecting(),\n azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated,http.StatusAccepted),\n autorest.ByUnmarshallingJSON(&result),\n autorest.ByClosing())\n result.Response = autorest.Response{Response: resp}\n return\n }", "func (client ThreatIntelligenceIndicatorClient) CreateIndicatorResponder(resp *http.Response) (result ThreatIntelligenceInformationModel, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func CreateGetAgentStateResponse() (response *GetAgentStateResponse) {\n\tresponse = &GetAgentStateResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateUpdateCommodityResponse() (response *UpdateCommodityResponse) {\n\tresponse = &UpdateCommodityResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetHotlineGroupDetailReportResponse() (response *GetHotlineGroupDetailReportResponse) {\n\tresponse = &GetHotlineGroupDetailReportResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateDescribeIpInfoResponse() (response *DescribeIpInfoResponse) {\n\tresponse = &DescribeIpInfoResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateBatchAuditTest01Response() (response *BatchAuditTest01Response) {\n\tresponse = &BatchAuditTest01Response{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func ParseCreateClinicResponse(rsp *http.Response) (*CreateClinicResponse, error) {\n\tbodyBytes, err := io.ReadAll(rsp.Body)\n\tdefer func() { _ = rsp.Body.Close() }()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &CreateClinicResponse{\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 Clinic\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\"), \"xml\") && rsp.StatusCode == 200:\n\t\tvar dest map[string]interface{}\n\t\tif err := xml.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.XML200 = &dest\n\n\t}\n\n\treturn response, nil\n}", "func CreateGetRenderResultResponse() (response *GetRenderResultResponse) {\n\tresponse = &GetRenderResultResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateDescribeReservedInstancesResponse() (response *DescribeReservedInstancesResponse) {\n\tresponse = &DescribeReservedInstancesResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (client DatasetClient) CreateResponder(resp *http.Response) (result LongRunningOperationResult, err error) {\n err = autorest.Respond(\n resp,\n azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted),\n autorest.ByUnmarshallingJSON(&result),\n autorest.ByClosing())\n result.Response = autorest.Response{Response: resp}\n return\n }", "func (req *RequestMessage) CreateResponse(err error) (*ResponseMessage, error) {\n\tswitch val := req.request.(type) {\n\tcase *proto.ProduceReq:\n\t\treturn createProduceResponse(val, err)\n\tcase *proto.FetchReq:\n\t\treturn createFetchResponse(val, err)\n\tcase *proto.OffsetReq:\n\t\treturn createOffsetResponse(val, err)\n\tcase *proto.MetadataReq:\n\t\treturn createMetadataResponse(val, err)\n\tcase *proto.ConsumerMetadataReq:\n\t\treturn createConsumerMetadataResponse(val, err)\n\tcase *proto.OffsetCommitReq:\n\t\treturn createOffsetCommitResponse(val, err)\n\tcase *proto.OffsetFetchReq:\n\t\treturn createOffsetFetchResponse(val, err)\n\tcase nil:\n\t\treturn nil, fmt.Errorf(\"unsupported request API key %d\", req.kind)\n\tdefault:\n\t\t// The switch cases above must correspond exactly to the switch cases\n\t\t// in ReadRequest.\n\t\tlogrus.Panic(fmt.Sprintf(\"Kafka API key not handled: %d\", req.kind))\n\t}\n\treturn nil, nil\n}", "func CreateCoreEngineResponse() (response *CoreEngineResponse) {\n\tresponse = &CoreEngineResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (client CertificateClient) CreateResponder(resp *http.Response) (result Certificate, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func CreateGetDirectoryOrFilePropertiesResponse() (response *GetDirectoryOrFilePropertiesResponse) {\n\tresponse = &GetDirectoryOrFilePropertiesResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (s *SmartContract) createDEC(APIstub shim.ChaincodeStubInterface, args []string) sc.Response {\n\t\n\t// if len(args) != 5 {\n\t// \treturn shim.Error(\"Incorrect number of arguments. Expecting 5\")\n\t// }\n\n\t// \"args\":[\"DECID\", \"BuildingID\", \"BuildingCategory\",\"FloorArea\",\"HoursOfOccupancy\", \"EnergyConsumption\", \"MeterStartDate\", \"MetereEndDate\", \"Grade\"]\n\n\n\t// ABAC\n\tval, ok, err := cid.GetAttributeValue(APIstub, \"role\")\n\tif err !=nil {\n\t\treturn shim.Error(\"Error retriving user attributes\")\n\t}\n\t\n\tif !ok {\n\t\t//The client identity does not possess the attributes\n\t\treturn shim.Error(\"The client identity does not possess the attributes\")\n\t}\n\n\tif val != \"buildingowner\" && val != \"admin\" {\n\t\tfmt.Println(\"Attribute role : \" + val)\n\t\treturn shim.Error(\"Only building owners can create a DEC\")\n\t}\n\n\n\tclientID, _ := cid.GetID(APIstub)\n\tdecID := args[0]\n\t// buildingID := \"util.GenerateUUID()\"\n\n\t//checking whether the key exists\n\tdecAsBytes, _ := APIstub.GetState(decID)\n\tif decAsBytes != nil {\n\t\treturn shim.Error(\"Key Exist Already\")\n\t}\n\n\t// getting the object\n\targuments := make([][]byte, 2)\n\targuments[0] = []byte(\"getAsset\")\n\targuments[1] = []byte(args[1])\n\n\tlogger.Infof(\"Getting the identity of the asset\")\n\tresponse := APIstub.InvokeChaincode(\"identitycontract\", arguments, \"mychannel\")\n\n\tlogger.Infof(\"Received a response from Identity Contract \")\n\tlogger.Infof(fmt.Sprint(response.Status))\n\tlogger.Infof(fmt.Sprint(response.Payload))\n\tif response.Status != shim.OK || len(response.Payload)==0{\n\t\treturn shim.Error(\"Invalid Building ID\")\n\t}\n\n\t// logger.Infof(fmt.Sprint(response.Payload))\n\t// object := Asset{}\n\t// json.Unmarshal(response.Payload, &object)\n\t// logger.Infof(object.ID)\n\n\t\n\n\t//creating the ledger entry\n\toccupancy, err := strconv.ParseFloat(args[4], 32)\n\tenergy, err := strconv.ParseFloat(args[5], 32)\n\tif err != nil {\n\t\treturn shim.Error(\"Invalid Data Types\")\n\t}\n\n\tvar dec = DEC{DECID: decID, CID: clientID, BuildingID: args[1], Status: \"Pending\", \n\t\t\t\t\tBuildingCategory : args[2],\n\t\t\t\t\tFloorArea: args[3], \n\t\t\t\t\tHoursOfOccupancy: occupancy,\n\t\t\t\t\tEnergyConsumption: energy, \n\t\t\t\t\tMeterStartDate: args[6], \n\t\t\t\t\tMetereEndDate: args[7], \n\t\t\t\t\tGrade: args[8]}\n\n\tdecAsBytes, _ = json.Marshal(dec)\n\tAPIstub.PutState(decID, decAsBytes)\n\n\tlogger.Infof(\"Successfully Added\")\n\treturn shim.Success(decAsBytes)\n}", "func CreateDescribeParentPlatformResponse() (response *DescribeParentPlatformResponse) {\n\tresponse = &DescribeParentPlatformResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (ccr ContainersCreateResponse) Response() *http.Response {\n\treturn ccr.rawResponse\n}", "func CreateSuccessResponse(w http.ResponseWriter, data interface{}) {\n\tif data != nil {\n\t\tbytes, err := json.Marshal(data)\n\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\n\t\tw.Write(bytes)\n\t}\n}", "func buildExampleResponse(rules Rules, list bool, version string) string {\n\treturn buildExamplePayload(rules, Outbound, list, version)\n}", "func CreateDescribeMaskingRulesResponse() (response *DescribeMaskingRulesResponse) {\n\tresponse = &DescribeMaskingRulesResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateCreateFileSystemResponse() (response *CreateFileSystemResponse) {\n\tresponse = &CreateFileSystemResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateReleaseDirectConnectionResponse() (response *ReleaseDirectConnectionResponse) {\n\tresponse = &ReleaseDirectConnectionResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateQueryWorksResponse() (response *QueryWorksResponse) {\n\tresponse = &QueryWorksResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateCancelInstanceResponse() (response *CancelInstanceResponse) {\n\tresponse = &CancelInstanceResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateCreateAgentResponse() (response *CreateAgentResponse) {\n\tresponse = &CreateAgentResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateDeleteDegradeControlResponse() (response *DeleteDegradeControlResponse) {\n\tresponse = &DeleteDegradeControlResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateGetIndustryCommerceInfoRequest() (request *GetIndustryCommerceInfoRequest) {\n\trequest = &GetIndustryCommerceInfoRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"companyreg\", \"2020-10-22\", \"GetIndustryCommerceInfo\", \"companyreg\", \"openAPI\")\n\trequest.Method = requests.GET\n\treturn\n}", "func BuildResponse(data interface{}, statusCode int, msg string, tid string) Response {\n\tstatus := OK\n\n\tif statusCode >= 400 {\n\t\tstatus = ERROR\n\t}\n\n\tresponse := Response{\n\t\tMeta: Meta{\n\t\t\tStatus: status,\n\t\t\tStatusCode: statusCode,\n\t\t\tMessage: msg,\n\t\t\tTransactionID: tid,\n\t\t},\n\t\tData: data,\n\t}\n\n\treturn response\n}" ]
[ "0.77589756", "0.7157844", "0.61063325", "0.6026642", "0.59860957", "0.59467834", "0.56416875", "0.5634511", "0.556447", "0.5405703", "0.52253896", "0.5192126", "0.51881194", "0.51555777", "0.50910974", "0.50739145", "0.5035087", "0.5018713", "0.5008554", "0.499794", "0.49734196", "0.4968148", "0.4944723", "0.4943738", "0.49427813", "0.49332538", "0.49282357", "0.48901853", "0.48847622", "0.4866865", "0.48573485", "0.48321313", "0.48001522", "0.47958642", "0.4792823", "0.479264", "0.47871107", "0.4786342", "0.47841036", "0.47687307", "0.47622785", "0.47483155", "0.4738794", "0.47194412", "0.4718895", "0.47160265", "0.47051826", "0.47047096", "0.4695428", "0.46788296", "0.46771696", "0.46767196", "0.4673029", "0.4671117", "0.4649908", "0.46453193", "0.46051136", "0.45825425", "0.45659873", "0.45640856", "0.45619076", "0.45574957", "0.4551609", "0.45501503", "0.45455492", "0.45413604", "0.45385242", "0.45371372", "0.45189902", "0.4501389", "0.4484897", "0.4483944", "0.44832593", "0.4473451", "0.4470173", "0.44667828", "0.44550517", "0.44541213", "0.44471025", "0.44429523", "0.4441997", "0.44393605", "0.44311294", "0.44305167", "0.44231337", "0.4417724", "0.44138294", "0.44135532", "0.4406074", "0.4405024", "0.43989995", "0.43971083", "0.43968123", "0.43963215", "0.43935612", "0.4389361", "0.4388594", "0.43813956", "0.43782455", "0.4376731" ]
0.899438
0
GetCmdQueryProfile queries a profile from the given address or dtag
GetCmdQueryProfile запрашивает профиль из заданного адреса или dtag
func GetCmdQueryProfile(cdc *codec.Codec) *cobra.Command { return &cobra.Command{ Use: "profile [address_or_dtag]", Short: "Retrieve the profile having the specified user address or profile dtag, if any.", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { cliCtx := context.NewCLIContext().WithCodec(cdc) route := fmt.Sprintf("custom/%s/%s/%s", types.QuerierRoute, types.QueryProfile, args[0]) res, _, err := cliCtx.QueryWithData(route, nil) if err != nil { fmt.Printf("Could not find a profile with dtag %s \n", args[0]) return nil } var out types.Profile cdc.MustUnmarshalJSON(res, &out) return cliCtx.PrintOutput(out) }, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func queryProfile(ctx sdk.Context, path []string, _ abci.RequestQuery, keeper Keeper) ([]byte, error) {\n\tif len(strings.TrimSpace(path[0])) == 0 {\n\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, \"DTag or address cannot be empty or blank\")\n\t}\n\n\taddress, err := sdk.AccAddressFromBech32(path[0])\n\tif err != nil {\n\t\taddress = keeper.GetDtagRelatedAddress(ctx, path[0])\n\t\tif address == nil {\n\t\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf(\"No address related to this dtag: %s\", path[0]))\n\t\t}\n\n\t}\n\n\taccount, found := keeper.GetProfile(ctx, address)\n\n\tif !found {\n\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest,\n\t\t\tfmt.Sprintf(\"Profile with address %s doesn't exists\", path[0]))\n\t}\n\n\tbz, err := codec.MarshalJSONIndent(keeper.Cdc, &account)\n\tif err != nil {\n\t\tpanic(\"could not marshal result to JSON\")\n\t}\n\n\treturn bz, nil\n}", "func (s *SmartContract) QueryProfile(ctx contractapi.TransactionContextInterface, carNumber string) (*Profile, error) {\n\tcarAsBytes, err := ctx.GetStub().GetState(\"profile-\" + carNumber)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to read from world state. %s\", err.Error())\n\t}\n\n\tif carAsBytes == nil {\n\t\treturn nil, fmt.Errorf(\"%s does not exist\", carNumber)\n\t}\n\n\tcar := new(Profile)\n\t_ = json.Unmarshal(carAsBytes, car)\n\n\treturn car, nil\n}", "func GetCmdQueryProfileParams(cdc *codec.Codec) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"parameters\",\n\t\tShort: \"Retrieve all the profile module parameters\",\n\t\tArgs: cobra.NoArgs,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\troute := fmt.Sprintf(\"custom/%s/%s\", types.QuerierRoute, types.QueryParams)\n\t\t\tres, _, err := cliCtx.QueryWithData(route, nil)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Could not find profile parameters\")\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tvar out types.Params\n\t\t\tcdc.MustUnmarshalJSON(res, &out)\n\t\t\treturn cliCtx.PrintOutput(out)\n\t\t},\n\t}\n}", "func GetCmdQueryProfiles(cdc *codec.Codec) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"all\",\n\t\tShort: \"Retrieve all the registered profiles.\",\n\t\tArgs: cobra.NoArgs,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\troute := fmt.Sprintf(\"custom/%s/%s\", types.QuerierRoute, types.QueryProfiles)\n\t\t\tres, _, err := cliCtx.QueryWithData(route, nil)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Could not find any profile\")\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tvar out types.Profiles\n\t\t\tcdc.MustUnmarshalJSON(res, &out)\n\t\t\treturn cliCtx.PrintOutput(out)\n\t\t},\n\t}\n}", "func GetQueryCmd(cdc *codec.Codec) *cobra.Command {\n\tprofileQueryCmd := &cobra.Command{\n\t\tUse: types.ModuleName,\n\t\tShort: \"Querying commands for the profiles module\",\n\t\tDisableFlagParsing: true,\n\t\tSuggestionsMinimumDistance: 2,\n\t\tRunE: client.ValidateCmd,\n\t}\n\tprofileQueryCmd.AddCommand(flags.GetCommands(\n\t\tGetCmdQueryProfile(cdc),\n\t\tGetCmdQueryProfiles(cdc),\n\t\tGetCmdQueryProfileParams(cdc),\n\t\tGetCmdQueryDTagRequests(cdc),\n\t)...)\n\treturn profileQueryCmd\n}", "func queryProfileParams(ctx sdk.Context, _ abci.RequestQuery, keeper Keeper) ([]byte, error) {\n\tprofileParams := keeper.GetParams(ctx)\n\n\tbz, err := codec.MarshalJSONIndent(keeper.Cdc, &profileParams)\n\tif err != nil {\n\t\tpanic(\"could not marshal result to JSON\")\n\t}\n\n\treturn bz, nil\n}", "func (svc *inmemService) GetProfile(ctx context.Context, id string) (Profile, error) {\n\t// Get the Read lock from the inmemService struct\n\tsvc.mtx.RLock()\n\n\t// Immediately set up a lock release to occur when the function finishes\n\tdefer svc.mtx.RUnlock()\n\n\t// Look for the profile by the `id` function param\n\tprofile, ok := svc.profiles[id]\n\n\t// Check if the profile id was not found in the datastore\n\tif !ok {\n\n\t\t// Return an empty profile and an error informing the caller that the profile was not found\n\t\treturn Profile{}, ErrNotFound\n\n\t}\n\n\t// Return the profile to the caller and a nil error\n\treturn profile, nil\n\n}", "func GetQueryCmd(queryRoute string, cdc *codec.Codec) *cobra.Command {\n\t// Group profile queries under a subcommand\n\tprofileQueryCmd := &cobra.Command{\n\t\tUse: types.ModuleName,\n\t\tShort: fmt.Sprintf(\"Querying commands for the %s module\", types.ModuleName),\n\t\tDisableFlagParsing: true,\n\t\tSuggestionsMinimumDistance: 2,\n\t\tRunE: client.ValidateCmd,\n\t}\n\n\tprofileQueryCmd.AddCommand(\n\t\tflags.GetCommands(\n\t\t\tGetCmdBalance(queryRoute, cdc),\n\t\t)...,\n\t)\n\n\treturn profileQueryCmd\n}", "func (repository *Datastore)GetProfile(username string)(*user.Person,error){\n\tperson := newUser() //initialize user.Person and will used to store profile info\n\tquery := `SELECT * FROM userRepository WHERE username = ?`\n\terr := repository.Db.Get(&person, query, username) //get person profile details\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &person, nil\n}", "func GetProfile(ctx *router.Context) {\n\tuin, _ := ctx.Keys[middleware.ComerUinContextKey].(uint64)\n\tresponse, err := service.GetComerProfile(uin)\n\tif err != nil {\n\t\tctx.ERROR(\n\t\t\trouter.ErrBuisnessError,\n\t\t\t\"wrong metamask login parameter\",\n\t\t)\n\t\treturn\n\t}\n\n\tctx.OK(response)\n}", "func GetProfile(c *fiber.Ctx) error {\n\tID := c.Query(\"id\")\n\n\tif len(ID) < 1 {\n\t\tc.Send(ID)\n\t\tc.Send(\"Parameter ID is required\")\n\t\tc.SendStatus(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tprofile, err := database.SearchProfile(ID)\n\tif err != nil {\n\t\tc.Send(\"Error Occurred\" + err.Error())\n\t\tc.SendStatus(http.StatusBadRequest)\n\t\treturn\n\t}\n\tif err := c.JSON(profile); err != nil {\n\t\tc.Status(500).Send(err)\n\t\treturn\n\t}\n\tc.Accepts(\"application/json\")\n\tc.SendStatus(http.StatusAccepted)\n}", "func (a *DeviceAPI) GetDeviceProfile(ctx context.Context, req *api.GetDSDeviceProfileRequest) (*api.GetDSDeviceProfileResponse, error) {\n\tlogInfo := \"api/appserver_serves_ui/GetDeviceProfile org=\" + strconv.FormatInt(req.OrgId, 10)\n\n\t// verify if user is global admin\n\tu, err := devmod.NewValidator(a.st).GetUser(ctx)\n\tif err != nil {\n\t\tlog.WithError(err).Error(logInfo)\n\t\treturn &api.GetDSDeviceProfileResponse{}, status.Errorf(codes.Internal, \"unable to verify user: %s\", err.Error())\n\t}\n\t// is user is not global admin, user must have accesss to this organization\n\tif !u.IsGlobalAdmin {\n\t\tif valid, err := organization.NewValidator(a.st).ValidateOrganizationAccess(ctx, authcus.Read, req.OrgId); !valid || err != nil {\n\t\t\treturn &api.GetDSDeviceProfileResponse{}, status.Errorf(codes.Unauthenticated, \"authentication failed: %s\", err)\n\t\t}\n\t}\n\n\tdevClient := mxpcli.Global.GetM2MDeviceServiceClient()\n\n\tresp, err := devClient.GetDeviceProfile(ctx, &pb.GetDSDeviceProfileRequest{\n\t\tOrgId: req.OrgId,\n\t\tDevId: req.DevId,\n\t})\n\tif err != nil {\n\t\tlog.WithError(err).Error(logInfo)\n\t\treturn &api.GetDSDeviceProfileResponse{}, status.Errorf(codes.Unavailable, err.Error())\n\t}\n\n\treturn &api.GetDSDeviceProfileResponse{\n\t\tDevProfile: &api.DSDeviceProfile{\n\t\t\tId: resp.DevProfile.Id,\n\t\t\tDevEui: resp.DevProfile.DevEui,\n\t\t\tFkWallet: resp.DevProfile.FkWallet,\n\t\t\tMode: api.DeviceMode(resp.DevProfile.Mode),\n\t\t\tCreatedAt: resp.DevProfile.CreatedAt,\n\t\t\tLastSeenAt: resp.DevProfile.LastSeenAt,\n\t\t\tApplicationId: resp.DevProfile.ApplicationId,\n\t\t\tName: resp.DevProfile.Name,\n\t\t},\n\t}, status.Error(codes.OK, \"\")\n}", "func Profile(req *ProfileRequest, dns string) (*ProfileResponse, error) {\n\tctx := context.Background()\n\ttgt, err := url.Parse(\"http://\" + dns + \"/profile\")\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n\tendPoint := ht.NewClient(\"POST\", tgt, encodeRequest, decodeProfileResponse).Endpoint()\n\tresp, err := endPoint(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresponse := resp.(ProfileResponse)\n\treturn &response, nil\n}", "func queryProfiles(ctx sdk.Context, _ abci.RequestQuery, keeper Keeper) ([]byte, error) {\n\taccounts := keeper.GetProfiles(ctx)\n\n\tbz, err := codec.MarshalJSONIndent(keeper.Cdc, &accounts)\n\tif err != nil {\n\t\tpanic(\"could not marshal result to JSON\")\n\t}\n\n\treturn bz, nil\n}", "func (pu *ProfileUKM) QueryOwnerProfile() *ProfileQuery {\n\treturn (&ProfileUKMClient{config: pu.config}).QueryOwnerProfile(pu)\n}", "func (r *client) Profile(ctx context.Context, req *debugpb.ProfileRequest) (debugpb.Debug_ProfileClient, error) {\n\tresp, err := r.DebugClient.Profile(ctx, req, r.callOptions...)\n\tif err != nil {\n\t\treturn nil, ConvertGRPCError(err)\n\t}\n\treturn resp, nil\n}", "func GetProfile(_db Queryable, uid int64) (*Profile, error) {\n\tp := &Profile{}\n\terr := _db.QueryRow(`SELECT first_name, last_name, high_score, gender, \n img, birth_date, signup_date\n FROM profile WHERE uid = $1`, uid).Scan(\n\t\tp.FirstName, p.LastName, p.HighScore, p.Gender, p.Img, p.BirthDate, p.SignupDate)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn p, err\n\t}\n}", "func (d *database) getProfile(person string) (profile string, err error) {\n\tquery := fmt.Sprintf(\"SELECT letter_content FROM letters WHERE opened == 1 AND letter_purpose == '%s' AND sender == '%s' ORDER BY time DESC;\", purpose.ActionProfile, person)\n\tlogger.Log.Debug(query)\n\trows, err := d.db.Query(query)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"getProfile\")\n\t\treturn\n\t}\n\tdefer rows.Close()\n\n\t// loop through rows\n\tfor rows.Next() {\n\t\terr = rows.Scan(&profile)\n\t\tif err != nil {\n\t\t\terr = errors.Wrap(err, \"getProfile\")\n\t\t\treturn\n\t\t}\n\t\tbreak\n\t}\n\n\terr = rows.Err()\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"getProfile\")\n\t}\n\treturn\n}", "func dnsmasqProfile(state *state.State, n network) (string, error) {\n\trootPath := \"\"\n\tif shared.InSnap() {\n\t\trootPath = \"/var/lib/snapd/hostfs\"\n\t}\n\n\t// Render the profile.\n\tvar sb *strings.Builder = &strings.Builder{}\n\terr := dnsmasqProfileTpl.Execute(sb, map[string]interface{}{\n\t\t\"name\": DnsmasqProfileName(n),\n\t\t\"networkName\": n.Name(),\n\t\t\"varPath\": shared.VarPath(\"\"),\n\t\t\"rootPath\": rootPath,\n\t\t\"snap\": shared.InSnap(),\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn sb.String(), nil\n}", "func (s Service) GetProfile(ctx context.Context, url string, language string) (*profile.Profile, error) {\n\tspan := s.tracer.MakeSpan(ctx, \"GetProfile\")\n\tdefer span.Finish()\n\n\t// retrive profile of target\n\tprof, err := s.repository.Users.GetProfileByURL(ctx, url)\n\tif err != nil {\n\t\ts.tracer.LogError(span, err)\n\t\treturn nil, err\n\t}\n\n\terr = s.processProfile(ctx, language, prof)\n\tif err != nil {\n\t\ts.tracer.LogError(span, err)\n\t\treturn nil, err\n\t}\n\n\treturn prof, nil\n}", "func GetServiceProfile(ctx context.Context, db sqlx.Queryer, id uuid.UUID, localOnly bool) (ServiceProfile, error) {\n\tvar sp ServiceProfile\n\trow := db.QueryRowx(`\n\t\tselect\n\t\t\tnetwork_server_id,\n\t\t\torganization_id,\n\t\t\tcreated_at,\n\t\t\tupdated_at,\n\t\t\tname\n\t\tfrom service_profile\n\t\twhere\n\t\t\tservice_profile_id = $1`,\n\t\tid,\n\t)\n\tif err := row.Err(); err != nil {\n\t\treturn sp, handlePSQLError(Select, err, \"select error\")\n\t}\n\n\terr := row.Scan(&sp.NetworkServerID, &sp.OrganizationID, &sp.CreatedAt, &sp.UpdatedAt, &sp.Name)\n\tif err != nil {\n\t\treturn sp, handlePSQLError(Scan, err, \"scan error\")\n\t}\n\n\tif localOnly {\n\t\treturn sp, nil\n\t}\n\n\tn, err := GetNetworkServer(ctx, db, sp.NetworkServerID)\n\tif err != nil {\n\t\treturn sp, errors.Wrap(err, \"get network-server errror\")\n\t}\n\n\tnsClient, err := networkserver.GetPool().Get(n.Server, []byte(n.CACert), []byte(n.TLSCert), []byte(n.TLSKey))\n\tif err != nil {\n\t\treturn sp, errors.Wrap(err, \"get network-server client error\")\n\t}\n\n\tresp, err := nsClient.GetServiceProfile(ctx, &ns.GetServiceProfileRequest{\n\t\tId: id.Bytes(),\n\t})\n\tif err != nil {\n\t\treturn sp, errors.Wrap(err, \"get service-profile error\")\n\t}\n\n\tif resp.ServiceProfile == nil {\n\t\treturn sp, errors.New(\"service_profile must not be nil\")\n\t}\n\n\tsp.ServiceProfile = *resp.ServiceProfile\n\n\treturn sp, nil\n}", "func (s *SmartContract) QueryUserProfile(ctx contractapi.TransactionContextInterface, userId string) (*UserProfile, error) {\n\tcarAsBytes, err := ctx.GetStub().GetState(\"profile-\" + userId)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to read from world state. %s\", err.Error())\n\t}\n\n\tif carAsBytes == nil {\n\t\treturn nil, fmt.Errorf(\"%s does not exist\", userId)\n\t}\n\n\tcar := new(UserProfile)\n\t_ = json.Unmarshal(carAsBytes, car)\n\n\treturn car, nil\n}", "func getProfile(name string) (*profile.Specification, error) {\n\tprofiles, err := profiles.GetKnownProfiles()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, p := range profiles {\n\t\tif p.Label == name {\n\t\t\treturn p, nil\n\t\t}\n\t}\n\treturn nil, nil\n\n\t// TODO(jsimsa): This function assumes the existence of a profile\n\t// server from which the profiles can be retrieved. The profile\n\t// server is a work in progress. When it exists, the commented out\n\t// code below should work.\n\t/*\n\t\tvar profile profile.Specification\n\t\t\t\tclient, err := r.NewClient()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, verror.New(ErrOperationFailed, nil, fmt.Sprintf(\"NewClient() failed: %v\", err))\n\t\t\t\t}\n\t\t\t\tdefer client.Close()\n\t\t\t server := // TODO\n\t\t\t\tmethod := \"Specification\"\n\t\t\t\tinputs := make([]interface{}, 0)\n\t\t\t\tcall, err := client.StartCall(server + \"/\" + name, method, inputs)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, verror.New(ErrOperationFailed, nil, fmt.Sprintf(\"StartCall(%s, %q, %v) failed: %v\\n\", server + \"/\" + name, method, inputs, err))\n\t\t\t\t}\n\t\t\t\tif err := call.Finish(&profiles); err != nil {\n\t\t\t\t\treturn nil, verror.New(ErrOperationFailed, nil, fmt.Sprintf(\"Finish(%v) failed: %v\\n\", &profiles, err))\n\t\t\t\t}\n\t\treturn &profile, nil\n\t*/\n}", "func LookupConnectionProfile(ctx *pulumi.Context, args *LookupConnectionProfileArgs, opts ...pulumi.InvokeOption) (*LookupConnectionProfileResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv LookupConnectionProfileResult\n\terr := ctx.Invoke(\"google-native:datastream/v1alpha1:getConnectionProfile\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "func (c *Config) GetProfile(profile string) ([]Entry, bool) {\n\tlog.Println(\"[DEBUG] GetProfile\", profile)\n\tentries, ok := c.Profiles[profile]\n\tif ok {\n\t\treturn entries, true\n\t}\n\n\treturn nil, false\n}", "func (db *DB) GetProfile(userID string) (*types.Profile, error) {\n\tsqlStatement := `\n\t\tSELECT\n\t\t\tname,\n\t\t\tusername\n\t\tFROM\n\t\t\tcoindrop_profiles\n\t\tWHERE\n\t\t\tuser_id = $1\n\t\t`\n\n\tstmt, err := db.client.Prepare(sqlStatement)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer stmt.Close()\n\n\trow := stmt.QueryRow(userID)\n\n\tvar name sql.NullString\n\tvar username sql.NullString\n\n\terr = row.Scan(\n\t\t&name,\n\t\t&username,\n\t)\n\tif err == sql.ErrNoRows {\n\t\treturn &types.Profile{\n\t\t\tName: \"\",\n\t\t\tUsername: \"\",\n\t\t}, nil\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &types.Profile{\n\t\tName: name.String,\n\t\tUsername: username.String,\n\t}, nil\n}", "func (dpc *deviceProfileRestClient) requestDeviceProfile(url string, ctx context.Context) (models.DeviceProfile, error) {\n\tdata, err := clients.GetRequest(url, ctx)\n\tif err != nil {\n\t\treturn models.DeviceProfile{}, err\n\t}\n\n\tdp := models.DeviceProfile{}\n\terr = json.Unmarshal(data, &dp)\n\treturn dp, err\n}", "func GetProfile() map[string]string {\n\treturn Creds.GetStringMapString(\"profiles.\" + strings.Replace(viper.GetString(\"profile\"), \".\", \"-\", -1))\n}", "func newCmdProfile() *cobra.Command {\n\toptions := newProfileOptions()\n\n\tcmd := &cobra.Command{\n\t\tUse: \"profile [flags] (--template | --open-api file | --proto file) (SERVICE)\",\n\t\tShort: \"Output service profile config for Kubernetes\",\n\t\tLong: \"Output service profile config for Kubernetes.\",\n\t\tExample: ` # Output a basic template to apply after modification.\n linkerd profile -n emojivoto --template web-svc\n\n # Generate a profile from an OpenAPI specification.\n linkerd profile -n emojivoto --open-api web-svc.swagger web-svc\n\n # Generate a profile from a protobuf definition.\n linkerd profile -n emojivoto --proto Voting.proto vote-svc\n`,\n\t\tArgs: cobra.ExactArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif options.namespace == \"\" {\n\t\t\t\toptions.namespace = pkgcmd.GetDefaultNamespace(kubeconfigPath, kubeContext)\n\t\t\t}\n\t\t\toptions.name = args[0]\n\t\t\tclusterDomain := defaultClusterDomain\n\n\t\t\terr := options.validate()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// performs an online profile generation and access-check to k8s cluster to extract\n\t\t\t// clusterDomain from linkerd configuration\n\t\t\tif !options.ignoreCluster {\n\t\t\t\tvar err error\n\t\t\t\tk8sAPI, err := k8s.NewAPI(kubeconfigPath, kubeContext, impersonate, impersonateGroup, 0)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\t_, values, err := healthcheck.FetchCurrentConfiguration(cmd.Context(), k8sAPI, controlPlaneNamespace)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tif cd := values.ClusterDomain; cd != \"\" {\n\t\t\t\t\tclusterDomain = cd\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif options.template {\n\t\t\t\treturn profiles.RenderProfileTemplate(options.namespace, options.name, clusterDomain, os.Stdout)\n\t\t\t} else if options.openAPI != \"\" {\n\t\t\t\treturn profiles.RenderOpenAPI(options.openAPI, options.namespace, options.name, clusterDomain, os.Stdout)\n\t\t\t} else if options.proto != \"\" {\n\t\t\t\treturn profiles.RenderProto(options.proto, options.namespace, options.name, clusterDomain, os.Stdout)\n\t\t\t}\n\n\t\t\t// we should never get here\n\t\t\treturn errors.New(\"Unexpected error\")\n\t\t},\n\t}\n\n\tcmd.PersistentFlags().BoolVar(&options.template, \"template\", options.template, \"Output a service profile template\")\n\tcmd.PersistentFlags().StringVar(&options.openAPI, \"open-api\", options.openAPI, \"Output a service profile based on the given OpenAPI spec file\")\n\tcmd.PersistentFlags().StringVarP(&options.namespace, \"namespace\", \"n\", options.namespace, \"Namespace of the service\")\n\tcmd.PersistentFlags().StringVar(&options.proto, \"proto\", options.proto, \"Output a service profile based on the given Protobuf spec file\")\n\tcmd.PersistentFlags().BoolVar(&options.ignoreCluster, \"ignore-cluster\", options.ignoreCluster, \"Output a service profile through offline generation\")\n\n\treturn cmd\n}", "func (S *Service) GetProfile(ctx context.Context) (profileDataList ProfileDataList, err error) {\n\tprofileList, err := S.repo.GetProfile(ctx)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor _, profile := range profileList.Data {\n\t\tprofileDataList.Profile = append(profileDataList.Profile, profileToProfileData(profile))\n\t}\n\tprofileDataList.TotalData = profileList.TotalData\n\n\treturn\n}", "func GenerateSubProfileQuery() (string, error) {\n\treturn globalProbe.GenerateSubProfileQuery()\n}", "func (s *Server) GetProfile(ctx context.Context, data *jobsRPC.Empty) (*jobsRPC.CandidateProfile, error) {\n\tprofile, err := s.service.GetCandidateProfile(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn candidateProfileToCandidateProfileRPC(profile), nil\n}", "func (c *IRacing) GetProfile(ctx context.Context) (*UserProfile, error) {\n\n\tprofile := &UserProfile{}\n\n\terr := c.json(ctx, http.MethodGet, \"/membersite/member/GetMember\", nil, profile)\n\n\treturn profile, err\n}", "func profileEnvArg(cmd *kingpin.CmdClause, desc string) *string {\n\tif v := os.Getenv(\"AWS_PROFILE\"); len(v) > 0 {\n\t\treturn &v\n\t}\n\treturn cmd.Arg(\"profile\", desc).String()\n}", "func (p *profile) Get(options map[string]interface{}) (riminderResponse.ProfileGetElem, error) {\n\tquery := map[string]string{\n\t\t\"source_id\": options[\"source_id\"].(string),\n\t}\n\tAddIfNotEmptyStrMap(&query, options, \"profile_id\")\n\tAddIfNotEmptyStrMap(&query, options, \"profile_reference\")\n\n\tresp := riminderResponse.ProfileGetContainer{}\n\terr := p.client.Get(\"profile\", query, &resp)\n\tif err != nil {\n\t\treturn riminderResponse.ProfileGetElem{}, err\n\t}\n\treturn resp.Data, nil\n}", "func GetProfile(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tuname, found := vars[\"uname\"]\n\tif !found {\n\t\tw.WriteHeader(http.StatusUnprocessableEntity)\n\t\tfmt.Fprintf(w, \"%s\", \"invalid username\")\n\t\treturn\n\t} // NOT NEEDED\n\n\t// get the username\n\ttokk := r.Header.Get(\"Token\")\n\tvar payload *token.Payload\n\tif tokk != \"\" {\n\t\tmaker, err := token.NewPasetoMaker(\"abcd1234abcd1234abcd1234abcd1234\")\n\t\tif err != nil {\n\t\t\tresponses.ERROR(w, http.StatusInternalServerError, err)\n\t\t\treturn\n\t\t}\n\t\tpayload, err = maker.VerifyToken(tokk)\n\t\tif err != nil {\n\t\t\tpayload = &token.Payload{}\n\t\t}\n\t} else {\n\t\tresponses.ERROR(w, http.StatusUnauthorized, errors.New(\"user not logged in\"))\n\t\treturn\n\t}\n\n\t// form the dto\n\tvar dto *dtos.ProfileDTO = dtos.NewProfileDTO()\n\tif payload.Username != \"\" {\n\t\tdto.LoggedIn = true // some one is there\n\t}\n\tif payload.Username == uname {\n\t\tdto.Editable = true // same user is there\n\t}\n\n\t// start the database\n\tdatabase, err := db.Connect()\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tdefer database.Close()\n\n\t// search the database\n\tvar user schema.User\n\terr = database.Model(&schema.User{}).Where(\"username = ?\", uname).Find(&user).Error\n\tswitch err {\n\tcase nil:\n\tcase gorm.ErrRecordNotFound:\n\t\tresponses.ERROR(w, http.StatusNotFound, gorm.ErrRecordNotFound)\n\t\treturn\n\tdefault:\n\t\tresponses.ERROR(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\t// form the dto now\n\tdto.FromSchema(&user)\n\n\t// more db calls to populate drafts, cards, bookmarks\n\tif dto.Editable {\n\t\tdto.Drafts, err = crud.GetDraftsFromDB(database, dto.Username)\n\t\tif err != nil {\n\t\t\tlog.Println(\"coudnot fetch drafts, cards or bookmarks from db\")\n\t\t}\n\t}\n\tdto.Cards, err = crud.GetCardsFromDB(database, dto.Username)\n\tif dto.Editable {\n\t\tdto.Bookmarks, err = crud.GetBookMarkCardsFromDB(database, dto.Username)\n\t\tif err != nil {\n\t\t\tlog.Println(\"coudnot fetch drafts, cards or bookmarks from db\")\n\t\t}\n\t}\n\n\t// return the response\n\tresponses.JSON(w, http.StatusAccepted, *dto)\n\treturn\n\n}", "func (e Endpoints) GetProfile(ctx context.Context, ID string) (Profile, error) {\n\n\t// Initialize a variable of type GetProfileRequest and set its ID field to the ID value passed to the function\n\trequest := getProfileRequest{ProfileID: ID}\n\n\t// Initialize two variable made by calling `e`'s GetProfileEndpoint field value.\n\t// This function will return a response value of type interface{} and an error\n\tresponse, err := e.GetProfileEndpoint(ctx, request)\n\n\t// Check to see if the endpoint call returned a non-nil error value.\n\tif err != nil {\n\n\t\t// Return an empty value Profile and the error from the endpoint call\n\t\treturn Profile{}, err\n\t}\n\n\t// Initialize a variable called `resp` which will be the result of asserting the response (`response` interface{})\n\t//from GetProfileEndpoint as a GetProfileResponse value\n\tresp := response.(getProfileResponse)\n\n\t// Return the Profile\n\treturn resp.Profile, resp.Err\n\n}", "func GetQueryCmd() *cobra.Command {\n\tqueryCmd := &cobra.Command{\n\t\tUse: types.ModuleName,\n\t\tAliases: []string{\"am\"},\n\t\tShort: \"Querying commands for the account metadata module\",\n\t\tDisableFlagParsing: true,\n\t\tSuggestionsMinimumDistance: 2,\n\t\tRunE: client.ValidateCmd,\n\t}\n\tqueryCmd.AddCommand(\n\t\tGetAttributeParamsCmd(),\n\t\tGetAccountAttributeCmd(),\n\t\tListAccountAttributesCmd(),\n\t\tScanAccountAttributesCmd(),\n\t)\n\n\treturn queryCmd\n}", "func (db *DB) GetProfile(feedID string) (*Profile, error) {\n\tvar ps []Profile\n\tdb.e.NewQuery(\"Profile\").Filter(\"FeedID =\", feedID).GetAll(&ps)\n\n\tif len(ps) == 0 {\n\t\treturn &Profile{}, nil\n\t}\n\treturn &ps[0], nil\n}", "func (bg *Backgrounder) GetProfile(key string) time.Duration {\n\treturn bg.profile[key]\n}", "func GetCmdQueryProposal(cdc *codec.Codec) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"query-proposal\",\n\t\tShort: \"Query details of a single proposal\",\n\t\tExample: \"iriscli gov query-proposal --proposal-id=1\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\t\t\tproposalID := uint64(viper.GetInt64(flagProposalID))\n\n\t\t\tparams := gov.QueryProposalParams{\n\t\t\t\tProposalID: proposalID,\n\t\t\t}\n\n\t\t\tbz, err := cdc.MarshalJSON(params)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tres, err := cliCtx.QueryWithData(fmt.Sprintf(\"custom/%s/proposal\", protocol.GovRoute), bz)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar proposal gov.Proposal\n\t\t\terr = cdc.UnmarshalJSON(res, &proposal)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn cliCtx.PrintOutput(proposal)\n\t\t},\n\t}\n\n\tcmd.Flags().String(flagProposalID, \"\", \"proposalID of proposal being queried\")\n\tcmd.MarkFlagRequired(flagProposalID)\n\treturn cmd\n}", "func (m *MicrosoftManagedDesktop) GetProfile()(*string) {\n val, err := m.GetBackingStore().Get(\"profile\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (s *HighAvailabilityService) GetAvailabilityProfileCommand(input *GetAvailabilityProfileCommandInput) (output *models.AvailabilityProfileView, resp *http.Response, err error) {\n\tpath := \"/highAvailability/availabilityProfiles/{id}\"\n\tpath = strings.Replace(path, \"{id}\", input.Id, -1)\n\n\top := &request.Operation{\n\t\tName: \"GetAvailabilityProfileCommand\",\n\t\tHTTPMethod: \"GET\",\n\t\tHTTPPath: path,\n\t\tQueryParams: map[string]string{},\n\t}\n\toutput = &models.AvailabilityProfileView{}\n\treq := s.newRequest(op, nil, output)\n\n\tif req.Send() == nil {\n\t\treturn output, req.HTTPResponse, nil\n\t}\n\treturn nil, req.HTTPResponse, req.Error\n}", "func GetCmdQueryOwner(queryRoute string, cdc *codec.Codec) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"owner [address]\",\n\t\tShort: \"get the NFTs owned by an account address\",\n\t\tExample: \"nft owner <address> --denom=<denom>\",\n\t\tArgs: cobra.ExactArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\t\t\taddress, err := sdk.AccAddressFromBech32(args[0])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tdenom := viper.GetString(FlagDenom)\n\t\t\tparams := types.NewQueryOwnerParams(denom, address)\n\t\t\tbz, err := cdc.MarshalJSON(params)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tres, _, err := cliCtx.QueryWithData(\n\t\t\t\tfmt.Sprintf(\"custom/%s/%s\", queryRoute, types.QueryOwner), bz)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar out types.Owner\n\t\t\terr = cdc.UnmarshalJSON(res, &out)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn cliCtx.PrintOutput(out)\n\t\t},\n\t}\n\tcmd.Flags().AddFlagSet(FsQueryOwner)\n\treturn cmd\n}", "func GetProfile(alias, domain string, tracing bool) (response *Response, err error) {\r\n\r\n\t// Set the url for the request\r\n\treqURL := fmt.Sprintf(\"%su?paymail=%s@%s\", Network, alias, domain)\r\n\r\n\t// Create a Client and start the request\r\n\tclient := resty.New().SetTimeout(defaultGetTimeout * time.Second)\r\n\tvar resp *resty.Response\r\n\treq := client.R().SetHeader(\"User-Agent\", UserAgent)\r\n\tif tracing {\r\n\t\treq.EnableTrace()\r\n\t}\r\n\tif resp, err = req.Get(reqURL); err != nil {\r\n\t\treturn\r\n\t}\r\n\r\n\t// Start the response\r\n\tresponse = new(Response)\r\n\r\n\t// Tracing enabled?\r\n\tif tracing {\r\n\t\tresponse.Tracing = resp.Request.TraceInfo()\r\n\t}\r\n\r\n\t// Test for a successful status code\r\n\tresponse.StatusCode = resp.StatusCode()\r\n\tif response.StatusCode != http.StatusOK && response.StatusCode != http.StatusNotModified {\r\n\t\tif response.StatusCode != http.StatusNotFound {\r\n\t\t\terr = fmt.Errorf(\"bad response from powping: %d\", response.StatusCode)\r\n\t\t}\r\n\r\n\t\treturn\r\n\t}\r\n\r\n\t// No result\r\n\tif string(resp.Body()) == \"null\" {\r\n\t\treturn\r\n\t}\r\n\r\n\t// Decode the body of the response\r\n\terr = json.Unmarshal(resp.Body(), &response.Profile)\r\n\r\n\treturn\r\n}", "func (s *SmartContract) QueryAllProfiles(ctx contractapi.TransactionContextInterface) ([]QueryProfileResult, error) {\n\tstartKey := \"\"\n\tendKey := \"\"\n\n\tresultsIterator, err := ctx.GetStub().GetStateByRange(startKey, endKey)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resultsIterator.Close()\n\n\tresults := []QueryProfileResult{}\n\n\tfor resultsIterator.HasNext() {\n\t\tqueryResponse, err := resultsIterator.Next()\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif strings.Contains(queryResponse.Key, \"profile-\"){\n\t\t\tprofile := new(UserProfile)\n\t\t\t_ = json.Unmarshal(queryResponse.Value, profile)\n\n\t\t\tqueryResult := QueryProfileResult{Key: queryResponse.Key, Record: profile}\n\t\t\tresults = append(results, queryResult)\n\t\t}\n\t\t\n\t}\n\n\treturn results, nil\n}", "func (mpRepo *ManageProfileRepository) Profile(id uint) (*entity.Profile, []error) {\n\tprfs := entity.Profile{}\n\terrs := mpRepo.conn.First(&prfs, id).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn &prfs, errs\n}", "func (svc *inmemService) GetAddress(ctx context.Context, profileID string, addressID string) (Address, error) {\n\n\t// Get a Read Lock on the svc for atomic read access to the datastore\n\tsvc.mtx.RLock()\n\n\t// Immediately set up a lock release to occur when the function finishes\n\tdefer svc.mtx.RUnlock()\n\n\t// Check the data store to make sure the requested profile exists and set\n\tprofile, ok := svc.profiles[profileID]\n\n\t// If no entry for the profile was fund in the datastore\n\tif !ok {\n\n\t\t// Return an empty valued Address and an error informing the caller that no profile was found with the provided ID.\n\t\treturn Address{}, ErrNotFound\n\t}\n\n\t// Loop through each address attached to the found profile\n\tfor _, address := range profile.Addresses {\n\n\t\t// Check to see if the current address's ID matches the addressID passed in\n\t\tif address.ID == addressID {\n\n\t\t\t// Return that address and a nil error for a value\n\t\t\treturn address, nil\n\t\t}\n\t}\n\n\t// Return an empty Address value and a not found error since we were unable to find the specified address.\n\treturn Address{}, ErrNotFound\n}", "func runOperationDevicesGetDevicesApsProfiles(cmd *cobra.Command, args []string) error {\n\tappCli, err := makeClient(cmd, args)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// retrieve flag values from cmd and fill params\n\tparams := devices.NewGetDevicesApsProfilesParams()\n\tif dryRun {\n\n\t\tlogDebugf(\"dry-run flag specified. Skip sending request.\")\n\t\treturn nil\n\t}\n\t// make request and then print result\n\tmsgStr, err := parseOperationDevicesGetDevicesApsProfilesResult(appCli.Devices.GetDevicesApsProfiles(params, nil))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !debug {\n\n\t\tfmt.Println(msgStr)\n\t}\n\treturn nil\n}", "func GetCmdQueryProposal(queryRoute string, cdc *codec.Codec) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"proposal [proposal-id]\",\n\t\tArgs: cobra.ExactArgs(1),\n\t\tShort: \"Query details of a single proposal\",\n\t\tExample: fmt.Sprintf(\"%s query %s proposal 2\", version.ClientName, types.ModuleName),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\t// Prepare params for querier\n\t\t\tproposalID, err := strconv.ParseUint(args[0], 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"proposal-id %s not a valid uint\", args[0])\n\t\t\t}\n\n\t\t\tproposal, _, err := common.QueryProposalByID(cliCtx, cdc, queryRoute, proposalID)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn cliCtx.PrintOutput(proposal)\n\t\t},\n\t}\n}", "func (s *EmptyStore) ProfileGet(id string) (*storagepb.Profile, error) {\n\treturn nil, fmt.Errorf(\"Profile not found\")\n}", "func GetCmdQueryPool(cdc *codec.Codec) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"pool\",\n\t\tArgs: cobra.NoArgs,\n\t\tShort: \"Query the current staking pool values\",\n\t\tLong: strings.TrimSpace(`Query values for amounts stored in the staking pool:\n\n$ cetcli query staking pool\n`),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\tres, _, err := cliCtx.QueryWithData(\"custom/stakingx/pool\", nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tprintln(string(res))\n\t\t\treturn nil\n\t\t},\n\t}\n}", "func (a *API) GetProfileSearch(ctx context.Context, search *ProfileSearchResp) (*ProfileResp, error) {\n\tvar resp ProfileResp\n\tif err := a.Get(ctx, search.ProfilesURL, &resp); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "func GetCmdQueryDeposit(cdc *codec.Codec) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"query-deposit\",\n\t\tShort: \"Query details of a deposit\",\n\t\tExample: \"iriscli gov query-deposit --proposal-id=1 --depositor=<depositor address>\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\t\t\tproposalID := uint64(viper.GetInt64(flagProposalID))\n\n\t\t\tdepositorAddr, err := sdk.AccAddressFromBech32(viper.GetString(flagDepositor))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tparams := gov.QueryDepositParams{\n\t\t\t\tDepositor: depositorAddr,\n\t\t\t\tProposalID: proposalID,\n\t\t\t}\n\t\t\tbz, err := cdc.MarshalJSON(params)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tres, err := cliCtx.QueryWithData(fmt.Sprintf(\"custom/%s/deposit\", protocol.GovRoute), bz)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar deposit gov.Deposit\n\t\t\tif err := cdc.UnmarshalJSON(res, &deposit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn cliCtx.PrintOutput(deposit)\n\t\t},\n\t}\n\n\tcmd.Flags().String(flagProposalID, \"\", \"proposalID of proposal deposited on\")\n\tcmd.Flags().String(flagDepositor, \"\", \"bech32 depositor address\")\n\tcmd.MarkFlagRequired(flagProposalID)\n\tcmd.MarkFlagRequired(flagDeposit)\n\treturn cmd\n}", "func (d *Daytype) Profile() ProfileQS {\n\treturn ProfileQS{}.DaytypeEq(d)\n}", "func (c Client) GetProfile(id int64) (Profile, error) {\n\tvar p Profile\n\n\turl := fmt.Sprintf(profileURL, c.api, id, c.token)\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn p, err\n\t}\n\tdefer func() {\n\t\t_ = resp.Body.Close()\n\t}()\n\n\tcontent, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn p, err\n\t}\n\n\tif err = json.Unmarshal(content, &p); err != nil {\n\t\treturn p, err\n\t}\n\n\treturn p, checkError(bytes.NewReader(content))\n}", "func (t *SimpleChaincode) QueryPrivate(stub shim.ChaincodeStubInterface, args []string) pb.Response{\n\tif len(args)!=2{\n\t\treturn shim.Error(\"Incorrect arguments, expecting 2\")\n\t}\n\n\tusername := args[0]\n\tcoll := args[1]\n\t//check if the state under username has been deleted\n\tstate_b, err := stub.GetState(username)\n\tif state_b == nil {\n\t\treturn shim.Error(\"User does not exist\")\n\t}\n\n\tprivate_b, err := stub.GetPrivateData(coll, username) \n if err != nil {\n return shim.Error(\"Failed to get private details for \"+username)\n } else if private_b == nil {\n return shim.Error(\"Private details do not exist for \"+username)\n }\n\treturn shim.Success(private_b)\n}", "func (api *LaborStatsAPI) QueryCountryProfile() ([]CountryProfile, error) {\n\ta := CountryProfileAPI{\n\t\tDebug: api.Debug,\n\t\tSecretKey: api.SecretKey,\n\t}\n\n\terr := a.sendRequest()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := a.unmarshalData()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n\n}", "func (c *Store) RetrieveProfile(forAddr string) (*messages.JSONProfile, bool) {\n\tc.ProfileLock.RLock()\n\tdefer c.ProfileLock.RUnlock()\n\n\tif msg, ok := c.Profiles[forAddr]; ok {\n\t\treturn msg.JSONProfile, true\n\t}\n\treturn nil, false\n}", "func (api *API) GetDLPProfile(ctx context.Context, rc *ResourceContainer, profileID string) (DLPProfile, error) {\n\tif rc.Identifier == \"\" {\n\t\treturn DLPProfile{}, ErrMissingResourceIdentifier\n\t}\n\n\tif profileID == \"\" {\n\t\treturn DLPProfile{}, ErrMissingProfileID\n\t}\n\n\turi := buildURI(fmt.Sprintf(\"/%s/%s/dlp/profiles/%s\", rc.Level, rc.Identifier, profileID), nil)\n\n\tres, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)\n\tif err != nil {\n\t\treturn DLPProfile{}, err\n\t}\n\n\tvar dlpProfileResponse DLPProfileResponse\n\terr = json.Unmarshal(res, &dlpProfileResponse)\n\tif err != nil {\n\t\treturn DLPProfile{}, fmt.Errorf(\"%s: %w\", errUnmarshalError, err)\n\t}\n\n\treturn dlpProfileResponse.Result, nil\n}", "func getCompleteProfile(ctx sdk.Context, path []string, k Keeper) (res []byte, sdkError error) {\n\tid := path[0]\n\tuser, err := k.GetUser(ctx, id)\n\tif err != nil {\n\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, \"user with address not found\")\n\t}\n\n\tthoughts := k.ListThoughtByCreator(ctx, user.Creator)\n\n\tvar followers []types.User\n\tvar followings []types.User\n\n\tfor _, addr := range user.Followers {\n\t\tfollower, err := k.GetUser(ctx, addr.String())\n\t\tif err == nil {\n\t\t\tfollowers = append(followers, follower)\n\t\t}\n\t}\n\n\tfor _, addr := range user.Following {\n\t\tfollowing, err := k.GetUser(ctx, addr.String())\n\t\tif err == nil {\n\t\t\tfollowings = append(followings, following)\n\t\t}\n\t}\n\n\tvar completeProfile = types.CompleteProfile{\n\t\tCreator: user.Creator,\n\t\tID: user.ID,\n\t\tUsername: user.Username,\n\t\tBio: user.Bio,\n\t\tAvatar: user.Avatar,\n\t\tFollowing: followings,\n\t\tFollowers: followers,\n\t\tThoughts: thoughts,\n\t}\n\n\tres, err = codec.MarshalJSONIndent(k.cdc, completeProfile)\n\tif err != nil {\n\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())\n\t}\n\n\treturn res, nil\n}", "func GetProfile(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *ProfileState, opts ...pulumi.ResourceOption) (*Profile, error) {\n\tvar resource Profile\n\terr := ctx.ReadResource(\"azure-native:cdn/v20200415:Profile\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func DefaultReadProfile(ctx context.Context, in *Profile, db *gorm1.DB) (*Profile, 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).(ProfileORMWithBeforeReadApplyQuery); ok {\n\t\tif db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif db, err = gorm2.ApplyFieldSelection(ctx, db, nil, &ProfileORM{}); err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(ProfileORMWithBeforeReadFind); ok {\n\t\tif db, err = hook.BeforeReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tormResponse := ProfileORM{}\n\tif err = db.Where(&ormObj).First(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormResponse).(ProfileORMWithAfterReadFind); ok {\n\t\tif err = hook.AfterReadFind(ctx, db); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse, err := ormResponse.ToPB(ctx)\n\treturn &pbResponse, err\n}", "func (t tomlConfig) getProfile(name string) Database {\n\treturn t.DB[name]\n}", "func (s *Service) ProfilesGet(userID string) *ProfilesGetOp {\n\treturn &ProfilesGetOp{\n\t\tCredential: s.credential,\n\t\tMethod: \"GET\",\n\t\tPath: strings.Join([]string{\"users\", userID, \"profile\"}, \"/\"),\n\t\tAccept: \"application/json\",\n\t\tQueryOpts: make(url.Values),\n\t\tVersion: esign.APIv21,\n\t}\n}", "func (p *profileParsing) Get(options map[string]interface{}) (riminderResponse.ProfileParsingGetElem, error) {\n\tquery := map[string]string{\n\t\t\"source_id\": options[\"source_id\"].(string),\n\t}\n\tAddIfNotEmptyStrMap(&query, options, \"profile_id\")\n\tAddIfNotEmptyStrMap(&query, options, \"profile_reference\")\n\n\tresp := riminderResponse.ProfileParsingGetContainer{}\n\terr := p.client.Get(\"profile/parsing\", query, &resp)\n\tif err != nil {\n\t\treturn riminderResponse.ProfileParsingGetElem{}, err\n\t}\n\treturn resp.Data, nil\n}", "func (repository *Datastore)UpdateProfile(p *user.Person)error {\n\tquery := `UPDATE userRepository SET password=?,firstname=?,lastname=?,age=?,gender=?,city=?,country=?,phone=?,email=?,githubUsername=? WHERE username = ?`\n\tchanges, err := repository.Db.Preparex(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = changes.Exec(p.Password, p.Firstname, p.Lastname, p.Age, p.Gender, p.City, p.Country, p.Phone, p.EmailId, p.GithubUsername, p.Username)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Println(\"profile updated on database\")\n\treturn nil\n}", "func (s *Service) GetProfileImage(userID string) *GetProfileImageOp {\n\treturn &GetProfileImageOp{\n\t\tCredential: s.credential,\n\t\tMethod: \"GET\",\n\t\tPath: strings.Join([]string{\"users\", userID, \"profile\", \"image\"}, \"/\"),\n\t\tQueryOpts: make(url.Values),\n\t\tVersion: esign.APIv21,\n\t}\n}", "func GetCmdQueryDenomTrace() *cobra.Command {\r\n\tcmd := &cobra.Command{\r\n\t\tUse: \"denom-trace [hash]\",\r\n\t\tShort: \"Query the denom trace info from a given trace hash\",\r\n\t\tLong: \"Query the denom trace info from a given trace hash\",\r\n\t\tExample: fmt.Sprintf(\"%s query ibc-transfer denom-trace [hash]\", version.AppName),\r\n\t\tArgs: cobra.ExactArgs(1),\r\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\r\n\t\t\tclientCtx, err := client.GetClientQueryContext(cmd)\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn err\r\n\t\t\t}\r\n\t\t\tqueryClient := types.NewQueryClient(clientCtx)\r\n\r\n\t\t\treq := &types.QueryDenomTraceRequest{\r\n\t\t\t\tHash: args[0],\r\n\t\t\t}\r\n\r\n\t\t\tres, err := queryClient.DenomTrace(context.Background(), req)\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn err\r\n\t\t\t}\r\n\r\n\t\t\treturn clientCtx.PrintProto(res)\r\n\t\t},\r\n\t}\r\n\r\n\tflags.AddQueryFlagsToCmd(cmd)\r\n\treturn cmd\r\n}", "func (c *Cluster) GetProfile(project, name string) (int64, *api.Profile, error) {\n\tvar result *api.Profile\n\tvar id int64\n\n\terr := c.Transaction(context.TODO(), func(ctx context.Context, tx *ClusterTx) error {\n\t\tvar err error\n\t\tprofiles, err := cluster.GetProfilesIfEnabled(ctx, tx.Tx(), project, []string{name})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(profiles) != 1 {\n\t\t\treturn fmt.Errorf(\"Expected one profile with name %q, got %d profiles\", name, len(profiles))\n\t\t}\n\n\t\tprofile := profiles[0]\n\t\tid = int64(profile.ID)\n\t\tresult, err = profile.ToAPI(ctx, tx.Tx())\n\n\t\treturn err\n\t})\n\tif err != nil {\n\t\treturn -1, nil, err\n\t}\n\n\treturn id, result, nil\n}", "func QueryBalanceCmd() *cobra.Command {\n\treturn qflags(&cobra.Command{\n\t\tUse: \"balance [batch_denom] [account]\",\n\t\tShort: \"Retrieve the tradable and retired balances of the credit batch\",\n\t\tLong: \"Retrieve the tradable and retired balances of the credit batch for a given account address\",\n\t\tArgs: cobra.ExactArgs(2),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tc, ctx, err := mkQueryClient(cmd)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tres, err := c.Balance(cmd.Context(), &ecocredit.QueryBalanceRequest{\n\t\t\t\tBatchDenom: args[0], Account: args[1],\n\t\t\t})\n\t\t\treturn print(ctx, res, err)\n\t\t},\n\t})\n}", "func (s *HighAvailabilityService) GetAvailabilityProfileDescriptorCommand(input *GetAvailabilityProfileDescriptorCommandInput) (output *models.DescriptorView, resp *http.Response, err error) {\n\tpath := \"/highAvailability/availabilityProfiles/descriptors/{availabilityProfileType}\"\n\tpath = strings.Replace(path, \"{availabilityProfileType}\", input.AvailabilityProfileType, -1)\n\n\top := &request.Operation{\n\t\tName: \"GetAvailabilityProfileDescriptorCommand\",\n\t\tHTTPMethod: \"GET\",\n\t\tHTTPPath: path,\n\t\tQueryParams: map[string]string{},\n\t}\n\toutput = &models.DescriptorView{}\n\treq := s.newRequest(op, nil, output)\n\n\tif req.Send() == nil {\n\t\treturn output, req.HTTPResponse, nil\n\t}\n\treturn nil, req.HTTPResponse, req.Error\n}", "func (e *sObjstoreV1GwService) GetServiceProfile(method string) (apigw.ServiceProfile, error) {\n\tif ret, ok := e.svcProf[method]; ok {\n\t\treturn ret, nil\n\t}\n\treturn nil, errors.New(\"not found\")\n}", "func (c *Control) Profile() ProfileQS {\n\treturn ProfileQS{}.ControlEq(c)\n}", "func (c *client) GetProfile(jwt string, profileID string) (*Profile, error) {\n\tu, err := url.Parse(fmt.Sprintf(\"%s/%s\", c.profURL.String(), profileID))\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to parse url %s\", err)\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to create new request %s\", err)\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %s\", jwt))\n\n\tresp, err := c.c.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"GetProfile: Code: %d Status: %s\", resp.StatusCode, resp.Status)\n\t}\n\n\tvar prof *Profile\n\terr = json.NewDecoder(resp.Body).Decode(&prof)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"GetProfile: failed to decode resp body: %s\", resp.Body)\n\t}\n\n\treturn prof, nil\n}", "func (_DelegateProfile *DelegateProfileSession) GetProfileByField(_delegate common.Address, _field string) ([]byte, error) {\n\treturn _DelegateProfile.Contract.GetProfileByField(&_DelegateProfile.CallOpts, _delegate, _field)\n}", "func QueryAccount(cdc *wire.Codec, addr string) (*qosacc.QOSAccount, error) {\n\tkey, err := types.AccAddressFromBech32(addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcliCtx := context.NewOQSCLIContext().WithCodec(cdc)\n\n\tacc, err := cliCtx.GetAccount(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn acc, nil\n}", "func GetProfile(c *gin.Context, auth *oauth2.Config, apiToken *oauth2.Token) (profile Profile, err error) {\n\tclient := auth.Client(c, apiToken)\n\turi := \"\"\n\tswitch auth.Endpoint {\n\tcase facebook.Endpoint:\n\t\turi = \"https://graph.facebook.com/v2.2/me?fields=id,name,email,picture,first_name,last_name\"\n\tcase google.Endpoint:\n\t\turi = \"https://www.googleapis.com/oauth2/v1/userinfo?alt=json\"\n\tdefault:\n\t\turi = \"\"\n\t}\n\n\tresp, err := client.Get(uri)\n\tif err != nil {\n\t\tc.AbortWithError(http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tdefer resp.Body.Close()\n\tcontents, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tc.AbortWithError(http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tswitch auth.Endpoint {\n\tcase facebook.Endpoint:\n\t\tvar p ProfileFacebook\n\t\terr = json.Unmarshal(contents, &p)\n\t\tif err != nil {\n\t\t\tprofile = Profile{}\n\t\t} else {\n\t\t\tprofile = Profile{\n\t\t\t\tID: p.ID,\n\t\t\t\tEmail: p.Email,\n\t\t\t\tFirstName: p.FirstName,\n\t\t\t\tLastName: p.LastName,\n\t\t\t\tHd: p.Hd,\n\t\t\t\tLocale: p.Locale,\n\t\t\t\tName: p.Name,\n\t\t\t\tSource: \"facebook\",\n\t\t\t}\n\t\t}\n\tcase google.Endpoint:\n\t\tvar p ProfileGoogle\n\t\terr = json.Unmarshal(contents, &p)\n\t\tif err != nil {\n\t\t\tprofile = Profile{}\n\t\t} else {\n\t\t\tprofile = Profile{\n\t\t\t\tID: p.ID,\n\t\t\t\tEmail: p.Email,\n\t\t\t\tFirstName: p.GivenName,\n\t\t\t\tLastName: p.FamilyName,\n\t\t\t\tHd: p.Hd,\n\t\t\t\tLocale: p.Locale,\n\t\t\t\tName: p.Name,\n\t\t\t\tSource: \"google\",\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tprofile = Profile{}\n\t}\n\n\tif len(profile.Email) == 0 {\n\t\terr = errors.New(\"Empty Email\")\n\t}\n\n\treturn\n}", "func GetEvidenceQueryCmd(storeName string, cdc *codec.Codec) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"evidence <evidence-address> <signer-address>\",\n\t\tShort: \"get evidence for claim\",\n\t\tArgs: cobra.ExactArgs(2),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\t\t\tcontent, err := types.DecodeBech32DataAddress(args[0])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tsigner, err := sdk.AccAddressFromBech32(args[1])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tres, err := cliCtx.QueryStore(claim.KeySignatureEvidence(content, signer), storeName)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif len(res) == 0 {\n\t\t\t\treturn fmt.Errorf(\"no evidence for claim\")\n\t\t\t}\n\n\t\t\tvar evidence []types.DataAddress\n\t\t\terr = cdc.UnmarshalBinaryBare(res, &evidence)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar evidenceString strings.Builder\n\n\t\t\tfor _, data := range evidence {\n\t\t\t\tevidenceString.WriteString(data.String())\n\t\t\t\tevidenceString.WriteString(\" \")\n\t\t\t}\n\n\t\t\tfmt.Println(evidenceString)\n\t\t\treturn nil\n\t\t},\n\t}\n}", "func GetProfile(ctx *pulumi.Context) string {\n\tv, err := config.Try(ctx, \"aws:profile\")\n\tif err == nil {\n\t\treturn v\n\t}\n\tif dv, ok := getEnvOrDefault(\"\", nil, \"AWS_PROFILE\").(string); ok {\n\t\treturn dv\n\t}\n\treturn v\n}", "func GetCmdQueryTaxRate(queryRoute string, cdc *codec.Codec) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: treasury.QueryTaxRate + \" [epoch]\",\n\t\tShort: \"Query the stability tax rate\",\n\t\tLong: strings.TrimSpace(`\nQuery the stability tax rate at the specified epoch.\n\n$ terracli query treasury taxrate --epoch=14\n`),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\tepoch := viper.GetInt(flagEpoch)\n\t\t\tres, err := cliCtx.QueryWithData(fmt.Sprintf(\"custom/%s/%s/%d\", queryRoute, treasury.QueryTaxRate, epoch), nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar taxRate sdk.Dec\n\t\t\tcdc.MustUnmarshalBinaryLengthPrefixed(res, &taxRate)\n\t\t\treturn cliCtx.PrintOutput(taxRate)\n\t\t},\n\t}\n\n\treturn cmd\n}", "func GetCmdQueryFeePool(queryRoute string, cdc *codec.Codec) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"pool\",\n\t\tArgs: cobra.NoArgs,\n\t\tShort: \"Query the global fee pool\",\n\t\tLong: \"pool\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\t// Query the proposal\n\t\t\tres, err := queryFeePool(cliCtx, cdc, queryRoute)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfmt.Println(string(res))\n\t\t\treturn nil\n\t\t},\n\t}\n\n\treturn cmd\n}", "func LookupProfile(ctx *pulumi.Context, args *LookupProfileArgs, opts ...pulumi.InvokeOption) (*LookupProfileResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv LookupProfileResult\n\terr := ctx.Invoke(\"aws-native:transfer:getProfile\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "func GetQueryCmd() *cobra.Command {\n\tqueryCmd := &cobra.Command{\n\t\tUse: types.ModuleName,\n\t\tAliases: []string{\"md\"},\n\t\tShort: \"Querying commands for the metadata module\",\n\t\tDisableFlagParsing: true,\n\t\tSuggestionsMinimumDistance: 2,\n\t\tRunE: client.ValidateCmd,\n\t}\n\tqueryCmd.AddCommand(\n\t\tGetMetadataParamsCmd(),\n\t\tGetMetadataByIDCmd(),\n\t\tGetMetadataGetAllCmd(),\n\t\tGetMetadataScopeCmd(),\n\t\tGetMetadataSessionCmd(),\n\t\tGetMetadataRecordCmd(),\n\t\tGetMetadataScopeSpecCmd(),\n\t\tGetMetadataContractSpecCmd(),\n\t\tGetMetadataRecordSpecCmd(),\n\t\tGetOwnershipCmd(),\n\t\tGetValueOwnershipCmd(),\n\t\tGetOSLocatorCmd(),\n\t)\n\treturn queryCmd\n}", "func GetAccountAttributeCmd() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"get [address] [name]\",\n\t\tShort: \"Get account attributes by name\",\n\t\tExample: strings.TrimSpace(\n\t\t\tfmt.Sprintf(`\n\t\t\t\t$ %[1]s query attribute get pb1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk attrib.name\n\t\t\t\t$ %[1]s query attribute get pb1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk attrib.name --page=2 --limit=100\n\t\t\t\t`,\n\t\t\t\tversion.AppName,\n\t\t\t)),\n\t\tArgs: cobra.ExactArgs(2),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tclientCtx, err := client.GetClientQueryContext(cmd)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tqueryClient := types.NewQueryClient(clientCtx)\n\n\t\t\tpageReq, err := client.ReadPageRequest(withPageKeyDecoded(cmd.Flags()))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\taddress := strings.ToLower(strings.TrimSpace(args[0]))\n\t\t\tname := strings.ToLower(strings.TrimSpace(args[1]))\n\n\t\t\tvar response *types.QueryAttributeResponse\n\t\t\tif response, err = queryClient.Attribute(\n\t\t\t\tcontext.Background(),\n\t\t\t\t&types.QueryAttributeRequest{Account: address, Name: name, Pagination: pageReq},\n\t\t\t); err != nil {\n\t\t\t\tfmt.Printf(\"failed to query account \\\"%s\\\" attributes for name \\\"%s\\\": %v\\n\", address, name, err)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn clientCtx.PrintProto(response)\n\t\t},\n\t}\n\n\tflags.AddPaginationFlagsToCmd(cmd, \"get\")\n\tflags.AddQueryFlagsToCmd(cmd)\n\n\treturn cmd\n}", "func Profile(context *cli.Context) error {\n\tsecretKey := context.String(flags.SecretKeyFlag)\n\tif err := fieldEmpty(secretKey, flags.SecretKeyFlag); err != nil {\n\t\treturn err\n\t}\n\taccessKey := context.String(flags.AccessKeyFlag)\n\tif err := fieldEmpty(accessKey, flags.AccessKeyFlag); err != nil {\n\t\treturn err\n\t}\n\tsessionToken := context.String(flags.SessionTokenFlag)\n\tprofileName := context.String(flags.ProfileNameFlag)\n\tif err := fieldEmpty(profileName, flags.ProfileNameFlag); err != nil {\n\t\treturn err\n\t}\n\tprofile := &config.Profile{\n\t\tAWSAccessKey: accessKey,\n\t\tAWSSecretKey: secretKey,\n\t\tAWSSessionToken: sessionToken,\n\t}\n\n\trdwr, err := config.NewReadWriter()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Error saving profile\")\n\t}\n\tif err = rdwr.SaveProfile(profileName, profile); err != nil {\n\t\treturn errors.Wrap(err, \"Error saving profile\")\n\t}\n\n\tlogrus.Infof(\"Saved ECS CLI profile configuration %s.\", profileName)\n\treturn nil\n}", "func DecodeGrpcReqDSCProfile(ctx context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*DSCProfile)\n\treturn req, nil\n}", "func queryfb(device string) (uint16, uint16, error) {\n\tvar fbinfo C.struct_fb_var_screeninfo\n\n\tif C.query_fb(C.CString(device), &fbinfo) != 0 {\n\t\treturn 0, 0, fmt.Errorf(\"%s: permission denied\")\n\t}\n\n\treturn uint16(fbinfo.xres), uint16(fbinfo.yres), nil\n}", "func (c *Cluster) GetInstancesWithProfile(project, profile string) (map[string][]string, error) {\n\terr := c.Transaction(context.TODO(), func(ctx context.Context, tx *ClusterTx) error {\n\t\tenabled, err := cluster.ProjectHasProfiles(context.Background(), tx.tx, project)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Check if project has profiles: %w\", err)\n\t\t}\n\n\t\tif !enabled {\n\t\t\tproject = \"default\"\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tq := `SELECT instances.name, projects.name FROM instances\n\t\tJOIN instances_profiles ON instances.id == instances_profiles.instance_id\n\t\tJOIN projects ON projects.id == instances.project_id\n\t\tWHERE instances_profiles.profile_id ==\n\t\t (SELECT profiles.id FROM profiles\n\t\t JOIN projects ON projects.id == profiles.project_id\n\t\t WHERE profiles.name=? AND projects.name=?)`\n\n\tresults := map[string][]string{}\n\tinargs := []any{profile, project}\n\tvar name string\n\toutfmt := []any{name, name}\n\n\toutput, err := queryScan(c, q, inargs, outfmt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, r := range output {\n\t\tif results[r[1].(string)] == nil {\n\t\t\tresults[r[1].(string)] = []string{}\n\t\t}\n\n\t\tresults[r[1].(string)] = append(results[r[1].(string)], r[0].(string))\n\t}\n\n\treturn results, nil\n}", "func (m *WindowsKioskProfile) GetProfileId()(*string) {\n val, err := m.GetBackingStore().Get(\"profileId\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func GetCmdQueryTaxProceeds(queryRoute string, cdc *codec.Codec) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: treasury.QueryTaxProceeds,\n\t\tShort: \"Query the tax proceeds for the epoch\",\n\t\tLong: strings.TrimSpace(`\nQuery the tax proceeds corresponding to the given epoch. The return value will be sdk.Coins{} of all the taxes collected. \n\n$ terracli query treasury tax-proceeds --epoch=14\n`),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\tepoch := viper.GetInt(flagEpoch)\n\t\t\tres, err := cliCtx.QueryWithData(fmt.Sprintf(\"custom/%s/%s/%d\", queryRoute, treasury.QueryTaxProceeds, epoch), nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar taxProceeds sdk.Coins\n\t\t\tcdc.MustUnmarshalBinaryLengthPrefixed(res, &taxProceeds)\n\t\t\treturn cliCtx.PrintOutput(taxProceeds)\n\t\t},\n\t}\n\n\treturn cmd\n}", "func (t *QueryCommand) GetUsage() string {\n\treturn \"dev:query\"\n}", "func (ConferenceAPI) GetProfile(c context.Context) (*Profile, error) {\n\tpid, err := profileID(c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn getProfile(c, pid)\n}", "func GetQueryCmd(queryRoute string) *cobra.Command {\n\t// Group id queries under a subcommand\n\tcmd := &cobra.Command{\n\t\tUse: types.ModuleName,\n\t\tShort: fmt.Sprintf(\"Querying commands for the %s module\", types.ModuleName),\n\t\tDisableFlagParsing: true,\n\t\tSuggestionsMinimumDistance: 2,\n\t\tRunE: client.ValidateCmd,\n\t}\n\tcmd.AddCommand(\n\t\tCmdGetGovernmentAddr(),\n\t)\n\treturn cmd\n}", "func TestProfile(t *testing.T) {\n\tvar se profile.Profile\n\n\t// Validate returned fields to match expected name set.\n\tfields := se.Fields()\n\n\tif _, ok := fields[\"address\"]; !ok {\n\t\ttests.Failed(\"Should have a 'address' field\")\n\t}\n\ttests.Passed(\"Should have a 'address' field\")\n\n\tif _, ok := fields[\"user_id\"]; !ok {\n\t\ttests.Failed(\"Should have a 'user_id' field\")\n\t}\n\ttests.Passed(\"Should have a 'user_id' field\")\n\n\tif _, ok := fields[\"public_id\"]; !ok {\n\t\ttests.Failed(\"Should have a 'public_id' field\")\n\t}\n\ttests.Passed(\"Should have a 'public_id' field\")\n\n\tif _, ok := fields[\"first_name\"]; !ok {\n\t\ttests.Failed(\"Should have a 'first_name' field\")\n\t}\n\ttests.Passed(\"Should have a 'first_name' field\")\n\n\tif _, ok := fields[\"last_name\"]; !ok {\n\t\ttests.Failed(\"Should have a 'last_name' field\")\n\t}\n\ttests.Passed(\"Should have a 'last_name' field\")\n}", "func (AppModuleBasic) GetQueryCmd(cdc *amino.Codec) *cobra.Command {\n\treturn client.GetQueryCmd(cdc)\n}", "func GetQueryCmd() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: types.ModuleName,\n\t\tShort: \"Querying commands for the relationships module\",\n\t\tDisableFlagParsing: true,\n\t\tSuggestionsMinimumDistance: 2,\n\t\tRunE: client.ValidateCmd,\n\t}\n\tcmd.AddCommand(\n\t\tGetCmdQueryUserRelationships(),\n\t\tGetCmdQueryUserBlocks(),\n\t)\n\treturn cmd\n}", "func (db *Database) QueryTwoAuthByAddressForDCI(address string) (*schema.TwoAuthForDCI, error) {\n\tvar ta schema.TwoAuthForDCI\n\n\terr := db.Model(&ta).\n\t\tWhere(\"Address = ?\", address).\n\t\tSelect()\n\n\tif err == pg.ErrNoRows {\n\t\treturn &ta, fmt.Errorf(\"no rows in twoauth table: %s\", err)\n\t}\n\n\tif err != nil {\n\t\treturn &ta, fmt.Errorf(\"unexpected database error: %s\", err)\n\t}\n\n\treturn &ta, nil\n}", "func GetCmdBalance(queryRoute string, cdc *codec.Codec) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"balance\",\n\t\tShort: \"Query account token balance\",\n\t\tArgs: cobra.ExactArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\t\t\tkey, err := sdk.AccAddressFromBech32(args[0])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tres, _, err := cliCtx.QueryWithData(fmt.Sprintf(\"custom/%s/private/%s\", queryRoute, key), nil)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"could not find private profile - %s \\n\", key)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn cliCtx.PrintOutput(string(res))\n\t\t},\n\t}\n}", "func (p *profileCache) DeviceCommand(profileName string, commandName string) (models.DeviceCommand, bool) {\n\tp.mutex.RLock()\n\tdefer p.mutex.RUnlock()\n\n\tdcs, ok := p.deviceCommandMap[profileName]\n\tif !ok {\n\t\treturn models.DeviceCommand{}, false\n\t}\n\n\tdc, ok := dcs[commandName]\n\treturn dc, ok\n}" ]
[ "0.73663527", "0.66192484", "0.66032195", "0.6373226", "0.62577033", "0.5889509", "0.5735262", "0.5682528", "0.56526613", "0.54866666", "0.5468216", "0.54676366", "0.5464707", "0.5439784", "0.5404302", "0.5396977", "0.53676295", "0.53150916", "0.53021604", "0.5297001", "0.5251094", "0.52248317", "0.52177143", "0.519803", "0.51577115", "0.51541775", "0.5138208", "0.51276904", "0.511461", "0.511391", "0.5111596", "0.51038647", "0.5068776", "0.5054223", "0.5044595", "0.5044218", "0.50437605", "0.5007318", "0.50067633", "0.50030994", "0.50027704", "0.4998607", "0.49965158", "0.49895737", "0.4987935", "0.4977783", "0.49759698", "0.49606493", "0.4959705", "0.4931711", "0.49248984", "0.49077672", "0.49025008", "0.4902498", "0.48842773", "0.48781222", "0.4867901", "0.4862886", "0.48569953", "0.48471078", "0.48211798", "0.4809489", "0.4807637", "0.48040614", "0.47969177", "0.4795136", "0.4792029", "0.4788374", "0.47872746", "0.47741616", "0.4766467", "0.4761491", "0.47599676", "0.4759339", "0.475577", "0.47540614", "0.47398946", "0.4738255", "0.4734157", "0.4722806", "0.47221467", "0.4720828", "0.47156212", "0.47116384", "0.47116274", "0.4705608", "0.46973106", "0.46970123", "0.46942052", "0.46936136", "0.46921706", "0.4691164", "0.4687137", "0.46865648", "0.46742946", "0.4670912", "0.46707457", "0.46674314", "0.46667093", "0.4654809" ]
0.8442145
0
GetCmdQueryProfiles queries all the profiles
GetCmdQueryProfiles запрашивает все профили
func GetCmdQueryProfiles(cdc *codec.Codec) *cobra.Command { return &cobra.Command{ Use: "all", Short: "Retrieve all the registered profiles.", Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { cliCtx := context.NewCLIContext().WithCodec(cdc) route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryProfiles) res, _, err := cliCtx.QueryWithData(route, nil) if err != nil { fmt.Printf("Could not find any profile") return nil } var out types.Profiles cdc.MustUnmarshalJSON(res, &out) return cliCtx.PrintOutput(out) }, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *SmartContract) QueryAllProfiles(ctx contractapi.TransactionContextInterface) ([]QueryProfileResult, error) {\n\tstartKey := \"\"\n\tendKey := \"\"\n\n\tresultsIterator, err := ctx.GetStub().GetStateByRange(startKey, endKey)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resultsIterator.Close()\n\n\tresults := []QueryProfileResult{}\n\n\tfor resultsIterator.HasNext() {\n\t\tqueryResponse, err := resultsIterator.Next()\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif strings.Contains(queryResponse.Key, \"profile-\"){\n\t\t\tprofile := new(UserProfile)\n\t\t\t_ = json.Unmarshal(queryResponse.Value, profile)\n\n\t\t\tqueryResult := QueryProfileResult{Key: queryResponse.Key, Record: profile}\n\t\t\tresults = append(results, queryResult)\n\t\t}\n\t\t\n\t}\n\n\treturn results, nil\n}", "func queryProfiles(ctx sdk.Context, _ abci.RequestQuery, keeper Keeper) ([]byte, error) {\n\taccounts := keeper.GetProfiles(ctx)\n\n\tbz, err := codec.MarshalJSONIndent(keeper.Cdc, &accounts)\n\tif err != nil {\n\t\tpanic(\"could not marshal result to JSON\")\n\t}\n\n\treturn bz, nil\n}", "func GetCmdQueryProfileParams(cdc *codec.Codec) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"parameters\",\n\t\tShort: \"Retrieve all the profile module parameters\",\n\t\tArgs: cobra.NoArgs,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\troute := fmt.Sprintf(\"custom/%s/%s\", types.QuerierRoute, types.QueryParams)\n\t\t\tres, _, err := cliCtx.QueryWithData(route, nil)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Could not find profile parameters\")\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tvar out types.Params\n\t\t\tcdc.MustUnmarshalJSON(res, &out)\n\t\t\treturn cliCtx.PrintOutput(out)\n\t\t},\n\t}\n}", "func GetCmdQueryProfile(cdc *codec.Codec) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"profile [address_or_dtag]\",\n\t\tShort: \"Retrieve the profile having the specified user address or profile dtag, if any.\",\n\t\tArgs: cobra.ExactArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\troute := fmt.Sprintf(\"custom/%s/%s/%s\", types.QuerierRoute, types.QueryProfile, args[0])\n\t\t\tres, _, err := cliCtx.QueryWithData(route, nil)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Could not find a profile with dtag %s \\n\", args[0])\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tvar out types.Profile\n\t\t\tcdc.MustUnmarshalJSON(res, &out)\n\t\t\treturn cliCtx.PrintOutput(out)\n\t\t},\n\t}\n}", "func FetchProfiles() map[string]string {\n\ttoken := auth.NewToken()\n\tquery := queryPayload{\"SELECT Id, ProfileName FROM CommunicationProfile\"}\n\tpayload, err := json.Marshal(query)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treq, err := http.NewRequest(\"POST\", viper.GetString(\"baseurl\")+\"/v1/action/query\", bytes.NewBuffer(payload))\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Authorization\", \"Bearer \"+token.Val)\n\n\tresponse, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer response.Body.Close()\n\n\tif response.StatusCode != 200 {\n\t\tbody, err := ioutil.ReadAll(response.Body)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tlog.Fatal(string(body))\n\t}\n\n\tdec := json.NewDecoder(response.Body)\n\tvar body profilesQueryResponse\n\tif err = dec.Decode(&body); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tif !body.Done {\n\t\tlog.Fatalln(\"there are more communication profile to query\")\n\t}\n\n\tresult := make(map[string]string)\n\tfor _, p := range body.Records {\n\t\tresult[p.Name] = p.ID\n\t}\n\n\treturn result\n}", "func (c *OVClient) GetProfiles(start string, count string, filter string, sort string, scopeUris string) (ServerProfileList, error) {\n\tvar (\n\t\turi = \"/rest/server-profiles\"\n\t\tq map[string]interface{}\n\t\tprofiles ServerProfileList\n\t)\n\tq = make(map[string]interface{})\n\tif len(filter) > 0 {\n\t\tq[\"filter\"] = filter\n\t}\n\n\tif sort != \"\" {\n\t\tq[\"sort\"] = sort\n\t}\n\n\tif start != \"\" {\n\t\tq[\"start\"] = start\n\t}\n\n\tif count != \"\" {\n\t\tq[\"count\"] = count\n\t}\n\n\tif scopeUris != \"\" {\n\t\tq[\"scopeUris\"] = scopeUris\n\t}\n\n\t// refresh login\n\tc.RefreshLogin()\n\tc.SetAuthHeaderOptions(c.GetAuthHeaderMap())\n\t// Setup query\n\tif len(q) > 0 {\n\t\tc.SetQueryString(q)\n\t}\n\tdata, err := c.RestAPICall(rest.GET, uri, nil)\n\tif err != nil {\n\t\treturn profiles, err\n\t}\n\n\tlog.Debugf(\"GetProfiles %s\", data)\n\tif err := json.Unmarshal([]byte(data), &profiles); err != nil {\n\t\treturn profiles, err\n\t}\n\treturn profiles, nil\n}", "func listProfiles(ctx context.Context, _ []string) error {\n\tm, err := cmdutils.LoadManager(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"%15s %s\\n\", \"ID\", \"NAME\")\n\tfor _, p := range m.Profiles() {\n\t\tfmt.Printf(\"%15s %s\\n\", p.Id, p.Name)\n\t}\n\n\treturn nil\n}", "func (a *App) GetAllProfiles(w http.ResponseWriter, r *http.Request) {\n\thandler.GetAllProfiles(a.DB, w, r)\n}", "func GetProfiles(ctx context.Context) []ProfileEntry {\n\tvar c *SqlContext\n\ti := ctx.Value(goradd.SqlContext)\n\tif i == nil {\n\t\tpanic(\"Profiling requires a preloaded context.\")\n\t} else {\n\t\tc = i.(*SqlContext)\n\t}\n\n\tif c != nil {\n\t\tp := c.profiles\n\t\tc.profiles = nil\n\t\treturn p\n\t}\n\treturn nil\n}", "func (s *HighAvailabilityService) GetAvailabilityProfilesCommand(input *GetAvailabilityProfilesCommandInput) (output *models.AvailabilityProfilesView, resp *http.Response, err error) {\n\tpath := \"/highAvailability/availabilityProfiles\"\n\top := &request.Operation{\n\t\tName: \"GetAvailabilityProfilesCommand\",\n\t\tHTTPMethod: \"GET\",\n\t\tHTTPPath: path,\n\t\tQueryParams: map[string]string{\n\t\t\t\"page\": input.Page,\n\t\t\t\"numberPerPage\": input.NumberPerPage,\n\t\t\t\"filter\": input.Filter,\n\t\t\t\"name\": input.Name,\n\t\t\t\"sortKey\": input.SortKey,\n\t\t\t\"order\": input.Order,\n\t\t},\n\t}\n\toutput = &models.AvailabilityProfilesView{}\n\treq := s.newRequest(op, nil, output)\n\n\tif req.Send() == nil {\n\t\treturn output, req.HTTPResponse, nil\n\t}\n\treturn nil, req.HTTPResponse, req.Error\n}", "func queryProfileParams(ctx sdk.Context, _ abci.RequestQuery, keeper Keeper) ([]byte, error) {\n\tprofileParams := keeper.GetParams(ctx)\n\n\tbz, err := codec.MarshalJSONIndent(keeper.Cdc, &profileParams)\n\tif err != nil {\n\t\tpanic(\"could not marshal result to JSON\")\n\t}\n\n\treturn bz, nil\n}", "func (s *Scraper) SearchProfiles(ctx context.Context, query string, maxProfilesNbr int) <-chan *ProfileResult {\n\treturn getUserTimeline(ctx, query, maxProfilesNbr, s.FetchSearchProfiles)\n}", "func (s *Service) ProfilesGet(userID string) *ProfilesGetOp {\n\treturn &ProfilesGetOp{\n\t\tCredential: s.credential,\n\t\tMethod: \"GET\",\n\t\tPath: strings.Join([]string{\"users\", userID, \"profile\"}, \"/\"),\n\t\tAccept: \"application/json\",\n\t\tQueryOpts: make(url.Values),\n\t\tVersion: esign.APIv21,\n\t}\n}", "func GetProfileList(ctx context.Context) ([]*shill.Profile, error) {\n\tmanager, err := shill.NewManager(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed creating shill manager object\")\n\t}\n\t// Refresh the in-memory profile list.\n\tif _, err := manager.GetProperties(ctx); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed refreshing the in-memory profile list\")\n\t}\n\t// Get current profiles.\n\tprofiles, err := manager.Profiles(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed getting profile list\")\n\t}\n\treturn profiles, nil\n}", "func (bg *Backgrounder) GetProfiles() map[string]time.Duration {\n\treturn bg.profile\n}", "func GetQueryCmd(cdc *codec.Codec) *cobra.Command {\n\tprofileQueryCmd := &cobra.Command{\n\t\tUse: types.ModuleName,\n\t\tShort: \"Querying commands for the profiles module\",\n\t\tDisableFlagParsing: true,\n\t\tSuggestionsMinimumDistance: 2,\n\t\tRunE: client.ValidateCmd,\n\t}\n\tprofileQueryCmd.AddCommand(flags.GetCommands(\n\t\tGetCmdQueryProfile(cdc),\n\t\tGetCmdQueryProfiles(cdc),\n\t\tGetCmdQueryProfileParams(cdc),\n\t\tGetCmdQueryDTagRequests(cdc),\n\t)...)\n\treturn profileQueryCmd\n}", "func (s *Scraper) FetchSearchProfiles(query string, maxProfilesNbr int, cursor string) ([]*Profile, string, error) {\n\ttimeline, err := s.getSearchTimeline(query, maxProfilesNbr, cursor)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\tusers, nextCursor := timeline.parseUsers()\n\treturn users, nextCursor, nil\n}", "func runOperationDevicesGetDevicesApsProfiles(cmd *cobra.Command, args []string) error {\n\tappCli, err := makeClient(cmd, args)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// retrieve flag values from cmd and fill params\n\tparams := devices.NewGetDevicesApsProfilesParams()\n\tif dryRun {\n\n\t\tlogDebugf(\"dry-run flag specified. Skip sending request.\")\n\t\treturn nil\n\t}\n\t// make request and then print result\n\tmsgStr, err := parseOperationDevicesGetDevicesApsProfilesResult(appCli.Devices.GetDevicesApsProfiles(params, nil))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !debug {\n\n\t\tfmt.Println(msgStr)\n\t}\n\treturn nil\n}", "func (mpRepo *ManageProfileRepository) Profiles() ([]entity.Profile, []error) {\n\tprfs := []entity.Profile{}\n\terrs := mpRepo.conn.Find(&prfs).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn prfs, errs\n}", "func getProfilesDirectory() (string, error) {\n\tn := uint32(100)\n\tfor {\n\t\tb := make([]uint16, n)\n\t\te := windows.GetProfilesDirectory(&b[0], &n)\n\t\tif e == nil {\n\t\t\treturn syscall.UTF16ToString(b), nil\n\t\t}\n\t\tif e != syscall.ERROR_INSUFFICIENT_BUFFER {\n\t\t\treturn \"\", e\n\t\t}\n\t\tif n <= uint32(len(b)) {\n\t\t\treturn \"\", e\n\t\t}\n\t}\n}", "func (ctx *Context) Profiles() []*Profile {\n\treturn ctx.profileDB.sortedProfiles()\n}", "func GetProfiles() map[string]*model.ConfigProfile {\n\treturn profiles\n}", "func (a *API) Profiles(ctx context.Context, pageNum, pageSize int) (*ProfileResp, error) {\n\n\tall := pageNum < 1\n\tif all {\n\t\tpageSize = 100\n\t\tpageNum = 1\n\t}\n\n\tvar resp ProfileResp\n\tif err := a.Get(ctx, fmt.Sprintf(\"/api/v1/profile?pageNumber=%d&pageSize=%d\", pageNum, getPageSize(pageSize)), &resp); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif all {\n\t\tfor i := 1; i < resp.TotalPageCount; i++ {\n\t\t\tpg, err := a.Profiles(ctx, i+1, pageSize)\n\t\t\tif err != nil {\n\t\t\t\treturn &resp, err\n\t\t\t}\n\t\t\tresp.Profiles = append(resp.Profiles, pg.Profiles...)\n\t\t}\n\t\tresp.TotalPageCount = 1\n\t\tresp.TotalCount = len(resp.Profiles)\n\t\tresp.Count = resp.TotalCount\n\t\tresp.NextPageURL = \"\"\n\t\tresp.LastPageURL = \"\"\n\t}\n\n\treturn &resp, nil\n}", "func (s *Service) PermissionProfilesGet(permissionProfileID string) *PermissionProfilesGetOp {\n\treturn &PermissionProfilesGetOp{\n\t\tCredential: s.credential,\n\t\tMethod: \"GET\",\n\t\tPath: strings.Join([]string{\"permission_profiles\", permissionProfileID}, \"/\"),\n\t\tAccept: \"application/json\",\n\t\tQueryOpts: make(url.Values),\n\t\tVersion: esign.APIv2,\n\t}\n}", "func GetServiceProfiles(ctx context.Context, db sqlx.Queryer, filters ServiceProfileFilters) ([]ServiceProfileMeta, error) {\n\tquery, args, err := sqlx.BindNamed(sqlx.DOLLAR, `\n\t\tselect\n\t\t\tsp.*,\n\t\t\tns.name as network_server_name\n\t\tfrom\n\t\t\tservice_profile sp\n\t\tinner join network_server ns\n\t\t\ton sp.network_server_id = ns.id\n\t\tleft join organization_user ou\n\t\t\ton sp.organization_id = ou.organization_id\n\t\tleft join \"user\" u\n\t\t\ton ou.user_id = u.id\n\t`+filters.SQL()+`\n\t\tgroup by\n\t\t\tsp.service_profile_id,\n\t\t\tsp.name,\n\t\t\tnetwork_server_name\n\t\torder by\n\t\t\tsp.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\tvar sps []ServiceProfileMeta\n\terr = sqlx.Select(db, &sps, query, args...)\n\tif err != nil {\n\t\treturn nil, handlePSQLError(Select, err, \"select error\")\n\t}\n\n\treturn sps, nil\n}", "func (u User) Profiles(t database.Transaction) []goth.User {\n\tif u.IsAnonymous() {\n\t\treturn nil\n\t}\n\tvar profileSlice []goth.User\n\tprofiles := make(map[string]map[string]goth.User)\n\terr := t.Read(u.ID()+\"/profiles\", &profiles)\n\tif err != nil {\n\t\treturn nil\n\t}\n\tfor provider := range profiles {\n\t\tfor account := range profiles[provider] {\n\t\t\tprofileSlice = append(profileSlice, profiles[provider][account])\n\t\t}\n\t}\n\treturn profileSlice\n}", "func (s *SmartContract) QueryProfile(ctx contractapi.TransactionContextInterface, carNumber string) (*Profile, error) {\n\tcarAsBytes, err := ctx.GetStub().GetState(\"profile-\" + carNumber)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to read from world state. %s\", err.Error())\n\t}\n\n\tif carAsBytes == nil {\n\t\treturn nil, fmt.Errorf(\"%s does not exist\", carNumber)\n\t}\n\n\tcar := new(Profile)\n\t_ = json.Unmarshal(carAsBytes, car)\n\n\treturn car, nil\n}", "func (s *EmptyStore) ProfileList() (profiles []*storagepb.Profile, err error) {\n\treturn profiles, nil\n}", "func (s *remoteStore) GetEndDeviceProfiles(req store.GetEndDeviceProfilesRequest) (*store.GetEndDeviceProfilesResponse, error) {\n\tif req.BrandID != \"\" {\n\t\treturn s.getEndDeviceProfilesByBrand(req)\n\t}\n\tall := []*store.EndDeviceProfile{}\n\tbrands, err := s.GetBrands(store.GetBrandsRequest{\n\t\tPaths: []string{\"brand_id\"},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, brand := range brands.Brands {\n\t\tprofiles, err := s.GetEndDeviceProfiles(store.GetEndDeviceProfilesRequest{\n\t\t\tBrandID: brand.BrandId,\n\t\t})\n\t\tif errors.IsNotFound(err) {\n\t\t\t// Skip vendors without any profiles.\n\t\t\tcontinue\n\t\t} else if err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tall = append(all, profiles.Profiles...)\n\t}\n\n\tstart, end := paginate(len(all), req.Limit, req.Page)\n\treturn &store.GetEndDeviceProfilesResponse{\n\t\tCount: end - start,\n\t\tOffset: start,\n\t\tTotal: uint32(len(all)),\n\t\tProfiles: all[start:end],\n\t}, nil\n}", "func (c ProfilesController) GetAll() (JSONResponse, error) {\n\tcontrollerProfiles, err := c.profileProvider.GetProfiles()\n\n\tif err != nil {\n\t\treturn JSONResponse{}, err\n\t}\n\treturn c.JSONResponse(200, controllerProfiles), nil\n}", "func queryProfile(ctx sdk.Context, path []string, _ abci.RequestQuery, keeper Keeper) ([]byte, error) {\n\tif len(strings.TrimSpace(path[0])) == 0 {\n\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, \"DTag or address cannot be empty or blank\")\n\t}\n\n\taddress, err := sdk.AccAddressFromBech32(path[0])\n\tif err != nil {\n\t\taddress = keeper.GetDtagRelatedAddress(ctx, path[0])\n\t\tif address == nil {\n\t\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf(\"No address related to this dtag: %s\", path[0]))\n\t\t}\n\n\t}\n\n\taccount, found := keeper.GetProfile(ctx, address)\n\n\tif !found {\n\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest,\n\t\t\tfmt.Sprintf(\"Profile with address %s doesn't exists\", path[0]))\n\t}\n\n\tbz, err := codec.MarshalJSONIndent(keeper.Cdc, &account)\n\tif err != nil {\n\t\tpanic(\"could not marshal result to JSON\")\n\t}\n\n\treturn bz, nil\n}", "func (c *Cluster) GetProfiles(projectName string, profileNames []string) ([]api.Profile, error) {\n\tprofiles := make([]api.Profile, len(profileNames))\n\n\terr := c.Transaction(context.TODO(), func(ctx context.Context, tx *ClusterTx) error {\n\t\tdbProfiles, err := cluster.GetProfilesIfEnabled(ctx, tx.Tx(), projectName, profileNames)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor i, profile := range dbProfiles {\n\t\t\tapiProfile, err := profile.ToAPI(ctx, tx.Tx())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tprofiles[i] = *apiProfile\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn profiles, nil\n}", "func retrieve_gmm_gwy_profiles_list(gmm_api_key string, org_id int) {\n\n\ttype gwy_profiles struct {\n\t\tGatewayProfiles []struct {\n\t\t\tID int `json:\"id\"`\n\t\t\tName string `json:\"name\"`\n\t\t} `json:\"gateway_profiles\"`\n\t\tPaging struct {\n\t\t\tLimit int `json:\"limit\"`\n\t\t\tOffset int `json:\"offset\"`\n\t\t\tPages int `json:\"pages\"`\n\t\t\tCount int `json:\"count\"`\n\t\t\tLinks struct {\n\t\t\t\tFirst string `json:\"first\"`\n\t\t\t\tLast string `json:\"last\"`\n\t\t\t\tNext string `json:\"next\"`\n\t\t\t} `json:\"links\"`\n\t\t} `json:\"paging\"`\n\t}\n\n\tjsonValue, _ := json.Marshal(\"\")\n\trequest, _ := http.NewRequest(\"GET\", \"https://us.ciscokinetic.io/api/v2/organizations/\" + strconv.Itoa(org_id) + \"/gateway_profiles?limit=100\", bytes.NewBuffer(jsonValue))\n\ttoken := \"Token \" + gmm_api_key\n\trequest.Header.Set(\"Authorization\", token)\n\tclient := &http.Client{}\n\tr, err := client.Do(request)\n\n\tif err != nil {\n\t\tfmt.Printf(\"Retrieve GMM GWY Profiles error %s\\n\", err)\n\t\tos.Exit(1)\n\t}\n\n\tresponseData, _ := ioutil.ReadAll(r.Body)\n\n\tvar responseObject gwy_profiles\n\te := json.Unmarshal(responseData, &responseObject)\n\tif e != nil {\n\t\tfmt.Println(\"Unmarshall Error: \", e)\n\t}\n\n\tfmt.Println(\"\")\n\tfmt.Println(\"Total Number of Gateway Profiles in GMM: \", len(responseObject.GatewayProfiles))\n\tfmt.Println(\"\")\n\tfmt.Println(\"Gateway Profiles in GMM\")\n\tfmt.Println(\"-----------------------\")\n\tfor i := 0; i < len(responseObject.GatewayProfiles); i++ {\n\t\tfmt.Println(\"Profile-ID: \", responseObject.GatewayProfiles[i].ID, \" Profile Name: \", responseObject.GatewayProfiles[i].Name)\n\t}\n}", "func (s *ProfileService) List(input *ListProfilesInput) (*ListProfilesOutput, *http.Response, error) {\n\treturn s.ListContext(context.Background(), input)\n}", "func (c *CompositeProfileClient) GetCompositeProfiles(p string, ca string, v string) ([]CompositeProfile, error) {\n\tkey := CompositeProfileKey{\n\t\tName: \"\",\n\t\tProject: p,\n\t\tCompositeApp: ca,\n\t\tVersion: v,\n\t}\n\n\tvalues, err := db.DBconn.Find(c.storeName, key, c.tagMeta)\n\tif err != nil {\n\t\treturn []CompositeProfile{}, pkgerrors.Wrap(err, \"Get Composite Profiles error\")\n\t}\n\n\tvar resp []CompositeProfile\n\n\tfor _, value := range values {\n\t\tcp := CompositeProfile{}\n\t\terr = db.DBconn.Unmarshal(value, &cp)\n\t\tif err != nil {\n\t\t\treturn []CompositeProfile{}, pkgerrors.Wrap(err, \"Get Composite Profiles unmarshalling error\")\n\t\t}\n\t\tresp = append(resp, cp)\n\t}\n\n\treturn resp, nil\n}", "func (S *Service) GetProfile(ctx context.Context) (profileDataList ProfileDataList, err error) {\n\tprofileList, err := S.repo.GetProfile(ctx)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor _, profile := range profileList.Data {\n\t\tprofileDataList.Profile = append(profileDataList.Profile, profileToProfileData(profile))\n\t}\n\tprofileDataList.TotalData = profileList.TotalData\n\n\treturn\n}", "func DefaultListProfile(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*Profile, error) {\n\tin := Profile{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(ProfileORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm2.ApplyCollectionOperators(ctx, db, &ProfileORM{}, &Profile{}, f, s, p, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(ProfileORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []ProfileORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(ProfileORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*Profile{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func (a *api) h_GET_profiles_prfId(c *gin.Context) {\n\tprfId, err := parseInt64Param(c, \"prfId\")\n\tif a.errorResponse(c, err) {\n\t\treturn\n\t}\n\n\ta.logger.Debug(\"GET /profiles/\", prfId)\n\n\tp, err := a.Dc.GetProfile(prfId)\n\tif a.errorResponse(c, err) {\n\t\treturn\n\t}\n\n\taCtx := a.getAuthContext(c)\n\tif a.errorResponse(c, aCtx.AuthZHasOrgLevel(p.OrgId, auth.AUTHZ_LEVEL_OU)) {\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, a.mprofile2profile(p))\n}", "func (s Source) AllProfiles() []string {\n\tif s.IsProfile() {\n\t\treturn []string{s.Path}\n\t}\n\treturn []string{}\n}", "func GetFanProfiles(conn io.ReadWriter) (fp FanProfiles, err error) {\n\n\tresp, err := getQuery(getFanProfiles, conn)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn *resp.(*FanProfiles), err\n}", "func (c *Cluster) GetProfileNames(project string) ([]string, error) {\n\terr := c.Transaction(context.TODO(), func(ctx context.Context, tx *ClusterTx) error {\n\t\tenabled, err := cluster.ProjectHasProfiles(context.Background(), tx.tx, project)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Check if project has profiles: %w\", err)\n\t\t}\n\n\t\tif !enabled {\n\t\t\tproject = \"default\"\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tq := `\nSELECT profiles.name\n FROM profiles\n JOIN projects ON projects.id = profiles.project_id\nWHERE projects.name = ?\n`\n\tinargs := []any{project}\n\tvar name string\n\toutfmt := []any{name}\n\tresult, err := queryScan(c, q, inargs, outfmt)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\n\tresponse := []string{}\n\tfor _, r := range result {\n\t\tresponse = append(response, r[0].(string))\n\t}\n\n\treturn response, nil\n}", "func GetProfile(c *fiber.Ctx) error {\n\tID := c.Query(\"id\")\n\n\tif len(ID) < 1 {\n\t\tc.Send(ID)\n\t\tc.Send(\"Parameter ID is required\")\n\t\tc.SendStatus(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tprofile, err := database.SearchProfile(ID)\n\tif err != nil {\n\t\tc.Send(\"Error Occurred\" + err.Error())\n\t\tc.SendStatus(http.StatusBadRequest)\n\t\treturn\n\t}\n\tif err := c.JSON(profile); err != nil {\n\t\tc.Status(500).Send(err)\n\t\treturn\n\t}\n\tc.Accepts(\"application/json\")\n\tc.SendStatus(http.StatusAccepted)\n}", "func (r *AccountUserProfilesService) List(profileId int64) *AccountUserProfilesListCall {\n\tc := &AccountUserProfilesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\treturn c\n}", "func makeOperationDevicesGetDevicesApsProfilesCmd() (*cobra.Command, error) {\n\tcmd := &cobra.Command{\n\t\tUse: \"getDevicesApsProfiles\",\n\t\tShort: ``,\n\t\tRunE: runOperationDevicesGetDevicesApsProfiles,\n\t}\n\n\tif err := registerOperationDevicesGetDevicesApsProfilesParamFlags(cmd); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn cmd, nil\n}", "func (dao PathProfileDAOPsql) GetByProfileID(id int16) ([]models.PathProfile, error) {\n\tquery := `SELECT pp.id, pp.profile_id, pp.path_id, pa.path, pa.path_name,\n\t\t\t\t\tpa.description, pp.post, pp.put, pp.del, pp.get,\n\t\t\t\t\tpp.created_at, pp.updated_at\n\t\t\t\tFROM path_profile AS pp INNER JOIN paths AS pa ON pp.path_id = pa.id\n\t\t\t\tWHERE profile_id = $1 ORDER BY pa.path`\n\n\tops := make([]models.PathProfile, 0)\n\tdb := get()\n\tdefer db.Close()\n\n\tstmt, err := db.Prepare(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer stmt.Close()\n\n\trows, err := stmt.Query(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar o models.PathProfile\n\t\terr = rows.Scan(&o.ID, &o.ProfileID, &o.Path.ID, &o.Path.Path, &o.Path.PathName, &o.Path.Description, &o.Post, &o.Put, &o.Del, &o.Get, &o.CreatedAt, &o.UpdatedAt)\n\t\tif err != nil {\n\t\t\treturn ops, err\n\t\t}\n\t\tops = append(ops, o)\n\t}\n\treturn ops, nil\n}", "func getProfiles() {\n\n\tvar configDir string\n\tif isRunningInDockerContainer() {\n\t\tconfigDir = filepath.Join(\"app\", \"config\")\n\t} else {\n\t\t_, fn, _, ok := runtime.Caller(0)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\t\tindex := strings.LastIndex(fn, \"chart-verifier/\")\n\t\tconfigDir = fn[0 : index+len(\"chart-verifier\")]\n\t\tconfigDir = filepath.Join(configDir, \"config\")\n\t}\n\n\tfilepath.Walk(configDir, func(path string, info os.FileInfo, err error) error {\n\t\tif info != nil {\n\t\t\tif strings.HasSuffix(info.Name(), \".yaml\") {\n\t\t\t\tprofileRead, err := readProfile(path)\n\t\t\t\tif err == nil {\n\t\t\t\t\t// If version is not valid set to a default version\n\t\t\t\t\tif !semver.IsValid(profileRead.Version) {\n\t\t\t\t\t\tprofileRead.Version = DefaultProfileVersion\n\t\t\t\t\t}\n\t\t\t\t\tif len(profileRead.Vendor) == 0 {\n\t\t\t\t\t\tprofileRead.Vendor = VendorTypeNotSpecified\n\t\t\t\t\t}\n\t\t\t\t\tprofileMap[profileRead.Vendor] = append(profileMap[profileRead.Vendor], profileRead)\n\t\t\t\t\tprofileRead.Name = strings.Split(info.Name(), \".yaml\")[0]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\treturn\n}", "func (p *PCE) GetContainerWkldProfiles(queryParameters map[string]string, containerClusterID string) (api APIResponse, err error) {\n\tp.ContainerWorkloadProfilesSlice = nil\n\tapi, err = p.GetCollection(\"container_clusters/\"+containerClusterID+\"/container_workload_profiles\", false, queryParameters, &p.ContainerWorkloadProfilesSlice)\n\tif len(p.ContainerWorkloadProfilesSlice) >= 500 {\n\t\tp.ContainerWorkloadProfilesSlice = nil\n\t\tapi, err = p.GetCollection(\"container_clusters/\"+containerClusterID+\"/container_workload_profiles\", true, queryParameters, &p.ContainerWorkloadProfilesSlice)\n\t}\n\tp.ContainerWorkloadProfiles = make(map[string]ContainerWorkloadProfile)\n\tfor _, c := range p.ContainerWorkloadProfilesSlice {\n\t\tp.ContainerWorkloadProfiles[c.Href] = c\n\t\tif PtrToVal(c.Name) != \"\" {\n\t\t\tp.ContainerWorkloadProfiles[*c.Name] = c\n\t\t}\n\t}\n\treturn api, err\n}", "func (l *RemoteProvider) GetPerformanceProfiles(req *http.Request, page, pageSize, search, order string) ([]byte, error) {\n\tif !l.Capabilities.IsSupported(PersistPerformanceProfiles) {\n\t\tlogrus.Error(\"operation not available\")\n\t\treturn []byte{}, ErrInvalidCapability(\"PersistPerformanceProfiles\", l.ProviderName)\n\t}\n\n\tep, _ := l.Capabilities.GetEndpointForFeature(PersistPerformanceProfiles)\n\n\tlogrus.Infof(\"attempting to fetch performance profiles from cloud\")\n\n\tremoteProviderURL, _ := url.Parse(l.RemoteProviderURL + ep)\n\tq := remoteProviderURL.Query()\n\tif page != \"\" {\n\t\tq.Set(\"page\", page)\n\t}\n\tif pageSize != \"\" {\n\t\tq.Set(\"page_size\", pageSize)\n\t}\n\tif search != \"\" {\n\t\tq.Set(\"search\", search)\n\t}\n\tif order != \"\" {\n\t\tq.Set(\"order\", order)\n\t}\n\tremoteProviderURL.RawQuery = q.Encode()\n\tlogrus.Debugf(\"constructed performance profiles url: %s\", remoteProviderURL.String())\n\tcReq, _ := http.NewRequest(http.MethodGet, remoteProviderURL.String(), nil)\n\n\ttokenString, err := l.GetToken(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := l.DoRequest(cReq, tokenString)\n\tif err != nil {\n\t\treturn nil, ErrFetch(err, \"Perf Profile Page\", resp.StatusCode)\n\t}\n\tdefer func() {\n\t\t_ = resp.Body.Close()\n\t}()\n\tbdr, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, ErrDataRead(err, \"Perf Profile Page\")\n\t}\n\n\tif resp.StatusCode == http.StatusOK {\n\t\tlogrus.Infof(\"performance profiles successfully retrieved from remote provider\")\n\t\treturn bdr, nil\n\t}\n\treturn nil, ErrPost(err, fmt.Sprint(bdr), resp.StatusCode)\n}", "func (api *dscprofileAPI) List(ctx context.Context, opts *api.ListWatchOptions) ([]*DSCProfile, error) {\n\tvar objlist []*DSCProfile\n\tobjs, err := api.ct.List(\"DSCProfile\", 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 *DSCProfile:\n\t\t\teobj := obj.(*DSCProfile)\n\t\t\tobjlist = append(objlist, eobj)\n\t\tdefault:\n\t\t\tlog.Fatalf(\"Got invalid object type %v while looking for DSCProfile\", tp)\n\t\t}\n\t}\n\n\treturn objlist, nil\n}", "func (l *configLoader) GetProfiles() ([]string, error) {\n\tpath := l.ConfigPath()\n\tbytes, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trawMap := map[interface{}]interface{}{}\n\terr = yaml.Unmarshal(bytes, &rawMap)\n\tif err != nil {\n\t\treturn nil, errors.Errorf(\"Error parsing devspace.yaml: %v\", err)\n\t}\n\n\tprofiles, ok := rawMap[\"profiles\"].([]interface{})\n\tif !ok {\n\t\tprofiles = []interface{}{}\n\t}\n\n\tprofileNames := []string{}\n\tfor _, profile := range profiles {\n\t\tprofileMap, ok := profile.(map[interface{}]interface{})\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tname, ok := profileMap[\"name\"].(string)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tprofileNames = append(profileNames, name)\n\t}\n\n\treturn profileNames, nil\n}", "func (p *profile) List(options map[string]interface{}) (riminderResponse.ProfileListElem, error) {\n\tsourceIDs, err := json.Marshal(options[\"source_ids\"])\n\tif err != nil {\n\t\treturn riminderResponse.ProfileListElem{}, fmt.Errorf(\"profile.List:Cannot parse source ids (should be a list of string): %v\", err)\n\t}\n\n\tquery := map[string]string{\n\t\t\"source_ids\": string(sourceIDs),\n\t\t\"sort_by\": \"ranking\",\n\t\t\"page\": \"1\",\n\t\t\"date_end\": strconv.Itoa(int(time.Now().Unix())),\n\t\t\"date_start\": defaultDateStart,\n\t}\n\tAddIfNotEmptyStrMap(&query, options, \"seniority\")\n\tAddIfNotEmptyStrMap(&query, options, \"filter_id\")\n\tAddIfNotEmptyStrMap(&query, options, \"filter_reference\")\n\tAddIfNotEmptyStrMap(&query, options, \"stage\")\n\tAddIfNotEmptyStrMap(&query, options, \"rating\")\n\tAddIfNotEmptyStrMap(&query, options, \"date_start\")\n\tAddIfNotEmptyStrMap(&query, options, \"date_end\")\n\tAddIfNotEmptyStrMap(&query, options, \"page\")\n\tAddIfNotEmptyStrMap(&query, options, \"limit\")\n\tAddIfNotEmptyStrMap(&query, options, \"sort_by\")\n\tAddIfNotEmptyStrMap(&query, options, \"order_by\")\n\n\tresp := riminderResponse.ProfileListContainer{}\n\terr = p.client.Get(\"profiles\", query, &resp)\n\tif err != nil {\n\t\treturn riminderResponse.ProfileListElem{}, err\n\t}\n\treturn resp.Data, nil\n}", "func (bav *UtxoView) GetAllProfiles(readerPK []byte) (\n\t_profiles map[PkMapKey]*ProfileEntry,\n\t_corePostsByProfilePublicKey map[PkMapKey][]*PostEntry,\n\t_commentsByProfilePublicKey map[PkMapKey][]*PostEntry,\n\t_postEntryReaderStates map[BlockHash]*PostEntryReaderState, _err error) {\n\t// Start by fetching all the profiles we have in the db.\n\t//\n\t// TODO(performance): This currently fetches all profiles. We should implement\n\t// some kind of pagination instead though.\n\t_, _, dbProfileEntries, err := DBGetAllProfilesByCoinValue(bav.Handle, true /*fetchEntries*/)\n\tif err != nil {\n\t\treturn nil, nil, nil, nil, errors.Wrapf(\n\t\t\terr, \"GetAllProfiles: Problem fetching ProfileEntrys from db: \")\n\t}\n\n\t// Iterate through the entries found in the db and force the view to load them.\n\t// This fills in any gaps in the view so that, after this, the view should contain\n\t// the union of what it had before plus what was in the db.\n\tfor _, dbProfileEntry := range dbProfileEntries {\n\t\tbav.GetProfileEntryForPublicKey(dbProfileEntry.PublicKey)\n\t}\n\n\t// At this point, all the profiles should be loaded into the view.\n\n\t// Do one more pass to load all the comments associated with each\n\t// profile into the view.\n\tcommentsByProfilePublicKey := make(map[PkMapKey][]*PostEntry)\n\tfor _, profileEntry := range bav.ProfilePKIDToProfileEntry {\n\t\t// Ignore deleted or rolled-back posts.\n\t\tif profileEntry.isDeleted {\n\t\t\tcontinue\n\t\t}\n\t\tcommentsByProfilePublicKey[MakePkMapKey(profileEntry.PublicKey)] = []*PostEntry{}\n\t\t_, dbCommentHashes, _, err := DBGetCommentPostHashesForParentStakeID(\n\t\t\tbav.Handle, profileEntry.PublicKey, false /*fetchEntries*/)\n\t\tif err != nil {\n\t\t\treturn nil, nil, nil, nil, errors.Wrapf(err, \"GetAllPosts: Problem fetching comment PostEntry's from db: \")\n\t\t}\n\t\tfor _, commentHash := range dbCommentHashes {\n\t\t\tbav.GetPostEntryForPostHash(commentHash)\n\t\t}\n\t}\n\t// TODO(performance): Because we want to load all the posts the profile\n\t// has made, just go ahead and load *all* the posts into the view so that\n\t// they'll get returned in the mapping. Later, we should use the db index\n\t// to do this.\n\t_, _, dbPostEntries, err := DBGetAllPostsByTstamp(bav.Handle, true /*fetchEntries*/)\n\tif err != nil {\n\t\treturn nil, nil, nil, nil, errors.Wrapf(\n\t\t\terr, \"GetAllPosts: Problem fetching PostEntry's from db: \")\n\t}\n\tfor _, dbPostEntry := range dbPostEntries {\n\t\tbav.GetPostEntryForPostHash(dbPostEntry.PostHash)\n\t}\n\n\t// Iterate through all the posts loaded into the view and attach them\n\t// to the relevant profiles. Also adds reader state if a reader pubkey is provided.\n\tcorePostsByPublicKey := make(map[PkMapKey][]*PostEntry)\n\tpostEntryReaderStates := make(map[BlockHash]*PostEntryReaderState)\n\tfor _, postEntry := range bav.PostHashToPostEntry {\n\t\t// Ignore deleted or rolled-back posts.\n\t\tif postEntry.isDeleted {\n\t\t\tcontinue\n\t\t}\n\n\t\t// If the post has a stakeID that corresponds to a profile then add\n\t\t// it to our map.\n\t\t// Every post is either a core post or a comment. If it has a stake ID\n\t\t// its a comment, and if it doesn't then it's a core post.\n\t\tif len(postEntry.ParentStakeID) == 0 {\n\t\t\t// In this case we are dealing with a \"core\" post so add it to the\n\t\t\t// core post map.\n\t\t\tpostEntry.stakeStats = GetStakeEntryStats(postEntry.StakeEntry, bav.Params)\n\t\t\tcorePostsForProfile := corePostsByPublicKey[MakePkMapKey(postEntry.PosterPublicKey)]\n\t\t\tcorePostsForProfile = append(corePostsForProfile, postEntry)\n\t\t\tcorePostsByPublicKey[MakePkMapKey(postEntry.PosterPublicKey)] = corePostsForProfile\n\t\t} else {\n\t\t\t// Add the comment to our map.\n\t\t\tcommentsForProfile := commentsByProfilePublicKey[MakePkMapKey(postEntry.ParentStakeID)]\n\t\t\tcommentsForProfile = append(commentsForProfile, postEntry)\n\t\t\tcommentsByProfilePublicKey[MakePkMapKey(postEntry.ParentStakeID)] = commentsForProfile\n\t\t}\n\n\t\t// Create reader state map. Ie, whether the reader has liked the post, etc.\n\t\t// If nil is passed in as the readerPK, this is skipped.\n\t\tif readerPK != nil {\n\t\t\tpostEntryReaderState := bav.GetPostEntryReaderState(readerPK, postEntry)\n\t\t\tpostEntryReaderStates[*postEntry.PostHash] = postEntryReaderState\n\t\t}\n\t}\n\n\t// Now that the view mappings are a complete picture, iterate through them\n\t// and set them on the map we're returning.\n\tprofilesByPublicKey := make(map[PkMapKey]*ProfileEntry)\n\tfor _, profileEntry := range bav.ProfilePKIDToProfileEntry {\n\t\t// Ignore deleted or rolled-back posts.\n\t\tif profileEntry.isDeleted {\n\t\t\tcontinue\n\t\t}\n\t\tprofileEntry.stakeStats = GetStakeEntryStats(profileEntry.StakeEntry, bav.Params)\n\t\tprofilesByPublicKey[MakePkMapKey(profileEntry.PublicKey)] = profileEntry\n\t}\n\n\t// Sort the posts for each profile by when their stake.\n\tfor _, postsForProfile := range corePostsByPublicKey {\n\t\tsort.Slice(postsForProfile, func(ii, jj int) bool {\n\t\t\treturn postsForProfile[ii].stakeStats.TotalStakeNanos > postsForProfile[jj].stakeStats.TotalStakeNanos\n\t\t})\n\t}\n\t// Sort all the comment lists. Here we put the latest comment at the\n\t// end.\n\tfor _, commentList := range commentsByProfilePublicKey {\n\t\tsort.Slice(commentList, func(ii, jj int) bool {\n\t\t\treturn commentList[ii].TimestampNanos < commentList[jj].TimestampNanos\n\t\t})\n\t}\n\n\treturn profilesByPublicKey, corePostsByPublicKey, commentsByProfilePublicKey, postEntryReaderStates, nil\n}", "func (c *Config) GetProfile(profile string) ([]Entry, bool) {\n\tlog.Println(\"[DEBUG] GetProfile\", profile)\n\tentries, ok := c.Profiles[profile]\n\tif ok {\n\t\treturn entries, true\n\t}\n\n\treturn nil, false\n}", "func GenerateSubProfileQuery() (string, error) {\n\treturn globalProbe.GenerateSubProfileQuery()\n}", "func GetProfiles() []AWS_Named_Profile {\n\txp := make([]AWS_Named_Profile, 0)\n\n\t// Get the userprofile from powershell.\n\tback := &backend.Local{}\n\tshell, err := ps.New(back)\n\tdefer shell.Exit()\n\tcheck(err)\n\tstdout, _, err := shell.Execute(\"$env:userprofile\")\n\tcheck(err)\n\n\t// Load config and remove carriage returns.\n\tre := regexp.MustCompile(`\\r?\\n`)\n\tawsconfig := re.ReplaceAllString(stdout, \"\") + \"\\\\.aws\\\\config\"\n\tcfg, err := ini.Load(awsconfig)\n\tif err != nil {\n\t\tlog.Printf(\"Fail to read file: %v\", err)\n\t\tos.Exit(1)\n\t}\n\n\t// Find Valid/Enabled Named profiles. EG: default profile has no arn.\n\tfor _, section := range cfg.Sections() {\n\t\tif section.HasKey(\"role_arn\") {\n\t\t\tvar p AWS_Named_Profile\n\t\t\tp.Name = section.Name()\n\t\t\tp.Arn = section.Key(\"role_arn\").String()\n\t\t\txp = append(xp, p)\n\t\t}\n\t}\n\t//return the named profiles\n\tlog.Printf(\"Found %v Named Profile(s) in: %v\", len(xp), awsconfig)\n\treturn xp\n}", "func testProfileList(t *testing.T) {\n\tp := profileName(t)\n\tt.Parallel()\n\tmk := NewMinikubeRunner(t, p, \"--wait=false\")\n\tout, stderr := mk.MustRun(\"profile list\")\n\tif !strings.Contains(out, p) {\n\t\tt.Errorf(\"Error , failed to read profile name (%s) in `profile list` command output : \\n %q : \\n stderr: %s \", p, out, stderr)\n\t}\n}", "func NewProfilesGetCollectionRequest(server string, params *ProfilesGetCollectionParams) (*http.Request, error) {\n\tvar err error\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/v1/profiles\")\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryURL.Query()\n\n\tif params.FilterName != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"filter[name]\", runtime.ParamLocationQuery, *params.FilterName); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FilterProfileState != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"filter[profileState]\", runtime.ParamLocationQuery, *params.FilterProfileState); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FilterProfileType != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"filter[profileType]\", runtime.ParamLocationQuery, *params.FilterProfileType); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FilterId != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"filter[id]\", runtime.ParamLocationQuery, *params.FilterId); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.Sort != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"sort\", runtime.ParamLocationQuery, *params.Sort); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FieldsProfiles != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[profiles]\", runtime.ParamLocationQuery, *params.FieldsProfiles); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.Limit != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"limit\", runtime.ParamLocationQuery, *params.Limit); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.Include != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"include\", runtime.ParamLocationQuery, *params.Include); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FieldsCertificates != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[certificates]\", runtime.ParamLocationQuery, *params.FieldsCertificates); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FieldsDevices != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[devices]\", runtime.ParamLocationQuery, *params.FieldsDevices); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FieldsBundleIds != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[bundleIds]\", runtime.ParamLocationQuery, *params.FieldsBundleIds); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.LimitCertificates != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"limit[certificates]\", runtime.ParamLocationQuery, *params.LimitCertificates); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.LimitDevices != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"limit[devices]\", runtime.ParamLocationQuery, *params.LimitDevices); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tqueryURL.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func (cli *Client) PeopleProfile(id string, fields []string) (r map[string]interface{}, e error) {\n\tvar opt map[string]interface{}\n\n\tif len(fields) > 0 {\n\t\topt = map[string]interface{}{\n\t\t\t\"fields\": fields,\n\t\t}\n\t}\n\n\tr, e = cli.call(\"GET\", \"people\", id, \"\", opt)\n\n\treturn r, e\n}", "func (org *Org) GetAllNsxtAppPortProfiles(queryParameters url.Values, scope string) ([]*NsxtAppPortProfile, error) {\n\tqueryParams := copyOrNewUrlValues(queryParameters)\n\tif scope != \"\" {\n\t\tqueryParams = queryParameterFilterAnd(\"scope==\"+scope, queryParams)\n\t}\n\n\treturn getAllNsxtAppPortProfiles(org.client, queryParams)\n}", "func (mpRepo *ManageProfileRepository) Profile(id uint) (*entity.Profile, []error) {\n\tprfs := entity.Profile{}\n\terrs := mpRepo.conn.First(&prfs, id).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn &prfs, errs\n}", "func (q *ColumnQueryAPI) ProfileTypes(ctx context.Context, req *pb.ProfileTypesRequest) (*pb.ProfileTypesResponse, error) {\n\ttypes, err := q.querier.ProfileTypes(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &pb.ProfileTypesResponse{\n\t\tTypes: types,\n\t}, nil\n}", "func (api *LaborStatsAPI) QueryCountryProfile() ([]CountryProfile, error) {\n\ta := CountryProfileAPI{\n\t\tDebug: api.Debug,\n\t\tSecretKey: api.SecretKey,\n\t}\n\n\terr := a.sendRequest()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := a.unmarshalData()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n\n}", "func (p *EnvConfigProvider) ListProfiles(roles bool) []string {\n\treturn []string{}\n}", "func (bc *BoltClient) GetDeviceProfilesByCommandId(id string) ([]models.DeviceProfile, error) {\n\t// Check if this command exists\n\terr := bc.checkId(db.Command, id)\n\tif err != nil {\n\t\treturn []models.DeviceProfile{}, err\n\t}\n\n\treturn bc.getDeviceProfilesBy(func(encoded []byte) bool {\n\t\tcommands := jsoniter.Get(encoded, \"commands\").GetInterface().([]interface{})\n\t\tfor _, value := range commands {\n\t\t\tif id == value.(string) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t})\n}", "func GetUserProfiles(users ...User) ([]Profile, error) {\n\tctx := context.Background()\n\tclient, err := getFireBaseApp().Auth(ctx)\n\tif err != nil {\n\t\treturn []Profile{}, fmt.Errorf(\"error getting firebase app: %v\", err)\n\t}\n\tprofiles := make([]Profile, len(users))\n\tfor i, u := range users {\n\t\tp := Profile{UID: u.ID}\n\t\tuserRecord, err := client.GetUser(ctx, u.ID)\n\t\tif err == nil {\n\t\t\tp.Name = userRecord.DisplayName\n\t\t\tp.ProfilePicture = userRecord.PhotoURL\n\t\t}\n\t\tprofiles[i] = p\n\t}\n\treturn profiles, nil\n}", "func (s *Storer) ListByProfile(ctx context.Context, profileID string) ([]accounts.Account, error) {\n\tquery := listByProfileSQL(ctx, profileID)\n\tqueryStr, err := query.PostgreSQLString()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trows, err := s.db.Query(queryStr, query.Args()...) //nolint:sqlclosecheck // the closeRows helper isn't picked up\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer closeRows(ctx, rows)\n\tvar accts []accounts.Account\n\tfor rows.Next() {\n\t\tvar account Account\n\t\terr = pan.Unmarshal(rows, &account)\n\t\tif err != nil {\n\t\t\treturn accts, err\n\t\t}\n\t\taccts = append(accts, fromPostgres(account))\n\t}\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\taccounts.ByLastUsedDesc(accts)\n\treturn accts, nil\n}", "func GenerateProfiles() director.GenerateProfilesFunc {\n\treturn func() ([]*pb.MatchProfile, error) {\n\t\tvar profiles []*pb.MatchProfile\n\n\t\tworlds := []string{\"Dune\", \"Nova\", \"Pandora\", \"Orion\"}\n\t\tregions := []string{\"us-east-1\", \"us-east-2\", \"us-west-1\", \"us-west-2\"}\n\n\t\tskillLevels := []*pb.DoubleRangeFilter{\n\t\t\t{DoubleArg: \"skill\", Min: 0, Max: 10},\n\t\t\t{DoubleArg: \"skill\", Min: 10, Max: 100},\n\t\t\t{DoubleArg: \"skill\", Min: 100, Max: 1000},\n\t\t}\n\n\t\tlatencies := []*pb.DoubleRangeFilter{\n\t\t\t{DoubleArg: \"latency\", Min: 0, Max: 25},\n\t\t\t{DoubleArg: \"latency\", Min: 25, Max: 50},\n\t\t\t{DoubleArg: \"latency\", Min: 50, Max: 75},\n\t\t\t{DoubleArg: \"latency\", Min: 75, Max: 100},\n\t\t}\n\n\t\tfor _, world := range worlds {\n\t\t\tfor _, region := range regions {\n\t\t\t\t//region := TagFromStringSlice(regions)\n\n\t\t\t\tprofile := &pb.MatchProfile{\n\t\t\t\t\tName: fmt.Sprintf(\"world_based_profile_%s_%s\", world, region),\n\t\t\t\t\tPools: []*pb.Pool{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"pool_mode_\" + world,\n\t\t\t\t\t\t\tTagPresentFilters: []*pb.TagPresentFilter{\n\t\t\t\t\t\t\t\t{Tag: \"mode.session\"},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tStringEqualsFilters: []*pb.StringEqualsFilter{\n\t\t\t\t\t\t\t\t{StringArg: \"world\", Value: world},\n\t\t\t\t\t\t\t\t{StringArg: \"region\", Value: region},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tDoubleRangeFilters: []*pb.DoubleRangeFilter{\n\t\t\t\t\t\t\t\tDoubleRangeFilterFromSlice(skillLevels),\n\t\t\t\t\t\t\t\tDoubleRangeFilterFromSlice(latencies),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}\n\n\t\t\t\t// build filter extensions\n\t\t\t\tfilter := extensions.AllocatorFilterExtension{\n\t\t\t\t\tLabels: map[string]string{\n\t\t\t\t\t\t\"region\": region,\n\t\t\t\t\t\t\"world\": world,\n\t\t\t\t\t},\n\t\t\t\t\tFields: map[string]string{\n\t\t\t\t\t\t\"status.state\": \"Ready\",\n\t\t\t\t\t},\n\t\t\t\t}\n\n\t\t\t\t// Multiples Extensions: extensions.WithAny(filter.Any()).WithAny(foo.Any()).WithAny(bar.Any()).Extensions()\n\t\t\t\tprofile.Extensions = extensions.WithAny(filter.Any()).Extensions()\n\t\t\t\tprofiles = append(profiles, profile)\n\t\t\t}\n\t\t}\n\n\t\treturn profiles, nil\n\t}\n}", "func (svc *inmemService) GetProfile(ctx context.Context, id string) (Profile, error) {\n\t// Get the Read lock from the inmemService struct\n\tsvc.mtx.RLock()\n\n\t// Immediately set up a lock release to occur when the function finishes\n\tdefer svc.mtx.RUnlock()\n\n\t// Look for the profile by the `id` function param\n\tprofile, ok := svc.profiles[id]\n\n\t// Check if the profile id was not found in the datastore\n\tif !ok {\n\n\t\t// Return an empty profile and an error informing the caller that the profile was not found\n\t\treturn Profile{}, ErrNotFound\n\n\t}\n\n\t// Return the profile to the caller and a nil error\n\treturn profile, nil\n\n}", "func (api *API) ListDLPProfiles(ctx context.Context, rc *ResourceContainer, params ListDLPProfilesParams) ([]DLPProfile, error) {\n\tif rc.Identifier == \"\" {\n\t\treturn []DLPProfile{}, ErrMissingResourceIdentifier\n\t}\n\n\turi := buildURI(fmt.Sprintf(\"/%s/%s/dlp/profiles\", rc.Level, rc.Identifier), nil)\n\n\tres, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)\n\tif err != nil {\n\t\treturn []DLPProfile{}, err\n\t}\n\n\tvar dlpProfilesListResponse DLPProfileListResponse\n\terr = json.Unmarshal(res, &dlpProfilesListResponse)\n\tif err != nil {\n\t\treturn []DLPProfile{}, fmt.Errorf(\"%s: %w\", errUnmarshalError, err)\n\t}\n\n\treturn dlpProfilesListResponse.Result, nil\n}", "func (repository *Datastore)GetProfile(username string)(*user.Person,error){\n\tperson := newUser() //initialize user.Person and will used to store profile info\n\tquery := `SELECT * FROM userRepository WHERE username = ?`\n\terr := repository.Db.Get(&person, query, username) //get person profile details\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &person, nil\n}", "func (s *EmptyStore) ProfileGet(id string) (*storagepb.Profile, error) {\n\treturn nil, fmt.Errorf(\"Profile not found\")\n}", "func (a *Client) GetMsgVpnClientProfiles(params *GetMsgVpnClientProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*GetMsgVpnClientProfilesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetMsgVpnClientProfilesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getMsgVpnClientProfiles\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/msgVpns/{msgVpnName}/clientProfiles\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetMsgVpnClientProfilesReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetMsgVpnClientProfilesOK), nil\n\n}", "func (f *IBMPIInstanceClient) GetSAPProfiles(powerinstanceid string) (*models.SAPProfiles, error) {\n\n\tparams := p_cloud_s_a_p.NewPcloudSapGetallParamsWithTimeout(helpers.PIGetTimeOut).WithCloudInstanceID(powerinstanceid)\n\tresp, err := f.session.Power.PCloudSAP.PcloudSapGetall(params, ibmpisession.NewAuth(f.session, powerinstanceid))\n\tif err != nil || resp.Payload == nil {\n\t\treturn nil, fmt.Errorf(\"Failed to get sap profiles to the power instance %s : %s\", powerinstanceid, err)\n\t}\n\treturn resp.Payload, nil\n}", "func List() {\n\n\tprofiles := GetProfileList()\n\n\tfmt.Println(\"\")\n\tfmt.Println(\"Available profiles in the JSon repository (\" + getProfilesPath() + \"):\")\n\tw := tabwriter.NewWriter(os.Stdout, 0, 0, 5, ' ', 0)\n\n\tfor _, profileName := range profiles {\n\n\t\tprofileData := getProfileFactory(getProfilesPath(), profileName)\n\n\t\tfmt.Fprintln(w, profileName+\"\\t Image => \"+profileData.Image+\"\\t Alias => \"+profileData.Alias)\n\n\t}\n\tw.Flush()\n\tfmt.Println(\" \")\n}", "func (p *profileDocument) List(options map[string]interface{}) ([]riminderResponse.ProfileDocumentsListElem, error) {\n\tquery := map[string]string{\n\t\t\"source_id\": options[\"source_id\"].(string),\n\t}\n\tAddIfNotEmptyStrMap(&query, options, \"profile_id\")\n\tAddIfNotEmptyStrMap(&query, options, \"profile_reference\")\n\n\tresp := riminderResponse.ProfileDocumentsListContainer{}\n\terr := p.client.Get(\"profile/documents\", query, &resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp.Data, nil\n}", "func (r *UserProfilesService) List() *UserProfilesListCall {\n\tc := &UserProfilesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\treturn c\n}", "func GetCmdQueryActiveClaims(queryRoute string, cdc *codec.Codec) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: treasury.QueryActiveClaims,\n\t\tShort: \"Query claims that have yet to be redeemed by the treasury\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\tres, err := cliCtx.QueryWithData(fmt.Sprintf(\"custom/%s/%s\", queryRoute, treasury.QueryActiveClaims), nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar claims types.ClaimPool\n\t\t\tcdc.MustUnmarshalBinaryLengthPrefixed(res, &claims)\n\t\t\treturn cliCtx.PrintOutput(claims)\n\t\t},\n\t}\n\n\treturn cmd\n}", "func (p *Profiler) All() []Profile {\n\tif p == nil {\n\t\t// If the profiler instance doesn't exist, then don't attempt to operate on it.\n\t\treturn []Profile{}\n\t}\n\tp.mutex.Lock()\n\tdefer p.mutex.Unlock()\n\treturn p.profiles\n}", "func getProfile(name string) (*profile.Specification, error) {\n\tprofiles, err := profiles.GetKnownProfiles()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, p := range profiles {\n\t\tif p.Label == name {\n\t\t\treturn p, nil\n\t\t}\n\t}\n\treturn nil, nil\n\n\t// TODO(jsimsa): This function assumes the existence of a profile\n\t// server from which the profiles can be retrieved. The profile\n\t// server is a work in progress. When it exists, the commented out\n\t// code below should work.\n\t/*\n\t\tvar profile profile.Specification\n\t\t\t\tclient, err := r.NewClient()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, verror.New(ErrOperationFailed, nil, fmt.Sprintf(\"NewClient() failed: %v\", err))\n\t\t\t\t}\n\t\t\t\tdefer client.Close()\n\t\t\t server := // TODO\n\t\t\t\tmethod := \"Specification\"\n\t\t\t\tinputs := make([]interface{}, 0)\n\t\t\t\tcall, err := client.StartCall(server + \"/\" + name, method, inputs)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, verror.New(ErrOperationFailed, nil, fmt.Sprintf(\"StartCall(%s, %q, %v) failed: %v\\n\", server + \"/\" + name, method, inputs, err))\n\t\t\t\t}\n\t\t\t\tif err := call.Finish(&profiles); err != nil {\n\t\t\t\t\treturn nil, verror.New(ErrOperationFailed, nil, fmt.Sprintf(\"Finish(%v) failed: %v\\n\", &profiles, err))\n\t\t\t\t}\n\t\treturn &profile, nil\n\t*/\n}", "func (p *profile) Get(options map[string]interface{}) (riminderResponse.ProfileGetElem, error) {\n\tquery := map[string]string{\n\t\t\"source_id\": options[\"source_id\"].(string),\n\t}\n\tAddIfNotEmptyStrMap(&query, options, \"profile_id\")\n\tAddIfNotEmptyStrMap(&query, options, \"profile_reference\")\n\n\tresp := riminderResponse.ProfileGetContainer{}\n\terr := p.client.Get(\"profile\", query, &resp)\n\tif err != nil {\n\t\treturn riminderResponse.ProfileGetElem{}, err\n\t}\n\treturn resp.Data, nil\n}", "func (c *Cluster) GetInstancesWithProfile(project, profile string) (map[string][]string, error) {\n\terr := c.Transaction(context.TODO(), func(ctx context.Context, tx *ClusterTx) error {\n\t\tenabled, err := cluster.ProjectHasProfiles(context.Background(), tx.tx, project)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Check if project has profiles: %w\", err)\n\t\t}\n\n\t\tif !enabled {\n\t\t\tproject = \"default\"\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tq := `SELECT instances.name, projects.name FROM instances\n\t\tJOIN instances_profiles ON instances.id == instances_profiles.instance_id\n\t\tJOIN projects ON projects.id == instances.project_id\n\t\tWHERE instances_profiles.profile_id ==\n\t\t (SELECT profiles.id FROM profiles\n\t\t JOIN projects ON projects.id == profiles.project_id\n\t\t WHERE profiles.name=? AND projects.name=?)`\n\n\tresults := map[string][]string{}\n\tinargs := []any{profile, project}\n\tvar name string\n\toutfmt := []any{name, name}\n\n\toutput, err := queryScan(c, q, inargs, outfmt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, r := range output {\n\t\tif results[r[1].(string)] == nil {\n\t\t\tresults[r[1].(string)] = []string{}\n\t\t}\n\n\t\tresults[r[1].(string)] = append(results[r[1].(string)], r[0].(string))\n\t}\n\n\treturn results, nil\n}", "func (dpc *deviceProfileRestClient) requestDeviceProfileSlice(url string, ctx context.Context) ([]models.DeviceProfile, error) {\n\tdata, err := clients.GetRequest(url, ctx)\n\tif err != nil {\n\t\treturn []models.DeviceProfile{}, err\n\t}\n\n\tdpSlice := make([]models.DeviceProfile, 0)\n\terr = json.Unmarshal(data, &dpSlice)\n\treturn dpSlice, err\n}", "func GetProfile(ctx *router.Context) {\n\tuin, _ := ctx.Keys[middleware.ComerUinContextKey].(uint64)\n\tresponse, err := service.GetComerProfile(uin)\n\tif err != nil {\n\t\tctx.ERROR(\n\t\t\trouter.ErrBuisnessError,\n\t\t\t\"wrong metamask login parameter\",\n\t\t)\n\t\treturn\n\t}\n\n\tctx.OK(response)\n}", "func (r *UserProfilesService) Get(profileId int64) *UserProfilesGetCall {\n\tc := &UserProfilesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\treturn c\n}", "func (s *Service) PermissionProfilesList() *PermissionProfilesListOp {\n\treturn &PermissionProfilesListOp{\n\t\tCredential: s.credential,\n\t\tMethod: \"GET\",\n\t\tPath: \"permission_profiles\",\n\t\tAccept: \"application/json\",\n\t\tQueryOpts: make(url.Values),\n\t\tVersion: esign.APIv2,\n\t}\n}", "func (a *ManagementApiService) GetCustomerProfiles(ctx _context.Context) apiGetCustomerProfilesRequest {\n\treturn apiGetCustomerProfilesRequest{\n\t\tapiService: a,\n\t\tctx: ctx,\n\t}\n}", "func GetProfile(_db Queryable, uid int64) (*Profile, error) {\n\tp := &Profile{}\n\terr := _db.QueryRow(`SELECT first_name, last_name, high_score, gender, \n img, birth_date, signup_date\n FROM profile WHERE uid = $1`, uid).Scan(\n\t\tp.FirstName, p.LastName, p.HighScore, p.Gender, p.Img, p.BirthDate, p.SignupDate)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn p, err\n\t}\n}", "func (c *IRacing) GetProfile(ctx context.Context) (*UserProfile, error) {\n\n\tprofile := &UserProfile{}\n\n\terr := c.json(ctx, http.MethodGet, \"/membersite/member/GetMember\", nil, profile)\n\n\treturn profile, err\n}", "func (r *Radarr) GetReleaseProfilesContext(ctx context.Context) ([]*ReleaseProfile, error) {\n\tvar output []*ReleaseProfile\n\n\treq := starr.Request{URI: bpReleaseProfile}\n\tif err := r.GetInto(ctx, req, &output); err != nil {\n\t\treturn nil, fmt.Errorf(\"api.Get(%s): %w\", &req, err)\n\t}\n\n\treturn output, nil\n}", "func (p *Profiler) Flush() []Profile {\n\tif p == nil {\n\t\treturn []Profile{}\n\t}\n\tp.mutex.Lock()\n\tdefer p.mutex.Unlock()\n\tresult := p.profiles\n\tp.profiles = []Profile{}\n\treturn result\n}", "func (a *API) ProfileSearch(ctx context.Context, searchID string, pageNum int) (*ProfileResp, error) {\n\n\tall := pageNum < 1\n\tif all || pageNum < 1 {\n\t\tpageNum = 1\n\t}\n\n\tvar resp ProfileResp\n\turlStr := fmt.Sprintf(\"/api/v1/profile?searchId=%s&pageSize=100&pageNumber=%d\", searchID, pageNum)\n\tif err := a.Get(ctx, urlStr, &resp); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif all && resp.TotalPageCount > 1 {\n\t\tfor i := 1; i < resp.TotalPageCount; i++ {\n\t\t\tpg, err := a.ProfileSearch(ctx, searchID, i+1)\n\t\t\tif err != nil {\n\t\t\t\treturn &resp, err\n\t\t\t}\n\t\t\tresp.Profiles = append(resp.Profiles, pg.Profiles...)\n\t\t}\n\t}\n\n\treturn &resp, nil\n}", "func (s *ProfileService) ListContext(ctx context.Context, input *ListProfilesInput) (*ListProfilesOutput, *http.Response, error) {\n\tspath, err := addOptions(\"/profiles\", input)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq, err := s.client.newRequest(ctx, \"GET\", spath, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tres, err := s.client.Do(ctx, req)\n\tif err != nil {\n\t\treturn nil, res, err\n\t}\n\n\tvar out ListProfilesOutput\n\tif err := decodeBody(res, &out); err != nil {\n\t\treturn nil, res, err\n\t}\n\n\treturn &out, res, nil\n}", "func IncludeProfiles(profiles ...string) {\n\tProfiles = append(Profiles, profiles...)\n}", "func (m MigProfile) GetProfileIDs() (int, int, int, error) {\n\terr := m.AssertValid()\n\tif err != nil {\n\t\treturn -1, -1, -1, fmt.Errorf(\"invalid MigProfile: %v\", err)\n\t}\n\n\tc, g, _, err := m.Parse()\n\tif err != nil {\n\t\treturn -1, -1, -1, fmt.Errorf(\"unable to parse MigProfile: %v\", err)\n\t}\n\n\tvar giProfileID, ciProfileID, ciEngProfileID int\n\n\tswitch g {\n\tcase 1:\n\t\tgiProfileID = nvml.GPU_INSTANCE_PROFILE_1_SLICE\n\tcase 2:\n\t\tgiProfileID = nvml.GPU_INSTANCE_PROFILE_2_SLICE\n\tcase 3:\n\t\tgiProfileID = nvml.GPU_INSTANCE_PROFILE_3_SLICE\n\tcase 4:\n\t\tgiProfileID = nvml.GPU_INSTANCE_PROFILE_4_SLICE\n\tcase 7:\n\t\tgiProfileID = nvml.GPU_INSTANCE_PROFILE_7_SLICE\n\tcase 8:\n\t\tgiProfileID = nvml.GPU_INSTANCE_PROFILE_8_SLICE\n\tdefault:\n\t\treturn -1, -1, -1, fmt.Errorf(\"unknown GPU Instance slice size: %v\", g)\n\t}\n\n\tswitch c {\n\tcase 1:\n\t\tciProfileID = nvml.COMPUTE_INSTANCE_PROFILE_1_SLICE\n\tcase 2:\n\t\tciProfileID = nvml.COMPUTE_INSTANCE_PROFILE_2_SLICE\n\tcase 3:\n\t\tciProfileID = nvml.COMPUTE_INSTANCE_PROFILE_3_SLICE\n\tcase 4:\n\t\tciProfileID = nvml.COMPUTE_INSTANCE_PROFILE_4_SLICE\n\tcase 7:\n\t\tciProfileID = nvml.COMPUTE_INSTANCE_PROFILE_7_SLICE\n\tcase 8:\n\t\tciProfileID = nvml.COMPUTE_INSTANCE_PROFILE_8_SLICE\n\tdefault:\n\t\treturn -1, -1, -1, fmt.Errorf(\"unknown Compute Instance slice size: %v\", c)\n\t}\n\n\tciEngProfileID = nvml.COMPUTE_INSTANCE_ENGINE_PROFILE_SHARED\n\n\treturn giProfileID, ciProfileID, ciEngProfileID, nil\n}", "func (a *Client) ListRunProfiles(params *ListRunProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*ListRunProfilesOK, *ListRunProfilesNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListRunProfilesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"ListRunProfiles\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/orgs/{owner}/run_profiles\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &ListRunProfilesReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tswitch value := result.(type) {\n\tcase *ListRunProfilesOK:\n\t\treturn value, nil, nil\n\tcase *ListRunProfilesNoContent:\n\t\treturn nil, value, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*ListRunProfilesDefault)\n\treturn nil, nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "func (r *OAuthProfileResource) ListAll() (*OAuthProfileConfigList, error) {\n\tvar list OAuthProfileConfigList\n\tif err := r.c.ReadQuery(BasePath+OAuthProfileEndpoint, &list); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &list, nil\n}", "func GetManageAccountProfilesByPhoneID(phone string) (AuthProfile, error) {\n\tdata := new(AuthProfile)\n\treq, reqErr := CreateRequest(\"GET\", os.Getenv(\"DOMAIN\")+\"/identity/v2/manage/account\", \"\")\n\tif reqErr != nil {\n\t\treturn *data, reqErr\n\t}\n\n\tq := req.URL.Query()\n\tq.Add(\"phone\", phone)\n\treq.URL.RawQuery = q.Encode()\n\treq.Header.Add(\"content-Type\", \"application/x-www-form-urlencoded\")\n\treq.Header.Add(\"X-LoginRadius-ApiKey\", os.Getenv(\"APIKEY\"))\n\treq.Header.Add(\"X-LoginRadius-ApiSecret\", os.Getenv(\"APISECRET\"))\n\n\terr := RunRequest(req, data)\n\treturn *data, err\n}", "func getCompleteProfile(ctx sdk.Context, path []string, k Keeper) (res []byte, sdkError error) {\n\tid := path[0]\n\tuser, err := k.GetUser(ctx, id)\n\tif err != nil {\n\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, \"user with address not found\")\n\t}\n\n\tthoughts := k.ListThoughtByCreator(ctx, user.Creator)\n\n\tvar followers []types.User\n\tvar followings []types.User\n\n\tfor _, addr := range user.Followers {\n\t\tfollower, err := k.GetUser(ctx, addr.String())\n\t\tif err == nil {\n\t\t\tfollowers = append(followers, follower)\n\t\t}\n\t}\n\n\tfor _, addr := range user.Following {\n\t\tfollowing, err := k.GetUser(ctx, addr.String())\n\t\tif err == nil {\n\t\t\tfollowings = append(followings, following)\n\t\t}\n\t}\n\n\tvar completeProfile = types.CompleteProfile{\n\t\tCreator: user.Creator,\n\t\tID: user.ID,\n\t\tUsername: user.Username,\n\t\tBio: user.Bio,\n\t\tAvatar: user.Avatar,\n\t\tFollowing: followings,\n\t\tFollowers: followers,\n\t\tThoughts: thoughts,\n\t}\n\n\tres, err = codec.MarshalJSONIndent(k.cdc, completeProfile)\n\tif err != nil {\n\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())\n\t}\n\n\treturn res, nil\n}", "func newCmdProfile() *cobra.Command {\n\toptions := newProfileOptions()\n\n\tcmd := &cobra.Command{\n\t\tUse: \"profile [flags] (--template | --open-api file | --proto file) (SERVICE)\",\n\t\tShort: \"Output service profile config for Kubernetes\",\n\t\tLong: \"Output service profile config for Kubernetes.\",\n\t\tExample: ` # Output a basic template to apply after modification.\n linkerd profile -n emojivoto --template web-svc\n\n # Generate a profile from an OpenAPI specification.\n linkerd profile -n emojivoto --open-api web-svc.swagger web-svc\n\n # Generate a profile from a protobuf definition.\n linkerd profile -n emojivoto --proto Voting.proto vote-svc\n`,\n\t\tArgs: cobra.ExactArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif options.namespace == \"\" {\n\t\t\t\toptions.namespace = pkgcmd.GetDefaultNamespace(kubeconfigPath, kubeContext)\n\t\t\t}\n\t\t\toptions.name = args[0]\n\t\t\tclusterDomain := defaultClusterDomain\n\n\t\t\terr := options.validate()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// performs an online profile generation and access-check to k8s cluster to extract\n\t\t\t// clusterDomain from linkerd configuration\n\t\t\tif !options.ignoreCluster {\n\t\t\t\tvar err error\n\t\t\t\tk8sAPI, err := k8s.NewAPI(kubeconfigPath, kubeContext, impersonate, impersonateGroup, 0)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\t_, values, err := healthcheck.FetchCurrentConfiguration(cmd.Context(), k8sAPI, controlPlaneNamespace)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tif cd := values.ClusterDomain; cd != \"\" {\n\t\t\t\t\tclusterDomain = cd\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif options.template {\n\t\t\t\treturn profiles.RenderProfileTemplate(options.namespace, options.name, clusterDomain, os.Stdout)\n\t\t\t} else if options.openAPI != \"\" {\n\t\t\t\treturn profiles.RenderOpenAPI(options.openAPI, options.namespace, options.name, clusterDomain, os.Stdout)\n\t\t\t} else if options.proto != \"\" {\n\t\t\t\treturn profiles.RenderProto(options.proto, options.namespace, options.name, clusterDomain, os.Stdout)\n\t\t\t}\n\n\t\t\t// we should never get here\n\t\t\treturn errors.New(\"Unexpected error\")\n\t\t},\n\t}\n\n\tcmd.PersistentFlags().BoolVar(&options.template, \"template\", options.template, \"Output a service profile template\")\n\tcmd.PersistentFlags().StringVar(&options.openAPI, \"open-api\", options.openAPI, \"Output a service profile based on the given OpenAPI spec file\")\n\tcmd.PersistentFlags().StringVarP(&options.namespace, \"namespace\", \"n\", options.namespace, \"Namespace of the service\")\n\tcmd.PersistentFlags().StringVar(&options.proto, \"proto\", options.proto, \"Output a service profile based on the given Protobuf spec file\")\n\tcmd.PersistentFlags().BoolVar(&options.ignoreCluster, \"ignore-cluster\", options.ignoreCluster, \"Output a service profile through offline generation\")\n\n\treturn cmd\n}", "func (a UsersApi) GetProfilesUsers(pageSize int, pageNumber int, id []string, jid []string, sortOrder string, expand []string, integrationPresenceSource string) (*Userprofileentitylisting, *APIResponse, error) {\n\tvar httpMethod = \"GET\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/api/v2/profiles/users\"\n\tdefaultReturn := new(Userprofileentitylisting)\n\tif true == false {\n\t\treturn defaultReturn, nil, errors.New(\"This message brought to you by the laws of physics being broken\")\n\t}\n\n\n\theaderParams := make(map[string]string)\n\tqueryParams := make(map[string]string)\n\tformParams := url.Values{}\n\tvar postBody interface{}\n\tvar postFileName string\n\tvar fileBytes []byte\n\t// authentication (PureCloud OAuth) required\n\n\t// oauth required\n\tif a.Configuration.AccessToken != \"\"{\n\t\theaderParams[\"Authorization\"] = \"Bearer \" + a.Configuration.AccessToken\n\t}\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\t\n\tqueryParams[\"pageSize\"] = a.Configuration.APIClient.ParameterToString(pageSize, \"\")\n\t\n\tqueryParams[\"pageNumber\"] = a.Configuration.APIClient.ParameterToString(pageNumber, \"\")\n\t\n\tqueryParams[\"id\"] = a.Configuration.APIClient.ParameterToString(id, \"multi\")\n\t\n\tqueryParams[\"jid\"] = a.Configuration.APIClient.ParameterToString(jid, \"multi\")\n\t\n\tqueryParams[\"sortOrder\"] = a.Configuration.APIClient.ParameterToString(sortOrder, \"\")\n\t\n\tqueryParams[\"expand\"] = a.Configuration.APIClient.ParameterToString(expand, \"multi\")\n\t\n\tqueryParams[\"integrationPresenceSource\"] = a.Configuration.APIClient.ParameterToString(integrationPresenceSource, \"\")\n\t\n\n\t// Find an replace keys that were altered to avoid clashes with go keywords \n\tcorrectedQueryParams := make(map[string]string)\n\tfor k, v := range queryParams {\n\t\tif k == \"varType\" {\n\t\t\tcorrectedQueryParams[\"type\"] = v\n\t\t\tcontinue\n\t\t}\n\t\tcorrectedQueryParams[k] = v\n\t}\n\tqueryParams = correctedQueryParams\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tvar successPayload *Userprofileentitylisting\n\tresponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, postFileName, fileBytes)\n\tif err != nil {\n\t\t// Nothing special to do here, but do avoid processing the response\n\t} else if err == nil && response.Error != nil {\n\t\terr = errors.New(response.ErrorMessage)\n\t} else if response.HasBody {\n\t\tif \"Userprofileentitylisting\" == \"string\" {\n\t\t\tcopy(response.RawBody, &successPayload)\n\t\t} else {\n\t\t\terr = json.Unmarshal(response.RawBody, &successPayload)\n\t\t}\n\t}\n\treturn successPayload, response, err\n}" ]
[ "0.7198962", "0.6869934", "0.6789719", "0.67125577", "0.6603376", "0.65903366", "0.6403358", "0.61283404", "0.5979468", "0.59100527", "0.58843744", "0.5871112", "0.58510584", "0.5812088", "0.57750744", "0.5740033", "0.57312274", "0.57131714", "0.57038635", "0.5665462", "0.5650157", "0.5582988", "0.55647236", "0.5562351", "0.5551982", "0.5550958", "0.5543493", "0.5498958", "0.5494953", "0.54691154", "0.545507", "0.5400691", "0.54004836", "0.53805065", "0.5374537", "0.53538436", "0.53378516", "0.5326786", "0.5318802", "0.5311433", "0.5288244", "0.5274247", "0.52566415", "0.52213925", "0.5218808", "0.5217135", "0.5204053", "0.51857084", "0.5181272", "0.5168757", "0.5167296", "0.51672316", "0.51565987", "0.5143938", "0.5137596", "0.51348567", "0.5130919", "0.5114644", "0.5105083", "0.51038206", "0.5089186", "0.5080312", "0.5065956", "0.50566906", "0.5056112", "0.5000419", "0.4969409", "0.4966967", "0.49667272", "0.4957326", "0.49512482", "0.4949572", "0.4940578", "0.4939023", "0.49364272", "0.49330774", "0.4929585", "0.49258223", "0.4920468", "0.49009386", "0.48900932", "0.48882967", "0.48881766", "0.48760742", "0.4875418", "0.4864147", "0.48556674", "0.4849216", "0.48376966", "0.48219958", "0.48211417", "0.4818083", "0.48019698", "0.47995257", "0.47840917", "0.47832185", "0.47808462", "0.47791785", "0.47752345", "0.47639498" ]
0.8219907
0
GetCmdQueryProfileParams queries all the profiles' module params
GetCmdQueryProfileParams запрашивает все параметры модулей профилей
func GetCmdQueryProfileParams(cdc *codec.Codec) *cobra.Command { return &cobra.Command{ Use: "parameters", Short: "Retrieve all the profile module parameters", Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { cliCtx := context.NewCLIContext().WithCodec(cdc) route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryParams) res, _, err := cliCtx.QueryWithData(route, nil) if err != nil { fmt.Printf("Could not find profile parameters") return nil } var out types.Params cdc.MustUnmarshalJSON(res, &out) return cliCtx.PrintOutput(out) }, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func queryProfileParams(ctx sdk.Context, _ abci.RequestQuery, keeper Keeper) ([]byte, error) {\n\tprofileParams := keeper.GetParams(ctx)\n\n\tbz, err := codec.MarshalJSONIndent(keeper.Cdc, &profileParams)\n\tif err != nil {\n\t\tpanic(\"could not marshal result to JSON\")\n\t}\n\n\treturn bz, nil\n}", "func GetCmdQueryProfiles(cdc *codec.Codec) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"all\",\n\t\tShort: \"Retrieve all the registered profiles.\",\n\t\tArgs: cobra.NoArgs,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\troute := fmt.Sprintf(\"custom/%s/%s\", types.QuerierRoute, types.QueryProfiles)\n\t\t\tres, _, err := cliCtx.QueryWithData(route, nil)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Could not find any profile\")\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tvar out types.Profiles\n\t\t\tcdc.MustUnmarshalJSON(res, &out)\n\t\t\treturn cliCtx.PrintOutput(out)\n\t\t},\n\t}\n}", "func GetCmdQueryProfile(cdc *codec.Codec) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"profile [address_or_dtag]\",\n\t\tShort: \"Retrieve the profile having the specified user address or profile dtag, if any.\",\n\t\tArgs: cobra.ExactArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\troute := fmt.Sprintf(\"custom/%s/%s/%s\", types.QuerierRoute, types.QueryProfile, args[0])\n\t\t\tres, _, err := cliCtx.QueryWithData(route, nil)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Could not find a profile with dtag %s \\n\", args[0])\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tvar out types.Profile\n\t\t\tcdc.MustUnmarshalJSON(res, &out)\n\t\t\treturn cliCtx.PrintOutput(out)\n\t\t},\n\t}\n}", "func GetProfileParameters() (ProfileParameters, Alerts) {\n\treturn ProfileParameters{}, Alerts{}\n}", "func GetCmdQueryParams() *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"params\",\n\t\tShort: fmt.Sprintf(\"get the %s module parameters\", types.ModuleName),\n\t\tLong: \"Get the current issuance module parameters.\",\n\t\tArgs: cobra.NoArgs,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tclientCtx, err := client.GetClientQueryContext(cmd)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tqueryClient := types.NewQueryClient(clientCtx)\n\n\t\t\tres, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn clientCtx.PrintProto(&res.Params)\n\t\t},\n\t}\n}", "func GetCmdQueryParams(cdc *codec.Codec) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"params\",\n\t\tArgs: cobra.NoArgs,\n\t\tShort: \"Query the current staking parameters information\",\n\t\tLong: strings.TrimSpace(\n\t\t\tfmt.Sprintf(`Query values set as staking parameters.\n\nExample:\n$ %s query staking params\n`,\n\t\t\t\tversion.ClientName,\n\t\t\t),\n\t\t),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\troute := fmt.Sprintf(\"custom/%s/%s\", types.StoreKey, staking.QueryParameters)\n\t\t\tbz, _, err := cliCtx.QueryWithData(route, nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar mergedParams types.MergedParams\n\t\t\tcdc.MustUnmarshalJSON(bz, &mergedParams)\n\t\t\treturn cliCtx.PrintOutput(mergedParams)\n\t\t},\n\t}\n}", "func (s *SmartContract) QueryAllProfiles(ctx contractapi.TransactionContextInterface) ([]QueryProfileResult, error) {\n\tstartKey := \"\"\n\tendKey := \"\"\n\n\tresultsIterator, err := ctx.GetStub().GetStateByRange(startKey, endKey)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resultsIterator.Close()\n\n\tresults := []QueryProfileResult{}\n\n\tfor resultsIterator.HasNext() {\n\t\tqueryResponse, err := resultsIterator.Next()\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif strings.Contains(queryResponse.Key, \"profile-\"){\n\t\t\tprofile := new(UserProfile)\n\t\t\t_ = json.Unmarshal(queryResponse.Value, profile)\n\n\t\t\tqueryResult := QueryProfileResult{Key: queryResponse.Key, Record: profile}\n\t\t\tresults = append(results, queryResult)\n\t\t}\n\t\t\n\t}\n\n\treturn results, nil\n}", "func QueryParams() *cobra.Command {\n\treturn qflags(&cobra.Command{\n\t\tUse: \"params\",\n\t\tShort: \"Query the current ecocredit module parameters\",\n\t\tLong: strings.TrimSpace(\n\t\t\tfmt.Sprintf(`Query the current ecocredit module parameters\n\t\t\t\nExamples:\n$%s query %s params\n$%s q %s params\n\t\t\t`, version.AppName, ecocredit.ModuleName, version.AppName, ecocredit.ModuleName),\n\t\t),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tc, ctx, err := mkQueryClient(cmd)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tres, err := c.Params(cmd.Context(), &ecocredit.QueryParamsRequest{})\n\t\t\treturn print(ctx, res, err)\n\t\t},\n\t})\n}", "func GetQueryCmd(cdc *codec.Codec) *cobra.Command {\n\tprofileQueryCmd := &cobra.Command{\n\t\tUse: types.ModuleName,\n\t\tShort: \"Querying commands for the profiles module\",\n\t\tDisableFlagParsing: true,\n\t\tSuggestionsMinimumDistance: 2,\n\t\tRunE: client.ValidateCmd,\n\t}\n\tprofileQueryCmd.AddCommand(flags.GetCommands(\n\t\tGetCmdQueryProfile(cdc),\n\t\tGetCmdQueryProfiles(cdc),\n\t\tGetCmdQueryProfileParams(cdc),\n\t\tGetCmdQueryDTagRequests(cdc),\n\t)...)\n\treturn profileQueryCmd\n}", "func GetQueryCmdParams(route string, cdc *codec.Codec) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"params\",\n\t\tArgs: cobra.NoArgs,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\t\t\tbz, _, err := cliCtx.Query(fmt.Sprintf(\"custom/%s/%s\", route, types.QueryParams))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn printOutput(cliCtx, cdc, bz, &types.Params{})\n\t\t},\n\t}\n}", "func FetchProfiles() map[string]string {\n\ttoken := auth.NewToken()\n\tquery := queryPayload{\"SELECT Id, ProfileName FROM CommunicationProfile\"}\n\tpayload, err := json.Marshal(query)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treq, err := http.NewRequest(\"POST\", viper.GetString(\"baseurl\")+\"/v1/action/query\", bytes.NewBuffer(payload))\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Authorization\", \"Bearer \"+token.Val)\n\n\tresponse, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer response.Body.Close()\n\n\tif response.StatusCode != 200 {\n\t\tbody, err := ioutil.ReadAll(response.Body)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tlog.Fatal(string(body))\n\t}\n\n\tdec := json.NewDecoder(response.Body)\n\tvar body profilesQueryResponse\n\tif err = dec.Decode(&body); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tif !body.Done {\n\t\tlog.Fatalln(\"there are more communication profile to query\")\n\t}\n\n\tresult := make(map[string]string)\n\tfor _, p := range body.Records {\n\t\tresult[p.Name] = p.ID\n\t}\n\n\treturn result\n}", "func GetCmdParams() *cobra.Command {\r\n\tcmd := &cobra.Command{\r\n\t\tUse: \"params\",\r\n\t\tShort: \"Query the current ibc-transfer parameters\",\r\n\t\tLong: \"Query the current ibc-transfer parameters\",\r\n\t\tArgs: cobra.NoArgs,\r\n\t\tExample: fmt.Sprintf(\"%s query ibc-transfer params\", version.AppName),\r\n\t\tRunE: func(cmd *cobra.Command, _ []string) error {\r\n\t\t\tclientCtx, err := client.GetClientQueryContext(cmd)\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn err\r\n\t\t\t}\r\n\t\t\tqueryClient := types.NewQueryClient(clientCtx)\r\n\r\n\t\t\tres, _ := queryClient.Params(context.Background(), &types.QueryParamsRequest{})\r\n\t\t\treturn clientCtx.PrintProto(res.Params)\r\n\t\t},\r\n\t}\r\n\r\n\tflags.AddQueryFlagsToCmd(cmd)\r\n\r\n\treturn cmd\r\n}", "func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {\n\tdefer telemetry.MeasureSince(time.Now(), types.ModuleName, \"query\", \"Params\")\n\tctx := sdk.UnwrapSDKContext(c)\n\tvar params types.Params\n\tk.paramSpace.GetParamSet(ctx, &params)\n\n\treturn &types.QueryParamsResponse{Params: params, Request: req}, nil\n}", "func NewGetPbxDeviceProfileitemsRequest(server string, params *GetPbxDeviceProfileitemsParams) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/pbxdeviceprofiles\")\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryUrl.Query()\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"name\", params.Name); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"config_id\", params.ConfigId); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"order_by\", params.OrderBy); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"order_by_direction\", params.OrderByDirection); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"page\", params.Page); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"rows\", params.Rows); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tqueryUrl.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func GetCmdQueryParams() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"params\",\n\t\tShort: \"Query the current minting parameters\",\n\t\tArgs: cobra.NoArgs,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tclientCtx, err := client.GetClientQueryContext(cmd)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tqueryClient := types.NewQueryClient(clientCtx)\n\n\t\t\tparams := &types.QueryParamsRequest{}\n\t\t\tres, err := queryClient.Params(cmd.Context(), params)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn clientCtx.PrintProto(&res.Params)\n\t\t},\n\t}\n\n\tflags.AddQueryFlagsToCmd(cmd)\n\n\treturn cmd\n}", "func getParameters(c *cli.Context) error {\n\tif !isSystemRunning() {\n\t\treturn nil\n\t}\n\t_, _, _, controllers := getIPAddresses()\n\n\tparams := sendCommandToControllers(controllers, \"GetParams\", \"\")\n\tfmt.Println(params)\n\n\treturn nil\n}", "func QueryParameters(f *cli.Fixtures, flags ...string) types.Params {\n\tcmd := fmt.Sprintf(\"%s query distribution params %v\", f.SimcliBinary, f.Flags())\n\tout, errStr := tests.ExecuteT(f.T, cli.AddFlags(cmd, flags), \"\")\n\trequire.Empty(f.T, errStr)\n\n\tvar params types.Params\n\trequire.NoError(f.T, f.Cdc.UnmarshalJSON([]byte(out), &params))\n\treturn params\n}", "func NewGetPbxDeviceProfilePreferenceitemsRequest(server string, params *GetPbxDeviceProfilePreferenceitemsParams) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/pbxdeviceprofilepreferences\")\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryUrl.Query()\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"order_by\", params.OrderBy); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"order_by_direction\", params.OrderByDirection); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"page\", params.Page); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"rows\", params.Rows); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tqueryUrl.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func queryProfiles(ctx sdk.Context, _ abci.RequestQuery, keeper Keeper) ([]byte, error) {\n\taccounts := keeper.GetProfiles(ctx)\n\n\tbz, err := codec.MarshalJSONIndent(keeper.Cdc, &accounts)\n\tif err != nil {\n\t\tpanic(\"could not marshal result to JSON\")\n\t}\n\n\treturn bz, nil\n}", "func (c *OVClient) GetProfiles(start string, count string, filter string, sort string, scopeUris string) (ServerProfileList, error) {\n\tvar (\n\t\turi = \"/rest/server-profiles\"\n\t\tq map[string]interface{}\n\t\tprofiles ServerProfileList\n\t)\n\tq = make(map[string]interface{})\n\tif len(filter) > 0 {\n\t\tq[\"filter\"] = filter\n\t}\n\n\tif sort != \"\" {\n\t\tq[\"sort\"] = sort\n\t}\n\n\tif start != \"\" {\n\t\tq[\"start\"] = start\n\t}\n\n\tif count != \"\" {\n\t\tq[\"count\"] = count\n\t}\n\n\tif scopeUris != \"\" {\n\t\tq[\"scopeUris\"] = scopeUris\n\t}\n\n\t// refresh login\n\tc.RefreshLogin()\n\tc.SetAuthHeaderOptions(c.GetAuthHeaderMap())\n\t// Setup query\n\tif len(q) > 0 {\n\t\tc.SetQueryString(q)\n\t}\n\tdata, err := c.RestAPICall(rest.GET, uri, nil)\n\tif err != nil {\n\t\treturn profiles, err\n\t}\n\n\tlog.Debugf(\"GetProfiles %s\", data)\n\tif err := json.Unmarshal([]byte(data), &profiles); err != nil {\n\t\treturn profiles, err\n\t}\n\treturn profiles, nil\n}", "func (c *Config) GetAllMemberParameters() map[string]string {\n\tvars := map[string]string{}\n\n\tfor _, env := range os.Environ() {\n\t\tkeyValue := strings.SplitN(env, \"=\", 2)\n\t\tif len(keyValue) < 2 {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasPrefix(keyValue[0], MemberEnvPrefix+\"_\") {\n\t\t\tvars[keyValue[0]] = keyValue[1]\n\t\t}\n\t}\n\treturn vars\n}", "func NewGetProfilePreferenceitemsRequest(server string, params *GetProfilePreferenceitemsParams) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/profilepreferences\")\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryUrl.Query()\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"order_by\", params.OrderBy); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"order_by_direction\", params.OrderByDirection); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"page\", params.Page); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"rows\", params.Rows); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tqueryUrl.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {\n\tk.paramSubspace.GetParamSet(ctx, &params)\n\treturn params\n}", "func (tr *Account) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func GetAttributeParamsCmd() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"params\",\n\t\tShort: \"Query the current name parameters\",\n\t\tArgs: cobra.NoArgs,\n\t\tExample: fmt.Sprintf(`$ %s query attribute params`, version.AppName),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tclientCtx, err := client.GetClientQueryContext(cmd)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tqueryClient := types.NewQueryClient(clientCtx)\n\t\t\tres, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn clientCtx.PrintProto(&res.Params)\n\t\t},\n\t}\n\n\tflags.AddQueryFlagsToCmd(cmd)\n\n\treturn cmd\n}", "func GetProfile(c *fiber.Ctx) error {\n\tID := c.Query(\"id\")\n\n\tif len(ID) < 1 {\n\t\tc.Send(ID)\n\t\tc.Send(\"Parameter ID is required\")\n\t\tc.SendStatus(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tprofile, err := database.SearchProfile(ID)\n\tif err != nil {\n\t\tc.Send(\"Error Occurred\" + err.Error())\n\t\tc.SendStatus(http.StatusBadRequest)\n\t\treturn\n\t}\n\tif err := c.JSON(profile); err != nil {\n\t\tc.Status(500).Send(err)\n\t\treturn\n\t}\n\tc.Accepts(\"application/json\")\n\tc.SendStatus(http.StatusAccepted)\n}", "func registerOperationDevicesGetDevicesApsProfilesParamFlags(cmd *cobra.Command) error {\n\treturn nil\n}", "func (o *PhoneSearchOptions) getParameters() (params map[string]string, err error) {\n\t// create an empty map of options\n\tparams = make(map[string]string)\n\n\t// reflect over the properties in o, adding parameters to the global map\n\tval := reflect.ValueOf(o).Elem()\n\tfor i := 0; i < val.NumField(); i++ {\n\t\tif !val.Field(i).IsNil() {\n\t\t\to := val.Field(i).Interface().(OptionProvider)\n\t\t\tfieldParams, err := o.getParameters()\n\t\t\tif err != nil {\n\t\t\t\treturn params, err\n\t\t\t}\n\t\t\tfor k, v := range fieldParams {\n\t\t\t\tparams[k] = v\n\t\t\t}\n\t\t}\n\t}\n\treturn params, nil\n}", "func listProfiles(ctx context.Context, _ []string) error {\n\tm, err := cmdutils.LoadManager(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"%15s %s\\n\", \"ID\", \"NAME\")\n\tfor _, p := range m.Profiles() {\n\t\tfmt.Printf(\"%15s %s\\n\", p.Id, p.Name)\n\t}\n\n\treturn nil\n}", "func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {\n\tk.paramspace.GetParamSet(ctx, &params)\n\treturn params\n}", "func testProfileList(t *testing.T) {\n\tp := profileName(t)\n\tt.Parallel()\n\tmk := NewMinikubeRunner(t, p, \"--wait=false\")\n\tout, stderr := mk.MustRun(\"profile list\")\n\tif !strings.Contains(out, p) {\n\t\tt.Errorf(\"Error , failed to read profile name (%s) in `profile list` command output : \\n %q : \\n stderr: %s \", p, out, stderr)\n\t}\n}", "func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {\n\tctx := sdk.UnwrapSDKContext(c)\n\tvar params types.Params\n\tk.paramSpace.GetParamSet(ctx, &params)\n\n\treturn &types.QueryParamsResponse{Params: params}, nil\n}", "func (p *OnuIgmpProfile) ListEssentialParams() map[string]interface{} {\r\n\tvar EssentialOnuIgmpProfile = map[string]interface{}{\r\n\t\tOnuIgmpProfileHeaders[0]: p.GetName(),\r\n\t\tOnuIgmpProfileHeaders[1]: p.GetMode(),\r\n\t\tOnuIgmpProfileHeaders[2]: p.GetProxy(),\r\n\t\tOnuIgmpProfileHeaders[3]: p.GetFastLeave(),\r\n\t\tOnuIgmpProfileHeaders[4]: p.GetUsTci(),\r\n\t\tOnuIgmpProfileHeaders[5]: p.DsGemPort,\r\n\t}\r\n\t// I want all of these Bools to return strings of \"Enabled/Disabled\"\r\n\treturn EssentialOnuIgmpProfile\r\n}", "func (ctx *Context) QueryParams(key string) []string {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams[key]\r\n}", "func (k Keeper) GetParams(ctx sdk.Context) types.Params {\n\tvar p types.Params\n\tk.paramSubspace.GetParamSet(ctx, &p)\n\treturn p\n}", "func NewProfilesGetCollectionRequest(server string, params *ProfilesGetCollectionParams) (*http.Request, error) {\n\tvar err error\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/v1/profiles\")\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryURL.Query()\n\n\tif params.FilterName != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"filter[name]\", runtime.ParamLocationQuery, *params.FilterName); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FilterProfileState != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"filter[profileState]\", runtime.ParamLocationQuery, *params.FilterProfileState); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FilterProfileType != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"filter[profileType]\", runtime.ParamLocationQuery, *params.FilterProfileType); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FilterId != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"filter[id]\", runtime.ParamLocationQuery, *params.FilterId); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.Sort != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"sort\", runtime.ParamLocationQuery, *params.Sort); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FieldsProfiles != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[profiles]\", runtime.ParamLocationQuery, *params.FieldsProfiles); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.Limit != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"limit\", runtime.ParamLocationQuery, *params.Limit); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.Include != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"include\", runtime.ParamLocationQuery, *params.Include); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FieldsCertificates != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[certificates]\", runtime.ParamLocationQuery, *params.FieldsCertificates); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FieldsDevices != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[devices]\", runtime.ParamLocationQuery, *params.FieldsDevices); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FieldsBundleIds != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[bundleIds]\", runtime.ParamLocationQuery, *params.FieldsBundleIds); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.LimitCertificates != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"limit[certificates]\", runtime.ParamLocationQuery, *params.LimitCertificates); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.LimitDevices != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"limit[devices]\", runtime.ParamLocationQuery, *params.LimitDevices); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tqueryURL.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func (ctx *Context) QueryParamAll() url.Values {\r\n\tif ctx.queryParams == nil {\r\n\t\tctx.queryParams = ctx.R.URL.Query()\r\n\t}\r\n\treturn ctx.queryParams\r\n}", "func (s *Service) ProfilesGet(userID string) *ProfilesGetOp {\n\treturn &ProfilesGetOp{\n\t\tCredential: s.credential,\n\t\tMethod: \"GET\",\n\t\tPath: strings.Join([]string{\"users\", userID, \"profile\"}, \"/\"),\n\t\tAccept: \"application/json\",\n\t\tQueryOpts: make(url.Values),\n\t\tVersion: esign.APIv21,\n\t}\n}", "func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {\n\tctx := sdk.UnwrapSDKContext(c)\n\n\tparams := k.GetParamSet(ctx)\n\n\treturn &types.QueryParamsResponse{Params: params}, nil\n}", "func NewUpdateDeviceProfileParams() *UpdateDeviceProfileParams {\n\tvar ()\n\treturn &UpdateDeviceProfileParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewProfilesGetInstanceRequest(server string, id string, params *ProfilesGetInstanceParams) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParamWithLocation(\"simple\", false, \"id\", runtime.ParamLocationPath, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/v1/profiles/%s\", pathParam0)\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryURL.Query()\n\n\tif params.FieldsProfiles != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[profiles]\", runtime.ParamLocationQuery, *params.FieldsProfiles); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.Include != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"include\", runtime.ParamLocationQuery, *params.Include); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FieldsCertificates != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[certificates]\", runtime.ParamLocationQuery, *params.FieldsCertificates); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FieldsDevices != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[devices]\", runtime.ParamLocationQuery, *params.FieldsDevices); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FieldsBundleIds != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[bundleIds]\", runtime.ParamLocationQuery, *params.FieldsBundleIds); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.LimitCertificates != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"limit[certificates]\", runtime.ParamLocationQuery, *params.LimitCertificates); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.LimitDevices != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"limit[devices]\", runtime.ParamLocationQuery, *params.LimitDevices); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tqueryURL.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func GetParamsCmd(cdc *codec.Codec) *cobra.Command {\n\tparamsCmd := &cobra.Command{\n\t\tUse: \"params\",\n\t\tShort: \"Update the params of various modules\",\n\t\tSuggestionsMinimumDistance: 2,\n\t}\n\n\tparamsCmd.AddCommand(AccountParamsCmd(cdc))\n\tparamsCmd.AddCommand(BankParamsCmd(cdc))\n\tparamsCmd.AddCommand(CommunityParamsCmd(cdc))\n\tparamsCmd.AddCommand(ClaimParamsCmd(cdc))\n\tparamsCmd.AddCommand(StakingParamsCmd(cdc))\n\tparamsCmd.AddCommand(SlashingParamsCmd(cdc))\n\n\treturn paramsCmd\n}", "func GetProfile(ctx *router.Context) {\n\tuin, _ := ctx.Keys[middleware.ComerUinContextKey].(uint64)\n\tresponse, err := service.GetComerProfile(uin)\n\tif err != nil {\n\t\tctx.ERROR(\n\t\t\trouter.ErrBuisnessError,\n\t\t\t\"wrong metamask login parameter\",\n\t\t)\n\t\treturn\n\t}\n\n\tctx.OK(response)\n}", "func GetCmdQueryParams(queryRoute string, cdc *codec.Codec) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: oracle.QueryParams,\n\t\tArgs: cobra.NoArgs,\n\t\tShort: \"Query the current Oracle params\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\tres, err := cliCtx.QueryWithData(fmt.Sprintf(\"custom/%s/%s\", queryRoute, oracle.QueryParams), nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar params oracle.Params\n\t\t\tcdc.MustUnmarshalJSON(res, &params)\n\t\t\treturn cliCtx.PrintOutput(params)\n\t\t},\n\t}\n\n\treturn cmd\n}", "func (a *API) ProfileSearch(ctx context.Context, searchID string, pageNum int) (*ProfileResp, error) {\n\n\tall := pageNum < 1\n\tif all || pageNum < 1 {\n\t\tpageNum = 1\n\t}\n\n\tvar resp ProfileResp\n\turlStr := fmt.Sprintf(\"/api/v1/profile?searchId=%s&pageSize=100&pageNumber=%d\", searchID, pageNum)\n\tif err := a.Get(ctx, urlStr, &resp); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif all && resp.TotalPageCount > 1 {\n\t\tfor i := 1; i < resp.TotalPageCount; i++ {\n\t\t\tpg, err := a.ProfileSearch(ctx, searchID, i+1)\n\t\t\tif err != nil {\n\t\t\t\treturn &resp, err\n\t\t\t}\n\t\t\tresp.Profiles = append(resp.Profiles, pg.Profiles...)\n\t\t}\n\t}\n\n\treturn &resp, nil\n}", "func (s *SmartContract) QueryProfile(ctx contractapi.TransactionContextInterface, carNumber string) (*Profile, error) {\n\tcarAsBytes, err := ctx.GetStub().GetState(\"profile-\" + carNumber)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to read from world state. %s\", err.Error())\n\t}\n\n\tif carAsBytes == nil {\n\t\treturn nil, fmt.Errorf(\"%s does not exist\", carNumber)\n\t}\n\n\tcar := new(Profile)\n\t_ = json.Unmarshal(carAsBytes, car)\n\n\treturn car, nil\n}", "func GetProfileList(ctx context.Context) ([]*shill.Profile, error) {\n\tmanager, err := shill.NewManager(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed creating shill manager object\")\n\t}\n\t// Refresh the in-memory profile list.\n\tif _, err := manager.GetProperties(ctx); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed refreshing the in-memory profile list\")\n\t}\n\t// Get current profiles.\n\tprofiles, err := manager.Profiles(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed getting profile list\")\n\t}\n\treturn profiles, nil\n}", "func GetMetadataParamsCmd() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"params [locator]\",\n\t\tAliases: []string{\"p\"},\n\t\tShort: \"Query the current metadata parameters\",\n\t\tArgs: cobra.MaximumNArgs(1),\n\t\tExample: fmt.Sprintf(\"%s params\", cmdStart),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif len(args) == 0 {\n\t\t\t\treturn outputParams(cmd)\n\t\t\t}\n\t\t\targ0 := strings.TrimSpace(args[0])\n\t\t\tif arg0 == \"locator\" {\n\t\t\t\treturn outputOSLocatorParams(cmd)\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"unknown argument: %s\", arg0)\n\t\t},\n\t}\n\n\taddIncludeRequestFlag(cmd)\n\tflags.AddQueryFlagsToCmd(cmd)\n\n\treturn cmd\n}", "func (db *DB) GetParams() (params core.Params, err error) {\n\tif err := db.Instance.First(&params).Error; err != nil {\n\t\treturn params, err\n\t}\n\treturn params, nil\n}", "func getParamsAndValues(b *ingestcommon.BenchData) ([]paramtools.Params, []float32, paramtools.ParamSet) {\n\tparams := []paramtools.Params{}\n\tvalues := []float32{}\n\tps := paramtools.ParamSet{}\n\tfor testName, allConfigs := range b.Results {\n\t\tfor configName, result := range allConfigs {\n\t\t\tkey := paramtools.Params(b.Key).Copy()\n\t\t\tkey[\"test\"] = testName\n\t\t\tkey[\"config\"] = configName\n\t\t\tkey.Add(paramtools.Params(b.Options))\n\n\t\t\t// If there is an options map inside the result add it to the params.\n\t\t\tif resultOptions, ok := result[\"options\"]; ok {\n\t\t\t\tif opts, ok := resultOptions.(map[string]interface{}); ok {\n\t\t\t\t\tfor k, vi := range opts {\n\t\t\t\t\t\t// Ignore the very long and not useful GL_ values, we can retrieve\n\t\t\t\t\t\t// them later via ptracestore.Details.\n\t\t\t\t\t\tif strings.HasPrefix(k, \"GL_\") {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif s, ok := vi.(string); ok {\n\t\t\t\t\t\t\tkey[k] = s\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\tfor k, vi := range result {\n\t\t\t\tif k == \"options\" || k == \"samples\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tkey[\"sub_result\"] = k\n\t\t\t\tfloatVal, ok := vi.(float64)\n\t\t\t\tif !ok {\n\t\t\t\t\tsklog.Errorf(\"Found a non-float64 in %v\", result)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tkey = query.ForceValid(key)\n\t\t\t\tparams = append(params, key.Copy())\n\t\t\t\tvalues = append(values, float32(floatVal))\n\t\t\t\tps.AddParams(key)\n\t\t\t}\n\t\t}\n\t}\n\tps.Normalize()\n\treturn params, values, ps\n}", "func GetCmdQueryParams(queryRoute string, cdc *codec.Codec) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"params\",\n\t\tShort: \"Query the current Treasury params\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\tres, err := cliCtx.QueryWithData(fmt.Sprintf(\"custom/%s/%s\", queryRoute, treasury.QueryParams), nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar params treasury.Params\n\t\t\tcdc.MustUnmarshalJSON(res, &params)\n\t\t\treturn cliCtx.PrintOutput(params)\n\t\t},\n\t}\n\n\treturn cmd\n}", "func (tr *CassandraKeySpace) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func GetCmdParams() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"params\",\n\t\tShort: \"Query the current ibc-router parameters\",\n\t\tLong: \"Query the current ibc-router parameters\",\n\t\tArgs: cobra.NoArgs,\n\t\tExample: fmt.Sprintf(\"%s query ibc-router params\", version.AppName),\n\t\tRunE: func(cmd *cobra.Command, _ []string) error {\n\t\t\tclientCtx, err := client.GetClientQueryContext(cmd)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tqueryClient := types.NewQueryClient(clientCtx)\n\n\t\t\tres, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn clientCtx.PrintProto(res.Params)\n\t\t},\n\t}\n\n\tflags.AddQueryFlagsToCmd(cmd)\n\n\treturn cmd\n}", "func GenerateSubProfileQuery() (string, error) {\n\treturn globalProbe.GenerateSubProfileQuery()\n}", "func (k Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {\n\tctx := sdk.UnwrapSDKContext(c)\n\tvar params types.Params\n\tk.paramSpace.GetParamSet(ctx, &params)\n\treturn &types.QueryParamsResponse{Params: params}, nil\n}", "func GetCmdQueryParams(queryRoute string, cdc *codec.Codec) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: budget.QueryParams,\n\t\tShort: \"Query the current budget params\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcliCtx := context.NewCLIContext().WithCodec(cdc)\n\n\t\t\tres, err := cliCtx.QueryWithData(fmt.Sprintf(\"custom/%s/%s\", queryRoute, budget.QueryParams), nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar params budget.Params\n\t\t\tcdc.MustUnmarshalJSON(res, &params)\n\t\t\treturn cliCtx.PrintOutput(params)\n\t\t},\n\t}\n\n\treturn cmd\n}", "func GetProfile() map[string]string {\n\treturn Creds.GetStringMapString(\"profiles.\" + strings.Replace(viper.GetString(\"profile\"), \".\", \"-\", -1))\n}", "func (o DiagnosticBackendRequestDataMaskingPtrOutput) QueryParams() DiagnosticBackendRequestDataMaskingQueryParamArrayOutput {\n\treturn o.ApplyT(func(v *DiagnosticBackendRequestDataMasking) []DiagnosticBackendRequestDataMaskingQueryParam {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryParams\n\t}).(DiagnosticBackendRequestDataMaskingQueryParamArrayOutput)\n}", "func (j *Jsonnet) Params(envName string) ([]ModuleParameter, error) {\n\tj.log().WithField(\"env-name\", envName).Debug(\"getting component params\")\n\n\tparamsData, err := j.readParams(envName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprops, err := params.ToMap(j.Name(false), paramsData, paramsComponentRoot)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not find components\")\n\t}\n\n\tvar params []ModuleParameter\n\tfor k, v := range props {\n\t\tvStr, err := j.paramValue(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnp := ModuleParameter{\n\t\t\tComponent: j.Name(false),\n\t\t\tKey: k,\n\t\t\tValue: vStr,\n\t\t}\n\n\t\tparams = append(params, np)\n\t}\n\n\tsort.Slice(params, func(i, j int) bool {\n\t\treturn params[i].Key < params[j].Key\n\t})\n\n\treturn params, nil\n}", "func (bg *Backgrounder) GetProfiles() map[string]time.Duration {\n\treturn bg.profile\n}", "func getProfilesDirectory() (string, error) {\n\tn := uint32(100)\n\tfor {\n\t\tb := make([]uint16, n)\n\t\te := windows.GetProfilesDirectory(&b[0], &n)\n\t\tif e == nil {\n\t\t\treturn syscall.UTF16ToString(b), nil\n\t\t}\n\t\tif e != syscall.ERROR_INSUFFICIENT_BUFFER {\n\t\t\treturn \"\", e\n\t\t}\n\t\tif n <= uint32(len(b)) {\n\t\t\treturn \"\", e\n\t\t}\n\t}\n}", "func (org *Org) GetAllNsxtAppPortProfiles(queryParameters url.Values, scope string) ([]*NsxtAppPortProfile, error) {\n\tqueryParams := copyOrNewUrlValues(queryParameters)\n\tif scope != \"\" {\n\t\tqueryParams = queryParameterFilterAnd(\"scope==\"+scope, queryParams)\n\t}\n\n\treturn getAllNsxtAppPortProfiles(org.client, queryParams)\n}", "func (m MigProfile) GetProfileIDs() (int, int, int, error) {\n\terr := m.AssertValid()\n\tif err != nil {\n\t\treturn -1, -1, -1, fmt.Errorf(\"invalid MigProfile: %v\", err)\n\t}\n\n\tc, g, _, err := m.Parse()\n\tif err != nil {\n\t\treturn -1, -1, -1, fmt.Errorf(\"unable to parse MigProfile: %v\", err)\n\t}\n\n\tvar giProfileID, ciProfileID, ciEngProfileID int\n\n\tswitch g {\n\tcase 1:\n\t\tgiProfileID = nvml.GPU_INSTANCE_PROFILE_1_SLICE\n\tcase 2:\n\t\tgiProfileID = nvml.GPU_INSTANCE_PROFILE_2_SLICE\n\tcase 3:\n\t\tgiProfileID = nvml.GPU_INSTANCE_PROFILE_3_SLICE\n\tcase 4:\n\t\tgiProfileID = nvml.GPU_INSTANCE_PROFILE_4_SLICE\n\tcase 7:\n\t\tgiProfileID = nvml.GPU_INSTANCE_PROFILE_7_SLICE\n\tcase 8:\n\t\tgiProfileID = nvml.GPU_INSTANCE_PROFILE_8_SLICE\n\tdefault:\n\t\treturn -1, -1, -1, fmt.Errorf(\"unknown GPU Instance slice size: %v\", g)\n\t}\n\n\tswitch c {\n\tcase 1:\n\t\tciProfileID = nvml.COMPUTE_INSTANCE_PROFILE_1_SLICE\n\tcase 2:\n\t\tciProfileID = nvml.COMPUTE_INSTANCE_PROFILE_2_SLICE\n\tcase 3:\n\t\tciProfileID = nvml.COMPUTE_INSTANCE_PROFILE_3_SLICE\n\tcase 4:\n\t\tciProfileID = nvml.COMPUTE_INSTANCE_PROFILE_4_SLICE\n\tcase 7:\n\t\tciProfileID = nvml.COMPUTE_INSTANCE_PROFILE_7_SLICE\n\tcase 8:\n\t\tciProfileID = nvml.COMPUTE_INSTANCE_PROFILE_8_SLICE\n\tdefault:\n\t\treturn -1, -1, -1, fmt.Errorf(\"unknown Compute Instance slice size: %v\", c)\n\t}\n\n\tciEngProfileID = nvml.COMPUTE_INSTANCE_ENGINE_PROFILE_SHARED\n\n\treturn giProfileID, ciProfileID, ciEngProfileID, nil\n}", "func NewGetaspecificPbxDeviceProfileRequest(server string, id string) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/pbxdeviceprofiles/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func (k Keeper) GetParams(ctx sdk.Context) Params {\n\tvar resultParams Params\n\tk.paramSpace.Get(ctx, paramStoreKeyParams, &resultParams)\n\treturn resultParams\n}", "func (f FindOptions) QueryParams() map[string][]string {\n\tqp := map[string][]string{\n\t\t\"descending\": {strconv.FormatBool(f.Descending)},\n\t\t\"offset\": {strconv.Itoa(f.Offset)},\n\t}\n\n\tif f.Limit > 0 {\n\t\tqp[\"limit\"] = []string{strconv.Itoa(f.Limit)}\n\t}\n\n\tif f.SortBy != \"\" {\n\t\tqp[\"sortBy\"] = []string{f.SortBy}\n\t}\n\n\treturn qp\n}", "func getProfiles() {\n\n\tvar configDir string\n\tif isRunningInDockerContainer() {\n\t\tconfigDir = filepath.Join(\"app\", \"config\")\n\t} else {\n\t\t_, fn, _, ok := runtime.Caller(0)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\t\tindex := strings.LastIndex(fn, \"chart-verifier/\")\n\t\tconfigDir = fn[0 : index+len(\"chart-verifier\")]\n\t\tconfigDir = filepath.Join(configDir, \"config\")\n\t}\n\n\tfilepath.Walk(configDir, func(path string, info os.FileInfo, err error) error {\n\t\tif info != nil {\n\t\t\tif strings.HasSuffix(info.Name(), \".yaml\") {\n\t\t\t\tprofileRead, err := readProfile(path)\n\t\t\t\tif err == nil {\n\t\t\t\t\t// If version is not valid set to a default version\n\t\t\t\t\tif !semver.IsValid(profileRead.Version) {\n\t\t\t\t\t\tprofileRead.Version = DefaultProfileVersion\n\t\t\t\t\t}\n\t\t\t\t\tif len(profileRead.Vendor) == 0 {\n\t\t\t\t\t\tprofileRead.Vendor = VendorTypeNotSpecified\n\t\t\t\t\t}\n\t\t\t\t\tprofileMap[profileRead.Vendor] = append(profileMap[profileRead.Vendor], profileRead)\n\t\t\t\t\tprofileRead.Name = strings.Split(info.Name(), \".yaml\")[0]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\treturn\n}", "func GetParameterByNameAndConfigFile(toClient *toclient.Session, name string, configFile string, opts *toclient.RequestOptions) ([]tc.Parameter, toclientlib.ReqInf, error) {\n\tif opts == nil {\n\t\topts = &toclient.RequestOptions{}\n\t}\n\tif opts.QueryParameters == nil {\n\t\topts.QueryParameters = url.Values{}\n\t}\n\topts.QueryParameters.Set(\"name\", name)\n\topts.QueryParameters.Set(\"configFile\", name)\n\tparams, reqInf, err := toClient.GetParameters(*opts)\n\treturn params.Response, reqInf, err\n}", "func (h *auth) Params(c echo.Context) error {\n\t// Fetch params from URL queries\n\temail := c.QueryParam(\"email\")\n\tif email == \"\" {\n\t\treturn c.JSON(http.StatusUnauthorized, sferror.New(\"No email provided.\"))\n\t}\n\n\treturn h.params(c, email)\n}", "func (c *Context) GetParams(key string) string {\n\treturn c.P.ByName(key)\n}", "func (k Keeper) GetParams(ctx sdk.Ctx) types.Params {\n\treturn types.Params{\n\t\tSessionNodeCount: k.SessionNodeCount(ctx),\n\t\tClaimSubmissionWindow: k.ClaimSubmissionWindow(ctx),\n\t\tSupportedBlockchains: k.SupportedBlockchains(ctx),\n\t\tClaimExpiration: k.ClaimExpiration(ctx),\n\t\tReplayAttackBurnMultiplier: k.ReplayAttackBurnMultiplier(ctx),\n\t\tMinimumNumberOfProofs: k.MinimumNumberOfProofs(ctx),\n\t\tBlockByteSize: k.BlockByteSize(ctx),\n\t}\n}", "func (sc SearchClient) QueryParams() url.Values {\n\tparams := url.Values{}\n\n\tif sc.FilterID > 0 {\n\t\tparams.Add(\"filter_id\", strconv.Itoa(sc.FilterID))\n\t}\n\n\tif sc.PerPage > 1 && sc.PerPage != 25 {\n\t\tparams.Add(\"per_page\", strconv.Itoa(sc.PerPage))\n\t}\n\n\tif len(sc.Key) > 0 {\n\t\tparams.Add(\"key\", sc.Key)\n\t}\n\n\tif len(sc.SortDirection) > 0 {\n\t\tparams.Add(\"sd\", sc.SortDirection)\n\t}\n\n\tif len(sc.SortField) > 0 {\n\t\tparams.Add(\"sf\", sc.SortField)\n\t}\n\n\treturn params\n}", "func (o *GetUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.Connection != nil {\n\n\t\t// query param connection\n\t\tvar qrConnection string\n\t\tif o.Connection != nil {\n\t\t\tqrConnection = *o.Connection\n\t\t}\n\t\tqConnection := qrConnection\n\t\tif qConnection != \"\" {\n\t\t\tif err := r.SetQueryParam(\"connection\", qConnection); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludeFields != nil {\n\n\t\t// query param include_fields\n\t\tvar qrIncludeFields bool\n\t\tif o.IncludeFields != nil {\n\t\t\tqrIncludeFields = *o.IncludeFields\n\t\t}\n\t\tqIncludeFields := swag.FormatBool(qrIncludeFields)\n\t\tif qIncludeFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"include_fields\", qIncludeFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludeTotals != nil {\n\n\t\t// query param include_totals\n\t\tvar qrIncludeTotals bool\n\t\tif o.IncludeTotals != nil {\n\t\t\tqrIncludeTotals = *o.IncludeTotals\n\t\t}\n\t\tqIncludeTotals := swag.FormatBool(qrIncludeTotals)\n\t\tif qIncludeTotals != \"\" {\n\t\t\tif err := r.SetQueryParam(\"include_totals\", qIncludeTotals); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int64\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt64(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PerPage != nil {\n\n\t\t// query param per_page\n\t\tvar qrPerPage int64\n\t\tif o.PerPage != nil {\n\t\t\tqrPerPage = *o.PerPage\n\t\t}\n\t\tqPerPage := swag.FormatInt64(qrPerPage)\n\t\tif qPerPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"per_page\", qPerPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Q != nil {\n\n\t\t// query param q\n\t\tvar qrQ string\n\t\tif o.Q != nil {\n\t\t\tqrQ = *o.Q\n\t\t}\n\t\tqQ := qrQ\n\t\tif qQ != \"\" {\n\t\t\tif err := r.SetQueryParam(\"q\", qQ); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.SearchEngine != nil {\n\n\t\t// query param search_engine\n\t\tvar qrSearchEngine string\n\t\tif o.SearchEngine != nil {\n\t\t\tqrSearchEngine = *o.SearchEngine\n\t\t}\n\t\tqSearchEngine := qrSearchEngine\n\t\tif qSearchEngine != \"\" {\n\t\t\tif err := r.SetQueryParam(\"search_engine\", qSearchEngine); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Sort != nil {\n\n\t\t// query param sort\n\t\tvar qrSort string\n\t\tif o.Sort != nil {\n\t\t\tqrSort = *o.Sort\n\t\t}\n\t\tqSort := qrSort\n\t\tif qSort != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sort\", qSort); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func collectParameters(r *http.Request, oauthParams map[string]string) map[string]string {\n\tparams := map[string]string{}\n\tfor key, value := range r.URL.Query() {\n\t\tparams[key] = value[0]\n\t}\n\tfor key, value := range oauthParams {\n\t\tparams[key] = value\n\t}\n\treturn params\n}", "func (o ApiDiagnosticBackendRequestDataMaskingPtrOutput) QueryParams() ApiDiagnosticBackendRequestDataMaskingQueryParamArrayOutput {\n\treturn o.ApplyT(func(v *ApiDiagnosticBackendRequestDataMasking) []ApiDiagnosticBackendRequestDataMaskingQueryParam {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryParams\n\t}).(ApiDiagnosticBackendRequestDataMaskingQueryParamArrayOutput)\n}", "func (tr *MongoDatabase) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func queryProfile(ctx sdk.Context, path []string, _ abci.RequestQuery, keeper Keeper) ([]byte, error) {\n\tif len(strings.TrimSpace(path[0])) == 0 {\n\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, \"DTag or address cannot be empty or blank\")\n\t}\n\n\taddress, err := sdk.AccAddressFromBech32(path[0])\n\tif err != nil {\n\t\taddress = keeper.GetDtagRelatedAddress(ctx, path[0])\n\t\tif address == nil {\n\t\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf(\"No address related to this dtag: %s\", path[0]))\n\t\t}\n\n\t}\n\n\taccount, found := keeper.GetProfile(ctx, address)\n\n\tif !found {\n\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest,\n\t\t\tfmt.Sprintf(\"Profile with address %s doesn't exists\", path[0]))\n\t}\n\n\tbz, err := codec.MarshalJSONIndent(keeper.Cdc, &account)\n\tif err != nil {\n\t\tpanic(\"could not marshal result to JSON\")\n\t}\n\n\treturn bz, nil\n}", "func (o DiagnosticFrontendRequestDataMaskingPtrOutput) QueryParams() DiagnosticFrontendRequestDataMaskingQueryParamArrayOutput {\n\treturn o.ApplyT(func(v *DiagnosticFrontendRequestDataMasking) []DiagnosticFrontendRequestDataMaskingQueryParam {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryParams\n\t}).(DiagnosticFrontendRequestDataMaskingQueryParamArrayOutput)\n}", "func (n *QriNode) RequestProfileInfo(pinfo pstore.PeerInfo) error {\n\t// Get this repo's profile information\n\tprofile, err := n.Repo.Profile()\n\tif err != nil {\n\t\tfmt.Println(\"error getting node profile info:\", err)\n\t\treturn err\n\t}\n\n\taddrs, err := n.IPFSListenAddresses()\n\tif err != nil {\n\t\treturn err\n\t}\n\tprofile.Addresses = addrs\n\n\tres, err := n.SendMessage(pinfo.ID, &Message{\n\t\tType: MtPeerInfo,\n\t\tPayload: profile,\n\t})\n\tif err != nil {\n\t\tfmt.Println(\"send profile message error:\", err.Error())\n\t\treturn err\n\t}\n\n\tif res.Phase == MpResponse {\n\t\tif err := n.handleProfileResponse(pinfo, res); err != nil {\n\t\t\tfmt.Println(\"profile response error\", err.Error())\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func GetQueryCmd(queryRoute string, cdc *codec.Codec) *cobra.Command {\n\t// Group profile queries under a subcommand\n\tprofileQueryCmd := &cobra.Command{\n\t\tUse: types.ModuleName,\n\t\tShort: fmt.Sprintf(\"Querying commands for the %s module\", types.ModuleName),\n\t\tDisableFlagParsing: true,\n\t\tSuggestionsMinimumDistance: 2,\n\t\tRunE: client.ValidateCmd,\n\t}\n\n\tprofileQueryCmd.AddCommand(\n\t\tflags.GetCommands(\n\t\t\tGetCmdBalance(queryRoute, cdc),\n\t\t)...,\n\t)\n\n\treturn profileQueryCmd\n}", "func (a API) Profile(client *http.Client, user_id string, fields Fields) (j map[string]interface{}, err error) {\r\n\treturn a.request(client, \"profile\", map[string]string{\r\n\t\t\"id\": getUserIdString(user_id),\r\n\t\t\"fields\": fields.Encode(),\r\n\t}, nil)\r\n}", "func (tr *CassandraTable) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func (s *Scraper) FetchSearchProfiles(query string, maxProfilesNbr int, cursor string) ([]*Profile, string, error) {\n\ttimeline, err := s.getSearchTimeline(query, maxProfilesNbr, cursor)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\tusers, nextCursor := timeline.parseUsers()\n\treturn users, nextCursor, nil\n}", "func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {\n\tctx := sdk.UnwrapSDKContext(c)\n\tparams := k.GetParams(ctx)\n\n\treturn &types.QueryParamsResponse{Params: params}, nil\n}", "func (cli *Client) PeopleProfile(id string, fields []string) (r map[string]interface{}, e error) {\n\tvar opt map[string]interface{}\n\n\tif len(fields) > 0 {\n\t\topt = map[string]interface{}{\n\t\t\t\"fields\": fields,\n\t\t}\n\t}\n\n\tr, e = cli.call(\"GET\", \"people\", id, \"\", opt)\n\n\treturn r, e\n}", "func retrieve_gmm_gwy_profiles_list(gmm_api_key string, org_id int) {\n\n\ttype gwy_profiles struct {\n\t\tGatewayProfiles []struct {\n\t\t\tID int `json:\"id\"`\n\t\t\tName string `json:\"name\"`\n\t\t} `json:\"gateway_profiles\"`\n\t\tPaging struct {\n\t\t\tLimit int `json:\"limit\"`\n\t\t\tOffset int `json:\"offset\"`\n\t\t\tPages int `json:\"pages\"`\n\t\t\tCount int `json:\"count\"`\n\t\t\tLinks struct {\n\t\t\t\tFirst string `json:\"first\"`\n\t\t\t\tLast string `json:\"last\"`\n\t\t\t\tNext string `json:\"next\"`\n\t\t\t} `json:\"links\"`\n\t\t} `json:\"paging\"`\n\t}\n\n\tjsonValue, _ := json.Marshal(\"\")\n\trequest, _ := http.NewRequest(\"GET\", \"https://us.ciscokinetic.io/api/v2/organizations/\" + strconv.Itoa(org_id) + \"/gateway_profiles?limit=100\", bytes.NewBuffer(jsonValue))\n\ttoken := \"Token \" + gmm_api_key\n\trequest.Header.Set(\"Authorization\", token)\n\tclient := &http.Client{}\n\tr, err := client.Do(request)\n\n\tif err != nil {\n\t\tfmt.Printf(\"Retrieve GMM GWY Profiles error %s\\n\", err)\n\t\tos.Exit(1)\n\t}\n\n\tresponseData, _ := ioutil.ReadAll(r.Body)\n\n\tvar responseObject gwy_profiles\n\te := json.Unmarshal(responseData, &responseObject)\n\tif e != nil {\n\t\tfmt.Println(\"Unmarshall Error: \", e)\n\t}\n\n\tfmt.Println(\"\")\n\tfmt.Println(\"Total Number of Gateway Profiles in GMM: \", len(responseObject.GatewayProfiles))\n\tfmt.Println(\"\")\n\tfmt.Println(\"Gateway Profiles in GMM\")\n\tfmt.Println(\"-----------------------\")\n\tfor i := 0; i < len(responseObject.GatewayProfiles); i++ {\n\t\tfmt.Println(\"Profile-ID: \", responseObject.GatewayProfiles[i].ID, \" Profile Name: \", responseObject.GatewayProfiles[i].Name)\n\t}\n}", "func (s *Service) PermissionProfilesGet(permissionProfileID string) *PermissionProfilesGetOp {\n\treturn &PermissionProfilesGetOp{\n\t\tCredential: s.credential,\n\t\tMethod: \"GET\",\n\t\tPath: strings.Join([]string{\"permission_profiles\", permissionProfileID}, \"/\"),\n\t\tAccept: \"application/json\",\n\t\tQueryOpts: make(url.Values),\n\t\tVersion: esign.APIv2,\n\t}\n}", "func (tr *GremlinDatabase) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func GetProfiles(ctx context.Context) []ProfileEntry {\n\tvar c *SqlContext\n\ti := ctx.Value(goradd.SqlContext)\n\tif i == nil {\n\t\tpanic(\"Profiling requires a preloaded context.\")\n\t} else {\n\t\tc = i.(*SqlContext)\n\t}\n\n\tif c != nil {\n\t\tp := c.profiles\n\t\tc.profiles = nil\n\t\treturn p\n\t}\n\treturn nil\n}", "func (o ApiDiagnosticFrontendRequestDataMaskingPtrOutput) QueryParams() ApiDiagnosticFrontendRequestDataMaskingQueryParamArrayOutput {\n\treturn o.ApplyT(func(v *ApiDiagnosticFrontendRequestDataMasking) []ApiDiagnosticFrontendRequestDataMaskingQueryParam {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryParams\n\t}).(ApiDiagnosticFrontendRequestDataMaskingQueryParamArrayOutput)\n}", "func (a *App) GetAllProfiles(w http.ResponseWriter, r *http.Request) {\n\thandler.GetAllProfiles(a.DB, w, r)\n}", "func (s *Scraper) SearchProfiles(ctx context.Context, query string, maxProfilesNbr int) <-chan *ProfileResult {\n\treturn getUserTimeline(ctx, query, maxProfilesNbr, s.FetchSearchProfiles)\n}", "func (tr *NotebookWorkspace) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func getAccountsPageQuery(r *http.Request) (db2.PageQuery, error) {\n\tcursor, err := hchi.GetStringFromURL(r, actions.ParamCursor)\n\tif err != nil {\n\t\treturn db2.PageQuery{}, errors.Wrap(err, \"getting param cursor\")\n\t}\n\n\torder, err := getOrder(r)\n\tif err != nil {\n\t\treturn db2.PageQuery{}, errors.Wrap(err, \"getting param order\")\n\t}\n\n\tlimit, err := getLimit(r, db2.DefaultPageSize, db2.MaxPageSize)\n\tif err != nil {\n\t\treturn db2.PageQuery{}, errors.Wrap(err, \"getting param limit\")\n\t}\n\n\treturn db2.PageQuery{\n\t\tCursor: cursor,\n\t\tOrder: order,\n\t\tLimit: limit,\n\t}, nil\n}", "func TestProfile(t *testing.T) {\n\tvar se profile.Profile\n\n\t// Validate returned fields to match expected name set.\n\tfields := se.Fields()\n\n\tif _, ok := fields[\"address\"]; !ok {\n\t\ttests.Failed(\"Should have a 'address' field\")\n\t}\n\ttests.Passed(\"Should have a 'address' field\")\n\n\tif _, ok := fields[\"user_id\"]; !ok {\n\t\ttests.Failed(\"Should have a 'user_id' field\")\n\t}\n\ttests.Passed(\"Should have a 'user_id' field\")\n\n\tif _, ok := fields[\"public_id\"]; !ok {\n\t\ttests.Failed(\"Should have a 'public_id' field\")\n\t}\n\ttests.Passed(\"Should have a 'public_id' field\")\n\n\tif _, ok := fields[\"first_name\"]; !ok {\n\t\ttests.Failed(\"Should have a 'first_name' field\")\n\t}\n\ttests.Passed(\"Should have a 'first_name' field\")\n\n\tif _, ok := fields[\"last_name\"]; !ok {\n\t\ttests.Failed(\"Should have a 'last_name' field\")\n\t}\n\ttests.Passed(\"Should have a 'last_name' field\")\n}", "func (o DiagnosticBackendResponseDataMaskingPtrOutput) QueryParams() DiagnosticBackendResponseDataMaskingQueryParamArrayOutput {\n\treturn o.ApplyT(func(v *DiagnosticBackendResponseDataMasking) []DiagnosticBackendResponseDataMaskingQueryParam {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryParams\n\t}).(DiagnosticBackendResponseDataMaskingQueryParamArrayOutput)\n}", "func (svc *inmemService) GetProfile(ctx context.Context, id string) (Profile, error) {\n\t// Get the Read lock from the inmemService struct\n\tsvc.mtx.RLock()\n\n\t// Immediately set up a lock release to occur when the function finishes\n\tdefer svc.mtx.RUnlock()\n\n\t// Look for the profile by the `id` function param\n\tprofile, ok := svc.profiles[id]\n\n\t// Check if the profile id was not found in the datastore\n\tif !ok {\n\n\t\t// Return an empty profile and an error informing the caller that the profile was not found\n\t\treturn Profile{}, ErrNotFound\n\n\t}\n\n\t// Return the profile to the caller and a nil error\n\treturn profile, nil\n\n}", "func DefaultListProfile(ctx context.Context, db *gorm1.DB, f *query1.Filtering, s *query1.Sorting, p *query1.Pagination, fs *query1.FieldSelection) ([]*Profile, error) {\n\tin := Profile{}\n\tormObj, err := in.ToORM(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(ProfileORMWithBeforeListApplyQuery); ok {\n\t\tif db, err = hook.BeforeListApplyQuery(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb, err = gorm2.ApplyCollectionOperators(ctx, db, &ProfileORM{}, &Profile{}, f, s, p, fs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(ProfileORMWithBeforeListFind); ok {\n\t\tif db, err = hook.BeforeListFind(ctx, db, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tdb = db.Where(&ormObj)\n\tdb = db.Order(\"id\")\n\tormResponse := []ProfileORM{}\n\tif err := db.Find(&ormResponse).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif hook, ok := interface{}(&ormObj).(ProfileORMWithAfterListFind); ok {\n\t\tif err = hook.AfterListFind(ctx, db, &ormResponse, f, s, p, fs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tpbResponse := []*Profile{}\n\tfor _, responseEntry := range ormResponse {\n\t\ttemp, err := responseEntry.ToPB(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpbResponse = append(pbResponse, &temp)\n\t}\n\treturn pbResponse, nil\n}", "func (tr *Service) GetParameters() (map[string]interface{}, error) {\n\tp, err := json.TFParser.Marshal(tr.Spec.ForProvider)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbase := map[string]interface{}{}\n\treturn base, json.TFParser.Unmarshal(p, &base)\n}", "func RetrieveProfileData(token string, params string) map[string]interface{} {\n\tendpoint := \"https://api.linkedin.com/v1/people/~\"\n\n\tif params == \"\" {\n\t\tparams = profileDataFullParams\n\t}\n\n\tlinkedInClient := LinkedInClient{\n\t\tToken: token,\n\t\tEndpoint: endpoint,\n\t\tParams: params,\n\t\tMethod: GET,\n\t}\n\n\treturn linkedInClient.Retrieve()\n}" ]
[ "0.67599773", "0.6400527", "0.5847315", "0.5535475", "0.55341256", "0.55146354", "0.55065244", "0.5402974", "0.5288138", "0.5251579", "0.520587", "0.51665294", "0.5144454", "0.5124429", "0.5092634", "0.5016223", "0.49747425", "0.4949739", "0.49178165", "0.48966557", "0.4874747", "0.48731953", "0.48654407", "0.48515353", "0.48453668", "0.48432463", "0.48399734", "0.48393244", "0.48160958", "0.48120746", "0.48076355", "0.47946352", "0.47864538", "0.4782093", "0.4776314", "0.4746134", "0.4717208", "0.47133723", "0.47041363", "0.47019476", "0.469463", "0.46934366", "0.46853745", "0.4685142", "0.4677333", "0.46739787", "0.4666918", "0.46626136", "0.46625993", "0.464907", "0.4648696", "0.46283054", "0.46197596", "0.46168166", "0.4615275", "0.4614475", "0.45978913", "0.45947674", "0.45919606", "0.45779002", "0.45751324", "0.4571713", "0.45713636", "0.45682046", "0.4557296", "0.45517114", "0.45459825", "0.45445386", "0.4535132", "0.45328176", "0.45256233", "0.45208308", "0.45198482", "0.45192337", "0.4513938", "0.45114872", "0.450111", "0.44996333", "0.44904664", "0.44899198", "0.44820625", "0.44746476", "0.44727734", "0.44681233", "0.44663817", "0.4464349", "0.44642872", "0.44601226", "0.44433615", "0.44421902", "0.44419503", "0.44416386", "0.4439787", "0.44382098", "0.4437579", "0.44366357", "0.4431303", "0.44291937", "0.44223198", "0.44198743" ]
0.7892636
0
stringView returns a view of the []byte as a string. In unsafe mode, it doesn't incur allocation and copying caused by conversion. In regular safe mode, it is an allocation and copy. Usage: Always maintain a reference to v while result of this call is in use, and call keepAlive4BytesView(v) at point where done with view.
stringView возвращает представление []byte в виде строки. В режиме unsafe не происходит выделения памяти и копирования, вызванного преобразованием. В обычном безопасном режиме это выделение и копирование. Использование: всегда сохраняйте ссылку на v во время использования результата этого вызова, и вызывайте keepAlive4BytesView(v) в точке, где работа с представлением завершена.
func stringView(v []byte) string { return string(v) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func bytesView(v string) []byte {\n\treturn []byte(v)\n}", "func (v ByteVec) String() string { return string([]byte(v)) }", "func (v *View) String() string {\n\tf := format.NewASCII()\n\treturn v.FormatString(f)\n}", "func (s View) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s View) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (b *SafeBuffer) String() string {\n\tb.m.RLock()\n\tdefer b.m.RUnlock()\n\treturn b.b.String()\n}", "func (s GetViewOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (v Value) String() string {\n\tif sp, ok := v.any.(stringptr); ok {\n\t\t// Inlining this code makes a huge difference.\n\t\tvar s string\n\t\thdr := (*reflect.StringHeader)(unsafe.Pointer(&s))\n\t\thdr.Data = uintptr(sp)\n\t\thdr.Len = int(v.num)\n\t\treturn s\n\t}\n\tvar buf []byte\n\treturn string(v.append(buf))\n}", "func (s DeleteViewOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DeleteViewOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DeleteViewVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DescribeViewOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s IPV4) String() string {\n\treturn fmt.Sprintf(\"%v.%v.%v.%v\", s[0], s[1], s[2], s[3])\n}", "func (v String) String() string {\n\treturn v.v\n}", "func StringUnsafe(b []byte) string {\n\tvar s string\n\tpb := (*reflect.SliceHeader)(unsafe.Pointer(&b))\n\tps := (*reflect.StringHeader)(unsafe.Pointer(&s))\n\tps.Data = pb.Data\n\tps.Len = pb.Len\n\treturn s\n}", "func String(b []byte) string {\n\treturn *(*string)(unsafe.Pointer(&b))\n}", "func (s DeleteViewVersionInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateViewVersionOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s ViewContent) String() string {\n\treturn awsutil.Prettify(s)\n}", "func String(b []byte) (s string) {\n pbytes := (*reflect.SliceHeader)(unsafe.Pointer(&b))\n pstring := (*reflect.StringHeader)(unsafe.Pointer(&s))\n pstring.Data = pbytes.Data\n pstring.Len = pbytes.Len\n return\n}", "func (s ViewVersionSummary) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (v *Version) String() string {\r\n\treturn v.str\r\n}", "func bufferToString(buffer *bytes.Buffer, unsafePtr *bool) string {\n defer buffer.Reset()//ensure buffer is reset\n if !*unsafePtr {\n return buffer.String()\n }\n bb := buffer.Bytes()\n s := *(*string)(unsafe.Pointer(&bb))\n return s\n}", "func (s DeleteViewInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s DeleteViewInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func unsafeString(b []byte) string {\n\treturn *(*string)(unsafe.Pointer(&b))\n}", "func (ip IPv4) String() string {\n\treturn string(ip.value)\n}", "func (s UpdateViewOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func UnsafeString(b []byte) string {\n\treturn *(*string)(unsafe.Pointer(&b))\n}", "func (s CreateViewOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateViewOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s GetViewInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func VVByte_to_string(m [][]byte) (*bytes.Buffer, *bytes.Buffer) {\n\n\tlg, b := loghttp.BuffLoggerUniversal(nil, nil)\n\t_ = b\n\n\tbRet := new(bytes.Buffer)\n\tbMsg := new(bytes.Buffer)\n\n\t//for i,v := range m {\n\tfor i := 0; i < len(m); i++ {\n\t\tn, err := bRet.Write(m[i])\n\t\tlg(err)\n\t\tbMsg.WriteString(\" lp\" + util.Itos(i) + \": writing \" + util.Itos(n) + \" bytes: \\n\")\n\t}\n\treturn bRet, bMsg\n}", "func (vl BytesValue) String() string {\n\treturn Buffer.BytesToHexString(vl)\n}", "func (vl BytesValue) String() string {\n\treturn Buffer.BytesToHexString(vl)\n}", "func StringBytes(b []byte) string { return *(*string)(Pointer(&b)) }", "func String(v interface{}) string {\n\treturn StringWithOptions(v, nil)\n}", "func String(b []byte) string {\n\treturn string(b)\n}", "func (s CreateViewVersionInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (v *Value) String() string {\n\tstr := C.value_get_string(v.value)\n\tdefer C.free(unsafe.Pointer(str))\n\n\treturn C.GoString(str)\n}", "func StringFromImmutableBytes(bs []byte) string {\n\tif len(bs) == 0 {\n\t\treturn \"\"\n\t}\n\treturn unsafe.String(&bs[0], len(bs))\n}", "func (s *Buffer) String() string {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\treturn s.buffer.String()\n}", "func String(b []byte) (s string) {\n\tpbytes := (*reflect.SliceHeader)(unsafe.Pointer(&b))\n\tpstring := (*reflect.StringHeader)(unsafe.Pointer(&s))\n\tpstring.Data = pbytes.Data\n\tpstring.Len = pbytes.Len\n\treturn\n}", "func String(v string) *string { return &v }", "func String(v string) *string { return &v }", "func String(v string) *string { return &v }", "func String(v string) *string { return &v }", "func String(b []byte) (s string) {\n\treturn string(b)\n}", "func (s UpdateViewInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (ip IPv4) String() string {\n\treturn fmt.Sprintf(\"%d.%d.%d.%d\", ip[0], ip[1], ip[2], ip[3])\n}", "func BytesToString(b []byte) string { return *(*string)(unsafe.Pointer(&b)) }", "func String(v interface{}) string {\n\treturn v.(string)\n}", "func (e Bytes) String() string {\n\treturn fmt.Sprintf(\"%v\", e)\n}", "func (s DescribeViewInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (b *Buffer) String() string {\n\treturn string(b.buf)\n}", "func gostringnocopy(str *byte) string", "func (s DisassociateDefaultViewOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func String(v string) *string {\n\treturn &v\n}", "func String(v string) *string {\n\treturn &v\n}", "func String(v string) *string {\n\treturn &v\n}", "func String(v string) *string {\n\treturn &v\n}", "func String(v string) *string {\n\treturn &v\n}", "func String(v string) *string {\n\treturn &v\n}", "func String(v string) *string {\n\treturn &v\n}", "func (s ViewSummary) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (b *Bytes) String() string {\n\treturn fmt.Sprint(*b)\n}", "func (s UpdateViewContentOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func String(v string) (p *string) { return &v }", "func (b *LimitedBuffer) String() string {\n\treturn string(b.buf)\n}", "func (s CreateViewInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s CreateViewInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func String(v string) *string { return &v }", "func (v *Value) String() string {\n switch d := v.data.(type) {\n case []byte:\n return string(d)\n case string:\n return d\n default:\n if j, e := json.Marshal(v.data); e == nil {\n return string(j)\n }\n return fmt.Sprintf(\"%+v\", v.data)\n }\n}", "func byteSliceToString(b []byte) string {\n\treturn *(*string)(unsafe.Pointer(&b))\n}", "func stringIPv4(n uint32) string {\n\tip := make(net.IP, 4)\n\tbinary.BigEndian.PutUint32(ip, n)\n\treturn ip.String()\n}", "func (d *Decoder) String() string {\n\tdata := d.Bytes()\n\treturn unsafe.BytesToString(data)\n}", "func GetString(v interface{}) string {\n\tswitch result := v.(type) {\n\tcase string:\n\t\treturn result\n\tcase []byte:\n\t\treturn string(v.([]byte))\n\tcase []string:\n\t\treturn strings.Join([]string(v.([]string)), \"\\n\")\n\tdefault:\n\t\tif v != nil {\n\t\t\treturn fmt.Sprint(result)\n\t\t}\n\t}\n\treturn \"\"\n}", "func (s AssociateDefaultViewOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (v Bytes) String() string {\n\tif v >= EXABYTE {\n\t\treturn v.format(EXABYTE) + EXABYTES\n\t}\n\tif v >= PETABYTE {\n\t\treturn v.format(PETABYTE) + PETABYTES\n\t}\n\tif v >= TERABYTE {\n\t\treturn v.format(TERABYTE) + TERABYTES\n\t}\n\tif v >= GIGABYTE {\n\t\treturn v.format(GIGABYTE) + GIGABYTES\n\t}\n\tif v >= MEGABYTE {\n\t\treturn v.format(MEGABYTE) + MEGABYTES\n\t}\n\tif v >= KILOBYTE {\n\t\treturn v.format(KILOBYTE) + KILOBYTES\n\t}\n\treturn strconv.FormatUint(uint64(v), 10) + JUSTBYTES\n}", "func bytesToString(bs []byte) string {\n\treturn *(*string)(unsafe.Pointer(&bs))\n}", "func (s ListViewsOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (s ListViewsOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (b *Buf) String() string { return string(b.b) }", "func (s UpdateViewContentInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func stringValue(v reflect.Value) string {\n\tif v.CanInterface() {\n\t\treturn fmt.Sprintf(\"%#v\", v.Interface())\n\t} else {\n\t\treturn v.String()\n\t}\n}", "func (v Value) String() string {\n\tif v.typ != String {\n\t\treturn v.Raw()\n\t}\n\treturn v.str\n}", "func (s ViewInputContent) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (k *Key4) String() string { return k.ipv4.String() }", "func (s BatchGetViewOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func BytesToReadOnlyString(b []byte) string {\n\treturn string(b)\n}", "func (b *Builder) String() string {\n\tp := unsafe.Pointer(&b.buf)\n\tsp := (*string)(p)\n\ts := *sp\n\t// return *(*string)(unsafe.Pointer(&b.buf))\n\treturn s\n}", "func (s DisassociateDefaultViewInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "func BytesString(b []byte) string {\n\treturn *(*string)(unsafe.Pointer(&b))\n}", "func (s DBEngineVersion) String() string {\n\treturn awsutil.Prettify(s)\n}", "func ShallowString(b []byte) (s string) {\n\tpbytes := (*reflect.SliceHeader)(unsafe.Pointer(&b))\n\tpstring := (*reflect.StringHeader)(unsafe.Pointer(&s))\n\tpstring.Data = pbytes.Data\n\tpstring.Len = pbytes.Len\n\treturn\n}", "func AsStr(v interface{}) string {\n\ts, err := elstr.ToString(v)\n\tif err != nil {\n\t\treturn \"\"\n\t} else {\n\t\treturn s\n\t}\n}", "func bytesToString(bytes []byte) (s string) {\n\tslice := (*reflect.SliceHeader)(unsafe.Pointer(&bytes))\n\tstr := (*reflect.StringHeader)(unsafe.Pointer(&s))\n\tstr.Data = slice.Data\n\tstr.Len = slice.Len\n\treturn s\n}", "func bytesToString(bytes []byte) (s string) {\n\tslice := (*reflect.SliceHeader)(unsafe.Pointer(&bytes))\n\tstr := (*reflect.StringHeader)(unsafe.Pointer(&s))\n\tstr.Data = slice.Data\n\tstr.Len = slice.Len\n\treturn s\n}", "func bytesToString(value []byte) string {\n\tn := bytes.IndexByte(value, 0)\n\tif n < 0 {\n\t\treturn \"\"\n\t}\n\n\treturn strn(value, n)\n}", "func (s ListViewsInput) String() string {\n\treturn awsutil.Prettify(s)\n}" ]
[ "0.63379955", "0.5909125", "0.58037746", "0.56420934", "0.56420934", "0.54916877", "0.54738015", "0.5430865", "0.5414218", "0.5414218", "0.53638655", "0.5337022", "0.53342456", "0.53323567", "0.52999586", "0.52574825", "0.52541006", "0.52512985", "0.5248777", "0.5213757", "0.51917297", "0.5171241", "0.51634866", "0.5157035", "0.5157035", "0.5156469", "0.513832", "0.51378185", "0.5128501", "0.5126863", "0.5126863", "0.51238745", "0.51109403", "0.5090268", "0.5090268", "0.5087596", "0.50620174", "0.50593096", "0.50425786", "0.5038153", "0.5014318", "0.5009089", "0.50069445", "0.50066686", "0.50066686", "0.50066686", "0.50066686", "0.49849522", "0.49833876", "0.49368206", "0.49290252", "0.49268696", "0.4926448", "0.49256456", "0.49154732", "0.49128085", "0.4911656", "0.49093148", "0.49093148", "0.49093148", "0.49093148", "0.49093148", "0.49093148", "0.49093148", "0.48981756", "0.4891384", "0.48910582", "0.48741093", "0.48418227", "0.48381555", "0.48381555", "0.48307803", "0.48296013", "0.48198634", "0.4815694", "0.4813439", "0.48025224", "0.47952625", "0.47882044", "0.47725397", "0.47717014", "0.4769885", "0.47630322", "0.47620183", "0.475038", "0.47329995", "0.47321823", "0.47314504", "0.47306818", "0.4728975", "0.4717342", "0.47094235", "0.47076365", "0.47069144", "0.47055426", "0.4696454", "0.46919572", "0.46919572", "0.4685944", "0.466918" ]
0.7783467
0
bytesView returns a view of the string as a []byte. In unsafe mode, it doesn't incur allocation and copying caused by conversion. In regular safe mode, it is an allocation and copy. Usage: Always maintain a reference to v while result of this call is in use, and call keepAlive4BytesView(v) at point where done with view.
bytesView возвращает представление строки в виде []byte. В режиме unsafe преобразование не вызывает выделение памяти и копирование. В обычном безопасном режиме это выделение и копирование. Использование: всегда сохраняйте ссылку на v во время использования результата этого вызова, и вызывайте keepAlive4BytesView(v) в точке, где работа с представлением завершена.
func bytesView(v string) []byte { return []byte(v) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func stringView(v []byte) string {\n\treturn string(v)\n}", "func NewView(b []byte) *View { return &View{b} }", "func GetBytesBuffer4K() *bytes.Buffer {\n\tif b := getb4K(); b != nil {\n\t\treturn b\n\t}\n\tif p := get4K(); p != nil {\n\t\treturn bytes.NewBuffer(internal.Puts(p))\n\t}\n\treturn bytes.NewBuffer(make([]byte, 4096))\n}", "func GetBytesBuffer4M() *bytes.Buffer {\n\tif b := getb4M(); b != nil {\n\t\treturn b\n\t}\n\tif p := get4M(); p != nil {\n\t\treturn bytes.NewBuffer(internal.Puts(p))\n\t}\n\treturn bytes.NewBuffer(make([]byte, 4194304))\n}", "func (v ByteVec) String() string { return string([]byte(v)) }", "func (b *SafeBuffer) Bytes() []byte {\n\tb.m.RLock()\n\tdefer b.m.RUnlock()\n\treturn b.b.Bytes()\n}", "func VVByte_to_string(m [][]byte) (*bytes.Buffer, *bytes.Buffer) {\n\n\tlg, b := loghttp.BuffLoggerUniversal(nil, nil)\n\t_ = b\n\n\tbRet := new(bytes.Buffer)\n\tbMsg := new(bytes.Buffer)\n\n\t//for i,v := range m {\n\tfor i := 0; i < len(m); i++ {\n\t\tn, err := bRet.Write(m[i])\n\t\tlg(err)\n\t\tbMsg.WriteString(\" lp\" + util.Itos(i) + \": writing \" + util.Itos(n) + \" bytes: \\n\")\n\t}\n\treturn bRet, bMsg\n}", "func ImmutableBytesFromString(s string) []byte {\n\tb := unsafe.StringData(s)\n\treturn unsafe.Slice(b, len(s))\n}", "func NewBytesViewer(from io.ReadCloser) (in io.ReadCloser) {\n\treturn &bytesViewer{from}\n}", "func (g *GLTF) loadBufferView(bvIdx int) ([]byte, error) {\n\n\t// Check if provided buffer view index is valid\n\tif bvIdx < 0 || bvIdx >= len(g.BufferViews) {\n\t\treturn nil, fmt.Errorf(\"invalid buffer view index\")\n\t}\n\tbvData := g.BufferViews[bvIdx]\n\t// Return cached if available\n\tif bvData.cache != nil {\n\t\tlog.Debug(\"Fetching BufferView %d (cached)\", bvIdx)\n\t\treturn bvData.cache, nil\n\t}\n\tlog.Debug(\"Loading BufferView %d\", bvIdx)\n\n\t// Load buffer view buffer\n\tbuf, err := g.loadBuffer(bvData.Buffer)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Establish offset\n\toffset := 0\n\tif bvData.ByteOffset != nil {\n\t\toffset = *bvData.ByteOffset\n\t}\n\n\t// Compute and return offset slice\n\tbvBytes := buf[offset : offset+bvData.ByteLength]\n\n\t// Cache buffer view\n\tg.BufferViews[bvIdx].cache = bvBytes\n\n\treturn bvBytes, nil\n}", "func BytesPtr(v []byte) *[]byte {\n\treturn &v\n}", "func StringToReadOnlyBytes(s string) []byte {\n\treturn []byte(s)\n}", "func zbuf(v Value) []byte {\n\ts := ToStr(v)\n\tbuf := make([]byte, len(s)+1)\n\tcopy(buf, s)\n\tbuf[len(s)] = 0\n\treturn buf\n}", "func rtBytes(rv reflect.Value) []byte {\n\t// Fastpath if the underlying type is []byte\n\tif rv.Kind() == reflect.Slice && rv.Type().Elem() == rtByte {\n\t\treturn rv.Bytes()\n\t}\n\t// Slowpath copying bytes one by one.\n\tret := make([]byte, rv.Len())\n\tfor ix := 0; ix < rv.Len(); ix++ {\n\t\tret[ix] = rv.Index(ix).Convert(rtByte).Interface().(byte)\n\t}\n\treturn ret\n}", "func (_ BufferPtrPool4K) Get() *[]byte {\n\treturn GetBytesSlicePtr4K()\n}", "func UnsafeStringBytes(s *string) []byte {\n\treturn *(*[]byte)(unsafe.Pointer((*reflect.SliceHeader)(unsafe.Pointer(s))))\n}", "func (b *buffer) bytes(n int) []byte {\n\tdata := b.unsafeBytes(n)\n\tif !b.shared {\n\t\treturn data\n\t}\n\t// TODO(kortschak): Replace this with bytes.Clone when available.\n\t// See https://github.com/golang/go/issues/45038 for bytes.Clone.\n\treturn append(data[:0:0], data...)\n}", "func StringToByteArray(v string) []byte {\n\tvar slcHdr reflect.SliceHeader\n\tsh := *(*reflect.StringHeader)(unsafe.Pointer(&v))\n\tslcHdr.Data = sh.Data\n\tslcHdr.Cap = sh.Len\n\tslcHdr.Len = sh.Len\n\treturn *(*[]byte)(unsafe.Pointer(&slcHdr))\n}", "func (b *buffer) unsafeBytes(n int) []byte {\n\tif b.err != nil {\n\t\treturn nil\n\t}\n\tif b.len() < n {\n\t\tb.err = io.ErrUnexpectedEOF\n\t\treturn nil\n\t}\n\ts := b.off\n\tb.off += n\n\treturn b.data[s:b.off]\n}", "func GetBytesSlice4M() []byte {\n\tif p := get4M(); p != nil {\n\t\treturn internal.Puts(p)\n\t}\n\tif b := getb4M(); b != nil {\n\t\treturn internal.Bb2bs(b)\n\t}\n\tp := make([]byte, 4194304)\n\treturn p\n}", "func BytePtr(v byte) *byte { return &v }", "func GetBytesSlice4K() []byte {\n\tif p := get4K(); p != nil {\n\t\treturn internal.Puts(p)\n\t}\n\tif b := getb4K(); b != nil {\n\t\treturn internal.Bb2bs(b)\n\t}\n\tp := make([]byte, 4096)\n\treturn p\n}", "func (b *Buffer) bytes() []byte {\n\treturn b.data\n}", "func GetBytesSlicePtr4M() *[]byte {\n\tif p := get4M(); p != nil {\n\t\treturn p\n\t}\n\tif b := getb4M(); b != nil {\n\t\tp := internal.Bb2bs(b)\n\t\treturn internal.Gets(p)\n\t}\n\tp := make([]byte, 4194304)\n\treturn &p\n}", "func (_ BufferPtrPool4M) Get() *[]byte {\n\treturn GetBytesSlicePtr4M()\n}", "func (v *Value) Bytes() []byte {\n switch d := v.data.(type) {\n case []byte:\n return d\n case string:\n return []byte(d)\n default:\n if j, e := json.Marshal(v.data); e == nil {\n return j\n }\n return []byte(fmt.Sprintf(\"%+v\", v.data))\n }\n}", "func GetBytesSlicePtr4K() *[]byte {\n\tif p := get4K(); p != nil {\n\t\treturn p\n\t}\n\tif b := getb4K(); b != nil {\n\t\tp := internal.Bb2bs(b)\n\t\treturn internal.Gets(p)\n\t}\n\tp := make([]byte, 4096)\n\treturn &p\n}", "func StringFromImmutableBytes(bs []byte) string {\n\tif len(bs) == 0 {\n\t\treturn \"\"\n\t}\n\treturn unsafe.String(&bs[0], len(bs))\n}", "func gostringnocopy(str *byte) string", "func (b *printer) UnsafeBytes(s []byte) {\n\tw := escapeWriter{w: &b.buf, enclose: true, strip: true}\n\t_, _ = w.Write(s)\n}", "func (b *Buffer) Bytes() []byte {\n\tb.m.RLock()\n\tbcpy := make([]byte, len(b.b.Bytes()))\n\tcopy(bcpy, b.b.Bytes())\n\tb.m.RUnlock()\n\treturn bcpy\n}", "func (s *scratch) bytes() []byte { return s.data[0:s.fill] }", "func (v Value) Bytes() []byte {\n\treturn v.bytes\n}", "func NewBufferBytes(data []byte) *Buffer {\n\treturn &Buffer{refCount: 0, buf: data, length: len(data)}\n}", "func StringBytes(b []byte) string { return *(*string)(Pointer(&b)) }", "func UnsafeStrToBytes(s string) []byte {\n\treturn unsafe.Slice(unsafe.StringData(s), len(s)) // ref https://github.com/golang/go/issues/53003#issuecomment-1140276077\n}", "func (b *Buffer) Bytes() []byte { return b.buf[:b.length] }", "func (s String) Bytes() []byte {\n\treturn []byte(s)\n}", "func (ip IP) v4(i uint8) uint8 {\n\treturn uint8(ip.lo >> ((3 - i) * 8))\n}", "func StringBytes(s string) []byte {\n\treturn *(*[]byte)(unsafe.Pointer(&s))\n}", "func (pk PacketBufferPtr) ToView() *buffer.View {\n\tp := buffer.NewView(int(pk.buf.Size()))\n\toffset := pk.headerOffset()\n\tpk.buf.SubApply(offset, int(pk.buf.Size())-offset, func(v *buffer.View) {\n\t\tp.Write(v.AsSlice())\n\t})\n\treturn p\n}", "func (b *Buffer) Bytes() []byte {\n\tswitch {\n\tcase b.written >= b.size && b.writeCursor == 0:\n\t\treturn b.data[b.offset:]\n\tcase b.written > b.size:\n\t\tout := make([]byte, b.size)\n\t\tcopy(out,\n\t\t\tb.data[b.offset+b.writeCursor:])\n\t\tcopy(out[b.size-b.writeCursor:],\n\t\t\tb.data[b.offset:b.offset+b.writeCursor])\n\t\treturn out\n\tdefault:\n\t\treturn b.data[b.offset : b.offset+b.writeCursor]\n\t}\n}", "func Str2bytes(s string) []byte {\n\tstringHeader := *(*[2]int)(unsafe.Pointer(&s))\n\tvar sliceHeader [3]int\n\tsliceHeader[0] = stringHeader[0]\n\tsliceHeader[1] = stringHeader[1]\n\tsliceHeader[2] = stringHeader[1]\n\treturn *(*[]byte)(unsafe.Pointer(&sliceHeader))\n}", "func (b *Buf) Bytes() []byte { return b.b }", "func InternBytes(b []byte) string {\n\ts := ToUnsafeString(b)\n\treturn InternString(s)\n}", "func InternBytes(b []byte) string {\n\ts := ToUnsafeString(b)\n\treturn InternString(s)\n}", "func (s String) ToBytes() []byte {\n\treturn []byte(s)\n}", "func bytesFromCBytes(size uint32, p *byte) []byte {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tif *p == 0 {\n\t\treturn nil\n\t}\n\ttmp := unsafe.Slice(p, size)\n\tout := make([]byte, len(tmp))\n\tcopy(out, tmp)\n\treturn out\n}", "func (o InstanceOutput) AccessIpV4() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.AccessIpV4 }).(pulumi.StringOutput)\n}", "func TestAuxUnsafeBytes(t *testing.T) {\n\tvar objBytesManaged = createObjectBytes(object)\n\tassert.Eq(t, 216, len(objBytesManaged))\n\tassert.Eq(t, 52, int(objBytesManaged[0]))\n\tassert.Eq(t, 51, int(objBytesManaged[57]))\n\n\t// get an unsafe copy (really just a pointer), as the the cursor would do\n\tvar unsafeBytes = getUnsafeBytes(objBytesManaged)\n\n\t// get a safe copy\n\tvar safeBytes = make([]byte, len(objBytesManaged))\n\tcopy(safeBytes, objBytesManaged)\n\n\t// at this point, they should all be the same\n\tassert.Eq(t, objBytesManaged, unsafeBytes)\n\tassert.NotEq(t, unsafe.Pointer(&objBytesManaged), unsafe.Pointer(&unsafeBytes))\n\tassert.Eq(t, unsafe.Pointer(&objBytesManaged[0]), unsafe.Pointer(&unsafeBytes[0]))\n\n\tassert.Eq(t, objBytesManaged, safeBytes)\n\tassert.NotEq(t, unsafe.Pointer(&objBytesManaged), unsafe.Pointer(&safeBytes))\n\n\t// now let's clear the object bytes, and check the copies\n\tclearBytes(&objBytesManaged)\n\tassert.Eq(t, 216, len(objBytesManaged))\n\tassert.Eq(t, 0, int(objBytesManaged[0]))\n\n\t// now we assert the unsafe bytes has changed if it wasn't supposed to\n\tassert.Eq(t, objBytesManaged, unsafeBytes)\n\n\t// but the safe copy is still the same\n\tassert.Eq(t, 52, int(safeBytes[0]))\n}", "func (a Address) Bytes() []byte { return a[:] }", "func (a Address) Bytes() []byte { return a[:] }", "func (b *SafeBuffer) String() string {\n\tb.m.RLock()\n\tdefer b.m.RUnlock()\n\treturn b.b.String()\n}", "func (b *Buffer) Bytes() []byte {\n\treturn b.bytes[0:b.length]\n}", "func (addr *Bytes) Load() (val []byte) {\n\tv := addr.v.Load()\n\tif v == nil {\n\t\treturn nil\n\t}\n\treturn v.([]byte)\n}", "func string2bytes(s string) []byte {\n\tstringHeader := (*reflect.StringHeader)(unsafe.Pointer(&s))\n\n\tbh := reflect.SliceHeader{\n\t\tData: stringHeader.Data,\n\t\tLen: stringHeader.Len,\n\t\tCap: stringHeader.Len,\n\t}\n\n\treturn *(*[]byte)(unsafe.Pointer(&bh))\n}", "func StringBytes(s string) []byte {\n\treturn []byte(s)\n}", "func (h *RequestHeader) SetBytesV(key string, value []byte) {\n\tk := getHeaderKeyBytes(&h.bufKV, key, h.disableNormalizing)\n\th.SetCanonical(k, value)\n}", "func StringToBytes(str string) []byte {\n\t// Empty strings may not allocate a backing array, so we have to check first\n\tif len(str) == 0 {\n\t\t// It makes sense to return a non-nil empty byte slice since we're passing in a non-nil (although empty) string\n\t\treturn []byte{}\n\t}\n\treturn (*[0x7fff0000]byte)(unsafe.Pointer(\n\t\t(*reflect.StringHeader)(unsafe.Pointer(&str)).Data),\n\t)[:len(str):len(str)]\n}", "func NewBytesBuffer(p []byte) *BytesBuffer {\n\treturn &BytesBuffer{reader: bytes.NewReader(p)}\n}", "func ReadOnlyBytes(s string) []byte {\n\tsh := (*reflect.StringHeader)(unsafe.Pointer(&s))\n\tbh := reflect.SliceHeader{Data: sh.Data, Len: sh.Len, Cap: sh.Len}\n\treturn *(*[]byte)(unsafe.Pointer(&bh))\n}", "func (a *DatumAlloc) NewDBytes(v tree.DBytes) *tree.DBytes {\n\tif a.AllocSize == 0 {\n\t\ta.AllocSize = defaultDatumAllocSize\n\t}\n\tbuf := &a.dbytesAlloc\n\tif len(*buf) == 0 {\n\t\t*buf = make([]tree.DBytes, a.AllocSize)\n\t}\n\tr := &(*buf)[0]\n\t*r = v\n\t*buf = (*buf)[1:]\n\treturn r\n}", "func(this *GView) Get() interface{} {\nif this == nil {\n\treturn nil\n} else {\n\tbuffer := make([]byte, 2048)\n\t\ttempString := \"\"\n\t\tn, _ := this.inOut.Read(buffer)\n\t\tfor {\n\t\t\ttemp := (string) (buffer[0:n])\n\t\t\ttempString = tempString + temp\n\t\t\tif n < 2048 { return tempString }\n\t\t\tn, _ = this.inOut.Read(buffer)\n\t\t}\n\t\treturn tempString\n\t}\nreturn \"\"\n}", "func (b *Blockstore) View(cid cid.Cid, fn func([]byte) error) error {\n\tif atomic.LoadInt64(&b.state) != stateOpen {\n\t\treturn ErrBlockstoreClosed\n\t}\n\n\tk, pooled := b.PooledStorageKey(cid)\n\tif pooled {\n\t\tdefer KeyPool.Put(k)\n\t}\n\n\treturn b.DB.View(func(txn *badger.Txn) error {\n\t\tswitch item, err := txn.Get(k); err {\n\t\tcase nil:\n\t\t\treturn item.Value(fn)\n\t\tcase badger.ErrKeyNotFound:\n\t\t\treturn blockstore.ErrNotFound\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"failed to view block from badger blockstore: %w\", err)\n\t\t}\n\t})\n}", "func BytesValue(b []byte) Value { return Value{Typ: '$', Str: b} }", "func (p *Buffer) Bytes() []byte { return p.buf }", "func (f *FileList) ToLevelViewBytes(pad string) []byte {\n\treturn []byte(f.ToLevelView(pad, false))\n}", "func UnsafeStrToBytes(s string) []byte {\n\treturn *(*[]byte)(unsafe.Pointer(&s))\n}", "func UnsafeStrToBytes(s string) []byte {\n\treturn *(*[]byte)(unsafe.Pointer(&s))\n}", "func (b *Vector) ByteSlice(off VOffsetT, s []byte) VField {\n\tb.VOffset = off\n\n\tb.t = FieldTypeByteSlice\n\tb.objectSize = len(s)\n\n\tpad, total := Prepad(int(SizeUOffsetT), (b.objectSize+1)*SizeByte)\n\n\tif b.b == nil {\n\t\tb.b = bytepool.NewByteBuffer(64)\n\t}\n\tb.b.Reset(total + SizeSOffsetT).Pad(pad)\n\n\tfor i := 0; i < pad; i++ {\n\t\tWriteByte(b.b.B[int(b.head)+i+b.objectSize:int(b.head)+i+b.objectSize+1], uint8(0))\n\t}\n\tcopy(b.b.B[b.head:], s)\n\tb.EndVector(b.objectSize)\n\tb.finished = true\n\n\treturn b\n}", "func byteReverseIP4(ip net.IP) (revip revIP4) {\n\n\tfor j := 0; j < len(ip); j++ {\n\t\trevip.Byte[len(ip)-j-1] = ip[j]\n\t\trevip.String = fmt.Sprintf(\"%d.%s\", ip[j], revip.String)\n\t}\n\n\trevip.String = strings.TrimRight(revip.String, \".\")\n\n\treturn\n}", "func GoEcho4(s *C.char, length C.int) (unsafe.Pointer, int) {\n\tslice := C.GoBytes(unsafe.Pointer(s), length)\n\tslice = append(slice, \" from golang4\"...)\n\treturn unsafe.Pointer(&(slice[0])), len(slice)\n}", "func (addr DevAddr) Bytes() []byte {\n\treturn addr[:]\n}", "func (b *Blockstore) View(cid cid.Cid, fn func([]byte) error) error {\n\tswitch v, err := b.DB.Get(cid.Hash(), nil); err {\n\tcase nil:\n\t\treturn fn(v)\n\tcase leveldb.ErrNotFound:\n\t\treturn blockstore.ErrNotFound\n\tdefault:\n\t\treturn fmt.Errorf(\"failed to view block from leveldb blockstore: %w\", err)\n\t}\n}", "func (v Value) Bytes() []byte {\n\tswitch v.Typ {\n\tdefault:\n\t\treturn []byte(v.String())\n\tcase '$', '+', '-':\n\t\treturn v.Str\n\t}\n}", "func string2ByteSlice(str string) (bs []byte) {\n\tstrHdr := (*reflect.StringHeader)(unsafe.Pointer(&str))\n\tsliceHdr := (*reflect.SliceHeader)(unsafe.Pointer(&bs))\n\tsliceHdr.Data = strHdr.Data\n\tsliceHdr.Len = strHdr.Len\n\tsliceHdr.Cap = strHdr.Len\n\t// This KeepAlive line is essential to make the\n\t// String2ByteSlice function be always valid\n\t// when it is provided in other custom packages.\n\truntime.KeepAlive(&str)\n\treturn\n}", "func UnsafeBytesToStr(b []byte) string {\n\treturn *(*string)(unsafe.Pointer(&b))\n}", "func UnsafeBytesToStr(b []byte) string {\n\treturn *(*string)(unsafe.Pointer(&b))\n}", "func UnsafeBytesToStr(b []byte) string {\n\treturn *(*string)(unsafe.Pointer(&b))\n}", "func (vl BytesValue) String() string {\n\treturn Buffer.BytesToHexString(vl)\n}", "func (vl BytesValue) String() string {\n\treturn Buffer.BytesToHexString(vl)\n}", "func (d PacketData) AppendView(v *buffer.View) {\n\td.pk.buf.Append(v)\n}", "func NewVersionUnsafe(str string) Version {\n\tv, _ := NewVersion(str)\n\treturn v\n}", "func (addr BitcoinAddress) Bytes() []byte {\n\tb := make([]byte, 20+1+4)\n\tb[0] = addr.Version\n\tcopy(b[1:21], addr.Key[0:20])\n\tchksum := addr.Checksum()\n\tcopy(b[21:25], chksum[0:4])\n\treturn b\n}", "func (d *Document) Bytes() *bytes.Buffer {\n\tbuf := new(bytes.Buffer)\n\tbinary.Write(buf, binary.LittleEndian, d.id)\n\tbinary.Write(buf, binary.LittleEndian, d.length)\n\tbinary.Write(buf, binary.LittleEndian, uint32(len(d.path)))\n\tbinary.Write(buf, binary.LittleEndian, []byte(d.path))\n\treturn buf\n}", "func (v *View) String() string {\n\tf := format.NewASCII()\n\treturn v.FormatString(f)\n}", "func StringFromBytes(b []byte) String {\n\treturn StringFromString(string(b))\n}", "func bytesToString(bs []byte) string {\n\treturn *(*string)(unsafe.Pointer(&bs))\n}", "func (_ BufferPtrPool16K) Get() *[]byte {\n\treturn GetBytesSlicePtr16K()\n}", "func StringOrBytes(value interface{}) (isString bool, str string, isBytes bool, bs []byte) {\n\tv := reflect.ValueOf(value)\n\tif v.Kind() == reflect.String {\n\t\tstr = v.String()\n\t\tisString = true\n\t} else if v.Kind() == reflect.Slice && v.Type() == bytesType {\n\t\tbs = v.Interface().([]byte)\n\t\tisBytes = true\n\t}\n\treturn\n}", "func Byte(v byte) *byte {\n\treturn &v\n}", "func Byte(v byte) *byte {\n\treturn &v\n}", "func BytesToString(b []byte) string { return *(*string)(unsafe.Pointer(&b)) }", "func (u UUID) Bytes() []byte {\n\treturn u[:]\n}", "func (u UUID) Bytes() []byte {\n\treturn u[:]\n}", "func (v Version) ToBytes() []byte {\n\treturn []byte{\n\t\tv.Major,\n\t\tv.Minor,\n\t\tv.Patch,\n\t}\n}", "func BytesString(b []byte) string {\n\treturn *(*string)(unsafe.Pointer(&b))\n}", "func (w *ByteWriter) Bytes() []byte { return w.buffer }", "func (p *parser) VisitBytes(ctx *gen.BytesContext) any {\n\tb := []byte(p.unquote(ctx, ctx.GetTok().GetText()[1:], true))\n\treturn p.helper.newLiteralBytes(ctx, b)\n}", "func (_ BufferPtrPool8K) Get() *[]byte {\n\treturn GetBytesSlicePtr8K()\n}" ]
[ "0.6358887", "0.5210643", "0.47978938", "0.47844735", "0.47593164", "0.46141908", "0.4609627", "0.46013665", "0.45809", "0.4562257", "0.45536464", "0.4526796", "0.45103198", "0.45092463", "0.4495565", "0.4488356", "0.4468821", "0.4467235", "0.4460009", "0.44589624", "0.44351736", "0.4425497", "0.44014257", "0.4387796", "0.43523282", "0.43463168", "0.43428335", "0.43372566", "0.43088296", "0.43083033", "0.43079248", "0.4279778", "0.42766464", "0.42753237", "0.42674583", "0.4248836", "0.4247261", "0.41997856", "0.41996855", "0.41893035", "0.4187981", "0.41723266", "0.4172011", "0.41635853", "0.41634792", "0.41634792", "0.4158446", "0.41492963", "0.41364914", "0.41281646", "0.41229627", "0.41229627", "0.41228908", "0.41170776", "0.41141525", "0.41110376", "0.41009763", "0.40969053", "0.40948114", "0.40840673", "0.40789115", "0.40767977", "0.40703654", "0.40618962", "0.40480104", "0.40436652", "0.4042615", "0.40380874", "0.40380874", "0.4035087", "0.40312266", "0.4024979", "0.40079352", "0.40065864", "0.4005098", "0.40002123", "0.39985725", "0.39985725", "0.39985725", "0.39946908", "0.39946908", "0.39946294", "0.3983998", "0.39821574", "0.39780796", "0.39743307", "0.3971957", "0.3971725", "0.3966956", "0.39627025", "0.3957349", "0.3957349", "0.3956155", "0.39548343", "0.39548343", "0.3951219", "0.39452186", "0.394118", "0.39378616", "0.39325857" ]
0.75592566
0
Subscribe will create a channel that will be published to each time a change on ONE partition changes
Subscribe создаст канал, который будет публиковаться каждый раз, когда изменится одна из партиций
func (n *Node) Subscribe(topic string) <-chan Message { consumer := make(chan Message) parts := n.getPartitionsFor(topic) var part partition for _, p := range parts { part = smallestOf(part, p) } log.Debug("Created subscriber for %s:%v", topic, part) part.Subscribe(consumer) return consumer }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c Conference) Subscribe(id uuid.UUID, topic string, out chan Notification) {\n\ttree, ok := c.Room[topic]\n\tif !ok {\n\t\ttree = &bst.BinarySearchTree{}\n\t\tc.Room[topic] = tree\n\t}\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\ttree.Add(NewSubscriber(id, out))\n}", "func (h *Hub) Subscribe(t string, c chan []byte) {\n\th.Lock()\n\tdefer h.Unlock()\n\tchans, ok := h.topicChans[t]\n\tif !ok {\n\t\tchans = make(map[chan []byte]struct{})\n\t\th.topicChans[t] = chans\n\t}\n\tchans[c] = struct{}{}\n\ttopics, ok := h.chanTopics[c]\n\tif !ok {\n\t\ttopics = make(map[string]struct{})\n\t\th.chanTopics[c] = topics\n\t}\n\ttopics[t] = struct{}{}\n}", "func (eb *EventBus) Subscribe(topic string, ch DataChannel) {\n\teb.rm.Lock()\n\tif prev, found := eb.subscribers[topic]; found {\n\t\teb.subscribers[topic] = append(prev, ch)\n\t} else {\n\t\teb.subscribers[topic] = append([]DataChannel{}, ch)\n\t}\n\teb.rm.Unlock()\n}", "func (t *Topic) Subscribe(ctx context.Context) <-chan interface{} {\n\tch := make(chan interface{})\n\tt.subs[ch] = ctx\n\treturn ch\n}", "func (r *reconciler) subscribeToBrokerChannel(ctx context.Context, t *v1alpha1.Trigger, brokerTrigger, brokerIngress *v1alpha1.Channel, svc *corev1.Service) (*v1alpha1.Subscription, error) {\n\turi := &url.URL{\n\t\tScheme: \"http\",\n\t\tHost: names.ServiceHostName(svc.Name, svc.Namespace),\n\t\tPath: path.Generate(t),\n\t}\n\texpected := resources.NewSubscription(t, brokerTrigger, brokerIngress, uri)\n\n\tsub, err := r.getSubscription(ctx, t)\n\t// If the resource doesn't exist, we'll create it\n\tif k8serrors.IsNotFound(err) {\n\t\tsub = expected\n\t\terr = r.client.Create(ctx, sub)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn sub, nil\n\t} else if err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Update Subscription if it has changed. Ignore the generation.\n\texpected.Spec.DeprecatedGeneration = sub.Spec.DeprecatedGeneration\n\tif !equality.Semantic.DeepDerivative(expected.Spec, sub.Spec) {\n\t\t// Given that spec.channel is immutable, we cannot just update the Subscription. We delete\n\t\t// it and re-create it instead.\n\t\terr = r.client.Delete(ctx, sub)\n\t\tif err != nil {\n\t\t\tlogging.FromContext(ctx).Info(\"Cannot delete subscription\", zap.Error(err))\n\t\t\tr.recorder.Eventf(t, corev1.EventTypeWarning, subscriptionDeleteFailed, \"Delete Trigger's subscription failed: %v\", err)\n\t\t\treturn nil, err\n\t\t}\n\t\tsub = expected\n\t\terr = r.client.Create(ctx, sub)\n\t\tif err != nil {\n\t\t\tlogging.FromContext(ctx).Info(\"Cannot create subscription\", zap.Error(err))\n\t\t\tr.recorder.Eventf(t, corev1.EventTypeWarning, subscriptionCreateFailed, \"Create Trigger's subscription failed: %v\", err)\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn sub, nil\n}", "func (channel Channel) subscribe(observers ...Observer) {\n\tchannel.checkChannelMap()\n\tfor _, observer := range observers {\n\t\tchannel.observers[observer.id] = observer\n\t\tfmt.Printf(\"New observer %s subscribed in channel %s \\n\", observer.id, channel.id)\n\t}\n}", "func (hc *Conn) Subscribe(topic string) {\n\thc.parent.subscribe <- subscription{topic, hc}\n}", "func (s *Cluster) NotifySubscribe(conn security.ID, ssid subscription.Ssid) {\n\tevent := SubscriptionEvent{\n\t\tPeer: s.name,\n\t\tConn: conn,\n\t\tSsid: ssid,\n\t}\n\n\t// Add to our global state\n\ts.state.Add(event.Encode())\n\t// Create a delta for broadcasting just this operation\n\top := newSubscriptionState()\n\top.Add(event.Encode())\n\ts.gossip.GossipBroadcast(op)\n}", "func SubscribeChannel(socket *websocket.Conn) {\n\tfmt.Printf(\"Subscribed channel by: %#v\\n\", socket)\n\n\t// TODO: query rethinkDB with the feature: changefeed,\n\t// it'll look up initial channels, then keep\n\t// blocking and waiting for channel changes such as ADD, REMOVE, or EDIT\n\tfor {\n\t\ttime.Sleep(time.Second * 1)\n\n\t\tmsg := models.Message{\n\t\t\t\"channel add\",\n\t\t\tmodels.Channel{\"1\", \"Software Support\"}}\n\t\tsocket.WriteJSON(msg)\n\t\tfmt.Println(\"sent newly added channel.\")\n\t}\n}", "func (psc *PubSubChannel) Subscribe() *Subscription {\n psc.subsMutex.Lock()\n defer psc.subsMutex.Unlock()\n newSubscription := newSubscription(strconv.Itoa(psc.nextId))\n psc.nextId++\n psc.subscriptions = append(psc.subscriptions, &newSubscription)\n newSubscription.removeSub = func() {\n psc.subsMutex.Lock()\n defer psc.subsMutex.Unlock()\n\n for i, subscription := range psc.subscriptions {\n if subscription.signal == newSubscription.signal {\n fmt.Println(\"Unsubscribing\", \"id\", subscription.id)\n subscription.closed = true\n psc.subscriptions = append(psc.subscriptions[:i], psc.subscriptions[i+1:]...)\n }\n }\n }\n return &newSubscription\n}", "func (p RPCServer) Subscribe(ctx context.Context, in *pb.SubscriptionRequest) (*pb.Subscription, error) {\n\tsubID := *p.currentSubID\n\t*p.currentSubID++\n\n\tlogrus.WithField(\"topic\", in.Topic).WithField(\"subID\", subID).Debug(\"subscribed to new messages\")\n\n\tp.subChannels[subID] = make(chan []byte)\n\tp.cancelChannels[subID] = make(chan bool)\n\n\ts, err := p.service.RegisterHandler(in.Topic, func(b []byte) error {\n\t\tselect {\n\t\tcase p.subChannels[subID] <- b:\n\t\tdefault:\n\t\t}\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp.subscriptions[subID] = s\n\n\treturn &pb.Subscription{ID: subID}, nil\n}", "func (k *KafkaBroker) Subscribe(topic string, output chan<- Message, offset int64) (err error) {\n\tconsumer, err := sarama.NewConsumerFromClient(k.Client)\n\n\tif err != nil {\n\t\tpanic(\"Got an error while trying to create a consumer: \" + err.Error())\n\t}\n\n\tconn, err := consumer.ConsumePartition(\n\t\ttopic,\n\t\t0,\n\t\toffset, // Start from the next unread message\n\t)\n\n\tif err != nil {\n\t\tpanic(\"Got an error while trying to consume a partition: \" + err.Error())\n\t}\n\n\tgo func() {\n\t\tfor msg := range conn.Messages() {\n\t\t\toutput <- Message{\n\t\t\t\tKey: msg.Key,\n\t\t\t\tValue: msg.Value,\n\t\t\t\tOffset: msg.Offset,\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn err\n}", "func (d StaticAgentDiscovery) Subscribe(c chan<- []string) { go func() { c <- d }() }", "func (n *notifier) Subscribe(ch chan<- []Update) {\n\tn.mu.Lock()\n\tdefer n.mu.Unlock()\n\tn.subs = append(n.subs, ch)\n}", "func Subscribe(topic string) (<-chan []byte, error) {\n\treturn Default.Subscribe(topic)\n}", "func (p *pahoClient) Subscribe(c chan error, topic string, qos uint8, callback CallbackHandler) {\n\thandler := func(i paho.Client, message paho.Message) {\n\t\tlog.Printf(\"RECEIVED - Topic: %s, Message Length: %d bytes\", message.Topic(), len(message.Payload()))\n\t\tif callback != nil {\n\t\t\tcallback(context.Background(), topic, p.clientID, message.Payload())\n\t\t}\n\t}\n\ttoken := p.client.Subscribe(topic, qos, handler)\n\tc <- p.waitForToken(token)\n}", "func (s *Subscription) Subscribe(channels ...string) {\n\tif len(channels) < 1 {\n\t\treturn\n\t}\n\n\ts.broker.dataChan <- &envData{false, &envSubscription{true, s, channels}, nil}\n}", "func (s *SyncStorage) SubscribeChannel(ns string, cb func(string, ...string), channels ...string) error {\n\tnsPrefix := getNsPrefix(ns)\n\treturn s.getDbBackend(ns).SubscribeChannelDB(cb, s.setNamespaceToChannels(nsPrefix, channels...)...)\n}", "func Subscribe(conn net.Conn, command []string, pubsub *PubSub) {\n\n\tfmt.Println(\"SUBSCRIBE TO:\", command[1:])\n\n\tch := make(chan string)\n\n\tdefer func() {\n\t\tconn.Close()\n\t\tpubsub.Unsubscribe <- UnsubscribeEvent{command[1], ch}\n\t}()\n\n\tpubsub.Subscribe <- SubscribeEvent{command[1], ch}\n\n\tfor msg := range ch {\n\t\t//fmt.Fprintf(conn, \"%s\\n\", msg)\n\t\t_, err := conn.Write([]byte(msg + \"\\n\"))\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n}", "func (h *hub) Subscribe(name, topic string, lease time.Duration) (<-chan Message, error) {\n\tselect {\n\tcase <-h.root.ctx.Done():\n\t\treturn nil, errors.New(\"Cannot subscribe to a closed hub.\");\n\tdefault:\n\t}\n\n\tdeadline := time.Now().Add(lease)\n\tcomm := make(chan Message)\n\tvar expandedTopic []string\n\n\tif topic == rootName {\n\t\texpandedTopic = []string{rootName}\n\t} else {\n\t\texpandedTopic = strings.Split(topic, topicDelimeter)\n\t}\n\n\th.sub <- &subscription{\n\t\tTopic: expandedTopic,\n\t\tName: name,\n\t\tDeadline: deadline,\n\t\tClient: comm,\n\t}\n\n\treturn comm, nil\n}", "func (repo *feedRepository) Subscribe(f *feed.Feed, channelname string) error {\n\t_, err := repo.db.Exec(`\n\t\tINSERT INTO feed_subscriptions (feed_id,channel_username)\n\t\tVALUES ($1, $2)\n\t\tON CONFLICT DO NOTHING\n\t\t`, f.ID, channelname)\n\tconst foreignKeyViolationErrorCode = pq.ErrorCode(\"23503\")\n\tif err != nil {\n\t\tif pgErr, isPGErr := err.(pq.Error); !isPGErr {\n\t\t\tif pgErr.Code != foreignKeyViolationErrorCode {\n\t\t\t\treturn feed.ErrChannelNotFound\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"insertion of user failed because of: %s\", err.Error())\n\t\t}\n\t}\n\treturn nil\n}", "func (ks *KafkaStream) Subscribe(close chan struct{}) (<-chan Event, error) {\n\t// Capture current state of stream for use throughout this connection\n\ttopic := ks.config.Topic\n\toffset := ks.config.Offset\n\tstreamPartitions, err := ks.consumer.Partitions(topic)\n\t// Set up return channel for subscription events\n\tevents := make(chan Event, ks.config.SubscribeBufferSize)\n\tif err != nil {\n\t\treturn events, err\n\t}\n\t// Start subscription to stream in background\n\tgo func() {\n\t\t// For each partition in the stream set up a consumer to subscribe to messages\n\t\t// published to that partition\n\t\tfor _, partition := range streamPartitions {\n\t\t\tpartitionConsumer, err := ks.consumer.ConsumePartition(topic, partition, offset)\n\t\t\tif err != nil {\n\t\t\t\tks.logger.Errorf(\"Subscribe: Error %s to starting consumer for partition %d\", partition, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Start goroutine to run until the close channel is closed by the caller\n\t\t\tgo func(partitionConsumer sarama.PartitionConsumer) {\n\t\t\t\t<-close\n\t\t\t\tks.logger.Debug(\"Subscribe: Received close signal\")\n\t\t\t\t// at which point the connection to this partition consumer should be closed\n\t\t\t\tpartitionConsumer.AsyncClose()\n\t\t\t}(partitionConsumer)\n\t\t\t// Start goroutine to run until the close channel is closed by the caller\n\t\t\tgo func(partitionConsumer sarama.PartitionConsumer) {\n\t\t\t\t// to consume and convert messages for the subscriber to receive\n\t\t\t\tfor message := range partitionConsumer.Messages() {\n\t\t\t\t\tevent := convertMessageToEvent(message, topic)\n\t\t\t\t\tks.logger.Debugf(\"Subscribe: Received event %+v\", event)\n\t\t\t\t\tevents <- event\n\t\t\t\t}\n\t\t\t}(partitionConsumer)\n\t\t}\n\t}()\n\n\treturn events, nil\n}", "func (kew *KeyspaceEventWatcher) Subscribe() chan *KeyspaceEvent {\n\tkew.subsMu.Lock()\n\tdefer kew.subsMu.Unlock()\n\tc := make(chan *KeyspaceEvent, 2)\n\tkew.subs[c] = struct{}{}\n\treturn c\n}", "func (ps *PubSub) Subscribe(channel ...interface{}) error {\n\tps.conn.Send(\"SUBSCRIBE\", channel...)\n\treturn ps.conn.Flush()\n}", "func (cg *CandlesGroup) subscribe() {\n\tfor _, symb := range cg.symbols {\n\t\tmessage := candlesSubsMessage{\n\t\t\tEvent: eventSubscribe,\n\t\t\tChannel: \"candles\",\n\t\t\tKey: \"trade:1m:t\" + strings.ToUpper(symb.OriginalName),\n\t\t}\n\n\t\tif err := cg.wsClient.Write(message); err != nil {\n\t\t\tlog.Printf(\"[BITFINEX] Error subsciring to %v candles\", symb.Name)\n\t\t\tcg.restart()\n\t\t\treturn\n\t\t}\n\t}\n\tlog.Println(\"[BITFINEX] Subscription ok\")\n}", "func (ps *PubSub) Subscribe(conn Conn, channel string) {\n\tps.subscribe(conn, false, channel)\n}", "func (c *Easee) subscribe(client signalr.Client) {\n\tstateC := make(chan signalr.ClientState, 1)\n\t_ = client.ObserveStateChanged(stateC)\n\n\tgo func() {\n\t\tfor state := range stateC {\n\t\t\tif state == signalr.ClientConnected {\n\t\t\t\tif err := <-client.Send(\"SubscribeWithCurrentState\", c.charger, true); err != nil {\n\t\t\t\t\tc.log.ERROR.Printf(\"SubscribeWithCurrentState: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n}", "func (p *Peer) subscribeSync(po int) {\n\terr := subscriptionFunc(p.streamer, p.ID(), uint8(po))\n\tif err != nil {\n\t\tlog.Error(\"subscription\", \"err\", err)\n\t}\n}", "func (hubPtr *Hub) Subscribe(sink chan<- accounts.WalletEvent) event.Subscription {\n\t// We need the mutex to reliably start/stop the update loop\n\thubPtr.stateLock.Lock()\n\tdefer hubPtr.stateLock.Unlock()\n\n\t// Subscribe the Called and track the subscriber count\n\tsub := hubPtr.updateScope.Track(hubPtr.updateFeed.Subscribe(sink))\n\n\t// Subscribers require an active notification loop, start it\n\tif !hubPtr.updating {\n\t\thubPtr.updating = true\n\t\tgo hubPtr.updater()\n\t}\n\treturn sub\n}", "func (s *Store) Subscribe(id string, up chan uint64) {\n\ts.subs = append(s.subs, subscription{id: id, ch: up})\n}", "func (eb *EventBus) Subscribe(topic string, ch chan<- Event) {\n\teb.rm.Lock()\n\n\tif prev, found := eb.subscribers[topic]; found {\n\t\teb.subscribers[topic] = append(prev, ch)\n\t} else {\n\t\teb.subscribers[topic] = append([]chan<- Event{}, ch)\n\t}\n\n\teb.rm.Unlock()\n}", "func (node *Node) Subscribe(ctx context.Context, project string) error {\n\tif !node.IsOnline() {\n\t\treturn ErrOffline\n\t}\n\tsub, err := node.sh.PubSubSubscribe(project)\n\tif err != nil {\n\t\treturn err\n\t}\n\tnode.subscription = sub\n\tnode.project = project\n\treturn nil\n}", "func (c Client) Subscribe(channel string, market string) error {\n\n\tdata := ws.Message{\n\t\tBaseOperation: ws.BaseOperation{\n\t\t\tOp: \"subscribe\",\n\t\t},\n\t\tArgs: []string{},\n\t}\n\n\tmessage, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.ws.WriteMessage(1, message)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *Client) Subscribe(topic string, callback SubscriptionCallback) error {\n\tif c.connected == false {\n\t\treturn ErrNotConnected\n\t}\n\n\tbuff := bytes.NewBuffer(make([]byte, 0, 1+4+len(topic)))\n\n\terr := buff.WriteByte(SUBSCRIBE)\n\tif err != nil {\n\t\tfmt.Println(\"error writing packet type\")\n\t\treturn err\n\t}\n\n\terr = binary.Write(buff, binary.LittleEndian, uint32(len(topic)))\n\tif err != nil {\n\t\tfmt.Println(\"error writing topic length\")\n\t\treturn err\n\t}\n\n\t_, err = buff.WriteString(topic)\n\tif err != nil {\n\t\tfmt.Println(\"error writing topic data\")\n\t\treturn err\n\t}\n\n\tif callback != nil {\n\t\tc.subs[topic] = callback\n\t}\n\n\tbuff.WriteTo(c.conn)\n\n\treturn nil\n}", "func subscribe(t *testing.T, con *websocket.Conn, eventid string) {\n\terr := con.WriteJSON(rpctypes.RPCRequest{\n\t\tJSONRPC: \"2.0\",\n\t\tID: \"\",\n\t\tMethod: \"subscribe\",\n\t\tParams: []interface{}{eventid},\n\t})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "func (psc *PubSubChannel) Publish(msg interface{}) {\n psc.subsMutex.RLock()\n defer psc.subsMutex.RUnlock()\n for i, sub := range psc.subscriptions {\n if sub.closed {\n fmt.Println(\"Subscription was closed\", \"id\", sub.id)\n sub.closeChannel()\n } else {\n go func(sub *Subscription, index int) {\n sub.signal <- msg\n }(sub, i)\n\n }\n }\n}", "func (s *RedisStore) Subscribe(channel string, callback func(notifier.Notification)) error {\n\tpubsub := s.Client.Subscribe(channel)\n\tdefer pubsub.Close()\n\n\tfor {\n\t\tv, err := pubsub.ReceiveMessage()\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Debug(\"An error occurred when getting the message\")\n\t\t\treturn err\n\t\t}\n\t\tnotification := notifier.Notification{}\n\t\tif marshallErr := json.Unmarshal([]byte(v.Payload), &notification); marshallErr != nil {\n\t\t\tlog.WithError(marshallErr).Error(\"Unmarshalling message body failed, malformed\")\n\t\t\treturn marshallErr\n\t\t}\n\t\tcallback(notification)\n\t}\n}", "func (this *Publisher) Subscribe() <-chan gopi.Event {\n\tthis.Lock()\n\tdefer this.Unlock()\n\n\t// Create channels with a capacity of one\n\tif this.channels == nil {\n\t\tthis.channels = make([]chan gopi.Event, 0, 1)\n\t}\n\t// Return a new channel\n\tchannel := make(chan gopi.Event)\n\tthis.channels = append(this.channels, channel)\n\treturn channel\n}", "func (t *Topic) Subscribe(cb *func(interface{})) {\n\tt.subs = append(t.subs, cb)\n}", "func subscribe(topic string) (<-chan *mqttTypes.Publish, error) {\n\tlog.Printf(\"[DEBUG] subscribe - Subscribing to topic %s\\n\", topic)\n\tsubscription, error := cbBroker.client.Subscribe(topic, cbBroker.qos)\n\tif error != nil {\n\t\tlog.Printf(\"[ERROR] subscribe - Unable to subscribe to topic: %s due to error: %s\\n\", topic, error.Error())\n\t\treturn nil, error\n\t}\n\n\tlog.Printf(\"[DEBUG] subscribe - Successfully subscribed to = %s\\n\", topic)\n\treturn subscription, nil\n}", "func Sub(c mqtt.Client, topic string) {\n\tvar choke = make(chan [2]string)\n\n\tvar f mqtt.MessageHandler = func(client mqtt.Client, msg mqtt.Message) {\n\t\tchoke <- [2]string{msg.Topic(), string(msg.Payload())}\n\t}\n\tfor {\n\t\tif token := c.Subscribe(topic, 0, f); token.Wait() && token.Error() != nil {\n\t\t\tmqtt.ERROR.Println(token.Error())\n\t\t\tos.Exit(1)\n\t\t}\n\t\tfor {\n\t\t\tincoming := <-choke\n\t\t\tmqtt.ERROR.Printf(\"Received:TOPIC: %s\\n\", incoming[0])\n\t\t\twriteFile(incoming[1])\n\t\t}\n\t}\n\n}", "func (tc *consumer) Subscribe(topics map[string]int64) error {\n\tfor topic := range topics {\n\t\tif _, exists := tc.subscribedTopics[topic]; exists {\n\t\t\tlogger.Printf(\"consumer for %s already exists. This is strange\", topic)\n\t\t}\n\t\tlogger.Printf(\"Subscribe %s\", topic)\n\t\ttc.subscribedTopics[topic] = tc.tester.getOrCreateQueue(topic).bindConsumer(tc, true)\n\t\ttc.subscribedTopics[topic].rebalance()\n\t\ttc.subscribedTopics[topic].startLoop(false)\n\t}\n\treturn nil\n}", "func (l *Logs) Subscribe(uuid string) (\n\tchan []byte, chan []byte, error,\n) {\n\tlogChan, err := l.GetChannel(uuid)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tschan, echan := messaging.CreateSubscriptionChannels()\n\tl.nub.Subscribe(logChan, \"\", schan, false, echan)\n\treturn schan, echan, nil\n\n}", "func (m *Module) Subscribe(ctx context.Context, topic string) (<-chan *redis.Message, error) {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\n\t// Check if subscription already exists. Return corresponding channel if it does.\n\tif sub, p := m.mapping[topic]; p {\n\t\treturn sub.ch, nil\n\t}\n\n\t// Make a redis subscription\n\tpubsub := m.client.Subscribe(context.TODO(), m.getTopicName(topic))\n\tif _, err := pubsub.Receive(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Make a channel to listen for subscriptions\n\tch := pubsub.Channel()\n\tm.mapping[topic] = &subscription{ch, pubsub}\n\treturn ch, nil\n}", "func (m *Module) Subscribe(ctx context.Context, topic string) (<-chan *redis.Message, error) {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\n\t// Check if subscription already exists. Return corresponding channel if it does.\n\tif sub, p := m.mapping[topic]; p {\n\t\treturn sub.ch, nil\n\t}\n\n\t// Make a redis subscription\n\tpubsub := m.client.Subscribe(context.TODO(), m.getTopicName(topic))\n\tif _, err := pubsub.Receive(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Make a channel to listen for subscriptions\n\tch := pubsub.Channel()\n\tm.mapping[topic] = &subscription{ch, pubsub}\n\treturn ch, nil\n}", "func subscribe(qname string) {\n\tpubsub := redisClient.Subscribe(qname)\n\tdefer pubsub.Close()\n\n\tfor {\n\t\tmsg, err := pubsub.ReceiveMessage()\n\t\tif err != nil {\n\t\t\terrLogger.Println(err)\n\t\t}\n\t\trepo, tag := repoTagFromFullName(msg.Payload)\n\t\tqChan <- struct{}{}\n\t\tgo cover(repo, tag, false)\n\t}\n}", "func (by *Bybit) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error {\n\tvar errs error\n\tfor i := range channelsToSubscribe {\n\t\tvar subReq WsReq\n\t\tsubReq.Topic = channelsToSubscribe[i].Channel\n\t\tsubReq.Event = sub\n\n\t\tformattedPair, err := by.FormatExchangeCurrency(channelsToSubscribe[i].Currency, asset.Spot)\n\t\tif err != nil {\n\t\t\terrs = common.AppendError(errs, err)\n\t\t\tcontinue\n\t\t}\n\t\tif channelsToSubscribe[i].Channel == wsKlines {\n\t\t\tsubReq.Parameters = WsParams{\n\t\t\t\tSymbol: formattedPair.String(),\n\t\t\t\tIsBinary: true,\n\t\t\t\tKlineType: \"1m\",\n\t\t\t}\n\t\t} else {\n\t\t\tsubReq.Parameters = WsParams{\n\t\t\t\tSymbol: formattedPair.String(),\n\t\t\t\tIsBinary: true,\n\t\t\t}\n\t\t}\n\t\terr = by.Websocket.Conn.SendJSONMessage(subReq)\n\t\tif err != nil {\n\t\t\terrs = common.AppendError(errs, err)\n\t\t\tcontinue\n\t\t}\n\t\tby.Websocket.AddSuccessfulSubscriptions(channelsToSubscribe[i])\n\t}\n\treturn errs\n}", "func (opcuaExport *OpcuaExport) Subscribe() {\n\tglog.Infof(\"-- Initializing message bus context\")\n\tdefer opcuaExport.configMgr.Destroy()\n\n\tnumOfSubscriber, _ := opcuaExport.configMgr.GetNumSubscribers()\n\tfor i := 0; i < numOfSubscriber; i++ {\n\t\tsubctx, err := opcuaExport.configMgr.GetSubscriberByIndex(i)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Failed to get subscriber context : %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\tsubTopics, err := subctx.GetTopics()\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Failed to fetch topics : %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\tconfig, err := subctx.GetMsgbusConfig()\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Failed to fetch msgbus config : %v\", err)\n\t\t\treturn\n\t\t}\n\t\tgo worker(opcuaExport, config, subTopics[0])\n\t\tsubctx.Destroy()\n\t}\n\t\n}", "func (backend *RedisBackend) Subscribe(queuename string) {\n\terr := backend.pubsub.Subscribe(fmt.Sprintf(\"%s_%s\", TITLE, queuename))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func (l *Logger) Subscribe(c chan DataUnit) {\n\tl.consumers = append(l.consumers, c)\n}", "func (ba *BroadcastAgent) Subscribe(id int, ch chan chan<- []Message) {\n\tc, ok := <-ch\n\tif ok {\n\t\tba.parties[id] = c\n\t}\n}", "func (h *Hub) Publish(t string, b []byte) {\n\th.RLock()\n\tdefer h.RUnlock()\n\tchans, ok := h.topicChans[t]\n\tif !ok {\n\t\treturn\n\t}\n\tfor ch := range chans {\n\t\tselect {\n\t\tcase ch <- b:\n\t\tdefault:\n\t\t\tcontinue\n\t\t}\n\t}\n}", "func (w *Watcher) Subscribe(sink chan<- []*zeroex.OrderEvent) event.Subscription {\n\treturn w.orderScope.Track(w.orderFeed.Subscribe(sink))\n}", "func (d *Demo) Subscribe(recv backend.Receiver) {\n\td.Lock()\n\tdefer d.Unlock()\n\n\td.subscriber = recv\n\n\t// Release the lock before running an update.\n\tgo d.updateAll()\n}", "func (c *Crawler) Subscribe(chanSize uint) UpdateChan {\n\tch := make(UpdateChan, int(chanSize))\n\tc.subscribeChan <- ch\n\treturn ch\n}", "func (b *Broker) Subscribe(s *Subscriber, topics ...string) {\n\tb.tlock.Lock()\n\tdefer b.tlock.Unlock()\n\tfor _, topic := range topics {\n\t\tif nil == b.topics[topic] {\n\t\t\tb.topics[topic] = Subscribers{}\n\t\t}\n\t\ts.topics[topic] = true\n\t\tb.topics[topic][s.id] = s\n\t}\n}", "func (c *subContext) subscribe(ctx context.Context, indCh chan<- indication.Indication) error {\n\t// Add the subscription to the subscription service\n\terr := c.subClient.Add(ctx, c.sub)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch the subscription task service to determine assignment of the subscription to E2 terminations\n\twatchCh := make(chan subtaskapi.Event)\n\twatchCtx, cancel := context.WithCancel(context.Background())\n\tc.cancel = cancel\n\terr = c.taskClient.Watch(watchCtx, watchCh, subscriptiontask.WithSubscriptionID(c.sub.ID))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// The subscription is considered activated, and task events are processed in a separate goroutine.\n\tgo c.processTaskEvents(watchCtx, watchCh, indCh)\n\treturn nil\n}", "func (tg *TradesGroup) subscribe() {\n\tfor _, s := range tg.symbols {\n\t\tmessage := tradeSubsMessage{\n\t\t\tEvent: eventSubscribe,\n\t\t\tChannel: channelTrades,\n\t\t\tSymbol: \"t\" + strings.ToUpper(s.OriginalName),\n\t\t}\n\t\tif err := tg.wsClient.Write(message); err != nil {\n\t\t\tlog.Printf(\"[BITFINEX] Error subsciring to %v trades\", s.Name)\n\t\t\ttg.restart()\n\t\t\treturn\n\t\t}\n\t}\n\tlog.Println(\"[BITFINEX] Subscription ok\")\n}", "func (q *QuotesGroup) subscribe(ch chan schemas.ResultChannel, d time.Duration) {\n\tfor {\n\t\tquotes, err := q.Get()\n\t\tif err != nil {\n\t\t\tch <- schemas.ResultChannel{\n\t\t\t\tData: quotes,\n\t\t\t\tError: err,\n\t\t\t\tDataType: \"s\",\n\t\t\t}\n\t\t}\n\t\tfor _, b := range quotes {\n\t\t\tch <- schemas.ResultChannel{\n\t\t\t\tData: b,\n\t\t\t\tError: err,\n\t\t\t\tDataType: \"s\",\n\t\t\t}\n\t\t}\n\t\ttime.Sleep(d)\n\t}\n}", "func (rabbitmq *RabbitMQ) Subscribe(sub SubscribeStruct) (delivery <-chan Delivery, err error) {\r\n\tif rabbitmq == nil || rabbitmq.Channel == nil {\r\n\t\treturn nil, ErrCursor\r\n\t}\r\n\t// ch, _ := rabbitmq.Connection.Channel()\r\n\t// defer ch.Close()\r\n\t// ch.Qos(sub.prefetchCount, sub.prefetchSize, sub.global)\r\n\r\n\trabbitmq.Channel.Qos(sub.PrefetchCount, sub.PrefetchSize, sub.ApplyPrefetchGlobally)\r\n\r\n\tmsgs, err := rabbitmq.Channel.Consume(\r\n\t\tsub.Queue,\r\n\t\tsub.Consumer,\r\n\t\tsub.AutoAck,\r\n\t\tsub.Exclusive,\r\n\t\tsub.NoLocal,\r\n\t\tsub.NoLocal,\r\n\t\tnil,\r\n\t)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\treturn castDeliveryCh(msgs), nil\r\n}", "func (s *server) Subscribe(p *Chat_Consumer, stream ChatService_SubscribeServer) error {\n\tep := s.read_ep(p.Id)\n\tif ep == nil {\n\t\tlog.Errorf(\"cannot find endpoint %v\", p)\n\t\treturn ERROR_NOT_EXISTS\n\t}\n\n\tconsumerid := atomic.AddUint64(&s.consumerid_autoinc, 1)\n\te := make(chan error, 1)\n\n\t// activate consumer\n\tep.mu.Lock()\n\n\t// from newest\n\tif p.From == -1 {\n\t\tp.From = ep.StartOffset + int64(len(ep.Inbox))\n\t}\n\tep.consumers[consumerid] = &Consumer{p.From, func(msg *Chat_Message) {\n\t\tif err := stream.Send(msg); err != nil {\n\t\t\tselect {\n\t\t\tcase e <- err:\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t}}\n\tep.mu.Unlock()\n\tdefer func() {\n\t\tep.mu.Lock()\n\t\tdelete(ep.consumers, consumerid)\n\t\tep.mu.Unlock()\n\t}()\n\n\tep.notifyConsumers()\n\n\tselect {\n\tcase <-stream.Context().Done():\n\tcase err := <-e:\n\t\treturn err\n\t}\n\treturn nil\n}", "func (g *Gemini) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error {\n\tchannels := make([]string, 0, len(channelsToSubscribe))\n\tfor x := range channelsToSubscribe {\n\t\tif common.StringDataCompareInsensitive(channels, channelsToSubscribe[x].Channel) {\n\t\t\tcontinue\n\t\t}\n\t\tchannels = append(channels, channelsToSubscribe[x].Channel)\n\t}\n\n\tvar pairs currency.Pairs\n\tfor x := range channelsToSubscribe {\n\t\tif pairs.Contains(channelsToSubscribe[x].Currency, true) {\n\t\t\tcontinue\n\t\t}\n\t\tpairs = append(pairs, channelsToSubscribe[x].Currency)\n\t}\n\n\tfmtPairs, err := g.FormatExchangeCurrencies(pairs, asset.Spot)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsubs := make([]wsSubscriptions, len(channels))\n\tfor x := range channels {\n\t\tsubs[x] = wsSubscriptions{\n\t\t\tName: channels[x],\n\t\t\tSymbols: strings.Split(fmtPairs, \",\"),\n\t\t}\n\t}\n\n\twsSub := wsSubscribeRequest{\n\t\tType: \"subscribe\",\n\t\tSubscriptions: subs,\n\t}\n\terr = g.Websocket.Conn.SendJSONMessage(wsSub)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Websocket.AddSuccessfulSubscriptions(channelsToSubscribe...)\n\treturn nil\n}", "func subscribe(t *testing.T, wsc *client.WSClient, eventid string) {\n\tif err := wsc.Subscribe(eventid); err != nil {\n\t\tpanic(err)\n\t}\n}", "func (agent *SrlAgent) Subscribe(topic string) {\n\tagent.Logger.Debug(\"Subscribing for \", topic)\n\top := pb.NotificationRegisterRequest_AddSubscription\n\tresponse := &pb.NotificationRegisterResponse{}\n\tvar err error\n\tif topic == \"intf\" {\n\t\tresponse, err = agent.Stub.NotificationRegister(agent.Ctx, &pb.NotificationRegisterRequest{\n\t\t\tStreamId: agent.StreamID,\n\t\t\tOp: op,\n\t\t\tSubscriptionTypes: &pb.NotificationRegisterRequest_Intf{},\n\t\t})\n\t}\n\tif topic == \"nw_inst\" {\n\t\tresponse, err = agent.Stub.NotificationRegister(agent.Ctx, &pb.NotificationRegisterRequest{\n\t\t\tStreamId: agent.StreamID,\n\t\t\tOp: op,\n\t\t\tSubscriptionTypes: &pb.NotificationRegisterRequest_NwInst{},\n\t\t})\n\t}\n\tif topic == \"lldp\" {\n\t\tresponse, err = agent.Stub.NotificationRegister(agent.Ctx, &pb.NotificationRegisterRequest{\n\t\t\tStreamId: agent.StreamID,\n\t\t\tOp: op,\n\t\t\tSubscriptionTypes: &pb.NotificationRegisterRequest_LldpNeighbor{},\n\t\t})\n\t}\n\tif topic == \"route\" {\n\t\tresponse, err = agent.Stub.NotificationRegister(agent.Ctx, &pb.NotificationRegisterRequest{\n\t\t\tStreamId: agent.StreamID,\n\t\t\tOp: op,\n\t\t\tSubscriptionTypes: &pb.NotificationRegisterRequest_Route{},\n\t\t})\n\t}\n\tif topic == \"cfg\" {\n\t\tresponse, err = agent.Stub.NotificationRegister(agent.Ctx, &pb.NotificationRegisterRequest{\n\t\t\tStreamId: agent.StreamID,\n\t\t\tOp: op,\n\t\t\tSubscriptionTypes: &pb.NotificationRegisterRequest_Config{},\n\t\t})\n\t}\n\tif topic == \"app\" {\n\t\tresponse, err = agent.Stub.NotificationRegister(agent.Ctx, &pb.NotificationRegisterRequest{\n\t\t\tStreamId: agent.StreamID,\n\t\t\tOp: op,\n\t\t\tSubscriptionTypes: &pb.NotificationRegisterRequest_Appid{},\n\t\t})\n\t}\n\tif err != nil {\n\t\tagent.Logger.Debug(\"Failed to subscribe for \", topic)\n\t}\n\tagent.Logger.Debug(\"Response for Notification register for \", topic, \" is \", response.Status)\n}", "func (s *OHLCVSocket) Subscribe(channelID string, c *Client) error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tif c == nil {\n\t\treturn errors.New(\"No connection found\")\n\t}\n\n\tif s.subscriptions[channelID] == nil {\n\t\ts.subscriptions[channelID] = make(map[*Client]bool)\n\t}\n\n\ts.subscriptions[channelID][c] = true\n\n\tif s.subscriptionsList[c] == nil {\n\t\ts.subscriptionsList[c] = []string{}\n\t}\n\n\ts.subscriptionsList[c] = append(s.subscriptionsList[c], channelID)\n\n\treturn nil\n}", "func (service *RedigoService) Subscribe(ctx context.Context, subscribed SubscribedHandler, subscription SubscriptionHandler, channels ...string) error {\n\n\tc, err := redis.Dial(\"tcp\", service.Configuration.Address,\n\t\t// Read timeout on server should be greater than ping period.\n\t\tredis.DialReadTimeout(service.Configuration.PubSub.ReadTimeout),\n\t\tredis.DialWriteTimeout(service.Configuration.PubSub.WriteTimeout),\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer c.Close()\n\n\tpsc := redis.PubSubConn{Conn: c}\n\tif err := psc.Subscribe(redis.Args{}.AddFlat(channels)...); err != nil {\n\t\treturn err\n\t}\n\n\tdone := make(chan error, 1)\n\n\t// Start a goroutine to receive notifications from the server.\n\tgo func() {\n\t\tfor {\n\t\t\tswitch n := psc.Receive().(type) {\n\t\t\tcase error:\n\t\t\t\t// Increment to count failures\n\t\t\t\tservice.Collector.subscribeFailures.Inc()\n\n\t\t\t\tdone <- n\n\t\t\t\treturn\n\t\t\tcase redis.Message:\n\t\t\t\tif err := subscription(n.Channel, n.Data); err != nil {\n\n\t\t\t\t\t// Increment to count failures\n\t\t\t\t\tservice.Collector.subscribeFailures.Inc()\n\n\t\t\t\t\tdone <- err\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Increment to count success\n\t\t\t\tservice.Collector.subscribeSuccesses.Inc()\n\n\t\t\tcase redis.Subscription:\n\t\t\t\tswitch n.Count {\n\t\t\t\tcase len(channels):\n\n\t\t\t\t\t// Increment 1 in subscriptionsActive\n\t\t\t\t\tservice.Collector.subscriptionsActive.Inc()\n\n\t\t\t\t\t// Notify application when all channels are subscribed.\n\t\t\t\t\tif err := subscribed(); err != nil {\n\n\t\t\t\t\t\t// Increment to count failures\n\t\t\t\t\t\tservice.Collector.subscribeFailures.Inc()\n\n\t\t\t\t\t\tdone <- err\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\t// Increment to count success\n\t\t\t\t\tservice.Collector.subscribeSuccesses.Inc()\n\n\t\t\t\tcase 0:\n\t\t\t\t\t// Return from the goroutine when all channels are unsubscribed.\n\t\t\t\t\tdone <- nil\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\t// A ping is set to the server with this period to test for the health of\n\t// the connection and server.\n\tticker := time.NewTicker(service.Configuration.PubSub.HealthCheckInterval)\n\tdefer ticker.Stop()\n\nloop:\n\tfor err == nil {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\t// Send ping to test health of connection and server. If\n\t\t\t// corresponding pong is not received, then receive on the\n\t\t\t// connection will timeout and the receive goroutine will exit.\n\t\t\tif err = psc.Ping(\"\"); err != nil {\n\n\t\t\t\t// Increment to count failures\n\t\t\t\tservice.Collector.subscribeFailures.Inc()\n\n\t\t\t\tbreak loop\n\t\t\t}\n\t\tcase <-ctx.Done():\n\t\t\tbreak loop\n\t\tcase err := <-done:\n\t\t\t// Return error from the receive goroutine.\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Decrement 1 in subscriptionsActive\n\tservice.Collector.subscriptionsActive.Dec()\n\n\t// Signal the receiving goroutine to exit by unsubscribing from all channels.\n\tpsc.Unsubscribe()\n\n\t// Wait for goroutine to complete.\n\treturn <-done\n}", "func (h *Hookbot) ServeSubscribe(conn *websocket.Conn, r *http.Request) {\n\ttopic := Topic(r)\n\n\tlistener := h.Add(topic)\n\tdefer h.Del(listener)\n\n\tclosed := make(chan struct{})\n\n\tgo func() {\n\t\tdefer close(closed)\n\t\tfor {\n\t\t\tif _, _, err := conn.NextReader(); err != nil {\n\t\t\t\tconn.Close()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tvar message Message\n\n\tfor {\n\t\tselect {\n\t\tcase message = <-listener.c:\n\t\tcase <-closed:\n\t\t\treturn\n\t\t}\n\n\t\tconn.SetWriteDeadline(time.Now().Add(90 * time.Second))\n\t\t_, isRecursive := recursive(topic)\n\t\tmsgBytes := []byte{}\n\t\tif isRecursive {\n\t\t\tmsgBytes = append(msgBytes, message.Topic...)\n\t\t\tmsgBytes = append(msgBytes, '\\x00')\n\t\t\tmsgBytes = append(msgBytes, message.Body...)\n\t\t} else {\n\t\t\tmsgBytes = message.Body\n\t\t}\n\t\terr := conn.WriteMessage(websocket.BinaryMessage, msgBytes)\n\t\tswitch {\n\t\tcase err == io.EOF || IsConnectionClose(err):\n\t\t\treturn\n\t\tcase err != nil:\n\t\t\tlog.Printf(\"Error in conn.WriteMessage: %v\", err)\n\t\t\treturn\n\t\t}\n\t}\n}", "func (m *Mux) Subscribe(ds *discordgo.Session, dm *discordgo.Message, ctx *Context) {\n\tresp := \"\\n\"\n\n\tid, _ := strconv.Atoi(ctx.Fields[len(ctx.Fields) -1])\n\tif id >= 0 && id < len(Config.Feeds) {\n\t\tvar sub Subscription\n\n\t\t// Check if already subscribed\n\t\tfor _, v := range Config.Subs {\n\t\t\tif v.ChanID == dm.ChannelID && v.SubID == id {\n\t\t\t\tresp += \"Denied subscription. Already subscribed in this channel.\"\n\t\t\t\tgoto NOSUB\n\t\t\t}\n\t\t}\n\t\t\n\t\tsub.ChanID = dm.ChannelID\n\t\tsub.SubID = id\n\t\n\t\t// Might not be thread-safe\n\t\tConfig.Subs = append(Config.Subs, sub)\n\t\tresp += \"Subscribed.\"\n\t\tNOSUB:\n\t} else {\n\t\tresp += \"Denied subscription. Invalid stream id, see: list command\"\n\t}\n\t\n\tresp += \"\\n\"\n\tds.ChannelMessageSend(dm.ChannelID, resp)\n\n\treturn\n}", "func (xa XAir) Subscribe() chan osc.Message {\n\tch := xa.ps.Subscribe()\n\tlog.Debug.Printf(\"Subscribed %p to %s.\", ch, xa.Name)\n\treturn ch\n}", "func (c *stream) Subscribe(subject string, cb streaminterface.MessageHandler) (streaminterface.Subscription, error) {\n\tif streaminterface.SubjectFromStr(subject).String() != subject {\n\t\treturn nil, ErrBadSubject\n\t}\n\tif cb == nil {\n\t\treturn nil, ErrBadSubscription\n\t}\n\n\tsub := &subscription{Subject: subject, cb: cb, stream: c}\n\n\t// setup a rendezvous point for announcing the occurrence of new messages.\n\tsub.pCond = sync.NewCond(&sub.mu)\n\n\tc.subsMu.Lock()\n\tc.ssid++\n\tsub.sid = c.ssid\n\tq := c.subs[subject]\n\tif q == nil {\n\t\tq = &channel{\n\t\t\tsubs: make(map[int64]*subscription, 1),\n\t\t}\n\t\tc.subs[subject] = q\n\t}\n\tif c.opts.Log {\n\t\tq.logMu.Lock()\n\t\tsub.log = make([]streaminterface.Message, len(q.log))\n\t\tsub.pMsgs += copy(sub.log, q.log)\n\t\tq.logMu.Unlock()\n\t}\n\tc.subs[subject].subs[sub.sid] = sub\n\tc.subsMu.Unlock()\n\n\t// start up a sub specific Go routine to deliver messages.\n\tgo c.waitDeliver(sub)\n\n\treturn sub, nil\n}", "func (h *handler) Subscribe(c *session.Client, topics *[]string) {\n\tif c == nil {\n\t\th.logger.Error(LogErrFailedSubscribe + (ErrClientNotInitialized).Error())\n\t\treturn\n\t}\n\th.logger.Info(fmt.Sprintf(LogInfoSubscribed, c.ID, strings.Join(*topics, \",\")))\n}", "func Subscribe(name string, paths [][]string) *Handle {\n\tif len(paths) == 0 {\n\t\tlog.Printf(\"module doesn't have paths for Subscribe.\")\n\t\treturn nil\n\t}\n\n\tstreamOnce.Do(func() {\n\t\tconn = startConnection()\n\t})\n\n\tsubMutex.Lock()\n\tdefer subMutex.Unlock()\n\tlog.Printf(\"subscriberId: %d\\n\", subscriberId)\n\n\tif subscriberId == math.MaxInt32 {\n\t\tlog.Printf(\"Can't create subscriber anymore.\\n\")\n\t\treturn nil\n\t}\n\n\tname = fmt.Sprintf(\"%v-%v\", name, subscriberId)\n\thandle := &Handle{\n\t\tsubscriberId: subscriberId,\n\t\tpaths: paths,\n\t\tname: name,\n\t\tconn: conn,\n\n\t\tConfigMessage: make(chan *ConfigMessage),\n\t\tRc: make(chan bool),\n\t}\n\tconn.handles[subscriberId] = handle\n\n\t// set a message to send openconfig\n\tsMsg.confReq.Type = pb.ConfigType_SUBSCRIBE\n\tsMsg.confReq.Module = name\n\n\t// subscribe paths to the server\n\tfor _, path := range paths {\n\n\t\tsMsg.confReq.Path = path\n\t\tsc <- sMsg\n\t\terr := <-sMsg.err\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Sending subscription message faild: %v\", err)\n\t\t\tconn.stream.CloseSend()\n\t\t\tdefer delete(conn.handles, subscriberId)\n\t\t\treturn nil\n\t\t}\n\t}\n\tsMsg.confReq = &pb.ConfigRequest{}\n\n\tlog.Printf(\"Subscribe success\\n\")\n\tsubscriberId++\n\treturn handle\n}", "func (pubsub *MemoryEventStore) Subscribe(topics ...string) <-chan Event {\n\tsub := subscription{\n\t\ttopics: topics,\n\t\tch: make(chan Event, pubsub.buffer),\n\t}\n\tpubsub.subscriptions = append(pubsub.subscriptions, sub)\n\treturn sub.ch\n}", "func (p *ConfigDistributor) Subscribe(ch chan<- *Config, checks ...ConfigChangedCheckFn) error {\n\t// Check that distributor is still active\n\tif p.closed.HasFired() {\n\t\treturn ErrConfigDistributorClosed\n\t}\n\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\n\t// Send current config immediately even before we registered a new subscription\n\tif p.lastConfig != nil && p.shouldSendUpdatedConfig(checks, nil, p.lastConfig) {\n\t\tch <- p.lastConfig\n\t}\n\n\t// Register subscription\n\tif p.subscriptions == nil {\n\t\tp.subscriptions = make(map[chan<- *Config][]ConfigChangedCheckFn)\n\t}\n\n\tp.subscriptions[ch] = checks\n\n\t// Start monitoring goroutine\n\tif p.started.Fire() {\n\t\tgo p.monitorConfig()\n\t}\n\n\treturn nil\n}", "func (p *Process) Subscribe(subject string) {\n\n\t\t// Pass this back to the parent\n\t\tp.subscribed_channels = append(p.subscribed_channels, p.parent.subscribe(subject))\n\t}", "func (ps *PubSub) Psubscribe(conn Conn, channel string) {\n\tps.subscribe(conn, true, channel)\n}", "func (a *Application) Subscribe(c *channel.Channel, conn *connection.Connection, data string) error {\n\treturn c.Subscribe(conn, data)\n}", "func (subscriber *Subscriber) Subscribe(conn *NATSConnection) (*nats.Subscription, error) {\n\tlog.Info(\"Initializing callback\")\n\tlog.Info(\"Subscription topic is: \", subscriber.topic)\n\tjs, err := conn.Conn.JetStream()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsub, err := js.Subscribe(streamName+\".\"+subscriber.topic, func(m *nats.Msg) {\n\t\tmeta, _ := m.Metadata()\n\t\tlog.Infof(\"Stream Sequence : %v\\n\", meta.Sequence.Stream)\n\t\tlog.Infof(\"Consumer Sequence: %v\\n\", meta.Sequence.Consumer)\n\t\tvar msg Message\n\t\tmsg.Timestamp = meta.Timestamp.Unix()\n\t\tmsg.Datum = m.Data\n\t\tdata, err := json.Marshal(&msg)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t} else {\n\t\t\tsubscriber.messages <- data\n\t\t}\n\t}, nats.DeliverNew())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn sub, nil\n}", "func TestClient_Subscribe(t *testing.T) {\n\tc := OpenClient(0)\n\tdefer c.Close()\n\tc.Server.Broker().CreateReplica(100, &url.URL{Host: \"localhost\"})\n\n\t// Create subscription through client.\n\tif err := c.Subscribe(100, 200); err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\n\t// Verify subscription was created.\n\tif a := c.Server.Handler.Broker().Replica(100).Topics(); !reflect.DeepEqual([]uint64{0, 200}, a) {\n\t\tt.Fatalf(\"topics mismatch: %v\", a)\n\t}\n}", "func (b *Topics) Subscribe(s *Subscriber, topics ...string) {\n\tb.topic_lock.Lock()\n\tdefer b.topic_lock.Unlock()\n\tfor _, topic := range topics {\n\t\tif nil == b.sub_topics[topic] {\n\t\t\tfmt.Println(\"!!! topic does not exist !!!\")\n\t\t}\n\t\ts.AddTopic(topic)\n\t\tb.sub_topics[topic][s.id] = s\n\t}\n}", "func (c *Connection) Subscribe(ctx context.Context, streamName, consumerName, subj string) ([]byte, error) {\n\tmgr, err := jsm.New(c.conn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstream, err := mgr.LoadStream(streamName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconsumer, err := stream.LoadOrNewConsumer(consumerName,\n\t\tjsm.DurableName(consumerName),\n\t\tjsm.FilterStreamBySubject(subj),\n\t\tjsm.DeliverAllAvailable(),\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_ = consumer\n\n\tjsSubject := fmt.Sprintf(`$JS.API.CONSUMER.MSG.NEXT.%s.%s`, streamName, consumerName)\n\t_ = jsSubject\n\n\t// msg, err := mgr.NextMsg(streamName, consumerName) // This does NOT work\n\t// msg, err := consumer.NextMsgContext(ctx) // This does work\n\tmsg, err := c.conn.RequestWithContext(ctx, jsSubject, []byte(\"a\")) // This does work\n\tif errors.Is(err, nats.ErrTimeout) {\n\t\treturn nil, nil\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmsg.Respond(nil)\n\treturn msg.Data, nil\n}", "func (k *Kafka) Subscribe(topic string, h broker.Handler, opts ...broker.SubscribeOption) (broker.Subscriber, error) {\n\n\top := &broker.SubscribeOptions{\n\t\tAutoAck: true,\n\t}\n\top.Apply(opts...)\n\n\tvar err error\n\t//handler function\n\thandler := func(msg *sarama.ConsumerMessage) {\n\t\tm := broker.Message{}\n\t\tif err := k.encoder.Decode(msg.Value, &m); err != nil {\n\t\t\tlog.Errorf(\"kafka: subscribe: decode failed, err: %v\", err)\n\t\t\treturn\n\t\t}\n\t\th(&event{\n\t\t\top: op,\n\t\t\tt: topic,\n\t\t\tm: &m,\n\t\t})\n\t}\n\t//Consumer with no groupID\n\tif op.Queue == \"\" {\n\t\tlog.Info(\"consumer with no groupID\")\n\t\t// Create new consumer\n\t\tk.consumer, err = sarama.NewConsumer(strings.Split(k.addrs, \",\"), k.config)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpartitionList, err := k.consumer.Partitions(topic)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor partition := range partitionList {\n\t\t\tconsumer, err := k.consumer.ConsumePartition(topic, int32(partition), sarama.OffsetNewest)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tgo func() {\n\t\t\t\tfor msg := range consumer.Messages() {\n\t\t\t\t\thandler(msg)\n\t\t\t\t}\n\t\t\t}()\n\t\t}\n\t\treturn &subscriber{\n\t\t\tqueue: op.Queue,\n\t\t\tt: topic,\n\t\t\ts: k.consumer,\n\t\t}, nil\n\n\t} //end no group\n\t{\n\t\t// Create new consumer group\n\t\tif k.consumerGroup, err = sarama.NewConsumerGroup([]string{k.addrs}, op.Queue, k.config); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tctx := context.Background()\n\t\tconsumer := Consumer{\n\t\t\tencoder: k.encoder,\n\t\t\ttopic: topic,\n\t\t\th: h,\n\t\t\tready: make(chan bool),\n\t\t}\n\t\tgo func() {\n\t\t\tfor {\n\n\t\t\t\tif err := k.consumerGroup.Consume(ctx, []string{topic}, &consumer); err != nil {\n\t\t\t\t\tlog.Panicf(\"Error from consumer: %v\", err)\n\t\t\t\t}\n\t\t\t\t<-ctx.Done()\n\n\t\t\t\tif ctx.Err() != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t\t<-consumer.ready // Await till the consumer has been set up\n\t\tlog.Info(\"Sarama consumer up and running!...\")\n\n\t\treturn &subscriberGroup{\n\t\t\tqueue: op.Queue,\n\t\t\tt: topic,\n\t\t\tg: k.consumerGroup,\n\t\t}, nil\n\t}\n\n}", "func (ps *PubsubApi) LogsSubscribe(ctx context.Context, crit filters.FilterCriteria) (*rpc.Subscription, error) {\n\tif ps.s.context().eventBus == nil {\n\t\t// @Note: Should not happen!\n\t\tlog.Error(\"rpc: eventbus nil, not support Subscribetion!!!\")\n\t\treturn nil, rpc.ErrNotificationsUnsupported\n\t}\n\n\tnotifier, supported := rpc.NotifierFromContext(ctx)\n\tif !supported {\n\t\treturn nil, rpc.ErrNotificationsUnsupported\n\t}\n\n\tsubscription := notifier.CreateSubscription()\n\n\tsuberName := fmt.Sprintf(\"rpc-log-suber-%s\", subscription.ID)\n\tebCtx := context.Background()\n\tlogsCh := make(chan interface{}, 128)\n\tif err := ps.context().eventBus.Subscribe(ebCtx, suberName, types.EventQueryLog, logsCh); err != nil {\n\t\tlog.Warn(\"rpc: Subscribe fail\", \"err\", err)\n\t\treturn nil, err\n\t}\n\n\tgo func() {\n\t\tdefer ps.context().eventBus.Unsubscribe(ebCtx, suberName, types.EventQueryLog)\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase ev := <-logsCh:\n\t\t\t\tlogs := ev.(types.EventDataLog).Logs\n\t\t\t\tlogs = filterLogs(logs, crit.FromBlock.ToInt(), crit.ToBlock.ToInt(), crit.Addresses, crit.Topics)\n\t\t\t\tfor _, l := range logs {\n\t\t\t\t\tnotifier.Notify(subscription.ID, l)\n\t\t\t\t\tlog.Info(\"rpc: notify success\", \"suber\", suberName, \"log\", l)\n\t\t\t\t}\n\t\t\tcase <-notifier.Closed():\n\t\t\t\tlog.Info(\"rpc LogSubscribe: unsubscribe\", \"suber\", suberName)\n\t\t\t\treturn\n\t\t\tcase err := <-subscription.Err():\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(\"rpc subscription: error\", \"suber\", suberName, \"err\", err)\n\t\t\t\t} else {\n\t\t\t\t\tlog.Info(\"rpc subscription: exit\", \"suber\", suberName)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tlog.Info(\"rpc LogsSubscribe: ok\", \"name\", suberName, \"crit\", crit.String())\n\treturn subscription, nil\n}", "func (_Eth *EthTransactor) Subscribe(opts *bind.TransactOpts, a common.Address, topic string) (*types.Transaction, error) {\n\treturn _Eth.contract.Transact(opts, \"subscribe\", a, topic)\n}", "func (nd *NodeDiscover) Subscribe(eventCh chan NodeEvent) {\n\tnd.subscribers.Lock()\n\tnd.subscribers.s[eventCh] = true\n\tnd.subscribers.Unlock()\n\tlog.Info(\"node-discovery: Subscriber added\")\n}", "func (s *Subscriber) Subscribe(ctx context.Context, channel chan<- cavpnEvent) error {\n\terr := s.connect(ctx, channel)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (trading *TradingProvider) Subscribe(interval time.Duration) (chan schemas.UserInfoChannel, chan schemas.UserOrdersChannel, chan schemas.UserTradesChannel) {\n\tuic := make(chan schemas.UserInfoChannel)\n\tuoc := make(chan schemas.UserOrdersChannel)\n\tutc := make(chan schemas.UserTradesChannel)\n\n\tif interval < 5*time.Second {\n\t\tinterval = 5 * time.Second\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tui, err := trading.Info()\n\t\t\tuic <- schemas.UserInfoChannel{\n\t\t\t\tDataType: dataTypeSnapshot,\n\t\t\t\tData: ui,\n\t\t\t\tError: err,\n\t\t\t}\n\n\t\t\tuo, err := trading.Orders([]schemas.Symbol{})\n\t\t\tuoc <- schemas.UserOrdersChannel{\n\t\t\t\tDataType: dataTypeSnapshot,\n\t\t\t\tData: uo,\n\t\t\t\tError: err,\n\t\t\t}\n\n\t\t\tut, _, err := trading.Trades(schemas.FilterOptions{})\n\t\t\tutc <- schemas.UserTradesChannel{\n\t\t\t\tDataType: dataTypeSnapshot,\n\t\t\t\tData: ut,\n\t\t\t\tError: err,\n\t\t\t}\n\n\t\t\ttime.Sleep(interval)\n\t\t}\n\t}()\n\n\treturn uic, uoc, utc\n}", "func (t *topicTrie) subscribe(clientID string, s *gmqtt.Subscription) *topicNode {\n\ttopicSlice := strings.Split(s.TopicFilter, \"/\")\n\tvar pNode = t\n\tfor _, lv := range topicSlice {\n\t\tif _, ok := pNode.children[lv]; !ok {\n\t\t\tpNode.children[lv] = pNode.newChild()\n\t\t}\n\t\tpNode = pNode.children[lv]\n\t}\n\t// shared subscription\n\tif s.ShareName != \"\" {\n\t\tif pNode.shared[s.ShareName] == nil {\n\t\t\tpNode.shared[s.ShareName] = make(clientOpts)\n\t\t}\n\t\tpNode.shared[s.ShareName][clientID] = s\n\t} else {\n\t\t// non-shared\n\t\tpNode.clients[clientID] = s\n\t}\n\tpNode.topicName = s.TopicFilter\n\treturn pNode\n}", "func (zs *pubZerver) Subscribe(stream pb.Subscription_SubscribeServer) error {\n\tres := new(pb.NotificationMessage)\n\t// res.Top10 = make([]*pb.NotificationMessage_Top10, 10)\n\n\tmsg, err := stream.Recv()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfreq := time.Duration(msg.GetRefreshRate()) * time.Second\n\tr := msg.GetStatistics()\n\n\tfmt.Printf(\"[ZubServer] Got subscription request with a refresh interval of %v and an enum of '%v'\\n\", freq, r.String())\n\n\tfor {\n\t\tif zs.logs.Entries() < 1 {\n\t\t\t// TODO error codes as int field?\n\t\t\tres.Status = fmt.Sprintf(\"2: The server has not yet logged any channels. Retrying in %v\", retryInterval)\n\t\t} else {\n\t\t\tres.Status = \"1\"\n\n\t\t\tres.Top10, err = parseTop10(r, zs.logs)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\terr = stream.Send(res)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\ttime.Sleep(freq)\n\t}\n}", "func (s *Subscriber) Subscribe(out chan *commons.WebResource) {\n\n\terr := s.sub.Receive(s.context, func(ctx context.Context, msg *pubsub.Message) {\n\t\titem := &commons.WebResource{}\n\t\tif err := json.Unmarshal(msg.Data, &item); err != nil {\n\t\t\tlogger.Printf(\"Error while decoding PubSub message: %#v\", msg)\n\t\t\tmsg.Nack()\n\t\t} else {\n\t\t\t//logger.Printf(\"Event -> %s\", item.String())\n\t\t\tout <- item\n\t\t\tmsg.Ack()\n\t\t}\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n}", "func (c *Coordinator) Subscribe(ss ...func(*Config) error) {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\n\tc.subscribers = append(c.subscribers, ss...)\n}", "func (c *MockController) Subscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error) {\n\tif channel == \"failure\" {\n\t\treturn nil, errors.New(\"Subscription Failure\")\n\t}\n\n\tres := NewMockResult(sid)\n\n\tif channel == \"failure\" {\n\t\treturn nil, errors.New(\"Subscription failed\")\n\t}\n\n\tif channel == \"disconnect\" {\n\t\tres.Disconnect = true\n\t\treturn res, nil\n\t}\n\n\tif channel == \"stream\" {\n\t\tres.Streams = []string{\"stream\"}\n\t}\n\n\treturn res, nil\n}", "func EventSubscribeH(w http.ResponseWriter, r *http.Request) {\n\n\tlog.V(logLevel).Debugf(\"%s:subscribe:> subscribe on subscribe\", logPrefix)\n\n\tif r.Method != \"GET\" {\n\t\thttp.Error(w, \"Method not allowed\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\tlog.V(logLevel).Debugf(\"%s:subscribe:> watch all events\", logPrefix)\n\n\tvar (\n\t\tsm = distribution.NewServiceModel(r.Context(), envs.Get().GetStorage())\n\t\tnm = distribution.NewNamespaceModel(r.Context(), envs.Get().GetStorage())\n\t\tcm = distribution.NewClusterModel(r.Context(), envs.Get().GetStorage())\n\t\tdone = make(chan bool, 1)\n\t)\n\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.V(logLevel).Debugf(\"%s:subscribe:> set websocket upgrade err: %s\", logPrefix, err.Error())\n\t\treturn\n\t}\n\n\tticker := time.NewTicker(time.Second)\n\tdefer ticker.Stop()\n\n\tvar serviceEvents = make(chan types.ServiceEvent)\n\tvar namespaceEvents = make(chan types.NamespaceEvent)\n\tvar clusterEvents = make(chan types.ClusterEvent)\n\n\tnotify := w.(http.CloseNotifier).CloseNotify()\n\n\tgo func() {\n\t\t<-notify\n\t\tlog.V(logLevel).Debugf(\"%s:subscribe:> HTTP connection just closed.\", logPrefix)\n\t\tdone <- true\n\t}()\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-done:\n\t\t\t\tclose(serviceEvents)\n\t\t\t\tclose(namespaceEvents)\n\t\t\t\tclose(clusterEvents)\n\t\t\t\treturn\n\t\t\tcase e := <-clusterEvents:\n\n\t\t\t\tvar data interface{}\n\t\t\t\tif e.Data == nil {\n\t\t\t\t\tdata = nil\n\t\t\t\t} else {\n\t\t\t\t\tdata = v1.View().Cluster().New(e.Data)\n\t\t\t\t}\n\n\t\t\t\tevent := Event{\n\t\t\t\t\tEntity: \"cluster\",\n\t\t\t\t\tAction: e.Action,\n\t\t\t\t\tName: e.Name,\n\t\t\t\t\tData: data,\n\t\t\t\t}\n\n\t\t\t\tif err = conn.WriteJSON(event); err != nil {\n\t\t\t\t\tlog.Errorf(\"%s:subscribe:> write cluster event to socket error.\", logPrefix)\n\t\t\t\t}\n\t\t\tcase e := <-serviceEvents:\n\n\t\t\t\tvar data interface{}\n\t\t\t\tif e.Data == nil {\n\t\t\t\t\tdata = nil\n\t\t\t\t} else {\n\t\t\t\t\tdata = v1.View().Service().New(e.Data)\n\t\t\t\t}\n\n\t\t\t\tevent := Event{\n\t\t\t\t\tEntity: \"service\",\n\t\t\t\t\tAction: e.Action,\n\t\t\t\t\tName: e.Name,\n\t\t\t\t\tData: data,\n\t\t\t\t}\n\n\t\t\t\tif err = conn.WriteJSON(event); err != nil {\n\t\t\t\t\tlog.Errorf(\"%s:subscribe:> write service event to socket error.\", logPrefix)\n\t\t\t\t}\n\t\t\tcase e := <-namespaceEvents:\n\n\t\t\t\tvar data interface{}\n\t\t\t\tif e.Data == nil {\n\t\t\t\t\tdata = nil\n\t\t\t\t} else {\n\t\t\t\t\tdata = v1.View().Namespace().New(e.Data)\n\t\t\t\t}\n\n\t\t\t\tevent := Event{\n\t\t\t\t\tEntity: \"namespace\",\n\t\t\t\t\tAction: e.Action,\n\t\t\t\t\tName: e.Name,\n\t\t\t\t\tData: data,\n\t\t\t\t}\n\n\t\t\t\tif err = conn.WriteJSON(event); err != nil {\n\t\t\t\t\tlog.Errorf(\"%s:subscribe:> write namespace event to socket error.\", logPrefix)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\tgo cm.Watch(clusterEvents)\n\tgo sm.Watch(serviceEvents, nil)\n\tgo nm.Watch(namespaceEvents)\n\n\tgo func() {\n\t\tfor range ticker.C {\n\t\t\tif err := conn.WriteMessage(websocket.TextMessage, []byte{}); err != nil {\n\t\t\t\tlog.Errorf(\"%s:subscribe:> writing to the client websocket err: %s\", logPrefix, err.Error())\n\t\t\t\tdone <- true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}()\n\n\t<-done\n}", "func subscribeCallback(client MQTT.Client, message MQTT.Message) {\n\n fmt.Printf(\"\\n\")\n fmt.Printf(\"\\nTopic: \" + message.Topic())\n fmt.Printf(\"\\nMessage: \\n\")\n fmt.Printf(string(message.Payload()))\n fmt.Printf(\"\\n--------------\")\n}", "func (pc *Client) Subscribe(channel string, callback SubscribeCallback) error {\n\tpc.subscribers[channel] = callback\n\n\terr := pc.sendMessage(&messages.Subscribe{messages.TYPE_SUBSCRIBE, channel})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = pc.wait(messages.TYPE_SUBSCRIBE_OK)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (m *Client) Subscribe() chan proto.Payload {\n\tmessages := make(chan proto.Payload)\n\ttq := []proto.TopicQos{proto.TopicQos{Topic: m.topic, Qos: 0}}\n\tm.client.Subscribe(tq)\n\tgo func() {\n\t\tdefer close(messages)\n\t\tfor message := range m.client.Incoming {\n\t\t\tmessages <- message.Payload\n\t\t}\n\t}()\n\treturn messages\n}", "func (p *metadataService) onTopicSubscribe(e event.Event) {\n}", "func SubscribeHandler(subChannel chan string) {\n\t// create a subscribe connection to RedisDB\n\tsubscribeConn, err := redisurl.ConnectToURL(\"redis://localhost:6379\")\n\tif err != nil {\n\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\n\t}\n\n\t// Before function exits close the connection\n\tdefer subscribeConn.Close()\n\n\tpubsubConn := redis.PubSubConn{Conn: subscribeConn}\n\tpubsubConn.Subscribe(\"messages\") // Subscribed to messages list in redis DB\n\n\tfor {\n\n\t\tswitch val := pubsubConn.Receive().(type) {\n\n\t\tcase redis.Message:\n\t\t\t// If the data being received is a text message then push it to the channel\n\t\t\tsubChannel <- string(val.Data)\n\n\t\tcase redis.Subscription:\n\t\t\t//Handle Subscription here\n\n\t\tcase error:\n\t\t\treturn\n\t\t}\n\t}\n\n}", "func (b *AsyncTower) Subscribe() chan int {\n\tb.mut.Lock()\n\tch := make(chan int, 1)\n\tb.subs = append(b.subs, ch)\n\tb.mut.Unlock()\n\treturn ch\n}", "func (s *Stentor) Subscribe() <-chan G {\n\tch := make(chan G, s.bufSize)\n\ts.mu.Lock()\n\ts.subscribers[ch] = ch\n\ts.mu.Unlock()\n\n\treturn ch\n}" ]
[ "0.66779685", "0.6572508", "0.6495061", "0.6422174", "0.63689184", "0.6352444", "0.6288932", "0.6274408", "0.62708884", "0.625784", "0.6244839", "0.62359333", "0.6185336", "0.6170156", "0.61666375", "0.6162882", "0.6162781", "0.61599725", "0.61536837", "0.61132455", "0.6086286", "0.6085617", "0.6074434", "0.6072351", "0.6069417", "0.6060739", "0.6054431", "0.60521674", "0.6047343", "0.602667", "0.6009161", "0.5995905", "0.59920865", "0.59802514", "0.5977099", "0.5977075", "0.5976779", "0.5976261", "0.5965189", "0.5963935", "0.5959921", "0.59591067", "0.59580845", "0.59556043", "0.59556043", "0.59433556", "0.59281826", "0.5922841", "0.5902451", "0.59015363", "0.58970726", "0.58815074", "0.58653915", "0.58607584", "0.5852928", "0.5850947", "0.5843706", "0.58395267", "0.5836524", "0.5835301", "0.5835281", "0.58266056", "0.5818532", "0.5816525", "0.5803873", "0.58038586", "0.57969004", "0.5791388", "0.57883346", "0.5786011", "0.5777916", "0.5773768", "0.5772156", "0.5764747", "0.57622963", "0.576218", "0.5759674", "0.57501966", "0.5740018", "0.573358", "0.57312787", "0.5700901", "0.5699191", "0.569727", "0.56911874", "0.56894654", "0.5686889", "0.567339", "0.5671101", "0.5666667", "0.5660641", "0.5657101", "0.56534487", "0.5646746", "0.56397104", "0.5637633", "0.56213504", "0.560482", "0.55995303", "0.5599213" ]
0.71316516
0
SubscribeToAll creates a channel that is registered to ALL of the different partitions
SubscribeToAll создает канал, который зарегистрирован во всех разных разделах
func (n *Node) SubscribeToAll(topic string) <-chan Message { consumer := make(chan Message) parts := n.getPartitionsFor(topic) for _, p := range parts { p.Subscribe(consumer) } return consumer }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (x *Pep) SubscribeToAll(ctx context.Context, host string, jid *jid.JID) {\n\tx.runQueue.Run(func() {\n\t\tif err := x.subscribeToAll(ctx, host, jid); err != nil {\n\t\t\tlog.Error(err)\n\t\t}\n\t})\n}", "func (cp *CandlesProvider) SubscribeAll(d time.Duration) chan schemas.ResultChannel {\n\tch := make(chan schemas.ResultChannel)\n\n\tfor _, orderBook := range cp.groups {\n\t\tgo orderBook.Subscribe(ch, d)\n\t\ttime.Sleep(100 * time.Millisecond)\n\t}\n\treturn ch\n}", "func (n *Node) Subscribe(topic string) <-chan Message {\n\tconsumer := make(chan Message)\n\n\tparts := n.getPartitionsFor(topic)\n\tvar part partition\n\tfor _, p := range parts {\n\t\tpart = smallestOf(part, p)\n\t}\n\n\tlog.Debug(\"Created subscriber for %s:%v\", topic, part)\n\tpart.Subscribe(consumer)\n\treturn consumer\n}", "func (cp *CandlesProvider) SubscribeAll(d time.Duration) chan schemas.ResultChannel {\n\treturn nil\n}", "func SubscribeAll(clientName string) {\n\tvar topic string\n\tvar err error\n\ttopic = fmt.Sprintf(\"/%s/echo\", clientName)\n\tif err = mqttHelper.Subscribe(topic, byte(0), onEcho); err != nil {\n\t\tlog.Errorf(\"Unable to subscribe to %s. Error: %s\", topic, err)\n\t}\n\ttopic = fmt.Sprintf(\"/%s/search\", clientName)\n\tif err = mqttHelper.Subscribe(topic, byte(0), onSearch); err != nil {\n\t\tlog.Errorf(\"Unable to subscribe to %s. Error: %s\", topic, err)\n\t}\n}", "func (g *Gemini) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error {\n\tchannels := make([]string, 0, len(channelsToSubscribe))\n\tfor x := range channelsToSubscribe {\n\t\tif common.StringDataCompareInsensitive(channels, channelsToSubscribe[x].Channel) {\n\t\t\tcontinue\n\t\t}\n\t\tchannels = append(channels, channelsToSubscribe[x].Channel)\n\t}\n\n\tvar pairs currency.Pairs\n\tfor x := range channelsToSubscribe {\n\t\tif pairs.Contains(channelsToSubscribe[x].Currency, true) {\n\t\t\tcontinue\n\t\t}\n\t\tpairs = append(pairs, channelsToSubscribe[x].Currency)\n\t}\n\n\tfmtPairs, err := g.FormatExchangeCurrencies(pairs, asset.Spot)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsubs := make([]wsSubscriptions, len(channels))\n\tfor x := range channels {\n\t\tsubs[x] = wsSubscriptions{\n\t\t\tName: channels[x],\n\t\t\tSymbols: strings.Split(fmtPairs, \",\"),\n\t\t}\n\t}\n\n\twsSub := wsSubscribeRequest{\n\t\tType: \"subscribe\",\n\t\tSubscriptions: subs,\n\t}\n\terr = g.Websocket.Conn.SendJSONMessage(wsSub)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Websocket.AddSuccessfulSubscriptions(channelsToSubscribe...)\n\treturn nil\n}", "func (r *Room) BroadcastAll(msg []byte) {\n\tfor _, client := range r.Clients {\n\t\tclient.WriteMessage(msg)\n\t}\n}", "func (app *App) RegisterAll(to string) {\n\tm := &message.Register{\n\t\tHeader: &message.Header{},\n\t}\n\tm.Header.From = &app.ID\n\tm.Name = &app.Name\n\tm.Header.To = &to\n\tm.Devices = app.DeviceList()\n\n\tapp.Publish(queue.Inventory, m)\n}", "func (by *Bybit) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error {\n\tvar errs error\n\tfor i := range channelsToSubscribe {\n\t\tvar subReq WsReq\n\t\tsubReq.Topic = channelsToSubscribe[i].Channel\n\t\tsubReq.Event = sub\n\n\t\tformattedPair, err := by.FormatExchangeCurrency(channelsToSubscribe[i].Currency, asset.Spot)\n\t\tif err != nil {\n\t\t\terrs = common.AppendError(errs, err)\n\t\t\tcontinue\n\t\t}\n\t\tif channelsToSubscribe[i].Channel == wsKlines {\n\t\t\tsubReq.Parameters = WsParams{\n\t\t\t\tSymbol: formattedPair.String(),\n\t\t\t\tIsBinary: true,\n\t\t\t\tKlineType: \"1m\",\n\t\t\t}\n\t\t} else {\n\t\t\tsubReq.Parameters = WsParams{\n\t\t\t\tSymbol: formattedPair.String(),\n\t\t\t\tIsBinary: true,\n\t\t\t}\n\t\t}\n\t\terr = by.Websocket.Conn.SendJSONMessage(subReq)\n\t\tif err != nil {\n\t\t\terrs = common.AppendError(errs, err)\n\t\t\tcontinue\n\t\t}\n\t\tby.Websocket.AddSuccessfulSubscriptions(channelsToSubscribe[i])\n\t}\n\treturn errs\n}", "func (opcuaExport *OpcuaExport) Subscribe() {\n\tglog.Infof(\"-- Initializing message bus context\")\n\tdefer opcuaExport.configMgr.Destroy()\n\n\tnumOfSubscriber, _ := opcuaExport.configMgr.GetNumSubscribers()\n\tfor i := 0; i < numOfSubscriber; i++ {\n\t\tsubctx, err := opcuaExport.configMgr.GetSubscriberByIndex(i)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Failed to get subscriber context : %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\tsubTopics, err := subctx.GetTopics()\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Failed to fetch topics : %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\tconfig, err := subctx.GetMsgbusConfig()\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Failed to fetch msgbus config : %v\", err)\n\t\t\treturn\n\t\t}\n\t\tgo worker(opcuaExport, config, subTopics[0])\n\t\tsubctx.Destroy()\n\t}\n\t\n}", "func subscribeAllTopics() {\n\tfor key, value := range topicMap {\n\t\thelper.TokenClient = helper.Client.Subscribe(key, 0, value)\n\t\tif helper.TokenClient.Wait() && helper.TokenClient.Error() != nil {\n\t\t\tklog.Errorf(\"subscribe() Error in topic: %s is: %s\", key, helper.TokenClient.Error())\n\t\t}\n\t}\n}", "func (cg *CandlesGroup) subscribe() {\n\tfor _, symb := range cg.symbols {\n\t\tmessage := candlesSubsMessage{\n\t\t\tEvent: eventSubscribe,\n\t\t\tChannel: \"candles\",\n\t\t\tKey: \"trade:1m:t\" + strings.ToUpper(symb.OriginalName),\n\t\t}\n\n\t\tif err := cg.wsClient.Write(message); err != nil {\n\t\t\tlog.Printf(\"[BITFINEX] Error subsciring to %v candles\", symb.Name)\n\t\t\tcg.restart()\n\t\t\treturn\n\t\t}\n\t}\n\tlog.Println(\"[BITFINEX] Subscription ok\")\n}", "func (h *Hub) SendToAll(data []byte) {\n\th.mux.Lock()\n\tdefer h.mux.Unlock()\n\tfor conn := range h.conns {\n\t\th.Send(conn, data, websocket.TextMessage)\n\t}\n}", "func (h *Hub) UnsubscribeAll(ch chan []byte) {\n\th.Lock()\n\tdefer h.Unlock()\n\ttopics, ok := h.chanTopics[ch]\n\tif !ok {\n\t\treturn\n\t}\n\tfor t := range topics {\n\t\tchans, ok := h.topicChans[t]\n\t\tif ok {\n\t\t\tdelete(chans, ch)\n\t\t}\n\t}\n\tdelete(h.chanTopics, ch)\n}", "func (s *StanServer) initSubscriptions() error {\n\n\t// Do not create internal subscriptions in clustered mode,\n\t// the leader will when it gets elected.\n\tif !s.isClustered {\n\t\tcreateSubOnClientPublish := true\n\n\t\tif s.partitions != nil {\n\t\t\t// Receive published messages from clients, but only on the list\n\t\t\t// of static channels.\n\t\t\tif err := s.partitions.initSubscriptions(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// Since we create a subscription per channel, do not create\n\t\t\t// the internal subscription on the > wildcard\n\t\t\tcreateSubOnClientPublish = false\n\t\t}\n\n\t\tif err := s.initInternalSubs(createSubOnClientPublish); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ts.log.Debugf(\"Discover subject: %s\", s.info.Discovery)\n\t// For partitions, we actually print the list of channels\n\t// in the startup banner, so we don't need to repeat them here.\n\tif s.partitions != nil {\n\t\ts.log.Debugf(\"Publish subjects root: %s\", s.info.Publish)\n\t} else {\n\t\ts.log.Debugf(\"Publish subject: %s.>\", s.info.Publish)\n\t}\n\ts.log.Debugf(\"Subscribe subject: %s\", s.info.Subscribe)\n\ts.log.Debugf(\"Subscription Close subject: %s\", s.info.SubClose)\n\ts.log.Debugf(\"Unsubscribe subject: %s\", s.info.Unsubscribe)\n\ts.log.Debugf(\"Close subject: %s\", s.info.Close)\n\treturn nil\n}", "func Register(ch chan ExecutionEvent, topics ...Topic) {\n\tfor _, t := range topics {\n\t\tsubscriberRegistry[t] = append(subscriberRegistry[t], ch)\n\t}\n}", "func (pr *PieceRegistry) SubscribeAllPartsDownloaded() chan PieceRange {\n\treturn pr.plansCompletedCh\n}", "func AllToAll(scope *Scope, input tf.Output, group_assignment tf.Output, concat_dimension int64, split_dimension int64, split_count int64) (output tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\tattrs := map[string]interface{}{\"concat_dimension\": concat_dimension, \"split_dimension\": split_dimension, \"split_count\": split_count}\n\topspec := tf.OpSpec{\n\t\tType: \"AllToAll\",\n\t\tInput: []tf.Input{\n\t\t\tinput, group_assignment,\n\t\t},\n\t\tAttrs: attrs,\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (h *Hub) Subscribe(t string, c chan []byte) {\n\th.Lock()\n\tdefer h.Unlock()\n\tchans, ok := h.topicChans[t]\n\tif !ok {\n\t\tchans = make(map[chan []byte]struct{})\n\t\th.topicChans[t] = chans\n\t}\n\tchans[c] = struct{}{}\n\ttopics, ok := h.chanTopics[c]\n\tif !ok {\n\t\ttopics = make(map[string]struct{})\n\t\th.chanTopics[c] = topics\n\t}\n\ttopics[t] = struct{}{}\n}", "func (qp *QuotesProvider) SubscribeAll(d time.Duration) chan schemas.ResultChannel {\n\tbufLength := len(qp.symbols)\n\tch := make(chan schemas.ResultChannel, 2*bufLength)\n\n\tgo func() {\n\t\tfor {\n\t\t\tquotes, err := qp.get()\n\t\t\tif err != nil {\n\t\t\t\tch <- schemas.ResultChannel{\n\t\t\t\t\tData: quotes,\n\t\t\t\t\tError: err,\n\t\t\t\t\tDataType: \"s\",\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, b := range quotes {\n\t\t\t\tch <- schemas.ResultChannel{\n\t\t\t\t\tData: b,\n\t\t\t\t\tError: err,\n\t\t\t\t\tDataType: \"s\",\n\t\t\t\t}\n\t\t\t}\n\t\t\ttime.Sleep(d)\n\t\t}\n\t}()\n\n\treturn ch\n}", "func (cp *ConnectPlugin) connectToAll(pctx context.Context) {\n\t// Connect to the list of peers. Hopefully Connect() skips the ones that we are already connect to\n\tfor _, pinfo := range cp.peerIDMap {\n\t\tif len(pinfo.Addrs) > 0 {\n\t\t\tfmt.Printf(\"Connecting to %s\\n\", pinfo)\n\t\t\tctx, cancelFunc := context.WithTimeout(pctx, connectTimeout)\n\t\t\tdefer cancelFunc()\n\t\t\terr := cp.api.PeerHost.Connect(ctx, pinfo)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t}\n\n\t}\n}", "func (ks *KafkaStream) Subscribe(close chan struct{}) (<-chan Event, error) {\n\t// Capture current state of stream for use throughout this connection\n\ttopic := ks.config.Topic\n\toffset := ks.config.Offset\n\tstreamPartitions, err := ks.consumer.Partitions(topic)\n\t// Set up return channel for subscription events\n\tevents := make(chan Event, ks.config.SubscribeBufferSize)\n\tif err != nil {\n\t\treturn events, err\n\t}\n\t// Start subscription to stream in background\n\tgo func() {\n\t\t// For each partition in the stream set up a consumer to subscribe to messages\n\t\t// published to that partition\n\t\tfor _, partition := range streamPartitions {\n\t\t\tpartitionConsumer, err := ks.consumer.ConsumePartition(topic, partition, offset)\n\t\t\tif err != nil {\n\t\t\t\tks.logger.Errorf(\"Subscribe: Error %s to starting consumer for partition %d\", partition, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Start goroutine to run until the close channel is closed by the caller\n\t\t\tgo func(partitionConsumer sarama.PartitionConsumer) {\n\t\t\t\t<-close\n\t\t\t\tks.logger.Debug(\"Subscribe: Received close signal\")\n\t\t\t\t// at which point the connection to this partition consumer should be closed\n\t\t\t\tpartitionConsumer.AsyncClose()\n\t\t\t}(partitionConsumer)\n\t\t\t// Start goroutine to run until the close channel is closed by the caller\n\t\t\tgo func(partitionConsumer sarama.PartitionConsumer) {\n\t\t\t\t// to consume and convert messages for the subscriber to receive\n\t\t\t\tfor message := range partitionConsumer.Messages() {\n\t\t\t\t\tevent := convertMessageToEvent(message, topic)\n\t\t\t\t\tks.logger.Debugf(\"Subscribe: Received event %+v\", event)\n\t\t\t\t\tevents <- event\n\t\t\t\t}\n\t\t\t}(partitionConsumer)\n\t\t}\n\t}()\n\n\treturn events, nil\n}", "func (o *Okcoin) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error {\n\treturn o.handleSubscriptions(\"subscribe\", channelsToSubscribe)\n}", "func (c Conference) Subscribe(id uuid.UUID, topic string, out chan Notification) {\n\ttree, ok := c.Room[topic]\n\tif !ok {\n\t\ttree = &bst.BinarySearchTree{}\n\t\tc.Room[topic] = tree\n\t}\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\ttree.Add(NewSubscriber(id, out))\n}", "func (cm *ConnectionManager) closeAll(onlyReceiving bool) (chs []*channeltype.Serialization, err error) {\n\tcm.lock.Lock()\n\tdefer cm.lock.Unlock()\n\tcm.initChannelTarget = 0\n\tif onlyReceiving {\n\t\tchs = cm.receivingChannels()\n\t} else {\n\t\tchs = cm.openChannels()\n\t}\n\tfor _, c := range chs {\n\t\t_, err = cm.api.Close(cm.tokenAddress, c.PartnerAddress())\n\t\tif err != nil {\n\t\t\tlog.Error(fmt.Sprintf(\"close channel %s error:%s\", c.ChannelIdentifier, err))\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func Subscribe(conn net.Conn, command []string, pubsub *PubSub) {\n\n\tfmt.Println(\"SUBSCRIBE TO:\", command[1:])\n\n\tch := make(chan string)\n\n\tdefer func() {\n\t\tconn.Close()\n\t\tpubsub.Unsubscribe <- UnsubscribeEvent{command[1], ch}\n\t}()\n\n\tpubsub.Subscribe <- SubscribeEvent{command[1], ch}\n\n\tfor msg := range ch {\n\t\t//fmt.Fprintf(conn, \"%s\\n\", msg)\n\t\t_, err := conn.Write([]byte(msg + \"\\n\"))\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n}", "func (dc *DurConn) subscribeAll(subs []*subscription, sc stan.Conn, scStaleCh chan struct{}) {\n\n\tsuccess := make([]bool, len(subs))\n\tfor {\n\t\tn := 0\n\t\tfor i, sub := range subs {\n\t\t\tif success[i] {\n\t\t\t\t// Already success.\n\t\t\t\tn++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := dc.subscribe(sub, sc); err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tsuccess[i] = true\n\t\t\tn++\n\n\t\t\tselect {\n\t\t\tcase <-scStaleCh:\n\t\t\t\tdc.logger.Info(\"subscribe stale\")\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\n\t\tif n >= len(subs) {\n\t\t\t// All success.\n\t\t\treturn\n\t\t}\n\n\t\tselect {\n\t\tcase <-scStaleCh:\n\t\t\tdc.logger.Info(\"subscribe stale during retry wait\")\n\t\t\treturn\n\n\t\tcase <-time.After(dc.subRetryWait):\n\t\t}\n\n\t}\n\n}", "func (tg *TradesGroup) subscribe() {\n\tfor _, s := range tg.symbols {\n\t\tmessage := tradeSubsMessage{\n\t\t\tEvent: eventSubscribe,\n\t\t\tChannel: channelTrades,\n\t\t\tSymbol: \"t\" + strings.ToUpper(s.OriginalName),\n\t\t}\n\t\tif err := tg.wsClient.Write(message); err != nil {\n\t\t\tlog.Printf(\"[BITFINEX] Error subsciring to %v trades\", s.Name)\n\t\t\ttg.restart()\n\t\t\treturn\n\t\t}\n\t}\n\tlog.Println(\"[BITFINEX] Subscription ok\")\n}", "func (m *TeamItemRequestBuilder) AllChannels()(*ic08a09e622b3f3279dad3fb1dc0d9adf50886e9a08f52205e44e27965d46190a.AllChannelsRequestBuilder) {\n return ic08a09e622b3f3279dad3fb1dc0d9adf50886e9a08f52205e44e27965d46190a.NewAllChannelsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func waitForClusterToBecomeAwareOfAllSubscriptions(servers []server.NATSServer, subscriptionCount int) error {\n\ttimeout := time.After(time.Second * 5)\n\tfor {\n\t\tselect {\n\t\tcase <-timeout:\n\t\t\tfor _, server := range servers {\n\t\t\t\tif int(server.NumSubscriptions()) != subscriptionCount {\n\t\t\t\t\treturn errors.New(\"Timed out : waitForClusterToBecomeAwareOfAllSubscriptions()\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tlog.Logger.Info().Msg(\"Entire cluster is aware of all subscriptions\")\n\t\t\treturn nil\n\t\tdefault:\n\t\t\tfor _, server := range servers {\n\t\t\t\tif int(server.NumSubscriptions()) != subscriptionCount {\n\t\t\t\t\tlog.Logger.Info().Msgf(\"Subscription count = %d\", server.NumSubscriptions())\n\t\t\t\t\ttime.Sleep(time.Millisecond)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tlog.Logger.Info().Msg(\"Entire cluster is aware of all subscriptions\")\n\t\t\treturn nil\n\t\t}\n\n\t}\n}", "func (c *Client) SubscribeAllDeviceMessages() {\n\ttok := c.c.Subscribe(AllDeviceTopic(c.opts.apiVer), c.opts.handlerQos,\n\t\tfunc(client pmqtt.Client, msg pmqtt.Message) {\n\t\t\tmessage := NewDeviceMessage().Decode(msg.Payload())\n\t\t\tlog.Infof(\"Topic: %s JSON: %s\", msg.Topic(), message.Message)\n\t\t\tLogMQTTMessage(msg)\n\t\t})\n\n\tif tok.WaitTimeout(c.opts.timeout) && tok.Error() != nil {\n\t\tlog.Errorf(\"Failed subscribe action: %v\", tok.Error())\n\t}\n}", "func (ba *BroadcastAgent) Subscribe(id int, ch chan chan<- []Message) {\n\tc, ok := <-ch\n\tif ok {\n\t\tba.parties[id] = c\n\t}\n}", "func Sub(c mqtt.Client, topic string) {\n\tvar choke = make(chan [2]string)\n\n\tvar f mqtt.MessageHandler = func(client mqtt.Client, msg mqtt.Message) {\n\t\tchoke <- [2]string{msg.Topic(), string(msg.Payload())}\n\t}\n\tfor {\n\t\tif token := c.Subscribe(topic, 0, f); token.Wait() && token.Error() != nil {\n\t\t\tmqtt.ERROR.Println(token.Error())\n\t\t\tos.Exit(1)\n\t\t}\n\t\tfor {\n\t\t\tincoming := <-choke\n\t\t\tmqtt.ERROR.Printf(\"Received:TOPIC: %s\\n\", incoming[0])\n\t\t\twriteFile(incoming[1])\n\t\t}\n\t}\n\n}", "func subscribeToEvents(bot *tgbotapi.BotAPI, redisClient *redis.Client, channel string) {\n\tpubsub := redisClient.Subscribe(channel)\n\tgo listen(bot, pubsub)\n}", "func (s *Subscription) Subscribe(channels ...string) {\n\tif len(channels) < 1 {\n\t\treturn\n\t}\n\n\ts.broker.dataChan <- &envData{false, &envSubscription{true, s, channels}, nil}\n}", "func (q channelQuery) All(ctx context.Context, exec boil.ContextExecutor) (ChannelSlice, error) {\n\tvar o []*Channel\n\n\terr := q.Bind(ctx, exec, &o)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"models: failed to assign all query results to Channel slice\")\n\t}\n\n\tif len(channelAfterSelectHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterSelectHooks(ctx, exec); err != nil {\n\t\t\t\treturn o, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn o, nil\n}", "func (ss *SubscriptionsService) All(ctx context.Context, opts *SubscriptionListOptions) (\n\tres *Response,\n\tsl *SubscriptionList,\n\terr error,\n) {\n\tu := \"v2/subscriptions\"\n\n\tres, err = ss.list(ctx, u, opts)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif err = json.Unmarshal(res.content, &sl); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (ps *PubSub) Subscribe(channel ...interface{}) error {\n\tps.conn.Send(\"SUBSCRIBE\", channel...)\n\treturn ps.conn.Flush()\n}", "func (d StaticAgentDiscovery) Subscribe(c chan<- []string) { go func() { c <- d }() }", "func (t *Topic) Subscribe(cb *func(interface{})) {\n\tt.subs = append(t.subs, cb)\n}", "func (tc *consumer) Subscribe(topics map[string]int64) error {\n\tfor topic := range topics {\n\t\tif _, exists := tc.subscribedTopics[topic]; exists {\n\t\t\tlogger.Printf(\"consumer for %s already exists. This is strange\", topic)\n\t\t}\n\t\tlogger.Printf(\"Subscribe %s\", topic)\n\t\ttc.subscribedTopics[topic] = tc.tester.getOrCreateQueue(topic).bindConsumer(tc, true)\n\t\ttc.subscribedTopics[topic].rebalance()\n\t\ttc.subscribedTopics[topic].startLoop(false)\n\t}\n\treturn nil\n}", "func (mem *Member) AllToAll() {\n\t// Encode the membership list to send it\n\tb := new(bytes.Buffer)\n\te := gob.NewEncoder(b)\n\terr := e.Encode(mem.membershipList)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t//Info.Println(\"Sending All-to-All.\")\n\t// Send heartbeatmsg and membership list to all members\n\tmem.SendAll(HeartbeatMsg, b.Bytes())\n}", "func startFanOut(quitC <-chan struct{}) (inC chan *model.PortalMsg, subC chan chan *model.PortalMsg) {\n\n\tinC = make(chan *model.PortalMsg, 1)\n\tsubC = make(chan chan *model.PortalMsg, 1)\n\n\tgo func(quitC <-chan struct{}) {\n\t\tdefer fmt.Println(\"fanout stopped\")\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-quitC:\n\t\t\t\treturn\n\t\t\tcase sub := <-subC:\n\t\t\t\tif nil != sub {\n\t\t\t\t\tsubs.Lock()\n\t\t\t\t\tsubs.subs = append(subs.subs, sub)\n\t\t\t\t\tsubs.Unlock()\n\t\t\t\t\tfmt.Println(\"subscription added\")\n\t\t\t\t}\n\t\t\tcase msg := <-inC:\n\t\t\t\t// The subscriptions are notified of a message and are groomed out\n\t\t\t\t// on unrecoverable failures using https://github.com/golang/go/wiki/SliceTricks#filtering-without-allocating\n\t\t\t\tsubs.Lock()\n\t\t\t\tnewSubs := subs.subs[:0]\n\t\t\t\tfor _, ch := range subs.subs {\n\t\t\t\t\tfunc() {\n\t\t\t\t\t\tdefer func() {\n\t\t\t\t\t\t\tif r := recover(); r == nil {\n\t\t\t\t\t\t\t\tnewSubs = append(newSubs, ch)\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfmt.Println(\"subscription dropped failed to send\")\n\t\t\t\t\t\t}()\n\t\t\t\t\t\tselect {\n\t\t\t\t\t\tcase ch <- msg:\n\t\t\t\t\t\tcase <-time.After(250 * time.Millisecond):\n\t\t\t\t\t\t\tfmt.Println(\"subscription failed to send\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}()\n\t\t\t\t}\n\t\t\t\tsubs.subs = newSubs\n\t\t\t\tsubs.Unlock()\n\t\t\t}\n\t\t}\n\t}(quitC)\n\n\treturn inC, subC\n}", "func (channel Channel) subscribe(observers ...Observer) {\n\tchannel.checkChannelMap()\n\tfor _, observer := range observers {\n\t\tchannel.observers[observer.id] = observer\n\t\tfmt.Printf(\"New observer %s subscribed in channel %s \\n\", observer.id, channel.id)\n\t}\n}", "func (kew *KeyspaceEventWatcher) Subscribe() chan *KeyspaceEvent {\n\tkew.subsMu.Lock()\n\tdefer kew.subsMu.Unlock()\n\tc := make(chan *KeyspaceEvent, 2)\n\tkew.subs[c] = struct{}{}\n\treturn c\n}", "func (b *Broker) Subscribe(s *Subscriber, topics ...string) {\n\tb.tlock.Lock()\n\tdefer b.tlock.Unlock()\n\tfor _, topic := range topics {\n\t\tif nil == b.topics[topic] {\n\t\t\tb.topics[topic] = Subscribers{}\n\t\t}\n\t\ts.topics[topic] = true\n\t\tb.topics[topic][s.id] = s\n\t}\n}", "func SubscriptionTo(ctx context.Context, b *Broadcaster) *Subscription {\n\n\tctx, done := context.WithCancel(ctx)\n\tret := &Subscription{\n\t\tctx: ctx,\n\t\tdone: done,\n\t\tc: make(chan struct{}),\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tnCh := b.Register()\n\t\t\tselect {\n\t\t\tcase <-nCh:\n\t\t\t\tlog.Printf(\"received event, sending\")\n\t\t\t\tret.send()\n\t\t\tcase <-ctx.Done():\n\t\t\t\tlog.Printf(\"context done (in SuscriptioTo)\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\treturn ret\n}", "func (h *Handler) All(e *emptypb.Empty, s protobufs.HackerNews_AllServer) error {\n\titems, err := h.reader.GetAllItems(s.Context())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getAllItems: %w\", err)\n\t}\n\n\tfor _, item := range items {\n\t\ts.Send(grpc.ToProto(item))\n\t}\n\n\treturn nil\n}", "func (b *Topics) Subscribe(s *Subscriber, topics ...string) {\n\tb.topic_lock.Lock()\n\tdefer b.topic_lock.Unlock()\n\tfor _, topic := range topics {\n\t\tif nil == b.sub_topics[topic] {\n\t\t\tfmt.Println(\"!!! topic does not exist !!!\")\n\t\t}\n\t\ts.AddTopic(topic)\n\t\tb.sub_topics[topic][s.id] = s\n\t}\n}", "func (s *Client) SubscribeNodes(name string,done chan struct{}) (chan []*ServiceNode, error){\n\tpath := s.zkRoot + \"/\" + name\n\terr := s.ensurePath(name)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tpanic(err)\n\t}\n\t// 获取字节点名称\n\tnodesChan := make(chan []*ServiceNode)\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase _,ok := <- done:\n\t\t\t\tif !ok {\n\t\t\t\t\tlog.Printf(\"done send, stop subscribing channel of %s\\n\", name)\n\t\t\t\t\tclose(nodesChan)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t}\n\t\t\tchilds, _,ch, err := s.conn.ChildrenW(path)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t\tpanic(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tvar nodes []*ServiceNode\n\t\t\tfor _, child := range childs {\n\t\t\t\tfullPath := path + \"/\" + child\n\t\t\t\tdata, _, err := s.conn.Get(fullPath)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif err == zk.ErrNoNode {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tlog.Println(err.Error())\n\t\t\t\t}\n\t\t\t\tnode := new(ServiceNode)\n\t\t\t\terr = json.Unmarshal(data, node)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(err.Error())\n\t\t\t\t}\n\t\t\t\tnodes = append(nodes, node)\n\t\t\t}\n\t\t\t/* send new nodes to chan */\n\t\t\tnodesChan <- nodes\n\t\t\t/* when receiving events*/\n\t\t\te := <- ch\n\t\t\tif e.Type == zk.EventNodeChildrenChanged {\n\t\t\t\tlog.Printf(\"zk Path: %s, children changed\\n\", name)\n\t\t\t}else {\n\t\t\t\tlog.Printf(\"zk Path: %s, unexpected events\\n\",name)\n\t\t\t}\n\n\t\t}\n\t}()\n\treturn nodesChan, nil\n}", "func (service *RedigoService) Subscribe(ctx context.Context, subscribed SubscribedHandler, subscription SubscriptionHandler, channels ...string) error {\n\n\tc, err := redis.Dial(\"tcp\", service.Configuration.Address,\n\t\t// Read timeout on server should be greater than ping period.\n\t\tredis.DialReadTimeout(service.Configuration.PubSub.ReadTimeout),\n\t\tredis.DialWriteTimeout(service.Configuration.PubSub.WriteTimeout),\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer c.Close()\n\n\tpsc := redis.PubSubConn{Conn: c}\n\tif err := psc.Subscribe(redis.Args{}.AddFlat(channels)...); err != nil {\n\t\treturn err\n\t}\n\n\tdone := make(chan error, 1)\n\n\t// Start a goroutine to receive notifications from the server.\n\tgo func() {\n\t\tfor {\n\t\t\tswitch n := psc.Receive().(type) {\n\t\t\tcase error:\n\t\t\t\t// Increment to count failures\n\t\t\t\tservice.Collector.subscribeFailures.Inc()\n\n\t\t\t\tdone <- n\n\t\t\t\treturn\n\t\t\tcase redis.Message:\n\t\t\t\tif err := subscription(n.Channel, n.Data); err != nil {\n\n\t\t\t\t\t// Increment to count failures\n\t\t\t\t\tservice.Collector.subscribeFailures.Inc()\n\n\t\t\t\t\tdone <- err\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Increment to count success\n\t\t\t\tservice.Collector.subscribeSuccesses.Inc()\n\n\t\t\tcase redis.Subscription:\n\t\t\t\tswitch n.Count {\n\t\t\t\tcase len(channels):\n\n\t\t\t\t\t// Increment 1 in subscriptionsActive\n\t\t\t\t\tservice.Collector.subscriptionsActive.Inc()\n\n\t\t\t\t\t// Notify application when all channels are subscribed.\n\t\t\t\t\tif err := subscribed(); err != nil {\n\n\t\t\t\t\t\t// Increment to count failures\n\t\t\t\t\t\tservice.Collector.subscribeFailures.Inc()\n\n\t\t\t\t\t\tdone <- err\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\t// Increment to count success\n\t\t\t\t\tservice.Collector.subscribeSuccesses.Inc()\n\n\t\t\t\tcase 0:\n\t\t\t\t\t// Return from the goroutine when all channels are unsubscribed.\n\t\t\t\t\tdone <- nil\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\t// A ping is set to the server with this period to test for the health of\n\t// the connection and server.\n\tticker := time.NewTicker(service.Configuration.PubSub.HealthCheckInterval)\n\tdefer ticker.Stop()\n\nloop:\n\tfor err == nil {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\t// Send ping to test health of connection and server. If\n\t\t\t// corresponding pong is not received, then receive on the\n\t\t\t// connection will timeout and the receive goroutine will exit.\n\t\t\tif err = psc.Ping(\"\"); err != nil {\n\n\t\t\t\t// Increment to count failures\n\t\t\t\tservice.Collector.subscribeFailures.Inc()\n\n\t\t\t\tbreak loop\n\t\t\t}\n\t\tcase <-ctx.Done():\n\t\t\tbreak loop\n\t\tcase err := <-done:\n\t\t\t// Return error from the receive goroutine.\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Decrement 1 in subscriptionsActive\n\tservice.Collector.subscriptionsActive.Dec()\n\n\t// Signal the receiving goroutine to exit by unsubscribing from all channels.\n\tpsc.Unsubscribe()\n\n\t// Wait for goroutine to complete.\n\treturn <-done\n}", "func InitRegistry() {\n\tsubscriberRegistry = make(map[Topic][]chan ExecutionEvent)\n\tsubscriberRegistry[SuiteStart] = make([]chan ExecutionEvent, 0)\n\tsubscriberRegistry[ScenarioStart] = make([]chan ExecutionEvent, 0)\n\tsubscriberRegistry[ConceptStart] = make([]chan ExecutionEvent, 0)\n\tsubscriberRegistry[StepStart] = make([]chan ExecutionEvent, 0)\n\tsubscriberRegistry[SuiteEnd] = make([]chan ExecutionEvent, 0)\n\tsubscriberRegistry[ConceptEnd] = make([]chan ExecutionEvent, 0)\n\tsubscriberRegistry[ScenarioEnd] = make([]chan ExecutionEvent, 0)\n\tsubscriberRegistry[SpecEnd] = make([]chan ExecutionEvent, 0)\n\tsubscriberRegistry[SuiteEnd] = make([]chan ExecutionEvent, 0)\n}", "func (ps *PubsubApi) LogsSubscribe(ctx context.Context, crit filters.FilterCriteria) (*rpc.Subscription, error) {\n\tif ps.s.context().eventBus == nil {\n\t\t// @Note: Should not happen!\n\t\tlog.Error(\"rpc: eventbus nil, not support Subscribetion!!!\")\n\t\treturn nil, rpc.ErrNotificationsUnsupported\n\t}\n\n\tnotifier, supported := rpc.NotifierFromContext(ctx)\n\tif !supported {\n\t\treturn nil, rpc.ErrNotificationsUnsupported\n\t}\n\n\tsubscription := notifier.CreateSubscription()\n\n\tsuberName := fmt.Sprintf(\"rpc-log-suber-%s\", subscription.ID)\n\tebCtx := context.Background()\n\tlogsCh := make(chan interface{}, 128)\n\tif err := ps.context().eventBus.Subscribe(ebCtx, suberName, types.EventQueryLog, logsCh); err != nil {\n\t\tlog.Warn(\"rpc: Subscribe fail\", \"err\", err)\n\t\treturn nil, err\n\t}\n\n\tgo func() {\n\t\tdefer ps.context().eventBus.Unsubscribe(ebCtx, suberName, types.EventQueryLog)\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase ev := <-logsCh:\n\t\t\t\tlogs := ev.(types.EventDataLog).Logs\n\t\t\t\tlogs = filterLogs(logs, crit.FromBlock.ToInt(), crit.ToBlock.ToInt(), crit.Addresses, crit.Topics)\n\t\t\t\tfor _, l := range logs {\n\t\t\t\t\tnotifier.Notify(subscription.ID, l)\n\t\t\t\t\tlog.Info(\"rpc: notify success\", \"suber\", suberName, \"log\", l)\n\t\t\t\t}\n\t\t\tcase <-notifier.Closed():\n\t\t\t\tlog.Info(\"rpc LogSubscribe: unsubscribe\", \"suber\", suberName)\n\t\t\t\treturn\n\t\t\tcase err := <-subscription.Err():\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(\"rpc subscription: error\", \"suber\", suberName, \"err\", err)\n\t\t\t\t} else {\n\t\t\t\t\tlog.Info(\"rpc subscription: exit\", \"suber\", suberName)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tlog.Info(\"rpc LogsSubscribe: ok\", \"name\", suberName, \"crit\", crit.String())\n\treturn subscription, nil\n}", "func InitiateConsumers(ns *servicebus.Namespace, availableTopicList []*servicebus.TopicEntity, componentName string,\n\tsubscriptionIdleTimeDuration time.Duration) {\n\tbindingKeys := []string {tokenRevocation, notification}\n\n\tfor _, key := range bindingKeys {\n\t\tgo func(key string) {\n\t\t\tlogger.LoggerMgw.Info(\"[TEST][FEATURE_FLAG_REPLACE_EVENT_HUB] starting the consumer for key : \" + key)\n\t\t\tstartBrokerConsumer(key, ns, availableTopicList, componentName,\n\t\t\t\tservicebus.SubscriptionWithAutoDeleteOnIdle(&subscriptionIdleTimeDuration))\n\t\t\tselect {}\n\t\t}(key)\n\t}\n}", "func (s *Slave) Subscribe(lsns ...uint64) (it PacketIterator, err error) {\n\tif len(lsns) == 0 || len(lsns) >= VClockMax {\n\t\treturn nil, ErrVectorClock\n\t}\n\t//don't call subscribe if there are no options had been set or before join request\n\tif !s.IsInReplicaSet() {\n\t\treturn nil, ErrNotInReplicaSet\n\t}\n\tif err = s.subscribe(lsns...); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// set iterator for the Next method\n\ts.next = s.nextXlog\n\n\t// Tarantool >= 1.7.0 sends periodic heartbeat messages\n\tif s.Version() < version1_7_0 {\n\t\treturn s, nil\n\t}\n\n\t// Start sending heartbeat messages to master\n\tgo s.heartbeat()\n\n\treturn s, nil\n}", "func SubListAll(w http.ResponseWriter, r *http.Request) {\n\n\tvar err error\n\tvar strPageSize string\n\tvar pageSize int\n\tvar res subscriptions.PaginatedSubscriptions\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\troles := gorillaContext.Get(r, \"auth_roles\").([]string)\n\n\turlValues := r.URL.Query()\n\tpageToken := urlValues.Get(\"pageToken\")\n\tstrPageSize = urlValues.Get(\"pageSize\")\n\n\t// if this route is used by a user who only has a consumer role\n\t// return all subscriptions that he has access to\n\tuserUUID := \"\"\n\tif !auth.IsProjectAdmin(roles) && !auth.IsServiceAdmin(roles) && auth.IsConsumer(roles) {\n\t\tuserUUID = gorillaContext.Get(r, \"auth_user_uuid\").(string)\n\t}\n\n\tif strPageSize != \"\" {\n\t\tif pageSize, err = strconv.Atoi(strPageSize); err != nil {\n\t\t\tlog.Errorf(\"Pagesize %v produced an error while being converted to int: %v\", strPageSize, err.Error())\n\t\t\terr := APIErrorInvalidData(\"Invalid page size\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif res, err = subscriptions.Find(projectUUID, userUUID, \"\", pageToken, int32(pageSize), refStr); err != nil {\n\t\terr := APIErrorInvalidData(\"Invalid page token\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Output result to JSON\n\tresJSON, err := res.ExportJSON()\n\tif err != nil {\n\t\terr := APIErrExportJSON()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Write Response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n\n}", "func (agent *SrlAgent) Subscribe(topic string) {\n\tagent.Logger.Debug(\"Subscribing for \", topic)\n\top := pb.NotificationRegisterRequest_AddSubscription\n\tresponse := &pb.NotificationRegisterResponse{}\n\tvar err error\n\tif topic == \"intf\" {\n\t\tresponse, err = agent.Stub.NotificationRegister(agent.Ctx, &pb.NotificationRegisterRequest{\n\t\t\tStreamId: agent.StreamID,\n\t\t\tOp: op,\n\t\t\tSubscriptionTypes: &pb.NotificationRegisterRequest_Intf{},\n\t\t})\n\t}\n\tif topic == \"nw_inst\" {\n\t\tresponse, err = agent.Stub.NotificationRegister(agent.Ctx, &pb.NotificationRegisterRequest{\n\t\t\tStreamId: agent.StreamID,\n\t\t\tOp: op,\n\t\t\tSubscriptionTypes: &pb.NotificationRegisterRequest_NwInst{},\n\t\t})\n\t}\n\tif topic == \"lldp\" {\n\t\tresponse, err = agent.Stub.NotificationRegister(agent.Ctx, &pb.NotificationRegisterRequest{\n\t\t\tStreamId: agent.StreamID,\n\t\t\tOp: op,\n\t\t\tSubscriptionTypes: &pb.NotificationRegisterRequest_LldpNeighbor{},\n\t\t})\n\t}\n\tif topic == \"route\" {\n\t\tresponse, err = agent.Stub.NotificationRegister(agent.Ctx, &pb.NotificationRegisterRequest{\n\t\t\tStreamId: agent.StreamID,\n\t\t\tOp: op,\n\t\t\tSubscriptionTypes: &pb.NotificationRegisterRequest_Route{},\n\t\t})\n\t}\n\tif topic == \"cfg\" {\n\t\tresponse, err = agent.Stub.NotificationRegister(agent.Ctx, &pb.NotificationRegisterRequest{\n\t\t\tStreamId: agent.StreamID,\n\t\t\tOp: op,\n\t\t\tSubscriptionTypes: &pb.NotificationRegisterRequest_Config{},\n\t\t})\n\t}\n\tif topic == \"app\" {\n\t\tresponse, err = agent.Stub.NotificationRegister(agent.Ctx, &pb.NotificationRegisterRequest{\n\t\t\tStreamId: agent.StreamID,\n\t\t\tOp: op,\n\t\t\tSubscriptionTypes: &pb.NotificationRegisterRequest_Appid{},\n\t\t})\n\t}\n\tif err != nil {\n\t\tagent.Logger.Debug(\"Failed to subscribe for \", topic)\n\t}\n\tagent.Logger.Debug(\"Response for Notification register for \", topic, \" is \", response.Status)\n}", "func RemoveAllSubscriptionsOnConnect(clientID string) {\n\tsubs := new(map[string]uint8)\n\tkey := fmt.Sprintf(\"chatterbox.client-subs.%s\", clientID)\n\tGlobalRedisClient.Fetch(key, subs)\n\n\tGlobalRedisClient.Delete(key)\n\n\tGlobalSubsLock.Lock()\n\tfor topic := range *subs {\n\t\tdelete(GlobalSubs[topic], clientID)\n\t}\n\tGlobalSubsLock.Unlock()\n\n}", "func (c *Coordinator) Subscribe(ss ...func(*Config) error) {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\n\tc.subscribers = append(c.subscribers, ss...)\n}", "func (s *Client) Subscribe1Node(name string) (chan ServiceNode, error){\n\tresChan := make(chan ServiceNode)\n\tdone := make(chan struct{})\n\tnodeChan, _ := s.SubscribeNodes(name,done)\n\n\tgo func() {\n\t\tfor nodes := range nodeChan {\n\t\t\tif len(nodes) == 0 {\n\t\t\tclose(resChan)\n\t\t\tclose(done)\n\t\t\t}else if len(nodes) != 1 {\n\t\t\t\tlog.Printf(\"not suppose to see multiple primary nodes\")\n\t\t\t}else {\n\t\t\t\tresChan <- *nodes[0]\n\t\t\t}\n\t\t}\n\t}()\n\treturn resChan,nil\n}", "func (s *Cluster) NotifySubscribe(conn security.ID, ssid subscription.Ssid) {\n\tevent := SubscriptionEvent{\n\t\tPeer: s.name,\n\t\tConn: conn,\n\t\tSsid: ssid,\n\t}\n\n\t// Add to our global state\n\ts.state.Add(event.Encode())\n\t// Create a delta for broadcasting just this operation\n\top := newSubscriptionState()\n\top.Add(event.Encode())\n\ts.gossip.GossipBroadcast(op)\n}", "func chatroom() {\n\tarchive := list.New()\n\tsubscribers := list.New()\n\n\tfor {\n\t\tselect {\n\t\tcase ch := <-subscribe:\n\t\t\tvar events []Event\n\t\t\tfor e := archive.Front(); e != nil; e = e.Next() {\n\t\t\t\tevents = append(events, e.Value.(Event))\n\t\t\t}\n\t\t\tsubscriber := make(chan Event, 10)\n\t\t\tsubscribers.PushBack(subscriber)\n\t\t\tch <- Subscription{events, subscriber}\n\n\t\tcase event := <-publish:\n\t\t\tfor ch := subscribers.Front(); ch != nil; ch = ch.Next() {\n\t\t\t\tch.Value.(chan Event) <- event\n\t\t\t}\n\t\t\tif archive.Len() >= archiveSize {\n\t\t\t\tarchive.Remove(archive.Front())\n\t\t\t}\n\t\t\tarchive.PushBack(event)\n\n\t\tcase unsub := <-unsubscribe:\n\t\t\tfor ch := subscribers.Front(); ch != nil; ch = ch.Next() {\n\t\t\t\tif ch.Value.(chan Event) == unsub {\n\t\t\t\t\tsubscribers.Remove(ch)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (p RPCServer) Subscribe(ctx context.Context, in *pb.SubscriptionRequest) (*pb.Subscription, error) {\n\tsubID := *p.currentSubID\n\t*p.currentSubID++\n\n\tlogrus.WithField(\"topic\", in.Topic).WithField(\"subID\", subID).Debug(\"subscribed to new messages\")\n\n\tp.subChannels[subID] = make(chan []byte)\n\tp.cancelChannels[subID] = make(chan bool)\n\n\ts, err := p.service.RegisterHandler(in.Topic, func(b []byte) error {\n\t\tselect {\n\t\tcase p.subChannels[subID] <- b:\n\t\tdefault:\n\t\t}\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp.subscriptions[subID] = s\n\n\treturn &pb.Subscription{ID: subID}, nil\n}", "func (h *Hub) SendAll(messageType int, data []byte) {\n\tlogger.Info.Println(\"message delivered to all:\", string(data), \"message type:\", messageType)\n\tfor client, _ := range h.Clients {\n\t\tclient.WriteMessage(messageType, data)\n\t}\n}", "func (c *clientWrapper) WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan interface{}, error) {\n\teventCh := make(chan interface{}, 1)\n\teventHandler := &resourceEventHandler{ev: eventCh}\n\n\tif len(namespaces) == 0 {\n\t\tnamespaces = []string{metav1.NamespaceAll}\n\t\tc.isNamespaceAll = true\n\t}\n\n\tc.watchedNamespaces = namespaces\n\n\tnotOwnedByHelm := func(opts *metav1.ListOptions) {\n\t\topts.LabelSelector = \"owner!=helm\"\n\t}\n\n\tlabelSelectorOptions := func(options *metav1.ListOptions) {\n\t\toptions.LabelSelector = c.labelSelector\n\t}\n\n\tc.factoryNamespace = informers.NewSharedInformerFactory(c.csKube, resyncPeriod)\n\tc.factoryNamespace.Core().V1().Namespaces().Informer().AddEventHandler(eventHandler)\n\n\tc.factoryGatewayClass = externalversions.NewSharedInformerFactoryWithOptions(c.csGateway, resyncPeriod, externalversions.WithTweakListOptions(labelSelectorOptions))\n\tc.factoryGatewayClass.Gateway().V1alpha2().GatewayClasses().Informer().AddEventHandler(eventHandler)\n\n\t// TODO manage Reference Policy\n\t// https://gateway-api.sigs.k8s.io/v1alpha2/references/spec/#gateway.networking.k8s.io/v1alpha2.ReferencePolicy\n\n\tfor _, ns := range namespaces {\n\t\tfactoryGateway := externalversions.NewSharedInformerFactoryWithOptions(c.csGateway, resyncPeriod, externalversions.WithNamespace(ns))\n\t\tfactoryGateway.Gateway().V1alpha2().Gateways().Informer().AddEventHandler(eventHandler)\n\t\tfactoryGateway.Gateway().V1alpha2().HTTPRoutes().Informer().AddEventHandler(eventHandler)\n\t\tfactoryGateway.Gateway().V1alpha2().TCPRoutes().Informer().AddEventHandler(eventHandler)\n\t\tfactoryGateway.Gateway().V1alpha2().TLSRoutes().Informer().AddEventHandler(eventHandler)\n\n\t\tfactoryKube := informers.NewSharedInformerFactoryWithOptions(c.csKube, resyncPeriod, informers.WithNamespace(ns))\n\t\tfactoryKube.Core().V1().Services().Informer().AddEventHandler(eventHandler)\n\t\tfactoryKube.Core().V1().Endpoints().Informer().AddEventHandler(eventHandler)\n\n\t\tfactorySecret := informers.NewSharedInformerFactoryWithOptions(c.csKube, resyncPeriod, informers.WithNamespace(ns), informers.WithTweakListOptions(notOwnedByHelm))\n\t\tfactorySecret.Core().V1().Secrets().Informer().AddEventHandler(eventHandler)\n\n\t\tc.factoriesGateway[ns] = factoryGateway\n\t\tc.factoriesKube[ns] = factoryKube\n\t\tc.factoriesSecret[ns] = factorySecret\n\t}\n\n\tc.factoryNamespace.Start(stopCh)\n\tc.factoryGatewayClass.Start(stopCh)\n\n\tfor _, ns := range namespaces {\n\t\tc.factoriesGateway[ns].Start(stopCh)\n\t\tc.factoriesKube[ns].Start(stopCh)\n\t\tc.factoriesSecret[ns].Start(stopCh)\n\t}\n\n\tfor t, ok := range c.factoryNamespace.WaitForCacheSync(stopCh) {\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"timed out waiting for controller caches to sync %s\", t.String())\n\t\t}\n\t}\n\n\tfor t, ok := range c.factoryGatewayClass.WaitForCacheSync(stopCh) {\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"timed out waiting for controller caches to sync %s\", t.String())\n\t\t}\n\t}\n\n\tfor _, ns := range namespaces {\n\t\tfor t, ok := range c.factoriesGateway[ns].WaitForCacheSync(stopCh) {\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"timed out waiting for controller caches to sync %s in namespace %q\", t.String(), ns)\n\t\t\t}\n\t\t}\n\n\t\tfor t, ok := range c.factoriesKube[ns].WaitForCacheSync(stopCh) {\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"timed out waiting for controller caches to sync %s in namespace %q\", t.String(), ns)\n\t\t\t}\n\t\t}\n\n\t\tfor t, ok := range c.factoriesSecret[ns].WaitForCacheSync(stopCh) {\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"timed out waiting for controller caches to sync %s in namespace %q\", t.String(), ns)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn eventCh, nil\n}", "func (csi ChannelStoreImpl) GetAll(db *gorm.DB) []models.Channel {\n\tchannels := []models.Channel{}\n\tdb.Find(&channels)\n\treturn channels\n}", "func (s *T) Subscriptions() <-chan map[string][]string {\n\treturn s.subscriptionsCh\n}", "func (t *Topic) Subscribe(ctx context.Context) <-chan interface{} {\n\tch := make(chan interface{})\n\tt.subs[ch] = ctx\n\treturn ch\n}", "func (c *Client) AllMessages() <-chan *Message {\n\treturn c.subs.subscribe(keyAnyMsg)\n}", "func (this *Publisher) Subscribe() <-chan gopi.Event {\n\tthis.Lock()\n\tdefer this.Unlock()\n\n\t// Create channels with a capacity of one\n\tif this.channels == nil {\n\t\tthis.channels = make([]chan gopi.Event, 0, 1)\n\t}\n\t// Return a new channel\n\tchannel := make(chan gopi.Event)\n\tthis.channels = append(this.channels, channel)\n\treturn channel\n}", "func (room *Room) subscribeToRoomMessages() {\n\tpubsub := room.redis.Subscribe(ctx, room.GetId())\n\n\tch := pubsub.Channel()\n\n\tfor msg := range ch {\n\t\troom.broadcastToClientsInRoom([]byte(msg.Payload))\n\t}\n}", "func (psc *PubSubChannel) Subscribe() *Subscription {\n psc.subsMutex.Lock()\n defer psc.subsMutex.Unlock()\n newSubscription := newSubscription(strconv.Itoa(psc.nextId))\n psc.nextId++\n psc.subscriptions = append(psc.subscriptions, &newSubscription)\n newSubscription.removeSub = func() {\n psc.subsMutex.Lock()\n defer psc.subsMutex.Unlock()\n\n for i, subscription := range psc.subscriptions {\n if subscription.signal == newSubscription.signal {\n fmt.Println(\"Unsubscribing\", \"id\", subscription.id)\n subscription.closed = true\n psc.subscriptions = append(psc.subscriptions[:i], psc.subscriptions[i+1:]...)\n }\n }\n }\n return &newSubscription\n}", "func InitiateConsumers(subscriptionMetaDataList []Subscription, reconnectInterval time.Duration) {\n\tfor _, subscriptionMetaData := range subscriptionMetaDataList {\n\t\tgo func(subscriptionMetaData Subscription) {\n\t\t\tstartBrokerConsumer(subscriptionMetaData, reconnectInterval)\n\t\t}(subscriptionMetaData)\n\t}\n}", "func (b *Broker) EventSubscribe(subscriptions []string) (events gp.MsgQueue) {\n\tcommands := make(chan gp.QueueCommand)\n\tmessages := make(chan []byte)\n\tevents = gp.MsgQueue{Commands: commands, Messages: messages}\n\tconn := b.pool.Get()\n\tpsc := redis.PubSubConn{Conn: conn}\n\tfor _, s := range subscriptions {\n\t\tpsc.Subscribe(s)\n\t}\n\tgo controller(&psc, events.Commands)\n\tgo messageReceiver(&psc, events.Messages)\n\tlog.Println(\"New websocket connection created.\")\n\treturn events\n}", "func (nch *NatsConnectionHandler) SubscribeToTopics(topics []string, messageHandler IKeptnNatsMessageHandler) error {\n\tif nch.natsURL == \"\" {\n\t\treturn errors.New(\"no PubSub URL defined\")\n\t}\n\n\tif nch.natsConnection == nil || !nch.natsConnection.IsConnected() {\n\t\tif err := nch.renewNatsConnection(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif nch.jetStream == nil {\n\t\tif err := nch.setupJetStreamContext(topics); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(topics) > 0 && !IsEqual(nch.topics, topics) {\n\t\tnch.RemoveAllSubscriptions()\n\t\tnch.topics = topics\n\n\t\tfor _, topic := range nch.topics {\n\t\t\tsubscription := NewPullSubscription(nch.ctx, queueGroup, topic, nch.jetStream, messageHandler.Process)\n\t\t\tif err := subscription.Activate(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"could not start subscription: %s\", err.Error())\n\t\t\t}\n\t\t\tnch.subscriptions = append(nch.subscriptions, subscription)\n\t\t}\n\t}\n\treturn nil\n}", "func (q subscriberQuery) All(ctx context.Context, exec boil.ContextExecutor) (SubscriberSlice, error) {\n\tvar o []*Subscriber\n\n\terr := q.Bind(ctx, exec, &o)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"models: failed to assign all query results to Subscriber slice\")\n\t}\n\n\tif len(subscriberAfterSelectHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterSelectHooks(ctx, exec); err != nil {\n\t\t\t\treturn o, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn o, nil\n}", "func ToSubscrible(eid string) {\n\tif alertSubscribeQueue == \"\" {\n\t\treturn\n\t}\n\tqueueCli.LPush(alertSubscribeQueue, eid)\n\tllen := queueCli.LLen(alertSubscribeQueue).Val()\n\tlog.Debug(\"lpush\", \"queue\", alertSubscribeQueue, \"eid\", eid, \"llen\", llen)\n\tif llen > 1e4 {\n\t\tqueueCli.LTrim(alertSubscribeQueue, 50, -1)\n\t\tlog.Debug(\"ltrim\", \"queue\", alertSubscribeQueue)\n\t}\n}", "func (b *Broker) Broadcast(payload interface{}, topics ...string) {\n\tfor _, topic := range topics {\n\t\tfor _, s := range b.topics[topic] {\n\t\t\tm := &Message{\n\t\t\t\ttopic: topic,\n\t\t\t\tpayload: payload,\n\t\t\t\tcreatedAt: time.Now().UnixNano(),\n\t\t\t}\n\t\t\tgo (func(s *Subscriber) {\n\t\t\t\ts.Signal(m)\n\t\t\t})(s)\n\t\t}\n\t}\n}", "func (h *clientHub) Broadcast(ch string, message []byte) error {\n\th.RLock()\n\tdefer h.RUnlock()\n\n\t// get connections currently subscribed on channel\n\tchannelSubscriptions, ok := h.subs[ch]\n\tif !ok {\n\t\treturn nil\n\t}\n\n\t// iterate over them and send message individually\n\tmsg := NewQueuedMessage(message, true)\n\n\tfor uid := range channelSubscriptions {\n\t\tc, ok := h.conns[uid]\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tc.Send(msg)\n\t}\n\treturn nil\n}", "func (r *Raft) sendToAll(msg interface{}) {\n\t//fmt.Println(\"Server-Raft map:\", server_raft_map)\n\tfor k := range server_raft_map {\n\t\t//fmt.Println(\"Id from map is:\", k, r.Myconfig.Id)\n\t\tif r.Myconfig.Id != k { //send to all except self\n\t\t\tgo send(k, msg) //removed go\n\t\t\t//fmt.Println(\"After sending RV\")\n\t\t}\n\t}\n\n}", "func (c *CoordinatorHelper) BroadcastAll(\n\tctx context.Context,\n) error {\n\treturn c.broadcastStorage.BroadcastAll(ctx, true)\n}", "func (q *Qlient) SubOn(topic string) (chan []byte, error) {\n\tsub, ok := q.subs[topic]\n\tif !ok {\n\t\tvar err error\n\t\tsub, err = q.newConsumer(topic)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn sub, nil\n}", "func (m *Client) Subscribe() chan proto.Payload {\n\tmessages := make(chan proto.Payload)\n\ttq := []proto.TopicQos{proto.TopicQos{Topic: m.topic, Qos: 0}}\n\tm.client.Subscribe(tq)\n\tgo func() {\n\t\tdefer close(messages)\n\t\tfor message := range m.client.Incoming {\n\t\t\tmessages <- message.Payload\n\t\t}\n\t}()\n\treturn messages\n}", "func (l *Logs) Subscribe(uuid string) (\n\tchan []byte, chan []byte, error,\n) {\n\tlogChan, err := l.GetChannel(uuid)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tschan, echan := messaging.CreateSubscriptionChannels()\n\tl.nub.Subscribe(logChan, \"\", schan, false, echan)\n\treturn schan, echan, nil\n\n}", "func (s *server) Subscribe(p *Chat_Consumer, stream ChatService_SubscribeServer) error {\n\tep := s.read_ep(p.Id)\n\tif ep == nil {\n\t\tlog.Errorf(\"cannot find endpoint %v\", p)\n\t\treturn ERROR_NOT_EXISTS\n\t}\n\n\tconsumerid := atomic.AddUint64(&s.consumerid_autoinc, 1)\n\te := make(chan error, 1)\n\n\t// activate consumer\n\tep.mu.Lock()\n\n\t// from newest\n\tif p.From == -1 {\n\t\tp.From = ep.StartOffset + int64(len(ep.Inbox))\n\t}\n\tep.consumers[consumerid] = &Consumer{p.From, func(msg *Chat_Message) {\n\t\tif err := stream.Send(msg); err != nil {\n\t\t\tselect {\n\t\t\tcase e <- err:\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t}}\n\tep.mu.Unlock()\n\tdefer func() {\n\t\tep.mu.Lock()\n\t\tdelete(ep.consumers, consumerid)\n\t\tep.mu.Unlock()\n\t}()\n\n\tep.notifyConsumers()\n\n\tselect {\n\tcase <-stream.Context().Done():\n\tcase err := <-e:\n\t\treturn err\n\t}\n\treturn nil\n}", "func (m *MockHub) BroadcastToAllClients(handler model.EventMetadata) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"BroadcastToAllClients\", handler)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func init() {\n\tgo func(ch <-chan string, chClose <-chan struct{}) {\n\t\tfor true {\n\t\t\tselect {\n\t\t\tcase msg := <-ch:\n\t\t\t\tOutMessageToAll(msg)\n\t\t\tcase <-chClose:\n\t\t\t\tclose(models.CancelChOutMessageToAll)\n\t\t\t\tclose(models.ChOutMessageToAll)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}(models.ChOutMessageToAll, models.CancelChOutMessageToAll)\n}", "func EventSubscribeH(w http.ResponseWriter, r *http.Request) {\n\n\tlog.V(logLevel).Debugf(\"%s:subscribe:> subscribe on subscribe\", logPrefix)\n\n\tif r.Method != \"GET\" {\n\t\thttp.Error(w, \"Method not allowed\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\tlog.V(logLevel).Debugf(\"%s:subscribe:> watch all events\", logPrefix)\n\n\tvar (\n\t\tsm = distribution.NewServiceModel(r.Context(), envs.Get().GetStorage())\n\t\tnm = distribution.NewNamespaceModel(r.Context(), envs.Get().GetStorage())\n\t\tcm = distribution.NewClusterModel(r.Context(), envs.Get().GetStorage())\n\t\tdone = make(chan bool, 1)\n\t)\n\n\tconn, err := upgrader.Upgrade(w, r, nil)\n\tif err != nil {\n\t\tlog.V(logLevel).Debugf(\"%s:subscribe:> set websocket upgrade err: %s\", logPrefix, err.Error())\n\t\treturn\n\t}\n\n\tticker := time.NewTicker(time.Second)\n\tdefer ticker.Stop()\n\n\tvar serviceEvents = make(chan types.ServiceEvent)\n\tvar namespaceEvents = make(chan types.NamespaceEvent)\n\tvar clusterEvents = make(chan types.ClusterEvent)\n\n\tnotify := w.(http.CloseNotifier).CloseNotify()\n\n\tgo func() {\n\t\t<-notify\n\t\tlog.V(logLevel).Debugf(\"%s:subscribe:> HTTP connection just closed.\", logPrefix)\n\t\tdone <- true\n\t}()\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-done:\n\t\t\t\tclose(serviceEvents)\n\t\t\t\tclose(namespaceEvents)\n\t\t\t\tclose(clusterEvents)\n\t\t\t\treturn\n\t\t\tcase e := <-clusterEvents:\n\n\t\t\t\tvar data interface{}\n\t\t\t\tif e.Data == nil {\n\t\t\t\t\tdata = nil\n\t\t\t\t} else {\n\t\t\t\t\tdata = v1.View().Cluster().New(e.Data)\n\t\t\t\t}\n\n\t\t\t\tevent := Event{\n\t\t\t\t\tEntity: \"cluster\",\n\t\t\t\t\tAction: e.Action,\n\t\t\t\t\tName: e.Name,\n\t\t\t\t\tData: data,\n\t\t\t\t}\n\n\t\t\t\tif err = conn.WriteJSON(event); err != nil {\n\t\t\t\t\tlog.Errorf(\"%s:subscribe:> write cluster event to socket error.\", logPrefix)\n\t\t\t\t}\n\t\t\tcase e := <-serviceEvents:\n\n\t\t\t\tvar data interface{}\n\t\t\t\tif e.Data == nil {\n\t\t\t\t\tdata = nil\n\t\t\t\t} else {\n\t\t\t\t\tdata = v1.View().Service().New(e.Data)\n\t\t\t\t}\n\n\t\t\t\tevent := Event{\n\t\t\t\t\tEntity: \"service\",\n\t\t\t\t\tAction: e.Action,\n\t\t\t\t\tName: e.Name,\n\t\t\t\t\tData: data,\n\t\t\t\t}\n\n\t\t\t\tif err = conn.WriteJSON(event); err != nil {\n\t\t\t\t\tlog.Errorf(\"%s:subscribe:> write service event to socket error.\", logPrefix)\n\t\t\t\t}\n\t\t\tcase e := <-namespaceEvents:\n\n\t\t\t\tvar data interface{}\n\t\t\t\tif e.Data == nil {\n\t\t\t\t\tdata = nil\n\t\t\t\t} else {\n\t\t\t\t\tdata = v1.View().Namespace().New(e.Data)\n\t\t\t\t}\n\n\t\t\t\tevent := Event{\n\t\t\t\t\tEntity: \"namespace\",\n\t\t\t\t\tAction: e.Action,\n\t\t\t\t\tName: e.Name,\n\t\t\t\t\tData: data,\n\t\t\t\t}\n\n\t\t\t\tif err = conn.WriteJSON(event); err != nil {\n\t\t\t\t\tlog.Errorf(\"%s:subscribe:> write namespace event to socket error.\", logPrefix)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\tgo cm.Watch(clusterEvents)\n\tgo sm.Watch(serviceEvents, nil)\n\tgo nm.Watch(namespaceEvents)\n\n\tgo func() {\n\t\tfor range ticker.C {\n\t\t\tif err := conn.WriteMessage(websocket.TextMessage, []byte{}); err != nil {\n\t\t\t\tlog.Errorf(\"%s:subscribe:> writing to the client websocket err: %s\", logPrefix, err.Error())\n\t\t\t\tdone <- true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}()\n\n\t<-done\n}", "func (m *Manager) WriteStreamAll(name, mimeType string, body <-chan StreamEvent, dlo bool) (errs error) {\n\n\tvar eg errgroup.Group\n\tstreamConsumer := make(map[string]Storage, len(m.storageServices))\n\tchanConsumer := make(map[string]ChannelWriter, len(m.storageServices))\n\n\tfor k, s := range m.storageServices {\n\t\tif w, ok := s.(ChannelWriter); ok {\n\t\t\tchanConsumer[k] = w\n\t\t} else {\n\t\t\tstreamConsumer[k] = s\n\t\t}\n\t}\n\n\t// connect all io.Reader consumer with a reader\n\treaders, writer, closer := m.createIOReaders(len(streamConsumer))\n\ti := 0\n\tfor _, s := range streamConsumer {\n\t\tfunc(i int, w Storage) {\n\t\t\teg.Go(func() error {\n\t\t\t\treturn w.WriteStream(name, mimeType, readers[i], nil, dlo)\n\t\t\t})\n\t\t}(i, s)\n\t\ti++\n\t}\n\n\t// connect all channel consumer with a channel\n\tchannels := m.createChannels(len(chanConsumer))\n\ti = 0\n\tfor _, s := range chanConsumer {\n\t\tfunc(i int, w ChannelWriter) {\n\t\t\teg.Go(func() error {\n\t\t\t\treturn w.WriteChannel(name, mimeType, channels[i], nil, dlo)\n\t\t\t})\n\t\t}(i, s)\n\t\ti++\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tv, ok := <-body\n\t\t\tif !ok {\n\t\t\t\t// Close all Reader, Writer and channels\n\t\t\t\tif closer != nil {\n\t\t\t\t\tcloser.Close()\n\t\t\t\t}\n\t\t\t\tfor _, c := range channels {\n\t\t\t\t\tclose(c)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// write bytes all io.Reader consumer\n\t\t\tif len(streamConsumer) > 0 {\n\t\t\t\twriter.Write(v.ToByte())\n\t\t\t}\n\t\t\t// send the event as is to all channel consumer\n\t\t\tfor _, c := range channels {\n\t\t\t\tc <- v\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn eg.Wait()\n}", "func New() *PubSubChannel {\n return &PubSubChannel{\n subscriptions: make([]*Subscription, 0),\n }\n}", "func (psc *PubSubChannel) Publish(msg interface{}) {\n psc.subsMutex.RLock()\n defer psc.subsMutex.RUnlock()\n for i, sub := range psc.subscriptions {\n if sub.closed {\n fmt.Println(\"Subscription was closed\", \"id\", sub.id)\n sub.closeChannel()\n } else {\n go func(sub *Subscription, index int) {\n sub.signal <- msg\n }(sub, i)\n\n }\n }\n}", "func Subscribe(topic string) (<-chan []byte, error) {\n\treturn Default.Subscribe(topic)\n}", "func BroadcastAll(message socket.RawMessage) {\n\tinstance.mutex.RLock()\n\tinstance.broadcast(uuid.Nil, message)\n\tinstance.mutex.RUnlock()\n}", "func (sn *SimNode) SubscribeEvents(ch chan *p2p.PeerEvent) event.Subscription {\n\tsrv := sn.Server()\n\tif srv == nil {\n\t\tpanic(\"node not running\")\n\t}\n\treturn srv.SubscribeEvents(ch)\n}", "func (q *Qlient) Sub() (chan []byte, error) {\n\treturn q.SubOn(q.config.Topic)\n}", "func (fs *FilterStorage) getSubscribersByTopic(topic Topic) []*Filter {\n\tres := make([]*Filter, 0, len(fs.topicToFilters[topic]))\n\tfor subscriber := range fs.topicToFilters[topic] {\n\t\tres = append(res, subscriber)\n\t}\n\treturn res\n}", "func InitiateConsumers(connectionString string, subscriptionMetaDataList []Subscription, reconnectInterval time.Duration) {\n\tfor _, subscriptionMetaData := range subscriptionMetaDataList {\n\t\tgo func(subscriptionMetaData Subscription) {\n\t\t\tstartBrokerConsumer(connectionString, subscriptionMetaData, reconnectInterval)\n\t\t}(subscriptionMetaData)\n\t}\n}", "func (h *clientHub) Channels() []string {\n\th.RLock()\n\tdefer h.RUnlock()\n\tchannels := make([]string, len(h.subs))\n\ti := 0\n\tfor ch := range h.subs {\n\t\tchannels[i] = ch\n\t\ti++\n\t}\n\treturn channels\n}", "func (pubsub *MemoryEventStore) Subscribe(topics ...string) <-chan Event {\n\tsub := subscription{\n\t\ttopics: topics,\n\t\tch: make(chan Event, pubsub.buffer),\n\t}\n\tpubsub.subscriptions = append(pubsub.subscriptions, sub)\n\treturn sub.ch\n}", "func (k *Kafka) Subscribe(topic string, h broker.Handler, opts ...broker.SubscribeOption) (broker.Subscriber, error) {\n\n\top := &broker.SubscribeOptions{\n\t\tAutoAck: true,\n\t}\n\top.Apply(opts...)\n\n\tvar err error\n\t//handler function\n\thandler := func(msg *sarama.ConsumerMessage) {\n\t\tm := broker.Message{}\n\t\tif err := k.encoder.Decode(msg.Value, &m); err != nil {\n\t\t\tlog.Errorf(\"kafka: subscribe: decode failed, err: %v\", err)\n\t\t\treturn\n\t\t}\n\t\th(&event{\n\t\t\top: op,\n\t\t\tt: topic,\n\t\t\tm: &m,\n\t\t})\n\t}\n\t//Consumer with no groupID\n\tif op.Queue == \"\" {\n\t\tlog.Info(\"consumer with no groupID\")\n\t\t// Create new consumer\n\t\tk.consumer, err = sarama.NewConsumer(strings.Split(k.addrs, \",\"), k.config)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpartitionList, err := k.consumer.Partitions(topic)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor partition := range partitionList {\n\t\t\tconsumer, err := k.consumer.ConsumePartition(topic, int32(partition), sarama.OffsetNewest)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tgo func() {\n\t\t\t\tfor msg := range consumer.Messages() {\n\t\t\t\t\thandler(msg)\n\t\t\t\t}\n\t\t\t}()\n\t\t}\n\t\treturn &subscriber{\n\t\t\tqueue: op.Queue,\n\t\t\tt: topic,\n\t\t\ts: k.consumer,\n\t\t}, nil\n\n\t} //end no group\n\t{\n\t\t// Create new consumer group\n\t\tif k.consumerGroup, err = sarama.NewConsumerGroup([]string{k.addrs}, op.Queue, k.config); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tctx := context.Background()\n\t\tconsumer := Consumer{\n\t\t\tencoder: k.encoder,\n\t\t\ttopic: topic,\n\t\t\th: h,\n\t\t\tready: make(chan bool),\n\t\t}\n\t\tgo func() {\n\t\t\tfor {\n\n\t\t\t\tif err := k.consumerGroup.Consume(ctx, []string{topic}, &consumer); err != nil {\n\t\t\t\t\tlog.Panicf(\"Error from consumer: %v\", err)\n\t\t\t\t}\n\t\t\t\t<-ctx.Done()\n\n\t\t\t\tif ctx.Err() != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t\t<-consumer.ready // Await till the consumer has been set up\n\t\tlog.Info(\"Sarama consumer up and running!...\")\n\n\t\treturn &subscriberGroup{\n\t\t\tqueue: op.Queue,\n\t\t\tt: topic,\n\t\t\tg: k.consumerGroup,\n\t\t}, nil\n\t}\n\n}" ]
[ "0.6937696", "0.58796257", "0.5855679", "0.5842687", "0.57394993", "0.5554731", "0.55545205", "0.5499015", "0.5495352", "0.54776376", "0.54013604", "0.53748983", "0.5313518", "0.52899235", "0.52726644", "0.52343976", "0.5234129", "0.5231414", "0.52018505", "0.51724696", "0.5146893", "0.5124124", "0.51228034", "0.5119867", "0.5063982", "0.5055968", "0.5052854", "0.50512874", "0.5045787", "0.5044471", "0.50293785", "0.5029157", "0.4974806", "0.49735984", "0.49622694", "0.4960119", "0.4958846", "0.49544632", "0.49536127", "0.49450055", "0.49413043", "0.49371743", "0.49094644", "0.49052256", "0.48925218", "0.4877531", "0.4874422", "0.48737738", "0.48612988", "0.48444572", "0.48435542", "0.4841446", "0.48391432", "0.48314726", "0.48190874", "0.48169947", "0.47982976", "0.47967124", "0.47957534", "0.4790064", "0.47900102", "0.47893804", "0.47882164", "0.47874537", "0.47869125", "0.4785707", "0.47734985", "0.47700518", "0.47616863", "0.4759079", "0.4756172", "0.4752999", "0.474615", "0.4738781", "0.47370353", "0.4728834", "0.47235453", "0.47203928", "0.47122544", "0.47121042", "0.46997878", "0.4697453", "0.4691208", "0.46878347", "0.4682957", "0.46807426", "0.46793288", "0.46781337", "0.4677115", "0.46737078", "0.46686316", "0.46383542", "0.46199664", "0.4619583", "0.46176183", "0.46140867", "0.461281", "0.46100703", "0.4589315", "0.45874584" ]
0.78876483
0
RegisterStrategy allows a different RoutingStrategy to be specified for a given topic
RegisterStrategy позволяет указать разный RoutingStrategy для заданной темы
func (n *Node) RegisterStrategy(topic string, strategy RoutingStrategy) { n.strategyMap[topic] = strategy }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func RegisterStrategy(info *StrategyInfo) {\n\tstrategyRegistry = append(strategyRegistry, info)\n}", "func RoutingStrategy(r RoutingStrategyType) metaOp {\n\treturn func(m *PluginMeta) {\n\t\tm.RoutingStrategy = r\n\t}\n}", "func (t Twitter) registerRoutes(r *mux.Router) {\n\n}", "func (n networkRoute) Register(m *mux.Router, handler http.Handler) {\n}", "func NewTopicRouter(br fiber.Router, conn *config.DBConn) {\n\trouter := br.Group(\"/topics\")\n\ttopicRepo := repository.NewTopicRepository(conn)\n\tpostRepo := repository.NewPostRepository(conn)\n\tuserRepo := repository.NewUserRepository(conn)\n\ttopicService := services.NewTopicService(topicRepo, postRepo, userRepo)\n\ttopicController := controllers.NewTopicController(topicService)\n\n\trouter.Get(\"/:id\", topicController.GetOne)\n\trouter.Get(\"/\", topicController.GetAll)\n\trouter.Post(\"/\", topicController.Create)\n}", "func (group *RouterGroup) register(method string, subpattern string, handler HandlerFunc) {\n\tpattern := path.Join(group.prefix + subpattern)\n\tgroup.engine.router.addRoute(method, pattern, handler)\n}", "func (r *LazyRouter) SetStrategy(strategy RoutingStrategy) {\n\tr.strategy = &baseRoutingStrategy{RoutingStrategy: strategy}\n}", "func (s Site) AddTopic(t string) {\n\ts.Handler.HandleFunc(\"/\"+t+\"/\", s.TopicHandler)\n\ts.Handler.HandleFunc(\"/nominate/\"+t+\"/\", s.NominateHandler)\n}", "func RegisterPlugin(key string, strategy ACLStrategy) {\n\tstrategiesMutex.Lock()\n\tdefer strategiesMutex.Unlock()\n\n\tif strategies == nil {\n\t\tstrategies = make(map[string]ACLStrategy)\n\t}\n\n\tstrategies[key] = strategy\n}", "func RegisterTransport(name string, transport TransportFactory) {\n\ttransportFactories[name] = transport\n}", "func (h *Hookbot) AddRouter(r Router) {\n\tfor _, topic := range r.Topics() {\n\t\th.wg.Add(1)\n\t\tgo func() {\n\t\t\tdefer h.wg.Done()\n\n\t\t\tl := h.Add(topic)\n\t\t\tfor m := range l.c {\n\t\t\t\tr.Route(m, h.Publish)\n\t\t\t}\n\t\t}()\n\t}\n}", "func (h *BasicHost) RegisterProtocol(\n\tpid common.Pid,\n\thandler ProtocolHandler,\n\tadapters ...ProtocolAdapter,\n) {\n\th.host.SetStreamHandler(pid.ProtocolID(), func(stream net.Stream) {\n\t\tdefer stream.Reset()\n\t\tmsg, err := common.ReadMessage(stream)\n\t\tif err != nil {\n\t\t\tlog.Println(\"failed to read message from stream :\", err)\n\t\t\treturn\n\t\t}\n\t\tgo handler.Handle(adapters...)(msg)\n\t})\n}", "func addRoutes(p *nats.Conn) {\n\tr := mux.NewRouter()\n\tr.Methods(\"POST\").Path(\"/topics/{topic}\").Handler(\n\t\thandlers.LoggingHandler(os.Stdout, handler(p, topic)))\n\tr.Methods(\"POST\").Path(\"/requests/{topic}\").Handler(\n\t\thandlers.LoggingHandler(os.Stdout, handler(p, request)))\n\thttp.Handle(\"/\", r)\n}", "func registerRoutes(jwtMiddleware *jwtmiddleware.JWTMiddleware) *mux.Router {\n\tr := mux.NewRouter()\n\n\tr.Handle(\"/healthcheck\", http.HandlerFunc(healthCheck)).Methods(\"GET\")\n\n\tr.Handle(\"/message\", http.HandlerFunc(message)).Methods(\"POST\")\n\tr.Handle(\"/message/{id}\", http.HandlerFunc(messageDelete)).Methods(\"DELETE\")\n\tr.Handle(\"/publish\", http.HandlerFunc(publish)).Methods(\"POST\")\n\n\tmsgRouter := mux.NewRouter().PathPrefix(\"/message\").Subrouter()\n\tpubRouter := mux.NewRouter().PathPrefix(\"/publish\").Subrouter()\n\n\tr.PathPrefix(\"/message\").Handler(negroni.New(\n\t\tnegroni.HandlerFunc(jwtMiddleware.HandlerWithNext),\n\t\tnegroni.Wrap(msgRouter),\n\t))\n\n\tr.PathPrefix(\"/publish\").Handler(negroni.New(\n\t\tnegroni.HandlerFunc(jwtMiddleware.HandlerWithNext),\n\t\tnegroni.Wrap(pubRouter),\n\t))\n\n\t// GET - handles upgrading http/https connections to ws/wss.\n\t// the JWT middleware is expecting an access_token\n\t// query parameter within the request\n\tr.Handle(\"/ws\", negroni.New(\n\t\tnegroni.HandlerFunc(jwtMiddleware.HandlerWithNext),\n\t\tnegroni.HandlerFunc(AddUserID),\n\t\tnegroni.Wrap(broker),\n\t))\n\n\treturn r\n}", "func RegisterTopologyAPI(r *shttp.Server, g *graph.Graph, parser *traversal.GremlinTraversalParser, authBackend shttp.AuthenticationBackend, extraMarshallers map[string]TopologyMarshaller) {\n\tt := &TopologyAPI{\n\t\tgremlinParser: parser,\n\t\tgraph: g,\n\t\textraMarshallers: extraMarshallers,\n\t}\n\n\tt.registerEndpoints(r, authBackend)\n}", "func RegisterTransport(scheme string, transport Transport) Transport {\n\treturn DefaultTransport.(*defaultTransport).registerTransport(scheme, transport)\n}", "func (api *api) RegisterRouting(g *echo.Group) {\n\n\tgrp := g.Group(\"/v2/products\")\n\tgrp.GET(\"\", api.Service.List)\n\tgrp.GET(\"/:id\", api.Service.Get)\n\tgrp.POST(\"\", api.Service.Create)\n\tgrp.PUT(\"/:id\", api.Service.Update)\n\tgrp.DELETE(\"/:id\", api.Service.Delete)\n\n}", "func (a *API) RegisterDistributor(d *distributor.Distributor, pushConfig distributor.Config) {\n\ta.RegisterRoute(\"/api/v1/push\", push.Handler(pushConfig, d.Push), true)\n\ta.RegisterRoute(\"/distributor/all_user_stats\", http.HandlerFunc(d.AllUserStatsHandler), false)\n\ta.RegisterRoute(\"/distributor/ha_tracker\", d.HATracker, false)\n\n\t// Legacy Routes\n\ta.RegisterRoute(a.cfg.LegacyHTTPPrefix+\"/push\", push.Handler(pushConfig, d.Push), true)\n\ta.RegisterRoute(\"/all_user_stats\", http.HandlerFunc(d.AllUserStatsHandler), false)\n\ta.RegisterRoute(\"/ha-tracker\", d.HATracker, false)\n}", "func registerRoutes(router *httprouter.Router, ctrl *webhook.Controller) {\n\trouter.POST(\"/auto-deploy/docker-hub\", ctrl.AutoDeployDockerHub)\n}", "func NewStrategy(typer runtime.ObjectTyper) clusterStrategy {\n\treturn clusterStrategy{typer, names.SimpleNameGenerator}\n}", "func init() {\n\t_ = router.Register(\"httprouter\", New)\n}", "func RegisterProcessor(topic string, mp MessageProcessor) {\n\tClient.topicProcessors[topic] = mp\n}", "func registerEndpoint(pattern string, methods []string, fn unboundEndpoint) {\n\tif endpoints == nil {\n\t\tendpoints = make(map[string]unboundEndpoint)\n\t}\n\tif endpoints[pattern] != nil || allowedMethods[pattern] != nil {\n\t\tpanic(fmt.Errorf(\"Pattern %q is already registered\", pattern))\n\t}\n\n\tendpoints[pattern] = fn\n\tallowedMethods[pattern] = methods\n}", "func (w Ws) Register(r *gin.RouterGroup) {\n\tst := r.Group(\"\")\n\tst.GET(\"/ws/:id\", w.Server)\n\tst.DELETE(\"/ws/:id\", w.Offline)\n\tst.PUT(\"/ws/:id\", w.Dispatch)\n}", "func (a *AApi) registerRoute(f func(http.ResponseWriter, *http.Request), path string, methods ...string) {\n\ta.logger.WithField(\"func\", \"registerRoute\").\n\t\tDebugf(\"Initializing route %s with methods: %v\", path, methods)\n\ta.router.HandleFunc(path, f).Name(path).Methods(methods...) // Name if set for ability to exclude route from authz\n}", "func registerRoutes() {\n\tuserRoutes()\n\troleRoutes()\n}", "func (route *baseRoute) addDestination(dest *Destination, extendConfig baseConfigExtender) {\n\troute.Lock()\n\tdefer route.Unlock()\n\tconf := route.config.Load().(RouteConfig)\n\tdest.Run()\n\tnewDests := append(conf.Dests(), dest)\n\tnewConf := extendConfig(baseRouteConfig{*conf.Matcher(), newDests})\n\troute.config.Store(newConf)\n}", "func Register(router *mux.Router) {\n\ttodoRoutes(router)\n\tuserRoutes(router)\n}", "func (_Flytrap *FlytrapSession) AddTopic(topic string, country [2]byte, addPubCost *big.Int, addSubCost *big.Int, reason string, sensitive bool) (*types.Transaction, error) {\n\treturn _Flytrap.Contract.AddTopic(&_Flytrap.TransactOpts, topic, country, addPubCost, addSubCost, reason, sensitive)\n}", "func (k *Keeper) RegisterRoute(moduleName, route string, invar sdk.Invariant) {\n\tinvarRoute := NewInvarRoute(moduleName, route, invar)\n\tk.routes = append(k.routes, invarRoute)\n}", "func (m *MessageProcessor) Register(topic topics.Topic, fn ProcessorFunc) {\n\tm.processors[topic] = fn\n}", "func (_Flytrap *FlytrapTransactorSession) AddTopic(topic string, country [2]byte, addPubCost *big.Int, addSubCost *big.Int, reason string, sensitive bool) (*types.Transaction, error) {\n\treturn _Flytrap.Contract.AddTopic(&_Flytrap.TransactOpts, topic, country, addPubCost, addSubCost, reason, sensitive)\n}", "func (s *Switch) RegisterGossipProtocol(protocol string, prio priorityq.Priority) chan service.GossipMessage {\n\tif s.started == 1 {\n\t\tlog.Panic(\"attempt to register gossip protocol after p2p has started\")\n\t}\n\tmchan := make(chan service.GossipMessage, s.config.BufferSize)\n\ts.gossip.SetPriority(protocol, prio)\n\ts.gossipProtocolHandlers[protocol] = mchan\n\treturn mchan\n}", "func NewFeedRewardStrategyRegister(feedRewardStrategyFns map[string]FeedRewardStrategyFunc) {\n\tif feedRewardStrategyFns == nil {\n\t\treturn\n\t}\n\n\tfor name := range feedRewardStrategyFns {\n\t\tif name == \"\" {\n\t\t\tpanic(\"feed reward strategy name can not be empty\")\n\t\t}\n\t}\n\n\tFeedRewardStrategyConvertor = feedRewardStrategyFns\n}", "func RegisterCompactor(topic string, compactor interface{}) {\n\tpanic(\"not implemented\")\n}", "func (n networkRoute) Register(m *mux.Router, handler http.Handler) {\n\tlogrus.Debugf(\"Registering %s, %v\", n.path, httpMethods)\n\tsubrouter := m.PathPrefix(router.VersionMatcher + n.path).Subrouter()\n\tsubrouter.Methods(httpMethods...).Handler(handler)\n\n\tsubrouter = m.PathPrefix(n.path).Subrouter()\n\tsubrouter.Methods(httpMethods...).Handler(handler)\n}", "func switchRouter(defaultHandler http.Handler, proxySrv *pServer.HttpServer) func(config dynamic.Configuration) {\n\treturn func(config dynamic.Configuration) {\n\t\tlog.Info(\"===Starting SwitchRouter====\")\n\t\trouterTemp, err := router.NewRouter()\n\t\tif err != nil {\n\t\t\tlog.Info(\"Failed to create router \", err)\n\t\t\t// return nil, err\n\t\t}\n\t\tlog.Infof(\"buildHandler : %v \\n\", config.Routers)\n\t\tfor name, value := range config.Routers {\n\t\t\tlog.Infof(\"Create Hypercloud proxy based on %v: %v \\n\", name, value)\n\t\t\tbackURL, err := url.Parse(value.Server)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(errors.Wrapf(err, \"URL Parsing failed for: %s\", value.Server))\n\t\t\t}\n\t\t\tdhconfig := &proxy.Config{\n\t\t\t\tTLSClientConfig: &tls.Config{\n\t\t\t\t\tInsecureSkipVerify: true,\n\t\t\t\t\tCipherSuites: crypto.DefaultCiphers(),\n\t\t\t\t},\n\t\t\t\tHeaderBlacklist: []string{\"X-CSRFToken\"},\n\t\t\t\tEndpoint: backURL,\n\t\t\t}\n\t\t\tdhproxy := proxy.NewProxy(dhconfig)\n\t\t\terr = routerTemp.AddRoute(value.Rule, 0, http.StripPrefix(value.Path, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\t\ttoken := r.Header.Clone().Get(\"Authorization\")\n\t\t\t\ttemp := strings.Split(token, \"Bearer \")\n\t\t\t\tif len(temp) > 1 {\n\t\t\t\t\ttoken = temp[1]\n\t\t\t\t} else {\n\t\t\t\t\ttoken = temp[0]\n\t\t\t\t}\n\t\t\t\t// NOTE: query에 token 정보가 있을 시 해당 token으로 설정\n\t\t\t\tqueryToken := r.URL.Query().Get(\"token\")\n\t\t\t\tif queryToken != \"\" && token == \"\" {\n\t\t\t\t\tr.URL.Query().Del(\"token\")\n\t\t\t\t\ttoken = queryToken\n\t\t\t\t}\n\t\t\t\tr.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %s\", token))\n\t\t\t\tdhproxy.ServeHTTP(w, r)\n\t\t\t})))\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"failed to put proxy handler into Router\", err)\n\t\t\t}\n\t\t}\n\t\terr = routerTemp.AddRoute(\"PathPrefix(`/api/console/dynamic`)\", 0, http.HandlerFunc(\n\t\t\tfunc(rw http.ResponseWriter, r *http.Request) {\n\t\t\t\trw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\t\terr := json.NewEncoder(rw).Encode(config)\n\t\t\t\tif err != nil {\n\t\t\t\t\thttp.NotFound(rw, r)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t},\n\t\t))\n\t\tif err != nil {\n\t\t\tlog.Error(\"/api/k8sAll/ has a problem\", err)\n\t\t}\n\n\t\terr = routerTemp.AddRoute(\"PathPrefix(`/`)\", 0, defaultHandler)\n\t\tif err != nil {\n\t\t\tlog.Error(\"failed to put hypercloud proxy\", err)\n\t\t\t// return nil, err\n\t\t}\n\n\t\tlog.Info(\"===End SwitchRouter ===\")\n\t\tlog.Info(\"Call updateHandler --> routerTemp.Router\")\n\t\t// olderSrv:=proxySrv.Handler.Switcher.GetHandler()\n\n\t\tif proxySrv.Switcher.GetHandler() == nil {\n\t\t\tproxySrv.Switcher.UpdateHandler(http.NotFoundHandler())\n\t\t}\n\n\t\tproxySrv.Switcher.UpdateHandler(routerTemp)\n\n\t}\n}", "func RegisterProtocol(messageProtocolID uint16, p Protocol) {\n\tprotocolRegistry[messageProtocolID] = p\n}", "func RegisterSink(scheme string, factory func(*url.URL) (Sink, error)) error {\n\t_sinkMutex.Lock()\n\tdefer _sinkMutex.Unlock()\n\n\tif scheme == \"\" {\n\t\treturn errors.New(\"can't register a sink factory for empty string\")\n\t}\n\tnormalized, err := normalizeScheme(scheme)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%q is not a valid scheme: %v\", scheme, err)\n\t}\n\tif _, ok := _sinkFactories[normalized]; ok {\n\t\treturn fmt.Errorf(\"sink factory already registered for scheme %q\", normalized)\n\t}\n\t_sinkFactories[normalized] = factory\n\treturn nil\n}", "func RegisterTransport(typ string, ctor TransportConstructor) {\n\ttransportTypes[typ] = ctor\n}", "func (m *Mesh) Subscribe(tp Topic, fn func(interface{})) {\n\tswitch tp {\n\tcase TOPIC_NODE:\n\t\tm.topic[tp] = append(m.topic[tp], fn)\n\tcase TOPIC_DATA:\n\tdefault:\n\t\tlog.WithField(\"topic\", tp).Error(\"invalid topic\")\n\t}\n}", "func RegisterPeerProvider(scheme string, pp PeerProvider) {\n\tregistry[scheme] = pp\n}", "func (p *JSONProtocol) Register(msg interface{}) {\n\tt := reflect.TypeOf(msg)\n\tif t.Kind() == reflect.Ptr {\n\t\tt = t.Elem()\n\t}\n\tname := t.PkgPath() + \"/\" + t.Name()\n\tp.types[name] = t\n\tp.names[t] = name\n}", "func RegisterTopics(topicNames ...string) {\n\tfor _, n := range topicNames {\n\t\tregisterTopic(n)\n\t}\n}", "func Register(scheme string, b Broker) {\n\tbrokerRegistery[scheme] = b\n}", "func (r *Router) AddWith(name, pattern, providerName, from string, isActive bool) error {\n\troute := r.Get(name)\n\tif route != nil {\n\t\treturn errors.New(\"route already exists\")\n\t}\n\tprovider := r.GetProvider(providerName)\n\tif provider == nil {\n\t\treturn errors.New(\"provider not found\")\n\t}\n\treturn r.Add(model.NewRoute(name, pattern, provider, isActive).SetFrom(from))\n}", "func InjectRoutingService(\n\truntime env.Runtime,\n\tprefix provider.LogPrefix,\n\tlogLevel logger.LogLevel,\n\tsqlDB *sql.DB,\n\tgithubClientID provider.GithubClientID,\n\tgithubClientSecret provider.GithubClientSecret,\n\tfacebookClientID provider.FacebookClientID,\n\tfacebookClientSecret provider.FacebookClientSecret,\n\tfacebookRedirectURI provider.FacebookRedirectURI,\n\tgoogleClientID provider.GoogleClientID,\n\tgoogleClientSecret provider.GoogleClientSecret,\n\tgoogleRedirectURI provider.GoogleRedirectURI,\n\tjwtSecret provider.JwtSecret,\n\tbufferSize provider.KeyGenBufferSize,\n\tkgsRPCConfig provider.KgsRPCConfig,\n\twebFrontendURL provider.WebFrontendURL,\n\ttokenValidDuration provider.TokenValidDuration,\n\tdataDogAPIKey provider.DataDogAPIKey,\n\tsegmentAPIKey provider.SegmentAPIKey,\n\tipStackAPIKey provider.IPStackAPIKey,\n) (service.Routing, error) {\n\twire.Build(\n\t\twire.Bind(new(timer.Timer), new(timer.System)),\n\t\twire.Bind(new(geo.Geo), new(geo.IPStack)),\n\n\t\twire.Bind(new(url.Retriever), new(url.RetrieverPersist)),\n\t\twire.Bind(new(repository.UserURLRelation), new(sqldb.UserURLRelationSQL)),\n\t\twire.Bind(new(repository.User), new(*sqldb.UserSQL)),\n\t\twire.Bind(new(repository.URL), new(*sqldb.URLSql)),\n\n\t\tobservabilitySet,\n\t\tauthSet,\n\t\tgithubAPISet,\n\t\tfacebookAPISet,\n\t\tgoogleAPISet,\n\t\tkeyGenSet,\n\t\tfeatureDecisionSet,\n\n\t\tservice.NewRouting,\n\t\twebreq.NewHTTPClient,\n\t\twebreq.NewHTTP,\n\t\tgraphql.NewClientFactory,\n\t\ttimer.NewSystem,\n\t\tprovider.NewIPStack,\n\t\tenv.NewDeployment,\n\n\t\tsqldb.NewUserSQL,\n\t\tsqldb.NewURLSql,\n\t\tsqldb.NewUserURLRelationSQL,\n\t\turl.NewRetrieverPersist,\n\t\taccount.NewProvider,\n\t\tprovider.NewShortRoutes,\n\t)\n\treturn service.Routing{}, nil\n}", "func Register(p Protocol, n NewFunc) {\n\treglock.Lock()\n\tdefer reglock.Unlock()\n\tregistry[p] = n\n}", "func (_Flytrap *FlytrapTransactor) AddTopic(opts *bind.TransactOpts, topic string, country [2]byte, addPubCost *big.Int, addSubCost *big.Int, reason string, sensitive bool) (*types.Transaction, error) {\n\treturn _Flytrap.contract.Transact(opts, \"addTopic\", topic, country, addPubCost, addSubCost, reason, sensitive)\n}", "func (p *Publisher) Register(topicURL, callbackURL, secret string, leaseEnd time.Time) error {\n\tlease := leaseEnd.Sub(time.Now())\n\tif lease <= 0 {\n\t\treturn nil\n\t}\n\n\ts, err := p.subscribeIfNotExist(topicURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.locker.Lock()\n\ts.callbacks[callbackURL] = &pubCallback{\n\t\tsecret: secret,\n\t\ttimer: time.AfterFunc(lease, func() {\n\t\t\tp.unregister(topicURL, callbackURL)\n\t\t}),\n\t}\n\ts.locker.Unlock()\n\n\tif p.SubscriptionState != nil {\n\t\tp.SubscriptionState(topicURL, callbackURL, secret, leaseEnd)\n\t}\n\n\treturn nil\n}", "func (conn *Conn) ListenWithAuth(token string, topics ...string) error {\n\tif conn.GetNumTopics()+len(topics) > conn.length {\n\t\treturn ErrShardTooManyTopics\n\t}\n\tif err := conn.WriteMessageWithNonce(Listen, conn.generator(), TopicData{topics, token}); err != nil {\n\t\treturn err\n\t}\n\tconn.listeners.Lock()\n\tdefer conn.listeners.Unlock()\n\tif conn.topics == nil {\n\t\tconn.topics = make(map[string][]string)\n\t}\n\tconn.topics[token] = append(conn.topics[token], topics...)\n\treturn nil\n}", "func (d *distEventBus) setupTopicSub(topicName, subscriberName string) error {\n\tctx := context.TODO()\n\n\t// Create the topic if it doesn't exist yet.\n\td.topic = d.client.Topic(topicName)\n\tif exists, err := d.topic.Exists(ctx); err != nil {\n\t\treturn skerr.Fmt(\"Error checking whether topic exits: %s\", err)\n\t} else if !exists {\n\t\tif d.topic, err = d.client.CreateTopic(ctx, topicName); err != nil {\n\t\t\treturn skerr.Fmt(\"Error creating pubsub topic '%s': %s\", topicName, err)\n\t\t}\n\t}\n\n\t// Create the subscription if it doesn't exist.\n\tsubName := fmt.Sprintf(\"%s+%s\", subscriberName, topicName)\n\td.sub = d.client.Subscription(subName)\n\tif exists, err := d.sub.Exists(ctx); err != nil {\n\t\treturn skerr.Fmt(\"Error checking existence of pubsub subscription '%s': %s\", subName, err)\n\t} else if !exists {\n\t\td.sub, err = d.client.CreateSubscription(ctx, subName, pubsub.SubscriptionConfig{\n\t\t\tTopic: d.topic,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn skerr.Fmt(\"Error creating pubsub subscription '%s': %s\", subName, err)\n\t\t}\n\t}\n\td.sub.ReceiveSettings.MaxOutstandingMessages = MaximumConcurrentPublishesPerTopic\n\t// Make the subscription also the id of this client.\n\td.clientID = subName\n\treturn nil\n}", "func (s *Switch) RegisterDirectProtocol(protocol string) chan service.DirectMessage { // TODO: not used - remove\n\tif s.started == 1 {\n\t\tlog.Panic(\"attempt to register direct protocol after p2p has started\")\n\t}\n\tmchan := make(chan service.DirectMessage, s.config.BufferSize)\n\ts.directProtocolHandlers[protocol] = mchan\n\treturn mchan\n}", "func New(t Topic) (Interface, error) {\n\t// TODO(tmrts): use a LFU and if cache-key space consumption is not a\n\t// problem, migrate to optimized cache replacement algorithms that use\n\t// extra queues\n\t// TODO(tmrts): utilize the eviction callback in LRU\n\tlruCache := lru.NewLRU(t.Capacity, nil)\n\n\tr, err := router.New(RouterPort)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := r.Join(t.Peers); err != nil {\n\t\treturn nil, err\n\t}\n\n\tc := &topic{\n\t\tlru: lruCache,\n\t\tprovider: t.Provider,\n\t\trouter: r,\n\t}\n\n\t// FIXME(tmrts): needs restructuring\n\tsvc, err := service.NewServer(ServicePort, c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc.svc = svc\n\n\treturn c, nil\n}", "func RegisterGroupAPIRoute(basePath string, ginEngine *gin.Engine, controllers []IBaseController) {\n\tif !strings.HasPrefix(basePath, \"/\") {\n\t\tbasePath = \"/\" + basePath\n\t}\n\tg := ginEngine.Group(basePath)\n\t{\n\t\troutesControllerMapping(g, controllers)\n\t}\n}", "func (r *HijackRouter) Add(pattern string, resourceType proto.NetworkResourceType, handler func(*Hijack)) error {\n\tr.enable.Patterns = append(r.enable.Patterns, &proto.FetchRequestPattern{\n\t\tURLPattern: pattern,\n\t\tResourceType: resourceType,\n\t})\n\n\treg := regexp.MustCompile(proto.PatternToReg(pattern))\n\n\tr.handlers = append(r.handlers, &hijackHandler{\n\t\tpattern: pattern,\n\t\tregexp: reg,\n\t\thandler: handler,\n\t})\n\n\treturn r.enable.Call(r.caller)\n}", "func Register(ch chan ExecutionEvent, topics ...Topic) {\n\tfor _, t := range topics {\n\t\tsubscriberRegistry[t] = append(subscriberRegistry[t], ch)\n\t}\n}", "func RegisterProvider(name string, provider Provider) {\n\tregistry[name] = provider\n\tpriority = append(priority, name)\n}", "func (cntrolr *Controller) BookmarkRouteRegister(r *mux.Router) {\n\ts := r.PathPrefix(\"/user/{userid}\").Subrouter()\n\ts.Use(cntrolr.auth.AuthUser)\n\tcntrolr.CategoryRouteRegister(s)\n\ts.HandleFunc(\"/bookmark/{pagesize}/{pagenumber}\", cntrolr.GetAllBookmark).Methods(\"GET\")\n\ts.HandleFunc(\"/bookmark/{bookmarkid}\", cntrolr.GetBookmarkByID).Methods(\"GET\")\n\ts.HandleFunc(\"/bookmark/category/{categoryid}/{pagesize}/{pagenumber}\", cntrolr.GetBookmarkByCategory).Methods(\"GET\")\n\ts.HandleFunc(\"/bookmark\", cntrolr.AddBookmark).Methods(\"POST\")\n\ts.HandleFunc(\"/bookmark/{bookmarkid}\", cntrolr.UpdateBookmark).Methods(\"PUT\")\n\ts.HandleFunc(\"/bookmark/{bookmarkid}\", cntrolr.DeleteBookmark).Methods(\"DELETE\")\n}", "func (p *endPoint) RegisterRoute(route *gin.RouterGroup) (err error) {\r\n\troute.GET(p.tasks, list)\r\n\troute.POST(p.tasks, create)\r\n\troute.GET(p.tasks+\"/:\"+p.taskid, get)\r\n\troute.PUT(p.tasks+\"/:\"+p.taskid, update)\r\n\troute.DELETE(p.tasks+\"/:\"+p.taskid, delete)\r\n\troute.PUT(p.taskorders, updateTaskOrders)\r\n\treturn\r\n}", "func (factory *Factory) MeshRouter(provider string) Interface {\n\tswitch {\n\tcase provider == \"none\":\n\t\treturn &NopRouter{}\n\tcase provider == \"kubernetes\":\n\t\treturn &NopRouter{}\n\tcase provider == \"nginx\":\n\t\treturn &IngressRouter{\n\t\t\tlogger: factory.logger,\n\t\t\tkubeClient: factory.kubeClient,\n\t\t\tannotationsPrefix: factory.ingressAnnotationsPrefix,\n\t\t}\n\tcase provider == \"appmesh\":\n\t\treturn &AppMeshRouter{\n\t\t\tlogger: factory.logger,\n\t\t\tflaggerClient: factory.flaggerClient,\n\t\t\tkubeClient: factory.kubeClient,\n\t\t\tappmeshClient: factory.meshClient,\n\t\t}\n\tcase strings.HasPrefix(provider, \"smi:\"):\n\t\tmesh := strings.TrimPrefix(provider, \"smi:\")\n\t\treturn &SmiRouter{\n\t\t\tlogger: factory.logger,\n\t\t\tflaggerClient: factory.flaggerClient,\n\t\t\tkubeClient: factory.kubeClient,\n\t\t\tsmiClient: factory.meshClient,\n\t\t\ttargetMesh: mesh,\n\t\t}\n\tcase provider == \"linkerd\":\n\t\treturn &SmiRouter{\n\t\t\tlogger: factory.logger,\n\t\t\tflaggerClient: factory.flaggerClient,\n\t\t\tkubeClient: factory.kubeClient,\n\t\t\tsmiClient: factory.meshClient,\n\t\t\ttargetMesh: \"linkerd\",\n\t\t}\n\tcase provider == \"contour\":\n\t\treturn &ContourRouter{\n\t\t\tlogger: factory.logger,\n\t\t\tflaggerClient: factory.flaggerClient,\n\t\t\tkubeClient: factory.kubeClient,\n\t\t\tcontourClient: factory.meshClient,\n\t\t}\n\tcase strings.HasPrefix(provider, \"gloo\"):\n\t\tupstreamDiscoveryNs := \"gloo-system\"\n\t\tif strings.HasPrefix(provider, \"gloo:\") {\n\t\t\tupstreamDiscoveryNs = strings.TrimPrefix(provider, \"gloo:\")\n\t\t}\n\t\treturn &GlooRouter{\n\t\t\tlogger: factory.logger,\n\t\t\tflaggerClient: factory.flaggerClient,\n\t\t\tkubeClient: factory.kubeClient,\n\t\t\tglooClient: factory.meshClient,\n\t\t\tupstreamDiscoveryNs: upstreamDiscoveryNs,\n\t\t}\n\tcase strings.HasPrefix(provider, \"supergloo:appmesh\"):\n\t\treturn &AppMeshRouter{\n\t\t\tlogger: factory.logger,\n\t\t\tflaggerClient: factory.flaggerClient,\n\t\t\tkubeClient: factory.kubeClient,\n\t\t\tappmeshClient: factory.meshClient,\n\t\t}\n\tcase strings.HasPrefix(provider, \"supergloo:istio\"):\n\t\treturn &IstioRouter{\n\t\t\tlogger: factory.logger,\n\t\t\tflaggerClient: factory.flaggerClient,\n\t\t\tkubeClient: factory.kubeClient,\n\t\t\tistioClient: factory.meshClient,\n\t\t}\n\tcase strings.HasPrefix(provider, \"supergloo:linkerd\"):\n\t\treturn &SmiRouter{\n\t\t\tlogger: factory.logger,\n\t\t\tflaggerClient: factory.flaggerClient,\n\t\t\tkubeClient: factory.kubeClient,\n\t\t\tsmiClient: factory.meshClient,\n\t\t\ttargetMesh: \"linkerd\",\n\t\t}\n\tdefault:\n\t\treturn &IstioRouter{\n\t\t\tlogger: factory.logger,\n\t\t\tflaggerClient: factory.flaggerClient,\n\t\t\tkubeClient: factory.kubeClient,\n\t\t\tistioClient: factory.meshClient,\n\t\t}\n\t}\n}", "func Register(clusters *clusters.Clusters, plugins *plugin.Plugins, config Config) chi.Router {\n\tplugins.Append(plugin.Plugin{\n\t\tName: \"dashboards\",\n\t\tDisplayName: \"Dashboards\",\n\t\tDescription: \"Create dashboards for your Teams and Applications.\",\n\t\tType: \"dashboards\",\n\t})\n\n\trouter := Router{\n\t\tchi.NewRouter(),\n\t\tclusters,\n\t\tconfig,\n\t}\n\n\trouter.Get(\"/dashboards\", router.getAllDashboards)\n\trouter.Post(\"/dashboards\", router.getDashboards)\n\trouter.Post(\"/dashboard\", router.getDashboard)\n\n\treturn router\n}", "func (follower *Follower) Register(leaderHost string) (err error) {\n\tlog.Printf(\"Registring with Leader...\\n\")\n\tconn, err := net.Dial(\"tcp\", leaderHost)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmessage := &Message{\n\t\tAction: Message_REGISTER.Enum(),\n\n\t\tId: follower.id[:],\n\t\tHost: proto.String(follower.host),\n\t}\n\n\tdata, err := proto.Marshal(message)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := conn.Write(data); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func RegisterRoutes(r weave.Registry, auth x.Authenticator) {\n\tblogs := NewBlogBucket()\n\tr.Handle(PathCreateBlogMsg, CreateBlogMsgHandler{auth, blogs})\n\tr.Handle(PathCreatePostMsg, CreatePostMsgHandler{auth, NewPostBucket(), blogs})\n\tr.Handle(PathRenameBlogMsg, RenameBlogMsgHandler{auth, blogs})\n\tr.Handle(PathChangeBlogAuthorsMsg, ChangeBlogAuthorsMsgHandler{auth, blogs})\n\tr.Handle(PathSetProfileMsg, SetProfileMsgHandler{auth, NewProfileBucket()})\n}", "func (srv *Server) RegisterPut(ep *Endpoint) (err error) {\n\tif ep == nil || ep.Call == nil {\n\t\treturn nil\n\t}\n\n\tep.Method = RequestMethodPut\n\tep.ResponseType = ResponseTypeNone\n\n\t// Check if the same route already registered.\n\tfor _, rute := range srv.routePuts {\n\t\t_, ok := rute.parse(ep.Path)\n\t\tif ok {\n\t\t\treturn ErrEndpointAmbiguous\n\t\t}\n\t}\n\n\trute, err := newRoute(ep)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsrv.routePuts = append(srv.routePuts, rute)\n\n\treturn nil\n}", "func (mux *URLMux) RegisterTransport(scheme string, opener TransportURLOpener) {\n\tmux.schemes.Register(\"mailer\", \"Transport\", scheme, opener)\n}", "func Register(kind string, props actor.Props) {\n\tnameLookup[kind] = props\n}", "func K8sRegister(auth *restful.WebService) {\n\tPub, Priv = CreateKeyPair()\n\tauth.Path(\"/\").\n\t\tConsumes(restful.MIME_JSON).\n\t\tProduces(restful.MIME_JSON) // you can specify this per route as well\n\t//apiserver http\n\tauth.Route(auth.GET(\"/.well-known/openid-configuration\").To(discoveryHandler))\n\tauth.Route(auth.GET(\"/keys\").To(handlePublicKeys))\n\t//user token http\n\tauth.Route(auth.GET(\"/token\").To(handlerToken))\n\n}", "func (h *HubBub) LookupStrategy(id string) (Strategy, error) {\n\tfor _, s := range h.strategies {\n\t\tif s.ID == id {\n\t\t\treturn s, nil\n\t\t}\n\t}\n\treturn Strategy{}, fmt.Errorf(\"%q not found\", id)\n}", "func RegisterEndpoints(router *fasthttprouter.Router) {\n\thandle(router, \"POST\", \"/submit/question\", SubmitQuestion)\n\thandle(router, \"POST\", \"/submit/answer\", SubmitAnswer)\n\thandleWs(router, wsPath)\n\thandleFS(router, \"/\", \"public\")\n\thandleFS(router, \"/images/*filepath\", \"public/images\")\n\thandleFS(router, \"/js/*filepath\", \"public/js\")\n\thandleFS(router, \"/vendor/*filepath\", \"public/vendor\")\n\thandleFS(router, \"/css/*filepath\", \"public/css\")\n\thandleNotFound(router)\n}", "func RegisterRoutes(r weave.Registry, auth x.Authenticator) {\n\tbucket := NewVoteBucket()\n\ttallies := NewTallyBucket()\n\tr.Handle(pathRecordVote, &recordVoteHandler{auth: auth, bucket: bucket, tallies: tallies})\n}", "func Register(clusters *clusters.Clusters, plugins *plugin.Plugins, config Config) chi.Router {\n\tvar options map[string]interface{}\n\toptions = make(map[string]interface{})\n\toptions[\"webSocketAddress\"] = config.WebSocket.Address\n\toptions[\"ephemeralContainers\"] = config.EphemeralContainers\n\n\tplugins.Append(plugin.Plugin{\n\t\tName: \"resources\",\n\t\tDisplayName: \"Resources\",\n\t\tDescription: \"View and edit Kubernetes resources.\",\n\t\tType: \"resources\",\n\t\tOptions: options,\n\t})\n\n\trouter := Router{\n\t\tchi.NewRouter(),\n\t\tclusters,\n\t\tconfig,\n\t}\n\n\trouter.Get(\"/resources\", router.getResources)\n\trouter.Delete(\"/resources\", router.deleteResource)\n\trouter.Put(\"/resources\", router.patchResource)\n\trouter.Post(\"/resources\", router.createResource)\n\trouter.Get(\"/logs\", router.getLogs)\n\trouter.HandleFunc(\"/terminal\", router.getTerminal)\n\n\treturn router\n}", "func ExposeStrategyFromString(s string) (ExposeStrategy, bool) {\n\tes := ExposeStrategy(s)\n\treturn es, AllExposeStrategies.Has(es)\n}", "func (c *Config) initTopicMap() {\n\ttopicMap[MapperTopicPrefix+c.Device.ID+WatcherTopicSuffix] = c.handleWatchMessage\n\ttopicMap[MapperTopicPrefix+c.Device.ID+SchedulerCreateTopicSuffix] = c.handleScheduleCreateMessage\n\ttopicMap[MapperTopicPrefix+c.Device.ID+SchedulerDeleteTopicSuffix] = c.handleScheduleDeleteMessage\n\ttopicMap[MapperTopicPrefix+c.Device.ID+ActionManagerCreateTopicSuffix] = c.handleActionCreateMessage\n\ttopicMap[MapperTopicPrefix+c.Device.ID+ActionManagerDeleteTopicSuffix] = c.handleActionDeleteMessage\n}", "func (s *Server) Register(service, method string, h http.HandlerFunc) {\n\ts.routes[fmt.Sprintf(\"%s%s.%s\", s.Basepath, service, method)] = h\n}", "func RegisterAPIRoute(ginEngine *gin.Engine, controllers []IBaseController) {\n\troutesControllerMapping(ginEngine, controllers)\n}", "func RegisterProtocol(name string, v interface{}) {\n\troot.Protocols[name] = v\n}", "func (p *JSONProtocol) RegisterWithName(msg interface{}, msgName string) {\n\tt := reflect.TypeOf(msg)\n\tif t.Kind() == reflect.Ptr {\n\t\tt = t.Elem()\n\t}\n\tif msgName == \"\" {\n\t\tmsgName = t.PkgPath() + \"/\" + t.Name()\n\t}\n\tp.types[msgName] = t\n\tp.names[t] = msgName\n}", "func NewStrategy(defaultRegistry DefaultRegistry) imageRepositoryStrategy {\n\treturn imageRepositoryStrategy{kapi.Scheme, kapi.SimpleNameGenerator, defaultRegistry}\n}", "func (r *Router) Register(log LogFunc, routes ...Route) *Router {\n\tfor _, route := range routes {\n\t\tr.inner.Path(route.Path).\n\t\t\tMethods(route.Method).\n\t\t\tHandlerFunc(route.Handler.HTTP(log))\n\t}\n\treturn r\n}", "func (b *Broker) AddTopic(subscriber *Subscriber, keyTopic string, priority uint, action func(msg interface{}) (err error)) {\n\n\tt := &topicSub{priority: priority, action: action, channel: make(chan interface{}, 1)}\n\n\tsubscriber.topic = t\n\n\tsubscriber.debug = keyTopic\n\t//subscriber.byPriority = append(subscriber.byPriority, t)\n\n\t// Sort topics by priority, will be useful to manage priorities after\n\n\tb.addSubscriber(keyTopic, subscriber)\n\n\t// Sort byPriority array\n\t//\tsort.SliceStable(subscriber.byPriority, func(i, j int) bool { return subscriber.byPriority[i].priority < subscriber.byPriority[j].priority })\n}", "func (sr *Sereport) RegisterRoute() *mux.Router {\n\tr := mux.NewRouter()\n\tsr.api.RegisterRoute(r)\n\treturn r\n}", "func (r *Routes) Add(pattern string, f fasthttp.RequestHandler) {\n\tr.Routes[normaliseRoute(pattern)] = f\n}", "func RegisterDriver(drv Driver, scheme string) {\n\tdrivers[scheme] = drv\n}", "func (r *templateRouter) dynamicallyAddRoute(backendKey ServiceAliasConfigKey, route *routev1.Route, backend *ServiceAliasConfig) bool {\n\tif r.dynamicConfigManager == nil {\n\t\treturn false\n\t}\n\n\tlog.V(4).Info(\"dynamically adding route backend\", \"backendKey\", backendKey)\n\tr.dynamicConfigManager.Register(backendKey, route)\n\n\t// If no initial sync was done, don't try to dynamically add the\n\t// route as we will need a reload anyway.\n\tif !r.synced {\n\t\treturn false\n\t}\n\n\terr := r.dynamicConfigManager.AddRoute(backendKey, backend.RoutingKeyName, route)\n\tif err != nil {\n\t\tlog.V(4).Info(\"router will reload as the ConfigManager could not dynamically add route for backend\", \"backendKey\", backendKey, \"error\", err)\n\t\treturn false\n\t}\n\n\t// For each referenced service unit replace the route endpoints.\n\toldEndpoints := []Endpoint{}\n\n\t// As the endpoints have changed, recalculate the weights.\n\tnewWeights := r.calculateServiceWeights(backend.ServiceUnits, backend.PreferPort)\n\tfor key := range backend.ServiceUnits {\n\t\tif service, ok := r.findMatchingServiceUnit(key); ok {\n\t\t\tnewEndpoints := endpointsForAlias(*backend, service)\n\t\t\tlog.V(4).Info(\"for new route backend, replacing endpoints for service\", \"backendKey\", backendKey, \"serviceKey\", key, \"newEndpoints\", newEndpoints)\n\n\t\t\tweight, ok := newWeights[key]\n\t\t\tif !ok {\n\t\t\t\tweight = 0\n\t\t\t}\n\t\t\tif err := r.dynamicConfigManager.ReplaceRouteEndpoints(backendKey, oldEndpoints, newEndpoints, weight); err != nil {\n\t\t\t\tlog.V(4).Info(\"router will reload as the ConfigManager could not dynamically replace endpoints for route backend\",\n\t\t\t\t\t\"backendKey\", backendKey, \"serviceKey\", key, \"error\", err)\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\n\tlog.V(4).Info(\"dynamically added route backend\", \"backendKey\", backendKey)\n\treturn true\n}", "func (l *Labeltile) SetupRoutes(injectFns ...RouteInjector) {\n\tfor _, fn := range injectFns {\n\t\tfn(l.engine, l.container)\n\t}\n}", "func (client *Client) DescribeRouteDistributionStrategiesWithCallback(request *DescribeRouteDistributionStrategiesRequest, callback func(response *DescribeRouteDistributionStrategiesResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeRouteDistributionStrategiesResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeRouteDistributionStrategies(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func RegisterEndpoints(router *mux.Router) {\n\tfmt.Println(\"Registering wheel endpoints...\")\n\twheelDriver = NewDriver(adaptor.RPi)\n\trouter.HandleFunc(\"/wheels\", setWheelsMovement).Methods(http.MethodPut)\n}", "func Register(plugins *admission.Plugins) {\n\tplugins.Register(\"FooBar\", func(config io.Reader) (admission.Interface, error) {\n\t\treturn New()\n\t})\n}", "func (s *sink) register(sub *sinksub) {\n\ts.trieq0.Add(sub)\n\ts.trieq1.Add(sub)\n}", "func Register(c *client.Client) {\n\tctrlz.RegisterTopic(CreateTopic(c))\n}", "func (c *Control) registerTunnel(rawTunnelReq *msg.ReqTunnel) {\n\tfor _, proto := range strings.Split(rawTunnelReq.Protocol, \"+\") {\n\t\ttunnelReq := *rawTunnelReq\n\t\ttunnelReq.Protocol = proto\n\n\t\tc.conn.Debug(\"Registering new tunnel\")\n\t\tt, err := NewTunnel(&tunnelReq, c)\n\t\tif err != nil {\n\t\t\tack := &msg.NewTunnel{Error: err.Error()}\n\t\t\tif len(c.tunnels) == 0 {\n\t\t\t\t// you can't fail your first tunnel registration\n\t\t\t\t// terminate the control connection\n\t\t\t\tc.stop <- ack\n\t\t\t} else {\n\t\t\t\t// inform client of failure\n\t\t\t\tc.out <- ack\n\t\t\t}\n\n\t\t\t// we're done\n\t\t\treturn\n\t\t}\n\n\t\t// add it to the list of tunnels\n\t\tc.tunnels = append(c.tunnels, t)\n\n\t\t// acknowledge success\n\t\tc.out <- &msg.NewTunnel{\n\t\t\tUrl: t.url,\n\t\t\tProtocol: proto,\n\t\t\tReqId: rawTunnelReq.ReqId,\n\t\t}\n\n\t\trawTunnelReq.Hostname = strings.Replace(t.url, proto+\"://\", \"\", 1)\n\t}\n}", "func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router) {\r\n\t// this line is used by starport scaffolding\r\n\tr.HandleFunc(\"/voter/poll\", ListPollHandler(cliCtx, \"voter\")).Methods(\"GET\")\r\n\tr.HandleFunc(\"/voter/poll\", createPollHandler(cliCtx)).Methods(\"POST\")\r\n}", "func RegisterRoute(w http.ResponseWriter, r *http.Request) {\n\taddr := r.URL.Query().Get(\"address\")\n\tport, err := strconv.Atoi(r.URL.Query().Get(\"port\"))\n\tif (addr == \"\" || port <= 0) || err != nil {\n\t\thttp.Error(w, \"'address' and/or 'port' query params are bad, please fix\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tip := net.ParseIP(addr)\n\tregister(dist.Address{\n\t\tIP: ip,\n\t\tPort: port,\n\t})\n\tw.WriteHeader(204) // 'No Content'\n}", "func AddOutputStrategy(name string, f OutputStrategyCreator) {\n\toutputStrategies[name] = f\n}", "func registerPostRoutes(api iris.Party) {\n\tpostRoutes := api.Party(\"/posts\")\n\tpostRoutes.Use(middlewares.CheckLoginStatus)\n\n\t// subpath of \"/posts\"\n\t// Post Collection and Creation\n\tpostRoutes.Get(\"/\", service.GetRecentPosts).Name = \"GetRecentPosts\"\n\tpostRoutes.Post(\"/\", service.CreatePost).Name = \"CreatePost\"\n\n\t// Get and Delete Post\n\tpostRoutes.Get(\"/{postId:int min(1)}\", middlewares.CheckPostIDExistence,\n\t\tservice.GetPostByID).Name = \"GetPostByID\"\n\tpostRoutes.Delete(\"/{postId:int min(1)}\", middlewares.CheckPostIDExistence,\n\t\tservice.DeletePost).Name = \"DeletePost\"\n\n\t// share a post\n\t// postRoutes.Get(\"/{postId:int min(1)/share\", handler)\n\n\t// liek/un-like a post\n\tpostRoutes.Get(\"/{postId:int min(1)}/like\", middlewares.CheckPostIDExistence,\n\t\tservice.UpvotePost).Name = \"UpvotePost\"\n\n\t// report a post\n\tpostRoutes.Post(\"/{postId:int min(1)}/report\", middlewares.CheckPostIDExistence,\n\t\tservice.CreateReportPost).Name = \"CreateReportPost\"\n\n\t// star a post\n\tpostRoutes.Get(\"/{postId:int min(1)}/star\", middlewares.CheckPostIDExistence,\n\t\tservice.StarPost).Name = \"StarPost\"\n\n\t// share a post\n\tpostRoutes.Get(\"/{postId:int min(1)}/share\", middlewares.CheckPostIDExistence,\n\t\tservice.SharePost).Name = \"SharePost\"\n\n\t// all category names\n\tpostRoutes.Get(\"/categories\", service.GetAllCategoryNames).Name = \"GetAllCategoryNames\"\n}", "func setupRoutes(srv *gin.Engine, s *controller) *gin.Engine {\n\n\tpingroute.NewRouter(s.pingController, srv).RegisterRoutes()\n\tqrcoderoute.NewRouter(s.qrcodeController, srv).RegisterRoutes()\n\tuserroute.NewRouter(s.userController, srv).RegisterRoutes()\n\tsafraroute.NewRouter(s.safraController, srv).RegisterRoutes()\n\n\treturn srv\n}", "func (r *rdsRoute) Add(ns, topic, address string, version uint64) error {\n\tkey := r.getRoutePrefix(ns, topic)\n\trds := r.rdc.Get(util.W, key)\n\tdefer rds.Close()\n\t_, err := rds.Do(\"HSET\", key, address, version)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *Switch) RegisterDirectProtocolWithChannel(protocol string, ingressChannel chan service.DirectMessage) chan service.DirectMessage {\n\tif s.started == 1 {\n\t\tlog.Panic(\"attempting to register direct protocol with channel after p2p has started\")\n\t}\n\ts.directProtocolHandlers[protocol] = ingressChannel\n\treturn ingressChannel\n}", "func (s Service) Register(engine *gin.RouterGroup) {\n\tfor i := 0; i < len(s.Routes); i++ {\n\t\tengine.Handle(s.Routes[i].Method, s.Prefix+s.Routes[i].Url, s.Routes[i].Handler)\n\t}\n}" ]
[ "0.6233871", "0.60150677", "0.5539055", "0.5388272", "0.5353805", "0.5258051", "0.5237158", "0.5210581", "0.52068865", "0.5089592", "0.50649077", "0.50563955", "0.5038952", "0.49194244", "0.48399246", "0.48336083", "0.48249227", "0.48226076", "0.48137185", "0.47765005", "0.47171158", "0.4699946", "0.46942163", "0.4683713", "0.46646646", "0.46525216", "0.46375036", "0.45974588", "0.45926422", "0.4587312", "0.45839214", "0.4583406", "0.45766097", "0.45709026", "0.45647272", "0.45448098", "0.4541369", "0.45290783", "0.45248446", "0.45214218", "0.45185527", "0.45148847", "0.4514022", "0.45135486", "0.45126092", "0.44894752", "0.44888514", "0.44843557", "0.44770533", "0.44698477", "0.44510818", "0.44503424", "0.4443307", "0.44399884", "0.4437437", "0.44363144", "0.44182473", "0.44160986", "0.44102848", "0.43994096", "0.43933317", "0.4386697", "0.43794006", "0.4379104", "0.43753737", "0.43708453", "0.4358872", "0.43536055", "0.43508503", "0.43493518", "0.43478355", "0.43477994", "0.43437767", "0.433444", "0.43284985", "0.4328204", "0.43067694", "0.43033844", "0.42972434", "0.42904246", "0.42841724", "0.42818552", "0.42782813", "0.42462537", "0.42422473", "0.4241987", "0.4241986", "0.42405534", "0.4235132", "0.42311", "0.4230506", "0.42269683", "0.42264813", "0.42255124", "0.4220519", "0.42203653", "0.4217864", "0.42077243", "0.42066112", "0.42003986" ]
0.8255487
0
Restore creates a topic with an existing wal
Restore создаёт тему с существующим wal
func Restore(name string, walDir string) (*WALTopic, error) { w, err := walFactory.Open(nil, nil, walDir) if err != nil { return nil, errors.Wrapf(err, "Could no open wal for topic %s", name) } m := make(map[int]uint64) return &WALTopic{name: name, walDir: walDir, wal: w, firstIndexInSegment: m}, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Cluster) RestoreTopic(toml []byte) error {\n\treturn c.createTopic(toml, true)\n}", "func (ctl Controller) Restore(name string) *pitr.Error {\n\terr := ctl.cluster.Stop()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = ctl.cluster.Clear()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstdout, stderr, runErr := ctl.runner.Run(\"sudo --login --user postgres wal-g backup-fetch %s %s\", ctl.cluster.DataDirectory(), name)\n\n\tif runErr != nil {\n\t\treturn &pitr.Error{\n\t\t\tMessage: runErr.Error(),\n\t\t\tStdout: stdout,\n\t\t\tStderr: stderr,\n\t\t}\n\t}\n\n\tctl.createRecoveryConf(`restore_command = 'bash --login -c \\\"wal-g wal-fetch %f %p\\\"'`)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = ctl.cluster.Start()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (tm *topicManager) createNewTopic(name string, id string) (log, error) {\n\tlc, ok := tm.topicNamesToLogs[name]\n\tif ok {\n\t\tlc.refCount++\n\t\treturn lc.l, nil\n\t}\n\n\t// lazily create the log if we know about the topic/cc ID\n\tl, err := newBadgerLog(tm.dataDir, name, id, tm.cc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttm.topicNamesToLogs[name] = &logContainer{\n\t\tl: l,\n\t\trefCount: 1,\n\t}\n\treturn l, nil\n}", "func (m *MonLeaderDetector) Restore(id int) {\n\t// TODO(student): Implement\n\t_, ok := m.suspected[id]\n\tif ok == true {\n\t\tdelete(m.suspected, id)\n\t\tm.alive[id] = true\n\t}\n\n\t//Publish to subscribers\n\tvar j int\n\tnewLeader := m.Leader()\n\tif m.LeaderChange || m.Allsuspected {\n\t\tfor j < len(m.Channels) {\n\t\t\tm.Channels[j] <- newLeader\n\t\t\tj++\n\t\t}\n\t}\n}", "func (ctl Controller) RestoreToTransactionID(txID int64) *pitr.Error {\n\terr := ctl.cluster.Stop()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = ctl.cluster.Clear()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstdout, stderr, runErr := ctl.runner.Run(\"sudo --login --user postgres wal-g backup-fetch %s %s\", ctl.cluster.DataDirectory(), \"LATEST\")\n\n\tif runErr != nil {\n\t\treturn &pitr.Error{\n\t\t\tMessage: runErr.Error(),\n\t\t\tStdout: stdout,\n\t\t\tStderr: stderr,\n\t\t}\n\t}\n\n\tctl.createRecoveryConf(\n\t\t`restore_command = 'bash --login -c \\\"wal-g wal-fetch %f %p\\\"'`,\n\t\tfmt.Sprintf(\"recovery_target_xid = %d\", txID),\n\t\t\"recovery_target_action=promote\",\n\t)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif runErr != nil {\n\t\treturn &pitr.Error{\n\t\t\tMessage: runErr.Error(),\n\t\t\tStdout: stdout,\n\t\t\tStderr: stderr,\n\t\t}\n\t}\n\n\terr = ctl.cluster.Start()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func createTopic(broker *sarama.Broker, topicName string) error {\n\ttopicDetail := &sarama.TopicDetail{}\n\ttopicDetail.NumPartitions = int32(1)\n\ttopicDetail.ReplicationFactor = int16(1)\n\ttopicDetail.ConfigEntries = make(map[string]*string)\n\n\ttopicDetails := make(map[string]*sarama.TopicDetail)\n\ttopicDetails[topicName] = topicDetail\n\trequest := sarama.CreateTopicsRequest{\n\t\tTimeout: time.Second * 15,\n\t\tTopicDetails: topicDetails,\n\t}\n\n\t_, err := broker.CreateTopics(&request)\n\treturn err\n}", "func (r *Reconciler) createTopic(ctx context.Context, topicName string, partitions int32, replicationFactor int16, retentionMillis int64) error {\n\n\t// Get The Logger From The Context\n\tlogger := logging.FromContext(ctx)\n\n\t// Create The TopicDefinition\n\tretentionMillisString := strconv.FormatInt(retentionMillis, 10)\n\ttopicDetail := &sarama.TopicDetail{\n\t\tNumPartitions: partitions,\n\t\tReplicationFactor: replicationFactor,\n\t\tReplicaAssignment: nil, // Currently Not Assigning Partitions To Replicas\n\t\tConfigEntries: map[string]*string{\n\t\t\tcommonconstants.KafkaTopicConfigRetentionMs: &retentionMillisString,\n\t\t},\n\t}\n\n\t// Attempt To Create The Topic & Process TopicError Results (Including Success ;)\n\terr := r.adminClient.CreateTopic(ctx, topicName, topicDetail)\n\tif err != nil {\n\t\tlogger := logger.With(zap.Int16(\"KError\", int16(err.Err)))\n\t\tswitch err.Err {\n\t\tcase sarama.ErrNoError:\n\t\t\tlogger.Info(\"Successfully Created New Kafka Topic (ErrNoError)\")\n\t\t\treturn nil\n\t\tcase sarama.ErrTopicAlreadyExists:\n\t\t\tlogger.Info(\"Kafka Topic Already Exists - No Creation Required\")\n\t\t\treturn nil\n\t\tdefault:\n\t\t\tlogger.Error(\"Failed To Create Topic\")\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tlogger.Info(\"Successfully Created New Kafka Topic (Nil TopicError)\")\n\t\treturn nil\n\t}\n}", "func New(name string, baseDir string) (*WALTopic, error) {\n\twalDir := filepath.Join(baseDir, name)\n\toneMB := 1 * 1024 * 1024\n\tw, err := walFactory.NewSize(nil, nil, walDir, oneMB, false)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Could not create wal for topic %s\", name)\n\t}\n\tm := make(map[int]uint64)\n\treturn &WALTopic{name: name, walDir: walDir, wal: w, firstIndexInSegment: m}, nil\n}", "func createTopic(brokerAddress string, topicName string,\n\tnumPartitions int32, replicationFactor int32) {\n\tbrokerAddresses := []string{brokerAddress}\n\n\t// configuration handling\n\t// please note the versioning, it needs to be specified explicitly\n\tconfig := sarama.NewConfig()\n\tconfig.Version = sarama.V2_1_0_0\n\n\t// try to create and initialize cluster admin object\n\t// (it will reach out Kafka broker, so it checks the connection as well)\n\tclusterAdmin, err := sarama.NewClusterAdmin(brokerAddresses, config)\n\n\t// check if cluster admin has been initialized successfully\n\tif err != nil {\n\t\tlog.Fatal(\"Error: create cluster admin: \", err.Error())\n\t}\n\n\t// everything's seems to be ok\n\tlog.Print(\"Cluster admin has been initialized\")\n\n\t// cluster admin needs to be closed properly\n\tdefer func() {\n\t\t// try to close cluster admin\n\t\terr := clusterAdmin.Close()\n\n\t\t// check if cluster admin has been closed successfully\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"Error: close cluster admin: \", err.Error())\n\t\t}\n\t}()\n\n\t// try to create a new topic via cluster admin\n\terr = clusterAdmin.CreateTopic(topicName,\n\t\t&sarama.TopicDetail{\n\t\t\tNumPartitions: numPartitions,\n\t\t\tReplicationFactor: int16(replicationFactor),\n\t\t}, false)\n\n\t// check if topic has been created successfully\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: create topic '%s': %v\", topicName, err.Error())\n\t}\n\n\t// everything's seems to be ok -> topic has been created\n\tlog.Printf(\"Topic '%s' has been created\", topicName)\n}", "func restore(ccmd *cobra.Command, args []string) error {\n\tkeyBytes, err := getPrivateKey()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar mdk types.MasterDerivationKey\n\tcopy(mdk[:], keyBytes)\n\tcwResponse, err := kmdClient.CreateWallet(WalletName, WalletPassword, kmd.DefaultWalletDriver, mdk)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error creating wallet - %s\", err)\n\t}\n\n\tfmt.Printf(\"Created wallet '%s' with ID: %s\\n\", cwResponse.Wallet.Name, cwResponse.Wallet.ID)\n\tif os.Getenv(\"GOTEST\") == \"true\" {\n\t\tccmd.Print(\"Created wallet successfully.\")\n\t}\n\n\treturn nil\n}", "func TestRestoreInvalidLearner(t *testing.T) {\n\ts := pb.Snapshot{\n\t\tMetadata: pb.SnapshotMetadata{\n\t\t\tIndex: 11, // magic number\n\t\t\tTerm: 11, // magic number\n\t\t\tConfState: pb.ConfState{Nodes: []uint64{1, 2}, Learners: []uint64{3}},\n\t\t},\n\t}\n\n\tstorage := NewMemoryStorage()\n\tsm := newTestRaft(3, []uint64{1, 2, 3}, 10, 1, storage)\n\tdefer closeAndFreeRaft(sm)\n\n\tif sm.isLearner {\n\t\tt.Errorf(\"%x is learner, want not\", sm.id)\n\t}\n\tif ok := sm.restore(s); ok {\n\t\tt.Error(\"restore succeed, want fail\")\n\t}\n}", "func TestRestoreLearnerPromotion(t *testing.T) {\n\ts := pb.Snapshot{\n\t\tMetadata: pb.SnapshotMetadata{\n\t\t\tIndex: 11, // magic number\n\t\t\tTerm: 11, // magic number\n\t\t\tConfState: pb.ConfState{Nodes: []uint64{1, 2, 3}},\n\t\t},\n\t}\n\n\tstorage := NewMemoryStorage()\n\tsm := newTestLearnerRaft(3, []uint64{1, 2}, []uint64{3}, 10, 1, storage)\n\tdefer closeAndFreeRaft(sm)\n\n\tif !sm.isLearner {\n\t\tt.Errorf(\"%x is not learner, want yes\", sm.id)\n\t}\n\n\tif ok := sm.restore(s); !ok {\n\t\tt.Error(\"restore fail, want succeed\")\n\t}\n\n\tif sm.isLearner {\n\t\tt.Errorf(\"%x is learner, want not\", sm.id)\n\t}\n}", "func TestRestoreWithLearner(t *testing.T) {\n\ts := pb.Snapshot{\n\t\tMetadata: pb.SnapshotMetadata{\n\t\t\tIndex: 11, // magic number\n\t\t\tTerm: 11, // magic number\n\t\t\tConfState: pb.ConfState{Nodes: []uint64{1, 2}, Learners: []uint64{3}},\n\t\t},\n\t}\n\n\tstorage := NewMemoryStorage()\n\tsm := newTestLearnerRaft(3, []uint64{1, 2}, []uint64{3}, 10, 1, storage)\n\tdefer closeAndFreeRaft(sm)\n\tif ok := sm.restore(s); !ok {\n\t\tt.Error(\"restore fail, want succeed\")\n\t}\n\n\tif sm.raftLog.lastIndex() != s.Metadata.Index {\n\t\tt.Errorf(\"log.lastIndex = %d, want %d\", sm.raftLog.lastIndex(), s.Metadata.Index)\n\t}\n\tif mustTerm(sm.raftLog.term(s.Metadata.Index)) != s.Metadata.Term {\n\t\tt.Errorf(\"log.lastTerm = %d, want %d\", mustTerm(sm.raftLog.term(s.Metadata.Index)), s.Metadata.Term)\n\t}\n\tif !sm.isLearner {\n\t\tt.Errorf(\"%x is not learner, want yes\", sm.id)\n\t}\n\tsg := sm.nodes()\n\tif len(sg)+len(sm.learnerNodes()) != len(s.Metadata.ConfState.Nodes)+len(s.Metadata.ConfState.Learners) {\n\t\tt.Errorf(\"sm.Nodes = %+v, length not equal with %+v\", sg, s.Metadata.ConfState)\n\t}\n\tfor _, n := range s.Metadata.ConfState.Nodes {\n\t\tif sm.prs[n].IsLearner {\n\t\t\tt.Errorf(\"sm.Node %x isLearner = %s, want %t\", n, sm.prs[n], false)\n\t\t}\n\t}\n\tif len(s.Metadata.ConfState.Nodes) != len(sm.prs) {\n\t\tt.Errorf(\"sm.Nodes = %+v, length not equal with %+v\", sm.prs, s.Metadata.ConfState.Nodes)\n\t}\n\tfor _, n := range s.Metadata.ConfState.Learners {\n\t\tif !sm.learnerPrs[n].IsLearner {\n\t\t\tt.Errorf(\"sm.Node %x isLearner = %s, want %t\", n, sm.prs[n], true)\n\t\t}\n\t}\n\tif len(s.Metadata.ConfState.Learners) != len(sm.learnerPrs) {\n\t\tt.Errorf(\"sm.Nodes = %+v, length not equal with %+v\", sm.learnerPrs, s.Metadata.ConfState.Learners)\n\t}\n\n\tif ok := sm.restore(s); ok {\n\t\tt.Error(\"restore succeed, want fail\")\n\t}\n}", "func (p *PubsubValueStore) createTopicHandler(topic string) (*topicInfo, error) {\n\tt, err := p.ps.Join(topic)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsub, err := t.Subscribe()\n\tif err != nil {\n\t\t_ = t.Close()\n\t\treturn nil, err\n\t}\n\n\tevts, err := t.EventHandler()\n\tif err != nil {\n\t\tsub.Cancel()\n\t\t_ = t.Close()\n\t}\n\n\tti := &topicInfo{\n\t\ttopic: t,\n\t\tevts: evts,\n\t\tsub: sub,\n\t\tfinished: make(chan struct{}, 1),\n\t}\n\n\treturn ti, nil\n}", "func (gWal *GenericWAL) Recover() error {\n entryCh := make(chan *Entry)\n quitCh := make(chan struct{})\n defer close(quitCh)\n go func() {\n if err := gWal.wal.StartRecovery(entryCh, quitCh); err != nil {\n glog.Errorf(\"could not recover state from local wal :: %v\", err)\n entryCh <- nil\n }\n }()\n\n count := 0\n for entry := range entryCh {\n if entry == nil {\n glog.Errorf(\"wal recovery channel is closed unexpectedly\")\n return fmt.Errorf(\"wal error\")\n }\n count++\n\n switch entry.Type {\n case CTypeDone:\n glog.Infof(\"wal recovery is complete because last record is read\")\n close(entryCh)\n\n case CTypeData:\n gWal.updateRecoveryMap(false /* checkpoint */, int64(entry.LSN),\n entry.Data)\n glog.V(1).Infof(\"recovered a delta record with lsn %v\", entry.LSN)\n\n case CTypeCheckpoint:\n gWal.updateRecoveryMap(true /* checkpoint */, -1, entry.Data)\n glog.V(1).Infof(\"recovered a checkpoint record with lsn %v\", entry.LSN)\n\n case CTypeError:\n glog.Errorf(\"wal recovery encountered an unrecoverable error\")\n return fmt.Errorf(\"wal error\")\n\n default:\n glog.Errorf(\"wal recovery received an unknown or invalid record\")\n return fmt.Errorf(\"wal error\")\n }\n }\n\n return nil\n}", "func (s *Store) Restore(rc io.ReadCloser) error {\n\t// TODO\n\treturn nil\n}", "func (tm *topicManager) createTopic(name string) error {\n\ttm.topicsMutex.RLock()\n\t_, ok := tm.topicNamesToIds[name]\n\ttm.topicsMutex.RUnlock()\n\tif ok {\n\t\treturn fmt.Errorf(\"Topic with name [%s] already exists\", name)\n\t}\n\n\t// this allocates a copycat data structure but doesn't create a log structure yet\n\tid, err := tm.cc.AllocateNewDataStructure()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprotobuf := &pb.TopicMetadataOperation{\n\t\tName: name,\n\t\tDataStructureId: id.String(),\n\t}\n\n\tbites, err := protobuf.Marshal()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttm.proposeCh <- bites\n\treturn nil\n}", "func CreateTopic(c *client.Client) fw.Topic {\n\treturn &configzTopic{\n\t\tcl: c,\n\t}\n}", "func (r *TopicReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {\n\tctx := context.Background()\n\t_ = r.Log.WithValues(\"topic\", req.NamespacedName)\n\n\ttopic := &nlptv1.Topic{}\n\tif err := r.Get(ctx, req.NamespacedName, topic); err != nil {\n\t\tklog.Errorf(\"cannot get topic of ctrl req: %+v\", err)\n\t\treturn ctrl.Result{}, nil\n\t}\n\t//klog.Infof(\"get new topic event: %+v\", *topic)\n\t//klog.Infof(\"Status:%s\", topic.Status.Status)\n\n\tif topic.Status.Status == nlptv1.Creating {\n\t\t//klog.Info(\"Current status is Init\")\n\t\tif err := r.Operator.CreateTopic(topic); err != nil {\n\t\t\ttopic.Spec.Url = topic.GetUrl()\n\t\t\ttopic.Status.Status = nlptv1.CreateFailed\n\t\t\ttopic.Status.Message = fmt.Sprintf(\"create topic error:%+v\", err)\n\t\t\tklog.Errorf(\"create topic failed, err: %+v\", err)\n\t\t} else {\n\t\t\ttopic.Spec.Url = topic.GetUrl()\n\t\t\ttopic.Status.Status = nlptv1.Created\n\t\t\ttopic.Status.Message = \"success\"\n\t\t}\n\n\t\t//更新数据库的状态\n\t\t//klog.Infof(\"Final Topic: %+v\", *topic)\n\t\tif err := r.Update(ctx, topic); err != nil {\n\t\t\tklog.Errorf(\"Update Topic Failed: %+v, err: %+v\", *topic, err)\n\t\t}\n\n\t}\n\n\tif topic.Status.Status == nlptv1.Importing {\n\t\tif ok, _ := r.Operator.isNamespacesExist(topic); ok {\n\t\t\tif err := r.Operator.CreateTopic(topic); err != nil {\n\t\t\t\ttopic.Spec.Url = topic.GetUrl()\n\t\t\t\ttopic.Status.Status = nlptv1.ImportFailed\n\t\t\t\ttopic.Status.Message = fmt.Sprintf(\"create topic error:%+v\", err)\n\t\t\t\tklog.Errorf(\"create topic failed, err: %+v\", err)\n\t\t\t} else {\n\t\t\t\ttopic.Spec.Url = topic.GetUrl()\n\t\t\t\ttopic.Status.Status = nlptv1.ImportSuccess\n\t\t\t\ttopic.Status.Message = \"success\"\n\t\t\t}\n\n\t\t\tif err := r.Update(ctx, topic); err != nil {\n\t\t\t\tklog.Errorf(\"Update Topic Failed: %+v\", *topic)\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif topic.Status.Status == nlptv1.Deleting {\n\t\tif err := r.Operator.DeleteTopic(topic, false); err != nil {\n\t\t\ttopic.Status.Status = nlptv1.DeleteFailed\n\t\t\ttopic.Status.Message = fmt.Sprintf(\"delete topic error: %+v\", err)\n\t\t\tif err := r.Update(ctx, topic); err != nil {\n\t\t\t\tklog.Errorf(\"Update Topic Failed: %+v\", *topic)\n\t\t\t}\n\t\t} else {\n\t\t\t//删除数据\n\t\t\tif err = r.Delete(ctx, topic); err != nil {\n\t\t\t\tklog.Errorf(\"delete Topic Failed: %+v\", *topic)\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif topic.Status.Status == nlptv1.ForceDeleting {\n\t\tif err := r.Operator.DeleteTopic(topic, true); err != nil {\n\t\t\ttopic.Status.Status = nlptv1.ForceDeleteFailed\n\t\t\ttopic.Status.Message = fmt.Sprintf(\"force delete topic error: %+v\", err)\n\t\t\tif err := r.Update(ctx, topic); err != nil {\n\t\t\t\tklog.Errorf(\"Update Topic Failed: %+v\", *topic)\n\t\t\t}\n\t\t} else {\n\t\t\t//删除数据\n\t\t\tif err = r.Delete(ctx, topic); err != nil {\n\t\t\t\tklog.Errorf(\"delete Topic Failed: %+v\", *topic)\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif topic.Status.Status == nlptv1.Terminating {\n\t\tif err := r.Operator.TerminateTopic(topic); err != nil {\n\t\t\ttopic.Status.Status = nlptv1.TerminatedFailed\n\t\t\ttopic.Status.Message = fmt.Sprintf(\"terminate topic error: %+v\", err)\n\n\t\t} else {\n\t\t\ttopic.Status.Status = nlptv1.Terminated\n\t\t\ttopic.Status.Message = fmt.Sprintf(\"terminate topic success\")\n\t\t}\n\n\t\tif err := r.Update(ctx, topic); err != nil {\n\t\t\tklog.Errorf(\"Update Topic Failed: %+v\", *topic)\n\t\t}\n\n\t}\n\n\tif topic.Status.Status == nlptv1.Updating {\n\t\t//增加topic分区\n\t\tif err := r.Operator.AddPartitionsOfTopic(topic); err != nil {\n\t\t\ttopic.Status.Status = nlptv1.UpdateFailed\n\t\t\ttopic.Status.Message = fmt.Sprintf(\"add topic partition error: %+v \", err)\n\t\t\ttopic.Spec.PartitionNum = topic.Spec.OldPartitionNum\n\t\t} else {\n\t\t\ttopic.Status.Status = nlptv1.Updated\n\t\t\ttopic.Status.Message = \"success\"\n\t\t}\n\t\tif err := r.Update(ctx, topic); err != nil {\n\t\t\tklog.Errorf(\"Update Topic Failed: %+v\", *topic)\n\t\t}\n\t}\n\n\t//删除授权\n\tif topic.Status.AuthorizationStatus == nlptv1.DeletingAuthorization {\n\t\tfor i := 0; i < len(topic.Spec.Permissions); i++ {\n\t\t\tp := topic.Spec.Permissions[i]\n\t\t\tif p.Status.Status == nlptv1.DeletingAuthorization {\n\t\t\t\tif err := r.Operator.DeletePer(topic, &p); err != nil {\n\t\t\t\t\tp.Status.Status = nlptv1.DeleteAuthorizationFailed\n\t\t\t\t\tp.Status.Message = fmt.Sprintf(\"revoke permission error: %+v\", err)\n\t\t\t\t\t//删除失败,将标签重置为true\n\t\t\t\t\ttopic.ObjectMeta.Labels[p.AuthUserID] = \"true\"\n\t\t\t\t\ttopic.Status.AuthorizationStatus = nlptv1.DeleteAuthorizationFailed\n\t\t\t\t} else {\n\t\t\t\t\tpers := topic.Spec.Permissions\n\t\t\t\t\ttopic.Spec.Permissions = append(pers[:i], pers[i+1:]...)\n\t\t\t\t\t//收回权限成功,删除标签\n\t\t\t\t\tdelete(topic.ObjectMeta.Labels, p.AuthUserID)\n\t\t\t\t\ttopic.Status.AuthorizationStatus = nlptv1.DeletedAuthorization\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif err := r.Update(ctx, topic); err != nil {\n\t\t\tklog.Errorf(\"Update Topic Failed: %+v\", *topic)\n\t\t}\n\t}\n\n\tif topic.Status.AuthorizationStatus == nlptv1.UpdatingAuthorization {\n\t\t//klog.Infof(\"Start Grant Topic: %+v\", *topic)\n\t\t//授权操作\n\t\tfor i := 0; i < len(topic.Spec.Permissions); i++ {\n\t\t\tp := topic.Spec.Permissions[i]\n\t\t\tif p.Status.Status == nlptv1.UpdatingAuthorization {\n\t\t\t\tif err := r.Operator.GrantPermission(topic, &p); err != nil {\n\t\t\t\t\tp.Status.Status = nlptv1.UpdatingAuthorizationFailed\n\t\t\t\t\tp.Status.Message = fmt.Sprintf(\"modify permission error: %+v\", err)\n\t\t\t\t\ttopic.Status.AuthorizationStatus = nlptv1.UpdatingAuthorizationFailed\n\n\t\t\t\t\t//TODO roll back\n\n\t\t\t\t} else {\n\t\t\t\t\tp.Status.Status = nlptv1.UpdatingAuthorizationSuccess\n\t\t\t\t\tp.Status.Message = \"success\"\n\t\t\t\t\ttopic.Status.AuthorizationStatus = nlptv1.UpdatingAuthorizationSuccess\n\t\t\t\t}\n\t\t\t\ttopic.Spec.Permissions[i] = p\n\t\t\t}\n\t\t}\n\n\t\tif err := r.Update(ctx, topic); err != nil {\n\t\t\tklog.Errorf(\"Update Topic Failed: %+v\", *topic)\n\t\t}\n\t}\n\tif topic.Status.AuthorizationStatus == nlptv1.Authorizing {\n\t\tklog.Infof(\"Start Grant Topic: %+v\", *topic)\n\t\t//授权操作\n\t\tfor i := 0; i < len(topic.Spec.Permissions); i++ {\n\t\t\tp := topic.Spec.Permissions[i]\n\t\t\tif p.Status.Status == nlptv1.Authorizing {\n\t\t\t\tif err := r.Operator.GrantPermission(topic, &p); err != nil {\n\t\t\t\t\tp.Status.Status = nlptv1.AuthorizeFailed\n\t\t\t\t\tp.Status.Message = fmt.Sprintf(\"grant permission error: %+v\", err)\n\t\t\t\t\ttopic.Status.AuthorizationStatus = nlptv1.AuthorizeFailed\n\t\t\t\t} else {\n\t\t\t\t\tp.Status.Status = nlptv1.Authorized\n\t\t\t\t\tp.Status.Message = \"success\"\n\t\t\t\t\ttopic.Status.AuthorizationStatus = nlptv1.Authorized\n\t\t\t\t}\n\t\t\t\ttopic.Spec.Permissions[i] = p\n\t\t\t}\n\t\t}\n\n\t\tif err := r.Update(ctx, topic); err != nil {\n\t\t\tklog.Errorf(\"Update Topic Failed: %+v\", *topic)\n\t\t}\n\t}\n\n\tif topic.Status.BindStatus == nlptv1.BindingOrUnBinding {\n\t\tfor appid, application := range topic.Spec.Applications {\n\t\t\tswitch application.Status {\n\t\t\tcase nlptv1.UpdatingAuthorization:\n\t\t\t\tp := nlptv1.Permission{\n\t\t\t\t\tAuthUserID: \"\",\n\t\t\t\t\tAuthUserName: application.ID,\n\t\t\t\t\tActions: application.Actions,\n\t\t\t\t}\n\t\t\t\tif err := r.Operator.GrantPermission(topic, &p); err != nil {\n\t\t\t\t\tapplication.Status = nlptv1.UpdatingAuthorizationFailed\n\t\t\t\t\tapplication.DisplayStatus = nlptv1.ShowStatusMap[application.Status]\n\t\t\t\t\tapplication.Message = fmt.Sprintf(\"update authorization: %+v\", err)\n\t\t\t\t} else {\n\t\t\t\t\tapplication.Status = nlptv1.UpdatingAuthorizationSuccess\n\t\t\t\t\tapplication.DisplayStatus = nlptv1.ShowStatusMap[application.Status]\n\t\t\t\t\tapplication.Message = \"update authorization successfully\"\n\t\t\t\t}\n\t\t\tcase nlptv1.Binding:\n\t\t\t\t//actions := make([]string, 0)\n\t\t\t\t//actions = append(actions, nlptv1.Consume)\n\t\t\t\t//actions = append(actions, nlptv1.Produce)\n\n\t\t\t\tp := nlptv1.Permission{\n\t\t\t\t\tAuthUserID: \"\",\n\t\t\t\t\tAuthUserName: application.ID,\n\t\t\t\t\tActions: application.Actions,\n\t\t\t\t}\n\t\t\t\tif err := r.Operator.GrantPermission(topic, &p); err != nil {\n\t\t\t\t\tapplication.Status = nlptv1.BindFailed\n\t\t\t\t\tapplication.DisplayStatus = nlptv1.ShowStatusMap[application.Status]\n\t\t\t\t\tapplication.Message = fmt.Sprintf(\"bind error: %+v\", err)\n\t\t\t\t} else {\n\t\t\t\t\tapplication.Status = nlptv1.Bound\n\t\t\t\t\tapplication.DisplayStatus = nlptv1.ShowStatusMap[application.Status]\n\t\t\t\t\tapplication.Message = \"bind success\"\n\t\t\t\t}\n\t\t\tcase nlptv1.Unbinding:\n\t\t\t\tp := nlptv1.Permission{\n\t\t\t\t\tAuthUserID: \"\",\n\t\t\t\t\tAuthUserName: application.ID,\n\t\t\t\t}\n\n\t\t\t\tif err := r.Operator.DeletePer(topic, &p); err != nil {\n\t\t\t\t\tapplication.Status = nlptv1.UnbindFailed\n\t\t\t\t\tapplication.DisplayStatus = nlptv1.ShowStatusMap[application.Status]\n\t\t\t\t\tapplication.Message = fmt.Sprintf(\"release error: %+v\", err)\n\n\t\t\t\t} else {\n\t\t\t\t\tapplication.Status = nlptv1.UnbindSuccess\n\t\t\t\t}\n\n\t\t\t}\n\t\t\ttopic.Spec.Applications[appid] = application\n\t\t\tif err := r.Update(ctx, topic); err != nil {\n\t\t\t\tklog.Errorf(\"Update Topic Failed: %+v\", *topic)\n\t\t\t}\n\t\t}\n\n\t\t//处理解绑定的场景\n\t\tapps := make(map[string]nlptv1.Application)\n\n\t\tfor appid, application := range topic.Spec.Applications {\n\t\t\tif application.Status != nlptv1.UnbindSuccess {\n\t\t\t\tapps[appid] = application\n\t\t\t}\n\t\t}\n\n\t\ttopic.Spec.Applications = apps\n\t\tif err := r.Update(ctx, topic); err != nil {\n\t\t\tklog.Errorf(\"Update Topic Failed: %+v\", *topic)\n\t\t}\n\n\t}\n\n\t//klog.Infof(\"Final Topic: %+v\", *topic)\n\treturn ctrl.Result{}, nil\n}", "func (f *fsm) Restore(rc io.ReadCloser) error {\n\t//o := NewInMemDatastore()\n\t//if err := json.NewDecoder(rc).Decode(&o.m); err != nil {\n\t//\treturn err\n\t//}\n\n\t// Set the state from the snapshot, no lock required according to\n\t// Hashicorp docs.\n\t//f.m = o\n\n\treturn nil\n}", "func (api *TopicalAPI) TopicNew(w http.ResponseWriter, r *http.Request) {\n\tflashes, _ := api.session.GetFlashes(r, w)\n\tuser, err := api.session.GetUser(r)\n\n\tif err != nil {\n\t\tapi.session.SaveFlash(\"Log in to post a message\", r, w)\n\t\thttp.Redirect(w, r, \"/topics\", 302)\n\t\treturn\n\t}\n\n\tpayload := struct {\n\t\tUser *models.User\n\t\tFlashes []string\n\t}{user, flashes}\n\n\tapi.templates.ExecuteTemplate(w, \"new-topic\", payload)\n}", "func TopicCreate(w http.ResponseWriter, r *http.Request) {\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab url path variables\n\turlVars := mux.Vars(r)\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\n\tpostBody := map[string]string{}\n\tschemaUUID := \"\"\n\n\t// check if there's a request body provided before trying to decode\n\tif r.Body != nil {\n\n\t\tb, err := ioutil.ReadAll(r.Body)\n\n\t\tif err != nil {\n\t\t\terr := APIErrorInvalidRequestBody()\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t\tdefer r.Body.Close()\n\n\t\tif len(b) > 0 {\n\t\t\terr = json.Unmarshal(b, &postBody)\n\t\t\tif err != nil {\n\t\t\t\terr := APIErrorInvalidRequestBody()\n\t\t\t\trespondErr(w, err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tschemaRef := postBody[\"schema\"]\n\n\t\t\t// if there was a schema name provided, check its existence\n\t\t\tif schemaRef != \"\" {\n\t\t\t\t_, schemaName, err := schemas.ExtractSchema(schemaRef)\n\t\t\t\tif err != nil {\n\t\t\t\t\terr := APIErrorInvalidData(err.Error())\n\t\t\t\t\trespondErr(w, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tsl, err := schemas.Find(projectUUID, \"\", schemaName, refStr)\n\t\t\t\tif err != nil {\n\t\t\t\t\terr := APIErrGenericInternal(err.Error())\n\t\t\t\t\trespondErr(w, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif sl.Empty() {\n\t\t\t\t\terr := APIErrorNotFound(\"Schema\")\n\t\t\t\t\trespondErr(w, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tschemaUUID = sl.Schemas[0].UUID\n\t\t\t}\n\t\t}\n\t}\n\t// Get Result Object\n\tres, err := topics.CreateTopic(projectUUID, urlVars[\"topic\"], schemaUUID, refStr)\n\tif err != nil {\n\t\tif err.Error() == \"exists\" {\n\t\t\terr := APIErrorConflict(\"Topic\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t\terr := APIErrGenericInternal(err.Error())\n\t\trespondErr(w, err)\n\t}\n\n\t// Output result to JSON\n\tresJSON, err := res.ExportJSON()\n\tif err != nil {\n\t\terr := APIErrExportJSON()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Write response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n\n}", "func (t *WALTopic) Close() error {\n\treturn t.wal.Close()\n}", "func (gWal *GenericWAL) updateRecoveryMap(\n checkpoint bool, lsn int64, data []byte) error {\n\n record := &GenericWALRecord{}\n if err := json.Unmarshal(data, record); err != nil {\n glog.Errorf(\"could not parse wal record during recovery :: %v\", err)\n return err\n }\n // We need to explicitly set the lsn field, as \"lsn\" is not present within\n // the \"data\" that is serialized on to the wal. The lsn is\n // generated \"after\" we finish writing \"data\" into the wal.\n record.LSN = lsn\n\n // Recovery happens as follows:\n //\n // Checkpoint records are applied immediately because they always store a\n // consistent snapshot with any live operations.\n //\n // Delta records are stored in a map so that when we see a corresponding\n // revert record, we can ignore it.\n //\n // EXTRA NOTES\n //\n // Ideally, we want to replay all delta records. But sometimes an operation\n // could have failed and returned an error. We don't want to replay such\n // operations after a crash, so we use Revert records to remove such items\n // out of the recovery record map.\n //\n // Similarly, a long running operation wants to record its progress so that\n // it can resume from the middle during recovery. They use Progress records\n // to save their progress and can skip over already completed operations\n // during recovery.\n //\n // Progress records are sometimes necessary for correctness because\n // filesystem state cannot be reconstructed through replay. For example,\n // consider this sequence of operations: etcd.Create, etcd.Remove and\n // etcd.Create. If current state of the system is at the second etcd.Create\n // and a crash here would replay etcd.Remove operation which removes the\n // files owned by second etcd.Create operation. So, progress records will\n // help avoid such cases.\n\n if record.IsRevert {\n delete(gWal.recoveryMap, record.Revert.LSN)\n return nil\n }\n\n if record.IsProgress {\n if _, ok := gWal.recoveryMap[record.Progress.LSN]; ok {\n gWal.recoveryMap[record.Progress.LSN] = record.Progress.NewRecord\n } else {\n glog.Warningf(\"progress record %d is ignored because its initial \"+\n \"record %d is not found in the recovery map\", lsn, record.Progress.LSN)\n }\n return nil\n }\n\n // This includes both delta and checkpoint records.\n gWal.recoveryMap[lsn] = record\n return nil\n}", "func (r *Reconciler) createTopic(ctx context.Context, topicName string, partitions int, replicationFactor int, retentionMillis int64) error {\n\n\t// Setup The Logger\n\tlogger := r.logger.With(zap.String(\"Topic\", topicName))\n\n\t// Create The TopicSpecification\n\ttopicSpecifications := []kafka.TopicSpecification{\n\t\t{\n\t\t\tTopic: topicName,\n\t\t\tNumPartitions: partitions,\n\t\t\tReplicationFactor: replicationFactor,\n\t\t\tConfig: map[string]string{\n\t\t\t\tconstants.KafkaTopicConfigRetentionMs: strconv.FormatInt(retentionMillis, 10),\n\t\t\t},\n\t\t},\n\t}\n\n\t// Attempt To Create The Topic & Process Results\n\ttopicResults, err := r.adminClient.CreateTopics(ctx, topicSpecifications)\n\tif len(topicResults) > 0 {\n\t\ttopicResultError := topicResults[0].Error\n\t\ttopicResultErrorCode := topicResultError.Code()\n\t\tif topicResultErrorCode == kafka.ErrTopicAlreadyExists {\n\t\t\tlogger.Info(\"Kafka Topic Already Exists - No Creation Required\")\n\t\t\treturn nil\n\t\t} else if topicResultErrorCode == kafka.ErrNoError {\n\t\t\tlogger.Info(\"Successfully Created New Kafka Topic\")\n\t\t\treturn nil\n\t\t} else {\n\t\t\tlogger.Error(\"Failed To Create Topic (Results)\", zap.Error(err), zap.Any(\"TopicResults\", topicResults))\n\t\t\treturn topicResults[0].Error\n\t\t}\n\t} else if err != nil {\n\t\tlogger.Error(\"Failed To Create Topic (Error)\", zap.Error(err))\n\t\treturn err\n\t} else {\n\t\tlogger.Warn(\"Received Empty TopicResults From CreateTopics Request\")\n\t\treturn nil\n\t}\n}", "func (r *Reconciler) createRestoreConfig(ctx context.Context, postgresCluster *v1beta1.PostgresCluster,\n\tconfigHash string) error {\n\n\tpostgresClusterWithMockedBackups := postgresCluster.DeepCopy()\n\tpostgresClusterWithMockedBackups.Spec.Backups.PGBackRest.Global = postgresCluster.Spec.\n\t\tDataSource.PGBackRest.Global\n\tpostgresClusterWithMockedBackups.Spec.Backups.PGBackRest.Repos = []v1beta1.PGBackRestRepo{\n\t\tpostgresCluster.Spec.DataSource.PGBackRest.Repo,\n\t}\n\n\treturn r.reconcilePGBackRestConfig(ctx, postgresClusterWithMockedBackups,\n\t\t\"\", configHash, \"\", \"\", []string{})\n}", "func (w *WorkerFSM) Restore(i io.ReadCloser) error {\n return nil\n}", "func (c *client) createTopic(topicName string) (*pubsub.Topic, error) {\n\tvar topic *pubsub.Topic\n\tctx := context.Background()\n\n\texists, err := c.topicExists(topicName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !exists {\n\t\ttopic, err = c.client.CreateTopic(ctx, topicName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\ttopic = c.client.Topic(topicName)\n\t}\n\n\treturn topic, nil\n}", "func (f *raftStore) Restore(rc io.ReadCloser) error {\n\tvar o state\n\tif err := json.NewDecoder(rc).Decode(&o); err != nil {\n\t\treturn err\n\t}\n\tf.mu.Lock()\n\tf.inFlight = nil\n\tf.mu.Unlock()\n\n\tf.m.setNewState(o)\n\treturn nil\n}", "func (zj *ZapJournal) Topic(topic string) Writer {\n\treturn &ZapWriter{\n\t\tlogger: zj.logger.Sugar().Named(topic),\n\t\ttopic: topic,\n\t}\n}", "func topic(prefix string, obj metav1.Object) string {\n\treturn fmt.Sprintf(\"%s.%s.%s\", prefix, obj.GetNamespace(), obj.GetName())\n}", "func (d *distEventBus) setupTopicSub(topicName, subscriberName string) error {\n\tctx := context.TODO()\n\n\t// Create the topic if it doesn't exist yet.\n\td.topic = d.client.Topic(topicName)\n\tif exists, err := d.topic.Exists(ctx); err != nil {\n\t\treturn skerr.Fmt(\"Error checking whether topic exits: %s\", err)\n\t} else if !exists {\n\t\tif d.topic, err = d.client.CreateTopic(ctx, topicName); err != nil {\n\t\t\treturn skerr.Fmt(\"Error creating pubsub topic '%s': %s\", topicName, err)\n\t\t}\n\t}\n\n\t// Create the subscription if it doesn't exist.\n\tsubName := fmt.Sprintf(\"%s+%s\", subscriberName, topicName)\n\td.sub = d.client.Subscription(subName)\n\tif exists, err := d.sub.Exists(ctx); err != nil {\n\t\treturn skerr.Fmt(\"Error checking existence of pubsub subscription '%s': %s\", subName, err)\n\t} else if !exists {\n\t\td.sub, err = d.client.CreateSubscription(ctx, subName, pubsub.SubscriptionConfig{\n\t\t\tTopic: d.topic,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn skerr.Fmt(\"Error creating pubsub subscription '%s': %s\", subName, err)\n\t\t}\n\t}\n\td.sub.ReceiveSettings.MaxOutstandingMessages = MaximumConcurrentPublishesPerTopic\n\t// Make the subscription also the id of this client.\n\td.clientID = subName\n\treturn nil\n}", "func TestLessorRecover(t *testing.T) {\n\tlg := zap.NewNop()\n\tdir, be := NewTestBackend(t)\n\tdefer os.RemoveAll(dir)\n\tdefer be.Close()\n\n\tle := newLessor(lg, be, clusterLatest(), LessorConfig{MinLeaseTTL: minLeaseTTL})\n\tdefer le.Stop()\n\tl1, err1 := le.Grant(1, 10)\n\tl2, err2 := le.Grant(2, 20)\n\tif err1 != nil || err2 != nil {\n\t\tt.Fatalf(\"could not grant initial leases (%v, %v)\", err1, err2)\n\t}\n\n\t// Create a new lessor with the same backend\n\tnle := newLessor(lg, be, clusterLatest(), LessorConfig{MinLeaseTTL: minLeaseTTL})\n\tdefer nle.Stop()\n\tnl1 := nle.Lookup(l1.ID)\n\tif nl1 == nil || nl1.ttl != l1.ttl {\n\t\tt.Errorf(\"nl1 = %v, want nl1.ttl= %d\", nl1.ttl, l1.ttl)\n\t}\n\n\tnl2 := nle.Lookup(l2.ID)\n\tif nl2 == nil || nl2.ttl != l2.ttl {\n\t\tt.Errorf(\"nl2 = %v, want nl2.ttl= %d\", nl2.ttl, l2.ttl)\n\t}\n}", "func (kz *Kazoo) Topic(topic string) *Topic {\n\treturn &Topic{Name: topic, kz: kz}\n}", "func (r *Reconciler) reconcileTopic(ctx context.Context, channel *kafkav1alpha1.KafkaChannel) error {\n\n\t// Get The TopicName For Specified Channel\n\ttopicName := util.TopicName(channel)\n\n\t// Get Channel Specific Logger & Add Topic Name\n\tlogger := util.ChannelLogger(r.logger, channel).With(zap.String(\"TopicName\", topicName))\n\n\t// Get The Topic Configuration (First From Channel With Failover To Environment)\n\tnumPartitions := util.NumPartitions(channel, r.environment, r.logger)\n\treplicationFactor := util.ReplicationFactor(channel, r.environment, r.logger)\n\tretentionMillis := util.RetentionMillis(channel, r.environment, r.logger)\n\n\t// Create The Topic (Handles Case Where Already Exists)\n\terr := r.createTopic(ctx, topicName, numPartitions, replicationFactor, retentionMillis)\n\n\t// Log Results & Return Status\n\tif err != nil {\n\t\tcontroller.GetEventRecorder(ctx).Eventf(channel, corev1.EventTypeWarning, event.KafkaTopicReconciliationFailed.String(), \"Failed To Reconcile Kafka Topic For Channel: %v\", err)\n\t\tlogger.Error(\"Failed To Reconcile Topic\", zap.Error(err))\n\t\tchannel.Status.MarkTopicFailed(\"TopicFailed\", fmt.Sprintf(\"Channel Kafka Topic Failed: %s\", err))\n\t} else {\n\t\tlogger.Info(\"Successfully Reconciled Topic\")\n\t\tchannel.Status.MarkTopicTrue()\n\t}\n\treturn err\n}", "func (gWal *GenericWAL) LogCheckpoint(payload interface{},\n version int64) error {\n\n if gWal.lostOwnership {\n return ErrLostOwnership\n }\n\n walRecord := &GenericWALRecord{}\n walRecord.Version = version\n // serialize the payload.\n userData, errMarshal := json.Marshal(payload)\n if errMarshal != nil {\n glog.Errorf(\"could not serialize user payload for WAL :: %v\",\n errMarshal)\n return errMarshal\n }\n walRecord.Payload = userData\n data, errMarshal := json.Marshal(walRecord)\n if errMarshal != nil {\n glog.Errorf(\"could not serialize wal record :: %v\", errMarshal)\n return errMarshal\n }\n\n if err := gWal.wal.StartCheckpoint(); err != nil {\n glog.Errorf(\"could not start new checkpoint :: %v\", err)\n return err\n }\n // TODO: WAL must have the ability to abort a checkpoint on errors,\n // otherwise, there is no way to cancel StartCheckpoint operation, so all\n // future checkpoint attempts will also fail.\n lsn, errWrite := gWal.writeCheckpointRecord(data)\n if errWrite != nil {\n glog.Errorf(\"could not write checkpoint record :: %v\", errWrite)\n gWal.lostOwnership = IsLostOwnership(errWrite)\n return errWrite\n }\n if err := gWal.wal.FinalizeCheckpoint(); err != nil {\n glog.Errorf(\"could not finalize checkpoint :: %v\", err)\n return err\n }\n glog.Infof(\"new checkpoint is recorded with lsn %d at version %d\", lsn,\n version)\n walRecord.LSN = lsn\n return nil\n}", "func (f *FSM) restoreDatabase(tracer *trace.Tracer, reader io.ReadCloser) (bool, error) {\n\tdone := false\n\n\t// The first 8 bytes contain the size of database.\n\tvar dataSize uint64\n\tif err := binary.Read(reader, binary.LittleEndian, &dataSize); err != nil {\n\t\treturn false, errors.Wrap(err, \"failed to read database size\")\n\t}\n\ttracer.Message(\"database size: %d\", dataSize)\n\n\t// Then there's the database data.\n\tdata := make([]byte, dataSize)\n\tif _, err := io.ReadFull(reader, data); err != nil {\n\t\treturn false, errors.Wrap(err, \"failed to read database data\")\n\t}\n\n\t// Next, the size of the WAL.\n\tvar walSize uint64\n\tif err := binary.Read(reader, binary.LittleEndian, &walSize); err != nil {\n\t\treturn false, errors.Wrap(err, \"failed to read wal size\")\n\t}\n\ttracer.Message(\"wal size: %d\", walSize)\n\n\t// Read the WAL data.\n\twal := make([]byte, walSize)\n\tif _, err := io.ReadFull(reader, wal); err != nil {\n\t\treturn false, errors.Wrap(err, \"failed to read wal data\")\n\t}\n\n\t// Read the database path.\n\tbufReader := bufio.NewReader(reader)\n\tfilename, err := bufReader.ReadString(0)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"failed to read database name\")\n\t}\n\tfilename = filename[:len(filename)-1] // Strip the trailing 0\n\ttracer.Message(\"filename: %s\", filename)\n\n\t// XXX TODO: reason about this situation, is it harmful?\n\t// Check that there are no leader connections for this database.\n\t//\n\t// FIXME: we should relax this, as it prevents restoring snapshots \"on\n\t// the fly\".\n\t// conns := f.registry.ConnLeaders(filename)\n\t// if len(conns) > 0 {\n\t// \ttracer.Panic(\"found %d leader connections\", len(conns))\n\t// }\n\n\t// XXX TODO: reason about this situation, is it possible?\n\t//txn := f.transactions.GetByConn(f.connections.Follower(name))\n\t//if txn != nil {\n\t//\tf.logger.Printf(\"[WARN] dqlite: fsm: closing follower in-flight transaction %s\", txn)\n\t//\tf.transactions.Remove(txn.ID())\n\t//}\n\n\t// Close any follower connection, since we're going to overwrite the\n\t// database file.\n\tif f.registry.ConnFollowerExists(filename) {\n\t\ttracer.Message(\"close follower: %s\", filename)\n\t\tfollower := f.registry.ConnFollower(filename)\n\t\tf.registry.ConnFollowerDel(filename)\n\t\tif err := follower.Close(); err != nil {\n\t\t\treturn false, err\n\t\t}\n\t}\n\n\t// At this point there should be not connection open against this\n\t// database, so it's safe to overwrite it.\n\ttxid, err := bufReader.ReadString(0)\n\tif err != nil {\n\t\tif err != io.EOF {\n\t\t\treturn false, errors.Wrap(err, \"failed to read txid\")\n\t\t}\n\t\tdone = true // This is the last database.\n\t}\n\ttracer.Message(\"transaction ID: %s\", txid)\n\n\tvfs := f.registry.Vfs()\n\n\tif err := connection.Restore(vfs, filename, data, wal); err != nil {\n\t\treturn false, err\n\t}\n\n\ttracer.Message(\"open follower: %s\", filename)\n\tif err := f.openFollower(filename); err != nil {\n\t\treturn false, err\n\t}\n\n\tif txid != \"\" {\n\t\t// txid, err := strconv.ParseUint(txid, 10, 64)\n\t\t// if err != nil {\n\t\t// \treturn false, err\n\t\t// }\n\t\t// tracer.Message(\"add transaction: %d\", txid)\n\t\t// conn := f.registry.ConnFollower(filename)\n\t\t// txn := f.registry.TxnFollowerAdd(conn, txid)\n\t\t// if err := txn.Begin(); err != nil {\n\t\t// \treturn false, err\n\t\t// }\n\t}\n\n\treturn done, nil\n}", "func (gWal *GenericWAL) LogRevertRecord(\n record *GenericWALRecord) error {\n\n if gWal.lostOwnership {\n return ErrLostOwnership\n }\n\n revert := &GenericWALRecord{Payload: []byte(`\"\"`)}\n revert.IsRevert = true\n revert.Revert.LSN = record.LSN\n data, errMarshal := json.Marshal(revert)\n if errMarshal != nil {\n glog.Errorf(\"could not serialize undo/rollback record :: %v\", errMarshal)\n return errMarshal\n }\n if _, err := gWal.writeDataRecord(data); err != nil {\n glog.Errorf(\"could not write revert record to wal :: %v\", err)\n gWal.lostOwnership = IsLostOwnership(err)\n return err\n }\n return nil\n}", "func UnmarshalTopic(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(Topic)\n\terr = core.UnmarshalPrimitive(m, \"id\", &obj.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"description\", &obj.Description)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"name\", &obj.Name)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"updated_at\", &obj.UpdatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_count\", &obj.SourceCount)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"sources\", &obj.Sources, UnmarshalSourcesListItems)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"subscription_count\", &obj.SubscriptionCount)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"subscriptions\", &obj.Subscriptions, UnmarshalSubscriptionListItem)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func SubCreate(w http.ResponseWriter, r *http.Request) {\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab url path variables\n\turlVars := mux.Vars(r)\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\trefBrk := gorillaContext.Get(r, \"brk\").(brokers.Broker)\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\n\t// Read POST JSON body\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\terr := APIErrorInvalidRequestBody()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Parse pull options\n\tpostBody, err := subscriptions.GetFromJSON(body)\n\tif err != nil {\n\t\terr := APIErrorInvalidArgument(\"Subscription\")\n\t\trespondErr(w, err)\n\t\tlog.Error(string(body[:]))\n\t\treturn\n\t}\n\n\ttProject, tName, err := subscriptions.ExtractFullTopicRef(postBody.FullTopic)\n\n\tif err != nil {\n\t\terr := APIErrorInvalidName(\"Topic\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\tif topics.HasTopic(projectUUID, tName, refStr) == false {\n\t\terr := APIErrorNotFound(\"Topic\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Get current topic offset\n\ttProjectUUID := projects.GetUUIDByName(tProject, refStr)\n\tfullTopic := tProjectUUID + \".\" + tName\n\tcurOff := refBrk.GetMaxOffset(fullTopic)\n\n\tpushEnd := \"\"\n\trPolicy := \"\"\n\trPeriod := 0\n\tmaxMessages := int64(1)\n\n\t//pushWorker := auth.User{}\n\tverifyHash := \"\"\n\n\tif postBody.PushCfg != (subscriptions.PushConfig{}) {\n\n\t\t// check the state of the push functionality\n\t\tpwToken := gorillaContext.Get(r, \"push_worker_token\").(string)\n\t\tpushEnabled := gorillaContext.Get(r, \"push_enabled\").(bool)\n\n\t\tif !pushEnabled {\n\t\t\terr := APIErrorPushConflict()\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\n\t\t_, err = auth.GetPushWorker(pwToken, refStr)\n\t\tif err != nil {\n\t\t\terr := APIErrInternalPush()\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\n\t\tpushEnd = postBody.PushCfg.Pend\n\t\t// Check if push endpoint is not a valid https:// endpoint\n\t\tif !(isValidHTTPS(pushEnd)) {\n\t\t\terr := APIErrorInvalidData(\"Push endpoint should be addressed by a valid https url\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t\trPolicy = postBody.PushCfg.RetPol.PolicyType\n\t\trPeriod = postBody.PushCfg.RetPol.Period\n\t\tmaxMessages = postBody.PushCfg.MaxMessages\n\n\t\tif rPolicy == \"\" {\n\t\t\trPolicy = subscriptions.LinearRetryPolicyType\n\t\t}\n\n\t\tif maxMessages == 0 {\n\t\t\tmaxMessages = int64(1)\n\t\t}\n\n\t\tif rPeriod <= 0 {\n\t\t\trPeriod = 3000\n\t\t}\n\n\t\tif !subscriptions.IsRetryPolicySupported(rPolicy) {\n\t\t\terr := APIErrorInvalidData(subscriptions.UnSupportedRetryPolicyError)\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\n\t\tverifyHash, err = auth.GenToken()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Could not generate verification hash for subscription %v, %v\", urlVars[\"subscription\"], err.Error())\n\t\t\terr := APIErrGenericInternal(\"Could not generate verification hash\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\n\t}\n\n\t// Get Result Object\n\tres, err := subscriptions.CreateSub(projectUUID, urlVars[\"subscription\"], tName, pushEnd, curOff, maxMessages, postBody.Ack, rPolicy, rPeriod, verifyHash, false, refStr)\n\n\tif err != nil {\n\t\tif err.Error() == \"exists\" {\n\t\t\terr := APIErrorConflict(\"Subscription\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t\terr := APIErrGenericInternal(err.Error())\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Output result to JSON\n\tresJSON, err := res.ExportJSON()\n\tif err != nil {\n\t\terr := APIErrExportJSON()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Write response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n\n}", "func (s *SchematicServer) generateSchemaTopic(schemaTopic string) error {\n\tconfig := sarama.NewConfig()\n\tconfig.Version = s.val.kafkaVersion\n\tadmin, err := sarama.NewClusterAdmin(s.val.brokerList, config)\n\tif err != nil {\n\t\t// log.Fatal(\"Cannot create cluster admin %s \", err)\n\t\treturn err\n\t}\n\tdefer admin.Close()\n\t// schema topic should be comacted\n\tcleanupPolicy := \"compact\"\n\terr = admin.CreateTopic(schemaTopic, &sarama.TopicDetail{\n\t\tNumPartitions: 1,\n\t\tReplicationFactor: 1,\n\t\tConfigEntries: map[string]*string{\n\t\t\t\"cleanup.policy\": &cleanupPolicy,\n\t\t},\n\t}, false)\n\treturn err\n\n}", "func CreateTopicOperation(k8sh *utils.K8sHelper, manifests installer.CephManifests) *TopicOperation {\n\treturn &TopicOperation{k8sh, manifests}\n}", "func (tm *topicManager) closeTopic(l log) error {\n\tdelete(tm.topicNamesToLogs, l.getTopicName())\n\tdefer l.close()\n\treturn nil\n}", "func (s *SimpleFSM) Restore(kvMap io.ReadCloser) error {\n\n\tkvSnapshot := make(map[string]string)\n\tif err := json.NewDecoder(kvMap).Decode(&kvSnapshot); err != nil {\n\t\treturn err\n\t}\n\n\t// Set the state from the snapshot, no lock required according to\n\t// Hashicorp docs.\n\tfor k, v := range kvSnapshot {\n\t\ts.db.Update(func(tx *bolt.Tx) error {\n\t\t\tb := tx.Bucket(bucket)\n\t\t\terr := b.Put([]byte(k), []byte(v))\n\t\t\treturn err\n\t\t})\n\t}\n\treturn nil\n}", "func (p *nsqPublisher) CreateTopic(topic string) error {\n\t//nolint:noctx\n\treq, err := http.NewRequest(http.MethodPost, fmt.Sprintf(\"http://%s/topic/create?topic=%s\", p.httpEndpoint, topic), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Add(\"ContentType\", \"text/plain\")\n\n\tresp, err := p.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.StatusCode >= 300 {\n\t\tbodyBytes, err := io.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn fmt.Errorf(\"error creating topic: %s\", string(bodyBytes))\n\t}\n\n\t_ = resp.Body.Close()\n\treturn nil\n}", "func (b *raftBadger) Restore(rClose io.ReadCloser) error {\n\tdefer func() {\n\t\tif err := rClose.Close(); err != nil {\n\t\t\t_, _ = fmt.Fprintf(os.Stdout, \"[FINALLY RESTORE] close error %s\\n\", err.Error())\n\t\t}\n\t}()\n\n\t_, _ = fmt.Fprintf(os.Stdout, \"[START RESTORE] read all message from snapshot\\n\")\n\tvar totalRestored int\n\n\tdecoder := json.NewDecoder(rClose)\n\tfor decoder.More() {\n\t\tvar data = &command{}\n\t\terr := decoder.Decode(data)\n\t\tif err != nil {\n\t\t\tif !strings.Contains(err.Error(), \"EOF\") {\n\t\t\t\t_, _ = fmt.Fprintf(os.Stdout, \"[END RESTORE]snap skipped\\n\", totalRestored)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\t_, _ = fmt.Fprintf(os.Stdout, \"[END RESTORE] error decode data %s\\n\", err.Error())\n\t\t\treturn err\n\t\t}\n\t\tvar key string\n\t\tif key, err = b.gs.Save(data.Key, data.Store, data.Value); err != nil {\n\t\t\t_, _ = fmt.Fprintf(os.Stdout, \"[END RESTORE] error persist data %s\\n\", err.Error())\n\t\t\treturn err\n\t\t}\n\t\tb.logger.Debug(\"restored key\", \"key\", hclog.Fmt(\"%v\", key))\n\n\t\ttotalRestored++\n\t}\n\n\t// read closing bracket\n\t_, err := decoder.Token()\n\tif err != nil && !strings.Contains(err.Error(), \"EOF\") {\n\t\t_, _ = fmt.Fprintf(os.Stdout, \"[END RESTORE] error %s\\n\", err.Error())\n\t\treturn err\n\t}\n\n\t_, _ = fmt.Fprintf(os.Stdout, \"[END RESTORE] success restore %d messages in snapshot\\n\", totalRestored)\n\treturn nil\n}", "func (client *Client) MetastoreCreateKafkaTopic(request *MetastoreCreateKafkaTopicRequest) (response *MetastoreCreateKafkaTopicResponse, err error) {\n\tresponse = CreateMetastoreCreateKafkaTopicResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func cephRBDVolumeRestore(clusterName string, poolName string, volumeName string,\n\tvolumeType string, snapshotName string, userName string) error {\n\t_, err := shared.RunCommand(\n\t\t\"rbd\",\n\t\t\"--id\", userName,\n\t\t\"--cluster\", clusterName,\n\t\t\"--pool\", poolName,\n\t\t\"snap\",\n\t\t\"rollback\",\n\t\t\"--snap\", snapshotName,\n\t\tfmt.Sprintf(\"%s_%s\", volumeType, volumeName))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func NewTopic(session *mgo.Session, name string) *Topic {\n\treturn &Topic{\n\t\tsession: session,\n\t\tname: name,\n\t}\n}", "func (s *KVStore) RestoreSnapshot(snapshot []byte) {\n\tlog.Printf(\"Restore all value from a snapshot\")\n\tread := bytes.NewBuffer(snapshot)\n\tdecoder := gob.NewDecoder(read)\n\tdecoder.Decode(&s.store)\n}", "func (e *Extractor) buildTopic(topic_name string) meta.Topic {\n\treturn meta.Topic{\n\t\tUrn: topic_name,\n\t\tName: topic_name,\n\t\tSource: \"kafka\",\n\t}\n}", "func (bin unixRecycleBin) Restore(trashFilename string) error {\n\ttrashInfoPath := buildTrashInfoPath(bin.Path, trashFilename)\n\ttrashInfo, err := readTrashInfo(trashInfoPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdeletedFilePath := buildTrashFilePath(bin.Path, trashFilename)\n\tif err := fs.Rename(deletedFilePath, trashInfo.Path); err != nil {\n\t\treturn err\n\t}\n\terr = fs.Remove(buildTrashInfoPath(bin.Path, trashFilename))\n\treturn err\n}", "func rollbackSchema(w io.Writer, projectID, schemaID, revisionID string) error {\n\t// projectID := \"my-project-id\"\n\t// schemaID := \"my-schema\"\n\t// revisionID := \"a1b2c3d4\"\n\tctx := context.Background()\n\tclient, err := pubsub.NewSchemaClient(ctx, projectID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"pubsub.NewSchemaClient: %w\", err)\n\t}\n\tdefer client.Close()\n\n\ts, err := client.RollbackSchema(ctx, schemaID, revisionID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"RollbackSchema: %w\", err)\n\t}\n\tfmt.Fprintf(w, \"Rolled back a schema: %#v\\n\", s)\n\treturn nil\n}", "func KeyToTopic(key string) string {\n\t// Record-store keys are arbitrary binary. However, pubsub requires UTF-8 string topic IDs.\n\t// Encodes to \"/record/base64url(key)\"\n\treturn \"/record/\" + base64.RawURLEncoding.EncodeToString([]byte(key))\n}", "func (es *EventStore) AddTopic(topic Topic) (string, error) {\n\tstart := time.Now()\n\tdefer func() {\n\t\tmetrics.EventStoreLatency(\"AddTopic\", start)\n\t}()\n\n\tname := strings.ToLower(topic.Name)\n\tschema := topic.Schema\n\n\tif name == \"\" {\n\t\treturn \"\", errors.New(\"Topic name cannot be empty\")\n\t} else if es.getTopicID(name) != \"\" {\n\t\treturn \"\", jh.NewError(errors.New(\"Topic with name already exists\").Error(), http.StatusConflict)\n\t}\n\n\tschemaStr := \"{}\"\n\tif schema != nil {\n\t\tschemaBytes, err := json.Marshal(schema)\n\t\tif err != nil {\n\t\t\treturn \"\", jh.NewError(errors.Wrap(err, \"Error marshalling schema into json\").Error(), http.StatusBadRequest)\n\t\t}\n\t\tschemaStr = string(schemaBytes)\n\t}\n\n\tjsonSchema, ok := es.validateSchema(schemaStr)\n\tif !ok {\n\t\treturn \"\", jh.NewError(errors.New(\"Error adding topic - schema is not in valid JSON format\").Error(), http.StatusBadRequest)\n\t}\n\n\tid := uuid.NewV4().String()\n\tif err := es.ds.AddTopic(RawTopic{\n\t\tID: id,\n\t\tName: name,\n\t\tSchema: schemaStr,\n\t}); err != nil {\n\t\tmetrics.DBError(\"write\")\n\t\treturn \"\", errors.Wrap(err, \"Error adding topic to data source\")\n\t}\n\n\tes.topicMutex.Lock()\n\tes.topicNameToID[name] = id\n\tes.topicIDToName[id] = name\n\tes.topicSchemaPropertiesMap[id] = schema\n\tes.topicSchemaMap[id] = jsonSchema\n\tes.topicMutex.Unlock()\n\n\treturn id, nil\n}", "func Sub(c mqtt.Client, topic string) {\n\tvar choke = make(chan [2]string)\n\n\tvar f mqtt.MessageHandler = func(client mqtt.Client, msg mqtt.Message) {\n\t\tchoke <- [2]string{msg.Topic(), string(msg.Payload())}\n\t}\n\tfor {\n\t\tif token := c.Subscribe(topic, 0, f); token.Wait() && token.Error() != nil {\n\t\t\tmqtt.ERROR.Println(token.Error())\n\t\t\tos.Exit(1)\n\t\t}\n\t\tfor {\n\t\t\tincoming := <-choke\n\t\t\tmqtt.ERROR.Printf(\"Received:TOPIC: %s\\n\", incoming[0])\n\t\t\twriteFile(incoming[1])\n\t\t}\n\t}\n\n}", "func (api *snapshotrestoreAPI) Create(obj *cluster.SnapshotRestore) error {\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = apicl.ClusterV1().SnapshotRestore().Create(context.Background(), obj)\n\t\tif err != nil && strings.Contains(err.Error(), \"AlreadyExists\") {\n\t\t\t_, err = apicl.ClusterV1().SnapshotRestore().Update(context.Background(), obj)\n\n\t\t}\n\t\treturn err\n\t}\n\n\tapi.ct.handleSnapshotRestoreEvent(&kvstore.WatchEvent{Object: obj, Type: kvstore.Created})\n\treturn nil\n}", "func NewTopic(node storm.Node) *Topic {\n\treturn &Topic{\n\t\tnode: node,\n\t}\n}", "func NewTopic(n string, ts []string) *Topic {\n\treturn &Topic{ID: strings.ToLower(n), Name: n, Tags: ts, Created: time.Now()}\n}", "func ExampleTopicsClient_CreateOrUpdate() {\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 := armservicebus.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.NewTopicsClient().CreateOrUpdate(ctx, \"ArunMonocle\", \"sdk-Namespace-1617\", \"sdk-Topics-5488\", armservicebus.SBTopic{\n\t\tProperties: &armservicebus.SBTopicProperties{\n\t\t\tEnableExpress: to.Ptr(true),\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.SBTopic = armservicebus.SBTopic{\n\t// \tName: to.Ptr(\"sdk-Topics-5488\"),\n\t// \tType: to.Ptr(\"Microsoft.ServiceBus/Namespaces/Topics\"),\n\t// \tID: to.Ptr(\"/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-1617/topics/sdk-Topics-5488\"),\n\t// \tProperties: &armservicebus.SBTopicProperties{\n\t// \t\tAccessedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2017-05-26T20:50:34.32Z\"); return t}()),\n\t// \t\tAutoDeleteOnIdle: to.Ptr(\"P10675199DT2H48M5.4775807S\"),\n\t// \t\tCreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2017-05-26T20:50:34.1Z\"); return t}()),\n\t// \t\tDefaultMessageTimeToLive: to.Ptr(\"P10675199DT2H48M5.4775807S\"),\n\t// \t\tDuplicateDetectionHistoryTimeWindow: to.Ptr(\"PT10M\"),\n\t// \t\tEnableBatchedOperations: to.Ptr(true),\n\t// \t\tEnableExpress: to.Ptr(true),\n\t// \t\tEnablePartitioning: to.Ptr(false),\n\t// \t\tMaxMessageSizeInKilobytes: to.Ptr[int64](10240),\n\t// \t\tMaxSizeInMegabytes: to.Ptr[int32](10240),\n\t// \t\tRequiresDuplicateDetection: to.Ptr(false),\n\t// \t\tSizeInBytes: to.Ptr[int64](0),\n\t// \t\tStatus: to.Ptr(armservicebus.EntityStatusActive),\n\t// \t\tSubscriptionCount: to.Ptr[int32](0),\n\t// \t\tSupportOrdering: to.Ptr(true),\n\t// \t\tUpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2017-05-26T20:50:34.32Z\"); return t}()),\n\t// \t},\n\t// }\n}", "func (t *Task) buildBackup(client k8sclient.Client, backupTypePrefix string) (*velero.Backup, error) {\n\tvar includeClusterResources *bool = nil\n\tannotations, err := t.getAnnotations(client)\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tbackupLocation, err := t.getBSL()\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\tsnapshotLocation, err := t.getVSL()\n\tif err != nil {\n\t\treturn nil, liberr.Wrap(err)\n\t}\n\n\t// Construct a restore name like \"$migrationname-54823-initial\" or \"$migrationname-54823-stage\".\n\t// This will produce a 57 character string max. Note that generateName gracefully handles strings >63 char.\n\tfmtString := fmt.Sprintf(\"%%.%ds\", 55-len(backupTypePrefix))\n\tmigrationNameTruncated := fmt.Sprintf(fmtString, t.Owner.GetName())\n\ttruncatedGenerateName := fmt.Sprintf(\"%s-%s-\", migrationNameTruncated, backupTypePrefix)\n\n\tbackup := &velero.Backup{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tLabels: t.Owner.GetCorrelationLabels(),\n\t\t\tGenerateName: truncatedGenerateName,\n\t\t\tNamespace: migapi.VeleroNamespace,\n\t\t\tAnnotations: annotations,\n\t\t},\n\t\tSpec: velero.BackupSpec{\n\t\t\tIncludeClusterResources: includeClusterResources,\n\t\t\tStorageLocation: backupLocation.Name,\n\t\t\tVolumeSnapshotLocations: []string{snapshotLocation.Name},\n\t\t\tTTL: metav1.Duration{Duration: 720 * time.Hour},\n\t\t\tIncludedNamespaces: t.sourceNamespaces(),\n\t\t\tHooks: velero.BackupHooks{\n\t\t\t\tResources: []velero.BackupResourceHookSpec{},\n\t\t\t},\n\t\t},\n\t}\n\treturn backup, nil\n}", "func (b *BackupEngine) RestoreDBFromLatestBackup(dbDir, walDir string, ro *RestoreOptions) (err error) {\n\tcDbDir := C.CString(dbDir)\n\tcWalDir := C.CString(walDir)\n\n\tvar cErr *C.char\n\tC.rocksdb_backup_engine_restore_db_from_latest_backup(b.c, cDbDir, cWalDir, ro.c, &cErr)\n\terr = fromCError(cErr)\n\n\tC.free(unsafe.Pointer(cDbDir))\n\tC.free(unsafe.Pointer(cWalDir))\n\treturn\n}", "func NewTopicRouter(br fiber.Router, conn *config.DBConn) {\n\trouter := br.Group(\"/topics\")\n\ttopicRepo := repository.NewTopicRepository(conn)\n\tpostRepo := repository.NewPostRepository(conn)\n\tuserRepo := repository.NewUserRepository(conn)\n\ttopicService := services.NewTopicService(topicRepo, postRepo, userRepo)\n\ttopicController := controllers.NewTopicController(topicService)\n\n\trouter.Get(\"/:id\", topicController.GetOne)\n\trouter.Get(\"/\", topicController.GetAll)\n\trouter.Post(\"/\", topicController.Create)\n}", "func (w *WAL) cut() error {\n\t// close old wal file; truncate to avoid wasting space if an early cut\n\toff, serr := w.tail().Seek(0, io.SeekCurrent)\n\tif serr != nil {\n\t\treturn serr\n\t}\n\n\tif err := w.tail().Truncate(off); err != nil {\n\t\treturn err\n\t}\n\n\tif err := w.sync(); err != nil {\n\t\treturn err\n\t}\n\n\tfpath := filepath.Join(w.dir, walName(w.seq()+1, w.enti+1))\n\n\t// create a temp wal file with name sequence + 1, or truncate the existing one\n\tnewTail, err := w.fp.Open()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// update writer and save the previous crc\n\tw.locks = append(w.locks, newTail)\n\tprevCrc := w.encoder.crc.Sum32()\n\tw.encoder, err = newFileEncoder(w.tail().File, prevCrc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = w.saveCrc(prevCrc); err != nil {\n\t\treturn err\n\t}\n\n\tif err = w.encoder.encode(&walpb.Record{Type: metadataType, Data: w.metadata}); err != nil {\n\t\treturn err\n\t}\n\n\tif err = w.saveState(&w.state); err != nil {\n\t\treturn err\n\t}\n\n\t// atomically move temp wal file to wal file\n\tif err = w.sync(); err != nil {\n\t\treturn err\n\t}\n\n\toff, err = w.tail().Seek(0, io.SeekCurrent)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = os.Rename(newTail.Name(), fpath); err != nil {\n\t\treturn err\n\t}\n\tstart := time.Now()\n\tif err = fileutil.Fsync(w.dirFile); err != nil {\n\t\treturn err\n\t}\n\twalFsyncSec.Observe(time.Since(start).Seconds())\n\n\t// reopen newTail with its new path so calls to Name() match the wal filename format\n\tnewTail.Close()\n\n\tif newTail, err = fileutil.LockFile(fpath, os.O_WRONLY, fileutil.PrivateFileMode); err != nil {\n\t\treturn err\n\t}\n\tif _, err = newTail.Seek(off, io.SeekStart); err != nil {\n\t\treturn err\n\t}\n\n\tw.locks[len(w.locks)-1] = newTail\n\n\tprevCrc = w.encoder.crc.Sum32()\n\tw.encoder, err = newFileEncoder(w.tail().File, prevCrc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tklog.Infof(fmt.Sprintf(\"created a new WAL segment path:%s\", fpath))\n\treturn nil\n}", "func (v *NopObject) Restore(Snapshot string) (err error) {\n\treturn\n}", "func RestoreSnapshot(snap []byte, appConfig string) *StateMachine {\n\tsm := New(appConfig)\n\terr := json.Unmarshal(snap, sm)\n\tif err != nil {\n\t\tglog.Fatal(\"Unable to restore from snapshot: \", err)\n\t}\n\treturn sm\n}", "func (r Restorer) Restore() {\n\tr()\n}", "func removeTopic(subID string, topics []string) (retErr error) {\n\n\t//Creazione nuovo insieme di topic eliminando quelli da rimuovere\n\torigTopics, err := getTopicList(subID)\n\tif err != nil {\n\t\tcommon.Fatal(\"[BROKER] Errore nell'ottenere la topic list\")\n\t}\n\n\tvar newTopics []string\n\n\tfor _, elem := range origTopics {\n\t\tif common.StringListContains(topics, elem) == false {\n\t\t\tnewTopics = append(newTopics, elem)\n\t\t}\n\t}\n\n\t//Se non rimane nessun topic, viene impostato il singolo topic empty\n\t//Nota bene: questo è necessario farlo poichè dynamodb non supporta le liste vuote\n\tif len(newTopics) == 0 {\n\t\tnewTopics = append(newTopics, \"empty\")\n\t}\n\n\tsvc := dynamodb.New(common.Sess)\n\n\tinput := &dynamodb.UpdateItemInput{\n\t\tExpressionAttributeValues: map[string]*dynamodb.AttributeValue{\n\t\t\t\":t\": {\n\t\t\t\tSS: aws.StringSlice(newTopics),\n\t\t\t},\n\t\t},\n\t\tTableName: aws.String(subTableName),\n\t\tKey: map[string]*dynamodb.AttributeValue{\n\t\t\t\"SubID\": {\n\t\t\t\tS: aws.String(subID),\n\t\t\t},\n\t\t},\n\t\tReturnValues: aws.String(\"UPDATED_NEW\"),\n\t\tUpdateExpression: aws.String(\"set Topics = :t\"),\n\t}\n\n\t_, err = svc.UpdateItem(input)\n\tif err != nil {\n\t\tcommon.Fatal(\"[BROKER] Errore nella rimozione di topic. \" + err.Error())\n\t\treturn err\n\t}\n\n\tcommon.Info(\"[BROKER] Topic rimosso con successo\")\n\n\treturn nil\n}", "func (r *Replica) tryRollbackRaftLearner(\n\tctx context.Context,\n\trangeDesc *roachpb.RangeDescriptor,\n\ttarget roachpb.ReplicationTarget,\n\treason kvserverpb.RangeLogEventReason,\n\tdetails string,\n) {\n\trepDesc, ok := rangeDesc.GetReplicaDescriptor(target.StoreID)\n\tisLearnerOrNonVoter := repDesc.GetType() == roachpb.LEARNER || repDesc.GetType() == roachpb.NON_VOTER\n\tif !ok || !isLearnerOrNonVoter {\n\t\t// There's no learner to roll back.\n\t\tlog.Event(ctx, \"learner to roll back not found; skipping\")\n\t\treturn\n\t}\n\n\t// If (for example) the promotion failed because of a context deadline\n\t// exceeded, we do still want to clean up after ourselves, so always use a new\n\t// context (but with the old tags and with some timeout to save this from\n\t// blocking the caller indefinitely).\n\tconst rollbackTimeout = 10 * time.Second\n\n\trollbackFn := func(ctx context.Context) error {\n\t\t_, err := execChangeReplicasTxn(\n\t\t\tctx, rangeDesc, reason, details,\n\t\t\t[]internalReplicationChange{{target: target, typ: internalChangeTypeRemove}},\n\t\t\tchangeReplicasTxnArgs{\n\t\t\t\tdb: r.store.DB(),\n\t\t\t\tliveAndDeadReplicas: r.store.allocator.storePool.liveAndDeadReplicas,\n\t\t\t\tlogChange: r.store.logChange,\n\t\t\t\ttestForceJointConfig: r.store.TestingKnobs().ReplicationAlwaysUseJointConfig,\n\t\t\t\ttestAllowDangerousReplicationChanges: r.store.TestingKnobs().AllowDangerousReplicationChanges,\n\t\t\t})\n\t\treturn err\n\t}\n\trollbackCtx := logtags.WithTags(context.Background(), logtags.FromContext(ctx))\n\tif err := contextutil.RunWithTimeout(\n\t\trollbackCtx, \"learner rollback\", rollbackTimeout, rollbackFn,\n\t); err != nil {\n\t\tlog.Infof(\n\t\t\tctx,\n\t\t\t\"failed to rollback %s %s, abandoning it for the replicate queue: %v\",\n\t\t\trepDesc.GetType(),\n\t\t\ttarget,\n\t\t\terr,\n\t\t)\n\t\tr.store.replicateQueue.MaybeAddAsync(ctx, r, r.store.Clock().NowAsClockTimestamp())\n\t} else {\n\t\tlog.Infof(ctx, \"rolled back %s %s in %s\", repDesc.GetType(), target, rangeDesc)\n\t}\n}", "func TestSubscriptionTopic(t *testing.T) {\n\tsub := NewFSubscription(\"foo\", nil)\n\tassert.Equal(t, \"foo\", sub.Topic())\n}", "func GenerateTopic(name string, s v1alpha1.TopicParameters) *pubsub.Topic {\n\tt := &pubsub.Topic{\n\t\tName: name,\n\t\tLabels: s.Labels,\n\t\tKmsKeyName: gcp.StringValue(s.KmsKeyName),\n\t}\n\tif s.MessageStoragePolicy != nil {\n\t\tt.MessageStoragePolicy = &pubsub.MessageStoragePolicy{\n\t\t\tAllowedPersistenceRegions: s.MessageStoragePolicy.AllowedPersistenceRegions,\n\t\t}\n\t}\n\tif s.MessageRetentionDuration != nil {\n\t\tt.MessageRetentionDuration = gcp.StringValue(s.MessageRetentionDuration)\n\t}\n\treturn t\n}", "func CreateRecovery(cluster, namespace, volumeName, deploymentName, mountPath, pathRestic string) {\n\tvar recovery map[string]interface{}\n\tvar nameRecovery string\n\t// TODO Backend -> local, s3, glusterFS, ...\n\tif cluster == \"ClusterFrom\" {\n\t\trecovery = utils.ReadJson(\"templates/recovery\", \"recovery_s3_template_from\")\n\t\tnameRecovery= \"recoveryFrom\"\n\t} else {\n\t\trecovery = utils.ReadJson(\"templates/recovery\", \"recovery_s3_template_to\")\n\t\tnameRecovery = \"recoveryTo\"\n\t}\n\n\t// Change namespace, name,\n\tauxName := \"recovery-\" + deploymentName\n\tauxName = deploymentName\n\trecovery[\"metadata\"].(map[string]interface{})[\"name\"] = auxName\n\trecovery[\"metadata\"].(map[string]interface{})[\"namespace\"] = namespace\n\trecovery[\"spec\"].(map[string]interface{})[\"workload\"].(map[string]interface{})[\"name\"] = deploymentName\n\trecovery[\"spec\"].(map[string]interface{})[\"paths\"].([]interface{})[0] = mountPath\n\trecovery[\"spec\"].(map[string]interface{})[\"recoveredVolumes\"].([]interface{})[0].(map[string]interface{})[\"mountPath\"] = mountPath\n\n\terr := utils.WriteJson(pathRestic, nameRecovery, recovery)\n\tif err != nil {\n\t\tfmt.Println(\"Error creating \" + auxName)\n\t}\n}", "func (m *subscriptionMigrator) migrateSubscription(sub kymaeventingv1alpha1.Subscription) error {\n\tsubKey := fmt.Sprintf(\"%s/%s\", sub.Namespace, sub.Name)\n\n\tlog.Printf(\"+ Checking Subscription %q\", subKey)\n\tif m.findTriggerForSubscription(sub) != nil {\n\t\tlog.Printf(\"+ Trigger already exists for Subscription %q, skipping\", subKey)\n\t\treturn nil\n\t}\n\n\tlog.Printf(\"+ Trigger not found for Subscription %q\", subKey)\n\ttrigger, err := m.createTriggerForSubscription(sub)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"creating Trigger for Subscription %q\", subKey)\n\t}\n\tlog.Printf(\"+ Trigger \\\"%s/%s\\\" created for Subscription %q\", trigger.Namespace, trigger.Name, subKey)\n\n\treturn nil\n}", "func (b *Topics) CreateTopic(topic_id string) {\n\tb.sub_lock.Lock()\n\tif nil == b.sub_topics[topic_id] {\n\t\tb.sub_topics[topic_id] = Subscribers{}\n\t}\n\tb.sub_lock.Unlock()\n}", "func (a *actuator) Restore(ctx context.Context, ex *extensionsv1alpha1.Extension) error {\n\treturn a.Reconcile(ctx, ex)\n}", "func TestTopicBeDeleteDuringProducerRunning(t *testing.T) {\n\tSetUp(t)\n\n\ttopicInfo2 := &topic.TopicInfo{\n\t\tTopicName: topicName,\n\t\tTopicTalosResourceName: &topic.TopicTalosResourceName{anotherResourceName},\n\t\tOwnerId: ownerId,\n\t}\n\ttopicAttribute2 := &topic.TopicAttribute{\n\t\tPartitionNumber: thrift.Int32Ptr(partitionNumber),\n\t\tMessageRetentionSecs: thrift.Int32Ptr(messageRetentionMs),\n\t}\n\ttopicState2 := &topic.TopicState{\n\t\tTopicStatus: topic.TopicStatus_ACTIVE,\n\t\tCreateTimestamp: utils.CurrentTimeMills(),\n\t}\n\tanother := &topic.Topic{\n\t\tTopicInfo: topicInfo2,\n\t\tTopicAttribute: topicAttribute2,\n\t\tTopicState: topicState2,\n\t}\n\n\tgomock.InOrder(\n\t\ttalosAdminMock.EXPECT().DescribeTopic(&topic.DescribeTopicRequest{topicName}).Return(topic1, nil).Times(1),\n\t\ttalosAdminMock.EXPECT().DescribeTopic(&topic.DescribeTopicRequest{topicName}).Return(another, nil).Times(1),\n\t)\n\n\ttalosProducer = producer.NewTalosProducerForTest(talosProducerConfig,\n\t\ttalosClientFactoryMock, talosAdminMock,\n\t\t&topic.TopicTalosResourceName{resourceName},\n\t\t&client.SimpleTopicAbnormalCallback{}, &TestCallback{})\n\n\t// wait check partition interval\n\ttime.Sleep(time.Duration(checkPartitionInterval*2) * time.Millisecond)\n}", "func (ctl Controller) RestoreLatest() *pitr.Error {\n\treturn ctl.Restore(\"LATEST\")\n}", "func TestStore_Snapshot_And_Restore(t *testing.T) {\n\tt.Parallel()\n\n\ts := MustOpenStore()\n\ts.LeaveFiles = true\n\n\t// Create a bunch of databases in the Store\n\tnDatabases := 5\n\tfor n := 0; n < nDatabases; n++ {\n\t\ts.CreateDatabase(fmt.Sprintf(\"db%d\", n))\n\t}\n\n\t// Test taking a snapshot.\n\tif err := s.Store.Snapshot(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ts.Close()\n\n\t// Test restoring the snapshot taken above.\n\texistingDataPath := s.Path()\n\ts = NewStore(NewConfig(existingDataPath))\n\tif err := s.Open(); err != nil {\n\t\tpanic(err)\n\t}\n\tdefer s.Close()\n\n\t// Wait until the server is ready.\n\tselect {\n\tcase err := <-s.Err():\n\t\tpanic(err)\n\tcase <-s.Ready():\n\t}\n\n\t// Make sure all the data we added to the Store is still there.\n\tfor n := 0; n < nDatabases; n++ {\n\t\tname := fmt.Sprintf(\"db%d\", n)\n\t\tif dbi, err := s.Database(name); err != nil {\n\t\t\tt.Fatal(err)\n\t\t} else if dbi == nil {\n\t\t\tt.Fatalf(\"database not found: %s\", name)\n\t\t} else if dbi.Name != name {\n\t\t\tt.Fatal(name)\n\t\t}\n\t}\n}", "func (_this *RaftNode) replayWAL() *wal.WAL {\n\tw := _this.openWAL()\n\t_, st, ents, err := w.ReadAll()\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to read WAL. %v\", err)\n\t}\n\n\t// append to storage so raft starts at the right place in log.\n\t_this.raftStorage.Append(ents)\n\t// send nil once lastIndex is published so client knows commit channel is current\n\tif len(ents) > 0 {\n\t\t_this.lastIndex = ents[len(ents)-1].Index\n\t} else {\n\t\t_this.commitC <- nil\n\t}\n\t_this.raftStorage.SetHardState(st)\n\treturn w\n}", "func (tm *TabletManager) restoreToTimeFromBinlog(ctx context.Context, pos replication.Position, restoreTime *vttime.Time) error {\n\t// validate the minimal settings necessary for connecting to binlog server\n\tif binlogHost == \"\" || binlogPort <= 0 || binlogUser == \"\" {\n\t\tlog.Warning(\"invalid binlog server setting, restoring to last available backup.\")\n\t\treturn nil\n\t}\n\n\ttimeoutCtx, cancelFnc := context.WithTimeout(ctx, timeoutForGTIDLookup)\n\tdefer cancelFnc()\n\n\tafterGTIDPos, beforeGTIDPos, err := tm.getGTIDFromTimestamp(timeoutCtx, pos, restoreTime.Seconds)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif afterGTIDPos == \"\" && beforeGTIDPos == \"\" {\n\t\treturn vterrors.New(vtrpcpb.Code_FAILED_PRECONDITION, fmt.Sprintf(\"unable to fetch the GTID for the specified time - %s\", restoreTime.String()))\n\t} else if afterGTIDPos == \"\" && beforeGTIDPos != \"\" {\n\t\tlog.Info(\"no afterGTIDPos found, which implies we reached the end of all GTID events\")\n\t}\n\n\tlog.Infof(\"going to restore upto the GTID - %s\", afterGTIDPos)\n\t// when we don't have before GTID, we will take it as current backup pos's last GTID\n\t// this is case where someone tries to restore just to the 1st event after backup\n\tif beforeGTIDPos == \"\" {\n\t\tbeforeGTIDPos = pos.GTIDSet.Last()\n\t}\n\terr = tm.catchupToGTID(timeoutCtx, afterGTIDPos, beforeGTIDPos)\n\tif err != nil {\n\t\treturn vterrors.Wrapf(err, \"unable to replicate upto desired GTID : %s\", afterGTIDPos)\n\t}\n\n\treturn nil\n}", "func (c *Container) Restore(ctx context.Context, name string) error {\n\treturn c.client.ContainerStart(ctx, c.id, types.ContainerStartOptions{CheckpointID: name})\n}", "func (r *Release) rollback(cs *currentState, p *plan) {\n\trs, ok := cs.releases[r.key()]\n\tif !ok {\n\t\treturn\n\t}\n\n\tif r.Namespace == rs.Namespace {\n\n\t\tcmd := helmCmd(concat([]string{\"rollback\", r.Name, rs.getRevision()}, r.getWait(), r.getTimeout(), r.getNoHooks(), flags.getRunFlags()), \"Rolling back release [ \"+r.Name+\" ] in namespace [ \"+r.Namespace+\" ]\")\n\t\tp.addCommand(cmd, r.Priority, r, []hookCmd{}, []hookCmd{})\n\t\tr.upgrade(p) // this is to reflect any changes in values file(s)\n\t\tp.addDecision(\"Release [ \"+r.Name+\" ] was deleted and is desired to be rolled back to \"+\n\t\t\t\"namespace [ \"+r.Namespace+\" ]\", r.Priority, create)\n\t} else {\n\t\tr.reInstall(p)\n\t\tp.addDecision(\"Release [ \"+r.Name+\" ] is deleted BUT from namespace [ \"+rs.Namespace+\n\t\t\t\" ]. Will purge delete it from there and install it in namespace [ \"+r.Namespace+\" ]\", r.Priority, create)\n\t\tp.addDecision(\"WARNING: rolling back release [ \"+r.Name+\" ] from [ \"+rs.Namespace+\" ] to [ \"+r.Namespace+\n\t\t\t\" ] might not correctly connect to existing volumes. Check https://github.com/Praqma/helmsman/blob/master/docs/how_to/apps/moving_across_namespaces.md\"+\n\t\t\t\" for details if this release uses PV and PVC.\", r.Priority, create)\n\t}\n}", "func CreateTopic(p *kafka.Producer, topic string) {\n\n\ta, err := kafka.NewAdminClientFromProducer(p)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to create new admin client from producer: %s\", err)\n\t\tos.Exit(1)\n\t}\n\t// Contexts are used to abort or limit the amount of time\n\t// the Admin call blocks waiting for a result.\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\t// Create topics on cluster.\n\t// Set Admin options to wait up to 60s for the operation to finish on the remote cluster\n\tmaxDur, err := time.ParseDuration(\"60s\")\n\tif err != nil {\n\t\tfmt.Printf(\"ParseDuration(60s): %s\", err)\n\t\tos.Exit(1)\n\t}\n\tresults, err := a.CreateTopics(\n\t\tctx,\n\t\t// Multiple topics can be created simultaneously\n\t\t// by providing more TopicSpecification structs here.\n\t\t[]kafka.TopicSpecification{{\n\t\t\tTopic: topic,\n\t\t\tNumPartitions: 1,\n\t\t\tReplicationFactor: 3}},\n\t\t// Admin options\n\t\tkafka.SetAdminOperationTimeout(maxDur))\n\tif err != nil {\n\t\tfmt.Printf(\"Admin Client request error: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\tfor _, result := range results {\n\t\tif result.Error.Code() != kafka.ErrNoError && result.Error.Code() != kafka.ErrTopicAlreadyExists {\n\t\t\tfmt.Printf(\"Failed to create topic: %v\\n\", result.Error)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tfmt.Printf(\"%v\\n\", result)\n\t}\n\ta.Close()\n\n}", "func ExampleServersClient_BeginCreate_createADatabaseAsAPointInTimeRestore() {\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 := armmariadb.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpoller, err := clientFactory.NewServersClient().BeginCreate(ctx, \"TargetResourceGroup\", \"targetserver\", armmariadb.ServerForCreate{\n\t\tLocation: to.Ptr(\"brazilsouth\"),\n\t\tProperties: &armmariadb.ServerPropertiesForRestore{\n\t\t\tCreateMode: to.Ptr(armmariadb.CreateModePointInTimeRestore),\n\t\t\tRestorePointInTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2017-12-14T00:00:37.467Z\"); return t }()),\n\t\t\tSourceServerID: to.Ptr(\"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforMariaDB/servers/sourceserver\"),\n\t\t},\n\t\tSKU: &armmariadb.SKU{\n\t\t\tName: to.Ptr(\"GP_Gen5_2\"),\n\t\t\tCapacity: to.Ptr[int32](2),\n\t\t\tFamily: to.Ptr(\"Gen5\"),\n\t\t\tTier: to.Ptr(armmariadb.SKUTierGeneralPurpose),\n\t\t},\n\t\tTags: map[string]*string{\n\t\t\t\"ElasticServer\": to.Ptr(\"1\"),\n\t\t},\n\t}, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\tres, err := poller.PollUntilDone(ctx, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to pull the result: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.Server = armmariadb.Server{\n\t// \tName: to.Ptr(\"targetserver\"),\n\t// \tType: to.Ptr(\"Microsoft.DBforMariaDB/servers\"),\n\t// \tID: to.Ptr(\"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMariaDB/servers/targetserver\"),\n\t// \tLocation: to.Ptr(\"brazilsouth\"),\n\t// \tTags: map[string]*string{\n\t// \t\t\"elasticServer\": to.Ptr(\"1\"),\n\t// \t},\n\t// \tProperties: &armmariadb.ServerProperties{\n\t// \t\tAdministratorLogin: to.Ptr(\"cloudsa\"),\n\t// \t\tEarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2018-03-14T18:02:41.577+00:00\"); return t}()),\n\t// \t\tFullyQualifiedDomainName: to.Ptr(\"targetserver.mariadb.database.azure.com\"),\n\t// \t\tSSLEnforcement: to.Ptr(armmariadb.SSLEnforcementEnumEnabled),\n\t// \t\tStorageProfile: &armmariadb.StorageProfile{\n\t// \t\t\tBackupRetentionDays: to.Ptr[int32](7),\n\t// \t\t\tGeoRedundantBackup: to.Ptr(armmariadb.GeoRedundantBackupEnabled),\n\t// \t\t\tStorageMB: to.Ptr[int32](128000),\n\t// \t\t},\n\t// \t\tUserVisibleState: to.Ptr(armmariadb.ServerStateReady),\n\t// \t\tVersion: to.Ptr(armmariadb.ServerVersionTen3),\n\t// \t},\n\t// \tSKU: &armmariadb.SKU{\n\t// \t\tName: to.Ptr(\"GP_Gen5_2\"),\n\t// \t\tCapacity: to.Ptr[int32](2),\n\t// \t\tFamily: to.Ptr(\"Gen5\"),\n\t// \t\tTier: to.Ptr(armmariadb.SKUTierGeneralPurpose),\n\t// \t},\n\t// }\n}", "func (_Flytrap *FlytrapTransactorSession) AddTopic(topic string, country [2]byte, addPubCost *big.Int, addSubCost *big.Int, reason string, sensitive bool) (*types.Transaction, error) {\n\treturn _Flytrap.Contract.AddTopic(&_Flytrap.TransactOpts, topic, country, addPubCost, addSubCost, reason, sensitive)\n}", "func newSubscriptionMigrator(kymaClient kymaeventingclientset.Interface,\n\tknativeClient kneventingclientset.Interface, namespaces []string) (*subscriptionMigrator, error) {\n\n\tm := &subscriptionMigrator{\n\t\tkymaClient: kymaClient,\n\t\tknativeClient: knativeClient,\n\t}\n\n\tif err := m.populateSubscriptions(namespaces); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := m.populateTriggers(namespaces); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn m, nil\n}", "func (s *StanServer) createSubStore() *subStore {\n\tsubs := &subStore{\n\t\tpsubs: make([]*subState, 0, 4),\n\t\tqsubs: make(map[string]*queueState),\n\t\tdurables: make(map[string]*subState),\n\t\tacks: make(map[string]*subState),\n\t\tinboxes: make(map[string]*subState),\n\t\tstan: s,\n\t}\n\treturn subs\n}", "func RestoreBackup(dto *action_dtos.RestoreBackupDto, service *pgCommon.PostgresServiceInformations) error {\n\t_, err := service.PgoApi.RestoreBackup(&msgs.RestoreRequest{\n\t\tBackrestStorageType: \"s3\",\n\t\tNamespace: service.ClusterInstance.Namespace,\n\t\tFromCluster: dto.OldClusterName,\n\t})\n\n\tif err != nil {\n\t\tlogger.RError(err, \"Unable to progress restore backup action for \"+service.ClusterInstance.Name)\n\t}\n\n\treturn err\n}", "func create(l *lambdasrv.Lambda, version string, note CreateNote) (string, error) {\n\tnoteId := &id{}\n\tstatus, err := lambda.InvokeLambda(l, version, nil, nil, note, noteId)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"saver lambda: %w\", err)\n\t}\n\tif status != http.StatusCreated {\n\t\treturn \"\", fmt.Errorf(\"create note: expected status: %v got %v\", http.StatusCreated, status)\n\t}\n\treturn noteId.ID, nil\n}", "func NewTopic() *Topic {\n\treturn &Topic{}\n}", "func (_Flytrap *FlytrapTransactor) AddTopic(opts *bind.TransactOpts, topic string, country [2]byte, addPubCost *big.Int, addSubCost *big.Int, reason string, sensitive bool) (*types.Transaction, error) {\n\treturn _Flytrap.contract.Transact(opts, \"addTopic\", topic, country, addPubCost, addSubCost, reason, sensitive)\n}", "func (c *consumer) Back() error {\n\tif err := c.store.Back(c.topic, c.ackOffset); err != nil {\n\t\treturn fmt.Errorf(\"backing topic %s with offset %d: %v\", c.topic, c.ackOffset, err)\n\t}\n\n\tc.outstanding = false\n\tc.notifier.NotifyConsumer(c.topic, eventTypeBack)\n\n\treturn nil\n}", "func CreateTopics(ctx context.Context, admin *kafka.AdminClient, details KafkaBroker) {\n\n\t// create topic configs\n\ttopicConfigs := buildTopicConfig(details)\n\tresults, _ := admin.CreateTopics(ctx, topicConfigs)\n\n\tfmt.Println(\"result topic creation\", results)\n\n\tfailedTopics := make(map[string]bool)\n\tfor _, res := range results {\n\t\tif res.Error.Code() == kafka.ErrTopicAlreadyExists {\n\t\t\tfailedTopics[res.Topic] = true\n\t\t}\n\t}\n\n\tif len(failedTopics) > 0 {\n\t\talterTopicConfigs := make([]kafka.TopicSpecification, 0, 0)\n\t\tfor _, topic := range topicConfigs {\n\t\t\tif _, ok := failedTopics[topic.Topic]; ok {\n\t\t\t\talterTopicConfigs = append(alterTopicConfigs, topic)\n\t\t\t}\n\t\t}\n\n\t\talterTopicsCgf := alterConfig(alterTopicConfigs)\n\t\tres, err := admin.AlterConfigs(ctx, alterTopicsCgf)\n\t\tfmt.Println(\"result topic alteration\", res, err)\n\t}\n\n}", "func initAndRestore(dbInfo *DatabaseInfo, targetDir string) error {\n\trestore, err := getMongoRestore(dbInfo, targetDir)\n\tif err != nil {\n\t\tfmt.Printf(\"Mongo restore initialization failed: %s\", err)\n\t\treturn err\n\t}\n\tif result := restore.Restore(); result.Err != nil {\n\t\tfmt.Printf(\"Mongo restore failed: %s\", result.Err)\n\t\treturn result.Err\n\t}\n\treturn nil\n}", "func restoreKV(r *Restore, c *consul.Consul) {\n\trestoredKeyCount := 0\n\terrorCount := 0\n\tfor _, data := range r.JSONData {\n\t\t_, err := c.Client.KV().Put(data, nil)\n\t\tif err != nil {\n\t\t\terrorCount++\n\t\t\tlog.Printf(\"Unable to restore key: %s, %v\", data.Key, err)\n\t\t}\n\t\trestoredKeyCount++\n\t}\n\tlog.Printf(\"[INFO] Restored %v keys with %v errors\", restoredKeyCount, errorCount)\n}", "func NewGenericWAL(wal *WAL) (*GenericWAL, error) {\n gWal := &GenericWAL{\n wal: wal,\n recoveryMap: make(map[int64]*GenericWALRecord),\n }\n return gWal, nil\n}", "func New(path string, logger *persist.Logger, cancel <-chan struct{}, walStopped chan struct{}, settings map[string]bool) (u []Update, w *WAL, err error) {\n\t// Create a new WAL\n\tnewWal := WAL{\n\t\tavailablePages: []uint64{},\n\t\tfilePageCount: 0,\n\t\ttransactionCounter: 0,\n\t\tlogFile: nil,\n\t\tlog: logger,\n\t\tsettings: settings,\n\t}\n\n\t// Try opening the WAL file.\n\tnewWal.logFile, err = os.OpenFile(path, os.O_RDWR, 0600)\n\tif err == nil {\n\t\t// err == nil indicates that there is a WAL file, which means that the\n\t\t// previous shutdown was not clean. Restore the WAL and return the updates\n\t\tnewWal.log.Println(\"WARN: WAL file detected, performing recovery after unclean shutdown.\")\n\n\t\t// Recover WAL and return updates\n\t\tupdates, err := newWal.recover()\n\t\treturn updates, &newWal, err\n\n\t} else if !os.IsNotExist(err) {\n\t\t// the file exists but couldn't be opened\n\t\treturn nil, nil, build.ExtendErr(\"walFile was not opened successfully\", err)\n\t}\n\n\t// Create new empty WAL\n\tnewWal.logFile, err = os.Create(path)\n\tif err != nil {\n\t\treturn nil, nil, build.ExtendErr(\"walFile could not be created\", err)\n\t}\n\n\t// If there were no errors prepare clean shutdown\n\tgo func() {\n\t\tselect {\n\t\tcase <-cancel:\n\t\t}\n\t\tw.logFile.Close()\n\t\tif !w.settings[\"cleanWALFile\"] {\n\t\t\tos.Remove(path)\n\t\t}\n\t\tclose(walStopped)\n\t}()\n\treturn nil, &newWal, nil\n}", "func createTopics(kafkaAddress string, topics ...string) error {\n\n\tconn, err := kafka.Dial(\"tcp\", kafkaAddress)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"event-publisher.createTopics\")\n\t}\n\tdefer conn.Close()\n\n\tcontroller, err := conn.Controller()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"event-publisher.createTopics\")\n\t}\n\tvar controllerConn *kafka.Conn\n\tcontrollerConn, err = kafka.Dial(\"tcp\", net.JoinHostPort(controller.Host, strconv.Itoa(controller.Port)))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"event-publisher.createTopics\")\n\t}\n\tdefer controllerConn.Close()\n\tfor _, topic := range topics {\n\n\t\ttopicConfigs := []kafka.TopicConfig{\n\t\t\tkafka.TopicConfig{\n\t\t\t\tTopic: topic,\n\t\t\t\tNumPartitions: 1,\n\t\t\t\tReplicationFactor: 1,\n\t\t\t},\n\t\t}\n\n\t\terr = controllerConn.CreateTopics(topicConfigs...)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"event-publisher.createTopics\")\n\t\t}\n\t}\n\n\treturn nil\n}", "func (svc *SNS) createTopic(name string) (topicARN string, err error) {\n\ttopicName := svc.prefix + name\n\tin := &SDK.CreateTopicInput{\n\t\tName: pointers.String(topicName),\n\t}\n\tresp, err := svc.client.CreateTopic(in)\n\tif err != nil {\n\t\tsvc.Errorf(\"error on `CreateTopic` operation; name=%s; error=%s;\", name, err.Error())\n\t\treturn \"\", err\n\t}\n\treturn *resp.TopicArn, nil\n}", "func (t *TopicService) Create(name, description, parentID string) (*Topic, error) {\n\tquery := `\n\tmutation (\n\t\t$name: String!,\n\t\t$description: String,\n\t\t$parentId: ID\n\t){\n\t\tcreateTopic(\n\t\t\tname: $name, description: $description, parentId: $parentId\n\t\t){ id, name, description }\n\t}`\n\tvar resp struct {\n\t\tTopic *Topic `json:\"createTopic\"`\n\t}\n\tvars := map[string]interface{}{\"name\": name, \"description\": description, \"parentId\": parentID}\n\terr := t.client.Do(context.Background(), query, vars, &resp)\n\treturn resp.Topic, err\n}" ]
[ "0.7388679", "0.5776889", "0.54517996", "0.5324671", "0.52316856", "0.52075505", "0.5200593", "0.5074295", "0.50688195", "0.5018047", "0.49563769", "0.49482065", "0.49438968", "0.49104205", "0.49067542", "0.4878728", "0.48616022", "0.48592317", "0.48512042", "0.48401818", "0.48293346", "0.4826911", "0.48152378", "0.48047054", "0.478865", "0.47751322", "0.4694502", "0.46688735", "0.4644747", "0.46117958", "0.46075088", "0.45825455", "0.45693532", "0.45623946", "0.4548324", "0.45469782", "0.4530172", "0.45093954", "0.4502007", "0.44982842", "0.44855177", "0.4485051", "0.44789207", "0.4477266", "0.44754502", "0.44626677", "0.44485766", "0.44431373", "0.44363376", "0.44273862", "0.4421797", "0.44150594", "0.44131383", "0.44121748", "0.44058815", "0.43975303", "0.43871278", "0.43844417", "0.43826082", "0.43683216", "0.43625695", "0.43619534", "0.43587846", "0.43539327", "0.4350482", "0.43497932", "0.43490776", "0.4349014", "0.43482825", "0.43355948", "0.43245918", "0.43240255", "0.43214008", "0.43174917", "0.43117222", "0.43098116", "0.42978573", "0.4289457", "0.42893183", "0.42887723", "0.4284596", "0.4284283", "0.42840865", "0.42825395", "0.42790943", "0.42769918", "0.4274504", "0.42735937", "0.4270964", "0.4269312", "0.42679977", "0.42598197", "0.4256943", "0.424216", "0.424088", "0.4240748", "0.42387018", "0.42381227", "0.4235825", "0.4234888" ]
0.8242817
0
Append appends to the wal of this topic
Append добавляет в файл журнала (wal) этого топика
func (t *WALTopic) Append(data Data) error { var buf bytes.Buffer _ = gob.NewEncoder(&buf).Encode(data) if err := t.wal.Log(buf.Bytes()); err != nil { return errors.Wrapf(err, "Error appending to wal for topic: %s", t.name) } for _, a := range t.readerAlerts { if a.waiting { a.appendC <- true } } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (t *Topic) Append(msg schema.Message) {\n\tt.lock.Lock()\n\tdefer t.lock.Unlock()\n\tt.Depth++\n\tmsg.Offset = t.Depth\n\tt.Channel <- msg\n\tt.buffer.Put(msg)\n}", "func (l *Log) Append(ctx context.Context, msg Message) error {\n\tdata, err := json.Marshal(msg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar b pgx.Batch\n\tb.Queue(\"begin\")\n\tb.Queue(\"lock table switchover_log in exclusive mode\")\n\tb.Queue(\"insert into switchover_log (id, timestamp, data) values (coalesce((select max(id)+1 from switchover_log), 1), now(), $1)\", data)\n\tb.Queue(\"commit\")\n\tb.Queue(\"rollback\")\n\n\tconn, err := stdlib.AcquireConn(l.db)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer releaseConn(l.db, conn)\n\n\terr = conn.SendBatch(ctx, &b).Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (l *InMemoryLog) Append(value []byte) error {\n\tl.Lock()\n\tdefer l.Unlock()\n\tl.create(value)\n\treturn nil\n}", "func (w *tWriter) append(key, value []byte) error {\n\tif w.first == nil {\n\t\tw.first = append([]byte{}, key...)\n\t}\n\tw.last = append(w.last[:0], key...)\n\treturn w.tw.Append(key, value)\n}", "func (w *Writer) Append(msg *sej.Message) error {\n\twriter, err := w.ws[int(w.shard(msg)&w.shardMask)].getOrOpen()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn writer.Append(msg)\n}", "func (r *Raft) AppendToLog_Leader(cmd []byte) {\n\tterm := r.currentTerm\n\tlogVal := LogVal{term, cmd, 0} //make object for log's value field with acks set to 0\n\t//fmt.Println(\"Before putting in log,\", logVal)\n\tr.myLog = append(r.myLog, logVal)\n\t//fmt.Println(\"I am:\", r.Myconfig.Id, \"Added cmd to my log\")\n\n\t//modify metadata after appending\n\t//fmt.Println(\"Metadata before appending,lastLogIndex,prevLogIndex,prevLogTerm\", r.myMetaData.lastLogIndex, r.myMetaData.prevLogIndex, r.myMetaData.prevLogTerm)\n\tlastLogIndex := r.myMetaData.lastLogIndex + 1\n\tr.myMetaData.prevLogIndex = r.myMetaData.lastLogIndex\n\tr.myMetaData.lastLogIndex = lastLogIndex\n\t//fmt.Println(r.myId(), \"Length of my log is\", len(r.myLog))\n\tif len(r.myLog) == 1 {\n\t\tr.myMetaData.prevLogTerm = r.myMetaData.prevLogTerm + 1 //as for empty log prevLogTerm is -2\n\n\t} else if len(r.myLog) > 1 { //explicit check, else would have sufficed too, just to eliminate len=0 possibility\n\t\tr.myMetaData.prevLogTerm = r.myLog[r.myMetaData.prevLogIndex].Term\n\t}\n\t//r.currentTerm = term\n\t//fmt.Println(\"I am leader, Appended to log, last index, its term is\", r.myMetaData.lastLogIndex, r.myLog[lastLogIndex].term)\n\t//fmt.Println(\"Metadata after appending,lastLogIndex,prevLogIndex,prevLogTerm\", r.myMetaData.lastLogIndex, r.myMetaData.prevLogIndex, r.myMetaData.prevLogTerm)\n\tr.setNextIndex_All() //Added-28 march for LogRepair\n\t//Write to disk\n\t//fmt.Println(r.myId(), \"In append_leader, appended to log\", string(cmd))\n\tr.WriteLogToDisk()\n\n}", "func (l *TimestampedLog) Append(ts int64, data []byte) error {\n\tlatest, err := l.latest()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif ts < latest {\n\t\treturn errors.New(\"TimestampedLog.append: wrong timestamp\")\n\t}\n\n\tidx, err := l.addToSize(1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar buf bytes.Buffer\n\tbuf.Write(util.Uint64To8Bytes(uint64(ts)))\n\tbuf.Write(data)\n\tl.kvw.Set(l.getElemKey(idx), buf.Bytes())\n\treturn nil\n}", "func (s *Storage) Append(smpl *model.Sample) error {\n\ts.mtx.RLock()\n\n\tvar snew model.Sample\n\tsnew = *smpl\n\tsnew.Metric = smpl.Metric.Clone()\n\n\tfor ln, lv := range s.externalLabels {\n\t\tif _, ok := smpl.Metric[ln]; !ok {\n\t\t\tsnew.Metric[ln] = lv\n\t\t}\n\t}\n\ts.mtx.RUnlock()\n\n\tfor _, q := range s.queues {\n\t\tq.Append(&snew)\n\t}\n\treturn nil\n}", "func (ck *Clerk) PutAppend(key string, value string, op string) {\n\n\t// Your code here.\n\tif ck.view.Viewnum == 0 {\n\t\tck.UpdateView()\n\t}\n\targs := PutAppendArgs{key, value, ck.me, strconv.FormatInt(nrand(), 10), op}\n\tvar reply PutAppendReply\n\tfor {\n\t\tok := call(ck.view.Primary, \"PBServer.PutAppend\", &args, &reply)\n\t\tif ok {\n\t\t\treturn \n\t\t}\n\t\ttime.Sleep(viewservice.PingInterval)\n\t\tck.UpdateView()\n\t}\n}", "func (m *Medium) Add(t Topic) {\n\tm.mx.Lock()\n\tm.topics[t.Name()] = t\n\tm.mx.Unlock()\n}", "func (r *Raft) AppendToLog_Leader(cmd []byte) {\n\tTerm := r.myCV.CurrentTerm\n\tlogVal := LogVal{Term, cmd, 0} //make object for log's value field with acks set to 0\n\tr.MyLog = append(r.MyLog, logVal)\n\t//modify metaData after appending\n\tLastLogIndex := r.MyMetaData.LastLogIndex + 1\n\tr.MyMetaData.PrevLogIndex = r.MyMetaData.LastLogIndex\n\tr.MyMetaData.LastLogIndex = LastLogIndex\n\tif len(r.MyLog) == 1 {\n\t\tr.MyMetaData.PrevLogTerm = r.MyMetaData.PrevLogTerm + 1 //as for empty log PrevLogTerm is -2\n\n\t} else if len(r.MyLog) > 1 { //explicit check, else would have sufficed too, just to eliminate len=0 possibility\n\t\tr.MyMetaData.PrevLogTerm = r.MyLog[r.MyMetaData.PrevLogIndex].Term\n\t}\n\tr.setNextIndex_All() //Added-28 march for LogRepair\n\tr.WriteLogToDisk()\n\n}", "func (wal *seriesWAL) Append(metricID uint32, tagsHash uint64, seriesID uint32) (err error) {\n\tif err := wal.base.checkPage(seriesEntryLength); err != nil {\n\t\treturn err\n\t}\n\twal.base.putUint32(metricID)\n\twal.base.putUint64(tagsHash)\n\twal.base.putUint32(seriesID)\n\n\treturn nil\n}", "func (s *SharedLog_) Append(data []byte) (LogEntry_, error) {\n\tmutex.Lock()\n\tlog := LogEntry_{r.currentTerm, s.LsnLogToBeAdded, data, false}\n\ts.Entries = append(s.Entries, log)\n\ts.LsnLogToBeAdded++\n\tmutex.Unlock()\n\treturn log, nil\n}", "func (r *Raft) sendAppend(to uint64) bool {\n\tprevIndex := r.Prs[to].Next - 1\n\tprevLogTerm, err := r.RaftLog.Term(prevIndex)\n\tif err != nil {\n\t\tif err == ErrCompacted {\n\t\t\tr.sendSnapshot(to)\n\t\t\treturn false\n\t\t}\n\t\tpanic(err)\n\t}\n\tvar entries []*pb.Entry\n\tn := len(r.RaftLog.entries)\n\tfor i := r.RaftLog.toSliceIndex(prevIndex + 1); i < n; i++ {\n\t\tentries = append(entries, &r.RaftLog.entries[i])\n\t}\n\tmsg := pb.Message{\n\t\tMsgType: pb.MessageType_MsgAppend,\n\t\tFrom: r.id,\n\t\tTo: to,\n\t\tTerm: r.Term,\n\t\tCommit: r.RaftLog.committed,\n\t\tLogTerm: prevLogTerm,\n\t\tIndex: prevIndex,\n\t\tEntries: entries,\n\t}\n\tr.msgs = append(r.msgs, msg)\n\treturn true\n}", "func (ck *Clerk) PutAppend(key string, value string, op string) {\n\tDPrintf(\"Clert PutAppend %s, %v\", key, value)\n\targs := PutAppendArgs{RequestId: ck.genMsgId(), PreviousId: ck.previousId, Key: key, Value: value, Op: op}\n\n\tfor ; ; ck.leaderId = (ck.leaderId + 1) % len(ck.servers) {\n\t\tserver := ck.servers[ck.leaderId]\n\t\treply := GetReply{}\n\t\tok := server.Call(\"KVServer.PutAppend\", &args, &reply)\n\t\tif ok && reply.Err == OK {\n\t\t\tDPrintf(\"!!! Clert PutAppend %s, %v DONE\", key, value)\n\t\t\tck.previousId = args.RequestId\n\t\t\treturn\n\t\t}\n\t}\n}", "func (c *Cache) appendEntries(topic, key string, entries Entries, new bool) error {\n\tt, ok := c.topics.Load(topic)\n\tif !ok {\n\t\treturn errors.New(\"Topic does not exist\")\n\t}\n\ttop := t.(*Topic)\n\n\tp, ok := top.partitions.Load(key)\n\tif !ok {\n\t\tnewPart, err := c.newPartition(topic, key)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttop.partitions.Store(key, newPart)\n\t\tp = newPart\n\t\tc.router.Update(topic, key, AddPartition)\n\t}\n\tpartition := p.(*Partition)\n\n\tpartition.mu.Lock()\n\tdefer partition.mu.Unlock()\n\tfpos := partition.clog.Tell()\n\n\tvar (\n\t\tfirstAppend *int\n\t\tlastEntry *Entry\n\t\tlastTime time.Time\n\t)\n\tif len(partition.entries) > 0 {\n\t\tlastEntry = partition.entries[len(partition.entries)-1]\n\t\tlastTime = lastEntry.Timestamp\n\t}\n\n\tfor i, entry := range entries {\n\t\tif entry.Timestamp.IsZero() {\n\t\t\t// maybe we want to error out in some cases in the future.\n\t\t\tentry.Timestamp = time.Now()\n\t\t\tif entry.Timestamp.Equal(lastTime) {\n\t\t\t\t// make sure it is unique (in some platform like play.golang.org,\n\t\t\t\t// time.Now() is second-precision)\n\t\t\t\tentry.Timestamp = entry.Timestamp.Add(time.Duration(1))\n\t\t\t}\n\t\t\tlastTime = entry.Timestamp\n\t\t}\n\n\t\tif i > 0 {\n\t\t\tlastEntry = entries[i-1]\n\t\t}\n\t\t// the behavior is to discard the entries that are before the latest\n\t\t// entry in the partition. if other entries in the request are after\n\t\t// though, they are still appended.\n\t\tif lastEntry != nil && entry.Timestamp.Before(lastEntry.Timestamp) {\n\t\t\tcontinue\n\t\t}\n\t\tif firstAppend == nil {\n\t\t\ttmp := i\n\t\t\tfirstAppend = &tmp\n\t\t}\n\t\tif new {\n\t\t\tif err := partition.clog.Append(&commitlog.Entry{\n\t\t\t\tTimestamp: entry.Timestamp,\n\t\t\t\tData: entry.Data}); err != nil {\n\t\t\t\tlog.Error(\"Failed to persist %v: %v\", entry, err)\n\t\t\t\tpartition.clog.Truncate(fpos)\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif firstAppend != nil {\n\t\tpartition.entries = append(partition.entries, entries[*firstAppend:]...)\n\t} else {\n\t\treturn errors.New(\"Nothing new to append\")\n\t}\n\n\tc.LastCommit = CacheCommit{\n\t\tKey: fmt.Sprintf(\"%v_%v\", topic, key),\n\t\tTimestamp: entries[entries.Len()-1].Timestamp,\n\t}\n\treturn nil\n}", "func (r *Raft) AppendToLog_Follower(request AppendEntriesReq) {\n\tterm := request.term\n\tcmd := request.entries\n\tindex := request.prevLogIndex + 1\n\tlogVal := LogVal{term, cmd, 0} //make object for log's value field\n\n\tif len(r.myLog) == index {\n\t\tr.myLog = append(r.myLog, logVal) //when trying to add a new entry\n\t} else {\n\t\tr.myLog[index] = logVal //overwriting in case of log repair\n\t\t//fmt.Println(\"Overwiriting!!\")\n\t}\n\t//fmt.Println(r.myId(), \"Append to log\", string(cmd))\n\t//modify metadata after appending\n\t//r.myMetaData.lastLogIndex = r.myMetaData.lastLogIndex + 1\n\t//r.myMetaData.prevLogIndex = r.myMetaData.lastLogIndex\n\t//\tif len(r.myLog) == 1 {\n\t//\t\tr.myMetaData.prevLogTerm = r.myMetaData.prevLogTerm + 1\n\t//\t} else if len(r.myLog) > 1 {\n\t//\t\tr.myMetaData.prevLogTerm = r.myLog[r.myMetaData.prevLogIndex].Term\n\t//\t}\n\n\t//Changed on 4th april, above is wrong in case of overwriting of log\n\tr.myMetaData.lastLogIndex = index\n\tr.myMetaData.prevLogIndex = index - 1\n\tif index == 0 {\n\t\tr.myMetaData.prevLogTerm = r.myMetaData.prevLogTerm + 1 //or simple -1\n\t} else if index >= 1 {\n\t\tr.myMetaData.prevLogTerm = r.myLog[index-1].Term\n\t}\n\n\t//Update commit index\n\tleaderCI := float64(request.leaderCommitIndex)\n\tmyLI := float64(r.myMetaData.lastLogIndex)\n\tif request.leaderCommitIndex > r.myMetaData.commitIndex {\n\t\tif myLI == -1 { //REDUNDANT since Append to log will make sure it is never -1,also must not copy higher CI if self LI is -1\n\t\t\tr.myMetaData.commitIndex = int(leaderCI)\n\t\t} else {\n\t\t\tr.myMetaData.commitIndex = int(math.Min(leaderCI, myLI))\n\t\t}\n\t}\n\t//fmt.Println(r.myId(), \"My CI is:\", r.myMetaData.commitIndex)\n\tr.WriteLogToDisk()\n}", "func (m *MemoryLogger) Append(newEntry LogEntry) {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tm.Entries[m.index] = newEntry\n\tm.index = (m.index + 1) % maxLogItems\n}", "func (h *HistoricalRecords) Append(tr *TransferRecord) {\n\th.mutex.Lock()\n\th.records = append(h.records, tr)\n\th.mutex.Unlock()\n}", "func (list *WhoWasList) Append(whowas WhoWas) {\n\tlist.accessMutex.Lock()\n\tdefer list.accessMutex.Unlock()\n\n\tif len(list.buffer) == 0 {\n\t\treturn\n\t}\n\n\tvar pos int\n\tif list.start == -1 { // empty\n\t\tpos = 0\n\t\tlist.start = 0\n\t\tlist.end = 1\n\t} else if list.start != list.end { // partially full\n\t\tpos = list.end\n\t\tlist.end = (list.end + 1) % len(list.buffer)\n\t} else if list.start == list.end { // full\n\t\tpos = list.end\n\t\tlist.end = (list.end + 1) % len(list.buffer)\n\t\tlist.start = list.end // advance start as well, overwriting first entry\n\t}\n\n\tlist.buffer[pos] = whowas\n}", "func (it *eventStorage) Append(event *spec.Event) (*spec.Event, error) {\n\ttopic := event.GetTopic()\n\teventToStore := &spec.Event{Id: it.ids.Next(), Topic: topic, Payload: event.GetPayload()}\n\n\tserializedEvent, err := serializeEvent(eventToStore)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbatch := new(leveldb.Batch)\n\tbatch.Put(it.keys.Event(eventToStore), serializedEvent)\n\n\terr = it.db.Write(batch, nil)\n\tif err != nil {\n\t\treturn nil, errors.Internal.New(\"could not write event: [%v, %v]\", topic, eventToStore)\n\t}\n\n\treturn eventToStore, nil\n}", "func (r *Raft) sendAppend(to uint64) bool {\n\t//\tappend entry\n\tlastIndex := r.RaftLog.LastIndex()\n\tprs := r.Prs[to]\n\tmatched := prs.Match\n\t//if matched < lastIndex {\n\tmsg := r.buildMsgWithoutData(pb.MessageType_MsgAppend, to, false)\n\tvar position int\n\t// send empty append,update follower committed index\n\tif matched == r.RaftLog.LastIndex() {\n\t\tposition = len(r.RaftLog.entries)\n\t} else {\n\t\tp, found := r.RaftLog.findByIndex(matched + 1)\n\t\tif !found {\n\t\t\tpanic(\"not found matched index\")\n\t\t}\n\t\tposition = p\n\t}\n\n\tmsg.Entries = entryValuesToPoints(r.RaftLog.entries[position:])\n\tmsg.Index = prs.Match\n\tt, err := r.RaftLog.Term(prs.Match)\n\tif err != nil {\n\t\tpanic(\"error \")\n\t}\n\tmsg.LogTerm = t\n\tmsg.Commit = r.RaftLog.committed\n\tr.appendMsg(msg)\n\t//update prs\n\tr.Prs[to] = &Progress{\n\t\tMatch: prs.Match,\n\t\tNext: lastIndex + 1,\n\t}\n\treturn true\n\t//}\n\t// Your Code Here (2A).\n\t//return false\n}", "func (ck *Clerk) PutAppend(key string, value string, op string) {\n\t// You will have to modify this function.\n\n\treqID := atomic.AddInt32(&ck.nextReqID, 1)\n\n\targs := PutAppendArgs{Key: key, Value: value, Op: op, RequestID: reqID, ClientID: ck.id, PrevIndex: -1}\n\treply := PutAppendReply{Index: -1}\n\n\tck.logger.Debugf(\"Put Append calls start, key %s, value %s\", args.Key, args.Value)\n\n\tfor {\n\t\tfor _, server := range ck.servers {\n\n\t\t\t//ck.logger.Debugf(\"Put Append calls start: server %d, key %s, value %s\", index, args.Key, args.Value)\n\t\t\tok := server.Call(\"KVServer.PutAppend\", &args, &reply)\n\t\t\tif ok {\n\t\t\t\tif reply.Err == OK {\n\t\t\t\t\tck.logger.Debugf(\"Put Append End Successfully : %s\", value)\n\t\t\t\t\treturn\n\t\t\t\t} else {\n\t\t\t\t\t//ck.logger.Debugf(\"Put Append Failed : Wrong leader %d\", index)\n\t\t\t\t\targs.PrevIndex = reply.Index\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t//ck.logger.Debugf(\"PutAppend RPC failed: %d\", index)\n\t\t\t}\n\t\t}\n\n\t}\n\n\n\n\n}", "func (r *RollingPolicy) Append(val float64) {\n\tr.add(r.window.Append, val)\n}", "func (r *RollingPolicy) Append(val float64) {\n\tr.add(r.window.Append, val)\n}", "func (tt *Index) Push(recs ...*types.Log) error {\n\tfor _, rec := range recs {\n\t\tif len(rec.Topics) > MaxCount {\n\t\t\treturn ErrTooManyTopics\n\t\t}\n\t\tcount := posToBytes(uint8(1 + len(rec.Topics)))\n\n\t\tid := NewID(rec.BlockNumber, rec.TxHash, rec.Index)\n\n\t\tvar pos int\n\t\tpush := func(topic common.Hash) error {\n\t\t\tkey := topicKey(topic, uint8(pos), id)\n\t\t\terr := tt.table.Topic.Put(key, count)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tkey = otherKey(id, uint8(pos))\n\t\t\terr = tt.table.Other.Put(key, topic.Bytes())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tpos++\n\t\t\treturn nil\n\t\t}\n\n\t\tif err := push(rec.Address.Hash()); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, topic := range rec.Topics {\n\t\t\tif err := push(topic); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tbuf := make([]byte, 0, common.HashLength+len(rec.Data))\n\t\tbuf = append(buf, rec.BlockHash.Bytes()...)\n\t\tbuf = append(buf, rec.Data...)\n\n\t\terr := tt.table.Logrec.Put(id.Bytes(), buf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (w WatWorkspace) Append(name, contents string) error {\n\tpath := filepath.Join(w.root, kWatDirName, name)\n\tfile, err := os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, permFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"os.OpenFile: %v\", err)\n\t}\n\tdefer file.Close()\n\n\t_, err = file.WriteString(contents)\n\treturn err\n\n}", "func (tr *Repository) Append(ev es.Event) {\n\ttr.DB.Append(ev)\n}", "func (r *Raft) AppendToLog_Follower(request AppendEntriesReq) {\n\tTerm := request.LeaderLastLogTerm\n\tcmd := request.Entries\n\tindex := request.PrevLogIndex + 1\n\tlogVal := LogVal{Term, cmd, 0} //make object for log's value field\n\n\tif len(r.MyLog) == index {\n\t\tr.MyLog = append(r.MyLog, logVal) //when trying to add a new entry\n\t} else {\n\t\tr.MyLog[index] = logVal //overwriting in case of log repair\n\t}\n\n\tr.MyMetaData.LastLogIndex = index\n\tr.MyMetaData.PrevLogIndex = index - 1\n\tif index == 0 {\n\t\tr.MyMetaData.PrevLogTerm = r.MyMetaData.PrevLogTerm + 1 //or simple -1\n\t} else if index >= 1 {\n\t\tr.MyMetaData.PrevLogTerm = r.MyLog[index-1].Term\n\t}\n\tleaderCI := float64(request.LeaderCommitIndex) //Update commit index\n\tmyLI := float64(r.MyMetaData.LastLogIndex)\n\tif request.LeaderCommitIndex > r.MyMetaData.CommitIndex {\n\t\tr.MyMetaData.CommitIndex = int(math.Min(leaderCI, myLI))\n\t}\n\tr.WriteLogToDisk()\n}", "func (t *QueueManager) Append(s *model.Sample) error {\n\tsnew := *s\n\tsnew.Metric = s.Metric.Clone()\n\n\tb := labels.NewBuilder(t.externalLabels)\n\tfor k, v := range s.Metric {\n\t\tif !t.externalLabels.Has(string(k)) {\n\t\t\tb.Set(string(k), string(v))\n\t\t}\n\t}\n\n\tls := relabel.Process(b.Labels(), t.relabelConfigs...)\n\n\t// If there are no labels; don't queue the sample\n\tif len(ls) < 1 {\n\t\treturn nil\n\t}\n\n\tsnew.Metric = make(model.Metric, len(ls))\n\tfor _, label := range ls {\n\t\tsnew.Metric[model.LabelName(label.Name)] = model.LabelValue(label.Value)\n\t}\n\n\tif snew.Metric == nil {\n\t\treturn nil\n\t}\n\n\tt.shardsMtx.RLock()\n\tenqueued := t.shards.enqueue(&snew)\n\tt.shardsMtx.RUnlock()\n\n\tif enqueued {\n\t\tqueueLength.WithLabelValues(t.queueName).Inc()\n\t} else {\n\t\tdroppedSamplesTotal.WithLabelValues(t.queueName).Inc()\n\t\tif t.logLimiter.Allow() {\n\t\t\tlevel.Warn(t.logger).Log(\"msg\", \"Remote storage queue full, discarding sample. Multiple subsequent messages of this kind may be suppressed.\")\n\t\t}\n\t}\n\treturn nil\n}", "func (kv *DisKV) PutAppend(args *PutAppendArgs, reply *PutAppendReply) error {\n\t// Your code here.\n\t// fmt.Printf(\"PUTAPPEND %d %t --- %d\\n\", kv.me, kv.recovery, kv.Seq+1)\n\tif !kv.recovery {\n\t\tkv.mu.Lock()\n\t\tdefer kv.mu.Unlock()\n\n\t\tvar op Op\n\t\tif args.Op == \"Put\" {\n\t\t\top = Op{OpID: args.OpID, Type: \"Put\", Key: args.Key, Value: args.Value,\n\t\t\t\tCk: args.Ck, LastID: args.LastID}\n\t\t} else {\n\t\t\top = Op{OpID: args.OpID, Type: \"Append\", Key: args.Key, Value: args.Value,\n\t\t\t\tCk: args.Ck, LastID: args.LastID}\n\t\t}\n\t\treply.Err = kv.handleReq(args.OpID, key2shard(args.Key), op)\n\t}\n\n\treturn nil\n}", "func (w *BytesWriter) Append(args ...interface{}) {\r\n\tw.args = append(w.args, args...)\r\n}", "func (w *Writer) Append(msg *Message) error {\n\tw.mu.Lock()\n\t// slow but correct: wait for https://github.com/golang/go/issues/14939\n\tdefer w.mu.Unlock()\n\n\tif w.err != nil { // skip if an error already happens\n\t\treturn w.err\n\t}\n\tif len(msg.Key) > math.MaxInt8 {\n\t\treturn errors.New(\"key is too long\")\n\t}\n\tif len(msg.Value) > math.MaxInt32 {\n\t\treturn errors.New(\"value is too long\")\n\t}\n\tmsg.Offset = w.offset\n\tnumWritten, err := WriteMessage(w.w, w.msgBuf, msg)\n\tw.fileLen += int(numWritten)\n\tif err != nil {\n\t\tw.err = err\n\t\treturn err\n\t}\n\tw.offset++\n\tif w.fileLen >= w.SegmentSize {\n\t\tif err := w.closeFile(); err != nil {\n\t\t\tw.err = err\n\t\t\treturn err\n\t\t}\n\t\tvar err error\n\t\tw.file, err = openOrCreate(journalFileName(w.dir, w.offset))\n\t\tif err != nil {\n\t\t\tw.err = err\n\t\t\treturn err\n\t\t}\n\t\tw.fileLen = 0\n\t\tw.w = newBufferWriter(w.file)\n\t}\n\treturn nil\n}", "func sendAppendEntries(s *Sailor, peer string) error {\n\tam := appendMessage{}\n\tam.Term = s.currentTerm\n\tam.LeaderId = s.client.NodeName\n\tam.PrevLogIndex = s.leader.nextIndex[peer] - 1\n\t// This is just some fancy logic to check for the bounds on the log\n\t// e.g. our log has 0 entries, so the prevEntryTerm cannot be pulled from the log\n\tif len(s.log) == 0 {\n\t\tam.PrevLogTerm = 0\n\t\tam.Entries = nil\n\t} else {\n\t\t// If our log is too short to have prevTerm, use 0\n\t\tif int(s.leader.nextIndex[peer])-2 < 0 {\n\t\t\tam.PrevLogTerm = 0\n\t\t} else {\n\t\t\tam.PrevLogTerm = s.log[s.leader.nextIndex[peer]-2].Term\n\t\t}\n\t\t// If our nextIndex is a value we don't have yet, send nothing\n\t\tif s.leader.nextIndex[peer] > uint(len(s.log)) {\n\t\t\tam.Entries = []entry{}\n\t\t} else {\n\t\t\tam.Entries = s.log[s.leader.nextIndex[peer]-1:]\n\t\t}\n\t}\n\n\tam.LeaderCommit = s.volatile.commitIndex\n\tap := messages.Message{}\n\tap.Type = \"appendEntries\"\n\tap.ID = 0\n\tap.Source = s.client.NodeName\n\tap.Value = makePayload(am)\n\treturn s.client.SendToPeer(ap, peer)\n}", "func (ck *Clerk) PutAppend(key string, value string, op string) {\n\t// You will have to modify this function.\n\t//lock\n\tck.snum = ck.snum + 1\n\treply := PutAppendReply{}\n\targs := &PutAppendArgs{Key: key, Value: value, Op: op, Snum: ck.snum, Cid: ck.me}\n\n\t//leaderTry := ck.lastLeader\n\tfor {\n\t\t//log.Printf(\"Leaderid: %d\", ck.lastLeader)\n\t\treply = PutAppendReply{}\n\n\t\tok := ck.servers[ck.lastLeader].Call(\"KVServer.PutAppend\", args, &reply)\n\t\t//WrongLeader bool\n\t\t//Err Err\n\t\tDPrintf4(\"Cli %d PutAppend %v to server %d. Get %v, %v\", ck.me, op, ck.lastLeader, ok, reply.WrongLeader)\n\t\tif !ok || reply.WrongLeader {\n\t\t\tck.lastLeader = (ck.lastLeader + 1) % len(ck.servers) //REM: random assign\n\t\t\tcontinue\n\t\t}\n\n\t\tif !reply.WrongLeader {\n\t\t\t//log.Printf(\"Success Leaderid: %d\", ck.lastLeader)\n\t\t\t//REM: possible reply.leader op in paper\n\t\t\t//ck.lastLeader = leaderTry\n\t\t\tbreak\n\t\t}\n\n\t}\n\t//WrongLeader bool\n\t//Err Err\n\treturn\n}", "func (l *LevelDBLog) Append(value []byte) error {\n\tl.Lock()\n\tdefer l.Unlock()\n\n\tif l.db == nil {\n\t\treturn errors.New(\"log database has been closed \")\n\t}\n\n\t// Create and dump entry to bytes, incrementing last index\n\tl.lastIdx++\n\tentry := &Entry{\n\t\tIndex: l.lastIdx,\n\t\tValue: value,\n\t}\n\tdata, err := entry.Dump()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Put the entry into the database\n\tkey := l.makeKey(entry.Index)\n\treturn l.db.Put(key, data, nil)\n}", "func (s *StickyMemberMetadata) AppendTo(dst []byte) []byte {\n\tdst = kbin.AppendArrayLen(dst, len(s.CurrentAssignment))\n\tfor _, assignment := range s.CurrentAssignment {\n\t\tdst = kbin.AppendString(dst, assignment.Topic)\n\t\tdst = kbin.AppendArrayLen(dst, len(assignment.Partitions))\n\t\tfor _, partition := range assignment.Partitions {\n\t\t\tdst = kbin.AppendInt32(dst, partition)\n\t\t}\n\t}\n\tif s.Generation != -1 {\n\t\tdst = kbin.AppendInt32(dst, s.Generation)\n\t}\n\treturn dst\n}", "func (ck *Clerk) Append(key string, value string) {\n\tck.PutAppend(key, value, \"Append\")\n}", "func (ck *Clerk) Append(key string, value string) {\n\tck.PutAppend(key, value, \"Append\")\n}", "func (rbl *RawBytesLog) Append(entry *Entry) error {\n\terr := writeBytesWithLen16(rbl.logFile, entry.Key)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = writeBytesWithLen32(rbl.logFile, entry.Bytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (ck *Clerk) PutAppend(key string, value string, op string) {\n\n\t// Your code here.\n\targs := &PutAppendArgs{}\n\targs.Forward = true\n\targs.Key = key\n\targs.Value = value\n\targs.Viewnum = ck.cur_view.Viewnum\n\t// args.Seq = hex.EncodeToString(Hash(key, value, op, time.Now()))\n\targs.Seq = hex.EncodeToString(Hash(key, value, op))\n\tswitch op {\n\tcase \"Put\":\n\t\targs.Op = 0\n\tcase \"Append\":\n\t\targs.Op = 1\n\t}\n\tfor {\n\t\t// log.Println(ck.cur_view.Primary, ck.cur_view.Backup)\n\t\trsp := &PutAppendReply{}\n\t\tok := call(ck.cur_view.Primary, \"PBServer.PutAppend\", args, rsp)\n\t\tif !ok {\n\t\t\t// log.Printf(\"Client PutAppend rpc to %s failed, Key:%s, Value:%s\\n\", ck.cur_view.Primary, key, value)\n\t\t} else if rsp.Err != \"\" {\n\t\t\t// log.Printf(\"Client PutAppend rpc to %s error, Key:%s, Value:%s\\n\", ck.cur_view.Primary, key, value)\n\t\t\t// log.Println(rsp.Err, ck.cur_view.Primary)\n\t\t\tif rsp.Err == ForwardFailed {\n\t\t\t\tck.UpdateView()\n\t\t\t\tif ck.cur_view.Backup == \"\" {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t} else if rsp.Err == DuplicateRequest {\n\t\t\t\tbreak\n\t\t\t}\n\t\t} else {\n\t\t\t// log.Printf(\"Client PutAppend rpc to %s done! Key:%s, Value:%s\\n\", ck.cur_view.Primary, key, value)\n\t\t\tbreak\n\t\t}\n\t\tif ck.UpdateView() != nil { //check if primary has changed\n\t\t\treturn\n\t\t}\n\t\ttime.Sleep(viewservice.PingInterval)\n\t}\n}", "func (ck *Clerk) PutAppend(key string, value string, op string) {\n\t// You will have to modify this function.\n\targs := PutAppendArgs{key, value, op}\n\tflag := false\n\tfor {\n\t\tfor i := range ck.servers {\n\t\t\treply := PutAppendReply{}\n\t\t\tok := ck.servers[i].Call(\"KVServer.PutAppend\", &args, &reply)\n\t\t\tif ok == true && reply.Err == OK {\n\t\t\t\tDPrintf(\"PutAppend succ. key:%v, value:%v, op:%v\", key, value, op)\n\t\t\t\tflag = true\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\t//DPrintf(\"PutAppend fail! key:%v value:%v op:%v ret:%v\", key, value, op, reply.Err)\n\t\t\t}\n\t\t}\n\t\tif true == flag {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(1000 * time.Millisecond)\n\t}\n\n}", "func (rf *Raft) StartAppendLog() {\n\tvar count int32 = 1\n\tfor i, _ := range rf.peers {\n\t\tif i == rf.me {\n\t\t\tcontinue\n\t\t}\n\t\tgo func(i int) {\n\t\t\tfor{\n\t\t\t\trf.mu.Lock()\n\t\t\t\t//fmt.Printf(\"follower %d lastlogindex: %v, nextIndex: %v\\n\",i, rf.GetPrevLogIndex(i), rf.nextIndex[i])\n\t\t\t\t//fmt.Print(\"sending log entries from leader %d to peer %d for term %d\\n\", rf.me, i, rf.currentTerm)\n\t\t\t\t//fmt.Print(\"nextIndex:%d\\n\", rf.nextIndex[i])\n\t\t\t\tif rf.state != Leader {\n\t\t\t\t\trf.mu.Unlock()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\targs := AppendEntriesArgs{\n\t\t\t\t\tTerm: rf.currentTerm,\n\t\t\t\t\tLeaderId: rf.me,\n\t\t\t\t\tPrevLogIndex: rf.GetPrevLogIndex(i),\n\t\t\t\t\tPrevLogTerm: rf.GetPrevLogTerm(i),\n\t\t\t\t\tEntries: append(make([]LogEntry, 0), rf.logEntries[rf.nextIndex[i]:]...),\n\t\t\t\t\tLeaderCommit: rf.commitIndex,\n\t\t\t\t}\n\t\t\t\treply := AppendEntriesReply{}\n\t\t\t\trf.mu.Unlock()\n\t\t\t\tok := rf.sendAppendEntries(i, &args, &reply)\n\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\trf.mu.Lock()\n\t\t\t\tif rf.state != Leader {\n\t\t\t\t\trf.mu.Unlock()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif reply.Term > rf.currentTerm {\n\t\t\t\t\trf.BeFollower(reply.Term)\n\t\t\t\t\tgo func() {\n\t\t\t\t\t\tsend(rf.appendEntry)\n\t\t\t\t\t}()\n\t\t\t\t\trf.mu.Unlock()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif reply.Success {\n\t\t\t\t\trf.matchIndex[i] = args.PrevLogIndex + len(args.Entries)\n\t\t\t\t\trf.nextIndex[i] = rf.matchIndex[i] + 1\n\t\t\t\t\t//fmt.Print(\"leader: %v, for peer %v, match index: %d, next index: %d, peers: %d\\n\", rf.me, i, rf.matchIndex[i], rf.nextIndex[i], len(rf.peers))\n\t\t\t\t\tatomic.AddInt32(&count, 1)\n\t\t\t\t\tif atomic.LoadInt32(&count) > int32(len(rf.peers)/2) {\n\t\t\t\t\t\t//fmt.Print(\"leader %d reach agreement\\n, args.prevlogindex:%d, len:%d\\n\", rf.me, args.PrevLogIndex, len(args.Entries))\n\t\t\t\t\t\trf.UpdateCommitIndex()\n\t\t\t\t\t}\n\t\t\t\t\trf.mu.Unlock()\n\t\t\t\t\treturn\n\t\t\t\t} else {\n\t\t\t\t\t//fmt.Printf(\"peer %d reset the next index from %d to %d\\n\", i, rf.nextIndex[i], rf.nextIndex[i]-1)\n\t\t\t\t\tif rf.nextIndex[i] > 0 {\n\t\t\t\t\t\trf.nextIndex[i]--\n\t\t\t\t\t\trf.mu.Unlock()\n\t\t\t\t\t} else {\n\t\t\t\t\t\trf.mu.Unlock()\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttime.Sleep(10 * time.Millisecond)\n\t\t\t}\n\t\t}(i)\n\t}\n\n}", "func (t Tee) Append(s *clientmodel.Sample) {\n\tt.Appender1.Append(s)\n\tt.Appender2.Append(s)\n}", "func (thread *Thread) OnAppend(ctx aero.Context, key string, index int, obj interface{}) {\n\tonAppend(thread, ctx, key, index, obj)\n}", "func (s *storage) appendEntry(e *entry) {\n\tassert(e.index == s.lastLogIndex+1)\n\tw := new(bytes.Buffer)\n\tif err := e.encode(w); err != nil {\n\t\tpanic(bug{fmt.Sprintf(\"entry.encode(%d)\", e.index), err})\n\t}\n\tif err := s.log.Append(w.Bytes()); err != nil {\n\t\tpanic(opError(err, \"Log.Append\"))\n\t}\n\ts.lastLogIndex, s.lastLogTerm = e.index, e.term\n}", "func (w *Writer) append(key, value []byte, restart bool) {\n\tnShared := 0\n\tif restart {\n\t\tw.restarts = append(w.restarts, uint32(w.buf.Len()))\n\t} else {\n\t\tnShared = db.SharedPrefixLen(w.prevKey, key)\n\t}\n\tw.prevKey = append(w.prevKey[:0], key...)\n\tw.nEntries++\n\tn := binary.PutUvarint(w.tmp[0:], uint64(nShared))\n\tn += binary.PutUvarint(w.tmp[n:], uint64(len(key)-nShared))\n\tn += binary.PutUvarint(w.tmp[n:], uint64(len(value)))\n\tw.buf.Write(w.tmp[:n])\n\tw.buf.Write(key[nShared:])\n\tw.buf.Write(value)\n}", "func (ck *Clerk) PutAppend(key string, value string, op string) {\n\t// You will have to modify this function.\n\targs := &PutAppendArgs{\n\t\tKey: key,\n\t\tValue: value,\n\t\tOp: op,\n\t\tCid: ck.cid,\n\t\tSeqNum: ck.seqNum,\n\t}\n\tidx := ck.lastLeaderId\n\tfor {\n\t\treply := &PutAppendReply{}\n\t\tck.mu.Lock()\n\t\tck.seqNum++\n\t\tck.mu.Unlock()\n\t\t//DPrintf(\"Client request server %v to call PutAppend method, args: %+v\", idx, args)\n\t\tok := ck.servers[idx].Call(\"KVServer.PutAppend\", args, reply)\n\t\t//DPrintf(\"Client request server %v to call PutAppend method finished, reply: %+v\", idx, reply)\n\t\tif ok && !reply.WrongLeader {\n\t\t\t// todo how to deal with ERR\n\t\t\tck.lastLeaderId = idx\n\t\t\t//DPrintf(\"===================Client request server %v to call PutAppend method success!\", idx)\n\t\t\treturn\n\t\t}\n\t\tidx = (idx + 1)%len(ck.servers)\n\t\ttime.Sleep(time.Duration(50)*time.Millisecond)\n\t}\n\n}", "func (ck *Clerk) PutAppend(key string, value string, op string) {\n\tck.RunCall(\"RaftKV.PutAppend\",\n\t\tfunc(callerId CallerId) interface{} {\n\t\t\targs := new(PutAppendArgs)\n\t\t\targs.CID = callerId\n\t\t\targs.Op = op\n\t\t\targs.Key = key\n\t\t\targs.Value = value\n\t\t\treturn args\n\t\t},\n\t\tfunc() interface{} {\n\t\t\treturn new(PutAppendReply)\n\t\t},\n\t\tfunc(reply interface{}) (string, Err) {\n\t\t\treturn \"\", reply.(*PutAppendReply).Err\n\t\t})\n}", "func (s *BytesWriter) Append(args ...interface{}) {\n\ts.args = append(s.args, args...)\n}", "func (s *BytesWriter) Append(args ...interface{}) {\n\ts.args = append(s.args, args...)\n}", "func (rf *Raft) AppendEntries(args *AppendEntriesArgs, reply *AppendEntriesReply) {\n\trf.mu.Lock()\n\tdefer rf.mu.Unlock()\n\t// Resetting as we received a heart beat.\n\trf.resetElectionTimer()\n\trf.debug( \"AppendEntries: from LEADER %#v \\n\",args)\n\trf.debug(\"My current state: %#v \\n\", rf)\n\t//1. Reply false if term < currentTerm (§5.1)\n\tif args.Term > rf.currentTerm{\n\t\tif rf.currentState != Follower {\n\t\t\trf.transitionToFollower(args.Term)\n\t\t}\n\t}\n\t//2. Reply false if log doesn’t contain an entry at prevLogIndex\n\t//whose term matches prevLogTerm (§5.3)\n\t//3. If an existing entry conflicts with a new one (same index\n\t//but different terms), delete the existing entry and all that\n\t//follow it (§5.3)\n\t//4. Append any new entries not already in the log\n\t//5. If leaderCommit > commitIndex, set commitIndex =\n\t//\tmin(leaderCommit, index of last new entry)\n\t/////////////Pending implementation point 5 above.\n\tif args.Term < rf.currentTerm{\n\t\treply.Success = false\n\t\treply.Term =rf.currentTerm\n\t\treturn\n\t}\n\n\t// Update my term to that of the leaders\n\trf.currentTerm = args.Term\n\trf.debug(\"Dereferencing %d\",len(rf.log)-1)\n\trf.debug(\"Current log contents %v\", rf.log)\n\n\t// Check first whether it is a heartbeat or an actual append entry.\n\t// If it is heartbeat, then just reset the timer and then go back.\n\t//Otherwise, we need to add the entries into the logs of this peer.\n\t// If this is heart beat, then we know that the command is going to be nil.\n\t// Identify this and return.\n\tlastLogEntryIndex := len(rf.log) - 1\n\tif args.LogEntries == nil {\n\t\t//This is heart beat\n\t\treply.Term = rf.currentTerm\n\t\trf.debug(\"Received a HEART BEAT.\")\n\t}else {\n\t\trf.debug(\"Received an APPEND ENTRY. PROCESSING\")\n\t\tlastLogEntry := rf.log[len(rf.log)-1]\n\t\t//1a\n\t\tif lastLogEntryIndex < args.PreviousLogIndex {\n\t\t\treply.Success = false\n\t\t\treply.NextIndex = lastLogEntryIndex\n\t\t\trf.debug(\"1a \\n\")\n\t\t\treturn\n\t\t}\n\t\t//1b\n\t\tif lastLogEntryIndex > args.PreviousLogIndex {\n\t\t\treply.Success = false\n\t\t\trf.debug(\"Last log entry index --> %d, PreviousLogIndex From LEADER -->%d\", lastLogEntryIndex, args.PreviousLogIndex)\n\t\t\trf.log = rf.log[:len(rf.log)-1]\n\t\t\treturn\n\t\t}\n\t\t//3\n\t\tif lastLogEntry.LastLogTerm != args.PreviousLogTerm {\n\t\t\treply.Success = false\n\t\t\t//Reduce size by 1;\n\t\t\trf.debug(\"3 \\n\")\n\t\t\trf.log = rf.log[:len(rf.log)-1]\n\t\t\treturn\n\t\t}\n\n\t\t// 4 We are good to apply the command.\n\t\trf.printSlice(rf.log, \"Before\")\n\t\trf.debug(\"Printing the entry to be added within the handler %v\", args.LogEntries)\n\t\trf.log = append(rf.log, args.LogEntries...)\n\t\trf.printSlice(rf.log, \"After\")\n\t\trf.debug(\"\\n Applied the command to the log. Log size is -->%d \\n\", len(rf.log))\n\t\t//5\n\t}\n\tif args.LeaderCommit >rf.commitIndex {\n\t\trf.debug(\"5 Update commitIndex. LeaderCommit %v rf.commitIndex %v \\n\",args.LeaderCommit,rf.commitIndex )\n\t\t//Check whether all the entries are committed prior to this.\n\t\toldCommitIndex:=rf.commitIndex\n\t\trf.commitIndex = min(args.LeaderCommit,lastLogEntryIndex+1)\n\t\trf.debug(\"moving ci from %v to %v\", oldCommitIndex, rf.commitIndex)\n\t\t//Send all the received entries into the channel\n\t\tj:=0\n\t\tfor i:=oldCommitIndex ;i<args.LeaderCommit;i++ {\n\t\t\trf.debug(\"Committing %v \",i)\n\t\t\tapplyMsg := ApplyMsg{CommandValid: true, Command: rf.log[i].Command, CommandIndex: i}\n\t\t\tj++\n\t\t\trf.debug(\"Sent a response to the end client \")\n\t\t\trf.debug(\"applyMsg %v\",applyMsg)\n\t\t\trf.applyCh <- applyMsg\n\t\t}\n\t}\n\treply.Success = true\n\t//Check at the last. This is because this way the first HB will be sent immediately.\n\t//timer := time.NewTimer(100 * time.Millisecond)\n}", "func AppendCaller() {\n\t\tfor {\n\t\t\tlog_conn := <-Append_ch\n\t\t\tlogentry :=log_conn.Logentry\n\t\t\tconn:=log_conn.Conn\n\t\t\traft.AppendHeartbeat <- 1 // No need to send heartbeat in this cycle, as sending log entires is also treated as heartbeat\n\t\t\tappendAckcount:=1\n\t\t\tsyncNeeded := false\n\t\t\tvar logentry1 LogEntry\n\t\t\tvar args *AppendRPCArgs // Prepare Arguments, \n\t\t\t/*if logentry.SequenceNumber >= 1 {\t // if Log has more than 2 entries\n\t\t\t\targs = &AppendRPCArgs {\n\t\t\t\t\tr.CurrentTerm,\n\t\t\t\t\tr.LeaderId,\n\t\t\t\t\tlogentry.SequenceNumber-1,\n\t\t\t\t\tr.Log[logentry.SequenceNumber-1].Term,\n\t\t\t\t\tlogentry,\n\t\t\t\t\tr.CommitIndex,\n\t\t\t\t}\n\t\t\t} else { \n\t\t\t\targs = &AppendRPCArgs { // if Log has only one entry or no entry\n\t\t\t\t\tr.CurrentTerm,\n\t\t\t\t\tr.LeaderId,\n\t\t\t\t\t0,\n\t\t\t\t\tr.CurrentTerm,\n\t\t\t\t\tlogentry,\n\t\t\t\t\tr.CommitIndex,\n\t\t\t\t}\n\t\t\t}*/\n\n\t\t\t//fmt.Println(\"Append Recieved \",logentry.SequenceNumber)\n\t\t\t\tvar AppendAck_ch = make (chan int,len(r.ClusterConfigV.Servers)-1)\n\t\t\t\tfor _,server := range r.ClusterConfigV.Servers {\t\t\t\n\t\t\t\t\t\tif server.Id != r.Id {\n\t\t\t\t\t\t\tif(logentry.SequenceNumber>r.NextIndex[server.Id]){\n\t\t\t\t\t\t\t\t\tlogentry1 = r.Log[r.NextIndex[server.Id]]\n\t\t\t\t\t\t\t\t\tsyncNeeded=true\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\tlogentry1 = logentry\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif logentry1.SequenceNumber >= 1 {\t\n\t\t\t\t\t\t\t\t\t\targs = &AppendRPCArgs {\n\t\t\t\t\t\t\t\t\t\tr.CurrentTerm,\n\t\t\t\t\t\t\t\t\t\tr.LeaderId,\n\t\t\t\t\t\t\t\t\t\tlogentry1.SequenceNumber-1,\n\t\t\t\t\t\t\t\t\t\tr.Log[logentry1.SequenceNumber-1].Term,\n\t\t\t\t\t\t\t\t\t\tlogentry1,\n\t\t\t\t\t\t\t\t\t\tr.CommitIndex,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\targs = &AppendRPCArgs {\n\t\t\t\t\t\t\t\t\tr.CurrentTerm,\n\t\t\t\t\t\t\t\t\tr.LeaderId,\n\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\tr.CurrentTerm,\n\t\t\t\t\t\t\t\t\tlogentry1,\n\t\t\t\t\t\t\t\t\tr.CommitIndex,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\t\t\t\n\t\t\t\t\t\t\tgo r.sendAppendRpc(server,args,AppendAck_ch,false) // to send Log entry to follower \n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor j:=0;j<len(r.ClusterConfigV.Servers)-1;j++{\n\t\t\t\t\t\t\tid:=<- AppendAck_ch \n\t\t\t\t\t\t\tif(id!=-1 && r.MatchIndex[id]==logentry.SequenceNumber){\n\t\t\t\t\t\t\t\tappendAckcount++\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif appendAckcount > len(r.ClusterConfigV.Servers)/2 { // If we have majority in log , update commit index\n\t\t\t\t\t\t\t\tr.CommitIndex=logentry.SequenceNumber\n\t\t\t\t\t\t\t\tlogentry.IsCommitted=true\n\t\t\t\t\t\t\tbreak\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t/*\tmajorCount:=0\n\t\t\t\t\t\tfor _,serverC:= range r.ClusterConfigV.Servers { // Check if log entry is in majority \n\t\t\t\t\t\t\tif serverC.Id !=r.Id && r.MatchIndex[serverC.Id] == logentry.SequenceNumber {\n\t\t\t\t\t\t\t\tmajorityCount++\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\tif(logentry.IsCommitted==true){ // If log is committed, write it to log, and send log entry for evaluation on input_ch\n\t\t\t\t\t\t//fmt.Println(\"Commited \",logentry.SequenceNumber)\n\t\t\t\t\t\tr.Log[logentry.SequenceNumber].IsCommitted=true\n\t\t\t\t\t\tlogentry.IsCommitted=true\n\t\t\t\t\t\tr.CommitIndex=logentry.SequenceNumber\n\t\t\t\t\t\tInput_ch <- Log_Conn{logentry, conn}\n\t\t\t\t\t\tr.File.WriteString(strconv.Itoa(logentry.Term)+\" \"+strconv.Itoa(logentry.SequenceNumber)+\" \"+strings.TrimSpace(strings.Replace(string(logentry.Command),\"\\n\",\" \",-1))+\" \"+\n\t\t\" \"+strconv.FormatBool(logentry.IsCommitted))\n\t\t\t\t\t\tr.File.WriteString(\"\\t\\r\\n\");\n\t\t\t\t\t} else { \n\t\t\t\t\t \t\t\t//if syncNeeded==true{ // If Log is not commited, call thsi function to Sync all logs, Logs are sync only till current Logentry, not beyong this even if \n\t\t\t\t\t\t\t\t\t// Leader log has go more entries added while executing this\n\t\t\t\t\t\t\t\t\t//fmt.Println(\"Sync call from append\")\n\t\t\t\t\t\t\t\tsyncNeeded=false\n\t\t\t\t\t\t\t\t//fmt.Println(\"Sync Called from Else\")\n\t\t\t\t\t\t\t\tSyncAllLog(Log_Conn{logentry,conn})\t\t\n\n\t\t\t\t\t\t}\n\t\t\t\t\tif syncNeeded==true{ // If Log is is commited, call thsi function to Sync all logs, Logs are sync only till current Logentry, not beyong this even if \n\t\t\t\t\t\t\t\t\t// Leader log has go more entries added while executing this\n\t\t\t\t\t\t\t\t\t//fmt.Println(\"Sync call from append\")\n\t\t\t\t\t\t//\tfmt.Println(\"Sync Called from syncNeeded == True\")\n\t\t\t\t\t\t\tSyncAllLog(Log_Conn{logentry,conn})\n\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\n\t\t\t\t}\n}", "func (ck *Clerk) PutAppend(key string, value string, op string) {\n\t// You will have to modify this function.\n\tck.mu.Lock()\n\tserveri := ck.i\n\tck.sequence++\n\tsequence := ck.sequence\n\tclientName := ck.name\n\tck.mu.Unlock()\n\tfor {\n\t\targs := &PutAppendArgs{\n\t\t\tKey: key,\n\t\t\tValue: value,\n\t\t\tOp: op,\n\t\t\tClientName: clientName,\n\t\t\tSequence: sequence,\n\t\t}\n\t\treply := &PutAppendReply{}\n\t\tDPrintf(\"[CLERK] calling KVServer %d.PutAppend [K=%s] [V=%s] [Op=%s] \", serveri, key, value, op)\n\t\tok := ck.servers[serveri].Call(\"KVServer.PutAppend\", args, reply)\n\t\tif !reply.IsLeader || !ok || reply.Err != \"\" {\n\t\t\tif reply.Err != \"\" {\n\t\t\t\tDPrintf(\"[DEBUG] Clerk.PutAppend err:[%s]\", reply.Err)\n\t\t\t}\n\t\t\tDPrintf(\"[CLERK] KVServer.PutAppend sent to nonleader\")\n\t\t\t// try another server\n\t\t\tck.mu.Lock()\n\t\t\tck.i = int(nrand()) % len(ck.servers)\n\t\t\tserveri = ck.i\n\t\t\tck.mu.Unlock()\n\t\t\ttime.Sleep(30 * time.Millisecond)\n\t\t\tcontinue\n\t\t} else {\n\t\t\tDPrintf(\"[CLERK] KVServer.PutAppend return\")\n\t\t\tbreak\n\t\t}\n\t}\n\n}", "func (c *ConcurrentPreviousSet) Append(message types.Message) {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\tc.values[message.Identifier] = message\n}", "func (r *Raft) sendAppend(to uint64) bool {\n\tr.sendAppendEntries(to)\n\treturn true\n}", "func (ck *Clerk) PutAppend(key string, value string, op Type) {\n\targs := PutAppendArgs{key, value, op, nrand()}\n\ti := ck.leader\n\tfor {\n\t\tvar reply PutAppendReply\n\t\tDPrintf(\"CLIENT %d TRYING TO CALL PUT/APPEND on server %d for key %s and value %s\\n\", ck.id, i, key, value)\n\t\tdone := make(chan bool)\n\t\tgo func() {\n\t\t\tok := ck.servers[i].Call(\"RaftKV.PutAppend\", &args, &reply)\n\t\t\tif ok {\n\t\t\t\tdone <- true\n\t\t\t}\n\t\t}()\n\t\tselect {\n\t\tcase <-done:\n\t\t\tDPrintf(\"CLIENT %d GOT PUT/APPEND KVRAFT REPLY from server %d for key %s and value %s: %+v\\n\", ck.id, i, key, value, reply)\n\t\t\tif reply.WrongLeader {\n\t\t\t\ti = (i + 1) % len(ck.servers)\n\t\t\t} else if reply.Err == ErrLostAction {\n\t\t\t\t// retry this server because its the leader\n\t\t\t} else if reply.Err == OK {\n\t\t\t\tck.leader = i\n\t\t\t\tDPrintf(\"CLIENT %d SET LEADER TO %d\\n\", ck.id, i)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-time.After(500 * time.Millisecond):\n\t\t\tDPrintf(\"CLIENT %d TIMED OUT ON PUT/APPEND KVRAFT REQUEST for server %d and key %s and value %s\", ck.id, i, key, value)\n\t\t\ti = (i + 1) % len(ck.servers)\n\t\t}\n\t}\n}", "func (s *State) Append(group *mesosfile.Group) {\n\ts.pending <- group\n}", "func (ep *EndPoint) push(msg *Chat_Message) {\n\tif len(ep.Inbox) > ep.retention {\n\t\tep.Inbox = append(ep.Inbox[1:], *msg)\n\t\tep.StartOffset++\n\t} else {\n\t\tep.Inbox = append(ep.Inbox, *msg)\n\t}\n\tep.notifyConsumers()\n}", "func (oplog *OpLog) Append(op *Operation) {\n\toplog.append(op, nil)\n}", "func (s *storage) add(m mqtt.Message, messageid uint16) {\n\ts.mux.Lock()\n\ts.sto[messageid] = m\n\ts.mux.Unlock()\n}", "func (l *LevelDB) Append(entries []pb.Entry) error {\n\tbatch := new(leveldb.Batch)\n\tfor _, e := range entries {\n\t\tk := make([]byte, 8)\n\t\tbinary.LittleEndian.PutUint64(k, uint64(e.Index))\n\t\tb, err := proto.Marshal(&e)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbatch.Put(k, b)\n\t}\n\n\treturn l.db.Write(batch, nil)\n}", "func (ck *Clerk) PutAppend(key string, value string, op string) {\n\t// You will have to modify this function.\n\targs := PutAppendArgs{\n\t\tClerkId: ck.clerkId,\n\t\tKey: key,\n\t\tValue: value,\n\t\tOp: op,\n\t}\n\tif !ck.reSendFlag {\n\t\tck.opId++\n\t}\n\targs.OpId = ck.opId\n\treply := PutAppendReply{}\n\tok := ck.servers[ck.leader].Call(\"KVServer.PutAppend\", &args, &reply)\n\tif ok {\n\t\tswitch reply.Err {\n\t\tcase OK:\n\t\t\tck.reSendFlag = false\n\t\tcase ErrWrongLeader:\n\t\t\tck.reSendFlag = true\n\t\t\tck.leader = (ck.leader + 1) % len(ck.servers)\n\t\t\tck.PutAppend(key, value, op)\n\t\t}\n\t} else {\n\t\tck.reSendFlag = true\n\t\tck.leader = (ck.leader + 1) % len(ck.servers)\n\t\tck.PutAppend(key, value, op)\n\t}\n}", "func (wal *BaseWAL) Write(msg WALMessage) error {\n\tif wal == nil {\n\t\treturn nil\n\t}\n\n\tif err := wal.enc.Encode(&TimedWALMessage{tmtime.Now(), msg}); err != nil {\n\t\twal.Logger.Error(\"Error writing msg to consensus wal. WARNING: recover may not be possible for the current height\",\n\t\t\t\"err\", err, \"msg\", msg)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (tm *TableManager) Append(i Index, ts *Table) error {\n\tif ts == nil {\n\t\treturn log.Error(\"csdb.TableManager.Init\", \"err\", errgo.Newf(\"Table pointer cannot be nil for Index %d\", i))\n\t}\n\ttm.mu.Lock()\n\ttm.ts[i] = ts\n\ttm.mu.Unlock() // use defer once there are multiple returns\n\treturn nil\n}", "func (ck *Clerk) PutAppend(key string, value string, op string) {\n\t// You will have to modify this function.\n\tpaArgs := &PutAppendArgs{}\n\tpaArgs.Key = key\n\tpaArgs.Value = value\n\tpaArgs.Op = op\n\tpaArgs.ClientID = ck.ID\n\tck.mu.Lock()\n\tpaArgs.CommSeq = ck.commSeq\n\tck.commSeq++\n\tck.mu.Unlock()\n\tDPrintf(\"client: %v reqeust pa ID %d %s key:%s value:%s\", ck.ID, paArgs.CommSeq, op, key, value)\n\tvar leaderNum int\n\tfor true {\n\t\tpaReply := &PutAppendReply{}\n\t\tif ck.LeaderIndex != -1 {\n\t\t\tleaderNum = ck.LeaderIndex\n\t\t} else {\n\t\t\tleaderNum = (int(nrand()) % len(ck.servers))\n\t\t}\n\t\tDPrintf(\"client %v: get leaderNum %d\", ck.ID, leaderNum)\n\t\t//ok := ck.servers[(leaderNum+len(ck.servers)-1)%(len(ck.servers))].Call(\"KVServer.PutAppend\", paArgs, paReply)\n\t\tok := ck.servers[leaderNum].Call(\"KVServer.PutAppend\", paArgs, paReply)\n\t\tif paReply.WrongLeader || !ok {\n\t\t\tDPrintf(\"client: %v ask %d but wrong leader\", ck.ID, leaderNum)\n\t\t\tck.LeaderIndex = -1\n\t\t\ttime.Sleep(10 * time.Millisecond)\n\t\t\t//TODO::optimization needed\n\t\t} else if paReply.Err != Err(\"\") {\n\t\t\tDPrintf(\"kv %s: put meets err\", string(paReply.Err))\n\t\t} else {\n\t\t\tck.LeaderIndex = leaderNum\n\t\t\tbreak\n\t\t}\n\t}\n\tDPrintf(\"client: %v end reqeust pa ID %d %s key:%s \", ck.ID, paArgs.CommSeq, op, key)\n}", "func updateLastAppended(s *followerReplication, req *pb.AppendEntriesRequest) {\n\t// Mark any inflight logs as committed\n\tif logs := req.Entries; len(logs) > 0 {\n\t\tlast := logs[len(logs)-1]\n\t\tatomic.StoreUint64(&s.nextIndex, last.Index+1)\n\t\ts.commitment.match(s.peer.ID, last.Index)\n\t}\n\n\t// Notify still leader\n\ts.notifyAll(true)\n}", "func (tm *topicManager) createNewTopic(name string, id string) (log, error) {\n\tlc, ok := tm.topicNamesToLogs[name]\n\tif ok {\n\t\tlc.refCount++\n\t\treturn lc.l, nil\n\t}\n\n\t// lazily create the log if we know about the topic/cc ID\n\tl, err := newBadgerLog(tm.dataDir, name, id, tm.cc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttm.topicNamesToLogs[name] = &logContainer{\n\t\tl: l,\n\t\trefCount: 1,\n\t}\n\treturn l, nil\n}", "func (e *EventStore) AppendTo(ctx context.Context, streamName goengine.StreamName, streamEvents []goengine.Message) error {\n\treturn e.AppendToWithExecer(ctx, e.db, streamName, streamEvents)\n}", "func (batch *BatchEncoder) Append(key []byte, value []byte) {\n\tvar keyLenByte [8]byte\n\tbinary.BigEndian.PutUint64(keyLenByte[:], uint64(len(key)))\n\tvar valueLenByte [8]byte\n\tbinary.BigEndian.PutUint64(valueLenByte[:], uint64(len(value)))\n\n\tbatch.keyBuf.Write(keyLenByte[:])\n\tbatch.keyBuf.Write(key)\n\n\tbatch.valueBuf.Write(valueLenByte[:])\n\tbatch.valueBuf.Write(value)\n}", "func (c *Chain) Append(mw ...Middleware) *Chain {\n\tnc := make([]Middleware, 0, len(c.mw)+len(mw))\n\tnc = append(nc, c.mw...)\n\tnc = append(nc, mw...)\n\n\treturn &Chain{\n\t\tmw: nc,\n\t}\n}", "func (wal *WAL) Write(bufs ...[]byte) error {\n\tif wal.backlog != nil {\n\t\twal.backlog <- bufs\n\t\treturn nil\n\t} else {\n\t\treturn wal.doWrite(bufs...)\n\t}\n}", "func (kv *ShardKV) PutAppend(args *PutAppendArgs, reply *PutAppendReply) error {\n\t// Your code here.\n\t\n\tkv.mu.Lock()\n\tdefer kv.mu.Unlock()\n\n\tdelete(kv.records, args.Prev)\n\n\tDPrintf(\"%s Received %s, Key=%s,Value=%s\",kv.name,args.Op,args.Key,args.Value)\n\tDPrintf(\"ID=%v\",args.ID)\n\t\n\tif record, ok := kv.records[args.ID]; ok && record.Err==OK {\n\t // we have a record associate with this ID\n\t reply.Err = record.Err\n\n\t DPrintf(\"%s found an ID we have seen before,%s key=%s value=%s\",kv.name,args.Op,args.Key,args.Value)\n\t DPrintf(\"Err=%v\", reply.Err)\n\t return nil\n\t}\n\n//\tdelete(kv.records, args.Prev)\n\n\tvar v = Op{}\n\tv.ID = args.ID\n\tv.Type = args.Op\n\tv.Key = args.Key\n\tv.Value = args.Value\n\t\n\tseq := kv.Log(v)\n\tresult := kv.ReadLog(seq)\n\n\treply.Err = result.Err\n\treply.Done = args.ID\n\n\tkv.px.Done(seq)\n\tkv.seq = seq + 1\n\n\tnewRecord := Record{result.Value,result.Err}\n\tkv.records[args.ID] = &newRecord\n\n\treturn nil\n}", "func (c *Client) PutAppend(key string, value string, op string) {\n\n\treq := PutAppendRequest{\n\t\tKey: key,\n\t\tValue: value,\n\t\tClientInfo: ClientInfo{\n\t\t\tUid: c.Uid,\n\t\t\tSeq: atomic.AddInt64(&c.Seq, 1),\n\t\t},\n\t\tOpType: op,\n\t}\n\ts := key2shard(key)\n\tc.info(\"开始PutAppend %+v\", req)\n\tdefer c.info(\"成功PutAppend %+v\", req)\n\tfor {\n\t\tc.mu.Lock()\n\t\tgid := c.conf.Shards[s]\n\t\tservers, ok := c.conf.Groups[gid]\n\t\tc.mu.Unlock()\n\t\tif ok {\n\t\tround:\n\t\t\tfor _, srvi := range servers {\n\t\t\t\tvar resp PutAppendResponse\n\t\t\t\tsrv := c.make_end(srvi)\n\t\t\t\tsrv.Call(\"ShardKV.PutAppend\", &req, &resp)\n\t\t\t\tswitch resp.RPCInfo {\n\t\t\t\tcase SUCCESS:\n\t\t\t\t\treturn\n\t\t\t\tcase DUPLICATE_REQUEST:\n\t\t\t\t\treturn\n\t\t\t\tcase WRONG_GROUP:\n\t\t\t\t\tbreak round\n\t\t\t\tdefault:\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttime.Sleep(CLIENT_REQUEST_INTERVAL)\n\t\t// ask controler for the latest configuration.\n\t\tconfig := c.scc.Query(-1)\n\t\tc.mu.Lock()\n\t\tc.conf = config\n\t\tc.mu.Unlock()\n\t}\n}", "func (fsm *fsm) applyAppend(b []byte) interface{} {\n\tvar req api.ProduceRequest\n\terr := proto.Unmarshal(b, &req)\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset, err := fsm.log.Append(req.Record)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn &api.ProduceResponse{Offset: offset}\n}", "func (w *fileWAL) append(entry walEntry) (int, error) {\n\n\t// Make sure we have an open WAL.\n\tif w.f == nil {\n\t\treturn 0, errorInvalidWALFile\n\t}\n\n\t// Buffer writes until the end.\n\tbuf := &bytes.Buffer{}\n\n\tvar err error\n\n\t// Write magic number\n\terr = binary.Write(buf, binary.LittleEndian, walMagic)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t// Write the operation type\n\terr = binary.Write(buf, binary.LittleEndian, entry.operation)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t// Write the number of rows\n\terr = binary.Write(buf, binary.LittleEndian, uint16(len(entry.rows)))\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tfor _, row := range entry.rows {\n\t\t// Write source name length\n\t\terr = binary.Write(buf, binary.LittleEndian, uint8(len(row.Source)))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\t// Write metric name length\n\t\terr = binary.Write(buf, binary.LittleEndian, uint8(len(row.Metric)))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\t// Write source and metric names\n\t\t_, err = buf.WriteString(row.Source + row.Metric)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\t// Write timestamp and value\n\t\terr = binary.Write(buf, binary.LittleEndian, Point{\n\t\t\tTimestamp: row.Timestamp,\n\t\t\tValue: row.Value,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\t// Record the current offset so we can truncate\n\t// later in case something goes wrong.\n\tcurrentOffset, err := w.f.Seek(0, 1)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tw.lastReadOffset = currentOffset\n\n\t// Flush to the file.\n\tn, err := w.f.Write(buf.Bytes())\n\tif err != nil {\n\t\treturn n, err\n\t}\n\n\treturn n, err\n}", "func (rf *Raft) sendAppendEntriesToMultipleFollowers() {\n for !rf.killed() {\n rf.mu.Lock()\n if rf.state != \"Leader\" {\n DLCPrintf(\"Server (%d) is no longer Leader and stop sending Heart Beat\", rf.me)\n rf.mu.Unlock()\n return\n }\n\n for i := 0; i < len(rf.peers) && rf.state == \"Leader\"; i++ {\n if i == rf.me {\n continue\n }else{\n if rf.nextIndex[i] <= rf.snapshottedIndex {\n go rf.sendInstallSnapshotToOneFollower(i, rf.log[0].Term)\n }else{\n go rf.sendAppendEntriesToOneFollower(i)\n }\n }\n }\n if rf.state != \"Leader\" {\n DLCPrintf(\"Server (%d) is no longer Leader and stop sending Heart Beat\", rf.me)\n rf.mu.Unlock()\n return\n }\n rf.commitEntries()\n rf.mu.Unlock()\n\n time.Sleep(100 * time.Millisecond)\n }\n}", "func (m *OutMessage) Append(src []byte) {\n\tp := m.GrowNoZero(len(src))\n\tif p == nil {\n\t\tpanic(fmt.Sprintf(\"Can't grow %d bytes\", len(src)))\n\t}\n\n\tsh := (*reflect.SliceHeader)(unsafe.Pointer(&src))\n\tmemmove(p, unsafe.Pointer(sh.Data), uintptr(sh.Len))\n\n\treturn\n}", "func (kv *ShardKV) PutAppend(args *PutAppendArgs, reply *PutAppendReply) error {\n\tkv.mu.Lock()\n\tdefer kv.mu.Unlock()\n\n\tif args.Seq == kv.seqHistory[args.Me] {\n\t\treply.Err = kv.replyHistory[args.Me].Err\n\t} else if args.Seq > kv.seqHistory[args.Me] {\n\t\tputAppendOp := Op{CID: args.Me, Seq: args.Seq, Op: args.Op, Key: args.Key, Value: args.Value}\n\t\tkv.doOperation(putAppendOp)\n\t}\n\n\treturn nil\n}", "func (h *Handle) NeighAppend(neigh *Neigh) error {\n\treturn h.neighAdd(neigh, syscall.NLM_F_CREATE|syscall.NLM_F_APPEND)\n}", "func (w *Writer) Append(prog []byte, n int64)", "func (this *UnsubscribeMessage) AddTopic(topic []byte) {\n\tif this.TopicExists(topic) {\n\t\treturn\n\t}\n\n\tthis.topics = append(this.topics, topic)\n\tthis.dirty = true\n}", "func (client *MemcachedClient4T) Append(e *common.Element) error {\n\treturn client.store(\"append\", e)\n}", "func (r *Redis) AppendTaskLog(taskID string, now time.Time, system, message, level string) error {\n\tconn := r.pool.Get()\n\tdefer conn.Close()\n\n\ttaskLogsKey := \"sync_tasks#\" + taskID + \":logs\"\n\tlogRecord := TaskLogRecord{\n\t\tTime: now.Format(timestamp.Layout),\n\t\tSystem: system,\n\t\tMessage: message,\n\t\tLevel: level,\n\t}\n\n\t_, err := conn.Do(\"ZADD\", taskLogsKey, now.Unix(), logRecord.Marshal())\n\tnoticeError(err)\n\tif err != nil && err != redis.ErrNil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *Cluster) AppendData(ap *types.AcceptedProposal) error {\n\tlog.Printf(\"[node %d] Received data: %d,%d [%s] - %s\\n\", c.id, ap.Index, ap.Term, ap.Topic, string(ap.Data))\n\n\tt, ok := c.Data.Topics[ap.Topic]\n\tif !ok {\n\t\treturn fmt.Errorf(\"Attempting to append to topic %s which was not found\", c.dataDir)\n\t}\n\n\treturn t.Append(topic.Data{Index: ap.Index, Term: ap.Term, Data: ap.Data})\n}", "func (s *sliding) append(u Update) {\n\tpos := s.start + LogPosition(len(s.log))\n\ts.log = append(s.log, u)\n\ts.addrPos[u.Addr] = pos\n}", "func (r *LoggingRepository) Append(ctx context.Context, teamID, userID string) error {\n\tstart := time.Now()\n\terr := r.upstream.Append(ctx, teamID, userID)\n\n\tlogger := r.logger.With().\n\t\tStr(\"request\", r.requestID(ctx)).\n\t\tStr(\"method\", \"append\").\n\t\tDur(\"duration\", time.Since(start)).\n\t\tStr(\"team\", teamID).\n\t\tStr(\"user\", userID).\n\t\tLogger()\n\n\tif err != nil {\n\t\tlogger.Warn().\n\t\t\tErr(err).\n\t\t\tMsg(\"failed to append member\")\n\t} else {\n\t\tlogger.Debug().\n\t\t\tMsg(\"\")\n\t}\n\n\treturn err\n}", "func (p *Pes) Append(buf []byte) {\n\tp.buf = append(p.buf, buf...)\n}", "func (n *Sub) push(nmsg []byte) {\n\tif n.filter != nil && n.filter(nmsg) {\n\t\treturn\n\t}\n\tfor n.stop {\n\t\ttime.Sleep(time.Minute)\n\t}\n\tmsg := string(nmsg)\n\tfor i := 0; i < len(n.w.Callbacks); i++ {\n\t\tcb := n.w.Callbacks[i]\n\t\tif err := n.retry(cb.URL, string(nmsg), _syncCall); err != nil {\n\t\t\tid, err := n.backupMsg(msg, i)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"group(%s) topic(%s) add msg(%s) backup fail err %v\", n.w.Group, n.w.Topic, string(nmsg), err)\n\t\t\t}\n\t\t\tn.addAsyncRty(id, msg, i)\n\t\t\treturn\n\t\t}\n\t}\n}", "func (ck *Clerk) PutAppend(key string, value string, op string) {\n\t// You will have to modify this function.\n\tck.seq++\n\targs := PutAppendArgs{\n\t\tKey: key,\n\t\tValue: value,\n\t\tOp: op,\n\t\tId: ck.id,\n\t\tSeq: ck.seq,\n\t}\n\n\tif op == \"Put\" || op == \"Append\" {\n\t\tfor {\n\t\t\tvar reply PutAppendReply\n\t\t\tif ck.servers[ck.leaderId].Call(\"KVServer.PutAppend\", &args, &reply) && reply.Err==OK {\n\t\t\t\tDPrintf(\"[client %v, commandSeq %v] command(%v) execute, (key:%v, value %v)\",ck.id, ck.seq, op, key, value)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif reply.Err == ErrWrongLeader {\n\t\t\t\tDPrintf(\"[client %v, commandSeq %v] command(%v) send to server(%v) is not leader\", ck.id, ck.seq, op, ck.leaderId)\n\t\t\t} else {\n\t\t\t\tDPrintf(\"cannot connect to server [%v], reply.Err(%v)\", ck.leaderId, reply.Err)\n\t\t\t}\n\t\t\tck.leaderId = ck.randomChooseLeader()\n\t\t}\n\t} else {\n\t\tDPrintf(\"[client %v, commandSeq %v] command (%v) not support\", ck.id, ck.seq, op)\n\t}\n}", "func (k Keeper) AppendMessage(\n\tctx sdk.Context,\n\tmessage types.Message,\n) uint64 {\n\t// Create the message\n\tcount := k.GetMessageCount(ctx)\n\n\t// Set the ID of the appended value\n\tmessage.Id = count\n\n\tstore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.MessageKey))\n\tappendedValue := k.cdc.MustMarshalBinaryBare(&message)\n\tstore.Set(GetMessageIDBytes(message.Id), appendedValue)\n\n\t// Update message count\n\tk.SetMessageCount(ctx, count+1)\n\n\treturn count\n}", "func (rf *Raft) sendEntries() {\n\trf.mu.Lock()\n\tlastLog := rf.getLastLog()\n\trf.mu.Unlock()\n\tfor i := range rf.peers {\n\t\tif i == rf.me {\n\t\t\tcontinue\n\t\t}\n\t\trf.mu.Lock()\n\t\tmatchIndex := rf.LeaderStatus.matchIndex[i]\n\t\tnextIndex := rf.LeaderStatus.nextIndex[i]\n\t\t//DPrintf(\"send entry peer=%v matchIndex=%v lastIndex=%v nextIndex=%v\", i, matchIndex, lastLog.Index, nextIndex)\n\t\tvar req *AppendEntriesArgs\n\t\t// TODO: whether delete ???\n\t\tif matchIndex >= lastLog.Index {\n\t\t\treq = &AppendEntriesArgs{\n\t\t\t\tType: HeartBeat,\n\t\t\t\tTerm: rf.currentTerm,\n\t\t\t\tLeaderId: rf.peerId,\n\t\t\t\tLeaderCommit: rf.commitIndex,\n\t\t\t}\n\t\t\tDPrintf(\"peer=%v send heartbeat to peer=%v\", rf.me, i)\n\t\t} else {\n\t\t\t// TODO: if the logEntries be cutoff after make snapshot, we should shift the start index\n\t\t\tlogEntries := rf.logEntries[matchIndex+1 : min(nextIndex+1, len(rf.logEntries))]\n\t\t\tprevLog := rf.logEntries[matchIndex]\n\t\t\treq = &AppendEntriesArgs{\n\t\t\t\tType: Entries,\n\t\t\t\tTerm: rf.currentTerm,\n\t\t\t\tLeaderId: rf.peerId,\n\t\t\t\tPrevLogIndex: prevLog.Index,\n\t\t\t\tPrevLogTerm: prevLog.Term,\n\t\t\t\tLogEntries: logEntries, // TODO: refine to control each time send message count (case 2B)\n\t\t\t\tLeaderCommit: rf.commitIndex,\n\t\t\t}\n\t\t\t//DPrintf(\"peer=%v send entry=%v to=%v next=%v logEntrySize=%d\", rf.me, rf.logEntries[matchIndex+1 : nextIndex+1], i, nextIndex, len(logEntries))\n\t\t}\n\t\trf.mu.Unlock()\n\t\tgo rf.sendAppendEntries(i, req, &AppendEntriesReply{})\n\t}\n}", "func (ck *Clerk) PutAppend(key string, value string, op string) {\n\targs := PutAppendArgs{}\n\targs.Key = key\n\targs.Value = value\n\targs.Op = op\n\targs.ClientID = ck.clientID\n\targs.RequestID = ck.currentRPCNum\n\n\n\tfor {\n\t\tshard := key2shard(key)\n\t\tgid := ck.config.Shards[shard]\n\t\t// If the gid exists in our current stored configuration. \n\t\tif servers, ok := ck.config.Groups[gid]; ok {\n\t\t\t// try each server for the shard.\n\t\t\t\n\t\t\t\tselectedServer := ck.getRandomServer(gid)\n\t\t\t\tsrv := ck.make_end(servers[selectedServer])\n\t\t\t\t\n\t\t\t\tvar reply PutAppendReply\n\t\t\t\tok := ck.sendRPC(srv, \"ShardKV.PutAppend\", &args, &reply)\n\n\t\t\t\t// Wrong Leader (reset stored leader)\n\t\t\t\tif !ok || (ok && reply.WrongLeader == true) {\n\t\t\t\t\tck.currentLeader[gid] = -1\n\t\t\t\t}\n\n\t\t\t\t// Correct Leader\n\t\t\t\tif ok && reply.WrongLeader == false {\n\t\t\t\t\t//Update stored Leader\n\t\t\t\t\tck.currentLeader[gid] = selectedServer\n\n\t\t\t\t\t// Handle successful reply\n\t\t\t\t\tif (reply.Err == OK) {\n\t\t\t\t\t\tck.DPrintf1(\"Action: PutAppend completed. Sent Args => %+v, Received Reply => %+v \\n\", args, reply)\n\t\t\t\t\t\t// RPC Completed so increment the RPC count by 1.\n\t\t\t\t\t\tck.currentRPCNum = ck.currentRPCNum + 1\n\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ok && reply.Err == ErrWrongGroup {\n\t\t\t\t\t// ask master for the latest configuration.\n\t\t\t\t\tck.config = ck.sm.Query(-1)\n\t\t\t\t\ttime.Sleep(100 * time.Millisecond)\n\t\t\t\t}\n\n\t\t} else {\n\t\t\t// ask master for the latest configuration.\n\t\t\tck.config = ck.sm.Query(-1)\n\t\t\ttime.Sleep(100 * time.Millisecond)\n\t\t}\n\t}\n\n\tck.DError(\"Return from PUTAPPEND in ShardKV Client. Should never return from here.\")\n}", "func (r *Raft) handleAppendEntries(m pb.Message) {\n\n\tvar prevPosition = -1\n\tif len(r.RaftLog.entries) == 0 || m.Index < r.RaftLog.entries[0].Index {\n\t\tterm, err := r.RaftLog.storage.Term(m.Index)\n\t\tif err != nil || term != m.LogTerm {\n\t\t\tr.appendMsg(r.buildReject(pb.MessageType_MsgAppendResponse, m.From))\n\t\t\treturn\n\t\t}\n\t} else {\n\t\t//reject if prevPosition entry not findLastMatch\n\t\tvar found bool\n\t\tprevPosition, found = r.RaftLog.findByIndex(m.Index)\n\t\tif !found || r.RaftLog.entries[prevPosition].Term != m.LogTerm {\n\t\t\tr.appendMsg(r.buildReject(pb.MessageType_MsgAppendResponse, m.From))\n\t\t\treturn\n\t\t}\n\t}\n\n\toffset := 0\n\tfor ; offset < len(m.Entries); offset++ {\n\t\tif offset+prevPosition+1 >= len(r.RaftLog.entries) {\n\t\t\tr.RaftLog.append(m.Entries[offset:])\n\t\t\tbreak\n\t\t}\n\t\te1 := r.RaftLog.entries[offset+prevPosition+1]\n\t\te2 := m.Entries[offset]\n\t\tif e1.Index != e2.Index || e1.Term != e2.Term {\n\t\t\tr.RaftLog.entries = r.RaftLog.entries[:offset+prevPosition+1]\n\t\t\tif len(r.RaftLog.entries) > 0 {\n\t\t\t\tlastIndexInLog := r.RaftLog.entries[len(r.RaftLog.entries)-1].Index\n\t\t\t\tif lastIndexInLog < r.RaftLog.stabled {\n\t\t\t\t\tr.RaftLog.stabled = lastIndexInLog\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tr.RaftLog.stabled = 0\n\t\t\t}\n\t\t\tr.RaftLog.append(m.Entries[offset:])\n\t\t\tbreak\n\t\t}\n\t}\n\n\tmsg := r.buildMsgWithoutData(pb.MessageType_MsgAppendResponse, m.From, false)\n\tmsg.Index = r.RaftLog.LastIndex()\n\tr.appendMsg(msg)\n\n\t// update committed\n\tlastIndex := lastIndexInMeg(m)\n\tif m.Commit > r.RaftLog.committed && lastIndex > r.RaftLog.committed {\n\t\tr.RaftLog.committed = min(m.Commit, lastIndex)\n\t}\n\n\t// Your Code Here (2A).\n}", "func (b *BookShelf) Append(book *Book) {\n\tb.books = append(b.books, book)\n\tb.last++\n}", "func (l *Log) writer() {\n\t// Open as O_RDWR (which should get lock) and O_DIRECT.\n\tf, err := os.OpenFile(l.filename, os.O_WRONLY|os.O_APPEND, 0660)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer f.Close()\n\tenc := json.NewEncoder(f)\n\tfor {\n\t\tr, ok := <-l.in\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\t\tif r.m == nil {\n\t\t\tr.err <- fmt.Errorf(\"cannot write nil to wal\")\n\t\t\treturn\n\t\t}\n\t\t// serialize mutation and write to disk\n\t\tif err := enc.Encode(r.m); err != nil {\n\t\t\tr.err <- fmt.Errorf(\"wal encoding: %s\", err.Error())\n\t\t\treturn\n\t\t}\n\t\t// sync\n\t\tif err := f.Sync(); err != nil {\n\t\t\tr.err <- fmt.Errorf(\"wal sync: %s\", err.Error())\n\t\t\treturn\n\t\t}\n\t\tr.err <- nil\n\t\t// send to reader\n\t\tif l.closed {\n\t\t\treturn\n\t\t}\n\t}\n}", "func (r *raft) appendEntriesReceiver(p *AppendEntries) (*AppendEntriesResults, error) {\n\tif p.Term < r.currentTerm {\n\t\treturn &AppendEntriesResults{Term: r.currentTerm, Success: false}, nil\n\t}\n\n\tlastIndex, err := r.log.LastIndex()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif lastIndex < p.PrevLogIndex {\n\t\treturn &AppendEntriesResults{Term: r.currentTerm, Success: false}, nil\n\t}\n\tentries, err := r.log.Read(p.PrevLogIndex, p.PrevLogIndex+1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif entries[0].Term != p.PrevLogTerm {\n\t\treturn &AppendEntriesResults{Term: r.currentTerm, Success: false}, nil\n\t}\n\t// 3. If an existing entry conflicts with a new one(same index but different terms),\n\t// delete the existing entry and all that follow\n\t// 4. Append any new entries not alredy in the log\n\t// TODO: just overwrite directly, is it most efficient?\n\t//r.log = append(r.log[:p.PrevLogIndex], p.Entries...)\n\tif err := r.log.Write(p.PrevLogIndex+1, p.Entries); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif p.LeaderCommit > r.commitIndex {\n\t\t// attention: the log's last index has been updated\n\t\tlastIndex, err := r.log.LastIndex()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tr.commitIndex = min(p.LeaderCommit, lastIndex)\n\t\t// TODO:apply the new committed log to state machine\n\t\t// and update lastApplied\n\t\tentries, err = r.log.Read(r.lastApplied+1, r.commitIndex+1)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// TODO: need save lastApplied to file as currentTerm and votedFor ?\n\t\tr.applier.Apply(entries)\n\t\tr.votedFor = p.LeaderId\n\t\tr.lastApplied = r.commitIndex\n\t}\n\tr.currentTerm = p.Term\n\treturn &AppendEntriesResults{Term: r.currentTerm, Success: true}, nil\n}", "func (l *Lgr) newStreamEntry(streamKey string, msg string, level string, complete bool) {\n // Get new connection from Redis pool.\n conn := l.RedisPool.Get()\n defer conn.Close()\n\n // Add message to log stream.\n if _, err := conn.Do(\"XADD\", streamKey, \"*\", \"msg\", msg, \"level\", level, \"complete\", complete); err != nil {\n l.Errorf(\"error logging to stream: %s\", err.Error())\n }\n}", "func (c *Cluster) AddTopic(toml []byte) error {\n\treturn c.createTopic(toml, false)\n}", "func (l *Lifecycle) Append(hook Hook) {\n\t// Save the caller's stack frame to report file/line number.\n\tif f := fxreflect.CallerStack(2, 0); len(f) > 0 {\n\t\thook.callerFrame = f[0]\n\t}\n\tl.hooks = append(l.hooks, hook)\n}" ]
[ "0.7172584", "0.6377327", "0.57611495", "0.5748846", "0.5728976", "0.5707987", "0.56621695", "0.5645391", "0.55513144", "0.55505306", "0.5547055", "0.55321455", "0.5517304", "0.5488533", "0.54715824", "0.5470633", "0.5447862", "0.5418506", "0.5404934", "0.5399982", "0.53975344", "0.53965235", "0.5375046", "0.53295565", "0.53295565", "0.52958375", "0.5295405", "0.5294363", "0.52781916", "0.52729446", "0.52707654", "0.526941", "0.52657485", "0.5248292", "0.523581", "0.5233371", "0.52330667", "0.5217975", "0.5217975", "0.5209594", "0.5207466", "0.52020955", "0.5201816", "0.5190506", "0.51887834", "0.5187495", "0.5187166", "0.5181439", "0.5175892", "0.5165442", "0.5165442", "0.51644033", "0.5158411", "0.5155751", "0.5152437", "0.5128269", "0.5115329", "0.5102119", "0.5100771", "0.5100118", "0.509994", "0.5086438", "0.50755847", "0.50676787", "0.5064432", "0.50624436", "0.5057373", "0.5055597", "0.5041096", "0.50350314", "0.50230014", "0.50147986", "0.5009445", "0.5008241", "0.49980783", "0.49953473", "0.49923852", "0.4991727", "0.49907213", "0.49903828", "0.49884138", "0.49855018", "0.49834862", "0.49834782", "0.49747807", "0.49672598", "0.49602807", "0.4958491", "0.49415877", "0.49414766", "0.49389717", "0.49249688", "0.4921974", "0.49197665", "0.4917665", "0.49084678", "0.4907669", "0.4894885", "0.48887002", "0.48829356" ]
0.7302169
0
User will inject the databaseTx in the `User` schema
Пользователь введет databaseTx в схему `User`
func (gtx *GuardTx) User(user *schema.User) *schema.User { if user == nil { user = &schema.User{ Entity: schema.Entity{DBContract: gtx.dbTx}, } } else { user.DBContract = gtx.dbTx } user.SetValidator(gtx.validator.User) return user }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func User(user tables.Person) error {\n\tfmt.Println(\"preparing\")\n\tstmt, err := mysqlBus.DB.Prepare(\"INSERT INTO Person VALUES(?, ?, ?, ?, ?, ?)\")\n\tfmt.Println(\"prepared\")\n\tfmt.Println(err)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Println(\"executing\")\n\t_, err = stmt.Exec(user.Username, user.HashedPassword, user.Salt, user.Fname, user.Lname, user.ColorPalette)\n\tfmt.Println(\"executed\")\n\tfmt.Println(err)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Println(\"no error\")\n\tfmt.Println(err)\n\treturn nil\n}", "func (tx *Tx) User(userName []byte) (*User, error) {\n\tu := &User{\n\t\tTx: tx,\n\t\tName: userName,\n\t}\n\n\treturn u, u.Load()\n}", "func (r *Resolver) User() exec.UserResolver { return &userResolver{r} }", "func (create) User(ctx context.Context, db *sqlx.DB, n NewUser, now time.Time) (*User, error) {\n\tctx, span := global.Tracer(\"service\").Start(ctx, \"internal.data.create.user\")\n\tdefer span.End()\n\n\thash, err := bcrypt.GenerateFromPassword([]byte(n.Password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"generating password hash\")\n\t}\n\n\tu := User{\n\t\tID: uuid.New().String(),\n\t\tName: n.Name,\n\t\tEmail: n.Email,\n\t\tPasswordHash: hash,\n\t\tRoles: n.Roles,\n\t\tDateCreated: now.UTC(),\n\t\tDateUpdated: now.UTC(),\n\t}\n\n\tconst q = `INSERT INTO users\n\t\t(user_id, name, email, password_hash, roles, date_created, date_updated)\n\t\tVALUES ($1, $2, $3, $4, $5, $6, $7)`\n\t_, err = db.ExecContext(ctx, q, u.ID, u.Name, u.Email, u.PasswordHash, u.Roles, u.DateCreated, u.DateUpdated)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"inserting user\")\n\t}\n\n\treturn &u, nil\n}", "func init() {\n\tuserFields := schema.User{}.Fields()\n\t_ = userFields\n\t// userDescUsername is the schema descriptor for username field.\n\tuserDescUsername := userFields[1].Descriptor()\n\t// user.UsernameValidator is a validator for the \"username\" field. It is called by the builders before save.\n\tuser.UsernameValidator = userDescUsername.Validators[0].(func(string) error)\n\t// userDescPassword is the schema descriptor for password field.\n\tuserDescPassword := userFields[2].Descriptor()\n\t// user.PasswordValidator is a validator for the \"password\" field. It is called by the builders before save.\n\tuser.PasswordValidator = userDescPassword.Validators[0].(func(string) error)\n\t// userDescEmail is the schema descriptor for email field.\n\tuserDescEmail := userFields[3].Descriptor()\n\t// user.EmailValidator is a validator for the \"email\" field. It is called by the builders before save.\n\tuser.EmailValidator = userDescEmail.Validators[0].(func(string) error)\n\t// userDescCreatedAt is the schema descriptor for created_at field.\n\tuserDescCreatedAt := userFields[4].Descriptor()\n\t// user.DefaultCreatedAt holds the default value on creation for the created_at field.\n\tuser.DefaultCreatedAt = userDescCreatedAt.Default.(func() time.Time)\n\t// userDescUpdatedAt is the schema descriptor for updated_at field.\n\tuserDescUpdatedAt := userFields[5].Descriptor()\n\t// user.DefaultUpdatedAt holds the default value on creation for the updated_at field.\n\tuser.DefaultUpdatedAt = userDescUpdatedAt.Default.(func() time.Time)\n\t// user.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.\n\tuser.UpdateDefaultUpdatedAt = userDescUpdatedAt.UpdateDefault.(func() time.Time)\n\t// userDescID is the schema descriptor for id field.\n\tuserDescID := userFields[0].Descriptor()\n\t// user.DefaultID holds the default value on creation for the id field.\n\tuser.DefaultID = userDescID.Default.(func() uuid.UUID)\n}", "func (r *Resolver) User() generated.UserResolver { return &userResolver{r} }", "func (r *Resolver) User() generated.UserResolver { return &userResolver{r} }", "func TestCreateTablePutUser(t *testing.T) {\n\n\tdbsql, err := sql.Open(\"postgres\", \"user=postgres dbname=gorm password=simsim sslmode=disable\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tdb, err := InitDB(dbsql)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\terr = db.PutUser(12312)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "func init() {\n\tuserFields := schema.User{}.Fields()\n\t_ = userFields\n\t// userDescLogin is the schema descriptor for login field.\n\tuserDescLogin := userFields[0].Descriptor()\n\t// user.LoginValidator is a validator for the \"login\" field. It is called by the builders before save.\n\tuser.LoginValidator = userDescLogin.Validators[0].(func(string) error)\n\t// userDescName is the schema descriptor for name field.\n\tuserDescName := userFields[1].Descriptor()\n\t// user.NameValidator is a validator for the \"name\" field. It is called by the builders before save.\n\tuser.NameValidator = userDescName.Validators[0].(func(string) error)\n\t// userDescPassword is the schema descriptor for password field.\n\tuserDescPassword := userFields[2].Descriptor()\n\t// user.PasswordValidator is a validator for the \"password\" field. It is called by the builders before save.\n\tuser.PasswordValidator = userDescPassword.Validators[0].(func(string) error)\n\t// userDescIsActive is the schema descriptor for isActive field.\n\tuserDescIsActive := userFields[3].Descriptor()\n\t// user.DefaultIsActive holds the default value on creation for the isActive field.\n\tuser.DefaultIsActive = userDescIsActive.Default.(bool)\n}", "func (r *Resolver) User() UserResolver { return &userResolver{r} }", "func TestTx_SaveUser(t *testing.T) {\n\tdb := NewTestDB()\n\tdefer db.Close()\n\n\tok(t, db.Update(func(tx *gist.Tx) error {\n\t\tok(t, tx.SaveUser(&gist.User{ID: 100, Username: \"john\", AccessToken: \"1234\"}))\n\t\treturn nil\n\t}))\n\n\tok(t, db.View(func(tx *gist.Tx) error {\n\t\tu, _ := tx.User(100)\n\t\tequals(t, &gist.User{ID: 100, Username: \"john\", AccessToken: \"1234\"}, u)\n\t\treturn nil\n\t}))\n}", "func (_UserCrud *UserCrudTransactor) InsertUser(opts *bind.TransactOpts, userAddress common.Address, userEmail string, userAge *big.Int) (*types.Transaction, error) {\n\treturn _UserCrud.contract.Transact(opts, \"insertUser\", userAddress, userEmail, userAge)\n}", "func Create(user User) error {\n\t\n}", "func (f *userFactory) Tx(tx *ent.Tx) *userFactory {\n\treturn f.Client(tx.Client())\n}", "func (m *Manager) Create(ctx context.Context, tx *sql.Tx, user v0.User) error {\n\t_, err := tx.ExecContext(ctx, `\n\t\t\t\tINSERT INTO users (\n\t\t\t\t\tname, \n\t\t\t\t\temail, \n\t\t\t\t\tprimary_public_key, \n\t\t\t\t\trecovery_public_key, \n\t\t\t\t\tsuper_user, \n\t\t\t\t\tauth_level, \n\t\t\t\t\tweight,\n\t\t\t\t\tuser_set\n\t\t\t\t\t) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,\n\t\tuser.Name,\n\t\tuser.Email,\n\t\tuser.PrimaryPublicKey,\n\t\tuser.RecoveryPublicKey,\n\t\tuser.SuperUser,\n\t\tuser.AuthLevel,\n\t\tuser.Weight,\n\t\tuser.Set,\n\t)\n\treturn err\n}", "func (ec *executionContext) _User(ctx context.Context, sel []query.Selection, obj *model.User) graphql.Marshaler {\n\tfields := graphql.CollectFields(ec.Doc, sel, userImplementors, ec.Variables)\n\n\tout := graphql.NewOrderedMap(len(fields))\n\tfor i, field := range fields {\n\t\tout.Keys[i] = field.Alias\n\n\t\tswitch field.Name {\n\t\tcase \"__typename\":\n\t\t\tout.Values[i] = graphql.MarshalString(\"User\")\n\t\tcase \"id\":\n\t\t\tout.Values[i] = ec._User_id(ctx, field, obj)\n\t\tcase \"username\":\n\t\t\tout.Values[i] = ec._User_username(ctx, field, obj)\n\t\tcase \"email\":\n\t\t\tout.Values[i] = ec._User_email(ctx, field, obj)\n\t\tcase \"displayName\":\n\t\t\tout.Values[i] = ec._User_displayName(ctx, field, obj)\n\t\tcase \"isDefault\":\n\t\t\tout.Values[i] = ec._User_isDefault(ctx, field, obj)\n\t\tcase \"profileImagePath\":\n\t\t\tout.Values[i] = ec._User_profileImagePath(ctx, field, obj)\n\t\tcase \"updatedAt\":\n\t\t\tout.Values[i] = ec._User_updatedAt(ctx, field, obj)\n\t\tcase \"blocked\":\n\t\t\tout.Values[i] = ec._User_blocked(ctx, field, obj)\n\t\tcase \"shadowbanned\":\n\t\t\tout.Values[i] = ec._User_shadowbanned(ctx, field, obj)\n\t\tcase \"possibleUninstall\":\n\t\t\tout.Values[i] = ec._User_possibleUninstall(ctx, field, obj)\n\t\tcase \"lastActiveAt\":\n\t\t\tout.Values[i] = ec._User_lastActiveAt(ctx, field, obj)\n\t\tcase \"joinedFromInvite\":\n\t\t\tout.Values[i] = ec._User_joinedFromInvite(ctx, field, obj)\n\t\tcase \"coinBalance\":\n\t\t\tout.Values[i] = ec._User_coinBalance(ctx, field, obj)\n\t\tcase \"temporaryCoinBalance\":\n\t\t\tout.Values[i] = ec._User_temporaryCoinBalance(ctx, field, obj)\n\t\tcase \"postCount\":\n\t\t\tout.Values[i] = ec._User_postCount(ctx, field, obj)\n\t\tcase \"engagement\":\n\t\t\tout.Values[i] = ec._User_engagement(ctx, field, obj)\n\t\tdefault:\n\t\t\tpanic(\"unknown field \" + strconv.Quote(field.Name))\n\t\t}\n\t}\n\n\treturn out\n}", "func (o *Transaction) User(exec boil.Executor, mods ...qm.QueryMod) userQuery {\n\tqueryMods := []qm.QueryMod{\n\t\tqm.Where(\"user_id=?\", o.UserID),\n\t}\n\n\tqueryMods = append(queryMods, mods...)\n\n\tquery := Users(exec, queryMods...)\n\tqueries.SetFrom(query.Query, \"`users`\")\n\n\treturn query\n}", "func (h *Handler) InsertUser(user models.User) (error){\n\n\thashedPassword, err := bcrypt.GenerateFromPassword([]byte(user.Password), 8)\n\n\tquery := fmt.Sprintf(\"insert into users (first_name, last_name, email, password) values ('%s', '%s', '%s', '%s');\", user.FirstName, user.LastName, user.Email, hashedPassword)\n\n\t_, err = h.DB.Exec(query)\n\tif err != nil {\n\t\tfmt.Printf(\"user_service-InsertUser-Exec: %s\\n\", err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func CreateUser(c *gin.Context) {}", "func init() {\n\tdatabaseModels = append(databaseModels, &models.User{})\n}", "func Example_transactions() {\n\tdb, _ := dbx.Open(\"mysql\", \"user:pass@/example\")\n\n\tdb.Transactional(func(tx *dbx.Tx) error {\n\t\t_, err := tx.Insert(\"user\", dbx.Params{\n\t\t\t\"name\": \"user1\",\n\t\t}).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = tx.Insert(\"user\", dbx.Params{\n\t\t\t\"name\": \"user2\",\n\t\t}).Execute()\n\t\treturn err\n\t})\n}", "func (user *User) BeforeCreate(transaction *gorm.DB) error {\n return nil\n}", "func (t *tx) AddUser(user *model.User) error {\n\t// FIXME: handle sql constraint errors\n\terr := t.Create(user).Error\n\n\treturn errors.Wrap(err, \"create user failed\")\n}", "func insertUser(db *sql.DB, u *User) {\n\n\t// name := u.name\n\t// rollno := u.rollno\n\tinsertUserSQL := `INSERT INTO User( name, rollno) VALUES (?, ?)`\n\tstatement, err := db.Prepare(insertUserSQL) \n\n\tif err != nil {\n\t\tlog.Fatalln(err.Error())\n\t}\n\t_, err = statement.Exec(u.name, u.rollno)\n\tif err != nil {\n\t\tlog.Fatalln(err.Error())\n\t}\n}", "func (us UserStorer) Save(schema *Schema, context *Context) (user User, userID aorm.ID, err error) {\n\tvar db = context.DB()\n\n\tif context.Auth.Config.UserModel != nil {\n\t\tcurrentUser := reflect.New(utils.ModelType(context.Auth.Config.UserModel)).Interface()\n\t\tcopier.Copy(currentUser, schema)\n\t\tif us.CreateFunc != nil {\n\t\t\terr = us.CreateFunc(context, currentUser)\n\t\t} else {\n\t\t\terr = db.Create(currentUser).Error\n\t\t}\n\t\treturn currentUser.(User), aorm.IdOf(currentUser), err\n\t}\n\treturn\n}", "func CreateUser(user model.User) {\n\tfmt.Println(user)\n}", "func Insert() error {\n\tuser := &TbUser{\n\t\tName: \"viney\",\n\t\tEmail: \"viney.chow@gmail.com\",\n\t\tCreated: time.Now().Format(\"2006-01-02 15:04:05\"),\n\t}\n\treturn orm.Save(user)\n}", "func registerUser() {\n\tgoes.Register(\n\t\t&User{},\n\t\tFirstNameUpdatedV1{},\n\t\tCreatedV1{},\n\t)\n}", "func init() {\n\torm.RegisterModel(new(User))\n}", "func (db *DataBase) Register(user *models.UserPrivateInfo) (userID int, err error) {\n\n\tvar (\n\t\ttx *sql.Tx\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, err = db.createPlayer(tx, user); err != nil {\n\t\treturn\n\t}\n\n\tif err = db.createRecords(tx, userID); err != nil {\n\t\treturn\n\t}\n\n\terr = tx.Commit()\n\treturn\n}", "func insertUser(user User) {\n\tcollection := client.Database(\"Go_task\").Collection(\"users\")\n\tinsertResult, err := collection.InsertOne(context.TODO(), user)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(\"Inserted user with ID:\", insertResult.InsertedID)\n}", "func (db Database) saveUser() error {\n\treturn makeError()\n}", "func SignUpUser(c *gin.Context) {\n\tvar db = models.InitDB()\n\tvar userData models.User\n\terr := c.Bind(&userData)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfmt.Println(userData)\n\tif err := db.Create(&userData).Error; err != nil {\n\t\tc.JSON(200, gin.H{\n\t\t\t\"creation\": \"false\",\n\t\t})\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\n\t\t\"creation\": \"true\",\n\t})\n}", "func AddUser(user *e.User) error {\n\treturn db.DB.Transaction(func(tx *gorm.DB) error {\n\t\tif err := tx.Create(&user).Error; err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif user.Type == \"talent\" {\n\t\t\ttx.Create(&e.Talent{\n\t\t\t\tUserID: user.ID,\n\t\t\t\tIsVerified: false,\n\t\t\t})\n\t\t}\n\t\tif user.Type == \"company\" {\n\t\t\ttx.Create(&e.Company{\n\t\t\t\tUserID: user.ID,\n\t\t\t\tName: user.Name,\n\t\t\t\tIsUpdated: false,\n\t\t\t})\n\t\t}\n\t\treturn nil\n\t})\n}", "func (persist *Persister) createUserTable() {\n\n\tvar dbaser = persist.databaser\n\n\tdb, err := sql.Open(dbaser.Driver(), dbaser.Name())\n\tif err != nil {\n\t\tfmt.Println(\"Error on open of database\", err)\n\t\treturn\n\t}\n\tdefer db.Close()\n\n\tvar query = fmt.Sprintf(\n\t\tcreateUserTable,\n\t\tdbaser.IncrementPrimaryKey(),\n\t\tdbaser.DateField())\n\n\t_, err = db.Exec(query)\n\tif err != nil {\n\t\tfmt.Printf(\"Error creating Users table, driver \\\"%s\\\", dbname \\\"%s\\\", query = \\\"%s\\\"\\n\",\n\t\t\tdbaser.Driver(), dbaser.Name(), query)\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n}", "func (u *User) Register(ctx context.Context, user model.User) (*model.User, error) {\n\tspan, _ := jtrace.Tracer.SpanFromContext(ctx, \"register_user\")\n\tdefer span.Finish()\n\tspan.SetTag(\"register\", \"register user model\")\n\n\ttx := mysql.Storage.GetDatabase().Begin()\n\n\tif err := tx.Create(&user).Error; err != nil {\n\t\tlog := logger.GetZapLogger(false)\n\t\tlogger.Prepare(log).\n\t\t\tAppend(zap.Any(\"error\", fmt.Sprintf(\"register user: %s\", err))).\n\t\t\tLevel(zap.ErrorLevel).\n\t\t\tDevelopment().\n\t\t\tCommit(\"env\")\n\t\ttx.Rollback()\n\t\treturn nil, err\n\t}\n\tdefer tx.Commit()\n\n\treturn &user, nil\n}", "func (ua *UserAuth) User(ctx context.Context, db XODB) (*User, error) {\n\treturn UserByUserID(ctx, db, ua.UserID)\n}", "func (s *UserRepository) User(id string) (*akwad.Account, error) {\n\n\treturn nil, nil\n}", "func (userRepo *mockUserRepo) Initialize(ctx context.Context, db *sql.DB) {}", "func setUser(ctx context.Context, data *User) error {\n\t// clear session_token and API_token for user\n\tk := datastore.NameKey(\"Users\", strings.ToLower(data.Username), nil)\n\n\t// New struct, to not add body, author etc\n\n\tif _, err := dbclient.Put(ctx, k, data); err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (d *PostgresDatabase) Store(u model.User) error {\n\topMetric.WithLabelValues(\"store-user\").Inc()\n\n\tostart := time.Now()\n\tdefer opDuration.WithLabelValues(\"store-user\").Observe(time.Since(ostart).Seconds())\n\n\tdob, err := time.Parse(\"2006-01-02\", u.DOB)\n\tif err != nil {\n\t\topErrMetric.WithLabelValues(\"store-user\").Inc()\n\t\treturn err\n\t}\n\t_, err = d.Get(u.Username)\n\t// if the user is not present we insert\n\tif err == ErrUserNotFound {\n\t\t_, err := d.db.Query(queryInsertUser, u.Username, dob)\n\t\tif err != nil {\n\t\t\topErrMetric.WithLabelValues(\"store-user\").Inc()\n\t\t\treturn err\n\t\t}\n\t\topMetric.WithLabelValues(\"store-user\").Inc()\n\t\treturn nil\n\t} else if err != nil {\n\t\topErrMetric.WithLabelValues(\"store-user\").Inc()\n\t\treturn err\n\t}\n\n\t// if we got here, the user is already present and we should do an update\n\tstmt, err := d.db.Prepare(queryUpdateUser)\n\t_, err = stmt.Exec(dob, u.Username)\n\tif err != nil {\n\t\topErrMetric.WithLabelValues(\"store-user\").Inc()\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *XPackSecurityPutUserService) User(user *XPackSecurityPutUserRequest) *XPackSecurityPutUserService {\n\ts.user = user\n\treturn s\n}", "func (db *UserDatabase) Init() error {\n\tvar err error\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, stmt := range schemaV1 {\n\t\tlog.Println(stmt)\n\t\ttx.MustExec(stmt)\n\t}\n\tdefaultPassword := getDefaultPassword()\n\t_, err = tx.CreateUser(claudia.ApplicationAdminUsername, defaultPassword)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsessionAuthKey := securecookie.GenerateRandomKey(32)\n\tsessionCryptKey := securecookie.GenerateRandomKey(32)\n\tcrt, key := util.GenerateSelfSignedCert()\n\ttx.MustExec(\"INSERT INTO configuration (schema_version, session_auth_key, session_crypt_key, private_key, public_certificate) VALUES ($1, $2, $3, $4, $5)\",\n\t\tSchemaVersion, sessionAuthKey, sessionCryptKey, key, crt)\n\ttx.Commit()\n\ttx, err = db.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\tconf, err := tx.GetConfiguration()\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn err\n\t}\n\ttx.Commit()\n\tlog.Printf(\"Successfully initialized database (schema: %d)\", conf.SchemaVersion)\n\treturn nil\n}", "func init() {\n\tuserFields := schema.User{}.Fields()\n\t_ = userFields\n\t// userDescUserName is the schema descriptor for user_name field.\n\tuserDescUserName := userFields[0].Descriptor()\n\t// user.DefaultUserName holds the default value on creation for the user_name field.\n\tuser.DefaultUserName = userDescUserName.Default.(string)\n\t// userDescEmail is the schema descriptor for email field.\n\tuserDescEmail := userFields[1].Descriptor()\n\t// user.DefaultEmail holds the default value on creation for the email field.\n\tuser.DefaultEmail = userDescEmail.Default.(string)\n\t// userDescTelNum is the schema descriptor for tel_num field.\n\tuserDescTelNum := userFields[2].Descriptor()\n\t// user.DefaultTelNum holds the default value on creation for the tel_num field.\n\tuser.DefaultTelNum = userDescTelNum.Default.(string)\n\t// userDescPassword is the schema descriptor for password field.\n\tuserDescPassword := userFields[3].Descriptor()\n\t// user.DefaultPassword holds the default value on creation for the password field.\n\tuser.DefaultPassword = userDescPassword.Default.(string)\n\t// userDescPasswordStr is the schema descriptor for password_str field.\n\tuserDescPasswordStr := userFields[4].Descriptor()\n\t// user.DefaultPasswordStr holds the default value on creation for the password_str field.\n\tuser.DefaultPasswordStr = userDescPasswordStr.Default.(string)\n\t// userDescRegType is the schema descriptor for reg_type field.\n\tuserDescRegType := userFields[5].Descriptor()\n\t// user.DefaultRegType holds the default value on creation for the reg_type field.\n\tuser.DefaultRegType = userDescRegType.Default.(int8)\n\t// userDescRegisterIP is the schema descriptor for register_ip field.\n\tuserDescRegisterIP := userFields[7].Descriptor()\n\t// user.DefaultRegisterIP holds the default value on creation for the register_ip field.\n\tuser.DefaultRegisterIP = userDescRegisterIP.Default.(int)\n\t// userDescTelStatus is the schema descriptor for tel_status field.\n\tuserDescTelStatus := userFields[8].Descriptor()\n\t// user.DefaultTelStatus holds the default value on creation for the tel_status field.\n\tuser.DefaultTelStatus = userDescTelStatus.Default.(int8)\n\t// userDescStatus is the schema descriptor for status field.\n\tuserDescStatus := userFields[9].Descriptor()\n\t// user.DefaultStatus holds the default value on creation for the status field.\n\tuser.DefaultStatus = userDescStatus.Default.(int8)\n\t// userDescCreatedAt is the schema descriptor for created_at field.\n\tuserDescCreatedAt := userFields[10].Descriptor()\n\t// user.DefaultCreatedAt holds the default value on creation for the created_at field.\n\tuser.DefaultCreatedAt = userDescCreatedAt.Default.(func() time.Time)\n\tuserextendFields := schema.UserExtend{}.Fields()\n\t_ = userextendFields\n\t// userextendDescRealName is the schema descriptor for real_name field.\n\tuserextendDescRealName := userextendFields[1].Descriptor()\n\t// userextend.DefaultRealName holds the default value on creation for the real_name field.\n\tuserextend.DefaultRealName = userextendDescRealName.Default.(string)\n\t// userextendDescIDNumber is the schema descriptor for id_number field.\n\tuserextendDescIDNumber := userextendFields[2].Descriptor()\n\t// userextend.DefaultIDNumber holds the default value on creation for the id_number field.\n\tuserextend.DefaultIDNumber = userextendDescIDNumber.Default.(string)\n\t// userextendDescAge is the schema descriptor for age field.\n\tuserextendDescAge := userextendFields[3].Descriptor()\n\t// userextend.DefaultAge holds the default value on creation for the age field.\n\tuserextend.DefaultAge = userextendDescAge.Default.(int8)\n\t// userextendDescSex is the schema descriptor for sex field.\n\tuserextendDescSex := userextendFields[4].Descriptor()\n\t// userextend.DefaultSex holds the default value on creation for the sex field.\n\tuserextend.DefaultSex = userextendDescSex.Default.(int8)\n\t// userextendDescBirth is the schema descriptor for birth field.\n\tuserextendDescBirth := userextendFields[5].Descriptor()\n\t// userextend.DefaultBirth holds the default value on creation for the birth field.\n\tuserextend.DefaultBirth = userextendDescBirth.Default.(int)\n\t// userextendDescIcon is the schema descriptor for icon field.\n\tuserextendDescIcon := userextendFields[6].Descriptor()\n\t// userextend.DefaultIcon holds the default value on creation for the icon field.\n\tuserextend.DefaultIcon = userextendDescIcon.Default.(string)\n\t// userextendDescNickName is the schema descriptor for nick_name field.\n\tuserextendDescNickName := userextendFields[7].Descriptor()\n\t// userextend.DefaultNickName holds the default value on creation for the nick_name field.\n\tuserextend.DefaultNickName = userextendDescNickName.Default.(string)\n\t// userextendDescImei is the schema descriptor for imei field.\n\tuserextendDescImei := userextendFields[8].Descriptor()\n\t// userextend.DefaultImei holds the default value on creation for the imei field.\n\tuserextend.DefaultImei = userextendDescImei.Default.(string)\n\t// userextendDescOaid is the schema descriptor for oaid field.\n\tuserextendDescOaid := userextendFields[9].Descriptor()\n\t// userextend.DefaultOaid holds the default value on creation for the oaid field.\n\tuserextend.DefaultOaid = userextendDescOaid.Default.(string)\n\t// userextendDescDeviceID is the schema descriptor for device_id field.\n\tuserextendDescDeviceID := userextendFields[10].Descriptor()\n\t// userextend.DefaultDeviceID holds the default value on creation for the device_id field.\n\tuserextend.DefaultDeviceID = userextendDescDeviceID.Default.(string)\n\t// userextendDescSystemName is the schema descriptor for system_name field.\n\tuserextendDescSystemName := userextendFields[11].Descriptor()\n\t// userextend.DefaultSystemName holds the default value on creation for the system_name field.\n\tuserextend.DefaultSystemName = userextendDescSystemName.Default.(string)\n\t// userextendDescSystemVersion is the schema descriptor for system_version field.\n\tuserextendDescSystemVersion := userextendFields[12].Descriptor()\n\t// userextend.DefaultSystemVersion holds the default value on creation for the system_version field.\n\tuserextend.DefaultSystemVersion = userextendDescSystemVersion.Default.(string)\n\t// userextendDescAdid is the schema descriptor for adid field.\n\tuserextendDescAdid := userextendFields[13].Descriptor()\n\t// userextend.DefaultAdid holds the default value on creation for the adid field.\n\tuserextend.DefaultAdid = userextendDescAdid.Default.(string)\n\t// userextendDescGameID is the schema descriptor for game_id field.\n\tuserextendDescGameID := userextendFields[14].Descriptor()\n\t// userextend.DefaultGameID holds the default value on creation for the game_id field.\n\tuserextend.DefaultGameID = userextendDescGameID.Default.(string)\n\t// userextendDescThirdPlatformID is the schema descriptor for third_platform_id field.\n\tuserextendDescThirdPlatformID := userextendFields[15].Descriptor()\n\t// userextend.DefaultThirdPlatformID holds the default value on creation for the third_platform_id field.\n\tuserextend.DefaultThirdPlatformID = userextendDescThirdPlatformID.Default.(int8)\n\t// userextendDescCreatedAt is the schema descriptor for created_at field.\n\tuserextendDescCreatedAt := userextendFields[16].Descriptor()\n\t// userextend.DefaultCreatedAt holds the default value on creation for the created_at field.\n\tuserextend.DefaultCreatedAt = userextendDescCreatedAt.Default.(func() time.Time)\n}", "func (mgr *UserMgr) InsertUser(user *User) {\n\tuser.Password = HashPassword(user.Password)\n\tsql := \"INSERT INTO users (username, email, password, role) VALUES (:username, :email, :password, :role)\"\n\t_, err := mgr.db.NamedExec(sql, user)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func (s *BasePlSqlParserListener) EnterCreate_user(ctx *Create_userContext) {}", "func (m *mysqlUserRepository) Store(u *domain.User) (err error) {\n\tquery := `INSERT INTO user SET name=?, email=?, password=?, updated_at=?, created_at, deleted_at`\n\n\tstmt, err := m.Conn.Prepare(query)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tres, err := stmt.Exec(u.Name, u.Email, u.Password, time.Now(), nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tlastID, err := res.LastInsertId()\n\tif err != nil {\n\t\treturn\n\t}\n\tu.ID = lastID\n\treturn\n\n}", "func init() {\n\tuserFields := schema.User{}.Fields()\n\t_ = userFields\n\t// userDescApikey is the schema descriptor for apikey field.\n\tuserDescApikey := userFields[5].Descriptor()\n\t// user.DefaultApikey holds the default value on creation for the apikey field.\n\tuser.DefaultApikey = userDescApikey.Default.(func() uuid.UUID)\n\t// userDescActivated is the schema descriptor for activated field.\n\tuserDescActivated := userFields[8].Descriptor()\n\t// user.DefaultActivated holds the default value on creation for the activated field.\n\tuser.DefaultActivated = userDescActivated.Default.(bool)\n\t// userDescLocked is the schema descriptor for locked field.\n\tuserDescLocked := userFields[9].Descriptor()\n\t// user.DefaultLocked holds the default value on creation for the locked field.\n\tuser.DefaultLocked = userDescLocked.Default.(bool)\n\t// userDescUpdatedAt is the schema descriptor for updated_at field.\n\tuserDescUpdatedAt := userFields[10].Descriptor()\n\t// user.DefaultUpdatedAt holds the default value on creation for the updated_at field.\n\tuser.DefaultUpdatedAt = userDescUpdatedAt.Default.(func() time.Time)\n\t// userDescCreatedAt is the schema descriptor for created_at field.\n\tuserDescCreatedAt := userFields[11].Descriptor()\n\t// user.DefaultCreatedAt holds the default value on creation for the created_at field.\n\tuser.DefaultCreatedAt = userDescCreatedAt.Default.(func() time.Time)\n\t// userDescID is the schema descriptor for id field.\n\tuserDescID := userFields[0].Descriptor()\n\t// user.DefaultID holds the default value on creation for the id field.\n\tuser.DefaultID = userDescID.Default.(func() uuid.UUID)\n}", "func (usr *UserAuth) createUserTable(cfg *config.CfgService) (err error) {\n\tuserSchema := []string{\n\t\t\"username TEXT\",\n\t\t\"password TEXT\",\n\t\t\"isAdmin INTEGER\",\n\t\t\"loggedIn INTEGER\",\n\t\t\"ccNumber INTEGER\",\n\t\t\"ccExpiryMonth INTEGER\",\n\t\t\"ccExpiryYear INTEGER\",\n\t\t\"cvv INTEGER\",\n\t\t\"cardName TEXT\"}\n\n\tuserDefaultAdmin := map[string]string{\n\t\t\"username\": \"'admin'\",\n\t\t\"password\": \"'admin'\",\n\t\t\"isAdmin\": \"1\",\n\t\t\"loggedIn\": \"0\",\n\t\t\"ccNumber\": \"\",\n\t\t\"ccExpiryMonth\": \"0\",\n\t\t\"ccExpiryYear\": \"0\",\n\t\t\"cvv\": \"0\",\n\t\t\"cardName\": \"\"}\n\n\tuserDefault := map[string]string{\n\t\t\"username\": \"'user'\",\n\t\t\"password\": \"'user'\",\n\t\t\"isAdmin\": \"0\",\n\t\t\"loggedIn\": \"0\",\n\t\t\"ccNumber\": \"\",\n\t\t\"ccExpiryMonth\": \"0\",\n\t\t\"ccExpiryYear\": \"0\",\n\t\t\"cvv\": \"0\",\n\t\t\"cardName\": \"\"}\n\n\terr = cfg.CreateTable(usr.Name, userSchema)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = cfg.InitUser(usr.Name, userDefaultAdmin, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = cfg.InitUser(usr.Name, userDefault, 1)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\treturn nil\n}", "func InsertUser(u User, t string) {\n\t// Begin transaction\n\ttx, err := globals.Db.Begin()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer tx.Rollback()\n\n\t// Prepare user insertion and execute\n\tstmt, err := tx.Prepare(\"INSERT INTO tblUsers(fldFirstName, fldLastName, fldEmail, fldPassword) VALUES (?, ?, ?, ?)\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer stmt.Close()\n\n\tres, err := stmt.Exec(u.FirstName, u.LastName, u.Email, u.Password)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Get the last inserted row's ID\n\tlastID, err := res.LastInsertId()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Prepare token insertion and execute\n\tstmt, err = tx.Prepare(\"INSERT INTO tblActivationTokens (fldToken,fldFKUserID) VALUES (?, ?)\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tres, err = stmt.Exec(t, lastID)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Commit query\n\terr = tx.Commit()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func GetUser() {\n\tvar user User\n\terr := orm.NewOrm().QueryTable(\"t_user\").Filter(\"Id\", 5).One(&user)\n\tif err == nil {\n\t\tfmt.Println(user.ToString())\n\t}\n}", "func (s *BasePlSqlParserListener) EnterAlter_user(ctx *Alter_userContext) {}", "func createSchema(db *pg.DB) (err error) {\n\t// db.AddQueryHook(dbLogger{})\n\n\trefresh := false\n\n\tmodels := []interface{}{\n\t\t&structs.User{},\n\t\t&structs.Project{},\n\t\t&structs.Webhook{},\n\t\t&structs.IssueEntry{},\n\t\t&structs.Comment{},\n\t\t&structs.InviteCode{},\n\t}\n\n\tfor _, model := range models {\n\t\tif refresh {\n\t\t\tdb.Model(model).DropTable(&orm.DropTableOptions{\n\t\t\t\tIfExists: true,\n\t\t\t\tCascade: true,\n\t\t\t})\n\t\t}\n\n\t\terr = db.Model(model).CreateTable(&orm.CreateTableOptions{\n\t\t\tIfNotExists: true,\n\t\t})\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\tif refresh {\n\t\tidGen := idgenerator.NewIDGenerator(1602507674941, 0)\n\n\t\tprintln(\"Create User\")\n\t\tuser := &structs.User{\n\t\t\tID: idGen.GenerateID(),\n\t\t\tName: \"ImRock\",\n\t\t\tAvatar: \"https://cdn.discordapp.com/avatars/143090142360371200/a_70444022ea3e5d73dd00d59c5578b07e.gif?size=1024\",\n\t\t\tUserType: structs.DiscordUser,\n\t\t\tHookID: 143090142360371200,\n\t\t\tProjectIDs: make([]int64, 0),\n\t\t\tIntegration: false,\n\t\t}\n\n\t\t_, err = db.Model(user).Insert()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Create second user\")\n\t\tuser2 := &structs.User{\n\t\t\tID: idGen.GenerateID(),\n\t\t\tName: \"biscuitcord\",\n\t\t\tAvatar: \"https://cdn.discordapp.com/avatars/164297154276360192/4c8f9b0310948cce460613081d074a13.webp?size=1024\",\n\t\t\tUserType: structs.DiscordUser,\n\t\t\tHookID: 164297154276360192,\n\t\t\tProjectIDs: make([]int64, 0),\n\t\t\tIntegration: false,\n\t\t}\n\t\t_, err = db.Model(user2).Insert()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Create Project\")\n\t\tproject := &structs.Project{\n\t\t\tID: idGen.GenerateID(),\n\n\t\t\tCreatedAt: time.Now().UTC(),\n\t\t\tCreatedByID: user.ID,\n\n\t\t\tIntegrations: make([]*structs.User, 0),\n\t\t\tWebhooks: make([]*structs.Webhook, 0),\n\n\t\t\tSettings: structs.ProjectSettings{\n\t\t\t\tDisplayName: \"Welcomer\",\n\t\t\t\tURL: \"https://welcomer.gg\",\n\t\t\t\tArchived: false,\n\t\t\t\tPrivate: false,\n\t\t\t\tLimited: false,\n\t\t\t},\n\n\t\t\tStarredIssues: 0,\n\t\t\tOpenIssues: 0,\n\t\t\tActiveIssues: 0,\n\t\t\tResolvedIssues: 0,\n\t\t}\n\t\t_, err = db.Model(project).Insert()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tprintln(\"Add project to user\")\n\t\tuser.ProjectIDs = append(user.ProjectIDs, project.ID)\n\t\t_, err = db.Model(user).WherePK().Update()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Add project to user 2\")\n\t\tuser2.ProjectIDs = append(user2.ProjectIDs, project.ID)\n\t\t_, err = db.Model(user).WherePK().Update()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Add second user to contributors\")\n\t\tproject.Settings.ContributorIDs = append(project.Settings.ContributorIDs, user2.ID)\n\t\t_, err = db.Model(project).WherePK().Update()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Create Webhooks\")\n\t\twebhook := &structs.Webhook{\n\t\t\tID: idGen.GenerateID(),\n\t\t\tProjectID: project.ID,\n\t\t\tActive: false,\n\t\t\tFailures: 16,\n\t\t\tCreatedAt: time.Now().UTC(),\n\t\t\tCreatedByID: user.ID,\n\t\t\tURL: \"https://welcomer.gg/webhook\",\n\t\t\tType: structs.DiscordWebhook,\n\t\t\tJSONContent: true,\n\t\t\tSecret: \"\",\n\t\t}\n\t\t_, err = db.Model(webhook).Insert()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Create Integration\")\n\t\tintegration := &structs.User{\n\t\t\tID: idGen.GenerateID(),\n\t\t\tName: \"Welcomer\",\n\n\t\t\tUserType: structs.IntegrationUser,\n\n\t\t\tCreatedAt: time.Now().UTC(),\n\n\t\t\tProjectID: project.ID,\n\t\t\tIntegration: true,\n\t\t\tCreatedByID: user.ID,\n\t\t}\n\t\t_, err = db.Model(integration).Insert()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Create user issue\")\n\t\tnow := time.Now().UTC()\n\t\tissue := &structs.IssueEntry{\n\t\t\tID: idGen.GenerateID(),\n\t\t\tProjectID: project.ID,\n\n\t\t\tStarred: false,\n\n\t\t\tType: structs.EntryOpen,\n\t\t\tOccurrences: 1,\n\t\t\tAssigneeID: 0,\n\n\t\t\tError: \"genericError\",\n\t\t\tFunction: \"createSchema(db *pg.DB)\",\n\t\t\tCheckpoint: \"internal/api.go:147\",\n\t\t\tDescription: \"\",\n\t\t\tTraceback: \"\",\n\n\t\t\tLastModified: now,\n\n\t\t\tCreatedAt: now,\n\t\t\tCreatedByID: user.ID,\n\n\t\t\tCommentCount: 0,\n\t\t\tCommentsLocked: false,\n\t\t}\n\t\t_, err = db.Model(issue).Insert()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Increment project issue counter\")\n\t\tproject.OpenIssues++\n\t\t_, err = db.Model(project).WherePK().Update()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Create user issue 2\")\n\t\tnow = time.Now().UTC()\n\t\tissue2 := &structs.IssueEntry{\n\t\t\tID: idGen.GenerateID(),\n\t\t\tProjectID: project.ID,\n\n\t\t\tStarred: false,\n\n\t\t\tType: structs.EntryOpen,\n\t\t\tOccurrences: 5,\n\t\t\tAssigneeID: user.ID,\n\n\t\t\tError: \"panic:\",\n\t\t\tFunction: \"main.main.func1\",\n\t\t\tCheckpoint: \"main.go:11\",\n\t\t\tDescription: \"\",\n\t\t\tTraceback: \"stacktrace from panic: \\ngoroutine 1 [running]:\\nruntime/debug.Stack(0x1042ff18, 0x98b2, 0xf0ba0, 0x17d048)\\n /usr/local/go/src/runtime/debug/stack.go:24 +0xc0\\nmain.main.func1()\\n /tmp/sandbox973508195/main.go:11 +0x60\\npanic(0xf0ba0, 0x17d048)\\n /usr/local/go/src/runtime/panic.go:502 +0x2c0\\nmain.main()\\n /tmp/sandbox973508195/main.go:16 +0x60\",\n\n\t\t\tLastModified: now,\n\n\t\t\tCreatedAt: now,\n\t\t\tCreatedByID: user2.ID,\n\n\t\t\tCommentCount: 0,\n\t\t\tCommentsLocked: false,\n\t\t}\n\t\t_, err = db.Model(issue2).Insert()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Increment project issue counter\")\n\t\tproject.OpenIssues++\n\t\t_, err = db.Model(project).WherePK().Update()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Create integration issue\")\n\t\tnow = time.Now().UTC()\n\t\tissue3 := &structs.IssueEntry{\n\t\t\tID: idGen.GenerateID(),\n\t\t\tProjectID: project.ID,\n\n\t\t\tStarred: false,\n\n\t\t\tType: structs.EntryOpen,\n\t\t\tOccurrences: 1,\n\t\t\tAssigneeID: user2.ID,\n\n\t\t\tError: \"TypeError\",\n\t\t\tFunction: \"\",\n\t\t\tCheckpoint: \"\",\n\t\t\tDescription: \"can only concatenate str (not \\\"int\\\") to str\",\n\t\t\tTraceback: \"Traceback (most recent call last):\\n File \\\"<stdin>\\\", line 1, in <module>\\n File \\\"<stdin>\\\", line 2, in a\\nTypeError: can only concatenate str (not \\\"int\\\") to str\",\n\n\t\t\tLastModified: now,\n\n\t\t\tCreatedAt: now,\n\t\t\tCreatedByID: integration.ID,\n\n\t\t\tCommentCount: 0,\n\t\t\tCommentsLocked: false,\n\t\t}\n\t\t_, err = db.Model(issue3).Insert()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Increment project issue counter\")\n\t\tproject.OpenIssues++\n\t\t_, err = db.Model(project).WherePK().Update()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Create user issue comment\")\n\t\tcontent := \"Test :)\"\n\t\tcomment := &structs.Comment{\n\t\t\tID: idGen.GenerateID(),\n\t\t\tIssueID: issue.ID,\n\n\t\t\tCreatedAt: time.Now().UTC(),\n\t\t\tCreatedByID: user2.ID,\n\n\t\t\tType: structs.Message,\n\t\t\tContent: &content,\n\t\t}\n\t\t_, err = db.Model(comment).Insert()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tissue.CommentCount++\n\n\t\tprintln(\"Create user issue comment2\")\n\t\topen := structs.EntryOpen\n\t\tcomment2 := &structs.Comment{\n\t\t\tID: idGen.GenerateID(),\n\t\t\tIssueID: issue.ID,\n\n\t\t\tCreatedAt: time.Now().UTC(),\n\t\t\tCreatedByID: user2.ID,\n\n\t\t\tType: structs.IssueMarked,\n\t\t\tIssueMarked: &open,\n\t\t}\n\t\t_, err = db.Model(comment2).Insert()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tissue.CommentCount++\n\n\t\tprintln(\"Create user issue comment3\")\n\t\topened := true\n\t\tcomment3 := &structs.Comment{\n\t\t\tID: idGen.GenerateID(),\n\t\t\tIssueID: issue.ID,\n\n\t\t\tCreatedAt: time.Now().UTC(),\n\t\t\tCreatedByID: user.ID,\n\n\t\t\tType: structs.CommentsLocked,\n\t\t\tCommentsOpened: &opened,\n\t\t}\n\t\t_, err = db.Model(comment3).Insert()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tissue.CommentCount++\n\n\t\tprintln(\"Update issue comment count\")\n\t\t_, err = db.Model(issue).WherePK().Update()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Create user 2 issue comment\")\n\t\tcomment4 := &structs.Comment{\n\t\t\tID: idGen.GenerateID(),\n\t\t\tIssueID: issue2.ID,\n\n\t\t\tCreatedAt: time.Now().UTC(),\n\t\t\tCreatedByID: user.ID,\n\n\t\t\tType: structs.CommentsLocked,\n\t\t\tCommentsOpened: &opened,\n\t\t}\n\t\t_, err = db.Model(comment4).Insert()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Update issue2 comment count\")\n\t\tissue2.CommentCount++\n\t\t_, err = db.Model(issue2).WherePK().Update()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Star user issue\")\n\t\tissue2.Starred = true\n\t\t_, err = db.Model(issue2).WherePK().Update()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Update project stars\")\n\t\tproject.StarredIssues++\n\t\t_, err = db.Model(project).WherePK().Update()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Close integration issue\")\n\t\tissue3.Type = structs.EntryResolved\n\t\tissue3.LastModified = time.Now().UTC()\n\t\t_, err = db.Model(issue3).WherePK().Update()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Update project issue counter\")\n\t\tproject.ResolvedIssues++\n\t\tproject.OpenIssues--\n\t\t_, err = db.Model(project).WherePK().Update()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tprintln(\"Create close integration issue comment\")\n\t\tresolved := structs.EntryResolved\n\t\tcomment5 := &structs.Comment{\n\t\t\tID: idGen.GenerateID(),\n\t\t\tIssueID: issue3.ID,\n\n\t\t\tCreatedAt: time.Now().UTC(),\n\t\t\tCreatedByID: user.ID,\n\n\t\t\tType: structs.IssueMarked,\n\t\t\tIssueMarked: &resolved,\n\t\t}\n\t\t_, err = db.Model(comment5).Insert()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (userRepo *PostUserRepository) StoreUser(u entity.User) error {\n\n\t_, err := userRepo.conn.Exec(\"INSERT INTO users (firstname,lastname,email,password)\"+\n\t\t\" values($1, $2, $3, $4)\", u.FirstName, u.LastName, u.Email, u.Password)\n\n\tif err != nil {\n\t\t//panic(err)\n\t\treturn errors.New(\"Insertion has failed\")\n\t}\n\n\treturn nil\n}", "func (ur *UserGormRepo) StoreUser(user *entity.User) (*entity.User, []error) {\n\tusr := user\n\tusr.Password,_ = handler.HashPassword(user.Password)\n\terrs := ur.conn.Create(usr).GetErrors()\n\n\tfor _, err := range errs {\n\t\tpqerr := err.(*pq.Error)\n\t\tfmt.Println(pqerr)\n\t}\n\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\n\treturn usr, nil\n}", "func (user *User) Save() error {\n\tif user.RegistrationDate.IsZero() {\n\t\tuser.RegistrationDate = time.Now()\n\t}\n\tvar q *ara.Query\n\tif user.Key == nil {\n\t\trd, _ := user.RegistrationDate.MarshalJSON()\n\t\tq = ara.NewQuery(`INSERT {\n\t\t\t\tUsername: %q,\n\t\t\t\tEmail: %q,\n\t\t\t\tPassword: %q,\n\t\t\t\tAge: %d,\n\t\t\t\tGender: %q,\n\t\t\t\tLikes: %q,\n\t\t\t\tMeets: %q,\n\t\t\t\tRegistrationDate: %s\n\t\t\t} IN users`,\n\t\t\tuser.Username,\n\t\t\tuser.Email,\n\t\t\tuser.Password,\n\t\t\tuser.Age,\n\t\t\tuser.Gender,\n\t\t\tuser.Likes,\n\t\t\tuser.Meets,\n\t\t\trd,\n\t\t\t)\n\n\t} else {\n\t\tq = ara.NewQuery(`UPDATE %q WITH {\n\t\t\t\tUsername: %q,\n\t\t\t\tEmail: %q,\n\t\t\t\tPassword: %q,\n\t\t\t\tAge: %d,\n\t\t\t\tGender: %q,\n\t\t\t\tLikes: %q,\n\t\t\t\tMeets: %q\n\t\t\t} IN users`,\n\t\t\t*user.Key,\n\t\t\tuser.Username,\n\t\t\tuser.Email,\n\t\t\tuser.Password,\n\t\t\tuser.Age,\n\t\t\tuser.Gender,\n\t\t\tuser.Likes,\n\t\t\tuser.Meets,\n\t\t\t)\n\t}\n\tlog.Println(q)\n\t_, err := db.Run(q)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\tvar users []User\n\tq = ara.NewQuery(`FOR user IN users FILTER user.Username == %q RETURN user`, user.Username).Cache(true).BatchSize(500)\n\tresp, err := db.Run(q)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\tlog.Println(string(resp))\n\terr = json.Unmarshal(resp, &users)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\tlog.Println(users)\n\tif len(users) > 0 {\n\t\t*user = users[0]\n\t\treturn nil\n\t}\n\treturn errors.New(\"prout\")\n}", "func (_UserCrud *UserCrudTransactorSession) InsertUser(userAddress common.Address, userEmail string, userAge *big.Int) (*types.Transaction, error) {\n\treturn _UserCrud.Contract.InsertUser(&_UserCrud.TransactOpts, userAddress, userEmail, userAge)\n}", "func CreateUser(user *User) error {\n\n //Validate fields\n\n //Username must be between 3 and 20 alphanumeric characters\n invalidCharsRegex := regexp.MustCompile(\"[^A-Za-z0-9]+\")\n if len(user.Username) < 3 || len(user.Username) > 20 || invalidCharsRegex.MatchString(user.Username) {\n return errors.New(\"username must be 3 to 20 alphanumeric characters\") \n }\n\n //Passwords must be at least 8 characters\n if len(user.Password) < 8 {\n return errors.New(\"password must be at least 8 characters\")\n }\n\n db, err := bolt.Open(DB_NAME, 0600, nil)\n if err != nil {\n panic(err)\n }\n defer db.Close()\n\n err = db.Update(func(tx *bolt.Tx) error {\n\n b := tx.Bucket([]byte(USER_BUCKET))\n\n //ensure username is not taken\n v := b.Get([]byte(user.Username))\n if v != nil {\n return errors.New(\"username already taken\")\n }\n\n // generate UUID that never changes for this user.\n user.ID = uuid.New().String()\n\n // hash password (NOTE this will modify the user object passed in)\n user.Password = hashPassword(user.Password)\n\n // encode to JSON\n encoded, err := json.Marshal(user)\n if err != nil {\n return err\n }\n\n // put in database\n err = b.Put([]byte(user.Username), encoded)\n\n return err //nil implies commit transaction, otherwise rollback\n })\n\n return err\n}", "func (s *CreateUserEndpoint) saveToDB(user *User) (int, error) {\n\t// implementation removed\n\treturn 0, nil\n}", "func (ur *UserGormRepo) User(user *entity.User) (*entity.User, []error) {\n\tlgusr := user\n\tusr := entity.User{}\n\terrs := ur.conn.Where(\"email = ?\", user.Email).First(&usr).GetErrors()\n\terr := bcrypt.CompareHashAndPassword([]byte(usr.Password), []byte(lgusr.Password))\n\tfmt.Println(err)\n\tif err != nil {\n\t\treturn nil, []error{err}\n\t}\n\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\n\treturn &usr, nil\n}", "func (tx *txDriver) Tx(context.Context) (dialect.Tx, error) { return tx, nil }", "func (tx *txDriver) Tx(context.Context) (dialect.Tx, error) { return tx, nil }", "func init() {\n\tuserHooks := schema.User{}.Hooks()\n\tuser.Hooks[0] = userHooks[0]\n\tuser.Hooks[1] = userHooks[1]\n}", "func Init() {\n\tdb, err = gorm.Open(\"postgres\", \"host=db port=5432 user=LikeTwitterApp-backend dbname=LikeTwitterApp-backend password=LikeTwitterApp-backend sslmode=disable\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tautoMigration()\n\tuser := models.User{\n\t\tID: 1,\n\t\tName: \"aoki\",\n\t\tPosts: []models.Post{{ID: 1, Content: \"tweet1\"}, {ID: 2, Content: \"tweet2\"}},\n\t}\n\tdb.Create(&user)\n}", "func (u *User) StoreUser() error {\n\terr := database.DB.Create(&u).Error\n\treturn err\n}", "func main() {\n\tdb, err := db.OpenConnection()\n\tdb.LogMode(true)\n\n\tif err != nil {\n\t\tlog.WithError(err).Fatal(\"An error occurred while connecting to the database\")\n\t}\n\tdefer db.Close()\n\n\t// Create models\n\tdb.DropTableIfExists(&domain.User{}, &domain.Email{}, &domain.Role{})\n\tdb.CreateTable(&domain.Email{}, &domain.Role{}, &domain.User{})\n\n\t// Create user\n\tid, _ := uuid.Parse(\"8c5df3bc-9fa6-4d73-b79a-9a1cbb35740c\")\n\tuser := domain.User{\n\t\tID: id,\n\t\tEmails: []domain.Email{\n\t\t\t{Email: \"user@devheaven.nl\"},\n\t\t},\n\t\tRoles: []domain.Role{\n\t\t\t{Role: \"ROLE_USER\"},\n\t\t},\n\t\tPassword: \"Test1234\",\n\t}\n\n\t// Create developer\n\tid, _ = uuid.Parse(\"b0203081-5dfe-4bb7-87d1-e2c59e2af7b6\")\n\tdeveloper := domain.User{\n\t\tID: id,\n\t\tEmails: []domain.Email{\n\t\t\t{Email: \"developer@devheaven.nl\"},\n\t\t},\n\t\tRoles: []domain.Role{\n\t\t\t{Role: \"ROLE_USER\"},\n\t\t\t{Role: \"ROLE_DEVELOPER\"},\n\t\t},\n\t\tPassword: \"Test1234\",\n\t}\n\n\t// Create hr\n\tid, _ = uuid.Parse(\"6b59c645-82c3-4e08-b089-f4236a2141b6\")\n\thr := domain.User{\n\t\tID: id,\n\t\tEmails: []domain.Email{\n\t\t\t{Email: \"hr@devheaven.nl\"},\n\t\t},\n\t\tRoles: []domain.Role{\n\t\t\t{Role: \"ROLE_USER\"},\n\t\t\t{Role: \"ROLE_HR\"},\n\t\t},\n\t\tPassword: \"Test1234\",\n\t}\n\n\t// Create manager\n\tid, _ = uuid.Parse(\"75129bb5-5c12-48a1-8410-bb2630fff9ed\")\n\tmanager := domain.User{\n\t\tID: id,\n\t\tEmails: []domain.Email{\n\t\t\t{Email: \"manager@devheaven.nl\"},\n\t\t\t{Email: \"devheavenplatform@gmail.com\"},\n\t\t},\n\t\tRoles: []domain.Role{\n\t\t\t{Role: \"ROLE_USER\"},\n\t\t\t{Role: \"ROLE_MANAGER\"},\n\t\t},\n\t\tPassword: \"Test1234\",\n\t}\n\n\tdb.Create(&user)\n\tdb.Create(&developer)\n\tdb.Create(&hr)\n\tdb.Create(&manager)\n}", "func createUser() User {\n\tuser := User{\n\t\tUsername: \"igor\",\n\t\tPassword: \"please store hashed password\",\n\t\tName: \"Paolo\",\n\t\tSurname: \"Galeone\",\n\t\tEmail: \"please validate the @email . com\",\n\t\tGender: true,\n\t\tBirthDate: time.Now(),\n\t}\n\n\tif e = db.Create(&user); e != nil {\n\t\tpanic(fmt.Sprintf(\"Create(&user) filling fields having no default should work, but got: %s\\n\", e.Error()))\n\t}\n\treturn user\n}", "func (u *User) Create() {\n\tconfig.DB.Create(u)\n}", "func (s *UserStore) Transaction(callback func(*UserStore) error) error {\n\tif callback == nil {\n\t\treturn kallax.ErrInvalidTxCallback\n\t}\n\n\treturn s.Store.Transaction(func(store *kallax.Store) error {\n\t\treturn callback(&UserStore{store})\n\t})\n}", "func (cli *Store) User() *UserRepository {\n\t// TODO: add test store for testing\n\tif cli.userRepository != nil {\n\t\treturn cli.userRepository\n\t}\n\n\tcli.userRepository = &UserRepository{\n\t\tstore: cli,\n\t}\n\n\treturn cli.userRepository\n}", "func SaveUser(user *User) {\n\tDb.Save(&user)\n}", "func CreateUser(\n\tctx context.Context,\n\ttx *sql.Tx,\n\trequest *models.CreateUserRequest) error {\n\tmodel := request.User\n\t// Prepare statement for inserting data\n\tstmt, err := tx.Prepare(insertUserQuery)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"preparing create statement failed\")\n\t}\n\tdefer stmt.Close()\n\tlog.WithFields(log.Fields{\n\t\t\"model\": model,\n\t\t\"query\": insertUserQuery,\n\t}).Debug(\"create query\")\n\t_, err = stmt.ExecContext(ctx, string(model.GetUUID()),\n\t\tcommon.MustJSON(model.GetPerms2().GetShare()),\n\t\tint(model.GetPerms2().GetOwnerAccess()),\n\t\tstring(model.GetPerms2().GetOwner()),\n\t\tint(model.GetPerms2().GetGlobalAccess()),\n\t\tstring(model.GetPassword()),\n\t\tstring(model.GetParentUUID()),\n\t\tstring(model.GetParentType()),\n\t\tbool(model.GetIDPerms().GetUserVisible()),\n\t\tint(model.GetIDPerms().GetPermissions().GetOwnerAccess()),\n\t\tstring(model.GetIDPerms().GetPermissions().GetOwner()),\n\t\tint(model.GetIDPerms().GetPermissions().GetOtherAccess()),\n\t\tint(model.GetIDPerms().GetPermissions().GetGroupAccess()),\n\t\tstring(model.GetIDPerms().GetPermissions().GetGroup()),\n\t\tstring(model.GetIDPerms().GetLastModified()),\n\t\tbool(model.GetIDPerms().GetEnable()),\n\t\tstring(model.GetIDPerms().GetDescription()),\n\t\tstring(model.GetIDPerms().GetCreator()),\n\t\tstring(model.GetIDPerms().GetCreated()),\n\t\tcommon.MustJSON(model.GetFQName()),\n\t\tstring(model.GetDisplayName()),\n\t\tcommon.MustJSON(model.GetAnnotations().GetKeyValuePair()))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"create failed\")\n\t}\n\n\tmetaData := &common.MetaData{\n\t\tUUID: model.UUID,\n\t\tType: \"user\",\n\t\tFQName: model.FQName,\n\t}\n\terr = common.CreateMetaData(tx, metaData)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = common.CreateSharing(tx, \"user\", model.UUID, model.GetPerms2().GetShare())\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.WithFields(log.Fields{\n\t\t\"model\": model,\n\t}).Debug(\"created\")\n\treturn nil\n}", "func (a UserService) WithTrx(trxHandle *gorm.DB) UserService {\n\ta.userRepository = a.userRepository.WithTrx(trxHandle)\n\ta.userRoleRepository = a.userRoleRepository.WithTrx(trxHandle)\n\n\treturn a\n}", "func (s *Supplier) User() store.UserStore {\n\treturn postgres.NewPgUserStore(s.Pgst)\n}", "func (pg *PG) StoreUser(ctx context.Context, user *models.User, passwordHash []byte) (*models.User, error) {\n\tconst query string = `insert into public.users \n\t\t(name_user, email_addr, pwd_hash,\n\t\tfirst_name, last_name, phone_number, \n\t\tuser_role, description)\n\t\tvalues ($1,$2,$3,$4,$5,$6,$7,$8)\n\t\treturning id_user;`\n\n\tvar uid int64\n\terr := pg.db.QueryRow(ctx, query, user.Username, user.Email, passwordHash,\n\t\tuser.FirstName, user.LastName, user.Phone,\n\t\tuser.UserRole, user.Username+\" TODO: привести БД в соответствии с моделью\").Scan(&uid)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"insert user failed\")\n\t}\n\tif uid == 0 {\n\t\treturn nil, errors.Errorf(\"insert user failed, empty id\")\n\t}\n\tuser.ID = uid\n\t// TODO: привести в соответствие с моделью и спекой\n\t// что за статус, что он означает?\n\tuser.UserStatus = 1\n\n\treturn user, nil\n}", "func (usr *User) Insert() error {\n\tif _, err := orm.NewOrm().Insert(usr); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (_UserCrud *UserCrudSession) InsertUser(userAddress common.Address, userEmail string, userAge *big.Int) (*types.Transaction, error) {\n\treturn _UserCrud.Contract.InsertUser(&_UserCrud.TransactOpts, userAddress, userEmail, userAge)\n}", "func (o *Stock) User(exec boil.Executor, mods ...qm.QueryMod) userQuery {\n\tqueryMods := []qm.QueryMod{\n\t\tqm.Where(\"user_id=?\", o.UserID),\n\t}\n\n\tqueryMods = append(queryMods, mods...)\n\n\tquery := Users(exec, queryMods...)\n\tqueries.SetFrom(query.Query, \"`users`\")\n\n\treturn query\n}", "func init() {\n\tuserFields := schema.User{}.Fields()\n\t_ = userFields\n\t// userDescCreatedAt is the schema descriptor for created_at field.\n\tuserDescCreatedAt := userFields[2].Descriptor()\n\t// user.DefaultCreatedAt holds the default value on creation for the created_at field.\n\tuser.DefaultCreatedAt = userDescCreatedAt.Default.(func() time.Time)\n\t// userDescUpdatedAt is the schema descriptor for updated_at field.\n\tuserDescUpdatedAt := userFields[3].Descriptor()\n\t// user.DefaultUpdatedAt holds the default value on creation for the updated_at field.\n\tuser.DefaultUpdatedAt = userDescUpdatedAt.Default.(func() time.Time)\n\t// user.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.\n\tuser.UpdateDefaultUpdatedAt = userDescUpdatedAt.UpdateDefault.(func() time.Time)\n\t// userDescID is the schema descriptor for id field.\n\tuserDescID := userFields[0].Descriptor()\n\t// user.IDValidator is a validator for the \"id\" field. It is called by the builders before save.\n\tuser.IDValidator = userDescID.Validators[0].(func(int) error)\n}", "func (user *User) Save() {\n\tdb := common.GetDatabase()\n\n\tdb.Save(&user)\n}", "func (ug *userGorm) Create(user *User) error{\n\treturn ug.db.Create(user).Error\n}", "func RegisterUser(db *gorm.DB, w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"register\")\n\truser := model.RUser{}\n\tdecoder := json.NewDecoder(r.Body)\n\tif err := decoder.Decode(&ruser); err != nil {\n\t\tRespondError(w, http.StatusBadRequest, \"\")\n\t\tlog.Println(\"decode:\", err.Error())\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\thashedPassword, err := bcrypt.GenerateFromPassword([]byte(ruser.Password), 8)\n\tif err != nil {\n\t\tRespondError(w, http.StatusInternalServerError, \"\")\n\t\tlog.Println(\"hash:\", err.Error())\n\t\treturn\n\t}\n\n\tid, err := uuid.NewUUID()\n\tif err != nil {\n\t\tRespondError(w, http.StatusInternalServerError, \"\")\n\t}\n\n\tuser := model.User{\n\t\tName: ruser.Name,\n\t\tUsername: ruser.Username,\n\t\tPassword: string(hashedPassword),\n\t\tUUID: id.String(),\n\t}\n\n\tif err := db.Save(&user).Error; err != nil {\n\t\tRespondError(w, http.StatusInternalServerError, \"\")\n\t\tlog.Println(\"save:\", err.Error())\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusCreated, user)\n}", "func (rep *UserRepository) Create(user *models.User) (err error) {\n\tuser.Created = utils.GetTimestampNow()\n\tuser.Updated = utils.GetTimestampNow()\n\terr = databaseConnection.Create(user).Error\n\tif err != nil {\n\t\tlog.Error(0, \"Could not create user: %v\", err)\n\t\treturn\n\t}\n\treturn\n}", "func (ug *userDbHandle) Create(user *User) error {\n\treturn ug.db.Create(user).Error\n}", "func NewUser(db *sql.DB) *User {\n\tvar dbx = sqlx.NewDb(db, \"postgres\")\n\treturn &User{\n\t\tdb: dbx,\n\t}\n}", "func CreateUser(c *gin.Context) {\n\n\tfmt.Println(\"Endpoint Hit: Create A new User\")\n\n\tuser := model.Users{}\n\n\terr := c.Bind(&user)\n\n\tif err != nil {\n\t\tfmt.Print(err)\n\t}\n\n\tfmt.Println(user.Name)\n\n\tfmt.Println(user.Email)\n\tfmt.Println(user.Password)\n\tdb, err := sql.Open(\"mysql\", \"root:password@tcp(127.0.0.1:3306)/twitter\")\n\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\t_, errQ := db.Query(\"INSERT INTO users(name, email, password) VALUES (?,?,?)\", user.Name, user.Email, user.Password)\n\n\tif errQ != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"Name\": user.Name,\n\t\t\"Email\": user.Email,\n\t\t\"Password\": user.Password,\n\t})\n\n\tdefer db.Close()\n\n}", "func (ug *userGorm) Create(user *User) error {\n\treturn ug.db.Create(user).Error\n\n}", "func dataSourceUser() *schema.Resource {\n\treturn &schema.Resource{\n\t\tRead: dataSourceUserRead,\n\t\tSchema: userschema.ReadSchema(),\n\t}\n}", "func registerUser(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\n\n\tvar user_obj sbiStruct.user\t\n\tvar err error\n\n\tfmt.Println(\"Entering registerUser\")\n\n\tif (len(args) < 1) {\n\t\tfmt.Println(\"Invalid number of args\")\n\t\treturn nil, errors.New(\"Expected atleast one arguments for initiate Transaction\")\n\t}\n\n\tfmt.Println(\"Args [0] is : %v\\n\",args[0])\n\tfmt.Println(\"Args [1] is : %v\\n\",args[1])\n\t\n\t//unmarshal transaction initiation data from UI to \"transactionInitiation\" struct\n\terr = json.Unmarshal([]byte(args[1]), &user_obj)\n\tif err != nil {\n\t\tfmt.Printf(\"Unable to unmarshal createTransaction input transaction initiation : %s\\n\", err)\n\t\treturn nil, nil\n\t}\n\n\tfmt.Println(\"TransactionInitiation object refno variable value is : %s\\n\",trans_obj.TransRefNo);\n\t\n\tGetUserMap(stub)\t\n\n\tuser_map[user_obj.uname] = user_obj\t\n\n\tSetUserMap(stub)\t\n\t\n\tfmt.Printf(\"final user map : %v \\n\", user_map)\t\t\n\t\n\treturn nil, nil\n}", "func CreateUser(c *gin.Context) {\n\tlog.Println(\"CreateUser in db\")\n\tvar user models.User\n\tvar db = db.GetDB()\n\tif err := c.BindJSON(&user); err != nil {\n\t\tc.AbortWithStatusJSON(http.StatusBadRequest, gin.H{\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\tlog.Println(\"Failed to create user in db\")\n\t\treturn\n\t}\n\t// hash the password\n\tuser.Password = security.HashAndSalt([]byte(user.Password))\n\n\tdb.Create(&user)\n\tc.JSON(http.StatusOK, &user)\n}", "func (t *UserInstanceTable) Setup(ctx context.Context, db *sql.DB) error {\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = tx.Exec(`\n\tCREATE TABLE IF NOT EXISTS compute_personal (\n\t\trowid INTEGER PRIMARY KEY AUTOINCREMENT,\n owner_uid INT NOT NULL,\n\t instance_uid INT NOT NULL,\n ip VARCHAR(64) NOT NULL,\n\t\tstatus VARCHAR(64) NOT NULL,\n user_sshkey VARCHAR(2048) NOT NULL,\n\n\t\tCONSTRAINT fk_compute_instances\n\t\t\tFOREIGN KEY (instance_uid)\n\t\t\tREFERENCES compute_instances(rowid)\n\t\t\tON DELETE CASCADE\n\t);\n\n CREATE INDEX IF NOT EXISTS compute_personal_owner ON compute_personal(owner_uid);\n\tCREATE INDEX IF NOT EXISTS compute_personal_instance_uid ON compute_personal(instance_uid);\n\t`)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err = tx.Commit(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func setUsuarioDBLF(newUser user) {\n\t_, err := database.Exec(\"call sp_insert_usuario_carga_masiva(:1,:2,:3,:4,:5,:6,:7)\",\n\t\tnewUser.UserName, newUser.Password, newUser.Nombre,\n\t\tnewUser.Apellido, newUser.FechaNacimiento, newUser.Email,\n\t\tnewUser.Membresia)\n\tif err != nil {\n\t\tfmt.Println(\"Error in Query:\", err)\n\t\treturn\n\t}\n}", "func (ug *userGorm) Create(user *User) error {\n\treturn ug.db.Create(user).Error\n}", "func (ug *userGorm) Create(user *User) error {\n\treturn ug.db.Create(user).Error\n}", "func (c *UserRepoImpl) Create(user *model.User) (*model.User, error) {\n\tif err := c.db.Table(\"user\").Save(&user).Error; err != nil {\n\t\tfmt.Errorf(\"Having error : %w\", err)\n\t\tlogrus.Error(err)\n\t\treturn nil, errors.New(\"add user data : error\")\n\t}\n\treturn user, nil\n}", "func createUser(u *models.User, db *sql.DB) error {\n\tif err := u.CryptPwd(); err != nil {\n\t\treturn fmt.Errorf(\"Cryptage du mot de passe de %s : %v\", u.Name, err)\n\t}\n\tif err := u.Create(db); err != nil {\n\t\treturn fmt.Errorf(\"Création en base de données de %s : %v\", u.Name, err)\n\t}\n\treturn nil\n}", "func (store *dbStore) CreateUser(user *structs.User) error {\r\n\tsqlStatement := fmt.Sprint(\"INSERT INTO user(username) VALUES ('\", user.Username, \"')\")\r\n\r\n\tfmt.Println(sqlStatement)\r\n\r\n\t_, err := store.db.Query(sqlStatement)\r\n\tif err != nil {\r\n\t\tfmt.Printf(\"failed to execute create user query on the database: %v\", err)\r\n\t\treturn err\r\n\t}\r\n\r\n\treturn nil\r\n}", "func TestUser(t *testing.T) {\n\tu := new(entity.User)\n\tu.Userid = \"1111\" //\n\thas, err := Engine.Get(u)\n\tt.Log(has, err)\n}", "func (dbHandler *DbHandler) CreateUser(user user.User) (err error) {\n\tpsw, _ := bcrypt.GenerateFromPassword([]byte(user.Password), bcrypt.DefaultCost)\n\tuser.Password = string(psw)\n\terr = dbHandler.handlers[UserCollection].GetCollection().Insert(user)\n\treturn\n}", "func User(w http.ResponseWriter, r *http.Request, db *mgo.Database) {\n\tuserID := chi.URLParam(r, \"userID\")\n\thelloWorld := \"Hello user \" + userID\n\trender.JSON(w, r, helloWorld)\n}" ]
[ "0.6224481", "0.58505857", "0.58417505", "0.5826436", "0.5734593", "0.5690672", "0.5690672", "0.568731", "0.5683977", "0.56832737", "0.5665492", "0.5661991", "0.56523687", "0.5643033", "0.5639015", "0.56369126", "0.56279415", "0.56095916", "0.56004083", "0.5600074", "0.5595484", "0.5565761", "0.5545583", "0.5542015", "0.5534423", "0.55320984", "0.5531834", "0.55242366", "0.5504431", "0.55030316", "0.5493047", "0.54877263", "0.54838043", "0.54757607", "0.5473926", "0.5470939", "0.5461291", "0.5439798", "0.54238564", "0.5420296", "0.5419646", "0.5419177", "0.5409692", "0.54083896", "0.54037637", "0.5392657", "0.5391155", "0.5381344", "0.53702915", "0.5360898", "0.5357747", "0.5354139", "0.5352433", "0.53491986", "0.53488064", "0.5346243", "0.5344441", "0.53364617", "0.53205574", "0.5318841", "0.53132886", "0.53132886", "0.5313153", "0.53084224", "0.53025484", "0.52941394", "0.52881664", "0.5280728", "0.527682", "0.52731633", "0.527029", "0.5266338", "0.5266307", "0.52503145", "0.5248703", "0.5242318", "0.5240256", "0.5240102", "0.5237818", "0.5235533", "0.5226176", "0.5224732", "0.52229136", "0.5217687", "0.52106", "0.5205586", "0.52050316", "0.5199569", "0.5198464", "0.51941717", "0.5191411", "0.51910585", "0.51837516", "0.51837516", "0.5183274", "0.51754415", "0.5171958", "0.51590437", "0.51574457", "0.5155708" ]
0.71175754
0
mark HTML as Output type
Отметить HTML как тип вывода
func (*HTML) isOutput() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (this *Tidy) OutputHtml(val bool) (bool, error) {\n\treturn this.optSetBool(C.TidyHtmlOut, cBool(val))\n}", "func (this *Tidy) OutputXhtml(val bool) (bool, error) {\n\treturn this.optSetBool(C.TidyXhtmlOut, cBool(val))\n}", "func htmlFmt(w io.Writer, x interface{}, format string) {\n\twriteAny(w, x, true)\n}", "func HTMLContentTypeMiddleware(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"text/html; charset=UTF-8\")\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func Html(resp http.ResponseWriter, content string, code int) error {\n\tresp.Header().Add(\"Content-Type\", \"text/html\")\n\tresp.WriteHeader(code)\n\t_, err := resp.Write([]byte(content))\n\treturn maskAny(err)\n}", "func (Output) typ() string { return \"output1\" }", "func IfReturnHTMLResponse(w http.ResponseWriter, r *http.Request) bool {\n\taccepts := r.Header[\"Accept\"]\n\tfor _, accept := range accepts {\n\t\tfields := strings.Split(accept, \",\")\n\t\tfor _, field := range fields {\n\t\t\tif field == contentTypeHtml {\n\t\t\t\tw.Header().Set(\"Content-Type\", contentTypeHtml)\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false\n}", "func (this *Tidy) OutputEncoding(val int) (bool, error) {\n\tswitch val {\n\tcase Raw, Ascii, Latin0, Latin1, Utf8, Iso2022, Mac, Win1252, Ibm858, Utf16le, Utf16be, Utf16, Big5, Shiftjis:\n\t\treturn this.optSetInt(C.TidyOutCharEncoding, (C.ulong)(val))\n\t}\n\treturn false, errors.New(\"Argument val int is out of range (0-13)\")\n}", "func Output(c Content, o Options) (string, error) {\n\tvar e error\n\tvar formatter format\n\tswitch style := o.Style; style {\n\tcase \"md\":\n\t\tformatter = md{Content: c, Options: o}\n\tcase \"psql\":\n\t\tformatter = psql{Content: c, Options: o}\n\tcase \"jira\":\n\t\tformatter = jira{Content: c, Options: o}\n\tdefault:\n\t\te = errors.New(\"Formatter not implemented error\")\n\t}\n\ttable := formatter.format()\n\treturn table, e\n}", "func (self *Output) Type() string {\n\treturn \"output\"\n}", "func (t FieldType) ToHTML() []byte {\n\treturn nil\n}", "func (self *Encoder) SetEscapeHTML(f bool) {\n if f {\n self.Opts |= EscapeHTML\n } else {\n self.Opts &= ^EscapeHTML\n }\n}", "func (ra *ResponseAsserter) HTML() *HTMLAsserter {\n\t// @TODO do some basic html validation checking\n\treturn newHTMLAsserter(ra, ra.fail)\n}", "func (p Page) IsHTML() bool {\n\treturn p.Type().MediaType() == \"text/html\"\n}", "func Output_(children ...HTML) HTML {\n return Output(nil, children...)\n}", "func writeAny(w io.Writer, x interface{}, html bool) {\n\tswitch v := x.(type) {\n\tcase []byte:\n\t\twriteText(w, v, html)\n\tcase string:\n\t\twriteText(w, strings.Bytes(v), html)\n\tcase ast.Decl:\n\t\twriteNode(w, v, html, &defaultStyler)\n\tcase ast.Expr:\n\t\twriteNode(w, v, html, &defaultStyler)\n\tdefault:\n\t\tif html {\n\t\t\tvar buf bytes.Buffer;\n\t\t\tfmt.Fprint(&buf, x);\n\t\t\twriteText(w, buf.Bytes(), true);\n\t\t} else {\n\t\t\tfmt.Fprint(w, x)\n\t\t}\n\t}\n}", "func (p *Parser) SetOutput(out io.Writer) { p.out = out }", "func outHTML(config *MainConfig, fileFunc FileResultFunc) {\n\n\tindexPath := filepath.Join(config.Outpath, FILE_NAME_HTML_INDEX)\n\terr := SFFileManager.WirteFilepath(indexPath, []byte(assets.HTML_INDEX))\n\n\tif nil != err {\n\t\tfileFunc(indexPath, ResultFileOutFail, err)\n\t} else {\n\t\tfileFunc(indexPath, ResultFileSuccess, nil)\n\t}\n\n\tsrcPath := filepath.Join(config.Outpath, FILE_NAME_HTML_SRC)\n\terr = SFFileManager.WirteFilepath(srcPath, []byte(assets.HTML_SRC))\n\n\tif nil != err {\n\t\tfileFunc(srcPath, ResultFileOutFail, err)\n\t} else {\n\t\tfileFunc(srcPath, ResultFileSuccess, nil)\n\t}\n\n}", "func WriteHTML(w http.ResponseWriter, data []byte, status int) (int, error) {\n\tw.Header().Set(ContentType, ContentHTML)\n\tw.WriteHeader(status)\n\treturn w.Write(data)\n}", "func Output(attrs []htmlgo.Attribute, children ...HTML) HTML {\n\treturn &htmlgo.Tree{Tag: \"output\", Attributes: attrs, Children: children}\n}", "func outputHTML(w http.ResponseWriter, r *http.Request, filepath string) {\n\tfile, err := os.Open(filepath)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer file.Close()\n\n\thttp.ServeContent(w, r, file.Name(), time.Now(), file)\n}", "func Render(typ Type, input any, urlPrefix string, metas map[string]string) []byte {\n\tvar rawBytes []byte\n\tswitch v := input.(type) {\n\tcase []byte:\n\t\trawBytes = v\n\tcase string:\n\t\trawBytes = []byte(v)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unrecognized input content type: %T\", input))\n\t}\n\n\turlPrefix = strings.TrimRight(strings.ReplaceAll(urlPrefix, \" \", \"%20\"), \"/\")\n\tvar rawHTML []byte\n\tswitch typ {\n\tcase TypeMarkdown:\n\t\trawHTML = RawMarkdown(rawBytes, urlPrefix)\n\tcase TypeOrgMode:\n\t\trawHTML = RawOrgMode(rawBytes, urlPrefix)\n\tdefault:\n\t\treturn rawBytes // Do nothing if syntax type is not recognized\n\t}\n\n\trawHTML = postProcessHTML(rawHTML, urlPrefix, metas)\n\treturn SanitizeBytes(rawHTML)\n}", "func (ctx *Context) HTML(code int, html string) (err error) {\n\tctx.response.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\tctx.response.WriteHeader(code)\n\t_, err = ctx.response.Write([]byte(html))\n\treturn\n}", "func (r Redirect) WriteContentType(http.ResponseWriter) {}", "func SetHandler(w io.Writer) {\n\toutput.output = w\n}", "func (t *typewriter) Typewrite() string {\n\t// Re-use the cached result if already processed.\n\tif t.cur != -1 {\n\t\treturn t.result\n\t}\n\n\tvar buf bytes.Buffer\n\n\tfor {\n\t\tsep, str := t.scanMorpheme()\n\t\tif str == \"\" {\n\t\t\tbreak\n\t\t}\n\n\t\tbuf.WriteString(sep)\n\t\tbuf.WriteString(str)\n\t}\n\n\tt.result = buf.String()\n\treturn t.result\n}", "func HTML(w http.ResponseWriter, name string, data interface{}) {\n\tDefault.HTML(w, name, data)\n}", "func renderHTMLPage(w http.ResponseWriter, r *http.Request, content []byte) {\n w.Header().Set(\"Content-Type\", \"text/html\")\n w.Write(content)\n}", "func (r renderer) BlockHtml(out *bytes.Buffer, text []byte) {}", "func (c *Context) HTML(code int, html string) {\n\tc.SetHeader(\"Content-Type\", \"text/html\")\n\tc.Status(code)\n\tc.Writer.Write([]byte(html))\n}", "func (h *Encoder) SetupOutput(output interface{}, ht *rest.HandlerTrait) {\n\th.outputBufferType = reflect.TypeOf(output)\n\th.outputHeadersEncoder = nil\n\th.skipRendering = true\n\n\tif output == nil {\n\t\treturn\n\t}\n\n\t// Enable dynamic headers check in interface mode.\n\tif h.unwrapInterface = reflect.ValueOf(output).Elem().Kind() == reflect.Interface; h.unwrapInterface {\n\t\tenc := form.NewEncoder()\n\t\tenc.SetMode(form.ModeExplicit)\n\t\tenc.SetTagName(string(rest.ParamInHeader))\n\n\t\th.outputHeadersEncoder = enc\n\t}\n\n\trespHeaderMapping := ht.RespHeaderMapping\n\tif len(respHeaderMapping) == 0 && refl.HasTaggedFields(output, string(rest.ParamInHeader)) {\n\t\trespHeaderMapping = make(map[string]string)\n\n\t\trefl.WalkTaggedFields(reflect.ValueOf(output), func(v reflect.Value, sf reflect.StructField, tag string) {\n\t\t\trespHeaderMapping[sf.Name] = tag\n\t\t}, string(rest.ParamInHeader))\n\t}\n\n\tif len(respHeaderMapping) > 0 {\n\t\tenc := form.NewEncoder()\n\t\tenc.SetMode(form.ModeExplicit)\n\t\tenc.RegisterTagNameFunc(func(field reflect.StructField) string {\n\t\t\treturn respHeaderMapping[field.Name]\n\t\t})\n\n\t\th.outputHeadersEncoder = enc\n\t}\n\n\tif h.outputBufferType.Kind() == reflect.Ptr {\n\t\th.outputBufferType = h.outputBufferType.Elem()\n\t}\n\n\tif !rest.OutputHasNoContent(output) {\n\t\th.skipRendering = false\n\t}\n\n\tif _, ok := output.(usecase.OutputWithWriter); ok {\n\t\th.skipRendering = true\n\t\th.outputWithWriter = true\n\t}\n\n\tif ht.SuccessStatus != 0 {\n\t\treturn\n\t}\n\n\tif h.skipRendering && !h.outputWithWriter {\n\t\tht.SuccessStatus = http.StatusNoContent\n\t} else {\n\t\tht.SuccessStatus = http.StatusOK\n\t}\n}", "func (c *C) HTML(name string, data interface{}) {\n\tc.render.Render(c.Writer, name, data)\n}", "func (f *FakeOutput) Type() string { return \"fake_output\" }", "func (e *htmlTag) WriteTo(w io.Writer) (int64, error) {\n\tvar bf bytes.Buffer\n\n\t// Write an open tag.\n\tbf.WriteString(lt)\n\tbf.WriteString(e.tagName)\n\t// Write an id.\n\tif e.id != \"\" {\n\t\tbf.WriteString(space)\n\t\tbf.WriteString(attributeNameID)\n\t\tbf.WriteString(equal)\n\t\tbf.WriteString(doubleQuote)\n\t\tbf.WriteString(e.id)\n\t\tbf.WriteString(doubleQuote)\n\t}\n\t// Write classes.\n\tif len(e.classes) > 0 {\n\t\tbf.WriteString(space)\n\t\tbf.WriteString(attributeNameClass)\n\t\tbf.WriteString(equal)\n\t\tbf.WriteString(doubleQuote)\n\t\tfor i, class := range e.classes {\n\t\t\tif i > 0 {\n\t\t\t\tbf.WriteString(space)\n\t\t\t}\n\t\t\tbf.WriteString(class)\n\t\t}\n\t\tbf.WriteString(doubleQuote)\n\t}\n\t// Write attributes.\n\tif len(e.attributes) > 0 {\n\n\t\tfor _, a := range e.attributes {\n\t\t\tbf.WriteString(space)\n\t\t\tbf.WriteString(a.key)\n\t\t\tif a.value != \"\" {\n\t\t\t\tbf.WriteString(equal)\n\t\t\t\tbf.WriteString(doubleQuote)\n\t\t\t\tbf.WriteString(a.value)\n\t\t\t\tbf.WriteString(doubleQuote)\n\t\t\t}\n\t\t}\n\t}\n\tbf.WriteString(gt)\n\n\t// Write a text value\n\tif e.textValue != \"\" {\n\t\tbf.WriteString(e.textValue)\n\t}\n\n\tif e.containPlainText {\n\t\tbf.WriteString(lf)\n\t}\n\n\t// Write children's HTML.\n\tif i, err := e.writeChildren(&bf); err != nil {\n\t\treturn i, err\n\t}\n\n\t// Write a close tag.\n\tif !e.noCloseTag() {\n\t\tbf.WriteString(lt)\n\t\tbf.WriteString(slash)\n\t\tbf.WriteString(e.tagName)\n\t\tbf.WriteString(gt)\n\t}\n\n\t// Write the buffer.\n\ti, err := w.Write(bf.Bytes())\n\n\treturn int64(i), err\n}", "func renderToHTML(b []byte) ([]byte, error) {\n\tb = convertImports(b)\n\tgmParser := goldmark.New(goldmark.WithRendererOptions(gmhtml.WithUnsafe()), goldmark.WithExtensions(extension.Typographer, extension.Table))\n\tvar out bytes.Buffer\n\tif err := gmParser.Convert(b, &out); err != nil {\n\t\tpanic(err)\n\t}\n\treturn out.Bytes(), nil\n}", "func (f *Template) SetOutput(dest io.Writer) {\n\tf.ac, _ = dest.(*AccessLog)\n\n\tif f.Tmpl == nil {\n\t\ttmpl := template.New(\"\")\n\n\t\ttext := f.Text\n\t\tif text != \"\" {\n\t\t\ttmpl.Funcs(f.Funcs)\n\t\t} else {\n\t\t\ttext = defaultTmplText\n\t\t}\n\n\t\tf.Tmpl = template.Must(tmpl.Parse(text))\n\t}\n}", "func (r renderer) RawHtmlTag(out *bytes.Buffer, tag []byte) {}", "func (t toc) writeToHTML(f string) (err error) {\n\ts := t.toHTMLStr()\n\treturn ioutil.WriteFile(f, []byte(s), 0755)\n}", "func (r *Template) Html() pulumi.StringOutput {\n\treturn (pulumi.StringOutput)(r.s.State[\"html\"])\n}", "func (p *ChangePasswordStep2Page) SetHTML(html template.HTML) {\n\tp.HTML = html\n}", "func httpHTML(w http.ResponseWriter, data interface{}) {\n\tw.WriteHeader(http.StatusOK)\n\tfmt.Fprint(w, data)\n}", "func RenderHTML(w http.ResponseWriter, view Renderable, code int) error {\n\tb, err := view.Render(view)\n\tif err != nil {\n\t\treturn err\n\t}\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\tw.WriteHeader(code)\n\t_, err = w.Write(b)\n\treturn err\n}", "func (logger *Logger) SetOutput(level string, w io.Writer, flag int) {\n\tlevelNum := LevelInt(level)\n\tswitch {\n\tcase INFO == levelNum:\n\t\tlogger.info = nativeLogger(w, level, flag)\n\tcase DEBUG == levelNum:\n\t\tlogger.debug = nativeLogger(w, level, flag)\n\tcase WARN == levelNum:\n\t\tlogger.warn = nativeLogger(w, level, flag)\n\tcase ERROR == levelNum:\n\t\tlogger.err = nativeLogger(w, level, flag)\n\tcase FATAL == levelNum:\n\t\tlogger.fatal = nativeLogger(w, level, flag)\n\tdefault:\n\t}\n}", "func Fmt (output *Data, data webapp.ReqData) {\n\toutput.Type = data[\"Content-Type\"]\n}", "func (rw *RW) WriteHTML(fileName string) (err error) {\n\tfile ,err := os.Open(\"views/\"+fileName)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer file.Close()\n\tfileBytes ,err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\treturn\n\t}\n\n\trw.W.WriteHeader(200)\n\t_,err = rw.W.Write(fileBytes)\n\treturn\n}", "func HTMLHandler(data string, status int) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tMustWriteHTML(w, []byte(data), status)\n\t})\n}", "func postProcessHTML(rawHTML []byte, urlPrefix string, metas map[string]string) []byte {\n\tstartTags := make([]string, 0, 5)\n\tbuf := bytes.NewBuffer(nil)\n\ttokenizer := html.NewTokenizer(bytes.NewReader(rawHTML))\n\nouterLoop:\n\tfor html.ErrorToken != tokenizer.Next() {\n\t\ttoken := tokenizer.Token()\n\t\tswitch token.Type {\n\t\tcase html.TextToken:\n\t\t\tbuf.Write(RenderSpecialLink([]byte(token.String()), urlPrefix, metas))\n\n\t\tcase html.StartTagToken:\n\t\t\ttagName := token.Data\n\n\t\t\tif tagName == \"img\" {\n\t\t\t\twrapImgWithLink(urlPrefix, buf, token)\n\t\t\t\tcontinue outerLoop\n\t\t\t}\n\n\t\t\tbuf.WriteString(token.String())\n\t\t\t// If this is an excluded tag, we skip processing all output until a close tag is encountered.\n\t\t\tif strings.EqualFold(\"a\", tagName) || strings.EqualFold(\"code\", tagName) || strings.EqualFold(\"pre\", tagName) {\n\t\t\t\tstackNum := 1\n\t\t\t\tfor html.ErrorToken != tokenizer.Next() {\n\t\t\t\t\ttoken = tokenizer.Token()\n\n\t\t\t\t\t// Copy the token to the output verbatim\n\t\t\t\t\tbuf.WriteString(token.String())\n\n\t\t\t\t\t// Stack number doesn't increase for tags without end tags.\n\t\t\t\t\tif token.Type == html.StartTagToken && !com.IsSliceContainsStr(noEndTags, token.Data) {\n\t\t\t\t\t\tstackNum++\n\t\t\t\t\t}\n\n\t\t\t\t\t// If this is the close tag to the outer-most, we are done\n\t\t\t\t\tif token.Type == html.EndTagToken {\n\t\t\t\t\t\tstackNum--\n\t\t\t\t\t\tif stackNum <= 0 && strings.EqualFold(tagName, token.Data) {\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontinue outerLoop\n\t\t\t}\n\n\t\t\tif !com.IsSliceContainsStr(noEndTags, tagName) {\n\t\t\t\tstartTags = append(startTags, tagName)\n\t\t\t}\n\n\t\tcase html.EndTagToken:\n\t\t\tif len(startTags) == 0 {\n\t\t\t\tbuf.WriteString(token.String())\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tbuf.Write(leftAngleBracket)\n\t\t\tbuf.WriteString(startTags[len(startTags)-1])\n\t\t\tbuf.Write(rightAngleBracket)\n\t\t\tstartTags = startTags[:len(startTags)-1]\n\t\tdefault:\n\t\t\tbuf.WriteString(token.String())\n\t\t}\n\t}\n\n\tif io.EOF == tokenizer.Err() {\n\t\treturn buf.Bytes()\n\t}\n\n\t// If we are not at the end of the input, then some other parsing error has occurred,\n\t// so return the input verbatim.\n\treturn rawHTML\n}", "func (ctx *Context) HTMLByte(code int, body []byte) {\n\tctx.SetContentType(\"text/html; charset=utf-8\")\n\tctx.SetStatusCode(code)\n\tctx.Response.Body = ioutil.NopCloser(bytes.NewBuffer(body))\n}", "func (c *Context) HTML(code int, name string, data interface{}) {\n\tc.SetHeader(\"Content-Type\", \"text/html\")\n\tc.Status(code)\n\tif err := c.engine.htmlTemplates.ExecuteTemplate(c.Writer, name, data); err != nil {\n\t\tc.Fail(500, err.Error())\n\t}\n}", "func (ctx *Context) HTML(code int, body string) {\n\tctx.SetContentType(\"text/html; charset=utf-8\")\n\tctx.SetStatusCode(code)\n\tctx.WriteString(body)\n}", "func (p *RegistrationPage) SetHTML(html template.HTML) {\n\tp.HTML = html\n}", "func (t tag) Render() string {\n return t.render()\n}", "func _html(ns Nodes, outer bool) string {\n\tif len(ns) == 0 {\n\t\treturn \"\"\n\t}\n\twr := w{}\n\tif outer {\n\t\thtml.Render(&wr, ns[0].Node)\n\t} else {\n\t\tfor _, v := range ns[0].Node.Child {\n\t\t\thtml.Render(&wr, v)\n\t\t}\n\t}\n\treturn wr.s\n}", "func (o AccessCustomPageOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *AccessCustomPage) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)\n}", "func (*backfiller) OutputTypes() []*types.T {\n\t// No output types.\n\treturn nil\n}", "func (h *Encoder) MakeOutput(w http.ResponseWriter, ht rest.HandlerTrait) interface{} {\n\tif h.outputBufferType == nil {\n\t\treturn nil\n\t}\n\n\toutput := reflect.New(h.outputBufferType).Interface()\n\n\tif h.outputWithWriter {\n\t\tif withWriter, ok := output.(usecase.OutputWithWriter); ok {\n\t\t\tif h.outputHeadersEncoder != nil || ht.SuccessContentType != \"\" {\n\t\t\t\twithWriter.SetWriter(&writerWithHeaders{\n\t\t\t\t\tResponseWriter: w,\n\t\t\t\t\tresponseWriter: h,\n\t\t\t\t\ttrait: ht,\n\t\t\t\t\toutput: output,\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\twithWriter.SetWriter(w)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn output\n}", "func output(data []byte, encodeType Encode) (string, error) {\n\tswitch encodeType {\n\tcase HEX:\n\t\treturn hex.EncodeToString(data), nil\n\tcase Base64:\n\t\treturn base64.StdEncoding.EncodeToString(data), nil\n\tcase None:\n\t\treturn string(data), nil\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"secretInfo OutputType unsupport\")\n\t}\n}", "func SetOutput(w io.Writer) { std.SetOutput(w) }", "func TestFieldOutputText(t *testing.T) {\n\tfield := NewField()\n\tfield.Name = \"foo\"\n\tfield.Type = \"text\"\n\n\ttag := field.output()\n\n\tassert.Equal(t, \"<input type=\\\"text\\\" name=\\\"foo\\\" id=\\\"foo\\\" value=\\\"\\\" />\", tag)\n}", "func (o DocumentDbOutputDataSourceResponseOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DocumentDbOutputDataSourceResponse) string { return v.Type }).(pulumi.StringOutput)\n}", "func (o BlobOutputDataSourceResponseOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BlobOutputDataSourceResponse) string { return v.Type }).(pulumi.StringOutput)\n}", "func (t *tag) render() string {\n tagType := t.GetType()\n tagFormat := tagsFormat[tagType]\n\n switch t.GetType() {\n case TYPE_OPEN:\n return fmt.Sprintf(tagFormat, t.GetName(), getAttrsToString(t))\n case TYPE_CLOSE:\n return fmt.Sprintf(tagFormat, t.GetName())\n case TYPE_OPEN_CLOSE:\n return fmt.Sprintf(tagFormat, t.GetName(), getAttrsToString(t), t.GetVal(), t.GetName())\n case TYPE_SELF_CLOSED_STRICT:\n if t.GetVal() != \"\" {\n t.SetAttr(\"value\", t.GetVal())\n }\n return fmt.Sprintf(tagFormat, t.GetName(), getAttrsToString(t))\n default:\n return t.GetName()\n }\n}", "func (this *Tidy) ForceOutput(val bool) (bool, error) {\n\treturn this.optSetBool(C.TidyForceOutput, cBool(val))\n}", "func SetContentType(w http.ResponseWriter, asset string) {\n\text := filepath.Ext(asset)\n\tswitch ext {\n\tcase \".png\":\n\t\tfallthrough\n\tcase \".gif\":\n\t\tw.Header().Set(\"Content-Type\", fmt.Sprintf(\"image/%s\", ext))\n\tcase \".woff\":\n\t\tfallthrough\n\tcase \".woff2\":\n\t\tfallthrough\n\tcase \".eot\":\n\t\tfallthrough\n\tcase \".ttf\":\n\t\tw.Header().Set(\"Content-Type\", fmt.Sprintf(\"font/%s\", ext))\n\tcase \".svg\":\n\t\tw.Header().Set(\"Content-Type\", \"image/svg+xml\")\n\tcase \".css\":\n\t\tw.Header().Set(\"Content-Type\", \"text/css\")\n\tcase \".js\":\n\t\tw.Header().Set(\"Content-Type\", \"text/javascript\")\n\tdefault:\n\t\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\t}\n}", "func (this *Tidy) OutputXml(val bool) (bool, error) {\n\treturn this.optSetBool(C.TidyXmlOut, cBool(val))\n}", "func (p *UpdatePage) SetHTML(html template.HTML) {\n\tp.HTML = html\n}", "func (o DocumentDbOutputDataSourceOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DocumentDbOutputDataSource) string { return v.Type }).(pulumi.StringOutput)\n}", "func (o GetSmartagFlowLogsLogOutput) OutputType() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetSmartagFlowLogsLog) string { return v.OutputType }).(pulumi.StringOutput)\n}", "func (c *Context) HTML(status int, data string) error {\n\tc.SetHeader(\"Content-Type\", \"text/html; charset=utf-8\")\n\treturn c.Bytes(status, []byte(data))\n}", "func (a *Ace) HtmlTemplate(render Renderer) {\n\ta.render = render\n}", "func (r *Reply) HTMLlf(layout, filename string, data Data) *Reply {\n\tr.ContentType(ahttp.ContentTypeHTML.String())\n\tr.Render(&htmlRender{Layout: layout, Filename: filename, ViewArgs: data})\n\treturn r\n}", "func (h HTML) HTML() string {\n\treturn string(h)\n}", "func (o WebAclRuleStatementAndStatementStatementNotStatementStatementRegexPatternSetReferenceStatementTextTransformationOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementNotStatementStatementRegexPatternSetReferenceStatementTextTransformation) string {\n\t\treturn v.Type\n\t}).(pulumi.StringOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementNotStatementStatementRegexMatchStatementTextTransformationOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementNotStatementStatementRegexMatchStatementTextTransformation) string {\n\t\treturn v.Type\n\t}).(pulumi.StringOutput)\n}", "func (r *renderer) write(s string, unescaped bool) {\n\tif r.indentNext {\n\t\tr.indentNext = false\n\t\tr.w.WriteString(r.indent)\n\t}\n\tif !unescaped {\n\t\ts = html.EscapeString(s)\n\t}\n\tr.w.WriteString(s)\n}", "func HTML(w http.ResponseWriter, r *http.Request, v string) {\n\trender.HTML(w, r, v)\n}", "func HTML(s string) got.HTML {\n\treturn got.HTML(s)\n}", "func (o WebAclRuleStatementNotStatementStatementRegexMatchStatementTextTransformationOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementRegexMatchStatementTextTransformation) string {\n\t\treturn v.Type\n\t}).(pulumi.StringOutput)\n}", "func (o WebAclRuleStatementNotStatementStatementRegexPatternSetReferenceStatementTextTransformationOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementRegexPatternSetReferenceStatementTextTransformation) string {\n\t\treturn v.Type\n\t}).(pulumi.StringOutput)\n}", "func ConfigureSetOutput(wr io.Writer) {\n\toutputFunction = func(x string) {\n\t\t_, err := fmt.Fprintln(wr, x)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n}", "func (u Unsafe) HTML(ctx context.Context) (HTML, error) {\n\treturn nil, errHTMLOnPrimitive(\"Unsafe\")\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementByteMatchStatementTextTransformationOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementByteMatchStatementTextTransformation) string {\n\t\treturn v.Type\n\t}).(pulumi.StringOutput)\n}", "func (o BlobOutputDataSourceOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BlobOutputDataSource) string { return v.Type }).(pulumi.StringOutput)\n}", "func (r *Render) HTML(w http.ResponseWriter, name string, data interface{}) {\n\tr.Engine.ExecuteTemplate(w, name, data)\n}", "func (o WebAclRuleStatementOrStatementStatementAndStatementStatementAndStatementStatementRegexPatternSetReferenceStatementTextTransformationOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementOrStatementStatementAndStatementStatementAndStatementStatementRegexPatternSetReferenceStatementTextTransformation) string {\n\t\treturn v.Type\n\t}).(pulumi.StringOutput)\n}", "func (c *Collection) Output() bool { return templates.VariableMap(c.Metadata).Bool(\"output\", false) }", "func (o *OutputHandler) createBeautifulHTML() error {\n\terr := o.importFile()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.markdownToHTML()\n\n\terr = o.createFile()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (DefaultDispatcher) Write(rw http.ResponseWriter, resp Response) error {\n\tswitch x := resp.(type) {\n\tcase JSONResponse:\n\t\trw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tio.WriteString(rw, \")]}',\\n\") // Break parsing of JavaScript in order to prevent XSSI.\n\t\treturn json.NewEncoder(rw).Encode(x.Data)\n\tcase *TemplateResponse:\n\t\tt, ok := (x.Template).(*template.Template)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"%T is not a safe template and it cannot be parsed and written\", t)\n\t\t}\n\t\trw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\t\tif len(x.FuncMap) == 0 {\n\t\t\tif x.Name == \"\" {\n\t\t\t\treturn t.Execute(rw, x.Data)\n\t\t\t}\n\t\t\treturn t.ExecuteTemplate(rw, x.Name, x.Data)\n\t\t}\n\t\tcloned, err := t.Clone()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcloned = cloned.Funcs(x.FuncMap)\n\t\tif x.Name == \"\" {\n\t\t\treturn cloned.Execute(rw, x.Data)\n\t\t}\n\t\treturn cloned.ExecuteTemplate(rw, x.Name, x.Data)\n\tcase safehtml.HTML:\n\t\trw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\t\t_, err := io.WriteString(rw, x.String())\n\t\treturn err\n\tcase FileServerResponse:\n\t\trw.Header().Set(\"Content-Type\", x.ContentType())\n\t\t// The http package will take care of writing the file body.\n\t\treturn nil\n\tcase RedirectResponse:\n\t\thttp.Redirect(rw, x.Request.req, x.Location, int(x.Code))\n\t\treturn nil\n\tcase NoContentResponse:\n\t\trw.WriteHeader(int(StatusNoContent))\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"%T is not a safe response type and it cannot be written\", resp)\n\t}\n}", "func (o WebAclRuleStatementOrStatementStatementAndStatementStatementAndStatementStatementByteMatchStatementTextTransformationOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementOrStatementStatementAndStatementStatementAndStatementStatementByteMatchStatementTextTransformation) string {\n\t\treturn v.Type\n\t}).(pulumi.StringOutput)\n}", "func (o EventHubOutputDataSourceResponseOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v EventHubOutputDataSourceResponse) string { return v.Type }).(pulumi.StringOutput)\n}", "func writeDocHTML(w http.ResponseWriter, content *contentBuffers, lang string) error {\n\t_, err := w.Write(htmlOpen1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = w.Write([]byte(lang))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = w.Write(htmlOpen2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = w.Write(content.head.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = w.Write(htmlHeadBody)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = w.Write(content.body.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = w.Write(htmlClose)\n\treturn err\n}", "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementRegexMatchStatementTextTransformationOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementRegexMatchStatementTextTransformation) string {\n\t\treturn v.Type\n\t}).(pulumi.StringOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementAndStatementStatementRegexPatternSetReferenceStatementTextTransformationOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementAndStatementStatementRegexPatternSetReferenceStatementTextTransformation) string {\n\t\treturn v.Type\n\t}).(pulumi.StringOutput)\n}", "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementTextTransformationOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementTextTransformation) string {\n\t\treturn v.Type\n\t}).(pulumi.StringOutput)\n}", "func Encode(w http.ResponseWriter, accept string, i interface{}, htmlLayout string) {\n\tlog.Println(\"Encoding...\")\n\tlog.Println(accept)\n\tprocessed := false\n\tfor _, a := range strings.Split(accept, \",\") {\n\t\tswitch a {\n\t\tcase \"*/*\", \"application/json\", \"\":\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tenc := json.NewEncoder(w)\n\t\t\tenc.Encode(i)\n\t\t\tprocessed = true\n\t\tcase \"text/html\":\n\t\t\tlog.Println(\"HTML\")\n\t\t\tw.Header().Set(\"Content-Type\", \"text/html\")\n\t\t\thtml := ToHTML(i, htmlLayout)\n\t\t\tfmt.Fprintln(w, html)\n\t\t\tprocessed = true\n\t\t}\n\t\tif processed {\n\t\t\tbreak\n\t\t}\n\t}\n\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementByteMatchStatementTextTransformationOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementByteMatchStatementTextTransformation) string {\n\t\treturn v.Type\n\t}).(pulumi.StringOutput)\n}", "func (o WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementRegexPatternSetReferenceStatementTextTransformationOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementAndStatementStatementOrStatementStatementNotStatementStatementRegexPatternSetReferenceStatementTextTransformation) string {\n\t\treturn v.Type\n\t}).(pulumi.StringOutput)\n}", "func (o RawOutputDatasourceResponseOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RawOutputDatasourceResponse) string { return v.Type }).(pulumi.StringOutput)\n}", "func (WriterWrapper) SetOut(filename string) {}", "func normalResponse(w http.ResponseWriter, r *http.Request){\n\trespStr := `<html>\n<head><title> My Custom Response </title> </head>\n<body> <h1> Testing the response headers ...... </h1></body>\n</html>`\nw.Write([]byte(respStr))\n}" ]
[ "0.6400135", "0.6055975", "0.6011148", "0.58667994", "0.5687668", "0.561943", "0.55879533", "0.55276394", "0.5470911", "0.5454469", "0.545375", "0.5367108", "0.53660023", "0.536108", "0.5316962", "0.5314116", "0.5296099", "0.5273366", "0.52713025", "0.5254828", "0.5251903", "0.5235802", "0.5221285", "0.51915514", "0.51729983", "0.51528054", "0.51500666", "0.5148139", "0.5110433", "0.50864744", "0.50842357", "0.50739473", "0.5071545", "0.50691015", "0.50666434", "0.5048121", "0.50396824", "0.50097096", "0.49957404", "0.49876302", "0.49800164", "0.4971295", "0.494561", "0.49405378", "0.4939719", "0.49390963", "0.49385193", "0.49333015", "0.492453", "0.4912866", "0.49069113", "0.48959905", "0.48875076", "0.48748642", "0.48723787", "0.48685327", "0.48630646", "0.48555526", "0.48503974", "0.484757", "0.48447904", "0.48371884", "0.4835455", "0.48275054", "0.4827486", "0.48245165", "0.4817055", "0.48162335", "0.4814617", "0.4814422", "0.48054346", "0.47995633", "0.47960356", "0.4789397", "0.47868866", "0.47863033", "0.47856426", "0.4779764", "0.47794044", "0.47781608", "0.47738522", "0.47724912", "0.47612277", "0.47554404", "0.47525495", "0.47492436", "0.4746553", "0.47426638", "0.47405493", "0.47336054", "0.47322783", "0.47301254", "0.47284845", "0.47267333", "0.47205484", "0.47163665", "0.4715423", "0.471436", "0.47142246", "0.47135586" ]
0.70670927
0
Update is for component to have itself rerendered.
Обновление предназначено для того, чтобы компонент перерисовался снова.
func (s *State) Update() { // fmt.Println("update") s.render() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *renderer) Update(_ tea.Msg, _ *list.Model) tea.Cmd { return nil }", "func (component *Component) Update() {\n\tcomponent.WarnError(component.UpdateWithError())\n}", "func (c *PureComponent) HasUpdated() bool { return false }", "func (v *Component) ComponentDidUpdate(prevProps *Map, prevState *Map) {}", "func (c *Component) OnUpdate() {\n\t// Logger.Trace().Str(\"component\", c.GetName()).Msg(\"OnUpdate\")\n\tif c.customOnUpdate != nil {\n\t\tc.customOnUpdate(c)\n\t}\n}", "func (s *State) RequestUpdate() {\n\ts.update = true\n}", "func (md *MockDisplay) Update(*[64][32]uint8, *[64][32]bool) {}", "func (*ModuleBase) Update(*ggl.Window, float64) {}", "func (v *Component) ComponentWillUpdate(nextProps *Map, nextState *Map) {}", "func (o *CanvasItem) Update() {\n\t//log.Println(\"Calling CanvasItem.Update()\")\n\n\t// Build out the method's arguments\n\tptrArguments := make([]gdnative.Pointer, 0, 0)\n\n\t// Get the method bind\n\tmethodBind := gdnative.NewMethodBind(\"CanvasItem\", \"update\")\n\n\t// Call the parent method.\n\t// void\n\tretPtr := gdnative.NewEmptyVoid()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n}", "func (v *Status) Update() error {\n\treturn nil\n}", "func (l *List) Update() {\n\tl.win.Update()\n}", "func (g *Game) Update(display chan<- Frame) {\n\t// apply animations\n\tif g.animator.Step() {\n\t\tg.needsRender = true\n\t}\n\t// render if needed\n\tif g.needsRender {\n\t\tdisplay <- g.Render()\n\t\tg.needsRender = false\n\t}\n}", "func (w *Window) Update() {\n\tw.redraw()\n\tw.refreshWait()\n\tw.resize()\n\tpollEvents()\n}", "func (c *Board) OnUpdate() {\n\tc.Component.OnUpdate()\n}", "func (NilUGauge) Update(v uint64) {}", "func (v *Component) redraw() {\n\tv.Render()\n}", "func (c *SceneController) OnUpdate() {\n\tc.Component.OnUpdate()\n}", "func (b *Bar) Update(progress int64) {\n\tb.control <- progress\n}", "func (s *State) Update(status mesos.TaskStatus) {\n\ts.updates <- status\n}", "func (w* Workermeta) Update(state WorkerState) Workermeta {\n\tw.State = state\n\tw.LastUpdateTime = time.Now().Unix()\n\tnw := *w\n\treturn nw\n}", "func (g *Game) Update() error{\n\treturn nil\n}", "func (l *Label) Update() error {\n\treturn nil\n}", "func (self *Graphics) Update() {\n self.Object.Call(\"update\")\n}", "func (f *falconMeter) Update() {\n\tfalcon.SetMeterCount(f.name, 1)\n}", "func (m *BoolMetric) Update(v bool) {\n\tm.update(v)\n}", "func (v *Component) ShouldComponentUpdate(nextProps *Map, nextState *Map) bool {\n\treturn true\n}", "func (c *PIDController) Update(value float64) float64 {\n\tvar duration time.Duration\n\tif !c.lastUpdate.IsZero() {\n\t\tduration = time.Since(c.lastUpdate)\n\t}\n\tc.lastUpdate = time.Now()\n\treturn c.UpdateDuration(value, duration)\n}", "func (h *consulGRPCSocketHook) Update(req *interfaces.RunnerUpdateRequest) error {\n\th.mu.Lock()\n\tdefer h.mu.Unlock()\n\n\th.alloc = req.Alloc\n\n\tif !h.shouldRun() {\n\t\treturn nil\n\t}\n\n\treturn h.proxy.run(h.alloc)\n}", "func (v *Layer) Update() error {\n\treturn nil\n}", "func (ui *UI) Update(f func()) {\n\tf()\n}", "func (o *sampleUpdateHandler) Update(rw http.ResponseWriter, req *http.Request) {\n\to.UpdateHandler.Update(rw, req)\n}", "func (b *BaseElement) HandleUpdate(update UpdateI) {\n\tdirty := true\n\tswitch u := update.(type) {\n\tcase UpdateValue:\n\t\tb.SetValue(u.Value)\n\tcase UpdateX:\n\t\tb.Style.X = u.Number\n\t\tb.Restyle = true\n\tcase UpdateY:\n\t\tb.Style.Y = u.Number\n\t\tb.Restyle = true\n\tcase UpdateW:\n\t\tb.Style.W = u.Number\n\t\tb.Restyle = true\n\tcase UpdateH:\n\t\tb.Style.H = u.Number\n\t\tb.Restyle = true\n\tcase UpdateDimensions:\n\t\tb.Style.X.Value = u.X.Value\n\t\tb.Style.Y.Value = u.Y.Value\n\t\tb.Style.W.Value = u.W.Value\n\t\tb.Style.H.Value = u.H.Value\n\t\tb.Restyle = true\n\tcase UpdateScroll:\n\t\tb.Style.ScrollLeft = u.Left\n\t\tb.Style.ScrollTop = u.Top\n\t\tb.Restyle = true\n\tcase UpdateScrollLeft:\n\t\tb.Style.ScrollLeft = u.Number\n\t\tb.Restyle = true\n\tcase UpdateScrollTop:\n\t\tb.Style.ScrollTop = u.Number\n\t\tb.Restyle = true\n\tcase UpdateZIndex:\n\t\tb.Style.ZIndex = u.Number\n\tcase UpdateOutlineColor:\n\t\tb.Style.OutlineColor = u\n\tcase UpdateBackgroundColor:\n\t\tb.Style.BackgroundColor = color.NRGBA(u)\n\tcase UpdateForegroundColor:\n\t\tb.Style.ForegroundColor = color.NRGBA(u)\n\tcase UpdateDirt:\n\t\tdirty = u\n\tcase UpdateFocus:\n\t\tb.Focus()\n\tcase UpdateHidden:\n\t\tb.SetHidden(bool(u))\n\t\tif u == false {\n\t\t\tb.Restyle = true\n\t\t}\n\tcase UpdateAlpha:\n\t\tb.Style.Alpha.Set(u)\n\tcase UpdateColorMod:\n\t\tb.Style.ColorMod = color.NRGBA{u.R, u.G, u.B, u.A}\n\tcase UpdateParseStyle:\n\t\tb.Style.Parse(string(u))\n\t}\n\tb.SetDirty(dirty)\n}", "func (g *Game) Update() error {\n\treturn nil\n}", "func (g *Game) Update() error {\n\treturn nil\n}", "func (r *Reporter) Update(message string) error {\n\tselect {\n\tcase r.c <- message:\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"warning: Reporter buffer is full\")\n\t}\n}", "func (b *Buffer) update() {\n\tb.NumLines = len(b.lines)\n}", "func (cl *RestClient) Update() {\n}", "func UpdateWidget(res http.ResponseWriter, req *http.Request) {\n\tresp := response.New()\n\n\tresp.Render(res, req)\n}", "func (g *Game) Update(){\n\t// update logic here\n\tg.inputs()\n\t// inputs\n\tif !g.gameOver {\n\t}\n}", "func (s *ProtoViewSourceJob) Update(key string, msg proto.Message) error {\n\ts.keysSeen[key] = struct{}{}\n\n\tcurrent, err := s.view.Get(key)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to get object\")\n\t}\n\n\tvar shouldUpdate = true\n\n\tif current != nil {\n\t\tc := current.(proto.Message)\n\t\tshouldUpdate = c == nil || !proto.Equal(c, msg)\n\t}\n\n\tif !shouldUpdate {\n\t\treturn nil\n\t}\n\n\terr = s.emitter.Emit(key, msg)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to emit update\")\n\t}\n\n\treturn nil\n}", "func (self *Graphics) PostUpdate() {\n self.Object.Call(\"postUpdate\")\n}", "func (c *Cherry) Update(dotTime int) error {\n\tif c.eaten == false {\n\t\treturn nil\n\t}\n\treturn nil\n}", "func (i *IpScheduler) OnUpdate(old, new interface{}) {}", "func (s *Stats) Update(c *gin.Context, last time.Time) {\n\tStatsWith(c, s.update(last))\n}", "func (s *State) UpdateChild(g *draw.Buffer, bounds image.Rectangle, c Component) {\n\tg.Push(bounds)\n\tif s.disabled {\n\t\tc.Update(g, s)\n\t\tg.Pop()\n\t\treturn\n\t}\n\tthis := s.current\n\th := s.hovered\n\tv := s.visible\n\tf := s.focusable\n\ts.visible = image.Rectangle{}\n\ts.hovered = h && s.mousePos.Sub(s.bounds.Min).In(bounds)\n\tif s.hovered {\n\t\ts.hoveredC = c\n\t}\n\tb := s.bounds\n\ts.bounds = bounds.Add(s.bounds.Min)\n\ts.current = c\n\ts.focusable = false\n\tif s.focused == s.current {\n\t\ts.focusNext = true\n\t}\n\tc.Update(g, s)\n\tif s.focusable {\n\t\ts.lastFocusable = c\n\t}\n\ts.current = this\n\ts.bounds = b\n\ts.hovered = h\n\tif s.visible.Empty() {\n\t\ts.visible = v\n\t} else {\n\t\ts.visible = s.visible.Add(bounds.Min)\n\t}\n\ts.focusable = f\n\tg.Pop()\n}", "func (g *Game) Update(screen *ebiten.Image) error {\n\tg.view = screen\n\n\t// Perform logical updates\n\tg.camera.Update()\n\n\t// TODO: Add your update logic here\n\tg.handleInput()\n\n\tif ebiten.IsDrawingSkipped() {\n\t\t// When the game is running slowly, the rendering result\n\t\t// will not be adopted.\n\t\treturn nil\n\t}\n\n\t// Render game to screen\n\tg.draw()\n\n\t// TPS counter\n\tfps := fmt.Sprintf(\"TPS: %f/%v\", ebiten.CurrentTPS(), ebiten.MaxTPS())\n\tebitenutil.DebugPrint(g.view, fps)\n\n\treturn nil\n}", "func (t *AudioPlayer) Update(a *app.App, deltaTime time.Duration) {\n\n\tif time.Now().Sub(t.lastUpdate) < 100*time.Millisecond {\n\t\treturn\n\t}\n\tt.pc1.UpdateTime()\n\tt.pc2.UpdateTime()\n\tt.pc3.UpdateTime()\n\tt.pc4.UpdateTime()\n\tt.lastUpdate = time.Now()\n}", "func (t *Points) Update(a *app.App, deltaTime time.Duration) {}", "func (b *Batcher) Update(matched, total int) {\n\tb.ratio = float64(matched) / float64(total)\n}", "func (s *HelloSystem) Update(ctx core.UpdateCtx) {}", "func (job *AnalyzeJob) Update(rowCount int64) {\n\tnow := time.Now()\n\tjob.Mutex.Lock()\n\tjob.RowCount += rowCount\n\tjob.updateTime = now\n\tjob.Mutex.Unlock()\n}", "func (g *Gui) Update(f func(*Gui) error) {\n\tgo func() { g.userEvents <- userEvent{f: f} }()\n}", "func (_m *ITaskActions) SendUpdate() {\n\t_m.Called()\n}", "func (dd *Datadog) Update(component *Component) error {\n\tswitch component.Type {\n\tcase types.ComponentDashboard:\n\t\treturn dd.updateDashboard(component.Dashboard)\n\tcase types.ComponentMonitor:\n\t\treturn dd.updateMonitor(component.Monitor)\n\tcase types.ComponentDowntime:\n\t\treturn dd.updateDowntime(component.Downtime)\n\tcase types.ComponentScreenboard:\n\t\treturn dd.updateScreenBoard(component.ScreenBoard)\n\t}\n\n\treturn ErrInvalidComponentTypeID\n}", "func (r *RadioStation) Update() error {\n\treturn nil\n}", "func (c *Camera) Update() {\n\tif c.renderer == nil {\n\t\treturn\n\t}\n\n\tc.updateZoom()\n\tc.santizeBounds()\n\n\tc.renderer.SetViewport(c.Viewport())\n}", "func (c *common) update() error {\n\tif len(c.flags.update) == 0 {\n\t\treturn nil\n\t}\n\n\targs := append(c.flags.global, c.flags.update...)\n\n\treturn shared.RunCommand(c.ctx, nil, nil, c.commands.update, args...)\n}", "func (view *DetailsView) Update() error {\n\treturn nil\n}", "func (d *Display) Update() error {\n\tif inpututil.IsKeyJustPressed(ebiten.KeyEscape) {\n\t\treturn errors.New(\"user exit\")\n\t}\n\tctx := NewUpdateContext(d.ctx)\n\n\t// update the mouse event registry\n\td.mouseEventRegistry.Update()\n\n\t// call all update handlers\n\tfor i := 0; i < len(d.updateHandlers); i++ {\n\t\tif err := d.updateHandlers[i].Update(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// draw background\n\tif d.background != nil {\n\t\tif err := d.background.Update(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// update components\n\tfor _, c := range d.components {\n\t\tif err := c.Update(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// draw cursor\n\tif d.cursor != nil {\n\t\tif err := d.cursor.Update(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (info *componentInfo) updateComponent(step float32, runtime *Runtime, context *Context) {\n\tif info.Active == 0 && info.Start != nil {\n\t\truntime.workers.Run(func() {\n\t\t\tinfo.Start.Start(context)\n\t\t\tinfo.Active += 1\n\t\t})\n\t} else if info.Update != nil {\n\t\truntime.workers.Run(func() {\n\t\t\tinfo.Update.Update(context)\n\t\t\tinfo.Active += 1\n\t\t})\n\t}\n}", "func CallUpdated(p *Element) error {\n\tif p == nil {\n\t\treturn nil\n\t}\n\n\tc := p.Component\n\tif c == nil {\n\t\tc = p.ParentComponent().Component\n\t}\n\n\tif c.Hooks.Updated != nil {\n\t\terr := c.Hooks.Updated()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (rs *RenderSystem) Update(frameDelta float32) {\n\t// clear the screen\n\twidth, height := rs.Renderer.GetResolution()\n\trs.gfx.Viewport(0, 0, int32(width), int32(height))\n\trs.gfx.ClearColor(0.25, 0.25, 0.25, 1.0)\n\trs.gfx.Clear(graphics.COLOR_BUFFER_BIT | graphics.DEPTH_BUFFER_BIT)\n\n\t// make the projection and view matrixes\n\tprojection := mgl.Perspective(mgl.DegToRad(60.0), float32(width)/float32(height), 1.0, 100.0)\n\tvar view mgl.Mat4\n\tif rs.Camera != nil {\n\t\tview = rs.Camera.GetViewMatrix()\n\t} else {\n\t\tview = mgl.Ident4()\n\t}\n\n\t// draw stuff the visible entities\n\tfor _, e := range rs.visibleEntities {\n\t\tvisibleEntity, okay := e.(RenderableEntity)\n\t\tif okay {\n\t\t\tr := visibleEntity.GetRenderable()\n\t\t\trs.Renderer.DrawRenderable(r, nil, projection, view, rs.Camera)\n\t\t}\n\t}\n\n\t// draw the screen\n\trs.MainWindow.SwapBuffers()\n}", "func (f *BasicFeature) Update(TimeCurrent uint64, data []*dfedata.InputData, connectionChannel ...chan ConnectionChannelData) {\n}", "func (o *Status) Update() {\n o.Time = time.Now()\n}", "func Update(s *discordgo.Session, m *discordgo.MessageCreate) {\n\tif *R == false {\n\t\ts.ChannelMessageSend(support.Config.FactorioChannelID, \"Server is not running!\")\n\t\treturn\n\t}\n\n\ts.ChannelMessageSend(support.Config.FactorioChannelID, \"Server received factorio client update command.\")\n\t*QuitFlag = 1\n\tio.WriteString(*P, \"/quit\\n\")\n\ttime.Sleep(600 * time.Millisecond)\n\tfor {\n\t\tif *QuitFlag == 2 {\n\t\t\ts.ChannelMessageSend(support.Config.FactorioChannelID, \"server is closed.\")\n\t\t\t*QuitFlag = 0\n\t\t\tbreak\n\t\t}\n\t}\n\n\t*R = false\n\tUpdateCmd = 1\n\n\treturn\n}", "func (pl *PolledList) UpdateCh() <-chan struct{} { return pl.updateCh }", "func (pl *PolledList) UpdateCh() <-chan struct{} { return pl.updateCh }", "func (s *Gauge) Update(time TS.TimeSelect) {\n\tt, _, _ := time.CurTime()\n\ts.SetData(t)\n\ts.SetTitle(t)\n}", "func (c *NullController) Update(tick int) {\n\tvar (\n\t\te = c.entity\n\t\tam = e.AnimationManager()\n\t)\n\tif am.Ready() {\n\t\tam.Select(\"Idle\")\n\t}\n}", "func (t *Pitch) Update(a *app.App, deltaTime time.Duration) {}", "func (t *Pitch) Update(a *app.App, deltaTime time.Duration) {}", "func (m *Float64Metric) Update(v float64) {\n\tm.update(v)\n}", "func (g *GistFile) Update(interface{}) (*http.Response, error) {\n\tpanic(\"implement me\")\n}", "func (g *Game) Update() error {\n\tif gameover {\n\t\treturn nil\n\t}\n\n\treturn nil\n}", "func (c *Candy) Update(g *Game) bool {\n\treturn c.state.Update(g, c)\n}", "func (s *UniformSample) Update(v int64) {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\ts.count++\n\tif len(s.values) < s.reservoirSize {\n\t\ts.values = append(s.values, v)\n\t} else {\n\t\t// Use circle buffer to eliminate the oldest value\n\t\tidx := s.count % int64(s.reservoirSize)\n\t\ts.values[idx] = v\n\t}\n}", "func (g userGists) ShouldComponentUpdate(this *gr.This, next gr.Cops) bool {\n\treturn g.State().HasChanged(next.State, \"gists\")\n}", "func (h *UpdateHandler) Update(rw http.ResponseWriter, req *http.Request) {\n\tstartTime := time.Now()\n\n\tdefer func() {\n\t\th.metrics.HTTPCreateUpdateTime(time.Since(startTime))\n\t}()\n\n\trequest, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\tcommon.WriteError(rw, http.StatusBadRequest, err)\n\n\t\treturn\n\t}\n\n\tlogger.Debug(\"Processing update request\", logfields.WithRequestBody(request))\n\n\tresponse, err := h.doUpdate(request)\n\tif err != nil {\n\t\tcommon.WriteError(rw, err.(*common.HTTPError).Status(), err)\n\n\t\treturn\n\t}\n\tcommon.WriteResponse(rw, http.StatusOK, response)\n}", "func (w *Watcher) Update() {\n\tw.Action = true\n\tfits := w.SessionKey[:2]\n\tfmt.Println(\"[!] Attempting to update watcher: %s\", fits)\n\twriten, err := w.Connection.Write([]byte(\"Y\"))\n\tif writen != len([]byte(\"Y\")) {\n\t\tfmt.Println(\"[!]Error writting: unable to write\")\n\t}\n\tif err != nil {\n\t\tfmt.Printf(\"%s\", err)\n\t}\n\n}", "func (d *delegate) NotifyUpdate(n *memberlist.Node) {\n\tlevel.Debug(d.logger).Log(\"received\", \"NotifyUpdate\", \"node\", n.Name, \"addr\", n.Address())\n}", "func (_m *Repository) Update(p *entity.Person, commitChan <-chan bool, doneChan chan<- bool) {\n\t_m.Called(p, commitChan, doneChan)\n}", "func (s *Scroll) Update() {\n\ts.win.Update()\n}", "func (v *Filter) Update() error {\n\treturn nil\n}", "func (g *Game) Update(screen *ebiten.Image) error {\n\treturn nil\n}", "func (c *Client) Update() goa.Endpoint {\n\treturn func(ctx context.Context, v interface{}) (interface{}, error) {\n\t\tinv := goagrpc.NewInvoker(\n\t\t\tBuildUpdateFunc(c.grpccli, c.opts...),\n\t\t\tEncodeUpdateRequest,\n\t\t\tnil)\n\t\tres, err := inv.Invoke(ctx, v)\n\t\tif err != nil {\n\t\t\treturn nil, goa.Fault(err.Error())\n\t\t}\n\t\treturn res, nil\n\t}\n}", "func (self *Graphics) PreUpdate() {\n self.Object.Call(\"preUpdate\")\n}", "func Update() {\n\n}", "func (w *Watcher) DoUpdate() {\n\tfor _, i := range w.Inputs {\n\t\tif w.closed {\n\t\t\treturn\n\t\t}\n\t\tnewStats, err := i.GetStats()\n\t\tif err == nil {\n\t\t\tif i.LastErr != nil || w.isSameAs(i.KnownStats, newStats) == false {\n\t\t\t\ti.Update(newStats)\n\t\t\t}\n\t\t} else {\n\t\t\tif i.OnErrored != nil {\n\t\t\t\ti.OnErrored(i, err)\n\t\t\t}\n\t\t\tw.LogFunc(\"Failed to resolve: %v\", err)\n\t\t}\n\t}\n}", "func (pm *basePackageManager) Update() error {\n\t_, _, err := RunCommandWithRetry(pm.cmder.UpdateCmd(), nil)\n\treturn err\n}", "func (t *Timer) Update() {\n\tt.currentTime = t.getCurrentTimeMs()\n\tdelta := t.currentTime - t.lastTime\n\n\tt.tick = float64(delta) * 0.001\n\tt.lastTime = t.currentTime\n}", "func (p *PodsWidget) Update() error {\n\tif !p.pause {\n\t\tpods, err := p.apiClient.GetPodsMetrics(p.filter, p.sortorder)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\trows := make([][]string, len(pods))\n\t\tfor i, pod := range pods {\n\t\t\trows[i] = make([]string, 11)\n\t\t\trows[i][0] = pod.Namespace\n\t\t\trows[i][1] = pod.Name\n\t\t\trows[i][2] = fmt.Sprintf(\"%d/%d\", pod.ContainersReady, pod.ContainersCount)\n\t\t\trows[i][3] = pod.Status\n\t\t\trows[i][4] = fmt.Sprintf(\"%d\", pod.Restarts)\n\t\t\trows[i][5] = fmt.Sprintf(\"%dm\", pod.CPU)\n\t\t\trows[i][6] = helpers.RenderCPUMax(pod.CPUMax, pod.CPUMaxContainerCount, int64(pod.ContainersCount))\n\t\t\trows[i][7] = helpers.FormatBytes(pod.Memory)\n\t\t\trows[i][8] = helpers.RenderMemoryMax(pod.MemoryMax, pod.MemoryMaxContainerCount, int64(pod.ContainersCount))\n\t\t\trows[i][9] = pod.IP\n\t\t\trows[i][10] = helpers.FormatDuration(time.Now().Sub(pod.CreationDate))\n\t\t}\n\n\t\tp.Rows = rows\n\t}\n\n\treturn nil\n}", "func (NilTimer) Update(time.Duration) {}", "func (p *PageView) Rerender() {\n\ttimeKey := time.Now().UnixNano()\n\tp.lastTimeKey = timeKey\n\tgo func() {\n\t\ttime.Sleep(800 * time.Millisecond)\n\t\tif timeKey == p.lastTimeKey {\n\t\t\tvecty.Rerender(p)\n\t\t}\n\t}()\n}", "func (s *EmptyScene) Update() {\n}", "func (sp *ServiceProcessor) Update(event controller.Event) error {\n\tif ksChange, isKSChange := event.(*controller.KubeStateChange); isKSChange {\n\t\treturn sp.propagateDataChangeEv(ksChange)\n\t}\n\n\tif addPod, isAddPod := event.(*podmanager.AddPod); isAddPod {\n\t\treturn sp.ProcessNewPod(addPod.Pod.Namespace, addPod.Pod.Name)\n\t}\n\tif deletePod, isDeletePod := event.(*podmanager.DeletePod); isDeletePod {\n\t\treturn sp.ProcessDeletingPod(deletePod.Pod.Namespace, deletePod.Pod.Name)\n\t}\n\n\tif _, isNodeUpdate := event.(*nodesync.NodeUpdate); isNodeUpdate {\n\t\treturn sp.renderNodePorts()\n\t}\n\n\treturn nil\n}", "func (b Plugin) Update() error {\n\treturn nil\n}", "func Update(req handler.Request, prevModel *Model, currentModel *Model) (handler.ProgressEvent, error) {\n\t// Add your code here:\n\t// * Make API calls (use req.Session)\n\t// * Mutate the model\n\t// * Check/set any callback context (req.CallbackContext / response.CallbackContext)\n\n\t// Construct a new handler.ProgressEvent and return it\n\tresponse := handler.ProgressEvent{\n\t\tOperationStatus: handler.Success,\n\t\tMessage: \"Update complete\",\n\t\tResourceModel: currentModel,\n\t}\n\n\treturn response, nil\n\n\t// Not implemented, return an empty handler.ProgressEvent\n\t// and an error\n\treturn handler.ProgressEvent{}, errors.New(\"Not implemented: Update\")\n}", "func (nv *NetView) Update() {\n\tif !nv.IsVisible() || !nv.HasLayers() {\n\t\treturn\n\t}\n\tvs := nv.Scene()\n\tupdt := vs.UpdateStart()\n\tnv.UpdateImpl()\n\tvs.UpdateEnd(updt)\n}", "func (t *StandardTimer) Update(d time.Duration) {\n\tt.mutex.Lock()\n\tdefer t.mutex.Unlock()\n\tt.histogram.Update(int64(d))\n\tt.meter.Mark(1)\n}" ]
[ "0.739471", "0.7180391", "0.7151857", "0.6852027", "0.67297417", "0.6516826", "0.6448432", "0.6317419", "0.6290429", "0.6266985", "0.6240016", "0.6225204", "0.6130606", "0.6125892", "0.6121056", "0.61098975", "0.6102079", "0.6094033", "0.6089738", "0.60849196", "0.60818887", "0.60601234", "0.60566497", "0.604679", "0.6039725", "0.60317504", "0.602329", "0.60176927", "0.601041", "0.60071033", "0.5988684", "0.5980281", "0.5973557", "0.59378386", "0.59378386", "0.59161747", "0.59160525", "0.5915103", "0.590533", "0.5882886", "0.5880514", "0.5879305", "0.5863307", "0.58526844", "0.5831093", "0.58232796", "0.5817", "0.5815649", "0.580157", "0.5792371", "0.5787555", "0.57770735", "0.57684493", "0.576593", "0.57433736", "0.57301456", "0.5722555", "0.57047933", "0.57047117", "0.5704467", "0.57043856", "0.570402", "0.5672171", "0.56652105", "0.5664052", "0.56625104", "0.5660584", "0.5660584", "0.56567425", "0.5651829", "0.5646247", "0.5646247", "0.56429505", "0.56424284", "0.5632425", "0.5632244", "0.5631095", "0.56281126", "0.5609607", "0.5609054", "0.5605489", "0.56005055", "0.55998594", "0.55966854", "0.55955863", "0.5589095", "0.558877", "0.55862176", "0.5585593", "0.5583543", "0.55741507", "0.5554694", "0.5549732", "0.55487806", "0.55412555", "0.5541001", "0.5517275", "0.5511247", "0.55048704", "0.5497264" ]
0.73830247
1
/ NewComboBoxSelector :initializer of combo box selector
/ NewComboBoxSelector : инициализатор комбобокса выбора
func NewComboBoxSelector(label string, list []string) *ComboBoxSelector { obj := new(ComboBoxSelector) obj.SelectedItem = list[0] // initialize widgets obj.Cell = widgets.NewQWidget(nil, 0) obj.box = widgets.NewQComboBox(obj.Cell) obj.box.AddItems(list) obj.textLabel = widgets.NewQLabel2(label, obj.Cell, 0) // layout layout := widgets.NewQHBoxLayout() layout.AddWidget(obj.textLabel, 0, 0) layout.AddWidget(obj.box, 0, 0) // apply layout obj.Cell.SetLayout(layout) // action connection obj.box.ConnectCurrentIndexChanged(func(index int) { obj.SelectedItem = list[index] //fmt.Println(obj.SelectedItem) }) return obj }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewCombobox() *Combobox {\n\tc := new(Combobox)\n\n\tc.c = C.uiNewCombobox()\n\n\tC.pkguiComboboxOnSelected(c.c)\n\n\tc.ControlBase = NewControlBase(c, uintptr(unsafe.Pointer(c.c)))\n\treturn c\n}", "func (app *controlsTestApplication) ForComboBox() *controls.ComboBoxBuilder {\n\treturn controls.NewComboBoxBuilder(app.ForLabel(), app.rectRenderer)\n}", "func NewSelector(ctx Context) Selector {\n\tstate := getState(ctx)\n\tstate.dispatcher.selectorSequence++\n\treturn NewNamedSelector(ctx, fmt.Sprintf(\"selector-%v\", state.dispatcher.selectorSequence))\n}", "func NewSelector() Selector {\n\treturn internalSelector(nil)\n}", "func newComboUtility(combinator Combinator) *comboUtility {\n\treturn &comboUtility{\n\t\tcombinator: combinator,\n\t\tchildren: bag.New(),\n\t\treset: true,\n\t}\n}", "func createObjectPicker(n int64, distrib string) (ObjectSelector, error) {\n\n\tswitch distrib {\n\tcase ZIPFIAN_OBJECT_PICK:\n\t\tvar x = new(Zipf)\n\t\tx.SetParams(n, 0.8, 99)\n\t\treturn x, nil\n\tcase UNIFORM_OBJECT_PICK:\n\t\tvar y = new(Uniform)\n\t\ty.SetParams(n, 99)\n\t\treturn y, nil\n\t}\n\treturn nil, errors.New(\"Not a valid distribution for object selection\")\n}", "func createObjectPicker(n int64, distrib string) (ObjectSelector, error) {\n\n\tswitch distrib {\n\tcase ZIPFIAN_OBJECT_PICK:\n\t\tvar x = new(Zipf)\n\t\tx.SetParams(n, 0.8, 99)\n\t\treturn x, nil\n\tcase UNIFORM_OBJECT_PICK:\n\t\tvar y = new(Uniform)\n\t\ty.SetParams(n, 99)\n\t\treturn y, nil\n\t}\n\n\tfmt.Println(\"what is the distribution :\", distrib)\n\treturn new(Uniform), errors.New(\"Not a valid distribution for object selection\")\n}", "func NewCFNSelector(prompt Prompter) *CFNSelector {\n\treturn &CFNSelector{\n\t\tprompt: prompt,\n\t}\n}", "func New(opts ...Option) selector.Selector {\n\treturn NewBuilder(opts...).Build()\n}", "func GuiComboBox(bounds Rectangle, text string, active int) int {\n\tctext := C.CString(text)\n\tdefer C.free(unsafe.Pointer(ctext))\n\tcbounds := *bounds.cptr()\n\tres := C.GuiComboBox(cbounds, ctext, C.int(int32(active)))\n\treturn int(int32(res))\n}", "func comboBoxFinalizer(cb *ComboBox) {\n\truntime.SetFinalizer(cb, func(cb *ComboBox) { gobject.Unref(cb) })\n}", "func (t *OpenconfigSystem_System_Logging_Console_Selectors) NewSelector(Facility E_OpenconfigSystemLogging_SYSLOG_FACILITY, Severity E_OpenconfigSystemLogging_SyslogSeverity) (*OpenconfigSystem_System_Logging_Console_Selectors_Selector, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Selector == nil {\n\t\tt.Selector = make(map[OpenconfigSystem_System_Logging_Console_Selectors_Selector_Key]*OpenconfigSystem_System_Logging_Console_Selectors_Selector)\n\t}\n\n\tkey := OpenconfigSystem_System_Logging_Console_Selectors_Selector_Key{\n\t\tFacility: Facility,\n\t\tSeverity: Severity,\n\t}\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Selector[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Selector\", key)\n\t}\n\n\tt.Selector[key] = &OpenconfigSystem_System_Logging_Console_Selectors_Selector{\n\t\tFacility: Facility,\n\t\tSeverity: Severity,\n\t}\n\n\treturn t.Selector[key], nil\n}", "func GuiComboBox(bounds Rectangle, text string, active int32) int32 {\n\tcbounds, _ := *(*C.Rectangle)(unsafe.Pointer(&bounds)), cgoAllocsUnknown\n\ttext = safeString(text)\n\tctext, _ := unpackPCharString(text)\n\tcactive, _ := (C.int)(active), cgoAllocsUnknown\n\t__ret := C.GuiComboBox(cbounds, ctext, cactive)\n\truntime.KeepAlive(text)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "func (t *OpenconfigOfficeAp_System_Logging_Console_Selectors) NewSelector(Facility E_OpenconfigSystemLogging_SYSLOG_FACILITY, Severity E_OpenconfigSystemLogging_SyslogSeverity) (*OpenconfigOfficeAp_System_Logging_Console_Selectors_Selector, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Selector == nil {\n\t\tt.Selector = make(map[OpenconfigOfficeAp_System_Logging_Console_Selectors_Selector_Key]*OpenconfigOfficeAp_System_Logging_Console_Selectors_Selector)\n\t}\n\n\tkey := OpenconfigOfficeAp_System_Logging_Console_Selectors_Selector_Key{\n\t\tFacility: Facility,\n\t\tSeverity: Severity,\n\t}\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Selector[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Selector\", key)\n\t}\n\n\tt.Selector[key] = &OpenconfigOfficeAp_System_Logging_Console_Selectors_Selector{\n\t\tFacility: Facility,\n\t\tSeverity: Severity,\n\t}\n\n\treturn t.Selector[key], nil\n}", "func newChoiceBuilder(choiceDef *ChoiceDef) ChoiceBuilder {\n\treturn &chosenBuilder{\n\t\tchoiceDef: choiceDef,\n\t}\n}", "func SelectorCli(label string, options ...string) (string, error) {\n\ts := promptui.Select{\n\t\tLabel: label,\n\t\tItems: options,\n\t}\n\n\t_, result, err := s.Run()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn result, nil\n}", "func NewNamedSelector(ctx Context, name string) Selector {\n\treturn &selectorImpl{name: name}\n}", "func NewSelectorFilter(filter string) LinkFilter {\n\treturn NewLinkFilter(selectorFilter, selectorFilterCode, filter)\n}", "func NewCmdSelector(f kcmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command {\n\tcmd := set.NewCmdSelector(f, streams)\n\tcmd.Long = setSelectorLong\n\tcmd.Example = setSelectorExample\n\n\treturn cmd\n}", "func NewFromRoundRobinSelector(ss *RoundRobinServerList) *Client {\n\treturn &Client{\n\t\tselector: ss,\n\t\tDisableCAS: false,\n\t}\n}", "func (l *labelInfo) genSelector() clusterservice.Selector {\n\treturn clusterservice.NewSelector().SelectByLabel(\n\t\tl.allLabels(), clusterservice.EQ,\n\t)\n}", "func newSelection(pools *csp.CSPList, opts ...buildOption) *selection {\n\ts := &selection{pools: pools, policies: &policyList{map[priority][]policy{}}}\n\tfor _, o := range opts {\n\t\tif o != nil {\n\t\t\to(s)\n\t\t}\n\t}\n\twithDefaultSelection(s)\n\treturn s\n}", "func NewSelect(table string, columns []string) Select {\n\treturn Select{\n\t\tcolumns: columns,\n\t\tBaseQuery: BaseQuery{table: table},\n\t}\n}", "func (s *Selector) Create(from time.Time) {\n\tdays := make([]int, 31)\n\tfor d := 0; d < 31; d++ { // TODO: Actual number of days / month (change dynamically on selection?).\n\t\tdays[d] = d + 1\n\t}\n\tnumYears := 5\n\tyears := make([]int, numYears)\n\tfor i := 0; i < numYears; i++ {\n\t\tyears[i] = from.Year() - i\n\t}\n\t*s = Selector{\n\t\tSelectedYear: from.Year(),\n\t\tSelectedMonth: from.Month() - 1, // -1 to give [0, 11]\n\t\tSelectedDay: from.Day(),\n\t\tSelectedTime: from.Format(\"15:04\"),\n\t\tDaysInMonth: days,\n\t\tMonths: make([]time.Month, 12),\n\t\tYears: years,\n\t}\n\tfor i := 1; i <= 12; i++ {\n\t\ts.Months[i-1] = time.Month(i)\n\t}\n}", "func GetSelector() *Selector {}", "func (t *OpenconfigSystem_System_Logging_RemoteServers_RemoteServer_Selectors) NewSelector(Facility E_OpenconfigSystemLogging_SYSLOG_FACILITY, Severity E_OpenconfigSystemLogging_SyslogSeverity) (*OpenconfigSystem_System_Logging_RemoteServers_RemoteServer_Selectors_Selector, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Selector == nil {\n\t\tt.Selector = make(map[OpenconfigSystem_System_Logging_RemoteServers_RemoteServer_Selectors_Selector_Key]*OpenconfigSystem_System_Logging_RemoteServers_RemoteServer_Selectors_Selector)\n\t}\n\n\tkey := OpenconfigSystem_System_Logging_RemoteServers_RemoteServer_Selectors_Selector_Key{\n\t\tFacility: Facility,\n\t\tSeverity: Severity,\n\t}\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Selector[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Selector\", key)\n\t}\n\n\tt.Selector[key] = &OpenconfigSystem_System_Logging_RemoteServers_RemoteServer_Selectors_Selector{\n\t\tFacility: Facility,\n\t\tSeverity: Severity,\n\t}\n\n\treturn t.Selector[key], nil\n}", "func (c ComboBox) Items() []Selection {\n\tresult := make([]Selection, len(c))\n\tfor i := range c {\n\t\tresult[i] = Selection{Name: c[i].Name, Value: strconv.Itoa(i + 1)}\n\t}\n\treturn result\n}", "func (b *Builder) Build(info base.PickerBuildInfo) gBalancer.Picker {\n\tif len(info.ReadySCs) == 0 {\n\t\t// Block the RPC until a new picker is available via UpdateState().\n\t\treturn base.NewErrPicker(gBalancer.ErrNoSubConnAvailable)\n\t}\n\n\tnodes := make([]selector.Node, 0)\n\tfor conn, info := range info.ReadySCs {\n\t\tins, _ := info.Address.Attributes.Value(\"rawServiceInstance\").(*registry.ServiceInstance)\n\t\tnodes = append(nodes, &grpcNode{\n\t\t\tNode: selector.NewNode(info.Address.Addr, ins),\n\t\t\tsubConn: conn,\n\t\t})\n\t}\n\tp := &Picker{\n\t\tselector: b.builder.Build(),\n\t}\n\tp.selector.Apply(nodes)\n\treturn p\n}", "func newSelector() map[string]string {\n\treturn map[string]string{selectorKey: string(uuid.NewUUID())}\n}", "func CargaComboMagnitudes(Magnitudes CatalogoModel.CatalogoMgo, ID string) string {\n\ttempl := ``\n\n\tif ID != \"\" {\n\t\ttempl = `<option value=\"\">--SELECCIONE--</option>`\n\t} else {\n\t\ttempl = `<option value=\"\" selected>--SELECCIONE--</option>`\n\t}\n\n\tfor _, v := range Magnitudes.Valores {\n\t\tif ID == v.ID.Hex() {\n\t\t\ttempl += `<option value=\"` + v.ID.Hex() + `\" selected>` + v.Valor + `</option>`\n\t\t} else {\n\t\t\ttempl += `<option value=\"` + v.ID.Hex() + `\">` + v.Valor + `</option>`\n\t\t}\n\t}\n\treturn templ\n}", "func (*nodePickerBuilder) Build(info base.PickerBuildInfo) balancer.V2Picker {\n\tif len(info.ReadySCs) == 0 {\n\t\treturn base.NewErrPickerV2(balancer.ErrNoSubConnAvailable)\n\t}\n\n\tvar scs []balancer.SubConn\n\tfor sc := range info.ReadySCs {\n\t\tscs = append(scs, sc)\n\t}\n\n\treturn &nodePicker{\n\t\tsubConns: scs,\n\t}\n}", "func CargaComboListaCostos(ID string) string {\n\t\t\tListaCostos := GetAll()\n\n\t\t\ttempl := ``\n\n\t\t\tif ID != \"\" {\n\t\t\t\ttempl = `<option value=\"\">--SELECCIONE--</option> `\n\t\t\t} else {\n\t\t\t\ttempl = `<option value=\"\" selected>--SELECCIONE--</option> `\n\t\t\t}\n\n\t\t\tfor _, v := range ListaCostos {\n\t\t\t\tif ID == v.ID.Hex() {\n\t\t\t\t\ttempl += `<option value=\" ` + v.ID.Hex() + `\" selected> ` + v.Nombre + ` </option> `\n\t\t\t\t} else {\n\t\t\t\t\ttempl += `<option value=\" ` + v.ID.Hex() + `\"> ` + v.Nombre + ` </option> `\n\t\t\t\t}\n\n\t\t\t}\n\t\t\treturn templ\n\t\t}", "func GenerateSelector(object CommonInterface) (labels.Selector, error) {\n\tls := &metav1.LabelSelector{\n\t\tMatchLabels: GenerateLabels(object),\n\t}\n\treturn metav1.LabelSelectorAsSelector(ls)\n}", "func GenerateSelector(object CommonInterface) (labels.Selector, error) {\n\tls := &metav1.LabelSelector{\n\t\tMatchLabels: GenerateLabels(object),\n\t}\n\treturn metav1.LabelSelectorAsSelector(ls)\n}", "func CargaComboUnidades(ID string) string {\n\tUnidades := GetAll()\n\n\ttempl := ``\n\n\tif ID != \"\" {\n\t\ttempl = `<option value=\"\">--SELECCIONE--</option>`\n\t} else {\n\t\ttempl = `<option value=\"\" selected>--SELECCIONE--</option>`\n\t}\n\n\tfor _, v := range Unidades {\n\t\tif ID == v.ID.Hex() {\n\t\t\ttempl += `<option value=\"` + v.ID.Hex() + `\" selected>` + v.Magnitud + `</option>`\n\t\t} else {\n\t\t\ttempl += `<option value=\"` + v.ID.Hex() + `\">` + v.Magnitud + `</option>`\n\t\t}\n\n\t}\n\treturn templ\n}", "func New() *Bricker {\n\treturn &Bricker{\n\t\tconnection: make(map[string]connector.Connector),\n\t\tfirst: \"\",\n\t\tuids: make(map[uint32]string),\n\t\tsubscriber: make(map[hash.Hash]map[string]Subscriber),\n\t\tchoosers: make([]uint8, 0)}\n}", "func comboBoxTextFinalizer(ct *ComboBoxText) {\n\truntime.SetFinalizer(ct, func(ct *ComboBoxText) { gobject.Unref(ct) })\n}", "func createSelector(values map[string]string) labels.Selector {\n\tselector := labels.NewSelector()\n\tfor k, v := range values {\n\t\treq, err := labels.NewRequirement(k, \"=\", []string{v})\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tselector = selector.Add(*req)\n\t}\n\n\treturn selector\n}", "func NewSelectorRegex(s *Selector) (*SelectorRegex, error) {\n\tsr := new(SelectorRegex)\n\tvar err error\n\tsr.selector = s\n\tsr.groupRegex, err = regexp.Compile(anchorRegex(s.Gvk.Group))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsr.versionRegex, err = regexp.Compile(anchorRegex(s.Gvk.Version))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsr.kindRegex, err = regexp.Compile(anchorRegex(s.Gvk.Kind))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsr.nameRegex, err = regexp.Compile(anchorRegex(s.Name))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsr.namespaceRegex, err = regexp.Compile(anchorRegex(s.Namespace))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sr, nil\n}", "func NewSelectorCollector(config *Config) *SelectorCollector {\n\tif config == nil {\n\t\treturn nil\n\t}\n\n\tif !config.Verify() || config.Type != COLLECTBYSELECTOR || len(config.ValueRuleMap.Items) < 3 {\n\t\tseelog.Errorf(\"config name:%s is unavailable, please check your collectorConfig.xml\", config.Name)\n\t\treturn nil\n\t}\n\n\tselectorMap := make(map[string][]string)\n\n\tfor _, value := range config.ValueRuleMap.Items {\n\t\tif value.Name == \"\" || value.Rule == \"\" {\n\t\t\tseelog.Errorf(\"config name:%s contains valueRuleMap item with empty name or rule, this item will be ignored.\", config.Name)\n\t\t\tcontinue\n\t\t}\n\n\t\tif value.Name == \"table\" {\n\t\t\tselectorMap[value.Name] = []string{value.Rule}\n\t\t} else if value.Attr != \"\" {\n\t\t\tselectorMap[value.Name] = []string{value.Rule, value.Attr}\n\t\t} else {\n\t\t\tselectorMap[value.Name] = []string{value.Rule}\n\t\t}\n\t}\n\n\t// Most website appear their ip list as table, So table item is required.\n\t// For other situation, you can implement your own method.\n\tif v, ok := selectorMap[\"table\"]; !ok || v[0] == \"\" {\n\t\tseelog.Errorf(\"config name:%s table selector's path should not be empty\", config.Name)\n\t\treturn nil\n\t}\n\n\tparameters := strings.Split(config.UrlParameters, \",\")\n\turls := util.MakeUrls(config.UrlFormat, parameters)\n\treturn &SelectorCollector{\n\t\tconfiguration: config,\n\t\turls: urls,\n\t\tselectorMap: selectorMap,\n\t}\n}", "func NewDefaultSelector(ds datastore.Datastorer) DefaultSelector {\n\treturn DefaultSelector{ds}\n}", "func (t *OpenconfigOfficeAp_System_Logging_RemoteServers_RemoteServer_Selectors) NewSelector(Facility E_OpenconfigSystemLogging_SYSLOG_FACILITY, Severity E_OpenconfigSystemLogging_SyslogSeverity) (*OpenconfigOfficeAp_System_Logging_RemoteServers_RemoteServer_Selectors_Selector, error) {\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Selector == nil {\n\t\tt.Selector = make(map[OpenconfigOfficeAp_System_Logging_RemoteServers_RemoteServer_Selectors_Selector_Key]*OpenconfigOfficeAp_System_Logging_RemoteServers_RemoteServer_Selectors_Selector)\n\t}\n\n\tkey := OpenconfigOfficeAp_System_Logging_RemoteServers_RemoteServer_Selectors_Selector_Key{\n\t\tFacility: Facility,\n\t\tSeverity: Severity,\n\t}\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.Selector[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Selector\", key)\n\t}\n\n\tt.Selector[key] = &OpenconfigOfficeAp_System_Logging_RemoteServers_RemoteServer_Selectors_Selector{\n\t\tFacility: Facility,\n\t\tSeverity: Severity,\n\t}\n\n\treturn t.Selector[key], nil\n}", "func NewArraySelector(array, index Expression) Expression {\n\treturn &arraySelector{\n\t\tarray: array,\n\t\tindex: index,\n\t}\n}", "func NewDynamicSelect(onKillAction func(), channels []ChannelEntry) *DynamicSelect {\n\t// both aggregators, on close notifier, and internal kill chan.\n\ta := make(chan dsWrapper)\n\tp := make(chan dsWrapper)\n\to := make(chan closeWrapper)\n\td := make(chan interface{})\n\n\t// guarded channels\n\tk := make(chan interface{}, 1)\n\tkg := make(chan interface{}, 1)\n\tl := make(chan []ChannelEntry)\n\tlg := make(chan interface{}, 1)\n\n\t// prime the guards.\n\tkg <- unit\n\tlg <- unit\n\n\treturn &DynamicSelect{\n\t\tonKillAction: onKillAction,\n\t\tload: l,\n\t\tloadGuard: lg,\n\t\tchannels: channels,\n\t\taggregator: a,\n\t\talive: true,\n\t\tdone: d,\n\t\tkill: k,\n\t\tkillGuard: kg,\n\t\tkillHeard: false,\n\t\tpriorityAggregator: p,\n\t\tonClose: o,\n\t}\n}", "func Selector(s selector.Selector) Option {\n\treturn func(o *Options) {\n\t\to.Selector = s\n\t}\n}", "func Selector(s selector.Selector) Option {\n\treturn func(o *Options) {\n\t\to.Selector = s\n\t}\n}", "func (c *Combobox) Append(text string) {\n\tctext := C.CString(text)\n\tC.uiComboboxAppend(c.c, ctext)\n\tfreestr(ctext)\n}", "func (p *parser) nextCombo() token.Token {\n\tt := p.next()\n\tt2 := p.next()\n\tif t.Type == token.RIGHT_CARET && t2.Type == token.RIGHT_CARET {\n\t\treturn token.Token{Type: token.RSHIFT, Pos: t.Pos}\n\t}\n\tp.backup(1)\n\treturn t\n}", "func (me TxsdSelectionAnswerTypeSequenceStyleSuggestion) IsCombobox() bool {\n\treturn me.String() == \"combobox\"\n}", "func (c *Combobox) OnSelected(f func(*Combobox)) {\n\tc.onSelected = f\n}", "func NewCBusOptions(connect bool, smart bool, idmon bool, exstat bool, monitor bool, monall bool, pun bool, pcn bool, srchk bool) *_CBusOptions {\n\treturn &_CBusOptions{Connect: connect, Smart: smart, Idmon: idmon, Exstat: exstat, Monitor: monitor, Monall: monall, Pun: pun, Pcn: pcn, Srchk: srchk}\n}", "func NewPicker(store MediumSourceStorer) *Picker {\n\treturn &Picker{\n\t\tstore: store,\n\t}\n}", "func cellRendererComboFinalizer(cl *CellRendererCombo) {\n\truntime.SetFinalizer(cl, func(cl *CellRendererCombo) { gobject.Unref(cl) })\n}", "func NewColorPicker() ColorPicker {\n\timageColors := make(map[string]Color)\n\n\treturn &colorPicker{\n\t\timageColors: imageColors,\n\t}\n}", "func NewDefaultSelector() (*DefaultSelector, error) {\n\n\ts := &DefaultSelector{\n\t\tsources: make(map[string]*source),\n\t}\n\n\treturn s, nil\n}", "func NewAutocompleterFromPool(pool *redis.Pool, name string) *Autocompleter {\n\treturn &Autocompleter{name: name, pool: pool}\n}", "func DefaultCodesSelector() CodesSelector {\n\tvar sel CodesSelector\n\tsel.FieldSelector.Code = \"code\"\n\tsel.FieldSelector.Perms = \"perms\"\n\treturn sel\n}", "func GuiColorPicker(bounds Rectangle, color Color) Color {\n\tccolor := *color.cptr()\n\tcbounds := *bounds.cptr()\n\tres := C.GuiColorPicker(cbounds, ccolor)\n\treturn newColorFromPointer(unsafe.Pointer(&res))\n}", "func createNodeSelector(nodeName string) *v1.NodeSelector {\n\treturn &v1.NodeSelector{\n\t\tNodeSelectorTerms: []v1.NodeSelectorTerm{\n\t\t\tv1.NodeSelectorTerm{\n\t\t\t\tMatchExpressions: []v1.NodeSelectorRequirement{\n\t\t\t\t\tv1.NodeSelectorRequirement{\n\t\t\t\t\t\tKey: \"kubernetes.io/hostname\",\n\t\t\t\t\t\tOperator: v1.NodeSelectorOpIn,\n\t\t\t\t\t\tValues: []string{nodeName},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "func New(prompt string, choices []*Choice) *Selection {\n\treturn &Selection{\n\t\tChoices: choices,\n\t\tPrompt: prompt,\n\t\tFilterPrompt: DefaultFilterPrompt,\n\t\tTemplate: DefaultTemplate,\n\t\tConfirmationTemplate: DefaultConfirmationTemplate,\n\t\tFilter: FilterContainsCaseInsensitive,\n\t\tFilterInputPlaceholderStyle: lipgloss.NewStyle().Foreground(lipgloss.Color(\"240\")),\n\t\tKeyMap: NewDefaultKeyMap(),\n\t\tFilterPlaceholder: DefaultFilterPlaceholder,\n\t\tExtendedTemplateScope: template.FuncMap{},\n\t\tOutput: os.Stdout,\n\t\tInput: os.Stdin,\n\t}\n}", "func (e *exprHelper) NewSelect(operand ast.Expr, field string) ast.Expr {\n\treturn e.exprFactory.NewSelect(e.nextMacroID(), operand, field)\n}", "func (p *parser) peekCombo() token.Token {\n\tt := p.next()\n\tif p.tokensAvailable() > 0 {\n\t\tt2 := p.peek()\n\t\tif t.Type == token.RIGHT_CARET && t2.Type == token.RIGHT_CARET {\n\t\t\tp.backup(1)\n\t\t\treturn token.Token{Type: token.RSHIFT, Pos: t.Pos}\n\t\t}\n\t}\n\tp.backup(1)\n\treturn t\n}", "func NewFieldSelector(base Expression, index int) Expression {\n\treturn &fieldSelector{\n\t\tbase: base,\n\t\tindex: index,\n\t}\n}", "func NewSelectBuilder() *SelectBuilder {\n\treturn &SelectBuilder{}\n}", "func GuiColorPicker(bounds Rectangle, color Color) Color {\n\tcbounds, _ := *(*C.Rectangle)(unsafe.Pointer(&bounds)), cgoAllocsUnknown\n\tccolor, _ := *(*C.Color)(unsafe.Pointer(&color)), cgoAllocsUnknown\n\t__ret := C.GuiColorPicker(cbounds, ccolor)\n\t__v := *newColorRef(unsafe.Pointer(&__ret)).convert()\n\treturn __v\n}", "func init() {\n\tSchemeBuilder.Register(&BucketClass{}, &BucketClassList{})\n}", "func init() {\n\tSchemeBuilder.Register(&BucketClass{}, &BucketClassList{})\n}", "func SelectorLabelsWithComponent(name, instance, component string) map[string]string {\n\tlabels := SelectorLabels(name, instance)\n\tlabels[ApplicationComponentLabelKey] = component\n\n\treturn labels\n}", "func NewCaption(ctx context.Context, uri string) (Caption, error) {\n\n\tu, err := url.Parse(uri)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to parse URI for NewCaption, %w\", err)\n\t}\n\n\tscheme := u.Scheme\n\n\ti, err := captions.Driver(ctx, scheme)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to derive driver for '%s' caption scheme, %w\", scheme, err)\n\t}\n\n\tfn := i.(CaptionInitializeFunc)\n\n\tcaption, err := fn(ctx, uri)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"CaptionInitializeFunc failed, %w\", err)\n\t}\n\n\treturn caption, nil\n}", "func NewPickUp() Pickup {\n p := Pickup{name: \"Pickup\", vehicle: \"Pickup\", speed: 60, capacity: 2, isPrivate: true}\n return p\n}", "func NewSelect(comments Comments, exprs SelectExprs, selectOptions []string, from TableExprs, where *Where, groupBy GroupBy, having *Where) *Select {\n\t////var cache *bool\n\t////var distinct, straightJoinHint, sqlFoundRows bool\n\t//\n\t//for _, option := range selectOptions {\n\t//\tswitch strings.ToLower(option) {\n\t//\tcase DistinctStr:\n\t//\t\tdistinct = true\n\t//\tcase SQLCacheStr:\n\t//\t\ttruth := true\n\t//\t\tcache = &truth\n\t//\tcase SQLNoCacheStr:\n\t//\t\ttruth := false\n\t//\t\tcache = &truth\n\t//\tcase StraightJoinHint:\n\t//\t\tstraightJoinHint = true\n\t//\t\t//case SQLCalcFoundRowsStr:\n\t//\t\t//\tsqlFoundRows = true\n\t//\t}\n\t//}\n\treturn &Select{\n\t\t//Cache: cache,\n\t\tComments: comments,\n\t\t//Distinct: distinct,\n\t\t//StraightJoinHint: straightJoinHint,\n\t\t//SQLCalcFoundRows: sqlFoundRows,\n\t\tSelectExprs: exprs,\n\t\tFrom: from,\n\t\tWhere: where,\n\t\tGroupBy: groupBy,\n\t\tHaving: having,\n\t}\n}", "func newChainClient[C chains.Config, R presenters.ChainResource[C], P TableRenderer, P2 ~[]P](c *Client, name string) ChainClient[C, R, P, P2] {\n\treturn &chainClient[C, R, P, P2]{\n\t\tClient: c,\n\t\tpath: \"/v2/chains/\" + name,\n\t}\n}", "func NewBucket(boptions BucketOptions) (b *Bucket) {\n\tb = new(Bucket)\n\tb.boptions = boptions\n\tb.chs = make(map[string]*Channel, boptions.ChannelSize)\n\treturn\n}", "func MakeSelector(in map[string]string) labels.Selector {\n\tset := make(labels.Set)\n\tfor key, val := range in {\n\t\tset[key] = val\n\t}\n\treturn set.AsSelector()\n}", "func Choice(s *string, choices []string, title, id, class string, valid Validator) (jquery.JQuery, error) {\n\tj := jq(\"<select>\").AddClass(ClassPrefix + \"-choice\").AddClass(class)\n\tj.SetAttr(\"title\", title).SetAttr(\"id\", id)\n\tif *s == \"\" {\n\t\t*s = choices[0]\n\t}\n\tindex := -1\n\tfor i, c := range choices {\n\t\tif c == *s {\n\t\t\tindex = i\n\t\t}\n\t\tj.Append(jq(\"<option>\").SetAttr(\"value\", c).SetText(c))\n\t}\n\tif index == -1 {\n\t\treturn jq(), fmt.Errorf(\"Default of '%s' is not among valid choices\", *s)\n\t}\n\tj.SetData(\"prev\", index)\n\tj.SetProp(\"selectedIndex\", index)\n\tj.Call(jquery.CHANGE, func(event jquery.Event) {\n\t\tnewS := event.Target.Get(\"value\").String()\n\t\tnewIndex := event.Target.Get(\"selectedIndex\").Int()\n\t\tif valid != nil && !valid.Validate(newS) {\n\t\t\tnewIndex = int(j.Data(\"prev\").(float64))\n\t\t\tj.SetProp(\"selectedIndex\", newIndex)\n\t\t}\n\t\t*s = choices[int(newIndex)]\n\t\tj.SetData(\"prev\", newIndex)\n\t})\n\treturn j, nil\n}", "func NewMockisAclSelector_PktSelector(ctrl *gomock.Controller) *MockisAclSelector_PktSelector {\n\tmock := &MockisAclSelector_PktSelector{ctrl: ctrl}\n\tmock.recorder = &MockisAclSelector_PktSelectorMockRecorder{mock}\n\treturn mock\n}", "func (gb *gcpBalancer) regeneratePicker() {\n\tgb.mu.RLock()\n\tdefer gb.mu.RUnlock()\n\n\tif gb.state == connectivity.TransientFailure {\n\t\tgb.picker = newErrPicker(balancer.ErrTransientFailure)\n\t\treturn\n\t}\n\treadyRefs := []*subConnRef{}\n\n\t// Select ready subConns from subConn map.\n\tfor sc, scState := range gb.scStates {\n\t\tif scState == connectivity.Ready {\n\t\t\treadyRefs = append(readyRefs, gb.scRefs[sc])\n\t\t}\n\t}\n\tgb.picker = newGCPPicker(readyRefs, gb)\n}", "func ConstructConsumer(id int, proxy Proxy) Consumer {\n\treturn Consumer{\n\t\tid: id,\n\t\tch: make(chan Widget, MAX_NUM_WIDGETS),\n\t\tproxy: proxy,\n\t}\n}", "func parseSelector(str string) (*types.Selector, error) {\n\tparts := strings.SplitAfterN(str, \":\", 2)\n\tif len(parts) < 2 {\n\t\treturn nil, fmt.Errorf(\"selector \\\"%s\\\" must be formatted as type:value\", str)\n\t}\n\n\ts := &types.Selector{\n\t\t// Strip the trailing delimiter\n\t\tType: strings.TrimSuffix(parts[0], \":\"),\n\t\tValue: parts[1],\n\t}\n\treturn s, nil\n}", "func NewChoice(allowedValues ...string) Choice {\n\treturn Choice{AllowedValues: allowedValues}\n}", "func NewCmdToolboxInstanceSelector(f commandutils.Factory, out io.Writer) *cobra.Command {\n\toptions := &InstanceSelectorOptions{}\n\n\tcommandline := cli.New(\n\t\t\"instance-selector INSTANCE_GROUP\",\n\t\ttoolboxInstanceSelectorShort,\n\t\ttoolboxInstanceSelectorLong,\n\t\ttoolboxInstanceSelectorExample,\n\t\tnil,\n\t)\n\tcommandline.Command.Args = func(cmd *cobra.Command, args []string) error {\n\t\toptions.ClusterName = rootCommand.ClusterName(true)\n\n\t\tif options.ClusterName == \"\" {\n\t\t\treturn fmt.Errorf(\"--name is required\")\n\t\t}\n\n\t\tif len(args) == 0 {\n\t\t\treturn fmt.Errorf(\"must specify name of instance group to create\")\n\t\t}\n\n\t\toptions.InstanceGroupName = args[0]\n\n\t\tif len(args) != 1 {\n\t\t\treturn fmt.Errorf(\"can only create one instance group at a time\")\n\t\t}\n\n\t\tif err := processAndValidateFlags(&commandline); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsetInstanceSelectorOpts(options, &commandline)\n\n\t\treturn nil\n\t}\n\tcommandline.Command.ValidArgsFunction = func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {\n\t\tcommandutils.ConfigureKlogForCompletion()\n\t\tif len(args) == 1 && rootCommand.ClusterName(false) == \"\" {\n\t\t\treturn []string{\"--name\"}, cobra.ShellCompDirectiveNoFileComp\n\t\t}\n\t\treturn nil, cobra.ShellCompDirectiveNoFileComp\n\t}\n\tcommandline.Command.RunE = func(cmd *cobra.Command, args []string) error {\n\t\treturn RunToolboxInstanceSelector(cmd.Context(), f, out, &commandline, options)\n\t}\n\n\tcpuArchs := []string{cpuArchitectureAMD64, cpuArchitectureARM64}\n\tcpuArchDefault := cpuArchitectureAMD64\n\tplacementGroupStrategies := []string{\"cluster\", \"partition\", \"spread\"}\n\tusageClasses := []string{usageClassSpot, usageClassOndemand}\n\tusageClassDefault := usageClassOndemand\n\toutputDefault := \"yaml\"\n\tdryRunDefault := false\n\tclusterAutoscalerDefault := true\n\tnodeCountMinDefault := 1\n\tnodeCountMaxDefault := 10\n\tmaxResultsDefault := 20\n\n\t// Instance Group Node Configurations\n\n\tcommandline.IntFlag(nodeCountMin, nil, &nodeCountMinDefault, \"Minimum number of nodes\")\n\tcommandline.IntFlag(nodeCountMax, nil, &nodeCountMaxDefault, \"Maximum number of nodes\")\n\tcommandline.IntFlag(nodeVolumeSize, nil, nil, \"Instance volume size (in GiB) for nodes\")\n\tcommandline.StringSliceFlag(nodeSecurityGroups, nil, nil, \"Pre-created additional security groups for nodes\")\n\tcommandline.Command.RegisterFlagCompletionFunc(nodeSecurityGroups, completeSecurityGroup)\n\tcommandline.BoolFlag(clusterAutoscaler, nil, &clusterAutoscalerDefault, \"Add auto-discovery tags for cluster-autoscaler to manage the instance-group\")\n\n\t// Aggregate Filters\n\n\tcommandline.StringFlag(instanceTypeBase, nil, nil, \"Base instance type to retrieve similarly specified instance types\", nil)\n\tcommandline.Command.RegisterFlagCompletionFunc(instanceTypeBase, completeMachineType)\n\tcommandline.BoolFlag(flexible, nil, nil, \"Retrieve a group of instance types spanning multiple generations based on opinionated defaults and user overridden resource filters\")\n\tcommandline.IntFlag(instanceGroupCount, nil, nil, \"Number of instance groups to create with different vcpus-to-memory ratios, starting at 1:2 and doubling\")\n\n\t// Raw Filters\n\n\tcommandline.IntMinMaxRangeFlags(vcpus, nil, nil, \"Number of vcpus available to the instance type\")\n\tcommandline.ByteQuantityMinMaxRangeFlags(memory, nil, nil, \"Amount of memory available (Example: 4gb)\")\n\tcommandline.Command.RegisterFlagCompletionFunc(memory, cobra.NoFileCompletions)\n\tcommandline.Command.RegisterFlagCompletionFunc(memory+\"-min\", cobra.NoFileCompletions)\n\tcommandline.Command.RegisterFlagCompletionFunc(memory+\"-max\", cobra.NoFileCompletions)\n\tcommandline.RatioFlag(vcpusToMemoryRatio, nil, nil, \"Ratio of vcpus to memory in MiB. (Example: 1:2)\")\n\tcommandline.Command.RegisterFlagCompletionFunc(vcpusToMemoryRatio, cobra.NoFileCompletions)\n\tcommandline.StringOptionsFlag(cpuArchitecture, nil, &cpuArchDefault, fmt.Sprintf(\"CPU architecture [%s]\", strings.Join(cpuArchs, \", \")), append(cpuArchs, cpuArchitectureX8664))\n\tcommandline.Command.RegisterFlagCompletionFunc(cpuArchitecture, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {\n\t\treturn cpuArchs, cobra.ShellCompDirectiveNoFileComp\n\t})\n\tcommandline.IntMinMaxRangeFlags(gpus, nil, nil, \"Number of GPUs (Example: 4)\")\n\tcommandline.ByteQuantityMinMaxRangeFlags(gpuMemory, nil, nil, \"GPUs' total memory (Example: 4gb)\")\n\tcommandline.Command.RegisterFlagCompletionFunc(gpuMemory, cobra.NoFileCompletions)\n\tcommandline.Command.RegisterFlagCompletionFunc(gpuMemory+\"-min\", cobra.NoFileCompletions)\n\tcommandline.Command.RegisterFlagCompletionFunc(gpuMemory+\"-max\", cobra.NoFileCompletions)\n\tcommandline.StringOptionsFlag(placementGroupStrategy, nil, nil, fmt.Sprintf(\"Placement group strategy: [%s]\", strings.Join(placementGroupStrategies, \", \")), placementGroupStrategies)\n\tcommandline.Command.RegisterFlagCompletionFunc(placementGroupStrategy, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {\n\t\treturn placementGroupStrategies, cobra.ShellCompDirectiveNoFileComp\n\t})\n\tcommandline.StringOptionsFlag(usageClass, nil, &usageClassDefault, fmt.Sprintf(\"Usage class: [%s]\", strings.Join(usageClasses, \", \")), usageClasses)\n\tcommandline.Command.RegisterFlagCompletionFunc(usageClass, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {\n\t\treturn usageClasses, cobra.ShellCompDirectiveNoFileComp\n\t})\n\tcommandline.BoolFlag(enaSupport, nil, nil, \"Instance types where ENA is supported or required\")\n\tcommandline.BoolFlag(burstSupport, nil, nil, \"Burstable instance types\")\n\tcommandline.StringSliceFlag(subnets, nil, nil, \"Subnet(s) in which to create the instance group. One of Availability Zone like eu-west-1a or utility-eu-west-1a,\")\n\tcommandline.Command.RegisterFlagCompletionFunc(subnets, completeClusterSubnet(f, commandline.Flags[subnets].(*[]string)))\n\tcommandline.IntMinMaxRangeFlags(networkInterfaces, nil, nil, \"Number of network interfaces (ENIs) that can be attached to the instance\")\n\tcommandline.RegexFlag(allowList, nil, nil, \"List of allowed instance types to select from w/ regex syntax (Example: m[3-5]\\\\.*)\")\n\tcommandline.Command.RegisterFlagCompletionFunc(allowList, cobra.NoFileCompletions)\n\tcommandline.RegexFlag(denyList, nil, nil, \"List of instance types which should be excluded w/ regex syntax (Example: m[1-2]\\\\.*)\")\n\tcommandline.Command.RegisterFlagCompletionFunc(denyList, cobra.NoFileCompletions)\n\n\t// Output Flags\n\n\tcommandline.IntFlag(maxResults, nil, &maxResultsDefault, \"Maximum number of instance types to return back\")\n\tcommandline.BoolFlag(dryRun, nil, &dryRunDefault, \"Only print the object that would be created, without creating it. This flag can be used to create a cluster YAML or JSON manifest.\")\n\tcommandline.StringFlag(output, commandline.StringMe(\"o\"), &outputDefault, \"Output format. One of json or yaml. Used with the --dry-run flag.\", nil)\n\tcommandline.Command.RegisterFlagCompletionFunc(output, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {\n\t\treturn []string{\"json\", \"yaml\"}, cobra.ShellCompDirectiveNoFileComp\n\t})\n\n\treturn commandline.Command\n}", "func s(name, key string) *corev1.SecretKeySelector {\n\treturn &corev1.SecretKeySelector{\n\t\tKey: key,\n\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\tName: name,\n\t\t},\n\t}\n}", "func NewBuilder(opts ...Option) selector.Builder {\n\tvar option options\n\tfor _, opt := range opts {\n\t\topt(&option)\n\t}\n\treturn &selector.DefaultBuilder{\n\t\tBalancer: &Builder{},\n\t\tNode: &direct.Builder{},\n\t}\n}", "func New(o *Opt) *Client {\n\treturn &Client{\n\t\to: o,\n\t}\n}", "func New(opts ...OptionFunc) Currency {\n\tc := Currency{}\n\tc.applyDefaults()\n\tc.Option(opts...)\n\treturn c\n}", "func (c *Combobox) SetSelected(index int) {\n\tC.uiComboboxSetSelected(c.c, C.int(index))\n}", "func New(opts ...OptionFunc) corev1.Container {\n\tc := &container{}\n\tfor _, o := range opts {\n\t\to(c)\n\t}\n\treturn c.asContainer()\n}", "func getSelectorFromString(str string) (labels.Selector, error) {\n\tlabelSelector, err := v1.ParseToLabelSelector(str)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tselector, err := v1.LabelSelectorAsSelector(labelSelector)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn selector, nil\n}", "func InitBrokers(opts ...OptionFunc) interfaces.Broker {\n\tbrokerInst := new(brokerInstance)\n\tfor _, opt := range opts {\n\t\topt(brokerInst)\n\t}\n\n\treturn brokerInst\n}", "func NewSubscriptionsCompanySubscriptionItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*SubscriptionsCompanySubscriptionItemRequestBuilder) {\n m := &SubscriptionsCompanySubscriptionItemRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/directory/subscriptions/{companySubscription%2Did}{?%24select,%24expand}\", pathParameters),\n }\n return m\n}", "func SelectorBlueprintsBySelectValue(optionTemplates []OptionTemplate, selector string) []PropertyBlueprint {\n\treturn selectorMetadataByFunc(\n\t\toptionTemplates,\n\t\tselector,\n\t\tfunc(optionTemplate OptionTemplate) string {\n\t\t\treturn optionTemplate.SelectValue\n\t\t})\n}", "func NewSelectorWithMinRequired(ec2api ec2iface.EC2API) *AvailabilityZoneSelector {\n\tavoidZones := map[string]bool{}\n\n\treturn &AvailabilityZoneSelector{\n\t\tec2api: ec2api,\n\t\tstrategy: NewMinRequiredNumberRandomStrategy(),\n\t\trules: []ZoneUsageRule{NewZonesToAvoidRule(avoidZones)},\n\t}\n}", "func NewCompaniesCompanyItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*CompaniesCompanyItemRequestBuilder) {\n m := &CompaniesCompanyItemRequestBuilder{\n BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, \"{+baseurl}/financials/companies/{company%2Did}{?%24select,%24expand}\", pathParameters),\n }\n return m\n}", "func NewConCurrency(limit int) *C {\n\treturn &C{\n\t\twg: &sync.WaitGroup{},\n\t\tch: make(chan struct{}, limit),\n\t\tnumber: limit,\n\t}\n}", "func NewPeerPicker(tracker *Tracker, list *memberlist.Memberlist) PeerPicker {\n\treturn PeerPicker{\n\t\ttracker: tracker,\n\t\tourName: list.LocalNode().Name,\n\t}\n}", "func initCbClient(platformBroker cbPlatformBroker) error {\n\tlog.Println(\"[DEBUG] initCbClient - Initializing the ClearBlade client\")\n\n\tcbBroker.client = cb.NewDeviceClientWithAddrs(*(platformBroker.platformURL), *(platformBroker.messagingURL), *(platformBroker.systemKey), *(platformBroker.systemSecret), *(platformBroker.username), *(platformBroker.password))\n\n\tfor err := cbBroker.client.Authenticate(); err != nil; {\n\t\tlog.Printf(\"[ERROR] initCbClient - Error authenticating %s: %s\\n\", platformBroker.name, err.Error())\n\t\tlog.Println(\"[ERROR] initCbClient - Will retry in 1 minute...\")\n\n\t\t// sleep 1 minute\n\t\ttime.Sleep(time.Duration(time.Minute * 1))\n\t\terr = cbBroker.client.Authenticate()\n\t}\n\n\t//Retrieve adapter configuration data\n\tlog.Println(\"[INFO] main - Retrieving adapter configuration...\")\n\tgetAdapterConfig()\n\n\tlog.Println(\"[DEBUG] initCbClient - Initializing MQTT\")\n\tcallbacks := cb.Callbacks{OnConnectionLostCallback: OnConnectLost, OnConnectCallback: OnConnect}\n\tif err := cbBroker.client.InitializeMQTTWithCallback(platformBroker.clientID, \"\", 30, nil, nil, &callbacks); err != nil {\n\t\tlog.Fatalf(\"[FATAL] initCbClient - Unable to initialize MQTT connection with %s: %s\", platformBroker.name, err.Error())\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *Client) Select(dbname string) (client *Client, err error) {\n\tc.mux.RLock()\n\tif c.config.IsEqualDB(dbname) {\n\t\tc.mux.RUnlock()\n\n\t\treturn c, nil\n\t}\n\n\tconfig, err := c.config.NewWithDB(dbname)\n\tif err != nil {\n\t\tc.mux.RUnlock()\n\t\treturn\n\t}\n\n\tname := config.Name()\n\n\t// first, try loading a client from default manager\n\tclient, err = DefaultMgr.NewClientWithLogger(name)\n\tif err == nil {\n\t\tc.mux.RUnlock()\n\n\t\treturn client, nil\n\t}\n\n\tc.mux.RUnlock()\n\n\t// second, register new client for default manager\n\tc.mux.Lock()\n\tdefer c.mux.Unlock()\n\n\tDefaultMgr.Add(name, config)\n\n\treturn DefaultMgr.NewClientWithLogger(name)\n}", "func New(lib io.CUILib) *CUI {\n\tcatList := component.NewListComponent(\"Categories\")\n\ttaskList := component.NewListComponent(\"Tasks\")\n\tstateBar := component.NewTextComponent(\"State\")\n\tdescBox := component.NewTextComponent(\"Description\")\n\tc := &CUI{\n\t\tCUILib: lib,\n\t\tgrid: component.NewGridComponent(\n\t\t\tmap[string]component.InteractiveComponent{\n\t\t\t\tcomponent.DefaultActivated: catList,\n\t\t\t\t\"h\": catList,\n\t\t\t\t\"<Left>\": catList,\n\t\t\t\t\"l\": taskList,\n\t\t\t\t\"<Right>\": taskList,\n\t\t\t},\n\t\t\tui.NewRow(9.0/10,\n\t\t\t\tui.NewCol(2.0/10, catList),\n\t\t\t\tui.NewCol(8.0/10,\n\t\t\t\t\tui.NewRow(5.0/10, taskList),\n\t\t\t\t\tui.NewRow(5.0/10, descBox),\n\t\t\t\t),\n\t\t\t),\n\t\t\tui.NewRow(1.0/10,\n\t\t\t\tui.NewCol(1.0/1, stateBar),\n\t\t\t),\n\t\t),\n\t\ttaskList: taskList,\n\t\tcatList: catList,\n\t\tstateBar: stateBar,\n\t\tdescBox: descBox,\n\t\tcomponents: []component.Component{\n\t\t\ttaskList,\n\t\t\tcatList,\n\t\t},\n\t}\n\treturn c\n}", "func SelectorFromSet(ls Set) Selector {\n\treturn SelectorFromValidatedSet(ls)\n}", "func NewSelectorWithDefaults(ec2api ec2iface.EC2API) *AvailabilityZoneSelector {\n\tavoidZones := map[string]bool{}\n\n\treturn &AvailabilityZoneSelector{\n\t\tec2api: ec2api,\n\t\tstrategy: NewRecommendedNumberRandomStrategy(),\n\t\trules: []ZoneUsageRule{NewZonesToAvoidRule(avoidZones)},\n\t}\n}" ]
[ "0.6398603", "0.60383093", "0.54640085", "0.5442935", "0.5414595", "0.52587616", "0.5221845", "0.519968", "0.5109608", "0.50104415", "0.49778694", "0.49130982", "0.49013048", "0.47839087", "0.47829998", "0.47143096", "0.47012314", "0.4693571", "0.4685004", "0.46644437", "0.46361268", "0.46007046", "0.45777676", "0.4559086", "0.45439368", "0.45267153", "0.4523236", "0.45232326", "0.45106873", "0.45029345", "0.45025072", "0.44884554", "0.44765624", "0.44765624", "0.4468099", "0.4454933", "0.445182", "0.44454074", "0.44342172", "0.4427904", "0.43926176", "0.43811917", "0.4356124", "0.4339909", "0.43117428", "0.43117428", "0.42903942", "0.42817962", "0.42759323", "0.42707092", "0.42583355", "0.42518604", "0.42463866", "0.4245053", "0.42434102", "0.42254323", "0.41862598", "0.41434732", "0.4134076", "0.41203836", "0.4091885", "0.40773317", "0.40670443", "0.4066715", "0.4064195", "0.40531164", "0.40531164", "0.4047968", "0.40330186", "0.40287432", "0.40186417", "0.3997915", "0.3996922", "0.39865598", "0.3971232", "0.39640373", "0.39636365", "0.3961921", "0.39563188", "0.3945611", "0.39426902", "0.3938693", "0.39359984", "0.39253768", "0.39229873", "0.39219952", "0.3917672", "0.39174914", "0.39151517", "0.39111117", "0.3909353", "0.38984233", "0.38924092", "0.388894", "0.38824466", "0.386233", "0.38613844", "0.3858908", "0.38565004", "0.3847688" ]
0.8261668
0
branchName takes the root directory and relative path to the directory and returns the branch name
branchName принимает корневую директорию и относительный путь к директории и возвращает имя ветки
func branchName(root, dirRelPath, openAPIFileName string) string { name := filepath.Base(dirRelPath) _, err := os.Stat(filepath.Join(root, dirRelPath, openAPIFileName)) if !os.IsNotExist(err) { // add Pkg: prefix indicating that it is a separate package as it has // openAPIFile return fmt.Sprintf("Pkg: %s", name) } return name }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (g *github) GetBranchName() string { return g.branchName }", "func (o FunctionBuildConfigSourceRepoSourceOutput) BranchName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FunctionBuildConfigSourceRepoSource) *string { return v.BranchName }).(pulumi.StringPtrOutput)\n}", "func (ref RefName) BranchName() string {\n\treturn ref.nameWithoutPrefix(BranchPrefix)\n}", "func (o TriggerBuildSourceRepoSourceOutput) BranchName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v TriggerBuildSourceRepoSource) *string { return v.BranchName }).(pulumi.StringPtrOutput)\n}", "func (o FunctionBuildConfigSourceRepoSourcePtrOutput) BranchName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *FunctionBuildConfigSourceRepoSource) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.BranchName\n\t}).(pulumi.StringPtrOutput)\n}", "func (o TriggerBuildSourceRepoSourcePtrOutput) BranchName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TriggerBuildSourceRepoSource) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.BranchName\n\t}).(pulumi.StringPtrOutput)\n}", "func gitBranchName() string {\n\t// branch name variable set by Github Actions\n\tif branch, isset := os.LookupEnv(\"GITHUB_HEAD_REF\"); isset && branch != \"\" {\n\t\treturn \"origin/\" + branch\n\t}\n\tif branch, isset := os.LookupEnv(\"GITHUB_REF\"); isset && branch != \"\" {\n\t\treturn \"origin/\" + strings.TrimPrefix(branch, \"refs/heads/\")\n\t}\n\tbranch := getCmdOutput(\"git rev-parse --abbrev-ref HEAD\")\n\treturn branch\n}", "func (p *PipelineActivity) BranchName() string {\n\tpipelineName := p.Spec.Pipeline\n\tif pipelineName == \"\" {\n\t\treturn \"\"\n\t}\n\tpaths := strings.Split(pipelineName, \"/\")\n\tbranch := paths[len(paths)-1]\n\tp.Spec.GitBranch = branch\n\treturn branch\n}", "func branchName() (string, string) {\n\tbranch := gitBranchName()\n\treleaseName := strings.TrimPrefix(branch, \"origin/\")\n\n\treturn releaseName, branch\n}", "func Branch() string {\n\treturn run.Capture(\"git rev-parse --abbrev-ref HEAD\")\n}", "func (g *GitLocal) Branch(dir string) (string, error) {\n\treturn g.GitCLI.Branch(dir)\n}", "func GitBranch(dir string) (branch string, err error) {\n\tcmd := Cmd(dir, \"git rev-parse --abbrev-ref HEAD\")\n\tout, err := cmd.Output()\n\tif err != nil {\n\t\treturn\n\t}\n\tbranch = strings.TrimSpace(string(out))\n\tif branch == \"HEAD\" {\n\t\terr = ErrGitDetached\n\t}\n\treturn\n}", "func (c *config) branch(name string) (output string, err error) {\n\tlog.Printf(\"creating branch: %v\", name)\n\n\tdefaultCommand := []string{\"branch\", name}\n\n\treturn c.command(defaultCommand...)\n\n}", "func (s *splicer) branch(name string) error {\n\treturn s.gitCall(\"checkout\", \"-B\", name, \"master\")\n}", "func (o TriggerTriggerTemplateOutput) BranchName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v TriggerTriggerTemplate) *string { return v.BranchName }).(pulumi.StringPtrOutput)\n}", "func (self *Repository) Branch(path string) error { return nil }", "func (o TriggerTriggerTemplatePtrOutput) BranchName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TriggerTriggerTemplate) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.BranchName\n\t}).(pulumi.StringPtrOutput)\n}", "func GetBranchFromRef(ref string) string {\n\tparts := strings.Split(ref, \"/\")\n\treturn strings.Join(parts[2:], \"/\")\n}", "func (st *buildStatus) branch() string {\n\tif st.SubRev != \"\" {\n\t\treturn st.SubRevBranch\n\t}\n\treturn st.RevBranch\n}", "func GetCurrentBranch() string {\n\tcmd := exec.Command(\"git\", \"branch\")\n\tvar out bytes.Buffer\n\tcmd.Stdout = &out\n\tcmd.Run()\n\tlines := strings.Split(out.String(), \"\\n\")\n\tfor _, line := range lines {\n\t\tif strings.Contains(line, \"*\") {\n\t\t\tbranch := strings.Replace(line, \"*\", \"\", -1)\n\t\t\tbranch = strings.TrimSpace(branch)\n\t\t\treturn branch\n\t\t}\n\t}\n\treturn \"\"\n}", "func (ge *GollumEvent) BranchName() string {\n\treturn ge.raw.Payload[\"ref\"].(string)\n}", "func GitBranch(e *editarea.EditArea) string {\n\tcmdOut, err := exec.Command(\"git\", \"rev-parse\", \"--abbrev-ref\", \"HEAD\").Output()\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn string(cmdOut)\n}", "func (self *StatusCommands) BranchBeingRebased() string {\n\tfor _, dir := range []string{\"rebase-merge\", \"rebase-apply\"} {\n\t\tif bytesContent, err := os.ReadFile(filepath.Join(self.repoPaths.WorktreeGitDirPath(), dir, \"head-name\")); err == nil {\n\t\t\treturn strings.TrimSpace(string(bytesContent))\n\t\t}\n\t}\n\treturn \"\"\n}", "func BranchNameFromArchiveRefDir(dir string) (data.BranchName, bool) {\n\tif !strings.HasPrefix(dir, ArchivedRevDirPrefix) {\n\t\treturn \"\", false\n\t}\n\n\trev, err := strconv.ParseInt(dir[len(ArchivedRevDirPrefix):], 10, 64)\n\tif err != nil {\n\t\treturn \"\", false\n\t}\n\n\treturn data.MakeRevBranchName(kbfsmd.Revision(rev)), true\n}", "func (r *Repo) BranchRef() string {\n\treturn fmt.Sprintf(\"refs/heads/%s\", r.Branch)\n}", "func binName(rel, prefix, repoRoot string) string {\n\treturn pathtools.RelBaseName(rel, prefix, repoRoot)\n}", "func GetDefaultBranchName(dbOwner, dbFolder, dbName string) (branchName string, err error) {\n\tdbQuery := `\n\t\tSELECT db.default_branch\n\t\tFROM sqlite_databases AS db\n\t\tWHERE db.user_id = (\n\t\t\t\tSELECT user_id\n\t\t\t\tFROM users\n\t\t\t\tWHERE lower(user_name) = lower($1)\n\t\t\t)\n\t\t\tAND db.folder = $2\n\t\t\tAND db.db_name = $3\n\t\t\tAND db.is_deleted = false`\n\tvar b pgx.NullString\n\terr = pdb.QueryRow(dbQuery, dbOwner, dbFolder, dbName).Scan(&b)\n\tif err != nil {\n\t\tif err != pgx.ErrNoRows {\n\t\t\tlog.Printf(\"Error when retrieving default branch name for database '%s%s%s': %v\\n\", dbOwner,\n\t\t\t\tdbFolder, dbName, err)\n\t\t} else {\n\t\t\tlog.Printf(\"No default branch name exists for database '%s%s%s'. This shouldn't happen\\n\", dbOwner,\n\t\t\t\tdbFolder, dbName)\n\t\t}\n\t\treturn\n\t}\n\tif b.Valid {\n\t\tbranchName = b.String\n\t}\n\treturn\n}", "func (o TriggerGithubPullRequestOutput) Branch() pulumi.StringOutput {\n\treturn o.ApplyT(func(v TriggerGithubPullRequest) string { return v.Branch }).(pulumi.StringOutput)\n}", "func GetTrackingBranchName(branchName string) string {\n\treturn \"origin/\" + branchName\n}", "func (prrce *PullRequestReviewCommentEvent) BranchName() string {\n\treturn \"\"\n}", "func checkBranchName(repo *models.Repository, name string) error {\n\tgitRepo, err := git.OpenRepository(repo.RepoPath())\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer gitRepo.Close()\n\n\tbranches, _, err := GetBranches(repo, 0, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, branch := range branches {\n\t\tif branch.Name == name {\n\t\t\treturn models.ErrBranchAlreadyExists{\n\t\t\t\tBranchName: branch.Name,\n\t\t\t}\n\t\t} else if (len(branch.Name) < len(name) && branch.Name+\"/\" == name[0:len(branch.Name)+1]) ||\n\t\t\t(len(branch.Name) > len(name) && name+\"/\" == branch.Name[0:len(name)+1]) {\n\t\t\treturn models.ErrBranchNameConflict{\n\t\t\t\tBranchName: branch.Name,\n\t\t\t}\n\t\t}\n\t}\n\n\tif _, err := gitRepo.GetTag(name); err == nil {\n\t\treturn models.ErrTagAlreadyExists{\n\t\t\tTagName: name,\n\t\t}\n\t}\n\n\treturn nil\n}", "func youtrackBranchNameFilter(branchName string) string {\n\tmatches := youtrackBranchNameRegEx.FindStringSubmatch(branchName)\n\tif matches != nil {\n\t\treturn fmt.Sprintf(\"%s-%s\", strings.ToUpper(matches[1]), matches[2])\n\t}\n\treturn \"\"\n}", "func (machine *Dishwasher) Branch(branch string) {\r\n machine.Append(func() (string, error) {\r\n // IDEA take care of special cases, such as the master branch\r\n // checking if branch exists\r\n branchExists := false\r\n output, oops := RunCommand(\"git branch\")\r\n if oops != nil {\r\n return string(output), oops\r\n }\r\n branches := strings.Split(output, \"\\n\")\r\n for _, rawMaybe := range branches {\r\n maybe := strings.Replace(rawMaybe, \"*\", \" \", -1)\r\n maybe = strings.TrimSpace(maybe)\r\n if maybe == branch {\r\n branchExists = true\r\n }\r\n }\r\n\r\n // creating branch if necessary\r\n if !branchExists {\r\n branchCmd := fmt.Sprintf(\"git branch %s\", branch)\r\n output, oops = RunCommand(branchCmd)\r\n if oops != nil {\r\n return string(output), oops\r\n }\r\n }\r\n\r\n // switching to target branch\r\n checkoutCmd := fmt.Sprintf(\"git checkout %s\", branch)\r\n output, oops = RunCommand(checkoutCmd)\r\n return string(output), oops\r\n })\r\n}", "func (o TriggerGithubPullRequestPtrOutput) Branch() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TriggerGithubPullRequest) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Branch\n\t}).(pulumi.StringPtrOutput)\n}", "func (n Node) CrumbName(url string) string {\n\treturn filepath.Base(url)\n}", "func checkoutLocalBranch(config *GitXargsConfig, ref *plumbing.Reference, worktree *git.Worktree, remoteRepository *github.Repository, localRepository *git.Repository) (plumbing.ReferenceName, error) {\n\tlogger := logging.GetLogger(\"git-xargs\")\n\n\t// BranchName is a global variable that is set in cmd/root.go. It is override-able by the operator via the --branch-name or -b flag. It defaults to \"git-xargs\"\n\n\tbranchName := plumbing.NewBranchReferenceName(config.BranchName)\n\tlogger.WithFields(logrus.Fields{\n\t\t\"Branch Name\": branchName,\n\t\t\"Repo\": remoteRepository.GetName(),\n\t}).Debug(\"Created branch\")\n\n\t// Create a branch specific to the multi repo script runner\n\tco := &git.CheckoutOptions{\n\t\tHash: ref.Hash(),\n\t\tBranch: branchName,\n\t\tCreate: true,\n\t}\n\n\t// Attempt to checkout the new tool-specific branch on which the supplied command will be executed\n\tcheckoutErr := worktree.Checkout(co)\n\n\tif checkoutErr != nil {\n\t\tlogger.WithFields(logrus.Fields{\n\t\t\t\"Error\": checkoutErr,\n\t\t\t\"Repo\": remoteRepository.GetName(),\n\t\t}).Debug(\"Error creating new branch\")\n\n\t\t// Track the error checking out the branch\n\t\tconfig.Stats.TrackSingle(BranchCheckoutFailed, remoteRepository)\n\n\t\treturn branchName, errors.WithStackTrace(checkoutErr)\n\t}\n\n\t// Pull latest code from remote branch if it exists to avoid fast-forwarding errors\n\tpo := &git.PullOptions{\n\t\tRemoteName: \"origin\",\n\t\tReferenceName: branchName,\n\t\tAuth: &http.BasicAuth{\n\t\t\tUsername: remoteRepository.GetOwner().GetLogin(),\n\t\t\tPassword: os.Getenv(\"GITHUB_OAUTH_TOKEN\"),\n\t\t},\n\t\tProgress: os.Stdout,\n\t}\n\n\tpullErr := worktree.Pull(po)\n\n\tif pullErr != nil {\n\n\t\tif pullErr == plumbing.ErrReferenceNotFound {\n\t\t\t// The suppled branch just doesn't exist yet on the remote - this is not a fatal error and will\n\t\t\t// allow the new branch to be pushed in pushLocalBranch\n\t\t\tconfig.Stats.TrackSingle(BranchRemoteDidntExistYet, remoteRepository)\n\t\t\treturn branchName, nil\n\t\t}\n\n\t\t// Track the error pulling the latest from the remote branch\n\t\tconfig.Stats.TrackSingle(BranchRemotePullFailed, remoteRepository)\n\n\t\treturn branchName, errors.WithStackTrace(pullErr)\n\t}\n\n\treturn branchName, nil\n}", "func (ref RefName) ForBranchName() string {\n\treturn ref.nameWithoutPrefix(ForPrefix)\n}", "func RenameBranch(repo *models.Repository, doer *user_model.User, gitRepo *git.Repository, from, to string) (string, error) {\n\tif from == to {\n\t\treturn \"target_exist\", nil\n\t}\n\n\tif gitRepo.IsBranchExist(to) {\n\t\treturn \"target_exist\", nil\n\t}\n\n\tif !gitRepo.IsBranchExist(from) {\n\t\treturn \"from_not_exist\", nil\n\t}\n\n\tif err := repo.RenameBranch(from, to, func(isDefault bool) error {\n\t\terr2 := gitRepo.RenameBranch(from, to)\n\t\tif err2 != nil {\n\t\t\treturn err2\n\t\t}\n\n\t\tif isDefault {\n\t\t\terr2 = gitRepo.SetDefaultBranch(to)\n\t\t\tif err2 != nil {\n\t\t\t\treturn err2\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tnotification.NotifyDeleteRef(doer, repo, \"branch\", \"refs/heads/\"+from)\n\tnotification.NotifyCreateRef(doer, repo, \"branch\", \"refs/heads/\"+to)\n\n\treturn \"\", nil\n}", "func validateBranchName(version string) error {\n\tcmd := exec.Command(\"git\", \"branch\", \"--show-current\")\n\tstdout, err := cmd.Output()\n\tif err != nil {\n\t\treturn err\n\t}\n\tbranch := strings.TrimSpace(string(stdout))\n\texpectedBranch := fmt.Sprintf(\"gopls-release-branch.%s\", strings.TrimPrefix(semver.MajorMinor(version), \"v\"))\n\tif branch != expectedBranch {\n\t\treturn fmt.Errorf(\"expected release branch %s, got %s\", expectedBranch, branch)\n\t}\n\treturn nil\n}", "func GenBranchName(text string) string {\n\ttoRemove := regexp.MustCompile(\"(^[[:^alnum:]]+|[[:^alnum:]]$)\")\n\ttoUnderscore := regexp.MustCompile(\"[[:^alnum:]]+\")\n\tbranchName := strings.ToLower(text)\n\tbranchName = toRemove.ReplaceAllString(branchName, \"\")\n\tbranchName = toUnderscore.ReplaceAllString(branchName, \"_\")\n\treturn branchName\n}", "func (s *Service) SetBranchName(v string) *Service {\n\ts.BranchName = &v\n\treturn s\n}", "func GetGitBranch(dir string) (string, error) {\n\treturn runGit(dir, \"rev-parse\", \"--abbrev-ref\", \"HEAD\")\n}", "func getModuleBranch(moduleName string, proj *model.Project) (string, error) {\n\t// find the module of the patch\n\tfor _, module := range proj.Modules {\n\t\tif module.Name == moduleName {\n\t\t\treturn module.Branch, nil\n\t\t}\n\t}\n\treturn \"\", errors.Errorf(\"module '%s' unknown or not found\", moduleName)\n}", "func GetAppBranch() (string, error) {\n\tcmdArgs := []string{\"rev-parse\", \"--abbrev-ref\", \"HEAD\"}\n\tbranchName, err := exec.Command(\"/usr/bin/git\", cmdArgs...).Output()\n\treturn string(branchName), err\n}", "func (t *Tree) Branch(b string) error {\n\tfor name, leaf := range t.packageMap {\n\t\tif leaf.IsRoot() {\n\t\t\tif err := t.branchBetween(name, b); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func getBranch(urlstr string, branch string, dst string) {\n\tlog.Debugf(\"Getting branch %s\", branch)\n\tif sh.DirExists(dst) {\n\t\tlog.Infof(\"Folder exists, skipping cloning %s\", dst)\n\t\tlog.Infof(\"Checking out %s\", branch)\n\t\tif oldPwd := sh.Pwd(); !(oldPwd == dst) {\n\t\t\tsh.Cd(dst)\n\t\t\tsh.SetE(exec.Command(\"git\", \"checkout\", branch))\n\t\t\tsh.Cd(oldPwd)\n\t\t} else {\n\t\t\tsh.SetE(exec.Command(\"git\", \"checkout\", branch))\n\t\t}\n\t} else {\n\t\tlog.Infof(\"Cloning into %s\", dst)\n\t\tcloneCmd := []string{\n\t\t\t// don't verify the ssl certificate (I've run into trouble with it)\n\t\t\t\"-c\", \"http.sslVerify=false\",\n\t\t\t\"clone\", urlstr, dst,\n\t\t\t// only clone this branch, with two commits of history\n\t\t\t\"--branch=\" + branch, \"--single-branch\",\n\t\t\t\"--depth\", \"2\",\n\t\t}\n\t\tsh.SetE(exec.Command(\"git\", cloneCmd...))\n\t}\n\tlog.Debugf(\"Done getting branch %s\", branch)\n}", "func GetBranch() string {\n\tv := Map[\"branch\"]\n\treturn v\n}", "func GenerateBranch() string {\n\treturn \"z9hG4bK-\" + GenerateTag()\n}", "func (c *CreateEvent) GetMasterBranch() string {\n\tif c == nil || c.MasterBranch == nil {\n\t\treturn \"\"\n\t}\n\treturn *c.MasterBranch\n}", "func CurrentBranch() (string, error) {\n\tresult, err := exec.Command(\"git\", \"symbolic-ref\", \"--short\", \"HEAD\").Output()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn strings.TrimSpace(string(result)), nil\n}", "func (o TriggerGithubPushOutput) Branch() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v TriggerGithubPush) *string { return v.Branch }).(pulumi.StringPtrOutput)\n}", "func (o TriggerGithubPushPtrOutput) Branch() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TriggerGithubPush) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Branch\n\t}).(pulumi.StringPtrOutput)\n}", "func (v Repository) TrackBranch(branch string) string {\n\tif branch == \"\" {\n\t\tbranch = v.GetHead()\n\t}\n\tif branch == \"\" {\n\t\treturn \"\"\n\t}\n\tbranch = strings.TrimPrefix(branch, config.RefsHeads)\n\n\tcfg := v.Config()\n\treturn strings.TrimPrefix(cfg.Get(\"branch.\"+branch+\".merge\"), config.RefsHeads)\n}", "func (s *CreateServiceInput) SetBranchName(v string) *CreateServiceInput {\n\ts.BranchName = &v\n\treturn s\n}", "func (r ReferenceName) IsBranch() bool {\n\treturn strings.HasPrefix(string(r), refHeadPrefix)\n}", "func GetMatchingBranch(input string) (string, error) {\n\tvar foundBranches []string\n\n\tloweredInput := strings.ToLower(input)\n\tfor _, branch := range GetBranches() {\n\t\tloweredBranch := strings.ToLower(branch)\n\t\tif loweredBranch == loweredInput {\n\t\t\treturn input, nil\n\t\t} else if strings.Contains(loweredBranch, loweredInput) {\n\t\t\tfoundBranches = append(foundBranches, branch)\n\t\t}\n\t}\n\n\tif len(foundBranches) > 1 {\n\t\treturn \"\", fmt.Errorf(\"multiple branches found: %s\", strings.Join(foundBranches, \", \"))\n\t} else if len(foundBranches) == 1 {\n\t\treturn foundBranches[0], nil\n\t}\n\n\tlog.Errorf(\"Branch not found: %s. We have %d known branches\", input, len(branches))\n\n\t// branch not found in local list, but maybe it was created recently -> let's try it if jenkins accept it\n\treturn input, nil\n}", "func (r *Repository) GetMasterBranch() string {\n\tif r == nil || r.MasterBranch == nil {\n\t\treturn \"\"\n\t}\n\treturn *r.MasterBranch\n}", "func (b Branch) Name() string {\n\treturn polName\n}", "func (p *PushEventRepository) GetMasterBranch() string {\n\tif p == nil || p.MasterBranch == nil {\n\t\treturn \"\"\n\t}\n\treturn *p.MasterBranch\n}", "func refFromCtx(ctx context.Context) string {\n\treturn DefaultBranchName\n}", "func Basename(path string) string {\n\treturn filepath.Base(path)\n}", "func createBranch(r *git.Repository, branchName string) error {\n\twt, err := r.Worktree()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = wt.Checkout(&git.CheckoutOptions{\n\t\tBranch: plumbing.NewBranchReferenceName(branchName),\n\t\tCreate: true,\n\t})\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), \"already exists\") {\n\t\t\tlogDebug(\"Reusing branch \" + branchName)\n\t\t\treturn wt.Checkout(&git.CheckoutOptions{\n\t\t\t\tBranch: plumbing.NewBranchReferenceName(branchName),\n\t\t\t\tCreate: false,\n\t\t\t})\n\t\t}\n\t\treturn err\n\t}\n\tlogDebug(\"Creating branch with name \" + branchName)\n\treturn err\n}", "func (novis *Novis) GetBranch(name string) *Branch {\n\treturn novis.Get(name)\n}", "func BranchHeadRoot(ctx context.Context, db *doltdb.DoltDB, brName string) (*doltdb.RootValue, error) {\n\tcs, err := doltdb.NewCommitSpec(brName)\n\tif err != nil {\n\t\treturn nil, doltdb.RootValueUnreadable{RootType: doltdb.HeadRoot, Cause: err}\n\t}\n\n\tcm, err := db.Resolve(ctx, cs, nil)\n\tif err != nil {\n\t\treturn nil, doltdb.RootValueUnreadable{RootType: doltdb.HeadRoot, Cause: err}\n\t}\n\n\tbranchRoot, err := cm.GetRootValue(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn branchRoot, nil\n}", "func (r *RepositoryContentFileOptions) GetBranch() string {\n\tif r == nil || r.Branch == nil {\n\t\treturn \"\"\n\t}\n\treturn *r.Branch\n}", "func CurrentBranchByRoot(ctx context.Context, dEnv *env.DoltEnv, replay ReplayRootFn, nerf NeedsRebaseFn) error {\n\treplayCommit := wrapReplayRootFn(replay)\n\theadRef, err := dEnv.RepoStateReader().CWBHeadRef()\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn rebaseRefs(ctx, dEnv.DbData(), replayCommit, nerf, headRef)\n}", "func (u GitlabUpstream) BranchURL(repoURL *url.URL, branch string) (string, error) {\n\tif branch != \"master\" {\n\t\trepoURL.Path = repoURL.Path + \"/-/tree/\" + branch\n\t}\n\treturn repoURL.String(), nil\n}", "func Basename(file string) string {\n\treturn path.Base(file)\n}", "func branchPropertiesFromName(name string) (string, string, color.Attribute) {\n\tif strings.Contains(name, \"feature/\") {\n\t\treturn \"feature\", \"develop\", color.FgGreen\n\t} else if strings.Contains(name, \"bugfix/\") {\n\t\treturn \"bugfix\", \"develop\", color.FgYellow\n\t} else if strings.Contains(name, \"hotfix/\") {\n\t\treturn \"hotfix\", \"master\", color.FgRed\n\t}\n\treturn \"other\", name, color.FgWhite\n}", "func (h *branchesService) determineCommitBranch(\n\trepo *Repo, c *Commit, branchesChildren map[string][]string,\n) *Branch {\n\t// At this point, if a commit c has possible branches in c.Branches[], they will all be\n\t// live git branches. However, on return the c.Branches[] may contain deleted or ambiguous\n\t// branches as well\n\n\tif branch := h.hasOnlyOneBranch(c); branch != nil {\n\t\t// Commit only has one branch, it must have been an actual branch tip originally, use that\n\t\treturn branch\n\t} else if branch := h.isLocalRemoteBranch(c); branch != nil {\n\t\t// Commit has only local and its remote branch, prefer remote remote branch\n\t\treturn branch\n\t} else if branch := h.hasParentChildSetBranch(c, branchesChildren); branch != nil {\n\t\t// The commit has several possible branches, and one is set as parent of the others by the user\n\t\treturn branch\n\t} else if branch := h.hasChildrenPriorityBranch(c, branchesChildren); branch != nil {\n\t\t// The commit has several possible branches, and one of the children's branches is set as the\n\t\t// the parent branch of the other children's branches\n\t\treturn branch\n\t} else if branch := h.isSameChildrenBranches(c); branch != nil {\n\t\t// Commit has no branch but has 2 children with same branch\n\t\treturn branch\n\t} else if branch := h.isMergedDeletedRemoteBranchTip(repo, c); branch != nil {\n\t\t// Commit has no branch and no children, but has a merge child, the commit is a tip\n\t\t// of a deleted branch. It might be a deleted remote branch. Lets try determine branch name\n\t\t// based on merge child's subject or use a generic branch name based on commit id\n\t\treturn branch\n\t} else if branch := h.isMergedDeletedBranchTip(repo, c); branch != nil {\n\t\t// Commit has no branch and no children, but has a merge child, the commit is a tip\n\t\t// of a deleted remote branch, lets try determine branch name based on merge child's\n\t\t// subject or use a generic branch name based on commit id\n\t\treturn branch\n\t} else if branch := h.hasOneChildInDeletedBranch(c); branch != nil {\n\t\t// Commit is middle commit in a deleted branch with only one child above, use same branch\n\t\treturn branch\n\t} else if branch := h.hasOneChildWithLikelyBranch(c); branch != nil {\n\t\t// Commit multiple possible git branches but has one child, which has a likely known branch, use same branch\n\t\treturn branch\n\t} else if branch := h.hasMainBranch(c); branch != nil {\n\t\t// Commit, has several possible branches, and one is in the priority list, e.g. main, master, ...\n\t\treturn branch\n\t} else if branch := h.hasBranchNameInSubject(repo, c); branch != nil {\n\t\t// A branch name could be parsed form the commit subject or a child subject.\n\t\t// The commit will be set to that branch and also if above (first child) commits have\n\t\t// ambiguous branches, the will be reset to same branch as well. This will 'repair' branch\n\t\t// when a parsable commit subjects are encountered.\n\t\treturn branch\n\t} else if branch := h.hasOnlyOneChild(c); branch != nil {\n\t\t// Commit has one child commit and not merge commits, reuse that child commit branch\n\t\treturn branch\n\t} else if branch := h.isChildAmbiguousBranch(c); branch != nil {\n\t\t// one of the commit children is a ambiguous branch, reuse same ambiguous branch\n\t\treturn branch\n\t}\n\n\t// Commit, has several possible branches, and we could not determine which branch is best,\n\t// create a new ambiguous branch. Later commits may fix this by parsing subjects of later\n\t// commits, or the user has to manually set the branch.\n\treturn repo.addAmbiguousBranch(c)\n}", "func (r *Repository) GetDefaultBranch() string {\n\tif r == nil || r.DefaultBranch == nil {\n\t\treturn \"\"\n\t}\n\treturn *r.DefaultBranch\n}", "func refFromCtx(ctx context.Context) string {\n\treturn depot.DefaultBranchName\n}", "func CurrentBranch(ctx context.Context, dEnv *env.DoltEnv, replay ReplayCommitFn, nerf NeedsRebaseFn) error {\n\theadRef, err := dEnv.RepoStateReader().CWBHeadRef()\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn rebaseRefs(ctx, dEnv.DbData(), replay, nerf, headRef)\n}", "func (v Repository) LocalTrackBranch(branch string) string {\n\tif branch == \"\" {\n\t\tbranch = v.GetHead()\n\t}\n\tif branch == \"\" {\n\t\treturn \"\"\n\t}\n\tbranch = strings.TrimPrefix(branch, config.RefsHeads)\n\n\tcfg := v.Config()\n\ttrack := strings.TrimPrefix(cfg.Get(\"branch.\"+branch+\".merge\"), config.RefsHeads)\n\tremote := cfg.Get(\"branch.\" + branch + \".remote\")\n\tif remote == \"\" || track == \"\" {\n\t\treturn \"\"\n\t}\n\treturn v.RemoteMatchingBranch(remote, track)\n}", "func (a *Action) GetBranch() string {\n\treturn strings.TrimPrefix(a.RefName, git.BranchPrefix)\n}", "func branchChangeID(br string) string {\n\tout, err := exec.Command(\"git\", \"show\", br, \"--\").CombinedOutput()\n\tif err != nil {\n\t\tlog.Printf(\"Error running git show %v: %v: %s\", br, err, out)\n\t}\n\tif m := changeRx.FindSubmatch(out); m != nil {\n\t\treturn string(m[1])\n\t}\n\treturn \"\"\n}", "func (g *GitUtil) GetBranch() (string, error) {\n\tref, err := g.Repository.Head()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif !ref.Name().IsBranch() {\n\t\tbranches, err := g.Repository.Branches()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tvar currentBranch string\n\t\tfound := branches.ForEach(func(p *plumbing.Reference) error {\n\n\t\t\tif p.Name().IsBranch() && p.Name().Short() != \"origin\" {\n\t\t\t\tcurrentBranch = p.Name().Short()\n\t\t\t\treturn fmt.Errorf(\"break\")\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\n\t\tif found != nil {\n\t\t\tlog.Debugf(\"Found branch from HEAD %s\", currentBranch)\n\t\t\treturn currentBranch, nil\n\t\t}\n\n\t\treturn \"\", fmt.Errorf(\"no branch found, found %s, please checkout a branch (git checkout -b <BRANCH>)\", ref.Name().String())\n\t}\n\tlog.Debugf(\"Found branch %s\", ref.Name().Short())\n\treturn ref.Name().Short(), nil\n}", "func branchGit() {\n\n}", "func GitBranch(tb testing.TB, branch string) {\n\ttb.Helper()\n\tout, err := fakeGit(\"branch\", branch)\n\trequire.NoError(tb, err)\n\trequire.Empty(tb, out)\n}", "func (o RegistryTaskSourceTriggerOutput) Branch() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RegistryTaskSourceTrigger) *string { return v.Branch }).(pulumi.StringPtrOutput)\n}", "func IsBranch(name string) bool {\n\treturn plumbing.ReferenceName(name).IsBranch()\n}", "func GetBranchSha(branchName string) string {\n\treturn command.New(\"git\", \"rev-parse\", branchName).Output()\n}", "func commitLogFileName(rootPath, name string) string {\n\treturn fmt.Sprintf(\"%s/%s.hnsw.commitlog\", rootPath, name)\n}", "func GetBranch(name string) *Branch {\n\treturn novis.Get(name)\n}", "func (s RepositoryBranch) String() string {\n\treturn awsutil.Prettify(s)\n}", "func BuildBranch(branch string) error {\n\tcurrDir, err := os.Getwd()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := buildSetup(cloneDir, branch); err != nil {\n\t\treturn err\n\t}\n\treturn buildAndClean(currDir, cloneDir)\n}", "func (r *Repository) Name() string {\n\tre := regexp.MustCompile(\"/([^/]*)\\\\.git$\")\n\tmatch := re.FindStringSubmatch(r.Git)\n\tif len(match) > 0 {\n\t\treturn match[1]\n\t}\n\n\treturn \"\"\n}", "func mergeBranch(c *cli.Context) error {\n\tif !dit.CheckDitFolderPresent() {\n\t\treturn ErrNotInitialized\n\t}\n\tif c.NArg() == 0 {\n\t\treturn ErrIncorrectOperands\n\t}\n\theadHash := dit.ReadHeadBranch(c.Args().First())\n\tmergedCommit, _ := dit.GetCommit(headHash)\n\tcurrentCommit := dit.GetHeadCommit()\n\tsplitCommit := dit.GetLCA(currentCommit.CommitID, mergedCommit.CommitID)\n\tif splitCommit.CommitID == mergedCommit.CommitID {\n\t\tfmt.Println(\"Given branch is an ancestor of the current branch.\")\n\t\treturn nil\n\t}\n\tif splitCommit.CommitID == currentCommit.CommitID {\n\t\tif err := dit.ApplyCommitToWD(currentCommit, mergedCommit); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdit.ResetIndex()\n\t\trefsHead := dit.GetRefsHead()\n\t\tif err := ioutil.WriteFile(path.Join(config.RootPath, refsHead), []byte(mergedCommit.CommitID), config.DefaultFilePerm); err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed to Set HEAD to the new commit\")\n\t\t}\n\t\tfmt.Println(\"Current branch fast-forwared to \", mergedCommit.CommitID)\n\t\treturn nil\n\t}\n\n\tcurrentIndex, err := dit.ReadIndex()\n\tif err != nil {\n\t\tcurrentIndex = &dit.Index{\n\t\t\tStagedFiles: make(map[string]string),\n\t\t\tRemovedFiles: make(map[string]bool),\n\t\t}\n\t}\n\tfileMap := dit.JoinMapString(currentCommit.Blob, mergedCommit.Blob)\n\tisConflict := false\n\tconflictedFiles := []string{}\n\t// first rule\n\tfor fileName := range fileMap {\n\t\tcurrentFileHash, isCurrentTracked := currentCommit.Blob[fileName]\n\t\tsplitFileHash, isSplitTracked := splitCommit.Blob[fileName]\n\t\tmergeFileHash, isMergedTracked := mergedCommit.Blob[fileName]\n\t\tswitch {\n\t\t// File tracked at split point and in current head\n\t\tcase isSplitTracked && isCurrentTracked && isMergedTracked:\n\t\t\tif (splitFileHash != mergeFileHash) && (splitFileHash == currentFileHash) {\n\t\t\t\t// Any files that have been modified in the given branch since the split point,\n\t\t\t\t// but not modified in the current branch since the split point should be changed\n\t\t\t\t// to their versions in the given branch (checked out from the commit at the front of the given branch).\n\t\t\t\t// These files should then all be automatically staged.\n\t\t\t\tblob, _ := dit.GetBlob(mergeFileHash)\n\t\t\t\tif err := dit.OverwriteFileWithBlob(blob, fileName); err != nil {\n\t\t\t\t\treturn errors.Wrapf(err, \"Failed to overwrite %s \\n\", fileName)\n\t\t\t\t}\n\t\t\t\tcurrentIndex.StagedFiles[fileName] = mergeFileHash\n\t\t\t} else if (splitFileHash != mergeFileHash) && (splitFileHash != currentFileHash) && (currentFileHash != mergeFileHash) {\n\t\t\t\t// \"Modified in different ways\" can mean that the contents of both are changed and different from other\n\t\t\t\tblobHead, _ := dit.GetBlob(currentFileHash)\n\t\t\t\tblobMerge, _ := dit.GetBlob(mergeFileHash)\n\t\t\t\tif err := dit.OverwriteFileWithConflictedBlob(blobHead, blobMerge, fileName); err != nil {\n\t\t\t\t\treturn errors.Wrapf(err, \"Failed to overwrite %s \\n\", fileName)\n\t\t\t\t}\n\t\t\t}\n\t\tcase isSplitTracked && isCurrentTracked && !isMergedTracked:\n\t\t\t// Any files present at the split point, unmodified in the current branch branch, and\n\t\t\t// absent in the given branch should be removed (and untracked).\n\t\t\tif splitFileHash == currentFileHash {\n\t\t\t\tcurrentIndex.RemovedFiles[fileName] = true\n\t\t\t\tos.Remove(fileName)\n\t\t\t} else if splitFileHash != currentFileHash {\n\t\t\t\tfmt.Println(fileName, \" Conflict\")\n\t\t\t\tblobHead, _ := dit.GetBlob(currentFileHash)\n\t\t\t\tblobMerge, _ := dit.GetBlob(mergeFileHash)\n\t\t\t\tif err := dit.OverwriteFileWithConflictedBlob(blobHead, blobMerge, fileName); err != nil {\n\t\t\t\t\treturn errors.Wrapf(err, \"Failed to overwrite %s \\n\", fileName)\n\t\t\t\t}\n\t\t\t}\n\t\tcase isSplitTracked && !isCurrentTracked && isMergedTracked:\n\t\t\tif splitFileHash != mergeFileHash {\n\t\t\t\tfmt.Println(fileName, \" Conflict\")\n\t\t\t\tblobHead, _ := dit.GetBlob(currentFileHash)\n\t\t\t\tblobMerge, _ := dit.GetBlob(mergeFileHash)\n\t\t\t\tif err := dit.OverwriteFileWithConflictedBlob(blobHead, blobMerge, fileName); err != nil {\n\t\t\t\t\treturn errors.Wrapf(err, \"Failed to overwrite %s \\n\", fileName)\n\t\t\t\t}\n\t\t\t}\n\t\tcase isSplitTracked && !isCurrentTracked && !isMergedTracked:\n\t\tcase !isSplitTracked && isCurrentTracked && isMergedTracked:\n\t\t\tif currentFileHash != mergeFileHash {\n\t\t\t\tfmt.Println(fileName, \" Conflict\")\n\t\t\t\tblobHead, _ := dit.GetBlob(currentFileHash)\n\t\t\t\tblobMerge, _ := dit.GetBlob(mergeFileHash)\n\t\t\t\tif err := dit.OverwriteFileWithConflictedBlob(blobHead, blobMerge, fileName); err != nil {\n\t\t\t\t\treturn errors.Wrapf(err, \"Failed to overwrite %s \\n\", fileName)\n\t\t\t\t}\n\t\t\t}\n\t\tcase !isSplitTracked && isCurrentTracked && !isMergedTracked:\n\t\tcase !isSplitTracked && !isCurrentTracked && isMergedTracked:\n\t\t\t// Any files that were not present at the split point and are present only\n\t\t\t// in the given branch should be checked out and staged.\n\t\t\tblob, _ := dit.GetBlob(mergeFileHash)\n\t\t\tif err := dit.OverwriteFileWithBlob(blob, fileName); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"Failed to overwrite %s \\n\", fileName)\n\t\t\t}\n\t\t\tcurrentIndex.StagedFiles[fileName] = mergeFileHash\n\t\tcase !isSplitTracked && !isCurrentTracked && !isMergedTracked:\n\t\t}\n\t}\n\tif isConflict {\n\t\tfmt.Println(\"Encountered a merge conflict.\")\n\t\tfmt.Println(\"Conflicted Files : \", conflictedFiles)\n\t\treturn nil\n\t}\n\t// Create a commit\n\treturn nil\n}", "func (o BranchProtectionOutput) Branch() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *BranchProtection) pulumi.StringOutput { return v.Branch }).(pulumi.StringOutput)\n}", "func TestGitCommandCurrentBranchName(t *testing.T) {\n\ttype scenario struct {\n\t\ttestName string\n\t\tcommand func(string, ...string) *exec.Cmd\n\t\ttest func(string, string, error)\n\t}\n\n\tscenarios := []scenario{\n\t\t{\n\t\t\t\"says we are on the master branch if we are\",\n\t\t\tfunc(cmd string, args ...string) *exec.Cmd {\n\t\t\t\tassert.Equal(t, \"git\", cmd)\n\t\t\t\treturn secureexec.Command(\"echo\", \"master\")\n\t\t\t},\n\t\t\tfunc(name string, displayname string, err error) {\n\t\t\t\tassert.NoError(t, err)\n\t\t\t\tassert.EqualValues(t, \"master\", name)\n\t\t\t\tassert.EqualValues(t, \"master\", displayname)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"falls back to git `git branch --contains` if symbolic-ref fails\",\n\t\t\tfunc(cmd string, args ...string) *exec.Cmd {\n\t\t\t\tassert.EqualValues(t, \"git\", cmd)\n\n\t\t\t\tswitch args[0] {\n\t\t\t\tcase \"symbolic-ref\":\n\t\t\t\t\tassert.EqualValues(t, []string{\"symbolic-ref\", \"--short\", \"HEAD\"}, args)\n\t\t\t\t\treturn secureexec.Command(\"test\")\n\t\t\t\tcase \"branch\":\n\t\t\t\t\tassert.EqualValues(t, []string{\"branch\", \"--contains\"}, args)\n\t\t\t\t\treturn secureexec.Command(\"echo\", \"* master\")\n\t\t\t\t}\n\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tfunc(name string, displayname string, err error) {\n\t\t\t\tassert.NoError(t, err)\n\t\t\t\tassert.EqualValues(t, \"master\", name)\n\t\t\t\tassert.EqualValues(t, \"master\", displayname)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"handles a detached head\",\n\t\t\tfunc(cmd string, args ...string) *exec.Cmd {\n\t\t\t\tassert.EqualValues(t, \"git\", cmd)\n\n\t\t\t\tswitch args[0] {\n\t\t\t\tcase \"symbolic-ref\":\n\t\t\t\t\tassert.EqualValues(t, []string{\"symbolic-ref\", \"--short\", \"HEAD\"}, args)\n\t\t\t\t\treturn secureexec.Command(\"test\")\n\t\t\t\tcase \"branch\":\n\t\t\t\t\tassert.EqualValues(t, []string{\"branch\", \"--contains\"}, args)\n\t\t\t\t\treturn secureexec.Command(\"echo\", \"* (HEAD detached at 123abcd)\")\n\t\t\t\t}\n\n\t\t\t\treturn nil\n\t\t\t},\n\t\t\tfunc(name string, displayname string, err error) {\n\t\t\t\tassert.NoError(t, err)\n\t\t\t\tassert.EqualValues(t, \"123abcd\", name)\n\t\t\t\tassert.EqualValues(t, \"(HEAD detached at 123abcd)\", displayname)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"bubbles up error if there is one\",\n\t\t\tfunc(cmd string, args ...string) *exec.Cmd {\n\t\t\t\tassert.Equal(t, \"git\", cmd)\n\t\t\t\treturn secureexec.Command(\"test\")\n\t\t\t},\n\t\t\tfunc(name string, displayname string, err error) {\n\t\t\t\tassert.Error(t, err)\n\t\t\t\tassert.EqualValues(t, \"\", name)\n\t\t\t\tassert.EqualValues(t, \"\", displayname)\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, s := range scenarios {\n\t\tt.Run(s.testName, func(t *testing.T) {\n\t\t\tgitCmd := NewDummyGitCommand()\n\t\t\tgitCmd.OSCommand.Command = s.command\n\t\t\ts.test(gitCmd.CurrentBranchName())\n\t\t})\n\t}\n}", "func packageFilename(pwd, relativePath string) string {\n\tfullPath := filepath.Join(pwd, relativePath)\n\treturn strings.TrimPrefix(strings.TrimPrefix(fullPath, filepath.Join(gopath(), \"src\")), \"/\")\n}", "func NewBranchReferenceName(name string) ReferenceName {\n\treturn ReferenceName(refHeadPrefix + name)\n}", "func dirName(filename string) string {\n\tif !strings.HasSuffix(filename, \"/\") {\n\t\tfilename += \"/\"\n\t}\n\treturn filename\n}", "func (g *GitLab) BranchHead(ctx context.Context, u *model.User, r *model.Repo, branch string) (string, error) {\n\ttoken := common.UserToken(ctx, r, u)\n\tclient, err := newClient(g.url, token, g.SkipVerify)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t_repo, err := g.getProject(ctx, client, r.Owner, r.Name)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tb, _, err := client.Branches.GetBranch(_repo.ID, branch, gitlab.WithContext(ctx))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn b.Commit.ID, nil\n}", "func (v Branch) ShortName() string {\n\treturn strings.TrimPrefix(v.Name, config.RefsHeads)\n}", "func (c *CheckSuite) GetHeadBranch() string {\n\tif c == nil || c.HeadBranch == nil {\n\t\treturn \"\"\n\t}\n\treturn *c.HeadBranch\n}", "func getRepoName(dir string) (string, error) {\n\tr, err := git.PlainOpen(dir)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error opening git dir %s: %w\", dir, err)\n\t}\n\trm, err := r.Remote(defaultRemote)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error finding remote %s in git dir %s: %w\", defaultRemote, dir, err)\n\t}\n\n\t// validate remote URL\n\tremoteURL, err := url.Parse(rm.Config().URLs[0])\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error parsing remote URL: %w\", err)\n\t}\n\ttrimmedRemotePath := strings.TrimSuffix(remoteURL.Path, \"/\")\n\tsplitRemotePath := strings.Split(trimmedRemotePath, \"/\")\n\t// expect path to be /owner/repo\n\tif len(splitRemotePath) != 3 {\n\t\treturn \"\", fmt.Errorf(\"expected owner/repo, got %s\", trimmedRemotePath)\n\t}\n\treturn splitRemotePath[len(splitRemotePath)-1], nil\n}", "func Branch(branch string) GitOptions {\n\treturn func(o *options) error {\n\t\to.branch = branch\n\t\treturn nil\n\t}\n}", "func isMainBranch(br string) bool {\n\treturn br == \"master\" || strings.HasPrefix(br, \"dev.\")\n}", "func (p *Project) GetDefaultBranch() (string, error) {\n\tcmd := exec.Command(\"git\", \"remote\", \"show\", \"origin\")\n\tcmd.Dir = workdir.ProjectDir(p.Name)\n\treader, err := stdoutStderrReader(cmd, nil)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tbuf := new(bytes.Buffer)\n\tbuf.ReadFrom(reader)\n\tstdout := buf.String()\n\tre := regexp.MustCompile(\"HEAD branch: (\\\\S+)\")\n\tgroup := re.FindStringSubmatch(stdout)\n\n\treturn group[1], nil\n}" ]
[ "0.68889207", "0.6779807", "0.67637867", "0.6708616", "0.66863376", "0.6600948", "0.6599172", "0.656859", "0.65478766", "0.6514856", "0.6429341", "0.63615274", "0.6339297", "0.628713", "0.6250935", "0.6203753", "0.61460423", "0.61223817", "0.60922194", "0.60919046", "0.6079676", "0.60549384", "0.5982161", "0.5962964", "0.5946766", "0.5924643", "0.59219044", "0.5902689", "0.58879274", "0.58367586", "0.57895786", "0.5785761", "0.5775609", "0.5719136", "0.56891394", "0.5687745", "0.564978", "0.563795", "0.5632848", "0.5629636", "0.56295073", "0.56246454", "0.5581682", "0.5549915", "0.55417436", "0.5540002", "0.5501593", "0.54947114", "0.54943687", "0.5492059", "0.54674023", "0.5466856", "0.54464006", "0.5420409", "0.54165983", "0.5406866", "0.5405447", "0.53832155", "0.5378979", "0.5363275", "0.5349607", "0.53382355", "0.53282845", "0.53241587", "0.53059524", "0.530512", "0.5291353", "0.52899945", "0.5289596", "0.528023", "0.5252154", "0.5247498", "0.52463794", "0.52351296", "0.5226568", "0.5224793", "0.52168113", "0.5215356", "0.5194293", "0.51683617", "0.5168172", "0.51665545", "0.5155848", "0.51553106", "0.51019365", "0.50959575", "0.50954014", "0.5094241", "0.5090418", "0.5090399", "0.5085443", "0.50778556", "0.5073105", "0.50722057", "0.5045385", "0.50427115", "0.5040441", "0.50375175", "0.502713", "0.5023958" ]
0.75781703
0
graphStructure writes the tree using owners for structure
graphStructure записывает дерево с использованием владельцев для структуры
func (p TreeWriter) graphStructure(nodes []*yaml.RNode) error { resourceToOwner := map[string]*node{} root := &node{} // index each of the nodes by their owner for _, n := range nodes { ownerVal, err := ownerToString(n) if err != nil { return err } var owner *node if ownerVal == "" { // no owner -- attach to the root owner = root } else { // owner found -- attach to the owner var found bool owner, found = resourceToOwner[ownerVal] if !found { // initialize the owner if not found resourceToOwner[ownerVal] = &node{p: p} owner = resourceToOwner[ownerVal] } } nodeVal, err := nodeToString(n) if err != nil { return err } val, found := resourceToOwner[nodeVal] if !found { // initialize the node if not found -- may have already been initialized if it // is the owner of another node resourceToOwner[nodeVal] = &node{p: p} val = resourceToOwner[nodeVal] } val.RNode = n owner.children = append(owner.children, val) } for k, v := range resourceToOwner { if v.RNode == nil { return fmt.Errorf( "owner '%s' not found in input, but found as an owner of input objects", k) } } // print the tree tree := treeprint.New() if err := root.Tree(tree); err != nil { return err } _, err := io.WriteString(p.Writer, tree.String()) return err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (q *Qualifier) Graph(w io.Writer) {\n\tfmt.Fprintf(w, \"digraph {\\n\")\n\tq.root.Graph(w, 0, \"[root]\")\n\tfmt.Fprintf(w, \"}\\n\")\n}", "func WriteTree(writer io.Writer, hierarchy *Hierarchy, includeEmpty bool) {\n\ttree := assembleTree(hierarchy)\n\tkeys := make([]string, len(tree))\n\ti := 0\n\tfor k := range tree {\n\t\tkeys[i] = k\n\t\ti++\n\t}\n\tsort.Strings(keys)\n\tfor _, key := range keys {\n\t\tb := tree[key]\n\t\twriteBranch(writer, b, \"\", hierarchy, includeEmpty)\n\t}\n}", "func (p *GameTree) writeTree(w *bufio.Writer, n TreeNodeIdx, needs bool, nMov int, nMovPerLine int) (err error) {\n\tdefer u(tr(\"writeTree\"))\n\tif needs == true {\n\t\tif nMov > 0 {\n\t\t\terr = w.WriteByte('\\n')\n\t\t\tnMov = 0\n\t\t}\n\t\terr = w.WriteByte('(')\n\t}\n\tif err == nil {\n\t\tif nMov == nMovPerLine {\n\t\t\terr = w.WriteByte('\\n')\n\t\t\tnMov = 0\n\t\t}\n\t\terr = w.WriteByte(';')\n\t\t// write the node\n\t\ttyp := p.treeNodes[n].TNodType\n\t\tswitch typ {\n\t\tcase GameInfoNode:\n\t\t\t// fmt.Println(\"writing GameInfoNode\\n\")\n\t\t\terr = p.writeProperties(w, n, true)\n\t\tcase InteriorNode:\n\t\t\t// fmt.Println(\"writing InteriorNode\\n\")\n\t\t\terr = p.writeProperties(w, n, false)\n\t\tcase BlackMoveNode:\n\t\t\t_, err = w.WriteString(\"B[\")\n\t\t\t_, err = w.Write(SGFCoords(ah.NodeLoc(p.treeNodes[n].propListOrNodeLoc), p.IsFF4()))\n\t\t\terr = w.WriteByte(']')\n\t\t\tnMov += 1\n\t\tcase WhiteMoveNode:\n\t\t\t_, err = w.WriteString(\"W[\")\n\t\t\t_, err = w.Write(SGFCoords(ah.NodeLoc(p.treeNodes[n].propListOrNodeLoc), p.IsFF4()))\n\t\t\terr = w.WriteByte(']')\n\t\t\tnMov += 1\n\t\tdefault:\n\t\t\tfmt.Println(\"*** unsupported TreeNodeType in writeTree\")\n\t\t\terr = errors.New(\"writeTree: unsupported TreeNodeType\" + strconv.FormatInt(int64(typ), 10))\n\t\t\treturn err\n\t\t}\n\t\tif err == nil {\n\t\t\t// write the children\n\t\t\tlastCh := p.treeNodes[n].Children\n\t\t\tif lastCh != nilTreeNodeIdx && err == nil {\n\t\t\t\tch := p.treeNodes[lastCh].NextSib\n\t\t\t\tchNeeds := (lastCh != ch)\n\t\t\t\terr = p.writeTree(w, ch, chNeeds, nMov, nMovPerLine)\n\t\t\t\tfor ch != lastCh && err == nil {\n\t\t\t\t\tch = p.treeNodes[ch].NextSib\n\t\t\t\t\t//\t\t\t\t\tnMov += 1\n\t\t\t\t\terr = p.writeTree(w, ch, chNeeds, nMov, nMovPerLine)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (err == nil) && (needs == true) {\n\t\t\t\terr = w.WriteByte(')')\n\t\t\t}\n\t\t}\n\t}\n\treturn err\n}", "func Marshal(g *graph.DirectedGraph) ([]byte, error) {\n\tvar b bytes.Buffer\n\n\t// Static graph configuration attributes\n\n\tb.WriteString(\"strict digraph bridge {\\n\")\n\tb.WriteByte('\\n')\n\tb.WriteString(\"graph [\\n\")\n\tb.WriteString(\" rankdir=LR\\n\")\n\tb.WriteString(\"]\\n\")\n\tb.WriteByte('\\n')\n\tb.WriteString(\"node [\\n\")\n\tb.WriteString(\" fontname=\\\"Helvetica\\\"\\n\")\n\tb.WriteString(\" shape=plain\\n\")\n\tb.WriteString(\"]\\n\")\n\tb.WriteByte('\\n')\n\n\t// Vertices\n\n\t// Index of vertices already converted to node, for faster access\n\t// during sorting of edges.\n\t// The keys used in the map are also the ones used in the graph.DirectedGraph\n\tvertIndex := make(map[interface{}]*node)\n\n\tsortedNodes := make(nodeList, 0, len(g.Vertices()))\n\tfor k, v := range g.Vertices() {\n\t\tn := graphVertexToNode(v)\n\t\tvertIndex[k] = n\n\n\t\tsortedNodes = append(sortedNodes, n)\n\t\tsort.Sort(sortedNodes)\n\t}\n\n\tfor _, n := range sortedNodes {\n\t\tdotN, err := n.marshalDOT()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"marshaling node to DOT: %w\", err)\n\t\t}\n\t\tb.Write(dotN)\n\t}\n\n\tb.WriteByte('\\n')\n\n\t// Edges\n\n\tsortedDownEdges := make(downEdgesList, 0, len(g.DownEdges()))\n\tfor tailVertKey, headVerts := range g.DownEdges() {\n\t\ttailNode := vertIndex[tailVertKey]\n\n\t\tsortedHeadNodes := make(nodeList, 0, len(headVerts))\n\t\tfor headVertKey := range headVerts {\n\t\t\tsortedHeadNodes = append(sortedHeadNodes, vertIndex[headVertKey])\n\t\t}\n\t\tsort.Sort(sortedHeadNodes)\n\n\t\tsortedDownEdges = append(sortedDownEdges, downEdges{\n\t\t\ttail: tailNode,\n\t\t\theads: sortedHeadNodes,\n\t\t})\n\t}\n\tsort.Sort(sortedDownEdges)\n\n\tfor _, e := range sortedDownEdges {\n\t\tb.WriteString(e.tail.id() + \" -> {\")\n\t\tfor _, h := range e.heads {\n\t\t\tb.WriteByte(' ')\n\t\t\tb.WriteString(h.id())\n\t\t}\n\t\tb.WriteString(\" }\\n\")\n\t}\n\n\tb.WriteByte('\\n')\n\n\tb.WriteString(\"}\\n\")\n\n\treturn b.Bytes(), nil\n}", "func (p TreeWriter) Write(nodes []*yaml.RNode) error {\n\tswitch p.Structure {\n\tcase TreeStructurePackage:\n\t\treturn p.packageStructure(nodes)\n\tcase TreeStructureGraph:\n\t\treturn p.graphStructure(nodes)\n\t}\n\n\t// If any resource has an owner reference, default to the graph structure. Otherwise, use package structure.\n\tfor _, node := range nodes {\n\t\tif owners, _ := node.Pipe(yaml.Lookup(\"metadata\", \"ownerReferences\")); owners != nil {\n\t\t\treturn p.graphStructure(nodes)\n\t\t}\n\t}\n\treturn p.packageStructure(nodes)\n}", "func writeJSON(search string, fileName string, nodeArr []nodeJSONStruct, edgeArr []edgeStruct, searchArr []*admin.Group) {\n var (\n jsonFile *os.File\n encoder *json.Encoder\n )\n\n if nodeArr != nil && edges.arr != nil {\n jsonFile = createJSONFile(outputJSONParentsDir, fileName)\n defer jsonFile.Close() \n\n // https://medium.com/eaciit-engineering/better-way-to-read-and-write-json-file-in-golang-9d575b7254f2 \n // also https://www.golangprograms.com/golang-writing-struct-to-json-file.html\n encoder = json.NewEncoder(jsonFile)\n encoder.Encode(parentsJSONStruct{SearchIdentity: search, NodeArr: nodeArr, EdgeArr: edgeArr})\n\n } else if searchArr != nil {\n jsonFile = createJSONFile(outputJSONSearchDir, fileName)\n defer jsonFile.Close() \n\n // https://medium.com/eaciit-engineering/better-way-to-read-and-write-json-file-in-golang-9d575b7254f2 \n // also https://www.golangprograms.com/golang-writing-struct-to-json-file.html\n encoder = json.NewEncoder(jsonFile)\n encoder.Encode(searchJSONStruct{SearchPrefix: search, GroupArr: searchArr})\n }\n}", "func (n *NetworkBuilder) NetworkGraph(w io.Writer) error {\n\tnodes := make(map[string]dot.Node)\n\tnodesByID := make(map[string]dot.Node)\n\tgraph := dot.NewGraph(dot.Directed)\n\n\tfor _, nr := range n.NetResources {\n\t\tnode := graph.Node(strings.Join([]string{nr.NodeId, nr.Iprange.String()}, \"\\n\")).Box()\n\t\t// set special style for \"hidden\" nodes\n\t\tif len(nr.PubEndpoints) == 0 {\n\t\t\tnode.Attr(\"style\", \"dashed\")\n\t\t\tnode.Attr(\"color\", \"blue\")\n\t\t\tgraph.AddToSameRank(\"hidden nodes\", node)\n\t\t}\n\t\tnodes[nr.WireguardPublicKey] = node\n\t\tnodesByID[nr.NodeId] = node\n\t}\n\n\t// add external access\n\tfor _, ea := range n.AccessPoints {\n\t\tnode := graph.Node(strings.Join([]string{\"External network\", ea.Subnet.String()}, \"\\n\")).Box()\n\t\t// set style for hidden nodes\n\t\tnode.Attr(\"style\", \"dashed\")\n\t\tnode.Attr(\"color\", \"green\")\n\t\tgraph.AddToSameRank(\"external access\", node)\n\t\t// add link to access point\n\t\tedge := graph.Edge(node, nodesByID[ea.NodeID], n.Iprange.String())\n\t\tif ea.IP4 {\n\t\t\tedge.Attr(\"color\", \"blue\")\n\t\t}\n\t\tnodes[ea.WGPublicKey] = node\n\t}\n\n\tfor _, nr := range n.NetResources {\n\t\tfor _, peer := range nr.Peers {\n\t\t\tallowedIPs := make([]string, 0, len(peer.AllowedIprange)/2)\n\t\t\tfor _, aip := range peer.AllowedIprange {\n\t\t\t\tif !isCGN(aip) {\n\t\t\t\t\tallowedIPs = append(allowedIPs, aip.String())\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tedge := graph.Edge(nodes[nr.WireguardPublicKey], nodes[peer.PublicKey], strings.Join(allowedIPs, \"\\n\"))\n\t\t\tif peer.Endpoint == \"\" {\n\t\t\t\t// connections to this peer are IPv4 -> blue, and can not be initiated by this node -> dashed\n\t\t\t\tedge.Attr(\"color\", \"blue\").Attr(\"style\", \"dashed\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif net.ParseIP(peer.Endpoint[:strings.LastIndex(peer.Endpoint, \":\")]).To4() != nil {\n\t\t\t\t// IPv4 connection -> blue\n\t\t\t\tedge.Attr(\"color\", \"blue\")\n\t\t\t}\n\t\t}\n\t}\n\n\tgraph.Write(w)\n\treturn nil\n}", "func (t *BPTree) WriteNodes(rwMode RWMode, syncEnable bool, flag int) error {\n\tvar (\n\t\tn *Node\n\t\ti int\n\t\terr error\n\t)\n\n\tfd, err := os.OpenFile(t.Filepath, os.O_CREATE|os.O_RDWR, 0644)\n\tdefer fd.Close()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tqueue = nil\n\n\tenqueue(t.root)\n\n\tfor queue != nil {\n\t\tn = dequeue()\n\n\t\t_, err := t.WriteNode(n, -1, syncEnable, fd)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif n != nil {\n\t\t\tif !n.isLeaf {\n\t\t\t\tfor i = 0; i <= n.KeysNum; i++ {\n\t\t\t\t\tc, _ := n.pointers[i].(*Node)\n\t\t\t\t\tenqueue(c)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (decTree *Tree) WriteTree(filename string) {\n\tfile, err := os.Create(filename)\n\tif err != nil {\n\t\tfmt.Println(\"Error opening output file: \", filename)\n\t\treturn\n\t}\n\n\tcurrNode := decTree\n\tvar treeStack []*Tree\n\n\ttreeLen := 1\n\tfor treeLen != 0 {\n\t\tfile.WriteString(nodeToStr(currNode.Details))\n\n\t\tif currNode.Details.Leaf == false {\n\t\t\ttreeStack = append(treeStack, currNode.Right)\n\t\t\tcurrNode = currNode.Left\n\t\t\ttreeLen++\n\t\t} else {\n\t\t\t//get the length of the tree and set curr to the last element in the list\n\t\t\ttreeLen--\n\n\t\t\tif treeLen > 0 {\n\t\t\t\tcurrNode, treeStack = treeStack[treeLen-1], treeStack[:treeLen-1]\n\t\t\t}\n\t\t}\n\t}\n\n\tfile.Close()\n}", "func DrawGraph(filename string, s spn.SPN) {\n\tfile, err := os.Create(filename)\n\n\tif err != nil {\n\t\tfmt.Printf(\"Error. Could not create file [%s].\\n\", filename)\n\t\tpanic(err)\n\t}\n\tdefer file.Close()\n\n\tfmt.Fprintf(file, \"graph {\\n\")\n\n\t// If the SPN is itself an univariate distribution, create a graph with a single node.\n\tif s.Type() == \"leaf\" {\n\t\tfmt.Fprintf(file, \"X1 [label=<X<sub>1</sub>>,shape=circle];\\n\")\n\t\tfmt.Fprintf(file, \"}\")\n\t\tfile.Close()\n\t\treturn\n\t}\n\n\t// Else, BFS the SPN and write nodes to filename.\n\tnvars, nsums, nprods := 0, 0, 0\n\tqueue := common.Queue{}\n\tqueue.Enqueue(&BFSPair{Spn: s, Pname: \"\", Weight: -1.0})\n\tfor !queue.Empty() {\n\t\tcurrpair := queue.Dequeue().(*BFSPair)\n\t\tcurr, pname, pw := currpair.Spn, currpair.Pname, currpair.Weight\n\t\tch := curr.Ch()\n\t\tnch := len(ch)\n\n\t\tname := \"N\"\n\t\tcurrt := curr.Type()\n\n\t\t// In case it is a sum node. Else product node.\n\t\tif currt == \"sum\" {\n\t\t\tname = fmt.Sprintf(\"S%d\", nsums)\n\t\t\tfmt.Fprintf(file, \"%s [label=\\\"+\\\",shape=circle];\\n\", name)\n\t\t\tnsums++\n\t\t} else if currt == \"product\" {\n\t\t\tname = fmt.Sprintf(\"P%d\", nprods)\n\t\t\tfmt.Fprintf(file, \"%s [label=<&times;>,shape=circle];\\n\", name)\n\t\t\tnprods++\n\t\t}\n\n\t\t// If pname is empty, then it is the root node. Else, link parent node to current node.\n\t\tif pname != \"\" {\n\t\t\tif pw >= 0 {\n\t\t\t\tfmt.Fprintf(file, \"%s -- %s [label=\\\"%.3f\\\"];\\n\", pname, name, pw)\n\t\t\t} else {\n\t\t\t\tfmt.Fprintf(file, \"%s -- %s\\n\", pname, name)\n\t\t\t}\n\t\t}\n\n\t\tvar w []float64\n\t\tif curr.Type() == \"sum\" {\n\t\t\tw = (curr.(*spn.Sum).Weights())\n\t\t}\n\t\t// For each children, run the BFS.\n\t\tfor i := 0; i < nch; i++ {\n\t\t\tc := ch[i]\n\n\t\t\t// If leaf, then simply write to the graphviz dot file. Else, recurse the BFS.\n\t\t\tif c.Type() == \"leaf\" {\n\t\t\t\tcname := fmt.Sprintf(\"X%d\", nvars)\n\t\t\t\tfmt.Fprintf(file, \"%s [label=<X<sub>%d</sub>>,shape=circle];\\n\", cname, c.Sc()[0])\n\t\t\t\tnvars++\n\t\t\t\tif currt == \"sum\" {\n\t\t\t\t\tfmt.Fprintf(file, \"%s -- %s [label=\\\"%.3f\\\"]\\n\", name, cname, w[i])\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Fprintf(file, \"%s -- %s\\n\", name, cname)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttw := -1.0\n\t\t\t\tif w != nil {\n\t\t\t\t\ttw = w[i]\n\t\t\t\t}\n\t\t\t\tqueue.Enqueue(&BFSPair{Spn: c, Pname: name, Weight: tw})\n\t\t\t}\n\t\t}\n\t}\n\n\tfmt.Fprintf(file, \"}\")\n}", "func (g *Graph) writeGraph(output io.Writer) error {\n\theader := \"p tw \" + strconv.Itoa(g.numvert) + \" \" + strconv.Itoa(g.numedge) + \"\\n\"\n\tio.WriteString(output, header)\n\n\tline := \"\"\n\tfor edge, value := range g.edges {\n\t\tif value {\n\t\t\tline = strconv.Itoa(edge.from.vert) + \" \" + strconv.Itoa(edge.to.vert) + \"\\n\"\n\t\t\tio.WriteString(output, line)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (node *URLNode) WriteTree(writer io.Writer) {\n\tif _, err := writer.Write([]byte(node.GenerateTree())); err != nil {\n\t\tlog.Error(err)\n\t}\n}", "func Map(w io.Writer, is interface{}, spec *Spec) error {\n\n\tvar vertexAppendix string\n\tvar edgeAppendix string\n\n\tfmt.Fprintln(w, \"strict graph {\")\n\tfmt.Fprintln(w, \" node [shape=\\\"circle\\\"];\")\n\n\tswitch is.(type) {\n\n\tcase *graph.Graph:\n\n\t\t// Initialize nodes\n\t\tfor _, v := range is.(*graph.Graph).V {\n\n\t\t\t// Visualize mst\n\t\t\tif spec.MST == true {\n\t\t\t\tvertexAppendix = \" color=\\\"red\\\" style=\\\"bold,filled\\\"\"\n\t\t\t}\n\n\t\t\tfmt.Fprintf(w, \" %d [label=\\\"%+v\\\"%s]\\n\", v.Serial, v.ID, vertexAppendix)\n\n\t\t}\n\n\t\t// Initialize edges\n\t\tfor _, e := range is.(*graph.Graph).E {\n\n\t\t\t// Visualize mst\n\t\t\tif (is.(*graph.Graph).V[e.EndpointA].GetEdgeByEndpoint(e.EndpointB).InMST == true ||\n\t\t\t\tis.(*graph.Graph).V[e.EndpointB].GetEdgeByEndpoint(e.EndpointA).InMST == true) && spec.MST == true {\n\t\t\t\tedgeAppendix = \" color=\\\"red\\\" style=\\\"bold\\\"\"\n\t\t\t}\n\n\t\t\tif is.(*graph.Graph).Type == graph.UNDIRECTED {\n\t\t\t\tfmt.Fprintf(w, \" %d -- %d [label=\\\"%d\\\"%s]\\n\", e.EndpointA, e.EndpointB, e.Weight, edgeAppendix)\n\t\t\t} else {\n\t\t\t\tfmt.Fprintf(w, \" %d -> %d [label=\\\"%d\\\"%s]\\n\", e.EndpointA, e.EndpointB, e.Weight, edgeAppendix)\n\t\t\t}\n\n\t\t\tedgeAppendix = \"\"\n\n\t\t}\n\t// case []graph.SEdge:\n\t// case []*graph.Node:\n\tdefault:\n\t\treturn fmt.Errorf(\"Unsupported Type\")\n\t}\n\n\tfmt.Fprintln(w, \"}\")\n\n\treturn nil\n\n}", "func Marshal(g *ag.Graph) ([]byte, error) {\n\tgv, err := graphviz.BuildGraph(g, graphviz.Options{ColoredTimeSteps: true})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn []byte(gv.String()), nil\n}", "func (bpt *BplusTree) writeLayout() {\n\tleafIdx := 0\n\tnodeIdx := 0\n\tlevelIdx := 0\n\n\tif !bpt.initialized || bpt.rootKey.IsNil() {\n\t\treturn\n\t}\n\n\trootNode, _ := bpt.fetch(bpt.rootKey)\n\tif rootNode == nil {\n\t\tglog.Errorf(\"failed to fetch root key: %v. can not print the tree.\",\n\t\t\tbpt.rootKey)\n\t\treturn\n\t}\n\tglog.Infof(\"dumping the tree layout.. numChildren: %d\\n\",\n\t\tlen(rootNode.Children))\n\tnodeList := rootNode.Children\n\tnodeLensList := make([]int, 1)\n\tnodeLensList[0] = len(rootNode.Children)\n\tnumElems := nodeLensList[0]\n\tnumNodesAtLevel := 0\n\tprintLevel := true\n\tglog.Infof(\"level -- 0 <root: %v>\\n\", rootNode)\n\tif rootNode.IsLeaf {\n\t\treturn\n\t}\n\tfor i := 0; i < numElems; i++ {\n\t\tif printLevel {\n\t\t\tglog.Infof(\"level -- %d \", levelIdx+1)\n\t\t\tprintLevel = false\n\t\t}\n\t\tnode, _ := bpt.fetch(nodeList[i].NodeKey)\n\t\tif node == nil {\n\t\t\tglog.Errorf(\"failed to fetch root key: %v\", nodeList[i].NodeKey)\n\t\t\treturn\n\t\t}\n\n\t\tif node.IsLeaf {\n\t\t\tglog.Infof(\"level:%d <tree-L-node :%d, node: %v> \", levelIdx+1, leafIdx, node)\n\t\t\tleafIdx++\n\t\t} else {\n\t\t\tglog.Infof(\"level:%d <tree-I-node :%d, node: %v> \", levelIdx+1, nodeIdx, node)\n\t\t\tnodeList = append(nodeList, node.Children...)\n\t\t\tnumElems += len(node.Children)\n\t\t\tnumNodesAtLevel += len(node.Children)\n\t\t}\n\t\tnodeIdx++\n\t\tif nodeIdx >= nodeLensList[levelIdx] {\n\t\t\tnodeLensList = append(nodeLensList, numNodesAtLevel)\n\t\t\tlevelIdx++\n\t\t\tnodeIdx = 0\n\t\t\tnumNodesAtLevel = 0\n\t\t\tglog.Infof(\"\\n\")\n\t\t\tprintLevel = true\n\t\t}\n\t}\n\tglog.Infof(\"done.. dumping the layout\\n\")\n\tglog.Infof(\"----------------------------\\n\")\n}", "func insertAncestryNodes(conn types.TGConnection, gof types.TGGraphObjectFactory) map[string]types.TGNode {\n\tfmt.Println(\">>>>>>> Entering InsertAncestryNodes: Insert Few Family Nodes with individual properties <<<<<<<\")\n\n\tvar houseMemberTable = make(map[string]types.TGNode, 0)\n\n\tgmd, err := conn.GetGraphMetadata(true)\n\tif err != nil {\n\t\tfmt.Println(\">>>>>>> Returning from InsertAncestryNodes - error during conn.GetGraphMetadata <<<<<<<\")\n\t\treturn nil\n\t}\n\n\ttestNodeType, err := gmd.GetNodeType(\"houseMemberType\")\n\tif err != nil {\n\t\tfmt.Println(\">>>>>>> Returning from InsertAncestryNodes - error during conn.GetNodeType('houseMemberType') <<<<<<<\")\n\t\treturn nil\n\t}\n\tif testNodeType != nil {\n\t\tfmt.Printf(\">>>>>>> 'houseMemberType' is found with %d attributes <<<<<<<\\n\", len(testNodeType.GetAttributeDescriptors()))\n\t} else {\n\t\tfmt.Println(\">>>>>>> 'houseMemberType' is not found from meta data fetch <<<<<<<\")\n\t\treturn nil\n\t}\n\n\tfor _, houseMember := range HouseMemberData {\n\t\tnode1, err := gof.CreateNodeInGraph(testNodeType)\n\t\tif err != nil {\n\t\t\tfmt.Println(\">>>>>>> Returning from InsertAncestryNodes - error during gof.CreateNode(node1) <<<<<<<\")\n\t\t\treturn nil\n\t\t}\n\t\t_ = node1.SetOrCreateAttribute(\"memberName\", houseMember.MemberName)\n\t\t_ = node1.SetOrCreateAttribute(\"crownName\", houseMember.CrownName)\n\t\t_ = node1.SetOrCreateAttribute(\"houseHead\", houseMember.HouseHead)\n\t\t_ = node1.SetOrCreateAttribute(\"yearBorn\", houseMember.YearBorn)\n\t\t_ = node1.SetOrCreateAttribute(\"yearDied\", houseMember.YearDied)\n\t\t_ = node1.SetOrCreateAttribute(\"crownTitle\", houseMember.CrownTitle)\n\n\t\tif houseMember.ReignStart != \"\" {\n\t\t\treignStart, _ := time.Parse(\"02 Jan 2006\", houseMember.ReignStart)\n\t\t\t_ = node1.SetOrCreateAttribute(\"reignStart\", reignStart)\n\t\t} else {\n\t\t\t_ = node1.SetOrCreateAttribute(\"reignStart\", nil)\n\t\t}\n\n\t\tif houseMember.ReignStart != \"\" {\n\t\t\treignEnd, _ := time.Parse(\"02 Jan 2006\", houseMember.ReignEnd)\n\t\t\t_ = node1.SetOrCreateAttribute(\"reignEnd\", reignEnd)\n\t\t} else {\n\t\t\t_ = node1.SetOrCreateAttribute(\"reignEnd\", nil)\n\t\t}\n\n\t\terr = conn.InsertEntity(node1)\n\t\tif err != nil {\n\t\t\tfmt.Println(\">>>>>>> Returning from InsertAncestryNodes w/ error during conn.InsertEntity(node1) <<<<<<<\")\n\t\t\treturn nil\n\t\t}\n\n\t\t_, err = conn.Commit()\n\t\tif err != nil {\n\t\t\tfmt.Println(\">>>>>>> Returning from InsertAncestryNodes w/ error during conn.Commit() <<<<<<<\")\n\t\t\treturn nil\n\t\t}\n\t\tfmt.Printf(\">>>>>>> Inside InsertAncestryNodes: Successfully added node '%+v'<<<<<<<\\n\", houseMember.MemberName)\n\t\thouseMemberTable[houseMember.MemberName] = node1\n\t} // End of for loop\n\tfmt.Println(\">>>>>>> Successfully added nodes w/ NO ERRORS !!! <<<<<<<\")\n\n\tfmt.Println(\">>>>>>> Returning from InsertAncestryNodes w/ NO ERRORS !!! <<<<<<<\")\n\treturn houseMemberTable\n}", "func main() {\n\troot := TreeNode{\n\t\tVal: 1,\n\t\tLeft: &TreeNode{\n\t\t\tVal: 2,\n\t\t\tLeft: nil,\n\t\t\tRight: nil,\n\t\t},\n\t\tRight: &TreeNode{\n\t\t\tVal: 3,\n\t\t\tLeft: &TreeNode{\n\t\t\t\tVal: 4,\n\t\t\t\tRight: nil,\n\t\t\t\tLeft: nil,\n\t\t\t},\n\t\t\tRight: &TreeNode{\n\t\t\t\tVal: 5,\n\t\t\t\tRight: nil,\n\t\t\t\tLeft: nil,\n\t\t\t},\n\t\t},\n\t}\n\tobj := Constructor()\n\tdata := obj.serialize(&root)\n\tfmt.Println(data)\n}", "func (graph *graphRW) Save() {\n\tgraph.parent.rwLock.Lock()\n\tdefer graph.parent.rwLock.Unlock()\n\n\tdestGraph := graph.parent.graph\n\n\t// propagate newly registered mappings\n\tfor mapName, mapping := range graph.mappings {\n\t\tif _, alreadyReg := destGraph.mappings[mapName]; !alreadyReg {\n\t\t\tdestGraph.mappings[mapName] = mapping\n\t\t}\n\t}\n\n\t// apply deleted nodes\n\tfor _, key := range graph.deleted {\n\t\tif node, has := destGraph.nodes[key]; has {\n\t\t\t// remove metadata\n\t\t\tif node.metadataAdded {\n\t\t\t\tif mapping, hasMapping := destGraph.mappings[node.metadataMap]; hasMapping {\n\t\t\t\t\tmapping.Delete(node.label)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// remove node from graph\n\t\t\tdelete(destGraph.nodes, key)\n\t\t}\n\t\tgraph.newRevs[key] = true\n\t}\n\tgraph.deleted = []string{}\n\n\t// apply new/changes nodes\n\tfor key, node := range graph.nodes {\n\t\tif !node.dataUpdated && !node.targetsUpdated && !node.sourcesUpdated {\n\t\t\tcontinue\n\t\t}\n\n\t\t// update metadata\n\t\tif !node.metaInSync {\n\t\t\t// update metadata map\n\t\t\tif mapping, hasMapping := destGraph.mappings[node.metadataMap]; hasMapping {\n\t\t\t\tif node.metadataAdded {\n\t\t\t\t\tif node.metadata == nil {\n\t\t\t\t\t\tmapping.Delete(node.label)\n\t\t\t\t\t\tnode.metadataAdded = false\n\t\t\t\t\t} else {\n\t\t\t\t\t\tprevMeta, _ := mapping.GetValue(node.label)\n\t\t\t\t\t\tif !reflect.DeepEqual(prevMeta, node.metadata) {\n\t\t\t\t\t\t\tmapping.Update(node.label, node.metadata)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if node.metadata != nil {\n\t\t\t\t\tmapping.Put(node.label, node.metadata)\n\t\t\t\t\tnode.metadataAdded = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// mark node for recording during RW-handle release\n\t\t// (ignore if only sources have been updated)\n\t\tif node.dataUpdated || node.targetsUpdated {\n\t\t\tif _, newRev := graph.newRevs[key]; !newRev {\n\t\t\t\tgraph.newRevs[key] = false\n\t\t\t}\n\t\t\tgraph.newRevs[key] = graph.newRevs[key] || node.dataUpdated\n\t\t}\n\n\t\t// copy changed node to the actual graph\n\t\tnodeCopy := node.copy()\n\t\tnodeCopy.graph = destGraph\n\t\tdestGraph.nodes[key] = newNode(nodeCopy)\n\n\t\t// use copy-on-write targets+sources for the write-handle\n\t\tcowTargets := nodeCopy.targets\n\t\tnodeCopy.targets = node.targets\n\t\tnode.targets = cowTargets\n\t\tcowSources := nodeCopy.sources\n\t\tnodeCopy.sources = node.sources\n\t\tnode.sources = cowSources\n\n\t\t// working copy is now in-sync\n\t\tnode.dataUpdated = false\n\t\tnode.targetsUpdated = false\n\t\tnode.sourcesUpdated = false\n\t\tnode.metaInSync = true\n\t}\n}", "func BuildAncestryGraph() {\n\tfmt.Println(\">>>>>>> Entering BuildAncestryGraph <<<<<<<\")\n\tconnFactory := connection.NewTGConnectionFactory()\n\tconn, err := connFactory.CreateConnection(ancestryUrl, ancestryUser, ancestryPassword, nil)\n\tif err != nil {\n\t\tfmt.Println(\">>>>>>> Returning from BuildAncestryGraph - error during CreateConnection <<<<<<<\")\n\t\treturn\n\t}\n\n\terr = conn.Connect()\n\tif err != nil {\n\t\tfmt.Println(\">>>>>>> Returning from BuildAncestryGraph - error during conn.Connect <<<<<<<\")\n\t\treturn\n\t}\n\n\tgof, err := conn.GetGraphObjectFactory()\n\tif err != nil {\n\t\tfmt.Println(\">>>>>>> Returning from BuildAncestryGraph - error during conn.GetGraphObjectFactory <<<<<<<\")\n\t\treturn\n\t}\n\tif gof == nil {\n\t\tfmt.Println(\">>>>>>> Returning from BuildAncestryGraph - Graph Object Factory is null <<<<<<<\")\n\t\treturn\n\t}\n\n\tfmt.Println(\">>>>>>> Inside BuildAncestryGraph: About to InsertAncestryNodes <<<<<<<\")\n\thouseMemberTable := insertAncestryNodes(conn, gof)\n\tfmt.Println(\">>>>>>> Inside BuildAncestryGraph: About to InsertRelationEdges <<<<<<<\")\n\tinsertRelationEdges(conn, gof, houseMemberTable)\n\tfmt.Println(\">>>>>>> Inside BuildAncestryGraph: Napoleon Bonaparte Ancestry Graph Created Successfully <<<<<<<\")\n\n\terr = conn.Disconnect()\n\tif err != nil {\n\t\tfmt.Println(\">>>>>>> Returning from BuildAncestryGraph - error during conn.Disconnect <<<<<<<\")\n\t\treturn\n\t}\n\tfmt.Println(\">>>>>>> Returning from BuildAncestryGraph - successfully disconnected. <<<<<<<\")\n}", "func (d *Graph) buildTree() {\n\tconfig := build.Default\n\n\t// For each package, look for the dependencies and build out a tree\n\tfor p := range d.Pkgs {\n\t\tpkg, _ := config.Import(d.Pkgs[p], d.SrcDir, build.AllowBinary)\n\t\timports := pkg.Imports\n\n\t\t// Iterate through the imports and build our tree\n\t\tfor i := range imports {\n\t\t\t// The full path of our current import\n\t\t\tpath := imports[i]\n\n\t\t\t// When dealing with multiple packages, we can't assume that imports\n\t\t\t// are unique. Thus the nodes may already exist and we shouldn't do any work\n\t\t\tif d.Nodes[path] != nil {\n\t\t\t\td.Nodes[path].IsDuplicate = true\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Ignore the GO standard library imports\n\t\t\tif _, ok := stdlib[strings.Split(path, \"/\")[0]]; ok && !d.StdLib {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Keep track when traversing the path\n\t\t\tvar currentNode = &Node{\n\t\t\t\tPath: path,\n\t\t\t\tIsDep: true,\n\t\t\t\tIsCoreDep: strings.HasPrefix(path, strings.Split(d.Pkgs[p], \"/\")[0]),\n\t\t\t}\n\n\t\t\t// Keep track of the number of dependencies\n\t\t\td.TotalDeps++\n\n\t\t\t// Link our dependency node to its ancestors\n\t\t\tfor path != \"\" {\n\t\t\t\t// Constant time lookup to all of our nodes\n\t\t\t\t// based on their full path string\n\t\t\t\td.Nodes[path] = currentNode\n\n\t\t\t\t// Keep popping off the tip of the path\n\t\t\t\tpath, _ = filepath.Split(path)\n\n\t\t\t\tif len(path) > 0 {\n\t\t\t\t\t// Trailing slash in file path causes issues, remove it\n\t\t\t\t\tif strings.HasSuffix(path, \"/\") {\n\t\t\t\t\t\tpath = path[:len(path)-1]\n\t\t\t\t\t}\n\n\t\t\t\t\t// Create nodes for all directory paths if they don't exist\n\t\t\t\t\tif d.Nodes[path] == nil {\n\t\t\t\t\t\tcurrentNode.addParent(&Node{\n\t\t\t\t\t\t\tPath: path,\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\t// Change the current node to the newly created item\n\t\t\t\t\t\tcurrentNode = currentNode.Parent\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Otherwise, assume the common ancestor already has it's tree built\n\t\t\t\t\t\tcurrentNode.addParent(d.Nodes[path])\n\t\t\t\t\t\tcurrentNode = nil\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// currentNode will be nil if there was already a common ancestor --\n\t\t\t// which means the root node already exists for that import path\n\t\t\tif currentNode != nil {\n\t\t\t\td.RootNode.addChild(currentNode)\n\t\t\t}\n\t\t}\n\t}\n}", "func writegraphs() {\n\n\tfor i := 2; i <= 10; i++ {\n\t\tg, err := buildGraph(false)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\terr = makegrid(i, &g)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\t//g, err = cfi(&g)\n\t\t//if err != nil {\n\t\t//\tlog.Fatal(err)\n\t\t//}\n\n\t\texpandgraph(&g)\n\n\t\tfilename := \"expgrid\" + strconv.Itoa(i) + \".gr\"\n\t\tfmt.Println(filename, \" created\")\n\t\tfile, err := os.Create(filename)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\terr = g.writeGraph(file)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n}", "func WriteGraph(g *Graph, w io.Writer) error {\n\tenc := gob.NewEncoder(w)\n\treturn enc.Encode(g)\n}", "func BuildGraph(rawGraph [][]string, timeStamps []time.Time) *CommitGraph {\n\tnodeMap := make(map[string]*Node, len(rawGraph))\n\tfor idx, rawNode := range rawGraph {\n\t\thash := rawNode[0]\n\t\tnodeMap[hash] = &Node{\n\t\t\tHash: hash,\n\t\t\tParents: make([]*Node, len(rawNode)-1),\n\t\t\tTimestamp: timeStamps[idx],\n\t\t}\n\t}\n\n\tfor _, rawNode := range rawGraph {\n\t\tfor idx, p := range rawNode[1:] {\n\t\t\tnodeMap[rawNode[0]].Parents[idx] = nodeMap[p]\n\t\t}\n\t}\n\n\treturn &CommitGraph{\n\t\tNodes: nodeMap,\n\t}\n}", "func (n *Node) WriteTree(padding ...int) string {\n\tvar indent int\n\tif len(padding) == 1 {\n\t\tindent = padding[0]\n\t}\n\n\tvar s string\n\tif n.val != \"\" {\n\t\tfor i := 0; i < indent; i++ {\n\t\t\ts += \" \"\n\t\t}\n\t\ts += n.key + \" : \" + n.val + \"\\n\"\n\t} else {\n\t\tfor i := 0; i < indent; i++ {\n\t\t\ts += \" \"\n\t\t}\n\t\ts += n.key + \" :\" + \"\\n\"\n\t\tfor _, nn := range n.nodes {\n\t\t\ts += nn.WriteTree(indent + 1)\n\t\t}\n\t}\n\treturn s\n}", "func createNewNodeNetworkObject(writer *bufio.Writer, sourceOsmNode *osm.Node) {\n\ttags := sourceOsmNode.TagMap()\n\n\t// Punktnetzwerk 'Fahrrad'\n\tnewOsmNode := *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found := tags[\"icn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_bicycle\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t} else {\n\t\trefValue, found = tags[\"ncn_ref\"]\n\t\tif found {\n\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_bicycle\"}\n\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t} else {\n\t\t\trefValue, found = tags[\"rcn_ref\"]\n\t\t\tif found {\n\t\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_bicycle\"}\n\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t\t} else {\n\t\t\t\trefValue, found = tags[\"lcn_ref\"]\n\t\t\t\tif found {\n\t\t\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_bicycle\"}\n\t\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Punktnetzwerk 'Wandern'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"iwn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_hiking\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t} else {\n\t\trefValue, found = tags[\"nwn_ref\"]\n\t\tif found {\n\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_hiking\"}\n\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t} else {\n\t\t\trefValue, found = tags[\"rwn_ref\"]\n\t\t\tif found {\n\t\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_hiking\"}\n\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t\t} else {\n\t\t\t\trefValue, found = tags[\"lwn_ref\"]\n\t\t\t\tif found {\n\t\t\t\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_hiking\"}\n\t\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\t\t\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\t\t\t\twriteNewNodeObject(writer, &newOsmNode)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Punktnetzwerk 'Inline-Skaten'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"rin_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_inline_skates\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t}\n\n\t// Punktnetzwerk 'Reiten'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"rhn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_horse\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t}\n\n\t// Punktnetzwerk 'Kanu'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"rpn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_canoe\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t}\n\n\t// Punktnetzwerk 'Motorboot'\n\tnewOsmNode = *sourceOsmNode // copy content (don't modify origin/source node)\n\tnewOsmNode.ID = 0\n\tnewOsmNode.Tags = []osm.Tag{} // remove all source tags\n\trefValue, found = tags[\"rmn_ref\"]\n\tif found {\n\t\ttag := osm.Tag{Key: \"node_network\", Value: \"node_motorboat\"}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\ttag = osm.Tag{Key: \"name\", Value: refValue}\n\t\tnewOsmNode.Tags = append(newOsmNode.Tags, tag)\n\t\twriteNewNodeObject(writer, &newOsmNode)\n\t}\n}", "func (tg *TrieGrapher) Graph(path string) error {\n\tf, err := os.Create(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\ttg.w = f\n\n\tfmt.Fprintln(f, \"digraph T {\")\n\tfmt.Fprintln(f, \"\\tnodesep=0.2; ranksep=0.4; splines=false; outputorder=edgesfirst;\")\n\tfmt.Fprintln(f, \"\\tnode [shape=circle, style=filled, fillcolor=white, fixedsize=true];\")\n\tfmt.Fprintln(f, \"\\tedge [arrowsize=0.5];\")\n\n\t// Will recursivelly call graphState on every state (which is in use).\n\ttg.graphState(RootState, EmptyCell)\n\n\tfmt.Fprintln(f, \"}\")\n\n\treturn nil\n}", "func (bpt *BplusTree) writeTree(printLayout bool) {\n\tdefer glog.Flush()\n\tnode, _ := bpt.fetch(bpt.rootKey)\n\tif node == nil {\n\t\tglog.Errorf(\"failed to fetch root key: %v\", bpt.rootKey)\n\t\treturn\n\t}\n\t// Print tree layout.\n\tif printLayout == true {\n\t\tbpt.writeLayout()\n\t}\n\n\t// Go to the left most leaf node and start printing in order.\n\tfor node != nil {\n\t\tif node.IsLeaf {\n\t\t\tbreak\n\t\t}\n\t\tnode, _ = bpt.fetch(node.Children[0].NodeKey)\n\t\tif node == nil {\n\t\t\tglog.Errorf(\"failed to fetch key: %v\", node.Children[0].NodeKey)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif node == nil {\n\t\tglog.Infof(\"tree is empty\")\n\t\treturn\n\t}\n\n\tindex := 0\n\tfor {\n\t\tglog.Infof(\"leaf node: %d (DK: %v, NK: %v, XK: %v, PK: %v)\\n\",\n\t\t\tindex, node.DataKey, node.NodeKey, node.NextKey, node.PrevKey)\n\t\tfor _, child := range node.Children {\n\t\t\tglog.Infof(\"\\t%v\\n\", child)\n\t\t}\n\n\t\tif node.NextKey.IsNil() {\n\t\t\tbreak\n\t\t}\n\n\t\tif !node.NextKey.IsNil() {\n\t\t\tnextKey := node.NextKey\n\t\t\tnode, _ = bpt.fetch(nextKey)\n\t\t\tif node == nil {\n\t\t\t\tglog.Errorf(\"failed to fetch key: %v\", nextKey)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tindex++\n\t}\n}", "func WriteTree(c *git.Client) string {\n\tidx, err := c.GitDir.ReadIndex()\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\tsha1, err := idx.WriteTree(c)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\treturn sha1.String()\n}", "func (graphS Graph) traverse(f *os.File, vertex *dag.Vertex, done *[]*dag.Vertex, fname string) error {\n graph := graphS.g\n\n var err error\n // Check if we are in done[]; if we are, we don't need to do anything\n if sliceContains(*done, vertex) {\n return nil\n }\n\n // We set this here to avoid loops\n *done = append(*done, vertex)\n\n // Loop over children\n children, err := graph.Successors(vertex)\n if err != nil {\n return fmt.Errorf(\"Unable to get children of %s with %w\", vertex.ID, err)\n }\n\n for _, child := range children {\n // Add the line to the DOT\n _, err = f.WriteString(fmt.Sprintf(\"\\\"%s\\\" -> \\\"%s\\\"\\n\", vertex.ID, child.ID))\n if err != nil {\n return fmt.Errorf(\"Unable to write to %s with %w\", fname, err)\n }\n // Recurse to children\n err = graphS.traverse(f, child, done, fname)\n if err != nil {\n return err\n }\n }\n\n return nil\n}", "func treeGene( geneArray[] string, arrayPos int, shapeType string) int{\n\n//Function check to see if the there is any shapes in the in the listArray\n//if not it changes the structures as it moves to the end\n\tif listArray[0] != shapeType { \n\t\t\tlistArray[1]= \"<inst>\"\n\t\t\tlistArray[0] = shapeType\n\t\tarrayPos++\n\t\ttreeGene(geneArray[0:],arrayPos,shapeType)\t// Called the function so it can be processed with the valid format \t\n\t}else{ if listArray[1] == \"\" || listArray[1] == \"<inst>\"{ // after transforming it is place in a format that can be parsed \n\t\t\tif geneArray[arrayPos] == shapeType{ \t// Ensure we are not Validating a Shape\n\t\t\t\tarrayPos++\n\t\t\t}\n\t\t\t// Retrieve the Coordinated from the array\n\t\t\tvar curCoord string=geneArray[arrayPos] \n\t\t\tarrayPos++\n\t\t\t\n\t\t\t// Using Slices we get each Values \n\t\t\tx:=curCoord[0:1] \n\t\t\ty:=curCoord[1:2]\n\t\t\tfmt.Printf(\"\\n |\\n\")\n\t\t\t\n\t\t\t// The Only Difference with Circle is that it Has a Coordinated\n\t\t\tfmt.Printf(shapeType+\"\\n / \\\\\\n\")\n\t\t\tif shapeType == \"CIR\"{\n\t\t\t\tfmt.Printf(\"<coord>\\n\")\n\t\t\t}\t\t\t\n\t\t\tfmt.Printf(\"<x><y>\\n\"+x+\" \"+y)\n\t\t\t\n\t\t}\n\t\t }\n\n\treturn arrayPos\n}", "func Graph(w http.ResponseWriter, g *model.Graph, params *Params) {\n\tgj, err := json.Marshal(g)\n\tif err != nil {\n\t\tlog.Printf(\"Could not execute graph editor template: %v\", err)\n\t\thttp.Error(w, \"Could not execute graph editor template\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\td := &editorInput{\n\t\tParams: params,\n\t\tGraph: g,\n\t\tGraphJSON: string(gj),\n\t\tPartTypes: model.PartTypes,\n\t\tPartTypesByCategory: model.PartTypesByCategory,\n\t}\n\td.Licenses = []license{\n\t\t{\"Shenzhen Go\", \"/.static/misc/LICENSE\"},\n\t\t{\"Ace (code editor)\", \"/.static/js/ace/LICENSE\"},\n\t\t{\"Chromium Hterm\", \"/.static/js/hterm/LICENSE\"},\n\t}\n\tif err := graphEditorTemplate.Execute(w, d); err != nil {\n\t\tlog.Printf(\"Could not execute graph editor template: %v\", err)\n\t\thttp.Error(w, \"Could not execute graph editor template\", http.StatusInternalServerError)\n\t}\n}", "func (l *Lista) GraphNodes(i int) string{\n\tAux := l.Inicio\n\tnodos := \"\"\n\tj := 0\n\tfor Aux != nil{\n\t\tnodos = nodos + \"a\" + strconv.Itoa(i) + \"Node\" + strconv.Itoa(j) + \" [label=\\\"\"+ Aux.Dato.Nombre +\"\\\"]\\n\"\n\t\tj++\n\t\tAux = Aux.Siguiente\n\t}\n\tk := 0\n\tnodos = nodos + \"struct:f\" + strconv.Itoa(i)\n\tAux = l.Inicio\n\tfor Aux != nil{\n\t\tnodos = nodos + \" -> a\" + strconv.Itoa(i) + \"Node\" + strconv.Itoa(k)\n\t\tk++\n\t\tAux = Aux.Siguiente\n\t}\n\tnodos = nodos + \";\\n\"\n\treturn nodos\n}", "func writeDotGraph(outf *os.File, start *node, id string) {\n\tdone := make(map[*node]bool)\n\tvar show func(*node)\n\tshow = func(u *node) {\n\t\tif u.accept {\n\t\t\tfmt.Fprintf(outf, \" %v[style=filled,color=green];\\n\", u.n)\n\t\t}\n\t\tdone[u] = true\n\t\tfor _, e := range u.e {\n\t\t\t// We use -1 to denote the dead end node in DFAs.\n\t\t\tif e.dst.n == -1 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlabel := \"\"\n\t\t\truneToDot := func(r rune) string {\n\t\t\t\tif strconv.IsPrint(r) {\n\t\t\t\t\treturn fmt.Sprintf(\"%v\", string(r))\n\t\t\t\t}\n\t\t\t\treturn fmt.Sprintf(\"U+%X\", int(r))\n\t\t\t}\n\t\t\tswitch e.kind {\n\t\t\tcase kRune:\n\t\t\t\tlabel = fmt.Sprintf(\"[label=%q]\", runeToDot(e.r))\n\t\t\tcase kWild:\n\t\t\t\tlabel = \"[color=blue]\"\n\t\t\tcase kClass:\n\t\t\t\tlabel = \"[label=\\\"[\"\n\t\t\t\tif e.negate {\n\t\t\t\t\tlabel += \"^\"\n\t\t\t\t}\n\t\t\t\tfor i := 0; i < len(e.lim); i += 2 {\n\t\t\t\t\tlabel += runeToDot(e.lim[i])\n\t\t\t\t\tif e.lim[i] != e.lim[i+1] {\n\t\t\t\t\t\tlabel += \"-\" + runeToDot(e.lim[i+1])\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlabel += \"]\\\"]\"\n\t\t\t}\n\t\t\tfmt.Fprintf(outf, \" %v -> %v%v;\\n\", u.n, e.dst.n, label)\n\t\t}\n\t\tfor _, e := range u.e {\n\t\t\tif !done[e.dst] {\n\t\t\t\tshow(e.dst)\n\t\t\t}\n\t\t}\n\t}\n\tfmt.Fprintf(outf, \"digraph %v {\\n 0[shape=box];\\n\", id)\n\tshow(start)\n\tfmt.Fprintln(outf, \"}\")\n}", "func writeNewNodeObject(writer *bufio.Writer, newOsmNode *osm.Node) {\n\tnewOsmNode.ID = newNodeID\n\tnewNodeID++\n\n\tdata, err := xml.MarshalIndent(newOsmNode, \" \", \" \")\n\tif err != nil {\n\t\tlog.Fatalf(\"error <%v> at xml.MarshalIndent()\", err)\n\t}\n\t_, err = fmt.Fprintf(writer, \"%s\\n\", string(data))\n\tif err != nil {\n\t\tlog.Fatalf(\"error writing output file: %v\", err)\n\t}\n}", "func (node *Node) PrintStructure(indent int, character string) {\n\tfor i := 0; i < indent; i++ {\n\t\tfmt.Print(character)\n\t}\n\tfmt.Println(node.Data)\n\tfor _, child := range node.Children {\n\t\tchild.PrintStructure(indent+1, character)\n\t}\n\tif len(node.Children) == 0 {\n\t\treturn\n\t}\n\tfor i := 0; i < indent; i++ {\n\t\tfmt.Print(character)\n\t}\n\tfmt.Println(node.Data)\n}", "func mermaidGraph(c *flow.Controller) string {\n\tw := &strings.Builder{}\n\tfmt.Fprintln(w, \"graph TD\")\n\tfor i, t := range c.Tasks() {\n\t\tfmt.Fprintf(w, \" t%d(\\\"%s [%s]\\\")\\n\", i, t.Path(), t.State())\n\t\tfor _, t := range t.Dependencies() {\n\t\t\tfmt.Fprintf(w, \" t%d-->t%d\\n\", i, t.Index())\n\t\t}\n\t}\n\treturn w.String()\n}", "func (g Index) WriteTree(c *Client) (TreeID, error) {\n\tsha1, err := writeIndexEntries(c, \"\", g.Objects)\n\tif err != nil && err != ObjectExists {\n\t\treturn TreeID{}, err\n\t}\n\treturn sha1, nil\n}", "func toJsGraph(g *gen.Graph) jsGraph {\n\tgraph := jsGraph{}\n\tfor _, n := range g.Nodes {\n\t\tnode := jsNode{ID: n.Name}\n\t\tfor _, f := range n.Fields {\n\t\t\tnode.Fields = append(node.Fields, jsField{\n\t\t\t\tName: f.Name,\n\t\t\t\tType: f.Type.String(),\n\t\t\t})\n\t\t}\n\t\tgraph.Nodes = append(graph.Nodes, node)\n\t\tfor _, e := range n.Edges {\n\t\t\tif e.IsInverse() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tgraph.Edges = append(graph.Edges, jsEdge{\n\t\t\t\tFrom: n.Name,\n\t\t\t\tTo: e.Type.Name,\n\t\t\t\tLabel: e.Name,\n\t\t\t})\n\t\t}\n\n\t}\n\treturn graph\n}", "func (n *Node) WriteMetadata(owner *userpb.UserId) (err error) {\n\tnodePath := n.InternalPath()\n\tif err = xattr.Set(nodePath, xattrs.ParentidAttr, []byte(n.ParentID)); err != nil {\n\t\treturn errors.Wrap(err, \"decomposedfs: could not set parentid attribute\")\n\t}\n\tif err = xattr.Set(nodePath, xattrs.NameAttr, []byte(n.Name)); err != nil {\n\t\treturn errors.Wrap(err, \"decomposedfs: could not set name attribute\")\n\t}\n\tif err = xattr.Set(nodePath, xattrs.BlobIDAttr, []byte(n.BlobID)); err != nil {\n\t\treturn errors.Wrap(err, \"decomposedfs: could not set blobid attribute\")\n\t}\n\tif err = xattr.Set(nodePath, xattrs.BlobsizeAttr, []byte(fmt.Sprintf(\"%d\", n.Blobsize))); err != nil {\n\t\treturn errors.Wrap(err, \"decomposedfs: could not set blobsize attribute\")\n\t}\n\tif owner == nil {\n\t\tif err = xattr.Set(nodePath, xattrs.OwnerIDAttr, []byte(\"\")); err != nil {\n\t\t\treturn errors.Wrap(err, \"decomposedfs: could not set empty owner id attribute\")\n\t\t}\n\t\tif err = xattr.Set(nodePath, xattrs.OwnerIDPAttr, []byte(\"\")); err != nil {\n\t\t\treturn errors.Wrap(err, \"decomposedfs: could not set empty owner idp attribute\")\n\t\t}\n\t\tif err = xattr.Set(nodePath, xattrs.OwnerTypeAttr, []byte(\"\")); err != nil {\n\t\t\treturn errors.Wrap(err, \"decomposedfs: could not set empty owner type attribute\")\n\t\t}\n\t} else {\n\t\tif err = xattr.Set(nodePath, xattrs.OwnerIDAttr, []byte(owner.OpaqueId)); err != nil {\n\t\t\treturn errors.Wrap(err, \"decomposedfs: could not set owner id attribute\")\n\t\t}\n\t\tif err = xattr.Set(nodePath, xattrs.OwnerIDPAttr, []byte(owner.Idp)); err != nil {\n\t\t\treturn errors.Wrap(err, \"decomposedfs: could not set owner idp attribute\")\n\t\t}\n\t\tif err = xattr.Set(nodePath, xattrs.OwnerTypeAttr, []byte(utils.UserTypeToString(owner.Type))); err != nil {\n\t\t\treturn errors.Wrap(err, \"decomposedfs: could not set owner idp attribute\")\n\t\t}\n\t}\n\treturn\n}", "func (this *Codec) serialize(root *TreeNode) string {\n if root == nil {\n return \"x\"\n }\n return strconv.Itoa(root.Val) + \",\" + this.serialize(root.Left)+ \",\" + this.serialize(root.Right)\n}", "func (project *Project) createGraph() error {\n\tg.AddNode(project.Name)\n\tfor _, ig := range project.Csproj.ItemGroups {\n\t\tfor _, pr := range ig.ProjectReferences {\n\t\t\tcsprojFilePath := strings.Replace(path.Join(path.Dir(project.Path), pr.Include), \"\\\\\", \"/\", -1)\n\t\t\tcsproj, err := parseCsproj(csprojFilePath)\n\t\t\tif err != nil {\n\t\t\t\terr = fmt.Errorf(\"cannot parse csproj file referenced in %s: %v\", project.Path, err)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfileName := path.Base(strings.Replace(pr.Include, \"\\\\\", \"/\", -1))\n\t\t\tfileNameNoExt := strings.Replace(fileName, path.Ext(fileName), \"\", -1)\n\t\t\tdep := &Project{\n\t\t\t\tName: fileNameNoExt,\n\t\t\t\tPath: csprojFilePath,\n\t\t\t\tCsproj: csproj,\n\t\t\t}\n\n\t\t\tif project.Name == \"\" || dep.Name == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tg.AddEdge(project.Name, dep.Name)\n\n\t\t\tdep.createGraph()\n\t\t}\n\t}\n\treturn nil\n}", "func buildTree(path string, vfileStack []*vfs.VFile) error {\n\n\terrFmt := \"build tree: %v\\n\"\n\n\tstats, err := ioutil.ReadDir(path)\n\tif err != nil {\n\t\treturn fmt.Errorf(errFmt, err)\n\t}\n\n\tfor _, node := range stats {\n\n\t\tnodePath := fmt.Sprintf(\"%s/%s\", path, node.Name())\n\n\t\tif node.IsDir() {\n\t\t\tvDir := vfs.NewFile(node)\n\t\t\t// append virtual directory to last element in vfs\n\t\t\tvfileStack[len(vfileStack)-1].Append(vDir)\n\t\t\t// virtual directory becomes new last\n\t\t\t// element of vfs within recursive call\n\t\t\terr := buildTree(nodePath, append(vfileStack, vDir))\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(errFmt, err)\n\t\t\t}\n\n\t\t\tcontinue\n\t\t}\n\n\t\tfileBytes, err := ioutil.ReadFile(nodePath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(errFmt, err)\n\t\t}\n\n\t\tbuf := bytes.NewBuffer(fileBytes)\n\n\t\t// strip json of white space to save space in generated binary\n\t\tif strings.HasSuffix(node.Name(), \".json\") {\n\t\t\tbuf, err = reEncodeJson(buf)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(errFmt, err)\n\t\t\t}\n\t\t}\n\n\t\tvfile := vfs.NewFile(node, buf.Bytes()...)\n\t\tvfileStack[len(vfileStack)-1].Append(vfile)\n\n\t\tfmt.Printf(\"ESSENCE: embedded file: %s/%s\\n\", path, node.Name())\n\t}\n\n\treturn nil\n}", "func saveNodes() {\n\tf, err := os.Create(\"nodes.dat\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer f.Close()\n\tb, err := json.Marshal(nodes)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif _, err := f.Write(b); err != nil {\n\t\tpanic(err)\n\t}\n}", "func (p *printer) printStructure(gn *GenericNode) {\n\t// traverse siblings\n\tfor s := gn; s != nil; s = s.next {\n\t\tswitch s.NodeType {\n\t\tcase Declaration:\n\t\t\t// print attributes\n\t\tcase Element:\n\t\t\tif p.pretty {\n\t\t\t\tfmt.Println(\"\")\n\t\t\t}\n\t\t\t// can have children and siblings which must be handled\n\t\t\tfmt.Print(\"<\" + string(s.Name) + \">\")\n\t\t\tp.traverseDepth(s)\n\t\t\tfmt.Print(\"</\" + string(s.Name) + \">\")\n\t\tcase Data:\n\t\t\t// just print and return\n\t\t\tfmt.Print(string(s.Value))\n\t\tcase Cdata:\n\t\t\t// cdata needs to be embedded in a CDATA structure\n\t\t\tfmt.Print(`<![CDATA[` + string(s.Value) + `]]`)\n\t\tcase Comment:\n\t\t\tfmt.Print(\"<!--\" + string(s.Value) + \"-->\")\n\t\tcase Doctype:\n\t\t\tfmt.Print(\"<!DOCTYPE \" + string(s.Value) + \">\")\n\t\t\tp.traverseDepth(s)\n\t\tcase Pi:\n\t\t\tfmt.Print(\"<?\" + string(s.Name) + \" \" + string(s.Value))\n\t\tcase Document:\n\t\t\tp.traverseDepth(s)\n\t\tdefault:\n\t\t\tpanic(\"unknown node type\")\n\t\t}\n\n\t}\n\n}", "func main() {\n\torbits := tree{}\n\n\tif len(os.Args) < 2 {\n\t\tlog.Fatalf(\"Missing parameter, provide file name!\")\n\t\treturn\n\t}\n\n\t// raw reading of the file\n\tdata, err := ioutil.ReadFile(os.Args[1])\n\tif err != nil {\n\t\tlog.Fatalf(\"Can't read file: %v\\n\", os.Args[1])\n\t\tpanic(err)\n\t}\n\n\t// take the read file and convert it from strings to ints\n\tfor _, line := range bytes.Split(data, []byte(\"\\n\")) {\n\t\tplanets := strings.Split(strings.TrimSpace(string(line)), \")\")\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Could not extract planets from line. %v\\n\", err)\n\t\t}\n\n\t\torbits[planets[0]] = append(orbits[planets[0]], planets[1])\n\t}\n\n\tspew.Dump(\"Result:\")\n\t//\tspew.Dump(orbits)\n\n\t//\tfmt.Printf(\"nodes:%d\\n\", orbits.height(\"COM\"))\n\t//\tfmt.Printf(\"count:%d\\n\", orbits.count(\"COM\", 0))\n\tfmt.Printf(\"p:%v\\n\", orbits.parent(\"B\"))\n\tfmt.Printf(\"p:%v\\n\", orbits.parent(\"COM\"))\n\tfmt.Printf(\"q:%v\\n\", orbits.ancestry(\"YOU\"))\n\tfmt.Printf(\"q:%v\\n\", orbits.ancestry(\"SAN\"))\n\tfmt.Printf(\"q:%v\\n\", orbits.transfers(\"YOU\", \"SAN\"))\n\n}", "func (this *Graph) Cluster() []*Graph {\n /*\n\n Algorithm synopsis:\n\n Loop over the Starters, for each unvisited Starter,\n define an empty sub-graph and, put it into the toVisit set\n\n Loop over the toVisit node set, for each node in it, \n skip if already visited\n add the node to the sub-graph\n remove the nodes into the hasVisited node set\n put all its incoming and outgoing edge into the the toWalk set while\n stop at the hub nodes (edges from the hub nodes are not put in the toWalk set)\n then iterate through the toWalk edge set \n skip if already walked\n add the edge to the sub-graph\n put its connected nodes into the toVisit node set\n remove the edge from the toWalk edge set into the hasWalked edge set\n\n */\n \n // sub-graph index\n sgNdx := -1\n sgRet := make([]*Graph,0)\n\n toVisit := make(nodeSet); hasVisited := make(nodeSet)\n toWalk := make(edgeSet); hasWalked := make(edgeSet)\n\n for starter := range *this.Starters() {\n // define an empty sub-graph and, put it into the toVisit set\n sgRet = append(sgRet, NewGraph(gographviz.NewGraph())); sgNdx++; \n sgRet[sgNdx].Attrs = this.Attrs\n sgRet[sgNdx].SetDir(this.Directed)\n graphName := fmt.Sprintf(\"%s_%03d\\n\", this.Name, sgNdx);\n sgRet[sgNdx].SetName(graphName)\n toVisit.Add(starter)\n hubVisited := make(nodeSet)\n for len(toVisit) > 0 { for nodep := range toVisit {\n toVisit.Del(nodep); //print(\"O \")\n if this.IsHub(nodep) && hasVisited.Has(nodep) && !hubVisited.Has(nodep) { \n // add the already-visited but not-in-this-graph hub node to the sub-graph\n sgRet[sgNdx].AddNode(nodep)\n hubVisited.Add(nodep)\n continue \n }\n if hasVisited.Has(nodep) { continue }\n //spew.Dump(\"toVisit\", nodep)\n // add the node to the sub-graph\n sgRet[sgNdx].AddNode(nodep)\n // remove the nodes into the hasVisited node set\n hasVisited.Add(nodep)\n // stop at the hub nodes\n if this.IsHub(nodep) { continue }\n // put all its incoming and outgoing edge into the the toWalk set\n noden := nodep.Name\n for _, ep := range this.EdgesToParents(noden) {\n toWalk.Add(ep)\n }\n for _, ep := range this.EdgesToChildren(noden) {\n toWalk.Add(ep)\n }\n for edgep := range toWalk {\n toWalk.Del(edgep); //print(\"- \")\n if hasWalked.Has(edgep) { continue }\n //spew.Dump(\"toWalk\", edgep)\n sgRet[sgNdx].Edges.Add(edgep)\n // put its connected nodes into the toVisit node set\n toVisit.Add(this.Lookup(edgep.Src))\n toVisit.Add(this.Lookup(edgep.Dst))\n // remove the edge into the hasWalked edge set\n hasWalked.Add(edgep)\n }\n }}\n //spew.Dump(sgNdx)\n }\n return sgRet\n}", "func DrawGraphTools(filename string, s spn.SPN) {\n\tfile, err := os.Create(filename)\n\n\tif err != nil {\n\t\tfmt.Printf(\"Error. Could not create file [%s].\\n\", filename)\n\t\tpanic(err)\n\t}\n\tdefer file.Close()\n\n\toutname := utils.StringConcat(filename[0:len(filename)-len(filepath.Ext(filename))], \".png\")\n\n\tfmt.Fprintf(file, \"from graph_tool.all import *\\n\\n\")\n\tfmt.Fprintf(file, \"g = Graph(directed=True)\\n\")\n\tfmt.Fprintf(file, \"vcolors = g.new_vertex_property(\\\"string\\\")\\n\")\n\tfmt.Fprintf(file, \"vnames = g.new_vertex_property(\\\"string\\\")\\n\")\n\tfmt.Fprintf(file, \"enames = g.new_edge_property(\\\"string\\\")\\n\\n\")\n\tfmt.Fprintf(file, \"def add_node(name, type):\\n\\tv=g.add_vertex()\\n\\tvnames[v]=name\\n\\t\"+\n\t\t\"vcolors[v]=type\\n\\treturn v\\n\\n\")\n\tfmt.Fprintf(file, \"def add_edge(o, t, name):\\n\\te=g.add_edge(o, t)\\n\\tenames[e]=name\\n\\treturn e\\n\\n\")\n\tfmt.Fprintf(file, \"def add_edge_nameless(o, t):\\n\\te=g.add_edge(o, t)\\n\\treturn e\\n\\n\\n\")\n\n\t// If the SPN is itself an univariate distribution, create a graph with a single node.\n\tif s.Type() == \"leaf\" {\n\t\tfmt.Fprintf(file, \"add_node(\\\"X\\\")\\n\\n\")\n\t\tfmt.Fprintf(file, \"g.vertex_properties[\\\"name\\\"]=vnames\\n\")\n\t\tfmt.Fprintf(file, \"g.vertex_properties[\\\"color\\\"]=vcolors\\n\")\n\t\tfmt.Fprintf(file, \"\\ngraph_draw(g, vertex_text=g.vertex_properties[\\\"name\\\"], \"+\n\t\t\t\"edge_text=enames, vertex_fill_color=g.vertex_properties[\\\"color\\\"], output=\\\"%s\\\")\\n\",\n\t\t\toutname)\n\t\treturn\n\t}\n\n\t// Else, BFS the SPN and write nodes to filename.\n\tnvars, nsums, nprods := 0, 0, 0\n\tqueue := common.Queue{}\n\tqueue.Enqueue(&BFSPair{Spn: s, Pname: \"\", Weight: -1.0})\n\tfor !queue.Empty() {\n\t\tcurrpair := queue.Dequeue().(*BFSPair)\n\t\tcurr, pname, pw := currpair.Spn, currpair.Pname, currpair.Weight\n\t\tch := curr.Ch()\n\t\tnch := len(ch)\n\n\t\tname := \"N\"\n\t\tcurrt := curr.Type()\n\n\t\t// In case it is a sum node. Else product node.\n\t\tif currt == \"sum\" {\n\t\t\tname = fmt.Sprintf(\"S%d\", nsums)\n\t\t\tfmt.Fprintf(file, \"%s = add_node(\\\"+\\\", \\\"#ff3300\\\")\\n\", name)\n\t\t\tnsums++\n\t\t} else if currt == \"product\" {\n\t\t\tname = fmt.Sprintf(\"P%d\", nprods)\n\t\t\tfmt.Fprintf(file, \"%s = add_node(\\\"*\\\", \\\"#669900\\\")\\n\", name)\n\t\t\tnprods++\n\t\t}\n\n\t\t// If pname is empty, then it is the root node. Else, link parent node to current node.\n\t\tif pname != \"\" {\n\t\t\tif pw >= 0 {\n\t\t\t\tfmt.Fprintf(file, \"add_edge(%s, %s, \\\"%.3f\\\")\\n\", pname, name, pw)\n\t\t\t} else {\n\t\t\t\tfmt.Fprintf(file, \"add_edge_nameless(%s, %s)\\n\", pname, name)\n\t\t\t}\n\t\t}\n\n\t\tvar w []float64\n\t\tif curr.Type() == \"sum\" {\n\t\t\tw = (curr.(*spn.Sum).Weights())\n\t\t}\n\t\t// For each children, run the BFS.\n\t\tfor i := 0; i < nch; i++ {\n\t\t\tc := ch[i]\n\n\t\t\t// If leaf, then simply write to the graphviz dot file. Else, recurse the BFS.\n\t\t\tif c.Type() == \"leaf\" {\n\t\t\t\tcname := fmt.Sprintf(\"X%d\", nvars)\n\t\t\t\tfmt.Fprintf(file, \"%s = add_node(\\\"X_%d\\\", \\\"#0066ff\\\")\\n\", cname, c.Sc()[0])\n\t\t\t\tnvars++\n\t\t\t\tif currt == \"sum\" {\n\t\t\t\t\tfmt.Fprintf(file, \"add_edge(%s, %s, \\\"%.3f\\\")\\n\", name, cname, w[i])\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Fprintf(file, \"add_edge_nameless(%s, %s)\\n\", name, cname)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttw := -1.0\n\t\t\t\tif w != nil {\n\t\t\t\t\ttw = w[i]\n\t\t\t\t}\n\t\t\t\tqueue.Enqueue(&BFSPair{Spn: c, Pname: name, Weight: tw})\n\t\t\t}\n\t\t}\n\t}\n\n\tfmt.Fprintf(file, \"g.vertex_properties[\\\"name\\\"]=vnames\\n\")\n\tfmt.Fprintf(file, \"g.vertex_properties[\\\"color\\\"]=vcolors\\n\")\n\t//fmt.Fprintf(file, \"\\ngraph_draw(g, vertex_text=g.vertex_properties[\\\"name\\\"], \"+\n\t//\"edge_text=enames, vertex_fill_color=g.vertex_properties[\\\"color\\\"], \"+\n\t//\"output_size=[16384, 16384], output=\\\"%s\\\", bg_color=[1, 1, 1, 1])\\n\", outname)\n\tfmt.Fprintf(file, \"\\ngraph_draw(g, \"+\n\t\t\"edge_text=enames, vertex_fill_color=g.vertex_properties[\\\"color\\\"], \"+\n\t\t\"output_size=[16384, 16384], output=\\\"%s\\\", bg_color=[1, 1, 1, 1])\\n\", outname)\n}", "func encodeTree(hmt *Tree, finalTree *string) {\n\tif hmt == nil {\n\t\treturn\n\t}\n\t\n\tif hmt.LeftNode == nil && hmt.RightNode == nil{\n\t\t*finalTree += \"1\" + string(hmt.Char)\n\t} else {\n\t\t*finalTree += \"0\"\n\t}\n\tencodeTree(hmt.LeftNode, finalTree)\n\tencodeTree(hmt.RightNode, finalTree) \n}", "func (p InodePlugin) GraphDefinition() map[string]mp.Graphs {\n\treturn map[string]mp.Graphs{\n\t\t\"inode.count.#\": {\n\t\t\tLabel: \"Inode\",\n\t\t\tUnit: \"integer\",\n\t\t\tMetrics: []mp.Metrics{\n\t\t\t\t{Name: \"used\", Label: \"used\"},\n\t\t\t\t{Name: \"free\", Label: \"free\"},\n\t\t\t\t{Name: \"total\", Label: \"total\"},\n\t\t\t},\n\t\t},\n\t\t\"inode.percentage.#\": {\n\t\t\tLabel: \"Inode Percentage\",\n\t\t\tUnit: \"percentage\",\n\t\t\tMetrics: []mp.Metrics{\n\t\t\t\t{Name: \"used\", Label: \"used %\"},\n\t\t\t},\n\t\t},\n\t}\n}", "func PrintTree(g *adjacencylist.AdjacencyList, s, v *adjacencylist.AdjListVertex) {\n\tif v == s {\n\t\tfmt.Println(s)\n\t} else if v.P != nil {\n\t\tPrintTree(g, s, v.P)\n\t\tfmt.Println(v)\n\t} else {\n\t\tfmt.Println(\"A path between these two vertices does not exist :(\")\n\t}\n}", "func (this *Codec) serialize(root *TreeNode) string {\n var s string \n res:=helpSerialize(root,s)\n fmt.Println(res)\n return res\n}", "func (graph *DirGraph) createStrongConnections() {\n\tvar l int\n\tl = 0\n\tvar nodes []*GraphNode\n\tnodes = graph.setFinishingOrder()\n\tgraph.reset()\n\tvar i int\n\tfor i = len(nodes) - 1; i >= 0; i-- {\n\t\tvar node *GraphNode\n\t\tnode = nodes[i]\n\t\tif node.visited == false {\n\t\t\tvar m int\n\t\t\tm = l\n\t\t\tl++\n\t\t\tMarkStrongConnections(node, graph, m)\n\t\t}\n\t}\n}", "func (node *URLNode) generateTree(tabSize int) string {\n\tsubTree := \"\"\n\tfor _, child := range node.children {\n\t\tline := strings.Repeat(\"\\t\", tabSize)\n\t\tline += \"└── \"\n\t\tsubTree += line + child.generateTree(tabSize+1)\n\t}\n\treturn node.url + \"\\n\" + subTree\n}", "func (g DotGraph) String() string {\n\tcontent := []string{\"digraph \" + g.name + \" {\"}\n\tcontent = append(content, g.createGlobalAttributes()...)\n\n\tfor from, deps := range g.edges {\n\t\tnodeStylePattern := g.createNodeOptionsPatternString(from)\n\t\tcontent = append(content, from+nodeStylePattern)\n\n\t\tfor _, to := range deps {\n\t\t\tif from == `\"\"` && to.nodeID == `\"\"` {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tedgeStyle := g.createEdgeOptionsPatternString(to.nodeID, to.description)\n\t\t\tcontent = append(content, from+\"->\"+to.nodeID+edgeStyle)\n\t\t}\n\t}\n\n\tcontent = append(content, \"}\")\n\n\treturn strings.Join(content, \"\\n\")\n}", "func (f *Fragment) Encode(w io.Writer) error {\n\ttraf := f.Moof.Traf\n\terr := traf.OptimizeTfhdTrun()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, b := range f.Children {\n\t\terr := b.Encode(w)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func PrettyPrint(graph *Graph) {\n\tfmt.Println(graph.Name)\n\tfmt.Println(\"\")\n\tstr := recursiveString(graph.Root, 0, true)\n\tfmt.Printf(\"%s\", str)\n}", "func printGroupStructure(g *clcv2.GroupInfo, indent string) {\n\tvar groupLine string\n\n\tif g.Type != \"default\" { // 'Archive' or similar: make it stand out\n\t\tgroupLine = fmt.Sprintf(\"%s[%s]/\", indent, g.Name)\n\t} else {\n\t\tgroupLine = fmt.Sprintf(\"%s%s/\", indent, g.Name)\n\t}\n\n\tif showFlags.GroupID {\n\t\tfmt.Printf(\"%-70s %s\\n\", groupLine, g.ID)\n\t} else {\n\t\tfmt.Printf(\"%s\\n\", groupLine)\n\t}\n\n\tfor _, s := range g.Servers {\n\t\tfmt.Printf(\"%s%s\\n\", indent+\" \", s)\n\t}\n\n\tfor _, g := range g.Groups {\n\t\tprintGroupStructure(g, indent+\" \")\n\t}\n}", "func (g *Graph) Write(w io.Writer, format string) error {\n\treturn templates.ExecuteTemplate(w, format+\".tmpl\", g)\n}", "func ownerToString(node *yaml.RNode) (string, error) {\n\tmeta, err := node.GetMeta()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tnamespace := meta.Namespace\n\n\towners, err := node.Pipe(yaml.Lookup(\"metadata\", \"ownerReferences\"))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif owners == nil {\n\t\treturn \"\", nil\n\t}\n\n\telements, err := owners.Elements()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif len(elements) == 0 {\n\t\treturn \"\", err\n\t}\n\towner := elements[0]\n\tvar kind, name string\n\n\tif value := owner.Field(\"kind\"); !value.IsNilOrEmpty() {\n\t\tkind = value.Value.YNode().Value\n\t}\n\tif value := owner.Field(\"name\"); !value.IsNilOrEmpty() {\n\t\tname = value.Value.YNode().Value\n\t}\n\n\treturn fmt.Sprintf(\"%s %s/%s\", kind, namespace, name), nil\n}", "func createGraph() *Graph {\n var g = Graph{}\n g.adjList = make(map[int]set)\n return &g\n}", "func saveAs(name string, node encoding.BinaryMarshaler) error {\n\tb, err := node.MarshalBinary()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := ioutil.WriteFile(name, b, 0660); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func writeInode(file *os.File, index int64, inode *iNode) {\n\tfile.Seek(index, 0)\n\t//Empezamos el proceso de guardar en binario la data en memoria del struct\n\tvar binaryDisc bytes.Buffer\n\tbinary.Write(&binaryDisc, binary.BigEndian, inode)\n\twriteNextBytes(file, binaryDisc.Bytes())\n}", "func printMST(parent []int, vertices int, graph [][]float64, k int) {\n\n\tfmt.Println(\"Edge Weight\")\n\n\tfor i := 1; i < vertices; i++ {\n\t\tif comp.numberOfComponents != 1 {\n\t\t\tfmt.Printf(\"%d - %d %f \\n\", comp.compMaps[k][parent[i]], comp.compMaps[k][i], graph[i][parent[i]])\n\t\t\tadj_forest[comp.compMaps[k][parent[i]]-1][comp.compMaps[k][i]-1] = graph[i][parent[i]]\n\t\t\tadj_forest[comp.compMaps[k][i]-1][comp.compMaps[k][parent[i]]-1] = graph[i][parent[i]]\n\t\t} else {\n\t\t\tfmt.Printf(\"%d - %d %f \\n\", comp.compMaps[k][parent[i]+1], comp.compMaps[k][i+1], graph[i][parent[i]])\n\t\t\tadj_forest[comp.compMaps[k][parent[i]]][comp.compMaps[k][i]] = graph[i][parent[i]]\n\t\t\tadj_forest[comp.compMaps[k][i]][comp.compMaps[k][parent[i]]] = graph[i][parent[i]]\n\t\t}\n\n\t}\n\n}", "func (t *TreeStorage) Write(ctx context.Context, nodes []storage.Node) error {\n\tms := make([]*spanner.Mutation, 0, len(nodes))\n\tfor _, node := range nodes {\n\t\t// TODO(pavelkalinnikov): Consider doing just Insert when it is clear what\n\t\t// semantic the callers need.\n\t\tms = append(ms, spanner.InsertOrUpdate(\"TreeNodes\",\n\t\t\t[]string{\"TreeID\", \"ShardID\", \"NodeID\", \"NodeHash\"},\n\t\t\t[]interface{}{t.id, t.opts.shardID(node.ID), packNodeID(node.ID), node.Hash}))\n\t}\n\t_, err := t.c.Apply(ctx, ms)\n\treturn err\n}", "func (g *Group) SetOwner(svg *Svg) {\n\tg.Owner = svg\n\tfor _, gn := range g.Elements {\n\t\tswitch gn.(type) {\n\t\tcase *Group:\n\t\t\tgn.(*Group).Owner = g.Owner\n\t\t\tgn.(*Group).SetOwner(svg)\n\t\tcase *Path:\n\t\t\tgn.(*Path).group = g\n\t\t}\n\t}\n}", "func (graph *Graph) BuildGraph(count int, templateHTMLPath string, dumpFolder string) error {\n\tgraph.Nodes = []Node{}\n\tpageDocs, error := graph.ReadPages(count, templateHTMLPath)\n\tgraph.CreateAllPages(pageDocs)\n\tgraph.createOutboundLinks()\n\tgraph.dumpSite(dumpFolder)\n\treturn error\n}", "func (g *unionGraph) Union(a, b unionNode) {\n\tinA := g.find(a)\n\tinB := g.find(b)\n\tif inA != inB {\n\t\tif inA.rank > inB.rank {\n\t\t\tinB.parent = inA\n\t\t} else if inA.rank < inB.rank {\n\t\t\tinA.parent = inB\n\t\t} else { // inA.rank == inB.rank\n\t\t\tinA.parent = inB\n\t\t\tinB.rank++\n\t\t}\n\t}\n}", "func printGraph(format string, dependencies map[string]map[string]bool) {\n\tswitch format {\n\tcase formatDigraph:\n\t\tprintDigraph(os.Stdout, dependencies)\n\tcase formatGraphviz:\n\t\tprintGraphviz(os.Stdout, dependencies)\n\t}\n}", "func Generate(w io.Writer, g goflow.GraphRenderer) error {\n\ttmpl, err := template.\n\t\tNew(\"template\").\n\t\tFuncs(template.FuncMap{\n\t\t\t\"DepsNameAndTypes\": func(fields []goflow.Field) string {\n\t\t\t\ts := make([]string, len(fields))\n\t\t\t\tfor i, f := range fields {\n\t\t\t\t\ts[i] = fmt.Sprintf(\"%s %s\", f.Name, f.Type)\n\t\t\t\t}\n\t\t\t\treturn strings.Join(s, \"\\n\")\n\t\t\t},\n\t\t\t\"NameAndTypes\": func(fields []goflow.Field) string {\n\t\t\t\ts := make([]string, len(fields))\n\t\t\t\tfor i, f := range fields {\n\t\t\t\t\ts[i] = fmt.Sprintf(\"%s %s\", f.Name, f.Type)\n\t\t\t\t}\n\t\t\t\treturn strings.Join(s, \", \")\n\t\t\t},\n\t\t\t\"Names\": func(fields []goflow.Field) string {\n\t\t\t\ts := make([]string, len(fields))\n\t\t\t\tfor i, f := range fields {\n\t\t\t\t\ts[i] = f.Name\n\t\t\t\t}\n\t\t\t\treturn strings.Join(s, \", \")\n\t\t\t},\n\t\t}).\n\t\tParse(tmplStr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn tmpl.Execute(w, nodeSorter{g})\n}", "func createGraph3() *NodeG {\n n1 := NodeG{1, nil}\n n2 := NodeG{2, nil}\n n3 := NodeG{3, nil}\n n1.neighbors = append(n1.neighbors, &n2)\n n2.neighbors = append(n2.neighbors, &n3)\n\n return &n1\n}", "func (a *RelationAssembler) GenerateJSON() bytes.Buffer {\n\n\t// buffer to store the json data\n\tvar buffer bytes.Buffer\n\n\t// keep track of sub-relations\n\tvar current int\n\tvar relations = make([]*gosmparse.Relation, 1)\n\trelations[0] = a.Relation\n\n\t// synchronize goroutines\n\tvar wg = &sync.WaitGroup{}\n\twg.Add(1)\n\n\t// write all members and sub members to buffer\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tfor current < len(relations) {\n\n\t\t\t// contains too many child relations\n\t\t\tif len(relations) >= MAX_MEMBER_RELATIONS {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\twriteRelation(&buffer, a, &relations, relations[current])\n\t\t\tcurrent++\n\t\t}\n\t}()\n\n\t// done\n\twg.Wait()\n\n\t// debug max sub relations for this entity\n\t// fmt.Printf(\"%d: %d\\n\", a.Relation.ID, len(relations))\n\n\treturn buffer\n}", "func DumpToGraphviz(tables map[string]Table) {\n\tfmt.Printf(\"graph schema {\\n\")\n\tfmt.Printf(\" layout=fdp;\\n\")\n\tfmt.Printf(\" K=0.15;\\n\")\n\tfmt.Printf(\" maxiter=1000;\\n\")\n\tfmt.Printf(\" start=0;\\n\\n\")\n\n\tfor _, table := range tables {\n\t\tfmt.Printf(\"\\\"%s\\\" [shape=box];\\n\", table.Name)\n\n\t\tfor _, column := range table.Columns {\n\t\t\t_, primary := table.PKColumns[column]\n\t\t\tcolor := \"transparent\"\n\t\t\tif primary {\n\t\t\t\tcolor = \"gainsboro\"\n\t\t\t}\n\t\t\tfmt.Printf(\"\\\"%s-%s\\\" [label=\\\"\\\" xlabel=\\\"%s\\\" style=filled fillcolor=\\\"%s\\\"];\\n\", table.Name, column, column, color)\n\t\t\tfmt.Printf(\"\\\"%s\\\" -- \\\"%s-%s\\\";\\n\", table.Name, table.Name, column)\n\t\t}\n\n\t\tif len(table.PKSequence) > 0 {\n\t\t\tfmt.Printf(\"\\\"%s-id-%s\\\" [label=\\\"%s\\\" shape=note];\\n\", table.Name, table.PKSequence, table.PKSequence)\n\t\t\tfmt.Printf(\"\\\"%s-id\\\" -- \\\"%s-id-%s\\\" [style=dashed];\\n\", table.Name, table.Name, table.PKSequence)\n\t\t}\n\n\t\tfor _, index := range table.UniqueIndexes {\n\t\t\tlabel := \"unique\"\n\t\t\tif len(table.MainUniqueIndexName) > 0 {\n\t\t\t\tif strings.Compare(index.Name, table.MainUniqueIndexName) == 0 {\n\t\t\t\t\tlabel = \"unique main\"\n\t\t\t\t}\n\t\t\t}\n\t\t\tfmt.Printf(\"\\\"%s\\\" [label=\\\"%s\\\" shape=tab];\\n\", index.Name, label)\n\n\t\t\tfor _, indexColumn := range index.Columns {\n\t\t\t\tfmt.Printf(\"\\\"%s-%s\\\" -- \\\"%s\\\" [style=dashed];\\n\", table.Name, indexColumn, index.Name)\n\t\t\t}\n\t\t}\n\n\t\tfor i, reference := range table.References {\n\t\t\tfmt.Printf(\"\\\"%s-%s-%d\\\" [label=\\\"\\\" shape=diamond];\\n\", table.Name, reference.TableName, i)\n\n\t\t\tfor column, foreignColumn := range reference.ColumnMapping {\n\t\t\t\tfmt.Printf(\"\\\"%s-%s-%d\\\" -- \\\"%s-%s\\\";\\n\", table.Name, reference.TableName, i, table.Name, column)\n\t\t\t\tfmt.Printf(\"\\\"%s-%s-%d\\\" -- \\\"%s-%s\\\";\\n\", table.Name, reference.TableName, i, reference.TableName, foreignColumn)\n\t\t\t}\n\t\t}\n\t}\n\n\tfmt.Printf(\"}\")\n}", "func TransactionGraph(sourceOutput SiacoinOutputID, edges []TransactionGraphEdge) ([]Transaction, error) {\n\t// Generating the transaction graph based on a set of edges is non-trivial.\n\t//\n\t// Step 1: Generate a map of nodes. Each node records which nodes use it for\n\t// input, and which nodes use it for output. The map goes from node index to\n\t// node data.\n\t//\n\t// Step 2: Create a list of outputs that need to be added to a transaction.\n\t// The first element of this list will be node 0, which uses the source\n\t// output as its input.\n\t//\n\t// Step 3: For each node in the list, check whether that node has already\n\t// been added to a transaction for its outputs. If so, skip that node.\n\t//\n\t// Step 4: For the nodes whose outputs do not yet appear in a transaction,\n\t// create a transaction to house that node. Then follow each output of the\n\t// node to the inputs of the destination nodes.\n\t//\n\t// Step 5: For each input in a destination node, follow that input back to\n\t// the node that created the output. If that output already appears in a\n\t// transaction, the graph is invalid and an error must be returned. If that\n\t// node's outputs do not appear in a transaction yet, that node's inputs\n\t// need to be checked. If that node's inputs do not appear in a transaction\n\t// yet, the current transaction has to be put on hold and the transaction\n\t// for those inputs needs to be created by following the inputs back to\n\t// their corresponding outputs and starting back at step 2.\n\t//\n\t// Step 6: As the transactions are searched, any outputs created by the\n\t// transaction will need to be added to the list of outputs that haven't had\n\t// their transactions finished yet to be searched later.\n\t//\n\t// Step 7: Once all transaction diagrams are complete, translate into\n\t// transactions.\n\t//\n\t// In short, the algorithm we use is essentially a recursive\n\t// depth-first-search that builds the correct transaction graph, and then\n\t// the transactions are processed in an order that allows us to create all\n\t// of their IDs.\n\n\t// Basic input validation.\n\tif len(edges) < 1 {\n\t\treturn nil, errors.New(\"no graph specificed\")\n\t}\n\n\t// Check that the first value of 'sources' is zero, and that the rest of the\n\t// array is sorted.\n\tif edges[0].Source != 0 {\n\t\treturn nil, errors.New(\"first edge must speficy node 0 as the parent\")\n\t}\n\tif edges[0].Dest != 1 {\n\t\treturn nil, errors.New(\"first edge must speficy node 1 as the child\")\n\t}\n\tlatest := edges[0].Source\n\tfor _, edge := range edges {\n\t\tif edge.Source < latest {\n\t\t\treturn nil, errors.New(\"'sources' input is not sorted\")\n\t\t}\n\t\tlatest = edge.Source\n\t}\n\n\t// Create the set of output ids, and fill out the input ids for the source\n\t// transaction.\n\tbiggest := 0\n\tfor _, edge := range edges {\n\t\tif edge.Dest > biggest {\n\t\t\tbiggest = edge.Dest\n\t\t}\n\t}\n\ttxnInputs := make([][]SiacoinOutputID, biggest+1)\n\ttxnInputs[0] = []SiacoinOutputID{sourceOutput}\n\n\t// Go through the nodes bit by bit and create outputs.\n\t// Fill out the outputs for the source.\n\ti, j := 0, 0\n\tts := make([]Transaction, edges[len(edges)-1].Source+1)\n\tfor i < len(edges) {\n\t\tvar t Transaction\n\n\t\t// Grab the inputs for this transaction.\n\t\tfor _, outputID := range txnInputs[j] {\n\t\t\tt.SiacoinInputs = append(t.SiacoinInputs, SiacoinInput{\n\t\t\t\tParentID: outputID,\n\t\t\t})\n\t\t}\n\n\t\t// Grab the outputs for this transaction.\n\t\tstartingPoint := i\n\t\tcurrent := edges[i].Source\n\t\tfor i < len(edges) && edges[i].Source == current {\n\t\t\tt.SiacoinOutputs = append(t.SiacoinOutputs, SiacoinOutput{\n\t\t\t\tValue: edges[i].Value,\n\t\t\t\tUnlockHash: UnlockConditions{}.UnlockHash(),\n\t\t\t})\n\t\t\tif !edges[i].Fee.IsZero() {\n\t\t\t\tt.MinerFees = append(t.MinerFees, edges[i].Fee)\n\t\t\t}\n\t\t\ti++\n\t\t}\n\n\t\t// Record the inputs for the next transactions.\n\t\tfor k := startingPoint; k < i; k++ {\n\t\t\ttxnInputs[edges[k].Dest] = append(txnInputs[edges[k].Dest], t.SiacoinOutputID(uint64(k-startingPoint)))\n\t\t}\n\t\tts[j] = t\n\t\tj++\n\t}\n\n\treturn ts, nil\n}", "func (g *Graph) GobEncode() ([]byte, error) {\n\tgGob := graphGob{[]string{}, map[string]map[string]int{}}\n\n\t// add vertexes and edges to gGob\n\tfor key, v := range g.vertexes {\n\t\tgGob.Vertexes = append(gGob.Vertexes, key)\n\n\t\tgGob.Edges[key] = map[string]int{}\n\n\t\t// for each neighbor...\n\t\tfor neighbor, weight := range v.neighbors {\n\t\t\t// save the edge connection to the neighbor into the edges map\n\t\t\tgGob.Edges[key][neighbor.key] = weight\n\t\t}\n\t}\n\n\t// encode gGob\n\tbuf := &bytes.Buffer{}\n\tenc := gob.NewEncoder(buf)\n\terr := enc.Encode(gGob)\n\n\treturn buf.Bytes(), err\n}", "func (node *Node) printTree1(out *bytes.Buffer, isRight bool, indent string) {\n\n\tif (node.Left != nil) {\n\t\tstr := \" \"\n\t\tif isRight {\n\t\t\tstr = \" | \"\n\t\t}\n\t\tstr = indent + str\n\t\tnode.Left.printTree1(out, false, str)\n\t}\n\n\tout.Write([]byte(indent))\n\tif (isRight) {\n\t\tout.Write([]byte(\"\\\\\"))\n\t} else {\n\t\tout.Write([]byte (\"/\"))\n\t}\n\tout.Write([]byte(\"--\"))\n\n\tnode.printNodeValue(out)\n\n\tif (node.Right != nil) {\n\t\tstr := \" | \"\n\t\tif isRight {\n\t\t\tstr = \" \"\n\t\t}\n\t\tstr = indent + str\n\t\tnode.Right.printTree1(out, true, str)\n\t}\n\n}", "func (wr *plainGenomeWriter) writeNetworkNode(n *network.NNode) error {\n\ttrait_id := 0\n\tif n.Trait != nil {\n\t\ttrait_id = n.Trait.Id\n\t}\n\tact_str, err := utils.NodeActivators.ActivationNameFromType(n.ActivationType)\n\tif err == nil {\n\t\t_, err = fmt.Fprintf(wr.w, \"%d %d %d %d %s\", n.Id, trait_id, n.NodeType(),\n\t\t\tn.NeuronType, act_str)\n\t}\n\treturn err\n}", "func EncodeDAG(ctx context.Context, dag format.NodeGetter, e Encoder, nd format.Node, r Recoverability) (format.Node, error) {\n\tif len(nd.Links()) == 0 {\n\t\treturn nd, nil\n\t}\n\n\tfor _, l := range nd.Links() {\n\t\tnd, err := l.GetNode(ctx, dag)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tend, err := EncodeDAG(ctx, dag, e, nd, r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif !nd.Cid().Equals(end.Cid()) {\n\t\t\tl.Size, err = end.Size()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tl.Cid = end.Cid()\n\t\t}\n\t}\n\n\treturn e.Encode(ctx, nd, r)\n}", "func createGraph1() *NodeG {\n n1 := NodeG{2, nil}\n n2 := NodeG{4, nil}\n n1.neighbors = append(n1.neighbors, &n2)\n n1.neighbors = append(n1.neighbors, &n1)\n n2.neighbors = append(n2.neighbors, &n1)\n\n // fmt.Println(\">>>>>>1\")\n // fmt.Println(n1)\n // fmt.Println(n2)\n // fmt.Println(\">>>>>>2\")\n\n return &n1\n}", "func main() {\n\troot := &TreeNode{\n\t\tVal: 2,\n\t\tLeft: &TreeNode{\n\t\t\tVal: 1,\n\t\t},\n\t\tRight: &TreeNode{\n\t\t\tVal: 3,\n\t\t},\n\t}\n\tprintTreeNodeByDFS(root)\n\tfmt.Println()\n\n\tser := Constructor()\n\ttreeString := ser.serialize(root)\n\tfmt.Println(treeString)\n\tans := ser.deserialize(treeString)\n\t// printTreeNodeByBFS(ans)\n\tprintTreeNodeByDFS(ans)\n\tfmt.Println()\n}", "func (g *Graph) Node(gvk schema.GroupVersionKind, obj metav1.Object) *Node {\n\tapiVersion, kind := gvk.ToAPIVersionAndKind()\n\tnode := &Node{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: apiVersion,\n\t\t\tKind: kind,\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tUID: obj.GetUID(),\n\t\t\tNamespace: obj.GetNamespace(),\n\t\t\tName: obj.GetName(),\n\t\t\tAnnotations: FilterByValue(obj.GetAnnotations(), func(v string) bool {\n\t\t\t\treturn !strings.HasPrefix(v, \"{\") && !strings.HasPrefix(v, \"[\")\n\t\t\t}),\n\t\t\tLabels: obj.GetLabels(),\n\t\t},\n\t}\n\n\tif n, ok := g.Nodes[obj.GetUID()]; ok {\n\t\tif len(n.GetAnnotations()) != 0 {\n\t\t\tnode.SetAnnotations(n.GetAnnotations())\n\t\t}\n\t\tif len(n.GetLabels()) != 0 {\n\t\t\tnode.SetLabels(n.GetLabels())\n\t\t}\n\t}\n\n\tg.Nodes[obj.GetUID()] = node\n\n\tfor _, ownerRef := range obj.GetOwnerReferences() {\n\t\towner := g.Node(\n\t\t\tschema.FromAPIVersionAndKind(ownerRef.APIVersion, ownerRef.Kind),\n\t\t\t&metav1.ObjectMeta{\n\t\t\t\tUID: ownerRef.UID,\n\t\t\t\tName: ownerRef.Name,\n\t\t\t\tNamespace: obj.GetNamespace(),\n\t\t\t},\n\t\t)\n\t\tg.Relationship(owner, kind, node)\n\t}\n\n\treturn node\n}", "func (g *CallGraph) WriteGraphviz(w io.Writer) error {\n\tif g.edges == nil {\n\t\tif err := callgraph.GraphVisitEdges(g.cg, g.populateEdges); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tbufw := bufio.NewWriter(w)\n\tbufw.WriteString(\"digraph callgraph {\\n\")\n\t// Instead of using template..\n\tfor _, edge := range g.edges {\n\t\tbufw.WriteString(fmt.Sprintf(\" %q -> %q\\n\", edge.Caller, edge.Callee))\n\t}\n\tbufw.WriteString(\"}\\n\")\n\tbufw.Flush()\n\treturn nil\n}", "func (m *ConnectedOrganizationMembers) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n err := m.SubjectSet.Serialize(writer)\n if err != nil {\n return err\n }\n {\n err = writer.WriteStringValue(\"connectedOrganizationId\", m.GetConnectedOrganizationId())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"description\", m.GetDescription())\n if err != nil {\n return err\n }\n }\n return nil\n}", "func (this *Codec) serialize(root *TreeNode) string {\n\treturn dfsSerial(root, \"\")\n}", "func create(\n\ttrx storage.Transaction,\n\ttxId merkle.Digest,\n\townerData OwnerData,\n\towner *account.Account,\n) {\n\t// increment the count for owner\n\tnKey := owner.Bytes()\n\tcount := trx.Get(storage.Pool.OwnerNextCount, nKey)\n\tif nil == count {\n\t\tcount = []byte{0, 0, 0, 0, 0, 0, 0, 0}\n\t} else if uint64ByteSize != len(count) {\n\t\tlogger.Panic(\"OwnerNextCount database corrupt\")\n\t}\n\tnewCount := make([]byte, uint64ByteSize)\n\tbinary.BigEndian.PutUint64(newCount, binary.BigEndian.Uint64(count)+1)\n\ttrx.Put(storage.Pool.OwnerNextCount, nKey, newCount, []byte{})\n\n\t// write to the owner list\n\toKey := append(owner.Bytes(), count...)\n\ttrx.Put(storage.Pool.OwnerList, oKey, txId[:], []byte{})\n\n\t// write new index record\n\tdKey := append(owner.Bytes(), txId[:]...)\n\ttrx.Put(storage.Pool.OwnerTxIndex, dKey, count, []byte{})\n\n\t// save owner data record\n\ttrx.Put(storage.Pool.OwnerData, txId[:], ownerData.Pack(), []byte{})\n}", "func writeNode(w io.Writer, fset *token.FileSet, x interface{}) {\n\t// convert trailing tabs into spaces using a tconv filter\n\t// to ensure a good outcome in most browsers (there may still\n\t// be tabs in comments and strings, but converting those into\n\t// the right number of spaces is much harder)\n\t//\n\t// TODO(gri) rethink printer flags - perhaps tconv can be eliminated\n\t// with an another printer mode (which is more efficiently\n\t// implemented in the printer than here with another layer)\n\tmode := printer.TabIndent | printer.UseSpaces\n\terr := (&printer.Config{Mode: mode, Tabwidth: tabwidth}).Fprint(&tconv{output: w}, fset, x)\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n}", "func (g *graph) String() string{\n\ts := \"Graph: \\n\"\n\tfor i,list := range g.nodes {\n\t\ts += \"Node \" + strconv.Itoa(i) + \":\\t\"\n\t\tfor n := range list.Iter() {\n\t\t\ts += strconv.Itoa(n.(int)) + \"\\t\"\n\t\t}\n\t\ts += \"\\n\"\n\t}\n\treturn s\n}", "func (s *ShortenBlock) nodeWrite(node *Node, data []byte) error {\n\tvar newID string\n\tvar err error\n\tlog.Debugf(\"writing %d bytes to node\", len(data))\n\tif newID, err = s.shortener.Write(data); err != nil {\n\t\treturn err\n\t}\n\tlog.Tracef(\"node id changed from %s to %s\", node.id, newID)\n\n\tnode.id = newID\n\tfor {\n\t\tnode = node.parent\n\t\tlog.Tracef(\"updating parent node %s\", node.id)\n\n\t\tvar childIDs []string\n\t\tfor _, child := range node.children {\n\t\t\tchildIDs = append(childIDs, child.id)\n\t\t}\n\t\tnewData := strings.Join(childIDs, \",\")\n\t\tlog.Tracef(\"new child nodes are %s\", newData)\n\n\t\tvar newID string\n\t\tlog.Debugf(\"writing %d bytes to node parent\", len(newData))\n\t\tif newID, err = s.shortener.Write([]byte(newData)); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tnode.id = newID\n\t\tfor _, child := range node.children {\n\t\t\tchild.parent = node\n\t\t}\n\t\tif node.parent == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (this *Codec) serialize(root *TreeNode) string {\n\tnodes := []*TreeNode{ root }\n\tstrList := []string{}\n\tfor i := 0; i < len(nodes); {\n\t\tcnt := len(nodes)\n\t\tfor ; i < cnt; i++ {\n\t\t\tnode := nodes[i]\n\t\t\tif node == nil {\n\t\t\t\tstrList = append(strList, \"null\")\n\t\t\t} else {\n\t\t\t\tstrList = append(strList, strconv.Itoa(node.Val))\n\t\t\t\tnodes = append(nodes, node.Left)\n\t\t\t\tnodes = append(nodes, node.Right)\n\t\t\t}\n\t\t}\n\t}\n\treturn \"[\" + strings.Join(strList, \"\") + \"]\"\n}", "func (g *NewGraph) PrintGraph() {\n\tfor i := range g.NodeSets {\n\t\tfmt.Println(g.NodeSets[i])\n\t}\n}", "func main() {\n graph := createGraph()\n graph.addEdge(1, 2)\n graph.addEdge(2, 3)\n graph.addEdge(2, 4)\n graph.addEdge(3, 4)\n graph.addEdge(1, 5)\n graph.addEdge(5, 6)\n graph.addEdge(5, 7)\n\n visited := make(set)\n\n dfs(graph, 1, visited, func(node int) {\n fmt.Print(node, \" \")\n })\n}", "func (this *Codec) serialize(root *TreeNode) string {\n\tif root == nil {\n\t\treturn \"\"\n\t}\n\n\tres := make([]string, 0)\n\tqueue := make([]*TreeNode, 0)\n\tqueue = append(queue, root)\n\tfor len(queue) > 0 {\n\t\tl := len(queue)\n\t\tfor i := 0; i < l; i++ {\n\t\t\tnode := queue[0]\n\t\t\tqueue = queue[1:]\n\t\t\tif node != nil {\n\t\t\t\tres = append(res, strconv.Itoa(node.Val))\n\t\t\t\tqueue = append(queue, node.Left, node.Right)\n\t\t\t} else {\n\t\t\t\tres = append(res, \"#\")\n\t\t\t}\n\n\t\t}\n\t}\n\treturn strings.Join(res, \",\")\n}", "func (c cluster) WriteOrder(hash string) []node {\n\treturn hashOrder(hash, len(c.GetNeighbors())+1, c.WriteRing())\n}", "func main() {\n\n nodes := []graph.Node{}\n router := Router{ \"routerA\",1 }\n router2 := Router{ \"routerB\",2 }\n subnet := Subnet{ \"subnet1\", 10}\n nodes = append(nodes, router)\n// nodes = append(nodes, subnet)\n g := graph.NewGraph(nodes)\n g.AddNode(subnet)\n g.AddNode(router2)\n\n\n g.SetEdge(router, subnet)\n g.SetEdge(router2, subnet)\n\n g.Dump()\n\n// weight := float64(40)\n// edge := g.NewWeightedEdge(router, subnet, weight)\n// g.SetWeightedEdge(edge)\n\n// fmt.Printf(\"%v\\n\", g)\n// g.Dump()\n\n/*\n self := 0.0 // the cost of self connection\n absent := 10.0 // the wieght returned for absent edges\n\n graph := simple.NewWeightedUndirectedGraph(self, absent)\n fmt.Printf(\"%v\\n\", graph)\n\n var id int64\n //var node simple.Node\n\n id = 0\n from := simple.Node(id)\n graph.AddNode(from)\n\n id = 1\n to := simple.Node(id)\n graph.AddNode(to)\n\n id = 2\n from2 := simple.Node(id)\n graph.AddNode(from2)\n\n id = 3\n to2 := simple.Node(id)\n graph.AddNode(to2)\n\n\n nodeA := graph.Node(int64(2))\n\n\n\n fmt.Printf(\"%v\\n\", graph)\n\n nodes := graph.Nodes()\n fmt.Printf(\"%v\\n\", nodes)\n fmt.Printf(\"%v\\n\", nodeA)\n\n weight := float64(40)\n edge := graph.NewWeightedEdge(from, to, weight)\n graph.SetWeightedEdge(edge)\n\n edge2 := graph.NewWeightedEdge(from2, to2, weight)\n graph.SetWeightedEdge(edge2)\n\n fmt.Printf(\"%v\\n\", graph)\n edges := graph.Edges()\n fmt.Printf(\"%v\\n\", edges)\n\n edge_ := graph.Edge(int64(0) ,int64(1))\n fmt.Printf(\"%v\\n\", edge_)\n*/\n}", "func (i *IndexBuilder) walk() error {\n\treturn i.g.CommitIter(func(branch string, c *git.Commit, tree *git.Tree, head bool) error {\n\t\tlog.Infof(\"Inspecting commit-id '%s/%s'\", branch, c.Id().String())\n\t\tvar chartDirs []string\n\t\tvar err error\n\t\tif head && branch == \"master\" {\n\t\t\tlog.Infof(\"HEAD: Retrieving all chart directories...\")\n\t\t\tchartDirs, err = i.listAllChartDirs()\n\t\t} else {\n\t\t\tchartDirs, err = i.listModifiedChartDirs(c, tree)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlog.Debugf(\"Chart directories: '%v'\", chartDirs)\n\t\treturn i.inspectDirs(chartDirs, branch, c, head)\n\t})\n}", "func (agent *MerkleAgent) Serialize() []byte{\n\tsize := config.Size\n\tret := make([]byte, 4 + 4 + size + int(agent.H) * size)\n\tbinary.LittleEndian.PutUint32(ret[0:4], agent.H)\n\tbinary.LittleEndian.PutUint32(ret[4:8], uint32(size))\n\tcopy(ret[8:8+size], agent.root[:])\n\toffset := 8 + size\n\tfor i := 0; i < int(agent.H); i++{\n\t\tcopy(ret[offset:offset+size], agent.auth[i][:])\n\t\toffset += size\n\t}\n\tfor i := 0; i < int(agent.H); i++{\n\t\ttreeHashBytes := agent.treeHashStacks[i].Serialize()\n\t\tret = append(ret, treeHashBytes...)\n\t}\n\tfor _, node := range agent.nodeHouse{\n\t\tret = append(ret, node...)\n\t}\n\treturn ret\n}", "func (this *Codec) serialize(root *TreeNode) string {\n\tif root == nil {\n\t\treturn \"nil\"\n\t}\n\treturn strconv.Itoa(root.Val) + \",\" + this.serialize(root.Left) + \",\" + this.serialize(root.Right)\n}", "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+\"%d\\n\", n.key)\n\t\tstringify(n.right, level)\n\t}\n}", "func (e EmptyNode) EncodeBinary(*io.BinWriter) {\n}", "func encodeNodeWithType(n Node, w *io.BinWriter) {\n\tw.WriteB(byte(n.Type()))\n\tn.EncodeBinary(w)\n}", "func Generate(data io.ReadSeeker, dataSize int64, treeReader io.ReadSeeker, treeWriter io.WriteSeeker, dataAndTreeInSameFile bool) ([]byte, error) {\n\tlayout := InitLayout(dataSize, dataAndTreeInSameFile)\n\n\tnumBlocks := (dataSize + layout.blockSize - 1) / layout.blockSize\n\n\t// If the data is in the same file as the tree, zero pad the last data\n\t// block.\n\tbytesInLastBlock := dataSize % layout.blockSize\n\tif dataAndTreeInSameFile && bytesInLastBlock != 0 {\n\t\tzeroBuf := make([]byte, layout.blockSize-bytesInLastBlock)\n\t\tif _, err := treeWriter.Seek(0, io.SeekEnd); err != nil && err != io.EOF {\n\t\t\treturn nil, err\n\t\t}\n\t\tif _, err := treeWriter.Write(zeroBuf); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Store the current offset, so we can set it back once verification\n\t// finishes.\n\torigOffset, err := data.Seek(0, io.SeekCurrent)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer data.Seek(origOffset, io.SeekStart)\n\n\t// Read from the beginning of both data and treeReader.\n\tif _, err := data.Seek(0, io.SeekStart); err != nil && err != io.EOF {\n\t\treturn nil, err\n\t}\n\n\tif _, err := treeReader.Seek(0, io.SeekStart); err != nil && err != io.EOF {\n\t\treturn nil, err\n\t}\n\n\tvar root []byte\n\tfor level := 0; level < layout.numLevels(); level++ {\n\t\tfor i := int64(0); i < numBlocks; i++ {\n\t\t\tbuf := make([]byte, layout.blockSize)\n\t\t\tvar (\n\t\t\t\tn int\n\t\t\t\terr error\n\t\t\t)\n\t\t\tif level == 0 {\n\t\t\t\t// Read data block from the target file since level 0 includes hashes\n\t\t\t\t// of blocks in the input data.\n\t\t\t\tn, err = data.Read(buf)\n\t\t\t} else {\n\t\t\t\t// Read data block from the tree file since levels higher than 0 are\n\t\t\t\t// hashing the lower level hashes.\n\t\t\t\tn, err = treeReader.Read(buf)\n\t\t\t}\n\n\t\t\t// err is populated as long as the bytes read is smaller than the buffer\n\t\t\t// size. This could be the case if we are reading the last block, and\n\t\t\t// break in that case. If this is the last block, the end of the block\n\t\t\t// will be zero-padded.\n\t\t\tif n == 0 && err == io.EOF {\n\t\t\t\tbreak\n\t\t\t} else if err != nil && err != io.EOF {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\t// Hash the bytes in buf.\n\t\t\tdigest := sha256.Sum256(buf)\n\n\t\t\tif level == layout.rootLevel() {\n\t\t\t\troot = digest[:]\n\t\t\t}\n\n\t\t\t// Write the generated hash to the end of the tree file.\n\t\t\tif _, err = treeWriter.Write(digest[:]); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\t// If the generated digests do not round up to a block, zero-padding the\n\t\t// remaining of the last block. But no need to do so for root.\n\t\tif level != layout.rootLevel() && numBlocks%layout.hashesPerBlock() != 0 {\n\t\t\tzeroBuf := make([]byte, layout.blockSize-(numBlocks%layout.hashesPerBlock())*layout.digestSize)\n\t\t\tif _, err := treeWriter.Write(zeroBuf[:]); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tnumBlocks = (numBlocks + layout.hashesPerBlock() - 1) / layout.hashesPerBlock()\n\t}\n\treturn root, nil\n}" ]
[ "0.6092704", "0.586756", "0.58613664", "0.57382333", "0.5712016", "0.56290585", "0.5610613", "0.5602439", "0.55215484", "0.54591393", "0.5436809", "0.5413327", "0.53986627", "0.5312661", "0.5216152", "0.51965225", "0.514187", "0.5128386", "0.5080789", "0.5075414", "0.5053383", "0.5034032", "0.5033987", "0.499279", "0.49819502", "0.49766588", "0.4963234", "0.49425358", "0.4932012", "0.4922566", "0.4915826", "0.49048176", "0.490085", "0.48961908", "0.48816642", "0.48592773", "0.48552522", "0.48508236", "0.48384094", "0.48306322", "0.4815688", "0.47982213", "0.47787225", "0.47553867", "0.47498515", "0.47466788", "0.4731142", "0.47304294", "0.47137746", "0.47136247", "0.4710455", "0.47006166", "0.46816114", "0.4680425", "0.4679492", "0.46757782", "0.46745726", "0.46611688", "0.46491674", "0.46379918", "0.4636279", "0.46334285", "0.4624189", "0.4620127", "0.46134523", "0.46006948", "0.4594411", "0.45867515", "0.45862913", "0.45790902", "0.45780545", "0.45650476", "0.4564029", "0.45560074", "0.45549473", "0.45525247", "0.4544659", "0.45418578", "0.45385662", "0.45352012", "0.4534263", "0.45309746", "0.4526098", "0.45239624", "0.45168886", "0.45143354", "0.45099995", "0.4508674", "0.45071885", "0.44904825", "0.44784206", "0.4470868", "0.44708264", "0.44685042", "0.44628704", "0.44603235", "0.44561446", "0.44504684", "0.44480306", "0.44463006" ]
0.7600591
0
ownerToString generate a string to identify the owner matches nodeToString format
ownerToString генерирует строку для идентификации владельца, соответствующую формату nodeToString
func ownerToString(node *yaml.RNode) (string, error) { meta, err := node.GetMeta() if err != nil { return "", err } namespace := meta.Namespace owners, err := node.Pipe(yaml.Lookup("metadata", "ownerReferences")) if err != nil { return "", err } if owners == nil { return "", nil } elements, err := owners.Elements() if err != nil { return "", err } if len(elements) == 0 { return "", err } owner := elements[0] var kind, name string if value := owner.Field("kind"); !value.IsNilOrEmpty() { kind = value.Value.YNode().Value } if value := owner.Field("name"); !value.IsNilOrEmpty() { name = value.Value.YNode().Value } return fmt.Sprintf("%s %s/%s", kind, namespace, name), nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o RepositoryAssociationRepositoryBitbucketOutput) Owner() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RepositoryAssociationRepositoryBitbucket) string { return v.Owner }).(pulumi.StringOutput)\n}", "func (o BucketReplicationConfigurationRuleDestinationAccessControlTranslationOutput) Owner() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BucketReplicationConfigurationRuleDestinationAccessControlTranslation) string { return v.Owner }).(pulumi.StringOutput)\n}", "func (o BucketReplicationConfigRuleDestinationAccessControlTranslationOutput) Owner() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BucketReplicationConfigRuleDestinationAccessControlTranslation) string { return v.Owner }).(pulumi.StringOutput)\n}", "func (o *V0037Node) GetOwner() string {\n\tif o == nil || o.Owner == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Owner\n}", "func (t *Transaction) Owner() string {\n\treturn utils.EncodeToBase64(t.owner.Bytes())\n}", "func (r *Document) Owner() pulumi.StringOutput {\n\treturn (pulumi.StringOutput)(r.s.State[\"owner\"])\n}", "func (o SubnetOutput) OwnerId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Subnet) pulumi.StringOutput { return v.OwnerId }).(pulumi.StringOutput)\n}", "func (o TopicPolicyOutput) Owner() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *TopicPolicy) pulumi.StringOutput { return v.Owner }).(pulumi.StringOutput)\n}", "func (o TriggerGithubOutput) Owner() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v TriggerGithub) *string { return v.Owner }).(pulumi.StringPtrOutput)\n}", "func (o RepositoryAssociationRepositoryBitbucketPtrOutput) Owner() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RepositoryAssociationRepositoryBitbucket) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Owner\n\t}).(pulumi.StringPtrOutput)\n}", "func (o RepositoryAssociationRepositoryGithubEnterpriseServerOutput) Owner() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RepositoryAssociationRepositoryGithubEnterpriseServer) string { return v.Owner }).(pulumi.StringOutput)\n}", "func (o TriggerGithubPtrOutput) Owner() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TriggerGithub) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Owner\n\t}).(pulumi.StringPtrOutput)\n}", "func (o LookupManagedPrefixListResultOutput) OwnerId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupManagedPrefixListResult) string { return v.OwnerId }).(pulumi.StringOutput)\n}", "func (s *Stream) Owner() string {\n\tif s.OwnerRaw == nil {\n\t\treturn \"\"\n\t}\n\n\treturn *s.OwnerRaw\n}", "func (n *Node) Owner() *userpb.UserId {\n\treturn n.SpaceRoot.owner\n}", "func (o GetAggregateConfigRulesRuleOutput) SourceOwner() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetAggregateConfigRulesRule) string { return v.SourceOwner }).(pulumi.StringOutput)\n}", "func (o RepositoryAssociationRepositoryGithubEnterpriseServerPtrOutput) Owner() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RepositoryAssociationRepositoryGithubEnterpriseServer) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Owner\n\t}).(pulumi.StringPtrOutput)\n}", "func (s OwnerIdentifier) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o BucketReplicationConfigRuleDestinationAccessControlTranslationPtrOutput) Owner() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BucketReplicationConfigRuleDestinationAccessControlTranslation) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Owner\n\t}).(pulumi.StringPtrOutput)\n}", "func (me TAttlistGeneralNoteOwner) String() string { return xsdt.Token(me).String() }", "func (o GetRulesRuleOutput) SourceOwner() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetRulesRule) string { return v.SourceOwner }).(pulumi.StringOutput)\n}", "func (o BucketReplicationConfigurationRuleDestinationAccessControlTranslationPtrOutput) Owner() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BucketReplicationConfigurationRuleDestinationAccessControlTranslation) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Owner\n\t}).(pulumi.StringPtrOutput)\n}", "func TopLevelOwnerKey(ctx context.Context, obj metav1.Object, kubeContext string, kind string) string {\n\tfor {\n\t\tor := obj.GetOwnerReferences()\n\t\tif or == nil {\n\t\t\treturn fmt.Sprintf(\"%s-%s\", kind, obj.GetName())\n\t\t}\n\t\tvar err error\n\t\tkind = or[0].Kind\n\t\tobj, err = ownerMetaObject(ctx, obj.GetNamespace(), kubeContext, or[0])\n\t\tif err != nil {\n\t\t\tlog.Entry(ctx).Warnf(\"unable to get owner from reference: %v\", or[0])\n\t\t\treturn \"\"\n\t\t}\n\t}\n}", "func (r *RouteTable) OwnerId() pulumi.StringOutput {\n\treturn (pulumi.StringOutput)(r.s.State[\"ownerId\"])\n}", "func (o SnapshotOutput) OwnerAccount() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Snapshot) pulumi.StringOutput { return v.OwnerAccount }).(pulumi.StringOutput)\n}", "func (o LookupMulticastDomainResultOutput) OwnerId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupMulticastDomainResult) string { return v.OwnerId }).(pulumi.StringOutput)\n}", "func (a Account) ShowOwner() string {\n\treturn a.owner\n}", "func (_NodeSpace *NodeSpaceCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _NodeSpace.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (s IpOwner) String() string {\n\treturn awsutil.Prettify(s)\n}", "func (o *StorageNetAppCloudTargetAllOf) GetOwner() string {\n\tif o == nil || o.Owner == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Owner\n}", "func (_Node *NodeCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Node.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (l *loadBalancer) Owner() string {\n\tif l.shared {\n\t\treturn \"\"\n\t}\n\n\tfor _, ingresses := range l.ingresses {\n\t\tfor _, ingress := range ingresses {\n\t\t\treturn fmt.Sprintf(\"%s/%s\", ingress.Namespace, ingress.Name)\n\t\t}\n\t}\n\n\treturn \"\"\n}", "func (o VirtualGatewayOutput) ResourceOwner() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *VirtualGateway) pulumi.StringOutput { return v.ResourceOwner }).(pulumi.StringOutput)\n}", "func (o LookupStreamingImageResultOutput) Owner() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LookupStreamingImageResult) *string { return v.Owner }).(pulumi.StringPtrOutput)\n}", "func (o VirtualGatewayOutput) MeshOwner() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *VirtualGateway) pulumi.StringOutput { return v.MeshOwner }).(pulumi.StringOutput)\n}", "func (n *Node) Owner() (*userpb.UserId, error) {\n\tif n.owner != nil {\n\t\treturn n.owner, nil\n\t}\n\n\towner := &userpb.UserId{}\n\n\t// FIXME ... do we return the owner of the reference or the owner of the target?\n\t// we don't really know the owner of the target ... and as the reference may point anywhere we cannot really find out\n\t// but what are the permissions? all? none? the gateway has to fill in?\n\t// TODO what if this is a reference?\n\tnodePath := n.InternalPath()\n\t// lookup parent id in extended attributes\n\tvar attrBytes []byte\n\tvar err error\n\t// lookup ID in extended attributes\n\tattrBytes, err = xattr.Get(nodePath, xattrs.OwnerIDAttr)\n\tswitch {\n\tcase err == nil:\n\t\towner.OpaqueId = string(attrBytes)\n\tcase isAttrUnset(err), isNotFound(err):\n\t\tfallthrough\n\tdefault:\n\t\treturn nil, err\n\t}\n\n\t// lookup IDP in extended attributes\n\tattrBytes, err = xattr.Get(nodePath, xattrs.OwnerIDPAttr)\n\tswitch {\n\tcase err == nil:\n\t\towner.Idp = string(attrBytes)\n\tcase isAttrUnset(err), isNotFound(err):\n\t\tfallthrough\n\tdefault:\n\t\treturn nil, err\n\t}\n\n\t// lookup type in extended attributes\n\tattrBytes, err = xattr.Get(nodePath, xattrs.OwnerTypeAttr)\n\tswitch {\n\tcase err == nil:\n\t\towner.Type = utils.UserTypeMap(string(attrBytes))\n\tcase isAttrUnset(err), isNotFound(err):\n\t\tfallthrough\n\tdefault:\n\t\t// TODO the user type defaults to invalid, which is the case\n\t\terr = nil\n\t}\n\n\tn.owner = owner\n\treturn n.owner, err\n}", "func (a LinkOwnershipClass) String() string {\n\tswitch a {\n\tcase OwnerToOwner:\n\t\treturn \"owner-to-owner\"\n\tcase OwnerToAny:\n\t\treturn \"owner-to-any\"\n\tcase AnyToOwner:\n\t\treturn \"any-to-owner\"\n\tdefault:\n\t\treturn \"<unknown link ownership class>\"\n\t}\n}", "func nodeToString(fs *token.FileSet, n ast.Node) string {\n\tb := bytes.NewBuffer([]byte{})\n\tprinter.Fprint(b, fs, n)\n\treturn b.String()\n}", "func (img Image) GetOwner() string {\n\treturn \"\"\n}", "func (o LookupVirtualRouterResultOutput) ResourceOwner() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupVirtualRouterResult) string { return v.ResourceOwner }).(pulumi.StringOutput)\n}", "func NodeToString(node core.Node) string {\n\tvar b strings.Builder\n\tfmt.Println()\n\tnodeRecurse(node, 0, &b)\n\treturn b.String()\n}", "func (me TAttlistMedlineCitationOwner) String() string { return xsdt.Token(me).String() }", "func (b *FollowUpBuilder) Owner(value string) *FollowUpBuilder {\n\tb.owner = value\n\tb.bitmap_ |= 512\n\treturn b\n}", "func (theAccount Account) Owner() string {\n\treturn theAccount.owner\n}", "func (s *SOC) OwnerAddress() []byte {\n\treturn s.owner\n}", "func (_BaseContentSpace *BaseContentSpaceCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseContentSpace.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (o *V0037Node) SetOwner(v string) {\n\to.Owner = &v\n}", "func (_Onesplitaudit *OnesplitauditCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Onesplitaudit.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_BaseGroupFactory *BaseGroupFactoryCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseGroupFactory.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func nodeToString(node *yaml.RNode) (string, error) {\n\tmeta, err := node.GetMeta()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn fmt.Sprintf(\"%s %s/%s\", meta.Kind, meta.Namespace, meta.Name), nil\n}", "func (_LvStreamRightsHolder *LvStreamRightsHolderCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _LvStreamRightsHolder.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func getOwnerSidString(sd []byte) (string, error) {\n\t// Make sure we have enough bytes to safely read the required fields.\n\tif len(sd) < int(unsafe.Sizeof(SECURITY_DESCRIPTOR_RELATIVE{})) {\n\t\treturn \"\", fmt.Errorf(\"Short Security Descriptor: %d bytes!\", len(sd))\n\t}\n\n\t// Only valid revision is 1, verify that.\n\trevision := getRevision(sd)\n\tif revision != SID_REVISION {\n\t\treturn \"\", fmt.Errorf(\"Invalid SID revision (%d), expected %d!\", revision, SID_REVISION)\n\t}\n\n\t// SECURITY_DESCRIPTOR_RELATIVE.OffsetOwner.\n\toffsetOwner := binary.LittleEndian.Uint32(sd[4:8])\n\tif offsetOwner >= uint32(len(sd)) {\n\t\treturn \"\", fmt.Errorf(\"offsetOwner (%d) points outside Security Descriptor of size %d bytes!\",\n\t\t\toffsetOwner, len(sd))\n\t}\n\n\tsidStr, err := sidToString(sd[offsetOwner:])\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn \"O:\" + sidStr, nil\n}", "func (_BaseContentFactory *BaseContentFactoryCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseContentFactory.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (network *VirtualNetwork) Owner() *genruntime.ResourceReference {\n\tgroup, kind := genruntime.LookupOwnerGroupKind(network.Spec)\n\treturn &genruntime.ResourceReference{\n\t\tGroup: group,\n\t\tKind: kind,\n\t\tName: network.Spec.Owner.Name,\n\t}\n}", "func (_LvRecordableStream *LvRecordableStreamCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _LvRecordableStream.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (as *AclStatus) Owner() string {\n\treturn as.aclStatus.GetOwner()\n}", "func (o *V0037Node) GetOwnerOk() (*string, bool) {\n\tif o == nil || o.Owner == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Owner, true\n}", "func (_Trebuchet *TrebuchetCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Trebuchet.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "func (_Smartchef *SmartchefCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Smartchef.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "func (_ChpRegistry *ChpRegistryCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _ChpRegistry.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "func (o LookupGatewayResultOutput) OwnerAccountId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupGatewayResult) string { return v.OwnerAccountId }).(pulumi.StringOutput)\n}", "func (f *HubCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := f.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func OwnerAddr(wk *key.Key) NodeOpt {\n\treturn func(opts *nodeOpts) error {\n\t\topts.ownerKey = wk\n\t\treturn nil\n\t}\n}", "func (_BaseAccessControlGroup *BaseAccessControlGroupCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseAccessControlGroup.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_FCToken *FCTokenCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _FCToken.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_BurnableToken *BurnableTokenCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _BurnableToken.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "func (_DetailedTestToken *DetailedTestTokenCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _DetailedTestToken.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (peering *VirtualNetworksVirtualNetworkPeering) Owner() *genruntime.ResourceReference {\n\tgroup, kind := genruntime.LookupOwnerGroupKind(peering.Spec)\n\treturn &genruntime.ResourceReference{\n\t\tGroup: group,\n\t\tKind: kind,\n\t\tName: peering.Spec.Owner.Name,\n\t}\n}", "func (topic *Topic) Owner() *genruntime.ResourceReference {\n\tgroup, kind := genruntime.LookupOwnerGroupKind(topic.Spec)\n\treturn &genruntime.ResourceReference{\n\t\tGroup: group,\n\t\tKind: kind,\n\t\tName: topic.Spec.Owner.Name,\n\t}\n}", "func (_OracleMgr *OracleMgrCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _OracleMgr.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "func ownerOrCurrentUser(gr *GroupResource, owner *string) error {\n\tif owner == nil || (*owner) == \"\" {\n\t\tcurrent, err := gr.client.Users.Current()\n\t\tif err == nil {\n\t\t\treturn err\n\t\t}\n\t\t*owner = current.User.Username\n\t}\n\treturn nil\n}", "func (_TokenVesting *TokenVestingCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _TokenVesting.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "func (o RouteOutput) InstanceOwnerId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Route) pulumi.StringOutput { return v.InstanceOwnerId }).(pulumi.StringOutput)\n}", "func (_Gatekeeper *GatekeeperCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Gatekeeper.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "func (_BaseContentFactoryExt *BaseContentFactoryExtCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseContentFactoryExt.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_Caller *CallerCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Caller.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (c *Client)GetOwner(name string)string{\n\treturn strings.Split(name,\"-\")[0]\n}", "func CodeOwner() string {\n\towner, _ := parseCodeRepoRaw()\n\treturn owner\n\n}", "func (_ElvTokenHelper *ElvTokenHelperCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _ElvTokenHelper.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_BaseFactory *BaseFactoryCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseFactory.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (k Keeper) GetMembersOwner(ctx sdk.Context, id uint64) string {\n\treturn k.GetMembers(ctx, id).Creator\n}", "func (_Container *ContainerCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Container.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_BaseContent *BaseContentCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseContent.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_ZKOnacci *ZKOnacciSession) OwnerOf(tokenId *big.Int) (common.Address, error) {\n\treturn _ZKOnacci.Contract.OwnerOf(&_ZKOnacci.CallOpts, tokenId)\n}", "func (rule *NamespacesTopicsSubscriptionsRule) Owner() *genruntime.ResourceReference {\n\tgroup, kind := genruntime.LookupOwnerGroupKind(rule.Spec)\n\treturn &genruntime.ResourceReference{\n\t\tGroup: group,\n\t\tKind: kind,\n\t\tName: rule.Spec.Owner.Name,\n\t}\n}", "func LabelOwnerCyclone() string {\n\treturn LabelOwner + \"=\" + OwnerCyclone\n}", "func (p Order) GetOwnerID() string {\n\treturn p.OwnerID.Hex()\n}", "func (_MetaObject *MetaObjectCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _MetaObject.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_HasNoEther *HasNoEtherCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _HasNoEther.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "func (_PBridge *PBridgeCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _PBridge.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_Editable *EditableCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Editable.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (o OwnershipLevel) String() string {\n\treturn string(o)\n}", "func (_SingleAuto *SingleAutoCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _SingleAuto.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_Cakevault *CakevaultCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Cakevault.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_LvRecording *LvRecordingCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _LvRecording.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (rr RepositoryReference) String() string {\n\treturn fmt.Sprintf(\"%s/%s\", rr.OwnerName, rr.Name)\n}", "func (_Votes *VotesCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Votes.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "func (_ZKOnacci *ZKOnacciCallerSession) OwnerOf(tokenId *big.Int) (common.Address, error) {\n\treturn _ZKOnacci.Contract.OwnerOf(&_ZKOnacci.CallOpts, tokenId)\n}", "func (_BaseAccessWalletFactory *BaseAccessWalletFactoryCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseAccessWalletFactory.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (s S3BucketOwner) String() string {\n\treturn awsutil.Prettify(s)\n}" ]
[ "0.70522296", "0.6943506", "0.69375956", "0.688022", "0.6856853", "0.6838874", "0.68302846", "0.67942965", "0.6789248", "0.67787945", "0.6762392", "0.6750272", "0.6650149", "0.6641561", "0.65653723", "0.65565586", "0.6555649", "0.6503313", "0.6494172", "0.6487006", "0.6482137", "0.6471201", "0.645364", "0.6440409", "0.6432808", "0.642556", "0.6406507", "0.6387009", "0.63457984", "0.63235337", "0.63074094", "0.6306351", "0.6280077", "0.62060845", "0.61961925", "0.61756915", "0.612887", "0.6067165", "0.6057717", "0.6056137", "0.6043704", "0.60313666", "0.6030846", "0.60295045", "0.6012226", "0.5989447", "0.59846216", "0.5968691", "0.59572625", "0.59387803", "0.5932242", "0.5915297", "0.5914082", "0.5913642", "0.5901566", "0.5900776", "0.59001124", "0.5883652", "0.5883495", "0.5882085", "0.588059", "0.5879416", "0.5879324", "0.58781403", "0.58723134", "0.587159", "0.5869158", "0.58592904", "0.5850257", "0.5847005", "0.5845539", "0.58360106", "0.5832202", "0.58314687", "0.5831405", "0.5829872", "0.5823703", "0.58122474", "0.580278", "0.57990545", "0.5797809", "0.57946867", "0.5776687", "0.57766616", "0.5776448", "0.57763547", "0.5774533", "0.5768984", "0.5768075", "0.57646984", "0.57616866", "0.5760717", "0.5756278", "0.57524693", "0.5746969", "0.5740973", "0.5740736", "0.5739714", "0.5732278", "0.5731846" ]
0.8615006
0
index indexes the Resources by their package
index индексирует Resources по их пакету
func (p TreeWriter) index(nodes []*yaml.RNode) map[string][]*yaml.RNode { // index the ResourceNodes by package indexByPackage := map[string][]*yaml.RNode{} for i := range nodes { meta, err := nodes[i].GetMeta() if err != nil || meta.Kind == "" { // not a resource continue } pkg := filepath.Dir(meta.Annotations[kioutil.PathAnnotation]) indexByPackage[pkg] = append(indexByPackage[pkg], nodes[i]) } return indexByPackage }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (pi *PackageIndexer) Index(pack *Package) string {\n\tpi.mutex.Lock() \n\tdefer pi.mutex.Unlock()\n\t// foreach loop over the package's dependencies \n\tfor _, dep := range pack.deps {\n\t\t// query for each dependency\n\t\tif dep.name != \"\" && pi.Query(dep.name) == FAIL {\n\t\t\t// dependency not installed, cannot be indexed \n\t\t\treturn FAIL\n\t\t}\n\t}\n\t// package dependencies exist: update/add package \n\tpi.packs[pack.name] = pack\n\n\treturn OK \n}", "func (w *exportWriter) writeIndex(index map[types.Object]uint64) {\n\ttype pkgObj struct {\n\t\tobj types.Object\n\t\tname string // qualified name; differs from obj.Name for type params\n\t}\n\t// Build a map from packages to objects from that package.\n\tpkgObjs := map[*types.Package][]pkgObj{}\n\n\t// For the main index, make sure to include every package that\n\t// we reference, even if we're not exporting (or reexporting)\n\t// any symbols from it.\n\tif w.p.localpkg != nil {\n\t\tpkgObjs[w.p.localpkg] = nil\n\t}\n\tfor pkg := range w.p.allPkgs {\n\t\tpkgObjs[pkg] = nil\n\t}\n\n\tfor obj := range index {\n\t\tname := w.p.exportName(obj)\n\t\tpkgObjs[obj.Pkg()] = append(pkgObjs[obj.Pkg()], pkgObj{obj, name})\n\t}\n\n\tvar pkgs []*types.Package\n\tfor pkg, objs := range pkgObjs {\n\t\tpkgs = append(pkgs, pkg)\n\n\t\tsort.Slice(objs, func(i, j int) bool {\n\t\t\treturn objs[i].name < objs[j].name\n\t\t})\n\t}\n\n\tsort.Slice(pkgs, func(i, j int) bool {\n\t\treturn w.exportPath(pkgs[i]) < w.exportPath(pkgs[j])\n\t})\n\n\tw.uint64(uint64(len(pkgs)))\n\tfor _, pkg := range pkgs {\n\t\tw.string(w.exportPath(pkg))\n\t\tw.string(pkg.Name())\n\t\tw.uint64(uint64(0)) // package height is not needed for go/types\n\n\t\tobjs := pkgObjs[pkg]\n\t\tw.uint64(uint64(len(objs)))\n\t\tfor _, obj := range objs {\n\t\t\tw.string(obj.name)\n\t\t\tw.uint64(index[obj.obj])\n\t\t}\n\t}\n}", "func IndexResourcesByName(items []types.Resource) map[string]types.Resource {\n\tindexed := make(map[string]types.Resource, len(items))\n\tfor _, item := range items {\n\t\tindexed[GetResourceName(item)] = item\n\t}\n\treturn indexed\n}", "func indexPackages(pkgs map[string]*ast.Package, prefix string) error {\n\tfor name, pkg := range pkgs {\n\t\tpath := prefix\n pack := name\n\t\t//fmt.Println(\"Inspecting \", path)\n\n\t\tast.Inspect(pkg, func(n ast.Node) bool {\n\n\t\t\tswitch x := n.(type) {\n\t\t\t//Packages\n\t\t\tcase *ast.Package:\n\t\t\t\tif x.Name != \"\" {\n\t\t\t\t\t//update index and docMap if necessary\n\t\t\t\t\tdocTerm := updateIndex(x.Name, pack, path)\n\t\t\t\t\t//update docTerm\n\t\t\t\t\tdocTerm.Packages += 1\n\t\t\t\t}\n\t\t\t\tbreak\n\n\t\t\t//Imports\n\t\t\tcase *ast.ImportSpec:\n\t\t\t\tif x.Path.Value != \"\" {\n\t\t\t\t\t//update index and docMap if necessary\n\t\t\t\t\tdocTerm := updateIndex(strings.Replace(x.Path.Value, \"\\\"\", \"\", -1), pack, path)\n\t\t\t\t\t//update docTerm\n\t\t\t\t\tdocTerm.Imports += 1\n\t\t\t\t}\n\t\t\t\tbreak\n\n\t\t\t//Functions\n\t\t\tcase *ast.FuncDecl:\n\t\t\t\tif x.Name.Name != \"\" {\n\t\t\t\t\t//Name tokenize function\n\t\t\t\t\tfor _, n := range tokenizeCamelCase(x.Name.Name) {\n\t\t\t\t\t\t//update index and docMap if necessary\n\t\t\t\t\t\tdocTerm := updateIndex(n, pack, path)\n\t\t\t\t\t\t//update docTerm\n\t\t\t\t\t\tdocTerm.Functions += 1\n\t\t\t\t\t}\n\n\t\t\t\t\t//Add comments to index\n\t\t\t\t\tif x.Doc != nil && *commentParse {\n\t\t\t\t\t\tcomment := \"\"\n\t\t\t\t\t\tfor _, c := range x.Doc.List {\n\t\t\t\t\t\t\tcomment += c.Text\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcomment = strings.Replace(comment, \"//\", \"\", -1)\n\t\t\t\t\t\tcomment = strings.ToLower(comment)\n\n\t\t\t\t\t\twords := strings.Fields(comment)\n\n\t\t\t\t\t\tfor _, word := range words {\n\t\t\t\t\t\t\tdocTerm := updateIndex(word, pack, path)\n\t\t\t\t\t\t\tdocTerm.Functions += 1\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\n\t\t\tcase *ast.TypeSpec:\n\t\t\t\tif x.Name.Name != \"\" {\n\t\t\t\t\t//Name tokenize function\n\t\t\t\t\tfor _, n := range tokenizeCamelCase(x.Name.Name) {\n\t\t\t\t\t\t//update index and docMap if necessary\n\t\t\t\t\t\tdocTerm := updateIndex(n, pack, path)\n\t\t\t\t\t\t//update docTerm\n\t\t\t\t\t\tdocTerm.Types += 1\n\t\t\t\t\t}\n\n\t\t\t\t\t//Add comments to index\n\t\t\t\t\tif x.Doc != nil && *commentParse {\n\t\t\t\t\t\tcomment := \"\"\n\t\t\t\t\t\tfor _, c := range x.Doc.List {\n\t\t\t\t\t\t\tcomment += c.Text\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcomment = strings.Replace(comment, \"//\", \"\", -1)\n\t\t\t\t\t\tcomment = strings.ToLower(comment)\n\n\t\t\t\t\t\twords := strings.Fields(comment)\n\n\t\t\t\t\t\tfor _, word := range words {\n\t\t\t\t\t\t\tdocTerm := updateIndex(word, pack, path)\n\t\t\t\t\t\t\tdocTerm.Types += 1\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn true\n\t\t})\n\t}\n\n\treturn nil\n}", "func IndexResourcesByName(items []envoy_types.ResourceWithTTL) map[string]envoy_types.ResourceWithTTL {\n\tindexed := make(map[string]envoy_types.ResourceWithTTL, len(items))\n\tfor _, item := range items {\n\t\tkey := GetResourceName(item.Resource)\n\t\tindexed[key] = item\n\t}\n\treturn indexed\n}", "func (api *MediaApi) index(c *routing.Context) error {\n\t// --- fetch search data\n\tsearchFields := []string{\"title\", \"type\", \"path\", \"created\", \"modified\"}\n\tsearchData := utils.GetSearchConditions(c, searchFields)\n\t// ---\n\n\t// --- fetch sort data\n\tsortFields := []string{\"title\", \"type\", \"path\", \"created\", \"modified\"}\n\tsortData := utils.GetSortFields(c, sortFields)\n\t// ---\n\n\ttotal, _ := api.dao.Count(searchData)\n\n\tlimit, page := utils.GetPaginationSettings(c, total)\n\n\tutils.SetPaginationHeaders(c, limit, total, page)\n\n\titems := []models.Media{}\n\n\tif total > 0 {\n\t\titems, _ = api.dao.GetList(limit, limit*(page-1), searchData, sortData)\n\n\t\titems = daos.ToAbsMediaPaths(items)\n\t}\n\n\treturn c.Write(items)\n}", "func index(pkg *pkg) error {\n\n\t// ensure dependencies are indexed\n\tfor _, dependency := range pkg.Dependencies {\n\t\tif _, ok := indexRead(dependency); !ok {\n\t\t\treturn missingDependencies\n\t\t}\n\t}\n\n\t// if this index already exists we need to just update dependencies\n\texistingPkg, ok := indexRead(pkg.Name)\n\tif ok {\n\t\treturn updateDependents(existingPkg, pkg)\n\t}\n\n\t// update any dependants of this package\n\tupdateDependents(nil, pkg)\n\n\t// add the new index (possibly replacing the old)\n\tindexWrite(pkg.Name, pkg)\n\n\treturn nil\n}", "func Index(realms map[string]*cloudformation.Realm, name, repo, dir, description string) j.ObjectType {\n\tfields := []j.Type{\n\t\td.Import(),\n\t\td.Pkg(name, path.Join(repo, dir, \"main.libsonnet\"), description),\n\t}\n\n\tfor _, realm := range realms {\n\t\timp := filepath.Join(GenPrefix, realm.N(\"realm\"), MainFile)\n\t\tfields = append(fields, j.Hidden(j.Import(realm.Name, imp)))\n\t}\n\n\tSortFields(fields)\n\n\treturn j.Object(\"\", fields...)\n}", "func (router *Router) getResources(w http.ResponseWriter, r *http.Request) {\n\tclusterNames := r.URL.Query()[\"cluster\"]\n\tnamespaces := r.URL.Query()[\"namespace\"]\n\tname := r.URL.Query().Get(\"name\")\n\tresource := r.URL.Query().Get(\"resource\")\n\tpath := r.URL.Query().Get(\"path\")\n\tparamName := r.URL.Query().Get(\"paramName\")\n\tparam := r.URL.Query().Get(\"param\")\n\n\tlog.WithFields(logrus.Fields{\"clusters\": clusterNames, \"namespaces\": namespaces, \"name\": name, \"resource\": resource, \"path\": path, \"paramName\": paramName, \"param\": param}).Tracef(\"getResources\")\n\n\tvar resources []Resources\n\n\t// Loop through all the given cluster names and get for each provided name the cluster interface. After that we\n\t// check if the resource was provided via the forbidden resources list.\n\tfor _, clusterName := range clusterNames {\n\t\tcluster := router.clusters.GetCluster(clusterName)\n\t\tif cluster == nil {\n\t\t\terrresponse.Render(w, r, nil, http.StatusBadRequest, \"Invalid cluster name\")\n\t\t\treturn\n\t\t}\n\n\t\tif router.isForbidden(resource) {\n\t\t\terrresponse.Render(w, r, nil, http.StatusForbidden, fmt.Sprintf(\"Access for resource %s is forbidding\", resource))\n\t\t\treturn\n\t\t}\n\n\t\t// If the namespaces slice is nil, we retrieve the resource for all namespaces. If a list of namespaces was\n\t\t// provided we loop through all the namespaces and return the resources for these namespaces. All results are\n\t\t// added to the resources slice, which is then returned by the api.\n\t\tif namespaces == nil {\n\t\t\tlist, err := cluster.GetResources(r.Context(), \"\", name, path, resource, paramName, param)\n\t\t\tif err != nil {\n\t\t\t\terrresponse.Render(w, r, err, http.StatusBadRequest, \"Could not get resources\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvar tmpResources map[string]interface{}\n\t\t\terr = json.Unmarshal(list, &tmpResources)\n\t\t\tif err != nil {\n\t\t\t\terrresponse.Render(w, r, err, http.StatusInternalServerError, \"Could not unmarshal resources\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tresources = append(resources, Resources{\n\t\t\t\tCluster: clusterName,\n\t\t\t\tNamespace: \"\",\n\t\t\t\tResources: tmpResources,\n\t\t\t})\n\t\t} else {\n\t\t\tfor _, namespace := range namespaces {\n\t\t\t\tlist, err := cluster.GetResources(r.Context(), namespace, name, path, resource, paramName, param)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrresponse.Render(w, r, err, http.StatusBadRequest, \"Could not get resources\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tvar tmpResources map[string]interface{}\n\t\t\t\terr = json.Unmarshal(list, &tmpResources)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrresponse.Render(w, r, err, http.StatusInternalServerError, \"Could not unmarshal resources\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tresources = append(resources, Resources{\n\t\t\t\t\tCluster: clusterName,\n\t\t\t\t\tNamespace: namespace,\n\t\t\t\t\tResources: tmpResources,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\tlog.WithFields(logrus.Fields{\"count\": len(resources)}).Tracef(\"getResources\")\n\trender.JSON(w, r, resources)\n}", "func (s *Server) getIndexes(w http.ResponseWriter, r *http.Request) {\n\tfs, err := s.db.List(\"file\")\n\tif err != nil {\n\t\ts.logf(\"error listing files from mpd for building indexes: %v\", err)\n\t\twriteXML(w, errGeneric)\n\t\treturn\n\t}\n\tfiles := indexFiles(fs)\n\n\twriteXML(w, func(c *container) {\n\t\tc.Indexes = &indexesContainer{\n\t\t\tLastModified: time.Now().Unix(),\n\t\t}\n\n\t\t// Incremented whenever it's time to create a new index for a new\n\t\t// initial letter\n\t\tidx := -1\n\n\t\tvar indexes []index\n\n\t\t// A set of initial characters, used to deduplicate the addition of\n\t\t// nwe indexes\n\t\tseenChars := make(map[rune]struct{}, 0)\n\n\t\tfor _, f := range files {\n\t\t\t// Filter any non-top level items\n\t\t\tif strings.Contains(f.Name, string(os.PathSeparator)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Initial rune is used to create an index name\n\t\t\tc, _ := utf8.DecodeRuneInString(f.Name)\n\t\t\tname := string(c)\n\n\t\t\t// If initial rune is a digit, put index under a numeric section\n\t\t\tif unicode.IsDigit(c) {\n\t\t\t\tc = '#'\n\t\t\t\tname = \"#\"\n\t\t\t}\n\n\t\t\t// If a new rune appears, create a new index for it\n\t\t\tif _, ok := seenChars[c]; !ok {\n\t\t\t\tseenChars[c] = struct{}{}\n\t\t\t\tindexes = append(indexes, index{Name: name})\n\t\t\t\tidx++\n\t\t\t}\n\n\t\t\tindexes[idx].Artists = append(indexes[idx].Artists, artist{\n\t\t\t\tName: f.Name,\n\t\t\t\tID: strconv.Itoa(f.ID),\n\t\t\t})\n\t\t}\n\n\t\tc.Indexes.Indexes = indexes\n\t})\n}", "func (d *docsIndexer) indexPackage(p *packages.Package) (docsPackage, error) {\n\tvar (\n\t\tpkgDocsMarkdown string\n\t\tconsts []constVarDocs\n\t\tvars []constVarDocs\n\t\ttypes []typeDocs\n\t\tfuncs []funcDocs\n\t\temitted = make(emittedDocumentationResults, 64)\n\t)\n\tfor _, file := range p.Syntax {\n\t\tfilename := p.Fset.Position(file.Pos()).Filename\n\t\tif !strings.HasPrefix(filename, d.i.projectRoot) {\n\t\t\t// Omit files (such as those generated by `go test`) that aren't in the project root\n\t\t\t// because those are not externally accessible under any circumstance.\n\t\t\tcontinue\n\t\t}\n\t\tfileDocs, err := d.indexFile(p, file, filepath.Base(filename), strings.HasSuffix(filename, \"_test.go\"))\n\t\tif err != nil {\n\t\t\treturn docsPackage{}, errors.Wrap(err, \"file \"+filename)\n\t\t}\n\t\tpkgDocsMarkdown += fileDocs.pkgDocsMarkdown\n\t\tfor _, c := range fileDocs.consts {\n\t\t\tconsts = append(consts, c)\n\t\t\temitted[c.def] = c.ID\n\t\t}\n\t\tfor _, v := range fileDocs.vars {\n\t\t\tvars = append(vars, v)\n\t\t\temitted[v.def] = v.ID\n\t\t}\n\t\tfor _, t := range fileDocs.types {\n\t\t\ttypes = append(types, t)\n\t\t\temitted[t.def] = t.ID\n\t\t}\n\t\tfor _, f := range fileDocs.funcs {\n\t\t\tfuncs = append(funcs, f)\n\t\t\temitted[f.def] = f.ID\n\t\t}\n\t}\n\n\trootPkgPath := d.rootPkgPath()\n\tshortestUniquePkgPath := strings.TrimPrefix(strings.TrimPrefix(pkgPathStdStrip(p.PkgPath), rootPkgPath), \"/\")\n\n\tvisibilityTags := []protocol.Tag{}\n\tif strings.Contains(p.PkgPath, \"/internal/\") || strings.HasSuffix(p.Name, \"_test\") {\n\t\tvisibilityTags = append(visibilityTags, protocol.TagPrivate)\n\t}\n\tif isDeprecated(pkgDocsMarkdown) {\n\t\tvisibilityTags = append(visibilityTags, protocol.TagDeprecated)\n\t}\n\tpkgTags := make([]protocol.Tag, len(visibilityTags))\n\tcopy(pkgTags, visibilityTags)\n\tpkgTags = append(pkgTags, protocol.TagPackage)\n\n\tpkgPathElements := strings.Split(pkgPathStdStrip(p.PkgPath), \"/\")\n\tpackageDocsID := (&documentationResult{\n\t\tDocumentation: protocol.Documentation{\n\t\t\tIdentifier: pkgPathElements[len(pkgPathElements)-1],\n\t\t\tSearchKey: shortestUniquePkgPath,\n\t\t\tNewPage: true,\n\t\t\tTags: pkgTags,\n\t\t},\n\t\tLabel: protocol.NewMarkupContent(\"Package \"+p.Name, protocol.PlainText),\n\t\tDetail: protocol.NewMarkupContent(pkgDocsMarkdown, protocol.Markdown),\n\t}).emit(d.i.emitter)\n\n\tnewSection := func(label, identifier string, children []uint64) uint64 {\n\t\tsectionID := (&documentationResult{\n\t\t\tDocumentation: protocol.Documentation{\n\t\t\t\tIdentifier: identifier,\n\t\t\t\tSearchKey: \"\", // don't index sections of documentation for search\n\t\t\t\tNewPage: false,\n\t\t\t\tTags: visibilityTags,\n\t\t\t},\n\t\t\tLabel: protocol.NewMarkupContent(label, protocol.PlainText),\n\t\t\tDetail: protocol.NewMarkupContent(\"\", protocol.PlainText),\n\t\t}).emit(d.i.emitter)\n\t\t_ = d.i.emitter.EmitDocumentationChildrenEdge(children, sectionID)\n\t\treturn sectionID\n\t}\n\n\tvar sections []uint64\n\t// Emit a \"Constants\" section\n\tsort.Slice(consts, func(i, j int) bool {\n\t\treturn sortName(\"\", \"\", consts[i].name, consts[j].name)\n\t})\n\tif len(consts) > 0 {\n\t\tvar children []uint64\n\t\tfor _, constDocs := range consts {\n\t\t\tchildren = append(children, constDocs.ID)\n\t\t}\n\t\tsections = append(sections, newSection(\"Constants\", \"const\", children))\n\t}\n\n\t// Emit a \"Variables\" section\n\tsort.Slice(vars, func(i, j int) bool {\n\t\treturn sortName(\"\", \"\", vars[i].name, vars[j].name)\n\t})\n\tif len(vars) > 0 {\n\t\tvar children []uint64\n\t\tfor _, varDocs := range vars {\n\t\t\tchildren = append(children, varDocs.ID)\n\t\t}\n\t\tsections = append(sections, newSection(\"Variables\", \"var\", children))\n\t}\n\n\t// Emit methods as children of their receiver types, functions as children of the type they\n\t// produce.\n\tsort.Slice(types, func(i, j int) bool {\n\t\treturn sortName(\"\", \"\", types[i].name, types[j].name)\n\t})\n\tsort.Slice(funcs, func(i, j int) bool {\n\t\treturn sortName(funcs[i].recvTypeName, funcs[j].recvTypeName, funcs[i].name, funcs[j].name)\n\t})\n\temittedMethods := map[uint64]struct{}{}\n\tfor _, typeDocs := range types {\n\t\tvar children []uint64\n\t\tfor _, funcDocs := range funcs {\n\t\t\tif _, emitted := emittedMethods[funcDocs.ID]; emitted {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif funcDocs.recvType == nil {\n\t\t\t\tvar matches int\n\t\t\t\tfor _, resultTypeExpr := range funcDocs.resultTypes {\n\t\t\t\t\tresultType := p.TypesInfo.TypeOf(resultTypeExpr)\n\t\t\t\t\tif dereference(resultType) == dereference(typeDocs.typ) {\n\t\t\t\t\t\tmatches++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif matches == 1 {\n\t\t\t\t\t// The function is only a child of the type it produces if there was one match.\n\t\t\t\t\t// If it returned multiple types, better off keeping it separate from both.\n\t\t\t\t\temittedMethods[funcDocs.ID] = struct{}{}\n\t\t\t\t\tchildren = append(children, funcDocs.ID)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor _, funcDocs := range funcs {\n\t\t\tif _, emitted := emittedMethods[funcDocs.ID]; emitted {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif funcDocs.recvType != nil {\n\t\t\t\trecvType := p.TypesInfo.TypeOf(funcDocs.recvType)\n\t\t\t\tif dereference(recvType) == dereference(typeDocs.typ) {\n\t\t\t\t\temittedMethods[funcDocs.ID] = struct{}{}\n\t\t\t\t\tchildren = append(children, funcDocs.ID)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif len(children) > 0 {\n\t\t\t_ = d.i.emitter.EmitDocumentationChildrenEdge(children, typeDocs.ID)\n\t\t}\n\t}\n\n\t// Emit a \"Types\" section\n\tif len(types) > 0 {\n\t\tvar children []uint64\n\t\tfor _, typeDocs := range types {\n\t\t\tchildren = append(children, typeDocs.ID)\n\t\t}\n\t\tsections = append(sections, newSection(\"Types\", \"type\", children))\n\t}\n\n\t// Emit a \"Functions\" section\n\tif len(funcs) > 0 {\n\t\tvar children []uint64\n\t\tfor _, funcDocs := range funcs {\n\t\t\tif _, emitted := emittedMethods[funcDocs.ID]; emitted {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tchildren = append(children, funcDocs.ID)\n\t\t}\n\t\tif len(children) > 0 {\n\t\t\tsections = append(sections, newSection(\"Functions\", \"func\", children))\n\t\t}\n\t}\n\n\treturn docsPackage{\n\t\tID: packageDocsID,\n\t\tPath: pkgPathStdStrip(p.PkgPath),\n\t\temitted: emitted,\n\t\tchildren: sections,\n\t}, nil\n}", "func (i *Indexer) indexDocumentation() error {\n\tvar (\n\t\td = &docsIndexer{i: i}\n\t\tmu sync.Mutex\n\t\tdocsPackages []docsPackage\n\t\temitted = make(emittedDocumentationResults, 4096)\n\t\temittedPackagesByPath = make(map[string]uint64, 32)\n\t\terrs error\n\t)\n\ti.visitEachPackage(\"Indexing documentation\", func(p *packages.Package) {\n\t\t// Index the package without the lock, for parallelism.\n\t\tdocsPkg, err := d.indexPackage(p)\n\n\t\t// Acquire the lock; note that multierror.Append could also be racy and hence we hold the\n\t\t// lock even for the error check. In practice, this is not where most of the work is done\n\t\t// (indexPackage is) so this is fine.\n\t\tmu.Lock()\n\t\tdefer mu.Unlock()\n\t\tif err != nil {\n\t\t\terrs = multierror.Append(errs, errors.Wrap(err, \"package \"+p.Name))\n\t\t\treturn\n\t\t}\n\t\temitted.addAll(docsPkg.emitted)\n\t\tdocsPackages = append(docsPackages, docsPkg)\n\t\temittedPackagesByPath[docsPkg.Path] = docsPkg.ID\n\t})\n\n\t// Find the root package path (e.g. \"github.com/sourcegraph/sourcegraph\").\n\trootPkgPath := d.rootPkgPath()\n\n\t// Build an understanding of all pages in the workspace.\n\ttype page struct {\n\t\tid uint64 // the page itself\n\t\tchildren []uint64 // the children pages of this one\n\t}\n\tpagesByPath := map[string]*page{}\n\tfor _, docsPkg := range docsPackages {\n\t\trelPackagePath := d.relPackagePath(docsPkg.Path, rootPkgPath)\n\t\tif _, exists := pagesByPath[relPackagePath]; exists {\n\t\t\tpanic(\"invariant: no duplicate paths\")\n\t\t}\n\t\tpagesByPath[relPackagePath] = &page{id: docsPkg.ID}\n\t}\n\n\t// Emit the root documentationResult which will link all packages in this project to the\n\t// project itself. If the root of the workspace is a Go package, this may already exist\n\t// and would be that Go package's documentation.\n\tif rootPage, ok := pagesByPath[\"\"]; ok {\n\t\t_ = i.emitter.EmitDocumentationResultEdge(rootPage.id, i.projectID)\n\t} else {\n\t\t// Emit a blank index page.\n\t\trootDocumentationID := (&documentationResult{\n\t\t\tDocumentation: protocol.Documentation{\n\t\t\t\tIdentifier: \"\",\n\t\t\t\tSearchKey: \"\",\n\t\t\t\tNewPage: true,\n\t\t\t\tTags: []protocol.Tag{},\n\t\t\t},\n\t\t\tLabel: protocol.NewMarkupContent(\"\", protocol.PlainText),\n\t\t\tDetail: protocol.NewMarkupContent(\"\", protocol.PlainText),\n\t\t}).emit(i.emitter)\n\t\t_ = i.emitter.EmitDocumentationResultEdge(rootDocumentationID, i.projectID)\n\t\tpagesByPath[\"\"] = &page{id: rootDocumentationID}\n\t}\n\n\t// What we have now is pages for each package in the workspace, e.g.:\n\t//\n\t// \t/ (root index page)\n\t// \t/internal/lib/protocol (package page)\n\t// \t/internal/lib/util (package page)\n\t// \t/router/mux (package page)\n\t//\n\t// What we want ot add in is index pages (blank pages) for each parent path so we end up with:\n\t//\n\t// \t/ (root index page)\n\t// \t/internal (index page)\n\t// \t/internal/lib (index page)\n\t// \t/internal/lib/protocol (package page)\n\t// \t/internal/lib/util (package page)\n\t// \t/router (index page)\n\t// \t/router/mux (package page)\n\t//\n\t// Note: the actual paths do not have a leading slash.\n\tsort.Slice(docsPackages, func(i, j int) bool {\n\t\treturn docsPackages[i].Path < docsPackages[j].Path\n\t})\n\tfor _, docsPkg := range docsPackages {\n\t\trelPackagePath := d.relPackagePath(docsPkg.Path, rootPkgPath)\n\t\tpkgPathElements := strings.Split(relPackagePath, \"/\") // [\"internal\", \"lib\", \"protocol\"]\n\n\t\t// Walk over each path: \"internal\", \"internal/lib\", \"internal/lib/protocol\" and emit an\n\t\t// index page for each that does not have it.\n\t\tcurrentPath := \"\"\n\t\tfor _, element := range pkgPathElements {\n\t\t\tcurrentPath = path.Join(currentPath, element)\n\t\t\t_, ok := pagesByPath[currentPath]\n\t\t\tif ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcurrentPathElements := strings.Split(currentPath, \"/\")\n\t\t\tparentPath := path.Join(currentPathElements[:len(currentPathElements)-1]...)\n\n\t\t\t// Emit an index page at this path since one does not exist.\n\t\t\tpageID := (&documentationResult{\n\t\t\t\tDocumentation: protocol.Documentation{\n\t\t\t\t\tIdentifier: element,\n\t\t\t\t\tSearchKey: \"\", // don't index for search\n\t\t\t\t\tNewPage: true,\n\t\t\t\t\tTags: []protocol.Tag{},\n\t\t\t\t},\n\t\t\t\tLabel: protocol.NewMarkupContent(\"\", protocol.PlainText),\n\t\t\t\tDetail: protocol.NewMarkupContent(\"\", protocol.PlainText),\n\t\t\t}).emit(i.emitter)\n\t\t\tparentPage, ok := pagesByPath[parentPath]\n\t\t\tif !ok {\n\t\t\t\tpanic(\"invariant: parentPage should always exist(1)\")\n\t\t\t}\n\t\t\tparentPage.children = append(parentPage.children, pageID)\n\t\t\tpagesByPath[currentPath] = &page{id: pageID}\n\t\t}\n\t}\n\n\t// Finalize children of pages.\n\tfor _, docsPkg := range docsPackages {\n\t\trelPackagePath := d.relPackagePath(docsPkg.Path, rootPkgPath)\n\n\t\t// Attach the children sections of the page (consts/vars/etc) as children of the page itself.\n\t\tpage, ok := pagesByPath[relPackagePath]\n\t\tif !ok {\n\t\t\tpanic(\"invariant: page should always exist\")\n\t\t}\n\t\tpage.children = append(page.children, docsPkg.children...)\n\n\t\t// Attach package documentation pages as children of their parent (either another package\n\t\t// documentation page, or a blank index page.)\n\t\tif relPackagePath == \"\" {\n\t\t\t// root is not a child of anything.\n\t\t\tcontinue\n\t\t}\n\t\tpkgPathElements := strings.Split(relPackagePath, \"/\") // [\"internal\", \"lib\", \"protocol\"]\n\t\tparentPath := path.Join(pkgPathElements[:len(pkgPathElements)-1]...)\n\t\tparentPage, ok := pagesByPath[parentPath]\n\t\tif !ok {\n\t\t\tpanic(\"invariant: parentPage should always exist(2)\")\n\t\t}\n\t\tparentPage.children = append(parentPage.children, docsPkg.ID)\n\t}\n\n\t// Emit children edges of all pages.\n\tfor _, page := range pagesByPath {\n\t\t_ = i.emitter.EmitDocumentationChildrenEdge(page.children, page.id)\n\t}\n\n\ti.emittedDocumentationResults = emitted\n\ti.emittedDocumentationResultsByPackagePath = emittedPackagesByPath\n\treturn errs\n}", "func (i *indexer) Index() (*Stats, error) {\n\tpkgs, err := i.packages()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn i.index(pkgs)\n}", "func (h *HTTPApi) listIndex(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tcollections := h.storageNode.Datasources[ps.ByName(\"datasource\")].GetMeta().Databases[ps.ByName(\"dbname\")].ShardInstances[ps.ByName(\"shardinstance\")].Collections[ps.ByName(\"collectionname\")]\n\n\t// Now we need to return the results\n\tif bytes, err := json.Marshal(collections.Indexes); err != nil {\n\t\t// TODO: log this better?\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t} else {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write(bytes)\n\t}\n}", "func (i indexer) Index(ctx context.Context, req IndexQuery) (\n\tresp *IndexResult, err error) {\n\n\tlog.Info(\"index [%v] root [%v] len_dirs=%v len_files=%v\",\n\t\treq.Key, req.Root, len(req.Dirs), len(req.Files))\n\tstart := time.Now()\n\t// Setup the response\n\tresp = NewIndexResult()\n\tif err = req.Normalize(); err != nil {\n\t\tlog.Info(\"index [%v] error: %v\", req.Key, err)\n\t\tresp.Error = errs.NewStructError(err)\n\t\treturn\n\t}\n\n\t// create index shards\n\tvar nshards int\n\tif nshards = i.cfg.NumShards; nshards == 0 {\n\t\tnshards = 1\n\t}\n\tnshards = utils.MinInt(nshards, maxShards)\n\ti.shards = make([]index.IndexWriter, nshards)\n\ti.root = getRoot(i.cfg, &req)\n\n\tfor n := range i.shards {\n\t\tname := path.Join(i.root, shardName(req.Key, n))\n\t\tixw, err := getIndexWriter(ctx, name)\n\t\tif err != nil {\n\t\t\tresp.Error = errs.NewStructError(err)\n\t\t\treturn resp, nil\n\t\t}\n\t\ti.shards[n] = ixw\n\t}\n\n\tfs := getFileSystem(ctx, i.root)\n\trepo := newRepoFromQuery(&req, i.root)\n\trepo.SetMeta(i.cfg.RepoMeta, req.Meta)\n\tresp.Repo = repo\n\n\t// Add query Files and scan Dirs for files to index\n\tnames, err := i.scanner(fs, &req)\n\tch := make(chan int, nshards)\n\tchnames := make(chan string, 100)\n\tgo func() {\n\t\tfor _, name := range names {\n\t\t\tchnames <- name\n\t\t}\n\t\tclose(chnames)\n\t}()\n\treqch := make(chan par.RequestFunc, nshards)\n\tfor _, shard := range i.shards {\n\t\treqch <- indexShard(&i, &req, shard, fs, chnames, ch)\n\t}\n\tclose(reqch)\n\terr = par.Requests(reqch).WithConcurrency(nshards).DoWithContext(ctx)\n\tclose(ch)\n\n\t// Await results, each indicating the number of files scanned\n\tfor num := range ch {\n\t\trepo.NumFiles += num\n\t}\n\n\trepo.NumShards = len(i.shards)\n\t// Flush our index shard files\n\tfor _, shard := range i.shards {\n\t\tshard.Flush()\n\t\trepo.SizeIndex += ByteSize(shard.IndexBytes())\n\t\trepo.SizeData += ByteSize(shard.DataBytes())\n\t\tlog.Debug(\"index flush %v (data) %v (index)\",\n\t\t\trepo.SizeData, repo.SizeIndex)\n\t}\n\trepo.ElapsedIndexing = time.Since(start)\n\trepo.TimeUpdated = time.Now().UTC()\n\n\tvar msg string\n\tif err != nil {\n\t\trepo.State = ERROR\n\t\tresp.SetError(err)\n\t\tmsg = \"error: \" + resp.Error.Error()\n\t} else {\n\t\trepo.State = OK\n\t\tmsg = \"ok \" + fmt.Sprintf(\n\t\t\t\"(%v files, %v data, %v index)\",\n\t\t\trepo.NumFiles, repo.SizeData, repo.SizeIndex)\n\t}\n\tlog.Info(\"index [%v] %v [%v]\", req.Key, msg, repo.ElapsedIndexing)\n\treturn\n}", "func indexesReport(c *clients.Client, response handle.ResponseHandle) error {\n\treq, err := http.NewRequest(\"GET\", c.Base()+\"/config/indexes\", nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn util.Execute(c, req, response)\n}", "func indexRead(key string) (*pkg, bool) {\n\tlocker.RLock()\n\tdefer locker.RUnlock()\n\n\tp, ok := indexedPkgs[key]\n\treturn p, ok\n}", "func index() string {\n\tvar buffer bytes.Buffer\n\tvar id = 0\n\tvar class = 0\n\tbuffer.WriteString(indexTemplate)\n\tlock.Lock()\n\tfor folderName, folder := range folders {\n\t\tbuffer.WriteString(fmt.Sprintf(\"<h2>%s</h2>\", folderName))\n\t\tfor _, source := range folder {\n\t\t\tif !anyNonRead(source) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tsort.Sort(source)\n\t\t\tbuffer.WriteString(fmt.Sprintf(\"<h3>%s</h3>\", source.Title))\n\t\t\tbuffer.WriteString(fmt.Sprintf(`<button onClick=\"hideAll('source_%d'); return false\">Mark all as read</button>`, class))\n\t\t\tbuffer.WriteString(\"<ul>\")\n\n\t\t\tfor _, entry := range source.Entries {\n\t\t\t\tif entry.Read {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tbuffer.WriteString(fmt.Sprintf(`<li id=\"entry_%d\">`, id))\n\t\t\t\tbuffer.WriteString(fmt.Sprintf(`<button class=\"source_%d\" onClick=\"hide('entry_%d', '%s'); return false\">Mark Read</button> `, class, id, entry.Url))\n\t\t\t\tbuffer.WriteString(fmt.Sprintf(`<a href=\"%s\">%s</a>`, entry.Url, entry.Title))\n\t\t\t\tbuffer.WriteString(\"</li>\")\n\t\t\t\tid += 1\n\t\t\t}\n\t\t\tbuffer.WriteString(\"</ul>\")\n\t\t\tclass += 1\n\t\t}\n\t}\n\tlock.Unlock()\n\tbuffer.WriteString(\"</body></html>\")\n\treturn buffer.String()\n}", "func getIndexLayout(clusterUrl string) ([]*IndexerNode, error) {\n\n\tcinfo, err := clusterInfoCache(clusterUrl)\n\tif err != nil {\n\t\tlogging.Errorf(\"Planner::getIndexLayout: Error from connecting to cluster at %v. Error = %v\", clusterUrl, err)\n\t\treturn nil, err\n\t}\n\n\t// find all nodes that has a index http service\n\t// If there is any indexer node that is not in active state (e.g. failover), then planner will skip those indexers.\n\t// Note that if the planner is invoked by the rebalancer, the rebalancer will receive callback ns_server if there is\n\t// an indexer node fails over while planning is happening.\n\tnids := cinfo.GetNodesByServiceType(common.INDEX_HTTP_SERVICE)\n\n\tlist := make([]*IndexerNode, 0)\n\tnumIndexes := 0\n\n\tfor _, nid := range nids {\n\n\t\t// create an empty indexer object using the indexer host name\n\t\tnode, err := createIndexerNode(cinfo, nid)\n\t\tif err != nil {\n\t\t\tlogging.Errorf(\"Planner::getIndexLayout: Error from initializing indexer node. Error = %v\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// assign server group\n\t\tnode.ServerGroup = cinfo.GetServerGroup(nid)\n\n\t\t// obtain the admin port for the indexer node\n\t\taddr, err := cinfo.GetServiceAddress(nid, common.INDEX_HTTP_SERVICE)\n\t\tif err != nil {\n\t\t\tlogging.Errorf(\"Planner::getIndexLayout: Error from getting service address for node %v. Error = %v\", node.NodeId, err)\n\t\t\treturn nil, err\n\t\t}\n\t\tnode.RestUrl = addr\n\n\t\t// Read the index metadata from the indexer node.\n\t\tlocalMeta, err := getLocalMetadata(addr)\n\t\tif err != nil {\n\t\t\tlogging.Errorf(\"Planner::getIndexLayout: Error from reading index metadata for node %v. Error = %v\", node.NodeId, err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// get the node UUID\n\t\tnode.NodeUUID = localMeta.NodeUUID\n\t\tnode.IndexerId = localMeta.IndexerId\n\t\tnode.StorageMode = localMeta.StorageMode\n\n\t\t// convert from LocalIndexMetadata to IndexUsage\n\t\tindexes, err := ConvertToIndexUsages(localMeta, node)\n\t\tif err != nil {\n\t\t\tlogging.Errorf(\"Planner::getIndexLayout: Error for converting index metadata to index usage for node %v. Error = %v\", node.NodeId, err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tnode.Indexes = indexes\n\t\tnumIndexes += len(indexes)\n\t\tlist = append(list, node)\n\t}\n\n\tif numIndexes != 0 {\n\t\tfor _, node := range list {\n\t\t\tif !common.IsValidIndexType(node.StorageMode) {\n\t\t\t\terr := errors.New(fmt.Sprintf(\"Fail to get storage mode\tfrom %v. Storage mode = %v\", node.RestUrl, node.StorageMode))\n\t\t\t\tlogging.Errorf(\"Planner::getIndexLayout: Error = %v\", err)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn list, nil\n}", "func BuildPackageIndex(pkgs []*Package) PackageIndex {\n\tidx := PackageIndex{\n\t\tPackages: pkgs,\n\t\tnameMap: make(map[string]*Package, len(pkgs)),\n\t\tcharMap: make(map[string][]*CompletionItem),\n\t}\n\n\tfor _, pkg := range pkgs {\n\t\taddPackageToIndex(pkg, &idx)\n\t}\n\n\treturn idx\n}", "func loadIndexs() {\n\tdb := open()\n\tindexs = make(map[string][]*Index)\n\tdb.View(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(INDEX_BUCKET))\n\t\tif b == nil {\n\t\t\tlogger.Infof(\"bucket[%s] not exist\", INDEX_BUCKET)\n\t\t\treturn nil\n\t\t}\n\t\tc := b.Cursor()\n\t\tfor k, v := c.First(); k != nil; k, v = c.Next() {\n\t\t\tkey := string(k)\n\t\t\tvar _indexs []string\n\t\t\terr := json.Unmarshal(v, &_indexs)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Errorf(\"parse index[%s] error -> %v\", k, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t__indexs := make([]*Index, len(_indexs)) \n\t\t\t// parse index\n\t\t\tfor i, _index := range _indexs {\n\t\t\t\tsps :=strings.Split(_index, INDEX_SPLIT) \n\t\t\t\tindex := &Index {\n\t\t\t\t\tbucket: key,\n\t\t\t\t\tindexs: sps,\n\t\t\t\t}\n\t\t\t\t__indexs[i] = index\n\t\t\t}\n\t\t\tindexs[key] = __indexs\n\t\t}\n\t\treturn nil\n\t})\n}", "func (resource *Resource) GetResourceIndex(component Component) int {\n\tfor i, currentResource := range component.GetResources() {\n\t\tif currentResource.Group == resource.Group && currentResource.Version == resource.Version && currentResource.Kind == resource.Kind {\n\t\t\tif currentResource.Name == resource.Name && currentResource.Namespace == resource.Namespace {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t}\n\n\treturn -1\n}", "func getFilesFromIndex(p string, r io.Reader) ([]*FileInfo, Paragraph, error) {\n\treturn getFilesFromRelease(p, r)\n}", "func Indexes() map[string]string {\n\treturn instance.getIndexes()\n}", "func indexWrite(key string, p *pkg) {\n\tlocker.Lock()\n\tdefer locker.Unlock()\n\n\tindexedPkgs[key] = p\n}", "func getResources(client *ApiClient) (map[schema.GroupVersion][]metav1.APIResource, error) {\n\n\tresourceLists, err := client.ClientSet.Discovery().ServerPreferredResources()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tversionResource := map[schema.GroupVersion][]metav1.APIResource{}\n\n\tfor _, apiResourceList := range resourceLists {\n\t\tversion, err := schema.ParseGroupVersion(apiResourceList.GroupVersion)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to parse GroupVersion %v\",err)\n\t\t}\n\n\t\tversionResource[version] = uniqResources(apiResourceList.APIResources)\n\t}\n\n\treturn versionResource, nil\n}", "func IndexDirectory(fs afero.Fs, path string, url string, now *time.Time) (*IndexFile, error) {\n\tarchives, err := afero.Glob(fs, filepath.Join(path, \"*.tgz\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(archives) == 0 {\n\t\treturn nil, errors.New(\"no packages discovered\")\n\t}\n\tindex := newIndexFile(now)\n\tops := filesDigest(fs, archives)\n\tpvs := Map(ops, url)\n\tfor _, pv := range pvs {\n\t\terr = index.AddPackageVersion(pv)\n\t\t// on error we report and continue\n\t\tif err != nil {\n\t\t\tfmt.Print(err.Error())\n\t\t}\n\t}\n\tindex.sortPackages()\n\treturn index, nil\n}", "func (i ImageIndexer) ExportFromIndex(request ExportFromIndexRequest) error {\n\t// set a temp directory\n\tworkingDir, err := ioutil.TempDir(\"./\", tmpDirPrefix)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer os.RemoveAll(workingDir)\n\n\t// extract the index database to the file\n\tdatabaseFile, err := i.getDatabaseFile(workingDir, request.Index, request.CaFile, request.SkipTLSVerify, request.PlainHTTP)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdb, err := sqlite.Open(databaseFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer db.Close()\n\n\tdbQuerier := sqlite.NewSQLLiteQuerierFromDb(db)\n\n\t// fetch all packages from the index image if packages is empty\n\tif len(request.Packages) == 0 {\n\t\trequest.Packages, err = dbQuerier.ListPackages(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tbundles, err := getBundlesToExport(dbQuerier, request.Packages)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ti.Logger.Infof(\"Preparing to pull bundles %+q\", bundles)\n\n\t// Creating downloadPath dir\n\tif err := os.MkdirAll(request.DownloadPath, 0777); err != nil {\n\t\treturn err\n\t}\n\n\tvar errs []error\n\tvar wg sync.WaitGroup\n\twg.Add(len(bundles))\n\tvar mu = &sync.Mutex{}\n\n\tsem := make(chan struct{}, concurrencyLimitForExport)\n\n\tfor bundleImage, bundleDir := range bundles {\n\t\tgo func(bundleImage string, bundleDir bundleDirPrefix) {\n\t\t\tdefer wg.Done()\n\n\t\t\tsem <- struct{}{}\n\t\t\tdefer func() {\n\t\t\t\t<-sem\n\t\t\t}()\n\n\t\t\t// generate a random folder name if bundle version is empty\n\t\t\tif bundleDir.bundleVersion == \"\" {\n\t\t\t\tbundleDir.bundleVersion = strconv.Itoa(rand.Intn(10000))\n\t\t\t}\n\t\t\texporter := bundle.NewExporterForBundle(bundleImage, filepath.Join(request.DownloadPath, bundleDir.pkgName, bundleDir.bundleVersion), request.ContainerTool)\n\t\t\tif err := exporter.Export(request.SkipTLSVerify, request.PlainHTTP); err != nil {\n\t\t\t\terr = fmt.Errorf(\"exporting bundle image:%s failed with %s\", bundleImage, err)\n\t\t\t\tmu.Lock()\n\t\t\t\terrs = append(errs, err)\n\t\t\t\tmu.Unlock()\n\t\t\t}\n\t\t}(bundleImage, bundleDir)\n\t}\n\t// Wait for all the go routines to finish export\n\twg.Wait()\n\n\tif errs != nil {\n\t\treturn utilerrors.NewAggregate(errs)\n\t}\n\n\tfor _, packageName := range request.Packages {\n\t\terr := generatePackageYaml(dbQuerier, packageName, filepath.Join(request.DownloadPath, packageName))\n\t\tif err != nil {\n\t\t\terrs = append(errs, err)\n\t\t}\n\t}\n\treturn utilerrors.NewAggregate(errs)\n}", "func (m *ProjectIndexer) Index(resource *models.Project, doc solr.Document) solr.Document {\n\tdoc.Set(\"type_ssi\", \"Project\")\n\tdoc.Set(\"title_tesi\", resource.Title)\n\tdoc.Set(\"alternative_title_tesim\", resource.AlternativeTitle)\n\tdoc.Set(\"start_date_ssi\", resource.StartDate)\n\tdoc.Set(\"end_date_ssi\", resource.EndDate)\n\n\treturn doc\n}", "func (d *Descriptor) ImageIndex() (v1.ImageIndex, error) {\n\tswitch d.MediaType {\n\tcase types.DockerManifestSchema1, types.DockerManifestSchema1Signed:\n\t\t// We don't care to support schema 1 images:\n\t\t// https://github.com/google/go-containerregistry/issues/377\n\t\treturn nil, newErrSchema1(d.MediaType)\n\tcase types.OCIManifestSchema1, types.DockerManifestSchema2:\n\t\t// We want an index but the registry has an image, nothing we can do.\n\t\treturn nil, fmt.Errorf(\"unexpected media type for ImageIndex(): %s; call Image() instead\", d.MediaType)\n\tcase types.OCIImageIndex, types.DockerManifestList:\n\t\t// These are expected.\n\tdefault:\n\t\t// We could just return an error here, but some registries (e.g. static\n\t\t// registries) don't set the Content-Type headers correctly, so instead...\n\t\tlogs.Warn.Printf(\"Unexpected media type for ImageIndex(): %s\", d.MediaType)\n\t}\n\treturn d.remoteIndex(), nil\n}", "func (idx *ManualIndex) Index() error {\n\tvar buf bytes.Buffer\n\n\tfor pkg := range idx.packages {\n\t\t_, err := fmt.Fprintf(&buf, \"\\x00%s\", pkg)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tidx.index = suffixarray.New(buf.Bytes())\n\treturn nil\n}", "func index(w http.ResponseWriter, r *http.Request){\n\terr := templ.ExecuteTemplate(w, \"index\", nil)\n\tif err != nil {\n\t\tfmt.Print(err.Error())\n\t}\n}", "func (c *clusterCache) listResources(ctx context.Context, resClient dynamic.ResourceInterface, callback func(*pager.ListPager) error) (string, error) {\n\tif err := c.listSemaphore.Acquire(ctx, 1); err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer c.listSemaphore.Release(1)\n\tvar retryCount int64 = 0\n\tresourceVersion := \"\"\n\tlistPager := pager.New(func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) {\n\t\tvar res *unstructured.UnstructuredList\n\t\tvar listRetry wait.Backoff\n\n\t\tif c.listRetryUseBackoff {\n\t\t\tlistRetry = retry.DefaultBackoff\n\t\t} else {\n\t\t\tlistRetry = retry.DefaultRetry\n\t\t}\n\n\t\tlistRetry.Steps = int(c.listRetryLimit)\n\t\terr := retry.OnError(listRetry, c.listRetryFunc, func() error {\n\t\t\tvar ierr error\n\t\t\tres, ierr = resClient.List(ctx, opts)\n\t\t\tif ierr != nil {\n\t\t\t\t// Log out a retry\n\t\t\t\tif c.listRetryLimit > 1 && c.listRetryFunc(ierr) {\n\t\t\t\t\tretryCount += 1\n\t\t\t\t\tc.log.Info(fmt.Sprintf(\"Error while listing resources: %v (try %d/%d)\", ierr, retryCount, c.listRetryLimit))\n\t\t\t\t}\n\t\t\t\treturn ierr\n\t\t\t}\n\t\t\tresourceVersion = res.GetResourceVersion()\n\t\t\treturn nil\n\t\t})\n\t\treturn res, err\n\t})\n\tlistPager.PageBufferSize = c.listPageBufferSize\n\tlistPager.PageSize = c.listPageSize\n\n\treturn resourceVersion, callback(listPager)\n}", "func TagIndex(c *gin.Context) {\n\tdb := models.GetDB()\n\tvar tags []models.Tag\n\tdb.Preload(\"Posts\").Order(\"title asc\").Find(&tags)\n\th := DefaultH(c)\n\th[\"Title\"] = \"タグ一覧\"\n\th[\"Tags\"] = tags\n\tc.HTML(http.StatusOK, \"tags/index\", h)\n}", "func (l *PackageList) PrepareIndex() {\n\tif l.indexed {\n\t\treturn\n\t}\n\n\tl.packagesIndex = make([]*Package, l.Len())\n\tl.providesIndex = make(map[string][]*Package, 128)\n\n\ti := 0\n\tfor _, p := range l.packages {\n\t\tl.packagesIndex[i] = p\n\t\ti++\n\n\t\tfor _, provides := range p.Provides {\n\t\t\tl.providesIndex[provides] = append(l.providesIndex[provides], p)\n\t\t}\n\t}\n\n\tsort.Sort(l)\n\n\tl.indexed = true\n}", "func (*SearchAllResourcesResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_asset_v1_asset_service_proto_rawDescGZIP(), []int{23}\n}", "func getItems(repoIndex *index.Index, url string) []FileInfo {\n\tvar items []FileInfo\n\n\tfor _, os := range repoIndex.Data.Keys() {\n\t\tfor _, arch := range repoIndex.Data[os].Keys() {\n\t\t\tfor _, category := range repoIndex.Data[os][arch].Keys() {\n\t\t\t\tfor _, version := range repoIndex.Data[os][arch][category] {\n\t\t\t\t\titems = append(items, FileInfo{\n\t\t\t\t\t\tFile: version.File,\n\t\t\t\t\t\tURL: url + \"/\" + version.Path + \"/\" + version.File,\n\t\t\t\t\t\tOS: os,\n\t\t\t\t\t\tArch: arch,\n\t\t\t\t\t\tSize: version.Size,\n\t\t\t\t\t})\n\n\t\t\t\t\tif len(version.Variations) != 0 {\n\t\t\t\t\t\tfor _, subVersion := range version.Variations {\n\t\t\t\t\t\t\titems = append(items, FileInfo{\n\t\t\t\t\t\t\t\tFile: subVersion.File,\n\t\t\t\t\t\t\t\tURL: url + \"/\" + subVersion.Path + \"/\" + subVersion.File,\n\t\t\t\t\t\t\t\tOS: os,\n\t\t\t\t\t\t\t\tArch: arch,\n\t\t\t\t\t\t\t\tSize: subVersion.Size,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn items\n}", "func generateSignedIndex(scenario string, signer digestedRefSigner, keys ...*cosign.KeysBytes) (layers []v1.Layer, manifests map[string]v1.Manifest, hash v1.Hash, err error) {\n\tmanifests = map[string]v1.Manifest{}\n\n\t// Generating two manifests A and B\n\tl, m, h, err := generateSignedManifest(scenario+\" manifest A\", signDigestedRef)\n\tif err != nil {\n\t\treturn nil, nil, v1.Hash{}, trace.Wrap(err)\n\t}\n\tlayers = append(layers, l...)\n\tmaps.Copy(manifests, m)\n\tmanifestA := m[h.String()]\n\tmanifestADesc, err := descriptorFromManifest(manifestA, &v1.Platform{\n\t\tArchitecture: \"arm64\",\n\t\tOS: \"linux\",\n\t})\n\tif err != nil {\n\t\treturn nil, nil, v1.Hash{}, trace.Wrap(err)\n\t}\n\n\tl, m, h, err = generateSignedManifest(scenario+\" manifest B\", signDigestedRef)\n\tif err != nil {\n\t\treturn nil, nil, v1.Hash{}, trace.Wrap(err)\n\t}\n\tlayers = append(layers, l...)\n\tmaps.Copy(manifests, m)\n\tmanifestB := m[h.String()]\n\tmanifestBDesc, err := descriptorFromManifest(manifestB, &v1.Platform{\n\t\tArchitecture: \"amd64\",\n\t\tOS: \"linux\",\n\t})\n\tif err != nil {\n\t\treturn nil, nil, v1.Hash{}, trace.Wrap(err)\n\t}\n\n\t// Referencing both manifests in an index\n\tindex := v1.IndexManifest{\n\t\tSchemaVersion: 2,\n\t\tMediaType: types.DockerManifestList,\n\t\tManifests: []v1.Descriptor{manifestADesc, manifestBDesc},\n\t}\n\n\t_, _, indexDigest, err := contentSizeAndHash(index)\n\tif err != nil {\n\t\treturn nil, nil, v1.Hash{}, trace.Wrap(err)\n\t}\n\thash = indexDigest\n\tindexRef, err := name.NewDigest(imagePath + \"@\" + indexDigest.String())\n\n\t// Don't sign when no keys are provided\n\tif len(keys) == 0 {\n\t\treturn\n\t}\n\n\t// Signing the index\n\tsigLayers, sigManifest, err := makeSignature(indexRef, signer, keys...)\n\tif err != nil {\n\t\treturn nil, nil, v1.Hash{}, trace.Wrap(err)\n\t}\n\tmanifests[Triangulate(indexDigest)] = sigManifest\n\tlayers = append(layers, sigLayers...)\n\treturn\n}", "func index(w http.ResponseWriter, req *http.Request, ctx httputil.Context) (e *httputil.Error) {\n\tif req.URL.Path != \"/\" {\n\t\tnotFound(w, req)\n\t\treturn\n\t}\n\tm := newManager(ctx)\n\n\tres, err := m.Index()\n\tif err != nil {\n\t\te = httputil.Errorf(err, \"couldn't query for test results\")\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"text/html\")\n\tif err := T(\"index/index.html\").Execute(w, res); err != nil {\n\t\te = httputil.Errorf(err, \"error executing index template\")\n\t}\n\treturn\n}", "func getTagDocuments(p config.Config, swagger *openapi3.Swagger, allDocuments docs.Index) docs.Index {\n\tio.WriteString(os.Stdout, fmt.Sprintf(\"\\033[1m %s\\033[0m (%v tags)\\n\", \"Tags\", len(swagger.Tags)))\n\tfor _, tag := range swagger.Tags {\n\n\t\tvar document docs.Document\n\n\t\t// Basics.\n\t\tdocument.Site = p.Name\n\t\tdocument.Title = tag.Name\n\t\tdocument.Section = \"\"\n\t\tdocument.Subsection = \"\"\n\n\t\t// URLs.\n\t\trel_url := fmt.Sprintf(\"#tag/%s\", strings.Replace(tag.Name, \" \", \"-\", -1))\n\t\tfull_url := fmt.Sprintf(\"%s%s\", p.URL, rel_url)\n\t\tdocument.URL = full_url\n\t\tdocument.RelativeURL = fmt.Sprintf(\"/%s\", rel_url)\n\n\t\t// DocumentID hash.\n\t\th := sha1.New()\n\t\th.Write([]byte(full_url))\n\t\tdocument.DocumentID = fmt.Sprintf(\"%x\", h.Sum(nil))\n\n\t\t// Match `config.yaml` rank, and use React primary/secondary designation.\n\t\tdocument.Rank = p.Rank\n\t\tif p.Rank == 1 {\n\t\t\tdocument.Source = \"primary\"\n\t\t} else {\n\t\t\tdocument.Source = \"secondary\"\n\t\t}\n\n\t\t// Document body text.\n\t\tdocument.Text = strings.Replace(tag.Description, \"\\n\", \" \", -1)\n\n\t\t// Document description.\n\t\tdocument.Description = strings.Replace(tag.Description, \"\\n\", \" \", -1)\n\n\t\t// Append the document.\n\t\tallDocuments.Documents = append(allDocuments.Documents, document)\n\t}\n\n\treturn allDocuments\n}", "func List(indexName string, options types.ListingOptions, indexes map[string]string) (*bleve.SearchResult, error) {\n\tcwd, _ := os.Getwd()\n\tp := cwd + viper.GetString(\"storage.basedir\") + \"/indexes/\" + indexName\n\n\tindex, err := openIndex(p)\n\n\titems_by_page := options.PageSize\n\tif items_by_page == 0 {\n\t\titems_by_page = viper.GetUint32(\"modules.all.items_per_page\")\n\t}\n\n\t// bleve start with page 1\n\tpage := options.Page\n\tif page <= 0 {\n\t\tpage = 1\n\t} else {\n\t\tpage++\n\t}\n\n\t// field scoping\n\tfields := []string{}\n\tfor k, v := range indexes {\n\t\tfields = append(fields, k+\":\"+v)\n\t}\n\tfieldscope := strings.Join(fields, \" \")\n\n\tvar searchRequest *bleve.SearchRequest\n\n\tif options.Q == \"\" {\n\n\t\tbq := bleve.NewBooleanQuery()\n\t\tbq.Must = bleve.NewMatchQuery(fieldscope)\n\t\tbq.Should = bleve.NewMatchAllQuery()\n\t\tquery := bq\n\t\tsearchRequest = bleve.NewSearchRequestOptions(query, int(items_by_page), int((page-1)*items_by_page), false)\n\t} else {\n\t\tquery := bleve.NewFuzzyQuery(fieldscope + options.Q)\n\t\tsearchRequest = bleve.NewSearchRequestOptions(query, int(items_by_page), int((page-1)*items_by_page), false)\n\t}\n\t// default sort order is id desc\n\tsortOrder := []string{\"-_id\"}\n\n\tif options.OrderBy != \"\" {\n\t\tsortOrder = strings.Split(strings.ReplaceAll(options.OrderBy, \" \", \"\"), \",\")\n\t}\n\n\t//searchRequest.Fields = strings.Split(strings.ReplaceAll(options.Fields, \" \", \"\"), \",\")\n\t// todo implement options.Filter\n\n\tsearchRequest.SortBy(sortOrder)\n\n\tres, err := index.Search(searchRequest)\n\treturn res, err\n}", "func registerSymbolIndex(sdk sdkProvider, packages []string, verbose bool) {\n\tfor _, pkg := range packages {\n\t\t// pkg should end with \".far\", otherwise the publish function should fail.\n\t\tsymbolIndexJsonFile := pkg[:len(pkg)-4] + \".symbol-index.json\"\n\t\tif _, err := os.Stat(symbolIndexJsonFile); err != nil {\n\t\t\t// File doesn't exist or is not readable.\n\t\t\tcontinue\n\t\t}\n\n\t\targs := []string{\"debug\", \"symbol-index\", \"add\", symbolIndexJsonFile}\n\t\tif verbose {\n\t\t\tfmt.Printf(\"Running command: ffx %v\\n\", args)\n\t\t}\n\t\t// The command outputs nothing if succeeds, and outputs error messages if fails,\n\t\t// which is sufficient for our users. Use interactive=true here allows the\n\t\t// command to output.\n\t\tsdk.RunFFX(args, true)\n\t}\n}", "func indexHandler(w http.ResponseWriter, req *http.Request) {\n\tlayout, err := template.ParseFile(PATH_PUBLIC + TEMPLATE_LAYOUT)\n\tif err != nil {\n\t\thttp.Error(w, ERROR_TEMPLATE_NOT_FOUND, http.StatusNotFound)\n\t\treturn\n\t}\n\tindex, err := template.ParseFile(PATH_PUBLIC + TEMPLATE_INDEX)\n\t//artical, err := template.ParseFile(PATH_PUBLIC + TEMPLATE_ARTICAL)\n\tif err != nil {\n\t\thttp.Error(w, ERROR_TEMPLATE_NOT_FOUND, http.StatusNotFound)\n\t\treturn\n\t}\n\tmapOutput := map[string]interface{}{\"Title\": \"炫酷的网站技术\" + TITLE, \"Keyword\": KEYWORD, \"Description\": DESCRIPTION, \"Base\": BASE_URL, \"Url\": BASE_URL, \"Carousel\": getAddition(PREFIX_INDEX), \"Script\": getAddition(PREFIX_SCRIPT), \"Items\": leveldb.GetRandomContents(20, &Filter{})}\n\tcontent := []byte(index.RenderInLayout(layout, mapOutput))\n\tw.Write(content)\n\tgo cacheFile(\"index\", content)\n}", "func Index(w http.ResponseWriter, r *http.Request) {\n\t//index_routes := []string{\"providers\"}\n\tvar index_routes []string\n\tindex_routes = GetJobs()\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\tif err := json.NewEncoder(w).Encode(index_routes); err != nil {\n\t\tpanic(err)\n\t}\n}", "func (o MongoDBCollectionResourceOutput) Indexes() MongoIndexArrayOutput {\n\treturn o.ApplyT(func(v MongoDBCollectionResource) []MongoIndex { return v.Indexes }).(MongoIndexArrayOutput)\n}", "func getIndexStats(clusterUrl string, plan *Plan) error {\n\n\tcinfo, err := clusterInfoCache(clusterUrl)\n\tif err != nil {\n\t\tlogging.Errorf(\"Planner::getIndexStats: Error from connecting to cluster at %v. Error = %v\", clusterUrl, err)\n\t\treturn err\n\t}\n\n\t// find all nodes that has a index http service\n\tnids := cinfo.GetNodesByServiceType(common.INDEX_HTTP_SERVICE)\n\n\tfor _, nid := range nids {\n\n\t\t// Find the indexer host name\n\t\tnodeId, err := getIndexerHost(cinfo, nid)\n\t\tif err != nil {\n\t\t\tlogging.Errorf(\"Planner::getIndexStats: Error from initializing indexer node. Error = %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\t// obtain the admin port for the indexer node\n\t\taddr, err := cinfo.GetServiceAddress(nid, common.INDEX_HTTP_SERVICE)\n\t\tif err != nil {\n\t\t\tlogging.Errorf(\"Planner::getIndexStats: Error from getting service address for node %v. Error = %v\", nodeId, err)\n\t\t\treturn err\n\t\t}\n\n\t\t// Read the index stats from the indexer node.\n\t\tstats, err := getLocalStats(addr)\n\t\tif err != nil {\n\t\t\tlogging.Errorf(\"Planner::getIndexStats: Error from reading index stats for node %v. Error = %v\", nodeId, err)\n\t\t\treturn err\n\t\t}\n\n\t\t// look up the corresponding indexer object based on the nodeId\n\t\tindexer := findIndexerByNodeId(plan.Placement, nodeId)\n\t\tstatsMap := stats.ToMap()\n\n\t\t/*\n\t\t\tCpuUsage uint64 `json:\"cpuUsage,omitempty\"`\n\t\t\tDiskUsage uint64 `json:\"diskUsage,omitempty\"`\n\t\t*/\n\n\t\tvar actualStorageMem uint64\n\t\t// memory_used_storage constains the total storage consumption,\n\t\t// including fdb overhead, main index and back index. This also\n\t\t// includes overhead (skip list / back index).\n\t\tif memUsedStorage, ok := statsMap[\"memory_used_storage\"]; ok {\n\t\t\tactualStorageMem = uint64(memUsedStorage.(float64))\n\t\t}\n\n\t\t// memory_used is the memory used by indexer. This includes\n\t\t// golang in-use heap space, golang idle heap space, and\n\t\t// storage memory manager space (e.g. jemalloc heap space).\n\t\tvar actualTotalMem uint64\n\t\tif memUsed, ok := statsMap[\"memory_used\"]; ok {\n\t\t\tactualTotalMem = uint64(memUsed.(float64))\n\t\t}\n\n\t\t// memory_quota is user specified memory quota.\n\t\tif memQuota, ok := statsMap[\"memory_quota\"]; ok {\n\t\t\tplan.MemQuota = uint64(memQuota.(float64))\n\t\t}\n\n\t\t// uptime\n\t\tvar elapsed uint64\n\t\tif uptimeStat, ok := statsMap[\"uptime\"]; ok {\n\t\t\tuptime := uptimeStat.(string)\n\t\t\tif duration, err := time.ParseDuration(uptime); err == nil {\n\t\t\t\telapsed = uint64(duration.Seconds())\n\t\t\t}\n\t\t}\n\n\t\t// cpu core in host. This is the actual num of cpu core, not cpu quota.\n\t\t/*\n\t\t\tvar actualCpuCore uint64\n\t\t\tif cpuCore, ok := statsMap[\"num_cpu_core\"]; ok {\n\t\t\t\tactualCpuCore = uint64(cpuCore.(float64))\n\t\t\t}\n\t\t*/\n\n\t\t// cpu utilization for the indexer process\n\t\tvar actualCpuUtil float64\n\t\tif cpuUtil, ok := statsMap[\"cpu_utilization\"]; ok {\n\t\t\tactualCpuUtil = cpuUtil.(float64) / 100\n\t\t}\n\n\t\tvar totalDataSize uint64\n\t\tvar totalMutation uint64\n\t\tvar totalScan uint64\n\t\tfor _, index := range indexer.Indexes {\n\n\t\t\t/*\n\t\t\t\tCpuUsage uint64 `json:\"cpuUsage,omitempty\"`\n\t\t\t\tDiskUsage uint64 `json:\"diskUsage,omitempty\"`\n\t\t\t*/\n\n\t\t\tvar key string\n\n\t\t\tindexName := index.GetDisplayName()\n\n\t\t\t// items_count captures number of key per index\n\t\t\tkey = fmt.Sprintf(\"%v:%v:items_count\", index.Bucket, indexName)\n\t\t\tif itemsCount, ok := statsMap[key]; ok {\n\t\t\t\tindex.NumOfDocs = uint64(itemsCount.(float64))\n\t\t\t}\n\n\t\t\t// data_size is the total key size of index, excluding back index overhead.\n\t\t\t// Therefore data_size is typically smaller than index sizing equation which\n\t\t\t// includes overhead for back-index.\n\t\t\tkey = fmt.Sprintf(\"%v:%v:data_size\", index.Bucket, indexName)\n\t\t\tif dataSize, ok := statsMap[key]; ok {\n\t\t\t\tindex.ActualMemUsage = uint64(dataSize.(float64))\n\t\t\t\ttotalDataSize += index.ActualMemUsage\n\t\t\t}\n\n\t\t\t// avg_sec_key_size is currently unavailable in 4.5. To estimate,\n\t\t\t// the key size, it divides index data_size by items_count. This\n\t\t\t// contains sec key size + doc key size + main index overhead (74 bytes).\n\t\t\t// Subtract 74 bytes to get sec key size.\n\t\t\tkey = fmt.Sprintf(\"%v:%v:avg_sec_key_size\", index.Bucket, indexName)\n\t\t\tif avgSecKeySize, ok := statsMap[key]; ok {\n\t\t\t\tindex.AvgSecKeySize = uint64(avgSecKeySize.(float64))\n\t\t\t} else if !index.IsPrimary {\n\t\t\t\t// Aproximate AvgSecKeySize. AvgSecKeySize includes both\n\t\t\t\t// sec key len + doc key len\n\t\t\t\tif index.NumOfDocs != 0 && index.ActualMemUsage != 0 {\n\t\t\t\t\tindex.ActualKeySize = index.ActualMemUsage / index.NumOfDocs\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// These stats are currently unavailable in 4.5.\n\t\t\tkey = fmt.Sprintf(\"%v:%v:avg_doc_key_size\", index.Bucket, indexName)\n\t\t\tif avgDocKeySize, ok := statsMap[key]; ok {\n\t\t\t\tindex.AvgDocKeySize = uint64(avgDocKeySize.(float64))\n\t\t\t} else if index.IsPrimary {\n\t\t\t\t// Aproximate AvgDocKeySize. Subtract 74 bytes for main\n\t\t\t\t// index overhead\n\t\t\t\tif index.NumOfDocs != 0 && index.ActualMemUsage != 0 {\n\t\t\t\t\tindex.ActualKeySize = index.ActualMemUsage / index.NumOfDocs\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// These stats are currently unavailable in 4.5.\n\t\t\tkey = fmt.Sprintf(\"%v:%v:avg_arr_size\", index.Bucket, indexName)\n\t\t\tif avgArrSize, ok := statsMap[key]; ok {\n\t\t\t\tindex.AvgArrSize = uint64(avgArrSize.(float64))\n\t\t\t}\n\n\t\t\t// These stats are currently unavailable in 4.5.\n\t\t\tkey = fmt.Sprintf(\"%v:%v:avg_arr_key_size\", index.Bucket, indexName)\n\t\t\tif avgArrKeySize, ok := statsMap[key]; ok {\n\t\t\t\tindex.AvgArrKeySize = uint64(avgArrKeySize.(float64))\n\t\t\t}\n\n\t\t\t// These stats are currently unavailable in 4.5.\n\t\t\tkey = fmt.Sprintf(\"%v:%v:avg_drain_rate\", index.Bucket, indexName)\n\t\t\tif avgMutationRate, ok := statsMap[key]; ok {\n\t\t\t\tindex.MutationRate = uint64(avgMutationRate.(float64))\n\t\t\t\ttotalMutation += index.MutationRate\n\t\t\t} else {\n\t\t\t\tkey = fmt.Sprintf(\"%v:%v:num_flush_queued\", index.Bucket, indexName)\n\t\t\t\tif flushQueuedStat, ok := statsMap[key]; ok {\n\t\t\t\t\tflushQueued := uint64(flushQueuedStat.(float64))\n\n\t\t\t\t\tif flushQueued != 0 {\n\t\t\t\t\t\tindex.MutationRate = flushQueued / elapsed\n\t\t\t\t\t\ttotalMutation += index.MutationRate\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// These stats are currently unavailable in 4.5.\n\t\t\tkey = fmt.Sprintf(\"%v:%v:avg_scan_rate\", index.Bucket, indexName)\n\t\t\tif avgScanRate, ok := statsMap[key]; ok {\n\t\t\t\tindex.ScanRate = uint64(avgScanRate.(float64))\n\t\t\t\ttotalScan += index.ScanRate\n\t\t\t} else {\n\t\t\t\tkey = fmt.Sprintf(\"%v:%v:num_rows_returned\", index.Bucket, indexName)\n\t\t\t\tif rowReturnedStat, ok := statsMap[key]; ok {\n\t\t\t\t\trowReturned := uint64(rowReturnedStat.(float64))\n\n\t\t\t\t\tif rowReturned != 0 {\n\t\t\t\t\t\tindex.ScanRate = rowReturned / elapsed\n\t\t\t\t\t\ttotalScan += index.ScanRate\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// compute the estimated memory usage for each index. This also computes\n\t\t// the aggregated indexer mem usage. Mem usage can be 0 if\n\t\t// 1) there is no index stats\n\t\t// 2) index has no data (datasize = 0) (e.g. deferred index)\n\t\tfor _, index := range indexer.Indexes {\n\t\t\tratio := float64(0)\n\t\t\tif totalDataSize != 0 {\n\t\t\t\tratio = float64(index.ActualMemUsage) / float64(totalDataSize)\n\t\t\t}\n\n\t\t\tindex.ActualMemUsage = uint64(float64(actualStorageMem) * ratio)\n\n\t\t\tif actualTotalMem > actualStorageMem {\n\t\t\t\tindex.ActualMemOverhead = uint64(float64(actualTotalMem-actualStorageMem) * ratio)\n\t\t\t} else {\n\t\t\t\tindex.ActualMemOverhead = 0\n\t\t\t}\n\n\t\t\tif index.ActualMemUsage != 0 {\n\t\t\t\tindex.NoUsage = false\n\t\t\t}\n\n\t\t\tindexer.ActualMemUsage += index.ActualMemUsage\n\t\t\tindexer.ActualMemOverhead += index.ActualMemOverhead\n\t\t}\n\n\t\t// compute the estimated cpu usage for each index. This also computes the\n\t\t// aggregated indexer cpu usage. CPU usge can be 0 if\n\t\t// 1) there is no index stats\n\t\t// 2) index has no scan or mutation (e.g. deferred index)\n\t\tfor _, index := range indexer.Indexes {\n\n\t\t\tmutationRatio := float64(0)\n\t\t\tif totalMutation != 0 {\n\t\t\t\tmutationRatio = float64(index.MutationRate) / float64(totalMutation)\n\t\t\t}\n\n\t\t\tscanRatio := float64(0)\n\t\t\tif totalScan != 0 {\n\t\t\t\tscanRatio = float64(index.ScanRate) / float64(totalScan)\n\t\t\t}\n\n\t\t\tratio := mutationRatio\n\t\t\tif scanRatio != 0 {\n\t\t\t\tif mutationRatio != 0 {\n\t\t\t\t\t// mutation uses 5 times less cpu than scan\n\t\t\t\t\tratio = ((mutationRatio / 5) + scanRatio) / 2\n\t\t\t\t} else {\n\t\t\t\t\tratio = scanRatio\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tusage := float64(actualCpuUtil) * ratio\n\n\t\t\tif usage > 0 {\n\t\t\t\tindex.ActualCpuUsage = usage\n\t\t\t\tindex.NoUsage = false\n\t\t\t}\n\n\t\t\tindexer.ActualCpuUsage += index.ActualCpuUsage\n\t\t}\n\t}\n\n\treturn nil\n}", "func indexHandler(w http.ResponseWriter, r *http.Request) {\n\tdata := &Index{\n\t\tTitle: \"Image gallery\",\n\t\tBody: \"Welcome to the image gallery.\",\n\t}\n\tfor name, img := range images {\n\t\tdata.Links = append(data.Links, Link{\n\t\t\tURL: \"/image/\" + name,\n\t\t\tTitle: img.Title,\n\t\t})\n\t}\n\tif err := indexTemplate.Execute(w, data); err != nil {\n\t\tlog.Println(err)\n\t}\n}", "func bookIndex(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tmtx.Lock()\n\tdefer mtx.Unlock()\n\tbooks := make([]*model.Book, len(bookstore))\n\ti := 0\n\tfor _, v := range bookstore {\n\t\tbooks[i] = v\n\t\ti++\n\t}\n\tres := &common.ResBody{\n\t\tErr: common.OK,\n\t\tData: books,\n\t}\n\tcommon.WriteJson(w, res, http.StatusOK)\n}", "func (d *Dataset) Indexes() []string {\n\t//grab indexes\n\tvar indexes []string\n\n\tindexFiles, err := ioutil.ReadDir(filepath.Join(path.Dir(d.path), \".gitdb/index/\", d.Name()))\n\tif err != nil {\n\t\treturn indexes\n\t}\n\n\tfor _, indexFile := range indexFiles {\n\t\tindexes = append(indexes, strings.TrimSuffix(indexFile.Name(), \".json\"))\n\t}\n\n\treturn indexes\n}", "func LoadImageManifestFromIndex(indexPath string) ([]ImageManifest, error) {\n\tdata, err := ioutil.ReadFile(indexPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"read index: %w\", err)\n\t}\n\n\tvar list ManifestList\n\tif err := json.Unmarshal(data, &list); err != nil {\n\t\treturn nil, fmt.Errorf(\"decode manifest: %w\", err)\n\t}\n\n\treturn list.Manifests, nil\n}", "func ForAllIndexes(ctx context.Context, repo restic.Repository,\n\tfn func(id restic.ID, index *Index, oldFormat bool, err error) error) error {\n\n\tdebug.Log(\"Start\")\n\n\ttype FileInfo struct {\n\t\trestic.ID\n\t\tSize int64\n\t}\n\n\tvar m sync.Mutex\n\n\t// track spawned goroutines using wg, create a new context which is\n\t// cancelled as soon as an error occurs.\n\twg, ctx := errgroup.WithContext(ctx)\n\n\tch := make(chan FileInfo)\n\t// send list of index files through ch, which is closed afterwards\n\twg.Go(func() error {\n\t\tdefer close(ch)\n\t\treturn repo.List(ctx, restic.IndexFile, func(id restic.ID, size int64) error {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn nil\n\t\t\tcase ch <- FileInfo{id, size}:\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t})\n\n\t// a worker receives an index ID from ch, loads the index, and sends it to indexCh\n\tworker := func() error {\n\t\tvar buf []byte\n\t\tfor fi := range ch {\n\t\t\tdebug.Log(\"worker got file %v\", fi.ID.Str())\n\t\t\tvar err error\n\t\t\tvar idx *Index\n\t\t\toldFormat := false\n\n\t\t\tbuf, err = repo.LoadAndDecrypt(ctx, buf[:0], restic.IndexFile, fi.ID)\n\t\t\tif err == nil {\n\t\t\t\tidx, oldFormat, err = DecodeIndex(buf, fi.ID)\n\t\t\t}\n\n\t\t\tm.Lock()\n\t\t\terr = fn(fi.ID, idx, oldFormat, err)\n\t\t\tm.Unlock()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\t// run workers on ch\n\twg.Go(func() error {\n\t\treturn RunWorkers(loadIndexParallelism, worker)\n\t})\n\n\treturn wg.Wait()\n}", "func (i IndexFile) sortPackages() {\n\tfor _, versions := range i.Entries {\n\t\tsort.Sort(sort.Reverse(versions))\n\t}\n}", "func (*SearchAllResourcesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_asset_v1_asset_service_proto_rawDescGZIP(), []int{22}\n}", "func list_arches(w rest.ResponseWriter, r *rest.Request) {\n\t// Use caching to reduce calls to the Dropbox API\n\tcache_path := \"arches\"\n\tdata, found := cache_instance.Get(cache_path)\n\tif found {\n\t\tif cached, ok := data.([]string); ok {\n\t\t\tw.WriteJson(cached)\n\t\t\treturn\n\t\t} else {\n\t\t\tlog.Println(\"Error: Unable to retrieve from cache\")\n\t\t}\n\t}\n\n\tarches := []string{}\n\tdirectories := get_directories(cache_instance, db, \"/\")\n\tfor _, arch := range directories {\n\t\tarches = append(arches, strings.Replace(arch.Path, \"/\", \"\", -1))\n\t}\n\tcache_instance.Set(cache_path, arches, 0)\n\tw.WriteJson(arches)\n}", "func indexFile(name string) string {\r\n\treturn name + \".files\"\r\n}", "func GetIndexByMediaType(index *imagespec.Index, mt string) (*imagespec.Descriptor, error) {\n\tfor _, d := range index.Manifests {\n\t\tif d.MediaType == mt {\n\t\t\treturn &d, nil\n\t\t}\n\t}\n\treturn nil, ErrMediaTypeNotFound\n}", "func CreateIndexByScanDir(targetDir string, indexFileName string, public_url string) (index Index) {\n\n\tindex = Index{Sitemaps: []Sitemap{}}\n\n\tfs, err := ioutil.ReadDir(targetDir)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor _, f := range fs {\n\t\tif strings.HasSuffix(f.Name(), \".xml.gz\") && !strings.HasSuffix(indexFileName, f.Name()) {\n\t\t\tlastModified := f.ModTime()\n\t\t\tindex.Sitemaps = append(index.Sitemaps, Sitemap{Loc: public_url + f.Name(), LastMod: &lastModified})\n\t\t}\n\t}\n\treturn\n}", "func (k8sc *Client) _search(ctx context.Context, groups, categories, kinds, namespaces, versions, names, labels, containers string) ([]SearchResult, error) {\n\n\t// normalize params\n\tgroups = strings.ToLower(groups)\n\tcategories = strings.ToLower(categories)\n\tkinds = strings.ToLower(kinds) // means resources in K8s API term (i.e. pods, services, etc)\n\tnamespaces = strings.ToLower(namespaces)\n\tversions = strings.ToLower(versions)\n\tlabels = strings.ToLower(labels)\n\tcontainers = strings.ToLower(containers)\n\n\tlogrus.Debugf(\n\t\t\"Search filters groups:[%v]; categories:[%v]; kinds:[%v]; namespaces:[%v]; versions:[%v]; names:[%v]; labels:[%v] containers:[%s]\",\n\t\tgroups, categories, kinds, namespaces, versions, names, labels, containers,\n\t)\n\n\t// Build a groups-resource Map that maps each\n\t// selected group to its associated resources.\n\tgroupResMap := make(map[schema.GroupVersion]*metav1.APIResourceList)\n\tswitch {\n\tcase groups == \"\" && kinds == \"\" && versions == \"\" && categories == \"\":\n\t\t// no groups, no kinds (resources), no versions, no categories provided\n\t\treturn nil, fmt.Errorf(\"search: at least one of {groups, kinds, versions, or categories} is required\")\n\tcase groups == \"\" && kinds == \"\" && versions != \"\" && categories == \"\":\n\t\t// only versions provided\n\t\treturn nil, fmt.Errorf(\"search: versions must be provided with at least one of {groups, kinds, or categories}\")\n\tdefault:\n\t\t// build a group-to-resources map, based on the passed parameters.\n\t\t// first, extract groups needed to build the map\n\t\tvar groupList *metav1.APIGroupList\n\t\tif groups != \"\" {\n\t\t\tgroupList = &metav1.APIGroupList{}\n\t\t\tgroupSlice := splitParamList(groups)\n\n\t\t\t// adjust for legacy group name \"core\" -> \"\" empty\n\t\t\tfor i := 0; i < len(groupSlice); i++ {\n\t\t\t\tgroupSlice[i] = toLegacyGrpName(groupSlice[i])\n\t\t\t}\n\n\t\t\tserverGroups, err := k8sc.Disco.ServerGroups()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"search: failed to get server groups: %w\", err)\n\t\t\t}\n\t\t\t// for each server group, match specified group name from param\n\t\t\tfor _, grp := range serverGroups.Groups {\n\t\t\t\tif sliceContains(groupSlice, grp.Name) {\n\t\t\t\t\tgroupList.Groups = append(groupList.Groups, grp)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tserverGroups, err := k8sc.Disco.ServerGroups()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"search: failed to get server groups: %w\", err)\n\t\t\t}\n\t\t\tgroupList = serverGroups\n\t\t}\n\n\t\t// extract resources names (kinds param) and versions params\n\t\tverSlice := splitParamList(versions)\n\t\tresSlice := splitParamList(kinds)\n\t\tcatSlice := splitParamList(categories)\n\n\t\t// next, for each groupVersion pair\n\t\t// retrieve a set of resources associated with it\n\t\tfor _, grp := range groupList.Groups {\n\t\t\tfor _, ver := range grp.Versions {\n\t\t\t\t// only select ver if it can be matched, otherwise continue to next ver\n\t\t\t\tif versions != \"\" && !sliceContains(verSlice, ver.Version) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// grab all available resources for group/ver\n\t\t\t\tgroupVersion := schema.GroupVersion{Group: grp.Name, Version: ver.Version}\n\t\t\t\tresList, err := k8sc.Disco.ServerResourcesForGroupVersion(groupVersion.String())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"search: failed to get resources for groups: %w\", err)\n\t\t\t\t}\n\n\t\t\t\t// for each resource in group/ver\n\t\t\t\t// attempt to match it with provided resources name (kinds)\n\t\t\t\tresultList := &metav1.APIResourceList{GroupVersion: groupVersion.String()}\n\t\t\t\tfor _, resource := range resList.APIResources {\n\t\t\t\t\t// filter resources on names if provided (kinds param)\n\t\t\t\t\tif kinds != \"\" && !sliceContains(resSlice, resource.Kind) && !sliceContains(resSlice, resource.Name) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\t// filter resources on categories if specified\n\t\t\t\t\tif categories != \"\" && !sliceContains(catSlice, resource.Categories...) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tresultList.APIResources = append(resultList.APIResources, resource)\n\t\t\t\t}\n\t\t\t\tgroupResMap[groupVersion] = resultList\n\t\t\t}\n\t\t}\n\t}\n\n\t// prepare namespaces\n\tvar nsList []string\n\tif namespaces != \"\" {\n\t\tnsList = splitParamList(namespaces)\n\t} else {\n\t\tnsNames, err := getNamespaces(ctx, k8sc)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnsList = nsNames\n\t}\n\n\t// Collect resource objects using the grou-to-resources map\n\tvar finalResults []SearchResult\n\tlogrus.Debugf(\"searching through %d groups\", len(groupResMap))\n\tfor groupVer, resourceList := range groupResMap {\n\t\tfor _, resource := range resourceList.APIResources {\n\t\t\tlistOptions := metav1.ListOptions{\n\t\t\t\tLabelSelector: labels,\n\t\t\t}\n\t\t\tgvr := schema.GroupVersionResource{Group: groupVer.Group, Version: groupVer.Version, Resource: resource.Name}\n\t\t\t// gather found resources\n\t\t\tvar results []SearchResult\n\t\t\tif resource.Namespaced {\n\t\t\t\tfor _, ns := range nsList {\n\t\t\t\t\tlogrus.Debugf(\"searching for %s objects in [group=%s; namespace=%s; labels=%v]\",\n\t\t\t\t\t\tresource.Name, groupVer, ns, listOptions.LabelSelector,\n\t\t\t\t\t)\n\t\t\t\t\tlist, err := k8sc.Client.Resource(gvr).Namespace(ns).List(ctx, listOptions)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlogrus.Debugf(\n\t\t\t\t\t\t\t\"WARN: failed to get %s objects in [group=%s; namespace=%s; labels=%v]: %s\",\n\t\t\t\t\t\t\tresource.Name, groupVer, ns, listOptions.LabelSelector, err,\n\t\t\t\t\t\t)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tif len(list.Items) == 0 {\n\t\t\t\t\t\tlogrus.Debugf(\n\t\t\t\t\t\t\t\"WARN: found 0 %s in [group=%s; namespace=%s; labels=%v]\",\n\t\t\t\t\t\t\tresource.Name, groupVer, ns, listOptions.LabelSelector,\n\t\t\t\t\t\t)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tlogrus.Debugf(\"found %d %s in [group=%s; namespace=%s; labels=%v]\",\n\t\t\t\t\t\tlen(list.Items), resource.Name, groupVer, ns, listOptions.LabelSelector,\n\t\t\t\t\t)\n\t\t\t\t\tresult := SearchResult{\n\t\t\t\t\t\tListKind: list.GetKind(),\n\t\t\t\t\t\tResourceName: resource.Name,\n\t\t\t\t\t\tResourceKind: resource.Kind,\n\t\t\t\t\t\tNamespaced: resource.Namespaced,\n\t\t\t\t\t\tNamespace: ns,\n\t\t\t\t\t\tGroupVersionResource: gvr,\n\t\t\t\t\t\tList: list,\n\t\t\t\t\t}\n\t\t\t\t\tresults = append(results, result)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlogrus.Debugf(\"searching for %s objects in [group=%s; non-namespced; labels=%v]\",\n\t\t\t\t\tresource.Name, groupVer, listOptions.LabelSelector,\n\t\t\t\t)\n\n\t\t\t\tlist, err := k8sc.Client.Resource(gvr).List(ctx, listOptions)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Debugf(\n\t\t\t\t\t\t\"WARN: failed to get %s objects in [group=%s; non-namespaced; labels=%v]: %s\",\n\t\t\t\t\t\tresource.Name, groupVer, listOptions.LabelSelector, err,\n\t\t\t\t\t)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif len(list.Items) == 0 {\n\t\t\t\t\tlogrus.Debugf(\n\t\t\t\t\t\t\"WARN: found 0 %s in [group=%s; non-namespaced; labels=%v]\",\n\t\t\t\t\t\tresource.Name, groupVer, listOptions.LabelSelector,\n\t\t\t\t\t)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tlogrus.Debugf(\"found %d %s in [group=%s; non-namespaced; labels=%v]\",\n\t\t\t\t\tlen(list.Items), resource.Name, groupVer, listOptions.LabelSelector,\n\t\t\t\t)\n\n\t\t\t\tresult := SearchResult{\n\t\t\t\t\tListKind: list.GetKind(),\n\t\t\t\t\tResourceKind: resource.Kind,\n\t\t\t\t\tResourceName: resource.Name,\n\t\t\t\t\tNamespaced: resource.Namespaced,\n\t\t\t\t\tGroupVersionResource: gvr,\n\t\t\t\t\tList: list,\n\t\t\t\t}\n\t\t\t\tresults = append(results, result)\n\t\t\t}\n\n\t\t\t// apply name filters\n\t\t\tlogrus.Debugf(\"applying filters on %d results\", len(results))\n\t\t\tfor _, result := range results {\n\t\t\t\tfilteredResult := result\n\t\t\t\tif len(containers) > 0 && result.ListKind == \"PodList\" {\n\t\t\t\t\tfilteredResult = filterPodsByContainers(result, containers)\n\t\t\t\t\tlogrus.Debugf(\"found %d %s with container filter [%s]\", len(filteredResult.List.Items), filteredResult.ResourceName, containers)\n\t\t\t\t}\n\t\t\t\tif len(names) > 0 {\n\t\t\t\t\tfilteredResult = filterByNames(result, names)\n\t\t\t\t\tlogrus.Debugf(\"found %d %s with name filter [%s]\", len(filteredResult.List.Items), filteredResult.ResourceName, names)\n\t\t\t\t}\n\t\t\t\tfinalResults = append(finalResults, filteredResult)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn finalResults, nil\n}", "func getIndexContent(name string) string {\n\treturn fmt.Sprintf(`export { default } from \"./%s\";`, name)\n}", "func (epi *epInfo) resources(portFilter *filter.RegexFilter, l *logger.Logger) (resources []*pb.Resource) {\n\tfor _, eps := range epi.Subsets {\n\t\t// There is usually one port, but there can be multiple ports, e.g. 9313\n\t\t// and 9314.\n\t\tfor _, port := range eps.Ports {\n\t\t\t// For unnamed ports, use port number.\n\t\t\tportName := port.Name\n\t\t\tif portName == \"\" {\n\t\t\t\tportName = strconv.FormatInt(int64(port.Port), 10)\n\t\t\t}\n\n\t\t\tif portFilter != nil && !portFilter.Match(portName, l) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor _, addr := range eps.Addresses {\n\t\t\t\t// We name the resource as <endpoints_name>_<IP>_<port>\n\t\t\t\tresName := fmt.Sprintf(\"%s_%s_%s\", epi.Metadata.Name, addr.IP, portName)\n\t\t\t\tresources = append(resources, &pb.Resource{\n\t\t\t\t\tName: proto.String(resName),\n\t\t\t\t\tIp: proto.String(addr.IP),\n\t\t\t\t\tPort: proto.Int(port.Port),\n\t\t\t\t\tLabels: epi.Metadata.Labels,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func templatesIndexTmpl() (*asset, error) {\n\tpath := \"/Volumes/Code/go/src/github.com/schollz/cowyo/templates/index.tmpl\"\n\tname := \"templates/index.tmpl\"\n\tbytes, err := bindataRead(path, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfi, err := os.Stat(path)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Error reading asset info %s at %s: %v\", name, path, err)\n\t}\n\n\ta := &asset{bytes: bytes, info: fi}\n\treturn a, err\n}", "func (m MatchedResources) Query(client *ApiClient, namespace string) (map[string][]byte, error) {\n\tvar err error\n\tresult := make(map[string][]byte)\n\n\tfor res, object := range m.WantRes{\n\t\tfor namespaced, g := range m.Gvr {\n\t\t\tfor _, gvr := range g {\n\t\t\t\tif res != gvr.Resource {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tj := 0\n\t\t\t\tfor _, k := range object{\n\t\t\t\t\tif namespaced {\n\t\t\t\t\t\tf, err = client.DynClient.Resource(gvr).Namespace(namespace).Get(context.TODO(), k, metav1.GetOptions{})\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tf, err = client.DynClient.Resource(gvr).Get(context.TODO(), k, metav1.GetOptions{})\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\terr = deepCleaning(f)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\n\t\t\t\t\toutput, err := utils.GetPrettyYaml(f)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\tresult[fmt.Sprintf(\"%s-%v\", res, j)] = output\n\n\t\t\t\t\tj++\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n\treturn result, nil\n\n}", "func (d *docsIndexer) indexFile(p *packages.Package, f *ast.File, fileName string, isTestFile bool) (fileDocs, error) {\n\tvar result fileDocs\n\tresult.pkgDocsMarkdown = godocToMarkdown(f.Doc.Text())\n\n\t// Collect each top-level declaration.\n\tvar initIndex int = 1\n\tfor _, decl := range f.Decls {\n\t\tswitch node := decl.(type) {\n\t\tcase *ast.GenDecl:\n\t\t\tgenDeclDocs := d.indexGenDecl(p, f, node, isTestFile)\n\t\t\tresult.consts = append(result.consts, genDeclDocs.consts...)\n\t\t\tresult.vars = append(result.vars, genDeclDocs.vars...)\n\t\t\tresult.types = append(result.types, genDeclDocs.types...)\n\t\tcase *ast.FuncDecl:\n\t\t\t// Functions, methods\n\t\t\tif node.Name.Name == \"_\" {\n\t\t\t\t// Not only is it not exported, it cannot be referenced outside this package at all.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tresult.funcs = append(result.funcs, d.indexFuncDecl(p.Fset, p, node, fileName, &initIndex, isTestFile))\n\t\t}\n\t}\n\n\t// Emit documentation for all constants.\n\tfor i, constDocs := range result.consts {\n\t\temittedID := constDocs.result().emit(d.i.emitter)\n\t\tconstDocs.ID = emittedID\n\t\tresult.consts[i] = constDocs\n\t}\n\n\t// Emit documentation for all variables.\n\tfor i, varDocs := range result.vars {\n\t\temittedID := varDocs.result().emit(d.i.emitter)\n\t\tvarDocs.ID = emittedID\n\t\tresult.vars[i] = varDocs\n\t}\n\n\t// Emit documentation for all types (struct/interface/other type definitions)\n\tfor i, typeDocs := range result.types {\n\t\temittedID := typeDocs.result().emit(d.i.emitter)\n\t\ttypeDocs.ID = emittedID\n\t\tresult.types[i] = typeDocs\n\t}\n\n\t// Emit documentation for all funcs/methods.\n\tfor i, funcDocs := range result.funcs {\n\t\temittedID := funcDocs.result().emit(d.i.emitter)\n\t\tfuncDocs.ID = emittedID\n\t\tresult.funcs[i] = funcDocs\n\t}\n\treturn result, nil\n}", "func writeIndexEntries(p []*post, o string, t postListing) error {\n\tvar m string\n\tswitch t {\n\tcase index:\n\t\tm = \"index_template.html\"\n\tcase rss:\n\t\tm = \"rss_template.rss\"\n\tcase archive:\n\t\tm = \"archive_template.html\"\n\t}\n\te, err := template.ParseFiles(filepath.Join(templatesrc, m))\n\tif checkError(err) {\n\t\treturn err\n\t}\n\n\tf, err := os.Create(o)\n\tif checkError(err) {\n\t\treturn err\n\t}\n\terr = e.Execute(f, p)\n\tif checkError(err) {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (m *CompositeIndexer) Map(resources []models.Resource) []solr.Document {\n\tdocs := make([]solr.Document, len(resources))\n\tfor i, v := range resources {\n\t\tif v == nil {\n\t\t\tcontinue\n\t\t}\n\t\tdocs[i] = m.mapOne(v)\n\t}\n\treturn docs\n}", "func (s pipelineResourceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.PipelineResource, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.PipelineResource))\n\t})\n\treturn ret, err\n}", "func IndexHandler(plugins map[string]*tools.Plugin, db *services.Database) httprouter.Handle {\n\treturn func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\t\tqueryValues := r.URL.Query()\n\t\tquery := make(map[string]interface{})\n\t\tfor k, v := range queryValues {\n\t\t\tquery[k] = strings.Join(v, \"\")\n\t\t}\n\n\t\tdata := make(map[string]interface{})\n\t\tif query[\"provider\"] == nil {\n\t\t\tdata[\"provider\"] = \"\"\n\t\t} else {\n\t\t\tdata[\"provider\"] = query[\"provider\"]\n\t\t}\n\n\t\tif query[\"provider\"] == \"\" {\n\t\t\tdelete(query, \"provider\")\n\t\t}\n\n\t\tif query[\"table\"] == nil {\n\t\t\tquery[\"table\"] = \"images\"\n\t\t}\n\t\tdata[\"table\"] = query[\"table\"]\n\n\t\tcount, err := db.CountEntries(query)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\tlog.Printf(\"query %s has %d elements\\n\", query, count)\n\t\tdata[\"count\"] = count\n\n\t\tshown := services.MaxValues\n\t\tif count < shown {\n\t\t\tshown = count\n\t\t}\n\t\tdata[\"shown\"] = shown\n\n\t\tlog.Printf(\"render results for %s\\n\", query)\n\t\tresults, err := db.ReadEntries(query)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\n\t\telements := make([]string, 0)\n\t\tvar element map[string]interface{}\n\t\tfor id := range results {\n\t\t\telement = results[id].(map[string]interface{})\n\t\t\tprovider := element[\"provider\"].(string)\n\t\t\tplugin := plugins[provider]\n\t\t\trender, err := plugin.Present(element, \"\")\n\t\t\tif err == nil {\n\t\t\t\telements = append(elements, render)\n\t\t\t} else {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t}\n\t\tdata[\"elements\"] = elements\n\t\trenderTemplate(w, \"index.html\", data)\n\t}\n}", "func sortResources(resources []astmodel.InternalTypeName) []astmodel.InternalTypeName {\n\tsort.Slice(resources, func(i, j int) bool {\n\t\tiVal := resources[i]\n\t\tjVal := resources[j]\n\n\t\treturn iVal.PackageReference().PackageName() < jVal.PackageReference().PackageName() ||\n\t\t\tiVal.PackageReference().PackageName() < jVal.PackageReference().PackageName() && iVal.Name() < jVal.Name()\n\t})\n\n\treturn resources\n}", "func InitSearchIndex() {\n\tfor t := range item.Types {\n\t\terr := search.MapIndex(t)\n\t\tif err != nil {\n\t\t\tlog.Fatalln(err)\n\t\t\treturn\n\t\t}\n\t\tSortContent(t)\n\t}\n}", "func (o Model) RebuildIndexes(pattern string) error {\n\t// Quick exit in case no index exists\n\tif o.IndexSet == nil || len(o.IndexSet.Indexes) == 0 {\n\t\treturn nil\n\t}\n\n\tp := res.Pattern(pattern)\n\tif !p.IsValid() {\n\t\treturn errors.New(\"invalid pattern\")\n\t}\n\n\t// Drop existing index entries\n\tfor _, idx := range o.IndexSet.Indexes {\n\t\terr := o.BadgerDB.DB.DropPrefix([]byte(idx.Name))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tt := reflect.TypeOf(o.Type)\n\n\t// Create a prefix to seek from\n\tridPrefix := pattern\n\ti := p.IndexWildcard()\n\tif i >= 0 {\n\t\tridPrefix = pattern[:i]\n\t}\n\n\t// Create new index entries in a single transaction\n\treturn o.BadgerDB.DB.Update(func(txn *badger.Txn) error {\n\t\tit := txn.NewIterator(badger.DefaultIteratorOptions)\n\t\tdefer it.Close()\n\t\tprefix := []byte(ridPrefix)\n\t\tfor it.Seek(prefix); it.ValidForPrefix(prefix); it.Next() {\n\t\t\t// Ensure the key matches the pattern\n\t\t\tif !p.Matches(string(it.Item().Key())) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Load item and unmarshal it\n\t\t\titem := it.Item()\n\t\t\tv := reflect.New(t)\n\t\t\terr := item.Value(func(dta []byte) error {\n\t\t\t\treturn json.Unmarshal(dta, v.Interface())\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// Loop through indexes and generate a new entry per index\n\t\t\tfor _, idx := range o.IndexSet.Indexes {\n\t\t\t\trname := item.KeyCopy(nil)\n\t\t\t\tidxKey := idx.getKey(rname, idx.Key(v.Elem().Interface()))\n\t\t\t\terr = txn.SetEntry(&badger.Entry{Key: idxKey, Value: nil, UserMeta: typeIndex})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n}", "func Main(adds []string) j.Type {\n\tindex := j.Import(\"\", IndexFile)\n\tif len(adds) == 0 {\n\t\treturn index\n\t}\n\telems := []j.Type{index}\n\tfor _, a := range adds {\n\t\ta = filepath.Join(CustomPrefix, filepath.Base(a))\n\t\tadd := j.Import(\"\", a)\n\t\telems = append(elems, add)\n\t}\n\n\treturn j.Add(\"\", elems...)\n}", "func FindPhysicalIndexes(url string, alias string) []string {\n\tindexResponse := infoResponse{}\n\t_, err := MakeJSONRequest(http.MethodGet, fmt.Sprintf(\"%s/%s\", url, alias), \"\", &indexResponse)\n\tindexes := make([]string, 0)\n\n\t// error could mean a variety of things, but we'll figure that out later\n\tif err != nil {\n\t\treturn indexes\n\t}\n\n\t// our top level key is our physical index name\n\tfor key := range indexResponse {\n\t\tindexes = append(indexes, key)\n\t}\n\n\t// reverse sort order should put our newest index first\n\tsort.Sort(sort.Reverse(sort.StringSlice(indexes)))\n\treturn indexes\n}", "func index(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprint(w, \"index de uma função\")\n}", "func (app *application) makeSearchIndexMap() *search.IndexSlice {\r\n\tindSlice := search.IndexSlice{map[string][]int{}, map[string][]int{}, map[string][]int{}}\r\n\tproductForSearch, err := app.products.GetSearchProducts()\r\n\tif err != nil {\r\n\t\tapp.errorLog.Println(err)\r\n\t\treturn nil\r\n\t}\r\n\tindSlice.Add(productForSearch)\r\n\treturn &indSlice\r\n}", "func (as *API) Index(ctx context.Context, req *pbreq.Index) (*pbresp.Index, error) {\n\tswitch req.GetType() {\n\tcase \"ipld\":\n\t\tbreak\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid data type '%s'\", req.GetType())\n\t}\n\n\tvar name = req.GetIdentifier()\n\tvar reindex = req.GetReindex()\n\tmetaData, err := as.lens.Magnify(name, reindex)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to perform indexing for '%s': %s\",\n\t\t\tname, err.Error())\n\t}\n\n\tvar resp *lens.Object\n\tif !reindex {\n\t\tif resp, err = as.lens.Store(name, metaData); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tb, err := as.lens.Get(name)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to find ID for object '%s'\", name)\n\t\t}\n\t\tid, err := uuid.FromBytes(b)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid uuid found for '%s' ('%s'): %s\",\n\t\t\t\tname, string(b), err.Error())\n\t\t}\n\t\tif resp, err = as.lens.Update(id, name, metaData); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to update object: %s\", err.Error())\n\t\t}\n\t}\n\n\treturn &pbresp.Index{\n\t\tId: resp.LensID.String(),\n\t\tKeywords: metaData.Summary,\n\t}, nil\n}", "func updateIndex(indexName string, objects []algoliasearch.Object) error {\n\n\tindex := algoliaClient.InitIndex(indexName)\n\terr := populateIndex(index, objects)\n\tif err != nil {\n\t\treturn errors.New(\"Error updating index -\" + err.Error())\n\t}\n\n\treturn nil\n}", "func (db *Database) Indexes(label string) ([]*Index, error) {\n\turi := join(db.Url, \"schema/index\", label)\n\tresult := []*Index{}\n\tne := NeoError{}\n\tresp, err := db.Session.Get(uri, nil, &result, &ne)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\tif resp.Status() == 404 {\n\t\treturn result, NotFound\n\t}\n\tif resp.Status() != 200 {\n\t\treturn result, ne\n\t}\n\tfor _, idx := range result {\n\t\tidx.db = db\n\t}\n\treturn result, nil\n}", "func (s *server) handleIndex(FSS fs.FS) http.HandlerFunc {\n\ttype AppConfig struct {\n\t\tAvatarService string\n\t\tToastTimeout int\n\t\tAllowGuests bool\n\t\tAllowRegistration bool\n\t\tDefaultLocale string\n\t\tAuthMethod string\n\t\tAppVersion string\n\t\tCookieName string\n\t\tPathPrefix string\n\t\tAPIEnabled bool\n\t\tCleanupGuestsDaysOld int\n\t\tCleanupStoryboardsDaysOld int\n\t\tShowActiveCountries bool\n\t}\n\ttype UIConfig struct {\n\t\tAnalyticsEnabled bool\n\t\tAnalyticsID string\n\t\tAppConfig AppConfig\n\t\tActiveAlerts []interface{}\n\t}\n\n\ttmpl := s.getIndexTemplate(FSS)\n\n\tappConfig := AppConfig{\n\t\tAvatarService: viper.GetString(\"config.avatar_service\"),\n\t\tToastTimeout: viper.GetInt(\"config.toast_timeout\"),\n\t\tAllowGuests: viper.GetBool(\"config.allow_guests\"),\n\t\tAllowRegistration: viper.GetBool(\"config.allow_registration\") && viper.GetString(\"auth.method\") == \"normal\",\n\t\tDefaultLocale: viper.GetString(\"config.default_locale\"),\n\t\tAuthMethod: viper.GetString(\"auth.method\"),\n\t\tAPIEnabled: viper.GetBool(\"config.allow_external_api\"),\n\t\tAppVersion: s.config.Version,\n\t\tCookieName: s.config.FrontendCookieName,\n\t\tPathPrefix: s.config.PathPrefix,\n\t\tCleanupGuestsDaysOld: viper.GetInt(\"config.cleanup_guests_days_old\"),\n\t\tCleanupStoryboardsDaysOld: viper.GetInt(\"config.cleanup_storyboards_days_old\"),\n\t\tShowActiveCountries: viper.GetBool(\"config.show_active_countries\"),\n\t}\n\n\tActiveAlerts = s.database.GetActiveAlerts()\n\n\tdata := UIConfig{\n\t\tAnalyticsEnabled: s.config.AnalyticsEnabled,\n\t\tAnalyticsID: s.config.AnalyticsID,\n\t\tAppConfig: appConfig,\n\t}\n\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tdata.ActiveAlerts = ActiveAlerts // get latest alerts from memory\n\n\t\tif embedUseOS {\n\t\t\ttmpl = s.getIndexTemplate(FSS)\n\t\t}\n\n\t\ttmpl.Execute(w, data)\n\t}\n}", "func getPackageRefs(resources []astmodel.InternalTypeName) []astmodel.PackageReference {\n\tpackageRefs := make([]astmodel.PackageReference, 0, len(resources)+1)\n\t// Package reference for return type\n\tpackageRefs = append(packageRefs, astmodel.KubernetesResourceType.PackageReference())\n\n\tfor _, typeDef := range resources {\n\t\tpackageRefs = append(packageRefs, typeDef.PackageReference())\n\t}\n\n\treturn packageRefs\n}", "func serveIndex(w http.ResponseWriter, r *http.Request, bs buildSpec, br *buildResult) {\n\txreq := request{bs, \"\", pageIndex}\n\txlink := xreq.link()\n\n\ttype versionLink struct {\n\t\tVersion string\n\t\tURLPath string\n\t\tSuccess bool\n\t\tActive bool\n\t}\n\ttype response struct {\n\t\tErr error\n\t\tLatestVersion string\n\t\tVersionLinks []versionLink\n\t}\n\n\t// Do a lookup to the goproxy in the background, to list the module versions.\n\tc := make(chan response, 1)\n\tgo func() {\n\t\tt0 := time.Now()\n\t\tdefer func() {\n\t\t\tmetricGoproxyListDuration.Observe(time.Since(t0).Seconds())\n\t\t}()\n\n\t\tmodPath, err := module.EscapePath(bs.Mod)\n\t\tif err != nil {\n\t\t\tc <- response{fmt.Errorf(\"bad module path: %v\", err), \"\", nil}\n\t\t\treturn\n\t\t}\n\t\tu := fmt.Sprintf(\"%s%s/@v/list\", config.GoProxy, modPath)\n\t\tmreq, err := http.NewRequestWithContext(r.Context(), \"GET\", u, nil)\n\t\tif err != nil {\n\t\t\tc <- response{fmt.Errorf(\"%w: preparing new http request: %v\", errServer, err), \"\", nil}\n\t\t\treturn\n\t\t}\n\t\tmreq.Header.Set(\"User-Agent\", userAgent)\n\t\tresp, err := http.DefaultClient.Do(mreq)\n\t\tif err != nil {\n\t\t\tc <- response{fmt.Errorf(\"%w: http request: %v\", errServer, err), \"\", nil}\n\t\t\treturn\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\tif resp.StatusCode != 200 {\n\t\t\tmetricGoproxyListErrors.WithLabelValues(fmt.Sprintf(\"%d\", resp.StatusCode)).Inc()\n\t\t\tc <- response{fmt.Errorf(\"%w: http response from goproxy: %v\", errRemote, resp.Status), \"\", nil}\n\t\t\treturn\n\t\t}\n\t\tbuf, err := io.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tc <- response{fmt.Errorf(\"%w: reading versions from goproxy: %v\", errRemote, err), \"\", nil}\n\t\t\treturn\n\t\t}\n\t\tl := []versionLink{}\n\t\tfor _, s := range strings.Split(string(buf), \"\\n\") {\n\t\t\tif s != \"\" {\n\t\t\t\tvbs := bs\n\t\t\t\tvbs.Version = s\n\t\t\t\tsuccess := fileExists(filepath.Join(vbs.storeDir(), \"recordnumber\"))\n\t\t\t\tp := request{vbs, \"\", pageIndex}.link()\n\t\t\t\tlink := versionLink{s, p, success, p == xlink}\n\t\t\t\tl = append(l, link)\n\t\t\t}\n\t\t}\n\t\tsort.Slice(l, func(i, j int) bool {\n\t\t\treturn semver.Compare(l[i].Version, l[j].Version) > 0\n\t\t})\n\t\tvar latestVersion string\n\t\tif len(l) > 0 {\n\t\t\tlatestVersion = l[0].Version\n\t\t}\n\t\tc <- response{nil, latestVersion, l}\n\t}()\n\n\t// Non-emptiness means we'll serve the error page instead of doing a SSE request for events.\n\tvar output string\n\tif br == nil {\n\t\tif buf, err := readGzipFile(filepath.Join(bs.storeDir(), \"log.gz\")); err != nil {\n\t\t\tif !os.IsNotExist(err) {\n\t\t\t\tfailf(w, \"%w: reading log.gz: %v\", errServer, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// For not-exist, we'll continue below to build.\n\t\t} else {\n\t\t\toutput = string(buf)\n\t\t}\n\t}\n\n\t// Construct links to other goversions, targets.\n\ttype goversionLink struct {\n\t\tGoversion string\n\t\tURLPath string\n\t\tSuccess bool\n\t\tSupported bool\n\t\tActive bool\n\t}\n\tgoversionLinks := []goversionLink{}\n\tnewestAllowed, supported, remaining := installedSDK()\n\tfor _, goversion := range supported {\n\t\tgvbs := bs\n\t\tgvbs.Goversion = goversion\n\t\tsuccess := fileExists(filepath.Join(gvbs.storeDir(), \"recordnumber\"))\n\t\tp := request{gvbs, \"\", pageIndex}.link()\n\t\tgoversionLinks = append(goversionLinks, goversionLink{goversion, p, success, true, p == xlink})\n\t}\n\tfor _, goversion := range remaining {\n\t\tgvbs := bs\n\t\tgvbs.Goversion = goversion\n\t\tsuccess := fileExists(filepath.Join(gvbs.storeDir(), \"recordnumber\"))\n\t\tp := request{gvbs, \"\", pageIndex}.link()\n\t\tgoversionLinks = append(goversionLinks, goversionLink{goversion, p, success, false, p == xlink})\n\t}\n\n\ttype targetLink struct {\n\t\tGoos string\n\t\tGoarch string\n\t\tURLPath string\n\t\tSuccess bool\n\t\tActive bool\n\t}\n\ttargetLinks := []targetLink{}\n\tfor _, target := range targets.get() {\n\t\ttbs := bs\n\t\ttbs.Goos = target.Goos\n\t\ttbs.Goarch = target.Goarch\n\t\tsuccess := fileExists(filepath.Join(tbs.storeDir(), \"recordnumber\"))\n\t\tp := request{tbs, \"\", pageIndex}.link()\n\t\ttargetLinks = append(targetLinks, targetLink{target.Goos, target.Goarch, p, success, p == xlink})\n\t}\n\n\ttype variantLink struct {\n\t\tVariant string // \"default\" or \"stripped\"\n\t\tTitle string // Displayed on hover in UI.\n\t\tURLPath string\n\t\tSuccess bool\n\t\tActive bool\n\t}\n\tvar variantLinks []variantLink\n\taddVariant := func(v, title string, stripped bool) {\n\t\tvbs := bs\n\t\tvbs.Stripped = stripped\n\t\tsuccess := fileExists(filepath.Join(vbs.storeDir(), \"recordnumber\"))\n\t\tp := request{vbs, \"\", pageIndex}.link()\n\t\tvariantLinks = append(variantLinks, variantLink{v, title, p, success, p == xlink})\n\t}\n\taddVariant(\"default\", \"\", false)\n\taddVariant(\"stripped\", \"Symbol table and debug information stripped, reducing binary size.\", true)\n\n\tpkgGoDevURL := \"https://pkg.go.dev/\" + path.Join(bs.Mod+\"@\"+bs.Version, bs.Dir[1:]) + \"?tab=doc\"\n\n\tresp := <-c\n\n\tvar filesizeGz string\n\tif br == nil {\n\t\tbr = &buildResult{buildSpec: bs}\n\t} else {\n\t\tif info, err := os.Stat(filepath.Join(bs.storeDir(), \"binary.gz\")); err == nil {\n\t\t\tfilesizeGz = fmt.Sprintf(\"%.1f MB\", float64(info.Size())/(1024*1024))\n\t\t}\n\t}\n\n\tprependDir := xreq.Dir\n\tif prependDir == \"/\" {\n\t\tprependDir = \"\"\n\t}\n\n\tvar newerText, newerURL string\n\tif xreq.Goversion != newestAllowed && newestAllowed != \"\" && xreq.Version != resp.LatestVersion && resp.LatestVersion != \"\" {\n\t\tnewerText = \"A newer version of both this module and the Go toolchain is available\"\n\t} else if xreq.Version != resp.LatestVersion && resp.LatestVersion != \"\" {\n\t\tnewerText = \"A newer version of this module is available\"\n\t} else if xreq.Goversion != newestAllowed && newestAllowed != \"\" {\n\t\tnewerText = \"A newer Go toolchain version is available\"\n\t}\n\tif newerText != \"\" {\n\t\tnbs := bs\n\t\tnbs.Version = resp.LatestVersion\n\t\tnbs.Goversion = newestAllowed\n\t\tnewerURL = request{nbs, \"\", pageIndex}.link()\n\t}\n\n\tfavicon := \"/favicon.ico\"\n\tif output != \"\" {\n\t\tfavicon = \"/favicon-error.png\"\n\t} else if br.Sum == \"\" {\n\t\tfavicon = \"/favicon-building.png\"\n\t}\n\targs := map[string]interface{}{\n\t\t\"Favicon\": favicon,\n\t\t\"Success\": br.Sum != \"\",\n\t\t\"Sum\": br.Sum,\n\t\t\"Req\": xreq, // eg \"/\" or \"/cmd/x\"\n\t\t\"DirAppend\": xreq.appendDir(), // eg \"\" or \"cmd/x/\"\n\t\t\"DirPrepend\": prependDir, // eg \"\" or /cmd/x\"\n\t\t\"GoversionLinks\": goversionLinks,\n\t\t\"TargetLinks\": targetLinks,\n\t\t\"VariantLinks\": variantLinks,\n\t\t\"Mod\": resp,\n\t\t\"GoProxy\": config.GoProxy,\n\t\t\"DownloadFilename\": xreq.downloadFilename(),\n\t\t\"PkgGoDevURL\": pkgGoDevURL,\n\t\t\"GobuildVersion\": gobuildVersion,\n\t\t\"GobuildPlatform\": gobuildPlatform,\n\t\t\"VerifierKey\": config.VerifierKey,\n\t\t\"GobuildsOrgVerifierKey\": gobuildsOrgVerifierKey,\n\t\t\"NewerText\": newerText,\n\t\t\"NewerURL\": newerURL,\n\n\t\t// Whether we will do SSE request for updates.\n\t\t\"InProgress\": br.Sum == \"\" && output == \"\",\n\n\t\t// Non-empty on failure.\n\t\t\"Output\": output,\n\n\t\t// Below only meaningful when \"success\".\n\t\t\"Filesize\": fmt.Sprintf(\"%.1f MB\", float64(br.Filesize)/(1024*1024)),\n\t\t\"FilesizeGz\": filesizeGz,\n\t}\n\n\tif br.Sum == \"\" {\n\t\tw.Header().Set(\"Cache-Control\", \"no-store\")\n\t}\n\n\tif err := buildTemplate.Execute(w, args); err != nil {\n\t\tfailf(w, \"%w: executing template: %v\", errServer, err)\n\t}\n}", "func (a *APIGen) Indices(ctx context.Context, filter string) ([]Index, error) {\n\tpanic(\"Should Not Be Called from Gen Pattern.\")\n}", "func loadIndex(ctx context.Context, repo restic.Repository, id restic.ID) (*index.Index, error) {\n\tbuf, err := repo.LoadUnpacked(ctx, restic.IndexFile, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tidx, oldFormat, err := index.DecodeIndex(buf, id)\n\tif oldFormat {\n\t\tfmt.Fprintf(os.Stderr, \"index %v has old format\\n\", id.Str())\n\t}\n\treturn idx, err\n}", "func Index() (int, error) {\n\t\tfmt.Println(\"Loading resources\")\n\t\terr := InitDB()\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tcoursesHTML, _ := ioutil.ReadFile(config.Local.DefaultFN)\n\t\tdoc := soup.HTMLParse(string(coursesHTML))\n\t\ttables := doc.FindAll(\"table\", \"class\", \"datadisplaytable\")\n\t\tregistrar := start(tables)\n\t\tif config.CatSecret != nil {\n\t\t\t\tcat := handleCatalog()\n\t\t\t\tindexCatalog(cat, registrar)\n\t\t}\n\t\tCommit(registrar)\n\t\treturn 0, nil\n}", "func (sqliteCtx *SqliteCtx) BookIndex(w http.ResponseWriter, r *http.Request) {\n\tquery := fmt.Sprintf(\"SELECT * FROM %s\", tableName)\n\trows, err := sqliteCtx.db.Query(query)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tbook := new(model.Book)\n\tscannedBooks := []*model.Book{}\n\tfor rows.Next() {\n\t\terr = rows.Scan(&book.ID, &book.Title, &book.Genres,\n\t\t\t&book.Pages, &book.Price)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tscannedBooks = append(scannedBooks, book)\n\t}\n\tjsonScannedBooks, err := json.MarshalIndent(scannedBooks, \"\", \" \")\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.Write(jsonScannedBooks)\n}", "func (g genericPlugin) List(gvk schema.GroupVersionKind, namespace string,\n\tclient plugin.KubernetesConnector) ([]helm.KubernetesResource, error) {\n\n\tvar returnData []helm.KubernetesResource\n\treturn returnData, nil\n}", "func ImageIndexSchema() *gojsonschema.Schema {\n\treturn loadSchema(\"image-index.schema.json\")\n}", "func (m *Entry) SearchData() *EntryIndex {\n\ttags := []string{}\n\tif m.Tags != nil {\n\t\tfor _, tag := range m.Tags {\n\t\t\ttags = append(tags, tag.Name)\n\t\t}\n\t}\n\n\timages := []string{}\n\tif m.Images != nil && !funcs.IsImgFallback(m.Blog.Url) {\n\t\tfor _, image := range m.Images {\n\t\t\timages = append(images, image.Src)\n\t\t}\n\t}\n\tif len(images) <= 0 {\n\t\timages = append(images, image.CachedRandomSrc(\"large\"))\n\t}\n\n\tidx := &EntryIndex{\n\t\tEntry: *m,\n\t\tTags: tags,\n\t\tImages: images,\n\t}\n\n\tif m.Blog != nil {\n\t\tidx.BlogName = m.Blog.Name\n\t\tidx.BlogMediatype = m.Blog.Mediatype\n\t\tidx.BlogAdsensetype = m.Blog.Adsensetype\n\t}\n\n\tif m.Video != nil {\n\t\tm.Video.LoadRelated()\n\n\t\tif m.Video.Divas != nil {\n\t\t\tfor _, diva := range m.Video.Divas {\n\t\t\t\tidx.VideoDivas = append(idx.VideoDivas, diva.Name)\n\t\t\t\tidx.VideoBracups = append(idx.VideoBracups, diva.Bracup)\n\t\t\t}\n\t\t}\n\n\t\tif m.Video.Site != nil {\n\t\t\tidx.VideoDomain = m.Video.Site.Domain\n\t\t}\n\n\t\tidx.VideoDuration = m.Video.Duration\n\t}\n\n\tif m.Picture != nil {\n\t\tm.Picture.LoadRelated()\n\n\t\tfor _, c := range m.Picture.Characters {\n\t\t\tidx.PictureCharacters = append(idx.PictureCharacters, c.Name)\n\t\t\tidx.PictureBracups = append(idx.PictureBracups, c.Bracup)\n\t\t}\n\n\t\tif m.Picture.Anime != nil {\n\t\t\tidx.PictureAnime = m.Picture.Anime.Name\n\t\t\tidx.PictureAlias = m.Picture.Anime.Alias\n\t\t\tidx.PictureAuthor = m.Picture.Anime.Author\n\t\t\tidx.PictureWorks = m.Picture.Anime.Works\n\t\t}\n\t}\n\n\tvar (\n\t\tn string\n\t\ts *Score\n\t)\n\n\tif m.Scores != nil {\n\t\tfor _, s = range m.Scores {\n\t\t\tn = fmt.Sprintf(\"%sScore\", strings.Title(s.Name))\n\t\t\tattr.SetField(idx, n, s.Count)\n\t\t}\n\t}\n\n\tif m.Blog != nil {\n\t\tif m.Blog.Scores != nil {\n\t\t\tfor _, s = range m.Blog.Scores {\n\t\t\t\tn = fmt.Sprintf(\"%sScore\", strings.Title(s.Name))\n\t\t\t\tattr.SetField(idx, n, s.Count)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn idx\n}", "func addAllFieldIndexes(ctx context.Context, indexer client.FieldIndexer) error {\n\tif err := indexer.IndexField(ctx, &gardencorev1beta1.Project{}, gardencore.ProjectNamespace, func(obj client.Object) []string {\n\t\tproject, ok := obj.(*gardencorev1beta1.Project)\n\t\tif !ok {\n\t\t\treturn []string{\"\"}\n\t\t}\n\t\tif project.Spec.Namespace == nil {\n\t\t\treturn []string{\"\"}\n\t\t}\n\t\treturn []string{*project.Spec.Namespace}\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"failed to add indexer to Project Informer: %w\", err)\n\t}\n\n\tif err := indexer.IndexField(ctx, &gardencorev1beta1.Shoot{}, gardencore.ShootSeedName, func(obj client.Object) []string {\n\t\tshoot, ok := obj.(*gardencorev1beta1.Shoot)\n\t\tif !ok {\n\t\t\treturn []string{\"\"}\n\t\t}\n\t\tif shoot.Spec.SeedName == nil {\n\t\t\treturn []string{\"\"}\n\t\t}\n\t\treturn []string{*shoot.Spec.SeedName}\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"failed to add indexer to Shoot Informer: %w\", err)\n\t}\n\n\tif err := indexer.IndexField(ctx, &seedmanagementv1alpha1.ManagedSeed{}, seedmanagement.ManagedSeedShootName, func(obj client.Object) []string {\n\t\tms, ok := obj.(*seedmanagementv1alpha1.ManagedSeed)\n\t\tif !ok {\n\t\t\treturn []string{\"\"}\n\t\t}\n\t\tif ms.Spec.Shoot == nil {\n\t\t\treturn []string{\"\"}\n\t\t}\n\t\treturn []string{ms.Spec.Shoot.Name}\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"failed to add indexer to ManagedSeed Informer: %w\", err)\n\t}\n\n\treturn nil\n}", "func GetIndexPkgs(page int) (pkgs []hv.PkgInfo) {\n\terr := x.Limit(100, (page-1)*100).Asc(\"rank\").Find(&pkgs)\n\tif err != nil {\n\t\tbeego.Error(\"models.GetIndexPkgs ->\", err)\n\t}\n\treturn pkgs\n}", "func (c *Checker) registerIdxPer(pkg string) {\n\tc.Packages[pkg] = append(c.Packages[pkg], len(c.Violations)-1)\n}", "func (c *Client) ItemTypeIndex() (*response.ItemTypeIndex, error) {\n\tvar data *d3.ItemTypeIndex\n\n\tep := endpointItemTypeIndex(c.region)\n\n\tq, err := c.get(ep, &data)\n\n\tif nil != err {\n\t\treturn nil, err\n\t}\n\n\treturn &response.ItemTypeIndex{\n\t\tData: data,\n\t\tEndpoint: ep,\n\t\tQuota: q,\n\t\tRegion: c.region,\n\t}, nil\n}", "func (d *Deployment) Scan(ctx context.Context, gvr, fqn string, wait bool) (Refs, error) {\n\tns, n := client.Namespaced(fqn)\n\too, err := d.GetFactory().List(d.GVR(), ns, wait, labels.Everything())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trefs := make(Refs, 0, len(oo))\n\tfor _, o := range oo {\n\t\tvar dp appsv1.Deployment\n\t\terr = runtime.DefaultUnstructuredConverter.FromUnstructured(o.(*unstructured.Unstructured).Object, &dp)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"expecting Deployment resource\")\n\t\t}\n\t\tswitch gvr {\n\t\tcase \"v1/configmaps\":\n\t\t\tif !hasConfigMap(&dp.Spec.Template.Spec, n) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\trefs = append(refs, Ref{\n\t\t\t\tGVR: d.GVR(),\n\t\t\t\tFQN: client.FQN(dp.Namespace, dp.Name),\n\t\t\t})\n\t\tcase \"v1/secrets\":\n\t\t\tfound, err := hasSecret(d.Factory, &dp.Spec.Template.Spec, dp.Namespace, n, wait)\n\t\t\tif err != nil {\n\t\t\t\tlog.Warn().Err(err).Msgf(\"scanning secret %q\", fqn)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\trefs = append(refs, Ref{\n\t\t\t\tGVR: d.GVR(),\n\t\t\t\tFQN: client.FQN(dp.Namespace, dp.Name),\n\t\t\t})\n\t\tcase \"v1/persistentvolumeclaims\":\n\t\t\tif !hasPVC(&dp.Spec.Template.Spec, n) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\trefs = append(refs, Ref{\n\t\t\t\tGVR: d.GVR(),\n\t\t\t\tFQN: client.FQN(dp.Namespace, dp.Name),\n\t\t\t})\n\t\tcase \"scheduling.k8s.io/v1/priorityclasses\":\n\t\t\tif !hasPC(&dp.Spec.Template.Spec, n) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\trefs = append(refs, Ref{\n\t\t\t\tGVR: d.GVR(),\n\t\t\t\tFQN: client.FQN(dp.Namespace, dp.Name),\n\t\t\t})\n\t\t}\n\n\t}\n\n\treturn refs, nil\n}", "func ApplicationIndex(w http.ResponseWriter, r *http.Request) {\n\tdb, err := database.Connect()\n\tdefer db.Close()\n\tif err != nil {\n\t\tlog.Printf(\"Database error: '%s'\\n\", err)\n\t\tjre := jsonutil.NewJSONResponseError(\n\t\t\thttp.StatusInternalServerError,\n\t\t\t\"there was an error when attempting to connect to the database\")\n\t\tjsonutil.RespondJSONError(w, jre)\n\t\treturn\n\t}\n\tapps, err := resources.AllApplications(db)\n\tif err != nil {\n\t\tlog.Printf(\"Error when retrieving applications: '%s'\\n\", err)\n\t\tjre := jsonutil.NewJSONResponseError(\n\t\t\thttp.StatusInternalServerError,\n\t\t\t\"there was an error when attempting to connect to the database\")\n\t\tjsonutil.RespondJSONError(w, jre)\n\t\treturn\n\t}\n\tfor i := range apps {\n\t\tif len(apps[i].Pods) == 0 {\n\t\t\tapps[i].Pods = make([]resources.Pod, 0)\n\t\t}\n\t\tif len(apps[i].Environments) == 0 {\n\t\t\tapps[i].Environments = make([]resources.Environment, 0)\n\t\t}\n\t}\n\tjson.NewEncoder(w).Encode(apps)\n}", "func loadIndex(data []byte) (*repo.IndexFile, error) {\n\ti := &repo.IndexFile{}\n\tif err := yaml.Unmarshal(data, i); err != nil {\n\t\treturn i, err\n\t}\n\n\ti.SortEntries()\n\tif i.APIVersion == \"\" {\n\t\treturn i, repo.ErrNoAPIVersion\n\t}\n\treturn i, nil\n}", "func loadIndex(r io.Reader) (*IndexFile, error) {\n\ti := &IndexFile{}\n\tif err := json.NewDecoder(r).Decode(i); err != nil {\n\t\treturn i, err\n\t}\n\ti.SortEntries()\n\treturn i, nil\n}", "func loadIndex(data []byte) (*repo.IndexFile, error) {\n\ti := &repo.IndexFile{}\n\tif err := yaml.Unmarshal(data, i); err != nil {\n\t\treturn i, err\n\t}\n\n\ti.SortEntries()\n\n\tif i.APIVersion == \"\" {\n\t\treturn i, repo.ErrNoAPIVersion\n\t}\n\n\treturn i, nil\n}", "func (c *Controller) ListResources(w http.ResponseWriter, r *http.Request) {\n\tresources := c.Dao.GetResources()\n\tlog.Println(resources)\n\n\tdata, _ := json.Marshal(resources)\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(data)\n\treturn\n}", "func loadIndex(data []byte) (*repo.IndexFile, error) {\n\ti := &repo.IndexFile{}\n\tif err := yaml.Unmarshal(data, i); err != nil {\n\t\tklog.Error(err, \"Unmarshal failed. Data: \", data)\n\t\treturn i, err\n\t}\n\n\ti.SortEntries()\n\n\tif i.APIVersion == \"\" {\n\t\treturn i, repo.ErrNoAPIVersion\n\t}\n\n\treturn i, nil\n}", "func ListEndpointGroupResults(r *http.Request, cfg config.Config) (int, http.Header, []byte, error) {\n\n\t//STANDARD DECLARATIONS START\n\tcode := http.StatusOK\n\th := http.Header{}\n\toutput := []byte(\"\")\n\terr := error(nil)\n\tcontentType := \"application/xml\"\n\tcharset := \"utf-8\"\n\t//STANDARD DECLARATIONS END\n\n\tcontentType, err = respond.ParseAcceptHeader(r)\n\th.Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\tif err != nil {\n\t\tcode = http.StatusNotAcceptable\n\t\toutput, _ = respond.MarshalContent(respond.NotAcceptableContentType, contentType, \"\", \" \")\n\t\treturn code, h, output, err\n\t}\n\n\t// Parse the request into the input\n\turlValues := r.URL.Query()\n\tvars := mux.Vars(r)\n\n\ttenantDbConfig, err := authentication.AuthenticateTenant(r.Header, cfg)\n\tif err != nil {\n\t\tif err.Error() == \"Unauthorized\" {\n\t\t\tcode = http.StatusUnauthorized\n\t\t\tout := respond.UnauthorizedMessage\n\t\t\toutput = out.MarshalTo(contentType)\n\t\t\treturn code, h, output, err\n\t\t}\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\tsession, err := mongo.OpenSession(tenantDbConfig)\n\tdefer mongo.CloseSession(session)\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\treport := reports.MongoInterface{}\n\terr = mongo.FindOne(session, tenantDbConfig.Db, \"reports\", bson.M{\"info.name\": vars[\"report_name\"]}, &report)\n\n\tif err != nil {\n\t\tcode = http.StatusBadRequest\n\t\tmessage := \"The report with the name \" + vars[\"report_name\"] + \" does not exist\"\n\t\toutput, err := createErrorMessage(message, contentType) //Render the response into XML or JSON\n\t\th.Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\t\treturn code, h, output, err\n\t}\n\n\tinput := endpointGroupResultQuery{\n\t\tbasicQuery{\n\t\t\tName: vars[\"lgroup_name\"],\n\t\t\tGranularity: urlValues.Get(\"granularity\"),\n\t\t\tFormat: contentType,\n\t\t\tStartTime: urlValues.Get(\"start_time\"),\n\t\t\tEndTime: urlValues.Get(\"end_time\"),\n\t\t\tReport: report,\n\t\t\tVars: vars,\n\t\t}, \"\",\n\t}\n\n\ttenantDB := session.DB(tenantDbConfig.Db)\n\terrs := input.Validate(tenantDB)\n\tif len(errs) > 0 {\n\t\tout := respond.BadRequestSimple\n\t\tout.Errors = errs\n\t\toutput = out.MarshalTo(contentType)\n\t\tcode = 400\n\t\treturn code, h, output, err\n\t}\n\n\tif vars[\"lgroup_type\"] != report.GetEndpointGroupType() {\n\t\tcode = http.StatusBadRequest\n\t\tmessage := \"The report \" + vars[\"report_name\"] + \" does not define endpoint group type: \" + vars[\"lgroup_type\"] + \". Try using \" + report.GetEndpointGroupType() + \" instead.\"\n\t\toutput, err := createErrorMessage(message, contentType) //Render the response into XML or JSON\n\t\th.Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\t\treturn code, h, output, err\n\t}\n\n\tresults := []EndpointGroupInterface{}\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\t// Construct the query to mongodb based on the input\n\tfilter := bson.M{\n\t\t\"date\": bson.M{\"$gte\": input.StartTimeInt, \"$lte\": input.EndTimeInt},\n\t\t\"report\": report.ID,\n\t}\n\n\tif input.Name != \"\" {\n\t\tfilter[\"name\"] = input.Name\n\t}\n\n\t// Select the granularity of the search daily/monthly\n\tif input.Granularity == \"daily\" {\n\t\tcustomForm[0] = \"20060102\"\n\t\tcustomForm[1] = \"2006-01-02\"\n\t\tquery := DailyEndpointGroup(filter)\n\t\terr = mongo.Pipe(session, tenantDbConfig.Db, \"endpoint_group_ar\", query, &results)\n\t} else if input.Granularity == \"monthly\" {\n\t\tcustomForm[0] = \"200601\"\n\t\tcustomForm[1] = \"2006-01\"\n\t\tquery := MonthlyEndpointGroup(filter)\n\t\terr = mongo.Pipe(session, tenantDbConfig.Db, \"endpoint_group_ar\", query, &results)\n\t}\n\n\t// mongo.Find(session, tenantDbConfig.Db, \"endpoint_group_ar\", bson.M{}, \"_id\", &results)\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\toutput, err = createEndpointGroupResultView(results, report, input.Format)\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\treturn code, h, output, err\n}", "func (*BulkIndexResponse) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_index_proto_rawDescGZIP(), []int{15}\n}" ]
[ "0.59473515", "0.5910294", "0.5895813", "0.5877585", "0.58192575", "0.5749591", "0.57174927", "0.5698926", "0.56244725", "0.5540453", "0.5508983", "0.54928124", "0.54442203", "0.5425963", "0.54177755", "0.53597957", "0.5350733", "0.53459483", "0.5278293", "0.5273926", "0.5261139", "0.52554137", "0.51712054", "0.51565874", "0.51518506", "0.5120092", "0.51103544", "0.5074563", "0.50634915", "0.5046172", "0.5038586", "0.5031231", "0.5029448", "0.5024264", "0.50147945", "0.5007662", "0.5005348", "0.50038105", "0.49910134", "0.4987291", "0.49823233", "0.49649528", "0.49636778", "0.49608055", "0.49551806", "0.4951384", "0.49468595", "0.4936837", "0.49364686", "0.4936058", "0.4932655", "0.49323234", "0.49250054", "0.4924357", "0.49242046", "0.4916827", "0.49165785", "0.49115825", "0.48935425", "0.48804677", "0.48755366", "0.48735952", "0.48502085", "0.48481622", "0.4845581", "0.48446596", "0.48368245", "0.48326224", "0.4831592", "0.4826705", "0.4821561", "0.48182786", "0.48156506", "0.48050603", "0.48029026", "0.47956264", "0.47951144", "0.47830245", "0.47827467", "0.47818053", "0.47815794", "0.47794363", "0.4779048", "0.47739217", "0.4773371", "0.47678214", "0.47620618", "0.47597635", "0.47574255", "0.4751009", "0.47492483", "0.47482526", "0.47458857", "0.4741442", "0.47408527", "0.47390735", "0.47371244", "0.4734788", "0.47268516", "0.47263882" ]
0.72815484
0
sort sorts the Resources in the index in display order and returns the ordered keys for the index Packages are sorted by package name Resources within a package are sorted by: [filename, namespace, name, kind, apiVersion]
sort сортирует Resources в индексе в порядке отображения и возвращает упорядоченные ключи для индекса. Пакеты сортируются по имени пакета. Resources внутри пакета сортируются по: [filename, namespace, name, kind, apiVersion]
func (p TreeWriter) sort(indexByPackage map[string][]*yaml.RNode) []string { var keys []string for k := range indexByPackage { pkgNodes := indexByPackage[k] sort.Slice(pkgNodes, func(i, j int) bool { return compareNodes(pkgNodes[i], pkgNodes[j]) }) keys = append(keys, k) } // return the package names sorted lexicographically sort.Strings(keys) return keys }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func sortResources(resources []astmodel.InternalTypeName) []astmodel.InternalTypeName {\n\tsort.Slice(resources, func(i, j int) bool {\n\t\tiVal := resources[i]\n\t\tjVal := resources[j]\n\n\t\treturn iVal.PackageReference().PackageName() < jVal.PackageReference().PackageName() ||\n\t\t\tiVal.PackageReference().PackageName() < jVal.PackageReference().PackageName() && iVal.Name() < jVal.Name()\n\t})\n\n\treturn resources\n}", "func (i IndexFile) sortPackages() {\n\tfor _, versions := range i.Entries {\n\t\tsort.Sort(sort.Reverse(versions))\n\t}\n}", "func SortResources(resources []*metav1.APIResourceList) {\n\tsort.SliceStable(resources, func(i, j int) bool {\n\t\tleft := resources[i]\n\t\tleftGV, _ := schema.ParseGroupVersion(left.GroupVersion)\n\t\t// not checking error because it should be impossible to fail to parse data coming from the\n\t\t// apiserver\n\t\tif leftGV.Group == \"extensions\" {\n\t\t\t// always sort extensions at the bottom by saying left is \"greater\"\n\t\t\treturn false\n\t\t}\n\n\t\tright := resources[j]\n\t\trightGV, _ := schema.ParseGroupVersion(right.GroupVersion)\n\t\t// not checking error because it should be impossible to fail to parse data coming from the\n\t\t// apiserver\n\t\tif rightGV.Group == \"extensions\" {\n\t\t\t// always sort extensions at the bottom by saying left is \"less\"\n\t\t\treturn true\n\t\t}\n\n\t\treturn i < j\n\t})\n}", "func orderStackResourceKeys(m map[string]StackResource) []string {\n\tret := make([]string, len(m))\n\ti := 0\n\n\tfor k := range m {\n\t\tret[i] = k\n\t\ti++\n\t}\n\tsort.Sort(sort.Reverse(sort.StringSlice(ret)))\n\treturn ret\n}", "func Sort(sortMetricName string, sortType string, rawMetrics *FormatedLevelMetric) (*FormatedLevelMetric, int) {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tglog.Errorln(err)\n\t\t\tdebug.PrintStack()\n\t\t}\n\t}()\n\n\tif sortMetricName == \"\" {\n\t\treturn rawMetrics, -1\n\t}\n\n\t// default sort type is descending order\n\tif sortType == \"\" {\n\t\tsortType = ResultSortTypeDesc\n\t}\n\n\tvar currentResourceMap = make(map[string]int)\n\n\t// {<Resource Name>: <Ordering>}\n\tvar indexMap = make(map[string]int)\n\ti := 0\n\n\t// each metricItem is the result for a specific metric name\n\t// so we find the metricItem with sortMetricName, and sort it\n\tfor _, metricItem := range rawMetrics.Results {\n\t\t// only vector type result can be sorted\n\t\tif metricItem.Data.ResultType == ResultTypeVector && metricItem.Status == MetricStatusSuccess {\n\t\t\tif metricItem.MetricName == sortMetricName {\n\t\t\t\tif sortType == ResultSortTypeAsc {\n\t\t\t\t\t// asc\n\t\t\t\t\tsort.Sort(FormatedMetricDataWrapper{metricItem.Data, func(p, q *map[string]interface{}) bool {\n\t\t\t\t\t\tvalue1 := (*p)[ResultItemValue].([]interface{})\n\t\t\t\t\t\tvalue2 := (*q)[ResultItemValue].([]interface{})\n\t\t\t\t\t\tv1, _ := strconv.ParseFloat(value1[len(value1)-1].(string), 64)\n\t\t\t\t\t\tv2, _ := strconv.ParseFloat(value2[len(value2)-1].(string), 64)\n\t\t\t\t\t\tif v1 == v2 {\n\t\t\t\t\t\t\tresourceName1 := (*p)[ResultItemMetric].(map[string]interface{})[ResultItemMetricResourceName]\n\t\t\t\t\t\t\tresourceName2 := (*q)[ResultItemMetric].(map[string]interface{})[ResultItemMetricResourceName]\n\t\t\t\t\t\t\treturn resourceName1.(string) < resourceName2.(string)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn v1 < v2\n\t\t\t\t\t}})\n\t\t\t\t} else {\n\t\t\t\t\t// desc\n\t\t\t\t\tsort.Sort(FormatedMetricDataWrapper{metricItem.Data, func(p, q *map[string]interface{}) bool {\n\t\t\t\t\t\tvalue1 := (*p)[ResultItemValue].([]interface{})\n\t\t\t\t\t\tvalue2 := (*q)[ResultItemValue].([]interface{})\n\t\t\t\t\t\tv1, _ := strconv.ParseFloat(value1[len(value1)-1].(string), 64)\n\t\t\t\t\t\tv2, _ := strconv.ParseFloat(value2[len(value2)-1].(string), 64)\n\n\t\t\t\t\t\tif v1 == v2 {\n\t\t\t\t\t\t\tresourceName1 := (*p)[ResultItemMetric].(map[string]interface{})[ResultItemMetricResourceName]\n\t\t\t\t\t\t\tresourceName2 := (*q)[ResultItemMetric].(map[string]interface{})[ResultItemMetricResourceName]\n\t\t\t\t\t\t\treturn resourceName1.(string) > resourceName2.(string)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn v1 > v2\n\t\t\t\t\t}})\n\t\t\t\t}\n\n\t\t\t\tfor _, r := range metricItem.Data.Result {\n\t\t\t\t\t// record the ordering of resource_name to indexMap\n\t\t\t\t\t// example: {\"metric\":{ResultItemMetricResourceName: \"Deployment:xxx\"},\"value\":[1541142931.731,\"3\"]}\n\t\t\t\t\tresourceName, exist := r[ResultItemMetric].(map[string]interface{})[ResultItemMetricResourceName]\n\t\t\t\t\tif exist {\n\t\t\t\t\t\tif _, exist := indexMap[resourceName.(string)]; !exist {\n\t\t\t\t\t\t\tindexMap[resourceName.(string)] = i\n\t\t\t\t\t\t\ti = i + 1\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\t// iterator all metric to find max metricItems length\n\t\t\tfor _, r := range metricItem.Data.Result {\n\t\t\t\tk, ok := r[ResultItemMetric].(map[string]interface{})[ResultItemMetricResourceName]\n\t\t\t\tif ok {\n\t\t\t\t\tcurrentResourceMap[k.(string)] = 1\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n\n\tvar keys []string\n\tfor k := range currentResourceMap {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\n\tfor _, resource := range keys {\n\t\tif _, exist := indexMap[resource]; !exist {\n\t\t\tindexMap[resource] = i\n\t\t\ti = i + 1\n\t\t}\n\t}\n\n\t// sort other metric\n\tfor i := 0; i < len(rawMetrics.Results); i++ {\n\t\tre := rawMetrics.Results[i]\n\t\tif re.Data.ResultType == ResultTypeVector && re.Status == MetricStatusSuccess {\n\t\t\tsortedMetric := make([]map[string]interface{}, len(indexMap))\n\t\t\tfor j := 0; j < len(re.Data.Result); j++ {\n\t\t\t\tr := re.Data.Result[j]\n\t\t\t\tk, exist := r[ResultItemMetric].(map[string]interface{})[ResultItemMetricResourceName]\n\t\t\t\tif exist {\n\t\t\t\t\tindex, exist := indexMap[k.(string)]\n\t\t\t\t\tif exist {\n\t\t\t\t\t\tsortedMetric[index] = r\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trawMetrics.Results[i].Data.Result = sortedMetric\n\t\t}\n\t}\n\n\treturn rawMetrics, len(indexMap)\n}", "func (d *Default) OrderResources(ctx context.Context, sp *spec.Spec, opts *DefaultOptions) error {\n\tsort.Slice(sp.Paths, func(i, j int) bool {\n\t\tp1, p2 := sp.Paths[i], sp.Paths[j]\n\n\t\treturn p1.Name < p2.Name\n\t})\n\n\tfor _, p := range sp.Paths {\n\t\tsort.Slice(p.Operations, func(i, j int) bool {\n\t\t\to1, o2 := p.Operations[i], p.Operations[j]\n\n\t\t\treturn o1.Name < o2.Name\n\t\t})\n\n\t\tfor _, o := range p.Operations {\n\t\t\tsort.Slice(o.Parameters, func(i, j int) bool {\n\t\t\t\tp1, p2 := o.Parameters[i], o.Parameters[j]\n\n\t\t\t\treturn p1.Name < p2.Name\n\t\t\t})\n\n\t\t\tsort.Slice(o.Responses, func(i, j int) bool {\n\t\t\t\tr1, r2 := o.Responses[i], o.Responses[j]\n\n\t\t\t\treturn r1.Name < r2.Name\n\t\t\t})\n\n\t\t\tfor _, cb := range o.Callbacks {\n\t\t\t\tfor _, cbPath := range cb {\n\t\t\t\t\tsort.Slice(cb, func(i, j int) bool {\n\t\t\t\t\t\tp1, p2 := cb[i], cb[j]\n\n\t\t\t\t\t\treturn p1.Name < p2.Name\n\t\t\t\t\t})\n\n\t\t\t\t\tfor _, cbOp := range cbPath.Operations {\n\t\t\t\t\t\tsort.Slice(cbOp.Parameters, func(i, j int) bool {\n\t\t\t\t\t\t\tp1, p2 := cbOp.Parameters[i], cbOp.Parameters[j]\n\n\t\t\t\t\t\t\treturn p1.Name < p2.Name\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\tsort.Slice(cbOp.Responses, func(i, j int) bool {\n\t\t\t\t\t\t\tr1, r2 := cbOp.Responses[i], cbOp.Responses[j]\n\n\t\t\t\t\t\t\treturn r1.Name < r2.Name\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn nil\n}", "func orderStackCRDKeys(m map[string]apiextensions.CustomResourceDefinition) []string {\n\tret := make([]string, len(m))\n\ti := 0\n\n\tfor k := range m {\n\t\tret[i] = k\n\t\ti++\n\t}\n\tsort.Sort(sort.Reverse(sort.StringSlice(ret)))\n\treturn ret\n}", "func sortByKind(manifests []releaseutil.Manifest) []releaseutil.Manifest {\n\tordering := kuberesource.InstallOrder\n\tks := newKindSorter(manifests, ordering)\n\tsort.Sort(ks)\n\treturn ks.manifests\n}", "func SortByKind(manifests []*resource.Resource, ordering SortOrder) []*resource.Resource {\n\tks := newKindSorter(manifests, ordering)\n\tsort.Sort(ks)\n\treturn ks.resources\n}", "func SortResourcesByType(resources []Resource) {\n\tsort.Sort(resourcesSortedByType(resources))\n}", "func sortedMapKeysbyName(m *jsonschema.Index) []string {\n\tvar schemas []*jsonschema.Schema\n\tfor _, v := range *m {\n\t\tschemas = append(schemas, v)\n\t}\n\tsort.Sort(byName(schemas))\n\n\tvar keys []string\n\tfor _, v := range schemas {\n\t\tkeys = append(keys, v.Pointer)\n\t}\n\treturn keys\n}", "func orderStackIconKeys(m map[string]*v1alpha1.IconSpec) []string {\n\tret := make([]string, len(m))\n\ti := 0\n\n\tfor k := range m {\n\t\tret[i] = k\n\t\ti++\n\t}\n\tsort.Sort(sort.Reverse(sort.StringSlice(ret)))\n\treturn ret\n}", "func normalizeAPIGroupResources(apiGroupResource *restmapper.APIGroupResources) []metav1.APIResource {\n\tvar versionedResources []metav1.APIResource\n\tfor version, vr := range apiGroupResource.VersionedResources {\n\t\tfor _, resource := range vr {\n\t\t\tresource.Group = apiGroupResource.Group.Name\n\t\t\tresource.Version = version\n\t\t\tversionedResources = append(versionedResources, resource)\n\t\t}\n\t}\n\n\t// Ensure deterministic output.\n\tpreferredVersion := apiGroupResource.Group.PreferredVersion.Version\n\tsort.SliceStable(versionedResources, func(i, j int) bool {\n\t\tif versionedResources[i].Version == versionedResources[j].Version {\n\t\t\treturn versionedResources[i].Name < versionedResources[j].Name\n\t\t}\n\n\t\t// preferred version\n\t\tif versionedResources[i].Version == preferredVersion {\n\t\t\treturn true\n\t\t}\n\t\tif versionedResources[j].Version == preferredVersion {\n\t\t\treturn false\n\t\t}\n\n\t\t// compare kube-like version\n\t\t// Versions will be sorted based on GA/alpha/beta first and then major and minor versions.\n\t\t// e.g. v2, v1, v1beta2, v1beta1, v1alpha1.\n\t\treturn version.CompareKubeAwareVersionStrings(versionedResources[i].Version, versionedResources[j].Version) > 0\n\t})\n\n\t// pick out preferred version or highest semantic version\n\tregistered := make(map[string]bool)\n\tvar normalizedVersionResources []metav1.APIResource\n\tfor _, vr := range versionedResources {\n\t\tif registered[vr.Name] {\n\t\t\tcontinue\n\t\t}\n\t\tnormalizedVersionResources = append(normalizedVersionResources, vr)\n\t\tregistered[vr.Name] = true\n\t}\n\treturn normalizedVersionResources\n}", "func (v ResourceNodes) Sort() {\n\tsort.Sort(v)\n}", "func (tf tFiles) sortByKey(icmp *iComparer) {\n\tsort.Sort(&tFilesSortByKey{tFiles: tf, icmp: icmp})\n}", "func (p TreeWriter) index(nodes []*yaml.RNode) map[string][]*yaml.RNode {\n\t// index the ResourceNodes by package\n\tindexByPackage := map[string][]*yaml.RNode{}\n\tfor i := range nodes {\n\t\tmeta, err := nodes[i].GetMeta()\n\t\tif err != nil || meta.Kind == \"\" {\n\t\t\t// not a resource\n\t\t\tcontinue\n\t\t}\n\t\tpkg := filepath.Dir(meta.Annotations[kioutil.PathAnnotation])\n\t\tindexByPackage[pkg] = append(indexByPackage[pkg], nodes[i])\n\t}\n\treturn indexByPackage\n}", "func (ri RecipeIndex) sortedSlice() []Recipe {\n\tvar rs []Recipe\n\tfor _, v := range ri {\n\t\trs = append(rs, v)\n\t}\n\tsort.Slice(rs, func(i, j int) bool {\n\t\treturn len(rs[i].Installers) < len(rs[j].Installers)\n\t})\n\treturn rs\n}", "func (i IndexFile) SortEntries() {\n\tfor _, versions := range i.Entries {\n\t\tsort.Sort(sort.Reverse(versions))\n\t}\n}", "func sortedMapKeys(m *jsonschema.Index) []string {\n\tvar keys []string\n\tfor k, _ := range *m {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\treturn keys\n}", "func sortLayer(layer []task.Task, idToDisplayName map[string]string) []task.Task {\n\tsortKeys := make([]string, 0, len(layer))\n\tsortKeyToTask := make(map[string]task.Task)\n\tfor _, t := range layer {\n\t\t// Construct a key to sort by, consisting of all dependency names, sorted alphabetically,\n\t\t// followed by the task name\n\t\tsortKeyWords := make([]string, 0, len(t.DependsOn)+1)\n\t\tfor _, dep := range t.DependsOn {\n\t\t\tdepName, ok := idToDisplayName[dep.TaskId]\n\t\t\t// Cross-variant dependencies will not be included in idToDisplayName\n\t\t\tif !ok {\n\t\t\t\tdepName = dep.TaskId\n\t\t\t}\n\t\t\tsortKeyWords = append(sortKeyWords, depName)\n\t\t}\n\t\tsort.Strings(sortKeyWords)\n\t\tsortKeyWords = append(sortKeyWords, t.DisplayName)\n\t\tsortKey := strings.Join(sortKeyWords, \" \")\n\t\tsortKeys = append(sortKeys, sortKey)\n\t\tsortKeyToTask[sortKey] = t\n\t}\n\tsort.Strings(sortKeys)\n\tsortedLayer := make([]task.Task, 0, len(layer))\n\tfor _, sortKey := range sortKeys {\n\t\tsortedLayer = append(sortedLayer, sortKeyToTask[sortKey])\n\t}\n\treturn sortedLayer\n}", "func getSortedKeys(modules map[string]*TerraformModule) []string {\n\tkeys := []string{}\n\tfor key := range modules {\n\t\tkeys = append(keys, key)\n\t}\n\n\tsort.Strings(keys)\n\n\treturn keys\n}", "func TestResourceListSorting(t *testing.T) {\n\tsortedResourceList := make([]string, len(resourceList))\n\tcopy(sortedResourceList, resourceList)\n\tsort.Strings(sortedResourceList)\n\tfor i := 0; i < len(resourceList); i++ {\n\t\tif resourceList[i] != sortedResourceList[i] {\n\t\t\tt.Errorf(\"Expected resourceList[%d] = \\\"%s\\\", resourceList is not correctly sorted.\", i, sortedResourceList[i])\n\t\t\tbreak\n\t\t}\n\t}\n}", "func (s SecretVersions) Sort() {\n\tsort.Sort(s)\n}", "func getResources(client *ApiClient) (map[schema.GroupVersion][]metav1.APIResource, error) {\n\n\tresourceLists, err := client.ClientSet.Discovery().ServerPreferredResources()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tversionResource := map[schema.GroupVersion][]metav1.APIResource{}\n\n\tfor _, apiResourceList := range resourceLists {\n\t\tversion, err := schema.ParseGroupVersion(apiResourceList.GroupVersion)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to parse GroupVersion %v\",err)\n\t\t}\n\n\t\tversionResource[version] = uniqResources(apiResourceList.APIResources)\n\t}\n\n\treturn versionResource, nil\n}", "func (p FileInfos) Sort() { sort.Sort(p) }", "func (p *PackageList) Sort(criteria string) {\n\tswitch criteria {\n\tcase \"alpha\":\n\t\talphaSort(p)\n\tcase \"score\":\n\t\tscoreSort(p)\n\tcase \"stars\":\n\t\tstarSort(p)\n\tcase \"imports\":\n\t\timportSort(p)\n\t}\n}", "func sortIngressByCreationTime(ingr []*knetworking.Ingress) []*knetworking.Ingress {\n\tsort.Slice(ingr, func(i, j int) bool {\n\t\t// If creation time is the same, then behavior is nondeterministic. In this case, we can\n\t\t// pick an arbitrary but consistent ordering based on name and namespace, which is unique.\n\t\t// CreationTimestamp is stored in seconds, so this is not uncommon.\n\t\tif ingr[i].CreationTimestamp == ingr[j].CreationTimestamp {\n\t\t\tin := ingr[i].Name + \".\" + ingr[i].Namespace\n\t\t\tjn := ingr[j].Name + \".\" + ingr[j].Namespace\n\t\t\treturn in < jn\n\t\t}\n\t\treturn ingr[i].CreationTimestamp.Before(&ingr[j].CreationTimestamp)\n\t})\n\treturn ingr\n}", "func getPackageRefs(resources []astmodel.InternalTypeName) []astmodel.PackageReference {\n\tpackageRefs := make([]astmodel.PackageReference, 0, len(resources)+1)\n\t// Package reference for return type\n\tpackageRefs = append(packageRefs, astmodel.KubernetesResourceType.PackageReference())\n\n\tfor _, typeDef := range resources {\n\t\tpackageRefs = append(packageRefs, typeDef.PackageReference())\n\t}\n\n\treturn packageRefs\n}", "func sortDescription(v interface{}) {\n\tslice := reflect.ValueOf(v)\n\tvalues := toValueSlice(slice)\n\tsort.Slice(values, func(i, j int) bool {\n\t\tnameI := values[i].FieldByName(\"Name\").String()\n\t\tnameJ := values[j].FieldByName(\"Name\").String()\n\t\tif nameI == nameJ {\n\t\t\tkindI := values[i].FieldByName(\"Kind\").String()\n\t\t\tkindJ := values[j].FieldByName(\"Kind\").String()\n\t\t\tif kindI == kindJ {\n\t\t\t\tversionI := values[i].FieldByName(\"Version\").String()\n\t\t\t\tversionJ := values[j].FieldByName(\"Version\").String()\n\t\t\t\treturn version.CompareKubeAwareVersionStrings(versionI, versionJ) > 0\n\t\t\t}\n\t\t\treturn kindI < kindJ\n\t\t}\n\t\treturn nameI < nameJ\n\t})\n\tfor i := 0; i < slice.Len(); i++ {\n\t\tslice.Index(i).Set(values[i])\n\t}\n}", "func sortNodesByUsage(nodes []NodeUsage) {\n\tsort.Slice(nodes, func(i, j int) bool {\n\t\tti := nodes[i].usage[v1.ResourceMemory].Value() + nodes[i].usage[v1.ResourceCPU].MilliValue() + nodes[i].usage[v1.ResourcePods].Value()\n\t\ttj := nodes[j].usage[v1.ResourceMemory].Value() + nodes[j].usage[v1.ResourceCPU].MilliValue() + nodes[j].usage[v1.ResourcePods].Value()\n\n\t\t// extended resources\n\t\tfor name := range nodes[i].usage {\n\t\t\tif !isBasicResource(name) {\n\t\t\t\tti = ti + nodes[i].usage[name].Value()\n\t\t\t\ttj = tj + nodes[j].usage[name].Value()\n\t\t\t}\n\t\t}\n\n\t\t// To return sorted in descending order\n\t\treturn ti > tj\n\t})\n}", "func sortConfig(provider objsort.Namespaced) objsort.Config {\n\treturn objsort.Config{\n\t\tNamespacedIndicator: func(gvk schema.GroupVersionKind) (bool, error) {\n\t\t\tret, err := provider(gvk)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\treturn ret, nil\n\t\t},\n\t\tOrderingProvider: ordering,\n\t}\n}", "func fetchGroupVersionResources(d discovery.DiscoveryInterface, apiGroups []*metav1.APIGroup) (map[schema.GroupVersion]*metav1.APIResourceList, map[schema.GroupVersion]error) {\n\tgroupVersionResources := make(map[schema.GroupVersion]*metav1.APIResourceList)\n\tfailedGroups := make(map[schema.GroupVersion]error)\n\n\twg := &sync.WaitGroup{}\n\tresultLock := &sync.Mutex{}\n\tfor _, apiGroup := range apiGroups {\n\t\tfor _, version := range apiGroup.Versions {\n\t\t\tgroupVersion := schema.GroupVersion{Group: apiGroup.Name, Version: version.Version}\n\t\t\twg.Add(1)\n\t\t\tgo func() {\n\t\t\t\tdefer wg.Done()\n\t\t\t\tdefer utilruntime.HandleCrash()\n\n\t\t\t\tapiResourceList, err := d.ServerResourcesForGroupVersion(groupVersion.String())\n\n\t\t\t\t// lock to record results\n\t\t\t\tresultLock.Lock()\n\t\t\t\tdefer resultLock.Unlock()\n\n\t\t\t\tif err != nil {\n\t\t\t\t\t// TODO: maybe restrict this to NotFound errors\n\t\t\t\t\tfailedGroups[groupVersion] = err\n\t\t\t\t}\n\t\t\t\tif apiResourceList != nil {\n\t\t\t\t\t// even in case of error, some fallback might have been returned\n\t\t\t\t\tgroupVersionResources[groupVersion] = apiResourceList\n\t\t\t\t}\n\t\t\t}()\n\t\t}\n\t}\n\twg.Wait()\n\n\treturn groupVersionResources, failedGroups\n}", "func getAllAPIVersions(apiResourceLists []*metav1.APIResourceList) map[string]apiVersions {\n\ttempKindToAPIVersions := make(map[string]apiVersions)\n\n\tfor _, apiResourceList := range apiResourceLists {\n\t\tlastKind := \"\"\n\t\tfor _, apiResource := range apiResourceList.APIResources {\n\t\t\tif apiResource.Kind == lastKind {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tversion, ok := tempKindToAPIVersions[apiResource.Kind]\n\t\t\tif !ok {\n\t\t\t\ttempKindToAPIVersions[apiResource.Kind] = apiVersions{}\n\t\t\t}\n\n\t\t\tgvk := strings.Join([]string{apiResourceList.GroupVersion, apiResource.Kind}, \"/\")\n\t\t\tversion.gvks = append(version.gvks, gvk)\n\t\t\ttempKindToAPIVersions[apiResource.Kind] = version\n\t\t\tlastKind = apiResource.Kind\n\t\t}\n\t}\n\n\treturn tempKindToAPIVersions\n}", "func Sort(sortKeys []string, reverseList []bool, data []Record) {\n\tsplitSortKeys := make([][]string, len(sortKeys))\n\tfor i, sortKey := range sortKeys {\n\t\tsplitSortKeys[i] = strings.Split(sortKey, \".\")\n\t}\n\n\tless := func(i, j int) (l bool) {\n\t\tvar reverse bool\n\t\tdefer func() {\n\t\t\tif reverse {\n\t\t\t\tl = !l\n\t\t\t}\n\t\t}()\n\tSORTKEYLOOP:\n\t\tfor sortKeyIdx, keyParts := range splitSortKeys {\n\t\t\treverse = reverseList[sortKeyIdx]\n\t\t\t// TODO: record could (and should) point at the CollectionFields which will tell us types\n\t\t\tiVal, iok := data[i].Get(keyParts)\n\t\t\tjVal, jok := data[j].Get(keyParts)\n\t\t\tif !iok || !jok {\n\t\t\t\t// if both don't have this field, continue on\n\t\t\t\tif iok == jok {\n\t\t\t\t\tcontinue SORTKEYLOOP\n\t\t\t\t}\n\t\t\t\tl = iok\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif iVal == nil || jVal == nil {\n\t\t\t\t// if both are nil, continue on\n\t\t\t\tif iVal == jVal {\n\t\t\t\t\tcontinue SORTKEYLOOP\n\t\t\t\t}\n\t\t\t\tl = iVal != nil\n\t\t\t\treturn\n\t\t\t}\n\t\t\tswitch iValTyped := iVal.(type) {\n\t\t\tcase string:\n\t\t\t\tjValTyped := jVal.(string)\n\t\t\t\tif iValTyped != jValTyped {\n\t\t\t\t\tl = iValTyped < jValTyped\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\tcase int:\n\t\t\t\tjValTyped := jVal.(int)\n\t\t\t\tif iValTyped != jValTyped {\n\t\t\t\t\tl = iValTyped < jValTyped\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\tcase int64:\n\t\t\t\tjValTyped := jVal.(int64)\n\t\t\t\tif iValTyped != jValTyped {\n\t\t\t\t\tl = iValTyped < jValTyped\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\tcase float64:\n\t\t\t\tjValTyped := jVal.(float64)\n\t\t\t\tif iValTyped != jValTyped {\n\t\t\t\t\tl = iValTyped < jValTyped\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\tcase bool:\n\t\t\t\tjValTyped := jVal.(bool)\n\t\t\t\tif iValTyped != jValTyped {\n\t\t\t\t\tl = !iValTyped && jValTyped\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t// TODO: return error? At this point if all return false, I'm not sure what happens\n\t\t\tdefault:\n\t\t\t\tpanic(\"Unknown type\")\n\t\t\t\tl = false\n\t\t\t\treturn\n\n\t\t\t}\n\t\t}\n\t\tl = false\n\t\treturn\n\t}\n\tsort.Slice(data, less)\n}", "func (p *provider) GetResources(_ context.Context) (map[string]tfsdk.ResourceType, diag.Diagnostics) {\n\treturn map[string]tfsdk.ResourceType{\n\t\t\"hashicups_order\": resourceOrderType{},\n\t}, nil\n}", "func TopologicalSort(bundle *smith.Bundle) (*SortedData, error) {\n\tgraph := newGraph(len(bundle.Spec.Resources))\n\n\tfor _, res := range bundle.Spec.Resources {\n\t\tgraph.addVertex(res.Name)\n\t}\n\n\tfor _, res := range bundle.Spec.Resources {\n\t\tfor _, d := range res.DependsOn {\n\t\t\tgraph.addEdge(res.Name, d)\n\t\t}\n\t}\n\n\tsorted, err := graph.topologicalSort()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgraphData := SortedData{\n\t\tGraph: graph,\n\t\tSortedVertices: sorted,\n\t}\n\n\tlog.Printf(\"Sorted graph: %v\", sorted)\n\n\treturn &graphData, nil\n}", "func SortTags(tags []v1alpha1.Tag, ecrTags []ecr.Tag) {\n\tsort.Slice(tags, func(i, j int) bool {\n\t\treturn tags[i].Key < tags[j].Key\n\t})\n\n\tsort.Slice(ecrTags, func(i, j int) bool {\n\t\treturn *ecrTags[i].Key < *ecrTags[j].Key\n\t})\n}", "func sortKeys(v []reflect.Value) []reflect.Value {\n\tif len(v) <= 1 {\n\t\treturn v\n\t}\n\tswitch v[0].Kind() {\n\tcase reflect.Float32, reflect.Float64:\n\t\tsort.Sort(rvFloats{v})\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\tsort.Sort(rvInts{v})\n\tcase reflect.String:\n\t\tsort.Sort(rvStrings{v})\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\tsort.Sort(rvUints{v})\n\t}\n\treturn v\n}", "func revisionListSortFunc(revisionList *servingv1.RevisionList) func(i int, j int) bool {\n\treturn func(i, j int) bool {\n\t\ta := revisionList.Items[i]\n\t\tb := revisionList.Items[j]\n\n\t\t// By Namespace\n\t\taNamespace := a.Namespace\n\t\tbNamespace := b.Namespace\n\t\tif aNamespace != bNamespace {\n\t\t\treturn aNamespace < bNamespace\n\t\t}\n\n\t\t// By Service\n\t\taService := a.Labels[serving.ServiceLabelKey]\n\t\tbService := b.Labels[serving.ServiceLabelKey]\n\n\t\tif aService != bService {\n\t\t\treturn aService < bService\n\t\t}\n\n\t\t// By Generation\n\t\t// Convert configuration generation key from string to int for avoiding string comparison.\n\t\tagen, err := strconv.Atoi(a.Labels[serving.ConfigurationGenerationLabelKey])\n\t\tif err != nil {\n\t\t\treturn a.Name < b.Name\n\t\t}\n\t\tbgen, err := strconv.Atoi(b.Labels[serving.ConfigurationGenerationLabelKey])\n\t\tif err != nil {\n\t\t\treturn a.Name < b.Name\n\t\t}\n\n\t\tif agen != bgen {\n\t\t\treturn agen > bgen\n\t\t}\n\t\treturn a.Name < b.Name\n\t}\n}", "func (uq *UploadQueue) sort() {\n\tsort.Slice(uq.Files, func(i, j int) bool {\n\t\treturn len(uq.Files[i].Data[0]) > len(uq.Files[j].Data[0])\n\t})\n}", "func listResources(clt resourcesAPIGetter, r *http.Request, resourceKind string) (*types.ListResourcesResponse, error) {\n\tvalues := r.URL.Query()\n\n\tlimit, err := queryLimitAsInt32(values, \"limit\", defaults.MaxIterationLimit)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\t// Sort is expected in format `<fieldName>:<asc|desc>` where\n\t// index 0 is fieldName and index 1 is direction.\n\t// If a direction is not set, or is not recognized, it defaults to ASC.\n\tvar sortBy types.SortBy\n\tsortParam := values.Get(\"sort\")\n\tif sortParam != \"\" {\n\t\tvals := strings.Split(sortParam, \":\")\n\t\tif vals[0] != \"\" {\n\t\t\tsortBy.Field = vals[0]\n\t\t\tif len(vals) > 1 && vals[1] == \"desc\" {\n\t\t\t\tsortBy.IsDesc = true\n\t\t\t}\n\t\t}\n\t}\n\n\tstartKey := values.Get(\"startKey\")\n\treq := proto.ListResourcesRequest{\n\t\tResourceType: resourceKind,\n\t\tLimit: limit,\n\t\tStartKey: startKey,\n\t\tSortBy: sortBy,\n\t\tPredicateExpression: values.Get(\"query\"),\n\t\tSearchKeywords: client.ParseSearchKeywords(values.Get(\"search\"), ' '),\n\t\tUseSearchAsRoles: values.Get(\"searchAsRoles\") == \"yes\",\n\t}\n\n\treturn clt.ListResources(r.Context(), req)\n}", "func (w *exportWriter) writeIndex(index map[types.Object]uint64) {\n\ttype pkgObj struct {\n\t\tobj types.Object\n\t\tname string // qualified name; differs from obj.Name for type params\n\t}\n\t// Build a map from packages to objects from that package.\n\tpkgObjs := map[*types.Package][]pkgObj{}\n\n\t// For the main index, make sure to include every package that\n\t// we reference, even if we're not exporting (or reexporting)\n\t// any symbols from it.\n\tif w.p.localpkg != nil {\n\t\tpkgObjs[w.p.localpkg] = nil\n\t}\n\tfor pkg := range w.p.allPkgs {\n\t\tpkgObjs[pkg] = nil\n\t}\n\n\tfor obj := range index {\n\t\tname := w.p.exportName(obj)\n\t\tpkgObjs[obj.Pkg()] = append(pkgObjs[obj.Pkg()], pkgObj{obj, name})\n\t}\n\n\tvar pkgs []*types.Package\n\tfor pkg, objs := range pkgObjs {\n\t\tpkgs = append(pkgs, pkg)\n\n\t\tsort.Slice(objs, func(i, j int) bool {\n\t\t\treturn objs[i].name < objs[j].name\n\t\t})\n\t}\n\n\tsort.Slice(pkgs, func(i, j int) bool {\n\t\treturn w.exportPath(pkgs[i]) < w.exportPath(pkgs[j])\n\t})\n\n\tw.uint64(uint64(len(pkgs)))\n\tfor _, pkg := range pkgs {\n\t\tw.string(w.exportPath(pkg))\n\t\tw.string(pkg.Name())\n\t\tw.uint64(uint64(0)) // package height is not needed for go/types\n\n\t\tobjs := pkgObjs[pkg]\n\t\tw.uint64(uint64(len(objs)))\n\t\tfor _, obj := range objs {\n\t\t\tw.string(obj.name)\n\t\t\tw.uint64(index[obj.obj])\n\t\t}\n\t}\n}", "func (responses Responses) SortByReleaseName() {\n\tsort.Slice(responses, func(i, j int) bool {\n\t\treturn responses[i].ReleaseName < responses[j].ReleaseName\n\t})\n}", "func sortGroups(ctx context.Context, log logrus.FieldLogger, client gcs.Stater, configPath gcs.Path, gridPrefix string, groups []*configpb.TestGroup) (map[string]int64, error) {\n\tgroupedPaths := make(map[gcs.Path]*configpb.TestGroup, len(groups))\n\tpaths := make([]gcs.Path, 0, len(groups))\n\tfor _, tg := range groups {\n\t\ttgp, err := testGroupPath(configPath, gridPrefix, tg.Name)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%s bad group path: %w\", tg.Name, err)\n\t\t}\n\t\tgroupedPaths[*tgp] = tg\n\t\tpaths = append(paths, *tgp)\n\t}\n\n\tgenerationPaths := gcs.LeastRecentlyUpdated(ctx, log, client, paths)\n\tgenerations := make(map[string]int64, len(generationPaths))\n\tfor i, p := range paths {\n\t\ttg := groupedPaths[p]\n\t\tgroups[i] = tg\n\t\tgenerations[tg.Name] = generationPaths[p]\n\t}\n\n\treturn generations, nil\n}", "func sortAlert() {\n\n\tswitch strings.ToLower(sortLabel) {\n\tcase \"severity\":\n\t\tsort.Sort(severitySorter(allAlertData))\n\tcase \"starts\":\n\t\tsort.Sort(startAtSorter(allAlertData))\n\tcase \"ends\":\n\t\tsort.Sort(endsAtSorter(allAlertData))\n\tcase \"duration\":\n\t\tsort.Sort(durationSorter(allAlertData))\n\tdefault:\n\t\treturn\n\t}\n}", "func sortDescriptors(v interface{}) {\n\tslice := reflect.ValueOf(v)\n\tvalues := toValueSlice(slice)\n\tsort.Slice(values, func(i, j int) bool {\n\t\treturn values[i].FieldByName(\"Path\").String() < values[j].FieldByName(\"Path\").String()\n\t})\n\tfor i := 0; i < slice.Len(); i++ {\n\t\tslice.Index(i).Set(values[i])\n\t}\n}", "func sortVersions(slice []string) []string {\n\tsort.Sort(VersionSlice(slice))\n\treturn slice\n}", "func (a KubectlLayerApplier) GetResources(ctx context.Context, layer layers.Layer) (resources []kraanv1alpha1.Resource, err error) {\n\tlogging.TraceCall(a.getLog(layer))\n\tdefer logging.TraceExit(a.getLog(layer))\n\n\tsourceHrs, clusterHrs, err := a.GetSourceAndClusterHelmReleases(ctx, layer)\n\tif err != nil {\n\t\treturn nil, errors.WithMessagef(err, \"%s - failed to get helm releases\", logging.CallerStr(logging.Me))\n\t}\n\n\tfor key, source := range sourceHrs {\n\t\tresource := kraanv1alpha1.Resource{\n\t\t\tNamespace: source.GetNamespace(),\n\t\t\tName: source.GetName(),\n\t\t\tKind: \"helmreleases.helm.toolkit.fluxcd.io\",\n\t\t\tLastTransitionTime: metav1.Now(),\n\t\t\tStatus: \"Unknown\",\n\t\t}\n\t\thr, ok := clusterHrs[key]\n\t\tif ok {\n\t\t\ta.logDebug(\"HelmRelease in AddonsLayer source directory and on cluster\", layer, logging.GetObjKindNamespaceName(source)...)\n\t\t\tresources = append(resources, a.getResourceInfo(layer, resource, hr.Status.Conditions))\n\t\t} else {\n\t\t\t// this resource exists in the source directory but not on the cluster\n\t\t\ta.logDebug(\"HelmRelease in AddonsLayer source directory but not on cluster\", layer, logging.GetObjKindNamespaceName(source)...)\n\t\t\tresource.Status = kraanv1alpha1.NotDeployed\n\t\t\tresources = append(resources, resource)\n\t\t}\n\t}\n\n\tfor key, hr := range clusterHrs {\n\t\tresource := kraanv1alpha1.Resource{\n\t\t\tNamespace: hr.GetNamespace(),\n\t\t\tName: hr.GetName(),\n\t\t\tKind: \"helmreleases.helm.toolkit.fluxcd.io\",\n\t\t\tLastTransitionTime: metav1.Now(),\n\t\t\tStatus: \"Unknown\",\n\t\t}\n\t\t_, ok := sourceHrs[key]\n\t\tif !ok {\n\t\t\ta.logDebug(\"HelmRelease not in AddonsLayer source directory but on cluster\", layer, \"name\", clusterHrs[key])\n\t\t\tresources = append(resources, a.getResourceInfo(layer, resource, hr.Status.Conditions))\n\t\t}\n\t}\n\treturn resources, err\n}", "func ActionApiResources() carapace.Action {\n\treturn carapace.ActionCallback(func(c carapace.Context) carapace.Action {\n\t\treturn carapace.ActionExecCommand(\"kubectl\", \"api-resources\", \"--output=name\", \"--cached\")(func(output []byte) carapace.Action {\n\t\t\tlines := strings.Split(string(output), \"\\n\")\n\t\t\tfor index, line := range lines {\n\t\t\t\tlines[index] = strings.SplitN(line, \".\", 2)[0]\n\t\t\t}\n\t\t\treturn carapace.ActionValues(lines[:len(lines)-1]...)\n\t\t})\n\t})\n}", "func sortProjects(projects []*projectInfo) {\n\tsort.Sort(ByName{projects})\n}", "func (m *mapper) fetchGroupVersionResources(groupName string, versions ...string) (map[schema.GroupVersion]*metav1.APIResourceList, error) {\n\tgroupVersionResources := make(map[schema.GroupVersion]*metav1.APIResourceList)\n\tfailedGroups := make(map[schema.GroupVersion]error)\n\n\tfor _, version := range versions {\n\t\tgroupVersion := schema.GroupVersion{Group: groupName, Version: version}\n\n\t\tapiResourceList, err := m.client.ServerResourcesForGroupVersion(groupVersion.String())\n\t\tif err != nil {\n\t\t\tfailedGroups[groupVersion] = err\n\t\t}\n\t\tif apiResourceList != nil {\n\t\t\t// even in case of error, some fallback might have been returned.\n\t\t\tgroupVersionResources[groupVersion] = apiResourceList\n\t\t}\n\t}\n\n\tif len(failedGroups) > 0 {\n\t\treturn nil, &discovery.ErrGroupDiscoveryFailed{Groups: failedGroups}\n\t}\n\n\treturn groupVersionResources, nil\n}", "func sortModules(modules []models.Module) []models.Module {\n\tfor i, m := range modules {\n\t\tif m.Root {\n\t\t\tmodules = append(modules[:i], modules[i+1:]...)\n\t\t\treturn append([]models.Module{m}, modules...)\n\t\t}\n\t}\n\n\treturn modules\n}", "func sortChannelsByName(pkg *apimanifests.PackageManifest) {\n\tsort.Slice(pkg.Channels, func(i int, j int) bool {\n\t\treturn pkg.Channels[i].Name < pkg.Channels[j].Name\n\t})\n}", "func sortRevisions(revisionList *servingv1.RevisionList) {\n\t// sort revisionList by configuration generation key\n\tsort.SliceStable(revisionList.Items, revisionListSortFunc(revisionList))\n}", "func (cm *CategoryMap) Sort() {\n\tsort.Ints(cm.index)\n}", "func XlaKeyValueSort(scope *Scope, keys tf.Output, values tf.Output) (sorted_keys tf.Output, sorted_values tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"XlaKeyValueSort\",\n\t\tInput: []tf.Input{\n\t\t\tkeys, values,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0), op.Output(1)\n}", "func (s *ServicesWidget) Sort() {\n\ts.Lock()\n\tdefer s.Unlock()\n\tswitch s.sortMode {\n\tcase docker.SortByServiceName:\n\t\ts.sortMode = docker.SortByServiceImage\n\tcase docker.SortByServiceImage:\n\t\ts.sortMode = docker.SortByServiceName\n\t}\n}", "func sortDependencies(ctx context.Context, ranker DepsRanker, missingRuleDeps map[*bazel.Rule]map[ClassName][]bazel.Label) {\n\tstopwatch := time.Now()\n\tfor _, classToLabels := range missingRuleDeps {\n\t\tfor _, labels := range classToLabels {\n\t\t\tsort.Slice(labels, func(i, j int) bool { return ranker.Less(ctx, labels[i], labels[j]) })\n\t\t}\n\t}\n\tlog.Printf(\"Ranking dependencies (%dms)\", int64(time.Now().Sub(stopwatch)/time.Millisecond))\n}", "func (o Actions) Sort() {\n\tfor k := range o {\n\t\tsort.Sort(o[k])\n\t}\n}", "func (cache *Cache) Keys () []string {\n keys := make([]string, len(cache.FilePrints))\n n := 0;\n for k := range cache.FilePrints { keys[n] = k; n++ }\n if len(keys) > 1 { sort.Strings(keys) }\n return keys\n}", "func orderStackGroupKeys(m map[string]StackGroup) []string {\n\tret := make([]string, len(m))\n\ti := 0\n\n\tfor k := range m {\n\t\tret[i] = k\n\t\ti++\n\t}\n\tsort.Sort(sort.Reverse(sort.StringSlice(ret)))\n\treturn ret\n}", "func (l *PackageList) PrepareIndex() {\n\tif l.indexed {\n\t\treturn\n\t}\n\n\tl.packagesIndex = make([]*Package, l.Len())\n\tl.providesIndex = make(map[string][]*Package, 128)\n\n\ti := 0\n\tfor _, p := range l.packages {\n\t\tl.packagesIndex[i] = p\n\t\ti++\n\n\t\tfor _, provides := range p.Provides {\n\t\t\tl.providesIndex[provides] = append(l.providesIndex[provides], p)\n\t\t}\n\t}\n\n\tsort.Sort(l)\n\n\tl.indexed = true\n}", "func (d *Dry) SortImages() {\n\td.state.mutex.Lock()\n\tdefer d.state.mutex.Unlock()\n\tswitch d.state.SortImagesMode {\n\tcase drydocker.SortImagesByRepo:\n\t\td.state.SortImagesMode = drydocker.SortImagesByID\n\tcase drydocker.SortImagesByID:\n\t\td.state.SortImagesMode = drydocker.SortImagesByCreationDate\n\tcase drydocker.SortImagesByCreationDate:\n\t\td.state.SortImagesMode = drydocker.SortImagesBySize\n\tcase drydocker.SortImagesBySize:\n\t\td.state.SortImagesMode = drydocker.SortImagesByRepo\n\n\tdefault:\n\t}\n\td.dockerDaemon.SortImages(d.state.SortImagesMode)\n\td.state.changed = true\n\n}", "func (ns *Namespace) Sort(ctx context.Context, l any, args ...any) (any, error) {\n\tif l == nil {\n\t\treturn nil, errors.New(\"sequence must be provided\")\n\t}\n\n\tseqv, isNil := indirect(reflect.ValueOf(l))\n\tif isNil {\n\t\treturn nil, errors.New(\"can't iterate over a nil value\")\n\t}\n\n\tctxv := reflect.ValueOf(ctx)\n\n\tvar sliceType reflect.Type\n\tswitch seqv.Kind() {\n\tcase reflect.Array, reflect.Slice:\n\t\tsliceType = seqv.Type()\n\tcase reflect.Map:\n\t\tsliceType = reflect.SliceOf(seqv.Type().Elem())\n\tdefault:\n\t\treturn nil, errors.New(\"can't sort \" + reflect.ValueOf(l).Type().String())\n\t}\n\n\tcollator := langs.GetCollator1(ns.deps.Conf.Language())\n\n\t// Create a list of pairs that will be used to do the sort\n\tp := pairList{Collator: collator, sortComp: ns.sortComp, SortAsc: true, SliceType: sliceType}\n\tp.Pairs = make([]pair, seqv.Len())\n\n\tvar sortByField string\n\tfor i, l := range args {\n\t\tdStr, err := cast.ToStringE(l)\n\t\tswitch {\n\t\tcase i == 0 && err != nil:\n\t\t\tsortByField = \"\"\n\t\tcase i == 0 && err == nil:\n\t\t\tsortByField = dStr\n\t\tcase i == 1 && err == nil && dStr == \"desc\":\n\t\t\tp.SortAsc = false\n\t\tcase i == 1:\n\t\t\tp.SortAsc = true\n\t\t}\n\t}\n\tpath := strings.Split(strings.Trim(sortByField, \".\"), \".\")\n\n\tswitch seqv.Kind() {\n\tcase reflect.Array, reflect.Slice:\n\t\tfor i := 0; i < seqv.Len(); i++ {\n\t\t\tp.Pairs[i].Value = seqv.Index(i)\n\t\t\tif sortByField == \"\" || sortByField == \"value\" {\n\t\t\t\tp.Pairs[i].Key = p.Pairs[i].Value\n\t\t\t} else {\n\t\t\t\tv := p.Pairs[i].Value\n\t\t\t\tvar err error\n\t\t\t\tfor i, elemName := range path {\n\t\t\t\t\tv, err = evaluateSubElem(ctxv, v, elemName)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\tif !v.IsValid() {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\t// Special handling of lower cased maps.\n\t\t\t\t\tif params, ok := v.Interface().(maps.Params); ok {\n\t\t\t\t\t\tv = reflect.ValueOf(params.GetNested(path[i+1:]...))\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tp.Pairs[i].Key = v\n\t\t\t}\n\t\t}\n\n\tcase reflect.Map:\n\t\tkeys := seqv.MapKeys()\n\t\tfor i := 0; i < seqv.Len(); i++ {\n\t\t\tp.Pairs[i].Value = seqv.MapIndex(keys[i])\n\n\t\t\tif sortByField == \"\" {\n\t\t\t\tp.Pairs[i].Key = keys[i]\n\t\t\t} else if sortByField == \"value\" {\n\t\t\t\tp.Pairs[i].Key = p.Pairs[i].Value\n\t\t\t} else {\n\t\t\t\tv := p.Pairs[i].Value\n\t\t\t\tvar err error\n\t\t\t\tfor i, elemName := range path {\n\t\t\t\t\tv, err = evaluateSubElem(ctxv, v, elemName)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\tif !v.IsValid() {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\t// Special handling of lower cased maps.\n\t\t\t\t\tif params, ok := v.Interface().(maps.Params); ok {\n\t\t\t\t\t\tv = reflect.ValueOf(params.GetNested(path[i+1:]...))\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tp.Pairs[i].Key = v\n\t\t\t}\n\t\t}\n\t}\n\n\tcollator.Lock()\n\tdefer collator.Unlock()\n\n\treturn p.sort(), nil\n}", "func sortObjectsByKindAndName(objs []*Object) []*Object {\n\tsort.SliceStable(objs, func(i, j int) bool {\n\t\ta := objs[i]\n\t\tb := objs[j]\n\n\t\taKind := ObjectKind(a)\n\t\tbKind := ObjectKind(b)\n\t\taName, err := ObjectName(a)\n\t\tif err != nil {\n\t\t\treturn false // Move a to end of slice\n\t\t}\n\t\tbName, err := ObjectName(b)\n\t\tif err != nil {\n\t\t\treturn true // Move b to end of slice\n\t\t}\n\n\t\tif aKind == bKind {\n\t\t\treturn aName < bName\n\t\t}\n\t\treturn aKind < bKind\n\t})\n\treturn objs\n}", "func indexPackages(pkgs map[string]*ast.Package, prefix string) error {\n\tfor name, pkg := range pkgs {\n\t\tpath := prefix\n pack := name\n\t\t//fmt.Println(\"Inspecting \", path)\n\n\t\tast.Inspect(pkg, func(n ast.Node) bool {\n\n\t\t\tswitch x := n.(type) {\n\t\t\t//Packages\n\t\t\tcase *ast.Package:\n\t\t\t\tif x.Name != \"\" {\n\t\t\t\t\t//update index and docMap if necessary\n\t\t\t\t\tdocTerm := updateIndex(x.Name, pack, path)\n\t\t\t\t\t//update docTerm\n\t\t\t\t\tdocTerm.Packages += 1\n\t\t\t\t}\n\t\t\t\tbreak\n\n\t\t\t//Imports\n\t\t\tcase *ast.ImportSpec:\n\t\t\t\tif x.Path.Value != \"\" {\n\t\t\t\t\t//update index and docMap if necessary\n\t\t\t\t\tdocTerm := updateIndex(strings.Replace(x.Path.Value, \"\\\"\", \"\", -1), pack, path)\n\t\t\t\t\t//update docTerm\n\t\t\t\t\tdocTerm.Imports += 1\n\t\t\t\t}\n\t\t\t\tbreak\n\n\t\t\t//Functions\n\t\t\tcase *ast.FuncDecl:\n\t\t\t\tif x.Name.Name != \"\" {\n\t\t\t\t\t//Name tokenize function\n\t\t\t\t\tfor _, n := range tokenizeCamelCase(x.Name.Name) {\n\t\t\t\t\t\t//update index and docMap if necessary\n\t\t\t\t\t\tdocTerm := updateIndex(n, pack, path)\n\t\t\t\t\t\t//update docTerm\n\t\t\t\t\t\tdocTerm.Functions += 1\n\t\t\t\t\t}\n\n\t\t\t\t\t//Add comments to index\n\t\t\t\t\tif x.Doc != nil && *commentParse {\n\t\t\t\t\t\tcomment := \"\"\n\t\t\t\t\t\tfor _, c := range x.Doc.List {\n\t\t\t\t\t\t\tcomment += c.Text\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcomment = strings.Replace(comment, \"//\", \"\", -1)\n\t\t\t\t\t\tcomment = strings.ToLower(comment)\n\n\t\t\t\t\t\twords := strings.Fields(comment)\n\n\t\t\t\t\t\tfor _, word := range words {\n\t\t\t\t\t\t\tdocTerm := updateIndex(word, pack, path)\n\t\t\t\t\t\t\tdocTerm.Functions += 1\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\n\t\t\tcase *ast.TypeSpec:\n\t\t\t\tif x.Name.Name != \"\" {\n\t\t\t\t\t//Name tokenize function\n\t\t\t\t\tfor _, n := range tokenizeCamelCase(x.Name.Name) {\n\t\t\t\t\t\t//update index and docMap if necessary\n\t\t\t\t\t\tdocTerm := updateIndex(n, pack, path)\n\t\t\t\t\t\t//update docTerm\n\t\t\t\t\t\tdocTerm.Types += 1\n\t\t\t\t\t}\n\n\t\t\t\t\t//Add comments to index\n\t\t\t\t\tif x.Doc != nil && *commentParse {\n\t\t\t\t\t\tcomment := \"\"\n\t\t\t\t\t\tfor _, c := range x.Doc.List {\n\t\t\t\t\t\t\tcomment += c.Text\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcomment = strings.Replace(comment, \"//\", \"\", -1)\n\t\t\t\t\t\tcomment = strings.ToLower(comment)\n\n\t\t\t\t\t\twords := strings.Fields(comment)\n\n\t\t\t\t\t\tfor _, word := range words {\n\t\t\t\t\t\t\tdocTerm := updateIndex(word, pack, path)\n\t\t\t\t\t\t\tdocTerm.Types += 1\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn true\n\t\t})\n\t}\n\n\treturn nil\n}", "func sortKeys(m map[int]int) []int {\r\n\t// TODO: Implement sortKeys function.\r\n\tkeys:= make([]int,0,len(m))\r\n\tfor k := range m {\r\n\t\tkeys = append(keys,k)\r\n\t}\r\n su:=SortUser{m,keys}\r\n sort.Sort(&su)\r\n\treturn su.Keys\r\n}", "func (r *Compare) Compare() (map[string][]schema.GroupVersionResource, error) {\n\tpreferredSrcResourceList, err := collectPreferredResources(r.SrcDiscovery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsrcCRDResource, err := collectPreferredCRDResource(r.SrcDiscovery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdstResourceList, err := collectNamespacedResources(r.DstDiscovery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpreferredSrcResourceList, err = r.excludeCRDs(preferredSrcResourceList, srcCRDResource, r.SrcClient)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresourcesDiff := r.compareResources(preferredSrcResourceList, dstResourceList)\n\tincompatibleGVKs, err := convertToGVRList(resourcesDiff)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Don't report an incompatibleGVK if user settings will skip resource anyways\n\texcludedResources := toStringSlice(settings.ExcludedInitialResources.Union(toSet(r.Plan.Status.ExcludedResources)))\n\tfilteredGVKs := []schema.GroupVersionResource{}\n\tfor _, gvr := range incompatibleGVKs {\n\t\tskip := false\n\t\tfor _, resource := range excludedResources {\n\t\t\tif strings.EqualFold(gvr.Resource, resource) {\n\t\t\t\tskip = true\n\t\t\t}\n\t\t}\n\t\tif !skip {\n\t\t\tfilteredGVKs = append(filteredGVKs, gvr)\n\t\t}\n\t}\n\n\treturn r.collectIncompatibleMapping(filteredGVKs)\n}", "func sortExtras(extras map[interface{}][]interface{}) (ret []extra) {\n\tfor k, v := range extras {\n\t\tret = append(ret, extra{k, v})\n\t}\n\tsort.Slice(ret, func(i, j int) bool {\n\t\treturn fmt.Sprint(ret[i].Key) < fmt.Sprint(ret[j].Key)\n\t})\n\treturn\n}", "func orderedPropertyKeys(required []string, m map[string]spec.Schema, isResource bool) []string {\n\tsort.Strings(required)\n\n\tif isResource {\n\t\tmkeys := make(map[string]struct{})\n\t\tfor k := range m {\n\t\t\tmkeys[k] = struct{}{}\n\t\t}\n\t\tfor _, special := range []string{\"metadata\", \"kind\", \"apiVersion\"} {\n\t\t\tif !isRequired(special, required) {\n\t\t\t\tif _, ok := mkeys[special]; ok {\n\t\t\t\t\trequired = append([]string{special}, required...)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tkeys := make([]string, len(m)-len(required))\n\ti := 0\n\tfor k := range m {\n\t\tif !isRequired(k, required) {\n\t\t\tkeys[i] = k\n\t\t\ti++\n\t\t}\n\t}\n\tsort.Strings(keys)\n\treturn append(required, keys...)\n}", "func (c *Clients) GetKubeResources(r *ReleaseData) (map[string]interface{}, error) {\n\tlog.Printf(\"Getting resources for %s\", r.Name)\n\tif r.Manifest == \"\" {\n\t\treturn nil, errors.New(\"manifest not provided in the request\")\n\t}\n\tresources := map[string]interface{}{}\n\tinfos, err := c.getManifestDetails(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnamespace := \"default\"\n\tfor _, info := range infos {\n\t\tvar spec interface{}\n\t\tkind := info.Object.GetObjectKind().GroupVersionKind().GroupKind().Kind\n\t\tv := kube.AsVersioned(info)\n\t\tif checkSize(resources, ResourcesOutputSize) {\n\t\t\tbreak\n\t\t}\n\n\t\tif stringInSlice(reflect.TypeOf(v).String(), ResourcesOutputIgnoredTypes) {\n\t\t\tcontinue\n\t\t}\n\t\tinner := make(map[string]interface{})\n\t\tname, ok := ScanFromStruct(v, \"ObjectMeta.Name\")\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tns, ok := ScanFromStruct(v, \"ObjectMeta.Namespace\")\n\t\tif ok {\n\t\t\tnamespace = fmt.Sprint(ns)\n\t\t}\n\t\tif stringInSlice(reflect.TypeOf(v).String(), ResourcesOutputIncludedSpec) {\n\t\t\tspec, ok = ScanFromStruct(v, \"Spec\")\n\t\t\tif ok {\n\t\t\t\tspec = structToMap(spec)\n\t\t\t}\n\t\t}\n\t\tstatus, ok := ScanFromStruct(v, \"Status\")\n\t\tif ok {\n\t\t\tstatus = structToMap(status)\n\t\t}\n\t\tinner = map[string]interface{}{\n\t\t\tfmt.Sprint(name): map[string]interface{}{\n\t\t\t\t\"Namespace\": namespace,\n\t\t\t\t\"Spec\": spec,\n\t\t\t\t\"Status\": status,\n\t\t\t},\n\t\t}\n\t\tif IsZero(resources[kind]) {\n\t\t\tresources[kind] = map[string]interface{}{}\n\t\t}\n\t\ttemp := resources[kind].(map[string]interface{})\n\t\tresources[kind] = mergeMaps(temp, inner)\n\t}\n\treturn resources, nil\n}", "func Sort(releasePackages []Compilable) ([]Compilable, error) {\n\tsortedPackages := []Compilable{}\n\n\tincomingEdges, outgoingEdges := getEdgeMaps(releasePackages)\n\tnoIncomingEdgesSet := []Compilable{}\n\n\tfor pkg, edgeList := range incomingEdges {\n\t\tif len(edgeList) == 0 {\n\t\t\tnoIncomingEdgesSet = append(noIncomingEdgesSet, pkg)\n\t\t}\n\t}\n\tfor len(noIncomingEdgesSet) > 0 {\n\t\telem := noIncomingEdgesSet[0]\n\t\tnoIncomingEdgesSet = noIncomingEdgesSet[1:]\n\n\t\tsortedPackages = append([]Compilable{elem}, sortedPackages...)\n\n\t\tfor _, pkg := range outgoingEdges[elem] {\n\t\t\tincomingEdges[pkg] = removeFromList(incomingEdges[pkg], elem)\n\t\t\tif len(incomingEdges[pkg]) == 0 {\n\t\t\t\tnoIncomingEdgesSet = append(noIncomingEdgesSet, pkg)\n\t\t\t}\n\t\t}\n\t}\n\tfor _, edges := range incomingEdges {\n\t\tif len(edges) > 0 {\n\t\t\treturn nil, errors.New(\"Circular dependency detected while sorting packages\")\n\t\t}\n\t}\n\treturn sortedPackages, nil\n}", "func IndexResourcesByName(items []envoy_types.ResourceWithTTL) map[string]envoy_types.ResourceWithTTL {\n\tindexed := make(map[string]envoy_types.ResourceWithTTL, len(items))\n\tfor _, item := range items {\n\t\tkey := GetResourceName(item.Resource)\n\t\tindexed[key] = item\n\t}\n\treturn indexed\n}", "func IndexResourcesByName(items []types.Resource) map[string]types.Resource {\n\tindexed := make(map[string]types.Resource, len(items))\n\tfor _, item := range items {\n\t\tindexed[GetResourceName(item)] = item\n\t}\n\treturn indexed\n}", "func (c *clusterCache) listResources(ctx context.Context, resClient dynamic.ResourceInterface, callback func(*pager.ListPager) error) (string, error) {\n\tif err := c.listSemaphore.Acquire(ctx, 1); err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer c.listSemaphore.Release(1)\n\tvar retryCount int64 = 0\n\tresourceVersion := \"\"\n\tlistPager := pager.New(func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) {\n\t\tvar res *unstructured.UnstructuredList\n\t\tvar listRetry wait.Backoff\n\n\t\tif c.listRetryUseBackoff {\n\t\t\tlistRetry = retry.DefaultBackoff\n\t\t} else {\n\t\t\tlistRetry = retry.DefaultRetry\n\t\t}\n\n\t\tlistRetry.Steps = int(c.listRetryLimit)\n\t\terr := retry.OnError(listRetry, c.listRetryFunc, func() error {\n\t\t\tvar ierr error\n\t\t\tres, ierr = resClient.List(ctx, opts)\n\t\t\tif ierr != nil {\n\t\t\t\t// Log out a retry\n\t\t\t\tif c.listRetryLimit > 1 && c.listRetryFunc(ierr) {\n\t\t\t\t\tretryCount += 1\n\t\t\t\t\tc.log.Info(fmt.Sprintf(\"Error while listing resources: %v (try %d/%d)\", ierr, retryCount, c.listRetryLimit))\n\t\t\t\t}\n\t\t\t\treturn ierr\n\t\t\t}\n\t\t\tresourceVersion = res.GetResourceVersion()\n\t\t\treturn nil\n\t\t})\n\t\treturn res, err\n\t})\n\tlistPager.PageBufferSize = c.listPageBufferSize\n\tlistPager.PageSize = c.listPageSize\n\n\treturn resourceVersion, callback(listPager)\n}", "func SortImages(images []image.Info, pattern policy.Pattern) SortedImageInfos {\n\treturn sortImages(images, pattern)\n}", "func (tf tFiles) sortByNum() {\n\tsort.Sort(&tFilesSortByNum{tFiles: tf})\n}", "func (*ListRequest_SortingParams) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{2, 1}\n}", "func (r *EventList) sort() {\n\tsort.Slice(\n\t\tr.Items,\n\t\tfunc(i, j int) bool {\n\t\t\treturn r.Items[i].id() < r.Items[j].id()\n\t\t})\n}", "func getDeviceResources(deviceGroupStats []*api.DeviceGroupStats) []string {\n\tstatsSummaryMap := buildDeviceStatsSummaryMap(deviceGroupStats)\n\n\tresult := make([]string, 0, len(statsSummaryMap))\n\tfor id, stats := range statsSummaryMap {\n\t\tresult = append(result, id+\"|\"+stats.String())\n\t}\n\n\tsort.Strings(result)\n\n\treturn result\n}", "func SortFilesByDate(files []File) []File {\n\tsort.Slice(files, func(i, j int) bool {\n\t\tif files[i].State == Uploaded {\n\t\t\treturn files[i].UploadedTimestamp > files[j].UploadedTimestamp\n\t\t}\n\t\treturn files[i].PublishedTimestamp > files[j].PublishedTimestamp\n\t})\n\treturn files\n}", "func (*ListPostsRequest_Sort) Descriptor() ([]byte, []int) {\n\treturn file_view_grpc_blog_api_proto_rawDescGZIP(), []int{19, 1}\n}", "func (g GroupedResponses) SortedFileNames() []string {\n\tvar keys []string\n\tfor k := range g {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\treturn keys\n}", "func (self *Encoder) SortKeys() *Encoder {\n self.Opts |= SortMapKeys\n return self\n}", "func (regionEnv *RegionEnv) sortUnstructured() {\n\tvar newList []*unstructured.Unstructured\n\n\tfor _, obj := range regionEnv.Unstructured {\n\t\tapiVersion := obj.GetAPIVersion()\n\t\t// Don't add to the list if it is the wrong networking object or if it has pods.\n\t\tif (apiVersion == \"networking.istio.io/v1beta1\" && regionEnv.ClusterSettings[\"ISTIO\"] != \"true\") ||\n\t\t\t(apiVersion == \"contour.heptio.com/v1beta1\" && regionEnv.ClusterSettings[\"ISTIO\"] == \"true\") {\n\t\t\tcontinue\n\t\t}\n\t\tnewList = append(newList, obj)\n\t}\n\tregionEnv.Unstructured = newList\n}", "func DependencySort(ks []HelmRelease) ([]HelmRelease, error) {\n\tn := make(graph)\n\tlookup := map[string]*HelmRelease{}\n\tfor i := 0; i < len(ks); i++ {\n\t\tn[ks[i].Name] = after(ks[i].Spec.DependsOn)\n\t\tlookup[ks[i].Name] = &ks[i]\n\t}\n\tsccs := tarjanSCC(n)\n\tvar sorted []HelmRelease\n\tvar unsortable CircularDependencyError\n\tfor i := 0; i < len(sccs); i++ {\n\t\ts := sccs[i]\n\t\tif len(s) != 1 {\n\t\t\tunsortable = append(unsortable, s)\n\t\t\tcontinue\n\t\t}\n\t\tif k, ok := lookup[s[0]]; ok {\n\t\t\tsorted = append(sorted, *k.DeepCopy())\n\t\t}\n\t}\n\tif unsortable != nil {\n\t\tfor i, j := 0, len(unsortable)-1; i < j; i, j = i+1, j-1 {\n\t\t\tunsortable[i], unsortable[j] = unsortable[j], unsortable[i]\n\t\t}\n\t\treturn nil, unsortable\n\t}\n\treturn sorted, nil\n}", "func (a *Account) Resources() ([]string, error) {\n\tt := a.SkyTable()\n\tresults, err := t.Query(\"SELECT count() GROUP BY resource\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresources := make([]string, 0, len(results))\n\tif results, ok := results[\"resource\"].(map[string]interface{}); ok {\n\t\tfor resource, _ := range results {\n\t\t\tresources = append(resources, resource)\n\t\t}\n\t}\n\tsort.Sort(sort.StringSlice(resources))\n\treturn resources, nil\n}", "func SortRecords(r []Record) {\n\tsort.Slice(r, func(i, j int) bool {\n\t\treturn r[i].Version < r[j].Version\n\t})\n}", "func (p *Proxy) SortKey() string {\n\treturn fmt.Sprintf(\"%s %s:%d/%s\", p.Name, p.ListenIP, p.ListenPort, p.ListenProto)\n}", "func (res *Resource) SortableAttrs(columns ...string) []string {\n\tif len(columns) != 0 || res.sortableAttrs == nil {\n\t\tif len(columns) == 0 {\n\t\t\tcolumns = res.ConvertSectionToStrings(res.indexSections)\n\t\t}\n\t\tres.sortableAttrs = &[]string{}\n\t\tscope := res.GetAdmin().Config.DB.NewScope(res.Value)\n\t\tfor _, column := range columns {\n\t\t\tif field, ok := scope.FieldByName(column); ok && field.DBName != \"\" {\n\t\t\t\tattrs := append(*res.sortableAttrs, column)\n\t\t\t\tres.sortableAttrs = &attrs\n\t\t\t}\n\t\t}\n\t}\n\treturn *res.sortableAttrs\n}", "func (AppImageConfigSortKey) Values() []AppImageConfigSortKey {\n\treturn []AppImageConfigSortKey{\n\t\t\"CreationTime\",\n\t\t\"LastModifiedTime\",\n\t\t\"Name\",\n\t}\n}", "func sortTags(tags []string) {\n\tsort.Slice(tags, func(i, j int) bool {\n\t\timatch := semverRegex.FindStringSubmatch(tags[i])\n\t\tjmatch := semverRegex.FindStringSubmatch(tags[j])\n\t\tif len(imatch) < 5 {\n\t\t\treturn false\n\t\t}\n\t\tif len(jmatch) < 5 {\n\t\t\treturn true\n\t\t}\n\n\t\t// Matches must be numbers due to regex they are parsed from.\n\t\tiM, _ := strconv.Atoi(imatch[1])\n\t\tjM, _ := strconv.Atoi(jmatch[1])\n\t\tim, _ := strconv.Atoi(imatch[2])\n\t\tjm, _ := strconv.Atoi(jmatch[2])\n\t\tip, _ := strconv.Atoi(imatch[3])\n\t\tjp, _ := strconv.Atoi(jmatch[3])\n\n\t\t// weight each level of semver for comparison\n\t\tiTotal := iM*marjorWeight + im*minorWeight + ip*patchWeight\n\t\tjTotal := jM*marjorWeight + jm*minorWeight + jp*patchWeight\n\n\t\t// de-rank all prereleases by a major version\n\t\tif imatch[4] != \"\" {\n\t\t\tiTotal -= marjorWeight\n\t\t}\n\t\tif jmatch[4] != \"\" {\n\t\t\tjTotal -= marjorWeight\n\t\t}\n\n\t\treturn iTotal > jTotal\n\t})\n}", "func getFilteredAPIGroupResources(cl discovery.DiscoveryInterface, groupFilterPredicate GroupFilterPredicate) ([]*restmapper.APIGroupResources, error) {\n\tgs, rs, err := filteredServerGroupsAndResources(cl, groupFilterPredicate)\n\tif rs == nil || gs == nil {\n\t\treturn nil, err\n\t\t// TODO track the errors and update callers to handle partial errors.\n\t}\n\trsm := map[string]*metav1.APIResourceList{}\n\tfor _, r := range rs {\n\t\trsm[r.GroupVersion] = r\n\t}\n\n\tvar result []*restmapper.APIGroupResources\n\tfor _, group := range gs {\n\t\tgroupResources := &restmapper.APIGroupResources{\n\t\t\tGroup: *group,\n\t\t\tVersionedResources: make(map[string][]metav1.APIResource),\n\t\t}\n\t\tfor _, version := range group.Versions {\n\t\t\tresources, ok := rsm[version.GroupVersion]\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tgroupResources.VersionedResources[version.Version] = resources.APIResources\n\t\t}\n\t\tresult = append(result, groupResources)\n\t}\n\treturn result, nil\n}", "func ResourceCatalogSortBy_Values() []string {\n\treturn []string{\n\t\tResourceCatalogSortByCreationTime,\n\t}\n}", "func (info ResourceInfo) Resources(opts options.Get) [][]string {\n\tincludedHeaders := info.Headers(opts)\n\tresult := make([][]string, len(info.data))\n\n\t// for each resource\n\tfor i, fieldMap := range info.data {\n\n\t\t// for each of the columns that we want to display\n\t\tline := make([]string, len(includedHeaders))\n\t\tfor j, h := range includedHeaders {\n\t\t\tval, ok := fieldMap[h]\n\t\t\tif !ok {\n\t\t\t\tval = \"\"\n\t\t\t}\n\t\t\tline[j] = val\n\t\t}\n\t\tresult[i] = line\n\t}\n\treturn result\n}", "func getResourcesForCrd(ctx context.Context, dynClient dynamic.Interface, crd *unstructured.Unstructured, log logr.Logger) ([]byte, error) {\n\tversions := getList(crd.Object, \"spec\", \"versions\")\n\tif len(versions) == 0 {\n\t\tlog.V(INFO).Info(\"crd has no version, skipping\", \"crd\", crd.GetName())\n\n\t\treturn nil, nil\n\t}\n\n\tgroup := getString(crd.Object, \"spec\", \"group\")\n\tresource := getString(crd.Object, \"spec\", \"names\", \"plural\")\n\tversion := getString(versions[0], \"name\")\n\n\tres := schema.GroupVersionResource{Group: group, Resource: resource, Version: version}\n\n\tresources, err := dynClient.Resource(res).List(ctx, metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to load resources for CRD %s: %w\", res, err)\n\t}\n\n\tresourceBuffer := bytes.Buffer{}\n\n\tfor j := range resources.Items {\n\t\tresourceYaml, err := ToCleanedK8sResourceYAML(&resources.Items[j])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresourceBuffer.WriteString(\"---\\n\")\n\t\tresourceBuffer.Write(resourceYaml)\n\t}\n\n\treturn resourceBuffer.Bytes(), nil\n}", "func (um *Manager) upgradeGroupVersion(ctx context.Context, groupVersion string) error {\n\t// new client to get updated restmapper\n\tc, err := client.New(um.mgr.GetConfig(), client.Options{Scheme: um.mgr.GetScheme(), Mapper: nil})\n\tif err != nil {\n\t\treturn err\n\t}\n\tum.client = c\n\tif err := um.ensureCRDExists(ctx); err != nil {\n\t\tlog.Info(\"required crd has not been deployed \", \"CRD\", crdName)\n\t\treturn err\n\t}\n\t// get all resource kinds\n\tresourceList, err := um.getAllKinds(groupVersion)\n\tif err != nil {\n\t\t// If the resource doesn't exist, it doesn't need upgrading\n\t\tif errors.IsNotFound(err) {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\tresourceGV := strings.Split(resourceList.GroupVersion, \"/\")\n\tgroup := resourceGV[0]\n\tversion := resourceGV[1]\n\n\t// For some reason we have seen duplicate kinds, suppress that\n\tuniqueKinds := make(map[string]bool)\n\tfor i := range resourceList.APIResources {\n\t\tuniqueKinds[resourceList.APIResources[i].Kind] = true\n\t}\n\n\t// get resource for each Kind\n\tfor kind := range uniqueKinds {\n\t\tlog.Info(\"resource\", \"kind\", kind, \"group\", group, \"version\", version)\n\t\tresourceGvk := schema.GroupVersionKind{\n\t\t\tGroup: group,\n\t\t\tVersion: version,\n\t\t\tKind: kind + \"List\",\n\t\t}\n\t\tinstanceList := &unstructured.UnstructuredList{}\n\t\tinstanceList.SetGroupVersionKind(resourceGvk)\n\t\terr := um.client.List(ctx, instanceList)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlog.Info(\"resource count\", \"count\", len(instanceList.Items))\n\t\tupdateResources := make(map[util.KindVersionName]unstructured.Unstructured, len(instanceList.Items))\n\t\t// get each resource\n\t\tfor _, item := range instanceList.Items {\n\t\t\tkey := util.GetUniqueKey(item)\n\t\t\tupdateResources[key] = item\n\t\t}\n\n\t\tif len(updateResources) > 0 {\n\t\t\turloop := &updateResourceLoop{\n\t\t\t\tur: updateResources,\n\t\t\t\tclient: um.client,\n\t\t\t\tstop: make(chan struct{}),\n\t\t\t\tstopped: make(chan struct{}),\n\t\t\t}\n\t\t\tlog.Info(\"starting update resources loop\", \"group\", group, \"version\", version, \"kind\", kind)\n\t\t\tgo urloop.update(ctx)\n\t\t}\n\t}\n\treturn nil\n}", "func ResourceKey(group, version, kind string) string {\n\tif group == \"\" {\n\t\tgroup = \"core\"\n\t}\n\treturn \"k8s_\" + ToSnake(group) + \"_\" + version + \"_\" + ToSnake(kind)\n}", "func (p *Provider) Resources() []terraform.ResourceType {\n\tkeys := make([]string, 0, len(p.ResourcesMap))\n\tfor k, _ := range p.ResourcesMap {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\n\tresult := make([]terraform.ResourceType, 0, len(keys))\n\tfor _, k := range keys {\n\t\tresult = append(result, terraform.ResourceType{\n\t\t\tName: k,\n\t\t})\n\t}\n\n\treturn result\n}", "func uniqResources(resources []metav1.APIResource) []metav1.APIResource {\n\tseen := make(map[string]struct{}, len(resources))\n\ti := 0\n\tfor _, k := range resources {\n\t\tif _, ok := seen[k.Name]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tseen[k.Name] = struct{}{}\n\t\tresources[i] = k\n\n\t\ti++\n\t}\n\treturn resources[:i]\n}" ]
[ "0.7373579", "0.67436945", "0.66443646", "0.63406587", "0.6209258", "0.605762", "0.6039649", "0.5944665", "0.5886248", "0.5750245", "0.56788707", "0.5572973", "0.55383927", "0.552214", "0.5503361", "0.55031127", "0.5499262", "0.5477553", "0.5433216", "0.53902084", "0.535577", "0.52868783", "0.5218482", "0.5204087", "0.51941985", "0.5169211", "0.51380396", "0.51134145", "0.5106708", "0.5090117", "0.50662315", "0.5052936", "0.5041121", "0.50354165", "0.5007837", "0.5007368", "0.4999884", "0.49854428", "0.49852842", "0.49726605", "0.49726474", "0.49437082", "0.4938736", "0.49363455", "0.49355167", "0.49321294", "0.49285063", "0.49049896", "0.4887764", "0.48821828", "0.48817712", "0.48803166", "0.4875778", "0.487134", "0.48707744", "0.4862691", "0.48601204", "0.48229778", "0.48090866", "0.48044574", "0.4804071", "0.4803175", "0.48019236", "0.47819176", "0.4778518", "0.4776585", "0.4771438", "0.47703734", "0.47482908", "0.4734014", "0.47294167", "0.47283155", "0.47263876", "0.47078046", "0.47041133", "0.4689539", "0.4682257", "0.4681459", "0.46722534", "0.4671265", "0.46697423", "0.4659851", "0.4644862", "0.46361467", "0.46358857", "0.46320394", "0.46299523", "0.46273217", "0.46271622", "0.46256393", "0.46070084", "0.46066692", "0.46012464", "0.4599022", "0.4597884", "0.45911103", "0.45907822", "0.4579066", "0.4575569", "0.4569986" ]
0.7210953
1
getFields looks up p.Fields from leaf and structures them into treeFields. TODO(pwittrock): simplify this function
getFields ищет p.Fields из листа и структурирует их в treeFields. TODO(pwittrock): упростить эту функцию
func (p TreeWriter) getFields(leaf *yaml.RNode) (treeFields, error) { fieldsByName := map[string]*treeField{} // index nested and non-nested fields for i := range p.Fields { f := p.Fields[i] seq, err := leaf.Pipe(&f) if err != nil { return nil, err } if seq == nil { continue } if fieldsByName[f.Name] == nil { fieldsByName[f.Name] = &treeField{name: f.Name} } // non-nested field -- add directly to the treeFields list if f.SubName == "" { // non-nested field -- only 1 element val, err := yaml.String(seq.Content()[0], yaml.Trim, yaml.Flow) if err != nil { return nil, err } fieldsByName[f.Name].value = val continue } // nested-field -- create a parent elem, and index by the 'match' value if fieldsByName[f.Name].subFieldByMatch == nil { fieldsByName[f.Name].subFieldByMatch = map[string]treeFields{} } index := fieldsByName[f.Name].subFieldByMatch for j := range seq.Content() { elem := seq.Content()[j] matches := f.Matches[elem] str, err := yaml.String(elem, yaml.Trim, yaml.Flow) if err != nil { return nil, err } // map the field by the name of the element // index the subfields by the matching element so we can put all the fields for the // same element under the same branch matchKey := strings.Join(matches, "/") index[matchKey] = append(index[matchKey], &treeField{name: f.SubName, value: str}) } } // iterate over collection of all queried fields in the Resource for _, field := range fieldsByName { // iterate over collection of elements under the field -- indexed by element name for match, subFields := range field.subFieldByMatch { // create a new element for this collection of fields // note: we will convert name to an index later, but keep the match for sorting elem := &treeField{name: match} field.matchingElementsAndFields = append(field.matchingElementsAndFields, elem) // iterate over collection of queried fields for the element for i := range subFields { // add to the list of fields for this element elem.matchingElementsAndFields = append(elem.matchingElementsAndFields, subFields[i]) } } // clear this cached data field.subFieldByMatch = nil } // put the fields in a list so they are ordered fieldList := treeFields{} for _, v := range fieldsByName { fieldList = append(fieldList, v) } // sort the fields sort.Sort(fieldList) for i := range fieldList { field := fieldList[i] // sort the elements under this field sort.Sort(field.matchingElementsAndFields) for i := range field.matchingElementsAndFields { element := field.matchingElementsAndFields[i] // sort the elements under a list field by their name sort.Sort(element.matchingElementsAndFields) // set the name of the element to its index element.name = fmt.Sprintf("%d", i) } } return fieldList, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func getParentTreeFields(treePath string) (treeNames, treePaths []string) {\n\tif treePath == \"\" {\n\t\treturn treeNames, treePaths\n\t}\n\n\ttreeNames = strings.Split(treePath, \"/\")\n\ttreePaths = make([]string, len(treeNames))\n\tfor i := range treeNames {\n\t\ttreePaths[i] = strings.Join(treeNames[:i+1], \"/\")\n\t}\n\treturn treeNames, treePaths\n}", "func GetFields(reader *os.File) []Field {\n\tvar curbuf []byte\n\tdbfhead := GetDbfHead(reader)\n\n\toff := dbfhead.Headerlen - 32 - 264\n\tif off < 1 {\n\t\tpanic(\"invalid header\")\n\t}\n\tfieldlist := make([]Field, off/32)\n\tbuf := make([]byte, off)\n\t_, err := reader.ReadAt(buf, 32)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfor i, val := range fieldlist {\n\t\ta := i * 32\n\t\tcurbuf = buf[a:]\n\t\tval.Name = copyUpToNull(curbuf[0:11])\n\t\tval.Fieldtype = fmt.Sprintf(\"%s\", curbuf[11:12])\n\t\tval.FieldDataaddress = curbuf[12:16]\n\t\tval.FieldLen = Changebytetoint(curbuf[16:17])\n\t\tval.DecimalCount = curbuf[17:18]\n\t\tval.Workareaid = curbuf[20:21]\n\t\tfieldlist[i] = val\n\t}\n\treturn fieldlist\n}", "func (self *mergeState) getFields() []string {\n\tfields := make([]string, len(self.fields))\n\tfor f, i := range self.fields {\n\t\tfields[i] = f\n\t}\n\treturn fields\n}", "func (n *Node) Fields() []uintptr {\n\t// we store the offsets for the fields in type properties\n\ttprops := kit.Types.Properties(n.Type(), true) // true = makeNew\n\tpnm := \"__FieldOffs\"\n\tif foff, ok := tprops[pnm]; ok {\n\t\treturn foff.([]uintptr)\n\t}\n\tfoff := make([]uintptr, 0)\n\tkitype := KiType()\n\tFlatFieldsValueFunc(n.This, func(stru interface{}, typ reflect.Type, field reflect.StructField, fieldVal reflect.Value) bool {\n\t\tif fieldVal.Kind() == reflect.Struct && kit.EmbeddedTypeImplements(field.Type, kitype) {\n\t\t\tfoff = append(foff, field.Offset)\n\t\t}\n\t\treturn true\n\t})\n\ttprops[pnm] = foff\n\treturn foff\n}", "func (_struct *Struct) Fields() (Fields, error) {\n\tvar goFields Fields\n\tstructType := _struct.StructType()\n\tif structType == nil {\n\t\treturn nil, fmt.Errorf(\"no struct type in %#+v\", _struct)\n\t}\n\tfor idx, field := range structType.Fields.List {\n\t\ttyp, err := _struct.toType(field.Type)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to lookup type '%s': %w\", field.Type, err)\n\t\t}\n\t\tgoFields = append(goFields, &Field{\n\t\t\tField: *field,\n\t\t\tStruct: _struct,\n\t\t\tNames: field.Names,\n\t\t\tIndex: uint(idx),\n\t\t\tTypeValue: typ,\n\t\t})\n\t}\n\treturn goFields, nil\n}", "func getNodeFields() []string {\n\trt := reflect.TypeOf((*tailcfg.Node)(nil)).Elem()\n\tret := make([]string, rt.NumField())\n\tfor i := 0; i < rt.NumField(); i++ {\n\t\tret[i] = rt.Field(i).Name\n\t}\n\treturn ret\n}", "func TraverseFields(v interface{}, processField ProcessValue) error {\n\treturn TraverseValueFields(reflect.ValueOf(v), processField)\n}", "func (*GetField) Children() []sql.Expression {\n\treturn nil\n}", "func fixFields(n, parent *node, depth int) {\n\tn.parent = parent\n\tn.depth = depth\n\tfor _, c := range n.children {\n\t\tfixFields(c, n, depth+1)\n\t}\n}", "func (n Node) AllFields() []interface{} {\n\tlabels := make([]interface{}, len(n.Labels))\n\tfor i, label := range n.Labels {\n\t\tlabels[i] = label\n\t}\n\treturn []interface{}{n.NodeIdentity, labels, n.Properties}\n}", "func (pce *ppdCacheEntry) getFields() (cdd.PrinterDescriptionSection, string, string, lib.DuplexVendorMap) {\n\tpce.mutex.Lock()\n\tdefer pce.mutex.Unlock()\n\treturn pce.description, pce.manufacturer, pce.model, pce.duplexMap\n}", "func typeFields(t reflect.Type) []field {\n\t// Anonymous fields to explore at the current level and the next.\n\tcurrent := []field{}\n\tnext := []field{{typ: t}}\n\n\t// Count of queued names for current level and the next.\n\tcount := map[reflect.Type]int{}\n\tnextCount := map[reflect.Type]int{}\n\n\t// Types already visited at an earlier level.\n\tvisited := map[reflect.Type]bool{}\n\n\t// Fields found.\n\tvar fields []field\n\n\tfor len(next) > 0 {\n\t\tcurrent, next = next, current[:0]\n\t\tcount, nextCount = nextCount, map[reflect.Type]int{}\n\n\t\tfor _, f := range current {\n\t\t\tif visited[f.typ] {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvisited[f.typ] = true\n\n\t\t\t// Scan f.typ for fields to include.\n\t\t\tfor i := 0; i < f.typ.NumField(); i++ {\n\t\t\t\tsf := f.typ.Field(i)\n\t\t\t\tisUnexported := sf.PkgPath != \"\"\n\t\t\t\tif sf.Anonymous {\n\t\t\t\t\tt := sf.Type\n\t\t\t\t\tif isUnexported && t.Kind() != reflect.Struct {\n\t\t\t\t\t\t// Ignore embedded fields of unexported non-struct types.\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\t// Do not ignore embedded fields of unexported struct types\n\t\t\t\t\t// since they may have exported fields.\n\t\t\t\t} else if isUnexported {\n\t\t\t\t\t// Ignore unexported non-embedded fields.\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tindex := make([]int, len(f.index)+1)\n\t\t\t\tcopy(index, f.index)\n\t\t\t\tindex[len(f.index)] = i\n\n\t\t\t\tft := sf.Type\n\n\t\t\t\t// Record found field and index sequence.\n\t\t\t\tif !sf.Anonymous || ft.Kind() != reflect.Struct {\n\t\t\t\t\tfields = append(fields, field{\n\t\t\t\t\t\tname: sf.Name,\n\t\t\t\t\t\tindex: index,\n\t\t\t\t\t\ttyp: ft,\n\t\t\t\t\t})\n\t\t\t\t\tif count[f.typ] > 1 {\n\t\t\t\t\t\t// If there were multiple instances, add a second,\n\t\t\t\t\t\t// so that the annihilation code will see a duplicate.\n\t\t\t\t\t\t// It only cares about the distinction between 1 or 2,\n\t\t\t\t\t\t// so don't bother generating any more copies.\n\t\t\t\t\t\tfields = append(fields, fields[len(fields)-1])\n\t\t\t\t\t}\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// Record new anonymous struct to explore in next round.\n\t\t\t\tnextCount[ft]++\n\t\t\t\tif nextCount[ft] == 1 {\n\t\t\t\t\tnext = append(next, field{name: ft.Name(), index: index, typ: ft})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tsort.Sort(byIndex(fields))\n\n\treturn fields\n}", "func (s Strategy) GetFieldsForSubDocument(model string, foreignfield string) []map[string]interface{} {\n\tvar fields []map[string]interface{}\n\n\tfor _, f := range s.Map.Entities[model].Fields { // search foreign field in []map[string]interface{}\n\t\tif f[\"foreign\"] == foreignfield {\n\t\t\tfi := f[\"fields\"].([]interface{})\n\t\t\t// Convert the []interface into []map[string]interface{}\n\t\t\tfields = make([]map[string]interface{}, len(fi))\n\t\t\tfor i := range fields {\n\t\t\t\tfields[i] = fi[i].(map[string]interface{})\n\t\t\t}\n\t\t\treturn fields\n\t\t}\n\t}\n\treturn fields\n}", "func (o *NotificationAllOf) GetFields() map[string]interface{} {\n\tif o == nil || o.Fields == nil {\n\t\tvar ret map[string]interface{}\n\t\treturn ret\n\t}\n\treturn *o.Fields\n}", "func (jn *SemiJoin) GetFields(ctx context.Context, vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error) {\n\treturn jn.Left.GetFields(ctx, vcursor, bindVars)\n}", "func TopLevelFields(paths []string) []string {\n\tseen := make(map[string]struct{}, len(paths))\n\tout := make([]string, 0, len(paths))\n\tfor _, path := range paths {\n\t\tparts := strings.SplitN(path, \".\", 2)\n\t\tif _, ok := seen[parts[0]]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tseen[parts[0]] = struct{}{}\n\t\tout = append(out, parts[0])\n\t}\n\treturn out\n}", "func GetFields(q graphql.Querier, query *querybuilder.Query) ([]Field, error) {\n\ttyp, ok := schema.GetQueryType()\n\tif !ok {\n\t\treturn nil, errors.New(\"No QueryType present in schema\")\n\t}\n\n\tfor _, node := range query.List() {\n\t\tif node.ConcreteType == \"\" {\n\t\t\tfield, ok := typ.GetField(node.Name)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"Missing field %q from type %q\", node.Name, typ.Name)\n\t\t\t}\n\n\t\t\ttyp, ok = schema.GetType(field.GetTypeName())\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"Missing type %q\", field.GetTypeName())\n\t\t\t}\n\t\t} else {\n\t\t\ttyp, ok = schema.GetType(node.ConcreteType)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"Missing type %q\", node.ConcreteType)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn typ.Fields, nil\n}", "func (del *Delete) GetFields(context.Context, VCursor, map[string]*querypb.BindVariable) (*sqltypes.Result, error) {\n\treturn nil, fmt.Errorf(\"BUG: unreachable code for %q\", del.Query)\n}", "func (g *generator) structFields(t reflect.Type) []field {\n\tvar fields []field\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tf := t.Field(i)\n\t\tif g.ignoreField(t, f) {\n\t\t\tcontinue\n\t\t}\n\t\tname, _ := parseTag(g.fieldTagKey, f.Tag)\n\t\tif name == \"\" {\n\t\t\tname = f.Name\n\t\t}\n\t\tfields = append(fields, field{\n\t\t\tName: name,\n\t\t\tType: f.Type,\n\t\t\tZero: zeroValue(f.Type),\n\t\t})\n\t}\n\treturn fields\n}", "func (e TypeReflectCacheEntry) Fields() map[string]*FieldCacheEntry {\n\treturn e.structFields\n}", "func BottomLevelFields(paths []string) []string {\n\tseen := make(map[string]struct{}, len(paths))\n\tfor _, path := range paths {\n\t\tprefix := path\n\t\tif i := strings.LastIndex(prefix, \".\"); i >= 0 {\n\t\t\tprefix = prefix[:i]\n\t\t}\n\t\tif _, ok := seen[prefix]; ok {\n\t\t\tdelete(seen, prefix)\n\t\t}\n\t\tseen[path] = struct{}{}\n\t}\n\tout := make([]string, 0, len(seen))\n\tfor k := range seen {\n\t\tout = append(out, k)\n\t}\n\treturn out\n}", "func getComparableFields() []string {\n\tfields := []string{}\n\n\tfor _, fieldName := range getContainerFields() {\n\t\t// Skip some fields\n\t\tif unicode.IsLower((rune)(fieldName[0])) {\n\t\t\tcontinue\n\t\t}\n\n\t\tskip := false\n\t\tfor _, f := range compareSkipFields {\n\t\t\tif f == fieldName {\n\t\t\t\tskip = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif !skip {\n\t\t\tfields = append(fields, fieldName)\n\t\t}\n\t}\n\n\treturn fields\n}", "func GetFields(c context.Context) Fields {\n\tret, _ := c.Value(fieldsKey).(Fields)\n\tif ret == nil {\n\t\treturn fields(nil)\n\t}\n\treturn ret\n}", "func IterFields(t *Type) (*Field, Iter)", "func (e Matcher_MatcherTreeValidationError) Field() string { return e.field }", "func (s *Search) GetFields() []string {\n\tq := s.buildQ()\n\tparams := map[string]string{\n\t\t\"query\": q,\n\t\t\"type\": \"File\",\n\t\t\"format\": \"application/solr+json\",\n\t\t\"fields\": \"*\",\n\t\t\"limit\": \"1\",\n\t}\n\n\tbody, err := s.performSearch(params)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn nil\n\t}\n\n\t// Parse response body as JSON\n\tvar result fieldResTop\n\tjson.Unmarshal(body, &result)\n\n\t// If no result was found\n\tif len(result.Res.Docs) != 1 {\n\t\treturn nil\n\t}\n\n\tvar fields []string\n\tfor key := range result.Res.Docs[0] {\n\t\tfields = append(fields, key)\n\t}\n\treturn fields\n}", "func StructFields(t reflect.Type) interface{} {\n\treturn structInfoForType(t).fields\n}", "func (fm *FieldModelOrder) GetFields(fbeValue *Order, fbeStructSize int) {\n fbeCurrentSize := 4 + 4\n\n if (fbeCurrentSize + fm.Id.FBESize()) <= fbeStructSize {\n fbeValue.Id, _ = fm.Id.Get()\n } else {\n fbeValue.Id = 0\n }\n fbeCurrentSize += fm.Id.FBESize()\n\n if (fbeCurrentSize + fm.Symbol.FBESize()) <= fbeStructSize {\n fbeValue.Symbol, _ = fm.Symbol.Get()\n } else {\n fbeValue.Symbol = \"\"\n }\n fbeCurrentSize += fm.Symbol.FBESize()\n\n if (fbeCurrentSize + fm.Side.FBESize()) <= fbeStructSize {\n _ = fm.Side.GetValue(&fbeValue.Side)\n } else {\n fbeValue.Side = *NewOrderSide()\n }\n fbeCurrentSize += fm.Side.FBESize()\n\n if (fbeCurrentSize + fm.Type.FBESize()) <= fbeStructSize {\n _ = fm.Type.GetValue(&fbeValue.Type)\n } else {\n fbeValue.Type = *NewOrderType()\n }\n fbeCurrentSize += fm.Type.FBESize()\n\n if (fbeCurrentSize + fm.Price.FBESize()) <= fbeStructSize {\n fbeValue.Price, _ = fm.Price.GetDefault(float64(0.0))\n } else {\n fbeValue.Price = float64(0.0)\n }\n fbeCurrentSize += fm.Price.FBESize()\n\n if (fbeCurrentSize + fm.Volume.FBESize()) <= fbeStructSize {\n fbeValue.Volume, _ = fm.Volume.GetDefault(float64(0.0))\n } else {\n fbeValue.Volume = float64(0.0)\n }\n fbeCurrentSize += fm.Volume.FBESize()\n}", "func (o *PublicViewInfo) GetFields() []PublicField {\n\tif o == nil {\n\t\tvar ret []PublicField\n\t\treturn ret\n\t}\n\n\treturn o.Fields\n}", "func loadFields(fieldBucket *bbolt.Bucket) (fields []field.Meta) {\n\tcursor := fieldBucket.Cursor()\n\tfor k, v := cursor.First(); k != nil; k, v = cursor.Next() {\n\t\tfields = append(fields, field.Meta{\n\t\t\tName: field.Name(k),\n\t\t\tID: field.ID(v[0]),\n\t\t\tType: field.Type(v[1]),\n\t\t})\n\t}\n\treturn\n}", "func _fields(args ...interface{}) *ast.FieldList {\n\tlist := []*ast.Field{}\n\tnames := []*ast.Ident{}\n\tlasti := interface{}(nil)\n\tmaybePop := func() {\n\t\tif len(names) > 0 {\n\t\t\tvar last ast.Expr\n\t\t\tif lastte_, ok := lasti.(string); ok {\n\t\t\t\tlast = _x(lastte_)\n\t\t\t} else {\n\t\t\t\tlast = lasti.(ast.Expr)\n\t\t\t}\n\t\t\tlist = append(list, &ast.Field{\n\t\t\t\tNames: names,\n\t\t\t\tType: last,\n\t\t\t})\n\t\t\tnames = []*ast.Ident{}\n\t\t}\n\t}\n\tfor i := 0; i < len(args); i++ {\n\t\tname, ok := args[i].(*ast.Ident)\n\t\tif !ok {\n\t\t\tname = _i(args[i].(string))\n\t\t}\n\t\tte_ := args[i+1]\n\t\ti += 1\n\t\t// NOTE: This comparison could be improved, to say, deep equality,\n\t\t// but is that the behavior we want?\n\t\tif lasti == te_ {\n\t\t\tnames = append(names, name)\n\t\t\tcontinue\n\t\t} else {\n\t\t\tmaybePop()\n\t\t\tnames = append(names, name)\n\t\t\tlasti = te_\n\t\t}\n\t}\n\tmaybePop()\n\treturn &ast.FieldList{\n\t\tList: list,\n\t}\n}", "func ReflectFieldsFq(\n\tt reflect.Type,\n\ttypeMap TypeMap,\n\texclude ExcludeFieldTag,\n) graphql.Fields {\n\tif t.Kind() != reflect.Struct {\n\t\tpanic(fmt.Sprintf(`ReflectFieldsFq can only work on struct types.\n\t\t\tReceived instead %s`, t.Kind()))\n\t}\n\tfields := make(graphql.Fields)\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tf := t.Field(i)\n\t\tif includeField(f, exclude) {\n\t\t\tname := GqlName(GetFieldFirstTag(f, \"json\"))\n\t\t\tfields[string(name)] = ReflectFieldFq(name, f.Type, typeMap, exclude)\n\t\t}\n\t}\n\treturn fields\n}", "func (b *Builder) QueryFields(source reflect.Value, parent reflect.Value) (graphql.Fields, error) {\n\tresult := make(graphql.Fields, 0)\n\tif source.IsValid() && source.IsZero() {\n\t\tsource = reflect.New(source.Type())\n\t}\n\tnodes := b.buildObject(source, parent)\n\tfor _, node := range nodes {\n\t\tif node.skip {\n\t\t\tcontinue\n\t\t}\n\t\tif !node.source.CanSet() {\n\t\t\tcontinue\n\t\t}\n\t\tif node.inputOnly {\n\t\t\tcontinue\n\t\t}\n\t\tname := node.alias\n\t\tif name == \"\" {\n\t\t\tname = strcase.ToLowerCamel(node.name)\n\t\t}\n\t\tvar gType graphql.Type\n\t\tif node.isRelay {\n\t\t\tgType = b.buildConnection(node.source, parent)\n\t\t} else {\n\t\t\tgType = b.mapOutput(node.source, parent)\n\t\t}\n\t\tif gType == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif node.required {\n\t\t\tgType = graphql.NewNonNull(gType)\n\t\t}\n\n\t\tfield := &graphql.Field{\n\t\t\tName: name,\n\t\t\tType: gType,\n\t\t\tDescription: node.description,\n\t\t\tResolve: node.resolver,\n\t\t\tArgs: node.resolverArgs,\n\t\t}\n\t\tresult[name] = field\n\t}\n\treturn result, nil\n}", "func (c MethodsCollection) FieldsGet() pFieldsGet {\n\treturn pFieldsGet{\n\t\tMethod: c.MustGet(\"FieldsGet\"),\n\t}\n}", "func (m *SubCategoryTemplate) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := m.FilePlanDescriptorTemplate.GetFieldDeserializers()\n return res\n}", "func Fields(msg proto.Message, processors ...FieldProcessor) Results {\n\tif len(processors) == 0 {\n\t\treturn nil\n\t}\n\t// 32 is a guess at how deep the Path could get.\n\t//\n\t// There's really no way to know ahead of time (since proto messages could\n\t// have a recursive structure, allowing the expression of trees, etc.)\n\treturn fieldsImpl(make(reflectutil.Path, 0, 32), msg.ProtoReflect(), lookupProcBundles(processors...))\n}", "func (r FieldRule) getFieldInfo(expr ast.Expr) fieldInfos {\n\tswitch t := expr.(type) {\n\tcase *ast.Ident:\n\t\tif t.Obj == nil || t.Obj.Decl == nil {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn r.getFieldInfoFromDecl(t.Obj.Decl)\n\tdefault:\n\t\tpepperlint.Log(\"TODO: getInternalTypeSpec %T\", t)\n\t}\n\n\treturn nil\n}", "func (entry *Entry) Fields() Fields {\n\treturn entry.fields\n}", "func (LevelOfDangerous) Fields() []ent.Field {\r\n\treturn []ent.Field{\r\n\t\tfield.String(\"name\"),\r\n\t}\r\n}", "func (s *Set) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error) {\n\tpanic(\"implement me\")\n}", "func (f *Field) Fields() []*Field {\n\treturn getFields(f.value, f.defaultTag)\n}", "func (d *Day16) getFieldOrder(order []field, fields []field, tickets []ticket) []field {\n\tif len(fields) == 0 && d.validOrderUntilNow(order, tickets) {\n\t\treturn order\n\t}\n\tfor i, f := range fields {\n\t\tnewOrder := make([]field, len(order), len(order)+1)\n\t\tcopy(newOrder, order)\n\t\tnewOrder = append(newOrder, f)\n\t\tif d.validOrderUntilNow(newOrder, tickets) {\n\t\t\tfieldsLeft := RemoveFieldAtIndex(fields, i)\n\t\t\tnewOrder = d.getFieldOrder(newOrder, fieldsLeft, tickets)\n\t\t\tif newOrder != nil {\n\t\t\t\treturn newOrder\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (m *ParentLabelDetails) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"color\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetColor(val)\n }\n return nil\n }\n res[\"description\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetDescription(val)\n }\n return nil\n }\n res[\"id\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetId(val)\n }\n return nil\n }\n res[\"isActive\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetBoolValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetIsActive(val)\n }\n return nil\n }\n res[\"name\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetName(val)\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n res[\"parent\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetObjectValue(CreateParentLabelDetailsFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetParent(val.(ParentLabelDetailsable))\n }\n return nil\n }\n res[\"sensitivity\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetInt32Value()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetSensitivity(val)\n }\n return nil\n }\n res[\"tooltip\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetTooltip(val)\n }\n return nil\n }\n return res\n}", "func (m *AuditLogRoot) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := m.Entity.GetFieldDeserializers()\n res[\"directoryAudits\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreateDirectoryAuditFromDiscriminatorValue , m.SetDirectoryAudits)\n res[\"provisioning\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreateProvisioningObjectSummaryFromDiscriminatorValue , m.SetProvisioning)\n res[\"signIns\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreateSignInFromDiscriminatorValue , m.SetSignIns)\n return res\n}", "func getAllFields(o interface{}) map[string]interface{} {\n\tt := reflect.TypeOf(o)\n\tif t.Kind() == reflect.Ptr || t.Kind() == reflect.Interface {\n\t\tt = reflect.ValueOf(o).Elem().Type()\n\t\to = reflect.ValueOf(o).Elem().Interface()\n\t}\n\n\tchanges := make(map[string]interface{})\n\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tfield := t.Field(i)\n\t\tvalue, exists := field.Tag.Lookup(changeTag)\n\t\tif exists {\n\t\t\tif value == \"inner\" {\n\n\t\t\t\tchanges[field.Name] = getAllFields(reflect.ValueOf(o).FieldByName(field.Name).Interface())\n\t\t\t} else {\n\t\t\t\tjsonFieldName, exists := field.Tag.Lookup(\"json\")\n\n\t\t\t\tif !exists {\n\t\t\t\t\tjsonFieldName = field.Name\n\t\t\t\t} else {\n\t\t\t\t\tcommaIndex := strings.Index(jsonFieldName, \",\")\n\t\t\t\t\tif commaIndex != -1 {\n\t\t\t\t\t\tjsonFieldName = jsonFieldName[:commaIndex]\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tchangeField := &ChangeField{\n\t\t\t\t\tValue: getValue(o, field.Name),\n\t\t\t\t\tField: jsonFieldName,\n\t\t\t\t}\n\t\t\t\tchanges[field.Name] = changeField\n\t\t\t}\n\t\t}\n\t}\n\treturn changes\n}", "func StructFields(v interface{}) (vType reflect.Type, vFields []*TField) {\n\tvar (\n\t\tfield reflect.StructField\n\t)\n\tvType = reflect.Indirect(reflect.ValueOf(v)).Type()\n\tnumFields := vType.NumField()\n\tvFields = make([]*TField, 0, numFields)\n\tfor i := 0; i < numFields; i++ {\n\t\tfield = vType.Field(i)\n\t\tfieldInfo := &TField{\n\t\t\tFname: field.Name,\n\t\t\tFtype: field.Type.String(),\n\t\t\tFkind: field.Type.Kind(),\n\t\t\tFtags: field.Tag,\n\t\t}\n\t\tif field.PkgPath == \"\" {\n\t\t\tfieldInfo.Fexported = true\n\t\t}\n\t\tvFields = append(vFields, fieldInfo)\n\t}\n\treturn\n}", "func fields(spec *ast.TypeSpec) []*ast.Field {\n\ts := make([]*ast.Field, 0)\n\tif structType, ok := spec.Type.(*ast.StructType); ok {\n\t\tfor _, field := range structType.Fields.List {\n\t\t\tif keyname(field) != \"\" {\n\t\t\t\ts = append(s, field)\n\t\t\t}\n\t\t}\n\t}\n\treturn s\n}", "func (upd *Update) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error) {\n\treturn nil, fmt.Errorf(\"BUG: unreachable code for %q\", upd.Query)\n}", "func GetFieldMap(obj interface{}) (ret map[string]string) {\n\tval := reflect.ValueOf(obj).Elem()\n\tret = make(map[string]string)\n\tfor i := 0; i < val.NumField(); i++ {\n\t\ttypeField := val.Type().Field(i)\n\t\tkey := strings.ToLower(typeField.Name)\n\t\tif typeField.PkgPath != \"\" {\n\t\t\t// Private method\n\t\t\tcontinue\n\t\t} else {\n\t\t\tret[key] = typeField.Name\n\t\t}\n\t}\n\treturn\n}", "func (e *Extractor) fields(s reflect.Value) []field {\n\tfields := make([]field, 0, s.NumField())\n\n\tfor i := 0; i < s.NumField(); i++ {\n\t\tif isIgnored(s.Type().Field(i).Name, e.ignoredFields) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif s.Type().Field(i).Anonymous {\n\t\t\tif e.useEmbeddedStructs {\n\t\t\t\tfields = append(fields, e.fields(s.Field(i))...)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\ttag := s.Type().Field(i).Tag\n\t\tname := s.Type().Field(i).Name\n\t\tvalue := s.Field(i)\n\t\tfields = append(fields, field{value, name, tag})\n\t}\n\n\treturn fields\n}", "func (e Matcher_MatcherTree_MatchMapValidationError) Field() string { return e.field }", "func (l *Lock) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error) {\n\treturn nil, vterrors.New(vtrpc.Code_UNIMPLEMENTED, \"not implements in lock primitive\")\n}", "func (fm *FinalModelStructBytes) GetFields(fbeValue *StructBytes) (int, error) {\n var err error = nil\n fbeCurrentOffset := 0\n fbeCurrentSize := 0\n fbeFieldSize := 0\n\n fm.F1.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F1, fbeFieldSize, err = fm.F1.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F2.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F2, fbeFieldSize, err = fm.F2.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F3.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F3, fbeFieldSize, err = fm.F3.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n return fbeCurrentSize, err\n}", "func (i PullAll) Fields() []interface{} {\n\treturn nil\n}", "func (s *SoExtFollowingWrap) getModifiedFields(oriTable *SoExtFollowing, curTable *SoExtFollowing) (map[string]bool, bool, error) {\n\tif oriTable == nil {\n\t\treturn nil, false, errors.New(\"table info is nil, can't get modified fields\")\n\t}\n\thasWatcher := false\n\tfields := make(map[string]bool)\n\n\tif !reflect.DeepEqual(oriTable.FollowingCreatedOrder, curTable.FollowingCreatedOrder) {\n\t\tfields[\"FollowingCreatedOrder\"] = true\n\t\thasWatcher = hasWatcher || s.watcherFlag.HasFollowingCreatedOrderWatcher\n\t}\n\n\thasWatcher = hasWatcher || s.watcherFlag.WholeWatcher\n\treturn fields, hasWatcher, nil\n}", "func (e Department) EntFields() ent.Fields { return ent_Department_fields }", "func (Project) Fields() []ent.Field {\n\treturn nil\n}", "func (f Fields) Fields() map[string]interface{} {\n\treturn f\n}", "func (m *Store) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := m.Entity.GetFieldDeserializers()\n res[\"defaultLanguageTag\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetStringValue(m.SetDefaultLanguageTag)\n res[\"groups\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreateGroupFromDiscriminatorValue , m.SetGroups)\n res[\"languageTags\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfPrimitiveValues(\"string\" , m.SetLanguageTags)\n res[\"sets\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreateSetFromDiscriminatorValue , m.SetSets)\n return res\n}", "func expandFields(compiled *lang.CompiledExpr, define *lang.DefineExpr) lang.DefineFieldsExpr {\n\tvar fields lang.DefineFieldsExpr\n\tfor _, field := range define.Fields {\n\t\tif isEmbeddedField(field) {\n\t\t\tembedded := expandFields(compiled, compiled.LookupDefine(string(field.Type)))\n\t\t\tfields = append(fields, embedded...)\n\t\t} else {\n\t\t\tfields = append(fields, field)\n\t\t}\n\t}\n\treturn fields\n}", "func (w *RootWalker) GetFromRefsField(fieldName string, p interface{}, finder func(i int, ref skyobject.Reference) bool) error {\n\t_, e := w.getFromRefsField(fieldName, p, finder)\n\treturn e\n}", "func fields(t reflect.Type) map[string]interface{} {\n\tfieldCache.RLock()\n\tfs := fieldCache.m[t]\n\tfieldCache.RUnlock()\n\n\t//Cached version exists\n\tif fs != nil {\n\t\treturn fs\n\t}\n\t//This is to prevent multiple goroutines computing the same thing\n\tfieldCache.Lock()\n\tvar sy *sync.WaitGroup\n\tif sy, ok := fieldCache.create[t]; ok {\n\t\tfieldCache.Unlock()\n\t\tsy.Wait()\n\t\treturn fields(t)\n\t}\n\tsy = &sync.WaitGroup{}\n\tfieldCache.create[t] = sy\n\tsy.Add(1)\n\tfieldCache.Unlock()\n\n\tfs = compileStruct(t)\n\n\tfieldCache.Lock()\n\tfieldCache.m[t] = fs\n\tfieldCache.Unlock()\n\tsy.Done()\n\treturn fs\n}", "func (op *metadataLookup) field(parentFunc *stmt.CallExpr, expr stmt.Expr) {\n\tif op.err != nil {\n\t\treturn\n\t}\n\tswitch e := expr.(type) {\n\tcase *stmt.SelectItem:\n\t\top.field(nil, e.Expr)\n\tcase *stmt.CallExpr:\n\t\tif e.FuncType == function.Quantile {\n\t\t\top.planHistogramFields(e)\n\t\t\treturn\n\t\t}\n\t\tfor _, param := range e.Params {\n\t\t\top.field(e, param)\n\t\t}\n\tcase *stmt.ParenExpr:\n\t\top.field(nil, e.Expr)\n\tcase *stmt.BinaryExpr:\n\t\top.field(nil, e.Left)\n\t\top.field(nil, e.Right)\n\tcase *stmt.FieldExpr:\n\t\tqueryStmt := op.executeCtx.Query\n\t\tfieldMeta, err := op.metadata.GetField(queryStmt.Namespace, queryStmt.MetricName, field.Name(e.Name))\n\t\tif err != nil {\n\t\t\top.err = err\n\t\t\treturn\n\t\t}\n\n\t\top.planField(parentFunc, fieldMeta)\n\t}\n}", "func fileFields(path string) (base string, root string, ext string, dirname string) {\n\tbase = lastInPath(path)\n\tbaseNoLeadingPeriods, nPeriods := trimLeading(base, \".\")\n\ttmp := strings.Split(baseNoLeadingPeriods, \".\")\n\tif len(tmp) == 1 {\n\t\t// no file extension\n\t\troot = tmp[0]\n\t\text = \"\"\n\t} else {\n\t\troot = strings.Join(tmp[:len(tmp)-1], \".\")\n\t\text = \".\" + tmp[len(tmp)-1]\n\t}\n\t// add back any leading periods that were trimmed from base\n\troot = strings.Repeat(\".\", nPeriods) + root\n\tdirname = strings.TrimSuffix(path, fmt.Sprintf(\"/%v\", base))\n\treturn base, root, ext, dirname\n}", "func (s *scanner) structFields(structType reflect.Type) ([]*r.Field, error) {\n\tfmPtr := reflect.New(structType).Interface()\n\tm, err := r.StructFieldMap(fmPtr, true)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not decode struct of type %T: %v\", fmPtr, err)\n\t}\n\n\tstructFields := make([]*r.Field, len(s.stmt.fieldNames))\n\tfor i, fieldName := range s.stmt.fieldNames {\n\t\tfield, ok := m[strings.ToLower(fieldName)]\n\t\tif !ok { // the field doesn't have a destination\n\t\t\tstructFields[i] = nil\n\t\t} else {\n\t\t\tstructFields[i] = &field\n\t\t}\n\t}\n\treturn structFields, nil\n}", "func (r *Route) Fields() RouteInfo {\n\tr.mu.RLock()\n\tdefer r.mu.RUnlock()\n\treturn r.fieldsLocked()\n}", "func (i *Index) openFields() error {\n\tf, err := os.Open(i.path)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"opening directory\")\n\t}\n\tdefer f.Close()\n\n\tfis, err := f.Readdir(0)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"reading directory\")\n\t}\n\n\tfor _, fi := range fis {\n\t\tif !fi.IsDir() {\n\t\t\tcontinue\n\t\t}\n\n\t\tfld, err := i.newField(i.fieldPath(filepath.Base(fi.Name())), filepath.Base(fi.Name()))\n\t\tif err != nil {\n\t\t\treturn ErrName\n\t\t}\n\t\tif err := fld.Open(); err != nil {\n\t\t\treturn fmt.Errorf(\"open field: name=%s, err=%s\", fld.Name(), err)\n\t\t}\n\t\ti.fields[fld.Name()] = fld\n\t}\n\treturn nil\n}", "func (s *Struct) structFields() []reflect.StructField {\n\tt := s.value.Type()\n\n\tvar f []reflect.StructField\n\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tfield := t.Field(i)\n\t\t// we can't access the value of unexported fields\n\t\tif field.PkgPath != \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\t// don't check if it's omitted\n\t\tif tag := field.Tag.Get(s.TagName); tag == \"-\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tf = append(f, field)\n\t}\n\n\treturn f\n}", "func TypeFields(t *Type) (fields []*Field) {\n\n\tif t == nil {\n\t\treturn\n\t}\n\n\tfor _, spec := range t.Decl.Specs {\n\n\t\ttypeSpec := spec.(*ast.TypeSpec)\n\n\t\t// struct type\n\t\tif str, ok := typeSpec.Type.(*ast.StructType); ok {\n\n\t\t\tfor _, f := range str.Fields.List {\n\t\t\t\tfields = append(fields, &Field{\n\t\t\t\t\tField: f,\n\t\t\t\t\tType: t,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\t// interface type methods\n\t\tif str, ok := typeSpec.Type.(*ast.InterfaceType); ok {\n\t\t\tfor _, field := range str.Methods.List {\n\t\t\t\tif ident, ok := field.Type.(*ast.Ident); ok && ident.Obj != nil {\n\t\t\t\t\tfield.Names = []*ast.Ident{ident}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor _, f := range str.Methods.List {\n\t\t\t\tfields = append(fields, &Field{\n\t\t\t\t\tField: f,\n\t\t\t\t\tType: t,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "func (svc record) readableFields(m *types.Module) []string {\n\tff := make([]string, 0)\n\n\t_ = m.Fields.Walk(func(f *types.ModuleField) error {\n\t\tif svc.ac.CanReadRecordValue(svc.ctx, f) {\n\t\t\tff = append(ff, f.Name)\n\t\t}\n\n\t\treturn nil\n\t})\n\n\treturn ff\n}", "func eachSubField(i interface{}, fn func(reflect.Value, string, []string) error, crumbs ...string) error {\n\tt := reflect.ValueOf(i)\n\tif t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {\n\t\treturn errors.New(\"eachSubField can only be called on a pointer-to-struct\")\n\t}\n\t// Sanity check. Should be true if it is a pointer-to-struct\n\tif !t.Elem().CanSet() {\n\t\treturn errors.New(\"eachSubField can only be called on a settable struct of structs\")\n\t}\n\n\tt = t.Elem()\n\tnf := t.NumField()\n\tfor i := 0; i < nf; i++ {\n\t\tfield := t.Field(i)\n\t\tsf := t.Type().Field(i)\n\t\tif sf.Tag.Get(\"flag\") == \"false\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tif field.Kind() == reflect.Struct && field.CanSet() {\n\t\t\teachSubField(field.Addr().Interface(), fn, append(crumbs, sf.Name)...)\n\t\t} else if field.CanSet() {\n\t\t\tif err := fn(t, sf.Name, crumbs); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (t *Type) FieldSlice() []*Field", "func (c *ProjectsGetAncestryCall) Fields(s ...googleapi.Field) *ProjectsGetAncestryCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func GetFields(m interface{}) (ns []string) {\n\ttyp := GetType(m)\n\t// Only structs are supported so return an empty result if the passed object\n\t// isn't a struct\n\tif typ.Kind() != reflect.Struct {\n\t\tfmt.Printf(\"%v type can't have attributes inspected\\n\", typ.Kind())\n\t\treturn\n\t}\n\t// loop through the struct's fields\n\tfor i := 0; i < typ.NumField(); i++ {\n\t\tf := typ.Field(i)\n\t\tif f.Anonymous {\n\t\t\tfkind := f.Type.Kind()\n\t\t\tif fkind == reflect.Struct || fkind == reflect.Ptr {\n\t\t\t\tfns := GetFields(reflect.New(f.Type).Interface())\n\t\t\t\tfor _, fn := range fns {\n\t\t\t\t\tif String(fn).IsInArray(ns) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tns = append(ns, fn)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif String(f.Name).IsInArray(ns) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tns = append(ns, f.Name)\n\t\t}\n\t}\n\treturn ns\n}", "func GetRootFields() graphql.Fields {\n\treturn graphql.Fields{\n\t\t\"program\": GetProgramQuery(),\n\t\t\"programs\": GetProgramsQuery(),\n\t\t\"production\": GetProductionQuery(),\n\t\t\"productions\": GetProductionsQuery(),\n\t}\n}", "func (p *Parser) ReadFields(data interface{}) {\n\tconfig.ReadData(p, data)\n}", "func (n *nodeHeader) prefixFields() (*uint16, []byte) {\n\tswitch n.typ {\n\tcase typLeaf:\n\t\t// Leaves have no prefix\n\t\treturn nil, nil\n\tcase typNode4:\n\t\tn4 := n.node4()\n\t\treturn &n4.prefixLen, n4.prefix[:]\n\n\tcase typNode16:\n\t\tn16 := n.node16()\n\t\treturn &n16.prefixLen, n16.prefix[:]\n\n\tcase typNode48:\n\t\tn48 := n.node48()\n\t\treturn &n48.prefixLen, n48.prefix[:]\n\n\tcase typNode256:\n\t\tn256 := n.node256()\n\t\treturn &n256.prefixLen, n256.prefix[:]\n\t}\n\tpanic(\"invalid type\")\n}", "func (e FailError) Fields() vals.StructMap { return failFields{e} }", "func decorateFieldGetter(t *TopLevelType) *TopLevelType {\n\tnewT := t.DeepCopy().(*TopLevelType)\n\tnewT.OriginalType = t.Type\n\n\tswitch tt := newT.Type.(type) {\n\tcase *ModeledType:\n\t\tif tt.IsPtr || tt.Interface != nil || tt.IsBuiltin {\n\t\t\treturn t\n\t\t}\n\t\ttt.IsPtr = true\n\tcase *ArrayType:\n\t\treturn t\n\tcase *MapType:\n\t\treturn t\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unsupported type: %T\", newT.Type))\n\t}\n\n\treturn newT\n}", "func (fm *FinalModelStructOptional) GetFields(fbeValue *StructOptional) (int, error) {\n var err error = nil\n fbeCurrentOffset := 0\n fbeCurrentSize := 0\n fbeFieldSize := 0\n\n fm.FinalModelStructSimple.SetFBEOffset(fbeCurrentOffset)\n if fbeFieldSize, err = fm.FinalModelStructSimple.GetFields(fbeValue.StructSimple); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F100.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F100, fbeFieldSize, err = fm.F100.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F101.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F101, fbeFieldSize, err = fm.F101.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F102.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F102, fbeFieldSize, err = fm.F102.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F103.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F103, fbeFieldSize, err = fm.F103.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F104.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F104, fbeFieldSize, err = fm.F104.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F105.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F105, fbeFieldSize, err = fm.F105.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F106.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F106, fbeFieldSize, err = fm.F106.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F107.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F107, fbeFieldSize, err = fm.F107.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F108.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F108, fbeFieldSize, err = fm.F108.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F109.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F109, fbeFieldSize, err = fm.F109.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F110.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F110, fbeFieldSize, err = fm.F110.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F111.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F111, fbeFieldSize, err = fm.F111.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F112.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F112, fbeFieldSize, err = fm.F112.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F113.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F113, fbeFieldSize, err = fm.F113.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F114.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F114, fbeFieldSize, err = fm.F114.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F115.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F115, fbeFieldSize, err = fm.F115.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F116.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F116, fbeFieldSize, err = fm.F116.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F117.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F117, fbeFieldSize, err = fm.F117.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F118.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F118, fbeFieldSize, err = fm.F118.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F119.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F119, fbeFieldSize, err = fm.F119.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F120.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F120, fbeFieldSize, err = fm.F120.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F121.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F121, fbeFieldSize, err = fm.F121.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F122.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F122, fbeFieldSize, err = fm.F122.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F123.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F123, fbeFieldSize, err = fm.F123.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F124.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F124, fbeFieldSize, err = fm.F124.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F125.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F125, fbeFieldSize, err = fm.F125.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F126.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F126, fbeFieldSize, err = fm.F126.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F127.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F127, fbeFieldSize, err = fm.F127.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F128.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F128, fbeFieldSize, err = fm.F128.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F129.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F129, fbeFieldSize, err = fm.F129.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F130.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F130, fbeFieldSize, err = fm.F130.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F131.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F131, fbeFieldSize, err = fm.F131.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F132.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F132, fbeFieldSize, err = fm.F132.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F133.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F133, fbeFieldSize, err = fm.F133.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F134.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F134, fbeFieldSize, err = fm.F134.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F135.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F135, fbeFieldSize, err = fm.F135.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F136.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F136, fbeFieldSize, err = fm.F136.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F137.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F137, fbeFieldSize, err = fm.F137.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F138.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F138, fbeFieldSize, err = fm.F138.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F139.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F139, fbeFieldSize, err = fm.F139.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F140.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F140, fbeFieldSize, err = fm.F140.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F141.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F141, fbeFieldSize, err = fm.F141.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F142.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F142, fbeFieldSize, err = fm.F142.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F143.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F143, fbeFieldSize, err = fm.F143.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F144.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F144, fbeFieldSize, err = fm.F144.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F145.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F145, fbeFieldSize, err = fm.F145.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F146.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F146, fbeFieldSize, err = fm.F146.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F147.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F147, fbeFieldSize, err = fm.F147.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F148.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F148, fbeFieldSize, err = fm.F148.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F149.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F149, fbeFieldSize, err = fm.F149.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F150.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F150, fbeFieldSize, err = fm.F150.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F151.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F151, fbeFieldSize, err = fm.F151.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F152.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F152, fbeFieldSize, err = fm.F152.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F153.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F153, fbeFieldSize, err = fm.F153.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F154.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F154, fbeFieldSize, err = fm.F154.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F155.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F155, fbeFieldSize, err = fm.F155.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F156.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F156, fbeFieldSize, err = fm.F156.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F157.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F157, fbeFieldSize, err = fm.F157.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F158.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F158, fbeFieldSize, err = fm.F158.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F159.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F159, fbeFieldSize, err = fm.F159.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F160.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F160, fbeFieldSize, err = fm.F160.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F161.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F161, fbeFieldSize, err = fm.F161.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F162.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F162, fbeFieldSize, err = fm.F162.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F163.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F163, fbeFieldSize, err = fm.F163.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F164.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F164, fbeFieldSize, err = fm.F164.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n fm.F165.SetFBEOffset(fbeCurrentOffset)\n if fbeValue.F165, fbeFieldSize, err = fm.F165.Get(); err != nil {\n return fbeCurrentSize, err\n }\n fbeCurrentOffset += fbeFieldSize\n fbeCurrentSize += fbeFieldSize\n\n return fbeCurrentSize, err\n}", "func (pf *PathFilter) Fields(contentPath string) map[string]string {\n\tout := make(map[string]string)\n\n\tmatch := pf.re.FindStringSubmatch(contentPath)\n\tnames := pf.re.SubexpNames()\n\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tfmt.Println(\"path filter fields is crashing the app\")\n\t\t\tspew.Dump(contentPath, pf.filterPath, pf.re.String(), match, names)\n\t\t\tpanic(\"i'm done\")\n\t\t}\n\t}()\n\n\tfor i, name := range names {\n\t\tif i != 0 && name != \"\" {\n\t\t\tout[name] = match[i]\n\t\t}\n\t}\n\n\treturn out\n}", "func (m *LevelMutation) Fields() []string {\n\tfields := make([]string, 0, 1)\n\tif m._LevelName != nil {\n\t\tfields = append(fields, level.FieldLevelName)\n\t}\n\treturn fields\n}", "func (m *PolicyRule) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := m.Entity.GetFieldDeserializers()\n res[\"name\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetName(val)\n }\n return nil\n }\n return res\n}", "func (o *NotificationAllOf) GetFieldsOk() (*map[string]interface{}, bool) {\n\tif o == nil || o.Fields == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Fields, true\n}", "func (s UserSet) FieldsGet(args models.FieldsGetArgs) map[string]*models.FieldInfo {\n\tres := s.Collection().Call(\"FieldsGet\", args)\n\tresTyped, _ := res.(map[string]*models.FieldInfo)\n\treturn resTyped\n}", "func getField(n string, i interface{}) (interface{}, bool) {\n\tre := reflect.ValueOf(i).Elem()\n\tif re.Kind() == reflect.Struct {\n\t\tf := re.FieldByName(n)\n\n\t\tif f.IsValid() {\n\t\t\treturn f.Interface(), true\n\t\t}\n\t}\n\n\treturn nil, false\n}", "func (r *ReflectMapper) FieldMap(v reflect.Value) map[string]reflect.Value {\n\tv = reflect.Indirect(v)\n\n\tret := map[string]reflect.Value{}\n\ttm := r.mapper.TypeMap(v.Type())\n\tfor tagName, fi := range tm.Names {\n\t\t//fmt.Println(tagName,fi.Parent.Zero.Kind(),fi.Parent.Field.Anonymous)\n\t\tif (fi.Parent.Zero.Kind() == reflect.Struct || (fi.Zero.Kind() == reflect.Ptr && fi.Zero.Type().Elem().Kind() == reflect.Struct)) && !fi.Parent.Field.Anonymous {\n\t\t\tcontinue\n\t\t}\n\t\tret[tagName] = reflectx.FieldByIndexes(v, fi.Index)\n\t}\n\n\treturn ret\n}", "func (d Document) Fields() []string {\n\treturn d.data.fields\n}", "func (Menu) Fields() []ent.Field {\n\treturn nil\n}", "func (m *Reports) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := m.Entity.GetFieldDeserializers()\n return res\n}", "func isLteField(fl FieldLevel) bool {\n\tfield := fl.Field()\n\tkind := field.Kind()\n\n\tcurrentField, currentKind, ok := fl.GetStructFieldOK()\n\tif !ok || currentKind != kind {\n\t\treturn false\n\t}\n\n\tswitch kind {\n\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\n\t\treturn field.Int() <= currentField.Int()\n\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\n\t\treturn field.Uint() <= currentField.Uint()\n\n\tcase reflect.Float32, reflect.Float64:\n\n\t\treturn field.Float() <= currentField.Float()\n\n\tcase reflect.Struct:\n\n\t\tfieldType := field.Type()\n\n\t\tif fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) {\n\n\t\t\tt := currentField.Convert(timeType).Interface().(time.Time)\n\t\t\tfieldTime := field.Convert(timeType).Interface().(time.Time)\n\n\t\t\treturn fieldTime.Before(t) || fieldTime.Equal(t)\n\t\t}\n\n\t\t// Not Same underlying type i.e. struct and time\n\t\tif fieldType != currentField.Type() {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// default reflect.String\n\treturn len(field.String()) <= len(currentField.String())\n}", "func (m *Planner) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := m.Entity.GetFieldDeserializers()\n res[\"buckets\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreatePlannerBucketFromDiscriminatorValue , m.SetBuckets)\n res[\"plans\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreatePlannerPlanFromDiscriminatorValue , m.SetPlans)\n res[\"tasks\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreatePlannerTaskFromDiscriminatorValue , m.SetTasks)\n return res\n}", "func (m *AdminReportSettings) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := m.Entity.GetFieldDeserializers()\n res[\"displayConcealedNames\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetBoolValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetDisplayConcealedNames(val)\n }\n return nil\n }\n return res\n}", "func (m *Descriptor) GetMessageFields() []*FieldDescriptor { return m.Fields }", "func (fp *slicingFieldParser) getTaggedFields(str *[]byte) (map[string]string, error) {\n\tfields := make(map[string]string, 20)\n\tfor {\n\t\tnextTag, err := fp.nextField(str, equalsBytes, true) // Expect at least a value after the tag\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"parsing next tag: %w\", err)\n\t\t}\n\n\t\tnextValue, err := fp.nextField(str, spaceBytes, false) // We cannot expect any more fields as this may be the last\n\t\tif err != nil && err != io.EOF {\n\t\t\treturn nil, fmt.Errorf(\"parsing next tagged value: %w\", err)\n\t\t}\n\n\t\tfields[nextTag] = nextValue\n\n\t\tif err == io.EOF { // No more fields in stream\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn fields, nil\n}", "func (m *TargetManager) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := m.SubjectSet.GetFieldDeserializers()\n res[\"managerLevel\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetInt32Value(m.SetManagerLevel)\n return res\n}", "func (m *MacroEvaluator) GetFields() []Field {\n\tfields := make([]Field, len(m.FieldValues))\n\ti := 0\n\tfor key := range m.FieldValues {\n\t\tfields[i] = key\n\t\ti++\n\t}\n\treturn fields\n}", "func (sh *Hook) Fields() map[string]interface{} {\n\treturn sh.fields\n}", "func (u ConfluenceServerUserV1) GetFields() logrus.Fields {\n\treturn logrus.Fields{\n\t\t\"Host\": u.Host,\n\t\t\"Port\": u.Port,\n\t\t\"Description\": u.Description,\n\t\t\"Auth\": u.Auth.GetFields(),\n\t}\n}", "func (c MethodsCollection) FieldGet() pFieldGet {\n\treturn pFieldGet{\n\t\tMethod: c.MustGet(\"FieldGet\"),\n\t}\n}" ]
[ "0.61212295", "0.5837798", "0.5814727", "0.57181865", "0.56932044", "0.5691752", "0.56457984", "0.56295365", "0.5619157", "0.56047153", "0.55527204", "0.5524664", "0.5486085", "0.5475357", "0.5453594", "0.5439258", "0.5431331", "0.54223394", "0.54207104", "0.54119086", "0.53684807", "0.53610134", "0.5333137", "0.5312929", "0.5310961", "0.53053457", "0.53016186", "0.52949023", "0.52445155", "0.5238158", "0.52348644", "0.52335066", "0.5232413", "0.52235883", "0.52160823", "0.52118987", "0.5199386", "0.5197722", "0.5192848", "0.5186224", "0.5185207", "0.51843816", "0.5157361", "0.51572603", "0.5156397", "0.5136306", "0.5119913", "0.51093525", "0.5094425", "0.50698143", "0.5068588", "0.5066323", "0.50593615", "0.5057461", "0.5053655", "0.5051799", "0.5049374", "0.5044848", "0.50429153", "0.50394005", "0.5037606", "0.50358254", "0.5031969", "0.50217474", "0.50141734", "0.5011943", "0.5011099", "0.5008504", "0.49839044", "0.49817932", "0.4980802", "0.49779838", "0.49710244", "0.49579832", "0.4951412", "0.4941188", "0.4941126", "0.4922502", "0.49216717", "0.49209705", "0.49150345", "0.49127144", "0.49033496", "0.49026254", "0.48967338", "0.48945376", "0.48940632", "0.48938534", "0.4884627", "0.48804134", "0.48762256", "0.48722547", "0.4867748", "0.48670414", "0.48644316", "0.48634696", "0.48633027", "0.4856444", "0.48509735", "0.48507622" ]
0.79517883
0
NewCopyRecipeToMyRecipesWithChangesParams creates a new CopyRecipeToMyRecipesWithChangesParams object with the default values initialized.
NewCopyRecipeToMyRecipesWithChangesParams создает новый объект CopyRecipeToMyRecipesWithChangesParams с инициализацией значений по умолчанию.
func NewCopyRecipeToMyRecipesWithChangesParams() *CopyRecipeToMyRecipesWithChangesParams { var () return &CopyRecipeToMyRecipesWithChangesParams{ timeout: cr.DefaultTimeout, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewCopyRecipeToMyRecipesWithChangesParamsWithHTTPClient(client *http.Client) *CopyRecipeToMyRecipesWithChangesParams {\n\tvar ()\n\treturn &CopyRecipeToMyRecipesWithChangesParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewCopyRecipeToMyRecipesWithChangesParamsWithTimeout(timeout time.Duration) *CopyRecipeToMyRecipesWithChangesParams {\n\tvar ()\n\treturn &CopyRecipeToMyRecipesWithChangesParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) WithContext(ctx context.Context) *CopyRecipeToMyRecipesWithChangesParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) WithTimeout(timeout time.Duration) *CopyRecipeToMyRecipesWithChangesParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) WithHTTPClient(client *http.Client) *CopyRecipeToMyRecipesWithChangesParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewCopyRecipeToMyRecipesWithChangesParamsWithContext(ctx context.Context) *CopyRecipeToMyRecipesWithChangesParams {\n\tvar ()\n\treturn &CopyRecipeToMyRecipesWithChangesParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.JSONBody != nil {\n\t\tif err := r.SetBodyParam(o.JSONBody); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param recipeId\n\tif err := r.SetPathParam(\"recipeId\", o.RecipeID); 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}", "func (o *CopyRecipeToMyRecipesWithChangesParams) WithJSONBody(jSONBody *models.Recipe) *CopyRecipeToMyRecipesWithChangesParams {\n\to.SetJSONBody(jSONBody)\n\treturn o\n}", "func NewGetRecipesParams() GetRecipesParams {\n\n\tvar (\n\t\t// initialize parameters with default values\n\n\t\tingredient1Default = string(\"\")\n\t\tingredient2Default = string(\"\")\n\t\tingredient3Default = string(\"\")\n\t\tseasonDefault = string(\"\")\n\t)\n\n\treturn GetRecipesParams{\n\t\tIngredient1: &ingredient1Default,\n\n\t\tIngredient2: &ingredient2Default,\n\n\t\tIngredient3: &ingredient3Default,\n\n\t\tSeason: &seasonDefault,\n\t}\n}", "func (s *TemplateService) NewCopyTemplateParams(id string) *CopyTemplateParams {\n\tp := &CopyTemplateParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func NewCopyToArgs(nodeID NodeID, targetNodeID NodeID) *CopyToArgs {\n\targs := new(CopyToArgs)\n\targs.NodeID = nodeID\n\targs.TargetNodeID = targetNodeID\n\treturn args\n}", "func (f *FilterParams) Clone() *FilterParams {\n\tclone := &FilterParams{\n\t\tFilters: []*model.FilterSet{},\n\t}\n\tfor _, filters := range f.Filters {\n\t\tclone.Filters = append(clone.Filters, filters.Clone())\n\t}\n\tfor _, highlights := range f.Highlights {\n\t\tclone.Highlights = append(clone.Highlights, highlights.Clone())\n\t}\n\tclone.Invert = f.Invert\n\tclone.Variables = append(clone.Variables, f.Variables...)\n\tclone.Size = f.Size\n\tclone.DataMode = f.DataMode\n\treturn clone\n}", "func NewTransferParams(toWalletableId int32, toWalletableType string, fromWalletableId int32, fromWalletableType string, amount int32, date string, companyId int32, ) *TransferParams {\n\tthis := TransferParams{}\n\tthis.ToWalletableId = toWalletableId\n\tthis.ToWalletableType = toWalletableType\n\tthis.FromWalletableId = fromWalletableId\n\tthis.FromWalletableType = fromWalletableType\n\tthis.Amount = amount\n\tthis.Date = date\n\tthis.CompanyId = companyId\n\treturn &this\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) WithRecipeID(recipeID string) *CopyRecipeToMyRecipesWithChangesParams {\n\to.SetRecipeID(recipeID)\n\treturn o\n}", "func linkedConstructInputsCopyTo(ctx *pulumi.Context, inputs map[string]interface{}, args interface{}) error", "func NewParams(opts []copts.Opt) *Params {\r\n\tparams := &Params{}\r\n\tcopts.Apply(params, opts)\r\n\treturn params\r\n}", "func NewParams(opts []copts.Opt) *Params {\n\tparams := &Params{}\n\tcopts.Apply(params, opts)\n\treturn params\n}", "func NewCopy(ctx context.Context, cfg CopyConfig, reg *config_vars.Registry, client *http.Client, serverURL, workdir, userName, userEmail string, dep child.Child) (*gitilesParent, error) {\n\tif err := cfg.Validate(); err != nil {\n\t\treturn nil, skerr.Wrap(err)\n\t}\n\tgetContentsAtRev := func(ctx context.Context, rev *revision.Revision) (map[string]string, error) {\n\t\tfs, err := dep.VFS(ctx, rev)\n\t\tif err != nil {\n\t\t\treturn nil, skerr.Wrap(err)\n\t\t}\n\t\trv := map[string]string{}\n\t\tfor _, cp := range cfg.Copies {\n\t\t\tif err := vfs.Walk(ctx, fs, cp.SrcRelPath, func(fp string, info os.FileInfo, err error) error {\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn skerr.Wrap(err)\n\t\t\t\t}\n\t\t\t\tif info.IsDir() {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tcontents, err := vfs.ReadFile(ctx, fs, fp)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn skerr.Wrap(err)\n\t\t\t\t}\n\t\t\t\tif !strings.HasPrefix(fp, cp.SrcRelPath) {\n\t\t\t\t\treturn skerr.Fmt(\"Path %q does not have expected prefix %q\", fp, cp.SrcRelPath)\n\t\t\t\t}\n\t\t\t\tparentPath := path.Join(cp.DstRelPath, strings.TrimPrefix(fp, cp.SrcRelPath))\n\t\t\t\trv[parentPath] = string(contents)\n\t\t\t\treturn nil\n\t\t\t}); err != nil {\n\t\t\t\treturn nil, skerr.Wrap(err)\n\t\t\t}\n\t\t}\n\t\treturn rv, nil\n\t}\n\tgetChangesHelper := gitilesFileGetChangesForRollFunc(cfg.DependencyConfig)\n\tgetChangesForRoll := func(ctx context.Context, repo *gitiles_common.GitilesRepo, baseCommit string, from, to *revision.Revision, rolling []*revision.Revision) (map[string]string, error) {\n\t\tchanges, err := getChangesHelper(ctx, repo, baseCommit, from, to, rolling)\n\t\tif err != nil {\n\t\t\treturn nil, skerr.Wrap(err)\n\t\t}\n\t\tbefore, err := getContentsAtRev(ctx, from)\n\t\tif err != nil {\n\t\t\treturn nil, skerr.Wrap(err)\n\t\t}\n\t\tafter, err := getContentsAtRev(ctx, to)\n\t\tif err != nil {\n\t\t\treturn nil, skerr.Wrap(err)\n\t\t}\n\t\tfilenames := util.StringSet{}\n\t\tfor f := range before {\n\t\t\tfilenames[f] = true\n\t\t}\n\t\tfor f := range after {\n\t\t\tfilenames[f] = true\n\t\t}\n\t\tfor f := range filenames {\n\t\t\tif before[f] != after[f] {\n\t\t\t\tchanges[f] = after[f]\n\t\t\t}\n\t\t}\n\t\treturn changes, nil\n\t}\n\treturn newGitiles(ctx, cfg.GitilesConfig, reg, client, serverURL, getChangesForRoll)\n}", "func (in *NewPendingTxNotificationParams) DeepCopy() *NewPendingTxNotificationParams {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NewPendingTxNotificationParams)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewCopyTemplateRequest(server string, id string, body CopyTemplateJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewCopyTemplateRequestWithBody(server, id, \"application/json\", bodyReader)\n}", "func (params *headerParams) Copy() Params {\n\tdup := NewParams()\n\tfor _, key := range params.Keys() {\n\t\tif val, ok := params.Get(key); ok {\n\t\t\tdup.Add(key, val)\n\t\t}\n\t}\n\n\treturn dup\n}", "func Copy(scope *Scope, input tf.Output, optional ...CopyAttr) (output tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\tattrs := map[string]interface{}{}\n\tfor _, a := range optional {\n\t\ta(attrs)\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"Copy\",\n\t\tInput: []tf.Input{\n\t\t\tinput,\n\t\t},\n\t\tAttrs: attrs,\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func copyParams(r *http.Request) map[string]string {\n\tparamMap := make(map[string]string)\n\n\tfor k, v := range r.Form {\n\t\tparamMap[k] = v[0]\n\t}\n\n\treturn paramMap\n}", "func (in *NewPendingTxBodyNotificationParams) DeepCopy() *NewPendingTxBodyNotificationParams {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NewPendingTxBodyNotificationParams)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewQueryChangesParams() *QueryChangesParams {\n\treturn &QueryChangesParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewGetPublicsRecipeParams() *GetPublicsRecipeParams {\n\n\treturn &GetPublicsRecipeParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewNarrowSearchRecipeParams() *NarrowSearchRecipeParams {\n\tvar (\n\t\tsortbyDefault = string(\"name\")\n\t\tsortdirDefault = string(\"desc\")\n\t)\n\treturn &NarrowSearchRecipeParams{\n\t\tSortby: &sortbyDefault,\n\t\tSortdir: &sortdirDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (m *Message) Copy() *Message {\n\t// Create a new message\n\tnewMessage := &Message{}\n\n\t// Copy stuff from the old message\n\t*newMessage = *m\n\n\t// Copy any IRcv3 tags\n\tnewMessage.Tags = m.Tags.Copy()\n\n\t// Copy the Prefix\n\tnewMessage.Prefix = m.Prefix.Copy()\n\n\t// Copy the Params slice\n\tnewMessage.Params = append(make([]string, 0, len(m.Params)), m.Params...)\n\n\t// Similar to parsing, if Params is empty, set it to nil\n\tif len(newMessage.Params) == 0 {\n\t\tnewMessage.Params = nil\n\t}\n\n\treturn newMessage\n}", "func NewChange(templateItem *ResourceItem, platformItem *ResourceItem, comparison map[string]*jsonPatch) *Change {\n\tc := &Change{\n\t\tKind: templateItem.Kind,\n\t\tName: templateItem.Name,\n\t\tPatches: []*jsonPatch{},\n\t\tCurrentState: platformItem.YamlConfig(),\n\t\tDesiredState: templateItem.YamlConfig(),\n\t}\n\n\tfor path, patch := range comparison {\n\t\tif patch.Op != \"noop\" {\n\t\t\tcli.DebugMsg(\"add path\", path)\n\t\t\tpatch.Path = path\n\t\t\tc.addPatch(patch)\n\t\t}\n\t}\n\n\tif len(c.Patches) > 0 {\n\t\tc.Action = \"Update\"\n\t} else {\n\t\tc.Action = \"Noop\"\n\t}\n\n\treturn c\n}", "func (in *HelmRequest) DeepCopy() *HelmRequest {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HelmRequest)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func ParamChanges(r *rand.Rand) []simtypes.ParamChange {\n\treturn []simtypes.ParamChange{\n\t\tsimulation.NewSimParamChange(types.ModuleName, string(types.KeyMaxContractSize),\n\t\t\tfunc(r *rand.Rand) string {\n\t\t\t\treturn fmt.Sprintf(\"\\\"%d\\\"\", GenMaxContractSize(r))\n\t\t\t},\n\t\t),\n\t\tsimulation.NewSimParamChange(types.ModuleName, string(types.KeyMaxContractGas),\n\t\t\tfunc(r *rand.Rand) string {\n\t\t\t\treturn fmt.Sprintf(\"\\\"%d\\\"\", GenMaxContractGas(r))\n\t\t\t},\n\t\t),\n\t\tsimulation.NewSimParamChange(types.ModuleName, string(types.KeyMaxContractMsgSize),\n\t\t\tfunc(r *rand.Rand) string {\n\t\t\t\treturn fmt.Sprintf(\"\\\"%d\\\"\", GenMaxContractMsgSize(r))\n\t\t\t},\n\t\t),\n\t}\n}", "func (p *DiscoveryProtocol) copyNewDiscoveryRequest(request *api.DiscoveryRequest) *api.DiscoveryRequest {\n\treq := &api.DiscoveryRequest{DiscoveryMsgData: NewDiscoveryMsgData(uuid.Must(uuid.NewV4(), nil).String(), true, p.p2pHost),\n\t\tMessage: api.DiscoveryMessage_DiscoveryReq}\n\treq.DiscoveryMsgData.InitNodeID = request.DiscoveryMsgData.InitNodeID\n\treq.DiscoveryMsgData.TTL = request.DiscoveryMsgData.TTL\n\treq.DiscoveryMsgData.Expiry = request.DiscoveryMsgData.Expiry\n\treq.DiscoveryMsgData.InitHash = request.DiscoveryMsgData.InitHash\n\tlog.Println(\"COPYING: \", req.DiscoveryMsgData.InitHash)\n\n\tkey := p.p2pHost.Peerstore().PrivKey(p.p2pHost.ID())\n\treq.DiscoveryMsgData.MessageData.Sign = signProtoMsg(req, key)\n\treturn req\n}", "func (in *CredentialProviderRequest) DeepCopy() *CredentialProviderRequest {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CredentialProviderRequest)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewGetReceiptsParams() *GetReceiptsParams {\n\tvar ()\n\treturn &GetReceiptsParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (s settings) deepCopy() settings {\n\t// vmodule is a slice and would be shared, so we have copy it.\n\tfilter := make([]modulePat, len(s.vmodule.filter))\n\tfor i := range s.vmodule.filter {\n\t\tfilter[i] = s.vmodule.filter[i]\n\t}\n\ts.vmodule.filter = filter\n\n\tif s.logger != nil {\n\t\tlogger := *s.logger\n\t\ts.logger = &logger\n\t}\n\n\treturn s\n}", "func GetParamsForPopularRecipe(hfrt PopularRecipeType) (types.CoinInputList, types.ItemInputList, types.EntriesList, types.WeightedOutputsList, int64) {\n\tswitch hfrt {\n\tcase Rcp5xWoodcoinTo1xChaircoin: // 5 x woodcoin -> 1 x chair coin recipe\n\t\treturn types.GenCoinInputList(\"wood\", 5),\n\t\t\ttypes.ItemInputList{},\n\t\t\ttypes.GenCoinOnlyEntry(\"chair\"),\n\t\t\ttypes.GenOneOutput(1),\n\t\t\t0\n\tcase Rcp5BlockDelayed5xWoodcoinTo1xChaircoin: // 5 x woodcoin -> 1 x chair coin recipe, 5 block delayed\n\t\treturn types.GenCoinInputList(\"wood\", 5),\n\t\t\ttypes.ItemInputList{},\n\t\t\ttypes.GenCoinOnlyEntry(\"chair\"),\n\t\t\ttypes.GenOneOutput(1),\n\t\t\t5\n\tcase Rcp5xWoodcoinTo1xRaichuItemBuy:\n\t\treturn types.GenCoinInputList(\"wood\", 5),\n\t\t\ttypes.ItemInputList{},\n\t\t\ttypes.GenItemOnlyEntry(\"Raichu\"),\n\t\t\ttypes.GenOneOutput(1),\n\t\t\t0\n\tcase RcpRaichuNameUpgrade:\n\t\treturn types.CoinInputList{},\n\t\t\ttypes.GenItemInputList(\"Raichu\"),\n\t\t\ttypes.GenEntriesFirstItemNameUpgrade(\"RaichuV2\"),\n\t\t\ttypes.GenOneOutput(1),\n\t\t\t0\n\tcase RcpRaichuNameUpgradeWithCatalyst:\n\t\treturn types.CoinInputList{},\n\t\t\ttypes.GenItemInputList(\"RaichuTC\", \"catalyst\"),\n\t\t\ttypes.GenEntriesFirstItemNameUpgrade(\"RaichuTCV2\"),\n\t\t\ttypes.GenOneOutput(1),\n\t\t\t0\n\tcase Rcp2BlockDelayedKnifeUpgrade:\n\t\treturn types.CoinInputList{},\n\t\t\ttypes.GenItemInputList(\"Knife\"),\n\t\t\ttypes.GenEntriesFirstItemNameUpgrade(\"KnifeV2\"),\n\t\t\ttypes.GenOneOutput(1),\n\t\t\t2\n\tcase Rcp2BlockDelayedKnifeMerge:\n\t\treturn types.CoinInputList{},\n\t\t\ttypes.GenItemInputList(\"Knife\", \"Knife\"),\n\t\t\ttypes.GenItemOnlyEntry(\"KnifeMRG\"),\n\t\t\ttypes.GenOneOutput(1),\n\t\t\t2\n\tcase Rcp2BlockDelayedKnifeBuyer:\n\t\treturn types.GenCoinInputList(\"wood\", 5),\n\t\t\ttypes.ItemInputList{},\n\t\t\ttypes.GenItemOnlyEntry(\"Knife\"),\n\t\t\ttypes.GenOneOutput(1),\n\t\t\t2\n\tdefault: // 5 x woodcoin -> 1 x chair coin recipe, no delay\n\t\treturn types.GenCoinInputList(\"wood\", 5),\n\t\t\ttypes.ItemInputList{},\n\t\t\ttypes.GenEntries(\"chair\", \"Raichu\"),\n\t\t\ttypes.GenOneOutput(1),\n\t\t\t0\n\t}\n}", "func NewParams(createWhoisPrice string, updateWhoisPrice string, deleteWhoisPrice string) Params {\n\treturn Params{\n\t\tCreateWhoisPrice: createWhoisPrice,\n\t\tUpdateWhoisPrice: updateWhoisPrice,\n\t\tDeleteWhoisPrice: deleteWhoisPrice,\n\t}\n}", "func NewPostReconciliationParams() *PostReconciliationParams {\n\tvar ()\n\treturn &PostReconciliationParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewParams(pricePerByte abi.TokenAmount, paymentInterval uint64, paymentIntervalIncrease uint64) (Params, error) {\n\treturn Params{\n\t\tPricePerByte: pricePerByte,\n\t\tPaymentInterval: paymentInterval,\n\t\tPaymentIntervalIncrease: paymentIntervalIncrease,\n\t}, nil\n}", "func NewCalcOperationParams() CalcOperationParams {\n\n\treturn CalcOperationParams{}\n}", "func NewChatNewParams() *ChatNewParams {\n\tvar (\n\t\tchannelIDDefault = float64(1)\n\t)\n\treturn &ChatNewParams{\n\t\tChannelID: &channelIDDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (m *ItemItemsDriveItemItemRequestBuilder) Copy()(*ItemItemsItemCopyRequestBuilder) {\n return NewItemItemsItemCopyRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func NewMsgUpdateRecipe(recipeName, cookbookID, id, description string,\n\tcoinInputs types.CoinInputList,\n\titemInputs types.ItemInputList,\n\tentries types.EntriesList,\n\toutputs types.WeightedOutputsList,\n\tsender sdk.AccAddress) MsgUpdateRecipe {\n\treturn MsgUpdateRecipe{\n\t\tName: recipeName,\n\t\tID: id,\n\t\tCookbookID: cookbookID,\n\t\tDescription: description,\n\t\tCoinInputs: coinInputs,\n\t\tItemInputs: itemInputs,\n\t\tEntries: entries,\n\t\tOutputs: outputs,\n\t\tBlockInterval: 0,\n\t\tSender: sender,\n\t}\n}", "func (inputs ConstructInputs) CopyTo(args interface{}) error {\n\treturn linkedConstructInputsCopyTo(inputs.ctx, inputs.inputs, args)\n}", "func callArgsCopyTo(ctx *Context, source map[string]interface{}, args interface{}) (Resource, error) {\n\t// Use the same implementation as construct.\n\tif err := constructInputsCopyTo(ctx, source, args); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Retrieve the `__self__` arg.\n\tself, err := callArgsSelf(ctx, source)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn self, nil\n}", "func NewConfigurationBackupModifyParams() *ConfigurationBackupModifyParams {\n\treturn &ConfigurationBackupModifyParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *Entry) Copy(s Entry) {\n\to.Interval = s.Interval\n\to.Threshold = s.Threshold\n\to.Action = s.Action\n}", "func NewCopyToDefaultContentLocationPostRequestBody()(*CopyToDefaultContentLocationPostRequestBody) {\n m := &CopyToDefaultContentLocationPostRequestBody{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "func (c *RBController) NewRecipe(w http.ResponseWriter, r *http.Request) (err error) {\n\t// build data with anonymous struct\n\tdata := struct {\n\t\t*Recipe\n\t\tNewRecipe bool\n\t}{\n\t\tnew(Recipe),\n\t\ttrue,\n\t}\n\n\t// pass data to render\n\tc.HTML(w, http.StatusOK, \"recipes/edit\", data)\n\treturn nil\n}", "func (o *QueryChangesParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (sh *Hook) Copy() *Hook {\n\t// another map copy...\n\tf := make(map[string]interface{}, len(sh.fields))\n\tfor k, v := range sh.fields {\n\t\tf[k] = v\n\t}\n\n\treturn &Hook{\n\t\tCapturer: sh.Capturer,\n\t\tfields: f,\n\t\tminLevel: sh.minLevel,\n\t\ttraceEnabled: sh.traceEnabled,\n\t\ttraceSkipFrames: sh.traceSkipFrames,\n\t\ttraceContextLines: sh.traceContextLines,\n\t\ttraceAppPrefixes: sh.traceAppPrefixes,\n\t}\n}", "func NewParams() *Params {\n\treturn new(Params)\n}", "func NewChangeRequest() *ChangeRequest {\n\tattr := &ChangeRequest{}\n\treturn attr\n}", "func ParamChanges(r *rand.Rand) []simulation.ParamChange {\n\t// Note: params are encoded to JSON before being stored in the param store. These param changes\n\t// update the raw values in the store so values need to be JSON. This is why values that are represented\n\t// as strings in JSON (such as time.Duration) have the escaped quotes.\n\t// TODO should we encode the values properly with ModuleCdc.MustMarshalJSON()?\n\treturn []simulation.ParamChange{\n\t\tsimulation.NewSimParamChange(types.ModuleName, string(types.KeyBidDuration),\n\t\t\tfunc(r *rand.Rand) string {\n\t\t\t\treturn fmt.Sprintf(\"%d\", GenBidDuration(r))\n\t\t\t},\n\t\t),\n\t\tsimulation.NewSimParamChange(types.ModuleName, string(types.KeyMaxAuctionDuration),\n\t\t\tfunc(r *rand.Rand) string {\n\t\t\t\treturn fmt.Sprintf(\"%d\", GenMaxAuctionDuration(r))\n\t\t\t},\n\t\t),\n\t\tsimulation.NewSimParamChange(types.ModuleName, string(types.KeyIncrementCollateral),\n\t\t\tfunc(r *rand.Rand) string {\n\t\t\t\treturn fmt.Sprintf(\"%d\", GenIncrementCollateral(r))\n\t\t\t},\n\t\t),\n\t\tsimulation.NewSimParamChange(types.ModuleName, string(types.KeyIncrementDebt),\n\t\t\tfunc(r *rand.Rand) string {\n\t\t\t\treturn fmt.Sprintf(\"%d\", GenIncrementDebt(r))\n\t\t\t},\n\t\t),\n\t\tsimulation.NewSimParamChange(types.ModuleName, string(types.KeyIncrementSurplus),\n\t\t\tfunc(r *rand.Rand) string {\n\t\t\t\treturn fmt.Sprintf(\"%d\", GenIncrementSurplus(r))\n\t\t\t},\n\t\t),\n\t}\n}", "func (o *Entry) Copy(s Entry) {\n o.Description = s.Description\n o.Type = s.Type\n o.SourceZones = s.SourceZones\n o.DestinationZone = s.DestinationZone\n o.ToInterface = s.ToInterface\n o.Service = s.Service\n o.SourceAddresses = s.SourceAddresses\n o.DestinationAddresses = s.DestinationAddresses\n o.SatType = s.SatType\n o.SatAddressType = s.SatAddressType\n o.SatTranslatedAddresses = s.SatTranslatedAddresses\n o.SatInterface = s.SatInterface\n o.SatIpAddress = s.SatIpAddress\n o.SatFallbackType = s.SatFallbackType\n o.SatFallbackTranslatedAddresses = s.SatFallbackTranslatedAddresses\n o.SatFallbackInterface = s.SatFallbackInterface\n o.SatFallbackIpType = s.SatFallbackIpType\n o.SatFallbackIpAddress = s.SatFallbackIpAddress\n o.SatStaticTranslatedAddress = s.SatStaticTranslatedAddress\n o.SatStaticBiDirectional = s.SatStaticBiDirectional\n o.DatAddress = s.DatAddress\n o.DatPort = s.DatPort\n o.Disabled = s.Disabled\n o.Targets = s.Targets\n o.NegateTarget = s.NegateTarget\n o.Tags = s.Tags\n o.DatType = s.DatType\n o.DatDynamicDistribution = s.DatDynamicDistribution\n}", "func NewParams() *Params {\n\tp := Params{}\n\tp.names = []string{}\n\tp.values = map[string]interface{}{}\n\n\treturn &p\n}", "func (o *GetIngredientVersionRevisionParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (pd *ParameterDefinition) DeepCopy() *ParameterDefinition {\n\tvar p2 ParameterDefinition\n\tp2 = *pd\n\tp2.ApplyTo = make([]string, len(pd.ApplyTo))\n\tcopy(p2.ApplyTo, pd.ApplyTo)\n\treturn &p2\n}", "func makeRequest(changes []store.Change) *store.ChangeRequest {\n\treq := new(store.ChangeRequest)\n\treq.RequestEntity = uint64(config.Id())\n\treq.RequestNode = config.Id()\n\treq.RequestId = store.AllocateRequestId()\n\treq.Changeset = changes\n\n\treturn req\n}", "func (v EditValidator) Copy() StakeMsg {\n\tv1 := v\n\tdesc := *v.Description\n\tv1.Description = &desc\n\treturn v1\n}", "func (in *FilterParameters) DeepCopy() *FilterParameters {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FilterParameters)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (b *ClusterNodesBuilder) Copy(object *ClusterNodes) *ClusterNodesBuilder {\n\tif object == nil {\n\t\treturn b\n\t}\n\tb.compute = object.compute\n\tb.infra = object.infra\n\tb.master = object.master\n\tb.total = object.total\n\treturn b\n}", "func (p *Predicate) copy() *Predicate {\n\tparams := make([]Variable, len(p.parameters))\n\tfor i := range params {\n\t\tparams[i] = Variable{p.parameters[i].name, p.parameters[i].kind}\n\t}\n\treturn &Predicate{p.name, params, p.private}\n}", "func (b *AccessReviewRequestBuilder) Copy(object *AccessReviewRequest) *AccessReviewRequestBuilder {\n\tif object == nil {\n\t\treturn b\n\t}\n\tb.bitmap_ = object.bitmap_\n\tb.accountUsername = object.accountUsername\n\tb.action = object.action\n\tb.clusterID = object.clusterID\n\tb.clusterUUID = object.clusterUUID\n\tb.organizationID = object.organizationID\n\tb.resourceType = object.resourceType\n\tb.subscriptionID = object.subscriptionID\n\treturn b\n}", "func (s *Step) Copy() *Step {\n\tif s == nil {\n\t\treturn nil\n\t}\n\t// Unfortunately, because we don't know the type of StepData.Data, we\n\t// can't deep copy it.\n\tvar data []*StepData\n\tif s.Data != nil {\n\t\tdata = append(make([]*StepData, 0, len(s.Data)), s.Data...)\n\t}\n\treturn &Step{\n\t\tProperties: s.Properties.Copy(),\n\t\tData: data,\n\t\tStarted: s.Started,\n\t\tFinished: s.Finished,\n\t\tResult: s.Result,\n\t\tErrors: util.CopyStringSlice(s.Errors),\n\t}\n}", "func makeParamsWithVersion(action, version string) map[string]string {\n\tparams := make(map[string]string)\n\tparams[\"Action\"] = action\n\tparams[\"Version\"] = version\n\treturn params\n}", "func (r *Helm) Copy() *Helm {\n\treturn &Helm{\n\t\tID: r.ID,\n\t\t//ProjectName: r.ProjectName,\n\t\tType: r.Type,\n\t\tName: r.Name,\n\t\tAddress: r.Address,\n\t\tUsername: r.Username,\n\t\tPrefix: r.Prefix,\n\t}\n}", "func (s *Spec) Clone() *Spec {\n\tres := &Spec{Target: make(map[string]string)}\n\tfor k, v := range s.Target {\n\t\tres.Target[k] = v\n\t}\n\tfor _, app := range s.Apps {\n\t\tres.Apps = append(res.Apps, app.Clone())\n\t}\n\treturn res\n}", "func (in *V1SystemDeploymentParameters) DeepCopyToModel() *models.V1SystemDeploymentParameters {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(models.V1SystemDeploymentParameters)\n\tin.DeepCopyToModelInto(out)\n\treturn out\n}", "func (cs *CollectionSpec) Copy() *CollectionSpec {\n\tif cs == nil {\n\t\treturn nil\n\t}\n\n\tcpy := CollectionSpec{\n\t\tMaps: make(map[string]*MapSpec, len(cs.Maps)),\n\t\tPrograms: make(map[string]*ProgramSpec, len(cs.Programs)),\n\t}\n\n\tfor name, spec := range cs.Maps {\n\t\tcpy.Maps[name] = spec.Copy()\n\t}\n\n\tfor name, spec := range cs.Programs {\n\t\tcpy.Programs[name] = spec.Copy()\n\t}\n\n\treturn &cpy\n}", "func (s *VPCService) NewCreateVPCOfferingParams(displaytext string, name string, supportedservices []string) *CreateVPCOfferingParams {\n\tp := &CreateVPCOfferingParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"displaytext\"] = displaytext\n\tp.p[\"name\"] = name\n\tp.p[\"supportedservices\"] = supportedservices\n\treturn p\n}", "func ParamChanges(r *rand.Rand) []simulation.ParamChange {\n\treturn []simulation.ParamChange{\n\t\tsimulation.NewSimParamChange(types.ModuleName, string(types.ParamStoreKeyVotePeriod),\n\t\t\tfunc(r *rand.Rand) string {\n\t\t\t\treturn fmt.Sprintf(\"\\\"%d\\\"\", GenVotePeriod(r))\n\t\t\t},\n\t\t),\n\t\tsimulation.NewSimParamChange(types.ModuleName, string(types.ParamStoreKeyVoteThreshold),\n\t\t\tfunc(r *rand.Rand) string {\n\t\t\t\treturn fmt.Sprintf(\"\\\"%s\\\"\", GenVoteThreshold(r))\n\t\t\t},\n\t\t),\n\t\tsimulation.NewSimParamChange(types.ModuleName, string(types.ParamStoreKeyRewardBand),\n\t\t\tfunc(r *rand.Rand) string {\n\t\t\t\treturn fmt.Sprintf(\"\\\"%s\\\"\", GenRewardBand(r))\n\t\t\t},\n\t\t),\n\t\tsimulation.NewSimParamChange(types.ModuleName, string(types.ParamStoreKeyRewardDistributionWindow),\n\t\t\tfunc(r *rand.Rand) string {\n\t\t\t\treturn fmt.Sprintf(\"\\\"%d\\\"\", GenRewardDistributionWindow(r))\n\t\t\t},\n\t\t),\n\t\tsimulation.NewSimParamChange(types.ModuleName, string(types.ParamStoreKeySlashFraction),\n\t\t\tfunc(r *rand.Rand) string {\n\t\t\t\treturn fmt.Sprintf(\"\\\"%s\\\"\", GenSlashFraction(r))\n\t\t\t},\n\t\t),\n\t\tsimulation.NewSimParamChange(types.ModuleName, string(types.ParamStoreKeySlashWindow),\n\t\t\tfunc(r *rand.Rand) string {\n\t\t\t\treturn fmt.Sprintf(\"\\\"%d\\\"\", GenSlashWindow(r))\n\t\t\t},\n\t\t),\n\t}\n}", "func NewModifiedResources() *ModifiedResources {\n\treturn &ModifiedResources{\n\t\titems: make(map[string]struct{}),\n\t\tauthors: make(map[string]struct{}),\n\t}\n}", "func (input *BeegoInput) ResetParams() {\n\tinput.pnames = input.pnames[:0]\n\tinput.pvalues = input.pvalues[:0]\n}", "func deepCopy(copy, orig interface{}) error {\n\tvar buf bytes.Buffer\n\tenc := gob.NewEncoder(&buf)\n\tdec := gob.NewDecoder(&buf)\n\terr := enc.Encode(orig)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn dec.Decode(copy)\n}", "func NewParams() *Parameters {\n\treturn &Parameters{\n\t\tTokenType: \"transit\",\n\t\tTLSMode: 1,\n\t\tLeaderOnly: true,\n\t\tConnectTimeout: defaultConnectTimeout,\n\t\tReadTimeout: defaultReadTimeout,\n\t\tRetryCount: defaultRetries,\n\t\tRequireType: \"master\",\n\t}\n}", "func copyComponentsPtr(s Servable, req *http.Request) {\n\tctx := context.WithValue(req.Context(), componentsKey, s.ServerField().Components)\n\t*req = *req.WithContext(ctx)\n}", "func (o *QueryChangesParams) WithDefaults() *QueryChangesParams {\n\to.SetDefaults()\n\treturn o\n}", "func (r *Resources) Copy(other *Resources) {\n\tr.CPU = other.CPU\n\tr.DISK = other.DISK\n\tr.MEMORY = other.MEMORY\n\tr.GPU = other.GPU\n}", "func (m *IntentsDeviceManagementIntentItemRequestBuilder) CreateCopy()(*IntentsItemCreateCopyRequestBuilder) {\n return NewIntentsItemCreateCopyRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func NewParams(tokenCourse, subscriptionPrice, VPNGBPrice,\n\tstorageGBPrice, baseVPNGb, baseStorageGb uint32, courseSigners []sdk.AccAddress) Params {\n\treturn Params{\n\t\tTokenCourse: tokenCourse,\n\t\tSubscriptionPrice: subscriptionPrice,\n\t\tVPNGBPrice: VPNGBPrice,\n\t\tStorageGBPrice: storageGBPrice,\n\t\tBaseVPNGb: baseVPNGb,\n\t\tBaseStorageGb: baseStorageGb,\n\t\tCourseChangeSigners: courseSigners[:],\n\t}\n}", "func DefaultParams() Params {\n\treturn Params{\n\t\tMintDenom: sdk.DefaultBondDenom,\n\t\tGenesisEpochProvisions: sdk.NewDec(5000000),\n\t\tEpochIdentifier: \"week\", // 1 week\n\t\tReductionPeriodInEpochs: 156, // 3 years\n\t\tReductionFactor: sdk.NewDecWithPrec(5, 1), // 0.5\n\t\tDistributionProportions: DistributionProportions{\n\t\t\tStaking: sdk.NewDecWithPrec(4, 1), // 0.4\n\t\t\tPoolIncentives: sdk.NewDecWithPrec(3, 1), // 0.3\n\t\t\tDeveloperRewards: sdk.NewDecWithPrec(2, 1), // 0.2\n\t\t\tCommunityPool: sdk.NewDecWithPrec(1, 1), // 0.1\n\t\t},\n\t\tWeightedDeveloperRewardsReceivers: []WeightedAddress{},\n\t\tMintingRewardsDistributionStartEpoch: 0,\n\t}\n}", "func (m *ItemMailFoldersItemMessagesMessageItemRequestBuilder) Copy()(*ItemMailFoldersItemMessagesItemCopyRequestBuilder) {\n return NewItemMailFoldersItemMessagesItemCopyRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func (v CreateValidator) Copy() StakeMsg {\n\tv1 := v\n\tdesc := *v.Description\n\tv1.Description = &desc\n\treturn v1\n}", "func (in *BindingVolumeParams) DeepCopy() *BindingVolumeParams {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BindingVolumeParams)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (c *Change) Reset() *Change {\n\tc.params = make(map[string]interface{})\n\treturn c\n}", "func (t *TaskDriverRun) Copy() *TaskDriverRun {\n\tif t == nil {\n\t\treturn nil\n\t}\n\tvar steps map[string]*Step\n\tif t.Steps != nil {\n\t\tsteps = make(map[string]*Step, len(t.Steps))\n\t\tfor k, v := range t.Steps {\n\t\t\tsteps[k] = v.Copy()\n\t\t}\n\t}\n\treturn &TaskDriverRun{\n\t\tTaskId: t.TaskId,\n\t\tProperties: t.Properties.Copy(),\n\t\tSteps: steps,\n\t}\n}", "func NewParams(communityTax sdk.Dec, withdrawAddrEnabled bool) Params {\n\treturn Params{\n\t\tCommunityTax: communityTax,\n\t\tWithdrawAddrEnabled: withdrawAddrEnabled,\n\t}\n}", "func (original *Place) Copy() *Place {\n\treturn &Place{original.latitude, original.longitude, original.Name}\n}", "func (o *Opts) Copy() *Opts {\n\tnewOpts := *o\n\treturn &newOpts\n}", "func NewMakeSnapshotArgs(layerID LayerID) *MakeSnapshotArgs {\n\targs := new(MakeSnapshotArgs)\n\targs.LayerID = layerID\n\treturn args\n}", "func copyAttrs(attrs map[string]interface{}) map[string]interface{} {\n\tduplicate := make(map[string]interface{}, len(attrs))\n\tfor k, v := range attrs {\n\t\tduplicate[k] = v\n\t}\n\treturn duplicate\n}", "func (cc *CopyCommand) Init(args []string, options OptionMapType) error {\n\treturn cc.command.Init(args, options, cc)\n}", "func (o *ProjectWebhook) Clone() datamodel.Model {\n\tc := new(ProjectWebhook)\n\tc.FromMap(o.ToMap())\n\treturn c\n}", "func (in DefaultParams) DeepCopy() DefaultParams {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DefaultParams)\n\tin.DeepCopyInto(out)\n\treturn *out\n}", "func DefaultParams() Params {\n\treturn Params{\n\t\tBudgets: []Budget{},\n\t\tEpochBlocks: DefaultEpochBlocks,\n\t}\n}", "func (this *L0JobContext) Copy(request string) JobContext {\n\treturn &L0JobContext{\n\t\trequest: request,\n\t\tjobID: this.jobID,\n\t\tlogic: this.logic,\n\t\tloadBalancerLogic: this.loadBalancerLogic,\n\t\tserviceLogic: this.serviceLogic,\n\t\tenvironmentLogic: this.environmentLogic,\n\t\tmutex: this.mutex,\n\t}\n}", "func (j *Job) CloneWithEmptyArgs() (r *Job) {\n\tcp := *j\n\tr = &cp\n\tcp.Args = []string{}\n\n\tcp.Out = make([]string, len(j.Out))\n\tcopy(cp.Out, j.Out)\n\tcp.Env = make([]string, len(j.Env))\n\tcopy(cp.Env, j.Env)\n\tcp.Finishaddr = make([]string, len(j.Finishaddr))\n\tcopy(cp.Finishaddr, j.Finishaddr)\n\tStampJob(r)\n\treturn\n}", "func init() {\n\tRootCmd.AddCommand(cloneCmd)\n\n\tcloneCmd.Flags().StringVarP(&BackrestPVCSize, \"pgbackrest-pvc-size\", \"\", \"\",\n\t\t`The size of the PVC capacity for the pgBackRest repository. Overrides the value set in the storage class. This is ignored if the storage type of \"local\" is not used. Must follow the standard Kubernetes format, e.g. \"10.1Gi\"`)\n\tcloneCmd.Flags().StringVarP(&BackrestStorageSource, \"pgbackrest-storage-source\", \"\", \"\",\n\t\t\"The data source for the clone when both \\\"local\\\" and \\\"s3\\\" are enabled in the \"+\n\t\t\t\"source cluster. Either \\\"local\\\", \\\"s3\\\" or both, comma separated. (default \\\"local\\\")\")\n\tcloneCmd.Flags().BoolVar(&MetricsFlag, \"enable-metrics\", false, `If sets, enables metrics collection on the newly cloned cluster`)\n\tcloneCmd.Flags().StringVarP(&PVCSize, \"pvc-size\", \"\", \"\",\n\t\t`The size of the PVC capacity for primary and replica PostgreSQL instances. Overrides the value set in the storage class. Must follow the standard Kubernetes format, e.g. \"10.1Gi\"`)\n}", "func (in *PeeringRequest) DeepCopy() *PeeringRequest {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PeeringRequest)\n\tin.DeepCopyInto(out)\n\treturn out\n}" ]
[ "0.7398709", "0.7115698", "0.6506534", "0.5838536", "0.575506", "0.55052036", "0.54349566", "0.54136103", "0.5332016", "0.5116452", "0.50422174", "0.48769543", "0.48056495", "0.47824895", "0.47173387", "0.470763", "0.4704235", "0.46622336", "0.46519724", "0.45844418", "0.4572863", "0.4571199", "0.4553177", "0.45291772", "0.45016047", "0.44923818", "0.4451014", "0.4430593", "0.44229752", "0.44178048", "0.43726182", "0.43614635", "0.4337656", "0.43368137", "0.43014342", "0.42683175", "0.4241892", "0.42098635", "0.42066357", "0.41897637", "0.41891125", "0.4187208", "0.41769338", "0.4171703", "0.41682282", "0.41510686", "0.41416737", "0.41267204", "0.41054416", "0.41051856", "0.41006398", "0.40940455", "0.40934187", "0.40875527", "0.40847808", "0.4083641", "0.40746537", "0.4072627", "0.40681276", "0.4067471", "0.40664482", "0.40620583", "0.40568003", "0.4045866", "0.404472", "0.40443504", "0.40404072", "0.4032808", "0.40295076", "0.40213028", "0.40159816", "0.40108806", "0.40082905", "0.40041715", "0.39942926", "0.3992565", "0.39907628", "0.3989566", "0.3989199", "0.3987946", "0.39862043", "0.3977043", "0.39768663", "0.39752552", "0.3973195", "0.39713553", "0.39666712", "0.3960216", "0.39556953", "0.3952889", "0.3950046", "0.39497396", "0.39335942", "0.39302617", "0.39253962", "0.39246148", "0.39233983", "0.39184326", "0.39172593", "0.39164925" ]
0.83219415
0
NewCopyRecipeToMyRecipesWithChangesParamsWithTimeout creates a new CopyRecipeToMyRecipesWithChangesParams object with the default values initialized, and the ability to set a timeout on a request
NewCopyRecipeToMyRecipesWithChangesParamsWithTimeout создает новый объект CopyRecipeToMyRecipesWithChangesParams с инициализированными значениями по умолчанию, а также возможность установить таймаут на запрос
func NewCopyRecipeToMyRecipesWithChangesParamsWithTimeout(timeout time.Duration) *CopyRecipeToMyRecipesWithChangesParams { var () return &CopyRecipeToMyRecipesWithChangesParams{ timeout: timeout, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *CopyRecipeToMyRecipesWithChangesParams) WithTimeout(timeout time.Duration) *CopyRecipeToMyRecipesWithChangesParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewCopyRecipeToMyRecipesWithChangesParams() *CopyRecipeToMyRecipesWithChangesParams {\n\tvar ()\n\treturn &CopyRecipeToMyRecipesWithChangesParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewCopyRecipeToMyRecipesWithChangesParamsWithHTTPClient(client *http.Client) *CopyRecipeToMyRecipesWithChangesParams {\n\tvar ()\n\treturn &CopyRecipeToMyRecipesWithChangesParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *GetPublicsRecipeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewNarrowSearchRecipeParamsWithTimeout(timeout time.Duration) *NarrowSearchRecipeParams {\n\tvar (\n\t\tsortbyDefault = string(\"name\")\n\t\tsortdirDefault = string(\"desc\")\n\t)\n\treturn &NarrowSearchRecipeParams{\n\t\tSortby: &sortbyDefault,\n\t\tSortdir: &sortdirDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewQueryChangesParamsWithTimeout(timeout time.Duration) *QueryChangesParams {\n\treturn &QueryChangesParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *QueryChangesParams) WithTimeout(timeout time.Duration) *QueryChangesParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *QueryChangesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewPostReconciliationParamsWithTimeout(timeout time.Duration) *PostReconciliationParams {\n\tvar ()\n\treturn &PostReconciliationParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewGetPublicsRecipeParamsWithTimeout(timeout time.Duration) *GetPublicsRecipeParams {\n\n\treturn &GetPublicsRecipeParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewCreateWidgetParamsWithTimeout(timeout time.Duration) *CreateWidgetParams {\n\tvar (\n\t\tacceptDefault = string(\"application/json\")\n\t\tcontentTypeDefault = string(\"application/json\")\n\t)\n\treturn &CreateWidgetParams{\n\t\tAccept: &acceptDefault,\n\t\tContentType: &contentTypeDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *ChatNewParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewConfigurationBackupModifyParamsWithTimeout(timeout time.Duration) *ConfigurationBackupModifyParams {\n\treturn &ConfigurationBackupModifyParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewContainerUpdateParamsWithTimeout(timeout time.Duration) *ContainerUpdateParams {\n\tvar ()\n\treturn &ContainerUpdateParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetReceiptsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewGetReceiptsParamsWithTimeout(timeout time.Duration) *GetReceiptsParams {\n\tvar ()\n\treturn &GetReceiptsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *NarrowSearchRecipeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.JSONBody != nil {\n\t\tif err := r.SetBodyParam(o.JSONBody); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param recipeId\n\tif err := r.SetPathParam(\"recipeId\", o.RecipeID); 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}", "func NewEditParamsWithTimeout(timeout time.Duration) *EditParams {\n\treturn &EditParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *PetCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewUpdateBuildPropertiesParamsWithTimeout(timeout time.Duration) *UpdateBuildPropertiesParams {\n\tvar ()\n\treturn &UpdateBuildPropertiesParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewSizeParamsWithTimeout(timeout time.Duration) *SizeParams {\n\tvar ()\n\treturn &SizeParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewFreezeParamsWithTimeout(timeout time.Duration) *FreezeParams {\n\treturn &FreezeParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewPostApplyManifestParamsWithTimeout(timeout time.Duration) *PostApplyManifestParams {\n\tvar (\n\t\tdisableUpdatePostDefault = bool(false)\n\t\tdisableUpdatePreDefault = bool(false)\n\t\tdryRunDefault = bool(false)\n\t\tenableChartCleanupDefault = bool(false)\n\t\ttillerHostDefault = string(\"None\")\n\t\ttimeoutDefault = int64(3600)\n\t)\n\treturn &PostApplyManifestParams{\n\t\tDisableUpdatePost: &disableUpdatePostDefault,\n\t\tDisableUpdatePre: &disableUpdatePreDefault,\n\t\tDryRun: &dryRunDefault,\n\t\tEnableChartCleanup: &enableChartCleanupDefault,\n\t\tTillerHost: &tillerHostDefault,\n\t\tTimeout: &timeoutDefault,\n\n\t\trequestTimeout: timeout,\n\t}\n}", "func NewContainerRenameParamsWithTimeout(timeout time.Duration) *ContainerRenameParams {\n\tvar ()\n\treturn &ContainerRenameParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CreateRunbookRunCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetBuildPropertiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewTimeout(parameters ...wparams.ParamStorer) Error {\n\treturn newGenericError(nil, DefaultTimeout, wparams.NewParamStorer(parameters...))\n}", "func (o *GetIngredientVersionRevisionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *FileInfoCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RevertProductSnapshotRequestUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewSwarmUpdateParamsWithTimeout(timeout time.Duration) *SwarmUpdateParams {\n\tvar (\n\t\trotateManagerTokenDefault = bool(false)\n\t\trotateManagerUnlockKeyDefault = bool(false)\n\t\trotateWorkerTokenDefault = bool(false)\n\t)\n\treturn &SwarmUpdateParams{\n\t\tRotateManagerToken: &rotateManagerTokenDefault,\n\t\tRotateManagerUnlockKey: &rotateManagerUnlockKeyDefault,\n\t\tRotateWorkerToken: &rotateWorkerTokenDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (c *OrganizationsEnvironmentsApisRevisionsDebugsessionsCreateCall) Timeout(timeout int64) *OrganizationsEnvironmentsApisRevisionsDebugsessionsCreateCall {\n\tc.urlParams_.Set(\"timeout\", fmt.Sprint(timeout))\n\treturn c\n}", "func (o *GetContentSourceUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *AddRepositoryParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(timeoutType fab.TimeoutType, timeout time.Duration) RequestOption {\n\treturn func(ctx context.Client, o *requestOptions) error {\n\t\tif o.Timeouts == nil {\n\t\t\to.Timeouts = make(map[fab.TimeoutType]time.Duration)\n\t\t}\n\t\to.Timeouts[timeoutType] = timeout\n\t\treturn nil\n\t}\n}", "func NewUpdateWidgetParamsWithTimeout(timeout time.Duration) *UpdateWidgetParams {\n\tvar (\n\t\tacceptDefault = string(\"application/json\")\n\t\tcontentTypeDefault = string(\"application/json\")\n\t)\n\treturn &UpdateWidgetParams{\n\t\tAccept: &acceptDefault,\n\t\tContentType: &contentTypeDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewInventoryStocktakingSearchParamsWithTimeout(timeout time.Duration) *InventoryStocktakingSearchParams {\n\tvar (\n\t\tcountDefault = int64(1000)\n\t\tfromDefault = int64(0)\n\t)\n\treturn &InventoryStocktakingSearchParams{\n\t\tCount: &countDefault,\n\t\tFrom: &fromDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CloudTargetCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewGetRequestDetailsParamsWithTimeout(timeout time.Duration) *GetRequestDetailsParams {\n\tvar ()\n\treturn &GetRequestDetailsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CreateLifecycleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *StorageServiceOwnershipGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCrossConnectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CapacityPoolGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ServiceInstanceGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewGetBuildPropertiesParamsWithTimeout(timeout time.Duration) *GetBuildPropertiesParams {\n\tvar ()\n\treturn &GetBuildPropertiesParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *NarrowSearchRecipeParams) WithTimeout(timeout time.Duration) *NarrowSearchRecipeParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *GetRequestDetailsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetWorkItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewUpdateCredentialParamsWithTimeout(timeout time.Duration) *UpdateCredentialParams {\n\tvar ()\n\treturn &UpdateCredentialParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *RegenerateDeployKeyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EditParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCartUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ChatNewParams) WithTimeout(timeout time.Duration) *ChatNewParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *ConfigurationBackupGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ConfigurationBackupModifyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *BackupsCreateStatusParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostReconciliationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewConvertParamsWithTimeout(timeout time.Duration) *ConvertParams {\n\tvar ()\n\treturn &ConvertParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewDeleteKeyPairsParamsWithTimeout(timeout time.Duration) *DeleteKeyPairsParams {\n\tvar ()\n\treturn &DeleteKeyPairsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *IntegrationsManualHTTPSCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewAddItemParamsWithTimeout(timeout time.Duration) *AddItemParams {\n\tvar ()\n\treturn &AddItemParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewChatNewParamsWithTimeout(timeout time.Duration) *ChatNewParams {\n\tvar (\n\t\tchannelIDDefault = float64(1)\n\t)\n\treturn &ChatNewParams{\n\t\tChannelID: &channelIDDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewBarParamsWithTimeout(timeout time.Duration) *BarParams {\n\tvar ()\n\treturn &BarParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CreateWidgetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetRedbeamsFlowLogsProgressByResourceCrnParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewPatchZoneParamsWithTimeout(timeout time.Duration) *PatchZoneParams {\n\tvar ()\n\treturn &PatchZoneParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *UpdateBuildPropertiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetRemotesupportConnectemcParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EditParams) WithTimeout(timeout time.Duration) *EditParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewRegenerateDeployKeyParamsWithTimeout(timeout time.Duration) *RegenerateDeployKeyParams {\n\treturn &RegenerateDeployKeyParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *GetPrivateToggleDepositAddressCreationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreatePolicyResetItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewRevertProductSnapshotRequestUsingPOSTParamsWithTimeout(timeout time.Duration) *RevertProductSnapshotRequestUsingPOSTParams {\n\tvar ()\n\treturn &RevertProductSnapshotRequestUsingPOSTParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *SyncStatusUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) WithContext(ctx context.Context) *CopyRecipeToMyRecipesWithChangesParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *PutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewPatchAddonParamsWithTimeout(timeout time.Duration) *PatchAddonParams {\n\tvar ()\n\treturn &PatchAddonParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CreateInstantPaymentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetTerraformConfigurationSourcesUsingGET1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *InventoryStocktakingSearchParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetRepository15Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ConvertParams) WithTimeout(timeout time.Duration) *ConvertParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *PostPartsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ApplicationComponentSnapshotCollectionGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteKeyPairsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateBlueprintInWorkspaceInternalParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func TimeoutSeconds(timeout int) Option {\n\treturn func(opts workerOpts) workerOpts {\n\t\topts.jobTimeoutSeconds = timeout\n\t\treturn opts\n\t}\n}", "func (o *GetDeploymentByIDV3UsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(duration time.Duration) ReconcilerOption {\n\treturn func(r *Reconciler) {\n\t\tr.timeout = duration\n\t}\n}", "func NewUpdateTableMetadataParamsWithTimeout(timeout time.Duration) *UpdateTableMetadataParams {\n\tvar ()\n\treturn &UpdateTableMetadataParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewFileInfoCreateParamsWithTimeout(timeout time.Duration) *FileInfoCreateParams {\n\treturn &FileInfoCreateParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *GetPaymentsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *BudgetAddParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetContentSourcesUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreatePolicyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}" ]
[ "0.7334397", "0.6605116", "0.63352853", "0.5800872", "0.56409484", "0.5607914", "0.54550415", "0.5356853", "0.5310841", "0.53100616", "0.5263849", "0.5247955", "0.52475536", "0.5226695", "0.52168256", "0.5173177", "0.5161624", "0.5160964", "0.5154121", "0.5137564", "0.5129438", "0.509061", "0.5075947", "0.5044079", "0.5043573", "0.50402194", "0.50364774", "0.5015112", "0.50103754", "0.49984336", "0.4994417", "0.49911186", "0.4985919", "0.49803686", "0.4977538", "0.49705553", "0.49669132", "0.4957732", "0.49575713", "0.4945712", "0.49426445", "0.49413744", "0.49387884", "0.49382064", "0.49378327", "0.49368423", "0.49167964", "0.49158952", "0.49145314", "0.49061963", "0.49027383", "0.49021363", "0.48972574", "0.48949277", "0.48921365", "0.48889342", "0.48874995", "0.48872876", "0.48839194", "0.48815405", "0.4879294", "0.4875162", "0.4873673", "0.48722887", "0.48593533", "0.48591775", "0.48553243", "0.48535115", "0.48518384", "0.48517892", "0.48504266", "0.48492536", "0.48456073", "0.4843525", "0.4841754", "0.48108134", "0.4804985", "0.4801075", "0.4800462", "0.4796924", "0.47938764", "0.47933123", "0.47928", "0.4790575", "0.47857007", "0.47820508", "0.47798878", "0.4778629", "0.4777421", "0.47754964", "0.47671118", "0.4759266", "0.47591543", "0.4759048", "0.4757747", "0.47555506", "0.47548163", "0.47480404", "0.4747348", "0.4744736" ]
0.7710058
0
NewCopyRecipeToMyRecipesWithChangesParamsWithContext creates a new CopyRecipeToMyRecipesWithChangesParams object with the default values initialized, and the ability to set a context for a request
NewCopyRecipeToMyRecipesWithChangesParamsWithContext создает новый объект CopyRecipeToMyRecipesWithChangesParams с инициализацией значений по умолчанию, а также возможность установки контекста для запроса
func NewCopyRecipeToMyRecipesWithChangesParamsWithContext(ctx context.Context) *CopyRecipeToMyRecipesWithChangesParams { var () return &CopyRecipeToMyRecipesWithChangesParams{ Context: ctx, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewCopyRecipeToMyRecipesWithChangesParams() *CopyRecipeToMyRecipesWithChangesParams {\n\tvar ()\n\treturn &CopyRecipeToMyRecipesWithChangesParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) WithContext(ctx context.Context) *CopyRecipeToMyRecipesWithChangesParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewCopyRecipeToMyRecipesWithChangesParamsWithHTTPClient(client *http.Client) *CopyRecipeToMyRecipesWithChangesParams {\n\tvar ()\n\treturn &CopyRecipeToMyRecipesWithChangesParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewCopyRecipeToMyRecipesWithChangesParamsWithTimeout(timeout time.Duration) *CopyRecipeToMyRecipesWithChangesParams {\n\tvar ()\n\treturn &CopyRecipeToMyRecipesWithChangesParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) WithRecipeID(recipeID string) *CopyRecipeToMyRecipesWithChangesParams {\n\to.SetRecipeID(recipeID)\n\treturn o\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) WithHTTPClient(client *http.Client) *CopyRecipeToMyRecipesWithChangesParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) WithTimeout(timeout time.Duration) *CopyRecipeToMyRecipesWithChangesParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) WithJSONBody(jSONBody *models.Recipe) *CopyRecipeToMyRecipesWithChangesParams {\n\to.SetJSONBody(jSONBody)\n\treturn o\n}", "func NewQueryChangesParamsWithContext(ctx context.Context) *QueryChangesParams {\n\treturn &QueryChangesParams{\n\t\tContext: ctx,\n\t}\n}", "func (o *QueryChangesParams) WithContext(ctx context.Context) *QueryChangesParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (in *GitContext) DeepCopy() *GitContext {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitContext)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.JSONBody != nil {\n\t\tif err := r.SetBodyParam(o.JSONBody); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param recipeId\n\tif err := r.SetPathParam(\"recipeId\", o.RecipeID); 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}", "func (c *SMS) GenerateChangeSetWithContext(ctx aws.Context, input *GenerateChangeSetInput, opts ...request.Option) (*GenerateChangeSetOutput, error) {\n\treq, out := c.GenerateChangeSetRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func NewPostV1ChangesChangeIDIdentitiesParamsWithContext(ctx context.Context) *PostV1ChangesChangeIDIdentitiesParams {\n\tvar ()\n\treturn &PostV1ChangesChangeIDIdentitiesParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewConfigurationBackupModifyParamsWithContext(ctx context.Context) *ConfigurationBackupModifyParams {\n\treturn &ConfigurationBackupModifyParams{\n\t\tContext: ctx,\n\t}\n}", "func NewPutClientConfigV2NamespaceChangesParamsWithContext(ctx context.Context) *PutClientConfigV2NamespaceChangesParams {\n\tvar ()\n\treturn &PutClientConfigV2NamespaceChangesParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *CommitOptions) WithChanges(value []string) *CommitOptions {\n\to.Changes = value\n\treturn o\n}", "func NewGetRecentFoodsParamsWithContext(ctx context.Context) *GetRecentFoodsParams {\n\n\treturn &GetRecentFoodsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *GetReceiptsParams) WithContext(ctx context.Context) *GetReceiptsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) SetRecipeID(recipeID string) {\n\to.RecipeID = recipeID\n}", "func (o *PatchV1ChangesEventsChangeEventIDParams) WithContext(ctx context.Context) *PatchV1ChangesEventsChangeEventIDParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (c *Client) CopyWithContext(ctx context.Context, src FileID, dst string) (FileID, error) {\n\tfileID, err := c.iclient.Copy(ctx, &pb.CopyRequest{SrcId: src[:], Dst: dst})\n\tif e, ok := err.(twirp.Error); ok && e.Code() == twirp.NotFound {\n\t\treturn FileID{}, ErrNotFound\n\t}\n\tif err != nil {\n\t\treturn FileID{}, err\n\t}\n\ts, err := UnmarshalFileID(fileID.Sum)\n\tif err != nil {\n\t\treturn FileID{}, err\n\t}\n\treturn s, nil\n}", "func NewGetReceiptsParamsWithContext(ctx context.Context) *GetReceiptsParams {\n\tvar ()\n\treturn &GetReceiptsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *QueryChangesParams) WithFilter(filter *string) *QueryChangesParams {\n\to.SetFilter(filter)\n\treturn o\n}", "func NewConversationsSendToConversationParamsWithContext(ctx context.Context) *ConversationsSendToConversationParams {\n\tvar ()\n\treturn &ConversationsSendToConversationParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (in *HelmRequest) DeepCopy() *HelmRequest {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HelmRequest)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o *GetIngredientVersionRevisionParams) WithContext(ctx context.Context) *GetIngredientVersionRevisionParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewPatchV1ChangesEventsChangeEventIDParamsWithContext(ctx context.Context) *PatchV1ChangesEventsChangeEventIDParams {\n\tvar ()\n\treturn &PatchV1ChangesEventsChangeEventIDParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewCopyToArgs(nodeID NodeID, targetNodeID NodeID) *CopyToArgs {\n\targs := new(CopyToArgs)\n\targs.NodeID = nodeID\n\targs.TargetNodeID = targetNodeID\n\treturn args\n}", "func (o *ConfigurationBackupModifyParams) WithContext(ctx context.Context) *ConfigurationBackupModifyParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (in *HelmRequestSpec) DeepCopy() *HelmRequestSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HelmRequestSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (s *TemplateService) NewCopyTemplateParams(id string) *CopyTemplateParams {\n\tp := &CopyTemplateParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\n\treturn p\n}", "func (p *PullRequestEvent) GetChanges() *EditChange {\n\tif p == nil {\n\t\treturn nil\n\t}\n\treturn p.Changes\n}", "func (m *ChargeRequestAdditionalRecipient) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateAmountMoney(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}", "func (in *ChoiceSpec) DeepCopy() *ChoiceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ChoiceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (p *PullRequestReviewCommentEvent) GetChanges() *EditChange {\n\tif p == nil {\n\t\treturn nil\n\t}\n\treturn p.Changes\n}", "func NewNotifyStateChangedParamsWithContext(ctx context.Context) *NotifyStateChangedParams {\n\tvar ()\n\treturn &NotifyStateChangedParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (a *ManagementApiService) GetChanges(ctx _context.Context) apiGetChangesRequest {\n\treturn apiGetChangesRequest{\n\t\tapiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (in *NewPendingTxNotificationParams) DeepCopy() *NewPendingTxNotificationParams {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NewPendingTxNotificationParams)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewPostReconciliationParamsWithContext(ctx context.Context) *PostReconciliationParams {\n\tvar ()\n\treturn &PostReconciliationParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *PostV1ChangesChangeIDIdentitiesParams) WithContext(ctx context.Context) *PostV1ChangesChangeIDIdentitiesParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewQueryChangesParamsWithHTTPClient(client *http.Client) *QueryChangesParams {\n\treturn &QueryChangesParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewQueryChangesParams() *QueryChangesParams {\n\treturn &QueryChangesParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewChatNewParamsWithContext(ctx context.Context) *ChatNewParams {\n\tvar (\n\t\tchannelIdDefault = float64(1)\n\t)\n\treturn &ChatNewParams{\n\t\tChannelID: &channelIdDefault,\n\n\t\tContext: ctx,\n\t}\n}", "func (project *ProjectV1) GetConfigDiffWithContext(ctx context.Context, getConfigDiffOptions *GetConfigDiffOptions) (result *ProjectConfigDiff, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(getConfigDiffOptions, \"getConfigDiffOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(getConfigDiffOptions, \"getConfigDiffOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"project_id\": *getConfigDiffOptions.ProjectID,\n\t\t\"id\": *getConfigDiffOptions.ID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = project.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(project.Service.Options.URL, `/v1/projects/{project_id}/configs/{id}/diff`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range getConfigDiffOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"project\", \"V1\", \"GetConfigDiff\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = project.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalProjectConfigDiff)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "func NewRevertProductSnapshotRequestUsingPOSTParamsWithContext(ctx context.Context) *RevertProductSnapshotRequestUsingPOSTParams {\n\tvar ()\n\treturn &RevertProductSnapshotRequestUsingPOSTParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewGetRecipesParams() GetRecipesParams {\n\n\tvar (\n\t\t// initialize parameters with default values\n\n\t\tingredient1Default = string(\"\")\n\t\tingredient2Default = string(\"\")\n\t\tingredient3Default = string(\"\")\n\t\tseasonDefault = string(\"\")\n\t)\n\n\treturn GetRecipesParams{\n\t\tIngredient1: &ingredient1Default,\n\n\t\tIngredient2: &ingredient2Default,\n\n\t\tIngredient3: &ingredient3Default,\n\n\t\tSeason: &seasonDefault,\n\t}\n}", "func NewMonitorCheckGetScreenshotsParamsWithContext(ctx context.Context) *MonitorCheckGetScreenshotsParams {\n\tvar ()\n\treturn &MonitorCheckGetScreenshotsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (in *BuildContext) DeepCopy() *BuildContext {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BuildContext)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewPostV1IncidentsIncidentIDRelatedChangeEventsParamsWithContext(ctx context.Context) *PostV1IncidentsIncidentIDRelatedChangeEventsParams {\n\tvar ()\n\treturn &PostV1IncidentsIncidentIDRelatedChangeEventsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (ctx *Context) Copy() *Context {\n\tvar pathParams Params\n\tif len(ctx.PathParams) > 0 {\n\t\tpathParams = append(pathParams, ctx.PathParams...)\n\t}\n\treturn &Context{\n\t\tresponseWriter2: nil,\n\t\tResponseWriter: nil,\n\t\tRequest: ctx.Request,\n\t\tPathParams: pathParams,\n\t\tqueryParams: ctx.queryParams,\n\t\tValidator: ctx.Validator,\n\t\tfetchClientIPFromHeader: ctx.fetchClientIPFromHeader,\n\t\thandlers: nil,\n\t\thandlerIndex: __abortHandlerIndex,\n\t\tkvs: ctx.kvs,\n\t}\n}", "func NewGetLolCatalogV1ItemsParamsWithContext(ctx context.Context) *GetLolCatalogV1ItemsParams {\n\tvar ()\n\treturn &GetLolCatalogV1ItemsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *PostV1IncidentsIncidentIDRelatedChangeEventsParams) WithContext(ctx context.Context) *PostV1IncidentsIncidentIDRelatedChangeEventsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewPostAPIV10PeerReviewsParamsWithContext(ctx context.Context) *PostAPIV10PeerReviewsParams {\n\tvar ()\n\treturn &PostAPIV10PeerReviewsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (in *CredentialProviderRequest) DeepCopy() *CredentialProviderRequest {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CredentialProviderRequest)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CloudEventContext) DeepCopy() *CloudEventContext {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CloudEventContext)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func Copy(scope *Scope, input tf.Output, optional ...CopyAttr) (output tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\tattrs := map[string]interface{}{}\n\tfor _, a := range optional {\n\t\ta(attrs)\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"Copy\",\n\t\tInput: []tf.Input{\n\t\t\tinput,\n\t\t},\n\t\tAttrs: attrs,\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (in *Choice) DeepCopy() *Choice {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Choice)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewRewardCommentsParamsWithContext(ctx context.Context) *RewardCommentsParams {\n\tvar ()\n\treturn &RewardCommentsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (in *GitCreds) DeepCopy() *GitCreds {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitCreds)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *GitSpec) DeepCopy() *GitSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewGetIngredientVersionRevisionParamsWithContext(ctx context.Context) *GetIngredientVersionRevisionParams {\n\treturn &GetIngredientVersionRevisionParams{\n\t\tContext: ctx,\n\t}\n}", "func (m *StepData) GetContextParameterFilters() StepFilters {\n\tvar filters StepFilters\n\tcontextFilters := []string{}\n\tfor _, secret := range m.Spec.Inputs.Secrets {\n\t\tcontextFilters = append(contextFilters, secret.Name)\n\t}\n\n\tif len(m.Spec.Inputs.Resources) > 0 {\n\t\tfor _, res := range m.Spec.Inputs.Resources {\n\t\t\tif res.Type == \"stash\" {\n\t\t\t\tcontextFilters = append(contextFilters, \"stashContent\")\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif len(m.Spec.Containers) > 0 {\n\t\tparameterKeys := []string{\"containerCommand\", \"containerShell\", \"dockerEnvVars\", \"dockerImage\", \"dockerName\", \"dockerOptions\", \"dockerPullImage\", \"dockerVolumeBind\", \"dockerWorkspace\", \"dockerRegistryUrl\", \"dockerRegistryCredentialsId\"}\n\t\tfor _, container := range m.Spec.Containers {\n\t\t\tfor _, condition := range container.Conditions {\n\t\t\t\tfor _, dependentParam := range condition.Params {\n\t\t\t\t\tparameterKeys = append(parameterKeys, dependentParam.Value)\n\t\t\t\t\tparameterKeys = append(parameterKeys, dependentParam.Name)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// ToDo: append dependentParam.Value & dependentParam.Name only according to correct parameter scope and not generally\n\t\tcontextFilters = append(contextFilters, parameterKeys...)\n\t}\n\tif len(m.Spec.Sidecars) > 0 {\n\t\t//ToDo: support fallback for \"dockerName\" configuration property -> via aliasing?\n\t\tcontextFilters = append(contextFilters, []string{\"containerName\", \"containerPortMappings\", \"dockerName\", \"sidecarEnvVars\", \"sidecarImage\", \"sidecarName\", \"sidecarOptions\", \"sidecarPullImage\", \"sidecarReadyCommand\", \"sidecarVolumeBind\", \"sidecarWorkspace\"}...)\n\t\t//ToDo: add condition param.Value and param.Name to filter as for Containers\n\t}\n\n\tcontextFilters = addVaultContextParametersFilter(m, contextFilters)\n\n\tif len(contextFilters) > 0 {\n\t\tfilters.All = append(filters.All, contextFilters...)\n\t\tfilters.General = append(filters.General, contextFilters...)\n\t\tfilters.Steps = append(filters.Steps, contextFilters...)\n\t\tfilters.Stages = append(filters.Stages, contextFilters...)\n\t\tfilters.Parameters = append(filters.Parameters, contextFilters...)\n\t\tfilters.Env = append(filters.Env, contextFilters...)\n\n\t}\n\treturn filters\n}", "func (c *SpanContext) CopyFrom(ctx *SpanContext) {\n\tc.traceID = ctx.traceID\n\tc.spanID = ctx.spanID\n\tc.parentID = ctx.parentID\n\tc.samplingState = ctx.samplingState\n\tif l := len(ctx.baggage); l > 0 {\n\t\tc.baggage = make(map[string]string, l)\n\t\tfor k, v := range ctx.baggage {\n\t\t\tc.baggage[k] = v\n\t\t}\n\t} else {\n\t\tc.baggage = nil\n\t}\n}", "func (c *Krds) ModifySecurityGroupWithContext(ctx aws.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {\n\treq, out := c.ModifySecurityGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (in *BackupResourceHookSpec) DeepCopy() *BackupResourceHookSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BackupResourceHookSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o *CommitOptions) GetChanges() []string {\n\tif o.Changes == nil {\n\t\tvar z []string\n\t\treturn z\n\t}\n\treturn o.Changes\n}", "func (in *NewPendingTxBodyNotificationParams) DeepCopy() *NewPendingTxBodyNotificationParams {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NewPendingTxBodyNotificationParams)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewChangeSet(ctx *pulumi.Context,\n\tname string, args *ChangeSetArgs, opts ...pulumi.ResourceOption) (*ChangeSet, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ChangeSetName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ChangeSetName'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource ChangeSet\n\terr := ctx.RegisterResource(\"alicloud:ros/changeSet:ChangeSet\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (c *Krds) CloneSecurityGroupWithContext(ctx aws.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {\n\treq, out := c.CloneSecurityGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (in *ContinuousParameterRangeSpecification) DeepCopy() *ContinuousParameterRangeSpecification {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ContinuousParameterRangeSpecification)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o *GetPublicsRecipeParams) WithContext(ctx context.Context) *GetPublicsRecipeParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewUpdateBuildPropertiesParamsWithContext(ctx context.Context) *UpdateBuildPropertiesParams {\n\tvar ()\n\treturn &UpdateBuildPropertiesParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *GetRecentFoodsParams) WithContext(ctx context.Context) *GetRecentFoodsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (om *Sdk) ApplyChanges(args []string) error {\n\tlogWriter := commands.NewLogWriter(os.Stdout)\n\tcmd := commands.NewApplyChanges(om.api, om.api, logWriter, om.logger, 10)\n\treturn cmd.Execute(args)\n}", "func (in *RestoreResourceHookSpec) DeepCopy() *RestoreResourceHookSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RestoreResourceHookSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (mr *MockPullRequestClientMockRecorder) GetPullRequestChanges(org, repo, number interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetPullRequestChanges\", reflect.TypeOf((*MockPullRequestClient)(nil).GetPullRequestChanges), org, repo, number)\n}", "func NewNarrowSearchRecipeParamsWithContext(ctx context.Context) *NarrowSearchRecipeParams {\n\tvar (\n\t\tsortbyDefault = string(\"name\")\n\t\tsortdirDefault = string(\"desc\")\n\t)\n\treturn &NarrowSearchRecipeParams{\n\t\tSortby: &sortbyDefault,\n\t\tSortdir: &sortdirDefault,\n\n\t\tContext: ctx,\n\t}\n}", "func (m *InstallVmtoolsParams) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateData(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateWhere(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}", "func NewExtrasSavedFiltersListParamsWithContext(ctx context.Context) *ExtrasSavedFiltersListParams {\n\treturn &ExtrasSavedFiltersListParams{\n\t\tContext: ctx,\n\t}\n}", "func NewGetServiceDetailsParamsWithContext(ctx context.Context) *GetServiceDetailsParams {\n\tvar ()\n\treturn &GetServiceDetailsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func RevisionContext(ns, svc, cfg, rev string) context.Context {\n\tkey := types.NamespacedName{Namespace: ns, Name: rev}\n\tif ctx, ok := contextCache.Get(key); ok {\n\t\treturn ctx.(context.Context)\n\t}\n\n\tctx := augmentWithRevision(context.Background(), ns, svc, cfg, rev)\n\tcontextCache.Add(key, ctx)\n\n\treturn ctx\n}", "func CopyWithContext(ctx context.Context, dst *Writer, src Stream) error {\n\tif err := src.Open(); err != nil {\n\t\treturn err\n\t}\n\tvar err error\n\tfor ctx.Err() == nil {\n\t\tvar pair Pair\n\t\tpair, err = src.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif pair.Key == nil {\n\t\t\tbreak\n\t\t}\n\t\terr = dst.Write(pair)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn ctx.Err()\n}", "func (m *MockchangeSetAPI) WaitUntilChangeSetCreateCompleteWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeChangeSetInput, arg2 ...request.WaiterOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"WaitUntilChangeSetCreateCompleteWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (in *S3Context) DeepCopy() *S3Context {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(S3Context)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o *GetContactsParams) WithModifiedSince(modifiedSince *strfmt.DateTime) *GetContactsParams {\n\to.SetModifiedSince(modifiedSince)\n\treturn o\n}", "func NewGetUserAuditLogsConnectionParamsWithContext(ctx context.Context) *GetUserAuditLogsConnectionParams {\n\treturn &GetUserAuditLogsConnectionParams{\n\t\tContext: ctx,\n\t}\n}", "func (m *Mockapi) WaitUntilChangeSetCreateCompleteWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeChangeSetInput, arg2 ...request.WaiterOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"WaitUntilChangeSetCreateCompleteWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (in *CrdSpec) DeepCopy() *CrdSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CrdSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CommonSpec) DeepCopy() *CommonSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CommonSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *CommonSpec) DeepCopy() *CommonSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CommonSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (m *MockRDSAPI) CopyDBClusterSnapshotWithContext(arg0 aws.Context, arg1 *rds.CopyDBClusterSnapshotInput, arg2 ...request.Option) (*rds.CopyDBClusterSnapshotOutput, error) {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"CopyDBClusterSnapshotWithContext\", varargs...)\n\tret0, _ := ret[0].(*rds.CopyDBClusterSnapshotOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (m *MockS3API) UploadPartCopyWithContext(arg0 context.Context, arg1 *s3.UploadPartCopyInput, arg2 ...request.Option) (*s3.UploadPartCopyOutput, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"UploadPartCopyWithContext\", varargs...)\n\tret0, _ := ret[0].(*s3.UploadPartCopyOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func NewCustomerGatewayUpdateOwnershipParamsWithContext(ctx context.Context) *CustomerGatewayUpdateOwnershipParams {\n\tvar ()\n\treturn &CustomerGatewayUpdateOwnershipParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *WorkflowCatalogServiceRequest) GetSelectionCriteriaInputs() []ServiceitemSelectionCriteriaInput {\n\tif o == nil {\n\t\tvar ret []ServiceitemSelectionCriteriaInput\n\t\treturn ret\n\t}\n\treturn o.SelectionCriteriaInputs\n}", "func (o *QueryChangesParams) WithDefaults() *QueryChangesParams {\n\to.SetDefaults()\n\treturn o\n}", "func NewMakeSnapshotArgs(layerID LayerID) *MakeSnapshotArgs {\n\targs := new(MakeSnapshotArgs)\n\targs.LayerID = layerID\n\treturn args\n}", "func (m Manager) GetChanges(context.Context, *pb.GetChangesRequest) (*pb.GetChangesResponse, error) {\n\tchanges, err := m.repo.GetAll()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pb.GetChangesResponse{Changes: changes}, nil\n}", "func (l *LabelEvent) GetChanges() *EditChange {\n\tif l == nil {\n\t\treturn nil\n\t}\n\treturn l.Changes\n}" ]
[ "0.7866671", "0.78459364", "0.7305147", "0.65556616", "0.59407496", "0.5868117", "0.5521566", "0.50582105", "0.48954266", "0.4673309", "0.44319955", "0.43159604", "0.4264343", "0.42311433", "0.40826327", "0.40715033", "0.4071279", "0.40607655", "0.39594117", "0.38937762", "0.3864576", "0.3842568", "0.38322037", "0.38188782", "0.3813321", "0.3774964", "0.37609944", "0.37572223", "0.37567598", "0.3752687", "0.37335092", "0.3704852", "0.36798385", "0.36753094", "0.3674576", "0.36708575", "0.36669868", "0.366307", "0.36578894", "0.36366335", "0.3626938", "0.36021295", "0.35986683", "0.35965535", "0.35858685", "0.35779923", "0.3573573", "0.3568671", "0.35369998", "0.35282803", "0.35276163", "0.35245803", "0.35160434", "0.3500678", "0.3498514", "0.34974495", "0.34967914", "0.34946638", "0.3493289", "0.34830326", "0.3457799", "0.34573483", "0.34558386", "0.3453062", "0.3450547", "0.34477168", "0.34440368", "0.34405082", "0.34389812", "0.34374878", "0.3437466", "0.3436546", "0.34287992", "0.34238464", "0.34231818", "0.34225973", "0.3419285", "0.3417254", "0.34152198", "0.34142503", "0.3410739", "0.3409042", "0.34075728", "0.3401796", "0.33976027", "0.3390453", "0.3389154", "0.33848533", "0.33821052", "0.337943", "0.33792663", "0.33792663", "0.3376983", "0.3372704", "0.33662507", "0.33657944", "0.3365439", "0.33646902", "0.33643103", "0.33628964" ]
0.83000755
0
NewCopyRecipeToMyRecipesWithChangesParamsWithHTTPClient creates a new CopyRecipeToMyRecipesWithChangesParams object with the default values initialized, and the ability to set a custom HTTPClient for a request
NewCopyRecipeToMyRecipesWithChangesParamsWithHTTPClient создает новый объект CopyRecipeToMyRecipesWithChangesParams с инициализацией значений по умолчанию, а также возможность установить пользовательский HTTPClient для запроса
func NewCopyRecipeToMyRecipesWithChangesParamsWithHTTPClient(client *http.Client) *CopyRecipeToMyRecipesWithChangesParams { var () return &CopyRecipeToMyRecipesWithChangesParams{ HTTPClient: client, } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *CopyRecipeToMyRecipesWithChangesParams) WithHTTPClient(client *http.Client) *CopyRecipeToMyRecipesWithChangesParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetPublicsRecipeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *QueryChangesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ChatNewParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RevertProductSnapshotRequestUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostReconciliationParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetIngredientVersionRevisionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *BudgetAddParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetReceiptsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ConfigurationBackupModifyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostPartsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewPostReconciliationParamsWithHTTPClient(client *http.Client) *PostReconciliationParams {\n\tvar ()\n\treturn &PostReconciliationParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *QueryChangesParams) WithHTTPClient(client *http.Client) *QueryChangesParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *AddBranchParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *NarrowSearchRecipeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ApplicationComponentSnapshotCollectionGetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetRequestDetailsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCrossConnectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateWidgetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EditParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetWorkItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PetCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddRepositoryParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostReconciliationParams) WithHTTPClient(client *http.Client) *PostReconciliationParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func WithHTTPClient(httpClient *http.Client) ClientOption {\n\treturn func(c *client) error {\n\t\tif httpClient == nil {\n\t\t\treturn errors.InvalidParameterError{Parameter: \"httpClient\", Reason: \"cannot be empty\"}\n\t\t}\n\n\t\tc.requester.Client = httpClient\n\t\treturn nil\n\t}\n}", "func (o *CreateCartUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostAPIV3MachinesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreatePackageRepositoryDeltaUploadParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateVolumeBackupParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreatePolicyResetItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostMeArticlesDraftsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetRedbeamsFlowLogsProgressByResourceCrnParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ContainerUpdateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ConfigurationBackupGetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *FileInfoCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *InventoryStocktakingSearchParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetBackupLocationsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateRunbookParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RepoGetAllCommitsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetRecentFoodsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PcloudPvminstancesSnapshotsRestorePostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateInstantPaymentParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *LogRequestDownloadParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateRunbookRunCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *IntegrationsManualHTTPSCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PatchReferenceEntityRecordsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RewardCommentsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateStockReceiptParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewConvertParamsWithHTTPClient(client *http.Client) *ConvertParams {\n\tvar ()\n\treturn &ConvertParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *EstimateCoinBuyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ImagePushParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddOrUpdateNodePoolConfigItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewAddItemParamsWithHTTPClient(client *http.Client) *AddItemParams {\n\tvar ()\n\treturn &AddItemParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *GetPaymentsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewHTTPClient(tc *trace.Client, orig *http.Client) *HTTPClient {\n\tif orig == nil {\n\t\torig = http.DefaultClient\n\t}\n\trt := orig.Transport\n\tif rt == nil {\n\t\trt = http.DefaultTransport\n\t}\n\tclient := http.Client{\n\t\tTransport: &tracerTransport{base: rt},\n\t\tCheckRedirect: orig.CheckRedirect,\n\t\tJar: orig.Jar,\n\t\tTimeout: orig.Timeout,\n\t}\n\treturn &HTTPClient{\n\t\tClient: client,\n\t\ttc: tc,\n\t}\n}", "func (o *PostMenuItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ConvertParams) WithHTTPClient(client *http.Client) *ConvertParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *CreateLifecycleParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *BackupsCreateStatusParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *WaitListParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CapacityPoolGetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PollersPostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCardPaymentSourceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewBarParamsWithHTTPClient(client *http.Client) *BarParams {\n\tvar ()\n\treturn &BarParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *SharedCatalogSharedCatalogRepositoryV1SavePostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CustomerGatewayUpdateOwnershipParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetDistroXOperationProgressByResourceCrnParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *LedgerVoucherPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateListParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *BucketsCollectionGetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewHTTPClient(options ...Opt) *HTTP {\n\tc := &HTTP{\n\t\tHTTPClient: &http.Client{},\n\t}\n\n\tfor _, option := range options {\n\t\toption(c)\n\t}\n\n\tif c.latestManifestURLFmt == \"\" {\n\t\tc.latestManifestURLFmt = defaultLatestManifestURLFmt\n\t}\n\n\tif c.manifestURLFmt == \"\" {\n\t\tc.manifestURLFmt = defaultManifestURLFmt\n\t}\n\n\treturn c\n}", "func (o *GetCreationTasksParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateBuildPropertiesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PayAllInvoicesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PayAllInvoicesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetContentSourceUsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *FreezeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *NearestUsingGET1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostDocumentMergeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CloudTargetCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GiftMessageCartRepositoryV1SavePostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ConvertParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetZippedParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CheckTransactionCreditLimitParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateCredentialParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostAPIV10PeerReviewsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostV1ChangesChangeIDIdentitiesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateRepoNotificationParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetGCParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SavePreferencesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetV1IntegrationsAwsCloudtrailBatchesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ChatNewParams) WithHTTPClient(client *http.Client) *ChatNewParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *PatchAddonParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}" ]
[ "0.7614183", "0.7191112", "0.60642815", "0.6035904", "0.6035271", "0.601885", "0.596128", "0.5958554", "0.5913607", "0.5900584", "0.58948666", "0.5868178", "0.5853816", "0.5807214", "0.5771283", "0.5759591", "0.5750537", "0.57373995", "0.5735678", "0.57353026", "0.5731023", "0.5728886", "0.5717779", "0.571097", "0.5705245", "0.5704444", "0.57024497", "0.57021934", "0.5697534", "0.56789833", "0.5672361", "0.5668083", "0.56656694", "0.56633604", "0.56613314", "0.5660155", "0.5655626", "0.56448334", "0.56381404", "0.5637204", "0.5633252", "0.56267506", "0.56253225", "0.5620838", "0.56169116", "0.5612991", "0.56084293", "0.5603547", "0.56028503", "0.55996263", "0.5599019", "0.5594215", "0.5593145", "0.559071", "0.55899197", "0.55895495", "0.5574314", "0.55686575", "0.556664", "0.5557696", "0.55560964", "0.55516654", "0.5550406", "0.55494535", "0.5547117", "0.5546348", "0.55420315", "0.5541407", "0.55401", "0.5532894", "0.5531079", "0.5526014", "0.5524486", "0.5524455", "0.552166", "0.5516429", "0.55163825", "0.5516117", "0.5515396", "0.55149424", "0.55149424", "0.5514349", "0.5513633", "0.5509976", "0.550896", "0.5507775", "0.5507527", "0.55066335", "0.55062", "0.55042285", "0.5503505", "0.5503007", "0.5501636", "0.55005294", "0.5499335", "0.5496578", "0.5489046", "0.54874665", "0.54872245", "0.5487055" ]
0.746175
1
WithTimeout adds the timeout to the copy recipe to my recipes with changes params
WithTimeout добавляет таймаут в рецепт копирования в мои рецепты с изменениями параметров
func (o *CopyRecipeToMyRecipesWithChangesParams) WithTimeout(timeout time.Duration) *CopyRecipeToMyRecipesWithChangesParams { o.SetTimeout(timeout) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *CopyRecipeToMyRecipesWithChangesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetPublicsRecipeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewCopyRecipeToMyRecipesWithChangesParamsWithTimeout(timeout time.Duration) *CopyRecipeToMyRecipesWithChangesParams {\n\tvar ()\n\treturn &CopyRecipeToMyRecipesWithChangesParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (b *taskBuilder) timeout(timeout time.Duration) {\n\tb.Spec.ExecutionTimeout = timeout\n\tb.Spec.IoTimeout = timeout // With kitchen, step logs don't count toward IoTimeout.\n}", "func (o *GetIngredientVersionRevisionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *NarrowSearchRecipeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *NarrowSearchRecipeParams) WithTimeout(timeout time.Duration) *NarrowSearchRecipeParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func WithTimeout(duration time.Duration) ReconcilerOption {\n\treturn func(r *Reconciler) {\n\t\tr.timeout = duration\n\t}\n}", "func WithTimeout(t time.Duration) OptFunc {\n\treturn func(d *Downloader) {\n\t\td.timeout = t\n\t}\n}", "func (o *GetPublicsRecipeParams) WithTimeout(timeout time.Duration) *GetPublicsRecipeParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func WithTimeout(timeout time.Duration) Option {\n\treturn func(opts *Opts) error {\n\t\topts.Timeout = timeout\n\t\treturn nil\n\t}\n}", "func (o *GetNutritionForSingleParsedPlainTextIngredientParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(timeout time.Duration) BuilderOptionFunc {\n\treturn func(b *Builder) error {\n\t\tb.timeout = timeout\n\t\treturn nil\n\t}\n}", "func (o *GetReceiptsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(timeout time.Duration) Option {\n\treturn func(o *options) {\n\t\to.timeout = timeout\n\t}\n}", "func WithTimeout(timeout time.Duration) Option {\n\treturn func(o *options) {\n\t\to.timeout = timeout\n\t}\n}", "func (o *AddRepositoryParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *AddItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (pool *ComplexPool) SetTimeout(timeout time.Duration) {\n\tlogger.Debugf(\"prox (%p): setting timeout: %v\", pool, timeout)\n\tpool.timeout = timeout\n}", "func WithTimeout(timeout time.Duration) Option {\n\treturn func(opts *Options) {\n\t\topts.Timeout = timeout\n\t}\n}", "func NewNarrowSearchRecipeParamsWithTimeout(timeout time.Duration) *NarrowSearchRecipeParams {\n\tvar (\n\t\tsortbyDefault = string(\"name\")\n\t\tsortdirDefault = string(\"desc\")\n\t)\n\treturn &NarrowSearchRecipeParams{\n\t\tSortby: &sortbyDefault,\n\t\tSortdir: &sortdirDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(duration time.Duration) Option {\n\treturn wrappedOption{otlpconfig.WithTimeout(duration)}\n}", "func WithTimeout(timeout time.Duration) ClientOption {\n\treturn withTimeout{timeout}\n}", "func (o *RevertProductSnapshotRequestUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *BudgetAddParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateRunbookRunCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *AddOrUpdateNodePoolConfigItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(duration time.Duration) Option {\n\treturn wrappedOption{oconf.WithTimeout(duration)}\n}", "func cloneWithTimeout(httpClient *http.Client, t time.Duration) (*http.Client, error) {\n\tif httpClient == nil {\n\t\treturn nil, fmt.Errorf(\"nil HTTP client\")\n\t} else if httpClient.Transport == nil {\n\t\treturn nil, fmt.Errorf(\"nil HTTP client transport\")\n\t}\n\n\tif t.Nanoseconds() < 0 {\n\t\treturn httpClient, nil\n\t}\n\n\ttr, ok := httpClient.Transport.(*http.Transport)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unexpected HTTP transport: %T\", httpClient.Transport)\n\t}\n\n\t// copy all public fields, to avoid copying transient state and locks\n\tntr := &http.Transport{\n\t\tProxy: tr.Proxy,\n\t\tDialContext: tr.DialContext,\n\t\tDial: tr.Dial,\n\t\tDialTLS: tr.DialTLS,\n\t\tTLSClientConfig: tr.TLSClientConfig,\n\t\tTLSHandshakeTimeout: tr.TLSHandshakeTimeout,\n\t\tDisableKeepAlives: tr.DisableKeepAlives,\n\t\tDisableCompression: tr.DisableCompression,\n\t\tMaxIdleConns: tr.MaxIdleConns,\n\t\tMaxIdleConnsPerHost: tr.MaxIdleConnsPerHost,\n\t\tMaxConnsPerHost: tr.MaxConnsPerHost,\n\t\tIdleConnTimeout: tr.IdleConnTimeout,\n\t\tResponseHeaderTimeout: tr.ResponseHeaderTimeout,\n\t\tExpectContinueTimeout: tr.ExpectContinueTimeout,\n\t\tTLSNextProto: tr.TLSNextProto,\n\t\tProxyConnectHeader: tr.ProxyConnectHeader,\n\t\tMaxResponseHeaderBytes: tr.MaxResponseHeaderBytes,\n\t}\n\n\t// apply timeout\n\tntr.DialContext = (&net.Dialer{\n\t\tTimeout: t,\n\t\tKeepAlive: 30 * time.Second,\n\t}).DialContext\n\n\t// clone http client with new transport\n\tnc := *httpClient\n\tnc.Transport = ntr\n\treturn &nc, nil\n}", "func WithTimeout(t time.Duration) Option {\n\treturn func(c *Client) { c.httpClient.Timeout = t }\n}", "func (o *CreateCartUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *FileInfoCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(timeout time.Duration) Option {\n\treturn func(c *Client) {\n\t\tc.client.Timeout = timeout\n\t}\n}", "func WithTimeout(timeout time.Duration) Option {\n\treturn func(c *Client) {\n\t\tc.client.Timeout = timeout\n\t}\n}", "func WithTimeout(timeout time.Duration) ClientOption {\n\treturn optionFunc(func(c *Client) {\n\t\tc.WithTimeout(timeout)\n\t})\n}", "func (o *EditParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "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}", "func (o *PutMenuItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EditParams) WithTimeout(timeout time.Duration) *EditParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *GetActionTemplateLogoVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (c *OrganizationsEnvironmentsApisRevisionsDebugsessionsCreateCall) Timeout(timeout int64) *OrganizationsEnvironmentsApisRevisionsDebugsessionsCreateCall {\n\tc.urlParams_.Set(\"timeout\", fmt.Sprint(timeout))\n\treturn c\n}", "func (c *Connection) CopyToRemoteWithRetry(hostname, path string, sleep, timeout time.Duration) error {\n\tctx, cancel := context.WithTimeout(context.Background(), timeout)\n\tdefer cancel()\n\tch := make(chan error)\n\tvar mostRecentCopyToRemoteWithRetry error\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tch <- c.CopyToRemote(hostname, path)\n\t\t\t\ttime.Sleep(sleep)\n\t\t\t}\n\t\t}\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase result := <-ch:\n\t\t\tmostRecentCopyToRemoteWithRetry = result\n\t\t\tif mostRecentCopyToRemoteWithRetry == nil {\n\t\t\t\treturn nil\n\t\t\t}\n\t\tcase <-ctx.Done():\n\t\t\treturn errors.Errorf(\"CopyToRemoteWithRetry timed out: %s\\n\", mostRecentCopyToRemoteWithRetry)\n\t\t}\n\t}\n}", "func (o *AddItemParams) WithTimeout(timeout time.Duration) *AddItemParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *PetCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RegenerateDeployKeyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetPrivateToggleDepositAddressCreationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(ctx context.Context, time time.Duration) (ret context.Context) {\n\tret = context.WithValue(ctx, liverpc.KeyTimeout, time)\n\treturn\n}", "func (o *AddBranchParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func Timeout(t time.Duration) ClientOpt {\n\treturn func(c *Client) {\n\t\tc.HTTPClient.Timeout = t\n\t}\n}", "func (c *Closer) AddTimeout(close func(ctx context.Context) error, timeout time.Duration) {\n\tc.closers = append(c.closers, &timeoutCloser{close: close, timeout: timeout})\n}", "func (o *GetRepository15Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func AddTimeout() {}", "func (x Go) Timeout(timeout time.Duration) Go {\n\tx.timeout = timeout\n\treturn x\n}", "func WithTimeout(timeout time.Duration) configF {\n\treturn func(c *config) *config {\n\t\tc.defaultTimeout = timeout\n\t\treturn c\n\t}\n}", "func (o *GetZippedParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetBuildPropertiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetDistroXOperationProgressByResourceCrnParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(timeout time.Duration) Option {\n\treturn func(opts *VDRI) {\n\t\topts.client.Timeout = timeout\n\t}\n}", "func (o *CreatePolicyResetItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func WithTimeout(timeout int) CreateDBOpFn {\n\treturn func(op *CreateDBOp) {\n\t\tif 0 == timeout {\n\t\t\treturn\n\t\t}\n\t\top.timeout = &timeout\n\t\top.set = true\n\t}\n}", "func (ini *Init) AddWithTimeout(timeout time.Duration, f func(ctx context.Context) (any, error)) *Init {\n\treturn ini.Add(func(ctx context.Context) (any, error) {\n\t\treturn ini.withTimeout(ctx, timeout, f)\n\t})\n}", "func (o *CreateBlueprintInWorkspaceInternalParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func Timeout(timeout int64) Option {\n\treturn func(opts *options) {\n\t\topts.timeout = time.Duration(timeout) * time.Second\n\t}\n}", "func WithTimeout(t time.Duration) apiOption {\n\treturn func(m *Management) {\n\t\tm.timeout = t\n\t}\n}", "func WithPoolTimeout(timeout time.Duration) OptsFunc {\n\treturn func(o *redis.Options) {\n\t\to.PoolTimeout = timeout\n\t}\n}", "func (o *PatchAddonParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateWidgetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func Timeout(timeout time.Duration) OptionFunc {\n\treturn func(tc *TracedClient) error {\n\t\tif timeout <= 0 {\n\t\t\treturn errors.New(\"timeout must be positive\")\n\t\t}\n\t\ttc.cl.Timeout = timeout\n\t\treturn nil\n\t}\n}", "func (o *FreezeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostMenuItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (m *monitor) withTimeout(timeout time.Duration) *monitor {\n\tm.timeout = timeout\n\treturn m\n}", "func (o *CreateCrossConnectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CloudNFSExportAddParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ConfigurationBackupModifyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PatchLibrariesByIDContentByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateRunbookParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostReconciliationParams) WithTimeout(timeout time.Duration) *PostReconciliationParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *UpdateBuildPropertiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ListDCForSeedParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetInterceptionitemsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostReconciliationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetProductsByIDVariationAttributesByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetExampleNewProjectDescriptionCompatibilityVersion1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func Timeout(t time.Duration) Option {\n\treturn func(c *Config) Option {\n\t\tprevious := c.Timeout\n\t\tc.Timeout = t\n\t\treturn Timeout(previous)\n\t}\n}", "func (o *GetRestoreDatalakeStatusParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *InventoryStocktakingSearchParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (r *Search) Timeout(timeout string) *Search {\n\n\tr.req.Timeout = &timeout\n\n\treturn r\n}", "func (f Reindex) WithTimeout(v time.Duration) func(*ReindexRequest) {\n\treturn func(r *ReindexRequest) {\n\t\tr.Timeout = v\n\t}\n}", "func (o *PcloudPvminstancesSnapshotsRestorePostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetClusterTemplateByNameInWorkspaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetItemByAppIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCardPaymentSourceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetLolCatalogV1ItemsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CustomerGatewayUpdateOwnershipParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetContentSourceUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (c *CentralCacheTestImpl) SetWithTimeout(item Item, serialize bool, compress bool, ttl int32) error {\n\treturn nil\n}", "func Timeout(timeout time.Duration) Option {\n\treturn func(client *http.Client) {\n\t\tclient.Timeout = timeout\n\t}\n}", "func Timeout(timeout time.Duration) Option {\n\treturn func(client *http.Client) {\n\t\tclient.Timeout = timeout\n\t}\n}" ]
[ "0.6520962", "0.5858076", "0.57581943", "0.5501371", "0.52934045", "0.5210673", "0.52082425", "0.5182034", "0.5154618", "0.508878", "0.50811505", "0.5077336", "0.50460726", "0.50446784", "0.5041395", "0.5041395", "0.5026333", "0.50209403", "0.49826825", "0.49667513", "0.49350506", "0.49000707", "0.48991832", "0.4899181", "0.48789322", "0.4878208", "0.48661205", "0.4862972", "0.4859411", "0.48487413", "0.4819714", "0.48195753", "0.48054454", "0.47872126", "0.47872126", "0.47812507", "0.4779445", "0.47775674", "0.476841", "0.47561425", "0.47559643", "0.47523353", "0.47439048", "0.4737756", "0.4732429", "0.47218335", "0.47116056", "0.47065336", "0.46980414", "0.46864238", "0.46831948", "0.46825367", "0.46799856", "0.46797565", "0.4672737", "0.46667558", "0.46653873", "0.46607205", "0.46479845", "0.46294", "0.4628776", "0.46286863", "0.462782", "0.46273237", "0.46265063", "0.462428", "0.46225348", "0.46161023", "0.4609931", "0.46094197", "0.46013364", "0.4598539", "0.45956787", "0.45955542", "0.45949632", "0.4591241", "0.4590414", "0.45893514", "0.4586748", "0.45867077", "0.4583725", "0.4581197", "0.45792067", "0.45781863", "0.4574672", "0.45735958", "0.457203", "0.457064", "0.45685962", "0.45676365", "0.45647547", "0.45629534", "0.4559099", "0.4558703", "0.45582998", "0.4557191", "0.45559624", "0.4547357", "0.45460075", "0.45460075" ]
0.7105756
0
SetTimeout adds the timeout to the copy recipe to my recipes with changes params
SetTimeout добавляет таймаут в копию рецепта в мои рецепты с изменениями параметров
func (o *CopyRecipeToMyRecipesWithChangesParams) SetTimeout(timeout time.Duration) { o.timeout = timeout }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *CopyRecipeToMyRecipesWithChangesParams) WithTimeout(timeout time.Duration) *CopyRecipeToMyRecipesWithChangesParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *GetPublicsRecipeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetIngredientVersionRevisionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *NarrowSearchRecipeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (pool *ComplexPool) SetTimeout(timeout time.Duration) {\n\tlogger.Debugf(\"prox (%p): setting timeout: %v\", pool, timeout)\n\tpool.timeout = timeout\n}", "func (o *GetReceiptsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetNutritionForSingleParsedPlainTextIngredientParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EditParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetActionTemplateLogoVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (b *taskBuilder) timeout(timeout time.Duration) {\n\tb.Spec.ExecutionTimeout = timeout\n\tb.Spec.IoTimeout = timeout // With kitchen, step logs don't count toward IoTimeout.\n}", "func (o *AddOrUpdateNodePoolConfigItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *AddItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *AddRepositoryParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RevertProductSnapshotRequestUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCartUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetWorkflowBuildTaskMetaMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetBuildPropertiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *FileInfoCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *FreezeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetRestoreDatalakeStatusParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateNetworkCellularGatewaySettingsSubnetPoolParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (p *WorkPool) SetTimeout(timeout time.Duration) { // 设置超时时间\n\tp.timeout = timeout\n}", "func (o *UpdateBuildPropertiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func SetTimeout(dur time.Duration) { note.Timeout = dur }", "func (o *PutMenuItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ConfigurationBackupModifyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateWidgetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateRunbookParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateRunbookRunCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetZippedParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PatchAddonParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetDistroXOperationProgressByResourceCrnParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateScriptParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostMenuItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RegenerateDeployKeyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetPrivateToggleDepositAddressCreationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreatePolicyResetItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *VectorThumbnailParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SetUniverseBackupFlagParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetRedbeamsFlowLogsProgressByResourceCrnParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ToggleNetworkGeneratorsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CustomerGatewayUpdateOwnershipParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetExampleNewProjectDescriptionCompatibilityVersion1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PcloudPvminstancesSnapshotsRestorePostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateLifecycleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateBlueprintInWorkspaceInternalParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostReconciliationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetRepository15Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetClusterTemplateByNameInWorkspaceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreatePackageRepositoryDeltaUploadParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetProductsByIDVariationAttributesByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ListDCForSeedParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetInterceptionitemsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetLolCatalogV1ItemsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateVolumeBackupParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostPartsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateDmrClusterLinkParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SkuPackPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCrossConnectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *AddBranchParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *InventoryStocktakingSearchParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetIconParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetWorkItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostAPIV3MachinesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetNetworkAppliancePortParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *BudgetAddParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func SetTimeout(timeout time.Duration) {\n\tclient.SetTimeout(timeout)\n}", "func (o *GetDatalakeDbConfigParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetContentSourceUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DevicesGetModuleComponentCommandHistoryParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CloudTargetCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewCopyRecipeToMyRecipesWithChangesParamsWithTimeout(timeout time.Duration) *CopyRecipeToMyRecipesWithChangesParams {\n\tvar ()\n\treturn &CopyRecipeToMyRecipesWithChangesParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *GetaspecificPbxDeviceFirmwareBinaryParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetRemotesupportConnectemcParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateStockReceiptParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PetCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (m *RedirectPostRequestBody) SetTimeout(value *int32)() {\n m.timeout = value\n}", "func (o *AddVMParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateSubnetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutFlagSettingParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SharedCatalogSharedCatalogRepositoryV1SavePostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UploadWorkflowTemplateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetBootstrapParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RebuildIndexSetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UploadDeployFileParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetPrivateOrderstateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteNetworksNetworkIDTiersTierIDImagesImageNameParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PatchSepainstantIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PatchAssetDeviceConfigurationsMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateAddonParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCardPaymentSourceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (xmlmc *XmlmcInstStruct) SetTimeout(timeout int) {\n\txmlmc.timeout = timeout\n}", "func (o *CatalogProductTierPriceManagementV1AddPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateTransactionCategorizationRuleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *BackupsCreateStatusParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetBundleByKeyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CloudNFSExportAddParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *VirtualizationChoicesReadParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}" ]
[ "0.6950563", "0.6872008", "0.63673514", "0.63112706", "0.62673944", "0.6094319", "0.6092785", "0.6001111", "0.59669495", "0.59356844", "0.5930924", "0.59246594", "0.5920255", "0.58911455", "0.58869755", "0.58824813", "0.5843332", "0.58411634", "0.5800582", "0.5796857", "0.57948065", "0.57835805", "0.57832783", "0.5781934", "0.5781316", "0.57804054", "0.5777273", "0.57694006", "0.57664967", "0.5754906", "0.57374287", "0.57355785", "0.5734713", "0.5725351", "0.572487", "0.5718388", "0.5711212", "0.5707071", "0.5701812", "0.5701267", "0.5693274", "0.56899804", "0.56861067", "0.56817704", "0.56743205", "0.5674021", "0.5669791", "0.5663938", "0.56621635", "0.56573623", "0.56402415", "0.5637113", "0.5635821", "0.5630474", "0.5629576", "0.5623465", "0.56203043", "0.5619131", "0.56182027", "0.56177384", "0.561342", "0.5612413", "0.5611636", "0.5595247", "0.5594694", "0.5593178", "0.55898327", "0.5587626", "0.5586399", "0.5581521", "0.5581301", "0.55789953", "0.5576991", "0.5576102", "0.5575919", "0.5568991", "0.55657613", "0.5562352", "0.55609363", "0.5549682", "0.5545799", "0.5545378", "0.55443364", "0.5543263", "0.5542479", "0.55385107", "0.55372375", "0.5535468", "0.5535421", "0.55328566", "0.5531095", "0.55301094", "0.5523148", "0.55207884", "0.5513605", "0.55127084", "0.5511358", "0.55055845", "0.5505483", "0.55045646" ]
0.74348015
0
WithHTTPClient adds the HTTPClient to the copy recipe to my recipes with changes params
WithHTTPClient добавляет HTTPClient в копию рецепта в мои рецепты с изменениями параметров
func (o *CopyRecipeToMyRecipesWithChangesParams) WithHTTPClient(client *http.Client) *CopyRecipeToMyRecipesWithChangesParams { o.SetHTTPClient(client) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *CopyRecipeToMyRecipesWithChangesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetPublicsRecipeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RevertProductSnapshotRequestUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewCopyRecipeToMyRecipesWithChangesParamsWithHTTPClient(client *http.Client) *CopyRecipeToMyRecipesWithChangesParams {\n\tvar ()\n\treturn &CopyRecipeToMyRecipesWithChangesParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *GetIngredientVersionRevisionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetReceiptsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *BudgetAddParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(httpClient *http.Client) ClientOption {\n\treturn func(c *Client) {\n\t\tc.sling.Client(httpClient)\n\t}\n}", "func (o *GetNutritionForSingleParsedPlainTextIngredientParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *NarrowSearchRecipeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(c *http.Client) func(*Client) {\n\treturn func(mr *Client) {\n\t\tmr.client = c\n\t}\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCartUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EditParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func withHTTPClient(target *http.Client) ClientOption {\n\treturn func(subject *client) {\n\t\tsubject.client = target\n\t}\n}", "func (o *PostReconciliationParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(httpClient *http.Client) ClientOption {\n\treturn func(c *client) error {\n\t\tif httpClient == nil {\n\t\t\treturn errors.InvalidParameterError{Parameter: \"httpClient\", Reason: \"cannot be empty\"}\n\t\t}\n\n\t\tc.requester.Client = httpClient\n\t\treturn nil\n\t}\n}", "func (o *PostPartsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *FreezeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ConfigurationBackupModifyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(client *http.Client) OptionFunc {\n\treturn func(c *Client) {\n\t\tc.client = client\n\t}\n}", "func WithHTTPClient(client *http.Client) func(c *Client) error {\n\treturn func(c *Client) error {\n\t\tif client == nil {\n\t\t\treturn errors.New(\"HTTP client is nil\")\n\t\t}\n\t\tc.client = client\n\t\treturn nil\n\t}\n}", "func WithHTTPClient(client *http.Client) Opt {\n\treturn func(c *Client) error {\n\t\tif client != nil {\n\t\t\tc.client = client\n\t\t}\n\t\treturn nil\n\t}\n}", "func (o *AddOrUpdateNodePoolConfigItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(client *http.Client) Opt {\n\treturn func(c *Client) {\n\t\tc.httpClient = client\n\t}\n}", "func (o *AddBranchParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(h *http.Client) Opts {\n\treturn func(r *retryable) {\n\t\tr.httpClient = h\n\t}\n}", "func (o *CreatePolicyResetItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(httpclient *http.Client) ClientOption {\n\treturn func(client *Client) {\n\t\tclient.httpClient = httpclient\n\t}\n}", "func (o *PostMenuItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func SetHTTPClient(httpClient *http.Client) func(*Client) error {\n\treturn func(client *Client) error {\n\t\tclient.client = httpClient\n\n\t\treturn nil\n\t}\n}", "func WithHTTPClient(httpClient *http.Client) ClientOption {\n\treturn func(client *Client) {\n\t\tclient.httpClient = httpClient\n\t}\n}", "func (o *PatchAddonParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetPrivateToggleDepositAddressCreationParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddRepositoryParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RewardCommentsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutMenuItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(c *http.Client) Option {\n\treturn func(args *Client) {\n\t\targs.httpClient = c\n\t}\n}", "func (o *PostMeArticlesDraftsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateStockReceiptParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RemoveDropRequestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateRunbookParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateAddonParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *InventoryStocktakingSearchParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetInterceptionitemsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(httpClient *http.Client) ClientOption {\n\treturn func(c *Client) {\n\t\tc.httpClient = httpClient\n\t}\n}", "func (o *CustomerGatewayUpdateOwnershipParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ChatNewParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func AddClient(nbmaster string, httpClient *http.Client, jwt string) {\r\n fmt.Printf(\"\\nSending a PUT request to add client %s to policy %s...\\n\", testClientName, testPolicyName)\r\n\r\n client := map[string]interface{}{\r\n \"data\": map[string]interface{}{\r\n \"type\": \"client\",\r\n \"attributes\": map[string]string{\r\n \"hardware\": \"VMware\",\r\n \"hostName\": \"MEDIA_SERVER\",\r\n \"OS\": \"VMware\"}}}\r\n\r\n clientRequest, _ := json.Marshal(client)\r\n\r\n uri := \"https://\" + nbmaster + \":\" + port + \"/netbackup/\" + policiesUri + testPolicyName + \"/clients/\" + testClientName\r\n\r\n request, _ := http.NewRequest(http.MethodPut, uri, bytes.NewBuffer(clientRequest))\r\n request.Header.Add(\"Content-Type\", contentTypeV2);\r\n request.Header.Add(\"Authorization\", jwt);\r\n request.Header.Add(\"If-Match\", \"1\");\r\n request.Header.Add(\"X-NetBackup-Audit-Reason\", \"added client \" + testClientName + \" to policy \" + testPolicyName);\r\n\r\n response, err := httpClient.Do(request)\r\n\r\n if err != nil {\r\n fmt.Printf(\"The HTTP request failed with error: %s\\n\", err)\r\n panic(\"Unable to add client to policy.\\n\")\r\n } else {\r\n if response.StatusCode != 201 {\r\n printErrorResponse(response)\r\n } else {\r\n fmt.Printf(\"%s added to %s successfully.\\n\", testClientName, testPolicyName);\r\n responseDetails, _ := httputil.DumpResponse(response, true);\r\n fmt.Printf(string(responseDetails))\r\n }\r\n }\r\n}", "func WithHTTPClient(client *http.Client) ClientOption {\n\treturn func(c *Client) {\n\t\tc.httpClient = client\n\t}\n}", "func (o *ExtrasSavedFiltersListParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PatchReferenceEntityRecordsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func SetHTTPClient(newClient *http.Client) {\n\thttpClient = newClient\n}", "func (o *CreateWidgetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateListParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (cb *ClientBuilder) HTTPClient(httpClient *http.Client) *ClientBuilder {\n\tcb.client.httpClient = httpClient\n\treturn cb\n}", "func (cb *ClientBuilder) HTTPClient(httpClient *http.Client) *ClientBuilder {\n\tcb.client.httpClient = httpClient\n\treturn cb\n}", "func (o *GetWorkItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetZippedParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(client *http.Client) Option {\n\treturn func(c *Client) error {\n\t\tif client == nil {\n\t\t\treturn errors.New(\"client cannot be nil\")\n\t\t}\n\n\t\tc.client = client\n\t\treturn nil\n\t}\n}", "func WithHTTPClient(client HTTPClient) Option {\n\treturn func(opts *Client) {\n\t\topts.httpClient = client\n\t}\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostMeOvhAccountOvhAccountIDCreditOrderParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostApplyManifestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *WaitListParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetItemByAppIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(h HTTPClient) ClientOption {\n\treturn clientOptionFunc(func(c interface{}) {\n\t\tswitch c := c.(type) {\n\t\tcase *Client:\n\t\t\tc.httpClient = h\n\t\tdefault:\n\t\t\tpanic(\"unknown type\")\n\t\t}\n\t})\n}", "func (o *GetV1IntegrationsAwsCloudtrailBatchesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ChargeAddonInvoiceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetShopItemListParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(hClient *http.Client) clientOption {\n\treturn func(c *client) {\n\t\tc.httpClient = hClient\n\t}\n}", "func (o *AddItemParams) WithHTTPClient(client *http.Client) *AddItemParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *CloudNFSExportAddParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ListDCForSeedParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ToggleNetworkGeneratorsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CheckTransactionCreditLimitParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EstimateCoinBuyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateFlowParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PatchRetryEventUsingPATCHParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetContentSourceUsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SetUniverseBackupFlagParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreatePackageRepositoryDeltaUploadParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdatePriceListParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (c *Client) WithHTTPClient(cl *http.Client) *Client {\n\tc.Client = cl\n\treturn c\n}", "func (o *PetCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *TurnOnLightParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateRowParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetRequestDetailsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateSubnetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ImportApplicationUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SharedCatalogSharedCatalogRepositoryV1SavePostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PatchLibrariesByIDContentByIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetLolCatalogV1ItemsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RebuildIndexSetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateTransactionCategorizationRuleParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetRecentFoodsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *APIServiceMissedBlocksParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *NearestUsingGET1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}" ]
[ "0.68199915", "0.6054078", "0.59095484", "0.58934873", "0.58423924", "0.5841846", "0.5841459", "0.58388424", "0.5804307", "0.5749258", "0.5740945", "0.57321674", "0.57095027", "0.5701237", "0.5682556", "0.56596583", "0.5657443", "0.5632348", "0.5626681", "0.5624085", "0.5623318", "0.56171", "0.56163394", "0.56127757", "0.55901235", "0.5561946", "0.5551378", "0.55486834", "0.55430585", "0.55350083", "0.5524862", "0.55246913", "0.5524687", "0.5519972", "0.55071783", "0.5504641", "0.54954094", "0.5492696", "0.54696715", "0.5468691", "0.5459408", "0.54502624", "0.5446549", "0.5440246", "0.54323316", "0.543021", "0.5429159", "0.5417493", "0.54173154", "0.54160476", "0.541047", "0.5407576", "0.540627", "0.5401972", "0.54001075", "0.53974944", "0.5395133", "0.5395133", "0.53944147", "0.53921086", "0.5381287", "0.53735566", "0.53717893", "0.536705", "0.53660005", "0.53634524", "0.5360766", "0.53599477", "0.5356654", "0.53521496", "0.53481114", "0.534749", "0.53426087", "0.53395337", "0.53374094", "0.5335667", "0.5329211", "0.53286874", "0.53286123", "0.5328211", "0.5326901", "0.53252643", "0.5324756", "0.5319993", "0.5316284", "0.53154224", "0.531322", "0.53076625", "0.5305749", "0.5304368", "0.53028965", "0.5300504", "0.5300174", "0.52993345", "0.5294867", "0.5294246", "0.5294246", "0.5293764", "0.52937335", "0.52927196" ]
0.7069977
0
SetHTTPClient adds the HTTPClient to the copy recipe to my recipes with changes params
SetHTTPClient добавляет HTTPClient в копию рецепта в мои рецепты с изменениями параметров
func (o *CopyRecipeToMyRecipesWithChangesParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *GetPublicsRecipeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RevertProductSnapshotRequestUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) WithHTTPClient(client *http.Client) *CopyRecipeToMyRecipesWithChangesParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *GetIngredientVersionRevisionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func SetHTTPClient(newClient *http.Client) {\n\thttpClient = newClient\n}", "func (o *GetReceiptsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *NarrowSearchRecipeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCartUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EditParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetNutritionForSingleParsedPlainTextIngredientParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func SetHTTPClient(httpClient *http.Client) func(*Client) error {\n\treturn func(client *Client) error {\n\t\tclient.client = httpClient\n\n\t\treturn nil\n\t}\n}", "func (o *AddOrUpdateNodePoolConfigItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *FreezeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ConfigurationBackupModifyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostReconciliationParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostPartsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func SetHTTPClient(client *http.Client) {\n\thttpClient = client\n}", "func (o *CreatePolicyResetItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PatchAddonParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *BudgetAddParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddRepositoryParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostMenuItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RewardCommentsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ToggleNetworkGeneratorsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateAddonParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddBranchParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RebuildIndexSetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateStockReceiptParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetContentSourceUsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ChatNewParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateRunbookParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutMenuItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateWidgetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PatchRetryEventUsingPATCHParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SetUniverseBackupFlagParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *IntegrationsManualHTTPSCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (c *Client) SetHTTPClient(client *http.Client) {\n\tc.client = client\n}", "func (c *Client) SetHTTPClient(client *http.Client) {\n\tc.client = client\n}", "func (o *UpdateNetworkSwitchAccessControlListsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *TurnOnLightParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreatePackageRepositoryDeltaUploadParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateNetworkCellularGatewaySettingsSubnetPoolParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *WaitListParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PatchReferenceEntityRecordsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetPrivateToggleDepositAddressCreationParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateFlowParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateFeaturesConfigurationParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostApplyManifestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (sm *Manager) SetHTTPClient(c *http.Client) {\n\tsm.client = c\n}", "func (sm *Manager) SetHTTPClient(c *http.Client) {\n\tsm.client = c\n}", "func (o *GetRuleChainParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetWorkItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetZippedParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetTerraformConfigurationSourcesUsingGET1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetInterceptionitemsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ImportApplicationUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SharedCatalogSharedCatalogRepositoryV1SavePostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *NearestUsingGET1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateTransactionCategorizationRuleParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateCredentialParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateDmrClusterLinkParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetRequestDetailsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CheckTransactionCreditLimitParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RemoveDropRequestParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *InventoryStocktakingSearchParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCrossConnectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateScriptParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ExtractionListV1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (c *Client) SetHTTPClient(httpClient HTTPClient) {\n\tif httpClient == nil {\n\t\tc.client = http.DefaultClient\n\t} else {\n\t\tc.client = httpClient\n\t}\n}", "func (o *CustomerGatewayUpdateOwnershipParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SaveTemplateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (service *BaseService) SetHTTPClient(client *http.Client) {\n\tsetMinimumTLSVersion(client)\n\n\tif isRetryableClient(service.Client) {\n\t\t// If \"service\" is currently holding a retryable client,\n\t\t// then set \"client\" as the embedded client used for individual requests.\n\t\ttr := service.Client.Transport.(*retryablehttp.RoundTripper)\n\t\ttr.Client.HTTPClient = client\n\t} else {\n\t\t// Otherwise, just hang \"client\" directly off the base service.\n\t\tservice.Client = client\n\t}\n}", "func (o *DevicesGetModuleComponentCommandHistoryParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetContentSourcesUsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateWidgetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ListDCForSeedParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetSingleBeadSimulationsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostMeArticlesDraftsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ResolveBatchParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostAsyncParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetLolCatalogV1ItemsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ExtrasSavedFiltersListParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetRepository15Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SearchKeywordChunkedParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ChargeAddonInvoiceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateSubnetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdatePriceListParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetRestoreDatalakeStatusParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func SetHTTPClient(client *http.Client) error {\n\tif client == nil {\n\t\treturn errHTTPClientInvalid\n\t}\n\tm.Lock()\n\t_HTTPClient = client\n\tm.Unlock()\n\treturn nil\n}", "func (o *PostIPAMSwitchesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetRedbeamsFlowLogsProgressByResourceCrnParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutFlagSettingParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *QueryChangesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ExtrasGraphsReadParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ModifyProxyConfigInternalParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutCwfNetworkIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateAccountStateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}" ]
[ "0.7151808", "0.7038088", "0.6908971", "0.6900971", "0.68990266", "0.6891095", "0.6878877", "0.68639123", "0.68540007", "0.6851541", "0.68416125", "0.6839482", "0.68369865", "0.68172693", "0.67863685", "0.67825335", "0.6768729", "0.67661315", "0.67284036", "0.669015", "0.6666474", "0.66595423", "0.66272116", "0.66251993", "0.6624819", "0.66120535", "0.6600765", "0.6595484", "0.6585106", "0.65792525", "0.6576837", "0.65640575", "0.65532804", "0.65520924", "0.6549552", "0.6542287", "0.65351915", "0.65347975", "0.6531616", "0.6530088", "0.6530088", "0.6524064", "0.6521851", "0.6519381", "0.65123063", "0.6498727", "0.6497561", "0.649555", "0.64926445", "0.64852166", "0.6482254", "0.6476503", "0.6476503", "0.6475066", "0.6471768", "0.6470399", "0.64627075", "0.6460342", "0.645829", "0.64564514", "0.64564407", "0.64563817", "0.6451665", "0.64506894", "0.6445098", "0.6444671", "0.64438236", "0.6442815", "0.644216", "0.64374065", "0.64351547", "0.6435119", "0.6434535", "0.6434402", "0.64330906", "0.6431951", "0.64316833", "0.64298123", "0.64272606", "0.64260316", "0.6422784", "0.6417391", "0.6416443", "0.6415855", "0.6407109", "0.6406952", "0.64056545", "0.6403929", "0.6401559", "0.6400267", "0.6399428", "0.639881", "0.63949907", "0.6386722", "0.6385927", "0.6385854", "0.63853043", "0.6384726", "0.6383152", "0.6380801" ]
0.7771742
0
WithJSONBody adds the jSONBody to the copy recipe to my recipes with changes params
WithJSONBody добавляет jSONBody в копию рецепта к моим рецептам с изменениями параметров
func (o *CopyRecipeToMyRecipesWithChangesParams) WithJSONBody(jSONBody *models.Recipe) *CopyRecipeToMyRecipesWithChangesParams { o.SetJSONBody(jSONBody) return o }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *CopyRecipeToMyRecipesWithChangesParams) SetJSONBody(jSONBody *models.Recipe) {\n\to.JSONBody = jSONBody\n}", "func (a *API) JSONBody(ctx *fasthttp.RequestCtx, model interface{}) {\n\tr := bytes.NewReader(ctx.PostBody())\n\tjson.NewDecoder(r).Decode(&model)\n}", "func (c *RBController) RecipeJSONAdvanced(w http.ResponseWriter, r *http.Request) (err error) {\n\tr.ParseForm()\n\tstrict, err := strconv.Atoi(r.PostFormValue(\"strict\"))\n\tname := r.PostFormValue(\"name\")\n\tcuisine, _ := strconv.Atoi(r.PostFormValue(\"cuisine\"))\n\tseason, _ := strconv.Atoi(r.PostFormValue(\"season\"))\n\tmealtype, _ := strconv.Atoi(r.PostFormValue(\"mealtype\"))\n\n\t// get all the recipes that match\n\tvar recipes *list.List\n\tif strict == 0 {\n\t\trecipes, err = c.GetRecipesLoose(name, cuisine, mealtype, season)\n\t} else {\n\t\trecipes, err = c.GetRecipesStrict(name, cuisine, mealtype, season)\n\t}\n\n\t// slice of jsons\n\tjsons := make([]string, recipes.Len())\n\n\tif err == nil {\n\t\tindex := 0\n\t\tfor e := recipes.Front(); e != nil; e = e.Next() {\n\t\t\trec := e.Value.(*Recipe)\n\t\t\tjsons[index] = rec.ToJSON()\n\t\t\tindex++\n\t\t}\n\t\trequest := strings.Join(jsons, \"\\n\")\n\t\tfmt.Fprintf(w, request)\n\t} else {\n\t\tfmt.Fprintf(w, \"%v\", err.Error())\n\t}\n\treturn\n}", "func (r *Request) SetJSONBody(val interface{}) error {\n\tbuf := bytes.NewBuffer(nil)\n\tenc := json.NewEncoder(buf)\n\tif err := enc.Encode(val); err != nil {\n\t\treturn err\n\t}\n\n\tr.Obj = val\n\tr.Body = buf\n\tr.BodySize = int64(buf.Len())\n\treturn nil\n}", "func (c *RBController) RecipeJSON(w http.ResponseWriter, r *http.Request) (err error) {\n\tvars := mux.Vars(r)\n\tid, _ := strconv.Atoi(vars[\"id\"])\n\trecipe, err := c.GetRecipe(id)\n\tif err == nil {\n\t\tc.JSON(w, http.StatusOK, recipe)\n\t} else if err == sql.ErrNoRows {\n\t\tc.RenderError(w, 404, \"Sorry, your page wasn't found\")\n\t\terr = nil\n\t}\n\treturn\n}", "func TestAddRecipe(t *testing.T) {\n\tpayload := fmt.Sprintf(`\n {\n \"mealtype\": \"Breakfast\",\n \"name\": \"Pancakes\",\n \"Ingredients\": [ \"150g all purpose flour\",\n \t\t\t\t \"150ml of milk\"],\n \"preparation\": \"Add all ingredients and mix. Put in Pan.\"\n}`)\n\n\tresponse, err := http.Post(baseURL+\"/recipes\", \"application/json\", strings.NewReader(payload))\n\tif err != nil {\n\t\tt.Fatalf(\"failed to get json, %s\", err)\n\t}\n\n\tcheckResponseCode(t, http.StatusOK, response.StatusCode)\n}", "func (o *PostMenuItemParams) SetJSONBody(jSONBody *models.MenuItem) {\n\to.JSONBody = jSONBody\n}", "func (o *PutMenuItemParams) SetJSONBody(jSONBody *models.MenuItem) {\n\to.JSONBody = jSONBody\n}", "func (api *FoodRecipeAPI) partialRecipeUpdate(w http.ResponseWriter, req *http.Request) {\n\tdefer DrainBody(req)\n\tctx := req.Context()\n\n\tvars := mux.Vars(req)\n\tid := vars[\"id\"]\n\tlogData := log.Data{\"id\": id}\n\n\tvar errorObjects []*models.ErrorObject\n\n\tpatchJSON, recipePatches, err := patch.Get(ctx, req.Body)\n\tif err != nil {\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: err.Error()})\n\t\tErrorResponse(ctx, w, http.StatusBadRequest, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\t// Validate patch request\n\tfor i, recipePatch := range *recipePatches {\n\t\tif err = recipePatch.Validate(nil); err != nil {\n\t\t\tif _, ok := err.(*validator.InvalidValidationError); ok {\n\t\t\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: errs.ErrInternalServer.Error()})\n\t\t\t\tErrorResponse(ctx, w, http.StatusInternalServerError, &models.ErrorResponse{Errors: errorObjects})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfor _, err := range err.(validator.ValidationErrors) {\n\t\t\t\terrorObjects = append(errorObjects, models.HandleValidationErrors(strconv.Itoa(i), err.ActualTag(), err.StructField(), err.Value().(string), err.Param()))\n\t\t\t}\n\t\t}\n\t}\n\tif len(errorObjects) > 0 {\n\t\tErrorResponse(ctx, w, http.StatusBadRequest, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\t// apply patch against recipe resource\n\tp, err := jsonpatch.DecodePatch(patchJSON)\n\tif err != nil {\n\t\tlog.Error(ctx, \"patch recipe: unable to decode patch\", err)\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: err.Error()})\n\t\tErrorResponse(ctx, w, http.StatusBadRequest, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\t// find current recipe doc\n\tvar recipe models.Recipe\n\n\tcollection := api.MongoClient.Database(\"food-recipes\").Collection(\"recipes\")\n\tif err = collection.FindOne(ctx, bson.M{\"_id\": id}).Decode(&recipe); err != nil {\n\t\tif err == mongo.ErrNoDocuments {\n\t\t\tlog.Warn(ctx, \"patch recipe: failed to find recipe\", log.FormatErrors([]error{err}), logData)\n\t\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: errs.ErrRecipeNotFound.Error()})\n\t\t\tErrorResponse(ctx, w, http.StatusNotFound, &models.ErrorResponse{Errors: errorObjects})\n\t\t\treturn\n\t\t}\n\n\t\tlog.Error(ctx, \"patch recipe: failed to find recipe, bad connection?\", err)\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: errs.ErrInternalServer.Error()})\n\t\tErrorResponse(ctx, w, http.StatusInternalServerError, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\tb, err := json.Marshal(recipe)\n\tif err != nil {\n\t\tlog.Error(ctx, \"patch recipe: error returned from json marshal\", err, logData)\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: errs.ErrInternalServer.Error()})\n\t\tErrorResponse(ctx, w, http.StatusInternalServerError, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\t// apply patch to existing recipe\n\tmodified, err := p.Apply(b)\n\tif err != nil {\n\t\tlog.Error(ctx, \"patch recipe: unable to apply patch to recipe\", err, logData)\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: err.Error()})\n\t\tErrorResponse(ctx, w, http.StatusBadRequest, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(modified, &recipe)\n\tif err != nil {\n\t\tlog.Error(ctx, \"patch recipe: unmarshal modified recipe into recipe struct\", err, logData)\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: err.Error()})\n\t\tErrorResponse(ctx, w, http.StatusBadRequest, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\t// store new recipe\n\tif _, err = collection.ReplaceOne(ctx, bson.M{\"_id\": id}, recipe); err != nil {\n\t\tif err == mongo.ErrNoDocuments {\n\t\t\tlog.Error(ctx, \"update recipe: failed to update recipe, recipe deos not exists\", err, logData)\n\t\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: errs.ErrRecipeNotFound.Error()})\n\t\t\tErrorResponse(ctx, w, http.StatusNotFound, &models.ErrorResponse{Errors: errorObjects})\n\t\t\treturn\n\t\t}\n\n\t\tlog.Error(ctx, \"update recipe: failed to insert recipe\", err, logData)\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: errs.ErrInternalServer.Error()})\n\t\tErrorResponse(ctx, w, http.StatusInternalServerError, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\n\tlog.Info(ctx, \"update recipe: request successful\", logData)\n}", "func NewJSONBody(v interface{}) (contentType string, bodyReader io.Reader, err error) {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn \"application/json;charset=utf-8\", bytes.NewReader(b), nil\n}", "func BindJSON(r *http.Request, target interface{}) error {\n\tdata, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = json.Unmarshal(data, target)\n\n\treturn err\n}", "func (c *apiClient) newRequestWithJSONBody(\n\tctx context.Context, method, resourcePath string,\n\tquery url.Values, body interface{}) (*http.Request, error) {\n\tdata, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc.Logger.Debugf(\"httpx: request body length: %d bytes\", len(data))\n\tif c.LogBody {\n\t\tc.Logger.Debugf(\"httpx: request body: %s\", string(data))\n\t}\n\trequest, err := c.newRequest(\n\t\tctx, method, resourcePath, query, bytes.NewReader(data))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif body != nil {\n\t\trequest.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn request, nil\n}", "func MutateRequestBody(v RequestBody) *RequestBodyMutator {\n\treturn &RequestBodyMutator{\n\t\ttarget: v.(*requestBody),\n\t\tproxy: v.Clone().(*requestBody),\n\t}\n}", "func (ctx *HijackRequest) JSONBody() gjson.Result {\n\treturn gjson.Parse(ctx.Body())\n}", "func BlendJSON(source string, dest map[string]interface{}) error {\n\tsourceMap, err := JsonToMSI(source)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn Blend(sourceMap, dest)\n}", "func (c *ThreeScaleClient) buildUpdateJSONReq(ep string, body io.Reader) (*http.Request, error) {\n\treq, err := http.NewRequest(\"PUT\", c.adminPortal.rawURL+ep, body)\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Basic \"+basicAuth(\"\", c.credential))\n\treturn req, err\n}", "func (r *Request) ResetJSONBody() error {\n\tif r.Body == nil {\n\t\treturn nil\n\t}\n\treturn r.SetJSONBody(r.Obj)\n}", "func (input *BeegoInput) CopyBody(MaxMemory int64) []byte {\n\tif input.Context.Request.Body == nil {\n\t\treturn []byte{}\n\t}\n\n\tvar requestbody []byte\n\tsafe := &io.LimitedReader{R: input.Context.Request.Body, N: MaxMemory}\n\tif input.Header(\"Content-Encoding\") == \"gzip\" {\n\t\treader, err := gzip.NewReader(safe)\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\t\trequestbody, _ = ioutil.ReadAll(reader)\n\t} else {\n\t\trequestbody, _ = ioutil.ReadAll(safe)\n\t}\n\n\tinput.Context.Request.Body.Close()\n\tbf := bytes.NewBuffer(requestbody)\n\tinput.Context.Request.Body = http.MaxBytesReader(input.Context.ResponseWriter, ioutil.NopCloser(bf), MaxMemory)\n\tinput.RequestBody = requestbody\n\treturn requestbody\n}", "func (recipe *Recipe) FromJSON(r io.Reader) error {\n\tdecoder := json.NewDecoder(r)\n\treturn decoder.Decode(recipe)\n}", "func (obj *JSONObject) Copy() JSONObject {\n\ttmp := obj.Export()\n\ttmp2 := JSONObject{}\n\ttmp2.ImportRaw(tmp)\n\treturn tmp2\n}", "func (e *ChefEnvironment) UpdateFromJSON(jsonEnv map[string]interface{}) util.Gerror {\n\tif e.Name != jsonEnv[\"name\"].(string) {\n\t\terr := util.Errorf(\"Environment name %s and %s from JSON do not match\", e.Name, jsonEnv[\"name\"].(string))\n\t\treturn err\n\t} else if e.Name == \"_default\" {\n\t\terr := util.Errorf(\"The '_default' environment cannot be modified.\")\n\t\terr.SetStatus(http.StatusMethodNotAllowed)\n\t\treturn err\n\t}\n\n\t/* Validations */\n\tvalidElements := []string{\"name\", \"chef_type\", \"json_class\", \"description\", \"default_attributes\", \"override_attributes\", \"cookbook_versions\"}\nValidElem:\n\tfor k := range jsonEnv {\n\t\tfor _, i := range validElements {\n\t\t\tif k == i {\n\t\t\t\tcontinue ValidElem\n\t\t\t}\n\t\t}\n\t\terr := util.Errorf(\"Invalid key %s in request body\", k)\n\t\treturn err\n\t}\n\n\tvar verr util.Gerror\n\n\tattrs := []string{\"default_attributes\", \"override_attributes\"}\n\tfor _, a := range attrs {\n\t\tjsonEnv[a], verr = util.ValidateAttributes(a, jsonEnv[a])\n\t\tif verr != nil {\n\t\t\treturn verr\n\t\t}\n\t}\n\n\tjsonEnv[\"json_class\"], verr = util.ValidateAsFieldString(jsonEnv[\"json_class\"])\n\tif verr != nil {\n\t\tif verr.Error() == \"Field 'name' nil\" {\n\t\t\tjsonEnv[\"json_class\"] = e.JSONClass\n\t\t} else {\n\t\t\treturn verr\n\t\t}\n\t} else {\n\t\tif jsonEnv[\"json_class\"].(string) != \"Chef::Environment\" {\n\t\t\tverr = util.Errorf(\"Field 'json_class' invalid\")\n\t\t\treturn verr\n\t\t}\n\t}\n\n\tjsonEnv[\"chef_type\"], verr = util.ValidateAsFieldString(jsonEnv[\"chef_type\"])\n\tif verr != nil {\n\t\tif verr.Error() == \"Field 'name' nil\" {\n\t\t\tjsonEnv[\"chef_type\"] = e.ChefType\n\t\t} else {\n\t\t\treturn verr\n\t\t}\n\t} else {\n\t\tif jsonEnv[\"chef_type\"].(string) != \"environment\" {\n\t\t\tverr = util.Errorf(\"Field 'chef_type' invalid\")\n\t\t\treturn verr\n\t\t}\n\t}\n\n\tjsonEnv[\"cookbook_versions\"], verr = util.ValidateAttributes(\"cookbook_versions\", jsonEnv[\"cookbook_versions\"])\n\tif verr != nil {\n\t\treturn verr\n\t}\n\tfor k, v := range jsonEnv[\"cookbook_versions\"].(map[string]interface{}) {\n\t\tif !util.ValidateEnvName(k) || k == \"\" {\n\t\t\tmerr := util.Errorf(\"Cookbook name %s invalid\", k)\n\t\t\tmerr.SetStatus(http.StatusBadRequest)\n\t\t\treturn merr\n\t\t}\n\n\t\tif v == nil {\n\t\t\tverr = util.Errorf(\"Invalid version number\")\n\t\t\treturn verr\n\t\t}\n\t\t_, verr = util.ValidateAsConstraint(v)\n\t\tif verr != nil {\n\t\t\t/* try validating as a version */\n\t\t\tv, verr = util.ValidateAsVersion(v)\n\t\t\tif verr != nil {\n\t\t\t\treturn verr\n\t\t\t}\n\t\t}\n\t}\n\n\tjsonEnv[\"description\"], verr = util.ValidateAsString(jsonEnv[\"description\"])\n\tif verr != nil {\n\t\tif verr.Error() == \"Field 'name' missing\" {\n\t\t\tjsonEnv[\"description\"] = \"\"\n\t\t} else {\n\t\t\treturn verr\n\t\t}\n\t}\n\n\te.ChefType = jsonEnv[\"chef_type\"].(string)\n\te.JSONClass = jsonEnv[\"json_class\"].(string)\n\te.Description = jsonEnv[\"description\"].(string)\n\te.Default = jsonEnv[\"default_attributes\"].(map[string]interface{})\n\te.Override = jsonEnv[\"override_attributes\"].(map[string]interface{})\n\t/* clear out, then loop over the cookbook versions */\n\te.CookbookVersions = make(map[string]string, len(jsonEnv[\"cookbook_versions\"].(map[string]interface{})))\n\tfor c, v := range jsonEnv[\"cookbook_versions\"].(map[string]interface{}) {\n\t\te.CookbookVersions[c] = v.(string)\n\t}\n\n\treturn nil\n}", "func RequestJSONBody(w http.ResponseWriter, r *http.Request, code int, payload interface{}) error {\n\tbuf := &bytes.Buffer{}\n\tenc := json.NewEncoder(buf)\n\tenc.SetEscapeHTML(true)\n\tif err := enc.Encode(payload); err != nil {\n\t\tw.Header().Set(\"X-Content-Type-Options\", \"nosniff\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn err\n\t}\n\tw.WriteHeader(code)\n\t_, err := w.Write(buf.Bytes())\n\tif err != nil {\n\t\tw.Header().Set(\"X-Content-Type-Options\", \"nosniff\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (o *BudgetAddParams) SetBody(body *models.BudgetAddRequest) {\n\to.Body = body\n}", "func ConversionRequestBody(imageLocation, desiredFormat string) ConversionRequest {\n\treturn ConversionRequest{\n\t\tImageLocation: imageLocation,\n\t\tDesiredFormat: desiredFormat,\n\t}\n}", "func (c *ThreeScaleClient) buildPatchJSONReq(ep string, body io.Reader) (*http.Request, error) {\n\treq, err := http.NewRequest(\"PATCH\", c.adminPortal.rawURL+ep, body)\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Basic \"+basicAuth(\"\", c.credential))\n\treturn req, err\n}", "func copyBody(r interface{}) (io.ReadCloser, error) {\n\tvar originalBody io.ReadCloser\n\tswitch r := r.(type) {\n\tcase *http.Request:\n\t\toriginalBody = r.Body\n\tcase *http.Response:\n\t\toriginalBody = r.Body\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported type (%T) for copyBody\", r)\n\t}\n\n\tcontent, err := ioutil.ReadAll(originalBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnewBody := ioutil.NopCloser(bytes.NewReader(content))\n\tswitch r := r.(type) {\n\tcase *http.Request:\n\t\tr.Body = newBody\n\tcase *http.Response:\n\t\tr.Body = newBody\n\t}\n\n\treturn ioutil.NopCloser(bytes.NewReader(content)), nil\n}", "func makeRequestBody(t interface{}) io.Reader {\n\tdebug := debug.Debug(\"oktad:makeRequestBody\")\n\tvar b bytes.Buffer\n\tenc := json.NewEncoder(&b)\n\terr := enc.Encode(t)\n\tif err != nil {\n\t\tdebug(\"Error encoding json! %s\", err)\n\t}\n\treturn &b\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.JSONBody != nil {\n\t\tif err := r.SetBodyParam(o.JSONBody); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param recipeId\n\tif err := r.SetPathParam(\"recipeId\", o.RecipeID); 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}", "func (s *Nap) BodyJSON(bodyJSON interface{}) *Nap {\n\tif bodyJSON == nil {\n\t\treturn s\n\t}\n\treturn s.BodyProvider(jsonBodyProvider{payload: bodyJSON})\n}", "func ReadJSONBody(writer http.ResponseWriter, request *http.Request, obj interface{}) error {\n\tb, err := ioutil.ReadAll(request.Body)\n\tif err != nil {\n\t\thttp.Error(writer, err.Error(), http.StatusInternalServerError)\n\t\treturn err\n\t}\n\terr = json.Unmarshal(b, obj)\n\tif err != nil {\n\t\thttp.Error(writer, err.Error(), http.StatusBadRequest)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (g *Github) PatchJSON(url, content string, v interface{}) error {\n\tbytes, err := g.patchBytes(url, content)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := json.Unmarshal(bytes, v); err != nil {\n\t\treturn fmt.Errorf(\"could not parse json for url %s: %v\", url, err)\n\t}\n\treturn nil\n}", "func PostJSONWithBody(url string, params interface{}) (*http.Response, error) {\n\treader := new(bytes.Reader)\n\tif params != nil {\n\t\traw, err := json.Marshal(params)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treader = bytes.NewReader(raw)\n\t}\n\n\treturn http.Post(url, \"application/json; charset=utf-8\", reader)\n}", "func (r *StandardResponse) SetJSONBody(body interface{}) error {\n\tbodyBytes, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed JSON conversion: %s\", err.Error())\n\t}\n\n\tr.SetBody(bodyBytes)\n\treturn nil\n}", "func BindJSON(r *http.Request, i interface{}) error {\n\tb := &binder.JSON{}\n\treturn b.Bind(r.Body, i)\n}", "func (r ApiPatchOAuth2ClientRequest) JsonPatch(jsonPatch []JsonPatch) ApiPatchOAuth2ClientRequest {\n\tr.jsonPatch = &jsonPatch\n\treturn r\n}", "func (o *PostMenuItemParams) WithJSONBody(jSONBody *models.MenuItem) *PostMenuItemParams {\n\to.SetJSONBody(jSONBody)\n\treturn o\n}", "func ReadJSONFromBody(ctx echo.Context, value interface{}) error {\n\tdata, err := ioutil.ReadAll(ctx.Request().Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(data) > 0 {\n\t\terr = json.Unmarshal(data, value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func createAppJson(dm util.DepManager, appDir, appName, appJson string) error {\n\n\tupdatedJson, err := getAndUpdateAppJson(dm, appName, appJson)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = ioutil.WriteFile(filepath.Join(appDir, fileFlogoJson), []byte(updatedJson), 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func CreateAndMergeJsonPatch(original, override crv1alpha1.JSONMap) (crv1alpha1.JSONMap, error) {\n\t// Merge json specs with StrategicMerge\n\tmergedPatch, err := strategicMergeJsonPatch(original, override)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Convert merged json to map[string]interface{}\n\tvar merged map[string]interface{}\n\terr = json.Unmarshal(mergedPatch, &merged)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn merged, err\n}", "func (r *Request) PatchJSON(path string, data interface{}) {\n\tb, err := json.Marshal(data)\n\tif err != nil {\n\t\tr.t.Fatalf(\"httptesting: PatchJSON:json.Marshal(%T): %v\", data, err)\n\t}\n\n\tr.Patch(path, \"application/json\", b)\n}", "func PatchJSONWithParams(url string, v interface{}) (newreq *PatchJSONRequest, err error) {\n\tbs, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treq, err := http.NewRequest(\"PATCH\", url, bytes.NewBuffer(bs))\n\tif err != nil {\n\t\treturn\n\t}\n\n\tnewreq = &PatchJSONRequest{req: req}\n\n\treturn\n}", "func prepareJSONPayload(rawReq *GenericRequest) (*bytes.Buffer, error) {\n\t// When payload ready, convert it to Json format\n\tbReqData, err := json.Marshal(&rawReq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// @TODO Debug print marshal body\n\tfmt.Println(\"RAW Marshal BODY \" + string(bReqData))\n\n\t// Write json object to buffer\n\tbuffer := bytes.NewBuffer(bReqData)\n\n\treturn buffer, nil\n}", "func BindJSON(ctx *fasthttp.RequestCtx, d interface{}) error {\n\treturn json.Unmarshal(ctx.PostBody(), d)\n}", "func mapBody(match HTTPMatch, contentType string, body []byte) ([]byte, error) {\n\tnewBody := []byte{}\n\n\tif !isSameCaseInsensitive(contentType, JSON) {\n\t\treturn newBody, nil\n\t}\n\n\tvar parsed interface{}\n\terr := json.Unmarshal(body, &parsed)\n\tif err != nil {\n\t\treturn newBody, err\n\t}\n\n\tredacted := redact(match, parsed, \"$\")\n\n\tnewBody, err = json.Marshal(redacted)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\n\treturn newBody, nil\n}", "func CreateRequestBody(target interface{}) (io.Reader, error) {\n\tbodyBytes, err := json.Marshal(target)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to marshal into json: %v\", err)\n\t}\n\n\treturn bytes.NewReader(bodyBytes), nil\n}", "func (o *PutMenuItemParams) WithJSONBody(jSONBody *models.MenuItem) *PutMenuItemParams {\n\to.SetJSONBody(jSONBody)\n\treturn o\n}", "func Copy(dest interface{}, src interface{}) error {\n\tdata, err := json.Marshal(src)\n\tif err != nil {\n\t\treturn errors.ErrorMarshal.Newm(err.Error())\n\t}\n\n\terr = json.Unmarshal(data, dest)\n\tif err != nil {\n\t\treturn errors.ErrorUnmarshal.Newm(err.Error())\n\t}\n\n\treturn nil\n}", "func (o *SavePreferencesParams) SetJSONBody(jSONBody *models.UpdateUserPreferences) {\n\to.JSONBody = jSONBody\n}", "func (s *ValidateService) BodyJson(body interface{}) *ValidateService {\n\ts.bodyJson = body\n\treturn s\n}", "func Copy(dst, src interface{}) interface{} {\n\tb, err := json.Marshal(src)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\terr = json.Unmarshal(b, dst)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn dst\n}", "func ToJSONBody(t *testing.T, body interface{}) *bytes.Buffer {\n\tjsonParams, err := json.Marshal(body)\n\tassert.NoErr(t, err)\n\treturn bytes.NewBuffer(jsonParams)\n}", "func setJSONData(req *http.Request, data interface{}) error {\n\tif data == nil {\n\t\treturn nil\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tbody, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Body = ioutil.NopCloser(bytes.NewReader(body))\n\treturn nil\n}", "func parseNDJSONRequestBody(body io.ReadCloser, structs []interface{}) {\n\tbuf := new(bytes.Buffer)\n\t_, err := buf.ReadFrom(body)\n\tExpect(err).ToNot(HaveOccurred())\n\n\trequestPayload := strings.TrimSuffix(buf.String(), \"\\n\") // _bulk requests need to end in a newline\n\tjsonPayloads := strings.Split(requestPayload, \"\\n\")\n\tExpect(jsonPayloads).To(HaveLen(len(structs)))\n\n\tfor i, s := range structs {\n\t\terr = json.Unmarshal([]byte(jsonPayloads[i]), s)\n\t\tExpect(err).ToNot(HaveOccurred())\n\t}\n}", "func GetBodyJSON(r *http.Request, v interface{}) error {\n\terr := json.NewDecoder(r.Body).Decode(&v)\n\treturn err\n}", "func (c *ThreeScaleClient) buildPostJSONReq(ep string, body io.Reader) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", c.adminPortal.rawURL+ep, body)\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Basic \"+basicAuth(\"\", c.credential))\n\treturn req, err\n}", "func (r *Recipe) MarshalJSON() ([]byte, error) {\n\tresp := struct {\n\t\tID int `json:\"id\"`\n\t\tName string `json:\"name\"`\n\t\tDescription string `json:\"description\"`\n\t\tPicture string `json:\"picture\"`\n\t\tCategory string `json:\"category\"`\n\t}{r.ID, r.Name, r.Description, r.Picture, r.Category}\n\tb, err := json.Marshal(resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tingredientsJSON := make([]*IngredientResponse, len(r.RecipesIngredients))\n\tfor i, v := range r.RecipesIngredients {\n\t\tingredientsJSON[i] = &IngredientResponse{Ingredient: v.Ingredient, Amount: v.Amount, Unit: v.Unit}\n\t}\n\tingredientsRaw, err := json.Marshal(ingredientsJSON)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tjsonSteps := fmt.Sprintf(`,\"steps\": %s, \"ingredients\": %v }`, r.Steps, string(ingredientsRaw))\n\treturn append(b[:len(b)-1], []byte(jsonSteps)...), nil\n}", "func WriteJSONBody(writer http.ResponseWriter, obj interface{}) {\n\twriter.Header().Add(\"Content-Type\", \"application/json\")\n\tb, err := json.Marshal(obj)\n\tif err != nil {\n\t\thttp.Error(writer, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\twriter.Write(b)\n}", "func copyBody(c io.ReadCloser) (*bytes.Reader, error) {\n\tif c == nil {\n\t\treturn nil, nil\n\t}\n\tdefer c.Close()\n\n\tvar b []byte\n\tbuf := bytes.NewBuffer(b)\n\t_, err := io.Copy(buf, c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tr := bytes.NewReader(buf.Bytes())\n\treturn r, nil\n}", "func SendJSON(url string, body interface{}) error {\n\tclient := &http.Client{}\n\n\tb, err := json.Marshal(body)\n\tif err != nil {\n\t\tlog.Error(\"failed marshal request\", \"err\", err)\n\t\treturn err\n\t}\n\tj := bytes.NewReader(b)\n\n\treq, err := http.NewRequest(\"POST\", url, j)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn badResponse(resp.StatusCode, respBody)\n\t}\n\n\treturn nil\n}", "func (bs *Bindings) Copy() (*Bindings, error) {\r\n\tbytes, err := json.Marshal(bs)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tret := NewBindings()\r\n\terr = json.Unmarshal(bytes, &ret)\r\n\r\n\treturn &ret, nil\r\n}", "func Copy(src interface{}, dst interface{}) error {\n\tif err := validateCopy(src, dst); err != nil {\n\t\treturn err\n\t}\n\tbytes, err := json.Marshal(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.Unmarshal(bytes, dst)\n}", "func AddJsonBookWithID(id string, bk Book) (Book, error) {\n\n\t// validate form values\n\tif bk.Isbn == \"\" || bk.Title == \"\" || bk.Author == \"\" || bk.Price == \"\" {\n\t\treturn bk, errors.New(\"400. Bad request. All fields must be complete.\")\n\t}\n ID := id\n\t//doc := make(map[string]interface{})\n\t//doc[\"Isbn\"] = bk.Isbn\n\t//doc[\"Title\"] = bk.Title\n\t//doc[\"Author\"] = bk.Author\n\t//doc[\"Price\"] = bk.Price\n\n ctx := context.Background()\n\t _, err := config.Client.Collection(\"books\").Doc(ID).Set(ctx,\n\t\tmap[string]interface{}{\n\t\t\t\"Isbn\": bk.Isbn,\n\t\t\t\"Title\": bk.Title,\n\t\t\t\"Author\": bk.Author,\n\t\t\t\"Price\": bk.Price,\n\t\t})\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to add a new book: %w\", err)\n\t\t//fmt.Errorf(\"Failed to iterate the list of requests: %w\", err)\n\n\t}\n\n\treturn bk, nil\n}", "func addBook(w http.ResponseWriter, r *http.Request) {\n\tvar book Book\n\t_= json.NewDecoder(r.Body).Decode(&book)\n\n\tbooks = append(books, book)\n\n\tw.WriteHeader(http.StatusCreated)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(book)\n\t\n}", "func (a BodyWithAddPropsJSONBody) MarshalJSON() ([]byte, error) {\n\tvar err error\n\tobject := make(map[string]json.RawMessage)\n\n\tobject[\"inner\"], err = json.Marshal(a.Inner)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error marshaling 'inner': %w\", err)\n\t}\n\n\tobject[\"name\"], err = json.Marshal(a.Name)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error marshaling 'name': %w\", err)\n\t}\n\n\tfor fieldName, field := range a.AdditionalProperties {\n\t\tobject[fieldName], err = json.Marshal(field)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error marshaling '%s': %w\", fieldName, err)\n\t\t}\n\t}\n\treturn json.Marshal(object)\n}", "func (a BodyWithAddPropsJSONBody) MarshalJSON() ([]byte, error) {\n\tvar err error\n\tobject := make(map[string]json.RawMessage)\n\n\tobject[\"inner\"], err = json.Marshal(a.Inner)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error marshaling 'inner': %w\", err)\n\t}\n\n\tobject[\"name\"], err = json.Marshal(a.Name)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error marshaling 'name': %w\", err)\n\t}\n\n\tfor fieldName, field := range a.AdditionalProperties {\n\t\tobject[fieldName], err = json.Marshal(field)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error marshaling '%s': %w\", fieldName, err)\n\t\t}\n\t}\n\treturn json.Marshal(object)\n}", "func resetBody(req *http.Request, body []byte) {\n\tif req == nil || req.Body == nil {\n\t\treturn\n\t}\n\n\treq.Body = ioutil.NopCloser(bytes.NewReader(body))\n\n\t// do not modify existing GetBody function\n\tif req.GetBody == nil {\n\t\treq.GetBody = func() (io.ReadCloser, error) {\n\t\t\treturn ioutil.NopCloser(bytes.NewReader(body)), nil\n\t\t}\n\t}\n}", "func ReadJSONBody(request *http.Request, value interface{}) error {\n\tcontentType := request.Header.Get(\"Content-Type\")\n\tif !strings.Contains(contentType, \"application/json\") {\n\t\treturn fmt.Errorf(\"Invalid media type provided: %s\", contentType)\n\t}\n\tdecoder := json.NewDecoder(request.Body)\n\tif err := decoder.Decode(value); err != nil {\n\t\treturn fmt.Errorf(\"Failed to decode request body: %s\", err)\n\t}\n\treturn nil\n}", "func Body(data ...interface{}) AdditionalAttribute {\n return func(rb *Builder) error {\n rb.SetBody(data...)\n return nil\n }\n}", "func CreateJSONPatch(port C.int64_t, sourceC *C.char, sourceLen C.int, targetC *C.char, targetLen C.int) {\n\tsource := C.GoStringN(sourceC, sourceLen)\n\ttarget := C.GoStringN(targetC, targetLen)\n\n\tgo createJSONPatch(int64(port), source, target)\n}", "func (a *BodyWithAddPropsJSONBody) UnmarshalJSON(b []byte) error {\n\tobject := make(map[string]json.RawMessage)\n\terr := json.Unmarshal(b, &object)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif raw, found := object[\"inner\"]; found {\n\t\terr = json.Unmarshal(raw, &a.Inner)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error reading 'inner': %w\", err)\n\t\t}\n\t\tdelete(object, \"inner\")\n\t}\n\n\tif raw, found := object[\"name\"]; found {\n\t\terr = json.Unmarshal(raw, &a.Name)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error reading 'name': %w\", err)\n\t\t}\n\t\tdelete(object, \"name\")\n\t}\n\n\tif len(object) != 0 {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t\tfor fieldName, fieldBuf := range object {\n\t\t\tvar fieldVal interface{}\n\t\t\terr := json.Unmarshal(fieldBuf, &fieldVal)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error unmarshaling field %s: %w\", fieldName, err)\n\t\t\t}\n\t\t\ta.AdditionalProperties[fieldName] = fieldVal\n\t\t}\n\t}\n\treturn nil\n}", "func (a *BodyWithAddPropsJSONBody) UnmarshalJSON(b []byte) error {\n\tobject := make(map[string]json.RawMessage)\n\terr := json.Unmarshal(b, &object)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif raw, found := object[\"inner\"]; found {\n\t\terr = json.Unmarshal(raw, &a.Inner)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error reading 'inner': %w\", err)\n\t\t}\n\t\tdelete(object, \"inner\")\n\t}\n\n\tif raw, found := object[\"name\"]; found {\n\t\terr = json.Unmarshal(raw, &a.Name)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error reading 'name': %w\", err)\n\t\t}\n\t\tdelete(object, \"name\")\n\t}\n\n\tif len(object) != 0 {\n\t\ta.AdditionalProperties = make(map[string]interface{})\n\t\tfor fieldName, fieldBuf := range object {\n\t\t\tvar fieldVal interface{}\n\t\t\terr := json.Unmarshal(fieldBuf, &fieldVal)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error unmarshaling field %s: %w\", fieldName, err)\n\t\t\t}\n\t\t\ta.AdditionalProperties[fieldName] = fieldVal\n\t\t}\n\t}\n\treturn nil\n}", "func (HTTPOperation) SetRequestBody(time time.Time, inputType api.InputTypeEnum, location int, numberAvailable int, numberTotal *int, tags *string, vaccine *int) error {\n\tbody.Date = time\n\tbody.InputType = inputType\n\tbody.Location = location\n\tbody.NumberAvailable = numberAvailable\n\tbody.NumberTotal = numberTotal\n\tbody.Tags = tags\n\tbody.Vaccine = vaccine\n\treturn nil\n}", "func JSONAddTblProduct(c *gin.Context) {\n\tDb, err := config.DbConnect()\n\tif err != nil {\n\t\tpanic(\"Not Connect database\")\n\t}\n\n\tdata, e := ioutil.ReadAll(c.Request.Body)\n\tif e != nil {\n\t\tc.JSON(http.StatusBadRequest, e.Error())\n\t}\n\tvar tabelproduct entities.TabelProduct\n\terr2 := json.Unmarshal(data, &tabelproduct)\n\tif err2 != nil {\n\t \tfmt.Println(err2)\n\t}\n\t\n\timagepath := tabelproduct.ImagePath\n\ttitle := tabelproduct.Title\n\tdescription := tabelproduct.Description\n\tprice := strconv.Itoa(tabelproduct.Price)\n\tmQuery := `INSERT INTO tabelproduct SET imagepath ='` + imagepath + `', title='` + title + `', description='` + description + `',\n\t\t\t\tprice='` + price + `';`\n\tupdDB, err := Db.Query(mQuery)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer updDB.Close()\n\n\tDb.Close()\n\tc.JSON(http.StatusOK, \"Add record successfully\")\n}", "func (c *RBController) SaveRecipe(w http.ResponseWriter, r *http.Request) (err error) {\n\t// Get properties\n\tname := r.PostFormValue(`name`)\n\tcuisine, err := strconv.Atoi(r.PostFormValue(`cuisine`))\n\n\t// Get the mealtype and season encoded ints\n\tmealtype := EncodeMealtype(r.Form[`mealtype`])\n\tseason := EncodeSeason(r.Form[`season`])\n\n\t// get everything else\n\tdescription := r.PostFormValue(`description`)\n\tingredients := r.PostFormValue(`ingredients`)\n\tinstructions := r.PostFormValue(`instructions`)\n\n\t// TODO better error handling\n\tif err != nil {\n\t\tfmt.Println(\"[WARNING] Something went wrong in SaveRecipe\")\n\t\tc.RenderError(w, 500, \"Sorry, something went wrong.\")\n\t\treturn\n\t}\n\n\t// everything OK: build the recipe, and send it to the database\n\trecipe := Recipe{ID: 0, Name: name, Cuisine: cuisine, Mealtype: mealtype,\n\t\tSeason: season, Description: description, Ingredientlist: ingredients,\n\t\tInstructions: instructions}\n\n\t// if we don't have the id string, then this is a new request.\n\tvars := mux.Vars(r)\n\tidStr := vars[\"id\"]\n\tid := 0\n\n\tif idStr != \"\" {\n\t\tid, _ = strconv.Atoi(idStr)\n\t\trecipe.ID = id\n\t\terr = c.RecipeDB.UpdateRecipe(&recipe)\n\t} else {\n\t\tid, err = c.RecipeDB.NewRecipe(&recipe)\n\t}\n\n\tif err == nil {\n\t\thttp.Redirect(w, r, \"/recipes/\"+fmt.Sprintf(\"%v\", id)+\"/\", http.StatusFound)\n\t}\n\treturn\n}", "func (req *Request) JSONBody() (url.Values, error) {\n\toutput := url.Values{}\n\n\tif req.ContentType() != ContentTypeJSON {\n\t\treturn output, nil\n\t}\n\n\tvars := map[string]interface{}{}\n\tif err := json.NewDecoder(req.Request.Body).Decode(&vars); err != nil && err != io.EOF {\n\t\treturn nil, err\n\t}\n\n\tfor k, v := range vars {\n\t\toutput.Set(k, fmt.Sprintf(\"%v\", v))\n\t}\n\n\treturn output, nil\n}", "func (o *PostApplyManifestParams) SetRequestBody(requestBody PostApplyManifestBody) {\n\to.RequestBody = requestBody\n}", "func CreatePatch(in *ecr.Repository, target *v1alpha1.RepositoryParameters) (*v1alpha1.RepositoryParameters, error) {\n\tcurrentParams := &v1alpha1.RepositoryParameters{}\n\tLateInitializeRepository(currentParams, in)\n\n\tjsonPatch, err := awsclients.CreateJSONPatch(currentParams, target)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpatch := &v1alpha1.RepositoryParameters{}\n\tif err := json.Unmarshal(jsonPatch, patch); err != nil {\n\t\treturn nil, err\n\t}\n\treturn patch, nil\n}", "func decodeJSONBody(r *http.Request, dst interface{}) error {\n\tif r.Header.Get(\"Content-Type\") != \"\" {\n\t\tvalue, _ := header.ParseValueAndParams(r.Header, \"Content-Type\")\n\t\tif value != \"application/json\" {\n\t\t\treturn ContentHeaderError\n\t\t}\n\t}\n\n\tdec := json.NewDecoder(r.Body)\n\tdec.DisallowUnknownFields()\n\n\terr := dec.Decode(&dst)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif dec.More() {\n\t\tmsg := \"Request body must only contain a single JSON object\"\n\t\treturn errors.New(msg)\n\t}\n\n\treturn nil\n}", "func (l *List) PrependJSON(json interface{}) (err error) {\n\titem := MakeZeroValue(l.valType)\n\n\tif err := item.Set(json); err != nil {\n\t\treturn err\n\t}\n\n\treturn l.Prepend(item)\n}", "func (api *Client) CallJSON(opts *Opts, request interface{}, response interface{}) (resp *http.Response, err error) {\n\tvar requestBody []byte\n\t// Marshal the request if given\n\tif request != nil {\n\t\topts = opts.Copy()\n\t\trequestBody, err = json.Marshal(request)\n\t\topts.ContentType = \"application/json\"\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Set the body up as a JSON object if required\n\t\tif opts.Body == nil {\n\t\t\topts.Body = bytes.NewBuffer(requestBody)\n\t\t}\n\t}\n\terrChan := make(chan error, 1)\n\tisMultipart := opts.MultipartMetadataName != \"\" && opts.Body != nil && request != nil\n\tif isMultipart {\n\t\tbodyReader, bodyWriter := io.Pipe()\n\t\twriter := multipart.NewWriter(bodyWriter)\n\t\topts.ContentType = writer.FormDataContentType()\n\t\tin := opts.Body\n\t\topts.Body = bodyReader\n\t\tgo func() {\n\t\t\tdefer func() { _ = bodyWriter.Close() }()\n\t\t\tvar err error\n\n\t\t\t// Create the first part\n\t\t\terr = writer.WriteField(opts.MultipartMetadataName, string(requestBody))\n\t\t\tif err != nil {\n\t\t\t\terrChan <- err\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Add the file part\n\t\t\tpart, err := writer.CreateFormFile(opts.MultipartContentName, opts.MultipartFileName)\n\t\t\tif err != nil {\n\t\t\t\terrChan <- err\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Copy it in\n\t\t\tif _, err := io.Copy(part, in); err != nil {\n\t\t\t\terrChan <- err\n\t\t\t\treturn\n\t\t\t}\n\t\t\terrChan <- writer.Close()\n\t\t}()\n\t}\n\tresp, err = api.Call(opts)\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\tif response == nil || opts.NoResponse {\n\t\treturn resp, nil\n\t}\n\tif isMultipart {\n\t\terr = <-errChan\n\t\tif err != nil {\n\t\t\treturn resp, err\n\t\t}\n\t}\n\terr = DecodeJSON(resp, response)\n\treturn resp, err\n}", "func (o *CustomerGatewayUpdateOwnershipParams) SetBody(body *models.V1UpdateOwnershipRequest) {\n\to.Body = body\n}", "func (b *OperationMutator) RequestBody(v RequestBody) *OperationMutator {\n\tb.proxy.requestBody = v\n\treturn b\n}", "func (ctx *SimpleContext) RequestJsonBody(typ interface{}) error {\n\tcontentType := ctx.request.Header.Get(\"Content-Type\")\n\tif strings.Contains(contentType, \"json\") {\n\t\tbody, err := ioutil.ReadAll(ctx.request.Body)\n\t\tif nil != err {\n\t\t\treturn err\n\t\t}\n\t\terr = json.Unmarshal(body, typ)\n\t\tif nil != err {\n\t\t\treturn err\n\t\t}\n\t\treturn ctx.validate(typ)\n\t}\n\treturn errors.New(\"request body content-type is not contains json \")\n}", "func (spec *MachineSpec) Copy() *MachineSpec {\n\tvar specCopy MachineSpec\n\tp, err := json.Marshal(spec)\n\tif err != nil {\n\t\tpanic(\"internal error copying a MachineSpec: \" + err.Error())\n\t}\n\terr = json.Unmarshal(p, &specCopy)\n\tif err != nil {\n\t\tpanic(\"internal error copying a MachineSpec: \" + err.Error())\n\t}\n\treturn &specCopy\n}", "func (c *Client) newRequestJSON(method, urlStr string, v interface{}) (*http.Request, error) {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq, err := c.newRequest(method, urlStr, bytes.NewReader(b))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treturn req, nil\n}", "func RequestBody(bodyReader io.Reader, data interface{}) error {\n\tbody, _ := ioutil.ReadAll(bodyReader)\n\terr := json.Unmarshal(body, data)\n\treturn err\n}", "func (r ApiApiProjectsIdDeploymentsPostRequest) Body(body RequestsCreateProjectDeploymentRequest) ApiApiProjectsIdDeploymentsPostRequest {\n\tr.body = &body\n\treturn r\n}", "func (r Recipe) MarshalJSON() ([]byte, error) {\n\n\t// specify the naming strategy here\n\treturn marshalJSON(\"SetJSONname\", r)\n}", "func Test_jsonpatch_Add_WithParents(t *testing.T) {\n\tg := NewWithT(t)\n\n\tpatch1, _ := DecodePatch([]byte(`\n[\n {\"op\":\"add\", \"path\":\"/level1\", \"value\":{}},\n {\"op\":\"add\", \"path\":\"/level1/level2\", \"value\":{}},\n {\"op\":\"add\", \"path\":\"/level1/level2/test_key\", \"value\":\"qwe\"}\n]\n`))\n\n\torigDoc := []byte(`{\"bar\":\"foo\"}`)\n\n\texpectNewDoc := []byte(`{\"bar\":\"foo\", \"level1\":{\"level2\":{\"test_key\":\"qwe\"}}}`)\n\n\tnewDoc, err := patch1.Apply(origDoc)\n\tg.Expect(err).ShouldNot(HaveOccurred(), \"patch apply\")\n\tg.Expect(JSONEqual(newDoc, expectNewDoc)).Should(BeTrue(), \"%v is not equal to %v\", string(newDoc), string(expectNewDoc))\n}", "func PatchJSON(left []byte, patch map[string]interface{}) ([]byte, error) {\n\tvLeft, err := parseFragment(left)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(mergeRecursive(vLeft, patch))\n}", "func (o *CopyRecipeToMyRecipesWithChangesParams) WithHTTPClient(client *http.Client) *CopyRecipeToMyRecipesWithChangesParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func RequireJSON(w http.ResponseWriter, r *http.Request, data interface{}) bool {\n\terr := json.NewDecoder(r.Body).Decode(data)\n\tif err != nil {\n\t\thttp.Error(w, \"request body is not valid JSON: \"+err.Error(), 400)\n\t\treturn false\n\t}\n\treturn true\n}", "func TestUpdateCategoryWrongJSONSyntax(t *testing.T) {\n\t//initial length of []products\n\tinitialLen := len(Categories)\n\t//parameters passed to request body\n\trequestBody := `{{\"CategoryID\":\"bq4fasj7jhfi127rimlg\",\"CategoryName\":\"Name\",,,}}`\n\treq, err := http.NewRequest(\"PATCH\", \"/categories/bq4fasj7jhfi127rimlg\", bytes.NewBufferString(requestBody))\n\treq = mux.SetURLVars(req, map[string]string{\"id\": \"bq4fasj7jhfi127rimlg\"})\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\trr := httptest.NewRecorder()\n\thandler := http.HandlerFunc(UpdateCategory)\n\n\thandler.ServeHTTP(rr, req)\n\n\tassert.Equal(t, 400, rr.Code, \"Bad request response is expected\")\n\tassert.Equal(t, initialLen, len(Categories), \"Expected length to stay the same after updating product\")\n}", "func Test_jsonpatch_Add_WithParents(t *testing.T) {\n\tg := NewWithT(t)\n\n\tpatch1, _ := jsonpatch.DecodePatch([]byte(`\n[\n {\"op\":\"add\", \"path\":\"/level1\", \"value\":{}},\n {\"op\":\"add\", \"path\":\"/level1/level2\", \"value\":{}},\n {\"op\":\"add\", \"path\":\"/level1/level2/test_key\", \"value\":\"qwe\"}\n]\n`))\n\n\torigDoc := []byte(`{\"bar\":\"foo\"}`)\n\n\texpectNewDoc := []byte(`{\"bar\":\"foo\", \"level1\":{\"level2\":{\"test_key\":\"qwe\"}}}`)\n\n\tnewDoc, err := patch1.Apply(origDoc)\n\tg.Expect(err).ShouldNot(HaveOccurred(), \"patch apply\")\n\tg.Expect(jsonpatch.Equal(newDoc, expectNewDoc)).Should(BeTrue(), \"%v is not equal to %v\", string(newDoc), string(expectNewDoc))\n}", "func (req *Request) UpdateFromJson(data []byte) error {\n\treturn json.Unmarshal(data, req)\n}", "func PatchJSON(object map[string]interface{},\n\toperation []map[string]interface{}) (map[string]interface{}, error) {\n\t// convert operation into JSON format\n\tpatchJson, err := json.Marshal(operation)\n\tif err != nil {\n\t\tlog.Error(fmt.Errorf(\"unable to convert patch operation to JSON: %+v\", err))\n\t\treturn map[string]interface{}{}, ErrInvalidPatch\n\t}\n\t// decode JSON patch operation\n\tpatch, err := jsonpatch.DecodePatch(patchJson)\n\tif err != nil {\n\t\tlog.Error(fmt.Errorf(\"unable to parse Json Patch operation: %+v\", err))\n\t\treturn map[string]interface{}{}, ErrInvalidPatch\n\t}\n\n\t// convert metadata to json\n\tvar metaJson []byte\n\tmetaJson, err = json.Marshal(object)\n\tif err != nil {\n\t\tlog.Error(fmt.Errorf(\"unable to convert object to JSON: %+v\", err))\n\t\treturn map[string]interface{}{}, ErrInvalidJSON\n\t}\n\n\t// apply JSON patch operation\n\tmodified, err := patch.Apply(metaJson)\n\tif err != nil {\n\t\tlog.Error(fmt.Errorf(\"unable to apply JSON patch: %+v\", err))\n\t\treturn map[string]interface{}{}, ErrInvalidPatch\n\t}\n\n\tlog.Debug(fmt.Sprintf(\"successfully applied JSON patch to object: %s\", modified))\n\t// convert final JSON string back to interface\n\tvar meta map[string]interface{}\n\tif err := json.Unmarshal(modified, &meta); err != nil {\n\t\treturn meta, ErrInvalidJSON\n\t}\n\treturn meta, nil\n}", "func encodeBody(obj any) (io.Reader, error) {\n\tbuf := bytes.NewBuffer(nil)\n\tenc := json.NewEncoder(buf)\n\tif err := enc.Encode(obj); err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf, nil\n}", "func (o *UpdateBuildPropertiesParams) SetBody(body *models.JSONPatchDocument) {\n\to.Body = body\n}", "func generateJSONPatches(jsonPatches []clusterv1.JSONPatch, variables map[string]apiextensionsv1.JSON) ([]byte, error) {\n\tres := []jsonPatchRFC6902{}\n\n\tfor _, jsonPatch := range jsonPatches {\n\t\tvar value *apiextensionsv1.JSON\n\t\tif jsonPatch.Op == \"add\" || jsonPatch.Op == \"replace\" {\n\t\t\tvar err error\n\t\t\tvalue, err = calculateValue(jsonPatch, variables)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\tres = append(res, jsonPatchRFC6902{\n\t\t\tOp: jsonPatch.Op,\n\t\t\tPath: jsonPatch.Path,\n\t\t\tValue: value,\n\t\t})\n\t}\n\n\t// Render JSON Patches.\n\tresJSON, err := json.Marshal(res)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to marshal JSON Patch %v\", jsonPatches)\n\t}\n\n\treturn resJSON, nil\n}", "func getSecretPatchBody(svc string, nv config.NameValue) types.Patch {\n\tph := getSuperSecretTemplate(svc)\n\tph.Data = map[string]string{\n\t\tnv.Name: fmt.Sprintf(`(( index (ds \"data\") \"%s\" ))`, nv.Name),\n\t}\n\tphb, _ := yaml.Marshal(ph)\n\tp1 := types.Patch{\n\t\tPatch: strings.Replace(string(phb), \": |\", \": |-\", -1), // when load again the |- will disappaer and the value will be on one line\n\t\tTarget: getSelector(\"SuperSecret\", svc),\n\t}\n\treturn p1\n}" ]
[ "0.63932765", "0.5612401", "0.5401041", "0.53624415", "0.528843", "0.51485735", "0.51017815", "0.5067448", "0.5022532", "0.49914533", "0.49796784", "0.4972427", "0.4907961", "0.48759767", "0.48699957", "0.48650312", "0.48458964", "0.48397836", "0.48314732", "0.48046854", "0.48015723", "0.47635266", "0.4754551", "0.47458997", "0.47440606", "0.47380224", "0.47324312", "0.47265822", "0.47112268", "0.4702513", "0.4698319", "0.4694028", "0.46796072", "0.46758914", "0.46708143", "0.46648023", "0.46631253", "0.46562946", "0.465385", "0.46012995", "0.4590407", "0.45823577", "0.45755932", "0.4552863", "0.4548016", "0.45391262", "0.4535911", "0.45325446", "0.4528459", "0.45183516", "0.45145702", "0.4492726", "0.44904932", "0.4472443", "0.44640148", "0.44596308", "0.44591406", "0.4450284", "0.44463122", "0.44326714", "0.44223806", "0.4421589", "0.44209316", "0.43994793", "0.43994793", "0.43994352", "0.43991417", "0.43988067", "0.43954444", "0.43829498", "0.43829498", "0.43812072", "0.43581843", "0.4351877", "0.4350641", "0.4347879", "0.4339248", "0.43331987", "0.43229958", "0.4322255", "0.43204024", "0.4317967", "0.43156585", "0.4313201", "0.43077868", "0.4297466", "0.42968974", "0.4296016", "0.42957562", "0.4290836", "0.4281028", "0.42785916", "0.4278322", "0.4275504", "0.4270869", "0.42697158", "0.42661643", "0.4265445", "0.4262461", "0.42621738" ]
0.7077129
0
SetJSONBody adds the jsonBody to the copy recipe to my recipes with changes params
SetJSONBody добавляет jsonBody в копию рецепта в мои рецепты с изменениями параметров
func (o *CopyRecipeToMyRecipesWithChangesParams) SetJSONBody(jSONBody *models.Recipe) { o.JSONBody = jSONBody }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *CopyRecipeToMyRecipesWithChangesParams) WithJSONBody(jSONBody *models.Recipe) *CopyRecipeToMyRecipesWithChangesParams {\n\to.SetJSONBody(jSONBody)\n\treturn o\n}", "func (r *Request) SetJSONBody(val interface{}) error {\n\tbuf := bytes.NewBuffer(nil)\n\tenc := json.NewEncoder(buf)\n\tif err := enc.Encode(val); err != nil {\n\t\treturn err\n\t}\n\n\tr.Obj = val\n\tr.Body = buf\n\tr.BodySize = int64(buf.Len())\n\treturn nil\n}", "func (o *PostMenuItemParams) SetJSONBody(jSONBody *models.MenuItem) {\n\to.JSONBody = jSONBody\n}", "func (r *StandardResponse) SetJSONBody(body interface{}) error {\n\tbodyBytes, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed JSON conversion: %s\", err.Error())\n\t}\n\n\tr.SetBody(bodyBytes)\n\treturn nil\n}", "func (o *PutMenuItemParams) SetJSONBody(jSONBody *models.MenuItem) {\n\to.JSONBody = jSONBody\n}", "func (a *API) JSONBody(ctx *fasthttp.RequestCtx, model interface{}) {\n\tr := bytes.NewReader(ctx.PostBody())\n\tjson.NewDecoder(r).Decode(&model)\n}", "func (HTTPOperation) SetRequestBody(time time.Time, inputType api.InputTypeEnum, location int, numberAvailable int, numberTotal *int, tags *string, vaccine *int) error {\n\tbody.Date = time\n\tbody.InputType = inputType\n\tbody.Location = location\n\tbody.NumberAvailable = numberAvailable\n\tbody.NumberTotal = numberTotal\n\tbody.Tags = tags\n\tbody.Vaccine = vaccine\n\treturn nil\n}", "func (r *Request) ResetJSONBody() error {\n\tif r.Body == nil {\n\t\treturn nil\n\t}\n\treturn r.SetJSONBody(r.Obj)\n}", "func (o *PostApplyManifestParams) SetRequestBody(requestBody PostApplyManifestBody) {\n\to.RequestBody = requestBody\n}", "func (o *SavePreferencesParams) SetJSONBody(jSONBody *models.UpdateUserPreferences) {\n\to.JSONBody = jSONBody\n}", "func NewJSONBody(v interface{}) (contentType string, bodyReader io.Reader, err error) {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn \"application/json;charset=utf-8\", bytes.NewReader(b), nil\n}", "func setJSONData(req *http.Request, data interface{}) error {\n\tif data == nil {\n\t\treturn nil\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tbody, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Body = ioutil.NopCloser(bytes.NewReader(body))\n\treturn nil\n}", "func (ctx *HijackRequest) SetBody(obj interface{}) *HijackRequest {\n\t// reset to empty\n\tctx.req.StringBody(\"\")\n\tctx.req.JSONBody(nil)\n\n\tswitch body := obj.(type) {\n\tcase []byte:\n\t\tbuf := bytes.NewBuffer(body)\n\t\tctx.req.Body(buf)\n\tcase string:\n\t\tctx.req.StringBody(body)\n\tdefault:\n\t\tctx.req.JSONBody(obj)\n\t}\n\treturn ctx\n}", "func (o *BudgetAddParams) SetBody(body *models.BudgetAddRequest) {\n\to.Body = body\n}", "func (o *UpdateBuildPropertiesParams) SetBody(body *models.JSONPatchDocument) {\n\to.Body = body\n}", "func (o *CustomerGatewayUpdateOwnershipParams) SetBody(body *models.V1UpdateOwnershipRequest) {\n\to.Body = body\n}", "func BindJSON(r *http.Request, target interface{}) error {\n\tdata, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = json.Unmarshal(data, target)\n\n\treturn err\n}", "func (r *Request) SetBody(reader io.Reader) {\n\tr.request.Body = ioutil.NopCloser(reader)\n}", "func MutateRequestBody(v RequestBody) *RequestBodyMutator {\n\treturn &RequestBodyMutator{\n\t\ttarget: v.(*requestBody),\n\t\tproxy: v.Clone().(*requestBody),\n\t}\n}", "func (o *CreateIscsiLunSnapshotParams) SetRequestBody(requestBody []*models.IscsiLunSnapshotCreationParams) {\n\to.RequestBody = requestBody\n}", "func (zr *ZRequest) SetBody(body interface{}) *ZRequest {\n\tif zr.ended {\n\t\treturn zr\n\t}\n\tzr.body = body\n\treturn zr\n}", "func (input *BeegoInput) CopyBody(MaxMemory int64) []byte {\n\tif input.Context.Request.Body == nil {\n\t\treturn []byte{}\n\t}\n\n\tvar requestbody []byte\n\tsafe := &io.LimitedReader{R: input.Context.Request.Body, N: MaxMemory}\n\tif input.Header(\"Content-Encoding\") == \"gzip\" {\n\t\treader, err := gzip.NewReader(safe)\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\t\trequestbody, _ = ioutil.ReadAll(reader)\n\t} else {\n\t\trequestbody, _ = ioutil.ReadAll(safe)\n\t}\n\n\tinput.Context.Request.Body.Close()\n\tbf := bytes.NewBuffer(requestbody)\n\tinput.Context.Request.Body = http.MaxBytesReader(input.Context.ResponseWriter, ioutil.NopCloser(bf), MaxMemory)\n\tinput.RequestBody = requestbody\n\treturn requestbody\n}", "func ReadJSONBody(writer http.ResponseWriter, request *http.Request, obj interface{}) error {\n\tb, err := ioutil.ReadAll(request.Body)\n\tif err != nil {\n\t\thttp.Error(writer, err.Error(), http.StatusInternalServerError)\n\t\treturn err\n\t}\n\terr = json.Unmarshal(b, obj)\n\tif err != nil {\n\t\thttp.Error(writer, err.Error(), http.StatusBadRequest)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (req *Request) SetBody(body []byte) {\n\treq.Req.Body = ioutil.NopCloser(bytes.NewReader(body))\n}", "func makeRequestBody(t interface{}) io.Reader {\n\tdebug := debug.Debug(\"oktad:makeRequestBody\")\n\tvar b bytes.Buffer\n\tenc := json.NewEncoder(&b)\n\terr := enc.Encode(t)\n\tif err != nil {\n\t\tdebug(\"Error encoding json! %s\", err)\n\t}\n\treturn &b\n}", "func (ctx *HijackResponse) SetBody(obj interface{}) *HijackResponse {\n\tswitch body := obj.(type) {\n\tcase []byte:\n\t\tctx.payload.Body = body\n\tcase string:\n\t\tctx.payload.Body = []byte(body)\n\tdefault:\n\t\tctx.SetHeader(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tvar err error\n\t\tctx.payload.Body, err = json.Marshal(obj)\n\t\tutils.E(err)\n\t}\n\treturn ctx\n}", "func (c *ThreeScaleClient) buildUpdateJSONReq(ep string, body io.Reader) (*http.Request, error) {\n\treq, err := http.NewRequest(\"PUT\", c.adminPortal.rawURL+ep, body)\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Basic \"+basicAuth(\"\", c.credential))\n\treturn req, err\n}", "func (s *Nap) BodyJSON(bodyJSON interface{}) *Nap {\n\tif bodyJSON == nil {\n\t\treturn s\n\t}\n\treturn s.BodyProvider(jsonBodyProvider{payload: bodyJSON})\n}", "func (e *ChefEnvironment) UpdateFromJSON(jsonEnv map[string]interface{}) util.Gerror {\n\tif e.Name != jsonEnv[\"name\"].(string) {\n\t\terr := util.Errorf(\"Environment name %s and %s from JSON do not match\", e.Name, jsonEnv[\"name\"].(string))\n\t\treturn err\n\t} else if e.Name == \"_default\" {\n\t\terr := util.Errorf(\"The '_default' environment cannot be modified.\")\n\t\terr.SetStatus(http.StatusMethodNotAllowed)\n\t\treturn err\n\t}\n\n\t/* Validations */\n\tvalidElements := []string{\"name\", \"chef_type\", \"json_class\", \"description\", \"default_attributes\", \"override_attributes\", \"cookbook_versions\"}\nValidElem:\n\tfor k := range jsonEnv {\n\t\tfor _, i := range validElements {\n\t\t\tif k == i {\n\t\t\t\tcontinue ValidElem\n\t\t\t}\n\t\t}\n\t\terr := util.Errorf(\"Invalid key %s in request body\", k)\n\t\treturn err\n\t}\n\n\tvar verr util.Gerror\n\n\tattrs := []string{\"default_attributes\", \"override_attributes\"}\n\tfor _, a := range attrs {\n\t\tjsonEnv[a], verr = util.ValidateAttributes(a, jsonEnv[a])\n\t\tif verr != nil {\n\t\t\treturn verr\n\t\t}\n\t}\n\n\tjsonEnv[\"json_class\"], verr = util.ValidateAsFieldString(jsonEnv[\"json_class\"])\n\tif verr != nil {\n\t\tif verr.Error() == \"Field 'name' nil\" {\n\t\t\tjsonEnv[\"json_class\"] = e.JSONClass\n\t\t} else {\n\t\t\treturn verr\n\t\t}\n\t} else {\n\t\tif jsonEnv[\"json_class\"].(string) != \"Chef::Environment\" {\n\t\t\tverr = util.Errorf(\"Field 'json_class' invalid\")\n\t\t\treturn verr\n\t\t}\n\t}\n\n\tjsonEnv[\"chef_type\"], verr = util.ValidateAsFieldString(jsonEnv[\"chef_type\"])\n\tif verr != nil {\n\t\tif verr.Error() == \"Field 'name' nil\" {\n\t\t\tjsonEnv[\"chef_type\"] = e.ChefType\n\t\t} else {\n\t\t\treturn verr\n\t\t}\n\t} else {\n\t\tif jsonEnv[\"chef_type\"].(string) != \"environment\" {\n\t\t\tverr = util.Errorf(\"Field 'chef_type' invalid\")\n\t\t\treturn verr\n\t\t}\n\t}\n\n\tjsonEnv[\"cookbook_versions\"], verr = util.ValidateAttributes(\"cookbook_versions\", jsonEnv[\"cookbook_versions\"])\n\tif verr != nil {\n\t\treturn verr\n\t}\n\tfor k, v := range jsonEnv[\"cookbook_versions\"].(map[string]interface{}) {\n\t\tif !util.ValidateEnvName(k) || k == \"\" {\n\t\t\tmerr := util.Errorf(\"Cookbook name %s invalid\", k)\n\t\t\tmerr.SetStatus(http.StatusBadRequest)\n\t\t\treturn merr\n\t\t}\n\n\t\tif v == nil {\n\t\t\tverr = util.Errorf(\"Invalid version number\")\n\t\t\treturn verr\n\t\t}\n\t\t_, verr = util.ValidateAsConstraint(v)\n\t\tif verr != nil {\n\t\t\t/* try validating as a version */\n\t\t\tv, verr = util.ValidateAsVersion(v)\n\t\t\tif verr != nil {\n\t\t\t\treturn verr\n\t\t\t}\n\t\t}\n\t}\n\n\tjsonEnv[\"description\"], verr = util.ValidateAsString(jsonEnv[\"description\"])\n\tif verr != nil {\n\t\tif verr.Error() == \"Field 'name' missing\" {\n\t\t\tjsonEnv[\"description\"] = \"\"\n\t\t} else {\n\t\t\treturn verr\n\t\t}\n\t}\n\n\te.ChefType = jsonEnv[\"chef_type\"].(string)\n\te.JSONClass = jsonEnv[\"json_class\"].(string)\n\te.Description = jsonEnv[\"description\"].(string)\n\te.Default = jsonEnv[\"default_attributes\"].(map[string]interface{})\n\te.Override = jsonEnv[\"override_attributes\"].(map[string]interface{})\n\t/* clear out, then loop over the cookbook versions */\n\te.CookbookVersions = make(map[string]string, len(jsonEnv[\"cookbook_versions\"].(map[string]interface{})))\n\tfor c, v := range jsonEnv[\"cookbook_versions\"].(map[string]interface{}) {\n\t\te.CookbookVersions[c] = v.(string)\n\t}\n\n\treturn nil\n}", "func (o *CheckTransactionCreditLimitParams) SetBody(body *platformclientmodels.CreditRequest) {\n\to.Body = body\n}", "func (c *baseClient) SetBody(params interface{}) *baseClient {\n\tc.body = params\n\treturn c\n}", "func (c *RBController) RecipeJSON(w http.ResponseWriter, r *http.Request) (err error) {\n\tvars := mux.Vars(r)\n\tid, _ := strconv.Atoi(vars[\"id\"])\n\trecipe, err := c.GetRecipe(id)\n\tif err == nil {\n\t\tc.JSON(w, http.StatusOK, recipe)\n\t} else if err == sql.ErrNoRows {\n\t\tc.RenderError(w, 404, \"Sorry, your page wasn't found\")\n\t\terr = nil\n\t}\n\treturn\n}", "func RequestJSONBody(w http.ResponseWriter, r *http.Request, code int, payload interface{}) error {\n\tbuf := &bytes.Buffer{}\n\tenc := json.NewEncoder(buf)\n\tenc.SetEscapeHTML(true)\n\tif err := enc.Encode(payload); err != nil {\n\t\tw.Header().Set(\"X-Content-Type-Options\", \"nosniff\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn err\n\t}\n\tw.WriteHeader(code)\n\t_, err := w.Write(buf.Bytes())\n\tif err != nil {\n\t\tw.Header().Set(\"X-Content-Type-Options\", \"nosniff\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn err\n\t}\n\treturn nil\n}", "func TestAddRecipe(t *testing.T) {\n\tpayload := fmt.Sprintf(`\n {\n \"mealtype\": \"Breakfast\",\n \"name\": \"Pancakes\",\n \"Ingredients\": [ \"150g all purpose flour\",\n \t\t\t\t \"150ml of milk\"],\n \"preparation\": \"Add all ingredients and mix. Put in Pan.\"\n}`)\n\n\tresponse, err := http.Post(baseURL+\"/recipes\", \"application/json\", strings.NewReader(payload))\n\tif err != nil {\n\t\tt.Fatalf(\"failed to get json, %s\", err)\n\t}\n\n\tcheckResponseCode(t, http.StatusOK, response.StatusCode)\n}", "func (c *RBController) RecipeJSONAdvanced(w http.ResponseWriter, r *http.Request) (err error) {\n\tr.ParseForm()\n\tstrict, err := strconv.Atoi(r.PostFormValue(\"strict\"))\n\tname := r.PostFormValue(\"name\")\n\tcuisine, _ := strconv.Atoi(r.PostFormValue(\"cuisine\"))\n\tseason, _ := strconv.Atoi(r.PostFormValue(\"season\"))\n\tmealtype, _ := strconv.Atoi(r.PostFormValue(\"mealtype\"))\n\n\t// get all the recipes that match\n\tvar recipes *list.List\n\tif strict == 0 {\n\t\trecipes, err = c.GetRecipesLoose(name, cuisine, mealtype, season)\n\t} else {\n\t\trecipes, err = c.GetRecipesStrict(name, cuisine, mealtype, season)\n\t}\n\n\t// slice of jsons\n\tjsons := make([]string, recipes.Len())\n\n\tif err == nil {\n\t\tindex := 0\n\t\tfor e := recipes.Front(); e != nil; e = e.Next() {\n\t\t\trec := e.Value.(*Recipe)\n\t\t\tjsons[index] = rec.ToJSON()\n\t\t\tindex++\n\t\t}\n\t\trequest := strings.Join(jsons, \"\\n\")\n\t\tfmt.Fprintf(w, request)\n\t} else {\n\t\tfmt.Fprintf(w, \"%v\", err.Error())\n\t}\n\treturn\n}", "func (o *UpdateCredentialParams) SetBody(body dynatrace.Credentials) {\n\to.Body = body\n}", "func (o *CreateBlueprintInWorkspaceInternalParams) SetBody(body *model.BlueprintV4Request) {\n\to.Body = body\n}", "func CreateRequestBody(target interface{}) (io.Reader, error) {\n\tbodyBytes, err := json.Marshal(target)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to marshal into json: %v\", err)\n\t}\n\n\treturn bytes.NewReader(bodyBytes), nil\n}", "func (ctx *HijackRequest) JSONBody() gjson.Result {\n\treturn gjson.Parse(ctx.Body())\n}", "func WriteJSONBody(writer http.ResponseWriter, obj interface{}) {\n\twriter.Header().Add(\"Content-Type\", \"application/json\")\n\tb, err := json.Marshal(obj)\n\tif err != nil {\n\t\thttp.Error(writer, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\twriter.Write(b)\n}", "func (s *ValidateService) BodyJson(body interface{}) *ValidateService {\n\ts.bodyJson = body\n\treturn s\n}", "func (o *ServiceBindingBindingParams) SetBody(body *models.ServiceBindingRequest) {\n\to.Body = body\n}", "func (o *IndicatorCreateV1Params) SetBody(body *models.APIIndicatorCreateReqsV1) {\n\to.Body = body\n}", "func ReadJSONFromBody(ctx echo.Context, value interface{}) error {\n\tdata, err := ioutil.ReadAll(ctx.Request().Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(data) > 0 {\n\t\terr = json.Unmarshal(data, value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (o *FetchIntegrationFormParams) SetBody(body map[string]string) {\n\to.Body = body\n}", "func mapBody(match HTTPMatch, contentType string, body []byte) ([]byte, error) {\n\tnewBody := []byte{}\n\n\tif !isSameCaseInsensitive(contentType, JSON) {\n\t\treturn newBody, nil\n\t}\n\n\tvar parsed interface{}\n\terr := json.Unmarshal(body, &parsed)\n\tif err != nil {\n\t\treturn newBody, err\n\t}\n\n\tredacted := redact(match, parsed, \"$\")\n\n\tnewBody, err = json.Marshal(redacted)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\n\treturn newBody, nil\n}", "func (o *CreateRepoNotificationParams) SetBody(body *models.NotificationCreateRequest) {\n\to.Body = body\n}", "func (c *ThreeScaleClient) buildPatchJSONReq(ep string, body io.Reader) (*http.Request, error) {\n\treq, err := http.NewRequest(\"PATCH\", c.adminPortal.rawURL+ep, body)\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Basic \"+basicAuth(\"\", c.credential))\n\treturn req, err\n}", "func resetBody(req *http.Request, body []byte) {\n\tif req == nil || req.Body == nil {\n\t\treturn\n\t}\n\n\treq.Body = ioutil.NopCloser(bytes.NewReader(body))\n\n\t// do not modify existing GetBody function\n\tif req.GetBody == nil {\n\t\treq.GetBody = func() (io.ReadCloser, error) {\n\t\t\treturn ioutil.NopCloser(bytes.NewReader(body)), nil\n\t\t}\n\t}\n}", "func (options *DeleteNotificationChannelsOptions) SetRequestBody(requestBody []string) *DeleteNotificationChannelsOptions {\n\toptions.RequestBody = requestBody\n\treturn options\n}", "func RequestBody(bodyReader io.Reader, data interface{}) error {\n\tbody, _ := ioutil.ReadAll(bodyReader)\n\terr := json.Unmarshal(body, data)\n\treturn err\n}", "func prepareJSONPayload(rawReq *GenericRequest) (*bytes.Buffer, error) {\n\t// When payload ready, convert it to Json format\n\tbReqData, err := json.Marshal(&rawReq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// @TODO Debug print marshal body\n\tfmt.Println(\"RAW Marshal BODY \" + string(bReqData))\n\n\t// Write json object to buffer\n\tbuffer := bytes.NewBuffer(bReqData)\n\n\treturn buffer, nil\n}", "func BindJSON(ctx *fasthttp.RequestCtx, d interface{}) error {\n\treturn json.Unmarshal(ctx.PostBody(), d)\n}", "func (r *Request) SetBody(b []byte) {\n\tr.body = b\n}", "func (o *PublicInteractiveLoginCredentialParams) SetBody(body *model.CredentialRequest) {\n\to.Body = body\n}", "func BindJSON(r *http.Request, i interface{}) error {\n\tb := &binder.JSON{}\n\treturn b.Bind(r.Body, i)\n}", "func (o *PostMenuItemParams) WithJSONBody(jSONBody *models.MenuItem) *PostMenuItemParams {\n\to.SetJSONBody(jSONBody)\n\treturn o\n}", "func (o *SearchWorkspacesParams) SetBody(body *models.RestSearchWorkspaceRequest) {\n\to.Body = body\n}", "func (o *GetUserRoleNextsParams) SetRequestBody(requestBody *models.GetUserRoleNextsRequestBody) {\n\to.RequestBody = requestBody\n}", "func (o *PatchAddonParams) SetBody(body *models.Addon) {\n\to.Body = body\n}", "func ReadJSONBody(request *http.Request, value interface{}) error {\n\tcontentType := request.Header.Get(\"Content-Type\")\n\tif !strings.Contains(contentType, \"application/json\") {\n\t\treturn fmt.Errorf(\"Invalid media type provided: %s\", contentType)\n\t}\n\tdecoder := json.NewDecoder(request.Body)\n\tif err := decoder.Decode(value); err != nil {\n\t\treturn fmt.Errorf(\"Failed to decode request body: %s\", err)\n\t}\n\treturn nil\n}", "func (o *PatchAssetDeviceConfigurationsMoidParams) SetBody(body *models.AssetDeviceConfiguration) {\n\to.Body = body\n}", "func (api *FoodRecipeAPI) partialRecipeUpdate(w http.ResponseWriter, req *http.Request) {\n\tdefer DrainBody(req)\n\tctx := req.Context()\n\n\tvars := mux.Vars(req)\n\tid := vars[\"id\"]\n\tlogData := log.Data{\"id\": id}\n\n\tvar errorObjects []*models.ErrorObject\n\n\tpatchJSON, recipePatches, err := patch.Get(ctx, req.Body)\n\tif err != nil {\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: err.Error()})\n\t\tErrorResponse(ctx, w, http.StatusBadRequest, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\t// Validate patch request\n\tfor i, recipePatch := range *recipePatches {\n\t\tif err = recipePatch.Validate(nil); err != nil {\n\t\t\tif _, ok := err.(*validator.InvalidValidationError); ok {\n\t\t\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: errs.ErrInternalServer.Error()})\n\t\t\t\tErrorResponse(ctx, w, http.StatusInternalServerError, &models.ErrorResponse{Errors: errorObjects})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfor _, err := range err.(validator.ValidationErrors) {\n\t\t\t\terrorObjects = append(errorObjects, models.HandleValidationErrors(strconv.Itoa(i), err.ActualTag(), err.StructField(), err.Value().(string), err.Param()))\n\t\t\t}\n\t\t}\n\t}\n\tif len(errorObjects) > 0 {\n\t\tErrorResponse(ctx, w, http.StatusBadRequest, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\t// apply patch against recipe resource\n\tp, err := jsonpatch.DecodePatch(patchJSON)\n\tif err != nil {\n\t\tlog.Error(ctx, \"patch recipe: unable to decode patch\", err)\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: err.Error()})\n\t\tErrorResponse(ctx, w, http.StatusBadRequest, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\t// find current recipe doc\n\tvar recipe models.Recipe\n\n\tcollection := api.MongoClient.Database(\"food-recipes\").Collection(\"recipes\")\n\tif err = collection.FindOne(ctx, bson.M{\"_id\": id}).Decode(&recipe); err != nil {\n\t\tif err == mongo.ErrNoDocuments {\n\t\t\tlog.Warn(ctx, \"patch recipe: failed to find recipe\", log.FormatErrors([]error{err}), logData)\n\t\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: errs.ErrRecipeNotFound.Error()})\n\t\t\tErrorResponse(ctx, w, http.StatusNotFound, &models.ErrorResponse{Errors: errorObjects})\n\t\t\treturn\n\t\t}\n\n\t\tlog.Error(ctx, \"patch recipe: failed to find recipe, bad connection?\", err)\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: errs.ErrInternalServer.Error()})\n\t\tErrorResponse(ctx, w, http.StatusInternalServerError, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\tb, err := json.Marshal(recipe)\n\tif err != nil {\n\t\tlog.Error(ctx, \"patch recipe: error returned from json marshal\", err, logData)\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: errs.ErrInternalServer.Error()})\n\t\tErrorResponse(ctx, w, http.StatusInternalServerError, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\t// apply patch to existing recipe\n\tmodified, err := p.Apply(b)\n\tif err != nil {\n\t\tlog.Error(ctx, \"patch recipe: unable to apply patch to recipe\", err, logData)\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: err.Error()})\n\t\tErrorResponse(ctx, w, http.StatusBadRequest, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(modified, &recipe)\n\tif err != nil {\n\t\tlog.Error(ctx, \"patch recipe: unmarshal modified recipe into recipe struct\", err, logData)\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: err.Error()})\n\t\tErrorResponse(ctx, w, http.StatusBadRequest, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\t// store new recipe\n\tif _, err = collection.ReplaceOne(ctx, bson.M{\"_id\": id}, recipe); err != nil {\n\t\tif err == mongo.ErrNoDocuments {\n\t\t\tlog.Error(ctx, \"update recipe: failed to update recipe, recipe deos not exists\", err, logData)\n\t\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: errs.ErrRecipeNotFound.Error()})\n\t\t\tErrorResponse(ctx, w, http.StatusNotFound, &models.ErrorResponse{Errors: errorObjects})\n\t\t\treturn\n\t\t}\n\n\t\tlog.Error(ctx, \"update recipe: failed to insert recipe\", err, logData)\n\t\terrorObjects = append(errorObjects, &models.ErrorObject{Error: errs.ErrInternalServer.Error()})\n\t\tErrorResponse(ctx, w, http.StatusInternalServerError, &models.ErrorResponse{Errors: errorObjects})\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\n\tlog.Info(ctx, \"update recipe: request successful\", logData)\n}", "func (o *SwarmUpdateParams) SetBody(body *models.SwarmSpec) {\n\to.Body = body\n}", "func (m *ItemItemsItemWorkbookFunctionsRandBetweenPostRequestBody) SetAdditionalData(value map[string]any)() {\n err := m.GetBackingStore().Set(\"additionalData\", value)\n if err != nil {\n panic(err)\n }\n}", "func (r *Request) SetBody(body io.Reader) *Request {\n\tr.Body = body\n\treturn r\n}", "func (b *httpRequestWriter) setBody(body io.Reader) error {\n\trc, ok := body.(io.ReadCloser)\n\tif !ok && body != nil {\n\t\trc = ioutil.NopCloser(body)\n\t}\n\tb.Body = rc\n\tif body != nil {\n\t\tswitch v := body.(type) {\n\t\tcase *bytes.Buffer:\n\t\t\tb.ContentLength = int64(v.Len())\n\t\t\tbuf := v.Bytes()\n\t\t\tb.GetBody = func() (io.ReadCloser, error) {\n\t\t\t\tr := bytes.NewReader(buf)\n\t\t\t\treturn ioutil.NopCloser(r), nil\n\t\t\t}\n\t\tcase *bytes.Reader:\n\t\t\tb.ContentLength = int64(v.Len())\n\t\t\tsnapshot := *v\n\t\t\tb.GetBody = func() (io.ReadCloser, error) {\n\t\t\t\tr := snapshot\n\t\t\t\treturn ioutil.NopCloser(&r), nil\n\t\t\t}\n\t\tcase *strings.Reader:\n\t\t\tb.ContentLength = int64(v.Len())\n\t\t\tsnapshot := *v\n\t\t\tb.GetBody = func() (io.ReadCloser, error) {\n\t\t\t\tr := snapshot\n\t\t\t\treturn ioutil.NopCloser(&r), nil\n\t\t\t}\n\t\tdefault:\n\t\t\t// This is where we'd set it to -1 (at least\n\t\t\t// if body != NoBody) to mean unknown, but\n\t\t\t// that broke people during the Go 1.8 testing\n\t\t\t// period. People depend on it being 0 I\n\t\t\t// guess. Maybe retry later. See Issue 18117.\n\t\t}\n\t\t// For client requests, Request.ContentLength of 0\n\t\t// means either actually 0, or unknown. The only way\n\t\t// to explicitly say that the ContentLength is zero is\n\t\t// to set the Body to nil. But turns out too much code\n\t\t// depends on NewRequest returning a non-nil Body,\n\t\t// so we use a well-known ReadCloser variable instead\n\t\t// and have the http package also treat that sentinel\n\t\t// variable to mean explicitly zero.\n\t\tif b.GetBody != nil && b.ContentLength == 0 {\n\t\t\tb.Body = http.NoBody\n\t\t\tb.GetBody = func() (io.ReadCloser, error) { return http.NoBody, nil }\n\t\t}\n\t}\n\treturn nil\n}", "func (o *ValidateCreateServiceRequestNamingParams) SetBody(body *dynatrace.RequestNaming) {\n\to.Body = body\n}", "func ConversionRequestBody(imageLocation, desiredFormat string) ConversionRequest {\n\treturn ConversionRequest{\n\t\tImageLocation: imageLocation,\n\t\tDesiredFormat: desiredFormat,\n\t}\n}", "func ToJSONBody(t *testing.T, body interface{}) *bytes.Buffer {\n\tjsonParams, err := json.Marshal(body)\n\tassert.NoErr(t, err)\n\treturn bytes.NewBuffer(jsonParams)\n}", "func BlendJSON(source string, dest map[string]interface{}) error {\n\tsourceMap, err := JsonToMSI(source)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn Blend(sourceMap, dest)\n}", "func (r *Request) PatchJSON(path string, data interface{}) {\n\tb, err := json.Marshal(data)\n\tif err != nil {\n\t\tr.t.Fatalf(\"httptesting: PatchJSON:json.Marshal(%T): %v\", data, err)\n\t}\n\n\tr.Patch(path, \"application/json\", b)\n}", "func (self *Response) SetBody(responseBody interface{}) error {\n\tswitch responseBody.(type) {\n\tcase func(string, http.Request) string:\n\t\t//\n\t\t// Mock Response should have a Body Generator function registered?\n\t\t//\n\n\t\tbodyGenerator := responseBody.(func(string, http.Request) string)\n\t\tself.bodyGenerator = &bodyGenerator\n\n\tcase string:\n\t\t//\n\t\t// Mock Response should have a static body registered?\n\t\t//\n\n\t\tself.body = responseBody.(string)\n\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported body type. SetBody() can receive either a static body string or a Body Generator Callback with the signature 'func(string, http.Request) string', for a more detailed description kindly check Go Mock Yourself documentation\")\n\t}\n\n\treturn nil\n}", "func (_options *SendNotificationsOptions) SetBody(body *NotificationCreate) *SendNotificationsOptions {\n\t_options.Body = body\n\treturn _options\n}", "func (o *GetRackTopoesParams) SetRequestBody(requestBody *models.GetRackTopoesRequestBody) {\n\to.RequestBody = requestBody\n}", "func AccessRequestBody(jsonToken string) string {\n\tvals := url.Values{}\n\tvals.Set(\"client_id\", config.C.Enterprise[\"APIKey\"])\n\tvals.Set(\"client_secret\", config.C.Enterprise[\"ClientSecret\"])\n\tvals.Set(\"jwt_token\", jsonToken)\n\treturn vals.Encode()\n}", "func (c *ThreeScaleClient) buildPostJSONReq(ep string, body io.Reader) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", c.adminPortal.rawURL+ep, body)\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Basic \"+basicAuth(\"\", c.credential))\n\treturn req, err\n}", "func (r ApiPatchOAuth2ClientRequest) JsonPatch(jsonPatch []JsonPatch) ApiPatchOAuth2ClientRequest {\n\tr.jsonPatch = &jsonPatch\n\treturn r\n}", "func (o *UpdateStockReceiptParams) SetBody(body *models.StockReceipt) {\n\to.Body = body\n}", "func (b *OperationMutator) RequestBody(v RequestBody) *OperationMutator {\n\tb.proxy.requestBody = v\n\treturn b\n}", "func (o *PutMenuItemParams) WithJSONBody(jSONBody *models.MenuItem) *PutMenuItemParams {\n\to.SetJSONBody(jSONBody)\n\treturn o\n}", "func GetBodyJSON(r *http.Request, v interface{}) error {\n\terr := json.NewDecoder(r.Body).Decode(&v)\n\treturn err\n}", "func (b binder) setFromJSONBody() HTTPError {\n\tif b.req.ContentLength == 0 {\n\t\treturn nil\n\t}\n\t// Always parse the form; it's safe and idempotent.\n\tif err := b.req.ParseForm(); err != nil {\n\t\treturn NewHTTPError(http.StatusInternalServerError, fmt.Sprintf(\"failed to parse form: %s\", err.Error()))\n\t}\n\tctype := b.req.Header.Get(\"Content-Type\")\n\tswitch {\n\tcase strings.HasPrefix(ctype, \"application/json\"):\n\t\tbody, err := b.requestBody()\n\t\tif err != nil {\n\t\t\treturn NewHTTPError(http.StatusBadRequest, err.Error())\n\t\t}\n\t\treturn b.decodeJSON(body)\n\tcase ctype == \"application/x-www-form-urlencoded\":\n\t\t// Handled by ParseForm.\n\t\treturn nil\n\tdefault:\n\t\treturn NewHTTPError(http.StatusUnsupportedMediaType, \"\")\n\t}\n}", "func writeJsonBody(w http.ResponseWriter, data interface{}) {\n\tpayload, err := json.Marshal(data)\n\tif err != nil {\n\t\tlog.Println(\"fail to encode data to the JSON format, error:\", err)\n\t\tupdateHeader(w, err)\n\t\treturn\n\t}\n\n\tupdateHeader(w, err)\n\tw.Write(payload)\n}", "func copyBody(r interface{}) (io.ReadCloser, error) {\n\tvar originalBody io.ReadCloser\n\tswitch r := r.(type) {\n\tcase *http.Request:\n\t\toriginalBody = r.Body\n\tcase *http.Response:\n\t\toriginalBody = r.Body\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported type (%T) for copyBody\", r)\n\t}\n\n\tcontent, err := ioutil.ReadAll(originalBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnewBody := ioutil.NopCloser(bytes.NewReader(content))\n\tswitch r := r.(type) {\n\tcase *http.Request:\n\t\tr.Body = newBody\n\tcase *http.Response:\n\t\tr.Body = newBody\n\t}\n\n\treturn ioutil.NopCloser(bytes.NewReader(content)), nil\n}", "func (o *BatchUpsertCatalogObjectsParams) SetBody(body *models.BatchUpsertCatalogObjectsRequest) {\n\to.Body = body\n}", "func (ctx *SimpleContext) RequestJsonBody(typ interface{}) error {\n\tcontentType := ctx.request.Header.Get(\"Content-Type\")\n\tif strings.Contains(contentType, \"json\") {\n\t\tbody, err := ioutil.ReadAll(ctx.request.Body)\n\t\tif nil != err {\n\t\t\treturn err\n\t\t}\n\t\terr = json.Unmarshal(body, typ)\n\t\tif nil != err {\n\t\t\treturn err\n\t\t}\n\t\treturn ctx.validate(typ)\n\t}\n\treturn errors.New(\"request body content-type is not contains json \")\n}", "func createAppJson(dm util.DepManager, appDir, appName, appJson string) error {\n\n\tupdatedJson, err := getAndUpdateAppJson(dm, appName, appJson)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = ioutil.WriteFile(filepath.Join(appDir, fileFlogoJson), []byte(updatedJson), 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (o *PcloudPvminstancesSnapshotsRestorePostParams) SetBody(body *models.SnapshotRestore) {\n\to.Body = body\n}", "func (o *UserRolesActionV1Params) SetBody(body *models.DomainActionUserRolesRequest) {\n\to.Body = body\n}", "func (c *apiClient) newRequestWithJSONBody(\n\tctx context.Context, method, resourcePath string,\n\tquery url.Values, body interface{}) (*http.Request, error) {\n\tdata, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc.Logger.Debugf(\"httpx: request body length: %d bytes\", len(data))\n\tif c.LogBody {\n\t\tc.Logger.Debugf(\"httpx: request body: %s\", string(data))\n\t}\n\trequest, err := c.newRequest(\n\t\tctx, method, resourcePath, query, bytes.NewReader(data))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif body != nil {\n\t\trequest.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn request, nil\n}", "func (r *Request) setBodyObject(object interface{}) error {\n\tvar err error\n\tr.body, err = r.session.codec.Marshal(object, nil)\n\treturn err\n}", "func (b *BitcoinClient) createBody(rpcBody *RPCBody) (*bytes.Buffer, error) {\n\tbodyJSON, err := json.Marshal(rpcBody)\n\tif err != nil {\n\t\tlog.Println(ErrCreatingBody)\n\t\treturn nil, ErrCreatingBody\n\t}\n\n\treturn bytes.NewBuffer(bodyJSON), nil\n}", "func (o *PcloudV1CloudinstancesCosimagesPostParams) SetBody(body *models.CreateCosImageImportJob) {\n\to.Body = body\n}", "func (recipe *Recipe) FromJSON(r io.Reader) error {\n\tdecoder := json.NewDecoder(r)\n\treturn decoder.Decode(recipe)\n}", "func Body(data ...interface{}) AdditionalAttribute {\n return func(rb *Builder) error {\n rb.SetBody(data...)\n return nil\n }\n}", "func (g *Github) PatchJSON(url, content string, v interface{}) error {\n\tbytes, err := g.patchBytes(url, content)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := json.Unmarshal(bytes, v); err != nil {\n\t\treturn fmt.Errorf(\"could not parse json for url %s: %v\", url, err)\n\t}\n\treturn nil\n}", "func update(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar receipt Receipt\n\tvar err error\n\tfmt.Println(\"starting write\")\n\n\tif len(args[0]) == 0 {\n\t\treturn shim.Error(\"wrong arguments\")\n\t}\n\n\treceiptJson := []byte(args[0])\n\terr = json.Unmarshal(receiptJson, &receipt)\n\tif err != nil {\n\t\tfmt.Println(\"json is wrong,json is: \" + args[0])\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t//check if new owner exists\n\towner, err := getOwner(stub, receipt.OwnerRelation.Id)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to find owner - \" + owner.Id)\n\t\treturn shim.Error(err.Error())\n\t}\n\n\terr = stub.PutState(receipt.Id, receiptJson) //write the variable into the ledger\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\tfmt.Println(\"- end write\")\n\treturn shim.Success(nil)\n}", "func (o *DeleteRolesParams) SetBody(body *models.OpenpitrixDeleteRolesRequest) {\n\to.Body = body\n}", "func (o *DeleteKeyPairsParams) SetBody(body *models.OpenpitrixDeleteKeyPairsRequest) {\n\to.Body = body\n}" ]
[ "0.68018734", "0.65308696", "0.5895473", "0.58617973", "0.5805046", "0.57633257", "0.56163126", "0.55379707", "0.544437", "0.543002", "0.5392192", "0.53760797", "0.53396225", "0.5332443", "0.52658796", "0.5227039", "0.5201621", "0.51650983", "0.5164823", "0.5163957", "0.5132194", "0.5121809", "0.5109449", "0.5087797", "0.50841653", "0.50432533", "0.5040159", "0.5030128", "0.50232303", "0.5020545", "0.5010065", "0.5005683", "0.49898025", "0.49835432", "0.49659893", "0.49582815", "0.49573895", "0.49548724", "0.4941528", "0.49231824", "0.4918244", "0.4915779", "0.4915135", "0.49105522", "0.49072474", "0.49065325", "0.49024886", "0.48932314", "0.48789856", "0.48660737", "0.48330647", "0.4831856", "0.48259124", "0.48226297", "0.48135003", "0.48120487", "0.48021063", "0.47971144", "0.47920674", "0.47910425", "0.47888118", "0.47825927", "0.477518", "0.47706112", "0.47649541", "0.47539806", "0.47539166", "0.4737956", "0.4737685", "0.473124", "0.47171292", "0.47159696", "0.47062302", "0.47021443", "0.4687725", "0.4686038", "0.46844363", "0.4682353", "0.46776888", "0.46755472", "0.46685338", "0.4667529", "0.46671632", "0.46608132", "0.46535465", "0.46525648", "0.4643804", "0.4640378", "0.46394086", "0.46360043", "0.46241742", "0.46134353", "0.4611435", "0.46046832", "0.45937136", "0.4591276", "0.45818275", "0.45809174", "0.45768395", "0.45724404" ]
0.7069762
0
To reduce request to GKE metadata server, the base token source is reused across syncers. Note: Initialization is deferred because there are possible to use serviceAccountSecretRef with no available default token source.
Чтобы сократить запросы к серверу метаданных GKE, базовый источник токенов переиспользуется между синхронизаторами. Примечание: инициализация откладывается, так как возможно использование serviceAccountSecretRef без доступного по умолчанию источника токенов.
func initializedBaseTokenSource() (oauth2.TokenSource, error) { baseTokenSourceOnce.Do(func() { baseTokenSource, baseTokenSourceErr = google.DefaultTokenSource(context.Background(), cloudPlatformScope) }) return baseTokenSource, baseTokenSourceErr }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func tokenSource(ctx context.Context) (oauth2.TokenSource, error) {\n\tok, err := credsFile.Exists()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar bootstrapToken *oauth2.Token\n\tif !ok {\n\t\ttok, err := authenticate()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbootstrapToken = tok\n\t}\n\treturn newCachedTokenFile(ctx, bootstrapToken, credsFile.Path())\n}", "func initializeTokenRequester(centralCfg config.CentralConfig) {\n\tagent.tokenRequester = apicauth.NewPlatformTokenGetter(\n\t\tcentralCfg.GetAuthConfig().GetPrivateKey(),\n\t\tcentralCfg.GetAuthConfig().GetPublicKey(),\n\t\tcentralCfg.GetAuthConfig().GetKeyPassword(),\n\t\tcentralCfg.GetAuthConfig().GetTokenURL(),\n\t\tcentralCfg.GetAuthConfig().GetAudience(),\n\t\tcentralCfg.GetAuthConfig().GetClientID(),\n\t\tcentralCfg.GetAuthConfig().GetTimeout(),\n\t)\n}", "func newTokenSource() *tokenReplacer {\n\t// nil token will cause a refresh\n\ttok, _ := readToken()\n\treturn &tokenReplacer{tok, oauthConfig.TokenSource(context.Background(), tok), &tokenPrompt{}}\n}", "func (c *Config) tokenSource(ctx context.Context, scheme string) (oauth2.TokenSource, error) {\n\tif c.WorkforcePoolUserProject != \"\" {\n\t\tvalid := validateWorkforceAudience(c.Audience)\n\t\tif !valid {\n\t\t\treturn nil, fmt.Errorf(\"oauth2/google: workforce_pool_user_project should not be set for non-workforce pool credentials\")\n\t\t}\n\t}\n\n\tts := tokenSource{\n\t\tctx: ctx,\n\t\tconf: c,\n\t}\n\tif c.ServiceAccountImpersonationURL == \"\" {\n\t\treturn oauth2.ReuseTokenSource(nil, ts), nil\n\t}\n\tscopes := c.Scopes\n\tts.conf.Scopes = []string{\"https://www.googleapis.com/auth/cloud-platform\"}\n\timp := ImpersonateTokenSource{\n\t\tCtx: ctx,\n\t\tURL: c.ServiceAccountImpersonationURL,\n\t\tScopes: scopes,\n\t\tTs: oauth2.ReuseTokenSource(nil, ts),\n\t\tTokenLifetimeSeconds: c.ServiceAccountImpersonationLifetimeSeconds,\n\t}\n\treturn oauth2.ReuseTokenSource(nil, imp), nil\n}", "func tokenSource(ctx context.Context, accessToken, credentials string) (oauth2.TokenSource, error) {\n\t// Try access token first\n\tif accessToken != \"\" {\n\t\tlog.Printf(\"[INFO] authenticating via access_token\")\n\n\t\tcontents, _, err := pathorcontents.Read(accessToken)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to load access token: %w\", err)\n\t\t}\n\n\t\treturn oauth2.StaticTokenSource(&oauth2.Token{\n\t\t\tAccessToken: contents,\n\t\t}), nil\n\t}\n\n\t// Then credentials\n\tif credentials != \"\" {\n\t\tlog.Printf(\"[INFO] authenticating via credentials\")\n\n\t\tcontents, _, err := pathorcontents.Read(credentials)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to load credentials: %w\", err)\n\t\t}\n\n\t\tcreds, err := google.CredentialsFromJSON(ctx, []byte(contents), cloudPlatformScope)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse credentials: %w\", err)\n\t\t}\n\n\t\treturn creds.TokenSource, nil\n\t}\n\n\t// Fallback to default credentials\n\tlog.Printf(\"[INFO] authenticating via default credentials\")\n\tsource, err := google.DefaultTokenSource(ctx, cloudPlatformScope)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get default credentials: %w\", err)\n\t}\n\treturn source, nil\n}", "func (w *GCPAuthWrapper) SetTokenSource(permissionCode string) error {\n\tvar err error\n\n\tctx := context.Background()\n\n\tw.OauthToken, err = w.Config.Exchange(ctx, permissionCode)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *Config) TokenSource(ctx context.Context, t *Token) TokenSource {\n\ttkr := &tokenRefresher{\n\t\tctx: ctx,\n\t\tconf: c,\n\t}\n\tif t != nil {\n\t\ttkr.refreshToken = t.RefreshToken\n\t}\n\treturn &reuseTokenSource{\n\t\tt: t,\n\t\tnew: tkr,\n\t}\n}", "func Init(ctx context.Context, local bool) (oauth2.TokenSource, error) {\n\treturn auth_steps.Init(ctx, local, auth.ScopeGerrit, auth.ScopeUserinfoEmail)\n}", "func (b *BungieConfig) TokenSource(t *oauth2.Token) oauth2.TokenSource {\n\treturn newTokenSource(t, b.cfg.ClientID)\n}", "func StorageTokenSource(ctx context.Context, c *Config, t *oauth2.Token) oauth2.TokenSource {\n\tif t == nil || !t.Valid() {\n\t\tif tok, err := c.Storage.GetToken(); err == nil {\n\t\t\tt = tok\n\t\t}\n\t}\n\tts := c.Config.TokenSource(ctx, t)\n\treturn &storageTokenSource{c, ts}\n}", "func (c *Credentials) TokenSource(ctx context.Context) (oauth2.TokenSource, error) {\n\tswitch c.Type {\n\tcase CredentialsTypeADC:\n\t\treturn initializedBaseTokenSource()\n\tcase CredentialsTypeServiceAccountJSON:\n\t\tcred, err := google.CredentialsFromJSON(ctx, c.ServiceAccountJSON, cloudPlatformScope)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn cred.TokenSource, nil\n\tcase CredentialsTypeImpersonation:\n\t\tbaseTS, err := initializedBaseTokenSource()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tts, err := impersonate.CredentialsTokenSource(ctx, impersonate.CredentialsConfig{\n\t\t\tTargetPrincipal: c.ImpersonateConfig.TargetServiceAccount,\n\t\t\tDelegates: c.ImpersonateConfig.Delegates,\n\t\t\tScopes: []string{cloudPlatformScope},\n\t\t},\n\t\t\toption.WithTokenSource(baseTS),\n\t\t)\n\t\treturn ts, err\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"credentials type unknown: %v\", c.Type)\n\t}\n}", "func (ts tokenSource) Token() (*oauth2.Token, error) {\n\tconf := ts.conf\n\n\tcredSource, err := conf.parse(ts.ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsubjectToken, err := credSource.subjectToken()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstsRequest := stsTokenExchangeRequest{\n\t\tGrantType: \"urn:ietf:params:oauth:grant-type:token-exchange\",\n\t\tAudience: conf.Audience,\n\t\tScope: conf.Scopes,\n\t\tRequestedTokenType: \"urn:ietf:params:oauth:token-type:access_token\",\n\t\tSubjectToken: subjectToken,\n\t\tSubjectTokenType: conf.SubjectTokenType,\n\t}\n\theader := make(http.Header)\n\theader.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\tclientAuth := clientAuthentication{\n\t\tAuthStyle: oauth2.AuthStyleInHeader,\n\t\tClientID: conf.ClientID,\n\t\tClientSecret: conf.ClientSecret,\n\t}\n\tvar options map[string]interface{}\n\t// Do not pass workforce_pool_user_project when client authentication is used.\n\t// The client ID is sufficient for determining the user project.\n\tif conf.WorkforcePoolUserProject != \"\" && conf.ClientID == \"\" {\n\t\toptions = map[string]interface{}{\n\t\t\t\"userProject\": conf.WorkforcePoolUserProject,\n\t\t}\n\t}\n\tstsResp, err := exchangeToken(ts.ctx, conf.TokenURL, &stsRequest, clientAuth, header, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taccessToken := &oauth2.Token{\n\t\tAccessToken: stsResp.AccessToken,\n\t\tTokenType: stsResp.TokenType,\n\t}\n\tif stsResp.ExpiresIn < 0 {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: got invalid expiry from security token service\")\n\t} else if stsResp.ExpiresIn >= 0 {\n\t\taccessToken.Expiry = now().Add(time.Duration(stsResp.ExpiresIn) * time.Second)\n\t}\n\n\tif stsResp.RefreshToken != \"\" {\n\t\taccessToken.RefreshToken = stsResp.RefreshToken\n\t}\n\treturn accessToken, nil\n}", "func attemptInit(ctx context.Context, account string, scopes []string, audience string) (TokenProvider, error) {\n\t// This mutex is used to avoid hitting GKE metadata server concurrently if\n\t// we have a stampede of goroutines. It doesn't actually protect any shared\n\t// state in the current process.\n\tglobalGCELock.Lock()\n\tdefer globalGCELock.Unlock()\n\n\tif account == \"\" {\n\t\taccount = \"default\"\n\t}\n\n\t// Grab an email associated with the account. This must not be failing on\n\t// a healthy VM if the account is present. If it does, the metadata server is\n\t// broken.\n\temail, err := metadataClient.Email(account)\n\tif err != nil {\n\t\t// Note: we purposefully delay this check only after the first call to\n\t\t// the metadata fails because metadata.OnGCE was observed to often report\n\t\t// \"false\" when running on GKE due to gke-metadata-server being slow. Our\n\t\t// metadataClient has (much) higher timeouts that the client used by\n\t\t// metadata.OnGCE, and it handles slow gke-metadata-server better. So if we\n\t\t// end up here and metadata.OnGCE also says \"false\", then we are not on GCE\n\t\t// with high probability. The downside is that it may take up to 15 sec to\n\t\t// detect this (or whatever ResponseHeaderTimeout in metadataClient is).\n\t\tif !metadata.OnGCE() {\n\t\t\treturn nil, ErrBadCredentials\n\t\t}\n\t\tif _, yep := err.(metadata.NotDefinedError); yep {\n\t\t\treturn nil, ErrInsufficientAccess\n\t\t}\n\t\treturn nil, transient.Tag.Apply(err)\n\t}\n\n\t// Ensure the account has requested scopes. Assume 'cloud-platform' scope\n\t// covers all possible scopes. This is important when using GKE Workload\n\t// Identities: the metadata server always reports only 'cloud-platform' scope\n\t// there. Its presence should be enough to cover all scopes used in practice.\n\t// The exception is non-cloud scopes (like gerritcodereview or G Suite). To\n\t// use such scopes, one will have to use impersonation through Cloud IAM APIs,\n\t// which *are* covered by cloud-platform (see ActAsServiceAccount in auth.go).\n\tif audience == \"\" {\n\t\tavailableScopes, err := metadataClient.Scopes(account)\n\t\tif err != nil {\n\t\t\treturn nil, transient.Tag.Apply(err)\n\t\t}\n\t\tavailableSet := stringset.NewFromSlice(availableScopes...)\n\t\tif !availableSet.Has(\"https://www.googleapis.com/auth/cloud-platform\") {\n\t\t\tfor _, requested := range scopes {\n\t\t\t\tif !availableSet.Has(requested) {\n\t\t\t\t\tlogging.Warningf(ctx, \"GCE service account %q doesn't have required scope %q (all scopes: %q)\", account, requested, availableScopes)\n\t\t\t\t\treturn nil, ErrInsufficientAccess\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &gceTokenProvider{\n\t\taccount: account,\n\t\temail: email,\n\t\taudience: audience,\n\t\tcacheKey: CacheKey{\n\t\t\tKey: fmt.Sprintf(\"gce/%s\", account),\n\t\t\tScopes: scopes,\n\t\t},\n\t}, nil\n}", "func (c *Config) TokenSource() oauth2.TokenSource {\n\tpk, err := jwt.ParseRSAPrivateKeyFromPEM(c.PrivateKey)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn oauth2.ReuseTokenSource(nil, appSource{\n\t\tappID: c.AppID,\n\t\texpire: c.Expire,\n\t\tpk: pk,\n\t})\n}", "func newTokenInjector(meta *metadata.Client, acc string) func(*http.Request) error {\n\tif acc == \"\" {\n\t\tacc = \"default\"\n\t}\n\tacc = url.PathEscape(acc)\n\treturn func(req *http.Request) error {\n\t\taud := fmt.Sprintf(\"%s://%s\", req.URL.Scheme, req.URL.Host)\n\t\taud = url.QueryEscape(aud)\n\t\t// TODO(smut): Cache the token and reuse if not yet expired.\n\t\t// Currently the only user of this package only makes one\n\t\t// request per boot so caching isn't too important yet.\n\t\ttok, err := meta.Get(fmt.Sprintf(tokMetadata, acc, aud))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treq.Header.Set(vmtoken.Header, tok)\n\t\treturn nil\n\t}\n}", "func appEngineTokenSource(ctx context.Context, scope ...string) oauth2.TokenSource {\n\tlogOnce.Do(func() {\n\t\tlog.Print(\"google: AppEngineTokenSource is deprecated on App Engine standard second generation runtimes (>= Go 1.11) and App Engine flexible. Please use DefaultTokenSource or ComputeTokenSource.\")\n\t})\n\treturn ComputeTokenSource(\"\")\n}", "func OIDCFederatedTokenSource(tokenConfig *OIDCFederatedTokenConfig) (oauth2.TokenSource, error) {\n\n\tif &tokenConfig.SourceTokenSource == nil {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: Source OIDC Token cannot be nil\")\n\t}\n\n\tif tokenConfig.Scope == \"\" {\n\t\ttokenConfig.Scope = GCP_OIDC_CLOUD_PLATFORM_SCOPE\n\t}\n\treturn &oidcFederatedTokenSource{\n\t\trefreshMutex: &sync.Mutex{},\n\t\trootSource: tokenConfig.SourceTokenSource,\n\t\tscope: tokenConfig.Scope,\n\t\ttargetResource: tokenConfig.TargetResource,\n\t\ttargetServiceAccount: tokenConfig.TargetServiceAccount,\n\t\tuseIAMToken: tokenConfig.UseIAMToken,\n\t}, nil\n}", "func (c *Config) TokenSource(ctx context.Context) (oauth2.TokenSource, error) {\n\treturn c.tokenSource(ctx, \"https\")\n}", "func Token(c *gin.Context) {\n\n\tclientStorage, err := models.NewClientStorage(ginject.Deps(c))\n\tif err != nil {\n\t\tpanic(err)\n\t\treturn\n\t}\n\n\tmanager := models.NewManager(ginject.Deps(c))\n\n\tserver.InitServer(manager)\n\tserver.SetAllowedGrantType(oauth2.AuthorizationCode, oauth2.Refreshing)\n\tserver.SetAllowedResponseType(oauth2.Token)\n\n\tserver.SetClientInfoHandler(func(r *http.Request) (clientID, clientSecret string, err error) {\n\n\t\tcid := r.FormValue(\"client_id\")\n\n\t\tif cid == \"\" {\n\n\t\t}\n\n\t\tinfo, err := clientStorage.GetByID(cid)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tclientID = info.GetID()\n\t\tclientSecret = info.GetSecret()\n\t\treturn\n\t})\n\n\tserver.HandleTokenRequest(c)\n}", "func New(name string, configPath string, userName string) (tokenauth.Source, error) {\n\tif configPath == \"\" {\n\t\tconfigPath = k8s.DefaultKubeConfigPath\n\t}\n\tk8sConfig, err := cfg.LoadFromFile(configPath)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Failed to load k8s config from file %v. Make sure it is there or change\"+\n\t\t\t\" permissions.\", configPath)\n\t}\n\n\tinfo, ok := k8sConfig.AuthInfos[userName]\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"Failed to find user %s inside k8s config AuthInfo from file %v\", userName, configPath)\n\t}\n\n\t// Currently supported:\n\t// - token\n\t// - OIDC\n\t// - Google compute platform via Oauth2\n\tif info.AuthProvider != nil {\n\t\tswitch info.AuthProvider.Name {\n\t\tcase \"oidc\":\n\t\t\tcache, err := k8s.NewCacheFromUser(configPath, userName)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"Failed to get OIDC configuration from user. \")\n\t\t\t}\n\t\t\ts, _, err := oidcauth.NewWithCache(name, cache, nil)\n\t\t\treturn s, err\n\t\tcase \"gcp\":\n\t\t\tc, err := oauth2auth.NewConfigFromMap(info.AuthProvider.Config)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"Failed to create OAuth2 config from map.\")\n\t\t\t}\n\t\t\treturn oauth2auth.NewGCP(name, userName, configPath, c)\n\t\tdefault:\n\t\t\t// TODO(bplotka): Add support for more of them if needed.\n\t\t\treturn nil, errors.Errorf(\"Not supported k8s Auth provider %v\", info.AuthProvider.Name)\n\t\t}\n\t}\n\n\tif info.Token != \"\" {\n\t\treturn directauth.New(name, info.Token), nil\n\t}\n\n\treturn nil, errors.Errorf(\"Not found supported auth source from k8s config %+v\", info)\n}", "func RecoverToken(currentTarget *types.Target) (*oauth2.Token, error) {\n\tvar storage []keyring.BackendType\n\tstorageConfig := viper.GetString(\"targets.\" + currentTarget.Label + \".token-storage\")\n\tstorage = append(storage, keyring.BackendType(storageConfig))\n\tring, err := keyring.Open(keyring.Config{\n\t\t// Configuration for keychain\n\t\tAllowedBackends: storage,\n\t\tServiceName: \"gsh\",\n\n\t\t// Configuration for encrypted file\n\t\tFileDir: \"~/.gsh/\" + currentTarget.Label,\n\t\tFilePasswordFunc: terminalPrompt,\n\n\t\t// Configuration for KWallet\n\t\tKWalletAppID: \"gsh\",\n\t\tKWalletFolder: currentTarget.Label,\n\n\t\t// Configuration for pass (https://www.passwordstore.org/)\n\t\tPassDir: \"~/.gsh/\" + currentTarget.Label,\n\n\t\t// Configuration for Secret Service (https://secretstorage.readthedocs.io/en/latest/)\n\t\tLibSecretCollectionName: \"gsh\",\n\t})\n\tif err != nil {\n\t\tfmt.Printf(\"Client error opening token-storage: (%s)\\n\", err.Error())\n\t\treturn nil, err\n\t}\n\n\ttokenKeyItem, err := ring.Get(currentTarget.Label)\n\tif err != nil {\n\t\tfmt.Printf(\"Client error reading token storage: (%s)\\n\", err.Error())\n\t\treturn nil, err\n\t}\n\n\ttoken := new(oauth2.Token)\n\tif err := json.Unmarshal(tokenKeyItem.Data, &token); err != nil {\n\t\tfmt.Printf(\"Client error unmarshalling stored token: (%s)\\n\", err.Error())\n\t\treturn nil, err\n\t}\n\n\t// Setting custom HTTP client with timeouts\n\tvar netTransport = &http.Transport{\n\t\tDial: (&net.Dialer{\n\t\t\tTimeout: 10 * time.Second,\n\t\t}).Dial,\n\t\tTLSHandshakeTimeout: 10 * time.Second,\n\t}\n\tvar netClient = &http.Client{\n\t\tTimeout: 10 * time.Second,\n\t\tTransport: netTransport,\n\t}\n\n\t// Making discovery GSH request\n\tresp, err := netClient.Get(currentTarget.Endpoint + \"/status/config\")\n\tif err != nil {\n\t\tfmt.Printf(\"GSH API is down: %s (%s)\\n\", currentTarget.Endpoint, err.Error())\n\t\tos.Exit(1)\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tfmt.Printf(\"GSH API body response error: %s\\n\", err.Error())\n\t\tos.Exit(1)\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\tfmt.Printf(\"GSH API status response error: %v\\n\", resp.StatusCode)\n\t\tos.Exit(1)\n\t}\n\ttype ConfigResponse struct {\n\t\tBaseURL string `json:\"oidc_base_url\"`\n\t\tRealm string `json:\"oidc_realm\"`\n\t\tAudience string `json:\"oidc_audience\"`\n\t\tIssuer string `json:\"oidc_issuer\"`\n\t\tCerts string `json:\"oidc_certs\"`\n\t}\n\tconfigResponse := new(ConfigResponse)\n\tif err := json.Unmarshal(body, &configResponse); err != nil {\n\t\tfmt.Printf(\"GSH API body unmarshal error: %s\\n\", err.Error())\n\t\tos.Exit(1)\n\t}\n\n\tctx := context.Background()\n\toauth2provider, err := oidc.NewProvider(ctx, configResponse.Issuer)\n\tif err != nil {\n\t\tfmt.Printf(\"GSH client setting OIDC provider error: %s\\n\", err.Error())\n\t\tos.Exit(1)\n\t}\n\n\t// Configure an OpenID Connect aware OAuth2 client.\n\toauth2config := &oauth2.Config{\n\t\tClientID: configResponse.Audience,\n\t\tEndpoint: oauth2provider.Endpoint(),\n\t}\n\ttokenRefreshed, err := oauth2config.TokenSource(ctx, token).Token()\n\tif err != nil {\n\t\tfmt.Printf(\"GSH client renew token error: %s\\n\", err.Error())\n\t\tos.Exit(1)\n\t}\n\n\treturn tokenRefreshed, nil\n}", "func init() {\n\toauthConfig, err := adal.NewOAuthConfig(azure.PublicCloud.ActiveDirectoryEndpoint, config.TenantID)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to get OAuth config: %v\\n\", err)\n\t}\n\ttoken, err = adal.NewServicePrincipalToken(\n\t\t*oauthConfig,\n\t\tconfig.ServicePrincipalID,\n\t\tconfig.ServicePrincipalSecret,\n\t\tazure.PublicCloud.ResourceManagerEndpoint)\n\tif err != nil {\n\t\tlog.Fatalf(\"faled to get token: %v\\n\", err)\n\t}\n}", "func CredentialsTokenSource(creds *google.Credentials) TokenSource {\n\tif creds == nil {\n\t\treturn nil\n\t}\n\treturn TokenSource(creds.TokenSource)\n}", "func Init(paramClientID, paramClientSecret, paramAuth0URL, paramAudience string) {\n\tf := logrus.Fields{\n\t\t\"functionName\": \"token.Init\",\n\t\t\"auth0URL\": paramAuth0URL,\n\t\t\"audience\": paramAudience,\n\t}\n\tlog.WithFields(f).Debug(\"token init running...\")\n\n\tclientID = paramClientID\n\tclientSecret = paramClientSecret\n\taudience = paramAudience\n\toauthTokenURL = paramAuth0URL\n\n\tif expiry.Year() == 1 {\n\t\texpiry = time.Now()\n\t}\n\n\tgo retrieveToken() //nolint\n}", "func (gsp *GoogleServiceProvider) TokenSource(c context.Context, scopes ...string) (oauth2.TokenSource, error) {\n\tcbts := contextBoundTokenSource{\n\t\tContext: c,\n\t\tcache: gsp.Cache,\n\t\tcacheKey: accessTokenKeyForScopes(scopes),\n\t\tmakeTokenSource: func(c context.Context) (oauth2.TokenSource, error) {\n\t\t\treturn google.DefaultTokenSource(c, scopes...)\n\t\t},\n\t}\n\treturn &cbts, nil\n}", "func appEngineTokenSource(ctx context.Context, scope ...string) oauth2.TokenSource {\n\tscopes := append([]string{}, scope...)\n\tsort.Strings(scopes)\n\treturn &gaeTokenSource{\n\t\tctx: ctx,\n\t\tscopes: scopes,\n\t\tkey: strings.Join(scopes, \" \"),\n\t}\n}", "func sourceFromDefault(ctx context.Context, targetAudience string, tokenURL string) (*oidcTokenSource, error) {\n\tcredentials, err := google.FindDefaultCredentials(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(credentials.JSON) == 0 {\n\t\treturn nil, ErrComputeEngineNotSupported\n\t}\n\tconfig, err := google.JWTConfigFromJSON(credentials.JSON)\n\tif err != nil {\n\t\t// friendly error message that we found user credentials\n\t\tif strings.Contains(err.Error(), \"authorized_user\") {\n\t\t\treturn nil, ErrUserCredentialsNotSupported\n\t\t}\n\t\treturn nil, err\n\t}\n\tprivateKey, err := parseKey(config.PrivateKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &oidcTokenSource{config.Email, config.PrivateKeyID, privateKey, targetAudience, tokenURL}, nil\n}", "func TokenSource(ctx context.Context, config *oauth2.Config, state string, authHandler AuthorizationHandler) oauth2.TokenSource {\n\treturn TokenSourceWithPKCE(ctx, config, state, authHandler, nil)\n}", "func getClient(config *oauth2.Config) *http.Client {\n // The file token.json stores the user's access and refresh tokens, and is\n // created automatically when the authorization flow completes for the first\n // time.\n tokFile := \"token.json\"\n tok, err := tokenFromFile(tokFile)\n if err != nil {\n tok = getTokenFromWeb(config)\n saveToken(tokFile, tok)\n }\n return config.Client(context.Background(), tok)\n}", "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}", "func (c *contextBoundTokenSource) Token() (*oauth2.Token, error) {\n\tnow := clock.Now(c)\n\n\t// Get the current token value. We do this without locking around the token\n\t// element.\n\tif tokIface, ok := c.cache.Get(c, c.cacheKey); ok {\n\t\ttok := tokIface.(*oauth2.Token)\n\t\tif !c.closeToExpRandomized(now, tok.Expiry, accessTokenExpirationRandomization) {\n\t\t\treturn tok, nil\n\t\t}\n\t}\n\n\t// Either the token is expired, or we are selected randomly as a refresh case.\n\t// Get a new TokenSource to refresh the token with.\n\tts, err := c.makeTokenSource(c)\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"failed to create new TokenSource\").Err()\n\t}\n\n\t// While refreshing, we lock around the cache key via GetOrCreate in case\n\t// multiple requests are either selected or have expired.\n\ttokIface, err := c.cache.GetOrCreate(c, c.cacheKey, func() (interface{}, time.Duration, error) {\n\t\ttok, err := ts.Token()\n\t\tif err != nil {\n\t\t\treturn nil, 0, err\n\t\t}\n\n\t\texpiryDelta := tok.Expiry.Sub(now)\n\t\tswitch {\n\t\tcase expiryDelta <= 0:\n\t\t\treturn nil, 0, errors.Reason(\"retrieved expired access token (%s < %s)\", tok.Expiry, now).Err()\n\t\tcase expiryDelta > accessTokenMinExpiration:\n\t\t\t// Subtract some time from the token's expiry so we don't use it immediately\n\t\t\t// before it actually expires.\n\t\t\ttok.Expiry = tok.Expiry.Add(-accessTokenMinExpiration)\n\t\t\texpiryDelta -= accessTokenMinExpiration\n\t\t}\n\t\treturn tok, expiryDelta, nil\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"failed to mint new access token\").Err()\n\t}\n\treturn tokIface.(*oauth2.Token), nil\n}", "func (its ImpersonateTokenSource) Token() (*oauth2.Token, error) {\n\tlifetimeString := \"3600s\"\n\tif its.TokenLifetimeSeconds != 0 {\n\t\tlifetimeString = fmt.Sprintf(\"%ds\", its.TokenLifetimeSeconds)\n\t}\n\treqBody := generateAccessTokenReq{\n\t\tLifetime: lifetimeString,\n\t\tScope: its.Scopes,\n\t\tDelegates: its.Delegates,\n\t}\n\tb, err := json.Marshal(reqBody)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: unable to marshal request: %v\", err)\n\t}\n\tclient := oauth2.NewClient(its.Ctx, its.Ts)\n\treq, err := http.NewRequest(\"POST\", its.URL, bytes.NewReader(b))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: unable to create impersonation request: %v\", err)\n\t}\n\treq = req.WithContext(its.Ctx)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: unable to generate access token: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(io.LimitReader(resp.Body, 1<<20))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: unable to read body: %v\", err)\n\t}\n\tif c := resp.StatusCode; c < 200 || c > 299 {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: status code %d: %s\", c, body)\n\t}\n\n\tvar accessTokenResp impersonateTokenResponse\n\tif err := json.Unmarshal(body, &accessTokenResp); err != nil {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: unable to parse response: %v\", err)\n\t}\n\texpiry, err := time.Parse(time.RFC3339, accessTokenResp.ExpireTime)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: unable to parse expiry: %v\", err)\n\t}\n\treturn &oauth2.Token{\n\t\tAccessToken: accessTokenResp.AccessToken,\n\t\tExpiry: expiry,\n\t\tTokenType: \"Bearer\",\n\t}, nil\n}", "func TokenSource(aud string) oauth2.TokenSource {\n\tidSrc := idTokenSrc{aud: aud}\n\tinitialToken := &oauth2.Token{}\n\treturn oauth2.ReuseTokenSource(initialToken, idSrc)\n}", "func grpcGetServiceConfigWithOauthToken(sa *string, ctx context.Context) (*serviceconfig.Service, error) {\n\t//scope := sm.CloudPlatformScope\n\tserverAddr := \"servicemanagement.googleapis.com\"\n\tserverAddrWithPort := \"servicemanagement.googleapis.com:443\"\n\tgetServiceConfigProtoReq := smp.GetServiceConfigRequest{\n\t\tServiceName: serviceName,\n\t}\n\tpool, _ := x509.SystemCertPool()\n\t// error handling omitted\n\tcreds := credentials.NewClientTLSFromCert(pool, serverAddrWithPort)\n\tcreds.OverrideServerName(serverAddr)\n\t//perRPC, _ := grpcOauth.NewServiceAccountFromFile(*sa, scope)\n\tbearerToken := \"Bearer ya29.c.ElrSBZKqpjJDEyFjqpfWF1s62FplR8at1Lvt2NDxFKShwNzJr6x2T0YK6ycldNv_ZlA4aNxBjL1jmZdBmjvf6733o8G9sCsxDWHWNgy9Wewz7Fz_Jo7bSaz0psc\"\n\n\t//md := metadata.Pairs(\"Authorization\", bearerToken)\n\t//cos := grpc.HeaderCallOption{\n\t//\tHeaderAddr: &md,\n\t//}\n\n\tperRPC := customJwt{\n\t\ttoken: bearerToken,\n\t}\n\n\tconn, _ := grpc.Dial(\n\t\tserverAddrWithPort,\n\t\tgrpc.WithPerRPCCredentials(&perRPC),\n\t\tgrpc.WithTransportCredentials(creds),\n\t)\n\t//grpc.Header()\n\tgscp, err := smp.NewServiceManagerClient(conn).GetServiceConfig(ctx, &getServiceConfigProtoReq)\n\tif err != nil {\n\t\tfmt.Println(\"Error while making grpc call: \", err)\n\t}\n\tfmt.Println(\"grpc call get name : \", gscp.GetName())\n\treturn gscp, err\n}", "func newReloadingTokenSource(getToken func() []byte) *reloadingTokenSource {\n\treturn &reloadingTokenSource{\n\t\tgetToken: getToken,\n\t}\n}", "func (o *AzureCLICredentialOptions) init() {\n\tif o.tokenProvider == nil {\n\t\to.tokenProvider = defaultTokenProvider()\n\t}\n}", "func (src *gcloudTokenSource) Token() (*oauth2.Token, error) {\n\tcfg, err := GcloudConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn cfg.oauthToken(), nil\n}", "func (dts downscopingTokenSource) Token() (*oauth2.Token, error) {\n\n\tdownscopedOptions := struct {\n\t\tBoundary accessBoundary `json:\"accessBoundary\"`\n\t}{\n\t\tBoundary: accessBoundary{\n\t\t\tAccessBoundaryRules: dts.config.Rules,\n\t\t},\n\t}\n\n\ttok, err := dts.config.RootSource.Token()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"downscope: unable to obtain root token: %v\", err)\n\t}\n\n\tb, err := json.Marshal(downscopedOptions)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"downscope: unable to marshal AccessBoundary payload %v\", err)\n\t}\n\n\tform := url.Values{}\n\tform.Add(\"grant_type\", \"urn:ietf:params:oauth:grant-type:token-exchange\")\n\tform.Add(\"subject_token_type\", \"urn:ietf:params:oauth:token-type:access_token\")\n\tform.Add(\"requested_token_type\", \"urn:ietf:params:oauth:token-type:access_token\")\n\tform.Add(\"subject_token\", tok.AccessToken)\n\tform.Add(\"options\", string(b))\n\n\tmyClient := oauth2.NewClient(dts.ctx, nil)\n\tresp, err := myClient.PostForm(identityBindingEndpoint, form)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to generate POST Request %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\trespBody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"downscope: unable to read response body: %v\", err)\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"downscope: unable to exchange token; %v. Server responded: %s\", resp.StatusCode, respBody)\n\t}\n\n\tvar tresp downscopedTokenResponse\n\n\terr = json.Unmarshal(respBody, &tresp)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"downscope: unable to unmarshal response body: %v\", err)\n\t}\n\n\t// an exchanged token that is derived from a service account (2LO) has an expired_in value\n\t// a token derived from a users token (3LO) does not.\n\t// The following code uses the time remaining on rootToken for a user as the value for the\n\t// derived token's lifetime\n\tvar expiryTime time.Time\n\tif tresp.ExpiresIn > 0 {\n\t\texpiryTime = time.Now().Add(time.Duration(tresp.ExpiresIn) * time.Second)\n\t} else {\n\t\texpiryTime = tok.Expiry\n\t}\n\n\tnewToken := &oauth2.Token{\n\t\tAccessToken: tresp.AccessToken,\n\t\tTokenType: tresp.TokenType,\n\t\tExpiry: expiryTime,\n\t}\n\treturn newToken, nil\n}", "func TokenSource(ctx context.Context, scopes ...string) oauth2.TokenSource {\n\treturn TokenSourceEnv(ctx, envPrivateKey, scopes...)\n}", "func getClient(ctx context.Context, config *oauth2.Config) *http.Client {\n cacheFile, err := tokenCacheFile()\n if err != nil {\n log.Fatalf(\"Unable to get path to cached credential file. %v\", err)\n }\n tok, err := tokenFromFile(cacheFile)\n if err != nil {\n tok = getTokenFromWeb(config)\n saveToken(cacheFile, tok)\n }\n return config.Client(ctx, tok)\n}", "func getClient(ctx context.Context, config *oauth2.Config) *http.Client {\n cacheFile, err := tokenCacheFile()\n if err != nil {\n log.Fatalf(\"Unable to get path to cached credential file. %v\", err)\n }\n tok, err := tokenFromFile(cacheFile)\n if err != nil {\n tok = getTokenFromWeb(config)\n saveToken(cacheFile, tok)\n }\n return config.Client(ctx, tok)\n}", "func getClient(ctx context.Context, config *oauth2.Config) *http.Client {\n cacheFile, err := tokenCacheFile()\n if err != nil {\n log.Fatalf(\"Unable to get path to cached credential file. %v\", err)\n }\n tok, err := tokenFromFile(cacheFile)\n if err != nil {\n tok = getTokenFromWeb(config)\n saveToken(cacheFile, tok)\n }\n return config.Client(ctx, tok)\n}", "func (a *auth) GetTokenSource(ctx context.Context, ref reference.Named) (oauth2.TokenSource, error) {\n\tsource, err := google.DefaultTokenSource(ctx, gcrScope)\n\tif nil != err {\n\t\terr = fmt.Errorf(\"failed to get Google Auth token source: %s\", err)\n\t}\n\n\treturn source, err\n\n}", "func newTokenSource(ctx context.Context, settings *Settings) (*internal.TokenSource, error) {\n\tvar ts internal.TokenSource\n\tvar err error\n\tif settings == nil {\n\t\tts, err = DefaultTokenSource(ctx, DefaultScope)\n\t} else if settings.APIKey != \"\" {\n\t\treturn nil, nil\n\t} else if settings.Scope != \"\" {\n\t\tts, err = OAuthJSONTokenSource(ctx, settings)\n\t} else {\n\t\tts, err = JWTTokenSource(ctx, settings)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ts, err\n}", "func getClient(ctx context.Context, config *oauth2.Config, tokenFile string) (*http.Client, error) {\n\tloadedTok, err := tokenFromFile(tokenFile)\n\tif err != nil {\n\t\tlog.Printf(\"Could not load token from '%s'\\n\", tokenFile)\n\t\treturn nil, err\n\t}\n\t// force refresh\n\ttokenSource := config.TokenSource(ctx, loadedTok)\n\ttok, err := tokenSource.Token()\n\tif err != nil {\n\t\tlog.Printf(\"Could not refresh token from '%s'\\n\", tokenFile)\n\t\treturn nil, err\n\t}\n\treturn config.Client(ctx, tok), nil\n}", "func InitPoolToken(poolTokenName string) token.Token {\n\treturn token.Token{\n\t\tDescription: poolTokenName,\n\t\tSymbol: poolTokenName,\n\t\tOriginalSymbol: poolTokenName,\n\t\tWholeName: poolTokenName,\n\t\tOriginalTotalSupply: sdk.NewDec(0),\n\t\tOwner: supply.NewModuleAddress(ModuleName),\n\t\tType: GenerateTokenType,\n\t\tMintable: true,\n\t}\n}", "func GCPTokenSource(ts gcp.TokenSource) broker.Option {\n\treturn optfunc(gcpTokenSourceKey{}, ts)\n}", "func (p *provider) Init(ctx servicehub.Context) error {\n\tp.accessKeyValidator = &accessKeyValidator{\n\t\tTokenService: p.TokenService,\n\t\tcollection: AccessItemCollection{},\n\t}\n\tctx.AddTask(p.InitAKItemTask)\n\tctx.AddTask(p.SyncAKItemTask)\n\treturn nil\n}", "func SetToken(token string) {\n\tDefaultClient.SetToken(token)\n}", "func (s *reloadingTokenSource) Token() (*oauth2.Token, error) {\n\treturn &oauth2.Token{\n\t\tAccessToken: string(s.getToken()),\n\t}, nil\n}", "func InitTokenGenerator(env conf.EnvironmentKey) (*TokenGenerator, error) {\n\tconfig, err := conf.ReadTokenConfig(env)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttokenGenerator, err := parseTokenConfig(config)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn tokenGenerator, nil\n}", "func (c *client) newClientToken(token string) *gitea.Client {\n\tclient := gitea.NewClient(c.URL, token)\n\tif c.SkipVerify {\n\t\thttpClient := &http.Client{}\n\t\thttpClient.Transport = &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t\t}\n\t\tclient.SetHTTPClient(httpClient)\n\t}\n\treturn client\n}", "func (ts *azureTokenSource) Token() (*azureToken, error) {\n\tts.lock.Lock()\n\tdefer ts.lock.Unlock()\n\n\tvar err error\n\ttoken := ts.cache.getToken(azureTokenKey)\n\n\tif token != nil && !token.token.IsExpired() {\n\t\treturn token, nil\n\t}\n\n\t// retrieve from config if no cache\n\tif token == nil {\n\t\ttokenFromCfg, err := ts.retrieveTokenFromCfg()\n\n\t\tif err == nil {\n\t\t\ttoken = tokenFromCfg\n\t\t}\n\t}\n\n\tif token != nil {\n\t\t// cache and return if the token is as good\n\t\t// avoids frequent persistor calls\n\t\tif !token.token.IsExpired() {\n\t\t\tts.cache.setToken(azureTokenKey, token)\n\t\t\treturn token, nil\n\t\t}\n\n\t\tklog.V(4).Info(\"Refreshing token.\")\n\t\ttokenFromRefresh, err := ts.Refresh(token)\n\t\tswitch {\n\t\tcase err == nil:\n\t\t\ttoken = tokenFromRefresh\n\t\tcase autorest.IsTokenRefreshError(err):\n\t\t\tklog.V(4).Infof(\"Failed to refresh expired token, proceed to auth: %v\", err)\n\t\t\t// reset token to nil so that the token source will be used to acquire new\n\t\t\ttoken = nil\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected error when refreshing token: %v\", err)\n\t\t}\n\t}\n\n\tif token == nil {\n\t\ttokenFromSource, err := ts.source.Token()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed acquiring new token: %v\", err)\n\t\t}\n\t\ttoken = tokenFromSource\n\t}\n\n\t// sanity check\n\tif token == nil {\n\t\treturn nil, fmt.Errorf(\"unable to acquire token\")\n\t}\n\n\t// corner condition, newly got token is valid but expired\n\tif token.token.IsExpired() {\n\t\treturn nil, fmt.Errorf(\"newly acquired token is expired\")\n\t}\n\n\terr = ts.storeTokenInCfg(token)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"storing the refreshed token in configuration: %v\", err)\n\t}\n\tts.cache.setToken(azureTokenKey, token)\n\n\treturn token, nil\n}", "func init() {\n\ttoken = nep17.Token{\n\t\tName: \"Awesome NEO Token\",\n\t\tSymbol: \"ANT\",\n\t\tDecimals: decimals,\n\t\tOwner: owner,\n\t\tTotalSupply: 11000000 * multiplier,\n\t\tCirculationKey: \"TokenCirculation\",\n\t}\n\tctx = storage.GetContext()\n}", "func newClient(token string) *github.Client {\n\tts := oauth2.StaticTokenSource(\n\t\t&oauth2.Token{AccessToken: token},\n\t)\n\ttc := oauth2.NewClient(context.Background(), ts)\n\n\treturn github.NewClient(tc)\n}", "func (g *gcs) Init(ctx context.Context) (err error) {\n\tg.context = context.Background()\n\n\tgcsClient, err := storage.NewClient(g.context, option.WithCredentialsFile(g.credentialsJSON))\n\tif err != nil {\n\t\treturn\n\t}\n\n\tg.bucket = gcsClient.Bucket(g.bucketName)\n\tg.client = gcsClient\n\n\treturn\n}", "func TestGetToken(t *testing.T) {\n\tmc := MockClient{t: t}\n\tmc.DoFunc = validDo\n\tmc.GetFunc = validGet\n\tconfig := ClientConfig{\n\t\tScopes: []string{\"thing\"},\n\t\tOktaDomain: \"mockta.local\",\n\t\tHTTPClient: &mc,\n\t}\n\n\tclient, err := NewClient(config)\n\n\tif err != nil {\n\t\tt.Fatalf(\"Failed: %s\", err)\n\t}\n\n\t// Test surge of requests these should all use the same key\n\tresult := testConcurrency(client, 0, 100, t)\n\tif len(result) > 1 {\n\t\tt.Fatalf(\"Concurrency Test 1 Failed: got %d, want 1\\n\", len(result))\n\t}\n\n\t// Test renewals\n\tresult = testConcurrency(client, 1000, 10, t)\n\tif len(result) != 10 {\n\t\tt.Fatalf(\"Concurrency Test 2 Failed: got %d, want 10\\n\", len(result))\n\t}\n}", "func Provider() terraform.ResourceProvider {\n\treturn &schema.Provider{\n\t\tSchema: map[string]*schema.Schema{\n\t\t\t\"credentials\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tDefaultFunc: schema.MultiEnvDefaultFunc([]string{\n\t\t\t\t\t\"GOOGLE_CREDENTIALS\",\n\t\t\t\t\t\"GOOGLE_CLOUD_KEYFILE_JSON\",\n\t\t\t\t\t\"GCLOUD_KEYFILE_JSON\",\n\t\t\t\t}, nil),\n\t\t\t\tValidateFunc: validateCredentials,\n\t\t\t},\n\n\t\t\t\"access_token\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tDefaultFunc: schema.MultiEnvDefaultFunc([]string{\n\t\t\t\t\t\"GOOGLE_OAUTH_ACCESS_TOKEN\",\n\t\t\t\t}, nil),\n\t\t\t\tConflictsWith: []string{\"credentials\"},\n\t\t\t},\n\n\t\t\t\"project\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tDefaultFunc: schema.MultiEnvDefaultFunc([]string{\n\t\t\t\t\t\"GOOGLE_PROJECT\",\n\t\t\t\t\t\"GOOGLE_CLOUD_PROJECT\",\n\t\t\t\t\t\"GCLOUD_PROJECT\",\n\t\t\t\t\t\"CLOUDSDK_CORE_PROJECT\",\n\t\t\t\t}, nil),\n\t\t\t},\n\n\t\t\t\"region\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tDefaultFunc: schema.MultiEnvDefaultFunc([]string{\n\t\t\t\t\t\"GOOGLE_REGION\",\n\t\t\t\t\t\"GCLOUD_REGION\",\n\t\t\t\t\t\"CLOUDSDK_COMPUTE_REGION\",\n\t\t\t\t}, nil),\n\t\t\t},\n\n\t\t\t\"zone\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tDefaultFunc: schema.MultiEnvDefaultFunc([]string{\n\t\t\t\t\t\"GOOGLE_ZONE\",\n\t\t\t\t\t\"GCLOUD_ZONE\",\n\t\t\t\t\t\"CLOUDSDK_COMPUTE_ZONE\",\n\t\t\t\t}, nil),\n\t\t\t},\n\t\t\t\"scopes\": {\n\t\t\t\tType: schema.TypeList,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Schema{Type: schema.TypeString},\n\t\t\t},\n\t\t},\n\n\t\tDataSourcesMap: map[string]*schema.Resource{\n\t\t\t\"google_active_folder\": dataSourceGoogleActiveFolder(),\n\t\t\t\"google_billing_account\": dataSourceGoogleBillingAccount(),\n\t\t\t\"google_dns_managed_zone\": dataSourceDnsManagedZone(),\n\t\t\t\"google_client_config\": dataSourceGoogleClientConfig(),\n\t\t\t\"google_cloudfunctions_function\": dataSourceGoogleCloudFunctionsFunction(),\n\t\t\t\"google_compute_address\": dataSourceGoogleComputeAddress(),\n\t\t\t\"google_compute_backend_service\": dataSourceGoogleComputeBackendService(),\n\t\t\t\"google_compute_default_service_account\": dataSourceGoogleComputeDefaultServiceAccount(),\n\t\t\t\"google_compute_forwarding_rule\": dataSourceGoogleComputeForwardingRule(),\n\t\t\t\"google_compute_image\": dataSourceGoogleComputeImage(),\n\t\t\t\"google_compute_instance\": dataSourceGoogleComputeInstance(),\n\t\t\t\"google_compute_global_address\": dataSourceGoogleComputeGlobalAddress(),\n\t\t\t\"google_compute_instance_group\": dataSourceGoogleComputeInstanceGroup(),\n\t\t\t\"google_compute_lb_ip_ranges\": dataSourceGoogleComputeLbIpRanges(),\n\t\t\t\"google_compute_network\": dataSourceGoogleComputeNetwork(),\n\t\t\t\"google_compute_regions\": dataSourceGoogleComputeRegions(),\n\t\t\t\"google_compute_region_instance_group\": dataSourceGoogleComputeRegionInstanceGroup(),\n\t\t\t\"google_compute_subnetwork\": dataSourceGoogleComputeSubnetwork(),\n\t\t\t\"google_compute_zones\": dataSourceGoogleComputeZones(),\n\t\t\t\"google_compute_vpn_gateway\": dataSourceGoogleComputeVpnGateway(),\n\t\t\t\"google_compute_ssl_policy\": dataSourceGoogleComputeSslPolicy(),\n\t\t\t\"google_container_cluster\": dataSourceGoogleContainerCluster(),\n\t\t\t\"google_container_engine_versions\": dataSourceGoogleContainerEngineVersions(),\n\t\t\t\"google_container_registry_repository\": dataSourceGoogleContainerRepo(),\n\t\t\t\"google_container_registry_image\": dataSourceGoogleContainerImage(),\n\t\t\t\"google_iam_policy\": dataSourceGoogleIamPolicy(),\n\t\t\t\"google_iam_role\": dataSourceGoogleIamRole(),\n\t\t\t\"google_kms_secret\": dataSourceGoogleKmsSecret(),\n\t\t\t\"google_kms_key_ring\": dataSourceGoogleKmsKeyRing(),\n\t\t\t\"google_kms_crypto_key\": dataSourceGoogleKmsCryptoKey(),\n\t\t\t\"google_folder\": dataSourceGoogleFolder(),\n\t\t\t\"google_netblock_ip_ranges\": dataSourceGoogleNetblockIpRanges(),\n\t\t\t\"google_organization\": dataSourceGoogleOrganization(),\n\t\t\t\"google_project\": dataSourceGoogleProject(),\n\t\t\t\"google_project_services\": dataSourceGoogleProjectServices(),\n\t\t\t\"google_service_account\": dataSourceGoogleServiceAccount(),\n\t\t\t\"google_service_account_key\": dataSourceGoogleServiceAccountKey(),\n\t\t\t\"google_storage_bucket_object\": dataSourceGoogleStorageBucketObject(),\n\t\t\t\"google_storage_object_signed_url\": dataSourceGoogleSignedUrl(),\n\t\t\t\"google_storage_project_service_account\": dataSourceGoogleStorageProjectServiceAccount(),\n\t\t\t\"google_storage_transfer_project_service_account\": dataSourceGoogleStorageTransferProjectServiceAccount(),\n\t\t},\n\n\t\tResourcesMap: ResourceMap(),\n\n\t\tConfigureFunc: providerConfigure,\n\t}\n}", "func (gts *GithubTokenSource) Token() (*oauth2.Token, error) {\n\treturn &oauth2.Token{AccessToken: gts.PersonalToken}, nil\n}", "func preConfigureCallback(vars resource.PropertyMap, c tfshim.ResourceConfig) error {\n\n\tenvName := stringValue(vars, \"environment\", []string{\"ARM_ENVIRONMENT\"})\n\tif envName == \"\" {\n\t\tenvName = \"public\"\n\t}\n\n\tenv, err := environments.FromName(envName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read Azure environment \\\"%s\\\": %v\", envName, err)\n\t}\n\n\tauthConfig := auth.Credentials{\n\t\tEnvironment: *env,\n\t\tEnableAuthenticatingUsingClientSecret: true,\n\t\tEnableAuthenticatingUsingAzureCLI: true,\n\t\tTenantID: stringValue(vars, \"tenantId\", []string{\"ARM_TENANT_ID\"}),\n\t\tClientID: stringValue(vars, \"clientId\", []string{\"ARM_CLIENT_ID\"}),\n\t\tClientSecret: stringValue(vars, \"clientSecret\", []string{\"ARM_CLIENT_SECRET\"}),\n\n\t\tEnableAuthenticatingUsingClientCertificate: true,\n\t\t// We don't handle ClientCertData yet, which is the actual base-64 encoded cert in config\n\t\tClientCertificatePassword: stringValue(vars, \"clientCertificatePassword\", []string{\"ARM_CLIENT_CERTIFICATE_PASSWORD\"}),\n\t\tClientCertificatePath: stringValue(vars, \"clientCertificatePath\", []string{\"ARM_CLIENT_CERTIFICATE_PATH\"}),\n\n\t\tEnableAuthenticatingUsingManagedIdentity: boolValue(vars, \"msiEndpoint\", []string{\"ARM_USE_MSI\"}),\n\t\tCustomManagedIdentityEndpoint: stringValue(vars, \"msiEndpoint\", []string{\"ARM_MSI_ENDPOINT\"}),\n\n\t\t// The configuration below would enable OIDC auth which we haven't tested and documented yet.\n\t\t//FederatedAssertion: idToken,\n\t\t//IDTokenRequestURL: d.Get(\"oidc_request_url\").(string),\n\t\t//IDTokenRequestToken: d.Get(\"oidc_request_token\").(string),\n\t\t//EnableClientFederatedAuth: d.Get(\"use_oidc\").(bool),\n\t\t//EnableGitHubOIDCAuth: d.Get(\"use_oidc\").(bool),\n\t}\n\n\t_, err = auth.NewAuthorizerFromCredentials(context.Background(), authConfig, env.MicrosoftGraph)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to load Azure credentials.\\n\"+\n\t\t\t\"Details: %v\\n\\n\"+\n\t\t\t\"\\tPlease make sure you have signed in via 'az login' or configured another authentication method.\\n\\n\"+\n\t\t\t\"\\tSee https://www.pulumi.com/registry/packages/azuread/installation-configuration/ for more information.\", err)\n\t}\n\n\treturn nil\n}", "func (s *storageTokenSource) Token() (*oauth2.Token, error) {\n\tif token, err := s.Config.Storage.GetToken(); err == nil && token.Valid() {\n\t\treturn token, err\n\t}\n\ttoken, err := s.TokenSource.Token()\n\tif err != nil {\n\t\treturn token, err\n\t}\n\tif err := s.Config.Storage.SetToken(token); err != nil {\n\t\treturn nil, err\n\t}\n\treturn token, nil\n}", "func initClientContext(c *GSSAPIContext, service string, inputToken []byte) error {\n\tc.ServiceName = service\n\n\tvar _inputToken *gssapi.Buffer\n\tvar err error\n\tif inputToken == nil {\n\t\t_inputToken = c.GSS_C_NO_BUFFER\n\t} else {\n\t\t_inputToken, err = c.MakeBufferBytes(inputToken)\n\t\tdefer _inputToken.Release()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tpreparedName := prepareServiceName(c)\n\tdefer preparedName.Release()\n\n\tcontextId, _, token, outputRetFlags, _, err := c.InitSecContext(\n\t\tnil,\n\t\tc.contextId,\n\t\tpreparedName,\n\t\tc.GSS_MECH_KRB5,\n\t\tc.reqFlags,\n\t\t0,\n\t\tc.GSS_C_NO_CHANNEL_BINDINGS,\n\t\t_inputToken)\n\tdefer token.Release()\n\n\tc.token = token.Bytes()\n\tc.contextId = contextId\n\tc.availFlags = outputRetFlags\n\treturn nil\n}", "func (idx *Unique) Init() error {\n\ttokenManager, err := jwt.New(map[string]interface{}{\n\t\t\"secret\": idx.cs3conf.JWTSecret,\n\t})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tidx.tokenManager = tokenManager\n\n\tclient, err := pool.GetStorageProviderServiceClient(idx.cs3conf.ProviderAddr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tidx.storageProvider = client\n\n\tctx := context.Background()\n\ttk, err := idx.authenticate(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tctx = metadata.AppendToOutgoingContext(ctx, revactx.TokenHeader, tk)\n\n\tif err := idx.makeDirIfNotExists(ctx, idx.indexBaseDir); err != nil {\n\t\treturn err\n\t}\n\n\tif err := idx.makeDirIfNotExists(ctx, idx.indexRootDir); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func getOauthClient(token string) (*github.Client, context.Context) {\n\toauthToken := &oauth2.Token{\n\t\tAccessToken: token,\n\t}\n\tctx := context.Background()\n\tts := oauth2.StaticTokenSource(oauthToken)\n\ttc := oauth2.NewClient(ctx, ts)\n\tghClient := github.NewClient(tc)\n\treturn ghClient, ctx\n}", "func initConfig() {\n\ttoken := rootCmd.Flag(\"token\").Value.String()\n\tgiturl := rootCmd.Flag(\"giturl\").Value.String()\n\tGitClient = gitlab.NewClient(nil, token)\n\tGitClient.SetBaseURL(giturl + \"/api/v4/\")\n}", "func Initialize(config *viper.Viper) (tokenConfig *Config, err error) {\n\ttokenConfig = &Config{PlatformName: config.GetString(\"PlatformName\")}\n\n\tbytes, err := getKey(config, \"Public\")\n\tif err != nil {\n\t\treturn\n\t}\n\ttokenConfig.PublicKey, err = crypto.ParseRSAPublicKeyFromPEM(bytes)\n\tif err != nil {\n\t\treturn\n\t}\n\tbytes, err = getKey(config, \"Private\")\n\tif err != nil {\n\t\treturn\n\t}\n\ttokenConfig.PrivateKey, err = crypto.ParseRSAPrivateKeyFromPEM(bytes)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func fetchToken(settings *Settings, taskSettings *TaskSettings) *oauth2.Token {\n\ttoken, err := LookupCache(settings)\n\ttokenExpired := isTokenExpired(token)\n\tif token == nil || tokenExpired {\n\t\tif taskSettings.AuthType == \"sso\" {\n\t\t\ttoken, err = SSOFetch(taskSettings.SsoCli, settings.Email, settings.Scope)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t} else {\n\t\t\tfetchSettings := settings\n\t\t\tif tokenExpired && taskSettings.Refresh {\n\t\t\t\t// If creds cannot be retrieved here, which is unexpected, we will ignore\n\t\t\t\t// the error and let FetchToken return a standardized error message\n\t\t\t\t// in the subsequent step.\n\t\t\t\tcreds, _ := FindJSONCredentials(context.Background(), settings)\n\t\t\t\trefreshTokenJSON := BuildRefreshTokenJSON(token.RefreshToken, creds)\n\t\t\t\tif refreshTokenJSON != \"\" {\n\t\t\t\t\trefreshSettings := *settings // Make a shallow copy\n\t\t\t\t\trefreshSettings.CredentialsJSON = refreshTokenJSON\n\t\t\t\t\tfetchSettings = &refreshSettings\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken, err = FetchToken(context.Background(), fetchSettings)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tif settings.ServiceAccount != \"\" {\n\t\t\ttoken, err = GenerateServiceAccountAccessToken(token.AccessToken, settings.ServiceAccount, settings.Scope)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tif settings.Sts {\n\t\t\ttoken, err = StsExchange(token.AccessToken, EncodeClaims(settings))\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\terr = InsertCache(settings, token)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn token\n}", "func (t *TokenSource) Token() (*oauth2.Token, error) {\n\ttoken, err := t.TokenGenerator.GetWithSTS(context.Background(), t.ClusterID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error generating token: %w\", err)\n\t}\n\treturn &oauth2.Token{\n\t\tAccessToken: token.Token,\n\t\tExpiry: token.Expiration.Add(-t.Leeway),\n\t}, nil\n}", "func init() {\n RootCmd.AddCommand(RefreshTokenCmd)\n}", "func ClientConfigurer(d *schema.ResourceData) (interface{}, error) {\n\t// req, err := http.NewRequest(\"POST\", d.Get(\"auth_server\").(string), nil)\n\t// if err != nil {\n\t// \treturn nil, err\n\t// }\n\t// req.SetBasicAuth(\"SpotifyAuthProxy\", d.Get(\"api_key\").(string))\n\t// resp, err := http.DefaultClient.Do(req)\n\t// if err != nil {\n\t// \treturn nil, err\n\t// }\n\t// defer resp.Body.Close()\n\t// body, err := ioutil.ReadAll(resp.Body)\n\t// if err != nil {\n\t// \treturn nil, err\n\t// }\n\t// if resp.StatusCode != http.StatusOK {\n\t// \treturn nil, fmt.Errorf(\"%s\", string(body))\n\t// }\n\n\t// tokenData := struct {\n\t// \tAccessToken string `json:\"access_token\"`\n\t// \tRefreshToken string `json:\"refresh_token\"`\n\t// \tExpiresIn int `json:\"expires_in\"`\n\t// \tTokenType string `json:\"token_type\"`\n\t// }{}\n\n\t// if err := json.Unmarshal(body, &tokenData); err != nil {\n\t// \treturn nil, err\n\t// }\n\n\t// token := &oauth2.Token{\n\t// \tAccessToken: tokenData.AccessToken,\n\t// \tRefreshToken: tokenData.RefreshToken,\n\t// \tTokenType: tokenData.TokenType,\n\t// \tExpiry: time.Now().Add(time.Duration(tokenData.ExpiresIn) * time.Second),\n\t// }\n\n\t// cnf := &oauth2.Config{\n\t// \t// ClientID: d.Get(\"client_id\").(string),\n\t// \tClientID: \"SpotifyAuthProxy\",\n\t// \tClientSecret: d.Get(\"api_key\").(string),\n\t// \tEndpoint: oauth2.Endpoint{\n\t// \t\tTokenURL: d.Get(\"auth_server\").(string),\n\t// \t\tAuthStyle: oauth2.AuthStyleInHeader,\n\t// \t},\n\t// }\n\n\ttransport := &transport{\n\t\tAPIKey: d.Get(\"api_key\").(string),\n\t\tServer: d.Get(\"auth_server\").(string),\n\t}\n\ttransport.getToken()\n\n\tclient := spotify.NewClient(&http.Client{\n\t\tTransport: transport,\n\t})\n\treturn &client, nil\n}", "func getArmClient(authCfg *authentication.Config, tfVersion string, skipProviderRegistration bool) (*ArmClient, error) {\n\tenv, err := authentication.LoadEnvironmentFromUrl(authCfg.CustomResourceManagerEndpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// client declarations:\n\tclient := ArmClient{\n\t\tclientId: authCfg.ClientID,\n\t\ttenantId: authCfg.TenantID,\n\t\tsubscriptionId: authCfg.SubscriptionID,\n\t\tterraformVersion: tfVersion,\n\t\tenvironment: *env,\n\t\tusingServicePrincipal: authCfg.AuthenticatedAsAServicePrincipal,\n\t\tskipProviderRegistration: skipProviderRegistration,\n\t}\n\n\toauth, err := authCfg.BuildOAuthConfig(env.ActiveDirectoryEndpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsender := sender.BuildSender(\"AzureStack\")\n\n\t// Resource Manager endpoints\n\tendpoint := env.ResourceManagerEndpoint\n\n\t// Instead of the same endpoint use token audience to get the correct token.\n\tauth, err := authCfg.GetAuthorizationToken(sender, oauth, env.TokenAudience)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Graph Endpoints\n\tgraphEndpoint := env.GraphEndpoint\n\tgraphAuth, err := authCfg.GetAuthorizationToken(sender, oauth, graphEndpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient.registerAuthentication(graphEndpoint, client.tenantId, graphAuth, sender)\n\tclient.registerComputeClients(endpoint, client.subscriptionId, auth)\n\tclient.registerDNSClients(endpoint, client.subscriptionId, auth)\n\tclient.registerNetworkingClients(endpoint, client.subscriptionId, auth)\n\tclient.registerResourcesClients(endpoint, client.subscriptionId, auth)\n\tclient.registerStorageClients(endpoint, client.subscriptionId, auth)\n\n\treturn &client, nil\n}", "func mustProviderClient() *gophercloud.ProviderClient {\n\topt, err := openstack.AuthOptionsFromEnv()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tprovider, err := openstack.AuthenticatedClient(opt)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tprovider.ReauthFunc = func() error {\n\t\topt, err := openstack.AuthOptionsFromEnv()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tnewprov, err := openstack.AuthenticatedClient(opt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tprovider.CopyTokenFrom(newprov)\n\t\treturn nil\n\t}\n\treturn provider\n}", "func (gr *Reconciler) Init() {\n\tkm := k8s.NewRsrcManager().WithName(\"basek8s\").WithClient(gr.Manager.GetClient()).WithScheme(gr.Manager.GetScheme())\n\tgr.RsrcMgr.Add(k8s.Type, km)\n\tapp.AddToScheme(&AddToSchemes)\n\tAddToSchemes.AddToScheme(gr.Manager.GetScheme())\n}", "func (t *Handler) Init() error {\n\tlog.Info(\"TeamHandler.Init\")\n\tvar err error\n\tt.clientset, err = authorization.CreateClientSet()\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\tpanic(err.Error())\n\t}\n\tt.edgenetClientset, err = authorization.CreateEdgeNetClientSet()\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\tpanic(err.Error())\n\t}\n\tt.resourceQuota = &corev1.ResourceQuota{}\n\tt.resourceQuota.Name = \"team-quota\"\n\tt.resourceQuota.Spec = corev1.ResourceQuotaSpec{\n\t\tHard: map[corev1.ResourceName]resource.Quantity{\n\t\t\t\"cpu\": resource.MustParse(\"5m\"),\n\t\t\t\"memory\": resource.MustParse(\"1Mi\"),\n\t\t\t\"requests.storage\": resource.MustParse(\"1Mi\"),\n\t\t\t\"pods\": resource.Quantity{Format: \"0\"},\n\t\t\t\"count/persistentvolumeclaims\": resource.Quantity{Format: \"0\"},\n\t\t\t\"count/services\": resource.Quantity{Format: \"0\"},\n\t\t\t\"count/configmaps\": resource.Quantity{Format: \"0\"},\n\t\t\t\"count/replicationcontrollers\": resource.Quantity{Format: \"0\"},\n\t\t\t\"count/deployments.apps\": resource.Quantity{Format: \"0\"},\n\t\t\t\"count/deployments.extensions\": resource.Quantity{Format: \"0\"},\n\t\t\t\"count/replicasets.apps\": resource.Quantity{Format: \"0\"},\n\t\t\t\"count/replicasets.extensions\": resource.Quantity{Format: \"0\"},\n\t\t\t\"count/statefulsets.apps\": resource.Quantity{Format: \"0\"},\n\t\t\t\"count/statefulsets.extensions\": resource.Quantity{Format: \"0\"},\n\t\t\t\"count/jobs.batch\": resource.Quantity{Format: \"0\"},\n\t\t\t\"count/cronjobs.batch\": resource.Quantity{Format: \"0\"},\n\t\t},\n\t}\n\treturn err\n}", "func newJWTBase(ctx context.Context, cfg Config) (string, error) {\n\tserviceAccount, project, tokenSource, err := getServiceAccountInfo(ctx, cfg)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"unable to get service account from environment\")\n\t}\n\n\tpayload, err := json.Marshal(map[string]interface{}{\n\t\t\"aud\": \"vault/\" + cfg.Role,\n\t\t\"sub\": serviceAccount,\n\t\t\"exp\": time.Now().UTC().Add(5 * time.Minute).Unix(),\n\t})\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"unable to encode JWT payload\")\n\t}\n\n\thc := getHTTPClient(ctx, cfg)\n\t// reuse base transport and timeout but sprinkle on the token source for IAM access\n\thcIAM := &http.Client{\n\t\tTimeout: hc.Timeout,\n\t\tTransport: &oauth2.Transport{\n\t\t\tSource: tokenSource,\n\t\t\tBase: hc.Transport,\n\t\t},\n\t}\n\tiamClient, err := iam.New(hcIAM)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"unable to init IAM client\")\n\t}\n\n\tif cfg.IAMAddress != \"\" {\n\t\tiamClient.BasePath = cfg.IAMAddress\n\t}\n\n\tresp, err := iamClient.Projects.ServiceAccounts.SignJwt(\n\t\tfmt.Sprintf(\"projects/%s/serviceAccounts/%s\",\n\t\t\tproject, serviceAccount),\n\t\t&iam.SignJwtRequest{Payload: string(payload)}).Context(ctx).Do()\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"unable to sign JWT\")\n\t}\n\treturn resp.SignedJwt, nil\n}", "func newV1TokenAuthenticator(serverURL string, clientCert, clientKey, ca []byte, cacheTime time.Duration, implicitAuds authenticator.Audiences, metrics AuthenticatorMetrics) (authenticator.Token, error) {\n\ttempfile, err := ioutil.TempFile(\"\", \"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp := tempfile.Name()\n\tdefer os.Remove(p)\n\tconfig := v1.Config{\n\t\tClusters: []v1.NamedCluster{\n\t\t\t{\n\t\t\t\tCluster: v1.Cluster{Server: serverURL, CertificateAuthorityData: ca},\n\t\t\t},\n\t\t},\n\t\tAuthInfos: []v1.NamedAuthInfo{\n\t\t\t{\n\t\t\t\tAuthInfo: v1.AuthInfo{ClientCertificateData: clientCert, ClientKeyData: clientKey},\n\t\t\t},\n\t\t},\n\t}\n\tif err := json.NewEncoder(tempfile).Encode(config); err != nil {\n\t\treturn nil, err\n\t}\n\n\tclientConfig, err := webhookutil.LoadKubeconfig(p, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc, err := tokenReviewInterfaceFromConfig(clientConfig, \"v1\", testRetryBackoff)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tauthn, err := newWithBackoff(c, testRetryBackoff, implicitAuds, 10*time.Second, metrics)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn cache.New(authn, false, cacheTime, cacheTime), nil\n}", "func (t *tokenSource) Token() (*oauth2.Token, error) {\n\treturn t.token, nil\n}", "func (t *tokenSource) Token() (*oauth2.Token, error) {\n\treturn t.token, nil\n}", "func (ap *Provider) updateToken(client clients.AzureClient, token *v3.Token) error {\n\t// For the new flow via Microsoft Graph, the caching and updating of the token to the Microsoft Graph API\n\t// is handled separately via the SDK client cache.\n\tcfg, err := ap.GetAzureConfigK8s()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !IsConfigDeprecated(cfg) {\n\t\treturn nil\n\t}\n\n\tcurrent, err := client.MarshalTokenJSON()\n\tif err != nil {\n\t\treturn errors.New(\"failed to unmarshal token\")\n\t}\n\n\tsecret, err := ap.tokenMGR.GetSecret(token.UserID, token.AuthProvider, []*v3.Token{token})\n\tif err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\t// providerToken doesn't exist as a secret, update on token.\n\t\t\tif current, ok := token.ProviderInfo[\"access_token\"]; ok && current != current {\n\t\t\t\ttoken.ProviderInfo[\"access_token\"] = current\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\tif current == secret {\n\t\treturn nil\n\t}\n\n\treturn ap.tokenMGR.UpdateSecret(token.UserID, token.AuthProvider, current)\n}", "func (s *StoreNotifyingSource) Token() (*oauth2.Token, error) {\n\tt, err := s.src.Token()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = s.store.Save(t)\n\treturn t, err\n}", "func getClient(config *oauth2.Config) *http.Client {\r\n\t// The file token.json stores the user's access and refresh tokens, and is\r\n\t// created automatically when the authorization flow completes for the first\r\n\t// time.\r\n\ttokFile := path.Join(secretDir, \"token.json\")\r\n\ttok, err := tokenFromFile(tokFile)\r\n\tif err != nil {\r\n\t\ttok = getTokenFromWeb(config)\r\n\t\t// saveToken(tokFile, tok)\r\n\t}\r\n\treturn config.Client(context.Background(), tok)\r\n}", "func (c *Client) Token(ctx context.Context, opts *tokenOptions) (*logical.Response, error) {\n\t// Marshal a request body only if there are any user-specified GitHub App\n\t// token constraints.\n\tvar body io.ReadWriter\n\tif opts != nil {\n\t\tbody = new(bytes.Buffer)\n\t\tif err := json.NewEncoder(body).Encode(opts); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Build the token request.\n\treq, err := http.NewRequestWithContext(ctx, http.MethodPost, c.url.String(), body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: %v\", errUnableToBuildAccessTokenReq, err)\n\t}\n\n\treq.Header.Set(\"User-Agent\", projectName)\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\n\t// Perform the request, re-using the shared transport.\n\tres, err := c.transport.RoundTrip(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: RoundTrip error: %v\", errUnableToCreateAccessToken, err)\n\t}\n\n\tdefer res.Body.Close()\n\n\tif statusCode(res.StatusCode).Unsuccessful() {\n\t\tbodyBytes, err := ioutil.ReadAll(res.Body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%w: %s: error reading error response body: %v\",\n\t\t\t\terrUnableToCreateAccessToken, res.Status, err)\n\t\t}\n\n\t\tbodyErr := fmt.Errorf(\"%w: %v\", errBody, string(bodyBytes))\n\n\t\treturn nil, fmt.Errorf(\"%w: %s: %v\", errUnableToCreateAccessToken,\n\t\t\tres.Status, bodyErr)\n\t}\n\n\tvar resData map[string]interface{}\n\tif err := json.NewDecoder(res.Body).Decode(&resData); err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: %v\", errUnableToDecodeAccessTokenRes, err)\n\t}\n\n\ttokenRes := &logical.Response{Data: resData}\n\n\t// As per the issue request in https://git.io/JUhRk, return a Vault \"lease\"\n\t// aligned to the GitHub token's `expires_at` field.\n\tif expiresAt, ok := resData[\"expires_at\"]; ok {\n\t\tif expiresAtStr, ok := expiresAt.(string); ok {\n\t\t\tif expiresAtTime, err := time.Parse(time.RFC3339, expiresAtStr); err == nil {\n\t\t\t\ttokenRes.Secret = &logical.Secret{\n\t\t\t\t\tInternalData: map[string]interface{}{\"secret_type\": backendSecretType},\n\t\t\t\t\tLeaseOptions: logical.LeaseOptions{\n\t\t\t\t\t\tTTL: time.Until(expiresAtTime),\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn tokenRes, nil\n}", "func (m *Manager) RefreshAccessToken(tgr *oauth2.TokenGenerateRequest) (accessToken oauth2.TokenInfo, err error) {\n\tcli, err := m.GetClient(tgr.ClientID)\n\tif err != nil {\n\t\treturn\n\t} else if tgr.ClientSecret != cli.GetSecret() {\n\t\terr = errors.ErrInvalidClient\n\t\treturn\n\t}\n\tti, err := m.LoadRefreshToken(tgr.Refresh)\n\tif err != nil {\n\t\treturn\n\t} else if ti.GetClientID() != tgr.ClientID {\n\t\terr = errors.ErrInvalidRefreshToken\n\t\treturn\n\t}\n\toldAccess := ti.GetAccess()\n\t_, ierr := m.injector.Invoke(func(stor oauth2.TokenStore, gen oauth2.AccessGenerate) {\n\t\ttd := &oauth2.GenerateBasic{\n\t\t\tClient: cli,\n\t\t\tUserID: ti.GetUserID(),\n\t\t\tCreateAt: time.Now(),\n\t\t}\n\t\tisGenRefresh := false\n\t\tif rcfg, ok := m.gtcfg[oauth2.Refreshing]; ok {\n\t\t\tisGenRefresh = rcfg.IsGenerateRefresh\n\t\t}\n\t\ttv, rv, terr := gen.Token(td, isGenRefresh)\n\t\tif terr != nil {\n\t\t\terr = terr\n\t\t\treturn\n\t\t}\n\t\tti.SetAccess(tv)\n\t\tti.SetAccessCreateAt(td.CreateAt)\n\t\tif scope := tgr.Scope; scope != \"\" {\n\t\t\tti.SetScope(scope)\n\t\t}\n\t\tif rv != \"\" {\n\t\t\tti.SetRefresh(rv)\n\t\t}\n\t\tif verr := stor.Create(ti); verr != nil {\n\t\t\terr = verr\n\t\t\treturn\n\t\t}\n\t\t// remove the old access token\n\t\tif verr := stor.RemoveByAccess(oldAccess); verr != nil {\n\t\t\terr = verr\n\t\t\treturn\n\t\t}\n\t\taccessToken = ti\n\t})\n\tif ierr != nil && err == nil {\n\t\terr = ierr\n\t}\n\treturn\n}", "func defConfig() Config {\n\treturn Config{\n\t\tAPI: api{\n\t\t\tServiceName: \"token-svc\",\n\t\t\tMetricsPort: \"4001\",\n\t\t\tPort: \"4000\",\n\t\t\tShutdownTimeoutSecs: 120,\n\t\t\tIdleTimeOutSecs: 90,\n\t\t\tWriteTimeOutSecs: 30,\n\t\t\tReadTimeOutSecs: 5,\n\t\t\tTimeoutSecs: 30,\n\t\t\tAllowedHeaders: []string{\"X-Requested-With\", \"X-Request-ID\", \"jaeger-debug-id\", \"Content-Type\", \"Authorization\"},\n\t\t\tAllowedOrigins: []string{\"*\"},\n\t\t\tAllowedMethods: []string{\"GET\", \"HEAD\", \"POST\", \"PUT\", \"OPTIONS\", \"DELETE\"},\n\t\t\tOpenEndPoints: []string{\"/login\", \"/health/ping\", \"/register\"},\n\t\t},\n\t\tLogger: logger{\n\t\t\tLevel: \"debug\",\n\t\t\tEncoding: \"json\",\n\t\t\tOutputPaths: []string{\"stdout\", \"/tmp/logs/tokensvc.logs\"},\n\t\t\tErrorOutputPaths: []string{\"stderr\"},\n\t\t},\n\t\tDB: db{\n\t\t\tUser: \"postgres\",\n\t\t\tPass: \"postgres\",\n\t\t\tHost: \"postgres\",\n\t\t\tPort: \"5432\",\n\t\t\tName: \"postgres\",\n\t\t\tTimeout: \"30\",\n\t\t},\n\t\tToken: token{\n\t\t\tAccessTokenLifeSpanMins: 30, // half hour\n\t\t\tRefreshTokenLifeSpanMins: 10080, // 1 week\n\t\t\tFailedLoginAttemptCacheLifeSpanMins: 30,\n\t\t\tFailedLoginAttemptsMax: 5,\n\t\t\tAuthPrivateKeyPath: \"/tmp/certs/app.rsa\", // TODO: Let's read these in from Vault\n\t\t\tAuthPublicKeyPath: \"/tmp/certs/app.rsa.pub\",\n\t\t\tIssuer: \"homerow.tech\",\n\t\t\tAccessCacheKeyID: \"token-access-user\",\n\t\t\tRefreshCacheKeyID: \"token-refresh-user\",\n\t\t\tFailedLoginCacheKeyID: \"failed-login-user\",\n\t\t},\n\t\tCookie: cookie{\n\t\t\tLifeSpanDays: 7,\n\t\t\tHashKey: \"something-that-is-32-byte-secret\",\n\t\t\tBlockKey: \"something-else-16-24-or-32secret\",\n\t\t\tName: \"homerow.tech\",\n\t\t\tDomain: \"dev.homerow.tech\",\n\t\t\tKeyUserID: \"id\",\n\t\t\tKeyEmail: \"email\",\n\t\t\tKeyJWTAccessID: \"jti-access\",\n\t\t\tKeyJWTRefreshID: \"jti-refresh\",\n\t\t},\n\t\tCache: cache{\n\t\t\tHost: \"redis\",\n\t\t\tPort: \"6379\",\n\t\t\tUserAccountLockedLifeSpanMins: 60,\n\t\t\tUserAccountLockedKeyID: \"account-locked-user\",\n\t\t},\n\t}\n}", "func (i *InternalTokenHelper) populateTokenPath() {\n\ti.tokenPath = filepath.Join(i.homeDir, \".vault-token\")\n}", "func (K *KWAPI) refreshToken(username string, auth *KWAuth) (*KWAuth, error) {\n\tif auth == nil {\n\t\treturn nil, fmt.Errorf(\"No refresh token found for %s.\", username)\n\t}\n\tpath := fmt.Sprintf(\"https://%s/oauth/token\", K.Server)\n\n\treq, err := http.NewRequest(http.MethodPost, path, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thttp_header := make(http.Header)\n\thttp_header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\tif K.AgentString == NONE {\n\t\tK.AgentString = \"SnugLib/1.0\"\n\t}\n\thttp_header.Set(\"User-Agent\", K.AgentString)\n\n\treq.Header = http_header\n\n\tclient_id := K.ApplicationID\n\n\tpostform := &url.Values{\n\t\t\"client_id\": {client_id},\n\t\t\"client_secret\": {K.secrets.decrypt(K.secrets.client_secret_key)},\n\t\t\"grant_type\": {\"refresh_token\"},\n\t\t\"refresh_token\": {auth.RefreshToken},\n\t}\n\n\tif K.Snoop {\n\t\tStdout(\"\\n[kiteworks]: %s\\n--> ACTION: \\\"POST\\\" PATH: \\\"%s\\\"\", username, path)\n\t\tfor k, v := range *postform {\n\t\t\tif k == \"grant_type\" || k == \"RedirectURI\" || k == \"scope\" {\n\t\t\t\tStdout(\"\\\\-> POST PARAM: %s VALUE: %s\", k, v)\n\t\t\t} else {\n\t\t\t\tStdout(\"\\\\-> POST PARAM: %s VALUE: [HIDDEN]\", k)\n\t\t\t}\n\t\t}\n\t}\n\n\treq.Body = ioutil.NopCloser(bytes.NewReader([]byte(postform.Encode())))\n\n\tclient := K.Session(username).NewClient()\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := K.decodeJSON(resp, &auth); err != nil {\n\t\treturn nil, err\n\t}\n\n\tauth.Expires = auth.Expires + time.Now().Unix()\n\treturn auth, nil\n}", "func GToken() string {\n\treturn viper.GetString(\"google-safile\")\n}", "func (t *TokenSource) Token() (*oauth2.Token, error) {\n\treturn &oauth2.Token{\n\t\tAccessToken: t.AccessToken,\n\t}, nil\n}", "func (s *notifyRefreshTokenSource) Token() (*oauth2.Token, error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tif s.t.Valid() {\n\t\treturn s.t, nil\n\t}\n\tt, err := s.new.Token()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.t = t\n\treturn t, s.f(t)\n}", "func (g *GitHub) getToken(code, state string) error {\n\tif code == \"\" || state == \"\" {\n\t\tlog.ErrorWithFields(\"code or state is nil\", log.Fields{\"code\": code, \"state\": state})\n\t\treturn fmt.Errorf(\"code or state is nil\")\n\t}\n\tlog.InfoWithFields(\"cyclone receives auth code\", log.Fields{\"request code\": code})\n\n\t// Get a object to request token.\n\tconf, err := g.getConf()\n\tif err != nil {\n\t\tlog.Warnf(\"Unable to get the conf according coderepository\")\n\t\treturn err\n\t}\n\n\t// To communication with githubo or other vcs to get token.\n\tvar tok *oauth2.Token\n\ttok, err = conf.Exchange(oauth2.NoContext, code) // Post a token request and receive toeken.\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn err\n\t}\n\n\tif !tok.Valid() {\n\t\tlog.Fatalf(\"Token invalid. Got: %#v\", tok)\n\t\treturn err\n\t}\n\tlog.Info(\"get the token successfully!\")\n\n\t// Create service in database (but not ready to be used yet).\n\tvcstoken := api.VscToken{\n\t\tUserID: state,\n\t\tVsc: \"github\",\n\t\tVsctoken: *tok,\n\t}\n\n\tds := store.NewStore()\n\tdefer ds.Close()\n\n\t_, err = ds.FindtokenByUserID(state, \"github\")\n\tif err != nil {\n\t\terr = ds.NewTokenDocument(&vcstoken)\n\t\tif err != nil {\n\t\t\tlog.ErrorWithFields(\"NewTokenDocument\", log.Fields{\"user_id\": state,\n\t\t\t\t\"token\": tok, \"error\": err})\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\terr = ds.UpdateToken(&vcstoken)\n\t\tif err != nil {\n\t\t\tlog.ErrorWithFields(\"UpdateToken\", log.Fields{\"user_id\": state,\n\t\t\t\t\"token\": tok, \"error\": err})\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func ReuseTokenSource(t *Token, src TokenSource) TokenSource {\n\t// Don't wrap a reuseTokenSource in itself. That would work,\n\t// but cause an unnecessary number of mutex operations.\n\t// Just build the equivalent one.\n\tif rt, ok := src.(*reuseTokenSource); ok {\n\t\tif t == nil {\n\t\t\t// Just use it directly.\n\t\t\treturn rt\n\t\t}\n\t\tsrc = rt.new\n\t}\n\treturn &reuseTokenSource{\n\t\tt: t,\n\t\tnew: src,\n\t}\n}", "func (h *handler) initFromActionsEnv(ctx context.Context) {\n\ttoken := h.GetInput(\"repo_token\")\n\tif token == \"\" {\n\t\th.Fatalf(\"Empty repo_token\")\n\t}\n\th.Client = github.NewClient(oauth2.NewClient(ctx, oauth2.StaticTokenSource(\n\t\t&oauth2.Token{AccessToken: token},\n\t)))\n}", "func Initialize(ctx context.Context, global *Global) (err error) {\n\tlog.SetFlags(0)\n\tglobal.ctx = ctx\n\n\tvar instanceDeployment InstanceDeployment\n\tvar storageClient *storage.Client\n\n\tinitID := fmt.Sprintf(\"%v\", uuid.New())\n\terr = ffo.ReadUnmarshalYAML(solution.PathToFunctionCode+solution.SettingsFileName, &instanceDeployment)\n\tif err != nil {\n\t\tlog.Println(glo.Entry{\n\t\t\tSeverity: \"CRITICAL\",\n\t\t\tMessage: \"init_failed\",\n\t\t\tDescription: fmt.Sprintf(\"ReadUnmarshalYAML %s %v\", solution.SettingsFileName, err),\n\t\t\tInitID: initID,\n\t\t})\n\t\treturn err\n\t}\n\n\tglobal.environment = instanceDeployment.Core.EnvironmentName\n\tglobal.instanceName = instanceDeployment.Core.InstanceName\n\tglobal.microserviceName = instanceDeployment.Core.ServiceName\n\n\tlog.Println(glo.Entry{\n\t\tMicroserviceName: global.microserviceName,\n\t\tInstanceName: global.instanceName,\n\t\tEnvironment: global.environment,\n\t\tSeverity: \"NOTICE\",\n\t\tMessage: \"coldstart\",\n\t\tInitID: initID,\n\t})\n\n\tglobal.assetsCollectionID = instanceDeployment.Core.SolutionSettings.Hosting.FireStore.CollectionIDs.Assets\n\tglobal.ownerLabelKeyName = instanceDeployment.Core.SolutionSettings.Monitoring.LabelKeyNames.Owner\n\tglobal.retryTimeOutSeconds = instanceDeployment.Settings.Service.GCF.RetryTimeOutSeconds\n\tglobal.violationResolverLabelKeyName = instanceDeployment.Core.SolutionSettings.Monitoring.LabelKeyNames.ViolationResolver\n\tprojectID := instanceDeployment.Core.SolutionSettings.Hosting.ProjectID\n\n\tstorageClient, err = storage.NewClient(ctx)\n\tif err != nil {\n\t\tlog.Println(glo.Entry{\n\t\t\tMicroserviceName: global.microserviceName,\n\t\t\tInstanceName: global.instanceName,\n\t\t\tEnvironment: global.environment,\n\t\t\tSeverity: \"CRITICAL\",\n\t\t\tMessage: \"init_failed\",\n\t\t\tDescription: fmt.Sprintf(\"storage.NewClient(ctx) %v\", err),\n\t\t\tInitID: initID,\n\t\t})\n\t\treturn err\n\t}\n\t// bucketHandle must be evaluated after storateClient init\n\tglobal.bucketHandle = storageClient.Bucket(instanceDeployment.Core.SolutionSettings.Hosting.GCS.Buckets.AssetsJSONFile.Name)\n\n\tglobal.cloudresourcemanagerService, err = cloudresourcemanager.NewService(ctx)\n\tif err != nil {\n\t\tlog.Println(glo.Entry{\n\t\t\tMicroserviceName: global.microserviceName,\n\t\t\tInstanceName: global.instanceName,\n\t\t\tEnvironment: global.environment,\n\t\t\tSeverity: \"CRITICAL\",\n\t\t\tMessage: \"init_failed\",\n\t\t\tDescription: fmt.Sprintf(\"cloudresourcemanager.NewService(ctx) %v\", err),\n\t\t\tInitID: initID,\n\t\t})\n\t\treturn err\n\t}\n\tglobal.cloudresourcemanagerServiceV2, err = cloudresourcemanagerv2.NewService(ctx)\n\tif err != nil {\n\t\tlog.Println(glo.Entry{\n\t\t\tMicroserviceName: global.microserviceName,\n\t\t\tInstanceName: global.instanceName,\n\t\t\tEnvironment: global.environment,\n\t\t\tSeverity: \"CRITICAL\",\n\t\t\tMessage: \"init_failed\",\n\t\t\tDescription: fmt.Sprintf(\"cloudresourcemanagerv2.NewService(ctx) %v\", err),\n\t\t\tInitID: initID,\n\t\t})\n\t\treturn err\n\t}\n\tglobal.firestoreClient, err = firestore.NewClient(ctx, projectID)\n\tif err != nil {\n\t\tlog.Println(glo.Entry{\n\t\t\tMicroserviceName: global.microserviceName,\n\t\t\tInstanceName: global.instanceName,\n\t\t\tEnvironment: global.environment,\n\t\t\tSeverity: \"CRITICAL\",\n\t\t\tMessage: \"init_failed\",\n\t\t\tDescription: fmt.Sprintf(\"firestore.NewClient(ctx, projectID) %v\", err),\n\t\t\tInitID: initID,\n\t\t})\n\t\treturn err\n\t}\n\treturn nil\n}", "func init() {\n\n\tflag.StringVar(&Token, \"t\", \"\", \"Bot Token\")\n}", "func Initialize(client kubernetes.Interface, namespace, serviceAccount string, imagePullSecrets []string) error {\n\tvar kc authn.Keychain\n\tkcOpts := &k8schain.Options{\n\t\tNamespace: namespace,\n\t\tServiceAccountName: serviceAccount,\n\t\tImagePullSecrets: imagePullSecrets,\n\t}\n\n\tkc, err := k8schain.New(context.Background(), client, *kcOpts)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to initialize registry keychain\")\n\t}\n\n\tauthn.DefaultKeychain = kc\n\treturn nil\n}", "func (c *Easee) refresh() {\n\tfor range time.Tick(5 * time.Minute) {\n\t\tif _, err := c.Client.Transport.(*oauth2.Transport).Source.Token(); err != nil {\n\t\t\tc.log.ERROR.Println(\"token refresh:\", err)\n\t\t}\n\t}\n}", "func (c *Client) Token(token string) *Client {\n\tc.api.Set(\"Authorization\", \"Discogs token=\"+token)\n\treturn c\n}", "func (w TokenFileWriter) CreateMgmtTokenForConsulSecretsEngine(rootToken string) (map[string]interface{},\n\ttokencreatable.RevokeFunc, error) {\n\tconsulSecretsEngineOpsPolicyDocument := `\n# allow to configure the access information for Consul\npath \"` + secretsengine.ConsulSecretEngineMountPoint + `/config/access\" {\n capabilities = [\"create\", \"update\"]\n}\n\n# allow to create, update, read, list, or delete the Consul role definition\npath \"` + secretsengine.ConsulSecretEngineMountPoint + `/roles/*\" {\n capabilities = [\"create\", \"read\", \"update\", \"delete\", \"list\"]\n}\n`\n\n\tif err := w.secretClient.InstallPolicy(rootToken,\n\t\tconsulSecretsEngineOpsPolicyName,\n\t\tconsulSecretsEngineOpsPolicyDocument); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to install Consul secrets engine operations policy: %v\", err)\n\t}\n\n\t// setup new token's properties\n\ttokenParams := make(map[string]interface{})\n\ttokenParams[\"type\"] = \"service\"\n\t// Vault prefixes \"token\" in front of display_name\n\ttokenParams[\"display_name\"] = \"for Consul ACL bootstrap\"\n\ttokenParams[\"no_parent\"] = true\n\ttokenParams[\"period\"] = \"1h\"\n\ttokenParams[\"policies\"] = []string{consulSecretsEngineOpsPolicyName}\n\ttokenParams[\"meta\"] = map[string]interface{}{\n\t\t\"description\": \"Consul secrets engine management token\",\n\t}\n\tresponse, err := w.secretClient.CreateToken(rootToken, tokenParams)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to create token for Consul secrets engine operations: %v\", err)\n\t}\n\n\treturn response, nil, nil\n}", "func (c *TokensCommand) Initialize(app *kingpin.Application, config *servicecfg.Config) {\n\tc.config = config\n\n\ttokens := app.Command(\"tokens\", \"List or revoke invitation tokens\")\n\n\tformats := []string{teleport.Text, teleport.JSON, teleport.YAML}\n\n\t// tctl tokens add ...\"\n\tc.tokenAdd = tokens.Command(\"add\", \"Create a invitation token.\")\n\tc.tokenAdd.Flag(\"type\", \"Type(s) of token to add, e.g. --type=node,app,db,proxy,etc\").Required().StringVar(&c.tokenType)\n\tc.tokenAdd.Flag(\"value\", \"Override the default random generated token with a specified value\").StringVar(&c.value)\n\tc.tokenAdd.Flag(\"labels\", \"Set token labels, e.g. env=prod,region=us-west\").StringVar(&c.labels)\n\tc.tokenAdd.Flag(\"ttl\", fmt.Sprintf(\"Set expiration time for token, default is %v minutes\",\n\t\tint(defaults.ProvisioningTokenTTL/time.Minute))).\n\t\tDefault(fmt.Sprintf(\"%v\", defaults.ProvisioningTokenTTL)).\n\t\tDurationVar(&c.ttl)\n\tc.tokenAdd.Flag(\"app-name\", \"Name of the application to add\").Default(\"example-app\").StringVar(&c.appName)\n\tc.tokenAdd.Flag(\"app-uri\", \"URI of the application to add\").Default(\"http://localhost:8080\").StringVar(&c.appURI)\n\tc.tokenAdd.Flag(\"db-name\", \"Name of the database to add\").StringVar(&c.dbName)\n\tc.tokenAdd.Flag(\"db-protocol\", fmt.Sprintf(\"Database protocol to use. Supported are: %v\", defaults.DatabaseProtocols)).StringVar(&c.dbProtocol)\n\tc.tokenAdd.Flag(\"db-uri\", \"Address the database is reachable at\").StringVar(&c.dbURI)\n\tc.tokenAdd.Flag(\"format\", \"Output format, 'text', 'json', or 'yaml'\").EnumVar(&c.format, formats...)\n\n\t// \"tctl tokens rm ...\"\n\tc.tokenDel = tokens.Command(\"rm\", \"Delete/revoke an invitation token.\").Alias(\"del\")\n\tc.tokenDel.Arg(\"token\", \"Token to delete\").StringVar(&c.value)\n\n\t// \"tctl tokens ls\"\n\tc.tokenList = tokens.Command(\"ls\", \"List node and user invitation tokens.\")\n\tc.tokenList.Flag(\"format\", \"Output format, 'text', 'json' or 'yaml'\").EnumVar(&c.format, formats...)\n\n\tif c.stdout == nil {\n\t\tc.stdout = os.Stdout\n\t}\n}", "func GenerateK8sApiFromToken(host string, caPath string, token string) (*K8sApi, error) {\n\tconfig := &rest.Config{\n\t\tHost: host,\n\t\tBearerToken: token,\n\t\tTLSClientConfig: rest.TLSClientConfig{\n\t\t\tCAFile: caPath,\n\t\t},\n\t}\n\tclientSet, dif, err := GetClientSet(config)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tapi := &K8sApi{\n\t\t\tClientSet: clientSet,\n\t\t\tDif: dif,\n\t\t}\n\t\tif rbacClient, err := rbac.NewForConfig(config); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tapi.RbacClient = rbacClient\n\t\t\tif v1beta1Client, err := v1beta1.NewForConfig(config); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t} else {\n\t\t\t\tapi.V1beta1Client = v1beta1Client\n\t\t\t\treturn api, nil\n\t\t\t}\n\t\t}\n\t}\n}" ]
[ "0.6248717", "0.59793735", "0.5819379", "0.5771171", "0.5746096", "0.57363856", "0.5698077", "0.56682885", "0.56210387", "0.560057", "0.55441684", "0.55334824", "0.5487145", "0.5487065", "0.545568", "0.5444413", "0.540357", "0.536407", "0.5363666", "0.5356209", "0.5340606", "0.53262603", "0.52807415", "0.52508456", "0.5244249", "0.5240652", "0.52141625", "0.51998115", "0.5182218", "0.5173219", "0.51634437", "0.516319", "0.5157955", "0.5155673", "0.51468414", "0.5136258", "0.5109961", "0.51060593", "0.5092437", "0.5090331", "0.5090331", "0.5090331", "0.5088441", "0.506864", "0.50550437", "0.50426227", "0.50342405", "0.5033609", "0.5029531", "0.5014899", "0.50067204", "0.50059974", "0.5000696", "0.49995935", "0.49966198", "0.49901855", "0.4989285", "0.4982872", "0.49827713", "0.49794254", "0.497637", "0.4967891", "0.4965149", "0.4929004", "0.49240944", "0.4920136", "0.4915101", "0.491126", "0.49044043", "0.49040434", "0.48862103", "0.4886109", "0.48533753", "0.4844106", "0.4841585", "0.4827553", "0.48109105", "0.48109105", "0.4792825", "0.47921476", "0.47789103", "0.47735044", "0.47693276", "0.47601682", "0.47548503", "0.47488436", "0.47413442", "0.47169647", "0.47135827", "0.4713057", "0.47113636", "0.4700624", "0.4699288", "0.46950927", "0.46909702", "0.4690951", "0.46855864", "0.46796447", "0.46794888", "0.46785042" ]
0.7220189
0
TokenSource create oauth2.TokenSource for Credentials. Note: We can specify scopes needed for spannerautoscaler but it does increase maintenance cost. We should already use least privileged Google Service Accounts so it use cloudPlatformScope.
TokenSource создает oauth2.TokenSource для Credentials. Примечание: Мы можем указать необходимые scopes для spannerautoscaler, но это увеличивает стоимость обслуживания. Мы уже должны использовать Google Service Accounts с минимальными привилегиями, поэтому используйте cloudPlatformScope.
func (c *Credentials) TokenSource(ctx context.Context) (oauth2.TokenSource, error) { switch c.Type { case CredentialsTypeADC: return initializedBaseTokenSource() case CredentialsTypeServiceAccountJSON: cred, err := google.CredentialsFromJSON(ctx, c.ServiceAccountJSON, cloudPlatformScope) if err != nil { return nil, err } return cred.TokenSource, nil case CredentialsTypeImpersonation: baseTS, err := initializedBaseTokenSource() if err != nil { return nil, err } ts, err := impersonate.CredentialsTokenSource(ctx, impersonate.CredentialsConfig{ TargetPrincipal: c.ImpersonateConfig.TargetServiceAccount, Delegates: c.ImpersonateConfig.Delegates, Scopes: []string{cloudPlatformScope}, }, option.WithTokenSource(baseTS), ) return ts, err default: return nil, fmt.Errorf("credentials type unknown: %v", c.Type) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func tokenSource(ctx context.Context, accessToken, credentials string) (oauth2.TokenSource, error) {\n\t// Try access token first\n\tif accessToken != \"\" {\n\t\tlog.Printf(\"[INFO] authenticating via access_token\")\n\n\t\tcontents, _, err := pathorcontents.Read(accessToken)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to load access token: %w\", err)\n\t\t}\n\n\t\treturn oauth2.StaticTokenSource(&oauth2.Token{\n\t\t\tAccessToken: contents,\n\t\t}), nil\n\t}\n\n\t// Then credentials\n\tif credentials != \"\" {\n\t\tlog.Printf(\"[INFO] authenticating via credentials\")\n\n\t\tcontents, _, err := pathorcontents.Read(credentials)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to load credentials: %w\", err)\n\t\t}\n\n\t\tcreds, err := google.CredentialsFromJSON(ctx, []byte(contents), cloudPlatformScope)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse credentials: %w\", err)\n\t\t}\n\n\t\treturn creds.TokenSource, nil\n\t}\n\n\t// Fallback to default credentials\n\tlog.Printf(\"[INFO] authenticating via default credentials\")\n\tsource, err := google.DefaultTokenSource(ctx, cloudPlatformScope)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get default credentials: %w\", err)\n\t}\n\treturn source, nil\n}", "func CredentialsTokenSource(creds *google.Credentials) TokenSource {\n\tif creds == nil {\n\t\treturn nil\n\t}\n\treturn TokenSource(creds.TokenSource)\n}", "func tokenSource(ctx context.Context) (oauth2.TokenSource, error) {\n\tok, err := credsFile.Exists()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar bootstrapToken *oauth2.Token\n\tif !ok {\n\t\ttok, err := authenticate()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tbootstrapToken = tok\n\t}\n\treturn newCachedTokenFile(ctx, bootstrapToken, credsFile.Path())\n}", "func StorageTokenSource(ctx context.Context, c *Config, t *oauth2.Token) oauth2.TokenSource {\n\tif t == nil || !t.Valid() {\n\t\tif tok, err := c.Storage.GetToken(); err == nil {\n\t\t\tt = tok\n\t\t}\n\t}\n\tts := c.Config.TokenSource(ctx, t)\n\treturn &storageTokenSource{c, ts}\n}", "func NewTokenSource(ctx context.Context, conf DownscopingConfig) (oauth2.TokenSource, error) {\n\tif conf.RootSource == nil {\n\t\treturn nil, fmt.Errorf(\"downscope: rootSource cannot be nil\")\n\t}\n\tif len(conf.Rules) == 0 {\n\t\treturn nil, fmt.Errorf(\"downscope: length of AccessBoundaryRules must be at least 1\")\n\t}\n\tif len(conf.Rules) > 10 {\n\t\treturn nil, fmt.Errorf(\"downscope: length of AccessBoundaryRules may not be greater than 10\")\n\t}\n\tfor _, val := range conf.Rules {\n\t\tif val.AvailableResource == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"downscope: all rules must have a nonempty AvailableResource: %+v\", val)\n\t\t}\n\t\tif len(val.AvailablePermissions) == 0 {\n\t\t\treturn nil, fmt.Errorf(\"downscope: all rules must provide at least one permission: %+v\", val)\n\t\t}\n\t}\n\treturn downscopingTokenSource{ctx: ctx, config: conf}, nil\n}", "func TokenSource(ctx context.Context, config *oauth2.Config, state string, authHandler AuthorizationHandler) oauth2.TokenSource {\n\treturn TokenSourceWithPKCE(ctx, config, state, authHandler, nil)\n}", "func (gsp *GoogleServiceProvider) TokenSource(c context.Context, scopes ...string) (oauth2.TokenSource, error) {\n\tcbts := contextBoundTokenSource{\n\t\tContext: c,\n\t\tcache: gsp.Cache,\n\t\tcacheKey: accessTokenKeyForScopes(scopes),\n\t\tmakeTokenSource: func(c context.Context) (oauth2.TokenSource, error) {\n\t\t\treturn google.DefaultTokenSource(c, scopes...)\n\t\t},\n\t}\n\treturn &cbts, nil\n}", "func OIDCFederatedTokenSource(tokenConfig *OIDCFederatedTokenConfig) (oauth2.TokenSource, error) {\n\n\tif &tokenConfig.SourceTokenSource == nil {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: Source OIDC Token cannot be nil\")\n\t}\n\n\tif tokenConfig.Scope == \"\" {\n\t\ttokenConfig.Scope = GCP_OIDC_CLOUD_PLATFORM_SCOPE\n\t}\n\treturn &oidcFederatedTokenSource{\n\t\trefreshMutex: &sync.Mutex{},\n\t\trootSource: tokenConfig.SourceTokenSource,\n\t\tscope: tokenConfig.Scope,\n\t\ttargetResource: tokenConfig.TargetResource,\n\t\ttargetServiceAccount: tokenConfig.TargetServiceAccount,\n\t\tuseIAMToken: tokenConfig.UseIAMToken,\n\t}, nil\n}", "func TokenSource(ctx context.Context, scopes ...string) oauth2.TokenSource {\n\treturn TokenSourceEnv(ctx, envPrivateKey, scopes...)\n}", "func TokenSource(aud string) oauth2.TokenSource {\n\tidSrc := idTokenSrc{aud: aud}\n\tinitialToken := &oauth2.Token{}\n\treturn oauth2.ReuseTokenSource(initialToken, idSrc)\n}", "func NewTokenSource(name string, path string) oauth2.TokenSource {\n\treturn &tokenSource{\n\t\tname: name,\n\t\tpath: path,\n\t}\n}", "func newTokenSource(ctx context.Context, settings *Settings) (*internal.TokenSource, error) {\n\tvar ts internal.TokenSource\n\tvar err error\n\tif settings == nil {\n\t\tts, err = DefaultTokenSource(ctx, DefaultScope)\n\t} else if settings.APIKey != \"\" {\n\t\treturn nil, nil\n\t} else if settings.Scope != \"\" {\n\t\tts, err = OAuthJSONTokenSource(ctx, settings)\n\t} else {\n\t\tts, err = JWTTokenSource(ctx, settings)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ts, err\n}", "func (c *Config) TokenSource(ctx context.Context) (oauth2.TokenSource, error) {\n\treturn c.tokenSource(ctx, \"https\")\n}", "func (c *Config) TokenSource() oauth2.TokenSource {\n\tpk, err := jwt.ParseRSAPrivateKeyFromPEM(c.PrivateKey)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn oauth2.ReuseTokenSource(nil, appSource{\n\t\tappID: c.AppID,\n\t\texpire: c.Expire,\n\t\tpk: pk,\n\t})\n}", "func (c *Config) tokenSource(ctx context.Context, scheme string) (oauth2.TokenSource, error) {\n\tif c.WorkforcePoolUserProject != \"\" {\n\t\tvalid := validateWorkforceAudience(c.Audience)\n\t\tif !valid {\n\t\t\treturn nil, fmt.Errorf(\"oauth2/google: workforce_pool_user_project should not be set for non-workforce pool credentials\")\n\t\t}\n\t}\n\n\tts := tokenSource{\n\t\tctx: ctx,\n\t\tconf: c,\n\t}\n\tif c.ServiceAccountImpersonationURL == \"\" {\n\t\treturn oauth2.ReuseTokenSource(nil, ts), nil\n\t}\n\tscopes := c.Scopes\n\tts.conf.Scopes = []string{\"https://www.googleapis.com/auth/cloud-platform\"}\n\timp := ImpersonateTokenSource{\n\t\tCtx: ctx,\n\t\tURL: c.ServiceAccountImpersonationURL,\n\t\tScopes: scopes,\n\t\tTs: oauth2.ReuseTokenSource(nil, ts),\n\t\tTokenLifetimeSeconds: c.ServiceAccountImpersonationLifetimeSeconds,\n\t}\n\treturn oauth2.ReuseTokenSource(nil, imp), nil\n}", "func newTokenSource() *tokenReplacer {\n\t// nil token will cause a refresh\n\ttok, _ := readToken()\n\treturn &tokenReplacer{tok, oauthConfig.TokenSource(context.Background(), tok), &tokenPrompt{}}\n}", "func NewIAMTokenSource(ctx context.Context, cfg IAMConfig) (oauth2.TokenSource, error) {\n\tvar (\n\t\terr error\n\t\ttknSrc oauth2.TokenSource\n\t)\n\tif cfg.JSON != nil {\n\t\tcreds, err := google.CredentialsFromJSON(ctx, cfg.JSON, iam.CloudPlatformScope)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttknSrc = creds.TokenSource\n\t} else {\n\t\ttknSrc, err = defaultTokenSource(ctx, iam.CloudPlatformScope)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsvc, err := iam.New(oauth2.NewClient(ctx, tknSrc))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif cfg.IAMAddress != \"\" {\n\t\tsvc.BasePath = cfg.IAMAddress\n\t}\n\n\tsrc := &iamTokenSource{\n\t\tcfg: cfg,\n\t\tsvc: svc,\n\t}\n\n\ttkn, err := src.Token()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to create initial token\")\n\t}\n\n\treturn oauth2.ReuseTokenSource(tkn, src), nil\n}", "func (w *GCPAuthWrapper) SetTokenSource(permissionCode string) error {\n\tvar err error\n\n\tctx := context.Background()\n\n\tw.OauthToken, err = w.Config.Exchange(ctx, permissionCode)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func appEngineTokenSource(ctx context.Context, scope ...string) oauth2.TokenSource {\n\tscopes := append([]string{}, scope...)\n\tsort.Strings(scopes)\n\treturn &gaeTokenSource{\n\t\tctx: ctx,\n\t\tscopes: scopes,\n\t\tkey: strings.Join(scopes, \" \"),\n\t}\n}", "func New(name string, configPath string, userName string) (tokenauth.Source, error) {\n\tif configPath == \"\" {\n\t\tconfigPath = k8s.DefaultKubeConfigPath\n\t}\n\tk8sConfig, err := cfg.LoadFromFile(configPath)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Failed to load k8s config from file %v. Make sure it is there or change\"+\n\t\t\t\" permissions.\", configPath)\n\t}\n\n\tinfo, ok := k8sConfig.AuthInfos[userName]\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"Failed to find user %s inside k8s config AuthInfo from file %v\", userName, configPath)\n\t}\n\n\t// Currently supported:\n\t// - token\n\t// - OIDC\n\t// - Google compute platform via Oauth2\n\tif info.AuthProvider != nil {\n\t\tswitch info.AuthProvider.Name {\n\t\tcase \"oidc\":\n\t\t\tcache, err := k8s.NewCacheFromUser(configPath, userName)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"Failed to get OIDC configuration from user. \")\n\t\t\t}\n\t\t\ts, _, err := oidcauth.NewWithCache(name, cache, nil)\n\t\t\treturn s, err\n\t\tcase \"gcp\":\n\t\t\tc, err := oauth2auth.NewConfigFromMap(info.AuthProvider.Config)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"Failed to create OAuth2 config from map.\")\n\t\t\t}\n\t\t\treturn oauth2auth.NewGCP(name, userName, configPath, c)\n\t\tdefault:\n\t\t\t// TODO(bplotka): Add support for more of them if needed.\n\t\t\treturn nil, errors.Errorf(\"Not supported k8s Auth provider %v\", info.AuthProvider.Name)\n\t\t}\n\t}\n\n\tif info.Token != \"\" {\n\t\treturn directauth.New(name, info.Token), nil\n\t}\n\n\treturn nil, errors.Errorf(\"Not found supported auth source from k8s config %+v\", info)\n}", "func (c *Config) TokenSource(ctx context.Context, t *Token) TokenSource {\n\ttkr := &tokenRefresher{\n\t\tctx: ctx,\n\t\tconf: c,\n\t}\n\tif t != nil {\n\t\ttkr.refreshToken = t.RefreshToken\n\t}\n\treturn &reuseTokenSource{\n\t\tt: t,\n\t\tnew: tkr,\n\t}\n}", "func initializedBaseTokenSource() (oauth2.TokenSource, error) {\n\tbaseTokenSourceOnce.Do(func() {\n\t\tbaseTokenSource, baseTokenSourceErr = google.DefaultTokenSource(context.Background(), cloudPlatformScope)\n\t})\n\treturn baseTokenSource, baseTokenSourceErr\n}", "func (ts tokenSource) Token() (*oauth2.Token, error) {\n\tconf := ts.conf\n\n\tcredSource, err := conf.parse(ts.ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsubjectToken, err := credSource.subjectToken()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstsRequest := stsTokenExchangeRequest{\n\t\tGrantType: \"urn:ietf:params:oauth:grant-type:token-exchange\",\n\t\tAudience: conf.Audience,\n\t\tScope: conf.Scopes,\n\t\tRequestedTokenType: \"urn:ietf:params:oauth:token-type:access_token\",\n\t\tSubjectToken: subjectToken,\n\t\tSubjectTokenType: conf.SubjectTokenType,\n\t}\n\theader := make(http.Header)\n\theader.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\tclientAuth := clientAuthentication{\n\t\tAuthStyle: oauth2.AuthStyleInHeader,\n\t\tClientID: conf.ClientID,\n\t\tClientSecret: conf.ClientSecret,\n\t}\n\tvar options map[string]interface{}\n\t// Do not pass workforce_pool_user_project when client authentication is used.\n\t// The client ID is sufficient for determining the user project.\n\tif conf.WorkforcePoolUserProject != \"\" && conf.ClientID == \"\" {\n\t\toptions = map[string]interface{}{\n\t\t\t\"userProject\": conf.WorkforcePoolUserProject,\n\t\t}\n\t}\n\tstsResp, err := exchangeToken(ts.ctx, conf.TokenURL, &stsRequest, clientAuth, header, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\taccessToken := &oauth2.Token{\n\t\tAccessToken: stsResp.AccessToken,\n\t\tTokenType: stsResp.TokenType,\n\t}\n\tif stsResp.ExpiresIn < 0 {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: got invalid expiry from security token service\")\n\t} else if stsResp.ExpiresIn >= 0 {\n\t\taccessToken.Expiry = now().Add(time.Duration(stsResp.ExpiresIn) * time.Second)\n\t}\n\n\tif stsResp.RefreshToken != \"\" {\n\t\taccessToken.RefreshToken = stsResp.RefreshToken\n\t}\n\treturn accessToken, nil\n}", "func (a *auth) GetTokenSource(ctx context.Context, ref reference.Named) (oauth2.TokenSource, error) {\n\tsource, err := google.DefaultTokenSource(ctx, gcrScope)\n\tif nil != err {\n\t\terr = fmt.Errorf(\"failed to get Google Auth token source: %s\", err)\n\t}\n\n\treturn source, err\n\n}", "func (b *BungieConfig) TokenSource(t *oauth2.Token) oauth2.TokenSource {\n\treturn newTokenSource(t, b.cfg.ClientID)\n}", "func IDTokenSource(ctx context.Context, config IDTokenConfig, opts ...option.ClientOption) (oauth2.TokenSource, error) {\n\tif config.Audience == \"\" {\n\t\treturn nil, fmt.Errorf(\"impersonate: an audience must be provided\")\n\t}\n\tif config.TargetPrincipal == \"\" {\n\t\treturn nil, fmt.Errorf(\"impersonate: a target service account must be provided\")\n\t}\n\n\tclientOpts := append(defaultClientOptions(), opts...)\n\tclient, _, err := htransport.NewClient(ctx, clientOpts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tits := impersonatedIDTokenSource{\n\t\tclient: client,\n\t\ttargetPrincipal: config.TargetPrincipal,\n\t\taudience: config.Audience,\n\t\tincludeEmail: config.IncludeEmail,\n\t}\n\tfor _, v := range config.Delegates {\n\t\tits.delegates = append(its.delegates, formatIAMServiceAccountName(v))\n\t}\n\treturn oauth2.ReuseTokenSource(nil, its), nil\n}", "func WithTokenSource(ctx context.Context, ts oauth2.TokenSource) context.Context {\n\treturn context.WithValue(ctx, contextKey, ts)\n}", "func JWTAccessTokenSource(ctx context.Context, config *gcpjwt.IAMConfig, audience string) (oauth2.TokenSource, error) {\n\tctx = gcpjwt.NewIAMContext(ctx, config)\n\tts := &jwtAccessTokenSource{\n\t\tctx: ctx,\n\t\taudience: audience,\n\t\tjwtConfig: config,\n\t}\n\ttok, err := ts.Token()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn oauth2.ReuseTokenSource(tok, ts), nil\n}", "func (h *WebFlowHelper) GetTokenSource(ctx context.Context) (oauth2.TokenSource, error) {\n\tauthURL := h.config.AuthCodeURL(\"state-token\", oauth2.AccessTypeOffline)\n\n\t// TODO(jlewi): How to open it automatically?\n\tfmt.Printf(\"Go to the following link in your browser then type the \"+\n\t\t\"authorization code: \\n%v\\n\", authURL)\n\n\tvar authCode string\n\tif _, err := fmt.Scan(&authCode); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Unable to read authorization code\")\n\t}\n\n\ttok, err := h.config.Exchange(context.TODO(), authCode)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Unable to retrieve token from web: %v\")\n\t}\n\n\treturn h.config.TokenSource(ctx, tok), nil\n}", "func (dts downscopingTokenSource) Token() (*oauth2.Token, error) {\n\n\tdownscopedOptions := struct {\n\t\tBoundary accessBoundary `json:\"accessBoundary\"`\n\t}{\n\t\tBoundary: accessBoundary{\n\t\t\tAccessBoundaryRules: dts.config.Rules,\n\t\t},\n\t}\n\n\ttok, err := dts.config.RootSource.Token()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"downscope: unable to obtain root token: %v\", err)\n\t}\n\n\tb, err := json.Marshal(downscopedOptions)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"downscope: unable to marshal AccessBoundary payload %v\", err)\n\t}\n\n\tform := url.Values{}\n\tform.Add(\"grant_type\", \"urn:ietf:params:oauth:grant-type:token-exchange\")\n\tform.Add(\"subject_token_type\", \"urn:ietf:params:oauth:token-type:access_token\")\n\tform.Add(\"requested_token_type\", \"urn:ietf:params:oauth:token-type:access_token\")\n\tform.Add(\"subject_token\", tok.AccessToken)\n\tform.Add(\"options\", string(b))\n\n\tmyClient := oauth2.NewClient(dts.ctx, nil)\n\tresp, err := myClient.PostForm(identityBindingEndpoint, form)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to generate POST Request %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\trespBody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"downscope: unable to read response body: %v\", err)\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"downscope: unable to exchange token; %v. Server responded: %s\", resp.StatusCode, respBody)\n\t}\n\n\tvar tresp downscopedTokenResponse\n\n\terr = json.Unmarshal(respBody, &tresp)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"downscope: unable to unmarshal response body: %v\", err)\n\t}\n\n\t// an exchanged token that is derived from a service account (2LO) has an expired_in value\n\t// a token derived from a users token (3LO) does not.\n\t// The following code uses the time remaining on rootToken for a user as the value for the\n\t// derived token's lifetime\n\tvar expiryTime time.Time\n\tif tresp.ExpiresIn > 0 {\n\t\texpiryTime = time.Now().Add(time.Duration(tresp.ExpiresIn) * time.Second)\n\t} else {\n\t\texpiryTime = tok.Expiry\n\t}\n\n\tnewToken := &oauth2.Token{\n\t\tAccessToken: tresp.AccessToken,\n\t\tTokenType: tresp.TokenType,\n\t\tExpiry: expiryTime,\n\t}\n\treturn newToken, nil\n}", "func sourceFromDefault(ctx context.Context, targetAudience string, tokenURL string) (*oidcTokenSource, error) {\n\tcredentials, err := google.FindDefaultCredentials(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(credentials.JSON) == 0 {\n\t\treturn nil, ErrComputeEngineNotSupported\n\t}\n\tconfig, err := google.JWTConfigFromJSON(credentials.JSON)\n\tif err != nil {\n\t\t// friendly error message that we found user credentials\n\t\tif strings.Contains(err.Error(), \"authorized_user\") {\n\t\t\treturn nil, ErrUserCredentialsNotSupported\n\t\t}\n\t\treturn nil, err\n\t}\n\tprivateKey, err := parseKey(config.PrivateKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &oidcTokenSource{config.Email, config.PrivateKeyID, privateKey, targetAudience, tokenURL}, nil\n}", "func GCPTokenSource(ts gcp.TokenSource) broker.Option {\n\treturn optfunc(gcpTokenSourceKey{}, ts)\n}", "func (its ImpersonateTokenSource) Token() (*oauth2.Token, error) {\n\tlifetimeString := \"3600s\"\n\tif its.TokenLifetimeSeconds != 0 {\n\t\tlifetimeString = fmt.Sprintf(\"%ds\", its.TokenLifetimeSeconds)\n\t}\n\treqBody := generateAccessTokenReq{\n\t\tLifetime: lifetimeString,\n\t\tScope: its.Scopes,\n\t\tDelegates: its.Delegates,\n\t}\n\tb, err := json.Marshal(reqBody)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: unable to marshal request: %v\", err)\n\t}\n\tclient := oauth2.NewClient(its.Ctx, its.Ts)\n\treq, err := http.NewRequest(\"POST\", its.URL, bytes.NewReader(b))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: unable to create impersonation request: %v\", err)\n\t}\n\treq = req.WithContext(its.Ctx)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: unable to generate access token: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(io.LimitReader(resp.Body, 1<<20))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: unable to read body: %v\", err)\n\t}\n\tif c := resp.StatusCode; c < 200 || c > 299 {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: status code %d: %s\", c, body)\n\t}\n\n\tvar accessTokenResp impersonateTokenResponse\n\tif err := json.Unmarshal(body, &accessTokenResp); err != nil {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: unable to parse response: %v\", err)\n\t}\n\texpiry, err := time.Parse(time.RFC3339, accessTokenResp.ExpireTime)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"oauth2/google: unable to parse expiry: %v\", err)\n\t}\n\treturn &oauth2.Token{\n\t\tAccessToken: accessTokenResp.AccessToken,\n\t\tExpiry: expiry,\n\t\tTokenType: \"Bearer\",\n\t}, nil\n}", "func newProxyTokenSource(\n\tctx context.Context,\n\tendpoint string,\n\treuseTokenFromUrl bool,\n) (ts oauth2.TokenSource, err error) {\n\tu, err := url.Parse(endpoint)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"newProxyTokenSource cannot parse endpoint %s: %w\", endpoint, err)\n\t\treturn\n\t}\n\n\tclient := &http.Client{}\n\tif u.Scheme == \"unix\" {\n\t\tclient.Transport = &http.Transport{\n\t\t\tDialContext: func(ctx context.Context, _, _ string) (net.Conn, error) {\n\t\t\t\tdialer := net.Dialer{}\n\t\t\t\treturn dialer.DialContext(ctx, u.Scheme, u.Path)\n\t\t\t},\n\t\t}\n\t\tendpoint = \"http://unix?\" + u.RawQuery\n\t}\n\n\tts = proxyTokenSource{\n\t\tctx: ctx,\n\t\tendpoint: endpoint,\n\t\tclient: client,\n\t}\n\tif reuseTokenFromUrl {\n\t\treturn oauth2.ReuseTokenSource(nil, ts), nil\n\t}\n\treturn ts, nil\n}", "func TokenSourceEnv(ctx context.Context, envVar string, scopes ...string) oauth2.TokenSource {\n\tif impKey := os.Getenv(envImpersonate); impKey == \"true\" {\n\t\treturn impersonatedTokenSource(ctx, scopes)\n\t}\n\tkey := os.Getenv(envVar)\n\tif key == \"\" { // Try for application default credentials.\n\t\tts, err := google.DefaultTokenSource(ctx, scopes...)\n\t\tif err != nil {\n\t\t\tlog.Println(\"No 'Application Default Credentials' found.\")\n\t\t\treturn nil\n\t\t}\n\t\treturn ts\n\t}\n\tconf, err := jwtConfigFromFile(key, scopes)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn conf.TokenSource(ctx)\n}", "func NewContextIAMTokenSource(ctx context.Context, cfg IAMConfig) (ContextTokenSource, error) {\n\tsrc := &iamTokenSource{cfg: cfg}\n\n\ttkn, err := src.ContextToken(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to create initial token\")\n\t}\n\n\treturn &reuseTokenSource{t: tkn, new: src}, nil\n}", "func appEngineTokenSource(ctx context.Context, scope ...string) oauth2.TokenSource {\n\tlogOnce.Do(func() {\n\t\tlog.Print(\"google: AppEngineTokenSource is deprecated on App Engine standard second generation runtimes (>= Go 1.11) and App Engine flexible. Please use DefaultTokenSource or ComputeTokenSource.\")\n\t})\n\treturn ComputeTokenSource(\"\")\n}", "func NewStkSource() (StkSource, error) {\n\tsecret := make([]byte, 32)\n\tif _, err := rand.Read(secret); err != nil {\n\t\treturn nil, err\n\t}\n\tkey, err := deriveKey(secret)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\taead, err := cipher.NewGCMWithNonceSize(c, stkNonceSize)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &stkSource{aead: aead}, nil\n}", "func (src *gcloudTokenSource) Token() (*oauth2.Token, error) {\n\tcfg, err := GcloudConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn cfg.oauthToken(), nil\n}", "func TokenSourceWithPKCE(ctx context.Context, config *oauth2.Config, state string, authHandler AuthorizationHandler, pkce *PKCEParams) oauth2.TokenSource {\n\treturn oauth2.ReuseTokenSource(nil, authHandlerSource{config: config, ctx: ctx, authHandler: authHandler, state: state, pkce: pkce})\n}", "func NewSourceCodeToken(ctx *pulumi.Context,\n\tname string, args *SourceCodeTokenArgs, opts ...pulumi.ResourceOption) (*SourceCodeToken, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.Token == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Token'\")\n\t}\n\tif args.Type == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Type'\")\n\t}\n\tif args.Token != nil {\n\t\targs.Token = pulumi.ToSecret(args.Token).(pulumi.StringInput)\n\t}\n\tif args.TokenSecret != nil {\n\t\targs.TokenSecret = pulumi.ToSecret(args.TokenSecret).(pulumi.StringPtrInput)\n\t}\n\tsecrets := pulumi.AdditionalSecretOutputs([]string{\n\t\t\"token\",\n\t\t\"tokenSecret\",\n\t})\n\topts = append(opts, secrets)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource SourceCodeToken\n\terr := ctx.RegisterResource(\"azure:appservice/sourceCodeToken:SourceCodeToken\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func NewSourceFromDefault(ctx context.Context, targetAudience string) (oauth2.TokenSource, error) {\n\n\treturn newSourceFromDefaultURL(ctx, targetAudience, googleTokenURL)\n}", "func (d *Disco) CredentialsSource() auth.CredentialsSource {\n\tif d.credsSrc == nil {\n\t\t// We'll return an empty one just to save the caller from having to\n\t\t// protect against the nil case, since this interface already allows\n\t\t// for the possibility of there being no credentials at all.\n\t\treturn auth.StaticCredentialsSource(nil)\n\t}\n\treturn d.credsSrc\n}", "func Provider() terraform.ResourceProvider {\n\treturn &schema.Provider{\n\t\tSchema: map[string]*schema.Schema{\n\t\t\t\"credentials\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tDefaultFunc: schema.MultiEnvDefaultFunc([]string{\n\t\t\t\t\t\"GOOGLE_CREDENTIALS\",\n\t\t\t\t\t\"GOOGLE_CLOUD_KEYFILE_JSON\",\n\t\t\t\t\t\"GCLOUD_KEYFILE_JSON\",\n\t\t\t\t}, nil),\n\t\t\t\tValidateFunc: validateCredentials,\n\t\t\t},\n\n\t\t\t\"access_token\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tDefaultFunc: schema.MultiEnvDefaultFunc([]string{\n\t\t\t\t\t\"GOOGLE_OAUTH_ACCESS_TOKEN\",\n\t\t\t\t}, nil),\n\t\t\t\tConflictsWith: []string{\"credentials\"},\n\t\t\t},\n\n\t\t\t\"project\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tDefaultFunc: schema.MultiEnvDefaultFunc([]string{\n\t\t\t\t\t\"GOOGLE_PROJECT\",\n\t\t\t\t\t\"GOOGLE_CLOUD_PROJECT\",\n\t\t\t\t\t\"GCLOUD_PROJECT\",\n\t\t\t\t\t\"CLOUDSDK_CORE_PROJECT\",\n\t\t\t\t}, nil),\n\t\t\t},\n\n\t\t\t\"region\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tDefaultFunc: schema.MultiEnvDefaultFunc([]string{\n\t\t\t\t\t\"GOOGLE_REGION\",\n\t\t\t\t\t\"GCLOUD_REGION\",\n\t\t\t\t\t\"CLOUDSDK_COMPUTE_REGION\",\n\t\t\t\t}, nil),\n\t\t\t},\n\n\t\t\t\"zone\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t\tDefaultFunc: schema.MultiEnvDefaultFunc([]string{\n\t\t\t\t\t\"GOOGLE_ZONE\",\n\t\t\t\t\t\"GCLOUD_ZONE\",\n\t\t\t\t\t\"CLOUDSDK_COMPUTE_ZONE\",\n\t\t\t\t}, nil),\n\t\t\t},\n\t\t\t\"scopes\": {\n\t\t\t\tType: schema.TypeList,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Schema{Type: schema.TypeString},\n\t\t\t},\n\t\t},\n\n\t\tDataSourcesMap: map[string]*schema.Resource{\n\t\t\t\"google_active_folder\": dataSourceGoogleActiveFolder(),\n\t\t\t\"google_billing_account\": dataSourceGoogleBillingAccount(),\n\t\t\t\"google_dns_managed_zone\": dataSourceDnsManagedZone(),\n\t\t\t\"google_client_config\": dataSourceGoogleClientConfig(),\n\t\t\t\"google_cloudfunctions_function\": dataSourceGoogleCloudFunctionsFunction(),\n\t\t\t\"google_compute_address\": dataSourceGoogleComputeAddress(),\n\t\t\t\"google_compute_backend_service\": dataSourceGoogleComputeBackendService(),\n\t\t\t\"google_compute_default_service_account\": dataSourceGoogleComputeDefaultServiceAccount(),\n\t\t\t\"google_compute_forwarding_rule\": dataSourceGoogleComputeForwardingRule(),\n\t\t\t\"google_compute_image\": dataSourceGoogleComputeImage(),\n\t\t\t\"google_compute_instance\": dataSourceGoogleComputeInstance(),\n\t\t\t\"google_compute_global_address\": dataSourceGoogleComputeGlobalAddress(),\n\t\t\t\"google_compute_instance_group\": dataSourceGoogleComputeInstanceGroup(),\n\t\t\t\"google_compute_lb_ip_ranges\": dataSourceGoogleComputeLbIpRanges(),\n\t\t\t\"google_compute_network\": dataSourceGoogleComputeNetwork(),\n\t\t\t\"google_compute_regions\": dataSourceGoogleComputeRegions(),\n\t\t\t\"google_compute_region_instance_group\": dataSourceGoogleComputeRegionInstanceGroup(),\n\t\t\t\"google_compute_subnetwork\": dataSourceGoogleComputeSubnetwork(),\n\t\t\t\"google_compute_zones\": dataSourceGoogleComputeZones(),\n\t\t\t\"google_compute_vpn_gateway\": dataSourceGoogleComputeVpnGateway(),\n\t\t\t\"google_compute_ssl_policy\": dataSourceGoogleComputeSslPolicy(),\n\t\t\t\"google_container_cluster\": dataSourceGoogleContainerCluster(),\n\t\t\t\"google_container_engine_versions\": dataSourceGoogleContainerEngineVersions(),\n\t\t\t\"google_container_registry_repository\": dataSourceGoogleContainerRepo(),\n\t\t\t\"google_container_registry_image\": dataSourceGoogleContainerImage(),\n\t\t\t\"google_iam_policy\": dataSourceGoogleIamPolicy(),\n\t\t\t\"google_iam_role\": dataSourceGoogleIamRole(),\n\t\t\t\"google_kms_secret\": dataSourceGoogleKmsSecret(),\n\t\t\t\"google_kms_key_ring\": dataSourceGoogleKmsKeyRing(),\n\t\t\t\"google_kms_crypto_key\": dataSourceGoogleKmsCryptoKey(),\n\t\t\t\"google_folder\": dataSourceGoogleFolder(),\n\t\t\t\"google_netblock_ip_ranges\": dataSourceGoogleNetblockIpRanges(),\n\t\t\t\"google_organization\": dataSourceGoogleOrganization(),\n\t\t\t\"google_project\": dataSourceGoogleProject(),\n\t\t\t\"google_project_services\": dataSourceGoogleProjectServices(),\n\t\t\t\"google_service_account\": dataSourceGoogleServiceAccount(),\n\t\t\t\"google_service_account_key\": dataSourceGoogleServiceAccountKey(),\n\t\t\t\"google_storage_bucket_object\": dataSourceGoogleStorageBucketObject(),\n\t\t\t\"google_storage_object_signed_url\": dataSourceGoogleSignedUrl(),\n\t\t\t\"google_storage_project_service_account\": dataSourceGoogleStorageProjectServiceAccount(),\n\t\t\t\"google_storage_transfer_project_service_account\": dataSourceGoogleStorageTransferProjectServiceAccount(),\n\t\t},\n\n\t\tResourcesMap: ResourceMap(),\n\n\t\tConfigureFunc: providerConfigure,\n\t}\n}", "func (t *TokenSource) Token() (*oauth2.Token, error) {\n\ttoken, err := t.TokenGenerator.GetWithSTS(context.Background(), t.ClusterID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error generating token: %w\", err)\n\t}\n\treturn &oauth2.Token{\n\t\tAccessToken: token.Token,\n\t\tExpiry: token.Expiration.Add(-t.Leeway),\n\t}, nil\n}", "func NewClientCredentialsSource(name string, path string) ClientCredentialsSource {\n\treturn &clientCredentialsSource{\n\t\tname: name,\n\t\tpath: path,\n\t}\n}", "func Init(ctx context.Context, local bool) (oauth2.TokenSource, error) {\n\treturn auth_steps.Init(ctx, local, auth.ScopeGerrit, auth.ScopeUserinfoEmail)\n}", "func (c *contextBoundTokenSource) Token() (*oauth2.Token, error) {\n\tnow := clock.Now(c)\n\n\t// Get the current token value. We do this without locking around the token\n\t// element.\n\tif tokIface, ok := c.cache.Get(c, c.cacheKey); ok {\n\t\ttok := tokIface.(*oauth2.Token)\n\t\tif !c.closeToExpRandomized(now, tok.Expiry, accessTokenExpirationRandomization) {\n\t\t\treturn tok, nil\n\t\t}\n\t}\n\n\t// Either the token is expired, or we are selected randomly as a refresh case.\n\t// Get a new TokenSource to refresh the token with.\n\tts, err := c.makeTokenSource(c)\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"failed to create new TokenSource\").Err()\n\t}\n\n\t// While refreshing, we lock around the cache key via GetOrCreate in case\n\t// multiple requests are either selected or have expired.\n\ttokIface, err := c.cache.GetOrCreate(c, c.cacheKey, func() (interface{}, time.Duration, error) {\n\t\ttok, err := ts.Token()\n\t\tif err != nil {\n\t\t\treturn nil, 0, err\n\t\t}\n\n\t\texpiryDelta := tok.Expiry.Sub(now)\n\t\tswitch {\n\t\tcase expiryDelta <= 0:\n\t\t\treturn nil, 0, errors.Reason(\"retrieved expired access token (%s < %s)\", tok.Expiry, now).Err()\n\t\tcase expiryDelta > accessTokenMinExpiration:\n\t\t\t// Subtract some time from the token's expiry so we don't use it immediately\n\t\t\t// before it actually expires.\n\t\t\ttok.Expiry = tok.Expiry.Add(-accessTokenMinExpiration)\n\t\t\texpiryDelta -= accessTokenMinExpiration\n\t\t}\n\t\treturn tok, expiryDelta, nil\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Annotate(err, \"failed to mint new access token\").Err()\n\t}\n\treturn tokIface.(*oauth2.Token), nil\n}", "func JWTAccessTokenSourceFromJSON(jsonKey []byte, audience string) (internal.TokenSource, error) {\n\tcfg, err := JWTConfigFromJSON(jsonKey, []string{}, \"\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"google: could not parse JSON key: %v\", err)\n\t}\n\tpk, err := parseKey(cfg.PrivateKey)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"google: could not parse key: %v\", err)\n\t}\n\tts := &jwtAccessTokenSource{\n\t\temail: cfg.Email,\n\t\taudience: audience,\n\t\tpk: pk,\n\t\tpkID: cfg.PrivateKeyID,\n\t}\n\ttok, err := ts.Token()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn internal.ReuseTokenSource(tok, ts), nil\n}", "func (ac *AuthorizationCodeTokenSource) Token() (*oauth2.Token, error) {\n\t// Generate a random code verifier string\n\tverifierBytes := make([]byte, 32)\n\tif _, err := rand.Read(verifierBytes); err != nil {\n\t\treturn nil, err\n\t}\n\n\tverifier := base64.RawURLEncoding.EncodeToString(verifierBytes)\n\n\t// Generate a code challenge. Only the challenge is sent when requesting a\n\t// code which allows us to keep it secret for now.\n\tshaBytes := sha256.Sum256([]byte(verifier))\n\tchallenge := base64.RawURLEncoding.EncodeToString(shaBytes[:])\n\n\t// Generate a URL with the challenge to have the user log in.\n\turl := fmt.Sprintf(\"%s?response_type=code&code_challenge=%s&code_challenge_method=S256&client_id=%s&redirect_uri=http://localhost:8484/&scope=%s\", ac.AuthorizeURL, challenge, ac.ClientID, strings.Join(ac.Scopes, `%20`))\n\n\tif len(*ac.EndpointParams) > 0 {\n\t\turl += \"&\" + ac.EndpointParams.Encode()\n\t}\n\n\t// Run server before opening the user's browser so we are ready for any redirect.\n\tcodeChan := make(chan string)\n\thandler := authHandler{\n\t\tc: codeChan,\n\t}\n\n\ts := &http.Server{\n\t\tAddr: \":8484\",\n\t\tHandler: handler,\n\t\tReadTimeout: 5 * time.Second,\n\t\tWriteTimeout: 5 * time.Second,\n\t\tMaxHeaderBytes: 1024,\n\t}\n\n\tgo func() {\n\t\t// Run in a goroutine until the server is closed or we get an error.\n\t\tif err := s.ListenAndServe(); err != http.ErrServerClosed {\n\t\t\tlog.Fatal().Err(err).Msg(\"Server exited unexpectedly\")\n\t\t}\n\t}()\n\n\t// Open auth URL in browser, print for manual use in case open fails.\n\tfmt.Println(\"Open your browser to log in using the URL:\")\n\tfmt.Println(url)\n\topen(url)\n\n\t// Get code from handler, exchange it for a token, and then return it. This\n\t// channel read blocks until one code becomes available.\n\t// There is currently no timeout.\n\tcode := <-codeChan\n\ts.Shutdown(context.Background())\n\n\tpayload := fmt.Sprintf(\"grant_type=authorization_code&client_id=%s&code_verifier=%s&code=%s&redirect_uri=http://localhost:8484/\", ac.ClientID, verifier, code)\n\n\treturn requestToken(ac.TokenURL, payload)\n}", "func NewSource(ctx *pulumi.Context,\n\tname string, args *SourceArgs, opts ...pulumi.ResourceOption) (*Source, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.OrganizationId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'OrganizationId'\")\n\t}\n\treplaceOnChanges := pulumi.ReplaceOnChanges([]string{\n\t\t\"organizationId\",\n\t})\n\topts = append(opts, replaceOnChanges)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Source\n\terr := ctx.RegisterResource(\"google-native:securitycenter/v1:Source\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (t *TokenSource) Token() (*oauth2.Token, error) {\n\treturn &oauth2.Token{\n\t\tAccessToken: t.AccessToken,\n\t}, nil\n}", "func NewServicePrincipalTokenFromCredentials(c map[string]string, scope string) (*adal.ServicePrincipalToken, error) {\n\toauthConfig, err := adal.NewOAuthConfig(azure.PublicCloud.ActiveDirectoryEndpoint, c[\"AZURE_TENANT_ID\"])\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn adal.NewServicePrincipalToken(*oauthConfig, c[\"AZURE_CLIENT_ID\"], c[\"AZURE_CLIENT_SECRET\"], scope)\n}", "func NewConfigWithToken(token string) oauth2.TokenSource {\n\treturn oauth2.StaticTokenSource(\n\t\t&oauth2.Token{AccessToken: token},\n\t)\n}", "func New(path string, mask int, d debug.Debugger) (*Source, error) {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn nil, ErrFileNotFound\n\t}\n\n\tts := &Source{\n\t\tpath: path,\n\t\ttoken: new(oauth2.Token),\n\t\tmask: mask,\n\t\tDebugger: d,\n\t}\n\tts.readToken()\n\n\treturn ts, nil\n}", "func NewSource(opts ...Option) (*Source, error) {\n\ts := Source{\n\t\tprefix: \"nsscache\",\n\t\tmountPath: \"secret\",\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(&s)\n\t}\n\n\tif s.client == nil {\n\t\tcl, err := api.NewClient(nil)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ts.client = cl\n\t}\n\n\treturn &s, nil\n}", "func (t *TokenSource) Token() (*oauth2.Token, error) {\n\ttoken := &oauth2.Token{\n\t\tAccessToken: t.AccessToken,\n\t}\n\treturn token, nil\n}", "func (t *TokenSource) Token() (*oauth2.Token, error) {\n\ttoken := &oauth2.Token{\n\t\tAccessToken: t.AccessToken,\n\t}\n\treturn token, nil\n}", "func NewHTTPClient(transport http.RoundTripper, ts TokenSource) (*HTTPClient, error) {\n\tif ts == nil {\n\t\treturn nil, errors.New(\"gcp: no credentials available\")\n\t}\n\treturn &HTTPClient{\n\t\tClient: http.Client{\n\t\t\tTransport: &oauth2.Transport{\n\t\t\t\tBase: transport,\n\t\t\t\tSource: ts,\n\t\t\t},\n\t\t},\n\t}, nil\n}", "func NewSecretsSource(prefix, delimiter string) (source *SecretsSource) {\n\treturn &SecretsSource{\n\t\tkoanf: koanf.New(constDelimiter),\n\t\tprefix: prefix,\n\t\tdelimiter: delimiter,\n\t}\n}", "func NewApplicationDefault(ctx context.Context, scope ...string) (credentials.PerRPCCredentials, error) {\n\tcreds, err := google.FindDefaultCredentials(ctx, scope...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// If JSON is nil, the authentication is provided by the environment and not\n\t// with a credentials file, e.g. when code is running on Google Cloud\n\t// Platform. Use the returned token source.\n\tif creds.JSON == nil {\n\t\treturn TokenSource{creds.TokenSource}, nil\n\t}\n\n\t// If auth is provided by env variable or creds file, the behavior will be\n\t// different based on whether scope is set. Because the returned\n\t// creds.TokenSource does oauth with jwt by default, and it requires scope.\n\t// We can only use it if scope is not empty, otherwise it will fail with\n\t// missing scope error.\n\t//\n\t// If scope is set, use it, it should just work.\n\t//\n\t// If scope is not set, we try to use jwt directly without oauth (this only\n\t// works if it's a service account).\n\n\tif len(scope) != 0 {\n\t\treturn TokenSource{creds.TokenSource}, nil\n\t}\n\n\t// Try to convert JSON to a jwt config without setting the optional scope\n\t// parameter to check if it's a service account (the function errors if it's\n\t// not). This is necessary because the returned config doesn't show the type\n\t// of the account.\n\tif _, err := google.JWTConfigFromJSON(creds.JSON); err != nil {\n\t\t// If this fails, it's not a service account, return the original\n\t\t// TokenSource from above.\n\t\treturn TokenSource{creds.TokenSource}, nil\n\t}\n\n\t// If it's a service account, create a JWT only access with the key.\n\treturn NewJWTAccessFromKey(creds.JSON)\n}", "func (s *reuseTokenSource) ContextToken(ctx context.Context) (*oauth2.Token, error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tif s.t.Valid() {\n\t\treturn s.t, nil\n\t}\n\tt, err := s.new.ContextToken(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.t = t\n\treturn t, nil\n}", "func CreateTargetClientFromDynamicServiceAccountToken(ctx context.Context, targetClient kubernetes.Interface, name string) (kubernetes.Interface, error) {\n\treturn createTargetClientFromServiceAccount(ctx, targetClient, name, labelsE2ETestDynamicServiceAccountTokenAccess, func(serviceAccount *corev1.ServiceAccount) (string, error) {\n\t\ttokenRequest := &authenticationv1.TokenRequest{\n\t\t\tSpec: authenticationv1.TokenRequestSpec{\n\t\t\t\tAudiences: []string{v1beta1constants.GardenerAudience},\n\t\t\t\tExpirationSeconds: pointer.Int64(3600),\n\t\t\t},\n\t\t}\n\n\t\tif err := targetClient.Client().SubResource(\"token\").Create(ctx, serviceAccount, tokenRequest); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\treturn tokenRequest.Status.Token, nil\n\t})\n}", "func NewWithCredentialsSource(credsSrc auth.CredentialsSource) *Disco {\n\treturn &Disco{\n\t\thostCache: make(map[svchost.Hostname]*Host),\n\t\tcredsSrc: credsSrc,\n\t\tTransport: httpTransport,\n\t}\n}", "func (gts *GithubTokenSource) Token() (*oauth2.Token, error) {\n\treturn &oauth2.Token{AccessToken: gts.PersonalToken}, nil\n}", "func AAZSTokenSource(log *util.Logger, tox vag.TokenExchanger, azsConfig string, q url.Values) (vag.TokenSource, vag.TokenSource, error) {\n\ttoken, err := tox.Exchange(q)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\ttrs := tox.TokenSource(token)\n\tazs := aazsproxy.New(log)\n\n\tmts := vag.MetaTokenSource(func() (*vag.Token, error) {\n\t\t// get TRS token from refreshing TRS token source\n\t\titoken, err := trs.TokenEx()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// exchange TRS id_token for AAZS token\n\t\tatoken, err := azs.Exchange(azsConfig, itoken.IDToken)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn atoken, err\n\n\t\t// produce tokens from refresh MBB token source\n\t}, azs.TokenSource)\n\n\treturn mts, trs, nil\n}", "func ReuseTokenSource(t *Token, src TokenSource) TokenSource {\n\t// Don't wrap a reuseTokenSource in itself. That would work,\n\t// but cause an unnecessary number of mutex operations.\n\t// Just build the equivalent one.\n\tif rt, ok := src.(*reuseTokenSource); ok {\n\t\tif t == nil {\n\t\t\t// Just use it directly.\n\t\t\treturn rt\n\t\t}\n\t\tsrc = rt.new\n\t}\n\treturn &reuseTokenSource{\n\t\tt: t,\n\t\tnew: src,\n\t}\n}", "func (p *tokenSource) Token() (*oauth2.Token, error) {\n\ttoken, err := readFileContent(path.Join(p.path, fmt.Sprintf(\"%s-token-secret\", p.name)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttokenType, err := readFileContent(path.Join(p.path, fmt.Sprintf(\"%s-token-type\", p.name)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// parse the token claims to get expiry time\n\tclaims, err := jwt.ParseClaims(token)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &oauth2.Token{\n\t\tAccessToken: token,\n\t\tTokenType: tokenType,\n\t\tExpiry: time.Unix(int64(claims.Exp), 0),\n\t}, nil\n}", "func NewOauthTokenCredentials(oauthToken string) Credentials {\n\treturn &oauthTokenCredentials{oauthToken: oauthToken}\n}", "func NewSSOTokenProvider(client CreateTokenAPIClient, cachedTokenFilepath string, optFns ...func(o *SSOTokenProviderOptions)) *SSOTokenProvider {\n\toptions := SSOTokenProviderOptions{\n\t\tClient: client,\n\t\tCachedTokenFilepath: cachedTokenFilepath,\n\t}\n\tfor _, fn := range optFns {\n\t\tfn(&options)\n\t}\n\n\tprovider := &SSOTokenProvider{\n\t\toptions: options,\n\t}\n\n\treturn provider\n}", "func NewSSOTokenProvider(client CreateTokenAPIClient, cachedTokenFilepath string, optFns ...func(o *SSOTokenProviderOptions)) *SSOTokenProvider {\n\toptions := SSOTokenProviderOptions{\n\t\tClient: client,\n\t\tCachedTokenFilepath: cachedTokenFilepath,\n\t}\n\tfor _, fn := range optFns {\n\t\tfn(&options)\n\t}\n\n\tprovider := &SSOTokenProvider{\n\t\toptions: options,\n\t}\n\n\treturn provider\n}", "func (s *storageTokenSource) Token() (*oauth2.Token, error) {\n\tif token, err := s.Config.Storage.GetToken(); err == nil && token.Valid() {\n\t\treturn token, err\n\t}\n\ttoken, err := s.TokenSource.Token()\n\tif err != nil {\n\t\treturn token, err\n\t}\n\tif err := s.Config.Storage.SetToken(token); err != nil {\n\t\treturn nil, err\n\t}\n\treturn token, nil\n}", "func NewTokenProvider() sarama.AccessTokenProvider {\n\tspt, err := getServicePrincipalToken(\n\t\tos.Getenv(\"AAD_TENANT_ID\"),\n\t\tos.Getenv(\"AAD_APPLICATION_ID\"),\n\t\tos.Getenv(\"AAD_APPLICATION_SECRET\"),\n\t\tos.Getenv(\"AAD_AUDIENCE\"))\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\treturn &TokenProvider{\n\t\tservicePrincipalToken : spt,\n\t}\n}", "func New(authToken string) (*datastore, error) {\n\tctx := context.Background()\n\n\tts := oauth2.StaticTokenSource(\n\t\t&oauth2.Token{AccessToken: authToken},\n\t)\n\ttc := oauth2.NewClient(ctx, ts)\n\tif tc == nil {\n\t\treturn nil, errors.New(\"Access Token Invalid\")\n\t}\n\n\tclient := github.NewClient(tc)\n\tif client == nil {\n\t\treturn nil, errors.New(\"Error creating Github client\")\n\t}\n\n\treturn &datastore{\n\t\tContext: ctx,\n\t\tClient: client,\n\t\tService: client.Git,\n\t}, nil\n}", "func (ap *oauth2ClientCredentialsAuthPlugin) requestToken() (*oauth2Token, error) {\n\tbody := url.Values{\"grant_type\": []string{\"client_credentials\"}}\n\tif len(*ap.Scopes) > 0 {\n\t\tbody[\"scope\"] = []string{strings.Join(*ap.Scopes, \" \")}\n\t}\n\n\tr, err := http.NewRequest(\"POST\", ap.TokenURL, strings.NewReader(body.Encode()))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\tr.SetBasicAuth(ap.ClientID, ap.ClientSecret)\n\n\tclient := defaultRoundTripperClient(&tls.Config{InsecureSkipVerify: ap.tlsSkipVerify}, 10)\n\tresponse, err := client.Do(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbodyRaw, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif response.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"error in response from OAuth2 token endpoint: %v\", string(bodyRaw))\n\t}\n\n\tvar tokenResponse tokenEndpointResponse\n\terr = json.Unmarshal(bodyRaw, &tokenResponse)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif strings.ToLower(tokenResponse.TokenType) != \"bearer\" {\n\t\treturn nil, errors.New(\"unknown token type returned from token endpoint\")\n\t}\n\n\treturn &oauth2Token{\n\t\tToken: strings.TrimSpace(tokenResponse.AccessToken),\n\t\tExpiresAt: time.Now().Add(time.Duration(tokenResponse.ExpiresIn) * time.Second),\n\t}, nil\n}", "func (t *tokenSource) Token() (*oauth2.Token, error) {\n\treturn t.token, nil\n}", "func (t *tokenSource) Token() (*oauth2.Token, error) {\n\treturn t.token, nil\n}", "func NewChromeOSTokenSourceForAccount(ctx context.Context,\n\ttconn *chrome.TestConn, scopes []string, email string) oauth2.TokenSource {\n\treturn &chromeOSTokenSource{\n\t\tctx: ctx,\n\t\ttconn: tconn,\n\t\temail: email,\n\t\tscopes: scopes,\n\t}\n}", "func newClient(token string) *github.Client {\n\tts := oauth2.StaticTokenSource(\n\t\t&oauth2.Token{AccessToken: token},\n\t)\n\ttc := oauth2.NewClient(context.Background(), ts)\n\n\treturn github.NewClient(tc)\n}", "func newReloadingTokenSource(getToken func() []byte) *reloadingTokenSource {\n\treturn &reloadingTokenSource{\n\t\tgetToken: getToken,\n\t}\n}", "func (ts *apiTokenSource) Token() (*oauth2.Token, error) {\n\tts.m.Lock()\n\tdefer ts.m.Unlock()\n\tif ts.token.Valid() {\n\t\treturn ts.token, nil\n\t}\n\n\tresp, err := ts.requestToken()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := ts.treatResponseBody(resp.Body); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ts.token, nil\n}", "func (c *ChainedTokenCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (*azcore.AccessToken, error) {\n\tif c.successfulCredential != nil && !c.retrySources {\n\t\treturn c.successfulCredential.GetToken(ctx, opts)\n\t}\n\n\tvar errs []error\n\tfor _, cred := range c.sources {\n\t\ttoken, err := cred.GetToken(ctx, opts)\n\t\tif err == nil {\n\t\t\tlog.Writef(EventAuthentication, \"Azure Identity => %s authenticated with %s\", c.name, extractCredentialName(cred))\n\t\t\tc.successfulCredential = cred\n\t\t\treturn token, nil\n\t\t}\n\t\terrs = append(errs, err)\n\t\tif _, ok := err.(credentialUnavailableError); !ok {\n\t\t\tres := getResponseFromError(err)\n\t\t\tmsg := createChainedErrorMessage(errs)\n\t\t\treturn nil, newAuthenticationFailedError(c.name, msg, res)\n\t\t}\n\t}\n\t// if we get here, all credentials returned credentialUnavailableError\n\tmsg := createChainedErrorMessage(errs)\n\terr := newCredentialUnavailableError(c.name, msg)\n\tlog.Write(EventAuthentication, \"Azure Identity => ERROR: \"+err.Error())\n\treturn nil, err\n}", "func createOAuthClient(token string) *http.Client {\n\tctx := context.Background()\n\tsrc := oauth2.StaticTokenSource(&oauth2.Token{\n\t\tAccessToken: token,\n\t})\n\n\treturn oauth2.NewClient(ctx, src)\n}", "func NewClientFromBearerToken(req *http.Request) (Client, http.Header, error) {\n\tauthorization := req.Header.Get(\"Authorization\")\n\n\tfields := strings.Split(authorization, \" \")\n\tif len(fields) != 2 || fields[0] != \"Bearer\" {\n\t\treturn nil, nil, errMissingOrInvalidToken\n\t}\n\n\ttoken := oauth2.Token{\n\t\tTokenType: fields[0],\n\t\tAccessToken: fields[1],\n\t}\n\tclient, err := storage.NewClient(req.Context(), option.WithTokenSource(oauth2.StaticTokenSource(&token)))\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"creating client with token source: %v\", err)\n\t}\n\n\treturn GCSClient{client}, map[string][]string{\n\t\t\"Authorization\": []string{authorization},\n\t}, nil\n}", "func (d *Disco) SetCredentialsSource(src auth.CredentialsSource) {\n\td.credsSrc = src\n}", "func (settings FileSettings) ServicePrincipalTokenFromClientCredentialsWithResource(resource string) (*adal.ServicePrincipalToken, error) {\n\tif _, ok := settings.Values[ClientSecret]; !ok {\n\t\treturn nil, errors.New(\"missing client secret\")\n\t}\n\tconfig, err := adal.NewOAuthConfig(settings.getAADEndpoint(), settings.Values[TenantID])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn adal.NewServicePrincipalToken(*config, settings.Values[ClientID], settings.Values[ClientSecret], resource)\n}", "func (c *Client) NewSdkToken(ctx context.Context, id, referrer string) (*SdkToken, error) {\n\tt := &SdkToken{\n\t\tApplicantID: id,\n\t\tReferrer: referrer,\n\t}\n\tjsonStr, err := json.Marshal(t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := c.newRequest(\"POST\", \"/sdk_token\", bytes.NewBuffer(jsonStr))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resp SdkToken\n\tif _, err := c.do(ctx, req, &resp); err != nil {\n\t\treturn nil, err\n\t}\n\tt.Token = resp.Token\n\treturn t, err\n}", "func Credentials(ctx context.Context, scopes ...string) *google.Credentials {\n\treturn CredentialsEnv(ctx, envPrivateKey, scopes...)\n}", "func (ts *Source) Token() (*oauth2.Token, error) {\n\tif !ts.token.Valid() {\n\t\tts.Log(ts.mask, \"[TKN] token is not valid, it has probably expired\")\n\t\tif err := ts.refreshToken(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif err := ts.saveToken(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn ts.token, nil\n}", "func NewTokenCredentialAdapter(credential azcore.TokenCredential, scopes []string) autorest.Authorizer {\n\ttkPolicy := runtime.NewBearerTokenPolicy(credential, scopes, nil)\n\treturn &policyAdapter{\n\t\tpl: runtime.NewPipeline(\"azidext\", \"v0.4.0\", runtime.PipelineOptions{\n\t\t\tPerRetry: []policy.Policy{tkPolicy, nullPolicy{}},\n\t\t}, nil),\n\t}\n}", "func NewServiceAccountToken(fp string, isKeyFile bool) (*ServiceAccountToken, error) {\n\trv := &ServiceAccountToken{\n\t\tfilename: fp,\n\t}\n\t// Set the update function whether the provided file contains a cached token\n\t// or a service account keyfile.\n\trv.updateFn = rv.readTokenFromFile\n\tif isKeyFile {\n\t\tvar err error\n\t\trv.tokenSrc, err = auth.NewJWTServiceAccountTokenSource(context.TODO(), \"#bogus\", fp, \"\", \"\", compute.CloudPlatformScope, auth.ScopeUserinfoEmail)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trv.updateFn = rv.tokenSrc.Token\n\t}\n\treturn rv, rv.Update()\n}", "func (fts ErroringTokenSource) Token() (*oauth2.Token, error) {\n\treturn nil, errors.New(\"intentional error\")\n}", "func New(ctx context.Context, credentials, token string, opts ...ClientOption) (*Client, error) {\r\n\r\n\tclient := &Client{\r\n\t\tscope: \"https://www.googleapis.com/auth/spreadsheets.readonly\",\r\n\t}\r\n\r\n\tfor _, opt := range opts {\r\n\t\tclient = opt(client)\r\n\t}\r\n\r\n\treturn new(ctx, credentials, token, client)\r\n}", "func NewSourceProvider(config Config) *SourceProvider {\n\tconn := NewConnection(config)\n\treturn &SourceProvider{\n\t\tConfig: config,\n\t\tConnection: conn,\n\t\tTaskFlow: make(chan provider.Task),\n\t\tQuitChan: make(chan bool),\n\t}\n}", "func Token(c *gin.Context) {\n\n\tclientStorage, err := models.NewClientStorage(ginject.Deps(c))\n\tif err != nil {\n\t\tpanic(err)\n\t\treturn\n\t}\n\n\tmanager := models.NewManager(ginject.Deps(c))\n\n\tserver.InitServer(manager)\n\tserver.SetAllowedGrantType(oauth2.AuthorizationCode, oauth2.Refreshing)\n\tserver.SetAllowedResponseType(oauth2.Token)\n\n\tserver.SetClientInfoHandler(func(r *http.Request) (clientID, clientSecret string, err error) {\n\n\t\tcid := r.FormValue(\"client_id\")\n\n\t\tif cid == \"\" {\n\n\t\t}\n\n\t\tinfo, err := clientStorage.GetByID(cid)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tclientID = info.GetID()\n\t\tclientSecret = info.GetSecret()\n\t\treturn\n\t})\n\n\tserver.HandleTokenRequest(c)\n}", "func GetSourceCodeToken(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *SourceCodeTokenState, opts ...pulumi.ResourceOption) (*SourceCodeToken, error) {\n\tvar resource SourceCodeToken\n\terr := ctx.ReadResource(\"azure:appservice/sourceCodeToken:SourceCodeToken\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (c Config) NewClient(tok oauth2.Token) *Client {\n\tts := tokenSource{\n\t\ttoken: tok,\n\t\tconfig: c,\n\t}\n\t_ = ts\n\tb, _ := url.Parse(c.BaseURL)\n\treturn &Client{\n\t\tTokenSource: ts,\n\t\tClient: http.Client{\n\t\t\tTransport: &oauth2.Transport{\n\t\t\t\tBase: &Transport{BaseURL: b},\n\t\t\t\tSource: ts,\n\t\t\t},\n\t\t},\n\t}\n}", "func getGoogleTokenFromFile(file string) (*oauth2.Token, error) {\n\n\t// os.Open opens the credential file.\n\t// creates File object\n\tf, err := os.Open(file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// initialize Token object\n\tt := &oauth2.Token{}\n\n\t// json.NewDecoder returns a new decoder that reads from r.\n\t// the decoder introduces its own buddering and may read data\n\t// from r beyond the JSON values requested.\n\td := json.NewDecoder(f)\n\n\t// Decode reads the next JSON-encoded value from its input\n\t// and stores it in the value pointed to by v.\n\terr = d.Decode(t)\n\tdefer f.Close()\n\treturn t, err\n}", "func newSource(opts ...SourceOption) *sourcesv1alpha1.HTTPSource {\n\tsrc := &sourcesv1alpha1.HTTPSource{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: tNs,\n\t\t\tName: tName,\n\t\t\tUID: tUID,\n\t\t},\n\t\tSpec: sourcesv1alpha1.HTTPSourceSpec{\n\t\t\tSource: tSource,\n\t\t},\n\t}\n\n\tsrc.Status.InitializeConditions()\n\n\tfor _, opt := range opts {\n\t\topt(src)\n\t}\n\n\treturn src\n}", "func (ts *azureTokenSource) Token() (*azureToken, error) {\n\tts.lock.Lock()\n\tdefer ts.lock.Unlock()\n\n\tvar err error\n\ttoken := ts.cache.getToken(azureTokenKey)\n\n\tif token != nil && !token.token.IsExpired() {\n\t\treturn token, nil\n\t}\n\n\t// retrieve from config if no cache\n\tif token == nil {\n\t\ttokenFromCfg, err := ts.retrieveTokenFromCfg()\n\n\t\tif err == nil {\n\t\t\ttoken = tokenFromCfg\n\t\t}\n\t}\n\n\tif token != nil {\n\t\t// cache and return if the token is as good\n\t\t// avoids frequent persistor calls\n\t\tif !token.token.IsExpired() {\n\t\t\tts.cache.setToken(azureTokenKey, token)\n\t\t\treturn token, nil\n\t\t}\n\n\t\tklog.V(4).Info(\"Refreshing token.\")\n\t\ttokenFromRefresh, err := ts.Refresh(token)\n\t\tswitch {\n\t\tcase err == nil:\n\t\t\ttoken = tokenFromRefresh\n\t\tcase autorest.IsTokenRefreshError(err):\n\t\t\tklog.V(4).Infof(\"Failed to refresh expired token, proceed to auth: %v\", err)\n\t\t\t// reset token to nil so that the token source will be used to acquire new\n\t\t\ttoken = nil\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected error when refreshing token: %v\", err)\n\t\t}\n\t}\n\n\tif token == nil {\n\t\ttokenFromSource, err := ts.source.Token()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed acquiring new token: %v\", err)\n\t\t}\n\t\ttoken = tokenFromSource\n\t}\n\n\t// sanity check\n\tif token == nil {\n\t\treturn nil, fmt.Errorf(\"unable to acquire token\")\n\t}\n\n\t// corner condition, newly got token is valid but expired\n\tif token.token.IsExpired() {\n\t\treturn nil, fmt.Errorf(\"newly acquired token is expired\")\n\t}\n\n\terr = ts.storeTokenInCfg(token)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"storing the refreshed token in configuration: %v\", err)\n\t}\n\tts.cache.setToken(azureTokenKey, token)\n\n\treturn token, nil\n}" ]
[ "0.74979717", "0.7401055", "0.70478684", "0.70462215", "0.7018204", "0.7013672", "0.6994854", "0.69563544", "0.6934276", "0.68950164", "0.6852529", "0.6838926", "0.6566733", "0.6493974", "0.64755976", "0.64075357", "0.63987464", "0.63816744", "0.6311301", "0.6255845", "0.6236213", "0.62148416", "0.6172333", "0.615314", "0.611329", "0.6101506", "0.6006135", "0.5999053", "0.5910152", "0.58661383", "0.5844087", "0.5822731", "0.5811801", "0.57878125", "0.577386", "0.5749013", "0.5741592", "0.56212234", "0.5512078", "0.54932404", "0.5488484", "0.5486315", "0.54288495", "0.54228663", "0.53945506", "0.5391912", "0.53631216", "0.53590333", "0.5354607", "0.5327732", "0.5293619", "0.5288975", "0.5262917", "0.5249633", "0.52204764", "0.52184", "0.5209877", "0.5209877", "0.51496667", "0.51468015", "0.51454616", "0.51165134", "0.5115445", "0.51007855", "0.509807", "0.506307", "0.50311613", "0.50306505", "0.5020333", "0.49871963", "0.49871963", "0.49863034", "0.49862713", "0.49767163", "0.49757373", "0.4974377", "0.4974377", "0.49693817", "0.4949857", "0.49476585", "0.49344978", "0.49335757", "0.49291018", "0.49157667", "0.49052602", "0.48751166", "0.48312938", "0.48265323", "0.4821572", "0.48153564", "0.4794772", "0.47920808", "0.47867814", "0.47670457", "0.47658384", "0.47526658", "0.47372767", "0.47291675", "0.47164917", "0.47124854" ]
0.7532123
0
UpdateTarget updates target and returns wether did update or not.
UpdateTarget обновляет целевой объект и возвращает, было ли обновление выполнено.
func (s *syncer) UpdateTarget(projectID, instanceID string, credentials *Credentials) bool { updated := false if s.projectID != projectID { updated = true s.projectID = projectID } if s.instanceID != instanceID { updated = true s.instanceID = instanceID } // TODO: Consider deepCopy if !reflect.DeepEqual(s.credentials, credentials) { updated = true s.credentials = credentials } return updated }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (mr *ClientMockRecorder) UpdateTarget(arg0, arg1, arg2 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateTarget\", reflect.TypeOf((*Client)(nil).UpdateTarget), arg0, arg1, arg2)\n}", "func (m *Client) UpdateTarget(arg0 context.Context, arg1 int64, arg2 zendesk.Target) (zendesk.Target, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateTarget\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(zendesk.Target)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func NeedsUpdate() (bool, error) {\n\ttarget := findTarget()\n\tif target == nil {\n\t\treturn false, nil\n\t}\n\texists, err := target.isSetup()\n\treturn !exists, err\n}", "func (o *RequestTarget) HasTarget() bool {\n\tif o != nil && o.Target != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (t *Target) Update(newTarget *Target) {\n\tmutableMutex.Lock()\n defer mutableMutex.Unlock()\n\tt.Protocol = newTarget.Protocol\n\tt.Dest = newTarget.Dest\n\tt.TCPTLS = newTarget.TCPTLS\n\tt.HTTPMethod = newTarget.HTTPMethod\n\tt.HTTPStatusList = newTarget.HTTPStatusList\n\tt.Regexp = newTarget.Regexp\n\tt.ResSize = newTarget.ResSize\n\tt.Retry = newTarget.Retry\n\tt.RetryWait = newTarget.RetryWait\n\tt.Timeout = newTarget.Timeout\n\tt.TLSSkipVerify = newTarget.TLSSkipVerify\n}", "func (c *FakeAWSSNSTargets) Update(ctx context.Context, aWSSNSTarget *v1alpha1.AWSSNSTarget, opts v1.UpdateOptions) (result *v1alpha1.AWSSNSTarget, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateAction(awssnstargetsResource, c.ns, aWSSNSTarget), &v1alpha1.AWSSNSTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.AWSSNSTarget), err\n}", "func (o *SLOOverallStatuses) HasTarget() bool {\n\treturn o != nil && o.Target != nil\n}", "func (a *Agent) updateTarget() error {\n\tif a.episodes%a.UpdateTargetEpisodes == 0 {\n\t\tlog.Infof(\"updating target model - current steps %v target update %v\", a.steps, a.updateTargetSteps)\n\t\terr := a.Policy.(*model.Sequential).CloneLearnablesTo(a.TargetPolicy.(*model.Sequential))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (u *Updater) Update() (bool, error) {\n\tisPatched := false\n\tfor _, updater := range u.updaters {\n\t\tif !u.dryRun {\n\t\t\terr := updater.buildNewAndOldObject()\n\t\t\tif err != nil {\n\t\t\t\treturn false, errors.Annotatef(err, \"build components:\")\n\t\t\t}\n\t\t}\n\t\tisUpdated, err := updater.add(isPatched)\n\t\tisPatched = isPatched || u.isPatched || isUpdated\n\t\tif err != nil {\n\t\t\treturn false, errors.Annotatef(err, \"add/patch components:\")\n\t\t}\n\t\tif !u.dryRun {\n\t\t\terr = updater.remove()\n\t\t\tif err != nil {\n\t\t\t\treturn false, errors.Annotatef(err, \"remove components:\")\n\t\t\t}\n\t\t}\n\t}\n\treturn isPatched, nil\n}", "func UpdateTargetHandler(w http.ResponseWriter, r *http.Request) {\n\tenv := envFromRequest(r)\n\n\tip, _, err := net.SplitHostPort(r.RemoteAddr)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif err := r.ParseForm(); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tmac, scriptName, environment, params := parsePostForm(r.PostForm)\n\tif mac == \"\" || scriptName == \"\" {\n\t\thttp.Error(w, \"MAC address and target must not be empty\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tserver := server.New(mac, ip, \"\")\n\tinputErr, err := polling.UpdateTarget(\n\t\tenv.Logger, env.ServerStates, env.Templates, env.EventLog, env.BaseURL, server,\n\t\tscriptName, environment, params)\n\n\tif err != nil {\n\t\tif inputErr {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t} else {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t}\n\t\treturn\n\t}\n\thttp.Redirect(w, r, \"/\", http.StatusFound)\n}", "func (c *FakeCloudwatchEventTargets) Update(cloudwatchEventTarget *v1alpha1.CloudwatchEventTarget) (result *v1alpha1.CloudwatchEventTarget, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateAction(cloudwatcheventtargetsResource, c.ns, cloudwatchEventTarget), &v1alpha1.CloudwatchEventTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.CloudwatchEventTarget), err\n}", "func (a Actions) Update() bool {\n\tif len(a) != 1 {\n\t\treturn false\n\t}\n\n\treturn a[0] == ActionUpdate\n}", "func targetChanged(s1, s2 *core.BuildState, t1, t2 *core.BuildTarget) bool {\n\th1 := build.RuleHash(s1, t1, true, false)\n\th2 := build.RuleHash(s2, t2, true, false)\n\tif !bytes.Equal(h1, h2) {\n\t\treturn true\n\t}\n\th1, err1 := sourceHash(s1, t1)\n\th2, err2 := sourceHash(s2, t2)\n\treturn !bytes.Equal(h1, h2) || err1 != nil || err2 != nil\n}", "func (o *SearchSLOResponseDataAttributesFacets) HasTarget() bool {\n\tif o != nil && o.Target != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (s *TargetCRUD) Update(arg ...crud.Arg) (crud.Arg, error) {\n\tevent := eventFromArg(arg[0])\n\ttarget := targetFromStuct(event)\n\toldTarget, ok := event.OldObj.(*state.Target)\n\tif !ok {\n\t\tpanic(\"unexpected type, expected *state.Target\")\n\t}\n\tprint.DeletePrintln(\"deleting target\", *oldTarget.Target.Target,\n\t\t\"from upstream\", *oldTarget.Upstream.ID)\n\tprint.CreatePrintln(\"creating target\", *target.Target.Target,\n\t\t\"on upstream\", *target.Upstream.ID)\n\treturn target, nil\n}", "func (c *CoWIdler) Updated() bool {\n\treturn c.newStatus != nil\n}", "func (m *ParcelMock) DefaultTargetFinished() bool {\n\t// if expectation series were set then invocations count should be equal to expectations count\n\tif len(m.DefaultTargetMock.expectationSeries) > 0 {\n\t\treturn atomic.LoadUint64(&m.DefaultTargetCounter) == uint64(len(m.DefaultTargetMock.expectationSeries))\n\t}\n\n\t// if main expectation was set then invocations count should be greater than zero\n\tif m.DefaultTargetMock.mainExpectation != nil {\n\t\treturn atomic.LoadUint64(&m.DefaultTargetCounter) > 0\n\t}\n\n\t// if func was set then invocations count should be greater than zero\n\tif m.DefaultTargetFunc != nil {\n\t\treturn atomic.LoadUint64(&m.DefaultTargetCounter) > 0\n\t}\n\n\treturn true\n}", "func (p *Privmsg) IsValidTarget() bool {\n\treturn len(p.Target) > 0\n}", "func (p *Proxy) UpdateTargets(groups map[string][]*target.Target) error {\n\tp.targetsLock.Lock()\n\tdefer p.targetsLock.Unlock()\n\n\tnewTargets := map[uint64]*target.ScrapeStatus{}\n\tfor _, ts := range groups {\n\t\tfor _, t := range ts {\n\t\t\told := p.targets[t.Hash]\n\t\t\tif old == nil {\n\t\t\t\told = target.NewScrapeStatus(t.Series)\n\t\t\t}\n\t\t\tnewTargets[t.Hash] = old\n\t\t}\n\t}\n\tp.targets = newTargets\n\treturn nil\n}", "func (m *Mounter) HasTarget(targetPath string) (string, bool) {\n\tm.Lock()\n\tdefer m.Unlock()\n\n\tfor k, v := range m.mounts {\n\t\tfor _, p := range v.Mountpoint {\n\t\t\tif p.Path == targetPath {\n\t\t\t\treturn k, true\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\", false\n}", "func (e *Explore) UpdateTargets(targets map[string][]*discovery.SDTargets) {\n\te.targetsLock.Lock()\n\tdefer e.targetsLock.Unlock()\n\n\tfor job, ts := range targets {\n\t\tall := map[uint64]*exploringTarget{}\n\t\tfor _, t := range ts {\n\t\t\thash := t.ShardTarget.Hash\n\n\t\t\tif e.targets[job] != nil && e.targets[job][hash] != nil {\n\t\t\t\tall[hash] = e.targets[job][hash]\n\t\t\t} else {\n\t\t\t\tall[hash] = &exploringTarget{\n\t\t\t\t\tjob: job,\n\t\t\t\t\trt: target.NewScrapeStatus(0),\n\t\t\t\t\ttarget: t.ShardTarget,\n\t\t\t\t}\n\t\t\t\te.needExplore <- all[hash]\n\t\t\t}\n\t\t}\n\t\te.targets[job] = all\n\t}\n}", "func (b Block) CheckTarget(target Target) bool {\n\tblockHash := b.ID()\n\treturn bytes.Compare(target[:], blockHash[:]) >= 0\n}", "func checkBuildTarget(path string, update bool) bool {\n\tif f, err := os.Stat(path); err == nil {\n\t\tif update && !f.IsDir() {\n\t\t\tsylog.Fatalf(\"Only sandbox updating is supported.\")\n\t\t}\n\t\tif !update && !force {\n\t\t\treader := bufio.NewReader(os.Stdin)\n\t\t\tfmt.Print(\"Build target already exists. Do you want to overwrite? [N/y] \")\n\t\t\tinput, err := reader.ReadString('\\n')\n\t\t\tif err != nil {\n\t\t\t\tsylog.Fatalf(\"Error parsing input: %s\", err)\n\t\t\t}\n\t\t\tif val := strings.Compare(strings.ToLower(input), \"y\\n\"); val == 0 {\n\t\t\t\tforce = true\n\t\t\t} else {\n\t\t\t\tsylog.Errorf(\"Stopping build.\")\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}", "func (u *Updater) HasUpdate() (bool, error) {\n\treturn u.pkg.CanUpdate()\n}", "func (ctl *Ctl) CanUpdate() (bool, error) {\n\treturn true, nil\n}", "func (ctl *Ctl) CanUpdate() (bool, error) {\n\treturn true, nil\n}", "func VerifyTargetGroup() bool {\n\treturn defaultVerifyTargetGroup\n}", "func (me TxsdSystemCategory) IsTarget() bool { return me.String() == \"target\" }", "func (o *RequestStatusMetadata) HasTargets() bool {\n\tif o != nil && o.Targets != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (n *Sub) IsUpdate(w *model.Watcher) bool {\n\treturn n.w.Mtime.Unix() != w.Mtime.Unix()\n}", "func (o *RequestTarget) GetTargetOk() (*ResourceReference, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Target, true\n}", "func (p MetadataChangedPredicate) Update(e event.UpdateEvent) bool {\n\tif e.ObjectOld == nil {\n\t\treturn false\n\t}\n\n\tif e.ObjectNew == nil {\n\t\treturn false\n\t}\n\n\tmetaChanged := !reflect.DeepEqual(e.ObjectOld.GetLabels(), e.ObjectNew.GetLabels()) ||\n\t\t!reflect.DeepEqual(e.ObjectOld.GetAnnotations(), e.ObjectNew.GetAnnotations()) ||\n\t\t!reflect.DeepEqual(e.ObjectOld.GetFinalizers(), e.ObjectNew.GetFinalizers())\n\n\treturn metaChanged\n}", "func (c *rolloutContext) shouldVerifyTargetGroup(svc *corev1.Service) bool {\n\tif !defaults.VerifyTargetGroup() {\n\t\t// feature is disabled\n\t\treturn false\n\t}\n\tdesiredPodHash := c.newRS.Labels[v1alpha1.DefaultRolloutUniqueLabelKey]\n\tif c.rollout.Spec.Strategy.BlueGreen != nil {\n\t\tif c.rollout.Status.StableRS == desiredPodHash {\n\t\t\t// for blue-green, we only verify targets right after switching active service. So if\n\t\t\t// we are fully promoted, then there is no need to verify targets.\n\t\t\t// NOTE: this is the opposite of canary, where we only verify targets if stable == desired\n\t\t\treturn false\n\t\t}\n\t\tsvcPodHash := svc.Spec.Selector[v1alpha1.DefaultRolloutUniqueLabelKey]\n\t\tif svcPodHash != desiredPodHash {\n\t\t\t// we have not yet switched service selector\n\t\t\treturn false\n\t\t}\n\t\tif c.rollout.Status.BlueGreen.PostPromotionAnalysisRunStatus != nil {\n\t\t\t// we already started post-promotion analysis, so verification already occurred\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t} else if c.rollout.Spec.Strategy.Canary != nil {\n\t\tif c.rollout.Spec.Strategy.Canary.TrafficRouting == nil || c.rollout.Spec.Strategy.Canary.TrafficRouting.ALB == nil {\n\t\t\t// not ALB canary, so no need to verify targets\n\t\t\treturn false\n\t\t}\n\t\tif c.rollout.Status.StableRS != desiredPodHash {\n\t\t\t// for canary, we only verify targets right after switching stable service, which happens\n\t\t\t// after the update. So if stable != desired, we are still in the middle of an update\n\t\t\t// and there is no need to verify targets.\n\t\t\t// NOTE: this is the opposite of blue-green, where we only verify targets if stable != active\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n\t// should not get here\n\treturn false\n}", "func ShouldUpdate(rollout Rollout, nodeID storj.NodeID) bool {\n\treturn isRolloutCandidate(nodeID, rollout)\n}", "func (t *Target) GetAlive() (bool) {\n\tmutableMutex.Lock()\n defer mutableMutex.Unlock()\n\treturn t.alive\n}", "func (SourceChangePredicate) Update(e event.UpdateEvent) bool {\n\tif e.MetaOld == nil || e.MetaNew == nil {\n\t\t// ignore objects without metadata\n\t\treturn false\n\t}\n\tif e.MetaNew.GetGeneration() != e.MetaOld.GetGeneration() {\n\t\t// reconcile on spec changes\n\t\treturn true\n\t}\n\n\t// handle force sync\n\tif val, ok := e.MetaNew.GetAnnotations()[sourcev1.SyncAtAnnotation]; ok {\n\t\tif valOld, okOld := e.MetaOld.GetAnnotations()[sourcev1.SyncAtAnnotation]; okOld {\n\t\t\tif val != valOld {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (c *CLIUpdater) IsUpdatable() (bool, error) {\n\texecutablePath, err := osext.Executable()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\terr = unix.Access(executablePath, unix.W_OK)\n\tif err == nil {\n\t\treturn true, nil\n\t}\n\t// File is not writable, check if the current user is owner.\n\ts := &unix.Stat_t{}\n\terr = unix.Stat(executablePath, s)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif int(s.Uid) != os.Getuid() {\n\t\treturn false, nil\n\t}\n\treturn true, nil\n}", "func (c *rolloutContext) areTargetsVerified() bool {\n\treturn c.targetsVerified == nil || *c.targetsVerified\n}", "func (op *UpdateTensorboardOperation) Done() bool {\n\treturn op.lro.Done()\n}", "func DoesTargetMatchPods(spec accessClient.TrafficTargetSpec, srcPod *corev1.Pod, dstPod *corev1.Pod) bool {\n\treturn cli.DoesTargetRefDstPod(spec, dstPod) && cli.DoesTargetRefSrcPod(spec, srcPod)\n}", "func (r *Elasticsearch) Update() bool {\n\treturn true\n}", "func (op *UpdateSnapshotOperation) Done() bool {\n\treturn op.lro.Done()\n}", "func TestApplyAddTargetTwice(t *testing.T) {\n\trepo, _, err := testutils.EmptyRepo(\"docker.com/notary\")\n\trequire.NoError(t, err)\n\t_, err = repo.InitTargets(data.CanonicalTargetsRole)\n\trequire.NoError(t, err)\n\thash := sha256.Sum256([]byte{})\n\tf := &data.FileMeta{\n\t\tLength: 1,\n\t\tHashes: map[string][]byte{\n\t\t\t\"sha256\": hash[:],\n\t\t},\n\t}\n\tfjson, err := json.Marshal(f)\n\trequire.NoError(t, err)\n\n\tcl := changelist.NewMemChangelist()\n\trequire.NoError(t, cl.Add(&changelist.TUFChange{\n\t\tActn: changelist.ActionCreate,\n\t\tRole: changelist.ScopeTargets,\n\t\tChangeType: \"target\",\n\t\tChangePath: \"latest\",\n\t\tData: fjson,\n\t}))\n\trequire.NoError(t, cl.Add(&changelist.TUFChange{\n\t\tActn: changelist.ActionCreate,\n\t\tRole: changelist.ScopeTargets,\n\t\tChangeType: \"target\",\n\t\tChangePath: \"latest\",\n\t\tData: fjson,\n\t}))\n\n\trequire.NoError(t, applyChangelist(repo, nil, cl))\n\trequire.Len(t, repo.Targets[\"targets\"].Signed.Targets, 1)\n\trequire.NotEmpty(t, repo.Targets[\"targets\"].Signed.Targets[\"latest\"])\n\n\trequire.NoError(t, applyTargetsChange(repo, nil, &changelist.TUFChange{\n\t\tActn: changelist.ActionCreate,\n\t\tRole: changelist.ScopeTargets,\n\t\tChangeType: \"target\",\n\t\tChangePath: \"latest\",\n\t\tData: fjson,\n\t}))\n\trequire.Len(t, repo.Targets[\"targets\"].Signed.Targets, 1)\n\trequire.NotEmpty(t, repo.Targets[\"targets\"].Signed.Targets[\"latest\"])\n}", "func (LabelsAndGenerationPredicate) Update(e event.UpdateEvent) bool {\n\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\n\t// reconcile if the labels have changed\n\treturn !reflect.DeepEqual(e.MetaOld.GetLabels(), e.MetaNew.GetLabels()) ||\n\t\te.MetaNew.GetGeneration() != e.MetaOld.GetGeneration()\n}", "func (a *HyperflexApiService) UpdateHyperflexTarget(ctx context.Context, moid string) ApiUpdateHyperflexTargetRequest {\n\treturn ApiUpdateHyperflexTargetRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func (p UserSignupChangedPredicate) Update(e runtimeevent.UpdateEvent) bool {\n\tif !checkMetaObjects(changedLog, e) {\n\t\treturn false\n\t}\n\treturn e.ObjectNew.GetGeneration() != e.ObjectOld.GetGeneration() ||\n\t\tp.annotationChanged(e, toolchainv1alpha1.UserSignupUserEmailAnnotationKey) ||\n\t\tp.labelChanged(e, toolchainv1alpha1.UserSignupUserEmailHashLabelKey)\n}", "func (qp QueryParsed) IsUpdate() bool {\n\treturn qp.Structure.GetKind() == lib.QueryKindCreate ||\n\t\tqp.Structure.GetKind() == lib.QueryKindDrop ||\n\t\tqp.Structure.GetKind() == lib.QueryKindDelete ||\n\t\tqp.Structure.GetKind() == lib.QueryKindInsert ||\n\t\tqp.Structure.GetKind() == lib.QueryKindUpdate\n}", "func (x *fastReflection_MsgUpdateParams) IsValid() bool {\n\treturn x != nil\n}", "func (o *Ga4ghChemotherapy) HasUpdated() bool {\n\tif o != nil && o.Updated != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (t *Texture) SetNeedsUpdate(value bool) *Texture {\n\tt.p.Set(\"needsUpdate\", value)\n\treturn t\n}", "func (p OwnerInNamespacePredicate) Update(e event.UpdateEvent) bool {\n\treturn p.ownerInNamespace(e.MetaNew.GetOwnerReferences())\n}", "func (o *Ga4ghTumourboard) HasUpdated() bool {\n\tif o != nil && o.Updated != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (_ *updateDebugPredicate) Update(evt event.UpdateEvent) bool {\n\tif os.Getenv(\"DEBUG_UPDATE\") == \"true\" {\n\t\tobj := fmt.Sprintf(\"%s/%s\", evt.ObjectNew.GetNamespace(), evt.ObjectNew.GetName())\n\t\tdiff, err := client.MergeFrom(evt.ObjectOld).Data(evt.ObjectNew)\n\t\tif err != nil {\n\t\t\tupdateDebugLog.Info(\"error generating diff\", \"err\", err, \"obj\", obj)\n\t\t} else {\n\t\t\tupdateDebugLog.Info(\"Update diff\", \"diff\", string(diff), \"obj\", obj)\n\t\t}\n\t}\n\treturn true\n}", "func (c *Candy) Update(g *Game) bool {\n\treturn c.state.Update(g, c)\n}", "func (c *ClusterStateImpl) instanceUpdateCompleted(asgName, instanceId string) bool {\n\treturn c.getInstanceState(asgName, instanceId) == updateCompleted\n}", "func (t *Target) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (s *Member) SetTargetName(v string) *Member {\n\ts.TargetName = &v\n\treturn s\n}", "func (t1 *Target) Equal(t2 *Target) bool {\n\treturn reflect.DeepEqual(t1.Target, t2.Target)\n}", "func (op *UpdateReplicationOperation) Done() bool {\n\treturn op.lro.Done()\n}", "func (s *txAllocState) Updated() bool {\n\treturn s.meta.Updated() || s.data.Updated()\n}", "func (kew *KeyspaceEventWatcher) TargetIsBeingResharded(ctx context.Context, target *querypb.Target) bool {\n\tif target.TabletType != topodatapb.TabletType_PRIMARY {\n\t\treturn false\n\t}\n\tks := kew.getKeyspaceStatus(ctx, target.Keyspace)\n\tif ks == nil {\n\t\treturn false\n\t}\n\treturn ks.beingResharded(target.Shard)\n}", "func (b *BrBuilder) CanUpdate() bool {\n\tfpath := filepath.Join(b.BuildPath, config.LatestBuildFile)\n\tif st, _ := os.Stat(fpath); st != nil && !st.IsDir() {\n\t\treturn true\n\t}\n\tlog.Trace(\"[Branch] Access build path %s failed.\", fpath)\n\treturn false\n}", "func (s *UpdateStatus) CheckUpdate(localVerStr string, remoteVerStr string, remoteAddr string) error {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\tif !s.seedSet.Has(remoteAddr) {\n\t\treturn nil\n\t}\n\n\tlocalVersion, err := gover.NewVersion(localVerStr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tremoteVersion, err := gover.NewVersion(remoteVerStr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif remoteVersion.GreaterThan(localVersion) {\n\t\tif s.versionStatus == noUpdate {\n\t\t\ts.versionStatus = hasUpdate\n\t\t}\n\n\t\tmaxVersion, err := gover.NewVersion(s.maxVerSeen)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif remoteVersion.GreaterThan(maxVersion) {\n\t\t\ts.maxVerSeen = remoteVerStr\n\t\t}\n\t}\n\tif remoteVersion.Segments()[0] > localVersion.Segments()[0] {\n\t\ts.versionStatus = hasMUpdate\n\t}\n\tif s.versionStatus != noUpdate {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"module\": logModule,\n\t\t\t\"Current version\": localVerStr,\n\t\t\t\"Newer version\": remoteVerStr,\n\t\t\t\"seed\": remoteAddr,\n\t\t}).Warn(\"Please update your bytomd via https://github.com/Bytom/bytom/releases/ or http://bytom.io/wallet/\")\n\t\ts.notified = true\n\t}\n\treturn nil\n}", "func (fs *FrameworkState) Update(ctx context.Context, b []byte) (stateChanged bool, err error) {\n\t// Operates in a locked environment.\n\n\tevent, err := ParseOperatorSubscribe(b)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"framework state update: %s\", err)\n\t}\n\n\tchanged := false\n\tswitch *event.Type {\n\tcase mesos_v1_master.Event_SUBSCRIBED:\n\t\tchanged = parseSubscribeEvent(fs, event)\n\tcase mesos_v1_master.Event_TASK_ADDED:\n\t\tchanged = parseTaskAddEvent(ctx, fs, event)\n\tcase mesos_v1_master.Event_TASK_UPDATED:\n\t\tchanged = parseTaskUpdateEvent(fs, event)\n\tcase mesos_v1_master.Event_AGENT_ADDED:\n\t\t// An agent may be re-added even if the agent was never removed, for\n\t\t// example if mesos agent restarts then it re-adds itself when coming\n\t\t// back.\n\t\tchanged = parseAgentAddEvent(fs, event)\n\tcase mesos_v1_master.Event_AGENT_REMOVED:\n\t\tchanged = parseAgentRemoveEvent(fs, event)\n\tcase mesos_v1_master.Event_UNKNOWN:\n\t\tlogger.Debug(\"mesos unknown mesos event\")\n\tdefault:\n\t\tlogger.WithField(\"type\", *event.Type).Debug(\"mesos unrecognized mesos event\")\n\t}\n\n\treturn changed, nil\n}", "func (DaemonSetStatusChangedPredicate) Update(e event.UpdateEvent) bool {\n\tnewDS := e.ObjectNew.DeepCopyObject().(*appsv1.DaemonSet)\n\toldDS := e.ObjectOld.DeepCopyObject().(*appsv1.DaemonSet)\n\tplog.V(2).Info(\"newDS\", \"nUNS:=\", newDS.Status.UpdatedNumberScheduled, \"oUNS:=\", oldDS.Status.UpdatedNumberScheduled, \"nDNS:=\", newDS.Status.DesiredNumberScheduled, \"nNR:=\", newDS.Status.NumberReady, \"nNA:=\", newDS.Status.NumberAvailable)\n\tif newDS.Status.UpdatedNumberScheduled >= oldDS.Status.UpdatedNumberScheduled {\n\t\tif (newDS.Status.UpdatedNumberScheduled == newDS.Status.NumberReady) &&\n\t\t\t(newDS.Status.UpdatedNumberScheduled == newDS.Status.NumberAvailable) {\n\t\t\treturn true\n\t\t}\n\t}\n\tif e.MetaOld == nil {\n\t\tplog.Error(nil, \"Update event has no old metadata\", \"event\", e)\n\t\treturn false\n\t}\n\tif e.ObjectOld == nil {\n\t\tplog.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\tplog.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\tplog.Error(nil, \"Update event has no new metadata\", \"event\", e)\n\t\treturn false\n\t}\n\tif e.MetaNew.GetGeneration() == e.MetaOld.GetGeneration() {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func HasUpdate(dir string) error {\n\th, err := hasUpdate(federalRevenueURL, dir)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error getting updated at: %w\", err)\n\t}\n\tif !h {\n\t\tos.Exit(1)\n\t}\n\treturn nil\n}", "func (x *fastReflection_MsgUpdateParamsResponse) IsValid() bool {\n\treturn x != nil\n}", "func (op *UpdateActiveDirectoryOperation) Done() bool {\n\treturn op.lro.Done()\n}", "func (op *UpdateVolumeOperation) Done() bool {\n\treturn op.lro.Done()\n}", "func (op *UpdateJobOperation) Done() bool {\n\treturn op.lro.Done()\n}", "func IsUpdate() bool {\n\tdataDir, err := FindDirectory(DataDirectory)\n\tif err != nil {\n\t\treturn false\n\t}\n\tif _, err := os.Stat(filepath.Join(dataDir, \"containerservice.yaml\")); err == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "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}", "func (tc *Configs) Target(name string) (*Target, bool) {\n\tfilePrefix, target := splitTarget(name)\n\tfor _, tf := range tc.Files {\n\t\tif filePrefix != \"\" && tf.Basename() != filePrefix {\n\t\t\tcontinue\n\t\t}\n\t\ttarget, ok := tf.Targets[target]\n\t\tif ok {\n\t\t\treturn target, ok\n\t\t}\n\t}\n\treturn nil, false\n}", "func (a *AdminApiService) ModifyTarget(ctx _context.Context, id string, target Target) (Target, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPatch\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue Target\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/admin/target/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.QueryEscape(parameterToString(id, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"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 = &target\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 == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 409 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\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}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (t *Target) EqualTo(other Target) bool {\n\treturn t.Host == other.Host &&\n\t\tt.Port == other.Port\n}", "func (o *SLOOverallStatuses) GetTargetOk() (*float64, bool) {\n\tif o == nil || o.Target == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Target, true\n}", "func (p OwnersOwnerInNamespacePredicate) Update(e event.UpdateEvent) bool {\n\treturn p.ownersOwnerInNamespace(e.MetaNew.GetOwnerReferences())\n}", "func FilterTarget(opt Options, store *core.StoreInfo, filters []Filter) bool {\n\tstoreID := fmt.Sprintf(\"store%d\", store.GetId())\n\tfor _, filter := range filters {\n\t\tif filter.FilterTarget(opt, store) {\n\t\t\tlog.Debugf(\"[filter %T] filters store %v from target\", filter, store)\n\t\t\tfilterCounter.WithLabelValues(\"filter-target\", storeID, filter.Type()).Inc()\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (s *RepositorySyncDefinition) SetTarget(v string) *RepositorySyncDefinition {\n\ts.Target = &v\n\treturn s\n}", "func (m *StorageMock) MinimockUpdateDone() bool {\n\tfor _, e := range m.UpdateMock.expectations {\n\t\tif mm_atomic.LoadUint64(&e.Counter) < 1 {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// if default expectation was set then invocations count should be greater than zero\n\tif m.UpdateMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterUpdateCounter) < 1 {\n\t\treturn false\n\t}\n\t// if func was set then invocations count should be greater than zero\n\tif m.funcUpdate != nil && mm_atomic.LoadUint64(&m.afterUpdateCounter) < 1 {\n\t\treturn false\n\t}\n\treturn true\n}", "func (pa *PodAutoscaler) Target() (float64, bool) {\n\treturn pa.annotationFloat64(autoscaling.TargetAnnotation)\n}", "func (agent *Agent) update_target_model() {\n\tagent.target_model = agent.model\n}", "func AutoUpdate(pjPath string, out output.Outputer) (updated bool, resultVersion string) {\n\tif versionInfo, _ := projectfile.ParseVersionInfo(pjPath); versionInfo != nil {\n\t\treturn false, \"\"\n\t}\n\n\t// Check for an update, but timeout after one second.\n\tlogging.Debug(\"Checking for updates.\")\n\tupdate := Updater{\n\t\tCurrentVersion: constants.Version,\n\t\tAPIURL: constants.APIUpdateURL,\n\t\tCmdName: constants.CommandName,\n\t}\n\tseconds := 1\n\tif secondsOverride := os.Getenv(constants.AutoUpdateTimeoutEnvVarName); secondsOverride != \"\" {\n\t\toverride, err := strconv.Atoi(secondsOverride)\n\t\tif err == nil {\n\t\t\tseconds = override\n\t\t}\n\t}\n\tinfo, err := timeout(update.Info, time.Duration(seconds)*time.Second)\n\tif err != nil {\n\t\tif err.Error() != \"timeout\" {\n\t\t\tlogging.Error(\"Unable to automatically check for updates: %s\", err)\n\t\t} else {\n\t\t\tlogging.Debug(\"Automatically checking for updates timed out\")\n\t\t}\n\t\treturn false, \"\"\n\t} else if info == nil {\n\t\tlogging.Debug(\"No update available.\")\n\t\treturn false, \"\"\n\t}\n\n\t// Self-update.\n\tlogging.Debug(\"Self-updating.\")\n\terr = update.Run(out, true)\n\tif err != nil {\n\t\tlog := logging.Error\n\t\tif os.IsPermission(errs.InnerError(err)) {\n\t\t\tout.Error(locale.T(\"auto_update_permission_err\"))\n\t\t}\n\t\tif errors.As(err, new(*osutils.AlreadyLockedError)) {\n\t\t\tlog = logging.Debug\n\t\t}\n\t\tlog(\"Unable to self update: %s\", err)\n\t\treturn false, \"\"\n\t}\n\n\treturn true, info.Version\n}", "func (c *Client) NeedsUpdate(ctx context.Context) (bool, error) {\n\tmeta, err := c.GetMetadata()\n\tif err != nil {\n\t\treturn true, nil\n\t}\n\n\t// No need to update if it's been within a day since the last update.\n\tif c.clock.Now().Before(meta.DownloadedAt.Add(updateInterval)) {\n\t\treturn false, nil\n\t}\n\n\tif err = c.populateOCIArtifact(); err != nil {\n\t\treturn false, xerrors.Errorf(\"OPA bundle error: %w\", err)\n\t}\n\n\tdigest, err := c.artifact.Digest(ctx)\n\tif err != nil {\n\t\treturn false, xerrors.Errorf(\"digest error: %w\", err)\n\t}\n\n\tif meta.Digest != digest {\n\t\treturn true, nil\n\t}\n\n\t// Update DownloadedAt with the current time.\n\t// Otherwise, if there are no updates in the remote registry,\n\t// the digest will be fetched every time even after this.\n\tif err = c.updateMetadata(meta.Digest, time.Now()); err != nil {\n\t\treturn false, xerrors.Errorf(\"unable to update the policy metadata: %w\", err)\n\t}\n\n\treturn false, nil\n}", "func (s *ResourceSyncAttempt) SetTarget(v string) *ResourceSyncAttempt {\n\ts.Target = &v\n\treturn s\n}", "func (s *peerRESTServer) TargetExistsHandler(w http.ResponseWriter, r *http.Request) {\n\tctx := newContext(r, w, \"TargetExists\")\n\tif !s.IsValid(w, r) {\n\t\ts.writeErrorResponse(w, errors.New(\"Invalid request\"))\n\t\treturn\n\t}\n\n\tvars := mux.Vars(r)\n\tbucketName := vars[peerRESTBucket]\n\tif bucketName == \"\" {\n\t\ts.writeErrorResponse(w, errors.New(\"Bucket name is missing\"))\n\t\treturn\n\t}\n\tvar targetID event.TargetID\n\tif r.ContentLength <= 0 {\n\t\ts.writeErrorResponse(w, errInvalidArgument)\n\t\treturn\n\t}\n\n\terr := gob.NewDecoder(r.Body).Decode(&targetID)\n\tif err != nil {\n\t\ts.writeErrorResponse(w, err)\n\t\treturn\n\t}\n\n\tvar targetExists remoteTargetExistsResp\n\ttargetExists.Exists = globalNotificationSys.RemoteTargetExist(bucketName, targetID)\n\n\tdefer w.(http.Flusher).Flush()\n\tlogger.LogIf(ctx, gob.NewEncoder(w).Encode(&targetExists))\n}", "func (s *DataStore) UpdateBackupTargetStatus(backupTarget *longhorn.BackupTarget) (*longhorn.BackupTarget, error) {\n\tobj, err := s.lhClient.LonghornV1beta2().BackupTargets(s.namespace).UpdateStatus(context.TODO(), backupTarget, metav1.UpdateOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tverifyUpdate(backupTarget.Name, obj, func(name string) (runtime.Object, error) {\n\t\treturn s.GetBackupTargetRO(name)\n\t})\n\treturn obj, nil\n}", "func (o *RequestStatusMetadata) GetTargetsOk() (*[]RequestTarget, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Targets, true\n}", "func (i *InvalidateDeadline) SetTarget(t time.Time) {\n\ti.Active = true\n\ti.Target = t\n}", "func (c *FakeAWSSNSTargets) UpdateStatus(ctx context.Context, aWSSNSTarget *v1alpha1.AWSSNSTarget, opts v1.UpdateOptions) (*v1alpha1.AWSSNSTarget, error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewUpdateSubresourceAction(awssnstargetsResource, \"status\", c.ns, aWSSNSTarget), &v1alpha1.AWSSNSTarget{})\n\n\tif obj == nil {\n\t\treturn nil, err\n\t}\n\treturn obj.(*v1alpha1.AWSSNSTarget), err\n}", "func (l Lambda) IsUpdatable() bool {\n\treturn l.updatable\n}", "func hasUpdateArg(args []string) bool {\n\tfor _, arg := range args {\n\t\tif ArgWorkflowUpdate == arg {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func vnodeNeedsUpdate(desired *appmeshv1beta1.VirtualNode, target *aws.VirtualNode) bool {\n\tif desired.Spec.ServiceDiscovery != nil &&\n\t\tdesired.Spec.ServiceDiscovery.Dns != nil {\n\t\t// If Service discovery is desired, verify target is equal\n\t\tif desired.Spec.ServiceDiscovery.Dns.HostName != target.HostName() {\n\t\t\treturn true\n\t\t}\n\t} else {\n\t\t// If no desired Service Discovery, verify target is not set\n\t\tif target.HostName() != \"\" {\n\t\t\treturn true\n\t\t}\n\t}\n\n\tif desired.Spec.Listeners != nil {\n\t\tdesiredSet := set.NewSet()\n\t\tfor i := range desired.Spec.Listeners {\n\t\t\tdesiredSet.Add(desired.Spec.Listeners[i])\n\t\t}\n\t\tcurrSet := target.ListenersSet()\n\t\tif !desiredSet.Equal(currSet) {\n\t\t\treturn true\n\t\t}\n\t} else {\n\t\t// If the spec doesn't have any listeners, make sure target is not set\n\t\tif len(target.Listeners()) != 0 {\n\t\t\treturn true\n\t\t}\n\t}\n\n\t// This needs to be updated since AppMesh VN name isn't the same as k8s VN name.\n\tif desired.Spec.Backends != nil {\n\t\tdesiredSet := set.NewSet()\n\t\tfor i := range desired.Spec.Backends {\n\t\t\tdesiredSet.Add(desired.Spec.Backends[i])\n\t\t}\n\t\tcurrSet := target.BackendsSet()\n\t\tif !desiredSet.Equal(currSet) {\n\t\t\treturn true\n\t\t}\n\t} else {\n\t\t// If the spec doesn't have any backends, make sure target is not set\n\t\tif len(target.Backends()) != 0 {\n\t\t\treturn true\n\t\t}\n\t}\n\n\tif vnodeLoggingNeedsUpdate(desired, target) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (clt *SMServiceClient) IsDemandTarget(dm Demand, idlist []uint64) bool {\n\tdmid := dm.TargetId\n\tfor _, id := range idlist {\n\t\tif id == dmid {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func SatisfiesTargetValue(targetValue int64, minChange int64, utxos []*common.UTXO) bool {\n\ttotalValue := int64(0)\n\tfor _, utxo := range utxos {\n\t\ttotalValue += utxo.Value\n\t}\n\n\treturn (totalValue == targetValue || totalValue >= targetValue+minChange)\n}", "func (o *SLOOverallStatuses) SetTarget(v float64) {\n\to.Target = &v\n}", "func (req *DronaRequest) IsDnUpdate() bool {\n\treq.Lock()\n\tdefer req.Unlock()\n\treturn !req.processed\n}", "func (s *TestExecutionSummary) SetTarget(v *TestExecutionTarget) *TestExecutionSummary {\n\ts.Target = v\n\treturn s\n}", "func IsUpdateNeeded(filepath string, updateInterval time.Duration) (bool, error) {\n\tinfo, err := os.Stat(filepath)\n\tif os.IsNotExist(err) {\n\t\treturn true, ResetUpdateTime(filepath)\n\t} else if err != nil {\n\t\treturn false, err\n\t}\n\n\ttimeSinceMod := time.Since(info.ModTime())\n\n\tif timeSinceMod >= updateInterval {\n\t\treturn true, nil\n\t}\n\n\treturn false, nil\n}", "func (p *ClientUpdatePoller) Done() bool {\n\treturn p.pt.Done()\n}" ]
[ "0.6614034", "0.64920354", "0.6105699", "0.60342765", "0.6030683", "0.59310377", "0.5721925", "0.56897306", "0.56685436", "0.5625591", "0.5597833", "0.55948585", "0.55275893", "0.5479221", "0.5437466", "0.5431092", "0.5352646", "0.53513056", "0.5247706", "0.52319986", "0.5218859", "0.5126008", "0.5123713", "0.5102578", "0.50980705", "0.50980705", "0.5077669", "0.5068585", "0.504985", "0.5047485", "0.5029949", "0.50288457", "0.49995494", "0.49883005", "0.49707618", "0.4969256", "0.49562407", "0.49236235", "0.49181753", "0.4887698", "0.48850834", "0.48804533", "0.48715234", "0.48534343", "0.48514205", "0.48442078", "0.48311225", "0.48306647", "0.48262447", "0.48238328", "0.48171017", "0.479466", "0.47933492", "0.478729", "0.47868702", "0.47794142", "0.47716722", "0.4770499", "0.4768803", "0.4763252", "0.47622558", "0.4748089", "0.47319576", "0.4730715", "0.47262576", "0.47218654", "0.47106868", "0.4709026", "0.47065383", "0.47061", "0.47012338", "0.46982333", "0.46900722", "0.4689173", "0.4662192", "0.4657857", "0.46552193", "0.46472454", "0.4637955", "0.46331123", "0.46259266", "0.4620435", "0.46172634", "0.46153527", "0.46128142", "0.46062654", "0.46053547", "0.46003383", "0.45993", "0.45987377", "0.45937958", "0.45933825", "0.4590953", "0.45874238", "0.45827252", "0.45759052", "0.4574269", "0.45631516", "0.45609513", "0.45585743" ]
0.73240125
0
Start spins up a goroutine that continously polls given API endpoint at interval Poller.Interval
Start запускает го-рутину, которая непрерывно опрашивает заданный API-конечный пункт с интервалом Poller.Interval
func (p *Poller) Start() { go func(url string, interval time.Duration, out chan<- PollMsg, shutdown <-chan *sync.WaitGroup) { wg := &sync.WaitGroup{} defer func() { wg.Done() }() ticker := time.NewTicker(interval) msg := PollMsg{} resp, err := http.Get(url) if err != nil { msg.Error = append(msg.Error, err) } data, err2 := ioutil.ReadAll(resp.Body) if err2 != nil { msg.Error = append(msg.Error, err2) } msg.Payload = data out <- msg resp.Body.Close() for { select { case wg = <-shutdown: return case <-ticker.C: msg := PollMsg{} resp, err := http.Get(url) if err != nil { msg.Error = append(msg.Error, err) } data, err2 := ioutil.ReadAll(resp.Body) if err2 != nil { msg.Error = append(msg.Error, err2) } msg.Payload = data out <- msg resp.Body.Close() } } }(p.URL, p.Interval, p.Out, p.Shutdown) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *AutoScaler) Run() {\n\tticker := s.clock.NewTicker(s.pollPeriod)\n\ts.readyCh <- struct{}{} // For testing.\n\n\t// Don't wait for ticker and execute pollAPIServer() for the first time.\n\ts.pollAPIServer()\n\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C():\n\t\t\ts.pollAPIServer()\n\t\tcase <-s.stopCh:\n\t\t\treturn\n\t\t}\n\t}\n}", "func (p *Poller) Start() {\n\tif p.IsStopped() {\n\t\tpanic(\"cannot restart poller after it has been stopped\")\n\t}\n\n\tp.group.Add(1)\n\tgo p.runPolling()\n}", "func (s *Service) Start(ctx context.Context) <-chan error {\n\ttick := make(chan error, 1)\n\n\tif s.Interval <= 0 {\n\t\ttick <- errors.New(\"cannot run poll service for non-positive interval\")\n\t\tclose(tick)\n\t\treturn tick\n\t}\n\n\tgo func(c context.Context, t chan<- error, interval time.Duration) {\n\t\t// update once when the service starts.\n\t\tt <- nil\n\n\t\tticker := time.NewTicker(interval)\n\t\tdefer ticker.Stop()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ticker.C:\n\t\t\t\tt <- nil\n\n\t\t\tcase <-ctx.Done():\n\t\t\t\tt <- ctx.Err()\n\t\t\t\tclose(t)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}(ctx, tick, time.Duration(s.Interval))\n\n\treturn tick\n}", "func (p *APIPingProbe) Start() error {\n\tif p.Active {\n\t\treturn nil\n\t}\n\n\tt := time.Duration(p.Config.Frequency * float64(time.Second))\n\twriteTicker := time.NewTicker(t)\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-p.StopChannel:\n\t\t\t\treturn\n\t\t\tcase <-writeTicker.C:\n\t\t\t\tgo p.PingAPI()\n\t\t\t}\n\t\t}\n\t}()\n\n\tp.Active = true\n\treturn nil\n}", "func (w *IndexPoller) Start() {\n\tw.channel <- w.run()\n\tticker := time.NewTicker(w.pollRate)\n\tfor {\n\t\tselect {\n\t\tcase <-w.controlChannel:\n\t\t\tdefer close(w.channel)\n\t\t\tticker.Stop()\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t\tw.channel <- w.run()\n\t\t}\n\t}\n}", "func (m *Microservice) StartOperationPolling() {\n\tinterval := m.Config.viper.GetString(\"agent.operations.pollRate\")\n\n\tzap.S().Infof(\"Adding operation polling task with interval: %s\", interval)\n\t_, err := m.Scheduler.cronjob.AddFunc(interval, func() {\n\t\tm.CheckForNewConfiguration()\n\t})\n\n\tif err != nil {\n\t\tzap.S().Errorf(\"Could not create polling task with interval [%s]. %s\", interval, err)\n\t}\n}", "func (f *Input) startPoller(ctx context.Context) {\n\tf.wg.Add(1)\n\tgo func() {\n\t\tdefer f.wg.Done()\n\t\tglobTicker := time.NewTicker(f.PollInterval)\n\t\tdefer globTicker.Stop()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase <-globTicker.C:\n\t\t\t}\n\n\t\t\tf.poll(ctx)\n\t\t}\n\t}()\n}", "func (p *StreamingEndpointsStartPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "func (e *EndpointsManager) Run() {\n\tticker := time.NewTicker(time.Second * 10)\n\tdefer ticker.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\te.watchAliveEndpoint()\n\t\tcase <-e.exit:\n\t\t\tclose(e.closed)\n\t\t\tcommon.Logger.Info(\"service done!!!\")\n\t\t\treturn\n\t\t}\n\t}\n}", "func (d *Daemon) Start(interval int, data chan *structs.Data) {\n\t// immediately fetch the first set of data and send it over the data channel\n\td.fetchData()\n\td.buildData()\n\n\tselect {\n\tcase data <- d.Data:\n\t\tlogger.Trace(\"Sending initial results on the 'data' channel\")\n\tdefault:\n\t\tlogger.Trace(\"Could not send initial results on the 'data' channel\")\n\t}\n\n\t// fetch new data every interval\n\tduration := time.Duration(interval) * time.Second\n\tfor _ = range time.Tick(duration) {\n\t\td.resetData()\n\t\td.fetchData()\n\t\td.buildData()\n\n\t\t// send the result over the data channel\n\t\tselect {\n\t\tcase data <- d.Data:\n\t\t\tlogger.Trace(\"Sending results on the 'data' channel\")\n\t\tdefault:\n\t\t\tlogger.Trace(\"Could not send results on the 'data' channel\")\n\t\t}\n\t}\n}", "func (s *Store) startPoller() {\n\tfor {\n\t\tselect {\n\t\tcase req := <-s.getReqQueue:\n\t\t\treq.respCh <- s.performGetOperation(req.key)\n\n\t\tcase req := <-s.modifyReqQueue:\n\t\t\terr := s.performModifyOperation(req)\n\t\t\treq.respCh <- err\n\n\t\t\ts.fanOutSubscriptions(req)\n\n\t\tcase sub := <-s.subscribeQueue:\n\t\t\ts.registerSubscription(sub)\n\t\t}\n\t}\n}", "func StartPing(interval time.Duration){\n\tlog.Println(\"Ping Time\")\n\tpinging := true\n\tfor pinging {\n\t\tpinging = false\n\t\tlog.Print(\"Pinging set to \" + strconv.FormatBool(pinging))\n\n\t\tif shouldIPing() {\n\t\t\tpinging = true\n\t\t\tlog.Print(\"Pinging set to \" + strconv.FormatBool(pinging))\n\n\t\t\tbullyImpl.SetIsCoordinatorAlive(false)\n\t\t\tlog.Print(bullyImpl.IsCoordinatorAlive())\n\t\t\tbullyImpl.GetMoi().Ping(bullyImpl.GetCoordinator())\n\n\t\t\ttimer := time.NewTimer(interval)\n\t\t\tselect {\n\t\t\tcase <- endTimer:\n\t\t\t\tlog.Print(\"Pinging was ended\")\n\t\t\tcase <- timer.C:\n\t\t\t\tif shouldIPing() && !bullyImpl.IsCoordinatorAlive() {\n\t\t\t\t\tpinging = false\n\t\t\t\t\tlog.Print(\"Pinging set to \" + strconv.FormatBool(pinging))\n\t\t\t\t\tlog.Print(\"Coordinator is not alive, launching a new Election\")\n\t\t\t\t\tgo func(){ electionChannel <- struct{}{} }()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (b *Bootstrapper) Start() {\n\tb.ctx, b.cancel = context.WithCancel(b.ctx)\n\tb.ticker = time.NewTicker(b.config.Period)\n\n\tgo func() {\n\t\tdefer b.ticker.Stop()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-b.ctx.Done():\n\t\t\t\treturn\n\t\t\tcase <-b.ticker.C:\n\t\t\t\tb.checkConnectivity()\n\t\t\t}\n\t\t}\n\t}()\n}", "func (p *Prober) Start() {\n\t// Get static copy of the config object\n\tcfg := p.config.Copy()\n\n\tfor _, svc := range cfg.Monitor.Services {\n\t\t// Create new Probe Bot and start it\n\t\tif svc.Interval == 0 {\n\t\t\tsvc.Interval = cfg.Monitor.Interval\n\t\t}\n\n\t\tgo NewProbeBot(\n\t\t\tp.eb,\n\t\t\tsvc,\n\t\t\tp.status.Update,\n\t\t).Start()\n\t}\n}", "func (p *Poller) runPolling() {\n\tfor !p.IsStopped() {\n\t\tif res := p.Poll(); res != nil {\n\t\t\tp.sendResult(res)\n\t\t}\n\t\ttime.Sleep(p.WaitInterval)\n\t}\n\tp.group.Done()\n\tp.isFinished = true\n}", "func (p *LiveEventsStartPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "func Start(host string, username string, password string, activeSeconds int, inactiveSeconds int, actionLevel string) {\n\tif !communication.TestConnectivity(host) {\n\t\tlog.Panic(\"The URL \" + host + \" is not the API Endpoint\")\n\t}\n\tvar login = authenticate.HandleLogin(username, password, host)\n\ttrigger.Run(login.Value, host, activeSeconds, inactiveSeconds, actionLevel)\n}", "func (m *Module) Start(initStartup bool) error {\n\tinterval := m.settings.FetchInterval\n\tif interval == 0 || interval < minFetchInterval {\n\t\tinterval = minFetchInterval\n\t}\n\n\t// Get some readings at start\n\tgo m.getReadings()\n\n\tm.ticker = time.NewTicker(time.Second * time.Duration(interval))\n\tgo func() {\n\t\tfor range m.ticker.C {\n\t\t\tm.getReadings()\n\t\t}\n\t}()\n\n\treturn nil\n}", "func (p *ServicesStartPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "func (r *MyMonitor) StartMonitoring(urlinfo st.URLInfo) {\n\n\tgo func() {\n\t\tticker := time.NewTicker(time.Duration(urlinfo.Frequency) * time.Second) // trigers at rate of Frequency\n\t\trequestStatus := make(chan string) // result of http request will come on requestStatus channel\n\t\tdataBase := database.GetDatabase()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase idStop := <-r.MonitorStp: // if deactivated Monitoring\n\t\t\t\tif idStop == urlinfo.ID { // check if this url need to be Deactivate\n\t\t\t\t\treturn // stop monitering\n\t\t\t\t}\n\t\t\tcase <-ticker.C: // at Frequency time\n\t\t\t\tfmt.Printf(\"Request to %s\\t\", urlinfo.URL)\n\t\t\t\tgo Request(urlinfo.URL, urlinfo.CrawlTimeout, requestStatus)\n\t\t\tcase st := <-requestStatus: // if status for request comes\n\t\t\t\tfmt.Println(\"Status: \", st)\n\t\t\t\t// if not 200 OK increase Failure count and update it to Database\n\t\t\t\t// if Failure count reaches to failure threshold then mark url inactive , stop crawling and update status into database\n\t\t\t\tif st != \"200 OK\" {\n\t\t\t\t\turlinfo.FailureCount++\n\t\t\t\t\tdataBase.UpdateColumnInDatabase(urlinfo.ID, \"failure_count\", urlinfo.FailureCount)\n\t\t\t\t\tif urlinfo.FailureCount == urlinfo.FailureThreshold {\n\t\t\t\t\t\tdataBase.UpdateColumnInDatabase(urlinfo.ID, \"status\", \"inactive\")\n\t\t\t\t\t\tdataBase.UpdateColumnInDatabase(urlinfo.ID, \"crawling\", false)\n\t\t\t\t\t\treturn //Stop Monitering\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n}", "func (r *PeriodicGoroutine) Start() {\n\tdefer close(r.finished)\n\nloop:\n\tfor {\n\t\tif shutdown, err := runPeriodicHandler(r.ctx, r.handler, r.operation); shutdown {\n\t\t\tbreak\n\t\t} else if h, ok := r.handler.(ErrorHandler); ok && err != nil {\n\t\t\th.HandleError(err)\n\t\t}\n\n\t\tselect {\n\t\tcase <-r.clock.After(r.interval):\n\t\tcase <-r.ctx.Done():\n\t\t\tbreak loop\n\t\t}\n\t}\n\n\tif h, ok := r.handler.(Finalizer); ok {\n\t\th.OnShutdown()\n\t}\n}", "func (bt *Esbeat) Polling(name string, host *url.URL, fetchData FuncFetchData) error {\n\tlogp.Info(\"esbeat-%s-%s is running\", name, host.String())\n\n\thttp := helper.NewHTTP(bt.config)\n\tticker := time.NewTicker(bt.config.Period)\n\n\tfor {\n\t\tselect {\n\t\tcase <-bt.done:\n\t\t\tlogp.Info(\"esbeat-%s-%s is stopping\", name, host.String())\n\t\t\treturn nil\n\t\tcase <-ticker.C:\n\t\t}\n\n\t\tbody, err := fetchData(http, host)\n\t\tif err != nil {\n\t\t\tlogp.Err(\"Error reading cluster node: %v\", err)\n\t\t} else {\n\t\t\tevent := common.MapStr{\n\t\t\t\t\"@timestamp\": common.Time(time.Now()),\n\t\t\t\t\"type\": name,\n\t\t\t\t\"url\": host.String(),\n\t\t\t\tname: body,\n\t\t\t}\n\t\t\tbt.client.PublishEvent(event)\n\t\t}\n\t}\n}", "func Start(h Handler) {\n for {\n log.Println(\"Polling ..!!\")\n resp, err := SqsService.Receive()\n\n if err != nil {\n log.Println(err)\n continue\n }\n\n if len(resp.Messages) > 0 {\n process(h, resp.Messages)\n }\n }\n}", "func startPeriodicHealthCheck(m *MicroService, interval time.Duration, d *net.Dialer) {\r\n\tticker := time.NewTicker(interval)\r\n\tdefer ticker.Stop()\r\n\tfor t := range ticker.C {\r\n\t\tlogVerbose(\"Checking health of Service:\", m.Route, \" ---tick:\", t)\r\n\t\thandleHealthCheck(m, d)\r\n\t}\r\n}", "func (p *Poller) Run() {\n\tgo util.Forever(func() {\n\t\te, err := p.getFunc()\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"failed to list: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tp.sync(e)\n\t}, p.period)\n}", "func (p *NotebookWorkspacesClientStartPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "func (c *TempController) Poll(w http.ResponseWriter, req *http.Request) {\n\tvar poll PollRequest\n\n\tbody, err := ioutil.ReadAll(io.LimitReader(req.Body, 500000))\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := req.Body.Close(); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := json.Unmarshal(body, &poll); err != nil {\n\t\trespondMessage(http.StatusNotAcceptable, w, err.Error())\n\t}\n\n\tswitch poll.Action {\n\tcase \"START\":\n\t\t//validate interval > 0\n\t\tif poll.IntervalMilliseconds <= 0 {\n\t\t\trespondMessage(http.StatusBadRequest, w, fmt.Sprintf(\"Expected intervalMilliseconds field > 0. Got %v\", poll.IntervalMilliseconds))\n\t\t\treturn\n\t\t}\n\n\t\t//call poller.start\n\t\terr = c.poller.Start(poll.IntervalMilliseconds)\n\n\t\tif err != nil {\n\t\t\trespondMessage(http.StatusInternalServerError, w, fmt.Sprintf(\"Error starting temperature poller. Error %v\", err))\n\t\t\treturn\n\t\t}\n\n\t\trespondMessage(http.StatusOK, w, fmt.Sprintf(\"Started polling temperature with interval %v\", poll.IntervalMilliseconds))\n\tcase \"STOP\":\n\t\t//call poller.stop\n\t\terr = c.poller.Stop()\n\n\t\tif err != nil {\n\t\t\trespondMessage(http.StatusInternalServerError, w, fmt.Sprintf(\"Error stopping temperature poller. Error %v\", err))\n\t\t\treturn\n\t\t}\n\n\t\trespondMessage(http.StatusOK, w, \"Stopped polling temperature.\")\n\tdefault:\n\t\trespondMessage(http.StatusBadRequest, w, fmt.Sprintf(\"Invalid 'action' value. Expected 'START' or 'STOP'. Got %v\", poll.Action))\n\t}\n}", "func (c *ProxyMarketClient) StartWatcher(updatedTime time.Duration) {\n\tgo func() {\n\t\tfor {\n\t\t\tres, err := c.GetProxyListAllByNewest()\n\t\t\tif err != nil {\n\t\t\t\ttime.Sleep(updatedTime * time.Millisecond)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tc.Proxies = res.List.Data\n\t\t\ttime.Sleep(updatedTime * time.Millisecond)\n\t\t}\n\t}()\n}", "func (sb *StatusBeater) Start(stopChan chan struct{}, publish func(event beat.Event)) {\n\tgo func() {\n\t\tsb.Beat(ServiceStarted, \"Service started\", publish)\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-sb.IntervalFunc():\n\t\t\t\tsb.Beat(ServiceRunning, \"Service is Running\", publish)\n\t\t\tcase <-stopChan:\n\t\t\t\tsb.Beat(ServiceStopped, \"Service is Stopped\", publish)\n\t\t\t\tsb.doneChan <- struct{}{}\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n}", "func (api *API) Start() {\n\t// timeout before forcing shutdown\n\twait := time.Second * 3\n\n\t// this is from the mux documentation\n\tsrv := &http.Server{\n\t\tAddr: api.IPPort,\n\t\t// Good practice to set timeouts to avoid Slowloris attacks.\n\t\tWriteTimeout: time.Second * 15,\n\t\tReadTimeout: time.Second * 15,\n\t\tIdleTimeout: time.Second * 60,\n\t\t//TOFIX ! load from config\n\t\tHandler: handlers.CORS(\n\t\t\thandlers.AllowedOrigins([]string{\"*\"}),\n\t\t\thandlers.AllowedMethods([]string{\"GET\", \"POST\", \"PUT\", \"DELETE\", \"OPTIONS\"}),\n\t\t\thandlers.AllowedHeaders([]string{\"X-Requested-With\", \"Content-Type\", \"X-Session-Token\"}),\n\t\t)(api.Router), // Pass our instance of gorilla/mux in.\n\t}\n\n\tgo func() {\n\t\tlog.Infof(\"API Listenning : %s, version : %s\", api.IPPort, api.Version)\n\t\tlog.Infof(\"API Endpoint : %s\", api.IPPort+api.Prefix)\n\t\tif err := srv.ListenAndServe(); err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}()\n\t// Block until we receive our signal.\n\t<-c\n\n\t// Create a deadline to wait for.\n\tctx, cancel := context.WithTimeout(context.Background(), wait)\n\tdefer cancel()\n\t// Doesn't block if no connections, but will otherwise wait\n\t// until the timeout deadline.\n\tsrv.Shutdown(ctx)\n\t// Optionally, you could run srv.Shutdown in a goroutine and block on\n\t// <-ctx.Done() if your application should wait for other services\n\t// to finalize based on context cancellation.\n\tlog.Println(\"shutting down\")\n\tos.Exit(0)\n}", "func (c *Client) RunDispatch() {\n for {\n time.Sleep(pollInterval)\n c.SendRequests()\n c.RecvResponses()\n }\n}", "func PollArtiMetricsRestEndpoint(artDetails *jfauth.ServiceDetails, intervalSecs int) {\n\tjflog.Info(fmt.Sprintf(\"Polling api/v1/metrics REST end point\"))\n\turl := \"api/v1/metrics\"\n\tfor {\n\t\tresp, err := getHttpResp(artDetails, url)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"GET HTTP failed for url : %s, resp = %s\\n\", url, resp)\n\t\t\tjflog.Error(fmt.Sprintf(\"GET HTTP failed for url : %s, resp = %s\", url, resp))\n\t\t}\n\t\ttime.Sleep(time.Duration(intervalSecs) * time.Second)\n\t}\n}", "func (p *pollerAutoScaler) Start() {\n\tlogger := p.logger.Sugar()\n\tp.wg.Add(1)\n\tgo func() {\n\t\tdefer p.wg.Done()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-p.ctx.Done():\n\t\t\t\treturn\n\t\t\tcase <-time.After(p.cooldownTime):\n\t\t\t\tcurrentResource := autoscaler.ResourceUnit(p.sem.GetLimit())\n\t\t\t\tcurrentUsages, err := p.pollerUsageEstimator.Estimate()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Warnw(\"poller autoscaler skip due to estimator error\", \"error\", err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tproposedResource := p.recommender.Recommend(currentResource, currentUsages)\n\t\t\t\tlogger.Debugw(\"poller autoscaler recommendation\",\n\t\t\t\t\t\"currentUsage\", currentUsages,\n\t\t\t\t\t\"current\", uint64(currentResource),\n\t\t\t\t\t\"recommend\", uint64(proposedResource),\n\t\t\t\t\t\"isDryRun\", p.isDryRun)\n\t\t\t\tif !p.isDryRun {\n\t\t\t\t\tp.sem.SetLimit(int(proposedResource))\n\t\t\t\t}\n\t\t\t\tp.pollerUsageEstimator.Reset()\n\n\t\t\t\t// hooks\n\t\t\t\tfor i := range p.onAutoScale {\n\t\t\t\t\tp.onAutoScale[i]()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\treturn\n}", "func (t Ticker) Start() {\n\t// Create new Kite ticker instance\n\tticker = kiteticker.New(t.APIKey, t.APIAccesToken)\n\tsubscriptions = t.Subscrptions\n\n\t// Assign callbacks\n\tticker.OnError(onError)\n\tticker.OnClose(onClose)\n\tticker.OnConnect(onConnect)\n\tticker.OnReconnect(onReconnect)\n\tticker.OnNoReconnect(onNoReconnect)\n\tticker.OnTick(onTick)\n\tticker.OnOrderUpdate(onOrderUpdate)\n\n\t// Start the connection\n\tticker.Serve()\n}", "func (pool *SubPool) Start() {\n\tfor {\n\t\tselect {\n\t\tcase sub := <-pool.Register:\n\t\t\tlog.Printf(\"Registering subscriber %v to pool\", sub.ID)\n\t\t\tpool.Subscribers = append(pool.Subscribers, sub)\n\t\t\tlog.Printf(\"Successfully registered subscriber %v to pool\", sub.ID)\n\t\tcase message := <-pool.Broadcast:\n\t\t\tlog.Printf(\"Broadcasting message to all subscribers...\")\n\t\t\tfor _, sub := range pool.Subscribers {\n\t\t\t\tif err := sub.connection.WriteJSON(message); err != nil {\n\t\t\t\t\tlog.Printf(\"Error writing message %v to subscriber %v\", message, sub.ID)\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-pool.StopChan:\n\t\t\tfor _, sub := range pool.Subscribers {\n\t\t\t\tlog.Printf(\"shutting down connection for subscriber %v...\", sub.ID)\n\t\t\t\tsub.connection.Close()\n\t\t\t}\n\t\t}\n\t}\n}", "func (mon Monitor) Start(ip string, port int, cloudFunctionsPattern string, chanAnalyzer chan []CloudService) {\n\n\tmon.cloudFunctionsPattern = cloudFunctionsPattern\n\n\tfor {\n\t\t//mon.lookup = *dist.NewLookupProxy(ip, port)\n\n\t\tmon.refreshCloudServices(ip, port)\n\n\t\t//err := mon.lookup.Close()\n\t\t//if err != nil {\n\t\t//\tlib.PrintlnError(\"Error at closing lookup. Error:\", err)\n\t\t//}\n\n\t\tfor i := range mon.cloudServices {\n\t\t\tmon.cloudServices[i].RefreshPrice()\n\t\t\tmon.cloudServices[i].RefreshStatus()\n\t\t}\n\n\t\tif len(mon.cloudServices) > 0 {\n\t\t\tchanAnalyzer <- mon.cloudServices\n\t\t}\n\n\t\ttime.Sleep(5 * time.Second)\n\t}\n}", "func TrackStreams() {\n // Sleep until the time is a multiple of the refresh period\n now := time.Now()\n wakeUpTime := now.Truncate(config.Timing.Period).Add(config.Timing.Period)\n fmt.Print(\"Waiting...\")\n time.Sleep(wakeUpTime.Sub(now))\n fmt.Println(\"Go\")\n\n // Start periodic updates\n ticker := time.NewTicker(config.Timing.Period)\n Update() // Update immediately, since ticker waits for next interval\n for {\n <-ticker.C\n Update()\n }\n}", "func Start(meter metric.Meter, interval time.Duration) error {\n\tr := &runtime{\n\t\tmeter: meter,\n\t\tinterval: interval,\n\t}\n\treturn r.register()\n}", "func (p *Proxy) Start() {\n\tp.stream.EventKv(\"proxy.starting\", kvs{\"public_key\": p.publicKey, \"speed\": strconv.Itoa(p.speed)})\n\n\tp.Fetch()\n\tfor {\n\t\tselect {\n\t\tcase <-p.stopCh:\n\t\t\tclose(p.doneCh)\n\t\t\treturn\n\t\tcase <-p.ticker.C:\n\t\t\tp.Fetch()\n\t\t}\n\t}\n}", "func (r *ManagedServicePollRequest) Interval(value time.Duration) *ManagedServicePollRequest {\n\tr.interval = value\n\treturn r\n}", "func (pr *PeriodicReader) start(ctx context.Context) {\n\tdefer pr.wait.Done()\n\tticker := time.NewTicker(pr.interval)\n\tfor {\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t\tif err := pr.collectWithTimeout(ctx, pr.exporter.ExportMetrics); err != nil {\n\t\t\t\totel.Handle(err)\n\t\t\t}\n\t\t}\n\t}\n}", "func (a *Aggregator) Run() {\n\tfor {\n\t\tnow := time.Now()\n\t\twait := now.Add(a.pollingInterval).\n\t\t\tTruncate(a.pollingInterval).\n\t\t\tSub(now)\n\t\ttime.Sleep(wait)\n\n\t\tts := time.Now().Truncate(a.pollingInterval)\n\t\tcounts := a.counter.Reset()\n\n\t\ta.mu.Lock()\n\t\ta.data = a.data.Next()\n\t\ta.data.Value = Rate{\n\t\t\tTimestamp: ts.Unix(),\n\t\t\tCounts: counts,\n\t\t}\n\t\ta.mu.Unlock()\n\t}\n}", "func (dispatcher *Dispatcher) Start() {\n\tfor {\n\t\tselect {\n\t\tcase statusUpdate := <-dispatcher.statusChan:\n\t\t\tif !dispatcher.shouldPublish(statusUpdate) {\n\t\t\t\tlog.Debugf(\"suppressing: %+v\", statusUpdate)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tpingResult := statusUpdate.Status.LatestResult\n\t\t\tvar error string\n\t\t\tif pingResult.Error != nil {\n\t\t\t\terror = pingResult.Error.Error()\n\t\t\t}\n\t\t\tstatus := alerter.PingerStatus{\n\t\t\t\tOK: pingResult.Status == ping.StatusOK,\n\t\t\t\tError: error,\n\t\t\t\tOutputURL: outputURL(dispatcher.advertisedBaseURL, statusUpdate.Name),\n\t\t\t}\n\n\t\t\tupdate := alerter.PingerUpdate{\n\t\t\t\tName: statusUpdate.Name,\n\t\t\t\tStatus: status,\n\t\t\t\tConsecutive: statusUpdate.Status.Consecutive,\n\t\t\t\tLatestOK: statusUpdate.Status.LatestOK,\n\t\t\t\tLatestNOK: statusUpdate.Status.LatestNOK,\n\t\t\t}\n\n\t\t\tlog.Debugf(\"dispatching %+v\", statusUpdate)\n\t\t\tdispatcher.dispatch(update)\n\t\t}\n\t}\n\n}", "func (this *BaseUnit) Start(ch chan<- model.Metric) {\n\tthis.RLock()\n\tfetchInterval := this.fetchInterval\n\tthis.RUnlock()\n\n\tlog.Debugf(\"Starting fetch for unit %v...\", this)\n\n\tticker := time.NewTicker(fetchInterval)\n\tdefer ticker.Stop()\n\n\tc := reflect.ValueOf(this.unit)\n\tmethodFetch := c.MethodByName(\"Fetch\")\n\tmethodFetch.Call([]reflect.Value{reflect.ValueOf(ch)})\n\n\tfor {\n\t\tselect {\n\t\tcase <-this.fetchStop:\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t\tmethodFetch.Call([]reflect.Value{reflect.ValueOf(ch)})\n\t\t}\n\t}\n}", "func PollItself() {\n\tfor {\n\t\tresp, err := http.Get(\"http://localhost:1234/\")\n\t\tif err != nil {\n\t\t\tlogger.Sugar().Errorf(\"HTTP request failed: %w\", err)\n\t\t} else {\n\t\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Sugar().Errorf(\"Failed to read response: %w\", err)\n\t\t\t} else {\n\t\t\t\tlogger.Sugar().Debugf(\"Response: %s\", string(body))\n\t\t\t\t_ = resp.Body.Close()\n\t\t\t}\n\t\t}\n\t\ttime.Sleep(time.Second * time.Duration(rand.Intn(3)))\n\t}\n}", "func (t *TestMonitor) Start(_ time.Duration) (chan statedb.PricePoint, chan error) {\n\n\tpriceChan := make(chan PricePoint)\n\n\tt.tick = time.NewTicker(t.interval)\n\tgo pitcher(t.tick.C, t.points, priceChan)\n\n\tt.active = true\n\n\treturn priceChan, nil\n}", "func (t *Timer) Start() {\n\tif !t.running {\n\t\tt.running = true\n\t\tgo func() {\n\t\t\ttime.Sleep(t.interval)\n\t\t\tt.elapsedCallback()\n\t\t\tt.running = false\n\t\t}()\n\t}\n}", "func (api *API) Start(block bool) error {\n\n\tif !api.hasHandlers {\n\t\tlog.Debug(\"Watchtower HTTP API skipped.\")\n\t\treturn nil\n\t}\n\n\tif api.Token == \"\" {\n\t\tlog.Fatal(tokenMissingMsg)\n\t}\n\n\tif block {\n\t\trunHTTPServer()\n\t} else {\n\t\tgo func() {\n\t\t\trunHTTPServer()\n\t\t}()\n\t}\n\treturn nil\n}", "func (n *Notifier) Start() error {\n\tnotificationForChannels := time.NewTicker(time.Second * 60).C\n\tnotificationForTimeTable := time.NewTicker(time.Second * 60).C\n\tfor {\n\t\tselect {\n\t\tcase <-notificationForChannels:\n\t\t\tn.NotifyChannels()\n\t\tcase <-notificationForTimeTable:\n\t\t\tn.NotifyIndividuals()\n\t\t}\n\t}\n}", "func (l *Log) start(ch chan<- *Event) {\n\tdefer close(ch)\n\n\tl.Log.Debug(\"enter\")\n\tdefer l.Log.Debug(\"exit\")\n\n\tvar start = l.StartTime.UnixNano() / int64(time.Millisecond)\n\tvar nextToken *string\n\tvar err error\n\n\tfor {\n\t\tl.Log.WithField(\"start\", start).Debug(\"request\")\n\t\tnextToken, start, err = l.fetch(nextToken, start, ch)\n\n\t\tif err != nil {\n\t\t\tl.err = fmt.Errorf(\"log %q: %s\", l.GroupName, err)\n\t\t\tbreak\n\t\t}\n\n\t\tif nextToken == nil && l.Follow {\n\t\t\ttime.Sleep(l.PollInterval)\n\t\t\tl.Log.WithField(\"start\", start).Debug(\"poll\")\n\t\t\tcontinue\n\t\t}\n\n\t\tif nextToken == nil {\n\t\t\tbreak\n\t\t}\n\t}\n}", "func (ex *ExchangeClient) LongPoll(stopPollCh, stopAllCh chan int, errCh chan error) {\n\tif ex.pi == nil {\n\t\tpanic(\"No pi in ex\")\n\t}\n\tex.Info(\"Starting LongPoll|msgCode=POLLING\")\n\tdefer Utils.RecoverCrash(ex.logger) // catch all panic. RecoverCrash logs information needed for debugging.\n\tex.wg.Add(1)\n\tdefer ex.wg.Done()\n\n\tdefer func() {\n\t\tex.Info(\"Stopping LongPoll...\")\n\t\tex.cancel()\n\t}()\n\n\tvar err error\n\treqTimeout := ex.pi.ResponseTimeout\n\treqTimeout += uint64(float64(reqTimeout) * 0.1) // add 10% so we don't step on the HeartbeatInterval inside the ping\n\n\tif err != nil {\n\t}\n\tex.transport = &http.Transport{\n\t\tTLSClientConfig: &tls.Config{\n\t\t\tInsecureSkipVerify: false,\n\t\t\tRootCAs: globals.config.RootCerts(),\n\t\t},\n\t\tResponseHeaderTimeout: time.Duration(reqTimeout) * time.Millisecond,\n\t}\n\n\t// check for the proxy setting. Useful for mitmproxy testing\n\tproxy := os.Getenv(\"PINGER_PROXY\")\n\tif proxy != \"\" {\n\t\tproxyUrl, err := url.Parse(proxy)\n\t\tif err != nil {\n\t\t\tex.sendError(errCh, err)\n\t\t\treturn\n\t\t}\n\t\tex.transport.Proxy = http.ProxyURL(proxyUrl)\n\t}\n\n\tex.httpClient = &http.Client{\n\t\tTransport: ex.transport,\n\t}\n\tuseCookieJar := false\n\tif useCookieJar {\n\t\tcookieJar, err := cookiejar.New(nil)\n\t\tif err != nil {\n\t\t\tex.sendError(errCh, err)\n\t\t\treturn\n\t\t}\n\t\tex.httpClient.Jar = cookieJar\n\t}\n\tredactedUrl := strings.Split(ex.pi.MailServerUrl, \"?\")[0]\n\n\tex.Info(\"New HTTP Client with timeout %s %s<redacted>\", ex.transport.ResponseHeaderTimeout, redactedUrl)\n\tsleepTime := 0\n\ttooFastResponse := (time.Duration(ex.pi.ResponseTimeout) * time.Millisecond) / 4\n\tex.Debug(\"TooFast timeout set to %s\", tooFastResponse)\n\tvar responseCh chan *http.Response\n\tvar responseErrCh chan error\n\tfor {\n\t\tif sleepTime > 0 {\n\t\t\ts := time.Duration(sleepTime) * time.Second\n\t\t\tex.Info(\"Sleeping %s before retry\", s)\n\t\t\ttime.Sleep(s)\n\t\t}\n\t\tif responseErrCh != nil {\n\t\t\tclose(responseErrCh)\n\t\t}\n\t\tresponseErrCh = make(chan error)\n\t\tif responseCh != nil {\n\t\t\tclose(responseCh)\n\t\t}\n\t\tresponseCh = make(chan *http.Response)\n\n\t\ttimeSent := time.Now()\n\t\tex.wg.Add(1)\n\t\tex.cancelled = false\n\t\tgo ex.doRequestResponse(responseCh, responseErrCh)\n\t\tselect {\n\t\tcase err = <-responseErrCh:\n\t\t\tif err == NoSuchHostError || err == UnknownCertificateAuthority {\n\t\t\t\terrCh <- LongPollReRegister\n\t\t\t} else {\n\t\t\t\tex.sendError(errCh, err)\n\t\t\t}\n\t\t\treturn\n\n\t\tcase response := <-responseCh:\n\t\t\tif response == retryResponse {\n\t\t\t\tex.Debug(\"Retry-response from response reader.\")\n\t\t\t\tsleepTime = ex.exponentialBackoff(sleepTime)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// the response body tends to be pretty short (and we've capped it anyway). Let's just read it all.\n\t\t\tresponseBody, err := ioutil.ReadAll(response.Body)\n\t\t\tif err != nil {\n\t\t\t\tresponse.Body.Close() // attempt to close. Ignore any errors.\n\t\t\t\tex.sendError(errCh, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\terr = response.Body.Close()\n\t\t\tif err != nil {\n\t\t\t\tex.sendError(errCh, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tswitch {\n\t\t\tcase response.StatusCode != 200:\n\t\t\t\tswitch {\n\t\t\t\tcase response.StatusCode == 401:\n\t\t\t\t\t// ask the client to re-register, since nothing we could do would fix this\n\t\t\t\t\tex.Info(\"401 response. Telling client to re-register|msgCode=EAS_AUTH_ERR_REREGISTER\")\n\t\t\t\t\terrCh <- LongPollReRegister\n\t\t\t\t\treturn\n\n\t\t\t\tdefault:\n\t\t\t\t\t// just retry\n\t\t\t\t\tsleepTime = ex.exponentialBackoff(sleepTime)\n\t\t\t\t\tex.Info(\"Response Status %s. Back to polling\", response.Status)\n\t\t\t\t}\n\t\t\t\t//EAS Ping\n\t\t\tcase ex.pi.ASIsSyncRequest == false && (ex.pi.NoChangeReply != nil && bytes.Compare(responseBody, ex.pi.NoChangeReply) == 0):\n\t\t\t\t// go back to polling\n\t\t\t\tif time.Since(timeSent) <= tooFastResponse {\n\t\t\t\t\tex.Warning(\"Ping: NoChangeReply was too fast. Doing backoff. This usually indicates that the client is still connected to the exchange server.\")\n\t\t\t\t\tsleepTime = ex.exponentialBackoff(sleepTime)\n\t\t\t\t} else {\n\t\t\t\t\tex.Info(\"Ping: NoChangeReply after %s. Back to polling\", time.Since(timeSent))\n\t\t\t\t\tsleepTime = 0 // good reply. Reset any exponential backoff stuff.\n\t\t\t\t}\n\t\t\t\t// EAS Ping\n\t\t\tcase ex.pi.ASIsSyncRequest == false && (ex.pi.ExpectedReply == nil || bytes.Compare(responseBody, ex.pi.ExpectedReply) == 0):\n\t\t\t\t// there's new mail!\n\t\t\t\tif ex.pi.ExpectedReply != nil {\n\t\t\t\t\tex.Debug(\"Ping: Reply matched ExpectedReply\")\n\t\t\t\t}\n\t\t\t\tex.Debug(\"Ping: Got mail. Setting LongPollNewMail|msgCode=EAS_NEW_EMAIL\")\n\t\t\t\terrCh <- LongPollNewMail\n\t\t\t\treturn\n\t\t\t\t// EAS Sync\n\t\t\tcase ex.pi.ASIsSyncRequest == true && len(responseBody) == 0:\n\t\t\t\t// go back to polling\n\t\t\t\tif time.Since(timeSent) <= tooFastResponse {\n\t\t\t\t\tex.Warning(\"Sync: NoChangeReply after %s was too fast. Doing backoff. This usually indicates that the client is still connected to the exchange server.\", time.Since(timeSent))\n\t\t\t\t\tsleepTime = ex.exponentialBackoff(sleepTime)\n\t\t\t\t} else {\n\t\t\t\t\tex.Info(\"Sync: NoChangeReply after %s. Back to polling\", time.Since(timeSent))\n\t\t\t\t\tsleepTime = 0 // good reply. Reset any exponential backoff stuff.\n\t\t\t\t}\n\n\t\t\tcase ex.pi.ASIsSyncRequest == true && len(responseBody) > 0:\n\t\t\t\t// there's new mail!\n\t\t\t\tif ex.pi.ExpectedReply != nil {\n\t\t\t\t\tex.Debug(\"Sync: Reply matched ExpectedReply\")\n\t\t\t\t}\n\t\t\t\tex.Debug(\"Sync: Got mail. Setting LongPollNewMail|msgCode=EAS_NEW_EMAIL\")\n\t\t\t\terrCh <- LongPollNewMail\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tex.Warning(\"Unhandled response. Just keep polling: Headers:%+v Body:%s\", response.Header, base64.StdEncoding.EncodeToString(responseBody))\n\t\t\t\tsleepTime = ex.exponentialBackoff(sleepTime)\n\t\t\t}\n\n\t\tcase <-stopPollCh: // parent will close this, at which point this will trigger.\n\t\t\tex.Debug(\"Was told to stop. Stopping\")\n\t\t\treturn\n\n\t\tcase <-stopAllCh: // parent will close this, at which point this will trigger.\n\t\t\tex.Debug(\"Was told to stop (allStop). Stopping\")\n\t\t\treturn\n\t\t}\n\t}\n}", "func (t *RisingMonitor) Start(_ time.Duration) (chan PricePoint, chan error) {\n\n\tpriceChan := make(chan PricePoint)\n\tt.tick = time.NewTicker(t.interval)\n\tgo risingPitcher(t.tick.C, t.start, priceChan)\n\tt.active = true\n\treturn priceChan, nil\n}", "func (c *watchAggregator) Start() {\n\tif c.autoWatch {\n\t\tc.startAutoWatch(true)\n\t} else if c.passiveClient != nil {\n\t\tc.startAutoWatch(false)\n\t}\n}", "func Start(ctx context.Context, restConfig *rest.Config) (*Monitor, error) {\n\tm := NewMonitorWithInterval(time.Second)\n\tclient, err := kubernetes.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconfigClient, err := configclientset.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := StartKubeAPIMonitoringWithNewConnections(ctx, m, restConfig, 5*time.Second); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := StartOpenShiftAPIMonitoringWithNewConnections(ctx, m, restConfig, 5*time.Second); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := StartOAuthAPIMonitoringWithNewConnections(ctx, m, restConfig, 5*time.Second); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := StartKubeAPIMonitoringWithConnectionReuse(ctx, m, restConfig, 5*time.Second); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := StartOpenShiftAPIMonitoringWithConnectionReuse(ctx, m, restConfig, 5*time.Second); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := StartOAuthAPIMonitoringWithConnectionReuse(ctx, m, restConfig, 5*time.Second); err != nil {\n\t\treturn nil, err\n\t}\n\tstartPodMonitoring(ctx, m, client)\n\tstartNodeMonitoring(ctx, m, client)\n\tstartEventMonitoring(ctx, m, client)\n\n\t// add interval creation at the same point where we add the monitors\n\tstartClusterOperatorMonitoring(ctx, m, configClient)\n\tm.intervalCreationFns = append(\n\t\tm.intervalCreationFns,\n\t\tintervalcreation.IntervalsFromEvents_OperatorAvailable,\n\t\tintervalcreation.IntervalsFromEvents_OperatorProgressing,\n\t\tintervalcreation.IntervalsFromEvents_OperatorDegraded,\n\t\tintervalcreation.IntervalsFromEvents_E2ETests,\n\t\tintervalcreation.IntervalsFromEvents_NodeChanges,\n\t)\n\n\tm.StartSampling(ctx)\n\treturn m, nil\n}", "func (h *LinkerdInfo) Start() {\n\tticker := time.NewTicker(linkerdInfoInterval)\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\th.handleCertsInfo()\n\t\tcase <-h.stopCh:\n\t\t\treturn\n\t\t}\n\t}\n}", "func (a *Agent) start() {\n\ta.initAPI()\n\tnb := 0\n\tfor {\n\t\ta.updateStreams()\n\t\tnb++\n\t\tif nb == 10 {\n\t\t\tlog.Printf(\"Sent %d logs and %d metrics on the last %d seconds\\n\", a.nbLogs, a.nbMetrics, nb*conf.period)\n\t\t\tnb = 0\n\t\t\ta.nbLogs = 0\n\t\t\ta.nbMetrics = 0\n\t\t}\n\t\ttime.Sleep(time.Duration(conf.period) * time.Second)\n\t}\n}", "func (p *NotebookWorkspacesStartPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "func (w *Worker) Start() {\n\tfor {\n\t\tselect {\n\t\tcase <-w.stopCh:\n\t\t\treturn\n\n\t\tcase services := <-w.serviceCh:\n\t\t\tlog.Info(\"Got services\")\n\n\t\t\tvhosts := make([]VirtualHost, 0)\n\n\t\t\tfor name := range services {\n\t\t\t\tvhost := VirtualHost{\n\t\t\t\t\tName: name,\n\t\t\t\t\tDomains: []string{\n\t\t\t\t\t\tfmt.Sprintf(\"%s.service.%s\", name, w.consulDomain),\n\t\t\t\t\t},\n\t\t\t\t\tRoutes: []Route{\n\t\t\t\t\t\tRoute{\n\t\t\t\t\t\t\tCluster: name,\n\t\t\t\t\t\t\tPrefix: \"/\",\n\t\t\t\t\t\t\tTimeoutMS: 3 * time.Minute,\n\t\t\t\t\t\t\tRetryPolicy: &RetryPolicy{\n\t\t\t\t\t\t\t\tRetryOn: \"5xx,connect-failure\",\n\t\t\t\t\t\t\t\tNumRetries: 1,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}\n\n\t\t\t\tif _, ok := services[\"api-users\"]; ok && name == \"api\" {\n\t\t\t\t\tvhost.Routes = append([]Route{{Cluster: \"api-users\", Prefix: \"/users\", RetryPolicy: vhost.Routes[0].RetryPolicy}}, vhost.Routes...)\n\t\t\t\t\tvhost.Routes = append([]Route{{Cluster: \"api-users\", Prefix: \"/oauth\", RetryPolicy: vhost.Routes[0].RetryPolicy}}, vhost.Routes...)\n\t\t\t\t\tvhost.Routes = append([]Route{{Cluster: \"api-users\", Prefix: \"/me\", RetryPolicy: vhost.Routes[0].RetryPolicy}}, vhost.Routes...)\n\t\t\t\t\tvhost.Routes = append([]Route{{Cluster: \"api-users\", Prefix: \"/emails\", RetryPolicy: vhost.Routes[0].RetryPolicy}}, vhost.Routes...)\n\t\t\t\t}\n\n\t\t\t\tvhosts = append(vhosts, vhost)\n\t\t\t}\n\n\t\t\tw.response = Response{VirtualHosts: vhosts}\n\t\t}\n\t}\n}", "func (p *DeploymentsStartPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "func (s *keyvisualService) run() {\n\t// TODO: make the ticker consistent with heartbeat interval\n\tticker := time.NewTicker(time.Minute)\n\tdefer ticker.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-s.ctx.Done():\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t\tcluster := s.svr.GetRaftCluster()\n\t\t\tif cluster == nil || !serverapi.IsServiceAllowed(s.svr, defaultRegisterAPIGroupInfo) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ts.scanRegions(cluster)\n\t\t\t// TODO: implements the stats\n\t\t}\n\t}\n}", "func (t *pollTrigger) Start(ctx context.Context) (<-chan bool, error) {\n\ttrigger := make(chan bool)\n\n\tticker := time.NewTicker(t.Interval)\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ticker.C:\n\t\t\t\ttrigger <- true\n\t\t\tcase <-ctx.Done():\n\t\t\t\tticker.Stop()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn trigger, nil\n}", "func (a *API) Run() error {\n\treturn a.e.Start(a.addr)\n}", "func (a *Agent) Run() error {\n\tuserCredentials := fmt.Sprintf(\"%s:%s\", a.config.User, a.config.Password)\n\tuserCredentials = base64.StdEncoding.EncodeToString([]byte(userCredentials))\n\theader := a.buildTransportHeaderMap()\n\theader.Set(\"Authorization\", \"Basic \"+userCredentials)\n\n\tconn, err := transport.Connect(a.backendSelector.Select(), a.config.TLS, header)\n\tif err != nil {\n\t\treturn err\n\t}\n\ta.conn = conn\n\n\tif _, _, err := a.createListenSockets(); err != nil {\n\t\treturn err\n\t}\n\n\t// These are in separate goroutines so that they can, theoretically, be executing\n\t// concurrently.\n\tgo a.sendPump(conn)\n\tgo a.receivePump(conn)\n\n\t// Send an immediate keepalive once we've connected.\n\tif err := a.sendKeepalive(); err != nil {\n\t\tlogger.Error(err)\n\t}\n\n\tgo func() {\n\t\tkeepaliveTicker := time.NewTicker(time.Duration(a.config.KeepaliveInterval) * time.Second)\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-keepaliveTicker.C:\n\t\t\t\tif err := a.sendKeepalive(); err != nil {\n\t\t\t\t\tlogger.WithError(err).Error(\"failed sending keepalive\")\n\t\t\t\t}\n\t\t\tcase <-a.stopping:\n\t\t\t\treturn\n\t\t\t}\n\n\t\t}\n\t}()\n\n\t// Prepare the HTTP API server\n\ta.api = newServer(a)\n\n\t// Start the HTTP API server\n\tgo func() {\n\t\tlogger.Info(\"starting api on address: \", a.api.Addr)\n\n\t\tif err := a.api.ListenAndServe(); err != http.ErrServerClosed {\n\t\t\tlogger.Fatal(err)\n\t\t}\n\t}()\n\n\t// Allow Stop() to block until the HTTP server shuts down.\n\ta.wg.Add(1)\n\tgo func() {\n\t\t// NOTE: This does not guarantee a clean shutdown of the HTTP API.\n\t\t// This is _only_ for the purpose of making Stop() a blocking call.\n\t\t// The goroutine running the HTTP Server has to return before Stop()\n\t\t// can return, so we use this to signal that goroutine to shutdown.\n\t\t<-a.stopping\n\t\tlogger.Info(\"api shutting down\")\n\n\t\tctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)\n\t\tdefer cancel()\n\n\t\tif err := a.api.Shutdown(ctx); err != nil {\n\t\t\tlogger.Error(err)\n\t\t}\n\t\ta.wg.Done()\n\t}()\n\n\treturn nil\n}", "func (i *Interval) Start() error {\n\tif !i.latch.CanStart() {\n\t\treturn exception.New(ErrCannotStart)\n\t}\n\n\ti.latch.Starting()\n\tgo func() {\n\t\ti.latch.Started()\n\n\t\tif i.delay > 0 {\n\t\t\ttime.Sleep(i.delay)\n\t\t}\n\n\t\ttick := time.Tick(i.interval)\n\t\tvar err error\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-tick:\n\t\t\t\terr = i.action()\n\t\t\t\tif err != nil && i.errors != nil {\n\t\t\t\t\ti.errors <- err\n\t\t\t\t}\n\t\t\tcase <-i.latch.NotifyStopping():\n\t\t\t\ti.latch.Stopped()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\t<-i.latch.NotifyStarted()\n\treturn nil\n}", "func (p *StreamingEndpointsCreatePoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "func (g *Engine) Start() error {\n\tudpListeners := make([]*net.UDPConn, len(g.addrs))[0:0]\n\tswitch g.network {\n\tcase \"tcp\", \"tcp4\", \"tcp6\":\n\t\tfor i := range g.addrs {\n\t\t\tln, err := newPoller(g, true, i)\n\t\t\tif err != nil {\n\t\t\t\tfor j := 0; j < i; j++ {\n\t\t\t\t\tg.listeners[j].stop()\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tg.addrs[i] = ln.listener.Addr().String()\n\t\t\tg.listeners = append(g.listeners, ln)\n\t\t}\n\tcase \"udp\", \"udp4\", \"udp6\":\n\t\tfor i, addrStr := range g.addrs {\n\t\t\taddr, err := net.ResolveUDPAddr(g.network, addrStr)\n\t\t\tif err != nil {\n\t\t\t\tfor j := 0; j < i; j++ {\n\t\t\t\t\tudpListeners[j].Close()\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tln, err := g.listenUDP(\"udp\", addr)\n\t\t\tif err != nil {\n\t\t\t\tfor j := 0; j < i; j++ {\n\t\t\t\t\tudpListeners[j].Close()\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tg.addrs[i] = ln.LocalAddr().String()\n\t\t\tudpListeners = append(udpListeners, ln)\n\t\t}\n\t}\n\n\tfor i := 0; i < g.pollerNum; i++ {\n\t\tp, err := newPoller(g, false, i)\n\t\tif err != nil {\n\t\t\tfor j := 0; j < len(g.listeners); j++ {\n\t\t\t\tg.listeners[j].stop()\n\t\t\t}\n\n\t\t\tfor j := 0; j < i; j++ {\n\t\t\t\tg.pollers[j].stop()\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tg.pollers[i] = p\n\t}\n\n\tfor i := 0; i < g.pollerNum; i++ {\n\t\tg.Add(1)\n\t\tgo g.pollers[i].start()\n\t}\n\tfor _, l := range g.listeners {\n\t\tg.Add(1)\n\t\tgo l.start()\n\t}\n\n\tfor _, ln := range udpListeners {\n\t\t_, err := g.AddConn(ln)\n\t\tif err != nil {\n\t\t\tfor j := 0; j < len(g.listeners); j++ {\n\t\t\t\tg.listeners[j].stop()\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(g.pollers); j++ {\n\t\t\t\tg.pollers[j].stop()\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(udpListeners); j++ {\n\t\t\t\tudpListeners[j].Close()\n\t\t\t}\n\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// g.Timer.Start()\n\n\tif len(g.addrs) == 0 {\n\t\tlogging.Info(\"NBIO[%v] start\", g.Name)\n\t} else {\n\t\tlogging.Info(\"NBIO[%v] start listen on: [\\\"%v@%v\\\"]\", g.Name, g.network, strings.Join(g.addrs, `\", \"`))\n\t}\n\treturn nil\n}", "func (am *AppManager) Start() {\n\tlogger.Printf(\"Starting Goroutine to refresh applications data every %d minute(s)\\n\", am.appUpdateInterval)\n\t//get the data as soon as possible\n\tgo am.refreshAppData()\n\tticker := time.NewTicker(time.Duration(int64(am.appUpdateInterval)) * time.Minute)\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ticker.C:\n\t\t\t\tgo am.refreshAppData()\n\n\t\t\tcase tempAppInfo := <-am.updateChannel:\n\t\t\t\tlogger.Printf(\"App Update....received %d app details\", len(tempAppInfo))\n\t\t\t\tam.appData = tempAppInfo\n\n\t\t\tcase rr := <-am.readChannel:\n\t\t\t\tad := am.getAppData(rr.appGUID)\n\t\t\t\trr.responseChan <- ad\n\n\t\t\tcase <-am.closeChannel:\n\t\t\t\tlogger.Print(\"quit \\r\\n\")\n\t\t\t\tticker.Stop()\n\t\t\t}\n\t\t}\n\t}()\n}", "func (p *ManagedClustersStartPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "func StartFetcher(f Fetcher, timer time.Duration) (<-chan *darksky.Forecast, chan string) {\n\tcontrolChannel := make(chan string)\n\tforecastChannel := make(chan *darksky.Forecast)\n\n\tticker := time.NewTicker(timer)\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ticker.C:\n\t\t\t\tforecast, err := f.Fetch()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"[ERROR] unable to get forecast\", err)\n\t\t\t\t}\n\t\t\t\tforecastChannel <- forecast\n\t\t\tcase <-controlChannel:\n\t\t\t\tclose(forecastChannel)\n\t\t\t\tticker.Stop()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn forecastChannel, controlChannel\n}", "func (c *Client) Start(ctx context.Context) error {\n\tif c.observer == nil || c.observer.listener == nil {\n\t\tlevel.Warn(c.logger).Log(xlog.MessageKey(), \"No listener was setup to receive updates.\")\n\t\treturn nil\n\t}\n\tif c.observer.ticker == nil {\n\t\tlevel.Error(c.logger).Log(xlog.MessageKey(), \"Observer ticker is nil\")\n\t\treturn ErrUndefinedIntervalTicker\n\t}\n\n\tif !atomic.CompareAndSwapInt32(&c.observer.state, stopped, transitioning) {\n\t\tlevel.Error(c.logger).Log(xlog.MessageKey(), \"Start called when a listener was not in stopped state\", \"err\", ErrListenerNotStopped)\n\t\treturn ErrListenerNotStopped\n\t}\n\n\tc.observer.ticker.Reset(c.observer.pullInterval)\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-c.observer.shutdown:\n\t\t\t\treturn\n\t\t\tcase <-c.observer.ticker.C:\n\t\t\t\toutcome := SuccessOutcome\n\t\t\t\tctx := c.setLogger(context.Background(), c.logger)\n\t\t\t\titems, err := c.GetItems(ctx, \"\")\n\t\t\t\tif err == nil {\n\t\t\t\t\tc.observer.listener.Update(items)\n\t\t\t\t} else {\n\t\t\t\t\toutcome = FailureOutcome\n\t\t\t\t\tlevel.Error(c.logger).Log(xlog.MessageKey(), \"Failed to get items for listeners\", xlog.ErrorKey(), err)\n\t\t\t\t}\n\t\t\t\tc.observer.measures.Polls.With(prometheus.Labels{\n\t\t\t\t\tOutcomeLabel: outcome}).Add(1)\n\t\t\t}\n\t\t}\n\t}()\n\n\tatomic.SwapInt32(&c.observer.state, running)\n\treturn nil\n}", "func (w *WatchManager) run() {\n\tw.pollUpdatesInWasp() // initial pull from WASP\n\trunning := true\n\tfor running {\n\t\tselect {\n\t\tcase <-time.After(1 * time.Minute):\n\t\t\tw.pollUpdatesInWasp()\n\n\t\tcase <-w.stopChannel:\n\t\t\trunning = false\n\t\t}\n\n\t\ttime.Sleep(1 * time.Second)\n\t}\n}", "func (TelegramBotApp *TelegramBotApp) setupPolling() (tgbotapi.UpdatesChannel, error) {\n\tTelegramBotApp.bot.RemoveWebhook()\n\tupdateConfig := tgbotapi.NewUpdate(0)\n\tupdateConfig.Timeout = 5\n\tfmt.Println(\"[+] Pooling method selected\")\n\treturn TelegramBotApp.bot.GetUpdatesChan(updateConfig)\n}", "func PollLocal(ConfigObject *common.Config, aggregateFile string, forever bool) {\n\tduration := ConfigObject.JsonConfig.LocalMetrics.Scrape_interval\n\tserviceType := ConfigObject.JsonConfig.LocalMetrics.Type\n\t// Setup storage dir\n\tcommon.SetupStorage(ConfigObject, serviceType, aggregateFile)\n\tfor {\n\t\tif len(ConfigObject.JsonConfig.LocalMetrics.Urls) <= 0 {\n\t\t\tfmt.Println(\"-------------- Nothing to monitor for Local Url --------------\")\n\t\t\tfmt.Println(\"-------------- Stopping the thread --------------\")\n\t\t\tbreak\n\t\t}\n\t\tfor i := 0; i < len(ConfigObject.JsonConfig.LocalMetrics.Urls); i++ {\n\t\t\tappID := ConfigObject.JsonConfig.LocalMetrics.Urls[i].Name\n\t\t\turl := ConfigObject.JsonConfig.LocalMetrics.Urls[i].Url\n\t\t\tresultTmpDir := strings.Replace(appID, \"/\", \"_\", -1)\n\t\t\tConfigObject.TW.Add(1)\n\t\t\tgo common.ScrapeMetrics(ConfigObject, url, serviceType, resultTmpDir, ConfigObject, appID, hrc)\n\t\t}\n\t\tConfigObject.TW.Wait()\n\t\tConfigObject.TW.Add(1)\n\t\tgo common.AggregateData(ConfigObject, aggregateFile, serviceType)\n\t\tConfigObject.TW.Wait()\n\t\t<-time.After(time.Duration(duration) * time.Second)\n\t}\n}", "func (n *Nozzle) Start() {\n\trx := n.s.Stream(context.Background(), n.buildBatchReq())\n\n\tgo n.timerProcessor()\n\tgo n.timerEmitter()\n\tgo n.envelopeReader(rx)\n\n\tn.log.Info(\"starting workers\", logger.Count(2*runtime.NumCPU()))\n\tfor i := 0; i < 2*runtime.NumCPU(); i++ {\n\t\tgo n.pointWriter()\n\t}\n\n\tgo n.pointBatcher()\n}", "func (r *AutoRoller) Start(ctx context.Context, tickFrequency time.Duration) {\n\tsklog.Infof(\"Starting autoroller.\")\n\tlv := metrics2.NewLiveness(\"last_successful_autoroll_tick\", map[string]string{\"roller\": r.roller})\n\tcleanup.Repeat(tickFrequency, func(_ context.Context) {\n\t\t// Explicitly ignore the passed-in context; this allows us to\n\t\t// continue running even if the context is canceled, which helps\n\t\t// to prevent errors due to interrupted syncs, etc.\n\t\tctx := context.Background()\n\t\tif err := r.Tick(ctx); err != nil {\n\t\t\t// Hack: we frequently get failures from GoB which trigger error-rate alerts.\n\t\t\t// These alerts are noise and sometimes hide real failures. If the error is\n\t\t\t// due to a sync failure, log it as a warning instead of an error. We'll rely\n\t\t\t// on the liveness alert in the case where we see persistent sync failures.\n\t\t\tif isSyncError(err) {\n\t\t\t\tsklog.Warningf(\"Failed to run autoroll: %s\", err)\n\t\t\t} else {\n\t\t\t\tsklog.Errorf(\"Failed to run autoroll: %s\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tlv.Reset()\n\t\t}\n\t}, nil)\n\n\t// Update the current reviewers in a loop.\n\tlvReviewers := metrics2.NewLiveness(\"last_successful_reviewers_retrieval\", map[string]string{\"roller\": r.roller})\n\tcleanup.Repeat(30*time.Minute, func(ctx context.Context) {\n\t\temails := GetReviewers(r.client, r.cfg.RollerName, r.cfg.Reviewer, r.cfg.ReviewerBackup)\n\t\tr.emailsMtx.Lock()\n\t\tdefer r.emailsMtx.Unlock()\n\t\tr.emails = emails\n\n\t\tconfigCopies := replaceReviewersPlaceholder(r.cfg.Notifiers, emails)\n\t\tif err := r.notifier.ReloadConfigs(ctx, configCopies); err != nil {\n\t\t\tsklog.Errorf(\"Failed to reload configs: %s\", err)\n\t\t\treturn\n\t\t}\n\t\tlvReviewers.Reset()\n\t}, nil)\n\n\t// Handle requests for manual rolls.\n\tif r.cfg.SupportsManualRolls {\n\t\tlvManualRolls := metrics2.NewLiveness(\"last_successful_manual_roll_check\", map[string]string{\"roller\": r.roller})\n\t\tcleanup.Repeat(time.Minute, func(_ context.Context) {\n\t\t\t// Explicitly ignore the passed-in context; this allows\n\t\t\t// us to continue handling manual rolls even if the\n\t\t\t// context is canceled, which helps to prevent errors\n\t\t\t// due to interrupted syncs, etc.\n\t\t\tctx := context.Background()\n\t\t\tif err := r.handleManualRolls(ctx); err != nil {\n\t\t\t\tsklog.Error(err)\n\t\t\t} else {\n\t\t\t\tlvManualRolls.Reset()\n\t\t\t}\n\t\t}, nil)\n\t}\n}", "func (s *Refresh) StartBackgroundRefresh() {\n\tgo s.FindServerStateAdded()\n}", "func (h *HookbotTrigger) Start() error {\n\tfinishCh := make(chan struct{})\n\tmsgCh, errCh := listen.RetryingWatch(h.Endpoint, http.Header{}, finishCh)\n\tgo h.errorHandler(errCh)\n\tgo h.msgHandler(msgCh)\n\treturn nil\n}", "func (m *Merge) Start(ctx context.Context, interval time.Duration) {\n\tticker := time.NewTicker(interval)\n\tdefer ticker.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tm.Main(ctx)\n\t\tcase <-m.ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "func StartPollingHandler(w http.ResponseWriter, r *http.Request) {\n\tenv := envFromRequest(r)\n\n\tscript := polling.GenStartScript(env.Logger, env.BaseURL)\n\n\tw.Write([]byte(script))\n}", "func (rl *RateLimit) startRequests() {\n\tfor {\n\t\t// start a user request every 1 second\n\t\tgo func() {\n\t\t\tsize := rl.requestSize()\n\t\t\terr := make(chan error)\n\t\t\tgo rl.VerifyQuota(size, err)\n\t\t\tif e := <-err; e != nil {\n\t\t\t\t// respond to the user about quota exhaustion\n\t\t\t\tlog.Println(e)\n\t\t\t} else {\n\t\t\t\tlog.Println(\"request OK to be sent downstream\")\n\t\t\t}\n\t\t}()\n\t\ttime.Sleep(500 * time.Millisecond)\n\t}\n}", "func (s *JRPCServer) Start() {\n\thttpCall := s.httpSrv.On(s.endpointURL)\n\thttpCall.Forever()\n\thttpCall.handlerFunc = func(w http.ResponseWriter, req *http.Request) error {\n\t\t// ctx := context.Background()\n\t\ts.guard.Lock()\n\t\tdefer s.guard.Unlock()\n\t\tjReq := btcjson.Request{}\n\t\tbuf, err := ioutil.ReadAll(req.Body)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to decode jRPC request: %v\", err)\n\t\t}\n\t\terr = req.Body.Close()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treq.Body = ioutil.NopCloser(bytes.NewBuffer(buf))\n\t\tmustUnmarshal(buf, &jReq)\n\t\tcall, err := s.findCall(jReq)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// put unmarshalled JRPC request into a context\n\t\tctx := context.WithValue(req.Context(), jRPCRequestKey, jReq)\n\t\treturn call.execute(w, req.WithContext(ctx))\n\t}\n\ts.httpSrv.Start()\n}", "func runTick() {\n ticker := time.NewTicker(time.Duration(*requestBurst * 1000000 / *requestRate) * time.Microsecond)\n for range ticker.C {\n //create \"burst\" go routines that each make 1 get request\n for i := 0; i < *requestBurst; i++ {\n\t // generate 1 request\n\t go generateRequest()\n }\n }\n}", "func (p *DeploymentsStartJFRPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "func pollerActor(logger log.Logger, status chan<- []*ec2.VpnConnection, svc ec2iface.EC2API, interval *time.Duration) actor.Actor {\n\n\tcancel := make(chan struct{})\n\tinput := &ec2.DescribeVpnConnectionsInput{}\n\tticker := time.NewTicker(*interval)\n\n\treturn actor.NewActor(\n\t\tfunc() error {\n\n\t\t\tfor {\n\n\t\t\t\tresult, err := svc.DescribeVpnConnections(input)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tstatus <- result.VpnConnections\n\t\t\t\t_ = level.Debug(logger).Log(\"msg\", \"Sent updated VPN telemetry data to next stage\")\n\n\t\t\t\tselect {\n\n\t\t\t\tcase <-ticker.C:\n\t\t\t\t\t_ = level.Debug(logger).Log(\"msg\", \"Waking up\")\n\t\t\t\t\tcontinue\n\n\t\t\t\tcase <-cancel:\n\t\t\t\t\t_ = level.Info(logger).Log(\"cancelled\", \"Asked to terminate\")\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tfunc(err error) {\n\t\t\t_ = level.Info(logger).Log(\"interrupted\", fmt.Sprintf(\"interrupted with %v\", err))\n\t\t\tclose(cancel)\n\t\t},\n\t)\n\n}", "func (mc *EndpointsWatcher) StartWatcher(quitCh chan struct{}, wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\tfor {\n\t\twatcher := cache.NewListWatchFromClient(mc.clientset.CoreV1().RESTClient(), mc.resourceStr, v1.NamespaceAll, fields.Everything())\n\t\tretryWatcher, err := watchClient.NewRetryWatcher(mc.lastRV, watcher)\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Fatal(\"Could not start watcher for k8s resource: \" + mc.resourceStr)\n\t\t}\n\n\t\tresCh := retryWatcher.ResultChan()\n\t\trunWatcher := true\n\t\tfor runWatcher {\n\t\t\tselect {\n\t\t\tcase <-quitCh:\n\t\t\t\treturn\n\t\t\tcase c := <-resCh:\n\t\t\t\ts, ok := c.Object.(*metav1.Status)\n\t\t\t\tif ok && s.Status == metav1.StatusFailure {\n\t\t\t\t\tif s.Reason == metav1.StatusReasonGone {\n\t\t\t\t\t\tlog.WithField(\"resource\", mc.resourceStr).Info(\"Requested resource version too old, no longer stored in K8S API\")\n\t\t\t\t\t\trunWatcher = false\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\t// Ignore and let the retry watcher retry.\n\t\t\t\t\tlog.WithField(\"resource\", mc.resourceStr).WithField(\"object\", c.Object).Info(\"Failed to read from k8s watcher\")\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// Update the lastRV, so that if the watcher restarts, it starts at the correct resource version.\n\t\t\t\to, ok := c.Object.(*v1.Endpoints)\n\t\t\t\tif !ok {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tmc.lastRV = o.ObjectMeta.ResourceVersion\n\n\t\t\t\tpb, err := protoutils.EndpointsToProto(o)\n\t\t\t\tif err != nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tr := &storepb.K8SResource{\n\t\t\t\t\tResource: &storepb.K8SResource_Endpoints{\n\t\t\t\t\t\tEndpoints: pb,\n\t\t\t\t\t},\n\t\t\t\t}\n\n\t\t\t\tmsg := &K8sResourceMessage{\n\t\t\t\t\tObject: r,\n\t\t\t\t\tObjectType: mc.resourceStr,\n\t\t\t\t\tEventType: c.Type,\n\t\t\t\t}\n\t\t\t\tmc.updateCh <- msg\n\t\t\t}\n\t\t}\n\n\t\tlog.WithField(\"resource\", mc.resourceStr).Info(\"K8s watcher channel closed. Retrying\")\n\n\t\t// Wait 5 minutes before retrying, however if stop is called, just return.\n\t\tselect {\n\t\tcase <-quitCh:\n\t\t\treturn\n\t\tcase <-time.After(5 * time.Minute):\n\t\t\tcontinue\n\t\t}\n\t}\n}", "func (iw *InstanceWorker) APILocalFeedMonitoring() {\n\tfmt.Printf(\"starting local feed API monitoring for %s\\n\", iw.Instance.Domain)\n\tvar timeFrame time.Duration\n\tu := url.URL{\n\t\tScheme: \"https\",\n\t\tHost: iw.Instance.Domain,\n\t\tPath: \"/api/v1/timelines/public\",\n\t\tRawQuery: \"local=true&limit=50\",\n\t}\n\tfor {\n\t\tresp, err := http.Get(u.String())\n\t\tif err == nil {\n\t\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\t\tresp.Body.Close()\n\t\t\tif err == nil {\n\t\t\t\tvar statuses []mastodon.Status\n\t\t\t\tif err = json.Unmarshal(body, &statuses); err == nil {\n\t\t\t\t\tif len(statuses) > 10 { // don't lose time with sleeping instances…\n\t\t\t\t\t\toldest := time.Now()\n\t\t\t\t\t\tmost_recent := time.Now()\n\t\t\t\t\t\tfor _, status := range statuses {\n\t\t\t\t\t\t\tiw.SaveIfUnknown(status.Account)\n\t\t\t\t\t\t\tif status.CreatedAt.After(most_recent) {\n\t\t\t\t\t\t\t\tmost_recent = status.CreatedAt\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif status.CreatedAt.Before(oldest) {\n\t\t\t\t\t\t\t\toldest = status.CreatedAt\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttimeFrame = most_recent.Sub(oldest)\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttimeFrame = 17 * time.Hour\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttimeFrame = time.Duration(float64(timeFrame) * 0.75)\n\t\tif timeFrame > (12 * time.Hour) {\n\t\t\ttimeFrame = 12 * time.Hour\n\t\t}\n\t\ttime.Sleep(timeFrame)\n\t}\n\t/*\n\t\t- fetch json from instance's URL\n\t\t- partially unmarshal json to retrieve toots' id and accounts\n\t\t- lookup worker's toots map\n\t\t- if toot not found, add it to worker's map and launch 'SaveIfUnknown' func\n\t\t- cleanup vars (json, etc.)\n\t*/\n}", "func (s *StopWatch) Start() {\n if !s.running {\n s.start = time.Now()\n s.running = true\n }\n}", "func (p *Probe) Start(ctx context.Context, dataChan chan *metrics.EventMetrics) {\n\tdefer p.wait()\n\n\tp.updateTargetsAndStartProbes(ctx, dataChan)\n\n\t// Do more frequent listing of targets until we get a non-zero list of\n\t// targets.\n\tinitialRefreshInterval := p.opts.Interval\n\t// Don't wait too long if p.opts.Interval is large.\n\tif initialRefreshInterval > time.Second {\n\t\tinitialRefreshInterval = time.Second\n\t}\n\n\tfor {\n\t\tif ctxDone(ctx) {\n\t\t\treturn\n\t\t}\n\t\tif len(p.targets) != 0 {\n\t\t\tbreak\n\t\t}\n\t\tp.updateTargetsAndStartProbes(ctx, dataChan)\n\t\ttime.Sleep(initialRefreshInterval)\n\t}\n\n\ttargetsUpdateTicker := time.NewTicker(p.targetsUpdateInterval)\n\tdefer targetsUpdateTicker.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase <-targetsUpdateTicker.C:\n\t\t\tp.updateOauthToken()\n\t\t\tp.updateTargetsAndStartProbes(ctx, dataChan)\n\t\t}\n\t}\n}", "func (e *Epazote) Start(sk Scheduler, debug bool) {\n\tif debug {\n\t\te.debug = true\n\t}\n\n\tfor k, v := range e.Services {\n\t\t// Set service name\n\t\tv.Name = k\n\n\t\t// Status\n\t\tif v.Expect.Status < 1 {\n\t\t\tv.Expect.Status = 200\n\t\t}\n\n\t\t// rxBody\n\t\tif v.Expect.Body != \"\" {\n\t\t\tre := regexp.MustCompile(v.Expect.Body)\n\t\t\tv.Expect.body = re\n\t\t}\n\n\t\t// retry\n\t\tif v.RetryInterval == 0 {\n\t\t\tv.RetryInterval = 500\n\t\t}\n\t\tif v.RetryLimit == 0 {\n\t\t\tv.RetryLimit = 3\n\t\t}\n\n\t\tif v.Test.Test != \"\" {\n\t\t\tv.Test.Test = strings.TrimSpace(v.Test.Test)\n\t\t}\n\n\t\tif e.debug {\n\t\t\tif v.URL != \"\" {\n\t\t\t\tlog.Printf(Green(\"Adding service: %s URL: %s\"), v.Name, v.URL)\n\t\t\t} else {\n\t\t\t\tlog.Printf(Green(\"Adding service: %s Test: %s\"), v.Name, v.Test.Test)\n\t\t\t}\n\t\t}\n\n\t\t// schedule the service\n\t\tsk.AddScheduler(k, GetInterval(60, v.Every), e.Supervice(v))\n\t}\n\n\t// initialize map in case of no services\n\tif e.Services == nil {\n\t\te.Services = make(map[string]*Service)\n\t}\n\n\tif len(e.Config.Scan.Paths) > 0 {\n\t\tfor _, v := range e.Config.Scan.Paths {\n\t\t\tsk.AddScheduler(v, GetInterval(300, e.Config.Scan.Every), e.Scan(v))\n\t\t\t// schedule the scan but also scan at the beginning\n\t\t\tgo e.search(v, false)\n\t\t}\n\t}\n\n\tlog.Printf(\"Epazote %c on %d services, scan paths: %s [pid: %d]\",\n\t\tIcon(herb),\n\t\tlen(e.Services),\n\t\tstrings.Join(e.Config.Scan.Paths, \",\"),\n\t\tos.Getpid())\n}", "func (s *Service) Boot() {\n\n\t// run tick goroutine\n\ttickChan := make(chan bool)\n\ts.logger.LogDebug(\"booting loop for interval %ds\", int(s.fetchInterval.Seconds()))\n\tgo intervalTick(int(s.fetchInterval.Seconds()), s.jitterSec, tickChan)\n\tgo s.notificationSentTimestampOperator()\n\n\t// run infinite loop\n\tfor {\n\t\t// wait until we reached another interval tick\n\t\tselect {\n\t\tcase <-tickChan:\n\t\t}\n\t\terr := s.mainLoop()\n\n\t\tif err != nil {\n\t\t\ts.logger.LogError(err, \"mainLoop failed\")\n\t\t}\n\t}\n\n}", "func (wss *WssClientContext) Start() {\n\tfor {\n\n\t\tu := url.URL{\n\t\t\tScheme: \"ws\",\n\t\t\tOpaque: \"\",\n\t\t\tUser: &url.Userinfo{},\n\t\t\tHost: wssConfig.Server + \":\" + strconv.Itoa(wssConfig.Port),\n\t\t\tPath: \"\",\n\t\t\tRawPath: \"\",\n\t\t\tForceQuery: false,\n\t\t\tRawQuery: \"\",\n\t\t\tFragment: \"\",\n\t\t\tRawFragment: \"\",\n\t\t}\n\t\tc, _, err := websocket.DefaultDialer.Dial(u.String(), nil)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"Can't access server \")\n\t\t\tcontinue\n\t\t}\n\t\tdefer c.Close()\n\t\t_, msg, err := c.ReadMessage()\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"Can't read message\")\n\t\t\tcontinue\n\t\t}\n\t\tmsgString := string(msg)\n\t\tlogger.Infof(\"Recieve message: \" + msgString)\n\n\t\ttime.Sleep(time.Duration(3) * time.Second)\n\t}\n}", "func (a *api) Run() {\n\tport := strconv.FormatInt(int64(a.Config.HttpPort), 10)\n\ta.logger.Info(\"Running API on \", port)\n\tgraceful.Run(\":\"+port, 100*time.Millisecond, a.ge)\n}", "func StartGettingWeather() {\n\t// get some initial data from start\n\t// mainWeatherGetter()\n\n\tfor i := range time.Tick(time.Second * time.Duration(delay)) {\n\t\t_ = i\n\t\tloopCounter++\n\t\tfmt.Println(time.Now().Format(time.RFC850), \" counter: \", loopCounter)\n\t\tmainWeatherGetter()\n\t}\n}", "func (c Consumer) Start() {\n\tfor {\n\t\tlog.Print(\"Consumer: Request initiated from consumer: \", c.id)\n\t\tc.RequestWidgets()\n\t}\n}", "func (p *CassandraClustersClientStartPoller) Poll(ctx context.Context) (*http.Response, error) {\n\treturn p.pt.Poll(ctx)\n}", "func (site *Site) Run(interval time.Duration) {\n\tloadpointChan := make(chan Updater)\n\tgo site.loopLoadpoints(loadpointChan)\n\n\tticker := time.NewTicker(interval)\n\tsite.update(<-loadpointChan) // start immediately\n\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tsite.update(<-loadpointChan)\n\t\tcase lp := <-site.lpUpdateChan:\n\t\t\tsite.update(lp)\n\t\t}\n\t}\n}", "func startCrawling(start string) {\n\tcheckIndexPresence()\n\n\tvar wg sync.WaitGroup\n\tnoOfWorkers := 10\n\n\t// Send first url to the channel\n\tgo func(s string) {\n\t\tqueue <- s\n\t}(start)\n\n\t// Create worker pool with noOfWorkers workers\n\twg.Add(noOfWorkers)\n\tfor i := 1; i <= noOfWorkers; i++ {\n\t\tgo worker(&wg, i)\n\t}\n\twg.Wait()\n}", "func (tb *TelemetryBuffer) Start(intervalms time.Duration) {\n\tdefer tb.close()\n\tif !tb.fdExists && tb.connected {\n\t\tif intervalms < DefaultInterval {\n\t\t\tintervalms = DefaultInterval\n\t\t}\n\n\t\tinterval := time.NewTicker(intervalms).C\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-interval:\n\t\t\t\t// Send payload to host and clear cache when sent successfully\n\t\t\t\t// To-do : if we hit max slice size in payload, write to disk and process the logs on disk on future sends\n\t\t\t\tif err := tb.sendToHost(); err == nil {\n\t\t\t\t\ttb.payload.reset()\n\t\t\t\t}\n\t\t\tcase report := <-tb.data:\n\t\t\t\ttb.payload.push(report)\n\t\t\tcase <-tb.cancel:\n\t\t\t\tgoto EXIT\n\t\t\t}\n\t\t}\n\t} else {\n\t\t<-tb.cancel\n\t}\n\nEXIT:\n}", "func (socket *Socket) StartPolling() {\r\n\tsocket.stopPollChan = make(chan struct{})\r\n\tsocket.wg.Add(1)\r\n\tgo func() {\r\n\t\tvar events [maxEpollEvents]syscall.EpollEvent\r\n\t\tdefer socket.wg.Done()\r\n\r\n\t\tfor {\r\n\t\t\tselect {\r\n\t\t\tcase <-socket.stopPollChan:\r\n\t\t\t\treturn\r\n\t\t\tdefault:\r\n\t\t\t\tnum, err := syscall.EpollWait(socket.epfd, events[:], -1)\r\n\t\t\t\tif err != nil {\r\n\t\t\t\t\tsocket.ErrChan <- fmt.Errorf(\"epollWait: %v\", err)\r\n\t\t\t\t\treturn\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor ev := 0; ev < num; ev++ {\r\n\t\t\t\t\tif events[0].Fd == socket.wakeEvent.Fd {\r\n\t\t\t\t\t\tcontinue\r\n\t\t\t\t\t}\r\n\t\t\t\t\terr = socket.handleEvent(&events[0])\r\n\t\t\t\t\tif err != nil {\r\n\t\t\t\t\t\tsocket.ErrChan <- fmt.Errorf(\"handleEvent: %v\", err)\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}()\r\n}", "func (c *Client) Start(ctx context.Context, productMap exchange.ProductMap, exchangeDoneCh chan<- struct{}) error {\n\tc.productMap = productMap[c.exchangeName]\n\terr := c.GetPairs()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = c.API.Connect(c.GetURL())\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = c.API.SendSubscribeRequest(c.FormatSubscribeRequest())\n\tif err != nil {\n\t\treturn err\n\t}\n\tgo c.StartTickerListener(ctx, exchangeDoneCh)\n\treturn nil\n}" ]
[ "0.6498689", "0.64851135", "0.64312106", "0.6397514", "0.63825715", "0.6344594", "0.6055021", "0.59994274", "0.59954834", "0.5936349", "0.5913254", "0.59047526", "0.5847434", "0.5748641", "0.56952643", "0.5693969", "0.5684528", "0.56824774", "0.5681835", "0.5674555", "0.5671568", "0.5653857", "0.56536263", "0.5650007", "0.5602763", "0.559277", "0.5588531", "0.55848986", "0.55549675", "0.55397743", "0.553308", "0.55329716", "0.5525544", "0.5498398", "0.54924744", "0.5475592", "0.5465721", "0.5439053", "0.54322684", "0.54248863", "0.54209423", "0.5408447", "0.5400997", "0.54007477", "0.53985304", "0.5397891", "0.53893906", "0.5381034", "0.53725773", "0.5365288", "0.5362025", "0.5343434", "0.5342817", "0.53358585", "0.5322", "0.53097546", "0.52966934", "0.52890736", "0.5286533", "0.5282733", "0.5276533", "0.5275376", "0.5262321", "0.52545995", "0.5249601", "0.5247767", "0.5239548", "0.5238626", "0.52288795", "0.52130985", "0.5212979", "0.5203716", "0.5203139", "0.5196553", "0.51955765", "0.5190943", "0.5188744", "0.5186378", "0.51773864", "0.5175815", "0.51754016", "0.51691586", "0.5166455", "0.5164783", "0.51634413", "0.5158356", "0.51582134", "0.5153815", "0.51483804", "0.51371086", "0.5132352", "0.5131929", "0.5130965", "0.51303935", "0.51285285", "0.5121558", "0.51165813", "0.5112623", "0.5110724", "0.51062757" ]
0.7321983
0