query stringlengths 8 4.68k | pos stringlengths 30 210k | negs listlengths 7 7 |
|---|---|---|
ListAllPlans lists all plans Endpoint: GET /v1/billing/plans | func (c *Client) ListAllPlans(params *ListPlansParams) (*ListPlansResponse, error) {
resp := &ListPlansResponse{}
req, err := c.NewRequest("GET", fmt.Sprintf("%s%s", c.APIBase, "/v1/billing/plans"), nil)
if err != nil {
return nil, err
}
q := req.URL.Query()
q.Add("product_id", params.ProductID)
q.Add("page_... | [
"func (r *PoolNAPTRResource) ListAll() (*PoolList, error) {\n\tvar list PoolList\n\tif err := r.c.ReadQuery(BasePath+PoolNAPTREndpoint, &list); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &list, nil\n}",
"func (s *Service) GetDiscountPlansPaginated(parameters connection.APIRequestParameters) (*connection.Pag... |
Deprecated: Use SearchUserReq.ProtoReflect.Descriptor instead. | func (*SearchUserReq) Descriptor() ([]byte, []int) {
return file_business_ext_proto_rawDescGZIP(), []int{6}
} | [
"func (*GetUserRequest) Descriptor() ([]byte, []int) {\n\treturn file_user_service_proto_rawDescGZIP(), []int{0}\n}",
"func (*WatchUserRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha_user_service_proto_rawDescGZIP(), []int{5}\n}",
"func (*UserGrantSearchRequest) Descriptor() ([]byte, ... |
PullSecret is an optional list of references to secrets in the same namespace to use for pulling any of the images | func (o PgbenchSpecImagePtrOutput) PullSecret() pulumi.StringPtrOutput {
return o.ApplyT(func(v *PgbenchSpecImage) *string {
if v == nil {
return nil
}
return v.PullSecret
}).(pulumi.StringPtrOutput)
} | [
"func (o FioSpecImageOutput) PullSecret() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FioSpecImage) *string { return v.PullSecret }).(pulumi.StringPtrOutput)\n}",
"func CreatePullImageSecret(cr, namespace, app, name string, registry operatorv1alpha1.AquaDockerRegistry) *corev1.Secret {\n\tlabels := map[str... |
findSmallest fines the location of the smallest int in an array of ints | func findSmallest(in []int) int {
var smallest = in[0]
var i = 0
for n, v := range in[1:] {
if v < smallest {
smallest = v
i = n + 1
}
}
return i
} | [
"func findMin(vals []float64) float64 {\n\tmin := float64(vals[0])\n\tfor v := range vals {\n\t\tif vals[v] < min {\n\t\t\tmin = vals[v]\n\t\t}\n\t}\n\treturn float64(min)\n}",
"func MinIntS(v []int) (m int) {\n\tl := len(v)\n\tif l > 0 {\n\t\tm = v[0]\n\t}\n\tfor i := 1; i < l; i++ {\n\t\tm = MinInt(m, v[i])\n\t... |
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Metric. | func (in Metric) DeepCopy() Metric {
if in == nil {
return nil
}
out := new(Metric)
in.DeepCopyInto(out)
return *out
} | [
"func (in *GraphiteMetric) DeepCopy() *GraphiteMetric {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GraphiteMetric)\n\tin.DeepCopyInto(out)\n\treturn out\n}",
"func (in *CloudWatchMetricStatMetric) DeepCopy() *CloudWatchMetricStatMetric {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CloudWatchMet... |
NewV1CreateHelloBadRequest creates V1CreateHelloBadRequest with default headers values | func NewV1CreateHelloBadRequest() *V1CreateHelloBadRequest {
return &V1CreateHelloBadRequest{}
} | [
"func NewNewThreadBadRequest() *NewThreadBadRequest {\n\treturn &NewThreadBadRequest{}\n}",
"func NewGetTagBadRequest() *GetTagBadRequest {\n\n\treturn &GetTagBadRequest{}\n}",
"func CreateBadRequestResponse(w http.ResponseWriter, err error) {\n\tw.WriteHeader(http.StatusBadRequest)\n\tbytes, _ := json.Marshal(... |
Check for bad host_ldlibs | func CheckBadHostLdlibs(ctx ModuleContext, prop string, flags []string) {
allowedLdlibs := ctx.toolchain().AvailableLibraries()
if !ctx.Host() {
panic("Invalid call to CheckBadHostLdlibs")
}
for _, flag := range flags {
flag = strings.TrimSpace(flag)
// TODO: Probably should just redo this property to pref... | [
"func link(pack *godata.GoPackage) bool {\n\tvar argc int\n\tvar argv []string\n\tvar argvFilled int\n\tvar objDir string = \"\" //outputDirPrefix + getObjDir();\n\n\t// build the command line for the linker\n\targc = 4\n\tif *flagIncludePaths != \"\" {\n\t\targc += 2\n\t}\n\tif pack.NeedsLocalSearchPath() {\n\t\ta... |
TimeRange return true during (or between) the specified time(s). (, , , , , , ) | func TimeRange(args []string) bool {
argc := len(args)
if argc < 1 {
return false
}
for k, v := range args {
args[k] = strings.ToUpper(v)
}
now := DefaultNower.Now()
isGMT := args[argc-1] == "GMT"
if isGMT {
argc--
now = now.UTC()
}
date1 := now
date2 := now
switch argc {
case 1:
tmp, err := strc... | [
"func timeBetween(t, min, max time.Time) bool {\n\treturn (t.Equal(min) || t.After(min)) && (t.Equal(max) || t.Before(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.M... |
Get retrieves the information about an Environment in an organization, information including the properties, and the created and last modified details. | func (s *EnvironmentsServiceOp) Get(env string) (*Environment, *Response, error) {
path := path.Join(environmentsPath, env)
req, e := s.client.NewRequest("GET", path, nil)
if e != nil {
return nil, nil, e
}
returnedEnv := Environment{}
resp, e := s.client.Do(req, &returnedEnv)
if e != nil {
return nil, resp,... | [
"func Environment() string {\n\tenv := os.Getenv(\"ENVIRONMENT\")\n\n\treturn env\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 (c *profileServiceClient) GetOrg... |
/ This function is the 'open to world' function for this lib. Application needs to pass in the scanner config which is used by the scanner to create a cache object which stores the resource contents by its name. config:the scanner config return: the cache object storing the resource data | func Process (config config.Config) cache.Cache {
scanner := scanner.Scanner {
Config: config,
}
scripts := scanner.Scan()
return scanner.LoadInCache(scripts)
} | [
"func open(s string, gopts GlobalOptions, opts options.Options) (restic.Backend, error) {\n\tdebug.Log(\"parsing location %v\", s)\n\tloc, err := location.Parse(s)\n\tif err != nil {\n\t\treturn nil, errors.Fatalf(\"parsing repository location failed: %v\", err)\n\t}\n\n\tvar be restic.Backend\n\n\tcfg, err := pars... |
FindJobStatuses indicates an expected call of FindJobStatuses | func (mr *MockAPIMockRecorder) FindJobStatuses() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindJobStatuses", reflect.TypeOf((*MockAPI)(nil).FindJobStatuses))
} | [
"func RunJSONSerializationTestForManagedClusterPodIdentity_STATUS(subject ManagedClusterPodIdentity_STATUS) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ManagedClusterPodIdentity_STATUS\n\terr... |
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `pet.Hooks(f(g(h())))`. | func (c *PetClient) Use(hooks ...Hook) {
c.hooks.Pet = append(c.hooks.Pet, hooks...)
} | [
"func (ms *MiddlewareStack) Use(mw ...MiddlewareFunc) {\n\tms.stack = append(ms.stack, mw...)\n}",
"func (c *UsertypeClient) Use(hooks ...Hook) {\n\tc.hooks.Usertype = append(c.hooks.Usertype, hooks...)\n}",
"func (c *DepositClient) Use(hooks ...Hook) {\n\tc.hooks.Deposit = append(c.hooks.Deposit, hooks...)\n}"... |
NewAppStoreVersionPhasedReleasesCreateInstanceRequestWithBody generates requests for AppStoreVersionPhasedReleasesCreateInstance with any type of body | func NewAppStoreVersionPhasedReleasesCreateInstanceRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/v1/appStoreVersionPhasedReleases")
if operationPath[... | [
"func NewAppPreviewSetsCreateInstanceRequest(server string, body AppPreviewSetsCreateInstanceJSONRequestBody) (*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 NewAppPreviewSetsCreateInst... |
RunJSONSerializationTestForHeaderActionParameters_STATUS runs a test to see if a specific instance of HeaderActionParameters_STATUS round trips to JSON and back losslessly | func RunJSONSerializationTestForHeaderActionParameters_STATUS(subject HeaderActionParameters_STATUS) string {
// Serialize to JSON
bin, err := json.Marshal(subject)
if err != nil {
return err.Error()
}
// Deserialize back into memory
var actual HeaderActionParameters_STATUS
err = json.Unmarshal(bin, &actual)
... | [
"func RunJSONSerializationTestForCorsRule_STATUS_ARM(subject CorsRule_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual CorsRule_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif e... |
GetApiCallsOk returns a tuple with the ApiCalls field value if set, zero value otherwise and a boolean to check if the value has been set. | func (o *AccountDashboardStatistic) GetApiCallsOk() ([]AccountDashboardStatisticApiCalls, bool) {
if o == nil || o.ApiCalls == nil {
var ret []AccountDashboardStatisticApiCalls
return ret, false
}
return *o.ApiCalls, true
} | [
"func (mock *SourceCodeProviderListerMock) GetCalls() []struct {\n\tNamespace string\n\tName string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t\tName string\n\t}\n\tlockSourceCodeProviderListerMockGet.RLock()\n\tcalls = mock.calls.Get\n\tlockSourceCodeProviderListerMockGet.RUnlock()\n\treturn c... |
CreateDBInstanceReadReplica mocks base method | func (m *MockRDSAPI) CreateDBInstanceReadReplica(arg0 *rds.CreateDBInstanceReadReplicaInput) (*rds.CreateDBInstanceReadReplicaOutput, error) {
ret := m.ctrl.Call(m, "CreateDBInstanceReadReplica", arg0)
ret0, _ := ret[0].(*rds.CreateDBInstanceReadReplicaOutput)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func TestSplitCloneV2_NoMasterAvailable(t *testing.T) {\n\tdelay := discovery.GetTabletPickerRetryDelay()\n\tdefer func() {\n\t\tdiscovery.SetTabletPickerRetryDelay(delay)\n\t}()\n\tdiscovery.SetTabletPickerRetryDelay(5 * time.Millisecond)\n\n\ttc := &splitCloneTestCase{t: t}\n\ttc.setUp(false /* v3 */)\n\tdefer t... |
Find returns an entity for an ID. | func (s *Service) Find(ctx context.Context, uuid eh.UUID) (eh.Entity, error) {
l, err := s.service.Find(ctx, string(uuid))
if err != nil {
if err == logs.ErrLogNotFound {
return nil, eh.RepoError{
Err: eh.ErrEntityNotFound,
}
}
return nil, err
}
ll := &Log{
UUID: eh.UUID(l.UUID),
User: ... | [
"func (c *BookController) Find(w http.ResponseWriter, r *http.Request) {\n\tid, code, err := c.ValidateId(r)\n\n\tif err != nil {\n\t\trender.Render(w, r, helper.ResponseError(code, err))\n\t\treturn\n\t}\n\n\tuser, err := services.GetBookByID(id)\n\n\tif err != nil {\n\t\trender.Render(w, r, helper.ResponseError(h... |
NewSearchLimits creates a new empty Limits instance and returns a pointer to it | func NewSearchLimits() *Limits {
return &Limits{}
} | [
"func NewRateLimiter(store data.Store, threshold int) *RateLimiter {\n\treturn &RateLimiter{\n\t\tstore: store,\n\t\tthreshold: threshold,\n\t}\n}",
"func New(limits *Limits, header interface{}, c *redis.Client) *Limiter {\n\tlMap := make(limitsMap)\n\n\tif c == nil {\n\t\tvar err error\n\t\tclient, err = gor... |
NewGetStorageByPath creates a new http.Handler for the get storage by path operation | func NewGetStorageByPath(ctx *middleware.Context, handler GetStorageByPathHandler) *GetStorageByPath {
return &GetStorageByPath{Context: ctx, Handler: handler}
} | [
"func NewTranslatorStorage(logger *log.Logger) func(http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {\n\t\t\tnext.ServeHTTP(rw, r)\n\n\t\t\tswitch next.(type) {\n\t\t\tcase *handlers.TranslatorWord:\n\t\t\t\ttw,... |
Direction returns the current direction of the robot | func (r *DefaultRobot) Direction() Direction {
return r.direction
} | [
"func Direction_Values() []string {\n\treturn []string{\n\t\tDirectionBoth,\n\t\tDirectionAscendants,\n\t\tDirectionDescendants,\n\t}\n}",
"func (s *State) MoveForward() {\n\tif s.robotLost {\n\t\treturn\n\t}\n\tswitch s.direction {\n\tcase North:\n\t\ts.y++\n\t\tbreak\n\tcase South:\n\t\ts.y--\n\t\tbreak\n\tcase... |
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope. Experimental. | func (c *jsiiProxy_CfnModuleDefaultVersion) AddDependsOn(target awscdk.CfnResource) {
_jsii_.InvokeVoid(
c,
"addDependsOn",
[]interface{}{target},
)
} | [
"func (r *Resource) ensure(ctx context.Context, obj interface{}) error {\n\tmd, err := key.ToMachineDeployment(obj)\n\tif err != nil {\n\t\treturn microerror.Mask(err)\n\t}\n\tcl, err := r.toClusterFunc(obj)\n\tif err != nil {\n\t\treturn microerror.Mask(err)\n\t}\n\tcc, err := controllercontext.FromContext(ctx)\n\... |
Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. Solidity: function allowance(address owner, address spender) view returns(uint256) | func (_Weth *WethSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) {
return _Weth.Contract.Allowance(&_Weth.CallOpts, owner, spender)
} | [
"func (_PausableToken *PausableTokenSession) Allowance(_owner common.Address, _spender common.Address) (*big.Int, error) {\n\treturn _PausableToken.Contract.Allowance(&_PausableToken.CallOpts, _owner, _spender)\n}",
"func (_SweetToken *SweetTokenCaller) Allowance(opts *bind.CallOpts, owner common.Address, spender... |
TestDeleteExperiments_MultiUser tests (1) deleting an existing experiment, and deleting an experiment that does not exist in ,multi user mode, for V2 api. | func TestDeleteExperiments_MultiUser(t *testing.T) {
viper.Set(common.MultiUserMode, "true")
defer viper.Set(common.MultiUserMode, "false")
md := metadata.New(map[string]string{common.GoogleIAPUserIdentityHeader: common.GoogleIAPUserIdentityPrefix + "user@google.com"})
ctx := metadata.NewIncomingContext(context.Bac... | [
"func (c CvpRestAPI) DeleteUsers(userIds []string) error {\n\tif len(userIds) == 0 {\n\t\treturn errors.New(\"DeleteUsers: no user specified for deletion\")\n\t}\n\tresp, err := c.client.Post(\"/user/deleteUsers.do\", nil, userIds)\n\tif err != nil {\n\t\treturn errors.Errorf(\"DeleteUsers: %s\", err)\n\t}\n\tvar m... |
WithMetricValueType adds a metric value type filter to the QueryBuilder Example: queryBuilder := NewQueryBuilder(translator, metricName).WithMetricValueType("INT64") | func (qb QueryBuilder) WithMetricValueType(metricValueType string) QueryBuilder {
qb.metricValueType = metricValueType
return qb
} | [
"func (o MetricDescriptorOutput) ValueType() MetricDescriptorValueTypePtrOutput {\n\treturn o.ApplyT(func(v MetricDescriptor) *MetricDescriptorValueType { return v.ValueType }).(MetricDescriptorValueTypePtrOutput)\n}",
"func (m *Metric) TypedValue(v interface{}) (*monpb.TypedValue, error) {\n\tvar tv monpb.TypedV... |
Name implements main.embeddedService interface. | func (s *Service) Name() string { return app.ServiceName } | [
"func (ifce *Interface) Name() string {\n\treturn ifce.name\n}",
"func (t *DynamicMessageType) Name() string {\n\treturn t.spec.FullName\n}",
"func (cl RestClient) Name() string {\n\treturn cl.name\n}",
"func (b *KubervisorServiceItem) Name() string {\n\treturn b.name\n}",
"func GetName() string {\n\treturn... |
CreateByUserCleared returns if the "create_by_user" field was cleared in this mutation. | func (m *JobHistoryMutation) CreateByUserCleared() bool {
_, ok := m.clearedFields[jobhistory.FieldCreateByUser]
return ok
} | [
"func (m *OrgUnitMemberMutation) ClearCreateBy() {\n\tm.clearedcreate_by = true\n}",
"func (m *JobHistoryMutation) ClearCreateByUser() {\n\tm.create_by = nil\n\tm.clearedFields[jobhistory.FieldCreateByUser] = struct{}{}\n}",
"func (m *UserMutation) UpdateByCleared() bool {\n\treturn m.UpdateByUserCleared() || m... |
Additional options if `sourceFormat` is set to\ "AVRO". Structure is documented below. | func (o TableExternalDataConfigurationOutput) AvroOptions() TableExternalDataConfigurationAvroOptionsPtrOutput {
return o.ApplyT(func(v TableExternalDataConfiguration) *TableExternalDataConfigurationAvroOptions {
return v.AvroOptions
}).(TableExternalDataConfigurationAvroOptionsPtrOutput)
} | [
"func customizedOptionsFromVolume(rwType RWType) (*Options, error) {\n\tfromVolume, err := util.LoadParamsFromVolume()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn customizedOption(fromVolume, rwType), nil\n}",
"func (s AwsElasticsearchDomainVPCOptions) MarshalFields(e protocol.FieldEncoder) error {\n\t... |
GhostConfigMap Get a ghost's config by it's codename | func GhostConfigMap() (map[string]*GhostConfig, error) {
bucket, err := db.GetBucket(ghostBucketName)
if err != nil {
return nil, err
}
ls, err := bucket.List(ghostConfigNamespace)
configs := map[string]*GhostConfig{}
for _, config := range ls {
ghostName := config[len(ghostConfigNamespace)+1:]
config, err ... | [
"func componentConfig(component *models.Component) (config map[string]interface{}, err error) {\n\n\t// fetch the env\n\tenv, err := models.FindEnvByID(component.EnvID)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"failed to load env model: %s\", err.Error())\n\t\treturn\n\t}\n\n\tbox := boxfile.New([]byte(env.BuiltBo... |
waitTimeout waits for the waitgroup for the specified max timeout. Returns true if waiting timed out. | func waitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {
c := make(chan struct{})
go func() {
defer close(c)
wg.Wait()
}()
select {
case <-c:
return false // completed normally
case <-time.After(timeout):
return true // timed out
}
} | [
"func TestWaitGroup(t *testing.T) {\n\t// goWait is a helper that calls wg.Wait() on a gorutine and closes the\n\t// returned chan once Wait() returns.\n\tgoWait := func(wg *waitGroup) chan struct{} {\n\t\tc := make(chan struct{})\n\t\tstarted := make(chan struct{})\n\t\tgo func() {\n\t\t\tclose(started)\n\t\t\twg.... |
The location of the source files to build. One of `storageSource` or `repoSource` must be provided. Structure is documented below. | func (o TriggerBuildPtrOutput) Source() TriggerBuildSourcePtrOutput {
return o.ApplyT(func(v *TriggerBuild) *TriggerBuildSource {
if v == nil {
return nil
}
return v.Source
}).(TriggerBuildSourcePtrOutput)
} | [
"func (p *Generator) SourcePath(a SourceCoder) string {\n\t//FIXME: handle source_path attr\n\t// if source_path := Attribute(a, \"source_path\"); source_path != \"\" {\n\t// \treturn rootDirectory(path.Join(p.OutputDir, p.CurrentDir)) + Attribute(a, \"source_path\")\n\t// }\n\tsourcePath, err := handleSourceURL(a.... |
AddIndependentPropertyGeneratorsForDeliveryRuleRequestUriCondition is a factory method for creating gopter generators | func AddIndependentPropertyGeneratorsForDeliveryRuleRequestUriCondition(gens map[string]gopter.Gen) {
gens["Name"] = gen.PtrOf(gen.AlphaString())
} | [
"func AddIndependentPropertyGeneratorsForUrlFileExtensionMatchConditionParameters_ARM(gens map[string]gopter.Gen) {\n\tgens[\"MatchValues\"] = gen.SliceOf(gen.AlphaString())\n\tgens[\"NegateCondition\"] = gen.PtrOf(gen.Bool())\n\tgens[\"Operator\"] = gen.PtrOf(gen.OneConstOf(\n\t\tUrlFileExtensionMatchConditionPara... |
Additional function for function SignHeader. | func (hs *QuerySorter) Less(i, j int) bool {
return bytes.Compare([]byte(hs.Keys[i]), []byte(hs.Keys[j])) < 0
} | [
"func Sign(enrollID, enrollToken, fileName, fileContent, fileHash string) string {\n\tvar signRequest signRequest\n\tsignRequest.EnrollID = enrollID\n\tsignRequest.EnrollToken = enrollToken\n\tsignRequest.FileName = fileName\n\tsignRequest.FileContent = fileContent\n\tsignRequest.FileHash = fileHash\n\n\treqBody, e... |
Send marshals and sends the GetApis API request. | func (r GetApisRequest) Send(ctx context.Context) (*GetApisOutput, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*GetApisOutput), nil
} | [
"func (r apiGetUsersRequest) Execute() (InlineResponse20037, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue InlineR... |
SetDefaultHeaders sets HTTP headers to be sent in every request | func (project *ProjectV1) SetDefaultHeaders(headers http.Header) {
project.Service.SetDefaultHeaders(headers)
} | [
"func WithDefaultHeaders() Option {\n\treturn func(r *RequestClient) {\n\t\tfor key, value := range defaultHeaders {\n\t\t\tr.headers.Add(key, value)\n\t\t}\n\t}\n}",
"func (options *GetKubeconfigOptions) SetHeaders(param map[string]string) *GetKubeconfigOptions {\n\toptions.Headers = param\n\treturn options\n}",... |
Destroy is a paid mutator transaction binding the contract method 0xa24835d1. Solidity: function destroy(address account, uint256 amount) returns() | func (_Token *TokenSession) Destroy(account common.Address, amount *big.Int) (*types.Transaction, error) {
return _Token.Contract.Destroy(&_Token.TransactOpts, account, amount)
} | [
"func (_Poll *PollTransactorSession) Destroy() (*types.Transaction, error) {\n\treturn _Poll.Contract.Destroy(&_Poll.TransactOpts)\n}",
"func (n *nativeObject) Destroy() {}",
"func (x *XcChaincode) unlock(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tif len(args) < 5 {\n\t\treturn shim.Error... |
GetExpiredDateTime gets the expiredDateTime property value. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 20140101T00:00:00Z. Readonly. | func (m *AccessPackageAssignment) GetExpiredDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {
return m.expiredDateTime
} | [
"func (transaction *AccountUpdateTransaction) GetExpirationTime() time.Time {\n\tif transaction.expirationTime != nil {\n\t\treturn *transaction.expirationTime\n\t}\n\treturn time.Time{}\n}",
"func (m *Application) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n ... |
Clone implements PhysicalPlan interface. | func (lt *PhysicalTopN) Clone() (PhysicalPlan, error) {
cloned := new(PhysicalTopN)
*cloned = *lt
base, err := lt.basePhysicalPlan.cloneWithSelf(cloned)
if err != nil {
return nil, err
}
cloned.basePhysicalPlan = *base
cloned.ByItems = make([]*util.ByItems, 0, len(lt.ByItems))
for _, it := range lt.ByItems {
... | [
"func (ts *PhysicalTableScan) Clone() (PhysicalPlan, error) {\n\tclonedScan := new(PhysicalTableScan)\n\t*clonedScan = *ts\n\tprod, err := ts.physicalSchemaProducer.cloneWithSelf(clonedScan)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclonedScan.physicalSchemaProducer = *prod\n\tclonedScan.AccessCondition = uti... |
PostUserHandler crea un usuario en la base de datos | func PostUserHandler(w http.ResponseWriter, r *http.Request) {
var user User
err := json.NewDecoder(r.Body).Decode(&user)
if err != nil {
panic(err)
}
user.CreateAt = time.Now()
id++
k := strconv.Itoa(id)
Listusers[k] = user
w.Header().Set("Content-Type", "application/json")
j, err := json.Marshal(user)
if... | [
"func (h *UserHandler) handlePostUser(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n //Decode request\n var req postUserRequest\n if err := json.NewDecoder(r.Body).Decode(&req.User); err != nil {\n Error(w, ErrInvalidJSON, http.StatusBadRequest, h.Logger)\n return\n }\n u := req.User\n\... |
postUser for creating a new user. Does all the checks. | func postUser(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
var user User
err := json.NewDecoder(r.Body).Decode(&user)
log.ErrorHandler(err)
var (
email = strings.ToLower(user.Email)
alias = user.Alias
userName = user.UserName
password ... | [
"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 PostUser(... |
UpdateG a single Vote record. See Update for whitelist behavior description. | func (o *Vote) UpdateG(whitelist ...string) error {
return o.Update(boil.GetDB(), whitelist...)
} | [
"func (o *BraceletPhoto) UpdateGP(whitelist ...string) {\n\tif err := o.Update(boil.GetDB(), whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}",
"func (o *Storestate) UpdateG(columns boil.Columns) (int64, error) {\n\treturn o.Update(boil.GetDB(), columns)\n}",
"func (o *UsernameListing) UpdateG(... |
fackeExecCommandV2 is a helper function that mock the exec.Command call (and call the test binary) | func fakeExecCommandV2(command string, args ...string) *exec.Cmd {
cs := []string{"-test.run=TestHelperProcessV2", "--", command}
cs = append(cs, args...)
cmd := exec.Command(os.Args[0], cs...)
cmd.Env = []string{"GO_WANT_HELPER_PROCESS=1"}
return cmd
} | [
"func fakeRunCommand(command string, arguments []string) (string, error) {\n\tcmdOutput := \"This is a fake test command return\"\n\tvar err error\n\tif msiItem.DisplayName == statusActionNoError {\n\t\terr = nil\n\t} else if msiItem.DisplayName == statusActionError {\n\t\terr = fmt.Errorf(\"Deliberate test error h... |
List implements rest.Lister interface | func (m *podMetrics) List(ctx context.Context, options *metainternalversion.ListOptions) (runtime.Object, error) {
pods, err := m.pods(ctx, options)
if err != nil {
return &metrics.PodMetricsList{}, err
}
ms, err := m.getMetrics(pods...)
if err != nil {
namespace := genericapirequest.NamespaceValue(ctx)
klog... | [
"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.ForT... |
Deprecated: Use GetStableCalRes.ProtoReflect.Descriptor instead. | func (*GetStableCalRes) Descriptor() ([]byte, []int) {
return file_svr_cal_v1_cal_pub_proto_rawDescGZIP(), []int{1}
} | [
"func (*ListenApiCF) Descriptor() ([]byte, []int) {\n\treturn file_pkg_kascfg_kascfg_proto_rawDescGZIP(), []int{22}\n}",
"func (*UpdateTelemetryReportedRequest) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{29}\n}",
"func (*GetChartReq) Descriptor() ... |
/ Given a project name, region name, and policy name, return a fake policy link. eg. [ | func fakePolicyLink(project string, region string, policyName string) string {
return fmt.Sprintf("%s/projects/%s/regions/%s/resourcePolicies/%s", gcpComputeURL, project, region, policyName)
} | [
"func GeneratePolicy(sensorUrl string, sensorOrg string, sensorName string, sensorVersion string, arch string, props *map[string]interface{}, haPartners []string, meterPolicy Meter, counterPartyProperties RequiredProperty, agps []AgreementProtocol, maxAgreements int, filePath string, deviceOrg string) (*events.Poli... |
read a reply to a buffer based on the expected message type return error if reply message has different type of command than expected | func readReply(command int, conn *UniqueConnection) (interface{}, error) {
duration := time.Second *10
timeNow := time.Now()
err := conn.Connection.SetReadDeadline(timeNow.Add(duration))
if err != nil {
TimeEncodedPrint("Cant set read timeout", err.Error())
return nil, err
}
length := int32(0)
err = binary.R... | [
"func getMorphResult(msg string, c net.Conn) (status string, err error) {\n\tfmt.Fprintf(c, \"%s%c\", msg, '\\x00')\n\tstatus, err = bufio.NewReader(c).ReadString('\\x00')\n\n\treturn\n}",
"func (cr *CmdRequest) Read(connReader *bufio.Reader) error {\n\tvar err error\n\tcr.Ver, err = connReader.ReadByte()\n\tif e... |
WithFixs tells the querybuilder to eagerloads the nodes that are connected to the "fixs" edge. The optional arguments used to configure the query builder of the edge. | func (fdq *FurnitureDetailQuery) WithFixs(opts ...func(*FixRoomQuery)) *FurnitureDetailQuery {
query := &FixRoomQuery{config: fdq.config}
for _, opt := range opts {
opt(query)
}
fdq.withFixs = query
return fdq
} | [
"func (fs FeatureSet) Fixed() FeatureSet {\n\treturn fs\n}",
"func (s *FilesystemCheckServer) FixAll(\n\tctx context.Context,\n\treq *api.SdkFilesystemCheckFixAllRequest,\n) (*api.SdkFilesystemCheckFixAllResponse, error) {\n\n\tif s.driver(ctx) == nil {\n\t\treturn nil, status.Error(codes.Unavailable, \"Resource ... |
Special index counting for Part B. | func countForB(n *node) int {
if len(n.children) == 0 {
return c.Sum(n.metadata)
}
result := 0
for _, m := range n.metadata {
if len(n.children) > m-1 {
result += countForB(&n.children[m-1])
}
}
return result
} | [
"func indexDiff(a, b []string) []int {\n\tm := make(map[string]bool)\n\tdiff := []int{}\n\n\tfor _, item := range b {\n\t\t m[item] = true\n\t}\n\n\tfor i, item := range a {\n\t\tif _, ok := m[item]; !ok {\n\t\t\tdiff = append(diff, i)\n\t\t}\n\t}\n\treturn diff\n}",
"func (pt MDTurbo) PartCount() uint8 {\n\tret... |
RedirectAndExecute : Special version of the execute function which takes a command and runs it, directing its input and output to files | func RedirectAndExecute(command Command) {
// Backups
stdin := os.Stdin
stdout := os.Stdout
// error variable
var err error
// Redirect the in/out streams
if command.infile != nil {
os.Stdin, err = os.OpenFile(*command.infile, os.O_RDWR, 0755)
}
if command.outfile != nil {
if command.appendMode {
os.S... | [
"func (rs *RedirectScript) Execute() (err error) {\n\terr = ioutil.WriteFile(\"/tmp/setup-iptables\", []byte(rs.script), 0755)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcmd := exec.Command(\"/tmp/setup-iptables\")\n\tcmd.Stdout = os.Stdout\n\tcmd.Stdin = os.Stdin\n\tcmd.Stderr = os.Stderr\n\terr = cmd.Run()\n\n\... |
HealthCheck is used to verify connectivity and health of the Cassandra cluster. This function simply runs a generic query against Cassandra. If the query errors in any fashion this function will also return an error. | func (db *Database) HealthCheck() error {
if db == nil || db.conn == nil {
return hord.ErrNoDial
}
err := db.conn.Query("SELECT now() FROM system.local;").Exec()
if err != nil {
return fmt.Errorf("health check of Cassandra cluster failed")
}
return nil
} | [
"func (d *DBHealthChecker) CheckHealth() error {\n\treturn d.db.Ping()\n}",
"func (s *FilesystemCheckServer) CheckHealth(\n\tctx context.Context,\n\treq *api.SdkFilesystemCheckCheckHealthRequest,\n) (*api.SdkFilesystemCheckCheckHealthResponse, error) {\n\n\tif s.driver(ctx) == nil {\n\t\treturn nil, status.Error(... |
GetDomainLine returns the domain for pointed path | func (c *Conf) GetDomainLine(path string) []string {
c.mutex.RLock()
defer c.mutex.RUnlock()
domainLine, err := c.root.getDomainLine(path)
if err != nil {
return []string{}
}
return domainLine
} | [
"func (r Dns_Secondary) GetDomain() (resp datatypes.Dns_Domain, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Dns_Secondary\", \"getDomain\", nil, &r.Options, &resp)\n\treturn\n}",
"func (spec *MachineSpec) Domain() string {\n\treturn fmt.Sprintf(\"%s.%s.%s\", spec.Machine.Uid, spec.Machine.Credential, dn... |
ReceivedGT applies the GT predicate on the "received" field. | func ReceivedGT(v float32) predicate.Order {
return predicate.Order(func(s *sql.Selector) {
s.Where(sql.GT(s.C(FieldReceived), v))
})
} | [
"func TypeNameGT(v string) predicate.Watchlisthistory {\n\treturn predicate.Watchlisthistory(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldTypeName), v))\n\t})\n}",
"func EmailGT(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldEmail), v))\n\t})... |
Exists checks if the row exists in the table. | func (q voteQuery) Exists() (bool, error) {
var count int64
queries.SetCount(q.Query)
queries.SetLimit(q.Query, 1)
err := q.Query.QueryRow().Scan(&count)
if err != nil {
return false, errors.Wrap(err, "models: failed to check if vote exists")
}
return count > 0, nil
} | [
"func Exists(IDval int) (err error){\n\treturn\n}",
"func (m *UserModel) Exists(ctx context.Context, builders ...query.SQLBuilder) (bool, error) {\n\tcount, err := m.Count(ctx, builders...)\n\treturn count > 0, err\n}",
"func (q shelfQuery) Exists() (bool, error) {\n\tvar count int64\n\n\tqueries.SetCount(q.Que... |
Start starts the loop of checking whether to synchronize with the global allocator. | func (ta *CachedAllocator) Start() error {
ta.TChan.Init()
ta.wg.Add(1)
go ta.mainLoop()
return nil
} | [
"func (c *Cache) StartGC() {\n\tgo c.GC()\n}",
"func (cs *ConsensusState) Start() {\n\tif atomic.CompareAndSwapUint32(&cs.status, 0, 1) {\n\t\tcs.timeoutTicker.Start()\n\n\t\tgo cs.checkTxsAvailable()\n\t\t// now start the receiveRoutine\n\t\tgo cs.receiveRoutine(0)\n\n\t\t// schedule the first round!\n\t\t// use... |
Remove delete given items from the set. | func (s *Set) Remove(items ...uint32) *Set {
for _, item := range items {
delete(s.items, item)
}
return s
} | [
"func (s *Set) Remove(elements ...interface{}) {\n\tif len(elements) == 0 {\n\t\treturn\n\t}\n\n\ts.mutex.Lock()\n\tfor _, element := range elements {\n\t\tdelete(s.m, element)\n\t}\n\ts.mutex.Unlock()\n}",
"func (set StringSet) Del(str string) {\n\tdelete(set, str)\n}",
"func (lwwset LWWSet) Removal(value stri... |
SetCustomerID sets the customer edge to Customer by id. | func (rrc *ReserveRoomCreate) SetCustomerID(id int) *ReserveRoomCreate {
rrc.mutation.SetCustomerID(id)
return rrc
} | [
"func (o *PostMultiNodeDeviceParams) SetCustomer(customer *string) {\n\to.Customer = customer\n}",
"func (c *CustomerClient) UpdateOneID(id uuid.UUID) *CustomerUpdateOne {\n\tmutation := newCustomerMutation(c.config, OpUpdateOne, withCustomerID(id))\n\treturn &CustomerUpdateOne{config: c.config, hooks: c.Hooks(),... |
UnmarshalJSON implements the json.Unmarshaller interface for type AbusePenalty. | func (a *AbusePenalty) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", a, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "action":
err = unpopulate(val, "Ac... | [
"func (n *NexposeAttributedAssetVulnerabilities) UnmarshalJSON(data []byte) error {\n\ttype Alias NexposeAttributedAssetVulnerabilities\n\taux := &struct {\n\t\t*Alias\n\t}{\n\t\tAlias: (*Alias)(n),\n\t}\n\tif err := json.Unmarshal(data, &aux); err != nil {\n\t\treturn err\n\t}\n\tif n.NexposeAssetVulnerabilities.V... |
specPVC updates node PVC spec | func (r *NodeReconciler) specPVC(node *filecoinv1alpha1.Node, pvc *corev1.PersistentVolumeClaim) {
request := corev1.ResourceList{
corev1.ResourceStorage: resource.MustParse(node.Spec.Resources.Storage),
}
// spec is immutable after creation except resources.requests for bound claims
if !pvc.CreationTimestamp.Is... | [
"func (o PodSecurityPolicyPatchOutput) Spec() PodSecurityPolicySpecPatchPtrOutput {\n\treturn o.ApplyT(func(v *PodSecurityPolicyPatch) PodSecurityPolicySpecPatchPtrOutput { return v.Spec }).(PodSecurityPolicySpecPatchPtrOutput)\n}",
"func pvcsiVolumeUpdated(ctx context.Context, resourceType interface{},\n\tvolume... |
Get mocks base method | func (m *MockUserStore) Get(arg0 context.Context, arg1 *sql.Tx, arg2 []byte) (*proto.User, error) {
ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2)
ret0, _ := ret[0].(*proto.User)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func (m *MockDBStorage) Get(arg0, arg1 string) (*models.Shadow, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Get\", arg0, arg1)\n\tret0, _ := ret[0].(*models.Shadow)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"func (m *MockPexeler) GetRequest(arg0, arg1 string) ([]byte, error) {\n\tm.ctrl... |
/////////////////////////////////////////////// Wrapper functions for FastPathManager | func (fp *FastPaxos) LeaderVote(vote *Vote) (*common.Future, *common.Future) {
return fp.fpManager.LeaderVote(vote)
} | [
"func (r *Paths) Path(handler interface{}) []string {\n\t// перебираем статические пути\n\tfor url, h := range r.static {\n\t\tif h == handler {\n\t\t\treturn splitter(url)\n\t\t}\n\t}\n\t// перебираем все пути с параметрами\n\tfor _, records := range r.fields {\n\t\tfor _, record := range records {\n\t\t\t// сравн... |
New returns a Conn wrapper. | func New(rawConn net.Conn) *Conn {
if _, ok := rawConn.(*Conn); ok {
return rawConn.(*Conn)
}
return &Conn{
Conn: rawConn,
isClosed: atomic.NewBool(false),
createdAt: time.Now(),
}
} | [
"func (p Pinger) NewConn() (*icmp.PacketConn, error) {\r\n\treturn icmp.ListenPacket(\"ip:icmp\", fmt.Sprint(p.src)) // packets from localhost\r\n}",
"func NewConn(conn net.Conn) Conn {\n\treturn &connWrap{\n\t\tConn: conn,\n\t\tbrw: bufio.NewReadWriter(bufio.NewReader(conn), bufio.NewWriter(conn)),\n\t}\n}",
... |
Create a new instance of the hashing server | func InitializeHashingServer() *hashingServer {
return new(hashingServer)
} | [
"func New(id string) *Node {\n\t// 16 is finger table size\n\treplicaCount, err := strconv.Atoi(os.Getenv(\"SUCCESSOR_LIST_SIZE\"))\n\tif err != nil {\n\t\tlog.Error.Fatalf(\"Node INIT error, invalid SUCCESSOR_LIST_SIZE: %v\", err)\n\t}\n\tn := &Node{ID: id, next: 0, fingers: make([]string, FINGER_TABLE_SIZE), succ... |
Validate the values of XML object. | func (xml XML) Validate() error {
return mustURL("xml.namespace", xml.Namespace)
} | [
"func (mt *Vironpage) Validate() (err error) {\n\tif mt.ID == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"id\"))\n\t}\n\tif mt.Name == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"name\"))\n\t}\n\tif mt.Section == \"\" {\n\t\terr = goa.MergeErrors... |
ListAppInstallationsForOrg lists the installations for an organisation. The requestor must be an organization owner with admin:read scope See | func (c *client) ListAppInstallationsForOrg(org string) ([]AppInstallation, error) {
durationLogger := c.log("AppInstallationForOrg")
defer durationLogger()
var ais []AppInstallation
if err := c.readPaginatedResults(
fmt.Sprintf("/orgs/%s/installations", org),
acceptNone,
org,
func() interface{} {
retur... | [
"func (c *V3Client) ListOrgRepositories(ctx context.Context, org string, page int, repoType string) (repos []*Repository, hasNextPage bool, rateLimitCost int, err error) {\n\tpath := fmt.Sprintf(\"orgs/%s/repos?sort=created&page=%d&per_page=100&type=%s\", org, page, repoType)\n\trepos, err = c.listRepositories(ctx,... |
GetID returns the ID field. When the provided Log type is nil, or the field within the type is nil, it returns the zero value for the field. | func (l *Log) GetID() int64 {
// return zero value if Log type or ID field is nil
if l == nil || l.ID == nil {
return 0
}
return *l.ID
} | [
"func (cons *LogConsumer) GetID() string {\n\treturn \"core.LogConsumer\"\n}",
"func (o *ModelError) GetLogId() string {\n\tif o == nil || IsNil(o.LogId.Get()) {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.LogId.Get()\n}",
"func (*InputIdentityDocument) TypeID() uint32 {\n\treturn InputIdentityDocumen... |
KubeConfigLoader is a fake implementation of function | func (c *Client) KubeConfigLoader() kubeconfig.Loader {
return c.KubeLoader
} | [
"func loadKubeconfig() (*rest.Config, string, bool, error) {\n\tcfg := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(clientcmd.NewDefaultClientConfigLoadingRules(), &clientcmd.ConfigOverrides{})\n\tclusterConfig, err := cfg.ClientConfig()\n\tif err != nil {\n\t\treturn nil, \"\", false, fmt.Errorf(\"could ... |
Validate validates the state of the Options struct. | func (o Options) Validate() []error {
return []error{
o.validateTLS(),
}
} | [
"func (opts *Options) Validate() error {\n\tif opts.LockTimeout < 0 {\n\t\treturn errors.New(\"cannot have negative lock timeout\")\n\t}\n\n\tif opts.LockTimeout == 0 {\n\t\topts.LockTimeout = amboy.LockTimeout\n\t}\n\n\tif opts.PoolSize == 0 {\n\t\topts.PoolSize = runtime.NumCPU()\n\t}\n\n\tif opts.WaitInterval ==... |
Calculate the score of all classes within the giving documents | func (c *Classifier) Probability(document []string) map[string]float64 {
class := c.cFrequency.Classes()
lenClasses := len(class)
score := make(map[string]float64, lenClasses)
totalNodes := c.cFrequency.AllNodesFrequencies()
totalNodeClassFreq := c.cFrequency.TotalClassNodesFrequencies()
var scoreSum float64 =... | [
"func Classify(num int64) (c Classification, err error) {\n\tif num <= 0 {\n\t\treturn c, ErrOnlyPositive\n\t}\n\n\tasum := AliquotSum(num)\n\n\tif asum > num {\n\t\tc = ClassificationAbundant\n\t} else if asum < num {\n\t\tc = ClassificationDeficient\n\t} else {\n\t\tc = ClassificationPerfect\n\t}\n\n\treturn\n}",... |
TestDeleteExperimentsV1_MultiUser tests (1) deleting an existing experiment, and deleting an experiment that does not exist in multi user mode, for V1 api. | func TestDeleteExperimentsV1_MultiUser(t *testing.T) {
viper.Set(common.MultiUserMode, "true")
defer viper.Set(common.MultiUserMode, "false")
md := metadata.New(map[string]string{common.GoogleIAPUserIdentityHeader: common.GoogleIAPUserIdentityPrefix + "user@google.com"})
ctx := metadata.NewIncomingContext(context.B... | [
"func (l *RemoteProvider) SMPTestConfigDelete(req *http.Request, testUUID string) error {\n\tif !l.Capabilities.IsSupported(PersistSMPTestProfile) {\n\t\tlogrus.Error(\"operation not available\")\n\t\treturn ErrInvalidCapability(\"PersistSMPTestProfile\", l.ProviderName)\n\t}\n\n\tep, _ := l.Capabilities.GetEndpoin... |
DeployApp indicates an expected call of DeployApp. | func (mr *MockCdkClientMockRecorder) DeployApp(appDir, context interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeployApp", reflect.TypeOf((*MockCdkClient)(nil).DeployApp), appDir, context)
} | [
"func DeployWandappBase(auth *bind.TransactOpts, backend bind.ContractBackend, tokenOrigAddr common.Address, operAddr common.Address, duration *big.Int) (common.Address, *types.Transaction, *WandappBase, error) {\n\tparsed, err := abi.JSON(strings.NewReader(WandappBaseABI))\n\tif err != nil {\n\t\treturn common.Add... |
WriteCollectionOfBoolValues writes a collection of Bool values to underlying the byte array. | func (w *FormSerializationWriter) WriteCollectionOfBoolValues(key string, collection []bool) error {
return writeCollectionOfPrimitiveValues(key, w.WriteBoolValue, collection)
} | [
"func marshalBoolean(bd io.StringWriter, b bool) error {\n\tif b {\n\t\t_, err := bd.WriteString(\"?1\")\n\n\t\treturn err\n\t}\n\n\t_, err := bd.WriteString(\"?0\")\n\n\treturn err\n}",
"func ToStringMapBool(in any) map[string]bool {\n\tm, _ := ToStringMapE(in)\n\treturn cast.ToStringMapBool(m)\n}",
"func (enc... |
DeleteAllP deletes all rows in the slice, using an executor, and panics on error. | func (o ClaimInListSlice) DeleteAllP(exec boil.Executor) {
err := o.DeleteAll(exec)
if err != nil {
panic(boil.WrapErr(err))
}
} | [
"func (o SourceSlice) DeleteAllP(exec boil.Executor) {\n\tif err := o.DeleteAll(exec); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}",
"func (q shelfQuery) DeleteAllP() {\n\tif err := q.DeleteAll(); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}",
"func (o ItemSlice) DeleteAll(ctx context.Context, exec... |
applyConfiguration apply new configuration if needed: add or delete pods configure the submarineserver process | func (c *Controller) applyConfiguration(admin submarine.AdminInterface, cluster *rapi.SubmarineCluster) (bool, error) {
glog.Info("applyConfiguration START")
defer glog.Info("applyConfiguration STOP")
asChanged := false
// expected replication factor and number of master nodes
cReplicaFactor := *cluster.Spec.Rep... | [
"func (a addPods) reconcile(ctx context.Context, r *FoundationDBClusterReconciler, cluster *fdbv1beta2.FoundationDBCluster, _ *fdbv1beta2.FoundationDBStatus, logger logr.Logger) *requeue {\n\tconfigMap, err := internal.GetConfigMap(cluster)\n\tif err != nil {\n\t\treturn &requeue{curError: err}\n\t}\n\texistingConf... |
NewPluginRunner creates a new runner for the supplied plugin and options | func NewPluginRunner(plugin interface{}, opts ...RunnerOption) *cobra.Command {
k := &PluginRunner{
plugin: plugin,
config: func(*cobra.Command, []string) ([]byte, error) { return nil, nil },
generate: func() (resmap.ResMap, error) { return resmap.New(), nil },
transform: func(resmap.ResMap) error { ret... | [
"func (p *Plugins) runPlugin(client github.Client, event *github.GenericRequestEvent, args []string) {\n\trunID, plugin, err := p.Get(args[0])\n\tif err != nil {\n\t\tp.log.Error(err, \"unable to get plugin for command\", \"command\", args[0])\n\t\treturn\n\t}\n\n\tif !client.IsAuthorized(plugin.Authorization(), ev... |
TGGetBotID returns the bot's telegram ID number used by templates | func TGGetBotID() (int, error) {
if !tgrunning {
return 0, nil
}
return tgbotid, nil
} | [
"func (s *ListAggregatedUtterancesOutput) SetBotId(v string) *ListAggregatedUtterancesOutput {\n\ts.BotId = &v\n\treturn s\n}",
"func (m *ChannelIdentity) GetTeamId()(*string) {\n return m.teamId\n}",
"func (s *UpdateIntentOutput) SetBotId(v string) *UpdateIntentOutput {\n\ts.BotId = &v\n\treturn s\n}",
"f... |
BuildResource builds a schema.Resource from a valid PostgreSQLFlexibleServer struct. This method is called after the resource is initialised by an IaC provider. See providers folder for more information. | func (r *PostgreSQLFlexibleServer) BuildResource() *schema.Resource {
costComponents := []*schema.CostComponent{
r.computeCostComponent(),
r.storageCostComponent(),
r.backupCostComponent(),
}
return &schema.Resource{
Name: r.Address,
UsageSchema: PostgreSQLFlexibleServerUsageSchema,
CostCom... | [
"func resourceFirstFreeSubnetSchema() map[string]*schema.Schema {\n\tschema := bareSubnetSchema()\n\tfor k, v := range schema {\n\t\tswitch {\n\t\t// Subnet id and Mask are currently ForceNew\n\t\tcase k == \"parent_subnet_id\" || k == \"subnet_mask\":\n\t\t\tv.Required = true\n\t\t\tv.ForceNew = true\n\t\tcase k =... |
GetPeerIdx is a convenience function for working with older code. | func (pm *PeerManager) GetPeerIdx(peer *Peer) uint32 {
if peer.idx == nil {
return 0
}
return *peer.idx
} | [
"func (r *Region) NextPeer() (*metapb.Peer, error) {\n\tnextPeerIdx := r.curPeerIdx + 1\n\tif nextPeerIdx >= len(r.meta.Peers) {\n\t\treturn nil, errors.New(\"out of range of peer\")\n\t}\n\treturn r.meta.Peers[nextPeerIdx], nil\n}",
"func (myRaft Raft) LeaderId() int {\n\tfor i := 0; i < PEERS; i++ {\n\t\tif myR... |
get an array filled with id(s) of all lower layers | func (d *Driver) getDiffChain(id string) ([]string, error) {
logrus.Debugf("secureoverlay2: getDiffChain called w. id: %s", id)
var chain []string
lowers, err := ioutil.ReadFile(path.Join(d.dir(id), lowerFile))
if err == nil {
for _, s := range strings.Split(string(lowers), ":") {
lp, err := os.Readlink(path.... | [
"func (m *OperativerecordMutation) ToolIDs() (ids []int) {\n\tif id := m._Tool; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}",
"func levelOrder(root *TreeNode) [][]int {\n\treturn helper(root)\n}",
"func servicesToServiceIds(objects []core.Service) []types.UID {\n\n\tif objects == nil {\n\t\treturn... |
verifyCtr verifies is containerd client and context. | func verifyCtr() error {
if CtrdClient == nil {
return fmt.Errorf("verifyCtr: Container client is nil")
}
if ctrdCtx == nil {
return fmt.Errorf("verifyCtr: Container context is nil")
}
return nil
} | [
"func (a *ChoriaAuth) Check(c server.ClientAuthentication) bool {\n\tvar (\n\t\tverified bool\n\t\ttlsVerified bool\n\t\terr error\n\t)\n\n\tlog := a.log.WithField(\"stage\", \"check\")\n\tremote := c.RemoteAddress()\n\tif remote != nil {\n\t\tlog = log.WithField(\"remote\", remote.String())\n\t}\n\tpipe... |
Validate verifies if aggregate is valid. Could be run in different spots | func (_ *BaseAggregate) Validate() []error {
return nil
} | [
"func (gtp GenesisTotalPrincipal) Validate() error {\n\tif gtp.TotalPrincipal.IsNegative() {\n\t\treturn fmt.Errorf(\"total principal should be positive, is %s for %s\", gtp.TotalPrincipal, gtp.CollateralType)\n\t}\n\treturn nil\n}",
"func (ut *JSONDataStatistics) Validate() (err error) {\n\n\treturn\n}",
"func... |
NewGetCharactersCharacterIDCalendarEventIDNotFound creates a GetCharactersCharacterIDCalendarEventIDNotFound with default headers values | func NewGetCharactersCharacterIDCalendarEventIDNotFound() *GetCharactersCharacterIDCalendarEventIDNotFound {
return &GetCharactersCharacterIDCalendarEventIDNotFound{}
} | [
"func NewPatchEventsEventIDNotFound() *PatchEventsEventIDNotFound {\n\treturn &PatchEventsEventIDNotFound{}\n}",
"func NewNotFound() error {\n\treturn requestError{\n\t\tClientError: ClientError{\n\t\t\tErrors: []clientErrorSubError{{Message: \"status code 404\"}},\n\t\t},\n\t}\n}",
"func NewGetBicsNotFound() *... |
SetCfo is a paid mutator transaction binding the contract method 0x2d46ed56. Solidity: function setCfo(address newCfo) returns() | func (_AccessControl *AccessControlTransactor) SetCfo(opts *bind.TransactOpts, newCfo common.Address) (*types.Transaction, error) {
return _AccessControl.contract.Transact(opts, "setCfo", newCfo)
} | [
"func (_Cakevault *CakevaultTransactorSession) SetCallFee(_callFee *big.Int) (*types.Transaction, error) {\n\treturn _Cakevault.Contract.SetCallFee(&_Cakevault.TransactOpts, _callFee)\n}",
"func (x *fastReflection_Bech32PrefixRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {\n\tswitch fd.F... |
newRequest creates a new request for a HsmProviders operation | func (s *HsmProvidersService) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := s.NewRequest(op, params, data)
return req
} | [
"func (w *AWS) newRequest(r *aws.Request) *Request {\n\tctx := arn.Ctx{\n\t\tPartition: region.Partition(r.Config.Region),\n\t\tRegion: r.Config.Region,\n\t\tAccount: w.Ctx.Account,\n\t}\n\tcr, err := r.Config.Credentials.Retrieve()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif cr.SessionToken != \"\" {\n\t\tc... |
GetV100 returns the V100 field if nonnil, zero value otherwise. | func (o *MicrosoftGraphWindowsMinimumOperatingSystem) GetV100() bool {
if o == nil || o.V100 == nil {
var ret bool
return ret
}
return *o.V100
} | [
"func (v *Venom) GetUint(key string) uint {\n\tval, ok := v.Find(key)\n\tif !ok {\n\t\treturn 0\n\t}\n\n\tif value, ok := val.(uint); !ok {\n\t\treturn 0\n\t} else {\n\t\treturn value\n\t}\n}",
"func (agent *Agent) GetVbucketSeqnos(serverIdx int, state VbucketState, cb GetVBucketSeqnosCallback) (PendingOp, error)... |
ClearUpdateTime clears the value of the "update_time" field. | func (m *SystemMutation) ClearUpdateTime() {
m.update_time = nil
m.clearedFields[system.FieldUpdateTime] = struct{}{}
} | [
"func (s *GetVariantImportJobOutput) SetUpdateTime(v time.Time) *GetVariantImportJobOutput {\n\ts.UpdateTime = &v\n\treturn s\n}",
"func (m *TimerMutation) ClearElapsedSeconds() {\n\tm.elapsedSeconds = nil\n\tm.addelapsedSeconds = nil\n\tm.clearedFields[timer.FieldElapsedSeconds] = struct{}{}\n}",
"func (o Look... |
Done implements the SubIterator.Done method. | func (u *UserCalculator) Done() {} | [
"func (d *DownloadProxy) Done() {\n\td.wg.Done()\n}",
"func (m *Master) DoneReduce(args *DoneReduceArgs, reply *DoneReduceReply) error {\n\tremainReduceMutex.Lock()\n\tm.remainReduceCount--\n\tm.reduces[args.Index].done = true\n\tlog.Print(\"[MASTER] after reduce, m.remainReduceCount: \" + strconv.Itoa(m.remainRe... |
Validate checks the field values on RicStyleName with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations. | func (m *RicStyleName) Validate() error {
return m.validate(false)
} | [
"func (m *RicFormatType) Validate() error {\n\treturn m.validate(false)\n}",
"func (m *ResourceControlUpdateRequest) Validate(formats strfmt.Registry) error {\n\treturn nil\n}",
"func (m *DestinyDefinitionsMilestonesDestinyMilestoneRewardCategoryDefinition) Validate(formats strfmt.Registry) error {\n\tvar res [... |
IsEmpty return true if it is empty | func (t *FileType) IsEmpty() bool {
return len(t.FileTypes) < 1 &&
t.MinLength == 0 &&
t.MaxLength == 2147483647
} | [
"func (this *MyStack) Empty() bool {\n\treturn this.l.Len() == 0\n}",
"func (s *ConcurrentSet) IsEmpty() bool {\n\treturn s.size == 0\n}",
"func (s Subtitles) IsEmpty() bool {\n\treturn len(s.Items) == 0\n}",
"func (stack *Stack) IsEmpty() bool {\n\treturn len(*stack) == 0\n}",
"func (t *RedBlackTree) Empty... |
With returns a DoFunc that executes HTTP roundtrips. The default implementation provides reasonable defaults for timeouts: keepalive, connection, request/response read/write, and TLS handshake. Callers can customize configuration by specifying one or more ConfigOpt's. | func With(opt ...ConfigOpt) DoFunc {
var (
dialer = &net.Dialer{
LocalAddr: &net.TCPAddr{IP: net.IPv4zero},
KeepAlive: 30 * time.Second,
Timeout: 5 * time.Second,
}
transport = &http.Transport{
Proxy: http.ProxyFromEnvironment,
Dial: dialer.Dial,
ResponseHeaderTimeout: 5 * time.Second,
TL... | [
"func Do(ctx context.Context, config Config) error {\n\tif config.Auth == nil {\n\t\treturn errors.New(\"config.Auth is nil\")\n\t}\n\tauthorization := fmt.Sprintf(\"Bearer %s\", config.Auth.Token)\n\treq := &request{Metadata: config.Metadata}\n\tvar resp struct{}\n\turlpath := fmt.Sprintf(\"/api/v1/update/%s\", co... |
FindAll of the keys in the database | func (store KeyValue) FindAll() []DatabaseKey {
return store.list()
} | [
"func (c *Conn) Keys() ([][]byte, error) {\n\tresponse := c.client.Cmd(cmdKeys)\n\titems, err := response.Array()\n\tif err != nil {\n\t\treturn nil, errx.Annotatef(err, \"response array\")\n\t}\n\tkeys := make([][]byte, len(items))\n\tfor index, item := range items {\n\t\tkey, err := item.Bytes()\n\t\tif err != ni... |
Post mocks base method. | func (m *Client) Post(arg0 context.Context, arg1 string, arg2 interface{}) ([]byte, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Post", arg0, arg1, arg2)
ret0, _ := ret[0].([]byte)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func (m *MockDelegateActor) PostOutbox(c context.Context, a Activity, outboxIRI *url.URL, rawJSON map[string]interface{}) (bool, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"PostOutbox\", c, a, outboxIRI, rawJSON)\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}",
"fun... |
GetCertificate gets the certificate property value. Data recovery Certificate | func (m *WindowsInformationProtectionDataRecoveryCertificate) GetCertificate()([]byte) {
val, err := m.GetBackingStore().Get("certificate")
if err != nil {
panic(err)
}
if val != nil {
return val.([]byte)
}
return nil
} | [
"func (d *DB) Get(ctx context.Context, key string) ([]byte, error) {\n\tquery := `SELECT certificate FROM certificates WHERE key = $1`\n\n\tvar cert []byte\n\terr := d.DB.Get(&cert, query, key)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn nil, autocert.ErrCacheMiss\n\t\t}\n\t\treturn nil, errors.... |
HandleInvokeRequest Handle Invocation Requests from Client | func (r *StorageServiceRequestHandler) HandleInvokeRequest(writer http.ResponseWriter, request *http.Request) {
output := r.Invoker.Invoke(request)
writer.Header().Set("Content-Type", "service/json; charset=utf-8")
writer.Write(output)
} | [
"func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {\n\n\t// Retrieve the requested Smart Contract function and arguments\n\tfunction, args := APIstub.GetFunctionAndParameters()\n\t// Route to the appropriate handler function to interact with the ledger appropriately\n\tif function == ... |
newPersistedEntry turns a value type into a persistedEntry. | func newPersistedEntry(value *value) (persistedEntry, error) {
if len(value.data) > modules.RegistryDataSize {
build.Critical("newPersistedEntry: called with too much data")
return persistedEntry{}, errors.New("value's data is too large")
}
cpk, err := newCompressedPublicKey(value.key)
if err != nil {
return ... | [
"func CreateKeyValueFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewKeyValue(), nil\n}",
"func NewEntry(log *log.Logger, clk clock.Clock) *Entry {\n\tre... |
Exec executes the query on the entity. | func (muo *MedicalfileUpdateOne) Exec(ctx context.Context) error {
_, err := muo.Save(ctx)
return err
} | [
"func (s *Stmt) Exec(args []driver.Value) (driver.Result, error) {\n\t// in transaction, need run Executor\n\texecutor, err := exec.BuildExecutor(s.res.dbType, s.txCtx.TransactionMode, s.query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\texecCtx := &types.ExecContext{\n\t\tTxCtx: s.txCtx,\n\t\tQuery: s.quer... |
Fatal calls Err and os.Exit(1) | func (il *InstanceLogger) Fatal(err error) {
il.Error(err)
il.Stop()
os.Exit(1)
} | [
"func (l *stubLogger) Fatalf(format string, args ...interface{}) {\n\tos.Exit(1)\n}",
"func lFatal(v ...interface{}) {\n\t/* #nosec */\n\t_ = errLogger.Output(2, fmt.Sprintln(v...)) //Following log package, ignoring error value\n\tos.Exit(1)\n}",
"func errExit(err error, l logrus.FieldLogger) {\n\tif l != nil {... |
Closes the serverstate associated with an open scanner. | func (p *HbaseClient) ScannerClose(id ScannerID) (err error) {
if err = p.sendScannerClose(id); err != nil {
return
}
return p.recvScannerClose()
} | [
"func (c *minecraftConn) close() error {\n\treturn c.closeKnown(true)\n}",
"func (c *Client) Close() {}",
"func (l *LocalSDKServer) Close() {\n\tl.updateObservers.Range(func(observer, _ interface{}) bool {\n\t\tclose(observer.(chan struct{}))\n\t\treturn true\n\t})\n}",
"func (s *SecondStateMachine) Close() {... |
Sends "stop" command to bedrock server stdin | func stopServer(stdin io.WriteCloser, log *zap.SugaredLogger) {
log.Info("writing stop to bedrock server...")
if _, err := stdin.Write([]byte("stop\n")); err != nil {
log.Error("failed to write \"stop\" to server")
}
} | [
"func (e *Engine) stop() error {\n\te.booted = false\n\n\t// instruct engine to shutdown\n\tshutdown := \"shutdown\"\n\tcommunication.Publish(\n\t\tnaming.Topic(e.Index, naming.Command),\n\t\tnaming.Publisher(e.Index, naming.Command),\n\t\tshutdown)\n\n\t// stop subscribing to engine's commands and events\n\te.Comm... |
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation. | func (msg *MsgBlockTxns) MaxPayloadLength(pver uint32) uint32 {
// In practice this will always be less than the payload but the number
// of txs in a block can vary so we really don't know the real max.
return maxMessagePayload()
} | [
"func (params *KeyParameters) MaxMsgBytes() int {\n\treturn (params.P.BitLen() / 8) - 4\n}",
"func (v *parameter) MaxLength() int {\n\tif !v.HasMaxLength() {\n\t\treturn 0\n\t}\n\treturn *v.maxLength\n}",
"func (s *FilesystemStore) MaxLength(l int) {\n\tfor _, c := range s.Codecs {\n\t\tif codec, ok := c.(*secu... |
We don't want one dispatch to delay Cmds and Events, that's why we create specific chans for each of them. For now we're limiting this behavior to Cmds and Events for lack of examples of other cases. | func (d *Dispatcher) key(m *Message) string {
// Message to runnable: Cmds
if m.To != nil && m.To.Type == RunnableIdentifierType {
return fmt.Sprintf("to.runnable.%s.%s", *m.To.Worker, *m.To.Name)
}
// Message from runnable: Events
if m.From.Type == RunnableIdentifierType {
return fmt.Sprintf("from.runnable.%... | [
"func (am *appMon) HandleCast(message etf.Term, state interface{}) (string, interface{}) {\n\tvar appState appMonState = state.(appMonState)\n\tlib.Log(\"APP_MON: HandleCast: %#v\", message)\n\tswitch message {\n\tcase \"sendStat\":\n\n\t\tfor cmd, jobs := range state.(appMonState).jobs {\n\t\t\tswitch cmd {\n\t\t\... |
IsValid return true if the value is valid for the enum, false otherwise. | func (v CIAppCIErrorDomain) IsValid() bool {
for _, existing := range allowedCIAppCIErrorDomainEnumValues {
if existing == v {
return true
}
}
return false
} | [
"func (v ActivityTypeEnum) IsValid() bool {\n\tfor _, existing := range allowedActivityTypeEnumEnumValues {\n\t\tif existing == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}",
"func (v InvestmentTransactionSubtype) IsValid() bool {\n\tfor _, existing := range allowedInvestmentTransactionSubtypeEnumValues ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.