text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (m *BaseMethod) GetCookies() []KVPair {
return m.Cookies
} | [
-0.8903307318687439,
0.26695090532302856,
0.4802747964859009,
1.2676323652267456,
-0.08022495359182358,
-0.6111933588981628,
0.45326098799705505,
-0.5867880582809448,
-0.22833053767681122,
-0.16373379528522491,
0.6615448594093323,
0.2318219095468521,
-1.1832189559936523,
1.1536673307418823... |
func (m *BaseMethod) GetQueryParams() map[string]string {
return m.QueryParams
} | [
-0.6965602040290833,
-0.3429194986820221,
0.34709957242012024,
0.24116745591163635,
0.03129962086677551,
0.27772897481918335,
0.16485418379306793,
-0.017576929181814194,
-0.4679744839668274,
-0.25326886773109436,
-0.46777841448783875,
0.11814174801111221,
-0.7418738603591919,
0.52034670114... |
func (m *BaseMethod) GetBody() (io.Reader, error) {
if m.Method == http.MethodGet && m.Body != nil {
return nil, NotEmptyBodyError
}
if m.Body == nil {
return nil, nil
}
return bytes.NewBuffer(m.Body), nil
} | [
-0.016636010259389877,
0.03492244333028793,
0.7239041924476624,
0.5097042322158813,
0.8447672724723816,
-0.3538326025009155,
-0.333957314491272,
-1.3448870182037354,
0.8026696443557739,
-0.356182724237442,
1.0202162265777588,
0.6662132143974304,
-0.7733064293861389,
1.0924044847488403,
0... |
func (m *BaseMethod) GetAcceptStatusCodes() []StatusCode {
return m.AcceptStatusCodes
} | [
0.09872075915336609,
0.01394563913345337,
0.5463355779647827,
0.7157608270645142,
-1.7689523696899414,
0.867943525314331,
0.06938594579696655,
0.15172258019447327,
-0.24891531467437744,
-0.027808530256152153,
-0.25003352761268616,
0.07204368710517883,
-0.529370903968811,
1.478061318397522,... |
func (m *BaseMethod) ResponseProcess(body io.ReadCloser, h http.Header, s StatusCode, retries uint) (*Response, error) {
b, err := ioutil.ReadAll(body)
if err != nil {
logrus.WithError(err).Error(ReadBodyError)
return nil, ReadBodyError
}
err = body.Close()
if err != nil {
logrus.WithError(err).Error(CloseBo... | [
1.059278964996338,
-0.8893537521362305,
0.5952516198158264,
0.25184574723243713,
-0.21441738307476044,
-0.15251439809799194,
-0.08526638150215149,
-0.4203914701938629,
1.0376532077789307,
0.1627465784549713,
-0.014468537643551826,
0.09137769043445587,
-0.7801246047019958,
-0.30480375885963... |
func Created(file io.ReadSeeker) (time.Time, error) {
c, _, err := times(file)
return c, err
} | [
0.1777602583169937,
-0.10847552120685577,
0.3207394480705261,
-0.13131359219551086,
0.296017587184906,
-0.04670742526650429,
0.5058827996253967,
-0.34395405650138855,
-1.0975537300109863,
-0.09383151680231094,
-0.2609645426273346,
-0.6127683520317078,
1.0683735609054565,
1.545913577079773,... |
func Modified(file io.ReadSeeker) (time.Time, error) {
_, m, err := times(file)
return m, err
} | [
-1.0808607339859009,
-0.25562208890914917,
0.4484444260597229,
-0.13513049483299255,
-0.489152193069458,
-0.24807433784008026,
0.14924028515815735,
-0.15180383622646332,
-0.21676257252693176,
0.3299311101436615,
-0.4110643267631531,
-0.6081927418708801,
0.1969924122095108,
1.38117837905883... |
func times(file io.ReadSeeker) (time.Time, time.Time, error) {
var c, m time.Time
var i int64
var err error
buf := [8]byte{}
for {
_, err := file.Read(buf[:])
if err != nil {
return c, m, err
}
if bytes.Equal(buf[4:8], []byte("moov")) {
break
} else {
atomSize := binary.BigEndian.Uint32(buf[:])... | [
-0.3423335552215576,
-0.18032924830913544,
1.0159363746643066,
-0.6547262072563171,
-0.6849796175956726,
-0.3415496051311493,
-0.4823014438152313,
-0.3263813555240631,
-0.8274099826812744,
0.7868255376815796,
-0.05454913154244423,
-0.14891190826892853,
-0.19527612626552582,
0.8890998363494... |
func (j *LoadTracker) getPrevElectionMessage(msg *MP.Message) (*DHT.BroadcastMessage, *MP.Message, *LoadBroadcastMessage) {
var payloadMsg MP.Message
var uTBMsg LoadBroadcastMessage
bMsg := j.dht.GetBroadcastMessage(msg)
MP.DecodeData(&payloadMsg, bMsg.Payload)
MP.DecodeData(&uTBMsg, payloadMsg.Data)
return bMsg... | [
-0.5549556016921997,
0.7985101342201233,
1.0286990404129028,
-0.5051432251930237,
-0.5895682573318481,
-0.41429784893989563,
0.2931726276874542,
-1.1213383674621582,
0.11975470930337906,
0.21886233985424042,
0.2462044060230255,
0.36531272530555725,
-1.3778719902038574,
1.2786487340927124,
... |
func transferUtbmToResult(msg *MP.Message) *LoadBroadcastMessage {
var uTBMsg LoadBroadcastMessage
MP.DecodeData(&uTBMsg, msg.Data)
return &uTBMsg
} | [
-0.4845274090766907,
0.8404616713523865,
0.45496881008148193,
-0.8031776547431946,
-0.26342809200286865,
-0.03261847794055939,
-0.13950009644031525,
-0.7119615077972412,
0.5039045214653015,
0.09528036415576935,
0.42480331659317017,
1.0171382427215576,
-2.144606113433838,
-0.279977470636367... |
func Create(id string) *Operator {
o := Operator{}
if id == "" {
uuid, _ := uuid.NewRandom()
o.Uid = uuid.String()
} else {
o.Uid = id
}
return &o
} | [
-0.7956826090812683,
0.16069035232067108,
0.3571431338787079,
-0.06875387579202652,
-0.9885724782943726,
0.4050526022911072,
-0.5065488815307617,
0.03198257461190224,
0.45130589604377747,
0.34256333112716675,
-0.18414561450481415,
-1.0319340229034424,
-1.011113166809082,
-0.039710164070129... |
func (o *Operator) GetFullName() string {
if o != nil {
return fmt.Sprintf("%s %s", o.GetFirstName(), o.GetLastName())
}
return ""
} | [
0.39036059379577637,
-0.14618702232837677,
0.9323776960372925,
0.3807995617389679,
-1.115383267402649,
-0.3702528476715088,
-0.5792862772941589,
0.4115765690803528,
0.33334115147590637,
-0.08563391119241714,
-0.5445324182510376,
-0.8585308790206909,
0.5394128561019897,
0.40408578515052795,... |
func (o *Operator) UnmarshalJSON(data []byte) error {
u := jsonpb.Unmarshaler{}
buf := bytes.NewBuffer(data)
return u.Unmarshal(buf, &*o)
} | [
-0.8917438983917236,
0.45310255885124207,
0.6137514114379883,
-0.8648052215576172,
-1.5123931169509888,
0.4155559539794922,
0.2204895168542862,
0.7674770355224609,
0.20219209790229797,
-0.056448597460985184,
-0.7253016233444214,
-0.8260564208030701,
-0.9107024669647217,
0.1174549087882042,... |
func (o Operator) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
m := jsonpb.Marshaler{}
if err := m.Marshal(&buf, &o); err != nil {
return nil, err
}
return buf.Bytes(), nil
} | [
-0.01705373078584671,
0.08943268656730652,
0.5563008189201355,
0.11998225003480911,
-1.4315153360366821,
0.09735600650310516,
0.15936246514320374,
0.3684338629245758,
0.517677903175354,
0.0806710422039032,
-1.0554808378219604,
-0.05997319892048836,
-0.731235682964325,
0.35033708810806274,
... |
func (o Operator) Key() string {
return fmt.Sprintf("operator.%s", o.Aid)
} | [
-0.27754905819892883,
0.17373967170715332,
0.5891844034194946,
-0.5249706506729126,
-0.4681261479854584,
1.2685282230377197,
0.026760928332805634,
-0.12712502479553223,
-0.07232232391834259,
0.8381292223930359,
0.21659186482429504,
-0.5483805537223816,
-0.16702881455421448,
-0.508946835994... |
func NewUnsignerFromPublicKeyFile(pubkeyPath string) (Unsigner, error) {
data, err := ioutil.ReadFile(pubkeyPath); if err != nil {
return nil, fmt.Errorf("[ERR] cannot open public key file from %s : %v", pubkeyPath, err)
}
rawkey, err := parsePublicKey(data); if err != nil {
return nil, fmt.... | [
0.22588935494422913,
-0.4500381052494049,
0.227756068110466,
-0.5518257021903992,
-1.2659839391708374,
0.08285773545503616,
-0.0910208448767662,
1.1768437623977661,
-0.9474967122077942,
0.5919598937034607,
-0.5243649482727051,
-0.7167887091636658,
-0.5906092524528503,
0.5223560333251953,
... |
func (m *BottleDB) ListBottleByYears(ctx context.Context, accountID int, years []int) (bottles []*app.Bottle, err error) {
defer goa.MeasureSince([]string{"goa", "db", "bottle", "listbottlebyyears"}, time.Now())
var native []*Bottle
var objs []*app.Bottle
err = m.Db.Scopes(BottleFilterByAccount(accountID, m.Db)).T... | [
-1.066724419593811,
-0.1569076031446457,
0.28840014338493347,
-0.3776543438434601,
-0.011721419170498848,
0.2923310101032257,
0.1693761944770813,
-0.4275844395160675,
0.27591273188591003,
0.3061586022377014,
-0.6676548719406128,
0.9607720971107483,
-0.13707926869392395,
0.5166759490966797,... |
func GetDefaultClient() *Client {
if client == nil {
panic("Tried to get nonexistent client, must be initialized first.")
}
return client
} | [
0.4811163544654846,
0.27319952845573425,
0.18103723227977753,
1.0607531070709229,
0.49838510155677795,
0.3987610638141632,
0.25021305680274963,
-0.5121455788612366,
0.0767102837562561,
-1.0797367095947266,
-0.18327467143535614,
0.8746601939201355,
-0.6813532114028931,
-0.132511168718338,
... |
func NewClient(cacher Cacher) *Client {
var newClient Client
newClient.BaseURL = DefaultBaseURL
newClient.Retries = 5
newClient.cacher = cacher
newClient.maxIdleConns = 2
// Also sets up our initial http client
newClient.SetTimeout(60 * time.Second)
if client == nil {
client = &newClient
}
return &newCli... | [
0.23308654129505157,
-0.6415623426437378,
0.07900597900152206,
0.9608446359634399,
-0.7963672280311584,
-0.05713936686515808,
-0.21204376220703125,
-0.16615772247314453,
0.5952391624450684,
-0.533966064453125,
-0.3809363543987274,
0.3922311067581177,
-0.5507266521453857,
0.3834405243396759... |
func (c *Client) SetTimeout(timeout time.Duration) {
if timeout.Seconds() <= 0 || timeout.Seconds() > 3600 {
timeout = 60 * time.Second
}
c.timeout = timeout
c.newHttpClient()
} | [
0.1559501439332962,
-0.026700103655457497,
0.41997048258781433,
0.12616442143917084,
-0.14625856280326843,
1.174586534500122,
-0.6440604329109192,
-0.009112567640841007,
-0.18998339772224426,
0.22936156392097473,
-0.485585480928421,
0.883120596408844,
-0.4052130877971649,
0.457605898380279... |
func SetMaxIdleConns(maxIdleConns int) {
client.SetMaxIdleConns(maxIdleConns)
} | [
-0.7598392367362976,
-0.6530313491821289,
0.6374985575675964,
0.2705882787704468,
0.1017557829618454,
0.37536123394966125,
-0.14292316138744354,
0.26027148962020874,
1.4686187505722046,
-0.4591594338417053,
-1.6928236484527588,
-0.012694861739873886,
-0.36088764667510986,
-0.63347810506820... |
func SetTimeout(timeout time.Duration) {
client.SetTimeout(timeout)
} | [
0.7259783744812012,
0.5292304754257202,
0.00984950177371502,
0.10213225334882736,
-0.1263236403465271,
1.1476020812988281,
-0.30085813999176025,
0.394315242767334,
0.17202287912368774,
0.6881288290023804,
-0.5720651745796204,
0.8717890381813049,
-0.021791726350784302,
0.46853917837142944,
... |
func (c *Client) NewRequest(url string) *Request {
var r Request
r.params = make(map[string]string)
if url[0] == '/' {
url = url[1:]
}
r.url = url
r.client = c
return &r
} | [
-0.5480890870094299,
0.035262346267700195,
0.16565655171871185,
0.48461881279945374,
-0.23568132519721985,
0.046152543276548386,
-0.1817276030778885,
-0.2120102047920227,
0.23012910783290863,
-0.2758328914642334,
0.30860307812690735,
0.6598411798477173,
0.17717017233371735,
0.0201376639306... |
func NewRequest(url string) *Request {
return client.NewRequest(url)
} | [
-0.5242493152618408,
0.048204489052295685,
-0.07287083566188812,
0.4508538246154785,
-0.5141767859458923,
-0.5188417434692383,
-0.5105665922164917,
0.12235581874847412,
0.2301447093486786,
-0.4158552587032318,
-0.08299396187067032,
0.6287519335746765,
0.23675581812858582,
-0.46793282032012... |
func (c *Client) Do(r *Request) (retresp *Response, reterr error) {
var data []byte
var expires time.Time
cacheTag := r.cacheTag()
// Check for cached version
resp, err := c.GetCached(r)
if err == nil {
return resp, nil
}
// If we're panicking, bail out early and spit back a fake error
c.RLock()
if c.pan... | [
-0.8024476766586304,
0.3119146227836609,
0.7595945596694946,
-0.37106001377105713,
-0.19419190287590027,
-0.06742023676633835,
-0.3300600051879883,
-0.4729726016521454,
0.45922231674194336,
0.3524441421031952,
-0.23038358986377716,
0.2546985447406769,
-0.08750373125076294,
0.18347379565238... |
func WithAuthorityPolicyLevel(ctx context.Context) context.Context {
return context.WithValue(ctx, policyLevelContextKey{}, authorityPolicyLevel)
} | [
0.9763945937156677,
-0.5773428082466125,
0.30252280831336975,
-0.48909369111061096,
-0.25231868028640747,
1.0970796346664429,
-0.41557106375694275,
-0.7382411360740662,
1.08109450340271,
0.6102936863899231,
-0.09350741654634476,
0.08213157951831818,
0.46025505661964417,
0.1532173752784729,... |
func IsAuthorityPolicyLevel(ctx context.Context) bool {
return isPolicyLevel(ctx, authorityPolicyLevel)
} | [
0.37325018644332886,
-1.130653977394104,
0.3041709363460541,
0.3758769631385803,
-0.3366467356681824,
1.0634552240371704,
-0.5533322691917419,
-0.2564595341682434,
1.3270424604415894,
0.5975358486175537,
0.3347976803779602,
0.6925482749938965,
-0.3421531617641449,
0.3938903510570526,
-0.... |
func WithProvisionerPolicyLevel(ctx context.Context) context.Context {
return context.WithValue(ctx, policyLevelContextKey{}, provisionerPolicyLevel)
} | [
0.1355353444814682,
-0.31857436895370483,
0.2753201723098755,
0.264156699180603,
-0.7768666744232178,
1.2022167444229126,
-0.44556885957717896,
-0.6273685693740845,
0.7257255911827087,
0.561710000038147,
-0.0522758811712265,
-0.6957472562789917,
0.10537241399288177,
-0.04702833294868469,
... |
func IsProvisionerPolicyLevel(ctx context.Context) bool {
return isPolicyLevel(ctx, provisionerPolicyLevel)
} | [
-0.040217336267232895,
-0.3841336667537689,
0.3433047831058502,
1.0433285236358643,
-0.734552800655365,
1.1067020893096924,
-0.6141963601112366,
-0.40245479345321655,
0.7984859943389893,
0.9527033567428589,
-0.09238160401582718,
-0.8092615008354187,
-0.6275328397750854,
0.1958664357662201,... |
func WithACMEPolicyLevel(ctx context.Context) context.Context {
return context.WithValue(ctx, policyLevelContextKey{}, acmePolicyLevel)
} | [
1.2476519346237183,
-0.15588508546352386,
0.2314046025276184,
-0.3770092725753784,
-0.7458252310752869,
0.7382052540779114,
-0.37620460987091064,
-0.8864888548851013,
0.4814373552799225,
0.7108108401298523,
0.2917082905769348,
0.09622950851917267,
-0.01385157648473978,
-0.4938633143901825,... |
func IsACMEPolicyLevel(ctx context.Context) bool {
return isPolicyLevel(ctx, acmePolicyLevel)
} | [
0.6609533429145813,
-0.23577001690864563,
0.2490583062171936,
-0.4658906161785126,
-0.9794773459434509,
0.7787014842033386,
-0.7899805903434753,
-0.47390303015708923,
1.3244045972824097,
0.9477081298828125,
0.11916104704141617,
0.3787309229373932,
-0.9300613403320312,
-0.011789494194090366... |
func isPolicyLevel(ctx context.Context, level policyLevel) bool {
v, _ := ctx.Value(policyLevelContextKey{}).(policyLevel)
return v == level
} | [
-0.2592020332813263,
-0.31291723251342773,
0.058621253818273544,
0.08872446417808533,
-0.2938261330127716,
0.5754411816596985,
-1.1524070501327515,
-0.9252336025238037,
1.6746997833251953,
0.6333857178688049,
-0.6579893827438354,
0.6060936450958252,
-0.5521445274353027,
-0.0533428452908992... |
func WithX509Policy(ctx context.Context) context.Context {
return context.WithValue(ctx, policyConfigurationTypeContextKey{}, x509PolicyType)
} | [
0.9756130576133728,
0.5042670965194702,
0.25311174988746643,
-0.5925918221473694,
-0.06130793318152428,
0.6397807002067566,
0.25852760672569275,
-1.1370283365249634,
1.313382625579834,
0.6786563396453857,
0.3324580490589142,
-0.06716819852590561,
0.22690564393997192,
0.3325395882129669,
... |
func IsX509Policy(ctx context.Context) bool {
v, _ := ctx.Value(policyConfigurationTypeContextKey{}).(policyConfigurationType)
return v == x509PolicyType
} | [
0.6174523830413818,
0.3974829316139221,
0.02056441269814968,
0.13854530453681946,
0.18580076098442078,
0.2784585654735565,
-0.10526575148105621,
-1.0205413103103638,
1.466291904449463,
1.0193294286727905,
0.03166310489177704,
0.46416330337524414,
-0.4074413478374481,
0.7222402095794678,
... |
func WithSSHHostPolicy(ctx context.Context) context.Context {
return context.WithValue(ctx, policyConfigurationTypeContextKey{}, sshHostPolicyType)
} | [
0.2500450611114502,
-0.2289966642856598,
0.5494053959846497,
0.29140758514404297,
0.42719948291778564,
1.5638118982315063,
-0.018112581223249435,
-0.0849819928407669,
0.5374176502227783,
0.29844093322753906,
-0.39956986904144287,
0.2549060583114624,
0.36004623770713806,
0.8488534688949585,... |
func IsSSHHostPolicy(ctx context.Context) bool {
v, _ := ctx.Value(policyConfigurationTypeContextKey{}).(policyConfigurationType)
return v == sshHostPolicyType
} | [
-0.10376040637493134,
0.010933036915957928,
0.3837687075138092,
0.42902788519859314,
0.5487009882926941,
1.5728524923324585,
-0.25985243916511536,
0.024635281413793564,
0.8202497959136963,
0.6956520080566406,
-0.21328629553318024,
0.7698826789855957,
-0.4403162896633148,
0.5678184032440186... |
func WithSSHUserPolicy(ctx context.Context) context.Context {
return context.WithValue(ctx, policyConfigurationTypeContextKey{}, sshUserPolicyType)
} | [
0.7353423237800598,
0.09069974720478058,
0.4529482424259186,
0.49916377663612366,
-0.42129069566726685,
0.9540448188781738,
0.40223294496536255,
0.25687673687934875,
1.0913102626800537,
0.3660973608493805,
-0.686418890953064,
0.5072605609893799,
0.624419093132019,
0.691826343536377,
0.10... |
func IsSSHUserPolicy(ctx context.Context) bool {
v, _ := ctx.Value(policyConfigurationTypeContextKey{}).(policyConfigurationType)
return v == sshUserPolicyType
} | [
-0.2700992822647095,
0.3766564726829529,
0.19532395899295807,
0.8657953143119812,
-0.11535025388002396,
0.9970694184303284,
0.2975246012210846,
0.18567094206809998,
1.2662765979766846,
0.6477154493331909,
-0.4509427845478058,
1.0969983339309692,
0.3002575933933258,
0.762963056564331,
-0.... |
func WithAllow(ctx context.Context) context.Context {
return context.WithValue(ctx, policyTypeContextKey{}, allowType)
} | [
0.6093255281448364,
0.4051765203475952,
0.6056777834892273,
-0.27714842557907104,
-0.8431209921836853,
1.3644952774047852,
-0.5320568084716797,
-1.045109748840332,
0.8524750471115112,
0.6140623688697815,
0.9852171540260315,
0.27660298347473145,
0.4456784129142761,
-0.12931859493255615,
-... |
func IsAllow(ctx context.Context) bool {
v, _ := ctx.Value(policyTypeContextKey{}).(policyType)
return v == allowType
} | [
-0.08599067479372025,
0.0016740481369197369,
0.29254886507987976,
0.3505437970161438,
-0.20427311956882477,
1.4199340343475342,
-0.4455617666244507,
-0.7551648616790771,
1.3194574117660522,
0.9077611565589905,
1.0753047466278076,
1.0925594568252563,
-0.36621731519699097,
0.2112485319375991... |
func WithDeny(ctx context.Context) context.Context {
return context.WithValue(ctx, policyTypeContextKey{}, denyType)
} | [
0.6014970541000366,
-0.24524079263210297,
0.5693703889846802,
-0.17210084199905396,
0.1524205058813095,
0.5149906873703003,
-0.2605423331260681,
-1.7813975811004639,
1.028354287147522,
0.12418785691261292,
0.5249806642532349,
-0.03567426651716232,
0.1306280642747879,
0.15744030475616455,
... |
func IsDeny(ctx context.Context) bool {
v, _ := ctx.Value(policyTypeContextKey{}).(policyType)
return v == denyType
} | [
-0.019492216408252716,
0.10172423720359802,
0.4201870858669281,
0.6254242658615112,
0.8569770455360413,
0.7447443008422852,
-0.43135833740234375,
-1.488972544670105,
1.3572518825531006,
0.30768492817878723,
0.3301704227924347,
0.7174378633499146,
-0.7380943298339844,
0.4899897277355194,
... |
func Validate(params Params) (err error) {
if params.Length <= 0 {
return errors.New("Length must be more than 0")
}
if params.Square <= 0 {
return errors.New("Square must be more than 0")
}
return nil
} | [
-0.21572092175483704,
0.1984940469264984,
0.7035716772079468,
0.36948448419570923,
0.206540048122406,
0.6527893543243408,
0.08924654871225357,
-0.48280206322669983,
-0.1743679940700531,
0.260200172662735,
0.5194805860519409,
0.006188392639160156,
-0.4227810502052307,
1.325721025466919,
-... |
func RegisterExt(id int8, value interface{}) {
typ := reflect.TypeOf(value)
if typ.Kind() == reflect.Ptr {
typ = typ.Elem()
}
ptr := reflect.PtrTo(typ)
if _, ok := extTypes[id]; ok {
panic(fmt.Errorf("msgpack: ext with id=%d is already registered", id))
}
registerExt(id, ptr, getEncoder(ptr), getDecoder(pt... | [
-0.6464464664459229,
0.9260015487670898,
0.5845768451690674,
-0.2680495083332062,
0.09366557747125626,
-0.47110289335250854,
-0.910030722618103,
-1.4464290142059326,
0.8499212861061096,
0.4580165445804596,
-1.3878189325332642,
0.770045816898346,
-0.47828957438468933,
1.1617788076400757,
... |
func initMuxDownload(serverPublicKey string, MainDownloadsLoc string, _fileName string) {
//create object to track file stats and add object to queue
newIndex := len(downloadQueue)
boolVar := true
newDownloadItem := downloadItem{
fileName: _fileName,
fileSize: navPtr.files[_fileName],
down... | [
-0.0028332839719951153,
-0.21997778117656708,
0.7095174193382263,
-0.07573975622653961,
-0.8005808591842651,
0.3385845422744751,
-0.8167073130607605,
0.530292809009552,
-0.5907807350158691,
-0.2938016951084137,
-0.7389072179794312,
0.5763099789619446,
0.13166099786758423,
0.785920858383178... |
func (*booleanScalar) CoerceIn(v interface{}) (interface{}, error) {
if v == nil {
return nil, nil
}
if b, ok := v.(bool); ok {
return b, nil
}
return nil, newCoerceErr(v, "Boolean")
} | [
-0.6301156878471375,
-0.09329620003700256,
0.7652749419212341,
0.32935941219329834,
-0.3418198227882385,
0.21358707547187805,
-0.25338491797447205,
-0.1814746856689453,
-0.0206080861389637,
0.3881910443305969,
-0.21364429593086243,
1.0448672771453857,
-0.23796463012695312,
0.56368499994277... |
func (t *booleanScalar) CoerceOut(v interface{}) (interface{}, error) {
var err error
switch tv := v.(type) {
case nil:
// remains nil
case bool:
// ok as is
case float32:
v = tv != 0.0
case int32:
v = tv != 0
case string:
var b bool
if b, err = strconv.ParseBool(tv); err == nil {
v = b
}
defau... | [
0.22341960668563843,
-0.1190805733203888,
0.6507313251495361,
-0.1144736111164093,
-0.06558814644813538,
-0.3309643268585205,
-0.37434160709381104,
-0.3344859182834625,
0.12727119028568268,
0.6007763743400574,
0.367213636636734,
1.0416085720062256,
0.15811783075332642,
0.8046020269393921,
... |
func albumsByArtist(name string, db *sql.DB) ([]Album, error) {
// An albums slice to hold data from returned rows.
var albums []Album
rows, err := db.Query("SELECT id,title,artist,price FROM album WHERE artist = ?", name)
if err != nil {
return nil, fmt.Errorf("albumsByArtist %q: %v", name, err)
}
defer rows.... | [
-0.41866499185562134,
-0.5043980479240417,
0.4510669410228729,
0.30524617433547974,
-1.1128636598587036,
-0.2448926866054535,
0.11997589468955994,
-0.88130784034729,
-0.173465758562088,
0.7739715576171875,
-1.0102139711380005,
-0.5028273463249207,
0.317780077457428,
0.009872758761048317,
... |
func albumByID(id int64, db *sql.DB) (Album, error) {
// An album to hold data from the returned row.
var alb Album
row := db.QueryRow("SELECT id,title,artist,price FROM album WHERE id = ?", id)
if err := row.Scan(&alb.ID, &alb.Title, &alb.Artist, &alb.Price); err != nil {
if err == sql.ErrNoRows {
return alb... | [
0.12197047472000122,
-0.5504241585731506,
0.08359323441982269,
0.4051648676395416,
-0.6042935848236084,
-0.1189509704709053,
0.034487977623939514,
-1.0906944274902344,
0.060792259871959686,
0.6034210324287415,
-0.8261120319366455,
-0.061707135289907455,
0.12769366800785065,
0.1638012081384... |
func TestNewSession_AssumeRole(t *testing.T) {
origNewSession := newSession
origNewSTSCredentials := newSTSCredentials
origNewEC2Metadata := newEC2Metadata
t.Cleanup(func() {
newSession = origNewSession
newSTSCredentials = origNewSTSCredentials
newEC2Metadata = origNewEC2Metadata
})
newSession = func(cfgs .... | [
0.16524671018123627,
-0.10929405689239502,
0.6744431257247925,
-0.5219894647598267,
0.29832836985588074,
0.15886585414409637,
0.017352359369397163,
-0.4141724109649658,
1.1100656986236572,
0.7274607419967651,
-0.8444497585296631,
0.5610460042953491,
0.5981480479240417,
0.2522539496421814,
... |
func GetVanityItem(c *gin.Context) {
vanityItemList, err := (&model.VanityItem{}).Get("")
if err != nil {
log.Printf("db fetching vanityItmeList error: %v", err)
c.JSON(http.StatusInternalServerError, &model.ErrResp{Error: "Server error"})
return
}
c.JSON(http.StatusOK, vanityItemList)
} | [
-0.8650102615356445,
-0.09975402057170868,
0.27561262249946594,
0.7402101159095764,
0.6236777901649475,
0.5043656229972839,
-0.3886670768260956,
0.14754241704940796,
-0.48949646949768066,
0.8468477129936218,
-1.006394863128662,
0.5184832215309143,
-0.43346160650253296,
0.5315053462982178,
... |
func RegisterTryServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.Dial(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed ... | [
0.03155435994267464,
-0.3709249794483185,
0.8146604895591736,
0.665723443031311,
-0.27103787660598755,
0.3910205364227295,
-0.5451511144638062,
-0.8869820833206177,
-0.21628230810165405,
0.09047993272542953,
0.2947162091732025,
0.15434938669204712,
-0.5937500596046448,
-0.4016687572002411,... |
func RegisterTryServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterTryServiceHandlerClient(ctx, mux, NewTryServiceClient(conn))
} | [
-0.22506006062030792,
0.3110045790672302,
0.3183979392051697,
0.1772293895483017,
-0.13368849456310272,
0.34283608198165894,
-0.15794771909713745,
-0.24033395946025848,
-0.5180963277816772,
-0.5542120933532715,
-0.33352258801460266,
1.016447901725769,
-0.4147496223449707,
0.308672130107879... |
func RegisterTryServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TryServiceClient) error {
mux.Handle("POST", pattern_TryService_Notify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inbound... | [
-0.12948940694332123,
0.08051399141550064,
0.9126371145248413,
-0.08872633427381516,
-0.19918502867221832,
0.3791203498840332,
0.12477359920740128,
-0.6571487784385681,
-0.8246491551399231,
-0.4744498133659363,
-0.42475786805152893,
0.5012932419776917,
-0.25971436500549316,
0.6048958301544... |
func History(ctx context.Context, channelName string) ([]*types.Message, error) {
channel := getChannel(channelName)
messages := messagesFromHistory(channel.History)
return messages, nil
} | [
0.0536237396299839,
0.44928687810897827,
0.5580245852470398,
-0.41131356358528137,
1.077682375907898,
-0.3499356210231781,
0.4009287655353546,
-1.0255951881408691,
0.1419764906167984,
0.3149890601634979,
-0.30881938338279724,
1.1978092193603516,
-0.15087614953517914,
1.2555303573608398,
... |
func AddMessage(ctx context.Context, channelName string, message string) (bool, error) {
channel := getChannel(channelName)
msg := types.Message{
ID: utils.NewID(),
Text: message,
Timestamp: time.Now(),
}
channel.History.Write(&msg)
received := false
for _, listener := range channel.Listeners ... | [
-0.5903375148773193,
0.565261721611023,
0.9031445980072021,
-0.9816639423370361,
1.1396466493606567,
0.13482776284217834,
-1.0364620685577393,
-0.4026467502117157,
-0.08717101067304611,
-0.40817296504974365,
0.38482779264450073,
-0.0947897657752037,
-1.4858678579330444,
0.7960071563720703,... |
func MessageAdded(ctx context.Context, channelName string) (<-chan *types.Message, error) {
channel := getChannel(channelName)
listener := enterChannel(channel)
go func() {
<-ctx.Done()
leaveChannel(channel, listener)
}()
return listener.Channel, nil
} | [
0.28357329964637756,
-0.0614284910261631,
0.6185515522956848,
-1.1761964559555054,
0.6820278167724609,
0.5567334890365601,
-0.9493156671524048,
-1.3786985874176025,
0.5772464871406555,
-0.42375999689102173,
0.5973961353302002,
0.47190386056900024,
-0.9832587242126465,
0.43891218304634094,
... |
func getChannel(channelName string) *Channel {
mutex.Lock()
defer mutex.Unlock()
if _, ok := channels[channelName]; !ok {
channels[channelName] = &Channel{
Mutex: new(sync.Mutex),
Name: channelName,
History: tailbuf.New(historyLength),
LastUsed: time.Now(),
Listeners: make(map[string]*L... | [
-0.2191160023212433,
0.041876185685396194,
0.4336506426334381,
-0.7772610187530518,
0.628035843372345,
-0.38658812642097473,
0.3116585612297058,
-1.1376721858978271,
0.5960619449615479,
-0.5122467875480652,
0.3755667507648468,
1.4944199323654175,
-0.8144679665565491,
0.015679486095905304,
... |
func enterChannel(channel *Channel) *Listener {
channel.Lock()
defer channel.Unlock()
var id string
for {
id = utils.NewID()
if _, ok := channel.Listeners[id]; !ok {
break
}
}
channel.Listeners[id] = &Listener{
Id: id,
Channel: make(chan *types.Message),
}
return channel.Listeners[id]
} | [
0.17760616540908813,
-0.874332845211029,
0.44217196106910706,
-1.2770028114318848,
0.5130723714828491,
0.051005322486162186,
-0.1097392737865448,
-1.2529107332229614,
0.46336299180984497,
-0.00578831322491169,
0.6969326138496399,
1.0238642692565918,
-1.5136635303497314,
0.5200663805007935,... |
func leaveChannel(channel *Channel, listener *Listener) {
channel.Lock()
defer channel.Unlock()
delete(channel.Listeners, listener.Id)
} | [
0.708306074142456,
-1.120092511177063,
0.3924494683742523,
-1.6923754215240479,
0.5000802874565125,
0.5602566599845886,
-1.2458925247192383,
-0.8572450280189514,
0.31951263546943665,
0.6475505828857422,
0.08338310569524765,
0.5210506319999695,
-1.4737966060638428,
0.3180904686450958,
1.0... |
func messagesFromHistory(history *tailbuf.TailBuf) []*types.Message {
data := history.Read()
result := make([]*types.Message, len(data))
for i, value := range data {
result[i] = value.(*types.Message)
}
return result
} | [
-0.27693694829940796,
-0.40828844904899597,
0.23346389830112457,
-0.46900367736816406,
0.4566148519515991,
-0.3303447663784027,
0.07043956220149994,
-1.16889488697052,
-0.40950900316238403,
-0.14408864080905914,
-0.401048868894577,
0.6734911799430847,
-0.683510422706604,
1.1978434324264526... |
func (p *Predict) GetPrediction(model *config.Model, evaluations []*stored.Evaluation) (int32, error) {
if model.HoltWinters == nil {
return 0, errors.New("No HoltWinters configuration provided for model")
}
// If less than a full season of data, return zero without error
if len(evaluations) < model.HoltWinters.... | [
-1.1829227209091187,
0.4091407060623169,
0.9512109756469727,
-0.05842467397451401,
0.30054986476898193,
-0.025165047496557236,
0.3543927073478699,
-0.33402034640312195,
-0.8577889800071716,
0.47709789872169495,
0.29549330472946167,
1.5504285097122192,
-0.22491545975208282,
0.47448107600212... |
func (p *Predict) GetIDsToRemove(model *config.Model, evaluations []*stored.Evaluation) ([]int, error) {
if model.HoltWinters == nil {
return nil, errors.New("No HoltWinters configuration provided for model")
}
// Sort by date created
sort.Slice(evaluations, func(i, j int) bool {
return evaluations[i].Created.... | [
-1.07072913646698,
0.5558062791824341,
0.6102266907691956,
-0.45708033442497253,
0.34797030687332153,
-0.2262740135192871,
0.8154960870742798,
0.07039503008127213,
-0.4097174406051636,
0.6482442617416382,
-0.19264419376850128,
0.9858303070068359,
-1.0929995775222778,
-0.029897619038820267,... |
func (p *Predict) GetType() string {
return Type
} | [
-0.2623455822467804,
0.5127691030502319,
0.4599093198776245,
0.9121289253234863,
1.0062751770019531,
1.0596001148223877,
0.34383049607276917,
-0.24589328467845917,
-0.2560288608074188,
0.2754296064376831,
0.3063903748989105,
1.0359654426574707,
-0.8726560473442078,
0.33304524421691895,
0... |
func (*SchemaVersion) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*SchemaVersion_ProtobufSettings)(nil),
(*SchemaVersion_AvroSettings)(nil),
(*SchemaVersion_JsonSchemaSettings)(nil),
}
} | [
-1.0988777875900269,
0.10231996327638626,
0.27766311168670654,
0.6202477812767029,
0.3390531837940216,
-0.25341087579727173,
0.08996912091970444,
-0.35407277941703796,
1.453381896018982,
0.5104799270629883,
-1.055190920829773,
0.06584776937961578,
-0.36733701825141907,
0.7310590744018555,
... |
func (*ImportGithubRequest) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*ImportGithubRequest_ProtobufSettings)(nil),
(*ImportGithubRequest_AvroSettings)(nil),
(*ImportGithubRequest_JsonSchemaSettings)(nil),
}
} | [
-1.1178826093673706,
0.7881762385368347,
0.47993701696395874,
-0.10347496718168259,
0.8660765290260315,
0.21996375918388367,
0.14663667976856232,
-0.7713789939880371,
1.0691951513290405,
0.8486495614051819,
-0.6894308924674988,
-0.002148568630218506,
-0.4791799485683441,
1.0677552223205566... |
func (*ImportLocalRequest) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*ImportLocalRequest_ProtobufSettings)(nil),
(*ImportLocalRequest_AvroSettings)(nil),
(*ImportLocalRequest_JsonSchemaSettings)(nil),
}
} | [
-0.6997411847114563,
-0.10685689002275467,
0.3819008469581604,
-0.08371392637491226,
0.24737592041492462,
-0.25025007128715515,
0.010485026985406876,
-0.30086228251457214,
1.4529460668563843,
0.9058048725128174,
-0.5004097819328308,
-0.3911984860897064,
-0.3525140583515167,
0.8871303796768... |
func NewResource(
conf Config, mgr types.Manager, log log.Modular, stats metrics.Type,
) (Type, error) {
// TODO: V4 Remove this
inputProvider, ok := mgr.(inputProvider)
if !ok {
return nil, errors.New("manager does not support input resources")
}
if _, err := inputProvider.GetInput(conf.Resource); err != nil ... | [
0.15395458042621613,
-0.2491014450788498,
0.10039475560188293,
0.32775312662124634,
-0.7144070267677307,
-0.11237702518701553,
0.2632893919944763,
-0.22415784001350403,
0.3981711268424988,
0.47592681646347046,
0.526361346244812,
0.1922355443239212,
-0.7475131750106812,
0.6130933165550232,
... |
func (r *Resource) TransactionChan() <-chan types.Transaction {
in, err := r.mgr.GetInput(r.name)
if err != nil {
r.log.Debugf("Failed to obtain input resource '%v': %v", r.name, err)
r.mErrNotFound.Incr(1)
return nil
}
return in.TransactionChan()
} | [
-0.08808010816574097,
-0.40829506516456604,
0.47540563344955444,
-0.887910783290863,
0.2633424997329712,
-0.6177064776420593,
0.8147339224815369,
-0.6912010908126831,
0.2531496286392212,
0.25408878922462463,
0.31326377391815186,
0.5412582755088806,
-0.7080027461051941,
0.4037095606327057,
... |
func (r *Resource) Connected() bool {
in, err := r.mgr.GetInput(r.name)
if err != nil {
r.log.Debugf("Failed to obtain input resource '%v': %v", r.name, err)
r.mErrNotFound.Incr(1)
return false
}
return in.Connected()
} | [
-0.42759576439857483,
-0.6967115998268127,
0.6463773250579834,
-0.11748427897691727,
-0.5021294951438904,
0.43422365188598633,
-0.3849712908267975,
-0.5484760999679565,
-0.42454779148101807,
0.14997629821300507,
-0.26631733775138855,
-0.44800329208374023,
-0.2214069366455078,
0.59317934513... |
func (r *Resource) CloseAsync() {
} | [
-0.3449217677116394,
-1.085310935974121,
0.5433078408241272,
-0.4017786383628845,
-0.9590039849281311,
0.2445484697818756,
0.5608212947845459,
-0.23300012946128845,
0.4565599858760834,
-0.30819493532180786,
0.6031222939491272,
-0.3270741403102875,
0.5350284576416016,
1.109824538230896,
0... |
func (r *Resource) WaitForClose(timeout time.Duration) error {
return nil
} | [
-0.022147193551063538,
0.06809236854314804,
0.49831485748291016,
-0.003640003502368927,
-0.15093344449996948,
0.23558633029460907,
-0.392596572637558,
-0.47068220376968384,
-0.671297013759613,
-0.698176383972168,
0.4704068601131439,
-1.1445684432983398,
-0.16932451725006104,
1.327353000640... |
func execSQL(stmt *sql.Stmt, args ...interface{}) (sql.Result, error) {
r, err := stmt.Exec(args...)
if err != nil {
return r, fmt.Errorf("mysql: could not execute statement: %v", err)
}
rowsAffected, err := r.RowsAffected()
if err != nil {
return r, fmt.Errorf("mysql: could not get rows affected: %v", err)
}... | [
-0.043828051537275314,
0.7823702096939087,
0.5922707319259644,
0.05154884606599808,
-0.44923171401023865,
-0.6621017456054688,
0.08710943907499313,
0.17277972400188446,
0.5127482414245605,
0.14608119428157806,
0.2613578736782074,
0.12503069639205933,
-0.3778144121170044,
-0.003134788246825... |
func scanBook(row rowScanner) (*Book, error) {
var (
id int64
title sql.NullString
author sql.NullString
publishedDate sql.NullString
imageUrl sql.NullString
description sql.NullString
createdBy sql.NullString
createdById sql.NullString
)
if err := row.Scan(&id,... | [
-1.0948306322097778,
-0.17032353579998016,
0.21503745019435883,
1.274032711982727,
-0.6769285798072815,
-0.010752587579190731,
-1.0743446350097656,
-0.415181964635849,
0.41740766167640686,
-0.6339418888092041,
0.05049307644367218,
-0.16746854782104492,
-0.19617997109889984,
0.4825901687145... |
func (m *mysqlDB) ListBooks() ([]*Book, error) {
fmt.Println("DB ListBook")
list, err := m.conn.Prepare(listStatement)
if err != nil {
return nil, fmt.Errorf("mysql: prepare list: %v", err)
}
rows, err := list.Query()
if err != nil {
return nil, err
}
defer rows.Close()
var books []*Book
for rows.Next() ... | [
-0.8087610006332397,
-0.6161279082298279,
0.25239047408103943,
0.9192680716514587,
-0.3437778055667877,
0.26126745343208313,
-0.6122395396232605,
-0.21710994839668274,
0.036230020225048065,
0.11249842494726181,
0.5497480630874634,
-0.27878013253211975,
-1.0874249935150146,
0.85537195205688... |
func (m *mysqlDB) GetBook(id int64) (*Book, error) {
fmt.Println("DB GetBook")
get, err := m.conn.Prepare(getStatement)
if err != nil {
return nil, fmt.Errorf("mysql: prepare get: %v", err)
}
row := get.QueryRow(id)
book, err := scanBook(row)
if err == sql.ErrNoRows {
return nil, fmt.Errorf("mysql: could no... | [
-1.1531825065612793,
-0.04554807394742966,
0.7146390676498413,
0.6875309348106384,
-0.4009440243244171,
-0.11554443836212158,
-0.14874650537967682,
-0.6027742624282837,
-0.05778120085597038,
-0.2830994129180908,
0.6182008385658264,
-0.11752356588840485,
-0.843831479549408,
0.55664008855819... |
func (m *mysqlDB) AddBook(b *Book) (id int64, err error) {
fmt.Println("DB AddBook")
insert, err := m.conn.Prepare(insertStatement)
if err != nil {
return -1, fmt.Errorf("mysql: prepare insert: %v", err)
}
r, err := execSQL(insert, b.Title, b.Author, b.ImageURL)
if err != nil {
return -1, err
}
lastInsertI... | [
-1.1015369892120361,
0.10821299254894257,
1.1676493883132935,
0.7569929957389832,
-0.3773503303527832,
0.5788626670837402,
0.6021127700805664,
0.23366747796535492,
-0.4109763503074646,
-0.25309938192367554,
0.35598495602607727,
-1.22059166431427,
-1.8500977754592896,
0.6064490675926208,
... |
func (m *mysqlDB) DeleteBook(id int64) error {
fmt.Println("DB DeleteBook")
if id == 0 {
return errors.New("mysql: book with unassigned ID passed into deleteBook")
}
delete, err := m.conn.Prepare(deleteStatement)
if err != nil {
return fmt.Errorf("mysql: prepare delete: %v", err)
}
_, err = execSQL(delete, i... | [
-1.1252118349075317,
0.048784177750349045,
0.6790912747383118,
1.0846033096313477,
-0.29833096265792847,
0.6597504615783691,
-0.15961869060993195,
0.5042661428451538,
-0.37709763646125793,
-0.10339758545160294,
0.22098881006240845,
-0.5379042029380798,
-0.8614476919174194,
1.48728239536285... |
func (m *mysqlDB) UpdateBook(b *Book) error {
fmt.Println("DB UpdateBook")
update, err := m.conn.Prepare(updateStatement)
if err != nil {
return fmt.Errorf("mysql: prepare update: %v", err)
}
_, err = execSQL(update, b.Title, b.Author, b.ID)
return err
} | [
-1.5997917652130127,
-0.7229213118553162,
0.7139878273010254,
1.0937005281448364,
-0.6570168137550354,
0.9865279197692871,
-0.5365017056465149,
0.43824148178100586,
-1.0294396877288818,
0.4662352204322815,
-0.09278526157140732,
-0.2617262899875641,
-1.168618083000183,
0.40468618273735046,
... |
func (m *mysqlDB) Close() {
fmt.Println("DB close")
m.conn.Close()
} | [
-0.2652912437915802,
-0.24396656453609467,
0.45763567090034485,
0.47638753056526184,
-0.45784759521484375,
1.1611727476119995,
-0.3550962209701538,
0.41070306301116943,
-1.1237355470657349,
-0.8594626188278198,
0.218897745013237,
0.34132200479507446,
-1.5017086267471313,
1.560214877128601,... |
func (c MySQLConfig) dataStoreName(dbName string) string {
cred := ""
if c.Username != "" {
cred = c.Username
if c.Password != "" {
cred = cred + ":" + c.Password
}
cred = cred + "@"
}
if c.UnixSocket != "" {
return fmt.Sprintf("%sunix(%s)/%s", cred, c.UnixSocket, dbName)
}
return fmt.Sprintf("%stcp(... | [
-0.5457319617271423,
0.24367859959602356,
0.7236661911010742,
-0.3624670207500458,
-1.1883323192596436,
-0.022635256871581078,
-0.4048593044281006,
0.28473490476608276,
-0.04787157475948334,
0.6115424036979675,
-1.1057391166687012,
0.03017413802444935,
0.11475532501935959,
0.10829301178455... |
func (c MySQLConfig) ensureTableExists() error {
conn, err := sql.Open("mysql", c.dataStoreName(""))
if err != nil {
return fmt.Errorf("mysql: could not get a connection: %v", err)
}
defer conn.Close()
// Check the connection.
if conn.Ping() == driver.ErrBadConn {
return fmt.Errorf("mysql: could not connect ... | [
-0.266891211271286,
0.2046138346195221,
0.7590031027793884,
-0.00845005176961422,
1.3736363649368286,
-0.581811785697937,
0.10864600539207458,
-0.5236396193504333,
-0.10871556401252747,
-0.03490043431520462,
0.43990662693977356,
-0.47751954197883606,
0.09118608385324478,
0.1123643219470977... |
func newMySQLDB(config MySQLConfig) (BookDatabase, error) {
// Check database and table exists. If not, create it.
if err := config.ensureTableExists(); err != nil {
return nil, err
}
conn, err := sql.Open("mysql", config.dataStoreName("library"))
if err != nil {
return nil, fmt.Errorf("mysql: could not get a ... | [
-0.243521586060524,
-0.49757447838783264,
0.4553615152835846,
0.3805291950702667,
-0.7799475193023682,
0.5854014754295349,
-0.5284377336502075,
0.1630759984254837,
-0.13687148690223694,
-0.15567263960838318,
-0.34743401408195496,
-0.2694685757160187,
-0.6995721459388733,
0.7549642324447632... |
func (s service_imp) Csrf(session_token string) string {
return to_csrf(from_token(session_token))
} | [
0.5402235984802246,
-0.5508338212966919,
0.24000301957130432,
0.09567350149154663,
-0.26863905787467957,
-0.5474309325218201,
-0.7557334303855896,
-0.6330292224884033,
0.5862317085266113,
-0.24490244686603546,
0.45480379462242126,
0.6171923279762268,
0.18241752684116364,
-0.884447574615478... |
func (qi *QueryIterator) HasNext() bool {
return qi.processedRows < qi.totalRows
} | [
0.3814888298511505,
0.3150070309638977,
0.5157016515731812,
-0.8972618579864502,
-0.6264446377754211,
-0.0046423557214438915,
-0.17145919799804688,
-0.14242157340049744,
-0.38424497842788696,
0.03934396058320999,
0.7043619155883789,
-0.511077880859375,
0.1812266707420349,
0.301865339279174... |
func unwrapValueIfNeeded(value interface{}, field *bigquery.TableFieldSchema) interface{} {
if fieldMap, ok := value.(map[string]interface{}); ok {
if wrappedValue, ok := fieldMap["v"]; ok {
if field.Fields != nil {
return unwrapValueIfNeeded(wrappedValue, field)
}
return wrappedValue
}
if fieldVal... | [
-0.8189184665679932,
0.0361994206905365,
0.6746435165405273,
-0.3694513440132141,
-0.14130201935768127,
-0.6872907280921936,
0.12134280055761337,
-0.04470623657107353,
-0.2676527500152588,
0.39170870184898376,
-0.09257320314645767,
0.8939099311828613,
0.6897502541542053,
0.8376094102859497... |
func (qi *QueryIterator) Next() ([]interface{}, error) {
qi.processedRows++
qi.rowsIndex++
if int(qi.rowsIndex) >= len(qi.Rows) {
err := qi.fetchPage()
if err != nil {
return nil, err
}
}
row := qi.Rows[qi.rowsIndex]
fields := qi.schema.Fields
var values = make([]interface{}, 0)
for i, cell := range ro... | [
-0.9537091851234436,
0.6320605874061584,
0.5161272883415222,
0.42565059661865234,
-0.5904906988143921,
-0.32814329862594604,
-0.830314576625824,
-0.22575785219669342,
0.19859027862548828,
0.2279764860868454,
0.6061354279518127,
-0.11122918874025345,
0.07311748713254929,
0.5283899307250977,... |
func (qi *QueryIterator) GetColumns() ([]string, error) {
if qi.schema == nil {
return nil, errors.New("Failed to get table schema")
}
var result = make([]string, 0)
for _, field := range qi.schema.Fields {
result = append(result, field.Name)
}
return result, nil
} | [
-0.4183535873889923,
0.29904139041900635,
0.26254457235336304,
-0.03511321544647217,
0.2750893235206604,
0.12703149020671844,
0.11935838311910629,
-0.4971993565559387,
0.1449146568775177,
0.038116954267024994,
-0.29238569736480713,
-0.13542889058589935,
-0.8622620701789856,
-0.289712071418... |
func NewQueryIterator(manager dsc.Manager, query string) (*QueryIterator, error) {
service, context, err := GetServiceAndContextForManager(manager)
if err != nil {
return nil, err
}
config := manager.Config()
var result = &QueryIterator{
Rows: make([]*bigquery.TableRow, 0),
queryTask: &queryTask{
manage... | [
-0.1701384335756302,
0.07037095725536346,
0.3410768210887909,
-0.6809385418891907,
-1.8104729652404785,
-0.37003839015960693,
-0.30679044127464294,
0.16124959290027618,
-0.42722395062446594,
-0.060742784291505814,
0.3100760579109192,
0.7061069011688232,
0.011505629867315292,
1.087879776954... |
func main() {
queryBytes, err := ioutil.ReadAll(os.Stdin)
if err != nil {
panic(err)
}
var query map[string]string
err = json.Unmarshal(queryBytes, &query)
if err != nil {
panic(err)
}
if query["fail"] != "" {
fmt.Fprintf(os.Stderr, "I was asked to fail\n")
os.Exit(1)
}
var result = map[string]stri... | [
0.04927494376897812,
-0.3075985908508301,
1.0968683958053589,
0.2111053317785263,
-0.8949145078659058,
0.7288806438446045,
-0.0069427951239049435,
-0.1728758066892624,
-1.0967518091201782,
-0.02177746221423149,
0.2811433672904968,
0.7182889580726624,
0.13570724427700043,
-0.078243069350719... |
func (instances *instances) AddDeploymentEvent(ctx context.Context, dep models.Deployment, event models.DeploymentEvent) error {
err := instances.Deployments.AddEvent(dep, event)
if err != nil {
return err
}
if event.Status == "TERMINATING" {
err = instances.Deploy.StopDeployment(ctx, dep)
}
return err
} | [
-0.40119990706443787,
0.09696562588214874,
0.2146778106689453,
-0.1370149701833725,
-0.05782013386487961,
0.8777003288269043,
-0.5690072774887085,
1.0054563283920288,
0.2009802609682083,
0.8837397694587708,
-0.4668506383895874,
-0.9471984505653381,
0.3823562562465668,
0.6452625393867493,
... |
func (instances *instances) UpdateInstanceStatus(ctx context.Context) error {
runningdeployments, err := instances.Deployments.GetWithStatus(runningStatus, 100)
log.WithFields(log.Fields{
"count": len(runningdeployments),
}).Info("Looking up deployments")
if len(runningdeployments) == 0 {
return nil
}
var ... | [
-1.084182620048523,
-0.846376359462738,
0.562090277671814,
-0.6517388820648193,
0.2537398338317871,
-0.14360851049423218,
-0.46706968545913696,
0.4444306492805481,
0.27432769536972046,
1.175264835357666,
-0.19060362875461578,
-0.6519021987915039,
-0.028956595808267593,
0.6300631761550903,
... |
func (instances *instances) FindIPs(ctx context.Context) error {
deploymentsWithoutIPs, err := instances.Deployments.GetWithoutIP()
log.WithFields(log.Fields{
"count": len(deploymentsWithoutIPs),
}).Info("Getting IPs of Deployments")
if len(deploymentsWithoutIPs) == 0 {
return nil
}
// AWS Describe the ass... | [
-1.10871422290802,
-0.08273003995418549,
0.4145223796367645,
-1.0124961137771606,
-0.16357940435409546,
-0.5138404369354248,
-0.0603947639465332,
0.15926118195056915,
-0.059039268642663956,
0.7243038415908813,
0.6294203400611877,
-0.5101228952407837,
0.15019816160202026,
0.4036774337291717... |
func TestPingGet(t *testing.T) {
p := Ping{}
code, resp := p.Get(nil)
if code != http.StatusOK {
t.Fatalf("Unexpected status code. Expected: %d - Found: %d.", http.StatusOK, code)
}
r, ok := resp.(SimpleResponse)
if !ok {
t.Fatalf("Unexected response type. Should be SimpleResponse but is: %s", reflect.TypeOf(... | [
0.15842205286026,
0.15485912561416626,
0.7697900533676147,
-0.22271929681301117,
0.7001650333404541,
0.2752440273761749,
-0.04091392830014229,
-0.12731370329856873,
0.5545111298561096,
-0.3411928713321686,
-0.15774789452552795,
-0.1729600876569748,
-0.2754209637641907,
-0.24798880517482758... |
func (tg *TiKVGroup) BaseTiKVSpec(tc *TidbCluster) ComponentAccessor {
return buildTidbClusterComponentAccessor(&tc.Spec, &tg.Spec.ComponentSpec)
} | [
0.11404521763324738,
-1.1704391241073608,
0.39107468724250793,
-0.6538518071174622,
-0.13869835436344147,
-0.3225601613521576,
0.3351801633834839,
-0.5687404274940491,
-0.6686532497406006,
0.5230444669723511,
1.419502854347229,
0.3489282727241516,
0.47927922010421753,
-0.288187175989151,
... |
func New(conf *liverpc.ClientConfig) *Client {
if conf == nil {
conf = &liverpc.ClientConfig{}
}
conf.AppID = DiscoveryAppId
var realCli = liverpc.NewClient(conf)
cli := &Client{cli: realCli}
cli.clientInit(realCli)
return cli
} | [
1.154547929763794,
-0.7369322180747986,
0.13196592032909393,
-0.3423330783843994,
-0.23510286211967468,
0.5449084043502808,
0.12360415607690811,
-0.04801174998283386,
-0.4766567647457123,
-0.49052396416664124,
-0.530773937702179,
0.5365930199623108,
0.2871353328227997,
0.45294222235679626,... |
func (args *Args) list() []*Arg {
return args.items
} | [
-0.41834157705307007,
-1.108263373374939,
0.24570903182029724,
-0.5158104300498962,
1.2736263275146484,
0.2482966035604477,
-0.8525522947311401,
0.6594748497009277,
-0.05869758874177933,
0.14886467158794403,
-0.7683841586112976,
0.6476866006851196,
0.1861175000667572,
0.4374728798866272,
... |
func (args *Args) isEmpty() bool {
return len(args.items) == 0
} | [
-1.3243916034698486,
-0.22361481189727783,
0.41310781240463257,
-0.22397513687610626,
1.9899808168411255,
0.24840618669986725,
-0.5939430594444275,
-0.08108224719762802,
-0.5762403011322021,
0.40893906354904175,
-0.2729807496070862,
0.6512404680252075,
-0.2298947423696518,
0.09497170895338... |
func (args *Args) len() int {
return len(args.items)
} | [
-0.1497507244348526,
0.19977107644081116,
0.11233025044202805,
-1.0745162963867188,
1.2948102951049805,
-0.5148429274559021,
0.552146852016449,
1.1498509645462036,
-0.7281911969184875,
-0.18649731576442719,
-0.9944823980331421,
0.590957760810852,
0.4815511703491211,
0.026768378913402557,
... |
func (args *Args) value(name string) interface{} {
for _, arg := range args.items {
if arg.name == name {
return arg.value
}
}
return nil
} | [
-0.34437456727027893,
-0.22835518419742584,
0.5885968804359436,
-0.29459303617477417,
0.37214523553848267,
-0.10601835697889328,
-0.6138715147972107,
-0.8578452467918396,
-0.5108910799026489,
1.157335638999939,
0.16920849680900574,
0.20274178683757782,
-0.161349356174469,
0.858631551265716... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.