anchor stringlengths 10 14.3k | positive stringlengths 10 14.9k |
|---|---|
GetProviderString will return an identifying string for itself | func (u *UnknownProvider) GetProviderString() string {
return "unknown"
} |
NewGetDevicesAircubesIDNetworkNotFound creates a GetDevicesAircubesIDNetworkNotFound with default headers values | func NewGetDevicesAircubesIDNetworkNotFound() *GetDevicesAircubesIDNetworkNotFound {
return &GetDevicesAircubesIDNetworkNotFound{}
} |
Remaining returns the number of unread bytes left | func (r *Reader) Remaining() int {
return len(r.buf)
} |
regenerateKeyHandleResponse handles the RegenerateKey response. | func (client *RedisClient) regenerateKeyHandleResponse(resp *http.Response) (RedisRegenerateKeyResponse, error) {
result := RedisRegenerateKeyResponse{RawResponse: resp}
if err := runtime.UnmarshalAsJSON(resp, &result.RedisAccessKeys); err != nil {
return RedisRegenerateKeyResponse{}, runtime.NewResponseError(err, ... |
NewDiskManifestLoader creates a new manifest loader for the given paths and kind. | func NewDiskManifestLoader[T kubernetesManifest](paths ...string) DiskManifestLoader[T] {
var zero T
return DiskManifestLoader[T]{
paths: paths,
kind: zero.Kind(),
}
} |
getWaitTime returns the wait time to sleep for. This is the same as webapp reconnection logic. | func getWaitTime(failCount int) time.Duration {
waitTime := minWebsocketReconnectDuration
if failCount > maxWebsocketFails {
waitTime *= time.Duration(failCount) * time.Duration(failCount)
if waitTime > maxWebsocketReconnectDuration {
waitTime = maxWebsocketReconnectDuration
}
}
return waitTime
} |
WriteResponse to the client | func (o *PutUserSubscriptionsOwnerRepoForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(403)
} |
GetAllJoinPoolAndStakeAsset returns all JoinPoolAndStakeAsset | func (k Keeper) GetAllJoinPoolAndStakeAsset(ctx sdk.Context) (list []types.JoinPoolAndStakeAsset) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.JoinPoolAndStakeAssetKey))
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next... |
QueryDepositAddress returns the deposit address for a specified currency | func (h *HUOBI) QueryDepositAddress(ctx context.Context, cryptocurrency currency.Code) ([]DepositAddress, error) {
resp := struct {
DepositAddress []DepositAddress `json:"data"`
}{}
vals := url.Values{}
vals.Set("currency", cryptocurrency.Lower().String())
err := h.SendAuthenticatedHTTPRequest(ctx, exchange.Re... |
PodScheduling contains options to determine which node the pod should be scheduled on | func (o Iperf3SpecServerConfigurationPtrOutput) PodScheduling() Iperf3SpecServerConfigurationPodSchedulingPtrOutput {
return o.ApplyT(func(v *Iperf3SpecServerConfiguration) *Iperf3SpecServerConfigurationPodScheduling {
if v == nil {
return nil
}
return v.PodScheduling
}).(Iperf3SpecServerConfigurationPodSche... |
expandStoredInfoTypeLargeCustomDictionarySlice expands the contents of StoredInfoTypeLargeCustomDictionary into a JSON request object. | func expandStoredInfoTypeLargeCustomDictionarySlice(c *Client, f []StoredInfoTypeLargeCustomDictionary, res *StoredInfoType) ([]map[string]interface{}, error) {
if f == nil {
return nil, nil
}
items := []map[string]interface{}{}
for _, item := range f {
i, err := expandStoredInfoTypeLargeCustomDictionary(c, &i... |
/ V2UpdateClusterInstallConfig Override values in the install config. | func (a *Client) V2UpdateClusterInstallConfig(ctx context.Context, params *V2UpdateClusterInstallConfigParams) (*V2UpdateClusterInstallConfigCreated, error) {
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "v2UpdateClusterInstallConfig",
Method: "PATCH",
PathPattern:... |
Helper method to count/check arguments | func (sc gloomList) countArgs() (int, error) {
// Extract all "arg characters" in the list
args := []int{}
for _, arg := range sc.Elems {
if v, ok := arg.(argument); ok {
args = append(args, int(v))
}
}
// Early exit for no-args case
if len(args) == 0 {
return 0, nil
}
// Sort the argument numbers in... |
/ The constructor returns a NewObjectValues with the an operand cast to a Function as the FunctionConstructor. | func (this *ObjectValues) Constructor() FunctionConstructor {
return func(operands ...Expression) Function {
return NewObjectValues(operands[0])
}
} |
SetObjectType sets field value | func (o *WorkflowWorkflowDefinitionAllOf) SetObjectType(v string) {
o.ObjectType = v
} |
MultiCloser implements io.Close, it sequentially calls Close() on each object | func MultiCloser(closers ...io.Closer) io.Closer {
return &multiCloser{
closers: closers,
}
} |
Parse returns a map from statement name to parse.Tree, created by parsing the statements described in the argument string. The toplevel statement will be given the specified name. If an error occurs, parsing stops and an empty map is returned with the error. | func Parse(name, text string) (*Tree, error) {
t := New(name)
t.text = text
return t.Parse(text)
} |
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeBackupDelete. | func (in *VolumeBackupDelete) DeepCopy() *VolumeBackupDelete {
if in == nil {
return nil
}
out := new(VolumeBackupDelete)
in.DeepCopyInto(out)
return out
} |
expandStoredInfoTypeLargeCustomDictionary expands an instance of StoredInfoTypeLargeCustomDictionary into a JSON request object. | func expandStoredInfoTypeLargeCustomDictionary(c *Client, f *StoredInfoTypeLargeCustomDictionary, res *StoredInfoType) (map[string]interface{}, error) {
if dcl.IsEmptyValueIndirect(f) {
return nil, nil
}
m := make(map[string]interface{})
if v, err := expandStoredInfoTypeLargeCustomDictionaryOutputPath(c, f.Outpu... |
Context for current client instance | func (c *RedisClient) Context() context.Context {
return c.ctx
} |
OrderFills is a free data retrieval call binding the contract method 0x19774d43. Solidity: function orderFills( address, bytes32) constant returns(uint256) | func (_EtherDelta *EtherDeltaSession) OrderFills(arg0 common.Address, arg1 [32]byte) (*big.Int, error) {
return _EtherDelta.Contract.OrderFills(&_EtherDelta.CallOpts, arg0, arg1)
} |
Put inserts a record | func (cb *cachedBatch) Put(namespace string, key, value []byte, errorFormat string, errorArgs ...interface{}) {
cb.lock.Lock()
defer cb.lock.Unlock()
h := cb.hash(namespace, key)
cb.Write(h, value)
cb.batch(Put, namespace, key, value, errorFormat, errorArgs)
} |
This functions accepts a byte array containing a JSON | func ParseUser(jsonBuffer []byte) (models.User, error) {
var user models.User
// Unmarshal the json into it. this will use the struct tag
err := json.Unmarshal(jsonBuffer, &user)
// the array is now filled with users
return user, err
} |
parseClientCfgFile parses config yaml file to global config varaible | func parseClientCfgFile(filePath string) (*WorkerNodeConfig, error) {
dat, err := ioutil.ReadFile(filePath)
if err != nil {
return nil, trace.Wrap(err)
}
var cfg WorkerNodeConfig
err = yaml.Unmarshal(dat, &cfg)
if err != nil {
return nil, trace.Wrap(err)
}
cfg.SilenceTimeout = cfg.SilenceTimeout * time.Se... |
RequestHeaders extracts saved headers from context. saveHeaders middleware required for operation. | func RequestHeaders(ctx context.Context) http.Header {
return ctx.Value(headersKey).(http.Header)
} |
Messages return the message channel for this consumer | func (c *consumerImpl) Messages() <-chan messaging.Message {
return c.msgChan
} |
EncryptWithPrivateKey will encrypt the data using a given private key | func EncryptWithPrivateKey(privateKey *bsvec.PrivateKey, data string) (string, error) {
// Encrypt using bsvec
encryptedData, err := bsvec.Encrypt(privateKey.PubKey(), []byte(data))
if err != nil {
return "", err
}
// Return the hex encoded value
return hex.EncodeToString(encryptedData), nil
} |
Type gets the type of this polymorphic type | func (m *sdt) Type() string {
return "SDT"
} |
GetEmailRequested returns value of EmailRequested conditional field. | func (i *Invoice) GetEmailRequested() (value bool) {
if i == nil {
return
}
return i.Flags.Has(3)
} |
SetCreateByUser sets the "create_by_user" field. | func (m *OrgUnitMutation) SetCreateByUser(i int) {
m.create_by = &i
} |
MaxAllCPU selects the MAX of all metrics under 'cpu' per hour for N random hosts Queries: cpumaxall1 cpumaxall8 | func (d *Devops) MaxAllCPU(qi query.Query, nHosts int) {
interval := d.Interval.MustRandWindow(devops.MaxAllDuration)
selectClauses := d.getSelectAggClauses("max", devops.GetAllCPUMetrics())
hosts, err := d.GetRandomHosts(nHosts)
panicIfErr(err)
sql := fmt.Sprintf(`
SELECT
hour(timestamp) AS hour,
%s
FR... |
DataDir returns the place where saves, mods and others are located. | func (f *Factorio) DataDir() string {
return f.datadir
} |
If true, enables [Malware Protection]( as data source for the detector. Defaults to `true`. | func (o DetectorDatasourcesMalwareProtectionScanEc2InstanceWithFindingsEbsVolumesPtrOutput) Enable() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *DetectorDatasourcesMalwareProtectionScanEc2InstanceWithFindingsEbsVolumes) *bool {
if v == nil {
return nil
}
return &v.Enable
}).(pulumi.BoolPtrOutput)
} |
Hook up gocheck into the "go test" runner. | func Test(t *testing.T) { TestingT(t) } |
Deprecated: Use CreateTestRequest.ProtoReflect.Descriptor instead. | func (*CreateTestRequest) Descriptor() ([]byte, []int) {
return file_yandex_cloud_loadtesting_agent_v1_test_service_proto_rawDescGZIP(), []int{1}
} |
The label key that the selector applies to. | func (o IopingSpecPodConfigPodSchedulingAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecutionNodeSelectorTermsMatchFieldsOutput) Key() pulumi.StringOutput {
return o.ApplyT(func(v IopingSpecPodConfigPodSchedulingAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecutionNodeSelectorTermsMatchFields... |
/ DBConn Function which opens a new connection with db | func DBConn() (db *sql.DB) {
dbDriver := "mysql"
dbUser := "root"
dbPass := "vrajupaj"
dbName := "example"
db, err := sql.Open(dbDriver, dbUser+":"+dbPass+"@/"+dbName)
if err != nil {
panic(err.Error())
} else {
log.Println("Connection was opened correctly")
}
return db
} |
New instantiates a Service object. | func New(untypedConfig *any.Any, logger *zap.Logger, scope tally.Scope) (module.Module, error) {
config := &configv1.Config{}
if err := untypedConfig.UnmarshalTo(config); err != nil {
return nil, err
}
store, ok := service.Registry[experimentstore.Name]
if !ok {
return nil, errors.New("could not find experime... |
createPV creates a PersistentVolume. | func (ls *LocalStorage) createPV(ctx context.Context, apiObject *api.ArangoLocalStorage, clients []provisioner.API, clientsOffset int, volSize int64, claim v1.PersistentVolumeClaim, deploymentName, role string) error {
log := ls.deps.Log
// Try clients
for clientIdx := 0; clientIdx < len(clients); clientIdx++ {
cl... |
Login tries to log in | func (u *UnknownProvider) Login(ctx context.Context) (string, error) {
return "", errors.New("Cannot log in using unknown provider")
} |
updates a subset of a buffer object's data store | func NamedBufferSubData(buffer uint32, offset int, size int, data unsafe.Pointer) {
C.glowNamedBufferSubData(gpNamedBufferSubData, (C.GLuint)(buffer), (C.GLintptr)(offset), (C.GLsizeiptr)(size), data)
} |
removeIfFile will inspect the uri, and if the uri is a file scheme, it will atempt to remove the specified file. This is primarily used after launching the initial containers. If they're from the local filesystem, we'll remove them to keep memory usage down on the tmpfs root. | func removeIfFile(uri string) {
u, err := url.Parse(uri)
if err != nil {
return
}
if u.Scheme != "file" {
return
}
os.Remove(u.Path)
} |
NewGetLolAcsV2RecentlyPlayedChampionsCurrentSummonerParamsWithContext creates a new GetLolAcsV2RecentlyPlayedChampionsCurrentSummonerParams object with the default values initialized, and the ability to set a context for a request | func NewGetLolAcsV2RecentlyPlayedChampionsCurrentSummonerParamsWithContext(ctx context.Context) *GetLolAcsV2RecentlyPlayedChampionsCurrentSummonerParams {
var ()
return &GetLolAcsV2RecentlyPlayedChampionsCurrentSummonerParams{
Context: ctx,
}
} |
AddedField returns the numeric value that was in/decremented from a field with the given name. The second value indicates that this field was not set, or was not define in the schema. | func (m *DrugMutation) AddedField(name string) (ent.Value, bool) {
return nil, false
} |
clearLog clears the log message. | func (ui *UI) clearLog() error {
return ui.writeContent(LOG_PANEL, "")
} |
NewGetDeviceHealthParams creates a new GetDeviceHealthParams object with the default values initialized. | func NewGetDeviceHealthParams() *GetDeviceHealthParams {
var ()
return &GetDeviceHealthParams{
timeout: cr.DefaultTimeout,
}
} |
GetNamespaceCustomerManagedKey gets an existing NamespaceCustomerManagedKey resource's state with the given name, ID, and optional state properties that are used to uniquely qualify the lookup (nil if not required). | func GetNamespaceCustomerManagedKey(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *NamespaceCustomerManagedKeyState, opts ...pulumi.ResourceOption) (*NamespaceCustomerManagedKey, error) {
var resource NamespaceCustomerManagedKey
err := ctx.ReadResource("azure:eventhub/namespaceCustomerManagedKey:Namespa... |
Specify the value of a uniform variable for a specified program object | func ProgramUniform3iv(program uint32, location int32, count int32, value *int32) {
C.glowProgramUniform3iv(gpProgramUniform3iv, (C.GLuint)(program), (C.GLint)(location), (C.GLsizei)(count), (*C.GLint)(unsafe.Pointer(value)))
} |
handleMessage should be called for all MESSAGE messages received for this consumer. | func (c *Consumer) handleMessage(f frame.Frame) error {
m := Message{
Topic: c.topic,
consumerID: c.consumerID,
Msg: f.BaseCmd.GetMessage(),
Meta: f.Metadata,
Payload: f.Payload,
}
select {
case c.queue <- m:
return nil
default:
// Add messageId to overflow buffer, avoiding dup... |
Gets the current Vizier if there is one in kubeconfig, even if it isn't healthy. Gets the first healthy Vizier otherwise. This is intentionally different from other px commands, since debug commands may run on an unhealthy Vizier. | func getVizier(cloudAddr string) (uuid.UUID, error) {
id, err := vizier.GetCurrentVizier(cloudAddr)
if err != nil || id == uuid.Nil {
id, err = vizier.FirstHealthyVizier(cloudAddr)
}
return id, err
} |
TimeZoneCurrentTime handles /tz Slack Slash Command | func TimeZoneCurrentTime(w http.ResponseWriter, r *http.Request) {
// Verify Slack Request with Signing Secret, and Timeout check
if ok := verifySlackSignature(r, []byte(slackSigningSecret)); ok == false {
w.WriteHeader(http.StatusInternalServerError)
log.Println("failed on VerifyRequest()")
return
}
// Par... |
FindOne User by ID. | func (ps *UserService) FindOne(loggedInUser string, id string) (user, error) {
dummy, err := ps.repository.FindOne(id)
if err != nil {
panic(err)
}
return dummy, nil
} |
AddMetricType optionally adds a metric.type corresponding to an OpenCensus custom metric to the Filter | func (f *Filter) AddMetricType(t string) {
const (
metricPath = "custom.googleapis.com/opencensus"
metricType = "metric.type"
)
if strings.Contains(f.String(), metricType) {
glog.Fatalf("Stackdriver filters may only contain one '%s'", metricType)
}
f.add(fmt.Sprintf("%s=\"%s/%s\"", metricType, metricPath, t)... |
Copy deep copy of this node and children | func (n Node) Copy() *Node {
newNode := n
if newNode.ChildNode != nil {
n.ChildNode = newNode.ChildNode.Copy()
}
return &newNode
} |
NodeID returns NodeID in []byte if the type of IE matches. | func (i *IE) NodeID() ([]byte, error) {
if len(i.Payload) < 1 {
return nil, io.ErrUnexpectedEOF
}
switch i.Type {
case FullyQualifiedCSID:
switch (i.Payload[0] >> 4) & 0x0f {
case nodeIDIPv4, nodeIDOther:
if len(i.Payload) < 6 {
return nil, io.ErrUnexpectedEOF
}
return i.Payload[1:5], nil
case... |
Host Caching mode: None, Read Only, Read Write. | func (o IopingSpecVolumeVolumeSourceAzureDiskOutput) CachingMode() pulumi.StringPtrOutput {
return o.ApplyT(func(v IopingSpecVolumeVolumeSourceAzureDisk) *string { return v.CachingMode }).(pulumi.StringPtrOutput)
} |
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be nonnil. | func (in *KeyVaultReference_STATUS_ARM) DeepCopyInto(out *KeyVaultReference_STATUS_ARM) {
*out = *in
if in.Id != nil {
in, out := &in.Id, &out.Id
*out = new(string)
**out = **in
}
if in.Url != nil {
in, out := &in.Url, &out.Url
*out = new(string)
**out = **in
}
} |
CreateStatus creates or updates the status of a commit. See | func (c *client) CreateStatus(org, repo, SHA string, s Status) error {
return c.CreateStatusWithContext(context.Background(), org, repo, SHA, s)
} |
AddIndependentPropertyGeneratorsForDeliveryRuleRequestUriCondition_STATUS is a factory method for creating gopter generators | func AddIndependentPropertyGeneratorsForDeliveryRuleRequestUriCondition_STATUS(gens map[string]gopter.Gen) {
gens["Name"] = gen.PtrOf(gen.AlphaString())
} |
copy from kubectl addResourceList adds the resources in newList to list | func addResourceList(list, new v1.ResourceList) {
for name, quantity := range new {
if value, ok := list[name]; !ok {
list[name] = quantity.DeepCopy()
} else {
value.Add(quantity)
list[name] = value
}
}
} |
GetComponentOk returns a tuple with the Component field value if set, nil otherwise and a boolean to check if the value has been set. | func (o *ReportingTaskEntity) GetComponentOk() (*ReportingTaskDTO, bool) {
if o == nil || o.Component == nil {
return nil, false
}
return o.Component, true
} |
GetDNSAdsBlocking obtains if ads hostnames/IPs should be blocked from being resolved by Unbound, using the environment variable BLOCK_ADS | func (r *reader) GetDNSAdsBlocking() (blocking bool, err error) {
return r.envParams.GetOnOff("BLOCK_ADS", libparams.Default("off"))
} |
NewBackendService creates a new BackendService stack from a manifest file. | func NewBackendService(mft *manifest.BackendService, env, app string, rc RuntimeConfig) (*BackendService, error) {
parser := template.New()
addons, err := addon.New(aws.StringValue(mft.Name))
if err != nil {
return nil, fmt.Errorf("new addons: %w", err)
}
envManifest, err := mft.ApplyEnv(env) // Apply environmen... |
Warning is alias of Warn | func Warning(args ...interface{}) {
Warn(args...)
} |
Value implements the database/sql/driver Valuer interface. | func (src Macaddr) Value() (driver.Value, error) {
return EncodeValueText(src)
} |
RemoveSource removes an audio Source from the Selector. | func (s *DefaultSelector) RemoveSource(name string) error {
s.Lock()
defer s.Unlock()
if _, ok := s.sources[name]; !ok {
return fmt.Errorf("unknown source %s", name)
}
delete(s.sources, name)
return nil
} |
Run runs the pacemaker which will beat when the previous QC is completed | func (p FixedLeader) Run(ctx context.Context) {
notify := p.GetNotifier()
if p.GetID() == p.leader {
go p.Propose()
}
var n hotstuff.Notification
var ok bool
for {
select {
case n, ok = <-notify:
if !ok {
return
}
case <-ctx.Done():
return
}
switch n.Event {
case hotstuff.QCFinish:
i... |
NewController creates a new instance of Controller | func NewController(betValidator BetValidator, betService BetService) *Controller {
return &Controller{
betValidator: betValidator,
betService: betService,
}
} |
SendDataOrion sends the data to Orion | func SendDataOrion(header http.Header, body map[string]interface{}, hashString string) error {
// Copy the body into a new variable.
// This will be the body of the http request to Orion
var bodyOrion = body
// Add the field hash to the metadata that will be send to Orion
var hash = make(map[string]interface{})
... |
Match matches input kv with kv, value will be wildcard matched depending on the user input | func (kv BatchKeyRotateKV) Match(ikv BatchKeyRotateKV) bool {
if kv.Empty() {
return true
}
if strings.EqualFold(kv.Key, ikv.Key) {
return wildcard.Match(kv.Value, ikv.Value)
}
return false
} |
LoadFromOnline is the option to download the emoji data from online instead of the local offline data | func LoadFromOnline(value bool) Option {
return loadFromOnline(value)
} |
SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type. | func (m *OrgUnitMutation) SetField(name string, value ent.Value) error {
switch name {
case orgunit.FieldCreateByUser:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreateByUser(v)
return nil
case orgunit.FieldUpdateByUser:
v, ok := value.(int)
... |
UpdateByCleared reports if the "update_by" edge to the User entity was cleared. | func (m *OrgUnitPositionMutation) UpdateByCleared() bool {
return m.UpdateByUserCleared() || m.clearedupdate_by
} |
Execute the command or return a humanfriendly error. | func (c *Authorize) Execute(
ctx context.Context,
) error {
err := cli.CheckEnvWarp(ctx)
if err != nil {
return errors.Trace(err)
}
result, err := cli.RunLocalCommand(ctx, warp.Command{
Type: warp.CmdTpState,
Args: []string{},
})
if err != nil {
return errors.Trace(err)
}
if result.Disconnected {
r... |
Fields returns all fields that were changed during this mutation. Note that, in order to get all numeric fields that were in/decremented, call AddedFields(). | func (m *DiagnosisMutation) Fields() []string {
fields := make([]string, 0, 3)
if m._DiagnosticMessages != nil {
fields = append(fields, diagnosis.FieldDiagnosticMessages)
}
if m._SurveillancePeriod != nil {
fields = append(fields, diagnosis.FieldSurveillancePeriod)
}
if m._DiagnosisDate != nil {
fields = a... |
Deprecated: Use EncodeRequest.ProtoReflect.Descriptor instead. | func (*EncodeRequest) Descriptor() ([]byte, []int) {
return file_raptorq_proto_rawDescGZIP(), []int{2}
} |
NewJobs create javascript jobs. | func NewJobs(r *GoRuntime, script string, parentName string, name string) ([]*JobJs, error) {
var (
filename string
fileModTime time.Time
prev = fmt.Sprintf("init %q jobs, ", parentName)
)
if r == nil {
return nil, errors.New(prev + "js runtime object is not initialized")
}
if script == "" {
re... |
wrapping slice: []float64 export Slice_float64_CTor | func Slice_float64_CTor() CGoHandle {
return CGoHandle(handleFromPtr_Slice_float64(&[]float64{}))
} |
Registers a function capable of creating a new Module instance. | func RegisterModule(name string, f func() Module) {
mods[name] = f
} |
WithConfigFile set xuperclient config file. | func WithConfigFile(configFile string) ClientOption {
return func(opts *clientOptions) error {
opts.configFile = configFile
return nil
}
} |
MinLength defines the minimum value alotted to given field | func (v *Validator) MinLength(field string, d int) {
value := v.model[field]
if value == "" {
return
}
if utf8.RuneCountInString(value) < d {
v.errors["errors"] = append(v.errors["errors"], ErrFieldTooShort(d))
}
} |
let a b c d = foo(1) foo(0) | func TestAssigningVariableToInvokedBlockWithMultipleValuesAcrossMultipleInvocations(t *testing.T) {
ast := []Node{
Node{
Token: "ASSIGNMENT",
Row: 3,
Col: 1,
Data: map[string]interface{}{
"Names": "a b c d",
"Values": []Node{},
},
},
Node{
Token: "INVOCA... |
Test that status transitions from Inactive to Active, once the start time is reached | func TestActivation(t *testing.T) {
mockclock := clock.NewMock()
setClock(mockclock) // replace clock with mock for speedy testing
now := mockclock.Now()
reset()
p, _ := New("Promo1", now.Add(1*time.Hour), now.Add(24*time.Hour))
runtime.Gosched()
if res := p.AllowDisplay(ip); res != false {
t.Errorf("Bad Pr... |
Perform a node check | func checkNode(c *cli.Context) error {
monitoringData := nagiosPlugin.NewMonitoring()
// Check global parameters
err := manageGlobalParameters()
if err != nil {
return cli.NewExitError(fmt.Sprintf("%v", err), nagiosPlugin.STATUS_UNKNOWN)
}
// Check current parameters
if c.String("cluster-name") == "" {
re... |
GetHostPorts returns the HostPorts field value if set, zero value otherwise (both if not set or set to explicit null). | func (o *EquipmentIoCardBase) GetHostPorts() []EtherHostPortRelationship {
if o == nil {
var ret []EtherHostPortRelationship
return ret
}
return o.HostPorts
} |
Returns true if the value exists in the BTree. | func (tree *BTree) Contains(val interface{}) bool {
return tree.contains(wrap(val))
} |
DefaultCluster initializes a client given a Config. | func DefaultCluster(cfg *Config) (Client, error) {
ctx := context.Background()
client := &defaultCluster{
ctx: ctx,
config: cfg,
}
if client.config.Port == "" {
client.config.Port = fmt.Sprintf("%d", DefaultPort)
}
err := client.setupAPIAddr()
if err != nil {
return nil, err
}
err = client.resolv... |
ScanX is like Scan, but panics if an error occurs. | func (das *DrugAllergySelect) ScanX(ctx context.Context, v interface{}) {
if err := das.Scan(ctx, v); err != nil {
panic(err)
}
} |
Put a value for key, if key is unknown, add a new. | func (m *OMap) Put(k string, v interface{}) bool {
if !m.HasKey(k) {
m.add(k, v)
return false
}
// move k to last of m.keys
n := indexOf(k, m.keys)
m.keys = append(append(m.keys[:n], m.keys[n+1:]...), k)
// set v for k in m.baseMap
m.baseMap[k] = v
return true
} |
Optional: FC volume world wide identifiers (wwids) Either wwids or combination of targetWWNs and lun must be set, but not both simultaneously. | func (o FioSpecVolumeVolumeSourceFcOutput) Wwids() pulumi.StringArrayOutput {
return o.ApplyT(func(v FioSpecVolumeVolumeSourceFc) []string { return v.Wwids }).(pulumi.StringArrayOutput)
} |
GetOwnershipType returns the OwnershipType field value | func (o *KanbanViewView) GetOwnershipType() string {
if o == nil {
var ret string
return ret
}
return o.OwnershipType
} |
Enqueue enqueues and never blocks | func (w *watchQueue) Enqueue(key string, kvp *kvdb.KVPair, err error) {
w.m.Lock()
w.updates = append(w.updates, &watchUpdate{key: key, kvp: kvp, err: err})
w.cv.Signal()
w.m.Unlock()
} |
SetPlmnIdFilter resets the service's PLMN ID filter from given PLMN ID list | func (s *EapAkaSrv) SetPlmnIdFilter(plmnIds []string) {
s.plmnFilter = plmn_filter.GetPlmnVals(plmnIds, "EAP-AKA")
} |
New returns a new PagerDuty notifier. | func New(c *config.PagerdutyConfig, t *template.Template, l log.Logger, httpOpts ...commoncfg.HTTPClientOption) (*Notifier, error) {
client, err := commoncfg.NewClientFromConfig(*c.HTTPConfig, "pagerduty", httpOpts...)
if err != nil {
return nil, err
}
n := &Notifier{conf: c, tmpl: t, logger: l, client: client}
... |
Bool decodes any JSON field into a bool | func Bool() Decoder {
return newDecoder(func(b []byte) (interface{}, error) {
var bl bool
if err := json.Unmarshal(b, &bl); err != nil {
return "", err
}
return bl, nil
})
} |
RecoverPanics wraps http.Handler to recover and log panics. | func RecoverPanics(handler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
defer func() {
if x := recover(); x != nil {
w.WriteHeader(http.StatusInternalServerError)
fmt.Fprint(w, "apis panic. Look in log for details.")
glog.Infof("APIServer panic'... |
compareResult compares the result value with the defined expectation. | func (ev *evalCmd) compareResult(j []byte) error {
var response prometheus.Response
err := json.Unmarshal(j, &response)
if err != nil {
return err
}
if response.Status != "success" {
return fmt.Errorf("unsuccess status received: %s", response.Status)
}
result := response.Data.Result
switch result := resu... |
MakeNAT creates a port mapper from set cmd line flags. | func MakeNAT(ctx *cli.Context) nat.Interface {
natif, err := nat.Parse(ctx.GlobalString(NATFlag.Name))
if err != nil {
Fatalf("Option %s: %v", NATFlag.Name, err)
}
return natif
} |
UnmarshalXML implements the xml.Unmarshaller interface for type ContainerProperties. | func (c *ContainerProperties) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error {
type alias ContainerProperties
aux := &struct {
*alias
DeletedTime *timeRFC1123 `xml:"DeletedTime"`
LastModified *timeRFC1123 `xml:"Last-Modified"`
}{
alias: (*alias)(c),
}
if err := dec.DecodeElement(aux, &start)... |
CheckHealth handles health checks sent from Grafana to the plugin. The main use case for these health checks is the test button on the datasource configuration page which allows users to verify that a datasource is working as expected. | func (v *VerticaDatasource) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error) {
log.DefaultLogger.Debug("Inside datasource.CheckHealth Function", "request", req)
var status = backend.HealthStatusOk
connDB, err := v.GetVerticaDb(req.PluginContext)
if err != nil ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.