anchor
stringlengths
10
14.3k
positive
stringlengths
10
14.9k
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 }
getVolunteers only for reporter
func getVolunteers(c *gin.Context) { var vols []Volunteer //Read volunteers from database if err := db.Find(&vols).Error; err != nil { createNotFoundResponse(c) return } //Authorization if user is reporter if !reporterAuth(c) { return } c.JSON(200, vols) }
getFileSystemPackagePath returns a string that represents the package files cache path. In some cases when the path isn't represented by the package name, instead the name represents a specific project's directory's path. In this case we will scan the path until we find the package directory.
func getFileSystemPackagePath(packageCachePath, name, version string) (string, error) { separator := string(filepath.Separator) // For Windows OS path := filepath.Join(name) for path != "" { packagePath := filepath.Join(packageCachePath, path+"@"+version) exists, err := fileutils.IsDirExists(packagePath, false)...
function to delete collector
func deleteCollector(d *schema.ResourceData, m interface{}) error { client := m.(*lmclient.LMSdkGo) // get collector id id, err := strconv.Atoi(d.Id()) if err != nil { return err } params := lm.NewDeleteCollectorByIDParams() params.SetID(int32(id)) restCollectorResponse, err := client.LM.DeleteCollectorByI...
JoinToMaxLength takes a string slice and joins it on sep until the joined string cannot be made larger without crossing maxLength length. If any entry in the slice to be joined is larger than maxLength, it will be added on its own to an entry in the resulting slice
func JoinToMaxLength(toJoin []string, sep string, maxLength int) []string { var out []string curBuilder := strings.Builder{} curBuilder.Grow(maxLength) for _, s := range toJoin { entryLen := len(s) if curBuilder.Len() == 0 && entryLen > maxLength { out = append(out, s) continue } if curBuilder.Len(...
configureWellKnown enables and configures /.wellknown endpoints.
func (r *Routes) configureWellKnown(healthFunc func() bool) { wellKnown := r.Group("/.well-known") { wellKnown.GET("/schema-discovery", func(ctx *gin.Context) { discovery := struct { SchemaURL string `json:"schema_url"` SchemaType string `json:"schema_type"` UIURL string `json:"ui_url"` }{ ...
VerifyWithdrawal will verify a withdrawal given the verification token
func (as *AddressService) VerifyWithdrawal(token string) error { if err := as.client.Get(buildString("address/withdraw/verify/", token), nil); err != nil { return err } return nil }
SetDefaults hydrates default values in the query roles params (not the query body). All values with no default are reset to their zero value.
func (o *QueryRolesParams) SetDefaults() { var ( limitDefault = int64(10) offsetDefault = int64(0) sortDefault = string("last_modified_timestamp|desc") ) val := QueryRolesParams{ Limit: &limitDefault, Offset: &offsetDefault, Sort: &sortDefault, } val.timeout = o.timeout val.Context = o.Context ...
CenterEntityInSurface centers an entity within a surface
func CenterEntityInSurface(entity *Entity, surface *sdl.Surface) { entity.X = (surface.W - entity.W) / 2 }
Create creates a new user. TODO: Verify email address is valid form
func (r mysqlUserRepository) Create(email string) (domain.User, error) { user := domain.User{Email: email} err := r.db.Create(&user).Error if err != nil && strings.Contains(err.Error(), "Duplicate entry") { return domain.User{}, db.DuplicateError{} } return user, err }
Layout clips to the dimensions of the selectable, updates the shaped text, configures input handling, and paints the text and selection rectangles. The provided textMaterial and selectionMaterial ops are used to set the paint material for the text and selection rectangles, respectively.
func (l *Selectable) Layout(gtx layout.Context, lt *text.Shaper, font font.Font, size unit.Sp, textMaterial, selectionMaterial op.CallOp) layout.Dimensions { l.initialize() l.text.LineHeight = l.LineHeight l.text.LineHeightScale = l.LineHeightScale l.text.Alignment = l.Alignment l.text.MaxLines = l.MaxLines l.tex...
Delete will remove the entity from the database.
func (entity *MilitaryForeign) Delete(context *pg.DB, account int64) (int, error) { entity.AccountID = account options := &orm.CreateTableOptions{ Temp: false, IfNotExists: true, } var err error if err = context.CreateTable(&MilitaryForeign{}, options); err != nil { return entity.ID, err } if _, ...
readCombinationOperator Bit 3 4
func (p *PageInformationSegment) readCombinationOperator() error { b, err := p.r.ReadBits(2) if err != nil { return err } p.combinationOperator = bitmap.CombinationOperator(int(b)) return nil }
GetAutomation mocks base method.
func (m *Client) GetAutomation(arg0 context.Context, arg1 int64) (zendesk.Automation, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAutomation", arg0, arg1) ret0, _ := ret[0].(zendesk.Automation) ret1, _ := ret[1].(error) return ret0, ret1 }
Glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. More info:
func (o IopingSpecVolumeVolumeSourcePtrOutput) Glusterfs() IopingSpecVolumeVolumeSourceGlusterfsPtrOutput { return o.ApplyT(func(v *IopingSpecVolumeVolumeSource) *IopingSpecVolumeVolumeSourceGlusterfs { if v == nil { return nil } return v.Glusterfs }).(IopingSpecVolumeVolumeSourceGlusterfsPtrOutput) }
Deprecated: Use Request.ProtoReflect.Descriptor instead.
func (*Request) Descriptor() ([]byte, []int) { return file_ocis_messages_policies_v0_policies_proto_rawDescGZIP(), []int{2} }
Delete removes a gateway or listener of gateway from an app.
func Delete(c *drycc.Client, appID string, name string, port int, protocol string) error { u := fmt.Sprintf("/v2/apps/%s/gateways/", appID) req := api.GatewayRemoveRequest{Name: name, Port: port, Protocol: protocol} body, err := json.Marshal(req) if err != nil { return err } res, err := c.Request("DELETE", ...
Affinity is a group of affinity scheduling rules.
func (o QperfSpecServerConfigurationPodSchedulingPtrOutput) Affinity() QperfSpecServerConfigurationPodSchedulingAffinityPtrOutput { return o.ApplyT(func(v *QperfSpecServerConfigurationPodScheduling) *QperfSpecServerConfigurationPodSchedulingAffinity { if v == nil { return nil } return v.Affinity }).(QperfSpe...
The name of the storage system as configured in ScaleIO.
func (o FioSpecVolumeVolumeSourceScaleIOPtrOutput) System() pulumi.StringPtrOutput { return o.ApplyT(func(v *FioSpecVolumeVolumeSourceScaleIO) *string { if v == nil { return nil } return &v.System }).(pulumi.StringPtrOutput) }
ReadOnly here will force the Quobyte volume to be mounted with readonly permissions. Defaults to false.
func (o IopingSpecVolumeVolumeSourceQuobyteOutput) ReadOnly() pulumi.BoolPtrOutput { return o.ApplyT(func(v IopingSpecVolumeVolumeSourceQuobyte) *bool { return v.ReadOnly }).(pulumi.BoolPtrOutput) }
Top gives the topmost item of the stack
func (s *LinkedStack) Top() (interface{}, error) { if s.topPtr == nil { return nil, errors.New("Stack is Empty") } return s.topPtr.item, nil }
set block times with ttl for ns/alarmVersion/host.
func (b *block) setBlockTimes(ns, alarmVersion, hostname, tagString string, times, timesTTL int) error { return b.c.SetWithTTL( BlockTimesKey(ns, alarmVersion, hostname, tagString), strconv.Itoa(int(times)), time.Duration(timesTTL)*time.Minute+10*time.Second) }
DeliveryRuleRequestMethodConditionGenerator returns a generator of DeliveryRuleRequestMethodCondition instances for property testing. We first initialize deliveryRuleRequestMethodConditionGenerator with a simplified generator based on the fields with primitive types then replacing it with a more complex one that also h...
func DeliveryRuleRequestMethodConditionGenerator() gopter.Gen { if deliveryRuleRequestMethodConditionGenerator != nil { return deliveryRuleRequestMethodConditionGenerator } generators := make(map[string]gopter.Gen) AddIndependentPropertyGeneratorsForDeliveryRuleRequestMethodCondition(generators) deliveryRuleReq...
GetVolumeSize returns the actual and maximum size of the volume plus a DiskType and a DirtyFlag
func GetVolumeSize(log *base.LogObject, name string) (uint64, uint64, string, bool, error) { info, err := os.Stat(name) if err != nil { errStr := fmt.Sprintf("GetVolumeSize failed for %s: %v", name, err) return 0, 0, "", false, errors.New(errStr) } if info.IsDir() { // Assume this is a container size, er...
MarshalEasyJSON supports easyjson.Marshaler interface
func (v PlantainerShadowStateSt) MarshalEasyJSON(w *jwriter.Writer) { easyjson5bd79fa1EncodeMevericcoreMcplantainer3(w, v) }
NewProductFromDownloader takes a downloader and builds a Product struct
func NewProductFromDownloader(dl downloader.Downloader, url string) (*Product, error) { // Fetch the URL content, err := dl.Download(url) if err != nil { return nil, err } // Parse the product parser := new(parser.ProductParser) results := parser.Parse(content.Data) // Convert price to float unit_price := ...
Create a flag set with flags common to most commands.
func (c *Command) DefaultFlagSet(cn string) *flag.FlagSet { f := flag.NewFlagSet(cn, flag.ExitOnError) f.StringVar(&c.workingDirFlag, "workingdir", "", "Working Directory. Defaults to current working directory.") f.StringVar(&c.projectOutFile, "projectout", "", "Where to save the project (json protobuf).") f.String...
Wrapper for returing precondition failure status from missing checkout/input root digest
func getCheckoutMissingStatus(snapshotID string) (*google_rpc_status.Status, error) { inputRoot, err := bazel.DigestFromSnapshotID(snapshotID) if err != nil { return nil, fmt.Errorf("Failed to convert SnapshotID %s to Digest: %s", snapshotID, err) } return getFailedPreconditionStatus([]*remoteexecution.Digest{inp...
NewServeBuildTypesInProjectParamsWithHTTPClient creates a new ServeBuildTypesInProjectParams object with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewServeBuildTypesInProjectParamsWithHTTPClient(client *http.Client) *ServeBuildTypesInProjectParams { var () return &ServeBuildTypesInProjectParams{ HTTPClient: client, } }
Nil asserts that the v is nil. assert.Nil(t, err, "err should be nothing") Returns whether the assertion was successful (true) or not (false).
func Nil(t Testing, v interface{}, formatAndArgs ...interface{}) bool { if isNil(v) { return true } return Fail(t, pretty.Sprintf("Expected to be nil, but got: %# v", v), formatAndArgs...) }
NewEndpointResource creates an instance of EndpointResource from the given Endpointer.
func NewEndpointResource(e Endpointer) EndpointResource { return EndpointResource{ Resource: "endpoint", Name: e.GetName(), Path: e.GetPath(), MethodsList: GetMethodsList(e), Methods: GetMethods(e), MediaTypesList: GetContentTypesList(hAPI, e), MediaTypes: GetConte...
Deprecated: Use CreateVacancyV1Response.ProtoReflect.Descriptor instead.
func (*CreateVacancyV1Response) Descriptor() ([]byte, []int) { return file_api_ocp_vacancy_api_ocp_vacancy_api_proto_rawDescGZIP(), []int{2} }
ThisFunction returns calling function name
func ThisFunction() string { var pc [32]uintptr runtime.Callers(2, pc[:]) return runtime.FuncForPC(pc[0]).Name() }
GetType returns the value of the "type" field in the mutation.
func (m *ResourceMutation) GetType() (r string, exists bool) { v := m._type if v == nil { return } return *v, true }
User to map volume access to Defaults to serivceaccount user
func (o IopingSpecVolumeVolumeSourceQuobyteOutput) User() pulumi.StringPtrOutput { return o.ApplyT(func(v IopingSpecVolumeVolumeSourceQuobyte) *string { return v.User }).(pulumi.StringPtrOutput) }
AddGetRecordsTimeout records the number of times the GetRecords API timed out on the HTTP level. This is influenced by the WithHTTPClientTimeout configuration.
func (dsc *DefaultConsumerStatsCollector) AddGetRecordsTimeout(count int) { dsc.GetRecordsTimeout.Inc(int64(count)) }
MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetCharactersCharacterIdClonesOk) MarshalEasyJSON(w *jwriter.Writer) { easyjson13ace497EncodeGithubComAntihaxGoesiEsi1(w, v) }
GetName returns the Name field value
func (o *Project) GetName() string { if o == nil { var ret string return ret } return o.Name }
New builds the Shoe from decks of Cards and then shuffles it
func New(decks int, shuffles int) *Shoe { var ret Shoe for i := 0; i < decks; i++ { ret.addDeck() } for i := 0; i < shuffles; i++ { ret.Shuffle() } return &ret }
Reconcile updates ClientConfigs of MutatingWebhookConfigurations to contain the CABundle from the respective Istio SA secret
func (r *reconciler) Reconcile(request reconcile.Request) (reconcile.Result, error) { logger := log.WithValues("WebhookConfig", request.Name) logger.Info("reconciling MutatingWebhookConfiguration") // get current webhook config currentConfig := &v1beta1.MutatingWebhookConfiguration{} err := r.Client.Get(context.TO...
DeliveryRuleClientPortCondition_STATUSGenerator returns a generator of DeliveryRuleClientPortCondition_STATUS instances for property testing. We first initialize deliveryRuleClientPortCondition_STATUSGenerator with a simplified generator based on the fields with primitive types then replacing it with a more complex one...
func DeliveryRuleClientPortCondition_STATUSGenerator() gopter.Gen { if deliveryRuleClientPortCondition_STATUSGenerator != nil { return deliveryRuleClientPortCondition_STATUSGenerator } generators := make(map[string]gopter.Gen) AddIndependentPropertyGeneratorsForDeliveryRuleClientPortCondition_STATUS(generators) ...
NewStorageConfig loads storage configuration for a S3 FileSystem service in the given namespace. If no storage config is found in that namespace, the koaljasystem namespace is used. +kubebuilder:rbac:groups=,resources=configmaps,verbs=get;list;watch
func NewStorageConfig(ctx context.Context, c client.Reader, ns string) (*StorageConfig, error) { var configMap corev1.ConfigMap key := client.ObjectKey{ Name: constants.ConfigMapS3Storage, Namespace: ns, } if err := c.Get(ctx, key, &configMap); errors.IsNotFound(err) { // Try koalja-system namespace ke...
The rados user name. Default is admin. More info:
func (o IopingSpecVolumeVolumeSourceRbdOutput) User() pulumi.StringPtrOutput { return o.ApplyT(func(v IopingSpecVolumeVolumeSourceRbd) *string { return v.User }).(pulumi.StringPtrOutput) }
(Output) URI of the Service deployed.
func (o FunctionServiceConfigOutput) Uri() pulumi.StringPtrOutput { return o.ApplyT(func(v FunctionServiceConfig) *string { return v.Uri }).(pulumi.StringPtrOutput) }
doTest runs a test, which involves generating the packet, sending it in the specified interface, then comparing any packets coming from the border router against the expected packets from the test. It returns true if the test was successful, ie. all expected packets and no others were received, otherwise it returns fal...
func doTest(t *BRTest, cases []reflect.SelectCase) error { devInfo, ok := devByName[t.In.Dev] if !ok { return fmt.Errorf("No device information for: %s\n", t.In.Dev) } raw, err := t.In.Pack(devInfo.mac) if err != nil { return err } err = devInfo.handle.WritePacketData(raw) if err != nil { return err } r...
Helper function for ComputeClassLoaderContext() that handles recursion.
func computeClassLoaderContextRec(clcs []*ClassLoaderContext) (string, string, android.Paths) { var paths android.Paths var clcsHost, clcsTarget []string for _, clc := range clcs { subClcHost, subClcTarget, subPaths := computeClassLoaderContextRec(clc.Subcontexts) if subPaths != nil { subClcHost = "{" + subC...
ActiveUsers returns the current set of active users for the current timestamp. It is only valid until the following Next() call and should not be modified.
func (u *UserCalculator) ActiveUsers() []string { return u.active }
Display nodes for testing purposes
func (s *stack) Display() { for i := int32(0); i < s.getCount(); i++ { fmt.Printf("NODE IN STACK: %+v %p \n", s.nodes[i], s.nodes[i]) } fmt.Println("TOTAL COUNT:", s.getCount()) }
AbbrevName2 third way to do it
func AbbrevName2(name string) string { var parts []string for _, part := range strings.Split(name, " ") { parts = append(parts, strings.ToUpper(part[:1])) } return strings.Join(parts, ".") }
ConfigureLogging will setup the glg logging package with the correct file destination coloring, etc. as desired for the entire application.
func ConfigureLogging(level string, logPath string) { if logPath != "" { infolog = glg.FileWriter(logPath, 0644) glg.Get().AddWriter(infolog) } glg.Get(). SetMode(glg.BOTH). EnableColor(). SetLevelMode(glg.LOG, glg.NONE) // Map the config log level value to an internal representation that is easier //...
UpdateAll updates all rows with the specified column values, using an executor.
func (o PeerSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) { ln := int64(len(o)) if ln == 0 { return 0, nil } if len(cols) == 0 { return 0, errors.New("model: update all requires at least one column argument") } colNames := make([]string, len(cols)) args := make([]i...
WaitForPodSucceeded waits until the Pod status is Succeeded.
func WaitForPodSucceeded(ctx context.Context, pods corev1.PodInterface, podName string, timeout time.Duration) error { log.Entry(ctx).Infof("Waiting for %s to be complete", podName) w, err := pods.Watch(ctx, metav1.ListOptions{}) if err != nil { return fmt.Errorf("initializing pod watcher: %s", err) } defer w.S...
TestExecute feeds input to the CLI and validates results. scan() is implicitly tested here.
func TestExecute(t *testing.T) { fmt.Println("TestExecute start") var inputSource *bytes.Buffer ipTest := []IPTest{ {"127.0.0.1", "9999", 1, 1}, {"8.8.8.8", "443", 1, 0}, {"::1", "9999", 1, 1}, {"127.0.0.1 ::1", "9999", 2, 2}} for _, v := range ipTest { inputSource = bytes.NewBuffer([]byte(fmt.Sprintf("se...
MakeEndpointNodeID produces an endpoint node ID from its composite parts.
func MakeEndpointNodeID(hostID, address, port string) string { return lookupID(hostID, address, port, func() string { return MakeAddressNodeID(hostID, address) + ScopeDelim + port }) }
Generates an Authenticate mock function which will return (authenticate, err)
func authenticateGenerator(authenticate bool, err error) func(r *http.Request) (bool, error) { return func(r *http.Request) (bool, error) { return authenticate, err } }
log writes to the io.Writer defined by Logger or standard out if Logger is not set. All input values are prefixed with "redicrypt: ".
func (rc *RediCrypt) log(input string) { if input == "" { return } output := fmt.Sprintf("redicrypt: %s", input) if rc == nil || rc.Logger == nil { fmt.Println(output) return } rc.Logger.Write([]byte(output)) }
Remove any values which match the specified regular expression from the PATH environment variable
func removePath(regexValue string) { regex, _ := regexp.Compile(regexValue) newPath := regex.ReplaceAllString(getPath(), "") setPath(newPath) }
loadRates loads rate codes from JSON file.
func loadRateTable(path string) map[stay]*rate.RatePlan { file := data.MustAsset("data/rates.json") rates := []*rate.RatePlan{} if err := json.Unmarshal(file, &rates); err != nil { log.Fatalf("Failed to load json: %v", err) } rateTable := make(map[stay]*rate.RatePlan) for _, ratePlan := range rates { stay :...
/ NewTransaction() To return new transaction data
func NewTransaction(eventType string, consumerName string, consumerId string, consumerAddress string, consumerRequire string, consumerCharge string, consumerDischargeRate string, buyRate string, requireEventId string, supplierName string, supplierId string, supplierAddress string, supplierToSupply string, supplierSup...
ProfileHandler is a handler to serve up user profile data from the database
func ProfileHandler(c buffalo.Context) error { user := models.User{} db := c.Value("tx").(*pop.Connection) db.Find(&user, c.Param("uid")) return c.Render(200, r.JSON(user)) }
Validate checks the field values on StreamAccessLogsMessage_HTTPAccessLogEntries 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 *StreamAccessLogsMessage_HTTPAccessLogEntries) Validate() error { return m.validate(false) }