anchor
stringlengths
10
14.3k
positive
stringlengths
10
14.9k
NewOutgoingPacket Creates a new packet instance intended for sending formatted data to the client.
func NewOutgoingPacket(opcode byte) *Packet { return &Packet{opcode, []byte{opcode}, false, 0, 0, 0} }
AMPBoilerplate removes and tags in , keeping only the ampcustom style tag. It then inserts the ampboilerplate.
func AMPBoilerplate(e *Context) error { // Remove <style> and <noscript> tags keeping only the amp-runtime and // amp-custom style tag. amp-runtime may be removed later by the // AMPRuntimeCSS transformer. for n := e.DOM.HeadNode; n != nil && n.DataAtom != atom.Body; n = htmlnode.Next(n) { sw...
Read returns gets a snapshot of all current stats
func (s *Stats) Read(ctx context.Context, req *stats.ReadRequest, rsp *stats.ReadResponse) error { if req.Service == nil { s.RLock() rsp.Stats = s.snapshots s.RUnlock() return nil } filter := func(a, b string) bool { if len(b) == 0 { return true } return a == b } s.RLock() for _, s := range s.s...
Update updates views along with given todos.
func (app *Application) Update(todos []todo.Todo) { app.table.Update(todos) }
DeleteIssueAttachment deletes an issue attachment
func (c *Client) DeleteIssueAttachment(issueIDOrKey string, attachmentID int) (*Attachment, error) { return c.DeleteIssueAttachmentContext(context.Background(), issueIDOrKey, attachmentID) }
BoolDefault returns the user's value as bool. a string which is "1" or "t" or "T" or "TRUE" or "true" or "True" or "0" or "f" or "F" or "FALSE" or "false" or "False". Any other value returns an error. If not found returns "def" and a nonnil error.
func (e Entry) BoolDefault(def bool) (bool, error) { v := e.ValueRaw if v == nil { return def, errFindParse.Format("bool", e.Key) } if vBoolean, ok := v.(bool); ok { return vBoolean, nil } if vString, ok := v.(string); ok { b, err := strconv.ParseBool(vString) if err != nil { return def, err } re...
HOST1 ID: Qma91H212PWtAFcioW7h9eKiosJtwHsb9x3RmjqRWTwciZ HOST2 ID: QmbazrBU4HthhnQWcUTiJLnj5ihbFHXsAkGAG6QfmrqJDs
func TestInit(t *testing.T) { os.RemoveAll(dataDir) defer os.RemoveAll(dataDir) protocol.ClearEventHandler() var err error q := queue.New("test") msgCh := initMockBlockchain(q) p1, p2 := initEnv(t, q) _ = p1 client := q.Client() //client用来模拟blockchain模块向p2p模块发消息,host1接收topic为p2pA的消息,host2接收topic为p2pB的消息 //向h...
SimpleRemoveDuplicates Removes Duplicates from the array
func SimpleRemoveDuplicates(arr []int) []int { //.. pocket := make([]int, 0) pocket = append(pocket, arr...) for index, num := range pocket { if contains(pocket, num) == true { fmt.Println("pocket: ", pocket) fmt.Println("pocket[index]: ", pocket[index:]) pocket = pocket[index:] } } // for _, item ...
dataSourceMetadataToHypercat converts a DataSourceMetadata instance to json for registering a data source
func (csc *CoreStoreClient) dataSourceMetadataToHypercat(metadata DataSourceMetadata, endPoint string) ([]byte, error) { if metadata.Description == "" || metadata.ContentType == "" || metadata.Vendor == "" || metadata.DataSourceType == "" || metadata.DataSourceID == "" || metadata.StoreType == "" { retur...
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil.
func (in *DnsDomainStatus) DeepCopyInto(out *DnsDomainStatus) { *out = *in if in.InstanceStatuses != nil { in, out := &in.InstanceStatuses, &out.InstanceStatuses *out = make(map[string]InstanceStatus, len(*in)) for key, val := range *in { (*out)[key] = val } } return }
The scheduler will prefer to schedule pods to nodes that satisfy the antiaffinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling r...
func (o DrillSpecPodConfigPodSchedulingAffinityPodAntiAffinityPtrOutput) PreferredDuringSchedulingIgnoredDuringExecution() DrillSpecPodConfigPodSchedulingAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecutionArrayOutput { return o.ApplyT(func(v *DrillSpecPodConfigPodSchedulingAffinityPodAntiAffinity) [...
DrawSnakeRect draws the snake shape using rectangles
func DrawSnakeRect(win *pixelgl.Window, imd *imdraw.IMDraw, gameCFG *game.Config, s *snake.Type) { imd.Clear() imd.Color = colornames.Purple positions := []pixel.Vec{s.GetHeadPos()} positions = append(positions, s.GetPositionPoints()...) positions = append(positions, s.GetTailPos()) for _, pos := range positions ...
Deposit is a paid mutator transaction binding the contract method 0xd0e30db0. Solidity: function deposit() returns()
func (_EtherDelta *EtherDeltaTransactor) Deposit(opts *bind.TransactOpts) (*types.Transaction, error) { return _EtherDelta.contract.Transact(opts, "deposit") }
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (m *JobHistoryMutation) ID() (id int, exists bool) { if m.id == nil { return } return *m.id, true }
Helper function that returns the NumericDate time value used by the spec
func EpochNow() int64 { return time.Now().UTC().Unix() }
TaskName returns the name of the shell task.
func (s *ShellTask) TaskName() string { return s.name }
BoolX is like Bool, but panics if an error occurs.
func (ougb *OrgUnitGroupBy) BoolX(ctx context.Context) bool { v, err := ougb.Bool(ctx) if err != nil { panic(err) } return v }
define an array of vertex data
func VertexPointer(size int32, xtype uint32, stride int32, pointer unsafe.Pointer) { C.glowVertexPointer(gpVertexPointer, (C.GLint)(size), (C.GLenum)(xtype), (C.GLsizei)(stride), pointer) }
CLUBELOCATIONADDRESSGT applies the GT predicate on the "CLUBE_LOCATION_ADDRESS" field.
func CLUBELOCATIONADDRESSGT(v string) predicate.Location { return predicate.Location(func(s *sql.Selector) { s.Where(sql.GT(s.C(FieldCLUBELOCATIONADDRESS), v)) }) }
SetHTTPClient adds the HTTPClient to the serve build types in project params
func (o *ServeBuildTypesInProjectParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client }
C returns the streaming data channel.
func (e *binaryExprEvaluator) C() <-chan map[string]interface{} { return e.c }
BeforeUnmarshalYAML implement yaml Initiator
func (t *FileType) BeforeUnmarshalYAML() (err error) { t.MaxLength = 2147483647 return }
NewRouter returns new instance of Router type
func NewRouter(interval string, agent *map[string]string, csvFile string) *cron.Cron { lr := new(regression.Regression) lr.SetObserved("Get throughput") lr.SetVar(0, "CPU usage") lr.SetVar(1, "Memory usage") timeConfig := "@every " + interval // It works on this format - http://golang.org/pkg/time/#ParseDuration ...
tokenize converts expression context to tokens
func (e *Exp) tokenize() []string { siz := len(e.context) tokens := make([]string, 0, 1) for i := 0; i < siz; i++ { ch := e.context[i] switch { case e.isSpace(ch): continue case ch == '(': tokens = append(tokens, "(") case ch == ')': tokens = append(tokens, ")") default: isOperator, op := e....
GetTicket mocks base method.
func (m *Client) GetTicket(arg0 context.Context, arg1 int64) (zendesk.Ticket, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetTicket", arg0, arg1) ret0, _ := ret[0].(zendesk.Ticket) ret1, _ := ret[1].(error) return ret0, ret1 }
Deprecated: Use Trigger_OperationTrigger.ProtoReflect.Descriptor instead.
func (*Trigger_OperationTrigger) Descriptor() ([]byte, []int) { return file_chain_proto_rawDescGZIP(), []int{19, 0} }
matchExpressions is a list of label selector requirements. The requirements are ANDed.
func (o IopingSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermLabelSelectorOutput) MatchExpressions() IopingSpecPodConfigPodSchedulingAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermLabelSelectorMatchExpressionsArrayOutput { re...
Pins returns all available AnalogPins
func (f *Firmata) SnapshotAnalogPins() (pins []*Pin, err error) { err = f.WaitLoop(func() error { pins = ClonePins_l(f.AnalogPins) return nil }) return }
Deprecated: Use GetWithdrawalRequest.ProtoReflect.Descriptor instead.
func (*GetWithdrawalRequest) Descriptor() ([]byte, []int) { return file_services_temporal_service_proto_rawDescGZIP(), []int{1} }
invalidate the content of a buffer object's data store
func InvalidateBufferData(buffer uint32) { C.glowInvalidateBufferData(gpInvalidateBufferData, (C.GLuint)(buffer)) }
UninstallOperator uninstalls the RHMI operator by deleting the CSV. If the subscription is not found, it doesn't do anything, as the operator might not be run through OLM
func UninstallOperator(ctx context.Context, client k8sclient.Client, installation *integreatlyv1alpha1.RHMI) error { // Get the operator subscription subscription, err := GetSubscription(ctx, client, installation) if err != nil { return err } // If the subscription is not found, finish: the operator might have ...
Expect uses reflect.DeepEqual to evaluate the equality of two values unless the objects both satisfy the Equaler interface
func Expect(t *testing.T, v, m interface{}) { vt, vok := v.(Equaler) mt, mok := m.(Equaler) var state bool if vok && mok { state = vt.Equal(mt) } else { state = reflect.DeepEqual(v, m) } if state { flux.FatalFailed(t, "Value %+v and %+v are not a match", v, m) return } flux.LogPassed(t, "Value %+v an...
SetValue sets the value property value. The value property
func (m *MessageSecurityStateCollectionResponse) SetValue(value []MessageSecurityStateable)() { m.value = value }
JLoginGET service to return persons data
func JLoginGET(w http.ResponseWriter, r *http.Request) { var params httprouter.Params sess := model.Instance(r) v := view.New(r) v.Vars["token"] = csrfbanana.Token(w, r, sess) params = context.Get(r, "params").(httprouter.Params) cuenta := params.ByName("cuenta") ...
NewServicesHandler creates a new handler to return all specs.
func NewServicesHandler(storage storage.Storage) func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) { specs, err := storage.GetSpecs() if err != nil { http.Error(w, fmt.Sprintf("Error getting the specs from the storage %s", err), http.StatusInternalServerError) ...
NewWorkloadv1LocationWithDefaults instantiates a new Workloadv1Location object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set
func NewWorkloadv1LocationWithDefaults() *Workloadv1Location { this := Workloadv1Location{} return &this }
ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.
func (m *JobHistoryMutation) ResetEdge(name string) error { switch name { case jobhistory.EdgeCreateBy: m.ResetCreateBy() return nil case jobhistory.EdgeBelongTo: m.ResetBelongTo() return nil } return fmt.Errorf("unknown JobHistory edge %s", name) }
StartService Starts selenium server
func StartService() { opts := []selenium.ServiceOption{ selenium.ChromeDriver(helpers.AutomationPath + driverPath), // Specify the path to GeckoDriver in order to use Firefox. selenium.Output(os.Stderr), // Output debug information to STDERR. } selenium.SetDebug(false) selenium, ...
AddExtraCommand adds a sub command.
func (g *App) AddExtraCommand(ptrSt interface{}, names, help string, inits ...extraCmdInit) { if g.root == nil { panic("need Bind or use NewWith") } v := reflect.ValueOf(ptrSt) if v.Kind() != reflect.Ptr && v.Elem().Kind() != reflect.Struct { panic("not a pointer to a struct") } if len(names) == 0 { panic(...
Verifier middleware will verify a JWT passed by a client request. The Verifier will look for a JWT token from: 1. 'jwt' URI query parameter 2. 'Authorization: BEARER T' request header 3. Cookie 'jwt' value The verification processes finishes here and sets the token and a error in the request context and calls the next ...
func (ja *JwtAuth) Verifier(next http.Handler) http.Handler { return ja.Verify("")(next) }
AllocedBytesPerOp returns the "B/op" metric, which is calculated as r.MemBytes / r.N.
func (r BenchmarkResult) AllocedBytesPerOp() int64 {}
WriteResponse to the client
func (o *GetIdentityEndpointsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(200) payload := o.Payload if payload == nil { // return empty array payload = make([]*models.IdentityEndpoints, 0, 50) } if err := producer.Produce(rw, payload); err != nil { panic(err) // let...
Deprecated: Use Scorecard_SparkChartView.ProtoReflect.Descriptor instead.
func (*Scorecard_SparkChartView) Descriptor() ([]byte, []int) { return file_google_monitoring_dashboard_v1_scorecard_proto_rawDescGZIP(), []int{0, 1} }
errInvalidArgument Invalid argument response.
func errInvalidArgument(message string) error { return minio.ErrorResponse{ StatusCode: http.StatusBadRequest, Code: "InvalidArgument", Message: message, RequestID: "minio", } }
Validate validates this band selection type
func (m BandSelectionType) Validate(formats strfmt.Registry) error { var res []error // value enum if err := m.validateBandSelectionTypeEnum("", "body", m); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
IsExist returns whether a file or directory exists.
func IsExist(path string) bool { _, err := os.Stat(path) return err == nil || os.IsExist(err) }
ID that identifies Photon Controller persistent disk
func (o IopingSpecVolumeVolumeSourcePhotonPersistentDiskOutput) PdID() pulumi.StringOutput { return o.ApplyT(func(v IopingSpecVolumeVolumeSourcePhotonPersistentDisk) string { return v.PdID }).(pulumi.StringOutput) }
CreateFeedCreated runs the method Create of the given controller with the given parameters. It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response. If ctx is nil then context.Background() is used. If service is nil then a default service is crea...
func CreateFeedCreated(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.FeedController, tags *string, title *string, url_ string) (http.ResponseWriter, *app.Feed) { // Setup service var ( logBuf bytes.Buffer resp interface{} respSetter goatest.ResponseSetterFunc = func(r interface{})...
CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.Step { return predicate.Step(func(s *sql.Selector) { s.Where(sql.NEQ(s.C(FieldCreatedAt), v)) }) }
GetLatestCommitMessage returns the latest git commit message
func (g *GitLocal) GetLatestCommitMessage(dir string) (string, error) { return g.GitCLI.GetLatestCommitMessage(dir) }
GetJSON will bind JSON response from a url or return a error.
func GetJSON(url string, target interface{}) error { return NewClient(nil).GetJSON(url, target) }
SetParent sets the parent of the WidgetBase and adds the WidgetBase to the Children list of the Container.
func (wb *WidgetBase) SetParent(parent Container) (err error) { if parent == wb.parent { return nil } style := uint32(win.GetWindowLong(wb.hWnd, win.GWL_STYLE)) if style == 0 { return lastError("GetWindowLong") } if parent == nil { wb.SetVisible(false) style &^= win.WS_CHILD style |= win.WS_POPUP ...
convertFile reads the provided .proto file and writes a corresponding .gunk file in the same directory.
func convertFile(path string, overwrite bool, importPath string, protocPath string) error { if filepath.Ext(path) != ".proto" { return fmt.Errorf("convert requires a .proto file") } file, err := os.Open(path) if err != nil { return fmt.Errorf("unable to read file %q: %v", path, err) } defer file.Close() file...
SelectionLen returns the length of the selection, in runes; it is equivalent to utf8.RuneCountInString(e.SelectedText()).
func (l *Selectable) SelectionLen() int { l.initialize() return l.text.SelectionLen() }
Insert will Inserts a value to the set. Returns true if the set did not already contain the specified element.
func (set *RandomizedSet) Insert(val int) bool { if v, ok := set.Value[val]; ok { if v { return false } } else { set.Keys = append(set.Keys, val) } set.Value[val] = true set.Count++ return true }
After proto.Merge called two lists are merged and we cannot be sure of order of the elements and if the element is from the Mesh or from the Dataplane resource.
func (d *DataplaneResource) mergeLists( meshCfg *mesh_proto.PrometheusMetricsBackendConfig, dpCfg *mesh_proto.PrometheusMetricsBackendConfig, ) { aggregate := make(map[string]*mesh_proto.PrometheusAggregateMetricsConfig) for _, conf := range meshCfg.Aggregate { aggregate[conf.Name] = conf } // override Mesh agg...
XXX_OneofFuncs is for the internal use of the proto package.
func (*FeeLimit) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _FeeLimit_OneofMarshaler, _FeeLimit_OneofUnmarshaler, _FeeLimit_OneofSizer, []interface{}{ (*FeeLimit_Fixe...
MarshalLogObject implements zapcore ObjectMarshaler.
func (o operation) MarshalLogObject(enc zapcore.ObjectEncoder) error { enc.AddString("id", o.id.String()) enc.AddBool("first", o.first) enc.AddBool("last", o.last) if o.producer != "" { enc.AddString("producer", o.producer) } return nil }
ListOpenIssues returns all open issues, including pull requests Each page of results consumes one API token. See
func (c *client) ListOpenIssues(org, repo string) ([]Issue, error) { c.log("ListOpenIssues", org, repo) if c.fake { return nil, nil } path := fmt.Sprintf("/repos/%s/%s/issues", org, repo) var issues []Issue err := c.readPaginatedResults( path, acceptNone, org, func() interface{} { return &[]Issue{} ...
this functionality was borrowed from the analysisutil package
func lineStart(f *token.File, line int) token.Pos { // Use binary search to find the start offset of this line. // // TODO(rstambler): eventually replace this function with the // simpler and more efficient (*go/token.File).LineStart, added // in go1.12. min := 0 // inclusive max := f.Size() // exclusive...
Specifies whether email sending is enabled.
func (o GetConfigurationSetSendingOptionOutput) SendingEnabled() pulumi.BoolOutput { return o.ApplyT(func(v GetConfigurationSetSendingOption) bool { return v.SendingEnabled }).(pulumi.BoolOutput) }
MessageStats receiveed message status
func (d *Dao) MessageStats() (err error) { q1 := bson.M{ "$match": bson.M{ "received": bson.M{"$gt": 0}, }, } q2 := bson.M{ "$group": bson.M{ "_id": "$seq", "count": bson.M{"$sum": 1}, }, } q3 := bson.M{ "$project": bson.M{ "_id": 1, "count": 1, }, } var res []model.MessageAggregat...
AutoIndexColumnID returns a unique Column ID/Name for the given Column Number. The functionality is similar to what you get in an Excel spreadsheet w.r.t. the Column ID/Name.
func AutoIndexColumnID(colIdx int) string { charIdx := colIdx % 26 out := string(rune(65 + charIdx)) colIdx = colIdx / 26 if colIdx > 0 { return AutoIndexColumnID(colIdx-1) + out } return out }
AddFeatureDifference adds feature difference to common difference in sum. All images must have the same width, height and format (8bit gray). For every point: excess = max(lo[i] value[i], 0) + max(value[i] hi[i], 0); difference[i] += (weight excessexcess) >> 16; This function is used for difference estimation in algori...
func AddFeatureDifference(value, lo, hi gocvsimd.View, weight uint16, difference gocvsimd.View) { gocvsimd.SimdSse2AddFeatureDifference(value, lo, hi, uint64(weight), difference) }
WritePath writes file and creates any missing path directories.
func WritePath(path string, text string) error { if err := MkMissingDir(filepath.Dir(path)); err != nil { return err } return WriteFile(path, text) }
WithHealthCheckPath returns the receiver adapter after changing the health check path that will be used by the resources created by the adapter.
func (a *Adapter) WithHealthCheckPath(path string) *Adapter { a.healthCheckPath = path return a }
Specifies additional settings for your VDM configuration as applicable to the Dashboard.
func (o ConfigurationSetVdmOptionsOutput) DashboardOptions() ConfigurationSetVdmOptionsDashboardOptionsPtrOutput { return o.ApplyT(func(v ConfigurationSetVdmOptions) *ConfigurationSetVdmOptionsDashboardOptions { return v.DashboardOptions }).(ConfigurationSetVdmOptionsDashboardOptionsPtrOutput) }
GetHasEditExpiredOk returns a tuple with the HasEditExpired field value if set, nil otherwise and a boolean to check if the value has been set.
func (o *InlineResponse200115) GetHasEditExpiredOk() (*bool, bool) { if o == nil || o.HasEditExpired == nil { return nil, false } return o.HasEditExpired, true }
renew performs a single renewal
func (b *Bot) renew( ctx context.Context, botDestination bot.Destination, ) error { // Make sure we can still write to the bot's destination. if err := identity.VerifyWrite(botDestination); err != nil { return trace.Wrap(err, "Cannot write to destination %s, aborting.", botDestination) } b.log.Debug("Attempting...
Save saves the Actor to the database.
func (a *Actor) Save(db XODB) error { if a.Exists() { return a.Update(db) } return a.Insert(db) }
WithButtonStatus configures the button color
func WithButtonStatus(status ButtonStatus) ButtonOption { return func(button *Button) { button.Config.Status = status } }
GenerateDivder Generates a divider block
func GenerateDivder() (section Blocks) { Divider := Blocks{Type: "divider"} return Divider }
TestFile basic test case
func TestFile(t *testing.T) { home, _ := homedir.Dir() // return filepath.Join(home, "test.secrets") filePath := filepath.Join(home, "test.secrets") v := File("test", filePath) assert.Equal(t, "test", v.encodingKey) key1 := "key1" value1 := "value1" v.SetKey(key1, value1) answer1, _ := v.GetValu...
EstimateFeePerWeight takes in a target for the number of blocks until an initial confirmation and returns the estimated fee expressed in satoshis/weight.
func (b *BtcdFeeEstimator) EstimateFeePerWeight(numBlocks uint32) (btcutil.Amount, error) { feePerByte, err := b.EstimateFeePerByte(numBlocks) if err != nil { return 0, err } // We'll scale down the fee per byte to fee per weight, as for each raw // byte, there's 1/4 unit of weight mapped to it. satWeight := f...
control the front and back writing of individual bits in the stencil planes
func StencilMask(mask uint32) { C.glowStencilMask(gpStencilMask, (C.GLuint)(mask)) }
NewGetOrganizationBadRequest creates a GetOrganizationBadRequest with default headers values
func NewGetOrganizationBadRequest() *GetOrganizationBadRequest { return &GetOrganizationBadRequest{} }
FiveHundred writes out a standard internal server error message.
func FiveHundred(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusInternalServerError) w.Write([]byte("500 - Internal Server Error")) }
buildFailureLabel returns the failure label (if passed).
func buildFailureLabel(labelAndArgs ...interface{}) string { if len(labelAndArgs) == 0 { return "" } return fmt.Sprintf(labelAndArgs[0].(string), labelAndArgs[1:]...) + "\n" }
CmdLineArgs are appended to the predefined iperf3 parameters
func (o Iperf3SpecServerConfigurationOutput) CmdLineArgs() pulumi.StringPtrOutput { return o.ApplyT(func(v Iperf3SpecServerConfiguration) *string { return v.CmdLineArgs }).(pulumi.StringPtrOutput) }
check if two parameters, true if it wants Context following by a Renderer
func hasContextAndRenderer(handlerType reflect.Type) bool { //first check if we have pass 2 arguments if handlerType.NumIn() < 2 { return false } firstParamIsContext := hasContextParam(handlerType) //the first argument/parameter is always context if exists otherwise it's only Renderer or ResponseWriter,Reques...
NewUpdateOfficeUserForbidden creates UpdateOfficeUserForbidden with default headers values
func NewUpdateOfficeUserForbidden() *UpdateOfficeUserForbidden { return &UpdateOfficeUserForbidden{} }
MakeDelete Delete an item
func (h Handler) makeDelete(v Injection) http.HandlerFunc { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { params := mux.Vars(r) mtx.Lock() _, deleted := v.Share[params["id"]] delete(v.Share, params["id"]) mtx.Unlock() json.NewEncoder(w).Encode(deleted) }) }
GetCanEditContentsOk returns a tuple with the CanEditContents field value if set, nil otherwise and a boolean to check if the value has been set.
func (o *InlineResponse200115) GetCanEditContentsOk() (*bool, bool) { if o == nil || o.CanEditContents == nil { return nil, false } return o.CanEditContents, true }
NewHandler creates a new build server wrapping a (also newly created) Go language server. I.e., it creates a BuildHandler wrapping a LangHandler. The two handlers share a file system (in memory). The build server is responsible for things such as fetching dependencies, setting up the right file system structure and pat...
func NewHandler(defaultCfg langserver.Config) *BuildHandler { if defaultCfg.MaxParallelism <= 0 { panic(fmt.Sprintf("langserver.Config.MaxParallelism must be at least 1 (got %d)", defaultCfg.MaxParallelism)) } shared := &langserver.HandlerShared{Shared: true} h := &BuildHandler{ HandlerShared: shared, lang: &...
/ V2UpdateHostLogsProgress Update log collection state and progress.
func (a *Client) V2UpdateHostLogsProgress(ctx context.Context, params *V2UpdateHostLogsProgressParams) (*V2UpdateHostLogsProgressNoContent, error) { result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "v2UpdateHostLogsProgress", Method: "PUT", PathPattern: "/v2/inf...
NewMockHandler creates a new mock instance
func NewMockHandler(ctrl *gomock.Controller) *MockHandler { mock := &MockHandler{ctrl: ctrl} mock.recorder = &MockHandlerMockRecorder{mock} return mock }
Characters returns a Profile's characterIds
func (p MemberProfile) Characters() []string { return p.Response.Profile.Data.CharacterIDs }
create a Master. main/mrmaster.go calls this function. nReduce is the number of reduce tasks to use.
func MakeMaster(files []string, nReduce int) *Master { m := Master{} // Your code here. //record each file as a task mapTasks := []MapTask{} j := 0 for _, filename := range files { mapTasks = append(mapTasks, MapTask{filename, j, 0, 0}) j++ } m.mapTasks = mapTasks m.nextmaptask = 0 //generate nReduce red...
Converters for pointer handles for type: cel.Library
func ptrFromHandle_cel_Library(h CGoHandle) cel.Library { p := gopyh.VarFromHandle((gopyh.CGoHandle)(h), "cel.Library") if p == nil { return nil } return p.(cel.Library) }
Exist returns true if the query has elements in the graph.
func (rdq *ResultsDefinitionQuery) Exist(ctx context.Context) (bool, error) { if err := rdq.prepareQuery(ctx); err != nil { return false, err } return rdq.sqlExist(ctx) }
Close terminates the iteration process, releasing any pending underlying resources.
func (it *EtherDeltaDepositIterator) Close() error { it.sub.Unsubscribe() return nil }
The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as "1". Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty).
func (o FioSpecVolumeVolumeSourceAwsElasticBlockStorePtrOutput) Partition() pulumi.IntPtrOutput { return o.ApplyT(func(v *FioSpecVolumeVolumeSourceAwsElasticBlockStore) *int { if v == nil { return nil } return v.Partition }).(pulumi.IntPtrOutput) }
UpdateOneID returns an update builder for the given id.
func (c *MediaClient) UpdateOneID(id int) *MediaUpdateOne { mutation := newMediaMutation(c.config, OpUpdateOne, withMediaID(id)) return &MediaUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} }
if necessary, wraps a type so that its method receiver is of the write type.
func methodReceiver(p Elem) string { switch p.(type) { // structs and arrays are // dereferenced automatically, // so no need to alter varname case *Struct, *Array: return "*" + p.TypeName() // set variable name to // *varname default: p.SetVarname("(*" + p.Varname() + ")") return "*" + p.TypeName() } }
GetApplication will get application status GET /namespaces//applications/
func (s *ApplicationService) GetApplication(c echo.Context) error { namespace := c.Param("namespace") appName := c.Param("appname") ctx := context.TODO() var existApp v1beta1.Application err := s.k8sClient.Get(ctx, client.ObjectKey{Namespace: namespace, Name: appName}, &existApp) if err != nil { if apierrors.I...
Send marshals and sends the DescribeUserHierarchyStructure API request.
func (r DescribeUserHierarchyStructureRequest) Send(ctx context.Context) (*DescribeUserHierarchyStructureResponse, error) { r.Request.SetContext(ctx) err := r.Request.Send() if err != nil { return nil, err } resp := &DescribeUserHierarchyStructureResponse{ DescribeUserHierarchyStructureOutput: r.Request.Data....
NewNodeServer returns as helper object
func NewNodeServer(nodeId string, ephemeral bool, maxVolumesPerNode int64) *nodeServer { return &nodeServer{ nodeID: nodeId, ephemeral: ephemeral, maxVolumePerNode: maxVolumesPerNode, } }
NewUpdateInventoryInventoryListItemNotFound creates a UpdateInventoryInventoryListItemNotFound with default headers values
func NewUpdateInventoryInventoryListItemNotFound() *UpdateInventoryInventoryListItemNotFound { return &UpdateInventoryInventoryListItemNotFound{} }
Equal asserts that two objects are equal. Pointer variable equality is determined based on the equality of the referenced values (as opposed to the memory addresses). assert.Equal(t, 123, 123) Returns whether the assertion was successful (true) or not (false).
func Equal(t Testing, expected, actual interface{}, formatAndArgs ...interface{}) bool { if !AreEqualObjects(expected, actual) { return Fail(t, fmt.Sprintf( "Expected values are NOT equal.%s", diffValues(expected, actual), ), formatAndArgs...) } return true }
IsCode returns true when this put customers customer fid contacts contact fid o k response a status code equal to that given
func (o *PutCustomersCustomerFidContactsContactFidOK) IsCode(code int) bool { return code == 200 }