query stringlengths 7 3.85k | document stringlengths 11 430k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102 values |
|---|---|---|---|---|---|---|
read a Grid in from stdin | func readStdin() (grid []lineRep, err error) {
scanner := bufio.NewScanner(os.Stdin)
for scanner.Scan() {
line := strings.Trim(scanner.Text(), "\r\n")
if len(line) != lineLen {
err = ErrBadLine
return
}
var lrep lineRep
for i := 0; i < lineLen; i++ {
lrep[i] = (line[i] == '#')
}
grid = append(grid, lrep)
}
return
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func ReadGrid(s io.ByteScanner) (Grid, error) {\n\tg := NewGrid()\n\tfor r := 0; r < GridSize; r++ {\n\t\tfor c := 0; c < GridSize; c++ {\n\t\t\t// read number\n\t\t\tb, err := s.ReadByte()\n\t\t\tif err != nil {\n\t\t\t\treturn g, fmt.Errorf(\"failed to read sudoku grid row %d: %s\", r+1, err)\n\t\t\t}\n\n\t\t\ti... | [
"0.63220334",
"0.58543783",
"0.5794181",
"0.53933036",
"0.5389282",
"0.53381824",
"0.532996",
"0.5317379",
"0.53009486",
"0.52075785",
"0.51880455",
"0.5155525",
"0.5149886",
"0.50784737",
"0.50684035",
"0.50643533",
"0.5062687",
"0.506253",
"0.50417095",
"0.50237936",
"0.501... | 0.69211537 | 0 |
inputs should only contain one element, which is a JSON in string format. | func simpleEC(this js.Value, inputs []js.Value) interface{} {
var suite = suites.MustFind("Ed25519")
var args map[string]interface{}
json.Unmarshal([]byte(inputs[0].String()), &args)
scalar := suite.Scalar()
scalarB, _ := base64.StdEncoding.DecodeString(args["scalar"].(string))
scalar.UnmarshalBinary(scalarB)
var resultB []byte
for i := 0; i < 1; i++ {
resultB, _ = suite.Point().Mul(scalar, nil).MarshalBinary()
}
args["result"] = base64.StdEncoding.EncodeToString(resultB)
//args["resultTest"] = result.String()
args["Accepted"] = "true"
return args
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (c *EzClient) JSONStr(j string) *EzClient {\n\tc.body = strings.NewReader(j)\n\treturn c\n}",
"func isJSON(fl FieldLevel) bool {\n\tfield := fl.Field()\n\n\tswitch field.Kind() {\n\tcase reflect.String:\n\t\tval := field.String()\n\t\treturn json.Valid([]byte(val))\n\tcase reflect.Slice:\n\t\tfieldType := f... | [
"0.55645144",
"0.556348",
"0.55368376",
"0.5528069",
"0.5527707",
"0.5421018",
"0.53463215",
"0.5275128",
"0.52324396",
"0.5226067",
"0.52047956",
"0.51953447",
"0.5169891",
"0.5084266",
"0.5078017",
"0.5057773",
"0.5048943",
"0.50449014",
"0.5040474",
"0.5037562",
"0.5028277... | 0.0 | -1 |
Ping gets the latest token and endpoint from knapsack and updates the sender | func (ls *LogShipper) Ping() {
// set up new auth token
token, _ := ls.knapsack.TokenStore().Get(storage.ObservabilityIngestAuthTokenKey)
ls.sender.authtoken = string(token)
parsedUrl, err := url.Parse(ls.knapsack.LogIngestServerURL())
if err != nil {
// If we have a bad endpoint, just disable for now.
// It will get renabled when control server sends a
// valid endpoint.
ls.sender.endpoint = ""
level.Debug(ls.baseLogger).Log(
"msg", "error parsing log ingest server url, shipping disabled",
"err", err,
"log_ingest_url", ls.knapsack.LogIngestServerURL(),
)
} else if parsedUrl != nil {
ls.sender.endpoint = parsedUrl.String()
}
ls.isShippingEnabled = ls.sender.endpoint != ""
ls.addDeviceIdentifyingAttributesToLogger()
if !ls.isShippingEnabled {
ls.sendBuffer.DeleteAllData()
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (p *protocol) Ping(ctx context.Context, peer p2pcrypto.PublicKey) error {\n\tplogger := p.logger.WithFields(log.String(\"type\", \"ping\"), log.String(\"to\", peer.String()))\n\tplogger.Debug(\"send ping request\")\n\n\tdata, err := types.InterfaceToBytes(p.local)\n\tif err != nil {\n\t\treturn err\n\t}\n\tch... | [
"0.62991756",
"0.62218475",
"0.6127298",
"0.60164106",
"0.5952915",
"0.594179",
"0.59320486",
"0.58054584",
"0.574001",
"0.572451",
"0.5642795",
"0.56324285",
"0.56268364",
"0.56138825",
"0.5613871",
"0.55971634",
"0.55664784",
"0.5563618",
"0.5556949",
"0.55345005",
"0.55270... | 0.6587082 | 0 |
filterResults filteres out the osquery results, which just make a lot of noise in our debug logs. It's a bit fragile, since it parses keyvals, but hopefully that's good enough | func filterResults(keyvals ...interface{}) {
// Consider switching on `method` as well?
for i := 0; i < len(keyvals); i += 2 {
if keyvals[i] == "results" && len(keyvals) > i+1 {
str, ok := keyvals[i+1].(string)
if ok && len(str) > 100 {
keyvals[i+1] = fmt.Sprintf(truncatedFormatString, str[0:99])
}
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (client *Client) FilterResults(bucketKey, testID string, count int64, since, before *time.Time) ([]Result, error) {\n\tvar results = []Result{}\n\n\tfilterQs, err := client.buildFilterQS(count, since, before)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpath := fmt.Sprintf(\"buckets/%s/tests/%s/results%s... | [
"0.5933217",
"0.5706581",
"0.5662733",
"0.5388316",
"0.5339293",
"0.5253418",
"0.522346",
"0.5208776",
"0.5194245",
"0.5080863",
"0.50705075",
"0.5032865",
"0.49835747",
"0.4974379",
"0.49097186",
"0.4871121",
"0.48682055",
"0.48492196",
"0.48399386",
"0.48255545",
"0.4796718... | 0.7366106 | 0 |
addDeviceIdentifyingAttributesToLogger gets device identifiers from the serverprovided data and adds them as attributes on the logger. | func (ls *LogShipper) addDeviceIdentifyingAttributesToLogger() {
if deviceId, err := ls.knapsack.ServerProvidedDataStore().Get([]byte("device_id")); err != nil {
level.Debug(ls.baseLogger).Log("msg", "could not get device id", "err", err)
} else {
ls.shippingLogger = log.With(ls.shippingLogger, "k2_device_id", string(deviceId))
}
if munemo, err := ls.knapsack.ServerProvidedDataStore().Get([]byte("munemo")); err != nil {
level.Debug(ls.baseLogger).Log("msg", "could not get munemo", "err", err)
} else {
ls.shippingLogger = log.With(ls.shippingLogger, "k2_munemo", string(munemo))
}
if orgId, err := ls.knapsack.ServerProvidedDataStore().Get([]byte("organization_id")); err != nil {
level.Debug(ls.baseLogger).Log("msg", "could not get organization id", "err", err)
} else {
ls.shippingLogger = log.With(ls.shippingLogger, "k2_organization_id", string(orgId))
}
if serialNumber, err := ls.knapsack.ServerProvidedDataStore().Get([]byte("serial_number")); err != nil {
level.Debug(ls.baseLogger).Log("msg", "could not get serial number", "err", err)
} else {
ls.shippingLogger = log.With(ls.shippingLogger, "serial_number", string(serialNumber))
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func saveDeviceAttributes(crosAttrs *crossdevicecommon.CrosAttributes, androidAttrs *AndroidAttributes, filepath string) error {\n\tattributes := struct {\n\t\tCrOS *crossdevicecommon.CrosAttributes\n\t\tAndroid *AndroidAttributes\n\t}{CrOS: crosAttrs, Android: androidAttrs}\n\tcrosLog, err := json.MarshalInden... | [
"0.5557884",
"0.4813603",
"0.46791387",
"0.46733153",
"0.4654631",
"0.4619182",
"0.45385584",
"0.4537661",
"0.45279917",
"0.45088488",
"0.44959372",
"0.44899687",
"0.44824657",
"0.44575042",
"0.4420062",
"0.44011697",
"0.43935454",
"0.43847346",
"0.4371316",
"0.4371216",
"0.4... | 0.77253795 | 0 |
AddDuckEntry add a duck entry to the database | func (h *Helper) AddDuckEntry(entry *types.Entry) error {
query := `
INSERT INTO duck_entries (
id,
fed_time,
food,
kind_of_food,
amount_of_food,
location,
number_of_ducks
) VALUES (
$1, $2, $3, $4, $5, $6, $7
)
`
_, err := h.db.Exec(
query,
entry.ID,
entry.TimeFed,
entry.Food.Name,
entry.Food.Kind,
entry.AmountOfFood,
entry.Location,
entry.NumberOfDucks,
)
return err
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func addEntry(t *testing.T, key string, keyspace uint) {\n\t// Insert at least one event to make sure db exists\n\tc, err := rd.Dial(\"tcp\", host)\n\tif err != nil {\n\t\tt.Fatal(\"connect\", err)\n\t}\n\t_, err = c.Do(\"SELECT\", keyspace)\n\tif err != nil {\n\t\tt.Fatal(\"select\", err)\n\t}\n\tdefer c.Close()\... | [
"0.56566906",
"0.54972076",
"0.5347849",
"0.5276514",
"0.52698773",
"0.5261927",
"0.5195475",
"0.5090482",
"0.50653654",
"0.50398946",
"0.5009467",
"0.49901676",
"0.4958086",
"0.49541336",
"0.4946788",
"0.49366578",
"0.49039248",
"0.4845691",
"0.48356435",
"0.48319933",
"0.48... | 0.80298865 | 0 |
EncodeAddResponse returns an encoder for responses returned by the station add endpoint. | func EncodeAddResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error {
return func(ctx context.Context, w http.ResponseWriter, v interface{}) error {
res := v.(*stationviews.StationFull)
enc := encoder(ctx, w)
body := NewAddResponseBody(res.Projected)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func EncodeAddResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) kithttp.EncodeResponseFunc {\n\treturn server.EncodeAddResponse(encoder)\n}",
"func EncodeAddResponse(_ context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"appl... | [
"0.77350336",
"0.7448181",
"0.73949987",
"0.73949987",
"0.7146428",
"0.6304965",
"0.6304965",
"0.61842614",
"0.606697",
"0.6016128",
"0.6006338",
"0.5940639",
"0.59328",
"0.58163124",
"0.5805168",
"0.5805168",
"0.5771933",
"0.5771933",
"0.5753668",
"0.573444",
"0.57306087",
... | 0.84407 | 1 |
DecodeAddRequest returns a decoder for requests sent to the station add endpoint. | func DecodeAddRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error) {
return func(r *http.Request) (interface{}, error) {
var (
body AddRequestBody
err error
)
err = decoder(r).Decode(&body)
if err != nil {
if err == io.EOF {
return nil, goa.MissingPayloadError()
}
return nil, goa.DecodePayloadError(err.Error())
}
err = ValidateAddRequestBody(&body)
if err != nil {
return nil, err
}
var (
auth string
)
auth = r.Header.Get("Authorization")
if auth == "" {
err = goa.MergeErrors(err, goa.MissingFieldError("Authorization", "header"))
}
if err != nil {
return nil, err
}
payload := NewAddPayload(&body, auth)
if strings.Contains(payload.Auth, " ") {
// Remove authorization scheme prefix (e.g. "Bearer")
cred := strings.SplitN(payload.Auth, " ", 2)[1]
payload.Auth = cred
}
return payload, nil
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func DecodeAddRequest(_ context.Context, r *http.Request) (req interface{}, err error) {\n\tt := da.DA{}\n\terr = json.NewDecoder(r.Body).Decode(&t)\n\treq = endpoints.AddRequest{Req: t}\n\treturn req, err\n}",
"func (tbr *TransportBaseReqquesst) DecodeAddRequest(data []byte) (dto.BasicRequest, error) {\n\treque... | [
"0.8180087",
"0.780095",
"0.76045024",
"0.72493047",
"0.7102593",
"0.706651",
"0.67097616",
"0.6551272",
"0.64122444",
"0.5997548",
"0.59262514",
"0.5888713",
"0.5675138",
"0.5635202",
"0.5613576",
"0.55950326",
"0.5587561",
"0.5580305",
"0.5570015",
"0.5559726",
"0.55489516"... | 0.68153095 | 7 |
EncodeGetResponse returns an encoder for responses returned by the station get endpoint. | func EncodeGetResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error {
return func(ctx context.Context, w http.ResponseWriter, v interface{}) error {
res := v.(*stationviews.StationFull)
enc := encoder(ctx, w)
body := NewGetResponseBody(res.Projected)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func EncodeGetResponse(_ context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\te := json.NewEncoder(w)\n\te.SetIndent(\"\", \"\\t\")\n\terr = e.Encode(response)\n\treturn err\n}",
"func EncodeGetResponse(encoder fun... | [
"0.738936",
"0.7218818",
"0.717976",
"0.717976",
"0.6347507",
"0.63088006",
"0.6233569",
"0.59925115",
"0.59872466",
"0.5914394",
"0.59015024",
"0.57884914",
"0.57449836",
"0.57449836",
"0.5724624",
"0.5677687",
"0.5677687",
"0.5672211",
"0.5615162",
"0.5615162",
"0.5574049",... | 0.8340234 | 1 |
DecodeGetRequest returns a decoder for requests sent to the station get endpoint. | func DecodeGetRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error) {
return func(r *http.Request) (interface{}, error) {
var (
id int32
auth string
err error
params = mux.Vars(r)
)
{
idRaw := params["id"]
v, err2 := strconv.ParseInt(idRaw, 10, 32)
if err2 != nil {
err = goa.MergeErrors(err, goa.InvalidFieldTypeError("id", idRaw, "integer"))
}
id = int32(v)
}
auth = r.Header.Get("Authorization")
if auth == "" {
err = goa.MergeErrors(err, goa.MissingFieldError("Authorization", "header"))
}
if err != nil {
return nil, err
}
payload := NewGetPayload(id, auth)
if strings.Contains(payload.Auth, " ") {
// Remove authorization scheme prefix (e.g. "Bearer")
cred := strings.SplitN(payload.Auth, " ", 2)[1]
payload.Auth = cred
}
return payload, nil
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func decodeGetRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\tvar req getRequest\n\tsymbol := mux.Vars(r)[\"symbol\"]\n\treq.symbol = symbol\n\treturn req, nil\n}",
"func decodeGetRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.GetRequest{}\n\treturn... | [
"0.7466018",
"0.7384454",
"0.7384454",
"0.73611623",
"0.68910074",
"0.6809246",
"0.67959404",
"0.6675078",
"0.64306253",
"0.6370576",
"0.62963444",
"0.6230798",
"0.618265",
"0.610566",
"0.60814506",
"0.6077663",
"0.6052375",
"0.59954447",
"0.5978668",
"0.5978415",
"0.59366804... | 0.67648876 | 7 |
EncodeUpdateResponse returns an encoder for responses returned by the station update endpoint. | func EncodeUpdateResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error {
return func(ctx context.Context, w http.ResponseWriter, v interface{}) error {
res := v.(*stationviews.StationFull)
enc := encoder(ctx, w)
body := NewUpdateResponseBody(res.Projected)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func EncodeUpdateResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v interface{}) error {\n\t\tres := v.(*inventoryviews.Inventory)\n\t\tenc := encoder(ctx, w)\n\t\t... | [
"0.7742181",
"0.71021205",
"0.7021235",
"0.6978841",
"0.6563629",
"0.63012516",
"0.6150287",
"0.6150287",
"0.60966545",
"0.6080683",
"0.6045867",
"0.6007651",
"0.60058993",
"0.59995383",
"0.5951425",
"0.59048086",
"0.59048086",
"0.5870445",
"0.58162326",
"0.5810505",
"0.57673... | 0.8471365 | 1 |
DecodeUpdateRequest returns a decoder for requests sent to the station update endpoint. | func DecodeUpdateRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error) {
return func(r *http.Request) (interface{}, error) {
var (
body UpdateRequestBody
err error
)
err = decoder(r).Decode(&body)
if err != nil {
if err == io.EOF {
return nil, goa.MissingPayloadError()
}
return nil, goa.DecodePayloadError(err.Error())
}
err = ValidateUpdateRequestBody(&body)
if err != nil {
return nil, err
}
var (
id int32
auth string
params = mux.Vars(r)
)
{
idRaw := params["id"]
v, err2 := strconv.ParseInt(idRaw, 10, 32)
if err2 != nil {
err = goa.MergeErrors(err, goa.InvalidFieldTypeError("id", idRaw, "integer"))
}
id = int32(v)
}
auth = r.Header.Get("Authorization")
if auth == "" {
err = goa.MergeErrors(err, goa.MissingFieldError("Authorization", "header"))
}
if err != nil {
return nil, err
}
payload := NewUpdatePayload(&body, id, auth)
if strings.Contains(payload.Auth, " ") {
// Remove authorization scheme prefix (e.g. "Bearer")
cred := strings.SplitN(payload.Auth, " ", 2)[1]
payload.Auth = cred
}
return payload, nil
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func DecodeUpdateReq(c context.Context, r *http.Request) (interface{}, error) {\n\tvar req updateReq\n\n\tprjReq, err := common.DecodeProjectRequest(c, r)\n\tif err != nil {\n\t\treturn nil, err\n\n\t}\n\treq.ProjectReq = prjReq.(common.ProjectReq)\n\n\tif err := json.NewDecoder(r.Body).Decode(&req.Body); err != n... | [
"0.7228984",
"0.7166149",
"0.69803184",
"0.6748723",
"0.65615344",
"0.6503183",
"0.6348351",
"0.6287267",
"0.622846",
"0.6216525",
"0.6201554",
"0.59866524",
"0.594428",
"0.5900754",
"0.58732945",
"0.5771747",
"0.5768235",
"0.5767347",
"0.5765923",
"0.57492346",
"0.5749043",
... | 0.70278543 | 3 |
EncodeListMineResponse returns an encoder for responses returned by the station list mine endpoint. | func EncodeListMineResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error {
return func(ctx context.Context, w http.ResponseWriter, v interface{}) error {
res := v.(*stationviews.StationsFull)
enc := encoder(ctx, w)
body := NewListMineResponseBody(res.Projected)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func NewListMineHandler(\n\tendpoint goa.Endpoint,\n\tmux goahttp.Muxer,\n\tdecoder func(*http.Request) goahttp.Decoder,\n\tencoder func(context.Context, http.ResponseWriter) goahttp.Encoder,\n\terrhandler func(context.Context, http.ResponseWriter, error),\n\tformatter func(err error) goahttp.Statuser,\n) http.Han... | [
"0.6749497",
"0.6174522",
"0.6067098",
"0.60174346",
"0.5780173",
"0.5780173",
"0.5778851",
"0.57437104",
"0.538584",
"0.53584236",
"0.5326893",
"0.5297041",
"0.5297041",
"0.5218593",
"0.5209975",
"0.5209975",
"0.518384",
"0.51277804",
"0.51260704",
"0.51260704",
"0.5113847",... | 0.87327904 | 1 |
DecodeListMineRequest returns a decoder for requests sent to the station list mine endpoint. | func DecodeListMineRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error) {
return func(r *http.Request) (interface{}, error) {
var (
auth string
err error
)
auth = r.Header.Get("Authorization")
if auth == "" {
err = goa.MergeErrors(err, goa.MissingFieldError("Authorization", "header"))
}
if err != nil {
return nil, err
}
payload := NewListMinePayload(auth)
if strings.Contains(payload.Auth, " ") {
// Remove authorization scheme prefix (e.g. "Bearer")
cred := strings.SplitN(payload.Auth, " ", 2)[1]
payload.Auth = cred
}
return payload, nil
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func DecodeListRequest(_ context.Context, r *http.Request) (req interface{}, err error) {\n\t//req = endpoints.ListRequest{}\n\t//err = json.NewDecoder(r.Body).Decode(&r)\n\treturn nil, nil\n}",
"func NewListMineHandler(\n\tendpoint goa.Endpoint,\n\tmux goahttp.Muxer,\n\tdecoder func(*http.Request) goahttp.Decod... | [
"0.6647594",
"0.623101",
"0.6119391",
"0.6101886",
"0.5967836",
"0.5677936",
"0.5642956",
"0.5642956",
"0.5464152",
"0.5373376",
"0.5305349",
"0.5294469",
"0.5274609",
"0.5234348",
"0.51371527",
"0.5090458",
"0.5090458",
"0.5079641",
"0.50233984",
"0.49366572",
"0.49283877",
... | 0.77336144 | 1 |
EncodeListProjectResponse returns an encoder for responses returned by the station list project endpoint. | func EncodeListProjectResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error {
return func(ctx context.Context, w http.ResponseWriter, v interface{}) error {
res := v.(*stationviews.StationsFull)
enc := encoder(ctx, w)
body := NewListProjectResponseBody(res.Projected)
w.WriteHeader(http.StatusOK)
return enc.Encode(body)
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func EncodeListAllResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v interface{}) error {\n\t\tres := v.(*stationviews.PageOfStations)\n\t\tenc := encoder(ctx, w)\n... | [
"0.66244555",
"0.66053957",
"0.64365035",
"0.63808805",
"0.63808805",
"0.5981067",
"0.5973597",
"0.59238386",
"0.5827064",
"0.5796707",
"0.56851476",
"0.5661161",
"0.5607564",
"0.55449367",
"0.5491274",
"0.53966177",
"0.53779817",
"0.5343738",
"0.53417397",
"0.5295",
"0.52944... | 0.8802749 | 1 |
DecodeListProjectRequest returns a decoder for requests sent to the station list project endpoint. | func DecodeListProjectRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error) {
return func(r *http.Request) (interface{}, error) {
var (
id int32
auth string
err error
params = mux.Vars(r)
)
{
idRaw := params["id"]
v, err2 := strconv.ParseInt(idRaw, 10, 32)
if err2 != nil {
err = goa.MergeErrors(err, goa.InvalidFieldTypeError("id", idRaw, "integer"))
}
id = int32(v)
}
auth = r.Header.Get("Authorization")
if auth == "" {
err = goa.MergeErrors(err, goa.MissingFieldError("Authorization", "header"))
}
if err != nil {
return nil, err
}
payload := NewListProjectPayload(id, auth)
if strings.Contains(payload.Auth, " ") {
// Remove authorization scheme prefix (e.g. "Bearer")
cred := strings.SplitN(payload.Auth, " ", 2)[1]
payload.Auth = cred
}
return payload, nil
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func DecodeListProjectRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error) {\n\treturn func(r *http.Request) (interface{}, error) {\n\t\tvar (\n\t\t\tid int32\n\t\t\tauth *string\n\t\t\terr error\n\n\t\t\tparams = mux.Vars(r)\n\t\t)\n\t\t{\n\t\t\tidRaw... | [
"0.77504146",
"0.6180641",
"0.60008043",
"0.59077823",
"0.5890921",
"0.58848584",
"0.5729322",
"0.5700603",
"0.5693746",
"0.56147546",
"0.54706967",
"0.53617907",
"0.51922315",
"0.51573884",
"0.51451105",
"0.51451105",
"0.5006936",
"0.49771795",
"0.49724835",
"0.4966115",
"0.... | 0.7734819 | 1 |
EncodePhotoResponse returns an encoder for responses returned by the station photo endpoint. | func EncodePhotoResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error {
return func(ctx context.Context, w http.ResponseWriter, v interface{}) error {
res := v.(*station.PhotoResult)
val := res.Length
lengths := strconv.FormatInt(val, 10)
w.Header().Set("Content-Length", lengths)
w.Header().Set("Content-Type", res.ContentType)
w.WriteHeader(http.StatusOK)
return nil
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func EncodeDownloadPhotoResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v interface{}) error {\n\t\tres := v.(*stationviews.DownloadedPhoto)\n\t\tenc := encoder(ct... | [
"0.74781483",
"0.62486506",
"0.59732944",
"0.57222086",
"0.5655075",
"0.5414545",
"0.5414545",
"0.53795993",
"0.53570646",
"0.5320004",
"0.53183687",
"0.51771194",
"0.51771194",
"0.5126381",
"0.5126381",
"0.51042616",
"0.50953805",
"0.50845945",
"0.5083168",
"0.5083168",
"0.5... | 0.841563 | 0 |
DecodePhotoRequest returns a decoder for requests sent to the station photo endpoint. | func DecodePhotoRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error) {
return func(r *http.Request) (interface{}, error) {
var (
id int32
auth string
err error
params = mux.Vars(r)
)
{
idRaw := params["id"]
v, err2 := strconv.ParseInt(idRaw, 10, 32)
if err2 != nil {
err = goa.MergeErrors(err, goa.InvalidFieldTypeError("id", idRaw, "integer"))
}
id = int32(v)
}
auth = r.URL.Query().Get("token")
if auth == "" {
err = goa.MergeErrors(err, goa.MissingFieldError("token", "query string"))
}
if err != nil {
return nil, err
}
payload := NewPhotoPayload(id, auth)
if strings.Contains(payload.Auth, " ") {
// Remove authorization scheme prefix (e.g. "Bearer")
cred := strings.SplitN(payload.Auth, " ", 2)[1]
payload.Auth = cred
}
return payload, nil
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func DecodeDownloadPhotoRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error) {\n\treturn func(r *http.Request) (interface{}, error) {\n\t\tvar (\n\t\t\tstationID int32\n\t\t\tsize *int32\n\t\t\tifNoneMatch *string\n\t\t\tauth string\n\t\t\... | [
"0.7342964",
"0.53671885",
"0.53411776",
"0.53116256",
"0.52504474",
"0.51435006",
"0.5059911",
"0.5053711",
"0.5008042",
"0.5003034",
"0.49835262",
"0.49192208",
"0.49134532",
"0.48851678",
"0.48676896",
"0.4850976",
"0.48315606",
"0.48152205",
"0.48096696",
"0.48055834",
"0... | 0.7481243 | 0 |
marshalStationviewsStationOwnerViewToStationOwnerResponseBody builds a value of type StationOwnerResponseBody from a value of type stationviews.StationOwnerView. | func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {
res := &StationOwnerResponseBody{
ID: *v.ID,
Name: *v.Name,
}
return res
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func marshalStationviewsStationLocationViewToStationLocationResponseBody(v *stationviews.StationLocationView) *StationLocationResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &StationLocationResponseBody{\n\t\tLatitude: *v.Latitude,\n\t\tLongitude: *v.Longitude,\n\t}\n\n\treturn res\n}",
"func mar... | [
"0.6972683",
"0.6749984",
"0.6749984",
"0.67477703",
"0.67364055",
"0.67186743",
"0.6703494",
"0.6680178",
"0.66111636",
"0.65271205",
"0.65271205",
"0.634803",
"0.6344699",
"0.6344699",
"0.6308697",
"0.6245512",
"0.61731243",
"0.61731243",
"0.615044",
"0.6141832",
"0.6101047... | 0.87977135 | 1 |
marshalStationviewsStationUploadViewToStationUploadResponseBody builds a value of type StationUploadResponseBody from a value of type stationviews.StationUploadView. | func marshalStationviewsStationUploadViewToStationUploadResponseBody(v *stationviews.StationUploadView) *StationUploadResponseBody {
res := &StationUploadResponseBody{
ID: *v.ID,
Time: *v.Time,
UploadID: *v.UploadID,
Size: *v.Size,
URL: *v.URL,
Type: *v.Type,
}
if v.Blocks != nil {
res.Blocks = make([]int64, len(v.Blocks))
for i, val := range v.Blocks {
res.Blocks[i] = val
}
}
return res
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func marshalStationviewsStationRegionViewToStationRegionResponseBody(v *stationviews.StationRegionView) *StationRegionResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &StationRegionResponseBody{\n\t\tName: *v.Name,\n\t}\n\tif v.Shape != nil {\n\t\tres.Shape = make([][][]float64, len(v.Shape))\n\t\tfo... | [
"0.70071906",
"0.6994669",
"0.6985549",
"0.682845",
"0.67634916",
"0.6625638",
"0.6625638",
"0.6548885",
"0.6548885",
"0.65425193",
"0.6507635",
"0.6507635",
"0.6404558",
"0.6389207",
"0.63145983",
"0.6297966",
"0.6287883",
"0.6287883",
"0.6236184",
"0.6236184",
"0.61632013",... | 0.8391433 | 1 |
marshalStationviewsImageRefViewToImageRefResponseBody builds a value of type ImageRefResponseBody from a value of type stationviews.ImageRefView. | func marshalStationviewsImageRefViewToImageRefResponseBody(v *stationviews.ImageRefView) *ImageRefResponseBody {
res := &ImageRefResponseBody{
URL: *v.URL,
}
return res
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v *stationviews.StationPhotosView) *StationPhotosResponseBody {\n\tres := &StationPhotosResponseBody{\n\t\tSmall: *v.Small,\n\t}\n\n\treturn res\n}",
"func marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v *stationviews.StationP... | [
"0.5710117",
"0.5710117",
"0.562188",
"0.562188",
"0.56170845",
"0.54668754",
"0.54254305",
"0.5310527",
"0.5253974",
"0.5253974",
"0.52484196",
"0.5228265",
"0.5228265",
"0.5203431",
"0.5193249",
"0.5134553",
"0.5009948",
"0.49802515",
"0.49359077",
"0.4896795",
"0.4870441",... | 0.87599164 | 0 |
marshalStationviewsStationPhotosViewToStationPhotosResponseBody builds a value of type StationPhotosResponseBody from a value of type stationviews.StationPhotosView. | func marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v *stationviews.StationPhotosView) *StationPhotosResponseBody {
res := &StationPhotosResponseBody{
Small: *v.Small,
}
return res
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func marshalStationviewsStationUploadViewToStationUploadResponseBody(v *stationviews.StationUploadView) *StationUploadResponseBody {\n\tres := &StationUploadResponseBody{\n\t\tID: *v.ID,\n\t\tTime: *v.Time,\n\t\tUploadID: *v.UploadID,\n\t\tSize: *v.Size,\n\t\tURL: *v.URL,\n\t\tType: *v.Type,... | [
"0.67545545",
"0.67545545",
"0.6533975",
"0.6441267",
"0.6286384",
"0.62758756",
"0.6192921",
"0.61770695",
"0.61571497",
"0.61571497",
"0.6059185",
"0.5956797",
"0.5902529",
"0.5901378",
"0.5901378",
"0.58851147",
"0.58851147",
"0.57728416",
"0.5759278",
"0.57382584",
"0.569... | 0.87652653 | 1 |
marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody builds a value of type StationConfigurationsResponseBody from a value of type stationviews.StationConfigurationsView. | func marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v *stationviews.StationConfigurationsView) *StationConfigurationsResponseBody {
res := &StationConfigurationsResponseBody{}
if v.All != nil {
res.All = make([]*StationConfigurationResponseBody, len(v.All))
for i, val := range v.All {
res.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)
}
}
return res
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(v *stationviews.StationConfigurationView) *StationConfigurationResponseBody {\n\tres := &StationConfigurationResponseBody{\n\t\tID: *v.ID,\n\t\tTime: *v.Time,\n\t\tProvisionID: *v.ProvisionID,\n\t\tMetaRecordID: v... | [
"0.79267925",
"0.79267925",
"0.64428455",
"0.64428455",
"0.6398182",
"0.6374693",
"0.61294436",
"0.6082822",
"0.6005982",
"0.59366393",
"0.5917162",
"0.58975965",
"0.58975965",
"0.5878693",
"0.57907563",
"0.57907563",
"0.57600814",
"0.57307446",
"0.55764854",
"0.5463496",
"0.... | 0.83925474 | 1 |
marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody builds a value of type StationConfigurationResponseBody from a value of type stationviews.StationConfigurationView. | func marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(v *stationviews.StationConfigurationView) *StationConfigurationResponseBody {
res := &StationConfigurationResponseBody{
ID: *v.ID,
Time: *v.Time,
ProvisionID: *v.ProvisionID,
MetaRecordID: v.MetaRecordID,
SourceID: v.SourceID,
}
if v.Modules != nil {
res.Modules = make([]*StationModuleResponseBody, len(v.Modules))
for i, val := range v.Modules {
res.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)
}
}
return res
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v *stationviews.StationConfigurationsView) *StationConfigurationsResponseBody {\n\tres := &StationConfigurationsResponseBody{}\n\tif v.All != nil {\n\t\tres.All = make([]*StationConfigurationResponseBody, len(v.All))\n\t\tfor i, v... | [
"0.7929566",
"0.7929566",
"0.6632881",
"0.6598946",
"0.65151966",
"0.65151966",
"0.64699715",
"0.64141536",
"0.63892883",
"0.62236166",
"0.6013304",
"0.5967359",
"0.59557813",
"0.5851227",
"0.5851227",
"0.58372265",
"0.5810946",
"0.5810946",
"0.5806702",
"0.5794077",
"0.56652... | 0.8305122 | 1 |
marshalStationviewsStationModuleViewToStationModuleResponseBody builds a value of type StationModuleResponseBody from a value of type stationviews.StationModuleView. | func marshalStationviewsStationModuleViewToStationModuleResponseBody(v *stationviews.StationModuleView) *StationModuleResponseBody {
res := &StationModuleResponseBody{
ID: *v.ID,
HardwareID: v.HardwareID,
MetaRecordID: v.MetaRecordID,
Name: *v.Name,
Position: *v.Position,
Flags: *v.Flags,
Internal: *v.Internal,
}
if v.Sensors != nil {
res.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))
for i, val := range v.Sensors {
res.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)
}
}
return res
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func marshalStationviewsStationModuleViewToStationModuleResponseBody(v *stationviews.StationModuleView) *StationModuleResponseBody {\n\tres := &StationModuleResponseBody{\n\t\tID: *v.ID,\n\t\tHardwareID: v.HardwareID,\n\t\tMetaRecordID: v.MetaRecordID,\n\t\tName: *v.Name,\n\t\tPosition: *v.... | [
"0.83554304",
"0.6818048",
"0.6818048",
"0.67077595",
"0.66819704",
"0.6562386",
"0.6562386",
"0.6451712",
"0.6358552",
"0.6319762",
"0.6319762",
"0.6263527",
"0.62305576",
"0.6185767",
"0.6095236",
"0.6095236",
"0.5908875",
"0.5894631",
"0.5870397",
"0.5801066",
"0.5801066",... | 0.8360227 | 0 |
marshalStationviewsStationSensorViewToStationSensorResponseBody builds a value of type StationSensorResponseBody from a value of type stationviews.StationSensorView. | func marshalStationviewsStationSensorViewToStationSensorResponseBody(v *stationviews.StationSensorView) *StationSensorResponseBody {
res := &StationSensorResponseBody{
Name: *v.Name,
UnitOfMeasure: *v.UnitOfMeasure,
Key: *v.Key,
}
if v.Reading != nil {
res.Reading = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)
}
if v.Ranges != nil {
res.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))
for i, val := range v.Ranges {
res.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)
}
}
return res
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func marshalStationviewsStationSensorViewToStationSensorResponseBody(v *stationviews.StationSensorView) *StationSensorResponseBody {\n\tres := &StationSensorResponseBody{\n\t\tName: *v.Name,\n\t\tUnitOfMeasure: *v.UnitOfMeasure,\n\t\tKey: *v.Key,\n\t\tFullKey: *v.FullKey,\n\t}\n\tif v.Read... | [
"0.8464057",
"0.77482903",
"0.77482903",
"0.7593321",
"0.7593321",
"0.72417295",
"0.7094909",
"0.7063237",
"0.70614374",
"0.7058796",
"0.70546293",
"0.6989615",
"0.6938645",
"0.6938645",
"0.66578555",
"0.66220224",
"0.6591441",
"0.6591441",
"0.65126264",
"0.65126264",
"0.6421... | 0.8488124 | 0 |
marshalStationviewsSensorReadingViewToSensorReadingResponseBody builds a value of type SensorReadingResponseBody from a value of type stationviews.SensorReadingView. | func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {
if v == nil {
return nil
}
res := &SensorReadingResponseBody{
Last: *v.Last,
Time: *v.Time,
}
return res
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func marshalStationviewsStationSensorViewToStationSensorResponseBody(v *stationviews.StationSensorView) *StationSensorResponseBody {\n\tres := &StationSensorResponseBody{\n\t\tName: *v.Name,\n\t\tUnitOfMeasure: *v.UnitOfMeasure,\n\t\tKey: *v.Key,\n\t}\n\tif v.Reading != nil {\n\t\tres.Reading = ... | [
"0.7440589",
"0.740655",
"0.7256154",
"0.7256154",
"0.5901679",
"0.5830257",
"0.5822103",
"0.5747911",
"0.5710538",
"0.5693901",
"0.5693901",
"0.5677142",
"0.55820125",
"0.5569254",
"0.5560421",
"0.5463103",
"0.5365716",
"0.526561",
"0.526561",
"0.52458173",
"0.509053",
"0.... | 0.8653149 | 1 |
marshalStationviewsSensorRangeViewToSensorRangeResponseBody builds a value of type SensorRangeResponseBody from a value of type stationviews.SensorRangeView. | func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {
res := &SensorRangeResponseBody{
Minimum: *v.Minimum,
Maximum: *v.Maximum,
}
return res
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func marshalStationviewsStationSensorViewToStationSensorResponseBody(v *stationviews.StationSensorView) *StationSensorResponseBody {\n\tres := &StationSensorResponseBody{\n\t\tName: *v.Name,\n\t\tUnitOfMeasure: *v.UnitOfMeasure,\n\t\tKey: *v.Key,\n\t}\n\tif v.Reading != nil {\n\t\tres.Reading = ... | [
"0.7335541",
"0.7297131",
"0.723063",
"0.723063",
"0.6611768",
"0.62029546",
"0.6186779",
"0.6129653",
"0.61062557",
"0.6068134",
"0.6068134",
"0.60338056",
"0.60098934",
"0.55822134",
"0.55383575",
"0.55383575",
"0.5514945",
"0.5514945",
"0.5509171",
"0.54716146",
"0.5471614... | 0.885715 | 1 |
marshalStationviewsStationLocationViewToStationLocationResponseBody builds a value of type StationLocationResponseBody from a value of type stationviews.StationLocationView. | func marshalStationviewsStationLocationViewToStationLocationResponseBody(v *stationviews.StationLocationView) *StationLocationResponseBody {
if v == nil {
return nil
}
res := &StationLocationResponseBody{
Latitude: *v.Latitude,
Longitude: *v.Longitude,
}
return res
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func marshalStationviewsStationLocationViewToStationLocationResponseBody(v *stationviews.StationLocationView) *StationLocationResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &StationLocationResponseBody{\n\t\tURL: v.URL,\n\t}\n\tif v.Precise != nil {\n\t\tres.Precise = make([]float64, len(v.Precise)... | [
"0.85588557",
"0.7428782",
"0.74054426",
"0.7354029",
"0.73047644",
"0.7209462",
"0.7115804",
"0.7115804",
"0.70084536",
"0.68129146",
"0.6812254",
"0.6812254",
"0.67632324",
"0.67632324",
"0.6763173",
"0.6763173",
"0.6747882",
"0.6707079",
"0.6707079",
"0.66595626",
"0.66551... | 0.8745905 | 0 |
marshalStationviewsStationFullViewToStationFullResponseBody builds a value of type StationFullResponseBody from a value of type stationviews.StationFullView. | func marshalStationviewsStationFullViewToStationFullResponseBody(v *stationviews.StationFullView) *StationFullResponseBody {
res := &StationFullResponseBody{
ID: *v.ID,
Name: *v.Name,
DeviceID: *v.DeviceID,
ReadOnly: *v.ReadOnly,
Battery: v.Battery,
RecordingStartedAt: v.RecordingStartedAt,
MemoryUsed: v.MemoryUsed,
MemoryAvailable: v.MemoryAvailable,
FirmwareNumber: v.FirmwareNumber,
FirmwareTime: v.FirmwareTime,
Updated: *v.Updated,
LocationName: v.LocationName,
}
if v.Owner != nil {
res.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)
}
if v.Uploads != nil {
res.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))
for i, val := range v.Uploads {
res.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)
}
}
if v.Images != nil {
res.Images = make([]*ImageRefResponseBody, len(v.Images))
for i, val := range v.Images {
res.Images[i] = marshalStationviewsImageRefViewToImageRefResponseBody(val)
}
}
if v.Photos != nil {
res.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)
}
if v.Configurations != nil {
res.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)
}
if v.Location != nil {
res.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)
}
return res
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func marshalStationviewsStationFullViewToStationFullResponseBody(v *stationviews.StationFullView) *StationFullResponseBody {\n\tres := &StationFullResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tDeviceID: *v.DeviceID,\n\t\tReadOnly: *v.ReadOnly,\n\t\tBattery... | [
"0.82343215",
"0.719919",
"0.71669877",
"0.69968563",
"0.6944219",
"0.6878805",
"0.6855457",
"0.6723838",
"0.6723838",
"0.6684666",
"0.65740126",
"0.65740126",
"0.63861525",
"0.63389343",
"0.6303049",
"0.6303049",
"0.629614",
"0.629614",
"0.6257191",
"0.62481487",
"0.62481487... | 0.8221312 | 1 |
NewConditionCommand creates a new command handling the 'condition' subcommand. | func NewConditionCommand() *ConditionCommand {
return &ConditionCommand{}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func newCondition(conditionType mxv1.MXJobConditionType, reason, message string) mxv1.MXJobCondition {\n\treturn mxv1.MXJobCondition{\n\t\tType: conditionType,\n\t\tStatus: v1.ConditionTrue,\n\t\tLastUpdateTime: metav1.Now(),\n\t\tLastTransitionTime: metav1.Now(),\n\t\tReason: ... | [
"0.72683936",
"0.71704596",
"0.7064366",
"0.69323015",
"0.6702884",
"0.6196688",
"0.61173177",
"0.6062493",
"0.60161763",
"0.60139626",
"0.5988218",
"0.595905",
"0.5719937",
"0.5670507",
"0.5665668",
"0.5662411",
"0.5662346",
"0.5655358",
"0.5612243",
"0.55732316",
"0.5572379... | 0.8579685 | 0 |
AddFlaggySubcommand adds the 'condition' subcommand to flaggy. | func (cmd *ConditionCommand) AddFlaggySubcommand() *flaggy.Subcommand {
cmd.subcommand = flaggy.NewSubcommand("condition")
cmd.subcommand.Description = "Condition and/or convert a mGuard configuration file"
cmd.subcommand.String(&cmd.inFilePath, "", "in", "File containing the mGuard configuration to condition (ATV format or unencrypted ECS container)")
cmd.subcommand.String(&cmd.outAtvFilePath, "", "atv-out", "File receiving the conditioned configuration (ATV format, instead of stdout)")
cmd.subcommand.String(&cmd.outEcsFilePath, "", "ecs-out", "File receiving the conditioned configuration (ECS container, unencrypted, instead of stdout)")
flaggy.AttachSubcommand(cmd.subcommand, 1)
return cmd.subcommand
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (v *VersionCommand) addFlags() {\n\t// TODO: add flags here\n}",
"func (c *Command) addFlag(flag *Flag) {\n\n\tif _, exists := c.innerFlagsLong[flag.Long]; exists {\n\t\tpanic(fmt.Errorf(\"Flag '%s' already exists \", flag.Long))\n\t}\n\tif _, exists := c.innerFlagsShort[flag.Short]; exists {\n\t\tpanic(fmt... | [
"0.5085005",
"0.5046201",
"0.49352053",
"0.48599106",
"0.47996205",
"0.4761986",
"0.47334093",
"0.47165725",
"0.47063375",
"0.47000897",
"0.46403655",
"0.46390265",
"0.4614507",
"0.45984703",
"0.45956972",
"0.45921105",
"0.45843956",
"0.45605075",
"0.45556092",
"0.4542845",
"... | 0.8378941 | 0 |
IsSubcommandUsed checks whether the 'condition' subcommand was used in the command line. | func (cmd *ConditionCommand) IsSubcommandUsed() bool {
return cmd.subcommand.Used
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (rc *ResourceCommand) IsDeleteSubcommand(cmd string) bool {\n\treturn cmd == rc.deleteCmd.FullCommand()\n}",
"func (pkg *goPackage) isCommand() bool {\n\treturn pkg.name == \"main\" && pkg.hasMainFunction\n}",
"func (p pkgInfo) IsCommand() bool { return p.Name == \"main\" }",
"func (ctx *docContext) sub... | [
"0.58130366",
"0.58011234",
"0.571592",
"0.5641225",
"0.55149096",
"0.5470646",
"0.5406413",
"0.53510106",
"0.53318286",
"0.5233015",
"0.520792",
"0.52058667",
"0.51337",
"0.50368905",
"0.50120246",
"0.50021106",
"0.49626616",
"0.49274504",
"0.49263328",
"0.49248016",
"0.4906... | 0.83998907 | 0 |
ValidateArguments checks whether the specified arguments for the 'condition' subcommand are valid. | func (cmd *ConditionCommand) ValidateArguments() error {
// ensure that the specified files exist and are readable
files := []string{cmd.inFilePath}
for _, path := range files {
if len(path) > 0 {
file, err := os.Open(path)
if err != nil {
return err
}
file.Close()
}
}
return nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func validateArguments(args ...string) error {\n\tif args == nil {\n\t\treturn errors.New(\"No command line args were specified\")\n\t}\n\tfor _, arg := range args {\n\t\tif arg == \"\" {\n\t\t\treturn errors.New(\"Unspecified required command line args\")\n\t\t}\n\t}\n\treturn nil\n}",
"func (Interface *LineInt... | [
"0.69566584",
"0.6955487",
"0.6763374",
"0.64712137",
"0.6297658",
"0.61843216",
"0.6181135",
"0.6172308",
"0.6144291",
"0.6111207",
"0.60935056",
"0.6031443",
"0.60160357",
"0.5930268",
"0.5868009",
"0.5867526",
"0.5858788",
"0.58458865",
"0.57952464",
"0.5782529",
"0.576538... | 0.7897152 | 0 |
ExecuteCommand performs the actual work of the 'condition' subcommand. | func (cmd *ConditionCommand) ExecuteCommand() error {
fileWritten := false
// load configuration file (can be ATV or ECS)
// (the configuration is always loaded into an ECS container, missing parts are filled with defaults)
ecs, err := loadConfigurationFile(cmd.inFilePath)
if err != nil {
return err
}
// write ATV file, if requested
if len(cmd.outAtvFilePath) > 0 {
fileWritten = true
log.Infof("Writing ATV file (%s)...", cmd.outAtvFilePath)
err := ecs.Atv.ToFile(cmd.outAtvFilePath)
if err != nil {
log.Errorf("Writing ATV file (%s) failed: %s", cmd.outAtvFilePath, err)
return err
}
}
// write ECS file, if requested
if len(cmd.outEcsFilePath) > 0 {
fileWritten = true
log.Infof("Writing ECS file (%s)...", cmd.outEcsFilePath)
err := ecs.ToFile(cmd.outEcsFilePath)
if err != nil {
log.Errorf("Writing ECS file (%s) failed: %s", cmd.outEcsFilePath, err)
return err
}
}
// write the ECS container to stdout, if no output file was specified
if !fileWritten {
log.Info("Writing ECS file to stdout...")
buffer := bytes.Buffer{}
err := ecs.ToWriter(&buffer)
if err != nil {
return err
}
os.Stdout.Write(buffer.Bytes())
}
return nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (cmd *ConditionsCmd) Execute(ctx context.Context, t time.Time, vars mathexp.Vars, tracer tracing.Tracer) (mathexp.Results, error) {\n\tctx, span := tracer.Start(ctx, \"SSE.ExecuteClassicConditions\")\n\tdefer span.End()\n\t// isFiring and isNoData contains the outcome of ConditionsCmd, and is derived from the... | [
"0.634297",
"0.61321396",
"0.6075748",
"0.6045505",
"0.60234475",
"0.596352",
"0.5943047",
"0.59015226",
"0.5860501",
"0.5855821",
"0.58335024",
"0.5781249",
"0.5773364",
"0.5767565",
"0.5694752",
"0.5688377",
"0.5669264",
"0.56521475",
"0.56482255",
"0.5628145",
"0.562734",
... | 0.6584883 | 0 |
Deletes all versions of the bot, including the $LATEST version. To delete a specific version of the bot, use the DeleteBotVersion operation. The DeleteBot operation doesn't immediately remove the bot schema. Instead, it is marked for deletion and removed later. Amazon Lex stores utterances indefinitely for improving the ability of your bot to respond to user inputs. These utterances are not removed when the bot is deleted. To remove the utterances, use the DeleteUtterances operation. If a bot has an alias, you can't delete it. Instead, the DeleteBot operation returns a ResourceInUseException exception that includes a reference to the alias that refers to the bot. To remove the reference to the bot, delete the alias. If you get the same exception again, delete the referring alias until the DeleteBot operation is successful. This operation requires permissions for the lex:DeleteBot action. | func (c *Client) DeleteBot(ctx context.Context, params *DeleteBotInput, optFns ...func(*Options)) (*DeleteBotOutput, error) {
if params == nil {
params = &DeleteBotInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteBot", params, optFns, addOperationDeleteBotMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteBotOutput)
out.ResultMetadata = metadata
return out, nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (repo *Repository) DeleteBot(id uuid.UUID) error {\n\tif id == uuid.Nil {\n\t\treturn repository.ErrNilID\n\t}\n\terr := repo.db.Transaction(func(tx *gorm.DB) error {\n\t\tvar b model.Bot\n\t\tif err := tx.First(&b, &model.Bot{ID: id}).Error; err != nil {\n\t\t\treturn convertError(err)\n\t\t}\n\n\t\tif err :... | [
"0.65976274",
"0.65339947",
"0.64393353",
"0.63932616",
"0.56210196",
"0.5169227",
"0.5087304",
"0.5024266",
"0.501262",
"0.493083",
"0.47869998",
"0.47574976",
"0.47252163",
"0.4684215",
"0.46626377",
"0.46585312",
"0.46446675",
"0.46379286",
"0.4633604",
"0.4618223",
"0.459... | 0.6199181 | 4 |
Validate validates this template update request | func (m *TemplateUpdateRequest) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateEnv(formats); err != nil {
res = append(res, err)
}
if err := m.validateLabels(formats); err != nil {
res = append(res, err)
}
if err := m.validateRepository(formats); err != nil {
res = append(res, err)
}
if err := m.validateVolumes(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (m *IoArgoprojWorkflowV1alpha1WorkflowTemplateUpdateRequest) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateTemplate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}",... | [
"0.6670242",
"0.6601898",
"0.63977146",
"0.6357023",
"0.63419235",
"0.63405234",
"0.62611276",
"0.61464405",
"0.6097062",
"0.60839",
"0.6053177",
"0.6013759",
"0.60061485",
"0.5997903",
"0.5971497",
"0.59678847",
"0.594513",
"0.5940418",
"0.5910533",
"0.59026706",
"0.588803",... | 0.7443678 | 0 |
waitWorkflows waits for the given workflowNames. | func waitWorkflows(ctx context.Context, serviceClient workflowpkg.WorkflowServiceClient, namespace string, workflowNames []string, ignoreNotFound, quiet bool) {
var wg sync.WaitGroup
wfSuccessStatus := true
for _, name := range workflowNames {
wg.Add(1)
go func(name string) {
if !waitOnOne(serviceClient, ctx, name, namespace, ignoreNotFound, quiet) {
wfSuccessStatus = false
}
wg.Done()
}(name)
}
wg.Wait()
if !wfSuccessStatus {
os.Exit(1)
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (t *Indie) waitModules() {\n for _, m := range t.modules {\n\tim := reflect.ValueOf(m).FieldByName(\"Module\").Interface()\n\tt.moduleWgs[im.(Module).Name].Wait()\n }\n}",
"func (c *Group) Wait(ctx context.Context, cancel context.CancelFunc, name string, depends []string) {\n\tlog := log.WithField(\"n... | [
"0.5350951",
"0.52752584",
"0.5198128",
"0.51444983",
"0.5046067",
"0.49930897",
"0.49835825",
"0.4955429",
"0.49228916",
"0.49221534",
"0.48998037",
"0.48998037",
"0.4894847",
"0.48859778",
"0.4879877",
"0.4867281",
"0.4863396",
"0.47744468",
"0.47719476",
"0.47673807",
"0.4... | 0.8439736 | 0 |
NewEapAkaService creates new Aka Service 'object' | func NewEapAkaService(config *mconfig.EapAkaConfig) (*EapAkaSrv, error) {
service := &EapAkaSrv{
sessions: map[string]*SessionCtx{},
plmnFilter: plmn_filter.PlmnIdVals{},
timeouts: defaultTimeouts,
mncLen: 3,
}
if config != nil {
if config.Timeout != nil {
if config.Timeout.ChallengeMs > 0 {
service.SetChallengeTimeout(time.Millisecond * time.Duration(config.Timeout.ChallengeMs))
}
if config.Timeout.ErrorNotificationMs > 0 {
service.SetNotificationTimeout(time.Millisecond * time.Duration(config.Timeout.ErrorNotificationMs))
}
if config.Timeout.SessionMs > 0 {
service.SetSessionTimeout(time.Millisecond * time.Duration(config.Timeout.SessionMs))
}
if config.Timeout.SessionAuthenticatedMs > 0 {
service.SetSessionAuthenticatedTimeout(
time.Millisecond * time.Duration(config.Timeout.SessionAuthenticatedMs))
}
}
service.plmnFilter = plmn_filter.GetPlmnVals(config.PlmnIds, "EAP-AKA")
service.useS6a = config.GetUseS6A()
if mncLn := config.GetMncLen(); mncLn >= 2 && mncLn <= 3 {
service.mncLen = mncLn
}
}
if useS6aStr, isset := os.LookupEnv("USE_S6A_BASED_AUTH"); isset {
service.useS6a, _ = strconv.ParseBool(useS6aStr)
}
if service.useS6a {
glog.Info("EAP-AKA: Using S6a Auth Vectors")
} else {
glog.Info("EAP-AKA: Using SWx Auth Vectors")
}
return service, nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func NewASService(sys systems.System, graph *graph.Graph, uuid string) *ASService {\n\tas := &ASService{\n\t\tGraph: graph,\n\t\tSourceType: requests.RIR,\n\t\tsys: sys,\n\t\tuuid: uuid,\n\t}\n\n\tas.BaseService = *requests.NewBaseService(as, \"AS Service\")\n\treturn as\n}",
"func New(c *conf.... | [
"0.61470634",
"0.6038688",
"0.6002176",
"0.59682864",
"0.58913106",
"0.5850981",
"0.5850981",
"0.5850981",
"0.5832147",
"0.5831827",
"0.5808951",
"0.58016384",
"0.5799585",
"0.5767169",
"0.575998",
"0.57473075",
"0.5741536",
"0.5740318",
"0.5734751",
"0.5711769",
"0.56736296"... | 0.7001705 | 0 |
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")
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (s *ProcessStat) SetPidFilter(filter PidFilterFunc) {\n\treturn\n}",
"func (s *EapAkaSrv) CheckPlmnId(imsi aka.IMSI) bool {\n\treturn s == nil || s.plmnFilter.Check(string(imsi))\n}",
"func (ps *GetProcedureState) SetFilter(filter.Filter) error {\n\t// Doesn't make sense on this kind of RPC.\n\treturn err... | [
"0.57200986",
"0.559907",
"0.5290566",
"0.519468",
"0.49780253",
"0.489195",
"0.48811746",
"0.48624626",
"0.4859342",
"0.48210987",
"0.47929743",
"0.47318727",
"0.47024506",
"0.46667773",
"0.46664366",
"0.46662915",
"0.46565035",
"0.4656434",
"0.46366328",
"0.4624582",
"0.460... | 0.79534346 | 0 |
CheckPlmnId returns true either if there is no PLMN ID filters (allowlist) configured or one the configured PLMN IDs matches passed IMSI | func (s *EapAkaSrv) CheckPlmnId(imsi aka.IMSI) bool {
return s == nil || s.plmnFilter.Check(string(imsi))
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (s *EapAkaSrv) SetPlmnIdFilter(plmnIds []string) {\n\ts.plmnFilter = plmn_filter.GetPlmnVals(plmnIds, \"EAP-AKA\")\n}",
"func (me TartIdTypeInt) IsPmcid() bool { return me.String() == \"pmcid\" }",
"func (i *IE) MustPLMNID() string {\n\tv, _ := i.PLMNID()\n\treturn v\n}",
"func (me TArtIdTypeUnion3) IsP... | [
"0.64834213",
"0.5616486",
"0.5394938",
"0.52985555",
"0.52068204",
"0.5148656",
"0.504526",
"0.5014757",
"0.50134444",
"0.4990817",
"0.49025",
"0.47761554",
"0.4749059",
"0.4724844",
"0.46497986",
"0.46490914",
"0.4642265",
"0.46205363",
"0.46194157",
"0.45924497",
"0.459228... | 0.823722 | 0 |
Unlock unlocks the CTX | func (lockedCtx *UserCtx) Unlock() {
if !lockedCtx.locked {
panic("Expected locked")
}
lockedCtx.locked = false
lockedCtx.mu.Unlock()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (_TokensNetwork *TokensNetworkTransactor) Unlock(opts *bind.TransactOpts, token common.Address, partner common.Address, transferred_amount *big.Int, expiration *big.Int, amount *big.Int, secret_hash [32]byte, merkle_proof []byte) (*types.Transaction, error) {\n\treturn _TokensNetwork.contract.Transact(opts, \... | [
"0.7185481",
"0.7055959",
"0.7029302",
"0.6924748",
"0.6901803",
"0.68980896",
"0.6896289",
"0.68911386",
"0.68834275",
"0.6857641",
"0.68049335",
"0.6765065",
"0.6761098",
"0.674067",
"0.67110366",
"0.6708135",
"0.66451514",
"0.66304946",
"0.66158307",
"0.66073924",
"0.66005... | 0.6811269 | 10 |
State returns current CTX state (CTX must be locked) | func (lockedCtx *UserCtx) State() (aka.AkaState, time.Time) {
if !lockedCtx.locked {
panic("Expected locked")
}
return lockedCtx.state, lockedCtx.stateTime
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (rc *Ctx) State() State {\n\treturn rc.state\n}",
"func (c *Context) State() *iavl.MutableTree {\n\tif c.IsCheckOnly() {\n\t\treturn c.state.CheckTxTree()\n\t}\n\treturn c.state.DeliverTxTree()\n}",
"func (ec EncryptedStateContext) State() state.State {\n\ts, _ := StateWithTransientKey(ec)\n\treturn s\n}"... | [
"0.7147441",
"0.65303206",
"0.6431976",
"0.63715243",
"0.6202507",
"0.6197028",
"0.612181",
"0.6096198",
"0.6090189",
"0.6013719",
"0.60101694",
"0.59735763",
"0.5963581",
"0.59595084",
"0.59267133",
"0.5912954",
"0.5911973",
"0.5903378",
"0.5867452",
"0.5819508",
"0.57825685... | 0.6247537 | 4 |
SetState updates current CTX state (CTX must be locked) | func (lockedCtx *UserCtx) SetState(s aka.AkaState) {
if !lockedCtx.locked {
panic("Expected locked")
}
lockedCtx.state, lockedCtx.stateTime = s, time.Now()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (m *DeviceManagementIntentDeviceState) SetState(value *ComplianceStatus)() {\n err := m.GetBackingStore().Set(\"state\", value)\n if err != nil {\n panic(err)\n }\n}",
"func (c *chain) SetState(state byte) {\n\tc.Lock() // -- lock\n\tc.JobChain.State = state\n\tc.Unlock() // -- unlock\n}",
... | [
"0.6003809",
"0.5992078",
"0.5975987",
"0.5948236",
"0.59028906",
"0.5882176",
"0.5874046",
"0.5862913",
"0.5844034",
"0.5829832",
"0.5812291",
"0.5800521",
"0.57959443",
"0.5795212",
"0.56880075",
"0.56199056",
"0.5613332",
"0.55894333",
"0.5572669",
"0.5570468",
"0.55618954... | 0.64960307 | 0 |
CreatedTime returns time of CTX creation | func (lockedCtx *UserCtx) CreatedTime() time.Time {
return lockedCtx.created
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o GraphOutput) CreatedTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Graph) pulumi.StringOutput { return v.CreatedTime }).(pulumi.StringOutput)\n}",
"func (o CertificateOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Certificate) pulumi.StringOutput { return v.CreateTime }).(... | [
"0.6872978",
"0.68453634",
"0.6819361",
"0.67331624",
"0.6719479",
"0.67010635",
"0.66973794",
"0.66631514",
"0.6651749",
"0.64922756",
"0.6472436",
"0.6460779",
"0.6418325",
"0.640913",
"0.6399703",
"0.6398547",
"0.6391757",
"0.63899314",
"0.6389118",
"0.6387396",
"0.6371877... | 0.7036663 | 0 |
Lifetime returns duration in seconds of the CTX existence | func (lockedCtx *UserCtx) Lifetime() float64 {
return time.Since(lockedCtx.created).Seconds()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (spec *Spec) Lifespan() time.Duration {\n\tt := spec.expiry.CA\n\tif t.After(spec.expiry.Cert) {\n\t\tt = spec.expiry.Cert\n\t}\n\treturn time.Now().Sub(t)\n}",
"func (spec *Spec) Lifespan() time.Duration {\n\tt := spec.expiry.CA\n\tif t.After(spec.expiry.Cert) {\n\t\tt = spec.expiry.Cert\n\t}\n\treturn tim... | [
"0.6601062",
"0.6601062",
"0.63060784",
"0.62399536",
"0.60517216",
"0.57772434",
"0.56856906",
"0.5665979",
"0.5503332",
"0.54266614",
"0.53134584",
"0.53076315",
"0.52908784",
"0.52809376",
"0.52794564",
"0.52794564",
"0.5268618",
"0.5253966",
"0.51437384",
"0.5131252",
"0.... | 0.66991234 | 0 |
InitSession either creates new or updates existing session & user ctx, it session ID into the CTX and initializes session map as well as users map Returns Locked User Ctx | func (s *EapAkaSrv) InitSession(sessionId string, imsi aka.IMSI) (lockedUserContext *UserCtx) {
var (
oldSessionTimer *time.Timer
oldSessionState aka.AkaState
)
// create new session with long session wide timeout
t := time.Now()
newSession := &SessionCtx{UserCtx: &UserCtx{
created: t, Imsi: imsi, state: aka.StateCreated, stateTime: t, locked: true, SessionId: sessionId}}
newSession.mu.Lock()
newSession.CleanupTimer = time.AfterFunc(s.SessionTimeout(), func() {
sessionTimeoutCleanup(s, sessionId, newSession)
})
uc := newSession.UserCtx
s.rwl.Lock()
if oldSession, ok := s.sessions[sessionId]; ok && oldSession != nil {
oldSessionTimer, oldSession.CleanupTimer = oldSession.CleanupTimer, nil
oldSessionState = oldSession.state
}
s.sessions[sessionId] = newSession
s.rwl.Unlock()
if oldSessionTimer != nil {
oldSessionTimer.Stop()
// Copy Redirected state to a new session to avoid auth thrashing between EAP methods
if oldSessionState == aka.StateRedirected {
newSession.state = aka.StateRedirected
}
}
return uc
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (u *user) InitSession(w http.ResponseWriter) (*session, error) {\n return InitSession(u, w)\n}",
"func (pdr *ProviderMySQL) SessionInit(lifetime int64, savePath string) error {\n\tpdr.lifetime = lifetime\n\tpdr.savePath = savePath\n\n\tc := pdr.connectInit()\n\t_, err := c.Exec(sqlInit)\n\tif err == nil ... | [
"0.6673753",
"0.6342095",
"0.63009894",
"0.6219338",
"0.60704154",
"0.59516037",
"0.5896988",
"0.5864814",
"0.58537745",
"0.58083045",
"0.5756945",
"0.5742521",
"0.57377404",
"0.5717782",
"0.56990904",
"0.56253517",
"0.5577891",
"0.54831004",
"0.5409166",
"0.5407248",
"0.5347... | 0.725223 | 0 |
UpdateSessionUnlockCtx sets session ID into the CTX and initializes session map & session timeout | func (s *EapAkaSrv) UpdateSessionUnlockCtx(lockedCtx *UserCtx, timeout time.Duration) {
if !lockedCtx.locked {
panic("Expected locked")
}
var (
oldSession, newSession *SessionCtx
exist bool
oldTimer *time.Timer
)
newSession = &SessionCtx{UserCtx: lockedCtx}
sessionId := lockedCtx.SessionId
lockedCtx.Unlock()
newSession.CleanupTimer = time.AfterFunc(timeout, func() {
sessionTimeoutCleanup(s, sessionId, newSession)
})
s.rwl.Lock()
oldSession, exist = s.sessions[sessionId]
s.sessions[sessionId] = newSession
if exist && oldSession != nil {
oldSession.UserCtx = nil
if oldSession.CleanupTimer != nil {
oldTimer, oldSession.CleanupTimer = oldSession.CleanupTimer, nil
}
}
s.rwl.Unlock()
if oldTimer != nil {
oldTimer.Stop()
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Unlock(c *template.Context) {\n\tid := c.ID()\n\tsession := c.Session()\n\tinstanceID := session.InstanceID()\n\n\t// Lock the mutex.\n\tlockMutex.Lock()\n\tdefer lockMutex.Unlock()\n\n\t// Check if locked by another session.\n\tlocked, err := dbIsLockedByAnotherValue(id, instanceID)\n\tif err != nil {\n\t\tl... | [
"0.6124807",
"0.5579189",
"0.53562164",
"0.51611096",
"0.5113783",
"0.5080367",
"0.5053628",
"0.5023063",
"0.4981352",
"0.49599132",
"0.49047497",
"0.48844445",
"0.48335624",
"0.4824681",
"0.48047826",
"0.47778115",
"0.47006798",
"0.46524185",
"0.46501467",
"0.46501407",
"0.4... | 0.79232544 | 0 |
UpdateSessionTimeout finds a session with specified ID, if found cancels its current timeout & schedules the new one. Returns true if the session was found | func (s *EapAkaSrv) UpdateSessionTimeout(sessionId string, timeout time.Duration) bool {
var (
newSession *SessionCtx
exist bool
oldTimer *time.Timer
)
s.rwl.Lock()
oldSession, exist := s.sessions[sessionId]
if exist {
if oldSession == nil {
exist = false
} else {
oldTimer, oldSession.CleanupTimer = oldSession.CleanupTimer, nil
newSession, oldSession.UserCtx = &SessionCtx{UserCtx: oldSession.UserCtx}, nil
s.sessions[sessionId] = newSession
newSession.CleanupTimer = time.AfterFunc(timeout, func() {
sessionTimeoutCleanup(s, sessionId, newSession)
})
}
}
s.rwl.Unlock()
if oldTimer != nil {
oldTimer.Stop()
}
return exist
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (s *StorageFile) timelyUpdateSessionTTL(ctx context.Context) {\n\tvar (\n\t\tsessionId string\n\t\terr error\n\t)\n\t// Batch updating sessions.\n\tfor {\n\t\tif sessionId = s.updatingIdSet.Pop(); sessionId == \"\" {\n\t\t\tbreak\n\t\t}\n\t\tif err = s.updateSessionTTl(context.TODO(), sessionId); err !=... | [
"0.590478",
"0.5846154",
"0.5822859",
"0.55828995",
"0.55501956",
"0.5531755",
"0.5486655",
"0.54707235",
"0.54651594",
"0.53818125",
"0.53278106",
"0.53221035",
"0.53189105",
"0.53084713",
"0.5301515",
"0.5296813",
"0.52742577",
"0.520852",
"0.5203438",
"0.51893806",
"0.5120... | 0.8070543 | 0 |
FindSession finds and returns IMSI of a session and a flag indication if the find succeeded If found, FindSession tries to stop outstanding session timer | func (s *EapAkaSrv) FindSession(sessionId string) (aka.IMSI, *UserCtx, bool) {
var (
imsi aka.IMSI
lockedCtx *UserCtx
timer *time.Timer
)
s.rwl.RLock()
sessionCtx, exist := s.sessions[sessionId]
if exist && sessionCtx != nil {
lockedCtx, timer, sessionCtx.CleanupTimer = sessionCtx.UserCtx, sessionCtx.CleanupTimer, nil
}
s.rwl.RUnlock()
if lockedCtx != nil {
lockedCtx.mu.Lock()
lockedCtx.SessionId = sessionId // just in case - should always match
imsi = lockedCtx.Imsi
lockedCtx.locked = true
}
if timer != nil {
timer.Stop()
}
return imsi, lockedCtx, exist
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (s *EapAkaSrv) FindAndRemoveSession(sessionId string) (aka.IMSI, bool) {\n\tvar (\n\t\timsi aka.IMSI\n\t\ttimer *time.Timer\n\t)\n\ts.rwl.Lock()\n\tsessionCtx, exist := s.sessions[sessionId]\n\tif exist {\n\t\tdelete(s.sessions, sessionId)\n\t\tif sessionCtx != nil {\n\t\t\timsi, timer, sessionCtx.CleanupTim... | [
"0.7254616",
"0.6846313",
"0.6621632",
"0.6552327",
"0.64377207",
"0.6285583",
"0.6137219",
"0.5868021",
"0.5810617",
"0.5786772",
"0.5630467",
"0.5614597",
"0.55915153",
"0.5550527",
"0.55471504",
"0.552155",
"0.55161715",
"0.5433876",
"0.54217637",
"0.53998345",
"0.53921324... | 0.7702459 | 0 |
RemoveSession removes session ID from the session map and attempts to cancel corresponding timer It also removes associated with the session user CTX if any returns associated with the session IMSI or an empty string | func (s *EapAkaSrv) RemoveSession(sessionId string) aka.IMSI {
var (
timer *time.Timer
imsi aka.IMSI
)
s.rwl.Lock()
sessionCtx, exist := s.sessions[sessionId]
if exist {
delete(s.sessions, sessionId)
if sessionCtx != nil {
imsi, timer, sessionCtx.CleanupTimer, sessionCtx.UserCtx =
sessionCtx.Imsi, sessionCtx.CleanupTimer, nil, nil
}
}
s.rwl.Unlock()
if timer != nil {
timer.Stop()
}
return imsi
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func RemoveSession(ctxid int64) {\n\tdelete(sessionBuf, ctxid)\n}",
"func (ctx *MqttSrvContext) RemoveSession(fd int) {\n\tctx.Clock.Lock()\n\tdelete(ctx.Connections, fd)\n\tctx.Clock.Unlock()\n}",
"func removeSession(sessionId string) error {\n\treturn rd.Del(\"session:\" + sessionId).Err()\n}",
"func (s *S... | [
"0.7640993",
"0.72319806",
"0.69733834",
"0.67995864",
"0.67262423",
"0.6637747",
"0.6589637",
"0.65702194",
"0.65565586",
"0.6548312",
"0.65208083",
"0.6506277",
"0.6452618",
"0.6353034",
"0.63186055",
"0.62973",
"0.6182048",
"0.61454064",
"0.6118734",
"0.61146694",
"0.61078... | 0.74100566 | 1 |
FindAndRemoveSession finds returns IMSI of a session and a flag indication if the find succeeded then it deletes the session ID from the map | func (s *EapAkaSrv) FindAndRemoveSession(sessionId string) (aka.IMSI, bool) {
var (
imsi aka.IMSI
timer *time.Timer
)
s.rwl.Lock()
sessionCtx, exist := s.sessions[sessionId]
if exist {
delete(s.sessions, sessionId)
if sessionCtx != nil {
imsi, timer, sessionCtx.CleanupTimer = sessionCtx.Imsi, sessionCtx.CleanupTimer, nil
}
}
s.rwl.Unlock()
if timer != nil {
timer.Stop()
}
return imsi, exist
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func removeSession(sessionId string) error {\n\treturn rd.Del(\"session:\" + sessionId).Err()\n}",
"func (s *EapAkaSrv) RemoveSession(sessionId string) aka.IMSI {\n\tvar (\n\t\ttimer *time.Timer\n\t\timsi aka.IMSI\n\t)\n\ts.rwl.Lock()\n\tsessionCtx, exist := s.sessions[sessionId]\n\tif exist {\n\t\tdelete(s.ses... | [
"0.6337527",
"0.63338506",
"0.62588054",
"0.619622",
"0.6001309",
"0.5987242",
"0.5862569",
"0.5854259",
"0.5793999",
"0.56286055",
"0.5623648",
"0.5599282",
"0.55727345",
"0.5529919",
"0.54763377",
"0.54709643",
"0.54298604",
"0.5349649",
"0.5334001",
"0.53175026",
"0.527777... | 0.7856674 | 0 |
ResetSessionTimeout finds a session with specified ID, if found attempts to cancel its current timeout (best effort) & schedules the new one. ResetSessionTimeout does not guarantee that the old timeout cleanup won't be executed | func (s *EapAkaSrv) ResetSessionTimeout(sessionId string, newTimeout time.Duration) {
var oldTimer *time.Timer
s.rwl.Lock()
session, exist := s.sessions[sessionId]
if exist {
if session != nil {
oldTimer, session.CleanupTimer = session.CleanupTimer, time.AfterFunc(newTimeout, func() {
sessionTimeoutCleanup(s, sessionId, session)
})
}
}
s.rwl.Unlock()
if oldTimer != nil {
oldTimer.Stop()
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (s *EapAkaSrv) UpdateSessionTimeout(sessionId string, timeout time.Duration) bool {\n\tvar (\n\t\tnewSession *SessionCtx\n\t\texist bool\n\t\toldTimer *time.Timer\n\t)\n\n\ts.rwl.Lock()\n\n\toldSession, exist := s.sessions[sessionId]\n\tif exist {\n\t\tif oldSession == nil {\n\t\t\texist = false\n\t\t}... | [
"0.58303523",
"0.57536286",
"0.57250553",
"0.56678575",
"0.5598923",
"0.5391376",
"0.52549744",
"0.5215387",
"0.52134204",
"0.51514316",
"0.5144149",
"0.505107",
"0.5010351",
"0.5007257",
"0.49984995",
"0.4982687",
"0.49728602",
"0.49500403",
"0.49310362",
"0.4928805",
"0.490... | 0.76363075 | 0 |
get action from any message which indicates what action is contained any message. return empty action if no action exist. | func (a AnyMessage) Action() Action {
if action, ok := a[KeyAction].(string); ok {
return Action(action)
}
return ActionEmpty
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (m *Message) Action() (*Action, error) {\n\tif err := m.checkType(ActionName); err != nil {\n\t\treturn nil, err\n\t}\n\tif m.Raw == false {\n\t\treturn m.Payload.(*Action), nil\n\t}\n\tobj := new(Action)\n\treturn obj, m.unmarshalPayload(obj)\n}",
"func toAction(actionInput string) (GameAction, error) {\n\... | [
"0.7306286",
"0.6702612",
"0.6634531",
"0.6624134",
"0.6582352",
"0.6437621",
"0.6424266",
"0.6422195",
"0.64076334",
"0.63615376",
"0.63188815",
"0.6217176",
"0.62162405",
"0.621624",
"0.62057364",
"0.61373276",
"0.6136337",
"0.61342955",
"0.61080563",
"0.6103804",
"0.608375... | 0.79127395 | 0 |
Convert AnyMessage to ActionMessage specified by AnyMessage.Action(). it returns error if AnyMessage has invalid data structure. | func ConvertAnyMessage(m AnyMessage) (ActionMessage, error) {
a := m.Action()
switch a {
// TODO support other Actions?
case ActionChatMessage:
return ParseChatMessage(m, a)
case ActionReadMessage:
return ParseReadMessage(m, a)
case ActionTypeStart:
return ParseTypeStart(m, a)
case ActionTypeEnd:
return ParseTypeEnd(m, a)
case ActionEmpty:
return m, errors.New("JSON object must have any action field")
}
return m, errors.New("unknown action: " + string(a))
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (a AnyMessage) Action() Action {\n\tif action, ok := a[KeyAction].(string); ok {\n\t\treturn Action(action)\n\t}\n\treturn ActionEmpty\n}",
"func (m *Message) Action() (*Action, error) {\n\tif err := m.checkType(ActionName); err != nil {\n\t\treturn nil, err\n\t}\n\tif m.Raw == false {\n\t\treturn m.Payload... | [
"0.70134044",
"0.6835206",
"0.6056837",
"0.60446316",
"0.59741914",
"0.5868112",
"0.57563007",
"0.57476586",
"0.569913",
"0.569567",
"0.5512062",
"0.5507776",
"0.53972507",
"0.5392704",
"0.5351618",
"0.5318276",
"0.52789843",
"0.52739334",
"0.524337",
"0.5192377",
"0.5179015"... | 0.81843996 | 0 |
helper function for parsing fields from AnyMessage. it will load Action from AnyMessage. | func (ef *EmbdFields) ParseFields(m AnyMessage) {
ef.ActionName = m.Action()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (fields *ChatActionFields) ParseFields(m AnyMessage) {\n\tfields.SenderID = uint64(m.Number(KeySenderID))\n\tfields.RoomID = uint64(m.Number(KeyRoomID))\n}",
"func ConvertAnyMessage(m AnyMessage) (ActionMessage, error) {\n\ta := m.Action()\n\tswitch a {\n\t// TODO support other Actions?\n\tcase ActionChatMe... | [
"0.721038",
"0.66078293",
"0.61688745",
"0.6119968",
"0.6072742",
"0.56536376",
"0.5598536",
"0.55259776",
"0.5487838",
"0.5465469",
"0.5444849",
"0.54407734",
"0.543",
"0.54041195",
"0.5370182",
"0.52989274",
"0.52649045",
"0.52343386",
"0.52060467",
"0.5167481",
"0.5152807"... | 0.69517875 | 1 |
helper function for parsing fields from AnyMessage. it will load RoomID and SenderID from AnyMessage. | func (fields *ChatActionFields) ParseFields(m AnyMessage) {
fields.SenderID = uint64(m.Number(KeySenderID))
fields.RoomID = uint64(m.Number(KeyRoomID))
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (msg *Message) ParseJSON(jsonMsg string) (*ParsedMsg, error) {\n\n\tbuf := bytes.NewBufferString(jsonMsg)\n\tfieldValArr := make([]fieldIdValue, 0, 10)\n\tjson.NewDecoder(buf).Decode(&fieldValArr)\n\n\tparsedMsg := &ParsedMsg{Msg: msg, FieldDataMap: make(map[int]*FieldData, 64)}\n\n\tisoBitmap := NewBitmap()\... | [
"0.5732198",
"0.5615825",
"0.5560655",
"0.55319726",
"0.55295855",
"0.5437243",
"0.5435778",
"0.54100525",
"0.5396397",
"0.53879786",
"0.5384482",
"0.53580153",
"0.5340863",
"0.5336776",
"0.5333828",
"0.532637",
"0.532536",
"0.53194845",
"0.531128",
"0.52851146",
"0.52660626"... | 0.68852764 | 0 |
NewQuoteGuestCartManagementV1AssignCustomerPutParams creates a new QuoteGuestCartManagementV1AssignCustomerPutParams object with the default values initialized. | func NewQuoteGuestCartManagementV1AssignCustomerPutParams() *QuoteGuestCartManagementV1AssignCustomerPutParams {
var ()
return &QuoteGuestCartManagementV1AssignCustomerPutParams{
timeout: cr.DefaultTimeout,
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithHTTPClient(client *http.Client) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\t\tHTTPClient: client,\n\t}\n}",
"func (o *QuoteGuestCartManagementV1AssignCustomerPutParams)... | [
"0.8271312",
"0.8212005",
"0.81320083",
"0.80844975",
"0.80062515",
"0.78691715",
"0.7789836",
"0.73155636",
"0.658854",
"0.64574057",
"0.595355",
"0.55138165",
"0.52931875",
"0.5288777",
"0.52370054",
"0.5205202",
"0.5196566",
"0.51082456",
"0.509685",
"0.49528384",
"0.49185... | 0.8667148 | 0 |
NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithTimeout creates a new QuoteGuestCartManagementV1AssignCustomerPutParams object with the default values initialized, and the ability to set a timeout on a request | func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {
var ()
return &QuoteGuestCartManagementV1AssignCustomerPutParams{
timeout: timeout,
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}",
"func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}"... | [
"0.8308475",
"0.7844152",
"0.64982295",
"0.6484297",
"0.6472054",
"0.64103794",
"0.6351184",
"0.6185913",
"0.6100963",
"0.5953824",
"0.5914043",
"0.5832217",
"0.5831452",
"0.5819997",
"0.57956785",
"0.5782647",
"0.5732313",
"0.57064855",
"0.57015955",
"0.57010484",
"0.5680807... | 0.8071971 | 1 |
NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithContext creates a new QuoteGuestCartManagementV1AssignCustomerPutParams object with the default values initialized, and the ability to set a context for a request | func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithContext(ctx context.Context) *QuoteGuestCartManagementV1AssignCustomerPutParams {
var ()
return &QuoteGuestCartManagementV1AssignCustomerPutParams{
Context: ctx,
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithContext(ctx context.Context) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetContext(ctx)\n\treturn o\n}",
"func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithHTTPClient(client *http.Client) *QuoteGuestCartManagementV1AssignCu... | [
"0.84626555",
"0.7730534",
"0.7684058",
"0.7454402",
"0.73755527",
"0.72856575",
"0.7250639",
"0.70582944",
"0.67311746",
"0.62402433",
"0.5935744",
"0.5764697",
"0.56237066",
"0.5479995",
"0.5446139",
"0.5336354",
"0.5306805",
"0.52093464",
"0.5190296",
"0.5190265",
"0.51823... | 0.8617059 | 0 |
NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithHTTPClient creates a new QuoteGuestCartManagementV1AssignCustomerPutParams object with the default values initialized, and the ability to set a custom HTTPClient for a request | func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithHTTPClient(client *http.Client) *QuoteGuestCartManagementV1AssignCustomerPutParams {
var ()
return &QuoteGuestCartManagementV1AssignCustomerPutParams{
HTTPClient: client,
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithHTTPClient(client *http.Client) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetHTTPClient(client)\n\treturn o\n}",
"func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = clie... | [
"0.8513652",
"0.81031305",
"0.72409236",
"0.70588464",
"0.69723165",
"0.68660784",
"0.6790791",
"0.6651792",
"0.6373096",
"0.63201773",
"0.62964815",
"0.62787026",
"0.6195781",
"0.6168339",
"0.6166511",
"0.61507803",
"0.6125819",
"0.60925746",
"0.6074109",
"0.60631275",
"0.60... | 0.7728503 | 2 |
WithTimeout adds the timeout to the quote guest cart management v1 assign customer put params | func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {
o.SetTimeout(timeout)
return o
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}",
"func (o *SetCartDeliveryModeUsingPUTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}",
"func (o *CreateCartUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.... | [
"0.6829775",
"0.64693916",
"0.616726",
"0.61298734",
"0.594674",
"0.5878005",
"0.585383",
"0.5846034",
"0.5801529",
"0.57892454",
"0.57431126",
"0.573466",
"0.5728525",
"0.56704754",
"0.5668898",
"0.5667617",
"0.56619924",
"0.5659144",
"0.5654781",
"0.5643625",
"0.564211",
... | 0.6422215 | 2 |
SetTimeout adds the timeout to the quote guest cart management v1 assign customer put params | func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *SetCartDeliveryModeUsingPUTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}",
"func (o *CreateCartUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}",
"func (o *PutProductsNameParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}",
"fu... | [
"0.72756255",
"0.7254339",
"0.6779402",
"0.67691255",
"0.67433965",
"0.6708501",
"0.6699051",
"0.66786355",
"0.66050214",
"0.6596965",
"0.65847635",
"0.6580533",
"0.65378034",
"0.65235615",
"0.64906514",
"0.6463794",
"0.6426044",
"0.6417624",
"0.6417241",
"0.6416271",
"0.6386... | 0.76016694 | 0 |
WithContext adds the context to the quote guest cart management v1 assign customer put params | func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithContext(ctx context.Context) *QuoteGuestCartManagementV1AssignCustomerPutParams {
o.SetContext(ctx)
return o
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}",
"func (o *SetCartDeliveryModeUsingPUTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}",
"func (o *PcloudIkepoliciesPutParams) SetContext(ctx context.Context) {\n\to.Context = ctx... | [
"0.57075393",
"0.56914246",
"0.5689175",
"0.55723166",
"0.5500067",
"0.54969674",
"0.5491649",
"0.5440946",
"0.54405046",
"0.54174834",
"0.54154426",
"0.53923774",
"0.53557456",
"0.53391117",
"0.53319114",
"0.5324435",
"0.5280288",
"0.5259861",
"0.5259854",
"0.52506113",
"0.5... | 0.5314429 | 16 |
SetContext adds the context to the quote guest cart management v1 assign customer put params | func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetContext(ctx context.Context) {
o.Context = ctx
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *CreateCartUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}",
"func (o *SetCartDeliveryModeUsingPUTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}",
"func (o *PcloudIkepoliciesPutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}",
"func (o *PutZon... | [
"0.6986311",
"0.6969701",
"0.6717224",
"0.667957",
"0.6608536",
"0.66020656",
"0.65851",
"0.65797526",
"0.6578861",
"0.65604377",
"0.65416586",
"0.64897275",
"0.64867085",
"0.64796966",
"0.64749956",
"0.6470742",
"0.6439428",
"0.64364356",
"0.6436191",
"0.64267135",
"0.642141... | 0.68196744 | 2 |
WithHTTPClient adds the HTTPClient to the quote guest cart management v1 assign customer put params | func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithHTTPClient(client *http.Client) *QuoteGuestCartManagementV1AssignCustomerPutParams {
o.SetHTTPClient(client)
return o
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}",
"func (o *SetCartDeliveryModeUsingPUTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}",
"func (o *CreateCartUsingPOSTParams) SetHTTPClient(client *http.Client) ... | [
"0.7077226",
"0.66339505",
"0.65746665",
"0.6393634",
"0.62742",
"0.61785537",
"0.61474353",
"0.6115478",
"0.6045528",
"0.60193396",
"0.60184395",
"0.5996956",
"0.5995192",
"0.5985374",
"0.59766406",
"0.5973581",
"0.5956146",
"0.59388703",
"0.59338367",
"0.59119785",
"0.59053... | 0.6473373 | 3 |
SetHTTPClient adds the HTTPClient to the quote guest cart management v1 assign customer put params | func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *CreateCartUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}",
"func (o *SetCartDeliveryModeUsingPUTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}",
"func (o *PostMeOvhAccountOvhAccountIDCreditOrderParams) SetHTTPClient(client *http.Client) {\n\... | [
"0.75690985",
"0.7511163",
"0.7243452",
"0.7083306",
"0.70585614",
"0.7011144",
"0.6986666",
"0.6983883",
"0.6934678",
"0.68749857",
"0.6869865",
"0.68646127",
"0.6858665",
"0.68520796",
"0.6839419",
"0.6837287",
"0.6833316",
"0.6827454",
"0.68238574",
"0.68182",
"0.68156874"... | 0.7740232 | 0 |
WithCartID adds the cartID to the quote guest cart management v1 assign customer put params | func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithCartID(cartID string) *QuoteGuestCartManagementV1AssignCustomerPutParams {
o.SetCartID(cartID)
return o
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *SetCartDeliveryModeUsingPUTParams) SetCartID(cartID string) {\n\to.CartID = cartID\n}",
"func (rest *RestApi) AddToCart(w http.ResponseWriter, r *http.Request, cart_id int64, item_id int64, quantity int64) {\n\n //@ TODO: Need to check for quantity and increment if necessary\n\n cart := rest.GoCart.Ge... | [
"0.61889285",
"0.60286504",
"0.5991168",
"0.5863901",
"0.5663869",
"0.5638338",
"0.54036796",
"0.53961825",
"0.5374433",
"0.52748066",
"0.5155923",
"0.5137047",
"0.51303124",
"0.51193875",
"0.5099927",
"0.50851536",
"0.5062641",
"0.49733937",
"0.4964736",
"0.49112463",
"0.491... | 0.5655872 | 5 |
SetCartID adds the cartId to the quote guest cart management v1 assign customer put params | func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetCartID(cartID string) {
o.CartID = cartID
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *SetCartDeliveryModeUsingPUTParams) SetCartID(cartID string) {\n\to.CartID = cartID\n}",
"func (o *GiftRegistryGuestCartShippingMethodManagementV1EstimateByRegistryIDPostParams) SetCartID(cartID string) {\n\to.CartID = cartID\n}",
"func (o *GiftMessageCartRepositoryV1SavePostParams) SetCartID(cartID in... | [
"0.710232",
"0.67913324",
"0.65997845",
"0.6211936",
"0.6137255",
"0.589663",
"0.5799431",
"0.5666723",
"0.5520935",
"0.540718",
"0.53189194",
"0.5302974",
"0.5285084",
"0.5256895",
"0.5231408",
"0.51802826",
"0.5172562",
"0.5133916",
"0.5086106",
"0.5070612",
"0.50324833",
... | 0.7222028 | 0 |
WithQuoteGuestCartManagementV1AssignCustomerPutBody adds the quoteGuestCartManagementV1AssignCustomerPutBody to the quote guest cart management v1 assign customer put params | func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithQuoteGuestCartManagementV1AssignCustomerPutBody(quoteGuestCartManagementV1AssignCustomerPutBody QuoteGuestCartManagementV1AssignCustomerPutBody) *QuoteGuestCartManagementV1AssignCustomerPutParams {
o.SetQuoteGuestCartManagementV1AssignCustomerPutBody(quoteGuestCartManagementV1AssignCustomerPutBody)
return o
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetQuoteGuestCartManagementV1AssignCustomerPutBody(quoteGuestCartManagementV1AssignCustomerPutBody QuoteGuestCartManagementV1AssignCustomerPutBody) {\n\to.QuoteGuestCartManagementV1AssignCustomerPutBody = quoteGuestCartManagementV1AssignCustomerPutBody\n}... | [
"0.83188844",
"0.78648466",
"0.7808166",
"0.7786088",
"0.7418378",
"0.72102064",
"0.71473825",
"0.63939446",
"0.63911986",
"0.59236753",
"0.57973975",
"0.5784694",
"0.53359973",
"0.5009722",
"0.49715364",
"0.4923072",
"0.48311046",
"0.47148082",
"0.46766508",
"0.45992535",
"0... | 0.82086074 | 1 |
SetQuoteGuestCartManagementV1AssignCustomerPutBody adds the quoteGuestCartManagementV1AssignCustomerPutBody to the quote guest cart management v1 assign customer put params | func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetQuoteGuestCartManagementV1AssignCustomerPutBody(quoteGuestCartManagementV1AssignCustomerPutBody QuoteGuestCartManagementV1AssignCustomerPutBody) {
o.QuoteGuestCartManagementV1AssignCustomerPutBody = quoteGuestCartManagementV1AssignCustomerPutBody
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithQuoteGuestCartManagementV1AssignCustomerPutBody(quoteGuestCartManagementV1AssignCustomerPutBody QuoteGuestCartManagementV1AssignCustomerPutBody) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetQuoteGuestCartManagementV1AssignCustomerPutBo... | [
"0.7935019",
"0.7369236",
"0.7369034",
"0.73177856",
"0.71789163",
"0.6868604",
"0.6855011",
"0.6253293",
"0.6198186",
"0.56966126",
"0.5541722",
"0.55134857",
"0.51450586",
"0.48024026",
"0.47238445",
"0.47156468",
"0.46833786",
"0.45996368",
"0.4514864",
"0.4514249",
"0.445... | 0.8210044 | 0 |
WriteToRequest writes these params to a swagger request | func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param cartId
if err := r.SetPathParam("cartId", o.CartID); err != nil {
return err
}
if err := r.SetBodyParam(o.QuoteGuestCartManagementV1AssignCustomerPutBody); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *FileInfoCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.ByteOffset != nil {\n\n\t\t// query param byte_offset\n\t\tvar qrByteOffset int64\n\n\t\tif o.ByteOffset != nil ... | [
"0.7198161",
"0.714435",
"0.70471495",
"0.7021836",
"0.69967365",
"0.69959503",
"0.6979433",
"0.6979074",
"0.69695425",
"0.6966308",
"0.69242847",
"0.6908102",
"0.69045216",
"0.6871055",
"0.68575305",
"0.68564737",
"0.6851862",
"0.6845359",
"0.6844677",
"0.684266",
"0.6830004... | 0.0 | -1 |
NewGeoLoc returns a new GeoLoc instance with the provided raw text | func NewGeoLoc(raw string) *GeoLoc {
return &GeoLoc{
Located: false,
Raw: raw,
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func NewLocation(text []byte, file string, row int, col int) *Location {\n\treturn location.NewLocation(text, file, row, col)\n}",
"func New(text string) error {\n\t// 没有取地址\n\treturn errorString(text)\n}",
"func NewUnlocatedGeoLoc(row *sql.Rows) (*GeoLoc, error) {\n\tloc := NewGeoLoc(\"\")\n\n\t// Parse\n\tif... | [
"0.6227741",
"0.6078744",
"0.5860529",
"0.5812811",
"0.58090365",
"0.5706036",
"0.5616656",
"0.54913384",
"0.5468475",
"0.54424673",
"0.54342973",
"0.54342973",
"0.54342973",
"0.5432191",
"0.5413864",
"0.54108983",
"0.50926495",
"0.5087199",
"0.49937034",
"0.49905518",
"0.497... | 0.75141335 | 0 |
NewUnlocatedGeoLoc creates a new GeoLoc instance from the currently selected result set in the provided sql.Rows object. This row should select the id and raw fields, in that order. An error will be returned if one occurs, nil on success. | func NewUnlocatedGeoLoc(row *sql.Rows) (*GeoLoc, error) {
loc := NewGeoLoc("")
// Parse
if err := row.Scan(&loc.ID, &loc.Raw); err != nil {
return nil, fmt.Errorf("error reading field values from row: %s",
err.Error())
}
// Success
return loc, nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func QueryUnlocatedGeoLocs() ([]*GeoLoc, error) {\n\tlocs := []*GeoLoc{}\n\n\t// Get db\n\tdb, err := dstore.NewDB()\n\tif err != nil {\n\t\treturn locs, fmt.Errorf(\"error retrieving database instance: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// Query\n\trows, err := db.Query(\"SELECT id, raw FROM geo_locs WHERE locat... | [
"0.59157485",
"0.5336436",
"0.5211899",
"0.50560826",
"0.49862352",
"0.49316272",
"0.48971105",
"0.47262537",
"0.4703283",
"0.46925646",
"0.4594549",
"0.44713196",
"0.44316882",
"0.44048014",
"0.4374621",
"0.43661842",
"0.4361967",
"0.4358638",
"0.4303174",
"0.42946663",
"0.4... | 0.82017237 | 0 |
Query attempts to find a GeoLoc model in the db with the same raw field value. If a model is found, the GeoLoc.ID field is set. Additionally an error is returned if one occurs. sql.ErrNoRows is returned if no GeoLocs were found. Or nil on success. | func (l *GeoLoc) Query() error {
// Get db instance
db, err := dstore.NewDB()
if err != nil {
return fmt.Errorf("error retrieving db instance: %s",
err.Error())
}
// Query
row := db.QueryRow("SELECT id FROM geo_locs WHERE raw = $1", l.Raw)
// Get ID
err = row.Scan(&l.ID)
// Check if row found
if err == sql.ErrNoRows {
// If not, return so we can identify
return err
} else if err != nil {
return fmt.Errorf("error reading GeoLoc ID from row: %s",
err.Error())
}
// Success
return nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (l GeoLoc) Update() error {\n\t// Get database instance\n\tdb, err := dstore.NewDB()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error retrieving database instance: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// Update\n\tvar row *sql.Row\n\n\t// If not located\n\tif !l.Located {\n\t\trow = db.QueryRow(\"UPDATE geo_l... | [
"0.6223622",
"0.5493927",
"0.54255736",
"0.52941716",
"0.52561975",
"0.5246454",
"0.5050418",
"0.5036265",
"0.4995013",
"0.48237905",
"0.48174006",
"0.4817126",
"0.4746114",
"0.47449532",
"0.474389",
"0.4711235",
"0.47075084",
"0.4678469",
"0.46382043",
"0.4630092",
"0.461380... | 0.7522025 | 0 |
Update sets an existing GeoLoc model's fields to new values. Only updates the located and raw fields if located == false. Updates all fields if located == true. It relies on the raw field to specify exactly which row to update. The row column has a unique constraint, so this is sufficient. An error is returned if one occurs, or nil on success. | func (l GeoLoc) Update() error {
// Get database instance
db, err := dstore.NewDB()
if err != nil {
return fmt.Errorf("error retrieving database instance: %s",
err.Error())
}
// Update
var row *sql.Row
// If not located
if !l.Located {
row = db.QueryRow("UPDATE geo_locs SET located = $1, raw = "+
"$2 WHERE raw = $2 RETURNING id", l.Located, l.Raw)
} else {
// Check accuracy value
if l.Accuracy == AccuracyErr {
return fmt.Errorf("invalid accuracy value: %s",
l.Accuracy)
}
// If located
row = db.QueryRow("UPDATE geo_locs SET located = $1, "+
"gapi_success = $2, lat = $3, long = $4, "+
"postal_addr = $5, accuracy = $6, bounds_provided = $7,"+
"bounds_id = $8, viewport_bounds_id = $9, "+
"gapi_place_id = $10, raw = $11 WHERE raw = $11 "+
"RETURNING id",
l.Located, l.GAPISuccess, l.Lat, l.Long, l.PostalAddr,
l.Accuracy, l.BoundsProvided, l.BoundsID,
l.ViewportBoundsID, l.GAPIPlaceID, l.Raw)
}
// Set ID
err = row.Scan(&l.ID)
// If doesn't exist
if err == sql.ErrNoRows {
// Return error so we can identify
return err
} else if err != nil {
// Other error
return fmt.Errorf("error updating GeoLoc, located: %t, err: %s",
l.Located, err.Error())
}
// Success
return nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (t LocationTable) Update(\n\tdb DBi,\n\trow *Location,\n) (\n\terr error,\n) {\n\n\t// Validate DatasetID.\n\tif err := validate.UUID(row.DatasetID); err != nil {\n\t\te := err.(errors.Error)\n\t\treturn e.Wrap(\"Validation failed on DatasetID.\")\n\t}\n\n\t// Sanitize LocationHash.\n\trow.LocationHash = sani... | [
"0.69641566",
"0.5843393",
"0.5823278",
"0.57759196",
"0.5748108",
"0.5735965",
"0.5600091",
"0.55859834",
"0.5548732",
"0.55268645",
"0.54857534",
"0.5463487",
"0.5463487",
"0.5463487",
"0.5463487",
"0.5463487",
"0.54631627",
"0.543054",
"0.5415033",
"0.54086083",
"0.5393353... | 0.7047339 | 0 |
QueryUnlocatedGeoLocs finds all GeoLoc models which have not been located on a map. Additionally an error is returned if one occurs, or nil on success. | func QueryUnlocatedGeoLocs() ([]*GeoLoc, error) {
locs := []*GeoLoc{}
// Get db
db, err := dstore.NewDB()
if err != nil {
return locs, fmt.Errorf("error retrieving database instance: %s",
err.Error())
}
// Query
rows, err := db.Query("SELECT id, raw FROM geo_locs WHERE located = " +
"false")
// Check if no results
if err == sql.ErrNoRows {
// If not results, return raw error so we can identify
return locs, err
} else if err != nil {
// Other error
return locs, fmt.Errorf("error querying for unlocated GeoLocs"+
": %s", err.Error())
}
// Parse rows into GeoLocs
for rows.Next() {
// Parse
loc, err := NewUnlocatedGeoLoc(rows)
if err != nil {
return locs, fmt.Errorf("error creating unlocated "+
"GeoLoc from row: %s", err.Error())
}
// Add to list
locs = append(locs, loc)
}
// Close
if err = rows.Close(); err != nil {
return locs, fmt.Errorf("error closing query: %s",
err.Error())
}
// Success
return locs, nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func NewUnlocatedGeoLoc(row *sql.Rows) (*GeoLoc, error) {\n\tloc := NewGeoLoc(\"\")\n\n\t// Parse\n\tif err := row.Scan(&loc.ID, &loc.Raw); err != nil {\n\t\treturn nil, fmt.Errorf(\"error reading field values from row: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// Success\n\treturn loc, nil\n}",
"func TestSuccessfulEm... | [
"0.55134904",
"0.54020214",
"0.515502",
"0.5036286",
"0.4825174",
"0.47992843",
"0.4780045",
"0.4779698",
"0.47294635",
"0.47174343",
"0.47147113",
"0.47013465",
"0.47011906",
"0.46199933",
"0.46156716",
"0.46126723",
"0.4552904",
"0.44921848",
"0.4490148",
"0.4471601",
"0.44... | 0.7892602 | 0 |
Insert adds a GeoLoc model to the database. An error is returned if one occurs, or nil on success. | func (l *GeoLoc) Insert() error {
// Get db instance
db, err := dstore.NewDB()
if err != nil {
return fmt.Errorf("error retrieving DB instance: %s",
err.Error())
}
// Insert
var row *sql.Row
// Check if GeoLoc has been parsed
if l.Located {
// Check accuracy value
if l.Accuracy == AccuracyErr {
return fmt.Errorf("invalid accuracy value: %s",
l.Accuracy)
}
// If so, save all fields
row = db.QueryRow("INSERT INTO geo_locs (located, gapi_success"+
", lat, long, postal_addr, accuracy, bounds_provided, "+
"bounds_id, viewport_bounds_id, gapi_place_id, raw) "+
"VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) "+
"RETURNING id",
l.Located, l.GAPISuccess, l.Lat, l.Long, l.PostalAddr,
l.Accuracy, l.BoundsProvided, l.BoundsID,
l.ViewportBoundsID, l.GAPIPlaceID, l.Raw)
} else {
// If not, only save a couple, and leave rest null
row = db.QueryRow("INSERT INTO geo_locs (located, raw) VALUES"+
" ($1, $2) RETURNING id",
l.Located, l.Raw)
}
// Get inserted row ID
err = row.Scan(&l.ID)
if err != nil {
return fmt.Errorf("error inserting row, Located: %t, err: %s",
l.Located, err.Error())
}
return nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (t LocationTable) Insert(\n\tdb DBi,\n\trow *Location,\n) (\n\terr error,\n) {\n\n\t// Validate DatasetID.\n\tif err := validate.UUID(row.DatasetID); err != nil {\n\t\te := err.(errors.Error)\n\t\treturn e.Wrap(\"Validation failed on DatasetID.\")\n\t}\n\n\t// Sanitize LocationHash.\n\trow.LocationHash = sani... | [
"0.69885266",
"0.5882191",
"0.5621426",
"0.5596069",
"0.5553327",
"0.5551301",
"0.54937685",
"0.54937685",
"0.54937685",
"0.54937685",
"0.54937685",
"0.54937685",
"0.5431328",
"0.540485",
"0.5371866",
"0.5328154",
"0.53042734",
"0.53042734",
"0.5283517",
"0.52814525",
"0.5280... | 0.78647643 | 0 |
NewMetrics create Metrics object | func NewMetrics(ns string) *Metrics {
res := &Metrics{
Info: promauto.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: ns,
Name: "info",
Help: "Informations about given repository, value always 1",
},
[]string{"module", "goversion"},
),
Deprecated: promauto.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: ns,
Name: "deprecated",
Help: "Number of days since given dependency of repository is out-of-date",
},
[]string{"module", "dependency", "type", "current", "latest"},
),
Replaced: promauto.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: ns,
Name: "replaced",
Help: "Give information about module replacements",
},
[]string{"module", "dependency", "type", "replacement", "version"},
),
Status: promauto.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: ns,
Name: "status",
Help: "Status of last analysis of given repository, 0 for error",
},
[]string{"repository"},
),
Duration: promauto.NewGauge(
prometheus.GaugeOpts{
Namespace: ns,
Name: "duration",
Help: "Duration of last analysis in second",
},
),
Registry: prometheus.NewRegistry(),
}
res.Registry.Register(res.Info)
res.Registry.Register(res.Deprecated)
res.Registry.Register(res.Replaced)
res.Registry.Register(res.Status)
res.Registry.Register(res.Duration)
return res
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func newMetrics() *metrics {\n\treturn new(metrics)\n}",
"func newMetrics() *Metrics {\n\treturn newMetricsFrom(DefaultMetricsOpts)\n}",
"func NewMetrics() *Metrics {\n\treturn &Metrics{items: make(map[string]*metric), rm: &sync.RWMutex{}}\n}",
"func NewMetrics() *Metrics {\n\tm := &Metrics{}\n\tm.Reset()\n\... | [
"0.8229114",
"0.8016538",
"0.7956319",
"0.7895081",
"0.78177565",
"0.7546552",
"0.7465832",
"0.74350107",
"0.73876256",
"0.73668575",
"0.7337993",
"0.7335995",
"0.7312208",
"0.72944885",
"0.72908497",
"0.7266318",
"0.725366",
"0.7248347",
"0.72324055",
"0.7194813",
"0.719366"... | 0.69571036 | 31 |
mock mutex support for Go 1.7 and earlier. | func setMutexProfileFraction(int) int { return 0 } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func patchEventMutex(ctx interface{}) (patched bool, err error) {\n\t// EnterCriticalSection on windows already allows for reentry into a critical section if called by the same thread\n\t// see remarks @ https://msdn.microsoft.com/en-us/library/windows/desktop/ms682608(v=vs.85).aspx\n\treturn true, nil\n}",
"fun... | [
"0.6459703",
"0.63822156",
"0.6371957",
"0.5926324",
"0.5910077",
"0.58782953",
"0.58689934",
"0.58222044",
"0.5741713",
"0.5683231",
"0.5679415",
"0.56418216",
"0.5627808",
"0.55988866",
"0.556453",
"0.556237",
"0.5556391",
"0.5552865",
"0.55521744",
"0.554189",
"0.5495211",... | 0.55945843 | 14 |
toLowerCase converts an input string to lowercase. | func toLowerCase(str string) string {
var strBuilder strings.Builder
var r rune
var ch string // Holds the character to add to the builder
for _, c := range str {
if 'A' <= c && c <= 'Z' {
r = c - 'A' + 'a'
ch = string(r)
} else {
ch = string(c)
}
strBuilder.WriteString(ch)
}
lowerStr := strBuilder.String()
return lowerStr
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func toLower(s string) string {\n\treturn strings.ToLower(s)\n}",
"func ToLower(str string) string {\n\treturn strings.ToLower(str)\n}",
"func ToLower(s string) string {\n\treturn strings.ToLower(s)\n}",
"func Lowercase(text string) string {\n\treturn strings.ToLower(text)\n}",
"func Strtolower(str string)... | [
"0.7333438",
"0.73026705",
"0.7161251",
"0.70986915",
"0.69935274",
"0.6992477",
"0.69621044",
"0.69469404",
"0.69237006",
"0.68729323",
"0.6843177",
"0.68292844",
"0.6786077",
"0.6780762",
"0.67669696",
"0.6654898",
"0.66274905",
"0.66196287",
"0.6590607",
"0.65576565",
"0.6... | 0.71665114 | 2 |
/ String manipulation Contains uses strings.Contains to check if substr is part of operand. | func Contains(substr, operand string) bool { return strings.Contains(operand, substr) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Contains(s string, substr string) bool {\n\treturn Index(s, substr) >= 0\n}",
"func Contains(str, substr string) bool {\n\treturn strings.Contains(str, substr)\n}",
"func Contains(s, substr string) bool {\n\tif len(substr) > len(s) {\n\t\treturn false\n\t}\n\t//an important note to observe below is that\n... | [
"0.7734591",
"0.7639095",
"0.74030083",
"0.73435307",
"0.728108",
"0.69459176",
"0.6784282",
"0.67821175",
"0.6773672",
"0.66800475",
"0.6583",
"0.6565879",
"0.6552564",
"0.65313345",
"0.6531156",
"0.6528213",
"0.65215325",
"0.64642537",
"0.63816553",
"0.6294091",
"0.62346405... | 0.8894528 | 0 |
ContainsAny uses strings.Contains to check if any of chars are part of operand. | func ContainsAny(chars, operand string) bool { return strings.ContainsAny(operand, chars) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func ContainsAny(chars string) MatchFunc {\n\treturn func(s string) bool { return strings.ContainsAny(s, chars) }\n}",
"func IndexAny(chars, operand string) int { return strings.IndexAny(operand, chars) }",
"func ContainsAny(str string, search ...string) bool {\n\tfor _, s := range search {\n\t\tif Contains(st... | [
"0.7545216",
"0.7263658",
"0.7151522",
"0.7112452",
"0.69225824",
"0.68905026",
"0.66387177",
"0.65721256",
"0.6562606",
"0.655559",
"0.6528168",
"0.64703906",
"0.6359264",
"0.62938815",
"0.628716",
"0.6238486",
"0.6234945",
"0.6203807",
"0.60848397",
"0.605712",
"0.6017286",... | 0.91182613 | 0 |
Count uses strings.Count to return the number of occurrences of str in operand. | func Count(str, operand string) int { return strings.Count(operand, str) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Count(str, substr string) int {\n\treturn strings.Count(str, substr)\n}",
"func Count(s, substr string) int {\n\treturn strings.Count(s, substr)\n}",
"func Count(str string, pattern string) int {\n\treturn xstrings.Count(str, pattern)\n}",
"func countDemo(a string, b string) int {\n\treturn strings.Coun... | [
"0.71832395",
"0.71819305",
"0.703466",
"0.7004045",
"0.67922014",
"0.6695712",
"0.66445243",
"0.6510346",
"0.6444496",
"0.6398221",
"0.6398221",
"0.629469",
"0.6245025",
"0.61216193",
"0.61167806",
"0.6110321",
"0.607898",
"0.6077375",
"0.5980308",
"0.5967659",
"0.59222937",... | 0.93025225 | 0 |
Fields uses strings.Fields to split operand on whitespace. | func Fields(operand string) []string { return strings.Fields(operand) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Fields(s string) []string {\n\treturn FieldsFunc(s, unicode.IsSpace)\n}",
"func operatorsField(str string) []string {\n\tstr = strings.ReplaceAll(str, \",\", \" \")\n\tpieces := strings.Fields(str)\n\tvar data []string\n\tfor _, v := range pieces {\n\t\tv = strings.TrimSpace(v)\n\t\tif v == \"\" {\n\t\t\tco... | [
"0.7598404",
"0.7531711",
"0.698739",
"0.6846432",
"0.66979027",
"0.6444274",
"0.64436215",
"0.6290289",
"0.6247574",
"0.6144007",
"0.61336064",
"0.6097396",
"0.60650676",
"0.5913654",
"0.5848643",
"0.5825609",
"0.573312",
"0.5722987",
"0.5714336",
"0.5673726",
"0.5667681",
... | 0.8390608 | 0 |
HasPrefix uses strings.HasPrefix to check if operand begins with prefix. | func HasPrefix(prefix, operand string) bool { return strings.HasPrefix(operand, prefix) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func hasPrefixDemo(a string, b string) bool {\n\treturn strings.HasPrefix(a, b)\n}",
"func StringHasPrefix(column string, prefix string, opts ...Option) *sql.Predicate {\n\treturn sql.P(func(b *sql.Builder) {\n\t\topts = append([]Option{Unquote(true)}, opts...)\n\t\tvaluePath(b, column, opts...)\n\t\tb.Join(sql.... | [
"0.7603212",
"0.7505219",
"0.7400224",
"0.7363716",
"0.7314256",
"0.72126406",
"0.7208676",
"0.71902686",
"0.71692646",
"0.71619916",
"0.71601486",
"0.71523356",
"0.71055824",
"0.71042764",
"0.71023166",
"0.71011543",
"0.70899475",
"0.7069966",
"0.70568204",
"0.7051944",
"0.7... | 0.87035435 | 0 |
HasSuffix uses strings.HasSuffix to check if operand ends with suffix. | func HasSuffix(suffix, operand string) bool { return strings.HasSuffix(operand, suffix) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func HasSuffix(s, suffix string) bool {\n\treturn len(s) >= len(suffix) && s[len(s)-len(suffix):] == suffix\n}",
"func HasSuffix(s, suffix string) bool {\n\treturn len(s) >= len(suffix) && s[len(s)-len(suffix):] == suffix\n}",
"func HasSuffix(s, suffix string) bool {\n\treturn len(s) >= len(suffix) && s[len(s)... | [
"0.82601887",
"0.82601887",
"0.82601887",
"0.8214367",
"0.8041907",
"0.80391157",
"0.8025807",
"0.7868168",
"0.780619",
"0.7671214",
"0.7566552",
"0.74054986",
"0.7344222",
"0.7336952",
"0.73317635",
"0.73306614",
"0.722524",
"0.71375334",
"0.71012694",
"0.7084334",
"0.707417... | 0.9276586 | 0 |
Index uses strings.Index to return the first index of substr in operand, or 1 if missing. | func Index(substr, operand string) int { return strings.Index(operand, substr) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func IndexString(a, b string) int",
"func getIndexPosition(str, substr string) int {\n\treturn strings.Index(str, substr)\n}",
"func StrAt(slice []string, val string) int {\n\tfor i, v := range slice {\n\t\tif v == val {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}",
"func (s *Stringish) Index(str string) int... | [
"0.73520285",
"0.73272145",
"0.7166056",
"0.71561986",
"0.71288574",
"0.69740033",
"0.6831085",
"0.67836225",
"0.67083985",
"0.66809803",
"0.6678759",
"0.66644704",
"0.66149276",
"0.65898013",
"0.6556691",
"0.651724",
"0.6514263",
"0.65015745",
"0.64674556",
"0.6464212",
"0.6... | 0.8583527 | 0 |
IndexAny uses strings.IndexAny to return the first index of any of chars in operand, or 1 if missing. | func IndexAny(chars, operand string) int { return strings.IndexAny(operand, chars) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func LastIndexAny(chars, operand string) int { return strings.LastIndexAny(operand, chars) }",
"func ContainsAny(chars, operand string) bool { return strings.ContainsAny(operand, chars) }",
"func Index(substr, operand string) int { return strings.Index(operand, substr) }",
"func AnyString(f func(string, int)... | [
"0.69393414",
"0.6644878",
"0.64181566",
"0.5829267",
"0.56882197",
"0.55065894",
"0.5501036",
"0.54394406",
"0.543438",
"0.5419748",
"0.5414054",
"0.5388696",
"0.5316827",
"0.5282786",
"0.52459556",
"0.5180572",
"0.51777834",
"0.51617616",
"0.5148281",
"0.51285195",
"0.51226... | 0.88512903 | 0 |
Join uses strings.Join to return the strings of operand joined by sep. | func Join(sep string, operand []string) string { return strings.Join(operand, sep) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Join(s []string, sep string) string {\n\tvar buf string\n\tfor _, v := range s[:len(s)-1] {\n\t\tbuf += fmt.Sprintf(\"%s%s\", v, sep)\n\t}\n\n\tbuf += s[len(s)-1]\n\treturn buf\n}",
"func (o Operator) Join(arr []string) string {\n\tvar str string\n\n\tswitch o {\n\tcase \"/\":\n\t\tfor i, v := range arr {\n... | [
"0.75256044",
"0.7464866",
"0.7403909",
"0.73688066",
"0.73642904",
"0.73564166",
"0.73480386",
"0.72646767",
"0.7261114",
"0.7052616",
"0.7008814",
"0.69522",
"0.69255215",
"0.68691003",
"0.6817845",
"0.678124",
"0.65978837",
"0.65551805",
"0.65517575",
"0.6542567",
"0.65397... | 0.91498774 | 0 |
LastIndex uses strings.LastIndex to return the last index of substr in operand, or 1 if missing. | func LastIndex(substr, operand string) int { return strings.LastIndex(operand, substr) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (s *Stringish) LastIndex(str string) int {\n\treturn strings.LastIndex(s.str, str)\n}",
"func StringLastIndex(a, b string) int { return strings.LastIndex(a, b) }",
"func LastIndexAny(chars, operand string) int { return strings.LastIndexAny(operand, chars) }",
"func LastIndex(key string) string {\n\tretu... | [
"0.8398408",
"0.83730054",
"0.8142364",
"0.75816685",
"0.73591405",
"0.73086655",
"0.72300553",
"0.6950303",
"0.68696654",
"0.67634326",
"0.6762888",
"0.6762888",
"0.6762888",
"0.6762888",
"0.6762888",
"0.6762888",
"0.6762888",
"0.6762888",
"0.66598845",
"0.6653371",
"0.66308... | 0.9296216 | 0 |
LastIndexAny uses strings.LastIndexAny to return the last index of any of chars in operand, or 1 if missing. | func LastIndexAny(chars, operand string) int { return strings.LastIndexAny(operand, chars) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func LastIndex(substr, operand string) int { return strings.LastIndex(operand, substr) }",
"func IndexAny(chars, operand string) int { return strings.IndexAny(operand, chars) }",
"func StringLastIndex(a, b string) int { return strings.LastIndex(a, b) }",
"func (s *Stringish) LastIndex(str string) int {\n\tre... | [
"0.7610299",
"0.72958726",
"0.6467064",
"0.63660413",
"0.61417466",
"0.60164464",
"0.59652597",
"0.5837598",
"0.5624682",
"0.56208855",
"0.56088233",
"0.55904293",
"0.55823475",
"0.55682796",
"0.5548754",
"0.5548754",
"0.5548754",
"0.5548754",
"0.5548754",
"0.5548754",
"0.554... | 0.9139015 | 0 |
Lines splits operand into a slice of lines with the endofline terminators removed. | func Lines(operand string) (lines []string, err error) {
// TODO: Give thought to eliminating error return
reader := strings.NewReader(operand)
scanner := bufio.NewScanner(reader)
for scanner.Scan() {
lines = append(lines, scanner.Text())
}
err = scanner.Err()
return
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func splitLines(lines [][]byte, data []byte) [][]byte {\n\tvar pos int\n\tvar last byte\n\tfor i, c := range data {\n\t\tif c == '\\n' {\n\t\t\tif last == '\\r' {\n\t\t\t\tpos++\n\t\t\t} else {\n\t\t\t\tlines = append(lines, data[pos:i])\n\t\t\t\tpos = i + 1\n\t\t\t}\n\t\t} else if c == '\\r' {\n\t\t\tlines = appe... | [
"0.6628435",
"0.6419755",
"0.6304556",
"0.6199387",
"0.61809397",
"0.617573",
"0.6140952",
"0.6126556",
"0.6081247",
"0.607789",
"0.5910736",
"0.5885097",
"0.58525497",
"0.5797187",
"0.5774801",
"0.5747812",
"0.56992",
"0.56926507",
"0.56178313",
"0.56178313",
"0.5616947",
... | 0.7189804 | 0 |
Quote uses strconv.Quote to return operand in quoted form. | func Quote(operand string) string { return strconv.Quote(operand) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (c *Client) Quote(v interface{}) Field {\n\tvar b []byte\n\tvar cp bool\n\tswitch s := v.(type) {\n\tcase string:\n\t\tb = []byte(s)\n\tcase []byte:\n\t\tb, cp = s, true\n\tcase fmt.Stringer:\n\t\tb = []byte(s.String())\n\tdefault:\n\t\treturn nil\n\t}\n\tif q := QuoteBytes(b, false); q != nil {\n\t\treturn s... | [
"0.67724854",
"0.672314",
"0.66739124",
"0.6672413",
"0.6604425",
"0.6457947",
"0.64538836",
"0.64424443",
"0.6362631",
"0.634526",
"0.63182724",
"0.6303418",
"0.6300532",
"0.62540025",
"0.6246771",
"0.61604947",
"0.61139077",
"0.60613805",
"0.60540783",
"0.604537",
"0.601246... | 0.9028715 | 0 |
Repeat uses strings.Repeat to return operand repeated count times. | func Repeat(count int, operand string) string { return strings.Repeat(operand, count) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Repeat(x string, count int) string {\n\tvar tmp string\n\n\tfor i := 0; i < count; i++ {\n\t\ttmp += x\n\t}\n\treturn tmp\n}",
"func Repeat(str string, count int) string {\n\tvar repeated string\n\tfor i := 0; i < count; i++ {\n\t\trepeated += str\n\t}\n\treturn repeated\n}",
"func Repeat(s string, count ... | [
"0.81087077",
"0.80611515",
"0.80388355",
"0.80275816",
"0.7991817",
"0.7943118",
"0.78999233",
"0.7871089",
"0.7868842",
"0.7799534",
"0.77878094",
"0.7761628",
"0.77589554",
"0.77205664",
"0.7702846",
"0.7692814",
"0.7609735",
"0.760945",
"0.76088685",
"0.75906384",
"0.7565... | 0.9269043 | 0 |
Replace uses strings.Replace to replace the first n occurrences of old with new. | func Replace(old, new string, n int, operand string) string {
return strings.Replace(operand, old, new, n)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Replace(s, old, new string, n int) string {return s}",
"func (s *Stringish) ReplaceN(old, new string, count int) *Stringish {\n\ts.str = strings.Replace(s.str, old, new, count)\n\treturn s\n}",
"func Replace(old, new string, n int) MapFunc {\n\treturn func(s string) string { return strings.Replace(s, old,... | [
"0.82198447",
"0.78765863",
"0.74704635",
"0.70332533",
"0.63961565",
"0.618726",
"0.61284655",
"0.6005145",
"0.592763",
"0.59137046",
"0.59038454",
"0.58959085",
"0.5832848",
"0.57535136",
"0.57090855",
"0.5653065",
"0.56295663",
"0.56088",
"0.56069434",
"0.56035155",
"0.556... | 0.7775555 | 2 |
Split uses strings.Split to split operand on sep, dropping sep from the resulting slice. | func Split(sep, operand string) []string { return strings.Split(operand, sep) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (s *Str) Split(sep string) []string {\n\treturn strings.Split(s.val, sep)\n}",
"func split(s string, sep string) []string {\n\tif s == \"\" {\n\t\treturn []string{}\n\t}\n\n\treturn strings.Split(s, sep)\n}",
"func Split(v, sep string) (sl []string) {\n\tif len(v) > 0 {\n\t\tsl = strings.Split(v, sep)\n\t... | [
"0.7781723",
"0.77303356",
"0.7596616",
"0.75234944",
"0.72743183",
"0.7198739",
"0.71530956",
"0.7060275",
"0.6923789",
"0.6910056",
"0.6857488",
"0.6814461",
"0.6776917",
"0.67762303",
"0.6706222",
"0.6640602",
"0.6640387",
"0.6637911",
"0.656748",
"0.6474187",
"0.6465538",... | 0.79331166 | 0 |
SplitAfter uses strings.SplitAfter to split operand after sep, leaving sep in the resulting slice. | func SplitAfter(sep, operand string) []string { return strings.SplitAfter(operand, sep) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func SplitAfterN(sep string, n int, operand string) []string {\n\treturn strings.SplitAfterN(operand, sep, n)\n}",
"func SubstringAfter(str string, sep string) string {\n\tidx := strings.Index(str, sep)\n\tif idx == -1 {\n\t\treturn str\n\t}\n\treturn str[idx+len(sep):]\n}",
"func SplitAfter[T any](slice []T, ... | [
"0.68313247",
"0.65905",
"0.65851027",
"0.6536396",
"0.62853515",
"0.62411356",
"0.607611",
"0.5987176",
"0.5922643",
"0.5868726",
"0.5696813",
"0.56356376",
"0.5610468",
"0.5584241",
"0.55637",
"0.5520223",
"0.55179083",
"0.5490344",
"0.5438785",
"0.54265654",
"0.5421514",
... | 0.85333556 | 0 |
SplitAfterN uses strings.SplitAfterN to split operand after sep, leaving sep in the resulting slice. Splits at most n times. | func SplitAfterN(sep string, n int, operand string) []string {
return strings.SplitAfterN(operand, sep, n)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func SplitN(sep string, n int, operand string) []string { return strings.SplitN(operand, sep, n) }",
"func TestSplitAfterN(t *testing.T) {\n\tConvey(\"分割字符串\", t, func() {\n\t\tConvey(\"全部分割:\", func() {\n\t\t\tstrArray := strings.SplitAfterN(\"a|b|c|d\", \"|\", 4)\n\t\t\tfor i, s := range strArray {\n\t\t\t\tfm... | [
"0.81235284",
"0.7568513",
"0.7228401",
"0.6420273",
"0.6344844",
"0.61365396",
"0.59296846",
"0.569893",
"0.56649643",
"0.56552154",
"0.56552154",
"0.56552154",
"0.56552154",
"0.56552154",
"0.56552154",
"0.56552154",
"0.56552154",
"0.56552154",
"0.56552154",
"0.56552154",
"0... | 0.87175244 | 0 |
SplitN uses strings.SplitN to split operand on sep, dropping sep from the resulting slice. Splits at most n times. | func SplitN(sep string, n int, operand string) []string { return strings.SplitN(operand, sep, n) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func SplitAfterN(sep string, n int, operand string) []string {\n\treturn strings.SplitAfterN(operand, sep, n)\n}",
"func splitStr(path, sep string, n int) []string {\n\tsplits := strings.SplitN(path, sep, n)\n\t// Add empty strings if we found elements less than nr\n\tfor i := n - len(splits); i > 0; i-- {\n\t\t... | [
"0.79668814",
"0.78912354",
"0.707287",
"0.6841752",
"0.6466911",
"0.63338417",
"0.6147164",
"0.6147164",
"0.6147164",
"0.6147164",
"0.6147164",
"0.6147164",
"0.6147164",
"0.6147164",
"0.6147164",
"0.6147164",
"0.6147164",
"0.6147164",
"0.61236423",
"0.60742384",
"0.5937574",... | 0.87715155 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.