query
stringlengths
7
3.85k
document
stringlengths
11
430k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
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\tif b == '_' {\n\t\t\t\tg[r][c] = Cell{}\n\t\t\t} else if b >= '1' && b <= '9' {\n\t\t\t\tg[r][c].resolve(b - '0')\n\t\t\t} else {\n\t\t\t\treturn g, fmt.Errorf(\"fot a number %c at row %d\", b, r+1)\n\t\t\t}\n\n\t\t\tif c != GridSize-1 {\n\t\t\t\t// read space\n\t\t\t\tb, err = s.ReadByte()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn g, fmt.Errorf(\"failed to read sudoku grid row %d: %s\", r+1, err)\n\t\t\t\t}\n\t\t\t\tif b != ' ' {\n\t\t\t\t\treturn g, fmt.Errorf(\"unexpected character '%c' at row %d\", b, r+1)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// read newline\n\t\t\t\tb, err = s.ReadByte()\n\t\t\t\tif r == GridSize-1 && err == io.EOF {\n\t\t\t\t\tbreak // TODO: return EOF here?\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn g, fmt.Errorf(\"failed to read sudoku grid row %d: %s\", r+1, err)\n\t\t\t\t}\n\t\t\t\tif b != '\\n' {\n\t\t\t\t\t// TODO: support Windows and MAC new lines\n\t\t\t\t\treturn g, fmt.Errorf(\"unexpected character '%c' at row %d\", b, r+1)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn g, nil\n}", "func ReadFrom(rdr io.Reader) (grid *Grid, err error) {\n\treader := bufio.NewReader(rdr)\n\theader := make([]byte, 8)\n\tif _, err = io.ReadFull(reader, header); err != nil {\n\t\treturn\n\t}\n\n\t// Read the size\n\tvar view Rect\n\tview.Min.X = int16(binary.BigEndian.Uint16(header[0:2]))\n\tview.Min.Y = int16(binary.BigEndian.Uint16(header[2:4]))\n\tview.Max.X = int16(binary.BigEndian.Uint16(header[4:6]))\n\tview.Max.Y = int16(binary.BigEndian.Uint16(header[6:8]))\n\n\t// Allocate a new grid\n\tgrid = NewGrid(view.Max.X+1, view.Max.Y+1)\n\tbuf := make([]byte, tileDataSize)\n\tgrid.pagesWithin(view.Min, view.Max, func(page *page) {\n\t\tif _, err = io.ReadFull(reader, buf); err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tcopy(page.Data(), buf)\n\t})\n\treturn\n}", "func main() {\n\tscanner := bufio.NewScanner(os.Stdin)\n\tscanner.Buffer(make([]byte, 1000000), 1000000)\n\n\t// W: number of columns.\n\t// H: number of rows.\n\tvar W, H int\n\tscanner.Scan()\n\tfmt.Sscan(scanner.Text(),&W, &H)\n\n\tfor i := 0; i < H; i++ {\n\t\tscanner.Scan()\n\t\tLINE := scanner.Text() // represents a line in the grid and contains W integers. Each integer represents one room of a given type.\n\t\tre := regexp.MustCompile(\" \")\n\t\tstr := \"[\" + re.ReplaceAllString(LINE, \",\") + \"]\"\n\t\tvar ints []int\n\t\tjson.Unmarshal([]byte(str), &ints)\n\n\t}\n\t// EX: the coordinate along the X axis of the exit (not useful for this first mission, but must be read).\n\tvar EX int\n\tscanner.Scan()\n\tfmt.Sscan(scanner.Text(),&EX)\n\n\tfor {\n\t\tvar XI, YI int\n\t\tvar POS string\n\t\tscanner.Scan()\n\t\tfmt.Sscan(scanner.Text(),&XI, &YI, &POS)\n\n\n\t\t// fmt.Fprintln(os.Stderr, \"Debug messages...\")\n\n\t\t// One line containing the X Y coordinates of the room in which you believe Indy will be on the next turn.\n\t\tfmt.Println(\"0 0\")\n\t}\n}", "func readInput(s beam.Scope, dsn string) beam.PCollection {\n\ts = s.Scope(\"readInput\")\n\n\t// read from the database into a PCollection of pageView structs\n\treturn databaseio.Read(s, \"mysql\", dsn, \"data\", reflect.TypeOf(pageView{}))\n}", "func readData() {\n\tin = bufio.NewReader(os.Stdin)\n\t// reading n\n\tn, _, _, _, _ = readFive()\n\tp = readLineNumbs(n)\n}", "func readCmd() {\n\tbzIn, err := ioutil.ReadAll(os.Stdin)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"cannot read stdin: %v\", err)\n\t\treturn\n\t}\n\tvestingData, err := unmarshalVestingData(bzIn)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"cannot decode vesting data: %v\", err)\n\t\treturn\n\t}\n\tevents, err := vestingDataToEvents(vestingData)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"cannot convert vesting data: %v\", err)\n\t}\n\tbzOut, err := marshalEvents(events)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"cannot encode events: %v\", err)\n\t\treturn\n\t}\n\tfmt.Println(string(bzOut))\n}", "func readInput(r io.Reader) Node {\n\tdata, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdata = bytes.Trim(data, \"^$ \\n\") // remove extraneous symbols\n\tnode, i := parseSequence(data, 0)\n\tif i < len(data) {\n\t\tpanic(fmt.Sprintf(\"parse error at offset %d\", i))\n\t}\n\treturn node\n}", "func readCommand(input chan<- string) {\n\tfor {\n\t\tvar cmd string\n\t\t_, err := fmt.Scanln(&cmd)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t\tinput <- cmd\n\t}\n}", "func (f *ioFile) read(args []interface{}, nl bool) {\n\tf.eol = false\n\tfor len(args) != 0 {\n\t\targ := args[0]\n\t\targs = args[1:]\n\t\tif _, ok := getWidth(&args); ok {\n\t\t\tpanic(\"internal error: read field width specifier not supported\")\n\t\t}\n\n\t\tswitch x := arg.(type) {\n\t\tcase *byte:\n\t\t\t*x = f.component[0]\n\t\tdefault:\n\t\t\tpanic(fmt.Errorf(\"unsupported read variable type: %T (%q)\", x, f.name))\n\t\t}\n\t\tf.get()\n\t}\n\tif !nl {\n\t\treturn\n\t}\n\n\t// [0] page 92\n\t//\n\t// ReadLn(F) skips to the beginning of the next line of the textfile F (F^\n\t// becomes the first character of the next line).\n\tfor !f.eof && f.component[0] != '\\n' {\n\t\tf.get()\n\t}\n\tif !f.eof {\n\t\tf.get()\n\t}\n}", "func getInput(trim bool) string {\n fi, err := os.Stdin.Stat()\n if err != nil {\n panic(err)\n }\n\n if fi.Mode() & os.ModeNamedPipe == 0 {\n fmt.Println(\"Nothing to draw\")\n os.Exit(0)\n }\n\n reader := bufio.NewReader(os.Stdin)\n var input []rune\n for {\n\t\tchunk, _, err := reader.ReadRune()\n\t\tif err != nil && err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tinput = append(input, chunk)\n\t}\n\n if trim {\n return strings.TrimSpace(string(input))\n }\n\n return string(input)\n}", "func readInputLoop(dt *discordterm.Client) {\n\trd := bufio.NewReader(os.Stdin)\n\n\tl, err := readline.NewEx(&readline.Config{\n\t\tPrompt: prompt,\n\t\tAutoComplete: completer,\n\t\tHistoryFile: filepath.Join(os.TempDir(), historyFile),\n\t\tHistorySearchFold: true,\n\t})\n\tif err != nil {\n\t\tlog.Println(\"Error creating readline:\", err)\n\t\treturn\n\t}\n\n\tvar standardReader bool\n\n\tfor {\n\t\tvar line string\n\t\tvar err error\n\n\t\tl.SetPrompt(createPrompt(dt))\n\n\t\tif !standardReader {\n\t\t\tline, err = l.Readline()\n\t\t\tif err != nil {\n\t\t\t\tstandardReader = true\n\t\t\t\tlog.Println(\"Error using readline package: switching to bufio reader: \", err)\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Print(prompt)\n\t\t\tline, err = rd.ReadString('\\n')\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t}\n\n\t\t// Read a line of input\n\n\t\t// Remove whitespace characters from line\n\t\tline = strings.TrimSpace(line)\n\n\t\terr = executeCommand(dt, line)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n}", "func (client *Client) InputReader(c net.Conn) {\n\tscanner := bufio.NewScanner(os.Stdin)\n\tfmt.Print(\"> \")\n\tfor scanner.Scan() {\n\t\targs := strings.Split(scanner.Text(), \" \")\n\t\tif args[0] == \"exit\" {\n\t\t\tos.Exit(0)\n\t\t}\n\t\tresponse, err := client.processCommand(c, args[0], args[1:]...)\n\t\tparseResponse(response, err, defaultTag)\n\t\tif args[0] == \"subscribe\" {\n\t\t\tsubscribePattern(c, scanner)\n\t\t\tfmt.Printf(\"\\r%s\", defaultTag)\n\t\t}\n\t}\n\n\tif scanner.Err() != nil {\n\t\tfmt.Printf(\"%v\", scanner.Err())\n\t\tos.Exit(2)\n\t}\n}", "func readStdin(out chan<- []byte) {\n\t//* copies some data from Stdin into data. Note that File.Read blocks until it receives data\n\tfor {\n\t\tdata := make([]byte, 1024)\n\t\tl, _ := os.Stdin.Read(data)\n\t\tif l > 0 {\n\t\t\t//* sends the buffered data over the channel\n\t\t\tout <- data\n\t\t}\n\t}\n}", "func (c *Config) Stdin() io.ReadCloser {\n\treturn c.stdin\n}", "func main() {\n\n\treader := bufio.NewReader(os.Stdin)\n\tfmt.Println(\"Enter your name:\")\n\n\tname, _ := reader.ReadString('\\n')\n\tfmt.Print(\"Your name is \", name)\n\n}", "func SetupSimulation() {\n iRobot = Robot{}\n iSurface = Surface{}\n fmt.Print(\"\\nPlease enter the length of the adjacency matrix to start simulation: \\n\")\n scanner := bufio.NewScanner(os.Stdin)\n for scanner.Scan() {\n length, err := strconv.Atoi(strings.TrimSpace(scanner.Text()))\n if err == nil && length > 1 {\n //initialize adjacency matrix\n iSurface = NewSurface(length)\n break\n }\n fmt.Println(\"Please enter the length of the adjacency matrix: >1 \\n\")\n }\n\n iSurface.Print(Node{})\n BeginSimulation()\n}", "func readInput(conn net.Conn, qst string) (string, error) {\n\tconn.Write([]byte(qst))\n\ts, err := bufio.NewReader(conn).ReadString('\\n')\n\tif err != nil {\n\t\tlog.Printf(\"readinput: could not read input from stdin: %v from client %v\", err, conn.RemoteAddr().String())\n\t\treturn \"\", err\n\t}\n\ts = strings.Trim(s, \"\\r\\n\")\n\treturn s, nil\n}", "func readInput(inCh chan byte) {\n\tscanner := bufio.NewScanner(os.Stdin)\n\tfor scanner.Scan() {\n\t\tinput := scanner.Bytes()\n\t\tfor _, c := range input {\n\t\t\tinCh <- c\n\t\t}\n\t}\n}", "func ParseGrid(lines []string) ([][]int, error) {\n\tvar result [][]int\n\tvar fields int\n\tfor i, line := range lines {\n\t\tparts := strings.Fields(line)\n\t\tif i == 0 {\n\t\t\tfields = len(parts)\n\t\t} else {\n\t\t\tif len(parts) != fields {\n\t\t\t\treturn nil, fmt.Errorf(\"line 0 has %d fields; line %d has %d: %q\", fields, i+1, len(parts), line)\n\t\t\t}\n\t\t}\n\t\tints := make([]int, 0, len(parts))\n\n\t\tfor _, part := range parts {\n\t\t\ttheInt, err := strconv.Atoi(part)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error at line %d: %w\", i+1, err)\n\t\t\t}\n\t\t\tints = append(ints, theInt)\n\t\t}\n\t\tresult = append(result, ints)\n\t}\n\n\treturn result, nil\n}", "func promptCoords() objects.GridCoords {\n\tfmt.Println(\"Enter row and column:\")\n\trow := getIntInput(\"row:\\n> \")\n\tcol := getIntInput(\"col:\\n> \")\n\n\treturn objects.GridCoords{Row: row, Col: col}\n}", "func (c *Coordinate) Read() {\n\tvar s string\n\tfor i := 0; i < 100; i++ {\n\t\tfmt.Println(\"Please enter a coordinate (e.g. 'd3'):\")\n\t\tfmt.Scanln(&s)\n\t\tif s == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.Contains(letters[boardSideLength:], string(s[0])) {\n\t\t\tfmt.Printf(\"Please use letters from %c-%c\\n\", letters[0], letters[int(boardSideLength)])\n\t\t\tcontinue\n\t\t}\n\t\tif strings.Contains(\"0123456789\", string(s[0])) {\n\t\t\tfmt.Printf(\"First character must be a letter from %c-%c\\n\", letters[0], letters[int(boardSideLength)])\n\t\t\tcontinue\n\t\t}\n\t\ty, err := strconv.Atoi(s[1:])\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Please make sure number follows the letter immediately\")\n\t\t\tcontinue\n\t\t}\n\t\tif y <= 0 || uint8(y) > boardSideLength {\n\t\t\tfmt.Printf(\"Please use numbers from 1-%d\\n\", boardSideLength)\n\t\t\tcontinue\n\t\t}\n\t\tc.x = byte(strings.IndexRune(letters, rune(s[0])))\n\t\tc.y = byte(y)\n\t\tc.y--\n\t\tbreak\n\t}\n}", "func StdinReader(input *ringbuffer.RingBuffer) {\n\tin := bufio.NewReader(os.Stdin)\n\tfor {\n\t\tby, err := in.ReadByte()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\n\t\tinput.Write([]byte{by})\n\t}\n}", "func (mongoImport *MongoImport) getInputReader() (io.ReadCloser, error) {\n\tif mongoImport.InputOptions.File != \"\" {\n\t\tfile, err := os.Open(util.ToUniversalPath(mongoImport.InputOptions.File))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfileStat, err := file.Stat()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlog.Logf(1, \"filesize: %v\", fileStat.Size())\n\t\treturn file, err\n\t}\n\tlog.Logf(1, \"filesize: 0\")\n\treturn os.Stdin, nil\n}", "func getInput(input chan string) {\n for {\n reader := bufio.NewReader(os.Stdin)\n d,_ := reader.ReadString('\\n')\n input <- d\n }\n}", "func reading_console(iConf conf.ConfStruct) {\n\treader := bufio.NewReader(os.Stdin)\n\twriteWelcome(iConf)\n\tprintln(\"DBHOST:\" + readExternal.ReadSettings().DB_adress)\n\t_, lConfLocation := readExternal.LoadFromOSArgs()\n\tgvConf := conf.GetConfig(lConfLocation)\n\tprintln(\"database:\", gvConf.DB_databases.Logger)\n\tfor {\n\t\tfmt.Print(\"-> \")\n\n\t\ttext, _ := reader.ReadString('\\n')\n\t\tvar lineEnding string = data.LineEnding\n\t\tif runtime.GOOS == \"windows\" {\n\t\t\tlineEnding = data.LineEndingWindows\n\t\t}\n\t\ttext = strings.Replace(text, lineEnding, \"\", -1)\n\n\t\tif text == \"create\" {\n\t\t\tservices.CreateDatabaseTables(gvConnection, gvDatabase)\n\t\t} else if text == \"drop\" && !iConf.In_PRODUCTIONSYSTEM {\n\t\t\tservices.DropDatabaseTable(gvConnection, gvDatabase)\n\t\t} else if text == \"dropcreate\" && !iConf.In_PRODUCTIONSYSTEM {\n\t\t\tservices.DropDatabaseTable(gvConnection, gvDatabase)\n\t\t\tservices.CreateDatabaseTables(gvConnection, gvDatabase)\n\t\t} else if text == \"exit\" {\n\t\t\tbreak\n\t\t} else {\n\t\t\tfmt.Println(\"keine gültige Anweisung\")\n\t\t}\n\t}\n}", "func readInput(kind, defaultValue string) (string, error) {\n\tr := bufio.NewReader(os.Stdin)\n\tfmt.Printf(\"%s (%s): \", color.YellowString(\"Enter a value\"), kind)\n\ttext, err := r.ReadString('\\n')\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif text == \"\\n\" {\n\t\ttext = defaultValue\n\t\tfmt.Printf(\"%s%s (%s): %s\\n\", moveLineUp, color.YellowString(\"Enter a value\"), kind, text)\n\t}\n\tfmt.Println()\n\treturn text, nil\n}", "func main() {\r\n\tscanner := bufio.NewScanner(os.Stdin)\r\n\tfor scanner.Scan() {\r\n\t\tfmt.Println(scanner.Text())\r\n\t}\r\n\tif err := scanner.Err(); err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n}", "func parseInput() {\n\n // Open the input file.\n f, _ := os.Open(os.Args[1])\n defer f.Close()\n\n // Use a scanner to read lines from the input file.\n scanner := bufio.NewScanner(f)\n arraySize := 0\n j := 0\n\n // Skip first few lines and get the number of dimension.\n for (scanner.Scan()) {\n line := scanner.Text()\n str := strings.Fields(line)\n\n // Get the number of dimension.\n if (strings.Contains(str[0], \"DIMENSION\")) {\n for i := 1; i < len(str); i++ {\n nextToken, _ := strconv.Atoi(str[i])\n if (nextToken != 0) {\n arraySize = nextToken\n }\n }\n break\n }\n }\n\n // Create two arrays to store x and y coordinates respectively.\n x := make([]float64, arraySize + 1)\n y := make([]float64, arraySize + 1)\n\n // Read all x, y coordinates of all points.\n for (scanner.Scan()) {\n line := scanner.Text()\n str := strings.Fields(line)\n firstToken, _ := strconv.Atoi(str[0])\n if (firstToken != 0 && line != \"EOF\") {\n j++\n x[j], _ = strconv.ParseFloat(str[1], 64)\n y[j], _ = strconv.ParseFloat(str[2], 64)\n }\n if (str[0] == \"EOF\") {\n break\n }\n }\n findRoute(x, y, arraySize)\n}", "func readInput() (src string, err error) {\n\tin := os.Args\n\tsrc = in[1]\n\tif src == \"\" {\n\t\treturn src, errors.New(\"missing string to match\")\n\t}\n\treturn src, nil\n}", "func readStdin() (count int, err error) {\n\tscanner := bufio.NewScanner(os.Stdin)\n\tfor scanner.Scan() {\n\t\tvar p Policy\n\t\tline := []byte(strings.Trim(scanner.Text(), \"\\r\\n\"))\n\t\tfields := strings.Fields(string(line))\n\t\tminmax := strings.Split(fields[0], \"-\")\n\t\tp.min, err = strconv.Atoi(minmax[0])\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tp.min -= 1\n\t\tp.max, err = strconv.Atoi(minmax[1])\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tp.max -= 1\n\t\tp.char = fields[1][0]\n\t\tpassword := fields[2]\n\t\tif p.Complies(password) {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn\n}", "func setInput(grid *datatypes.Grid) int {\n\tsetValue(grid, 0, 4, 4)\n\tsetValue(grid, 0, 5, 5)\n\n\tsetValue(grid, 1, 0, 8)\n\tsetValue(grid, 1, 6, 2)\n\tsetValue(grid, 1, 8, 7)\n\n\tsetValue(grid, 2, 2, 2)\n\tsetValue(grid, 2, 8, 4)\n\n\tsetValue(grid, 3, 2, 6)\n\tsetValue(grid, 3, 6, 3)\n\tsetValue(grid, 3, 8, 2)\n\n\tsetValue(grid, 4, 3, 1)\n\n\tsetValue(grid, 5, 0, 2)\n\tsetValue(grid, 5, 2, 7)\n\tsetValue(grid, 5, 3, 4)\n\tsetValue(grid, 5, 6, 6)\n\n\tsetValue(grid, 6, 0, 6)\n\tsetValue(grid, 6, 1, 4)\n\tsetValue(grid, 6, 4, 9)\n\tsetValue(grid, 6, 5, 8)\n\n\tsetValue(grid, 7, 0, 7)\n\tsetValue(grid, 7, 1, 9)\n\tsetValue(grid, 7, 5, 4)\n\n\tsetValue(grid, 8, 7, 3)\n\n\tgrid.Print()\n\treturn 23\n}", "func readInput(path string) []byte {\n\tvar bytes []byte\n\tvar err error\n\n\tif path != \"\" {\n\t\tbytes, err = ioutil.ReadFile(path)\n\t} else {\n\t\tbytes, err = ioutil.ReadAll(os.Stdin)\n\t}\n\n\tapp.FatalIfError(err, \"unable to read input\")\n\treturn bytes\n}", "func ReadIO(in io.Reader) (l *Line, err error) {\n\n s := bufio.NewScanner(in)\n\n // scan once to get the first line\n if s.Scan() == false || s.Err() != nil {\n return nil, s.Err()\n }\n\n l = &Line{data: s.Text()}\n scanIO(l, s)\n\n return l, s.Err()\n}", "func readstdin(reader *bufio.Reader) string {\n\ttext, err := reader.ReadString('\\n')\n\tif err != nil {\n\t\tlog.Fatalf(\"Error when reading input: %v\", err)\n\t}\n\treturn strings.TrimSpace(text)\n}", "func input() (io.Reader, error) {\n\targs := flag.Args()\n\tswitch len(args) {\n\tcase 0:\n\t\tfi, _ := os.Stdin.Stat()\n\t\tif (fi.Mode() & os.ModeCharDevice) != 0 {\n\t\t\tbreak\n\t\t}\n\t\treturn os.Stdin, nil\n\tcase 1:\n\t\treturn os.Open(args[0])\n\t}\n\treturn nil, errors.New(\"usage: etod [opts] <file> or cmd | etod\")\n}", "func input() io.Reader {\n\tif isatty.IsTerminal(os.Stdin.Fd()) {\n\t\treturn strings.NewReader(\"{}\")\n\t}\n\n\treturn os.Stdin\n}", "func (k *PluginRunner) newResMapFromStdin() (resmap.ResMap, error) {\n\tb, err := ioutil.ReadAll(k.cmd.InOrStdin())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn k.h.ResmapFactory().NewResMapFromBytes(b)\n}", "func stdin(c chan<- string, mf string) {\n\tdefer close(c)\n\tscanner := bufio.NewScanner(os.Stdin)\n\tlog.Printf(\"Ready.\")\n\tfor scanner.Scan() {\n\t\tc <- mf + scanner.Text()\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\tlog.Fatalf(\"Read error: %v\", err)\n\t}\n}", "func main() {\n\tapp := &CLIApp{GetOutboundIP().String(), 10002}\n\treader := bufio.NewReader(os.Stdin)\n\tfmt.Printf(\"Welcome to kademlia network!\\nAvailable commands:\\nput <string> (stores data on k closest nodes to hash)\t\\nget <hash> (fetches data object with this hash if it is stored in the network)\t\\nexit (terminates this node)\\n\")\n\n\tfor {\n\t\tfmt.Printf(\"\\nEnter command: \")\n\t\ttext, _ := reader.ReadString('\\n') //read from terminal\n\t\ttext = strings.TrimRight(text, \"\\n\")\n\n\t\tsplitStr := strings.SplitN(text, \" \", 2) //Split string at first space\n\n\t\terr := app.parser(splitStr)\n\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"%s\", err)\n\t\t}\n\t}\n}", "func getInputLines() <-chan string {\n\tch := make(chan string, 10)\n\tgo func() {\n\t\tdefer close(ch)\n\t\tf, err := os.Open(\"testdata\")\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tr := bufio.NewReader(f)\n\t\tfor {\n\t\t\tline, err := r.ReadString('\\n')\n\t\t\tch <- strings.TrimSpace(line)\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}()\n\treturn ch\n}", "func readInput() string {\r\n cmdString, err := reader.ReadString('\\n')\r\n check(err)\r\n\r\n return cmdString\r\n}", "func (c *Cmd) StdinPipe() (io.WriteCloser, error)", "func (reader *testReader) Read(b []byte) (int, error) {\n\tfmt.Print(\"[IN] > \")\n\treturn os.Stdin.Read(b)\n}", "func newGrid(lines []string) *grid {\n\tsize := len(lines) // grids are square\n\tbits := makeBits(size)\n\t// dump the characters into a 2d grid\n\tfor y, line := range lines {\n\t\trow := strings.Split(line, \"\")\n\t\tfor x := 0; x < len(row); x++ {\n\t\t\tif row[x] == \"#\" {\n\t\t\t\tbits[y][x] = 1\n\t\t\t}\n\t\t}\n\t}\n\tcenter := vector{size / 2, size / 2}\n\treturn &grid{bits, size, center}\n}", "func Reader(conn net.Conn){\r\n osReader := bufio.NewReader(os.Stdin) // make a READER\r\n for {\r\n msg,err:=osReader.ReadString('\\n')\r\n if err != nil {\r\n fmt.Println(\"Client DISCONNECTED\")\r\n return\r\n }else {\r\n pass <- msg // pass the user input to channel\r\n }\r\n }\r\n }", "func Reader(conn net.Conn){\n osReader := bufio.NewReader(os.Stdin) // make a READER\n for {\n msg,err:=osReader.ReadString('\\n')\n if err != nil {\n fmt.Println(\"Client DISCONNECTED\")\n return\n }else {\n pass <- msg // pass the user input to channel\n\n }\n }\n }", "func read(msg string) string {\n\tfmt.Print(msg)\n\tvar ret, _ = bufio.NewReader(os.Stdin).ReadString('\\n')\n\treturn ret\n}", "func (p *Process) Stdin() io.Reader {\n\treturn p.stdin\n}", "func main() {\n scanner := bufio.NewScanner(os.Stdin)\n scanner.Buffer(make([]byte, 1000000), 1000000)\n\n var width, height int\n scanner.Scan()\n fmt.Sscan(scanner.Text(),&width, &height)\n\n var count int\n scanner.Scan()\n fmt.Sscan(scanner.Text(),&count)\n\n grid := [][]string{}\n for i := 0; i < height; i++ {\n scanner.Scan()\n raster := scanner.Text()\n // _ = raster // to avoid unused error\n\n grid = append(grid, strings.Split(raster, \"\"))\n }\n\n for i := 0; i < count; i++ {\n for _, row := range grid {\n sort.Strings(row)\n }\n grid = anticlockwiseTurn90Degree(grid)\n }\n\n // fmt.Fprintln(os.Stderr, \"Debug messages...\")\n // fmt.Println(\"...\")// Write answer to stdout\n // fmt.Println(\"write ###\")\n for _, row := range grid {\n fmt.Println(strings.Join(row, \"\"))\n }\n}", "func (l *Linenoise) readBasic() (string, error) {\n\tif l.scanner == nil {\n\t\tl.scanner = bufio.NewScanner(os.Stdin)\n\t}\n\t// scan a line\n\tif !l.scanner.Scan() {\n\t\t// EOF - return quit\n\t\treturn \"\", ErrQuit\n\t}\n\t// check for unexpected errors\n\terr := l.scanner.Err()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// get the line string\n\treturn l.scanner.Text(), nil\n}", "func (cmd Cmd) Read(stdin io.Reader) Cmd {\n\tcmd.Stdin = stdin\n\treturn cmd\n}", "func main() {\n\tfp, err := os.Open(\"hightemp.txt\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer fp.Close()\n\n\t// get args\n\tn := flag.Int(\"n\", 0, \"input natural number\")\n\tflag.Parse()\n\n\tscanner := bufio.NewScanner(fp)\n\tfor i := 0; i < *n; i++ {\n\t\tscanner.Scan()\n\t\tfmt.Println(scanner.Text())\n\t}\n}", "func testBufioOs() {\n\n\t// a reader object can collect information from a variety of inputs\n\treader := bufio.NewReader(os.Stdin) // --> this means that this reader object is looking for information from standard input\n\tfmt.Print(\"Enter text: \")\n\tstr, _ := reader.ReadString('\\n') // --> the character defines when the ReadString operation needs to return\n\t// --> in this case, it will return whatever it reads until the new line character\n\tfmt.Println(str)\n\n}", "func main() {\n\tc := AnagramsReader(os.Stdin)\n\tfmt.Println(c)\n}", "func (p *Init) Stdin() io.Closer {\n\treturn p.stdin\n}", "func reader(threads int, parallel bool, queue Queue, wg *sync.WaitGroup, shots []Shot, m map[string]int) {\n\n\t// Add jobs from the input to the queue\n\tscanner := bufio.NewScanner(os.Stdin)\n\tfor scanner.Scan(){\n\t\ttempJob := scanner.Text()\n\t\ttempJobP := unsafe.Pointer(&tempJob)\n\t\tqueue.enq(&tempJobP)\n\n\t}\n\n\t// Boolean that signals when to stop reading from queue\n\tvar done bool\n\n\t// Variable that checks if we have gone through all items from the queue\n\tcounter := int32(0)\n\n\t// Value to reach before signaling done to be true\n\ttail := queue.end\n\n\t// Dequeue until done is true\n\tfor !done{\n\n\t\t// If there are still tasks to read\n\t\tif counter != tail{\n\n\t\t\t// Grab a job\n\t\t\ttemp := queue.deq()\n\n\t\t\t// Visualization Job\n\t\t\tif strings.Contains(temp, \"visualize\"){\n\n\t\t\t\t// Run Parallel Version\n\t\t\t\tif parallel{\n\t\t\t\t\twg.Add(1)\n\t\t\t\t\tgo visualizationWorker(temp, threads, wg, parallel, shots, m)\n\n\t\t\t\t\t// Run Sequential Version\n\t\t\t\t} else{\n\t\t\t\t\tvisualizationWorker(temp, threads, wg, parallel, shots, m)\n\t\t\t\t}\n\t\t\t// ML Model Job\n\t\t\t} else if strings.Contains(temp, \"ml\"){\n\t\t\t\t\n\t\t\t\t// Run Parallel Version\n\t\t\t\tif parallel{\n\t\t\t\t\twg.Add(1)\n\t\t\t\t\tgo mlWorker(temp, threads, wg, parallel)\n\n\t\t\t\t// Run Sequential Version\n\t\t\t\t}else{\n\t\t\t\t\tmlWorker(temp, threads, wg, parallel)\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t// Increment Counter\n\t\t\tcounter++\n\t\t\n\t\t// We have read everything\n\t\t// break out of for loop\n\t\t} else {\n\n\t\t\tdone = true\n\t\t}\n\n\t}\n\n}", "func ReadInput(args ...string) []string {\n\tvar scanner *bufio.Scanner\n\tif len(args) == 0 {\n\t\tfmt.Printf(\"Input:\\n\")\n\t\tscanner = bufio.NewScanner(os.Stdin)\n\t} else {\n\t\tf, err := os.Open(args[0])\n\t\tCheck(err, \"Couldn't open file: \"+args[0])\n\t\tscanner = bufio.NewScanner(f)\n\t}\n\n\tvar res []string\n\tfor scanner.Scan() {\n\t\t// s := strings.Trim(scanner.Text(), \" \\n\\t\")\n\t\ts := scanner.Text()\n\t\tif len(s) > 0 {\n\t\t\tres = append(res, s)\n\t\t}\n\t}\n\tCheck(scanner.Err(), \"Error reading input\")\n\treturn res\n}", "func (c *Cmd) Stdin(in io.Reader) *Cmd {\n\tc.stdin = in\n\treturn c\n}", "func readInput(filename string) ([]string, error) {\n\tfilePath, err := filepath.Abs(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfile, err := os.Open(filePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tscanner := bufio.NewScanner(file)\n\tscanner.Split(bufio.ScanLines)\n\n\tvar passports []string\n\n\tvar tempString string\n\n\tfor scanner.Scan() {\n\t\tthisLine := scanner.Text()\n\n\t\ttempString = tempString + \" \" + thisLine\n\n\t\tif thisLine == \"\"{\n\t\t\tpassports = append(passports, tempString)\n\t\t\ttempString = \"\"\n\t\t}\n\t}\n\n\tpassports = append(passports, tempString)\n\treturn passports, nil\n}", "func readinput(r io.Reader, f string) {\n\n s := bufio.NewScanner(r)\n\n ln := 0\n for s.Scan() {\n ln++\n l := s.Text()\n c := strings.Split(strings.TrimSpace(l), seperator)\n\n if len(c) == 0 {\n readerr(\"No columns parsed from line\", f, ln, nil)\n continue\n }\n\n if column > len(c) {\n readerr(\"No enough columns to meet requested column number\", f, ln, nil)\n continue\n }\n\n v, e := strconv.ParseFloat(c[column - 1], 64)\n\n if e != nil {\n readerr(\"Failed to parse line\", f, ln, e)\n }\n\n // remove the value column since we don't to output that in the result\n columns := []string{}\n for k, v := range c {\n if k == (column - 1) {\n continue\n }\n columns = append(columns, v)\n }\n\n k := hash(strings.Join(columns, \"\"))\n\n if _, ok := summary[k]; !ok {\n summary[k] = NewRow(columns, k)\n }\n\n summary[k].Add(v, f)\n }\n\n if e := s.Err(); e != nil {\n panic(e)\n }\n\n}", "func readInput(in io.Reader) (string, error) {\n\tline, _, err := bufio.NewReader(in).ReadLine()\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"error while reading input\")\n\t}\n\treturn strings.TrimSpace(string(line)), nil\n}", "func (gosh *Goshell) Open(r *bufio.Reader) {\n\tloopCtx := gosh.ctx\n\tline := make(chan string)\n\tfor {\n\t\t// start a goroutine to get input from the user\n\t\tgo func(ctx context.Context, input chan<- string) {\n\t\t\tfor {\n\t\t\t\t// TODO: future enhancement is to capture input key by key\n\t\t\t\t// to give command granular notification of key events.\n\t\t\t\t// This could be used to implement command autocompletion.\n\t\t\t\tfmt.Fprintf(ctx.Value(\"gosh.stdout\").(io.Writer), \"%s \", api.GetPrompt(loopCtx))\n\t\t\t\tline, err := r.ReadString('\\n')\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Fprintf(ctx.Value(\"gosh.stderr\").(io.Writer), \"%v\\n\", err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tinput <- line\n\t\t\t\treturn\n\t\t\t}\n\t\t}(loopCtx, line)\n\n\t\t// wait for input or cancel\n\t\tselect {\n\t\tcase <-gosh.ctx.Done():\n\t\t\tclose(gosh.closed)\n\t\t\treturn\n\t\tcase input := <-line:\n\t\t\tvar err error\n\t\t\tloopCtx, err = gosh.handle(loopCtx, input)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Fprintf(loopCtx.Value(\"gosh.stderr\").(io.Writer), \"%v\\n\", err)\n\t\t\t}\n\t\t}\n\t}\n}", "func readInput() string {\n\n\tvar input string\n\n\tf, _ := os.Open(\"input.txt\")\n\tscanner := bufio.NewScanner(f)\n\n\tfor scanner.Scan() {\n\t\tif scanner.Text() != \"\" {\n\t\t\tinput = scanner.Text()\n\t\t}\n\t}\n\treturn input\n}", "func (l *Linenoise) readRaw(prompt, init string) (string, error) {\n\t// set rawmode for stdin\n\tl.enableRawMode(syscall.Stdin)\n\tdefer l.disableRawMode(syscall.Stdin)\n\t// edit the line\n\ts, err := l.edit(syscall.Stdin, syscall.Stdout, prompt, init)\n\tfmt.Printf(\"\\r\\n\")\n\treturn s, err\n}", "func readData(input *string) ([]byte, error) {\n\tif *input == \"-\" {\n\t\tlog.Println(\"reading bytes from stdin\")\n\t\treturn ioutil.ReadAll(os.Stdin)\n\t} else {\n\t\tlog.Println(\"reading bytes from '\" + *input + \"'\")\n\t\treturn ioutil.ReadFile(*input)\n\t}\n}", "func readLines() string {\n\tbody := \"package main\\n\"\n\treader := bufio.NewReader(os.Stdin)\n\tlineNo := 2\n\tfor {\n\t\t//make a fancy look with line number\n\t\tif lineNo > 9 && lineNo < 100 {\n\t\t\tfmt.Fprintf(os.Stdout, \" %d|> \", lineNo)\n\t\t} else if lineNo > 99 {\n\t\t\tfmt.Fprintf(os.Stdout, \"%d|> \", lineNo)\n\t\t} else {\n\t\t\tfmt.Fprintf(os.Stdout, \" %d|> \", lineNo)\n\t\t}\n\n\t\ttext, _ := reader.ReadString('\\n')\n\t\t// CRLF to LF\n\t\ttext = strings.Replace(text, \"\\n\", \"\", -1)\n\n\t\tif strings.Compare(strings.TrimRight(text, \"\\n\"), \":cr\") == 0 {\n\t\t\treturn body\n\t\t}\n\t\tbody += \"\\n\" + text\n\t\tlineNo++\n\t}\n\treturn body\n}", "func main() {\n\n\tscanner := bufio.NewScanner(os.Stdin)\n\tvar lines []string\n\n\tfor scanner.Scan() {\n\t\tif len(scanner.Text()) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tlines = append(lines, scanner.Text())\n\n\t}\n\n\tn, _ := strconv.Atoi(lines[0])\n\n\tline := strings.Split(lines[1], \" \")\n\n\tfor x := n - 1; x >= 0; x-- {\n\n\t\tfmt.Print(line[x] + \" \")\n\n\t}\n\n}", "func traverseInput(clip *cliParamsType, workers *workersType, runWithin func(record []string)) (err error) {\n\tvar reader *csv.Reader\n\n\tif len(clip.params) > 0 {\n\t\tvar f *os.File\n\t\tf, err = os.Open(clip.params)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tdefer f.Close()\n\t\treader = csv.NewReader(f)\n\t} else {\n\t\treader = csv.NewReader(bufio.NewReader(os.Stdin))\n\t}\n\n\t// Streams over the input, line by line, until EOF. When a line is read, calls a runWithin callback\n\t// (third traverseInput function's argument).\n\tlines := uint(0)\n\tfor {\n\t\tvar record []string\n\t\trecord, err = reader.Read()\n\t\tif err == io.EOF {\n\t\t\terr = nil\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn\n\t\t}\n\t\tlines++\n\t\tif lines == 1 {\n\t\t\tcontinue\n\t\t}\n\t\trunWithin(record)\n\t}\n\n\treturn\n}", "func (cli *ExecCli) In() *streams.In {\n\treturn cli.in\n}", "func BeginSimulation() {\n fmt.Print(\"Enter command: \\n\")\n scanner := bufio.NewScanner(os.Stdin)\n for scanner.Scan() {\n ProcessCommand(scanner.Text())\n fmt.Print(\"Enter command: \\n\")\n }\n}", "func getInput(r *bufio.Reader, q string) string {\n\tfmt.Printf(\"%s:\\n\", q)\n\ttext, err := r.ReadString('\\n')\n\tif err != nil {\n\t\tfmt.Printf(\"an error has occured: %s\", err.Error())\n\t\tos.Exit(2)\n\t}\n\treturn text\n}", "func (p *stdinParser) Read() ([]byte, error) {\n\tif p.size == p.start {\n\t\tbuf, err := p.ConsoleParser.Read()\n\t\tif err != nil {\n\t\t\treturn []byte{}, err\n\t\t}\n\t\tp.start = 0\n\t\tp.size = len(buf)\n\t\tp.buf = buf\n\t}\n\ti := p.start\nL:\n\tfor ; i < p.size; i++ {\n\t\tif remapped, ok := p.keyMap[prompt.GetKey(p.buf[i:])]; ok {\n\t\t\tp.start = p.size\n\t\t\treturn remapped, nil\n\t\t}\n\t\tswitch prompt.GetKey(p.buf[i : i+1]) {\n\t\tcase prompt.Enter, prompt.ControlJ, prompt.ControlM:\n\t\t\tbreak L\n\t\t}\n\t}\n\tif i == p.start {\n\t\tp.start++\n\t\treturn p.buf[i : i+1], nil\n\t}\n\tbuf := p.buf[p.start:i]\n\tp.start = i\n\treturn buf, nil\n}", "func readEvaluateProcess(br *bufio.Reader) (terr error) {\n\tfmt.Printf(\"> \")\n\tline, _, err := br.ReadLine()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tout, err := processLine(line)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Printf(\"< %s\\n\\n\", out)\n\treturn nil\n}", "func Scan() (int, [][]int) {\n\tscanner := bufio.NewScanner(os.Stdin)\n\tresult := [][]int{}\n\n\tscanner.Scan()\n\tsizeString := scanner.Text()\n\tsize, _ := strconv.ParseInt(sizeString, 10, 64)\n\n\tfor scanner.Scan() {\n\t\tslice := strings.Split(scanner.Text(), \" \")\n\t\tresult = append(result, ConvStrToSlice(slice))\n\t}\n\treturn int(size), result\n}", "func NewBoardFromReader(in io.Reader) (Board, error) {\n\tvar b Board\n\n\ts := bufio.NewScanner(in)\n\ts.Split(bufio.ScanWords)\n\n\tfor i := 0; i < 9; i++ {\n\t\tfor j := 0; j < 9; j++ {\n\t\t\tif !s.Scan() {\n\t\t\t\tif err := s.Err(); err != nil {\n\t\t\t\t\treturn b, err\n\t\t\t\t}\n\n\t\t\t\t// reached EOF\n\t\t\t\treturn b, errors.New(\"invalid input: too short\")\n\t\t\t}\n\n\t\t\tif s.Text() == \"_\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\td, err := strconv.Atoi(s.Text())\n\t\t\tif err != nil {\n\t\t\t\treturn b, fmt.Errorf(\"invalid input: %s\", s.Text())\n\t\t\t}\n\n\t\t\tif d < 1 || d > 9 {\n\t\t\t\treturn b, fmt.Errorf(\"invalid input: %d\", d)\n\t\t\t}\n\n\t\t\tb[i][j] = d\n\t\t}\n\t}\n\n\treturn b, nil\n}", "func Read(pipes *plumbing.Pipes, stream io.Reader) {\n\tinput := &input{\n\t\treceive: pipes.FromInterpreter(),\n\t\tsend: pipes.ToInterpreter(),\n\t\tstream: stream,\n\t}\n\tinput.read()\n}", "func ReadInput(path string) []int {\n\tfile, err := os.Open(path)\n\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t}\n\n\tdefer file.Close()\n\tvar data []int\n\tscanner := bufio.NewScanner(file)\n\n\tfor scanner.Scan() {\n\t\tval, _ := strconv.ParseInt(scanner.Text(), 10, 0)\n\t\tdata = append(data, int(val))\n\t}\n\n\treturn data\n}", "func localClientInput(conn net.Conn) {\n\tfmt.Print(\"> \")\n\tscanner := bufio.NewScanner(os.Stdin)\n\twriter := bufio.NewWriter(conn)\n\tfor scanner.Scan() {\n\t\tfmt.Print(\"> \")\n\t\t_, err := writer.WriteString(scanner.Text() + \"\\n\")\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\twriter.Flush()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tconn.Close()\n\t\t}\n\t}\n}", "func getInput() (string, error) {\n\ttext, err := reader.ReadString('\\n')\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn strings.TrimSpace(text), nil\n}", "func main() {\n\n\treader := bufio.NewReader(os.Stdin)\n\n\tfor {\n\t\tfmt.Print(\"Enter command: \")\n\t\tif line, err := reader.ReadString('\\n'); err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t} else {\n\t\t\tline = strings.TrimSpace(line)\n\t\t\targs := strings.Split(line, \" \")\n\t\t\tif fn, ok := commandMap[args[0]]; !ok {\n\t\t\t\tfmt.Println(\"Invalid Command.\")\n\t\t\t} else {\n\t\t\t\tfn(args[1:])\n\t\t\t}\n\t\t}\n\t}\n}", "func (s *statistics) Read(input snreader.InputItf) {\n\tlex := read(input)\n\tif strings.Contains(lex.Value, \"\\n\") {\n\t\tspls := strings.Split(lex.Value, \"\\n\")\n\t\ts.col = strLen(spls[len(spls)-1])\n\t\ts.line += len(spls) - 1\n\t} else {\n\t\ts.col += strLen(lex.Value)\n\t}\n}", "func (s *MailStruct) readData() error {\n\tdata, err := ioutil.ReadAll(os.Stdin)\n\ts.MailData = data\n\treturn err\n}", "func (p *Player) readLoop() {\n\tfor p.Scan() {\n\t\tp.handleCmd(p.Text())\n\t}\n\terr := p.Err()\n\tif err != nil {\n\t\tlog.Printf(\"Error reading from user %v: %v\", p.Name, err)\n\t}\n\tp.exit(err)\n}", "func (p *program) doReadInput(i *instruction) {\n var input int64\n channelReadOk := false\n\n if p.inChannel != nil {\n select {\n case <-time.After(10 * time.Second):\n fmt.Println(\"waiting for input timed-out, trying to read from dataStack\")\n case input = <-p.inChannel:\n channelReadOk = true\n }\n }\n\n if !channelReadOk {\n if len(p.dataStack) > 0 {\n input = p.dataStack[len(p.dataStack)-1]\n p.dataStack = p.dataStack[:len(p.dataStack)-1]\n } else {\n reader := bufio.NewReader(os.Stdin)\n fmt.Print(\"Enter value: \")\n value, err := reader.ReadString('\\n')\n\n if err != nil {\n fmt.Println(err)\n }\n\n inputInt, err := strconv.Atoi(strings.TrimSuffix(value, \"\\n\"))\n\n if err != nil {\n fmt.Println(err)\n }\n\n input = int64(inputInt)\n }\n }\n\n p.memory[i.params[0].value] = input\n p.position += i.length\n}", "func Import(in *bufio.Reader)", "func getInput(filename string) ([]string, error) {\n\tbody, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinput := strings.Split(string(body), \"\\n\")\n\n\treturn input, nil\n}", "func GetInput(sorted bool) []string {\n\treader := getPipeReader()\n\tvar input []string\n\n\tfor {\n\t\tlineBytes, _, err := reader.ReadLine()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tlineString := string(lineBytes)\n\t\tinput = append(input, lineString)\n\t}\n\n\tif sorted {\n\t\tsort.Strings(input)\n\t}\n\treturn input\n}", "func readGame(fname string) (*Game, error) {\n\tfile, err := os.Open(fname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tscanner := bufio.NewScanner(file)\n\tb := NewGame()\n\tfor row := 0; row < DIM; row++ {\n\t\tif !scanner.Scan() {\n\t\t\treturn nil, fmt.Errorf(\"EOF while reading row %v\", row+1)\n\t\t}\n\t\tline := scanner.Text()\n\t\tif err := scanner.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcol := 0\n\t\tfor _, c := range line {\n\t\t\t// ASCII values 48..57 represent 0..9\n\t\t\tif 48 <= c && c <= 57 {\n\t\t\t\t// c is numeric\n\t\t\t\tif c > 0 {\n\t\t\t\t\tb.MakeMove(row, col, int(c-48))\n\t\t\t\t}\n\t\t\t\tcol++\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn b, nil\n}", "func read(in *bufio.Reader) (*world.World, map[string]interface{}, error) {\n\tw, err := world.Read(in)\n\tif err != nil {\n\t\treturn nil, nil, errors.New(\"Error reading world: \" + err.Error())\n\t}\n\tgame := make(map[string]interface{})\n\terr = json.NewDecoder(in).Decode(&game)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, nil, errors.New(\"Error reading game: \" + err.Error())\n\t}\n\treturn w, game, nil\n}", "func LoadInput(filepath string) (puzzle.Puzzle, error) {\n\tvar nums puzzle.Puzzle\n\n\tbytes, err := ioutil.ReadFile(filepath)\n\tif err != nil {\n\t\treturn nums, err\n\t}\n\n\tlines := strings.Split(string(bytes), \"\\n\")\n\tfor lineNum, line := range lines {\n\t\tif len(line) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tset, err := splitLine(line)\n\t\tif err != nil {\n\t\t\treturn nums, err\n\t\t}\n\t\tnums[lineNum] = set\n\t}\n\n\treturn nums, nil\n}", "func askForPlacement(reader *bufio.Reader) (int, int, error) {\n\tfmt.Print(\"column: \")\n\tcolumnString, err := reader.ReadString('\\n')\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\n\tfmt.Print(\"row: \")\n\trowString, err := reader.ReadString('\\n')\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\n\t// make sure to trim all whitespace\n\tcolumnString = strings.TrimSpace(columnString)\n\trowString = strings.TrimSpace(rowString)\n\n\tcolumn, err := strconv.Atoi(columnString)\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\trow, err := strconv.Atoi(rowString)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn column, row, nil\n}", "func (s *server) readCommand(client *client) ([]byte, error) {\n\t//var input string\n\tvar err error\n\tvar bs []byte\n\t// In command state, stop reading at line breaks\n\tbs, err = client.bufin.ReadSlice('\\n')\n\tif err != nil {\n\t\treturn bs, err\n\t} else if bytes.HasSuffix(bs, []byte(commandSuffix)) {\n\t\treturn bs[:len(bs)-2], err\n\t}\n\treturn bs[:len(bs)-1], err\n}", "func input(cmd_chan chan string) {\n\tin := bufio.NewReader(os.Stdin)\n\n\tlog(\"\")\n\tfor {\n\t\tif cmd, err := in.ReadString('\\n'); err == nil && cmd != \"\\n\" {\n\t\t\tcmd_chan <- strings.Trim(cmd, \"\\n\")\n\t\t}\n\t\tlogPrompt()\n\t}\n}", "func main() {\n bufSize := 4096\n buf := make([]byte, bufSize)\n for n, err := os.Stdin.Read(buf); err == nil && err != os.EOF; \n n, err = os.Stdin.Read(buf) {\n start := 0\n for i, c := range buf[0:n] {\n if c == ' ' || c == '\\n' {\n fmt.Printf(\"%s \", buf[start:i])\n start = i + 1;\n }\n }\n n = 0\n }\n}", "func main() {\n\tscanner := bufio.NewScanner(os.Stdin)\n\tscanner.Buffer(make([]byte, 1000000), 1000000)\n\n\tvar N int\n\tscanner.Scan()\n\tfmt.Sscan(scanner.Text(), &N)\n\n\tfor i := 0; i < N; i++ {\n\t\tscanner.Scan()\n\t\t//room := scanner.Text()\n\t}\n\n\t// fmt.Fprintln(os.Stderr, \"Debug messages...\")\n\tfmt.Println(\"answer\") // Write answer to stdout\n}", "func ReadConstraints(r *bufio.Reader) (int, int) {\n\tline, err := r.ReadBytes('\\n')\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tlineString := strings.TrimSuffix(string(line), \"\\n\")\n\tallNums := strings.Split(lineString, \" \")\n\tn, err := strconv.Atoi(allNums[0])\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tt, err := strconv.Atoi(allNums[1])\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn n, t\n}", "func NewIn(in io.ReadCloser) *In {\n\ti := &In{in: in}\n\ti.fd, i.isTerminal = term.GetFdInfo(in)\n\treturn i\n}", "func (term *Terminal) setup(buf *Buffer, in io.Reader) (*bufio.Reader, error) {\n\tcols, _, err := TerminalSize(buf.Out)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbuf.Cols = cols\n\tinput := bufio.NewReader(in)\n\n\terr = buf.Refresh()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn input, nil\n}", "func readKB() {\n\treader := bufio.NewReader(os.Stdin)\n\n\tfor {\n\t\tstrRead, _ := reader.ReadString('\\n')\n\t\ttextToSend = strings.TrimSuffix(strRead, \"\\n\")\n\t}\n\n}", "func readInput(prompt string) []int {\n\treader := bufio.NewReader(os.Stdin)\n\tfmt.Print(prompt)\n\tinputString, _ := reader.ReadString('\\n')\n\n\tnumbers := make([]int, len(inputString)-1)\n\tfor i := 0; i < len(inputString)-1; i++ {\n\t\tnumbers[i] = int(inputString[i]) - 48\n\t}\n\treturn numbers\n}" ]
[ "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.5019048", "0.5007098", "0.5006956", "0.50046486", "0.4999476", "0.49936023", "0.499297", "0.49925292", "0.49759537", "0.49397078", "0.4930607", "0.49248567", "0.4915956", "0.4913241", "0.4897194", "0.48923665", "0.48897585", "0.48888206", "0.48867545", "0.48806193", "0.4878375", "0.48738217", "0.48714626", "0.48667404", "0.48536047", "0.48403916", "0.48331085", "0.48251843", "0.48242447", "0.48038357", "0.47904155", "0.4787604", "0.47876027", "0.47812682", "0.4780138", "0.47797865", "0.47765476", "0.4769431", "0.4757936", "0.47557443", "0.474523", "0.47341436", "0.47271353", "0.4727066", "0.47159696", "0.4713949", "0.4703935", "0.46923175", "0.46885547", "0.46865436", "0.46834752", "0.46741608", "0.46685824", "0.4666299", "0.46638432", "0.4659966", "0.46589372", "0.4657907", "0.4656653", "0.46312514", "0.46243545", "0.4621318", "0.46170783", "0.46079248", "0.45948273", "0.45927674", "0.4582946", "0.4582389", "0.45806283", "0.4574886", "0.45619383", "0.45616856", "0.4560575", "0.45565528", "0.454574", "0.45454034", "0.45423213", "0.4534246", "0.45288855", "0.45287767" ]
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 := field.Type()\n\n\t\tif fieldType.ConvertibleTo(byteSliceType) {\n\t\t\tb := field.Convert(byteSliceType).Interface().([]byte)\n\t\t\treturn json.Valid(b)\n\t\t}\n\t}\n\n\tpanic(fmt.Sprintf(\"Bad field type %T\", field.Interface()))\n}", "func parseString(cur *GoJSON, input []byte) ([]byte, error) {\n\tvar offset int\n\n\tif len(input) == 0 {\n\t\terrorStr := fmt.Sprintf(\"%s: Byte slice is empty\", funcName())\n\t\treturn []byte{}, errors.New(errorStr)\n\t}\n\n\tif input[0] != '\"' {\n\t\terrorStr := fmt.Sprintf(\"%s: Not a valid string in input %s\", funcName(), string(input))\n\t\treturn nil, errors.New(errorStr)\n\t}\n\n\tfor i := range input {\n\t\tif i > 0 && input[i] == '\"' {\n\t\t\tbreak\n\t\t} else {\n\t\t\toffset++\n\t\t}\n\t}\n\n\tcur.Jsontype = JSON_STRING\n\tcur.Valstr = strings.Trim(string(input[1:offset]), \" \")\n\n\treturn input[offset+1:], nil\n}", "func BeJSON(actual interface{}, expected ...interface{}) (fail string) {\n\tusage := \"BeJson expects a single string argument and passes if that argument parses as JSON.\"\n\tif actual == nil {\n\t\treturn usage\n\t}\n\t_, err := parseJSON(actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\treturn \"\"\n}", "func dummyJSONStr() string {\n\treturn `{\n \"number\": 1234.56,\n \"string\": \"foo bar\",\n \"arrayOfString\": [\n \"one\",\n \"two\",\n \"three\",\n \"four\"\n ],\n \"object\": {\n \"foo\": \"bar\",\n \"hello\": \"world\",\n \"answer\": 42\n },\n \"true\": true,\n \"false\": false,\n \"null\": null\n }`\n}", "func TestValidateJSON1(t *testing.T) {\n\tinput := map[string]interface{}{\n\t\t\"foo\": map[interface{}]interface{}{\n\t\t\t\"bar\": 1234,\n\t\t},\n\t}\n\n\toutput := validateJSON(input)\n\n\tif tmp1, ok := output.(map[string]interface{}); ok {\n\t\tif fooEntry, found := tmp1[\"foo\"]; found {\n\t\t\ttmp2, ok := fooEntry.(map[string]interface{})\n\t\t\tif ok {\n\t\t\t\tif barEntry, found := tmp2[\"bar\"]; found {\n\t\t\t\t\tif barEntry.(int) != 1234 {\n\t\t\t\t\t\tt.Errorf(\"barEntry Does Not Match Input\")\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tt.Errorf(\"Returned Validated JSON Is Invalid: Missing Key 'bar'\")\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tt.Errorf(\"Returned Validated JSON Is Invalid: tmp2\")\n\t\t\t}\n\t\t} else {\n\t\t\tt.Errorf(\"Returned Validated JSON Is Invalid: Missing Key 'foo'\")\n\t\t}\n\t} else {\n\t\tt.Errorf(\"Returned Validated JSON Is Invalid: tmp1\")\n\t}\n}", "func (this *jsonObjectInput) constructInput(contents ...interface{}) []interface{} {\n\tcontentList := make([]interface{}, len(contents))\n\tfor i, content := range contents {\n\t\tcontentList[i] = content\n\t}\n\treturn contentList\n}", "func (this *jsonEncodedInput) constructInput(contents ...interface{}) []interface{} {\n\tcontentList := make([]interface{}, len(contents))\n\tfor i := 0; i < len(contents); i++ {\n\t\tcontentList[i] = &[]byte{}\n\t}\n\treturn contentList\n}", "func JSON(raw []byte, limit uint32) bool {\n\traw = trimLWS(raw)\n\t// #175 A single JSON string, number or bool is not considered JSON.\n\t// JSON objects and arrays are reported as JSON.\n\tif len(raw) < 2 || (raw[0] != '[' && raw[0] != '{') {\n\t\treturn false\n\t}\n\tparsed, err := json.Scan(raw)\n\t// If the full file content was provided, check there is no error.\n\tif limit == 0 || len(raw) < int(limit) {\n\t\treturn err == nil\n\t}\n\n\t// If a section of the file was provided, check if all of it was parsed.\n\treturn parsed == len(raw) && len(raw) > 0\n}", "func parseJSONString(input string) aws.JSONValue {\n\tvar v aws.JSONValue\n\tif err := json.Unmarshal([]byte(input), &v); err != nil {\n\t\tpanic(fmt.Sprintf(\"unable to unmarshal JSONValue, %v\", err))\n\t}\n\treturn v\n}", "func jsonString(b []byte) string {\n\ts := string(b)\n\tif s == \"\" {\n\t\treturn \"{}\"\n\t}\n\treturn s\n}", "func (in *Input) UnmarshalJSON(data []byte) error {\n\t// TODO(someday): Deal with deeply nested JSON.\n\n\tif len(data) == 0 {\n\t\treturn xerrors.New(\"unmarshal input json: empty\")\n\t}\n\tswitch {\n\tcase data[0] == '{':\n\t\tvar m map[string]Input\n\t\tif err := json.Unmarshal(data, &m); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tin.val = m\n\tcase data[0] == '[':\n\t\tvar l []Input\n\t\tif err := json.Unmarshal(data, &l); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tin.val = l\n\tcase data[0] == '\"':\n\t\tvar s string\n\t\tif err := json.Unmarshal(data, &s); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tin.val = s\n\tcase bytes.Equal(data, []byte(\"null\")):\n\t\tin.val = nil\n\tdefault:\n\t\t// A literal of some sort: number or boolean.\n\t\tin.val = string(data)\n\t}\n\treturn nil\n}", "func IsJSON(str Item) bool {\n\tvar js json.RawMessage\n\treturn json.Unmarshal([]byte(str), &js) == nil\n}", "func parseJSON(c *gin.Context, dst interface{}) error {\n\terr := c.ShouldBindJSON(dst)\n\tif err != nil {\n\t\treturn ErrInvalidJSONInput\n\t}\n\n\treturn nil\n}", "func BeJSONAPI(actual interface{}, expected ...interface{}) (fail string) {\n\tusage := \"BeJSONAPIArray expects a single string argument and passes if that argument parses as a JSONAPI return value.\"\n\tif actual == nil {\n\t\treturn usage\n\t}\n\tjson, err := parseJSON(actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\tif HaveFields(json, \"data\", reflect.Slice) == \"\" {\n\t\treturn BeJSONAPIArray(actual, expected)\n\t}\n\treturn BeJSONAPIRecord(actual, expected)\n}", "func IsJSON(s string) bool {\n\tif s == \"\" {\n\t\treturn false\n\t}\n\n\treturn json.ConfigCompatibleWithStandardLibrary.Valid(Bytes(s))\n}", "func test_Json() {\n\t// data := []byte(`{\"foo\":\"bar\"}`)\n // r := bytes.NewReader(data)\n // resp, err := http.Post(\"http://example.com/upload\", \"application/json\", r)\n \n // if err != nil {\n // return \n // }\n // defer resp.Close()\n}", "func StringsToJSON(input string) string {\n\trs := []rune(input)\n\tjsons := \"\"\n\n\tfor _, r := range rs {\n\t\trint := int(r)\n\t\tif rint < 128 {\n\t\t\tjsons += string(r)\n\t\t} else {\n\t\t\tjsons += \"\\\\u\" + strconv.FormatInt(int64(rint), 16) // json\n\t\t}\n\t}\n\n\treturn jsons\n}", "func mustJSON(thing interface{}) string {\n\ts, err := json.Marshal(thing)\n\tif err != nil {\n\t\treturn \"invalid json: \" + err.Error()\n\t}\n\treturn string(s)\n}", "func BeJSONAPIArray(actual interface{}, expected ...interface{}) (fail string) {\n\tusage := \"BeJSONAPIArray expects a single string argument and passes if that argument parses as a JSONAPI multi-object array.\"\n\tif actual == nil {\n\t\treturn usage\n\t}\n\tjson, err := parseJSON(actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\tFailFirst(\n\t\tNotJSONAPIError(json),\n\t\tHaveFields(json, \"meta\", reflect.Map, \"data\", reflect.Slice),\n\t\tHaveOnlyFields(json, \"meta\", reflect.Map, \"data\", reflect.Slice, \"links\", reflect.Map, \"included\", reflect.Slice),\n\t\tBeValidRecordArray(json.Search(\"data\")),\n\t\t// check links\n\t\t// check includes\n\t)\n\n\treturn\n}", "func JsonString(data string) (*Typed, error) {\n\treturn Json([]byte(data))\n}", "func JSON(str string) bool {\n\tvar js json.RawMessage\n\treturn json.Unmarshal([]byte(str), &js) == nil\n}", "func IsString(input []byte) bool {\n\treturn len(input) >= 2 && input[0] == '\"' && input[len(input)-1] == '\"'\n\n}", "func CleanupJSON(input interface{}) interface{} {\n\tif inputMap, ok := input.(map[string]interface{}); ok {\n\t\tnewMap := make(map[string]interface{})\n\t\tfor key, value := range inputMap {\n\t\t\tswitch v := value.(type) {\n\t\t\tcase string:\n\t\t\t\t// Strings must not be empty\n\t\t\t\tif v != \"\" {\n\t\t\t\t\tnewMap[key] = value\n\t\t\t\t}\n\t\t\tcase []interface{}:\n\t\t\t\t// Arrays must not be empty\n\t\t\t\tif len(v) > 0 {\n\t\t\t\t\tvar newArray []interface{} = nil\n\t\t\t\t\tfor _, value := range v {\n\t\t\t\t\t\tnewArray = append(newArray, CleanupJSON(value))\n\t\t\t\t\t}\n\t\t\t\t\tnewMap[key] = newArray\n\t\t\t\t}\n\t\t\tcase map[string]interface{}:\n\t\t\t\t// Objects must not be empty\n\t\t\t\tif len(v) > 0 {\n\t\t\t\t\tnewMapValue := CleanupJSON(value).(map[string]interface{})\n\t\t\t\t\tif len(newMapValue) > 0 {\n\t\t\t\t\t\tnewMap[key] = newMapValue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tif value != nil {\n\t\t\t\t\tnewMap[key] = value\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn newMap\n\t}\n\treturn input\n}", "func RequireJSON(w http.ResponseWriter, r *http.Request, data interface{}) bool {\n\terr := json.NewDecoder(r.Body).Decode(data)\n\tif err != nil {\n\t\thttp.Error(w, \"request body is not valid JSON: \"+err.Error(), 400)\n\t\treturn false\n\t}\n\treturn true\n}", "func IsStringJSON(str string) bool {\n\tvar devNull interface{}\n\terr := json.Unmarshal([]byte(str), &devNull)\n\treturn err == nil\n}", "func isJSON(s string) bool {\n\tvar js json.RawMessage\n\treturn json.Unmarshal([]byte(s), &js) == nil\n}", "func assertPostJSON(t *testing.T, expected interface{}, req *http.Request) {\n\tvar actual interface{}\n\n\td := json.NewDecoder(req.Body)\n\td.UseNumber()\n\n\terr := d.Decode(&actual)\n\tassert.NoError(t, err)\n\tassert.EqualValues(t, expected, actual)\n}", "func isJsonDataValidAlarm (data []byte) {\r\n if(json.Valid([]byte(data)) == false){\r\n \tpanic(\"invalid json data\")\r\n }\r\n}", "func getErrOfMalformedInput(v interface{}, excludedFields []string) string {\n\terrInfo := make(map[string]string)\n\n\tval := reflect.ValueOf(v).Elem()\n\tfor i := 0; i < val.NumField(); i++ {\n\n\t\tfld := val.Type().Field(i)\n\n\t\tif helpers.StrSliceIndexOf(excludedFields, fld.Name) == -1 {\n\t\t\tjsonFldName := fld.Tag.Get(\"json\")\n\t\t\tif jsonFldName == \"\" {\n\t\t\t\tjsonFldName = fld.Name\n\t\t\t}\n\n\t\t\t// errInfo[jsonFldName] = fld.Type.Kind().String()\n\n\t\t\terrInfo[jsonFldName] = getSimpleType(fld.Type)\n\t\t}\n\t}\n\t/**/\n\tresErrText := \"Malformed payload.\"\n\terrInfoTxt, err := json.Marshal(errInfo)\n\tif err == nil {\n\t\treturn resErrText + \" The payload should look like: \\n\" + string(errInfoTxt)\n\t}\n\n\treturn resErrText\n}", "func isJSON(s string) bool {\n\tvar js interface{}\n\treturn json.Unmarshal([]byte(s), &js) == nil\n}", "func IsJSON(s string) bool {\n\tif s == \"\" {\n\t\treturn false\n\t}\n\n\tvar js json.RawMessage\n\treturn Unmarshal([]byte(s), &js) == nil\n}", "func isJSON(payload []byte) (interface{}, error) {\n\tvar p interface{}\n\tvar err error\n\t//decode json\n\terr = json.Unmarshal(payload, &p)\n\treturn p, err\n}", "func JSONString(e interface{}) string {\n\treturn string(JSON(e))\n}", "func validateJSON(next http.HandlerFunc) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tjsonBytes, err := ioutil.ReadAll(r.Body)\n\t\tr.Body = ioutil.NopCloser(bytes.NewBuffer(jsonBytes))\n\t\tif len(jsonBytes) > 0 {\n\t\t\tif !json.Valid(jsonBytes) || err != nil {\n\t\t\t\tlogFailure(\"INVALID_JSON\", w, r, 0)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tnext.ServeHTTP(w, r)\n\t}\n}", "func ShouldJSONEqual(actual interface{}, expected ...interface{}) error {\n\tif err := need(1, expected); err != nil {\n\t\treturn err\n\t}\n\n\tswitch actual.(type) {\n\tcase map[string]interface{}:\n\t\tactualMap, err := cast.ToStringMapE(actual)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\texpectedString, err := cast.ToStringE(expected[0])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Marshal and unmarshal for later deepequal to work\n\t\tactualBytes, err := json.Marshal(actualMap)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = json.Unmarshal(actualBytes, &actualMap)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\texpectedMap := map[string]interface{}{}\n\t\terr = json.Unmarshal([]byte(expectedString), &expectedMap)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif reflect.DeepEqual(actualMap, expectedMap) {\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"expected '%v' to be JSON equals to '%v' \", actualMap, expectedMap)\n\tcase []interface{}:\n\t\tactualSlice, err := cast.ToSliceE(actual)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\texpectedString, err := cast.ToStringE(expected[0])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Marshal and unmarshal for later deepequal to work\n\t\tactualBytes, err := json.Marshal(actualSlice)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = json.Unmarshal(actualBytes, &actualSlice)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\texpectedSlice := []interface{}{}\n\t\terr = json.Unmarshal([]byte(expectedString), &expectedSlice)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif reflect.DeepEqual(actualSlice, expectedSlice) {\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"expected '%v' to be JSON equals to '%v' \", actualSlice, expectedSlice)\n\tcase string:\n\t\tactualString, err := cast.ToStringE(actual)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\texpectedString, err := cast.ToStringE(expected[0])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif actualString == expectedString {\n\t\t\treturn nil\n\t\t}\n\t\t// Special case: Venom passes an empty string when `actual` JSON is JSON's `null`.\n\t\t// Above check is already valid when `expected` is an empty string, but\n\t\t// the user might have passed `null` explicitly.\n\t\t// TODO: This should be changed as soon as Venom passes Go's `nil` for JSON `null` values.\n\t\tif actualString == \"\" && expectedString == \"null\" {\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"expected '%v' to be JSON equals to '%v' \", actualString, expectedString)\n\tcase json.Number:\n\t\tactualFloat, err := cast.ToFloat64E(actual)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\texpectedFloat, err := cast.ToFloat64E(expected[0])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif actualFloat == expectedFloat {\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"expected '%v' to be JSON equals to '%v' \", actualFloat, expectedFloat)\n\tcase bool:\n\t\tactualBool, err := cast.ToBoolE(actual)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\texpectedBool, err := cast.ToBoolE(expected[0])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif actualBool == expectedBool {\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"expected '%v' to be JSON equals to '%v' \", actualBool, expectedBool)\n\tdefault:\n\t\treturn fmt.Errorf(\"unexpected type for actual: %T\", actual)\n\t}\n}", "func TestInvalidJSON(t *testing.T) {\n\tjson := `{\"action\":jump\", \"time\":100}`\n\t_, err := ParseEventJSON(json)\n\tif err == nil {\n\t\tt.Errorf(\"JSON parsing of %v should have generated error, but didn't\", json)\n\t}\n}", "func (jp *JsonPrinter) isString(line string) bool {\n\treturn strings.HasPrefix(line, `\"`) && (strings.HasSuffix(line, `\"`) || strings.HasSuffix(line, `\",`))\n}", "func mustFromJson(v string) (interface{}, error) {\n\tvar output interface{}\n\terr := json.Unmarshal([]byte(v), &output)\n\treturn output, err\n}", "func JsonStringArray(data string) ([]*Typed, error) {\n\treturn JsonArray([]byte(data))\n}", "func isJSON(s []byte) (bool, map[string]interface{}) {\n\tvar js map[string]interface{}\n\treturn json.Unmarshal([]byte(s), &js) == nil, js\n}", "func isValidSyncJSON(s string) error {\n\tvar js map[string]interface{}\n\tif json.Unmarshal([]byte(s), &js) == nil {\n\t\t//TODO check if data is valid sync data\n\t\treturn nil\n\t} else {\n\t\treturn errors.New(\"Invalid JSON\")\n\t}\n}", "func ValidateInputs(dataSet interface{}) (bool, string) {\n\n\tvar validate *validator.Validate\n\n\tvalidate = validator.New()\n\n\terr := validate.Struct(dataSet)\n\n\tif err != nil {\n\n\t\t//Validation syntax is invalid\n\t\tif err, ok := err.(*validator.InvalidValidationError); ok {\n\t\t\tpanic(err)\n\t\t}\n\n\t\t//Validation errors occurred\n\t\tvar errString string\n\n\t\treflected := reflect.ValueOf(dataSet)\n\n\t\tfor _, err := range err.(validator.ValidationErrors) {\n\n\t\t\t// Attempt to find field by name and get json tag name\n\t\t\tfield, _ := reflected.Type().FieldByName(err.StructField())\n\t\t\tvar name string\n\t\t\t//If json tag doesn't exist, use lower case of name\n\t\t\tif name = field.Tag.Get(\"json\"); name == \"\" {\n\t\t\t\tname = strings.ToLower(err.StructField())\n\t\t\t}\n\n\t\t\tswitch err.Tag() {\n\t\t\tcase \"required\":\n\t\t\t\terrString = \"The \" + name + \" is required\"\n\t\t\t\tbreak\n\t\t\tcase \"email\":\n\t\t\t\terrString = \"The \" + name + \" should be a valid email\"\n\t\t\t\tbreak\n\t\t\tcase \"eqfield\":\n\t\t\t\terrString = \"The \" + name + \" should be equal to the \" + err.Param()\n\t\t\t\tbreak\n\t\t\tdefault:\n\n\t\t\t\terrString = \"The \" + name + \" is invalid\"\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn false, errString\n\t}\n\treturn true, \"\"\n}", "func TestConvertBatchJSON(t *testing.T) {\n\tt.Log(\"Converting a 3 events to JSON to check\")\n\n\tevents := []*Event{GetTestEvent(97421193), GetTestEvent(197421199), GetTestEvent(7421191)}\n\tb, err := ConvertBatchJSON(events)\n\tif err != nil {\n\t\tt.Errorf(\"Batch JSON conversion is failed: %s\", err.Error())\n\t}\n\tfor i := range events {\n\t\tline, _ := b.ReadString('\\n')\n\t\tsb, _ := ConvertJSON(events[i])\n\t\tif sb.String() != line {\n\t\t\tt.Errorf(\"Line mismatch, expected was `%s` but it was `%s`\", sb, line)\n\t\t}\n\t}\n}", "func TestJSON(t *testing.T) {\n\n\tsrcJSON := []byte(`{\"float\": 1.2, \"int\": 1, \"bool\": true, \"array\":[\"apple\", 2]}`)\n\tvar m map[string]interface{}\n\terr := json.Unmarshal(srcJSON, &m)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tfmt.Printf(\"%T, %T, %T, %T, %T %T\\n\", m[\"float\"], m[\"int\"], m[\"bool\"], m[\"array\"], m[\"array\"].([]interface{})[0], m[\"array\"].([]interface{})[1])\n}", "func assertPostJSONValue(t *testing.T, expected interface{}, req *http.Request) {\n\tvar actual interface{}\n\n\td := json.NewDecoder(req.Body)\n\td.UseNumber()\n\n\terr := d.Decode(&actual)\n\tassert.NoError(t, err)\n\tassert.ObjectsAreEqualValues(expected, actual)\n}", "func TestJSONStringifiedNumbers(t *testing.T) {\n\tif testing.Short() {\n\t\tt.Skip(\"Skipping integration tests in short mode\")\n\t}\n\tc, _ := minikubetestenv.AcquireCluster(t)\n\trequire.NoError(t, tu.PachctlBashCmd(t, c, `\n\t\tyes | pachctl delete all\n\t\tpachctl create repo input\n\t\tpachctl create pipeline -f - <<EOF\n\t\t{\n\t\t \"pipeline\": {\n\t\t \"name\": \"first\"\n\t\t },\n\t\t \"input\": {\n\t\t \"pfs\": {\n\t\t \"glob\": \"/*\",\n\t\t \"repo\": \"input\"\n\t\t }\n\t\t },\n\t\t \"parallelism_spec\": {\n\t\t \"constant\": \"1\"\n\t\t },\n\t\t \"transform\": {\n\t\t \"cmd\": [ \"/bin/bash\" ],\n\t\t \"stdin\": [\n\t\t \"cp /pfs/input/* /pfs/out\"\n\t\t ]\n\t\t }\n\t\t}\n\t\tEOF\n\n\t\tpachctl start commit input@master\n\t\techo foo | pachctl put file input@master:/foo\n\t\techo bar | pachctl put file input@master:/bar\n\t\techo baz | pachctl put file input@master:/baz\n\t\tpachctl finish commit input@master\n\t\tpachctl wait commit first@master\n\t\tpachctl get file first@master:/foo | match foo\n\t\tpachctl get file first@master:/bar | match bar\n\t\tpachctl get file first@master:/baz | match baz\n\t\t`,\n\t).Run())\n\trequire.NoError(t, tu.PachctlBashCmd(t, c, `pachctl list pipeline`).Run())\n}", "func isJSON(p string) bool {\n\treturn p[len(p)-4:] == \"json\"\n}", "func isJSON(fileBytes []byte) bool {\n\tfor _, b := range fileBytes {\n\t\tif !unicode.IsSpace(rune(b)) {\n\t\t\treturn b == '{'\n\t\t}\n\t}\n\treturn false\n}", "func (Quantity) OpenAPIV3OneOfTypes() []string { return []string{\"string\", \"number\"} }", "func (req *request) IsJSON() bool {\n return req.json != nil\n}", "func isJSONIdx(s string) (string, bool) {\n\tif len(s) > 2 && s[0] == '[' && s[len(s)-1] == ']' && (isNumber(s[1:len(s)-1]) || s[1] == '#' && isNumber(s[2:len(s)-1])) {\n\t\treturn s[1 : len(s)-1], true\n\t}\n\treturn \"\", false\n}", "func parseValue(cur *GoJSON, input []byte) ([]byte, error) {\n\tinput = nextToken(input)\n length := len(input)\n\n\tif length == 0 {\n cur.Jsontype = JSON_NULL\n return input[:], nil\n\t}\n\n\tif length >= 4 &&\n strings.Compare(string(input[:4]), \"null\") == 0 {\n\t\tcur.Jsontype = JSON_NULL\n\t\treturn input[4:], nil\n\t}\n\n\tif length >= 5 && strings.Compare(string(input[:5]), \"false\") == 0 {\n\t\tcur.Jsontype = JSON_BOOL\n\t\tcur.Valbool = false\n\t\treturn input[5:], nil\n\t}\n\n\tif length >= 4 && strings.Compare(string(input[:4]), \"true\") == 0 {\n\t\tcur.Jsontype = JSON_BOOL\n\t\tcur.Valbool = true\n\t\treturn input[4:], nil\n\t}\n\n\tif input[0] >= '0' && input[0] <= '9' {\n\t\treturn parseNumber(cur, input)\n\t}\n\n\tswitch input[0] {\n\tcase '\"':\n\t\treturn parseString(cur, input)\n\n\tcase '-':\n\t\treturn parseNumber(cur, input)\n\n\tcase '[':\n\t\treturn parseArray(cur, input)\n\n\tcase '{':\n\t\treturn parseObject(cur, input)\n\n\t}\n\n\terrorStr := fmt.Sprintf(\"%s: Parsing Error\", funcName())\n\treturn []byte{}, errors.New(errorStr)\n}", "func (u *Util) IsJSON(s interface{}) bool {\n\tjs, _ := u.JSONParse(s)\n\treturn js != nil\n}", "func ParseJsonInput(input string) ([]parser_struct.UpdatedRepo, error) {\n\t//takes care of empty json Deployment (use case where we redeploy using same app spec)\n\tvar allRepos []parser_struct.UpdatedRepo\n\terr := json.Unmarshal([]byte(input), &allRepos)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error in parsing json data from file\")\n\t}\n\treturn allRepos, nil\n}", "func Write(input interface{}) ([]byte, error) {\n\treturn json.Marshal(input)\n}", "func IsJSON(str string) bool {\n\tvar js json.RawMessage\n\treturn json.Unmarshal([]byte(str), &js) == nil\n}", "func (res *result) toJSON(ptr interface{}) bool {\n\tif err := json.Unmarshal([]byte(res.stdout), ptr); err != nil {\n\t\tres.t.Errorf(\"invalid JSON %v\", err)\n\t\treturn false\n\t}\n\treturn true\n}", "func (sc *SmartContract) ValidateObjectIntegrity(jsonInput string) (bool, string, []interface{}) {\n\n\tvar errMsgBuf bytes.Buffer\n\tvar inputObject interface{}\n\tparsedObjects := make([]interface{}, 0)\n\tjson.Unmarshal([]byte(jsonInput), &inputObject)\n\tswitch inputObject.(type) {\n\tcase []interface{}:\n\t\t_SC_LOGGER.Info(\"Array detected\")\n\t\tallGood := true\n\n\t\tfor index, item := range inputObject.([]interface{}) {\n\t\t\tisGood := sc.CheckObjects(item)\n\t\t\tallGood = allGood && isGood\n\t\t\tif !isGood {\n\t\t\t\terrMsgBuf.WriteString(fmt.Sprintf(\"\\\"Object type missing for %d\\\",\", index))\n\t\t\t}\n\t\t\tparsedObjects = append(parsedObjects, item)\n\t\t}\n\n\t\treturn allGood, errMsgBuf.String(), parsedObjects\n\tcase interface{}:\n\t\t_SC_LOGGER.Info(\"Object detected\")\n\t\tisGood := sc.CheckObjects(inputObject)\n\t\tif !isGood {\n\t\t\terrMsgBuf.WriteString(\"Object type missing\")\n\t\t}\n\t\tparsedObjects = append(parsedObjects, inputObject)\n\t\treturn isGood, errMsgBuf.String(), parsedObjects\n\tdefault:\n\t\t_SC_LOGGER.Info(\"Unkown data type\")\n\t}\n\n\treturn false, \"Unkown data type\", nil\n}", "func (f JSONField) Clean(value string) (interface{}, ValidationError) {\n\tvar js interface{}\n\te := json.Unmarshal([]byte(value), &js)\n\treturn js, e\n}", "func TestConvertJSON(t *testing.T) {\n\tt.Log(\"Converting a single event to JSON and back to check integrity\")\n\tevent := GetTestEvent(97421193)\n\tb, err := ConvertJSON(event)\n\tif err != nil {\n\t\tt.Errorf(\"JSON conversion failed %s\", err.Error())\n\t}\n\tjsonStr := b.String()\n\tif jsonStr[len(jsonStr)-1:] != \"\\n\" {\n\t\tt.Errorf(\"Converted JSON should contains a new line\")\n\t}\n\tvar copyEvent Event\n\tif err := json.Unmarshal([]byte(jsonStr), &copyEvent); err != nil {\n\t\tt.Errorf(\"JSON conversion failed %s\", err.Error())\n\t}\n\tif !reflect.DeepEqual(copyEvent, *event) {\n\t\tt.Errorf(\"JSON conversion is creating invalid JSON\")\n\t}\n}", "func AreEqualJSON(b1, b2 []byte) (bool, error) {\n\tvar o1 interface{}\n\tvar o2 interface{}\n\n\tvar err error\n\terr = json.Unmarshal(b1, &o1)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"Error mashalling string 1 :: %s\", err.Error())\n\t}\n\terr = json.Unmarshal(b2, &o2)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"Error mashalling string 2 :: %s\", err.Error())\n\t}\n\n\treturn reflect.DeepEqual(o1, o2), nil\n}", "func (_ Quantity) OpenAPISchemaType() []string { return []string{\"string\"} }", "func NdJSON(raw []byte, limit uint32) bool {\n\tlCount, hasObjOrArr := 0, false\n\tsc := bufio.NewScanner(dropLastLine(raw, limit))\n\tfor sc.Scan() {\n\t\tl := sc.Bytes()\n\t\t// Empty lines are allowed in NDJSON.\n\t\tif l = trimRWS(trimLWS(l)); len(l) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\t_, err := json.Scan(l)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\tif l[0] == '[' || l[0] == '{' {\n\t\t\thasObjOrArr = true\n\t\t}\n\t\tlCount++\n\t}\n\n\treturn lCount > 1 && hasObjOrArr\n}", "func isValidJSON(data []byte) bool {\n\tvar res interface{}\n\terr := json.Unmarshal(data, &res)\n\treturn err == nil\n}", "func (fd FieldData) JSON() (string, error) {\n\tdata, err := json.MarshalIndent(fd.values, \"\", \" \")\n\treturn string(data), err\n}", "func json2form(v interface{}) map[string]string {\n\tvalue := reflect.ValueOf(v)\n\tt := value.Type()\n\tparams := make(map[string]string)\n\tfor i := 0; i < value.NumField(); i++ {\n\t\tf := t.Field(i)\n\t\tname := f.Tag.Get(\"json\")\n\t\tfv := value.Field(i).Interface()\n\t\tif fv == nil {\n\t\t\tcontinue\n\t\t}\n\t\tswitch x := fv.(type) {\n\t\tcase *string:\n\t\t\tif x != nil {\n\t\t\t\tparams[name] = *x\n\t\t\t}\n\t\tcase string:\n\t\t\tif x != \"\" {\n\t\t\t\tparams[name] = x\n\t\t\t}\n\t\tcase int:\n\t\t\tif x != 0 {\n\t\t\t\tparams[name] = strconv.Itoa(x)\n\t\t\t}\n\t\tcase *bool:\n\t\t\tif x != nil {\n\t\t\t\tparams[name] = fmt.Sprintf(\"%v\", *x)\n\t\t\t}\n\t\tcase int64:\n\t\t\tif x != 0 {\n\t\t\t\tparams[name] = strconv.FormatInt(x, 10)\n\t\t\t}\n\t\tcase float64:\n\t\t\tparams[name] = fmt.Sprintf(\"%.2f\", x)\n\t\tcase []string:\n\t\t\tif len(x) > 0 {\n\t\t\t\tparams[name] = strings.Join(x, \" \")\n\t\t\t}\n\t\tcase map[string]string:\n\t\t\tfor mapkey, mapvalue := range x {\n\t\t\t\tparams[name+\"[\"+mapkey+\"]\"] = mapvalue\n\t\t\t}\n\t\tcase *Error:\n\t\t\t// do not turn into form values. This is for the return response only\n\t\tdefault:\n\t\t\t// ignore\n\t\t\tpanic(fmt.Errorf(\"Unknown field type: \" + value.Field(i).Type().String()))\n\t\t}\n\t}\n\treturn params\n}", "func mustToRawJson(v interface{}) (string, error) {\n\tbuf := new(bytes.Buffer)\n\tenc := json.NewEncoder(buf)\n\tenc.SetEscapeHTML(false)\n\terr := enc.Encode(&v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn strings.TrimSuffix(buf.String(), \"\\n\"), nil\n}", "func JSONFirstRowEquals(jsonString string, testVals map[string]interface{}) error {\n\tm, err := JSONUnmarshal(jsonString)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfirstRow := m[0].(map[string]interface{})\n\n\tfor k, v := range testVals {\n\t\tif fmt.Sprintf(\"%+v\", firstRow[k]) != fmt.Sprintf(\"%+v\", v) {\n\t\t\treturn fmt.Errorf(\"values for key %s do not match: expected '%+v' provided '%+v'\", k, v, firstRow[k])\n\t\t}\n\t}\n\n\treturn nil\n}", "func getInputValues(i []js.Value) (v1, v2 float64) {\n\tvalue1 := getStringValueById(i[0].String())\n\tvalue2 := getStringValueById(i[1].String())\n\tv1, _ = strconv.ParseFloat(value1, 64)\n\tv2, _ = strconv.ParseFloat(value2, 64)\n\treturn\n}", "func readPostAsJSON(rq *http.Request, i interface{}) error {\n\tdefer rq.Body.Close()\n\tb, err := ioutil.ReadAll(rq.Body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read POST body: %w\", err)\n\t}\n\treturn json.Unmarshal(b, i)\n}", "func (o *Textboterrorinputevent) String() string {\n \n \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "func (m *jsonValue) Scan(src interface{}) error {\n\tvar source []byte\n\tswitch src.(type) {\n\tcase string:\n\t\tsource = []byte(src.(string))\n\tcase []byte:\n\t\tsource = src.([]byte)\n\tdefault:\n\t\treturn errors.New(\"Incompatible type for jsonValue\")\n\t}\n\n\treturn json.Unmarshal(source, m.data)\n}", "func JSON(val interface{}) interface {\n\tdriver.Valuer\n\tsql.Scanner\n} {\n\treturn jsontype{val: val}\n}", "func JSONs(args [][]byte) ([]byte, error) {\n\tm := make(map[string]interface{})\n\tfor _, arg := range args {\n\t\tif _, err := ToMap(arg, m); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn FromMap(m)\n}", "func (v *JSONValue) IsString() bool {\n\tv.parseString()\n\treturn v.dataType == stringDataType\n}", "func (t *TestRuntime) GetDataWithInputTyped(path string, input interface{}, response interface{}) error {\n\n\tbs, err := t.GetDataWithInput(path, input)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn json.Unmarshal(bs, response)\n}", "func (in Input) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(in.val)\n}", "func My_json(demo interface{}) *bytes.Buffer {\r\n\tif bs, err := json.Marshal(demo); err == nil {\r\n\t\treq := bytes.NewBuffer([]byte(bs))\r\n\t\treturn req\r\n\t} else {\r\n\t\tpanic(err)\r\n\t}\r\n}", "func MustJSON(v interface{}) string {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn fmt.Sprintf(\"%v\", v)\n\t}\n\treturn string(b)\n}", "func JSON(e interface{}) []byte {\n\tcontents, err := json.Marshal(e)\n\tif err != nil {\n\t\treturn []byte{}\n\t}\n\n\treturn contents\n}", "func starlarkJSON(out *bytes.Buffer, v starlark.Value) error {\n\tswitch v := v.(type) {\n\tcase starlark.NoneType:\n\t\tout.WriteString(\"null\")\n\tcase starlark.Bool:\n\t\tfmt.Fprintf(out, \"%t\", v)\n\tcase starlark.Int:\n\t\tdata, err := json.Marshal(v.BigInt())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tout.Write(data)\n\tcase starlark.Float:\n\t\tdata, err := json.Marshal(float64(v))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tout.Write(data)\n\tcase starlark.String:\n\t\t// we have to use a json Encoder to disable noisy html\n\t\t// escaping. But the encoder appends a final \\n so we\n\t\t// also should remove it.\n\t\tdata := &bytes.Buffer{}\n\t\te := json.NewEncoder(data)\n\t\te.SetEscapeHTML(false)\n\t\tif err := e.Encode(string(v)); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// remove final \\n introduced by the encoder\n\t\tout.Write(bytes.TrimSuffix(data.Bytes(), []byte(\"\\n\")))\n\tcase starlark.Indexable: // Tuple, List\n\t\tout.WriteByte('[')\n\t\tfor i, n := 0, starlark.Len(v); i < n; i++ {\n\t\t\tif i > 0 {\n\t\t\t\tout.WriteString(\", \")\n\t\t\t}\n\t\t\tif err := starlarkJSON(out, v.Index(i)); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tout.WriteByte(']')\n\tcase *starlark.Dict:\n\t\tout.WriteByte('{')\n\t\tfor i, item := range v.Items() {\n\t\t\tif i > 0 {\n\t\t\t\tout.WriteString(\", \")\n\t\t\t}\n\t\t\tif _, ok := item[0].(starlark.String); !ok {\n\t\t\t\treturn fmt.Errorf(\"cannot convert non-string dict key to JSON\")\n\t\t\t}\n\t\t\tif err := starlarkJSON(out, item[0]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tout.WriteString(\": \")\n\t\t\tif err := starlarkJSON(out, item[1]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tout.WriteByte('}')\n\n\tdefault:\n\t\treturn fmt.Errorf(\"cannot convert starlark type %q to JSON\", v.Type())\n\t}\n\treturn nil\n}", "func main() {\r\n\ts := `[{\"First\":\"Austin\",\"Last\":\"Megarroni\",\"Age\":21},{\"First\":\"Morgan\",\"Last\":\"Beckerroni\",\"Age\":19}]`\r\n\tbs := []byte(s)\r\n\tfmt.Printf(\"%T\\n\", s)\r\n\tfmt.Printf(\"%T\\n\", bs)\r\n\r\n\tp1 := person{\r\n\t\tFirst: \"Austin\",\r\n\t\tLast: \"Megarroni\",\r\n\t\tAge: 21,\r\n\t}\r\n\r\n\tp2 := person{\r\n\t\tFirst: \"Morgan\",\r\n\t\tLast: \"Beckerroni\",\r\n\t\tAge: 19,\r\n\t}\r\n\r\n\tpeople := []person{p1, p2}\r\n\r\n\tfmt.Println(people)\r\n\r\n\tbs, err := json.Marshal(people)\r\n\tif err != nil {\r\n\t\tfmt.Println(err)\r\n\t}\r\n\tfmt.Println(string(bs))\r\n\r\n}", "func GeoJSON(raw []byte, limit uint32) bool {\n\traw = trimLWS(raw)\n\tif len(raw) == 0 {\n\t\treturn false\n\t}\n\t// GeoJSON is always a JSON object, not a JSON array or any other JSON value.\n\tif raw[0] != '{' {\n\t\treturn false\n\t}\n\n\ts := []byte(`\"type\"`)\n\tsi, sl := bytes.Index(raw, s), len(s)\n\n\tif si == -1 {\n\t\treturn false\n\t}\n\n\t// If the \"type\" string is the suffix of the input,\n\t// there is no need to search for the value of the key.\n\tif si+sl == len(raw) {\n\t\treturn false\n\t}\n\t// Skip the \"type\" part.\n\traw = raw[si+sl:]\n\t// Skip any whitespace before the colon.\n\traw = trimLWS(raw)\n\t// Check for colon.\n\tif len(raw) == 0 || raw[0] != ':' {\n\t\treturn false\n\t}\n\t// Skip any whitespace after the colon.\n\traw = trimLWS(raw[1:])\n\n\tgeoJSONTypes := [][]byte{\n\t\t[]byte(`\"Feature\"`),\n\t\t[]byte(`\"FeatureCollection\"`),\n\t\t[]byte(`\"Point\"`),\n\t\t[]byte(`\"LineString\"`),\n\t\t[]byte(`\"Polygon\"`),\n\t\t[]byte(`\"MultiPoint\"`),\n\t\t[]byte(`\"MultiLineString\"`),\n\t\t[]byte(`\"MultiPolygon\"`),\n\t\t[]byte(`\"GeometryCollection\"`),\n\t}\n\tfor _, t := range geoJSONTypes {\n\t\tif bytes.HasPrefix(raw, t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (dst *UiNodeInputAttributesValue) UnmarshalJSON(data []byte) error {\n\tvar err error\n\tmatch := 0\n\t// try to unmarshal data into Bool\n\terr = newStrictDecoder(data).Decode(&dst.Bool)\n\tif err == nil {\n\t\tjsonBool, _ := json.Marshal(dst.Bool)\n\t\tif string(jsonBool) == \"{}\" { // empty struct\n\t\t\tdst.Bool = nil\n\t\t} else {\n\t\t\tmatch++\n\t\t}\n\t} else {\n\t\tdst.Bool = nil\n\t}\n\n\t// try to unmarshal data into Float32\n\terr = newStrictDecoder(data).Decode(&dst.Float32)\n\tif err == nil {\n\t\tjsonFloat32, _ := json.Marshal(dst.Float32)\n\t\tif string(jsonFloat32) == \"{}\" { // empty struct\n\t\t\tdst.Float32 = nil\n\t\t} else {\n\t\t\tmatch++\n\t\t}\n\t} else {\n\t\tdst.Float32 = nil\n\t}\n\n\t// try to unmarshal data into String\n\terr = newStrictDecoder(data).Decode(&dst.String)\n\tif err == nil {\n\t\tjsonString, _ := json.Marshal(dst.String)\n\t\tif string(jsonString) == \"{}\" { // empty struct\n\t\t\tdst.String = nil\n\t\t} else {\n\t\t\tmatch++\n\t\t}\n\t} else {\n\t\tdst.String = nil\n\t}\n\n\tif match > 1 { // more than 1 match\n\t\t// reset to nil\n\t\tdst.Bool = nil\n\t\tdst.Float32 = nil\n\t\tdst.String = nil\n\n\t\treturn fmt.Errorf(\"Data matches more than one schema in oneOf(UiNodeInputAttributesValue)\")\n\t} else if match == 1 {\n\t\treturn nil // exactly one match\n\t} else { // no match\n\t\treturn fmt.Errorf(\"Data failed to match schemas in oneOf(UiNodeInputAttributesValue)\")\n\t}\n}", "func TestUnmarshalJSONEncodedStrings(t *testing.T) {\n\t// Test with pre-defined inputs and expectations. Inputs will be converted\n\t// to bytes (not json-marshalled), so we'd expect inputs that are not valid\n\t// json-encoded strings to fail.\n\texpectionsTests := []struct {\n\t\tname string\n\t\tjsonPass jsonString\n\t\texpectErr bool\n\t}{\n\t\t// valid json-encoded strings\n\t\t{\n\t\t\tname: \"empty string\",\n\t\t\tjsonPass: `\"\"`,\n\t\t\texpectErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"qutf-8 string\",\n\t\t\tjsonPass: `\"@123\"`,\n\t\t\texpectErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"string with escaped char (\\\")\",\n\t\t\tjsonPass: `\"quote\\\"embedded\"`,\n\t\t\texpectErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"unicode character\",\n\t\t\tjsonPass: `\"\\u5f5b\"`,\n\t\t\texpectErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"unicode surrogate pair\",\n\t\t\tjsonPass: `\"\\uD800\\uDC00\"`,\n\t\t\texpectErr: false,\n\t\t},\n\t\t{\n\t\t\tname: \"valid non-utf8 characters\",\n\t\t\tjsonPass: `\"√ç∂\"`,\n\t\t\texpectErr: false,\n\t\t},\n\n\t\t// invalid json strings\n\t\t{\n\t\t\tname: \"unquoted empty string\",\n\t\t\tjsonPass: \"\",\n\t\t\texpectErr: true,\n\t\t},\n\t\t{\n\t\t\tname: \"unquoted UTF8 string\",\n\t\t\tjsonPass: `@123`,\n\t\t\texpectErr: true,\n\t\t},\n\t\t{\n\t\t\tname: `quoted string with unescaped \" char`,\n\t\t\tjsonPass: `\"quote\"embedded\"`,\n\t\t\texpectErr: true,\n\t\t},\n\t\t{\n\t\t\tname: `invalid unicode character (\\U instead of \\u)`,\n\t\t\tjsonPass: `\"\\UD800\"`,\n\t\t\texpectErr: true,\n\t\t},\n\t\t{\n\t\t\tname: `invalid unicode surrogate pair (\\U instead of \\u)`,\n\t\t\tjsonPass: `\"\\UD800\\UDC00\"`,\n\t\t\texpectErr: true,\n\t\t},\n\t}\n\n\tfor _, test := range expectionsTests {\n\t\tvar unmarshalledPassBytes PassBytes\n\t\terr := json.Unmarshal(test.jsonPass.bytes(), &unmarshalledPassBytes)\n\t\tif test.expectErr && err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tif test.expectErr {\n\t\t\tt.Fatalf(\"%s -> %q: expected error but got nil\", test.name, test.jsonPass)\n\t\t}\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"%s -> %q: unexpected unmarshal error: %v\", test.name, test.jsonPass, err)\n\t\t}\n\n\t\t// If we got here, we expect unmarshalling to have been successful,\n\t\t// confirm that the unmarshalled password is accurate.\n\t\tactualPassword, err := test.jsonPass.string()\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"%s: unexpected error getting actual password string from JSON-encoded string (%q): %v\",\n\t\t\t\ttest.name, test.jsonPass, err)\n\t\t}\n\t\tunmarshalunmarshalledPassword := string(unmarshalledPassBytes)\n\t\tif actualPassword != unmarshalunmarshalledPassword {\n\t\t\tt.Fatalf(\"%s: expected %q, got %q\", test.name, actualPassword, unmarshalunmarshalledPassword)\n\t\t}\n\t}\n}", "func TestCreateCategoryWrongJSONSyntax(t *testing.T) {\n\t//initial length of []Categories\n\tinitialLen := len(Categories)\n\t//parameters passed to request body\n\trequestBody := `{{\"CategoryID\":\"bq4fasj7jhfi127rimlg\",\"CategoryName\":\"Name\",,,}}`\n\treq, err := http.NewRequest(\"POST\", \"/categories/new\", bytes.NewBufferString(requestBody))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\trr := httptest.NewRecorder()\n\thandler := http.HandlerFunc(CreateCategory)\n\n\thandler.ServeHTTP(rr, req)\n\n\tassert.Equal(t, 400, rr.Code, \"Bad request response is expected\")\n\tassert.Equal(t, initialLen, len(Categories), \"Expected length to stay the same after wrong syntax json\")\n\n}", "func TestJSON(t *testing.T) {\n\ta := assert.New(t)\n\t// r := require.New(t)\n\trender := NewRender()\n\n\tstr := \"foobar\"\n\n\tc := &stubController{r: render, status: http.StatusOK, obj: str}\n\ta.HTTPBodyContains(c.Handler, \"GET\", \"/\", url.Values{}, \"foobar\")\n\n\tc.obj = &str\n\ta.HTTPBodyContains(c.Handler, \"GET\", \"/\", url.Values{}, \"foobar\")\n\n\tc.obj = nil\n\ta.HTTPBodyNotContains(c.Handler, \"GET\", \"/\", url.Values{}, \"foobar\")\n}", "func (f Function) JSON(e error, ctx string) error {\n\treturn f.unsafeWrap(e, ctx, \"invalid json\")\n}", "func (this *Element) Type() value.Type { return value.JSON }", "func IsEmptyInput(input interface{}) bool {\n\tif input == nil {\n\t\treturn true\n\t}\n\ts := fmt.Sprint(input)\n\ts = strings.TrimSpace(s)\n\treturn s == \"\"\n}", "func execValid(_ int, p *gop.Context) {\n\targs := p.GetArgs(1)\n\tret := json.Valid(args[0].([]byte))\n\tp.Ret(1, ret)\n}", "func StringsType() *jsonDataType {\n\treturn JSONType([]string{})\n}", "func String(i interface{}) string {\n\tj, e := json.Marshal(i)\n\tif e != nil {\n\t\treturn fmt.Sprintf(\"%+v\", i)\n\t}\n\treturn string(j)\n}", "func JSON(j interface{}) string {\n\tvar buf bytes.Buffer\n\tencoder := json.NewEncoder(&buf)\n\tencoder.SetEscapeHTML(false)\n\tencoder.SetIndent(\"\", \"\")\n\terr := encoder.Encode(j)\n\n\tif err == nil {\n\t\treturn strings.TrimSuffix(buf.String(), \"\\n\")\n\t}\n\n\t// j could not be serialized to json, so let's log the error and return a\n\t// helpful-ish value\n\tError().logGenericArgs(\"error serializing value to json\", err, nil, 1)\n\treturn fmt.Sprintf(\"<error: %v>\", err)\n}", "func (sl *Slice) UnmarshalJSON(b []byte) error {\n\t// fmt.Printf(\"json in: %v\\n\", string(b))\n\tif bytes.Equal(b, []byte(\"null\")) {\n\t\t*sl = nil\n\t\treturn nil\n\t}\n\tlb := bytes.IndexRune(b, '{')\n\trb := bytes.IndexRune(b, '}')\n\tif lb < 0 || rb < 0 { // probably null\n\t\treturn nil\n\t}\n\t// todo: if name contains \",\" this won't work..\n\tflds := bytes.Split(b[lb+1:rb], []byte(\",\"))\n\tif len(flds) == 0 {\n\t\treturn errors.New(\"Slice UnmarshalJSON: no child data found\")\n\t}\n\t// fmt.Printf(\"flds[0]:\\n%v\\n\", string(flds[0]))\n\tns := bytes.Index(flds[0], []byte(\"\\\"n\\\":\"))\n\tbn := bytes.TrimSpace(flds[0][ns+4:])\n\n\tn64, err := strconv.ParseInt(string(bn), 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn := int(n64)\n\tif n == 0 {\n\t\treturn nil\n\t}\n\t// fmt.Printf(\"n parsed: %d from %v\\n\", n, string(bn))\n\n\ttnl := make(kit.TypeAndNameList, n)\n\n\tfor i := 0; i < n; i++ {\n\t\tfld := flds[2*i+1]\n\t\t// fmt.Printf(\"fld:\\n%v\\n\", string(fld))\n\t\tti := bytes.Index(fld, []byte(\"\\\"type\\\":\"))\n\t\ttn := string(bytes.Trim(bytes.TrimSpace(fld[ti+7:]), \"\\\"\"))\n\t\tfld = flds[2*i+2]\n\t\tni := bytes.Index(fld, []byte(\"\\\"name\\\":\"))\n\t\tnm := string(bytes.Trim(bytes.TrimSpace(fld[ni+7:]), \"\\\"\"))\n\t\t// fmt.Printf(\"making type: %v\", tn)\n\t\ttyp := kit.Types.Type(tn)\n\t\tif typ == nil {\n\t\t\treturn fmt.Errorf(\"ki.Slice UnmarshalJSON: kit.Types type name not found: %v\", tn)\n\t\t}\n\t\ttnl[i].Type = typ\n\t\ttnl[i].Name = nm\n\t}\n\n\tsl.Config(nil, tnl, true) // true = uniq names\n\n\tnwk := make([]Ki, n) // allocate new slice containing *pointers* to kids\n\n\tfor i, kid := range *sl {\n\t\tnwk[i] = kid\n\t}\n\n\tcb := make([]byte, 0, 1+len(b)-rb)\n\tcb = append(cb, []byte(\"[\")...)\n\tcb = append(cb, b[rb+2:]...)\n\n\t// fmt.Printf(\"loading:\\n%v\", string(cb))\n\n\terr = json.Unmarshal(cb, &nwk)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *Hook) JSONRequest() string {\n\tvar req string\n\tif c.username != \"\" {\n\t\tif req != \"\" {\n\t\t\treq += \",\"\n\t\t}\n\t\treq += fmt.Sprintf(`\"username\":\"%v\"`, c.username)\n\t}\n\tif c.avatarURL != \"\" {\n\t\tif req != \"\" {\n\t\t\treq += \",\"\n\t\t}\n\t\treq += fmt.Sprintf(`\"avatar_url\":\"%v\"`, c.avatarURL)\n\t}\n\tif c.Content != \"\" {\n\t\tif req != \"\" {\n\t\t\treq += \",\"\n\t\t}\n\t\treq += fmt.Sprintf(`\"content\":\"%v\"`, c.Content)\n\t}\n\tif c.Tts != false {\n\t\tif req != \"\" {\n\t\t\treq += \",\"\n\t\t}\n\t\treq += fmt.Sprintf(`\"tts\": \"%v\"`, c.Tts)\n\t}\n\temb := c.Embedded.Parse()\n\tif emb != \"\" {\n\t\tif req != \"\" {\n\t\t\treq += \",\"\n\t\t}\n\t\treq += emb\n\t}\n\treturn fmt.Sprintf(`{ %v }`, req)\n}", "func (r *Request) JSON(v interface{}) *Request {\n\tswitch x := v.(type) {\n\tcase string:\n\t\tr.body = x\n\tcase []byte:\n\t\tr.body = string(x)\n\tdefault:\n\t\tasJSON, err := json.Marshal(x)\n\t\tif err != nil {\n\t\t\tr.apiTest.t.Fatal(err)\n\t\t\treturn nil\n\t\t}\n\t\tr.body = string(asJSON)\n\t}\n\tr.ContentType(\"application/json\")\n\treturn r\n}", "func RunJSONSerializationTestForJsonInputSchemaMapping(subject JsonInputSchemaMapping) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual JsonInputSchemaMapping\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "func AssertJSON(t *testing.T, data interface{}, expectedJSON string) {\n\tjsonData, err := json.MarshalIndent(data, \"\", \"\\t\")\n\trequire.NoError(t, err)\n\n\tdataJson := \"\\n\" + string(jsonData) + \"\\n\"\n\trequire.Equal(t, dataJson, expectedJSON)\n}", "func (s *JobSpec) Inputs() InputDefinition {\n\tspec := &JobSpec{\n\t\tRefs: s.Refs,\n\t}\n\traw, err := json.Marshal(spec)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn InputDefinition{string(raw)}\n}" ]
[ "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.50101805", "0.5001159", "0.49642336", "0.49522942", "0.49466673", "0.49409387", "0.49290982", "0.492678", "0.49255788", "0.49209327", "0.49114466", "0.49034828", "0.4900937", "0.48950398", "0.48945862", "0.48944798", "0.48915026", "0.487897", "0.4874658", "0.48502547", "0.48327452", "0.4823591", "0.4804593", "0.48012018", "0.47986436", "0.47758862", "0.47747302", "0.4770619", "0.47683454", "0.47618273", "0.47444078", "0.47355512", "0.47342268", "0.47258762", "0.47207066", "0.47161546", "0.47150338", "0.47109428", "0.4705664", "0.46921027", "0.4691429", "0.46893558", "0.4681381", "0.4677942", "0.46686283", "0.4665728", "0.46618658", "0.4640171", "0.46369827", "0.46310696", "0.4624546", "0.46245202", "0.46228328", "0.4621715", "0.46213037", "0.46129194", "0.460436", "0.45981035", "0.45980522", "0.45960572", "0.45912755", "0.4590956", "0.4590374", "0.45797408", "0.457223", "0.45622233", "0.45541787", "0.45475852", "0.45468557", "0.45465538", "0.45464456", "0.45462003", "0.45455202", "0.45439786", "0.45406583", "0.45350125", "0.45327806", "0.45260093", "0.45247254", "0.45230243" ]
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 := make(chan []byte, 1)\n\tfoo := func(msg []byte) {\n\t\tplogger.Debug(\"handle ping response\")\n\t\tsender := &node.Info{}\n\t\terr := types.BytesToInterface(msg, sender)\n\n\t\tif err != nil {\n\t\t\tplogger.With().Warning(\"got unreadable pong\", log.Err(err))\n\t\t\treturn\n\t\t}\n\t\t// TODO: if we pinged it we already have id so no need to update,\n\t\t// but what if id or listen address has changed?\n\t\tch <- sender.ID.Bytes()\n\t}\n\n\terr = p.msgServer.SendRequest(ctx, server.PingPong, data, peer, foo, func(err error) {})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttimeout := time.NewTimer(MessageTimeout) // todo: check whether this is useless because of `requestLifetime`\n\tselect {\n\tcase id := <-ch:\n\t\tif id == nil {\n\t\t\treturn errors.New(\"failed sending message\")\n\t\t}\n\t\tif !bytes.Equal(id, peer.Bytes()) {\n\t\t\treturn errors.New(\"got pong with different public key\")\n\t\t}\n\tcase <-timeout.C:\n\t\treturn errors.New(\"ping timeout\")\n\t}\n\n\treturn nil\n}", "func (p *Ping) Ping(target p2pcrypto.PublicKey, msg string) (string, error) {\n\tvar response string\n\treqid := crypto.NewUUID()\n\tping := &pb.Ping{\n\t\tReqID: reqid[:],\n\t\tReq: true,\n\t\tMessage: msg,\n\t}\n\tpchan, err := p.sendRequest(target, reqid, ping)\n\tif err != nil {\n\t\treturn response, err\n\t}\n\n\ttimer := time.NewTimer(PingTimeout)\n\tselect {\n\tcase res := <-pchan:\n\t\tresponse = res.Message\n\t\tp.pendMuxtex.Lock()\n\t\tdelete(p.pending, reqid)\n\t\tp.pendMuxtex.Unlock()\n\tcase <-timer.C:\n\t\treturn response, errPingTimedOut\n\t}\n\n\treturn response, nil\n}", "func Ping(node *shared.Node) {\n\tfor {\n\t\tblockchain.SwimBatchPuzzleGenerator(node)\n\n\t\ttime.Sleep(pingInterval)\n\t\ttarget := node.MembersSet.GetRandom()\n\t\tif target == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\ttargetPeer := strings.Split(target, \" \")\n\t\tip := targetPeer[0]\n\t\tport := targetPeer[1]\n\t\tconn, err := net.Dial(\"tcp\", ip+\":\"+port)\n\t\tif err != nil {\n\t\t\t// failure detected!\n\t\t\tif strings.HasSuffix(err.Error(), \"connect: connection refused\") {\n\t\t\t\tnode.MembersSet.SetDelete(target)\n\t\t\t\tnode.FailMsgBuffer.Add(target)\n\t\t\t\tfmt.Println(\"FAILURE DETECTED \" + target)\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"Dial Error: \", err)\n\t\t\t}\n\t\t} else {\n\t\t\t// SWIM Implementation would send membership update message here\n\t\t\tswimMsg := \"DEAD \" + strings.Join(node.FailMsgBuffer.GetN(10), \",\") + \"\\n\"\n\t\t\tlogBandwithInfo(\"Send\", len(swimMsg))\n\t\t\tfmt.Fprintf(conn, swimMsg)\n\t\t\tfmt.Print(\"SWIM SENT \" + swimMsg)\n\t\t\ttransactionsMsg := strings.Join(node.TransactionBuffer.GetN(10000), \"\\n\") + \"\\n\"\n\t\t\tlogBandwithInfo(\"Send\", len(transactionsMsg))\n\t\t\tfmt.Fprintf(conn, transactionsMsg)\n\t\t\tfor _, block := range node.BlockBuffer.GetAll() {\n\t\t\t\tblockchain.SendBlock(node, conn, block)\n\t\t\t}\n\n\t\t\tconn.Close()\n\t\t}\n\t}\n}", "func ping(times, size, timeout, sendPackageInterMin, sendPackageWait int, ips []string, sip string) (result map[string]*PingStat, send int, err error) {\n\tresult = make(map[string]*PingStat)\n\t//给每个ip生成随机id放入icmp报文,保证同一个ip的id相同\n\tip2id := make(map[string]int)\n\trand.Seed(time.Now().UnixNano())\n\tfor _, ip := range ips {\n\t\tip2id[ip] = rand.Intn(0xffff)\n\t}\n\t// 开始ping指定次数\n\t// startTime := time.Now()\n\tfor send = 0; send < times; send++ {\n\t\tlogs.Debug(\"ping round:%d start\", send)\n\t\tpinger := util.NewPinger(send+1, \"\")\n\t\tfor _, ip := range ips {\n\t\t\terr := pinger.AddIP(ip, ip2id[ip])\n\t\t\tif err != nil {\n\t\t\t\tlogs.Error(\"p.AddIP(ip) for ip %s fails with error %s\\n\", ip, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tpinger.Size = size\n\t\tpinger.MaxRTT = time.Duration(timeout) * time.Millisecond\n\t\ttimer := time.NewTimer(time.Duration(sendPackageInterMin) * time.Millisecond)\n\t\tnow := time.Now()\n\t\t// 启动本次ping\n\t\tm, _, err := pinger.Run()\n\t\tif err != nil {\n\t\t\tlogs.Error(\"ping run fails:%s\", err)\n\t\t\tcontinue\n\t\t}\n\t\t// 本次ping,与之前ping所有结果打包\n\t\t// logs.Debug(\"ping result:\", m)\n\t\tfor ip, d := range m {\n\t\t\tr := result[ip]\n\t\t\t// 已经有结果,则更新\n\t\t\tif r != nil {\n\t\t\t\tr.Times++\n\t\t\t\tr.Duration += d\n\t\t\t\tif d >= r.MaxRtt {\n\t\t\t\t\tr.MaxRtt = d\n\t\t\t\t}\n\t\t\t\tif d < r.MinRtt {\n\t\t\t\t\tr.MinRtt = d\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// 首次ping\n\t\t\t\tresult[ip] = &PingStat{\n\t\t\t\t\tTimes: 1,\n\t\t\t\t\tDuration: d,\n\t\t\t\t\tMaxRtt: d,\n\t\t\t\t\tMinRtt: d,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tdiff := time.Since(now)\n\t\tselect {\n\t\tcase <-timer.C:\n\t\t\tlogs.Debug(\"ping round:%d finished, %dip ping use time %s\", send, len(ips), diff.String())\n\t\tdefault:\n\t\t\tlogs.Debug(\"finish %d ip ping with %s,less than %d ms,so wait %d ms\",\n\t\t\t\tlen(ips), diff.String(), sendPackageInterMin, sendPackageWait)\n\t\t\ttime.Sleep(time.Duration(sendPackageWait) * time.Millisecond)\n\t\t}\n\t\ttimer.Stop()\n\t}\n\treturn\n}", "func (s *SWIM) ping(target *Member) error {\n\tstats, err := s.mbrStatsMsgStore.Get()\n\tif err != nil {\n\t\tiLogger.Error(nil, err.Error())\n\t}\n\n\t// send ping message\n\taddr := target.Address()\n\tpingId := xid.New().String()\n\tping := createPingMessage(pingId, s.member.Address(), &stats)\n\n\tres, err := s.messageEndpoint.SyncSend(addr, ping)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// update piggyback data to store\n\ts.handlePbk(res.PiggyBack)\n\n\treturn nil\n}", "func (p *Pinger) Ping() error {\r\n\tconn, err := p.NewConn()\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\tp.conn = conn\r\n\tfor i := 0; i < p.amt; i++ {\r\n\t\terr = p.SendOnePing(i, conn)\r\n\t}\r\n\treturn err\r\n}", "func (s *SWIM) handlePing(msg pb.Message) {\n\tid := msg.Id\n\n\tmbrStatsMsg, err := s.mbrStatsMsgStore.Get()\n\tif err != nil {\n\t\tiLogger.Error(nil, err.Error())\n\t}\n\n\t// address of messgae source member\n\tsrcAddr := msg.Address\n\n\tack := createAckMessage(id, srcAddr, &mbrStatsMsg)\n\tif err := s.messageEndpoint.Send(srcAddr, ack); err != nil {\n\t\tiLogger.Error(nil, err.Error())\n\t}\n}", "func (r *BreakerRPC) Ping(c rcontext.Context, arg *BreakerReq, res *BreakerReply) (err error) {\n\tif rand.Int31n(100) < 40 {\n\t\treturn ecode.ServerErr\n\t}\n\tres.Success = true\n\treturn\n}", "func (t *Transport) Ping(ctx context.Context, token string) error {\n\tscheme := \"http\"\n\tif t.sslEnabled {\n\t\tscheme = \"https\"\n\t}\n\n\t// Make a http request\n\tr, err := http.NewRequestWithContext(ctx, http.MethodGet, fmt.Sprintf(\"%s://%s/v1/config/env\", scheme, t.addr), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Add appropriate headers\n\tr.Header.Add(\"Authorization\", \"Bearer \"+token)\n\tr.Header.Add(\"Content-Type\", contentTypeJSON)\n\n\t// Fire the request\n\tres, err := t.httpClient.Do(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer utils.CloseTheCloser(res.Body)\n\n\tif res.StatusCode >= 200 && res.StatusCode < 300 {\n\t\treturn nil\n\t}\n\n\t// Unmarshal the response\n\tresult := types.M{}\n\tif err := json.NewDecoder(res.Body).Decode(&result); err != nil {\n\t\treturn err\n\t}\n\n\treturn fmt.Errorf(\"Service responde with status code (%v) with error message - (%v) \", res.StatusCode, result[\"error\"].(string))\n}", "func (s *Server) processPing(msg message.Message, db *database.DataStore) {\n\tlog.Debugf(\"[%s] Processing ping command\", msg.ULID)\n\n\terr := db.C(models.Endpoints).Update(bson.M{\"ulid\": msg.ULID}, bson.M{\"$set\": bson.M{\"last_ping\": time.Now()}})\n\tif err == mgo.ErrNotFound {\n\t\tlog.Errorf(\"[%s] Sending PONG with error: %s\", msg.ULID, errors.Errors[errors.NeedsRegister])\n\t\ts.sendErrorMsg(msg, errors.NeedsRegister, \"Pong\")\n\t} else {\n\t\tif jobs, pending := s.pendingJobs(msg, db); pending {\n\t\t\ts.taskPicker(msg, jobs, db)\n\t\t} else {\n\t\t\tmsg.Result = \"Pong\"\n\t\t\ts.w.Encode(msg)\n\t\t\tlog.Infof(\"[%s] Sending PONG due to no task assigned\", msg.ULID)\n\t\t}\n\t}\n}", "func (app *App) Ping(args []string) error {\n\treturn errors.Wrap(app.Send(osc.Message{Address: \"/ping\"}), \"sending ping\")\n}", "func (reb *rebManager) pingTarget(tsi *cluster.Snode, config *cmn.Config, ver int64, _ *xactGlobalReb) (ok bool) {\n\tvar (\n\t\ttname = reb.t.si.Name()\n\t\tmaxwt = config.Rebalance.DestRetryTime\n\t\tsleep = config.Timeout.CplaneOperation\n\t\tsleepRetry = keepaliveRetryDuration(config)\n\t\tcurwt time.Duration\n\t\targs = callArgs{\n\t\t\tsi: tsi,\n\t\t\treq: cmn.ReqArgs{\n\t\t\t\tMethod: http.MethodGet,\n\t\t\t\tBase: tsi.IntraControlNet.DirectURL,\n\t\t\t\tPath: cmn.URLPath(cmn.Version, cmn.Health),\n\t\t\t},\n\t\t\ttimeout: config.Timeout.CplaneOperation,\n\t\t}\n\t)\n\tfor curwt < maxwt {\n\t\tres := reb.t.call(args)\n\t\tif res.err == nil {\n\t\t\tif curwt > 0 {\n\t\t\t\tglog.Infof(\"%s: %s is online\", tname, tsi.Name())\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\targs.timeout = sleepRetry\n\t\tglog.Warningf(\"%s: waiting for %s, err %v\", tname, tsi.Name(), res.err)\n\t\ttime.Sleep(sleep)\n\t\tcurwt += sleep\n\t\tnver := reb.t.smapowner.get().version()\n\t\tif nver > ver {\n\t\t\treturn\n\t\t}\n\t}\n\tglog.Errorf(\"%s: timed-out waiting for %s\", tname, tsi.Name())\n\treturn\n}", "func periodicPing() {\n\tfor {\n\t\t// Shuffle membership list and get a member\n\t\t// Only executed when the membership list is not empty\n\t\tif CurrentList.Size() > 0 {\n\t\t\tmember := CurrentList.Shuffle()\n\t\t\t// Do not pick itself as the ping target\n\t\t\tif (member.TimeStamp == CurrentMember.TimeStamp) && (member.IP == CurrentMember.IP) {\n\t\t\t\ttime.Sleep(PingSendingPeriod)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tLogger.Info(\"Member (%d, %d) is selected by shuffling\\n\", member.TimeStamp, member.IP)\n\t\t\t// Get update entry from TTL Cache\n\t\t\tupdate, flag, err := getUpdate()\n\t\t\t// if no update there, do pure ping\n\t\t\tif err != nil {\n\t\t\t\tping(member)\n\t\t\t} else {\n\t\t\t\t// Send update as payload of ping\n\t\t\t\tpingWithPayload(member, update, flag)\n\t\t\t}\n\t\t}\n\t\ttime.Sleep(PingSendingPeriod)\n\t}\n}", "func (a API) Ping(cmd *None) (e error) {\n\tRPCHandlers[\"ping\"].Call <-API{a.Ch, cmd, nil}\n\treturn\n}", "func (p *peer) Ping() {\n\t// this task is recorded in the waitgroup, so clear waitgroup on return\n\tdefer p.ms.Done()\n\t// This must come after Done and before Reporter (executes in reverse order)\n\tdefer p.ms.Delete(p)\n\n\tif p.ms.Verbose() > 1 {\n\t\tlog.Println(\"ping\", p.Url)\n\t}\n\n\tmaxfail := p.Maxfail // default before thread quits trying\n\tmn := \"TCP RTT\" // CloudWatch metric name\n\tns := \"pingmesh\" // Cloudwatch namespace\n\n\tlimit := p.Limit // number of pings before we quit, \"forever\" if zero\n\tif limit == 0 {\n\t\tlimit = math.MaxInt32\n\t}\n\tif maxfail > limit {\n\t\tmaxfail = limit\n\t}\n\n\t////\n\t// Reporter summarizes ping statistics to stdout at the end of the run\n\tdefer func() { // Reporter\n\t\tif p.Pings == 0 {\n\t\t\tfmt.Printf(\"\\nRecorded 0 valid samples, %d of %d failures\\n\", p.Fails, maxfail)\n\t\t\treturn\n\t\t}\n\n\t\tfc := float64(p.Pings)\n\t\telapsed := Hhmmss_d(p.PingTotals.Start)\n\n\t\tfmt.Printf(\"\\nRecorded %d samples in %s, average values:\\n\"+\"%s\"+\n\t\t\t\"%d %-6s\\t%.03f\\t%.03f\\t%.03f\\t%.03f\\t%.03f\\t%.03f\\t\\t%d\\t%s\\t%s\\n\\n\",\n\t\t\tp.Pings, elapsed, pt.PingTimesHeader(),\n\t\t\tp.Pings, elapsed,\n\t\t\tpt.Msec(p.PingTotals.DnsLk)/fc,\n\t\t\tpt.Msec(p.PingTotals.TcpHs)/fc,\n\t\t\tpt.Msec(p.PingTotals.TlsHs)/fc,\n\t\t\tpt.Msec(p.PingTotals.Reply)/fc,\n\t\t\tpt.Msec(p.PingTotals.Close)/fc,\n\t\t\tpt.Msec(p.PingTotals.RespTime())/fc,\n\t\t\tp.PingTotals.Size/int64(p.Pings),\n\t\t\tpt.LocationOrIp(p.PingTotals.Location),\n\t\t\t*p.PingTotals.DestUrl)\n\t}()\n\n\tp.FirstPing = time.Now().UTC().Truncate(time.Second)\n\tfor {\n\t\tif p.ms.DoneChan() == nil {\n\t\t\t// channel is nil, reading from it will block, return\n\t\t\tif p.ms.Verbose() > 1 {\n\t\t\t\tlog.Println(\"peer.Ping: channel is nil, returning\")\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\t////\n\t\t// Sleep first, allows risk-free continue from error cases below\n\t\tvar sleepTime int\n\t\tif p.Pings == 0 {\n\t\t\tif sleepTime < p.Delay {\n\t\t\t\tsleepTime++\n\t\t\t}\n\t\t} else {\n\t\t\tsleepTime = p.Delay\n\t\t}\n\n\t\tselect {\n\t\tcase <-time.After(JitterPct(sleepTime, 1)):\n\t\t\t// we waited for the delay and got nothing ... loop around\n\n\t\tcase newdelay, more := <-p.ms.DoneChan():\n\t\t\tif !more {\n\t\t\t\t// channel is closed, we are done -- goodbye\n\t\t\t\tif p.ms.Verbose() > 1 {\n\t\t\t\t\tlog.Println(\"peer.Ping: channel is closed, returning\")\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// else we got a new delay on this channel (0 is signal to stop)\n\t\t\tp.Delay = newdelay\n\t\t\tif p.Delay <= 0 {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// we did not (finish) our sleep in this case ...\n\t\t}\n\n\t\t////\n\t\t// Try to fetch the URL\n\t\tptResult := client.FetchURL(p.Url, p.PeerIP)\n\n\t\tswitch {\n\t\t// result nil, something totally failed\n\t\tcase nil == ptResult:\n\t\t\tfunc() {\n\t\t\t\tp.mu.Lock()\n\t\t\t\tdefer p.mu.Unlock()\n\t\t\t\tp.Fails++\n\t\t\t}()\n\t\t\tlog.Println(\"fetch failure\", p.Fails, \"of\", maxfail, \"on\", p.Url)\n\t\t\tif p.Fails >= maxfail {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcontinue\n\n\t\t// HTTP 200 OK and 300 series \"OK\" status codes\n\t\tcase ptResult.RespCode <= 304:\n\t\t\t// Take a write lock on this peer before updating values\n\t\t\t// (make each peer read/write reentrant, also []*peers)\n\t\t\tfunc() {\n\t\t\t\tp.mu.Lock()\n\t\t\t\tdefer p.mu.Unlock()\n\t\t\t\tp.Pings++\n\t\t\t\tnow := time.Now().UTC()\n\t\t\t\tp.LatestPing = now.UTC().Truncate(time.Second)\n\t\t\t\tif p.Pings == 1 {\n\t\t\t\t\t////\n\t\t\t\t\t// first ping -- initialize ptResult\n\t\t\t\t\tp.PingTotals = *ptResult\n\t\t\t\t} else {\n\t\t\t\t\tp.PingTotals.DnsLk += ptResult.DnsLk\n\t\t\t\t\tp.PingTotals.TcpHs += ptResult.TcpHs\n\t\t\t\t\tp.PingTotals.TlsHs += ptResult.TlsHs\n\t\t\t\t\tp.PingTotals.Reply += ptResult.Reply\n\t\t\t\t\tp.PingTotals.Close += ptResult.Close\n\t\t\t\t\tp.PingTotals.Total += ptResult.Total\n\t\t\t\t\tp.PingTotals.Size += ptResult.Size\n\t\t\t\t}\n\n\t\t\t\tif len(p.PeerIP) == 0 && len(ptResult.Remote) > 0 {\n\t\t\t\t\tp.PeerIP = ptResult.Remote\n\t\t\t\t}\n\n\t\t\t\tif p.Location == client.LocUnknown {\n\t\t\t\t\tif *ptResult.Location != client.LocUnknown && len(*ptResult.Location) > 0 {\n\t\t\t\t\t\tp.Location = *ptResult.Location\n\t\t\t\t\t\tp.PingTotals.Location = &p.Location\n\t\t\t\t\t\tif p.ms.Verbose() > 1 {\n\t\t\t\t\t\t\tlog.Println(\"Initialize remote location to\", *ptResult.Location)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// It's not returning a pingmesh Location response, use hostname\n\t\t\t\t\t\tp.Location = p.Url\n\t\t\t\t\t\tp.PingTotals.Location = &p.Location\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}()\n\n\t\t// HTTP 500 series error\n\t\tcase ptResult.RespCode > 304:\n\t\t\tfunc() {\n\t\t\t\tp.mu.Lock()\n\t\t\t\tdefer p.mu.Unlock()\n\t\t\t\tp.Fails++\n\t\t\t}()\n\t\t\tremote := p.Location\n\t\t\tif len(remote) == 0 || remote == client.LocUnknown {\n\t\t\t\tif len(p.PeerIP) > 0 {\n\t\t\t\t\tremote = p.PeerIP\n\t\t\t\t} else {\n\t\t\t\t\tremote = p.Host\n\t\t\t\t}\n\t\t\t}\n\t\t\tif p.ms.Verbose() > 0 {\n\t\t\t\tfmt.Println(p.Pings, ptResult.MsecTsv())\n\t\t\t}\n\t\t\tif p.Fails >= maxfail {\n\t\t\t\tclient.LogSentry(sentry.LevelWarning, \"%s to %s: HTTP error %d hit failure limit %d on %s, Ping quitting\", p.ms.SrvLocation(), remote, ptResult.RespCode, p.Fails, p.Url)\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tlog.Println(p.ms.SrvLocation(), \"to\", remote, \"HTTP\", ptResult.RespCode, \"failure\", p.Fails, \"of\", maxfail, \"on\", p.Url)\n\t\t\t}\n\t\t\tcontinue\n\n\t\t\t////\n\t\t\t// Other HTTP response codes can be coded here (error, redirect)\n\t\t\t////\n\t\t}\n\n\t\t////\n\t\t// Execution should continue here only in NON-ERROR cases; errors\n\t\t// continue the for{} above\n\t\t////\n\n\t\tif p.ms.Verbose() > 0 {\n\t\t\tif p.ms.Verbose() > 1 {\n\t\t\t\tfmt.Println(p.Pings, ptResult.MsecTsv())\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"%3d %8.03f msec %20s %s\\n\", p.Pings, pt.Msec(ptResult.TcpHs), pt.LocationOrIp(ptResult.Location), ptResult.Remote)\n\t\t\t}\n\t\t}\n\n\t\tif p.ms.CwFlag() {\n\t\t\tmetric := pt.Msec(ptResult.TcpHs)\n\t\t\tmyLocation := p.ms.SrvLocation()\n\t\t\tif p.ms.Verbose() > 2 {\n\t\t\t\tlog.Println(\"publishing TCP RTT\", metric, \"msec to CloudWatch\", ns, \"from\", myLocation)\n\t\t\t}\n\t\t\trespCode := \"0\"\n\t\t\tif ptResult.RespCode >= 0 {\n\t\t\t\t// 000 in cloudwatch indicates it was a zero return code from lower layer\n\t\t\t\t// while single digit 0 indicates an error making the request\n\t\t\t\trespCode = fmt.Sprintf(\"%03d\", ptResult.RespCode)\n\t\t\t}\n\n\t\t\t////\n\t\t\t// Publish my location (IP or REP_LOCATION) and their location\n\t\t\tcw.PublishRespTime(myLocation, p.Location, respCode, metric, mn, ns)\n\t\t\t// NOTE: using network RTT estimate (TcpHs) rather than full page response time\n\t\t\t// TODO: This makes the legends wrong in Cloudwatch. Fix that.\n\t\t}\n\n\t\tif p.Pings >= limit {\n\t\t\t// report stats (see deferred func() above) upon return\n\t\t\treturn\n\t\t}\n\n\t\tif p.Delay <= 0 {\n\t\t\t// we were signaled to stop\n\t\t\treturn\n\t\t}\n\t}\n}", "func (s *ClientState) Ping(pingMsg MsgBody) error {\n\tlogInfo(\"Received ping message\")\n\trs := s.RegisterSystem(pingMsg.System)\n\tif rs.RedeemToken(pingMsg.Token) {\n\t\treturn s.SendPong(rs)\n\t}\n\treturn nil\n}", "func (agent *Agent) PingKvEx(opts PingKvOptions, cb PingKvExCallback) (PendingOp, error) {\n\tconfig := agent.routingInfo.Get()\n\tif config == nil {\n\t\treturn nil, ErrShutdown\n\t}\n\n\top := &pingOp{\n\t\tcallback: cb,\n\t\tremaining: 1,\n\t}\n\n\tpingStartTime := time.Now()\n\n\tkvHandler := func(resp *memdQResponse, req *memdQRequest, err error) {\n\t\tserverAddress := resp.sourceAddr\n\n\t\tpingLatency := time.Now().Sub(pingStartTime)\n\n\t\top.lock.Lock()\n\t\top.results = append(op.results, PingResult{\n\t\t\tEndpoint: serverAddress,\n\t\t\tError: err,\n\t\t\tLatency: pingLatency,\n\t\t})\n\t\top.handledOneLocked()\n\t\top.lock.Unlock()\n\t}\n\n\tfor serverIdx := 0; serverIdx < config.clientMux.NumPipelines(); serverIdx++ {\n\t\tpipeline := config.clientMux.GetPipeline(serverIdx)\n\t\tserverAddress := pipeline.Address()\n\n\t\treq := &memdQRequest{\n\t\t\tmemdPacket: memdPacket{\n\t\t\t\tMagic: reqMagic,\n\t\t\t\tOpcode: cmdNoop,\n\t\t\t\tDatatype: 0,\n\t\t\t\tCas: 0,\n\t\t\t\tKey: nil,\n\t\t\t\tValue: nil,\n\t\t\t},\n\t\t\tCallback: kvHandler,\n\t\t}\n\n\t\tcurOp, err := agent.dispatchOpToAddress(req, serverAddress)\n\t\tif err != nil {\n\t\t\top.lock.Lock()\n\t\t\top.results = append(op.results, PingResult{\n\t\t\t\tEndpoint: serverAddress,\n\t\t\t\tError: err,\n\t\t\t\tLatency: 0,\n\t\t\t})\n\t\t\top.lock.Unlock()\n\t\t\tcontinue\n\t\t}\n\n\t\top.lock.Lock()\n\t\top.subops = append(op.subops, pingSubOp{\n\t\t\tendpoint: serverAddress,\n\t\t\top: curOp,\n\t\t})\n\t\tatomic.AddInt32(&op.remaining, 1)\n\t\top.lock.Unlock()\n\t}\n\n\t// We initialized remaining to one to ensure that the callback is not\n\t// invoked until all of the operations have been dispatched first. This\n\t// final handling is to indicate that all operations were dispatched.\n\top.lock.Lock()\n\top.handledOneLocked()\n\top.lock.Unlock()\n\n\treturn op, nil\n}", "func ping(c *bm.Context) {}", "func (h *Hub) Ping(ctx context.Context, _ *pb.PingRequest) (*pb.PingReply, error) {\n\tlog.G(h.ctx).Info(\"handling Ping request\")\n\treturn &pb.PingReply{}, nil\n}", "func (b *Backend) Ping(ctx context.Context, req *dashboard.Hello) (*dashboard.Pong, error) {\n\tif req.GetMessage() == \"Expect-Error\" {\n\t\treturn nil, newStatus(codes.Canceled, \"operation canceled because client sent Expect-Error\").err()\n\t}\n\treturn &dashboard.Pong{\n\t\tReply: req.GetMessage(),\n\t}, nil\n}", "func (this *service) Ping(ctx context.Context, _ *empty.Empty) (*empty.Empty, error) {\n\tthis.log.Debug2(\"<grpc.service.sensordb.Ping>{ }\")\n\treturn &empty.Empty{}, nil\n}", "func ping() error {\n\tfor i := 0; i < 10; i++ {\n\t\t// Ping the server by sending a GET request to `/health`.\n\t\tresp, err := http.Get(\"http://localhost\" + viper.GetString(\"addr\") + \"/\")\n\t\tif err == nil && resp.StatusCode == 200 {\n\t\t\treturn nil\n\t\t}\n\n\t\t// Sleep for a second to continue the next ping.\n\t\tlog.Infoln(\"Waiting for the router, retry in 1 second.\")\n\t\ttime.Sleep(time.Second)\n\t}\n\treturn errors.New(\"app is not working\")\n}", "func ping(pings chan<- string, msg string) {\n\tpings <- msg\n}", "func ping(pings chan<- string, msg string) {\n\tpings <- msg\n}", "func ping(pings chan<- string, msg string) {\n\tpings <- msg\n}", "func (connection *Connection) ping() {\n\tfor {\n\t\ttime.Sleep(1 * time.Second)\n\t\tif len(connection.consumers) > 0 {\n\t\t\t//do some ping, if no response then kill it\n\t\t\tfor _, consumer := range connection.consumers {\n\t\t\t\t_, pingError := consumer.connection.Write([]byte(\"hunga\"))\n\t\t\t\tif pingError != nil {\n\t\t\t\t\t// fmt.Print(\"PING ERROR\")\n\t\t\t\t\tconnection.killConsumer(consumer.id)\n\t\t\t\t} else {\n\t\t\t\t\tconnection.getConsumerMessage(consumer.id)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func ping(c *bm.Context) {\n\tc.JSON(nil, srv.Ping(c))\n}", "func (conn *Conn) ping() {\n\ttick := time.NewTicker(conn.PingFreq)\n\tfor {\n\t\tselect {\n\t\tcase <-tick.C:\n\t\t\tconn.Raw(fmt.Sprintf(\"PING :%d\", time.Now().UnixNano()))\n\t\tcase <-conn.cPing:\n\t\t\ttick.Stop()\n\t\t\treturn\n\t\t}\n\t}\n}", "func (m *manager) onPing(addr string, rtt time.Duration) error {\n\tv := int32(rtt.Nanoseconds() / 1000)\n\tif v == 0 { // Don't let it be zero, otherwise the update would fail\n\t\tv = 1\n\t}\n\n\tm.monitor.Measure(addr, v)\n\treturn nil\n}", "func (registry *Registry) Ping(ctx context.Context) error {\n\turl := registry.url(\"/v2/\")\n\tregistry.Logf(\"registry.ping url=%s\", url)\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tresp, err := registry.Client.Do(req.WithContext(ctx))\n\tif resp != nil {\n\t\tdefer resp.Body.Close()\n\t}\n\treturn err\n}", "func ping(cfg configFlags) {\n\t// Dial a remote server and send a stream to that server.\n\tc, err := vsock.Dial(uint32(cfg.contextID), uint32(cfg.port))\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to dial: %v\", err)\n\t}\n\tdefer c.Close()\n\n\tvar p func(i uint) []byte\n\tp = func(i uint) []byte {\n\t\tc := make([]byte, 8)\n\t\tbinary.LittleEndian.PutUint64(c, uint64(i))\n\t\tb := md5.Sum(c)\n\t\treturn b[:]\n\t}\n\n\tif cfg.pattern != \"\" {\n\t\tb, err := hex.DecodeString(cfg.pattern)\n\t\tif err != nil {\n\t\t\tlog.Println(\"pattern must be specified as hex digits\")\n\t\t\tlog.Fatalf(\"failed to decode pattern: %v\", err)\n\t\t}\n\t\tp = func(i uint) []byte { return b }\n\t\tfmt.Printf(\"PATTERN: %s\", cfg.pattern)\n\t}\n\n\tlogf(\"PING %s FROM %s\", c.LocalAddr(), c.RemoteAddr())\n\n\tbuf := make([]byte, 64)\n\ttick := time.NewTicker(cfg.interval)\n\tfor i := uint(0); cfg.count == 0 || i < cfg.count; i++ {\n\t\tn, err := c.Write(p(i))\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"error writing to socket: %v\", err)\n\t\t}\n\t\tn, err = c.Read(buf)\n\t\tfmt.Printf(\"%d bytes from %s: ping_seq=%d\\n\", n, c.RemoteAddr(), i)\n\t\t<-tick.C\n\t}\n}", "func ping(pings chan <- string, msg string) {\n\tpings <- msg\n}", "func (t *Tracker) Ping() {\n\t// acquire mutex\n\tt.mutex.Lock()\n\tdefer t.mutex.Unlock()\n\n\t// increment\n\tt.pings++\n}", "func pingRequest(cmd *cobra.Command, args []string) error {\n\tisBootstrapNode, bootstrapPeers := isBootstrapNode(args)\n\tvar (\n\t\tlibp2pConfig = libp2p.Config{Peers: bootstrapPeers}\n\t\tctx = context.Background()\n\t\tprivKey *operator.PrivateKey\n\t)\n\n\tbootstrapPeerPrivKey, _ := getBootstrapPeerOperatorKey()\n\tstandardPeerPrivKey, _ := getStandardPeerOperatorKey()\n\n\tif isBootstrapNode {\n\t\tprivKey = bootstrapPeerPrivKey\n\t} else {\n\t\tprivKey = standardPeerPrivKey\n\t}\n\n\tnetProvider, err := libp2p.Connect(\n\t\tctx,\n\t\tlibp2pConfig,\n\t\tprivKey,\n\t\tfirewall.Disabled,\n\t\tretransmission.NewTimeTicker(ctx, 50*time.Millisecond),\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif isBootstrapNode {\n\t\tvar bootstrapAddr string\n\t\tfor _, addr := range netProvider.ConnectionManager().AddrStrings() {\n\t\t\tif strings.Contains(addr, \"ip4\") && !strings.Contains(addr, \"127.0.0.1\") {\n\t\t\t\tbootstrapAddr = addr\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tfmt.Printf(\"You can ping this node using:\\n\"+\n\t\t\t\" %s %s\\n\\n\",\n\t\t\tcmd.CommandPath(),\n\t\t\tbootstrapAddr,\n\t\t)\n\t}\n\n\t// When we call ChannelFor, we create a coordination point for peers\n\tbroadcastChannel, err := netProvider.BroadcastChannelFor(ping)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// PingMessage and PongMessage conform to the net.Message interface\n\t// (Type, Unmarshal, Marshal); ensure our network knows how to serialize\n\t// them when sending over the wire\n\tbroadcastChannel.SetUnmarshaler(\n\t\tfunc() net.TaggedUnmarshaler { return &PingMessage{} },\n\t)\n\tbroadcastChannel.SetUnmarshaler(\n\t\tfunc() net.TaggedUnmarshaler { return &PongMessage{} },\n\t)\n\n\tvar (\n\t\tpingChan = make(chan net.Message)\n\t\tpongChan = make(chan net.Message)\n\t)\n\n\tbroadcastChannel.Recv(ctx, func(msg net.Message) {\n\t\t// Do some message routing\n\t\tif msg.Type() == pong {\n\t\t\tpongChan <- msg\n\t\t}\n\t})\n\n\tbroadcastChannel.Recv(ctx, func(msg net.Message) {\n\t\t// Do some message routing\n\t\tif msg.Type() == ping {\n\t\t\tpingChan <- msg\n\t\t}\n\t})\n\n\t// Give ourselves a moment to form a mesh with the other peer\n\tfor {\n\t\ttime.Sleep(3 * time.Second)\n\t\tpeers := netProvider.ConnectionManager().ConnectedPeers()\n\t\tif len(peers) < 1 {\n\t\t\tfmt.Println(\"waiting for peer...\")\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n\n\tstart := make(chan struct{})\n\treceivedMessages := make(map[string]bool)\n\n\tfor i := 1; i <= messageCount; i++ {\n\t\tmessage := &PingMessage{\n\t\t\tSender: netProvider.ID().String(),\n\t\t\tPayload: ping + \" number \" + strconv.Itoa(i),\n\t\t}\n\n\t\tgo func(msg *PingMessage) {\n\t\t\t<-start\n\t\t\terr := broadcastChannel.Send(ctx, message)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Fprintf(\n\t\t\t\t\tos.Stderr,\n\t\t\t\t\t\"Error while sending PING with payload [%v]: [%v]\\n\",\n\t\t\t\t\tmessage.Payload,\n\t\t\t\t\terr,\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"Sent PING with payload [%v]\\n\", message.Payload)\n\t\t\t}\n\t\t}(message)\n\t}\n\n\tclose(start)\n\n\tfor {\n\t\tselect {\n\t\tcase msg := <-pingChan:\n\t\t\t// don't read our own ping\n\t\t\tif msg.TransportSenderID().String() == netProvider.ID().String() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tpingPayload, ok := msg.Payload().(*PingMessage)\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"expected: payload type PingMessage\\nactual: payload type [%v]\",\n\t\t\t\t\tpingPayload,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tmessage := &PongMessage{\n\t\t\t\tSender: netProvider.ID().String(),\n\t\t\t\tPayload: pong + \" corresponding to \" + pingPayload.Payload,\n\t\t\t}\n\t\t\terr := broadcastChannel.Send(ctx, message)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase msg := <-pongChan:\n\t\t\t// don't read our own pong\n\t\t\tif msg.TransportSenderID().String() == netProvider.ID().String() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// if you read a pong message, go ahead and ack and close out\n\t\t\tpongPayload, ok := msg.Payload().(*PongMessage)\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"expected: payload type PongMessage\\nactual: payload type [%v]\",\n\t\t\t\t\tpongPayload,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tfmt.Printf(\n\t\t\t\t\"Received PONG from [%s] with payload [%v]\\n\",\n\t\t\t\tmsg.TransportSenderID().String(),\n\t\t\t\tpongPayload.Payload,\n\t\t\t)\n\n\t\t\treceivedMessages[pongPayload.Payload] = true\n\n\t\t\tif len(receivedMessages) == messageCount {\n\t\t\t\tfmt.Println(\"All expected messages received\")\n\t\t\t}\n\t\tcase <-ctx.Done():\n\t\t\terr := ctx.Err()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Fprintf(\n\t\t\t\t\tos.Stderr,\n\t\t\t\t\t\"Request errored out: [%v].\\n\",\n\t\t\t\t\terr,\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"Request errored for unknown reason.\\n\")\n\t\t\t}\n\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n}", "func (m *Miner) Ping(ctx context.Context, _ *pb.PingRequest) (*pb.PingReply, error) {\n\tlog.G(m.ctx).Info(\"got ping request from Hub\")\n\treturn &pb.PingReply{}, nil\n}", "func (router Router) sendPing(receiver Peer) {\n\t// Build empty packet.\n\tvar packet Packet\n\t// Fill the headers with the type, ID, Nonce and destPort.\n\tpacket.setHeadersInfo(0, router, receiver)\n\n\t// Since return values from functions are not addressable, we need to\n\t// allocate the receiver UDPAddr\n\tdestUDPAddr := receiver.getUDPAddr()\n\t// Send the packet\n\tsendUDPPacket(\"udp\", destUDPAddr, packet.asBytes())\n}", "func sendHeartbeat(cache *cache.Cache) {\n\tvar routeTable []string\n\n\t(*cache).RWMutex.RLock()\n\tfor node := range *cache.RouteTable {\n\t\trouteTable = append(routeTable, node)\n\t}\n\t(*cache).RWMutex.RUnlock()\n\n\tfor _, node := range routeTable {\n\t\tsplit := strings.Split(node, \":\")\n\t\tip := split[0]\n\t\tport, _ := strconv.Atoi(split[1])\n\t\theartbeatPort := port + 1024\n\t\tmonitorAddr := ip + \":\" + strconv.Itoa(heartbeatPort)\n\t\tlocalAddr := (*cache).Config.Address\n\n\t\ttcpAddr, err := net.ResolveTCPAddr(\"tcp\", monitorAddr)\n\t\tif err != nil {\n\t\t\t(*cache).RWMutex.Lock()\n\t\t\t(*cache.RouteTable)[node] = false\n\t\t\t(*cache).RWMutex.Unlock()\n\t\t\tcontinue\n\t\t}\n\n\t\tconn, err := net.DialTCP(\"tcp\", nil, tcpAddr)\n\t\tif err != nil {\n\t\t\t(*cache).RWMutex.Lock()\n\t\t\t(*cache.RouteTable)[node] = false\n\t\t\t(*cache).RWMutex.Unlock()\n\t\t\tcontinue\n\t\t}\n\t\tdefer (*conn).Close()\n\n\t\trequest := fmt.Sprintf(\"*2\\r\\n$4\\r\\nPING\\r\\n$%d\\r\\n%s\\r\\n\", len(localAddr), localAddr)\n\t\t_, err = conn.Write([]byte(request))\n\t\tif err != nil {\n\t\t\t(*cache).RWMutex.Lock()\n\t\t\t(*cache.RouteTable)[node] = false\n\t\t\t(*cache).RWMutex.Unlock()\n\t\t\tcontinue\n\t\t}\n\n\t\treply := make([]byte, heartbeatPackageSize)\n\t\treader := bufio.NewReader(conn)\n\n\t\t_, err = reader.Read(reply)\n\t\tcommand, _ := protocol.Parser(string(reply))\n\t\tif err != nil {\n\t\t\t(*cache).RWMutex.Lock()\n\t\t\t(*cache.RouteTable)[node] = false\n\t\t\t(*cache).RWMutex.Unlock()\n\t\t\tcontinue\n\t\t}\n\n\t\tif command.Args[0] == \"PONG\" {\n\t\t\t(*cache).RWMutex.Lock()\n\t\t\t(*cache.RouteTable)[node] = true\n\t\t\t(*cache).RWMutex.Unlock()\n\t\t\tcontinue\n\t\t} else if command.Args[0] == \"Deny heartbeat\" {\n\t\t\tlogger.Warning.Printf(command.Args[0]+\" by %s\", node)\n\n\t\t\t// Join cluster\n\t\t\tjoinAddr, err := net.ResolveTCPAddr(\"tcp\", node)\n\t\t\tjoinConn, err := net.DialTCP(\"tcp\", nil, joinAddr)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdefer joinConn.Close()\n\n\t\t\tjoinRequest := fmt.Sprintf(\"*2\\r\\n$4\\r\\nJOIN\\r\\n$%d\\r\\n%s\\r\\n\", len(localAddr), localAddr)\n\t\t\t_, err = joinConn.Write([]byte(joinRequest))\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlogger.Info.Printf(\"Send join cluster request to %s\", node)\n\t\t\tjoinReply := make([]byte, heartbeatPackageSize)\n\t\t\treader := bufio.NewReader(joinConn)\n\n\t\t\t_, err = reader.Read(joinReply)\n\t\t\tcommand, _ := protocol.Parser(string(joinReply))\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif command.Args[0] == \"OK\" {\n\t\t\t\tlogger.Info.Printf(\"Receive route table infomation from cluster, and update it\")\n\t\t\t\tfor index := 1; index < len(command.Args); index++ {\n\t\t\t\t\t(*cache).RWMutex.Lock()\n\t\t\t\t\t(*cache.RouteTable)[command.Args[index]] = false\n\t\t\t\t\t(*cache).RWMutex.Unlock()\n\t\t\t\t}\n\t\t\t\t// TODO print route table\n\n\t\t\t} else if command.Args[0] == \"FAIL\" {\n\t\t\t\t// TODO\n\t\t\t}\n\t\t}\n\t}\n}", "func (s *Server) handlePing(request []byte) {\n\tvar payload serverutil.MsgPing\n\tif err := getPayload(request, &payload); err != nil {\n\t\tlog.Panic(err)\n\t}\n\taddr := payload.AddrSender.String()\n\tp, _ := s.GetPeer(addr)\n\tp.IncreaseBytesReceived(uint64(len(request)))\n\ts.AddPeer(p)\n\ts.Log(true, \"Ping received from :\", addr)\n\ts.sendPong(payload.AddrSender)\n\n}", "func (this *service) Ping(ctx context.Context, _ *empty.Empty) (*empty.Empty, error) {\n\tthis.log.Debug(\"<grpc.service.mihome.Ping>{ }\")\n\n\tthis.Lock()\n\tdefer this.Unlock()\n\n\treturn &empty.Empty{}, nil\n}", "func ping(s *discordgo.Session, m *discordgo.MessageCreate, message []string) {\n\tarrivalTime, err := m.Timestamp.Parse()\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\treturn\n\t}\n\tif message[0] == \"ping\" {\n\t\ts.ChannelMessageSend(m.ChannelID, fmt.Sprintf(\"Pong! %dms\",\n\t\t\ttime.Since(arrivalTime).Nanoseconds()/1000000))\n\t} else {\n\t\ts.ChannelMessageSend(m.ChannelID, fmt.Sprintf(\"Ping! %dms\",\n\t\t\ttime.Since(arrivalTime).Nanoseconds()/1000000))\n\t}\n}", "func ping(c *bm.Context) {\n\tif err := spySrv.Ping(c); err != nil {\n\t\tlog.Error(\"spy admin ping error(%v)\", err)\n\t\tc.JSON(nil, err)\n\t\tc.AbortWithStatus(http.StatusServiceUnavailable)\n\t}\n}", "func (p *Endpoint) Ping() error {\n\treturn p.send(p.session, p.encodePingCmd())\n}", "func (kademlia *Kademlia) SendPing(contact *Contact) (*Contact, error) {\n\n\tresultChannel := make(chan sendPingResult)\n\n\tgo func() {\n\t\tlog.Printf(\"Sending ping to %v\\n\", kademlia.GetContactAddress(contact))\n\t\tclient, err := rpc.DialHTTP(\"tcp\", kademlia.GetContactAddress(contact))\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Connection error, marking node dead\")\n\t\t\tkademlia.RoutingTable.MarkDead(contact)\n\t\t\tresultChannel <- sendPingResult{nil, err}\n\t\t\treturn\n\t\t}\n\n\t\tping := new(Ping)\n\t\tping.Sender = *kademlia.RoutingTable.SelfContact\n\t\tping.MsgID = NewRandomID()\n\t\tvar pong Pong\n\n\t\terr = client.Call(\"Kademlia.Ping\", ping, &pong)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error in remote node response, marking node dead\")\n\t\t\tkademlia.RoutingTable.MarkDead(contact)\n\t\t\tresultChannel <- sendPingResult{nil, err}\n\t\t\treturn\n\t\t}\n\n\t\t//log.Printf(\"Received pong from %v:%v\\n\", pong.Sender.Host, pong.Sender.Port)\n\t\t//log.Printf(\" Node ID: %v\\n\", pong.Sender.NodeID.AsString())\n\n\t\tif ping.MsgID.Equals(pong.MsgID) {\n\t\t\tkademlia.markAliveAndPossiblyPing(&pong.Sender)\n\t\t} else {\n\t\t\tlog.Printf(\"Incorrect MsgID\\n\")\n\t\t\tlog.Printf(\" Ping Message ID: %v\\n\", ping.MsgID.AsString())\n\t\t\tlog.Printf(\" Pong Message ID: %v\\n\", pong.MsgID.AsString())\n\t\t\tkademlia.RoutingTable.MarkDead(contact)\n\t\t}\n\n\t\tclient.Close()\n\t\tresultChannel <- sendPingResult{&pong.Sender, nil}\n\t\treturn\n\t}()\n\n\tselect {\n\tcase result := <-resultChannel:\n\t\treturn result.contact, result.err\n\tcase <-time.NewTimer(primitiveTimeout).C:\n\t\treturn nil, errors.New(\"Timed out\")\n\t}\n}", "func (a *API) Ping(ctx context.Context) (*PingResult, error) {\n\tres := &PingResult{}\n\t_, err := a.get(ctx, ping, nil, res)\n\n\treturn res, err\n}", "func (p *peerAddr) ping(curTime time.Time) {\n\n\t// Advance forward and record the current time.\n\tp.lastPing = p.lastPing.Next()\n\tp.lastPing.Value = curTime\n}", "func (conn *Conn) ping(ctx context.Context) {\n\tdefer conn.wg.Done()\n\ttick := time.NewTicker(conn.cfg.PingFreq)\n\tfor {\n\t\tselect {\n\t\tcase <-tick.C:\n\t\t\tconn.Ping(fmt.Sprintf(\"%d\", time.Now().UnixNano()))\n\t\tcase <-ctx.Done():\n\t\t\t// control channel closed, bail out\n\t\t\ttick.Stop()\n\t\t\treturn\n\t\t}\n\t}\n}", "func PingPeer() {\n\t// If the payload is not empty, the recipient MUST generate a PONG frame containing the same Data.\n}", "func (p *Protocol) Ping(ctx context.Context, addr string) error {\n\tmsg, err := p.node.RequestMessage(ctx, addr, Ping{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to ping: %w\", err)\n\t}\n\n\tif _, ok := msg.(Pong); !ok {\n\t\treturn errors.New(\"did not get a pong back\")\n\t}\n\n\treturn nil\n}", "func pingMasterNode(url string, subNodeIP string, updateTimeDelaySecond float64) {\n\t// Gets system information and adds it to POST request payload\n\tbase64Image := getBase64Screenshot()\n\tbatteryLevelPercentage := getBatteryPercentage()\n\tportInfo := getOpenPorts()\n\tfmt.Println(portInfo)\n\tpayload := strings.NewReader(fmt.Sprintf(\"Base64Image=%s&BatteryLevelPercentage=%s&IP=%s&PortInfo=%s\", base64Image, batteryLevelPercentage, subNodeIP, portInfo))\n\n\t// Defines POST request with appropriate header(s)\n\treq, err := http.NewRequest(\"POST\", url, payload)\n\thandleError(err)\n\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\treq.Header.Add(\"cache-control\", \"no-cache\") // ??? Why is this required ???\n\treq.Header.Add(\"Postman-Token\", \"93b74e57-31fd-436d-976c-e10f223dc185\") // ??? Why is this required ???\n\n\t// Sends POST request\n\tres, err := http.DefaultClient.Do(req)\n\thandleError(err)\n\trespBody, err := ioutil.ReadAll(res.Body)\n\thandleError(err)\n\tfmt.Println(string(respBody))\n\tres.Body.Close()\n}", "func (p *protocol) Ping() error {\n\tlog.Debugf(\"[T %s > %s] Sending ping\", p.conn.LocalAddr().String(), p.conn.RemoteAddr().String())\n\treturn p.conn.SendMessage(&protocolPING{})\n}", "func Pinging(memberList *[]MemberID, msgQueue *[]GossipMessage, selfMember *MemberID) {\n\tfor {\n\t\tif len(*msgQueue) == 0 {\n\t\t\tvar msg GossipMessage\n\t\t\tmsg.Status = 3\n\t\t\tGossip(msg, memberList, msgQueue, selfMember)\n\t\t} else {\n\t\t\t// fmt.Println(*msgQueue)\n\t\t\tGossip((*msgQueue)[0], memberList, msgQueue, selfMember)\n\t\t\t*msgQueue = (*msgQueue)[1:]\n\t\t}\n\t\ttime.Sleep(600 * time.Millisecond)\n\t}\n}", "func (p *kping) send(index int, addrBatchChan chan addrBatch) {\n\tstime := time.Now()\n\t// create ICMP Echo packet\n\tt := make([]byte, p.size)\n\tb := icmp.Echo{ID: icmpIDSeqInitNum + index, Data: t}\n\tm := icmp.Message{\n\t\tType: ipv4.ICMPTypeEcho,\n\t\tCode: 0,\n\t\tBody: &b,\n\t}\n\t// message cache\n\twms := make([]message, 0, p.sendOpts.BatchSize)\nL:\n\tfor {\n\t\tvar ab addrBatch\n\t\tvar ok bool\n\t\tselect {\n\t\tcase <-p.context.Done():\n\t\t\tbreak L // send timeout\n\t\tcase ab, ok = <-addrBatchChan:\n\t\t\tif !ok {\n\t\t\t\tbreak L // send done\n\t\t\t}\n\t\t}\n\t\t// get lock, at most one sent goroutine working\n\t\tp.sendLock.Lock()\n\t\tstime2 := time.Now()\n\t\tb.Seq = icmpIDSeqInitNum + ab.seq\n\t\t// fill icmp payload with current timestamp\n\t\tnsec := time.Now().UnixNano()\n\t\tfor i := uint64(0); i < uint64(p.size); i++ {\n\t\t\tif i < timeSliceLength {\n\t\t\t\tt[i] = byte((nsec >> ((7 - i) * timeSliceLength)) & 0xff)\n\t\t\t} else {\n\t\t\t\tt[i] = 1\n\t\t\t}\n\t\t}\n\t\tbytes, _ := (&m).Marshal(nil)\n\t\t// reuse message cache\n\t\twms2 := wms[0:0:len(ab.addrs)]\n\t\tfor _, addr := range ab.addrs {\n\t\t\tmsg := message{\n\t\t\t\tBuffers: [][]byte{bytes},\n\t\t\t\tAddr: addr,\n\t\t\t}\n\t\t\twms2 = append(wms2, msg)\n\t\t}\n\t\tvar num int\n\t\tvar err error\n\t\tfor {\n\t\t\t// blocking write multi messages\n\t\t\tnum, err = p.rawConn.writeBatch(wms2, 0)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"kping send: %d(%d), seq: %d, writeBatch failed: %v\\n\", index, p.sendOpts.Parallel, ab.seq, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tif num != len(wms2) {\n\t\t\tfmt.Fprintf(os.Stderr, \"kping send: %d(%d), seq: %d, writeBatch parted: %d(%d)\\n\", index, p.sendOpts.Parallel, ab.seq, len(wms2), num)\n\t\t}\n\t\tdurTime := time.Since(stime2)\n\t\tif durTime > 50*time.Millisecond {\n\t\t\tfmt.Fprintf(os.Stderr, \"kping send: %d(%d), seq: %d, writeBatch %d(%d), usedTime: %s\\n\", index, p.sendOpts.Parallel, ab.seq, len(wms2), num, durTime)\n\t\t}\n\t\tfor _, msg := range wms2[0:num] {\n\t\t\taddr := msg.Addr.String()\n\t\t\tdurTime := time.Since(stime2)\n\t\t\tp.ipEventChan <- &ipEvent{\n\t\t\t\tip: addr,\n\t\t\t\tseq: b.Seq,\n\t\t\t\tsendDuration: durTime,\n\t\t\t}\n\t\t}\n\t\t// wait a little time\n\t\ttime.Sleep(p.sendOpts.WaitTimeout)\n\t\tp.sendLock.Unlock()\n\t}\n\tfmt.Fprintf(os.Stderr, \"kping send: %d(%d) done, usedTime: %s\\n\", index, p.sendOpts.Parallel, time.Since(stime))\n}", "func (h *Handler) Ping() error {\n\tresult := h.ring.Ping()\n\tif result.Val() != \"PONG\" {\n\t\treturn ErrPing\n\t}\n\n\treturn nil\n}", "func (client *activeClient) Ping(c *ishell.Context) error {\n\treturn client.RPC.Call(\"API.Ping\", void, &void)\n}", "func (s *Server) handlePing(p Peer, ping *payload.Ping) error {\n\terr := p.HandlePing(ping)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = s.requestBlocksOrHeaders(p)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn p.EnqueueP2PMessage(NewMessage(CMDPong, payload.NewPing(s.chain.BlockHeight(), s.id)))\n}", "func (this *PreferenceController) Ping(writer http.ResponseWriter, request *http.Request) *result.WebResult {\n\n\treturn this.Success(core.VERSION)\n\n}", "func (this *PreferenceController) Ping(writer http.ResponseWriter, request *http.Request) *result.WebResult {\n\n\treturn this.Success(core.VERSION)\n\n}", "func (r *RPC) Ping(c context.Context, arg *struct{}, res *struct{}) (err error) {\n\treturn\n}", "func (r *RPC) Ping(c context.Context, arg *struct{}, res *struct{}) (err error) {\n\treturn\n}", "func (a *Client) Ping(params *PingParams, authInfo runtime.ClientAuthInfoWriter) (*PingOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPingParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"ping\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &PingReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*PingOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for ping: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (s *Session) Ping() (rtt time.Duration, err error) {\n\tnow := time.Now()\n\tdeadline := time.NewTimer(s.config.KeepAliveTimeout)\n\tdefer deadline.Stop()\n\tsid, done := s.pings.new()\n\tdefer s.pings.close(sid)\n\tif err = s.sendFrame(typePing, flagSYN, sid, 0); err != nil {\n\t\treturn\n\t}\n\n\tselect {\n\tcase <-done:\n\t\trtt = time.Now().Sub(now)\n\tcase <-deadline.C:\n\t\terr = ErrTimeout\n\tcase <-s.done:\n\t\terr = ErrSessionClosed\n\t}\n\treturn\n}", "func (s *Service) Ping(topicID string) error {\n\tt := time.Now()\n\tpf, err := s.client.Publish(topicID, []byte(fmt.Sprintf(\"pinged at %s\", t)), 2, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn pf.Wait(5 * time.Second)\n}", "func (m *Memberlist) Ping(node string, addr net.Addr) (time.Duration, error) {\n\t// Prepare a ping message and setup an ack handler.\n\tselfAddr, selfPort := m.getAdvertise()\n\tping := ping{\n\t\tSeqNo: m.nextSeqNo(),\n\t\tNode: node,\n\t\tSourceAddr: selfAddr,\n\t\tSourcePort: selfPort,\n\t\tSourceNode: m.config.Name,\n\t}\n\tackCh := make(chan ackMessage, m.config.IndirectChecks+1)\n\tm.setProbeChannels(ping.SeqNo, ackCh, nil, m.config.ProbeInterval)\n\n\ta := Address{Addr: addr.String(), Name: node}\n\n\t// Send a ping to the node.\n\tif err := m.encodeAndSendMsg(a, pingMsg, &ping); err != nil {\n\t\treturn 0, err\n\t}\n\n\t// Mark the sent time here, which should be after any pre-processing and\n\t// system calls to do the actual send. This probably under-reports a bit,\n\t// but it's the best we can do.\n\tsent := time.Now()\n\n\t// Wait for response or timeout.\n\tselect {\n\tcase v := <-ackCh:\n\t\tif v.Complete == true {\n\t\t\treturn v.Timestamp.Sub(sent), nil\n\t\t}\n\tcase <-time.After(m.config.ProbeTimeout):\n\t\t// Timeout, return an error below.\n\t}\n\n\tm.logger.Printf(\"[DEBUG] memberlist: Failed UDP ping: %v (timeout reached)\", node)\n\treturn 0, NoPingResponseError{ping.Node}\n}", "func (a *api) h_GET_ping(c *gin.Context) {\n\ta.logger.Debug(\"GET /ping\")\n\t//\terr := a.EmSender.Send(\"[email protected]\", \"Hello Dima\", \"How are U?/nDima.\")\n\t//\tif err != nil {\n\t//\t\ta.logger.Error(\"Could not send err=\", err)\n\t//\t}\n\tc.String(http.StatusOK, \"pong URL conversion is \"+composeURI(c.Request, \"\"))\n}", "func ping(c *bm.Context) {\n}", "func (m *Manager) Ping() string {\n\tnodes := m.Nodes()\n\tcommittedNodesLen := len(nodes)\n\n\tif committedNodesLen > 0 {\n\t\tnode := nodes[0]\n\n\t\tres, err := http.Get(node.LocalIP)\n\n\t\tif err != nil {\n\t\t\tlog.Print(\"Target horde node is either unhealthy or down!\", err)\n\t\t}\n\n\t\tdefer res.Body.Close()\n\n\t\tif res.StatusCode == http.StatusOK {\n\t\t\t_, err := ioutil.ReadAll(res.Body)\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Print(\"Failed to read body\", err)\n\n\t\t\t\treturn \"pang\"\n\t\t\t}\n\n\t\t\treturn \"pong\"\n\t\t}\n\t}\n\n\treturn \"pang\"\n}", "func ping(c *bm.Context) {\n\tif err := Svc.Ping(c); err != nil {\n\t\tlog.Error(\"svr.Ping error(%v)\", err)\n\t\tc.AbortWithStatus(http.StatusServiceUnavailable)\n\t}\n}", "func pingTimeoutHandler(_ *PingMessageTask, env *Env) {\n log.Debugf(\"Ping Timeout #%+v\", env.session.GetCurrentMissingHb())\n\n\tif !env.IsHeartbeatAllowed() {\n\t\tlog.Debug(\"Exceeded missing_hb_allowed. Stop ping task...\")\n \n // Get dot peer common name from current session\n cn, err := env.session.DtlsGetPeerCommonName()\n if err != nil {\n log.WithError(err).Error(\"DtlsGetPeercCommonName() failed\")\n return\n }\n\n // Get customer from common name\n customer, err := models.GetCustomerByCommonName(cn)\n if err != nil || customer.Id == 0 {\n log.WithError(err).Error(\"Customer not found.\")\n return\n }\n\n // Trigger mitigation mechanism is active\n log.Debug(\"Start Trigger Mitigation mechanism.\")\n err = controllers.TriggerMitigation(customer)\n if err != nil {\n log.WithError(err).Error(\"TriggerMitigation() failed\")\n return\n }\n env.session.SetIsPingTask(false)\n\n log.Debugf(\"DTLS session: %+v has already disconnected. Terminate session...\", env.session.String())\n env.session.TerminateConnectingSession(env.context)\n return\n }\n log.Debugf(\"[Session Mngt Thread]: Re-send ping message (id = %+v) to check client connection\", env.pingMessageTask.message.MessageID)\n env.Run(env.pingMessageTask)\n}", "func ping(c *bm.Context) {\n\n}", "func (s *SimpleHandler) Ping() (*computing.StatusOfService, error) {\n\tfmt.Print(\"Pong!\\n\")\n\treturn &computing.StatusOfService{Version: \"0.0.1\", Network: \"9090\"}, nil\n}", "func (vs *ViewServer) Ping(args *PingArgs, reply *PingReply) error {\n\t\n\tvs.viewMu.Lock()\n\n\tif vs.getViewNum() == 0 {\n\t\t// If current view number in ping is 0\n\n\t\t// If ping view number is 0\n\t\tif args.Viewnum == 0 {\n\t\t\t// put the ping server into primary\n\t\t\tvs.currentView.Primary = args.Me\n\t\t\tvs.acked = false\n\t\t\tvs.increaseViewNum()\n\t\t} else {\n\t\t\t// If ping view number is greater than 0\n\t\t\t// ignore this case\n\t\t}\n\t} else {\n\t\t// If current view number in ping is greater than 0\n\t\tif vs.acked == false {\n\t\t\t// If acked is false\n\n\t\t\tif args.Me == vs.currentView.Primary {\n\t\t\t\t// If primary pings\n\t\t\t\t// If ping number equals to current view\n\t\t\t\tif args.Viewnum == vs.getViewNum() {\n\t\t\t\t\t// set acked = true\n\t\t\t\t\tvs.acked = true\n\t\t\t\t\tif vs.currentView.Backup == \"\" && len(vs.idle) > 0 {\n\t\t\t\t\t\ttestLog(\"ACKED = False && PRIMARY -> Move Idle \" + vs.idle[0] + \"to backup\")\n\t\t\t\t\t\tvs.currentView.Backup = vs.idle[0]\n\t\t\t\t\t\tvs.idle = vs.idle[1:]\n\t\t\t\t\t}\n\t\t\t\t\ttestLog(\"ACKED = False && PRIMARY -> Current view: \" + convertView(vs.currentView) + \" is acked by primary\" + args.Me)\n\t\t\t\t\t//\t\t\t\t\tfmt.Println(vs.currentView, \" acked by \", vs.currentView.Primary)\n\t\t\t\t} else {\n\t\t\t\t\t// If ping number less than current view(including the case when primary restarts)\n\t\t\t\t\t// ignore this case\n\t\t\t\t\ttestLog(\"ACKED = False && PRIMARY -> WRONG CASE: Primary ping view number \" + strconv.Itoa(int(args.Viewnum)) + \"--> Current viewnum is \" + strconv.Itoa(int(vs.currentView.Viewnum)))\n//\t\t\t\t\tfmt.Println(\"CAODAN ERHAO *(*(*(*(*(*(*(*(\")\n\t\t\t\t}\n\t\t\t} else if args.Me == vs.currentView.Backup {\n\t\t\t\t// If backup pings\n\t\t\t\t// Do nothing.\n\t\t\t\ttestLog(\"ACKED = False && BACKUP -> \" + args.Me + \" pinged view \" + strconv.Itoa(int(args.Viewnum)))\n\t\t\t\t//\t\t\t\tfmt.Println(\"TEST #4: \", vs.currentView)\n\t\t\t} else {\n\t\t\t\t// If others pings\n\t\t\t\t// put it into idle\n\t\t\t\tif !idleContains(vs.idle, args.Me) {\n\t\t\t\t\ttestLog(\"ACKED = False && OTHERS -> \" + args.Me + \" added to idle\")\n\t\t\t\t\tvs.idle = append(vs.idle, args.Me)\n\t\t\t\t}\n\t\t\t\ttestLog(\"ACKED = False && OTHERS -> \" + args.Me + \" pinged view \" + strconv.Itoa(int(args.Viewnum)))\n\t\t\t}\n\t\t} else {\n\t\t\t// If acked is true\n\t\t\tif args.Me == vs.currentView.Primary { // If primary pings\n\t\t\t\t// If ping number equals to current view\n\t\t\t\t\t// doing nothing\n\t\t\t\t// If ping number less than current view but more than 0\n\t\t\t\t\t// Do nothing\n\t\t\t\tif args.Viewnum == 0 {\n\t\t\t\t\t// If ping number is 0 (Primary restarts)\n\t\t\t\t\ttestLog(\"ACKED = True && PRIMARY -> \" + args.Me + \" pinged view \" + strconv.Itoa(int(args.Viewnum)) + \" Primary RESTARTS!!!\")\n\t\t\t\t\ttestLog(\"ACKED = True && PRIMARY (View before changed) \" + convertView(vs.currentView))\n\n\t\t\t\t\tif vs.currentView.Backup != \"\" {\n\t\t\t\t\t\t// If has backup\n\t\t\t\t\t\t// promote backup and put the old primary into idle\n\n\t\t\t\t\t\tvs.currentView.Primary = vs.currentView.Backup\n\t\t\t\t\t\tvs.currentView.Backup = args.Me\n\n\t\t\t\t\t\t// Change ack\n\t\t\t\t\t\tvs.acked = false\n\n\t\t\t\t\t\t// Increase view number\n\t\t\t\t\t\tvs.increaseViewNum()\n//\t\t\t\t\t\tfmt.Println(\"TEST #5: \", vs.currentView)\n\t\t\t\t\t\ttestLog(\"ACKED = True to False && PRIMARY (View after changed) \" + convertView(vs.currentView))\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttestLog(\"ACKED = True && PRIMARY is STUCK \" + args.Me + \" pinged \" + strconv.Itoa(int(args.Viewnum)))\n\t\t\t\t\t\t// If no backup\n\t\t\t\t\t\t// STUCK!!\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if args.Me == vs.currentView.Backup {\n\t\t\t\t// If backup pings\n\n\t\t\t\tif args.Viewnum == 0 {\n\t\t\t\t\t// If ping nunmber is 0(restart)\n\t\t\t\t\t// Set backup to \"\", put old backup to idle, set ack = false\n\t\t\t\t\ttestLog(\"ACKED = True && BACKUP -> \" + args.Me + \" pinged view \" + strconv.Itoa(int(args.Viewnum)) + \" Backup RESTARTS!!!\")\n\t\t\t\t\tvs.currentView.Backup = \"\"\n\t\t\t\t\tif !idleContains(vs.idle, args.Me) {\n\t\t\t\t\t\tvs.idle = append(vs.idle, args.Me)\n\t\t\t\t\t}\n\t\t\t\t\tvs.acked = false\n\t\t\t\t\t// Increase view number\n\t\t\t\t\tvs.increaseViewNum()\n\t\t\t\t\ttestLog(\"ACKED = True to False && BACKUP -> Current view is \" + convertView(vs.currentView))\n\t\t\t\t\t//\t\t\t\t\tfmt.Println(\"TEST #6: \", vs.currentView)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// If others pings\n\t\t\t\ttestLog(\"ACKED = True && OTHERS -> \" + args.Me + \" pinged \" + strconv.Itoa(int(args.Viewnum)))\n\t\t\t\tif vs.currentView.Backup == \"\" {\n\t\t\t\t\t// If no backup\n\t\t\t\t\t// put ping server into backup and set acked = false\n//\t\t\t\t\tfmt.Println(\"Before backup added: \", vs.currentView)\n//\t\t\t\t\tfmt.Println(\"Add backup: \", args.Me)\n\t\t\t\t\tif (idleContains(vs.idle, args.Me)) {\n\t\t\t\t\t\tvs.currentView.Backup = vs.idle[0]\n\t\t\t\t\t\tvs.idle = vs.idle[1:]\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvs.currentView.Backup = args.Me\n\t\t\t\t\t}\n\t\t\t\t\tvs.acked = false\n\n\t\t\t\t\t// Increase view number\n\t\t\t\t\tvs.increaseViewNum()\n\t\t\t\t\ttestLog(\"ACKED = True to False && OTHERS -> View after change \" + convertView(vs.currentView))\n\t\t\t\t\t//\t\t\t\t\tfmt.Println(\"After backup added: \", vs.currentView)\n\t\t\t\t} else {\n\t\t\t\t\t// If already has backup\n\t\t\t\t\t// put it into idle\n//\t\t\t\t\tfmt.Println(\"TEST #600: put\", args.Me, \" in idle\")\n\t\t\t\t\tif !idleContains(vs.idle, args.Me) {\n\t\t\t\t\t\tvs.idle = append(vs.idle, args.Me)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Set up the return view\n\tvs.pingKeeper[args.Me] = time.Now()\n\treply.View = vs.currentView\n\ttestLog(\"Returning view\" + convertView(vs.currentView))\n\tvs.viewMu.Unlock()\n\treturn nil\n}", "func (ghost *Ghost) Ping() error {\n\tpingHandler := func(res *Response) error {\n\t\tif res == nil {\n\t\t\tghost.reset = true\n\t\t\treturn errors.New(\"Ping timeout\")\n\t\t}\n\t\treturn nil\n\t}\n\treq := NewRequest(\"ping\", nil)\n\treq.SetTimeout(pingTimeout)\n\treturn ghost.SendRequest(req, pingHandler)\n}", "func (router Router) sendPong(receiver Peer) {\n\t// Build empty packet.\n\tvar packet Packet\n\t// Fill the headers with the type, ID, Nonce and destPort.\n\tpacket.setHeadersInfo(1, router, receiver)\n\n\t// Since return values from functions are not addressable, we need to\n\t// allocate the receiver UDPAddr\n\tdestUDPAddr := receiver.getUDPAddr()\n\t// Send the packet\n\tsendUDPPacket(\"udp\", destUDPAddr, packet.asBytes())\n}", "func (s *Server) sendPing(addrTo *serverutil.NetAddress) ([]byte, error) {\n\taddr := addrTo.String()\n\n\ts.Log(true, \"Ping sent to:\", addr)\n\tpayload := gobEncode(*s.NewPing(addrTo))\n\trequest := append(commandToBytes(\"ping\"), payload...)\n\terr := s.sendData(addrTo.String(), request)\n\tif err == nil {\n\t\tp, _ := s.GetPeer(addr)\n\t\tp.PingSent()\n\t\ts.AddPeer(p)\n\t}\n\treturn request, err\n}", "func (ng Ngrok) Ping() error {\n\tresp, err := http.Get(fmt.Sprintf(\"http://%s:%d/api/tunnels\", ng.host, ng.port))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.StatusCode == 200 {\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"unknown error\")\n}", "func (p *Peer) pingHandler() {\n\tpingTicker := time.NewTicker(pingInterval)\n\tdefer pingTicker.Stop()\n\nout:\n\tfor {\n\t\tselect {\n\t\tcase <-pingTicker.C:\n\t\t\tnonce, err := wire.RandomUint64()\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Not sending ping to %s: %v\", p, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tp.QueueMessage(wire.NewMsgPing(nonce), nil)\n\n\t\tcase <-p.quit:\n\t\t\tbreak out\n\t\t}\n\t}\n}", "func pingHandler(c *gin.Context) {\n\tvar data TargetPayload\n\tif err := c.Bind(&data); err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tpinger, err := ping.NewPinger(data.Target)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tpinger.SetPrivileged(true)\n\tpinger.Count = 3\n\tpinger.Run()\n\tstats := pinger.Statistics()\n\tc.JSON(http.StatusOK, gin.H{\"status\": stats})\n}", "func (c *Conn) ping() error {\n\treturn c.write(websocket.PingMessage, []byte{})\n}", "func (cc *ClientConn) Ping(ctx context.Context) error {\n\tc := make(chan struct{})\n\t// Generate a random payload\n\tvar p [8]byte\n\tfor {\n\t\tif _, err := rand.Read(p[:]); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcc.mu.Lock()\n\t\t// check for dup before insert\n\t\tif _, found := cc.pings[p]; !found {\n\t\t\tcc.pings[p] = c\n\t\t\tcc.mu.Unlock()\n\t\t\tbreak\n\t\t}\n\t\tcc.mu.Unlock()\n\t}\n\terrc := make(chan error, 1)\n\tgo func() {\n\t\tcc.wmu.Lock()\n\t\tdefer cc.wmu.Unlock()\n\t\tif err := cc.fr.WritePing(false, p); err != nil {\n\t\t\terrc <- err\n\t\t\treturn\n\t\t}\n\t\tif err := cc.bw.Flush(); err != nil {\n\t\t\terrc <- err\n\t\t\treturn\n\t\t}\n\t}()\n\tselect {\n\tcase <-c:\n\t\treturn nil\n\tcase err := <-errc:\n\t\treturn err\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase <-cc.readerDone:\n\t\t// connection closed\n\t\treturn cc.readerErr\n\t}\n}", "func (finux *Finux) Ping() (err error) {\n\terr = finux.do(\"ping\", http.MethodGet, nil, nil)\n\treturn\n}", "func (a *Client) Ping(params *PingParams) (*PingOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPingParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"Ping\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/ping\",\n\t\tProducesMediaTypes: []string{\"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"text/plain\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &PingReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*PingOK), nil\n\n}", "func (sdk *SDK) Ping() error {\n\treturn sdk.Verify()\n}", "func ping(w http.ResponseWriter, req *http.Request) {\n\n\t// Manage Cors\n\tsetCors(&w)\n\tif req.Method == \"OPTIONS\" {\n\t\treturn\n\t}\n\n\tresp := PingResp{\n\t\tMessage: \"pong\",\n\t}\n\tjs, err := json.Marshal(resp)\n\tif err != nil {\n\t\tlogger.Error(\"failed to marshal json sending 500: %v\", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(\"500 - Something went wrong on our end\"))\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(js)\n\treturn\n}", "func (conn *Conn) Ping(message string) { conn.Raw(PING + \" :\" + message) }", "func (e *Exporter) getVpnSemp1(ch chan<- prometheus.Metric) (ok float64) {\n\n\ttype Data struct {\n\t\tRPC struct {\n\t\t\tShow struct {\n\t\t\t\tMessageVpn struct {\n\t\t\t\t\tVpn []struct {\n\t\t\t\t\t\tName string `xml:\"name\"`\n\t\t\t\t\t\tLocalStatus string `xml:\"local-status\"`\n\t\t\t\t\t\tConnections float64 `xml:\"connections\"`\n\t\t\t\t\t\tStats struct {\n\t\t\t\t\t\t\tDataRxByteCount float64 `xml:\"client-data-bytes-received\"`\n\t\t\t\t\t\t\tDataRxMsgCount float64 `xml:\"client-data-messages-received\"`\n\t\t\t\t\t\t\tDataTxByteCount float64 `xml:\"client-data-bytes-sent\"`\n\t\t\t\t\t\t\tDataTxMsgCount float64 `xml:\"client-data-messages-sent\"`\n\t\t\t\t\t\t\tAverageRxByteRate float64 `xml:\"average-ingress-byte-rate-per-minute\"`\n\t\t\t\t\t\t\tAverageRxMsgRate float64 `xml:\"average-ingress-rate-per-minute\"`\n\t\t\t\t\t\t\tAverageTxByteRate float64 `xml:\"average-egress-byte-rate-per-minute\"`\n\t\t\t\t\t\t\tAverageTxMsgRate float64 `xml:\"average-egress-rate-per-minute\"`\n\t\t\t\t\t\t\tRxByteRate float64 `xml:\"current-ingress-byte-rate-per-second\"`\n\t\t\t\t\t\t\tRxMsgRate float64 `xml:\"current-ingress-rate-per-second\"`\n\t\t\t\t\t\t\tTxByteRate float64 `xml:\"current-egress-byte-rate-per-second\"`\n\t\t\t\t\t\t\tTxMsgRate float64 `xml:\"current-egress-rate-per-second\"`\n\t\t\t\t\t\t\tIngressDiscards struct {\n\t\t\t\t\t\t\t\tDiscardedRxMsgCount float64 `xml:\"total-ingress-discards\"`\n\t\t\t\t\t\t\t} `xml:\"ingress-discards\"`\n\t\t\t\t\t\t\tEgressDiscards struct {\n\t\t\t\t\t\t\t\tDiscardedTxMsgCount float64 `xml:\"total-egress-discards\"`\n\t\t\t\t\t\t\t} `xml:\"egress-discards\"`\n\t\t\t\t\t\t} `xml:\"stats\"`\n\t\t\t\t\t} `xml:\"vpn\"`\n\t\t\t\t} `xml:\"message-vpn\"`\n\t\t\t} `xml:\"show\"`\n\t\t} `xml:\"rpc\"`\n\t\tExecuteResult struct {\n\t\t\tResult string `xml:\"code,attr\"`\n\t\t} `xml:\"execute-result\"`\n\t}\n\n\tcommand := \"<rpc><show><message-vpn><vpn-name>*</vpn-name><stats/></message-vpn></show></rpc>\"\n\tbody, err := postHTTP(e.config.scrapeURI+\"/SEMP\", e.config.sslVerify, e.config.timeout, \"application/xml\", command)\n\tif err != nil {\n\t\tlevel.Error(e.logger).Log(\"msg\", \"Can't scrape VpnSemp1\", \"err\", err)\n\t\treturn 0\n\t}\n\tdefer body.Close()\n\tdecoder := xml.NewDecoder(body)\n\tvar target Data\n\terr2 := decoder.Decode(&target)\n\tif err2 != nil {\n\t\tlevel.Error(e.logger).Log(\"msg\", \"Can't decode Xml VpnSemp1\", \"err\", err2)\n\t\treturn 0\n\t}\n\tif target.ExecuteResult.Result != \"ok\" {\n\t\tlevel.Error(e.logger).Log(\"command\", command)\n\t\treturn 0\n\t}\n\n\tfor _, vpn := range target.RPC.Show.MessageVpn.Vpn {\n\t\tch <- prometheus.MustNewConstMetric(metricsStd[\"vpn_connection_count\"], prometheus.GaugeValue, vpn.Connections, vpn.Name)\n\t\tch <- prometheus.MustNewConstMetric(metricsStd[\"vpn_local_status\"], prometheus.GaugeValue, encodeMetricMulti(vpn.LocalStatus, []string{\"Down\", \"Up\"}), vpn.Name)\n\n\t\tch <- prometheus.MustNewConstMetric(metricsStd[\"vpn_rx_msg_count\"], prometheus.GaugeValue, vpn.Stats.DataRxMsgCount, vpn.Name)\n\t\tch <- prometheus.MustNewConstMetric(metricsStd[\"vpn_tx_msg_count\"], prometheus.GaugeValue, vpn.Stats.DataTxMsgCount, vpn.Name)\n\t\tch <- prometheus.MustNewConstMetric(metricsStd[\"vpn_rx_byte_count\"], prometheus.GaugeValue, vpn.Stats.DataRxByteCount, vpn.Name)\n\t\tch <- prometheus.MustNewConstMetric(metricsStd[\"vpn_tx_byte_count\"], prometheus.GaugeValue, vpn.Stats.DataTxByteCount, vpn.Name)\n\t\tch <- prometheus.MustNewConstMetric(metricsStd[\"vpn_rx_discard_msg_count\"], prometheus.GaugeValue, vpn.Stats.IngressDiscards.DiscardedRxMsgCount, vpn.Name)\n\t\tch <- prometheus.MustNewConstMetric(metricsStd[\"vpn_tx_discard_msg_count\"], prometheus.GaugeValue, vpn.Stats.EgressDiscards.DiscardedTxMsgCount, vpn.Name)\n\n\t\tif e.config.scrapeRates {\n\t\t\tch <- prometheus.MustNewConstMetric(metricsStd[\"vpn_rx_msg_rate\"], prometheus.GaugeValue, vpn.Stats.RxMsgRate, vpn.Name)\n\t\t\tch <- prometheus.MustNewConstMetric(metricsStd[\"vpn_tx_msg_rate\"], prometheus.GaugeValue, vpn.Stats.TxMsgRate, vpn.Name)\n\t\t\tch <- prometheus.MustNewConstMetric(metricsStd[\"vpn_rx_byte_rate\"], prometheus.GaugeValue, vpn.Stats.RxByteRate, vpn.Name)\n\t\t\tch <- prometheus.MustNewConstMetric(metricsStd[\"vpn_tx_byte_rate\"], prometheus.GaugeValue, vpn.Stats.TxByteRate, vpn.Name)\n\t\t\tch <- prometheus.MustNewConstMetric(metricsStd[\"vpn_rx_msg_rate_avg\"], prometheus.GaugeValue, vpn.Stats.AverageRxMsgRate, vpn.Name)\n\t\t\tch <- prometheus.MustNewConstMetric(metricsStd[\"vpn_tx_msg_rate_avg\"], prometheus.GaugeValue, vpn.Stats.AverageTxMsgRate, vpn.Name)\n\t\t\tch <- prometheus.MustNewConstMetric(metricsStd[\"vpn_rx_byte_rate_avg\"], prometheus.GaugeValue, vpn.Stats.AverageRxByteRate, vpn.Name)\n\t\t\tch <- prometheus.MustNewConstMetric(metricsStd[\"vpn_tx_byte_rate_avg\"], prometheus.GaugeValue, vpn.Stats.AverageTxByteRate, vpn.Name)\n\t\t}\n\t}\n\n\treturn 1\n}", "func (s *Status) Ping(args struct{}, reply *struct{}) error {\n\treturn nil\n}", "func (a *Client) Ping(params *PingParams) (*PingOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPingParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"ping\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/ping\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &PingReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*PingOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for ping: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func Ping(session *discordgo.Session, message *discordgo.MessageCreate) {\n\t_, _ = session.ChannelMessageSend(message.ChannelID, \"Pong!\")\n}", "func pinger(cfg config.ConfYaml) error {\n\ttransport := &http.Transport{\n\t\tDial: (&net.Dialer{\n\t\t\tTimeout: 5 * time.Second,\n\t\t}).Dial,\n\t\tTLSHandshakeTimeout: 5 * time.Second,\n\t}\n\tclient := &http.Client{\n\t\tTimeout: time.Second * 10,\n\t\tTransport: transport,\n\t}\n\tresp, err := client.Get(\"http://localhost:\" + cfg.Core.Port + cfg.API.HealthURI)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"server returned non-200 status code\")\n\t}\n\treturn nil\n}", "func (a *Client) V1Ping(params *V1PingParams) (*V1PingOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewV1PingParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"V1Ping\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/v1/ping\",\n\t\tProducesMediaTypes: []string{\"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"text/plain\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &V1PingReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*V1PingOK), nil\n\n}", "func (vs *ViewServer) Ping(args *PingArgs, reply *PingReply) error {\n\n\tvs.mu.Lock()\n\tlog.Printf(\"[viewserver]%+v PING, vs state: vs.view=%+v, vs.primaryAck=%d\", args, vs.view, vs.primaryAck)\n\t// Your code here.\n\n\t//0. keep track by setting pingMap\n\t// if primary viewnum lag behind more than 1 with viewserver, we consider the priamry is dead\n\tif !(vs.view.Primary == args.Me && vs.view.Viewnum > args.Viewnum + 1) {\n\t\tvs.pingTrack[args.Me] = time.Now()\n\t}\n\t\n\tif vs.view.Primary == \"\" && vs.view.Backup == \"\" {\n\t\t// Should prevent uninitialized server to be primary\n\t\t// When primary crashes while there is no backup, we must reboot primary to recovery the service\n\t\t// When primary crashes while backup crashes simultaneously, we can recovery the service through both primary and backup \n\t\tif vs.view.Viewnum == 0 && vs.view.Viewnum == vs.primaryAck {\n\t\t\tvs.view.Primary = args.Me\n\t\t\tvs.view.Viewnum += 1\n\t\t\tlog.Printf(\"[viewserver]add primary %s, reply=%+v\", args.Me, vs.view)\n\t\t}\n\t} else if vs.view.Primary != \"\" && vs.view.Backup == \"\" {\n\t\tif vs.view.Primary == args.Me {\n\t\t\t//primary acknowledge\n\t\t\tif vs.primaryAck == args.Viewnum - 1 {\n\t\t\t\tvs.primaryAck = args.Viewnum\n\t\t\t\tlog.Printf(\"[viewserver]Primary %s ack %d\",args.Me, vs.primaryAck)\n\t\t\t}\n\t\t} else if vs.view.Viewnum == vs.primaryAck {\n\t\t\t//Add Backup \n\t\t\tvs.view.Backup = args.Me\n\t\t\tvs.view.Viewnum += 1\n\t\t}\n\t} else if vs.view.Primary != \"\" && vs.view.Backup != \"\" {\n\t\tif vs.view.Primary == args.Me {\n\t\t\t//primary acknowledge\n\t\t\tif vs.primaryAck == args.Viewnum - 1 {\n\t\t\t\tvs.primaryAck = args.Viewnum\n\t\t\t\tlog.Printf(\"[viewserver]Primary %s ack %d\",args.Me, vs.primaryAck)\n\t\t\t}\n\t\t}\n\t}\n\treply.View = vs.view\n\tvs.mu.Unlock()\n\treturn nil\n}", "func (e *Payments) PingPong(ctx context.Context, stream payments.Payments_PingPongStream) error {\n\tfor {\n\t\treq, err := stream.Recv()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlog.Logf(\"Got ping %v\", req.Stroke)\n\t\tif err := stream.Send(&payments.Pong{Stroke: req.Stroke}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n}", "func (sc *sparkyClient) pingProcessor() {\n\tvar pingCount int\n\tvar ptMax, ptMin int\n\tvar latencyHist pingHistory\n\n\t// We never want to run the ping test beyond maxPingTestLength seconds\n\ttimeout := time.NewTimer(time.Duration(maxPingTestLength) * time.Second)\n\n\t// Signal pingTest() that we're ready\n\tclose(sc.pingProcessorReady)\n\n\tfor {\n\t\tselect {\n\t\tcase <-timeout.C:\n\t\t\t// If we've been pinging for maxPingTestLength, call it quits\n\t\t\treturn\n\t\tcase pt := <-sc.pingTime:\n\t\t\tpingCount++\n\n\t\t\t// Calculate our ping time in microseconds\n\t\t\tptMicro := pt.Nanoseconds() / 1000\n\n\t\t\t// Add this ping to our ping history\n\t\t\tlatencyHist = append(latencyHist, ptMicro)\n\n\t\t\tptMin, ptMax = latencyHist.minMax()\n\n\t\t\t// Advance the progress bar a bit\n\t\t\tsc.pingProgressTicker <- true\n\n\t\t\t// Update the ping stats widget\n\t\t\tsc.wr.jobs[\"latency\"].(*termui.Sparklines).Lines[0].Data = latencyHist.toMilli()\n\t\t\tsc.wr.jobs[\"latencystats\"].(*termui.Par).Text = fmt.Sprintf(\"Cur/Min/Max\\n%.2f/%.2f/%.2f ms\\nAvg/σ\\n%.2f/%.2f ms\",\n\t\t\t\tfloat64(ptMicro/1000), float64(ptMin/1000), float64(ptMax/1000), latencyHist.mean()/1000, latencyHist.stdDev()/1000)\n\t\t\tsc.wr.Render()\n\t\t}\n\t}\n}", "func (s *Service) Ping(c context.Context) (err error) {\n\treturn\n}", "func (p *KiteHTTPPinger) Ping() Status {\n\tres, err := p.Client.Get(p.Address)\n\tif err != nil {\n\t\treturn Failure\n\t}\n\tdefer res.Body.Close()\n\n\tresData, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn Failure\n\t}\n\n\tif string(resData) != kiteHTTPResponse {\n\t\treturn Failure\n\t}\n\n\treturn Success\n}", "func (c *Client) Ping() error {\n\treturn c.request(\"GET\", \"/ping\", nil)\n}", "func ping(c *bm.Context) {\n\tif err := relationSvc.Ping(c); err != nil {\n\t\tlog.Error(\"service ping error(%v)\", err)\n\t\tc.Writer.WriteHeader(http.StatusServiceUnavailable)\n\t}\n}", "func (a API) PingChk() (isNew bool) {\n\tselect {\n\tcase o := <-a.Ch.(chan PingRes):\n\t\tif o.Err != nil {\n\t\t\ta.Result = o.Err\n\t\t} else {\n\t\t\ta.Result = o.Res\n\t\t}\n\t\tisNew = true\n\tdefault:\n\t}\n\treturn\n}", "func (s *Service) Ping(c context.Context) (err error) {\n\t// TODO\n\treturn\n}", "func (bot *Bot) Ping(*gateway.MessageCreateEvent) (string, error) {\n\treturn \"Pong!\", nil\n}" ]
[ "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.5527057", "0.5509152", "0.549565", "0.549565", "0.549565", "0.54849744", "0.5463772", "0.54382706", "0.54319054", "0.54288906", "0.5424734", "0.5420491", "0.5417861", "0.5405799", "0.54052365", "0.54016703", "0.54003817", "0.5398452", "0.5388931", "0.5388059", "0.5335504", "0.53288275", "0.53136086", "0.5299352", "0.5299128", "0.5297227", "0.5283013", "0.52646625", "0.52543813", "0.52510095", "0.5243888", "0.52434385", "0.5242661", "0.5231771", "0.52221984", "0.52032745", "0.52032745", "0.51970714", "0.51970714", "0.5188914", "0.5188798", "0.5182862", "0.51809764", "0.5179869", "0.5161998", "0.516018", "0.5153049", "0.5150076", "0.51449424", "0.51359725", "0.5126401", "0.51250845", "0.5119951", "0.51139516", "0.51071346", "0.5107034", "0.51069427", "0.5105547", "0.51029223", "0.5101393", "0.510105", "0.5099849", "0.5095172", "0.5091246", "0.50886613", "0.5086964", "0.5080788", "0.50788456", "0.5078664", "0.5069034", "0.5066333", "0.5062132", "0.5060682", "0.5060357", "0.50563943", "0.50524443", "0.5049418", "0.50470674", "0.5034817", "0.50255287" ]
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\", bucketKey, testID, filterQs)\n\tcontent, err := client.Get(path)\n\tif err != nil {\n\t\treturn results, err\n\t}\n\n\terr = unmarshal(content, &results)\n\treturn results, err\n}", "func processFilter(keys []string, filter []string) ([]string, bool) {\n\tvar vpps []string\n\tif len(filter) > 0 {\n\t\t// Ignore all parameters but first\n\t\tvpps = strings.Split(filter[0], \",\")\n\t} else {\n\t\t// Show all if there is no filter\n\t\tvpps = keys\n\t}\n\tvar isData bool\n\t// Find at leas one match\n\tfor _, key := range keys {\n\t\tfor _, vpp := range vpps {\n\t\t\tif key == vpp {\n\t\t\t\tisData = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn vpps, isData\n}", "func getFilteredResults(args []interface{}, dtData dtPaginationData) ([]map[string]string, error) { //nolint:lll\n\tvar (\n\t\tresult []map[string]string\n\t\tp = \"%\"\n\t\taux = []interface{}{p}\n\t)\n\n\tresult, err := search(dtData, args)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = getNumberOfResults(dtData, aux)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "func (list *APTAuditList) clearResults() {\n\tlist.mutex.Lock()\n\tlist.results = make([]string, 0)\n\tlist.mutex.Unlock()\n}", "func filterViewResult(input sgbucket.ViewResult, user auth.User, applyChannelFiltering bool) (result sgbucket.ViewResult) {\n\thasStarChannel := false\n\tvar visibleChannels ch.TimedSet\n\tif user != nil {\n\t\tvisibleChannels = user.InheritedChannels()\n\t\thasStarChannel = !visibleChannels.Contains(\"*\")\n\t\tif !applyChannelFiltering {\n\t\t\treturn // this is an error\n\t\t}\n\t}\n\tresult.TotalRows = input.TotalRows\n\tresult.Rows = make([]*sgbucket.ViewRow, 0, len(input.Rows)/2)\n\tfor _, row := range input.Rows {\n\t\tif applyChannelFiltering {\n\t\t\tvalue, ok := row.Value.([]interface{})\n\t\t\tif ok {\n\t\t\t\t// value[0] is the array of channels; value[1] is the actual value\n\t\t\t\tif !hasStarChannel || channelsIntersect(visibleChannels, value[0].([]interface{})) {\n\t\t\t\t\t// Add this row:\n\t\t\t\t\tstripSyncProperty(row)\n\t\t\t\t\tresult.Rows = append(result.Rows, &sgbucket.ViewRow{\n\t\t\t\t\t\tKey: row.Key,\n\t\t\t\t\t\tValue: value[1],\n\t\t\t\t\t\tID: row.ID,\n\t\t\t\t\t\tDoc: row.Doc,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// Add the raw row:\n\t\t\tstripSyncProperty(row)\n\t\t\tresult.Rows = append(result.Rows, &sgbucket.ViewRow{\n\t\t\t\tKey: row.Key,\n\t\t\t\tValue: row.Value,\n\t\t\t\tID: row.ID,\n\t\t\t\tDoc: row.Doc,\n\t\t\t})\n\t\t}\n\n\t}\n\tresult.TotalRows = len(result.Rows)\n\treturn\n}", "func filterResultSet(result couchDbResponse, params dragonfruit.QueryParams,\n\tlimit int, offset int) (int, couchDbResponse, error) {\n\n\tif len(params.QueryParams) < 1 {\n\t\treturn len(result.Rows), result, nil\n\t}\n\toutResult := result\n\n\toutResult.Rows = make([]couchdbRow, 0)\n\tfor _, v := range result.Rows {\n\t\tfor queryParam := range params.QueryParams {\n\n\t\t\tval, ok := v.Value[queryParam]\n\t\t\tif ok && (params.QueryParams.Get(queryParam) == val) {\n\t\t\t\t/*switch val.(type) {}*/\n\n\t\t\t\toutResult.Rows = append(outResult.Rows, v)\n\t\t\t}\n\t\t}\n\t}\n\ttotalNum := len(outResult.Rows)\n\tif int(offset) > totalNum {\n\t\toutResult.Rows = make([]couchdbRow, 0)\n\t} else if int(limit+offset) > len(outResult.Rows) {\n\t\toutResult.Rows = outResult.Rows[offset:len(outResult.Rows)]\n\t} else {\n\t\toutResult.Rows = outResult.Rows[offset:(offset + limit)]\n\t}\n\n\treturn totalNum, outResult, nil\n}", "func FilterPubSimulationResults(_ map[string]*common.CollectionConfigPackage, pubSimulationResults *rwset.TxReadWriteSet) (*rwset.TxReadWriteSet, error) {\n\treturn pubSimulationResults, nil\n}", "func parseResults(byteVal []byte) []NavResults {\n\tvar navResults NavResults\n\tvar navResultsSlice []NavResults\n\n\tvar output FfufOutput\n\tjson.Unmarshal(byteVal, &output)\n\n\tif DEBUGMODE {\n\t\tfmt.Printf(\"[debug] command line: %v\\n\", output.CommandLine)\n\t\tfmt.Printf(\"[debug] target: %v\\n\", output.Config.URL)\n\t\tfmt.Printf(\"[debug] method: %v\\n\", output.Config.Method)\n\t\tfmt.Printf(\"[debug] wordlist: %v\\n\", output.Config.InputProviders[0].Value)\n\t\tfmt.Printf(\"[debug] outputfile: %v\\n\", output.Config.Outputfile)\n\t\tfmt.Printf(\"[debug] time: %v\\n\", output.Time)\n\t\tfmt.Printf(\"[debug] url: %v\\n\", output.Results[0].URL)\n\t}\n\n\tnavResults.URL = output.Config.URL\n\tnavResults.Outputfile = output.Config.Outputfile\n\tnavResults.Wordlist = output.Config.InputProviders[0].Value\n\n\tif len(output.Results) == 0 {\n\t\t// handle storage of metadata for output file with no results\n\t\tnavResultsSlice = append(navResultsSlice, navResults)\n\t} else {\n\t\tfor i := 0; i < len(output.Results); i++ {\n\t\t\tnavResults.Endpoint = output.Results[i].URL\n\t\t\tnavResults.Status = output.Results[i].Status\n\t\t\tnavResults.Length = output.Results[i].Length\n\t\t\tnavResults.Words = output.Results[i].Words\n\t\t\tnavResults.Lines = output.Results[i].Lines\n\n\t\t\tif DEBUGMODE {\n\t\t\t\tfmt.Printf(\"%v [Status: %v, Size: %v, Words: %v, Lines: %v]\\n\", navResults.Endpoint, navResults.Status, navResults.Length, navResults.Words, navResults.Lines)\n\t\t\t}\n\n\t\t\tnavResultsSlice = append(navResultsSlice, navResults)\n\t\t}\n\t}\n\n\treturn navResultsSlice\n}", "func (client *BaseClient) Query(filter map[string]interface{}) map[string]string {\n\ttmp := make(map[string]interface{})\n\tbyt, _ := json.Marshal(filter)\n\t_ = json.Unmarshal(byt, &tmp)\n\n\tresult := make(map[string]string)\n\tfor key, value := range tmp {\n\t\tfilterValue := reflect.ValueOf(value)\n\t\tflatRepeatedList(filterValue, result, key)\n\t}\n\n\treturn result\n}", "func resultToQueryItems(queryType string, results Results) ([]QueryItem, error) {\n\tresultSize := int64(results.Results.Total)\n\tif resultSize < 1 {\n\t\treturn nil, nil\n\t}\n\tvar items = make([]QueryItem, resultSize)\n\tswitch queryType {\n\tcase types.QtAdminCatalogItem:\n\t\tfor i, item := range results.Results.AdminCatalogItemRecord {\n\t\t\titems[i] = QueryCatalogItem(*item)\n\t\t}\n\tcase types.QtCatalogItem:\n\t\tfor i, item := range results.Results.CatalogItemRecord {\n\t\t\titems[i] = QueryCatalogItem(*item)\n\t\t}\n\tcase types.QtMedia:\n\t\tfor i, item := range results.Results.MediaRecord {\n\t\t\titems[i] = QueryMedia(*item)\n\t\t}\n\tcase types.QtAdminMedia:\n\t\tfor i, item := range results.Results.AdminMediaRecord {\n\t\t\titems[i] = QueryMedia(*item)\n\t\t}\n\tcase types.QtVappTemplate:\n\t\tfor i, item := range results.Results.VappTemplateRecord {\n\t\t\titems[i] = QueryVAppTemplate(*item)\n\t\t}\n\tcase types.QtAdminVappTemplate:\n\t\tfor i, item := range results.Results.AdminVappTemplateRecord {\n\t\t\titems[i] = QueryVAppTemplate(*item)\n\t\t}\n\tcase types.QtEdgeGateway:\n\t\tfor i, item := range results.Results.EdgeGatewayRecord {\n\t\t\titems[i] = QueryEdgeGateway(*item)\n\t\t}\n\tcase types.QtOrgVdcNetwork:\n\t\tfor i, item := range results.Results.OrgVdcNetworkRecord {\n\t\t\titems[i] = QueryOrgVdcNetwork(*item)\n\t\t}\n\tcase types.QtCatalog:\n\t\tfor i, item := range results.Results.CatalogRecord {\n\t\t\titems[i] = QueryCatalog(*item)\n\t\t}\n\tcase types.QtAdminCatalog:\n\t\tfor i, item := range results.Results.AdminCatalogRecord {\n\t\t\titems[i] = QueryAdminCatalog(*item)\n\t\t}\n\tcase types.QtVm:\n\t\tfor i, item := range results.Results.VMRecord {\n\t\t\titems[i] = QueryVm(*item)\n\t\t}\n\tcase types.QtAdminVm:\n\t\tfor i, item := range results.Results.AdminVMRecord {\n\t\t\titems[i] = QueryVm(*item)\n\t\t}\n\tcase types.QtVapp:\n\t\tfor i, item := range results.Results.VAppRecord {\n\t\t\titems[i] = QueryVapp(*item)\n\t\t}\n\tcase types.QtAdminVapp:\n\t\tfor i, item := range results.Results.AdminVAppRecord {\n\t\t\titems[i] = QueryVapp(*item)\n\t\t}\n\tcase types.QtOrgVdc:\n\t\tfor i, item := range results.Results.OrgVdcRecord {\n\t\t\titems[i] = QueryOrgVdc(*item)\n\t\t}\n\tcase types.QtAdminOrgVdc:\n\t\tfor i, item := range results.Results.OrgVdcAdminRecord {\n\t\t\titems[i] = QueryOrgVdc(*item)\n\t\t}\n\tcase types.QtTask:\n\t\tfor i, item := range results.Results.TaskRecord {\n\t\t\titems[i] = QueryTask(*item)\n\t\t}\n\tcase types.QtAdminTask:\n\t\tfor i, item := range results.Results.TaskRecord {\n\t\t\titems[i] = QueryAdminTask(*item)\n\t\t}\n\n\t}\n\tif len(items) > 0 {\n\t\treturn items, nil\n\t}\n\treturn nil, fmt.Errorf(\"unsupported query type %s\", queryType)\n}", "func LogResults(ctx context.Context, searchResult []string) error {\n\tfmt.Println(\"Start to log results\")\n\tfor i, result := range searchResult {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn context.Canceled\n\t\tdefault:\n\t\t}\n\n\t\tvar product Product\n\t\tif err := json.NewDecoder(strings.NewReader(result)).Decode(&product); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Printf(\"Total #%d : \\n%v\\n%v\\n%v\\n%v\\n\\n\", i+1, product.Name, product.URL, product.Image, product.Price)\n\n\t}\n\treturn nil\n}", "func handleResults() {\n\tlist, err := database.ReadList()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(\"\\n//---------------//5 CLOSEST LOCATIONS//--------------//\")\n\tfmt.Println(\"\\n//ID: DISTANCE (in meters)\")\n\t// Slicing the ordered list with the top 5 results\n\tfor _, c := range list[:5] {\n\t\tfmt.Printf(\"%v: %.0fm\\n\", c.Id, c.Distance)\n\t}\n\n\tfmt.Println(\"\\n//---------------//5 FURTHEST LOCATIONS//--------------//\")\n\tfmt.Println(\"\\n//ID: DISTANCE (in meters)\")\n\t// Slicing the list with the bottom 5 results\n\tfor _, c := range list[len(list)-5:] {\n\t\tfmt.Printf(\"%v: %.0fm\\n\", c.Id, c.Distance)\n\t}\n}", "func getNonFilteredResults(searchValue string, start string, end string, dtData dtPaginationData) ([]map[string]string, error) {\n\tvar (\n\t\tp = searchValue + \"%\"\n\t\targs = []interface{}{p, start, end}\n\t\taux = []interface{}{p}\n\t)\n\n\tresult, err := search(dtData, args)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = getNumberOfResults(dtData, aux)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result, err\n}", "func doFilterHistory() error {\n\n\tshowUpdateStatus()\n\n\thistory.MaxSearchResults = maxResults * 10 // allow for lots of duplicates\n\twf.Configure(aw.MaxResults(maxResults))\n\n\tentries, err := history.Search(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Remove duplicates\n\tvar (\n\t\tseen = map[string]bool{}\n\t\tunique = []*history.Entry{}\n\t)\n\tfor _, e := range entries {\n\t\tif seen[e.URL] {\n\t\t\tcontinue\n\t\t}\n\t\tseen[e.URL] = true\n\t\tunique = append(unique, e)\n\t}\n\tentries = unique\n\n\tlog.Printf(\"%d results for \\\"%s\\\"\", len(entries), query)\n\n\tfor _, e := range entries {\n\t\tURLerItem(&hURLer{e})\n\t}\n\n\twf.WarnEmpty(\"No matching entries found\", \"Try a different query?\")\n\twf.SendFeedback()\n\n\treturn nil\n}", "func (f *aclFilter) filterPreparedQueries(queries *structs.PreparedQueries) {\n\t// Management tokens can see everything with no filtering.\n\tif f.authorizer.ACLWrite() {\n\t\treturn\n\t}\n\n\t// Otherwise, we need to see what the token has access to.\n\tret := make(structs.PreparedQueries, 0, len(*queries))\n\tfor _, query := range *queries {\n\t\t// If no prefix ACL applies to this query then filter it, since\n\t\t// we know at this point the user doesn't have a management\n\t\t// token, otherwise see what the policy says.\n\t\tprefix, ok := query.GetACLPrefix()\n\t\tif !ok || !f.authorizer.PreparedQueryRead(prefix) {\n\t\t\tf.logger.Printf(\"[DEBUG] consul: dropping prepared query %q from result due to ACLs\", query.ID)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Redact any tokens if necessary. We make a copy of just the\n\t\t// pointer so we don't mess with the caller's slice.\n\t\tfinal := query\n\t\tf.redactPreparedQueryTokens(&final)\n\t\tret = append(ret, final)\n\t}\n\t*queries = ret\n}", "func SearchResults(req *core.SearchProductRequest, results *core.ProductSearchResult) {\n\tttl := time.Minute\n\tif req.GetFromId() > 0 {\n\t\tttl = ttl * 30\n\t}\n\tkey := GetSearchProductKey(req)\n\tlog.Error(\n\t\tPutV(key, results, ttl),\n\t)\n\n\tfor _, p := range results.Result {\n\t\tAddTags(key, time.Minute*60, getProductTags(p)...)\n\t}\n}", "func filterVolume(all []lepton.NanosVolume, query map[string]string) ([]lepton.NanosVolume, error) {\n\tif len(query) == 0 {\n\t\treturn all, nil\n\t}\n\n\tvar vols []lepton.NanosVolume\n\tfor _, vol := range all {\n\t\tif vol.MatchedByQueries(query) {\n\t\t\tvols = append(vols, vol)\n\t\t}\n\t}\n\treturn vols, nil\n}", "func (handler *dbHandler) notEqualToFilterSummary(writer http.ResponseWriter, request *http.Request) {\n\t//generate the filtered buildings by passing appropriate comparison parameters\n\tbuildings, err := handler.equalityFilter(writer, request, \"$ne\")\n\tif err != nil {\n\t\tfmt.Fprintln(writer, err.Error())\n\t}\n\n\t//get the output summary for the filtered list and print it on screen\n\toutput := getSummary(buildings)\n\tfmt.Fprintln(writer, output)\n\n}", "func (p defaultStdErrParser) parseResults(b []byte) (r DefaultStdErrResults) {\n\t// Split on =\n\tvar k string\n\tfor idx, i := range bytes.Split(b, []byte(\"=\")) {\n\t\t// Split on space\n\t\tvar items = bytes.Split(bytes.TrimSpace(i), []byte(\" \"))\n\n\t\t// Parse key/value\n\t\tif len(items[0]) > 0 && len(k) > 0 {\n\t\t\tv := string(items[0])\n\t\t\tswitch k {\n\t\t\tcase \"bitrate\":\n\t\t\t\t// There may be other suffix, but we only support this one for now\n\t\t\t\tv = strings.TrimSuffix(v, \"kbits/s\")\n\t\t\t\tif p, err := strconv.ParseFloat(v, 64); err == nil {\n\t\t\t\t\tr.Bitrate = astikit.Float64Ptr(p * 1000)\n\t\t\t\t}\n\t\t\tcase \"frame\":\n\t\t\t\tif p, err := strconv.Atoi(v); err == nil {\n\t\t\t\t\tr.Frame = astikit.IntPtr(p)\n\t\t\t\t}\n\t\t\tcase \"fps\":\n\t\t\t\tif p, err := strconv.ParseFloat(v, 64); err == nil {\n\t\t\t\t\tr.FPS = astikit.IntPtr(int(p))\n\t\t\t\t}\n\t\t\tcase \"q\":\n\t\t\t\tif p, err := strconv.ParseFloat(v, 64); err == nil {\n\t\t\t\t\tr.Q = astikit.Float64Ptr(p)\n\t\t\t\t}\n\t\t\tcase \"size\":\n\t\t\t\tif n, err := numberFromString(v); err == nil {\n\t\t\t\t\tr.Size = astikit.IntPtr(int(n.float64()))\n\t\t\t\t}\n\t\t\tcase \"speed\":\n\t\t\t\tif p, err := strconv.ParseFloat(strings.TrimSuffix(v, \"x\"), 64); err == nil {\n\t\t\t\t\tr.Speed = astikit.Float64Ptr(p)\n\t\t\t\t}\n\t\t\tcase \"time\":\n\t\t\t\t// Split on .\n\t\t\t\tvar d time.Duration\n\t\t\t\tps := strings.Split(v, \".\")\n\t\t\t\tif len(ps) > 1 {\n\t\t\t\t\tif p, err := strconv.Atoi(ps[1]); err == nil {\n\t\t\t\t\t\t// For now we make the assumption that milliseconds are in this format \".99\" and not \".999\"\n\t\t\t\t\t\td += time.Duration(p*10) * time.Millisecond\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Split on :\n\t\t\t\tps = strings.Split(ps[0], \":\")\n\t\t\t\tif len(ps) >= 3 {\n\t\t\t\t\tif p, err := strconv.Atoi(ps[0]); err == nil {\n\t\t\t\t\t\td += time.Duration(p) * time.Hour\n\t\t\t\t\t}\n\t\t\t\t\tif p, err := strconv.Atoi(ps[1]); err == nil {\n\t\t\t\t\t\td += time.Duration(p) * time.Minute\n\t\t\t\t\t}\n\t\t\t\t\tif p, err := strconv.Atoi(ps[2]); err == nil {\n\t\t\t\t\t\td += time.Duration(p) * time.Second\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tr.Time = astikit.DurationPtr(d)\n\t\t\t}\n\t\t}\n\n\t\t// Get key\n\t\tif len(items) > 1 && len(items[1]) > 0 {\n\t\t\tk = string(items[1])\n\t\t} else if len(items) == 1 && idx == 0 {\n\t\t\tk = string(items[0])\n\t\t}\n\t}\n\treturn\n}", "func (qb *QueryBuilder) buildFilters() {\n\t// todo: loop and yaml conf. but this one is faster as no loop, will try array switch\n\tsearchParams := GetFilterConfig()\n\tfor key, val := range searchParams {\n\t\tm2 := val.(map[string]interface{})\n\t\tpk := m2[\"filter\"].(map[string]interface{})\n\t\tpkey := fmt.Sprintf(\"%v\", pk[\"key\"])\n\t\t//log.Println(key, pkey)\n\t\t//log.Println(key, m2[\"filter\"])\n\t\tqb.addMustFilterByTerm(key, pkey)\n\t}\n}", "func prepareKeyListQueryFilterString(keys []string) string {\n\tstr := \"[\"\n\tfor idx, key := range keys {\n\t\tstr += fmt.Sprintf(\"'%s'\", key)\n\t\tif idx < len(keys)-1 {\n\t\t\tstr += \",\"\n\t\t}\n\t}\n\tstr += \"]\"\n\treturn str\n}", "func filteredKeyValues(cs path.ColorScheme, kv ...string) []string {\n\tif len(kv)%2 != 0 {\n\t\tpanic(\"KeyValues expects even number of parameters\")\n\t}\n\tentries := make([]string, 0)\n\tfor i := 0; i < len(kv); i += 2 {\n\t\tif kv[i+1] == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tentries = append(entries, cs.KeyValue(kv[i], kv[i+1]))\n\t}\n\treturn entries\n}", "func (o DebugSessionOutput) Filter() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *DebugSession) pulumi.StringOutput { return v.Filter }).(pulumi.StringOutput)\n}", "func getResultKeys(\n\treq *pb.StatSummaryRequest,\n\tk8sObjects map[rKey]k8sStat,\n\tmetricResults map[rKey]*pb.BasicStats,\n) []rKey {\n\tvar keys []rKey\n\n\tif req.GetOutbound() == nil || req.GetNone() != nil {\n\t\t// if the request doesn't have outbound filtering, return all rows\n\t\tfor key := range k8sObjects {\n\t\t\tkeys = append(keys, key)\n\t\t}\n\t} else {\n\t\t// if the request does have outbound filtering,\n\t\t// only return rows for which we have stats\n\t\tfor key := range metricResults {\n\t\t\tkeys = append(keys, key)\n\t\t}\n\t}\n\treturn keys\n}", "func (sh *StatsHandler) parseStatsFilter(vals url.Values) error {\n\tvar err error\n\n\terr = sh.ParseCommonFilter(vals)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsh.filter.GroupBy, err = sh.readGroupBy(vals.Get(\"group_by\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsh.filter.Limit, err = sh.readInt(vals.Get(\"limit\"), 1, statsAPIMaxLimit, statsAPIMaxLimit)\n\tif err != nil {\n\t\treturn gimlet.ErrorResponse{\n\t\t\tMessage: errors.Wrap(err, \"invalid limit\").Error(),\n\t\t\tStatusCode: http.StatusBadRequest,\n\t\t}\n\t}\n\t// Add 1 for pagination\n\tsh.filter.Limit++\n\n\tsh.filter.Tasks = sh.readStringList(vals[\"tasks\"])\n\tif len(sh.filter.Tasks) > statsAPIMaxNumTasks {\n\t\treturn gimlet.ErrorResponse{\n\t\t\tMessage: fmt.Sprintf(\"number of tasks given must not exceed %d\", statsAPIMaxNumTasks),\n\t\t\tStatusCode: http.StatusBadRequest,\n\t\t}\n\t}\n\n\tbeforeDate := vals.Get(\"before_date\")\n\tif beforeDate == \"\" {\n\t\treturn gimlet.ErrorResponse{\n\t\t\tMessage: \"missing 'before' date\",\n\t\t\tStatusCode: http.StatusBadRequest,\n\t\t}\n\t}\n\tsh.filter.BeforeDate, err = time.ParseInLocation(statsAPIDateFormat, beforeDate, time.UTC)\n\tif err != nil {\n\t\treturn gimlet.ErrorResponse{\n\t\t\tMessage: errors.Wrapf(err, \"parsing 'before' date in expected format (%s)\", statsAPIDateFormat).Error(),\n\t\t\tStatusCode: http.StatusBadRequest,\n\t\t}\n\t}\n\n\tafterDate := vals.Get(\"after_date\")\n\tif afterDate == \"\" {\n\t\treturn gimlet.ErrorResponse{\n\t\t\tMessage: \"missing 'after' date\",\n\t\t\tStatusCode: http.StatusBadRequest,\n\t\t}\n\t}\n\tsh.filter.AfterDate, err = time.ParseInLocation(statsAPIDateFormat, afterDate, time.UTC)\n\tif err != nil {\n\t\treturn gimlet.ErrorResponse{\n\t\t\tMessage: errors.Wrapf(err, \"parsing 'after' date in expected format (%s)\", statsAPIDateFormat).Error(),\n\t\t\tStatusCode: http.StatusBadRequest,\n\t\t}\n\t}\n\n\tsh.filter.Sort, err = sh.readSort(vals.Get(\"sort\"))\n\tif err != nil {\n\t\treturn gimlet.ErrorResponse{\n\t\t\tMessage: errors.Wrap(err, \"invalid sort\").Error(),\n\t\t\tStatusCode: http.StatusBadRequest,\n\t\t}\n\t}\n\n\treturn err\n}", "func (e FlatMap) Filter(r ...*regexp.Regexp) (res FlatMap) {\n\tres = FlatMap{}\nLOOP:\n\tfor k, v := range e {\n\t\tfor _, r1 := range r {\n\t\t\tif r1.MatchString(k) {\n\t\t\t\tcontinue LOOP\n\t\t\t}\n\t\t\tres[k] = v\n\t\t}\n\t}\n\treturn\n}", "func printCertCheckerResults(scanResult *CertCheckerResults) {\n\tscanResults := reflect.ValueOf(scanResult).Elem()\n\ttypeOfT := scanResults.Type()\n\tfor i := 0; i < scanResults.NumField(); i++ {\n\t\tf := scanResults.Field(i)\n\t\tif f.Kind() == reflect.Map {\n\t\t\tfor _, key := range f.MapKeys() {\n\t\t\t\tstrct := f.MapIndex(key)\n\t\t\t\tfmt.Println(key.Interface(), \":\", colorizeOutput(strct.Interface().(string)))\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Printf(\"%s: %v\\n\", typeOfT.Field(i).Name, f.Interface())\n\t\t}\n\t}\n}", "func ListResults(cmd *cobra.Command, args []string) error {\n\n\tclient, err := auth.GetClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Parse all flags\n\n\tvar countDefault int32\n\tcount := &countDefault\n\terr = flags.ParseFlag(cmd.Flags(), \"count\", &count)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"count\": ` + err.Error())\n\t}\n\tvar field string\n\terr = flags.ParseFlag(cmd.Flags(), \"field\", &field)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"field\": ` + err.Error())\n\t}\n\tvar offsetDefault int32\n\toffset := &offsetDefault\n\terr = flags.ParseFlag(cmd.Flags(), \"offset\", &offset)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"offset\": ` + err.Error())\n\t}\n\tvar sid string\n\terr = flags.ParseFlag(cmd.Flags(), \"sid\", &sid)\n\tif err != nil {\n\t\treturn fmt.Errorf(`error parsing \"sid\": ` + err.Error())\n\t}\n\t// Form query params\n\tgenerated_query := model.ListResultsQueryParams{}\n\tgenerated_query.Count = count\n\tgenerated_query.Field = field\n\tgenerated_query.Offset = offset\n\n\t// Silence Usage\n\tcmd.SilenceUsage = true\n\n\tresp, err := client.SearchService.ListResults(sid, &generated_query)\n\tif err != nil {\n\t\treturn err\n\t}\n\tjsonx.Pprint(cmd, resp)\n\treturn nil\n}", "func queryCatalogItemFilteredList(client *Client, filter map[string]string) ([]*types.QueryResultCatalogItemType, error) {\n\tcatalogItemType := types.QtCatalogItem\n\tif client.IsSysAdmin {\n\t\tcatalogItemType = types.QtAdminCatalogItem\n\t}\n\n\tfilterText := \"\"\n\tfor k, v := range filter {\n\t\tif filterText != \"\" {\n\t\t\tfilterText += \";\"\n\t\t}\n\t\tfilterText += fmt.Sprintf(\"%s==%s\", k, url.QueryEscape(v))\n\t}\n\n\tnotEncodedParams := map[string]string{\n\t\t\"type\": catalogItemType,\n\t}\n\tif filterText != \"\" {\n\t\tnotEncodedParams[\"filter\"] = filterText\n\t}\n\tresults, err := client.cumulativeQuery(catalogItemType, nil, notEncodedParams)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error querying catalog items %s\", err)\n\t}\n\n\tif client.IsSysAdmin {\n\t\treturn results.Results.AdminCatalogItemRecord, nil\n\t} else {\n\t\treturn results.Results.CatalogItemRecord, nil\n\t}\n}", "func BuildMetricsTimeSeriesFilterQuery(fs *model.FilterSet, groupTags []string, metricName string, aggregateOperator model.AggregateOperator) (string, error) {\n\tvar conditions []string\n\tconditions = append(conditions, fmt.Sprintf(\"metric_name = %s\", FormattedValue(metricName)))\n\tif fs != nil && len(fs.Items) != 0 {\n\t\tfor _, item := range fs.Items {\n\t\t\ttoFormat := item.Value\n\t\t\top := strings.ToLower(strings.TrimSpace(item.Operator))\n\t\t\t// if the received value is an array for like/match op, just take the first value\n\t\t\tif op == \"like\" || op == \"match\" || op == \"nlike\" || op == \"nmatch\" {\n\t\t\t\tx, ok := item.Value.([]interface{})\n\t\t\t\tif ok {\n\t\t\t\t\tif len(x) == 0 {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\ttoFormat = x[0]\n\t\t\t\t}\n\t\t\t}\n\t\t\tfmtVal := FormattedValue(toFormat)\n\t\t\tswitch op {\n\t\t\tcase \"eq\":\n\t\t\t\tconditions = append(conditions, fmt.Sprintf(\"JSONExtractString(labels, '%s') = %s\", item.Key, fmtVal))\n\t\t\tcase \"neq\":\n\t\t\t\tconditions = append(conditions, fmt.Sprintf(\"JSONExtractString(labels, '%s') != %s\", item.Key, fmtVal))\n\t\t\tcase \"in\":\n\t\t\t\tconditions = append(conditions, fmt.Sprintf(\"JSONExtractString(labels, '%s') IN %s\", item.Key, fmtVal))\n\t\t\tcase \"nin\":\n\t\t\t\tconditions = append(conditions, fmt.Sprintf(\"JSONExtractString(labels, '%s') NOT IN %s\", item.Key, fmtVal))\n\t\t\tcase \"like\":\n\t\t\t\tconditions = append(conditions, fmt.Sprintf(\"like(JSONExtractString(labels, '%s'), %s)\", item.Key, fmtVal))\n\t\t\tcase \"nlike\":\n\t\t\t\tconditions = append(conditions, fmt.Sprintf(\"notLike(JSONExtractString(labels, '%s'), %s)\", item.Key, fmtVal))\n\t\t\tcase \"match\":\n\t\t\t\tconditions = append(conditions, fmt.Sprintf(\"match(JSONExtractString(labels, '%s'), %s)\", item.Key, fmtVal))\n\t\t\tcase \"nmatch\":\n\t\t\t\tconditions = append(conditions, fmt.Sprintf(\"not match(JSONExtractString(labels, '%s'), %s)\", item.Key, fmtVal))\n\t\t\tdefault:\n\t\t\t\treturn \"\", fmt.Errorf(\"unsupported operation\")\n\t\t\t}\n\t\t}\n\t}\n\tqueryString := strings.Join(conditions, \" AND \")\n\n\tvar selectLabels string\n\tif aggregateOperator == model.NOOP || aggregateOperator == model.RATE {\n\t\tselectLabels = \"labels,\"\n\t} else {\n\t\tfor _, tag := range groupTags {\n\t\t\tselectLabels += fmt.Sprintf(\" JSONExtractString(labels, '%s') as %s,\", tag, tag)\n\t\t}\n\t}\n\n\tfilterSubQuery := fmt.Sprintf(\"SELECT %s fingerprint FROM %s.%s WHERE %s\", selectLabels, constants.SIGNOZ_METRIC_DBNAME, constants.SIGNOZ_TIMESERIES_TABLENAME, queryString)\n\n\treturn filterSubQuery, nil\n}", "func analyzeTestResults(details scan.LabsEndpointDetails) map[string]string {\n\n\tscanTests := []string{\"VulnBeast\", \"RenegSupport\", \"ForwardSecrecy\", \"Heartbeat\", \"Heartbleed\",\n\t\t\"OpenSslCcs\", \"OpenSSLLuckyMinus20\", \"Ticketbleed\", \"Bleichenbacher\",\n\t\t\"Poodle\", \"PoodleTLS\", \"FallbackScsv\", \"Freak\", \"DhYsReuse\", \"Logjam\",\n\t\t\"DrownVulnerable\", \"SupportsRc4\"}\n\tscanDetails := reflect.ValueOf(&details).Elem()\n\tvulnRslts := make(map[string]string)\n\tfor _, test := range scanTests {\n\t\ttestValue := scanDetails.FieldByName(test)\n\t\t// valueType := testValue.Type().String()\n\t\tswitch reflect.TypeOf(testValue.Interface()).Kind() {\n\t\tcase reflect.Int:\n\t\t\tvulnRslts[test] = analyzeResultValue(test, testValue.Int())\n\t\tcase reflect.Bool:\n\t\t\tif testValue.Bool() {\n\t\t\t\tvulnRslts[test] = \"vulnerable\"\n\t\t\t} else {\n\t\t\t\tvulnRslts[test] = \"not vulnerable\"\n\t\t\t}\n\t\tdefault:\n\t\t\tvulnRslts[test] = testValue.String()\n\t\t}\n\t}\n\treturn vulnRslts\n}", "func PrettyPrintQueryResults(results models.Rows, printMode config.PrintModeEnum) {\n\tswitch printMode {\n\tcase config.PrintJSON:\n\t\tprettyPrintQueryResultsJSON(results)\n\tcase config.PrintLine:\n\t\tprettyPrintQueryResultsLines(results)\n\tcase config.PrintPretty:\n\t\tprettyPrintQueryResultsPretty(results)\n\tdefault:\n\t}\n}", "func testRunQueryResults(t *testing.T, queryResults []testQueryResults) {\n\tfor _, queryResult := range queryResults {\n\n\t\tif len(queryResult.args) != len(queryResult.results) {\n\t\t\tt.Errorf(\"args len %v and results len %v do not match - query: %v\",\n\t\t\t\tlen(queryResult.args), len(queryResult.results), queryResult.query)\n\t\t\tcontinue\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(context.Background(), TestContextTimeout)\n\t\tstmt, err := TestDB.PrepareContext(ctx, queryResult.query)\n\t\tcancel()\n\t\tif err != nil {\n\t\t\tt.Errorf(\"prepare error: %v - query: %v\", err, queryResult.query)\n\t\t\tcontinue\n\t\t}\n\n\t\ttestRunQueryResult(t, queryResult, stmt)\n\n\t\terr = stmt.Close()\n\t\tif err != nil {\n\t\t\tt.Errorf(\"close error: %v - query: %v\", err, queryResult.query)\n\t\t}\n\n\t}\n}", "func checkResults(results []kubeval.ValidationResult) error {\n\tif len(results) == 0 {\n\t\treturn nil\n\t}\n\n\tvar errs []string\n\tfor _, r := range results {\n\t\tfor _, e := range r.Errors {\n\t\t\terrs = append(errs, e.String())\n\t\t}\n\t}\n\n\tif len(errs) > 0 {\n\t\treturn errors.New(strings.Join(errs, \"\\n\"))\n\t}\n\n\treturn nil\n}", "func (rs *Results) Filter(fun ResultFilterFunc) (out Results) {\n\tfor _, r := range *rs {\n\t\tif fun(r) {\n\t\t\tout = append(out, r)\n\t\t}\n\t}\n\treturn\n}", "func Filter(r io.Reader, w io.Writer, conf Config) error {\n\ts := bufio.NewScanner(r)\n\tfilters := compile(conf)\n\n\tfor s.Scan() {\n\t\tmetric := s.Bytes()\n\t\tparts := bytes.SplitN(metric, []byte(\"|\"), 2)\n\t\tname := parts[0]\n\n\t\tif len(name) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\ttail := parts[1]\n\n\t\tfor regexp, v := range filters {\n\t\t\tmatches := regexp.FindAllSubmatch(name, -1)\n\n\t\t\tif matches == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tswitch v.(type) {\n\t\t\tcase string:\n\t\t\t\tw.Write(replace([]byte(v.(string)), matches))\n\t\t\t\tw.Write([]byte(\"|\"))\n\t\t\t\tw.Write(tail)\n\t\t\t\tw.Write([]byte(\"\\n\"))\n\t\t\tcase bool:\n\t\t\t\tw.Write(metric)\n\t\t\t\tw.Write([]byte(\"\\n\"))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn s.Err()\n}", "func Filter(result []Expression, input []Expression, filter func(Expression) bool) []Expression {\n\ttrace_util_0.Count(_util_00000, 0)\n\tfor _, e := range input {\n\t\ttrace_util_0.Count(_util_00000, 2)\n\t\tif filter(e) {\n\t\t\ttrace_util_0.Count(_util_00000, 3)\n\t\t\tresult = append(result, e)\n\t\t}\n\t}\n\ttrace_util_0.Count(_util_00000, 1)\n\treturn result\n}", "func TestResultTypeFilter_Values() []string {\n\treturn []string{\n\t\tTestResultTypeFilterOverallTestResults,\n\t\tTestResultTypeFilterConversationLevelTestResults,\n\t\tTestResultTypeFilterIntentClassificationTestResults,\n\t\tTestResultTypeFilterSlotResolutionTestResults,\n\t\tTestResultTypeFilterUtteranceLevelResults,\n\t}\n}", "func (hrsi *SubscriberItem) filterOnVersion(indexFile *repo.IndexFile) {\n\tkeys := make([]string, 0)\n\tfor k := range indexFile.Entries {\n\t\tkeys = append(keys, k)\n\t}\n\n\tfor _, k := range keys {\n\t\tchartVersions := indexFile.Entries[k]\n\t\tnewChartVersions := make([]*repo.ChartVersion, 0)\n\n\t\tfor index, chartVersion := range chartVersions {\n\t\t\tif hrsi.checkKeywords(chartVersion) && hrsi.checkDigest(chartVersion) && hrsi.checkTillerVersion(chartVersion) && hrsi.checkVersion(chartVersion) {\n\t\t\t\tnewChartVersions = append(newChartVersions, chartVersions[index])\n\t\t\t}\n\t\t}\n\n\t\tif len(newChartVersions) > 0 {\n\t\t\tindexFile.Entries[k] = newChartVersions\n\t\t} else {\n\t\t\tdelete(indexFile.Entries, k)\n\t\t}\n\t}\n\n\tklog.V(5).Info(\"After version matching:\", indexFile)\n}", "func FilterList(filter, metrics []string) []string {\n\tresult := make([]string, 0)\n\thash := make(map[string]bool)\n\tfor _, v := range filter {\n\t\thash[v] = true\n\t}\n\n\tfor _, v := range metrics {\n\t\tif hash[v] {\n\t\t\tresult = append(result, v)\n\t\t}\n\t}\n\n\treturn result\n}", "func handleResults(result hooks.InternalMessage) {\n\tres, ok := result.Results.(TableRow)\n\tmanager.Status.AddCurrentScans(-1)\n\n\tif !ok {\n\t\tmanager.Logger.Errorf(\"Couldn't assert type of result for %v\", result.Domain.DomainName)\n\t\tres = TableRow{}\n\t\tresult.StatusCode = hooks.InternalFatalError\n\t}\n\n\tswitch result.StatusCode {\n\tcase hooks.InternalFatalError:\n\t\tres.ScanStatus = hooks.StatusError\n\t\tmanager.Status.AddFatalErrorScans(1)\n\t\tmanager.Logger.Infof(\"Assessment of %v failed ultimately\", result.Domain.DomainName)\n\tcase hooks.InternalSuccess:\n\t\tres.ScanStatus = hooks.StatusDone\n\t\tmanager.Logger.Debugf(\"Assessment of %v was successful\", result.Domain.DomainName)\n\t\tmanager.Status.AddFinishedScans(1)\n\t}\n\twhere := hooks.ScanWhereCond{\n\t\tDomainID: result.Domain.DomainID,\n\t\tScanID: manager.ScanID,\n\t\tTestWithSSL: result.Domain.TestWithSSL}\n\terr := backend.SaveResults(manager.GetTableName(), structs.New(where), structs.New(res))\n\tif err != nil {\n\t\tmanager.Logger.Errorf(\"Couldn't save results for %v: %v\", result.Domain.DomainName, err)\n\t\treturn\n\t}\n\tmanager.Logger.Debugf(\"Results for %v saved\", result.Domain.DomainName)\n\n}", "func traverseResults(parent string, testResults map[string]interface{}) ([]string, error) {\n\tret := []string{}\n\tfor testName, testResults := range testResults {\n\t\tres, ok := testResults.(map[string]interface{})\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"Couldn't convert test results to map: %s/%s\", parent, testName)\n\t\t}\n\t\t// First check if results is actually results, or just another branch\n\t\t// in the tree of test results\n\t\t// Uuuuugly.\n\t\tif res[\"expected\"] == nil || res[\"actual\"] == nil {\n\t\t\t// Assume it's a branch.\n\t\t\tchildRes, err := traverseResults(fmt.Sprintf(\"%s/%s\", parent, testName), res)\n\t\t\tif err != nil {\n\t\t\t\treturn ret, err\n\t\t\t}\n\t\t\tret = append(ret, childRes...)\n\t\t\tcontinue\n\t\t}\n\n\t\tif ue, ok := res[\"is_unexpected\"]; ok && ue.(bool) && res[\"actual\"] != \"PASS\" {\n\t\t\tret = append(ret, fmt.Sprintf(\"%s/%s\", parent, testName))\n\t\t}\n\t}\n\treturn ret, nil\n}", "func QueryStringParser(queryStr string, filters map[string]string) []FilteredResult {\n\t//define custom map type to allowduplicate keys\n\ttype Map struct {\n\t\tKey string\n\t\tValue string\n\t}\n\n\tparams := []Map{}\n\tsearchFilters := []FilteredResult{}\n\n\tparts := strings.Split(queryStr, \"&\")\n\n\t//build a key/value map of the querystring by\n\t//storing the query as key and the fragment as the value\n\tfor _, part := range parts {\n\t\tsplit := strings.Split(part, \"=\")\n\n\t\tif len(split) > 1 && split[1] != \"\" {\n\t\t\tparams = append(params, Map{\n\t\t\t\tKey: split[0],\n\t\t\t\tValue: split[1],\n\t\t\t})\n\t\t} else {\n\t\t\tparams = append(params, Map{\n\t\t\t\tKey: split[0],\n\t\t\t\tValue: \"\",\n\t\t\t})\n\t\t}\n\t}\n\n\t//\n\tfor _, param := range params {\n\t\tfor name, varType := range filters {\n\t\t\tif param.Key == name {\n\t\t\t\tesc, _ := url.QueryUnescape(param.Value)\n\t\t\t\tparseValue, operator, condition := RHSParser(esc, varType)\n\n\t\t\t\tsearchFilters = append(searchFilters, FilteredResult{\n\t\t\t\t\tField: param.Key,\n\t\t\t\t\tType: varType,\n\t\t\t\t\tValue: parseValue,\n\t\t\t\t\tOperator: operator,\n\t\t\t\t\tCondition: condition,\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn searchFilters\n}", "func mkFilter(filter map[string]interface{}) string {\n\tif len(filter) < 1 {\n\t\treturn \"\"\n\t}\n\n\twhereFilter := make([]string, 0)\n\tfor k, v := range filter {\n\t\twhereFilter = append(whereFilter, fmt.Sprintf(\" %s = '%s' \", k, v))\n\t}\n\n\treturn fmt.Sprintf(\"WHERE %s\", strings.Join(whereFilter, \" AND \"))\n}", "func (f *aclFilter) filterSessions(sessions *structs.Sessions) {\n\ts := *sessions\n\tfor i := 0; i < len(s); i++ {\n\t\tsession := s[i]\n\t\tif f.allowSession(session.Node) {\n\t\t\tcontinue\n\t\t}\n\t\tf.logger.Printf(\"[DEBUG] consul: dropping session %q from result due to ACLs\", session.ID)\n\t\ts = append(s[:i], s[i+1:]...)\n\t\ti--\n\t}\n\t*sessions = s\n}", "func (f filterTests) run(filter Filterer, t *testing.T) {\n\tfor _, tt := range f {\n\t\tres := filter(tt.in)\n\n\t\t// Both nil? Then OK\n\t\tif tt.out == nil && res == nil {\n\t\t\treturn\n\t\t}\n\n\t\tif !tt.out.Equal(*res) {\n\t\t\tt.Errorf(\"Expected log\\n\\t%s\\nto equal\\n\\t%s\", res, tt.out)\n\t\t}\n\t}\n}", "func readFilteredEntriesFromGcl(filter string) ([]string, error) {\n\tframework.Logf(\"Reading entries from GCL with filter '%v'\", filter)\n\targList := []string{\"beta\",\n\t\t\"logging\",\n\t\t\"read\",\n\t\tfilter,\n\t\t\"--format\",\n\t\t\"json\",\n\t\t\"--project\",\n\t\tframework.TestContext.CloudConfig.ProjectID,\n\t}\n\toutput, err := exec.Command(\"gcloud\", argList...).CombinedOutput()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar entries []*LogEntry\n\tif err = json.Unmarshal(output, &entries); err != nil {\n\t\treturn nil, err\n\t}\n\tframework.Logf(\"Read %d entries from GCL\", len(entries))\n\n\tvar result []string\n\tfor _, entry := range entries {\n\t\tif entry.TextPayload != \"\" {\n\t\t\tresult = append(result, entry.TextPayload)\n\t\t}\n\t}\n\n\treturn result, nil\n}", "func TestResultsSort(t *testing.T) {\n\trf, err := ResultsFromReader(strings.NewReader(`401 Q0 LA110990-0013 0 0.89 BB2c1.0\n401 Q0 FBIS3-18833 1 0.9 BB2c1.0\n401 Q0 FBIS3-39117 2 1.1 BB2c1.0\n401 Q0 FT941-230 3 1.2 BB2c1.0\n`))\n\tresults, ok := rf.Results[\"401\"]\n\tif !ok {\n\t\tt.Error(\"Topic list missing for topic 401\")\n\t}\n\tif err != nil {\n\t\tt.Error(\"Expected no error, but got\", err)\n\t}\n\tif len(results) != 4 {\n\t\tt.Error(\"Expected 4 results, but got\", len(results))\n\t}\n\tsort.Sort(results)\n\n\tCheckResult(results[0], \"401\", \"Q0\", \"FT941-230\", 0, 1.2, \"BB2c1.0\", \"401 Q0 FT941-230 0 1.2 BB2c1.0\", t)\n\tCheckResult(results[1], \"401\", \"Q0\", \"FBIS3-39117\", 1, 1.1, \"BB2c1.0\", \"401 Q0 FBIS3-39117 1 1.1 BB2c1.0\", t)\n\tCheckResult(results[2], \"401\", \"Q0\", \"FBIS3-18833\", 2, 0.9, \"BB2c1.0\", \"401 Q0 FBIS3-18833 2 0.9 BB2c1.0\", t)\n\tCheckResult(results[3], \"401\", \"Q0\", \"LA110990-0013\", 3, 0.89, \"BB2c1.0\", \"401 Q0 LA110990-0013 3 0.89 BB2c1.0\", t)\n}", "func (conn *Conn) SelectTestResults() []Metrics {\n\tdb := conn.db\n\tsqlStr := \"SELECT result_type, x_axis, y_axis FROM test_results\"\n\trows, err := db.Query(sqlStr)\n\tif err != nil {\n\t\tlog.Printf(\"Error query: %v\\n\", err)\n\t}\n\n\tvar resultType string\n\tvar x float64\n\tvar y float64\n\tresult := make([]Metrics, 0)\n\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\terr = rows.Scan(&resultType, &x, &y)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error scanning row: %v\\n\", err)\n\t\t\treturn nil\n\t\t}\n\t\tresult = append(result, Metrics{resultType, x, y})\n\t}\n\treturn result\n}", "func filterAll(args []sexp) (Filter, error) {\n\tfilters, err := checkFilterArgs(\"all\", args)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn func(msg *layers.SIP) bool {\n\t\tfor _, f := range filters {\n\t\t\tif !f(msg) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}, nil\n}", "func searchExact(w http.ResponseWriter, r *http.Request, db *mgo.Database, argPos int) {\n\tkey := r.FormValue(\"key\")\n\tval := r.FormValue(\"val\")\n\n\tcontext := make([]appResult, 0, 10)\n\tvar res *appResult\n\n\tc := db.C(\"machines\")\n\tvar usePath bool\n\tif key == \"apps.path\" {\n\t\tusePath = true\n\t}\n\n\terr := c.Find(bson.M{key: val}).\n\t\tSelect(bson.M{\n\t\t\"hostname\": 1,\n\t\t\"apps\": 1,\n\t\t\"_id\": 1}).\n\t\tSort(\"hostname\").\n\t\tFor(&res, func() error {\n\t\tres.Apps = filter_apps(val, res.Apps, usePath)\n\t\tcontext = append(context, *res)\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\tset.ExecuteTemplate(w, \"searchresults\", context)\n}", "func usersApplyFilters(query string, f UsersFilters) (string, map[string]interface{}) {\n\tcond := make([]string, 0)\n\tparams := make(map[string]interface{})\n\n\t// Name.\n\tif f.Name != \"\" {\n\t\tcond = append(cond, \"name ILIKE :name\")\n\t\tparams[\"name\"] = fmt.Sprintf(\"%%%s%%\", f.Name)\n\t}\n\n\t// Email.\n\tif f.Email != \"\" {\n\t\tcond = append(cond, \"name ILIKE :email\")\n\t\tparams[\"email\"] = fmt.Sprintf(\"%%%s%%\", f.Email)\n\t}\n\n\t// Date from.\n\tif !f.CreatedAt.From.IsZero() {\n\t\tcond = append(cond, \":created_at >= :from\")\n\t\tparams[\"from\"] = f.CreatedAt.From\n\t}\n\n\t// Date to.\n\tif !f.CreatedAt.To.IsZero() {\n\t\tcond = append(cond, \":created_at <= :to\")\n\t\tparams[\"from\"] = f.CreatedAt.To\n\t}\n\n\t// IsActivated\n\tif f.IsActivated != nil {\n\t\tcond = append(cond, \"name ILIKE :is_activated\")\n\t\tparams[\"is_activated\"] = *f.IsActivated\n\t}\n\n\t// Extra fields.\n\tif f.Extra != nil {\n\t\t// TODO: whitelist\n\t\tfor k, v := range f.Extra {\n\t\t\tkey := fmt.Sprintf(\"extra_%s_key\", k)\n\t\t\tvalue := fmt.Sprintf(\"extra_%s_value\", k)\n\t\t\tcond = append(cond, fmt.Sprintf(\"extra ->> :%s = :%s\", key, value))\n\t\t\tparams[key] = k\n\t\t\tparams[value] = v\n\t\t}\n\t\textra, _ := json.Marshal(f.Extra)\n\t\tparams[\"extra\"] = extra\n\t}\n\n\tif len(cond) > 0 {\n\t\tquery += \" WHERE \" + strings.Join(cond, \" AND \")\n\t}\n\n\treturn query, params\n}", "func filter(filters []dsq.Filter, entry dsq.Entry) bool {\n\tfor _, f := range filters {\n\t\tif !f.Filter(entry) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (q *ParsedRawQuery) FilterStartIndex() int { return 2 }", "func filterOutput(output []byte) []byte {\n\tvar result [][]byte\n\tvar ignore bool\n\tdeprecation := []byte(\"DeprecationWarning\")\n\tregexLog := regexp.MustCompile(`^\\d{4}-\\d{2}-\\d{2}\\s\\d{2}:\\d{2}:\\d{2}`)\n\tregexSshWarning := regexp.MustCompile(`^Warning: Permanently added`)\n\tregexPythonWarning := regexp.MustCompile(`^.*warnings.warn`)\n\tregexUserWarning := regexp.MustCompile(`^.*UserWarning`)\n\tlines := bytes.Split(output, []byte{'\\n'})\n\tfor _, line := range lines {\n\t\tif ignore {\n\t\t\tignore = false\n\t\t\tcontinue\n\t\t}\n\t\tif bytes.Contains(line, deprecation) {\n\t\t\tignore = true\n\t\t\tcontinue\n\t\t}\n\t\tif !regexSshWarning.Match(line) &&\n\t\t\t!regexLog.Match(line) &&\n\t\t\t!regexPythonWarning.Match(line) &&\n\t\t\t!regexUserWarning.Match(line) {\n\t\t\tresult = append(result, line)\n\t\t}\n\t}\n\treturn bytes.Join(result, []byte{'\\n'})\n}", "func (r *Request) resultProvider(hosts []*Host) []*Host {\n\tvar finalHosts []*Host\n\n\tchHosts := r.splitResult(hosts)\n\t//hostsFirst, hostsSec := r.sortResult(hosts)\n\thostsFirst := <-chHosts\n\thostsSec := <-chHosts\n\n\tif len(hostsSec) != 0 {\n\t\tswitch {\n\t\tcase r.Operator == AND:\n\t\t\tfor i := range hostsFirst {\n\t\t\t\tif r.inRange(hostsFirst[i], hostsSec) == true {\n\t\t\t\t\tfinalHosts = append(finalHosts, hostsFirst[i])\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase r.Operator == NOT:\n\t\t\tfor i := range hostsFirst {\n\t\t\t\tif r.inRange(hostsFirst[i], hostsSec) == false {\n\t\t\t\t\tfinalHosts = append(finalHosts, hostsFirst[i])\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase r.Operator == OR:\n\t\t\tfor i := range hostsFirst {\n\t\t\t\tfinalHosts = append(finalHosts, hostsFirst[i])\n\t\t\t}\n\n\t\t\tfor i := range hostsSec {\n\t\t\t\tfinalHosts = append(finalHosts, hostsSec[i])\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfinalHosts = hosts\n\t}\n\n\treturn finalHosts\n}", "func queryVappTemplateListWithFilter(client *Client, filter map[string]string) ([]*types.QueryResultVappTemplateType, error) {\n\tvappTemplateType := types.QtVappTemplate\n\tif client.IsSysAdmin {\n\t\tvappTemplateType = types.QtAdminVappTemplate\n\t}\n\tfilterEncoded := \"\"\n\tfor k, v := range filter {\n\t\tfilterEncoded += fmt.Sprintf(\"%s==%s;\", url.QueryEscape(k), url.QueryEscape(v))\n\t}\n\tresults, err := client.cumulativeQuery(vappTemplateType, nil, map[string]string{\n\t\t\"type\": vappTemplateType,\n\t\t\"filter\": filterEncoded[:len(filterEncoded)-1], // Removes the trailing ';'\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error querying vApp templates %s\", err)\n\t}\n\n\tif client.IsSysAdmin {\n\t\treturn results.Results.AdminVappTemplateRecord, nil\n\t} else {\n\t\treturn results.Results.VappTemplateRecord, nil\n\t}\n}", "func runFilter(ctx context.Context, destUIDs *task.List,\n\tfilter *gql.FilterTree) (*task.List, error) {\n\tif len(filter.FuncName) > 0 { // Leaf node.\n\t\tfilter.FuncName = strings.ToLower(filter.FuncName)\n\t\tx.AssertTruef(len(filter.FuncArgs) == 2,\n\t\t\t\"Expect exactly two arguments: pred and predValue\")\n\n\t\tswitch filter.FuncName {\n\t\tcase \"anyof\":\n\t\t\treturn anyOf(ctx, destUIDs, filter.FuncArgs[0], filter.FuncArgs[1])\n\t\tcase \"allof\":\n\t\t\treturn allOf(ctx, destUIDs, filter.FuncArgs[0], filter.FuncArgs[1])\n\t\t}\n\t}\n\n\tif filter.Op == \"&\" {\n\t\t// For intersect operator, we process the children serially.\n\t\tfor _, c := range filter.Child {\n\t\t\tvar err error\n\t\t\tif destUIDs, err = runFilter(ctx, destUIDs, c); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\treturn destUIDs, nil\n\t}\n\n\t// For now, we only handle AND and OR.\n\tif filter.Op != \"|\" {\n\t\treturn destUIDs, x.Errorf(\"Unknown operator %v\", filter.Op)\n\t}\n\n\t// For union operator, we do it in parallel.\n\t// First, get UIDs for child filters in parallel.\n\ttype resultPair struct {\n\t\tuids *task.List\n\t\terr error\n\t}\n\tresultChan := make(chan resultPair, len(filter.Child))\n\tfor _, c := range filter.Child {\n\t\tgo func(c *gql.FilterTree) {\n\t\t\tr, err := runFilter(ctx, destUIDs, c)\n\t\t\tresultChan <- resultPair{r, err}\n\t\t}(c)\n\t}\n\n\tlists := make([]*task.List, 0, len(filter.Child))\n\t// Next, collect the results from above goroutines.\n\tfor i := 0; i < len(filter.Child); i++ {\n\t\tr := <-resultChan\n\t\tif r.err != nil {\n\t\t\treturn destUIDs, r.err\n\t\t}\n\t\tlists = append(lists, r.uids)\n\t}\n\treturn algo.MergeSortedLists(lists), nil\n}", "func (sf *SanitizingFilter) FilterS(msg string, keysAndValues []interface{}) (string, []interface{}) {\n\tfor i, v := range keysAndValues {\n\t\ttypes := datapol.Verify(v)\n\t\tif len(types) > 0 {\n\t\t\tif i%2 == 0 {\n\t\t\t\treturn datapolMsg, []interface{}{\"key_index\", i, \"types\", types}\n\t\t\t}\n\t\t\t// since we scanned linearly we can safely log the key.\n\t\t\treturn datapolMsg, []interface{}{\"key\", keysAndValues[i-1], \"types\", types}\n\t\t}\n\t}\n\treturn msg, keysAndValues\n}", "func filteringProcess(gvrs map[schema.GroupVersion][]metav1.APIResource, namespaced bool, wantResources map[string][]string) *MatchedResources {\n\twR := make(map[string][]string)\n\tresult := make(map[bool][]schema.GroupVersionResource)\n\n\tfor gv, resources := range gvrs {\n\t\tfor _, res := range resources {\n\t\t\tif namespaced != res.Namespaced {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif wantResources != nil {\n\t\t\t\tok := false\n\t\t\t\tif objects, ok = utils.Contains(wantResources, res.Name); !ok {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tselectedGVR = append(selectedGVR, gv.WithResource(res.Name))\n\n\t\t\tresult[namespaced] = selectedGVR\n\t\t\twR[res.Name] = objects\n\t\t}\n\t}\n\tselectedGVR = nil\n\treturn &MatchedResources{\n\t\tGvr: result,\n\t\tWantRes: wR,\n\t}\n}", "func processQuery(userQuery string) (keywords string) {\n\tcandidates := rake.RunRake(userQuery)\n\tkeywords = \"\"\n\tfor _, candidate := range candidates {\n\t\tkeywords += candidate.Key + \";\"\n\t}\n\treturn keywords\n\n}", "func printResults(finalCount map[string]int) {\n\tfor index, phrase := range sortedKeys(finalCount) {\n\t\tif index == 100 {\n\t\t\tbreak\n\t\t}\n\t\tfmt.Printf(\"%v: %v\\n\", phrase, finalCount[phrase])\n\t}\n}", "func (fmp *filterMetricProcessor) filterMetrics(metrics []*metricspb.Metric) []*metricspb.Metric {\n\tkeep := make([]*metricspb.Metric, 0, len(metrics))\n\tfor _, m := range metrics {\n\t\tif fmp.shouldKeepMetric(m) {\n\t\t\tkeep = append(keep, m)\n\t\t}\n\t}\n\n\treturn keep\n}", "func ProcessViewResult(result ViewResult, params map[string]interface{},\n\tds DataStore, reduceFunction string) (ViewResult, error) {\n\tincludeDocs := false\n\tlimit := 0\n\treverse := false\n\treduce := true\n\n\tif params != nil {\n\t\tincludeDocs, _ = params[\"include_docs\"].(bool)\n\n\t\tif plimit, ok := params[\"limit\"]; ok {\n\t\t\tif pLimitInt, err := interfaceToInt(plimit); err == nil {\n\t\t\t\tlimit = pLimitInt\n\t\t\t} else {\n\t\t\t\tlogg(\"Unsupported type for view limit parameter: %T %v\", plimit, err)\n\t\t\t}\n\t\t}\n\n\t\treverse, _ = params[\"reverse\"].(bool)\n\t\tif reduceParam, found := params[\"reduce\"].(bool); found {\n\t\t\treduce = reduceParam\n\t\t}\n\t}\n\n\tif reverse {\n\t\t//TODO: Apply \"reverse\" option\n\t\treturn result, fmt.Errorf(\"Reverse is not supported yet, sorry\")\n\t}\n\n\tstartkey := params[\"startkey\"]\n\tif startkey == nil {\n\t\tstartkey = params[\"start_key\"] // older synonym\n\t}\n\tendkey := params[\"endkey\"]\n\tif endkey == nil {\n\t\tendkey = params[\"end_key\"]\n\t}\n\tinclusiveEnd := true\n\tif key := params[\"key\"]; key != nil {\n\t\tstartkey = key\n\t\tendkey = key\n\t} else {\n\t\tif value, ok := params[\"inclusive_end\"].(bool); ok {\n\t\t\tinclusiveEnd = value\n\t\t}\n\t}\n\n\tvar collator JSONCollator\n\n\tif keys, ok := params[\"keys\"].([]interface{}); ok {\n\t\tfilteredRows := make(ViewRows, 0)\n\t\tfor _, targetKey := range keys {\n\t\t\ti := sort.Search(len(result.Rows), func(i int) bool {\n\t\t\t\treturn collator.Collate(result.Rows[i].Key, targetKey) >= 0\n\t\t\t})\n\t\t\tif i < len(result.Rows) && collator.Collate(result.Rows[i].Key, targetKey) == 0 {\n\t\t\t\tfilteredRows = append(filteredRows, result.Rows[i])\n\t\t\t}\n\t\t}\n\t\tresult.Rows = filteredRows\n\t}\n\n\tif startkey != nil {\n\t\ti := sort.Search(len(result.Rows), func(i int) bool {\n\t\t\treturn collator.Collate(result.Rows[i].Key, startkey) >= 0\n\t\t})\n\t\tresult.Rows = result.Rows[i:]\n\t}\n\n\tif limit > 0 && len(result.Rows) > limit {\n\t\tresult.Rows = result.Rows[:limit]\n\t}\n\n\tif endkey != nil {\n\t\tlimit := 0\n\t\tif !inclusiveEnd {\n\t\t\tlimit = -1\n\t\t}\n\t\ti := sort.Search(len(result.Rows), func(i int) bool {\n\t\t\treturn collator.Collate(result.Rows[i].Key, endkey) > limit\n\t\t})\n\t\tresult.Rows = result.Rows[:i]\n\t}\n\n\tif includeDocs {\n\t\tnewRows := make(ViewRows, len(result.Rows))\n\t\tfor i, row := range result.Rows {\n\t\t\t//OPT: This may unmarshal the same doc more than once\n\t\t\tvar parsedDoc interface{}\n\t\t\t_, err := ds.Get(row.ID, &parsedDoc)\n\t\t\tif err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\t\t\tnewRows[i] = row\n\t\t\tnewRows[i].Doc = &parsedDoc\n\t\t}\n\t\tresult.Rows = newRows\n\t}\n\n\tif reduce && reduceFunction != \"\" {\n\t\tif err := ReduceViewResult(reduceFunction, params, &result); err != nil {\n\t\t\treturn result, err\n\t\t}\n\t}\n\n\tresult.TotalRows = len(result.Rows)\n\tlogg(\"\\t... view returned %d rows\", result.TotalRows)\n\treturn result, nil\n}", "func sortFilter(secretData map[string][]byte, targetData string) (secData []secretDataType) {\n\tfor k, v := range secretData {\n\t\tif targetData == \"\" || strings.Contains(strings.ToLower(k), strings.ToLower(targetData)) {\n\t\t\tsecData = append(secData, secretDataType{Key: k, Value: string(v)})\n\t\t}\n\t}\n\tif len(secData) == 0 {\n\t\tfmt.Fprintf(os.Stderr, \"No data key found with %s\\n\", targetData)\n\t}\n\tsort.Slice(secData, func(i, j int) bool {\n\t\treturn secData[i].Key < secData[j].Key\n\t})\n\treturn\n}", "func FilterMeasurements(ctx context.Context, in <-chan *Measurement, logger *logrus.Entry, filters ...MeasurementsFilter) <-chan *Measurement {\n\tout := make(chan *Measurement)\n\n\tstats := make(map[string]filterStats, len(filters))\n\tfor _, f := range filters {\n\t\tstats[f.name()] = filterStats{}\n\t}\n\n\tgo func() {\n\t\tdefer close(out)\n\t\tdefer func() {\n\t\t\tif logger != nil {\n\t\t\t\tlogger.Debugf(\"filter stats %s\", formatStats(stats))\n\t\t\t}\n\t\t}()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase m, ok := <-in:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\taccept := true\n\t\t\t\tfor _, f := range filters {\n\t\t\t\t\tfStats := stats[f.name()]\n\t\t\t\t\tfStats.incoming()\n\t\t\t\t\tstats[f.name()] = fStats\n\t\t\t\t\tif !f.filter(*m) {\n\t\t\t\t\t\taccept = false\n\t\t\t\t\t\tbreak\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfStats.outgoing()\n\t\t\t\t\t\tstats[f.name()] = fStats\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif accept {\n\t\t\t\t\tselect {\n\t\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\t\treturn\n\t\t\t\t\tcase out <- m:\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\treturn out\n}", "func FilterQuery(baseQuery string, filters map[string][]string, model interface{}) (string, map[string]interface{}, error) {\n\tfilterStrings := make(map[string]string)\n\tfor key, values := range filters {\n\t\tif len(values) >= 1 {\n\t\t\t// we only consider the first query parameter for now (we could AND or OR multiple params in the future)\n\t\t\tfilterStrings[key] = values[0]\n\t\t}\n\t}\n\n\tquery := baseQuery + \" WHERE 1=1\"\n\tqueryArgs := make(map[string]interface{})\n\n\tmodelReflection := reflect.ValueOf(model)\n\tif modelReflection.Kind() == reflect.Struct {\n\t\tfor i := 0; i < modelReflection.NumField(); i++ {\n\t\t\tfilterKey := modelReflection.Type().Field(i).Tag.Get(\"db\")\n\t\t\tif filterString, ok := filterStrings[filterKey]; ok {\n\t\t\t\tvar filterValue interface{}\n\t\t\t\tvar err error\n\n\t\t\t\tswitch modelReflection.Field(i).Interface().(type) {\n\t\t\t\tcase bool:\n\t\t\t\t\tfilterValue, err = strconv.ParseBool(filterString)\n\t\t\t\tcase int, int8, int16, int32, int64:\n\t\t\t\t\tfilterValue, err = strconv.ParseInt(filterString, 10, 64)\n\t\t\t\tcase uint, uint8, uint16, uint32, uint64:\n\t\t\t\t\tfilterValue, err = strconv.ParseUint(filterString, 10, 64)\n\t\t\t\tcase float32, float64:\n\t\t\t\t\tfilterValue, err = strconv.ParseFloat(filterString, 64)\n\t\t\t\tcase string:\n\t\t\t\t\tfilterValue = filterString\n\t\t\t\t}\n\n\t\t\t\tmodelName := reflect.TypeOf(model).Name()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", nil, fmt.Errorf(\"invalid type of filterValue value for field '%v' of '%v': %w\", filterKey, modelName, err)\n\t\t\t\t}\n\t\t\t\tif filterValue == nil {\n\t\t\t\t\treturn \"\", nil, fmt.Errorf(\"invalid field type for field '%v' of '%v'\", filterKey, model)\n\t\t\t\t}\n\n\t\t\t\t// Note that the string being inserted into the SQL query (filterKey) comes directly from the provided model\n\t\t\t\t// and not from user input (filters), so this should be safe from SQL Injection\n\t\t\t\tquery += fmt.Sprintf(\" AND %[1]v = :%[1]v\", filterKey) // e.g. \" AND username = :username\"\n\t\t\t\tqueryArgs[filterKey] = filterValue\n\t\t\t}\n\t\t}\n\n\t\treturn query, queryArgs, nil\n\t}\n\treturn \"\", nil, fmt.Errorf(\"the provided model is not a struct\")\n}", "func AddFiltersFromQueryParams(r *http.Request, filterDetails ...string) ([]QueryProcessor, error) {\n\tqueryParams := r.URL.Query()\n\tfilters := make([]QueryProcessor, 0)\n\tfor _, filterNameAndTypeStr := range filterDetails {\n\t\tfilterNameAndType := strings.Split(filterNameAndTypeStr, \":\")\n\t\tfilterValueAsStr := queryParams.Get(filterNameAndType[0])\n\t\tif filterValueAsStr != \"\" {\n\t\t\tif len(filterNameAndType) > 1 && filterNameAndType[1] == \"datetime\" {\n\t\t\t\tfilterValueAsTime, err := time.Parse(time.RFC3339, filterValueAsStr)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, microappError.NewValidationError(\"Key_InvalidFields\", map[string]string{filterNameAndType[0]: \"Key_InvalidValue\"})\n\t\t\t\t}\n\t\t\t\tfilters = append(filters, Filter(fmt.Sprintf(\"%v = ?\", filterNameAndType[0]), filterValueAsTime))\n\t\t\t} else {\n\t\t\t\tfilters = append(filters, Filter(fmt.Sprintf(\"%v = ?\", filterNameAndType[0]), filterValueAsStr))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn filters, nil\n}", "func (l *Links) buildFilters(filters map[string][]string) (string, []interface{}, error) {\n\tif len(filters) == 0 {\n\t\treturn \"\", nil, nil\n\t}\n\n\tvar filter string\n\tvar outValues []interface{}\n\toperator := \" \"\n\tfor field, values := range filters {\n\t\tif len(filter) > 0 {\n\t\t\toperator = \" AND \"\n\t\t}\n\t\tfield = strings.ToLower(field)\n\t\tif !l.isFieldAllowed(field) {\n\t\t\treturn \"\", nil, fmt.Errorf(\"Field %s is not allowed\", field)\n\t\t}\n\t\tif len(values) == 1 {\n\t\t\tfilter += operator + correctFieldName(field) + \" = ?\"\n\t\t} else {\n\t\t\tinClauseVals := strings.Repeat(\"?, \", len(values))\n\t\t\tfilter += operator + correctFieldName(field) + \" IN (\" +\n\t\t\t\tinClauseVals[:len(inClauseVals)-2] + \")\"\n\t\t\tfor _, val := range values {\n\t\t\t\ttypedValue, err := l.convertValue(field, val)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", nil, err\n\t\t\t\t}\n\t\t\t\toutValues = append(outValues, typedValue)\n\t\t\t}\n\t\t}\n\t}\n\treturn filter, outValues, nil\n}", "func printResults(body []byte) {\n\tvar i Issues\n\terr := json.Unmarshal(body, &i)\n\tif err != nil {\n\t\tfmt.Println(\"[ERROR] Cannot unmarshal data. %s\", err)\n\t}\n\tdata := [][]string{}\n\tfor _, value := range i.Items {\n\t\tif value.Score >= 0.500 {\n\t\t\tscore := strconv.FormatFloat(value.Score, 'f', 4, 32)\n\t\t\tissueValue := []string{value.Title, value.State, value.HtmlUrl, score}\n\t\t\tdata = append(data, issueValue)\n\t\t}\n\t}\n\t// Creating table for stdout.\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"Title\", \"State\", \"URL\", \"Search score\"})\n\n\tfor _, v := range data {\n\t\ttable.Append(v)\n\t}\n\ttable.SetRowLine(true)\n\ttotal := strconv.Itoa(i.TotalCount)\n\ttable.SetFooter([]string{\"\", \"\", \"Found total:\", total})\n\ttable.Render()\n}", "func testRunQueryResult(t *testing.T, queryResult testQueryResults, stmt *sql.Stmt) {\n\tfor i := 0; i < len(queryResult.args); i++ {\n\t\tresult, err := testGetRows(t, stmt, queryResult.args[i])\n\t\tif err != nil {\n\t\t\tt.Errorf(\"get rows error: %v - query: %v\", err, queryResult.query)\n\t\t\tcontinue\n\t\t}\n\t\tif result == nil && queryResult.results[i] != nil {\n\t\t\tt.Errorf(\"result is nil - query: %v\", queryResult.query)\n\t\t\tcontinue\n\t\t}\n\t\tif len(result) != len(queryResult.results[i]) {\n\t\t\tt.Errorf(\"result rows len %v not equal to expected len %v - query: %v\",\n\t\t\t\tlen(result), len(queryResult.results[i]), queryResult.query)\n\t\t\tcontinue\n\t\t}\n\n\t\tfor j := 0; j < len(result); j++ {\n\t\t\tif len(result[j]) != len(queryResult.results[i][j]) {\n\t\t\t\tt.Errorf(\"result columns len %v not equal to expected len %v - query: %v\",\n\t\t\t\t\tlen(result[j]), len(queryResult.results[i][j]), queryResult.query)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor k := 0; k < len(result[j]); k++ {\n\t\t\t\tbad := false\n\t\t\t\ttype1 := reflect.TypeOf(result[j][k])\n\t\t\t\ttype2 := reflect.TypeOf(queryResult.results[i][j][k])\n\t\t\t\tswitch {\n\t\t\t\tcase type1 == nil || type2 == nil:\n\t\t\t\t\tif type1 != type2 {\n\t\t\t\t\t\tbad = true\n\t\t\t\t\t}\n\t\t\t\tcase type1 == TestTypeTime || type2 == TestTypeTime:\n\t\t\t\t\tif type1 != type2 {\n\t\t\t\t\t\tbad = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\ttime1 := result[j][k].(time.Time)\n\t\t\t\t\ttime2 := queryResult.results[i][j][k].(time.Time)\n\t\t\t\t\tif !time1.Equal(time2) {\n\t\t\t\t\t\tbad = true\n\t\t\t\t\t}\n\t\t\t\tcase type1.Kind() == reflect.Slice || type2.Kind() == reflect.Slice:\n\t\t\t\t\tif !reflect.DeepEqual(result[j][k], queryResult.results[i][j][k]) {\n\t\t\t\t\t\tbad = true\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tif result[j][k] != queryResult.results[i][j][k] {\n\t\t\t\t\t\tbad = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif bad {\n\t\t\t\t\tt.Errorf(\"result - %v row %v, %v - received: %T, %v - expected: %T, %v - query: %v\", i, j, k,\n\t\t\t\t\t\tresult[j][k], result[j][k], queryResult.results[i][j][k], queryResult.results[i][j][k], queryResult.query)\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t}\n}", "func (_Harberger *HarbergerFilterer) FilterScriptResult(opts *bind.FilterOpts, executor []common.Address) (*HarbergerScriptResultIterator, error) {\n\n\tvar executorRule []interface{}\n\tfor _, executorItem := range executor {\n\t\texecutorRule = append(executorRule, executorItem)\n\t}\n\n\tlogs, sub, err := _Harberger.contract.FilterLogs(opts, \"ScriptResult\", executorRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &HarbergerScriptResultIterator{contract: _Harberger.contract, event: \"ScriptResult\", logs: logs, sub: sub}, nil\n}", "func buildEc2Filters(input map[*string]*string) []*ec2.Filter {\n\tvar filters []*ec2.Filter\n\tfor k, v := range input {\n\t\tfilters = append(filters, &ec2.Filter{\n\t\t\tName: k,\n\t\t\tValues: []*string{v},\n\t\t})\n\t}\n\treturn filters\n}", "func checkResults(r []byte) error {\n\tif len(r) != 2 {\n\t\treturn nil\n\t}\n\n\tif r[0] == openBracketASCII && r[1] == closedBracketASCII {\n\t\treturn ErrNoResults\n\t}\n\n\treturn nil\n}", "func filter(links []string, filterValues ...string) []string {\n\ti:=0\n\tfor _, s := range links {\n\t\tfor _, f := range filterValues {\n\t\t\tif strings.Contains(s, f) {\n\t\t\t\tlinks[i] = s\n\t\t\t\ti++\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn links[:i]\n}", "func ParseResults(query string) []Recipe {\r\n\t// Create request string and get search page\r\n\tvar joinedQuery bytes.Buffer\r\n\tjoinedQuery.WriteString(\"https://www.allrecipes.com/search/results/?wt=\")\r\n\tjoinedQuery.WriteString(query)\r\n\troot := ParseHTML(joinedQuery.String())\r\n\t// Match recipe cards\r\n\tmatchCards := func(n *html.Node) bool {\r\n\t\tif n.DataAtom == atom.A && n.Parent != nil {\r\n\t\t\treturn scrape.Attr(n.Parent, \"class\") == \"fixed-recipe-card__h3\"\r\n\t\t}\r\n\t\treturn false\r\n\t}\r\n\r\n\tvar recipes []Recipe\r\n\t// For each recipe card, make a request for the recipe page\r\n\t// and then collect information into Recipe\r\n\trcps := scrape.FindAll(root, matchCards)\r\n\thm := make(chan bool)\r\n\tfor _, rcp := range rcps {\r\n\t\thref := scrape.Attr(rcp, \"href\")\r\n\t\tgo ParsePage(&recipes, href, hm)\r\n\t}\r\n\tfor i := 0; i < len(rcps); {\r\n\t\tselect {\r\n\t\tcase <-hm:\r\n\t\t\ti++\r\n\t\t}\r\n\t}\r\n\treturn recipes\r\n}", "func Filter(entries *csp.CSPList, opts ...buildOption) (*csp.CSPList, error) {\n\tif entries == nil {\n\t\treturn entries, nil\n\t}\n\ts := newSelection(entries, opts...)\n\terr := s.validate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn s.filter()\n}", "func (o Oscar) IterateResults(f func(string, int, int, int, time.Duration, time.Duration, time.Duration)) {\n\tfor i, ts := range o.Suits {\n\t\tfor _, tc := range ts.GetCases() {\n\t\t\tcntErr := 0\n\t\t\tif tc.Error != nil {\n\t\t\t\tcntErr = 1\n\t\t\t}\n\t\t\tif cntErr == 0 && tc.CountAssertSuccess == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\telapsedTotal, elapsedHTTP, elapsedSleep := tc.Elapsed()\n\n\t\t\tf(\n\t\t\t\to.prefix(i)+tc.Name,\n\t\t\t\ttc.CountAssertSuccess,\n\t\t\t\tcntErr,\n\t\t\t\ttc.CountRemoteRequests,\n\t\t\t\telapsedTotal,\n\t\t\t\telapsedHTTP,\n\t\t\t\telapsedSleep,\n\t\t\t)\n\t\t}\n\t}\n}", "func QueryTokens(strippedQuery string) []string {\n\tprototoks := delims.Split(strippedQuery, -1)\n\tif len(prototoks) == 0 {\n\t\treturn nil\n\t}\n\ttoks := make([]string, 0, len(prototoks))\n\tfor _, tokmaybe := range prototoks {\n\t\tif tokmaybe != \"\" {\n\t\t\ttoks = append(toks, tokmaybe)\n\t\t}\n\t}\n\treturn toks\n}", "func (o LookupServiceAccountResultOutput) Filter() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LookupServiceAccountResult) *string { return v.Filter }).(pulumi.StringPtrOutput)\n}", "func printResults(results []*Result) {\n\tfmt.Printf(\"results %v\", results)\n\tfor _, r := range results {\n\t\tif r.Rows != nil {\n\t\t\tfmt.Printf(\"\\n\\nColums:\\n\")\n\t\t\tfor j, c := range r.Columns {\n\t\t\t\tfmt.Printf(\"\\t%3d%20s%10d%10d\\n\", j, c.Name, c.DbType, c.DbSize)\n\t\t\t}\n\t\t\tfor i, _ := range r.Rows {\n\t\t\t\tfor j, _ := range r.Columns {\n\t\t\t\t\tfmt.Printf(\"value[%2d, %2d]: %v\\n\", i, j, r.Rows[i][j])\n\t\t\t\t}\n\t\t\t\tfmt.Printf(\"\\n\")\n\t\t\t}\n\t\t}\n\t\tfmt.Printf(\"rows affected: %d\\n\", r.RowsAffected)\n\t\tfmt.Printf(\"return value: %d\\n\", r.ReturnValue)\n\t}\n}", "func filteredConfig(list *configstore.ItemList, dropAlias ...string) (map[string]*string, error) {\n\tcfg := make(map[string]*string)\n\tfor _, i := range list.Items {\n\t\tif !utils.ListContainsString(dropAlias, i.Key()) {\n\t\t\t// assume only one value per alias\n\t\t\tif _, ok := cfg[i.Key()]; !ok {\n\t\t\t\tv, err := i.Value()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif len(v) > 0 {\n\t\t\t\t\tcfg[i.Key()] = &v\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn cfg, nil\n}", "func (f *Function) processResults() {\n\tdefer f.wg.Done()\n\tvar otherClosed bool\n\tfor {\n\t\tselect {\n\t\tcase res, ok := <-f.output:\n\t\t\tif !ok {\n\t\t\t\tif otherClosed {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\totherClosed = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tf.resHandler(res)\n\n\t\tcase err, ok := <-f.errch:\n\t\t\tif !ok {\n\t\t\t\tif otherClosed {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\totherClosed = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tf.errHandler(err)\n\t\t}\n\t}\n}", "func (t *queryExecFormatter) formattedResult() (pathResults map[string]interface{}, err error) {\n\tr, err := t.queryAndVerify()\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// query path results are set against the index\n\tpathResults = map[string]interface{}{\n\t\tt.index: r,\n\t}\n\treturn\n}", "func parseMatchers(task *kernel.Task, filter stack.IPHeaderFilter, optVal []byte) ([]stack.Matcher, error) {\n\tnflog(\"set entries: parsing matchers of size %d\", len(optVal))\n\tvar matchers []stack.Matcher\n\tfor len(optVal) > 0 {\n\t\tnflog(\"set entries: optVal has len %d\", len(optVal))\n\n\t\t// Get the XTEntryMatch.\n\t\tif len(optVal) < linux.SizeOfXTEntryMatch {\n\t\t\treturn nil, fmt.Errorf(\"optVal has insufficient size for entry match: %d\", len(optVal))\n\t\t}\n\t\tvar match linux.XTEntryMatch\n\t\tmatch.UnmarshalUnsafe(optVal)\n\t\tnflog(\"set entries: parsed entry match %q: %+v\", match.Name.String(), match)\n\n\t\t// Check some invariants.\n\t\tif match.MatchSize < linux.SizeOfXTEntryMatch {\n\t\t\treturn nil, fmt.Errorf(\"match size is too small, must be at least %d\", linux.SizeOfXTEntryMatch)\n\t\t}\n\t\tif len(optVal) < int(match.MatchSize) {\n\t\t\treturn nil, fmt.Errorf(\"optVal has insufficient size for match: %d\", len(optVal))\n\t\t}\n\n\t\t// Parse the specific matcher.\n\t\tmatcher, err := unmarshalMatcher(task, match, filter, optVal[linux.SizeOfXTEntryMatch:match.MatchSize])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create matcher: %v\", err)\n\t\t}\n\t\tmatchers = append(matchers, matcher)\n\n\t\t// TODO(gvisor.dev/issue/6167): Check the revision field.\n\t\toptVal = optVal[match.MatchSize:]\n\t}\n\n\tif len(optVal) != 0 {\n\t\treturn nil, errors.New(\"optVal should be exhausted after parsing matchers\")\n\t}\n\n\treturn matchers, nil\n}", "func ParseConfigurationFilters(values map[string]interface{}) (Filters, error) {\n\tfilters := Filters{}\n\tfor filterType, rawValue := range values {\n\t\tvalue, err := filterValue(rawValue)\n\t\tif err != nil {\n\t\t\treturn []*Filter{}, err\n\t\t}\n\t\tfilter, err := MakeFilter(filterType, value)\n\t\tif err != nil {\n\t\t\treturn []*Filter{}, err\n\t\t}\n\t\tfilters = append(filters, filter)\n\t}\n\treturn filters, nil\n}", "func (s *selection) filter() (*csp.CSPList, error) {\n\tvar err error\n\tif s.policies == nil || len(s.policies.items) == 0 || s.pools == nil || len(s.pools.GetPoolUIDs()) == 0 {\n\t\treturn s.pools, nil\n\t}\n\t// make a copy of original pool UIDs\n\tfiltered := csp.ListBuilder().WithList(s.pools).List()\n\t// Sorting policies based on the priority\n\tpolicies := s.policies.sortByPriority()\n\t// Executing policy filters\n\tfor _, policy := range policies {\n\t\tfiltered, err = policy.filter(filtered)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// stopping here if running as\n\t\t// singleExecution mode\n\t\tif s.mode == singleExection {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn filtered, nil\n}", "func getParamsAndValues(b *ingestcommon.BenchData) ([]paramtools.Params, []float32, paramtools.ParamSet) {\n\tparams := []paramtools.Params{}\n\tvalues := []float32{}\n\tps := paramtools.ParamSet{}\n\tfor testName, allConfigs := range b.Results {\n\t\tfor configName, result := range allConfigs {\n\t\t\tkey := paramtools.Params(b.Key).Copy()\n\t\t\tkey[\"test\"] = testName\n\t\t\tkey[\"config\"] = configName\n\t\t\tkey.Add(paramtools.Params(b.Options))\n\n\t\t\t// If there is an options map inside the result add it to the params.\n\t\t\tif resultOptions, ok := result[\"options\"]; ok {\n\t\t\t\tif opts, ok := resultOptions.(map[string]interface{}); ok {\n\t\t\t\t\tfor k, vi := range opts {\n\t\t\t\t\t\t// Ignore the very long and not useful GL_ values, we can retrieve\n\t\t\t\t\t\t// them later via ptracestore.Details.\n\t\t\t\t\t\tif strings.HasPrefix(k, \"GL_\") {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif s, ok := vi.(string); ok {\n\t\t\t\t\t\t\tkey[k] = s\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor k, vi := range result {\n\t\t\t\tif k == \"options\" || k == \"samples\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tkey[\"sub_result\"] = k\n\t\t\t\tfloatVal, ok := vi.(float64)\n\t\t\t\tif !ok {\n\t\t\t\t\tsklog.Errorf(\"Found a non-float64 in %v\", result)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tkey = query.ForceValid(key)\n\t\t\t\tparams = append(params, key.Copy())\n\t\t\t\tvalues = append(values, float32(floatVal))\n\t\t\t\tps.AddParams(key)\n\t\t\t}\n\t\t}\n\t}\n\tps.Normalize()\n\treturn params, values, ps\n}", "func processAndWrapQuery(jsonQueryMap map[string]interface{}) {\n\tfor jsonKey, jsonValue := range jsonQueryMap {\n\t\twraperField := processField(jsonKey)\n\t\tdelete(jsonQueryMap, jsonKey)\n\t\twraperValue := processValue(jsonValue)\n\t\tjsonQueryMap[wraperField] = wraperValue\n\t}\n}", "func processQuery(query *emailToLoginQuery, email string, log *logrus.Entry) string {\n\tswitch len(query.Search.Edges) {\n\tcase 0:\n\t\treturn fmt.Sprintf(\"No GitHub users were found matching the public email listed for the QA contact in Bugzilla (%s), skipping review request.\", email)\n\tcase 1:\n\t\treturn fmt.Sprintf(\"Requesting review from QA contact:\\n/cc @%s\", query.Search.Edges[0].Node.User.Login)\n\tdefault:\n\t\tresponse := fmt.Sprintf(\"Multiple GitHub users were found matching the public email listed for the QA contact in Bugzilla (%s), skipping review request. List of users with matching email:\", email)\n\t\tfor _, edge := range query.Search.Edges {\n\t\t\tresponse += fmt.Sprintf(\"\\n\\t- %s\", edge.Node.User.Login)\n\t\t}\n\t\treturn response\n\t}\n}", "func (s storager) FilterAuthOptions(options []storage.Option) []storage.Option {\n\tvar authOptions = make([]storage.Option, 0)\n\tif awsConfig, _ := filterAuthOption(options); awsConfig != nil {\n\t\tauthOptions = append(authOptions, awsConfig)\n\t}\n\treturn authOptions\n\n}", "func (c *Client) FilterEntryList(tenant, filter string) ([]map[string]interface{}, error) {\n\n\tme := \"FilterEntryList\"\n\n\tkey := \"vzEntry\"\n\n\tdnF := dnFilter(tenant, filter)\n\n\tapi := \"/api/node/mo/uni/\" + dnF + \".json?query-target=children&target-subtree-class=\" + key\n\n\turl := c.getURL(api)\n\n\tc.debugf(\"%s: url=%s\", me, url)\n\n\tbody, errGet := c.get(url)\n\tif errGet != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %v\", me, errGet)\n\t}\n\n\tc.debugf(\"%s: reply: %s\", me, string(body))\n\n\treturn jsonImdataAttributes(c, body, key, me)\n}", "func (client *Client) ListResults(bucketKey string, testID string) ([]Result, error) {\n\tvar results = []Result{}\n\n\tpath := fmt.Sprintf(\"buckets/%s/tests/%s/results\", bucketKey, testID)\n\tcontent, err := client.Get(path)\n\tif err != nil {\n\t\treturn results, err\n\t}\n\n\terr = unmarshal(content, &results)\n\treturn results, err\n}", "func resultParser(response *http.Response, shortURL string) ([]Structure, error) {\r\n\tdoc, err := goquery.NewDocumentFromResponse(response)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\tresults := []Structure{}\r\n\t//if statement can change what to scrape depending on website chosen (fill in this case)\r\n\tif shortURL == \"fill\" {\r\n\t\tvar item = doc.Find(\"div.CopyProtected\")\r\n\r\n\t\t//the information we want\r\n\t\tclasses := [4]string{\"div.manga_canon\", \"div.mixed_canon/filler\", \"div.filler\", \"div.anime_canon\"}\r\n\r\n\t\tfor _, search := range classes {\r\n\r\n\t\t\t//searches for information\r\n\t\t\tselection := item.Find(search)\r\n\r\n\t\t\t//saves it as text\r\n\t\t\tepisodes := selection.Find(\"span.Episodes\")\r\n\t\t\tepisodestxt := episodes.Text()\r\n\r\n\t\t\tif episodestxt == \"\" {\r\n\t\t\t\tepisodestxt = \"0\"\r\n\t\t\t}\r\n\t\t\t//saves result in the structure struct\r\n\t\t\t//the %//DEVIDER//% is used for splitting the\r\n\t\t\t//information later\r\n\t\t\tresult := Structure{\r\n\t\t\t\t\"%//DEVIDER//%\",\r\n\t\t\t\tepisodestxt,\r\n\t\t\t}\r\n\t\t\t//append the results together\r\n\t\t\tresults = append(results, result)\r\n\t\t}\r\n\r\n\t}\r\n\treturn results, err\r\n}", "func filterRules(rules []string, filters []utiliptables.Chain) []string {\n\tfiltered := []string{}\n\tfor _, rule := range rules {\n\t\tskip := false\n\t\tfor _, filter := range filters {\n\t\t\tif strings.Contains(rule, string(filter)) {\n\t\t\t\tskip = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !skip {\n\t\t\tfiltered = append(filtered, rule)\n\t\t}\n\t}\n\treturn filtered\n}", "func (prCtx *ParseResultContext) AddResults(source string, parsedResList []*ParseResult) {\n\t// If there is no source, the configMap is probably a platform scan map, in that case\n\t// treat all the results as consistent.\n\tif source == \"\" {\n\t\tprCtx.addConsistentResults(source, parsedResList)\n\t\treturn\n\t}\n\n\t// Treat the first batch of results as consistent\n\tif len(prCtx.inconsistent) == 0 && len(prCtx.consistent) == 0 {\n\t\tprCtx.addConsistentResults(source, parsedResList)\n\t} else {\n\t\tprCtx.addParsedResults(source, parsedResList)\n\t}\n}", "func (is *InfoStore) buildFilter(maxHops uint32) (*Filter, error) {\n\tf, err := NewFilter(is.infoCount(), filterBits, filterMaxFP)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = is.visitInfos(nil, func(info *Info) error {\n\t\tif info.Hops <= maxHops {\n\t\t\tf.AddKey(info.Key)\n\t\t}\n\t\treturn nil\n\t})\n\n\treturn f, err\n}", "func (vm *VM) FilterScans(a *client.Adapter, scans *[]client.Scan) (filtered []client.Scan) {\n\t//TODO: Make this a method :-P\n\tid := vm.Config.VM.ID\n\tuuid := vm.Config.VM.UUID\n\tname := vm.Config.VM.Name\n\tregex := vm.Config.VM.Regex\n\thistid := vm.Config.VM.HistoryID\n\n\tif id != \"\" {\n\t\tfiltered = a.Filter.ScanByID(*scans, id)\n\t} else if uuid != \"\" {\n\t\tfiltered = a.Filter.ScanByScheduleUUID(*scans, uuid)\n\t} else if name != \"\" {\n\t\tfiltered = a.Filter.ScanByName(*scans, name)\n\t} else if regex != \"\" {\n\t\tfiltered = a.Filter.ScanByRegex(*scans, regex)\n\t} else {\n\t\tfiltered = append(filtered, *scans...)\n\t}\n\n\tif histid != \"\" {\n\t\tvar reduced []client.Scan\n\t\tfor _, s := range filtered {\n\t\t\tdet, err := a.ScanDetails(&s, true, true)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, h := range det.History {\n\t\t\t\tif h.HistoryID == histid {\n\t\t\t\t\treduced = append(reduced, s)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tfiltered = reduced\n\t}\n\n\treturn\n}", "func Filter(query string, result interface{}, input interface{}) error {\n\treturn Do(fmt.Sprintf(\"SELECT * FROM t0 WHERE %s\", query),\n\t\tresult, Obj{\"t0\": input})\n}", "func filterFields(mi *modelInfo, fields, filters []string) []string {\n\tvar res []string\n\tfor _, field := range fields {\n\t\tfieldExprs := jsonizeExpr(mi, strings.Split(field, ExprSep))\n\t\tfield = strings.Join(fieldExprs, ExprSep)\n\t\tif len(filters) == 0 {\n\t\t\tres = append(res, field)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, filter := range filters {\n\t\t\tfilterExprs := jsonizeExpr(mi, strings.Split(filter, ExprSep))\n\t\t\tfilter = strings.Join(filterExprs, ExprSep)\n\t\t\tif field == filter {\n\t\t\t\tres = append(res, field)\n\t\t\t}\n\t\t}\n\t}\n\treturn res\n}" ]
[ "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.4795634", "0.4782584", "0.4775394", "0.47669214", "0.47491744", "0.47442073", "0.47425014", "0.47214162", "0.4709422", "0.4685592", "0.46588543", "0.46536112", "0.46514484", "0.46396497", "0.46374172", "0.46332166", "0.46264493", "0.46020204", "0.45921776", "0.4592023", "0.4586581", "0.4586302", "0.45858714", "0.4574817", "0.4562695", "0.45590425", "0.45568556", "0.4546369", "0.45440128", "0.45354003", "0.45262724", "0.45232338", "0.45177603", "0.4511881", "0.45025206", "0.4501945", "0.44981882", "0.44966125", "0.44928768", "0.44925168", "0.44913423", "0.4476073", "0.44747663", "0.4472855", "0.44712457", "0.4467234", "0.44651586", "0.44467178", "0.44388744", "0.44340903", "0.44314203", "0.44285223", "0.44262224", "0.44225967", "0.4421529", "0.44199026", "0.44149166", "0.44047752", "0.43967003", "0.4391289", "0.43860084", "0.4385294", "0.43699077", "0.43688893", "0.43672362", "0.43671727", "0.43641892", "0.4363733", "0.43635255", "0.43634477", "0.4359447", "0.43579614", "0.43551108", "0.4353161", "0.43514073", "0.43499628", "0.43465698", "0.43415076", "0.43393356" ]
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.MarshalIndent(attributes, \"\", \"\\t\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to format device metadata for logging\")\n\t}\n\tif err := ioutil.WriteFile(filepath, crosLog, 0644); err != nil {\n\t\treturn errors.Wrap(err, \"failed to write CrOS attributes to output file\")\n\t}\n\treturn nil\n}", "func DebugIdentityDeviceName(value string) DebugIdentityAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"device_name\"] = value\n\t}\n}", "func (a Add) DeviceIDs(devices ...deviceID) error {\n\tfor i := range devices {\n\t\treqBody, err := json.Marshal(devices[i])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif a.debug == false {\n\t\t\terr = send(reqBody, a.APIKey, \"add\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn nil\n}", "func (m *Middleware) DeviceUID(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tspan := trace.SpanFromContext(r.Context())\n\t\tduidCookie, err := r.Cookie(m.duidCookieSettings.Name)\n\t\tvar uid ksuid.KSUID\n\t\tswitch {\n\t\tcase errors.Is(err, http.ErrNoCookie):\n\t\t\tspan.AddEvent(\"set new duid cookie\")\n\t\t\tuid = m.MustNewUID()\n\t\t\tm.SetDeviceUID(w, uid)\n\t\tcase err != nil:\n\t\t\tspan.RecordError(err)\n\t\t\tuid = m.MustNewUID()\n\t\t\tm.SetDeviceUID(w, uid)\n\t\tdefault:\n\t\t\tuid, err = m.parseUID(duidCookie.Value)\n\t\t\tif err != nil {\n\t\t\t\tspan.AddEvent(\"replace invalid duid cookie\")\n\t\t\t\tuid = m.MustNewUID()\n\t\t\t\tm.SetDeviceUID(w, uid)\n\t\t\t}\n\t\t}\n\t\tspan.SetAttributes(duidAttributeKey.String(uid.String()))\n\t\tctx := context.WithValue(r.Context(), duidContextKey, uid)\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}", "func parseDeviceID() Handler {\n\treturn func(rc *RouterContext, w http.ResponseWriter, r *http.Request) *HTTPError {\n\n\t\tdeviceid := r.Header.Get(\"deviceid\")\n\t\tif deviceid == \"\" {\n\t\t\treturn handleMissingDataError(\"deviceid\")\n\t\t}\n\n\t\trc.deviceid = deviceid\n\t\treturn nil\n\t}\n}", "func (v *VolumePublishManager) populateDevicePath(ctx context.Context, volumeId string,\n\tvolumeTrackingInfo *utils.VolumeTrackingInfo,\n) {\n\tlogFields := LogFields{\n\t\t\"volumeID\": volumeId,\n\t\t\"iscsiTargetPortal\": volumeTrackingInfo.IscsiTargetPortal,\n\t\t\"lun\": volumeTrackingInfo.IscsiLunNumber,\n\t}\n\n\tif volumeTrackingInfo.DevicePath == \"\" {\n\t\tif volumeTrackingInfo.RawDevicePath != \"\" {\n\t\t\tvolumeTrackingInfo.DevicePath = volumeTrackingInfo.RawDevicePath\n\t\t\tvolumeTrackingInfo.RawDevicePath = \"\"\n\n\t\t\tlogFields[\"devicePath\"] = volumeTrackingInfo.DevicePath\n\t\t\tLogc(ctx).Debug(\"Updating publish info records.\")\n\t\t} else {\n\t\t\tLogc(ctx).Errorf(\"Publish info is missing device path.\")\n\t\t}\n\t} else {\n\t\tif volumeTrackingInfo.RawDevicePath != \"\" {\n\t\t\tlogFields[\"devicePath\"] = volumeTrackingInfo.DevicePath\n\t\t\tlogFields[\"rawDevicePath\"] = volumeTrackingInfo.RawDevicePath\n\t\t\tLogc(ctx).Warn(\"Found both devices.\")\n\n\t\t\t// No need to have two sources of device path information\n\t\t\tvolumeTrackingInfo.RawDevicePath = \"\"\n\t\t}\n\t}\n}", "func (daemon *Daemon) LogImageEventWithAttributes(imageID, refName, action string, attributes map[string]string) {\n\timg, err := daemon.GetImage(imageID)\n\tif err == nil && img.Config != nil {\n\t\t// image has not been removed yet.\n\t\t// it could be missing if the event is `delete`.\n\t\tcopyAttributes(attributes, img.Config.Labels)\n\t}\n\tif refName != \"\" {\n\t\tattributes[\"name\"] = refName\n\t}\n\tactor := events.Actor{\n\t\tID: imageID,\n\t\tAttributes: attributes,\n\t}\n\n\tdaemon.EventsService.Log(action, events.ImageEventType, actor)\n}", "func logDataAdd(r *http.Request, key string, value interface{}) {\n\tvar data map[string]interface{}\n\n\tctx := r.Context()\n\td := ctx.Value(\"log\")\n\tswitch v := d.(type) {\n\tcase map[string]interface{}:\n\t\tdata = v\n\tdefault:\n\t\tdata = make(map[string]interface{})\n\t}\n\n\tdata[key] = value\n\n\tr = r.WithContext(context.WithValue(ctx, \"log\", data))\n}", "func (e *HueEmulator) getDeviceInfo(w http.ResponseWriter, _ *http.Request, params httprouter.Params) {\n\tlightID := params.ByName(\"lightID\")\n\tfor _, v := range e.devices {\n\t\tif lightID == v.internalHash {\n\t\t\te.logger.Debug(\"Requested device state info\", common.LogIDToken, v.DeviceID)\n\t\t\te.sendJSON(w, getDevice(v))\n\t\t\treturn\n\t\t}\n\t}\n\n\te.logger.Warn(\"Requested unknown device state info\", common.LogIDToken, lightID)\n}", "func (o OpenSignal) AddADevice(device Device) (Response, error) {\n\tstrResponse := Response{}\n\n\tres, body, errs := o.Client.Post(addADevice).\n\t\tSet(\"Authorization\", \"Basic \"+o.APIKey).\n\t\tSend(device).\n\t\tEndStruct(&strResponse)\n\terr := catch(res, body)\n\tif err == nil {\n\t\tfor _, e := range errs {\n\t\t\tif e != nil {\n\t\t\t\terr = e\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn strResponse, err\n}", "func addAttribute(buf *bytes.Buffer, attrType uint16, data interface{}, dataSize int) {\n\tattr := syscall.RtAttr{\n\t\tLen: syscall.SizeofRtAttr,\n\t\tType: attrType,\n\t}\n\tattr.Len += uint16(dataSize)\n\tbinary.Write(buf, Endian, attr)\n\tswitch data := data.(type) {\n\tcase string:\n\t\tbinary.Write(buf, Endian, []byte(data))\n\t\tbuf.WriteByte(0) // terminate\n\tdefault:\n\t\tbinary.Write(buf, Endian, data)\n\t}\n\tfor i := 0; i < padding(int(attr.Len), syscall.NLMSG_ALIGNTO); i++ {\n\t\tbuf.WriteByte(0)\n\t}\n}", "func DebugIdentityV3DeviceName(value string) DebugIdentityV3Attr {\n\treturn func(m optionalAttr) {\n\t\tm[\"device_name\"] = value\n\t}\n}", "func (a *metricAttributesProcessor) processMetricAttributes(ctx context.Context, m pmetric.Metric) {\n\n\t// This is a lot of repeated code, but since there is no single parent superclass\n\t// between metric data types, we can't use polymorphism.\n\tswitch m.Type() {\n\tcase pmetric.MetricTypeGauge:\n\t\tdps := m.Gauge().DataPoints()\n\t\tfor i := 0; i < dps.Len(); i++ {\n\t\t\ta.attrProc.Process(ctx, a.logger, dps.At(i).Attributes())\n\t\t}\n\tcase pmetric.MetricTypeSum:\n\t\tdps := m.Sum().DataPoints()\n\t\tfor i := 0; i < dps.Len(); i++ {\n\t\t\ta.attrProc.Process(ctx, a.logger, dps.At(i).Attributes())\n\t\t}\n\tcase pmetric.MetricTypeHistogram:\n\t\tdps := m.Histogram().DataPoints()\n\t\tfor i := 0; i < dps.Len(); i++ {\n\t\t\ta.attrProc.Process(ctx, a.logger, dps.At(i).Attributes())\n\t\t}\n\tcase pmetric.MetricTypeExponentialHistogram:\n\t\tdps := m.ExponentialHistogram().DataPoints()\n\t\tfor i := 0; i < dps.Len(); i++ {\n\t\t\ta.attrProc.Process(ctx, a.logger, dps.At(i).Attributes())\n\t\t}\n\tcase pmetric.MetricTypeSummary:\n\t\tdps := m.Summary().DataPoints()\n\t\tfor i := 0; i < dps.Len(); i++ {\n\t\t\ta.attrProc.Process(ctx, a.logger, dps.At(i).Attributes())\n\t\t}\n\t}\n}", "func (s *Service) registerDeviceHandler(w http.ResponseWriter, r *http.Request) {\n\t// Get the authenticated user from the request context\n\tauthenticatedUser, err := accounts.GetAuthenticatedUser(r)\n\tif err != nil {\n\t\tresponse.UnauthorizedError(w, err.Error())\n\t\treturn\n\t}\n\n\t// Request body cannot be nil\n\tif r.Body == nil {\n\t\tresponse.Error(w, \"Request body cannot be nil\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Read the request body\n\tpayload, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tresponse.Error(w, \"Error reading request body\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Unmarshal the request body into the request prototype\n\tdeviceRequest := new(DeviceRequest)\n\tif err := json.Unmarshal(payload, deviceRequest); err != nil {\n\t\tlogger.ERROR.Printf(\"Failed to unmarshal device request: %s\", payload)\n\t\tresponse.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Get the correct platform application ARN\n\tapplicationARN, ok := map[string]string{\n\t\tPlatformIOS: s.cnf.AWS.APNSPlatformApplicationARN,\n\t\tPlatformAndroid: s.cnf.AWS.GCMPlatformApplicationARN,\n\t}[deviceRequest.Platform]\n\tif !ok {\n\t\tresponse.Error(w, ErrPlatformNotSupported.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Register a new endpoint for this device\n\t_, err = s.createOrUpdateEndpoint(\n\t\tauthenticatedUser,\n\t\tapplicationARN,\n\t\tdeviceRequest.Token,\n\t)\n\tif err != nil {\n\t\tresponse.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// 204 no content response\n\tresponse.NoContent(w)\n}", "func createDevice() []*Device {\n\tattrs := createMessageAttribute()\n\tdevices := []*Device{}\n\tdevice := &Device{\n\t\tID: \"id1\",\n\t\tName: \"SensorTag\",\n\t\tDescription: \"Sensor\",\n\t\tState: \"ON\",\n\t\tLastOnline: \"TODAY\",\n\t\tAttributes: attrs,\n\t}\n\tdevices = append(devices, device)\n\treturn devices\n}", "func (data *AccountData) LoggingAddDetails() {\n\n}", "func populateLocationsAttributes(d *schema.ResourceData, locations []client.Location) error {\n\thash, err := hashstructure.Hash(locations, nil) // this may not generate a unique ID, but it is fine for data sources\n\tif err != nil {\n\t\tpanic(\"[Dotcom-Monitor] Error hashing location data to create ID\")\n\t}\n\tstrHash := fmt.Sprint(hash)\n\td.SetId(strHash)\n\n\t// fill ids and names\n\tids := []int{}\n\tnames := []string{}\n\tfor _, item := range(locations) {\n\t\tids = append(ids, item.ID)\n\t\tnames = append(names, item.Name)\n\t}\n\td.Set(\"ids\", ids)\n\td.Set(\"names\", names)\n\n\treturn nil\n}", "func writeAttributes(headers map[string]string, attributes map[string]string, w http.ResponseWriter) {\n\tlog.Debugf(\"Headers: %+v, Attributes: %+v\", headers, attributes)\n\tfor h, a := range headers {\n\t\tif !strings.HasPrefix(h, \"X-\") && !strings.HasPrefix(h, \"x-\") {\n\t\t\th = \"X-\" + h\n\t\t}\n\n\t\tw.Header().Set(h, attributes[a])\n\t}\n}", "func (c *KebaUdp) Identify() (string, error) {\n\tvar kr keba.Report100\n\terr := c.roundtrip(\"report\", 100, &kr)\n\treturn kr.RFIDTag, err\n}", "func (d *MotorDev) SetDeviceID(id uint32) *MotorDev {\n d.Info.DeviceId = id\n return d\n}", "func (ifi *Interface) idAttrs() []netlink.Attribute {\n\treturn []netlink.Attribute{\n\t\t{\n\t\t\tType: unix.NL80211_ATTR_IFINDEX,\n\t\t\tData: nlenc.Uint32Bytes(uint32(ifi.Index)),\n\t\t},\n\t\t{\n\t\t\tType: unix.NL80211_ATTR_MAC,\n\t\t\tData: ifi.HardwareAddr,\n\t\t},\n\t}\n}", "func AddAttributes(ctx context.Context, attrs ...attribute.KeyValue) {\n\tif span := trace.SpanFromContext(ctx); span.SpanContext().IsSampled() {\n\t\tspan.SetAttributes(attrs...)\n\t}\n}", "func (m *IosDeviceType) SetAdditionalData(value map[string]interface{})() {\n m.additionalData = value\n}", "func (e *rawData) AddAttribute(key string, val string) {}", "func AddDevice(m *Device) (id int64, err error) {\n\to := orm.NewOrm()\n\tid, err = o.Insert(m)\n\treturn\n}", "func addAttributeToRequest(name, value string, attributes *[]api.Attribute) {\n\t*attributes = append(*attributes, api.Attribute{Name: name, Value: value, ECert: true})\n}", "func (p *EnricherProcessor) HandleDeviceIDDetails(ctx details.Enricher_ProcessorContext, message *deviceId.Details) error {\n\tstate := ctx.State()\n\tstate.Details = message\n\n\tctx.SaveState(state)\n\n\tp.output(ctx, state)\n\n\treturn nil\n}", "func (l *AppLogger) Info(tag string, message ...interface{}) {\n\tl.logging.SetFormatter(&logrus.JSONFormatter{})\n\tk := getAppFields(l.reqId, tag, l.userId)\n\tl.logging.WithFields(k).Info(message...)\n}", "func (ctx *HandlerContext) SpecificDeviceHandler(w http.ResponseWriter, r *http.Request) {\n\tsessionState := &SessionState{}\n\tsessID, err := sessions.GetState(r, ctx.SigningKey, ctx.SessStore, sessionState)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"problem with session %v\", err), http.StatusUnauthorized)\n\t\treturn\n\t}\n\tdeviceID := sessionState.Device.ID\n\tswitch r.Method {\n\tcase \"GET\":\n\t\tdevice, err := ctx.deviceStore.GetByID(deviceID)\n\t\tif err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"device not found: %v\", err), http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\t\trespond(w, device, http.StatusOK, ctx.PubVapid)\n\tcase \"PATCH\":\n\t\t// segment := path.Base(r.URL.Path)\n\t\t// if segment != \"me\" || segment != deviceID.Hex() {\n\t\t// \thttp.Error(w, \"unathorized\", http.StatusUnauthorized)\n\t\t// \treturn\n\t\t// }\n\t\tif r.Header.Get(headerContentType) != contentTypeJSON {\n\t\t\thttp.Error(w, \"content type must be application/json\", http.StatusUnsupportedMediaType)\n\t\t\treturn\n\t\t}\n\n\t\tdevice, err := ctx.deviceStore.GetByID(deviceID)\n\t\tif err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"error getting device: %v\", err), http.StatusNotFound)\n\t\t}\n\n\t\tdeviceUpdates := &devices.Updates{}\n\t\tif err := json.NewDecoder(r.Body).Decode(deviceUpdates); err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"error decoding JSON: %v\", err), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tif err = device.ApplyUpdates(deviceUpdates); err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"error updating device: %v\", err), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tif err = ctx.deviceStore.Update(deviceID, device); err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"error updating device: %v\", err), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tsessionState.Device = device\n\t\tif err := ctx.SessStore.Save(sessID, sessionState); err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"error updating session state: %v\", err), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\trespond(w, device, http.StatusOK, ctx.PubVapid)\n\n\tdefault:\n\t\thttp.Error(w, \"method must be GET or PATCH\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n}", "func (a *tailscaleSTSReconciler) DeviceInfo(ctx context.Context, childLabels map[string]string) (id tailcfg.StableNodeID, hostname string, ips []string, err error) {\n\tsec, err := getSingleObject[corev1.Secret](ctx, a.Client, a.operatorNamespace, childLabels)\n\tif err != nil {\n\t\treturn \"\", \"\", nil, err\n\t}\n\tif sec == nil {\n\t\treturn \"\", \"\", nil, nil\n\t}\n\tid = tailcfg.StableNodeID(sec.Data[\"device_id\"])\n\tif id == \"\" {\n\t\treturn \"\", \"\", nil, nil\n\t}\n\t// Kubernetes chokes on well-formed FQDNs with the trailing dot, so we have\n\t// to remove it.\n\thostname = strings.TrimSuffix(string(sec.Data[\"device_fqdn\"]), \".\")\n\tif hostname == \"\" {\n\t\treturn \"\", \"\", nil, nil\n\t}\n\tif rawDeviceIPs, ok := sec.Data[\"device_ips\"]; ok {\n\t\tif err := json.Unmarshal(rawDeviceIPs, &ips); err != nil {\n\t\t\treturn \"\", \"\", nil, err\n\t\t}\n\t}\n\n\treturn id, hostname, ips, nil\n}", "func AddLoggerToContext() echo.MiddlewareFunc {\n\treturn func(next echo.HandlerFunc) echo.HandlerFunc {\n\t\treturn func(c echo.Context) error {\n\n\t\t\tlogger := log.WithFields(log.Fields{\n\t\t\t\t\"request_id\": c.Response().Header().Get(echo.HeaderXRequestID),\n\t\t\t})\n\t\t\tc.Set(\"logger\", logger)\n\t\t\treturn next(c)\n\t\t}\n\t}\n}", "func AttachUserAndLogger[Ctx context.Context, In, Out any](h th.Handler[MyAppContext, In, Out]) th.Handler[Ctx, In, Out] {\n\treturn func(ctx Ctx, in In, req *http.Request) (Out, error) {\n\t\t// currently, the only way to genereate a zero value of a generic type is\n\t\t// like so:\n\t\tvar zero Out\n\n\t\tuserIDStr := req.Header.Get(\"X-User-Id\")\n\t\tif userIDStr == \"\" {\n\t\t\treturn zero, errors.New(\"please set the X-User-Id header with your ID\")\n\t\t}\n\n\t\tuserID, err := UserIDFromString(userIDStr)\n\t\tif err != nil {\n\t\t\treturn zero, err\n\t\t}\n\n\t\tmyAppCtx := MyAppContext{\n\t\t\tContext: ctx,\n\t\t\tUserID: userID,\n\t\t\tLogger: logrus.StandardLogger().WithField(\"context_id\", uuid.NewV4().String()),\n\t\t}\n\t\treturn h(myAppCtx, in, req)\n\t}\n}", "func storeDeviceInfo(ctx context.Context, secretName string, deviceID tailcfg.StableNodeID, fqdn string) error {\n\t// First check if the secret exists at all. Even if running on\n\t// kubernetes, we do not necessarily store state in a k8s secret.\n\treq, err := http.NewRequest(\"GET\", fmt.Sprintf(\"/api/v1/namespaces/%s/secrets/%s\", kubeNamespace, secretName), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tresp, err := doKubeRequest(ctx, req)\n\tif err != nil {\n\t\tif resp != nil && resp.StatusCode >= 400 && resp.StatusCode <= 499 {\n\t\t\t// Assume the secret doesn't exist, or we don't have\n\t\t\t// permission to access it.\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\tm := map[string]map[string]string{\n\t\t\"stringData\": {\n\t\t\t\"device_id\": string(deviceID),\n\t\t\t\"device_fqdn\": fqdn,\n\t\t},\n\t}\n\tvar b bytes.Buffer\n\tif err := json.NewEncoder(&b).Encode(m); err != nil {\n\t\treturn err\n\t}\n\treq, err = http.NewRequest(\"PATCH\", fmt.Sprintf(\"/api/v1/namespaces/%s/secrets/%s?fieldManager=tailscale-container\", kubeNamespace, secretName), &b)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/strategic-merge-patch+json\")\n\tif _, err := doKubeRequest(ctx, req); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (m *UserExperienceAnalyticsMetricHistory) SetDeviceId(value *string)() {\n err := m.GetBackingStore().Set(\"deviceId\", value)\n if err != nil {\n panic(err)\n }\n}", "func (us *UserStorage) AttachDeviceToken(id, token string) error {\n\t//we are not supporting devices for users here\n\treturn model.ErrorNotImplemented\n}", "func (us *UserStorage) AttachDeviceToken(id, token string) error {\n\t//we are not supporting devices for users here\n\treturn model.ErrorNotImplemented\n}", "func (rp *ResourcePoolImpl) StoreDeviceInfoFile(resourceNamePrefix string) error {\n\treturn nil\n}", "func (h *DeviceHandler) DeviceAdd(c context.Context, sessionID int) error {\n\tuis := libkb.UIs{\n\t\tProvisionUI: h.getProvisionUI(sessionID),\n\t\tSecretUI: h.getSecretUI(sessionID, h.G()),\n\t\tSessionID: sessionID,\n\t}\n\tm := libkb.NewMetaContext(c, h.G()).WithUIs(uis)\n\teng := engine.NewDeviceAdd(h.G())\n\treturn engine.RunEngine2(m, eng)\n}", "func (m *AgreementAcceptance) SetDeviceId(value *string)() {\n m.deviceId = value\n}", "func (m *ItemManagedDevicesItemCreateDeviceLogCollectionRequestRequestBuilder) ToPostRequestInformation(ctx context.Context, body ItemManagedDevicesItemCreateDeviceLogCollectionRequestPostRequestBodyable, requestConfiguration *ItemManagedDevicesItemCreateDeviceLogCollectionRequestRequestBuilderPostRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.BaseRequestBuilder.UrlTemplate\n requestInfo.PathParameters = m.BaseRequestBuilder.PathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST\n requestInfo.Headers.Add(\"Accept\", \"application/json\")\n err := requestInfo.SetContentFromParsable(ctx, m.BaseRequestBuilder.RequestAdapter, \"application/json\", body)\n if err != nil {\n return nil, err\n }\n if requestConfiguration != nil {\n requestInfo.Headers.AddAll(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "func (d *DeviceInfoCache) IAmDeviceInfo(iAm readWriteModel.BACnetUnconfirmedServiceRequestIAm, pduSource Address) {\n\tlog.Debug().Stringer(\"iAm\", iAm).Msg(\"IAmDeviceInfo\")\n\n\tdeviceIdentifier := iAm.GetDeviceIdentifier()\n\t// Get the device instance\n\tdeviceInstance := deviceIdentifier.GetInstanceNumber()\n\n\t// get the existing cache record if it exists\n\tdeviceInfo, ok := d.cache[DeviceInfoCacheKey{&deviceInstance, nil}.HashKey()]\n\n\t// maybe there is a record for this address\n\tif !ok {\n\t\tdeviceInfo, ok = d.cache[DeviceInfoCacheKey{nil, &pduSource}.HashKey()]\n\t}\n\n\t// make a new one using the class provided\n\tif !ok {\n\t\tdeviceInfo = NewDeviceInfo(deviceIdentifier.GetPayload(), pduSource)\n\t}\n\n\t// jam in the correct values\n\tmaximumApduLengthAccepted := readWriteModel.MaxApduLengthAccepted(iAm.GetMaximumApduLengthAcceptedLength().GetActualValue())\n\tdeviceInfo.MaximumApduLengthAccepted = &maximumApduLengthAccepted\n\tsegmentationSupported := iAm.GetSegmentationSupported().GetValue()\n\tdeviceInfo.SegmentationSupported = &segmentationSupported\n\tvendorId := iAm.GetVendorId().GetValue()\n\tdeviceInfo.VendorId = &vendorId\n\n\t// tell the cache this is an updated record\n\td.UpdateDeviceInfo(deviceInfo)\n}", "func updateDeviceServiceFields(\n\tfrom models.DeviceService,\n\tto *models.DeviceService,\n\tw http.ResponseWriter,\n\tdbClient interfaces.DBClient,\n\terrorHandler errorconcept.ErrorHandler) error {\n\n\t// Use .String() to compare empty structs (not ideal, but there is no .equals method)\n\tif (from.Addressable.String() != models.Addressable{}.String()) {\n\t\tvar addr models.Addressable\n\t\tvar err error\n\t\tif from.Addressable.Id != \"\" {\n\t\t\taddr, err = dbClient.GetAddressableById(from.Addressable.Id)\n\t\t}\n\t\tif from.Addressable.Id == \"\" || err != nil {\n\t\t\taddr, err = dbClient.GetAddressableByName(from.Addressable.Name)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tto.Addressable = addr\n\t}\n\n\tto.AdminState = from.AdminState\n\tif from.Description != \"\" {\n\t\tto.Description = from.Description\n\t}\n\tif from.Labels != nil {\n\t\tto.Labels = from.Labels\n\t}\n\tif from.LastConnected != 0 {\n\t\tto.LastConnected = from.LastConnected\n\t}\n\tif from.LastReported != 0 {\n\t\tto.LastReported = from.LastReported\n\t}\n\tif from.Name != \"\" {\n\t\tto.Name = from.Name\n\n\t\t// Check if the new name is unique\n\t\tcheckDS, err := dbClient.GetDeviceServiceByName(from.Name)\n\t\tif err != nil {\n\t\t\terrorHandler.HandleOneVariant(\n\t\t\t\tw,\n\t\t\t\terr,\n\t\t\t\terrorconcept.NewDeviceServiceDuplicate(checkDS.Id, to.Id),\n\t\t\t\terrorconcept.Default.ServiceUnavailable)\n\t\t}\n\t}\n\n\tto.OperatingState = from.OperatingState\n\tif from.Origin != 0 {\n\t\tto.Origin = from.Origin\n\t}\n\n\treturn nil\n}", "func (cache *LedisCacheStorage) AddDevice(clientID string, device *core.Device) {\n\t_, err := cache.db.HSet([]byte(clientID+\":device\"), []byte(device.ID), []byte(device.Token))\n\n\tif err != nil {\n\t\t_, _ = fmt.Fprintf(os.Stderr, \"Ledis Cache: failed to add device %v\\n\", err)\n\t}\n}", "func (b *MonopAmpBridge) AddDevice(ctx context.Context, id string) error {\n\treturn building.ErrOperationNotSupported\n}", "func (vera *Vera) getDeviceInfo(deviceID string) (DeviceInfo, error) {\n\tvar device Device\n\n\tfor _, d := range vera.Devices.Devices {\n\t\tif deviceID == d.PKDevice {\n\t\t\tdevice = d\n\t\t}\n\t}\n\n\tif device == (Device{}) {\n\t\treturn DeviceInfo{}, fmt.Errorf(\"%w: %s\", errDeviceNotFound, deviceID)\n\t}\n\n\turl := https + device.ServerDevice + devicePath + deviceID\n\n\tdeviceInfo, err := vera.getDeviceInfoURL(url)\n\t// Try using ServerDeviceAlt if ServerDevice doesn't work\n\tif err != nil {\n\t\turl = https + device.ServerDeviceAlt + devicePath + deviceID\n\t\tdeviceInfo, err = vera.getDeviceInfoURL(url)\n\t}\n\n\treturn deviceInfo, err\n}", "func (a *Agent) identifyAttributes(img *world.Image) map[int]int {\n\tattrs := make(map[int]int)\n\n\tattrs[attrTypeColor] = img.Color\n\tattrs[attrTypeShape] = img.Shape\n\tattrs[attrTypeDistance] = util.Abs(img.XDist) + util.Abs(img.ZDist)\n\n\tif img.XDist == 0 && img.ZDist == 0 {\n\t\tattrs[attrTypeDirection] = directionOrigin\n\t} else if img.XDist > 0 && img.ZDist == 0 {\n\t\tattrs[attrTypeDirection] = directionXPos\n\t} else if img.XDist < 0 && img.ZDist == 0 {\n\t\tattrs[attrTypeDirection] = directionXNeg\n\t} else if img.XDist == 0 && img.ZDist > 0 {\n\t\tattrs[attrTypeDirection] = directionZPos\n\t} else if img.XDist == 0 && img.ZDist < 0 {\n\t\tattrs[attrTypeDirection] = directionZNeg\n\t} else if img.XDist > 0 && img.ZDist > 0 {\n\t\tattrs[attrTypeDirection] = directionXPosZPos\n\t} else if img.XDist > 0 && img.ZDist < 0 {\n\t\tattrs[attrTypeDirection] = directionXPosZNeg\n\t} else if img.XDist < 0 && img.ZDist > 0 {\n\t\tattrs[attrTypeDirection] = directionXNegZPos\n\t} else if img.XDist < 0 && img.ZDist < 0 {\n\t\tattrs[attrTypeDirection] = directionXNegZNeg\n\t}\n\n\treturn attrs\n}", "func ShowSensorTagInfo(adapterID string) error {\n\n\tboo, err := api.AdapterExists(adapterID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Debugf(\"AdapterExists: %b\", boo)\n\n\t//err = api.StartDiscoveryOn(adapterID)\n\t//if err != nil {\n\t//\treturn err\n\t//}\n\t// wait a moment for the device to be spawn\n\ttime.Sleep(time.Second)\n\n\tdevarr, err := api.GetDevices()\n\tif err != nil {\n\t\treturn err\n\t}\n\t//log.Debug(\"devarr\",devarr[0])\n\tlen := len(devarr)\n\tlog.Debugf(\"length: %d\", len)\n\n\tfor i := 0; i < len; i++ {\n\t\tprop1, err := devarr[i].GetProperties()\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Cannot load properties of %s: %s\", devarr[i].Path, err.Error())\n\t\t\tcontinue\n\t\t}\n\t\tlog.Debugf(\"DeviceProperties - ADDRESS: %s\", prop1.Address)\n\n\t\tif prop1.Address == \"C4:7C:8D:63:33:14\"{\n\t\t\terr = ConnectAndFetchSensorDetailAndData(prop1.Address)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn nil\n}", "func (g *GroupsService) AddDevices(group Group, devices ...string) (bool, *Response, error) {\n\treturn g.AddIdentities(group, \"DEVICE\", devices...)\n}", "func (m *UserExperienceAnalyticsAnomalyDevice) SetDeviceId(value *string)() {\n err := m.GetBackingStore().Set(\"deviceId\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *CreatePostRequestBody) SetPhysicalDeviceId(value *string)() {\n m.physicalDeviceId = value\n}", "func (m *ManagedDevicesItemLogCollectionRequestsDeviceLogCollectionResponseItemRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *ManagedDevicesItemLogCollectionRequestsDeviceLogCollectionResponseItemRequestBuilderGetRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.BaseRequestBuilder.UrlTemplate\n requestInfo.PathParameters = m.BaseRequestBuilder.PathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET\n requestInfo.Headers.Add(\"Accept\", \"application/json\")\n if requestConfiguration != nil {\n if requestConfiguration.QueryParameters != nil {\n requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters))\n }\n requestInfo.Headers.AddAll(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "func LogFields(r *http.Request, keysAndValues ...interface{}) []interface{} {\n\tctx := r.Context()\n\ttraceID, spanID := tracing.TraceInfo(ctx)\n\n\treturn append([]interface{}{\n\t\t\"trace-id\", traceID,\n\t\t\"span-id\", spanID,\n\t}, keysAndValues...)\n}", "func (o *UpdateProjectDeviceParams) bindDeviceID(rawData []string, hasKey bool, formats strfmt.Registry) error {\n\tvar raw string\n\tif len(rawData) > 0 {\n\t\traw = rawData[len(rawData)-1]\n\t}\n\n\t// Required: true\n\t// Parameter is provided by construction from the route\n\n\to.DeviceID = raw\n\n\treturn nil\n}", "func registerIncomingMetricsFromDevices(from, to int) {\n\thandler := getHandler()\n\tconnections = append(connections, handler)\n\tfor {\n\t\tlog.Println(\"Registering metrics from devices...\")\n\t\tfor ID := from; ID <= to; ID++ {\n\t\t\tmetrics := make(map[int]int)\n\t\t\tfor i := 1; i <= 5; i++ {\n\t\t\t\tmetrics[i] = getDeviceMetricsForDevice(ID)\n\t\t\t}\n\t\t\tlog.Println(\"Updating metrics:\", ID, metrics)\n\t\t\thandler.UpdateMetrics(ID, metrics)\n\t\t}\n\t\ttime.Sleep(5 * time.Second)\n\t}\n}", "func DebugNanCountDeviceName(value string) DebugNanCountAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"device_name\"] = value\n\t}\n}", "func initTelemetry() error {\n\tuuidFilename := filepath.Join(caddy.AssetsPath(), \"uuid\")\n\tif customUUIDFile := os.Getenv(\"CADDY_UUID_FILE\"); customUUIDFile != \"\" {\n\t\tuuidFilename = customUUIDFile\n\t}\n\n\tnewUUID := func() uuid.UUID {\n\t\tid := uuid.New()\n\t\terr := os.MkdirAll(caddy.AssetsPath(), 0700)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"[ERROR] Persisting instance UUID: %v\", err)\n\t\t\treturn id\n\t\t}\n\t\terr = ioutil.WriteFile(uuidFilename, []byte(id.String()), 0600) // human-readable as a string\n\t\tif err != nil {\n\t\t\tlog.Printf(\"[ERROR] Persisting instance UUID: %v\", err)\n\t\t}\n\t\treturn id\n\t}\n\n\tvar id uuid.UUID\n\n\t// load UUID from storage, or create one if we don't have one\n\tif uuidFile, err := os.Open(uuidFilename); os.IsNotExist(err) {\n\t\t// no UUID exists yet; create a new one and persist it\n\t\tid = newUUID()\n\t} else if err != nil {\n\t\tlog.Printf(\"[ERROR] Loading persistent UUID: %v\", err)\n\t\tid = newUUID()\n\t} else {\n\t\tdefer uuidFile.Close()\n\t\tuuidBytes, err := ioutil.ReadAll(uuidFile)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"[ERROR] Reading persistent UUID: %v\", err)\n\t\t\tid = newUUID()\n\t\t} else {\n\t\t\tid, err = uuid.ParseBytes(uuidBytes)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"[ERROR] Parsing UUID: %v\", err)\n\t\t\t\tid = newUUID()\n\t\t\t}\n\t\t}\n\t}\n\n\t// parse and check the list of disabled metrics\n\tvar disabledMetricsSlice []string\n\tif len(disabledMetrics) > 0 {\n\t\tif len(disabledMetrics) > 1024 {\n\t\t\t// mitigate disk space exhaustion at the collection endpoint\n\t\t\treturn fmt.Errorf(\"too many metrics to disable\")\n\t\t}\n\t\tdisabledMetricsSlice = splitTrim(disabledMetrics, \",\")\n\t\tfor _, metric := range disabledMetricsSlice {\n\t\t\tif metric == \"instance_id\" || metric == \"timestamp\" || metric == \"disabled_metrics\" {\n\t\t\t\treturn fmt.Errorf(\"instance_id, timestamp, and disabled_metrics cannot be disabled\")\n\t\t\t}\n\t\t}\n\t}\n\n\t// initialize telemetry\n\ttelemetry.Init(id, disabledMetricsSlice)\n\n\t// if any metrics were disabled, report which ones (so we know how representative the data is)\n\tif len(disabledMetricsSlice) > 0 {\n\t\ttelemetry.Set(\"disabled_metrics\", disabledMetricsSlice)\n\t\tlog.Printf(\"[NOTICE] The following telemetry metrics are disabled: %s\", disabledMetrics)\n\t}\n\n\treturn nil\n}", "func AddTag(client *packngo.Client, deviceID, tag string) error {\n\tdevice, _, err := client.Devices.Get(deviceID)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttags := append(device.Tags, tag)\n\tclient.Devices.Update(deviceID, &packngo.DeviceUpdateRequest{\n\t\tTags: &tags,\n\t})\n\n\treturn nil\n}", "func (devices *DeviceSet) constructDeviceIDMap() {\n\tlogrus.Debug(\"devmapper: constructDeviceIDMap()\")\n\tdefer logrus.Debug(\"devmapper: constructDeviceIDMap() END\")\n\n\tfor _, info := range devices.Devices {\n\t\tdevices.markDeviceIDUsed(info.DeviceID)\n\t\tlogrus.Debugf(\"devmapper: Added deviceId=%d to DeviceIdMap\", info.DeviceID)\n\t}\n}", "func (a *App) LoggingContext(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\tsession, err := Store.Get(r, \"session-key\")\n\tif err != nil {\n\t\tlogger.Get().Error(\"Error Getting the session. error: %v\", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tvar username string\n\tif val, ok := session.Values[\"username\"]; ok {\n\t\tusername = val.(string)\n\t}\n\n\treqId, err := uuid.New()\n\tif err != nil {\n\t\tlogger.Get().Error(\"Error Creating the RequestId. error: %v\", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tloggingContext := fmt.Sprintf(\"%v:%v\", username, reqId.String())\n\n\tcontext.Set(r, LoggingCtxt, loggingContext)\n\n\tdefer context.Clear(r)\n\tnext(w, r)\n}", "func RequestIDHandler(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := r.Context()\n\t\tfr := frame.FromContext(ctx)\n\t\tfr.UUID = uuid.New()\n\t\tfr.Logger = fr.Logger.With().\n\t\t\tStr(\"uuid\", fr.UUID.String()).\n\t\t\tLogger()\n\t\th.ServeHTTP(w, r)\n\t})\n}", "func ContextLogger(ctx context.Context, module string, opts ...interface{}) log.Logger {\n\tnewLogger := log.MustLogger(module)\n\tif ctx != nil {\n\t\tctxRqID := ctx.Value(requestIDKey)\n\t\tif ctxRqID != nil {\n\t\t\tnewLogger = newLogger.New(\"requestID\", ctxRqID)\n\t\t}\n\n\t\tctxSessionID := ctx.Value(sessionIDKey)\n\t\tif ctxSessionID != nil {\n\t\t\tnewLogger = newLogger.New(\"sessionID\", ctxSessionID)\n\t\t}\n\t}\n\tif len(opts) > 0 {\n\t\tnewLogger = newLogger.New(opts...)\n\t}\n\treturn newLogger\n}", "func DeviceConnectedHandler(device *api.Device, attempt int) {\n\taddress, err := device.GetProperty(\"Address\")\n\tif err != nil {\n\t\tLogger.Println(err)\n\t\treturn\n\t}\n\n\taddressStr := fmt.Sprintf(\"%s\", address)\n\n\tdeviceLogger := log.New(os.Stdout, \"[\"+addressStr+\"] \", log.Lshortfile)\n\n\tdeviceLogger.Printf(\"Device connected\")\n\n\t// Get all characteristics\n\tcharList, err := device.GetCharsList()\n\tif err != nil {\n\t\tdeviceLogger.Println(err)\n\t\treturn\n\t}\n\tdeviceLogger.Printf(\"Discovered %d characteristics\", len(charList))\n\tif len(charList) == 0 {\n\t\tif attempt < GetCharsAttempts {\n\t\t\tdeviceLogger.Println(\"Device is not ready. Get characteristics later\")\n\t\t\tgo RetryForChars(device, attempt)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Look for known characteristic\n\tfor _, charPath := range charList {\n\t\tchar, err := device.GetChar(fmt.Sprintf(\"%s\", charPath))\n\t\tif err != nil {\n\t\t\tdeviceLogger.Println(err)\n\t\t\tcontinue\n\t\t}\n\t\tuuid, err := char.GetProperty(\"UUID\")\n\t\tif err != nil {\n\t\t\tdeviceLogger.Println(err)\n\t\t\tcontinue\n\t\t}\n\t\tswitch fmt.Sprintf(\"%s\", uuid)[4:8] {\n\t\tcase HRMeasuremetCharID:\n\t\t\tdeviceLogger.Println(\"is HR device\")\n\t\t\tsensor := Sensor{\n\t\t\t\tChar: char,\n\t\t\t\tKind: HRKind,\n\t\t\t\tLogger: deviceLogger,\n\t\t\t\tAddress: addressStr,\n\t\t\t\tDevice: device,\n\t\t\t}\n\t\t\tConnectedDevices = append(ConnectedDevices, addressStr)\n\t\t\tgo sensor.Listen()\n\t\t\treturn\n\t\tcase CSCMeasuremetCharID:\n\t\t\tdeviceLogger.Println(\"is CSC device\")\n\t\t\tsensor := Sensor{\n\t\t\t\tChar: char,\n\t\t\t\tLogger: deviceLogger,\n\t\t\t\tAddress: addressStr,\n\t\t\t\tDevice: device,\n\t\t\t}\n\t\t\tConnectedDevices = append(ConnectedDevices, addressStr)\n\t\t\tgo sensor.Listen()\n\t\t\treturn\n\t\t}\n\t}\n\tdeviceLogger.Println(\"Device with unknown characteristics\")\n\terr = device.Disconnect()\n\tif err != nil {\n\t\tdeviceLogger.Println(err)\n\t}\n}", "func (m *UserSimulationEventInfo) SetOsPlatformDeviceDetails(value *string)() {\n m.osPlatformDeviceDetails = value\n}", "func (p Params) SetDeviceID(id string) {\n\tp[\"image_request[device_id]\"] = id\n}", "func NewDeviceInfo() (DeviceInfo, error) {\n\td := DeviceInfo{Created: time.Now()}\n\n\t// Get the operating system\n\tout, err := exec.Command(\"uname\").Output()\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), \"executable file not found\") {\n\t\t\td.OS = \"WindowsNT\"\n\t\t} else {\n\t\t\treturn d, errors.New(\"Error getting device Operating System. \" + err.Error())\n\t\t}\n\t} else {\n\t\td.OS = strings.TrimSpace(string(out))\n\t}\n\n\t// Get the Host Name\n\tout, err = exec.Command(\"hostname\").Output()\n\tif err != nil {\n\t\treturn d, errors.New(\"Error getting device HostName. \" + err.Error())\n\t}\n\td.HostName = strings.TrimSpace(string(out))\n\n\t// Get the Machine ID\n\tif strings.ToLower(d.OS) == \"linux\" {\n\t\ttxt, err := ReadAllText(\"/etc/machine-id\")\n\t\tif err != nil {\n\t\t\treturn d, errors.New(\"Error getting device Machine-ID. \" + err.Error())\n\t\t}\n\t\td.MachineID = txt\n\t} else {\n\t\ttxt, err := GetClientID()\n\t\tif err != nil {\n\t\t\treturn d, errors.New(\"Error getting device Client-ID. \" + err.Error())\n\t\t}\n\t\td.MachineID = txt\n\t}\n\tif d.MachineID != \"\" {\n\t\t// Generate the SHA1 hash of the Machine ID\n\t\tsum := sha1.Sum([]byte(d.MachineID))\n\t\td.MachineID = fmt.Sprintf(\"%x\", sum)\n\t}\n\n\t// Get the IP addresses\n\tip, err := GetLocalIPAddresses()\n\tif err != nil {\n\t\treturn d, errors.New(\"Error getting device IP addresses. \" + err.Error())\n\t}\n\td.IPAddress = ip\n\n\treturn d, nil\n}", "func (l *Libvirt) DomainAttachDeviceFlags(Dom Domain, XML string, Flags uint32) (err error) {\n\tvar buf []byte\n\n\targs := DomainAttachDeviceFlagsArgs {\n\t\tDom: Dom,\n\t\tXML: XML,\n\t\tFlags: Flags,\n\t}\n\n\tbuf, err = encode(&args)\n\tif err != nil {\n\t\treturn\n\t}\n\n\n\t_, err = l.requestStream(160, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func ShowSensorTagInfo(adapterID string) error {\n\n\tboo, err := api.AdapterExists(adapterID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Debugf(\"AdapterExists: %b\", boo)\n\n\terr = api.StartDiscoveryOn(adapterID)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// wait a moment for the device to be spawn\n\ttime.Sleep(time.Second)\n\n\tdevarr, err := api.GetDevices()\n\tif err != nil {\n\t\treturn err\n\t}\n\t//log.Debug(\"devarr\",devarr[0])\n\tlen := len(devarr)\n\tlog.Debugf(\"length: %d\", len)\n\n\tfor i := 0; i < len; i++ {\n\t\tprop1, err := devarr[i].GetProperties()\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Cannot load properties of %s: %s\", devarr[i].Path, err.Error())\n\t\t\tcontinue\n\t\t}\n\t\tlog.Debugf(\"DeviceProperties - ADDRESS: %s\", prop1.Address)\n\n\t\terr = ConnectAndFetchSensorDetailAndData(prop1.Address)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func ServeDeviceDetails(details DeviceDetailsResponse) TestServerPayload {\n\treturn TestServerPayload{DeviceDetails: &details}\n}", "func TestGetDeviceByAttribute(t *testing.T) {\n\tpool := getStoragePool(t)\n\tassert.NotNil(t, pool)\n\tif pool == nil {\n\t\treturn\n\t}\n\n\tdevices := getAllDevices(t)\n\tassert.NotNil(t, devices)\n\tassert.NotZero(t, len(devices))\n\tif devices == nil {\n\t\treturn\n\t}\n\n\tfound, err := pool.FindDevice(\"Name\", devices[0].Device.Name)\n\tassert.Nil(t, err)\n\tassert.NotNil(t, found)\n\tassert.Equal(t, devices[0].Device.Name, found.Name)\n\n\tfound, err = pool.FindDevice(\"ID\", devices[0].Device.ID)\n\tassert.Nil(t, err)\n\tassert.NotNil(t, found)\n\tassert.Equal(t, devices[0].Device.ID, found.ID)\n}", "func (rb *ResourceBuilder) SetDeviceID(val string) {\n\tif rb.config.DeviceID.Enabled {\n\t\trb.res.Attributes().PutStr(\"device.id\", val)\n\t}\n}", "func (w *deviceWrapper) processDiscovery(d *device.DiscoveredDevices) {\n\tw.Ctor.Logger.Info(\"Discovered a new device\", common.LogDeviceTypeToken,\n\t\tw.Ctor.DeviceType.String(), common.LogDeviceNameToken, w.ID)\n\n\tsubLoadData := &device.InitDataDevice{\n\t\tLogger: w.Ctor.Logger,\n\t\tSecret: w.Ctor.Secret,\n\t\tDeviceDiscoveredChan: w.Ctor.LoadData.DeviceDiscoveredChan,\n\t\tDeviceStateUpdateChan: make(chan *device.StateUpdateData, 10),\n\t}\n\n\tloadedDevice, ok := d.Interface.(device.IDevice)\n\tif !ok {\n\t\tw.Ctor.Logger.Warn(\"One of the loaded devices is not implementing IDevice interface\",\n\t\t\tcommon.LogDeviceTypeToken, w.Ctor.DeviceConfigName, common.LogDeviceNameToken, w.ID)\n\t\treturn\n\t}\n\n\terr := loadedDevice.Init(subLoadData)\n\tif err != nil {\n\t\tw.Ctor.Logger.Warn(\"Failed to execute device.Load method\",\n\t\t\tcommon.LogDeviceTypeToken, w.Ctor.DeviceConfigName, common.LogDeviceNameToken, w.ID)\n\t\treturn\n\t}\n\n\tctor := &wrapperConstruct{\n\t\tDeviceType: d.Type,\n\t\tDeviceInterface: d.Interface,\n\t\tIsRootDevice: false,\n\t\tCron: w.Ctor.Cron,\n\t\tDeviceConfigName: w.Ctor.DeviceConfigName,\n\t\tDeviceState: d.State,\n\t\tLoadData: w.Ctor.LoadData,\n\t\tLogger: w.Ctor.Logger,\n\t\tSecret: w.Ctor.Secret,\n\t\tWorkerID: w.Ctor.WorkerID,\n\t\tDiscoveryChan: w.Ctor.DiscoveryChan,\n\t\tStatusUpdatesChan: w.Ctor.StatusUpdatesChan,\n\t}\n\n\twrapper := NewDeviceWrapper(ctor)\n\n\tw.Ctor.DiscoveryChan <- &NewDeviceDiscoveredEvent{\n\t\tProvider: wrapper,\n\t}\n}", "func dataToLogging(name string, d *schema.ResourceData) go_thunder.Logging {\n\tvar s go_thunder.Logging\n\n\tvar sInstance go_thunder.LoggingInstance\n\n\tsInstance.PoolShared = d.Get(\"pool_shared\").(string)\n\tsInstance.Name = d.Get(\"name\").(string)\n\tsInstance.Format = d.Get(\"format\").(string)\n\tsInstance.Auto = d.Get(\"auto\").(string)\n\tsInstance.KeepEnd = d.Get(\"keep_end\").(int)\n\tsInstance.LocalLogging = d.Get(\"local_logging\").(int)\n\tsInstance.Mask = d.Get(\"mask\").(string)\n\tsInstance.TemplateTCPProxyShared = d.Get(\"template_tcp_proxy_shared\").(string)\n\tsInstance.SharedPartitionTCPProxyTemplate = d.Get(\"shared_partition_tcp_proxy_template\").(int)\n\tsInstance.KeepStart = d.Get(\"keep_start\").(int)\n\tsInstance.ServiceGroup = d.Get(\"service_group\").(string)\n\tsInstance.PcreMask = d.Get(\"pcre_mask\").(string)\n\tsInstance.UserTag = d.Get(\"user_tag\").(string)\n\tsInstance.TCPProxy = d.Get(\"tcp_proxy\").(string)\n\tsInstance.SharedPartitionPool = d.Get(\"shared_partition_pool\").(int)\n\tsInstance.Pool = d.Get(\"pool\").(string)\n\n\ts.Name = sInstance\n\n\treturn s\n}", "func LoggingHandler(h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfields := map[string]interface{}{\n\t\t\t\"remote_ip\": r.RemoteAddr,\n\t\t\t\"http_uri\": r.URL.Path,\n\t\t\t\"http_referer\": r.Referer(),\n\t\t\t\"http_user_agent\": r.UserAgent(),\n\t\t\t\"http_method\": r.Method,\n\t\t\t\"http_proto\": r.Proto,\n\t\t}\n\t\taccessLogger := log.GetLoggerWithFields(\"api\", fields)\n\t\taccessLogger.Info(\"Incoming request\")\n\n\t\th.ServeHTTP(w, r)\n\t})\n}", "func (m *PeerManager) populateDeviceData(device *Device) {\n\tdevice.AllowedIPs = strings.Split(device.AllowedIPsStr, \", \")\n\tdevice.IPs = strings.Split(device.IPsStr, \", \")\n\tdevice.DNS = strings.Split(device.DNSStr, \", \")\n\n\t// set data from WireGuard interface\n\tdevice.Interface, _ = m.wg.GetDeviceInfo(device.DeviceName)\n}", "func concatDeviceIDPortID(deviceID string, portNo uint32) string {\n\treturn fmt.Sprintf(\"%s:%d\", deviceID, portNo)\n}", "func mapToAdxLog(resource pcommon.Resource, scope pcommon.InstrumentationScope, logData plog.LogRecord, _ *zap.Logger) *AdxLog {\n\n\tlogAttrib := logData.Attributes().AsRaw()\n\tclonedLogAttrib := cloneMap(logAttrib)\n\tcopyMap(clonedLogAttrib, getScopeMap(scope))\n\tadxLog := &AdxLog{\n\t\tTimestamp: logData.Timestamp().AsTime().Format(time.RFC3339Nano),\n\t\tObservedTimestamp: logData.ObservedTimestamp().AsTime().Format(time.RFC3339Nano),\n\t\tTraceID: traceutil.TraceIDToHexOrEmptyString(logData.TraceID()),\n\t\tSpanID: traceutil.SpanIDToHexOrEmptyString(logData.SpanID()),\n\t\tSeverityText: logData.SeverityText(),\n\t\tSeverityNumber: int32(logData.SeverityNumber()),\n\t\tBody: logData.Body().AsString(),\n\t\tResourceAttributes: resource.Attributes().AsRaw(),\n\t\tLogsAttributes: clonedLogAttrib,\n\t}\n\treturn adxLog\n}", "func useID(f IDFromRequest) func(http.Handler) http.Handler {\n\treturn func(delegate http.Handler) http.Handler {\n\t\treturn http.HandlerFunc(func(response http.ResponseWriter, request *http.Request) {\n\t\t\tid, err := f(request)\n\t\t\tif err != nil {\n\t\t\t\thttperror.Formatf(\n\t\t\t\t\tresponse,\n\t\t\t\t\thttp.StatusBadRequest,\n\t\t\t\t\t\"Could extract device id: %s\",\n\t\t\t\t\terr,\n\t\t\t\t)\n\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tctx := WithID(id, request.Context())\n\t\t\tdelegate.ServeHTTP(response, request.WithContext(ctx))\n\t\t})\n\t}\n}", "func logRequest(ctx context.Context, fields map[string]interface{}, msg string) {\n\n\t// metadata and headers.\n\tif md, ok := metadata.FromIncomingContext(ctx); ok {\n\t\tfor k, v := range md {\n\t\t\tfields[k] = v\n\t\t}\n\n\t\trequestID := \"\"\n\t\tif v, ok := fields[\"user-agent\"]; ok {\n\t\t\trequestID = fmt.Sprintf(\"%s%s\", requestID, v)\n\t\t}\n\t\tif v, ok := fields[\"x-forwarded-for\"]; ok {\n\t\t\trequestID = fmt.Sprintf(\"%s%s\", requestID, v)\n\t\t}\n\t\tif \"\" != requestID {\n\t\t\thash := sha1.New()\n\t\t\thash.Write([]byte(requestID))\n\t\t\tfields[\":request-id\"] = base64.URLEncoding.EncodeToString(hash.Sum(nil))\n\t\t}\n\t}\n\n\t// peer address\n\tif peerAddr, ok := peer.FromContext(ctx); ok {\n\t\taddress := peerAddr.Addr.String()\n\t\tif address != \"\" &&\n\t\t\t!strings.HasPrefix(address, \"127.0.0.1\") &&\n\t\t\t!strings.HasPrefix(address, \"localhost\") {\n\t\t\t// strip the port and any brackets (IPv6)\n\t\t\taddress = strings.TrimFunc(\n\t\t\t\taddress[:strings.LastIndexByte(address, byte(':'))],\n\t\t\t\tfunc(r rune) bool {\n\t\t\t\t\treturn '[' == r || ']' == r\n\t\t\t\t},\n\t\t\t)\n\t\t\tfields[\"peer\"] = address\n\t\t}\n\t}\n\n\tlog.WithFields(log.Fields(fields)).Info(msg)\n}", "func Identifier(resource *monitoredrespb.MonitoredResource, extraLabels map[string]string, metric pmetric.Metric, attributes pcommon.Map) string {\n\tvar b strings.Builder\n\n\t// Resource identifiers\n\tif resource != nil {\n\t\tfmt.Fprintf(&b, \"%v\", resource.GetLabels())\n\t}\n\n\t// Instrumentation library labels and additional resource labels\n\tfmt.Fprintf(&b, \" - %v\", extraLabels)\n\n\t// Metric identifiers\n\tfmt.Fprintf(&b, \" - %s -\", metric.Name())\n\tattributes.Sort().Range(func(k string, v pcommon.Value) bool {\n\t\tfmt.Fprintf(&b, \" %s=%s\", k, v.AsString())\n\t\treturn true\n\t})\n\treturn b.String()\n}", "func (m MetaData) GetDeviceID() string {\n\tif len(m) == 0 {\n\t\treturn \"\"\n\t}\n\tfor _, k := range []string{\"grpcgateway-x-device-id\", \"x-device-id\", \"device-id\"} {\n\t\tif v := m[k]; v != \"\" {\n\t\t\treturn v\n\t\t}\n\t}\n\treturn \"\"\n}", "func (m *GraphBaseServiceClient) DevicesById(id string)(*ib6d66da0f7d4860b7205f5fdb1200fc9000adb4fbc853a2f05f70c644580220f.DeviceItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"device%2Did\"] = id\n }\n return ib6d66da0f7d4860b7205f5fdb1200fc9000adb4fbc853a2f05f70c644580220f.NewDeviceItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "func (m *GraphBaseServiceClient) DevicesById(id string)(*ib6d66da0f7d4860b7205f5fdb1200fc9000adb4fbc853a2f05f70c644580220f.DeviceItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"device%2Did\"] = id\n }\n return ib6d66da0f7d4860b7205f5fdb1200fc9000adb4fbc853a2f05f70c644580220f.NewDeviceItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "func WithContext(ctx context.Context, fields ...zap.Field) *zap.Logger {\n\treqID, _ := requestid.Value(ctx)\n\tlog := zap.L()\n\tif len(fields) > 0 {\n\t\tlog = log.With(fields...)\n\t}\n\tif reqID != \"\" {\n\t\treturn log.With(ReqIDField(reqID))\n\t}\n\treturn log\n}", "func (m *RepairinvoiceMutation) AddDeviceid(i int) {\n\tif m.adddeviceid != nil {\n\t\t*m.adddeviceid += i\n\t} else {\n\t\tm.adddeviceid = &i\n\t}\n}", "func (m *Smart) getAttributes(acc telegraf.Accumulator, devices []string) {\n\tvar wg sync.WaitGroup\n\twg.Add(len(devices))\n\n\tfor _, device := range devices {\n\t\tgo gatherDisk(acc, m.UseSudo, m.Attributes, m.Path, m.Nocheck, device, &wg)\n\t}\n\n\twg.Wait()\n}", "func (in *DeviceInfo) DeepCopy() *DeviceInfo {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DeviceInfo)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (m *UserExperienceAnalyticsDeviceStartupHistory) SetDeviceId(value *string)() {\n err := m.GetBackingStore().Set(\"deviceId\", value)\n if err != nil {\n panic(err)\n }\n}", "func AddDeviceInRuntime(k string, cfg *config.SnmpDeviceCfg) {\n\t// Initialize each SNMP device and put pointer to the global map devices\n\tdev := device.New(cfg)\n\tdev.AttachToBus(Bus)\n\tdev.InitCatalogVar(DBConfig.VarCatalog)\n\tdev.SetSelfMonitoring(selfmonProc)\n\n\t// send a db map to initialize each one its own db if needed\n\toutdb, _ := dev.GetOutSenderFromMap(influxdb)\n\toutdb.Init()\n\toutdb.StartSender(&senderWg)\n\n\tmutex.Lock()\n\tdevices[k] = dev\n\t// Start gather goroutine for device and add it to the wait group for gather goroutines\n\tgatherWg.Add(1)\n\tgo func() {\n\t\tdefer gatherWg.Done()\n\t\tdev.StartGather()\n\t\tlog.Infof(\"Device %s finished\", cfg.ID)\n\t\t// If device goroutine has finished, leave the bus so it won't get blocked trying\n\t\t// to send messages to a not running device.\n\t\tdev.LeaveBus(Bus)\n\t}()\n\tmutex.Unlock()\n}", "func (m *Middleware) SetDeviceUID(w http.ResponseWriter, value ksuid.KSUID) {\n\tc := *m.duidCookieSettings\n\tc.Value = value.String()\n\thttp.SetCookie(w, &c)\n}", "func TestDeviceAttrToMsgAttr(t *testing.T) {\n\tvar devAttr []dtclient.DeviceAttr\n\tattr := dtclient.DeviceAttr{\n\t\tID: 00,\n\t\tDeviceID: \"DeviceA\",\n\t\tName: \"SensorTag\",\n\t\tDescription: \"Sensor\",\n\t\tValue: \"Temperature\",\n\t\tOptional: true,\n\t\tAttrType: \"float\",\n\t\tMetadata: \"CelsiusScale\",\n\t}\n\n\tdevAttr = append(devAttr, attr)\n\twantAttr := make(map[string]*MsgAttr)\n\twantAttr[attr.Name] = &MsgAttr{\n\t\tValue: attr.Value,\n\t\tOptional: &attr.Optional,\n\t\tMetadata: &TypeMetadata{\n\t\t\tType: attr.AttrType,\n\t\t},\n\t}\n\n\ttests := []struct {\n\t\tname string\n\t\tdeviceAttrs []dtclient.DeviceAttr\n\t\twant map[string]*MsgAttr\n\t}{\n\t\t{\n\t\t\tname: \"DeviceAttrToMsgAttr\",\n\t\t\tdeviceAttrs: devAttr,\n\t\t\twant: wantAttr,\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tgot := DeviceAttrToMsgAttr(tt.deviceAttrs)\n\t\t\tif len(got) != len(tt.want) {\n\t\t\t\tt.Errorf(\"DeviceAttrToMsgAttr failed due to wrong map size, Got Size = %v Want = %v\", len(got), len(tt.want))\n\t\t\t}\n\t\t\tfor gotKey, gotValue := range got {\n\t\t\t\tkeyPresent := false\n\t\t\t\tfor wantKey, wantValue := range tt.want {\n\t\t\t\t\tif gotKey == wantKey {\n\t\t\t\t\t\tkeyPresent = true\n\t\t\t\t\t\tif !reflect.DeepEqual(gotValue.Metadata, wantValue.Metadata) || !reflect.DeepEqual(gotValue.Optional, wantValue.Optional) || !reflect.DeepEqual(gotValue.Value, wantValue.Value) {\n\t\t\t\t\t\t\tt.Errorf(\"Error in DeviceAttrToMsgAttr() Got wrong value for key %v\", gotKey)\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !keyPresent {\n\t\t\t\t\tt.Errorf(\"DeviceAttrToMsgAttr failed() due to wrong key %v\", gotKey)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "func deriveDIDs(data *Data) ([]identity.DID, error) {\n\tvar c []identity.DID\n\tfor _, id := range []string{data.SenderID, data.RecipientID} {\n\t\tif id != \"\" {\n\t\t\tdid, err := identity.NewDIDFromString(id)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tc = append(c, did)\n\t\t}\n\t}\n\n\treturn c, nil\n}", "func deviceStatusHandler(devices map[string]*Device) http.HandlerFunc {\n\treturn func(respWriter http.ResponseWriter, request *http.Request) {\n\t\trespWriter.Header().Add(\"Content-Type\", \"application/json\")\n\t\tbytes, err := json.Marshal(&devices)\n\t\tif err != nil {\n\t\t\thttp.Error(respWriter, \"Can't marshall devices\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\trespWriter.Write(bytes)\n\t}\n}", "func (a *logAttributesProcessor) ProcessLogs(_ context.Context, ld pdata.Logs) (pdata.Logs, error) {\n\trls := ld.ResourceLogs()\n\tfor i := 0; i < rls.Len(); i++ {\n\t\trs := rls.At(i)\n\t\tilss := rs.InstrumentationLibraryLogs()\n\t\tresource := rs.Resource()\n\t\tfor j := 0; j < ilss.Len(); j++ {\n\t\t\tils := ilss.At(j)\n\t\t\tlogs := ils.Logs()\n\t\t\tlibrary := ils.InstrumentationLibrary()\n\t\t\tfor k := 0; k < logs.Len(); k++ {\n\t\t\t\tlr := logs.At(k)\n\t\t\t\tif a.skipLog(lr, resource, library) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\ta.attrProc.Process(lr.Attributes())\n\t\t\t}\n\t\t}\n\t}\n\treturn ld, nil\n}", "func (s *Driver) AddDevice(deviceName string, protocols map[string]contract.ProtocolProperties, adminState contract.AdminState) error {\n\ts.lc.Debug(fmt.Sprintf(\"a new Device is added: %s\", deviceName))\n\treturn nil\n}", "func fillRequestDataInternal(span *tracepb.Span, data *contracts.RequestData) {\n\t// Everything is a custom attribute here\n\tfor k, v := range span.Attributes.AttributeMap {\n\t\tsetAttributeValueAsPropertyOrMeasurement(k, v, data.Properties, data.Measurements)\n\t}\n}", "func createDevicesMap() map[string]string {\n\n\tdevices := map[string]string{}\n\n\tserials, err := listDeviceSerials()\n\tif err != nil {\n\t\treturn devices\n\t}\n\n\twg := new(sync.WaitGroup)\n\tmutex := new(sync.Mutex)\n\tfor _, serial := range serials {\n\t\twg.Add(1)\n\t\tgo func(serial string, mutex *sync.Mutex, waitGroup *sync.WaitGroup) {\n\t\t\tstdOut := &bytes.Buffer{}\n\t\t\tparams := Params{args: []string{\"-s\", serial, \"shell\", \"cat\", \"/system/build.prop\"}, stdOut:stdOut}\n\t\t\terr := execAdb(params)\n\t\t\tif err != nil {\n\t\t\t\twg.Done()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tmutex.Lock()\n\t\t\tdefer mutex.Unlock()\n\t\t\tfor _, line := range strings.Split(stdOut.String(), \"\\n\") {\n\t\t\t\tif strings.HasPrefix(line, \"ro.product.model=\") {\n\t\t\t\t\tname := strings.TrimSpace(strings.Split(line, \"=\")[1])\n\t\t\t\t\tdevices[name] = serial\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\twg.Done()\n\t\t}(serial, mutex, wg)\n\t}\n\twg.Wait()\n\n\treturn devices\n}", "func (m *ComanagedDevicesItemLogCollectionRequestsDeviceLogCollectionResponseItemRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *ComanagedDevicesItemLogCollectionRequestsDeviceLogCollectionResponseItemRequestBuilderGetRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.BaseRequestBuilder.UrlTemplate\n requestInfo.PathParameters = m.BaseRequestBuilder.PathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET\n requestInfo.Headers.Add(\"Accept\", \"application/json\")\n if requestConfiguration != nil {\n if requestConfiguration.QueryParameters != nil {\n requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters))\n }\n requestInfo.Headers.AddAll(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "func (m *IosDeviceType) GetAdditionalData()(map[string]interface{}) {\n return m.additionalData\n}", "func newLogAttributesProcessor(attrProc *processorhelper.AttrProc, include, exclude filterlog.Matcher) *logAttributesProcessor {\n\treturn &logAttributesProcessor{\n\t\tattrProc: attrProc,\n\t\tinclude: include,\n\t\texclude: exclude,\n\t}\n}", "func setUID(genericData map[string]interface{}) error {\n\treturn setJSONValue(genericData, []string{\"metadata\", \"uid\"}, uuid.NewUUID())\n}" ]
[ "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.4365317", "0.43588683", "0.4357424", "0.43559805", "0.43536973", "0.4347446", "0.43457592", "0.43365645", "0.43266433", "0.4303506", "0.4301167", "0.42948753", "0.4291321", "0.42852327", "0.42803338", "0.42803338", "0.42753392", "0.42721343", "0.42720607", "0.42599788", "0.42597175", "0.4256304", "0.42560562", "0.4254481", "0.42526728", "0.42507285", "0.4226363", "0.42218673", "0.42210546", "0.42122772", "0.4207238", "0.42061862", "0.42028627", "0.41975358", "0.41953665", "0.4174625", "0.41736007", "0.41693372", "0.41663313", "0.4163566", "0.4160223", "0.41474816", "0.41460177", "0.41423607", "0.41275904", "0.41275486", "0.41268405", "0.41255736", "0.41204524", "0.4111101", "0.41090104", "0.4102577", "0.40995806", "0.40986383", "0.40962833", "0.40953013", "0.4093918", "0.40927726", "0.40812537", "0.40795296", "0.4073041", "0.4073041", "0.407092", "0.4070785", "0.40705538", "0.4064562", "0.40534234", "0.4051515", "0.40512875", "0.40458834", "0.40417024", "0.4041329", "0.40401116", "0.40387306", "0.40377808", "0.4023828", "0.40177867", "0.4017358", "0.40164676", "0.40160143" ]
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()\n\t_, err = c.Do(\"SET\", key, \"bar\", \"EX\", \"360\")\n\tif err != nil {\n\t\tt.Fatal(\"SET\", err)\n\t}\n}", "func (s *dnsTestServer) AddEntryToDNSDatabase(q DNSQuery, a DNSAnswers) {\n\ts.DNSDatabase[q] = append(s.DNSDatabase[q], a...)\n}", "func (c *ComponentChest) AddDeck(name string, deck *Deck) error {\n\t//Only add the deck if we haven't finished initalizing\n\tif c.initialized {\n\t\treturn errors.New(\"The chest was already finished, so no new decks may be added.\")\n\t}\n\tif c.decks == nil {\n\t\tc.decks = make(map[string]*Deck)\n\t}\n\n\tif name == \"\" {\n\t\tname = \"NONAMEPROVIDED\"\n\t}\n\n\tif _, ok := c.decks[name]; ok {\n\t\treturn errors.New(\"A deck with name \" + name + \" was already in the deck.\")\n\t}\n\n\t//Tell the deck that no more items will be added to it.\n\tif err := deck.finish(c, name); err != nil {\n\t\treturn errors.New(\"Couldn't finish deck: \" + err.Error())\n\t}\n\n\tc.decks[name] = deck\n\n\treturn nil\n\n}", "func (ps *dsPieceStore) AddDealForPiece(pieceCID cid.Cid, dealInfo piecestore.DealInfo) error {\n\t/*\treturn ps.mutatePieceInfo(pieceCID, func(pi *PieceInfo) error {\n\t\tfor _, di := range pi.Deals {\n\t\t\tif di.DealID == dealInfo.DealID {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\t//new deal\n\t\tpi.Deals = append(pi.Deals, DealInfo{\n\t\t\tDealInfo: dealInfo,\n\t\t\tIsPacking: false,\n\t\t\tExpiration: 0,\n\t\t})\n\t\treturn nil\n\t})*/\n\treturn nil\n}", "func AddDeck(m *Deck) (id int64, err error) {\n\to := orm.NewOrm()\n\tif m.Title == \"\"{\n\t\treturn 0, errors.New(\"名称不能为空\")\n\t}\n\tid, err = o.Insert(m)\n\treturn\n}", "func AddDish(dishId int, date int, db *sqlx.DB) error {\n\t_, err := squirrel.Insert(Table).Columns(DishId, Date).Values(dishId, date).RunWith(db.DB).Exec()\n\treturn err\n}", "func (db RecipeDB) addRecipe(name, version string, success bool) error {\n\tversionNum, err := convertVersion(version)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdb[name] = Recipe{Name: name, Version: versionNum, InstallTime: time.Now().Unix(), Success: success}\n\n\tvar recipelist []Recipe\n\tfor _, recipe := range db {\n\t\trecipelist = append(recipelist, recipe)\n\t}\n\tdbBytes, err := json.Marshal(recipelist)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdbDir := getDbDir()\n\tif err := os.MkdirAll(dbDir, 0755); err != nil {\n\t\treturn err\n\t}\n\n\tf, err := ioutil.TempFile(dbDir, dbFileName+\"_*\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := f.Write(dbBytes); err != nil {\n\t\tf.Close()\n\t\treturn err\n\t}\n\tif err := f.Close(); err != nil {\n\t\treturn err\n\t}\n\n\treturn os.Rename(f.Name(), filepath.Join(dbDir, dbFileName))\n}", "func (r *WorkplaceRepository) Add(ctx context.Context, entity *model.WorkplaceInfo) error {\n\tdata, err := json.Marshal(entity)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error to marshal workplace info\")\n\t}\n\t_, err = r.db.Conn.Exec(ctx, \"INSERT INTO workplace(info) VALUES($1) ON CONFLICT (info) DO UPDATE SET updated_at=now()\", data)\n\treturn err\n}", "func (room *Room) AddEntry(entry, issuer string) error {\n\tif room.game == nil {\n\t\treturn errors.New(\"there isn't a started game\")\n\t}\n\n\tif err := room.game.AddEntry(entry, issuer); err != nil {\n\t\treturn err\n\t}\n\n\tif room.game.Finished {\n\t\troom.previousGame = room.game\n\t\troom.game = nil\n\t}\n\treturn nil\n}", "func (s *Sqlite) AddCheck(check gogios.Check, output string) error {\n\tdb, err := s.openConnection()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer db.Close()\n\n\tdata := gogios.CheckHistory{CheckID: &check.ID, Asof: &check.Asof, Output: output, Status: &check.Status}\n\n\tif db.NewRecord(check) {\n\t\tdb.Create(&check)\n\t\tid, err := s.GetCheck(check.Title, \"title\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdata.CheckID = &id.ID\n\t\tdb.Create(&data)\n\t} else {\n\t\tdb.Model(check).Updates(&check)\n\t\tdb.Create(&data)\n\t}\n\n\treturn nil\n}", "func (r Resolver) addToDB() {\n\tquery := fmt.Sprintf(\n\t\t`INSERT INTO noobles (title, category, description, audio, creator)\nVALUES ($1, $2, $3, $4, $5)\nRETURNING id`,\n\t)\n\n\terr := database.PGclient.QueryRow(context.TODO(), query,\n\t\tr.nooble.Title, r.nooble.Category, r.nooble.Description, r.nooble.Audio, r.nooble.Creator.Email).Scan(&r.nooble.ID)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n}", "func (d *Dao) Add(ctx context.Context, h *model.History) error {\n\tvalueByte, err := json.Marshal(h)\n\tif err != nil {\n\t\tlog.Error(\"json.Marshal(%v) error(%v)\", h, err)\n\t\treturn err\n\t}\n\tfValues := make(map[string][]byte)\n\tcolumn := d.column(h.Aid, h.TP)\n\tfValues[column] = valueByte\n\tkey := hashRowKey(h.Mid)\n\tvalues := map[string]map[string][]byte{family: fValues}\n\tctx, cancel := context.WithTimeout(ctx, time.Duration(d.conf.Info.WriteTimeout))\n\tdefer cancel()\n\tif _, err = d.info.PutStr(ctx, tableInfo, key, values); err != nil {\n\t\tlog.Error(\"info.PutStr error(%v)\", err)\n\t}\n\treturn nil\n}", "func (s *dnsTestServer) AddEntryToDNSDatabaseRetry(q DNSQuery, a DNSAnswers) {\n\ts.DNSDatabaseRetry[q] = append(s.DNSDatabaseRetry[q], a...)\n}", "func (b *Backend) addEntry(s string) error {\n\tfp, err := os.OpenFile(b.config.omwFile, os.O_APPEND|os.O_RDWR|os.O_CREATE, 0644)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"can't open or create %s: %q\", b.config.omwFile, err)\n\t}\n\tdefer fp.Close()\n\tdata := SavedItems{}\n\tentry := SavedEntry{}\n\tentry.ID = uuid.New().String()\n\tentry.End = time.Now()\n\tentry.Task = s\n\tdata.Entries = append(data.Entries, entry)\n\tentriesBytes, err := toml.Marshal(data)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"can't marshal data\")\n\t}\n\ttoSave := string(entriesBytes)\n\tfileLock := flock.New(b.config.omwFile)\n\tlocked, err := fileLock.TryLock()\n\tdefer fileLock.Unlock()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to get file lock\")\n\t}\n\tif !locked {\n\t\treturn errors.New(\"unable to get file lock\")\n\t}\n\t_, err = fp.WriteString(toSave)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error saving new data\")\n\t}\n\treturn nil\n}", "func (l *RaftLog) addEntry(term uint64, data []byte) {\n\tnewEntry := pb.Entry{\n\t\tIndex: l.LastIndex() + 1,\n\t\tTerm: term,\n\t\tData: data,\n\t}\n\tl.entries = append(l.entries, newEntry)\n\tl.pendingEntries = append(l.pendingEntries, newEntry)\n}", "func add(c *cli.Context) error {\n\tproject := c.Args().First()\n\n\tslug, err := getSlug(project)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"%s\\n\", err)\n\t\treturn err\n\t}\n\tabsolutePath, _ := filepath.Abs(project)\n\n\trecord := ledger.Record{Path: absolutePath, Slug: slug}\n\trecord.RemoveFromLedger()\n\trecord.AddToLedger()\n\n\treturn nil\n}", "func AddRecipe(db *database.DB, recipe *Recipe) {\n\tdb.Create(recipe)\n}", "func (s *APAPIServer) AddIDEntry(ctxt context.Context, req *fibcapi.DbIdEntry) (*fibcapi.ApAddIdEntryReply, error) {\n\tif err := s.ctl.AddIDEntry(req); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &fibcapi.ApAddIdEntryReply{}, nil\n}", "func (d *Dao) Addit(c context.Context, aid int64) (ad *archive.Addit, err error) {\n\trow := d.rddb.QueryRow(c, _AdditSQL, aid)\n\tad = &archive.Addit{}\n\tif err = row.Scan(&ad.Aid, &ad.MissionID, &ad.FromIP, &ad.UpFrom, &ad.RecheckReason, &ad.RedirectURL, &ad.Source, &ad.OrderID, &ad.DescFormatID, &ad.Dynamic, &ad.InnerAttr); err != nil {\n\t\tif err == xsql.ErrNoRows {\n\t\t\terr = nil\n\t\t} else {\n\t\t\tlog.Error(\"row.Scan error(%v)\", err)\n\t\t}\n\t}\n\treturn\n}", "func (r *Report) addEntry(key string, suppressedKinds []string, kind string, context int, diffs []difflib.DiffRecord, changeType string) {\n\tentry := ReportEntry{\n\t\tkey,\n\t\tsuppressedKinds,\n\t\tkind,\n\t\tcontext,\n\t\tdiffs,\n\t\tchangeType,\n\t}\n\tr.entries = append(r.entries, entry)\n}", "func (d Dog) Add(dog *model.Dog) (string, error) {\n\tctx := context.Background()\n\tref := client.NewRef(\"dogs\")\n\n\trespRef, err := ref.Push(ctx, dog)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdog.ID = respRef.Key\n\n\treturn respRef.Key, nil\n}", "func (s *Service) Add(r *http.Request, args *AddEntryArgs, result *AddResponse) error {\n\tif args.UserID == \"\" {\n\t\tresult.Message = uidMissing\n\t\treturn nil\n\t}\n\tentryType := args.Type\n\tif entryType == \"\" {\n\t\tresult.Message = \"Entry type is missing\"\n\t\treturn nil\n\t} else if (entryType != EntryTypePim) && (entryType != EntryTypeBookmark) && (entryType != EntryTypeOrg) {\n\t\tresult.Message = \"Unknown entry type\"\n\t\treturn nil\n\t}\n\tcontent := args.Content\n\tif content == \"\" {\n\t\tresult.Message = \"Empty content not allowed\"\n\t\treturn nil\n\t}\n\ts.Log.Infof(\"received '%s' entry: '%s'\", entryType, content)\n\n\tcoll := s.Session.DB(MentatDatabase).C(args.UserID)\n\n\tentry := Entry{}\n\tmgoErr := coll.Find(bson.M{\"content\": content}).One(&entry)\n\tif mgoErr != nil {\n\t\tif mgoErr.Error() == MongoNotFound {\n\t\t\tentry.Type = args.Type\n\t\t\tentry.Content = content\n\t\t\ttags := args.Tags\n\t\t\tif len(tags) > 0 {\n\t\t\t\tvar lowerTags []string\n\t\t\t\tfor _, tag := range tags {\n\t\t\t\t\tlowerTags = append(lowerTags, strings.ToLower(tag))\n\t\t\t\t}\n\t\t\t\ttags := lowerTags\n\t\t\t\tentry.Tags = tags\n\t\t\t}\n\t\t\tif args.Scheduled != \"\" {\n\t\t\t\tscheduled, err := time.Parse(DatetimeLayout, args.Scheduled)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tentry.Scheduled = scheduled\n\t\t\t}\n\t\t\tif args.Deadline != \"\" {\n\t\t\t\tdeadline, err := time.Parse(DatetimeLayout, args.Deadline)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tentry.Deadline = deadline\n\t\t\t}\n\n\t\t\tnow := time.Now()\n\t\t\tentry.AddedAt = now\n\t\t\tentry.ModifiedAt = now\n\n\t\t\tif args.Priority != \"\" {\n\t\t\t\trexp, err := regexp.Compile(\"\\\\#[A-Z]$\")\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(err) // sentinel, should fail, because such error is predictable\n\t\t\t\t}\n\t\t\t\tif rexp.Match([]byte(args.Priority)) {\n\t\t\t\t\tentry.Priority = args.Priority\n\t\t\t\t} else {\n\t\t\t\t\tresult.Message = \"Malformed priority value\"\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif args.TodoStatus != \"\" {\n\t\t\t\tentry.TodoStatus = strings.ToUpper(args.TodoStatus)\n\t\t\t}\n\n\t\t\tif (PostMetadata{}) != args.Metadata {\n\t\t\t\tentry.Metadata = args.Metadata\n\t\t\t}\n\n\t\t\tentry.UUID = uuid.NewV4().String()\n\t\t\tmgoErr = coll.Insert(&entry)\n\t\t\tif mgoErr != nil {\n\t\t\t\ts.Log.Infof(\"failed to insert entry: %s\", mgoErr.Error())\n\t\t\t\tresult.Message = fmt.Sprintf(\"failed to insert entry: %s\", mgoErr.Error())\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tresult.Message = entry.UUID\n\t\t\treturn nil\n\t\t}\n\t\ts.Log.Infof(\"mgo error: %s\", mgoErr)\n\t\tresult.Message = fmt.Sprintf(\"mgo error: %s\", mgoErr)\n\t\treturn nil\n\t}\n\tresult.Message = \"Already exists, skipping\"\n\treturn nil\n}", "func (c *Collection) Add(entry interface{}) error {\n\tkeyComponents, err := c.generateKey(entry)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to add to collection. %s\", err.Error())\n\t}\n\n\tkey, err := c.formatKey(keyComponents)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to add to collection. %s\", err.Error())\n\t}\n\n\texists, err := c.exists(key)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to add to collection. %s\", err.Error())\n\t}\n\n\tif exists {\n\t\treturn fmt.Errorf(\"Failed to add to collection. Key already exists\")\n\t}\n\n\tbytes, err := c.Serializer.ToBytes(entry)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to add to collection. %s\", err.Error())\n\t}\n\n\tif c.Name != WorldStateIdentifier {\n\t\terr = c.Stub.PutPrivateData(c.Name, key, bytes)\n\t} else {\n\t\terr = c.Stub.PutState(key, bytes)\n\t}\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to add to collection. %s\", err.Error())\n\t}\n\n\treturn nil\n}", "func (b *BaseImpl) AddDirty(d Dirty) {\n\n\tb.dirties = append(b.dirties, d)\n\n}", "func (db RDB) Add(o DBObject) error {\n\tquery := upsertQuery(o)\n\tresults, err := db.Write(query)\n\tif err != nil {\n\t\tfor _, result := range results {\n\t\t\tfmt.Println(\"RES ERR:\", result.Err)\n\t\t}\n\t\treturn err\n\t}\n\tif len(results) > 0 {\n\t\t// If not a primary object this is a NOP\n\t\to.SetPrimary(results[0].LastInsertID)\n\t}\n\treturn nil\n}", "func (h mainUC) Add(req requests.RecipeRequest) (interface{}, error) {\n\t/** validate category */\n\t_, err := h.catRepo.Find(req.CategoryID)\n\tif err != nil {\n\t\treturn nil, errors.New(\"selected category not found\")\n\t}\n\n\trecipe := models.NewRecipe(req.Name, h.slugHelp.Make(\"recipes\", req.Name),\n\t\treq.CategoryID)\n\n\ttx := h.recipeDtlRepo.DBConn().Begin()\n\terr = h.recipeRepo.Save(recipe, tx)\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn nil, errors.New(\"error while saving recipe\")\n\t}\n\n\tvar details []*models.RecipeDetail\n\tfor _, item := range req.Ingredients {\n\t\t_, err := h.ingRepo.Find(item.IngredientID)\n\t\tif err != nil {\n\t\t\ttx.Rollback()\n\t\t\treturn nil, errors.New(\"selected ingredient not found\")\n\t\t}\n\t\tdtl := models.NewRecipeDetail(recipe.ID, item.IngredientID, item.Notes)\n\t\terr = h.recipeDtlRepo.Save(dtl, tx)\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"error while saving recipe item\")\n\t\t}\n\t\tdetails = append(details, dtl)\n\t}\n\n\ttx.Commit()\n\n\treturn h.createResponse(recipe, details)\n}", "func (d *DatabaseConnection) AddBottle(b *bottles.Bottle) error {\n\tb.BottleID = d.GenUniqueBottleID()\n\n\tsqlStatement := `\n\tINSERT INTO BOTTLES (bottleid, senderid, message, tag, lives, age, enabled, lat, long)\n\tVALUES ($1, $2, $3,$4, $5, $6, $7, $8, $9)`\n\t_, err := d.db.Exec(sqlStatement, b.BottleID, b.SenderID, b.Message, b.Tag, b.Lives, b.Age, b.Point.Enabled, b.Point.Lat, b.Point.Long)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func insertEntry(db *sql.DB, stamp time.Time, watts int) error {\n\tstampStr := stamp.Format(RFC3339NoZ)\n\tinsertSQLFormat := insertSQLFormat(db)\n\tinsertSQL := fmt.Sprintf(insertSQLFormat, stampStr, watts)\n\t_, err := db.Exec(insertSQL)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *Storage) Add(uuid []byte, e Entry) (err error) {\n\ttxn, dbis, err := s.startTxn(false, timeDB, entryDB, keyDB)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif e.Key != \"\" {\n\t\tDebug(\"Entry has key: \", e.Key)\n\n\t\tvar ouuid []byte\n\t\touuid, err = txn.Get(dbis[2], []byte(e.Key))\n\t\tif err != nil && err != mdb.NotFound {\n\t\t\ttxn.Abort()\n\t\t\treturn\n\t\t}\n\n\t\tif err == nil {\n\t\t\tDebug(\"Exising key found; removing.\")\n\n\t\t\terr = s.innerRemove(txn, dbis, ouuid)\n\t\t\tif err != nil {\n\t\t\t\ttxn.Abort()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\terr = txn.Put(dbis[2], []byte(e.Key), uuid, 0)\n\t\tif err != nil {\n\t\t\ttxn.Abort()\n\t\t\treturn\n\t\t}\n\t}\n\n\tk := uint64ToBytes(uint64(e.SendAt.UnixNano()))\n\terr = txn.Put(dbis[0], k, uuid, 0)\n\tif err != nil {\n\t\ttxn.Abort()\n\t\treturn\n\t}\n\n\tb, err := e.ToBytes()\n\tif err != nil {\n\t\ttxn.Abort()\n\t\treturn\n\t}\n\n\terr = txn.Put(dbis[1], uuid, b, 0)\n\tif err != nil {\n\t\ttxn.Abort()\n\t\treturn\n\t}\n\n\tok, t, err := s.innerNextTime(txn, dbis[0])\n\tif err != nil {\n\t\ttxn.Abort()\n\t\treturn\n\t}\n\n\terr = txn.Commit()\n\n\tif err == nil && ok {\n\t\ts.c <- t\n\t}\n\n\treturn\n}", "func cmdAddDeck() *cobra.Command {\n\tvar name string\n\n\tcmdAdd := &cobra.Command{\n\t\tUse: \"deck\",\n\t\tShort: \"Add a deck\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tdeck := card.NewDeck(name)\n\n\t\t\tfilename := cli.DeckDir() + name + fileExtensionJSON\n\t\t\terr := writeFileJSON(filename, &deck, os.ModePerm)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmdAdd.Flags().StringVarP(&name, flagName, flagNameS, \"\", \"name for deck (required)\")\n\tcmdAdd.MarkFlagRequired(flagName)\n\n\treturn cmdAdd\n}", "func (s *Store) addDepositInfo(di DepositInfo) (DepositInfo, error) {\n\tvar updatedDi DepositInfo\n\tif err := s.db.Update(func(tx *bolt.Tx) error {\n\t\tvar err error\n\t\tupdatedDi, err = s.addDepositInfoTx(tx, di)\n\t\treturn err\n\t}); err != nil {\n\t\treturn di, err\n\t}\n\n\treturn updatedDi, nil\n}", "func (d *Dao) ChannelTabAdd(param *show.ChannelTabAP) (err error) {\n\tif err = d.DB.Create(param).Error; err != nil {\n\t\tlog.Error(\"dao.show.ChannelTabAdd error(%v)\", err)\n\t\treturn\n\t}\n\treturn\n}", "func (k *Keeper) Add(ctx sdk.Context, address sdk.AccAddress, coins sdk.Coins) error {\n\tif err := k.bank.SendCoinsFromAccountToModule(ctx, address, types.ModuleName, coins); err != nil {\n\t\treturn err\n\t}\n\n\tdeposit, found := k.GetDeposit(ctx, address)\n\tif !found {\n\t\tdeposit = types.Deposit{\n\t\t\tAddress: address.String(),\n\t\t\tCoins: sdk.NewCoins(),\n\t\t}\n\t}\n\n\tdeposit.Coins = deposit.Coins.Add(coins...)\n\tif deposit.Coins.IsAnyNegative() {\n\t\treturn types.ErrorInsufficientDepositFunds\n\t}\n\n\tk.SetDeposit(ctx, deposit)\n\treturn nil\n}", "func (instance *cache) AddEntry(content Cacheable) (_ *Entry, xerr fail.Error) {\n\tif instance == nil {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\tif content == nil {\n\t\treturn nil, fail.InvalidParameterCannotBeNilError(\"content\")\n\t}\n\n\tinstance.lock.Lock()\n\tdefer instance.lock.Unlock()\n\n\tid := content.GetID()\n\tif xerr := instance.unsafeReserveEntry(id); xerr != nil {\n\t\treturn nil, xerr\n\t}\n\tdefer func() {\n\t\tif xerr != nil {\n\t\t\tif derr := instance.unsafeFreeEntry(id); derr != nil {\n\t\t\t\t_ = xerr.AddConsequence(fail.Wrap(derr, \"cleaning up on failure, failed to free cache entry '%s'\", id))\n\t\t\t}\n\t\t}\n\t}()\n\n\tcacheEntry, xerr := instance.unsafeCommitEntry(id, content)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\treturn cacheEntry, nil\n}", "func Add(db sql.Executor, ref types.PoetProofRef, poet, serviceID []byte, roundID string) error {\n\tenc := func(stmt *sql.Statement) {\n\t\tstmt.BindBytes(1, ref[:])\n\t\tstmt.BindBytes(2, poet)\n\t\tstmt.BindBytes(3, serviceID)\n\t\tstmt.BindBytes(4, []byte(roundID))\n\t}\n\t_, err := db.Exec(`\n\t\tinsert into poets (ref, poet, service_id, round_id) \n\t\tvalues (?1, ?2, ?3, ?4);`, enc, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"exec: %w\", err)\n\t}\n\n\treturn nil\n}", "func (db *DB) AddDB(key string, src *DB) error {\n\t// No tree to add, nothing to do\n\tsrc.l.RLock()\n\tdefer src.l.RUnlock()\n\tif src.tree == nil {\n\t\treturn nil\n\t}\n\treturn db.Add(key, src.tree.Id())\n}", "func (keyDB *KeyDB) AddHashChainEntry(\n\tdomain string,\n\tposition uint64,\n\tentry string,\n) error {\n\tdmn := identity.MapDomain(domain)\n\t_, err := keyDB.addHashChainEntryQuery.Exec(dmn, position, entry)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (db *Database) AddGroupHolder(gh *GroupHolder) (int, error) {\n\t// make sure if strings are empty we pass NULL to PostgreSQL\n\tvar user interface{}\n\tvar channel interface{}\n\tif gh.User != \"\" {\n\t\tuser = gh.User\n\t} else {\n\t\tuser = nil\n\t}\n\tif gh.Channel != \"\" {\n\t\tchannel = gh.Channel\n\t} else {\n\t\tchannel = nil\n\t}\n\trow := db.db.QueryRow(`\n\t\tSELECT melodious.insert_group_holder($1, $2, $3);\n\t`, gh.Group, user, channel)\n\tvar id int\n\terr := row.Scan(&id)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\treturn id, nil\n}", "func (st *SqliteStoreMatchup) AddMatchup(matchup *data.Matchup) error {\n\tstatement, err := st.database.Prepare(`INSERT INTO matchup (league_id, season_year, id,\n\t\thome, away, round, start) VALUES (?, ?, ?, ?, ?, ?, ?)`)\n\tif err != nil {\n\t\tfmt.Printf(\"AddMatchup Prepare Err: %v\\n\", err)\n\t\treturn err\n\t}\n\t_, err = statement.Exec(matchup.League.ID, matchup.Season.Year, matchup.ID, matchup.Home.ID, matchup.Away.ID, matchup.Round, matchup.Start.Format(time.RFC3339))\n\tif err != nil {\n\t\tfmt.Printf(\"AddMatchup Exec Err: %v\\n\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func TestDbLog_Add(t *testing.T) {\n\thandler := debug.NewLocalDb()\n\tdb := newDbLog(handler)\n\t_, err := db.Add(0, \"success\", \"\", 0, \"\", time.GetDayTime())\n\tif err == nil {\n\t\tt.Errorf(\"Add check cronId fail\")\n\t\treturn\n\t}\n\tid, err := db.Add(1, \"success\", \"123\", 1000, \"hello\", time.GetDayTime())\n\tif err != nil {\n\t\tt.Errorf(\"Add fail, error=[%v]\", err)\n\t\treturn\n\t}\n\tif id <= 0{\n\t\tt.Errorf(\"Add check rows fail\")\n\t\treturn\n\t}\n\tdb.Delete(id)\n}", "func AddData(stub shim.ChaincodeStubInterface,date string, importer string, exporter string, importerbank string, exporterbank string, key string, productdes string,payment int, status string, pendingstate string) {\r\n\tletter := LetterCredit{DocType: DocType, Date: date, ImporterName: importer, ExporterName: exporter, ImporterBankName: importerbank, ExporterBankName: exporterbank, ProductOrderId: key, ProductOrderDetails: productdes, PaymentAmount: payment, State: status,Pendingstate: pendingstate}\r\n\tjsonletter, _ = json.Marshal(letter)\r\n\t// Key = VIN#, Value = Car's JSON representation\r\n\tstub.PutState(key, jsonletter)\r\n}", "func DbPutTicket(dbTx database.Tx, ticketBucket []byte, hash *chainhash.Hash,\n\theight uint32, missed, revoked, spent, expired bool) error {\n\tmeta := dbTx.Metadata()\n\tbucket := meta.Bucket(ticketBucket)\n\tk := hash[:]\n\tv := make([]byte, 5)\n\tdbnamespace.ByteOrder.PutUint32(v, height)\n\tv[4] = undoBitFlagsToByte(missed, revoked, spent, expired)\n\n\treturn bucket.Put(k, v)\n}", "func TestAdd(t *testing.T) {\n\t_plague := New()\n\t_plague.Add(Item{})\n\tif len(_plague.Items) != 1 {\n\t\tt.Errorf(\"Item was not added\")\n\t}\n}", "func (r *InMemoryDeckRepository) Save(_ context.Context, d *domain.Deck) error {\n\tr.decks[d.UUID] = d\n\n\treturn nil\n}", "func (cache *Cache) AddEntry (path string) *FilePrint {\n ent, ok := cache.FilePrints[path]\n if ! ok {\n ent = new(FilePrint)\n ent.Local.Changed = true\n ent.Remote.Changed = true\n cache.FilePrints[path] = ent\n }\n return ent\n}", "func (d *DrainableStan) add(id string) {\n\tdefer d.m.Unlock()\n\n\td.m.Lock()\n\tif d.bucket == nil {\n\t\td.bucket = map[string]struct{}{}\n\t}\n\td.bucket[id] = struct{}{}\n}", "func (m *Maintenance) AddMaintenance(stub shim.ChaincodeStubInterface, args []string) error {\n\tcarID := args[0]\n\tm.Garage = args[1]\n\tm.Type = args[2]\n\tm.Date, _ = time.Parse(\"02-01-2006\", args[3])\n\tm.Km, _ = strconv.Atoi(args[4])\n\tm.Description = args[5]\n\n\tvar cm CarMaintenance\n\tcmJson, _ := stub.GetState(\"cm-\" + carID)\n\tif cmJson == nil {\n\t\tcm.CarID = carID\n\t} else {\n\t\terr := json.Unmarshal(cmJson, &cm)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"AddMaintence: Error in unmarshaling JSON\")\n\t\t}\n\t}\n\tcm.MantenanceList = append(cm.MantenanceList, *m)\n\tsort.Sort(cm.MantenanceList)\n\tcmJsonIndent, _ := json.MarshalIndent(cm, \"\", \" \")\n\terr := stub.PutState(\"cm-\"+carID, cmJsonIndent)\n\tif err != nil {\n\t\treturn errors.New(\"AddMaintenance: Unable to PutState\")\n\t}\n\treturn nil\n}", "func (wlt *Wallet) AddEntry(entry Entry) error {\n\t// dup check\n\tfor _, e := range wlt.Entries {\n\t\tif e.Address == entry.Address {\n\t\t\treturn errors.New(\"duplicate address entry\")\n\t\t}\n\t}\n\n\twlt.Entries = append(wlt.Entries, entry)\n\treturn nil\n}", "func (e *dataUsageEntry) addChild(hash dataUsageHash) {\n\tif _, ok := e.Children[hash.Key()]; ok {\n\t\treturn\n\t}\n\tif e.Children == nil {\n\t\te.Children = make(dataUsageHashMap, 1)\n\t}\n\te.Children[hash.Key()] = struct{}{}\n}", "func (es *EventService) AddBeer(eventID, beerID string, q *EventChangeBeerRequest) error {\n\t// POST: /event/:eventId/beers\n\tvar params *eventAddBeerRequest\n\tif q != nil {\n\t\tparams = &eventAddBeerRequest{beerID, *q}\n\t} else {\n\t\tparams = &eventAddBeerRequest{BeerID: beerID}\n\t}\n\treq, err := es.c.NewRequest(\"POST\", \"/event/\"+eventID+\"/beers\", params)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn es.c.Do(req, nil)\n}", "func add(h *Hand, c Card) {\n h.Cards[h.Size] = c\n h.Size += 1\n}", "func (ctx *TestContext) addItem(fields map[string]string) {\n\tdbFields := make(map[string]interface{})\n\tfor key, value := range fields {\n\t\tif key == \"item\" {\n\t\t\tkey = \"id\"\n\t\t}\n\n\t\tswitch {\n\t\tcase strings.HasSuffix(key, \"id\"):\n\t\t\tdbFields[key] = ctx.getReference(value)\n\t\tcase value[0] == ReferencePrefix:\n\t\t\tdbFields[key] = value[1:]\n\t\tdefault:\n\t\t\tdbFields[key] = value\n\t\t}\n\t}\n\n\titemKey := strconv.FormatInt(dbFields[\"id\"].(int64), 10)\n\n\tif oldFields, ok := ctx.dbTables[\"items\"][itemKey]; ok {\n\t\tdbFields = mergeFields(oldFields, dbFields)\n\t}\n\n\tif _, ok := dbFields[\"type\"]; !ok {\n\t\tdbFields[\"type\"] = \"Task\"\n\t}\n\tif _, ok := dbFields[\"default_language_tag\"]; !ok {\n\t\tdbFields[\"default_language_tag\"] = \"en\"\n\t}\n\tif _, ok := dbFields[\"text_id\"]; !ok && fields[\"item\"][0] == ReferencePrefix {\n\t\tdbFields[\"text_id\"] = fields[\"item\"][1:]\n\t}\n\n\tctx.addInDatabase(\"items\", itemKey, dbFields)\n}", "func (c *directClient) PostEntry(ctx context.Context, entry *disc.Entry) error {\n\tc.mx.Lock()\n\tdefer c.mx.Unlock()\n\tc.entries[entry.Static] = entry\n\treturn nil\n}", "func (d *Dump) Add(item Item) (int, error) {\n\td.mutex.Lock()\n\tdefer d.mutex.Unlock()\n\n\td.items = append(d.items, item)\n\n\tif d.persist == PERSIST_WRITES {\n\t\treturn len(d.items) - 1, d.save()\n\t}\n\n\treturn len(d.items) - 1, nil\n}", "func AddCheckpoint(name string, path string) error {\n walk, err := FetchCheckpoint(name)\n if len(walk) > 0 {\n return errors.New(\"jump: Checkpoint already exists\")\n }\n\n db, err := GetDatabase()\n if err != nil {\n return err\n }\n\n defer db.Close()\n\n err = db.Put([]byte(name), []byte(path), nil)\n if err != nil {\n return err\n }\n\n return nil\n}", "func (t *FakeObjectTracker) Add(obj runtime.Object) error {\n\tif t.fakingOptions.failAll != nil {\n\t\terr := t.fakingOptions.failAll.RunFakeInvocations()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn t.delegatee.Add(obj)\n}", "func (d *Deployer) AddEntry(name, value string) (*r.ChangeResourceRecordSetsResponse, error) {\n\tif !strings.HasPrefix(name, \"_dnslink.\") {\n\t\treturn nil, errors.New(\"invalid dnslink name\")\n\t}\n\tformattedValue := fmt.Sprintf(\"\\\"%s\\\"\", value)\n\treturn d.client.Zone(d.zoneID).Add(\"TXT\", name, formattedValue)\n}", "func AddEntry(storage core.StorageClient) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tvar (\n\t\t\terr error\n\t\t\tentry models.Entry\n\t\t)\n\n\t\terr = c.Bind(&entry)\n\t\tif err != nil {\n\t\t\tc.Status(http.StatusBadRequest)\n\n\t\t\treturn\n\t\t}\n\n\t\tentry.Id = uuid.New().String()\n\n\t\terr = storage.Add(entry)\n\t\tif err != nil {\n\t\t\tvar storageError *core.StorageError\n\n\t\t\tif errors.As(err, &storageError) {\n\t\t\t\tc.Status(storageError.StatusCode())\n\t\t\t} else {\n\t\t\t\tc.Status(http.StatusInternalServerError)\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\tc.JSON(http.StatusCreated, entry)\n\t}\n}", "func (d *db) SaveEntry(e *Entry) error {\n\te.Start = e.Start.Truncate(time.Second)\n\te.End = e.End.Truncate(time.Second)\n\terr := e.Valid()\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar insert bool\n\tif insert = e.ID == \"\"; insert {\n\t\te.ID = uuid.NewRandom().String()\n\t}\n\tvar start, end interface{}\n\tstart = e.Start.Format(datetimeLayout)\n\tif !e.End.IsZero() {\n\t\tend = e.End.Format(datetimeLayout)\n\t}\n\tcategoryID := sql.NullString{String: e.CategoryID, Valid: e.CategoryID != \"\"}\n\tq := \"INSERT INTO entries (id, start, end, note, category_id) VALUES (?, ?, ?, ?, ?)\"\n\targs := []interface{}{e.ID, start, end, e.Note, categoryID}\n\tif !insert {\n\t\tq = \"UPDATE entries SET id=?, start=?, end=?, note=?, category_id=? WHERE id=?\"\n\t\targs = append(args, e.ID)\n\t}\n\t_, err = d.Exec(q, args...)\n\treturn err\n}", "func (d *DbHandle) AddEvent(n NotifRec) error {\n\t// convert hub time to UTC\n\tn.EvTime = time.Unix(n.EvTime, 0).Unix()\n\tlog.WithField(\"rec\", n).Debug(\"insert record\")\n\t_, err := d.addStmt.Exec(n.Device, n.EvTime, n.Event, n.Value, n.Description)\n\treturn err\n}", "func AddWatchdog(iWid int64, iUid int, iType string, iMessage string, iVariables []byte, iSeverity int, iLink string, iLocation string, iReferer string, iHostname string, iTimestamp int) error {\n\t_Watchdog := &Watchdog{Wid: iWid, Uid: iUid, Type: iType, Message: iMessage, Variables: iVariables, Severity: iSeverity, Link: iLink, Location: iLocation, Referer: iReferer, Hostname: iHostname, Timestamp: iTimestamp}\n\tif _, err := Engine.Insert(_Watchdog); err != nil {\n\t\treturn err\n\t} else {\n\t\treturn nil\n\t}\n}", "func (c *PumpsClient) addPump(pump *PumpStatus, updateSelector bool) {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tif pump.ShouldBeUsable() {\n\t\tc.Pumps.AvaliablePumps[pump.NodeID] = pump\n\t} else {\n\t\tc.Pumps.UnAvaliablePumps[pump.NodeID] = pump\n\t}\n\tc.Pumps.Pumps[pump.NodeID] = pump\n\n\tif updateSelector {\n\t\tc.Selector.SetPumps(copyPumps(c.Pumps.AvaliablePumps))\n\t}\n}", "func (s *Store) Add(ctx context.Context, key interface{}, v json.Marshaler) error {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tdefault:\n\t}\n\n\tb, err := v.MarshalJSON()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tdefault:\n\t}\n\n\tif _, ok := s.m[key]; ok {\n\t\treturn store.ErrKeyExists\n\t}\n\n\ts.m[key] = entry{data: b}\n\treturn nil\n}", "func (dao *FilingDaoImpl) Add(filing *model.Filing) (created *model.Filing, existed bool, err error) {\n\tf := filingAsRecord(filing)\n\tres, err := dao.db.Model(f).OnConflict(\"DO NOTHING\").Insert()\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\tif res.RowsAffected() > 0 {\n\t\treturn f.export(), false, nil\n\t}\n\treturn f.export(), true, nil\n}", "func (ps *peerStore) AddDatum(infoHash InfoHash, datum *Datum) bool {\n\tset := ps.Set(infoHash)\n\tif set == nil {\n\t\tset = newValueSet()\n\t}\n\n\treturn set.PutDatum(datum)\n}", "func addTank(gamestate *gamestate, client uint32, team string) {\n\tgamestate.Tanks[client] = initTank(team, gamestate.Terrain)\n\tgamestate.AliveTanks++\n}", "func (aec *AddEntryCmd) Run() error {\n\tif err := aec.Client.AddEntry(aec.entry); err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(\"You've successfully submitted your entry.\")\n\tfmt.Println(\"You can use the get-game command to check the story status.\")\n\treturn nil\n}", "func (g *PitBoss) Add(game Game) {\n\tg.Lock()\n\tdefer g.Unlock()\n\tg.games[game.Id()] = game\n}", "func AddMatchToDatabase(matchID uint64) {\n\tif CheckIfMatchExistsAlready(matchID) {\n\t\treturn\n\t}\n\n\tstmt, errPrepare := db.Prepare(\"insert into matches (id) values (?)\")\n\t_, errExec := stmt.Exec(matchID)\n\n\tif errPrepare == nil && errExec == nil {\n\t\tlog.Printf(\"added match %d to the database\\n\", matchID)\n\t}\n}", "func (duo *DealUpdateOne) AddUID(i int64) *DealUpdateOne {\n\tduo.mutation.AddUID(i)\n\treturn duo\n}", "func (db *DataBase) AddSticker(user *tg.User, sticker *tg.Sticker) (bool, error) {\n\tlog.Ln(\"Trying to add\", sticker.FileID, \"sticker from\", user.ID, \"user\")\n\tif sticker.SetName == \"\" {\n\t\tsticker.SetName = models.SetUploaded\n\t}\n\n\tvar exists bool\n\terr := db.Update(func(tx *buntdb.Tx) error {\n\t\tvar err error\n\t\t_, exists, err = tx.Set(\n\t\t\tfmt.Sprint(\"user:\", user.ID, \":set:\", sticker.SetName, \":sticker:\", sticker.FileID), // key\n\t\t\tsticker.Emoji, // value\n\t\t\tnil, // options\n\t\t)\n\t\tif err == buntdb.ErrIndexExists {\n\t\t\texists = true\n\t\t\treturn nil\n\t\t}\n\n\t\treturn err\n\t})\n\n\treturn exists, err\n}", "func AddTrack(track *models.Track) {\n\tdb, err := open()\n\tutil.CheckErr(\"AddTrack\", err, true)\n\n\tdefer db.Close()\n\tstmt, err := db.Prepare(\"INSERT INTO tracks values(NULL, ?, ?, ?, ?, ?, ?, ?, ?)\")\n\tutil.CheckErr(\"AddTrack\", err, true)\n\n\th := md5.New()\n\th.Write([]byte(track.Path))\n\thash := hex.EncodeToString(h.Sum(nil))\n\n\t_, err = stmt.Exec(track.TrackNumber,\n\t\ttrack.Name,\n\t\ttrack.AlbumId,\n\t\ttrack.ArtistId,\n\t\ttrack.DiscNumber,\n\t\ttrack.Genre,\n\t\thash,\n\t\ttrack.Path)\n\n\tutil.CheckErr(\"AddTrack\", err, true)\n}", "func (m *Storage) AddRecipe(r adding.Recipe) error {\n\n\tnewR := Recipe{\n\t\tID: len(m.recipes) + 1,\n\t\tCreated: time.Now(),\n\t\tMealType: r.MealType,\n\t\tName: r.Name,\n\t\tIngredients: r.Ingredients,\n\t\tPreparation: r.Preparation,\n\t}\n\tm.recipes = append(m.recipes, newR)\n\n\treturn nil\n}", "func (s *DnsServer) AddEntry(name string, rr dns.RR) {\n\tc := s.NewControllerForName(dns.CanonicalName(name))\n\tc.AddRecords([]dns.RR{rr})\n}", "func (p *Store) AddFK(ctx context.Context) error {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tdefault:\n\t}\n\n\tconst query = `\n\t\tALTER TABLE beacon_details\n\t\tADD CONSTRAINT fk_beacon_id FOREIGN KEY (beacon_id) REFERENCES beacons(id) ON DELETE CASCADE`\n\n\t_, err := p.db.ExecContext(ctx, query)\n\treturn err\n}", "func (r *MongoRepository) add(definition *Definition) error {\n\tsession, coll := r.getSession()\n\tdefer session.Close()\n\n\tisValid, err := definition.Validate()\n\tif false == isValid && err != nil {\n\t\tlog.WithError(err).Error(\"Validation errors\")\n\t\treturn err\n\t}\n\n\t_, err = coll.Upsert(bson.M{\"name\": definition.Name}, definition)\n\tif err != nil {\n\t\tlog.WithField(\"name\", definition.Name).Error(\"There was an error adding the resource\")\n\t\treturn err\n\t}\n\n\tlog.WithField(\"name\", definition.Name).Debug(\"Resource added\")\n\treturn nil\n}", "func (du *DealUpdate) AddUID(i int64) *DealUpdate {\n\tdu.mutation.AddUID(i)\n\treturn du\n}", "func (s *Store) add(id string, e Entry) (err error) {\n\tutils.Assert(!utils.IsSet(e.ID()) || id == e.ID(), \"ID must not be set here\")\n\tif _, exists := (*s)[id]; exists {\n\t\treturn fmt.Errorf(\"Found multiple parameter definitions with id '%v'\", id)\n\t}\n\n\tif !utils.IsSet(e.ID()) {\n\t\te.setID(id)\n\t}\n\t(*s)[id] = e\n\treturn nil\n}", "func addPost(item Post) bool {\n\tdb := getDBInstance()\n\tdefer db.Close()\n\n\tsqlStatement := `INSERT INTO \"Reddit_Posts\" \n\t\t\t\t\t(\"Title\", \"Upvotes\", \"UpvoteRatio\", \"URL\", \"Permalink\", \"Date\", \"Sub_id\")\n\t\t\t\t\tVALUES\n\t\t\t\t\t($1, $2, $3, $4, $5, $6, (SELECT id FROM \"Subreddits\" WHERE \"name\"=$7))`\n\t_, err := db.Exec(sqlStatement,\n\t\titem.Title,\n\t\titem.Upvotes,\n\t\titem.UpvoteRatio,\n\t\titem.URL,\n\t\titem.Permalink,\n\t\titem.Date,\n\t\titem.Sub)\n\n\tif err != nil {\n\t\tfmt.Printf(\"Error adding post: %+v\", err.Error())\n\t\treturn false\n\t}\n\n\treturn true\n}", "func AddGame(g *Game) (err error) {\n\td := db.Create(g)\n\treturn d.Error\n}", "func (s *IdeaStorage) Add(title, description string, userID int) (*models.Idea, error) {\n\ts.lastID = s.lastID + 1\n\tidea := &models.Idea{\n\t\tID: s.lastID,\n\t\tNumber: s.lastID,\n\t\tTitle: title,\n\t\tDescription: description,\n\t}\n\ts.ideas = append(s.ideas, idea)\n\treturn idea, nil\n}", "func (d DeckList) AddCard(card *mtgjson.Card, count int) error {\n\tif card.Name == \"\" {\n\t\treturn fmt.Errorf(\"Card name can't be empty\")\n\t}\n\tif count < 1 {\n\t\treturn fmt.Errorf(\"Card count must be > 0\")\n\t}\n\tif c, ok := d[card.Name]; ok {\n\t\tc.Count = c.Count + count\n\t} else {\n\t\td[card.Name] = &CardEntry{\n\t\t\tCard: card,\n\t\t\tCount: count,\n\t\t}\n\t}\n\tif d[card.Name].Count > 4 && !card.IsBasicLand() {\n\t\td[card.Name].Count = 4\n\t}\n\n\treturn nil\n}", "func AddENCEntry(hostName string, class string, entry Entry, backend gitlab.ENCBackend, force bool) {\n\t// TODO class should be directly injected in the entry array\n\tb := []string{class}\n\tentry.Classes = b\n\n\t// Marshal to yaml\n\tenc, err := yaml.Marshal(entry)\n\tif err != nil {\n\t\tlog.Fatalf(\"error: %v\", err)\n\t}\n\tfileName, err := writeToFile(enc, hostName)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// TODO implement error handling for\n\tgitlab.AddToGitlab(fileName, enc, backend, force)\n}", "func (m *bucketMD) add(bck *cluster.Bck, p *cmn.BucketProps) bool {\n\tcmn.Assert(p != nil)\n\tmm := m.LBmap\n\tif !bck.IsAIS() {\n\t\tmm = m.CBmap\n\t}\n\tp.CloudProvider = bck.Provider\n\tcmn.AssertMsg(cmn.StringInSlice(p.CloudProvider, cmn.Providers), p.CloudProvider)\n\n\tif _, exists := mm[bck.Name]; exists {\n\t\treturn false\n\t}\n\n\tm.Version++\n\tp.BID = m.GenBucketID(bck.IsAIS())\n\tmm[bck.Name] = p\n\tbck.Props = p\n\treturn true\n}", "func (sl *Shortlist) Add(c *contact.Contact) {\n\t// Check if contact already exists\n\tfor _, entry := range sl.Entries {\n\t\tif entry != nil {\n\t\t\tif entry.Contact.ID.Equals(c.ID) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\t// calc distance of new candidate\n\tc.CalcDistance(sl.target)\n\n\tif sl.Len() == k {\n\t\tif c.Less(&sl.Entries[k-1].Contact) {\n\t\t\tsl.Entries[k-1] = &Entry{Contact: *c, Active: false, Probed: false}\n\t\t}\n\t} else {\n\t\tfor i := 0; i < len(sl.Entries); i++ {\n\t\t\tif sl.Entries[i] == nil {\n\t\t\t\tsl.Entries[i] = &Entry{Contact: *c, Active: false, Probed: false}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tsort.Sort(sl)\n\tsl.Closest = &sl.Entries[0].Contact\n}", "func (k Keeper) AddRecord(fields map[string]string) error {\n\t// Ensure keeper commander is installed and\n\t// there is a valid keeper session.\n\tif !k.CommanderInstalled() || !k.LoggedIn() {\n\t\treturn errors.New(\"error: ensure keeper commander is installed \" +\n\t\t\t\"and a valid keeper session is established\")\n\t}\n\n\tconfigPath, err := configPath()\n\tif err != nil {\n\t\treturn errors.New(color.RedString(\n\t\t\t\"failed to retrieve keeper config path\"))\n\t}\n\n\ttitle := fields[\"title\"]\n\tlogin := fields[\"login\"]\n\tpassword := fields[\"password\"]\n\tnotes := fields[\"notes\"]\n\n\t_, err = sys.RunCommand(\"keeper\", \"record-add\", \"--title\", title, \"--login\", login, \"--pass\", password, \"--notes\", notes, \"--config\", configPath)\n\n\treturn err\n}", "func (c *EntryCache) add(e *Entry) error {\n\thashes, err := allHashes(e, c.hashes)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tif _, present := c.entries[e.name]; present {\n\t\t// log or fail...?\n\t\tc.log.Warning(\"[cache] Overwriting cache entry '%s'\", e.name)\n\t} else {\n\t\tc.log.Info(\"[cache] Adding entry for '%s'\", e.name)\n\t}\n\tc.entries[e.name] = e\n\tfor _, h := range hashes {\n\t\tc.lookupMap[h] = e\n\t}\n\treturn nil\n}", "func (v *Virter) addDHCPEntry(mac string, id uint) (net.IP, error) {\n\tnetwork, err := v.libvirt.NetworkLookupByName(v.networkName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not get network: %w\", err)\n\t}\n\n\tipNet, err := v.getIPNet(network)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnetworkBaseIP := ipNet.IP.Mask(ipNet.Mask)\n\tip := addToIP(networkBaseIP, id)\n\n\tif !ipNet.Contains(ip) {\n\t\treturn nil, fmt.Errorf(\"computed IP %v is not in network\", ip)\n\t}\n\n\tlog.Printf(\"Add DHCP entry from %v to %v\", mac, ip)\n\terr = v.libvirt.NetworkUpdate(\n\t\tnetwork,\n\t\t// the following 2 arguments are swapped; see\n\t\t// https://github.com/digitalocean/go-libvirt/issues/87\n\t\tuint32(libvirt.NetworkSectionIPDhcpHost),\n\t\tuint32(libvirt.NetworkUpdateCommandAddLast),\n\t\t-1,\n\t\tfmt.Sprintf(\"<host mac='%s' ip='%v'/>\", mac, ip),\n\t\tlibvirt.NetworkUpdateAffectLive|libvirt.NetworkUpdateAffectConfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not add DHCP entry: %w\", err)\n\t}\n\n\treturn ip, nil\n}", "func dbPutSpendJournalEntry(dbTx database.Tx, blockHash *common.Hash, stxos []txo.SpentTxOut) error {\n\tspendBucket := dbTx.Metadata().Bucket(spendJournalBucketName)\n\tserialized := serializeSpendJournalEntry(stxos)\n\treturn spendBucket.Put(blockHash[:], serialized)\n}", "func AddGame(m *Game) (id int64, err error) {\n\to := orm.NewOrm()\n\tid, err = o.Insert(m)\n\treturn\n}", "func (d *DogNZB) Add(t Type, id string) error {\n\tb, err := d.get(d.buildURL(\"add\", t, id))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar q AddRemoveQuery\n\tif err := xml.Unmarshal(b, &q); err != nil {\n\t\treturn err\n\t}\n\n\t// if dognzb sent an error back, we should also error\n\tif q.ErrorCode != \"\" {\n\t\treturn fmt.Errorf(\"%v\", q.ErrorDesc)\n\t}\n\treturn nil\n}", "func (d *Die) Add(r Roller) {\n\tpanic(\"impossible action\")\n}", "func (c *UsageController) Add(recipeID int64, userID int64) error {\n\tc.Usage = append(c.Usage, models.Usage{\n\t\tID: c.getNewID(),\n\t\tRecipeID: recipeID,\n\t\tDate: time.Now(),\n\t\tUserID: userID,\n\t})\n\n\treturn nil\n}", "func _addDesk(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tvar responseBody []byte\n\tbody ,err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tvar desk Desk\n\terr = json.Unmarshal(body, &desk)\n\n\tif err != nil {\n\t\tresponseBody, _ = json.Marshal(HttpResponse{\"code\": 500, \"details\": http.StatusInternalServerError, \"error\": err.Error() })\n\t\tw.Write(responseBody)\n\t\treturn\n\t}\n\tdesk.Health = \"false\"\n\t_, err = addDesk(desk)\n\n\tif err == nil {\n\t\tresponseBody, _ = json.Marshal(HttpResponse{\"code\": 200, \"details\": \"added Desk successfully\", \"error\": \"\" })\n\t} else {\n\t\tresponseBody, _ = json.Marshal(HttpResponse{\"code\": 500, \"details\": http.StatusInternalServerError, \"error\": err.Error() })\n\t}\n\tw.Write(responseBody)\n}", "func storeRunEntry(ah *AppContext, entry RunEntry) error {\n\tlog.Debug(\"Entered storeRunEntry\")\n\trecord, err := json.Marshal(entry)\n\tif err != nil {\n\t\tlog.Debug(\"json.Marshal result: \" + err.Error())\n\t\treturn errors.Wrap(err, \"storeRunEntry:json.Marshal\")\n\t}\n\terr = ah.burnerLogDB.Update(func(tx *bolt.Tx) error {\n\t\terr := tx.Bucket([]byte(\"times\")).Put([]byte(time.Now().UTC().Format(time.RFC3339)), record)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"storeRunEntry:DBPut\")\n\t\t}\n\t\treturn nil\n\t})\n\tlog.Info(\"Logged run time\")\n\treturn err\n\t/* TODO: Look at Update error handling */\n}", "func (router *Router) AddEntry(origin, address string, onlyIfNotExists bool) bool {\n\toldValue, found := router.GetAddress(origin)\n\tisNew := false\n\tif !found || (!onlyIfNotExists && oldValue.String() != address) {\n\t\tisNew = true\n\t\tnewEntry := utils.PeerAddress{}\n\t\terr := newEntry.Set(address)\n\t\tif err != nil {\n\t\t\tlogger.Logw(\"Error updating router entry\")\n\t\t\treturn false\n\t\t}\n\t\trouter.setEntry(origin, newEntry)\n\t}\n\treturn isNew\n}", "func (c *Crud) AddCrud() {\n\tdb.Local.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(crudBucket))\n\t\tid, _ := b.NextSequence()\n\t\tc.ID = int(id)\n\n\t\t// Marshal user data into bytes.\n\t\tbuf, err := json.Marshal(c)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Persist bytes to users bucket.\n\t\treturn b.Put(Itob(c.ID), buf)\n\t})\n}", "func AddChequera(m *Chequera) (id int64, err error) {\n\to := orm.NewOrm()\n\tid, err = o.Insert(m)\n\treturn\n}", "func (s *Service) addHotRecheck() (err error) {\n\tvar (\n\t\tc = context.TODO()\n\t\taids []int64\n\t)\n\tif aids, err = s.dataDao.HotArchive(c); err != nil {\n\t\tlog.Error(\"s.addHotRecheck() s.dataDao.HotArchive() error(%v)\", err)\n\t\treturn\n\t}\n\tif err = s.arc.AddRecheckAids(c, archive.TypeHotRecheck, aids, true); err != nil {\n\t\tlog.Error(\"s.addHotRecheck() s.arc.AddRecheckAids error(%v)\", err)\n\t\treturn\n\t}\n\treturn\n}", "func (ctx *TestContext) addAttempt(item, participant string) {\n\titemID := ctx.getReference(item)\n\tparticipantID := ctx.getReference(participant)\n\n\tctx.addInDatabase(\n\t\t`attempts`,\n\t\tstrconv.FormatInt(itemID, 10)+\",\"+strconv.FormatInt(participantID, 10),\n\t\tmap[string]interface{}{\n\t\t\t\"id\": itemID,\n\t\t\t\"participant_id\": participantID,\n\t\t},\n\t)\n}" ]
[ "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.4814617", "0.48040637", "0.48034087", "0.4790899", "0.47899383", "0.4784528", "0.47734612", "0.47672915", "0.4747984", "0.47311836", "0.47209084", "0.4717417", "0.4712311", "0.4707337", "0.4689694", "0.46675462", "0.46612296", "0.46287498", "0.46272677", "0.4622585", "0.4615375", "0.45951933", "0.4592341", "0.45872763", "0.45851734", "0.45850188", "0.45845237", "0.45840186", "0.45820192", "0.45805866", "0.4577319", "0.4572543", "0.45711485", "0.4570993", "0.45664838", "0.4561334", "0.45584294", "0.45579484", "0.4553075", "0.4552457", "0.45481542", "0.4538418", "0.45360163", "0.45323944", "0.45238355", "0.45233604", "0.45232245", "0.45195666", "0.4517703", "0.45077237", "0.45076135", "0.45034474", "0.44962934", "0.44958612", "0.4494323", "0.4491181", "0.44908607", "0.4483609", "0.44798175", "0.4479574", "0.44771066", "0.4472096", "0.4471615", "0.44595358", "0.4455949", "0.44554827", "0.44465864", "0.44420514", "0.4439969", "0.44392395", "0.44333476", "0.4422388", "0.44221455", "0.4412192", "0.4410149", "0.440966", "0.4396806", "0.4396506", "0.43939546", "0.43926167" ]
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\", \"application/json; charset=utf-8\")\n\te := json.NewEncoder(w)\n\te.SetIndent(\"\", \"\\t\")\n\terr = e.Encode(response)\n\treturn err\n}", "func encodeAddResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeAddResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func (res *AddResponse) Encode(_ context.Context, w ResponseWriter) error {\n\treturn w.WriteError(ldaputil.ApplicationAddResponse, errors.New(\"not implemented\"))\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeRegisterResponse(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.(int)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusCreated)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeStationMetaResponse(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.(*sensor.StationMetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func DecodeAddResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error) {\n\treturn func(resp *http.Response) (any, error) {\n\t\tif restoreBody {\n\t\t\tb, err := io.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresp.Body = io.NopCloser(bytes.NewBuffer(b))\n\t\t\tdefer func() {\n\t\t\t\tresp.Body = io.NopCloser(bytes.NewBuffer(b))\n\t\t\t}()\n\t\t} else {\n\t\t\tdefer resp.Body.Close()\n\t\t}\n\t\tswitch resp.StatusCode {\n\t\tcase http.StatusCreated:\n\t\t\tvar (\n\t\t\t\tbody string\n\t\t\t\terr error\n\t\t\t)\n\t\t\terr = decoder(resp).Decode(&body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, goahttp.ErrDecodingError(\"storage\", \"add\", err)\n\t\t\t}\n\t\t\treturn body, nil\n\t\tdefault:\n\t\t\tbody, _ := io.ReadAll(resp.Body)\n\t\t\treturn nil, goahttp.ErrInvalidResponse(\"storage\", \"add\", resp.StatusCode, string(body))\n\t\t}\n\t}\n}", "func (t AddOffsetsToTxnResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\te.PutInt16(t.ErrorCode) // ErrorCode\n}", "func (t RenewDelegationTokenResponse) Encode(e *Encoder, version int16) {\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\te.PutInt64(t.ExpiryTimestampMs) // ExpiryTimestampMs\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n}", "func (t UpdateMetadataResponse) Encode(e *Encoder, version int16) {\n\te.PutInt16(t.ErrorCode) // ErrorCode\n}", "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\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeListMineResponse(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.StationsFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListMineResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeListMineResponse(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.StationsFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListMineResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeGetResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewGetResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeGetResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewGetResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (t EndTxnResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\te.PutInt16(t.ErrorCode) // ErrorCode\n}", "func (t FindCoordinatorResponse) Encode(e *Encoder, version int16) {\n\tif version >= 1 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\tif version >= 1 {\n\t\te.PutString(t.ErrorMessage) // ErrorMessage\n\t}\n\te.PutInt32(t.NodeId) // NodeId\n\te.PutString(t.Host) // Host\n\te.PutInt32(t.Port) // Port\n}", "func encodeUpdateTagResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\t\tlogrus.Warn(err.Error())\n\t\t}\n\treturn\n}", "func (subr *SRRecordResponse) Encode() (b []byte, err error) {\n\tbuffer := new(bytes.Buffer)\n\tif err = binary.Write(buffer, binary.LittleEndian, subr.ConfirmedRecordNumber); err != nil {\n\t\treturn nil, fmt.Errorf(\"EGTS_SR_RECORD_RESPONSE; Error writing CRN\")\n\t}\n\tif err = buffer.WriteByte(subr.RecordStatus); err != nil {\n\t\treturn nil, fmt.Errorf(\"EGTS_SR_RECORD_RESPONSE; Error writing RST\")\n\t}\n\treturn buffer.Bytes(), nil\n}", "func EncodeEnableResponse(_ 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 (t HeartbeatResponse) Encode(e *Encoder, version int16) {\n\tif version >= 1 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\te.PutInt16(t.ErrorCode) // ErrorCode\n}", "func EncodeCreateResponse(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\tbody := NewCreateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeRemoveResponse(_ 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 encodeGetTagResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\t\tlogrus.Warn(err.Error())\n\t\t}\n\treturn\n}", "func encodeCreateTagResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\t\tlogrus.Warn(err.Error())\n\t\t}\n\treturn\n}", "func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n return json.NewEncoder(w).Encode(response)\n}", "func (t DescribeDelegationTokenResponse) Encode(e *Encoder, version int16) {\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\t// Tokens\n\tlen1 := len(t.Tokens)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Tokens[i].Encode(e, version)\n\t}\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n}", "func encodeGetByIDResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeGetByIDResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func (t CreateDelegationTokenResponse) Encode(e *Encoder, version int16) {\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\te.PutString(t.PrincipalType) // PrincipalType\n\te.PutString(t.PrincipalName) // PrincipalName\n\te.PutInt64(t.IssueTimestampMs) // IssueTimestampMs\n\te.PutInt64(t.ExpiryTimestampMs) // ExpiryTimestampMs\n\te.PutInt64(t.MaxTimestampMs) // MaxTimestampMs\n\te.PutString(t.TokenId) // TokenId\n\te.PutBytes(t.Hmac) // Hmac\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n}", "func encodeRegisterResponse(_ context.Context, r interface{}) (interface{}, error) {\n\trs := r.(endpoint.RegisterResponse)\n\n\tif rs.Err != nil {\n\t\treturn &pb.RegisterReply{\n\t\t\tMessage: rs.Err.Error(),\n\t\t\tStatus: \"ERROR\",\n\t\t}, fmt.Errorf(\"Message: %v With Status: %v\", rs.Err.Error(), rs.Err)\n\t}\n\n\treturn &pb.RegisterReply{\n\t\tMessage: fmt.Sprintf(\"Hi %s %s We Send a SMS for verify your Phone!\", rs.Response.Name, rs.Response.LastName),\n\t\tStatus: \"SUCCESS\",\n\t}, nil\n}", "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\t\tbody := NewListAllResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (t SyncGroupResponse) Encode(e *Encoder, version int16) {\n\tif version >= 1 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\te.PutBytes(t.Assignment) // Assignment\n}", "func encodePutDealStateResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func (t ControlledShutdownResponse) Encode(e *Encoder, version int16) {\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\t// RemainingPartitions\n\tlen1 := len(t.RemainingPartitions)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.RemainingPartitions[i].Encode(e, version)\n\t}\n}", "func EncodeNewNeatThingResponse(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.(*neatthingviews.NeatThing)\n\t\tw.Header().Set(\"goa-view\", res.View)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewNewNeatThingResponseBodyFull(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (t IncrementalAlterConfigsResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t// Responses\n\tlen1 := len(t.Responses)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Responses[i].Encode(e, version)\n\t}\n}", "func encodeGetResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeGetResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif e, ok := response.(errorer); ok && e.error() != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tw.WriteHeader(codeFrom(e.error()))\n\t\treturn marshalStructWithError(response, w)\n\t}\n\n\t// Used for pagination\n\tif e, ok := response.(counter); ok {\n\t\tw.Header().Set(\"X-Total-Count\", strconv.Itoa(e.count()))\n\t}\n\n\t// Don't overwrite a header (i.e. called from encodeTextResponse)\n\tif v := w.Header().Get(\"Content-Type\"); v == \"\" {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\t// Only write json body if we're setting response as json\n\t\treturn json.NewEncoder(w).Encode(response)\n\t}\n\treturn nil\n}", "func (t ExpireDelegationTokenResponse) Encode(e *Encoder, version int16) {\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\te.PutInt64(t.ExpiryTimestampMs) // ExpiryTimestampMs\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n}", "func encodeGetDealByDIDResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeGetDealByStateResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func EncodeAlsoDoublySecureResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(string)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func DecodeAddResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error) {\n\treturn func(resp *http.Response) (interface{}, error) {\n\t\tif restoreBody {\n\t\t\tb, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\tdefer func() {\n\t\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\t}()\n\t\t} else {\n\t\t\tdefer resp.Body.Close()\n\t\t}\n\t\tswitch resp.StatusCode {\n\t\tcase http.StatusCreated:\n\t\t\tvar (\n\t\t\t\tbody AddResponseBody\n\t\t\t\terr error\n\t\t\t)\n\t\t\terr = decoder(resp).Decode(&body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, goahttp.ErrDecodingError(\"blog\", \"add\", err)\n\t\t\t}\n\t\t\tres := NewAddNewCommentCreated(&body)\n\t\t\treturn res, nil\n\t\tdefault:\n\t\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\t\treturn nil, goahttp.ErrInvalidResponse(\"blog\", \"add\", resp.StatusCode, string(body))\n\t\t}\n\t}\n}", "func encodeGetByCreteriaResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeUploadResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\t\tlogrus.Warn(err.Error())\n\t\t}\n\treturn\n}", "func EncodeSecureResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(string)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeDoublySecureResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(string)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (t AddPartitionsToTxnResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t// Results\n\tlen1 := len(t.Results)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Results[i].Encode(e, version)\n\t}\n}", "func EncodeShowResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres := v.(*pipelineviews.EnduroStoredPipeline)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewShowResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (t DescribeLogDirsResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t// Results\n\tlen1 := len(t.Results)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Results[i].Encode(e, version)\n\t}\n}", "func (pkt *SubAddRequest) Encode(buffer *bytes.Buffer) (xID uint32) {\n\txID = XID()\n\tXdrPutInt32(buffer, int32(pkt.ID()))\n\tXdrPutUint32(buffer, xID)\n\tXdrPutString(buffer, pkt.Expression)\n\tXdrPutBool(buffer, pkt.AcceptInsecure)\n\tXdrPutKeys(buffer, pkt.Keys)\n\n\treturn\n}", "func EncodeResolveResponse(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.(*sensorviews.SavedBookmark)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewResolveResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeBasicResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\") //允许访问所有域\n\tw.Header().Add(\"Access-Control-Allow-Headers\", \"Origin, Content-Type, Authorization, tk, encrypt, authorization, platform\") //自定义header头\n\tw.Header().Set(\"Access-Control-Allow-Credentials\", \"true\") //允许\n\tw.Header().Add(\"Access-Control-Allow-Methods\", \"GET, POST, OPTIONS\") //允许接受\n\tw.Header().Set(\"Content-Type\", \"application/json;charset=utf-8\")\n\tif f, ok := response.(endpoint.Failer); ok && f.Failed() != nil {\n\t\tbusinessErrorEncoder(f.Failed(), w)\n\t\treturn nil\n\t}\n\n\treturn json.NewEncoder(w).Encode(response)\n}", "func (t AlterReplicaLogDirsResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t// Results\n\tlen1 := len(t.Results)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Results[i].Encode(e, version)\n\t}\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tresp := response.(*common.XmidtResponse)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Header().Set(common.HeaderWPATID, ctx.Value(common.ContextKeyRequestTID).(string))\n\tcommon.ForwardHeadersByPrefix(\"\", resp.ForwardedHeaders, w.Header())\n\n\tw.WriteHeader(resp.Code)\n\t_, err = w.Write(resp.Body)\n\treturn\n}", "func encodeStringResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tw.Header().Set(\"Content-Type\", \"application/json;charset=utf-8\")\n\treturn json.NewEncoder(w).Encode(response)\n}", "func NewAddHandler(\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.Handler {\n\tvar (\n\t\tdecodeRequest = DecodeAddRequest(mux, decoder)\n\t\tencodeResponse = EncodeAddResponse(encoder)\n\t\tencodeError = EncodeAddError(encoder, formatter)\n\t)\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get(\"Accept\"))\n\t\tctx = context.WithValue(ctx, goa.MethodKey, \"add\")\n\t\tctx = context.WithValue(ctx, goa.ServiceKey, \"station\")\n\t\tpayload, err := decodeRequest(r)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tres, err := endpoint(ctx, payload)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif err := encodeResponse(ctx, w, res); err != nil {\n\t\t\terrhandler(ctx, w, err)\n\t\t}\n\t})\n}", "func (t ListOffsetResponse) Encode(e *Encoder, version int16) {\n\tif version >= 2 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\t// Topics\n\tlen1 := len(t.Topics)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Topics[i].Encode(e, version)\n\t}\n}", "func EncodeSigninResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(*securedservice.Creds)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewSigninResponseBody(res)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeLoginResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(string)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeCalculatorResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif e, ok := response.(errorer); ok && e.error() != nil {\n\t\t// Not a Go kit transport error, but a business-logic error.\n\t\t// Provide those as HTTP errors.\n\t\tencodeError(ctx, e.error(), w)\n\t\treturn nil\n\t}\n\n\t// fmt.Println(ctx)\n\tfmt.Println(response)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\treturn json.NewEncoder(w).Encode(response)\n}", "func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\treturn json.NewEncoder(w).Encode(response)\n}", "func EncodePostResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(*tus.PostResult)\n\t\tw.Header().Set(\"Location\", res.Location)\n\t\tw.Header().Set(\"Tus-Resumable\", res.TusResumable)\n\t\t{\n\t\t\tval := res.UploadOffset\n\t\t\tuploadOffsets := strconv.FormatInt(val, 10)\n\t\t\tw.Header().Set(\"Upload-Offset\", uploadOffsets)\n\t\t}\n\t\tif res.UploadExpires != nil {\n\t\t\tw.Header().Set(\"Upload-Expires\", *res.UploadExpires)\n\t\t}\n\t\tw.WriteHeader(http.StatusCreated)\n\t\treturn nil\n\t}\n}", "func encodeRegisterResponse(_ context.Context, r interface{}) (interface{}, error) {\n\tresponse := r.(endpoint.RegisterResponse)\n\tif response.U0 == nil {\n\t\treturn nil,response.E1\n\t}\n\t//进行数据的转换\n\tvar user = &pb.UserInfo{\n\t\tId:response.U0.Id,\n\t\tPhone:response.U0.Phone,\n\t\tPassword:response.U0.Password,\n\t\tAge:response.U0.Age,\n\t}\n\treturn &pb.RegisterReply{\n\t\tUser:user,\n\t},response.E1\n\n}", "func EncodeSealStatusResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tresp := response.(endpoints.SealStatusResponse)\n\n\tstatus := &pb.SealStatus{\n\t\tSealed: resp.Sealed,\n\t\tT: uint32(resp.T),\n\t\tN: uint32(resp.N),\n\t\tProgress: uint32(resp.Progress),\n\t\tVersion: resp.Version,\n\t\tClusterName: resp.ClusterName,\n\t\tClusterId: resp.ClusterID,\n\t}\n\treturn &pb.SealStatusResponse{\n\t\tSealStatus: status,\n\t\tErr: service.Error2String(resp.Err),\n\t}, nil\n}", "func EncodeDeleteResponse(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.SuccessResult)\n\t\tctx = context.WithValue(ctx, goahttp.ContentTypeKey, \"application/json\")\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewDeleteResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif e, ok := response.(errorer); ok && e.error() != nil {\n\t\tEncodeError(ctx, e.error(), w)\n\t\treturn nil\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\treturn nil\n}", "func encodeResponse(w http.ResponseWriter, resp interface{}) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(resp)\n}", "func EncodeAddRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, any) error {\n\treturn func(req *http.Request, v any) error {\n\t\tp, ok := v.(*storage.Bottle)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"storage\", \"add\", \"*storage.Bottle\", v)\n\t\t}\n\t\tbody := NewAddRequestBody(p)\n\t\tif err := encoder(req).Encode(&body); err != nil {\n\t\t\treturn goahttp.ErrEncodingError(\"storage\", \"add\", err)\n\t\t}\n\t\treturn nil\n\t}\n}", "func EncodeMetaResponse(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.(*sensor.MetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (t AlterConfigsResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t// Responses\n\tlen1 := len(t.Responses)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Responses[i].Encode(e, version)\n\t}\n}", "func (t ResponseHeader) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.CorrelationId) // CorrelationId\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\t// Set JSON type\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\t// Check error\n\tif e, ok := response.(errorer); ok {\n\t\t// This is a errorer class, now check for error\n\t\tif err := e.error(); err != nil {\n\t\t\tencodeError(ctx, e.error(), w)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// cast to dataHolder to get Data, otherwise just encode the resposne\n\tif holder, ok := response.(dataHolder); ok {\n\t\treturn json.NewEncoder(w).Encode(holder.getData())\n\t} else {\n\t\treturn json.NewEncoder(w).Encode(response)\n\t}\n}", "func encodePostAcceptDealResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeUpdatePostResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\t\tlogrus.Warn(err.Error())\n\t\t}\n\treturn\n}", "func EncodeStartResponse(_ 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 EncodeProcessingResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.([]string)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (t MetadataResponse) Encode(e *Encoder, version int16) {\n\tif version >= 3 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\t// Brokers\n\tlen1 := len(t.Brokers)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Brokers[i].Encode(e, version)\n\t}\n\tif version >= 2 {\n\t\te.PutString(t.ClusterId) // ClusterId\n\t}\n\tif version >= 1 {\n\t\te.PutInt32(t.ControllerId) // ControllerId\n\t}\n\t// Topics\n\tlen4 := len(t.Topics)\n\te.PutArrayLength(len4)\n\tfor i := 0; i < len4; i++ {\n\t\tt.Topics[i].Encode(e, version)\n\t}\n\tif version >= 8 {\n\t\te.PutInt32(t.ClusterAuthorizedOperations) // ClusterAuthorizedOperations\n\t}\n}", "func CorporateCreateTicketEncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tvar body []byte\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type,Authorization\")\n\tbody, err := json.Marshal(&response)\n\tlogger.Logf(\"CorporateCreateTicketEncodeResponse : %s\", string(body[:]))\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//w.Header().Set(\"X-Checksum\", cm.Cksum(body))\n\n\tvar e = response.(dt.CorporateCreateTicketJSONResponse).ResponseCode\n\n\tif e <= dt.HeaderStatusOk {\n\t\tw.WriteHeader(http.StatusOK)\n\t} else if e <= dt.StatusBadRequest {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t} else if e <= 998 {\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t} else {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t}\n\n\t_, err = w.Write(body)\n\n\treturn err\n}", "func (t TxnOffsetCommitResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t// Topics\n\tlen1 := len(t.Topics)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Topics[i].Encode(e, version)\n\t}\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\treturn json.NewEncoder(w).Encode(response)\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\treturn json.NewEncoder(w).Encode(response)\n}", "func encodeCreateUserResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func (resp *FailoverLogResponse) Encode() (data []byte, err error) {\n\treturn proto.Marshal(resp)\n}", "func encodeCreatePostResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\tlogrus.Warn(err.Error())\n\t}\n\treturn\n}", "func (t ProduceResponse) Encode(e *Encoder, version int16) {\n\t// Responses\n\tlen0 := len(t.Responses)\n\te.PutArrayLength(len0)\n\tfor i := 0; i < len0; i++ {\n\t\tt.Responses[i].Encode(e, version)\n\t}\n\tif version >= 1 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n}", "func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\n\tif e, ok := response.(Errorer); ok {\n\t\t// Not a Go kit transport error, but a business-logic error.\n\t\t// Provide those as HTTP errors.\n\t\tEncodeError(ctx, e.Error, w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tw.WriteHeader(http.StatusOK)\n\treturn json.NewEncoder(w).Encode(response)\n}", "func (t InitProducerIdResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\te.PutInt64(t.ProducerId) // ProducerId\n\te.PutInt16(t.ProducerEpoch) // ProducerEpoch\n}", "func EncodeProgressResponse(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.StationProgress)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewProgressResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeSCEPResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tresp := response.(SCEPResponse)\n\tif resp.Err != nil {\n\t\thttp.Error(w, resp.Err.Error(), http.StatusInternalServerError)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", contentHeader(resp.operation, resp.CACertNum))\n\tw.Write(resp.Data)\n\treturn nil\n}", "func (t ApiVersionsResponse) Encode(e *Encoder, version int16) {\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\t// ApiKeys\n\tlen1 := len(t.ApiKeys)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.ApiKeys[i].Encode(e, version)\n\t}\n\tif version >= 1 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n}", "func (res *ModifyDNResponse) Encode(_ context.Context, w ResponseWriter) error {\n\treturn w.WriteError(ldaputil.ApplicationModifyDNResponse, errors.New(\"not implemented\"))\n}", "func (t DeleteTopicsResponse) Encode(e *Encoder, version int16) {\n\tif version >= 1 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\t// Responses\n\tlen1 := len(t.Responses)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Responses[i].Encode(e, version)\n\t}\n}", "func encodeGenericResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\treturn json.NewEncoder(w).Encode(response)\n}" ]
[ "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.5703823", "0.5684152", "0.56803113", "0.5653751", "0.5652826", "0.56512725", "0.5644743", "0.562579", "0.56253517", "0.56245905", "0.56245905", "0.56133336", "0.56100184", "0.5582694", "0.5577266", "0.5558321", "0.5547824", "0.55324167", "0.55251974", "0.5524593", "0.5524593", "0.55210453", "0.55168724", "0.55101746", "0.55068284", "0.55028766", "0.5488917", "0.54841936", "0.547961", "0.54709536", "0.5456986", "0.5440956", "0.54108435", "0.5402926", "0.53896374", "0.5376997", "0.5374607", "0.5366667", "0.5357487", "0.5354177", "0.53421396", "0.5336984", "0.53306705", "0.5321726", "0.5312924", "0.531161", "0.5307164", "0.53062177", "0.5303961", "0.53004223", "0.529844", "0.529443", "0.5288446", "0.5283017", "0.5282189", "0.5281534", "0.5279385", "0.5271821", "0.52685106", "0.5267079", "0.52625334", "0.52572376", "0.525491", "0.5252738", "0.52503824", "0.52503824", "0.5248598", "0.52403194", "0.52385473", "0.5222854", "0.5213641", "0.521344", "0.52111375", "0.521091", "0.5210214", "0.52084184", "0.5207561", "0.5207375" ]
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\trequest := dto.AddRequest{}\n\terr := json.Unmarshal(data, &request)\n\tif err != nil {\n\t\treturn dto.BasicRequest{}, err\n\t}\n\treturn dto.BasicRequest{Path: \"Add\", RequestId: \"xxx\", Request: request}, nil\n}", "func decodeAddRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.AddRequest{\n\t\tio.Department{\n\t\t\tDepartmentName: r.FormValue(\"DepartmentName\"),\n\t\t},\n\t}\n\treturn req, nil\n}", "func decodeAddRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\tzip, _ := strconv.Atoi(r.FormValue(\"ZipCode\"))\n\ttel, _ := strconv.Atoi(r.FormValue(\"EmployeeNumTel\"))\n\tEmergencyTel, _ := strconv.Atoi(r.FormValue(\"EmergencyContactTel\"))\n\tsalary, _ := strconv.ParseFloat(r.FormValue(\"EmployeeSalary\"), 32)\n\tiban, _ := strconv.Atoi(r.FormValue(\"EmployeeIban\"))\n\tbic, _ := strconv.Atoi(r.FormValue(\"EmployeeBic\"))\n\treq := endpoint.AddRequest{\n\t\tio.Employee{\n\t\t\tEmployeeName: r.FormValue(\"EmployeeName\"),\n\t\t\tEmployeeEmail: r.FormValue(\"EmployeeEmail\"),\n\t\t\tAddress: r.FormValue(\"Address\"),\n\t\t\tZipCode: zip,\n\t\t\tEmployeeBirthDate: r.FormValue(\"EmployeeBirthDate\"),\n\t\t\tEmployeeNumTel: tel,\n\t\t\tEmergencyContactName: r.FormValue(\"EmergencyContactName\"),\n\t\t\tEmergencyContactTel: EmergencyTel,\n\t\t\tEmployeeStartDate: r.FormValue(\"EmployeeStartDate\"),\n\t\t\tEmployeeSalary: salary,\n\t\t\tEmployeeIban: iban,\n\t\t\tEmployeeBic: bic,\n\t\t},\n\t}\n\treturn req, nil\n}", "func (pkt *SubAddRequest) Decode(bytes []byte) (err error) {\n\tvar used int\n\toffset := 4 // header\n\n\tpkt.XID, used, err = XdrGetUint32(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.Expression, used, err = XdrGetString(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.AcceptInsecure, used, err = XdrGetBool(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.Keys, used, err = XdrGetKeys(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\treturn nil\n}", "func DecodeAddReq(c context.Context, r *http.Request) (interface{}, error) {\n\tvar req addReq\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 != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func DecodeAddFlagRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tparams := mux.Vars(r)\n\tgameId, ok := params[\"gameId\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"Bad routing, game id not provided\")\n\t}\n\tvar request model.PickCellRequest\n\tif err := json.NewDecoder(r.Body).Decode(&request); err != nil {\n\t\treturn nil, err\n\t}\n\trequest.GameId = gameId\n\treturn request, nil\n}", "func DecodeAddRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) kithttp.DecodeRequestFunc {\n\tdec := server.DecodeAddRequest(mux, decoder)\n\treturn func(ctx context.Context, r *http.Request) (interface{}, error) {\n\t\tr = r.WithContext(ctx)\n\t\treturn dec(r)\n\t}\n}", "func DecodeRemoveRequest(_ context.Context, r *http.Request) (req interface{}, err error) {\n\treq = endpoints.RemoveRequest{Id: mux.Vars(r)[\"id\"]}\n\t//err = json.NewDecoder(r.Body).Decode(&r)\n\treturn req, err\n}", "func (t *AddOffsetsToTxnRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TransactionalId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerId, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerEpoch, err = d.Int16()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.GroupId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func (pkt *SubDelRequest) Decode(bytes []byte) (err error) {\n\tvar used int\n\toffset := 4 // header\n\n\tpkt.XID, used, err = XdrGetUint32(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.SubID, used, err = XdrGetInt64(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\treturn nil\n}", "func decodeHTTPSumRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvar req endpoints.SumRequest\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func (t *AddPartitionsToTxnRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TransactionalId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerId, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerEpoch, err = d.Int16()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]AddPartitionsToTxnTopic24, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item AddPartitionsToTxnTopic24\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func DecodeDeleteRequest(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\tauth string\n\t\t\terr error\n\n\t\t\tparams = mux.Vars(r)\n\t\t)\n\t\t{\n\t\t\tstationIDRaw := params[\"stationId\"]\n\t\t\tv, err2 := strconv.ParseInt(stationIDRaw, 10, 32)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"stationID\", stationIDRaw, \"integer\"))\n\t\t\t}\n\t\t\tstationID = int32(v)\n\t\t}\n\t\tauth = r.Header.Get(\"Authorization\")\n\t\tif auth == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewDeletePayload(stationID, auth)\n\t\tif strings.Contains(payload.Auth, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Auth, \" \", 2)[1]\n\t\t\tpayload.Auth = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func decodePostAcceptDealRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.PostAcceptDealRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func (t *RenewDelegationTokenRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.Hmac, err = d.Bytes()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.RenewPeriodMs, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func decodeHTTPConcatRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvar req endpoints.ConcatRequest\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func decodeCalculatorRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\n\ta, ok := vars[\"a\"]\n\tif !ok {\n\t\treturn nil, ErrBadRouting\n\t}\n\n\tb, ok := vars[\"b\"]\n\tif !ok {\n\t\treturn nil, ErrBadRouting\n\t}\n\n\taint, _ := strconv.Atoi(a)\n\tbint, _ := strconv.Atoi(b)\n\treturn CalculatorRequest{\n\t\tA: aint,\n\t\tB: bint,\n\t}, nil\n}", "func (t *CreateDelegationTokenRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\t// Renewers\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Renewers = make([]CreatableRenewers38, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item CreatableRenewers38\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Renewers[i] = item\n\t\t}\n\t}\n\tt.MaxLifetimeMs, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func (t *FindCoordinatorRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.Key, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 1 {\n\t\tt.KeyType, err = d.Int8()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "func (t *ExpireDelegationTokenRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.Hmac, err = d.Bytes()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ExpiryTimePeriodMs, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func (pkt *SubModRequest) Decode(bytes []byte) (err error) {\n\tvar used int\n\toffset := 4 // header\n\n\tpkt.XID, used, err = XdrGetUint32(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.SubID, used, err = XdrGetInt64(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.Expression, used, err = XdrGetString(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.AcceptInsecure, used, err = XdrGetBool(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.AddKeys, used, err = XdrGetKeys(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.DelKeys, used, err = XdrGetKeys(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\treturn nil\n}", "func DecodeRequest[I any](ctx context.Context, r *http.Request) (in I, err error) {\n\tswitch r.Method {\n\tcase \"POST\", \"PUT\", \"PATCH\":\n\t\terr = magic.Decode(r, &in,\n\t\t\tmagic.JSON,\n\t\t\tmagic.ChiRouter,\n\t\t)\n\tcase \"GET\", \"DELETE\":\n\t\terr = magic.Decode(r, &in,\n\t\t\tmagic.QueryParams,\n\t\t\tmagic.ChiRouter,\n\t\t)\n\tdefault:\n\t\terr = errors.Errorf(\"method %s not supported\", r.Method)\n\t}\n\n\tif err == io.EOF {\n\t\terr = errors.New(\"empty body\")\n\t}\n\n\treturn in, errors.E(err, \"can not unmarshal request\", errors.Unmarshal)\n}", "func decodeCreateTagRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.CreateTagRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func decodeDeleteRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\tid, ok := vars[\"id\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"not a valid ID\")\n\t}\n\treq := endpoint.DeleteRequest{\n\t\tId: id,\n\t}\n\treturn req, nil\n}", "func decodeDeleteRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\tid, ok := vars[\"id\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"not a valid ID\")\n\t}\n\treq := endpoint.DeleteRequest{\n\t\tId: id,\n\t}\n\treturn req, nil\n}", "func decodeUpdateTagRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.UpdateTagRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func decodeSubRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\tvar req subRequest\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "func decodePutDealStateRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.PutDealStateRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func decodeRegisterRequest(_ context.Context, r interface{}) (interface{}, error) {\n\trq := r.(*pb.RegisterRequest)\n\treturn endpoint.RegisterRequest{\n\t\tUsername: rq.Username,\n\t\tPassword: rq.Password,\n\t\tName: rq.Name,\n\t\tLastName: rq.LastName,\n\t\tPhone: rq.Phone,\n\t\tEmail: rq.Email,\n\t}, nil\n}", "func BuildAddPayload(stationAddBody string, stationAddAuth string) (*station.AddPayload, error) {\n\tvar err error\n\tvar body AddRequestBody\n\t{\n\t\terr = json.Unmarshal([]byte(stationAddBody), &body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid JSON for body, example of valid JSON:\\n%s\", \"'{\\n \\\"device_id\\\": \\\"Aliquam tempora ullam temporibus similique vel in.\\\",\\n \\\"location_name\\\": \\\"Et enim labore.\\\",\\n \\\"name\\\": \\\"Nemo corrupti et non suscipit similique aut.\\\",\\n \\\"status_json\\\": {\\n \\\"Aliquid expedita veniam voluptatem ad.\\\": \\\"Facere atque quam eum recusandae.\\\",\\n \\\"Voluptas amet sint hic accusamus.\\\": \\\"Temporibus a facilis earum ut non accusantium.\\\"\\n },\\n \\\"status_pb\\\": \\\"Exercitationem explicabo quis et omnis delectus sed.\\\"\\n }'\")\n\t\t}\n\t\tif body.StatusJSON == nil {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"status_json\", \"body\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tvar auth string\n\t{\n\t\tauth = stationAddAuth\n\t}\n\tv := &station.AddPayload{\n\t\tName: body.Name,\n\t\tDeviceID: body.DeviceID,\n\t\tLocationName: body.LocationName,\n\t\tStatusPb: body.StatusPb,\n\t}\n\tif body.StatusJSON != nil {\n\t\tv.StatusJSON = make(map[string]interface{}, len(body.StatusJSON))\n\t\tfor key, val := range body.StatusJSON {\n\t\t\ttk := key\n\t\t\ttv := val\n\t\t\tv.StatusJSON[tk] = tv\n\t\t}\n\t}\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func RequestDecode(req *http.Request) (*JWT, error) {\n\treturn decode(req, nil)\n}", "func DecodeSubscribeRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error) {\n\treturn func(r *http.Request) (any, error) {\n\t\tvar (\n\t\t\ttoken string\n\t\t\terr error\n\t\t)\n\t\ttoken = r.Header.Get(\"Authorization\")\n\t\tif token == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"token\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewSubscribePayload(token)\n\t\tif strings.Contains(payload.Token, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Token, \" \", 2)[1]\n\t\t\tpayload.Token = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func decodeRegisterRequest(_ context.Context, r interface{}) (interface{}, error) {\n\treq := r.(*pb.RegisterRequest)\n\t//进行数据的转换\n\tvar user = service.UserInfo{\n\t\tId:req.User.Id,\n\t\tPhone:req.User.Phone,\n\t\tPassword:req.User.Password,\n\t\tAge:req.User.Age,\n\n\t}\n\treturn endpoint.RegisterRequest{\n\t\tUser:user,\n\t},nil\n}", "func (req *FailoverLogRequest) Decode(data []byte) (err error) {\n\treturn proto.Unmarshal(data, req)\n}", "func decodeStringRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\trequestType, ok := vars[\"type\"]\n\tif !ok {\n\t\treturn nil, ErrorBadRequest\n\t}\n\n\tpa, ok := vars[\"a\"]\n\tif !ok {\n\t\treturn nil, ErrorBadRequest\n\t}\n\n\tpb, ok := vars[\"b\"]\n\tif !ok {\n\t\treturn nil, ErrorBadRequest\n\t}\n\n\treturn endpoint.StringRequest{\n\t\tRequestType: requestType,\n\t\tA: pa,\n\t\tB: pb,\n\t}, nil\n}", "func decodeGetDealByDIDRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\tid, ok := vars[\"dId\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"not a valid dId\")\n\t}\n\treq := endpoint.GetDealByDIDRequest{\n\t\tId: id,\n\t}\n\treturn req, nil\n}", "func (r *Route) DecodeRequest(req interface{}) *Route {\n\tr.request = reflect.TypeOf(req)\n\tif r.request.Kind() != reflect.Ptr {\n\t\tpanic(\"request structure must be a pointer\")\n\t}\n\treturn r\n}", "func (t *DeleteAclsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\t// Filters\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Filters = make([]DeleteAclsFilter31, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item DeleteAclsFilter31\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Filters[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func DecodeStationMetaRequest(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\tstations *string\n\t\t)\n\t\tstationsRaw := r.URL.Query().Get(\"stations\")\n\t\tif stationsRaw != \"\" {\n\t\t\tstations = &stationsRaw\n\t\t}\n\t\tpayload := NewStationMetaPayload(stations)\n\n\t\treturn payload, nil\n\t}\n}", "func decodeCreateIndustryRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.CreateIndustryRequest)\n\treturn endpoints.CreateIndustryRequest{Industry: models.IndustryToORM(req.Industry)}, nil\n}", "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 DecodeAddResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error) {\n\treturn func(resp *http.Response) (any, error) {\n\t\tif restoreBody {\n\t\t\tb, err := io.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresp.Body = io.NopCloser(bytes.NewBuffer(b))\n\t\t\tdefer func() {\n\t\t\t\tresp.Body = io.NopCloser(bytes.NewBuffer(b))\n\t\t\t}()\n\t\t} else {\n\t\t\tdefer resp.Body.Close()\n\t\t}\n\t\tswitch resp.StatusCode {\n\t\tcase http.StatusCreated:\n\t\t\tvar (\n\t\t\t\tbody string\n\t\t\t\terr error\n\t\t\t)\n\t\t\terr = decoder(resp).Decode(&body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, goahttp.ErrDecodingError(\"storage\", \"add\", err)\n\t\t\t}\n\t\t\treturn body, nil\n\t\tdefault:\n\t\t\tbody, _ := io.ReadAll(resp.Body)\n\t\t\treturn nil, goahttp.ErrInvalidResponse(\"storage\", \"add\", resp.StatusCode, string(body))\n\t\t}\n\t}\n}", "func (mh *MessageHandler) decodeRequest(httpRequest *http.Request) (deviceRequest *Request, err error) {\n\tdeviceRequest, err = DecodeRequest(httpRequest.Body, mh.Decoders)\n\tif err == nil {\n\t\tdeviceRequest = deviceRequest.WithContext(httpRequest.Context())\n\t}\n\n\treturn\n}", "func decodeRequest(_ context.Context, r *http.Request) (request interface{}, err error) {\n\tdefer r.Body.Close()\n\treturn nil, nil\n}", "func (t *DescribeDelegationTokenRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\t// Owners\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Owners = make([]DescribeDelegationTokenOwner41, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item DescribeDelegationTokenOwner41\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Owners[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func BuildAddPayload(stationAddBody string, stationAddAuth string) (*station.AddPayload, error) {\n\tvar err error\n\tvar body AddRequestBody\n\t{\n\t\terr = json.Unmarshal([]byte(stationAddBody), &body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid JSON for body, \\nerror: %s, \\nexample of valid JSON:\\n%s\", err, \"'{\\n \\\"description\\\": \\\"Provident delectus commodi in.\\\",\\n \\\"deviceId\\\": \\\"Aut nisi iusto architecto.\\\",\\n \\\"locationName\\\": \\\"Ab corrupti dicta est.\\\",\\n \\\"name\\\": \\\"Quas ipsum mollitia laudantium.\\\",\\n \\\"statusPb\\\": \\\"Ex consequatur ipsam.\\\"\\n }'\")\n\t\t}\n\t}\n\tvar auth string\n\t{\n\t\tauth = stationAddAuth\n\t}\n\tv := &station.AddPayload{\n\t\tName: body.Name,\n\t\tDeviceID: body.DeviceID,\n\t\tLocationName: body.LocationName,\n\t\tStatusPb: body.StatusPb,\n\t\tDescription: body.Description,\n\t}\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func (req *AppendEntriesRequest) Decode(r io.Reader) (int, error) {\n\tdata, err := ioutil.ReadAll(r)\n\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\ttotalBytes := len(data)\n\n\tpb := &protobuf.ProtoAppendEntriesRequest{}\n\tif err := proto.Unmarshal(data, pb); err != nil {\n\t\treturn -1, err\n\t}\n\n\treq.Term = pb.GetTerm()\n\treq.PrevLogIndex = pb.GetPrevLogIndex()\n\treq.PrevLogTerm = pb.GetPrevLogTerm()\n\treq.CommitIndex = pb.GetCommitIndex()\n\treq.LeaderName = pb.GetLeaderName()\n\n\treq.Entries = make([]*LogEntry, len(pb.Entries))\n\n\tfor i, entry := range pb.Entries {\n\t\treq.Entries[i] = &LogEntry{\n\t\t\tIndex: entry.GetIndex(),\n\t\t\tTerm: entry.GetTerm(),\n\t\t\tCommandName: entry.GetCommandName(),\n\t\t\tCommand: entry.Command,\n\t\t}\n\t}\n\n\treturn totalBytes, nil\n}", "func decodeDeleteTagRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.DeleteTagRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func (d decoder) Decode(req types.Request, into runtime.Object) error {\n\tdeserializer := d.codecs.UniversalDeserializer()\n\treturn runtime.DecodeInto(deserializer, req.AdmissionRequest.Object.Raw, into)\n}", "func DecodeAddResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error) {\n\treturn func(resp *http.Response) (interface{}, error) {\n\t\tif restoreBody {\n\t\t\tb, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\tdefer func() {\n\t\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\t}()\n\t\t} else {\n\t\t\tdefer resp.Body.Close()\n\t\t}\n\t\tswitch resp.StatusCode {\n\t\tcase http.StatusCreated:\n\t\t\tvar (\n\t\t\t\tbody AddResponseBody\n\t\t\t\terr error\n\t\t\t)\n\t\t\terr = decoder(resp).Decode(&body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, goahttp.ErrDecodingError(\"blog\", \"add\", err)\n\t\t\t}\n\t\t\tres := NewAddNewCommentCreated(&body)\n\t\t\treturn res, nil\n\t\tdefault:\n\t\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\t\treturn nil, goahttp.ErrInvalidResponse(\"blog\", \"add\", resp.StatusCode, string(body))\n\t\t}\n\t}\n}", "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 decodeGetEventsRequest(_ context.Context, r interface{}) (interface{}, error) {\r\n\treturn nil, errors.New(\"'Events' Decoder is not impelemented\")\r\n}", "func decodeCreatePostRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.CreatePostRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func decodeDeleteIndustryRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.DeleteIndustryRequest)\n\treturn endpoints.DeleteIndustryRequest{ID: req.Id}, nil\n}", "func decodeCreateUserRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.CreateUserRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func (t *DeleteTopicsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TopicNames, err = d.StringArray()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.TimeoutMs, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func decodeGetByIDRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\tid, ok := vars[\"id\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"not a valid ID\")\n\t}\n\treq := endpoint.GetByIDRequest{\n\t\tId: id,\n\t}\n\treturn req, nil\n}", "func decodeGetByIDRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\tid, ok := vars[\"id\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"not a valid ID\")\n\t}\n\treq := endpoint.GetByIDRequest{\n\t\tId: id,\n\t}\n\treturn req, nil\n}", "func (t *DescribeAclsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.ResourceType, err = d.Int8()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ResourceNameFilter, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 1 {\n\t\tt.ResourcePatternType, err = d.Int8()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tt.PrincipalFilter, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.HostFilter, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.Operation, err = d.Int8()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.PermissionType, err = d.Int8()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func decodeRequest(r io.Reader) *plugin.CodeGeneratorRequest {\n\tvar req plugin.CodeGeneratorRequest\n\tinput, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\tlog.Fatal(\"unable to read stdin: \" + err.Error())\n\t}\n\tif err := proto.Unmarshal(input, &req); err != nil {\n\t\tlog.Fatal(\"unable to marshal stdin as protobuf: \" + err.Error())\n\t}\n\treturn &req\n}", "func decodeGRPCSumRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.SumRequest)\n\treturn endpoints.SumRequest{A: req.A, B: req.B}, nil\n}", "func (t *ApiVersionsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tif version >= 3 {\n\t\tt.ClientSoftwareName, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif version >= 3 {\n\t\tt.ClientSoftwareVersion, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "func DecodeStartRequest(_ context.Context, r *http.Request) (req interface{}, err error) {\n\treq = endpoints.StartRequest{Id: mux.Vars(r)[\"id\"]}\n\t//err = json.NewDecoder(r.Body).Decode(&r)\n\treturn req, err\n}", "func DecodeListenerRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error) {\n\treturn func(r *http.Request) (any, error) {\n\t\tvar (\n\t\t\ttoken string\n\t\t\terr error\n\t\t)\n\t\ttoken = r.Header.Get(\"Authorization\")\n\t\tif token == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"token\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewListenerPayload(token)\n\t\tif strings.Contains(payload.Token, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Token, \" \", 2)[1]\n\t\t\tpayload.Token = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func decodeGetTagRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.GetTagRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func decodeCreateOrderRequest(_ context.Context, r *stdhttp.Request) (interface{}, error) {\n\treq := dto.CreateOrderRequest{}\n\tdecoder := json.NewDecoder(r.Body)\n\tdecoder.DisallowUnknownFields()\n\terr := decoder.Decode(&req)\n\tif err != nil {\n\t\terr = ce.ErrInvalidReqBody\n\t}\n\treturn req, err\n}", "func (t *InitProducerIdRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TransactionalId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.TransactionTimeoutMs, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func DecodeRegisterRequest(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\tbody RegisterRequestBody\n\t\t\terr error\n\t\t)\n\t\terr = decoder(r).Decode(&body)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\treturn nil, goa.MissingPayloadError()\n\t\t\t}\n\t\t\treturn nil, goa.DecodePayloadError(err.Error())\n\t\t}\n\t\terr = ValidateRegisterRequestBody(&body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar (\n\t\t\tkey string\n\t\t)\n\t\tkey = r.Header.Get(\"Authorization\")\n\t\tif key == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewRegisterPayload(&body, key)\n\n\t\treturn payload, nil\n\t}\n}", "func DecodeRequest(source io.Reader, format wrp.Format) (*Request, error) {\n\tcontents, err := io.ReadAll(source)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// nolint: typecheck\n\tmessage := new(wrp.Message)\n\tif err := wrp.NewDecoderBytes(contents, format).Decode(message); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// nolint: typecheck\n\terr = wrp.UTF8(message)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Request{\n\t\tMessage: message,\n\t\tFormat: format,\n\t\tContents: contents,\n\t}, nil\n}", "func DecodeEnableRequest(_ context.Context, r *http.Request) (req interface{}, err error) {\n\t//req = endpoints.EnableRequest{}\n\t//err = json.NewDecoder(r.Body).Decode(&r)\n\treturn req, err\n}", "func (t *ListOffsetRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.ReplicaId, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 2 {\n\t\tt.IsolationLevel, err = d.Int8()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]ListOffsetTopic2, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item ListOffsetTopic2\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func (t *EndTxnRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TransactionalId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerId, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerEpoch, err = d.Int16()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.Committed, err = d.Bool()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func (msg *GlobalBeginRequest) Decode(buf *goetty.ByteBuf) {\n\tmsg.Timeout = ReadInt(buf)\n\tmsg.TransactionName = ReadString(buf)\n}", "func DecodeQuestionRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n var req QuestionRequest\n err := json.NewDecoder(r.Body).Decode(&req)\n if err != nil {\n return nil, err\n }\n return req, nil\n}", "func decodeDeleteBookRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tbookId, err := parseBookId(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Make request to delete book\n\tvar request deleteBookRequest\n\trequest = deleteBookRequest{\n\t\tBookId: bookId,\n\t}\n\n\treturn request, nil\n}", "func decodeGetByCreteriaRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\n\tvars := mux.Vars(r)\n\tname, ok := vars[\"name\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"not a valid creteria\")\n\t}\n\treq := endpoint.GetByCreteriaRequest{\n\t\tCreteria: name,\n\t}\n\treturn req, nil\n}", "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 != nil {\n\t\treturn nil, err\n\t}\n\n\tsaIDReq, err := decodeServiceAccountIDReq(c, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.ServiceAccountID = saIDReq.ServiceAccountID\n\n\treturn req, nil\n}", "func decodeGetAllIndustriesRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.GetAllIndustriesRequest)\n\tdecoded := endpoints.GetAllIndustriesRequest{\n\t\tID: req.Id,\n\t\tName: req.Name,\n\t}\n\treturn decoded, nil\n}", "func decodeGetRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.GetRequest{}\n\treturn req, nil\n}", "func decodeGetRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.GetRequest{}\n\treturn req, nil\n}", "func (t *ElectLeadersRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tif version >= 1 {\n\t\tt.ElectionType, err = d.Int8()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// TopicPartitions\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.TopicPartitions = make([]TopicPartitions43, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item TopicPartitions43\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.TopicPartitions[i] = item\n\t\t}\n\t}\n\tt.TimeoutMs, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func (t *HeartbeatRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.GroupId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.GenerationId, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.MemberId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 3 {\n\t\tt.GroupInstanceId, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "func DecodeRequest(ctx context.Context, req *http.Request, pathParams map[string]string, queryParams map[string]string) (interface{}, error) {\n\treturn DecodeRequestWithHeaders(ctx, req, pathParams, queryParams, nil)\n}", "func decodeUploadRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.UploadRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func (cborEventReader) ReadAddEventRequest(bytes []byte) (dto.AddEventRequest, errors.EdgeX) {\n\tvar addEvent dto.AddEventRequest\n\terr := cbor.Unmarshal(bytes, &addEvent)\n\tif err != nil {\n\t\treturn addEvent, errors.NewCommonEdgeX(errors.KindContractInvalid, \"cbor AddEventRequest decoding failed\", err)\n\t}\n\n\treturn addEvent, nil\n}", "func (jsonEventReader) ReadAddEventRequest(bytes []byte) (dto.AddEventRequest, errors.EdgeX) {\n\tvar addEvent dto.AddEventRequest\n\terr := json.Unmarshal(bytes, &addEvent)\n\tif err != nil {\n\t\treturn addEvent, errors.NewCommonEdgeX(errors.KindContractInvalid, \"event json decoding failed\", err)\n\t}\n\treturn addEvent, nil\n}", "func decodeDeletePostRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.DeletePostRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func DecodeListRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error) {\n\treturn func(r *http.Request) (any, error) {\n\t\tvar (\n\t\t\tname *string\n\t\t\tstatus bool\n\t\t\terr error\n\t\t)\n\t\tnameRaw := r.URL.Query().Get(\"name\")\n\t\tif nameRaw != \"\" {\n\t\t\tname = &nameRaw\n\t\t}\n\t\t{\n\t\t\tstatusRaw := r.URL.Query().Get(\"status\")\n\t\t\tif statusRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseBool(statusRaw)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"status\", statusRaw, \"boolean\"))\n\t\t\t\t}\n\t\t\t\tstatus = v\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewListPayload(name, status)\n\n\t\treturn payload, nil\n\t}\n}", "func Decoder(d DecodeRequestFunc) func(e *Endpoint) {\n\treturn func(e *Endpoint) { e.decode = d }\n}", "func (msg *RegisterRMRequest) Decode(buf *goetty.ByteBuf) {\n\tmsg.abstractIdentifyRequest.Decode(buf)\n\tmsg.ResourceIDs = ReadBigString(buf)\n}", "func DecodeIDRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n var req IDRequest\n req.Id = mux.Vars(r)[\"id\"]\n return req, nil\n}", "func DecodeUnsealRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.UnsealRequest)\n\treturn &endpoints.UnsealRequest{Key: req.Key, Reset: req.Reset_}, nil\n}", "func decodeGetPostRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.GetPostRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func (t *TxnOffsetCommitRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TransactionalId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.GroupId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerId, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerEpoch, err = d.Int16()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]TxnOffsetCommitRequestTopic28, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item TxnOffsetCommitRequestTopic28\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func (t *DescribeLogDirsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]DescribableLogDirTopic35, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item DescribableLogDirTopic35\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func (t *OffsetDeleteRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.GroupId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]OffsetDeleteRequestTopic47, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item OffsetDeleteRequestTopic47\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func (t *ControlledShutdownRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.BrokerId, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 2 {\n\t\tt.BrokerEpoch, err = d.Int64()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "func decodeUpdatePostRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.UpdatePostRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}" ]
[ "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.5544039", "0.55277276", "0.55244607", "0.5453612", "0.5453612", "0.5447983", "0.54429764", "0.54314435", "0.5429044", "0.5419476", "0.5413183", "0.5402235", "0.53818715", "0.5381399", "0.5371461", "0.536712", "0.53390986", "0.5329427", "0.5327479", "0.53207034", "0.5312662", "0.53104395", "0.52931666", "0.5292251", "0.5284161", "0.52713937", "0.52650154", "0.52628994", "0.5260548", "0.5253192", "0.5230632", "0.5222697", "0.5220201", "0.5206509", "0.5199236", "0.519734", "0.519644", "0.519644", "0.5196169", "0.51958686", "0.51889795", "0.51875937", "0.518128", "0.51735955", "0.51632607", "0.5157526", "0.5149338", "0.5148503", "0.5136157", "0.5132291", "0.5121188", "0.51013184", "0.51003504", "0.5099737", "0.50996023", "0.50826263", "0.5076009", "0.5060647", "0.50594056", "0.50594056", "0.50520384", "0.50511587", "0.50386655", "0.5038371", "0.50370306", "0.5032609", "0.50244737", "0.5018348", "0.5017407", "0.5016591", "0.5013854", "0.5002203", "0.50016505", "0.5001616", "0.4998452", "0.49934533", "0.49876708", "0.4987356" ]
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 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\tbody := NewGetResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeGetResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeGetResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeGetEventsResponse(_ context.Context, r interface{}) (interface{}, error) {\r\n\treturn nil, errors.New(\"'Events' Encoder is not impelemented\")\r\n}", "func encodeGetDealByStateResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func EncodeGetResponse(ctx context.Context, v interface{}, hdr, trlr *metadata.MD) (interface{}, error) {\n\tvres, ok := v.(*termlimitviews.TermLimitResponse)\n\tif !ok {\n\t\treturn nil, goagrpc.ErrInvalidType(\"term_limit\", \"get\", \"*termlimitviews.TermLimitResponse\", v)\n\t}\n\tresult := vres.Projected\n\t(*hdr).Append(\"goa-view\", vres.View)\n\tresp := NewGetResponse(result)\n\treturn resp, nil\n}", "func EncodeGetLicenseResponse(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.(int)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeGetPostResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\t\tlogrus.Warn(err.Error())\n\t\t}\n\treturn\n}", "func encodeGetByCreteriaResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeGetDealByDIDResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func EncodeStationMetaResponse(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.(*sensor.StationMetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeAddResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewAddResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeAddResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewAddResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeGetUserDealByStateResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeGetByMultiCriteriaResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeGetByIDResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeGetByIDResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tresp := response.(*common.XmidtResponse)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Header().Set(common.HeaderWPATID, ctx.Value(common.ContextKeyRequestTID).(string))\n\tcommon.ForwardHeadersByPrefix(\"\", resp.ForwardedHeaders, w.Header())\n\n\tw.WriteHeader(resp.Code)\n\t_, err = w.Write(resp.Body)\n\treturn\n}", "func encodeGetTagResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\t\tlogrus.Warn(err.Error())\n\t\t}\n\treturn\n}", "func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n return json.NewEncoder(w).Encode(response)\n}", "func encodeGetAllIndustriesResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tres := response.(endpoints.GetAllIndustriesResponse)\n\terr := getError(res.Err)\n\tif err == nil {\n\t\tvar industries []*pb.Industry\n\t\tfor _, industry := range res.Industries {\n\t\t\tindustries = append(industries, industry.ToProto())\n\t\t}\n\t\treturn &pb.GetAllIndustriesResponse{Industries: industries}, nil\n\t}\n\treturn nil, err\n}", "func encodeStringResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tw.Header().Set(\"Content-Type\", \"application/json;charset=utf-8\")\n\treturn json.NewEncoder(w).Encode(response)\n}", "func encodeGetUserResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func (s GetRequest) Encode() ([]byte, error) {\n\tbuf := &bytes.Buffer{}\n\n\tfor _, entry := range s.PDU.rawSequence {\n\t\tencodedEntry, err := entry.Encode()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t_, err = buf.Write(encodedEntry)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tseqLength := buf.Len()\n\n\treturn append(encodeHeaderSequence(TypeGetRequest, seqLength), buf.Bytes()...), nil\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\treturn json.NewEncoder(w).Encode(response)\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\treturn json.NewEncoder(w).Encode(response)\n}", "func encodeSCEPResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tresp := response.(SCEPResponse)\n\tif resp.Err != nil {\n\t\thttp.Error(w, resp.Err.Error(), http.StatusInternalServerError)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", contentHeader(resp.operation, resp.CACertNum))\n\tw.Write(resp.Data)\n\treturn nil\n}", "func EncodeGetRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*warehouse.GetPayload)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"Warehouse\", \"Get\", \"*warehouse.GetPayload\", v)\n\t\t}\n\t\t{\n\t\t\thead := p.Token\n\t\t\tif !strings.Contains(head, \" \") {\n\t\t\t\treq.Header.Set(\"Authorization\", \"Bearer \"+head)\n\t\t\t} else {\n\t\t\t\treq.Header.Set(\"Authorization\", head)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n}", "func encodeCalculatorResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif e, ok := response.(errorer); ok && e.error() != nil {\n\t\t// Not a Go kit transport error, but a business-logic error.\n\t\t// Provide those as HTTP errors.\n\t\tencodeError(ctx, e.error(), w)\n\t\treturn nil\n\t}\n\n\t// fmt.Println(ctx)\n\tfmt.Println(response)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\treturn json.NewEncoder(w).Encode(response)\n}", "func EncodeGetInfoResponse(ctx context.Context, v interface{}, hdr, trlr *metadata.MD) (interface{}, error) {\n\tvres, ok := v.(*tableinfoviews.Tablepayload)\n\tif !ok {\n\t\treturn nil, goagrpc.ErrInvalidType(\"TableInfo\", \"get_info\", \"*tableinfoviews.Tablepayload\", v)\n\t}\n\tresult := vres.Projected\n\t(*hdr).Append(\"goa-view\", vres.View)\n\tresp := NewGetInfoResponse(result)\n\treturn resp, nil\n}", "func encodePutDealStateResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\t// Set JSON type\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\t// Check error\n\tif e, ok := response.(errorer); ok {\n\t\t// This is a errorer class, now check for error\n\t\tif err := e.error(); err != nil {\n\t\t\tencodeError(ctx, e.error(), w)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// cast to dataHolder to get Data, otherwise just encode the resposne\n\tif holder, ok := response.(dataHolder); ok {\n\t\treturn json.NewEncoder(w).Encode(holder.getData())\n\t} else {\n\t\treturn json.NewEncoder(w).Encode(response)\n\t}\n}", "func EncodeEnableResponse(_ 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 encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif e, ok := response.(errorer); ok && e.error() != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tw.WriteHeader(codeFrom(e.error()))\n\t\treturn marshalStructWithError(response, w)\n\t}\n\n\t// Used for pagination\n\tif e, ok := response.(counter); ok {\n\t\tw.Header().Set(\"X-Total-Count\", strconv.Itoa(e.count()))\n\t}\n\n\t// Don't overwrite a header (i.e. called from encodeTextResponse)\n\tif v := w.Header().Get(\"Content-Type\"); v == \"\" {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\t// Only write json body if we're setting response as json\n\t\treturn json.NewEncoder(w).Encode(response)\n\t}\n\treturn nil\n}", "func encodeGenericResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\treturn json.NewEncoder(w).Encode(response)\n}", "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\t\tbody := NewListAllResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeBasicResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\") //允许访问所有域\n\tw.Header().Add(\"Access-Control-Allow-Headers\", \"Origin, Content-Type, Authorization, tk, encrypt, authorization, platform\") //自定义header头\n\tw.Header().Set(\"Access-Control-Allow-Credentials\", \"true\") //允许\n\tw.Header().Add(\"Access-Control-Allow-Methods\", \"GET, POST, OPTIONS\") //允许接受\n\tw.Header().Set(\"Content-Type\", \"application/json;charset=utf-8\")\n\tif f, ok := response.(endpoint.Failer); ok && f.Failed() != nil {\n\t\tbusinessErrorEncoder(f.Failed(), w)\n\t\treturn nil\n\t}\n\n\treturn json.NewEncoder(w).Encode(response)\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif e, ok := response.(errorer); ok && e.error() != nil {\n\t\tEncodeError(ctx, e.error(), w)\n\t\treturn nil\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\treturn nil\n}", "func encodeHTTPGenericResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif f, ok := response.(kitendpoint.Failer); ok && f.Failed() != nil {\n\t\terrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\treturn json.NewEncoder(w).Encode(response)\n}", "func EncodeDoublySecureResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(string)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func GetEncodedResponse(requestID network.RequestID, encoding GetEncodedResponseEncoding) *GetEncodedResponseParams {\n\treturn &GetEncodedResponseParams{\n\t\tRequestID: requestID,\n\t\tEncoding: encoding,\n\t}\n}", "func encodeCreateIndustryResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tres := response.(endpoints.CreateIndustryResponse)\n\terr := getError(res.Err)\n\tif err == nil {\n\t\treturn res.Industry.ToProto(), nil\n\t}\n\treturn nil, err\n}", "func encodeResponse(w http.ResponseWriter, resp interface{}) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(resp)\n}", "func EncodeAddResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) kithttp.EncodeResponseFunc {\n\treturn server.EncodeAddResponse(encoder)\n}", "func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\n\tif e, ok := response.(Errorer); ok {\n\t\t// Not a Go kit transport error, but a business-logic error.\n\t\t// Provide those as HTTP errors.\n\t\tEncodeError(ctx, e.Error, w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tw.WriteHeader(http.StatusOK)\n\treturn json.NewEncoder(w).Encode(response)\n}", "func encodeAddResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeAddResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func EncodeStartResponse(_ 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 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(ctx, w)\n\t\tbody := NewDownloadPhotoResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif e, ok := response.(errorer); ok && e.error() != nil {\n\t\t// Not a Go kit transport error, but a business-logic error.\n\t\t// Provide those as HTTP errors.\n\t\tencodeError(ctx, e.error(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", ContentType)\n\treturn json.NewEncoder(w).Encode(response)\n}", "func EncodeResponse(_ context.Context, w http.ResponseWriter, response interface{}) error {\n\treturn json.NewEncoder(w).Encode(response)\n}", "func encodeUpdateTagResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\t\tlogrus.Warn(err.Error())\n\t\t}\n\treturn\n}", "func encodeResponse(response interface{}) []byte {\n\tvar bytesBuffer bytes.Buffer\n\tbytesBuffer.WriteString(xml.Header)\n\te := xml.NewEncoder(&bytesBuffer)\n\te.Encode(response)\n\treturn bytesBuffer.Bytes()\n}", "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\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeResponse(ctx context.Context, responseWriter http.ResponseWriter, response interface{}) error {\n\tif err, ok := response.(errorer); ok && err.error() != nil {\n\t\t// Not a Go kit transport error, but a business-logic error.\n\t\t// Provide those as HTTP errors.\n\t\tencodeError(ctx, err.error(), responseWriter)\n\t\treturn nil\n\t}\n\tresponseWriter.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\treturn json.NewEncoder(responseWriter).Encode(response)\n}", "func EncodeAdminSearchResponse(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\t\tbody := NewAdminSearchResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeSigninResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(*securedservice.Creds)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewSigninResponseBody(res)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (t EndTxnResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\te.PutInt16(t.ErrorCode) // ErrorCode\n}", "func encodeRegisterResponse(_ context.Context, r interface{}) (interface{}, error) {\n\trs := r.(endpoint.RegisterResponse)\n\n\tif rs.Err != nil {\n\t\treturn &pb.RegisterReply{\n\t\t\tMessage: rs.Err.Error(),\n\t\t\tStatus: \"ERROR\",\n\t\t}, fmt.Errorf(\"Message: %v With Status: %v\", rs.Err.Error(), rs.Err)\n\t}\n\n\treturn &pb.RegisterReply{\n\t\tMessage: fmt.Sprintf(\"Hi %s %s We Send a SMS for verify your Phone!\", rs.Response.Name, rs.Response.LastName),\n\t\tStatus: \"SUCCESS\",\n\t}, nil\n}", "func EncodeDataResponse(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.(*sensor.DataResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeRegisterResponse(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.(int)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusCreated)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeSecureResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(string)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeSearchResponse(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.(*posts.SearchResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewSearchResponseBody(res)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeAddResponse(_ 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 EncodeRefreshResponse(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.(*catalogviews.Job)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewRefreshResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\treturn json.NewEncoder(w).Encode(response)\n}", "func (t RenewDelegationTokenResponse) Encode(e *Encoder, version int16) {\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\te.PutInt64(t.ExpiryTimestampMs) // ExpiryTimestampMs\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n}", "func EncodeListResponse(_ 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 EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\te, ok := response.(HTTPErrorer)\n\tresErr := e.HTTPError()\n\n\tif ok && resErr != nil {\n\t\t// Not a Go kit transport error, but a business-logic error.\n\t\t// Provide those as HTTP errors.\n\t\tEncodeError(ctx, resErr, w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\treturn json.NewEncoder(w).Encode(response)\n}", "func EncodeLoginResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(string)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeTransferResponse(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\tw.WriteHeader(http.StatusNoContent)\n\t\treturn nil\n\t}\n}", "func EncodeGRPCGetCodeResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tresp := response.(*pb.GetCodeResp)\n\treturn resp, nil\n}", "func EncodeListResponse(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.(*inventory.ListResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListResponseBody(res)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeCreateTagResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\t\tlogrus.Warn(err.Error())\n\t\t}\n\treturn\n}", "func (o JsonSerializationResponseOutput) Encoding() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v JsonSerializationResponse) *string { return v.Encoding }).(pulumi.StringPtrOutput)\n}", "func EncodeListMineResponse(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.StationsFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListMineResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeListMineResponse(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.StationsFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListMineResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeAlsoDoublySecureResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(string)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeCreateResponse(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\tbody := NewCreateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeRegisterResponse(_ context.Context, r interface{}) (interface{}, error) {\n\tresponse := r.(endpoint.RegisterResponse)\n\tif response.U0 == nil {\n\t\treturn nil,response.E1\n\t}\n\t//进行数据的转换\n\tvar user = &pb.UserInfo{\n\t\tId:response.U0.Id,\n\t\tPhone:response.U0.Phone,\n\t\tPassword:response.U0.Password,\n\t\tAge:response.U0.Age,\n\t}\n\treturn &pb.RegisterReply{\n\t\tUser:user,\n\t},response.E1\n\n}", "func EncodeResolveResponse(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.(*sensorviews.SavedBookmark)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewResolveResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (t FindCoordinatorResponse) Encode(e *Encoder, version int16) {\n\tif version >= 1 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\tif version >= 1 {\n\t\te.PutString(t.ErrorMessage) // ErrorMessage\n\t}\n\te.PutInt32(t.NodeId) // NodeId\n\te.PutString(t.Host) // Host\n\te.PutInt32(t.Port) // Port\n}", "func EncodeGetRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*termlimit.GetPayload)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"term_limit\", \"get\", \"*termlimit.GetPayload\", v)\n\t\t}\n\t\tvalues := req.URL.Query()\n\t\tvalues.Add(\"muid\", p.Muid)\n\t\tvalues.Add(\"media_id\", fmt.Sprintf(\"%v\", p.MediaID))\n\t\treq.URL.RawQuery = values.Encode()\n\t\tbody := NewGetRequestBody(p)\n\t\tif err := encoder(req).Encode(&body); err != nil {\n\t\t\treturn goahttp.ErrEncodingError(\"term_limit\", \"get\", err)\n\t\t}\n\t\treturn nil\n\t}\n}", "func (t AddOffsetsToTxnResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\te.PutInt16(t.ErrorCode) // ErrorCode\n}", "func EncodeChangeResponse(_ 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 EncodeSealStatusResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tresp := response.(endpoints.SealStatusResponse)\n\n\tstatus := &pb.SealStatus{\n\t\tSealed: resp.Sealed,\n\t\tT: uint32(resp.T),\n\t\tN: uint32(resp.N),\n\t\tProgress: uint32(resp.Progress),\n\t\tVersion: resp.Version,\n\t\tClusterName: resp.ClusterName,\n\t\tClusterId: resp.ClusterID,\n\t}\n\treturn &pb.SealStatusResponse{\n\t\tSealStatus: status,\n\t\tErr: service.Error2String(resp.Err),\n\t}, nil\n}", "func EncodeSensorMetaResponse(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.(*sensor.SensorMetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodePostAcceptDealResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func NewGetHandler(\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.Handler {\n\tvar (\n\t\tdecodeRequest = DecodeGetRequest(mux, decoder)\n\t\tencodeResponse = EncodeGetResponse(encoder)\n\t\tencodeError = EncodeGetError(encoder, formatter)\n\t)\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get(\"Accept\"))\n\t\tctx = context.WithValue(ctx, goa.MethodKey, \"get\")\n\t\tctx = context.WithValue(ctx, goa.ServiceKey, \"station\")\n\t\tpayload, err := decodeRequest(r)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tres, err := endpoint(ctx, payload)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif err := encodeResponse(ctx, w, res); err != nil {\n\t\t\terrhandler(ctx, w, err)\n\t\t}\n\t})\n}", "func encodeGetAllOutput() string {\n\treturn `\n\t[\n\t\t{\n\t\t\t\"registered_from_address\": \"http://original-requester.example.net\",\n\t\t\t\"config\": {\n\t\t\t\t\"url\": \"http://deliver-here-0.example.net\",\n\t\t\t\t\"content_type\": \"application/json\",\n\t\t\t\t\"secret\": \"<obfuscated>\"\n\t\t\t},\n\t\t\t\"events\": [\"online\"],\n\t\t\t\"matcher\": {\n\t\t\t\t\"device_id\": [\"mac:aabbccddee.*\"]\n\t\t\t},\n\t\t\t\"failure_url\": \"http://contact-here-when-fails.example.net\",\n\t\t\t\"duration\": 0,\n\t\t\t\"until\": \"2021-01-02T15:04:10Z\"\n\t\t},\n\t\t{\n\t\t\t\"registered_from_address\": \"http://original-requester.example.net\",\n\t\t\t\"config\": {\n\t\t\t\t\"url\": \"http://deliver-here-1.example.net\",\n\t\t\t\t\"content_type\": \"application/json\",\n\t\t\t\t\"secret\": \"<obfuscated>\"\n\t\t\t},\n\t\t\t\"events\": [\"online\"],\n\t\t\t\"matcher\": {\n\t\t\t\t\"device_id\": [\"mac:aabbccddee.*\"]\n\t\t\t},\n\t\t\t\"failure_url\": \"http://contact-here-when-fails.example.net\",\n\t\t\t\"duration\": 0,\n\t\t\t\"until\": \"2021-01-02T15:04:20Z\"\n\t\t}\n\t]\n\t`\n}", "func EncodeMetaResponse(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.(*sensor.MetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (r VideoAdGetRequest) Encode() string {\n\tvalues := &url.Values{}\n\tvalues.Set(\"advertiser_id\", strconv.FormatUint(r.AdvertiserID, 10))\n\tif len(r.VideoIDs) > 0 {\n\t\tids, _ := json.Marshal(r.VideoIDs)\n\t\tvalues.Set(\"video_ids\", string(ids))\n\t}\n\treturn values.Encode()\n}", "func EncodeGetTradePairRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*restapi.GetTradePairPayload)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"RestAPI\", \"getTradePair\", \"*restapi.GetTradePairPayload\", v)\n\t\t}\n\t\tvalues := req.URL.Query()\n\t\tif p.Name != nil {\n\t\t\tvalues.Add(\"name\", *p.Name)\n\t\t}\n\t\tif p.Hash != nil {\n\t\t\tvalues.Add(\"hash\", *p.Hash)\n\t\t}\n\t\tif p.MakerAssetData != nil {\n\t\t\tvalues.Add(\"makerAssetData\", *p.MakerAssetData)\n\t\t}\n\t\tif p.TakerAssetData != nil {\n\t\t\tvalues.Add(\"takerAssetData\", *p.TakerAssetData)\n\t\t}\n\t\treq.URL.RawQuery = values.Encode()\n\t\treturn nil\n\t}\n}", "func EncodeResponse(response interface{}) []byte {\n\tvar bytesBuffer bytes.Buffer\n\tbytesBuffer.WriteString(xml.Header)\n\te := xml.NewEncoder(&bytesBuffer)\n\te.Encode(response)\n\treturn bytesBuffer.Bytes()\n}", "func EncodeDisableResponse(_ 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 encodeGetRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treturn nil, errors.New(\"'Users' Encoder is not impelemented\")\n}" ]
[ "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.55537736", "0.5503206", "0.54925364", "0.5473633", "0.54444784", "0.5400487", "0.53737205", "0.53737205", "0.5323827", "0.5315356", "0.53004813", "0.5292342", "0.5282365", "0.5252016", "0.5228369", "0.5226473", "0.5223621", "0.5190151", "0.5175329", "0.5170264", "0.5157761", "0.5135976", "0.5124975", "0.5105325", "0.509997", "0.5097961", "0.5092276", "0.507607", "0.507607", "0.5052495", "0.5049989", "0.5034121", "0.5012704", "0.5009202", "0.50090164", "0.50061834", "0.49914575", "0.49855754", "0.49763757", "0.49749824", "0.49748868", "0.4974113", "0.49739832", "0.49583015", "0.4934103", "0.49328807", "0.49323767", "0.4923972", "0.49056602", "0.4895281", "0.48934254", "0.48862827", "0.48698556", "0.48668623", "0.48661745", "0.48652717", "0.4865085", "0.4863781", "0.4863781", "0.48635414", "0.48457658", "0.48426846", "0.48379037", "0.48254588", "0.4822323", "0.47920758", "0.47852945", "0.47832185", "0.47764608", "0.4774819", "0.47709584", "0.47681656", "0.47603548", "0.47460613", "0.47453633", "0.47416577", "0.47352192", "0.4729565" ]
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 req, nil\n}", "func decodeGetRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.GetRequest{}\n\treturn req, nil\n}", "func DecodeGetRequest(_ context.Context, r *http.Request) (req interface{}, err error) {\n\treq = endpoints.GetRequest{Id: mux.Vars(r)[\"id\"]}\n\t//err = json.NewDecoder(r.Body).Decode(&r)\n\treturn req, err\n}", "func DecodeGetRequest(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 string\n\t\t\ttoken string\n\t\t\terr error\n\n\t\t\tparams = mux.Vars(r)\n\t\t)\n\t\tid = params[\"id\"]\n\t\ttoken = r.Header.Get(\"Authorization\")\n\t\tif token == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewGetPayload(id, token)\n\t\tif strings.Contains(payload.Token, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Token, \" \", 2)[1]\n\t\t\tpayload.Token = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func (tbr *TransportBaseReqquesst) DecodeGETRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\t//首字母设为大写\n\trequestMethodName := fmt.Sprintf(\"Decode%sRequest\", fmt.Sprintf(\"%v\", ctx.Value(auth.HttpPATH)))\n\tdata := []byte{}\n\tif callResult := core.CallReflect(tbr, requestMethodName, data); callResult != nil {\n\t\treturn callResult[0].Interface(), nil\n\t}\n\treturn nil, errors.New(\"read body data error\")\n}", "func DecodeGetRequest(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 := params[\"id\"]\n\t\t\tv, err2 := strconv.ParseInt(idRaw, 10, 32)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"id\", idRaw, \"integer\"))\n\t\t\t}\n\t\t\tid = int32(v)\n\t\t}\n\t\tauthRaw := r.Header.Get(\"Authorization\")\n\t\tif authRaw != \"\" {\n\t\t\tauth = &authRaw\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewGetPayload(id, auth)\n\t\tif payload.Auth != nil {\n\t\t\tif strings.Contains(*payload.Auth, \" \") {\n\t\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\t\tcred := strings.SplitN(*payload.Auth, \" \", 2)[1]\n\t\t\t\tpayload.Auth = &cred\n\t\t\t}\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func DecodeGetRequest(ctx context.Context, v interface{}, md metadata.MD) (interface{}, error) {\n\tvar (\n\t\tmessage *term_limitpb.GetRequest\n\t\tok bool\n\t)\n\t{\n\t\tif message, ok = v.(*term_limitpb.GetRequest); !ok {\n\t\t\treturn nil, goagrpc.ErrInvalidType(\"term_limit\", \"get\", \"*term_limitpb.GetRequest\", v)\n\t\t}\n\t}\n\tvar payload *termlimit.GetPayload\n\t{\n\t\tpayload = NewGetPayload(message)\n\t}\n\treturn payload, nil\n}", "func DecodeStationMetaRequest(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\tstations *string\n\t\t)\n\t\tstationsRaw := r.URL.Query().Get(\"stations\")\n\t\tif stationsRaw != \"\" {\n\t\t\tstations = &stationsRaw\n\t\t}\n\t\tpayload := NewStationMetaPayload(stations)\n\n\t\treturn payload, nil\n\t}\n}", "func decodeGetEventsRequest(_ context.Context, r interface{}) (interface{}, error) {\r\n\treturn nil, errors.New(\"'Events' Decoder is not impelemented\")\r\n}", "func decodeGetDealByStateRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\tvals := r.URL.Query()\n\tstate := \"\"\n\tstates, okk := vals[\"state\"]\n\tif okk {\n\t\tstate = states[0]\n\t}\n\treq := endpoint.GetDealByStateRequest{\n\t\tState: state,\n\t}\n\treturn req, nil\n}", "func DecodeRequest[I any](ctx context.Context, r *http.Request) (in I, err error) {\n\tswitch r.Method {\n\tcase \"POST\", \"PUT\", \"PATCH\":\n\t\terr = magic.Decode(r, &in,\n\t\t\tmagic.JSON,\n\t\t\tmagic.ChiRouter,\n\t\t)\n\tcase \"GET\", \"DELETE\":\n\t\terr = magic.Decode(r, &in,\n\t\t\tmagic.QueryParams,\n\t\t\tmagic.ChiRouter,\n\t\t)\n\tdefault:\n\t\terr = errors.Errorf(\"method %s not supported\", r.Method)\n\t}\n\n\tif err == io.EOF {\n\t\terr = errors.New(\"empty body\")\n\t}\n\n\treturn in, errors.E(err, \"can not unmarshal request\", errors.Unmarshal)\n}", "func decodeGetPostRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.GetPostRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func decodeRequest(_ context.Context, r *http.Request) (request interface{}, err error) {\n\tdefer r.Body.Close()\n\treturn nil, nil\n}", "func DecodeRequest(ctx context.Context, req *http.Request, pathParams map[string]string, queryParams map[string]string) (interface{}, error) {\n\treturn DecodeRequestWithHeaders(ctx, req, pathParams, queryParams, nil)\n}", "func decodeGetByMultiCriteriaRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.GetByMultiCriteriaRequest{\n\t\tUrlMap: r.URL.String(),\n\t}\n\treturn req, nil\n}", "func DecodeHTTPGetStatRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvar req GetStatRequest\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\tif err != nil {\n\t\treturn nil, RequestError\n\t}\n\treturn req, err\n}", "func DecodeGetLicenseRequest(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\tlicenseID int\n\t\t\terr error\n\n\t\t\tparams = mux.Vars(r)\n\t\t)\n\t\t{\n\t\t\tlicenseIDRaw := params[\"LicenseID\"]\n\t\t\tv, err2 := strconv.ParseInt(licenseIDRaw, 10, strconv.IntSize)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"licenseID\", licenseIDRaw, \"integer\"))\n\t\t\t}\n\t\t\tlicenseID = int(v)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewGetLicenseLicenseObject(licenseID)\n\n\t\treturn payload, nil\n\t}\n}", "func decodeGetByCreteriaRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\n\tvars := mux.Vars(r)\n\tname, ok := vars[\"name\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"not a valid creteria\")\n\t}\n\treq := endpoint.GetByCreteriaRequest{\n\t\tCreteria: name,\n\t}\n\treturn req, nil\n}", "func decodeGetDealByDIDRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\tid, ok := vars[\"dId\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"not a valid dId\")\n\t}\n\treq := endpoint.GetDealByDIDRequest{\n\t\tId: id,\n\t}\n\treturn req, nil\n}", "func DecodeDeleteRequest(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\tauth string\n\t\t\terr error\n\n\t\t\tparams = mux.Vars(r)\n\t\t)\n\t\t{\n\t\t\tstationIDRaw := params[\"stationId\"]\n\t\t\tv, err2 := strconv.ParseInt(stationIDRaw, 10, 32)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"stationID\", stationIDRaw, \"integer\"))\n\t\t\t}\n\t\t\tstationID = int32(v)\n\t\t}\n\t\tauth = r.Header.Get(\"Authorization\")\n\t\tif auth == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewDeletePayload(stationID, auth)\n\t\tif strings.Contains(payload.Auth, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Auth, \" \", 2)[1]\n\t\t\tpayload.Auth = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func decodeGetAllIndustriesRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.GetAllIndustriesRequest)\n\tdecoded := endpoints.GetAllIndustriesRequest{\n\t\tID: req.Id,\n\t\tName: req.Name,\n\t}\n\treturn decoded, nil\n}", "func RequestDecode(req *http.Request) (*JWT, error) {\n\treturn decode(req, nil)\n}", "func decodeGoGetRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvar request goGetRequest\n\tif err := json.NewDecoder(r.Body).Decode(&request); err != nil {\n\t\treturn nil, err\n\t}\n\treturn request, nil\n}", "func (t *FindCoordinatorRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.Key, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 1 {\n\t\tt.KeyType, err = d.Int8()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "func decodeStringRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\trequestType, ok := vars[\"type\"]\n\tif !ok {\n\t\treturn nil, ErrorBadRequest\n\t}\n\n\tpa, ok := vars[\"a\"]\n\tif !ok {\n\t\treturn nil, ErrorBadRequest\n\t}\n\n\tpb, ok := vars[\"b\"]\n\tif !ok {\n\t\treturn nil, ErrorBadRequest\n\t}\n\n\treturn endpoint.StringRequest{\n\t\tRequestType: requestType,\n\t\tA: pa,\n\t\tB: pb,\n\t}, nil\n}", "func decodeCalculatorRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\n\ta, ok := vars[\"a\"]\n\tif !ok {\n\t\treturn nil, ErrBadRouting\n\t}\n\n\tb, ok := vars[\"b\"]\n\tif !ok {\n\t\treturn nil, ErrBadRouting\n\t}\n\n\taint, _ := strconv.Atoi(a)\n\tbint, _ := strconv.Atoi(b)\n\treturn CalculatorRequest{\n\t\tA: aint,\n\t\tB: bint,\n\t}, nil\n}", "func decodeGetByIDRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\tid, ok := vars[\"id\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"not a valid ID\")\n\t}\n\treq := endpoint.GetByIDRequest{\n\t\tId: id,\n\t}\n\treturn req, nil\n}", "func decodeGetByIDRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\tid, ok := vars[\"id\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"not a valid ID\")\n\t}\n\treq := endpoint.GetByIDRequest{\n\t\tId: id,\n\t}\n\treturn req, nil\n}", "func decodeHTTPGetRoleRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvar req endpoints.GetRoleRequest\n\treq.RoleID = bone.GetValue(r, \"id\")\n\treturn req, nil\n}", "func (c *Cache) RequestDecode(req *http.Request) (*token.JWT, error) {\n\tvar jwt *token.JWT\n\tvar err error\n\taerr := c.doSync(func() {\n\t\tvar st string\n\t\tif st, err = c.requestToken(req); err != nil {\n\t\t\treturn\n\t\t}\n\t\tif jwt, err = c.Get(st); err != nil {\n\t\t\treturn\n\t\t}\n\t\tif jwt, err = token.Decode(st); err != nil {\n\t\t\treturn\n\t\t}\n\t\t_, err = c.Put(jwt)\n\t}, defaultTimeout)\n\tif aerr != nil {\n\t\treturn nil, aerr\n\t}\n\treturn jwt, err\n}", "func decodeGetTagRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.GetTagRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func DecodeRecentlyRequest(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\tstations *string\n\t\t\tauth *string\n\t\t)\n\t\tstationsRaw := r.URL.Query().Get(\"stations\")\n\t\tif stationsRaw != \"\" {\n\t\t\tstations = &stationsRaw\n\t\t}\n\t\tauthRaw := r.Header.Get(\"Authorization\")\n\t\tif authRaw != \"\" {\n\t\t\tauth = &authRaw\n\t\t}\n\t\tpayload := NewRecentlyPayload(stations, auth)\n\t\tif payload.Auth != nil {\n\t\t\tif strings.Contains(*payload.Auth, \" \") {\n\t\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\t\tcred := strings.SplitN(*payload.Auth, \" \", 2)[1]\n\t\t\t\tpayload.Auth = &cred\n\t\t\t}\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func (mh *MessageHandler) decodeRequest(httpRequest *http.Request) (deviceRequest *Request, err error) {\n\tdeviceRequest, err = DecodeRequest(httpRequest.Body, mh.Decoders)\n\tif err == nil {\n\t\tdeviceRequest = deviceRequest.WithContext(httpRequest.Context())\n\t}\n\n\treturn\n}", "func DecodeGetInfoRequest(ctx context.Context, v interface{}, md metadata.MD) (interface{}, error) {\n\tvar (\n\t\tmessage *table_infopb.GetInfoRequest\n\t\tok bool\n\t)\n\t{\n\t\tif message, ok = v.(*table_infopb.GetInfoRequest); !ok {\n\t\t\treturn nil, goagrpc.ErrInvalidType(\"TableInfo\", \"get_info\", \"*table_infopb.GetInfoRequest\", v)\n\t\t}\n\t}\n\tvar payload *tableinfo.GetInfoPayload\n\t{\n\t\tpayload = NewGetInfoPayload(message)\n\t}\n\treturn payload, nil\n}", "func DecodeBasicRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\n\tmethodName := fmt.Sprintf(\"Decode%sRequest\", r.Method)\n\ttbr := &TransportBaseReqquesst{}\n\tif callResult := core.CallReflect(tbr, methodName, ctx, r); callResult != nil {\n\t\tif callResult[1].Interface() != nil {\n\t\t\treturn callResult[0].Interface(), nil\n\t\t}\n\t\treturn callResult[0].Interface(), nil\n\t}\n\treturn nil, ErrorBadRequest\n}", "func decodeGetUserRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.GetUserRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func (t *RenewDelegationTokenRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.Hmac, err = d.Bytes()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.RenewPeriodMs, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func DecodeRequest(source io.Reader, format wrp.Format) (*Request, error) {\n\tcontents, err := io.ReadAll(source)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// nolint: typecheck\n\tmessage := new(wrp.Message)\n\tif err := wrp.NewDecoderBytes(contents, format).Decode(message); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// nolint: typecheck\n\terr = wrp.UTF8(message)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Request{\n\t\tMessage: message,\n\t\tFormat: format,\n\t\tContents: contents,\n\t}, nil\n}", "func DecodeGenerateKeyRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\tvar req GenerateKeyRequest\n\tvar err error\n\tif err = json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, err\n}", "func (msg *GlobalBeginRequest) Decode(buf *goetty.ByteBuf) {\n\tmsg.Timeout = ReadInt(buf)\n\tmsg.TransactionName = ReadString(buf)\n}", "func BasicDecodeRequest(ctx context.Context, req *http.Request) (interface{}, error) {\n\treturn DecodeRequestWithHeaders(ctx, req, map[string]string{}, map[string]string{}, nil)\n}", "func decodeGetAllBooksRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\trealOffset, realLimit := parseOffsetAndLimit(r)\n\n\t///////////////////\n\t// Parse parameters\n\tr.ParseForm()\n\tvalues := r.Form\n\n\t// get Title\n\ttitle := values.Get(\"title\")\n\n\t// get author name\n\tauthorName := values.Get(\"author_name\")\n\n\t// get AuthorId list\n\ttempAuthorIds := values[\"author_id\"]\n\ttemp := strings.Join(tempAuthorIds, \",\")\n\tauthorIds := splitCsvStringAsInts(temp)\n\n\t// Get BookId list\n\ttempIds := values[\"book_id\"]\n\ttemp = strings.Join(tempIds, \",\")\n\tbookIds := splitCsvStringAsInts(temp)\n\n\t// Get bearer from headers\n\tbearer := parseBearer(r)\n\n\t// Make request for all books\n\tvar request getAllBooksRequest\n\trequest = getAllBooksRequest{\n\t\tBearer: bearer,\n\t\tOffset: realOffset,\n\t\tLimit: realLimit,\n\t\tTitle: title,\n\t\tAuthorId: authorIds,\n\t\tBookId: bookIds,\n\t\tAuthorName: authorName,\n\t}\n\n\treturn request, nil\n}", "func (t *ExpireDelegationTokenRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.Hmac, err = d.Bytes()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ExpiryTimePeriodMs, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func DecodeGetProductsRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\tvar req payload.GetProductsRequest\n\treturn req, nil\n}", "func decodeHTTPGetAllNodesRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvar req endpoint.GetAllNodesRequest\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func (t *ApiVersionsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tif version >= 3 {\n\t\tt.ClientSoftwareName, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif version >= 3 {\n\t\tt.ClientSoftwareVersion, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "func (t *DescribeDelegationTokenRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\t// Owners\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Owners = make([]DescribeDelegationTokenOwner41, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item DescribeDelegationTokenOwner41\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Owners[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func DecodeTailRequest(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\tstations *string\n\t\t\tbackend *string\n\t\t\tauth *string\n\t\t)\n\t\tstationsRaw := r.URL.Query().Get(\"stations\")\n\t\tif stationsRaw != \"\" {\n\t\t\tstations = &stationsRaw\n\t\t}\n\t\tbackendRaw := r.URL.Query().Get(\"backend\")\n\t\tif backendRaw != \"\" {\n\t\t\tbackend = &backendRaw\n\t\t}\n\t\tauthRaw := r.Header.Get(\"Authorization\")\n\t\tif authRaw != \"\" {\n\t\t\tauth = &authRaw\n\t\t}\n\t\tpayload := NewTailPayload(stations, backend, auth)\n\t\tif payload.Auth != nil {\n\t\t\tif strings.Contains(*payload.Auth, \" \") {\n\t\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\t\tcred := strings.SplitN(*payload.Auth, \" \", 2)[1]\n\t\t\t\tpayload.Auth = &cred\n\t\t\t}\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func DecodeQuestionRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n var req QuestionRequest\n err := json.NewDecoder(r.Body).Decode(&req)\n if err != nil {\n return nil, err\n }\n return req, nil\n}", "func decodeDeleteIndustryRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.DeleteIndustryRequest)\n\treturn endpoints.DeleteIndustryRequest{ID: req.Id}, nil\n}", "func (t *DescribeAclsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.ResourceType, err = d.Int8()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ResourceNameFilter, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 1 {\n\t\tt.ResourcePatternType, err = d.Int8()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tt.PrincipalFilter, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.HostFilter, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.Operation, err = d.Int8()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.PermissionType, err = d.Int8()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func DecodeUnsealRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.UnsealRequest)\n\treturn &endpoints.UnsealRequest{Key: req.Key, Reset: req.Reset_}, nil\n}", "func DecodeProgressRequest(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\tauth string\n\t\t\terr error\n\n\t\t\tparams = mux.Vars(r)\n\t\t)\n\t\t{\n\t\t\tstationIDRaw := params[\"stationId\"]\n\t\t\tv, err2 := strconv.ParseInt(stationIDRaw, 10, 32)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"stationID\", stationIDRaw, \"integer\"))\n\t\t\t}\n\t\t\tstationID = int32(v)\n\t\t}\n\t\tauth = r.Header.Get(\"Authorization\")\n\t\tif auth == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewProgressPayload(stationID, auth)\n\t\tif strings.Contains(payload.Auth, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Auth, \" \", 2)[1]\n\t\t\tpayload.Auth = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "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\terr error\n\n\t\t\tparams = mux.Vars(r)\n\t\t)\n\t\t{\n\t\t\tstationIDRaw := params[\"stationId\"]\n\t\t\tv, err2 := strconv.ParseInt(stationIDRaw, 10, 32)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"stationID\", stationIDRaw, \"integer\"))\n\t\t\t}\n\t\t\tstationID = int32(v)\n\t\t}\n\t\t{\n\t\t\tsizeRaw := r.URL.Query().Get(\"size\")\n\t\t\tif sizeRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(sizeRaw, 10, 32)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"size\", sizeRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tpv := int32(v)\n\t\t\t\tsize = &pv\n\t\t\t}\n\t\t}\n\t\tifNoneMatchRaw := r.Header.Get(\"If-None-Match\")\n\t\tif ifNoneMatchRaw != \"\" {\n\t\t\tifNoneMatch = &ifNoneMatchRaw\n\t\t}\n\t\tauth = r.Header.Get(\"Authorization\")\n\t\tif auth == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewDownloadPhotoPayload(stationID, size, ifNoneMatch, auth)\n\t\tif strings.Contains(payload.Auth, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Auth, \" \", 2)[1]\n\t\t\tpayload.Auth = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func DelayRequestDecode(buffer string) (uint8, uint8) {\n\tmessage := DelayRequestMessage{}\n\terr := binary.Read(strings.NewReader(buffer), binary.BigEndian, &message)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn message.MessageCode, message.Id\n}", "func DecodeSubscribeRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error) {\n\treturn func(r *http.Request) (any, error) {\n\t\tvar (\n\t\t\ttoken string\n\t\t\terr error\n\t\t)\n\t\ttoken = r.Header.Get(\"Authorization\")\n\t\tif token == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"token\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewSubscribePayload(token)\n\t\tif strings.Contains(payload.Token, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Token, \" \", 2)[1]\n\t\t\tpayload.Token = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func DecodeStartRequest(_ context.Context, r *http.Request) (req interface{}, err error) {\n\treq = endpoints.StartRequest{Id: mux.Vars(r)[\"id\"]}\n\t//err = json.NewDecoder(r.Body).Decode(&r)\n\treturn req, err\n}", "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 decodePostAcceptDealRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.PostAcceptDealRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func decodeRequest(r io.Reader) *plugin.CodeGeneratorRequest {\n\tvar req plugin.CodeGeneratorRequest\n\tinput, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\tlog.Fatal(\"unable to read stdin: \" + err.Error())\n\t}\n\tif err := proto.Unmarshal(input, &req); err != nil {\n\t\tlog.Fatal(\"unable to marshal stdin as protobuf: \" + err.Error())\n\t}\n\treturn &req\n}", "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 decodeDeleteBookRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tbookId, err := parseBookId(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Make request to delete book\n\tvar request deleteBookRequest\n\trequest = deleteBookRequest{\n\t\tBookId: bookId,\n\t}\n\n\treturn request, nil\n}", "func decodeHelloRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvar request helloRequest\n\tif err := json.NewDecoder(r.Body).Decode(&request); err != nil {\n\t\treturn nil, err\n\t}\n\treturn request, nil\n}", "func (t *InitProducerIdRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TransactionalId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.TransactionTimeoutMs, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func decodeDeleteRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\tid, ok := vars[\"id\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"not a valid ID\")\n\t}\n\treq := endpoint.DeleteRequest{\n\t\tId: id,\n\t}\n\treturn req, nil\n}", "func decodeDeleteRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\tid, ok := vars[\"id\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"not a valid ID\")\n\t}\n\treq := endpoint.DeleteRequest{\n\t\tId: id,\n\t}\n\treturn req, nil\n}", "func TestReadServiceHTTPFactory_MakeDecode(t *testing.T) {\n\tassert := asst.New(t)\n\tqueryData := `{\n\t\t\"start_time\": 1493363958000,\n\t\t\"end_time\": 1494363958000,\n\t\t\"queries\":[\n\t\t\t{\n\t\t\t\t\"name\":\"cpi\",\n\t\t\t\t\"tags\":{\"machine\":\"machine-01\",\"os\":\"ubuntu\"},\n\t\t\t\t\"match_policy\": \"exact\",\n\t\t\t\t\"start_time\": 1493363958000,\n\t\t\t\t\"end_time\": 1494363958000\n\t\t\t}\n\t\t]\n\t}`\n\n\tvar req readRequest\n\terr := json.NewDecoder(strings.NewReader(queryData)).Decode(&req)\n\tassert.Nil(err)\n\t// NOTE: nothing to do with decoder\n\t// FIXED: Golang can't handle nested struct array http://stackoverflow.com/questions/21268000/unmarshaling-nested-json-objects-in-golang\n\terr = json.Unmarshal([]byte(queryData), &req)\n\tassert.Nil(err)\n\tassert.Equal(1, len(req.Queries))\n\tassert.Equal(\"cpi\", req.Queries[0].Name)\n}", "func RequestQueryDecoder(dec DecodeRequestFunc) ServerOption {\n\treturn func(o *Server) {\n\t\to.decQuery = dec\n\t}\n}", "func (pkt *SubModRequest) Decode(bytes []byte) (err error) {\n\tvar used int\n\toffset := 4 // header\n\n\tpkt.XID, used, err = XdrGetUint32(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.SubID, used, err = XdrGetInt64(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.Expression, used, err = XdrGetString(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.AcceptInsecure, used, err = XdrGetBool(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.AddKeys, used, err = XdrGetKeys(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.DelKeys, used, err = XdrGetKeys(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\treturn nil\n}", "func (r *Route) DecodeRequest(req interface{}) *Route {\n\tr.request = reflect.TypeOf(req)\n\tif r.request.Kind() != reflect.Ptr {\n\t\tpanic(\"request structure must be a pointer\")\n\t}\n\treturn r\n}", "func decodeAddRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.AddRequest{\n\t\tio.Department{\n\t\t\tDepartmentName: r.FormValue(\"DepartmentName\"),\n\t\t},\n\t}\n\treturn req, nil\n}", "func (pkt *SubDelRequest) Decode(bytes []byte) (err error) {\n\tvar used int\n\toffset := 4 // header\n\n\tpkt.XID, used, err = XdrGetUint32(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.SubID, used, err = XdrGetInt64(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\treturn nil\n}", "func DecodeEnableRequest(_ context.Context, r *http.Request) (req interface{}, err error) {\n\t//req = endpoints.EnableRequest{}\n\t//err = json.NewDecoder(r.Body).Decode(&r)\n\treturn req, err\n}", "func DecodeListenerRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error) {\n\treturn func(r *http.Request) (any, error) {\n\t\tvar (\n\t\t\ttoken string\n\t\t\terr error\n\t\t)\n\t\ttoken = r.Header.Get(\"Authorization\")\n\t\tif token == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"token\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewListenerPayload(token)\n\t\tif strings.Contains(payload.Token, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Token, \" \", 2)[1]\n\t\t\tpayload.Token = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func decodeRequestQuery(r *http.Request, v interface{}) error {\n\tif err := schema.NewDecoder().Decode(v, r.URL.Query()); err != nil {\n\t\tlog.WithField(\"err\", err).Info(\"Invalid request query\")\n\t\treturn err\n\t}\n\treturn nil\n}", "func DecodeSigninRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error) {\n\treturn func(r *http.Request) (any, error) {\n\t\tpayload := NewSigninPayload()\n\t\tuser, pass, ok := r.BasicAuth()\n\t\tif !ok {\n\t\t\treturn nil, goa.MissingFieldError(\"Authorization\", \"header\")\n\t\t}\n\t\tpayload.Username = user\n\t\tpayload.Password = pass\n\n\t\treturn payload, nil\n\t}\n}", "func decodeDeleteTagRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.DeleteTagRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func DecodeRequestString(r *http.Request) (string, error) {\n\tif r.Body == http.NoBody || r.Body == nil {\n\t\treturn \"\", errdefs.InvalidParameter(errors.New(\"http body is required\"))\n\t}\n\n\tb, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn \"\", errdefs.InvalidParameter(fmt.Errorf(\"failed to decode request body: %w\", err))\n\t}\n\n\treturn string(b), nil\n}", "func (d decoder) Decode(req types.Request, into runtime.Object) error {\n\tdeserializer := d.codecs.UniversalDeserializer()\n\treturn runtime.DecodeInto(deserializer, req.AdmissionRequest.Object.Raw, into)\n}", "func DecodeRemoveRequest(_ context.Context, r *http.Request) (req interface{}, err error) {\n\treq = endpoints.RemoveRequest{Id: mux.Vars(r)[\"id\"]}\n\t//err = json.NewDecoder(r.Body).Decode(&r)\n\treturn req, err\n}", "func decodePutDealStateRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.PutDealStateRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func (t *DeleteTopicsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TopicNames, err = d.StringArray()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.TimeoutMs, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func decodeHTTPNewJobRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvar req endpoint.NewJobRequest\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func (msg *globalActionRequest) Decode(buf *goetty.ByteBuf) {\n\tmsg.XID = ReadXID(buf)\n\tmsg.ExtraData = ReadString(buf)\n}", "func (t *AddOffsetsToTxnRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TransactionalId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerId, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerEpoch, err = d.Int16()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.GroupId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func Decode(ctx context.Context, r *http.Request, val interface{}) error {\n\n\tif r.Method == http.MethodPost || r.Method == http.MethodPut || r.Method == http.MethodPatch || r.Method == http.MethodDelete {\n\t\tdecoder := json.NewDecoder(r.Body)\n\t\tdecoder.DisallowUnknownFields()\n\t\tif err := decoder.Decode(val); err != nil {\n\t\t\treturn weberror.NewErrorMessage(ctx, err, http.StatusBadRequest, \"decode request body failed\")\n\t\t}\n\t} else {\n\t\tdecoder := schema.NewDecoder()\n\t\tif err := decoder.Decode(val, r.URL.Query()); err != nil {\n\t\t\terr = errors.Wrap(err, \"decode request query failed\")\n\t\t\treturn weberror.NewErrorMessage(ctx, err, http.StatusBadRequest, \"decode request query failed\")\n\t\t}\n\t}\n\n\treturn nil\n}", "func decodeUpdateTagRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.UpdateTagRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func decodeHotPlayMoviesrRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tfmt.Printf(\"read body err, %v\\n\", err)\n\t\treturn nil, err\n\t}\n\tprintln(\"json-request:\", string(body))\n\n\tvar rhe endpoint.MoviesListRequest // 请求参数解析后放在结构体中\n\tif err = json.Unmarshal(body, &rhe); err != nil {\n\t\tfmt.Printf(\"Unmarshal err, %v\\n\", err)\n\t\treturn nil, err\n\t}\n\tfmt.Println(\"request\", rhe)\n\n\treturn &rhe, nil\n}", "func decodeVerifyRequest(_ context.Context, r interface{}) (interface{}, error) {\n\trq := r.(*pb.VerifyRequest)\n\n\treturn endpoint.VerifyRequest{\n\t\tToken: rq.Token,\n\t\tType: rq.Type,\n\t\tCode: rq.Code,\n\t}, nil\n}", "func DecodeGRPCGetCodeRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.GetCodeReq)\n\treturn req, nil\n}", "func DecodeDataRequest(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\tstart *int64\n\t\t\tend *int64\n\t\t\tstations *string\n\t\t\tsensors *string\n\t\t\tresolution *int32\n\t\t\taggregate *string\n\t\t\tcomplete *bool\n\t\t\ttail *int32\n\t\t\tbackend *string\n\t\t\tauth *string\n\t\t\terr error\n\t\t)\n\t\t{\n\t\t\tstartRaw := r.URL.Query().Get(\"start\")\n\t\t\tif startRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(startRaw, 10, 64)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"start\", startRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tstart = &v\n\t\t\t}\n\t\t}\n\t\t{\n\t\t\tendRaw := r.URL.Query().Get(\"end\")\n\t\t\tif endRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(endRaw, 10, 64)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"end\", endRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tend = &v\n\t\t\t}\n\t\t}\n\t\tstationsRaw := r.URL.Query().Get(\"stations\")\n\t\tif stationsRaw != \"\" {\n\t\t\tstations = &stationsRaw\n\t\t}\n\t\tsensorsRaw := r.URL.Query().Get(\"sensors\")\n\t\tif sensorsRaw != \"\" {\n\t\t\tsensors = &sensorsRaw\n\t\t}\n\t\t{\n\t\t\tresolutionRaw := r.URL.Query().Get(\"resolution\")\n\t\t\tif resolutionRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(resolutionRaw, 10, 32)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"resolution\", resolutionRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tpv := int32(v)\n\t\t\t\tresolution = &pv\n\t\t\t}\n\t\t}\n\t\taggregateRaw := r.URL.Query().Get(\"aggregate\")\n\t\tif aggregateRaw != \"\" {\n\t\t\taggregate = &aggregateRaw\n\t\t}\n\t\t{\n\t\t\tcompleteRaw := r.URL.Query().Get(\"complete\")\n\t\t\tif completeRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseBool(completeRaw)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"complete\", completeRaw, \"boolean\"))\n\t\t\t\t}\n\t\t\t\tcomplete = &v\n\t\t\t}\n\t\t}\n\t\t{\n\t\t\ttailRaw := r.URL.Query().Get(\"tail\")\n\t\t\tif tailRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(tailRaw, 10, 32)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"tail\", tailRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tpv := int32(v)\n\t\t\t\ttail = &pv\n\t\t\t}\n\t\t}\n\t\tbackendRaw := r.URL.Query().Get(\"backend\")\n\t\tif backendRaw != \"\" {\n\t\t\tbackend = &backendRaw\n\t\t}\n\t\tauthRaw := r.Header.Get(\"Authorization\")\n\t\tif authRaw != \"\" {\n\t\t\tauth = &authRaw\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewDataPayload(start, end, stations, sensors, resolution, aggregate, complete, tail, backend, auth)\n\t\tif payload.Auth != nil {\n\t\t\tif strings.Contains(*payload.Auth, \" \") {\n\t\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\t\tcred := strings.SplitN(*payload.Auth, \" \", 2)[1]\n\t\t\t\tpayload.Auth = &cred\n\t\t\t}\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func EncodeGetRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*warehouse.GetPayload)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"Warehouse\", \"Get\", \"*warehouse.GetPayload\", v)\n\t\t}\n\t\t{\n\t\t\thead := p.Token\n\t\t\tif !strings.Contains(head, \" \") {\n\t\t\t\treq.Header.Set(\"Authorization\", \"Bearer \"+head)\n\t\t\t} else {\n\t\t\t\treq.Header.Set(\"Authorization\", head)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n}", "func decodeHTTPSumRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvar req endpoints.SumRequest\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func Decoder(d DecodeRequestFunc) func(e *Endpoint) {\n\treturn func(e *Endpoint) { e.decode = d }\n}", "func (t *EndTxnRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TransactionalId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerId, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerEpoch, err = d.Int16()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.Committed, err = d.Bool()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func decodeCreateTagRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.CreateTagRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func decodeGetAllJobPlatformsRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.GetAllJobPlatformsRequest)\n\tdecoded := endpoints.GetAllJobPlatformsRequest{\n\t\tID: req.Id,\n\t\tName: req.Name,\n\t}\n\treturn decoded, nil\n}", "func (t *CreateDelegationTokenRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\t// Renewers\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Renewers = make([]CreatableRenewers38, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item CreatableRenewers38\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Renewers[i] = item\n\t\t}\n\t}\n\tt.MaxLifetimeMs, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func decodeSubRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\tvar req subRequest\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}" ]
[ "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.590861", "0.5882635", "0.58820754", "0.5873376", "0.57982767", "0.5760476", "0.57490414", "0.57490414", "0.57169557", "0.5712939", "0.5667755", "0.562545", "0.56143636", "0.5612032", "0.55960995", "0.5594726", "0.5593574", "0.5588596", "0.5576861", "0.554536", "0.55190843", "0.5490357", "0.5461504", "0.54383475", "0.5423577", "0.54103446", "0.5369988", "0.5365519", "0.5346515", "0.5335646", "0.5331528", "0.5322407", "0.5321589", "0.5318454", "0.5310427", "0.5308383", "0.5308289", "0.5293242", "0.5286264", "0.5281936", "0.5278744", "0.5276726", "0.52672416", "0.5260874", "0.5248986", "0.5248986", "0.5234963", "0.52333313", "0.5231031", "0.522826", "0.5220177", "0.52160966", "0.521549", "0.52057827", "0.51915544", "0.51910865", "0.51901954", "0.5189685", "0.5188019", "0.5185366", "0.518311", "0.5182114", "0.51817906", "0.5163952", "0.5157609", "0.51530206", "0.51500106", "0.5142123", "0.514042", "0.5131338", "0.5130649", "0.51292276", "0.51214504", "0.511701", "0.5110018", "0.5080946", "0.5075259", "0.5074271", "0.5073889" ]
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\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeUpdateMessageResponse(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.(*discussion.UpdateMessageResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateMessageResponseBody(res)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeUpdatePostResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\t\tlogrus.Warn(err.Error())\n\t\t}\n\treturn\n}", "func encodeUpdateTagResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\t\tlogrus.Warn(err.Error())\n\t\t}\n\treturn\n}", "func EncodeUpdateDeviceLicenseResponse(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.(int)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (t UpdateMetadataResponse) Encode(e *Encoder, version int16) {\n\te.PutInt16(t.ErrorCode) // ErrorCode\n}", "func EncodeAddResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewAddResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeAddResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewAddResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeUpdateCompanyResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tres := response.(endpoints.UpdateCompanyResponse)\n\terr := getError(res.Err)\n\tif err == nil {\n\t\treturn res.Company.ToProto(), nil\n\t}\n\treturn nil, err\n}", "func (r UpdateRequest) Encode() []byte {\n\tret, _ := json.Marshal(r)\n\treturn ret\n}", "func (t FindCoordinatorResponse) Encode(e *Encoder, version int16) {\n\tif version >= 1 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\tif version >= 1 {\n\t\te.PutString(t.ErrorMessage) // ErrorMessage\n\t}\n\te.PutInt32(t.NodeId) // NodeId\n\te.PutString(t.Host) // Host\n\te.PutInt32(t.Port) // Port\n}", "func EncodePatchResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(*tus.PatchResult)\n\t\tw.Header().Set(\"Tus-Resumable\", res.TusResumable)\n\t\t{\n\t\t\tval := res.UploadOffset\n\t\t\tuploadOffsets := strconv.FormatInt(val, 10)\n\t\t\tw.Header().Set(\"Upload-Offset\", uploadOffsets)\n\t\t}\n\t\tif res.UploadExpires != nil {\n\t\t\tw.Header().Set(\"Upload-Expires\", *res.UploadExpires)\n\t\t}\n\t\tw.WriteHeader(http.StatusNoContent)\n\t\treturn nil\n\t}\n}", "func EncodeUpdateRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*warehouse.UpdatePayload)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"Warehouse\", \"Update\", \"*warehouse.UpdatePayload\", v)\n\t\t}\n\t\t{\n\t\t\thead := p.Token\n\t\t\tif !strings.Contains(head, \" \") {\n\t\t\t\treq.Header.Set(\"Authorization\", \"Bearer \"+head)\n\t\t\t} else {\n\t\t\t\treq.Header.Set(\"Authorization\", head)\n\t\t\t}\n\t\t}\n\t\tbody := NewUpdateRequestBody(p)\n\t\tif err := encoder(req).Encode(&body); err != nil {\n\t\t\treturn goahttp.ErrEncodingError(\"Warehouse\", \"Update\", err)\n\t\t}\n\t\treturn nil\n\t}\n}", "func EncodeUpdateDeviceLicenseWithValueResponse(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.(int)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeChangeResponse(_ 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 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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewGetResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeGetResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewGetResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeStationMetaResponse(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.(*sensor.StationMetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodePutDealStateResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeUpdateJobPostResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tres := response.(endpoints.UpdateJobPostResponse)\n\terr := getError(res.Err)\n\tif err == nil {\n\t\treturn res.JobPost.ToProto(), nil\n\t}\n\treturn nil, err\n}", "func (t IncrementalAlterConfigsResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t// Responses\n\tlen1 := len(t.Responses)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Responses[i].Encode(e, version)\n\t}\n}", "func EncodeRefreshResponse(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.(*catalogviews.Job)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewRefreshResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeAdminSearchResponse(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\t\tbody := NewAdminSearchResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (t SyncGroupResponse) Encode(e *Encoder, version int16) {\n\tif version >= 1 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\te.PutBytes(t.Assignment) // Assignment\n}", "func NewUpdateHandler(\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.Handler {\n\tvar (\n\t\tdecodeRequest = DecodeUpdateRequest(mux, decoder)\n\t\tencodeResponse = EncodeUpdateResponse(encoder)\n\t\tencodeError = EncodeUpdateError(encoder, formatter)\n\t)\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get(\"Accept\"))\n\t\tctx = context.WithValue(ctx, goa.MethodKey, \"update\")\n\t\tctx = context.WithValue(ctx, goa.ServiceKey, \"station\")\n\t\tpayload, err := decodeRequest(r)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tres, err := endpoint(ctx, payload)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif err := encodeResponse(ctx, w, res); err != nil {\n\t\t\terrhandler(ctx, w, err)\n\t\t}\n\t})\n}", "func (t UpdateMetadataRequest) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ControllerId) // ControllerId\n\te.PutInt32(t.ControllerEpoch) // ControllerEpoch\n\tif version >= 5 {\n\t\te.PutInt64(t.BrokerEpoch) // BrokerEpoch\n\t}\n\tif version >= 0 && version <= 4 {\n\t\t// UngroupedPartitionStates\n\t\tlen3 := len(t.UngroupedPartitionStates)\n\t\te.PutArrayLength(len3)\n\t\tfor i := 0; i < len3; i++ {\n\t\t\tt.UngroupedPartitionStates[i].Encode(e, version)\n\t\t}\n\t}\n\tif version >= 5 {\n\t\t// TopicStates\n\t\tlen4 := len(t.TopicStates)\n\t\te.PutArrayLength(len4)\n\t\tfor i := 0; i < len4; i++ {\n\t\t\tt.TopicStates[i].Encode(e, version)\n\t\t}\n\t}\n\t// LiveBrokers\n\tlen5 := len(t.LiveBrokers)\n\te.PutArrayLength(len5)\n\tfor i := 0; i < len5; i++ {\n\t\tt.LiveBrokers[i].Encode(e, version)\n\t}\n}", "func (t RenewDelegationTokenResponse) Encode(e *Encoder, version int16) {\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\te.PutInt64(t.ExpiryTimestampMs) // ExpiryTimestampMs\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n}", "func (t AlterConfigsResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t// Responses\n\tlen1 := len(t.Responses)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Responses[i].Encode(e, version)\n\t}\n}", "func EncodeGRPCUpdateUserInfoResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tresp := response.(*pb.ErrCode)\n\treturn resp, nil\n}", "func EncodeUpdateRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*user.UpdateUser)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"user\", \"update\", \"*user.UpdateUser\", v)\n\t\t}\n\t\treq.Header.Set(\"Authorization\", p.Token)\n\t\tbody := NewUpdateRequestBody(p)\n\t\tif err := encoder(req).Encode(&body); err != nil {\n\t\t\treturn goahttp.ErrEncodingError(\"user\", \"update\", err)\n\t\t}\n\t\treturn nil\n\t}\n}", "func (t ApiVersionsResponse) Encode(e *Encoder, version int16) {\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\t// ApiKeys\n\tlen1 := len(t.ApiKeys)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.ApiKeys[i].Encode(e, version)\n\t}\n\tif version >= 1 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n}", "func encodeUpdateKeyPersonResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tres := response.(endpoints.UpdateKeyPersonResponse)\n\terr := getError(res.Err)\n\tif err == nil {\n\t\treturn res.KeyPerson.ToProto(), nil\n\t}\n\treturn nil, err\n}", "func (t ControlledShutdownResponse) Encode(e *Encoder, version int16) {\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\t// RemainingPartitions\n\tlen1 := len(t.RemainingPartitions)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.RemainingPartitions[i].Encode(e, version)\n\t}\n}", "func EncodeInitResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tresp := response.(endpoints.InitResponse)\n\n\treturn &pb.InitResponse{\n\t\tKeys: resp.Init.Keys,\n\t\tKeysBase64: resp.Init.KeysB64,\n\t\tRecoveryKeys: resp.Init.RecoveryKeys,\n\t\tRecoveryKeysBase64: resp.Init.RecoveryKeysB64,\n\t\tRootToken: resp.Init.RootToken,\n\t\tErr: service.Error2String(resp.Err),\n\t}, nil\n}", "func (r UpdateBidRequest) Encode() []byte {\n\tret, _ := json.Marshal(r)\n\treturn ret\n}", "func (t EndTxnResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\te.PutInt16(t.ErrorCode) // ErrorCode\n}", "func (t AddOffsetsToTxnResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\te.PutInt16(t.ErrorCode) // ErrorCode\n}", "func (t HeartbeatResponse) Encode(e *Encoder, version int16) {\n\tif version >= 1 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\te.PutInt16(t.ErrorCode) // ErrorCode\n}", "func EncodeUpdateRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*log.Log)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"log\", \"update\", \"*log.Log\", v)\n\t\t}\n\t\tbody := NewUpdateRequestBody(p)\n\t\tif err := encoder(req).Encode(&body); err != nil {\n\t\t\treturn goahttp.ErrEncodingError(\"log\", \"update\", err)\n\t\t}\n\t\treturn nil\n\t}\n}", "func EncodeUpdateRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*blog.UpdatePayload)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"blog\", \"update\", \"*blog.UpdatePayload\", v)\n\t\t}\n\t\tbody := NewUpdateRequestBody(p)\n\t\tif err := encoder(req).Encode(&body); err != nil {\n\t\t\treturn goahttp.ErrEncodingError(\"blog\", \"update\", err)\n\t\t}\n\t\treturn nil\n\t}\n}", "func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n return json.NewEncoder(w).Encode(response)\n}", "func DecodeUpdateResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error) {\n\treturn func(resp *http.Response) (interface{}, error) {\n\t\tif restoreBody {\n\t\t\tb, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\tdefer func() {\n\t\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\t}()\n\t\t} else {\n\t\t\tdefer resp.Body.Close()\n\t\t}\n\t\tswitch resp.StatusCode {\n\t\tcase http.StatusNoContent:\n\t\t\treturn nil, nil\n\t\tdefault:\n\t\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\t\treturn nil, goahttp.ErrInvalidResponse(\"blog\", \"update\", resp.StatusCode, string(body))\n\t\t}\n\t}\n}", "func EncodeListMineResponse(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.StationsFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListMineResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeListMineResponse(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.StationsFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListMineResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeEnableResponse(_ 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 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\t\tbody := NewListAllResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (t AlterPartitionReassignmentsResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\te.PutString(t.ErrorMessage) // ErrorMessage\n\t// Responses\n\tlen3 := len(t.Responses)\n\te.PutArrayLength(len3)\n\tfor i := 0; i < len3; i++ {\n\t\tt.Responses[i].Encode(e, version)\n\t}\n}", "func encodeGetResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeGetResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func EncodeAddResponse(_ 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 DecodeVMUpdateResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error) {\n\treturn func(resp *http.Response) (interface{}, error) {\n\t\tif restoreBody {\n\t\t\tb, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\tdefer func() {\n\t\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\t}()\n\t\t} else {\n\t\t\tdefer resp.Body.Close()\n\t\t}\n\t\tswitch resp.StatusCode {\n\t\tcase http.StatusOK:\n\t\t\treturn nil, nil\n\t\tdefault:\n\t\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\t\treturn nil, goahttp.ErrInvalidResponse(\"spin-registry\", \"vm_update\", resp.StatusCode, string(body))\n\t\t}\n\t}\n}", "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 EncodeUpdateDeviceRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*chargewatch.UpdateDevicePayload)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"chargewatch\", \"updateDevice\", \"*chargewatch.UpdateDevicePayload\", v)\n\t\t}\n\t\tbody := p\n\t\tif err := encoder(req).Encode(&body); err != nil {\n\t\t\treturn goahttp.ErrEncodingError(\"chargewatch\", \"updateDevice\", err)\n\t\t}\n\t\treturn nil\n\t}\n}", "func encodeAddResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeAddResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func DecodeUpdateDeviceResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error) {\n\treturn func(resp *http.Response) (interface{}, error) {\n\t\tif restoreBody {\n\t\t\tb, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\tdefer func() {\n\t\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\t}()\n\t\t} else {\n\t\t\tdefer resp.Body.Close()\n\t\t}\n\t\tswitch resp.StatusCode {\n\t\tcase http.StatusOK:\n\t\t\tvar (\n\t\t\t\tbody UpdateDeviceResponseBody\n\t\t\t\terr error\n\t\t\t)\n\t\t\terr = decoder(resp).Decode(&body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, goahttp.ErrDecodingError(\"chargewatch\", \"updateDevice\", err)\n\t\t\t}\n\t\t\terr = ValidateUpdateDeviceResponseBody(&body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, goahttp.ErrValidationError(\"chargewatch\", \"updateDevice\", err)\n\t\t\t}\n\t\t\tres := NewUpdateDeviceResultOK(&body)\n\t\t\treturn res, nil\n\t\tdefault:\n\t\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\t\treturn nil, goahttp.ErrInvalidResponse(\"chargewatch\", \"updateDevice\", resp.StatusCode, string(body))\n\t\t}\n\t}\n}", "func (t ProduceResponse) Encode(e *Encoder, version int16) {\n\t// Responses\n\tlen0 := len(t.Responses)\n\te.PutArrayLength(len0)\n\tfor i := 0; i < len0; i++ {\n\t\tt.Responses[i].Encode(e, version)\n\t}\n\tif version >= 1 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n}", "func (res *ModifyDNResponse) Encode(_ context.Context, w ResponseWriter) error {\n\treturn w.WriteError(ldaputil.ApplicationModifyDNResponse, errors.New(\"not implemented\"))\n}", "func NewUpdateResponse(result string) *taskspb.UpdateResponse {\n\tmessage := &taskspb.UpdateResponse{}\n\tmessage.Field = result\n\treturn message\n}", "func EncodeRegisterResponse(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.(int)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusCreated)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\treturn json.NewEncoder(w).Encode(response)\n}", "func (t MetadataResponse) Encode(e *Encoder, version int16) {\n\tif version >= 3 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\t// Brokers\n\tlen1 := len(t.Brokers)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Brokers[i].Encode(e, version)\n\t}\n\tif version >= 2 {\n\t\te.PutString(t.ClusterId) // ClusterId\n\t}\n\tif version >= 1 {\n\t\te.PutInt32(t.ControllerId) // ControllerId\n\t}\n\t// Topics\n\tlen4 := len(t.Topics)\n\te.PutArrayLength(len4)\n\tfor i := 0; i < len4; i++ {\n\t\tt.Topics[i].Encode(e, version)\n\t}\n\tif version >= 8 {\n\t\te.PutInt32(t.ClusterAuthorizedOperations) // ClusterAuthorizedOperations\n\t}\n}", "func NewUpdateResponseBody(res *warehouseviews.WarehouseView) *UpdateResponseBody {\n\tbody := &UpdateResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func CreateUpdateK8sApplicationConfigResponse() (response *UpdateK8sApplicationConfigResponse) {\n\tresponse = &UpdateK8sApplicationConfigResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func encodeGetDealByStateResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func EncodeAddResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) kithttp.EncodeResponseFunc {\n\treturn server.EncodeAddResponse(encoder)\n}", "func encodeCalculatorResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif e, ok := response.(errorer); ok && e.error() != nil {\n\t\t// Not a Go kit transport error, but a business-logic error.\n\t\t// Provide those as HTTP errors.\n\t\tencodeError(ctx, e.error(), w)\n\t\treturn nil\n\t}\n\n\t// fmt.Println(ctx)\n\tfmt.Println(response)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\treturn json.NewEncoder(w).Encode(response)\n}", "func EncodeInitStatusResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tresp := response.(endpoints.InitStatusResponse)\n\tstatus := &pb.Status{Initialized: bool(resp.Initialized)}\n\treturn &pb.InitStatusResponse{Status: status, Err: service.Error2String(resp.Err)}, nil\n}", "func EncodeLoginResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(string)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (t AlterReplicaLogDirsResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t// Results\n\tlen1 := len(t.Results)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Results[i].Encode(e, version)\n\t}\n}", "func EncodeSensorMetaResponse(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.(*sensor.SensorMetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeGetTagResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\t\tlogrus.Warn(err.Error())\n\t\t}\n\treturn\n}", "func CreateUpdateIntegrationResponse() (response *UpdateIntegrationResponse) {\n\tresponse = &UpdateIntegrationResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif e, ok := response.(errorer); ok && e.error() != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tw.WriteHeader(codeFrom(e.error()))\n\t\treturn marshalStructWithError(response, w)\n\t}\n\n\t// Used for pagination\n\tif e, ok := response.(counter); ok {\n\t\tw.Header().Set(\"X-Total-Count\", strconv.Itoa(e.count()))\n\t}\n\n\t// Don't overwrite a header (i.e. called from encodeTextResponse)\n\tif v := w.Header().Get(\"Content-Type\"); v == \"\" {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\t// Only write json body if we're setting response as json\n\t\treturn json.NewEncoder(w).Encode(response)\n\t}\n\treturn nil\n}", "func EncodeResponse(_ context.Context, w http.ResponseWriter, response interface{}) error {\n\treturn json.NewEncoder(w).Encode(response)\n}", "func EncodeVMUpdateRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*spinregistry.UpdateVM)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"spin-registry\", \"vm_update\", \"*spinregistry.UpdateVM\", v)\n\t\t}\n\t\tbody := NewVMUpdateRequestBody(p)\n\t\tif err := encoder(req).Encode(&body); err != nil {\n\t\t\treturn goahttp.ErrEncodingError(\"spin-registry\", \"vm_update\", err)\n\t\t}\n\t\treturn nil\n\t}\n}", "func (t FetchResponse) Encode(e *Encoder, version int16) {\n\tif version >= 1 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\tif version >= 7 {\n\t\te.PutInt16(t.ErrorCode) // ErrorCode\n\t}\n\tif version >= 7 {\n\t\te.PutInt32(t.SessionId) // SessionId\n\t}\n\t// Topics\n\tlen3 := len(t.Topics)\n\te.PutArrayLength(len3)\n\tfor i := 0; i < len3; i++ {\n\t\tt.Topics[i].Encode(e, version)\n\t}\n}", "func (t ListOffsetResponse) Encode(e *Encoder, version int16) {\n\tif version >= 2 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\t// Topics\n\tlen1 := len(t.Topics)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Topics[i].Encode(e, version)\n\t}\n}", "func (t TxnOffsetCommitResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t// Topics\n\tlen1 := len(t.Topics)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Topics[i].Encode(e, version)\n\t}\n}", "func (t UpdateMetadataEndpoint6) Encode(e *Encoder, version int16) {\n\tif version >= 1 {\n\t\te.PutInt32(t.Port) // Port\n\t}\n\tif version >= 1 {\n\t\te.PutString(t.Host) // Host\n\t}\n\tif version >= 3 {\n\t\te.PutString(t.Listener) // Listener\n\t}\n\tif version >= 1 {\n\t\te.PutInt16(t.SecurityProtocol) // SecurityProtocol\n\t}\n}", "func EncodeDataResponse(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.(*sensor.DataResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (t OffsetCommitResponse) Encode(e *Encoder, version int16) {\n\tif version >= 3 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\t// Topics\n\tlen1 := len(t.Topics)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Topics[i].Encode(e, version)\n\t}\n}", "func (t UpdateMetadataBroker6) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.Id) // Id\n\tif version >= 0 && version <= 0 {\n\t\te.PutString(t.V0Host) // V0Host\n\t}\n\tif version >= 0 && version <= 0 {\n\t\te.PutInt32(t.V0Port) // V0Port\n\t}\n\tif version >= 1 {\n\t\t// Endpoints\n\t\tlen3 := len(t.Endpoints)\n\t\te.PutArrayLength(len3)\n\t\tfor i := 0; i < len3; i++ {\n\t\t\tt.Endpoints[i].Encode(e, version)\n\t\t}\n\t}\n\tif version >= 2 {\n\t\te.PutString(t.Rack) // Rack\n\t}\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif e, ok := response.(errorer); ok && e.error() != nil {\n\t\tEncodeError(ctx, e.error(), w)\n\t\treturn nil\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\treturn nil\n}", "func (x respExt) UpdateExt(dest interface{}, v interface{}) {\n\tdata := v.([]byte)\n\tdecoder := codec.NewDecoderBytes(data, x.cbor)\n\tvar wire map[string]interface{}\n\tdecoder.MustDecode(&wire)\n\tresponse := dest.(*Response)\n\tresponse.ID = uint(wire[\"id\"].(uint64))\n\tresponse.Result = wire[\"result\"]\n\tif wire[\"error\"] != nil {\n\t\terrorDict := wire[\"error\"].(map[string]interface{})\n\t\tresponse.Error = string(errorDict[\"message\"].([]byte))\n\t}\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\t// Set JSON type\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\t// Check error\n\tif e, ok := response.(errorer); ok {\n\t\t// This is a errorer class, now check for error\n\t\tif err := e.error(); err != nil {\n\t\t\tencodeError(ctx, e.error(), w)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// cast to dataHolder to get Data, otherwise just encode the resposne\n\tif holder, ok := response.(dataHolder); ok {\n\t\treturn json.NewEncoder(w).Encode(holder.getData())\n\t} else {\n\t\treturn json.NewEncoder(w).Encode(response)\n\t}\n}", "func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\n\tif e, ok := response.(Errorer); ok {\n\t\t// Not a Go kit transport error, but a business-logic error.\n\t\t// Provide those as HTTP errors.\n\t\tEncodeError(ctx, e.Error, w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tw.WriteHeader(http.StatusOK)\n\treturn json.NewEncoder(w).Encode(response)\n}", "func (subr *SRRecordResponse) Encode() (b []byte, err error) {\n\tbuffer := new(bytes.Buffer)\n\tif err = binary.Write(buffer, binary.LittleEndian, subr.ConfirmedRecordNumber); err != nil {\n\t\treturn nil, fmt.Errorf(\"EGTS_SR_RECORD_RESPONSE; Error writing CRN\")\n\t}\n\tif err = buffer.WriteByte(subr.RecordStatus); err != nil {\n\t\treturn nil, fmt.Errorf(\"EGTS_SR_RECORD_RESPONSE; Error writing RST\")\n\t}\n\treturn buffer.Bytes(), nil\n}", "func EncodeResolveResponse(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.(*sensorviews.SavedBookmark)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewResolveResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeUploadResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\t\tlogrus.Warn(err.Error())\n\t\t}\n\treturn\n}", "func (res *AddResponse) Encode(_ context.Context, w ResponseWriter) error {\n\treturn w.WriteError(ldaputil.ApplicationAddResponse, errors.New(\"not implemented\"))\n}", "func (m *Response) Encode() ([]byte, error) {\n\treturn msgpack.Marshal(m)\n}", "func EncodeSecureResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(string)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (t ExpireDelegationTokenResponse) Encode(e *Encoder, version int16) {\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\te.PutInt64(t.ExpiryTimestampMs) // ExpiryTimestampMs\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n}", "func (t DescribeConfigsResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t// Results\n\tlen1 := len(t.Results)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Results[i].Encode(e, version)\n\t}\n}", "func encodeGetUserDealByStateResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func (t OffsetFetchResponse) Encode(e *Encoder, version int16) {\n\tif version >= 3 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\t// Topics\n\tlen1 := len(t.Topics)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Topics[i].Encode(e, version)\n\t}\n\tif version >= 2 {\n\t\te.PutInt16(t.ErrorCode) // ErrorCode\n\t}\n}", "func encodeRegisterResponse(_ context.Context, r interface{}) (interface{}, error) {\n\trs := r.(endpoint.RegisterResponse)\n\n\tif rs.Err != nil {\n\t\treturn &pb.RegisterReply{\n\t\t\tMessage: rs.Err.Error(),\n\t\t\tStatus: \"ERROR\",\n\t\t}, fmt.Errorf(\"Message: %v With Status: %v\", rs.Err.Error(), rs.Err)\n\t}\n\n\treturn &pb.RegisterReply{\n\t\tMessage: fmt.Sprintf(\"Hi %s %s We Send a SMS for verify your Phone!\", rs.Response.Name, rs.Response.LastName),\n\t\tStatus: \"SUCCESS\",\n\t}, nil\n}", "func EncodeNewNeatThingResponse(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.(*neatthingviews.NeatThing)\n\t\tw.Header().Set(\"goa-view\", res.View)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewNewNeatThingResponseBodyFull(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}" ]
[ "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.5767397", "0.5750917", "0.57071626", "0.56663686", "0.56426793", "0.5639952", "0.5637515", "0.56335825", "0.56218886", "0.5615568", "0.56153", "0.56134087", "0.56041783", "0.5589336", "0.5577177", "0.55649847", "0.5560306", "0.55524266", "0.55029225", "0.54894245", "0.5484495", "0.5480925", "0.5405095", "0.5405095", "0.53831196", "0.538147", "0.53812116", "0.53798", "0.53798", "0.537804", "0.53626484", "0.535078", "0.5309297", "0.53081703", "0.53081703", "0.5300761", "0.5287551", "0.52850175", "0.52838236", "0.5279864", "0.5267243", "0.5265124", "0.52638096", "0.52477705", "0.5243584", "0.5241853", "0.5238441", "0.5235637", "0.52290577", "0.5223137", "0.5216652", "0.52109224", "0.5205149", "0.51979077", "0.51952493", "0.5190584", "0.5179921", "0.51792014", "0.51791847", "0.5174071", "0.51646847", "0.5162082", "0.51617134", "0.51615214", "0.5156507", "0.5144811", "0.512945", "0.5124215", "0.51198274", "0.5115305", "0.5110074", "0.5106816", "0.51018906", "0.50998497", "0.50992674", "0.50961185", "0.5093597", "0.5093542", "0.50928366" ]
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 != nil {\n\t\treturn nil, err\n\t}\n\n\tsaIDReq, err := decodeServiceAccountIDReq(c, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.ServiceAccountID = saIDReq.ServiceAccountID\n\n\treturn req, nil\n}", "func DecodeUpdateRequest(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\tbody UpdateRequestBody\n\t\t\terr error\n\t\t)\n\t\terr = decoder(r).Decode(&body)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\treturn nil, goa.MissingPayloadError()\n\t\t\t}\n\t\t\treturn nil, goa.DecodePayloadError(err.Error())\n\t\t}\n\t\terr = ValidateUpdateRequestBody(&body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar (\n\t\t\ttoken string\n\t\t)\n\t\ttoken = r.Header.Get(\"Authorization\")\n\t\tif token == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewUpdatePayload(&body, token)\n\t\tif strings.Contains(payload.Token, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Token, \" \", 2)[1]\n\t\t\tpayload.Token = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func decodeUpdatePostRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.UpdatePostRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func decodeUpdateTagRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.UpdateTagRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func (msg *Update) Decode() ([]string, map[string]string, map[string]string, error) {\n\tif err := headerCheck(msg.header, updateHeader); err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\n\tmsgValues := make([]string, len(msg.header))\n\tfor idx, pair := range msg.header {\n\t\tmsgValues[idx] = pair.Value\n\t}\n\n\t// If additional service discovery arguments exist\n\tvar msgOldArgs map[string]string\n\tif len(msg.oldArgs) != 0 {\n\t\tmsgOldArgs = make(map[string]string, len(msg.oldArgs))\n\t\tfor _, pair := range msg.oldArgs {\n\t\t\tmsgOldArgs[pair.Key] = pair.Value\n\t\t}\n\t}\n\tvar msgNewArgs map[string]string\n\tif len(msg.newArgs) != 0 {\n\t\tmsgNewArgs = make(map[string]string, len(msg.newArgs))\n\t\tfor _, pair := range msg.newArgs {\n\t\t\tmsgNewArgs[pair.Key] = pair.Value\n\t\t}\n\t}\n\n\treturn msgValues, msgOldArgs, msgNewArgs, nil\n}", "func (t *UpdateMetadataRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.ControllerId, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ControllerEpoch, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 5 {\n\t\tt.BrokerEpoch, err = d.Int64()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif version >= 0 && version <= 4 {\n\t\t// UngroupedPartitionStates\n\t\tif n, err := d.ArrayLength(); err != nil {\n\t\t\treturn err\n\t\t} else if n >= 0 {\n\t\t\tt.UngroupedPartitionStates = make([]UpdateMetadataPartitionState6, n)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tvar item UpdateMetadataPartitionState6\n\t\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tt.UngroupedPartitionStates[i] = item\n\t\t\t}\n\t\t}\n\t}\n\tif version >= 5 {\n\t\t// TopicStates\n\t\tif n, err := d.ArrayLength(); err != nil {\n\t\t\treturn err\n\t\t} else if n >= 0 {\n\t\t\tt.TopicStates = make([]UpdateMetadataTopicState6, n)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tvar item UpdateMetadataTopicState6\n\t\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tt.TopicStates[i] = item\n\t\t\t}\n\t\t}\n\t}\n\t// LiveBrokers\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.LiveBrokers = make([]UpdateMetadataBroker6, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item UpdateMetadataBroker6\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.LiveBrokers[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func DecodeUpdateMessageRequest(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\tbody UpdateMessageRequestBody\n\t\t\terr error\n\t\t)\n\t\terr = decoder(r).Decode(&body)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\treturn nil, goa.MissingPayloadError()\n\t\t\t}\n\t\t\treturn nil, goa.DecodePayloadError(err.Error())\n\t\t}\n\t\terr = ValidateUpdateMessageRequestBody(&body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar (\n\t\t\tpostID int64\n\t\t\tauth string\n\n\t\t\tparams = mux.Vars(r)\n\t\t)\n\t\t{\n\t\t\tpostIDRaw := params[\"postId\"]\n\t\t\tv, err2 := strconv.ParseInt(postIDRaw, 10, 64)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"postID\", postIDRaw, \"integer\"))\n\t\t\t}\n\t\t\tpostID = v\n\t\t}\n\t\tauth = r.Header.Get(\"Authorization\")\n\t\tif auth == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewUpdateMessagePayload(&body, postID, auth)\n\t\tif strings.Contains(payload.Auth, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Auth, \" \", 2)[1]\n\t\t\tpayload.Auth = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func decodeUpdateKeyPersonRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.UpdateKeyPersonRequest)\n\treturn endpoints.UpdateKeyPersonRequest{ID: req.Id, KeyPerson: models.KeyPersonToORM(req.KeyPerson)}, nil\n}", "func decodeUpdateBookRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tbookId, err := parseBookId(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get bearer from headers\n\tbearer := parseBearer(r)\n\n\t///////////////////\n\t// Parse body\n\tvar updateBook updateBookRequest\n\tif err := json.NewDecoder(r.Body).Decode(&updateBook); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Set bookid on update request\n\tupdateBook.BookId = bookId\n\n\tupdateBook.Bearer = bearer\n\n\treturn updateBook, nil\n}", "func decodeUpdateJobPostRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.UpdateJobPostRequest)\n\treturn endpoints.UpdateJobPostRequest{ID: req.Id, JobPost: models.JobPostToORM(req.JobPost)}, nil\n}", "func DecodeUpdateDeviceLicenseRequest(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\tlicenseID int\n\t\t\terr error\n\n\t\t\tparams = mux.Vars(r)\n\t\t)\n\t\t{\n\t\t\tlicenseIDRaw := params[\"LicenseID\"]\n\t\t\tv, err2 := strconv.ParseInt(licenseIDRaw, 10, strconv.IntSize)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"licenseID\", licenseIDRaw, \"integer\"))\n\t\t\t}\n\t\t\tlicenseID = int(v)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewUpdateDeviceLicenseLicenseObject(licenseID)\n\n\t\treturn payload, nil\n\t}\n}", "func (_BaseAccessWallet *BaseAccessWalletFilterer) ParseUpdateRequest(log types.Log) (*BaseAccessWalletUpdateRequest, error) {\n\tevent := new(BaseAccessWalletUpdateRequest)\n\tif err := _BaseAccessWallet.contract.UnpackLog(event, \"UpdateRequest\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "func (t *FindCoordinatorRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.Key, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 1 {\n\t\tt.KeyType, err = d.Int8()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "func decodeUpdateCompanyRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.UpdateJobCompanyRequest)\n\treturn endpoints.UpdateCompanyRequest{ID: req.Id, Company: models.JobCompanyToORM(req.Company)}, nil\n}", "func parseTelegramRequest(r *http.Request) (*Update, error) {\n\tvar update Update\n\tif err := json.NewDecoder(r.Body).Decode(&update); err != nil {\n\t\tlog.Printf(\"could not decode incoming update %s\", err.Error())\n\t\treturn nil, err\n\t}\n\tif update.UpdateId == 0 {\n\t\tlog.Printf(\"invalid update id, got update id = 0\")\n\t\treturn nil, errors.New(\"invalid update id of 0 indicates failure to parse incoming update\")\n\t}\n\treturn &update, nil\n}", "func DecodeVMUpdateResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error) {\n\treturn func(resp *http.Response) (interface{}, error) {\n\t\tif restoreBody {\n\t\t\tb, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\tdefer func() {\n\t\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\t}()\n\t\t} else {\n\t\t\tdefer resp.Body.Close()\n\t\t}\n\t\tswitch resp.StatusCode {\n\t\tcase http.StatusOK:\n\t\t\treturn nil, nil\n\t\tdefault:\n\t\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\t\treturn nil, goahttp.ErrInvalidResponse(\"spin-registry\", \"vm_update\", resp.StatusCode, string(body))\n\t\t}\n\t}\n}", "func (s *Server) update(req *jsonrpc2.Request) (interface{}, error) {\n\tin := new(updateReq)\n\tif err := json.Unmarshal([]byte(*req.Params), in); err != nil {\n\t\treturn nil, err\n\t}\n\treturn nil, s.peer.Update(noContext, in.ID, in.State)\n}", "func BuildUpdatePayload(stationUpdateBody string, stationUpdateID string, stationUpdateAuth string) (*station.UpdatePayload, error) {\n\tvar err error\n\tvar body UpdateRequestBody\n\t{\n\t\terr = json.Unmarshal([]byte(stationUpdateBody), &body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid JSON for body, example of valid JSON:\\n%s\", \"'{\\n \\\"location_name\\\": \\\"Et deserunt sequi est sunt qui.\\\",\\n \\\"name\\\": \\\"Facilis hic ea incidunt saepe et.\\\",\\n \\\"status_json\\\": {\\n \\\"Sapiente tempore a dicta culpa aperiam incidunt.\\\": \\\"Repudiandae nam delectus quasi explicabo adipisci sunt.\\\"\\n },\\n \\\"status_pb\\\": \\\"Ut quae sunt in officia perspiciatis maiores.\\\"\\n }'\")\n\t\t}\n\t\tif body.StatusJSON == nil {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"status_json\", \"body\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tvar id int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(stationUpdateID, 10, 32)\n\t\tid = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for id, must be INT32\")\n\t\t}\n\t}\n\tvar auth string\n\t{\n\t\tauth = stationUpdateAuth\n\t}\n\tv := &station.UpdatePayload{\n\t\tName: body.Name,\n\t\tLocationName: body.LocationName,\n\t\tStatusPb: body.StatusPb,\n\t}\n\tif body.StatusJSON != nil {\n\t\tv.StatusJSON = make(map[string]interface{}, len(body.StatusJSON))\n\t\tfor key, val := range body.StatusJSON {\n\t\t\ttk := key\n\t\t\ttv := val\n\t\t\tv.StatusJSON[tk] = tv\n\t\t}\n\t}\n\tv.ID = id\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func decodePutDealStateRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.PutDealStateRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func UnmarshalFilterUpdateInput(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(FilterUpdateInput)\n\terr = core.UnmarshalPrimitive(m, \"id\", &obj.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"expression\", &obj.Expression)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"description\", &obj.Description)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"paused\", &obj.Paused)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func (_Container *ContainerFilterer) ParseUpdateRequest(log types.Log) (*ContainerUpdateRequest, error) {\n\tevent := new(ContainerUpdateRequest)\n\tif err := _Container.contract.UnpackLog(event, \"UpdateRequest\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "func (_BaseLibrary *BaseLibraryFilterer) ParseUpdateRequest(log types.Log) (*BaseLibraryUpdateRequest, error) {\n\tevent := new(BaseLibraryUpdateRequest)\n\tif err := _BaseLibrary.contract.UnpackLog(event, \"UpdateRequest\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "func (t *RenewDelegationTokenRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.Hmac, err = d.Bytes()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.RenewPeriodMs, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func (t *ApiVersionsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tif version >= 3 {\n\t\tt.ClientSoftwareName, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif version >= 3 {\n\t\tt.ClientSoftwareVersion, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "func DecodeStationMetaRequest(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\tstations *string\n\t\t)\n\t\tstationsRaw := r.URL.Query().Get(\"stations\")\n\t\tif stationsRaw != \"\" {\n\t\t\tstations = &stationsRaw\n\t\t}\n\t\tpayload := NewStationMetaPayload(stations)\n\n\t\treturn payload, nil\n\t}\n}", "func (t *HeartbeatRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.GroupId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.GenerationId, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.MemberId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 3 {\n\t\tt.GroupInstanceId, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "func (_BaseContentSpace *BaseContentSpaceFilterer) ParseUpdateRequest(log types.Log) (*BaseContentSpaceUpdateRequest, error) {\n\tevent := new(BaseContentSpaceUpdateRequest)\n\tif err := _BaseContentSpace.contract.UnpackLog(event, \"UpdateRequest\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "func BuildUpdatePayload(stationUpdateBody string, stationUpdateID string, stationUpdateAuth string) (*station.UpdatePayload, error) {\n\tvar err error\n\tvar body UpdateRequestBody\n\t{\n\t\terr = json.Unmarshal([]byte(stationUpdateBody), &body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid JSON for body, \\nerror: %s, \\nexample of valid JSON:\\n%s\", err, \"'{\\n \\\"description\\\": \\\"Dignissimos qui nihil commodi veritatis necessitatibus.\\\",\\n \\\"locationName\\\": \\\"Eum ex ut aperiam.\\\",\\n \\\"name\\\": \\\"Omnis beatae in error deserunt.\\\",\\n \\\"statusPb\\\": \\\"Qui similique nobis.\\\"\\n }'\")\n\t\t}\n\t}\n\tvar id int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(stationUpdateID, 10, 32)\n\t\tid = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for id, must be INT32\")\n\t\t}\n\t}\n\tvar auth string\n\t{\n\t\tauth = stationUpdateAuth\n\t}\n\tv := &station.UpdatePayload{\n\t\tName: body.Name,\n\t\tLocationName: body.LocationName,\n\t\tStatusPb: body.StatusPb,\n\t\tDescription: body.Description,\n\t}\n\tv.ID = id\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func (t *ControlledShutdownRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.BrokerId, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 2 {\n\t\tt.BrokerEpoch, err = d.Int64()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "func DecodeUpdateResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error) {\n\treturn func(resp *http.Response) (interface{}, error) {\n\t\tif restoreBody {\n\t\t\tb, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\tdefer func() {\n\t\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\t}()\n\t\t} else {\n\t\t\tdefer resp.Body.Close()\n\t\t}\n\t\tswitch resp.StatusCode {\n\t\tcase http.StatusNoContent:\n\t\t\treturn nil, nil\n\t\tdefault:\n\t\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\t\treturn nil, goahttp.ErrInvalidResponse(\"blog\", \"update\", resp.StatusCode, string(body))\n\t\t}\n\t}\n}", "func (pkt *SubModRequest) Decode(bytes []byte) (err error) {\n\tvar used int\n\toffset := 4 // header\n\n\tpkt.XID, used, err = XdrGetUint32(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.SubID, used, err = XdrGetInt64(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.Expression, used, err = XdrGetString(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.AcceptInsecure, used, err = XdrGetBool(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.AddKeys, used, err = XdrGetKeys(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.DelKeys, used, err = XdrGetKeys(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\treturn nil\n}", "func (t *ListOffsetRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.ReplicaId, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 2 {\n\t\tt.IsolationLevel, err = d.Int8()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]ListOffsetTopic2, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item ListOffsetTopic2\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func UnmarshalWorkspaceStatusUpdateRequest(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(WorkspaceStatusUpdateRequest)\n\terr = core.UnmarshalPrimitive(m, \"frozen\", &obj.Frozen)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"frozen_at\", &obj.FrozenAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"frozen_by\", &obj.FrozenBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"locked\", &obj.Locked)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"locked_by\", &obj.LockedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"locked_time\", &obj.LockedTime)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func DecodeGRPCUpdateUserInfoRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.UpdateUserInfoParams)\n\treturn req, nil\n}", "func (t *OffsetCommitRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.GroupId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 1 {\n\t\tt.GenerationId, err = d.Int32()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif version >= 1 {\n\t\tt.MemberId, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif version >= 7 {\n\t\tt.GroupInstanceId, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif version >= 2 && version <= 4 {\n\t\tt.RetentionTimeMs, err = d.Int64()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]OffsetCommitRequestTopic8, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item OffsetCommitRequestTopic8\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func (_BaseContentType *BaseContentTypeFilterer) ParseUpdateRequest(log types.Log) (*BaseContentTypeUpdateRequest, error) {\n\tevent := new(BaseContentTypeUpdateRequest)\n\tif err := _BaseContentType.contract.UnpackLog(event, \"UpdateRequest\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "func DecodeChangeRequest(_ context.Context, r *http.Request) (req interface{}, err error) {\n\tt := da.DA{}\n\terr = json.NewDecoder(r.Body).Decode(&t)\n\treq = endpoints.ChangeRequest{Id: mux.Vars(r)[\"id\"], Req: t}\n\treturn req, err\n}", "func (a *ChangeRequest) Decode(src []byte) (int, error) {\n\t//binary.BigEndian.Uint16(src[0:2]) type\n\t//len := binary.BigEndian.Uint16(src[2:4]) //length\n\t//skip 3 byte\n\tswitch src[7] {\n\tcase 0:\n\t\tbreak\n\tcase 2:\n\t\ta.ChangePort = true\n\tcase 4:\n\t\ta.ChangeIP = true\n\tcase 6:\n\t\ta.ChangeIP = true\n\t\ta.ChangePort = true\n\t}\n\treturn 8, nil\n}", "func DecodeUpdateDeviceLicenseWithValueRequest(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\tlicenseID int\n\t\t\tconsumptionValue int\n\t\t\terr error\n\n\t\t\tparams = mux.Vars(r)\n\t\t)\n\t\t{\n\t\t\tlicenseIDRaw := params[\"LicenseID\"]\n\t\t\tv, err2 := strconv.ParseInt(licenseIDRaw, 10, strconv.IntSize)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"licenseID\", licenseIDRaw, \"integer\"))\n\t\t\t}\n\t\t\tlicenseID = int(v)\n\t\t}\n\t\t{\n\t\t\tconsumptionValueRaw := params[\"ConsumptionValue\"]\n\t\t\tv, err2 := strconv.ParseInt(consumptionValueRaw, 10, strconv.IntSize)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"consumptionValue\", consumptionValueRaw, \"integer\"))\n\t\t\t}\n\t\t\tconsumptionValue = int(v)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewUpdateDeviceLicenseWithValueLicenseConsumption(licenseID, consumptionValue)\n\n\t\treturn payload, nil\n\t}\n}", "func decodeCalculatorRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\n\ta, ok := vars[\"a\"]\n\tif !ok {\n\t\treturn nil, ErrBadRouting\n\t}\n\n\tb, ok := vars[\"b\"]\n\tif !ok {\n\t\treturn nil, ErrBadRouting\n\t}\n\n\taint, _ := strconv.Atoi(a)\n\tbint, _ := strconv.Atoi(b)\n\treturn CalculatorRequest{\n\t\tA: aint,\n\t\tB: bint,\n\t}, nil\n}", "func (_BaseContent *BaseContentFilterer) ParseUpdateRequest(log types.Log) (*BaseContentUpdateRequest, error) {\n\tevent := new(BaseContentUpdateRequest)\n\tif err := _BaseContent.contract.UnpackLog(event, \"UpdateRequest\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "func (_Editable *EditableFilterer) ParseUpdateRequest(log types.Log) (*EditableUpdateRequest, error) {\n\tevent := new(EditableUpdateRequest)\n\tif err := _Editable.contract.UnpackLog(event, \"UpdateRequest\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "func (t *AddOffsetsToTxnRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TransactionalId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerId, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerEpoch, err = d.Int16()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.GroupId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func DecodeUnsealRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.UnsealRequest)\n\treturn &endpoints.UnsealRequest{Key: req.Key, Reset: req.Reset_}, nil\n}", "func (t *ExpireDelegationTokenRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.Hmac, err = d.Bytes()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ExpiryTimePeriodMs, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func DecodeGetInfoRequest(ctx context.Context, v interface{}, md metadata.MD) (interface{}, error) {\n\tvar (\n\t\tmessage *table_infopb.GetInfoRequest\n\t\tok bool\n\t)\n\t{\n\t\tif message, ok = v.(*table_infopb.GetInfoRequest); !ok {\n\t\t\treturn nil, goagrpc.ErrInvalidType(\"TableInfo\", \"get_info\", \"*table_infopb.GetInfoRequest\", v)\n\t\t}\n\t}\n\tvar payload *tableinfo.GetInfoPayload\n\t{\n\t\tpayload = NewGetInfoPayload(message)\n\t}\n\treturn payload, nil\n}", "func (t *UpdateMetadataEndpoint6) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tif version >= 1 {\n\t\tt.Port, err = d.Int32()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif version >= 1 {\n\t\tt.Host, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif version >= 3 {\n\t\tt.Listener, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif version >= 1 {\n\t\tt.SecurityProtocol, err = d.Int16()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "func (t *OffsetForLeaderEpochRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tif version >= 3 {\n\t\tt.ReplicaId, err = d.Int32()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]OffsetForLeaderTopic23, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item OffsetForLeaderTopic23\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func (t *ElectLeadersRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tif version >= 1 {\n\t\tt.ElectionType, err = d.Int8()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// TopicPartitions\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.TopicPartitions = make([]TopicPartitions43, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item TopicPartitions43\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.TopicPartitions[i] = item\n\t\t}\n\t}\n\tt.TimeoutMs, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func (t *AlterConfigsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\t// Resources\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Resources = make([]AlterConfigsResource33, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item AlterConfigsResource33\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Resources[i] = item\n\t\t}\n\t}\n\tt.ValidateOnly, err = d.Bool()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func DecodeUpdates(buf *bin.Buffer) (UpdatesClass, error) {\n\tid, err := buf.PeekID()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tswitch id {\n\tcase UpdatesTooLongTypeID:\n\t\t// Decoding updatesTooLong#e317af7e.\n\t\tv := UpdatesTooLong{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode UpdatesClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase UpdateShortMessageTypeID:\n\t\t// Decoding updateShortMessage#313bc7f8.\n\t\tv := UpdateShortMessage{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode UpdatesClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase UpdateShortChatMessageTypeID:\n\t\t// Decoding updateShortChatMessage#4d6deea5.\n\t\tv := UpdateShortChatMessage{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode UpdatesClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase UpdateShortTypeID:\n\t\t// Decoding updateShort#78d4dec1.\n\t\tv := UpdateShort{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode UpdatesClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase UpdatesCombinedTypeID:\n\t\t// Decoding updatesCombined#725b04c3.\n\t\tv := UpdatesCombined{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode UpdatesClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase UpdatesTypeID:\n\t\t// Decoding updates#74ae4240.\n\t\tv := Updates{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode UpdatesClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tcase UpdateShortSentMessageTypeID:\n\t\t// Decoding updateShortSentMessage#9015e101.\n\t\tv := UpdateShortSentMessage{}\n\t\tif err := v.Decode(buf); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode UpdatesClass: %w\", err)\n\t\t}\n\t\treturn &v, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unable to decode UpdatesClass: %w\", bin.NewUnexpectedID(id))\n\t}\n}", "func (_BaseAccessControlGroup *BaseAccessControlGroupFilterer) ParseUpdateRequest(log types.Log) (*BaseAccessControlGroupUpdateRequest, error) {\n\tevent := new(BaseAccessControlGroupUpdateRequest)\n\tif err := _BaseAccessControlGroup.contract.UnpackLog(event, \"UpdateRequest\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "func DecodeRequest[I any](ctx context.Context, r *http.Request) (in I, err error) {\n\tswitch r.Method {\n\tcase \"POST\", \"PUT\", \"PATCH\":\n\t\terr = magic.Decode(r, &in,\n\t\t\tmagic.JSON,\n\t\t\tmagic.ChiRouter,\n\t\t)\n\tcase \"GET\", \"DELETE\":\n\t\terr = magic.Decode(r, &in,\n\t\t\tmagic.QueryParams,\n\t\t\tmagic.ChiRouter,\n\t\t)\n\tdefault:\n\t\terr = errors.Errorf(\"method %s not supported\", r.Method)\n\t}\n\n\tif err == io.EOF {\n\t\terr = errors.New(\"empty body\")\n\t}\n\n\treturn in, errors.E(err, \"can not unmarshal request\", errors.Unmarshal)\n}", "func (t *TxnOffsetCommitRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TransactionalId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.GroupId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerId, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerEpoch, err = d.Int16()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]TxnOffsetCommitRequestTopic28, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item TxnOffsetCommitRequestTopic28\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func (t *SyncGroupRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.GroupId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.GenerationId, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.MemberId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 3 {\n\t\tt.GroupInstanceId, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Assignments\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Assignments = make([]SyncGroupRequestAssignment14, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item SyncGroupRequestAssignment14\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Assignments[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func (mh *MessageHandler) decodeRequest(httpRequest *http.Request) (deviceRequest *Request, err error) {\n\tdeviceRequest, err = DecodeRequest(httpRequest.Body, mh.Decoders)\n\tif err == nil {\n\t\tdeviceRequest = deviceRequest.WithContext(httpRequest.Context())\n\t}\n\n\treturn\n}", "func (t *EndTxnRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TransactionalId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerId, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerEpoch, err = d.Int16()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.Committed, err = d.Bool()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func (pkt *SubDelRequest) Decode(bytes []byte) (err error) {\n\tvar used int\n\toffset := 4 // header\n\n\tpkt.XID, used, err = XdrGetUint32(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.SubID, used, err = XdrGetInt64(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\treturn nil\n}", "func (t *StopReplicaRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.ControllerId, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ControllerEpoch, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 1 {\n\t\tt.BrokerEpoch, err = d.Int64()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tt.DeletePartitions, err = d.Bool()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 0 && version <= 0 {\n\t\t// UngroupedPartitions\n\t\tif n, err := d.ArrayLength(); err != nil {\n\t\t\treturn err\n\t\t} else if n >= 0 {\n\t\t\tt.UngroupedPartitions = make([]StopReplicaPartitionV05, n)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tvar item StopReplicaPartitionV05\n\t\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tt.UngroupedPartitions[i] = item\n\t\t\t}\n\t\t}\n\t}\n\tif version >= 1 {\n\t\t// Topics\n\t\tif n, err := d.ArrayLength(); err != nil {\n\t\t\treturn err\n\t\t} else if n >= 0 {\n\t\t\tt.Topics = make([]StopReplicaTopic5, n)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tvar item StopReplicaTopic5\n\t\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tt.Topics[i] = item\n\t\t\t}\n\t\t}\n\t}\n\treturn err\n}", "func UnmarshalTemplateRepoUpdateRequest(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(TemplateRepoUpdateRequest)\n\terr = core.UnmarshalPrimitive(m, \"branch\", &obj.Branch)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"release\", &obj.Release)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"repo_sha_value\", &obj.RepoShaValue)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"repo_url\", &obj.RepoURL)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"url\", &obj.URL)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func DecodeRequest(source io.Reader, format wrp.Format) (*Request, error) {\n\tcontents, err := io.ReadAll(source)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// nolint: typecheck\n\tmessage := new(wrp.Message)\n\tif err := wrp.NewDecoderBytes(contents, format).Decode(message); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// nolint: typecheck\n\terr = wrp.UTF8(message)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Request{\n\t\tMessage: message,\n\t\tFormat: format,\n\t\tContents: contents,\n\t}, nil\n}", "func DecodeInitRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.InitRequest)\n\topts := service.InitOptions{\n\t\tSecretShares: int(req.SecretShares),\n\t\tSecretThreshold: int(req.SecretThreshold),\n\t\tStoredShares: int(req.StoredShares),\n\t\tPGPKeys: req.PgpKeys,\n\t\tRecoveryShares: int(req.RecoveryShares),\n\t\tRecoveryThreshold: int(req.RecoveryThreshold),\n\t\tRecoveryPGPKeys: req.RecoveryPgpKeys,\n\t\tRootTokenPGPKey: req.RootTokenPgpKey,\n\t\tRootTokenHolderEmail: req.RootTokenHolderEmail,\n\t\tSecretKeyHolderEmails: req.SecretKeyHolderEmails,\n\t}\n\treturn &endpoints.InitRequest{Opts: opts}, nil\n}", "func DecodeUpdateDeviceResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error) {\n\treturn func(resp *http.Response) (interface{}, error) {\n\t\tif restoreBody {\n\t\t\tb, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\tdefer func() {\n\t\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\t}()\n\t\t} else {\n\t\t\tdefer resp.Body.Close()\n\t\t}\n\t\tswitch resp.StatusCode {\n\t\tcase http.StatusOK:\n\t\t\tvar (\n\t\t\t\tbody UpdateDeviceResponseBody\n\t\t\t\terr error\n\t\t\t)\n\t\t\terr = decoder(resp).Decode(&body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, goahttp.ErrDecodingError(\"chargewatch\", \"updateDevice\", err)\n\t\t\t}\n\t\t\terr = ValidateUpdateDeviceResponseBody(&body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, goahttp.ErrValidationError(\"chargewatch\", \"updateDevice\", err)\n\t\t\t}\n\t\t\tres := NewUpdateDeviceResultOK(&body)\n\t\t\treturn res, nil\n\t\tdefault:\n\t\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\t\treturn nil, goahttp.ErrInvalidResponse(\"chargewatch\", \"updateDevice\", resp.StatusCode, string(body))\n\t\t}\n\t}\n}", "func decodeGetEventsRequest(_ context.Context, r interface{}) (interface{}, error) {\r\n\treturn nil, errors.New(\"'Events' Decoder is not impelemented\")\r\n}", "func decodeRequestQuery(r *http.Request, v interface{}) error {\n\tif err := schema.NewDecoder().Decode(v, r.URL.Query()); err != nil {\n\t\tlog.WithField(\"err\", err).Info(\"Invalid request query\")\n\t\treturn err\n\t}\n\treturn nil\n}", "func decodeRequest(r io.Reader) *plugin.CodeGeneratorRequest {\n\tvar req plugin.CodeGeneratorRequest\n\tinput, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\tlog.Fatal(\"unable to read stdin: \" + err.Error())\n\t}\n\tif err := proto.Unmarshal(input, &req); err != nil {\n\t\tlog.Fatal(\"unable to marshal stdin as protobuf: \" + err.Error())\n\t}\n\treturn &req\n}", "func decodeRequest(_ context.Context, r *http.Request) (request interface{}, err error) {\n\tdefer r.Body.Close()\n\treturn nil, nil\n}", "func UnmarshalConfigUpdate(data []byte) (*cb.ConfigUpdate, error) {\n\tconfigUpdate := &cb.ConfigUpdate{}\n\terr := proto.Unmarshal(data, configUpdate)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn configUpdate, nil\n}", "func DecodeRefreshRequest(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\ttoken string\n\t\t\terr error\n\t\t)\n\t\ttoken = r.Header.Get(\"Authorization\")\n\t\tif token == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewRefreshPayload(token)\n\t\tif strings.Contains(payload.Token, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Token, \" \", 2)[1]\n\t\t\tpayload.Token = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func DecodeRemoveRequest(_ context.Context, r *http.Request) (req interface{}, err error) {\n\treq = endpoints.RemoveRequest{Id: mux.Vars(r)[\"id\"]}\n\t//err = json.NewDecoder(r.Body).Decode(&r)\n\treturn req, err\n}", "func UnmarshalBGPUpdate(b []byte) (*Update, error) {\n\tif glog.V(6) {\n\t\tglog.Infof(\"BGPUpdate Raw: %s\", tools.MessageHex(b))\n\t}\n\tp := 0\n\tu := Update{}\n\tu.WithdrawnRoutesLength = binary.BigEndian.Uint16(b[p : p+2])\n\tp += 2\n\twdr, err := base.UnmarshalRoutes(b[p : p+int(u.WithdrawnRoutesLength)])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tu.WithdrawnRoutes = wdr\n\tp += int(u.WithdrawnRoutesLength)\n\tu.TotalPathAttributeLength = binary.BigEndian.Uint16(b[p : p+2])\n\tp += 2\n\tattrs, err := UnmarshalBGPPathAttributes(b[p : p+int(u.TotalPathAttributeLength)])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Building BGP's update Base attributes struct which is common to all messages\n\tbaseAttrs, err := UnmarshalBGPBaseAttributes(b[p : p+int(u.TotalPathAttributeLength)])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tu.PathAttributes = attrs\n\tu.BaseAttributes = baseAttrs\n\tp += int(u.TotalPathAttributeLength)\n\troutes, err := base.UnmarshalRoutes(b[p:])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tu.NLRI = routes\n\n\treturn &u, nil\n}", "func (_Container *ContainerTransactor) UpdateRequest(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Container.contract.Transact(opts, \"updateRequest\")\n}", "func (_BaseAccessWallet *BaseAccessWalletTransactor) UpdateRequest(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _BaseAccessWallet.contract.Transact(opts, \"updateRequest\")\n}", "func (_BaseAccessWallet *BaseAccessWalletFilterer) FilterUpdateRequest(opts *bind.FilterOpts) (*BaseAccessWalletUpdateRequestIterator, error) {\n\n\tlogs, sub, err := _BaseAccessWallet.contract.FilterLogs(opts, \"UpdateRequest\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &BaseAccessWalletUpdateRequestIterator{contract: _BaseAccessWallet.contract, event: \"UpdateRequest\", logs: logs, sub: sub}, nil\n}", "func (b *Base) DecryptUpdate(req *DecryptUpdateReq) (*DecryptUpdateResp, error) {\n\treturn nil, ErrFunctionNotSupported\n}", "func DecodeDeleteRequest(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\tauth string\n\t\t\terr error\n\n\t\t\tparams = mux.Vars(r)\n\t\t)\n\t\t{\n\t\t\tstationIDRaw := params[\"stationId\"]\n\t\t\tv, err2 := strconv.ParseInt(stationIDRaw, 10, 32)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"stationID\", stationIDRaw, \"integer\"))\n\t\t\t}\n\t\t\tstationID = int32(v)\n\t\t}\n\t\tauth = r.Header.Get(\"Authorization\")\n\t\tif auth == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewDeletePayload(stationID, auth)\n\t\tif strings.Contains(payload.Auth, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Auth, \" \", 2)[1]\n\t\t\tpayload.Auth = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func readUpdate(message []byte) *updateMessage {\n\tbuf := bytes.NewBuffer(message)\n\tupdate := new(updateMessage)\n\tupdate.withdrawnRoutesLength = stream.ReadUint16(buf)\n\tupdate.withdrawnRoutes = readWithdrawnRoutes(\n\t\tint(update.withdrawnRoutesLength),\n\t\tstream.ReadBytes(int(update.withdrawnRoutesLength), buf),\n\t)\n\tupdate.pathAttributesLength = stream.ReadUint16(buf)\n\tupdate.pathAttributes = readPathAttributes(\n\t\tint(update.pathAttributesLength),\n\t\tstream.ReadBytes(int(update.pathAttributesLength), buf),\n\t)\n\t// TODO: Add reading path attributes\n\t// TODO: Add reading NLRIs\n\treturn update\n}", "func (t *CreateDelegationTokenRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\t// Renewers\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Renewers = make([]CreatableRenewers38, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item CreatableRenewers38\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Renewers[i] = item\n\t\t}\n\t}\n\tt.MaxLifetimeMs, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func newUpdateUrlMapUpdateRequest(ctx context.Context, f *UrlMap, c *Client) (map[string]interface{}, error) {\n\treq := map[string]interface{}{}\n\n\tif v, err := expandUrlMapDefaultRouteAction(c, f.DefaultRouteAction); err != nil {\n\t\treturn nil, fmt.Errorf(\"error expanding DefaultRouteAction into defaultRouteAction: %w\", err)\n\t} else if !dcl.IsEmptyValueIndirect(v) {\n\t\treq[\"defaultRouteAction\"] = v\n\t}\n\tif v := f.DefaultService; !dcl.IsEmptyValueIndirect(v) {\n\t\treq[\"defaultService\"] = v\n\t}\n\tif v, err := expandUrlMapDefaultUrlRedirect(c, f.DefaultUrlRedirect); err != nil {\n\t\treturn nil, fmt.Errorf(\"error expanding DefaultUrlRedirect into defaultUrlRedirect: %w\", err)\n\t} else if !dcl.IsEmptyValueIndirect(v) {\n\t\treq[\"defaultUrlRedirect\"] = v\n\t}\n\tif v := f.Description; !dcl.IsEmptyValueIndirect(v) {\n\t\treq[\"description\"] = v\n\t}\n\tif v, err := expandUrlMapHeaderAction(c, f.HeaderAction); err != nil {\n\t\treturn nil, fmt.Errorf(\"error expanding HeaderAction into headerAction: %w\", err)\n\t} else if !dcl.IsEmptyValueIndirect(v) {\n\t\treq[\"headerAction\"] = v\n\t}\n\tif v, err := expandUrlMapHostRuleSlice(c, f.HostRule); err != nil {\n\t\treturn nil, fmt.Errorf(\"error expanding HostRule into hostRules: %w\", err)\n\t} else if !dcl.IsEmptyValueIndirect(v) {\n\t\treq[\"hostRules\"] = v\n\t}\n\tif v := f.Name; !dcl.IsEmptyValueIndirect(v) {\n\t\treq[\"name\"] = v\n\t}\n\tif v, err := expandUrlMapPathMatcherSlice(c, f.PathMatcher); err != nil {\n\t\treturn nil, fmt.Errorf(\"error expanding PathMatcher into pathMatchers: %w\", err)\n\t} else if !dcl.IsEmptyValueIndirect(v) {\n\t\treq[\"pathMatchers\"] = v\n\t}\n\tif v, err := expandUrlMapTestSlice(c, f.Test); err != nil {\n\t\treturn nil, fmt.Errorf(\"error expanding Test into tests: %w\", err)\n\t} else if !dcl.IsEmptyValueIndirect(v) {\n\t\treq[\"tests\"] = v\n\t}\n\tb, err := c.getUrlMapRaw(ctx, f.urlNormalized())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar m map[string]interface{}\n\tif err := json.Unmarshal(b, &m); err != nil {\n\t\treturn nil, err\n\t}\n\trawFingerprint, err := dcl.GetMapEntry(\n\t\tm,\n\t\t[]string{\"fingerprint\"},\n\t)\n\tif err != nil {\n\t\tc.Config.Logger.Warningf(\"Failed to fetch from JSON Path: %v\", err)\n\t} else {\n\t\treq[\"fingerprint\"] = rawFingerprint.(string)\n\t}\n\treturn req, nil\n}", "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 (pkt *SubAddRequest) Decode(bytes []byte) (err error) {\n\tvar used int\n\toffset := 4 // header\n\n\tpkt.XID, used, err = XdrGetUint32(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.Expression, used, err = XdrGetString(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.AcceptInsecure, used, err = XdrGetBool(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.Keys, used, err = XdrGetKeys(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\treturn nil\n}", "func decodeGetDealByStateRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\tvals := r.URL.Query()\n\tstate := \"\"\n\tstates, okk := vals[\"state\"]\n\tif okk {\n\t\tstate = states[0]\n\t}\n\treq := endpoint.GetDealByStateRequest{\n\t\tState: state,\n\t}\n\treturn req, nil\n}", "func EncodeUpdateRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*warehouse.UpdatePayload)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"Warehouse\", \"Update\", \"*warehouse.UpdatePayload\", v)\n\t\t}\n\t\t{\n\t\t\thead := p.Token\n\t\t\tif !strings.Contains(head, \" \") {\n\t\t\t\treq.Header.Set(\"Authorization\", \"Bearer \"+head)\n\t\t\t} else {\n\t\t\t\treq.Header.Set(\"Authorization\", head)\n\t\t\t}\n\t\t}\n\t\tbody := NewUpdateRequestBody(p)\n\t\tif err := encoder(req).Encode(&body); err != nil {\n\t\t\treturn goahttp.ErrEncodingError(\"Warehouse\", \"Update\", err)\n\t\t}\n\t\treturn nil\n\t}\n}", "func (d decoder) Decode(req types.Request, into runtime.Object) error {\n\tdeserializer := d.codecs.UniversalDeserializer()\n\treturn runtime.DecodeInto(deserializer, req.AdmissionRequest.Object.Raw, into)\n}", "func (_BaseLibrary *BaseLibraryTransactor) UpdateRequest(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _BaseLibrary.contract.Transact(opts, \"updateRequest\")\n}", "func decodeAddRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\tzip, _ := strconv.Atoi(r.FormValue(\"ZipCode\"))\n\ttel, _ := strconv.Atoi(r.FormValue(\"EmployeeNumTel\"))\n\tEmergencyTel, _ := strconv.Atoi(r.FormValue(\"EmergencyContactTel\"))\n\tsalary, _ := strconv.ParseFloat(r.FormValue(\"EmployeeSalary\"), 32)\n\tiban, _ := strconv.Atoi(r.FormValue(\"EmployeeIban\"))\n\tbic, _ := strconv.Atoi(r.FormValue(\"EmployeeBic\"))\n\treq := endpoint.AddRequest{\n\t\tio.Employee{\n\t\t\tEmployeeName: r.FormValue(\"EmployeeName\"),\n\t\t\tEmployeeEmail: r.FormValue(\"EmployeeEmail\"),\n\t\t\tAddress: r.FormValue(\"Address\"),\n\t\t\tZipCode: zip,\n\t\t\tEmployeeBirthDate: r.FormValue(\"EmployeeBirthDate\"),\n\t\t\tEmployeeNumTel: tel,\n\t\t\tEmergencyContactName: r.FormValue(\"EmergencyContactName\"),\n\t\t\tEmergencyContactTel: EmergencyTel,\n\t\t\tEmployeeStartDate: r.FormValue(\"EmployeeStartDate\"),\n\t\t\tEmployeeSalary: salary,\n\t\t\tEmployeeIban: iban,\n\t\t\tEmployeeBic: bic,\n\t\t},\n\t}\n\treturn req, nil\n}", "func (r *Route) DecodeRequest(req interface{}) *Route {\n\tr.request = reflect.TypeOf(req)\n\tif r.request.Kind() != reflect.Ptr {\n\t\tpanic(\"request structure must be a pointer\")\n\t}\n\treturn r\n}", "func (t *UpdateMetadataResponse) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.ErrorCode, err = d.Int16()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func decodeSubRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\tvar req subRequest\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "func decodeAddRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.AddRequest{\n\t\tio.Department{\n\t\t\tDepartmentName: r.FormValue(\"DepartmentName\"),\n\t\t},\n\t}\n\treturn req, nil\n}", "func (*UpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_weather_proto_rawDescGZIP(), []int{6}\n}", "func decodeKeyPolicyUpdateData(r io.Reader) (*keyPolicyUpdateData, error) {\n\tvar header uint32\n\tif _, err := tpm2.UnmarshalFromReader(r, &header); err != nil {\n\t\treturn nil, xerrors.Errorf(\"cannot unmarshal header: %w\", err)\n\t}\n\tif header != keyPolicyUpdateDataHeader {\n\t\treturn nil, fmt.Errorf(\"unexpected header (%d)\", header)\n\t}\n\n\tvar d keyPolicyUpdateData\n\tif _, err := tpm2.UnmarshalFromReader(r, &d); err != nil {\n\t\treturn nil, xerrors.Errorf(\"cannot unmarshal data: %w\", err)\n\t}\n\n\treturn &d, nil\n}", "func decodeDeleteIndustryRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.DeleteIndustryRequest)\n\treturn endpoints.DeleteIndustryRequest{ID: req.Id}, nil\n}", "func decodeGetTagRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.GetTagRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func fromExternalUpdate(req *pb_req.UpdateRuleReq) (*authz.UpdateRuleReq, error) {\n\tt, err := fromExternalType(req.Type)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconditions, err := fromExternalConditions(req.Conditions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &authz.UpdateRuleReq{\n\t\tId: req.Id,\n\t\tName: req.Name,\n\t\tProjectId: req.ProjectId,\n\t\tType: t,\n\t\tConditions: conditions,\n\t}, nil\n}", "func (_BaseAccessWallet *BaseAccessWalletFilterer) WatchUpdateRequest(opts *bind.WatchOpts, sink chan<- *BaseAccessWalletUpdateRequest) (event.Subscription, error) {\n\n\tlogs, sub, err := _BaseAccessWallet.contract.WatchLogs(opts, \"UpdateRequest\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn event.NewSubscription(func(quit <-chan struct{}) error {\n\t\tdefer sub.Unsubscribe()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase log := <-logs:\n\t\t\t\t// New log arrived, parse the event and forward to the user\n\t\t\t\tevent := new(BaseAccessWalletUpdateRequest)\n\t\t\t\tif err := _BaseAccessWallet.contract.UnpackLog(event, \"UpdateRequest\", log); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevent.Raw = log\n\n\t\t\t\tselect {\n\t\t\t\tcase sink <- event:\n\t\t\t\tcase err := <-sub.Err():\n\t\t\t\t\treturn err\n\t\t\t\tcase <-quit:\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tcase err := <-sub.Err():\n\t\t\t\treturn err\n\t\t\tcase <-quit:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}), nil\n}", "func (req *FailoverLogRequest) Decode(data []byte) (err error) {\n\treturn proto.Unmarshal(data, req)\n}", "func (_BaseLibrary *BaseLibraryFilterer) FilterUpdateRequest(opts *bind.FilterOpts) (*BaseLibraryUpdateRequestIterator, error) {\n\n\tlogs, sub, err := _BaseLibrary.contract.FilterLogs(opts, \"UpdateRequest\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &BaseLibraryUpdateRequestIterator{contract: _BaseLibrary.contract, event: \"UpdateRequest\", logs: logs, sub: sub}, nil\n}", "func (_Container *ContainerFilterer) FilterUpdateRequest(opts *bind.FilterOpts) (*ContainerUpdateRequestIterator, error) {\n\n\tlogs, sub, err := _Container.contract.FilterLogs(opts, \"UpdateRequest\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ContainerUpdateRequestIterator{contract: _Container.contract, event: \"UpdateRequest\", logs: logs, sub: sub}, nil\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.5742189", "0.57358515", "0.5735293", "0.56595933", "0.5635777", "0.56324273", "0.56207186", "0.56171316", "0.56106895", "0.559874", "0.55925983", "0.55709916", "0.5565282", "0.55502933", "0.5541676", "0.5536648", "0.55353904", "0.5530325", "0.5504439", "0.54737306", "0.5468165", "0.5459539", "0.54134196", "0.5412457", "0.54077595", "0.54009014", "0.5397758", "0.5392801", "0.5371933", "0.53658", "0.5364988", "0.5353793", "0.5349846", "0.5349517", "0.5344631", "0.5308029", "0.53013194", "0.52981865", "0.52927524", "0.52690727", "0.5265515", "0.5262468", "0.5257464", "0.5257436", "0.5252118", "0.5236199", "0.52228683", "0.5222501", "0.52182436", "0.52086514", "0.5203062", "0.5202025", "0.518823", "0.51706153", "0.5166928", "0.5162884", "0.5147679", "0.5140561", "0.5139335", "0.513903", "0.5138976", "0.5136057", "0.51305884", "0.51128894", "0.5097733", "0.5097472", "0.50949097", "0.5094642", "0.5094323", "0.5089192", "0.5088669", "0.50868034", "0.5085765", "0.50818294", "0.50783217", "0.507798", "0.5076433", "0.50708556" ]
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.Handler {\n\tvar (\n\t\tdecodeRequest = DecodeListMineRequest(mux, decoder)\n\t\tencodeResponse = EncodeListMineResponse(encoder)\n\t\tencodeError = EncodeListMineError(encoder, formatter)\n\t)\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get(\"Accept\"))\n\t\tctx = context.WithValue(ctx, goa.MethodKey, \"list mine\")\n\t\tctx = context.WithValue(ctx, goa.ServiceKey, \"station\")\n\t\tpayload, err := decodeRequest(r)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tres, err := endpoint(ctx, payload)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif err := encodeResponse(ctx, w, res); err != nil {\n\t\t\terrhandler(ctx, w, err)\n\t\t}\n\t})\n}", "func EncodeListResponse(_ 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 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\t\tbody := NewListAllResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (c *Client) ListMine(ctx context.Context, p *ListMinePayload) (res *StationsFull, err error) {\n\tvar ires interface{}\n\tires, err = c.ListMineEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(*StationsFull), nil\n}", "func EncodeListProjectResponse(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.StationsFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListProjectResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeListProjectResponse(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.StationsFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListProjectResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeListResponse(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.(*inventory.ListResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListResponseBody(res)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeListResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.([]*pipeline.EnduroStoredPipeline)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListResponseBody(res)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (t WriteTxnMarkersResponse) Encode(e *Encoder, version int16) {\n\t// Markers\n\tlen0 := len(t.Markers)\n\te.PutArrayLength(len0)\n\tfor i := 0; i < len0; i++ {\n\t\tt.Markers[i].Encode(e, version)\n\t}\n}", "func (v NetworkListResponse) EncodeJSON(b []byte) []byte {\n\tb = append(b, '{', '\"', 'n', 'e', 't', 'w', 'o', 'r', 'k', '_', 'i', 'd', 'e', 'n', 't', 'i', 'f', 'i', 'e', 'r', 's', '\"', ':', '[')\n\tfor i, elem := range v.NetworkIdentifiers {\n\t\tif i != 0 {\n\t\t\tb = append(b, \",\"...)\n\t\t}\n\t\tb = elem.EncodeJSON(b)\n\t}\n\treturn append(b, \"]}\"...)\n}", "func (t ListOffsetResponse) Encode(e *Encoder, version int16) {\n\tif version >= 2 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\t// Topics\n\tlen1 := len(t.Topics)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Topics[i].Encode(e, version)\n\t}\n}", "func EncodeAddResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewAddResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeAddResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewAddResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (o *GenesisPeersListOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif payload == nil {\n\t\t// return empty array\n\t\tpayload = make([]*models.Peer, 0, 50)\n\t}\n\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "func BuildListMinePayload(stationListMineAuth string) (*station.ListMinePayload, error) {\n\tvar auth string\n\t{\n\t\tauth = stationListMineAuth\n\t}\n\tv := &station.ListMinePayload{}\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func BuildListMinePayload(stationListMineAuth string) (*station.ListMinePayload, error) {\n\tvar auth string\n\t{\n\t\tauth = stationListMineAuth\n\t}\n\tv := &station.ListMinePayload{}\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func EncodeNewNeatThingResponse(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.(*neatthingviews.NeatThing)\n\t\tw.Header().Set(\"goa-view\", res.View)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewNewNeatThingResponseBodyFull(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeGetAllOutput() string {\n\treturn `\n\t[\n\t\t{\n\t\t\t\"registered_from_address\": \"http://original-requester.example.net\",\n\t\t\t\"config\": {\n\t\t\t\t\"url\": \"http://deliver-here-0.example.net\",\n\t\t\t\t\"content_type\": \"application/json\",\n\t\t\t\t\"secret\": \"<obfuscated>\"\n\t\t\t},\n\t\t\t\"events\": [\"online\"],\n\t\t\t\"matcher\": {\n\t\t\t\t\"device_id\": [\"mac:aabbccddee.*\"]\n\t\t\t},\n\t\t\t\"failure_url\": \"http://contact-here-when-fails.example.net\",\n\t\t\t\"duration\": 0,\n\t\t\t\"until\": \"2021-01-02T15:04:10Z\"\n\t\t},\n\t\t{\n\t\t\t\"registered_from_address\": \"http://original-requester.example.net\",\n\t\t\t\"config\": {\n\t\t\t\t\"url\": \"http://deliver-here-1.example.net\",\n\t\t\t\t\"content_type\": \"application/json\",\n\t\t\t\t\"secret\": \"<obfuscated>\"\n\t\t\t},\n\t\t\t\"events\": [\"online\"],\n\t\t\t\"matcher\": {\n\t\t\t\t\"device_id\": [\"mac:aabbccddee.*\"]\n\t\t\t},\n\t\t\t\"failure_url\": \"http://contact-here-when-fails.example.net\",\n\t\t\t\"duration\": 0,\n\t\t\t\"until\": \"2021-01-02T15:04:20Z\"\n\t\t}\n\t]\n\t`\n}", "func DecodeListMineRequest(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\tauth string\n\t\t\terr error\n\t\t)\n\t\tauth = r.Header.Get(\"Authorization\")\n\t\tif auth == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewListMinePayload(auth)\n\t\tif strings.Contains(payload.Auth, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Auth, \" \", 2)[1]\n\t\t\tpayload.Auth = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func DecodeListMineRequest(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\tauth string\n\t\t\terr error\n\t\t)\n\t\tauth = r.Header.Get(\"Authorization\")\n\t\tif auth == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewListMinePayload(auth)\n\t\tif strings.Contains(payload.Auth, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Auth, \" \", 2)[1]\n\t\t\tpayload.Auth = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func (t ListGroupsResponse) Encode(e *Encoder, version int16) {\n\tif version >= 1 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\t// Groups\n\tlen2 := len(t.Groups)\n\te.PutArrayLength(len2)\n\tfor i := 0; i < len2; i++ {\n\t\tt.Groups[i].Encode(e, version)\n\t}\n}", "func EncodeStationMetaResponse(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.(*sensor.StationMetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeGrpcRespMetricsQueryList(ctx context.Context, response interface{}) (interface{}, error) {\n\treturn response, nil\n}", "func (fl *FlightList) returnJSONFlightList(w http.ResponseWriter, r *http.Request) {\n json.NewEncoder(w).Encode(fl)\n}", "func EncodeAddResponse(_ 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 (v MempoolResponse) EncodeJSON(b []byte) []byte {\n\tb = append(b, '{', '\"', 't', 'r', 'a', 'n', 's', 'a', 'c', 't', 'i', 'o', 'n', '_', 'i', 'd', 'e', 'n', 't', 'i', 'f', 'i', 'e', 'r', 's', '\"', ':', '[')\n\tfor i, elem := range v.TransactionIdentifiers {\n\t\tif i != 0 {\n\t\t\tb = append(b, \",\"...)\n\t\t}\n\t\tb = elem.EncodeJSON(b)\n\t}\n\treturn append(b, \"]}\"...)\n}", "func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n return json.NewEncoder(w).Encode(response)\n}", "func encodeListRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treturn nil, errors.New(\"'Users' Encoder is not impelemented\")\n}", "func EncodeLoginResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(string)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeListRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*warehouse.ListPayload)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"Warehouse\", \"List\", \"*warehouse.ListPayload\", v)\n\t\t}\n\t\t{\n\t\t\thead := p.Token\n\t\t\tif !strings.Contains(head, \" \") {\n\t\t\t\treq.Header.Set(\"Authorization\", \"Bearer \"+head)\n\t\t\t} else {\n\t\t\t\treq.Header.Set(\"Authorization\", head)\n\t\t\t}\n\t\t}\n\t\tvalues := req.URL.Query()\n\t\tif p.Cursor != nil {\n\t\t\tvalues.Add(\"cursor\", fmt.Sprintf(\"%v\", *p.Cursor))\n\t\t}\n\t\tif p.Limit != nil {\n\t\t\tvalues.Add(\"limit\", fmt.Sprintf(\"%v\", *p.Limit))\n\t\t}\n\t\treq.URL.RawQuery = values.Encode()\n\t\treturn nil\n\t}\n}", "func EncodeSigninResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(*securedservice.Creds)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewSigninResponseBody(res)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func MountListMineHandler(mux goahttp.Muxer, h http.Handler) {\n\tf, ok := handleStationOrigin(h).(http.HandlerFunc)\n\tif !ok {\n\t\tf = func(w http.ResponseWriter, r *http.Request) {\n\t\t\th.ServeHTTP(w, r)\n\t\t}\n\t}\n\tmux.Handle(\"GET\", \"/stations\", f)\n}", "func encodeAddResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeAddResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeGetByMultiCriteriaResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func (t FindCoordinatorResponse) Encode(e *Encoder, version int16) {\n\tif version >= 1 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\tif version >= 1 {\n\t\te.PutString(t.ErrorMessage) // ErrorMessage\n\t}\n\te.PutInt32(t.NodeId) // NodeId\n\te.PutString(t.Host) // Host\n\te.PutInt32(t.Port) // Port\n}", "func EncodeAddResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) kithttp.EncodeResponseFunc {\n\treturn server.EncodeAddResponse(encoder)\n}", "func (t DescribeDelegationTokenResponse) Encode(e *Encoder, version int16) {\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\t// Tokens\n\tlen1 := len(t.Tokens)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Tokens[i].Encode(e, version)\n\t}\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n}", "func (v NetworkStatusResponse) EncodeJSON(b []byte) []byte {\n\tb = append(b, '{', '\"', 'c', 'u', 'r', 'r', 'e', 'n', 't', '_', 'b', 'l', 'o', 'c', 'k', '_', 'i', 'd', 'e', 'n', 't', 'i', 'f', 'i', 'e', 'r', '\"', ':')\n\tb = v.CurrentBlockIdentifier.EncodeJSON(b)\n\tb = append(b, ',', '\"', 'c', 'u', 'r', 'r', 'e', 'n', 't', '_', 'b', 'l', 'o', 'c', 'k', '_', 't', 'i', 'm', 'e', 's', 't', 'a', 'm', 'p', '\"', ':')\n\tb = json.AppendInt(b, int64(v.CurrentBlockTimestamp))\n\tb = append(b, ',', '\"', 'g', 'e', 'n', 'e', 's', 'i', 's', '_', 'b', 'l', 'o', 'c', 'k', '_', 'i', 'd', 'e', 'n', 't', 'i', 'f', 'i', 'e', 'r', '\"', ':')\n\tb = v.GenesisBlockIdentifier.EncodeJSON(b)\n\tb = append(b, \",\"...)\n\tif v.OldestBlockIdentifier.Set {\n\t\tb = append(b, '\"', 'o', 'l', 'd', 'e', 's', 't', '_', 'b', 'l', 'o', 'c', 'k', '_', 'i', 'd', 'e', 'n', 't', 'i', 'f', 'i', 'e', 'r', '\"', ':')\n\t\tb = v.OldestBlockIdentifier.Value.EncodeJSON(b)\n\t\tb = append(b, \",\"...)\n\t}\n\tb = append(b, `\"peers\":[`...)\n\tfor i, elem := range v.Peers {\n\t\tif i != 0 {\n\t\t\tb = append(b, \",\"...)\n\t\t}\n\t\tb = elem.EncodeJSON(b)\n\t}\n\tb = append(b, \"],\"...)\n\tif v.SyncStatus.Set {\n\t\tb = append(b, `\"sync_status\":`...)\n\t\tb = v.SyncStatus.Value.EncodeJSON(b)\n\t\tb = append(b, \",\"...)\n\t}\n\tb[len(b)-1] = '}'\n\treturn b\n}", "func (t ListGroupsRequest) Encode(e *Encoder, version int16) {\n}", "func encodeGetDealByStateResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func respond(w http.ResponseWriter, r *http.Request, data []interface{}) error {\n\tpublicData := make([]interface{}, len(data))\n\tfor i, d := range data {\n\t\tpublicData[i] = meander.Public(d)\n\t}\n\treturn json.NewEncoder(w).Encode(publicData)\n}", "func (t ListOffsetTopicResponse2) Encode(e *Encoder, version int16) {\n\te.PutString(t.Name) // Name\n\t// Partitions\n\tlen1 := len(t.Partitions)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Partitions[i].Encode(e, version)\n\t}\n}", "func EncodeListRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*recordersvc.Series)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"recorder\", \"list\", \"*recordersvc.Series\", v)\n\t\t}\n\t\tvalues := req.URL.Query()\n\t\tvalues.Add(\"service\", p.Service)\n\t\tvalues.Add(\"name\", p.Name)\n\t\treq.URL.RawQuery = values.Encode()\n\t\treturn nil\n\t}\n}", "func encodeGetUserDealByStateResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func (t ListOffsetPartitionResponse2) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.PartitionIndex) // PartitionIndex\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\tif version >= 0 && version <= 0 {\n\t\te.PutInt64Array(t.OldStyleOffsets) // OldStyleOffsets\n\t}\n\tif version >= 1 {\n\t\te.PutInt64(t.Timestamp) // Timestamp\n\t}\n\tif version >= 1 {\n\t\te.PutInt64(t.Offset) // Offset\n\t}\n\tif version >= 4 {\n\t\te.PutInt32(t.LeaderEpoch) // LeaderEpoch\n\t}\n}", "func EncodeShowResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres := v.(*pipelineviews.EnduroStoredPipeline)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewShowResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeLoginResponse(_ context.Context, r interface{}) (interface{}, error) {\n\tresp := r.(LoginResponse)\n\treturn &pb.LoginResponse{\n\t\tJwt: resp.Jwt,\n\t}, nil\n}", "func encodeGetByCreteriaResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func EncodeListRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*log.LogListPayload)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"log\", \"list\", \"*log.LogListPayload\", v)\n\t\t}\n\t\tbody := NewListRequestBody(p)\n\t\tif err := encoder(req).Encode(&body); err != nil {\n\t\t\treturn goahttp.ErrEncodingError(\"log\", \"list\", err)\n\t\t}\n\t\treturn nil\n\t}\n}", "func (resp *FailoverLogResponse) Encode() (data []byte, err error) {\n\treturn proto.Marshal(resp)\n}", "func EncodeRegisterResponse(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.(int)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusCreated)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeGetUserResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "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\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (v SpotInstrumentsListWrapper) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson25363b2dEncodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi45(w, v)\n}", "func ReturnJSONEncoded(w http.ResponseWriter, v interface{}) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tif err := json.NewEncoder(w).Encode(v); err != nil {\n\t\tInternalServerError(w, err)\n\t\treturn\n\t}\n}", "func (m *Response) Encode() ([]byte, error) {\n\treturn msgpack.Marshal(m)\n}", "func EncodeNeatThingTodayResponse(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.(*neatthingviews.NeatThing)\n\t\tw.Header().Set(\"goa-view\", res.View)\n\t\tenc := encoder(ctx, w)\n\t\tvar body interface{}\n\t\tswitch res.View {\n\t\tcase \"default\", \"\":\n\t\t\tbody = NewNeatThingTodayResponseBody(res.Projected)\n\t\tcase \"full\":\n\t\t\tbody = NewNeatThingTodayResponseBodyFull(res.Projected)\n\t\tcase \"name\":\n\t\t\tbody = NewNeatThingTodayResponseBodyName(res.Projected)\n\t\tcase \"name+definition\":\n\t\t\tbody = NewNeatThingTodayResponseBodyNameDefinition(res.Projected)\n\t\tcase \"name+link\":\n\t\t\tbody = NewNeatThingTodayResponseBodyNameLink(res.Projected)\n\t\t}\n\t\tw.WriteHeader(http.StatusNoContent)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (o *PostFriendsUpdatesListOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func (t ListPartitionReassignmentsResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\te.PutString(t.ErrorMessage) // ErrorMessage\n\t// Topics\n\tlen3 := len(t.Topics)\n\te.PutArrayLength(len3)\n\tfor i := 0; i < len3; i++ {\n\t\tt.Topics[i].Encode(e, version)\n\t}\n}", "func (t WriteTxnMarkersRequest) Encode(e *Encoder, version int16) {\n\t// Markers\n\tlen0 := len(t.Markers)\n\te.PutArrayLength(len0)\n\tfor i := 0; i < len0; i++ {\n\t\tt.Markers[i].Encode(e, version)\n\t}\n}", "func (t ListOffsetRequest) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ReplicaId) // ReplicaId\n\tif version >= 2 {\n\t\te.PutInt8(t.IsolationLevel) // IsolationLevel\n\t}\n\t// Topics\n\tlen2 := len(t.Topics)\n\te.PutArrayLength(len2)\n\tfor i := 0; i < len2; i++ {\n\t\tt.Topics[i].Encode(e, version)\n\t}\n}", "func encodeResponse(w http.ResponseWriter, resp interface{}) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(resp)\n}", "func (r CreativeWordListRequest) Encode() string {\n\tvalues := &url.Values{}\n\tvalues.Set(\"advertiser_id\", strconv.FormatInt(r.AdvertiserID, 10))\n\treturn values.Encode()\n}", "func (v SpotInstrumentsListWrapper) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson25363b2dEncodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi45(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func responseList (w http.ResponseWriter, response *model.Response, invoices *model.InvoicesResponse) {\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tvar err error\n\tif response.Code < 0{\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\terr = json.NewEncoder(w).Encode(&response)\n\t}else{\n\t\tw.WriteHeader(http.StatusOK)\n\t\terr = json.NewEncoder(w).Encode(&invoices)\n\t}\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func encodeGetDealByDIDResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func (m *MessageFromServer) Encode() []byte {\n\n\t// encode to json\n\tbytes, err := json.Marshal(m)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn []byte{}\n\t}\n\n\treturn bytes\n}", "func (res *AddResponse) Encode(_ context.Context, w ResponseWriter) error {\n\treturn w.WriteError(ldaputil.ApplicationAddResponse, errors.New(\"not implemented\"))\n}", "func EncodeListRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*resource.ListPayload)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"resource\", \"List\", \"*resource.ListPayload\", v)\n\t\t}\n\t\tvalues := req.URL.Query()\n\t\tvalues.Add(\"limit\", fmt.Sprintf(\"%v\", p.Limit))\n\t\treq.URL.RawQuery = values.Encode()\n\t\treturn nil\n\t}\n}", "func BuildListMinePayload(projectListMineAuth string) (*project.ListMinePayload, error) {\n\tvar auth string\n\t{\n\t\tauth = projectListMineAuth\n\t}\n\tv := &project.ListMinePayload{}\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif e, ok := response.(errorer); ok && e.error() != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tw.WriteHeader(codeFrom(e.error()))\n\t\treturn marshalStructWithError(response, w)\n\t}\n\n\t// Used for pagination\n\tif e, ok := response.(counter); ok {\n\t\tw.Header().Set(\"X-Total-Count\", strconv.Itoa(e.count()))\n\t}\n\n\t// Don't overwrite a header (i.e. called from encodeTextResponse)\n\tif v := w.Header().Get(\"Content-Type\"); v == \"\" {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\t// Only write json body if we're setting response as json\n\t\treturn json.NewEncoder(w).Encode(response)\n\t}\n\treturn nil\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\t// Set JSON type\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\t// Check error\n\tif e, ok := response.(errorer); ok {\n\t\t// This is a errorer class, now check for error\n\t\tif err := e.error(); err != nil {\n\t\t\tencodeError(ctx, e.error(), w)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// cast to dataHolder to get Data, otherwise just encode the resposne\n\tif holder, ok := response.(dataHolder); ok {\n\t\treturn json.NewEncoder(w).Encode(holder.getData())\n\t} else {\n\t\treturn json.NewEncoder(w).Encode(response)\n\t}\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\treturn json.NewEncoder(w).Encode(response)\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\treturn json.NewEncoder(w).Encode(response)\n}", "func (t UpdateMetadataResponse) Encode(e *Encoder, version int16) {\n\te.PutInt16(t.ErrorCode) // ErrorCode\n}", "func EncodePhotoResponse(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.(*station.PhotoResult)\n\t\tval := res.Length\n\t\tlengths := strconv.FormatInt(val, 10)\n\t\tw.Header().Set(\"Content-Length\", lengths)\n\t\tw.Header().Set(\"Content-Type\", res.ContentType)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn nil\n\t}\n}", "func EncodeStartResponse(_ 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 (v GetCharactersCharacterIdMedals200OkList) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson88215edcEncodeGithubComAntihaxGoesiEsi(w, v)\n}", "func (t RenewDelegationTokenResponse) Encode(e *Encoder, version int16) {\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\te.PutInt64(t.ExpiryTimestampMs) // ExpiryTimestampMs\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n}", "func (v SpotInstrumentsTickerListWrapper) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson25363b2dEncodeGithubComDarkfoxs96OpenApiV3SdkOkexGoSdkApi43(w, v)\n}", "func generateListPartsResponse(partsInfo ListPartsInfo, encodingType string) ListPartsResponse {\n\tlistPartsResponse := ListPartsResponse{}\n\tlistPartsResponse.Bucket = partsInfo.Bucket\n\tlistPartsResponse.Key = s3EncodeName(partsInfo.Object, encodingType)\n\tlistPartsResponse.UploadID = partsInfo.UploadID\n\tlistPartsResponse.StorageClass = globalMinioDefaultStorageClass\n\tlistPartsResponse.Initiator.ID = globalMinioDefaultOwnerID\n\tlistPartsResponse.Owner.ID = globalMinioDefaultOwnerID\n\n\tlistPartsResponse.MaxParts = partsInfo.MaxParts\n\tlistPartsResponse.PartNumberMarker = partsInfo.PartNumberMarker\n\tlistPartsResponse.IsTruncated = partsInfo.IsTruncated\n\tlistPartsResponse.NextPartNumberMarker = partsInfo.NextPartNumberMarker\n\n\tlistPartsResponse.Parts = make([]Part, len(partsInfo.Parts))\n\tfor index, part := range partsInfo.Parts {\n\t\tnewPart := Part{}\n\t\tnewPart.PartNumber = part.PartNumber\n\t\tnewPart.ETag = \"\\\"\" + part.ETag + \"\\\"\"\n\t\tnewPart.Size = part.Size\n\t\tnewPart.LastModified = part.LastModified.UTC().Format(timeFormatAMZLong)\n\t\tlistPartsResponse.Parts[index] = newPart\n\t}\n\treturn listPartsResponse\n}", "func encodeRegisterResponse(_ context.Context, r interface{}) (interface{}, error) {\n\trs := r.(endpoint.RegisterResponse)\n\n\tif rs.Err != nil {\n\t\treturn &pb.RegisterReply{\n\t\t\tMessage: rs.Err.Error(),\n\t\t\tStatus: \"ERROR\",\n\t\t}, fmt.Errorf(\"Message: %v With Status: %v\", rs.Err.Error(), rs.Err)\n\t}\n\n\treturn &pb.RegisterReply{\n\t\tMessage: fmt.Sprintf(\"Hi %s %s We Send a SMS for verify your Phone!\", rs.Response.Name, rs.Response.LastName),\n\t\tStatus: \"SUCCESS\",\n\t}, nil\n}", "func EncodeResponse(_ context.Context, w http.ResponseWriter, response interface{}) error {\n\treturn json.NewEncoder(w).Encode(response)\n}", "func EncodeSecureResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(string)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (v ConstructionMetadataResponse) EncodeJSON(b []byte) []byte {\n\tb = append(b, `{\"metadata\":`...)\n\tb = appendMapObject(b, v.Metadata)\n\tb = append(b, \",\"...)\n\tif len(v.SuggestedFee) > 0 {\n\t\tb = append(b, '\"', 's', 'u', 'g', 'g', 'e', 's', 't', 'e', 'd', '_', 'f', 'e', 'e', '\"', ':', '[')\n\t\tfor i, elem := range v.SuggestedFee {\n\t\t\tif i != 0 {\n\t\t\t\tb = append(b, \",\"...)\n\t\t\t}\n\t\t\tb = elem.EncodeJSON(b)\n\t\t}\n\t\tb = append(b, \"],\"...)\n\t}\n\tb[len(b)-1] = '}'\n\treturn b\n}", "func (p *ProxyInfo) Encode() []byte {\n\treturn JSONEncode(p)\n}", "func EncodeChangeResponse(_ 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 (m *List) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n err := m.BaseItem.Serialize(writer)\n if err != nil {\n return err\n }\n if m.GetColumns() != nil {\n cast := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.CollectionCast[i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable](m.GetColumns())\n err = writer.WriteCollectionOfObjectValues(\"columns\", cast)\n if err != nil {\n return err\n }\n }\n if m.GetContentTypes() != nil {\n cast := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.CollectionCast[i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable](m.GetContentTypes())\n err = writer.WriteCollectionOfObjectValues(\"contentTypes\", cast)\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"displayName\", m.GetDisplayName())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteObjectValue(\"drive\", m.GetDrive())\n if err != nil {\n return err\n }\n }\n if m.GetItems() != nil {\n cast := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.CollectionCast[i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable](m.GetItems())\n err = writer.WriteCollectionOfObjectValues(\"items\", cast)\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteObjectValue(\"list\", m.GetList())\n if err != nil {\n return err\n }\n }\n if m.GetOperations() != nil {\n cast := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.CollectionCast[i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable](m.GetOperations())\n err = writer.WriteCollectionOfObjectValues(\"operations\", cast)\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteObjectValue(\"sharepointIds\", m.GetSharepointIds())\n if err != nil {\n return err\n }\n }\n if m.GetSubscriptions() != nil {\n cast := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.CollectionCast[i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable](m.GetSubscriptions())\n err = writer.WriteCollectionOfObjectValues(\"subscriptions\", cast)\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteObjectValue(\"system\", m.GetSystem())\n if err != nil {\n return err\n }\n }\n return nil\n}", "func EncodeMetaResponse(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.(*sensor.MetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (enc EncodableMapList) EncodeList(encoder ListEncoder) {\n\tfor _, value := range enc {\n\t\tencoder.AddObject(EncodableMap(value))\n\t}\n}", "func (v GetCharactersCharacterIdMedals200OkList) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson88215edcEncodeGithubComAntihaxGoesiEsi(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "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(ctx, w)\n\t\tbody := NewDownloadPhotoResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (o *GenesisPeersListInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\trw.Header().Del(runtime.HeaderContentType) // Remove Content-Type on empty responses\n\n\trw.WriteHeader(500)\n}", "func (t JoinGroupResponse) Encode(e *Encoder, version int16) {\n\tif version >= 2 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\te.PutInt32(t.GenerationId) // GenerationId\n\te.PutString(t.ProtocolName) // ProtocolName\n\te.PutString(t.Leader) // Leader\n\te.PutString(t.MemberId) // MemberId\n\t// Members\n\tlen6 := len(t.Members)\n\te.PutArrayLength(len6)\n\tfor i := 0; i < len6; i++ {\n\t\tt.Members[i].Encode(e, version)\n\t}\n}", "func EncodeFetcherResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tfetcherResponse, ok := response.(FetchResponser)\n\tif !ok {\n\t\t//return errors.New(\"invalid Fetcher Response\")\n\t\te := errs.BadGateway{What: \"response\"}\n\t\tencodeError(ctx, &e, w)\n\t\treturn nil\n\t}\n\t//statusCode := fetcherResponse.GetStatusCode()\n\t//if statusCode != 200 {\n\t//\treturn errors.New(strconv.Itoa(statusCode))\n\t//}\n\t//if fetcherResponse.Error != \"\" {\n\t//\treturn errors.New(fetcherResponse.Error)\n\t//}\n\n\tdata, err := json.Marshal(fetcherResponse)\n\tif err != nil {\n\t\tencodeError(ctx, err, w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t_, err = w.Write(data)\n\n\tif err != nil {\n\t\tencodeError(ctx, err, w)\n\t\treturn nil\n\t}\n\treturn nil\n}", "func (b BotResponseList) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"nextLink\", b.NextLink)\n\tpopulate(objectMap, \"value\", b.Value)\n\treturn json.Marshal(objectMap)\n}" ]
[ "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.50674057", "0.5046765", "0.5035613", "0.5024794", "0.49745488", "0.49650142", "0.49634475", "0.4939781", "0.4938793", "0.4938793", "0.49300948", "0.49208573", "0.49044254", "0.49040297", "0.49040297", "0.4874749", "0.48643443", "0.4846756", "0.48341516", "0.48313516", "0.48236042", "0.48226932", "0.48150688", "0.48045573", "0.4801491", "0.48010856", "0.47992823", "0.4779367", "0.47790214", "0.47773635", "0.47741044", "0.4772363", "0.47644034", "0.4762499", "0.47553164", "0.4749763", "0.4744224", "0.47339293", "0.4732633", "0.47298142", "0.47284505", "0.47130585", "0.47085753", "0.47079092", "0.46950093", "0.46934822", "0.468967", "0.46856475", "0.4678924", "0.4668862", "0.46608174", "0.46599394", "0.46548298", "0.46543896", "0.46488187", "0.46488187", "0.46479607", "0.46392655", "0.46338508", "0.4630654", "0.4624923", "0.46183708", "0.46177626", "0.4616964", "0.46123478", "0.46114868", "0.46097112", "0.46085438", "0.4608213", "0.46057826", "0.46028617", "0.46027595", "0.45987487", "0.45963544", "0.45892328", "0.45856553", "0.45825776", "0.45801237" ]
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.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.Handler {\n\tvar (\n\t\tdecodeRequest = DecodeListMineRequest(mux, decoder)\n\t\tencodeResponse = EncodeListMineResponse(encoder)\n\t\tencodeError = EncodeListMineError(encoder, formatter)\n\t)\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get(\"Accept\"))\n\t\tctx = context.WithValue(ctx, goa.MethodKey, \"list mine\")\n\t\tctx = context.WithValue(ctx, goa.ServiceKey, \"station\")\n\t\tpayload, err := decodeRequest(r)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tres, err := endpoint(ctx, payload)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif err := encodeResponse(ctx, w, res); err != nil {\n\t\t\terrhandler(ctx, w, err)\n\t\t}\n\t})\n}", "func DecodeListReq(ctx context.Context, r *http.Request) (interface{}, error) {\n\tvar request api.ListRequest\n\tif err := json.NewDecoder(r.Body).Decode(&request); err != nil {\n\t\treturn nil, err\n\t}\n\treturn request, nil\n}", "func DecodeListRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error) {\n\treturn func(r *http.Request) (any, error) {\n\t\tvar (\n\t\t\tname *string\n\t\t\tstatus bool\n\t\t\terr error\n\t\t)\n\t\tnameRaw := r.URL.Query().Get(\"name\")\n\t\tif nameRaw != \"\" {\n\t\t\tname = &nameRaw\n\t\t}\n\t\t{\n\t\t\tstatusRaw := r.URL.Query().Get(\"status\")\n\t\t\tif statusRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseBool(statusRaw)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"status\", statusRaw, \"boolean\"))\n\t\t\t\t}\n\t\t\t\tstatus = v\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewListPayload(name, status)\n\n\t\treturn payload, nil\n\t}\n}", "func (c *Client) ListMine(ctx context.Context, p *ListMinePayload) (res *StationsFull, err error) {\n\tvar ires interface{}\n\tires, err = c.ListMineEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(*StationsFull), nil\n}", "func (t *ListOffsetRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.ReplicaId, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 2 {\n\t\tt.IsolationLevel, err = d.Int8()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]ListOffsetTopic2, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item ListOffsetTopic2\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func BuildListMinePayload(stationListMineAuth string) (*station.ListMinePayload, error) {\n\tvar auth string\n\t{\n\t\tauth = stationListMineAuth\n\t}\n\tv := &station.ListMinePayload{}\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func BuildListMinePayload(stationListMineAuth string) (*station.ListMinePayload, error) {\n\tvar auth string\n\t{\n\t\tauth = stationListMineAuth\n\t}\n\tv := &station.ListMinePayload{}\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func DecodeScoreListRequest(ctx context.Context, v interface{}, md metadata.MD) (interface{}, error) {\n\tvar (\n\t\tmessage *scorepb.ScoreListRequest\n\t\tok bool\n\t)\n\t{\n\t\tif message, ok = v.(*scorepb.ScoreListRequest); !ok {\n\t\t\treturn nil, goagrpc.ErrInvalidType(\"Score\", \"ScoreList\", \"*scorepb.ScoreListRequest\", v)\n\t\t}\n\t\tif err := ValidateScoreListRequest(message); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tvar payload *score.ScoreListPayload\n\t{\n\t\tpayload = NewScoreListPayload(message)\n\t}\n\treturn payload, nil\n}", "func DecodeListRequest(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\tcursor *int\n\t\t\tlimit *int\n\t\t\ttoken string\n\t\t\terr error\n\t\t)\n\t\t{\n\t\t\tcursorRaw := r.URL.Query().Get(\"cursor\")\n\t\t\tif cursorRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(cursorRaw, 10, strconv.IntSize)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"cursor\", cursorRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tpv := int(v)\n\t\t\t\tcursor = &pv\n\t\t\t}\n\t\t}\n\t\t{\n\t\t\tlimitRaw := r.URL.Query().Get(\"limit\")\n\t\t\tif limitRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(limitRaw, 10, strconv.IntSize)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"limit\", limitRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tpv := int(v)\n\t\t\t\tlimit = &pv\n\t\t\t}\n\t\t}\n\t\ttoken = r.Header.Get(\"Authorization\")\n\t\tif token == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewListPayload(cursor, limit, token)\n\t\tif strings.Contains(payload.Token, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Token, \" \", 2)[1]\n\t\t\tpayload.Token = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func RequestDecode(req *http.Request) (*JWT, error) {\n\treturn decode(req, nil)\n}", "func (t *DescribeDelegationTokenRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\t// Owners\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Owners = make([]DescribeDelegationTokenOwner41, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item DescribeDelegationTokenOwner41\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Owners[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func decodeHTTPListRolesRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvar req endpoints.ListRolesRequest\n\treturn req, nil\n}", "func (t *WriteTxnMarkersRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\t// Markers\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Markers = make([]WritableTxnMarker27, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item WritableTxnMarker27\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Markers[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func decodeListOrderRequest(_ context.Context, r *stdhttp.Request) (interface{}, error) {\n\tqp := processBasicQP(r)\n\treturn qp, nil\n}", "func EncodeListMineResponse(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.StationsFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListMineResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeListMineResponse(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.StationsFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListMineResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func BuildListMinePayload(projectListMineAuth string) (*project.ListMinePayload, error) {\n\tvar auth string\n\t{\n\t\tauth = projectListMineAuth\n\t}\n\tv := &project.ListMinePayload{}\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func DecodeRequest[I any](ctx context.Context, r *http.Request) (in I, err error) {\n\tswitch r.Method {\n\tcase \"POST\", \"PUT\", \"PATCH\":\n\t\terr = magic.Decode(r, &in,\n\t\t\tmagic.JSON,\n\t\t\tmagic.ChiRouter,\n\t\t)\n\tcase \"GET\", \"DELETE\":\n\t\terr = magic.Decode(r, &in,\n\t\t\tmagic.QueryParams,\n\t\t\tmagic.ChiRouter,\n\t\t)\n\tdefault:\n\t\terr = errors.Errorf(\"method %s not supported\", r.Method)\n\t}\n\n\tif err == io.EOF {\n\t\terr = errors.New(\"empty body\")\n\t}\n\n\treturn in, errors.E(err, \"can not unmarshal request\", errors.Unmarshal)\n}", "func (req *FailoverLogRequest) Decode(data []byte) (err error) {\n\treturn proto.Unmarshal(data, req)\n}", "func DecodeRequest(source io.Reader, format wrp.Format) (*Request, error) {\n\tcontents, err := io.ReadAll(source)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// nolint: typecheck\n\tmessage := new(wrp.Message)\n\tif err := wrp.NewDecoderBytes(contents, format).Decode(message); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// nolint: typecheck\n\terr = wrp.UTF8(message)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Request{\n\t\tMessage: message,\n\t\tFormat: format,\n\t\tContents: contents,\n\t}, nil\n}", "func (t *ListGroupsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\treturn err\n}", "func DecodeGrpcReqMetricsQueryList(ctx context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*MetricsQueryList)\n\treturn req, nil\n}", "func DecodeAddFlagRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tparams := mux.Vars(r)\n\tgameId, ok := params[\"gameId\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"Bad routing, game id not provided\")\n\t}\n\tvar request model.PickCellRequest\n\tif err := json.NewDecoder(r.Body).Decode(&request); err != nil {\n\t\treturn nil, err\n\t}\n\trequest.GameId = gameId\n\treturn request, nil\n}", "func (t *ListPartitionReassignmentsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TimeoutMs, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]ListPartitionReassignmentsTopics46, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item ListPartitionReassignmentsTopics46\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func MountListMineHandler(mux goahttp.Muxer, h http.Handler) {\n\tf, ok := handleStationOrigin(h).(http.HandlerFunc)\n\tif !ok {\n\t\tf = func(w http.ResponseWriter, r *http.Request) {\n\t\t\th.ServeHTTP(w, r)\n\t\t}\n\t}\n\tmux.Handle(\"GET\", \"/stations\", f)\n}", "func DecodeJSONRequest(ctx context.Context, msg *natn.Msg) (req interface{}, err error) {\n\tvar request Request\n\n\terr = json.NewDecoder(bytes.NewReader(msg.Data)).Decode(request)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn request, err\n}", "func (*GetMengerListRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_menger_menger_proto_rawDescGZIP(), []int{13}\n}", "func DecodeLoginRequest(_ context.Context, r interface{}) (interface{}, error) {\n\treq := r.(*pb.LoginRequest)\n\treturn LoginRequest{\n\t\tUsername: req.Username,\n\t\tPassword: req.Password,\n\t}, nil\n}", "func decodeRequest(r io.Reader) *plugin.CodeGeneratorRequest {\n\tvar req plugin.CodeGeneratorRequest\n\tinput, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\tlog.Fatal(\"unable to read stdin: \" + err.Error())\n\t}\n\tif err := proto.Unmarshal(input, &req); err != nil {\n\t\tlog.Fatal(\"unable to marshal stdin as protobuf: \" + err.Error())\n\t}\n\treturn &req\n}", "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 (t *ElectLeadersRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tif version >= 1 {\n\t\tt.ElectionType, err = d.Int8()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// TopicPartitions\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.TopicPartitions = make([]TopicPartitions43, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item TopicPartitions43\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.TopicPartitions[i] = item\n\t\t}\n\t}\n\tt.TimeoutMs, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func (t *CreateDelegationTokenRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\t// Renewers\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Renewers = make([]CreatableRenewers38, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item CreatableRenewers38\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Renewers[i] = item\n\t\t}\n\t}\n\tt.MaxLifetimeMs, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func DecodeRequest(r BytesReader) ([]string, error) {\n\t// Decode the value\n\tval, err := Decode(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Must be an array\n\tar, ok := val.(Array)\n\tif !ok {\n\t\treturn nil, ErrNotAnArray\n\t}\n\n\t// Must have at least one element\n\tif len(ar) < 1 {\n\t\treturn nil, ErrInvalidRequest\n\t}\n\n\t// Must have only strings\n\tstrs := make([]string, len(ar))\n\tfor i, v := range ar {\n\t\tv, ok := v.(string)\n\t\tif !ok {\n\t\t\treturn nil, ErrInvalidRequest\n\t\t}\n\t\tstrs[i] = v\n\t}\n\treturn strs, nil\n}", "func RequestDecoder(r *http.Request, accepts []mime.Type) (Decoder, error) {\n\tserverAccepts := mime.Aggregate(accepts)\n\tclientSent := mime.NewTypes(r.Header.Get(\"Content-Type\"))\n\tavailable := mime.Intersect(serverAccepts, clientSent)\n\n\tif len(available) < 0 {\n\t\tavailable = serverAccepts\n\t}\n\tvar dec Decoder\n\terr := available.Walk(func(x mime.Type) error {\n\t\tif decoderFunc, ok := decoders[x]; ok {\n\t\t\tdec = decoderFunc(r.Body)\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"%s isn't a registered decoder\", x)\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif dec == nil {\n\t\treturn nil, fmt.Errorf(\"coudln't find decoder for %q\", accepts)\n\t}\n\treturn dec, nil\n}", "func (t *LeaveGroupRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.GroupId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 0 && version <= 2 {\n\t\tt.MemberId, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif version >= 3 {\n\t\t// Members\n\t\tif n, err := d.ArrayLength(); err != nil {\n\t\t\treturn err\n\t\t} else if n >= 0 {\n\t\t\tt.Members = make([]MemberIdentity13, n)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tvar item MemberIdentity13\n\t\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tt.Members[i] = item\n\t\t\t}\n\t\t}\n\t}\n\treturn err\n}", "func DecodeStationMetaRequest(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\tstations *string\n\t\t)\n\t\tstationsRaw := r.URL.Query().Get(\"stations\")\n\t\tif stationsRaw != \"\" {\n\t\t\tstations = &stationsRaw\n\t\t}\n\t\tpayload := NewStationMetaPayload(stations)\n\n\t\treturn payload, nil\n\t}\n}", "func (t *AddOffsetsToTxnRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TransactionalId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerId, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerEpoch, err = d.Int16()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.GroupId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func DecodeRequestToken(ptoken string) (int, int, int, error) { // TODO: Return Values to Struct!\n\ttoken, err := jwt.Parse(ptoken, func(token *jwt.Token) (interface{}, error) {\n\t\tif _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {\n\t\t\treturn nil, fmt.Errorf(\"Unexpected signing method: %v\", token.Header[\"alg\"])\n\t\t}\n\t\treturn []byte(os.Getenv(\"JWTSecret\")), nil\n\t})\n\n\tif err == nil {\n\t\tif claims, ok := token.Claims.(jwt.MapClaims); ok && token.Valid {\n\t\t\treturn int(claims[\"proxy\"].(float64)), int(claims[\"id\"].(float64)), int(claims[\"checkid\"].(float64)), nil\n\t\t}\n\t}\n\n\treturn 0, 0, 0, err\n}", "func (c *Cache) RequestDecode(req *http.Request) (*token.JWT, error) {\n\tvar jwt *token.JWT\n\tvar err error\n\taerr := c.doSync(func() {\n\t\tvar st string\n\t\tif st, err = c.requestToken(req); err != nil {\n\t\t\treturn\n\t\t}\n\t\tif jwt, err = c.Get(st); err != nil {\n\t\t\treturn\n\t\t}\n\t\tif jwt, err = token.Decode(st); err != nil {\n\t\t\treturn\n\t\t}\n\t\t_, err = c.Put(jwt)\n\t}, defaultTimeout)\n\tif aerr != nil {\n\t\treturn nil, aerr\n\t}\n\treturn jwt, err\n}", "func DecodeSplashFetcherRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\tvar request splash.Request\n\tif err := json.NewDecoder(r.Body).Decode(&request); err != nil {\n\t\treturn nil, &errs.BadRequest{err}\n\t}\n\treturn request, nil\n}", "func (t *ExpireDelegationTokenRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.Hmac, err = d.Bytes()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ExpiryTimePeriodMs, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func (mh *MessageHandler) decodeRequest(httpRequest *http.Request) (deviceRequest *Request, err error) {\n\tdeviceRequest, err = DecodeRequest(httpRequest.Body, mh.Decoders)\n\tif err == nil {\n\t\tdeviceRequest = deviceRequest.WithContext(httpRequest.Context())\n\t}\n\n\treturn\n}", "func JSONRequestDeserializer(message []byte) (*WsMessageBody, error) {\n\tvar jsonWsMessageBody jsonWsMessageBody\n\terr := json.Unmarshal(message, &jsonWsMessageBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &WsMessageBody{Type: jsonWsMessageBody.Type, Content: jsonWsMessageBody.Content}, nil\n}", "func (r *Route) DecodeRequest(req interface{}) *Route {\n\tr.request = reflect.TypeOf(req)\n\tif r.request.Kind() != reflect.Ptr {\n\t\tpanic(\"request structure must be a pointer\")\n\t}\n\treturn r\n}", "func decodeHTTPSumRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvar req endpoints.SumRequest\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func (t *HeartbeatRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.GroupId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.GenerationId, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.MemberId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 3 {\n\t\tt.GroupInstanceId, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "func (t *FindCoordinatorRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.Key, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 1 {\n\t\tt.KeyType, err = d.Int8()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "func encodeListRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treturn nil, errors.New(\"'Users' Encoder is not impelemented\")\n}", "func (msg *RegisterRMRequest) Decode(buf *goetty.ByteBuf) {\n\tmsg.abstractIdentifyRequest.Decode(buf)\n\tmsg.ResourceIDs = ReadBigString(buf)\n}", "func DecodeList(inp []byte, startIndex int) (encodedItems [][]byte, bytesRead int, err error) {\n\t// read data size info\n\tisString, dataStartIndex, listDataSize, err := ReadSize(inp, startIndex)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\n\t// check type\n\tif isString {\n\t\treturn nil, 0, ErrTypeMismatch\n\t}\n\n\tretList := make([][]byte, 0)\n\n\t// special case - empty list\n\tif listDataSize == 0 {\n\t\treturn retList, 1, nil\n\t}\n\n\tif listDataSize+dataStartIndex > len(inp) {\n\t\treturn nil, 0, ErrIncompleteInput\n\t}\n\n\tvar itemStartIndex, itemEndIndex, dataBytesRead int\n\titemStartIndex = dataStartIndex\n\n\tfor dataBytesRead < listDataSize {\n\t\t_, itemDataStartIndex, itemSize, err := ReadSize(inp, itemStartIndex)\n\t\tif err != nil {\n\t\t\treturn nil, 0, err\n\t\t}\n\t\t// collect encoded item\n\t\titemEndIndex = itemDataStartIndex + itemSize\n\t\tif itemEndIndex > len(inp) {\n\t\t\treturn nil, 0, ErrIncompleteInput\n\t\t}\n\t\tretList = append(retList, inp[itemStartIndex:itemEndIndex])\n\t\tdataBytesRead += itemEndIndex - itemStartIndex\n\t\titemStartIndex = itemEndIndex\n\t}\n\tif dataBytesRead != listDataSize {\n\t\treturn nil, 0, ErrListSizeMismatch\n\t}\n\n\treturn retList, itemEndIndex - startIndex, nil\n}", "func (msg *abstractIdentifyRequest) Decode(buf *goetty.ByteBuf) {\n\tmsg.Version = ReadString(buf)\n\tmsg.ApplicationID = ReadString(buf)\n\tmsg.TransactionServiceGroup = ReadString(buf)\n\tmsg.ExtraData = ReadString(buf)\n}", "func DecodeRemoveRequest(_ context.Context, r *http.Request) (req interface{}, err error) {\n\treq = endpoints.RemoveRequest{Id: mux.Vars(r)[\"id\"]}\n\t//err = json.NewDecoder(r.Body).Decode(&r)\n\treturn req, err\n}", "func decodeRequest(_ context.Context, r *http.Request) (request interface{}, err error) {\n\tdefer r.Body.Close()\n\treturn nil, nil\n}", "func (t *OffsetForLeaderEpochRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tif version >= 3 {\n\t\tt.ReplicaId, err = d.Int32()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]OffsetForLeaderTopic23, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item OffsetForLeaderTopic23\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func decodeLoginPRequest(_ context.Context, r interface{}) (interface{}, error) {\n\trq := r.(*pb.LoginPRequest)\n\n\treturn endpoint.LoginPRequest{\n\t\tPhone: rq.Phone,\n\t}, nil\n}", "func decodeAddRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\tzip, _ := strconv.Atoi(r.FormValue(\"ZipCode\"))\n\ttel, _ := strconv.Atoi(r.FormValue(\"EmployeeNumTel\"))\n\tEmergencyTel, _ := strconv.Atoi(r.FormValue(\"EmergencyContactTel\"))\n\tsalary, _ := strconv.ParseFloat(r.FormValue(\"EmployeeSalary\"), 32)\n\tiban, _ := strconv.Atoi(r.FormValue(\"EmployeeIban\"))\n\tbic, _ := strconv.Atoi(r.FormValue(\"EmployeeBic\"))\n\treq := endpoint.AddRequest{\n\t\tio.Employee{\n\t\t\tEmployeeName: r.FormValue(\"EmployeeName\"),\n\t\t\tEmployeeEmail: r.FormValue(\"EmployeeEmail\"),\n\t\t\tAddress: r.FormValue(\"Address\"),\n\t\t\tZipCode: zip,\n\t\t\tEmployeeBirthDate: r.FormValue(\"EmployeeBirthDate\"),\n\t\t\tEmployeeNumTel: tel,\n\t\t\tEmergencyContactName: r.FormValue(\"EmergencyContactName\"),\n\t\t\tEmergencyContactTel: EmergencyTel,\n\t\t\tEmployeeStartDate: r.FormValue(\"EmployeeStartDate\"),\n\t\t\tEmployeeSalary: salary,\n\t\t\tEmployeeIban: iban,\n\t\t\tEmployeeBic: bic,\n\t\t},\n\t}\n\treturn req, nil\n}", "func (t *OffsetFetchRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.GroupId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]OffsetFetchRequestTopic9, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item OffsetFetchRequestTopic9\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func DecodeLoginRequest(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\tbody LoginRequestBody\n\t\t\terr error\n\t\t)\n\t\terr = decoder(r).Decode(&body)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\treturn nil, goa.MissingPayloadError()\n\t\t\t}\n\t\t\treturn nil, goa.DecodePayloadError(err.Error())\n\t\t}\n\t\terr = ValidateLoginRequestBody(&body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewLoginPayload(&body)\n\n\t\treturn payload, nil\n\t}\n}", "func decodeGetAllIndustriesRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.GetAllIndustriesRequest)\n\tdecoded := endpoints.GetAllIndustriesRequest{\n\t\tID: req.Id,\n\t\tName: req.Name,\n\t}\n\treturn decoded, nil\n}", "func EncodeListRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*warehouse.ListPayload)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"Warehouse\", \"List\", \"*warehouse.ListPayload\", v)\n\t\t}\n\t\t{\n\t\t\thead := p.Token\n\t\t\tif !strings.Contains(head, \" \") {\n\t\t\t\treq.Header.Set(\"Authorization\", \"Bearer \"+head)\n\t\t\t} else {\n\t\t\t\treq.Header.Set(\"Authorization\", head)\n\t\t\t}\n\t\t}\n\t\tvalues := req.URL.Query()\n\t\tif p.Cursor != nil {\n\t\t\tvalues.Add(\"cursor\", fmt.Sprintf(\"%v\", *p.Cursor))\n\t\t}\n\t\tif p.Limit != nil {\n\t\t\tvalues.Add(\"limit\", fmt.Sprintf(\"%v\", *p.Limit))\n\t\t}\n\t\treq.URL.RawQuery = values.Encode()\n\t\treturn nil\n\t}\n}", "func decodeVerifyRequest(_ context.Context, r interface{}) (interface{}, error) {\n\trq := r.(*pb.VerifyRequest)\n\n\treturn endpoint.VerifyRequest{\n\t\tToken: rq.Token,\n\t\tType: rq.Type,\n\t\tCode: rq.Code,\n\t}, nil\n}", "func DecodeRequest(ctx context.Context, req *http.Request, pathParams map[string]string, queryParams map[string]string) (interface{}, error) {\n\treturn DecodeRequestWithHeaders(ctx, req, pathParams, queryParams, nil)\n}", "func (t *RenewDelegationTokenRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.Hmac, err = d.Bytes()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.RenewPeriodMs, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func (t *TxnOffsetCommitRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TransactionalId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.GroupId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerId, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerEpoch, err = d.Int16()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]TxnOffsetCommitRequestTopic28, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item TxnOffsetCommitRequestTopic28\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func NewListRequest() *todopb.ListRequest {\n\tmessage := &todopb.ListRequest{}\n\treturn message\n}", "func DecodeListAllRequest(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\tpage *int32\n\t\t\tpageSize *int32\n\t\t\townerID *int32\n\t\t\tquery *string\n\t\t\tsortBy *string\n\t\t\tauth string\n\t\t\terr error\n\t\t)\n\t\t{\n\t\t\tpageRaw := r.URL.Query().Get(\"page\")\n\t\t\tif pageRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(pageRaw, 10, 32)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"page\", pageRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tpv := int32(v)\n\t\t\t\tpage = &pv\n\t\t\t}\n\t\t}\n\t\t{\n\t\t\tpageSizeRaw := r.URL.Query().Get(\"pageSize\")\n\t\t\tif pageSizeRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(pageSizeRaw, 10, 32)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"pageSize\", pageSizeRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tpv := int32(v)\n\t\t\t\tpageSize = &pv\n\t\t\t}\n\t\t}\n\t\t{\n\t\t\townerIDRaw := r.URL.Query().Get(\"ownerId\")\n\t\t\tif ownerIDRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(ownerIDRaw, 10, 32)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"ownerID\", ownerIDRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tpv := int32(v)\n\t\t\t\townerID = &pv\n\t\t\t}\n\t\t}\n\t\tqueryRaw := r.URL.Query().Get(\"query\")\n\t\tif queryRaw != \"\" {\n\t\t\tquery = &queryRaw\n\t\t}\n\t\tsortByRaw := r.URL.Query().Get(\"sortBy\")\n\t\tif sortByRaw != \"\" {\n\t\t\tsortBy = &sortByRaw\n\t\t}\n\t\tauth = r.Header.Get(\"Authorization\")\n\t\tif auth == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewListAllPayload(page, pageSize, ownerID, query, sortBy, auth)\n\t\tif strings.Contains(payload.Auth, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Auth, \" \", 2)[1]\n\t\t\tpayload.Auth = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func EncodeListRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*recordersvc.Series)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"recorder\", \"list\", \"*recordersvc.Series\", v)\n\t\t}\n\t\tvalues := req.URL.Query()\n\t\tvalues.Add(\"service\", p.Service)\n\t\tvalues.Add(\"name\", p.Name)\n\t\treq.URL.RawQuery = values.Encode()\n\t\treturn nil\n\t}\n}", "func (o *ViewReactionsForObject) SetMine(v string) {\n\to.Mine = &v\n}", "func DecodeVerifyJWTRequest(_ context.Context, r interface{}) (interface{}, error) {\n\treq := r.(*pb.VerifyJWTRequest)\n\treturn VerifyJWTRequest{\n\t\tJwt: req.Jwt,\n\t}, nil\n}", "func DecodeNewNeatThingRequest(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\tbody NewNeatThingRequestBody\n\t\t\terr error\n\t\t)\n\t\terr = decoder(r).Decode(&body)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\treturn nil, goa.MissingPayloadError()\n\t\t\t}\n\t\t\treturn nil, goa.DecodePayloadError(err.Error())\n\t\t}\n\t\terr = ValidateNewNeatThingRequestBody(&body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewNewNeatThingNeatThing(&body)\n\n\t\treturn payload, nil\n\t}\n}", "func DecodeGetInfoRequest(ctx context.Context, v interface{}, md metadata.MD) (interface{}, error) {\n\tvar (\n\t\tmessage *table_infopb.GetInfoRequest\n\t\tok bool\n\t)\n\t{\n\t\tif message, ok = v.(*table_infopb.GetInfoRequest); !ok {\n\t\t\treturn nil, goagrpc.ErrInvalidType(\"TableInfo\", \"get_info\", \"*table_infopb.GetInfoRequest\", v)\n\t\t}\n\t}\n\tvar payload *tableinfo.GetInfoPayload\n\t{\n\t\tpayload = NewGetInfoPayload(message)\n\t}\n\treturn payload, nil\n}", "func decodeHotPlayMoviesrRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tfmt.Printf(\"read body err, %v\\n\", err)\n\t\treturn nil, err\n\t}\n\tprintln(\"json-request:\", string(body))\n\n\tvar rhe endpoint.MoviesListRequest // 请求参数解析后放在结构体中\n\tif err = json.Unmarshal(body, &rhe); err != nil {\n\t\tfmt.Printf(\"Unmarshal err, %v\\n\", err)\n\t\treturn nil, err\n\t}\n\tfmt.Println(\"request\", rhe)\n\n\treturn &rhe, nil\n}", "func EncodeListRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*resource.ListPayload)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"resource\", \"List\", \"*resource.ListPayload\", v)\n\t\t}\n\t\tvalues := req.URL.Query()\n\t\tvalues.Add(\"limit\", fmt.Sprintf(\"%v\", p.Limit))\n\t\treq.URL.RawQuery = values.Encode()\n\t\treturn nil\n\t}\n}", "func EncodeListRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error {\n\treturn func(req *http.Request, v interface{}) error {\n\t\tp, ok := v.(*log.LogListPayload)\n\t\tif !ok {\n\t\t\treturn goahttp.ErrInvalidType(\"log\", \"list\", \"*log.LogListPayload\", v)\n\t\t}\n\t\tbody := NewListRequestBody(p)\n\t\tif err := encoder(req).Encode(&body); err != nil {\n\t\t\treturn goahttp.ErrEncodingError(\"log\", \"list\", err)\n\t\t}\n\t\treturn nil\n\t}\n}", "func NewGetCallListitemsRequest(server string, params *GetCallListitemsParams) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/calllists\")\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryUrl.Query()\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"tz\", params.Tz); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"use_owner_tz\", params.UseOwnerTz); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"subscriber_id\", params.SubscriberId); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"customer_id\", params.CustomerId); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"alias_field\", params.AliasField); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"status\", params.Status); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"status_ne\", params.StatusNe); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"rating_status\", params.RatingStatus); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"rating_status_ne\", params.RatingStatusNe); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"type\", params.Type); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"type_ne\", params.TypeNe); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"direction\", params.Direction); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"start_ge\", params.StartGe); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"start_le\", params.StartLe); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"init_ge\", params.InitGe); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"init_le\", params.InitLe); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"call_id\", params.CallId); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"own_cli\", params.OwnCli); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"order_by\", params.OrderBy); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"order_by_direction\", params.OrderByDirection); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"page\", params.Page); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"rows\", params.Rows); err != nil {\n\t\treturn nil, err\n\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor k, v := range parsed {\n\t\t\tfor _, v2 := range v {\n\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t}\n\t\t}\n\t}\n\n\tqueryUrl.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func (*ListRemindsRequest) Descriptor() ([]byte, []int) {\n\treturn file_ocp_remind_api_proto_rawDescGZIP(), []int{1}\n}", "func DecodeQuestionRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n var req QuestionRequest\n err := json.NewDecoder(r.Body).Decode(&req)\n if err != nil {\n return nil, err\n }\n return req, nil\n}", "func (a *Client) QuoteShippingMethodManagementV1GetListGetMine(params *QuoteShippingMethodManagementV1GetListGetMineParams) (*QuoteShippingMethodManagementV1GetListGetMineOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewQuoteShippingMethodManagementV1GetListGetMineParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"quoteShippingMethodManagementV1GetListGetMine\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/V1/carts/mine/shipping-methods\",\n\t\tProducesMediaTypes: []string{\"\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &QuoteShippingMethodManagementV1GetListGetMineReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*QuoteShippingMethodManagementV1GetListGetMineOK), nil\n\n}", "func decodeGetUserRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.GetUserRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func decodePostAcceptDealRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.PostAcceptDealRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func DecodeStartRequest(_ context.Context, r *http.Request) (req interface{}, err error) {\n\treq = endpoints.StartRequest{Id: mux.Vars(r)[\"id\"]}\n\t//err = json.NewDecoder(r.Body).Decode(&r)\n\treturn req, err\n}", "func RequestDecoder(dec DecodeRequestFunc) ServerOption {\n\treturn func(o *Server) {\n\t\to.decBody = dec\n\t}\n}", "func decodeLoginUPRequest(_ context.Context, r interface{}) (interface{}, error) {\n\trq := r.(*pb.LoginUPRequest)\n\treturn endpoint.LoginUPRequest{\n\t\tUsername: rq.Username,\n\t\tPassword: rq.Password,\n\t}, nil\n}", "func (t *AlterReplicaLogDirsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\t// Dirs\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Dirs = make([]AlterReplicaLogDir34, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item AlterReplicaLogDir34\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Dirs[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func (*CUserAccount_GetFriendInviteTokens_Request) Descriptor() ([]byte, []int) {\n\treturn file_steammessages_useraccount_steamclient_proto_rawDescGZIP(), []int{8}\n}", "func (t *OffsetCommitRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.GroupId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 1 {\n\t\tt.GenerationId, err = d.Int32()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif version >= 1 {\n\t\tt.MemberId, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif version >= 7 {\n\t\tt.GroupInstanceId, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif version >= 2 && version <= 4 {\n\t\tt.RetentionTimeMs, err = d.Int64()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]OffsetCommitRequestTopic8, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item OffsetCommitRequestTopic8\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func (c *Client) NewListIDMemberRequest(ctx context.Context, path string) (*http.Request, error) {\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"https\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif c.JWTSigner != nil {\n\t\tif err := c.JWTSigner.Sign(req); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn req, nil\n}", "func DecodeRecentlyRequest(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\tstations *string\n\t\t\tauth *string\n\t\t)\n\t\tstationsRaw := r.URL.Query().Get(\"stations\")\n\t\tif stationsRaw != \"\" {\n\t\t\tstations = &stationsRaw\n\t\t}\n\t\tauthRaw := r.Header.Get(\"Authorization\")\n\t\tif authRaw != \"\" {\n\t\t\tauth = &authRaw\n\t\t}\n\t\tpayload := NewRecentlyPayload(stations, auth)\n\t\tif payload.Auth != nil {\n\t\t\tif strings.Contains(*payload.Auth, \" \") {\n\t\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\t\tcred := strings.SplitN(*payload.Auth, \" \", 2)[1]\n\t\t\t\tpayload.Auth = &cred\n\t\t\t}\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func (req *AppendEntriesRequest) Decode(r io.Reader) (int, error) {\n\tdata, err := ioutil.ReadAll(r)\n\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\ttotalBytes := len(data)\n\n\tpb := &protobuf.ProtoAppendEntriesRequest{}\n\tif err := proto.Unmarshal(data, pb); err != nil {\n\t\treturn -1, err\n\t}\n\n\treq.Term = pb.GetTerm()\n\treq.PrevLogIndex = pb.GetPrevLogIndex()\n\treq.PrevLogTerm = pb.GetPrevLogTerm()\n\treq.CommitIndex = pb.GetCommitIndex()\n\treq.LeaderName = pb.GetLeaderName()\n\n\treq.Entries = make([]*LogEntry, len(pb.Entries))\n\n\tfor i, entry := range pb.Entries {\n\t\treq.Entries[i] = &LogEntry{\n\t\t\tIndex: entry.GetIndex(),\n\t\t\tTerm: entry.GetTerm(),\n\t\t\tCommandName: entry.GetCommandName(),\n\t\t\tCommand: entry.Command,\n\t\t}\n\t}\n\n\treturn totalBytes, nil\n}", "func decodeGetByMultiCriteriaRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.GetByMultiCriteriaRequest{\n\t\tUrlMap: r.URL.String(),\n\t}\n\treturn req, nil\n}", "func DecodeUnsealRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.UnsealRequest)\n\treturn &endpoints.UnsealRequest{Key: req.Key, Reset: req.Reset_}, nil\n}", "func decodeHTTPGetAllNodesRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvar req endpoint.GetAllNodesRequest\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func DecodeGenerateKeyRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\tvar req GenerateKeyRequest\n\tvar err error\n\tif err = json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, err\n}", "func decodeList(f interface{}) []map[string]interface{} {\n\tret := make([]map[string]interface{}, 0)\n\tif v, ok := f.([]interface{}); ok {\n\t\tfor _, vv := range v {\n\t\t\tret = append(ret, vv.(map[string]interface{}))\n\t\t}\n\t}\n\n\treturn ret\n}", "func (t *AddPartitionsToTxnRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TransactionalId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerId, err = d.Int64()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ProducerEpoch, err = d.Int16()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]AddPartitionsToTxnTopic24, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item AddPartitionsToTxnTopic24\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func (b *BastionShareableLinkListRequest) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", b, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"vms\":\n\t\t\terr = unpopulate(val, \"VMs\", &b.VMs)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", b, err)\n\t\t}\n\t}\n\treturn nil\n}", "func DecodeShowRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error) {\n\treturn func(r *http.Request) (any, error) {\n\t\tvar (\n\t\t\tid string\n\t\t\terr error\n\n\t\t\tparams = mux.Vars(r)\n\t\t)\n\t\tid = params[\"id\"]\n\t\terr = goa.MergeErrors(err, goa.ValidateFormat(\"id\", id, goa.FormatUUID))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewShowPayload(id)\n\n\t\treturn payload, nil\n\t}\n}", "func (c *Client) NewListMemberRequest(ctx context.Context, path string) (*http.Request, error) {\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"https\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif c.JWTSigner != nil {\n\t\tif err := c.JWTSigner.Sign(req); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn req, nil\n}" ]
[ "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.49169418", "0.49159876", "0.4801789", "0.47925675", "0.47706228", "0.4749068", "0.47482935", "0.47443104", "0.47336966", "0.47297403", "0.4727174", "0.47184974", "0.46704498", "0.46446842", "0.46394145", "0.46308315", "0.46287033", "0.46077976", "0.46073604", "0.45912814", "0.45868856", "0.45748502", "0.45711297", "0.45707026", "0.4565934", "0.45613968", "0.45550865", "0.45413655", "0.454064", "0.45391226", "0.45383558", "0.45383036", "0.4530149", "0.45255762", "0.45234522", "0.45191073", "0.45098773", "0.45000452", "0.4489684", "0.44767502", "0.44719312", "0.4467776", "0.44623655", "0.44582438", "0.4442937", "0.44245642", "0.44241238", "0.4401146", "0.4400055", "0.43966183", "0.4382344", "0.43776554", "0.4373827", "0.4367576", "0.43653268", "0.43649462", "0.4359065", "0.43539137", "0.43492436", "0.4346377", "0.43367672", "0.43365806", "0.43344817", "0.43272716", "0.43146512", "0.43064436", "0.4299122", "0.42918885", "0.42913765", "0.42900857", "0.42898235", "0.42897367", "0.4287869", "0.42820057", "0.4281687", "0.4280121", "0.42798483", "0.42779106" ]
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\t\tbody := NewListAllResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeProjectResponse(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.(*discussionviews.Discussion)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewProjectResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func NewListProjectHandler(\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.Handler {\n\tvar (\n\t\tdecodeRequest = DecodeListProjectRequest(mux, decoder)\n\t\tencodeResponse = EncodeListProjectResponse(encoder)\n\t\tencodeError = EncodeListProjectError(encoder, formatter)\n\t)\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get(\"Accept\"))\n\t\tctx = context.WithValue(ctx, goa.MethodKey, \"list project\")\n\t\tctx = context.WithValue(ctx, goa.ServiceKey, \"station\")\n\t\tpayload, err := decodeRequest(r)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tres, err := endpoint(ctx, payload)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif err := encodeResponse(ctx, w, res); err != nil {\n\t\t\terrhandler(ctx, w, err)\n\t\t}\n\t})\n}", "func EncodeListMineResponse(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.StationsFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListMineResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeListMineResponse(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.StationsFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListMineResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeListResponse(_ 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 EncodeListResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.([]*pipeline.EnduroStoredPipeline)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListResponseBody(res)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func ListProject(projectID string) error {\n\tclient, err := NewPacketClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp, _, err := client.Projects.Get(projectID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te := MarshallAndPrint(p)\n\treturn e\n}", "func (c *Client) ListProject(ctx context.Context, p *ListProjectPayload) (res *StationsFull, err error) {\n\tvar ires interface{}\n\tires, err = c.ListProjectEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(*StationsFull), nil\n}", "func ProjectListAll(w http.ResponseWriter, r *http.Request) {\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get Results Object\n\n\tres, err := projects.Find(\"\", \"\", refStr)\n\n\tif err != nil && err.Error() != \"not found\" {\n\t\terr := APIErrQueryDatastore()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Output result to JSON\n\tresJSON, err := res.ExportJSON()\n\n\tif err != nil {\n\t\terr := APIErrExportJSON()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Write response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n\n}", "func EncodeListResponse(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.(*inventory.ListResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListResponseBody(res)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func ListProjects() error {\n\tclient, err := NewPacketClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprojects, _, err := client.Projects.List()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te := MarshallAndPrint(projects)\n\treturn e\n}", "func (d *Driver) ProjectList() (*ProjectListResponse, error) {\n\tresponse := &ProjectListResponse{}\n\tlistProjects := project.NewListProjectsParams()\n\tresp, err := d.project.ListProjects(listProjects, d.auth)\n\tif err != nil {\n\t\treturn response, err\n\t}\n\tresponse.Project = resp.Payload\n\treturn response, nil\n}", "func ProjectListOne(w http.ResponseWriter, r *http.Request) {\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab url path variables\n\turlVars := mux.Vars(r)\n\turlProject := urlVars[\"project\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get Results Object\n\tresults, err := projects.Find(\"\", urlProject, refStr)\n\n\tif err != nil {\n\n\t\tif err.Error() == \"not found\" {\n\t\t\terr := APIErrorNotFound(\"ProjectUUID\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t\terr := APIErrQueryDatastore()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Output result to JSON\n\tres := results.One()\n\tresJSON, err := res.ExportJSON()\n\n\tif err != nil {\n\t\terr := APIErrExportJSON()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Write response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n\n}", "func ProjectList(c *gin.Context) error {\n\tuserID, err := GetIDParam(c, userIDParam)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toption := &model.ProjectQueryOption{\n\t\tUserID: userID,\n\t}\n\n\tif limit := c.Query(\"limit\"); limit != \"\" {\n\t\tif i, err := strconv.Atoi(limit); err == nil {\n\t\t\toption.Limit = i\n\t\t}\n\t}\n\n\tif offset := c.Query(\"offset\"); offset != \"\" {\n\t\tif i, err := strconv.Atoi(offset); err == nil {\n\t\t\toption.Offset = i\n\t\t}\n\t}\n\n\tif order := c.Query(\"order\"); order != \"\" {\n\t\toption.Order = order\n\t} else {\n\t\toption.Order = \"-created_at\"\n\t}\n\n\tif err := CheckUserPermission(c, *userID); err == nil {\n\t\toption.Private = true\n\t}\n\n\tlist, err := model.GetProjectList(option)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn common.APIResponse(c, http.StatusOK, list)\n}", "func (c *ProjectService) List() ([]Project, *http.Response, error) {\n\tresponse := new(projectListResponse)\n\tapiError := new(APIError)\n\tresp, err := c.sling.New().Get(\"\").Receive(response, apiError)\n\treturn response.Results, resp, relevantError(err, *apiError)\n}", "func BuildListProjectPayload(stationListProjectID string, stationListProjectAuth string) (*station.ListProjectPayload, error) {\n\tvar err error\n\tvar id int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(stationListProjectID, 10, 32)\n\t\tid = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for id, must be INT32\")\n\t\t}\n\t}\n\tvar auth string\n\t{\n\t\tauth = stationListProjectAuth\n\t}\n\tv := &station.ListProjectPayload{}\n\tv.ID = id\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func (t ListGroupsResponse) Encode(e *Encoder, version int16) {\n\tif version >= 1 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\t// Groups\n\tlen2 := len(t.Groups)\n\te.PutArrayLength(len2)\n\tfor i := 0; i < len2; i++ {\n\t\tt.Groups[i].Encode(e, version)\n\t}\n}", "func BuildListProjectPayload(stationListProjectID string, stationListProjectDisableFiltering string, stationListProjectAuth string) (*station.ListProjectPayload, error) {\n\tvar err error\n\tvar id int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(stationListProjectID, 10, 32)\n\t\tid = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for id, must be INT32\")\n\t\t}\n\t}\n\tvar disableFiltering *bool\n\t{\n\t\tif stationListProjectDisableFiltering != \"\" {\n\t\t\tvar val bool\n\t\t\tval, err = strconv.ParseBool(stationListProjectDisableFiltering)\n\t\t\tdisableFiltering = &val\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid value for disableFiltering, must be BOOL\")\n\t\t\t}\n\t\t}\n\t}\n\tvar auth *string\n\t{\n\t\tif stationListProjectAuth != \"\" {\n\t\t\tauth = &stationListProjectAuth\n\t\t}\n\t}\n\tv := &station.ListProjectPayload{}\n\tv.ID = id\n\tv.DisableFiltering = disableFiltering\n\tv.Auth = auth\n\n\treturn v, nil\n}", "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 := params[\"id\"]\n\t\t\tv, err2 := strconv.ParseInt(idRaw, 10, 32)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"id\", idRaw, \"integer\"))\n\t\t\t}\n\t\t\tid = int32(v)\n\t\t}\n\t\tauth = r.Header.Get(\"Authorization\")\n\t\tif auth == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewListProjectPayload(id, auth)\n\t\tif strings.Contains(payload.Auth, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Auth, \" \", 2)[1]\n\t\t\tpayload.Auth = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "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 := params[\"id\"]\n\t\t\tv, err2 := strconv.ParseInt(idRaw, 10, 32)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"id\", idRaw, \"integer\"))\n\t\t\t}\n\t\t\tid = int32(v)\n\t\t}\n\t\tauthRaw := r.Header.Get(\"Authorization\")\n\t\tif authRaw != \"\" {\n\t\t\tauth = &authRaw\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewListProjectPayload(id, auth)\n\t\tif payload.Auth != nil {\n\t\t\tif strings.Contains(*payload.Auth, \" \") {\n\t\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\t\tcred := strings.SplitN(*payload.Auth, \" \", 2)[1]\n\t\t\t\tpayload.Auth = &cred\n\t\t\t}\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func (a *Client) PostProjectsList(params *PostProjectsListParams, authInfo runtime.ClientAuthInfoWriter) (*PostProjectsListOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostProjectsListParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostProjectsList\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/projects/list\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PostProjectsListReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*PostProjectsListOK), nil\n\n}", "func MockListRepositoryProjectsResponse() MockResponse {\n\treturn MockResponse{\n\t\tStatusCode: http.StatusOK,\n\t\tResponse: listRepositoryProjectsResponse,\n\t}\n}", "func (page ProjectListPage) Response() ProjectList {\n\treturn page.pl\n}", "func (c *Client) ListProject() (projectNames []string, err error) {\n\th := map[string]string{\n\t\t\"x-log-bodyrawsize\": \"0\",\n\t}\n\n\turi := \"/\"\n\tproj := convert(c, \"\")\n\n\ttype Project struct {\n\t\tProjectName string `json:\"projectName\"`\n\t}\n\n\ttype Body struct {\n\t\tProjects []Project `json:\"projects\"`\n\t}\n\n\tr, err := request(proj, \"GET\", uri, h, nil)\n\tif err != nil {\n\t\treturn nil, NewClientError(err)\n\t}\n\n\tdefer r.Body.Close()\n\tbuf, _ := ioutil.ReadAll(r.Body)\n\tif r.StatusCode != http.StatusOK {\n\t\terr := new(Error)\n\t\tjson.Unmarshal(buf, err)\n\t\treturn nil, err\n\t}\n\n\tbody := &Body{}\n\terr = json.Unmarshal(buf, body)\n\tfor _, project := range body.Projects {\n\t\tprojectNames = append(projectNames, project.ProjectName)\n\t}\n\treturn projectNames, err\n}", "func (*ListProjectsResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{1}\n}", "func EncodeCreateResponse(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\tbody := NewCreateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeGetAllJobPlatformsResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tres := response.(endpoints.GetAllJobPlatformsResponse)\n\terr := getError(res.Err)\n\tif err == nil {\n\t\tvar jobPlatforms []*pb.JobPlatform\n\t\tfor _, jobPlatform := range res.JobPlatforms {\n\t\t\tjobPlatforms = append(jobPlatforms, jobPlatform.ToProto())\n\t\t}\n\t\treturn &pb.GetAllJobPlatformsResponse{JobPlatforms: jobPlatforms}, nil\n\t}\n\treturn nil, err\n}", "func EncodeProgressResponse(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.StationProgress)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewProgressResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func MountListProjectHandler(mux goahttp.Muxer, h http.Handler) {\n\tf, ok := handleStationOrigin(h).(http.HandlerFunc)\n\tif !ok {\n\t\tf = func(w http.ResponseWriter, r *http.Request) {\n\t\t\th.ServeHTTP(w, r)\n\t\t}\n\t}\n\tmux.Handle(\"GET\", \"/projects/{id}/stations\", f)\n}", "func (project *ProjectV1) ListProjectsWithContext(ctx context.Context, listProjectsOptions *ListProjectsOptions) (result *ProjectCollection, response *core.DetailedResponse, err error) {\n\terr = core.ValidateStruct(listProjectsOptions, \"listProjectsOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = project.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(project.Service.Options.URL, `/v1/projects`, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range listProjectsOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"project\", \"V1\", \"ListProjects\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\n\tif listProjectsOptions.Start != nil {\n\t\tbuilder.AddQuery(\"start\", fmt.Sprint(*listProjectsOptions.Start))\n\t}\n\tif listProjectsOptions.Limit != nil {\n\t\tbuilder.AddQuery(\"limit\", fmt.Sprint(*listProjectsOptions.Limit))\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = project.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalProjectCollection)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "func MockListOrganizationProjectsResponse() MockResponse {\n\treturn MockResponse{\n\t\tStatusCode: http.StatusOK,\n\t\tResponse: listOrganizationProjectsResponse,\n\t}\n}", "func (impl *ProjectAPIClient) List(ctx context.Context, token *api.Token) (reply []application.Definition, err error) {\n\terr = client.CallHTTP(ctx, impl.BaseURL, \"ProjectAPI.List\", atomic.AddUint64(&impl.sequence, 1), &reply, token)\n\treturn\n}", "func (k *Keystone) ListProjectsAPI(c echo.Context) error {\n\tclusterID := c.Request().Header.Get(xClusterIDKey)\n\tif ke := getKeystoneEndpoints(clusterID, k.endpointStore); len(ke) > 0 {\n\t\treturn k.proxyRequest(c)\n\t}\n\t_, err := k.validateToken(c.Request())\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = k.setAssignment(clusterID)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.JSON(http.StatusOK, &asfkeystone.ProjectListResponse{\n\t\tProjects: k.Assignment.ListProjects(),\n\t})\n}", "func EncodeAddResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewAddResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeAddResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewAddResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func ParsenewProjectResponse(rsp *http.Response) (*newProjectResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &newProjectResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 201:\n\t\tresponse.JSON201 = &Project{}\n\t\tif err := json.Unmarshal(bodyBytes, response.JSON201); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn response, nil\n}", "func ListProjectEvents(id string) error {\n\tclient, err := NewExtPacketClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tevents, _, err := client.Events.ListProjectEvents(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te := MarshallAndPrint(events)\n\treturn e\n}", "func List(ctx context.Context, client *selvpcclient.ServiceClient) ([]*Project, *selvpcclient.ResponseResult, error) {\n\turl := strings.Join([]string{client.Endpoint, resourceURL}, \"/\")\n\tresponseResult, err := client.DoRequest(ctx, http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif responseResult.Err != nil {\n\t\treturn nil, responseResult, responseResult.Err\n\t}\n\n\t// Extract projects from the response body.\n\tvar result struct {\n\t\tProjects []*Project `json:\"projects\"`\n\t}\n\terr = responseResult.ExtractResult(&result)\n\tif err != nil {\n\t\treturn nil, responseResult, err\n\t}\n\n\treturn result.Projects, responseResult, nil\n}", "func MockListEmptyProjectsResponse() MockResponse {\n\treturn MockResponse{\n\t\tStatusCode: http.StatusOK,\n\t\tResponse: listEmptyProjectsResponse,\n\t}\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (s *ProjectsService) List(ctx context.Context, opts *PagingOptions) (*ProjectsList, error) {\n\tquery := addPaging(url.Values{}, opts)\n\treq, err := s.Client.NewRequest(ctx, http.MethodGet, newURI(projectsURI), WithQuery(query))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"get projects request creation failed: %w\", err)\n\t}\n\tres, resp, err := s.Client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"list projects failed: %w\", err)\n\t}\n\n\tif resp != nil && resp.StatusCode == http.StatusNotFound {\n\t\treturn nil, ErrNotFound\n\t}\n\n\tif resp != nil && resp.StatusCode == http.StatusBadRequest {\n\t\treturn nil, fmt.Errorf(\"list projects failed: %s\", resp.Status)\n\t}\n\n\tp := &ProjectsList{\n\t\tProjects: []*Project{},\n\t}\n\tif err := json.Unmarshal(res, p); err != nil {\n\t\treturn nil, fmt.Errorf(\"list projects failed, unable to unmarshal repository list json: %w\", err)\n\t}\n\n\tfor _, r := range p.GetProjects() {\n\t\tr.Session.set(resp)\n\t}\n\n\treturn p, nil\n}", "func ListProjectHandler(c *gin.Context) {\r\n\tres, err := ListProjectsCore()\r\n\tif err != nil {\r\n\t\tc.JSON(500, err)\r\n\t} else {\r\n\t\tc.JSON(200, res)\r\n\t}\r\n}", "func EncodeGetResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewGetResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeGetResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewGetResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (k *Keystone) ListProjectsAPI(c echo.Context) error {\n\tclusterID := c.Request().Header.Get(xClusterIDKey)\n\tif ke := getKeystoneEndpoints(clusterID, k.endpointStore); len(ke) > 0 {\n\t\treturn k.proxyRequest(c, ke)\n\t}\n\n\ttoken, err := k.validateToken(c.Request())\n\tif err != nil {\n\t\treturn err\n\t}\n\tconfigEndpoint, err := k.setAssignment(clusterID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tuserProjects := []*keystone.Project{}\n\tuser := token.User\n\tprojects := k.Assignment.ListProjects()\n\tif configEndpoint == \"\" {\n\t\tfor _, project := range projects {\n\t\t\tfor _, role := range user.Roles {\n\t\t\t\tif role.Project.Name == project.Name {\n\t\t\t\t\tuserProjects = append(userProjects, role.Project)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tuserProjects = append(userProjects, projects...)\n\t}\n\tprojectsResponse := &ProjectListResponse{\n\t\tProjects: userProjects,\n\t}\n\treturn c.JSON(http.StatusOK, projectsResponse)\n}", "func (o PublicAdvertisedPrefixPublicDelegatedPrefixResponseOutput) Project() pulumi.StringOutput {\n\treturn o.ApplyT(func(v PublicAdvertisedPrefixPublicDelegatedPrefixResponse) string { return v.Project }).(pulumi.StringOutput)\n}", "func ProjectList(quietList bool) error {\n\tcli, err := newBkCli()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn cli.projectList(quietList)\n}", "func EncodeAdminSearchResponse(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\t\tbody := NewAdminSearchResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (s *Server) List(ctx context.Context, q *ProjectQuery) (*v1alpha1.AppProjectList, error) {\n\tlist, err := s.appclientset.ArgoprojV1alpha1().AppProjects(s.ns).List(metav1.ListOptions{})\n\tlist.Items = append(list.Items, v1alpha1.GetDefaultProject(s.ns))\n\tif list != nil {\n\t\tnewItems := make([]v1alpha1.AppProject, 0)\n\t\tfor i := range list.Items {\n\t\t\tproject := list.Items[i]\n\t\t\tif s.enf.EnforceClaims(ctx.Value(\"claims\"), \"projects\", \"get\", project.Name) {\n\t\t\t\tnewItems = append(newItems, project)\n\t\t\t}\n\t\t}\n\t\tlist.Items = newItems\n\t}\n\treturn list, err\n}", "func NewProjectList(controller controller.Controller, router *Router) *ProjectList {\n\tp := &ProjectList{\n\t\tcontroller: controller,\n\t\trouter: router,\n\t}\n\tp.createComponents()\n\treturn p\n}", "func EncodeEnableResponse(_ 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 ProjectList(opts gitlab.ListProjectsOptions, n int) ([]*gitlab.Project, error) {\n\tlist, resp, err := lab.Projects.ListProjects(&opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.CurrentPage == resp.TotalPages {\n\t\treturn list, nil\n\t}\n\topts.Page = resp.NextPage\n\tfor len(list) < n || n == -1 {\n\t\tif n != -1 {\n\t\t\topts.PerPage = n - len(list)\n\t\t}\n\t\tprojects, resp, err := lab.Projects.ListProjects(&opts)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\topts.Page = resp.NextPage\n\t\tlist = append(list, projects...)\n\t\tif resp.CurrentPage == resp.TotalPages {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn list, nil\n}", "func (g *projectGateway) ListProjectsAction(params project.ListProjectsParams) middleware.Responder {\n\tlistRsp, err := g.projectClient.List(context.TODO(), &proto.ListRequest{})\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn project.NewCreateProjectInternalServerError()\n\t}\n\n\tvar projects = []*models.Project{}\n\tfor _, listResp := range listRsp.Projects {\n\t\tp := &models.Project{\n\t\t\tUUID: strfmt.UUID(listResp.Uuid),\n\t\t\tName: listResp.Name,\n\t\t\tDescription: listResp.Description,\n\t\t}\n\t\tprojects = append(projects, p)\n\t}\n\n\treturn project.NewListProjectsOK().WithPayload(projects)\n}", "func (t ListGroupsRequest) Encode(e *Encoder, version int16) {\n}", "func EncodeLoginResponse(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.(*authviews.Authorized)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewLoginResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeGetAllCompaniesResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tres := response.(endpoints.GetAllCompaniesResponse)\n\terr := getError(res.Err)\n\tif err == nil {\n\t\tvar companies []*pb.JobCompany\n\t\tfor _, company := range res.Companies {\n\t\t\tcompanies = append(companies, company.ToProto())\n\t\t}\n\t\treturn &pb.GetAllJobCompaniesResponse{Companies: companies}, nil\n\t}\n\treturn nil, err\n}", "func (iter ProjectListIterator) Response() ProjectList {\n\treturn iter.page.Response()\n}", "func (o ShareSettingsResponseOutput) Projects() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ShareSettingsResponse) []string { return v.Projects }).(pulumi.StringArrayOutput)\n}", "func (pg *MongoDb) ListProjects(ctx context.Context, filter string, pageSize int, pageToken string) ([]*prpb.Project, string, error) {\n\t//id := decryptInt64(pageToken, pg.PaginationKey, 0)\n\t//TODO\n\treturn nil, \"\", nil\n}", "func EncodeRegisterResponse(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.(int)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusCreated)\n\t\treturn enc.Encode(body)\n\t}\n}", "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\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (a *Client) ListProjects(params *ListProjectsParams) (*ListProjectsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListProjectsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"listProjects\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/projects\",\n\t\tProducesMediaTypes: []string{\"application/release-manager.v1+json\"},\n\t\tConsumesMediaTypes: []string{\"application/release-manager.v1+json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &ListProjectsReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*ListProjectsOK), nil\n\n}", "func (cli *bkCli) projectList(quietList bool) error {\n\n\tt := time.Now()\n\n\tprojects, err := cli.listProjects()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif quietList {\n\t\tfor _, proj := range projects {\n\t\t\tfmt.Printf(\"%-36s\\n\", *proj.ID)\n\t\t}\n\t\treturn nil // we are done\n\t}\n\n\ttb := table.New(projectColumns)\n\tvals := make(map[string]interface{})\n\n\tfor _, proj := range projects {\n\t\tif proj.FeaturedBuild != nil {\n\t\t\tfb := proj.FeaturedBuild\n\t\t\tvals = utils.ToMap(projectColumns, []interface{}{*proj.ID, *proj.Name, *fb.Number, toString(fb.Branch), toString(fb.Message), toString(fb.State), valString(fb.FinishedAt)})\n\t\t} else {\n\t\t\tvals = utils.ToMap(projectColumns, []interface{}{*proj.ID, *proj.Name, 0, \"\", \"\", \"\", \"\"})\n\t\t}\n\t\ttb.AddRow(vals)\n\t}\n\ttb.Markdown = true\n\ttb.Print()\n\n\tfmt.Printf(\"\\nTime taken: %s\\n\", time.Now().Sub(t))\n\n\treturn err\n}", "func (s *ProjectsService) ListProjects(opt *ProjectOptions) (*map[string]ProjectInfo, *Response, error) {\n\tu := \"projects/\"\n\n\tu, err := addOptions(u, opt)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tv := new(map[string]ProjectInfo)\n\tresp, err := s.client.Call(\"GET\", u, nil, v)\n\treturn v, resp, err\n}", "func (c *CodeShipProvider) GetProjectsList() ([]string, error) {\n\tres, _, err := c.API.ListProjects(c.Context)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc.Projects = res.Projects\n\n\tvar strs []string\n\tfor index, project := range res.Projects {\n\t\tstrs = append(strs, fmt.Sprintf(\"[%d] %s\", index, project.Name))\n\t}\n\n\treturn strs, nil\n}", "func (m *manager) List(query ...*models.ProjectQueryParam) ([]*models.Project, error) {\n\tvar q *models.ProjectQueryParam\n\tif len(query) > 0 {\n\t\tq = query[0]\n\t}\n\treturn dao.GetProjects(q)\n}", "func (c *ClientImpl) ListProject(ctx context.Context, hcpHostURL string) ([]hcpModels.Tenant, error) {\n\tspan, _ := opentracing.StartSpanFromContext(ctx, \"List HCP Projects\")\n\tdefer span.Finish()\n\n\tsession, err := c.getSession(ctx, hcpHostURL, hcpUserName, hcpPassword)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstatus = Failure\n\tmonitor := metrics.StartExternalCall(externalSvcName, \"List Projects from HCP\")\n\tdefer func() { monitor.RecordWithStatus(status) }()\n\n\tresp, err := mlopsHttp.ExecuteHTTPRequest(\n\t\tctx,\n\t\tc.client,\n\t\thcpHostURL+projectPathV1,\n\t\thttp.MethodGet,\n\t\tmap[string]string{sessionHeader: session},\n\t\tbytes.NewReader(nil),\n\t)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"while fetching projects from MLOps controller platform.\")\n\t}\n\n\tstatus = Success\n\n\terr = c.deleteSession(ctx, hcpHostURL, session)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar tenants hcpModels.ListTenants\n\t_, parseRespErr := common.ParseResponse(resp, &tenants)\n\tif parseRespErr != nil {\n\t\tlog.Errorf(\"Failed to fetch projects from HCP: %v\", parseRespErr)\n\t\treturn nil, errors.Wrapf(parseRespErr, \"Failed to fetch projects from HCP\")\n\t}\n\n\t// filter only ML projects\n\tvar mlProjects []hcpModels.Tenant\n\tfor _, tenant := range tenants.Embedded.Tenants {\n\t\tif tenant.Features.MlProject {\n\t\t\tmlProjects = append(mlProjects, tenant)\n\t\t}\n\t}\n\treturn mlProjects, nil\n}", "func (s ListProjectsOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.NextToken != nil {\n\t\tv := *s.NextToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"nextToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.ProjectSummaries != nil {\n\t\tv := s.ProjectSummaries\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"projectSummaries\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "func (s ListProjectsOutput) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.NextToken != nil {\n\t\tv := *s.NextToken\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"nextToken\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif len(s.Projects) > 0 {\n\t\tv := s.Projects\n\n\t\tmetadata := protocol.Metadata{}\n\t\tls0 := e.List(protocol.BodyTarget, \"projects\", metadata)\n\t\tls0.Start()\n\t\tfor _, v1 := range v {\n\t\t\tls0.ListAddFields(v1)\n\t\t}\n\t\tls0.End()\n\n\t}\n\treturn nil\n}", "func (o *GetProjectSummaryOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tpayload := o.Payload\n\tif err := producer.Produce(rw, payload); err != nil {\n\t\tpanic(err) // let the recovery middleware deal with this\n\t}\n}", "func ProjectsJSONPrint(t []dto.Project, w io.Writer) error {\n\treturn json.NewEncoder(w).Encode(t)\n}", "func TestProjectsList(t *testing.T) {\n\n\tviper.Set(\"token\", token)\n\n\tprojects, err := projects.GetProjects()\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tif len(projects) < 1 {\n\t\tt.Error(\"no projects\")\n\t} else {\n\t\tvar ok bool\n\t\tfor _, p := range projects {\n\t\t\tif p.Name == projectTest {\n\t\t\t\tok = true\n\t\t\t}\n\t\t}\n\t\tif !ok {\n\t\t\tt.Error(\"there is no \", projectTest)\n\t\t}\n\t}\n}", "func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n return json.NewEncoder(w).Encode(response)\n}", "func (l *PackageRefList) Encode() []byte {\n\tvar buf bytes.Buffer\n\n\tencoder := codec.NewEncoder(&buf, &codec.MsgpackHandle{})\n\tencoder.Encode(l)\n\n\treturn buf.Bytes()\n}", "func (f *FakeProjectProvider) List(options *provider.ProjectListOptions) ([]*kubermaticapiv1.Project, error) {\n\treturn nil, errors.New(\"not implemented\")\n}", "func (*ListProjectsResponse) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{1}\n}", "func BuildListProjectAssociatedPayload(stationListProjectAssociatedProjectID string, stationListProjectAssociatedAuth string) (*station.ListProjectAssociatedPayload, error) {\n\tvar err error\n\tvar projectID int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(stationListProjectAssociatedProjectID, 10, 32)\n\t\tprojectID = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for projectID, must be INT32\")\n\t\t}\n\t}\n\tvar auth *string\n\t{\n\t\tif stationListProjectAssociatedAuth != \"\" {\n\t\t\tauth = &stationListProjectAssociatedAuth\n\t\t}\n\t}\n\tv := &station.ListProjectAssociatedPayload{}\n\tv.ProjectID = projectID\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func GetListProj(c *gin.Context) {\r\n\t//var gp []model.GrupProject\r\n\t//var gp1 model.GrupProject\r\n\tvar gp3 []model.Project\r\n\r\n\t/*if err := c.Bind(&u); err != nil {\r\n\t\tutils.WrapAPIError(c, err.Error(), http.StatusBadRequest)\r\n\t\treturn\r\n\t}\r\n\t//log.Println(\"LOGIN\") */\r\n\r\n\t//di save >> save\r\n\r\n\taID := c.Param(\"username\")\r\n\r\n\t//model.DB.Where(\"username = ?\", aID).Preload(\"GrupProject\", \"username\", aID).Find(&gp3)\r\n\r\n\tmodel.DB.Preload(\"GrupProject\", \"username\", aID).Find(&gp3)\r\n\t//model.DB.Raw(\"Select * from projct group by username order by trending desc limit 3\").Scan(&trending_membership)\r\n\r\n\t//model.DB.Where(\"grup_projects.username = ?\", aID).Preload(\"GrupProject\", \"username\", aID).Find(&gp3)\r\n\r\n\t//model.DB.Model(&gp1).Where(\"username=?\", aID).Scan(&gp)\r\n\t//model.DB.Model(&gp).Where(\"id_project=?\", gp.id_project).Scan(&gp3)\r\n\r\n\tutils.WrapAPIData(c, map[string]interface{}{\r\n\t\t\"Anggota\": gp3,\r\n\t}, http.StatusOK, \"success\")\r\n}", "func ProjectGet(w http.ResponseWriter, r *http.Request) {\n\tdb := utils.GetDB()\n\tdefer db.Close()\n\n\tvar projects []models.Project\n\terr := db.Find(&projects).Error\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 400)\n\t\tutils.LOG.Println(err)\n\t\treturn\n\t}\n\n\terr = json.NewEncoder(w).Encode(projects)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\tutils.LOG.Println(err)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\tw.Write([]byte(`success`))\n\n}", "func NewProjectList(list []*Project) *ProjectList {\n\treturn &ProjectList{Projects: list}\n}", "func CreateListExperimentGroupsResponse() (response *ListExperimentGroupsResponse) {\n\tresponse = &ListExperimentGroupsResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif e, ok := response.(errorer); ok && e.error() != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tw.WriteHeader(codeFrom(e.error()))\n\t\treturn marshalStructWithError(response, w)\n\t}\n\n\t// Used for pagination\n\tif e, ok := response.(counter); ok {\n\t\tw.Header().Set(\"X-Total-Count\", strconv.Itoa(e.count()))\n\t}\n\n\t// Don't overwrite a header (i.e. called from encodeTextResponse)\n\tif v := w.Header().Get(\"Content-Type\"); v == \"\" {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\t// Only write json body if we're setting response as json\n\t\treturn json.NewEncoder(w).Encode(response)\n\t}\n\treturn nil\n}", "func ProjectListUsers(w http.ResponseWriter, r *http.Request) {\n\n\tvar err error\n\tvar pageSize int\n\tvar paginatedUsers auth.PaginatedUsers\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\trefRoles := gorillaContext.Get(r, \"auth_roles\").([]string)\n\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\n\t// Grab url path variables\n\turlValues := r.URL.Query()\n\tpageToken := urlValues.Get(\"pageToken\")\n\tstrPageSize := urlValues.Get(\"pageSize\")\n\n\tif strPageSize != \"\" {\n\t\tif pageSize, err = strconv.Atoi(strPageSize); err != nil {\n\t\t\tlog.Errorf(\"Pagesize %v produced an error while being converted to int: %v\", strPageSize, err.Error())\n\t\t\terr := APIErrorInvalidData(\"Invalid page size\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// check that user is indeed a service admin in order to be priviledged to see full user info\n\tpriviledged := auth.IsServiceAdmin(refRoles)\n\n\t// Get Results Object - call is always priviledged because this handler is only accessible by service admins\n\tif paginatedUsers, err = auth.PaginatedFindUsers(pageToken, int32(pageSize), projectUUID, priviledged, refStr); err != nil {\n\t\terr := APIErrorInvalidData(\"Invalid page token\")\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Output result to JSON\n\tresJSON, err := paginatedUsers.ExportJSON()\n\n\tif err != nil {\n\t\terr := APIErrExportJSON()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Write response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n\n}", "func HandleListSuccessfully(t *testing.T, output string) {\n\tth.Mux.HandleFunc(\"/software_configs\", func(w http.ResponseWriter, r *http.Request) {\n\t\tth.TestMethod(t, r, \"GET\")\n\t\tth.TestHeader(t, r, \"X-Auth-Token\", fake.TokenID)\n\t\tth.TestHeader(t, r, \"Accept\", \"application/json\")\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\tw.WriteHeader(http.StatusOK)\n\t\tfmt.Fprintf(w, output)\n\t\t//r.ParseForm()\n\t})\n}", "func encodeGetAllIndustriesResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tres := response.(endpoints.GetAllIndustriesResponse)\n\terr := getError(res.Err)\n\tif err == nil {\n\t\tvar industries []*pb.Industry\n\t\tfor _, industry := range res.Industries {\n\t\t\tindustries = append(industries, industry.ToProto())\n\t\t}\n\t\treturn &pb.GetAllIndustriesResponse{Industries: industries}, nil\n\t}\n\treturn nil, err\n}", "func responseList (w http.ResponseWriter, response *model.Response, invoices *model.InvoicesResponse) {\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tvar err error\n\tif response.Code < 0{\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\terr = json.NewEncoder(w).Encode(&response)\n\t}else{\n\t\tw.WriteHeader(http.StatusOK)\n\t\terr = json.NewEncoder(w).Encode(&invoices)\n\t}\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func (e *BcsDataManager) GetAllProjectList(ctx context.Context,\n\treq *bcsdatamanager.GetAllProjectListRequest, rsp *bcsdatamanager.GetAllProjectListResponse) error {\n\tblog.Infof(\"Received GetAllProjectList.Call request. Dimension:%s, page:%d, size:%d, startTime=%s, endTime=%s\",\n\t\treq.GetDimension(), req.Page, req.Size, time.Unix(req.GetStartTime(), 0),\n\t\ttime.Unix(req.GetEndTime(), 0))\n\tstart := time.Now()\n\tresult, total, err := e.model.GetProjectList(ctx, req)\n\tif err != nil {\n\t\trsp.Message = fmt.Sprintf(\"get project list error: %v\", err)\n\t\trsp.Code = bcsCommon.AdditionErrorCode + 500\n\t\tblog.Errorf(rsp.Message)\n\t\tprom.ReportAPIRequestMetric(\"GetAllProjectList\", \"grpc\", prom.StatusErr, start)\n\t\treturn nil\n\t}\n\trsp.Data = result\n\trsp.Message = bcsCommon.BcsSuccessStr\n\trsp.Code = bcsCommon.BcsSuccess\n\trsp.Total = uint32(total)\n\tprom.ReportAPIRequestMetric(\"GetAllProjectList\", \"grpc\", prom.StatusOK, start)\n\treturn nil\n}", "func (v NetworkListResponse) EncodeJSON(b []byte) []byte {\n\tb = append(b, '{', '\"', 'n', 'e', 't', 'w', 'o', 'r', 'k', '_', 'i', 'd', 'e', 'n', 't', 'i', 'f', 'i', 'e', 'r', 's', '\"', ':', '[')\n\tfor i, elem := range v.NetworkIdentifiers {\n\t\tif i != 0 {\n\t\t\tb = append(b, \",\"...)\n\t\t}\n\t\tb = elem.EncodeJSON(b)\n\t}\n\treturn append(b, \"]}\"...)\n}", "func GetListTracks(w http.ResponseWriter, r *http.Request) {\n\tresponse := make(map[string]interface{})\n\tqueuedTracks := context.tq.list()\n\n\tresponse[\"queue\"] = queuedTracks\n\tresponse[\"now_playing\"] = map[string]interface{}{\n\t\t\"track\": context.np.current,\n\t\t\"time_remaining\": context.np.timeRemaining,\n\t}\n\n\tjresponse, _ := json.Marshal(response)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(jresponse)\n}", "func (p ProjectSimpleList) String() string {\n\tvar s string\n\ts += fmt.Sprintf(\"| %6s | %-20s | %-15s | %-65s |\\n\", \"ID\", \"Name\", \"Owner\", \"Self Link\")\n\tfor _, proj := range p.Embedded.Projects {\n\t\ts += fmt.Sprintf(\"| %6s | %-20s | %-15s | %65s |\\n\", proj.ID, proj.Name, proj.Owner, proj.Links.Self.Href)\n\t}\n\treturn s\n}", "func (o *CreateProjectOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {\n\n\trw.WriteHeader(200)\n\tif o.Payload != nil {\n\t\tpayload := o.Payload\n\t\tif err := producer.Produce(rw, payload); err != nil {\n\t\t\tpanic(err) // let the recovery middleware deal with this\n\t\t}\n\t}\n}", "func EncodeDeleteResponse(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.SuccessResult)\n\t\tctx = context.WithValue(ctx, goahttp.ContentTypeKey, \"application/json\")\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewDeleteResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func UnmarshalWorkspaceResponseList(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(WorkspaceResponseList)\n\terr = core.UnmarshalPrimitive(m, \"count\", &obj.Count)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"limit\", &obj.Limit)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"offset\", &obj.Offset)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"workspaces\", &obj.Workspaces, UnmarshalWorkspaceResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func MockListProjectColumnsResponse() MockResponse {\n\treturn MockResponse{\n\t\tStatusCode: http.StatusOK,\n\t\tResponse: listProjectColumnsResponse,\n\t}\n}", "func (repos *TestRepositories) ListProjects(ctx context.Context, owner string, repo string, opts *github.ProjectListOptions) ([]*github.Project, *github.Response, error) {\n\n\tvar resultProjects = make([]*github.Project, 3)\n\n\tnames := []string{\"Project 1\", \"Project 2\", \"Project 3\"}\n\tbodies := []string{\"This is a project\", \"This is a project\", \"This is a project\"}\n\n\tfor i, v := range []int{1, 2, 3} {\n\t\tresultProjects[i] = &github.Project{\n\t\t\tNumber: &v,\n\t\t\tName: &names[i],\n\t\t\tBody: &bodies[i],\n\t\t}\n\t}\n\n\treturn resultProjects, prepareGitHubAPIResponse(), nil\n\n}", "func (p *ProjectHandler) ListProjects(ctx context.Context,\n\treq *proto.ListProjectsRequest, resp *proto.ListProjectsResponse) error {\n\tla := project.NewListAction(p.model)\n\tprojects, e := la.Do(ctx, req)\n\tif e != nil {\n\t\treturn e\n\t}\n\tauthUser, err := middleware.GetUserFromContext(ctx)\n\tif err == nil && authUser.Username != \"\" {\n\t\t// with username\n\t\t// 获取 project id, 用以获取对应的权限\n\t\tids := getProjectIDs(projects)\n\t\tperms, err := auth.ProjectIamClient.GetMultiProjectMultiActionPermission(\n\t\t\tauthUser.Username, ids,\n\t\t\t[]string{auth.ProjectCreate, auth.ProjectView, auth.ProjectEdit, auth.ProjectDelete},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// 处理返回\n\t\tsetListPermsResp(resp, projects, perms)\n\t} else {\n\t\t// without username\n\t\tsetListPermsResp(resp, projects, nil)\n\t}\n\tif err := projutil.PatchBusinessName(resp.Data.Results); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (*ListProjectsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{0}\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.52944976", "0.5215282", "0.5206305", "0.52030975", "0.5195665", "0.5194451", "0.51678014", "0.51621747", "0.51350325", "0.51193726", "0.5104441", "0.50945234", "0.5087951", "0.5030543", "0.5030155", "0.5030155", "0.50087684", "0.50075626", "0.5005072", "0.49594885", "0.49500585", "0.49500585", "0.49490207", "0.4943463", "0.4912149", "0.4912149", "0.49077508", "0.4905274", "0.49018687", "0.4880158", "0.48750687", "0.4873342", "0.486452", "0.48531097", "0.48350507", "0.4832998", "0.48237082", "0.48203462", "0.4810758", "0.4794996", "0.47945726", "0.47646528", "0.47607508", "0.47523937", "0.47493643", "0.47455487", "0.47237268", "0.47213584", "0.47205642", "0.4706381", "0.4702116", "0.46929845", "0.46899545", "0.46886504", "0.46836886", "0.46755025", "0.46736708", "0.46719062", "0.46675605", "0.46623477", "0.46578702", "0.46573257", "0.46500942", "0.46437454", "0.46379367", "0.46355614", "0.4631364", "0.46296316", "0.46250647", "0.4608738", "0.4607049", "0.46033463", "0.4598814", "0.45982158", "0.45894918", "0.4583456", "0.45831794", "0.4572244", "0.45719188" ]
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 := params[\"id\"]\n\t\t\tv, err2 := strconv.ParseInt(idRaw, 10, 32)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"id\", idRaw, \"integer\"))\n\t\t\t}\n\t\t\tid = int32(v)\n\t\t}\n\t\tauthRaw := r.Header.Get(\"Authorization\")\n\t\tif authRaw != \"\" {\n\t\t\tauth = &authRaw\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewListProjectPayload(id, auth)\n\t\tif payload.Auth != nil {\n\t\t\tif strings.Contains(*payload.Auth, \" \") {\n\t\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\t\tcred := strings.SplitN(*payload.Auth, \" \", 2)[1]\n\t\t\t\tpayload.Auth = &cred\n\t\t\t}\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "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 BuildListProjectPayload(stationListProjectID string, stationListProjectDisableFiltering string, stationListProjectAuth string) (*station.ListProjectPayload, error) {\n\tvar err error\n\tvar id int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(stationListProjectID, 10, 32)\n\t\tid = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for id, must be INT32\")\n\t\t}\n\t}\n\tvar disableFiltering *bool\n\t{\n\t\tif stationListProjectDisableFiltering != \"\" {\n\t\t\tvar val bool\n\t\t\tval, err = strconv.ParseBool(stationListProjectDisableFiltering)\n\t\t\tdisableFiltering = &val\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid value for disableFiltering, must be BOOL\")\n\t\t\t}\n\t\t}\n\t}\n\tvar auth *string\n\t{\n\t\tif stationListProjectAuth != \"\" {\n\t\t\tauth = &stationListProjectAuth\n\t\t}\n\t}\n\tv := &station.ListProjectPayload{}\n\tv.ID = id\n\tv.DisableFiltering = disableFiltering\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func DecodeListRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error) {\n\treturn func(r *http.Request) (any, error) {\n\t\tvar (\n\t\t\tname *string\n\t\t\tstatus bool\n\t\t\terr error\n\t\t)\n\t\tnameRaw := r.URL.Query().Get(\"name\")\n\t\tif nameRaw != \"\" {\n\t\t\tname = &nameRaw\n\t\t}\n\t\t{\n\t\t\tstatusRaw := r.URL.Query().Get(\"status\")\n\t\t\tif statusRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseBool(statusRaw)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"status\", statusRaw, \"boolean\"))\n\t\t\t\t}\n\t\t\t\tstatus = v\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewListPayload(name, status)\n\n\t\treturn payload, nil\n\t}\n}", "func DecodeProjectRequest(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\tprojectID 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\tprojectIDRaw := params[\"projectID\"]\n\t\t\tv, err2 := strconv.ParseInt(projectIDRaw, 10, 32)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"projectID\", projectIDRaw, \"integer\"))\n\t\t\t}\n\t\t\tprojectID = int32(v)\n\t\t}\n\t\tauthRaw := r.Header.Get(\"Authorization\")\n\t\tif authRaw != \"\" {\n\t\t\tauth = &authRaw\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewProjectPayload(projectID, auth)\n\t\tif payload.Auth != nil {\n\t\t\tif strings.Contains(*payload.Auth, \" \") {\n\t\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\t\tcred := strings.SplitN(*payload.Auth, \" \", 2)[1]\n\t\t\t\tpayload.Auth = &cred\n\t\t\t}\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func BuildListProjectPayload(stationListProjectID string, stationListProjectAuth string) (*station.ListProjectPayload, error) {\n\tvar err error\n\tvar id int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(stationListProjectID, 10, 32)\n\t\tid = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for id, must be INT32\")\n\t\t}\n\t}\n\tvar auth string\n\t{\n\t\tauth = stationListProjectAuth\n\t}\n\tv := &station.ListProjectPayload{}\n\tv.ID = id\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func NewListProjectHandler(\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.Handler {\n\tvar (\n\t\tdecodeRequest = DecodeListProjectRequest(mux, decoder)\n\t\tencodeResponse = EncodeListProjectResponse(encoder)\n\t\tencodeError = EncodeListProjectError(encoder, formatter)\n\t)\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get(\"Accept\"))\n\t\tctx = context.WithValue(ctx, goa.MethodKey, \"list project\")\n\t\tctx = context.WithValue(ctx, goa.ServiceKey, \"station\")\n\t\tpayload, err := decodeRequest(r)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tres, err := endpoint(ctx, payload)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif err := encodeResponse(ctx, w, res); err != nil {\n\t\t\terrhandler(ctx, w, err)\n\t\t}\n\t})\n}", "func DecodeListReq(ctx context.Context, r *http.Request) (interface{}, error) {\n\tvar request api.ListRequest\n\tif err := json.NewDecoder(r.Body).Decode(&request); err != nil {\n\t\treturn nil, err\n\t}\n\treturn request, nil\n}", "func (c *Client) ListProject(ctx context.Context, p *ListProjectPayload) (res *StationsFull, err error) {\n\tvar ires interface{}\n\tires, err = c.ListProjectEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(*StationsFull), nil\n}", "func ListProject(projectID string) error {\n\tclient, err := NewPacketClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp, _, err := client.Projects.Get(projectID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te := MarshallAndPrint(p)\n\treturn e\n}", "func (t *ListGroupsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\treturn err\n}", "func DecodeListRequest(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\tcursor *int\n\t\t\tlimit *int\n\t\t\ttoken string\n\t\t\terr error\n\t\t)\n\t\t{\n\t\t\tcursorRaw := r.URL.Query().Get(\"cursor\")\n\t\t\tif cursorRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(cursorRaw, 10, strconv.IntSize)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"cursor\", cursorRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tpv := int(v)\n\t\t\t\tcursor = &pv\n\t\t\t}\n\t\t}\n\t\t{\n\t\t\tlimitRaw := r.URL.Query().Get(\"limit\")\n\t\t\tif limitRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(limitRaw, 10, strconv.IntSize)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"limit\", limitRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tpv := int(v)\n\t\t\t\tlimit = &pv\n\t\t\t}\n\t\t}\n\t\ttoken = r.Header.Get(\"Authorization\")\n\t\tif token == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewListPayload(cursor, limit, token)\n\t\tif strings.Contains(payload.Token, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Token, \" \", 2)[1]\n\t\t\tpayload.Token = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func ProjectList(c *gin.Context) error {\n\tuserID, err := GetIDParam(c, userIDParam)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toption := &model.ProjectQueryOption{\n\t\tUserID: userID,\n\t}\n\n\tif limit := c.Query(\"limit\"); limit != \"\" {\n\t\tif i, err := strconv.Atoi(limit); err == nil {\n\t\t\toption.Limit = i\n\t\t}\n\t}\n\n\tif offset := c.Query(\"offset\"); offset != \"\" {\n\t\tif i, err := strconv.Atoi(offset); err == nil {\n\t\t\toption.Offset = i\n\t\t}\n\t}\n\n\tif order := c.Query(\"order\"); order != \"\" {\n\t\toption.Order = order\n\t} else {\n\t\toption.Order = \"-created_at\"\n\t}\n\n\tif err := CheckUserPermission(c, *userID); err == nil {\n\t\toption.Private = true\n\t}\n\n\tlist, err := model.GetProjectList(option)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn common.APIResponse(c, http.StatusOK, list)\n}", "func (impl *ProjectAPIClient) List(ctx context.Context, token *api.Token) (reply []application.Definition, err error) {\n\terr = client.CallHTTP(ctx, impl.BaseURL, \"ProjectAPI.List\", atomic.AddUint64(&impl.sequence, 1), &reply, token)\n\treturn\n}", "func EncodeListProjectResponse(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.StationsFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListProjectResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeListProjectResponse(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.StationsFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListProjectResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (*ListProjectsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{0}\n}", "func NewProjectList(controller controller.Controller, router *Router) *ProjectList {\n\tp := &ProjectList{\n\t\tcontroller: controller,\n\t\trouter: router,\n\t}\n\tp.createComponents()\n\treturn p\n}", "func (t *ListOffsetRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.ReplicaId, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 2 {\n\t\tt.IsolationLevel, err = d.Int8()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]ListOffsetTopic2, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item ListOffsetTopic2\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func (o *ListParams) WithProject(project string) *ListParams {\n\to.SetProject(project)\n\treturn o\n}", "func (d *Driver) ProjectList() (*ProjectListResponse, error) {\n\tresponse := &ProjectListResponse{}\n\tlistProjects := project.NewListProjectsParams()\n\tresp, err := d.project.ListProjects(listProjects, d.auth)\n\tif err != nil {\n\t\treturn response, err\n\t}\n\tresponse.Project = resp.Payload\n\treturn response, nil\n}", "func ListProjects() error {\n\tclient, err := NewPacketClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprojects, _, err := client.Projects.List()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te := MarshallAndPrint(projects)\n\treturn e\n}", "func (t *DescribeConfigsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\t// Resources\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Resources = make([]DescribeConfigsResource32, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item DescribeConfigsResource32\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Resources[i] = item\n\t\t}\n\t}\n\tif version >= 1 {\n\t\tt.IncludeSynoyms, err = d.Bool()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "func (t *ListPartitionReassignmentsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TimeoutMs, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]ListPartitionReassignmentsTopics46, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item ListPartitionReassignmentsTopics46\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func NewListTasksRequest(server string, params *ListTasksParams) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/domain/v2alpha2/tasks\")\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryUrl.Query()\n\n\tif params.Page != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"page\", *params.Page); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.PageSize != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"page_size\", *params.PageSize); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.Domain != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"domain\", *params.Domain); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.OrganizationId != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"organization_id\", *params.OrganizationId); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tqueryUrl.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func (a *Client) PostProjectsList(params *PostProjectsListParams, authInfo runtime.ClientAuthInfoWriter) (*PostProjectsListOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostProjectsListParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostProjectsList\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/projects/list\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PostProjectsListReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*PostProjectsListOK), nil\n\n}", "func (m *manager) List(query ...*models.ProjectQueryParam) ([]*models.Project, error) {\n\tvar q *models.ProjectQueryParam\n\tif len(query) > 0 {\n\t\tq = query[0]\n\t}\n\treturn dao.GetProjects(q)\n}", "func (pl ProjectList) projectListPreparer(ctx context.Context) (*http.Request, error) {\n\tif pl.NextLink == nil || len(to.String(pl.NextLink)) < 1 {\n\t\treturn nil, nil\n\t}\n\treturn autorest.Prepare((&http.Request{}).WithContext(ctx),\n\t\tautorest.AsJSON(),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(to.String(pl.NextLink)))\n}", "func (t *DeleteGroupsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.GroupsNames, err = d.StringArray()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func DecodeListMineRequest(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\tauth string\n\t\t\terr error\n\t\t)\n\t\tauth = r.Header.Get(\"Authorization\")\n\t\tif auth == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewListMinePayload(auth)\n\t\tif strings.Contains(payload.Auth, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Auth, \" \", 2)[1]\n\t\t\tpayload.Auth = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func DecodeListMineRequest(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\tauth string\n\t\t\terr error\n\t\t)\n\t\tauth = r.Header.Get(\"Authorization\")\n\t\tif auth == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewListMinePayload(auth)\n\t\tif strings.Contains(payload.Auth, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Auth, \" \", 2)[1]\n\t\t\tpayload.Auth = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func DecodeScoreListRequest(ctx context.Context, v interface{}, md metadata.MD) (interface{}, error) {\n\tvar (\n\t\tmessage *scorepb.ScoreListRequest\n\t\tok bool\n\t)\n\t{\n\t\tif message, ok = v.(*scorepb.ScoreListRequest); !ok {\n\t\t\treturn nil, goagrpc.ErrInvalidType(\"Score\", \"ScoreList\", \"*scorepb.ScoreListRequest\", v)\n\t\t}\n\t\tif err := ValidateScoreListRequest(message); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tvar payload *score.ScoreListPayload\n\t{\n\t\tpayload = NewScoreListPayload(message)\n\t}\n\treturn payload, nil\n}", "func (*ListProjectsRequest) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{0}\n}", "func (c *ProjectService) List() ([]Project, *http.Response, error) {\n\tresponse := new(projectListResponse)\n\tapiError := new(APIError)\n\tresp, err := c.sling.New().Get(\"\").Receive(response, apiError)\n\treturn response.Results, resp, relevantError(err, *apiError)\n}", "func CreateGetApplicationListRequest() (request *GetApplicationListRequest) {\n\trequest = &GetApplicationListRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"mse\", \"2019-05-31\", \"GetApplicationList\", \"mse\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "func NewProjectListPage(getNextPage func(context.Context, ProjectList) (ProjectList, error)) ProjectListPage {\n\treturn ProjectListPage{fn: getNextPage}\n}", "func decodeGetAllJobPlatformsRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.GetAllJobPlatformsRequest)\n\tdecoded := endpoints.GetAllJobPlatformsRequest{\n\t\tID: req.Id,\n\t\tName: req.Name,\n\t}\n\treturn decoded, nil\n}", "func (t *DescribeGroupsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.Groups, err = d.StringArray()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 3 {\n\t\tt.IncludeAuthorizedOperations, err = d.Bool()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "func decodeListOrderRequest(_ context.Context, r *stdhttp.Request) (interface{}, error) {\n\tqp := processBasicQP(r)\n\treturn qp, nil\n}", "func NewProjectList(list []*Project) *ProjectList {\n\treturn &ProjectList{Projects: list}\n}", "func MountListProjectHandler(mux goahttp.Muxer, h http.Handler) {\n\tf, ok := handleStationOrigin(h).(http.HandlerFunc)\n\tif !ok {\n\t\tf = func(w http.ResponseWriter, r *http.Request) {\n\t\t\th.ServeHTTP(w, r)\n\t\t}\n\t}\n\tmux.Handle(\"GET\", \"/projects/{id}/stations\", f)\n}", "func (t *AlterConfigsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\t// Resources\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Resources = make([]AlterConfigsResource33, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item AlterConfigsResource33\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Resources[i] = item\n\t\t}\n\t}\n\tt.ValidateOnly, err = d.Bool()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func NewListRequest() *todopb.ListRequest {\n\tmessage := &todopb.ListRequest{}\n\treturn message\n}", "func decodeHTTPListRolesRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvar req endpoints.ListRolesRequest\n\treturn req, nil\n}", "func (project *ProjectV1) ListProjectsWithContext(ctx context.Context, listProjectsOptions *ListProjectsOptions) (result *ProjectCollection, response *core.DetailedResponse, err error) {\n\terr = core.ValidateStruct(listProjectsOptions, \"listProjectsOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = project.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(project.Service.Options.URL, `/v1/projects`, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range listProjectsOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"project\", \"V1\", \"ListProjects\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\n\tif listProjectsOptions.Start != nil {\n\t\tbuilder.AddQuery(\"start\", fmt.Sprint(*listProjectsOptions.Start))\n\t}\n\tif listProjectsOptions.Limit != nil {\n\t\tbuilder.AddQuery(\"limit\", fmt.Sprint(*listProjectsOptions.Limit))\n\t}\n\n\trequest, err := builder.Build()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar rawResponse map[string]json.RawMessage\n\tresponse, err = project.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalProjectCollection)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tresponse.Result = result\n\t}\n\n\treturn\n}", "func (a *IamProjectApiService) IamProjectList(ctx context.Context) ApiIamProjectListRequest {\n\treturn ApiIamProjectListRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (s *Server) List(ctx context.Context, q *ProjectQuery) (*v1alpha1.AppProjectList, error) {\n\tlist, err := s.appclientset.ArgoprojV1alpha1().AppProjects(s.ns).List(metav1.ListOptions{})\n\tlist.Items = append(list.Items, v1alpha1.GetDefaultProject(s.ns))\n\tif list != nil {\n\t\tnewItems := make([]v1alpha1.AppProject, 0)\n\t\tfor i := range list.Items {\n\t\t\tproject := list.Items[i]\n\t\t\tif s.enf.EnforceClaims(ctx.Value(\"claims\"), \"projects\", \"get\", project.Name) {\n\t\t\t\tnewItems = append(newItems, project)\n\t\t\t}\n\t\t}\n\t\tlist.Items = newItems\n\t}\n\treturn list, err\n}", "func ProjectList(quietList bool) error {\n\tcli, err := newBkCli()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn cli.projectList(quietList)\n}", "func List(ctx context.Context, client *selvpcclient.ServiceClient) ([]*Project, *selvpcclient.ResponseResult, error) {\n\turl := strings.Join([]string{client.Endpoint, resourceURL}, \"/\")\n\tresponseResult, err := client.DoRequest(ctx, http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif responseResult.Err != nil {\n\t\treturn nil, responseResult, responseResult.Err\n\t}\n\n\t// Extract projects from the response body.\n\tvar result struct {\n\t\tProjects []*Project `json:\"projects\"`\n\t}\n\terr = responseResult.ExtractResult(&result)\n\tif err != nil {\n\t\treturn nil, responseResult, err\n\t}\n\n\treturn result.Projects, responseResult, nil\n}", "func decodeGetAllIndustriesRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.GetAllIndustriesRequest)\n\tdecoded := endpoints.GetAllIndustriesRequest{\n\t\tID: req.Id,\n\t\tName: req.Name,\n\t}\n\treturn decoded, nil\n}", "func GetListProj(c *gin.Context) {\r\n\t//var gp []model.GrupProject\r\n\t//var gp1 model.GrupProject\r\n\tvar gp3 []model.Project\r\n\r\n\t/*if err := c.Bind(&u); err != nil {\r\n\t\tutils.WrapAPIError(c, err.Error(), http.StatusBadRequest)\r\n\t\treturn\r\n\t}\r\n\t//log.Println(\"LOGIN\") */\r\n\r\n\t//di save >> save\r\n\r\n\taID := c.Param(\"username\")\r\n\r\n\t//model.DB.Where(\"username = ?\", aID).Preload(\"GrupProject\", \"username\", aID).Find(&gp3)\r\n\r\n\tmodel.DB.Preload(\"GrupProject\", \"username\", aID).Find(&gp3)\r\n\t//model.DB.Raw(\"Select * from projct group by username order by trending desc limit 3\").Scan(&trending_membership)\r\n\r\n\t//model.DB.Where(\"grup_projects.username = ?\", aID).Preload(\"GrupProject\", \"username\", aID).Find(&gp3)\r\n\r\n\t//model.DB.Model(&gp1).Where(\"username=?\", aID).Scan(&gp)\r\n\t//model.DB.Model(&gp).Where(\"id_project=?\", gp.id_project).Scan(&gp3)\r\n\r\n\tutils.WrapAPIData(c, map[string]interface{}{\r\n\t\t\"Anggota\": gp3,\r\n\t}, http.StatusOK, \"success\")\r\n}", "func (s *ProjectsService) List(ctx context.Context, opts *PagingOptions) (*ProjectsList, error) {\n\tquery := addPaging(url.Values{}, opts)\n\treq, err := s.Client.NewRequest(ctx, http.MethodGet, newURI(projectsURI), WithQuery(query))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"get projects request creation failed: %w\", err)\n\t}\n\tres, resp, err := s.Client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"list projects failed: %w\", err)\n\t}\n\n\tif resp != nil && resp.StatusCode == http.StatusNotFound {\n\t\treturn nil, ErrNotFound\n\t}\n\n\tif resp != nil && resp.StatusCode == http.StatusBadRequest {\n\t\treturn nil, fmt.Errorf(\"list projects failed: %s\", resp.Status)\n\t}\n\n\tp := &ProjectsList{\n\t\tProjects: []*Project{},\n\t}\n\tif err := json.Unmarshal(res, p); err != nil {\n\t\treturn nil, fmt.Errorf(\"list projects failed, unable to unmarshal repository list json: %w\", err)\n\t}\n\n\tfor _, r := range p.GetProjects() {\n\t\tr.Session.set(resp)\n\t}\n\n\treturn p, nil\n}", "func ProjectListOne(w http.ResponseWriter, r *http.Request) {\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab url path variables\n\turlVars := mux.Vars(r)\n\turlProject := urlVars[\"project\"]\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get Results Object\n\tresults, err := projects.Find(\"\", urlProject, refStr)\n\n\tif err != nil {\n\n\t\tif err.Error() == \"not found\" {\n\t\t\terr := APIErrorNotFound(\"ProjectUUID\")\n\t\t\trespondErr(w, err)\n\t\t\treturn\n\t\t}\n\t\terr := APIErrQueryDatastore()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Output result to JSON\n\tres := results.One()\n\tresJSON, err := res.ExportJSON()\n\n\tif err != nil {\n\t\terr := APIErrExportJSON()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Write response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n\n}", "func ProjectList(opts gitlab.ListProjectsOptions, n int) ([]*gitlab.Project, error) {\n\tlist, resp, err := lab.Projects.ListProjects(&opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.CurrentPage == resp.TotalPages {\n\t\treturn list, nil\n\t}\n\topts.Page = resp.NextPage\n\tfor len(list) < n || n == -1 {\n\t\tif n != -1 {\n\t\t\topts.PerPage = n - len(list)\n\t\t}\n\t\tprojects, resp, err := lab.Projects.ListProjects(&opts)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\topts.Page = resp.NextPage\n\t\tlist = append(list, projects...)\n\t\tif resp.CurrentPage == resp.TotalPages {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn list, nil\n}", "func (cmd *ListStationProjectCommand) Run(c *client.Client, args []string) error {\n\tvar path string\n\tif len(args) > 0 {\n\t\tpath = args[0]\n\t} else {\n\t\tpath = fmt.Sprintf(\"/stations/%v/projects\", cmd.StationID)\n\t}\n\tlogger := goa.NewLogger(log.New(os.Stderr, \"\", log.LstdFlags))\n\tctx := goa.WithLogger(context.Background(), logger)\n\tresp, err := c.ListStationProject(ctx, path)\n\tif err != nil {\n\t\tgoa.LogError(ctx, \"failed\", \"err\", err)\n\t\treturn err\n\t}\n\n\tgoaclient.HandleResponse(c.Client, resp, cmd.PrettyPrint)\n\treturn nil\n}", "func ProjectListAll(w http.ResponseWriter, r *http.Request) {\n\n\t// Init output\n\toutput := []byte(\"\")\n\n\t// Add content type header to the response\n\tcontentType := \"application/json\"\n\tcharset := \"utf-8\"\n\tw.Header().Add(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab context references\n\trefStr := gorillaContext.Get(r, \"str\").(stores.Store)\n\n\t// Get Results Object\n\n\tres, err := projects.Find(\"\", \"\", refStr)\n\n\tif err != nil && err.Error() != \"not found\" {\n\t\terr := APIErrQueryDatastore()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Output result to JSON\n\tresJSON, err := res.ExportJSON()\n\n\tif err != nil {\n\t\terr := APIErrExportJSON()\n\t\trespondErr(w, err)\n\t\treturn\n\t}\n\n\t// Write response\n\toutput = []byte(resJSON)\n\trespondOK(w, output)\n\n}", "func UnmarshalWorkspaceResponseList(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(WorkspaceResponseList)\n\terr = core.UnmarshalPrimitive(m, \"count\", &obj.Count)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"limit\", &obj.Limit)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"offset\", &obj.Offset)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"workspaces\", &obj.Workspaces, UnmarshalWorkspaceResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func BuildListProjectAssociatedPayload(stationListProjectAssociatedProjectID string, stationListProjectAssociatedAuth string) (*station.ListProjectAssociatedPayload, error) {\n\tvar err error\n\tvar projectID int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(stationListProjectAssociatedProjectID, 10, 32)\n\t\tprojectID = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for projectID, must be INT32\")\n\t\t}\n\t}\n\tvar auth *string\n\t{\n\t\tif stationListProjectAssociatedAuth != \"\" {\n\t\t\tauth = &stationListProjectAssociatedAuth\n\t\t}\n\t}\n\tv := &station.ListProjectAssociatedPayload{}\n\tv.ProjectID = projectID\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func (p *ProjectListAPIView) POST(w http.ResponseWriter, r *http.Request) {\n\n\tvar err error\n\n\t// get auth user to check permissions\n\tusermanager := models.NewUserManager(p.context)\n\tuser := usermanager.NewUser()\n\tif err = usermanager.GetAuthUser(user, r); err != nil {\n\t\t// this should not happened\n\t\tresponse.New(http.StatusUnauthorized).Write(w, r)\n\t\treturn\n\t}\n\n\t// unmarshal posted data\n\tserializer := ProjectCreateSerializer{}\n\n\tif err = p.context.Bind(&serializer); err != nil {\n\t\tresponse.New(http.StatusBadRequest).Write(w, r)\n\t}\n\n\t// validate struct\n\tif vr := serializer.Validate(p.context); !vr.IsValid() {\n\t\tresponse.New(http.StatusBadRequest).Error(vr).Write(w, r)\n\t\treturn\n\t}\n\n\t// get team from serializer.TeamID\n\tteam := models.NewTeam()\n\tif err = team.Manager(p.context).GetByID(team, serializer.TeamID); err != nil {\n\t\tresponse.New(http.StatusNotFound).Write(w, r)\n\t\treturn\n\t}\n\n\t// check permissions (IsSuperuser, member type)\n\ttmm := models.NewTeamMemberManager(p.context)\n\tvar mt models.MemberType\n\t// not superuser so we have to check member type for permissions\n\tif !user.IsSuperuser {\n\t\tif mt, err = tmm.MemberType(team, user); err != nil || mt != models.MEMBER_TYPE_ADMIN {\n\t\t\tresponse.New(http.StatusForbidden).Write(w, r)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// // create project\n\tproject := models.NewProject(func(proj *models.Project) {\n\t\tproj.Name = serializer.Name\n\t\tproj.Platform = serializer.Platform\n\t\tproj.TeamID = types.ForeignKey(team.ID)\n\t})\n\n\tif vr, _ := project.Validate(p.context); !vr.IsValid() {\n\t\tresponse.New(http.StatusBadRequest).Error(vr).Write(w, r)\n\t\treturn\n\t}\n\n\tif err = project.Insert(p.context); err != nil {\n\t\tresponse.New(http.StatusInternalServerError).Error(err).Write(w, r)\n\t\treturn\n\t}\n\n\t// create new project key\n\tpk := models.NewProjectKey(func(projectKey *models.ProjectKey) {\n\t\tprojectKey.UserID = types.ForeignKey(user.ID)\n\t\tprojectKey.UserAddedID = types.ForeignKey(user.ID)\n\t\tprojectKey.ProjectID = project.ID.ToForeignKey()\n\t})\n\n\tif err = pk.Insert(p.context); err != nil {\n\t\tresponse.New(http.StatusInternalServerError).Error(err).Write(w, r)\n\t\treturn\n\t}\n\n\t// everything went ok\n\tresponse.New(http.StatusCreated).Result(project).Write(w, r)\n}", "func CreateListProgramTypeCountRequest() (request *ListProgramTypeCountRequest) {\n\trequest = &ListProgramTypeCountRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"dataworks-public\", \"2020-05-18\", \"ListProgramTypeCount\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (c *Client) ListProject() (projectNames []string, err error) {\n\th := map[string]string{\n\t\t\"x-log-bodyrawsize\": \"0\",\n\t}\n\n\turi := \"/\"\n\tproj := convert(c, \"\")\n\n\ttype Project struct {\n\t\tProjectName string `json:\"projectName\"`\n\t}\n\n\ttype Body struct {\n\t\tProjects []Project `json:\"projects\"`\n\t}\n\n\tr, err := request(proj, \"GET\", uri, h, nil)\n\tif err != nil {\n\t\treturn nil, NewClientError(err)\n\t}\n\n\tdefer r.Body.Close()\n\tbuf, _ := ioutil.ReadAll(r.Body)\n\tif r.StatusCode != http.StatusOK {\n\t\terr := new(Error)\n\t\tjson.Unmarshal(buf, err)\n\t\treturn nil, err\n\t}\n\n\tbody := &Body{}\n\terr = json.Unmarshal(buf, body)\n\tfor _, project := range body.Projects {\n\t\tprojectNames = append(projectNames, project.ProjectName)\n\t}\n\treturn projectNames, err\n}", "func NewListDomainsRequest(server string, params *ListDomainsParams) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/domain/v2alpha2/domains\")\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryUrl.Query()\n\n\tif params.Page != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"page\", *params.Page); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.PageSize != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"page_size\", *params.PageSize); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.OrderBy != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"order_by\", *params.OrderBy); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.Registrar != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"registrar\", *params.Registrar); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.Status != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"status\", *params.Status); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.OrganizationId != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"organization_id\", *params.OrganizationId); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.IsExternal != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"is_external\", *params.IsExternal); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tqueryUrl.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func NewGetProjectsRequest(server string, params *GetProjectsParams) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/projects\")\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryUrl.Query()\n\n\tif params.Query != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"query\", *params.Query); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.Identifier != nil {\n\n\t\tif queryFrag, err := runtime.StyleParam(\"form\", true, \"identifier\", *params.Identifier); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tqueryUrl.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func unmarshalProject(b []byte, c *Client) (*Project, error) {\n\tvar m map[string]interface{}\n\tif err := json.Unmarshal(b, &m); err != nil {\n\t\treturn nil, err\n\t}\n\treturn unmarshalMapProject(m, c)\n}", "func NewProjectsRequest(server string, params *ProjectsParams) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl := fmt.Sprintf(\"%s/projects\", server)\n\n\tvar queryStrings []string\n\n\tvar queryParam0 string\n\tif params.Q != nil {\n\n\t\tqueryParam0, err = runtime.StyleParam(\"form\", true, \"q\", *params.Q)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tqueryStrings = append(queryStrings, queryParam0)\n\t}\n\n\tvar queryParam1 string\n\tif params.Offset != nil {\n\n\t\tqueryParam1, err = runtime.StyleParam(\"form\", true, \"offset\", *params.Offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tqueryStrings = append(queryStrings, queryParam1)\n\t}\n\n\tvar queryParam2 string\n\tif params.Limit != nil {\n\n\t\tqueryParam2, err = runtime.StyleParam(\"form\", true, \"limit\", *params.Limit)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tqueryStrings = append(queryStrings, queryParam2)\n\t}\n\n\tif len(queryStrings) != 0 {\n\t\tqueryUrl += \"?\" + strings.Join(queryStrings, \"&\")\n\t}\n\n\treq, err := http.NewRequest(\"GET\", queryUrl, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func TestGetProjectJobTokenInboundAllowList(t *testing.T) {\n\tmux, client := setup(t)\n\n\t// Handle project ID 1, and print a result of two projects\n\tmux.HandleFunc(\"/api/v4/projects/1/job_token_scope/allowlist\", func(w http.ResponseWriter, r *http.Request) {\n\t\ttestMethod(t, r, http.MethodGet)\n\n\t\t// Print on the response\n\t\tfmt.Fprint(w, `[{\"id\":1},{\"id\":2}]`)\n\t})\n\n\twant := []*Project{{ID: 1}, {ID: 2}}\n\tprojects, _, err := client.JobTokenScope.GetProjectJobTokenInboundAllowList(\n\t\t1,\n\t\t&GetJobTokenInboundAllowListOptions{},\n\t)\n\n\tassert.NoError(t, err)\n\tassert.Equal(t, want, projects)\n}", "func (client *DicomServicesClient) listByWorkspaceCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *DicomServicesClientListByWorkspaceOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif workspaceName == \"\" {\n\t\treturn nil, errors.New(\"parameter workspaceName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{workspaceName}\", url.PathEscape(workspaceName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-06-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func (c *Client) BuildListRequest(ctx context.Context, v interface{}) (*http.Request, error) {\n\tu := &url.URL{Scheme: c.scheme, Host: c.host, Path: ListResourcePath()}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, goahttp.ErrInvalidURL(\"resource\", \"List\", u.String(), err)\n\t}\n\tif ctx != nil {\n\t\treq = req.WithContext(ctx)\n\t}\n\n\treturn req, nil\n}", "func ProjectListFactory() (cli.Command, error) {\n\tcomm, err := newCommand(\"nerd project list\", \"List all your projects.\", \"\", nil)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to create command\")\n\t}\n\tcmd := &ProjectList{\n\t\tcommand: comm,\n\t}\n\tcmd.runFunc = cmd.DoRun\n\n\treturn cmd, nil\n}", "func (t *ApiVersionsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tif version >= 3 {\n\t\tt.ClientSoftwareName, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif version >= 3 {\n\t\tt.ClientSoftwareVersion, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "func (t *SyncGroupRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.GroupId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.GenerationId, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.MemberId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 3 {\n\t\tt.GroupInstanceId, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Assignments\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Assignments = make([]SyncGroupRequestAssignment14, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item SyncGroupRequestAssignment14\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Assignments[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func CreateDescribePortConnsListRequest() (request *DescribePortConnsListRequest) {\n\trequest = &DescribePortConnsListRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"ddoscoo\", \"2020-01-01\", \"DescribePortConnsList\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "func (s *TaskService) ListWithProject(projectID int64) ([]Task, *http.Response, error) {\n\tresObj := new(TaskResponse)\n\tresp, err := s.sling.New().\n\t\tQueryStruct(CreateFunctionParam(\"gettasks\")).\n\t\tQueryStruct(&GetTasksParam{ProjectID: &projectID}).\n\t\tReceiveSuccess(resObj)\n\tif resObj != nil && len(resObj.Results) > 0 {\n\t\tif resObj.Results[0].ErrorDesc != nil {\n\t\t\treturn nil, resp, Error{*resObj.Results[0].ErrorDesc}\n\t\t}\n\t\treturn *(&resObj.Results), resp, err\n\t}\n\treturn make([]Task, 0), resp, err\n}", "func (t *DescribeLogDirsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\t// Topics\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Topics = make([]DescribableLogDirTopic35, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item DescribableLogDirTopic35\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Topics[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func (c *Client) NewListLabelRequest(ctx context.Context, path string, ifModifiedSince *string, ifNoneMatch *string) (*http.Request, error) {\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"http\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader := req.Header\n\tif ifModifiedSince != nil {\n\n\t\theader.Set(\"If-Modified-Since\", *ifModifiedSince)\n\t}\n\tif ifNoneMatch != nil {\n\n\t\theader.Set(\"If-None-Match\", *ifNoneMatch)\n\t}\n\treturn req, nil\n}", "func (l *PackageRefList) Decode(input []byte) error {\n\tdecoder := codec.NewDecoderBytes(input, &codec.MsgpackHandle{})\n\treturn decoder.Decode(l)\n}", "func UnmarshalProjectConfigPatchRequest(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(ProjectConfigPatchRequest)\n\terr = core.UnmarshalPrimitive(m, \"name\", &obj.Name)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"labels\", &obj.Labels)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"description\", &obj.Description)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"type\", &obj.Type)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"external_resources_account\", &obj.ExternalResourcesAccount)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"locator_id\", &obj.LocatorID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"input\", &obj.Input, UnmarshalProjectConfigInputVariable)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"setting\", &obj.Setting, UnmarshalProjectConfigSettingCollection)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func (o *ListParams) SetProject(project string) {\n\to.Project = project\n}", "func CreateGetNamespaceListRequest() (request *GetNamespaceListRequest) {\n\trequest = &GetNamespaceListRequest{\n\t\tRoaRequest: &requests.RoaRequest{},\n\t}\n\trequest.InitWithApiInfo(\"cr\", \"2016-06-07\", \"GetNamespaceList\", \"/namespace\", \"cr\", \"openAPI\")\n\trequest.Method = requests.GET\n\treturn\n}", "func (c *ClientImpl) ListProject(ctx context.Context, hcpHostURL string) ([]hcpModels.Tenant, error) {\n\tspan, _ := opentracing.StartSpanFromContext(ctx, \"List HCP Projects\")\n\tdefer span.Finish()\n\n\tsession, err := c.getSession(ctx, hcpHostURL, hcpUserName, hcpPassword)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstatus = Failure\n\tmonitor := metrics.StartExternalCall(externalSvcName, \"List Projects from HCP\")\n\tdefer func() { monitor.RecordWithStatus(status) }()\n\n\tresp, err := mlopsHttp.ExecuteHTTPRequest(\n\t\tctx,\n\t\tc.client,\n\t\thcpHostURL+projectPathV1,\n\t\thttp.MethodGet,\n\t\tmap[string]string{sessionHeader: session},\n\t\tbytes.NewReader(nil),\n\t)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"while fetching projects from MLOps controller platform.\")\n\t}\n\n\tstatus = Success\n\n\terr = c.deleteSession(ctx, hcpHostURL, session)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar tenants hcpModels.ListTenants\n\t_, parseRespErr := common.ParseResponse(resp, &tenants)\n\tif parseRespErr != nil {\n\t\tlog.Errorf(\"Failed to fetch projects from HCP: %v\", parseRespErr)\n\t\treturn nil, errors.Wrapf(parseRespErr, \"Failed to fetch projects from HCP\")\n\t}\n\n\t// filter only ML projects\n\tvar mlProjects []hcpModels.Tenant\n\tfor _, tenant := range tenants.Embedded.Tenants {\n\t\tif tenant.Features.MlProject {\n\t\t\tmlProjects = append(mlProjects, tenant)\n\t\t}\n\t}\n\treturn mlProjects, nil\n}", "func (*ListProjectsResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_project_api_ocp_project_api_proto_rawDescGZIP(), []int{1}\n}", "func (t *IncrementalAlterConfigsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\t// Resources\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Resources = make([]AlterConfigsResource44, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item AlterConfigsResource44\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Resources[i] = item\n\t\t}\n\t}\n\tt.ValidateOnly, err = d.Bool()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func UnmarshalProject(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(Project)\n\terr = core.UnmarshalPrimitive(m, \"name\", &obj.Name)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"description\", &obj.Description)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"id\", &obj.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"crn\", &obj.Crn)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"configs\", &obj.Configs, UnmarshalProjectConfig)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"metadata\", &obj.Metadata, UnmarshalProjectMetadata)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func (t *DescribeDelegationTokenRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\t// Owners\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Owners = make([]DescribeDelegationTokenOwner41, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item DescribeDelegationTokenOwner41\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Owners[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func (k *Keystone) ListProjectsAPI(c echo.Context) error {\n\tclusterID := c.Request().Header.Get(xClusterIDKey)\n\tif ke := getKeystoneEndpoints(clusterID, k.endpointStore); len(ke) > 0 {\n\t\treturn k.proxyRequest(c)\n\t}\n\t_, err := k.validateToken(c.Request())\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = k.setAssignment(clusterID)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.JSON(http.StatusOK, &asfkeystone.ProjectListResponse{\n\t\tProjects: k.Assignment.ListProjects(),\n\t})\n}", "func Decode(data bytes.Buffer, strict bool) (Playlist, ListType, error) {\n\treturn decode(&data, strict, nil)\n}", "func TestProjectsList(t *testing.T) {\n\n\tviper.Set(\"token\", token)\n\n\tprojects, err := projects.GetProjects()\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tif len(projects) < 1 {\n\t\tt.Error(\"no projects\")\n\t} else {\n\t\tvar ok bool\n\t\tfor _, p := range projects {\n\t\t\tif p.Name == projectTest {\n\t\t\t\tok = true\n\t\t\t}\n\t\t}\n\t\tif !ok {\n\t\t\tt.Error(\"there is no \", projectTest)\n\t\t}\n\t}\n}", "func (c *Client) BuildListRequest(ctx context.Context, v any) (*http.Request, error) {\n\tu := &url.URL{Scheme: c.scheme, Host: c.host, Path: ListStoragePath()}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, goahttp.ErrInvalidURL(\"storage\", \"list\", u.String(), err)\n\t}\n\tif ctx != nil {\n\t\treq = req.WithContext(ctx)\n\t}\n\n\treturn req, nil\n}", "func ListProjectEvents(id string) error {\n\tclient, err := NewExtPacketClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tevents, _, err := client.Events.ListProjectEvents(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te := MarshallAndPrint(events)\n\treturn e\n}", "func (s *Server) List(ctx context.Context, q *project.ProjectQuery) (*v1alpha1.AppProjectList, error) {\n\tlist, err := s.appclientset.ArgoprojV1alpha1().AppProjects(s.ns).List(ctx, metav1.ListOptions{})\n\tif list != nil {\n\t\tnewItems := make([]v1alpha1.AppProject, 0)\n\t\tfor i := range list.Items {\n\t\t\tproject := list.Items[i]\n\t\t\tif s.enf.Enforce(ctx.Value(\"claims\"), rbacpolicy.ResourceProjects, rbacpolicy.ActionGet, project.Name) {\n\t\t\t\tnewItems = append(newItems, project)\n\t\t\t}\n\t\t}\n\t\tlist.Items = newItems\n\t}\n\treturn list, err\n}", "func NewListRequest() *rolespb.ListRequest {\n\tmessage := &rolespb.ListRequest{}\n\treturn message\n}", "func (t *DeleteTopicsRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.TopicNames, err = d.StringArray()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.TimeoutMs, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func (t *JoinGroupRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.GroupId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.SessionTimeoutMs, err = d.Int32()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 1 {\n\t\tt.RebalanceTimeoutMs, err = d.Int32()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tt.MemberId, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 5 {\n\t\tt.GroupInstanceId, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tt.ProtocolType, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Protocols\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Protocols = make([]JoinGroupRequestProtocol11, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item JoinGroupRequestProtocol11\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Protocols[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func (a *Client) ProjectParticipantListPostList(params *ProjectParticipantListPostListParams, authInfo runtime.ClientAuthInfoWriter) (*ProjectParticipantListPostListCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewProjectParticipantListPostListParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"ProjectParticipantList_postList\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/project/participant/list\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json; charset=utf-8\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ProjectParticipantListPostListReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*ProjectParticipantListPostListCreated)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for ProjectParticipantList_postList: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func DecodeListAllRequest(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\tpage *int32\n\t\t\tpageSize *int32\n\t\t\townerID *int32\n\t\t\tquery *string\n\t\t\tsortBy *string\n\t\t\tauth string\n\t\t\terr error\n\t\t)\n\t\t{\n\t\t\tpageRaw := r.URL.Query().Get(\"page\")\n\t\t\tif pageRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(pageRaw, 10, 32)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"page\", pageRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tpv := int32(v)\n\t\t\t\tpage = &pv\n\t\t\t}\n\t\t}\n\t\t{\n\t\t\tpageSizeRaw := r.URL.Query().Get(\"pageSize\")\n\t\t\tif pageSizeRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(pageSizeRaw, 10, 32)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"pageSize\", pageSizeRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tpv := int32(v)\n\t\t\t\tpageSize = &pv\n\t\t\t}\n\t\t}\n\t\t{\n\t\t\townerIDRaw := r.URL.Query().Get(\"ownerId\")\n\t\t\tif ownerIDRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(ownerIDRaw, 10, 32)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"ownerID\", ownerIDRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tpv := int32(v)\n\t\t\t\townerID = &pv\n\t\t\t}\n\t\t}\n\t\tqueryRaw := r.URL.Query().Get(\"query\")\n\t\tif queryRaw != \"\" {\n\t\t\tquery = &queryRaw\n\t\t}\n\t\tsortByRaw := r.URL.Query().Get(\"sortBy\")\n\t\tif sortByRaw != \"\" {\n\t\t\tsortBy = &sortByRaw\n\t\t}\n\t\tauth = r.Header.Get(\"Authorization\")\n\t\tif auth == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewListAllPayload(page, pageSize, ownerID, query, sortBy, auth)\n\t\tif strings.Contains(payload.Auth, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Auth, \" \", 2)[1]\n\t\t\tpayload.Auth = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func decodeGetAllCompaniesRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.GetAllJobCompaniesRequest)\n\tdecoded := endpoints.GetAllCompaniesRequest{\n\t\tID: req.Id,\n\t\tName: req.Name,\n\t}\n\treturn decoded, nil\n}", "func (pg *MongoDb) ListProjects(ctx context.Context, filter string, pageSize int, pageToken string) ([]*prpb.Project, string, error) {\n\t//id := decryptInt64(pageToken, pg.PaginationKey, 0)\n\t//TODO\n\treturn nil, \"\", nil\n}", "func (r ListProjectsRequest) Send() (*ListProjectsOutput, error) {\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Request.Data.(*ListProjectsOutput), nil\n}", "func UnmarshalWorkspaceStatusRequest(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(WorkspaceStatusRequest)\n\terr = core.UnmarshalPrimitive(m, \"frozen\", &obj.Frozen)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"frozen_at\", &obj.FrozenAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"frozen_by\", &obj.FrozenBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"locked\", &obj.Locked)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"locked_by\", &obj.LockedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"locked_time\", &obj.LockedTime)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func GetProjectList(tasks []api.Task) []api.Task {\n\tvar result []api.Task\n\tfor _, task := range tasks {\n\t\tif task.IsProject() {\n\t\t\tresult = append(result, task)\n\t\t}\n\t}\n\treturn result\n}" ]
[ "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.49655336", "0.4932461", "0.49138418", "0.48854712", "0.4874036", "0.48527887", "0.48315924", "0.48158583", "0.480654", "0.47886172", "0.47886172", "0.47739774", "0.4759468", "0.47421876", "0.4739977", "0.47236902", "0.4723584", "0.47194806", "0.46806875", "0.46701235", "0.46647823", "0.46377543", "0.46289152", "0.46110722", "0.4610253", "0.4598045", "0.456582", "0.45657685", "0.45598558", "0.45593005", "0.45245737", "0.452372", "0.45221028", "0.45131716", "0.44945174", "0.44939297", "0.44909492", "0.44798863", "0.44796252", "0.4475271", "0.4471535", "0.44479313", "0.44478366", "0.44465482", "0.444416", "0.4442647", "0.4435744", "0.44350168", "0.4430724", "0.44288802", "0.44285813", "0.44191524", "0.44178125", "0.4417428", "0.43960285", "0.43918946", "0.43912685", "0.43810925", "0.43723643", "0.43657896", "0.4362979", "0.43566358", "0.43559375", "0.4343319", "0.4330178", "0.43274823", "0.43219042", "0.4320574", "0.43004197", "0.4298619", "0.42953482", "0.42898735", "0.42884776", "0.4287685", "0.42869917", "0.42855254", "0.42807785", "0.4280086", "0.4273532", "0.42676023" ]
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(ctx, w)\n\t\tbody := NewDownloadPhotoResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func NewPhotoHandler(\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.Handler {\n\tvar (\n\t\tdecodeRequest = DecodePhotoRequest(mux, decoder)\n\t\tencodeResponse = EncodePhotoResponse(encoder)\n\t\tencodeError = EncodePhotoError(encoder, formatter)\n\t)\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get(\"Accept\"))\n\t\tctx = context.WithValue(ctx, goa.MethodKey, \"photo\")\n\t\tctx = context.WithValue(ctx, goa.ServiceKey, \"station\")\n\t\tpayload, err := decodeRequest(r)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tres, err := endpoint(ctx, payload)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\to := res.(*station.PhotoResponseData)\n\t\tdefer o.Body.Close()\n\t\tif err := encodeResponse(ctx, w, o.Result); err != nil {\n\t\t\terrhandler(ctx, w, err)\n\t\t\treturn\n\t\t}\n\t\tif _, err := io.Copy(w, o.Body); err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t}\n\t})\n}", "func EncodeStationMetaResponse(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.(*sensor.StationMetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeMetaResponse(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.(*sensor.MetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeSensorMetaResponse(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.(*sensor.SensorMetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "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.StationPhotosView) *StationPhotosResponseBody {\n\tres := &StationPhotosResponseBody{\n\t\tSmall: *v.Small,\n\t}\n\n\treturn res\n}", "func encodeGetByCreteriaResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func (o SignatureResponseOutput) Image() ImageResponseOutput {\n\treturn o.ApplyT(func(v SignatureResponse) ImageResponse { return v.Image }).(ImageResponseOutput)\n}", "func encodeUploadResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\t\tlogrus.Warn(err.Error())\n\t\t}\n\treturn\n}", "func encodeCalculatorResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif e, ok := response.(errorer); ok && e.error() != nil {\n\t\t// Not a Go kit transport error, but a business-logic error.\n\t\t// Provide those as HTTP errors.\n\t\tencodeError(ctx, e.error(), w)\n\t\treturn nil\n\t}\n\n\t// fmt.Println(ctx)\n\tfmt.Println(response)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\treturn json.NewEncoder(w).Encode(response)\n}", "func EncodeListMineResponse(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.StationsFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListMineResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeListMineResponse(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.StationsFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewListMineResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodePatchResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(*tus.PatchResult)\n\t\tw.Header().Set(\"Tus-Resumable\", res.TusResumable)\n\t\t{\n\t\t\tval := res.UploadOffset\n\t\t\tuploadOffsets := strconv.FormatInt(val, 10)\n\t\t\tw.Header().Set(\"Upload-Offset\", uploadOffsets)\n\t\t}\n\t\tif res.UploadExpires != nil {\n\t\t\tw.Header().Set(\"Upload-Expires\", *res.UploadExpires)\n\t\t}\n\t\tw.WriteHeader(http.StatusNoContent)\n\t\treturn nil\n\t}\n}", "func EncodeBasicResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\") //允许访问所有域\n\tw.Header().Add(\"Access-Control-Allow-Headers\", \"Origin, Content-Type, Authorization, tk, encrypt, authorization, platform\") //自定义header头\n\tw.Header().Set(\"Access-Control-Allow-Credentials\", \"true\") //允许\n\tw.Header().Add(\"Access-Control-Allow-Methods\", \"GET, POST, OPTIONS\") //允许接受\n\tw.Header().Set(\"Content-Type\", \"application/json;charset=utf-8\")\n\tif f, ok := response.(endpoint.Failer); ok && f.Failed() != nil {\n\t\tbusinessErrorEncoder(f.Failed(), w)\n\t\treturn nil\n\t}\n\n\treturn json.NewEncoder(w).Encode(response)\n}", "func EncodeNewNeatThingResponse(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.(*neatthingviews.NeatThing)\n\t\tw.Header().Set(\"goa-view\", res.View)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewNewNeatThingResponseBodyFull(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeAddResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewAddResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeAddResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewAddResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeGetDealByStateResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeGenericResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\treturn json.NewEncoder(w).Encode(response)\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif e, ok := response.(errorer); ok && e.error() != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\tw.WriteHeader(codeFrom(e.error()))\n\t\treturn marshalStructWithError(response, w)\n\t}\n\n\t// Used for pagination\n\tif e, ok := response.(counter); ok {\n\t\tw.Header().Set(\"X-Total-Count\", strconv.Itoa(e.count()))\n\t}\n\n\t// Don't overwrite a header (i.e. called from encodeTextResponse)\n\tif v := w.Header().Get(\"Content-Type\"); v == \"\" {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\t// Only write json body if we're setting response as json\n\t\treturn json.NewEncoder(w).Encode(response)\n\t}\n\treturn nil\n}", "func (o ImageResponseOutput) RawBytes() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ImageResponse) string { return v.RawBytes }).(pulumi.StringOutput)\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\t// Set JSON type\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\t// Check error\n\tif e, ok := response.(errorer); ok {\n\t\t// This is a errorer class, now check for error\n\t\tif err := e.error(); err != nil {\n\t\t\tencodeError(ctx, e.error(), w)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// cast to dataHolder to get Data, otherwise just encode the resposne\n\tif holder, ok := response.(dataHolder); ok {\n\t\treturn json.NewEncoder(w).Encode(holder.getData())\n\t} else {\n\t\treturn json.NewEncoder(w).Encode(response)\n\t}\n}", "func encodeGetUserDealByStateResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeGetByMultiCriteriaResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func EncodeAuthtypeResponse(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.(vironviews.VironAuthtypeCollection)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewVironAuthtypeResponseCollection(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeJSONResponseFileImgUpload(_ context.Context, w http.ResponseWriter, request interface{}) error {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\treq := request.(*getFondoCursoByIDRequest)\n\topenFile, err := os.Open(\"uploads/curso/fondos/\" + req.File)\n\tif err != nil {\n\t\thttp.Error(w, \"Error al abrir la imagen\", http.StatusBadRequest)\n\t}\n\t_, err = io.Copy(w, openFile)\n\tif err != nil {\n\t\thttp.Error(w, \"Error al copiar la imagen\", http.StatusBadRequest)\n\t}\n\t// return json.NewEncoder(w).Encode(map[string]string{\"mensaje\": \"Imagen Encontrada\"})\n\treturn nil\n}", "func CreatePhotoProcessResponse() (response *PhotoProcessResponse) {\n\tresponse = &PhotoProcessResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func EncodeDataResponse(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.(*sensor.DataResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeRegisterResponse(_ context.Context, r interface{}) (interface{}, error) {\n\trs := r.(endpoint.RegisterResponse)\n\n\tif rs.Err != nil {\n\t\treturn &pb.RegisterReply{\n\t\t\tMessage: rs.Err.Error(),\n\t\t\tStatus: \"ERROR\",\n\t\t}, fmt.Errorf(\"Message: %v With Status: %v\", rs.Err.Error(), rs.Err)\n\t}\n\n\treturn &pb.RegisterReply{\n\t\tMessage: fmt.Sprintf(\"Hi %s %s We Send a SMS for verify your Phone!\", rs.Response.Name, rs.Response.LastName),\n\t\tStatus: \"SUCCESS\",\n\t}, nil\n}", "func encodeGetTagResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\t\tlogrus.Warn(err.Error())\n\t\t}\n\treturn\n}", "func EncodeNeatThingTodayResponse(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.(*neatthingviews.NeatThing)\n\t\tw.Header().Set(\"goa-view\", res.View)\n\t\tenc := encoder(ctx, w)\n\t\tvar body interface{}\n\t\tswitch res.View {\n\t\tcase \"default\", \"\":\n\t\t\tbody = NewNeatThingTodayResponseBody(res.Projected)\n\t\tcase \"full\":\n\t\t\tbody = NewNeatThingTodayResponseBodyFull(res.Projected)\n\t\tcase \"name\":\n\t\t\tbody = NewNeatThingTodayResponseBodyName(res.Projected)\n\t\tcase \"name+definition\":\n\t\t\tbody = NewNeatThingTodayResponseBodyNameDefinition(res.Projected)\n\t\tcase \"name+link\":\n\t\t\tbody = NewNeatThingTodayResponseBodyNameLink(res.Projected)\n\t\t}\n\t\tw.WriteHeader(http.StatusNoContent)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeUserInfoByPhoneResponse(_ context.Context, r interface{}) (interface{}, error) {\n\tresponse := r.(endpoint.UserInfoByPhoneResponse)\n\tvar user = &pb.UserInfo{\n\t\tId:response.U0.Id,\n\t\tPhone:response.U0.Phone,\n\t\tPassword:response.U0.Password,\n\t\tAge:response.U0.Age,\n\t}\n\treturn &pb.UserInfoByPhoneReply{\n\t\tUser:user,\n\t},nil\n}", "func EncodeRegisterResponse(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.(int)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusCreated)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeSigninResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(*securedservice.Creds)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewSigninResponseBody(res)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func marshalDiscussionAuthorPhotoToAuthorPhotoResponseBody(v *discussion.AuthorPhoto) *AuthorPhotoResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &AuthorPhotoResponseBody{\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func EncodeUserDetailsResponse(_ context.Context, r interface{}) (interface{}, error) {\n\tresp := r.(UserDetailsResponse)\n\treturn &pb.UserDetailsResponse{\n\t\tId: int32(resp.ID),\n\t\tUsername: resp.Username,\n\t\tEmail: resp.Email,\n\t\tPhoneNumber: resp.PhoneNumber,\n\t\tConfirmed: resp.Confirmed,\n\t}, nil\n}", "func (o SignatureResponsePtrOutput) Image() ImageResponsePtrOutput {\n\treturn o.ApplyT(func(v *SignatureResponse) *ImageResponse {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Image\n\t}).(ImageResponsePtrOutput)\n}", "func EncodeGetResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewGetResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeGetResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewGetResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeLoginResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(string)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeCreateTagResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\t\tlogrus.Warn(err.Error())\n\t\t}\n\treturn\n}", "func EncodeRefreshResponse(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.(*catalogviews.Job)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewRefreshResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeSecureResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(string)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeShowResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres := v.(*pipelineviews.EnduroStoredPipeline)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewShowResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodePutDealStateResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeGetUserResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeUpdateTagResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\tif err != nil {\n\t\t\tlogrus.Warn(err.Error())\n\t\t}\n\treturn\n}", "func EncodeRecentlyResponse(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.(*sensor.RecentlyResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeFetcherResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tfetcherResponse, ok := response.(FetchResponser)\n\tif !ok {\n\t\t//return errors.New(\"invalid Fetcher Response\")\n\t\te := errs.BadGateway{What: \"response\"}\n\t\tencodeError(ctx, &e, w)\n\t\treturn nil\n\t}\n\t//statusCode := fetcherResponse.GetStatusCode()\n\t//if statusCode != 200 {\n\t//\treturn errors.New(strconv.Itoa(statusCode))\n\t//}\n\t//if fetcherResponse.Error != \"\" {\n\t//\treturn errors.New(fetcherResponse.Error)\n\t//}\n\n\tdata, err := json.Marshal(fetcherResponse)\n\tif err != nil {\n\t\tencodeError(ctx, err, w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t_, err = w.Write(data)\n\n\tif err != nil {\n\t\tencodeError(ctx, err, w)\n\t\treturn nil\n\t}\n\treturn nil\n}", "func encodeHTTPGenericResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif f, ok := response.(kitendpoint.Failer); ok && f.Failed() != nil {\n\t\terrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\treturn json.NewEncoder(w).Encode(response)\n}", "func EncodeSearchResponse(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.(*posts.SearchResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewSearchResponseBody(res)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeRegisterResponse(_ context.Context, r interface{}) (interface{}, error) {\n\tresponse := r.(endpoint.RegisterResponse)\n\tif response.U0 == nil {\n\t\treturn nil,response.E1\n\t}\n\t//进行数据的转换\n\tvar user = &pb.UserInfo{\n\t\tId:response.U0.Id,\n\t\tPhone:response.U0.Phone,\n\t\tPassword:response.U0.Password,\n\t\tAge:response.U0.Age,\n\t}\n\treturn &pb.RegisterReply{\n\t\tUser:user,\n\t},response.E1\n\n}", "func EncodePostResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(*tus.PostResult)\n\t\tw.Header().Set(\"Location\", res.Location)\n\t\tw.Header().Set(\"Tus-Resumable\", res.TusResumable)\n\t\t{\n\t\t\tval := res.UploadOffset\n\t\t\tuploadOffsets := strconv.FormatInt(val, 10)\n\t\t\tw.Header().Set(\"Upload-Offset\", uploadOffsets)\n\t\t}\n\t\tif res.UploadExpires != nil {\n\t\t\tw.Header().Set(\"Upload-Expires\", *res.UploadExpires)\n\t\t}\n\t\tw.WriteHeader(http.StatusCreated)\n\t\treturn nil\n\t}\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif e, ok := response.(errorer); ok && e.error() != nil {\n\t\tEncodeError(ctx, e.error(), w)\n\t\treturn nil\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\treturn nil\n}", "func EncodeApplyMatchResponse(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.(*matchesviews.RestratingMatch)\n\t\tctx = context.WithValue(ctx, goahttp.ContentTypeKey, \"application/json\")\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewApplyMatchResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeResponse(w http.ResponseWriter, resp interface{}) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(resp)\n}", "func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n return json.NewEncoder(w).Encode(response)\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\treturn json.NewEncoder(w).Encode(response)\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\treturn json.NewEncoder(w).Encode(response)\n}", "func EncodeLoginResponse(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.(*authviews.Authorized)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewLoginResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func RespondOk(w http.ResponseWriter, r *http.Request, response interface{}) {\n\taccept := r.Header.Get(\"Accept\")\n\n\tvar err error\n\tjson := &codec.JsonHandle{}\n\tjson.Canonical = true\n\tcbor := &codec.CborHandle{}\n\n\tswitch accept {\n\tcase \"application/cbor\":\n\t\tw.Header().Set(\"Content-Type\", \"application/cbor\")\n\t\tenc := codec.NewEncoder(w, cbor)\n\t\terr = enc.Encode(response)\n\tdefault:\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tenc := codec.NewEncoder(w, json)\n\t\terr = enc.Encode(response)\n\t}\n\tif err != nil {\n\t\tlog.Printf(\"[RespondOk] Encode Error: %v, \", err)\n\t\tRespondError(w, r, http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {\n\tresp := response.(*common.XmidtResponse)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Header().Set(common.HeaderWPATID, ctx.Value(common.ContextKeyRequestTID).(string))\n\tcommon.ForwardHeadersByPrefix(\"\", resp.ForwardedHeaders, w.Header())\n\n\tw.WriteHeader(resp.Code)\n\t_, err = w.Write(resp.Body)\n\treturn\n}", "func (t UpdateMetadataResponse) Encode(e *Encoder, version int16) {\n\te.PutInt16(t.ErrorCode) // ErrorCode\n}", "func EncodeTailResponse(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.(*sensor.TailResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func encodeLoginPResponse(_ context.Context, r interface{}) (interface{}, error) {\n\trs := r.(endpoint.LoginPResponse)\n\n\tif rs.Err != nil {\n\t\treturn &pb.LoginPReply{}, fmt.Errorf(\"Error: %s \", rs.Err.Error())\n\t}\n\n\treturn &pb.LoginPReply{\n\t\tMessage: fmt.Sprintf(\"Hi %s %s We Send a SMS for verify your Phone!\", rs.Response.Name, rs.Response.LastName),\n\t\tStatus: \"SUCCESS\",\n\t}, nil\n}", "func encodeGetResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeGetResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func EncodeTransferResponse(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\tw.WriteHeader(http.StatusNoContent)\n\t\treturn nil\n\t}\n}", "func encodeUserInfoByIdResponse(_ context.Context, r interface{}) (interface{}, error) {\n\tresponse := r.(endpoint.UserInfoByIdResponse)\n\tvar user = &pb.UserInfo{\n\t\tId:response.U0.Id,\n\t\tPhone:response.U0.Phone,\n\t\tPassword:response.U0.Password,\n\t\tAge:response.U0.Age,\n\t}\n\treturn &pb.UserInfoByIdReply{\n\t\tUser:user,\n\t},nil\n}", "func encodeGetEventsResponse(_ context.Context, r interface{}) (interface{}, error) {\r\n\treturn nil, errors.New(\"'Events' Encoder is not impelemented\")\r\n}", "func encodeGetByIDResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeGetByIDResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func EncodeProcessingResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.([]string)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeResolveResponse(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.(*sensorviews.SavedBookmark)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewResolveResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeGRPCBlockConnectionResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tres := response.(BlockConnectionResponse)\n\tgRPCRes := &pb.BlockConnectionResponse{}\n\tif res.Error != nil {\n\t\tgRPCRes.Error = res.Error.Error()\n\t}\n\treturn gRPCRes, nil\n}", "func CorporateCreateTicketEncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tvar body []byte\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type,Authorization\")\n\tbody, err := json.Marshal(&response)\n\tlogger.Logf(\"CorporateCreateTicketEncodeResponse : %s\", string(body[:]))\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//w.Header().Set(\"X-Checksum\", cm.Cksum(body))\n\n\tvar e = response.(dt.CorporateCreateTicketJSONResponse).ResponseCode\n\n\tif e <= dt.HeaderStatusOk {\n\t\tw.WriteHeader(http.StatusOK)\n\t} else if e <= dt.StatusBadRequest {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t} else if e <= 998 {\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t} else {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t}\n\n\t_, err = w.Write(body)\n\n\treturn err\n}", "func EncodeGetInfoResponse(ctx context.Context, v interface{}, hdr, trlr *metadata.MD) (interface{}, error) {\n\tvres, ok := v.(*tableinfoviews.Tablepayload)\n\tif !ok {\n\t\treturn nil, goagrpc.ErrInvalidType(\"TableInfo\", \"get_info\", \"*tableinfoviews.Tablepayload\", v)\n\t}\n\tresult := vres.Projected\n\t(*hdr).Append(\"goa-view\", vres.View)\n\tresp := NewGetInfoResponse(result)\n\treturn resp, nil\n}", "func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tif e, ok := response.(errorer); ok && e.error() != nil {\n\t\t// Not a Go kit transport error, but a business-logic error.\n\t\t// Provide those as HTTP errors.\n\t\tencodeError(ctx, e.error(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", ContentType)\n\treturn json.NewEncoder(w).Encode(response)\n}", "func encodeGetDealByDIDResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeAddResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func encodeAddResponse(ctx context.Context, w http1.ResponseWriter, response interface{}) (err error) {\n\tif f, ok := response.(endpoint.Failure); ok && f.Failed() != nil {\n\t\tErrorEncoder(ctx, f.Failed(), w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\terr = json.NewEncoder(w).Encode(response)\n\treturn\n}", "func (t MetadataResponse) Encode(e *Encoder, version int16) {\n\tif version >= 3 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\t// Brokers\n\tlen1 := len(t.Brokers)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Brokers[i].Encode(e, version)\n\t}\n\tif version >= 2 {\n\t\te.PutString(t.ClusterId) // ClusterId\n\t}\n\tif version >= 1 {\n\t\te.PutInt32(t.ControllerId) // ControllerId\n\t}\n\t// Topics\n\tlen4 := len(t.Topics)\n\te.PutArrayLength(len4)\n\tfor i := 0; i < len4; i++ {\n\t\tt.Topics[i].Encode(e, version)\n\t}\n\tif version >= 8 {\n\t\te.PutInt32(t.ClusterAuthorizedOperations) // ClusterAuthorizedOperations\n\t}\n}", "func encodeSCEPResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\tresp := response.(SCEPResponse)\n\tif resp.Err != nil {\n\t\thttp.Error(w, resp.Err.Error(), http.StatusInternalServerError)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", contentHeader(resp.operation, resp.CACertNum))\n\tw.Write(resp.Data)\n\treturn nil\n}", "func EncodeInitResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tresp := response.(endpoints.InitResponse)\n\n\treturn &pb.InitResponse{\n\t\tKeys: resp.Init.Keys,\n\t\tKeysBase64: resp.Init.KeysB64,\n\t\tRecoveryKeys: resp.Init.RecoveryKeys,\n\t\tRecoveryKeysBase64: resp.Init.RecoveryKeysB64,\n\t\tRootToken: resp.Init.RootToken,\n\t\tErr: service.Error2String(resp.Err),\n\t}, nil\n}", "func encodeCreateCompanyResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tres := response.(endpoints.CreateCompanyResponse)\n\terr := getError(res.Err)\n\tif err == nil {\n\t\treturn res.Company.ToProto(), nil\n\t}\n\treturn nil, err\n}", "func (t FindCoordinatorResponse) Encode(e *Encoder, version int16) {\n\tif version >= 1 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\tif version >= 1 {\n\t\te.PutString(t.ErrorMessage) // ErrorMessage\n\t}\n\te.PutInt32(t.NodeId) // NodeId\n\te.PutString(t.Host) // Host\n\te.PutInt32(t.Port) // Port\n}", "func EncodeAdminSearchResponse(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\t\tbody := NewAdminSearchResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (t SyncGroupResponse) Encode(e *Encoder, version int16) {\n\tif version >= 1 {\n\t\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t}\n\te.PutInt16(t.ErrorCode) // ErrorCode\n\te.PutBytes(t.Assignment) // Assignment\n}", "func (*NewsPhotoCreateResponse) Descriptor() ([]byte, []int) {\n\treturn file_contents_v1_news_photo_proto_rawDescGZIP(), []int{9}\n}", "func (o ImageResponsePtrOutput) RawBytes() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ImageResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.RawBytes\n\t}).(pulumi.StringPtrOutput)\n}", "func EncodeLoginResponse(_ context.Context, r interface{}) (interface{}, error) {\n\tresp := r.(LoginResponse)\n\treturn &pb.LoginResponse{\n\t\tJwt: resp.Jwt,\n\t}, nil\n}", "func EncodeConfigureResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tresp := response.(endpoints.ConfigureResponse)\n\n\t// mounts\n\tvar mounts map[string]*pb.MountOutput\n\tif (resp.Mounts != nil) && (len(resp.Mounts) > 0) {\n\t\tmounts = make(map[string]*pb.MountOutput)\n\t\tfor k, v := range resp.Mounts {\n\t\t\tmountCfgOut := &pb.MountConfigOutput{\n\t\t\t\tDefaultLeaseTtl: uint32(v.Config.DefaultLeaseTTL),\n\t\t\t\tMaxLeaseTtl: uint32(v.Config.MaxLeaseTTL),\n\t\t\t}\n\n\t\t\tmountOut := &pb.MountOutput{\n\t\t\t\tType: v.Type,\n\t\t\t\tDescription: v.Description,\n\t\t\t\tConfig: mountCfgOut,\n\t\t\t}\n\n\t\t\tmounts[k] = mountOut\n\t\t}\n\t}\n\n\t// auths\n\tvar auths map[string]*pb.AuthMountOutput\n\tif (resp.Auths != nil) && (len(resp.Auths) > 0) {\n\t\tauths = make(map[string]*pb.AuthMountOutput)\n\t\tfor k, v := range resp.Auths {\n\t\t\tauthCfgOut := &pb.AuthConfigOutput{\n\t\t\t\tDefaultLeaseTtl: uint32(v.Config.DefaultLeaseTTL),\n\t\t\t\tMaxLeaseTtl: uint32(v.Config.MaxLeaseTTL),\n\t\t\t}\n\n\t\t\tauthMountOut := &pb.AuthMountOutput{\n\t\t\t\tType: v.Type,\n\t\t\t\tDescription: v.Description,\n\t\t\t\tConfig: authCfgOut,\n\t\t\t}\n\n\t\t\tauths[k] = authMountOut\n\t\t}\n\t}\n\n\t// policies\n\tvar policies []string\n\tif (resp.Policies != nil) && (len(resp.Policies) > 0) {\n\t\tpolicies = resp.Policies\n\t}\n\n\tstatus := &pb.ConfigStatus{\n\t\tConfigId: resp.ConfigID,\n\t\tMounts: mounts,\n\t\tAuths: auths,\n\t\tPolicies: policies,\n\t}\n\treturn &pb.ConfigureResponse{\n\t\tConfigStatus: status,\n\t\tErr: service.Error2String(resp.Err),\n\t}, nil\n}", "func encodeUpdateCompanyResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tres := response.(endpoints.UpdateCompanyResponse)\n\terr := getError(res.Err)\n\tif err == nil {\n\t\treturn res.Company.ToProto(), nil\n\t}\n\treturn nil, err\n}", "func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {\n\n\tif e, ok := response.(Errorer); ok {\n\t\t// Not a Go kit transport error, but a business-logic error.\n\t\t// Provide those as HTTP errors.\n\t\tEncodeError(ctx, e.Error, w)\n\t\treturn nil\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tw.WriteHeader(http.StatusOK)\n\treturn json.NewEncoder(w).Encode(response)\n}", "func EncodeDoublySecureResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error {\n\treturn func(ctx context.Context, w http.ResponseWriter, v any) error {\n\t\tres, _ := v.(string)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeGetLicenseResponse(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.(int)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeGrpcRespWorkloadSpec(ctx context.Context, response interface{}) (interface{}, error) {\n\treturn response, nil\n}" ]
[ "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.50701666", "0.50677156", "0.5065102", "0.5044927", "0.5044118", "0.5035849", "0.5035523", "0.50295734", "0.5017998", "0.50081414", "0.49995038", "0.49986443", "0.49968293", "0.49968177", "0.49916583", "0.49902126", "0.4986811", "0.49797156", "0.49776006", "0.4972276", "0.4971669", "0.4971669", "0.49601033", "0.49586254", "0.49491957", "0.49442413", "0.49440247", "0.49290955", "0.49232855", "0.4910123", "0.49081686", "0.4901513", "0.48994172", "0.4899153", "0.48841047", "0.4878501", "0.48745745", "0.48655307", "0.48465964", "0.4843662", "0.48287255", "0.48287255", "0.482757", "0.48254627", "0.48145854", "0.4805038", "0.47781637", "0.47751084", "0.47678697", "0.47678697", "0.4765269", "0.47630313", "0.474968", "0.47427183", "0.47427183", "0.47404787", "0.47383788", "0.47377363", "0.47361565", "0.4723426", "0.4712958", "0.47088072", "0.47085696", "0.47085696", "0.468234", "0.46792445", "0.4674218", "0.46607304", "0.4656188", "0.46545142", "0.46511614", "0.46466148", "0.4636754", "0.46313894", "0.4627143", "0.46180204", "0.46145573", "0.46039647", "0.4589093", "0.4586927" ]
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\terr error\n\n\t\t\tparams = mux.Vars(r)\n\t\t)\n\t\t{\n\t\t\tstationIDRaw := params[\"stationId\"]\n\t\t\tv, err2 := strconv.ParseInt(stationIDRaw, 10, 32)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"stationID\", stationIDRaw, \"integer\"))\n\t\t\t}\n\t\t\tstationID = int32(v)\n\t\t}\n\t\t{\n\t\t\tsizeRaw := r.URL.Query().Get(\"size\")\n\t\t\tif sizeRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(sizeRaw, 10, 32)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"size\", sizeRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tpv := int32(v)\n\t\t\t\tsize = &pv\n\t\t\t}\n\t\t}\n\t\tifNoneMatchRaw := r.Header.Get(\"If-None-Match\")\n\t\tif ifNoneMatchRaw != \"\" {\n\t\t\tifNoneMatch = &ifNoneMatchRaw\n\t\t}\n\t\tauth = r.Header.Get(\"Authorization\")\n\t\tif auth == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewDownloadPhotoPayload(stationID, size, ifNoneMatch, auth)\n\t\tif strings.Contains(payload.Auth, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Auth, \" \", 2)[1]\n\t\t\tpayload.Auth = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func DecodeRequest[I any](ctx context.Context, r *http.Request) (in I, err error) {\n\tswitch r.Method {\n\tcase \"POST\", \"PUT\", \"PATCH\":\n\t\terr = magic.Decode(r, &in,\n\t\t\tmagic.JSON,\n\t\t\tmagic.ChiRouter,\n\t\t)\n\tcase \"GET\", \"DELETE\":\n\t\terr = magic.Decode(r, &in,\n\t\t\tmagic.QueryParams,\n\t\t\tmagic.ChiRouter,\n\t\t)\n\tdefault:\n\t\terr = errors.Errorf(\"method %s not supported\", r.Method)\n\t}\n\n\tif err == io.EOF {\n\t\terr = errors.New(\"empty body\")\n\t}\n\n\treturn in, errors.E(err, \"can not unmarshal request\", errors.Unmarshal)\n}", "func DecodeStationMetaRequest(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\tstations *string\n\t\t)\n\t\tstationsRaw := r.URL.Query().Get(\"stations\")\n\t\tif stationsRaw != \"\" {\n\t\t\tstations = &stationsRaw\n\t\t}\n\t\tpayload := NewStationMetaPayload(stations)\n\n\t\treturn payload, nil\n\t}\n}", "func decodeRequest(_ context.Context, r *http.Request) (request interface{}, err error) {\n\tdefer r.Body.Close()\n\treturn nil, nil\n}", "func (mh *MessageHandler) decodeRequest(httpRequest *http.Request) (deviceRequest *Request, err error) {\n\tdeviceRequest, err = DecodeRequest(httpRequest.Body, mh.Decoders)\n\tif err == nil {\n\t\tdeviceRequest = deviceRequest.WithContext(httpRequest.Context())\n\t}\n\n\treturn\n}", "func decodeCalculatorRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\n\ta, ok := vars[\"a\"]\n\tif !ok {\n\t\treturn nil, ErrBadRouting\n\t}\n\n\tb, ok := vars[\"b\"]\n\tif !ok {\n\t\treturn nil, ErrBadRouting\n\t}\n\n\taint, _ := strconv.Atoi(a)\n\tbint, _ := strconv.Atoi(b)\n\treturn CalculatorRequest{\n\t\tA: aint,\n\t\tB: bint,\n\t}, nil\n}", "func DecodeRequest(ctx context.Context, req *http.Request, pathParams map[string]string, queryParams map[string]string) (interface{}, error) {\n\treturn DecodeRequestWithHeaders(ctx, req, pathParams, queryParams, nil)\n}", "func decodeUserInfoByPhoneRequest(_ context.Context, r interface{}) (interface{}, error) {\n\treq := r.(*pb.UserInfoByPhoneRequest)\n\treturn endpoint.UserInfoByPhoneRequest{\n\t\tPhone:req.Phone,\n\t},nil\n}", "func DecodeRecentlyRequest(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\tstations *string\n\t\t\tauth *string\n\t\t)\n\t\tstationsRaw := r.URL.Query().Get(\"stations\")\n\t\tif stationsRaw != \"\" {\n\t\t\tstations = &stationsRaw\n\t\t}\n\t\tauthRaw := r.Header.Get(\"Authorization\")\n\t\tif authRaw != \"\" {\n\t\t\tauth = &authRaw\n\t\t}\n\t\tpayload := NewRecentlyPayload(stations, auth)\n\t\tif payload.Auth != nil {\n\t\t\tif strings.Contains(*payload.Auth, \" \") {\n\t\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\t\tcred := strings.SplitN(*payload.Auth, \" \", 2)[1]\n\t\t\t\tpayload.Auth = &cred\n\t\t\t}\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func decodeVerifyRequest(_ context.Context, r interface{}) (interface{}, error) {\n\trq := r.(*pb.VerifyRequest)\n\n\treturn endpoint.VerifyRequest{\n\t\tToken: rq.Token,\n\t\tType: rq.Type,\n\t\tCode: rq.Code,\n\t}, nil\n}", "func decodeGetByCreteriaRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\n\tvars := mux.Vars(r)\n\tname, ok := vars[\"name\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"not a valid creteria\")\n\t}\n\treq := endpoint.GetByCreteriaRequest{\n\t\tCreteria: name,\n\t}\n\treturn req, nil\n}", "func DecodePickCellRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tparams := mux.Vars(r)\n\tgameId, ok := params[\"gameId\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"Bad routing, game id not provided\")\n\t}\n\tvar request model.PickCellRequest\n\tif err := json.NewDecoder(r.Body).Decode(&request); err != nil {\n\t\treturn nil, err\n\t}\n\trequest.GameId = gameId\n\treturn request, nil\n}", "func DecodeTailRequest(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\tstations *string\n\t\t\tbackend *string\n\t\t\tauth *string\n\t\t)\n\t\tstationsRaw := r.URL.Query().Get(\"stations\")\n\t\tif stationsRaw != \"\" {\n\t\t\tstations = &stationsRaw\n\t\t}\n\t\tbackendRaw := r.URL.Query().Get(\"backend\")\n\t\tif backendRaw != \"\" {\n\t\t\tbackend = &backendRaw\n\t\t}\n\t\tauthRaw := r.Header.Get(\"Authorization\")\n\t\tif authRaw != \"\" {\n\t\t\tauth = &authRaw\n\t\t}\n\t\tpayload := NewTailPayload(stations, backend, auth)\n\t\tif payload.Auth != nil {\n\t\t\tif strings.Contains(*payload.Auth, \" \") {\n\t\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\t\tcred := strings.SplitN(*payload.Auth, \" \", 2)[1]\n\t\t\t\tpayload.Auth = &cred\n\t\t\t}\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func NewPhotoHandler(\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.Handler {\n\tvar (\n\t\tdecodeRequest = DecodePhotoRequest(mux, decoder)\n\t\tencodeResponse = EncodePhotoResponse(encoder)\n\t\tencodeError = EncodePhotoError(encoder, formatter)\n\t)\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get(\"Accept\"))\n\t\tctx = context.WithValue(ctx, goa.MethodKey, \"photo\")\n\t\tctx = context.WithValue(ctx, goa.ServiceKey, \"station\")\n\t\tpayload, err := decodeRequest(r)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tres, err := endpoint(ctx, payload)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\to := res.(*station.PhotoResponseData)\n\t\tdefer o.Body.Close()\n\t\tif err := encodeResponse(ctx, w, o.Result); err != nil {\n\t\t\terrhandler(ctx, w, err)\n\t\t\treturn\n\t\t}\n\t\tif _, err := io.Copy(w, o.Body); err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t}\n\t})\n}", "func decodeGetUserRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.GetUserRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func decodeUploadRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.UploadRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func DecodeSigninRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error) {\n\treturn func(r *http.Request) (any, error) {\n\t\tpayload := NewSigninPayload()\n\t\tuser, pass, ok := r.BasicAuth()\n\t\tif !ok {\n\t\t\treturn nil, goa.MissingFieldError(\"Authorization\", \"header\")\n\t\t}\n\t\tpayload.Username = user\n\t\tpayload.Password = pass\n\n\t\treturn payload, nil\n\t}\n}", "func decodeGetByMultiCriteriaRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.GetByMultiCriteriaRequest{\n\t\tUrlMap: r.URL.String(),\n\t}\n\treturn req, nil\n}", "func decodeGetDealByStateRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\tvals := r.URL.Query()\n\tstate := \"\"\n\tstates, okk := vals[\"state\"]\n\tif okk {\n\t\tstate = states[0]\n\t}\n\treq := endpoint.GetDealByStateRequest{\n\t\tState: state,\n\t}\n\treturn req, nil\n}", "func (r *KubeCover) decodeInput(req *http.Request, data interface{}) (string, error) {\n\t// step: read in the content payload\n\tcontent, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\tglog.Errorf(\"unable to read in the content, error: %s\", err)\n\t\treturn \"\", err\n\t}\n\tdefer func() {\n\t\t// we need to set the content back\n\t\treq.Body = ioutil.NopCloser(bytes.NewReader(content))\n\t}()\n\n\trdr := strings.NewReader(string(content))\n\n\t// step: decode the json\n\terr = json.NewDecoder(rdr).Decode(data)\n\tif err != nil {\n\t\tglog.Errorf(\"unable to decode the request body, error: %s\", err)\n\t\treturn \"\", err\n\t}\n\n\treturn string(content), nil\n}", "func Decode(r io.Reader) (image.Image, error)", "func Decode(r io.Reader) (image.Image, error)", "func Decode(r io.Reader) (image.Image, error) {}", "func decodepicture(json map[string]interface{}, p *Photo){\n\tphotos := json[\"photos\"].(map[string]interface{})\n\tmaxpages := int(photos[\"pages\"].(float64))\n\tif (photos[\"total\"] == \"0\"){\n\t\tfmt.Println(\"No photos found\")\n\t\treturn\n\t}\n\tphoto := photos[\"photo\"].([]interface{})[0].(map[string]interface{})\n\tfarmid := photo[\"farm\"]\n\tserverid := photo[\"server\"]\n\tphotoid := photo[\"id\"]\n\tphotosecret := photo[\"secret\"]\n\tuserid := photo[\"owner\"]\n\tlat, _ := strconv.ParseFloat(photo[\"latitude\"].(string), 64)\n\tlng, _ := strconv.ParseFloat(photo[\"longitude\"].(string), 64)\n\n\tphotourl := fmt.Sprintf(\"https://farm%.0f.staticflickr.com/%s/%s_%s_n.jpg\", farmid, serverid, photoid, photosecret)\n\n\tphotolink := fmt.Sprintf(\"https://www.flickr.com/photos/%s/%s\", userid, photoid)\n\t*p = Photo{Url: photourl, Link: photolink, Lat: lat, Lng: lng, Maxpages: maxpages}\n\n}", "func decodePostAcceptDealRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.PostAcceptDealRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func (r *Route) DecodeRequest(req interface{}) *Route {\n\tr.request = reflect.TypeOf(req)\n\tif r.request.Kind() != reflect.Ptr {\n\t\tpanic(\"request structure must be a pointer\")\n\t}\n\treturn r\n}", "func BasicDecodeRequest(ctx context.Context, req *http.Request) (interface{}, error) {\n\treturn DecodeRequestWithHeaders(ctx, req, map[string]string{}, map[string]string{}, nil)\n}", "func DecodeDataRequest(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\tstart *int64\n\t\t\tend *int64\n\t\t\tstations *string\n\t\t\tsensors *string\n\t\t\tresolution *int32\n\t\t\taggregate *string\n\t\t\tcomplete *bool\n\t\t\ttail *int32\n\t\t\tbackend *string\n\t\t\tauth *string\n\t\t\terr error\n\t\t)\n\t\t{\n\t\t\tstartRaw := r.URL.Query().Get(\"start\")\n\t\t\tif startRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(startRaw, 10, 64)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"start\", startRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tstart = &v\n\t\t\t}\n\t\t}\n\t\t{\n\t\t\tendRaw := r.URL.Query().Get(\"end\")\n\t\t\tif endRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(endRaw, 10, 64)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"end\", endRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tend = &v\n\t\t\t}\n\t\t}\n\t\tstationsRaw := r.URL.Query().Get(\"stations\")\n\t\tif stationsRaw != \"\" {\n\t\t\tstations = &stationsRaw\n\t\t}\n\t\tsensorsRaw := r.URL.Query().Get(\"sensors\")\n\t\tif sensorsRaw != \"\" {\n\t\t\tsensors = &sensorsRaw\n\t\t}\n\t\t{\n\t\t\tresolutionRaw := r.URL.Query().Get(\"resolution\")\n\t\t\tif resolutionRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(resolutionRaw, 10, 32)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"resolution\", resolutionRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tpv := int32(v)\n\t\t\t\tresolution = &pv\n\t\t\t}\n\t\t}\n\t\taggregateRaw := r.URL.Query().Get(\"aggregate\")\n\t\tif aggregateRaw != \"\" {\n\t\t\taggregate = &aggregateRaw\n\t\t}\n\t\t{\n\t\t\tcompleteRaw := r.URL.Query().Get(\"complete\")\n\t\t\tif completeRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseBool(completeRaw)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"complete\", completeRaw, \"boolean\"))\n\t\t\t\t}\n\t\t\t\tcomplete = &v\n\t\t\t}\n\t\t}\n\t\t{\n\t\t\ttailRaw := r.URL.Query().Get(\"tail\")\n\t\t\tif tailRaw != \"\" {\n\t\t\t\tv, err2 := strconv.ParseInt(tailRaw, 10, 32)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"tail\", tailRaw, \"integer\"))\n\t\t\t\t}\n\t\t\t\tpv := int32(v)\n\t\t\t\ttail = &pv\n\t\t\t}\n\t\t}\n\t\tbackendRaw := r.URL.Query().Get(\"backend\")\n\t\tif backendRaw != \"\" {\n\t\t\tbackend = &backendRaw\n\t\t}\n\t\tauthRaw := r.Header.Get(\"Authorization\")\n\t\tif authRaw != \"\" {\n\t\t\tauth = &authRaw\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewDataPayload(start, end, stations, sensors, resolution, aggregate, complete, tail, backend, auth)\n\t\tif payload.Auth != nil {\n\t\t\tif strings.Contains(*payload.Auth, \" \") {\n\t\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\t\tcred := strings.SplitN(*payload.Auth, \" \", 2)[1]\n\t\t\t\tpayload.Auth = &cred\n\t\t\t}\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func decodeGetDealByDIDRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\tid, ok := vars[\"dId\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"not a valid dId\")\n\t}\n\treq := endpoint.GetDealByDIDRequest{\n\t\tId: id,\n\t}\n\treturn req, nil\n}", "func Decoder(d DecodeRequestFunc) func(e *Endpoint) {\n\treturn func(e *Endpoint) { e.decode = d }\n}", "func decodeGetTagRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.GetTagRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func DecodeConfigureRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.ConfigureRequest)\n\treturn &endpoints.ConfigureRequest{URL: req.Url, Token: req.Token}, nil\n}", "func (d *Decoder) Decode(dst interface{}, r *http.Request) error {\n\tv := reflect.ValueOf(dst)\n\tif v.Kind() != reflect.Ptr || v.Elem().Kind() != reflect.Struct {\n\t\treturn errors.New(\"interface must be a pointer to struct\")\n\t}\n\tv = v.Elem()\n\tt := v.Type()\n\tvar err error\n\terrors := MultiError{}\n\tlens := map[reflect.Value]map[int]int{}\n\tps := map[string][]pathPart{}\n\tinfo := d.cache.get(t)\n\tvar fs map[string][]*multipart.FileHeader\n\tif r.Method == \"POST\" || r.Method == \"PUT\" || r.Method == \"PATCH\" {\n\t\tif !info.containsPath && !info.containsQuery && !info.containsHeader && !info.containsFile && !info.containsForm && info.containsJSON {\n\t\t\tif err = json.NewDecoder(r.Body).Decode(dst); err != nil {\n\t\t\t\treturn ParsingError{Err: fmt.Errorf(\"cannot unmarshal JSON\"), WrappedErr: err}\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\tif info.containsFile {\n\t\t\tif !isMultipartForm(r) {\n\t\t\t\treturn ContentTypeError{RequestContentType: r.Header.Get(\"Content-Type\"), ContentType: \"multipart/form-data\"}\n\t\t\t}\n\t\t\terr = r.ParseMultipartForm(d.maxMemory)\n\t\t\tif err != nil {\n\t\t\t\treturn ParsingError{Err: fmt.Errorf(\"cannot parse multipart form\"), WrappedErr: err}\n\t\t\t}\n\t\t\tfs = r.MultipartForm.File\n\t\t\td.checkFiles(fs, t, ps, errors)\n\t\t\tif !d.collectErrors && len(errors) > 0 {\n\t\t\t\treturn errors\n\t\t\t}\n\t\t}\n\t}\n\n\tm, err := d.extractMap(info, t, r, ps, errors)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !d.collectErrors && len(errors) > 0 {\n\t\treturn errors\n\t}\n\td.decodeMaps(t, v, m, fs, ps, lens, errors)\n\tif len(errors) > 0 {\n\t\treturn errors\n\t}\n\treturn nil\n}", "func parseRequest(r *http.Request, host, prefix string) (*ImaginaryRequestParameters, error) {\n\tvalues := r.URL.Query()\n\t// method\n\tmethod := values.Get(\"method\")\n\tif method == \"\" {\n\t\treturn nil, methodIsNotDefinedError\n\t}\n\t// sizes\n\twidth, err := strconv.Atoi(values.Get(\"width\"))\n\tif err != nil {\n\t\treturn nil, widthIsNotDefinedError\n\t}\n\theight, err := strconv.Atoi(values.Get(\"height\"))\n\tif err != nil {\n\t\treturn nil, heightIsNotDefinedError\n\t}\n\t// quality\n\tquality, _ := strconv.Atoi(values.Get(\"quality\"))\n\tif quality == 0 {\n\t\tquality = DEFAULT_QUALITY\n\t}\n\t// filePath\n\tfilePath := r.URL.Path\n\tif prefix != \"\" {\n\t\tfilePath = strings.Replace(r.URL.Path, prefix, \"\", 1)\n\t}\n\t// type\n\tfileType := values.Get(\"type\")\n\tif fileType == \"\" {\n\t\tfileType = config.DefaultType\n\t}\n\n\treturn &ImaginaryRequestParameters{\n\t\tHost: host,\n\t\tFile: filePath,\n\t\tMethod: method,\n\t\tWidth: width,\n\t\tHeight: height,\n\t\tQuality: quality,\n\t\tType: fileType,\n\t}, nil\n}", "func decodeLoginPRequest(_ context.Context, r interface{}) (interface{}, error) {\n\trq := r.(*pb.LoginPRequest)\n\n\treturn endpoint.LoginPRequest{\n\t\tPhone: rq.Phone,\n\t}, nil\n}", "func decodeGetEventsRequest(_ context.Context, r interface{}) (interface{}, error) {\r\n\treturn nil, errors.New(\"'Events' Decoder is not impelemented\")\r\n}", "func decodeHotPlayMoviesrRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tfmt.Printf(\"read body err, %v\\n\", err)\n\t\treturn nil, err\n\t}\n\tprintln(\"json-request:\", string(body))\n\n\tvar rhe endpoint.MoviesListRequest // 请求参数解析后放在结构体中\n\tif err = json.Unmarshal(body, &rhe); err != nil {\n\t\tfmt.Printf(\"Unmarshal err, %v\\n\", err)\n\t\treturn nil, err\n\t}\n\tfmt.Println(\"request\", rhe)\n\n\treturn &rhe, nil\n}", "func decodeUserInfoByIdRequest(_ context.Context, r interface{}) (interface{}, error) {\n\treq := r.(*pb.UserInfoByIdRequest)\n\treturn endpoint.UserInfoByIdRequest{\n\t\tId:req.Id,\n\t},nil\n}", "func DecodeRemoveRequest(_ context.Context, r *http.Request) (req interface{}, err error) {\n\treq = endpoints.RemoveRequest{Id: mux.Vars(r)[\"id\"]}\n\t//err = json.NewDecoder(r.Body).Decode(&r)\n\treturn req, err\n}", "func DecodeStartRequest(_ context.Context, r *http.Request) (req interface{}, err error) {\n\treq = endpoints.StartRequest{Id: mux.Vars(r)[\"id\"]}\n\t//err = json.NewDecoder(r.Body).Decode(&r)\n\treturn req, err\n}", "func Decode(r *http.Request, v interface{}) error {\n\tbuf, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\trdr := ioutil.NopCloser(bytes.NewBuffer(buf))\n\tr.Body = ioutil.NopCloser(bytes.NewBuffer(buf))\n\n\tif err := json.NewDecoder(rdr).Decode(v); err != nil {\n\t\tfmt.Println(\"json\", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (ig *Instagram) getDecode(location string) (*InstagramResponse, error) {\n\tvar data InstagramResponse\n\n\t//Store location in the struct so we can access our current URL if we feel like it\n\tdata.Meta.URL = location\n\n\tresp, err := http.Get(location)\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn &data, err\n\t}\n\n\tif err := json.Unmarshal(body, &data); err != nil {\n\t\treturn &data, err\n\t}\n\n\treturn &data, nil\n}", "func DecodeShowRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error) {\n\treturn func(r *http.Request) (any, error) {\n\t\tvar (\n\t\t\tid string\n\t\t\terr error\n\n\t\t\tparams = mux.Vars(r)\n\t\t)\n\t\tid = params[\"id\"]\n\t\terr = goa.MergeErrors(err, goa.ValidateFormat(\"id\", id, goa.FormatUUID))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewShowPayload(id)\n\n\t\treturn payload, nil\n\t}\n}", "func (b *PhotoSizeBox) Decode(buf *bin.Buffer) error {\n\tif b == nil {\n\t\treturn fmt.Errorf(\"unable to decode PhotoSizeBox to nil\")\n\t}\n\tv, err := DecodePhotoSize(buf)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to decode boxed value: %w\", err)\n\t}\n\tb.PhotoSize = v\n\treturn nil\n}", "func (*DecodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_videoservice_proto_rawDescGZIP(), []int{0}\n}", "func DecodeUserDetailsRequest(_ context.Context, r interface{}) (interface{}, error) {\n\treq := r.(*pb.UserDetailsRequest)\n\treturn &UserDetailsRequest{\n\t\tJwt: req.Jwt,\n\t}, nil\n}", "func decodeGetUserDealByStateRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\tvars := mux.Vars(r)\n\tvals := r.URL.Query()\n\tstate := \"\"\n\tid, ok := vars[\"userId\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"not a valid userId\")\n\t}\n\tstates, okk := vals[\"state\"]\n\tif okk {\n\t\tstate = states[0]\n\t}\n\treq := endpoint.GetUserDealByStateRequest{\n\t\tId: id,\n\t\tState: state,\n\t}\n\treturn req, nil\n}", "func DecodeGetRequest(_ context.Context, r *http.Request) (req interface{}, err error) {\n\treq = endpoints.GetRequest{Id: mux.Vars(r)[\"id\"]}\n\t//err = json.NewDecoder(r.Body).Decode(&r)\n\treturn req, err\n}", "func decodeUpdateTagRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.UpdateTagRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func DecodeLoginRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error) {\n\treturn func(r *http.Request) (any, error) {\n\t\tpayload := NewLoginPayload()\n\t\tuser, pass, ok := r.BasicAuth()\n\t\tif !ok {\n\t\t\treturn nil, goa.MissingFieldError(\"Authorization\", \"header\")\n\t\t}\n\t\tpayload.User = user\n\t\tpayload.Password = pass\n\n\t\treturn payload, nil\n\t}\n}", "func decodeGetPostRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.GetPostRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func BuildDownloadPhotoPayload(stationDownloadPhotoStationID string, stationDownloadPhotoSize string, stationDownloadPhotoIfNoneMatch string, stationDownloadPhotoAuth string) (*station.DownloadPhotoPayload, error) {\n\tvar err error\n\tvar stationID int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(stationDownloadPhotoStationID, 10, 32)\n\t\tstationID = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for stationID, must be INT32\")\n\t\t}\n\t}\n\tvar size *int32\n\t{\n\t\tif stationDownloadPhotoSize != \"\" {\n\t\t\tvar v int64\n\t\t\tv, err = strconv.ParseInt(stationDownloadPhotoSize, 10, 32)\n\t\t\tval := int32(v)\n\t\t\tsize = &val\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid value for size, must be INT32\")\n\t\t\t}\n\t\t}\n\t}\n\tvar ifNoneMatch *string\n\t{\n\t\tif stationDownloadPhotoIfNoneMatch != \"\" {\n\t\t\tifNoneMatch = &stationDownloadPhotoIfNoneMatch\n\t\t}\n\t}\n\tvar auth *string\n\t{\n\t\tif stationDownloadPhotoAuth != \"\" {\n\t\t\tauth = &stationDownloadPhotoAuth\n\t\t}\n\t}\n\tv := &station.DownloadPhotoPayload{}\n\tv.StationID = stationID\n\tv.Size = size\n\tv.IfNoneMatch = ifNoneMatch\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func decodeCreateTagRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\treq := endpoint.CreateTagRequest{}\n\terr := json.NewDecoder(r.Body).Decode(&req)\n\treturn req, err\n}", "func Decode(r *http.Request, v interface{}) error {\n\tbodyBytes, err := io.ReadAll(io.LimitReader(r.Body, 1024*1024))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Decode: read body: %w\", err)\n\t}\n\terr = json.Unmarshal(bodyBytes, v)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Decode: json.Unmarshal: %w\", err)\n\t}\n\treturn nil\n}", "func DecodeListenerRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (any, error) {\n\treturn func(r *http.Request) (any, error) {\n\t\tvar (\n\t\t\ttoken string\n\t\t\terr error\n\t\t)\n\t\ttoken = r.Header.Get(\"Authorization\")\n\t\tif token == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"token\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewListenerPayload(token)\n\t\tif strings.Contains(payload.Token, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Token, \" \", 2)[1]\n\t\t\tpayload.Token = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func (t *FindCoordinatorRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.Key, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif version >= 1 {\n\t\tt.KeyType, err = d.Int8()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "func DecodeUnsealRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.UnsealRequest)\n\treturn &endpoints.UnsealRequest{Key: req.Key, Reset: req.Reset_}, nil\n}", "func DecodeSplashFetcherRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\tvar request splash.Request\n\tif err := json.NewDecoder(r.Body).Decode(&request); err != nil {\n\t\treturn nil, &errs.BadRequest{err}\n\t}\n\treturn request, nil\n}", "func (msg *abstractIdentifyRequest) MaybeDecode(buf *goetty.ByteBuf) bool {\n\tvalue, ok := MaybeReadString(buf)\n\tif !ok {\n\t\treturn false\n\t}\n\tmsg.Version = value\n\n\tvalue, ok = MaybeReadString(buf)\n\tif !ok {\n\t\treturn false\n\t}\n\tmsg.ApplicationID = value\n\n\tvalue, ok = MaybeReadString(buf)\n\tif !ok {\n\t\treturn false\n\t}\n\tmsg.TransactionServiceGroup = value\n\n\tvalue, ok = MaybeReadString(buf)\n\tif !ok {\n\t\treturn false\n\t}\n\tmsg.ExtraData = value\n\treturn true\n}", "func DecodeRefreshRequest(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\ttoken string\n\t\t\terr error\n\t\t)\n\t\ttoken = r.Header.Get(\"Authorization\")\n\t\tif token == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewRefreshPayload(token)\n\t\tif strings.Contains(payload.Token, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Token, \" \", 2)[1]\n\t\t\tpayload.Token = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func DecodeBaseFetcherRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\tvar request BaseFetcherRequest\n\tif err := json.NewDecoder(r.Body).Decode(&request); err != nil {\n\t\treturn nil, &errs.BadRequest{err}\n\t}\n\treturn request, nil\n}", "func DecodeGRPCBlockConnectionRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.BlockConnectionRequest)\n\tsrcIP, err := abstraction.NewInet(req.SrcIP)\n\tif err != nil {\n\t\treturn BlockConnectionRequest{}, err\n\t}\n\tdstIP, err := abstraction.NewInet(req.DstIP)\n\tif err != nil {\n\t\treturn BlockConnectionRequest{}, err\n\t}\n\treturn BlockConnectionRequest{\n\t\tSrcIP: srcIP,\n\t\tDstIP: dstIP,\n\t\tSrcNetwork: req.SrcNetwork,\n\t\tDstNetwork: req.DstNetwork,\n\t}, nil\n}", "func DecodeInitRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.InitRequest)\n\topts := service.InitOptions{\n\t\tSecretShares: int(req.SecretShares),\n\t\tSecretThreshold: int(req.SecretThreshold),\n\t\tStoredShares: int(req.StoredShares),\n\t\tPGPKeys: req.PgpKeys,\n\t\tRecoveryShares: int(req.RecoveryShares),\n\t\tRecoveryThreshold: int(req.RecoveryThreshold),\n\t\tRecoveryPGPKeys: req.RecoveryPgpKeys,\n\t\tRootTokenPGPKey: req.RootTokenPgpKey,\n\t\tRootTokenHolderEmail: req.RootTokenHolderEmail,\n\t\tSecretKeyHolderEmails: req.SecretKeyHolderEmails,\n\t}\n\treturn &endpoints.InitRequest{Opts: opts}, nil\n}", "func (r *Request) Decode(v interface{}) error {\n\treturn r.decode(r.Raw, v)\n}", "func DecodeLoginRequest(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\tbody LoginRequestBody\n\t\t\terr error\n\t\t)\n\t\terr = decoder(r).Decode(&body)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\treturn nil, goa.MissingPayloadError()\n\t\t\t}\n\t\t\treturn nil, goa.DecodePayloadError(err.Error())\n\t\t}\n\t\terr = ValidateLoginRequestBody(&body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewLoginPayload(&body)\n\n\t\treturn payload, nil\n\t}\n}", "func NewGetaspecificPbxDeviceModelImageRequest(server string, id string) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/pbxdevicemodelimages/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"GET\", queryUrl.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func DecodeGenerateKeyRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\tvar req GenerateKeyRequest\n\tvar err error\n\tif err = json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, err\n}", "func (*NewsPhotoUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_contents_v1_news_photo_proto_rawDescGZIP(), []int{10}\n}", "func (t *DescribeDelegationTokenRequest) Decode(d *Decoder, version int16) error {\n\tvar err error\n\t// Owners\n\tif n, err := d.ArrayLength(); err != nil {\n\t\treturn err\n\t} else if n >= 0 {\n\t\tt.Owners = make([]DescribeDelegationTokenOwner41, n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar item DescribeDelegationTokenOwner41\n\t\t\tif err := (&item).Decode(d, version); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.Owners[i] = item\n\t\t}\n\t}\n\treturn err\n}", "func decodeBody(req *http.Request, out interface{}, cb func(interface{}) error) error {\n\t// This generally only happens in tests since real HTTP requests set\n\t// a non-nil body with no content. We guard against it anyways to prevent\n\t// a panic. The EOF response is the same behavior as an empty reader.\n\tif req.Body == nil {\n\t\treturn io.EOF\n\t}\n\n\tvar raw interface{}\n\tdec := json.NewDecoder(req.Body)\n\tif err := dec.Decode(&raw); err != nil {\n\t\treturn err\n\t}\n\n\t// Invoke the callback prior to decode\n\tif cb != nil {\n\t\tif err := cb(raw); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tdecodeConf := &mapstructure.DecoderConfig{\n\t\tDecodeHook: mapstructure.ComposeDecodeHookFunc(\n\t\t\tmapstructure.StringToTimeDurationHookFunc(),\n\t\t\tstringToReadableDurationFunc(),\n\t\t),\n\t\tResult: &out,\n\t}\n\n\tdecoder, err := mapstructure.NewDecoder(decodeConf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn decoder.Decode(raw)\n}", "func ParseGetaspecificPbxDeviceModelImageResponse(rsp *http.Response) (*GetaspecificPbxDeviceModelImageResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer rsp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &GetaspecificPbxDeviceModelImageResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest string\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\t}\n\n\treturn response, nil\n}", "func BuildPhotoPayload(stationPhotoID string, stationPhotoAuth string) (*station.PhotoPayload, error) {\n\tvar err error\n\tvar id int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(stationPhotoID, 10, 32)\n\t\tid = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for id, must be INT32\")\n\t\t}\n\t}\n\tvar auth string\n\t{\n\t\tauth = stationPhotoAuth\n\t}\n\tv := &station.PhotoPayload{}\n\tv.ID = id\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func decodeCreateBookRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\t// Get bearer from headers\n\tbearer := parseBearer(r)\n\n\t///////////////////\n\t// Parse body\n\tvar createBookRequest createBookRequest\n\tif err := json.NewDecoder(r.Body).Decode(&createBookRequest); err != nil {\n\t\tfmt.Println(\"Error decoding book request: \", err)\n\t\treturn nil, err\n\t}\n\n\tcreateBookRequest.Bearer = bearer\n\n\treturn createBookRequest, nil\n}", "func (*GetPhotoRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_streetview_publish_v1_rpcmessages_proto_rawDescGZIP(), []int{1}\n}", "func DecodeGrpcReqDSCProfileSpec(ctx context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*DSCProfileSpec)\n\treturn req, nil\n}", "func (c *Client) GetPhoto(device string) ([]byte, error) {\n\treq := fmt.Sprintf(\"%s/img/%s\", c.serviceURL, device)\n\tlogger.Printf(\"photo request %s\", req)\n\tres, err := http.Get(req)\n\tif err != nil {\n\t\tlogger.Printf(\"photo request to %s, %s\", device, err)\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\tif res.StatusCode != http.StatusOK {\n\t\tvar resStr string\n\t\tif buf, readErr := ioutil.ReadAll(res.Body); readErr == nil {\n\t\t\tresStr = string(buf)\n\t\t}\n\t\tlogger.Printf(\"response to request %s: %s, %s\", device, res.Status, resStr)\n\t\treturn nil, fmt.Errorf(\"photo response (status %d) %s\", res.StatusCode, resStr)\n\t}\n\n\tdata, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tlogger.Printf(\"reading bytes from %s photo response, %s\", device, err)\n\t\treturn nil, err\n\t}\n\treturn data, nil\n}", "func (req *FailoverLogRequest) Decode(data []byte) (err error) {\n\treturn proto.Unmarshal(data, req)\n}", "func decode(r *http.Request, v ok) error {\n\tif r.Body == nil {\n\t\treturn errors.New(\"Invalid Body\")\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(v); err != nil {\n\t\treturn err\n\t}\n\treturn v.OK()\n}", "func decodeGetRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.GetRequest{}\n\treturn req, nil\n}", "func decodeGetRequest(_ context.Context, r *http1.Request) (interface{}, error) {\n\treq := endpoint.GetRequest{}\n\treturn req, nil\n}", "func decodeGetAllBooksRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\trealOffset, realLimit := parseOffsetAndLimit(r)\n\n\t///////////////////\n\t// Parse parameters\n\tr.ParseForm()\n\tvalues := r.Form\n\n\t// get Title\n\ttitle := values.Get(\"title\")\n\n\t// get author name\n\tauthorName := values.Get(\"author_name\")\n\n\t// get AuthorId list\n\ttempAuthorIds := values[\"author_id\"]\n\ttemp := strings.Join(tempAuthorIds, \",\")\n\tauthorIds := splitCsvStringAsInts(temp)\n\n\t// Get BookId list\n\ttempIds := values[\"book_id\"]\n\ttemp = strings.Join(tempIds, \",\")\n\tbookIds := splitCsvStringAsInts(temp)\n\n\t// Get bearer from headers\n\tbearer := parseBearer(r)\n\n\t// Make request for all books\n\tvar request getAllBooksRequest\n\trequest = getAllBooksRequest{\n\t\tBearer: bearer,\n\t\tOffset: realOffset,\n\t\tLimit: realLimit,\n\t\tTitle: title,\n\t\tAuthorId: authorIds,\n\t\tBookId: bookIds,\n\t\tAuthorName: authorName,\n\t}\n\n\treturn request, nil\n}", "func (tbr *TransportBaseReqquesst) DecodePOSTRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\tbodyBytes, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn nil, errors.New(\"read body data error\")\n\t}\n\trouterPath := ctx.Value(auth.HttpPATH)\n\trequestMethodName := fmt.Sprintf(\"Decode%sRequest\", fmt.Sprintf(\"%v\", routerPath))\n\tif callResult := core.CallReflect(tbr, requestMethodName, bodyBytes); callResult != nil {\n\t\treturn callResult[0].Interface(), nil\n\t}\n\treturn nil, errors.New(\"read body data error\")\n}", "func (pp *Pingreq) Decode(src []byte) (int, error) {\n\treturn nakedDecode(src, PINGREQ)\n}", "func DecodeLoadRequest(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\tbody LoadRequestBody\n\t\t\terr error\n\t\t)\n\t\terr = decoder(r).Decode(&body)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\treturn nil, goa.MissingPayloadError()\n\t\t\t}\n\t\t\treturn nil, goa.DecodePayloadError(err.Error())\n\t\t}\n\t\terr = ValidateLoadRequestBody(&body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewLoadPayload(&body)\n\n\t\treturn payload, nil\n\t}\n}", "func decodeGetJobPostByIDRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.GetJobPostByIDRequest)\n\treturn endpoints.GetJobPostByIDRequest{ID: req.Id}, nil\n}", "func DecodeReqBody(reqBody io.ReadCloser, v interface{}) error {\n\tbody, _ := ioutil.ReadAll(reqBody)\n\terr := json.Unmarshal(body, v)\n\tif err != nil {\n\t\tlog.Printf(\"Error unmarshaling request body: %s\", err)\n\t}\n\n\treqBody.Close()\n\treturn err\n}", "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 (c *Client) DownloadPhoto(ctx context.Context, p *DownloadPhotoPayload) (res *DownloadedPhoto, err error) {\n\tvar ires interface{}\n\tires, err = c.DownloadPhotoEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(*DownloadedPhoto), nil\n}", "func decodeUpdateKeyPersonRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.UpdateKeyPersonRequest)\n\treturn endpoints.UpdateKeyPersonRequest{ID: req.Id, KeyPerson: models.KeyPersonToORM(req.KeyPerson)}, nil\n}", "func (msg *abstractIdentifyRequest) Decode(buf *goetty.ByteBuf) {\n\tmsg.Version = ReadString(buf)\n\tmsg.ApplicationID = ReadString(buf)\n\tmsg.TransactionServiceGroup = ReadString(buf)\n\tmsg.ExtraData = ReadString(buf)\n}", "func DecodeDeleteRequest(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\tauth string\n\t\t\terr error\n\n\t\t\tparams = mux.Vars(r)\n\t\t)\n\t\t{\n\t\t\tstationIDRaw := params[\"stationId\"]\n\t\t\tv, err2 := strconv.ParseInt(stationIDRaw, 10, 32)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"stationID\", stationIDRaw, \"integer\"))\n\t\t\t}\n\t\t\tstationID = int32(v)\n\t\t}\n\t\tauth = r.Header.Get(\"Authorization\")\n\t\tif auth == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"Authorization\", \"header\"))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewDeletePayload(stationID, auth)\n\t\tif strings.Contains(payload.Auth, \" \") {\n\t\t\t// Remove authorization scheme prefix (e.g. \"Bearer\")\n\t\t\tcred := strings.SplitN(payload.Auth, \" \", 2)[1]\n\t\t\tpayload.Auth = cred\n\t\t}\n\n\t\treturn payload, nil\n\t}\n}", "func DecodeBasicRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\n\tmethodName := fmt.Sprintf(\"Decode%sRequest\", r.Method)\n\ttbr := &TransportBaseReqquesst{}\n\tif callResult := core.CallReflect(tbr, methodName, ctx, r); callResult != nil {\n\t\tif callResult[1].Interface() != nil {\n\t\t\treturn callResult[0].Interface(), nil\n\t\t}\n\t\treturn callResult[0].Interface(), nil\n\t}\n\treturn nil, ErrorBadRequest\n}", "func (f DecodeFunc) Decode(req types.Request, obj runtime.Object) error {\n\treturn f(req, obj)\n}", "func DecodeLoginRequest(_ context.Context, r interface{}) (interface{}, error) {\n\treq := r.(*pb.LoginRequest)\n\treturn LoginRequest{\n\t\tUsername: req.Username,\n\t\tPassword: req.Password,\n\t}, nil\n}", "func DecodeSearchRequest(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\tquery string\n\t\t\tpage uint\n\t\t\tpageSize uint\n\t\t\terr error\n\t\t)\n\t\tquery = r.URL.Query().Get(\"query\")\n\t\tif query == \"\" {\n\t\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"query\", \"query string\"))\n\t\t}\n\t\t{\n\t\t\tpageRaw := r.URL.Query().Get(\"page\")\n\t\t\tif pageRaw == \"\" {\n\t\t\t\tpage = 1\n\t\t\t} else {\n\t\t\t\tv, err2 := strconv.ParseUint(pageRaw, 10, strconv.IntSize)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"page\", pageRaw, \"unsigned integer\"))\n\t\t\t\t}\n\t\t\t\tpage = uint(v)\n\t\t\t}\n\t\t}\n\t\t{\n\t\t\tpageSizeRaw := r.URL.Query().Get(\"pageSize\")\n\t\t\tif pageSizeRaw == \"\" {\n\t\t\t\tpageSize = 50\n\t\t\t} else {\n\t\t\t\tv, err2 := strconv.ParseUint(pageSizeRaw, 10, strconv.IntSize)\n\t\t\t\tif err2 != nil {\n\t\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"pageSize\", pageSizeRaw, \"unsigned integer\"))\n\t\t\t\t}\n\t\t\t\tpageSize = uint(v)\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewSearchPayload(query, page, pageSize)\n\n\t\treturn payload, nil\n\t}\n}", "func decodeGetAllKeyPersonsRequest(_ context.Context, request interface{}) (interface{}, error) {\n\treq := request.(*pb.GetAllKeyPersonsRequest)\n\tdecoded := endpoints.GetAllKeyPersonsRequest{\n\t\tID: req.Id,\n\t\tCompanyID: req.CompanyId,\n\t\tName: req.Name,\n\t\tContactNumber: req.ContactNumber,\n\t\tEmail: req.Email,\n\t\tJobTitle: req.JobTitle,\n\t}\n\treturn decoded, nil\n}", "func (pkt *SubModRequest) Decode(bytes []byte) (err error) {\n\tvar used int\n\toffset := 4 // header\n\n\tpkt.XID, used, err = XdrGetUint32(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.SubID, used, err = XdrGetInt64(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.Expression, used, err = XdrGetString(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.AcceptInsecure, used, err = XdrGetBool(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.AddKeys, used, err = XdrGetKeys(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\tpkt.DelKeys, used, err = XdrGetKeys(bytes[offset:])\n\tif err != nil {\n\t\treturn err\n\t}\n\toffset += used\n\n\treturn nil\n}", "func (tbr *TransportBaseReqquesst) DecodeGETRequest(ctx context.Context, r *http.Request) (interface{}, error) {\n\t//首字母设为大写\n\trequestMethodName := fmt.Sprintf(\"Decode%sRequest\", fmt.Sprintf(\"%v\", ctx.Value(auth.HttpPATH)))\n\tdata := []byte{}\n\tif callResult := core.CallReflect(tbr, requestMethodName, data); callResult != nil {\n\t\treturn callResult[0].Interface(), nil\n\t}\n\treturn nil, errors.New(\"read body data error\")\n}", "func decodeUpdateBookRequest(_ context.Context, r *http.Request) (interface{}, error) {\n\tbookId, err := parseBookId(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get bearer from headers\n\tbearer := parseBearer(r)\n\n\t///////////////////\n\t// Parse body\n\tvar updateBook updateBookRequest\n\tif err := json.NewDecoder(r.Body).Decode(&updateBook); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Set bookid on update request\n\tupdateBook.BookId = bookId\n\n\tupdateBook.Bearer = bearer\n\n\treturn updateBook, nil\n}", "func (r *Request) Decode(v interface{}, tag string) error {\n\tvar (\n\t\terr error\n\t\tct = r.RequestCtx.Request.Header.ContentType()\n\t)\n\n\t// Validate compulsory fields in JSON body. The struct to be unmarshaled into needs a struct tag with required=true for enforcing presence.\n\tif bytes.Contains(ct, constJSON) {\n\t\terr = json.Unmarshal(r.RequestCtx.PostBody(), &v)\n\t} else if bytes.Contains(ct, constXML) {\n\t\terr = xml.Unmarshal(r.RequestCtx.PostBody(), &v)\n\t} else {\n\t\t_, err = ScanArgs(r.RequestCtx.PostArgs(), v, tag)\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error decoding request: %v\", err)\n\t}\n\treturn nil\n}" ]
[ "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.4802524", "0.4802524", "0.47812504", "0.47704628", "0.4760977", "0.4751809", "0.47472113", "0.47395", "0.47373837", "0.47292337", "0.4722527", "0.4720624", "0.47130132", "0.47095296", "0.4660188", "0.46585372", "0.4626299", "0.4625727", "0.46113095", "0.46047425", "0.458987", "0.45806366", "0.45738274", "0.4571038", "0.4560798", "0.45599774", "0.45480433", "0.45410568", "0.4538897", "0.45324305", "0.45299494", "0.4529186", "0.45266864", "0.45092058", "0.45077655", "0.45059675", "0.45046493", "0.45028", "0.44905493", "0.44896406", "0.4474126", "0.44694656", "0.44543564", "0.44497368", "0.44496778", "0.44417328", "0.4434321", "0.44330207", "0.44272062", "0.44254225", "0.44238216", "0.4423377", "0.44231886", "0.44065404", "0.44041502", "0.44018742", "0.4399005", "0.439851", "0.43976015", "0.43976015", "0.4393697", "0.4393379", "0.4380792", "0.4375804", "0.4375521", "0.43731704", "0.4371939", "0.43716908", "0.43674347", "0.43632796", "0.43624607", "0.43611702", "0.4358281", "0.43574187", "0.43550718", "0.4354425", "0.43532044", "0.43514493", "0.4351147", "0.43454897" ]
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 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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsEssentialStationViewToEssentialStationResponseBody(v *stationviews.EssentialStationView) *EssentialStationResponseBody {\n\tres := &EssentialStationResponseBody{\n\t\tID: *v.ID,\n\t\tDeviceID: *v.DeviceID,\n\t\tName: *v.Name,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tLastIngestionAt: v.LastIngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "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))\n\t\tfor i, val := range v.Precise {\n\t\t\tres.Precise[i] = val\n\t\t}\n\t}\n\tif v.Regions != nil {\n\t\tres.Regions = make([]*StationRegionResponseBody, len(v.Regions))\n\t\tfor i, val := range v.Regions {\n\t\t\tres.Regions[i] = marshalStationviewsStationRegionViewToStationRegionResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Reading != nil {\n\t\tres.Reading = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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 = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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\tfor i, val := range v.Shape {\n\t\t\tres.Shape[i] = make([][]float64, len(val))\n\t\t\tfor j, val := range val {\n\t\t\t\tres.Shape[i][j] = make([]float64, len(val))\n\t\t\t\tfor k, val := range val {\n\t\t\t\t\tres.Shape[i][j][k] = val\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v *stationviews.StationDataSummaryView) *StationDataSummaryResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &StationDataSummaryResponseBody{\n\t\tStart: *v.Start,\n\t\tEnd: *v.End,\n\t\tNumberOfSamples: *v.NumberOfSamples,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tLocationName: v.LocationName,\n\t\tPlaceNameOther: v.PlaceNameOther,\n\t\tPlaceNameNative: v.PlaceNameNative,\n\t\tSyncedAt: v.SyncedAt,\n\t\tIngestionAt: v.IngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\tif v.Data != nil {\n\t\tres.Data = marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v.Data)\n\t}\n\n\treturn res\n}", "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.StationPhotosView) *StationPhotosResponseBody {\n\tres := &StationPhotosResponseBody{\n\t\tSmall: *v.Small,\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdated: *v.Updated,\n\t\tLocationName: v.LocationName,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Images != nil {\n\t\tres.Images = make([]*ImageRefResponseBody, len(v.Images))\n\t\tfor i, val := range v.Images {\n\t\t\tres.Images[i] = marshalStationviewsImageRefViewToImageRefResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsWarehouseViewToWarehouseResponseBody(v *inventoryviews.WarehouseView) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tCode: *v.Code,\n\t\tAddress: *v.Address,\n\t\tType: *v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationJobViewToStationJobResponseBody(v *stationviews.StationJobView) *StationJobResponseBody {\n\tres := &StationJobResponseBody{\n\t\tTitle: *v.Title,\n\t\tStartedAt: *v.StartedAt,\n\t\tCompletedAt: v.CompletedAt,\n\t\tProgress: *v.Progress,\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t\tFullKey: *v.FullKey,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalMatchesviewsRatingViewToRatingResponseBody(v *matchesviews.RatingView) *RatingResponseBody {\n\tres := &RatingResponseBody{\n\t\tStrength: *v.Strength,\n\t\tLower: *v.Lower,\n\t\tUpper: *v.Upper,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsFounderViewToFounderResponseBody(v *inventoryviews.FounderView) *FounderResponseBody {\n\tres := &FounderResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalDiscussionviewsAuthorPhotoViewToAuthorPhotoResponseBody(v *discussionviews.AuthorPhotoView) *AuthorPhotoResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &AuthorPhotoResponseBody{\n\t\tURL: *v.URL,\n\t}\n\n\treturn res\n}", "func marshalStationviewsImageRefViewToImageRefResponseBody(v *stationviews.ImageRefView) *ImageRefResponseBody {\n\tres := &ImageRefResponseBody{\n\t\tURL: *v.URL,\n\t}\n\n\treturn res\n}", "func marshalVironAPIViewToVironAPIResponseBody(v *vironviews.VironAPIView) *VironAPIResponseBody {\n\tres := &VironAPIResponseBody{\n\t\tMethod: *v.Method,\n\t\tPath: *v.Path,\n\t}\n\n\treturn res\n}", "func marshalDiscussionviewsPostAuthorViewToPostAuthorResponseBody(v *discussionviews.PostAuthorView) *PostAuthorResponseBody {\n\tres := &PostAuthorResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\tif v.Photo != nil {\n\t\tres.Photo = marshalDiscussionviewsAuthorPhotoViewToAuthorPhotoResponseBody(v.Photo)\n\t}\n\n\treturn res\n}", "func (o RepositoryAssociationRepositoryGithubEnterpriseServerOutput) Owner() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RepositoryAssociationRepositoryGithubEnterpriseServer) string { return v.Owner }).(pulumi.StringOutput)\n}", "func unmarshalWineryResponseBodyToStorageviewsWineryView(v *WineryResponseBody) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func viewGetOwner(_ wasmlib.ScViewContext, f *GetOwnerContext) {\n\tf.Results.Owner().SetValue(f.State.Owner().Value())\n}", "func (o *CredentialsResponseElement) SetOwner(v string) {\n\to.Owner = v\n}", "func marshalInventoryWarehouseToWarehouseResponseBody(v *inventory.Warehouse) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t\tCode: v.Code,\n\t\tAddress: v.Address,\n\t\tType: v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryFounderToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func unmarshalFounderResponseBodyToWarehouseviewsFounderView(v *FounderResponseBody) *warehouseviews.FounderView {\n\tres := &warehouseviews.FounderView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func marshalInventoryFounderToFounderResponseBody(v *inventory.Founder) *FounderResponseBody {\n\tres := &FounderResponseBody{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func marshalDiscussionAuthorPhotoToAuthorPhotoResponseBody(v *discussion.AuthorPhoto) *AuthorPhotoResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &AuthorPhotoResponseBody{\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsHeadViewToHeadResponseBody(v *inventoryviews.HeadView) *HeadResponseBody {\n\tres := &HeadResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func (_LvStreamRightsHolder *LvStreamRightsHolderCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _LvStreamRightsHolder.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_VorRandomnessRequestMock *VorRandomnessRequestMockCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _VorRandomnessRequestMock.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (v *View) SetOwner(h handle.Handler) {\n\tv.owner = h\n}", "func NewUpdateResponseBody(res *warehouseviews.WarehouseView) *UpdateResponseBody {\n\tbody := &UpdateResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func (o RepositoryAssociationRepositoryGithubEnterpriseServerPtrOutput) Owner() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RepositoryAssociationRepositoryGithubEnterpriseServer) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Owner\n\t}).(pulumi.StringPtrOutput)\n}", "func marshalMatchesviewsRatingResourceViewToRatingResourceResponseBody(v *matchesviews.RatingResourceView) *RatingResourceResponseBody {\n\tres := &RatingResourceResponseBody{\n\t\tRrn: *v.Rrn,\n\t}\n\tif v.Rating != nil {\n\t\tres.Rating = marshalMatchesviewsRatingViewToRatingResponseBody(v.Rating)\n\t}\n\n\treturn res\n}", "func (s *View) SetOwner(v string) *View {\n\ts.Owner = &v\n\treturn s\n}", "func NewGetUserResponseBodyTiny(res *userviews.UserView) *GetUserResponseBodyTiny {\n\tbody := &GetUserResponseBodyTiny{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t}\n\treturn body\n}", "func EncodeNeatThingTodayResponse(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.(*neatthingviews.NeatThing)\n\t\tw.Header().Set(\"goa-view\", res.View)\n\t\tenc := encoder(ctx, w)\n\t\tvar body interface{}\n\t\tswitch res.View {\n\t\tcase \"default\", \"\":\n\t\t\tbody = NewNeatThingTodayResponseBody(res.Projected)\n\t\tcase \"full\":\n\t\t\tbody = NewNeatThingTodayResponseBodyFull(res.Projected)\n\t\tcase \"name\":\n\t\t\tbody = NewNeatThingTodayResponseBodyName(res.Projected)\n\t\tcase \"name+definition\":\n\t\t\tbody = NewNeatThingTodayResponseBodyNameDefinition(res.Projected)\n\t\tcase \"name+link\":\n\t\t\tbody = NewNeatThingTodayResponseBodyNameLink(res.Projected)\n\t\t}\n\t\tw.WriteHeader(http.StatusNoContent)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (o BucketReplicationConfigurationRuleDestinationAccessControlTranslationOutput) Owner() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BucketReplicationConfigurationRuleDestinationAccessControlTranslation) string { return v.Owner }).(pulumi.StringOutput)\n}", "func (o BucketReplicationConfigRuleDestinationAccessControlTranslationOutput) Owner() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BucketReplicationConfigRuleDestinationAccessControlTranslation) string { return v.Owner }).(pulumi.StringOutput)\n}", "func (_VorRandomnessRequestMock *VorRandomnessRequestMockCallerSession) Owner() (common.Address, error) {\n\treturn _VorRandomnessRequestMock.Contract.Owner(&_VorRandomnessRequestMock.CallOpts)\n}", "func (o RepositoryAssociationRepositoryBitbucketOutput) Owner() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RepositoryAssociationRepositoryBitbucket) string { return v.Owner }).(pulumi.StringOutput)\n}", "func (_VorRandomnessRequestMock *VorRandomnessRequestMockSession) Owner() (common.Address, error) {\n\treturn _VorRandomnessRequestMock.Contract.Owner(&_VorRandomnessRequestMock.CallOpts)\n}", "func (o LookupStreamingImageResultOutput) Owner() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LookupStreamingImageResult) *string { return v.Owner }).(pulumi.StringPtrOutput)\n}", "func marshalInventoryviewsProductViewToProductResponseBody(v *inventoryviews.ProductView) *ProductResponseBody {\n\tres := &ProductResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tUnit: *v.Unit,\n\t\tCostPrice: *v.CostPrice,\n\t\tMarketPrice: *v.MarketPrice,\n\t\tNote: *v.Note,\n\t\tImage: *v.Image,\n\t\tCode: *v.Code,\n\t\tSize: *v.Size,\n\t\tType: *v.Type,\n\t\tIsShelves: *v.IsShelves,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func (_SweetToken *SweetTokenCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _SweetToken.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "func NewCreateResponseBody(res *warehouseviews.WarehouseView) *CreateResponseBody {\n\tbody := &CreateResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func (_SimpleSavingsWallet *SimpleSavingsWalletCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _SimpleSavingsWallet.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "func NewFollowersResponseBody(res *followingviews.FollowersPageView) *FollowersResponseBody {\n\tbody := &FollowersResponseBody{\n\t\tTotal: *res.Total,\n\t\tPage: *res.Page,\n\t}\n\tif res.Followers != nil {\n\t\tbody.Followers = make([]*FollowerResponseBody, len(res.Followers))\n\t\tfor i, val := range res.Followers {\n\t\t\tbody.Followers[i] = marshalFollowingviewsFollowerViewToFollowerResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func (_BaseContentSpace *BaseContentSpaceCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseContentSpace.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (o *V0037Node) SetOwner(v string) {\n\to.Owner = &v\n}", "func (o SubnetOutput) OwnerId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Subnet) pulumi.StringOutput { return v.OwnerId }).(pulumi.StringOutput)\n}", "func (_NodeSpace *NodeSpaceCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _NodeSpace.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (u *GithubGistUpsert) SetOwner(v *github.User) *GithubGistUpsert {\n\tu.Set(githubgist.FieldOwner, v)\n\treturn u\n}", "func (_SweetToken *SweetTokenTransactorSession) SetOwner(owner_ common.Address) (*types.Transaction, error) {\n\treturn _SweetToken.Contract.SetOwner(&_SweetToken.TransactOpts, owner_)\n}", "func (o *StorageNetAppCloudTargetAllOf) SetOwner(v string) {\n\to.Owner = &v\n}", "func (_BaseContentFactory *BaseContentFactoryCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseContentFactory.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (o *CredentialsResponseElement) SetOwnerAccessOnly(v bool) {\n\to.OwnerAccessOnly = v\n}", "func (_Erc20Mock *Erc20MockCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Erc20Mock.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "func (option *SetAttribute) SetOwner(value string) {\n\toption.Owner = &value\n}", "func (_Mevsky *MevskySession) Owner() (common.Address, error) {\n\treturn _Mevsky.Contract.Owner(&_Mevsky.CallOpts)\n}", "func unmarshalComponentResponseBodyToStorageviewsComponentView(v *ComponentResponseBody) *storageviews.ComponentView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &storageviews.ComponentView{\n\t\tVarietal: v.Varietal,\n\t\tPercentage: v.Percentage,\n\t}\n\n\treturn res\n}", "func (_TokenStakingEscrow *TokenStakingEscrowCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _TokenStakingEscrow.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "func (_SweetToken *SweetTokenSession) SetOwner(owner_ common.Address) (*types.Transaction, error) {\n\treturn _SweetToken.Contract.SetOwner(&_SweetToken.TransactOpts, owner_)\n}", "func (_BaseAccessWalletFactory *BaseAccessWalletFactoryCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseAccessWalletFactory.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_SimpleSavingsWallet *SimpleSavingsWalletSession) Owner() (common.Address, error) {\n\treturn _SimpleSavingsWallet.Contract.Owner(&_SimpleSavingsWallet.CallOpts)\n}", "func (_SweetToken *SweetTokenSession) Owner() (common.Address, error) {\n\treturn _SweetToken.Contract.Owner(&_SweetToken.CallOpts)\n}", "func (o *CredentialsResponseElement) GetOwner() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Owner\n}", "func (o *GetTreeParams) SetOwner(owner string) {\n\to.Owner = owner\n}", "func NewGetUserResponseBody(res *userviews.UserView) *GetUserResponseBody {\n\tbody := &GetUserResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tEmail: *res.Email,\n\t\tScore: res.Score,\n\t}\n\treturn body\n}", "func (_OwnerProxyRegistry *OwnerProxyRegistryCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _OwnerProxyRegistry.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_UpkeepRegistrationRequests *UpkeepRegistrationRequestsCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _UpkeepRegistrationRequests.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_Mcapscontroller *McapscontrollerCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Mcapscontroller.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_TransferProxyRegistry *TransferProxyRegistryCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _TransferProxyRegistry.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_MetaObject *MetaObjectCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _MetaObject.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_BaseContentType *BaseContentTypeCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseContentType.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (o *DeployKey) SetOwner(v Account) {\n\to.Owner = &v\n}", "func (o *V0037Node) GetOwnerOk() (*string, bool) {\n\tif o == nil || o.Owner == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Owner, true\n}", "func (_SimpleSavingsWallet *SimpleSavingsWalletCallerSession) Owner() (common.Address, error) {\n\treturn _SimpleSavingsWallet.Contract.Owner(&_SimpleSavingsWallet.CallOpts)\n}", "func (o *InlineResponse20027Person) GetSiteOwnerOk() (*bool, bool) {\n\tif o == nil || o.SiteOwner == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SiteOwner, true\n}", "func (_XStaking *XStakingCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _XStaking.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_Mevsky *MevskyCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _Mevsky.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (o LookupMulticastDomainResultOutput) OwnerId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupMulticastDomainResult) string { return v.OwnerId }).(pulumi.StringOutput)\n}", "func (_BaseFactory *BaseFactoryCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseFactory.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "func (_FinalizableCrowdsaleImpl *FinalizableCrowdsaleImplCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _FinalizableCrowdsaleImpl.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "func (_Gatekeeper *GatekeeperSession) Owner() (common.Address, error) {\n\treturn _Gatekeeper.Contract.Owner(&_Gatekeeper.CallOpts)\n}", "func (_WyvernExchange *WyvernExchangeCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _WyvernExchange.contract.Call(opts, out, \"owner\")\n\treturn *ret0, err\n}", "func (_BaseLibraryFactory *BaseLibraryFactoryCaller) Owner(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _BaseLibraryFactory.contract.Call(opts, &out, \"owner\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}" ]
[ "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.60750115", "0.60750115", "0.5998508", "0.5981963", "0.5981963", "0.5964544", "0.5771961", "0.5689389", "0.5500022", "0.53603274", "0.51866555", "0.5164558", "0.51011175", "0.50663936", "0.50247777", "0.5017956", "0.50177836", "0.50048625", "0.50036806", "0.49757916", "0.4939927", "0.49157253", "0.48874417", "0.48678616", "0.48352274", "0.48324773", "0.48298895", "0.48003814", "0.4800204", "0.4799904", "0.4743737", "0.47397643", "0.47074986", "0.46478602", "0.46472958", "0.46440235", "0.46425635", "0.46421036", "0.4637882", "0.4636535", "0.463075", "0.46282408", "0.46275", "0.46272317", "0.45921513", "0.45916963", "0.45764092", "0.4567779", "0.45575348", "0.45494533", "0.45462382", "0.4536462", "0.45270476", "0.45251223", "0.45237467", "0.45227423", "0.45202005", "0.45139298", "0.45125976", "0.4511929", "0.4500084", "0.44989634", "0.4494171", "0.4492796", "0.4491169", "0.449054", "0.44844705", "0.44781744", "0.44778183", "0.44771406", "0.44744593", "0.44738895", "0.44722974", "0.4471191", "0.44649577", "0.44630206", "0.44628504", "0.4457943" ]
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\tfor i, val := range v.Shape {\n\t\t\tres.Shape[i] = make([][]float64, len(val))\n\t\t\tfor j, val := range val {\n\t\t\t\tres.Shape[i][j] = make([]float64, len(val))\n\t\t\t\tfor k, val := range val {\n\t\t\t\t\tres.Shape[i][j][k] = val\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}", "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 = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Reading != nil {\n\t\tres.Reading = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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 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))\n\t\tfor i, val := range v.Precise {\n\t\t\tres.Precise[i] = val\n\t\t}\n\t}\n\tif v.Regions != nil {\n\t\tres.Regions = make([]*StationRegionResponseBody, len(v.Regions))\n\t\tfor i, val := range v.Regions {\n\t\t\tres.Regions[i] = marshalStationviewsStationRegionViewToStationRegionResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.StationPhotosView) *StationPhotosResponseBody {\n\tres := &StationPhotosResponseBody{\n\t\tSmall: *v.Small,\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationJobViewToStationJobResponseBody(v *stationviews.StationJobView) *StationJobResponseBody {\n\tres := &StationJobResponseBody{\n\t\tTitle: *v.Title,\n\t\tStartedAt: *v.StartedAt,\n\t\tCompletedAt: v.CompletedAt,\n\t\tProgress: *v.Progress,\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t\tFullKey: *v.FullKey,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsEssentialStationViewToEssentialStationResponseBody(v *stationviews.EssentialStationView) *EssentialStationResponseBody {\n\tres := &EssentialStationResponseBody{\n\t\tID: *v.ID,\n\t\tDeviceID: *v.DeviceID,\n\t\tName: *v.Name,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tLastIngestionAt: v.LastIngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v *stationviews.StationDataSummaryView) *StationDataSummaryResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &StationDataSummaryResponseBody{\n\t\tStart: *v.Start,\n\t\tEnd: *v.End,\n\t\tNumberOfSamples: *v.NumberOfSamples,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tLocationName: v.LocationName,\n\t\tPlaceNameOther: v.PlaceNameOther,\n\t\tPlaceNameNative: v.PlaceNameNative,\n\t\tSyncedAt: v.SyncedAt,\n\t\tIngestionAt: v.IngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\tif v.Data != nil {\n\t\tres.Data = marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v.Data)\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdated: *v.Updated,\n\t\tLocationName: v.LocationName,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Images != nil {\n\t\tres.Images = make([]*ImageRefResponseBody, len(v.Images))\n\t\tfor i, val := range v.Images {\n\t\t\tres.Images[i] = marshalStationviewsImageRefViewToImageRefResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "func marshalStationviewsImageRefViewToImageRefResponseBody(v *stationviews.ImageRefView) *ImageRefResponseBody {\n\tres := &ImageRefResponseBody{\n\t\tURL: *v.URL,\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsWarehouseViewToWarehouseResponseBody(v *inventoryviews.WarehouseView) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tCode: *v.Code,\n\t\tAddress: *v.Address,\n\t\tType: *v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func unmarshalWineryResponseBodyToStorageviewsWineryView(v *WineryResponseBody) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func marshalVironAPIViewToVironAPIResponseBody(v *vironviews.VironAPIView) *VironAPIResponseBody {\n\tres := &VironAPIResponseBody{\n\t\tMethod: *v.Method,\n\t\tPath: *v.Path,\n\t}\n\n\treturn res\n}", "func marshalMatchesviewsRatingViewToRatingResponseBody(v *matchesviews.RatingView) *RatingResponseBody {\n\tres := &RatingResponseBody{\n\t\tStrength: *v.Strength,\n\t\tLower: *v.Lower,\n\t\tUpper: *v.Upper,\n\t}\n\n\treturn res\n}", "func unmarshalComponentResponseBodyToStorageviewsComponentView(v *ComponentResponseBody) *storageviews.ComponentView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &storageviews.ComponentView{\n\t\tVarietal: v.Varietal,\n\t\tPercentage: v.Percentage,\n\t}\n\n\treturn res\n}", "func NewAddResponseBodyTiny(res *stepviews.ResultStepView) *AddResponseBodyTiny {\n\tbody := &AddResponseBodyTiny{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Step != nil {\n\t\tbody.Step = marshalStepviewsStoredStepViewToStoredStepResponseBody(res.Step)\n\t}\n\treturn body\n}", "func ValidateStationSensorResponseBody(body *StationSensorResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.UnitOfMeasure == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"unit_of_measure\", \"body\"))\n\t}\n\tif body.Key == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"key\", \"body\"))\n\t}\n\tif body.Ranges == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"ranges\", \"body\"))\n\t}\n\tif body.Reading != nil {\n\t\tif err2 := ValidateSensorReadingResponseBody(body.Reading); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\tfor _, e := range body.Ranges {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateSensorRangeResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func NewUpdateResponseBody(res *warehouseviews.WarehouseView) *UpdateResponseBody {\n\tbody := &UpdateResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(v *discussionviews.ThreadedPostView) *ThreadedPostResponseBody {\n\tres := &ThreadedPostResponseBody{\n\t\tID: *v.ID,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tBody: *v.Body,\n\t\tBookmark: v.Bookmark,\n\t}\n\tif v.Author != nil {\n\t\tres.Author = marshalDiscussionviewsPostAuthorViewToPostAuthorResponseBody(v.Author)\n\t}\n\tif v.Replies != nil {\n\t\tres.Replies = make([]*ThreadedPostResponseBody, len(v.Replies))\n\t\tfor i, val := range v.Replies {\n\t\t\tres.Replies[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func NewAddResponseBody(res *stepviews.ResultStepView) *AddResponseBody {\n\tbody := &AddResponseBody{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Step != nil {\n\t\tbody.Step = marshalStepviewsStoredStepViewToStoredStepResponseBody(res.Step)\n\t}\n\treturn body\n}", "func marshalInventoryviewsProductViewToProductResponseBody(v *inventoryviews.ProductView) *ProductResponseBody {\n\tres := &ProductResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tUnit: *v.Unit,\n\t\tCostPrice: *v.CostPrice,\n\t\tMarketPrice: *v.MarketPrice,\n\t\tNote: *v.Note,\n\t\tImage: *v.Image,\n\t\tCode: *v.Code,\n\t\tSize: *v.Size,\n\t\tType: *v.Type,\n\t\tIsShelves: *v.IsShelves,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsFounderViewToFounderResponseBody(v *inventoryviews.FounderView) *FounderResponseBody {\n\tres := &FounderResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalInventoryWarehouseToWarehouseResponseBody(v *inventory.Warehouse) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t\tCode: v.Code,\n\t\tAddress: v.Address,\n\t\tType: v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryFounderToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func ValidateStationConfigurationResponseBody(body *StationConfigurationResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.ProvisionID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"provision_id\", \"body\"))\n\t}\n\tif body.Time == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"time\", \"body\"))\n\t}\n\tif body.Modules == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"modules\", \"body\"))\n\t}\n\tfor _, e := range body.Modules {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateStationModuleResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func unmarshalStoredBottleResponseToStorageviewsStoredBottleView(v *StoredBottleResponse) *storageviews.StoredBottleView {\n\tres := &storageviews.StoredBottleView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t\tVintage: v.Vintage,\n\t\tDescription: v.Description,\n\t\tRating: v.Rating,\n\t}\n\tres.Winery = unmarshalWineryResponseToStorageviewsWineryView(v.Winery)\n\tif v.Composition != nil {\n\t\tres.Composition = make([]*storageviews.ComponentView, len(v.Composition))\n\t\tfor i, val := range v.Composition {\n\t\t\tres.Composition[i] = unmarshalComponentResponseToStorageviewsComponentView(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func NewSigninResponseBody(res *securedviews.GoaJWTView) *SigninResponseBody {\n\tbody := &SigninResponseBody{\n\t\tAuthorization: *res.Authorization,\n\t}\n\treturn body\n}", "func NewUploadWidget(handler func(*vecty.Event)) *UploadWidget {\n\treturn &UploadWidget{\n\t\thandler: handler,\n\t}\n}", "func UnmarshalTemplateRepoTarUploadResponse(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(TemplateRepoTarUploadResponse)\n\terr = core.UnmarshalPrimitive(m, \"file_value\", &obj.FileValue)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"has_received_file\", &obj.HasReceivedFile)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"id\", &obj.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func UploadTarbal(sm session.Manager) http.Handler {\n\treturn &tarballUploader{sm}\n}", "func unmarshalWineryResponseToStorageviewsWineryView(v *WineryResponse) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func ValidateStationModuleResponseBody(body *StationModuleResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.Position == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"position\", \"body\"))\n\t}\n\tif body.Flags == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"flags\", \"body\"))\n\t}\n\tif body.Internal == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"internal\", \"body\"))\n\t}\n\tif body.Sensors == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"sensors\", \"body\"))\n\t}\n\tfor _, e := range body.Sensors {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateStationSensorResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func ServerEncodeResponseBody(timeLayout string, format wrp.Format) gokithttp.EncodeResponseFunc {\n\treturn func(ctx context.Context, httpResponse http.ResponseWriter, value interface{}) error {\n\t\tvar (\n\t\t\twrpResponse = value.(wrpendpoint.Response)\n\t\t\toutput bytes.Buffer\n\t\t)\n\n\t\ttracinghttp.HeadersForSpans(timeLayout, httpResponse.Header(), wrpResponse.Spans()...)\n\n\t\tif err := wrpResponse.Encode(&output, format); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\thttpResponse.Header().Set(\"Content-Type\", format.ContentType())\n\t\t_, err := output.WriteTo(httpResponse)\n\t\treturn err\n\t}\n}", "func marshalInventoryviewsHeadViewToHeadResponseBody(v *inventoryviews.HeadView) *HeadResponseBody {\n\tres := &HeadResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func unmarshalWindResponseBodyToLogWind(v *WindResponseBody) *log.Wind {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &log.Wind{\n\t\tSpeed: v.Speed,\n\t\tDirection: v.Direction,\n\t\tUnit: v.Unit,\n\t}\n\n\treturn res\n}", "func marshalDiscussionviewsAuthorPhotoViewToAuthorPhotoResponseBody(v *discussionviews.AuthorPhotoView) *AuthorPhotoResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &AuthorPhotoResponseBody{\n\t\tURL: *v.URL,\n\t}\n\n\treturn res\n}", "func unmarshalFounderResponseBodyToWarehouseviewsFounderView(v *FounderResponseBody) *warehouseviews.FounderView {\n\tres := &warehouseviews.FounderView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func NewCreateResponseBody(res *warehouseviews.WarehouseView) *CreateResponseBody {\n\tbody := &CreateResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func marshalPostsPostOutputToPostOutputResponseBody(v *posts.PostOutput) *PostOutputResponseBody {\n\tres := &PostOutputResponseBody{\n\t\tID: v.ID,\n\t\tTitle: v.Title,\n\t\tDescription: v.Description,\n\t\tScreenImageURL: v.ScreenImageURL,\n\t}\n\n\treturn res\n}", "func NewListResponseBody(res *stepviews.StoredListOfStepsView) *ListResponseBody {\n\tbody := &ListResponseBody{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Steps != nil {\n\t\tbody.Steps = make([]*StoredStepResponseBody, len(res.Steps))\n\t\tfor i, val := range res.Steps {\n\t\t\tbody.Steps[i] = marshalStepviewsStoredStepViewToStoredStepResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func unmarshalSuccessResultResponseBodyToUserSuccessResult(v *SuccessResultResponseBody) *user.SuccessResult {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &user.SuccessResult{\n\t\tOK: *v.OK,\n\t}\n\n\treturn res\n}", "func unmarshalWarehouseResponseBodyToWarehouseWarehouse(v *WarehouseResponseBody) *warehouse.Warehouse {\n\tres := &warehouse.Warehouse{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tCode: *v.Code,\n\t\tAddress: *v.Address,\n\t\tType: *v.Type,\n\t}\n\tres.Founder = unmarshalFounderResponseBodyToWarehouseFounder(v.Founder)\n\n\treturn res\n}", "func EncodeStationMetaResponse(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.(*sensor.StationMetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func marshalMatchesviewsRatingResourceViewToRatingResourceResponseBody(v *matchesviews.RatingResourceView) *RatingResourceResponseBody {\n\tres := &RatingResourceResponseBody{\n\t\tRrn: *v.Rrn,\n\t}\n\tif v.Rating != nil {\n\t\tres.Rating = marshalMatchesviewsRatingViewToRatingResponseBody(v.Rating)\n\t}\n\n\treturn res\n}", "func NewDeviceLayoutResponseViewOK(body *DeviceLayoutResponseBody) *informationviews.DeviceLayoutResponseView {\n\tv := &informationviews.DeviceLayoutResponseView{}\n\tv.Configurations = make([]*informationviews.StationConfigurationView, len(body.Configurations))\n\tfor i, val := range body.Configurations {\n\t\tv.Configurations[i] = unmarshalStationConfigurationResponseBodyToInformationviewsStationConfigurationView(val)\n\t}\n\tv.Sensors = make(map[string][]*informationviews.StationSensorView, len(body.Sensors))\n\tfor key, val := range body.Sensors {\n\t\ttk := key\n\t\ttv := make([]*informationviews.StationSensorView, len(val))\n\t\tfor i, val := range val {\n\t\t\ttv[i] = unmarshalStationSensorResponseBodyToInformationviewsStationSensorView(val)\n\t\t}\n\t\tv.Sensors[tk] = tv\n\t}\n\n\treturn v\n}", "func BuildRemoveStationPayload(projectRemoveStationProjectID string, projectRemoveStationStationID string, projectRemoveStationAuth string) (*project.RemoveStationPayload, error) {\n\tvar err error\n\tvar projectID int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(projectRemoveStationProjectID, 10, 32)\n\t\tprojectID = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for projectID, must be INT32\")\n\t\t}\n\t}\n\tvar stationID int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(projectRemoveStationStationID, 10, 32)\n\t\tstationID = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for stationID, must be INT32\")\n\t\t}\n\t}\n\tvar auth string\n\t{\n\t\tauth = projectRemoveStationAuth\n\t}\n\tv := &project.RemoveStationPayload{}\n\tv.ProjectID = projectID\n\tv.StationID = stationID\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func unmarshalTagResponseBodyToResourceviewsTagView(v *TagResponseBody) *resourceviews.TagView {\n\tres := &resourceviews.TagView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func NewStatusResponseBody(res *spinbroker.StatusResult) *StatusResponseBody {\n\tbody := &StatusResponseBody{\n\t\tStatus: res.Status,\n\t\tReason: res.Reason,\n\t\tCauser: res.Causer,\n\t}\n\treturn body\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func marshalDiscussionThreadedPostToThreadedPostResponseBody(v *discussion.ThreadedPost) *ThreadedPostResponseBody {\n\tres := &ThreadedPostResponseBody{\n\t\tID: v.ID,\n\t\tCreatedAt: v.CreatedAt,\n\t\tUpdatedAt: v.UpdatedAt,\n\t\tBody: v.Body,\n\t\tBookmark: v.Bookmark,\n\t}\n\tif v.Author != nil {\n\t\tres.Author = marshalDiscussionPostAuthorToPostAuthorResponseBody(v.Author)\n\t}\n\tif v.Replies != nil {\n\t\tres.Replies = make([]*ThreadedPostResponseBody, len(v.Replies))\n\t\tfor i, val := range v.Replies {\n\t\t\tres.Replies[i] = marshalDiscussionThreadedPostToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func NewUploadRegulaScanViewOK() *UploadRegulaScanViewOK {\n\treturn &UploadRegulaScanViewOK{}\n}", "func (o SnapshotImportClientDataOutput) UploadSize() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v SnapshotImportClientData) *float64 { return v.UploadSize }).(pulumi.Float64PtrOutput)\n}", "func CreateUploadIoTDataToBlockchainResponse() (response *UploadIoTDataToBlockchainResponse) {\n\tresponse = &UploadIoTDataToBlockchainResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func CreateUploadFileByURLResponse() (response *UploadFileByURLResponse) {\n\tresponse = &UploadFileByURLResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func NewProjectResponseBody(res *discussionviews.DiscussionView) *ProjectResponseBody {\n\tbody := &ProjectResponseBody{}\n\tif res.Posts != nil {\n\t\tbody.Posts = make([]*ThreadedPostResponseBody, len(res.Posts))\n\t\tfor i, val := range res.Posts {\n\t\t\tbody.Posts[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func ValueHTTPResponseBody(ctx context.Context) interface{} {\n\treturn ctx.Value(contextHTTPResponseBodyFields)\n}", "func unmarshalAvatarResponseBodyToFollowingviewsAvatarView(v *AvatarResponseBody) *followingviews.AvatarView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &followingviews.AvatarView{\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func NewAdminSigninResponseBody(res *adminviews.JeeekAdminSigninView) *AdminSigninResponseBody {\n\tbody := &AdminSigninResponseBody{\n\t\tToken: *res.Token,\n\t}\n\treturn body\n}", "func UploadHandler(ctx context.Context, r *http.Request) (interface{}, error) {\n\tctx = setupHandlerContext(ctx, r)\n\tresponse, err := storageHandler.WriteFile(ctx, r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn response, nil\n}", "func ValidateFieldNoteStationResponseBody(body *FieldNoteStationResponseBody) (err error) {\n\tif body.ReadOnly == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"readOnly\", \"body\"))\n\t}\n\treturn\n}", "func newBattlestreamingresultView(res *Battlestreamingresult) *shiritoriviews.BattlestreamingresultView {\n\tvres := &shiritoriviews.BattlestreamingresultView{\n\t\tType: &res.Type,\n\t\tTimestamp: &res.Timestamp,\n\t}\n\tif res.MessagePayload != nil {\n\t\tvres.MessagePayload = transformMessagePayloadToShiritoriviewsMessagePayloadView(res.MessagePayload)\n\t}\n\treturn vres\n}", "func WrapUploadInfos(h Handler, w http.ResponseWriter, r *http.Request) {\n\th.UploadInfos(w, r)\n}", "func NewGetUserResponseBodyTiny(res *userviews.UserView) *GetUserResponseBodyTiny {\n\tbody := &GetUserResponseBodyTiny{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t}\n\treturn body\n}", "func marshalWindRequestBodyToLogWind(v *WindRequestBody) *log.Wind {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &log.Wind{\n\t\tSpeed: v.Speed,\n\t\tDirection: v.Direction,\n\t\tUnit: v.Unit,\n\t}\n\n\treturn res\n}", "func NewUploadResponse() *UploadResponse {\n\tthis := UploadResponse{}\n\tvar ok bool = true\n\tthis.Ok = &ok\n\treturn &this\n}", "func GetUploadHandler(c buffalo.Context) error {\n\t// get current user details to show\n\tc.Set(\"widget\", &models.Widget{})\n\treturn c.Render(200, render.R.HTML(\"api-examples/upload.html\"))\n}", "func marshalBottleRequestBodyToStorageBottle(v *BottleRequestBody) *storage.Bottle {\n\tres := &storage.Bottle{\n\t\tName: v.Name,\n\t\tVintage: v.Vintage,\n\t\tDescription: v.Description,\n\t\tRating: v.Rating,\n\t}\n\tif v.Winery != nil {\n\t\tres.Winery = marshalWineryRequestBodyToStorageWinery(v.Winery)\n\t}\n\tif v.Composition != nil {\n\t\tres.Composition = make([]*storage.Component, len(v.Composition))\n\t\tfor i, val := range v.Composition {\n\t\t\tres.Composition[i] = marshalComponentRequestBodyToStorageComponent(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func NewAdminUpdateUserResponseBodyTiny(res *adminviews.JeeekUserView) *AdminUpdateUserResponseBodyTiny {\n\tbody := &AdminUpdateUserResponseBodyTiny{\n\t\tUserID: *res.UserID,\n\t\tUserName: *res.UserName,\n\t\tEmailAddress: *res.EmailAddress,\n\t}\n\treturn body\n}", "func marshalLogWindToWindRequestBody(v *log.Wind) *WindRequestBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &WindRequestBody{\n\t\tSpeed: v.Speed,\n\t\tDirection: v.Direction,\n\t\tUnit: v.Unit,\n\t}\n\n\treturn res\n}", "func UploadSuccessHandler(w http.ResponseWriter, r *http.Request) {\n\tio.WriteString(w, \"uploaded successfully!\")\n}", "func (o SnapshotImportClientDataPtrOutput) UploadSize() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *SnapshotImportClientData) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.UploadSize\n\t}).(pulumi.Float64PtrOutput)\n}", "func marshalWineryRequestBodyToStorageWinery(v *WineryRequestBody) *storage.Winery {\n\tres := &storage.Winery{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func (o *UploadResponse) SetValue(v NFT) {\n\to.Value = &v\n}", "func transformShiritoriviewsMessagePayloadViewToMessagePayload(v *shiritoriviews.MessagePayloadView) *MessagePayload {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &MessagePayload{\n\t\tMessage: *v.Message,\n\t}\n\n\treturn res\n}", "func Upload(w http.ResponseWriter, r *http.Request) {\n\tblockChainJson, err := SBC.BlockChainToJson()\n\tif err != nil {\n\t\tfmt.Println(err, \"Upload\")\n\t}\n\n\tfmt.Fprint(w, blockChainJson)\n}", "func WithRawResponseBody() RequestParam {\n\treturn requestParamFunc(func(b *requestBuilder) error {\n\t\tb.bodyMiddleware.rawOutput = true\n\t\tb.bodyMiddleware.responseOutput = nil\n\t\tb.bodyMiddleware.responseDecoder = nil\n\t\tb.headers.Set(\"Accept\", \"application/octet-stream\")\n\t\treturn nil\n\t})\n}", "func unmarshalComponentResponseToStorageviewsComponentView(v *ComponentResponse) *storageviews.ComponentView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &storageviews.ComponentView{\n\t\tVarietal: v.Varietal,\n\t\tPercentage: v.Percentage,\n\t}\n\n\treturn res\n}", "func marshalDiscussionviewsPostAuthorViewToPostAuthorResponseBody(v *discussionviews.PostAuthorView) *PostAuthorResponseBody {\n\tres := &PostAuthorResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\tif v.Photo != nil {\n\t\tres.Photo = marshalDiscussionviewsAuthorPhotoViewToAuthorPhotoResponseBody(v.Photo)\n\t}\n\n\treturn res\n}", "func UploadHandler(outputPath string, config *task.IngestTaskConfig) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tdataset := pat.Param(r, \"dataset\")\n\n\t\t// read the file from the request\n\t\tbytes, err := receiveFile(r)\n\t\tif err != nil {\n\t\t\thandleError(w, errors.Wrap(err, \"unable to receive file from request\"))\n\t\t\treturn\n\t\t}\n\n\t\t// create the raw dataset schema doc\n\t\tformattedPath, err := task.CreateDataset(dataset, bytes, outputPath, config)\n\t\tif err != nil {\n\t\t\thandleError(w, errors.Wrap(err, \"unable to create dataset\"))\n\t\t\treturn\n\t\t}\n\t\tlog.Infof(\"uploaded new dataset %s at %s\", dataset, formattedPath)\n\t\t// marshal data and sent the response back\n\t\terr = handleJSON(w, map[string]interface{}{\"result\": \"uploaded\"})\n\t\tif err != nil {\n\t\t\thandleError(w, errors.Wrap(err, \"unable marshal result histogram into JSON\"))\n\t\t\treturn\n\t\t}\n\t}\n}", "func HTTPResponseBodyContent(val string) zap.Field {\n\treturn zap.String(FieldHTTPResponseBodyContent, val)\n}", "func UploadSuccessHandler(w http.ResponseWriter, r *http.Request) {\n\t_, _ = io.WriteString(w, \"upload succeed\")\n}", "func (UploadReady) Unmarshal(v []byte) (interface{}, error) {\n\te := UploadReady{}\n\terr := json.Unmarshal(v, &e)\n\treturn e, err\n}", "func BuildTransferPayload(stationTransferID string, stationTransferOwnerID string, stationTransferAuth string) (*station.TransferPayload, error) {\n\tvar err error\n\tvar id int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(stationTransferID, 10, 32)\n\t\tid = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for id, must be INT32\")\n\t\t}\n\t}\n\tvar ownerID int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(stationTransferOwnerID, 10, 32)\n\t\townerID = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for ownerID, must be INT32\")\n\t\t}\n\t}\n\tvar auth string\n\t{\n\t\tauth = stationTransferAuth\n\t}\n\tv := &station.TransferPayload{}\n\tv.ID = id\n\tv.OwnerID = ownerID\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func EncodeAddResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewAddResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}" ]
[ "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.61621374", "0.61621374", "0.6126022", "0.5897642", "0.5729308", "0.51035595", "0.49373573", "0.49318516", "0.4742225", "0.46016914", "0.4579638", "0.45061442", "0.4491815", "0.44383457", "0.44279408", "0.44261637", "0.43955728", "0.43563914", "0.43069643", "0.42983785", "0.429434", "0.42940438", "0.42877203", "0.42429638", "0.42105094", "0.42075685", "0.41617197", "0.41500688", "0.41441154", "0.41344017", "0.40930447", "0.40595356", "0.40301943", "0.4029808", "0.40132433", "0.39821044", "0.39624462", "0.3958666", "0.39529148", "0.3947797", "0.3946409", "0.39332274", "0.39332274", "0.3913835", "0.3905932", "0.39000487", "0.38752237", "0.38691097", "0.38592246", "0.3859094", "0.38459912", "0.38286784", "0.38202995", "0.38129747", "0.37989622", "0.37795606", "0.37783486", "0.3777463", "0.37704247", "0.37697136", "0.3764507", "0.37542212", "0.3747248", "0.37469178", "0.37426004", "0.37273645", "0.37218407", "0.37164813", "0.370336", "0.37004608", "0.36939484", "0.36917552", "0.36868727", "0.36815816", "0.36727676", "0.3672464", "0.36648646", "0.36627367" ]
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.StationPhotosView) *StationPhotosResponseBody {\n\tres := &StationPhotosResponseBody{\n\t\tSmall: *v.Small,\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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))\n\t\tfor i, val := range v.Precise {\n\t\t\tres.Precise[i] = val\n\t\t}\n\t}\n\tif v.Regions != nil {\n\t\tres.Regions = make([]*StationRegionResponseBody, len(v.Regions))\n\t\tfor i, val := range v.Regions {\n\t\t\tres.Regions[i] = marshalStationviewsStationRegionViewToStationRegionResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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 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\tfor i, val := range v.Shape {\n\t\t\tres.Shape[i] = make([][]float64, len(val))\n\t\t\tfor j, val := range val {\n\t\t\t\tres.Shape[i][j] = make([]float64, len(val))\n\t\t\t\tfor k, val := range val {\n\t\t\t\t\tres.Shape[i][j][k] = val\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalMatchesviewsRatingViewToRatingResponseBody(v *matchesviews.RatingView) *RatingResponseBody {\n\tres := &RatingResponseBody{\n\t\tStrength: *v.Strength,\n\t\tLower: *v.Lower,\n\t\tUpper: *v.Upper,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalDiscussionviewsAuthorPhotoViewToAuthorPhotoResponseBody(v *discussionviews.AuthorPhotoView) *AuthorPhotoResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &AuthorPhotoResponseBody{\n\t\tURL: *v.URL,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "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 = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Reading != nil {\n\t\tres.Reading = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalMatchesviewsRatingResourceViewToRatingResourceResponseBody(v *matchesviews.RatingResourceView) *RatingResourceResponseBody {\n\tres := &RatingResourceResponseBody{\n\t\tRrn: *v.Rrn,\n\t}\n\tif v.Rating != nil {\n\t\tres.Rating = marshalMatchesviewsRatingViewToRatingResponseBody(v.Rating)\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsFounderViewToFounderResponseBody(v *inventoryviews.FounderView) *FounderResponseBody {\n\tres := &FounderResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v *stationviews.StationDataSummaryView) *StationDataSummaryResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &StationDataSummaryResponseBody{\n\t\tStart: *v.Start,\n\t\tEnd: *v.End,\n\t\tNumberOfSamples: *v.NumberOfSamples,\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdated: *v.Updated,\n\t\tLocationName: v.LocationName,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Images != nil {\n\t\tres.Images = make([]*ImageRefResponseBody, len(v.Images))\n\t\tfor i, val := range v.Images {\n\t\t\tres.Images[i] = marshalStationviewsImageRefViewToImageRefResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "func marshalStationviewsEssentialStationViewToEssentialStationResponseBody(v *stationviews.EssentialStationView) *EssentialStationResponseBody {\n\tres := &EssentialStationResponseBody{\n\t\tID: *v.ID,\n\t\tDeviceID: *v.DeviceID,\n\t\tName: *v.Name,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tLastIngestionAt: v.LastIngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "func unmarshalAvatarResponseBodyToFollowingviewsAvatarView(v *AvatarResponseBody) *followingviews.AvatarView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &followingviews.AvatarView{\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationJobViewToStationJobResponseBody(v *stationviews.StationJobView) *StationJobResponseBody {\n\tres := &StationJobResponseBody{\n\t\tTitle: *v.Title,\n\t\tStartedAt: *v.StartedAt,\n\t\tCompletedAt: v.CompletedAt,\n\t\tProgress: *v.Progress,\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t\tFullKey: *v.FullKey,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalVironAPIViewToVironAPIResponseBody(v *vironviews.VironAPIView) *VironAPIResponseBody {\n\tres := &VironAPIResponseBody{\n\t\tMethod: *v.Method,\n\t\tPath: *v.Path,\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tLocationName: v.LocationName,\n\t\tPlaceNameOther: v.PlaceNameOther,\n\t\tPlaceNameNative: v.PlaceNameNative,\n\t\tSyncedAt: v.SyncedAt,\n\t\tIngestionAt: v.IngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\tif v.Data != nil {\n\t\tres.Data = marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v.Data)\n\t}\n\n\treturn res\n}", "func unmarshalImage(b []byte, c *Client) (*Image, error) {\n\tvar m map[string]interface{}\n\tif err := json.Unmarshal(b, &m); err != nil {\n\t\treturn nil, err\n\t}\n\treturn unmarshalMapImage(m, c)\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalPostsPostOutputToPostOutputResponseBody(v *posts.PostOutput) *PostOutputResponseBody {\n\tres := &PostOutputResponseBody{\n\t\tID: v.ID,\n\t\tTitle: v.Title,\n\t\tDescription: v.Description,\n\t\tScreenImageURL: v.ScreenImageURL,\n\t}\n\n\treturn res\n}", "func marshalDiscussionAuthorPhotoToAuthorPhotoResponseBody(v *discussion.AuthorPhoto) *AuthorPhotoResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &AuthorPhotoResponseBody{\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func (r *Image) marshal(c *Client) ([]byte, error) {\n\tm, err := expandImage(c, r)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error marshalling Image: %w\", err)\n\t}\n\n\treturn json.Marshal(m)\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func (r *ImageRef) BuildOutput() (*buildv1.BuildOutput, error) {\n\tif r == nil {\n\t\treturn &buildv1.BuildOutput{}, nil\n\t}\n\tif !r.AsImageStream {\n\t\treturn &buildv1.BuildOutput{\n\t\t\tTo: &corev1.ObjectReference{\n\t\t\t\tKind: \"DockerImage\",\n\t\t\t\tName: r.Reference.String(),\n\t\t\t},\n\t\t}, nil\n\t}\n\timageRepo, err := r.ImageStream()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &buildv1.BuildOutput{\n\t\tTo: &corev1.ObjectReference{\n\t\t\tKind: \"ImageStreamTag\",\n\t\t\tName: imageutil.JoinImageStreamTag(imageRepo.Name, r.Reference.Tag),\n\t\t},\n\t}, nil\n}", "func unmarshalWineryResponseBodyToStorageviewsWineryView(v *WineryResponseBody) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func (i ImageReference) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"offer\", i.Offer)\n\tpopulate(objectMap, \"publisher\", i.Publisher)\n\tpopulate(objectMap, \"sku\", i.SKU)\n\tpopulate(objectMap, \"version\", i.Version)\n\treturn json.Marshal(objectMap)\n}", "func (o SignatureResponseOutput) Image() ImageResponseOutput {\n\treturn o.ApplyT(func(v SignatureResponse) ImageResponse { return v.Image }).(ImageResponseOutput)\n}", "func unmarshalTagResponseBodyToResourceviewsTagView(v *TagResponseBody) *resourceviews.TagView {\n\tres := &resourceviews.TagView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func marshalRxRecipeResponseBodyToRxRecipeView(v *RxRecipeResponseBody) *recipeviews.RxRecipeView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &recipeviews.RxRecipeView{\n\t\tID: v.ID,\n\t\tTitle: v.Title,\n\t\tDescription: v.Description,\n\t\tVersion: v.Version,\n\t\tFavorite: v.Favorite,\n\t\tRating: v.Rating,\n\t\tDifficulty: v.Difficulty,\n\t\tState: v.State,\n\t\tComplete: v.Complete,\n\t}\n\tif v.Ingredients != nil {\n\t\tres.Ingredients = marshalIngredientListResponseBodyToIngredientListView(v.Ingredients)\n\t}\n\n\treturn res\n}", "func (o *ProdutoVM) SetRefImagem(v int64) {\n\to.RefImagem.Set(&v)\n}", "func (s *scanner) ToImageRef(req harbor.ScanRequest) (string, error) {\n\tregistryURL, err := url.Parse(req.Registry.URL)\n\tif err != nil {\n\t\treturn \"\", xerrors.Errorf(\"parsing registry URL: %w\", err)\n\t}\n\treturn fmt.Sprintf(\"%s/%s@%s\", registryURL.Host, req.Artifact.Repository, req.Artifact.Digest), nil\n}", "func handler_image(w http.ResponseWriter, r *http.Request) {\n\tgetImage(w, num) // fetch the base64 encoded png image\n}", "func marshalInventoryviewsWarehouseViewToWarehouseResponseBody(v *inventoryviews.WarehouseView) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tCode: *v.Code,\n\t\tAddress: *v.Address,\n\t\tType: *v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func (o SignatureResponsePtrOutput) Image() ImageResponsePtrOutput {\n\treturn o.ApplyT(func(v *SignatureResponse) *ImageResponse {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Image\n\t}).(ImageResponsePtrOutput)\n}", "func (r *ImageRef) ObjectReference() corev1.ObjectReference {\n\tswitch {\n\tcase r.Stream != nil:\n\t\treturn corev1.ObjectReference{\n\t\t\tKind: \"ImageStreamTag\",\n\t\t\tName: imageutil.JoinImageStreamTag(r.Stream.Name, r.Reference.Tag),\n\t\t\tNamespace: r.Stream.Namespace,\n\t\t}\n\tcase r.AsImageStream:\n\t\tname, _ := r.SuggestName()\n\t\treturn corev1.ObjectReference{\n\t\t\tKind: \"ImageStreamTag\",\n\t\t\tName: imageutil.JoinImageStreamTag(name, r.InternalTag()),\n\t\t}\n\tdefault:\n\t\treturn corev1.ObjectReference{\n\t\t\tKind: \"DockerImage\",\n\t\t\tName: r.PullSpec(),\n\t\t}\n\t}\n}", "func (i *ImageReference) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"offer\":\n\t\t\terr = unpopulate(val, \"Offer\", &i.Offer)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"publisher\":\n\t\t\terr = unpopulate(val, \"Publisher\", &i.Publisher)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sku\":\n\t\t\terr = unpopulate(val, \"SKU\", &i.SKU)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"version\":\n\t\t\terr = unpopulate(val, \"Version\", &i.Version)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", i, err)\n\t\t}\n\t}\n\treturn nil\n}", "func marshalInventoryviewsProductViewToProductResponseBody(v *inventoryviews.ProductView) *ProductResponseBody {\n\tres := &ProductResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tUnit: *v.Unit,\n\t\tCostPrice: *v.CostPrice,\n\t\tMarketPrice: *v.MarketPrice,\n\t\tNote: *v.Note,\n\t\tImage: *v.Image,\n\t\tCode: *v.Code,\n\t\tSize: *v.Size,\n\t\tType: *v.Type,\n\t\tIsShelves: *v.IsShelves,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func imageHandler(formatter *render.Render) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\tsetupResponse(&w, req)\n\t\tparams := mux.Vars(req)\n\t\tvar imageId string = params[\"id\"]\n\t\tfmt.Println( \"Image ID: \", imageId )\n\t\tsession, err := mgo.Dial(mongodb_server)\n if err != nil {\n\t\t\tvar errorResponse ErrorResponse\n\t\t\terrorResponse.Message = \"Server Error\"\n\t\t\tformatter.JSON(w, http.StatusInternalServerError, errorResponse)\n\t\t\tpanic(err)\n\t\t\treturn\n }\n defer session.Close()\n session.SetMode(mgo.Monotonic, true)\n conn := session.DB(mongodb_database).C(mongodb_collection)\n\t\tvar result bson.M\n\t\tquery := bson.M{\"id\" : imageId}\n\t\terr = conn.Find(query).One(&result)\n if err != nil {\n\t\t\tlog.Print(err)\n\t\t\tvar errorResponse ErrorResponse\n\t\t\terrorResponse.Message = \"Image not found\"\n\t\t\tformatter.JSON(w, http.StatusBadRequest, errorResponse)\n } else {\n\t\t\tfmt.Println(\"Image data:\", result )\n\t\t\tvar image Image\n\t\t\tbsonBytes, _ := bson.Marshal(result)\n\t\t\tbson.Unmarshal(bsonBytes, &image)\n\t\t\tfmt.Println(\"Image :\", image )\n\t\t\tformatter.JSON(w, http.StatusOK, image)\n\t\t}\n\t}\n}", "func DecodeStorageImagesGetResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error) {\n\treturn func(resp *http.Response) (interface{}, error) {\n\t\tif restoreBody {\n\t\t\tb, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\tdefer func() {\n\t\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\t}()\n\t\t} else {\n\t\t\tdefer resp.Body.Close()\n\t\t}\n\t\tswitch resp.StatusCode {\n\t\tcase http.StatusOK:\n\t\t\tvar (\n\t\t\t\tbody *vm.Image\n\t\t\t\terr error\n\t\t\t)\n\t\t\terr = decoder(resp).Decode(&body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, goahttp.ErrDecodingError(\"spin-registry\", \"storage_images_get\", err)\n\t\t\t}\n\t\t\treturn body, nil\n\t\tdefault:\n\t\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\t\treturn nil, goahttp.ErrInvalidResponse(\"spin-registry\", \"storage_images_get\", resp.StatusCode, string(body))\n\t\t}\n\t}\n}", "func (r *ImageRef) ImageStream() (*imagev1.ImageStream, error) {\n\tif r.Stream != nil {\n\t\treturn r.Stream, nil\n\t}\n\n\tname, ok := r.SuggestName()\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unable to suggest an ImageStream name for %q\", r.Reference.String())\n\t}\n\n\tstream := &imagev1.ImageStream{\n\t\t// this is ok because we know exactly how we want to be serialized\n\t\tTypeMeta: metav1.TypeMeta{APIVersion: imagev1.SchemeGroupVersion.String(), Kind: \"ImageStream\"},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t},\n\t}\n\tif r.OutputImage {\n\t\treturn stream, nil\n\t}\n\n\t// Legacy path, talking to a server that cannot do granular import of exact image stream spec tags.\n\tif !r.TagDirectly {\n\t\t// Ignore AsResolvedImage here because we are attempting to get images from this location.\n\t\tstream.Spec.DockerImageRepository = r.Reference.AsRepository().String()\n\t\tif r.Insecure {\n\t\t\tstream.ObjectMeta.Annotations = map[string]string{\n\t\t\t\timagev1.InsecureRepositoryAnnotation: \"true\",\n\t\t\t}\n\t\t}\n\t\treturn stream, nil\n\t}\n\n\tif stream.Spec.Tags == nil {\n\t\tstream.Spec.Tags = []imagev1.TagReference{}\n\t}\n\n\tstream.Spec.Tags = append(stream.Spec.Tags, imagev1.TagReference{\n\t\tName: r.InternalTag(),\n\t\t// Make this a constant\n\t\tAnnotations: map[string]string{\"openshift.io/imported-from\": r.Reference.Exact()},\n\t\tFrom: &corev1.ObjectReference{\n\t\t\tKind: \"DockerImage\",\n\t\t\tName: r.PullSpec(),\n\t\t},\n\t\tImportPolicy: imagev1.TagImportPolicy{Insecure: r.Insecure, ImportMode: r.ImportMode},\n\t})\n\n\treturn stream, nil\n}", "func handleImageView(w http.ResponseWriter, r *http.Request) {\n\tuserEmail := getUserEmail(r)\n\tblobKey := r.FormValue(\"blobkey\")\n\tif blobKey == \"\" {\n\t\treturn\n\t}\n\timg, err := getImageRecord(getContext(r), blobKey)\n\tif err != nil {\n\t\tio.WriteString(w, \"image record not found\")\n\t\treturn\n\t}\n\ttmplData := map[string]string{\n\t\t\"name\": img.Name,\n\t\t\"blobKey\": img.BlobKey,\n\t\t\"email\": img.Email,\n\t\t\"timeUploaded\": img.TimeUploaded.Format(time.UnixDate),\n\t\t\"userEmail\": userEmail,\n\t\t\"loginURL\": \tgetLoginURL(r, \"/\"),\n\t\t\"logoutURL\": \tgetLogoutURL(r, \"\"),\n\t\t\"username\": \tgetUserEmail(r),\n\t}\n\trenderTemplate(w, \"image_view.html\", tmplData)\n}", "func (a *FrinxLoggingApiService) PutFrinxLoggingLoggingInterfacesInterfaceInterfaceRef(ctx context.Context, interfaceId string, frinxOpenconfigInterfacesInterfacerefInterfaceRefBodyParam FrinxOpenconfigInterfacesInterfacerefInterfaceRefRequest, nodeId string) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Put\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/config/network-topology:network-topology/network-topology:topology/unified/network-topology:node/{node-id}/yang-ext:mount/frinx-logging:logging/frinx-logging:interfaces/frinx-logging:interface/{interface-id}/frinx-logging:interface-ref/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"interface-id\"+\"}\", fmt.Sprintf(\"%v\", interfaceId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"node-id\"+\"}\", fmt.Sprintf(\"%v\", nodeId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/xml\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/xml\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &frinxOpenconfigInterfacesInterfacerefInterfaceRefBodyParam\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "func marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(v *discussionviews.ThreadedPostView) *ThreadedPostResponseBody {\n\tres := &ThreadedPostResponseBody{\n\t\tID: *v.ID,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tBody: *v.Body,\n\t\tBookmark: v.Bookmark,\n\t}\n\tif v.Author != nil {\n\t\tres.Author = marshalDiscussionviewsPostAuthorViewToPostAuthorResponseBody(v.Author)\n\t}\n\tif v.Replies != nil {\n\t\tres.Replies = make([]*ThreadedPostResponseBody, len(v.Replies))\n\t\tfor i, val := range v.Replies {\n\t\t\tres.Replies[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func (o LookupNoteResultOutput) BaseImage() BasisResponseOutput {\n\treturn o.ApplyT(func(v LookupNoteResult) BasisResponse { return v.BaseImage }).(BasisResponseOutput)\n}", "func marshalInventoryFounderToFounderResponseBody(v *inventory.Founder) *FounderResponseBody {\n\tres := &FounderResponseBody{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func (sr SearchResponse) AsImageObject() (*ImageObject, bool) {\n\treturn nil, false\n}", "func (e *Export) RebuildImage(squashLayer *Layer, outstream io.Writer, squashLayerFile *os.File) (imageID string, err error) {\n\tvar (\n\t\tlatestDirHeader, latestVersionHeader *tar.Header\n\t\tlatestJSONHeader, latestTarHeader *tar.Header\n\t\tretID string\n\t)\n\n\ttw := tarball.NewTarstream(outstream)\n\tsquashedLayerConfig := squashLayer.LayerConfig\n\tcurrent := e.Root()\n\n\tfor {\n\t\t// add \"<uuid>/\"\n\t\tvar dir *tar.Header\n\t\tdir, latestDirHeader = chooseDefault(current.DirHeader, latestDirHeader)\n\t\tdir.Name = current.LayerConfig.ID + \"/\"\n\t\tif err := tw.Add(&tarball.TarFile{Header: dir}); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\t// add \"<uuid>/VERSION\"\n\t\tvar version *tar.Header\n\t\tversion, latestVersionHeader = chooseDefault(current.VersionHeader, latestVersionHeader)\n\t\tversion.Name = current.LayerConfig.ID + \"/VERSION\"\n\t\tif err := tw.Add(&tarball.TarFile{Header: version, Stream: bytes.NewBuffer([]byte(\"1.0\"))}); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\t// add \"<uuid>/json\"\n\t\tvar jsonHdr *tar.Header\n\t\tvar jsonBytes []byte\n\t\tvar err error\n\t\tjsonHdr, latestJSONHeader = chooseDefault(current.JSONHeader, latestJSONHeader)\n\t\tjsonHdr.Name = current.LayerConfig.ID + \"/json\"\n\t\tif current.LayerConfig.ID == squashLayer.LayerConfig.ID {\n\t\t\tjsonBytes, err = json.Marshal(squashedLayerConfig)\n\t\t} else {\n\t\t\tjsonBytes, err = json.Marshal(current.LayerConfig)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tjsonHdr.Size = int64(len(jsonBytes))\n\t\tif err := tw.Add(&tarball.TarFile{Header: jsonHdr, Stream: bytes.NewBuffer(jsonBytes)}); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\t// add \"<uuid>/layer.tar\"\n\t\tvar layerTar *tar.Header\n\t\tlayerTar, latestTarHeader = chooseDefault(current.LayerTarHeader, latestTarHeader)\n\t\tlayerTar.Name = current.LayerConfig.ID + \"/layer.tar\"\n\t\tif current.LayerConfig.ID == squashLayer.LayerConfig.ID {\n\t\t\tfi, err := squashLayerFile.Stat()\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\tlayerTar.Size = fi.Size()\n\t\t\tif err := tw.Add(&tarball.TarFile{Header: layerTar, Stream: squashLayerFile}); err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t} else {\n\t\t\tlayerTar.Size = 1024\n\t\t\tif err := tw.Add(\n\t\t\t\t&tarball.TarFile{Header: layerTar, Stream: bytes.NewBuffer(bytes.Repeat([]byte(\"\\x00\"), 1024))},\n\t\t\t); err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\n\t\t// check loop condition\n\t\tchild := e.ChildOf(current.LayerConfig.ID)\n\t\tif child == nil {\n\t\t\t// return the ID of the last layer - it will be the image ID used by the daemon\n\t\t\tretID = current.LayerConfig.ID\n\t\t\tbreak\n\t\t}\n\t\tcurrent = child\n\t}\n\t// close tar writer before returning\n\tif err := tw.Close(); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn retID, nil\n}", "func unmarshalFounderResponseBodyToWarehouseviewsFounderView(v *FounderResponseBody) *warehouseviews.FounderView {\n\tres := &warehouseviews.FounderView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func (o *ProdutoVM) GetRefImagem() int64 {\n\tif o == nil || o.RefImagem.Get() == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.RefImagem.Get()\n}", "func ValueHTTPResponseBody(ctx context.Context) interface{} {\n\treturn ctx.Value(contextHTTPResponseBodyFields)\n}", "func imageLinkForJson(b []byte) string {\n\t// Very hacky. I cba to do the whole danbooru API, so we're just throwing this in as an unstructured JSON object.\n\tif b[0] == '[' {\n\t\t// xtreme hack: unlistify it. Makes the rest a little easier.\n\t\t// We assume it's a singleton list.\n\t\tb[0] = ' '\n\t\tb[len(b)-1] = ' '\n\t}\n\tvar obj interface{}\n\terr := json.Unmarshal(b, &obj)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\tobjmap := obj.(map[string]interface{})\n\tfileurl := objmap[\"file_url\"]\n\tif fileurl == nil {\n\t\treturn \"Malformed json data (nothing for file_url found)\"\n\t}\n\tswitch fut := fileurl.(type) {\n\tcase string:\n\t\tif strings.HasPrefix(fut, \"http\") {\n\t\t\treturn strings.Replace(strings.Replace(fut, \"https//\", \"https://\", 1), \"http//\", \"http://\", 1)\n\t\t} else {\n\t\t\treturn \"https://danbooru.donmai.us\" + fut\n\t\t}\n\tdefault:\n\t\treturn \"Malformed json data (wrong type for file_url; was expecting string)\"\n\t}\n}", "func (x *FzImage) Ref() *C.fz_image {\n\tif x == nil {\n\t\treturn nil\n\t}\n\treturn (*C.fz_image)(unsafe.Pointer(x))\n}", "func (ioVar ImageObject) MarshalJSON() ([]byte, error) {\n\tioVar.Type = TypeImageObject\n\tobjectMap := make(map[string]interface{})\n\tif ioVar.Thumbnail != nil {\n\t\tobjectMap[\"thumbnail\"] = ioVar.Thumbnail\n\t}\n\tif ioVar.ContentURL != nil {\n\t\tobjectMap[\"contentUrl\"] = ioVar.ContentURL\n\t}\n\tif ioVar.HostPageURL != nil {\n\t\tobjectMap[\"hostPageUrl\"] = ioVar.HostPageURL\n\t}\n\tif ioVar.Width != nil {\n\t\tobjectMap[\"width\"] = ioVar.Width\n\t}\n\tif ioVar.Height != nil {\n\t\tobjectMap[\"height\"] = ioVar.Height\n\t}\n\tif ioVar.ThumbnailURL != nil {\n\t\tobjectMap[\"thumbnailUrl\"] = ioVar.ThumbnailURL\n\t}\n\tif ioVar.Provider != nil {\n\t\tobjectMap[\"provider\"] = ioVar.Provider\n\t}\n\tif ioVar.Text != nil {\n\t\tobjectMap[\"text\"] = ioVar.Text\n\t}\n\tif ioVar.Name != nil {\n\t\tobjectMap[\"name\"] = ioVar.Name\n\t}\n\tif ioVar.URL != nil {\n\t\tobjectMap[\"url\"] = ioVar.URL\n\t}\n\tif ioVar.Image != nil {\n\t\tobjectMap[\"image\"] = ioVar.Image\n\t}\n\tif ioVar.Description != nil {\n\t\tobjectMap[\"description\"] = ioVar.Description\n\t}\n\tif ioVar.EntityPresentationInfo != nil {\n\t\tobjectMap[\"entityPresentationInfo\"] = ioVar.EntityPresentationInfo\n\t}\n\tif ioVar.BingID != nil {\n\t\tobjectMap[\"bingId\"] = ioVar.BingID\n\t}\n\tif ioVar.ContractualRules != nil {\n\t\tobjectMap[\"contractualRules\"] = ioVar.ContractualRules\n\t}\n\tif ioVar.WebSearchURL != nil {\n\t\tobjectMap[\"webSearchUrl\"] = ioVar.WebSearchURL\n\t}\n\tif ioVar.ID != nil {\n\t\tobjectMap[\"id\"] = ioVar.ID\n\t}\n\tif ioVar.Type != \"\" {\n\t\tobjectMap[\"_type\"] = ioVar.Type\n\t}\n\treturn json.Marshal(objectMap)\n}", "func (rb ResponseBase) AsImageObject() (*ImageObject, bool) {\n\treturn nil, false\n}", "func (r Response) AsImageObject() (*ImageObject, bool) {\n\treturn nil, false\n}", "func (o LookupOccurrenceResultOutput) DerivedImage() DerivedResponseOutput {\n\treturn o.ApplyT(func(v LookupOccurrenceResult) DerivedResponse { return v.DerivedImage }).(DerivedResponseOutput)\n}", "func (w *ServerInterfaceWrapper) ComposeImage(ctx echo.Context) error {\n\tvar err error\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.ComposeImage(ctx)\n\treturn err\n}", "func (canvas *Canvas) DrawImageReference(ref Reference, rect Rectangle) {\n\tname := canvas.nextImageName()\n\tcanvas.page.Resources.XObject[name] = ref\n\n\tcanvas.Push()\n\tcanvas.Transform(float32(rect.Dx()), 0, 0, float32(rect.Dy()), float32(rect.Min.X), float32(rect.Min.Y))\n\twriteCommand(canvas.contents, \"Do\", name)\n\tcanvas.Pop()\n}", "func (r ImageWrapper) MarshalJSON() ([]byte, error) {\n\tvar doc bytes.Buffer\n\n\tif r.Image == nil {\n\t\treturn []byte(\"\\\"\\\"\"), nil\n\t}\n\n\terr := json.NewEncoder(&doc).Encode(r.Image)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn doc.Bytes(), nil\n}", "func (o ApplicationStatusOperationStateSyncResultSourceKustomizeOutput) Images() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ApplicationStatusOperationStateSyncResultSourceKustomize) []string { return v.Images }).(pulumi.StringArrayOutput)\n}", "func (d *archiveImageDestination) Reference() types.ImageReference {\n\treturn d.ref\n}", "func (o ApplicationStatusOperationStateOperationSyncSourceKustomizeOutput) Images() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ApplicationStatusOperationStateOperationSyncSourceKustomize) []string { return v.Images }).(pulumi.StringArrayOutput)\n}", "func (r *ImageWrapper) UnmarshalJSON(data []byte) error {\n\tif data == nil {\n\t\tr = &ImageWrapper{}\n\n\t\treturn nil\n\t}\n\n\tif data != nil && len(data) == 2 && data[0] == '\"' && data[1] == '\"' {\n\t\tr = &ImageWrapper{}\n\n\t\treturn nil\n\t}\n\n\tr.Image = &Image{}\n\n\terr := json.NewDecoder(bytes.NewReader(data)).Decode(r.Image)\n\n\treturn err\n}", "func (d *dockerImageDestination) Reference() types.ImageReference {\n\treturn d.ref\n}", "func (r *ImageRef) Cast(format BandFormat) error {\n\tout, err := vipsCast(r.image, format)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.setImage(out)\n\treturn nil\n}", "func marshalIngredientListResponseBodyToIngredientListView(v *IngredientListResponseBody) *recipeviews.IngredientListView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &recipeviews.IngredientListView{}\n\tif v.Ingredients != nil {\n\t\tres.Ingredients = make([]*recipeviews.IngredientView, len(v.Ingredients))\n\t\tfor j, val := range v.Ingredients {\n\t\t\tres.Ingredients[j] = &recipeviews.IngredientView{\n\t\t\t\tQuantity: val.Quantity,\n\t\t\t}\n\t\t\tif val.Recipe != nil {\n\t\t\t\tres.Ingredients[j].Recipe = marshalRxRecipeResponseBodyToRxRecipeView(val.Recipe)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}", "func GetResponseImages(albumID string, clientID string) (imageLink string) { // removed: (imageLink interface{})\n\n\t// This hash is the albumID hash\n\turl := \"https://api.imgur.com/3/album/\" + albumID + \"/images.json\"\n\tmethod := \"GET\"\n\n\tpayload := &bytes.Buffer{}\n\twriter := multipart.NewWriter(payload)\n\terr := writer.Close()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(method, url, payload)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\treq.Header.Add(\"Authorization\", \"Client-ID \"+clientID)\n\n\treq.Header.Set(\"Content-Type\", writer.FormDataContentType())\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\tfmt.Println(\"[-] Error connecting:\", err)\n\t}\n\tdefer res.Body.Close()\n\tbody, err := ioutil.ReadAll(res.Body)\n\n\tvar results AlbumImages\n\terrr := json.Unmarshal([]byte(body), &results)\n\tif errr != nil {\n\t\tfmt.Println(\"[!] Error unmarshalling::\", errr)\n\t}\n\n\tdatavalues := results.Data\n\tif results.Success == true {\n\t\tfor field := range datavalues {\n\t\t\tif strings.Contains(datavalues[field].Description, \"response\") {\n\n\t\t\t\tfmt.Println(\"[+] ImageID:\", datavalues[field].ID)\n\t\t\t\tfmt.Println(\"[+] ImageTitle:\", datavalues[field].Title)\n\t\t\t\tfmt.Println(\"[+] Description:\", datavalues[field].Description)\n\t\t\t\tfmt.Println(\"[+] ImageLink:\", datavalues[field].Link)\n\t\t\t\tfmt.Println(\" \")\n\n\t\t\t\tresponseURL = datavalues[field].Link\n\t\t\t}\n\n\t\t\t//\tfmt.Println(\"[+] Logic worked and got a response from a client: \", datavalues[field].Link)\n\t\t}\n\n\t}\n\treturn responseURL\n}", "func marshalDiscussionThreadedPostToThreadedPostResponseBody(v *discussion.ThreadedPost) *ThreadedPostResponseBody {\n\tres := &ThreadedPostResponseBody{\n\t\tID: v.ID,\n\t\tCreatedAt: v.CreatedAt,\n\t\tUpdatedAt: v.UpdatedAt,\n\t\tBody: v.Body,\n\t\tBookmark: v.Bookmark,\n\t}\n\tif v.Author != nil {\n\t\tres.Author = marshalDiscussionPostAuthorToPostAuthorResponseBody(v.Author)\n\t}\n\tif v.Replies != nil {\n\t\tres.Replies = make([]*ThreadedPostResponseBody, len(v.Replies))\n\t\tfor i, val := range v.Replies {\n\t\t\tres.Replies[i] = marshalDiscussionThreadedPostToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func (o ApplicationStatusHistorySourceKustomizeOutput) Images() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ApplicationStatusHistorySourceKustomize) []string { return v.Images }).(pulumi.StringArrayOutput)\n}", "func (m ExportImageViaObjectStorageURIDetails) MarshalJSON() ([]byte, error) {\n\tvar data struct {\n\t\tDestinationType string `json:\"destinationType\"`\n\n\t\t// The Object Storage Service URL to export the image to. See [Object Storage URLs](/Content/Compute/Tasks/imageimportexport.htm#URLs)\n\t\t// and [pre-authenticated requests](/Content/Object/Tasks/managingaccess.htm#pre-auth) for constructing URLs for image import/export.\n\t\t//\n\t\t// Required: true\n\t\tDestinationURI *string `json:\"destinationUri\"`\n\t}\n\n\tdata.DestinationURI = m.DestinationURI\n\tdata.DestinationType = DiscriminatorTypeValues[\"ExportImageViaObjectStorageUriDetails\"]\n\treturn json.Marshal(data)\n}", "func GetImage(w http.ResponseWriter, r *http.Request) {\n\n\t//Response Parameter\n\tvars := mux.Vars(r)\n\timageID := vars[\"imageID\"]\n\n\t//Get Data and make Response\n\timage, mimeType, err := model.GetImage(imageID)\n\tif err != nil {\n\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tw.Write([]byte(err.Error()))\n\t\treturn\n\n\t}\n\n\t//Write Response\n\tw.Header().Set(\"Content-Type\", mimeType)\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(image)\n\n}", "func (o ApplicationStatusSyncComparedToSourceKustomizeOutput) Images() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ApplicationStatusSyncComparedToSourceKustomize) []string { return v.Images }).(pulumi.StringArrayOutput)\n}", "func apiImagesHandler(w http.ResponseWriter, r *http.Request, params map[string]string) {\n\tuserName := sessionHandler.GetUserName(r)\n\tif userName != \"\" {\n\t\tnumber := params[\"number\"]\n\t\tpage, err := strconv.Atoi(number)\n\t\tif err != nil || page < 1 {\n\t\t\thttp.Error(w, \"Not a valid api function!\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\timages := make([]string, 0)\n\t\t// Walk all files in images folder\n\t\terr = filepath.Walk(filenames.ImagesFilepath, func(filePath string, info os.FileInfo, err error) error {\n\t\t\tif !info.IsDir() && (strings.EqualFold(filepath.Ext(filePath), \".jpg\") || strings.EqualFold(filepath.Ext(filePath), \".jpeg\") || strings.EqualFold(filepath.Ext(filePath), \".gif\") || strings.EqualFold(filepath.Ext(filePath), \".png\") || strings.EqualFold(filepath.Ext(filePath), \".svg\")) {\n\t\t\t\t// Rewrite to file path on server\n\t\t\t\tfilePath = strings.Replace(filePath, filenames.ImagesFilepath, \"/images\", 1)\n\t\t\t\t// Make sure to always use \"/\" as path separator (to make a valid url that we can use on the blog)\n\t\t\t\tfilePath = filepath.ToSlash(filePath)\n\t\t\t\t// Prepend file to slice (thus reversing the order)\n\t\t\t\timages = append([]string{filePath}, images...)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif len(images) == 0 {\n\t\t\t// Write empty json array\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.Write([]byte(\"[]\"))\n\t\t\treturn\n\t\t}\n\t\timagesPerPage := 15\n\t\tstart := (page * imagesPerPage) - imagesPerPage\n\t\tend := page * imagesPerPage\n\t\tif start > (len(images) - 1) {\n\t\t\t// Write empty json array\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.Write([]byte(\"[]\"))\n\t\t\treturn\n\t\t}\n\t\tif end > len(images) {\n\t\t\tend = len(images)\n\t\t}\n\t\tjson, err := json.Marshal(images[start:end])\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tw.Write(json)\n\t\treturn\n\t}\n\thttp.Error(w, \"Not logged in!\", http.StatusInternalServerError)\n}", "func (o ApplicationStatusOperationStateSyncResultSourceKustomizePtrOutput) Images() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ApplicationStatusOperationStateSyncResultSourceKustomize) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Images\n\t}).(pulumi.StringArrayOutput)\n}", "func CreateUpdateAppInstanceGroupImageResponse() (response *UpdateAppInstanceGroupImageResponse) {\n\tresponse = &UpdateAppInstanceGroupImageResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func imageHandler(w http.ResponseWriter, r *http.Request) {\n\tdata, ok := images[strings.TrimPrefix(r.URL.Path, \"/image/\")]\n\tif !ok {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\tif err := imageTemplate.Execute(w, data); err != nil {\n\t\tlog.Println(err)\n\t}\n}", "func (client ListManagementImageClient) AddImageResponder(resp *http.Response) (result Image, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func (object Object) Image(value interface{}) Object {\n\treturn object.Property(as.PropertyImage, value)\n}", "func (o InstanceOutput) VmImage() VmImageResponseOutput {\n\treturn o.ApplyT(func(v *Instance) VmImageResponseOutput { return v.VmImage }).(VmImageResponseOutput)\n}", "func (app *application) extractImageInfo(imageInfo string) (*data.Image, error) {\n\timage := data.Image{}\n\terr := json.Unmarshal([]byte(imageInfo), &image)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &image, nil\n}", "func unmarshalComponentResponseBodyToStorageviewsComponentView(v *ComponentResponseBody) *storageviews.ComponentView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &storageviews.ComponentView{\n\t\tVarietal: v.Varietal,\n\t\tPercentage: v.Percentage,\n\t}\n\n\treturn res\n}", "func flattenImage(c *Client, i interface{}) *Image {\n\tm, ok := i.(map[string]interface{})\n\tif !ok {\n\t\treturn nil\n\t}\n\tif len(m) == 0 {\n\t\treturn nil\n\t}\n\n\tr := &Image{}\n\tr.ArchiveSizeBytes = dcl.FlattenInteger(m[\"archiveSizeBytes\"])\n\tr.Description = dcl.FlattenString(m[\"description\"])\n\tr.DiskSizeGb = dcl.FlattenInteger(m[\"diskSizeGb\"])\n\tr.Family = dcl.FlattenString(m[\"family\"])\n\tr.GuestOsFeature = flattenImageGuestOsFeatureSlice(c, m[\"guestOsFeatures\"])\n\tr.ImageEncryptionKey = flattenImageImageEncryptionKey(c, m[\"imageEncryptionKey\"])\n\tr.Labels = dcl.FlattenKeyValuePairs(m[\"labels\"])\n\tr.License = dcl.FlattenStringSlice(m[\"licenses\"])\n\tr.Name = dcl.FlattenString(m[\"name\"])\n\tr.RawDisk = flattenImageRawDisk(c, m[\"rawDisk\"])\n\tr.ShieldedInstanceInitialState = flattenImageShieldedInstanceInitialState(c, m[\"shieldedInstanceInitialState\"])\n\tr.SelfLink = dcl.FlattenString(m[\"selfLink\"])\n\tr.SourceDisk = dcl.FlattenString(m[\"sourceDisk\"])\n\tr.SourceDiskEncryptionKey = flattenImageSourceDiskEncryptionKey(c, m[\"sourceDiskEncryptionKey\"])\n\tr.SourceDiskId = dcl.FlattenString(m[\"sourceDiskId\"])\n\tr.SourceImage = dcl.FlattenString(m[\"sourceImage\"])\n\tr.SourceImageEncryptionKey = flattenImageSourceImageEncryptionKey(c, m[\"sourceImageEncryptionKey\"])\n\tr.SourceImageId = dcl.FlattenString(m[\"sourceImageId\"])\n\tr.SourceSnapshot = dcl.FlattenString(m[\"sourceSnapshot\"])\n\tr.SourceSnapshotEncryptionKey = flattenImageSourceSnapshotEncryptionKey(c, m[\"sourceSnapshotEncryptionKey\"])\n\tr.SourceSnapshotId = dcl.FlattenString(m[\"sourceSnapshotId\"])\n\tr.SourceType = flattenImageSourceTypeEnum(m[\"sourceType\"])\n\tr.Status = flattenImageStatusEnum(m[\"status\"])\n\tr.StorageLocation = dcl.FlattenStringSlice(m[\"storageLocations\"])\n\tr.Deprecated = flattenImageDeprecated(c, m[\"deprecated\"])\n\tr.Project = dcl.FlattenString(m[\"project\"])\n\n\treturn r\n}", "func LookupMyImage(connConfig string, myImageId string) (SpiderMyImageInfo, error) {\n\n\tif connConfig == \"\" {\n\t\terr := fmt.Errorf(\"LookupMyImage() called with empty connConfig.\")\n\t\tcommon.CBLog.Error(err)\n\t\treturn SpiderMyImageInfo{}, err\n\t} else if myImageId == \"\" {\n\t\terr := fmt.Errorf(\"LookupMyImage() called with empty myImageId.\")\n\t\tcommon.CBLog.Error(err)\n\t\treturn SpiderMyImageInfo{}, err\n\t}\n\n\turl := common.SpiderRestUrl + \"/myimage/\" + url.QueryEscape(myImageId)\n\n\t// Create Req body\n\ttempReq := common.SpiderConnectionName{}\n\ttempReq.ConnectionName = connConfig\n\n\tclient := resty.New().SetCloseConnection(true)\n\tclient.SetAllowGetMethodPayload(true)\n\n\tresp, err := client.R().\n\t\tSetHeader(\"Content-Type\", \"application/json\").\n\t\tSetBody(tempReq).\n\t\tSetResult(&SpiderMyImageInfo{}). // or SetResult(AuthSuccess{}).\n\t\t//SetError(&AuthError{}). // or SetError(AuthError{}).\n\t\tGet(url)\n\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\terr := fmt.Errorf(\"an error occurred while requesting to CB-Spider\")\n\t\treturn SpiderMyImageInfo{}, err\n\t}\n\n\tfmt.Println(string(resp.Body()))\n\n\tfmt.Println(\"HTTP Status code: \" + strconv.Itoa(resp.StatusCode()))\n\tswitch {\n\tcase resp.StatusCode() >= 400 || resp.StatusCode() < 200:\n\t\terr := fmt.Errorf(string(resp.Body()))\n\t\tcommon.CBLog.Error(err)\n\t\treturn SpiderMyImageInfo{}, err\n\t}\n\n\ttemp := resp.Result().(*SpiderMyImageInfo)\n\treturn *temp, nil\n\n}", "func (ref ostreeReference) NewImage(ctx context.Context, sys *types.SystemContext) (types.ImageCloser, error) {\n\treturn image.FromReference(ctx, sys, ref)\n}", "func Image(id, ref string) imageapi.Image {\n\treturn AgedImage(id, ref, 120)\n}", "func analyzeImage(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tparams := mux.Vars(r)\n\tvar img ImageBody\n\terr := json.NewDecoder(r.Body).Decode(&img)\n\tif err != nil {\n\t\tfmt.Println(\"ERROR\")\n\t}\n\tjsonMap := put.AnalyzeImage(params[\"id\"], img.DownloadURL)\n\tfmt.Println(jsonMap)\n\tfmt.Println()\n\tjson.NewEncoder(w).Encode(jsonMap)\n}", "func (o ApplicationStatusSyncComparedToSourceKustomizePtrOutput) Images() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ApplicationStatusSyncComparedToSourceKustomize) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Images\n\t}).(pulumi.StringArrayOutput)\n}" ]
[ "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.48563898", "0.48081356", "0.48044533", "0.48041937", "0.479127", "0.47545794", "0.46467045", "0.46467045", "0.4629495", "0.4621788", "0.46135008", "0.46113676", "0.46113676", "0.4593208", "0.45774534", "0.45769334", "0.4545808", "0.45256877", "0.45232967", "0.45126963", "0.44827554", "0.44601965", "0.445292", "0.44106779", "0.43983328", "0.43920702", "0.43588924", "0.4353089", "0.4353089", "0.43311393", "0.43225414", "0.4249457", "0.42318374", "0.42254102", "0.4203975", "0.420044", "0.4196108", "0.4175593", "0.4174679", "0.41664788", "0.41574487", "0.4135961", "0.41251612", "0.4104268", "0.41034904", "0.40984628", "0.40830052", "0.40799743", "0.40731832", "0.40680116", "0.40621257", "0.4058431", "0.40414792", "0.4035197", "0.40336582", "0.40098667", "0.40010223", "0.39947006", "0.39929375", "0.39912724", "0.39759755", "0.39740416", "0.39735365", "0.397238", "0.39619273", "0.39559656", "0.39534873", "0.39488825", "0.39435956", "0.39385396", "0.39382267", "0.39381313", "0.39324096", "0.39307833", "0.39185327", "0.39141038", "0.39135972", "0.39034745", "0.38970453" ]
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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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))\n\t\tfor i, val := range v.Precise {\n\t\t\tres.Precise[i] = val\n\t\t}\n\t}\n\tif v.Regions != nil {\n\t\tres.Regions = make([]*StationRegionResponseBody, len(v.Regions))\n\t\tfor i, val := range v.Regions {\n\t\t\tres.Regions[i] = marshalStationviewsStationRegionViewToStationRegionResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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 marshalStationviewsImageRefViewToImageRefResponseBody(v *stationviews.ImageRefView) *ImageRefResponseBody {\n\tres := &ImageRefResponseBody{\n\t\tURL: *v.URL,\n\t}\n\n\treturn res\n}", "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\tfor i, val := range v.Shape {\n\t\t\tres.Shape[i] = make([][]float64, len(val))\n\t\t\tfor j, val := range val {\n\t\t\t\tres.Shape[i][j] = make([]float64, len(val))\n\t\t\t\tfor k, val := range val {\n\t\t\t\t\tres.Shape[i][j][k] = val\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}", "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 = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Reading != nil {\n\t\tres.Reading = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationJobViewToStationJobResponseBody(v *stationviews.StationJobView) *StationJobResponseBody {\n\tres := &StationJobResponseBody{\n\t\tTitle: *v.Title,\n\t\tStartedAt: *v.StartedAt,\n\t\tCompletedAt: v.CompletedAt,\n\t\tProgress: *v.Progress,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v *stationviews.StationDataSummaryView) *StationDataSummaryResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &StationDataSummaryResponseBody{\n\t\tStart: *v.Start,\n\t\tEnd: *v.End,\n\t\tNumberOfSamples: *v.NumberOfSamples,\n\t}\n\n\treturn res\n}", "func marshalStationviewsEssentialStationViewToEssentialStationResponseBody(v *stationviews.EssentialStationView) *EssentialStationResponseBody {\n\tres := &EssentialStationResponseBody{\n\t\tID: *v.ID,\n\t\tDeviceID: *v.DeviceID,\n\t\tName: *v.Name,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tLastIngestionAt: v.LastIngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t\tFullKey: *v.FullKey,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdated: *v.Updated,\n\t\tLocationName: v.LocationName,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Images != nil {\n\t\tres.Images = make([]*ImageRefResponseBody, len(v.Images))\n\t\tfor i, val := range v.Images {\n\t\t\tres.Images[i] = marshalStationviewsImageRefViewToImageRefResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tLocationName: v.LocationName,\n\t\tPlaceNameOther: v.PlaceNameOther,\n\t\tPlaceNameNative: v.PlaceNameNative,\n\t\tSyncedAt: v.SyncedAt,\n\t\tIngestionAt: v.IngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\tif v.Data != nil {\n\t\tres.Data = marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v.Data)\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalDiscussionviewsAuthorPhotoViewToAuthorPhotoResponseBody(v *discussionviews.AuthorPhotoView) *AuthorPhotoResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &AuthorPhotoResponseBody{\n\t\tURL: *v.URL,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalMatchesviewsRatingViewToRatingResponseBody(v *matchesviews.RatingView) *RatingResponseBody {\n\tres := &RatingResponseBody{\n\t\tStrength: *v.Strength,\n\t\tLower: *v.Lower,\n\t\tUpper: *v.Upper,\n\t}\n\n\treturn res\n}", "func NewPhotoHandler(\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.Handler {\n\tvar (\n\t\tdecodeRequest = DecodePhotoRequest(mux, decoder)\n\t\tencodeResponse = EncodePhotoResponse(encoder)\n\t\tencodeError = EncodePhotoError(encoder, formatter)\n\t)\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := context.WithValue(r.Context(), goahttp.AcceptTypeKey, r.Header.Get(\"Accept\"))\n\t\tctx = context.WithValue(ctx, goa.MethodKey, \"photo\")\n\t\tctx = context.WithValue(ctx, goa.ServiceKey, \"station\")\n\t\tpayload, err := decodeRequest(r)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tres, err := endpoint(ctx, payload)\n\t\tif err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\to := res.(*station.PhotoResponseData)\n\t\tdefer o.Body.Close()\n\t\tif err := encodeResponse(ctx, w, o.Result); err != nil {\n\t\t\terrhandler(ctx, w, err)\n\t\t\treturn\n\t\t}\n\t\tif _, err := io.Copy(w, o.Body); err != nil {\n\t\t\tif err := encodeError(ctx, w, err); err != nil {\n\t\t\t\terrhandler(ctx, w, err)\n\t\t\t}\n\t\t}\n\t})\n}", "func marshalInventoryviewsWarehouseViewToWarehouseResponseBody(v *inventoryviews.WarehouseView) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tCode: *v.Code,\n\t\tAddress: *v.Address,\n\t\tType: *v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func marshalDiscussionAuthorPhotoToAuthorPhotoResponseBody(v *discussion.AuthorPhoto) *AuthorPhotoResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &AuthorPhotoResponseBody{\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func EncodePhotoResponse(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.(*station.PhotoResult)\n\t\tval := res.Length\n\t\tlengths := strconv.FormatInt(val, 10)\n\t\tw.Header().Set(\"Content-Length\", lengths)\n\t\tw.Header().Set(\"Content-Type\", res.ContentType)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn nil\n\t}\n}", "func marshalMatchesviewsRatingResourceViewToRatingResourceResponseBody(v *matchesviews.RatingResourceView) *RatingResourceResponseBody {\n\tres := &RatingResourceResponseBody{\n\t\tRrn: *v.Rrn,\n\t}\n\tif v.Rating != nil {\n\t\tres.Rating = marshalMatchesviewsRatingViewToRatingResponseBody(v.Rating)\n\t}\n\n\treturn res\n}", "func marshalVironAPIViewToVironAPIResponseBody(v *vironviews.VironAPIView) *VironAPIResponseBody {\n\tres := &VironAPIResponseBody{\n\t\tMethod: *v.Method,\n\t\tPath: *v.Path,\n\t}\n\n\treturn res\n}", "func unmarshalWineryResponseBodyToStorageviewsWineryView(v *WineryResponseBody) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsProductViewToProductResponseBody(v *inventoryviews.ProductView) *ProductResponseBody {\n\tres := &ProductResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tUnit: *v.Unit,\n\t\tCostPrice: *v.CostPrice,\n\t\tMarketPrice: *v.MarketPrice,\n\t\tNote: *v.Note,\n\t\tImage: *v.Image,\n\t\tCode: *v.Code,\n\t\tSize: *v.Size,\n\t\tType: *v.Type,\n\t\tIsShelves: *v.IsShelves,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsFounderViewToFounderResponseBody(v *inventoryviews.FounderView) *FounderResponseBody {\n\tres := &FounderResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func GetPhotos(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tsiteName := vars[\"name\"]\n\n\tsite, _ := database.GetSiteByName(siteName)\n\tuser, _ := database.GetUserByID(utils.GetUserObjectID(r))\n\n\tif !utils.IsAuthorized(site, user) {\n\t\tutils.RespondWithJSON(w, http.StatusUnauthorized, \"unauthorized\", nil)\n\t\treturn\n\t}\n\n\tphotos, err := database.GetSitePhotos(site.ID)\n\tif err != nil {\n\t\tutils.RespondWithJSON(w, http.StatusInternalServerError, \"error\", nil)\n\t\treturn\n\t}\n\tutils.RespondWithJSON(w, http.StatusOK, \"success\", photos)\n\treturn\n}", "func marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(v *discussionviews.ThreadedPostView) *ThreadedPostResponseBody {\n\tres := &ThreadedPostResponseBody{\n\t\tID: *v.ID,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tBody: *v.Body,\n\t\tBookmark: v.Bookmark,\n\t}\n\tif v.Author != nil {\n\t\tres.Author = marshalDiscussionviewsPostAuthorViewToPostAuthorResponseBody(v.Author)\n\t}\n\tif v.Replies != nil {\n\t\tres.Replies = make([]*ThreadedPostResponseBody, len(v.Replies))\n\t\tfor i, val := range v.Replies {\n\t\t\tres.Replies[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func NewSigninResponseBody(res *securedviews.GoaJWTView) *SigninResponseBody {\n\tbody := &SigninResponseBody{\n\t\tAuthorization: *res.Authorization,\n\t}\n\treturn body\n}", "func GetPhotos() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tconn, err := middleware.ExtractSession(r)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), 500)\n\t\t\treturn\n\t\t}\n\t\tdao := model.PhotoDao{DB: conn}\n\t\tphotos, err := dao.Read()\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), 500)\n\t\t\treturn\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tjson.NewEncoder(w).Encode(photos)\n\t})\n}", "func (wc WebClient) Photos(user *User) error {\n\n\tconst (\n\t\tselPhotos = \"html body table.pagew tbody tr td.pagew div.pg-lst\"\n\t)\n\n\tphotosURL := NewEndpointBuilder(wc.Config.BaseURL).\n\t\tWithPath(fmt.Sprintf(\"/photo/%s\", user.Profile)).\n\t\tString()\n\n\tresponse, err := wc.client.Get(photosURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer response.Body.Close()\n\n\tif doc, err := goquery.NewDocumentFromReader(response.Body); err == nil {\n\t\tdoc.Find(selPhotos).SiblingsFiltered(\"script\").Each(func(i int, sel *goquery.Selection) {\n\t\t\traw := sel.Contents().Text()\n\t\t\tif strings.Contains(raw, \"PS=[\") {\n\t\t\t\traw = strings.Split(strings.Split(raw, \"PS=[\")[1], \"]\")[0]\n\t\t\t\tdata := strings.Split(strings.ReplaceAll(raw, \"'\", \"\"), \",\")\n\t\t\t\tuser.Photos = &data\n\t\t\t}\n\t\t})\n\t\treturn nil\n\t}\n\n\treturn err\n}", "func MountPhotoHandler(mux goahttp.Muxer, h http.Handler) {\n\tf, ok := handleStationOrigin(h).(http.HandlerFunc)\n\tif !ok {\n\t\tf = func(w http.ResponseWriter, r *http.Request) {\n\t\t\th.ServeHTTP(w, r)\n\t\t}\n\t}\n\tmux.Handle(\"GET\", \"/stations/{id}/photo\", f)\n}", "func marshalPostsPostOutputToPostOutputResponseBody(v *posts.PostOutput) *PostOutputResponseBody {\n\tres := &PostOutputResponseBody{\n\t\tID: v.ID,\n\t\tTitle: v.Title,\n\t\tDescription: v.Description,\n\t\tScreenImageURL: v.ScreenImageURL,\n\t}\n\n\treturn res\n}", "func GetPhotosHandler(c *gin.Context) {\n\tif !service.VerifyAPIRequest(c, c.Request.Header[\"Token\"]) {\n\t\treturn\n\t}\n\n\tphotos, err := MyStore.GetPhotos()\n\n\tif err == nil {\n\t\tc.Header(\"Access-Control-Allow-Origin\", \"*\")\n\t\tc.Header(\"Content-Type\", \"application/json\")\n\t\tc.JSON(http.StatusOK, photos)\n\t} else {\n\t\tpanic(err)\n\t}\n}", "func NewListResponseBody(res *stepviews.StoredListOfStepsView) *ListResponseBody {\n\tbody := &ListResponseBody{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Steps != nil {\n\t\tbody.Steps = make([]*StoredStepResponseBody, len(res.Steps))\n\t\tfor i, val := range res.Steps {\n\t\t\tbody.Steps[i] = marshalStepviewsStoredStepViewToStoredStepResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func (m *Group) SetPhotos(value []ProfilePhotoable)() {\n m.photos = value\n}", "func marshalIngredientListResponseBodyToIngredientListView(v *IngredientListResponseBody) *recipeviews.IngredientListView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &recipeviews.IngredientListView{}\n\tif v.Ingredients != nil {\n\t\tres.Ingredients = make([]*recipeviews.IngredientView, len(v.Ingredients))\n\t\tfor j, val := range v.Ingredients {\n\t\t\tres.Ingredients[j] = &recipeviews.IngredientView{\n\t\t\t\tQuantity: val.Quantity,\n\t\t\t}\n\t\t\tif val.Recipe != nil {\n\t\t\t\tres.Ingredients[j].Recipe = marshalRxRecipeResponseBodyToRxRecipeView(val.Recipe)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}", "func (m *User) SetPhotos(value []ProfilePhotoable)() {\n m.photos = value\n}", "func unmarshalComponentResponseBodyToStorageviewsComponentView(v *ComponentResponseBody) *storageviews.ComponentView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &storageviews.ComponentView{\n\t\tVarietal: v.Varietal,\n\t\tPercentage: v.Percentage,\n\t}\n\n\treturn res\n}", "func NewGetUserResponseBodyTiny(res *userviews.UserView) *GetUserResponseBodyTiny {\n\tbody := &GetUserResponseBodyTiny{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t}\n\treturn body\n}", "func NewAddResponseBodyTiny(res *stepviews.ResultStepView) *AddResponseBodyTiny {\n\tbody := &AddResponseBodyTiny{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Step != nil {\n\t\tbody.Step = marshalStepviewsStoredStepViewToStoredStepResponseBody(res.Step)\n\t}\n\treturn body\n}", "func marshalRxRecipeResponseBodyToRxRecipeView(v *RxRecipeResponseBody) *recipeviews.RxRecipeView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &recipeviews.RxRecipeView{\n\t\tID: v.ID,\n\t\tTitle: v.Title,\n\t\tDescription: v.Description,\n\t\tVersion: v.Version,\n\t\tFavorite: v.Favorite,\n\t\tRating: v.Rating,\n\t\tDifficulty: v.Difficulty,\n\t\tState: v.State,\n\t\tComplete: v.Complete,\n\t}\n\tif v.Ingredients != nil {\n\t\tres.Ingredients = marshalIngredientListResponseBodyToIngredientListView(v.Ingredients)\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsHeadViewToHeadResponseBody(v *inventoryviews.HeadView) *HeadResponseBody {\n\tres := &HeadResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func (b *PhotosGetByIDBuilder) Photos(v []string) *PhotosGetByIDBuilder {\n\tb.Params[\"photos\"] = v\n\treturn b\n}", "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(ctx, w)\n\t\tbody := NewDownloadPhotoResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func New(client *http.Client) (*Photos, error) {\n\tservice, err := internal.New(client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Photos{service}, nil\n}", "func (c *Client) SearchPhotos(ctx context.Context, queryParams QueryParams) (*PhotoSearchResult, error) {\n\tlink, err := buildURL(SearchPhotosEndpoint, queryParams)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// throw an error if search query parameter not in URL\n\tif _, ok := queryParams[\"query\"]; !ok {\n\t\treturn nil, ErrQueryNotInURL(link)\n\t}\n\tdata, err := c.getBodyBytes(ctx, link)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar res PhotoSearchResult\n\terr = parseJSON(data, &res)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &res, nil\n}", "func NewUpdateResponseBody(res *warehouseviews.WarehouseView) *UpdateResponseBody {\n\tbody := &UpdateResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func GetPhotosByMonthHandler(c *gin.Context) {\n\tif !service.VerifyAPIRequest(c, c.Request.Header[\"Token\"]) {\n\t\treturn\n\t}\n\n\toffset, err := strconv.Atoi(c.Param(\"offset\"))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := MyStore.GetPhotosByMonth(offset)\n\n\tif err == nil {\n\t\tc.Header(\"Access-Control-Allow-Origin\", \"*\")\n\t\tc.Header(\"Content-Type\", \"application/json\")\n\t\tc.JSON(http.StatusOK, result)\n\t} else {\n\t\tpanic(err)\n\t}\n}", "func NewGetResponseBody(res *warehouseviews.WarehouseView) *GetResponseBody {\n\tbody := &GetResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func unmarshalWineryResponseToStorageviewsWineryView(v *WineryResponse) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func EncodeNeatThingTodayResponse(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.(*neatthingviews.NeatThing)\n\t\tw.Header().Set(\"goa-view\", res.View)\n\t\tenc := encoder(ctx, w)\n\t\tvar body interface{}\n\t\tswitch res.View {\n\t\tcase \"default\", \"\":\n\t\t\tbody = NewNeatThingTodayResponseBody(res.Projected)\n\t\tcase \"full\":\n\t\t\tbody = NewNeatThingTodayResponseBodyFull(res.Projected)\n\t\tcase \"name\":\n\t\t\tbody = NewNeatThingTodayResponseBodyName(res.Projected)\n\t\tcase \"name+definition\":\n\t\t\tbody = NewNeatThingTodayResponseBodyNameDefinition(res.Projected)\n\t\tcase \"name+link\":\n\t\t\tbody = NewNeatThingTodayResponseBodyNameLink(res.Projected)\n\t\t}\n\t\tw.WriteHeader(http.StatusNoContent)\n\t\treturn enc.Encode(body)\n\t}\n}", "func NewSigninUnauthorizedResponseBody(res secured.Unauthorized) SigninUnauthorizedResponseBody {\n\tbody := SigninUnauthorizedResponseBody(res)\n\treturn body\n}", "func unmarshalAvatarResponseBodyToFollowingviewsAvatarView(v *AvatarResponseBody) *followingviews.AvatarView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &followingviews.AvatarView{\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func New(client *http.Client) (Photos, error) {\n\tservice, err := photoslibrary.New(client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &defaultPhotos{\n\t\tclient: client,\n\t\tservice: service,\n\t\tlog: log.New(os.Stderr, \"\", log.LstdFlags),\n\t}, nil\n}", "func NewProjectResponseBody(res *discussionviews.DiscussionView) *ProjectResponseBody {\n\tbody := &ProjectResponseBody{}\n\tif res.Posts != nil {\n\t\tbody.Posts = make([]*ThreadedPostResponseBody, len(res.Posts))\n\t\tfor i, val := range res.Posts {\n\t\t\tbody.Posts[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func NewDataResponseBody(res *discussionviews.DiscussionView) *DataResponseBody {\n\tbody := &DataResponseBody{}\n\tif res.Posts != nil {\n\t\tbody.Posts = make([]*ThreadedPostResponseBody, len(res.Posts))\n\t\tfor i, val := range res.Posts {\n\t\t\tbody.Posts[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func marshalDiscussionviewsPostAuthorViewToPostAuthorResponseBody(v *discussionviews.PostAuthorView) *PostAuthorResponseBody {\n\tres := &PostAuthorResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\tif v.Photo != nil {\n\t\tres.Photo = marshalDiscussionviewsAuthorPhotoViewToAuthorPhotoResponseBody(v.Photo)\n\t}\n\n\treturn res\n}", "func NewGetUserResponseBody(res *userviews.UserView) *GetUserResponseBody {\n\tbody := &GetUserResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tEmail: *res.Email,\n\t\tScore: res.Score,\n\t}\n\treturn body\n}", "func GetSitePhotos(id bson.ObjectId) ([]models.Photo, error) {\n\tvar photos []models.Photo\n\terr := DB.C(photosCollection).Find(bson.M{\n\t\t\"site_id\": id,\n\t}).All(&photos)\n\treturn photos, err\n}", "func unmarshalStoredBottleResponseToStorageviewsStoredBottleView(v *StoredBottleResponse) *storageviews.StoredBottleView {\n\tres := &storageviews.StoredBottleView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t\tVintage: v.Vintage,\n\t\tDescription: v.Description,\n\t\tRating: v.Rating,\n\t}\n\tres.Winery = unmarshalWineryResponseToStorageviewsWineryView(v.Winery)\n\tif v.Composition != nil {\n\t\tres.Composition = make([]*storageviews.ComponentView, len(v.Composition))\n\t\tfor i, val := range v.Composition {\n\t\t\tres.Composition[i] = unmarshalComponentResponseToStorageviewsComponentView(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func unmarshalTagResponseBodyToResourceviewsTagView(v *TagResponseBody) *resourceviews.TagView {\n\tres := &resourceviews.TagView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func NewPhotosSummary() *PhotosSummary {\n\tthis := PhotosSummary{}\n\treturn &this\n}", "func (us *UsersService) Photos(username string, queryParams client.QueryParams) ([]client.Photo, error) {\n\tctx := context.Background()\n\treturn us.client.GetUserPhotos(ctx, username, queryParams)\n}", "func GetMarsPhotos(date string, camera string) (*models.Photos, error) {\n\t// Create URL data\n\turlData := url.Values{}\n\turlData.Set(\"earth_date\", date)\n\tif camera != \"\" && camera != \"all\" {\n\t\turlData.Set(\"camera\", camera)\n\t}\n\turlData.Set(\"api_key\", config.Nasa.APIKey)\n\n\turl, _ := url.ParseRequestURI(config.Nasa.APIURL)\n\turl.Path = config.Nasa.MRPPath\n\turl.RawQuery = urlData.Encode()\n\tencodedUrl := fmt.Sprintf(\"%v\", url)\n\n\tfmt.Printf(\"URL: %v\\n\", encodedUrl)\n\n\t// Send a request to NASA API\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(\"GET\", encodedUrl, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\treq.Header.Add(\"Content-Length\", strconv.Itoa(len(urlData.Encode())))\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tjsonData, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Parse response from API\n\tphotos := &models.Photos{}\n\terr = json.Unmarshal(jsonData, photos)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Store in cache\n\terr = cache.SetMarsPhotos(date, camera, string(jsonData))\n\tif err != nil {\n\t\tlog.Printf(\"mars-rover-photos: failed to store in cache: %v\\n\", err)\n\t}\n\n\treturn photos, nil\n}", "func NewGPhotos(client *http.Client) *Client {\n\treturn &Client{client}\n}", "func (b *PhotosSaveBuilder) PhotosList(v string) *PhotosSaveBuilder {\n\tb.Params[\"photos_list\"] = v\n\treturn b\n}", "func unmarshalVersionsResponseBodyToResourceviewsVersionsView(v *VersionsResponseBody) *resourceviews.VersionsView {\n\tres := &resourceviews.VersionsView{}\n\tres.Latest = unmarshalResourceVersionDataResponseBodyToResourceviewsResourceVersionDataView(v.Latest)\n\tres.Versions = make([]*resourceviews.ResourceVersionDataView, len(v.Versions))\n\tfor i, val := range v.Versions {\n\t\tres.Versions[i] = unmarshalResourceVersionDataResponseBodyToResourceviewsResourceVersionDataView(val)\n\t}\n\n\treturn res\n}", "func marshalDiscussionThreadedPostToThreadedPostResponseBody(v *discussion.ThreadedPost) *ThreadedPostResponseBody {\n\tres := &ThreadedPostResponseBody{\n\t\tID: v.ID,\n\t\tCreatedAt: v.CreatedAt,\n\t\tUpdatedAt: v.UpdatedAt,\n\t\tBody: v.Body,\n\t\tBookmark: v.Bookmark,\n\t}\n\tif v.Author != nil {\n\t\tres.Author = marshalDiscussionPostAuthorToPostAuthorResponseBody(v.Author)\n\t}\n\tif v.Replies != nil {\n\t\tres.Replies = make([]*ThreadedPostResponseBody, len(v.Replies))\n\t\tfor i, val := range v.Replies {\n\t\t\tres.Replies[i] = marshalDiscussionThreadedPostToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func NewVironMenuResponseBody(res *vironviews.VironMenuView) *VironMenuResponseBody {\n\tbody := &VironMenuResponseBody{\n\t\tName: *res.Name,\n\t\tThumbnail: res.Thumbnail,\n\t\tColor: res.Color,\n\t\tTheme: res.Theme,\n\t}\n\tif res.Tags != nil {\n\t\tbody.Tags = make([]string, len(res.Tags))\n\t\tfor i, val := range res.Tags {\n\t\t\tbody.Tags[i] = val\n\t\t}\n\t}\n\tif res.Pages != nil {\n\t\tbody.Pages = make([]*VironPageResponseBody, len(res.Pages))\n\t\tfor i, val := range res.Pages {\n\t\t\tbody.Pages[i] = &VironPageResponseBody{\n\t\t\t\tID: *val.ID,\n\t\t\t\tName: *val.Name,\n\t\t\t\tSection: *val.Section,\n\t\t\t\tGroup: val.Group,\n\t\t\t}\n\t\t\tif val.Components != nil {\n\t\t\t\tbody.Pages[i].Components = make([]*VironComponentResponseBody, len(val.Components))\n\t\t\t\tfor j, val := range val.Components {\n\t\t\t\t\tbody.Pages[i].Components[j] = &VironComponentResponseBody{\n\t\t\t\t\t\tName: *val.Name,\n\t\t\t\t\t\tStyle: *val.Style,\n\t\t\t\t\t\tUnit: val.Unit,\n\t\t\t\t\t\tPagination: val.Pagination,\n\t\t\t\t\t\tPrimary: val.Primary,\n\t\t\t\t\t\tAutoRefreshSec: val.AutoRefreshSec,\n\t\t\t\t\t}\n\t\t\t\t\tif val.Actions != nil {\n\t\t\t\t\t\tbody.Pages[i].Components[j].Actions = make([]string, len(val.Actions))\n\t\t\t\t\t\tfor k, val := range val.Actions {\n\t\t\t\t\t\t\tbody.Pages[i].Components[j].Actions[k] = val\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif val.API != nil {\n\t\t\t\t\t\tbody.Pages[i].Components[j].API = marshalVironAPIViewToVironAPIResponseBody(val.API)\n\t\t\t\t\t}\n\t\t\t\t\tif val.TableLabels != nil {\n\t\t\t\t\t\tbody.Pages[i].Components[j].TableLabels = make([]string, len(val.TableLabels))\n\t\t\t\t\t\tfor k, val := range val.TableLabels {\n\t\t\t\t\t\t\tbody.Pages[i].Components[j].TableLabels[k] = val\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif val.Query != nil {\n\t\t\t\t\t\tbody.Pages[i].Components[j].Query = make([]*VironQueryResponseBody, len(val.Query))\n\t\t\t\t\t\tfor k, val := range val.Query {\n\t\t\t\t\t\t\tbody.Pages[i].Components[j].Query[k] = &VironQueryResponseBody{\n\t\t\t\t\t\t\t\tKey: *val.Key,\n\t\t\t\t\t\t\t\tType: *val.Type,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn body\n}", "func unmarshalSuccessResultResponseBodyToUserSuccessResult(v *SuccessResultResponseBody) *user.SuccessResult {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &user.SuccessResult{\n\t\tOK: *v.OK,\n\t}\n\n\treturn res\n}", "func (o *User) GetPhotosOk() ([]MicrosoftGraphProfilePhoto, bool) {\n\tif o == nil || o.Photos == nil {\n\t\tvar ret []MicrosoftGraphProfilePhoto\n\t\treturn ret, false\n\t}\n\treturn *o.Photos, true\n}", "func unmarshalFounderResponseBodyToWarehouseviewsFounderView(v *FounderResponseBody) *warehouseviews.FounderView {\n\tres := &warehouseviews.FounderView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func NewAddResponseBody(res *stepviews.ResultStepView) *AddResponseBody {\n\tbody := &AddResponseBody{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Step != nil {\n\t\tbody.Step = marshalStepviewsStoredStepViewToStoredStepResponseBody(res.Step)\n\t}\n\treturn body\n}", "func unmarshalCatalogResponseBodyToResourceviewsCatalogView(v *CatalogResponseBody) *resourceviews.CatalogView {\n\tres := &resourceviews.CatalogView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t\tType: v.Type,\n\t\tURL: v.URL,\n\t\tProvider: v.Provider,\n\t}\n\n\treturn res\n}", "func marshalChatterviewsChatSummaryViewToChatSummaryResponse(v *chatterviews.ChatSummaryView) *ChatSummaryResponse {\n\tres := &ChatSummaryResponse{\n\t\tMessage: *v.Message,\n\t\tLength: v.Length,\n\t\tSentAt: *v.SentAt,\n\t}\n\n\treturn res\n}", "func NewPhotoSite(config Config) *PhotoSite {\n\td := dropbox.New(dropbox.NewConfig(config.DropBoxAccessToken))\n\talbum := NewAlbum(config.PhotoFolder, d)\n\n\tpf := time.Second * 30\n\tif config.PollFreq > 0 {\n\t\tpf = config.PollFreq\n\t}\n\n\t// TODO(dan): Come up with a better way of loading and polling for changes.\n\t// This loads all the images, in order to get EXIF data, which has the side\n\t// effect of pre-warming teh cache.\n\tgo func() {\n\t\terr := album.Load()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\talbum.Monitor(pf)\n\t}()\n\n\treturn &PhotoSite{\n\t\t&jsonHandler{album},\n\t\t&photoHandler{album},\n\t\t&thumbnailHandler{album},\n\t\talbum,\n\t}\n}", "func NewAdminSigninResponseBody(res *adminviews.JeeekAdminSigninView) *AdminSigninResponseBody {\n\tbody := &AdminSigninResponseBody{\n\t\tToken: *res.Token,\n\t}\n\treturn body\n}", "func (d *domainClient) TakeResponseBodyForInterceptionAsStream(ctx context.Context, args *TakeResponseBodyForInterceptionAsStreamArgs) (reply *TakeResponseBodyForInterceptionAsStreamReply, err error) {\n\treply = new(TakeResponseBodyForInterceptionAsStreamReply)\n\tif args != nil {\n\t\terr = rpcc.Invoke(ctx, \"Network.takeResponseBodyForInterceptionAsStream\", args, reply, d.conn)\n\t} else {\n\t\terr = rpcc.Invoke(ctx, \"Network.takeResponseBodyForInterceptionAsStream\", nil, reply, d.conn)\n\t}\n\tif err != nil {\n\t\terr = &internal.OpError{Domain: \"Network\", Op: \"TakeResponseBodyForInterceptionAsStream\", Err: err}\n\t}\n\treturn\n}", "func NewListResponseBody(res *warehouse.ListResult) *ListResponseBody {\n\tbody := &ListResponseBody{\n\t\tNextCursor: res.NextCursor,\n\t\tTotal: res.Total,\n\t}\n\tif res.Items != nil {\n\t\tbody.Items = make([]*WarehouseResponseBody, len(res.Items))\n\t\tfor i, val := range res.Items {\n\t\t\tbody.Items[i] = marshalWarehouseWarehouseToWarehouseResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func PhotosToInterfaceSlice(photos ...*RawPhoto) []interface{} {\n\tvar interfaceSlice = make([]interface{}, len(photos))\n\tfor i, d := range photos {\n\t\tinterfaceSlice[i] = d\n\t}\n\treturn interfaceSlice\n}", "func ValidateStationSensorResponseBody(body *StationSensorResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.UnitOfMeasure == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"unit_of_measure\", \"body\"))\n\t}\n\tif body.Key == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"key\", \"body\"))\n\t}\n\tif body.Ranges == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"ranges\", \"body\"))\n\t}\n\tif body.Reading != nil {\n\t\tif err2 := ValidateSensorReadingResponseBody(body.Reading); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\tfor _, e := range body.Ranges {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateSensorRangeResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func marshalInventoryWarehouseToWarehouseResponseBody(v *inventory.Warehouse) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t\tCode: v.Code,\n\t\tAddress: v.Address,\n\t\tType: v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryFounderToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func decodepicture(json map[string]interface{}, p *Photo){\n\tphotos := json[\"photos\"].(map[string]interface{})\n\tmaxpages := int(photos[\"pages\"].(float64))\n\tif (photos[\"total\"] == \"0\"){\n\t\tfmt.Println(\"No photos found\")\n\t\treturn\n\t}\n\tphoto := photos[\"photo\"].([]interface{})[0].(map[string]interface{})\n\tfarmid := photo[\"farm\"]\n\tserverid := photo[\"server\"]\n\tphotoid := photo[\"id\"]\n\tphotosecret := photo[\"secret\"]\n\tuserid := photo[\"owner\"]\n\tlat, _ := strconv.ParseFloat(photo[\"latitude\"].(string), 64)\n\tlng, _ := strconv.ParseFloat(photo[\"longitude\"].(string), 64)\n\n\tphotourl := fmt.Sprintf(\"https://farm%.0f.staticflickr.com/%s/%s_%s_n.jpg\", farmid, serverid, photoid, photosecret)\n\n\tphotolink := fmt.Sprintf(\"https://www.flickr.com/photos/%s/%s\", userid, photoid)\n\t*p = Photo{Url: photourl, Link: photolink, Lat: lat, Lng: lng, Maxpages: maxpages}\n\n}", "func NewAdminGetUserResponseBodyTiny(res *adminviews.JeeekUserView) *AdminGetUserResponseBodyTiny {\n\tbody := &AdminGetUserResponseBodyTiny{\n\t\tUserID: *res.UserID,\n\t\tUserName: *res.UserName,\n\t\tEmailAddress: *res.EmailAddress,\n\t}\n\treturn body\n}", "func BuildPhotoPayload(stationPhotoID string, stationPhotoAuth string) (*station.PhotoPayload, error) {\n\tvar err error\n\tvar id int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(stationPhotoID, 10, 32)\n\t\tid = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for id, must be INT32\")\n\t\t}\n\t}\n\tvar auth string\n\t{\n\t\tauth = stationPhotoAuth\n\t}\n\tv := &station.PhotoPayload{}\n\tv.ID = id\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func GetPhotosByAlbumKeyHandler(w http.ResponseWriter, r *http.Request) {\n\tfuncTag := \"GetPhotosByAlbumKeyHandler\"\n\n\t// process request params\n\tmp, err := requester.GetRequestParams(r, nil, routeKeyAlbumID)\n\tif err != nil {\n\t\terr = apierr.Errorf(err, funcTag, \"process request params\")\n\t\tresponder.SendJSONError(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\t// get the photos\n\tps, err := photoDB.GetPhotosByAlbumKey(mp[routeKeyAlbumID])\n\tif err != nil {\n\t\terr = apierr.Errorf(err, funcTag, \"get photos by album key\")\n\t\tresponder.SendJSONError(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\t// give the photos their url from s3\n\t// TODO: have the client pass in a quality filter via query params (\"1024\" below)\n\tfor _, p := range ps {\n\t\trelativePath := fmt.Sprintf(\"%s/%s\", \"1024\", p.Src)\n\t\tp.Src = aws.S3PublicAssetURL(relativePath)\n\t}\n\n\t// build the return data\n\tres := &GetPhotosResponse{}\n\tres.Photos = ps\n\n\t// return\n\tresponder.SendJSON(w, res)\n}", "func getAllPhotos(flickrOAuth FlickrOAuth, apiName string, setId string) map[string]Photo {\n\n\tvar err error\n\tvar body []byte\n\tphotos := map[string]Photo{}\n\tcurrentPage := 1\n\tpageSize := 500\n\n\tfor {\n\n\t\textras := map[string]string{\"page\": strconv.Itoa(currentPage)}\n\t\textras[\"per_page\"] = strconv.Itoa(pageSize)\n\t\textras[\"extras\"] = \"media,url_o\"\n\t\tif len(setId) > 0 {\n\t\t\textras[\"photoset_id\"] = setId\n\t\t}\n\n\t\tbody, err = makeGetRequest(func() string { return generateOAuthUrl(apiBaseUrl, apiName, flickrOAuth, extras) })\n\t\tif err != nil {\n\t\t\tlogMessage(\"Could not unmarshal body, check logs for body detail.\", true)\n\t\t\tlogMessage(string(body), false)\n\t\t\treturn map[string]Photo{}\n\t\t}\n\n\t\tresponsePhotos := []Photo{}\n\t\tvar err error\n\t\tif apiName == getPhotosNotInSetName {\n\t\t\tresponse := PhotosNotInSetResponse{}\n\t\t\terr = xml.Unmarshal(body, &response)\n\t\t\tif err == nil {\n\t\t\t\tresponsePhotos = response.Photos\n\t\t\t}\n\t\t} else {\n\t\t\tresponse := PhotosResponse{}\n\t\t\terr = xml.Unmarshal(body, &response)\n\t\t\tif err == nil {\n\t\t\t\tresponsePhotos = response.Set.Photos\n\t\t\t}\n\t\t}\n\n\t\tif err != nil {\n\n\t\t\t// We couldn't unmarshal the response as photos, but it might be the case\n\t\t\t// that we just ran out of photos, i.e. the set has a multiple of 500 photos in it\n\t\t\t// Lets try to unmarshal the response as an error, and if it is, error code \"1\" means\n\t\t\t// we're good and we can take what we've got and roll on.\n\t\t\terrorResponse := FlickrErrorResponse{}\n\t\t\terr = xml.Unmarshal(body, &errorResponse)\n\t\t\tif err != nil {\n\n\t\t\t\tlogMessage(\"Could not unmarshal body, check logs for body detail.\", true)\n\t\t\t\tlogMessage(string(body), false)\n\t\t\t\treturn map[string]Photo{}\n\t\t\t}\n\n\t\t\t// The \"good\" error code\n\t\t\tif errorResponse.Error.Code == \"1\" {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tlogMessage(\"An error occurred while getting photos for the set. Check the body in the logs.\", false)\n\t\t\tlogMessage(string(body), false)\n\t\t}\n\n\t\tfor _, v := range responsePhotos {\n\t\t\tphotos[v.Id] = v\n\t\t}\n\n\t\t// If we didn't get 500 photos, then we're done.\n\t\t// There are no more photos to get.\n\t\tif len(responsePhotos) < pageSize {\n\t\t\tbreak\n\t\t}\n\n\t\tcurrentPage++\n\t}\n\n\treturn photos\n}", "func BraceletPhotos(exec boil.Executor, mods ...qm.QueryMod) braceletPhotoQuery {\n\tmods = append(mods, qm.From(\"`bracelet_photo`\"))\n\treturn braceletPhotoQuery{NewQuery(exec, mods...)}\n}" ]
[ "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.5698772", "0.56889397", "0.56889397", "0.56835645", "0.5462998", "0.5462998", "0.54250324", "0.49617684", "0.4956227", "0.4812284", "0.48121122", "0.4775683", "0.46984398", "0.46909517", "0.4647925", "0.45807672", "0.45798743", "0.45583168", "0.4527001", "0.45097727", "0.4443876", "0.44096985", "0.44067776", "0.4398474", "0.439734", "0.43598932", "0.43249804", "0.4323638", "0.43046847", "0.42896914", "0.42857024", "0.41761863", "0.41674992", "0.41561937", "0.4104125", "0.4099268", "0.4081508", "0.40552297", "0.40406087", "0.4040318", "0.4039297", "0.40301573", "0.4024168", "0.40142587", "0.39831325", "0.39771786", "0.39707038", "0.39634195", "0.39559868", "0.3954231", "0.39240566", "0.392093", "0.3896548", "0.38797912", "0.387806", "0.38772807", "0.38768938", "0.38709924", "0.3870624", "0.3851721", "0.38357002", "0.38283622", "0.3814364", "0.38128167", "0.3812502", "0.38110057", "0.3810547", "0.37905407", "0.37872565", "0.37764463", "0.37648198", "0.3756093", "0.37469092", "0.37447956", "0.37439045", "0.37420985", "0.37305996", "0.3711802", "0.37007844" ]
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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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 = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Reading != nil {\n\t\tres.Reading = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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))\n\t\tfor i, val := range v.Precise {\n\t\t\tres.Precise[i] = val\n\t\t}\n\t}\n\tif v.Regions != nil {\n\t\tres.Regions = make([]*StationRegionResponseBody, len(v.Regions))\n\t\tfor i, val := range v.Regions {\n\t\t\tres.Regions[i] = marshalStationviewsStationRegionViewToStationRegionResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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\tfor i, val := range v.Shape {\n\t\t\tres.Shape[i] = make([][]float64, len(val))\n\t\t\tfor j, val := range val {\n\t\t\t\tres.Shape[i][j] = make([]float64, len(val))\n\t\t\t\tfor k, val := range val {\n\t\t\t\t\tres.Shape[i][j][k] = val\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}", "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 marshalStationviewsEssentialStationViewToEssentialStationResponseBody(v *stationviews.EssentialStationView) *EssentialStationResponseBody {\n\tres := &EssentialStationResponseBody{\n\t\tID: *v.ID,\n\t\tDeviceID: *v.DeviceID,\n\t\tName: *v.Name,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tLastIngestionAt: v.LastIngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t\tFullKey: *v.FullKey,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.StationPhotosView) *StationPhotosResponseBody {\n\tres := &StationPhotosResponseBody{\n\t\tSmall: *v.Small,\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationJobViewToStationJobResponseBody(v *stationviews.StationJobView) *StationJobResponseBody {\n\tres := &StationJobResponseBody{\n\t\tTitle: *v.Title,\n\t\tStartedAt: *v.StartedAt,\n\t\tCompletedAt: v.CompletedAt,\n\t\tProgress: *v.Progress,\n\t}\n\n\treturn res\n}", "func ValidateStationConfigurationResponseBody(body *StationConfigurationResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.ProvisionID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"provision_id\", \"body\"))\n\t}\n\tif body.Time == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"time\", \"body\"))\n\t}\n\tif body.Modules == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"modules\", \"body\"))\n\t}\n\tfor _, e := range body.Modules {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateStationModuleResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v *stationviews.StationDataSummaryView) *StationDataSummaryResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &StationDataSummaryResponseBody{\n\t\tStart: *v.Start,\n\t\tEnd: *v.End,\n\t\tNumberOfSamples: *v.NumberOfSamples,\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tLocationName: v.LocationName,\n\t\tPlaceNameOther: v.PlaceNameOther,\n\t\tPlaceNameNative: v.PlaceNameNative,\n\t\tSyncedAt: v.SyncedAt,\n\t\tIngestionAt: v.IngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\tif v.Data != nil {\n\t\tres.Data = marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v.Data)\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdated: *v.Updated,\n\t\tLocationName: v.LocationName,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Images != nil {\n\t\tres.Images = make([]*ImageRefResponseBody, len(v.Images))\n\t\tfor i, val := range v.Images {\n\t\t\tres.Images[i] = marshalStationviewsImageRefViewToImageRefResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsWarehouseViewToWarehouseResponseBody(v *inventoryviews.WarehouseView) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tCode: *v.Code,\n\t\tAddress: *v.Address,\n\t\tType: *v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func (s *server) ScrapeConfigsHandler(w http.ResponseWriter, r *http.Request) {\n\tconfigs := s.discoveryManager.GetScrapeConfigs()\n\tconfigBytes, err := yaml2.Marshal(configs)\n\tif err != nil {\n\t\ts.errorHandler(w, err)\n\t}\n\tjsonConfig, err := yaml.YAMLToJSON(configBytes)\n\tif err != nil {\n\t\ts.errorHandler(w, err)\n\t}\n\t// We don't use the jsonHandler method because we don't want our bytes to be re-encoded\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t_, err = w.Write(jsonConfig)\n\tif err != nil {\n\t\ts.errorHandler(w, err)\n\t}\n}", "func (_e *MockDataCoord_Expecter) ShowConfigurations(ctx interface{}, req interface{}) *MockDataCoord_ShowConfigurations_Call {\n\treturn &MockDataCoord_ShowConfigurations_Call{Call: _e.mock.On(\"ShowConfigurations\", ctx, req)}\n}", "func marshalMatchesviewsRatingViewToRatingResponseBody(v *matchesviews.RatingView) *RatingResponseBody {\n\tres := &RatingResponseBody{\n\t\tStrength: *v.Strength,\n\t\tLower: *v.Lower,\n\t\tUpper: *v.Upper,\n\t}\n\n\treturn res\n}", "func marshalStationviewsImageRefViewToImageRefResponseBody(v *stationviews.ImageRefView) *ImageRefResponseBody {\n\tres := &ImageRefResponseBody{\n\t\tURL: *v.URL,\n\t}\n\n\treturn res\n}", "func (client *WebAppsClient) listConfigurationsHandleResponse(resp *http.Response) (WebAppsListConfigurationsResponse, error) {\n\tresult := WebAppsListConfigurationsResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResourceCollection); err != nil {\n\t\treturn WebAppsListConfigurationsResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "func (s *ListConfigurationsOutput) SetConfigurations(v []map[string]*string) *ListConfigurationsOutput {\n\ts.Configurations = v\n\treturn s\n}", "func (_e *MockQueryCoord_Expecter) ShowConfigurations(ctx interface{}, req interface{}) *MockQueryCoord_ShowConfigurations_Call {\n\treturn &MockQueryCoord_ShowConfigurations_Call{Call: _e.mock.On(\"ShowConfigurations\", ctx, req)}\n}", "func (o StudyOutput) StudyConfig() GoogleCloudMlV1__StudyConfigResponseOutput {\n\treturn o.ApplyT(func(v *Study) GoogleCloudMlV1__StudyConfigResponseOutput { return v.StudyConfig }).(GoogleCloudMlV1__StudyConfigResponseOutput)\n}", "func ValidateStationSensorResponseBody(body *StationSensorResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.UnitOfMeasure == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"unit_of_measure\", \"body\"))\n\t}\n\tif body.Key == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"key\", \"body\"))\n\t}\n\tif body.Ranges == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"ranges\", \"body\"))\n\t}\n\tif body.Reading != nil {\n\t\tif err2 := ValidateSensorReadingResponseBody(body.Reading); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\tfor _, e := range body.Ranges {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateSensorRangeResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func NewDeviceLayoutResponseViewOK(body *DeviceLayoutResponseBody) *informationviews.DeviceLayoutResponseView {\n\tv := &informationviews.DeviceLayoutResponseView{}\n\tv.Configurations = make([]*informationviews.StationConfigurationView, len(body.Configurations))\n\tfor i, val := range body.Configurations {\n\t\tv.Configurations[i] = unmarshalStationConfigurationResponseBodyToInformationviewsStationConfigurationView(val)\n\t}\n\tv.Sensors = make(map[string][]*informationviews.StationSensorView, len(body.Sensors))\n\tfor key, val := range body.Sensors {\n\t\ttk := key\n\t\ttv := make([]*informationviews.StationSensorView, len(val))\n\t\tfor i, val := range val {\n\t\t\ttv[i] = unmarshalStationSensorResponseBodyToInformationviewsStationSensorView(val)\n\t\t}\n\t\tv.Sensors[tk] = tv\n\t}\n\n\treturn v\n}", "func (client *Client) sapDiskConfigurationsHandleResponse(resp *http.Response) (ClientSAPDiskConfigurationsResponse, error) {\n\tresult := ClientSAPDiskConfigurationsResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SAPDiskConfigurationsResult); err != nil {\n\t\treturn ClientSAPDiskConfigurationsResponse{}, err\n\t}\n\treturn result, nil\n}", "func (s *DescribeConfigurationsOutput) SetConfigurations(v []map[string]*string) *DescribeConfigurationsOutput {\n\ts.Configurations = v\n\treturn s\n}", "func (client *WebAppsClient) listConfigurationsSlotHandleResponse(resp *http.Response) (WebAppsListConfigurationsSlotResponse, error) {\n\tresult := WebAppsListConfigurationsSlotResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResourceCollection); err != nil {\n\t\treturn WebAppsListConfigurationsSlotResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "func (o FolderNotificationConfigOutput) StreamingConfig() StreamingConfigResponseOutput {\n\treturn o.ApplyT(func(v *FolderNotificationConfig) StreamingConfigResponseOutput { return v.StreamingConfig }).(StreamingConfigResponseOutput)\n}", "func (o ConfigurationSetEventDestinationEventDestinationCloudWatchDestinationOutput) DimensionConfigurations() ConfigurationSetEventDestinationEventDestinationCloudWatchDestinationDimensionConfigurationArrayOutput {\n\treturn o.ApplyT(func(v ConfigurationSetEventDestinationEventDestinationCloudWatchDestination) []ConfigurationSetEventDestinationEventDestinationCloudWatchDestinationDimensionConfiguration {\n\t\treturn v.DimensionConfigurations\n\t}).(ConfigurationSetEventDestinationEventDestinationCloudWatchDestinationDimensionConfigurationArrayOutput)\n}", "func (s *Server) ShowConfigurations(ctx context.Context, req *internalpb.ShowConfigurationsRequest) (*internalpb.ShowConfigurationsResponse, error) {\n\treturn s.querynode.ShowConfigurations(ctx, req)\n}", "func sessionConfigResponseHandler(t *task.SessionConfigTask, pdu *libcoap.Pdu, env *task.Env) {\n\tlog.Infof(\"Message Code: %v (%+v)\", pdu.Code, pdu.CoapCode())\n\tmaxAgeRes, _ := strconv.Atoi(pdu.GetOptionStringValue(libcoap.OptionMaxage))\n\tlog.Infof(\"Max-Age Option: %v\", maxAgeRes)\n\tlog.Infof(\" Raw payload: %s\", pdu.Data)\n\tlog.Infof(\" Raw payload hex: \\n%s\", hex.Dump(pdu.Data))\n\n\t// Check if the response body data is a string message (not an object)\n\tif pdu.IsMessageResponse() {\n\t\treturn\n\t}\n\n\tdec := codec.NewDecoder(bytes.NewReader(pdu.Data), dots_common.NewCborHandle())\n\tvar v messages.ConfigurationResponse\n\terr := dec.Decode(&v)\n\tif err != nil {\n\t\tlog.WithError(err).Warn(\"CBOR Decode failed.\")\n\t\treturn\n\t}\n\tlog.Infof(\" CBOR decoded: %+v\", v.String())\n\tif pdu.Code == libcoap.ResponseContent {\n\t\tRestartHeartBeatTask(pdu, env)\n\t\tRefreshSessionConfig(pdu, env, t.MessageTask())\n\t}\n}", "func (c *Client) ShowConfigurations(ctx context.Context, req *internalpb.ShowConfigurationsRequest) (*internalpb.ShowConfigurationsResponse, error) {\n\treq = typeutil.Clone(req)\n\tcommonpbutil.UpdateMsgBase(\n\t\treq.GetBase(),\n\t\tcommonpbutil.FillMsgBaseFromClient(paramtable.GetNodeID()))\n\treturn wrapGrpcCall(ctx, c, func(client querypb.QueryNodeClient) (*internalpb.ShowConfigurationsResponse, error) {\n\t\treturn client.ShowConfigurations(ctx, req)\n\t})\n}", "func (o LookupOrganizationNotificationConfigResultOutput) StreamingConfig() StreamingConfigResponseOutput {\n\treturn o.ApplyT(func(v LookupOrganizationNotificationConfigResult) StreamingConfigResponse { return v.StreamingConfig }).(StreamingConfigResponseOutput)\n}", "func marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(v *discussionviews.ThreadedPostView) *ThreadedPostResponseBody {\n\tres := &ThreadedPostResponseBody{\n\t\tID: *v.ID,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tBody: *v.Body,\n\t\tBookmark: v.Bookmark,\n\t}\n\tif v.Author != nil {\n\t\tres.Author = marshalDiscussionviewsPostAuthorViewToPostAuthorResponseBody(v.Author)\n\t}\n\tif v.Replies != nil {\n\t\tres.Replies = make([]*ThreadedPostResponseBody, len(v.Replies))\n\t\tfor i, val := range v.Replies {\n\t\t\tres.Replies[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func (c *Client) ShowConfigurations(ctx context.Context, req *internalpb.ShowConfigurationsRequest) (*internalpb.ShowConfigurationsResponse, error) {\n\treq = typeutil.Clone(req)\n\tcommonpbutil.UpdateMsgBase(\n\t\treq.GetBase(),\n\t\tcommonpbutil.FillMsgBaseFromClient(paramtable.GetNodeID(), commonpbutil.WithTargetID(c.grpcClient.GetNodeID())),\n\t)\n\treturn wrapGrpcCall(ctx, c, func(client querypb.QueryCoordClient) (*internalpb.ShowConfigurationsResponse, error) {\n\t\treturn client.ShowConfigurations(ctx, req)\n\t})\n}", "func (o *SyntheticsPrivateLocationCreationResponse) GetConfig() interface{} {\n\tif o == nil || o.Config == nil {\n\t\tvar ret interface{}\n\t\treturn ret\n\t}\n\treturn o.Config\n}", "func (o OsSapConfiguration) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"deployerVmPackages\", o.DeployerVMPackages)\n\tpopulate(objectMap, \"sapFqdn\", o.SapFqdn)\n\treturn json.Marshal(objectMap)\n}", "func ValidateStationModuleResponseBody(body *StationModuleResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.Position == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"position\", \"body\"))\n\t}\n\tif body.Flags == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"flags\", \"body\"))\n\t}\n\tif body.Internal == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"internal\", \"body\"))\n\t}\n\tif body.Sensors == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"sensors\", \"body\"))\n\t}\n\tfor _, e := range body.Sensors {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateStationSensorResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func (t DescribeConfigsResponse) Encode(e *Encoder, version int16) {\n\te.PutInt32(t.ThrottleTimeMs) // ThrottleTimeMs\n\t// Results\n\tlen1 := len(t.Results)\n\te.PutArrayLength(len1)\n\tfor i := 0; i < len1; i++ {\n\t\tt.Results[i].Encode(e, version)\n\t}\n}", "func (o RouterNatResponseOutput) LogConfig() RouterNatLogConfigResponseOutput {\n\treturn o.ApplyT(func(v RouterNatResponse) RouterNatLogConfigResponse { return v.LogConfig }).(RouterNatLogConfigResponseOutput)\n}", "func (controller *BuoyController) RetrieveStationJSON() {\n\tbuoyStations, err := buoyService.AllStation(&controller.Service)\n\n\tif err != nil {\n\t\tcontroller.ServeError(err)\n\t\treturn\n\t}\n\n\tcontroller.Data[\"json\"] = buoyStations\n\tcontroller.ServeJSON()\n}", "func (o RuleResponseOutput) LogConfigs() LogConfigResponseArrayOutput {\n\treturn o.ApplyT(func(v RuleResponse) []LogConfigResponse { return v.LogConfigs }).(LogConfigResponseArrayOutput)\n}", "func (s *ExportInfo) SetConfigurationsDownloadUrl(v string) *ExportInfo {\n\ts.ConfigurationsDownloadUrl = &v\n\treturn s\n}", "func (m *ConfigurationResponse) String() (result string) {\n\tresult = \"\\n \\\"ietf-dots-signal-channel:signal-config\\\":\\n\"\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"mitigating-config\")\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"heartbeat-interval\")\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"min-value\", m.SignalConfigs.MitigatingConfig.HeartbeatInterval.MinValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"max-value\", m.SignalConfigs.MitigatingConfig.HeartbeatInterval.MaxValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"current-value\", m.SignalConfigs.MitigatingConfig.HeartbeatInterval.CurrentValue)\n\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"missing-hb-allowed\")\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"min-value\", m.SignalConfigs.MitigatingConfig.MissingHbAllowed.MinValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"max-value\", m.SignalConfigs.MitigatingConfig.MissingHbAllowed.MaxValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"current-value\", m.SignalConfigs.MitigatingConfig.MissingHbAllowed.CurrentValue)\n\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"max-retransmit\")\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"min-value\", m.SignalConfigs.MitigatingConfig.MaxRetransmit.MinValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"max-value\", m.SignalConfigs.MitigatingConfig.MaxRetransmit.MaxValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"current-value\", m.SignalConfigs.MitigatingConfig.MaxRetransmit.CurrentValue)\n\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"ack-timeout\")\n\tmin_float, _ := m.SignalConfigs.MitigatingConfig.AckTimeout.MinValue.Round(2).Float64()\n\tmax_float, _ := m.SignalConfigs.MitigatingConfig.AckTimeout.MaxValue.Round(2).Float64()\n\tcurrent_float, _ := m.SignalConfigs.MitigatingConfig.AckTimeout.CurrentValue.Round(2).Float64()\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"min-value-decimal\", min_float)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"max-value-decimal\", max_float)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"current-value-decimal\", current_float)\n\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"ack-random-factor\")\n\tmin_float, _ = m.SignalConfigs.MitigatingConfig.AckRandomFactor.MinValue.Round(2).Float64()\n\tmax_float, _ = m.SignalConfigs.MitigatingConfig.AckRandomFactor.MaxValue.Round(2).Float64()\n\tcurrent_float, _ = m.SignalConfigs.MitigatingConfig.AckRandomFactor.CurrentValue.Round(2).Float64()\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"min-value-decimal\", min_float)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"max-value-decimal\", max_float)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"current-value-decimal\", current_float)\n\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"idle-config\")\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"heartbeat-interval\")\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"min-value\", m.SignalConfigs.IdleConfig.HeartbeatInterval.MinValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"max-value\", m.SignalConfigs.IdleConfig.HeartbeatInterval.MaxValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"current-value\", m.SignalConfigs.IdleConfig.HeartbeatInterval.CurrentValue)\n\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"missing-hb-allowed\")\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"min-value\", m.SignalConfigs.IdleConfig.MissingHbAllowed.MinValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"max-value\", m.SignalConfigs.IdleConfig.MissingHbAllowed.MaxValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"current-value\", m.SignalConfigs.IdleConfig.MissingHbAllowed.CurrentValue)\n\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"max-retransmit\")\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"min-value\", m.SignalConfigs.IdleConfig.MaxRetransmit.MinValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"max-value\", m.SignalConfigs.IdleConfig.MaxRetransmit.MaxValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"current-value\", m.SignalConfigs.IdleConfig.MaxRetransmit.CurrentValue)\n\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"ack-timeout\")\n\tmin_float, _ = m.SignalConfigs.IdleConfig.AckTimeout.MinValue.Round(2).Float64()\n\tmax_float, _ = m.SignalConfigs.IdleConfig.AckTimeout.MaxValue.Round(2).Float64()\n\tcurrent_float, _ = m.SignalConfigs.IdleConfig.AckTimeout.CurrentValue.Round(2).Float64()\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"min-value-decimal\", min_float)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"max-value-decimal\", max_float)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"current-value-decimal\", current_float)\n\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"ack-random-factor\")\n\tmin_float, _ = m.SignalConfigs.IdleConfig.AckRandomFactor.MinValue.Round(2).Float64()\n\tmax_float, _ = m.SignalConfigs.IdleConfig.AckRandomFactor.MaxValue.Round(2).Float64()\n\tcurrent_float, _ = m.SignalConfigs.IdleConfig.AckRandomFactor.CurrentValue.Round(2).Float64()\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"min-value-decimal\", min_float)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"max-value-decimal\", max_float)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"current-value-decimal\", current_float)\n\treturn\n}", "func (o HttpFilterConfigResponseOutput) Config() pulumi.StringOutput {\n\treturn o.ApplyT(func(v HttpFilterConfigResponse) string { return v.Config }).(pulumi.StringOutput)\n}", "func (c CentralServerConfiguration) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"instanceCount\", c.InstanceCount)\n\tpopulate(objectMap, \"subnetId\", c.SubnetID)\n\tpopulate(objectMap, \"virtualMachineConfiguration\", c.VirtualMachineConfiguration)\n\treturn json.Marshal(objectMap)\n}", "func EncodeConfigureResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tresp := response.(endpoints.ConfigureResponse)\n\n\t// mounts\n\tvar mounts map[string]*pb.MountOutput\n\tif (resp.Mounts != nil) && (len(resp.Mounts) > 0) {\n\t\tmounts = make(map[string]*pb.MountOutput)\n\t\tfor k, v := range resp.Mounts {\n\t\t\tmountCfgOut := &pb.MountConfigOutput{\n\t\t\t\tDefaultLeaseTtl: uint32(v.Config.DefaultLeaseTTL),\n\t\t\t\tMaxLeaseTtl: uint32(v.Config.MaxLeaseTTL),\n\t\t\t}\n\n\t\t\tmountOut := &pb.MountOutput{\n\t\t\t\tType: v.Type,\n\t\t\t\tDescription: v.Description,\n\t\t\t\tConfig: mountCfgOut,\n\t\t\t}\n\n\t\t\tmounts[k] = mountOut\n\t\t}\n\t}\n\n\t// auths\n\tvar auths map[string]*pb.AuthMountOutput\n\tif (resp.Auths != nil) && (len(resp.Auths) > 0) {\n\t\tauths = make(map[string]*pb.AuthMountOutput)\n\t\tfor k, v := range resp.Auths {\n\t\t\tauthCfgOut := &pb.AuthConfigOutput{\n\t\t\t\tDefaultLeaseTtl: uint32(v.Config.DefaultLeaseTTL),\n\t\t\t\tMaxLeaseTtl: uint32(v.Config.MaxLeaseTTL),\n\t\t\t}\n\n\t\t\tauthMountOut := &pb.AuthMountOutput{\n\t\t\t\tType: v.Type,\n\t\t\t\tDescription: v.Description,\n\t\t\t\tConfig: authCfgOut,\n\t\t\t}\n\n\t\t\tauths[k] = authMountOut\n\t\t}\n\t}\n\n\t// policies\n\tvar policies []string\n\tif (resp.Policies != nil) && (len(resp.Policies) > 0) {\n\t\tpolicies = resp.Policies\n\t}\n\n\tstatus := &pb.ConfigStatus{\n\t\tConfigId: resp.ConfigID,\n\t\tMounts: mounts,\n\t\tAuths: auths,\n\t\tPolicies: policies,\n\t}\n\treturn &pb.ConfigureResponse{\n\t\tConfigStatus: status,\n\t\tErr: service.Error2String(resp.Err),\n\t}, nil\n}", "func (o DicomStoreOutput) StreamConfigs() DicomStoreStreamConfigArrayOutput {\n\treturn o.ApplyT(func(v *DicomStore) DicomStoreStreamConfigArrayOutput { return v.StreamConfigs }).(DicomStoreStreamConfigArrayOutput)\n}", "func getcms(w http.ResponseWriter, r *http.Request) {\n w.Header().Set(\"Content-Type\", \"application/json\")\n json.NewEncoder(w).Encode(configurationmanagement)\n}", "func marshalVironAPIViewToVironAPIResponseBody(v *vironviews.VironAPIView) *VironAPIResponseBody {\n\tres := &VironAPIResponseBody{\n\t\tMethod: *v.Method,\n\t\tPath: *v.Path,\n\t}\n\n\treturn res\n}", "func (o SecurityPolicyRuleMatcherResponseOutput) Config() SecurityPolicyRuleMatcherConfigResponseOutput {\n\treturn o.ApplyT(func(v SecurityPolicyRuleMatcherResponse) SecurityPolicyRuleMatcherConfigResponse { return v.Config }).(SecurityPolicyRuleMatcherConfigResponseOutput)\n}", "func UnmarshalWorkspaceTemplateValuesResponse(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(WorkspaceTemplateValuesResponse)\n\terr = core.UnmarshalModel(m, \"runtime_data\", &obj.RuntimeData, UnmarshalTemplateRunTimeDataResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"shared_data\", &obj.SharedData, UnmarshalSharedTargetData)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"template_data\", &obj.TemplateData, UnmarshalTemplateSourceDataResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func (s *Server) ConfigHandler(w http.ResponseWriter, r *http.Request) {\n\tswitch r.Method {\n\tcase http.MethodPost:\n\t\t// copy current config, this allows for setting only a subset of the whole config\n\t\tvar cfg regenbox.Config = s.Regenbox.Config()\n\t\terr := json.NewDecoder(r.Body).Decode(&cfg)\n\t\tif err != nil {\n\t\t\tlog.Println(\"error decoding json:\", err)\n\t\t\thttp.Error(w, \"couldn't decode provided json\", http.StatusUnprocessableEntity)\n\t\t\treturn\n\t\t}\n\n\t\tif !s.Regenbox.Stopped() {\n\t\t\thttp.Error(w, \"regenbox must be stopped first\", http.StatusNotAcceptable)\n\t\t\treturn\n\t\t}\n\t\terr = s.Regenbox.SetConfig(&cfg)\n\t\tif err != nil {\n\t\t\tlog.Println(\"error setting config:\", err)\n\t\t\thttp.Error(w, \"error setting config (internal)\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\t// save newly set config - todo ? huston we have design issues\n\t\t//err = util.WriteTomlFile(cfg, s.cfg)\n\t\t//if err != nil {\n\t\t//\tlog.Println(\"error writing config:\", err)\n\t\t//}\n\t\tbreak\n\tcase http.MethodGet:\n\t\tbreak\n\tdefault:\n\t\thttp.Error(w, fmt.Sprintf(\"unexpected http-method (%s)\", r.Method), http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\t// encode regenbox config regardless of http method\n\tw.WriteHeader(200)\n\t_ = json.NewEncoder(w).Encode(s.Regenbox.Config())\n\treturn\n}", "func unmarshalWineryResponseBodyToStorageviewsWineryView(v *WineryResponseBody) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func (o AppMonitorOutput) AppMonitorConfiguration() AppMonitorAppMonitorConfigurationOutput {\n\treturn o.ApplyT(func(v *AppMonitor) AppMonitorAppMonitorConfigurationOutput { return v.AppMonitorConfiguration }).(AppMonitorAppMonitorConfigurationOutput)\n}", "func (o LookupOptionGroupResultOutput) OptionConfigurations() OptionGroupOptionConfigurationArrayOutput {\n\treturn o.ApplyT(func(v LookupOptionGroupResult) []OptionGroupOptionConfiguration { return v.OptionConfigurations }).(OptionGroupOptionConfigurationArrayOutput)\n}", "func (o ConfigurationSetEventDestinationEventDestinationCloudWatchDestinationPtrOutput) DimensionConfigurations() ConfigurationSetEventDestinationEventDestinationCloudWatchDestinationDimensionConfigurationArrayOutput {\n\treturn o.ApplyT(func(v *ConfigurationSetEventDestinationEventDestinationCloudWatchDestination) []ConfigurationSetEventDestinationEventDestinationCloudWatchDestinationDimensionConfiguration {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.DimensionConfigurations\n\t}).(ConfigurationSetEventDestinationEventDestinationCloudWatchDestinationDimensionConfigurationArrayOutput)\n}", "func (app *App) ApplyTKGConfigForVsphere(params vsphere.ApplyTKGConfigForVsphereParams) middleware.Responder { // nolint:dupl\n\tconfig, err := tkgconfigproviders.New(app.AppConfig.TKGConfigDir, app.TKGConfigReaderWriter).NewVSphereConfig(params.Params)\n\tif err != nil {\n\t\treturn vsphere.NewApplyTKGConfigForVsphereInternalServerError().WithPayload(Err(err))\n\t}\n\n\terr = tkgconfigupdater.SaveConfig(app.getFilePathForSavingConfig(), app.TKGConfigReaderWriter, config)\n\tif err != nil {\n\t\treturn vsphere.NewApplyTKGConfigForVsphereInternalServerError().WithPayload(Err(err))\n\t}\n\treturn vsphere.NewApplyTKGConfigForVsphereOK().WithPayload(&models.ConfigFileInfo{Path: app.getFilePathForSavingConfig()})\n}", "func ServeConfig(s *Site) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tfmt.Fprint(w, s.Config)\n\t}\n}", "func (m *DeviceManagementRequestBuilder) DeviceConfigurations()(*ic0282b591819c9e922d4e2dcb24aea19571278605e12e63f9c5f2e43a4012aca.DeviceConfigurationsRequestBuilder) {\n return ic0282b591819c9e922d4e2dcb24aea19571278605e12e63f9c5f2e43a4012aca.NewDeviceConfigurationsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (o FunctionOutput) ServiceConfig() ServiceConfigResponseOutput {\n\treturn o.ApplyT(func(v *Function) ServiceConfigResponseOutput { return v.ServiceConfig }).(ServiceConfigResponseOutput)\n}", "func (s *UpdateDataLakeInput) SetConfigurations(v []*DataLakeConfiguration) *UpdateDataLakeInput {\n\ts.Configurations = v\n\treturn s\n}", "func unmarshalComponentResponseBodyToStorageviewsComponentView(v *ComponentResponseBody) *storageviews.ComponentView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &storageviews.ComponentView{\n\t\tVarietal: v.Varietal,\n\t\tPercentage: v.Percentage,\n\t}\n\n\treturn res\n}", "func (l ListVPNServerConfigurationsResult) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"nextLink\", l.NextLink)\n\tpopulate(objectMap, \"value\", l.Value)\n\treturn json.Marshal(objectMap)\n}", "func (s SAPConfiguration) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tobjectMap[\"configurationType\"] = s.ConfigurationType\n\treturn json.Marshal(objectMap)\n}", "func (o ServiceResponseOutput) NetworkConfig() NetworkConfigResponseOutput {\n\treturn o.ApplyT(func(v ServiceResponse) NetworkConfigResponse { return v.NetworkConfig }).(NetworkConfigResponseOutput)\n}", "func (d DeploymentWithOSConfiguration) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"appLocation\", d.AppLocation)\n\tobjectMap[\"configurationType\"] = SAPConfigurationTypeDeploymentWithOSConfig\n\tpopulate(objectMap, \"infrastructureConfiguration\", d.InfrastructureConfiguration)\n\tpopulate(objectMap, \"osSapConfiguration\", d.OSSapConfiguration)\n\tpopulate(objectMap, \"softwareConfiguration\", d.SoftwareConfiguration)\n\treturn json.Marshal(objectMap)\n}", "func GetWebConfig(w http.ResponseWriter, r *http.Request) {\n\tmiddleware.EnableCors(&w)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tconfiguration := config.Config.InstanceDetails\n\tconfiguration.Version = config.Config.VersionInfo\n\tif err := json.NewEncoder(w).Encode(configuration); err != nil {\n\t\tbadRequestHandler(w, err)\n\t}\n}", "func (o JobOutput) ValidationConfigurations() JobValidationConfigurationArrayOutput {\n\treturn o.ApplyT(func(v *Job) JobValidationConfigurationArrayOutput { return v.ValidationConfigurations }).(JobValidationConfigurationArrayOutput)\n}", "func (o LinuxWebAppOutput) SiteConfig() LinuxWebAppSiteConfigOutput {\n\treturn o.ApplyT(func(v *LinuxWebApp) LinuxWebAppSiteConfigOutput { return v.SiteConfig }).(LinuxWebAppSiteConfigOutput)\n}", "func NewListConfigurationsOK() *ListConfigurationsOK {\n\treturn &ListConfigurationsOK{}\n}", "func IndexConfigHandler(cfg *config.ApiConfig) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// TODO(toru): Write a middleware that does this.\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\tif err := json.NewEncoder(w).Encode(cfg); err != nil {\n\t\t\tlog.Print(err)\n\t\t}\n\t}\n}", "func (v AccountConfigurations) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (s *CreateDataLakeInput) SetConfigurations(v []*DataLakeConfiguration) *CreateDataLakeInput {\n\ts.Configurations = v\n\treturn s\n}", "func (client *WebAppsClient) getDiagnosticLogsConfigurationHandleResponse(resp *http.Response) (WebAppsGetDiagnosticLogsConfigurationResponse, error) {\n\tresult := WebAppsGetDiagnosticLogsConfigurationResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SiteLogsConfig); err != nil {\n\t\treturn WebAppsGetDiagnosticLogsConfigurationResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "func (clbCfg *CLBConfig) GenerateSdkConfig() *sdk.Config {\n\tbackendType := sdk.ClbBackendTargetTypeCVM\n\tif clbCfg.BackendMode == ConfigBcsClbBackendModeENI {\n\t\tbackendType = sdk.ClbBackendTargetTypeENI\n\t}\n\treturn &sdk.Config{\n\t\tBackendType: backendType,\n\t\tRegion: clbCfg.Region,\n\t\tProjectID: clbCfg.ProjectID,\n\t\tSubnetID: clbCfg.SubnetID,\n\t\tVpcID: clbCfg.VpcID,\n\t\tSecretID: clbCfg.SecretID,\n\t\tSecretKey: clbCfg.SecretKey,\n\t\tMaxTimeout: clbCfg.MaxTimeout,\n\t\tWaitPeriodExceedLimit: clbCfg.WaitPeriodExceedLimit,\n\t\tWaitPeriodLBDealing: clbCfg.WaitPeriodLBDealing,\n\t}\n}", "func ConfigView(wn eve.Node, vn gi3d.Node3D, sc *gi3d.Scene) {\n\twb := wn.AsNodeBase()\n\tvb := vn.(*gi3d.Group)\n\tvb.Pose.Pos = wb.Rel.Pos\n\tvb.Pose.Quat = wb.Rel.Quat\n\tbod := wn.AsBody()\n\tif bod != nil {\n\t\tif !vb.HasChildren() {\n\t\t\tsc.AddFmLibrary(bod.AsBodyBase().Vis, vb)\n\t\t}\n\t}\n}", "func (client *WebAppsClient) updateConfigurationHandleResponse(resp *http.Response) (WebAppsUpdateConfigurationResponse, error) {\n\tresult := WebAppsUpdateConfigurationResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResource); err != nil {\n\t\treturn WebAppsUpdateConfigurationResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "func (o LookupInstanceResultOutput) Config() ConfigResponseOutput {\n\treturn o.ApplyT(func(v LookupInstanceResult) ConfigResponse { return v.Config }).(ConfigResponseOutput)\n}", "func (o *OsSapConfiguration) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", o, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"deployerVmPackages\":\n\t\t\terr = unpopulate(val, \"DeployerVMPackages\", &o.DeployerVMPackages)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sapFqdn\":\n\t\t\terr = unpopulate(val, \"SapFqdn\", &o.SapFqdn)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", o, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (client *WebAppsClient) getConfigurationHandleResponse(resp *http.Response) (WebAppsGetConfigurationResponse, error) {\n\tresult := WebAppsGetConfigurationResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResource); err != nil {\n\t\treturn WebAppsGetConfigurationResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "func ServerEncodeResponseBody(timeLayout string, format wrp.Format) gokithttp.EncodeResponseFunc {\n\treturn func(ctx context.Context, httpResponse http.ResponseWriter, value interface{}) error {\n\t\tvar (\n\t\t\twrpResponse = value.(wrpendpoint.Response)\n\t\t\toutput bytes.Buffer\n\t\t)\n\n\t\ttracinghttp.HeadersForSpans(timeLayout, httpResponse.Header(), wrpResponse.Spans()...)\n\n\t\tif err := wrpResponse.Encode(&output, format); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\thttpResponse.Header().Set(\"Content-Type\", format.ContentType())\n\t\t_, err := output.WriteTo(httpResponse)\n\t\treturn err\n\t}\n}", "func CreateSetCasterConfigResponse() (response *SetCasterConfigResponse) {\n\tresponse = &SetCasterConfigResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (nv *NetView) ViewConfig() {\n\tvs := nv.Scene()\n\tif nv.Net == nil || nv.Net.NLayers() == 0 {\n\t\tvs.DeleteChildren(true)\n\t\tvs.Meshes.Reset()\n\t\treturn\n\t}\n\tif vs.Lights.Len() == 0 {\n\t\tnv.ViewDefaults()\n\t}\n\tvs.BgColor = gi.Prefs.Colors.Background // reset in case user changes\n\tnlay := nv.Net.NLayers()\n\tlaysGp, err := vs.ChildByNameTry(\"Layers\", 0)\n\tif err != nil {\n\t\tlaysGp = gi3d.AddNewGroup(vs, vs, \"Layers\")\n\t}\n\tlayConfig := kit.TypeAndNameList{}\n\tfor li := 0; li < nlay; li++ {\n\t\tlay := nv.Net.Layer(li)\n\t\tlmesh := vs.MeshByName(lay.Name())\n\t\tif lmesh == nil {\n\t\t\tAddNewLayMesh(vs, nv, lay)\n\t\t} else {\n\t\t\tlmesh.(*LayMesh).Lay = lay // make sure\n\t\t}\n\t\tlayConfig.Add(gi3d.KiT_Group, lay.Name())\n\t}\n\tgpConfig := kit.TypeAndNameList{}\n\tgpConfig.Add(KiT_LayObj, \"layer\")\n\tgpConfig.Add(KiT_LayName, \"name\")\n\n\t_, updt := laysGp.ConfigChildren(layConfig)\n\t// if !mods {\n\t// \tupdt = laysGp.UpdateStart()\n\t// }\n\tnmin, nmax := nv.Net.Bounds()\n\tnsz := nmax.Sub(nmin).Sub(mat32.Vec3{1, 1, 0}).Max(mat32.Vec3{1, 1, 1})\n\tnsc := mat32.Vec3{1.0 / nsz.X, 1.0 / nsz.Y, 1.0 / nsz.Z}\n\tszc := mat32.Max(nsc.X, nsc.Y)\n\tpoff := mat32.NewVec3Scalar(0.5)\n\tpoff.Y = -0.5\n\tfor li, lgi := range *laysGp.Children() {\n\t\tly := nv.Net.Layer(li)\n\t\tlg := lgi.(*gi3d.Group)\n\t\tlg.ConfigChildren(gpConfig) // won't do update b/c of above\n\t\tlp := ly.Pos()\n\t\tlp.Y = -lp.Y // reverse direction\n\t\tlp = lp.Sub(nmin).Mul(nsc).Sub(poff)\n\t\trp := ly.RelPos()\n\t\tlg.Pose.Pos.Set(lp.X, lp.Z, lp.Y)\n\t\tlg.Pose.Scale.Set(nsc.X*rp.Scale, szc, nsc.Y*rp.Scale)\n\n\t\tlo := lg.Child(0).(*LayObj)\n\t\tlo.Defaults()\n\t\tlo.LayName = ly.Name()\n\t\tlo.NetView = nv\n\t\tlo.SetMeshName(vs, ly.Name())\n\t\tlo.Mat.Color.SetUInt8(255, 100, 255, 255)\n\t\tlo.Mat.Reflective = 8\n\t\tlo.Mat.Bright = 8\n\t\tlo.Mat.Shiny = 30\n\t\t// note: would actually be better to NOT cull back so you can view underneath\n\t\t// but then the front and back fight against each other, causing flickering\n\n\t\ttxt := lg.Child(1).(*LayName)\n\t\ttxt.Nm = \"layname:\" + ly.Name()\n\t\ttxt.Defaults(vs)\n\t\ttxt.NetView = nv\n\t\ttxt.SetText(vs, ly.Name())\n\t\ttxt.Pose.Scale = mat32.NewVec3Scalar(nv.Params.LayNmSize).Div(lg.Pose.Scale)\n\t\ttxt.SetProp(\"text-align\", gist.AlignLeft)\n\t\ttxt.SetProp(\"text-vertical-align\", gist.AlignTop)\n\t}\n\tlaysGp.UpdateEnd(updt)\n}", "func sessionConfigurationPayloadDisplay(data *messages.SignalConfigs) {\n\tvar result string = \"\\n\"\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"session-id\", data.MitigatingConfig.SessionId)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"heartbeat-interval\", data.MitigatingConfig.HeartbeatInterval)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"missing-hb-allowed\", data.MitigatingConfig.MissingHbAllowed)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"max-retransmit\", data.MitigatingConfig.MaxRetransmit)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"ack-timeout\", data.MitigatingConfig.AckTimeout)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"ack-random-factor\", data.MitigatingConfig.AckRandomFactor)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"heartbeat-interval-idle\", data.IdleConfig.HeartbeatInterval)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"missing-hb-allowed-idle\", data.IdleConfig.MissingHbAllowed)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"max-retransmit-idle\", data.IdleConfig.MaxRetransmit)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"ack-timeout-idle\", data.IdleConfig.AckTimeout)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"ack-random-factor-idle\", data.IdleConfig.AckRandomFactor)\n\tlog.Infoln(result)\n}", "func (o HttpFilterConfigResponseOutput) ConfigTypeUrl() pulumi.StringOutput {\n\treturn o.ApplyT(func(v HttpFilterConfigResponse) string { return v.ConfigTypeUrl }).(pulumi.StringOutput)\n}", "func NewGetUniverseStationsStationIDGatewayTimeout() *GetUniverseStationsStationIDGatewayTimeout {\n\treturn &GetUniverseStationsStationIDGatewayTimeout{}\n}" ]
[ "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.5456909", "0.526836", "0.526836", "0.51442236", "0.51442236", "0.46490955", "0.45812026", "0.453634", "0.4524218", "0.4516547", "0.44513595", "0.44455662", "0.44045046", "0.43517995", "0.4304071", "0.42874873", "0.42664257", "0.42616433", "0.4236232", "0.42301762", "0.41192037", "0.4095247", "0.40645882", "0.4016765", "0.40083107", "0.40059045", "0.40039575", "0.39984947", "0.39940897", "0.39935407", "0.3974506", "0.38999996", "0.38808554", "0.38676438", "0.3854562", "0.38441068", "0.3839229", "0.38353565", "0.38338694", "0.38188982", "0.38090044", "0.38011244", "0.37913424", "0.37865114", "0.3771245", "0.37585315", "0.37472072", "0.37444732", "0.37422833", "0.3740073", "0.37346566", "0.37159434", "0.37078485", "0.37075803", "0.3706116", "0.37000102", "0.36873248", "0.36863935", "0.36760822", "0.36612928", "0.36514652", "0.36483654", "0.3633399", "0.36326584", "0.36314225", "0.3628369", "0.36270332", "0.36232594", "0.36219472", "0.3616461", "0.3614295", "0.36142814", "0.36102685", "0.3607896", "0.35997683", "0.35910034", "0.3590811", "0.3587677", "0.35860342" ]
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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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 = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Reading != nil {\n\t\tres.Reading = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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))\n\t\tfor i, val := range v.Precise {\n\t\t\tres.Precise[i] = val\n\t\t}\n\t}\n\tif v.Regions != nil {\n\t\tres.Regions = make([]*StationRegionResponseBody, len(v.Regions))\n\t\tfor i, val := range v.Regions {\n\t\t\tres.Regions[i] = marshalStationviewsStationRegionViewToStationRegionResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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 marshalStationviewsEssentialStationViewToEssentialStationResponseBody(v *stationviews.EssentialStationView) *EssentialStationResponseBody {\n\tres := &EssentialStationResponseBody{\n\t\tID: *v.ID,\n\t\tDeviceID: *v.DeviceID,\n\t\tName: *v.Name,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tLastIngestionAt: v.LastIngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "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\tfor i, val := range v.Shape {\n\t\t\tres.Shape[i] = make([][]float64, len(val))\n\t\t\tfor j, val := range val {\n\t\t\t\tres.Shape[i][j] = make([]float64, len(val))\n\t\t\t\tfor k, val := range val {\n\t\t\t\t\tres.Shape[i][j][k] = val\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t\tFullKey: *v.FullKey,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationJobViewToStationJobResponseBody(v *stationviews.StationJobView) *StationJobResponseBody {\n\tres := &StationJobResponseBody{\n\t\tTitle: *v.Title,\n\t\tStartedAt: *v.StartedAt,\n\t\tCompletedAt: v.CompletedAt,\n\t\tProgress: *v.Progress,\n\t}\n\n\treturn res\n}", "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.StationPhotosView) *StationPhotosResponseBody {\n\tres := &StationPhotosResponseBody{\n\t\tSmall: *v.Small,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v *stationviews.StationDataSummaryView) *StationDataSummaryResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &StationDataSummaryResponseBody{\n\t\tStart: *v.Start,\n\t\tEnd: *v.End,\n\t\tNumberOfSamples: *v.NumberOfSamples,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tLocationName: v.LocationName,\n\t\tPlaceNameOther: v.PlaceNameOther,\n\t\tPlaceNameNative: v.PlaceNameNative,\n\t\tSyncedAt: v.SyncedAt,\n\t\tIngestionAt: v.IngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\tif v.Data != nil {\n\t\tres.Data = marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v.Data)\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdated: *v.Updated,\n\t\tLocationName: v.LocationName,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Images != nil {\n\t\tres.Images = make([]*ImageRefResponseBody, len(v.Images))\n\t\tfor i, val := range v.Images {\n\t\t\tres.Images[i] = marshalStationviewsImageRefViewToImageRefResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "func ValidateStationConfigurationResponseBody(body *StationConfigurationResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.ProvisionID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"provision_id\", \"body\"))\n\t}\n\tif body.Time == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"time\", \"body\"))\n\t}\n\tif body.Modules == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"modules\", \"body\"))\n\t}\n\tfor _, e := range body.Modules {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateStationModuleResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalStationviewsImageRefViewToImageRefResponseBody(v *stationviews.ImageRefView) *ImageRefResponseBody {\n\tres := &ImageRefResponseBody{\n\t\tURL: *v.URL,\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsWarehouseViewToWarehouseResponseBody(v *inventoryviews.WarehouseView) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tCode: *v.Code,\n\t\tAddress: *v.Address,\n\t\tType: *v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func marshalMatchesviewsRatingViewToRatingResponseBody(v *matchesviews.RatingView) *RatingResponseBody {\n\tres := &RatingResponseBody{\n\t\tStrength: *v.Strength,\n\t\tLower: *v.Lower,\n\t\tUpper: *v.Upper,\n\t}\n\n\treturn res\n}", "func (o FolderNotificationConfigOutput) StreamingConfig() StreamingConfigResponseOutput {\n\treturn o.ApplyT(func(v *FolderNotificationConfig) StreamingConfigResponseOutput { return v.StreamingConfig }).(StreamingConfigResponseOutput)\n}", "func (o StudyOutput) StudyConfig() GoogleCloudMlV1__StudyConfigResponseOutput {\n\treturn o.ApplyT(func(v *Study) GoogleCloudMlV1__StudyConfigResponseOutput { return v.StudyConfig }).(GoogleCloudMlV1__StudyConfigResponseOutput)\n}", "func (o *SyntheticsPrivateLocationCreationResponse) GetConfig() interface{} {\n\tif o == nil || o.Config == nil {\n\t\tvar ret interface{}\n\t\treturn ret\n\t}\n\treturn o.Config\n}", "func (o LookupOrganizationNotificationConfigResultOutput) StreamingConfig() StreamingConfigResponseOutput {\n\treturn o.ApplyT(func(v LookupOrganizationNotificationConfigResult) StreamingConfigResponse { return v.StreamingConfig }).(StreamingConfigResponseOutput)\n}", "func marshalVironAPIViewToVironAPIResponseBody(v *vironviews.VironAPIView) *VironAPIResponseBody {\n\tres := &VironAPIResponseBody{\n\t\tMethod: *v.Method,\n\t\tPath: *v.Path,\n\t}\n\n\treturn res\n}", "func NewDeviceLayoutResponseViewOK(body *DeviceLayoutResponseBody) *informationviews.DeviceLayoutResponseView {\n\tv := &informationviews.DeviceLayoutResponseView{}\n\tv.Configurations = make([]*informationviews.StationConfigurationView, len(body.Configurations))\n\tfor i, val := range body.Configurations {\n\t\tv.Configurations[i] = unmarshalStationConfigurationResponseBodyToInformationviewsStationConfigurationView(val)\n\t}\n\tv.Sensors = make(map[string][]*informationviews.StationSensorView, len(body.Sensors))\n\tfor key, val := range body.Sensors {\n\t\ttk := key\n\t\ttv := make([]*informationviews.StationSensorView, len(val))\n\t\tfor i, val := range val {\n\t\t\ttv[i] = unmarshalStationSensorResponseBodyToInformationviewsStationSensorView(val)\n\t\t}\n\t\tv.Sensors[tk] = tv\n\t}\n\n\treturn v\n}", "func (o HttpFilterConfigResponseOutput) Config() pulumi.StringOutput {\n\treturn o.ApplyT(func(v HttpFilterConfigResponse) string { return v.Config }).(pulumi.StringOutput)\n}", "func sessionConfigResponseHandler(t *task.SessionConfigTask, pdu *libcoap.Pdu, env *task.Env) {\n\tlog.Infof(\"Message Code: %v (%+v)\", pdu.Code, pdu.CoapCode())\n\tmaxAgeRes, _ := strconv.Atoi(pdu.GetOptionStringValue(libcoap.OptionMaxage))\n\tlog.Infof(\"Max-Age Option: %v\", maxAgeRes)\n\tlog.Infof(\" Raw payload: %s\", pdu.Data)\n\tlog.Infof(\" Raw payload hex: \\n%s\", hex.Dump(pdu.Data))\n\n\t// Check if the response body data is a string message (not an object)\n\tif pdu.IsMessageResponse() {\n\t\treturn\n\t}\n\n\tdec := codec.NewDecoder(bytes.NewReader(pdu.Data), dots_common.NewCborHandle())\n\tvar v messages.ConfigurationResponse\n\terr := dec.Decode(&v)\n\tif err != nil {\n\t\tlog.WithError(err).Warn(\"CBOR Decode failed.\")\n\t\treturn\n\t}\n\tlog.Infof(\" CBOR decoded: %+v\", v.String())\n\tif pdu.Code == libcoap.ResponseContent {\n\t\tRestartHeartBeatTask(pdu, env)\n\t\tRefreshSessionConfig(pdu, env, t.MessageTask())\n\t}\n}", "func (o OsSapConfiguration) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"deployerVmPackages\", o.DeployerVMPackages)\n\tpopulate(objectMap, \"sapFqdn\", o.SapFqdn)\n\treturn json.Marshal(objectMap)\n}", "func (o RouterNatResponseOutput) LogConfig() RouterNatLogConfigResponseOutput {\n\treturn o.ApplyT(func(v RouterNatResponse) RouterNatLogConfigResponse { return v.LogConfig }).(RouterNatLogConfigResponseOutput)\n}", "func (o AppMonitorOutput) AppMonitorConfiguration() AppMonitorAppMonitorConfigurationOutput {\n\treturn o.ApplyT(func(v *AppMonitor) AppMonitorAppMonitorConfigurationOutput { return v.AppMonitorConfiguration }).(AppMonitorAppMonitorConfigurationOutput)\n}", "func (m *ConfigurationResponse) String() (result string) {\n\tresult = \"\\n \\\"ietf-dots-signal-channel:signal-config\\\":\\n\"\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"mitigating-config\")\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"heartbeat-interval\")\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"min-value\", m.SignalConfigs.MitigatingConfig.HeartbeatInterval.MinValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"max-value\", m.SignalConfigs.MitigatingConfig.HeartbeatInterval.MaxValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"current-value\", m.SignalConfigs.MitigatingConfig.HeartbeatInterval.CurrentValue)\n\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"missing-hb-allowed\")\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"min-value\", m.SignalConfigs.MitigatingConfig.MissingHbAllowed.MinValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"max-value\", m.SignalConfigs.MitigatingConfig.MissingHbAllowed.MaxValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"current-value\", m.SignalConfigs.MitigatingConfig.MissingHbAllowed.CurrentValue)\n\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"max-retransmit\")\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"min-value\", m.SignalConfigs.MitigatingConfig.MaxRetransmit.MinValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"max-value\", m.SignalConfigs.MitigatingConfig.MaxRetransmit.MaxValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"current-value\", m.SignalConfigs.MitigatingConfig.MaxRetransmit.CurrentValue)\n\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"ack-timeout\")\n\tmin_float, _ := m.SignalConfigs.MitigatingConfig.AckTimeout.MinValue.Round(2).Float64()\n\tmax_float, _ := m.SignalConfigs.MitigatingConfig.AckTimeout.MaxValue.Round(2).Float64()\n\tcurrent_float, _ := m.SignalConfigs.MitigatingConfig.AckTimeout.CurrentValue.Round(2).Float64()\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"min-value-decimal\", min_float)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"max-value-decimal\", max_float)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"current-value-decimal\", current_float)\n\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"ack-random-factor\")\n\tmin_float, _ = m.SignalConfigs.MitigatingConfig.AckRandomFactor.MinValue.Round(2).Float64()\n\tmax_float, _ = m.SignalConfigs.MitigatingConfig.AckRandomFactor.MaxValue.Round(2).Float64()\n\tcurrent_float, _ = m.SignalConfigs.MitigatingConfig.AckRandomFactor.CurrentValue.Round(2).Float64()\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"min-value-decimal\", min_float)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"max-value-decimal\", max_float)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"current-value-decimal\", current_float)\n\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"idle-config\")\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"heartbeat-interval\")\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"min-value\", m.SignalConfigs.IdleConfig.HeartbeatInterval.MinValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"max-value\", m.SignalConfigs.IdleConfig.HeartbeatInterval.MaxValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"current-value\", m.SignalConfigs.IdleConfig.HeartbeatInterval.CurrentValue)\n\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"missing-hb-allowed\")\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"min-value\", m.SignalConfigs.IdleConfig.MissingHbAllowed.MinValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"max-value\", m.SignalConfigs.IdleConfig.MissingHbAllowed.MaxValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"current-value\", m.SignalConfigs.IdleConfig.MissingHbAllowed.CurrentValue)\n\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"max-retransmit\")\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"min-value\", m.SignalConfigs.IdleConfig.MaxRetransmit.MinValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"max-value\", m.SignalConfigs.IdleConfig.MaxRetransmit.MaxValue)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"current-value\", m.SignalConfigs.IdleConfig.MaxRetransmit.CurrentValue)\n\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"ack-timeout\")\n\tmin_float, _ = m.SignalConfigs.IdleConfig.AckTimeout.MinValue.Round(2).Float64()\n\tmax_float, _ = m.SignalConfigs.IdleConfig.AckTimeout.MaxValue.Round(2).Float64()\n\tcurrent_float, _ = m.SignalConfigs.IdleConfig.AckTimeout.CurrentValue.Round(2).Float64()\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"min-value-decimal\", min_float)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"max-value-decimal\", max_float)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"current-value-decimal\", current_float)\n\n\tresult += fmt.Sprintf(\" \\\"%s\\\":\\n\", \"ack-random-factor\")\n\tmin_float, _ = m.SignalConfigs.IdleConfig.AckRandomFactor.MinValue.Round(2).Float64()\n\tmax_float, _ = m.SignalConfigs.IdleConfig.AckRandomFactor.MaxValue.Round(2).Float64()\n\tcurrent_float, _ = m.SignalConfigs.IdleConfig.AckRandomFactor.CurrentValue.Round(2).Float64()\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"min-value-decimal\", min_float)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"max-value-decimal\", max_float)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"current-value-decimal\", current_float)\n\treturn\n}", "func (s *server) ScrapeConfigsHandler(w http.ResponseWriter, r *http.Request) {\n\tconfigs := s.discoveryManager.GetScrapeConfigs()\n\tconfigBytes, err := yaml2.Marshal(configs)\n\tif err != nil {\n\t\ts.errorHandler(w, err)\n\t}\n\tjsonConfig, err := yaml.YAMLToJSON(configBytes)\n\tif err != nil {\n\t\ts.errorHandler(w, err)\n\t}\n\t// We don't use the jsonHandler method because we don't want our bytes to be re-encoded\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t_, err = w.Write(jsonConfig)\n\tif err != nil {\n\t\ts.errorHandler(w, err)\n\t}\n}", "func (controller *BuoyController) RetrieveStationJSON() {\n\tbuoyStations, err := buoyService.AllStation(&controller.Service)\n\n\tif err != nil {\n\t\tcontroller.ServeError(err)\n\t\treturn\n\t}\n\n\tcontroller.Data[\"json\"] = buoyStations\n\tcontroller.ServeJSON()\n}", "func IndexConfigHandler(cfg *config.ApiConfig) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// TODO(toru): Write a middleware that does this.\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\tif err := json.NewEncoder(w).Encode(cfg); err != nil {\n\t\t\tlog.Print(err)\n\t\t}\n\t}\n}", "func ValidateStationSensorResponseBody(body *StationSensorResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.UnitOfMeasure == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"unit_of_measure\", \"body\"))\n\t}\n\tif body.Key == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"key\", \"body\"))\n\t}\n\tif body.Ranges == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"ranges\", \"body\"))\n\t}\n\tif body.Reading != nil {\n\t\tif err2 := ValidateSensorReadingResponseBody(body.Reading); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\tfor _, e := range body.Ranges {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateSensorRangeResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func unmarshalWineryResponseBodyToStorageviewsWineryView(v *WineryResponseBody) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func ServeConfig(s *Site) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tfmt.Fprint(w, s.Config)\n\t}\n}", "func (s *Server) ConfigHandler(w http.ResponseWriter, r *http.Request) {\n\tswitch r.Method {\n\tcase http.MethodPost:\n\t\t// copy current config, this allows for setting only a subset of the whole config\n\t\tvar cfg regenbox.Config = s.Regenbox.Config()\n\t\terr := json.NewDecoder(r.Body).Decode(&cfg)\n\t\tif err != nil {\n\t\t\tlog.Println(\"error decoding json:\", err)\n\t\t\thttp.Error(w, \"couldn't decode provided json\", http.StatusUnprocessableEntity)\n\t\t\treturn\n\t\t}\n\n\t\tif !s.Regenbox.Stopped() {\n\t\t\thttp.Error(w, \"regenbox must be stopped first\", http.StatusNotAcceptable)\n\t\t\treturn\n\t\t}\n\t\terr = s.Regenbox.SetConfig(&cfg)\n\t\tif err != nil {\n\t\t\tlog.Println(\"error setting config:\", err)\n\t\t\thttp.Error(w, \"error setting config (internal)\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\t// save newly set config - todo ? huston we have design issues\n\t\t//err = util.WriteTomlFile(cfg, s.cfg)\n\t\t//if err != nil {\n\t\t//\tlog.Println(\"error writing config:\", err)\n\t\t//}\n\t\tbreak\n\tcase http.MethodGet:\n\t\tbreak\n\tdefault:\n\t\thttp.Error(w, fmt.Sprintf(\"unexpected http-method (%s)\", r.Method), http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\t// encode regenbox config regardless of http method\n\tw.WriteHeader(200)\n\t_ = json.NewEncoder(w).Encode(s.Regenbox.Config())\n\treturn\n}", "func CreateSetCasterConfigResponse() (response *SetCasterConfigResponse) {\n\tresponse = &SetCasterConfigResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (o SecurityPolicyRuleMatcherResponseOutput) Config() SecurityPolicyRuleMatcherConfigResponseOutput {\n\treturn o.ApplyT(func(v SecurityPolicyRuleMatcherResponse) SecurityPolicyRuleMatcherConfigResponse { return v.Config }).(SecurityPolicyRuleMatcherConfigResponseOutput)\n}", "func (m *VpnConfiguration) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n err := m.DeviceConfiguration.Serialize(writer)\n if err != nil {\n return err\n }\n if m.GetAuthenticationMethod() != nil {\n cast := (*m.GetAuthenticationMethod()).String()\n err = writer.WriteStringValue(\"authenticationMethod\", &cast)\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"connectionName\", m.GetConnectionName())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"realm\", m.GetRealm())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteStringValue(\"role\", m.GetRole())\n if err != nil {\n return err\n }\n }\n if m.GetServers() != nil {\n cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetServers()))\n for i, v := range m.GetServers() {\n if v != nil {\n cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)\n }\n }\n err = writer.WriteCollectionOfObjectValues(\"servers\", cast)\n if err != nil {\n return err\n }\n }\n return nil\n}", "func (o FunctionOutput) ServiceConfig() ServiceConfigResponseOutput {\n\treturn o.ApplyT(func(v *Function) ServiceConfigResponseOutput { return v.ServiceConfig }).(ServiceConfigResponseOutput)\n}", "func GetWebConfig(w http.ResponseWriter, r *http.Request) {\n\tmiddleware.EnableCors(&w)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tconfiguration := config.Config.InstanceDetails\n\tconfiguration.Version = config.Config.VersionInfo\n\tif err := json.NewEncoder(w).Encode(configuration); err != nil {\n\t\tbadRequestHandler(w, err)\n\t}\n}", "func (nv *NetView) ViewConfig() {\n\tvs := nv.Scene()\n\tif nv.Net == nil || nv.Net.NLayers() == 0 {\n\t\tvs.DeleteChildren(true)\n\t\tvs.Meshes.Reset()\n\t\treturn\n\t}\n\tif vs.Lights.Len() == 0 {\n\t\tnv.ViewDefaults()\n\t}\n\tvs.BgColor = gi.Prefs.Colors.Background // reset in case user changes\n\tnlay := nv.Net.NLayers()\n\tlaysGp, err := vs.ChildByNameTry(\"Layers\", 0)\n\tif err != nil {\n\t\tlaysGp = gi3d.AddNewGroup(vs, vs, \"Layers\")\n\t}\n\tlayConfig := kit.TypeAndNameList{}\n\tfor li := 0; li < nlay; li++ {\n\t\tlay := nv.Net.Layer(li)\n\t\tlmesh := vs.MeshByName(lay.Name())\n\t\tif lmesh == nil {\n\t\t\tAddNewLayMesh(vs, nv, lay)\n\t\t} else {\n\t\t\tlmesh.(*LayMesh).Lay = lay // make sure\n\t\t}\n\t\tlayConfig.Add(gi3d.KiT_Group, lay.Name())\n\t}\n\tgpConfig := kit.TypeAndNameList{}\n\tgpConfig.Add(KiT_LayObj, \"layer\")\n\tgpConfig.Add(KiT_LayName, \"name\")\n\n\t_, updt := laysGp.ConfigChildren(layConfig)\n\t// if !mods {\n\t// \tupdt = laysGp.UpdateStart()\n\t// }\n\tnmin, nmax := nv.Net.Bounds()\n\tnsz := nmax.Sub(nmin).Sub(mat32.Vec3{1, 1, 0}).Max(mat32.Vec3{1, 1, 1})\n\tnsc := mat32.Vec3{1.0 / nsz.X, 1.0 / nsz.Y, 1.0 / nsz.Z}\n\tszc := mat32.Max(nsc.X, nsc.Y)\n\tpoff := mat32.NewVec3Scalar(0.5)\n\tpoff.Y = -0.5\n\tfor li, lgi := range *laysGp.Children() {\n\t\tly := nv.Net.Layer(li)\n\t\tlg := lgi.(*gi3d.Group)\n\t\tlg.ConfigChildren(gpConfig) // won't do update b/c of above\n\t\tlp := ly.Pos()\n\t\tlp.Y = -lp.Y // reverse direction\n\t\tlp = lp.Sub(nmin).Mul(nsc).Sub(poff)\n\t\trp := ly.RelPos()\n\t\tlg.Pose.Pos.Set(lp.X, lp.Z, lp.Y)\n\t\tlg.Pose.Scale.Set(nsc.X*rp.Scale, szc, nsc.Y*rp.Scale)\n\n\t\tlo := lg.Child(0).(*LayObj)\n\t\tlo.Defaults()\n\t\tlo.LayName = ly.Name()\n\t\tlo.NetView = nv\n\t\tlo.SetMeshName(vs, ly.Name())\n\t\tlo.Mat.Color.SetUInt8(255, 100, 255, 255)\n\t\tlo.Mat.Reflective = 8\n\t\tlo.Mat.Bright = 8\n\t\tlo.Mat.Shiny = 30\n\t\t// note: would actually be better to NOT cull back so you can view underneath\n\t\t// but then the front and back fight against each other, causing flickering\n\n\t\ttxt := lg.Child(1).(*LayName)\n\t\ttxt.Nm = \"layname:\" + ly.Name()\n\t\ttxt.Defaults(vs)\n\t\ttxt.NetView = nv\n\t\ttxt.SetText(vs, ly.Name())\n\t\ttxt.Pose.Scale = mat32.NewVec3Scalar(nv.Params.LayNmSize).Div(lg.Pose.Scale)\n\t\ttxt.SetProp(\"text-align\", gist.AlignLeft)\n\t\ttxt.SetProp(\"text-vertical-align\", gist.AlignTop)\n\t}\n\tlaysGp.UpdateEnd(updt)\n}", "func marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(v *discussionviews.ThreadedPostView) *ThreadedPostResponseBody {\n\tres := &ThreadedPostResponseBody{\n\t\tID: *v.ID,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tBody: *v.Body,\n\t\tBookmark: v.Bookmark,\n\t}\n\tif v.Author != nil {\n\t\tres.Author = marshalDiscussionviewsPostAuthorViewToPostAuthorResponseBody(v.Author)\n\t}\n\tif v.Replies != nil {\n\t\tres.Replies = make([]*ThreadedPostResponseBody, len(v.Replies))\n\t\tfor i, val := range v.Replies {\n\t\t\tres.Replies[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func (o LookupInstanceResultOutput) Config() ConfigResponseOutput {\n\treturn o.ApplyT(func(v LookupInstanceResult) ConfigResponse { return v.Config }).(ConfigResponseOutput)\n}", "func EncodeConfigureResponse(_ context.Context, response interface{}) (interface{}, error) {\n\tresp := response.(endpoints.ConfigureResponse)\n\n\t// mounts\n\tvar mounts map[string]*pb.MountOutput\n\tif (resp.Mounts != nil) && (len(resp.Mounts) > 0) {\n\t\tmounts = make(map[string]*pb.MountOutput)\n\t\tfor k, v := range resp.Mounts {\n\t\t\tmountCfgOut := &pb.MountConfigOutput{\n\t\t\t\tDefaultLeaseTtl: uint32(v.Config.DefaultLeaseTTL),\n\t\t\t\tMaxLeaseTtl: uint32(v.Config.MaxLeaseTTL),\n\t\t\t}\n\n\t\t\tmountOut := &pb.MountOutput{\n\t\t\t\tType: v.Type,\n\t\t\t\tDescription: v.Description,\n\t\t\t\tConfig: mountCfgOut,\n\t\t\t}\n\n\t\t\tmounts[k] = mountOut\n\t\t}\n\t}\n\n\t// auths\n\tvar auths map[string]*pb.AuthMountOutput\n\tif (resp.Auths != nil) && (len(resp.Auths) > 0) {\n\t\tauths = make(map[string]*pb.AuthMountOutput)\n\t\tfor k, v := range resp.Auths {\n\t\t\tauthCfgOut := &pb.AuthConfigOutput{\n\t\t\t\tDefaultLeaseTtl: uint32(v.Config.DefaultLeaseTTL),\n\t\t\t\tMaxLeaseTtl: uint32(v.Config.MaxLeaseTTL),\n\t\t\t}\n\n\t\t\tauthMountOut := &pb.AuthMountOutput{\n\t\t\t\tType: v.Type,\n\t\t\t\tDescription: v.Description,\n\t\t\t\tConfig: authCfgOut,\n\t\t\t}\n\n\t\t\tauths[k] = authMountOut\n\t\t}\n\t}\n\n\t// policies\n\tvar policies []string\n\tif (resp.Policies != nil) && (len(resp.Policies) > 0) {\n\t\tpolicies = resp.Policies\n\t}\n\n\tstatus := &pb.ConfigStatus{\n\t\tConfigId: resp.ConfigID,\n\t\tMounts: mounts,\n\t\tAuths: auths,\n\t\tPolicies: policies,\n\t}\n\treturn &pb.ConfigureResponse{\n\t\tConfigStatus: status,\n\t\tErr: service.Error2String(resp.Err),\n\t}, nil\n}", "func (s StreamingPolicyWidevineConfiguration) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"customLicenseAcquisitionUrlTemplate\", s.CustomLicenseAcquisitionURLTemplate)\n\treturn json.Marshal(objectMap)\n}", "func ConfigView(wn eve.Node, vn gi3d.Node3D, sc *gi3d.Scene) {\n\twb := wn.AsNodeBase()\n\tvb := vn.(*gi3d.Group)\n\tvb.Pose.Pos = wb.Rel.Pos\n\tvb.Pose.Quat = wb.Rel.Quat\n\tbod := wn.AsBody()\n\tif bod != nil {\n\t\tif !vb.HasChildren() {\n\t\t\tsc.AddFmLibrary(bod.AsBodyBase().Vis, vb)\n\t\t}\n\t}\n}", "func (c CentralServerConfiguration) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"instanceCount\", c.InstanceCount)\n\tpopulate(objectMap, \"subnetId\", c.SubnetID)\n\tpopulate(objectMap, \"virtualMachineConfiguration\", c.VirtualMachineConfiguration)\n\treturn json.Marshal(objectMap)\n}", "func (o ServiceResponseOutput) EncryptionConfig() EncryptionConfigResponseOutput {\n\treturn o.ApplyT(func(v ServiceResponse) EncryptionConfigResponse { return v.EncryptionConfig }).(EncryptionConfigResponseOutput)\n}", "func (o ServiceResponseOutput) NetworkConfig() NetworkConfigResponseOutput {\n\treturn o.ApplyT(func(v ServiceResponse) NetworkConfigResponse { return v.NetworkConfig }).(NetworkConfigResponseOutput)\n}", "func (a *MaintenanceWindowApiService) StoreMaintenanceWindowConfigExecute(r ApiStoreMaintenanceWindowConfigRequest) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"MaintenanceWindowApiService.StoreMaintenanceWindowConfig\")\n\tif err != nil {\n\t\treturn nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/maintenance\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"*/*\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = r.maintenanceWindow\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif apiKey, ok := auth[\"Api-Token\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif apiKey.Prefix != \"\" {\n\t\t\t\t\tkey = apiKey.Prefix + \" \" + apiKey.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = apiKey.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v ErrorEnvelope\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "func (d DeploymentWithOSConfiguration) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"appLocation\", d.AppLocation)\n\tobjectMap[\"configurationType\"] = SAPConfigurationTypeDeploymentWithOSConfig\n\tpopulate(objectMap, \"infrastructureConfiguration\", d.InfrastructureConfiguration)\n\tpopulate(objectMap, \"osSapConfiguration\", d.OSSapConfiguration)\n\tpopulate(objectMap, \"softwareConfiguration\", d.SoftwareConfiguration)\n\treturn json.Marshal(objectMap)\n}", "func (client *WebAppsClient) getConfigurationHandleResponse(resp *http.Response) (WebAppsGetConfigurationResponse, error) {\n\tresult := WebAppsGetConfigurationResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResource); err != nil {\n\t\treturn WebAppsGetConfigurationResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "func (c *ClientWithResponses) SetConfigWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*SetConfigResponse, error) {\n\trsp, err := c.SetConfigWithBody(ctx, contentType, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseSetConfigResponse(rsp)\n}", "func (a ApplicationGatewayWebApplicationFirewallConfiguration) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"disabledRuleGroups\", a.DisabledRuleGroups)\n\tpopulate(objectMap, \"enabled\", a.Enabled)\n\tpopulate(objectMap, \"exclusions\", a.Exclusions)\n\tpopulate(objectMap, \"fileUploadLimitInMb\", a.FileUploadLimitInMb)\n\tpopulate(objectMap, \"firewallMode\", a.FirewallMode)\n\tpopulate(objectMap, \"maxRequestBodySize\", a.MaxRequestBodySize)\n\tpopulate(objectMap, \"maxRequestBodySizeInKb\", a.MaxRequestBodySizeInKb)\n\tpopulate(objectMap, \"requestBodyCheck\", a.RequestBodyCheck)\n\tpopulate(objectMap, \"ruleSetType\", a.RuleSetType)\n\tpopulate(objectMap, \"ruleSetVersion\", a.RuleSetVersion)\n\treturn json.Marshal(objectMap)\n}", "func ServerEncodeResponseBody(timeLayout string, format wrp.Format) gokithttp.EncodeResponseFunc {\n\treturn func(ctx context.Context, httpResponse http.ResponseWriter, value interface{}) error {\n\t\tvar (\n\t\t\twrpResponse = value.(wrpendpoint.Response)\n\t\t\toutput bytes.Buffer\n\t\t)\n\n\t\ttracinghttp.HeadersForSpans(timeLayout, httpResponse.Header(), wrpResponse.Spans()...)\n\n\t\tif err := wrpResponse.Encode(&output, format); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\thttpResponse.Header().Set(\"Content-Type\", format.ContentType())\n\t\t_, err := output.WriteTo(httpResponse)\n\t\treturn err\n\t}\n}", "func getcms(w http.ResponseWriter, r *http.Request) {\n w.Header().Set(\"Content-Type\", \"application/json\")\n json.NewEncoder(w).Encode(configurationmanagement)\n}", "func (s SAPConfiguration) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tobjectMap[\"configurationType\"] = s.ConfigurationType\n\treturn json.Marshal(objectMap)\n}", "func (a *MaintenanceWindowApiService) StoreMaintenanceWindowConfig(ctx _context.Context) ApiStoreMaintenanceWindowConfigRequest {\n\treturn ApiStoreMaintenanceWindowConfigRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func httpConfigDefaultHandler(w http.ResponseWriter, r *http.Request) {\n\tdefaultConfig := DefaultConfig()\n\tbody, err := yaml.Marshal(defaultConfig)\n\tif err != nil {\n\t\twriteError(w, http.StatusInternalServerError, \"default-config\", err)\n\t}\n\tw.Header().Set(\"Content-Type\", \"text/plain; charset=UTF-8\")\n\tw.Header().Set(\"Cache-Control\", \"no-store, no-cache, must-revalidate\")\n\tw.Header().Set(\"Pragma\", \"no-cache\")\n\tfmt.Fprintln(w, string(body))\n}", "func (client *WebAppsClient) updateConfigurationHandleResponse(resp *http.Response) (WebAppsUpdateConfigurationResponse, error) {\n\tresult := WebAppsUpdateConfigurationResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResource); err != nil {\n\t\treturn WebAppsUpdateConfigurationResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "func EncodeStationMetaResponse(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.(*sensor.StationMetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (o LinuxWebAppOutput) SiteConfig() LinuxWebAppSiteConfigOutput {\n\treturn o.ApplyT(func(v *LinuxWebApp) LinuxWebAppSiteConfigOutput { return v.SiteConfig }).(LinuxWebAppSiteConfigOutput)\n}", "func (o *SyntheticsPrivateLocationCreationResponse) GetConfigOk() (*interface{}, bool) {\n\tif o == nil || o.Config == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Config, true\n}", "func marshalMatchesviewsRatingResourceViewToRatingResourceResponseBody(v *matchesviews.RatingResourceView) *RatingResourceResponseBody {\n\tres := &RatingResourceResponseBody{\n\t\tRrn: *v.Rrn,\n\t}\n\tif v.Rating != nil {\n\t\tres.Rating = marshalMatchesviewsRatingViewToRatingResponseBody(v.Rating)\n\t}\n\n\treturn res\n}", "func (client *WebAppsClient) getConfigurationSlotHandleResponse(resp *http.Response) (WebAppsGetConfigurationSlotResponse, error) {\n\tresult := WebAppsGetConfigurationSlotResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResource); err != nil {\n\t\treturn WebAppsGetConfigurationSlotResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "func ValidateStationModuleResponseBody(body *StationModuleResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.Position == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"position\", \"body\"))\n\t}\n\tif body.Flags == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"flags\", \"body\"))\n\t}\n\tif body.Internal == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"internal\", \"body\"))\n\t}\n\tif body.Sensors == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"sensors\", \"body\"))\n\t}\n\tfor _, e := range body.Sensors {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateStationSensorResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func GetConfigHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tconfigName := ps.ByName(\"config\")\n\n\tconfiguration, err := ubus.UciGetConfig(uci.ConfigType(configName))\n\tif err != nil {\n\t\trend.JSON(w, http.StatusOK, map[string]string{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\trend.JSON(w, http.StatusOK, configuration)\n}", "func (app *App) ApplyTKGConfigForVsphere(params vsphere.ApplyTKGConfigForVsphereParams) middleware.Responder { // nolint:dupl\n\tconfig, err := tkgconfigproviders.New(app.AppConfig.TKGConfigDir, app.TKGConfigReaderWriter).NewVSphereConfig(params.Params)\n\tif err != nil {\n\t\treturn vsphere.NewApplyTKGConfigForVsphereInternalServerError().WithPayload(Err(err))\n\t}\n\n\terr = tkgconfigupdater.SaveConfig(app.getFilePathForSavingConfig(), app.TKGConfigReaderWriter, config)\n\tif err != nil {\n\t\treturn vsphere.NewApplyTKGConfigForVsphereInternalServerError().WithPayload(Err(err))\n\t}\n\treturn vsphere.NewApplyTKGConfigForVsphereOK().WithPayload(&models.ConfigFileInfo{Path: app.getFilePathForSavingConfig()})\n}", "func (client *WebAppsClient) updateConfigurationSlotHandleResponse(resp *http.Response) (WebAppsUpdateConfigurationSlotResponse, error) {\n\tresult := WebAppsUpdateConfigurationSlotResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResource); err != nil {\n\t\treturn WebAppsUpdateConfigurationSlotResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "func CreatePublishLiveStagingConfigToProductionResponse() (response *PublishLiveStagingConfigToProductionResponse) {\n\tresponse = &PublishLiveStagingConfigToProductionResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "func (c *Config) WritePayload(w io.Writer, payload interface{}) error {\n\tjsonConf, err := json.Marshal(payload)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to marshal payload: %s\", err)\n\t}\n\n\tc.config.jsonConfSize = C.uint(len(jsonConf))\n\tc.config.nsPathSize = C.uint(len(c.nsPath))\n\tcconfPayload := C.GoBytes(unsafe.Pointer(c.config), C.sizeof_struct_cConfig)\n\tcconfPayload = append(cconfPayload, c.nsPath...)\n\tcconfPayload = append(cconfPayload, jsonConf...)\n\n\tif n, err := w.Write(cconfPayload); err != nil || n != len(cconfPayload) {\n\t\treturn fmt.Errorf(\"failed to write payload: %s\", err)\n\t}\n\treturn nil\n}", "func (a ApplicationGatewayRedirectConfiguration) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"etag\", a.Etag)\n\tpopulate(objectMap, \"id\", a.ID)\n\tpopulate(objectMap, \"name\", a.Name)\n\tpopulate(objectMap, \"properties\", a.Properties)\n\tpopulate(objectMap, \"type\", a.Type)\n\treturn json.Marshal(objectMap)\n}", "func (o ClusterOutput) GatewayApiConfig() ClusterGatewayApiConfigOutput {\n\treturn o.ApplyT(func(v *Cluster) ClusterGatewayApiConfigOutput { return v.GatewayApiConfig }).(ClusterGatewayApiConfigOutput)\n}", "func (x *Rest) ConfigurationShow(w http.ResponseWriter, r *http.Request,\n\tparams httprouter.Params) {\n\tdefer panicCatcher(w)\n\n\trequest := msg.New(r, params)\n\trequest.Section = msg.SectionConfiguration\n\trequest.Action = msg.ActionShow\n\trequest.Configuration.ID = strings.ToLower(params.ByName(`ID`))\n\n\tif _, err := uuid.FromString(request.Configuration.ID); err != nil {\n\t\tx.replyBadRequest(&w, &request, err)\n\t\treturn\n\t}\n\n\tif !x.isAuthorized(&request) {\n\t\tx.replyForbidden(&w, &request, nil)\n\t\treturn\n\t}\n\n\thandler := x.handlerMap.Get(`configuration_r`)\n\thandler.Intake() <- request\n\tresult := <-request.Reply\n\tx.respond(&w, &result)\n}", "func (client *WebAppsClient) getConfigurationSnapshotHandleResponse(resp *http.Response) (WebAppsGetConfigurationSnapshotResponse, error) {\n\tresult := WebAppsGetConfigurationSnapshotResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResource); err != nil {\n\t\treturn WebAppsGetConfigurationSnapshotResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "func (client *Client) sapDiskConfigurationsHandleResponse(resp *http.Response) (ClientSAPDiskConfigurationsResponse, error) {\n\tresult := ClientSAPDiskConfigurationsResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SAPDiskConfigurationsResult); err != nil {\n\t\treturn ClientSAPDiskConfigurationsResponse{}, err\n\t}\n\treturn result, nil\n}", "func renderOVNFlowsConfig(bootstrapResult *bootstrap.BootstrapResult, data *render.RenderData) {\n\tflows := bootstrapResult.OVN.FlowsConfig\n\tif flows == nil {\n\t\treturn\n\t}\n\tif flows.Target == \"\" {\n\t\tklog.Warningf(\"ovs-flows-config configmap 'target' field can't be empty. Ignoring configuration: %+v\", flows)\n\t\treturn\n\t}\n\t// if IPFIX collectors are provided by means of both the operator configuration and the\n\t// ovs-flows-config ConfigMap, we will merge both targets\n\tif colls, ok := data.Data[\"IPFIXCollectors\"].(string); !ok || colls == \"\" {\n\t\tdata.Data[\"IPFIXCollectors\"] = flows.Target\n\t} else {\n\t\tdata.Data[\"IPFIXCollectors\"] = colls + \",\" + flows.Target\n\t}\n\tif flows.CacheMaxFlows != nil {\n\t\tdata.Data[\"IPFIXCacheMaxFlows\"] = *flows.CacheMaxFlows\n\t}\n\tif flows.Sampling != nil {\n\t\tdata.Data[\"IPFIXSampling\"] = *flows.Sampling\n\t}\n\tif flows.CacheActiveTimeout != nil {\n\t\tdata.Data[\"IPFIXCacheActiveTimeout\"] = *flows.CacheActiveTimeout\n\t}\n}", "func (o HttpFilterConfigResponseOutput) ConfigTypeUrl() pulumi.StringOutput {\n\treturn o.ApplyT(func(v HttpFilterConfigResponse) string { return v.ConfigTypeUrl }).(pulumi.StringOutput)\n}", "func unmarshalWindResponseBodyToLogWind(v *WindResponseBody) *log.Wind {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &log.Wind{\n\t\tSpeed: v.Speed,\n\t\tDirection: v.Direction,\n\t\tUnit: v.Unit,\n\t}\n\n\treturn res\n}", "func sessionConfigurationPayloadDisplay(data *messages.SignalConfigs) {\n\tvar result string = \"\\n\"\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"session-id\", data.MitigatingConfig.SessionId)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"heartbeat-interval\", data.MitigatingConfig.HeartbeatInterval)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"missing-hb-allowed\", data.MitigatingConfig.MissingHbAllowed)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"max-retransmit\", data.MitigatingConfig.MaxRetransmit)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"ack-timeout\", data.MitigatingConfig.AckTimeout)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"ack-random-factor\", data.MitigatingConfig.AckRandomFactor)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"heartbeat-interval-idle\", data.IdleConfig.HeartbeatInterval)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"missing-hb-allowed-idle\", data.IdleConfig.MissingHbAllowed)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"max-retransmit-idle\", data.IdleConfig.MaxRetransmit)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %d\\n\", \"ack-timeout-idle\", data.IdleConfig.AckTimeout)\n\tresult += fmt.Sprintf(\" \\\"%s\\\": %f\\n\", \"ack-random-factor-idle\", data.IdleConfig.AckRandomFactor)\n\tlog.Infoln(result)\n}", "func (client *WebAppsClient) getDiagnosticLogsConfigurationHandleResponse(resp *http.Response) (WebAppsGetDiagnosticLogsConfigurationResponse, error) {\n\tresult := WebAppsGetDiagnosticLogsConfigurationResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SiteLogsConfig); err != nil {\n\t\treturn WebAppsGetDiagnosticLogsConfigurationResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "func (d DeploymentConfiguration) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"appLocation\", d.AppLocation)\n\tobjectMap[\"configurationType\"] = SAPConfigurationTypeDeployment\n\tpopulate(objectMap, \"infrastructureConfiguration\", d.InfrastructureConfiguration)\n\tpopulate(objectMap, \"softwareConfiguration\", d.SoftwareConfiguration)\n\treturn json.Marshal(objectMap)\n}", "func NewSigninResponseBody(res *securedviews.GoaJWTView) *SigninResponseBody {\n\tbody := &SigninResponseBody{\n\t\tAuthorization: *res.Authorization,\n\t}\n\treturn body\n}", "func (o FunctionOutput) BuildConfig() BuildConfigResponseOutput {\n\treturn o.ApplyT(func(v *Function) BuildConfigResponseOutput { return v.BuildConfig }).(BuildConfigResponseOutput)\n}", "func (c *Config) MarshalJSON() ([]byte, error) {\n\ttype Alias Config\n\tjson := jsoniter.ConfigFastest // TODO make configurable?\n\treturn json.Marshal(&struct {\n\t\tMonitorConfigPollingIntervalMs uint64 `json:\"monitor_config_polling_interval_ms\"`\n\t\tHTTPTimeoutMS uint64 `json:\"http_timeout_ms\"`\n\t\tHealthFlushIntervalMs uint64 `json:\"health_flush_interval_ms\"`\n\t\tStatFlushIntervalMs uint64 `json:\"stat_flush_interval_ms\"`\n\t\tStatBufferIntervalMs uint64 `json:\"stat_buffer_interval_ms\"`\n\t\tServeReadTimeoutMs uint64 `json:\"serve_read_timeout_ms\"`\n\t\tServeWriteTimeoutMs uint64 `json:\"serve_write_timeout_ms\"`\n\t\t*Alias\n\t}{\n\t\tMonitorConfigPollingIntervalMs: uint64(c.MonitorConfigPollingInterval / time.Millisecond),\n\t\tHTTPTimeoutMS: uint64(c.HTTPTimeout / time.Millisecond),\n\t\tHealthFlushIntervalMs: uint64(c.HealthFlushInterval / time.Millisecond),\n\t\tStatFlushIntervalMs: uint64(c.StatFlushInterval / time.Millisecond),\n\t\tStatBufferIntervalMs: uint64(c.StatBufferInterval / time.Millisecond),\n\t\tAlias: (*Alias)(c),\n\t})\n}", "func (s *Server) SetView(view *gview.View) {\n\ts.config.View = view\n}", "func (client *WebAppsClient) createOrUpdateConfigurationHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateConfigurationResponse, error) {\n\tresult := WebAppsCreateOrUpdateConfigurationResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResource); err != nil {\n\t\treturn WebAppsCreateOrUpdateConfigurationResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}" ]
[ "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.56652105", "0.5510659", "0.5510659", "0.53321564", "0.53321564", "0.48552376", "0.48438388", "0.47826838", "0.4643969", "0.4544846", "0.4450413", "0.43487146", "0.43276998", "0.43153086", "0.42396322", "0.42049733", "0.4202092", "0.41905692", "0.4166802", "0.4165274", "0.41634104", "0.41369072", "0.4132728", "0.4125252", "0.40816793", "0.40737197", "0.4061169", "0.40608382", "0.40490198", "0.4043481", "0.40342107", "0.4019957", "0.39923328", "0.39888012", "0.39587274", "0.3957908", "0.39453897", "0.3939804", "0.39382216", "0.39338708", "0.3913007", "0.39128196", "0.39060345", "0.38858595", "0.38839024", "0.38747585", "0.38735956", "0.38726705", "0.38708216", "0.38611627", "0.38545132", "0.38523653", "0.38485903", "0.38472506", "0.3832427", "0.3826202", "0.3821133", "0.38018885", "0.37992787", "0.37984738", "0.37955374", "0.3794411", "0.37722024", "0.37721196", "0.37710822", "0.37639323", "0.37599143", "0.37474653", "0.37424672", "0.37372363", "0.37356538", "0.37308228", "0.37257218", "0.37237564", "0.37230355", "0.37213704", "0.3714152", "0.37076437", "0.3707532" ]
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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t\tFullKey: *v.FullKey,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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 = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Reading != nil {\n\t\tres.Reading = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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 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\tfor i, val := range v.Shape {\n\t\t\tres.Shape[i] = make([][]float64, len(val))\n\t\t\tfor j, val := range val {\n\t\t\t\tres.Shape[i][j] = make([]float64, len(val))\n\t\t\t\tfor k, val := range val {\n\t\t\t\t\tres.Shape[i][j][k] = val\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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))\n\t\tfor i, val := range v.Precise {\n\t\t\tres.Precise[i] = val\n\t\t}\n\t}\n\tif v.Regions != nil {\n\t\tres.Regions = make([]*StationRegionResponseBody, len(v.Regions))\n\t\tfor i, val := range v.Regions {\n\t\t\tres.Regions[i] = marshalStationviewsStationRegionViewToStationRegionResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsEssentialStationViewToEssentialStationResponseBody(v *stationviews.EssentialStationView) *EssentialStationResponseBody {\n\tres := &EssentialStationResponseBody{\n\t\tID: *v.ID,\n\t\tDeviceID: *v.DeviceID,\n\t\tName: *v.Name,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tLastIngestionAt: v.LastIngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v *stationviews.StationDataSummaryView) *StationDataSummaryResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &StationDataSummaryResponseBody{\n\t\tStart: *v.Start,\n\t\tEnd: *v.End,\n\t\tNumberOfSamples: *v.NumberOfSamples,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdated: *v.Updated,\n\t\tLocationName: v.LocationName,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Images != nil {\n\t\tres.Images = make([]*ImageRefResponseBody, len(v.Images))\n\t\tfor i, val := range v.Images {\n\t\t\tres.Images[i] = marshalStationviewsImageRefViewToImageRefResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tLocationName: v.LocationName,\n\t\tPlaceNameOther: v.PlaceNameOther,\n\t\tPlaceNameNative: v.PlaceNameNative,\n\t\tSyncedAt: v.SyncedAt,\n\t\tIngestionAt: v.IngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\tif v.Data != nil {\n\t\tres.Data = marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v.Data)\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationJobViewToStationJobResponseBody(v *stationviews.StationJobView) *StationJobResponseBody {\n\tres := &StationJobResponseBody{\n\t\tTitle: *v.Title,\n\t\tStartedAt: *v.StartedAt,\n\t\tCompletedAt: v.CompletedAt,\n\t\tProgress: *v.Progress,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "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.StationPhotosView) *StationPhotosResponseBody {\n\tres := &StationPhotosResponseBody{\n\t\tSmall: *v.Small,\n\t}\n\n\treturn res\n}", "func ValidateStationModuleResponseBody(body *StationModuleResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.Position == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"position\", \"body\"))\n\t}\n\tif body.Flags == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"flags\", \"body\"))\n\t}\n\tif body.Internal == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"internal\", \"body\"))\n\t}\n\tif body.Sensors == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"sensors\", \"body\"))\n\t}\n\tfor _, e := range body.Sensors {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateStationSensorResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func marshalInventoryviewsWarehouseViewToWarehouseResponseBody(v *inventoryviews.WarehouseView) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tCode: *v.Code,\n\t\tAddress: *v.Address,\n\t\tType: *v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func marshalStationviewsImageRefViewToImageRefResponseBody(v *stationviews.ImageRefView) *ImageRefResponseBody {\n\tres := &ImageRefResponseBody{\n\t\tURL: *v.URL,\n\t}\n\n\treturn res\n}", "func marshalMatchesviewsRatingViewToRatingResponseBody(v *matchesviews.RatingView) *RatingResponseBody {\n\tres := &RatingResponseBody{\n\t\tStrength: *v.Strength,\n\t\tLower: *v.Lower,\n\t\tUpper: *v.Upper,\n\t}\n\n\treturn res\n}", "func ServerEncodeResponseBody(timeLayout string, format wrp.Format) gokithttp.EncodeResponseFunc {\n\treturn func(ctx context.Context, httpResponse http.ResponseWriter, value interface{}) error {\n\t\tvar (\n\t\t\twrpResponse = value.(wrpendpoint.Response)\n\t\t\toutput bytes.Buffer\n\t\t)\n\n\t\ttracinghttp.HeadersForSpans(timeLayout, httpResponse.Header(), wrpResponse.Spans()...)\n\n\t\tif err := wrpResponse.Encode(&output, format); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\thttpResponse.Header().Set(\"Content-Type\", format.ContentType())\n\t\t_, err := output.WriteTo(httpResponse)\n\t\treturn err\n\t}\n}", "func NewUpdateResponseBody(res *warehouseviews.WarehouseView) *UpdateResponseBody {\n\tbody := &UpdateResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func marshalVironAPIViewToVironAPIResponseBody(v *vironviews.VironAPIView) *VironAPIResponseBody {\n\tres := &VironAPIResponseBody{\n\t\tMethod: *v.Method,\n\t\tPath: *v.Path,\n\t}\n\n\treturn res\n}", "func GetModuleValue(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tvars := mux.Vars(r)\n\tid, err := strconv.Atoi(vars[\"id\"])\n\n\t// This shouldn't happen since the mux only accepts numbers to this route\n\tif err != nil {\n\t\thttp.Error(w, \"Invalid Id, please try again.\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tmodules := hardware.GetModules()\n\tmodule, err := getModuleByID(modules, id)\n\n\tif err != nil {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\tvalues := hardware.ReadStatus(module.Pin)\n\tvar sens sensor\n\tsens.Name = module.Name\n\tsens.Description = module.Description\n\tsens.ID = module.ID\n\tsens.Pin = module.Pin\n\tsens.Type = module.Type\n\tsens.Values = values\n\tfmt.Println(values)\n\tenc := json.NewEncoder(w)\n\terr = enc.Encode(sens)\n}", "func ValidateStationConfigurationResponseBody(body *StationConfigurationResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.ProvisionID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"provision_id\", \"body\"))\n\t}\n\tif body.Time == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"time\", \"body\"))\n\t}\n\tif body.Modules == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"modules\", \"body\"))\n\t}\n\tfor _, e := range body.Modules {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateStationModuleResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func marshalInventoryviewsProductViewToProductResponseBody(v *inventoryviews.ProductView) *ProductResponseBody {\n\tres := &ProductResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tUnit: *v.Unit,\n\t\tCostPrice: *v.CostPrice,\n\t\tMarketPrice: *v.MarketPrice,\n\t\tNote: *v.Note,\n\t\tImage: *v.Image,\n\t\tCode: *v.Code,\n\t\tSize: *v.Size,\n\t\tType: *v.Type,\n\t\tIsShelves: *v.IsShelves,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func marshalInventoryWarehouseToWarehouseResponseBody(v *inventory.Warehouse) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t\tCode: v.Code,\n\t\tAddress: v.Address,\n\t\tType: v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryFounderToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func unmarshalComponentResponseBodyToStorageviewsComponentView(v *ComponentResponseBody) *storageviews.ComponentView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &storageviews.ComponentView{\n\t\tVarietal: v.Varietal,\n\t\tPercentage: v.Percentage,\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsFounderViewToFounderResponseBody(v *inventoryviews.FounderView) *FounderResponseBody {\n\tres := &FounderResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func NewGetResponseBody(res *warehouseviews.WarehouseView) *GetResponseBody {\n\tbody := &GetResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func NewSigninResponseBody(res *securedviews.GoaJWTView) *SigninResponseBody {\n\tbody := &SigninResponseBody{\n\t\tAuthorization: *res.Authorization,\n\t}\n\treturn body\n}", "func EncodeStationMetaResponse(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.(*sensor.StationMetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func unmarshalWineryResponseBodyToStorageviewsWineryView(v *WineryResponseBody) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(v *discussionviews.ThreadedPostView) *ThreadedPostResponseBody {\n\tres := &ThreadedPostResponseBody{\n\t\tID: *v.ID,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tBody: *v.Body,\n\t\tBookmark: v.Bookmark,\n\t}\n\tif v.Author != nil {\n\t\tres.Author = marshalDiscussionviewsPostAuthorViewToPostAuthorResponseBody(v.Author)\n\t}\n\tif v.Replies != nil {\n\t\tres.Replies = make([]*ThreadedPostResponseBody, len(v.Replies))\n\t\tfor i, val := range v.Replies {\n\t\t\tres.Replies[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsHeadViewToHeadResponseBody(v *inventoryviews.HeadView) *HeadResponseBody {\n\tres := &HeadResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func NewProjectResponseBody(res *discussionviews.DiscussionView) *ProjectResponseBody {\n\tbody := &ProjectResponseBody{}\n\tif res.Posts != nil {\n\t\tbody.Posts = make([]*ThreadedPostResponseBody, len(res.Posts))\n\t\tfor i, val := range res.Posts {\n\t\t\tbody.Posts[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func (c *Client) UpdateModule(ctx context.Context, p *UpdateModulePayload) (res *StationFull, err error) {\n\tvar ires interface{}\n\tires, err = c.UpdateModuleEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(*StationFull), nil\n}", "func NewAdminSigninResponseBody(res *adminviews.JeeekAdminSigninView) *AdminSigninResponseBody {\n\tbody := &AdminSigninResponseBody{\n\t\tToken: *res.Token,\n\t}\n\treturn body\n}", "func ValueHTTPResponseBody(ctx context.Context) interface{} {\n\treturn ctx.Value(contextHTTPResponseBodyFields)\n}", "func NewStatusResponseBody(res *spinbroker.StatusResult) *StatusResponseBody {\n\tbody := &StatusResponseBody{\n\t\tStatus: res.Status,\n\t\tReason: res.Reason,\n\t\tCauser: res.Causer,\n\t}\n\treturn body\n}", "func NewVironMenuResponseBody(res *vironviews.VironMenuView) *VironMenuResponseBody {\n\tbody := &VironMenuResponseBody{\n\t\tName: *res.Name,\n\t\tThumbnail: res.Thumbnail,\n\t\tColor: res.Color,\n\t\tTheme: res.Theme,\n\t}\n\tif res.Tags != nil {\n\t\tbody.Tags = make([]string, len(res.Tags))\n\t\tfor i, val := range res.Tags {\n\t\t\tbody.Tags[i] = val\n\t\t}\n\t}\n\tif res.Pages != nil {\n\t\tbody.Pages = make([]*VironPageResponseBody, len(res.Pages))\n\t\tfor i, val := range res.Pages {\n\t\t\tbody.Pages[i] = &VironPageResponseBody{\n\t\t\t\tID: *val.ID,\n\t\t\t\tName: *val.Name,\n\t\t\t\tSection: *val.Section,\n\t\t\t\tGroup: val.Group,\n\t\t\t}\n\t\t\tif val.Components != nil {\n\t\t\t\tbody.Pages[i].Components = make([]*VironComponentResponseBody, len(val.Components))\n\t\t\t\tfor j, val := range val.Components {\n\t\t\t\t\tbody.Pages[i].Components[j] = &VironComponentResponseBody{\n\t\t\t\t\t\tName: *val.Name,\n\t\t\t\t\t\tStyle: *val.Style,\n\t\t\t\t\t\tUnit: val.Unit,\n\t\t\t\t\t\tPagination: val.Pagination,\n\t\t\t\t\t\tPrimary: val.Primary,\n\t\t\t\t\t\tAutoRefreshSec: val.AutoRefreshSec,\n\t\t\t\t\t}\n\t\t\t\t\tif val.Actions != nil {\n\t\t\t\t\t\tbody.Pages[i].Components[j].Actions = make([]string, len(val.Actions))\n\t\t\t\t\t\tfor k, val := range val.Actions {\n\t\t\t\t\t\t\tbody.Pages[i].Components[j].Actions[k] = val\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif val.API != nil {\n\t\t\t\t\t\tbody.Pages[i].Components[j].API = marshalVironAPIViewToVironAPIResponseBody(val.API)\n\t\t\t\t\t}\n\t\t\t\t\tif val.TableLabels != nil {\n\t\t\t\t\t\tbody.Pages[i].Components[j].TableLabels = make([]string, len(val.TableLabels))\n\t\t\t\t\t\tfor k, val := range val.TableLabels {\n\t\t\t\t\t\t\tbody.Pages[i].Components[j].TableLabels[k] = val\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif val.Query != nil {\n\t\t\t\t\t\tbody.Pages[i].Components[j].Query = make([]*VironQueryResponseBody, len(val.Query))\n\t\t\t\t\t\tfor k, val := range val.Query {\n\t\t\t\t\t\t\tbody.Pages[i].Components[j].Query[k] = &VironQueryResponseBody{\n\t\t\t\t\t\t\t\tKey: *val.Key,\n\t\t\t\t\t\t\t\tType: *val.Type,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn body\n}", "func NewListResponseBody(res *stepviews.StoredListOfStepsView) *ListResponseBody {\n\tbody := &ListResponseBody{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Steps != nil {\n\t\tbody.Steps = make([]*StoredStepResponseBody, len(res.Steps))\n\t\tfor i, val := range res.Steps {\n\t\t\tbody.Steps[i] = marshalStepviewsStoredStepViewToStoredStepResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func NewCreateResponseBody(res *warehouseviews.WarehouseView) *CreateResponseBody {\n\tbody := &CreateResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func BuildUpdateModulePayload(stationUpdateModuleBody string, stationUpdateModuleID string, stationUpdateModuleModuleID string, stationUpdateModuleAuth string) (*station.UpdateModulePayload, error) {\n\tvar err error\n\tvar body UpdateModuleRequestBody\n\t{\n\t\terr = json.Unmarshal([]byte(stationUpdateModuleBody), &body)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid JSON for body, \\nerror: %s, \\nexample of valid JSON:\\n%s\", err, \"'{\\n \\\"label\\\": \\\"Non placeat aliquam sit.\\\"\\n }'\")\n\t\t}\n\t}\n\tvar id int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(stationUpdateModuleID, 10, 32)\n\t\tid = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for id, must be INT32\")\n\t\t}\n\t}\n\tvar moduleID int32\n\t{\n\t\tvar v int64\n\t\tv, err = strconv.ParseInt(stationUpdateModuleModuleID, 10, 32)\n\t\tmoduleID = int32(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for moduleID, must be INT32\")\n\t\t}\n\t}\n\tvar auth string\n\t{\n\t\tauth = stationUpdateModuleAuth\n\t}\n\tv := &station.UpdateModulePayload{\n\t\tLabel: body.Label,\n\t}\n\tv.ID = id\n\tv.ModuleID = moduleID\n\tv.Auth = auth\n\n\treturn v, nil\n}", "func marshalMatchesviewsRatingResourceViewToRatingResourceResponseBody(v *matchesviews.RatingResourceView) *RatingResourceResponseBody {\n\tres := &RatingResourceResponseBody{\n\t\tRrn: *v.Rrn,\n\t}\n\tif v.Rating != nil {\n\t\tres.Rating = marshalMatchesviewsRatingViewToRatingResponseBody(v.Rating)\n\t}\n\n\treturn res\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func marshalRxRecipeResponseBodyToRxRecipeView(v *RxRecipeResponseBody) *recipeviews.RxRecipeView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &recipeviews.RxRecipeView{\n\t\tID: v.ID,\n\t\tTitle: v.Title,\n\t\tDescription: v.Description,\n\t\tVersion: v.Version,\n\t\tFavorite: v.Favorite,\n\t\tRating: v.Rating,\n\t\tDifficulty: v.Difficulty,\n\t\tState: v.State,\n\t\tComplete: v.Complete,\n\t}\n\tif v.Ingredients != nil {\n\t\tres.Ingredients = marshalIngredientListResponseBodyToIngredientListView(v.Ingredients)\n\t}\n\n\treturn res\n}", "func marshalPostsPostOutputToPostOutputResponseBody(v *posts.PostOutput) *PostOutputResponseBody {\n\tres := &PostOutputResponseBody{\n\t\tID: v.ID,\n\t\tTitle: v.Title,\n\t\tDescription: v.Description,\n\t\tScreenImageURL: v.ScreenImageURL,\n\t}\n\n\treturn res\n}", "func ValidateStationSensorResponseBody(body *StationSensorResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.UnitOfMeasure == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"unit_of_measure\", \"body\"))\n\t}\n\tif body.Key == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"key\", \"body\"))\n\t}\n\tif body.Ranges == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"ranges\", \"body\"))\n\t}\n\tif body.Reading != nil {\n\t\tif err2 := ValidateSensorReadingResponseBody(body.Reading); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\tfor _, e := range body.Ranges {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateSensorRangeResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func NewDeviceLayoutResponseViewOK(body *DeviceLayoutResponseBody) *informationviews.DeviceLayoutResponseView {\n\tv := &informationviews.DeviceLayoutResponseView{}\n\tv.Configurations = make([]*informationviews.StationConfigurationView, len(body.Configurations))\n\tfor i, val := range body.Configurations {\n\t\tv.Configurations[i] = unmarshalStationConfigurationResponseBodyToInformationviewsStationConfigurationView(val)\n\t}\n\tv.Sensors = make(map[string][]*informationviews.StationSensorView, len(body.Sensors))\n\tfor key, val := range body.Sensors {\n\t\ttk := key\n\t\ttv := make([]*informationviews.StationSensorView, len(val))\n\t\tfor i, val := range val {\n\t\t\ttv[i] = unmarshalStationSensorResponseBodyToInformationviewsStationSensorView(val)\n\t\t}\n\t\tv.Sensors[tk] = tv\n\t}\n\n\treturn v\n}", "func unmarshalWindResponseBodyToLogWind(v *WindResponseBody) *log.Wind {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &log.Wind{\n\t\tSpeed: v.Speed,\n\t\tDirection: v.Direction,\n\t\tUnit: v.Unit,\n\t}\n\n\treturn res\n}", "func unmarshalWarehouseResponseBodyToWarehouseWarehouse(v *WarehouseResponseBody) *warehouse.Warehouse {\n\tres := &warehouse.Warehouse{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tCode: *v.Code,\n\t\tAddress: *v.Address,\n\t\tType: *v.Type,\n\t}\n\tres.Founder = unmarshalFounderResponseBodyToWarehouseFounder(v.Founder)\n\n\treturn res\n}", "func marshalDiscussionThreadedPostToThreadedPostResponseBody(v *discussion.ThreadedPost) *ThreadedPostResponseBody {\n\tres := &ThreadedPostResponseBody{\n\t\tID: v.ID,\n\t\tCreatedAt: v.CreatedAt,\n\t\tUpdatedAt: v.UpdatedAt,\n\t\tBody: v.Body,\n\t\tBookmark: v.Bookmark,\n\t}\n\tif v.Author != nil {\n\t\tres.Author = marshalDiscussionPostAuthorToPostAuthorResponseBody(v.Author)\n\t}\n\tif v.Replies != nil {\n\t\tres.Replies = make([]*ThreadedPostResponseBody, len(v.Replies))\n\t\tfor i, val := range v.Replies {\n\t\t\tres.Replies[i] = marshalDiscussionThreadedPostToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func NewGetUserResponseBody(res *userviews.UserView) *GetUserResponseBody {\n\tbody := &GetUserResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tEmail: *res.Email,\n\t\tScore: res.Score,\n\t}\n\treturn body\n}", "func NewAddResponseBody(res *stepviews.ResultStepView) *AddResponseBody {\n\tbody := &AddResponseBody{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Step != nil {\n\t\tbody.Step = marshalStepviewsStoredStepViewToStoredStepResponseBody(res.Step)\n\t}\n\treturn body\n}", "func NewAdminGetUserResponseBody(res *adminviews.JeeekUserView) *AdminGetUserResponseBody {\n\tbody := &AdminGetUserResponseBody{\n\t\tUserID: *res.UserID,\n\t\tUserName: *res.UserName,\n\t\tEmailAddress: *res.EmailAddress,\n\t\tPhoneNumber: *res.PhoneNumber,\n\t\tPhotoURL: *res.PhotoURL,\n\t\tEmailVerified: *res.EmailVerified,\n\t}\n\treturn body\n}", "func NewAdminUpdateUserResponseBody(res *adminviews.JeeekUserView) *AdminUpdateUserResponseBody {\n\tbody := &AdminUpdateUserResponseBody{\n\t\tUserID: *res.UserID,\n\t\tUserName: *res.UserName,\n\t\tEmailAddress: *res.EmailAddress,\n\t\tPhoneNumber: *res.PhoneNumber,\n\t\tPhotoURL: *res.PhotoURL,\n\t\tEmailVerified: *res.EmailVerified,\n\t}\n\treturn body\n}", "func HTTPResponseBodyContent(val string) zap.Field {\n\treturn zap.String(FieldHTTPResponseBodyContent, val)\n}", "func (controller *BuoyController) RetrieveStationJSON() {\n\tbuoyStations, err := buoyService.AllStation(&controller.Service)\n\n\tif err != nil {\n\t\tcontroller.ServeError(err)\n\t\treturn\n\t}\n\n\tcontroller.Data[\"json\"] = buoyStations\n\tcontroller.ServeJSON()\n}", "func NewProjectUnauthorizedResponseBody(res *goa.ServiceError) *ProjectUnauthorizedResponseBody {\n\tbody := &ProjectUnauthorizedResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "func (client *WebAppsClient) getInstanceProcessModuleHandleResponse(resp *http.Response) (WebAppsGetInstanceProcessModuleResponse, error) {\n\tresult := WebAppsGetInstanceProcessModuleResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ProcessModuleInfo); err != nil {\n\t\treturn WebAppsGetInstanceProcessModuleResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "func EncodeNeatThingTodayResponse(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.(*neatthingviews.NeatThing)\n\t\tw.Header().Set(\"goa-view\", res.View)\n\t\tenc := encoder(ctx, w)\n\t\tvar body interface{}\n\t\tswitch res.View {\n\t\tcase \"default\", \"\":\n\t\t\tbody = NewNeatThingTodayResponseBody(res.Projected)\n\t\tcase \"full\":\n\t\t\tbody = NewNeatThingTodayResponseBodyFull(res.Projected)\n\t\tcase \"name\":\n\t\t\tbody = NewNeatThingTodayResponseBodyName(res.Projected)\n\t\tcase \"name+definition\":\n\t\t\tbody = NewNeatThingTodayResponseBodyNameDefinition(res.Projected)\n\t\tcase \"name+link\":\n\t\t\tbody = NewNeatThingTodayResponseBodyNameLink(res.Projected)\n\t\t}\n\t\tw.WriteHeader(http.StatusNoContent)\n\t\treturn enc.Encode(body)\n\t}\n}", "func newBattlestreamingresultView(res *Battlestreamingresult) *shiritoriviews.BattlestreamingresultView {\n\tvres := &shiritoriviews.BattlestreamingresultView{\n\t\tType: &res.Type,\n\t\tTimestamp: &res.Timestamp,\n\t}\n\tif res.MessagePayload != nil {\n\t\tvres.MessagePayload = transformMessagePayloadToShiritoriviewsMessagePayloadView(res.MessagePayload)\n\t}\n\treturn vres\n}", "func NewDataResponseBody(res *discussionviews.DiscussionView) *DataResponseBody {\n\tbody := &DataResponseBody{}\n\tif res.Posts != nil {\n\t\tbody.Posts = make([]*ThreadedPostResponseBody, len(res.Posts))\n\t\tfor i, val := range res.Posts {\n\t\t\tbody.Posts[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func NewNextResponseBody(res *spinbroker.NextResult) *NextResponseBody {\n\tbody := &NextResponseBody{\n\t\tUUID: res.UUID,\n\t\tResource: res.Resource,\n\t\tAction: res.Action,\n\t}\n\tif res.Parameters != nil {\n\t\tbody.Parameters = make(map[string]json.RawMessage, len(res.Parameters))\n\t\tfor key, val := range res.Parameters {\n\t\t\ttk := key\n\t\t\ttv := val\n\t\t\tbody.Parameters[tk] = tv\n\t\t}\n\t}\n\treturn body\n}", "func (client *WebAppsClient) getProcessModuleSlotHandleResponse(resp *http.Response) (WebAppsGetProcessModuleSlotResponse, error) {\n\tresult := WebAppsGetProcessModuleSlotResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ProcessModuleInfo); err != nil {\n\t\treturn WebAppsGetProcessModuleSlotResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "func NewSigninUnauthorizedResponseBody(res secured.Unauthorized) SigninUnauthorizedResponseBody {\n\tbody := SigninUnauthorizedResponseBody(res)\n\treturn body\n}", "func ValidateFieldNoteStationResponseBody(body *FieldNoteStationResponseBody) (err error) {\n\tif body.ReadOnly == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"readOnly\", \"body\"))\n\t}\n\treturn\n}", "func unmarshalFounderResponseBodyToWarehouseviewsFounderView(v *FounderResponseBody) *warehouseviews.FounderView {\n\tres := &warehouseviews.FounderView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func NewListResponseBody(res *warehouse.ListResult) *ListResponseBody {\n\tbody := &ListResponseBody{\n\t\tNextCursor: res.NextCursor,\n\t\tTotal: res.Total,\n\t}\n\tif res.Items != nil {\n\t\tbody.Items = make([]*WarehouseResponseBody, len(res.Items))\n\t\tfor i, val := range res.Items {\n\t\t\tbody.Items[i] = marshalWarehouseWarehouseToWarehouseResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func (client *WebAppsClient) getInstanceProcessModuleSlotHandleResponse(resp *http.Response) (WebAppsGetInstanceProcessModuleSlotResponse, error) {\n\tresult := WebAppsGetInstanceProcessModuleSlotResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ProcessModuleInfo); err != nil {\n\t\treturn WebAppsGetInstanceProcessModuleSlotResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "func NewAddResponseBodyTiny(res *stepviews.ResultStepView) *AddResponseBodyTiny {\n\tbody := &AddResponseBodyTiny{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Step != nil {\n\t\tbody.Step = marshalStepviewsStoredStepViewToStoredStepResponseBody(res.Step)\n\t}\n\treturn body\n}", "func EncodeAddResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewAddResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeAddResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewAddResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func SwarmHandler(swarmHost string, swarmPort string, swarmHash string) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tfullURI := \"http://\" + swarmHost + \":\" + swarmPort + \"/bzz:/\" + swarmHash + r.URL.String()\n\t\tclient := &http.Client{}\n\t\treq, err := http.NewRequest(r.Method, fullURI, r.Body)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tfmt.Fprint(w, err.Error())\n\t\t\treturn\n\t\t}\n\t\tresp, err := client.Do(req)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tfmt.Fprint(w, err.Error())\n\t\t\treturn\n\t\t}\n\t\tdefer resp.Body.Close()\n\n\t\tfor i, v := range resp.Header {\n\t\t\tw.Header().Set(i, v[0])\n\t\t}\n\n\t\tdefer resp.Body.Close()\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tfmt.Fprint(w, err.Error())\n\t\t\treturn\n\t\t}\n\t\tlog.Println(fullURI)\n\t\tfmt.Fprint(w, string(body))\n\t}\n}", "func EncodeGetResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewGetResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeGetResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewGetResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func unmarshalSuccessResultResponseBodyToUserSuccessResult(v *SuccessResultResponseBody) *user.SuccessResult {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &user.SuccessResult{\n\t\tOK: *v.OK,\n\t}\n\n\treturn res\n}", "func NewAdminGetUserUnauthorizedResponseBody(res admin.Unauthorized) AdminGetUserUnauthorizedResponseBody {\n\tbody := AdminGetUserUnauthorizedResponseBody(res)\n\treturn body\n}", "func (client *WebAppsClient) getProcessModuleHandleResponse(resp *http.Response) (WebAppsGetProcessModuleResponse, error) {\n\tresult := WebAppsGetProcessModuleResponse{RawResponse: resp}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ProcessModuleInfo); err != nil {\n\t\treturn WebAppsGetProcessModuleResponse{}, runtime.NewResponseError(err, resp)\n\t}\n\treturn result, nil\n}", "func NewGetUserResponseBodyTiny(res *userviews.UserView) *GetUserResponseBodyTiny {\n\tbody := &GetUserResponseBodyTiny{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t}\n\treturn body\n}", "func NewAdminUpdateUserUnauthorizedResponseBody(res admin.Unauthorized) AdminUpdateUserUnauthorizedResponseBody {\n\tbody := AdminUpdateUserUnauthorizedResponseBody(res)\n\treturn body\n}", "func (s *server) WASMHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\n\t// Read the HTTP Payload\n\tvar payload []byte\n\tvar err error\n\tif r.Method == \"POST\" || r.Method == \"PUT\" {\n\t\tpayload, err = ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\tlog.WithFields(logrus.Fields{\n\t\t\t\t\"method\": r.Method,\n\t\t\t\t\"remote-addr\": r.RemoteAddr,\n\t\t\t\t\"http-protocol\": r.Proto,\n\t\t\t\t\"headers\": r.Header,\n\t\t\t\t\"content-length\": r.ContentLength,\n\t\t\t}).Debugf(\"Error reading HTTP payload - %s\", err)\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Create Request type\n\treq := tarmac.ServerRequest{\n\t\tHeaders: map[string]string{\n\t\t\t\"request_type\": \"http\",\n\t\t\t\"http_method\": r.Method,\n\t\t\t\"http_path\": r.URL.Path,\n\t\t\t\"remote_addr\": r.RemoteAddr,\n\t\t},\n\t\tPayload: base64.StdEncoding.EncodeToString(payload),\n\t}\n\n\t// Append Request Headers\n\tfor k := range r.Header {\n\t\treq.Headers[strings.ToLower(k)] = r.Header.Get(k)\n\t}\n\n\t// Execute WASM Module\n\trsp, err := runWASM(\"default\", \"http:\"+r.Method, req)\n\tif err != nil {\n\t\tlog.WithFields(logrus.Fields{\n\t\t\t\"method\": r.Method,\n\t\t\t\"remote-addr\": r.RemoteAddr,\n\t\t\t\"http-protocol\": r.Proto,\n\t\t\t\"headers\": r.Header,\n\t\t\t\"content-length\": r.ContentLength,\n\t\t}).Debugf(\"Error executing WASM module - %s\", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Decode Response Payload\n\trspPayload, err := base64.StdEncoding.DecodeString(rsp.Payload)\n\tif err != nil {\n\t\tlog.WithFields(logrus.Fields{\n\t\t\t\"method\": r.Method,\n\t\t\t\"remote-addr\": r.RemoteAddr,\n\t\t\t\"http-protocol\": r.Proto,\n\t\t\t\"headers\": r.Header,\n\t\t\t\"content-length\": r.ContentLength,\n\t\t}).Debugf(\"Error decoing base64 payload response from WASM module - %s\", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// If Response indicates error print it out\n\tif rsp.Status.Code > 399 {\n\t\t// Return status code and print stdout\n\t\tw.WriteHeader(rsp.Status.Code)\n\t\tfmt.Fprintf(w, \"%s\", rsp.Status.Status)\n\t\treturn\n\t}\n\n\t// Assume if no status code everything worked as expected\n\tif rsp.Status.Code == 0 {\n\t\trsp.Status.Code = 200\n\t}\n\n\t// Return status code and print stdout\n\tw.WriteHeader(rsp.Status.Code)\n\tfmt.Fprintf(w, \"%s\", rspPayload)\n}", "func ResponseOutput(v interface{}) ([]byte, error) {\n\tj, err := json.MarshalIndent(v, \"\", \"\\t\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn j, nil\n}", "func WithResponseBody(output interface{}, decoder codecs.Decoder) RequestParam {\n\treturn requestParamFunc(func(b *requestBuilder) error {\n\t\tb.bodyMiddleware.responseOutput = output\n\t\tb.bodyMiddleware.responseDecoder = decoder\n\t\tb.headers.Set(\"Accept\", decoder.Accept())\n\t\treturn nil\n\t})\n}", "func AddCloseResponseBodyMiddleware(stack *middleware.Stack) error {\n\treturn stack.Deserialize.Insert(&closeResponseBody{}, \"OperationDeserializer\", middleware.Before)\n}", "func NewAdminSigninUnauthorizedResponseBody(res admin.Unauthorized) AdminSigninUnauthorizedResponseBody {\n\tbody := AdminSigninUnauthorizedResponseBody(res)\n\treturn body\n}", "func NewProjectForbiddenResponseBody(res *goa.ServiceError) *ProjectForbiddenResponseBody {\n\tbody := &ProjectForbiddenResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "func NewAdminUpdateUserResponseBodyTiny(res *adminviews.JeeekUserView) *AdminUpdateUserResponseBodyTiny {\n\tbody := &AdminUpdateUserResponseBodyTiny{\n\t\tUserID: *res.UserID,\n\t\tUserName: *res.UserName,\n\t\tEmailAddress: *res.EmailAddress,\n\t}\n\treturn body\n}", "func unmarshalWineryResponseToStorageviewsWineryView(v *WineryResponse) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}" ]
[ "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.5643626", "0.5643626", "0.5619093", "0.5619093", "0.5604376", "0.54757684", "0.5122458", "0.5043251", "0.4884485", "0.47295925", "0.4664017", "0.4655254", "0.46519986", "0.448343", "0.44755962", "0.4429725", "0.44022542", "0.43710706", "0.43611607", "0.43434855", "0.43312538", "0.43188924", "0.42733294", "0.42501128", "0.4234442", "0.42164516", "0.42143", "0.41916826", "0.41459453", "0.4142388", "0.41391495", "0.41142994", "0.410529", "0.40645725", "0.40645725", "0.40621647", "0.4054777", "0.40398827", "0.40228933", "0.40221924", "0.40141854", "0.40013972", "0.39904803", "0.3989133", "0.39851403", "0.39636245", "0.39353016", "0.39288938", "0.39263365", "0.39241463", "0.39003357", "0.38985014", "0.38910133", "0.38839123", "0.3860609", "0.38584524", "0.38550353", "0.3843896", "0.3834487", "0.38329783", "0.3804053", "0.3799932", "0.3799932", "0.37678823", "0.3758161", "0.3758161", "0.37536952", "0.37164378", "0.37159395", "0.37106544", "0.37088966", "0.37082264", "0.37018666", "0.36938292", "0.369331", "0.36775994", "0.36727247", "0.36725265", "0.3659776" ]
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.Reading != nil {\n\t\tres.Reading = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "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 marshalStationviewsEssentialStationViewToEssentialStationResponseBody(v *stationviews.EssentialStationView) *EssentialStationResponseBody {\n\tres := &EssentialStationResponseBody{\n\t\tID: *v.ID,\n\t\tDeviceID: *v.DeviceID,\n\t\tName: *v.Name,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tLastIngestionAt: v.LastIngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "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))\n\t\tfor i, val := range v.Precise {\n\t\t\tres.Precise[i] = val\n\t\t}\n\t}\n\tif v.Regions != nil {\n\t\tres.Regions = make([]*StationRegionResponseBody, len(v.Regions))\n\t\tfor i, val := range v.Regions {\n\t\t\tres.Regions[i] = marshalStationviewsStationRegionViewToStationRegionResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t\tFullKey: *v.FullKey,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v *stationviews.StationDataSummaryView) *StationDataSummaryResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &StationDataSummaryResponseBody{\n\t\tStart: *v.Start,\n\t\tEnd: *v.End,\n\t\tNumberOfSamples: *v.NumberOfSamples,\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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\tfor i, val := range v.Shape {\n\t\t\tres.Shape[i] = make([][]float64, len(val))\n\t\t\tfor j, val := range val {\n\t\t\t\tres.Shape[i][j] = make([]float64, len(val))\n\t\t\t\tfor k, val := range val {\n\t\t\t\t\tres.Shape[i][j][k] = val\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdated: *v.Updated,\n\t\tLocationName: v.LocationName,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Images != nil {\n\t\tres.Images = make([]*ImageRefResponseBody, len(v.Images))\n\t\tfor i, val := range v.Images {\n\t\t\tres.Images[i] = marshalStationviewsImageRefViewToImageRefResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tLocationName: v.LocationName,\n\t\tPlaceNameOther: v.PlaceNameOther,\n\t\tPlaceNameNative: v.PlaceNameNative,\n\t\tSyncedAt: v.SyncedAt,\n\t\tIngestionAt: v.IngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\tif v.Data != nil {\n\t\tres.Data = marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v.Data)\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationJobViewToStationJobResponseBody(v *stationviews.StationJobView) *StationJobResponseBody {\n\tres := &StationJobResponseBody{\n\t\tTitle: *v.Title,\n\t\tStartedAt: *v.StartedAt,\n\t\tCompletedAt: v.CompletedAt,\n\t\tProgress: *v.Progress,\n\t}\n\n\treturn res\n}", "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.StationPhotosView) *StationPhotosResponseBody {\n\tres := &StationPhotosResponseBody{\n\t\tSmall: *v.Small,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func ValidateStationSensorResponseBody(body *StationSensorResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.UnitOfMeasure == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"unit_of_measure\", \"body\"))\n\t}\n\tif body.Key == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"key\", \"body\"))\n\t}\n\tif body.Ranges == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"ranges\", \"body\"))\n\t}\n\tif body.Reading != nil {\n\t\tif err2 := ValidateSensorReadingResponseBody(body.Reading); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\tfor _, e := range body.Ranges {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateSensorRangeResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func marshalStationviewsImageRefViewToImageRefResponseBody(v *stationviews.ImageRefView) *ImageRefResponseBody {\n\tres := &ImageRefResponseBody{\n\t\tURL: *v.URL,\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsWarehouseViewToWarehouseResponseBody(v *inventoryviews.WarehouseView) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tCode: *v.Code,\n\t\tAddress: *v.Address,\n\t\tType: *v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func marshalMatchesviewsRatingViewToRatingResponseBody(v *matchesviews.RatingView) *RatingResponseBody {\n\tres := &RatingResponseBody{\n\t\tStrength: *v.Strength,\n\t\tLower: *v.Lower,\n\t\tUpper: *v.Upper,\n\t}\n\n\treturn res\n}", "func unmarshalWindResponseBodyToLogWind(v *WindResponseBody) *log.Wind {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &log.Wind{\n\t\tSpeed: v.Speed,\n\t\tDirection: v.Direction,\n\t\tUnit: v.Unit,\n\t}\n\n\treturn res\n}", "func unmarshalWineryResponseBodyToStorageviewsWineryView(v *WineryResponseBody) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func EncodeStationMetaResponse(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.(*sensor.StationMetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func NewDeviceLayoutResponseViewOK(body *DeviceLayoutResponseBody) *informationviews.DeviceLayoutResponseView {\n\tv := &informationviews.DeviceLayoutResponseView{}\n\tv.Configurations = make([]*informationviews.StationConfigurationView, len(body.Configurations))\n\tfor i, val := range body.Configurations {\n\t\tv.Configurations[i] = unmarshalStationConfigurationResponseBodyToInformationviewsStationConfigurationView(val)\n\t}\n\tv.Sensors = make(map[string][]*informationviews.StationSensorView, len(body.Sensors))\n\tfor key, val := range body.Sensors {\n\t\ttk := key\n\t\ttv := make([]*informationviews.StationSensorView, len(val))\n\t\tfor i, val := range val {\n\t\t\ttv[i] = unmarshalStationSensorResponseBodyToInformationviewsStationSensorView(val)\n\t\t}\n\t\tv.Sensors[tk] = tv\n\t}\n\n\treturn v\n}", "func ValidateStationModuleResponseBody(body *StationModuleResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.Position == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"position\", \"body\"))\n\t}\n\tif body.Flags == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"flags\", \"body\"))\n\t}\n\tif body.Internal == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"internal\", \"body\"))\n\t}\n\tif body.Sensors == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"sensors\", \"body\"))\n\t}\n\tfor _, e := range body.Sensors {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateStationSensorResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func EncodeSensorMetaResponse(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.(*sensor.SensorMetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func marshalVironAPIViewToVironAPIResponseBody(v *vironviews.VironAPIView) *VironAPIResponseBody {\n\tres := &VironAPIResponseBody{\n\t\tMethod: *v.Method,\n\t\tPath: *v.Path,\n\t}\n\n\treturn res\n}", "func ServerEncodeResponseBody(timeLayout string, format wrp.Format) gokithttp.EncodeResponseFunc {\n\treturn func(ctx context.Context, httpResponse http.ResponseWriter, value interface{}) error {\n\t\tvar (\n\t\t\twrpResponse = value.(wrpendpoint.Response)\n\t\t\toutput bytes.Buffer\n\t\t)\n\n\t\ttracinghttp.HeadersForSpans(timeLayout, httpResponse.Header(), wrpResponse.Spans()...)\n\n\t\tif err := wrpResponse.Encode(&output, format); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\thttpResponse.Header().Set(\"Content-Type\", format.ContentType())\n\t\t_, err := output.WriteTo(httpResponse)\n\t\treturn err\n\t}\n}", "func NewUpdateResponseBody(res *warehouseviews.WarehouseView) *UpdateResponseBody {\n\tbody := &UpdateResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func marshalMatchesviewsRatingResourceViewToRatingResourceResponseBody(v *matchesviews.RatingResourceView) *RatingResourceResponseBody {\n\tres := &RatingResourceResponseBody{\n\t\tRrn: *v.Rrn,\n\t}\n\tif v.Rating != nil {\n\t\tres.Rating = marshalMatchesviewsRatingViewToRatingResponseBody(v.Rating)\n\t}\n\n\treturn res\n}", "func (controller *BuoyController) RetrieveStationJSON() {\n\tbuoyStations, err := buoyService.AllStation(&controller.Service)\n\n\tif err != nil {\n\t\tcontroller.ServeError(err)\n\t\treturn\n\t}\n\n\tcontroller.Data[\"json\"] = buoyStations\n\tcontroller.ServeJSON()\n}", "func ValidateStationConfigurationResponseBody(body *StationConfigurationResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.ProvisionID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"provision_id\", \"body\"))\n\t}\n\tif body.Time == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"time\", \"body\"))\n\t}\n\tif body.Modules == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"modules\", \"body\"))\n\t}\n\tfor _, e := range body.Modules {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateStationModuleResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func unmarshalComponentResponseBodyToStorageviewsComponentView(v *ComponentResponseBody) *storageviews.ComponentView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &storageviews.ComponentView{\n\t\tVarietal: v.Varietal,\n\t\tPercentage: v.Percentage,\n\t}\n\n\treturn res\n}", "func UnmarshalStationMonitorResponse(res *HttpResponse)(*Journey,error){\n\tbody, err := ioutil.ReadAll(res.Response.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar record Journey\n\terr=parseResponseObject(body,record)\n\treturn &record, err\n}", "func NewSensorController(rest *rest.Config, kubeClient kubernetes.Interface, sensorClient sensorclientset.Interface, log *zap.SugaredLogger, configMap string) *SensorController {\n\treturn &SensorController{\n\t\tkubeConfig: rest,\n\t\tkubeClientset: kubeClient,\n\t\tsensorClientset: sensorClient,\n\t\tConfigMap: configMap,\n\t\tssQueue: workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()),\n\t\tpodQueue: workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()),\n\t\tlog: log,\n\t}\n}", "func unmarshalWeatherResponseBodyToLogWeather(v *WeatherResponseBody) *log.Weather {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &log.Weather{\n\t\tID: v.ID,\n\t\tCreatedAt: v.CreatedAt,\n\t\tFireID: v.FireID,\n\t\tLogID: v.LogID,\n\t\tHumidity: v.Humidity,\n\t\tWeatherType: v.WeatherType,\n\t\tWeatherTime: v.WeatherTime,\n\t}\n\tif v.Temperature != nil {\n\t\tres.Temperature = unmarshalTemperatureResponseBodyToLogTemperature(v.Temperature)\n\t}\n\tif v.DewPoint != nil {\n\t\tres.DewPoint = unmarshalTemperatureResponseBodyToLogTemperature(v.DewPoint)\n\t}\n\tif v.Wind != nil {\n\t\tres.Wind = unmarshalWindResponseBodyToLogWind(v.Wind)\n\t}\n\n\treturn res\n}", "func marshalInventoryWarehouseToWarehouseResponseBody(v *inventory.Warehouse) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t\tCode: v.Code,\n\t\tAddress: v.Address,\n\t\tType: v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryFounderToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func ValidateSensorReadingResponseBody(body *SensorReadingResponseBody) (err error) {\n\tif body.Last == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"last\", \"body\"))\n\t}\n\tif body.Time == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"time\", \"body\"))\n\t}\n\treturn\n}", "func NewSigninResponseBody(res *securedviews.GoaJWTView) *SigninResponseBody {\n\tbody := &SigninResponseBody{\n\t\tAuthorization: *res.Authorization,\n\t}\n\treturn body\n}", "func ValidateSensorRangeResponseBody(body *SensorRangeResponseBody) (err error) {\n\tif body.Minimum == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"minimum\", \"body\"))\n\t}\n\tif body.Maximum == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"maximum\", \"body\"))\n\t}\n\treturn\n}", "func marshalInventoryviewsFounderViewToFounderResponseBody(v *inventoryviews.FounderView) *FounderResponseBody {\n\tres := &FounderResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func NewListResponseBody(res *stepviews.StoredListOfStepsView) *ListResponseBody {\n\tbody := &ListResponseBody{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Steps != nil {\n\t\tbody.Steps = make([]*StoredStepResponseBody, len(res.Steps))\n\t\tfor i, val := range res.Steps {\n\t\t\tbody.Steps[i] = marshalStepviewsStoredStepViewToStoredStepResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func marshalWindRequestBodyToLogWind(v *WindRequestBody) *log.Wind {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &log.Wind{\n\t\tSpeed: v.Speed,\n\t\tDirection: v.Direction,\n\t\tUnit: v.Unit,\n\t}\n\n\treturn res\n}", "func NewStatusResponseBody(res *spinbroker.StatusResult) *StatusResponseBody {\n\tbody := &StatusResponseBody{\n\t\tStatus: res.Status,\n\t\tReason: res.Reason,\n\t\tCauser: res.Causer,\n\t}\n\treturn body\n}", "func unmarshalFounderResponseBodyToWarehouseviewsFounderView(v *FounderResponseBody) *warehouseviews.FounderView {\n\tres := &warehouseviews.FounderView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func NewShuntSensor(config devices.DeviceConfig) (s devices.Shunt, err error) {\n\tif config.Type != devices.ShuntType {\n\t\terr = fmt.Errorf(\"Invalid sensor type, %d\", config.Type)\n\t\treturn\n\t}\n\n\tswitch config.Model {\n\tcase devices.INA219Model:\n\t\tvar shunt *i2c.INA219\n\t\tshunt, err = i2c.NewINA219Sensor(config)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\ts = shunt\n\n\tdefault:\n\t\terr = fmt.Errorf(\"Unknown sensor model, %d\", config.Model)\n\t}\n\treturn\n}", "func unmarshalWarehouseResponseBodyToWarehouseWarehouse(v *WarehouseResponseBody) *warehouse.Warehouse {\n\tres := &warehouse.Warehouse{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tCode: *v.Code,\n\t\tAddress: *v.Address,\n\t\tType: *v.Type,\n\t}\n\tres.Founder = unmarshalFounderResponseBodyToWarehouseFounder(v.Founder)\n\n\treturn res\n}", "func (in *Sensor) DeepCopy() *Sensor {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Sensor)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(v *discussionviews.ThreadedPostView) *ThreadedPostResponseBody {\n\tres := &ThreadedPostResponseBody{\n\t\tID: *v.ID,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tBody: *v.Body,\n\t\tBookmark: v.Bookmark,\n\t}\n\tif v.Author != nil {\n\t\tres.Author = marshalDiscussionviewsPostAuthorViewToPostAuthorResponseBody(v.Author)\n\t}\n\tif v.Replies != nil {\n\t\tres.Replies = make([]*ThreadedPostResponseBody, len(v.Replies))\n\t\tfor i, val := range v.Replies {\n\t\t\tres.Replies[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func (s *SensorsService) Sensors(sensorsQueryParams *SensorsQueryParams) (*SensorsResponse, *resty.Response, error) {\n\n\tpath := \"/dna/intent/api/v1/sensor\"\n\n\tqueryString, _ := query.Values(sensorsQueryParams)\n\n\tresponse, err := RestyClient.R().\n\t\tSetQueryString(queryString.Encode()).\n\t\tSetResult(&SensorsResponse{}).\n\t\tSetError(&Error{}).\n\t\tGet(path)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tif response.IsError() {\n\t\treturn nil, response, fmt.Errorf(\"Error with operation sensors\")\n\t}\n\n\tresult := response.Result().(*SensorsResponse)\n\treturn result, response, err\n}", "func unmarshalWineryResponseToStorageviewsWineryView(v *WineryResponse) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func ValidateFieldNoteStationResponseBody(body *FieldNoteStationResponseBody) (err error) {\n\tif body.ReadOnly == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"readOnly\", \"body\"))\n\t}\n\treturn\n}", "func (o *GetUniverseStationsStationIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetUniverseStationsStationIDOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 304:\n\t\tresult := NewGetUniverseStationsStationIDNotModified()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 400:\n\t\tresult := NewGetUniverseStationsStationIDBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewGetUniverseStationsStationIDNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 420:\n\t\tresult := NewGetUniverseStationsStationIDEnhanceYourCalm()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewGetUniverseStationsStationIDInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 503:\n\t\tresult := NewGetUniverseStationsStationIDServiceUnavailable()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 504:\n\t\tresult := NewGetUniverseStationsStationIDGatewayTimeout()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func NewAddResponseBodyTiny(res *stepviews.ResultStepView) *AddResponseBodyTiny {\n\tbody := &AddResponseBodyTiny{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Step != nil {\n\t\tbody.Step = marshalStepviewsStoredStepViewToStoredStepResponseBody(res.Step)\n\t}\n\treturn body\n}", "func ValueHTTPResponseBody(ctx context.Context) interface{} {\n\treturn ctx.Value(contextHTTPResponseBodyFields)\n}", "func ParseSensorInfo(v url.Values) (out SensorInfo) {\n\tout.Temp, _ = strconv.ParseFloat(v.Get(\"htemp\"), 64)\n\tif otemp, err := strconv.ParseFloat(v.Get(\"otemp\"), 64); err == nil {\n\t\tout.World = &otemp\n\t}\n\treturn\n}", "func NewGetResponseBody(res *warehouseviews.WarehouseView) *GetResponseBody {\n\tbody := &GetResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func marshalInventoryviewsHeadViewToHeadResponseBody(v *inventoryviews.HeadView) *HeadResponseBody {\n\tres := &HeadResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func NewGetUserResponseBodyTiny(res *userviews.UserView) *GetUserResponseBodyTiny {\n\tbody := &GetUserResponseBodyTiny{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t}\n\treturn body\n}", "func EncodeNeatThingTodayResponse(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.(*neatthingviews.NeatThing)\n\t\tw.Header().Set(\"goa-view\", res.View)\n\t\tenc := encoder(ctx, w)\n\t\tvar body interface{}\n\t\tswitch res.View {\n\t\tcase \"default\", \"\":\n\t\t\tbody = NewNeatThingTodayResponseBody(res.Projected)\n\t\tcase \"full\":\n\t\t\tbody = NewNeatThingTodayResponseBodyFull(res.Projected)\n\t\tcase \"name\":\n\t\t\tbody = NewNeatThingTodayResponseBodyName(res.Projected)\n\t\tcase \"name+definition\":\n\t\t\tbody = NewNeatThingTodayResponseBodyNameDefinition(res.Projected)\n\t\tcase \"name+link\":\n\t\t\tbody = NewNeatThingTodayResponseBodyNameLink(res.Projected)\n\t\t}\n\t\tw.WriteHeader(http.StatusNoContent)\n\t\treturn enc.Encode(body)\n\t}\n}", "func CreateSensorsEndpoint(externalURL string) *endpoint.Endpoint {\n\treturn &endpoint.Endpoint{\n\t\tName: \"Sensors\",\n\t\tEntityType: entities.EntityTypeSensor,\n\t\tOutputInfo: true,\n\t\tURL: fmt.Sprintf(\"%s/%s/%s\", externalURL, models.APIPrefix, fmt.Sprintf(\"%v\", \"Sensors\")),\n\t\tSupportedExpandParams: []string{\n\t\t\t\"datastreams\",\n\t\t},\n\t\tSupportedSelectParams: []string{\n\t\t\t\"id\",\n\t\t\t\"name\",\n\t\t\t\"description\",\n\t\t\t\"encodingtype\",\n\t\t\t\"metadata\",\n\t\t\t\"datastreams\",\n\t\t},\n\t\tOperations: []models.EndpointOperation{\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/sensors\", Handler: handlers.HandleGetSensors},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/sensors{id}\", Handler: handlers.HandleGetSensor},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/datastreams{id}/sensor\", Handler: handlers.HandleGetSensorByDatastream},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/datastreams{id}/sensor/{params}\", Handler: handlers.HandleGetSensorByDatastream},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/datastreams{id}/sensor/{params}/$value\", Handler: handlers.HandleGetSensorByDatastream},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/sensors{id}/{params}\", Handler: handlers.HandleGetSensor},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/sensors{id}/{params}/$value\", Handler: handlers.HandleGetSensor},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/sensors/{params}\", Handler: handlers.HandleGetSensors},\n\n\t\t\t{OperationType: models.HTTPOperationPost, Path: \"/v1.0/sensors\", Handler: handlers.HandlePostSensors},\n\t\t\t{OperationType: models.HTTPOperationDelete, Path: \"/v1.0/sensors{id}\", Handler: handlers.HandleDeleteSensor},\n\t\t\t{OperationType: models.HTTPOperationPatch, Path: \"/v1.0/sensors{id}\", Handler: handlers.HandlePatchSensor},\n\t\t\t{OperationType: models.HTTPOperationPut, Path: \"/v1.0/sensors{id}\", Handler: handlers.HandlePutSensor},\n\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/{c:.*}/sensors\", Handler: handlers.HandleGetSensors},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/{c:.*}/sensors{id}\", Handler: handlers.HandleGetSensor},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/{c:.*}/datastreams{id}/sensor\", Handler: handlers.HandleGetSensorByDatastream},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/{c:.*}/datastreams{id}/sensor/{params}\", Handler: handlers.HandleGetSensorByDatastream},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/{c:.*}/datastreams{id}/sensor/{params}/$value\", Handler: handlers.HandleGetSensorByDatastream},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/{c:.*}/sensors{id}/{params}\", Handler: handlers.HandleGetSensor},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/{c:.*}/sensors{id}/{params}/$value\", Handler: handlers.HandleGetSensor},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/{c:.*}/sensors/{params}\", Handler: handlers.HandleGetSensors},\n\n\t\t\t{OperationType: models.HTTPOperationPost, Path: \"/v1.0/{c:.*}/sensors\", Handler: handlers.HandlePostSensors},\n\t\t\t{OperationType: models.HTTPOperationDelete, Path: \"/v1.0/{c:.*}/sensors{id}\", Handler: handlers.HandleDeleteSensor},\n\t\t\t{OperationType: models.HTTPOperationPatch, Path: \"/v1.0/{c:.*}/sensors{id}\", Handler: handlers.HandlePatchSensor},\n\t\t\t{OperationType: models.HTTPOperationPut, Path: \"/v1.0/{c:.*}/sensors{id}\", Handler: handlers.HandlePutSensor},\n\t\t},\n\t}\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func NewCreateResponseBody(res *warehouseviews.WarehouseView) *CreateResponseBody {\n\tbody := &CreateResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func NewShowDutyStationTransportationOffice(ctx *middleware.Context, handler ShowDutyStationTransportationOfficeHandler) *ShowDutyStationTransportationOffice {\n\treturn &ShowDutyStationTransportationOffice{Context: ctx, Handler: handler}\n}", "func NewSigninUnauthorizedResponseBody(res secured.Unauthorized) SigninUnauthorizedResponseBody {\n\tbody := SigninUnauthorizedResponseBody(res)\n\treturn body\n}", "func marshalPostsPostOutputToPostOutputResponseBody(v *posts.PostOutput) *PostOutputResponseBody {\n\tres := &PostOutputResponseBody{\n\t\tID: v.ID,\n\t\tTitle: v.Title,\n\t\tDescription: v.Description,\n\t\tScreenImageURL: v.ScreenImageURL,\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsProductViewToProductResponseBody(v *inventoryviews.ProductView) *ProductResponseBody {\n\tres := &ProductResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tUnit: *v.Unit,\n\t\tCostPrice: *v.CostPrice,\n\t\tMarketPrice: *v.MarketPrice,\n\t\tNote: *v.Note,\n\t\tImage: *v.Image,\n\t\tCode: *v.Code,\n\t\tSize: *v.Size,\n\t\tType: *v.Type,\n\t\tIsShelves: *v.IsShelves,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func NewDataResponseBody(res *discussionviews.DiscussionView) *DataResponseBody {\n\tbody := &DataResponseBody{}\n\tif res.Posts != nil {\n\t\tbody.Posts = make([]*ThreadedPostResponseBody, len(res.Posts))\n\t\tfor i, val := range res.Posts {\n\t\t\tbody.Posts[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func newBattlestreamingresultView(res *Battlestreamingresult) *shiritoriviews.BattlestreamingresultView {\n\tvres := &shiritoriviews.BattlestreamingresultView{\n\t\tType: &res.Type,\n\t\tTimestamp: &res.Timestamp,\n\t}\n\tif res.MessagePayload != nil {\n\t\tvres.MessagePayload = transformMessagePayloadToShiritoriviewsMessagePayloadView(res.MessagePayload)\n\t}\n\treturn vres\n}", "func (tag *SensorTag) NewSensorConfig(uuid uuid.UUID) (*sensorConfig, error) {\n\tcfg, err := tag.device.GetCharByUUID(uuid.Config)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get config characteristic\")\n\t}\n\n\tdata, err := tag.device.GetCharByUUID(uuid.Data)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get data characteristic\")\n\t}\n\n\tperiod, err := tag.device.GetCharByUUID(uuid.Period)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get period characteristic\")\n\t}\n\n\treturn &sensorConfig{\n\t\tcfg: cfg,\n\t\tdata: data,\n\t\tperiod: period,\n\t}, nil\n}", "func EncodeTailResponse(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.(*sensor.TailResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (kssd *KeyServerStatsDay) ToResponse() *keyserver.StatsDay {\n\treqs := keyserver.PublishRequests{}\n\tif l := len(kssd.PublishRequests); l == 3 {\n\t\treqs.UnknownPlatform = kssd.PublishRequests[OSTypeUnknown]\n\t\treqs.IOS = kssd.PublishRequests[OSTypeIOS]\n\t\treqs.Android = kssd.PublishRequests[OSTypeAndroid]\n\t}\n\n\treturn &keyserver.StatsDay{\n\t\tDay: kssd.Day,\n\t\tPublishRequests: reqs,\n\t\tTotalTEKsPublished: kssd.TotalTEKsPublished,\n\t\tRevisionRequests: kssd.RevisionRequests,\n\t\tTEKAgeDistribution: kssd.TEKAgeDistribution,\n\t\tOnsetToUploadDistribution: kssd.OnsetToUploadDistribution,\n\t\tRequestsMissingOnsetDate: kssd.RequestsMissingOnsetDate,\n\t}\n}", "func (s *SensorsService) RunNowSensorTest(runNowSensorTestRequest *RunNowSensorTestRequest) (*resty.Response, error) {\n\n\tpath := \"/dna/intent/api/v1/sensor-run-now\"\n\n\tresponse, err := RestyClient.R().\n\t\tSetBody(runNowSensorTestRequest).\n\t\tSetError(&Error{}).\n\t\tPut(path)\n\n\tif err != nil {\n\t\treturn nil, nil\n\t}\n\treturn response, err\n}", "func (s *sensorReading) GetSensor() Sensor {\n\treturn s.sensor\n}", "func unmarshalPlatformResponseBodyToResourceviewsPlatformView(v *PlatformResponseBody) *resourceviews.PlatformView {\n\tres := &resourceviews.PlatformView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func marshalRxRecipeResponseBodyToRxRecipeView(v *RxRecipeResponseBody) *recipeviews.RxRecipeView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &recipeviews.RxRecipeView{\n\t\tID: v.ID,\n\t\tTitle: v.Title,\n\t\tDescription: v.Description,\n\t\tVersion: v.Version,\n\t\tFavorite: v.Favorite,\n\t\tRating: v.Rating,\n\t\tDifficulty: v.Difficulty,\n\t\tState: v.State,\n\t\tComplete: v.Complete,\n\t}\n\tif v.Ingredients != nil {\n\t\tres.Ingredients = marshalIngredientListResponseBodyToIngredientListView(v.Ingredients)\n\t}\n\n\treturn res\n}", "func NewGetUserResponseBody(res *userviews.UserView) *GetUserResponseBody {\n\tbody := &GetUserResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tEmail: *res.Email,\n\t\tScore: res.Score,\n\t}\n\treturn body\n}", "func DecodeResponseBody(body io.Reader, dest interface{}) error {\n\tdecoder := json.NewDecoder(body)\n\terr := decoder.Decode(dest)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to decode response body: %s\", err.Error())\n\t}\n\n\treturn nil\n}", "func NewGetUniverseStationsStationIDOK() *GetUniverseStationsStationIDOK {\n\treturn &GetUniverseStationsStationIDOK{}\n}", "func NewGetUniverseStationsStationIDOK() *GetUniverseStationsStationIDOK {\n\treturn &GetUniverseStationsStationIDOK{}\n}", "func HTTPResponseBodyContent(val string) zap.Field {\n\treturn zap.String(FieldHTTPResponseBodyContent, val)\n}", "func (v *VCR) FilterResponseBody(original string, replacement string) {\n\tv.mu.Lock()\n\tdefer v.mu.Unlock()\n\tv.FilterMap[original] = replacement\n}", "func NewAddResponseBody(res *stepviews.ResultStepView) *AddResponseBody {\n\tbody := &AddResponseBody{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Step != nil {\n\t\tbody.Step = marshalStepviewsStoredStepViewToStoredStepResponseBody(res.Step)\n\t}\n\treturn body\n}", "func tariffHandler(site site.API) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tvars := mux.Vars(r)\n\t\ttariff := vars[\"tariff\"]\n\n\t\tt := site.GetTariff(tariff)\n\t\tif t == nil {\n\t\t\tjsonError(w, http.StatusNotFound, errors.New(\"tariff not available\"))\n\t\t\treturn\n\t\t}\n\n\t\trates, err := t.Rates()\n\t\tif err != nil {\n\t\t\tjsonError(w, http.StatusNotFound, err)\n\t\t\treturn\n\t\t}\n\n\t\tres := struct {\n\t\t\tRates api.Rates `json:\"rates\"`\n\t\t}{\n\t\t\tRates: rates,\n\t\t}\n\n\t\tjsonResult(w, res)\n\t}\n}", "func unmarshalStoredBottleResponseToStorageviewsStoredBottleView(v *StoredBottleResponse) *storageviews.StoredBottleView {\n\tres := &storageviews.StoredBottleView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t\tVintage: v.Vintage,\n\t\tDescription: v.Description,\n\t\tRating: v.Rating,\n\t}\n\tres.Winery = unmarshalWineryResponseToStorageviewsWineryView(v.Winery)\n\tif v.Composition != nil {\n\t\tres.Composition = make([]*storageviews.ComponentView, len(v.Composition))\n\t\tfor i, val := range v.Composition {\n\t\t\tres.Composition[i] = unmarshalComponentResponseToStorageviewsComponentView(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func (o TransformationResponseOutput) StreamingUnits() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v TransformationResponse) *int { return v.StreamingUnits }).(pulumi.IntPtrOutput)\n}", "func unmarshalSuccessResultResponseBodyToUserSuccessResult(v *SuccessResultResponseBody) *user.SuccessResult {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &user.SuccessResult{\n\t\tOK: *v.OK,\n\t}\n\n\treturn res\n}", "func (s *sensorPackage) SetSensor(sensor Sensor) {\n\ts.Next()\n\ts.manifest[s.currentIndex-1] = sensor\n}", "func unmarshalTemperatureResponseBodyToLogTemperature(v *TemperatureResponseBody) *log.Temperature {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &log.Temperature{\n\t\tUnit: v.Unit,\n\t\tValue: v.Value,\n\t}\n\n\treturn res\n}", "func marshalLogWindToWindRequestBody(v *log.Wind) *WindRequestBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &WindRequestBody{\n\t\tSpeed: v.Speed,\n\t\tDirection: v.Direction,\n\t\tUnit: v.Unit,\n\t}\n\n\treturn res\n}" ]
[ "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.64218116", "0.620003", "0.620003", "0.61597353", "0.61597353", "0.56573", "0.5576129", "0.5445892", "0.5349316", "0.50494075", "0.49598128", "0.4844472", "0.48338902", "0.47144726", "0.4596911", "0.4587015", "0.45625925", "0.45327225", "0.44862667", "0.44661677", "0.44630027", "0.443101", "0.43457815", "0.43439478", "0.43339723", "0.4304646", "0.42842513", "0.42462564", "0.423526", "0.42268318", "0.42237264", "0.42185274", "0.42000705", "0.41952765", "0.4189013", "0.41875318", "0.41736424", "0.4143496", "0.41376665", "0.41338292", "0.41093016", "0.4108213", "0.40950048", "0.40930775", "0.4085545", "0.4083757", "0.4064293", "0.4055125", "0.40436238", "0.4027446", "0.4010321", "0.4010321", "0.40092862", "0.39942172", "0.39840132", "0.3982932", "0.39824143", "0.3936081", "0.3928769", "0.39278597", "0.3927115", "0.3926433", "0.39239544", "0.3908344", "0.39072976", "0.3891573", "0.38889167", "0.38859046", "0.38848856", "0.38848856", "0.38844737", "0.3880328", "0.38778564", "0.38683125", "0.38529912", "0.3842564", "0.38326702", "0.38180187", "0.3815931", "0.3799093" ]
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 = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Reading != nil {\n\t\tres.Reading = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v *stationviews.StationDataSummaryView) *StationDataSummaryResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &StationDataSummaryResponseBody{\n\t\tStart: *v.Start,\n\t\tEnd: *v.End,\n\t\tNumberOfSamples: *v.NumberOfSamples,\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t\tFullKey: *v.FullKey,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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 marshalStationviewsEssentialStationViewToEssentialStationResponseBody(v *stationviews.EssentialStationView) *EssentialStationResponseBody {\n\tres := &EssentialStationResponseBody{\n\t\tID: *v.ID,\n\t\tDeviceID: *v.DeviceID,\n\t\tName: *v.Name,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tLastIngestionAt: v.LastIngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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\tfor i, val := range v.Shape {\n\t\t\tres.Shape[i] = make([][]float64, len(val))\n\t\t\tfor j, val := range val {\n\t\t\t\tres.Shape[i][j] = make([]float64, len(val))\n\t\t\t\tfor k, val := range val {\n\t\t\t\t\tres.Shape[i][j][k] = val\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}", "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))\n\t\tfor i, val := range v.Precise {\n\t\t\tres.Precise[i] = val\n\t\t}\n\t}\n\tif v.Regions != nil {\n\t\tres.Regions = make([]*StationRegionResponseBody, len(v.Regions))\n\t\tfor i, val := range v.Regions {\n\t\t\tres.Regions[i] = marshalStationviewsStationRegionViewToStationRegionResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdated: *v.Updated,\n\t\tLocationName: v.LocationName,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Images != nil {\n\t\tres.Images = make([]*ImageRefResponseBody, len(v.Images))\n\t\tfor i, val := range v.Images {\n\t\t\tres.Images[i] = marshalStationviewsImageRefViewToImageRefResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "func ValidateSensorReadingResponseBody(body *SensorReadingResponseBody) (err error) {\n\tif body.Last == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"last\", \"body\"))\n\t}\n\tif body.Time == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"time\", \"body\"))\n\t}\n\treturn\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tLocationName: v.LocationName,\n\t\tPlaceNameOther: v.PlaceNameOther,\n\t\tPlaceNameNative: v.PlaceNameNative,\n\t\tSyncedAt: v.SyncedAt,\n\t\tIngestionAt: v.IngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\tif v.Data != nil {\n\t\tres.Data = marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v.Data)\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationJobViewToStationJobResponseBody(v *stationviews.StationJobView) *StationJobResponseBody {\n\tres := &StationJobResponseBody{\n\t\tTitle: *v.Title,\n\t\tStartedAt: *v.StartedAt,\n\t\tCompletedAt: v.CompletedAt,\n\t\tProgress: *v.Progress,\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsWarehouseViewToWarehouseResponseBody(v *inventoryviews.WarehouseView) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tCode: *v.Code,\n\t\tAddress: *v.Address,\n\t\tType: *v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func marshalMatchesviewsRatingViewToRatingResponseBody(v *matchesviews.RatingView) *RatingResponseBody {\n\tres := &RatingResponseBody{\n\t\tStrength: *v.Strength,\n\t\tLower: *v.Lower,\n\t\tUpper: *v.Upper,\n\t}\n\n\treturn res\n}", "func ValidateStationSensorResponseBody(body *StationSensorResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.UnitOfMeasure == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"unit_of_measure\", \"body\"))\n\t}\n\tif body.Key == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"key\", \"body\"))\n\t}\n\tif body.Ranges == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"ranges\", \"body\"))\n\t}\n\tif body.Reading != nil {\n\t\tif err2 := ValidateSensorReadingResponseBody(body.Reading); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\tfor _, e := range body.Ranges {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateSensorRangeResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func marshalStationviewsImageRefViewToImageRefResponseBody(v *stationviews.ImageRefView) *ImageRefResponseBody {\n\tres := &ImageRefResponseBody{\n\t\tURL: *v.URL,\n\t}\n\n\treturn res\n}", "func unmarshalWineryResponseBodyToStorageviewsWineryView(v *WineryResponseBody) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.StationPhotosView) *StationPhotosResponseBody {\n\tres := &StationPhotosResponseBody{\n\t\tSmall: *v.Small,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func (s *sensorReading) GetSensor() Sensor {\n\treturn s.sensor\n}", "func unmarshalWindResponseBodyToLogWind(v *WindResponseBody) *log.Wind {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &log.Wind{\n\t\tSpeed: v.Speed,\n\t\tDirection: v.Direction,\n\t\tUnit: v.Unit,\n\t}\n\n\treturn res\n}", "func Reading(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"Request Received: \")\n\n\tdefer r.Body.Close()\n\tif r.Method != \"POST\" {\n\t\tlog.Println(\"Method not POST\")\n\t\tw.Header().Set(\"Allow\", \"POST\")\n\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\tvar message SensorReading\n\n\terr := json.NewDecoder(r.Body).Decode(&message)\n\tpayload := Payload{apiKey, message}\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tpayload.Publish()\n}", "func (dev *SDRDevice) ReadSensor(key string) string {\n\n\tcKey := C.CString(key)\n\tdefer C.free(unsafe.Pointer(cKey))\n\n\tval := (*C.char)(C.SoapySDRDevice_readSensor(dev.device, cKey))\n\tdefer C.free(unsafe.Pointer(val))\n\n\treturn C.GoString(val)\n}", "func marshalMatchesviewsRatingResourceViewToRatingResourceResponseBody(v *matchesviews.RatingResourceView) *RatingResourceResponseBody {\n\tres := &RatingResourceResponseBody{\n\t\tRrn: *v.Rrn,\n\t}\n\tif v.Rating != nil {\n\t\tres.Rating = marshalMatchesviewsRatingViewToRatingResponseBody(v.Rating)\n\t}\n\n\treturn res\n}", "func ValidateSensorRangeResponseBody(body *SensorRangeResponseBody) (err error) {\n\tif body.Minimum == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"minimum\", \"body\"))\n\t}\n\tif body.Maximum == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"maximum\", \"body\"))\n\t}\n\treturn\n}", "func NewUpdateResponseBody(res *warehouseviews.WarehouseView) *UpdateResponseBody {\n\tbody := &UpdateResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func NewGetResponseBody(res *warehouseviews.WarehouseView) *GetResponseBody {\n\tbody := &GetResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func unmarshalWeatherResponseBodyToLogWeather(v *WeatherResponseBody) *log.Weather {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &log.Weather{\n\t\tID: v.ID,\n\t\tCreatedAt: v.CreatedAt,\n\t\tFireID: v.FireID,\n\t\tLogID: v.LogID,\n\t\tHumidity: v.Humidity,\n\t\tWeatherType: v.WeatherType,\n\t\tWeatherTime: v.WeatherTime,\n\t}\n\tif v.Temperature != nil {\n\t\tres.Temperature = unmarshalTemperatureResponseBodyToLogTemperature(v.Temperature)\n\t}\n\tif v.DewPoint != nil {\n\t\tres.DewPoint = unmarshalTemperatureResponseBodyToLogTemperature(v.DewPoint)\n\t}\n\tif v.Wind != nil {\n\t\tres.Wind = unmarshalWindResponseBodyToLogWind(v.Wind)\n\t}\n\n\treturn res\n}", "func marshalRxRecipeResponseBodyToRxRecipeView(v *RxRecipeResponseBody) *recipeviews.RxRecipeView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &recipeviews.RxRecipeView{\n\t\tID: v.ID,\n\t\tTitle: v.Title,\n\t\tDescription: v.Description,\n\t\tVersion: v.Version,\n\t\tFavorite: v.Favorite,\n\t\tRating: v.Rating,\n\t\tDifficulty: v.Difficulty,\n\t\tState: v.State,\n\t\tComplete: v.Complete,\n\t}\n\tif v.Ingredients != nil {\n\t\tres.Ingredients = marshalIngredientListResponseBodyToIngredientListView(v.Ingredients)\n\t}\n\n\treturn res\n}", "func (o *GetUniverseStationsStationIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetUniverseStationsStationIDOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewGetUniverseStationsStationIDNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewGetUniverseStationsStationIDInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *THSRAPIDailyTrainInfo21233Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewTHSRAPIDailyTrainInfo21233OK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 299:\n\t\tresult := NewTHSRAPIDailyTrainInfo21233Status299()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 304:\n\t\tresult := NewTHSRAPIDailyTrainInfo21233NotModified()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func readResponseBody(resp *http.Response) (content []byte, err error) {\n\t// Get the content\n\tcontent, err = ioutil.ReadAll(resp.Body)\n\n\t// Reset the response body\n\trCloser := ioutil.NopCloser(bytes.NewBuffer(content))\n\tresp.Body = rCloser\n\n\treturn\n}", "func unmarshalFounderResponseBodyToWarehouseviewsFounderView(v *FounderResponseBody) *warehouseviews.FounderView {\n\tres := &warehouseviews.FounderView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func getResponseBody(r io.Reader) ([]byte, error) {\n\n\tbody, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\treturn body, nil\n}", "func (o *GetUniverseStationsStationIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetUniverseStationsStationIDOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 304:\n\t\tresult := NewGetUniverseStationsStationIDNotModified()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 400:\n\t\tresult := NewGetUniverseStationsStationIDBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewGetUniverseStationsStationIDNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 420:\n\t\tresult := NewGetUniverseStationsStationIDEnhanceYourCalm()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewGetUniverseStationsStationIDInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 503:\n\t\tresult := NewGetUniverseStationsStationIDServiceUnavailable()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 504:\n\t\tresult := NewGetUniverseStationsStationIDGatewayTimeout()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (o *GetSensorTypesCountUsingGETReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetSensorTypesCountUsingGETOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewGetSensorTypesCountUsingGETBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewGetSensorTypesCountUsingGETNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func NewGetUserResponseBodyTiny(res *userviews.UserView) *GetUserResponseBodyTiny {\n\tbody := &GetUserResponseBodyTiny{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t}\n\treturn body\n}", "func (in *Sensor) DeepCopy() *Sensor {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Sensor)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func DecodeResponseBody(body io.Reader, dest interface{}) error {\n\tdecoder := json.NewDecoder(body)\n\terr := decoder.Decode(dest)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to decode response body: %s\", err.Error())\n\t}\n\n\treturn nil\n}", "func NewGetUserResponseBody(res *userviews.UserView) *GetUserResponseBody {\n\tbody := &GetUserResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tEmail: *res.Email,\n\t\tScore: res.Score,\n\t}\n\treturn body\n}", "func marshalVironAPIViewToVironAPIResponseBody(v *vironviews.VironAPIView) *VironAPIResponseBody {\n\tres := &VironAPIResponseBody{\n\t\tMethod: *v.Method,\n\t\tPath: *v.Path,\n\t}\n\n\treturn res\n}", "func unmarshalTemperatureResponseBodyToLogTemperature(v *TemperatureResponseBody) *log.Temperature {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &log.Temperature{\n\t\tUnit: v.Unit,\n\t\tValue: v.Value,\n\t}\n\n\treturn res\n}", "func (o *WidgetValueReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewWidgetValueOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 404:\n\t\tresult := NewWidgetValueNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 504:\n\t\tresult := NewWidgetValueGatewayTimeout()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func marshalInventoryWarehouseToWarehouseResponseBody(v *inventory.Warehouse) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t\tCode: v.Code,\n\t\tAddress: v.Address,\n\t\tType: v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryFounderToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func (c *ClientCodec) ReadResponseBody(obj interface{}) error {\n\tpb, ok := obj.(proto.Message)\n\tif !ok {\n\t\treturn fmt.Errorf(\"%T does not implement proto.Message\", obj)\n\t}\n\n\treturn ReadProto(c.r, pb)\n}", "func (o *BikeAPIStation2180Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewBikeAPIStation2180OK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 299:\n\t\tresult := NewBikeAPIStation2180Status299()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 304:\n\t\tresult := NewBikeAPIStation2180NotModified()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func unmarshalWarehouseResponseBodyToWarehouseWarehouse(v *WarehouseResponseBody) *warehouse.Warehouse {\n\tres := &warehouse.Warehouse{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tCode: *v.Code,\n\t\tAddress: *v.Address,\n\t\tType: *v.Type,\n\t}\n\tres.Founder = unmarshalFounderResponseBodyToWarehouseFounder(v.Founder)\n\n\treturn res\n}", "func NewSensorController(rest *rest.Config, kubeClient kubernetes.Interface, sensorClient sensorclientset.Interface, log *zap.SugaredLogger, configMap string) *SensorController {\n\treturn &SensorController{\n\t\tkubeConfig: rest,\n\t\tkubeClientset: kubeClient,\n\t\tsensorClientset: sensorClient,\n\t\tConfigMap: configMap,\n\t\tssQueue: workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()),\n\t\tpodQueue: workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()),\n\t\tlog: log,\n\t}\n}", "func GetResponseBody(r *http.Response) (string, error) {\n\tif r == nil || r.Body == nil {\n\t\treturn \"\", nil\n\t}\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tr.Body = ioutil.NopCloser(bytes.NewBuffer(body))\n\n\treturn string(body), nil\n}", "func (d *SHT2xDriver) readSensor(cmd byte) (read uint16, err error) {\n\tif err = d.connection.WriteByte(cmd); err != nil {\n\t\treturn\n\t}\n\n\t//Hang out while measurement is taken. 85ms max, page 9 of datasheet.\n\ttime.Sleep(85 * time.Millisecond)\n\n\t//Comes back in three bytes, data(MSB) / data(LSB) / Checksum\n\tbuf := make([]byte, 3)\n\tcounter := 0\n\tfor {\n\t\tvar got int\n\t\tgot, err = d.connection.Read(buf)\n\t\tcounter++\n\t\tif counter > 50 {\n\t\t\treturn\n\t\t}\n\t\tif err == nil {\n\t\t\tif got != 3 {\n\t\t\t\terr = ErrNotEnoughBytes\n\t\t\t\treturn\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(1 * time.Millisecond)\n\t}\n\n\t//Store the result\n\tcrc := crc8.Checksum(buf[0:2], d.crcTable)\n\tif buf[2] != crc {\n\t\terr = errors.New(\"Invalid crc\")\n\t\treturn\n\t}\n\tread = uint16(buf[0])<<8 | uint16(buf[1])\n\tread &= 0xfffc // clear two low bits (status bits)\n\n\treturn\n}", "func unmarshalComponentResponseBodyToStorageviewsComponentView(v *ComponentResponseBody) *storageviews.ComponentView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &storageviews.ComponentView{\n\t\tVarietal: v.Varietal,\n\t\tPercentage: v.Percentage,\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsFounderViewToFounderResponseBody(v *inventoryviews.FounderView) *FounderResponseBody {\n\tres := &FounderResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func (i *InfluxDAO) GetLastSensorReadings(accountID string, state string) (*LatestSensorReadings, error) {\n\tvar sensors []*Sensor\n\tvar err error\n\tif sensors, err = i.deviceManager.GetSensors(accountID, state); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlatestReadings := &LatestSensorReadings{make(map[string]*SensorReading)}\n\tfor _, sensor := range sensors {\n\t\treading := &SensorReading{\n\t\t\tSensorID: sensor.ID,\n\t\t\tAccountID: sensor.AccountID,\n\t\t\tName: sensor.Name,\n\t\t\tState: sensor.State,\n\t\t}\n\n\t\tseries, err := i.getLastReadingForSensor(sensor.ID, sensor.AccountID)\n\t\tif err != nil {\n\t\t\treturn latestReadings, err\n\t\t}\n\n\t\tif series != nil {\n\t\t\treading.Measurements = make([]Measurement, 0)\n\t\t\tfor key, value := range series.Columns {\n\t\t\t\tif strings.Contains(value, \"time\") {\n\t\t\t\t\tvar timestamp time.Time\n\t\t\t\t\ttimestamp, err = time.Parse(time.RFC3339, series.Values[0][key].(string))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn latestReadings, err\n\t\t\t\t\t}\n\t\t\t\t\treading.Timestamp = timestamp.Unix()\n\t\t\t\t} else if strings.Contains(value, \"temperature\") {\n\t\t\t\t\tvar temperatureValue float64\n\t\t\t\t\ttemperatureValue, err = series.Values[0][key].(json.Number).Float64()\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\treading.Measurements = append(reading.Measurements, Measurement{\n\t\t\t\t\t\t\tName: value,\n\t\t\t\t\t\t\tUnit: \"Celsius\",\n\t\t\t\t\t\t\tValue: temperatureValue,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t} else if strings.Contains(value, \"humidity\") {\n\t\t\t\t\tvar humidityValue float64\n\t\t\t\t\thumidityValue, err = series.Values[0][key].(json.Number).Float64()\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\treading.Measurements = append(reading.Measurements, Measurement{\n\t\t\t\t\t\t\tName: value,\n\t\t\t\t\t\t\tUnit: \"%\",\n\t\t\t\t\t\t\tValue: humidityValue,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t} else if strings.Contains(value, \"soil_moisture\") {\n\t\t\t\t\tvar soilMoistureValue float64\n\t\t\t\t\tsoilMoistureValue, err = series.Values[0][key].(json.Number).Float64()\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\treading.Measurements = append(reading.Measurements, Measurement{\n\t\t\t\t\t\t\tName: value,\n\t\t\t\t\t\t\tUnit: \"VWC\",\n\t\t\t\t\t\t\tValue: soilMoistureValue,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlatestReadings.Sensors[reading.SensorID] = reading\n\t}\n\n\treturn latestReadings, err\n}", "func marshalInventoryviewsHeadViewToHeadResponseBody(v *inventoryviews.HeadView) *HeadResponseBody {\n\tres := &HeadResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func ParseSensorInfo(v url.Values) (out SensorInfo) {\n\tout.Temp, _ = strconv.ParseFloat(v.Get(\"htemp\"), 64)\n\tif otemp, err := strconv.ParseFloat(v.Get(\"otemp\"), 64); err == nil {\n\t\tout.World = &otemp\n\t}\n\treturn\n}", "func (i *InfluxDAO) QueryForSensorReadings(accountID, sensorID string, startTime, endTime int64) (*QueryForSensorReadingsResults, error) {\n\tresults := &QueryForSensorReadingsResults{accountID, sensorID, make([]*MinimalReading, 0)}\n\n\tres, err := i.queryDB(fmt.Sprintf(\"SELECT * from %s where sensor_id = '%s' and account_id = '%s' and time >= '%s' and time <= '%s' order by time desc\", sensorMeasurementsTableName, sensorID, accountID, time.Unix(startTime, 0).Format(time.RFC3339), time.Unix(endTime, 0).Format(time.RFC3339)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(res) != 1 || res[0].Series == nil || len(res[0].Series) == 0 {\n\t\treturn results, nil\n\t}\n\n\trow := res[0].Series[0]\n\n\tfor _, rowValues := range row.Values {\n\t\trowReading := &MinimalReading{\n\t\t\tMeasurements: make([]Measurement, 0),\n\t\t}\n\t\tfor k, v := range rowValues {\n\t\t\tvalueName := row.Columns[k]\n\t\t\tif strings.Contains(valueName, \"time\") {\n\t\t\t\tvar timestamp time.Time\n\t\t\t\ttimestamp, err = time.Parse(time.RFC3339, v.(string))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn results, err\n\t\t\t\t}\n\t\t\t\trowReading.Timestamp = timestamp.Unix()\n\t\t\t} else if strings.Contains(valueName, \"temperature\") {\n\t\t\t\tvar temperatureValue float64\n\t\t\t\ttemperatureValue, err = v.(json.Number).Float64()\n\t\t\t\tif err == nil {\n\t\t\t\t\trowReading.Measurements = append(rowReading.Measurements, Measurement{\n\t\t\t\t\t\tName: valueName,\n\t\t\t\t\t\tUnit: \"Celsius\",\n\t\t\t\t\t\tValue: temperatureValue,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t} else if strings.Contains(valueName, \"humidity\") {\n\t\t\t\tvar humidityValue float64\n\t\t\t\thumidityValue, err = v.(json.Number).Float64()\n\t\t\t\tif err == nil {\n\t\t\t\t\trowReading.Measurements = append(rowReading.Measurements, Measurement{\n\t\t\t\t\t\tName: valueName,\n\t\t\t\t\t\tUnit: \"%\",\n\t\t\t\t\t\tValue: humidityValue,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t} else if strings.Contains(valueName, \"soil_moisture\") {\n\t\t\t\tvar soilMoistureValue float64\n\t\t\t\tsoilMoistureValue, err = v.(json.Number).Float64()\n\t\t\t\tif err == nil {\n\t\t\t\t\trowReading.Measurements = append(rowReading.Measurements, Measurement{\n\t\t\t\t\t\tName: valueName,\n\t\t\t\t\t\tUnit: \"VWC\",\n\t\t\t\t\t\tValue: soilMoistureValue,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tresults.Readings = append(results.Readings, rowReading)\n\t}\n\treturn results, err\n}", "func EncodeSensorMetaResponse(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.(*sensor.SensorMetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func unmarshalWineryResponseToStorageviewsWineryView(v *WineryResponse) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func (o *MetroAPIStationOfLine2093Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewMetroAPIStationOfLine2093OK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 299:\n\t\tresult := NewMetroAPIStationOfLine2093Status299()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 304:\n\t\tresult := NewMetroAPIStationOfLine2093NotModified()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func (o *MetroAPIShape2105Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewMetroAPIShape2105OK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 299:\n\t\tresult := NewMetroAPIShape2105Status299()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 304:\n\t\tresult := NewMetroAPIShape2105NotModified()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func unmarshalPlatformResponseBodyToResourceviewsPlatformView(v *PlatformResponseBody) *resourceviews.PlatformView {\n\tres := &resourceviews.PlatformView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func (g *Given) Sensor(text string) *Given {\n\tg.t.Helper()\n\tg.sensor = &sensorv1alpha1.Sensor{}\n\tg.readResource(text, g.sensor)\n\tl := g.sensor.GetLabels()\n\tif l == nil {\n\t\tl = map[string]string{}\n\t}\n\tl[Label] = LabelValue\n\tg.sensor.SetLabels(l)\n\tg.sensor.Spec.EventBusName = EventBusName\n\treturn g\n}", "func marshalInventoryviewsProductViewToProductResponseBody(v *inventoryviews.ProductView) *ProductResponseBody {\n\tres := &ProductResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tUnit: *v.Unit,\n\t\tCostPrice: *v.CostPrice,\n\t\tMarketPrice: *v.MarketPrice,\n\t\tNote: *v.Note,\n\t\tImage: *v.Image,\n\t\tCode: *v.Code,\n\t\tSize: *v.Size,\n\t\tType: *v.Type,\n\t\tIsShelves: *v.IsShelves,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func NewCreateResponseBody(res *warehouseviews.WarehouseView) *CreateResponseBody {\n\tbody := &CreateResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func (db *DB) CreateSensorReading(sensorReading *SensorReading) error {\n\tstmt, err := db.Preparex(`INSERT INTO sensor_reading (reading_id, sensor_type_id, value) VALUES(?, ?, ?);`)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = stmt.Exec(sensorReading.ReadingId, sensorReading.SensorTypeId, sensorReading.Value)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (d *domainClient) TakeResponseBodyForInterceptionAsStream(ctx context.Context, args *TakeResponseBodyForInterceptionAsStreamArgs) (reply *TakeResponseBodyForInterceptionAsStreamReply, err error) {\n\treply = new(TakeResponseBodyForInterceptionAsStreamReply)\n\tif args != nil {\n\t\terr = rpcc.Invoke(ctx, \"Network.takeResponseBodyForInterceptionAsStream\", args, reply, d.conn)\n\t} else {\n\t\terr = rpcc.Invoke(ctx, \"Network.takeResponseBodyForInterceptionAsStream\", nil, reply, d.conn)\n\t}\n\tif err != nil {\n\t\terr = &internal.OpError{Domain: \"Network\", Op: \"TakeResponseBodyForInterceptionAsStream\", Err: err}\n\t}\n\treturn\n}", "func NewStatusResponseBody(res *spinbroker.StatusResult) *StatusResponseBody {\n\tbody := &StatusResponseBody{\n\t\tStatus: res.Status,\n\t\tReason: res.Reason,\n\t\tCauser: res.Causer,\n\t}\n\treturn body\n}", "func (v *VCR) FilterResponseBody(original string, replacement string) {\n\tv.mu.Lock()\n\tdefer v.mu.Unlock()\n\tv.FilterMap[original] = replacement\n}", "func (o *UpdateSensorUpdatePoliciesV2Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewUpdateSensorUpdatePoliciesV2OK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewUpdateSensorUpdatePoliciesV2BadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewUpdateSensorUpdatePoliciesV2Forbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewUpdateSensorUpdatePoliciesV2NotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 429:\n\t\tresult := NewUpdateSensorUpdatePoliciesV2TooManyRequests()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewUpdateSensorUpdatePoliciesV2InternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"[PATCH /policy/entities/sensor-update/v2] updateSensorUpdatePoliciesV2\", response, response.Code())\n\t}\n}", "func NewDeviceLayoutResponseViewOK(body *DeviceLayoutResponseBody) *informationviews.DeviceLayoutResponseView {\n\tv := &informationviews.DeviceLayoutResponseView{}\n\tv.Configurations = make([]*informationviews.StationConfigurationView, len(body.Configurations))\n\tfor i, val := range body.Configurations {\n\t\tv.Configurations[i] = unmarshalStationConfigurationResponseBodyToInformationviewsStationConfigurationView(val)\n\t}\n\tv.Sensors = make(map[string][]*informationviews.StationSensorView, len(body.Sensors))\n\tfor key, val := range body.Sensors {\n\t\ttk := key\n\t\ttv := make([]*informationviews.StationSensorView, len(val))\n\t\tfor i, val := range val {\n\t\t\ttv[i] = unmarshalStationSensorResponseBodyToInformationviewsStationSensorView(val)\n\t\t}\n\t\tv.Sensors[tk] = tv\n\t}\n\n\treturn v\n}", "func (o *CityBusAPIRealTimeNearStopByStation2879Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewCityBusAPIRealTimeNearStopByStation2879OK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 299:\n\t\tresult := NewCityBusAPIRealTimeNearStopByStation2879Status299()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 304:\n\t\tresult := NewCityBusAPIRealTimeNearStopByStation2879NotModified()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"response status code does not match any response statuses defined for this endpoint in the swagger spec\", response, response.Code())\n\t}\n}", "func unmarshalDeviceResponseBodyToChargewatchDevice(v *DeviceResponseBody) *chargewatch.Device {\n\tres := &chargewatch.Device{\n\t\tID: *v.ID,\n\t\tUserID: *v.UserID,\n\t\tName: *v.Name,\n\t\tDescription: *v.Description,\n\t\tState: *v.State,\n\t}\n\tres.Charge = unmarshalChargeResponseBodyToChargewatchCharge(v.Charge)\n\n\treturn res\n}", "func (tag *SensorTag) NewSensorConfig(uuid uuid.UUID) (*sensorConfig, error) {\n\tcfg, err := tag.device.GetCharByUUID(uuid.Config)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get config characteristic\")\n\t}\n\n\tdata, err := tag.device.GetCharByUUID(uuid.Data)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get data characteristic\")\n\t}\n\n\tperiod, err := tag.device.GetCharByUUID(uuid.Period)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get period characteristic\")\n\t}\n\n\treturn &sensorConfig{\n\t\tcfg: cfg,\n\t\tdata: data,\n\t\tperiod: period,\n\t}, nil\n}", "func (o *GetCombinedSensorInstallersByQueryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetCombinedSensorInstallersByQueryOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewGetCombinedSensorInstallersByQueryBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewGetCombinedSensorInstallersByQueryForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 429:\n\t\tresult := NewGetCombinedSensorInstallersByQueryTooManyRequests()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"[GET /sensors/combined/installers/v1] GetCombinedSensorInstallersByQuery\", response, response.Code())\n\t}\n}", "func (dev *SDRDevice) ReadChannelSensor(direction Direction, channel uint, key string) string {\n\n\tcKey := C.CString(key)\n\tdefer C.free(unsafe.Pointer(cKey))\n\n\tval := (*C.char)(C.SoapySDRDevice_readChannelSensor(dev.device, C.int(direction), C.size_t(channel), cKey))\n\tdefer C.free(unsafe.Pointer(val))\n\n\treturn C.GoString(val)\n}", "func NewSigninResponseBody(res *securedviews.GoaJWTView) *SigninResponseBody {\n\tbody := &SigninResponseBody{\n\t\tAuthorization: *res.Authorization,\n\t}\n\treturn body\n}", "func (o *PerformSensorUpdatePoliciesActionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewPerformSensorUpdatePoliciesActionOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewPerformSensorUpdatePoliciesActionBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewPerformSensorUpdatePoliciesActionForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewPerformSensorUpdatePoliciesActionNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 429:\n\t\tresult := NewPerformSensorUpdatePoliciesActionTooManyRequests()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewPerformSensorUpdatePoliciesActionInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tdefault:\n\t\tresult := NewPerformSensorUpdatePoliciesActionDefault(response.Code())\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif response.Code()/100 == 2 {\n\t\t\treturn result, nil\n\t\t}\n\t\treturn nil, result\n\t}\n}", "func WrapReadWriter(rw io.ReadWriter) FrameReadWriter {\n\treturn &socketDevice{rw}\n}", "func (o *GetOrganizationalUnitDayRatingsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewGetOrganizationalUnitDayRatingsOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewGetOrganizationalUnitDayRatingsBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 401:\n\t\tresult := NewGetOrganizationalUnitDayRatingsUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewGetOrganizationalUnitDayRatingsForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewGetOrganizationalUnitDayRatingsNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 429:\n\t\tresult := NewGetOrganizationalUnitDayRatingsTooManyRequests()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(v *discussionviews.ThreadedPostView) *ThreadedPostResponseBody {\n\tres := &ThreadedPostResponseBody{\n\t\tID: *v.ID,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tBody: *v.Body,\n\t\tBookmark: v.Bookmark,\n\t}\n\tif v.Author != nil {\n\t\tres.Author = marshalDiscussionviewsPostAuthorViewToPostAuthorResponseBody(v.Author)\n\t}\n\tif v.Replies != nil {\n\t\tres.Replies = make([]*ThreadedPostResponseBody, len(v.Replies))\n\t\tfor i, val := range v.Replies {\n\t\t\tres.Replies[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func NewSeriesDataDatasourceReaderWrapperFromWriter(w io.Writer) SeriesDataDatasourceReaderWrapper {\n return SeriesDataDatasourceReaderWrapper{\n w: w,\n }\n}", "func (s HueServer) GetSensors(ctx context.Context, in *hue.Empty) (*hue.Sensors, error) {\n\tstart := time.Now()\n\tss := sensors.New(hueBridge.Bridge, hueBridge.Username)\n\tallSensors, err := ss.GetAllSensors()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlog.WithField(\"bridge_exec_time\", time.Since(start)).\n\t\tWithField(\"call\", \"GetSensors\").Print(\"Incoming gRPC call\")\n\n\tsensorsResp := &hue.Sensors{}\n\tsensorsResp.Sensors = make([]*hue.Sensor, len(allSensors))\n\tfor i, s := range allSensors {\n\t\tsensorsResp.Sensors[i] = &hue.Sensor{\n\t\t\tID: int32(s.ID),\n\t\t\tUniqueID: s.UniqueID,\n\t\t\tName: s.Name,\n\t\t\tType: s.Type,\n\t\t\tModelID: s.ModelID,\n\t\t\tSWVersion: s.SWVersion,\n\t\t\tManufacturerName: s.ManufacturerName,\n\t\t\tState: &hue.State{\n\t\t\t\tButtonEvent: int32(s.State.ButtonEvent),\n\t\t\t\tDark: s.State.Dark,\n\t\t\t\tDaylight: s.State.Daylight,\n\t\t\t\tLastUpdated: s.State.LastUpdated,\n\t\t\t\tLightLevel: int32(s.State.LightLevel),\n\t\t\t\tPresence: s.State.Presence,\n\t\t\t\tStatus: int32(s.State.Status),\n\t\t\t\tTemperature: int32(s.State.Temperature),\n\t\t\t},\n\t\t}\n\t}\n\treturn sensorsResp, nil\n}", "func (o *UploadRegulaScanViewReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\tcase 200:\n\t\tresult := NewUploadRegulaScanViewOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\tcase 400:\n\t\tresult := NewUploadRegulaScanViewBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 401:\n\t\tresult := NewUploadRegulaScanViewUnauthorized()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 403:\n\t\tresult := NewUploadRegulaScanViewForbidden()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 404:\n\t\tresult := NewUploadRegulaScanViewNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\tcase 500:\n\t\tresult := NewUploadRegulaScanViewInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (d *DynamoDAO) GetSensor(sensorID string, accountID string) (*Sensor, error) {\n\tparams := &dynamodb.GetItemInput{\n\t\tKey: map[string]*dynamodb.AttributeValue{\n\t\t\t\"id\": {\n\t\t\t\tS: aws.String(sensorID),\n\t\t\t},\n\t\t},\n\t\tTableName: aws.String(\"sensors\"),\n\t\tAttributesToGet: []*string{\n\t\t\taws.String(\"name\"),\n\t\t\taws.String(\"state\"),\n\t\t\taws.String(\"account_id\"),\n\t\t\taws.String(\"sample_frequency\"),\n\t\t\taws.String(\"location_enabled\"),\n\t\t\taws.String(\"latitude\"),\n\t\t\taws.String(\"longitude\"),\n\t\t},\n\t}\n\n\tvar resp *dynamodb.GetItemOutput\n\tvar sensor *Sensor\n\tvar err error\n\tif resp, err = d.dynamoDBService.GetItem(params); err == nil {\n\t\tif resp.Item != nil {\n\t\t\tsensor = &Sensor{\n\t\t\t\tID: sensorID,\n\t\t\t\tAccountID: *resp.Item[\"account_id\"].S,\n\t\t\t\tName: *resp.Item[\"name\"].S,\n\t\t\t\tState: *resp.Item[\"state\"].S,\n\t\t\t\tLocationEnabled: *resp.Item[\"location_enabled\"].BOOL,\n\t\t\t}\n\t\t\tif resp.Item[\"sample_frequency\"] != nil {\n\t\t\t\tsensor.SampleFrequency, _ = strconv.ParseInt(*resp.Item[\"sample_frequency\"].N, 10, 64)\n\t\t\t} else {\n\t\t\t\tsensor.SampleFrequency = 60\n\t\t\t}\n\n\t\t\tif resp.Item[\"latitude\"] != nil && resp.Item[\"longitude\"] != nil {\n\t\t\t\tsensor.Latitude, _ = strconv.ParseFloat(*resp.Item[\"latitude\"].N, 64)\n\t\t\t\tsensor.Longitude, _ = strconv.ParseFloat(*resp.Item[\"longitude\"].N, 64)\n\t\t\t}\n\t\t}\n\t}\n\treturn sensor, err\n}", "func (s *sensorPackage) GetSensor() Sensor {\n\treturn s.manifest[s.currentIndex-1]\n}", "func GetModuleValue(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tvars := mux.Vars(r)\n\tid, err := strconv.Atoi(vars[\"id\"])\n\n\t// This shouldn't happen since the mux only accepts numbers to this route\n\tif err != nil {\n\t\thttp.Error(w, \"Invalid Id, please try again.\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tmodules := hardware.GetModules()\n\tmodule, err := getModuleByID(modules, id)\n\n\tif err != nil {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\tvalues := hardware.ReadStatus(module.Pin)\n\tvar sens sensor\n\tsens.Name = module.Name\n\tsens.Description = module.Description\n\tsens.ID = module.ID\n\tsens.Pin = module.Pin\n\tsens.Type = module.Type\n\tsens.Values = values\n\tfmt.Println(values)\n\tenc := json.NewEncoder(w)\n\terr = enc.Encode(sens)\n}", "func (s *SensorsService) Sensors(sensorsQueryParams *SensorsQueryParams) (*SensorsResponse, *resty.Response, error) {\n\n\tpath := \"/dna/intent/api/v1/sensor\"\n\n\tqueryString, _ := query.Values(sensorsQueryParams)\n\n\tresponse, err := RestyClient.R().\n\t\tSetQueryString(queryString.Encode()).\n\t\tSetResult(&SensorsResponse{}).\n\t\tSetError(&Error{}).\n\t\tGet(path)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tif response.IsError() {\n\t\treturn nil, response, fmt.Errorf(\"Error with operation sensors\")\n\t}\n\n\tresult := response.Result().(*SensorsResponse)\n\treturn result, response, err\n}", "func getResponseBody(body string) io.ReadCloser {\n\treader := strings.NewReader(body)\n\treturn ioutil.NopCloser(reader)\n}" ]
[ "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.5005275", "0.4988036", "0.49658537", "0.49310166", "0.49310166", "0.48947695", "0.48947695", "0.4890336", "0.4890336", "0.48099396", "0.48051563", "0.47494522", "0.46434063", "0.45961744", "0.4522382", "0.44503415", "0.44329613", "0.4429115", "0.44129533", "0.44029394", "0.43910658", "0.43893105", "0.43883067", "0.4384413", "0.43819612", "0.43757123", "0.43678552", "0.43591285", "0.4351979", "0.4345231", "0.4342537", "0.4318786", "0.43114325", "0.43026987", "0.425092", "0.42495447", "0.42459828", "0.420058", "0.41709682", "0.41680366", "0.416176", "0.4160815", "0.41479874", "0.41456625", "0.41446894", "0.41443452", "0.413219", "0.41211772", "0.41058663", "0.40865207", "0.40805057", "0.405885", "0.405824", "0.40528694", "0.40528604", "0.4042539", "0.40422368", "0.4041212", "0.40342638", "0.40326658", "0.40295067", "0.40289953", "0.40248838", "0.40220755", "0.40213382", "0.40095454", "0.40081298", "0.40061224", "0.39979506", "0.39882794", "0.39813182", "0.3976679", "0.39761534", "0.39674112", "0.3950869", "0.39467022", "0.3946289", "0.39368114" ]
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 = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Reading != nil {\n\t\tres.Reading = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "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\tfor i, val := range v.Shape {\n\t\t\tres.Shape[i] = make([][]float64, len(val))\n\t\t\tfor j, val := range val {\n\t\t\t\tres.Shape[i][j] = make([]float64, len(val))\n\t\t\t\tfor k, val := range val {\n\t\t\t\t\tres.Shape[i][j][k] = val\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}", "func ValidateSensorRangeResponseBody(body *SensorRangeResponseBody) (err error) {\n\tif body.Minimum == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"minimum\", \"body\"))\n\t}\n\tif body.Maximum == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"maximum\", \"body\"))\n\t}\n\treturn\n}", "func marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v *stationviews.StationDataSummaryView) *StationDataSummaryResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &StationDataSummaryResponseBody{\n\t\tStart: *v.Start,\n\t\tEnd: *v.End,\n\t\tNumberOfSamples: *v.NumberOfSamples,\n\t}\n\n\treturn res\n}", "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 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))\n\t\tfor i, val := range v.Precise {\n\t\t\tres.Precise[i] = val\n\t\t}\n\t}\n\tif v.Regions != nil {\n\t\tres.Regions = make([]*StationRegionResponseBody, len(v.Regions))\n\t\tfor i, val := range v.Regions {\n\t\t\tres.Regions[i] = marshalStationviewsStationRegionViewToStationRegionResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t\tFullKey: *v.FullKey,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsEssentialStationViewToEssentialStationResponseBody(v *stationviews.EssentialStationView) *EssentialStationResponseBody {\n\tres := &EssentialStationResponseBody{\n\t\tID: *v.ID,\n\t\tDeviceID: *v.DeviceID,\n\t\tName: *v.Name,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tLastIngestionAt: v.LastIngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "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.StationPhotosView) *StationPhotosResponseBody {\n\tres := &StationPhotosResponseBody{\n\t\tSmall: *v.Small,\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdated: *v.Updated,\n\t\tLocationName: v.LocationName,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Images != nil {\n\t\tres.Images = make([]*ImageRefResponseBody, len(v.Images))\n\t\tfor i, val := range v.Images {\n\t\t\tres.Images[i] = marshalStationviewsImageRefViewToImageRefResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func ValidateStationSensorResponseBody(body *StationSensorResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.UnitOfMeasure == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"unit_of_measure\", \"body\"))\n\t}\n\tif body.Key == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"key\", \"body\"))\n\t}\n\tif body.Ranges == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"ranges\", \"body\"))\n\t}\n\tif body.Reading != nil {\n\t\tif err2 := ValidateSensorReadingResponseBody(body.Reading); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\tfor _, e := range body.Ranges {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateSensorRangeResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func marshalMatchesviewsRatingViewToRatingResponseBody(v *matchesviews.RatingView) *RatingResponseBody {\n\tres := &RatingResponseBody{\n\t\tStrength: *v.Strength,\n\t\tLower: *v.Lower,\n\t\tUpper: *v.Upper,\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tLocationName: v.LocationName,\n\t\tPlaceNameOther: v.PlaceNameOther,\n\t\tPlaceNameNative: v.PlaceNameNative,\n\t\tSyncedAt: v.SyncedAt,\n\t\tIngestionAt: v.IngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\tif v.Data != nil {\n\t\tres.Data = marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v.Data)\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalStationviewsImageRefViewToImageRefResponseBody(v *stationviews.ImageRefView) *ImageRefResponseBody {\n\tres := &ImageRefResponseBody{\n\t\tURL: *v.URL,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationJobViewToStationJobResponseBody(v *stationviews.StationJobView) *StationJobResponseBody {\n\tres := &StationJobResponseBody{\n\t\tTitle: *v.Title,\n\t\tStartedAt: *v.StartedAt,\n\t\tCompletedAt: v.CompletedAt,\n\t\tProgress: *v.Progress,\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsWarehouseViewToWarehouseResponseBody(v *inventoryviews.WarehouseView) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tCode: *v.Code,\n\t\tAddress: *v.Address,\n\t\tType: *v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func ValidateEstimatedSeatTimeRangeResponseBody(body *EstimatedSeatTimeRangeResponseBody) (err error) {\n\tif body.StartSeconds == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"start_seconds\", \"body\"))\n\t}\n\tif body.EndSeconds == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"end_seconds\", \"body\"))\n\t}\n\treturn\n}", "func marshalMatchesviewsRatingResourceViewToRatingResourceResponseBody(v *matchesviews.RatingResourceView) *RatingResourceResponseBody {\n\tres := &RatingResourceResponseBody{\n\t\tRrn: *v.Rrn,\n\t}\n\tif v.Rating != nil {\n\t\tres.Rating = marshalMatchesviewsRatingViewToRatingResponseBody(v.Rating)\n\t}\n\n\treturn res\n}", "func unmarshalWineryResponseBodyToStorageviewsWineryView(v *WineryResponseBody) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func ValidateSensorReadingResponseBody(body *SensorReadingResponseBody) (err error) {\n\tif body.Last == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"last\", \"body\"))\n\t}\n\tif body.Time == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"time\", \"body\"))\n\t}\n\treturn\n}", "func unmarshalWindResponseBodyToLogWind(v *WindResponseBody) *log.Wind {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &log.Wind{\n\t\tSpeed: v.Speed,\n\t\tDirection: v.Direction,\n\t\tUnit: v.Unit,\n\t}\n\n\treturn res\n}", "func marshalVironAPIViewToVironAPIResponseBody(v *vironviews.VironAPIView) *VironAPIResponseBody {\n\tres := &VironAPIResponseBody{\n\t\tMethod: *v.Method,\n\t\tPath: *v.Path,\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsFounderViewToFounderResponseBody(v *inventoryviews.FounderView) *FounderResponseBody {\n\tres := &FounderResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func (sasr *SummaryAllocationSetRange) ToResponse() *SummaryAllocationSetRangeResponse {\n\tif sasr == nil {\n\t\treturn nil\n\t}\n\n\tsasrr := make([]*SummaryAllocationSetResponse, len(sasr.SummaryAllocationSets))\n\tfor i, v := range sasr.SummaryAllocationSets {\n\t\tsasrr[i] = v.ToResponse()\n\t}\n\n\treturn &SummaryAllocationSetRangeResponse{\n\t\tStep: sasr.Step,\n\t\tSummaryAllocationSets: sasrr,\n\t\tWindow: sasr.Window.Clone(),\n\t}\n}", "func unmarshalComponentResponseBodyToStorageviewsComponentView(v *ComponentResponseBody) *storageviews.ComponentView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &storageviews.ComponentView{\n\t\tVarietal: v.Varietal,\n\t\tPercentage: v.Percentage,\n\t}\n\n\treturn res\n}", "func NewStatusResponseBody(res *spinbroker.StatusResult) *StatusResponseBody {\n\tbody := &StatusResponseBody{\n\t\tStatus: res.Status,\n\t\tReason: res.Reason,\n\t\tCauser: res.Causer,\n\t}\n\treturn body\n}", "func ValueHTTPResponseBody(ctx context.Context) interface{} {\n\treturn ctx.Value(contextHTTPResponseBodyFields)\n}", "func ValidateStationModuleResponseBody(body *StationModuleResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.Position == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"position\", \"body\"))\n\t}\n\tif body.Flags == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"flags\", \"body\"))\n\t}\n\tif body.Internal == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"internal\", \"body\"))\n\t}\n\tif body.Sensors == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"sensors\", \"body\"))\n\t}\n\tfor _, e := range body.Sensors {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateStationSensorResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func marshalRxRecipeResponseBodyToRxRecipeView(v *RxRecipeResponseBody) *recipeviews.RxRecipeView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &recipeviews.RxRecipeView{\n\t\tID: v.ID,\n\t\tTitle: v.Title,\n\t\tDescription: v.Description,\n\t\tVersion: v.Version,\n\t\tFavorite: v.Favorite,\n\t\tRating: v.Rating,\n\t\tDifficulty: v.Difficulty,\n\t\tState: v.State,\n\t\tComplete: v.Complete,\n\t}\n\tif v.Ingredients != nil {\n\t\tres.Ingredients = marshalIngredientListResponseBodyToIngredientListView(v.Ingredients)\n\t}\n\n\treturn res\n}", "func marshalInventoryWarehouseToWarehouseResponseBody(v *inventory.Warehouse) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t\tCode: v.Code,\n\t\tAddress: v.Address,\n\t\tType: v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryFounderToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func ServerEncodeResponseBody(timeLayout string, format wrp.Format) gokithttp.EncodeResponseFunc {\n\treturn func(ctx context.Context, httpResponse http.ResponseWriter, value interface{}) error {\n\t\tvar (\n\t\t\twrpResponse = value.(wrpendpoint.Response)\n\t\t\toutput bytes.Buffer\n\t\t)\n\n\t\ttracinghttp.HeadersForSpans(timeLayout, httpResponse.Header(), wrpResponse.Spans()...)\n\n\t\tif err := wrpResponse.Encode(&output, format); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\thttpResponse.Header().Set(\"Content-Type\", format.ContentType())\n\t\t_, err := output.WriteTo(httpResponse)\n\t\treturn err\n\t}\n}", "func NewListResponseBody(res *stepviews.StoredListOfStepsView) *ListResponseBody {\n\tbody := &ListResponseBody{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Steps != nil {\n\t\tbody.Steps = make([]*StoredStepResponseBody, len(res.Steps))\n\t\tfor i, val := range res.Steps {\n\t\t\tbody.Steps[i] = marshalStepviewsStoredStepViewToStoredStepResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(v *discussionviews.ThreadedPostView) *ThreadedPostResponseBody {\n\tres := &ThreadedPostResponseBody{\n\t\tID: *v.ID,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tBody: *v.Body,\n\t\tBookmark: v.Bookmark,\n\t}\n\tif v.Author != nil {\n\t\tres.Author = marshalDiscussionviewsPostAuthorViewToPostAuthorResponseBody(v.Author)\n\t}\n\tif v.Replies != nil {\n\t\tres.Replies = make([]*ThreadedPostResponseBody, len(v.Replies))\n\t\tfor i, val := range v.Replies {\n\t\t\tres.Replies[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func (r Range) ToView() *buffer.View {\n\tif r.length == 0 {\n\t\treturn nil\n\t}\n\tnewV := buffer.NewView(r.length)\n\tr.iterate(func(v *buffer.View) {\n\t\tnewV.Write(v.AsSlice())\n\t})\n\treturn newV\n}", "func NewGetUserResponseBodyTiny(res *userviews.UserView) *GetUserResponseBodyTiny {\n\tbody := &GetUserResponseBodyTiny{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t}\n\treturn body\n}", "func NewSigninUnauthorizedResponseBody(res secured.Unauthorized) SigninUnauthorizedResponseBody {\n\tbody := SigninUnauthorizedResponseBody(res)\n\treturn body\n}", "func (v *VCR) FilterResponseBody(original string, replacement string) {\n\tv.mu.Lock()\n\tdefer v.mu.Unlock()\n\tv.FilterMap[original] = replacement\n}", "func unmarshalFounderResponseBodyToWarehouseviewsFounderView(v *FounderResponseBody) *warehouseviews.FounderView {\n\tres := &warehouseviews.FounderView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func (o OutlierDetectionResponseOutput) Interval() DurationResponseOutput {\n\treturn o.ApplyT(func(v OutlierDetectionResponse) DurationResponse { return v.Interval }).(DurationResponseOutput)\n}", "func NewGetUserLikeTechUnauthorizedResponseBody(res *goa.ServiceError) *GetUserLikeTechUnauthorizedResponseBody {\n\tbody := &GetUserLikeTechUnauthorizedResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "func NewUpdateResponseBody(res *warehouseviews.WarehouseView) *UpdateResponseBody {\n\tbody := &UpdateResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func (ut *jSONDataMetaSensorRange) Validate() (err error) {\n\tif ut.Minimum == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"minimum\"))\n\t}\n\tif ut.Maximum == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"maximum\"))\n\t}\n\treturn\n}", "func EncodeSensorMetaResponse(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.(*sensor.SensorMetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func NewGetResponseBody(res *warehouseviews.WarehouseView) *GetResponseBody {\n\tbody := &GetResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func unmarshalPlatformResponseBodyToResourceviewsPlatformView(v *PlatformResponseBody) *resourceviews.PlatformView {\n\tres := &resourceviews.PlatformView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func unmarshalTagResponseBodyToResourceviewsTagView(v *TagResponseBody) *resourceviews.TagView {\n\tres := &resourceviews.TagView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func unmarshalVersionsResponseBodyToResourceviewsVersionsView(v *VersionsResponseBody) *resourceviews.VersionsView {\n\tres := &resourceviews.VersionsView{}\n\tres.Latest = unmarshalResourceVersionDataResponseBodyToResourceviewsResourceVersionDataView(v.Latest)\n\tres.Versions = make([]*resourceviews.ResourceVersionDataView, len(v.Versions))\n\tfor i, val := range v.Versions {\n\t\tres.Versions[i] = unmarshalResourceVersionDataResponseBodyToResourceviewsResourceVersionDataView(val)\n\t}\n\n\treturn res\n}", "func UnmarshalStationMonitorResponse(res *HttpResponse)(*Journey,error){\n\tbody, err := ioutil.ReadAll(res.Response.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar record Journey\n\terr=parseResponseObject(body,record)\n\treturn &record, err\n}", "func DecodeResponseBody(body io.Reader, dest interface{}) error {\n\tdecoder := json.NewDecoder(body)\n\terr := decoder.Decode(dest)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to decode response body: %s\", err.Error())\n\t}\n\n\treturn nil\n}", "func NewGetUserResponseBody(res *userviews.UserView) *GetUserResponseBody {\n\tbody := &GetUserResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tEmail: *res.Email,\n\t\tScore: res.Score,\n\t}\n\treturn body\n}", "func (o RouterAdvertisedIpRangeResponseOutput) Range() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RouterAdvertisedIpRangeResponse) string { return v.Range }).(pulumi.StringOutput)\n}", "func marshalDiscussionviewsAuthorPhotoViewToAuthorPhotoResponseBody(v *discussionviews.AuthorPhotoView) *AuthorPhotoResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &AuthorPhotoResponseBody{\n\t\tURL: *v.URL,\n\t}\n\n\treturn res\n}", "func (m *GetSchedulePostRequestBody) SetAvailabilityViewInterval(value *int32)() {\n m.availabilityViewInterval = value\n}", "func NewFollowersUnauthorizedResponseBody(res following.Unauthorized) FollowersUnauthorizedResponseBody {\n\tbody := FollowersUnauthorizedResponseBody(res)\n\treturn body\n}", "func marshalInventoryviewsProductViewToProductResponseBody(v *inventoryviews.ProductView) *ProductResponseBody {\n\tres := &ProductResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tUnit: *v.Unit,\n\t\tCostPrice: *v.CostPrice,\n\t\tMarketPrice: *v.MarketPrice,\n\t\tNote: *v.Note,\n\t\tImage: *v.Image,\n\t\tCode: *v.Code,\n\t\tSize: *v.Size,\n\t\tType: *v.Type,\n\t\tIsShelves: *v.IsShelves,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func (m *SensorsResponse) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateLinks(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSensorsResponseInlineRecords(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}", "func NewAdminGetUserUnauthorizedResponseBody(res admin.Unauthorized) AdminGetUserUnauthorizedResponseBody {\n\tbody := AdminGetUserUnauthorizedResponseBody(res)\n\treturn body\n}", "func marshalInventoryviewsHeadViewToHeadResponseBody(v *inventoryviews.HeadView) *HeadResponseBody {\n\tres := &HeadResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func (d *domainClient) TakeResponseBodyForInterceptionAsStream(ctx context.Context, args *TakeResponseBodyForInterceptionAsStreamArgs) (reply *TakeResponseBodyForInterceptionAsStreamReply, err error) {\n\treply = new(TakeResponseBodyForInterceptionAsStreamReply)\n\tif args != nil {\n\t\terr = rpcc.Invoke(ctx, \"Network.takeResponseBodyForInterceptionAsStream\", args, reply, d.conn)\n\t} else {\n\t\terr = rpcc.Invoke(ctx, \"Network.takeResponseBodyForInterceptionAsStream\", nil, reply, d.conn)\n\t}\n\tif err != nil {\n\t\terr = &internal.OpError{Domain: \"Network\", Op: \"TakeResponseBodyForInterceptionAsStream\", Err: err}\n\t}\n\treturn\n}", "func NewCreateResponseBody(res *warehouseviews.WarehouseView) *CreateResponseBody {\n\tbody := &CreateResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func newBattlestreamingresultView(res *Battlestreamingresult) *shiritoriviews.BattlestreamingresultView {\n\tvres := &shiritoriviews.BattlestreamingresultView{\n\t\tType: &res.Type,\n\t\tTimestamp: &res.Timestamp,\n\t}\n\tif res.MessagePayload != nil {\n\t\tvres.MessagePayload = transformMessagePayloadToShiritoriviewsMessagePayloadView(res.MessagePayload)\n\t}\n\treturn vres\n}", "func NewDeviceLayoutResponseViewOK(body *DeviceLayoutResponseBody) *informationviews.DeviceLayoutResponseView {\n\tv := &informationviews.DeviceLayoutResponseView{}\n\tv.Configurations = make([]*informationviews.StationConfigurationView, len(body.Configurations))\n\tfor i, val := range body.Configurations {\n\t\tv.Configurations[i] = unmarshalStationConfigurationResponseBodyToInformationviewsStationConfigurationView(val)\n\t}\n\tv.Sensors = make(map[string][]*informationviews.StationSensorView, len(body.Sensors))\n\tfor key, val := range body.Sensors {\n\t\ttk := key\n\t\ttv := make([]*informationviews.StationSensorView, len(val))\n\t\tfor i, val := range val {\n\t\t\ttv[i] = unmarshalStationSensorResponseBodyToInformationviewsStationSensorView(val)\n\t\t}\n\t\tv.Sensors[tk] = tv\n\t}\n\n\treturn v\n}", "func ValidateStationConfigurationResponseBody(body *StationConfigurationResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.ProvisionID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"provision_id\", \"body\"))\n\t}\n\tif body.Time == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"time\", \"body\"))\n\t}\n\tif body.Modules == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"modules\", \"body\"))\n\t}\n\tfor _, e := range body.Modules {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateStationModuleResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func marshalChatterviewsChatSummaryViewToChatSummaryResponse(v *chatterviews.ChatSummaryView) *ChatSummaryResponse {\n\tres := &ChatSummaryResponse{\n\t\tMessage: *v.Message,\n\t\tLength: v.Length,\n\t\tSentAt: *v.SentAt,\n\t}\n\n\treturn res\n}", "func NewFollowUnauthorizedResponseBody(res following.Unauthorized) FollowUnauthorizedResponseBody {\n\tbody := FollowUnauthorizedResponseBody(res)\n\treturn body\n}", "func UnmarshalWorkspaceTemplateValuesResponse(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(WorkspaceTemplateValuesResponse)\n\terr = core.UnmarshalModel(m, \"runtime_data\", &obj.RuntimeData, UnmarshalTemplateRunTimeDataResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"shared_data\", &obj.SharedData, UnmarshalSharedTargetData)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"template_data\", &obj.TemplateData, UnmarshalTemplateSourceDataResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func unmarshalWineryResponseToStorageviewsWineryView(v *WineryResponse) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func NewSigninResponseBody(res *securedviews.GoaJWTView) *SigninResponseBody {\n\tbody := &SigninResponseBody{\n\t\tAuthorization: *res.Authorization,\n\t}\n\treturn body\n}", "func GetScreenSizeRangeUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenSizeRangeCookie {\n\tc.ExtLock.RLock()\n\tdefer c.ExtLock.RUnlock()\n\tif _, ok := c.Extensions[\"RANDR\"]; !ok {\n\t\tpanic(\"Cannot issue request 'GetScreenSizeRange' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.\")\n\t}\n\tcookie := c.NewCookie(false, true)\n\tc.NewRequest(getScreenSizeRangeRequest(c, Window), cookie)\n\treturn GetScreenSizeRangeCookie{cookie}\n}", "func NewGetUserDisLikeTechUnauthorizedResponseBody(res *goa.ServiceError) *GetUserDisLikeTechUnauthorizedResponseBody {\n\tbody := &GetUserDisLikeTechUnauthorizedResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "func (o TransformationResponseOutput) StreamingUnits() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v TransformationResponse) *int { return v.StreamingUnits }).(pulumi.IntPtrOutput)\n}", "func (ser *Series) WriteRange(w io.Writer, first, last int) {\n\n\tif _, err := io.WriteString(w, fmt.Sprintf(\"Name: %s\\n\", ser.Name)); err != nil {\n\t\tpanic(err)\n\t}\n\tty := fmt.Sprintf(\"%T\", ser.data)\n\tif _, err := io.WriteString(w, fmt.Sprintf(\"Type: %s\\n\", ty[2:])); err != nil {\n\t\tpanic(err)\n\t}\n\n\tswitch ser.data.(type) {\n\tcase []float64:\n\t\tdata := ser.data.([]float64)\n\t\tfor j := first; j < last; j++ {\n\t\t\tif ser.missing == nil || !ser.missing[j] {\n\t\t\t\ts := fmt.Sprintf(\"%d: %f\\n\", j, data[j])\n\t\t\t\tif _, err := io.WriteString(w, s); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif _, err := io.WriteString(w, fmt.Sprintf(\"%d:\\n\", j)); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcase []float32:\n\t\tdata := ser.data.([]float32)\n\t\tfor j := first; j < last; j++ {\n\t\t\tif ser.missing == nil || !ser.missing[j] {\n\t\t\t\ts := fmt.Sprintf(\"%d: %f\\n\", j, data[j])\n\t\t\t\tif _, err := io.WriteString(w, s); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif _, err := io.WriteString(w, fmt.Sprintf(\"%d:\\n\", j)); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcase []int64:\n\t\tdata := ser.data.([]int64)\n\t\tfor j := first; j < last; j++ {\n\t\t\tif ser.missing == nil || !ser.missing[j] {\n\t\t\t\ts := fmt.Sprintf(\"%d: %d\\n\", j, data[j])\n\t\t\t\tif _, err := io.WriteString(w, s); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif _, err := io.WriteString(w, fmt.Sprintf(\"%d:\\n\", j)); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcase []int32:\n\t\tdata := ser.data.([]int32)\n\t\tfor j := first; j < last; j++ {\n\t\t\tif ser.missing == nil || !ser.missing[j] {\n\t\t\t\ts := fmt.Sprintf(\"%d: %d\\n\", j, data[j])\n\t\t\t\tif _, err := io.WriteString(w, s); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif _, err := io.WriteString(w, fmt.Sprintf(\"%d:\\n\", j)); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcase []int16:\n\t\tdata := ser.data.([]int16)\n\t\tfor j := first; j < last; j++ {\n\t\t\tif ser.missing == nil || !ser.missing[j] {\n\t\t\t\ts := fmt.Sprintf(\"%d: %d\\n\", j, data[j])\n\t\t\t\tif _, err := io.WriteString(w, s); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif _, err := io.WriteString(w, fmt.Sprintf(\"%d:\\n\", j)); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcase []int8:\n\t\tdata := ser.data.([]int8)\n\t\tfor j := first; j < last; j++ {\n\t\t\tif ser.missing == nil || !ser.missing[j] {\n\t\t\t\ts := fmt.Sprintf(\"%d: %d\\n\", j, data[j])\n\t\t\t\tif _, err := io.WriteString(w, s); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif _, err := io.WriteString(w, fmt.Sprintf(\"%d:\\n\", j)); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcase []uint64:\n\t\tdata := ser.data.([]uint64)\n\t\tfor j := first; j < last; j++ {\n\t\t\tif ser.missing == nil || !ser.missing[j] {\n\t\t\t\ts := fmt.Sprintf(\"%d: %d\\n\", j, data[j])\n\t\t\t\tif _, err := io.WriteString(w, s); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif _, err := io.WriteString(w, fmt.Sprintf(\"%d:\\n\", j)); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcase []string:\n\t\tdata := ser.data.([]string)\n\t\tfor j := first; j < last; j++ {\n\t\t\tif ser.missing == nil || !ser.missing[j] {\n\t\t\t\ts := fmt.Sprintf(\"%d: %s\\n\", j, data[j])\n\t\t\t\tif _, err := io.WriteString(w, s); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif _, err := io.WriteString(w, fmt.Sprintf(\"%d:\\n\", j)); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcase []time.Time:\n\t\tdata := ser.data.([]time.Time)\n\t\tfor j := first; j < last; j++ {\n\t\t\tif ser.missing == nil || !ser.missing[j] {\n\t\t\t\ts := fmt.Sprintf(\"%d: %v\\n\", j, data[j])\n\t\t\t\tif _, err := io.WriteString(w, s); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif _, err := io.WriteString(w, fmt.Sprintf(\"%d:\\n\", j)); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tpanic(\"Unknown type in WriteRange\")\n\t}\n}", "func unmarshalWarehouseResponseBodyToWarehouseWarehouse(v *WarehouseResponseBody) *warehouse.Warehouse {\n\tres := &warehouse.Warehouse{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tCode: *v.Code,\n\t\tAddress: *v.Address,\n\t\tType: *v.Type,\n\t}\n\tres.Founder = unmarshalFounderResponseBodyToWarehouseFounder(v.Founder)\n\n\treturn res\n}", "func (s HueServer) GetSensors(ctx context.Context, in *hue.Empty) (*hue.Sensors, error) {\n\tstart := time.Now()\n\tss := sensors.New(hueBridge.Bridge, hueBridge.Username)\n\tallSensors, err := ss.GetAllSensors()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlog.WithField(\"bridge_exec_time\", time.Since(start)).\n\t\tWithField(\"call\", \"GetSensors\").Print(\"Incoming gRPC call\")\n\n\tsensorsResp := &hue.Sensors{}\n\tsensorsResp.Sensors = make([]*hue.Sensor, len(allSensors))\n\tfor i, s := range allSensors {\n\t\tsensorsResp.Sensors[i] = &hue.Sensor{\n\t\t\tID: int32(s.ID),\n\t\t\tUniqueID: s.UniqueID,\n\t\t\tName: s.Name,\n\t\t\tType: s.Type,\n\t\t\tModelID: s.ModelID,\n\t\t\tSWVersion: s.SWVersion,\n\t\t\tManufacturerName: s.ManufacturerName,\n\t\t\tState: &hue.State{\n\t\t\t\tButtonEvent: int32(s.State.ButtonEvent),\n\t\t\t\tDark: s.State.Dark,\n\t\t\t\tDaylight: s.State.Daylight,\n\t\t\t\tLastUpdated: s.State.LastUpdated,\n\t\t\t\tLightLevel: int32(s.State.LightLevel),\n\t\t\t\tPresence: s.State.Presence,\n\t\t\t\tStatus: int32(s.State.Status),\n\t\t\t\tTemperature: int32(s.State.Temperature),\n\t\t\t},\n\t\t}\n\t}\n\treturn sensorsResp, nil\n}", "func marshalDiscussionThreadedPostToThreadedPostResponseBody(v *discussion.ThreadedPost) *ThreadedPostResponseBody {\n\tres := &ThreadedPostResponseBody{\n\t\tID: v.ID,\n\t\tCreatedAt: v.CreatedAt,\n\t\tUpdatedAt: v.UpdatedAt,\n\t\tBody: v.Body,\n\t\tBookmark: v.Bookmark,\n\t}\n\tif v.Author != nil {\n\t\tres.Author = marshalDiscussionPostAuthorToPostAuthorResponseBody(v.Author)\n\t}\n\tif v.Replies != nil {\n\t\tres.Replies = make([]*ThreadedPostResponseBody, len(v.Replies))\n\t\tfor i, val := range v.Replies {\n\t\t\tres.Replies[i] = marshalDiscussionThreadedPostToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func unmarshalTemperatureResponseBodyToLogTemperature(v *TemperatureResponseBody) *log.Temperature {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &log.Temperature{\n\t\tUnit: v.Unit,\n\t\tValue: v.Value,\n\t}\n\n\treturn res\n}", "func (tv *TextView) RenderRegionToEnd(st TextPos, sty *gi.Style, bgclr *gi.ColorSpec) {\n\tspos := tv.CharStartPos(st)\n\tepos := spos\n\tepos.Y += tv.LineHeight\n\tepos.X = float32(tv.VpBBox.Max.X)\n\tif int(mat32.Ceil(epos.Y)) < tv.VpBBox.Min.Y || int(mat32.Floor(spos.Y)) > tv.VpBBox.Max.Y {\n\t\treturn\n\t}\n\n\trs := &tv.Viewport.Render\n\tpc := &rs.Paint\n\n\tpc.FillBox(rs, spos, epos.Sub(spos), bgclr) // same line, done\n}", "func GetResponseBody(r *http.Response) (string, error) {\n\tif r == nil || r.Body == nil {\n\t\treturn \"\", nil\n\t}\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tr.Body = ioutil.NopCloser(bytes.NewBuffer(body))\n\n\treturn string(body), nil\n}", "func (s *SensorsService) Sensors(sensorsQueryParams *SensorsQueryParams) (*SensorsResponse, *resty.Response, error) {\n\n\tpath := \"/dna/intent/api/v1/sensor\"\n\n\tqueryString, _ := query.Values(sensorsQueryParams)\n\n\tresponse, err := RestyClient.R().\n\t\tSetQueryString(queryString.Encode()).\n\t\tSetResult(&SensorsResponse{}).\n\t\tSetError(&Error{}).\n\t\tGet(path)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tif response.IsError() {\n\t\treturn nil, response, fmt.Errorf(\"Error with operation sensors\")\n\t}\n\n\tresult := response.Result().(*SensorsResponse)\n\treturn result, response, err\n}", "func (ut *JSONDataMetaSensorRange) Validate() (err error) {\n\n\treturn\n}", "func CreateSensorsEndpoint(externalURL string) *endpoint.Endpoint {\n\treturn &endpoint.Endpoint{\n\t\tName: \"Sensors\",\n\t\tEntityType: entities.EntityTypeSensor,\n\t\tOutputInfo: true,\n\t\tURL: fmt.Sprintf(\"%s/%s/%s\", externalURL, models.APIPrefix, fmt.Sprintf(\"%v\", \"Sensors\")),\n\t\tSupportedExpandParams: []string{\n\t\t\t\"datastreams\",\n\t\t},\n\t\tSupportedSelectParams: []string{\n\t\t\t\"id\",\n\t\t\t\"name\",\n\t\t\t\"description\",\n\t\t\t\"encodingtype\",\n\t\t\t\"metadata\",\n\t\t\t\"datastreams\",\n\t\t},\n\t\tOperations: []models.EndpointOperation{\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/sensors\", Handler: handlers.HandleGetSensors},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/sensors{id}\", Handler: handlers.HandleGetSensor},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/datastreams{id}/sensor\", Handler: handlers.HandleGetSensorByDatastream},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/datastreams{id}/sensor/{params}\", Handler: handlers.HandleGetSensorByDatastream},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/datastreams{id}/sensor/{params}/$value\", Handler: handlers.HandleGetSensorByDatastream},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/sensors{id}/{params}\", Handler: handlers.HandleGetSensor},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/sensors{id}/{params}/$value\", Handler: handlers.HandleGetSensor},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/sensors/{params}\", Handler: handlers.HandleGetSensors},\n\n\t\t\t{OperationType: models.HTTPOperationPost, Path: \"/v1.0/sensors\", Handler: handlers.HandlePostSensors},\n\t\t\t{OperationType: models.HTTPOperationDelete, Path: \"/v1.0/sensors{id}\", Handler: handlers.HandleDeleteSensor},\n\t\t\t{OperationType: models.HTTPOperationPatch, Path: \"/v1.0/sensors{id}\", Handler: handlers.HandlePatchSensor},\n\t\t\t{OperationType: models.HTTPOperationPut, Path: \"/v1.0/sensors{id}\", Handler: handlers.HandlePutSensor},\n\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/{c:.*}/sensors\", Handler: handlers.HandleGetSensors},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/{c:.*}/sensors{id}\", Handler: handlers.HandleGetSensor},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/{c:.*}/datastreams{id}/sensor\", Handler: handlers.HandleGetSensorByDatastream},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/{c:.*}/datastreams{id}/sensor/{params}\", Handler: handlers.HandleGetSensorByDatastream},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/{c:.*}/datastreams{id}/sensor/{params}/$value\", Handler: handlers.HandleGetSensorByDatastream},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/{c:.*}/sensors{id}/{params}\", Handler: handlers.HandleGetSensor},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/{c:.*}/sensors{id}/{params}/$value\", Handler: handlers.HandleGetSensor},\n\t\t\t{OperationType: models.HTTPOperationGet, Path: \"/v1.0/{c:.*}/sensors/{params}\", Handler: handlers.HandleGetSensors},\n\n\t\t\t{OperationType: models.HTTPOperationPost, Path: \"/v1.0/{c:.*}/sensors\", Handler: handlers.HandlePostSensors},\n\t\t\t{OperationType: models.HTTPOperationDelete, Path: \"/v1.0/{c:.*}/sensors{id}\", Handler: handlers.HandleDeleteSensor},\n\t\t\t{OperationType: models.HTTPOperationPatch, Path: \"/v1.0/{c:.*}/sensors{id}\", Handler: handlers.HandlePatchSensor},\n\t\t\t{OperationType: models.HTTPOperationPut, Path: \"/v1.0/{c:.*}/sensors{id}\", Handler: handlers.HandlePutSensor},\n\t\t},\n\t}\n}", "func NewVironMenuResponseBody(res *vironviews.VironMenuView) *VironMenuResponseBody {\n\tbody := &VironMenuResponseBody{\n\t\tName: *res.Name,\n\t\tThumbnail: res.Thumbnail,\n\t\tColor: res.Color,\n\t\tTheme: res.Theme,\n\t}\n\tif res.Tags != nil {\n\t\tbody.Tags = make([]string, len(res.Tags))\n\t\tfor i, val := range res.Tags {\n\t\t\tbody.Tags[i] = val\n\t\t}\n\t}\n\tif res.Pages != nil {\n\t\tbody.Pages = make([]*VironPageResponseBody, len(res.Pages))\n\t\tfor i, val := range res.Pages {\n\t\t\tbody.Pages[i] = &VironPageResponseBody{\n\t\t\t\tID: *val.ID,\n\t\t\t\tName: *val.Name,\n\t\t\t\tSection: *val.Section,\n\t\t\t\tGroup: val.Group,\n\t\t\t}\n\t\t\tif val.Components != nil {\n\t\t\t\tbody.Pages[i].Components = make([]*VironComponentResponseBody, len(val.Components))\n\t\t\t\tfor j, val := range val.Components {\n\t\t\t\t\tbody.Pages[i].Components[j] = &VironComponentResponseBody{\n\t\t\t\t\t\tName: *val.Name,\n\t\t\t\t\t\tStyle: *val.Style,\n\t\t\t\t\t\tUnit: val.Unit,\n\t\t\t\t\t\tPagination: val.Pagination,\n\t\t\t\t\t\tPrimary: val.Primary,\n\t\t\t\t\t\tAutoRefreshSec: val.AutoRefreshSec,\n\t\t\t\t\t}\n\t\t\t\t\tif val.Actions != nil {\n\t\t\t\t\t\tbody.Pages[i].Components[j].Actions = make([]string, len(val.Actions))\n\t\t\t\t\t\tfor k, val := range val.Actions {\n\t\t\t\t\t\t\tbody.Pages[i].Components[j].Actions[k] = val\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif val.API != nil {\n\t\t\t\t\t\tbody.Pages[i].Components[j].API = marshalVironAPIViewToVironAPIResponseBody(val.API)\n\t\t\t\t\t}\n\t\t\t\t\tif val.TableLabels != nil {\n\t\t\t\t\t\tbody.Pages[i].Components[j].TableLabels = make([]string, len(val.TableLabels))\n\t\t\t\t\t\tfor k, val := range val.TableLabels {\n\t\t\t\t\t\t\tbody.Pages[i].Components[j].TableLabels[k] = val\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif val.Query != nil {\n\t\t\t\t\t\tbody.Pages[i].Components[j].Query = make([]*VironQueryResponseBody, len(val.Query))\n\t\t\t\t\t\tfor k, val := range val.Query {\n\t\t\t\t\t\t\tbody.Pages[i].Components[j].Query[k] = &VironQueryResponseBody{\n\t\t\t\t\t\t\t\tKey: *val.Key,\n\t\t\t\t\t\t\t\tType: *val.Type,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn body\n}", "func getSensorData(w http.ResponseWriter, r *http.Request) {\n\tquery := r.URL.Query()\n\ts := query.Get(\"starttime\")\n\te := query.Get(\"endtime\")\n\tsensorType := query.Get(\"sensortype\")\n\tif s == \"\" || e == \"\" || sensorType == \"\" {\n\t\trespondWithError(w, http.StatusBadRequest, fmt.Errorf(\"empty parameters being passed\"))\n\t\treturn\n\t}\n\tstart, err := strconv.Atoi(s)\n\tif err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, fmt.Errorf(\"check the value of parameters being passed\"))\n\t\treturn\n\t}\n\tend, err := strconv.Atoi(e)\n\tif err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, fmt.Errorf(\"check the value of parameters being passed\"))\n\t\treturn\n\t}\n\tclaims := getClaims(w, r)\n\tvar st consts.BucketFilter\n\tkey := claims[\"key\"].(string)\n\tswitch strings.ToLower(sensorType) {\n\tcase \"humidity\":\n\t\tst = consts.Humidity\n\tcase \"temperature\":\n\t\tst = consts.Temperature\n\tcase \"waterlevel\":\n\t\tst = consts.WaterLevel\n\tcase \"ph\":\n\t\tst = consts.PH\n\tcase \"all\":\n\t\tst = consts.All\n\tdefault:\n\t\trespondWithError(w, http.StatusNotFound, fmt.Errorf(\"page not found\"))\n\t\treturn\n\t}\n\n\tdata, err := db.GetSensorData([]byte(key), st, int64(start), int64(end))\n\tif err != nil {\n\t\trespondWithError(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tsendResponse(w, data)\n\treturn\n}", "func unmarshalWeatherResponseBodyToLogWeather(v *WeatherResponseBody) *log.Weather {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &log.Weather{\n\t\tID: v.ID,\n\t\tCreatedAt: v.CreatedAt,\n\t\tFireID: v.FireID,\n\t\tLogID: v.LogID,\n\t\tHumidity: v.Humidity,\n\t\tWeatherType: v.WeatherType,\n\t\tWeatherTime: v.WeatherTime,\n\t}\n\tif v.Temperature != nil {\n\t\tres.Temperature = unmarshalTemperatureResponseBodyToLogTemperature(v.Temperature)\n\t}\n\tif v.DewPoint != nil {\n\t\tres.DewPoint = unmarshalTemperatureResponseBodyToLogTemperature(v.DewPoint)\n\t}\n\tif v.Wind != nil {\n\t\tres.Wind = unmarshalWindResponseBodyToLogWind(v.Wind)\n\t}\n\n\treturn res\n}", "func (d *Device) SetRange(sensorRange Range) bool {\n\td.dataFormat.sensorRange = sensorRange & 0x03\n\td.bus.WriteRegister(uint8(d.Address), REG_DATA_FORMAT, []byte{d.dataFormat.toByte()})\n\treturn true\n}", "func (v *ValueRange) Bytes() []byte {\n\tvar endPointExistsMask bitmask.BitMask\n\tif v.lowerEndPoint != nil {\n\t\tendPointExistsMask = endPointExistsMask.SetBit(0)\n\t}\n\tif v.upperEndPoint != nil {\n\t\tendPointExistsMask = endPointExistsMask.SetBit(1)\n\t}\n\n\tmarshalUtil := marshalutil.New()\n\tmarshalUtil.WriteByte(byte(endPointExistsMask))\n\tif endPointExistsMask.HasBit(0) {\n\t\tmarshalUtil.Write(v.lowerEndPoint)\n\t}\n\tif endPointExistsMask.HasBit(1) {\n\t\tmarshalUtil.Write(v.upperEndPoint)\n\t}\n\n\treturn marshalUtil.Bytes()\n}" ]
[ "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.54716146", "0.54677916", "0.5449466", "0.54424477", "0.5373854", "0.5373854", "0.53067714", "0.5289433", "0.5242388", "0.4852409", "0.47723025", "0.47365624", "0.4720615", "0.45332792", "0.45164448", "0.44586337", "0.43936083", "0.43864965", "0.4377583", "0.4332514", "0.42766944", "0.42623013", "0.42510045", "0.4212567", "0.41827434", "0.418171", "0.41755065", "0.4172599", "0.4166291", "0.41643447", "0.4142905", "0.41381595", "0.41311538", "0.4129458", "0.4089661", "0.40742642", "0.4069227", "0.4049427", "0.40398002", "0.40260017", "0.4020179", "0.40177852", "0.40173388", "0.40142247", "0.40133667", "0.40089473", "0.3970342", "0.3969056", "0.39593518", "0.39585263", "0.395355", "0.3947711", "0.3946073", "0.39422864", "0.39292112", "0.39263737", "0.3914627", "0.39106178", "0.39084324", "0.39049178", "0.39034367", "0.3899543", "0.38951445", "0.38686392", "0.38669404", "0.38652697", "0.38281208", "0.38124317", "0.38115102", "0.37990344", "0.37945586", "0.3794039", "0.37909976", "0.3790544", "0.3787688", "0.37770203", "0.37737614", "0.37708822", "0.37483472" ]
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))\n\t\tfor i, val := range v.Precise {\n\t\t\tres.Precise[i] = val\n\t\t}\n\t}\n\tif v.Regions != nil {\n\t\tres.Regions = make([]*StationRegionResponseBody, len(v.Regions))\n\t\tfor i, val := range v.Regions {\n\t\t\tres.Regions[i] = marshalStationviewsStationRegionViewToStationRegionResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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 = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Reading != nil {\n\t\tres.Reading = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsEssentialStationViewToEssentialStationResponseBody(v *stationviews.EssentialStationView) *EssentialStationResponseBody {\n\tres := &EssentialStationResponseBody{\n\t\tID: *v.ID,\n\t\tDeviceID: *v.DeviceID,\n\t\tName: *v.Name,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tLastIngestionAt: v.LastIngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "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\tfor i, val := range v.Shape {\n\t\t\tres.Shape[i] = make([][]float64, len(val))\n\t\t\tfor j, val := range val {\n\t\t\t\tres.Shape[i][j] = make([]float64, len(val))\n\t\t\t\tfor k, val := range val {\n\t\t\t\t\tres.Shape[i][j][k] = val\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationJobViewToStationJobResponseBody(v *stationviews.StationJobView) *StationJobResponseBody {\n\tres := &StationJobResponseBody{\n\t\tTitle: *v.Title,\n\t\tStartedAt: *v.StartedAt,\n\t\tCompletedAt: v.CompletedAt,\n\t\tProgress: *v.Progress,\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v *stationviews.StationDataSummaryView) *StationDataSummaryResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &StationDataSummaryResponseBody{\n\t\tStart: *v.Start,\n\t\tEnd: *v.End,\n\t\tNumberOfSamples: *v.NumberOfSamples,\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdated: *v.Updated,\n\t\tLocationName: v.LocationName,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Images != nil {\n\t\tres.Images = make([]*ImageRefResponseBody, len(v.Images))\n\t\tfor i, val := range v.Images {\n\t\t\tres.Images[i] = marshalStationviewsImageRefViewToImageRefResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "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.StationPhotosView) *StationPhotosResponseBody {\n\tres := &StationPhotosResponseBody{\n\t\tSmall: *v.Small,\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tLocationName: v.LocationName,\n\t\tPlaceNameOther: v.PlaceNameOther,\n\t\tPlaceNameNative: v.PlaceNameNative,\n\t\tSyncedAt: v.SyncedAt,\n\t\tIngestionAt: v.IngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\tif v.Data != nil {\n\t\tres.Data = marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v.Data)\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t\tFullKey: *v.FullKey,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalStationviewsImageRefViewToImageRefResponseBody(v *stationviews.ImageRefView) *ImageRefResponseBody {\n\tres := &ImageRefResponseBody{\n\t\tURL: *v.URL,\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsWarehouseViewToWarehouseResponseBody(v *inventoryviews.WarehouseView) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tCode: *v.Code,\n\t\tAddress: *v.Address,\n\t\tType: *v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func marshalMatchesviewsRatingViewToRatingResponseBody(v *matchesviews.RatingView) *RatingResponseBody {\n\tres := &RatingResponseBody{\n\t\tStrength: *v.Strength,\n\t\tLower: *v.Lower,\n\t\tUpper: *v.Upper,\n\t}\n\n\treturn res\n}", "func unmarshalWineryResponseBodyToStorageviewsWineryView(v *WineryResponseBody) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func marshalVironAPIViewToVironAPIResponseBody(v *vironviews.VironAPIView) *VironAPIResponseBody {\n\tres := &VironAPIResponseBody{\n\t\tMethod: *v.Method,\n\t\tPath: *v.Path,\n\t}\n\n\treturn res\n}", "func NewUpdateResponseBody(res *warehouseviews.WarehouseView) *UpdateResponseBody {\n\tbody := &UpdateResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func ValidateStationSensorResponseBody(body *StationSensorResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.UnitOfMeasure == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"unit_of_measure\", \"body\"))\n\t}\n\tif body.Key == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"key\", \"body\"))\n\t}\n\tif body.Ranges == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"ranges\", \"body\"))\n\t}\n\tif body.Reading != nil {\n\t\tif err2 := ValidateSensorReadingResponseBody(body.Reading); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\tfor _, e := range body.Ranges {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateSensorRangeResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func (client *LiveOutputsClient) operationLocationHandleResponse(resp *http.Response) (LiveOutputsClientOperationLocationResponse, error) {\n\tresult := LiveOutputsClientOperationLocationResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.LiveOutput); err != nil {\n\t\treturn LiveOutputsClientOperationLocationResponse{}, err\n\t}\n\treturn result, nil\n}", "func getLocation(w http.ResponseWriter, request *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(locations)\n}", "func NewDeviceLayoutResponseViewOK(body *DeviceLayoutResponseBody) *informationviews.DeviceLayoutResponseView {\n\tv := &informationviews.DeviceLayoutResponseView{}\n\tv.Configurations = make([]*informationviews.StationConfigurationView, len(body.Configurations))\n\tfor i, val := range body.Configurations {\n\t\tv.Configurations[i] = unmarshalStationConfigurationResponseBodyToInformationviewsStationConfigurationView(val)\n\t}\n\tv.Sensors = make(map[string][]*informationviews.StationSensorView, len(body.Sensors))\n\tfor key, val := range body.Sensors {\n\t\ttk := key\n\t\ttv := make([]*informationviews.StationSensorView, len(val))\n\t\tfor i, val := range val {\n\t\t\ttv[i] = unmarshalStationSensorResponseBodyToInformationviewsStationSensorView(val)\n\t\t}\n\t\tv.Sensors[tk] = tv\n\t}\n\n\treturn v\n}", "func marshalInventoryWarehouseToWarehouseResponseBody(v *inventory.Warehouse) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t\tCode: v.Code,\n\t\tAddress: v.Address,\n\t\tType: v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryFounderToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsFounderViewToFounderResponseBody(v *inventoryviews.FounderView) *FounderResponseBody {\n\tres := &FounderResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func unmarshalWineryResponseToStorageviewsWineryView(v *WineryResponse) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func marshalMatchesviewsRatingResourceViewToRatingResourceResponseBody(v *matchesviews.RatingResourceView) *RatingResourceResponseBody {\n\tres := &RatingResourceResponseBody{\n\t\tRrn: *v.Rrn,\n\t}\n\tif v.Rating != nil {\n\t\tres.Rating = marshalMatchesviewsRatingViewToRatingResponseBody(v.Rating)\n\t}\n\n\treturn res\n}", "func (o PartnerRegionInfoResponseOutput) Location() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v PartnerRegionInfoResponse) *string { return v.Location }).(pulumi.StringPtrOutput)\n}", "func NewAddResponseBody(res *stepviews.ResultStepView) *AddResponseBody {\n\tbody := &AddResponseBody{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Step != nil {\n\t\tbody.Step = marshalStepviewsStoredStepViewToStoredStepResponseBody(res.Step)\n\t}\n\treturn body\n}", "func (o WebTestGeolocationResponseOutput) Location() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WebTestGeolocationResponse) *string { return v.Location }).(pulumi.StringPtrOutput)\n}", "func NewGetResponseBody(res *warehouseviews.WarehouseView) *GetResponseBody {\n\tbody := &GetResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func unmarshalWindResponseBodyToLogWind(v *WindResponseBody) *log.Wind {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &log.Wind{\n\t\tSpeed: v.Speed,\n\t\tDirection: v.Direction,\n\t\tUnit: v.Unit,\n\t}\n\n\treturn res\n}", "func NewAddResponseBodyTiny(res *stepviews.ResultStepView) *AddResponseBodyTiny {\n\tbody := &AddResponseBodyTiny{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Step != nil {\n\t\tbody.Step = marshalStepviewsStoredStepViewToStoredStepResponseBody(res.Step)\n\t}\n\treturn body\n}", "func NewListResponseBody(res *stepviews.StoredListOfStepsView) *ListResponseBody {\n\tbody := &ListResponseBody{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Steps != nil {\n\t\tbody.Steps = make([]*StoredStepResponseBody, len(res.Steps))\n\t\tfor i, val := range res.Steps {\n\t\t\tbody.Steps[i] = marshalStepviewsStoredStepViewToStoredStepResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func ValidateStationConfigurationResponseBody(body *StationConfigurationResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.ProvisionID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"provision_id\", \"body\"))\n\t}\n\tif body.Time == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"time\", \"body\"))\n\t}\n\tif body.Modules == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"modules\", \"body\"))\n\t}\n\tfor _, e := range body.Modules {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateStationModuleResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func UnmarshalStationMonitorResponse(res *HttpResponse)(*Journey,error){\n\tbody, err := ioutil.ReadAll(res.Response.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar record Journey\n\terr=parseResponseObject(body,record)\n\treturn &record, err\n}", "func ServerEncodeResponseBody(timeLayout string, format wrp.Format) gokithttp.EncodeResponseFunc {\n\treturn func(ctx context.Context, httpResponse http.ResponseWriter, value interface{}) error {\n\t\tvar (\n\t\t\twrpResponse = value.(wrpendpoint.Response)\n\t\t\toutput bytes.Buffer\n\t\t)\n\n\t\ttracinghttp.HeadersForSpans(timeLayout, httpResponse.Header(), wrpResponse.Spans()...)\n\n\t\tif err := wrpResponse.Encode(&output, format); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\thttpResponse.Header().Set(\"Content-Type\", format.ContentType())\n\t\t_, err := output.WriteTo(httpResponse)\n\t\treturn err\n\t}\n}", "func unmarshalComponentResponseBodyToStorageviewsComponentView(v *ComponentResponseBody) *storageviews.ComponentView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &storageviews.ComponentView{\n\t\tVarietal: v.Varietal,\n\t\tPercentage: v.Percentage,\n\t}\n\n\treturn res\n}", "func unmarshalFounderResponseBodyToWarehouseviewsFounderView(v *FounderResponseBody) *warehouseviews.FounderView {\n\tres := &warehouseviews.FounderView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func EncodeStationMetaResponse(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.(*sensor.StationMetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func ValidateStationModuleResponseBody(body *StationModuleResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.Position == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"position\", \"body\"))\n\t}\n\tif body.Flags == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"flags\", \"body\"))\n\t}\n\tif body.Internal == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"internal\", \"body\"))\n\t}\n\tif body.Sensors == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"sensors\", \"body\"))\n\t}\n\tfor _, e := range body.Sensors {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateStationSensorResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func (o ExprResponseOutput) Location() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ExprResponse) string { return v.Location }).(pulumi.StringOutput)\n}", "func (o ExprResponseOutput) Location() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ExprResponse) string { return v.Location }).(pulumi.StringOutput)\n}", "func (o ExprResponseOutput) Location() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ExprResponse) string { return v.Location }).(pulumi.StringOutput)\n}", "func (o ExprResponseOutput) Location() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ExprResponse) string { return v.Location }).(pulumi.StringOutput)\n}", "func (o ExprResponseOutput) Location() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ExprResponse) string { return v.Location }).(pulumi.StringOutput)\n}", "func (o ExprResponseOutput) Location() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ExprResponse) string { return v.Location }).(pulumi.StringOutput)\n}", "func (controller *BuoyController) RetrieveStationJSON() {\n\tbuoyStations, err := buoyService.AllStation(&controller.Service)\n\n\tif err != nil {\n\t\tcontroller.ServeError(err)\n\t\treturn\n\t}\n\n\tcontroller.Data[\"json\"] = buoyStations\n\tcontroller.ServeJSON()\n}", "func unmarshalWarehouseResponseBodyToWarehouseWarehouse(v *WarehouseResponseBody) *warehouse.Warehouse {\n\tres := &warehouse.Warehouse{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tCode: *v.Code,\n\t\tAddress: *v.Address,\n\t\tType: *v.Type,\n\t}\n\tres.Founder = unmarshalFounderResponseBodyToWarehouseFounder(v.Founder)\n\n\treturn res\n}", "func (o AnycastEipAddressOutput) ServiceLocation() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *AnycastEipAddress) pulumi.StringOutput { return v.ServiceLocation }).(pulumi.StringOutput)\n}", "func EncodeNeatThingTodayResponse(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.(*neatthingviews.NeatThing)\n\t\tw.Header().Set(\"goa-view\", res.View)\n\t\tenc := encoder(ctx, w)\n\t\tvar body interface{}\n\t\tswitch res.View {\n\t\tcase \"default\", \"\":\n\t\t\tbody = NewNeatThingTodayResponseBody(res.Projected)\n\t\tcase \"full\":\n\t\t\tbody = NewNeatThingTodayResponseBodyFull(res.Projected)\n\t\tcase \"name\":\n\t\t\tbody = NewNeatThingTodayResponseBodyName(res.Projected)\n\t\tcase \"name+definition\":\n\t\t\tbody = NewNeatThingTodayResponseBodyNameDefinition(res.Projected)\n\t\tcase \"name+link\":\n\t\t\tbody = NewNeatThingTodayResponseBodyNameLink(res.Projected)\n\t\t}\n\t\tw.WriteHeader(http.StatusNoContent)\n\t\treturn enc.Encode(body)\n\t}\n}", "func marshalRxRecipeResponseBodyToRxRecipeView(v *RxRecipeResponseBody) *recipeviews.RxRecipeView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &recipeviews.RxRecipeView{\n\t\tID: v.ID,\n\t\tTitle: v.Title,\n\t\tDescription: v.Description,\n\t\tVersion: v.Version,\n\t\tFavorite: v.Favorite,\n\t\tRating: v.Rating,\n\t\tDifficulty: v.Difficulty,\n\t\tState: v.State,\n\t\tComplete: v.Complete,\n\t}\n\tif v.Ingredients != nil {\n\t\tres.Ingredients = marshalIngredientListResponseBodyToIngredientListView(v.Ingredients)\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsProductViewToProductResponseBody(v *inventoryviews.ProductView) *ProductResponseBody {\n\tres := &ProductResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tUnit: *v.Unit,\n\t\tCostPrice: *v.CostPrice,\n\t\tMarketPrice: *v.MarketPrice,\n\t\tNote: *v.Note,\n\t\tImage: *v.Image,\n\t\tCode: *v.Code,\n\t\tSize: *v.Size,\n\t\tType: *v.Type,\n\t\tIsShelves: *v.IsShelves,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func ValueHTTPResponseBody(ctx context.Context) interface{} {\n\treturn ctx.Value(contextHTTPResponseBodyFields)\n}", "func ValidateFieldNoteStationResponseBody(body *FieldNoteStationResponseBody) (err error) {\n\tif body.ReadOnly == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"readOnly\", \"body\"))\n\t}\n\treturn\n}", "func NewCreateResponseBody(res *warehouseviews.WarehouseView) *CreateResponseBody {\n\tbody := &CreateResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func RenderLocation(w http.ResponseWriter, status int, location string) error {\n\tw.Header().Add(HeaderLocation, location)\n\tw.WriteHeader(status)\n\tw.Write([]byte{})\n\n\treturn nil\n}", "func marshalPostsPostOutputToPostOutputResponseBody(v *posts.PostOutput) *PostOutputResponseBody {\n\tres := &PostOutputResponseBody{\n\t\tID: v.ID,\n\t\tTitle: v.Title,\n\t\tDescription: v.Description,\n\t\tScreenImageURL: v.ScreenImageURL,\n\t}\n\n\treturn res\n}", "func NewStatusResponseBody(res *spinbroker.StatusResult) *StatusResponseBody {\n\tbody := &StatusResponseBody{\n\t\tStatus: res.Status,\n\t\tReason: res.Reason,\n\t\tCauser: res.Causer,\n\t}\n\treturn body\n}", "func (o GatewayOutput) Location() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Gateway) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)\n}", "func (o ServiceAdditionalLocationOutput) Location() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ServiceAdditionalLocation) string { return v.Location }).(pulumi.StringOutput)\n}", "func (o ServiceOutput) Location() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Service) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)\n}", "func DecodeResponseBody(body io.Reader, dest interface{}) error {\n\tdecoder := json.NewDecoder(body)\n\terr := decoder.Decode(dest)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to decode response body: %s\", err.Error())\n\t}\n\n\treturn nil\n}", "func marshalInventoryviewsHeadViewToHeadResponseBody(v *inventoryviews.HeadView) *HeadResponseBody {\n\tres := &HeadResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalDiscussionviewsAuthorPhotoViewToAuthorPhotoResponseBody(v *discussionviews.AuthorPhotoView) *AuthorPhotoResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &AuthorPhotoResponseBody{\n\t\tURL: *v.URL,\n\t}\n\n\treturn res\n}", "func NewSigninResponseBody(res *securedviews.GoaJWTView) *SigninResponseBody {\n\tbody := &SigninResponseBody{\n\t\tAuthorization: *res.Authorization,\n\t}\n\treturn body\n}", "func (o GetServiceAdditionalLocationOutput) Location() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetServiceAdditionalLocation) string { return v.Location }).(pulumi.StringOutput)\n}", "func (r Response) IsLocation() bool {\n\treturn r.isType(TypeLocation)\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (c *ClientWithResponses) CreateanewCustomerLocationWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CreateanewCustomerLocationResponse, error) {\n\trsp, err := c.CreateanewCustomerLocationWithBody(ctx, contentType, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseCreateanewCustomerLocationResponse(rsp)\n}", "func (d DatacenterAddressLocationResponse) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"additionalShippingInformation\", d.AdditionalShippingInformation)\n\tpopulate(objectMap, \"addressType\", d.AddressType)\n\tpopulate(objectMap, \"city\", d.City)\n\tpopulate(objectMap, \"company\", d.Company)\n\tpopulate(objectMap, \"contactPersonName\", d.ContactPersonName)\n\tpopulate(objectMap, \"country\", d.Country)\n\tpopulate(objectMap, \"dataCenterAzureLocation\", d.DataCenterAzureLocation)\n\tobjectMap[\"datacenterAddressType\"] = DatacenterAddressTypeDatacenterAddressLocation\n\tpopulate(objectMap, \"phone\", d.Phone)\n\tpopulate(objectMap, \"phoneExtension\", d.PhoneExtension)\n\tpopulate(objectMap, \"state\", d.State)\n\tpopulate(objectMap, \"street1\", d.Street1)\n\tpopulate(objectMap, \"street2\", d.Street2)\n\tpopulate(objectMap, \"street3\", d.Street3)\n\tpopulate(objectMap, \"supportedCarriersForReturnShipment\", d.SupportedCarriersForReturnShipment)\n\tpopulate(objectMap, \"zip\", d.Zip)\n\treturn json.Marshal(objectMap)\n}", "func (o WebTestGeolocationOutput) Location() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v WebTestGeolocation) *string { return v.Location }).(pulumi.StringPtrOutput)\n}", "func (o *GetUniverseStationsStationIDOKBodyPosition) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateX(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateY(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateZ(formats); err != nil {\n\t\t// prop\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}", "func unmarshalSuccessResultResponseBodyToUserSuccessResult(v *SuccessResultResponseBody) *user.SuccessResult {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &user.SuccessResult{\n\t\tOK: *v.OK,\n\t}\n\n\treturn res\n}", "func (o SchedulingResponseOutput) LocationHint() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SchedulingResponse) string { return v.LocationHint }).(pulumi.StringOutput)\n}", "func marshalIngredientListResponseBodyToIngredientListView(v *IngredientListResponseBody) *recipeviews.IngredientListView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &recipeviews.IngredientListView{}\n\tif v.Ingredients != nil {\n\t\tres.Ingredients = make([]*recipeviews.IngredientView, len(v.Ingredients))\n\t\tfor j, val := range v.Ingredients {\n\t\t\tres.Ingredients[j] = &recipeviews.IngredientView{\n\t\t\t\tQuantity: val.Quantity,\n\t\t\t}\n\t\t\tif val.Recipe != nil {\n\t\t\t\tres.Ingredients[j].Recipe = marshalRxRecipeResponseBodyToRxRecipeView(val.Recipe)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}", "func (o LinuxWebAppOutput) Location() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *LinuxWebApp) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)\n}", "func (o RouteFilterOutput) Location() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *RouteFilter) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)\n}", "func (o LookupVirtualNetworkResultOutput) Location() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupVirtualNetworkResult) string { return v.Location }).(pulumi.StringOutput)\n}", "func unmarshalStoredBottleResponseToStorageviewsStoredBottleView(v *StoredBottleResponse) *storageviews.StoredBottleView {\n\tres := &storageviews.StoredBottleView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t\tVintage: v.Vintage,\n\t\tDescription: v.Description,\n\t\tRating: v.Rating,\n\t}\n\tres.Winery = unmarshalWineryResponseToStorageviewsWineryView(v.Winery)\n\tif v.Composition != nil {\n\t\tres.Composition = make([]*storageviews.ComponentView, len(v.Composition))\n\t\tfor i, val := range v.Composition {\n\t\t\tres.Composition[i] = unmarshalComponentResponseToStorageviewsComponentView(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func HTTPResponseBodyContent(val string) zap.Field {\n\treturn zap.String(FieldHTTPResponseBodyContent, val)\n}", "func marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(v *discussionviews.ThreadedPostView) *ThreadedPostResponseBody {\n\tres := &ThreadedPostResponseBody{\n\t\tID: *v.ID,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tBody: *v.Body,\n\t\tBookmark: v.Bookmark,\n\t}\n\tif v.Author != nil {\n\t\tres.Author = marshalDiscussionviewsPostAuthorViewToPostAuthorResponseBody(v.Author)\n\t}\n\tif v.Replies != nil {\n\t\tres.Replies = make([]*ThreadedPostResponseBody, len(v.Replies))\n\t\tfor i, val := range v.Replies {\n\t\t\tres.Replies[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func (lc LocationController) GetLocation(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\t// Grab id\n\tid := p.ByName(\"id\")\n\n\t// Verify id is ObjectId, otherwise bail\n\tif !bson.IsObjectIdHex(id) {\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\n\t// Grab id\n\toid := bson.ObjectIdHex(id)\n\n\t// Stub Location\n\tvar locationObject Location\n\n\t// Fetch user\n\tif err := lc.session.DB(\"go_rest_api_assignment2\").C(\"locations\").FindId(oid).One(&locationObject); err != nil {\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\n\t// Marshal provided interface into JSON structure\n\tuj, _ := json.Marshal(locationObject)\n\n\t// Write content-type, statuscode, payload\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(200)\n\tfmt.Fprintf(w, \"%s\", uj)\n}", "func (o WorkstationIamBindingOutput) Location() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *WorkstationIamBinding) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)\n}", "func newBattlestreamingresultView(res *Battlestreamingresult) *shiritoriviews.BattlestreamingresultView {\n\tvres := &shiritoriviews.BattlestreamingresultView{\n\t\tType: &res.Type,\n\t\tTimestamp: &res.Timestamp,\n\t}\n\tif res.MessagePayload != nil {\n\t\tvres.MessagePayload = transformMessagePayloadToShiritoriviewsMessagePayloadView(res.MessagePayload)\n\t}\n\treturn vres\n}", "func NewListResponseBody(res *warehouse.ListResult) *ListResponseBody {\n\tbody := &ListResponseBody{\n\t\tNextCursor: res.NextCursor,\n\t\tTotal: res.Total,\n\t}\n\tif res.Items != nil {\n\t\tbody.Items = make([]*WarehouseResponseBody, len(res.Items))\n\t\tfor i, val := range res.Items {\n\t\t\tbody.Items[i] = marshalWarehouseWarehouseToWarehouseResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func (o PartnerRegionInfoOutput) Location() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v PartnerRegionInfo) *string { return v.Location }).(pulumi.StringPtrOutput)\n}" ]
[ "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.66551524", "0.6635597", "0.6635597", "0.6525326", "0.6525326", "0.61544055", "0.6126543", "0.5691652", "0.55280185", "0.5130569", "0.50639385", "0.50442964", "0.49815536", "0.49677807", "0.4902587", "0.48935285", "0.48497322", "0.48246476", "0.47276402", "0.4710258", "0.46895695", "0.4631518", "0.46312454", "0.46133828", "0.459976", "0.45963734", "0.45910415", "0.4564958", "0.45633954", "0.455406", "0.45438987", "0.45340222", "0.45185465", "0.45117405", "0.45117405", "0.45117405", "0.45117405", "0.45117405", "0.45117405", "0.4505455", "0.44745702", "0.4426059", "0.44183028", "0.44141263", "0.44120154", "0.44022277", "0.43932635", "0.43878275", "0.43534124", "0.4349379", "0.4334907", "0.43189198", "0.43176723", "0.43023127", "0.4239218", "0.42343867", "0.42273477", "0.42256805", "0.4225274", "0.42209452", "0.42080778", "0.42080778", "0.42008528", "0.41930747", "0.4170009", "0.41629386", "0.41618508", "0.41553172", "0.41420984", "0.41200152", "0.4113517", "0.41083893", "0.410456", "0.40984306", "0.4077169", "0.40620688", "0.40513507", "0.40507135", "0.40465608", "0.40396455" ]
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: v.Battery,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tLocationName: v.LocationName,\n\t\tPlaceNameOther: v.PlaceNameOther,\n\t\tPlaceNameNative: v.PlaceNameNative,\n\t\tSyncedAt: v.SyncedAt,\n\t\tIngestionAt: v.IngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Uploads != nil {\n\t\tres.Uploads = make([]*StationUploadResponseBody, len(v.Uploads))\n\t\tfor i, val := range v.Uploads {\n\t\t\tres.Uploads[i] = marshalStationviewsStationUploadViewToStationUploadResponseBody(val)\n\t\t}\n\t}\n\tif v.Photos != nil {\n\t\tres.Photos = marshalStationviewsStationPhotosViewToStationPhotosResponseBody(v.Photos)\n\t}\n\tif v.Configurations != nil {\n\t\tres.Configurations = marshalStationviewsStationConfigurationsViewToStationConfigurationsResponseBody(v.Configurations)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\tif v.Data != nil {\n\t\tres.Data = marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v.Data)\n\t}\n\n\treturn res\n}", "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.Reading != nil {\n\t\tres.Reading = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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 = marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v.Reading)\n\t}\n\tif v.Ranges != nil {\n\t\tres.Ranges = make([]*SensorRangeResponseBody, len(v.Ranges))\n\t\tfor i, val := range v.Ranges {\n\t\t\tres.Ranges[i] = marshalStationviewsSensorRangeViewToSensorRangeResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsEssentialStationViewToEssentialStationResponseBody(v *stationviews.EssentialStationView) *EssentialStationResponseBody {\n\tres := &EssentialStationResponseBody{\n\t\tID: *v.ID,\n\t\tDeviceID: *v.DeviceID,\n\t\tName: *v.Name,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tRecordingStartedAt: v.RecordingStartedAt,\n\t\tMemoryUsed: v.MemoryUsed,\n\t\tMemoryAvailable: v.MemoryAvailable,\n\t\tFirmwareNumber: v.FirmwareNumber,\n\t\tFirmwareTime: v.FirmwareTime,\n\t\tLastIngestionAt: v.LastIngestionAt,\n\t}\n\tif v.Owner != nil {\n\t\tres.Owner = marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v.Owner)\n\t}\n\tif v.Location != nil {\n\t\tres.Location = marshalStationviewsStationLocationViewToStationLocationResponseBody(v.Location)\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationDataSummaryViewToStationDataSummaryResponseBody(v *stationviews.StationDataSummaryView) *StationDataSummaryResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &StationDataSummaryResponseBody{\n\t\tStart: *v.Start,\n\t\tEnd: *v.End,\n\t\tNumberOfSamples: *v.NumberOfSamples,\n\t}\n\n\treturn res\n}", "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 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))\n\t\tfor i, val := range v.Precise {\n\t\t\tres.Precise[i] = val\n\t\t}\n\t}\n\tif v.Regions != nil {\n\t\tres.Regions = make([]*StationRegionResponseBody, len(v.Regions))\n\t\tfor i, val := range v.Regions {\n\t\t\tres.Regions[i] = marshalStationviewsStationRegionViewToStationRegionResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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,\n\t}\n\tif v.Blocks != nil {\n\t\tres.Blocks = make([]int64, len(v.Blocks))\n\t\tfor i, val := range v.Blocks {\n\t\t\tres.Blocks[i] = val\n\t\t}\n\t}\n\n\treturn res\n}", "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\tfor i, val := range v.Shape {\n\t\t\tres.Shape[i] = make([][]float64, len(val))\n\t\t\tfor j, val := range val {\n\t\t\t\tres.Shape[i][j] = make([]float64, len(val))\n\t\t\t\tfor k, val := range val {\n\t\t\t\t\tres.Shape[i][j][k] = val\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorRangeViewToSensorRangeResponseBody(v *stationviews.SensorRangeView) *SensorRangeResponseBody {\n\tres := &SensorRangeResponseBody{\n\t\tMinimum: *v.Minimum,\n\t\tMaximum: *v.Maximum,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationJobViewToStationJobResponseBody(v *stationviews.StationJobView) *StationJobResponseBody {\n\tres := &StationJobResponseBody{\n\t\tTitle: *v.Title,\n\t\tStartedAt: *v.StartedAt,\n\t\tCompletedAt: v.CompletedAt,\n\t\tProgress: *v.Progress,\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t\tFullKey: *v.FullKey,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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, val := range v.All {\n\t\t\tres.All[i] = marshalStationviewsStationConfigurationViewToStationConfigurationResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.MetaRecordID,\n\t\tSourceID: v.SourceID,\n\t}\n\tif v.Modules != nil {\n\t\tres.Modules = make([]*StationModuleResponseBody, len(v.Modules))\n\t\tfor i, val := range v.Modules {\n\t\t\tres.Modules[i] = marshalStationviewsStationModuleViewToStationModuleResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "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.Position,\n\t\tFlags: *v.Flags,\n\t\tInternal: *v.Internal,\n\t}\n\tif v.Sensors != nil {\n\t\tres.Sensors = make([]*StationSensorResponseBody, len(v.Sensors))\n\t\tfor i, val := range v.Sensors {\n\t\t\tres.Sensors[i] = marshalStationviewsStationSensorViewToStationSensorResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalStationviewsSensorReadingViewToSensorReadingResponseBody(v *stationviews.SensorReadingView) *SensorReadingResponseBody {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &SensorReadingResponseBody{\n\t\tLast: *v.Last,\n\t\tTime: *v.Time,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalStationviewsStationOwnerViewToStationOwnerResponseBody(v *stationviews.StationOwnerView) *StationOwnerResponseBody {\n\tres := &StationOwnerResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "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.StationPhotosView) *StationPhotosResponseBody {\n\tres := &StationPhotosResponseBody{\n\t\tSmall: *v.Small,\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsWarehouseViewToWarehouseResponseBody(v *inventoryviews.WarehouseView) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tCode: *v.Code,\n\t\tAddress: *v.Address,\n\t\tType: *v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func marshalStationviewsImageRefViewToImageRefResponseBody(v *stationviews.ImageRefView) *ImageRefResponseBody {\n\tres := &ImageRefResponseBody{\n\t\tURL: *v.URL,\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsFounderViewToFounderResponseBody(v *inventoryviews.FounderView) *FounderResponseBody {\n\tres := &FounderResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func marshalMatchesviewsRatingViewToRatingResponseBody(v *matchesviews.RatingView) *RatingResponseBody {\n\tres := &RatingResponseBody{\n\t\tStrength: *v.Strength,\n\t\tLower: *v.Lower,\n\t\tUpper: *v.Upper,\n\t}\n\n\treturn res\n}", "func marshalVironAPIViewToVironAPIResponseBody(v *vironviews.VironAPIView) *VironAPIResponseBody {\n\tres := &VironAPIResponseBody{\n\t\tMethod: *v.Method,\n\t\tPath: *v.Path,\n\t}\n\n\treturn res\n}", "func NewUpdateResponseBody(res *warehouseviews.WarehouseView) *UpdateResponseBody {\n\tbody := &UpdateResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func NewGetResponseBody(res *warehouseviews.WarehouseView) *GetResponseBody {\n\tbody := &GetResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func (controller *BuoyController) RetrieveStationJSON() {\n\tbuoyStations, err := buoyService.AllStation(&controller.Service)\n\n\tif err != nil {\n\t\tcontroller.ServeError(err)\n\t\treturn\n\t}\n\n\tcontroller.Data[\"json\"] = buoyStations\n\tcontroller.ServeJSON()\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "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.(*stationviews.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewUpdateResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeNeatThingTodayResponse(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.(*neatthingviews.NeatThing)\n\t\tw.Header().Set(\"goa-view\", res.View)\n\t\tenc := encoder(ctx, w)\n\t\tvar body interface{}\n\t\tswitch res.View {\n\t\tcase \"default\", \"\":\n\t\t\tbody = NewNeatThingTodayResponseBody(res.Projected)\n\t\tcase \"full\":\n\t\t\tbody = NewNeatThingTodayResponseBodyFull(res.Projected)\n\t\tcase \"name\":\n\t\t\tbody = NewNeatThingTodayResponseBodyName(res.Projected)\n\t\tcase \"name+definition\":\n\t\t\tbody = NewNeatThingTodayResponseBodyNameDefinition(res.Projected)\n\t\tcase \"name+link\":\n\t\t\tbody = NewNeatThingTodayResponseBodyNameLink(res.Projected)\n\t\t}\n\t\tw.WriteHeader(http.StatusNoContent)\n\t\treturn enc.Encode(body)\n\t}\n}", "func unmarshalFounderResponseBodyToWarehouseviewsFounderView(v *FounderResponseBody) *warehouseviews.FounderView {\n\tres := &warehouseviews.FounderView{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func ValidateStationSensorResponseBody(body *StationSensorResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.UnitOfMeasure == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"unit_of_measure\", \"body\"))\n\t}\n\tif body.Key == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"key\", \"body\"))\n\t}\n\tif body.Ranges == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"ranges\", \"body\"))\n\t}\n\tif body.Reading != nil {\n\t\tif err2 := ValidateSensorReadingResponseBody(body.Reading); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\tfor _, e := range body.Ranges {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateSensorRangeResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func EncodeGetResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewGetResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeGetResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewGetResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func unmarshalWineryResponseBodyToStorageviewsWineryView(v *WineryResponseBody) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func marshalInventoryviewsProductViewToProductResponseBody(v *inventoryviews.ProductView) *ProductResponseBody {\n\tres := &ProductResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t\tUnit: *v.Unit,\n\t\tCostPrice: *v.CostPrice,\n\t\tMarketPrice: *v.MarketPrice,\n\t\tNote: *v.Note,\n\t\tImage: *v.Image,\n\t\tCode: *v.Code,\n\t\tSize: *v.Size,\n\t\tType: *v.Type,\n\t\tIsShelves: *v.IsShelves,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryviewsFounderViewToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func ServerEncodeResponseBody(timeLayout string, format wrp.Format) gokithttp.EncodeResponseFunc {\n\treturn func(ctx context.Context, httpResponse http.ResponseWriter, value interface{}) error {\n\t\tvar (\n\t\t\twrpResponse = value.(wrpendpoint.Response)\n\t\t\toutput bytes.Buffer\n\t\t)\n\n\t\ttracinghttp.HeadersForSpans(timeLayout, httpResponse.Header(), wrpResponse.Spans()...)\n\n\t\tif err := wrpResponse.Encode(&output, format); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\thttpResponse.Header().Set(\"Content-Type\", format.ContentType())\n\t\t_, err := output.WriteTo(httpResponse)\n\t\treturn err\n\t}\n}", "func NewGetUserResponseBodyTiny(res *userviews.UserView) *GetUserResponseBodyTiny {\n\tbody := &GetUserResponseBodyTiny{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t}\n\treturn body\n}", "func NewCreateResponseBody(res *warehouseviews.WarehouseView) *CreateResponseBody {\n\tbody := &CreateResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tCode: *res.Code,\n\t\tAddress: *res.Address,\n\t\tType: *res.Type,\n\t}\n\tif res.Founder != nil {\n\t\tbody.Founder = marshalWarehouseviewsFounderViewToFounderResponseBody(res.Founder)\n\t}\n\treturn body\n}", "func marshalInventoryWarehouseToWarehouseResponseBody(v *inventory.Warehouse) *WarehouseResponseBody {\n\tres := &WarehouseResponseBody{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t\tCode: v.Code,\n\t\tAddress: v.Address,\n\t\tType: v.Type,\n\t}\n\tif v.Founder != nil {\n\t\tres.Founder = marshalInventoryFounderToFounderResponseBody(v.Founder)\n\t}\n\n\treturn res\n}", "func EncodeStationMetaResponse(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.(*sensor.StationMetaResult)\n\t\tenc := encoder(ctx, w)\n\t\tbody := res.Object\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func NewStatusResponseBody(res *spinbroker.StatusResult) *StatusResponseBody {\n\tbody := &StatusResponseBody{\n\t\tStatus: res.Status,\n\t\tReason: res.Reason,\n\t\tCauser: res.Causer,\n\t}\n\treturn body\n}", "func marshalInventoryFounderToFounderResponseBody(v *inventory.Founder) *FounderResponseBody {\n\tres := &FounderResponseBody{\n\t\tID: v.ID,\n\t\tName: v.Name,\n\t}\n\n\treturn res\n}", "func marshalMatchesviewsRatingResourceViewToRatingResourceResponseBody(v *matchesviews.RatingResourceView) *RatingResourceResponseBody {\n\tres := &RatingResourceResponseBody{\n\t\tRrn: *v.Rrn,\n\t}\n\tif v.Rating != nil {\n\t\tres.Rating = marshalMatchesviewsRatingViewToRatingResponseBody(v.Rating)\n\t}\n\n\treturn res\n}", "func NewAddResponseBodyTiny(res *stepviews.ResultStepView) *AddResponseBodyTiny {\n\tbody := &AddResponseBodyTiny{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Step != nil {\n\t\tbody.Step = marshalStepviewsStoredStepViewToStoredStepResponseBody(res.Step)\n\t}\n\treturn body\n}", "func (c *Client) Get(ctx context.Context, p *GetPayload) (res *StationFull, err error) {\n\tvar ires interface{}\n\tires, err = c.GetEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(*StationFull), nil\n}", "func NewDeviceLayoutResponseViewOK(body *DeviceLayoutResponseBody) *informationviews.DeviceLayoutResponseView {\n\tv := &informationviews.DeviceLayoutResponseView{}\n\tv.Configurations = make([]*informationviews.StationConfigurationView, len(body.Configurations))\n\tfor i, val := range body.Configurations {\n\t\tv.Configurations[i] = unmarshalStationConfigurationResponseBodyToInformationviewsStationConfigurationView(val)\n\t}\n\tv.Sensors = make(map[string][]*informationviews.StationSensorView, len(body.Sensors))\n\tfor key, val := range body.Sensors {\n\t\ttk := key\n\t\ttv := make([]*informationviews.StationSensorView, len(val))\n\t\tfor i, val := range val {\n\t\t\ttv[i] = unmarshalStationSensorResponseBodyToInformationviewsStationSensorView(val)\n\t\t}\n\t\tv.Sensors[tk] = tv\n\t}\n\n\treturn v\n}", "func EncodeAddResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewAddResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func EncodeAddResponse(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.StationFull)\n\t\tenc := encoder(ctx, w)\n\t\tbody := NewAddResponseBody(res.Projected)\n\t\tw.WriteHeader(http.StatusOK)\n\t\treturn enc.Encode(body)\n\t}\n}", "func (kssd *KeyServerStatsDay) ToResponse() *keyserver.StatsDay {\n\treqs := keyserver.PublishRequests{}\n\tif l := len(kssd.PublishRequests); l == 3 {\n\t\treqs.UnknownPlatform = kssd.PublishRequests[OSTypeUnknown]\n\t\treqs.IOS = kssd.PublishRequests[OSTypeIOS]\n\t\treqs.Android = kssd.PublishRequests[OSTypeAndroid]\n\t}\n\n\treturn &keyserver.StatsDay{\n\t\tDay: kssd.Day,\n\t\tPublishRequests: reqs,\n\t\tTotalTEKsPublished: kssd.TotalTEKsPublished,\n\t\tRevisionRequests: kssd.RevisionRequests,\n\t\tTEKAgeDistribution: kssd.TEKAgeDistribution,\n\t\tOnsetToUploadDistribution: kssd.OnsetToUploadDistribution,\n\t\tRequestsMissingOnsetDate: kssd.RequestsMissingOnsetDate,\n\t}\n}", "func marshalInventoryviewsHeadViewToHeadResponseBody(v *inventoryviews.HeadView) *HeadResponseBody {\n\tres := &HeadResponseBody{\n\t\tID: *v.ID,\n\t\tName: *v.Name,\n\t}\n\n\treturn res\n}", "func NewFullSpectrum(width core.Px, frequencyRange core.FrequencyRange, vfoFrequency core.Frequency) *Panorama {\n\tresult := New(width, frequencyRange, vfoFrequency)\n\tresult.fullRangeMode = true\n\treturn result\n}", "func unmarshalComponentResponseBodyToStorageviewsComponentView(v *ComponentResponseBody) *storageviews.ComponentView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &storageviews.ComponentView{\n\t\tVarietal: v.Varietal,\n\t\tPercentage: v.Percentage,\n\t}\n\n\treturn res\n}", "func NewGetUserResponseBody(res *userviews.UserView) *GetUserResponseBody {\n\tbody := &GetUserResponseBody{\n\t\tID: *res.ID,\n\t\tName: *res.Name,\n\t\tEmail: *res.Email,\n\t\tScore: res.Score,\n\t}\n\treturn body\n}", "func ValidateStationConfigurationResponseBody(body *StationConfigurationResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.ProvisionID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"provision_id\", \"body\"))\n\t}\n\tif body.Time == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"time\", \"body\"))\n\t}\n\tif body.Modules == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"modules\", \"body\"))\n\t}\n\tfor _, e := range body.Modules {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateStationModuleResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(v *discussionviews.ThreadedPostView) *ThreadedPostResponseBody {\n\tres := &ThreadedPostResponseBody{\n\t\tID: *v.ID,\n\t\tCreatedAt: *v.CreatedAt,\n\t\tUpdatedAt: *v.UpdatedAt,\n\t\tBody: *v.Body,\n\t\tBookmark: v.Bookmark,\n\t}\n\tif v.Author != nil {\n\t\tres.Author = marshalDiscussionviewsPostAuthorViewToPostAuthorResponseBody(v.Author)\n\t}\n\tif v.Replies != nil {\n\t\tres.Replies = make([]*ThreadedPostResponseBody, len(v.Replies))\n\t\tfor i, val := range v.Replies {\n\t\t\tres.Replies[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func NewShowDutyStationTransportationOffice(ctx *middleware.Context, handler ShowDutyStationTransportationOfficeHandler) *ShowDutyStationTransportationOffice {\n\treturn &ShowDutyStationTransportationOffice{Context: ctx, Handler: handler}\n}", "func ValidateStationModuleResponseBody(body *StationModuleResponseBody) (err error) {\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.Position == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"position\", \"body\"))\n\t}\n\tif body.Flags == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"flags\", \"body\"))\n\t}\n\tif body.Internal == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"internal\", \"body\"))\n\t}\n\tif body.Sensors == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"sensors\", \"body\"))\n\t}\n\tfor _, e := range body.Sensors {\n\t\tif e != nil {\n\t\t\tif err2 := ValidateStationSensorResponseBody(e); err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, err2)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func (c *Client) Update(ctx context.Context, p *UpdatePayload) (res *StationFull, err error) {\n\tvar ires interface{}\n\tires, err = c.UpdateEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(*StationFull), nil\n}", "func NewViewedBattlestreamingresult(res *Battlestreamingresult, view string) *shiritoriviews.Battlestreamingresult {\n\tp := newBattlestreamingresultView(res)\n\treturn &shiritoriviews.Battlestreamingresult{Projected: p, View: \"default\"}\n}", "func marshalChatterviewsChatSummaryViewToChatSummaryResponse(v *chatterviews.ChatSummaryView) *ChatSummaryResponse {\n\tres := &ChatSummaryResponse{\n\t\tMessage: *v.Message,\n\t\tLength: v.Length,\n\t\tSentAt: *v.SentAt,\n\t}\n\n\treturn res\n}", "func newBattlestreamingresultView(res *Battlestreamingresult) *shiritoriviews.BattlestreamingresultView {\n\tvres := &shiritoriviews.BattlestreamingresultView{\n\t\tType: &res.Type,\n\t\tTimestamp: &res.Timestamp,\n\t}\n\tif res.MessagePayload != nil {\n\t\tvres.MessagePayload = transformMessagePayloadToShiritoriviewsMessagePayloadView(res.MessagePayload)\n\t}\n\treturn vres\n}", "func (controller *BuoyController) RetrieveStation() {\n\tvar params struct {\n\t\tStationID string `form:\"stationId\" error:\"invalid_station_id\"`\n\t}\n\tif controller.ParseAndValidate(&params) == false {\n\t\treturn\n\t}\n\tbuoyStation, err := buoyService.FindStation(&controller.Service, params.StationID)\n\tif err != nil {\n\t\tlog.CompletedErrorf(err, controller.UserID, \"BuoyController.RetrieveStation\", \"StationID[%s]\", params.StationID)\n\t\tcontroller.ServeError(err)\n\t\treturn\n\t}\n\tcontroller.Data[\"Station\"] = buoyStation\n\tcontroller.Layout = \"\"\n\tcontroller.TplName = \"buoy/modal/pv_station-detail.html\"\n\tview, _ := controller.RenderString()\n\tcontroller.AjaxResponse(0, \"SUCCESS\", view)\n}", "func (c *Client) DecodeComJossemargtSaoDraftFull(resp *http.Response) (*ComJossemargtSaoDraftFull, error) {\n\tvar decoded ComJossemargtSaoDraftFull\n\terr := c.Decoder.Decode(&decoded, resp.Body, resp.Header.Get(\"Content-Type\"))\n\treturn &decoded, err\n}", "func ValidateFieldNoteStationResponseBody(body *FieldNoteStationResponseBody) (err error) {\n\tif body.ReadOnly == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"readOnly\", \"body\"))\n\t}\n\treturn\n}", "func NewSigninResponseBody(res *securedviews.GoaJWTView) *SigninResponseBody {\n\tbody := &SigninResponseBody{\n\t\tAuthorization: *res.Authorization,\n\t}\n\treturn body\n}", "func NewAddResponseBody(res *stepviews.ResultStepView) *AddResponseBody {\n\tbody := &AddResponseBody{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Step != nil {\n\t\tbody.Step = marshalStepviewsStoredStepViewToStoredStepResponseBody(res.Step)\n\t}\n\treturn body\n}", "func unmarshalWineryResponseToStorageviewsWineryView(v *WineryResponse) *storageviews.WineryView {\n\tres := &storageviews.WineryView{\n\t\tName: v.Name,\n\t\tRegion: v.Region,\n\t\tCountry: v.Country,\n\t\tURL: v.URL,\n\t}\n\n\treturn res\n}", "func NewVironMenuResponseBody(res *vironviews.VironMenuView) *VironMenuResponseBody {\n\tbody := &VironMenuResponseBody{\n\t\tName: *res.Name,\n\t\tThumbnail: res.Thumbnail,\n\t\tColor: res.Color,\n\t\tTheme: res.Theme,\n\t}\n\tif res.Tags != nil {\n\t\tbody.Tags = make([]string, len(res.Tags))\n\t\tfor i, val := range res.Tags {\n\t\t\tbody.Tags[i] = val\n\t\t}\n\t}\n\tif res.Pages != nil {\n\t\tbody.Pages = make([]*VironPageResponseBody, len(res.Pages))\n\t\tfor i, val := range res.Pages {\n\t\t\tbody.Pages[i] = &VironPageResponseBody{\n\t\t\t\tID: *val.ID,\n\t\t\t\tName: *val.Name,\n\t\t\t\tSection: *val.Section,\n\t\t\t\tGroup: val.Group,\n\t\t\t}\n\t\t\tif val.Components != nil {\n\t\t\t\tbody.Pages[i].Components = make([]*VironComponentResponseBody, len(val.Components))\n\t\t\t\tfor j, val := range val.Components {\n\t\t\t\t\tbody.Pages[i].Components[j] = &VironComponentResponseBody{\n\t\t\t\t\t\tName: *val.Name,\n\t\t\t\t\t\tStyle: *val.Style,\n\t\t\t\t\t\tUnit: val.Unit,\n\t\t\t\t\t\tPagination: val.Pagination,\n\t\t\t\t\t\tPrimary: val.Primary,\n\t\t\t\t\t\tAutoRefreshSec: val.AutoRefreshSec,\n\t\t\t\t\t}\n\t\t\t\t\tif val.Actions != nil {\n\t\t\t\t\t\tbody.Pages[i].Components[j].Actions = make([]string, len(val.Actions))\n\t\t\t\t\t\tfor k, val := range val.Actions {\n\t\t\t\t\t\t\tbody.Pages[i].Components[j].Actions[k] = val\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif val.API != nil {\n\t\t\t\t\t\tbody.Pages[i].Components[j].API = marshalVironAPIViewToVironAPIResponseBody(val.API)\n\t\t\t\t\t}\n\t\t\t\t\tif val.TableLabels != nil {\n\t\t\t\t\t\tbody.Pages[i].Components[j].TableLabels = make([]string, len(val.TableLabels))\n\t\t\t\t\t\tfor k, val := range val.TableLabels {\n\t\t\t\t\t\t\tbody.Pages[i].Components[j].TableLabels[k] = val\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif val.Query != nil {\n\t\t\t\t\t\tbody.Pages[i].Components[j].Query = make([]*VironQueryResponseBody, len(val.Query))\n\t\t\t\t\t\tfor k, val := range val.Query {\n\t\t\t\t\t\t\tbody.Pages[i].Components[j].Query[k] = &VironQueryResponseBody{\n\t\t\t\t\t\t\t\tKey: *val.Key,\n\t\t\t\t\t\t\t\tType: *val.Type,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn body\n}", "func (ch *Chain) callViewFull(req *CallParams) (dict.Dict, error) {\n\tch.runVMMutex.Lock()\n\tdefer ch.runVMMutex.Unlock()\n\n\tvctx := viewcontext.New(ch.ChainID, ch.StateReader, ch.proc, ch.Log)\n\ta, ok, err := req.args.SolidifyRequestArguments(ch.Env.blobCache)\n\tif err != nil || !ok {\n\t\treturn nil, fmt.Errorf(\"solo.internal error: can't solidify args\")\n\t}\n\treturn vctx.CallView(req.target, req.entryPoint, a)\n}", "func unmarshalWindResponseBodyToLogWind(v *WindResponseBody) *log.Wind {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &log.Wind{\n\t\tSpeed: v.Speed,\n\t\tDirection: v.Direction,\n\t\tUnit: v.Unit,\n\t}\n\n\treturn res\n}", "func NewListResponseBody(res *stepviews.StoredListOfStepsView) *ListResponseBody {\n\tbody := &ListResponseBody{\n\t\tWtID: *res.WtID,\n\t}\n\tif res.Steps != nil {\n\t\tbody.Steps = make([]*StoredStepResponseBody, len(res.Steps))\n\t\tfor i, val := range res.Steps {\n\t\t\tbody.Steps[i] = marshalStepviewsStoredStepViewToStoredStepResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func NewFullServer(listener net.Listener) *Server {\n\treturn NewCustomServer(func() Codec {\n\t\treturn &codec.Full{}\n\t}, listener)\n}", "func (c *Client) LatestObservationForStation(id string) Observation {\n\t// return empty observation if station does not exist in obeservations map\n\treturn c.observations[id].observation\n}", "func NewGetUniverseStationsStationIDOK() *GetUniverseStationsStationIDOK {\n\treturn &GetUniverseStationsStationIDOK{}\n}", "func NewGetUniverseStationsStationIDOK() *GetUniverseStationsStationIDOK {\n\treturn &GetUniverseStationsStationIDOK{}\n}", "func NewGetUniverseStationsStationIDEnhanceYourCalm() *GetUniverseStationsStationIDEnhanceYourCalm {\n\treturn &GetUniverseStationsStationIDEnhanceYourCalm{}\n}", "func NewAdminGetUserResponseBodyTiny(res *adminviews.JeeekUserView) *AdminGetUserResponseBodyTiny {\n\tbody := &AdminGetUserResponseBodyTiny{\n\t\tUserID: *res.UserID,\n\t\tUserName: *res.UserName,\n\t\tEmailAddress: *res.EmailAddress,\n\t}\n\treturn body\n}", "func marshalPostsPostOutputToPostOutputResponseBody(v *posts.PostOutput) *PostOutputResponseBody {\n\tres := &PostOutputResponseBody{\n\t\tID: v.ID,\n\t\tTitle: v.Title,\n\t\tDescription: v.Description,\n\t\tScreenImageURL: v.ScreenImageURL,\n\t}\n\n\treturn res\n}", "func (o MixinResponseOutput) Root() pulumi.StringOutput {\n\treturn o.ApplyT(func(v MixinResponse) string { return v.Root }).(pulumi.StringOutput)\n}", "func NewFindResponseBody(res *incidents.Incident) *FindResponseBody {\n\tbody := &FindResponseBody{\n\t\tID: res.ID,\n\t\tDate: res.Date,\n\t\tDateClosed: res.DateClosed,\n\t\tPermissions: res.Permissions,\n\t\tSeverity: res.Severity,\n\t\tTitle: res.Title,\n\t\tSummary: res.Summary,\n\t\tScope: res.Scope,\n\t\tResponsibleParty: res.ResponsibleParty,\n\t\tRootCause: res.RootCause,\n\t\tSlackChannel: res.SlackChannel,\n\t\tCreatedAt: res.CreatedAt,\n\t\tUpdatedAt: res.UpdatedAt,\n\t}\n\tif res.AffectedCustomers != nil {\n\t\tbody.AffectedCustomers = make([]string, len(res.AffectedCustomers))\n\t\tfor i, val := range res.AffectedCustomers {\n\t\t\tbody.AffectedCustomers[i] = val\n\t\t}\n\t}\n\treturn body\n}", "func NewDataResponseBody(res *discussionviews.DiscussionView) *DataResponseBody {\n\tbody := &DataResponseBody{}\n\tif res.Posts != nil {\n\t\tbody.Posts = make([]*ThreadedPostResponseBody, len(res.Posts))\n\t\tfor i, val := range res.Posts {\n\t\t\tbody.Posts[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func NewAdminUpdateUserResponseBodyTiny(res *adminviews.JeeekUserView) *AdminUpdateUserResponseBodyTiny {\n\tbody := &AdminUpdateUserResponseBodyTiny{\n\t\tUserID: *res.UserID,\n\t\tUserName: *res.UserName,\n\t\tEmailAddress: *res.EmailAddress,\n\t}\n\treturn body\n}", "func NewProjectResponseBody(res *discussionviews.DiscussionView) *ProjectResponseBody {\n\tbody := &ProjectResponseBody{}\n\tif res.Posts != nil {\n\t\tbody.Posts = make([]*ThreadedPostResponseBody, len(res.Posts))\n\t\tfor i, val := range res.Posts {\n\t\t\tbody.Posts[i] = marshalDiscussionviewsThreadedPostViewToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\treturn body\n}", "func marshalDiscussionThreadedPostToThreadedPostResponseBody(v *discussion.ThreadedPost) *ThreadedPostResponseBody {\n\tres := &ThreadedPostResponseBody{\n\t\tID: v.ID,\n\t\tCreatedAt: v.CreatedAt,\n\t\tUpdatedAt: v.UpdatedAt,\n\t\tBody: v.Body,\n\t\tBookmark: v.Bookmark,\n\t}\n\tif v.Author != nil {\n\t\tres.Author = marshalDiscussionPostAuthorToPostAuthorResponseBody(v.Author)\n\t}\n\tif v.Replies != nil {\n\t\tres.Replies = make([]*ThreadedPostResponseBody, len(v.Replies))\n\t\tfor i, val := range v.Replies {\n\t\t\tres.Replies[i] = marshalDiscussionThreadedPostToThreadedPostResponseBody(val)\n\t\t}\n\t}\n\n\treturn res\n}", "func (this *BuoyController) Station() {\n\tbuoyBusiness.Station(&this.BaseController, this.GetString(\":stationId\"))\n}", "func (s *Service) FullShort(c context.Context, pn, ps int64, source string) (res []*webmdl.Mi, err error) {\n\tvar (\n\t\taids []int64\n\t\tip = metadata.String(c, metadata.RemoteIP)\n\t\tm = make(map[int64]string)\n\t)\n\tif aids, err = s.aids(c, pn, ps); err != nil {\n\t\treturn\n\t}\n\tif res, err = s.archiveWithTag(c, aids, ip, m, source); err != nil {\n\t\tlog.Error(\"s.archiveWithTag error(%v)\", err)\n\t}\n\treturn\n}", "func TickerOutLatestHandler() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\ttemp := storage.TrackDB.ReadTimeStamps()\n\t\tmax := len(temp) - 1\n\t\tout := temp[max]\n\t\tjson.NewEncoder(w).Encode(out)\n\t})\n}", "func (o *GetUniverseStationsStationIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {\n\tswitch response.Code() {\n\n\tcase 200:\n\t\tresult := NewGetUniverseStationsStationIDOK()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, nil\n\n\tcase 304:\n\t\tresult := NewGetUniverseStationsStationIDNotModified()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 400:\n\t\tresult := NewGetUniverseStationsStationIDBadRequest()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 404:\n\t\tresult := NewGetUniverseStationsStationIDNotFound()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 420:\n\t\tresult := NewGetUniverseStationsStationIDEnhanceYourCalm()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 500:\n\t\tresult := NewGetUniverseStationsStationIDInternalServerError()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 503:\n\t\tresult := NewGetUniverseStationsStationIDServiceUnavailable()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tcase 504:\n\t\tresult := NewGetUniverseStationsStationIDGatewayTimeout()\n\t\tif err := result.readResponse(response, consumer, o.formats); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, result\n\n\tdefault:\n\t\treturn nil, runtime.NewAPIError(\"unknown error\", response, response.Code())\n\t}\n}", "func (c *Client) DecodeComJossemargtSaoDraftResultFull(resp *http.Response) (*ComJossemargtSaoDraftResultFull, error) {\n\tvar decoded ComJossemargtSaoDraftResultFull\n\terr := c.Decoder.Decode(&decoded, resp.Body, resp.Header.Get(\"Content-Type\"))\n\treturn &decoded, err\n}", "func (c *Client) LatestObservationForStationLastRetrieved(id string) time.Time {\n\t// return zero time if station does not exist in obeservations map\n\treturn c.observations[id].observationLastRetrieved\n}", "func newBattlestreamingresult(vres *shiritoriviews.BattlestreamingresultView) *Battlestreamingresult {\n\tres := &Battlestreamingresult{}\n\tif vres.Type != nil {\n\t\tres.Type = *vres.Type\n\t}\n\tif vres.Timestamp != nil {\n\t\tres.Timestamp = *vres.Timestamp\n\t}\n\tif vres.MessagePayload != nil {\n\t\tres.MessagePayload = transformShiritoriviewsMessagePayloadViewToMessagePayload(vres.MessagePayload)\n\t}\n\treturn res\n}", "func NewAdminGetUserResponseBody(res *adminviews.JeeekUserView) *AdminGetUserResponseBody {\n\tbody := &AdminGetUserResponseBody{\n\t\tUserID: *res.UserID,\n\t\tUserName: *res.UserName,\n\t\tEmailAddress: *res.EmailAddress,\n\t\tPhoneNumber: *res.PhoneNumber,\n\t\tPhotoURL: *res.PhotoURL,\n\t\tEmailVerified: *res.EmailVerified,\n\t}\n\treturn body\n}", "func marshalRxRecipeResponseBodyToRxRecipeView(v *RxRecipeResponseBody) *recipeviews.RxRecipeView {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tres := &recipeviews.RxRecipeView{\n\t\tID: v.ID,\n\t\tTitle: v.Title,\n\t\tDescription: v.Description,\n\t\tVersion: v.Version,\n\t\tFavorite: v.Favorite,\n\t\tRating: v.Rating,\n\t\tDifficulty: v.Difficulty,\n\t\tState: v.State,\n\t\tComplete: v.Complete,\n\t}\n\tif v.Ingredients != nil {\n\t\tres.Ingredients = marshalIngredientListResponseBodyToIngredientListView(v.Ingredients)\n\t}\n\n\treturn res\n}" ]
[ "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.62119246", "0.62119246", "0.6145562", "0.6145562", "0.54091907", "0.53821766", "0.52899957", "0.5090064", "0.5017846", "0.49494392", "0.47911316", "0.47437823", "0.45934406", "0.45934406", "0.45872462", "0.45867214", "0.45605946", "0.45564628", "0.45564628", "0.4472565", "0.434347", "0.43201202", "0.43183976", "0.4306569", "0.4304003", "0.4295773", "0.42742613", "0.42669827", "0.42386788", "0.4227939", "0.41846365", "0.4177146", "0.41737726", "0.41737726", "0.41516158", "0.41359502", "0.41344815", "0.41302118", "0.4106678", "0.41042978", "0.40867576", "0.40699977", "0.40686423", "0.40643096", "0.40620068", "0.40610367", "0.40528986", "0.40355057", "0.39851138", "0.39809677", "0.39401135", "0.39142552", "0.38897473", "0.3883291", "0.38739717", "0.3863711", "0.3856341", "0.38479978", "0.3837366", "0.3813057", "0.3813057", "0.3811625", "0.38077575", "0.37984452", "0.37944192", "0.37787235", "0.37718698", "0.3769058", "0.37681547", "0.3760814", "0.37559205", "0.3754308", "0.37541425", "0.374525", "0.37333697", "0.37115544", "0.37099424", "0.3705513", "0.3694754" ]
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: reason,\n\t\tMessage: message,\n\t}\n}", "func newCondition(conditionType api.Caffe2JobConditionType, reason, message string) api.Caffe2JobCondition {\n\treturn api.Caffe2JobCondition{\n\t\tType: conditionType,\n\t\tStatus: v1.ConditionTrue,\n\t\tLastUpdateTime: metav1.Now(),\n\t\tLastTransitionTime: metav1.Now(),\n\t\tReason: reason,\n\t\tMessage: message,\n\t}\n}", "func NewCondition(attribute string, comparisonInfo ComparisonInfo, ) *Condition {\n\tthis := Condition{}\n\tthis.Attribute = attribute\n\tthis.ComparisonInfo = comparisonInfo\n\treturn &this\n}", "func NewCreateOrUpdateAlertSettingConditionCommand() *cobra.Command {\n\tvar conds SettingConditionPayloads\n\tvar cond SettingConditionPayload\n\n\tcmd := &cobra.Command{\n\t\tUse: \"set\",\n\t\tAliases: []string{\"create\", \"update\"},\n\t\tShort: \"Create or Update an alert setting's condition or load from file\",\n\t\tExample: `alert setting condition set --alert=1001 --condition=\"lag >= 100000 or alert setting condition set ./alert_cond.yml`,\n\t\tTraverseChildren: true,\n\t\tSilenceErrors: true,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\n\t\t\tif len(conds.Conditions) > 0 {\n\t\t\t\talertID := conds.AlertID\n\t\t\t\tfor _, condition := range conds.Conditions {\n\t\t\t\t\terr := config.Client.CreateOrUpdateAlertSettingCondition(alertID, condition)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tgolog.Errorf(\"Failed to creating/updating alert setting condition [%s]. [%s]\", condition, err.Error())\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tbite.PrintInfo(cmd, \"Condition [%s] added\", condition)\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tfmt.Print(cond)\n\t\t\tif err := bite.CheckRequiredFlags(cmd, bite.FlagPair{\"alert\": cond.AlertID, \"condition\": cond.Condition}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr := config.Client.CreateOrUpdateAlertSettingCondition(cond.AlertID, cond.Condition)\n\t\t\tif err != nil {\n\t\t\t\tgolog.Errorf(\"Failed to creating/updating alert setting condition [%s]. [%s]\", cond.Condition, err.Error())\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn bite.PrintInfo(cmd, \"Condition [%s] added\", cond.Condition)\n\t\t},\n\t}\n\n\tcmd.Flags().IntVar(&cond.AlertID, \"alert\", 0, \"Alert ID\")\n\tcmd.Flags().StringVar(&cond.Condition, \"condition\", \"\", `Alert condition .e.g. \"lag >= 100000 on group group and topic topicA\"`)\n\n\tbite.CanBeSilent(cmd)\n\n\tbite.Prepend(cmd, bite.FileBind(&cond))\n\tbite.Prepend(cmd, bite.FileBind(&conds))\n\n\treturn cmd\n}", "func NewAlertSettingConditionGroupCommand() *cobra.Command {\n\trootSub := &cobra.Command{\n\t\tUse: \"condition\",\n\t\tShort: \"Manage alert setting's condition\",\n\t\tExample: `alert setting condition delete --alert=1001 --condition=\"28bbad2b-69bb-4c01-8e37-28e2e7083aa9\"`,\n\t\tTraverseChildren: true,\n\t\tSilenceErrors: true,\n\t}\n\n\trootSub.AddCommand(NewCreateOrUpdateAlertSettingConditionCommand())\n\trootSub.AddCommand(NewDeleteAlertSettingConditionCommand())\n\n\treturn rootSub\n}", "func NewCond() Cond {\n\treturn condEmpty{}\n}", "func NewDeleteAlertSettingConditionCommand() *cobra.Command {\n\tvar (\n\t\talertID int\n\t\tconditionUUID string\n\t)\n\n\tcmd := &cobra.Command{\n\t\tUse: \"delete\",\n\t\tShort: \"Delete an alert setting's condition\",\n\t\tExample: `alert setting condition delete --alert=1001 --condition=\"28bbad2b-69bb-4c01-8e37-28e2e7083aa9\"`,\n\t\tTraverseChildren: true,\n\t\tSilenceErrors: true,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\terr := config.Client.DeleteAlertSettingCondition(alertID, conditionUUID)\n\t\t\tif err != nil {\n\t\t\t\tgolog.Errorf(\"Failed to deleting alert setting condition [%s]. [%s]\", conditionUUID, err.Error())\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn bite.PrintInfo(cmd, \"Condition [%s] for alert setting [%d] deleted\", conditionUUID, alertID)\n\t\t},\n\t}\n\n\tcmd.Flags().IntVar(&alertID, \"alert\", 0, \"Alert ID\")\n\tcmd.MarkFlagRequired(\"alert\")\n\tcmd.Flags().StringVar(&conditionUUID, \"condition\", \"\", `Alert condition uuid .e.g. \"28bbad2b-69bb-4c01-8e37-28e2e7083aa9\"`)\n\tcmd.MarkFlagRequired(\"condition\")\n\tbite.CanBeSilent(cmd)\n\n\treturn cmd\n}", "func NewRuleCondition(anchoring RulePatternAnchoring, pattern, context string) RuleCondition {\n\treturn RuleCondition{\n\t\tAnchoring: anchoring,\n\t\tPattern: pattern,\n\t\tContext: context,\n\t}\n}", "func NewCond() *Cond {\n\treturn &Cond{C: make(chan struct{})}\n}", "func NewGetCondition(receiver, runtime string) New {\n\treturn func(f *jen.File, o types.Object) {\n\t\tf.Commentf(\"GetCondition of this %s.\", o.Name())\n\t\tf.Func().Params(jen.Id(receiver).Op(\"*\").Id(o.Name())).Id(\"GetCondition\").Params(jen.Id(\"ct\").Qual(runtime, \"ConditionType\")).Qual(runtime, \"Condition\").Block(\n\t\t\tjen.Return(jen.Id(receiver).Dot(fields.NameStatus).Dot(\"GetCondition\").Call(jen.Id(\"ct\"))),\n\t\t)\n\t}\n}", "func NewCommand(cfg etc.AquaCSP) Command {\n\treturn &command{\n\t\tcfg: cfg,\n\t}\n}", "func NewCondition(c MarshalableUnlockCondition) UnlockConditionProxy {\n\treturn UnlockConditionProxy{Condition: c}\n}", "func NewBoolCondition(c int, b bool) (*Condition, error) {\n\tif c != CaseEq && c != CaseNe {\n\t\treturn nil, ErrInvalidCondition\n\t}\n\tret := &Condition{ctype: types.Bool, ccase: c, cvalue: b}\n\n\treturn ret, nil\n}", "func Condition(name string, ops ...ConditionOp) *v1alpha1.Condition {\n\tcondition := &v1alpha1.Condition{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t},\n\t}\n\tfor _, op := range ops {\n\t\top(condition)\n\t}\n\treturn condition\n}", "func (in Condition) DeepCopy() Condition {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Condition)\n\tin.DeepCopyInto(out)\n\treturn *out\n}", "func (app *exitBuilder) WithCondition(cond string) ExitBuilder {\n\tapp.condition = cond\n\treturn app\n}", "func (ec *EquipmentCreate) SetCondition(s string) *EquipmentCreate {\n\tec.mutation.SetCondition(s)\n\treturn ec\n}", "func NewGetAlertSettingConditionsCommand() *cobra.Command {\n\tvar alertID int\n\n\tcmd := &cobra.Command{\n\t\tUse: \"conditions\",\n\t\tShort: \"Print alert setting's conditions\",\n\t\tExample: \"alert setting conditions --alert=1001\",\n\t\tTraverseChildren: true,\n\t\tSilenceErrors: true,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tconds, err := config.Client.GetAlertSettingConditions(alertID)\n\t\t\tif err != nil {\n\t\t\t\tgolog.Errorf(\"Failed to retrieve alert setting conditions for [%d]. [%s]\", alertID, err.Error())\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// force-json\n\t\t\treturn bite.PrintObject(cmd, conds)\n\t\t},\n\t}\n\n\tcmd.Flags().IntVar(&alertID, \"alert\", 0, \"--alert=1001\")\n\tcmd.MarkFlagRequired(\"alert\")\n\n\tbite.CanBeSilent(cmd)\n\tbite.CanPrintJSON(cmd)\n\n\treturn cmd\n}", "func NewConditionRule(\n\tconfig conditions.Config,\n\tp Processor,\n) (Processor, error) {\n\tcond, err := conditions.NewCondition(&config)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to initialize condition\")\n\t}\n\n\tif cond == nil {\n\t\treturn p, nil\n\t}\n\treturn &WhenProcessor{cond, p}, nil\n}", "func (s *ContainerDependency) SetCondition(v string) *ContainerDependency {\n\ts.Condition = &v\n\treturn s\n}", "func NewQueryCondition()(*QueryCondition) {\n m := &QueryCondition{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "func NewCommand(commandName string, p1 int64, p2 int64) Command {\n\tcommandCode := commandCodes[commandName]\n\n\treturn Command{commandCode, p1, p2, false, false, \"\"}\n}", "func NewStringCondition(c int, s string) (*Condition, error) {\n\tif c != CaseEq && c != CaseNe && c != CaseContains && c != CaseNotContains {\n\t\treturn nil, ErrInvalidCondition\n\t}\n\tret := &Condition{ctype: types.String, ccase: c, cvalue: s}\n\n\treturn ret, nil\n}", "func NewCommand(cmdName string, u *store.User) Command {\n\tfor _, cp := range commandPatterns {\n\t\tif cp.compPattern.MatchString(cmdName) {\n\t\t\tcmd := cp.createCmd(cmdName)\n\t\t\tif cmd.IsAllow(u) {\n\t\t\t\treturn cmd\n\t\t\t}\n\t\t}\n\t}\n\tc := &unknown{\n\t\tu: u,\n\t}\n\treturn c\n}", "func (in *Condition) DeepCopy() *Condition {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Condition)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Condition) DeepCopy() *Condition {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Condition)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Condition) DeepCopy() *Condition {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Condition)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Condition) DeepCopy() *Condition {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Condition)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Condition) DeepCopy() *Condition {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Condition)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Condition) DeepCopy() *Condition {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Condition)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Condition) DeepCopy() *Condition {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Condition)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Condition) DeepCopy() *Condition {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Condition)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Condition) DeepCopy() *Condition {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Condition)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Condition) DeepCopy() *Condition {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Condition)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Condition) DeepCopy() *Condition {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Condition)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Condition) DeepCopy() *Condition {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Condition)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (o *SecurityMonitoringRuleCase) SetCondition(v string) {\n\to.Condition = &v\n}", "func (s *ExportFilter) SetCondition(v string) *ExportFilter {\n\ts.Condition = &v\n\treturn s\n}", "func NewCond(l Locker) *Cond {\n\treturn sync.NewCond(l)\n}", "func NewContractCommand(cli *Cli) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"contract\",\n\t\tShort: \"Operate contract command, query\",\n\t}\n\tcmd.AddCommand(NewContractStatDataQueryCommand(cli))\n\treturn cmd\n}", "func (n *Node) SetCondition(condition string) {\n\tif strings.IndexFunc(condition, unicode.IsSpace) != -1 {\n\t\tpanic(\"vdf: condition cannot contain spaces\")\n\t}\n\tif strings.ContainsAny(condition, \"\\\"{}\") {\n\t\tpanic(\"vdf: condition cannot contain \\\", {, or }\")\n\t}\n\tn.condition = condition\n\tif n.cf != nil && n.cf.condition == \"\" {\n\t\tn.cf.condition = \" \"\n\t}\n}", "func Condition() *ConditionApplyConfiguration {\n\treturn &ConditionApplyConfiguration{}\n}", "func NewCommand(name string) Command {\n\treturn Command{name: name}\n}", "func (m *TradeConditionMutation) SetCondition(s string) {\n\tm.condition = &s\n}", "func NewScriptConditionBuilder() *ScriptConditionBuilder {\n\tr := ScriptConditionBuilder{\n\t\t&ScriptCondition{\n\t\t\tParams: make(map[string]interface{}, 0),\n\t\t},\n\t}\n\n\treturn &r\n}", "func (m *PasswordResetModel) Condition(builder query.SQLBuilder) *PasswordResetModel {\n\tmm := m.clone()\n\tmm.query = mm.query.Merge(builder)\n\n\treturn mm\n}", "func New() *Command {\n\treturn &Command{}\n}", "func (s *SingleSelectQuestionRuleCategoryAutomation) SetCondition(v string) *SingleSelectQuestionRuleCategoryAutomation {\n\ts.Condition = &v\n\treturn s\n}", "func ConditionExport(context *clusterd.Context, namespaceName types.NamespacedName, conditionType cephv1.ConditionType, status v1.ConditionStatus, reason, message string) {\n\tsetCondition(context, namespaceName, cephv1.Condition{\n\t\tType: conditionType,\n\t\tStatus: status,\n\t\tReason: reason,\n\t\tMessage: message,\n\t})\n}", "func NewCommand(tick uint, name string, args ...string) *Command {\n\tc := &Command{tick: tick, name: name, args: args}\n\treturn c\n}", "func NewResourceCondition(ref *common.ResourceRef) ResourceConditionInterface {\n\tkvg := ref.SprintKindVersionGroup()\n\trc, found := supportedResourceConditions[kvg]\n\tif found == false {\n\t\trc = nil\n\t}\n\treturn rc\n}", "func newIfCond(a, operator, b string) (ifCond, error) {\n\tif _, ok := ifConditions[operator]; !ok {\n\t\treturn ifCond{}, operatorError(operator)\n\t}\n\treturn ifCond{\n\t\ta: a,\n\t\top: operator,\n\t\tb: b,\n\t}, nil\n}", "func (s *Delete) Condition(c *Condition) *Delete {\n\tc.Reset(HAVING, LIMIT, ORDER, OFFSET, GROUP, ON)\n\ts.condition = c\n\treturn s\n}", "func (gatewayUpdate *GatewayConditionsUpdate) AddCondition(cond gatewayapi_v1alpha1.GatewayConditionType, status metav1.ConditionStatus, reason GatewayReasonType, message string) metav1.Condition {\n\n\tif c, ok := gatewayUpdate.Conditions[cond]; ok {\n\t\tmessage = fmt.Sprintf(\"%s, %s\", c.Message, message)\n\t}\n\n\tnewCond := metav1.Condition{\n\t\tReason: string(reason),\n\t\tStatus: status,\n\t\tType: string(cond),\n\t\tMessage: message,\n\t\tLastTransitionTime: metav1.NewTime(clock.Now()),\n\t\tObservedGeneration: gatewayUpdate.Generation,\n\t}\n\tgatewayUpdate.Conditions[cond] = newCond\n\treturn newCond\n}", "func RepresentCondition(expected conditionsv1.Condition) gomegatypes.GomegaMatcher {\n\treturn &representConditionMatcher{\n\t\texpected: expected,\n\t}\n}", "func NewCommand(reqType string) (cmd map[string]interface{}) {\n\treturn map[string]interface{}{\n\t\t\"cmd\": reqType,\n\t}\n}", "func (chs *ChartChangeSync) setCondition(hr helmfluxv1.HelmRelease, typ helmfluxv1.HelmReleaseConditionType, st v1.ConditionStatus, reason, message string) error {\n\thrClient := chs.ifClient.HelmV1().HelmReleases(hr.Namespace)\n\tcondition := status.NewCondition(typ, st, reason, message)\n\treturn status.SetCondition(hrClient, hr, condition)\n}", "func createCommand() cli.Command {\n\treturn cli.Command{\n\t\tName: \"create\",\n\t\tBefore: survey.RequireGlobalFlagsFunc(requiredFlags...),\n\t\tAction: create(),\n\t}\n}", "func (b *QueryBuilder) Condition(c NodeI) {\n\tif b.ConditionNode == nil {\n\t\tb.ConditionNode = c\n\t} else {\n\t\tb.ConditionNode = op.And(b.ConditionNode, c)\n\t}\n}", "func NewCommand(c *cli.Context) (Command, error) {\n\tconst errtag = \"NewCommand():\"\n\tvar err error\n\n\tvar cmd Command\n\tb := c.GlobalString(\"businesscard\")\n\n\tif b == \"\" {\n\t\targs := c.Args()\n\t\tcmd.repo = args[0]\n\t\tcmd.name, err = getName(cmd.repo)\n\t\tif err != nil {\n\t\t\treturn cmd, errors.Wrap(err, errtag)\n\t\t}\n\t\tcmd.args = args[1:]\n\t} else {\n\t\tcmd.name = b\n\t\tcmd.repo = \"github.com/\" + b + \"/\" + b\n\t}\n\n\treturn cmd, nil\n}", "func (s *PipelineExecutionStepMetadata) SetCondition(v *ConditionStepMetadata) *PipelineExecutionStepMetadata {\n\ts.Condition = v\n\treturn s\n}", "func NewOperatorCommand() *cobra.Command {\n\tc := &cobra.Command{\n\t\tUse: \"operator\",\n\t\tShort: \"operator commands\",\n\t}\n\tc.AddCommand(NewShowOperatorCommand())\n\tc.AddCommand(NewCheckOperatorCommand())\n\tc.AddCommand(NewAddOperatorCommand())\n\tc.AddCommand(NewRemoveOperatorCommand())\n\tc.AddCommand(NewHistoryOperatorCommand())\n\treturn c\n}", "func (m *UserModel) Condition(builder query.SQLBuilder) *UserModel {\n\tmm := m.clone()\n\tmm.query = mm.query.Merge(builder)\n\n\treturn mm\n}", "func (s *CreateResourcePolicyStatementInput) SetCondition(v map[string]map[string]*string) *CreateResourcePolicyStatementInput {\n\ts.Condition = v\n\treturn s\n}", "func setCondition(c *clusterd.Context, namespaceName types.NamespacedName, newCondition cephv1.Condition) {\n\tcluster, err := c.RookClientset.CephV1().CephClusters(namespaceName.Namespace).Get(namespaceName.Name, metav1.GetOptions{})\n\tif err != nil {\n\t\tif kerrors.IsNotFound(err) {\n\t\t\tlogger.Errorf(\"no CephCluster could not be found. %+v\", err)\n\t\t\treturn\n\t\t}\n\t\tlogger.Errorf(\"failed to get CephCluster object. %+v\", err)\n\t\treturn\n\t}\n\n\tif conditions == nil {\n\t\tconditions = &cluster.Status.Conditions\n\t\tif cluster.Status.Conditions != nil {\n\t\t\tconditionMapping(*conditions)\n\t\t}\n\t}\n\tconditionMap[newCondition.Type] = newCondition.Status\n\texistingCondition := findStatusCondition(*conditions, newCondition.Type)\n\tif existingCondition == nil {\n\t\tnewCondition.LastTransitionTime = metav1.NewTime(time.Now())\n\t\tnewCondition.LastHeartbeatTime = metav1.NewTime(time.Now())\n\t\t*conditions = append(*conditions, newCondition)\n\n\t} else if existingCondition.Status != newCondition.Status || existingCondition.Message != newCondition.Message {\n\t\tnewCondition.LastTransitionTime = metav1.NewTime(time.Now())\n\t\texistingCondition.Status = newCondition.Status\n\t\texistingCondition.Reason = newCondition.Reason\n\t\texistingCondition.Message = newCondition.Message\n\t\texistingCondition.LastHeartbeatTime = metav1.NewTime(time.Now())\n\t}\n\tcluster.Status.Conditions = *conditions\n\n\tif newCondition.Status == v1.ConditionTrue {\n\t\tcluster.Status.Phase = newCondition.Type\n\t\tif state := translatePhasetoState(newCondition.Type); state != \"\" {\n\t\t\tcluster.Status.State = state\n\t\t}\n\t\tcluster.Status.Message = newCondition.Message\n\t\tlogger.Debugf(\"CephCluster %q status: %q. %q\", namespaceName.Namespace, cluster.Status.Phase, cluster.Status.Message)\n\t}\n\n\terr = c.Client.Status().Update(context.TODO(), cluster)\n\tif err != nil {\n\t\tlogger.Errorf(\"failed to update cluster condition to %+v. %v\", newCondition, err)\n\t}\n\tif newCondition.Type == cephv1.ConditionReady {\n\t\tcheckConditionFalse(c, namespaceName)\n\t}\n}", "func newTradeConditionMutation(c config, op Op, opts ...tradeconditionOption) *TradeConditionMutation {\n\tm := &TradeConditionMutation{\n\t\tconfig: c,\n\t\top: op,\n\t\ttyp: TypeTradeCondition,\n\t\tclearedFields: make(map[string]struct{}),\n\t}\n\tfor _, opt := range opts {\n\t\topt(m)\n\t}\n\treturn m\n}", "func NewIntCondition(c int, i int) (*Condition, error) {\n\tif c != CaseEq && c != CaseNe && c != CaseGt && c != CaseGe && c != CaseLt && c != CaseLe {\n\t\treturn nil, ErrInvalidCondition\n\t}\n\tret := &Condition{ctype: types.Int, ccase: c, cvalue: i}\n\n\treturn ret, nil\n}", "func (t *Table) NewConditionList() *ConditionList {\n\treturn NewConditionList(t.design.GetKeyAttributes())\n}", "func (s *Filter) SetCondition(v string) *Filter {\n\ts.Condition = &v\n\treturn s\n}", "func (m *UserExtModel) Condition(builder query.SQLBuilder) *UserExtModel {\n\tmm := m.clone()\n\tmm.query = mm.query.Merge(builder)\n\n\treturn mm\n}", "func NewCommand(io ui.IO, newClient newClientFunc) *Command {\n\treturn &Command{\n\t\tio: io,\n\t\tnewClient: newClient,\n\t}\n}", "func newCommand(devfileObj parser.DevfileObj, devfileCmd v1alpha2.Command) (command, error) {\n\tvar cmd command\n\n\tcommandType, err := common.GetCommandType(devfileCmd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch commandType {\n\n\tcase v1alpha2.ApplyCommandType:\n\t\tcmd = newApplyCommand(devfileObj, devfileCmd)\n\n\tcase v1alpha2.CompositeCommandType:\n\t\tif util.SafeGetBool(devfileCmd.Composite.Parallel) {\n\t\t\tcmd = newParallelCompositeCommand(devfileObj, devfileCmd)\n\t\t}\n\t\tcmd = newCompositeCommand(devfileObj, devfileCmd)\n\n\tcase v1alpha2.ExecCommandType:\n\t\tcmd = newExecCommand(devfileObj, devfileCmd)\n\t}\n\n\tif err = cmd.CheckValidity(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn cmd, nil\n}", "func ParseCondition(inputStr string) (ast.Condition, error) {\n\tlogger := logrus.WithField(\"method\", \"ParseCondition\")\n\tlxr := lexer.New(inputStr)\n\temptySwaggerTypes := []types.Type{}\n\tprsr := New(lxr, emptySwaggerTypes)\n\tast := prsr.parseCondition(PRECEDENCE_LOWEST)\n\tlogger.WithField(\"condition\", inputStr).WithField(\"ast\", fmt.Sprintf(\"%#v\", ast)).Debug(\"ParseCondition\")\n\tif len(prsr.errors) > 0 {\n\t\treturn nil, errors.New(strings.Join(prsr.errors, \"\\n\"))\n\t}\n\treturn ast, nil\n}", "func (tb *TaskBuilder) ChangeCondition(newCondition string) string {\n\treturn fmt.Sprintf(`ALTER TASK %v MODIFY WHEN %v`, tb.QualifiedName(), newCondition)\n}", "func NewOperatorCommand() *cobra.Command {\n\t// \"console\" just prints help, then exists. It doesn't start\n\t// the operator.\n\tcmd := &cobra.Command{\n\t\tUse: \"console\",\n\t\tShort: \"Top level command\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tcmd.Help()\n\t\t\tos.Exit(1)\n\t\t},\n\t}\n\n\tcmd.AddCommand(operator.NewOperator())\n\tcmd.AddCommand(version.NewVersion())\n\tcmd.AddCommand(crdconversionwebhook.NewConverter())\n\n\treturn cmd\n}", "func NewCommand(ctx *plan.Context, p *plan.Command) *Command {\n\tm := &Command{\n\t\tTaskBase: NewTaskBase(ctx),\n\t\tp: p,\n\t}\n\treturn m\n}", "func (b *IntervalBuilder) BuildCondition() Condition {\n\tret := Condition{\n\t\tLevel: b.level,\n\t\tLocator: b.structuredLocator.OldLocator(),\n\t\tStructuredLocator: b.structuredLocator,\n\t\tMessage: b.structuredMessage.OldMessage(),\n\t\tStructuredMessage: b.structuredMessage,\n\t}\n\n\treturn ret\n}", "func (_e *DeleteItemBuilder_Expecter) WithCondition(cond interface{}) *DeleteItemBuilder_WithCondition_Call {\n\treturn &DeleteItemBuilder_WithCondition_Call{Call: _e.mock.On(\"WithCondition\", cond)}\n}", "func NewCommand(name string, args []string, argsname []string) *CommandBase {\n\treturn &CommandBase{name, args, argsname}\n}", "func NewConditionEqual(uuid string, data interface{}) (EqualCondition, error) {\n\treturn EqualCondition{id: uuid, kind: ConditionEqual, target: data}, nil\n}", "func NewCommand(client interfaces.Client, config interfaces.ConfigProvider) *cobra.Command {\n\tcommand := &cobra.Command{\n\t\tUse: \"apply\",\n\t\tShort: \"Make changes to existing resources\",\n\t}\n\n\tcommand.AddCommand(\n\t\tnewLicence(os.Stdout, client, config),\n\t)\n\n\treturn command\n}", "func NewConditional(\n\truleFactory Constructor,\n) Constructor {\n\treturn func(cfg *common.Config) (Processor, error) {\n\t\trule, err := ruleFactory(cfg)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn addCondition(cfg, rule)\n\t}\n}", "func setCondition(status *api.Caffe2JobStatus, condition api.Caffe2JobCondition) {\n\tcurrentCond := getCondition(*status, condition.Type)\n\n\t// Do nothing if condition doesn't change\n\tif currentCond != nil && currentCond.Status == condition.Status && currentCond.Reason == condition.Reason {\n\t\treturn\n\t}\n\n\t// Do not update lastTransitionTime if the status of the condition doesn't change.\n\tif currentCond != nil && currentCond.Status == condition.Status {\n\t\tcondition.LastTransitionTime = currentCond.LastTransitionTime\n\t}\n\n\t// Append the updated condition to the\n\tnewConditions := filterOutCondition(status.Conditions, condition.Type)\n\tstatus.Conditions = append(newConditions, condition)\n}", "func NewConditionUrlCondition() *ConditionUrlCondition {\n\tthis := ConditionUrlCondition{}\n\treturn &this\n}", "func (b *Builder) WithCommandNew(cmd []string) *Builder {\n\tif cmd == nil {\n\t\tb.errors = append(\n\t\t\tb.errors,\n\t\t\terrors.New(\"failed to build container object: nil command\"),\n\t\t)\n\t\treturn b\n\t}\n\n\tif len(cmd) == 0 {\n\t\tb.errors = append(\n\t\t\tb.errors,\n\t\t\terrors.New(\"failed to build container object: missing command\"),\n\t\t)\n\t\treturn b\n\t}\n\n\tnewcmd := []string{}\n\tnewcmd = append(newcmd, cmd...)\n\n\tb.con.Command = newcmd\n\treturn b\n}", "func NewSetConditions(receiver, runtime string) New {\n\treturn func(f *jen.File, o types.Object) {\n\t\tf.Commentf(\"SetConditions of this %s.\", o.Name())\n\t\tf.Func().Params(jen.Id(receiver).Op(\"*\").Id(o.Name())).Id(\"SetConditions\").Params(jen.Id(\"c\").Op(\"...\").Qual(runtime, \"Condition\")).Block(\n\t\t\tjen.Id(receiver).Dot(fields.NameStatus).Dot(\"SetConditions\").Call(jen.Id(\"c\").Op(\"...\")),\n\t\t)\n\t}\n}", "func MatchCondition(expected status.Condition) types.GomegaMatcher {\n\treturn &conditionMatcher{ExpectedCondition: expected}\n}", "func NewCommand(app *App) *Command {\n\treturn &Command{\n\t\tapp: app,\n\t}\n}", "func NewCommand(c Command, run RunFunc, subCommands SubCommands, mod ...CommandModifier) *cobra.Command {\n\treturn newCommand(c, run, subCommands, mod...)\n}", "func NewCfnWaitCondition(scope constructs.Construct, id *string, props *CfnWaitConditionProps) CfnWaitCondition {\n\t_init_.Initialize()\n\n\tj := jsiiProxy_CfnWaitCondition{}\n\n\t_jsii_.Create(\n\t\t\"aws-cdk-lib.aws_cloudformation.CfnWaitCondition\",\n\t\t[]interface{}{scope, id, props},\n\t\t&j,\n\t)\n\n\treturn &j\n}", "func NewDMClusterCondition(condType v1alpha1.DMClusterConditionType, status v1.ConditionStatus, reason, message string) *v1alpha1.DMClusterCondition {\n\treturn &v1alpha1.DMClusterCondition{\n\t\tType: condType,\n\t\tStatus: status,\n\t\tLastUpdateTime: metav1.Now(),\n\t\tLastTransitionTime: metav1.Now(),\n\t\tReason: reason,\n\t\tMessage: message,\n\t}\n}", "func newCommand(s *Set) *Command {\n\tc := new(Command)\n\tc.set = s\n\n\treturn c\n}", "func (o BindingOutput) Condition() ExprPtrOutput {\n\treturn o.ApplyT(func(v Binding) *Expr { return v.Condition }).(ExprPtrOutput)\n}", "func (o BindingOutput) Condition() ExprPtrOutput {\n\treturn o.ApplyT(func(v Binding) *Expr { return v.Condition }).(ExprPtrOutput)\n}", "func (o BindingOutput) Condition() ExprPtrOutput {\n\treturn o.ApplyT(func(v Binding) *Expr { return v.Condition }).(ExprPtrOutput)\n}", "func (o BindingOutput) Condition() ExprPtrOutput {\n\treturn o.ApplyT(func(v Binding) *Expr { return v.Condition }).(ExprPtrOutput)\n}", "func (o BindingOutput) Condition() ExprPtrOutput {\n\treturn o.ApplyT(func(v Binding) *Expr { return v.Condition }).(ExprPtrOutput)\n}", "func UnmarshalConditionsCmd(rawQuery map[string]interface{}, refID string) (*ConditionsCmd, error) {\n\tjsonFromM, err := json.Marshal(rawQuery[\"conditions\"])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to remarshal classic condition body: %w\", err)\n\t}\n\tvar ccj []ConditionJSON\n\tif err = json.Unmarshal(jsonFromM, &ccj); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to unmarshal remarshaled classic condition body: %w\", err)\n\t}\n\n\tc := &ConditionsCmd{\n\t\tRefID: refID,\n\t}\n\n\tfor i, cj := range ccj {\n\t\tcond := condition{}\n\n\t\tif i > 0 && cj.Operator.Type != \"and\" && cj.Operator.Type != \"or\" {\n\t\t\treturn nil, fmt.Errorf(\"condition %v operator must be `and` or `or`\", i+1)\n\t\t}\n\t\tcond.Operator = cj.Operator.Type\n\n\t\tif len(cj.Query.Params) == 0 || cj.Query.Params[0] == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"condition %v is missing the query RefID argument\", i+1)\n\t\t}\n\n\t\tcond.InputRefID = cj.Query.Params[0]\n\n\t\tcond.Reducer = reducer(cj.Reducer.Type)\n\t\tif !cond.Reducer.ValidReduceFunc() {\n\t\t\treturn nil, fmt.Errorf(\"invalid reducer '%v' in condition %v\", cond.Reducer, i+1)\n\t\t}\n\n\t\tcond.Evaluator, err = newAlertEvaluator(cj.Evaluator)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tc.Conditions = append(c.Conditions, cond)\n\t}\n\n\treturn c, nil\n}", "func NewCommand(cmd uint32, count int) Command {\n\treturn Command((cmd & 0x7) | (uint32(count) << 3))\n}", "func (o BucketLifecycleRuleOutput) Condition() BucketLifecycleRuleConditionOutput {\n\treturn o.ApplyT(func(v BucketLifecycleRule) BucketLifecycleRuleCondition { return v.Condition }).(BucketLifecycleRuleConditionOutput)\n}" ]
[ "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.5519888", "0.5518471", "0.55175936", "0.5511925", "0.5511925", "0.5511925", "0.5511925", "0.5511925", "0.5511925", "0.5511925", "0.5511925", "0.5511925", "0.5511925", "0.5511925", "0.5511925", "0.546346", "0.5392746", "0.53771675", "0.53649276", "0.53646046", "0.5356542", "0.53348017", "0.53326017", "0.53256726", "0.53014606", "0.5291489", "0.52906334", "0.5281019", "0.5275326", "0.5274393", "0.52689165", "0.52574474", "0.5235039", "0.52182317", "0.52164704", "0.521638", "0.52087396", "0.52041227", "0.52026296", "0.5176977", "0.5174522", "0.5170831", "0.51609766", "0.5156645", "0.51562005", "0.5155679", "0.5155451", "0.5148444", "0.5145216", "0.5141264", "0.51411396", "0.51345146", "0.5118133", "0.5113076", "0.5092448", "0.5090607", "0.50842124", "0.50775546", "0.5076771", "0.50704336", "0.5062909", "0.5054235", "0.5044121", "0.5043614", "0.50402135", "0.5039861", "0.5021132", "0.501348", "0.50111383", "0.5008756", "0.5006213", "0.500195", "0.500195", "0.500195", "0.500195", "0.500195", "0.49962622", "0.49921212", "0.4988537" ]
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.Errorf(\"Flag '%s' already exists \", flag.Short))\n\t}\n\tc.innerFlagsLong[flag.Long] = flag\n\tc.orderedFlags = append(c.orderedFlags, flag)\n\tif flag.Short != \"\" {\n\t\tc.innerFlagsShort[flag.Short] = flag\n\t}\n\n}", "func addEnvironmentFlag(cmd *cobra.Command) {\n\tcmd.Flags().StringArrayVarP(&environment, \"env\", \"e\", []string{}, \"environment variables to pass to container\")\n}", "func (p *PullCommand) addFlags() {\n\t// TODO: add flags here\n}", "func (PingCIMunger) AddFlags(cmd *cobra.Command, config *github_util.Config) {}", "func (s *BasePCREListener) EnterOption_flag(ctx *Option_flagContext) {}", "func (app *exitBuilder) WithCondition(cond string) ExitBuilder {\n\tapp.condition = cond\n\treturn app\n}", "func AddCommand(parentCmd, cmd *cobra.Command, envPrefix string) (*viper.Viper, *Flagger) {\n\tparentCmd.AddCommand(cmd)\n\tcfg := InitConfig(envPrefix)\n\treturn cfg, NewFlagger(cmd, cfg)\n}", "func (p *PublisherMunger) AddFlags(cmd *cobra.Command, config *github.Config) {}", "func AddConfFlag(c *cobra.Command) {\n\tc.PersistentFlags().StringP(\"conf\", \"c\", \"\", \"configuration file to use\")\n}", "func (gatewayUpdate *GatewayConditionsUpdate) AddCondition(cond gatewayapi_v1alpha1.GatewayConditionType, status metav1.ConditionStatus, reason GatewayReasonType, message string) metav1.Condition {\n\n\tif c, ok := gatewayUpdate.Conditions[cond]; ok {\n\t\tmessage = fmt.Sprintf(\"%s, %s\", c.Message, message)\n\t}\n\n\tnewCond := metav1.Condition{\n\t\tReason: string(reason),\n\t\tStatus: status,\n\t\tType: string(cond),\n\t\tMessage: message,\n\t\tLastTransitionTime: metav1.NewTime(clock.Now()),\n\t\tObservedGeneration: gatewayUpdate.Generation,\n\t}\n\tgatewayUpdate.Conditions[cond] = newCond\n\treturn newCond\n}", "func (PickMustHaveMilestone) AddFlags(cmd *cobra.Command, config *github.Config) {}", "func AddRakkessFlags(cmd *cobra.Command) {\n\tcmd.Flags().StringSliceVar(&opts.Verbs, constants.FlagVerbs, []string{\"list\", \"create\", \"update\", \"delete\"}, fmt.Sprintf(\"show access for verbs out of (%s)\", strings.Join(constants.ValidVerbs, \", \")))\n\tcmd.Flags().StringVarP(&opts.OutputFormat, constants.FlagOutput, \"o\", \"icon-table\", fmt.Sprintf(\"output format out of (%s)\", strings.Join(constants.ValidOutputFormats, \", \")))\n\tcmd.Flags().StringSliceVar(&diffWith, constants.FlagDiffWith, nil, \"Show diff for modified call. For example --diff-with=namespace=kube-system.\")\n\n\topts.ConfigFlags.AddFlags(cmd.Flags())\n}", "func (cc *BackupCommand) addFlags() {\n\tflagSet := cc.cmd.Flags()\n\thome, _ := homedir.Dir()\n\tbackPath := filepath.Join(home, \".mysshbackup\")\n\tflagSet.StringVarP(&cc.backupPath, \"path\", \"p\", backPath, \"backup path\")\n\n}", "func AddKubeconfigFlag(cfg *Kubeconfig, cmd *cobra.Command) {\n\t// The default is the empty string (look in the environment)\n\tcmd.PersistentFlags().Var(cfg, \"kubeconfig\", \"Explict kubeconfig file\")\n\tcmd.MarkFlagFilename(\"kubeconfig\")\n}", "func AddFlags(cmd *cobra.Command) {\n\tcmd.Flags().BoolVarP(&quiet, \"quiet\", \"q\", false, \"Suppress output to stderr.\")\n}", "func (d *DeploymentComponent) AddNotifyCond(version string) <-chan struct{} {\n\td.notifyChsMu.Lock()\n\tdefer d.notifyChsMu.Unlock()\n\tif d.notifyChs[version] == nil {\n\t\td.notifyChs[version] = make(map[chan<- struct{}]bool)\n\t}\n\tch := make(chan struct{}, 1)\n\td.notifyChs[version][ch] = true\n\tif d.version == version {\n\t\tch <- struct{}{}\n\t}\n\treturn ch\n}", "func AddFlags(cmd *cobra.Command) {\n\tcmd.Flags().String(\"log-level\", \"info\", \"The log-level for the operator. Possible values: trace, debug, info, warning, error, fatal, panic\")\n\tcmd.Flags().String(\"jaeger-version\", version.DefaultJaeger(), \"Deprecated: the Jaeger version is now managed entirely by the operator. This option is currently no-op.\")\n\tcmd.Flags().String(\"jaeger-agent-image\", \"jaegertracing/jaeger-agent\", \"The Docker image for the Jaeger Agent\")\n\tcmd.Flags().String(\"jaeger-query-image\", \"jaegertracing/jaeger-query\", \"The Docker image for the Jaeger Query\")\n\tcmd.Flags().String(\"jaeger-collector-image\", \"jaegertracing/jaeger-collector\", \"The Docker image for the Jaeger Collector\")\n\tcmd.Flags().String(\"jaeger-ingester-image\", \"jaegertracing/jaeger-ingester\", \"The Docker image for the Jaeger Ingester\")\n\tcmd.Flags().String(\"jaeger-all-in-one-image\", \"jaegertracing/all-in-one\", \"The Docker image for the Jaeger all-in-one\")\n\tcmd.Flags().String(\"jaeger-cassandra-schema-image\", \"jaegertracing/jaeger-cassandra-schema\", \"The Docker image for the Jaeger Cassandra Schema\")\n\tcmd.Flags().String(\"jaeger-spark-dependencies-image\", \"ghcr.io/jaegertracing/spark-dependencies/spark-dependencies\", \"The Docker image for the Spark Dependencies Job\")\n\tcmd.Flags().String(\"jaeger-es-index-cleaner-image\", \"jaegertracing/jaeger-es-index-cleaner\", \"The Docker image for the Jaeger Elasticsearch Index Cleaner\")\n\tcmd.Flags().String(\"jaeger-es-rollover-image\", \"jaegertracing/jaeger-es-rollover\", \"The Docker image for the Jaeger Elasticsearch Rollover\")\n\tcmd.Flags().String(\"openshift-oauth-proxy-image\", \"quay.io/openshift/origin-oauth-proxy:4.12\", \"The Docker image location definition for the OpenShift OAuth Proxy\")\n\tcmd.Flags().String(\"openshift-oauth-proxy-imagestream-ns\", \"\", \"The namespace for the OpenShift OAuth Proxy imagestream\")\n\tcmd.Flags().String(\"openshift-oauth-proxy-imagestream-name\", \"\", \"The name for the OpenShift OAuth Proxy imagestream\")\n\tcmd.Flags().String(\"platform\", v1.FlagPlatformAutoDetect, \"The target platform the operator will run. Possible values: 'kubernetes', 'openshift', 'auto-detect'\")\n\tcmd.Flags().String(\"es-provision\", v1.FlagProvisionElasticsearchAuto, \"Whether to auto-provision an Elasticsearch cluster for suitable Jaeger instances. Possible values: 'yes', 'no', 'auto'. When set to 'auto' and the API name 'logging.openshift.io' is available, auto-provisioning is enabled.\")\n\tcmd.Flags().String(\"kafka-provision\", \"auto\", \"Whether to auto-provision a Kafka cluster for suitable Jaeger instances. Possible values: 'yes', 'no', 'auto'. When set to 'auto' and the API name 'kafka.strimzi.io' is available, auto-provisioning is enabled.\")\n\tcmd.Flags().Bool(\"kafka-provisioning-minimal\", false, \"(unsupported) Whether to provision Kafka clusters with minimal requirements, suitable for demos and tests.\")\n\tcmd.Flags().String(\"secure-listen-address\", \"\", \"\")\n\tcmd.Flags().String(\"health-probe-bind-address\", \":8081\", \"The address the probe endpoint binds to.\")\n\tcmd.Flags().Int(\"webhook-bind-port\", 9443, \"The address webhooks expose.\")\n\tcmd.Flags().String(\"tls-min-version\", \"VersionTLS12\", \"Minimum TLS version supported. Value must match version names from https://golang.org/pkg/crypto/tls/#pkg-constants.\")\n\tcmd.Flags().StringSlice(\"tls-cipher-suites\", nil, \"Comma-separated list of cipher suites for the server. Values are from tls package constants (https://golang.org/pkg/crypto/tls/#pkg-constants). If omitted, the default Go cipher suites will be used\")\n\tcmd.Flags().Bool(\"leader-elect\", false, \"Enable leader election for controller manager. \"+\n\t\t\"Enabling this will ensure there is only one active controller manager.\")\n\n\tdocURL := fmt.Sprintf(\"https://www.jaegertracing.io/docs/%s\", version.DefaultJaegerMajorMinor())\n\tcmd.Flags().String(\"documentation-url\", docURL, \"The URL for the 'Documentation' menu item\")\n}", "func (*SigMentionHandler) AddFlags(cmd *cobra.Command, config *github.Config) {}", "func (o *unsafeCommonOptions) addFlags(cmd *cobra.Command) {\n\tcmd.PersistentFlags().BoolVar(&o.noConfirm, \"no-confirm\", false, \"Don't ask user whether to confirm executing meta command\")\n}", "func (s *BasePCREListener) ExitOption_flag(ctx *Option_flagContext) {}", "func NewAlertSettingConditionGroupCommand() *cobra.Command {\n\trootSub := &cobra.Command{\n\t\tUse: \"condition\",\n\t\tShort: \"Manage alert setting's condition\",\n\t\tExample: `alert setting condition delete --alert=1001 --condition=\"28bbad2b-69bb-4c01-8e37-28e2e7083aa9\"`,\n\t\tTraverseChildren: true,\n\t\tSilenceErrors: true,\n\t}\n\n\trootSub.AddCommand(NewCreateOrUpdateAlertSettingConditionCommand())\n\trootSub.AddCommand(NewDeleteAlertSettingConditionCommand())\n\n\treturn rootSub\n}", "func AddSonobuoyConfigFlag(cfg *SonobuoyConfig, cmd *cobra.Command) {\n\tcmd.PersistentFlags().Var(\n\t\tcfg, \"config\",\n\t\t\"path to a sonobuoy configuration JSON file. Overrides --mode\",\n\t)\n\tcmd.MarkFlagFilename(\"config\", \"json\")\n}", "func (o *Options) AddFlags(cmd *cobra.Command) {\n\to.cmd = cmd\n\n\tcompletionCommand.SetHelpFunc(func(cmd *cobra.Command, args []string) {\n\t\tif shellPath, ok := os.LookupEnv(\"SHELL\"); ok {\n\t\t\tshell := shellPath[strings.LastIndex(shellPath, \"/\")+1:]\n\t\t\tfmt.Println(FetchLoadInstructions(shell))\n\t\t} else {\n\t\t\tfmt.Println(\"SHELL environment variable not set, falling back to bash\")\n\t\t\tfmt.Println(FetchLoadInstructions(\"bash\"))\n\t\t}\n\t\tklog.FlushAndExit(klog.ExitFlushTimeout, 0)\n\t})\n\n\tversionCommand := &cobra.Command{\n\t\tUse: \"version\",\n\t\tShort: \"Print version information.\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tfmt.Printf(\"%s\\n\", version.Print(\"kube-state-metrics\"))\n\t\t\tklog.FlushAndExit(klog.ExitFlushTimeout, 0)\n\t\t},\n\t}\n\n\tcmd.AddCommand(completionCommand, versionCommand)\n\n\to.cmd.Flags().Usage = func() {\n\t\t_, _ = fmt.Fprintf(os.Stderr, \"Usage of %s:\\n\", os.Args[0])\n\t\to.cmd.Flags().PrintDefaults()\n\t}\n\n\tklogFlags := flag.NewFlagSet(\"klog\", flag.ExitOnError)\n\tklog.InitFlags(klogFlags)\n\to.cmd.Flags().AddGoFlagSet(klogFlags)\n\t_ = o.cmd.Flags().Lookup(\"logtostderr\").Value.Set(\"true\")\n\to.cmd.Flags().Lookup(\"logtostderr\").DefValue = \"true\"\n\to.cmd.Flags().Lookup(\"logtostderr\").NoOptDefVal = \"true\"\n\n\tautoshardingNotice := \"When set, it is expected that --pod and --pod-namespace are both set. Most likely this should be passed via the downward API. This is used for auto-detecting sharding. If set, this has preference over statically configured sharding. This is experimental, it may be removed without notice.\"\n\n\to.cmd.Flags().BoolVar(&o.CustomResourcesOnly, \"custom-resource-state-only\", false, \"Only provide Custom Resource State metrics (experimental)\")\n\to.cmd.Flags().BoolVar(&o.EnableGZIPEncoding, \"enable-gzip-encoding\", false, \"Gzip responses when requested by clients via 'Accept-Encoding: gzip' header.\")\n\to.cmd.Flags().BoolVarP(&o.Help, \"help\", \"h\", false, \"Print Help text\")\n\to.cmd.Flags().BoolVarP(&o.UseAPIServerCache, \"use-apiserver-cache\", \"\", false, \"Sets resourceVersion=0 for ListWatch requests, using cached resources from the apiserver instead of an etcd quorum read.\")\n\to.cmd.Flags().Int32Var(&o.Shard, \"shard\", int32(0), \"The instances shard nominal (zero indexed) within the total number of shards. (default 0)\")\n\to.cmd.Flags().IntVar(&o.Port, \"port\", 8080, `Port to expose metrics on.`)\n\to.cmd.Flags().IntVar(&o.TelemetryPort, \"telemetry-port\", 8081, `Port to expose kube-state-metrics self metrics on.`)\n\to.cmd.Flags().IntVar(&o.TotalShards, \"total-shards\", 1, \"The total number of shards. Sharding is disabled when total shards is set to 1.\")\n\to.cmd.Flags().StringVar(&o.Apiserver, \"apiserver\", \"\", `The URL of the apiserver to use as a master`)\n\to.cmd.Flags().StringVar(&o.CustomResourceConfig, \"custom-resource-state-config\", \"\", \"Inline Custom Resource State Metrics config YAML (experimental)\")\n\to.cmd.Flags().StringVar(&o.CustomResourceConfigFile, \"custom-resource-state-config-file\", \"\", \"Path to a Custom Resource State Metrics config file (experimental)\")\n\to.cmd.Flags().StringVar(&o.Host, \"host\", \"::\", `Host to expose metrics on.`)\n\to.cmd.Flags().StringVar(&o.Kubeconfig, \"kubeconfig\", \"\", \"Absolute path to the kubeconfig file\")\n\to.cmd.Flags().StringVar(&o.Namespace, \"pod-namespace\", \"\", \"Name of the namespace of the pod specified by --pod. \"+autoshardingNotice)\n\to.cmd.Flags().StringVar(&o.Pod, \"pod\", \"\", \"Name of the pod that contains the kube-state-metrics container. \"+autoshardingNotice)\n\to.cmd.Flags().StringVar(&o.TLSConfig, \"tls-config\", \"\", \"Path to the TLS configuration file\")\n\to.cmd.Flags().StringVar(&o.TelemetryHost, \"telemetry-host\", \"::\", `Host to expose kube-state-metrics self metrics on.`)\n\to.cmd.Flags().StringVar(&o.Config, \"config\", \"\", \"Path to the kube-state-metrics options config file\")\n\to.cmd.Flags().StringVar((*string)(&o.Node), \"node\", \"\", \"Name of the node that contains the kube-state-metrics pod. Most likely it should be passed via the downward API. This is used for daemonset sharding. Only available for resources (pod metrics) that support spec.nodeName fieldSelector. This is experimental.\")\n\to.cmd.Flags().Var(&o.AnnotationsAllowList, \"metric-annotations-allowlist\", \"Comma-separated list of Kubernetes annotations keys that will be used in the resource' labels metric. By default the metric contains only name and namespace labels. To include additional annotations provide a list of resource names in their plural form and Kubernetes annotation keys you would like to allow for them (Example: '=namespaces=[kubernetes.io/team,...],pods=[kubernetes.io/team],...)'. A single '*' can be provided per resource instead to allow any annotations, but that has severe performance implications (Example: '=pods=[*]').\")\n\to.cmd.Flags().Var(&o.LabelsAllowList, \"metric-labels-allowlist\", \"Comma-separated list of additional Kubernetes label keys that will be used in the resource' labels metric. By default the metric contains only name and namespace labels. To include additional labels provide a list of resource names in their plural form and Kubernetes label keys you would like to allow for them (Example: '=namespaces=[k8s-label-1,k8s-label-n,...],pods=[app],...)'. A single '*' can be provided per resource instead to allow any labels, but that has severe performance implications (Example: '=pods=[*]'). Additionally, an asterisk (*) can be provided as a key, which will resolve to all resources, i.e., assuming '--resources=deployments,pods', '=*=[*]' will resolve to '=deployments=[*],pods=[*]'.\")\n\to.cmd.Flags().Var(&o.MetricAllowlist, \"metric-allowlist\", \"Comma-separated list of metrics to be exposed. This list comprises of exact metric names and/or regex patterns. The allowlist and denylist are mutually exclusive.\")\n\to.cmd.Flags().Var(&o.MetricDenylist, \"metric-denylist\", \"Comma-separated list of metrics not to be enabled. This list comprises of exact metric names and/or regex patterns. The allowlist and denylist are mutually exclusive.\")\n\to.cmd.Flags().Var(&o.MetricOptInList, \"metric-opt-in-list\", \"Comma-separated list of metrics which are opt-in and not enabled by default. This is in addition to the metric allow- and denylists\")\n\to.cmd.Flags().Var(&o.Namespaces, \"namespaces\", fmt.Sprintf(\"Comma-separated list of namespaces to be enabled. Defaults to %q\", &DefaultNamespaces))\n\to.cmd.Flags().Var(&o.NamespacesDenylist, \"namespaces-denylist\", \"Comma-separated list of namespaces not to be enabled. If namespaces and namespaces-denylist are both set, only namespaces that are excluded in namespaces-denylist will be used.\")\n\to.cmd.Flags().Var(&o.Resources, \"resources\", fmt.Sprintf(\"Comma-separated list of Resources to be enabled. Defaults to %q\", &DefaultResources))\n}", "func (gfc *GoldenFileCfg) AddUpdateFlag() {\n\tif gfc.updFlagAdded {\n\t\treturn\n\t}\n\n\tgfGlob := gfc.PathName(\"*\")\n\tif gfc.UpdFlagName == \"\" {\n\t\tpanic(errors.New(\n\t\t\t\"AddUpdateFlag has been called for files in \" + gfGlob +\n\t\t\t\t\" but the GoldenFileCfg has no flag name set\"))\n\t}\n\n\tflag.BoolVar(&gfc.updFlag, gfc.UpdFlagName, false,\n\t\t\"set this flag to update the golden files in \"+gfGlob)\n\n\tgfc.updFlagAdded = true\n}", "func NewCreateOrUpdateAlertSettingConditionCommand() *cobra.Command {\n\tvar conds SettingConditionPayloads\n\tvar cond SettingConditionPayload\n\n\tcmd := &cobra.Command{\n\t\tUse: \"set\",\n\t\tAliases: []string{\"create\", \"update\"},\n\t\tShort: \"Create or Update an alert setting's condition or load from file\",\n\t\tExample: `alert setting condition set --alert=1001 --condition=\"lag >= 100000 or alert setting condition set ./alert_cond.yml`,\n\t\tTraverseChildren: true,\n\t\tSilenceErrors: true,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\n\t\t\tif len(conds.Conditions) > 0 {\n\t\t\t\talertID := conds.AlertID\n\t\t\t\tfor _, condition := range conds.Conditions {\n\t\t\t\t\terr := config.Client.CreateOrUpdateAlertSettingCondition(alertID, condition)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tgolog.Errorf(\"Failed to creating/updating alert setting condition [%s]. [%s]\", condition, err.Error())\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tbite.PrintInfo(cmd, \"Condition [%s] added\", condition)\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tfmt.Print(cond)\n\t\t\tif err := bite.CheckRequiredFlags(cmd, bite.FlagPair{\"alert\": cond.AlertID, \"condition\": cond.Condition}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\terr := config.Client.CreateOrUpdateAlertSettingCondition(cond.AlertID, cond.Condition)\n\t\t\tif err != nil {\n\t\t\t\tgolog.Errorf(\"Failed to creating/updating alert setting condition [%s]. [%s]\", cond.Condition, err.Error())\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn bite.PrintInfo(cmd, \"Condition [%s] added\", cond.Condition)\n\t\t},\n\t}\n\n\tcmd.Flags().IntVar(&cond.AlertID, \"alert\", 0, \"Alert ID\")\n\tcmd.Flags().StringVar(&cond.Condition, \"condition\", \"\", `Alert condition .e.g. \"lag >= 100000 on group group and topic topicA\"`)\n\n\tbite.CanBeSilent(cmd)\n\n\tbite.Prepend(cmd, bite.FileBind(&cond))\n\tbite.Prepend(cmd, bite.FileBind(&conds))\n\n\treturn cmd\n}", "func (c *Command) addArgument(arg interface{}) {\n\tc.Arguments = append(c.Arguments, arg)\n}", "func (self Flags) AddIf(flag Flags, condition bool) Flags {\n\tif condition {\n\t\treturn self | flag\n\t} else {\n\t\treturn self\n\t}\n}", "func Branch(name string) func(*types.Cmd) {\n\treturn func(g *types.Cmd) {\n\t\tg.AddOptions(name)\n\t}\n}", "func AddCommand(c *cobra.Command, globalOptions *options.Options) {\n\tc.AddCommand(cmd)\n\tgopts = globalOptions\n}", "func registerSubcommand(name, desc string, do subcommandFunc) *subcommand {\n\tc := &subcommand{\n\t\tname: name,\n\t\tdesc: desc,\n\t\tflags: flag.NewFlagSet(name, flag.ExitOnError),\n\t\tdo: do,\n\t}\n\t// define flags that are common to all subcommands\n\tc.flags.BoolVar(&quiet, \"quiet\", false, \"minimize output messages\")\n\tsubcommands[name] = c\n\treturn c\n}", "func versionFlag(cmd *cobra.Command) {\n\tversion, err := cmd.Flags().GetBool(\"version\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\tif version {\n\t\tfmt.Printf(\"\\nversion: %s\\n\\nbuild: %s\\n\\n\",\n\t\t\tbuildVersion, buildDate)\n\t\tos.Exit(0)\n\t}\n}", "func (i *ImageInspectCommand) addFlags() {\n\ti.cmd.Flags().StringVarP(&i.format, \"format\", \"f\", \"\", \"Format the output using the given go template\")\n}", "func (q *BasicQuery) AddCond(p string, v interface{}) Query {\n\tq.Conds.Add(p, v)\n\treturn q\n}", "func cmdAdd(mainArgs []string) error {\n\tadd := flag.NewFlagSet(\"add\", flag.ExitOnError)\n\tname := add.Bool(\"n\", false, commentAddName)\n\tday := add.String(\"d\", \"t\", commentAddDay)\n\tadd.Parse(mainArgs[1:])\n\targs := add.Args()\n\tif len(args) < 1 {\n\t\treturn errors.New(notEnoughSubCmdArgsError)\n\t}\n\tnewTask := Task{}\n\tvar c *Favorite\n\tvar err error\n\tif *name {\n\t\tc, err = getFavoriteByName(args[0])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif c != nil {\n\t\tnewTask.Name = c.Name\n\t\tnewTask.Content = c.Content\n\t\tnewTask.IsFin = false\n\t} else {\n\t\tnewTask.Name = \"\"\n\t\tnewTask.Content = strings.Join(args, \" \")\n\t\tnewTask.IsFin = false\n\t}\n\treturn addTask(&newTask, *day)\n}", "func (p *Package) AddOption(t *GlobalOption) {\n\tp.options = append(p.options, t)\n}", "func AddDeploymentFlag(cmd *cobra.Command) *string {\n\tv := \"\"\n\tcmd.Flags().StringVar(&v, \"deployment\", DefaultIngressDeploymentName, \"The name of the ingress-nginx deployment\")\n\treturn &v\n}", "func (ctl *CRSpecBuilderFromCobraFlags) AddCRSpecFlagsToCommand(cmd *cobra.Command, master bool) {\n\tif master {\n\t\tcmd.Flags().StringVar(&ctl.PvcStorageClass, \"pvc-storage-class\", ctl.PvcStorageClass, \"Name of Storage Class for the PVC\")\n\t\tcmd.Flags().StringVar(&ctl.PersistentStorage, \"persistent-storage\", ctl.PersistentStorage, \"If true, Black Duck has persistent storage [true|false]\")\n\t\tcmd.Flags().StringVar(&ctl.PVCFilePath, \"pvc-file-path\", ctl.PVCFilePath, \"Absolute path to a file containing a list of PVC json structs\")\n\t}\n\tcmd.Flags().StringVar(&ctl.Size, \"size\", ctl.Size, \"Size of Black Duck [small|medium|large|x-large]\")\n\tcmd.Flags().StringVar(&ctl.Version, \"version\", ctl.Version, \"Version of Black Duck\")\n\tif master {\n\t\tcmd.Flags().StringVar(&ctl.ExposeService, \"expose-ui\", util.NONE, \"Service type of Black Duck webserver's user interface [NODEPORT|LOADBALANCER|OPENSHIFT|NONE]\")\n\t} else {\n\t\tcmd.Flags().StringVar(&ctl.ExposeService, \"expose-ui\", ctl.ExposeService, \"Service type of Black Duck webserver's user interface [NODEPORT|LOADBALANCER|OPENSHIFT|NONE]\")\n\t}\n\tif !strings.Contains(cmd.CommandPath(), \"native\") {\n\t\tcmd.Flags().StringVar(&ctl.DbPrototype, \"db-prototype\", ctl.DbPrototype, \"Black Duck name to clone the database\")\n\t}\n\tcmd.Flags().StringVar(&ctl.ExternalPostgresHost, \"external-postgres-host\", ctl.ExternalPostgresHost, \"Host of external Postgres\")\n\tcmd.Flags().IntVar(&ctl.ExternalPostgresPort, \"external-postgres-port\", ctl.ExternalPostgresPort, \"Port of external Postgres\")\n\tcmd.Flags().StringVar(&ctl.ExternalPostgresAdmin, \"external-postgres-admin\", ctl.ExternalPostgresAdmin, \"Name of 'admin' of external Postgres database\")\n\tcmd.Flags().StringVar(&ctl.ExternalPostgresUser, \"external-postgres-user\", ctl.ExternalPostgresUser, \"Name of 'user' of external Postgres database\")\n\tcmd.Flags().StringVar(&ctl.ExternalPostgresSsl, \"external-postgres-ssl\", ctl.ExternalPostgresSsl, \"If true, Black Duck uses SSL for external Postgres connection [true|false]\")\n\tcmd.Flags().StringVar(&ctl.ExternalPostgresAdminPassword, \"external-postgres-admin-password\", ctl.ExternalPostgresAdminPassword, \"'admin' password of external Postgres database\")\n\tcmd.Flags().StringVar(&ctl.ExternalPostgresUserPassword, \"external-postgres-user-password\", ctl.ExternalPostgresUserPassword, \"'user' password of external Postgres database\")\n\tcmd.Flags().StringVar(&ctl.LivenessProbes, \"liveness-probes\", ctl.LivenessProbes, \"If true, Black Duck uses liveness probes [true|false]\")\n\tcmd.Flags().StringVar(&ctl.PostgresClaimSize, \"postgres-claim-size\", ctl.PostgresClaimSize, \"Size of the blackduck-postgres PVC\")\n\tcmd.Flags().StringVar(&ctl.CertificateName, \"certificate-name\", ctl.CertificateName, \"Name of Black Duck nginx certificate\")\n\tcmd.Flags().StringVar(&ctl.CertificateFilePath, \"certificate-file-path\", ctl.CertificateFilePath, \"Absolute path to a file for the Black Duck nginx certificate\")\n\tcmd.Flags().StringVar(&ctl.CertificateKeyFilePath, \"certificate-key-file-path\", ctl.CertificateKeyFilePath, \"Absolute path to a file for the Black Duck nginx certificate key\")\n\tcmd.Flags().StringVar(&ctl.ProxyCertificateFilePath, \"proxy-certificate-file-path\", ctl.ProxyCertificateFilePath, \"Absolute path to a file for the Black Duck proxy server’s Certificate Authority (CA)\")\n\tcmd.Flags().StringVar(&ctl.AuthCustomCAFilePath, \"auth-custom-ca-file-path\", ctl.AuthCustomCAFilePath, \"Absolute path to a file for the Custom Auth CA for Black Duck\")\n\tif !strings.Contains(cmd.CommandPath(), \"native\") {\n\t\tcmd.Flags().StringVar(&ctl.Type, \"type\", ctl.Type, \"Type of Black Duck\")\n\t}\n\tcmd.Flags().StringVar(&ctl.DesiredState, \"desired-state\", ctl.DesiredState, \"Desired state of Black Duck\")\n\tif !strings.Contains(cmd.CommandPath(), \"native\") {\n\t\tcmd.Flags().BoolVar(&ctl.MigrationMode, \"migration-mode\", ctl.MigrationMode, \"Create Black Duck in the database-migration state\")\n\t}\n\tcmd.Flags().StringSliceVar(&ctl.Environs, \"environs\", ctl.Environs, \"List of environment variables (NAME:VALUE,NAME:VALUE)\")\n\tcmd.Flags().StringSliceVar(&ctl.ImageRegistries, \"image-registries\", ctl.ImageRegistries, \"List of image registries\")\n\tif !strings.Contains(cmd.CommandPath(), \"native\") {\n\t\tcmd.Flags().StringVar(&ctl.LicenseKey, \"license-key\", ctl.LicenseKey, \"License Key of Black Duck\")\n\t}\n\tcmd.Flags().StringVar(&ctl.AdminPassword, \"admin-password\", ctl.AdminPassword, \"'admin' password of Postgres database\")\n\tcmd.Flags().StringVar(&ctl.PostgresPassword, \"postgres-password\", ctl.PostgresPassword, \"'postgres' password of Postgres database\")\n\tcmd.Flags().StringVar(&ctl.UserPassword, \"user-password\", ctl.UserPassword, \"'user' password of Postgres database\")\n\tcmd.Flags().BoolVar(&ctl.EnableBinaryAnalysis, \"enable-binary-analysis\", ctl.EnableBinaryAnalysis, \"If true, enable binary analysis by setting the environment variable (this takes priority over environs flag values)\")\n\tcmd.Flags().BoolVar(&ctl.EnableSourceCodeUpload, \"enable-source-code-upload\", ctl.EnableSourceCodeUpload, \"If true, enable source code upload by setting the environment variable (this takes priority over environs flag values)\")\n\tcmd.Flags().StringVar(&ctl.NodeAffinityFilePath, \"node-affinity-file-path\", ctl.NodeAffinityFilePath, \"Absolute path to a file containing a list of node affinities\")\n\tcmd.Flags().StringVar(&ctl.SecurityContextFilePath, \"security-context-file-path\", ctl.SecurityContextFilePath, \"Absolute path to a file containing a map of pod names to security contexts runAsUser, fsGroup, and runAsGroup\")\n\tcmd.Flags().StringVar(&ctl.Registry, \"registry\", ctl.Registry, \"Name of the registry to use for images e.g. docker.io/blackducksoftware\")\n\tcmd.Flags().StringSliceVar(&ctl.PullSecrets, \"pull-secret-name\", ctl.PullSecrets, \"Only if the registry requires authentication\")\n\tif master {\n\t\tcmd.Flags().StringVar(&ctl.SealKey, \"seal-key\", ctl.SealKey, \"Seal key to encrypt the master key when Source code upload is enabled and it should be of length 32\")\n\t}\n\t// TODO: Remove this flag in next release\n\tcmd.Flags().MarkDeprecated(\"desired-state\", \"desired-state flag is deprecated and will be removed by the next release\")\n}", "func Cond(apply bool, options ...types.Option) types.Option {\n\tif apply {\n\t\treturn func(g *types.Cmd) {\n\t\t\tg.ApplyOptions(options...)\n\t\t}\n\t}\n\treturn NoOp\n}", "func HaveCondition(condType interface{}, status corev1.ConditionStatus) gomegatypes.GomegaMatcher {\n\treturn PointTo(MatchFields(IgnoreExtras, Fields{\n\t\t\"Status\": MatchFields(IgnoreExtras, Fields{\n\t\t\t\"Conditions\": ContainElement(MatchFields(IgnoreExtras, Fields{\n\t\t\t\t\"Type\": Equal(condType),\n\t\t\t\t\"Status\": Equal(status),\n\t\t\t})),\n\t\t}),\n\t}))\n}", "func (s *BasePCREListener) EnterOption_flags(ctx *Option_flagsContext) {}", "func AddFlagsVar(a *kingpin.Application, config *Config) {\n\ta.Flag(LevelFlagName, LevelFlagHelp).\n\t\tEnvar(LevelFlagEnvar).\n\t\tDefault(\"info\").\n\t\tSetValue(&config.Level)\n\ta.Flag(FormatFlagName, FormatFlagHelp).\n\t\tEnvar(FormatFlagEnvar).\n\t\tDefault(\"console\").\n\t\tSetValue(&config.Format)\n}", "func (i *SinkFlags) Add(cmd *cobra.Command) {\n\ti.AddWithFlagName(cmd, \"sink\", \"s\")\n}", "func AddModeFlag(mode *ops.Mode, cmd *cobra.Command) {\n\t*mode = ops.Conformance // default\n\tcmd.PersistentFlags().Var(\n\t\tmode, \"mode\",\n\t\tfmt.Sprintf(\"What mode to run sonobuoy in. [%s]\", strings.Join(ops.GetModes(), \", \")),\n\t)\n}", "func (n *NetworkRemoveCommand) addFlags() {\n\t//TODO add flags\n}", "func Flag(discord *discordgo.Session, message *discordgo.MessageCreate) {\r\n\tif message.ChannelID == channelid {\r\n\t\tif message.Content == (commandPrefix + \"flag\") {\r\n\t\t\t_, err := discord.ChannelMessageSend(message.ChannelID, \"Support Turned back On\")\r\n\t\t\tif err != nil {\r\n\t\t\t\ttools.Log.WithField(\"Error\", err).Warn(\"Unusual Error\")\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t\tflag = 0\r\n\t\t}\r\n\t}\r\n}", "func AddKubeContextFlag(set *pflag.FlagSet, KubeContext *string) {\n\tset.StringVarP(KubeContext, \"kube-context\", \"\", \"\", \"kube context to use when interacting with kubernetes\")\n}", "func (*bzlLibraryLang) RegisterFlags(fs *flag.FlagSet, cmd string, c *config.Config) {}", "func addIncludeScopeFlag(cmd *cobra.Command) {\n\tcmd.Flags().BoolVar(&includeScope, \"include-scope\", false, \"include the scope in the output\")\n}", "func (ctl *Ctl) AddSpecFlags(cmd *cobra.Command, master bool) {\n\tcmd.Flags().StringVar(&ctl.Version, \"version\", ctl.Version, \"Version of the Alert\")\n\tcmd.Flags().StringVar(&ctl.AlertImage, \"alert-image\", ctl.AlertImage, \"Url of the Alert Image\")\n\tcmd.Flags().StringVar(&ctl.CfsslImage, \"cfssl-image\", ctl.CfsslImage, \"Url of Cfssl Image\")\n\tcmd.Flags().BoolVar(&ctl.StandAlone, \"stand-alone\", ctl.StandAlone, \"Enable Stand Alone mode\")\n\tcmd.Flags().StringVar(&ctl.ExposeService, \"expose-service\", ctl.ExposeService, \"Type of Service to Expose\")\n\tcmd.Flags().IntVar(&ctl.Port, \"port\", ctl.Port, \"Port for Alert\")\n\tcmd.Flags().StringVar(&ctl.EncryptionPassword, \"encryption-password\", ctl.EncryptionPassword, \"Encryption Password for the Alert\")\n\tcmd.Flags().StringVar(&ctl.EncryptionGlobalSalt, \"encryption-global-salt\", ctl.EncryptionGlobalSalt, \"Encryption Global Salt for the Alert\")\n\tcmd.Flags().StringSliceVar(&ctl.Environs, \"environs\", ctl.Environs, \"Environment variables for the Alert\")\n\tcmd.Flags().BoolVar(&ctl.PersistentStorage, \"persistent-storage\", ctl.PersistentStorage, \"Enable persistent storage\")\n\tcmd.Flags().StringVar(&ctl.PVCName, \"pvc-name\", ctl.PVCName, \"Name for the PVC\")\n\tcmd.Flags().StringVar(&ctl.PVCStorageClass, \"pvc-storage-class\", ctl.PVCStorageClass, \"StorageClass for the PVC\")\n\tcmd.Flags().StringVar(&ctl.PVCSize, \"pvc-size\", ctl.PVCSize, \"Memory allocation for the PVC\")\n\tcmd.Flags().StringVar(&ctl.AlertMemory, \"alert-memory\", ctl.AlertMemory, \"Memory allocation for the Alert\")\n\tcmd.Flags().StringVar(&ctl.CfsslMemory, \"cfssl-memory\", ctl.CfsslMemory, \"Memory allocation for the Cfssl\")\n\tcmd.Flags().StringVar(&ctl.DesiredState, \"alert-desired-state\", ctl.DesiredState, \"State of the Alert\")\n}", "func (c *Condition) addArgument(conditionType int, args interface{}) {\n\n\t// Array/Slice arguments\n\tif reflect.ValueOf(args).Kind() == reflect.Array || reflect.ValueOf(args).Kind() == reflect.Slice {\n\t\tfor n := 0; n < reflect.ValueOf(args).Len(); n++ {\n\t\t\tswitch t := reflect.TypeOf(reflect.ValueOf(args).Index(n).Interface()).Kind(); t {\n\t\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\t\tvar val int64\n\t\t\t\tif t == reflect.Int || t == reflect.Int32 {\n\t\t\t\t\tval = int64(reflect.ValueOf(args).Index(n).Interface().(int))\n\t\t\t\t}\n\t\t\t\tif t == reflect.Int8 {\n\t\t\t\t\tval = int64(reflect.ValueOf(args).Index(n).Interface().(int8))\n\t\t\t\t}\n\t\t\t\tif t == reflect.Int16 {\n\t\t\t\t\tval = int64(reflect.ValueOf(args).Index(n).Interface().(int16))\n\t\t\t\t}\n\t\t\t\tif t == reflect.Int64 {\n\t\t\t\t\tval = reflect.ValueOf(args).Index(n).Interface().(int64)\n\t\t\t\t}\n\n\t\t\t\tc.args[conditionType] = append(c.args[conditionType], val)\n\t\t\tcase reflect.String:\n\t\t\t\tval := reflect.ValueOf(args).Index(n).Interface().(string)\n\t\t\t\tc.args[conditionType] = append(c.args[conditionType], val)\n\t\t\tdefault:\n\t\t\t\tc.error = fmt.Errorf(ErrArgumentType.Error(), reflect.ValueOf(args).Index(n).Kind())\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\t// single argument\n\tc.args[conditionType] = append(c.args[conditionType], args)\n}", "func AddComponentFlag(cmd *cobra.Command) {\n\tcmd.Flags().String(genericclioptions.ComponentFlagName, \"\", \"Component, defaults to active component.\")\n\tcompletion.RegisterCommandFlagHandler(cmd, \"component\", completion.ComponentNameCompletionHandler)\n}", "func (ctx *zedmanagerContext) AddAgentSpecificCLIFlags(flagSet *flag.FlagSet) {\n\tctx.versionPtr = flagSet.Bool(\"v\", false, \"Version\")\n}", "func AddFlags(rootCmd *cobra.Command) {\n\tflag.CommandLine.VisitAll(func(gf *flag.Flag) {\n\t\trootCmd.PersistentFlags().AddGoFlag(gf)\n\t})\n}", "func (c *Command) AddFlag(flag *Flag) error {\n\tcc := c.GetCobraCmd()\n\tflagSetter := cc.Flags\n\tif flag.Persist {\n\t\tflagSetter = cc.PersistentFlags\n\t}\n\n\tswitch flag.Type {\n\tcase TypeString:\n\t\tflagSetter().StringVarP(flag.StringVar, flag.Name, flag.Shorthand, flag.StringValue, T(flag.Description))\n\tcase TypeInt:\n\t\tflagSetter().IntVarP(flag.IntVar, flag.Name, flag.Shorthand, flag.IntValue, T(flag.Description))\n\tcase TypeBool:\n\t\tflagSetter().BoolVarP(flag.BoolVar, flag.Name, flag.Shorthand, flag.BoolValue, T(flag.Description))\n\tdefault:\n\t\treturn failures.FailInput.New(\"Unknown type:\" + string(flag.Type))\n\t}\n\n\treturn nil\n}", "func NewConditionCommand() *ConditionCommand {\n\treturn &ConditionCommand{}\n}", "func (ctl *Ctl) AddSpecFlags(cmd *cobra.Command, master bool) {\n\tif master {\n\t\tcmd.Flags().StringVar(&ctl.PerceptorName, \"perceptor-name\", ctl.PerceptorName, \"Name of the Perceptor\")\n\t\tcmd.Flags().StringVar(&ctl.ScannerPodName, \"scannerpod-name\", ctl.ScannerPodName, \"Name of the ScannerPod\")\n\t\tcmd.Flags().StringVar(&ctl.ScannerPodScannerName, \"scannerpod-scanner-name\", ctl.ScannerPodScannerName, \"Name of the ScannerPod's Scanner Container\")\n\t\tcmd.Flags().StringVar(&ctl.ScannerPodImageFacadeName, \"scannerpod-imagefacade-name\", ctl.ScannerPodImageFacadeName, \"Name of the ScannerPod's ImageFacade Container\")\n\t\tcmd.Flags().StringVar(&ctl.PerceiverImagePerceiverName, \"imageperceiver-name\", ctl.PerceiverImagePerceiverName, \"Name of the ImagePerceiver\")\n\t\tcmd.Flags().StringVar(&ctl.PerceiverPodPerceiverName, \"podperceiver-name\", ctl.PerceiverPodPerceiverName, \"Name of the PodPerceiver\")\n\t\tcmd.Flags().StringVar(&ctl.PerceiverServiceAccount, \"perceiver-service-account\", ctl.PerceiverServiceAccount, \"TODO\")\n\t\tcmd.Flags().StringVar(&ctl.PrometheusName, \"prometheus-name\", ctl.PrometheusName, \"Name of Prometheus\")\n\t\tcmd.Flags().StringVar(&ctl.SkyfireName, \"skyfire-name\", ctl.SkyfireName, \"Name of Skyfire\")\n\t\tcmd.Flags().StringVar(&ctl.SkyfireServiceAccount, \"skyfire-service-account\", ctl.SkyfireServiceAccount, \"Service Account for Skyfire\")\n\t\tcmd.Flags().StringVar(&ctl.BlackduckConnectionsEnvironmentVaraiableName, \"blackduck-connections-environment-variable-name\", ctl.BlackduckConnectionsEnvironmentVaraiableName, \"TODO\")\n\t\tcmd.Flags().StringVar(&ctl.ConfigMapName, \"config-map-name\", ctl.ConfigMapName, \"Name of the config map for OpsSight\")\n\t\tcmd.Flags().StringVar(&ctl.SecretName, \"secret-name\", ctl.SecretName, \"Name of the secret for OpsSight\")\n\t}\n\tcmd.Flags().StringVar(&ctl.PerceptorImage, \"perceptor-image\", ctl.PerceptorImage, \"Image of the Perceptor\")\n\tcmd.Flags().IntVar(&ctl.PerceptorPort, \"perceptor-port\", ctl.PerceptorPort, \"Port for the Perceptor\")\n\tcmd.Flags().IntVar(&ctl.PerceptorCheckForStalledScansPauseHours, \"perceptor-check-scan-hours\", ctl.PerceptorCheckForStalledScansPauseHours, \"Hours the Percpetor waits between checking for scans\")\n\tcmd.Flags().IntVar(&ctl.PerceptorStalledScanClientTimeoutHours, \"perceptor-scan-client-timeout-hours\", ctl.PerceptorStalledScanClientTimeoutHours, \"Hours until Perceptor stops checking for scans\")\n\tcmd.Flags().IntVar(&ctl.PerceptorModelMetricsPauseSeconds, \"perceptor-metrics-pause-seconds\", ctl.PerceptorModelMetricsPauseSeconds, \"TODO\")\n\tcmd.Flags().IntVar(&ctl.PerceptorUnknownImagePauseMilliseconds, \"perceptor-unknown-image-pause-milliseconds\", ctl.PerceptorUnknownImagePauseMilliseconds, \"TODO\")\n\tcmd.Flags().IntVar(&ctl.PerceptorClientTimeoutMilliseconds, \"perceptor-client-timeout-milliseconds\", ctl.PerceptorClientTimeoutMilliseconds, \"TODO\")\n\tcmd.Flags().StringVar(&ctl.ScannerPodScannerImage, \"scannerpod-scanner-image\", ctl.ScannerPodScannerImage, \"Scanner Container's image\")\n\tcmd.Flags().IntVar(&ctl.ScannerPodScannerPort, \"scannerpod-scanner-port\", ctl.ScannerPodScannerPort, \"Scanner Container's port\")\n\tcmd.Flags().IntVar(&ctl.ScannerPodScannerClientTimeoutSeconds, \"scannerpod-scanner-client-timeout-seconds\", ctl.ScannerPodScannerClientTimeoutSeconds, \"TODO\")\n\tcmd.Flags().StringVar(&ctl.ScannerPodImageFacadeImage, \"scannerpod-imagefacade-image\", ctl.ScannerPodImageFacadeImage, \"ImageFacade Container's image\")\n\tcmd.Flags().IntVar(&ctl.ScannerPodImageFacadePort, \"scannerpod-imagefacade-port\", ctl.ScannerPodImageFacadePort, \"ImageFacade Container's port\")\n\tcmd.Flags().StringSliceVar(&ctl.ScannerPodImageFacadeInternalRegistriesJSONSlice, \"scannerpod-imagefacade-internal-registries\", ctl.ScannerPodImageFacadeInternalRegistriesJSONSlice, \"TODO\")\n\tcmd.Flags().StringVar(&ctl.ScannerPodImageFacadeImagePullerType, \"scannerpod-imagefacade-image-puller-type\", ctl.ScannerPodImageFacadeImagePullerType, \"Type of ImageFacade's Image Puller - docker, skopeo\")\n\tcmd.Flags().StringVar(&ctl.ScannerPodImageFacadeServiceAccount, \"scannerpod-imagefacade-service-account\", ctl.ScannerPodImageFacadeServiceAccount, \"Service Account for the ImageFacade\")\n\tcmd.Flags().IntVar(&ctl.ScannerPodReplicaCount, \"scannerpod-replica-count\", ctl.ScannerPodReplicaCount, \"TODO\")\n\tcmd.Flags().StringVar(&ctl.ScannerPodImageDirectory, \"scannerpod-image-directory\", ctl.ScannerPodImageDirectory, \"TODO\")\n\tcmd.Flags().BoolVar(&ctl.PerceiverEnableImagePerceiver, \"enable-image-perceiver\", ctl.PerceiverEnableImagePerceiver, \"TODO\")\n\tcmd.Flags().BoolVar(&ctl.PerceiverEnablePodPerceiver, \"enable-pod-perceiver\", ctl.PerceiverEnablePodPerceiver, \"TODO\")\n\tcmd.Flags().StringVar(&ctl.PerceiverImagePerceiverImage, \"imageperceiver-image\", ctl.PerceiverImagePerceiverImage, \"Image of the ImagePerceiver\")\n\tcmd.Flags().StringVar(&ctl.PerceiverPodPerceiverImage, \"podperceiver-image\", ctl.PerceiverPodPerceiverImage, \"Image of the PodPerceiver\")\n\tcmd.Flags().StringVar(&ctl.PerceiverPodPerceiverNamespaceFilter, \"podperceiver-namespace-filter\", ctl.PerceiverPodPerceiverNamespaceFilter, \"TODO\")\n\tcmd.Flags().IntVar(&ctl.PerceiverAnnotationIntervalSeconds, \"perceiver-annotation-interval-seconds\", ctl.PerceiverAnnotationIntervalSeconds, \"TODO\")\n\tcmd.Flags().IntVar(&ctl.PerceiverDumpIntervalMinutes, \"perceiver-dump-interval-minutes\", ctl.PerceiverDumpIntervalMinutes, \"TODO\")\n\tcmd.Flags().IntVar(&ctl.PerceiverPort, \"perceiver-port\", ctl.PerceiverPort, \"Port for the Perceiver\")\n\tcmd.Flags().StringVar(&ctl.ConfigMapName, \"configmapname\", ctl.ConfigMapName, \"TODO\")\n\tcmd.Flags().StringVar(&ctl.SecretName, \"secretname\", ctl.SecretName, \"TODO\")\n\tcmd.Flags().StringVar(&ctl.DefaultCPU, \"defaultcpu\", ctl.DefaultCPU, \"TODO\")\n\tcmd.Flags().StringVar(&ctl.DefaultMem, \"defaultmem\", ctl.DefaultMem, \"TODO\")\n\tcmd.Flags().StringVar(&ctl.ScannerCPU, \"scannercpu\", ctl.ScannerCPU, \"TODO\")\n\tcmd.Flags().StringVar(&ctl.ScannerMem, \"scannermem\", ctl.ScannerMem, \"TODO\")\n\tcmd.Flags().StringVar(&ctl.LogLevel, \"log-level\", ctl.LogLevel, \"TODO\")\n\tcmd.Flags().BoolVar(&ctl.EnableMetrics, \"enable-metrics\", ctl.EnableMetrics, \"TODO\")\n\tcmd.Flags().StringVar(&ctl.PrometheusImage, \"prometheus-image\", ctl.PrometheusImage, \"Image for Prometheus\")\n\tcmd.Flags().IntVar(&ctl.PrometheusPort, \"prometheus-port\", ctl.PrometheusPort, \"Port for Prometheus\")\n\tcmd.Flags().BoolVar(&ctl.EnableSkyfire, \"enable-skyfire\", ctl.EnableSkyfire, \"Enables Skyfire Pod if true\")\n\tcmd.Flags().StringVar(&ctl.SkyfireImage, \"skyfire-image\", ctl.SkyfireImage, \"Image of Skyfire\")\n\tcmd.Flags().IntVar(&ctl.SkyfirePort, \"skyfire-port\", ctl.SkyfirePort, \"Port of Skyfire\")\n\tcmd.Flags().IntVar(&ctl.SkyfirePrometheusPort, \"skyfire-prometheus-port\", ctl.SkyfirePrometheusPort, \"Skyfire's Prometheus port\")\n\tcmd.Flags().IntVar(&ctl.SkyfireHubClientTimeoutSeconds, \"skyfire-hub-client-timeout-seconds\", ctl.SkyfireHubClientTimeoutSeconds, \"TODO\")\n\tcmd.Flags().IntVar(&ctl.SkyfireHubDumpPauseSeconds, \"skyfire-hub-dump-pause-seconds\", ctl.SkyfireHubDumpPauseSeconds, \"Seconds Skyfire waits between querying Blackducks\")\n\tcmd.Flags().IntVar(&ctl.SkyfireKubeDumpIntervalSeconds, \"skyfire-kube-dump-interval-seconds\", ctl.SkyfireKubeDumpIntervalSeconds, \"Seconds Skyfire waits between querying the KubeAPI\")\n\tcmd.Flags().IntVar(&ctl.SkyfirePerceptorDumpIntervalSeconds, \"skyfire-perceptor-dump-interval-seconds\", ctl.SkyfirePerceptorDumpIntervalSeconds, \"Seconds Skyfire waits between querying the Perceptor Model\")\n\tcmd.Flags().StringSliceVar(&ctl.BlackduckExternalHostsJSON, \"blackduck-external-hosts\", ctl.BlackduckExternalHostsJSON, \"List of Blackduck External Hosts\")\n\tcmd.Flags().BoolVar(&ctl.BlackduckTLSVerification, \"blackduck-TLS-verification\", ctl.BlackduckTLSVerification, \"TODO\")\n\tcmd.Flags().IntVar(&ctl.BlackduckInitialCount, \"blackduck-initial-count\", ctl.BlackduckInitialCount, \"Initial number of Blackducks to create\")\n\tcmd.Flags().IntVar(&ctl.BlackduckMaxCount, \"blackduck-max-count\", ctl.BlackduckMaxCount, \"Maximum number of Blackducks that can be created\")\n\tcmd.Flags().IntVar(&ctl.BlackduckDeleteBlackduckThresholdPercentage, \"blackduck-delete-blackduck-threshold-percentage\", ctl.BlackduckDeleteBlackduckThresholdPercentage, \"TODO\")\n}", "func (g *Generator) AddFlags(command *cobra.Command) {\n\tflags := command.Flags()\n\tflags.SortFlags = false\n\n\tflags.StringP(base.Output, \"o\", \"\", \"output dir path\")\n\tif err := command.MarkFlagRequired(base.Output); err != nil {\n\t\tpanic(err)\n\t}\n\n\tflags.StringP(mfdFlag, \"m\", \"\", \"mfd file path\")\n\tif err := command.MarkFlagRequired(mfdFlag); err != nil {\n\t\tpanic(err)\n\t}\n\n\tflags.StringSliceP(nsFlag, \"n\", []string{}, \"namespaces to generate. separate by comma\\n\")\n\tflags.StringSliceP(entitiesFlag, \"e\", []string{}, \"entities to generate, must be in vt.xml file. separate by comma\")\n\n\tflags.String(routesTemplateFlag, \"\", \"path to routes custom template\")\n\tflags.String(listTemplateFlag, \"\", \"path to list custom template\")\n\tflags.String(filterTemplateFlag, \"\", \"path to filter custom template\")\n\tflags.String(formTemplateFlag, \"\", \"path to form custom template\\n\")\n}", "func AddPodFlag(cmd *cobra.Command) *string {\n\tv := \"\"\n\tcmd.Flags().StringVar(&v, \"pod\", \"\", \"Query a particular ingress-nginx pod\")\n\treturn &v\n}", "func (commandConfig *CommandConfig) AddFlag(name string, shortName string, isBool bool, defaultValue string) (*Flag, bool) {\n\n\t// clean argument values\n\t_name := removeWhitespaces(name)\n\t_shortName := removeWhitespaces(shortName)\n\t_defaultValue := trimWhitespaces(defaultValue)\n\n\t// inverted flag is a boolean flag with `no-` prefix\n\t_isInvert := false\n\n\t// short flag name should be only one character long\n\tif _shortName != \"\" {\n\t\t_shortName = _shortName[:1]\n\t}\n\n\t// set up `Flag` field values\n\tif isBool {\n\n\t\t// check for an inverted flag\n\t\tif strings.HasPrefix(name, \"no-\") {\n\t\t\t_isInvert = true // is an inverted flag\n\t\t\t_name = strings.TrimLeft(name, \"no-\") // trim `no-` prefix\n\t\t\t_defaultValue = \"true\" // default value of an inverted flag is `true`\n\t\t\t_shortName = \"\" // no short flag name for an inverted flag\n\t\t} else {\n\t\t\t_defaultValue = \"false\" // default value of a boolean flag is `true`\n\t\t}\n\t}\n\n\t// return if flag is already registered\n\tif _flag, ok := commandConfig.Flags[_name]; ok {\n\t\treturn _flag, true\n\t}\n\n\t// create a `Flag` object\n\tflag := &Flag{\n\t\tName: _name,\n\t\tShortName: _shortName,\n\t\tIsBoolean: isBool,\n\t\tIsInverted: _isInvert,\n\t\tDefaultValue: _defaultValue,\n\t}\n\n\t// register flag with the command-config\n\tcommandConfig.Flags[_name] = flag\n\n\t// register short flag name (for mapping)\n\tif len(_shortName) > 0 {\n\t\tcommandConfig.flagsShort[_shortName] = _name\n\t}\n\n\treturn flag, false\n}", "func addFlags(cmd *cobra.Command) {\n\tname = cmd.Flags().StringSliceP(\"name\", \"n\", []string{}, \"filter servers by Name tag, multiple comma separated values are allowed\")\n\tenv = cmd.Flags().StringSliceP(\"env\", \"e\", []string{}, \"filter servers by Env tag, multiple comma separated values are allowed\")\n\tregion = cmd.Flags().StringSliceP(\"region\", \"r\", []string{\"us-east-1\"}, \"look for servers in selected AWS region(s), any of: us-east-1,us-west-2,eu-west-1,ap-northeast-1,ap-southeast-2,all\")\n\tignoreCase = cmd.Flags().BoolP(\"ignore-case\", \"i\", false, \"ignore case in tag filters\")\n\n\t// Remove confusing `[]` symbols from region's default value.\n\tcmd.Flags().VisitAll(func(flag *pflag.Flag) {\n\t\tif flag.Name == \"region\" {\n\t\t\tflag.DefValue = strings.Map(func(r rune) rune {\n\t\t\t\tif r == '[' || r == ']' {\n\t\t\t\t\treturn '\"'\n\t\t\t\t}\n\t\t\t\treturn r\n\t\t\t}, flag.DefValue)\n\t\t}\n\t})\n}", "func CmdReporterFlagArgumentToCommand(flagArg string) (cmd []string, args []string, err error) {\n\tb := []byte(flagArg)\n\tr := &commandRepresentation{}\n\tif err := json.Unmarshal(b, r); err != nil {\n\t\treturn []string{}, []string{}, fmt.Errorf(\"failed to unmarshal command from argument. %+v\", err)\n\t}\n\treturn r.Cmd, r.Args, nil\n}", "func initFlag(cmd *cobra.Command) {\n\t//\tcobra.OnInitialize(initConfig)\n\t// add Pesistent flags\n\tcmd.PersistentFlags().StringP(\"server\", \"s\", \"localhost:6789\", \"katib manager API endpoint\")\n\n\t//bind viper\n\tviper.BindPFlag(\"server\", cmd.PersistentFlags().Lookup(\"server\"))\n}", "func (cmd *HealthHealthCommand) RegisterFlags(cc *cobra.Command, c *client.Client) {\n}", "func setCondition(status *api.Caffe2JobStatus, condition api.Caffe2JobCondition) {\n\tcurrentCond := getCondition(*status, condition.Type)\n\n\t// Do nothing if condition doesn't change\n\tif currentCond != nil && currentCond.Status == condition.Status && currentCond.Reason == condition.Reason {\n\t\treturn\n\t}\n\n\t// Do not update lastTransitionTime if the status of the condition doesn't change.\n\tif currentCond != nil && currentCond.Status == condition.Status {\n\t\tcondition.LastTransitionTime = currentCond.LastTransitionTime\n\t}\n\n\t// Append the updated condition to the\n\tnewConditions := filterOutCondition(status.Conditions, condition.Type)\n\tstatus.Conditions = append(newConditions, condition)\n}", "func (cli *Application) flag(name string) flags.Interface {\n\tif id, exists := cli.flagAliases[name]; exists {\n\t\treturn cli.flags[id]\n\t}\n\treturn flags.NewBoolFlag(name)\n}", "func AsFlag(key string, target *Flag) cm.ParseFunc {\n\treturn func(data map[string]string) error {\n\t\tif raw, ok := data[key]; ok {\n\t\t\tfor _, flag := range []Flag{Enabled, Allowed, Disabled} {\n\t\t\t\tif strings.EqualFold(raw, string(flag)) {\n\t\t\t\t\t*target = flag\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n}", "func (cli *Application) AddFlag(f flags.Interface) {\n\tcli.Log.Debugf(\"CLI:AddFlag - %q\", f.Name())\n\t// Verify flag\n\tcli.errs.Add(f.Verify())\n\n\t// add flag if there was no errors\n\tif cli.errs.Nil() {\n\t\tnextFlagID := len(cli.flags) + 1\n\t\t// assign the flag and set error if there is flag alias shadowing.\n\t\tcli.flags[nextFlagID] = f\n\t\t// Check that flag or it's aliases do not shadow other global flag\n\t\tfor _, alias := range f.GetAliases() {\n\t\t\tif flagID, exists := cli.flagAliases[alias]; exists {\n\t\t\t\tcli.errs.Appendf(FmtErrFlagShadowing, f.Name(), alias, cli.flags[flagID].Name())\n\t\t\t} else {\n\t\t\t\tcli.flagAliases[alias] = nextFlagID\n\t\t\t}\n\t\t}\n\t}\n}", "func AddTrackFlags(cmd *cobra.Command) {\n\tcmd.Flags().Int(maxPollRetriesFlag, util.DefaultRetries, \"Optional maximum plan tracking retries\")\n\tcmd.Flags().Duration(pollFrequencyFlag, util.DefaultPollFrequency, \"Optional polling frequency to check for plan change updates\")\n}", "func flagInit(cp *cliParams) {\n flag.IntVar(&cp.updateInterval, \"update-interval\", config.DefaultUpdateInterval, \"Interval to update PTP status\")\n}", "func addRenderFlags(settings *render.Settings, cmd *cobra.Command) {\n\tflags := cmd.Flags()\n\n\tflags.StringVarP(\n\t\t&settings.Label,\n\t\t\"label\",\n\t\t\"l\",\n\t\t\"\",\n\t\t\"filter documents by Labels\")\n\n\tflags.StringVarP(\n\t\t&settings.Annotation,\n\t\t\"annotation\",\n\t\t\"a\",\n\t\t\"\",\n\t\t\"filter documents by Annotations\")\n\n\tflags.StringVarP(\n\t\t&settings.APIVersion,\n\t\t\"apiversion\",\n\t\t\"g\",\n\t\t\"\",\n\t\t\"filter documents by API version\")\n\n\tflags.StringVarP(\n\t\t&settings.Kind,\n\t\t\"kind\",\n\t\t\"k\",\n\t\t\"\",\n\t\t\"filter documents by Kinds\")\n}", "func AddStringFlag(cmd *cobra.Command, name string, aliases []string, value string, env, usage string) {\n\tif env != \"\" {\n\t\tusage = fmt.Sprintf(\"%s [$%s]\", usage, env)\n\t}\n\tif envV, ok := os.LookupEnv(env); ok {\n\t\tvalue = envV\n\t}\n\taliasesUsage := fmt.Sprintf(\"Alias of --%s\", name)\n\tp := new(string)\n\tflags := cmd.Flags()\n\tflags.StringVar(p, name, value, usage)\n\tfor _, a := range aliases {\n\t\tif len(a) == 1 {\n\t\t\t// pflag doesn't support short-only flags, so we have to register long one as well here\n\t\t\tflags.StringVarP(p, a, a, value, aliasesUsage)\n\t\t} else {\n\t\t\tflags.StringVar(p, a, value, aliasesUsage)\n\t\t}\n\t}\n}", "func AddCommand(ctx context.Context,\n\tcb CommandBuilder,\n\tcommandBuffer VkCommandBuffer,\n\tr *api.GlobalState,\n\ts *api.GlobalState,\n\trebuildInfo interface{}) (func(), api.Cmd, error) {\n\tswitch t := rebuildInfo.(type) {\n\tcase *VkCmdBeginRenderPassArgs:\n\t\treturn rebuildVkCmdBeginRenderPass(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdEndRenderPassArgs:\n\t\treturn rebuildVkCmdEndRenderPass(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdNextSubpassArgs:\n\t\treturn rebuildVkCmdNextSubpass(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdBindPipelineArgs:\n\t\treturn rebuildVkCmdBindPipeline(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdBindDescriptorSetsArgs:\n\t\treturn rebuildVkCmdBindDescriptorSets(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdBindVertexBuffersArgs:\n\t\treturn rebuildVkCmdBindVertexBuffers(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdBindIndexBufferArgs:\n\t\treturn rebuildVkCmdBindIndexBuffer(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdPipelineBarrierArgs:\n\t\treturn rebuildVkCmdPipelineBarrier(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdWaitEventsArgs:\n\t\treturn rebuildVkCmdWaitEvents(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdBeginQueryArgs:\n\t\treturn rebuildVkCmdBeginQuery(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdBlitImageArgs:\n\t\treturn rebuildVkCmdBlitImage(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdClearAttachmentsArgs:\n\t\treturn rebuildVkCmdClearAttachments(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdClearColorImageArgs:\n\t\treturn rebuildVkCmdClearColorImage(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdClearDepthStencilImageArgs:\n\t\treturn rebuildVkCmdClearDepthStencilImage(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdCopyBufferArgs:\n\t\treturn rebuildVkCmdCopyBuffer(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdCopyBufferToImageArgs:\n\t\treturn rebuildVkCmdCopyBufferToImage(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdCopyImageArgs:\n\t\treturn rebuildVkCmdCopyImage(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdCopyImageToBufferArgs:\n\t\treturn rebuildVkCmdCopyImageToBuffer(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdCopyQueryPoolResultsArgs:\n\t\treturn rebuildVkCmdCopyQueryPoolResults(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdDispatchArgs:\n\t\treturn rebuildVkCmdDispatch(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdDispatchIndirectArgs:\n\t\treturn rebuildVkCmdDispatchIndirect(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdDrawArgs:\n\t\treturn rebuildVkCmdDraw(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdDrawIndexedArgs:\n\t\treturn rebuildVkCmdDrawIndexed(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdDrawIndexedIndirectArgs:\n\t\treturn rebuildVkCmdDrawIndexedIndirect(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdDrawIndirectArgs:\n\t\treturn rebuildVkCmdDrawIndirect(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdEndQueryArgs:\n\t\treturn rebuildVkCmdEndQuery(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdExecuteCommandsArgs:\n\t\treturn rebuildVkCmdExecuteCommands(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdFillBufferArgs:\n\t\treturn rebuildVkCmdFillBuffer(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdPushConstantsArgs:\n\t\treturn rebuildVkCmdPushConstants(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdResetQueryPoolArgs:\n\t\treturn rebuildVkCmdResetQueryPool(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdResolveImageArgs:\n\t\treturn rebuildVkCmdResolveImage(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdSetBlendConstantsArgs:\n\t\treturn rebuildVkCmdSetBlendConstants(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdSetDepthBiasArgs:\n\t\treturn rebuildVkCmdSetDepthBias(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdSetDepthBoundsArgs:\n\t\treturn rebuildVkCmdSetDepthBounds(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdSetEventArgs:\n\t\treturn rebuildVkCmdSetEvent(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdResetEventArgs:\n\t\treturn rebuildVkCmdResetEvent(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdSetLineWidthArgs:\n\t\treturn rebuildVkCmdSetLineWidth(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdSetScissorArgs:\n\t\treturn rebuildVkCmdSetScissor(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdSetStencilCompareMaskArgs:\n\t\treturn rebuildVkCmdSetStencilCompareMask(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdSetStencilReferenceArgs:\n\t\treturn rebuildVkCmdSetStencilReference(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdSetStencilWriteMaskArgs:\n\t\treturn rebuildVkCmdSetStencilWriteMask(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdSetViewportArgs:\n\t\treturn rebuildVkCmdSetViewport(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdUpdateBufferArgs:\n\t\treturn rebuildVkCmdUpdateBuffer(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdWriteTimestampArgs:\n\t\treturn rebuildVkCmdWriteTimestamp(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdDebugMarkerBeginEXTArgs:\n\t\treturn rebuildVkCmdDebugMarkerBeginEXT(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdDebugMarkerEndEXTArgs:\n\t\treturn rebuildVkCmdDebugMarkerEndEXT(ctx, cb, commandBuffer, r, s, t)\n\tcase *VkCmdDebugMarkerInsertEXTArgs:\n\t\treturn rebuildVkCmdDebugMarkerInsertEXT(ctx, cb, commandBuffer, r, s, t)\n\tdefault:\n\t\tx := fmt.Sprintf(\"Should not reach here: %T\", t)\n\t\tpanic(x)\n\t}\n}", "func (cmd *TechListHyTechCommand) RegisterFlags(cc *cobra.Command, c *client.Client) {\n}", "func addFlagWithEnvDefault(c *cobra.Command, flag string, defVal string, help string) {\n\tc.PersistentFlags().String(\n\t\tflag,\n\t\tdefaultValue(flag, defVal),\n\t\tfmt.Sprintf(\"%s (${%s})\", help, GetEnvName(flag)))\n}", "func updateBoolFromFlag(cmd *cobra.Command, v *bool, key string) {\n\tif cmd.Flags().Changed(key) {\n\t\t*v = viper.GetBool(key)\n\t}\n}", "func (c *Commands) FlagDemo(m *discordgo.MessageCreate, f *arguments.Flag) error {\n\tvar fs = arguments.NewFlagSet()\n\n\topt := fs.Bool(\"opt\", false, \"\")\n\tstr := fs.String(\"str\", \"\", \"\")\n\n\tif err := f.With(fs); err != nil {\n\t\treturn errors.Wrap(err, \"Invalid flags\")\n\t}\n\n\targs := fs.Args()\n\n\treturn c.Context.Send(m.ChannelID, fmt.Sprintf(\n\t\t`opt: %v, str: \"%s\", args: %v`,\n\t\t*opt, *str, args),\n\t)\n}", "func CommandToCmdReporterFlagArgument(cmd []string, args []string) (string, error) {\n\tr := &commandRepresentation{Cmd: cmd, Args: args}\n\tb, err := json.Marshal(r)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to marshal command+args into an argument string. %+v\", err)\n\t}\n\treturn string(b), nil\n}", "func (s *BasePCREListener) ExitConditional(ctx *ConditionalContext) {}", "func NewEnvFlag(config interface{}, args []string) error {\n\treturn newFlagWithErrorHandling(config, args, flag.ExitOnError, true)\n}", "func init() {\n\tappCmd.AddCommand(appEnsureCmd)\n\tappEnsureCmd.Flags().StringVar(&ensureAdd, \"add\", \"\", \"add new dependencies, or populate Gopkg.toml with constraints for existing dependencies (default: false)\")\n\tappEnsureCmd.Flags().BoolVar(&ensureUpdate, \"update\", false, \"update the named dependencies (or all, if none are named) in Gopkg.lock to the latest allowed by Gopkg.toml (default: false)\")\n\tappEnsureCmd.Flags().BoolVar(&ensureNoVendor, \"no-vendor\", false, \" update Gopkg.lock (if needed), but do not update vendor/ (default: false)\")\n\tappEnsureCmd.Flags().BoolVar(&ensureVerbose, \"verbose\", false, \"enable verbose logging (default: false)\")\n\tappEnsureCmd.Flags().BoolVar(&ensureVendorOnly, \"vendor-only\", false, \"populate vendor/ from Gopkg.lock without updating it first (default: false)\")\n}", "func (cli *Application) AddCommand(c Command) {\n\tcli.Log.Debugf(\"CLI:AddCommand - %q\", c.Name())\n\t// Can only check command name here since nothing stops you to add possible\n\t// shadow flags after this command was added.\n\tif _, exists := cli.commands[c.Name()]; exists {\n\t\tcli.errs.Add(errors.Newf(FmtErrCommandNameInUse, c.Name()))\n\t\treturn\n\t}\n\tcli.commands[c.Name()] = c\n}", "func (nd *NetworkDisconnectCommand) addFlags() {\n\t// add flags\n\tnd.cmd.Flags().BoolVarP(&nd.force, \"force\", \"f\", false, \"Force the container to disconnect from a network\")\n}", "func addIncludeRequestFlag(cmd *cobra.Command) {\n\tcmd.Flags().BoolVar(&includeRequest, \"include-request\", false, \"include the query request in the output\")\n}", "func cmdWithFlagsChecked(cmd *Command, args []string) (*Command, error) {\n\t// No subcommands defined. Check the flags and return the command.\n\tcmd.Args = args\n\tnotMyFlags := checkFlags(cmd)\n\ts := \"\"\n\tif len(notMyFlags) > 0 {\n\t\tif len(notMyFlags) > 1 {\n\t\t\ts = \"s\"\n\t\t}\n\t\terrmsg := fmt.Sprintf(\"Unknown flag%s: %v\", s, notMyFlags)\n\t\treturn &Command{\n\t\t\tCmd: Usage,\n\t\t}, errors.New(errmsg)\n\t}\n\treturn cmd, nil\n}", "func (o *PullRequestOptions) AddFlags(cmd *cobra.Command) {\n\to.Options.AddFlags(cmd)\n\n\tcmd.Flags().IntVarP(&o.Number, \"pr\", \"\", 0, \"the Pull Request number. If not specified we detect it via $PULL_NUMBER or $BRANCH_NAME environment variables\")\n\n}", "func addFlagToConfig(cfg *config.Config) {\n\tif len(cfg.Targets) == 0 {\n\t\tcfg.Targets = *targets\n\t}\n\tif cfg.Ping.History == 0 {\n\t\tcfg.Ping.History = *historySize\n\t}\n\tif cfg.Ping.Interval == 0 {\n\t\tcfg.Ping.Interval.Set(*pingInterval)\n\t}\n\tif cfg.Ping.Timeout == 0 {\n\t\tcfg.Ping.Timeout.Set(*pingTimeout)\n\t}\n\tif cfg.Ping.Size == 0 {\n\t\tcfg.Ping.Size = *pingSize\n\t}\n\tif cfg.DNS.Refresh == 0 {\n\t\tcfg.DNS.Refresh.Set(*dnsRefresh)\n\t}\n\tif cfg.DNS.Nameserver == \"\" {\n\t\tcfg.DNS.Nameserver = *dnsNameServer\n\t}\n}", "func AddCommand(c *cobra.Command) {\n\tc.AddCommand(cmd)\n\n\tfs := cmd.Flags()\n\tfs.SortFlags = false\n\n\topts.Request = request.New(\"\")\n\trequest.AddFlags(opts.Request, fs)\n\n\tfs.StringVarP(&opts.Value, \"value\", \"v\", \"test\", \"Use `string` for the placeholder\")\n\tfs.BoolVar(&opts.ShowRequest, \"show-request\", false, \"Also print HTTP request\")\n}", "func MatchFlag(full string, arg string) bool {\n\treturn Match(\"--\"+full, arg)\n}", "func AddPersistentStringFlag(cmd *cobra.Command, name string, aliases, localAliases, persistentAliases []string, aliasToBeInherited *pflag.FlagSet, value string, env, usage string) {\n\tif env != \"\" {\n\t\tusage = fmt.Sprintf(\"%s [$%s]\", usage, env)\n\t}\n\tif envV, ok := os.LookupEnv(env); ok {\n\t\tvalue = envV\n\t}\n\taliasesUsage := fmt.Sprintf(\"Alias of --%s\", name)\n\tp := new(string)\n\n\t// flags is full set of flag(s)\n\t// flags can redefine alias already used in subcommands\n\tflags := cmd.Flags()\n\tfor _, a := range aliases {\n\t\tif len(a) == 1 {\n\t\t\t// pflag doesn't support short-only flags, so we have to register long one as well here\n\t\t\tflags.StringVarP(p, a, a, value, aliasesUsage)\n\t\t} else {\n\t\t\tflags.StringVar(p, a, value, aliasesUsage)\n\t\t}\n\t\t// non-persistent flags are not added to the InheritedFlags, so we should add them manually\n\t\tf := flags.Lookup(a)\n\t\taliasToBeInherited.AddFlag(f)\n\t}\n\n\t// localFlags are local to the rootCmd\n\tlocalFlags := cmd.LocalFlags()\n\tfor _, a := range localAliases {\n\t\tif len(a) == 1 {\n\t\t\t// pflag doesn't support short-only flags, so we have to register long one as well here\n\t\t\tlocalFlags.StringVarP(p, a, a, value, aliasesUsage)\n\t\t} else {\n\t\t\tlocalFlags.StringVar(p, a, value, aliasesUsage)\n\t\t}\n\t}\n\n\t// persistentFlags cannot redefine alias already used in subcommands\n\tpersistentFlags := cmd.PersistentFlags()\n\tpersistentFlags.StringVar(p, name, value, usage)\n\tfor _, a := range persistentAliases {\n\t\tif len(a) == 1 {\n\t\t\t// pflag doesn't support short-only flags, so we have to register long one as well here\n\t\t\tpersistentFlags.StringVarP(p, a, a, value, aliasesUsage)\n\t\t} else {\n\t\t\tpersistentFlags.StringVar(p, a, value, aliasesUsage)\n\t\t}\n\t}\n}", "func addConfigFlag(basename string, fs *pflag.FlagSet) {\n\tfs.AddFlag(pflag.Lookup(configFlagName))\n\n\tviper.AutomaticEnv()\n\tviper.SetEnvPrefix(strings.Replace(strings.ToUpper(basename), \"-\", \"_\", -1))\n\tviper.SetEnvKeyReplacer(strings.NewReplacer(\".\", \"_\", \"-\", \"_\"))\n\n\tcobra.OnInitialize(func() {\n\t\tif cfgFile != \"\" {\n\t\t\tviper.SetConfigFile(cfgFile)\n\t\t} else {\n\t\t\tviper.AddConfigPath(\".\")\n\n\t\t\tif names := strings.Split(basename, \"-\"); len(names) > 1 {\n\t\t\t\tviper.AddConfigPath(filepath.Join(homedir.HomeDir(), \".\"+names[0]))\n\t\t\t}\n\n\t\t\tviper.SetConfigName(basename)\n\t\t}\n\n\t\tif err := viper.ReadInConfig(); err != nil {\n\t\t\t_, _ = fmt.Fprintf(os.Stderr, \"Error: failed to read configuration file(%s): %v\\n\", cfgFile, err)\n\t\t\tos.Exit(1)\n\t\t}\n\t})\n}", "func AddApplicationFlag(cmd *cobra.Command) {\n\tcmd.Flags().String(genericclioptions.ApplicationFlagName, \"\", \"Application, defaults to active application\")\n\tcompletion.RegisterCommandFlagHandler(cmd, \"app\", completion.AppCompletionHandler)\n}", "func AddKubectlFlagsToCmd(cmd *cobra.Command) clientcmd.ClientConfig {\n\tloadingRules := clientcmd.NewDefaultClientConfigLoadingRules()\n\tloadingRules.DefaultClientConfig = &clientcmd.DefaultClientConfig\n\toverrides := clientcmd.ConfigOverrides{}\n\tkflags := clientcmd.RecommendedConfigOverrideFlags(\"\")\n\tcmd.PersistentFlags().StringVar(&loadingRules.ExplicitPath, \"kubeconfig\", \"\", \"Path to a kube config. Only required if out-of-cluster\")\n\tclientcmd.BindOverrideFlags(&overrides, cmd.PersistentFlags(), kflags)\n\treturn clientcmd.NewInteractiveDeferredLoadingClientConfig(loadingRules, &overrides, os.Stdin)\n}", "func (ctx *verifierContext) AddAgentSpecificCLIFlags(flagSet *flag.FlagSet) {\n\tctx.versionPtr = flagSet.Bool(\"v\", false, \"Version\")\n}", "func (c *Command) AddCommand(sub *Command) *Command {\n\tc.lasyInit()\n\tif sub := c.Lookup(sub.Name); sub != nil {\n\t\tpanic(fmt.Sprintf(\"%s already exists\", sub.Name))\n\t}\n\tsub.parent = c\n\tc.SubCommands = append(c.SubCommands, sub)\n\treturn c\n}", "func (s *Statement) AddWorkingGrpahClause() {\n\tif s.workingClause != nil || !s.workingClause.IsEmpty() {\n\t\ts.pattern = append(s.pattern, s.workingClause)\n\t}\n\ts.ResetWorkingGraphClause()\n}", "func (s *Statement) AddWorkingGrpahClause() {\n\ts.pattern = append(s.pattern, s.workingClause)\n\ts.ResetWorkingGraphClause()\n}", "func addBenchmarkFlags(cmd *cobra.Command) {\n\tcmd.Flags().StringVarP(&benchmark, \"benchmark\", \"b\", \"netperf\", \"benchmark program to use\")\n\tcmd.Flags().StringVarP(&runLabel, \"run-label\", \"l\", \"\", \"benchmark run label\")\n\tcmd.Flags().IntVarP(&benchmarkDuration, \"duration\", \"t\", 30, \"benchmark duration (sec)\")\n\tcmd.Flags().BoolVar(&noCleanup, \"no-cleanup\", false, \"do not perform cleanup (delete created k8s resources, etc.)\")\n\tcmd.Flags().StringVar(&cliAffinity, \"client-affinity\", \"different\", \"client affinity (different: different than server, same: same as server, host=XXXX)\")\n\tcmd.Flags().StringVar(&srvAffinity, \"server-affinity\", \"none\", \"server affinity (none, host=XXXX)\")\n\tcmd.Flags().BoolVar(&collectPerf, \"collect-perf\", false, \"collect performance data using perf\")\n\tcmd.Flags().BoolVar(&cliHost, \"cli-on-host\", false, \"run client on host (enables: HostNetwork, HostIPC, HostPID)\")\n\tcmd.Flags().BoolVar(&srvHost, \"srv-on-host\", false, \"run server on host (enables: HostNetwork, HostIPC, HostPID)\")\n\taddNetperfFlags(cmd)\n}", "func checkStringFlagReplaceWithUtilVersion(name string, arg string, compulsory bool) (exists bool) {\n\tvar hasArg bool\n\n\tif arg != \"\" {\n\t\texists = true\n\t}\n\n\t// Try to detect missing flag argument.\n\t// If an argument is another flag, argument has not been provided.\n\tif exists && !strings.HasPrefix(arg, \"-\") {\n\t\t// Option expecting an argument but has been followed by another flag.\n\t\thasArg = true\n\t}\n\t/*\n\t\twhere(fmt.Sprintf(\"-%s compulsory = %t\", name, compulsory))\n\t\twhere(fmt.Sprintf(\"-%s exists = %t\", name, exists))\n\t\twhere(fmt.Sprintf(\"-%s hasArg = %t\", name, hasArg))\n\t\twhere(fmt.Sprintf(\"-%s value = %s\", name, arg))\n\t*/\n\n\tif compulsory && !exists {\n\t\tfmt.Fprintf(os.Stderr, \"compulsory flag: -%s\\n\", name)\n\t\tprintUsage()\n\t\tos.Exit(2)\n\t}\n\n\tif exists && !hasArg {\n\t\tfmt.Fprintf(os.Stderr, \"flag -%s needs a valid argument (not: %s)\\n\", name, arg)\n\t\tprintUsage()\n\t\tos.Exit(3)\n\t}\n\n\treturn\n}", "func (s *BasePCREListener) ExitOption_flags(ctx *Option_flagsContext) {}" ]
[ "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.45300654", "0.44939056", "0.4475093", "0.44690654", "0.44672233", "0.4423053", "0.43812367", "0.43371022", "0.43150076", "0.43113583", "0.43085843", "0.43003783", "0.42941558", "0.42910662", "0.4287516", "0.42871326", "0.42845815", "0.42833996", "0.4277622", "0.4274158", "0.42626965", "0.4247566", "0.42203474", "0.42180252", "0.4193732", "0.41920096", "0.4187544", "0.41866866", "0.41845754", "0.41839403", "0.41830707", "0.41782245", "0.41745704", "0.4165933", "0.41647112", "0.41372705", "0.41249332", "0.4123314", "0.41230914", "0.4120313", "0.41192636", "0.41152626", "0.4110272", "0.41086882", "0.41034746", "0.40966073", "0.4085449", "0.40721107", "0.40706545", "0.40690205", "0.4057648", "0.40523946", "0.40501034", "0.4037667", "0.40375018", "0.40304846", "0.40300095", "0.40257257", "0.4023006", "0.40192428", "0.40176246", "0.40157875", "0.4012876", "0.39926267", "0.39891118", "0.39847374", "0.3983209", "0.39828894", "0.3982763", "0.39793974", "0.3976342", "0.39742914", "0.39698064", "0.3962342", "0.3961063", "0.39574602", "0.39544913", "0.39510834", "0.39399996", "0.39336032" ]
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) subCommand(header string) bool {\n\theader = strings.TrimPrefix(header, metaTag)\n\tif !strings.HasPrefix(header, \".\") { // unmatch any subcommand\n\t\treturn false\n\t}\n\tswitch {\n\t// sub command to change section context\n\tcase strings.HasPrefix(header, \".set_section\"):\n\t\tif match := sectionPattern.FindStringSubmatch(header); match != nil {\n\t\t\tctx.Section = match[1]\n\t\t}\n\t\treturn true\n\tdefault:\n\t\tfmt.Println(\"gendoc: unknown subcommand:\", header)\n\t\treturn false\n\t}\n}", "func startSubcommand(c *subcommand) bool {\n\tc.flags.Parse(os.Args[2:])\n\tif !c.flags.Parsed() {\n\t\tc.flags.Usage()\n\t\treturn false\n\t}\n\n\tif !quiet {\n\t\tprintBanner()\n\t}\n\treturn true\n}", "func hasSeeAlso(cmd *cobra.Command) bool {\n\tif cmd.HasParent() {\n\t\treturn true\n\t}\n\tfor _, c := range cmd.Commands() {\n\t\tif !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {\n\t\t\tcontinue\n\t\t}\n\t\treturn true\n\t}\n\treturn false\n}", "func hasSeeAlso(c *cobra.Command) bool {\n\tif c.HasParent() {\n\t\treturn true\n\t}\n\tfor _, c := range c.Commands() {\n\t\tif !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {\n\t\t\tcontinue\n\t\t}\n\t\treturn true\n\t}\n\treturn false\n}", "func (r *subprocess) isContext(n ast.Node, ctx *gosec.Context) bool {\n\tselector, indent, err := gosec.GetCallInfo(n, ctx)\n\tif err != nil {\n\t\treturn false\n\t}\n\tif selector == \"exec\" && indent == \"CommandContext\" {\n\t\treturn true\n\t}\n\treturn false\n}", "func wrongOrMissingSubcommand(cmd *Command) (*Command, error) {\n\terrmsg := \"Command \" + cmd.Name + \" requires one of these subcommands:\\n\"\n\tfor _, n := range cmd.children {\n\t\terrmsg += n.Name + \"\\n\"\n\t}\n\treturn &Command{\n\t\tCmd: func(cmd *Command) error { return Usage(cmd) },\n\t}, errors.New(errmsg)\n}", "func (cmd *ConditionCommand) AddFlaggySubcommand() *flaggy.Subcommand {\n\n\tcmd.subcommand = flaggy.NewSubcommand(\"condition\")\n\tcmd.subcommand.Description = \"Condition and/or convert a mGuard configuration file\"\n\tcmd.subcommand.String(&cmd.inFilePath, \"\", \"in\", \"File containing the mGuard configuration to condition (ATV format or unencrypted ECS container)\")\n\tcmd.subcommand.String(&cmd.outAtvFilePath, \"\", \"atv-out\", \"File receiving the conditioned configuration (ATV format, instead of stdout)\")\n\tcmd.subcommand.String(&cmd.outEcsFilePath, \"\", \"ecs-out\", \"File receiving the conditioned configuration (ECS container, unencrypted, instead of stdout)\")\n\n\tflaggy.AttachSubcommand(cmd.subcommand, 1)\n\n\treturn cmd.subcommand\n}", "func ContainsCmd(aa []api.Command, c api.Command) bool {\n\tfor _, v := range aa {\n\t\tif c.Parent == v.Parent && c.Usage == v.Usage {\n\t\t\treturn true\n\t\t}\n\n\t\tcoreCmd := fmt.Sprintf(\"%s_%s\", v.Parent, v.Usage)\n\t\tif c.Parent == coreCmd { // Ensures that no core commands will be added\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func isCommand(c *yaml.Container) bool {\n\treturn len(c.Commands) != 0\n}", "func IsCmd(cmd string)(b bool) {\n\n\tvar i uint32\n\n\tprogPath := \"/programs/\"\n\n\tfiles, status := altEthos.SubFiles(progPath)\n\tif status != syscall.StatusOk {\n\n\t\tshellStatus := String(\"Subfiles failed\\n\")\n\t\taltEthos.WriteStream(syscall.Stdout, &shellStatus)\n\n\t}\n\n\tb = false\n\n\tfor i=0; i<uint32(len(files)); i++ {\n\n\t\tif files[i] == cmd {\n\t\t\tb = true\n\t\t}\n\n\t}\n\n\treturn\n}", "func findSubCommand(cmd *cobra.Command, subCmdName string) *cobra.Command {\n\tfor _, subCmd := range cmd.Commands() {\n\t\tuse := subCmd.Use\n\t\tif use == subCmdName || strings.HasPrefix(use, subCmdName+\" \") {\n\t\t\treturn subCmd\n\t\t}\n\t}\n\treturn nil\n}", "func isCommand(name string) bool {\n\tfor _, cmd := range []string{\"_hooks\", \"_forward\"} {\n\t\tif strings.Compare(name, cmd) == 0 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (te *TreeEntry) IsSubModule() bool {\n\treturn te.gogitTreeEntry.Mode == filemode.Submodule\n}", "func (p *Project) IsCommand(name string) bool {\n\tif t, exists := p.Targets[name]; exists {\n\t\treturn t.Command\n\t}\n\treturn false\n}", "func IsCommand(cmd string) bool {\n for val := range DaemonizedCommands() {\n if val == cmd {\n return true\n }\n }\n for val := range InfoCommands() {\n if val == cmd {\n return true\n }\n }\n\n return false\n}", "func LowSubcmd(subcmd string) (bool, int) {\n\targs := []string{}\n\tif len(os.Args) > 1 {\n\t\targs = os.Args\n\t} else {\n\t\treturn false, 0\n\t}\n\tfor i, v := range args {\n\t\tif v == subcmd {\n\t\t\treturn true, i\n\t\t}\n\t}\n\treturn false, 0\n}", "func validateRootCommand(cmd *cobra.Command) error {\n\tfoundCmd, innerArgs, err := cmd.Find(os.Args[1:])\n\tif err == nil && foundCmd.HasSubCommands() && len(innerArgs) > 0 {\n\t\targsWithoutFlags, err := stripFlags(cmd, innerArgs)\n\t\tif len(argsWithoutFlags) > 0 || err != nil {\n\t\t\treturn fmt.Errorf(\"unknown sub-command '%s' for '%s'. Available sub-commands: %s\", innerArgs[0], foundCmd.CommandPath(), strings.Join(root.ExtractSubCommandNames(foundCmd.Commands()), \", \"))\n\t\t}\n\t\t// If no args where given (only flags), then fall through to execute the command itself, which leads to\n\t\t// a more appropriate error message\n\t}\n\treturn nil\n}", "func (p Typed) IsCommand() bool {\n\treturn p.Kind() == TypeIDKindCommand\n}", "func (te *TreeEntry) IsSubModule() bool {\n\treturn te.entryMode == EntryModeCommit\n}", "func (tk Kinds) IsSubCat() bool {\n\treturn tk.SubCat() == tk\n}", "func containsCommand(components []string) bool {\n\tfor _, comp := range components {\n\t\tif isCommand(comp) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (r Response) IsCommand() bool {\n\treturn r.Act == ActCommand\n}", "func (o MaxSubSession) IsOption() {}", "func IsPluginCommand(cmd *cobra.Command) bool {\n\treturn cmd.Annotations[CommandAnnotationPlugin] == \"true\"\n}", "func (tk Tokens) IsSubCat() bool {\n\treturn tk.SubCat() == tk\n}", "func (tok Token) IsCommand() bool {\n\treturn commandBegin < tok && tok < commandEnd\n}", "func needsInit(terragruntOptions *options.TerragruntOptions, terragruntConfig *config.TerragruntConfig) (bool, error) {\n\tif util.ListContainsElement(TerraformCommandsThatDoNotNeedInit, util.FirstArg(terragruntOptions.TerraformCliArgs)) {\n\t\treturn false, nil\n\t}\n\n\tif providersNeedInit(terragruntOptions) {\n\t\treturn true, nil\n\t}\n\n\tmodulesNeedsInit, err := modulesNeedInit(terragruntOptions)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif modulesNeedsInit {\n\t\treturn true, nil\n\t}\n\n\treturn remoteStateNeedsInit(terragruntConfig.RemoteState, terragruntOptions)\n}", "func argIsOption(arg string) bool {\n\treturn strings.Contains(arg, \"=\") || strings.Contains(arg, \".\")\n}", "func hasTags(cmd *cobra.Command) bool {\n\tfor curr := cmd; curr != nil; curr = curr.Parent() {\n\t\tif len(curr.Tags) > 0 {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (authClient *AuthClient) IsCommand(message string) bool {\n\treturn strings.HasPrefix(message, authCommand)\n}", "func (c PolicyCheckCommand) SubCommandName() string {\n\treturn \"\"\n}", "func (c CommentCommand) IsForSpecificProject() bool {\n\treturn c.RepoRelDir != \"\" || c.Workspace != \"\" || c.ProjectName != \"\"\n}", "func (e Event) IsSlashCommand() bool {\n\treturn e.Is(SlashCommand)\n}", "func isInOptions(config sonarExecuteScanOptions, property string) bool {\n\tproperty = strings.TrimSuffix(property, \"=\")\n\treturn piperutils.ContainsStringPart(config.Options, property)\n}", "func reconfigureCmdWithSubcmd(cmd *cobra.Command) {\n\tif len(cmd.Commands()) == 0 {\n\t\treturn\n\t}\n\n\tif cmd.Args == nil {\n\t\tcmd.Args = cobra.ArbitraryArgs\n\t}\n\tif cmd.RunE == nil {\n\t\tcmd.RunE = ShowSubcommands\n\t}\n\n\tvar strs []string\n\tfor _, subcmd := range cmd.Commands() {\n\t\tif !subcmd.Hidden {\n\t\t\tstrs = append(strs, strings.Split(subcmd.Use, \" \")[0])\n\t\t}\n\t}\n\n\tcmd.Short += \" (\" + strings.Join(strs, \", \") + \")\"\n}", "func cmdWithFlagsChecked(cmd *Command, args []string) (*Command, error) {\n\t// No subcommands defined. Check the flags and return the command.\n\tcmd.Args = args\n\tnotMyFlags := checkFlags(cmd)\n\ts := \"\"\n\tif len(notMyFlags) > 0 {\n\t\tif len(notMyFlags) > 1 {\n\t\t\ts = \"s\"\n\t\t}\n\t\terrmsg := fmt.Sprintf(\"Unknown flag%s: %v\", s, notMyFlags)\n\t\treturn &Command{\n\t\t\tCmd: Usage,\n\t\t}, errors.New(errmsg)\n\t}\n\treturn cmd, nil\n}", "func (o *WorkflowCliCommandAllOf) HasCommand() bool {\n\tif o != nil && o.Command != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (strokeClient *StrokeClient) IsCommand(message string) bool {\n\treturn strings.HasPrefix(message, strokeCommand)\n}", "func inChild() bool {\n\treturn os.Getenv(childEnv) == \"true\"\n}", "func isInit() bool {\n\treturn len(os.Args) >= 2 && os.Args[1] == \"init\"\n}", "func prepareNonInitCommand(originalTerragruntOptions *options.TerragruntOptions, terragruntOptions *options.TerragruntOptions, terragruntConfig *config.TerragruntConfig) error {\n\tneedsInit, err := needsInit(terragruntOptions, terragruntConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif needsInit {\n\t\tif err := runTerraformInit(originalTerragruntOptions, terragruntOptions, terragruntConfig, nil); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (client *consulClient) HasSubConfiguration(name string) (bool, error) {\n\tif stemKeys, _, err := client.consulClient.KV().Keys(client.fullPath(name), \"\", nil); err != nil {\n\t\treturn false, fmt.Errorf(\"checking sub configuration existence from Consul failed: %v\", err)\n\t} else if len(stemKeys) == 0 {\n\t\treturn false, nil\n\t} else {\n\t\treturn true, nil\n\t}\n}", "func isPlugin(c *yaml.Container) bool {\n\treturn len(c.Commands) == 0 || len(c.Vargs) != 0\n}", "func (o *WorkflowSshCmd) HasCommand() bool {\n\tif o != nil && o.Command != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func IsCmd(c *config.Config, message string) (bool, string) {\n\tcmdcs := c.GetArray(\"CommandChar\", []string{\"!\"})\n\tbotnick := strings.ToLower(c.Get(\"Nick\", \"bot\"))\n\tif botnick == \"\" {\n\t\tlog.Fatal().\n\t\t\tMsgf(`You must run catbase -set nick -val <your bot nick>`)\n\t}\n\tiscmd := false\n\tlowerMessage := strings.ToLower(message)\n\n\tif strings.HasPrefix(lowerMessage, botnick) &&\n\t\tlen(lowerMessage) > len(botnick) &&\n\t\t(lowerMessage[len(botnick)] == ',' || lowerMessage[len(botnick)] == ':') {\n\n\t\tiscmd = true\n\t\tmessage = message[len(botnick):]\n\n\t\t// trim off the customary addressing punctuation\n\t\tif message[0] == ':' || message[0] == ',' {\n\t\t\tmessage = message[1:]\n\t\t}\n\t} else {\n\t\tfor _, cmdc := range cmdcs {\n\t\t\tif strings.HasPrefix(lowerMessage, cmdc) && len(cmdc) > 0 {\n\t\t\t\tiscmd = true\n\t\t\t\tmessage = message[len(cmdc):]\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\t// trim off any whitespace left on the message\n\tmessage = strings.TrimSpace(message)\n\n\treturn iscmd, message\n}", "func topLevelCmd(use, short string) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: use,\n\t\tShort: short,\n\t\tDisableFlagParsing: false,\n\t\tSuggestionsMinimumDistance: 2,\n\t\tRunE: validateCmd,\n\t}\n}", "func (c Category) IsSubSet() bool {\n\treturn c.Sub != 0\n}", "func isRootCommand(values []string, registry Registry) bool {\n\n\t// FALSE: if the root command is not registered\n\tif _, ok := registry[\"\"]; !ok {\n\t\treturn false\n\t}\n\n\t// TRUE: if all `values` are empty or the first `value` is a flag\n\tif len(values) == 0 || isFlag(values[0]) {\n\t\treturn true\n\t}\n\n\t// get root `CommandConfig` value from the registry\n\trootCommandConfig := registry[\"\"]\n\n\t// TRUE: if the first value is not a registered command\n\t// and some arguments are registered for the root command\n\tif _, ok := registry[values[0]]; len(rootCommandConfig.Args) > 0 && !ok {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func isSVNCommandAvailableInPath() (bool, error) {\n\tSVNPath, err := exec.LookPath(constant.SVN_COMMAND)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tlogger.Debug(fmt.Sprintf(\"%s executable found in %s\", constant.SVN_COMMAND, SVNPath))\n\treturn true, nil\n}", "func (c CommentCommand) SubCommandName() string {\n\treturn c.SubName\n}", "func IsMetaPackage(name string) bool {\n\treturn name == \"std\" || name == \"cmd\" || name == \"all\"\n}", "func run_command(command string)bool{\n\treturn true\n\n}", "func IsSubvolume(path string) bool {\n\tout, err := exec.Command(\"btrfs\", \"subvolume\", \"show\", path).CombinedOutput()\n\tlog.Check(log.DebugLevel, \"Checking is path BTRFS subvolume\", err)\n\treturn strings.Contains(string(out), \"Subvolume ID\")\n}", "func isOption(inString string) bool {\r\n\tvar rx *regexp.Regexp = regexp.MustCompile(`^--?`)\r\n\treturn rx.MatchString(inString)\r\n}", "func IsCommandExists(name string) (bool, string) {\n\tresult := false\n\n\tpath, err := exec.LookPath(name)\n\tif err == nil {\n\t\tresult = true\n\t}\n\n\treturn result, path\n}", "func (p Plugin) GetInitSubcommand() plugin.InitSubcommand { return &p.initSubcommand }", "func MaybeRunExternalCommand(command string, args []string) {\n\ttryRunExternalCommand(config.ZenlogSrcTopDir()+\"/subcommands\", command, args)\n\n\tfor _, path := range strings.Split(os.Getenv(\"PATH\"), \":\") {\n\t\ttryRunExternalCommand(path, command, args)\n\t}\n}", "func checkSubCgroup(parent, child string) bool {\n\tif strings.HasPrefix(child, parent) {\n\t\treturn true\n\t}\n\treturn false\n}", "func shouldGarble(args []string) bool {\n\tcurrentPackageName := pkgNameFromBuildArgs(args)\n\n\tonlyThisPkgName := os.Getenv(\"ONLY\")\n\tif onlyThisPkgName != \"\" && !strings.HasPrefix(currentPackageName, onlyThisPkgName) {\n\t\treturn false\n\t}\n\n\texcludeEnvVal := os.Getenv(\"EXCLUDE\")\n\tif excludeEnvVal != \"\" {\n\t\texclude := strings.Split(os.Getenv(\"EXCLUDE\"), \",\")\n\t\tfor _, pkgName := range exclude {\n\t\t\tif strings.HasPrefix(currentPackageName, pkgName) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true\n}", "func commandExists(name string) bool {\n\t_, err := exec.LookPath(name)\n\treturn err == nil\n}", "func (c AutoplanCommand) SubCommandName() string {\n\treturn \"\"\n}", "func shouldCopyLockFile(args []string) bool {\n\tif util.FirstArg(args) == CommandNameInit {\n\t\treturn true\n\t}\n\n\tif util.FirstArg(args) == CommandNameProviders && util.SecondArg(args) == CommandNameLock {\n\t\treturn true\n\t}\n\treturn false\n}", "func CheckCommandIsAvailable(commandToCheck string) (bool, error) {\n\tcmd := exec.Command(\"command\", \"-v\", commandToCheck)\n\terrorMsg := fmt.Sprintf(\"error while checking if command %s is in PATH\", commandToCheck)\n\t// folder where the command must be is useless since it is not used.\n\t// So using \"/\"\n\t// false means : do not show the executed command to the end user.\n\t_, errorcode, err := RunCmdWithErrorCode(\"/\", *cmd, errorMsg, IsDebugActivated(), false)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, fmt.Sprintf(\"error while checking if command %s is present in user's PATH\", commandToCheck))\n\t}\n\n\tif errorcode == 0 {\n\t\treturn true, nil\n\t}\n\treturn false, nil\n}", "func SimplePrivateCommand(desired string, supplied string, isUser bool) bool {\n\tif supplied == desired && isUser {\n\t\treturn true\n\t}\n\treturn false\n}", "func (o *ApplianceClusterInstallPhase) HasCurrentSubphase() bool {\n\tif o != nil && o.CurrentSubphase != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func IsCommandFeasibleInState(currentState GameState, command string) bool {\n\tswitch currentState {\n\tcase InitState:\n\t\tif command == \"aloita\" {\n\t\t\treturn true\n\t\t}\n\tcase WaitingForPlayers:\n\t\tswitch command {\n\t\tcase \"aloita\", \"jatka\", \"lopeta\":\n\t\t\treturn true\n\t\t}\n\tcase WaitingForSongs:\n\t\tswitch command {\n\t\tcase \"esitys\", \"esitä\", \"jatka\", \"lopeta\":\n\t\t\treturn true\n\t\t}\n\tcase WaitingForReviews:\n\t\tswitch command {\n\t\tcase \"arvio\", \"arvioi\", \"arvostele\", \"jatka\", \"lopeta\":\n\t\t\treturn true\n\t\t}\n\tcase PublishingSong, StopGame:\n\t\treturn false\n\t}\n\treturn false\n}", "func (d *common) isUsed() (bool, error) {\n\tusedBy, err := d.usedBy(true)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn len(usedBy) > 0, nil\n}", "func checkCommand(cmd string) bool {\n\tr := false\n\tfor _, c := range CMDS {\n\t\tif c == cmd {\n\t\t\tr = true\n\t\t}\n\t}\n\treturn r\n}", "func IsCommandSet() PredicateFunc {\n\treturn func(v *VolumeGetProperty) bool {\n\t\treturn len(v.Command) != 0\n\t}\n}", "func IsCmd() bool {\n\tproc, _ := ps.FindProcess(os.Getppid())\n\tif proc != nil && !strings.Contains(proc.Executable(), \"cmd.exe\") {\n\t\treturn false\n\t}\n\treturn true\n}", "func (o *WorkflowSshCmdAllOf) HasCommand() bool {\n\tif o != nil && o.Command != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func CommandArgExists(mapArr map[string]string, key string) bool {\n\tif _, ok := mapArr[key]; ok {\n\t\treturn true\n\t}\n\treturn false\n}", "func CompileOptionUsed(optName string) bool {\n\tcOptName := C.CString(optName)\n\tdefer C.free(unsafe.Pointer(cOptName))\n\treturn C.sqlite3_compileoption_used(cOptName) == 1\n}", "func (o *ReconciliationTarget) HasUsage() bool {\n\tif o != nil && o.Usage != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func HandleSubCommand(line []rune, pos int, command *flags.Command) (lastWord string, completions []*readline.CompletionGroup) {\n\n\t_, _, lastWord = FormatInput(line)\n\n\treturn\n}", "func (sb *SecretBackend) isConfigured() bool {\n\treturn sb.cmd != \"\"\n}", "func (c PolicyCheckCommand) IsVerbose() bool {\n\treturn false\n}", "func (o *TaskOptions) HasIsTemplate() bool {\n\tif o != nil && o.IsTemplate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func registerSubcommand(name, desc string, do subcommandFunc) *subcommand {\n\tc := &subcommand{\n\t\tname: name,\n\t\tdesc: desc,\n\t\tflags: flag.NewFlagSet(name, flag.ExitOnError),\n\t\tdo: do,\n\t}\n\t// define flags that are common to all subcommands\n\tc.flags.BoolVar(&quiet, \"quiet\", false, \"minimize output messages\")\n\tsubcommands[name] = c\n\treturn c\n}", "func (r *MessageExecuteCommand) HasCommand() bool {\n\treturn r.hasCommand\n}", "func (a *App) SubCommand(pattern string, handler Handler) {\n\ta.cmd.addRoute(pattern, handler)\n}", "func (p *Plugin) PrepareCommand(command string, extraArgs []string) (main string, argv []string, err error) {\n\tparts := strings.Split(os.ExpandEnv(command), \" \")\n\tmain = parts[0]\n\tif len(parts) > 1 {\n\t\targv = parts[1:]\n\t}\n\tif !p.Metadata.IgnoreGlobalFlags && extraArgs != nil {\n\t\targv = append(argv, extraArgs...)\n\t}\n\treturn\n}", "func (o *SubTransactionParams) HasCategoryId() bool {\n\tif o != nil && o.CategoryId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func isServerSubrequestOutputBufferSizeDirective(directive string) bool {\n\tif isEqualString(directive, ServerSubrequestOutputBufferSizeDirective) {\n\t\treturn true\n\t}\n\treturn false\n}", "func confirmShouldApplyExternalDependency(module *TerraformModule, dependency *TerraformModule, terragruntOptions *options.TerragruntOptions) (bool, error) {\n\tif terragruntOptions.IncludeExternalDependencies {\n\t\tterragruntOptions.Logger.Debugf(\"The --terragrunt-include-external-dependencies flag is set, so automatically including all external dependencies, and will run this command against module %s, which is a dependency of module %s.\", dependency.Path, module.Path)\n\t\treturn true, nil\n\t}\n\n\tif terragruntOptions.NonInteractive {\n\t\tterragruntOptions.Logger.Debugf(\"The --non-interactive flag is set. To avoid accidentally affecting external dependencies with a run-all command, will not run this command against module %s, which is a dependency of module %s.\", dependency.Path, module.Path)\n\t\treturn false, nil\n\t}\n\n\tstackCmd := terragruntOptions.TerraformCommand\n\tif stackCmd == \"destroy\" {\n\t\tterragruntOptions.Logger.Debugf(\"run-all command called with destroy. To avoid accidentally having destructive effects on external dependencies with run-all command, will not run this command against module %s, which is a dependency of module %s.\", dependency.Path, module.Path)\n\t\treturn false, nil\n\t}\n\n\tprompt := fmt.Sprintf(\"Module: \\t\\t %s\\nExternal dependency: \\t %s\\nShould Terragrunt apply the external dependency?\", module.Path, dependency.Path)\n\treturn shell.PromptUserForYesNo(prompt, terragruntOptions)\n}", "func TestBareCommand(t *testing.T) {\n\n\t// Run a blank command\n\toutput := executeCommand()\n\n\t// We should have a subcommand required command and a complete usage dump\n\trequire.NotNil(t, executeError, \"there should have been an error\")\n\trequire.Equal(t, \"subcommand is required\", executeError.Error(), \"Expected subcommand required error\")\n\trequire.Contains(t, output,\n\t\t\"Slog is a CLI utility for reading and culling web access logs stored in S3\",\n\t\t\"Expected full usage display\")\n}", "func (c CommentCommand) IsVerbose() bool {\n\treturn c.Verbose\n}", "func (tk Tokens) InSubCat(other Tokens) bool {\n\treturn tk.SubCat() == other.SubCat()\n}", "func IsSystemCmd(cmd string) bool {\n\t_, err := os.Stat(cmd)\n\tif err == nil {\n\t\treturn true\n\t}\n\n\tsysPath := os.Getenv(\"PATH\")\n\n\tpathSeparator := \":\"\n\tif runtime.GOOS == \"windows\" {\n\t\tpathSeparator = \";\"\n\t}\n\n\tfor _, e := range strings.Split(sysPath, pathSeparator) {\n\t\tcmdPath := fmt.Sprintf(\"%s%s%s\", e, string(os.PathSeparator), cmd)\n\t\t_, err := os.Stat(cmdPath)\n\t\tif err == nil {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (o *SecurityMonitoringRuleCase) HasCondition() bool {\n\treturn o != nil && o.Condition != nil\n}", "func (connManager *ConnectionManager) canRunCommand() bool {\n\tif !connManager.acc.isValidAccount() {\n\t\tconnManager.sendStr(\"530 Need Auth\\r\\n\")\n\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (b *Builder) ShouldBuild() bool {\n\tif osFlag != \"\" && !osFilter[b.OS] {\n\t\treturn false\n\t}\n\tif archFlag != \"\" && !archFilter[b.Arch] {\n\t\treturn false\n\t}\n\tif cmdFlag != \"\" && !cmdFilter[b.Cmd] {\n\t\treturn false\n\t}\n\treturn true\n}", "func (self *AdminCmdHandler) IsAdminCmd(cmd *proxy.RedisCmd) bool {\n\tif cmd.Cmd == \"yundisctl\" {\n\t\treturn true\n\t}\n\treturn false\n}", "func (o *SubTransactionParams) HasPurpose() bool {\n\tif o != nil && o.Purpose != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (tk Kinds) IsSub2Cat() bool {\n\treturn tk.Sub2Cat() == tk\n}", "func isServerLogSubrequestDirective(directive string) bool {\n\tif isEqualString(directive, ServerLogSubrequestDirective) {\n\t\treturn true\n\t}\n\treturn false\n}", "func analysisArgs() bool {\n\t//没有选项的情况显示帮助信息\n\tif len(os.Args) <= 1 {\n\t\tfor _, v := range gCommandItems {\n\t\t\tlog(v.mBuilder.getCommandDesc())\n\t\t}\n\t\treturn false\n\t}\n\n\t//解析指令\n\targs := os.Args[1:]\n\tvar pItem *sCommandItem = nil\n\tfor i := 0; i < len(args); i++ {\n\t\tparm := args[i]\n\t\tif parm[0] == '-' {\n\t\t\tpItem = findCommandItem(parm)\n\t\t\tif pItem == nil {\n\t\t\t\tlogErr(\"illegal command:\" + parm)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tpItem.mCanExecute = true\n\t\t} else {\n\t\t\tif pItem == nil {\n\t\t\t\tlogErr(\"illegal command:\" + parm)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tpItem.mParm = append(pItem.mParm, parm)\n\t\t}\n\t}\n\n\treturn true\n}" ]
[ "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.49061692", "0.48864996", "0.4878995", "0.4848642", "0.48138362", "0.48085588", "0.47966245", "0.4794121", "0.4746039", "0.4736983", "0.47294566", "0.47007468", "0.46881148", "0.46798825", "0.46631256", "0.46393982", "0.45874637", "0.4580997", "0.45798945", "0.45720813", "0.45563796", "0.45373905", "0.4515198", "0.45088136", "0.45033574", "0.45015553", "0.44995892", "0.4490872", "0.44885615", "0.44851515", "0.4475528", "0.44701627", "0.44585845", "0.44555718", "0.44509017", "0.44505125", "0.4445877", "0.4444051", "0.44386175", "0.44300872", "0.44291803", "0.4428241", "0.44193727", "0.44136235", "0.44135192", "0.44102928", "0.44074595", "0.44074172", "0.44041607", "0.43991044", "0.4395078", "0.43902355", "0.43829235", "0.43724498", "0.4369518", "0.43675095", "0.43671647", "0.4362376", "0.43614227", "0.4361067", "0.4359739", "0.43493912", "0.43448937", "0.43424398", "0.43357864", "0.43339235", "0.43320218", "0.43303972", "0.43298054", "0.43279138", "0.4327539", "0.43246937", "0.4322849", "0.43216392", "0.43203977", "0.43017608", "0.4301389", "0.42964795", "0.42957667", "0.42892122" ]
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 *LineInterface) ValidateArguments() {\n\tif len(os.Args) < 2 {\n\t\tInterface.PrintUsage()\n\t\truntime.Goexit()\n\t}\n}", "func CheckArguments(arguments []Argument, min int, max int, fname string, usage string) (int, ErrorValue) {\n\targLen := len(arguments)\n\tif argLen < min || argLen > max {\n\t\treturn argLen, NewErrorValue(fmt.Sprintf(\"Invalid call to %s. Usage: %s %s\", fname, fname, usage))\n\t}\n\treturn argLen, nil\n}", "func ValidateArgument(c *cli.Context) error {\n\tvar err error\n\tcommandName := c.Args().Get(0)\n\tinputArgumentsSize := len(c.Args())\n\tcorrectSize, exists := argumentSizeMap[commandName]\n\n\tif !exists {\n\t\tmessage := fmt.Sprintf(\"command not found :%s\", commandName)\n\t\terr = errors.New(message)\n\t}\n\n\tif inputArgumentsSize != correctSize {\n\t\tmessage := fmt.Sprintf(\"arguments size error.\")\n\t\terr = errors.New(message)\n\t}\n\treturn err\n}", "func CheckArgsLength(args []string, expectedLength int) error {\r\n\tif len(args) != expectedLength {\r\n\t\treturn fmt.Errorf(\"invalid number of arguments. Expected %v, got %v\", expectedLength, len(args))\r\n\t}\r\n\treturn nil\r\n}", "func (cmd *Command) checkArgs(args []string) {\n\tif len(args) < cmd.MinArgs {\n\t\tsyntaxError()\n\t\tfmt.Fprintf(os.Stderr, \"Command %s needs %d arguments mininum\\n\", cmd.Name, cmd.MinArgs)\n\t\tos.Exit(1)\n\t} else if len(args) > cmd.MaxArgs {\n\t\tsyntaxError()\n\t\tfmt.Fprintf(os.Stderr, \"Command %s needs %d arguments maximum\\n\", cmd.Name, cmd.MaxArgs)\n\t\tos.Exit(1)\n\t}\n}", "func IsValidArgsLength(args []string, n int) bool {\n\tif args == nil && n == 0 {\n\t\treturn true\n\t}\n\tif args == nil {\n\t\treturn false\n\t}\n\n\tif n < 0 {\n\t\treturn false\n\t}\n\n\targsNr := len(args)\n\tif argsNr < n || argsNr > n {\n\t\treturn false\n\t}\n\treturn true\n}", "func ValidateArgs(args []string) error {\n\targsSorted := make([]string, len(args))\n\tcopy(argsSorted, args)\n\tsort.Strings(argsSorted)\n\tif i := sort.SearchStrings(argsSorted, separatorArg); i == len(argsSorted) || argsSorted[i] != separatorArg {\n\t\treturn fmt.Errorf(\"missing the argument %s\", separatorArg)\n\t}\n\n\treturn nil\n}", "func ValidateCommonArguments(flags *flag.FlagSet) (*CommonArguments, error) {\n\tversion, err := flags.GetString(\"version\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdebug, err := flags.GetBool(\"debug\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttimeout, err := flags.GetInt(\"timeout\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &CommonArguments{\n\t\tVersion: version,\n\t\tDebug: debug,\n\t\tTimeout: time.Duration(timeout) * time.Second,\n\t}, nil\n}", "func (c *MigrationsCmd) CheckArgs(cmd *cobra.Command, args []string) error {\n\treturn nil\n}", "func ValidateArgs(config Config) error {\n\tvalidUpgradeScope := false\n\tfor _, scope := range config.TargetCluster.UpgradeScopes() {\n\t\tif config.TargetCluster.UpgradeScope == scope {\n\t\t\tvalidUpgradeScope = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !validUpgradeScope {\n\t\treturn errors.Errorf(\"invalid upgrade scope, must be one of %v\", config.TargetCluster.UpgradeScopes())\n\t}\n\n\tif _, err := semver.ParseTolerant(config.KubernetesVersion); err != nil {\n\t\treturn errors.Errorf(\"Invalid Kubernetes version: %q\", config.KubernetesVersion)\n\t}\n\n\tif (config.MachineUpdates.Image.ID == \"\" && config.MachineUpdates.Image.Field != \"\") ||\n\t\t(config.MachineUpdates.Image.ID != \"\" && config.MachineUpdates.Image.Field == \"\") {\n\t\treturn errors.New(\"when specifying image id, image field is required (and vice versa)\")\n\t}\n\n\tif config.MachineDeployment.Name != \"\" && config.MachineDeployment.LabelSelector != \"\" {\n\t\treturn errors.New(\"you may only set one of machine deployment name and label selector, but not both\")\n\t}\n\n\treturn nil\n}", "func (a *Arguments) Validate() error {\n\tif a.Person == nil && a.Employee == nil {\n\t\treturn server.EmptyArgumentsHTTPError\n\t}\n\n\tif a.Person != nil && a.Employee.PersonID != nil {\n\t\treturn server.NewHTTPError(http.StatusBadRequest, \"person_id and person can not be specified together\")\n\t}\n\n\tif a.Person != nil {\n\t\tif err := a.Person.Validate(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif a.Employee != nil {\n\t\tif err := a.Employee.Validate(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func ValidateArgs(args []string, validations []validate.Argument) error {\n\tif err := ValidateArgCount(len(validations), len(args)); err != nil {\n\t\treturn err\n\t}\n\n\tfor i, arg := range validations {\n\t\tif ok := arg.Validate(args[i]); !ok {\n\t\t\treturn fmt.Errorf(InvalidArg, arg.Name, args[i], arg.Validate.TypeName())\n\t\t}\n\t}\n\n\treturn nil\n}", "func ValidateCommonArguments(flags *flag.FlagSet) (*CommonArguments, error) {\n\tversion, err := flags.GetString(\"version\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdevel, err := flags.GetBool(\"devel\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdebug, err := flags.GetBool(\"debug\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttimeout, err := flags.GetInt(\"timeout\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdryRun, err := flags.GetBool(\"dry-run\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdumpValues, err := flags.GetBool(\"only-output-values\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdumpValuesPath, err := flags.GetString(\"dump-values-path\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclusterLabels, err := flags.GetString(\"cluster-labels\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlanDiscovery, err := flags.GetBool(\"enable-lan-discovery\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcommonValues, err := parseCommonValues(clusterLabels, lanDiscovery)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &CommonArguments{\n\t\tVersion: version,\n\t\tDebug: debug,\n\t\tTimeout: time.Duration(timeout) * time.Second,\n\t\tDryRun: dryRun,\n\t\tDumpValues: dumpValues,\n\t\tDumpValuesPath: dumpValuesPath,\n\t\tCommonValues: commonValues,\n\t\tDevel: devel,\n\t}, nil\n}", "func (c *compiledStatement) validateCondition(expr influxql.Expr) error {\n\tswitch expr := expr.(type) {\n\tcase *influxql.BinaryExpr:\n\t\t// Verify each side of the binary expression. We do not need to\n\t\t// verify the binary expression itself since that should have been\n\t\t// done by influxql.ConditionExpr.\n\t\tif err := c.validateCondition(expr.LHS); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := c.validateCondition(expr.RHS); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\tcase *influxql.Call:\n\t\tif !isMathFunction(expr) {\n\t\t\treturn fmt.Errorf(\"invalid function call in condition: %s\", expr)\n\t\t}\n\n\t\t// How many arguments are we expecting?\n\t\tnargs := 1\n\t\tswitch expr.Name {\n\t\tcase \"atan2\", \"pow\":\n\t\t\tnargs = 2\n\t\t}\n\n\t\t// Did we get the expected number of args?\n\t\tif got := len(expr.Args); got != nargs {\n\t\t\treturn fmt.Errorf(\"invalid number of arguments for %s, expected %d, got %d\", expr.Name, nargs, got)\n\t\t}\n\n\t\t// Are all the args valid?\n\t\tfor _, arg := range expr.Args {\n\t\t\tif err := c.validateCondition(arg); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\tdefault:\n\t\treturn nil\n\t}\n}", "func (v *validator) CheckArgsAmount(args []string) error {\n\toperators, operands := 0, 0\n\tmacthOperator := fmt.Sprintf(`^%s$`, v.ValidOperatorExp)\n\tmacthOperand := fmt.Sprintf(`^%s$`, v.ValidOperandExp)\n\tfor _, arg := range args {\n\t\tif isOperator, _ := regexp.MatchString(macthOperator, arg); isOperator {\n\t\t\toperators++\n\t\t} else if isOperand, _ := regexp.MatchString(macthOperand, arg); isOperand {\n\t\t\toperands++\n\t\t}\n\t}\n\tswitch {\n\tcase operators + operands != len(args):\n\t\treturn fmt.Errorf(\"invalid expression argument(s)\")\n\tcase operands > operators + 1:\n\t\treturn fmt.Errorf(\"too many operands\")\n\tcase operators > operands - 1:\n\t\treturn fmt.Errorf(\"too many operators\")\n\tdefault:\n\t\treturn nil\n\t}\n}", "func checkArguments(hash string, privateKey string) bool {\n\t// easy check\n\t// if len(hash) != 46 || len(privateKey) != 64 {\n\t// \treturn false\n\t// }\n\n\treturn true\n}", "func check_args(parsed_query []string, num_expected int) bool {\n\treturn (len(parsed_query) >= num_expected)\n}", "func (a *WorkArguments) Validate() error {\n\tif a.DepartmentName == \"\" || a.AppointmentName == \"\" {\n\t\treturn server.EmptyArgumentsHTTPError\n\t}\n\n\treturn nil\n}", "func checkArguments() {\n\tif len(dockerRegistryUrl) == 0 {\n\t\tlog.Fatalln(\"Environment Variable 'DOCKER_REGISTRY_URL' not set\")\n\t}\n\n\tif len(replaceRegistryUrl) == 0 {\n\t\tlog.Fatalln(\"Environment Variable 'REPLACE_REGISTRY_URL' not set\")\n\t}\n\n\t_, err := strconv.ParseBool(replaceRegistryUrl)\n\tif err != nil {\n\t\tlog.Fatalln(\"Invalid Value in Environment Variable 'REPLACE_REGISTRY_URL'\")\n\t}\n}", "func (c *Command) argInputValidator(cmd *cobra.Command, args []string) error {\n\n\t// Validate whether we have all arguments that need to be defined\n\tif len(args) < len(c.Arguments) {\n\t\terrMsg := \"\"\n\t\tfor i := len(args); i < len(c.Arguments); i++ {\n\t\t\targ := c.Arguments[i]\n\t\t\tif !arg.Required {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\terrMsg += Tr(\"error_missing_arg\", T(arg.Name)) + \"\\n\"\n\t\t}\n\t\tif errMsg != \"\" {\n\t\t\treturn failures.FailUserInput.New(errMsg)\n\t\t}\n\t}\n\n\tsize := len(args)\n\tif len(c.Arguments) < size {\n\t\tsize = len(c.Arguments)\n\t}\n\n\t// Invoke validators, if any are defined\n\terrMsg := \"\"\n\tfor i := 0; i < size; i++ {\n\t\targ := c.Arguments[i]\n\t\tif arg.Validator == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\terr := arg.Validator(arg, args[i])\n\t\tif err != nil {\n\t\t\terrMsg += err.Error() + \"\\n\"\n\t\t}\n\t}\n\n\tif errMsg != \"\" {\n\t\treturn failures.FailUserInput.New(errMsg)\n\t}\n\n\treturn nil\n}", "func (c *UsersSetPresenceCall) ValidateArgs() error {\n\tif len(c.presence) <= 0 {\n\t\treturn errors.New(`required field presence not initialized`)\n\t}\n\treturn nil\n}", "func (mv *MoveValidator) ValidateArgs(args []string) error {\n\tfor _, arg := range args {\n\t\tif !validpath.Valid(arg) {\n\t\t\treturn fmt.Errorf(\"%s is not a valid argument\", arg)\n\t\t}\n\t}\n\tif len(args) != 2 {\n\t\treturn fmt.Errorf(\"Expected there to be 2 arguments, but got %d\", len(args))\n\t}\n\treturn nil\n}", "func ValidateCommonArguments(providerName string, flags *flag.FlagSet) (*CommonArguments, error) {\n\tchartPath, err := flags.GetString(\"chart-path\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tversion, err := flags.GetString(\"version\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdevel, err := flags.GetBool(\"devel\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdebug, err := flags.GetBool(\"debug\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttimeout, err := flags.GetInt(\"timeout\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdryRun, err := flags.GetBool(\"dry-run\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdumpValues, err := flags.GetBool(\"only-output-values\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdumpValuesPath, err := flags.GetString(\"dump-values-path\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclusterLabels, err := flags.GetString(\"cluster-labels\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlanDiscovery, err := flags.GetBool(\"enable-lan-discovery\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdisableEndpointCheck, err := flags.GetBool(\"disable-endpoint-check\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresourceSharingPercentage, err := flags.GetString(\"resource-sharing-percentage\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tenableHa, err := flags.GetBool(\"enable-ha\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tifaceMTU, err := flags.GetInt(\"mtu\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlisteningPort, err := flags.GetInt(\"vpn-listening-port\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcommonValues, err := parseCommonValues(providerName, clusterLabels, chartPath, version, resourceSharingPercentage,\n\t\tlanDiscovery, enableHa, float64(ifaceMTU), float64(listeningPort))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &CommonArguments{\n\t\tVersion: version,\n\t\tDebug: debug,\n\t\tTimeout: time.Duration(timeout) * time.Second,\n\t\tDryRun: dryRun,\n\t\tDumpValues: dumpValues,\n\t\tDumpValuesPath: dumpValuesPath,\n\t\tCommonValues: commonValues,\n\t\tDevel: devel,\n\t\tDisableEndpointCheck: disableEndpointCheck,\n\t\tChartPath: chartPath,\n\t}, nil\n}", "func (c *UsersGetPresenceCall) ValidateArgs() error {\n\tif len(c.user) <= 0 {\n\t\treturn errors.New(`required field user not initialized`)\n\t}\n\treturn nil\n}", "func checkArgs(nargs int, errMsg string) func(cmd *cobra.Command, args []string) error {\n\treturn func(cmd *cobra.Command, args []string) error {\n\t\tif len(args) != nargs {\n\t\t\treturn errors.Errorf(errMsg)\n\t\t}\n\t\treturn nil\n\t}\n}", "func CheckArgs(argsLength, argIndex int) error {\n\tif argsLength == (argIndex + 1) {\n\t\treturn errors.New(\"Not specified key value.\")\n\t}\n\treturn nil\n}", "func ParseVariadicCheckArguments(\n\tresult map[string][]string,\n\tconstraints []proto.CheckConfigConstraint,\n\tthresholds []proto.CheckConfigThreshold,\n\targs []string,\n) error {\n\t// used to hold found errors, so if three keywords are missing they can\n\t// all be mentioned in one call\n\terrors := []string{}\n\n\tmultiple := []string{\n\t\t`threshold`,\n\t\t`constraint`}\n\tunique := []string{\n\t\t`in`,\n\t\t`on`,\n\t\t`with`,\n\t\t`interval`,\n\t\t`inheritance`,\n\t\t`childrenonly`,\n\t\t`extern`}\n\trequired := []string{\n\t\t`in`,\n\t\t`on`,\n\t\t`with`,\n\t\t`interval`}\n\n\t// merge key slices\n\tkeys := append(multiple, unique...)\n\n\t// iteration helper\n\tskip := false\n\tskipcount := 0\n\nargloop:\n\tfor pos, val := range args {\n\t\t// skip current arg if it was already consumed\n\t\tif skip {\n\t\t\tskipcount--\n\t\t\tif skipcount == 0 {\n\t\t\t\tskip = false\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif sliceContainsString(val, keys) {\n\t\t\t// there must be at least one arguments left\n\t\t\tif len(args[pos+1:]) < 1 {\n\t\t\t\terrors = append(errors, `Syntax error, incomplete`+\n\t\t\t\t\t` key/value specification (too few items left`+\n\t\t\t\t\t` to parse)`,\n\t\t\t\t)\n\t\t\t\tgoto abort\n\t\t\t}\n\t\t\t// check for back-to-back keyswords\n\t\t\tif err := checkStringNotAKeyword(\n\t\t\t\targs[pos+1], keys,\n\t\t\t); err != nil {\n\t\t\t\terrors = append(errors, err.Error())\n\t\t\t\tgoto abort\n\t\t\t}\n\n\t\t\tswitch val {\n\t\t\tcase `threshold`:\n\t\t\t\tif len(args[pos+1:]) < 6 {\n\t\t\t\t\terrors = append(errors, `Syntax error, incomplete`+\n\t\t\t\t\t\t`threshold specification`)\n\t\t\t\t\tgoto abort\n\t\t\t\t}\n\t\t\t\tthr := proto.CheckConfigThreshold{}\n\t\t\t\tif err := parseThresholdChain(\n\t\t\t\t\tthr,\n\t\t\t\t\targs[pos+1:pos+7],\n\t\t\t\t); err != nil {\n\t\t\t\t\terrors = append(errors, err.Error())\n\t\t\t\t} else {\n\t\t\t\t\tthresholds = append(thresholds, thr)\n\t\t\t\t}\n\t\t\t\tskip = true\n\t\t\t\tskipcount = 6\n\t\t\t\tcontinue argloop\n\n\t\t\tcase `constraint`:\n\t\t\t\t// argument is the start of a constraint specification.\n\t\t\t\t// check we have enough arguments left\n\t\t\t\tif len(args[pos+1:]) < 3 {\n\t\t\t\t\terrors = append(errors, `Syntax error, incomplete`+\n\t\t\t\t\t\t` constraint specification`)\n\t\t\t\t}\n\t\t\t\tconstr := proto.CheckConfigConstraint{}\n\t\t\t\tif err := parseConstraintChain(\n\t\t\t\t\tconstr,\n\t\t\t\t\targs[pos+1:pos+3],\n\t\t\t\t); err != nil {\n\t\t\t\t\terrors = append(errors, err.Error())\n\t\t\t\t} else {\n\t\t\t\t\tconstraints = append(constraints, constr)\n\t\t\t\t}\n\t\t\t\tskip = true\n\t\t\t\tskipcount = 3\n\t\t\t\tcontinue argloop\n\n\t\t\tcase `on`:\n\t\t\t\tresult[`on/type`] = append(result[`on/type`],\n\t\t\t\t\targs[pos+1])\n\t\t\t\tresult[`on/object`] = append(result[`on/object`],\n\t\t\t\t\targs[pos+2])\n\t\t\t\t// set for required+unique checks\n\t\t\t\tresult[val] = append(result[val], fmt.Sprintf(\n\t\t\t\t\t\"%s::%s\", args[pos+1], args[pos+2]))\n\t\t\t\tskip = true\n\t\t\t\tskipcount = 2\n\t\t\t\tcontinue argloop\n\n\t\t\tdefault:\n\t\t\t\t// regular key/value keyword\n\t\t\t\tresult[val] = append(result[val], args[pos+1])\n\t\t\t\tskip = true\n\t\t\t\tskipcount = 1\n\t\t\t\tcontinue argloop\n\t\t\t}\n\t\t}\n\t\t// error is reached if argument was not skipped and not a\n\t\t// recognized keyword\n\t\terrors = append(errors, fmt.Sprintf(\"Syntax error, erroneus\"+\n\t\t\t\" argument: %s\", val))\n\t}\n\n\t// check if all required keywords were collected\n\tfor _, key := range required {\n\t\tif _, ok := result[key]; !ok {\n\t\t\terrors = append(errors, fmt.Sprintf(\"Syntax error,\"+\n\t\t\t\t\" missing keyword: %s\", key))\n\t\t}\n\t}\n\n\t// check if unique keywords were only specuified once\n\tfor _, key := range unique {\n\t\t// check ok since unique may still be optional\n\t\tif sl, ok := result[key]; ok && (len(sl) > 1) {\n\t\t\terrors = append(errors, fmt.Sprintf(\"Syntax error,\"+\n\t\t\t\t\" keyword must only be provided once: %s\", key))\n\t\t}\n\t}\n\nabort:\n\tif len(errors) > 0 {\n\t\treturn fmt.Errorf(combineStrings(errors...))\n\t}\n\n\treturn nil\n}", "func (s service) checkArgs() error {\n\tif len(s.args) < 1 {\n\t\treturn errors.New(\"no file added as a command line argument\")\n\t}\n\n\tif s.args[0] == \"\" {\n\t\treturn errors.New(\"filename cannot be empty\")\n\t}\n\n\treturn nil\n}", "func ValidateVarArgs(args []string, v validate.Argument) error {\n\tif len(args) == 0 {\n\t\treturn ErrNotEnoughArgs\n\t}\n\n\tfor _, arg := range args {\n\t\tif ok := v.Validate(arg); !ok {\n\t\t\treturn fmt.Errorf(InvalidArg, v.Name, arg, v.Validate.TypeName())\n\t\t}\n\t}\n\n\treturn nil\n}", "func checkAtLeastArgs(nargs int, errMsg string) func(cmd *cobra.Command, args []string) error {\n\treturn func(cmd *cobra.Command, args []string) error {\n\t\tif len(args) < nargs {\n\t\t\treturn errors.Errorf(errMsg)\n\t\t}\n\t\treturn nil\n\t}\n}", "func (h *FuncHandler) CheckArgs(check func(cmd *cobra.Command, args []string) error) func(cmd *cobra.Command, args []string) error {\n\treturn func(cmd *cobra.Command, args []string) error {\n\t\treturn check(cmd, args)\n\t}\n}", "func validateArgs(linkIndex int, fn reflect.Type, args []Argument) error {\n\tif !fn.IsVariadic() && (fn.NumIn() != len(args)) {\n\t\treturn argumentMismatchError(linkIndex, len(args), fn.NumIn())\n\t}\n\n\treturn nil\n}", "func checkArgs() error {\n\tnargs := len(os.Args)\n\tpiped := isPiped()\n\tswitch {\n\tcase (2 != nargs) && piped:\n\t\treturn PipeArgErr\n\tcase (3 != nargs) && !piped:\n\t\treturn FileArgErr\n\t}\n\treturn nil\n}", "func (o *Options) validate(args []string) error {\n\tif len(args) != 0 {\n\t\treturn errors.New(\"arguments are not supported\")\n\t}\n\treturn nil\n}", "func validateArgs() {\n\tif *optionsEndpoint == \"\" {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n\tif *inputEndpoint == \"\" {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n\tif *outputEndpoint == \"\" {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n}", "func validArgs(args *runtimeArgs) bool {\n\tflag.Usage = showHelp\n\n\targs.fg = flag.String(\"fg\", \"black\", \"foreground color\")\n\targs.bg = flag.String(\"bg\", \"green\", \"background color\")\n\n\tflag.Parse()\n\n\tif args.fg == nil || hue.StringToHue[*args.fg] == 0 {\n\t\tbadColor(*args.fg) // prints an error message w/ a list of supported colors\n\t\treturn false\n\t}\n\n\tif args.fg == nil || hue.StringToHue[*args.bg] == 0 {\n\t\tbadColor(*args.bg)\n\t\treturn false\n\t}\n\n\t// Get the remaining flags, which should\n\t// consist of a pattern, and optionally, one or more file names.\n\trem := flag.Args()\n\n\tswitch {\n\tcase len(rem) == 0:\n\t\tfmt.Println(\"Error: No pattern specified.\")\n\t\tshowHelp()\n\t\treturn false\n\tcase len(rem) == 1:\n\t\targs.pattern = &rem[0]\n\tcase len(rem) >= 2:\n\t\targs.pattern = &rem[0]\n\n\t\tfor i := 1; i < len(rem); i++ {\n\t\t\targs.files = append(args.files, &rem[i])\n\t\t}\n\t}\n\n\treturn true\n}", "func (a *PersonArguments) Validate() error {\n\treturn nil\n}", "func (o *ChonkOptions) Validate() error {\n\tif len(o.args) > 0 {\n\t\treturn fmt.Errorf(\"no arguments expected\")\n\t}\n\n\treturn nil\n}", "func ValidateArgCount(expectedArgNo, argNo int) error {\n\tswitch {\n\tcase expectedArgNo < argNo:\n\t\treturn ErrUnexpectedArgs\n\tcase expectedArgNo > argNo:\n\t\treturn ErrNotEnoughArgs\n\tcase expectedArgNo == argNo:\n\t}\n\n\treturn nil\n}", "func (rv *RemoveValidator) ValidateArgs(args []string) error {\n\tfor _, arg := range args {\n\t\tif !validpath.Valid(arg) {\n\t\t\treturn fmt.Errorf(\"%s is not a valid argument\", arg)\n\t\t}\n\t}\n\tif len(args) != 1 {\n\t\treturn fmt.Errorf(\"Expected there to be 1 argument, but got %d\", len(args))\n\t}\n\treturn nil\n}", "func (m *Arg) Validate() error {\n\tif m.Options != nil {\n\t\tfor _, r := range *m.Options {\n\t\t\tif err := r.Validate(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func VerifyRequiredArgs(c *Command, required []string) *Result {\n for _, arg := range required {\n _, r := getArgument(c, arg)\n if r != nil { return r }\n }\n return nil\n}", "func validateProgramArgs() {\n\tif *version {\n\t\tshowVersion()\n\t}\n\n\tif *helpUsage {\n\t\tusage(0)\n\t}\n\n\tif *helpFull {\n\t\tshowHelp(0)\n\t}\n\n\tif *LocalFolderPath == \"\" ||\n\t\t(*dpUsername != \"\" && *dpRestURL == \"\" && *dpSomaURL == \"\") {\n\t\tusage(1)\n\t}\n\n}", "func (a *EmployeeArguments) Validate() error {\n\tif a.Work != nil {\n\t\treturn a.Work.Validate()\n\t}\n\n\treturn nil\n}", "func checkForArgErrors(token string, platform string) error {\n\tif token == \"\" {\n\t\treturn errors.New(\"Token needs to be a device token\")\n\t} else if platform != PlatformIos && platform != PlatformAndroid {\n\t\treturn errors.New(\"Platform must be either PlatformIos or PlatformAndroid\")\n\t}\n\treturn nil\n}", "func IsCommandLineArguments(id PackageID) bool {\n\treturn strings.Contains(string(id), \"command-line-arguments\")\n}", "func IsExactArgs(number int) cobra.PositionalArgs {\n\treturn func(cmd *cobra.Command, args []string) error {\n\t\tif len(args) == number {\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\n\t\t\t\"%q requires exactly %d %s.\\nSee '%s --help'.\\n\\nUsage: %s\\n\\n%s\",\n\t\t\tcmd.CommandPath(),\n\t\t\tnumber,\n\t\t\t\"argument(s)\",\n\t\t\tcmd.CommandPath(),\n\t\t\tcmd.UseLine(),\n\t\t\tcmd.Short,\n\t\t)\n\t}\n}", "func (m *CommandError) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateArguments(formats); err != nil {\n\t\t// prop\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}", "func (o PruneBuildsOptions) Validate() error {\n\tif o.KeepYoungerThan < 0 {\n\t\treturn fmt.Errorf(\"--keep-younger-than must be greater than or equal to 0\")\n\t}\n\tif o.KeepComplete < 0 {\n\t\treturn fmt.Errorf(\"--keep-complete must be greater than or equal to 0\")\n\t}\n\tif o.KeepFailed < 0 {\n\t\treturn fmt.Errorf(\"--keep-failed must be greater than or equal to 0\")\n\t}\n\treturn nil\n}", "func checkNoArguments(_ *cobra.Command, args []string) error {\n\tif len(args) > 0 {\n\t\treturn errors.New(\"this command doesn't support any arguments\")\n\t}\n\n\treturn nil\n}", "func (o *Options) Validate() error {\n\tif len(o.args) > 0 {\n\t\treturn errors.New(\"no argument is allowed\")\n\t}\n\tif o.useServicePrincipal && o.useUserPrincipal {\n\t\treturn errors.New(\"service principal and user principal cannot be used at the same time\")\n\t}\n\treturn nil\n}", "func (args *DataArgs) Check() *constant.YiError {\n\tif args.ReqBufferCap == 0 {\n\t\treturn constant.NewYiErrorf(constant.ERR_ARGS, \"Zero request buffer capacity.\")\n\t}\n\tif args.ReqMaxBufferNumber == 0 {\n\t\treturn constant.NewYiErrorf(constant.ERR_ARGS, \"Zero max request buffer number.\")\n\t}\n\tif args.RespBufferCap == 0 {\n\t\treturn constant.NewYiErrorf(constant.ERR_ARGS, \"Zero response buffer capacity.\")\n\t}\n\tif args.RespMaxBufferNumber == 0 {\n\t\treturn constant.NewYiErrorf(constant.ERR_ARGS, \"Zero max response buffer capacity.\")\n\t}\n\tif args.ItemBufferCap == 0 {\n\t\treturn constant.NewYiErrorf(constant.ERR_ARGS, \"Zero item buffer capacity.\")\n\t}\n\tif args.ItemMaxBufferNumber == 0 {\n\t\treturn constant.NewYiErrorf(constant.ERR_ARGS, \"Zero max item buffer capatity.\")\n\t}\n\tif args.ErrorBufferCap == 0 {\n\t\treturn constant.NewYiErrorf(constant.ERR_ARGS, \"Zero error buffer capacity.\")\n\t}\n\tif args.ErrorMaxBufferNumber == 0 {\n\t\treturn constant.NewYiErrorf(constant.ERR_ARGS, \"Zero max error buffer number.\")\n\t}\n\treturn nil\n}", "func (r Describe) validation(cmd *cobra.Command, args []string) error {\n\tif err := require.MaxArgs(args, 3); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *UsersSetActiveCall) ValidateArgs() error {\n\treturn nil\n}", "func CheckNumArgs(num int, args []string, usage string) error {\n\tif len(os.Args) != num {\n\t\tvar errString string\n\t\tif len(os.Args) >= 1 {\n\t\t\terrString = fmt.Sprintf(\"Incorrect usage should do: %s %s\", args[0], usage)\n\t\t} else {\n\t\t\terrString = fmt.Sprintf(\"Incorrect usage should do: scriptname %s\", usage)\n\t\t}\n\t\treturn errors.New(errString)\n\t}\n\treturn nil\n}", "func checkArgValue(v string, found bool, def cmdkit.Argument) error {\n\tif def.Variadic && def.SupportsStdin {\n\t\treturn nil\n\t}\n\n\tif !found && def.Required {\n\t\treturn fmt.Errorf(\"argument %q is required\", def.Name)\n\t}\n\n\treturn nil\n}", "func CheckArgsNotMultiColumnRow(args ...Expression) error {\n\ttrace_util_0.Count(_util_00000, 151)\n\tfor _, arg := range args {\n\t\ttrace_util_0.Count(_util_00000, 153)\n\t\tif GetRowLen(arg) != 1 {\n\t\t\ttrace_util_0.Count(_util_00000, 154)\n\t\t\treturn ErrOperandColumns.GenWithStackByArgs(1)\n\t\t}\n\t}\n\ttrace_util_0.Count(_util_00000, 152)\n\treturn nil\n}", "func (c *UsersDeletePhotoCall) ValidateArgs() error {\n\treturn nil\n}", "func OnlyValidArgs(cmd *Command, args []string) error {\n\tif len(cmd.ValidArgs) > 0 {\n\t\t// Remove any description that may be included in ValidArgs.\n\t\t// A description is following a tab character.\n\t\tvar validArgs []string\n\t\tfor _, v := range cmd.ValidArgs {\n\t\t\tvalidArgs = append(validArgs, strings.Split(v, \"\\t\")[0])\n\t\t}\n\t\tfor _, v := range args {\n\t\t\tif !stringInSlice(v, validArgs) {\n\t\t\t\treturn fmt.Errorf(\"invalid argument %q for %q%s\", v, cmd.CommandPath(), cmd.findSuggestions(args[0]))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func verifyArgs() (bool, string) {\n\tvar errMsg string\n\tvar webhookURL string\n\n\tif *auth == \"\" {\n\t\terrMsg = \"Invalid authentication! It must not be empty.\\n\"\n\t\treturn false, errMsg\n\t}\n\n\tif *address == \"\" {\n\t\terrMsg = \"Invalid URL! It must not be empty.\\n\"\n\t\treturn false, errMsg\n\t}\n\n\tif *port < 1025 || *port > 65535 {\n\t\terrMsg = \"Invalid port! Please, check it is between 1025 and 65535.\\n\"\n\t\treturn false, errMsg\n\t}\n\n\tif *prefix != \"\" {\n\t\t*prefix = strings.Trim(*prefix, \"/\")\n\t}\n\n\twebhookURL = fmt.Sprintf(\"%s:%d\", *address, *port)\n\n\treturn true, webhookURL\n}", "func ParseArguments() {\n\t/** Initializing system */\n\tconfigParams := InitSystem()\n\n\t/** Parse arguments */\n\tglobalFlags()\n\tkubectl(configParams)\n\tdockerBuild(configParams)\n\thelm(configParams)\n\n\t/** Default behavior */\n\tAlert(\"ERR\", \"This command doesn't exists!\", false)\n\tos.Exit(1)\n}", "func checkArguments(url, dir string) {\n\tif !httputil.IsURL(url) {\n\t\tprintErrorAndExit(\"Url %s doesn't look like valid url\", url)\n\t}\n\n\tif !fsutil.IsExist(dir) {\n\t\tprintErrorAndExit(\"Directory %s does not exist\", dir)\n\t}\n\n\tif !fsutil.IsDir(dir) {\n\t\tprintErrorAndExit(\"Target %s is not a directory\", dir)\n\t}\n\n\tif !fsutil.IsReadable(dir) {\n\t\tprintErrorAndExit(\"Directory %s is not readable\", dir)\n\t}\n\n\tif !fsutil.IsExecutable(dir) {\n\t\tprintErrorAndExit(\"Directory %s is not executable\", dir)\n\t}\n}", "func VerifyCommitArgs(apr *argparser.ArgParseResults) error {\n\tif apr.Contains(AllowEmptyFlag) && apr.Contains(SkipEmptyFlag) {\n\t\treturn fmt.Errorf(\"error: cannot use both --allow-empty and --skip-empty\")\n\t}\n\n\treturn nil\n}", "func (v *requiredArgValidator) Validate(val interface{}) error {\n\tswitch tv := val.(type) {\n\t// don't care\n\tcase bool:\n\t\treturn nil\n\tcase *bool:\n\t\treturn nil\n\n\t// number cannot be zero\n\tcase int, float64:\n\t\tif tv != 0 {\n\t\t\treturn nil\n\t\t}\n\tcase *int:\n\t\tif *tv != 0 {\n\t\t\treturn nil\n\t\t}\n\tcase *float64:\n\t\tif *tv != 0 {\n\t\t\treturn nil\n\t\t}\n\n\t// string cannot be empty\n\tcase string:\n\t\tif tv != \"\" {\n\t\t\treturn nil\n\t\t}\n\tcase *string:\n\t\tif *tv != \"\" {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn errors.New(\"val is required\")\n}", "func sanitize_arguments(strs []string) error {\n\tfor i, val := range strs {\n\t\tif len(val) <= 0 {\n\t\t\treturn errors.New(\"Argument \" + strconv.Itoa(i) + \" must be a non-empty string\")\n\t\t}\n\t\t// if len(val) > 32 {\n\t\t// \treturn errors.New(\"Argument \" + strconv.Itoa(i) + \" must be <= 32 characters\")\n\t\t// }\n\t}\n\treturn nil\n}", "func (c *CommandContext) RequireExactlyNArgs(n int) {\n\tif len(c.Args) != n {\n\t\tc.UsageExit()\n\t}\n}", "func (o *GrowManifestOptions) Validate() error {\n\tif o.BaseDir == \"\" {\n\t\treturn xerrors.New(\"must specify --base_dir\")\n\t}\n\n\tif o.StagingRepo == \"\" {\n\t\treturn xerrors.New(\"must specify --staging_repo\")\n\t}\n\n\tif o.FilterTag == latestTag {\n\t\treturn xerrors.Errorf(\n\t\t\t\"--filter_tag cannot be %q (anti-pattern)\", latestTag)\n\t}\n\treturn nil\n}", "func (m *Permission_Condition) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tswitch m.ConditionSpec.(type) {\n\n\tcase *Permission_Condition_Header:\n\n\t\tif v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\treturn Permission_ConditionValidationError{\n\t\t\t\t\tField: \"Header\",\n\t\t\t\t\tReason: \"embedded message failed validation\",\n\t\t\t\t\tCause: err,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\tcase *Permission_Condition_DestinationIps:\n\n\t\tif v, ok := interface{}(m.GetDestinationIps()).(interface{ Validate() error }); ok {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\treturn Permission_ConditionValidationError{\n\t\t\t\t\tField: \"DestinationIps\",\n\t\t\t\t\tReason: \"embedded message failed validation\",\n\t\t\t\t\tCause: err,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\tcase *Permission_Condition_DestinationPorts:\n\n\t\tif v, ok := interface{}(m.GetDestinationPorts()).(interface{ Validate() error }); ok {\n\t\t\tif err := v.Validate(); err != nil {\n\t\t\t\treturn Permission_ConditionValidationError{\n\t\t\t\t\tField: \"DestinationPorts\",\n\t\t\t\t\tReason: \"embedded message failed validation\",\n\t\t\t\t\tCause: err,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn nil\n}", "func TestValidArguments(t *testing.T) {\n\ttesttype.SkipUnlessTestType(t, testtype.UnitTestType)\n\n\tConvey(\"With a MongoFiles instance\", t, func() {\n\t\tmf := simpleMockMongoFilesInstanceWithFilename(\"search\", \"file\")\n\t\tConvey(\"It should error out when no arguments fed\", func() {\n\t\t\targs := []string{}\n\t\t\terr := mf.ValidateCommand(args)\n\t\t\tSo(err, ShouldNotBeNil)\n\t\t\tSo(err.Error(), ShouldEqual, \"no command specified\")\n\t\t})\n\n\t\tConvey(\"(list|delete|search|get_id|delete_id) should error out when more than 1 positional argument (except URI) is provided\", func() {\n\t\t\tfor _, command := range []string{\"list\", \"delete\", \"search\", \"get_id\", \"delete_id\"} {\n\t\t\t\targs := []string{command, \"arg1\", \"arg2\"}\n\t\t\t\terr := mf.ValidateCommand(args)\n\t\t\t\tSo(err, ShouldNotBeNil)\n\t\t\t\tSo(err.Error(), ShouldEqual, \"too many non-URI positional arguments (If you are trying to specify a connection string, it must begin with mongodb:// or mongodb+srv://)\")\n\t\t\t}\n\t\t})\n\n\t\tConvey(\"put_id should error out when more than 3 positional argument provided\", func() {\n\t\t\targs := []string{\"put_id\", \"arg1\", \"arg2\", \"arg3\"}\n\t\t\terr := mf.ValidateCommand(args)\n\t\t\tSo(err, ShouldNotBeNil)\n\t\t\tSo(err.Error(), ShouldEqual, \"too many non-URI positional arguments (If you are trying to specify a connection string, it must begin with mongodb:// or mongodb+srv://)\")\n\t\t})\n\n\t\tConvey(\"put_id should error out when only 1 positional argument provided\", func() {\n\t\t\targs := []string{\"put_id\", \"arg1\"}\n\t\t\terr := mf.ValidateCommand(args)\n\t\t\tSo(err, ShouldNotBeNil)\n\t\t\tSo(err.Error(), ShouldEqual, fmt.Sprintf(\"'%v' argument(s) missing\", \"put_id\"))\n\t\t})\n\n\t\tConvey(\"It should not error out when list command isn't given an argument\", func() {\n\t\t\targs := []string{\"list\"}\n\t\t\tSo(mf.ValidateCommand(args), ShouldBeNil)\n\t\t\tSo(mf.StorageOptions.LocalFileName, ShouldEqual, \"\")\n\t\t})\n\n\t\tConvey(\"It should not error out when the get command is given multiple supporting arguments\", func() {\n\t\t\targs := []string{\"get\", \"foo\", \"bar\", \"baz\"}\n\t\t\tSo(mf.ValidateCommand(args), ShouldBeNil)\n\t\t\tSo(mf.FileNameList, ShouldResemble, []string{\"foo\", \"bar\", \"baz\"})\n\t\t})\n\n\t\tConvey(\"It should not error out when the put command is given multiple supporting arguments\", func() {\n\t\t\targs := []string{\"put\", \"foo\", \"bar\", \"baz\"}\n\t\t\tSo(mf.ValidateCommand(args), ShouldBeNil)\n\t\t\tSo(mf.FileNameList, ShouldResemble, []string{\"foo\", \"bar\", \"baz\"})\n\t\t})\n\n\t\tConvey(\"It should error out when any of (get|put|delete|search|get_id|delete_id) not given supporting argument\", func() {\n\t\t\tfor _, command := range []string{\"get\", \"put\", \"delete\", \"search\", \"get_id\", \"delete_id\"} {\n\t\t\t\targs := []string{command}\n\t\t\t\terr := mf.ValidateCommand(args)\n\t\t\t\tSo(err, ShouldNotBeNil)\n\t\t\t\tSo(err.Error(), ShouldEqual, fmt.Sprintf(\"'%v' argument missing\", command))\n\t\t\t}\n\t\t})\n\n\t\tConvey(\"It should error out when a nonsensical command is given\", func() {\n\t\t\targs := []string{\"commandnonexistent\"}\n\n\t\t\terr := mf.ValidateCommand(args)\n\t\t\tSo(err, ShouldNotBeNil)\n\t\t\tSo(err.Error(), ShouldEqual, fmt.Sprintf(\"'%v' is not a valid command (If you are trying to specify a connection string, it must begin with mongodb:// or mongodb+srv://)\", args[0]))\n\t\t})\n\n\t})\n}", "func (o *CreateDeploymentOptions) Validate() error {\n\tif len(o.Images) > 1 && len(o.Command) > 0 {\n\t\treturn fmt.Errorf(\"cannot specify multiple --image options and command\")\n\t}\n\treturn nil\n}", "func (c *Compiler) checkBuiltinArgs() {\n\tfor _, m := range c.Modules {\n\t\tfor _, r := range m.Rules {\n\t\t\tfor _, expr := range r.Body {\n\t\t\t\tif ts, ok := expr.Terms.([]*Term); ok {\n\t\t\t\t\tif bi, ok := BuiltinMap[ts[0].Value.(Var)]; ok {\n\t\t\t\t\t\tif bi.NumArgs != len(ts[1:]) {\n\t\t\t\t\t\t\tc.err(expr.Location.Errorf(\"%v: wrong number of arguments (expression %s must specify %d arguments to built-in function %v)\", r.Name, expr.Location.Text, bi.NumArgs, ts[0]))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (c *Condition) arguments() []interface{} {\n\tvar arguments []interface{}\n\targuments = append(arguments, c.args[ON]...)\n\targuments = append(arguments, c.args[WHERE]...)\n\targuments = append(arguments, c.args[HAVING]...)\n\treturn arguments\n}", "func (args *ModuleArgs) Check() *constant.YiError {\n\tif args.Downloader == nil {\n\t\treturn constant.NewYiErrorf(constant.ERR_SCHEDULER_ARGS, \"Nil downloader.\")\n\t}\n\tif args.Analyzer == nil {\n\t\treturn constant.NewYiErrorf(constant.ERR_SCHEDULER_ARGS, \"Nil analyzer.\")\n\t}\n\tif args.Pipeline == nil {\n\t\treturn constant.NewYiErrorf(constant.ERR_SCHEDULER_ARGS, \"Nil pipeline.\")\n\t}\n\treturn nil\n}", "func (DockerBuildArgs) validate() error {\n\treturn nil\n}", "func ValidStringArgs(possibilities []string, received string) bool {\n\tfor _, possible := range possibilities {\n\t\tif possible == received {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func validateCommandSyntax(args ...string) bool {\n\tif len(args) < 4 {\n\t\treturn false\n\t}\n\n\tnewArgs := args\n\tif newArgs[0] == \"sudo\" && newArgs[1] == \"--preserve-env\" {\n\t\tnewArgs = newArgs[2:]\n\t}\n\n\tcmdTree := supportedCommandTree\n\t// check each argument one by one\n\tfor index, arg := range newArgs {\n\t\tif v, ok := cmdTree[arg]; ok {\n\t\t\tif index+1 == len(newArgs) {\n\t\t\t\treturn v == nil\n\t\t\t}\n\t\t\tcmdTree = v.(map[string]interface{})\n\t\t} else {\n\t\t\tmatched := false\n\t\t\tfor k, v := range cmdTree {\n\t\t\t\tif matched, _ = regexp.MatchString(k, arg); matched {\n\t\t\t\t\tif index+1 == len(newArgs) {\n\t\t\t\t\t\treturn v == nil\n\t\t\t\t\t}\n\t\t\t\t\tcmdTree = v.(map[string]interface{})\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !matched {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true\n}", "func (c *UsergroupsUsersListCall) ValidateArgs() error {\n\tif len(c.usergroup) <= 0 {\n\t\treturn errors.New(`required field usergroup not initialized`)\n\t}\n\treturn nil\n}", "func checkNumberOfArgs(name string, nargs, nresults, min, max int) error {\n\tif min == max {\n\t\tif nargs != max {\n\t\t\treturn ExceptionNewf(TypeError, \"%s() takes exactly %d arguments (%d given)\", name, max, nargs)\n\t\t}\n\t} else {\n\t\tif nargs > max {\n\t\t\treturn ExceptionNewf(TypeError, \"%s() takes at most %d arguments (%d given)\", name, max, nargs)\n\t\t}\n\t\tif nargs < min {\n\t\t\treturn ExceptionNewf(TypeError, \"%s() takes at least %d arguments (%d given)\", name, min, nargs)\n\t\t}\n\t}\n\n\tif nargs > nresults {\n\t\treturn ExceptionNewf(TypeError, \"Internal error: not enough arguments supplied to Unpack*/Parse*\")\n\t}\n\treturn nil\n}", "func (c *modAccountRun) validate(args []string) error {\n\tif len(args) < 2 {\n\t\treturn errors.New(\"not enough arguments\")\n\t}\n\n\tif len(args) > 2 {\n\t\treturn errors.New(\"too many arguments\")\n\t}\n\n\treturn nil\n}", "func parseArguments() service.Arguments {\n args := service.ParseArguments()\n _, err := args.IsValid()\n\n if err == nil {\n return args\n }\n\n if service.IsUnknownArgumentsError(err) {\n flag.Usage()\n os.Exit(ERR_WRONG_USAGE)\n return args\n }\n\n StdErr.Write([]byte(err.Error() + \"\\n\"))\n os.Exit(ERR_WRONG_USAGE)\n\n return args\n}", "func sanitize_arguments(strs []string) error{\n\tfor i, val:= range strs {\n\t\tif len(val) <= 0 {\n\t\t\treturn errors.New(\"Argument \" + strconv.Itoa(i) + \" must be a non-empty string\")\n\t\t}\n\t\tif len(val) > 32 {\n\t\t\treturn errors.New(\"Argument \" + strconv.Itoa(i) + \" must be <= 32 characters\")\n\t\t}\n\t}\n\treturn nil\n}", "func sanitize_arguments(strs []string) error{\n\tfor i, val:= range strs {\n\t\tif len(val) <= 0 {\n\t\t\treturn errors.New(\"Argument \" + strconv.Itoa(i) + \" must be a non-empty string\")\n\t\t}\n\t\tif len(val) > 32 {\n\t\t\treturn errors.New(\"Argument \" + strconv.Itoa(i) + \" must be <= 32 characters\")\n\t\t}\n\t}\n\treturn nil\n}", "func ValidateFlags(args ...string) error {\n\tfor _, arg := range args {\n\t\tif arg == \"\" {\n\t\t\treturn errors.New(\"Missing flag\")\n\t\t}\n\t}\n\treturn nil\n}", "func RangeArgs(min int, max int) PositionalArgs {\n\treturn func(cmd *Command, args []string) error {\n\t\tif len(args) < min || len(args) > max {\n\t\t\treturn fmt.Errorf(\"accepts between %d and %d arg(s), received %d\", min, max, len(args))\n\t\t}\n\t\treturn nil\n\t}\n}", "func validateFetchArgs(apr *argparser.ArgParseResults, refSpecArgs []string) error {\n\tif len(refSpecArgs) > 0 && apr.Contains(cli.PruneFlag) {\n\t\t// The current prune implementation assumes that we're processing branch specs, which\n\t\treturn fmt.Errorf(\"--prune option cannot be provided with a ref spec\")\n\t}\n\n\treturn nil\n}", "func (o ModuleOptions) Validate(c *cobra.Command, args []string) error {\n\tif len(o.falcoVersion) == 0 {\n\t\treturn fmt.Errorf(\"missing Falco version: specify it via FALCOCTL_FALCO_VERSION env variable or via --falco-version flag\")\n\t}\n\treturn nil\n}", "func validateEqualArgs(expected, actual interface{}) error {\n\tif expected == nil && actual == nil {\n\t\treturn nil\n\t}\n\n\t// NOTE: in iam policy expression, we guarantee the value will not be Function!\n\t// if isFunction(expected) || isFunction(actual) {\n\t// \treturn errors.New(\"cannot take func type as argument\")\n\t// }\n\treturn nil\n}", "func (m *Condition) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAnd(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateBetween(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateEquals(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateGreaterThan(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateGreaterThanOrEquals(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLessThan(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateLessThanOrEquals(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateNot(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOr(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}", "func (flags *Flags) Validate(args []string) error {\n\treturn nil\n}", "func (c *UsergroupsUsersUpdateCall) ValidateArgs() error {\n\tif len(c.usergroup) <= 0 {\n\t\treturn errors.New(`required field usergroup not initialized`)\n\t}\n\tif len(c.users) <= 0 {\n\t\treturn errors.New(`required field users not initialized`)\n\t}\n\treturn nil\n}", "func ValidateArg(c *cli.Context) error {\n\tvar err error\n\n\tif c.NArg() != 3 {\n\t\treturn fmt.Errorf(\"invalid number of arguments\")\n\t}\n\n\tmarket = c.Args().First()\n\n\tquantity, err = decimal.NewFromString(c.Args().Get(1))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trate, err = decimal.NewFromString(c.Args().Get(2))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsecret = Secret(c)\n\n\tkey = Key(c)\n\n\treturn nil\n}", "func (rbc *RegisterBrokerCmd) Validate(args []string) error {\n\tif len(args) < 2 {\n\t\treturn fmt.Errorf(\"name and URL are required\")\n\t}\n\n\tif rbc.basicString == \"\" {\n\t\treturn fmt.Errorf(\"--basic flag is required\")\n\t}\n\n\trbc.broker.Name = args[0]\n\trbc.broker.URL = args[1]\n\n\tif len(args) > 2 {\n\t\trbc.broker.Description = args[2]\n\t}\n\n\treturn rbc.parseCredentials()\n}", "func checkArgs() (string, bool, error) {\n\t//Fetch the command line arguments.\n\targs := os.Args\n\n\t//Check the length of the arugments, return failure if they are too\n\t//long or too short.\n\tif (len(args) < 2) || (len(args) > 3) {\n\t\treturn \"\", false, errors.New(\"Invalid number of arguments. \\n\" +\n\t\t\t\" Please provide sort option (-s) and the file name with relative path\" +\n\t\t\t\" of the csv data input file!\\n\")\n\t}\n\tfile_path := args[1]\n\tvar isSort bool\n\tif len(args) == 3 {\n\t\tif args[1] != \"-s\" {\n\t\t\treturn \"\", false, errors.New(\"Invalid number of arguments. \\n\" +\n\t\t\t\t\" Please provide sort option (-s) and the file name with relative path\" +\n\t\t\t\t\" of the csv data input file!\\n\")\n\t\t}\n\t\tisSort = true\n\t\tfile_path = args[2]\n\t}\n\t//On success, return the file_path and isSort value\n\treturn file_path, isSort, nil\n}", "func ParseCommandArguments(command string) CommandArguments {\n\tvar cleanArgs []string\n\n\tparts := strings.Split(strings.TrimSpace(command), \" \")\n\n\t// Spliting for spaces is not enough to get the clean arguments, since\n\t// two or more consecutive spaces will create an empty argument.\n\t// This cycle gets rid of \"empty\" arguments.\n\tfor _, part := range parts {\n\t\tif part != \"\" {\n\t\t\tcleanArgs = append(cleanArgs, part)\n\t\t}\n\t}\n\n\tif len(cleanArgs) == 0 {\n\t\treturn CommandArguments{}\n\t}\n\n\treturn CommandArguments{\n\t\tCommand: cleanArgs[0],\n\t\tArguments: cleanArgs[1:],\n\t}\n}", "func validateArgs() {\n\tif *inputEndpoint == \"\" {\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n}", "func (d Definition) IsValid(args ...interface{}) bool {\n\tif d.Inputs == nil {\n\t\treturn true\n\t}\n\tif len(args) != len(d.Inputs) {\n\t\treturn false\n\t}\n\tfor i, a := range args {\n\t\tswitch x := d.Inputs[i].(type) {\n\t\tcase reflect.Type:\n\t\t\txv := reflect.ValueOf(x)\n\t\t\tav := reflect.ValueOf(a)\n\t\t\tif !xv.IsNil() {\n\t\t\t\tif !av.IsValid() {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\tif ak := reflect.TypeOf(a).Kind(); (ak == reflect.Chan || ak == reflect.Func || ak == reflect.Map || ak == reflect.Ptr || ak == reflect.Slice) && av.IsNil() {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\tif !av.Type().AssignableTo(x) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\tcase reflect.Kind:\n\t\t\txv := reflect.ValueOf(x)\n\t\t\tav := reflect.ValueOf(a)\n\t\t\tif xv.IsValid() || !xv.IsNil() {\n\t\t\t\tif !av.IsValid() {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\tif xv.IsValid() && av.Type().Kind() != x {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true\n}", "func (p *Params) Check() error {\n\t// Validate Memory\n\tif p.Memory < minMemoryValue {\n\t\treturn ErrInvalidParams\n\t}\n\n\t// Validate Iterations\n\tif p.Iterations < 1 {\n\t\treturn ErrInvalidParams\n\t}\n\n\t// Validate Parallelism\n\tif p.Parallelism < 1 {\n\t\treturn ErrInvalidParams\n\t}\n\n\t// Validate salt length\n\tif p.SaltLength < minSaltLength {\n\t\treturn ErrInvalidParams\n\t}\n\n\t// Validate key length\n\tif p.KeyLength < minKeyLength {\n\t\treturn ErrInvalidParams\n\t}\n\n\treturn nil\n}", "func parseArguments() (int, int, int) {\n\tcontracts.Require(func() bool {\n\t\treturn len(os.Args) > 3\n\t}, \"The program receives number of producers, consumers and buffer size.\"+np+help)\n\n\tvar nProd, errProd = strconv.Atoi(os.Args[1])\n\tvar nCons, errCons = strconv.Atoi(os.Args[2])\n\tvar bufferSize, errBuffer = strconv.Atoi(os.Args[3])\n\n\tcontracts.Require(func() bool {\n\t\tif errProd == nil && errCons == nil && errBuffer == nil {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}, \"Arguments must be int.\"+np+help)\n\n\treturn nProd, nCons, bufferSize\n}", "func checkHYPGEOMDISTArgs(sampleS, numberSample, populationS, numberPop formulaArg) bool {\n\treturn sampleS.Number < 0 ||\n\t\tsampleS.Number > math.Min(numberSample.Number, populationS.Number) ||\n\t\tsampleS.Number < math.Max(0, numberSample.Number-numberPop.Number+populationS.Number) ||\n\t\tnumberSample.Number <= 0 ||\n\t\tnumberSample.Number > numberPop.Number ||\n\t\tpopulationS.Number <= 0 ||\n\t\tpopulationS.Number > numberPop.Number ||\n\t\tnumberPop.Number <= 0\n}" ]
[ "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.57653874", "0.576131", "0.57389265", "0.5737601", "0.5721704", "0.5698584", "0.5690564", "0.56731474", "0.5610073", "0.5585284", "0.55725694", "0.55674666", "0.5566706", "0.55654097", "0.5533836", "0.5520362", "0.5517632", "0.5494154", "0.5493635", "0.54803437", "0.5474123", "0.5471447", "0.54286134", "0.5427109", "0.54034466", "0.5350356", "0.53344834", "0.5333544", "0.53197294", "0.5319293", "0.5297318", "0.5288187", "0.528736", "0.5275282", "0.5269939", "0.52688587", "0.526829", "0.5260815", "0.5256109", "0.5255116", "0.5246197", "0.5243527", "0.5242191", "0.5221211", "0.5218033", "0.5205362", "0.5204764", "0.5188418", "0.5147854", "0.5142491", "0.51342154", "0.511612", "0.51124525", "0.5110531", "0.5108336", "0.5096577", "0.5088445", "0.5086584", "0.5079029", "0.5078516", "0.5064012", "0.50511986", "0.50511986", "0.50275844", "0.50204253", "0.5018078", "0.5015771", "0.5014227", "0.50083286", "0.5001064", "0.49960184", "0.49919978", "0.49590018", "0.4955292", "0.494804", "0.49341848", "0.4928003", "0.4923411", "0.492043", "0.49188662" ]
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\n\t// boolean comparison of isCondFiring and isCondNoData of all conditions in ConditionsCmd\n\tvar isFiring, isNoData bool\n\n\t// matches contains the list of matches for all conditions\n\tmatches := make([]EvalMatch, 0)\n\tfor i, cond := range cmd.Conditions {\n\t\tisCondFiring, isCondNoData, condMatches, err := cmd.executeCond(ctx, t, cond, vars)\n\t\tif err != nil {\n\t\t\treturn mathexp.Results{}, err\n\t\t}\n\n\t\tif i == 0 {\n\t\t\t// If this condition is the first condition evaluated in ConditionsCmd\n\t\t\t// then isFiring and isNoData must be set to the outcome of the condition\n\t\t\tisFiring = isCondFiring\n\t\t\tisNoData = isCondNoData\n\t\t} else {\n\t\t\t// If this is condition is a subsequent condition then isFiring and isNoData\n\t\t\t// must be derived from the boolean comparison of all previous conditions\n\t\t\t// and the current condition\n\t\t\tisFiring = compareWithOperator(isFiring, isCondFiring, cond.Operator)\n\t\t\tisNoData = compareWithOperator(isNoData, isCondNoData, cond.Operator)\n\t\t}\n\n\t\tmatches = append(matches, condMatches...)\n\t}\n\n\t// Start to prepare the result of the ConditionsCmd. It contains a mathexp.Number\n\t// that has a value of 1, 0, or nil, depending on whether the result is firing, normal,\n\t// or no data; and a list of matches for all conditions\n\tnumber := mathexp.NewNumber(\"\", nil)\n\tnumber.SetMeta(matches)\n\n\tvar v float64\n\t// isNoData must be checked first because it is possible for both isNoData and isFiring\n\t// to be true at the same time\n\tif isNoData {\n\t\tnumber.SetValue(nil)\n\t} else if isFiring {\n\t\tv = 1\n\t\tnumber.SetValue(&v)\n\t} else {\n\t\t// the default value of v is 0\n\t\tnumber.SetValue(&v)\n\t}\n\n\tres := mathexp.Results{}\n\tres.Values = append(res.Values, number)\n\treturn res, nil\n}", "func ExecuteCommand(cmdvalue string) bool {\n\n\tif len(cmdvalue) == 0 {\n\t\tfmt.Println(\"Pass the correct input\")\n\t\treturn false\n\t}\n\n\tif SunnyDay {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (wc *CmdCheckWrapperCommand) Execute(args []string) error {\n\tif len(args) < wc.leastNumArgs {\n\t\terr := fmt.Errorf(\"Invalid arguments.\\nUsage: supervisord ctl %v\", wc.usage)\n\t\tfmt.Printf(\"%v\\n\", err)\n\t\treturn err\n\t}\n\treturn wc.cmd.Execute(args)\n}", "func (e *Engine) ExecuteCommand(ctx context.Context, m dogma.Message) error {\n\tselect {\n\tcase <-e.ready:\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\t}\n\n\tmt := message.TypeOf(m)\n\n\tif x, ok := e.executors[mt]; ok {\n\t\treturn x.ExecuteCommand(ctx, m)\n\t}\n\n\treturn fmt.Errorf(\"no application accepts %s commands\", mt)\n}", "func (mo *MenuOption) ExecuteCommand(ev chan UIEvent) {\n\tev <- mo.Command()\n}", "func (cmd *storagePrepareCmd) Execute(args []string) error {\n\tvar nReq *ctlpb.PrepareNvmeReq\n\tvar sReq *ctlpb.PrepareScmReq\n\n\tprepNvme, prepScm, err := cmd.Validate()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif prepNvme {\n\t\tnReq = &ctlpb.PrepareNvmeReq{\n\t\t\tPciwhitelist: cmd.PCIWhiteList,\n\t\t\tNrhugepages: int32(cmd.NrHugepages),\n\t\t\tTargetuser: cmd.TargetUser,\n\t\t\tReset_: cmd.Reset,\n\t\t}\n\t}\n\n\tif prepScm {\n\t\tif err := cmd.Warn(cmd.log); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tsReq = &ctlpb.PrepareScmReq{Reset_: cmd.Reset}\n\t}\n\n\tcmd.log.Infof(\"NVMe & SCM preparation:\\n%s\",\n\t\tcmd.conns.StoragePrepare(&ctlpb.StoragePrepareReq{Nvme: nReq, Scm: sReq}))\n\n\treturn nil\n}", "func (c gosundheitCheck) Execute() (interface{}, error) { return c.checkFn() }", "func (g *GuaranteeExecutor) Execute(ctx context.Context) (err error) {\n\tdefer func() {\n\t\tif rc := recover(); rc != nil {\n\t\t\tswitch rv := rc.(type) {\n\t\t\tcase error:\n\t\t\t\terr = rv.(error)\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\terr = errors.Errorf(\"%v\", rv)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\terr = g.exec.Execute(ctx)\n\treturn\n}", "func execute(c *Command) {\n\tswitch c.Name {\n\tcase \"print\":\n\t\tfor _, v := range c.Arguments {\n\t\t\tfmt.Print(v)\n\t\t}\n\t\tfmt.Print(\"\\n\")\n\tcase \"if\":\n\t\targ := c.Arguments[0]\n\t\ttest := arg.(func() bool)\n\t\tif ok := test(); ok == true {\n\t\t\tfmt.Println(\"=> true\")\n\t\t} else {\n\t\t\tfmt.Println(\"=> false\")\n\t\t}\n\t}\n}", "func (copy Copy) Execute() (result model.Result) {\n\tm := fmt.Sprintf(\"Copy %s to %s\", copy.Source, copy.Destination)\n\tfmt.Println(m)\n\tlog.Print(m)\n\n\tvar err error\n\n\tfileInfo, err := os.Stat(copy.Source)\n\tif err != nil {\n\t\tresult.WasSuccessful = false\n\t\tresult.Message = err.Error()\n\t\treturn result\n\t}\n\n\tswitch mode := fileInfo.Mode(); {\n\tcase mode.IsDir():\n\t\terr = dir(copy.Source, copy.Destination)\n\tcase mode.IsRegular():\n\t\terr = file(copy.Source, copy.Destination)\n\t}\n\n\tif err != nil {\n\t\tresult.WasSuccessful = false\n\t\tresult.Message = err.Error()\n\t\treturn result\n\t}\n\n\tresult.WasSuccessful = true\n\tresult.Message = fmt.Sprintf(\"Copied %s to %s\", copy.Source, copy.Destination)\n\treturn result\n}", "func ExecuteCommand(r *rcon.RCON, command string) {\n\t_, err := r.Execute(command)\n\tcheck(err)\n}", "func (p *Plugin) ExecuteCommand(c *plugin.Context, args *model.CommandArgs) (*model.CommandResponse, *model.AppError) {\n\tstringArgs := strings.Split(strings.TrimSpace(args.Command), \" \")\n\tlengthOfArgs := len(stringArgs)\n\trestOfArgs := []string{}\n\n\tvar handler func([]string, *model.CommandArgs) (*model.CommandResponse, bool, error)\n\tif lengthOfArgs == 1 {\n\t\thandler = p.runListCommand\n\t} else {\n\t\tcommand := stringArgs[1]\n\t\tif lengthOfArgs > 2 {\n\t\t\trestOfArgs = stringArgs[2:]\n\t\t}\n\t\tswitch command {\n\t\tcase \"add\":\n\t\t\thandler = p.runAddCommand\n\t\tcase \"list\":\n\t\t\thandler = p.runListCommand\n\t\tcase \"start\":\n\t\t\thandler = p.runStartCommand\n\t\tdefault:\n\t\t\treturn getCommandResponse(model.COMMAND_RESPONSE_TYPE_EPHEMERAL, getHelp()), nil\n\t\t}\n\t}\n\n\tresp, isUserError, err := handler(restOfArgs, args)\n\tif err != nil {\n\t\tif isUserError {\n\t\t\treturn getCommandResponse(model.COMMAND_RESPONSE_TYPE_EPHEMERAL, fmt.Sprintf(\"__Error: %s__\\n\\nRun `/cquiz help` for usage instructions.\", err.Error())), nil\n\t\t}\n\t\tp.API.LogError(err.Error())\n\t\treturn getCommandResponse(model.COMMAND_RESPONSE_TYPE_EPHEMERAL, \"An unknown error occurred. Please talk to your system administrator for help.\"), nil\n\t}\n\n\treturn resp, nil\n}", "func (a *Assert) Execute(ctx context.OrionContext) errors.Error {\n\treturn actions.Execute(ctx, a.Base, func(ctx context.OrionContext) errors.Error {\n\t\tassertion, err := helper.GetExpressionValueAsBool(ctx.EvalContext(), a.assertion, defaultAssertion)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !assertion {\n\t\t\terr := errors.Unexpected(\"assertion is not satisfied!\")\n\t\t\tif a.assertion != nil {\n\t\t\t\treturn err.AddMeta(errors.MetaLocation, a.assertion.Range().String())\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}", "func (c *Command) Execute(ctx context.Context) error {\n\n\tpctx := &commandContext{\n\t\tdependencyResolver: pipeline.NewDependencyRecorder[*commandContext](),\n\t\tContext: ctx,\n\t}\n\n\tp := pipeline.NewPipeline[*commandContext]().WithBeforeHooks(pipe.DebugLogger[*commandContext](c.Log), pctx.dependencyResolver.Record)\n\tp.WithSteps(\n\t\tp.NewStep(\"create client\", c.createClient),\n\t\tp.NewStep(\"fetch task\", c.fetchTask),\n\t\tp.NewStep(\"list intermediary files\", c.listIntermediaryFiles),\n\t\tp.NewStep(\"delete intermediary files\", c.deleteFiles),\n\t\tp.NewStep(\"delete source file\", c.deleteSourceFile),\n\t)\n\n\treturn p.RunWithContext(pctx)\n}", "func (c VersionCommand) Execute(args []string) error {\n\tfmt.Printf(\"%s version %s build %s\\n\", c.Name, c.Version, c.Build)\n\treturn nil\n}", "func (m *Machine) ExecuteCommand(command string) {\n\tseparateRegexp := `[\\w.-]+`\n\tr := regexp.MustCompile(separateRegexp)\n\tallCommands := r.FindAllString(command, -1)\n\n\tfor _, s := range allCommands {\n\t\t_, err := strconv.ParseFloat(s, 32)\n\t\tif err != nil {\n\t\t\taction := strings.Split(s, \"-\")\n\t\t\tif strings.EqualFold(action[0], \"GET\") && len(action) > 1 {\n\t\t\t\terr := m.SellItem(action[1])\n\t\t\t\tif err != nil {\n\t\t\t\t\tm.logger.Printf(\"Error selling item, %s\", err)\n\t\t\t\t}\n\t\t\t} else if strings.EqualFold(action[0], \"RETURN\") && len(action) > 1 && strings.EqualFold(action[0], \"COIN\") {\n\t\t\t\tm.ReturnCoins()\n\t\t\t} else if strings.EqualFold(s, \"SERVICE\") {\n\t\t\t\tm.DefaultService()\n\t\t\t\tm.logger.Println(\"SERVICE in progress\")\n\t\t\t} else {\n\t\t\t\tm.logger.Println(\"Invalid command, please try again\")\n\t\t\t}\n\t\t} else {\n\t\t\terr = m.InsertCoins(s)\n\t\t\tif err != nil {\n\t\t\t\tm.logger.Printf(\"%s, %s\", err, s)\n\t\t\t}\n\t\t}\n\n\t}\n\n}", "func Execute() error {\n\treturn cmd.Execute()\n}", "func (runner *McRunner) executeCommand(command string) {\n\trunner.inMutex.Lock()\n\tdefer runner.inMutex.Unlock()\n\n\trunner.inPipe.Write([]byte(command))\n\trunner.inPipe.Write([]byte(\"\\n\"))\n}", "func (c *Command) Execute() {\n\targs := os.Args[1:]\n\tswitch argsLen := len(args); {\n\tcase argsLen == 1:\n\t\tc.Run(args)\n\tdefault:\n\t\tlog.Println(\"our service currently handle 1 command only\")\n\t}\n}", "func Execute() {\n\tmainCmd.Execute()\n}", "func (sc *StatusCommand) Execute(args []string) error {\n\tctlCommand.status(ctlCommand.createRPCClient(), args)\n\treturn nil\n}", "func Execute() {\n\tcmd := arrangeCommands()\n\n\tif err := cmd.Execute(); err != nil {\n\t\tlog.LogError(err)\n\t\tos.Exit(1)\n\t}\n}", "func (c *Command) Execute(user string, msg string, args []string) {\n}", "func (a *ServerQueryAPI) ExecuteCommand(\n\tctx context.Context,\n\tcommand Command,\n) (interface{}, error) {\n\tdoneCh := make(chan error, 1)\n\tmc, err := MarshalCommand(command)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpendCommand := &pendingCommand{\n\t\tctx: ctx,\n\t\tcommand: mc,\n\t\tresult: command.GetResponseType(),\n\t\tdoneCh: doneCh,\n\t}\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn nil, context.Canceled\n\tcase a.commandQueue <- pendCommand:\n\t}\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn nil, context.Canceled\n\tcase err, ok := <-doneCh:\n\t\tif !ok {\n\t\t\treturn nil, context.Canceled\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn pendCommand.result, nil\n\t}\n}", "func (err *ErrBytesRecv) Execute() error {\n\treturn executeCommand(err.config)\n}", "func (p *Plugin) ExecuteCommand(c *plugin.Context, args *model.CommandArgs) (*model.CommandResponse, *model.AppError) {\n\n\tcArgs, err := p.extractCommandArgs(args.Command)\n\n\tif err != nil {\n\t\treturn p.postEphemeral(\"Could not extract command arguments\"), nil\n\t}\n\n\tif cArgs[0] == \"/\"+commandTriggerHooks {\n\t\treturn p.executeCommandHooks(args), nil\n\t}\n\n\treturn &model.CommandResponse{\n\t\tResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL,\n\t\tText: fmt.Sprintf(\"Unknown command: \" + args.Command),\n\t}, nil\n}", "func Execute() {\n\tif err := searchCmd.Execute(); err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n}", "func (p *Plugin) ExecuteCommand(c *plugin.Context, args *model.CommandArgs) (*model.CommandResponse, *model.AppError) {\n\tsplit := strings.Fields(args.Command)\n\tif len(split) < 2 {\n\t\treturn p.executeCommandHelp(args), nil\n\t}\n\n\taction := split[1]\n\n\t//nolint:goconst\n\tswitch action {\n\tcase \"add\":\n\t\treturn p.executeCommandAdd(args), nil\n\tcase \"label\":\n\t\treturn p.executeCommandLabel(args), nil\n\tcase \"remove\":\n\t\treturn p.executeCommandRemove(args), nil\n\tcase \"view\":\n\t\treturn p.executeCommandView(args), nil\n\tcase \"help\":\n\t\treturn p.executeCommandHelp(args), nil\n\n\tdefault:\n\t\treturn p.responsef(args, fmt.Sprintf(\"Unknown command: \"+args.Command)), nil\n\t}\n}", "func (ctrl *PGCtrl) Execute(q string) error {\n\t_, err := ctrl.conn.Exec(q)\n\treturn err\n}", "func (w *waitForBoundPVCsMeasurement) Execute(config *measurement.MeasurementConfig) ([]measurement.Summary, error) {\n\tdesiredPVCCount, err := util.GetInt(config.Params, \"desiredPVCCount\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tselector := measurementutil.NewObjectSelector()\n\tif err := selector.Parse(config.Params); err != nil {\n\t\treturn nil, err\n\t}\n\ttimeout, err := util.GetDurationOrDefault(config.Params, \"timeout\", defaultWaitForPVCsTimeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstopCh := make(chan struct{})\n\ttime.AfterFunc(timeout, func() {\n\t\tclose(stopCh)\n\t})\n\toptions := &measurementutil.WaitForPVCOptions{\n\t\tSelector: selector,\n\t\tDesiredPVCCount: desiredPVCCount,\n\t\tEnableLogging: true,\n\t\tCallerName: w.String(),\n\t\tWaitForPVCsInterval: defaultWaitForPVCsInterval,\n\t}\n\treturn nil, measurementutil.WaitForPVCs(config.ClusterFramework.GetClientSets().GetClient(), stopCh, options)\n}", "func (self *Controller) ExecuteCommand(notification interfaces.INotification) {\n\tself.commandMapMutex.RLock()\n\tdefer self.commandMapMutex.RUnlock()\n\n\tvar commandFunc = self.commandMap[notification.Name()]\n\tif commandFunc == nil {\n\t\treturn\n\t}\n\tcommandInstance := commandFunc()\n\tcommandInstance.InitializeNotifier(self.Key)\n\tcommandInstance.Execute(notification)\n}", "func (scs *SubCommandStruct) Execute(ctx context.Context, in io.Reader, out, outErr io.Writer) error {\n\tif scs.ExecuteValue != nil {\n\t\treturn scs.ExecuteValue(ctx, in, out, outErr)\n\t}\n\treturn nil\n}", "func Execute() {\n\tdefer func() {\n\t\t_ = gutils.Logger.Sync()\n\t}()\n\trand.Seed(time.Now().UnixNano())\n\n\tvar err error\n\tif err = gutils.Settings.BindPFlags(rootCmd.Flags()); err != nil {\n\t\tgutils.Logger.Panic(\"bind flags\", zap.Error(err))\n\t}\n\n\tif gutils.Settings.GetBool(\"debug\") {\n\t\tif err := gutils.Logger.ChangeLevel(gutils.LoggerLevelDebug); err != nil {\n\t\t\tgutils.Logger.Panic(\"change logger level to debug\", zap.Error(err))\n\t\t}\n\t}\n\n\tif err = rootCmd.Execute(); err != nil {\n\t\tgutils.Logger.Panic(\"parse command line arguments\", zap.Error(err))\n\t}\n}", "func (err *ErrBytesSent) Execute() error {\n\treturn executeCommand(err.config)\n}", "func Execute() {\n\tif err := cmd.Execute(); err != nil {\n\t\tlog.Printf(\"failed command execution: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n}", "func (cmd *DNSStatusCmd) Execute(args []string) error {\n\tif client.DNSActive(cmd.Args.ID) {\n\t\tpr(\"DNS is active.\")\n\t} else {\n\t\tpr(\"Non-existent or not yet activated.\")\n\t}\n\treturn nil\n}", "func (m *MockFinder) Execute(ctx context.Context, config *config.Config, query string, from int64, until int64, stat *FinderStat) (err error) {\n\tm.query = query\n\treturn\n}", "func (s *service) ExecuteCommand(pluginContext *plugin.Context, commandArgs *model.CommandArgs) (resp *model.CommandResponse, err error) {\n\tparams := &commandParams{\n\t\tpluginContext: pluginContext,\n\t\tcommandArgs: commandArgs,\n\t}\n\tif pluginContext == nil || commandArgs == nil {\n\t\treturn errorOut(params, errors.New(\"invalid arguments to command.Handler. Please contact your system administrator\"))\n\t}\n\n\tconf := s.conf.MattermostConfig().Config()\n\tenableOAuthServiceProvider := conf.ServiceSettings.EnableOAuthServiceProvider\n\tif enableOAuthServiceProvider == nil || !*enableOAuthServiceProvider {\n\t\treturn errorOut(params, errors.Errorf(\"the system setting `Enable OAuth 2.0 Service Provider` needs to be enabled in order for the Apps plugin to work. Please go to %s/admin_console/integrations/integration_management and enable it.\", commandArgs.SiteURL))\n\t}\n\n\tenableBotAccounts := conf.ServiceSettings.EnableBotAccountCreation\n\tif enableBotAccounts == nil || !*enableBotAccounts {\n\t\treturn errorOut(params, errors.Errorf(\"the system setting `Enable Bot Account Creation` needs to be enabled in order for the Apps plugin to work. Please go to %s/admin_console/integrations/bot_accounts and enable it.\", commandArgs.SiteURL))\n\t}\n\n\tsplit := strings.Fields(commandArgs.Command)\n\tif len(split) < 2 {\n\t\treturn errorOut(params, errors.New(\"no subcommand specified, nothing to do\"))\n\t}\n\n\tcommand := split[0]\n\tif command != \"/\"+config.CommandTrigger {\n\t\treturn errorOut(params, errors.Errorf(\"%q is not a supported command and should not have been invoked. Please contact your system administrator\", command))\n\t}\n\n\tparams.current = split[1:]\n\n\tdefer func(log utils.Logger, developerMode bool) {\n\t\tif x := recover(); x != nil {\n\t\t\tstack := string(debug.Stack())\n\n\t\t\tlog.Errorw(\n\t\t\t\t\"Recovered from a panic in a command\",\n\t\t\t\t\"command\", commandArgs.Command,\n\t\t\t\t\"error\", x,\n\t\t\t\t\"stack\", stack,\n\t\t\t)\n\n\t\t\ttxt := utils.CodeBlock(commandArgs.Command+\"\\n\") + \"Command paniced. \"\n\n\t\t\tif developerMode {\n\t\t\t\ttxt += fmt.Sprintf(\"Error: **%v**. Stack:\\n%v\", x, utils.CodeBlock(stack))\n\t\t\t} else {\n\t\t\t\ttxt += \"Please check the server logs for more details.\"\n\t\t\t}\n\t\t\tresp = &model.CommandResponse{\n\t\t\t\tText: txt,\n\t\t\t\tResponseType: model.CommandResponseTypeEphemeral,\n\t\t\t}\n\t\t}\n\t}(s.conf.Logger(), s.conf.Get().DeveloperMode)\n\n\treturn s.handleMain(params)\n}", "func Execute() error { return rootCmd.Execute() }", "func (_m *Syncer) Execute() {\n\t_m.Called()\n}", "func (c *Ping) Execute(args ...string) Reply {\n\treply := checkExpcetArgs(0, args...)\n\tif _, ok := reply.(*OkReply); ok {\n\t\treturn &StringReply{Message: \"pong\"}\n\t}\n\treturn &StringReply{Message: strings.Join(args, \" \")}\n}", "func (cmd *command) Execute(ch io.ReadWriter) (err error) {\n\tif cmd.Flags.Source {\n\t\terr = cmd.serveSource(ch)\n\t} else {\n\t\terr = cmd.serveSink(ch)\n\t}\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\treturn nil\n}", "func (o *Opts) Execute(args []string) error {\n\tvar status StatusData\n\n\terr := updateStatusFromFile(&status, o.StatusFile)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR: failed to read status from SKVS file: %s\", err.Error())\n\t}\n\tgo watchStatusFileForChange(&status, o.StatusFile)\n\n\tserver := &http.Server{\n\t\tHandler: getStatusReadMux(&status),\n\t}\n\n\tlog.Println(\"Starting platform-install-status\")\n\t// We're explicitly opening a listener first to check if there is already\n\t// an instance running. If we could bind to the port successfully then\n\t// we can also safely remove the UNIX domain socket.\n\tlistener, err := net.Listen(\"tcp\", fmt.Sprintf(\":%d\", o.Port))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = listenOnUnixSocket(&status, o.StatusSocket)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = server.Serve(listener)\n\treturn err\n}", "func (command SimpleCommandTestCommand) execute(notification interfaces.INotification) {\n\tvar vo = notification.Body().(*SimpleCommandTestVO)\n\n\t//Fabricate a result\n\tvo.Result = 2 * vo.Input\n}", "func (cmd *CreditCommand) Execute(args string) (string, error) {\n\treturn \"\", &NotImplementedCommandError{\"credit\"}\n}", "func (eng *Engine) ExecuteCommand(token string, cmd Command) (interface{}, error) {\n\tuser, err := eng.checkUser(token)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// exec command\n\tr, err := eng.execute(cmd, user)\n\treturn r, err\n}", "func Execute() error {\n\trootCmd.PersistentFlags().IntVar(&p.WebPort, \"web-port\", 9000, \"Web server port\")\n\trootCmd.PersistentFlags().IntVar(&p.FtpPort, \"ftp-port\", 2121, \"FTP server port\")\n\trootCmd.PersistentFlags().StringVar(&p.ConfigDir, \"config-dir\", \"\", \"Config dir\")\n\trootCmd.PersistentFlags().StringVar(&p.DataDir, \"data-dir\", \"\", \"Data directory root (for files and DB)\")\n\trootCmd.PersistentFlags().StringVar(&p.FrontendDir, \"frontend-dir\", \"\", \"Frontend directory root (for web)\")\n\n\trootCmd.PersistentFlags().StringVar(&p.Host, \"host\", \"0.0.0.0\", \"Host address to bind to\")\n\trootCmd.PersistentFlags().StringVar(&p.FtpPassword, \"ftp-password\", \"admin\", \"Password to use for FTP\")\n\n\treturn rootCmd.Execute()\n}", "func Execute() error {\n\tcleaners = make([]Cleaner, 0, 2)\n\tdefer clean()\n\n\tgo func() {\n\t\tquit := make(chan os.Signal, 1)\n\t\tsignal.Notify(quit, syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase sig := <-quit:\n\t\t\t\tkill(sig)\n\t\t\t\tclean()\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t}\n\t}()\n\n\trootCmd := newRootCmd()\n\trootCmd.SilenceErrors = true\n\trootCmd.AddCommand(\n\t\tnewBuildCmd(),\n\t\tconfig.NewConfigCmd(),\n\t\tnewVersionCmd(),\n\t\tnewUpdateCmd(),\n\t)\n\treturn rootCmd.Execute()\n}", "func commandExecutor(\n\tctx context.Context,\n\tstringCh <-chan string,\n\tscriptPath string,\n) <-chan interface{} {\n\tresultCh := make(chan interface{})\n\n\tgo func() {\n\t\tdefer close(resultCh)\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase resultCh <- execCommand(<-stringCh, scriptPath):\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn resultCh\n}", "func (e *remoteExecutor) Execute(command []string, in io.Reader, out, errOut io.Writer) error {\n\tklog.V(3).Infof(\"Remote executor running command: %s\", strings.Join(command, \" \"))\n\texecOptions := &kexec.ExecOptions{\n\t\tStreamOptions: kexec.StreamOptions{\n\t\t\tNamespace: e.Namespace,\n\t\t\tPodName: e.PodName,\n\t\t\tContainerName: e.ContainerName,\n\t\t\tIOStreams: genericclioptions.IOStreams{\n\t\t\t\tIn: in,\n\t\t\t\tOut: out,\n\t\t\t\tErrOut: errOut,\n\t\t\t},\n\t\t\tStdin: in != nil,\n\t\t},\n\t\tExecutor: &kexec.DefaultRemoteExecutor{},\n\t\tPodClient: e.Client.CoreV1(),\n\t\tConfig: e.Config,\n\t\tCommand: command,\n\t}\n\terr := execOptions.Validate()\n\tif err != nil {\n\t\tklog.V(4).Infof(\"Error from remote command validation: %v\", err)\n\t\treturn err\n\t}\n\terr = execOptions.Run()\n\tif err != nil {\n\t\tklog.V(4).Infof(\"Error from remote execution: %v\", err)\n\t}\n\treturn err\n}", "func (h *Handler) Execute(name string, args []string) {\n\tlog.Warn(\"generic doesn't support command execution\")\n}", "func Execute() error {\n\tvar (\n\t\twaitTimeout time.Duration\n\t\tdefaultPollFreq time.Duration\n\t\tisQuiet bool\n\n\t\tver = fmt.Sprintf(\"%s (build time: %s, commit: %s)\", version, buildTime, gitCommit)\n\t)\n\n\tcmd := &cobra.Command{\n\t\tUse: name + \" [FLAGS] ADDRESS...\",\n\t\tShort: desc,\n\t\tVersion: ver,\n\t\tDisableFlagsInUseLine: true,\n\t\tSilenceErrors: true,\n\n\t\tArgs: func(cmd *cobra.Command, args []string) error {\n\t\t\tif len(args) < 1 {\n\t\t\t\treturn fmt.Errorf(\"at least one address must be specified\")\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tvar rawAddrs []string\n\t\t\tif dashIdx := cmd.ArgsLenAtDash(); dashIdx == -1 {\n\t\t\t\trawAddrs = args\n\t\t\t} else {\n\t\t\t\trawAddrs = args[:dashIdx]\n\t\t\t}\n\t\t\texitCode := run(rawAddrs, waitTimeout, defaultPollFreq, isQuiet)\n\t\t\tif exitCode != 0 {\n\t\t\t\tos.Exit(exitCode) // nolint: revive\n\t\t\t}\n\t\t},\n\t}\n\n\tflagSet := cmd.Flags()\n\tflagSet.SortFlags = false\n\tflagSet.DurationVarP(&waitTimeout, \"timeout\", \"t\", 5*time.Second, \"set wait timeout\")\n\tflagSet.DurationVarP(\n\t\t&defaultPollFreq,\n\t\t\"poll-freq\",\n\t\t\"f\",\n\t\t500*time.Millisecond,\n\t\t\"set connection poll frequency\",\n\t)\n\tflagSet.BoolVarP(&isQuiet, \"quiet\", \"q\", false, \"suppress waiting messages\")\n\n\treturn cmd.Execute()\n}", "func (c *testComamnd) Execute() {\n\n\t// Parse subcommand args first.\n\tif len(os.Args) < 4 {\n\t\tfmt.Println(\"test command require <apiName:apiVersion> <testEndpoint> <runner> args\")\n\t\tos.Exit(1)\n\t}\n\n\tserviceRef := os.Args[2]\n\ttestEndpoint := os.Args[3]\n\trunnerType := os.Args[4]\n\n\t// Validate presence and values of args.\n\tif &serviceRef == nil || strings.HasPrefix(serviceRef, \"-\") {\n\t\tfmt.Println(\"test command require <apiName:apiVersion> <testEndpoint> <runner> args\")\n\t\tos.Exit(1)\n\t}\n\tif &testEndpoint == nil || strings.HasPrefix(testEndpoint, \"-\") {\n\t\tfmt.Println(\"test command require <apiName:apiVersion> <testEndpoint> <runner> args\")\n\t\tos.Exit(1)\n\t}\n\tif &runnerType == nil || strings.HasPrefix(runnerType, \"-\") {\n\t\tfmt.Println(\"test command require <apiName:apiVersion> <testEndpoint> <runner> args\")\n\t\tos.Exit(1)\n\t}\n\tif _, validChoice := runnerChoices[runnerType]; !validChoice {\n\t\tfmt.Println(\"<runner> should be one of: HTTP, SOAP, SOAP_UI, POSTMAN, OPEN_API_SCHEMA, ASYNC_API_SCHEMA, GRPC_PROTOBUF, GRAPHQL_SCHEMA\")\n\t\tos.Exit(1)\n\t}\n\n\t// Then parse flags.\n\ttestCmd := flag.NewFlagSet(\"test\", flag.ExitOnError)\n\n\tvar microcksURL string\n\tvar keycloakURL string\n\tvar keycloakClientID string\n\tvar keycloakClientSecret string\n\tvar waitFor string\n\tvar secretName string\n\tvar filteredOperations string\n\tvar operationsHeaders string\n\tvar insecureTLS bool\n\tvar caCertPaths string\n\tvar verbose bool\n\n\ttestCmd.StringVar(&microcksURL, \"microcksURL\", \"\", \"Microcks API URL\")\n\ttestCmd.StringVar(&keycloakClientID, \"keycloakClientId\", \"\", \"Keycloak Realm Service Account ClientId\")\n\ttestCmd.StringVar(&keycloakClientSecret, \"keycloakClientSecret\", \"\", \"Keycloak Realm Service Account ClientSecret\")\n\ttestCmd.StringVar(&waitFor, \"waitFor\", \"5sec\", \"Time to wait for test to finish\")\n\ttestCmd.StringVar(&secretName, \"secretName\", \"\", \"Secret to use for connecting test endpoint\")\n\ttestCmd.StringVar(&filteredOperations, \"filteredOperations\", \"\", \"List of operations to launch a test for\")\n\ttestCmd.StringVar(&operationsHeaders, \"operationsHeaders\", \"\", \"Override of operations headers as JSON string\")\n\ttestCmd.BoolVar(&insecureTLS, \"insecure\", false, \"Whether to accept insecure HTTPS connection\")\n\ttestCmd.StringVar(&caCertPaths, \"caCerts\", \"\", \"Comma separated paths of CRT files to add to Root CAs\")\n\ttestCmd.BoolVar(&verbose, \"verbose\", false, \"Produce dumps of HTTP exchanges\")\n\ttestCmd.Parse(os.Args[5:])\n\n\t// Validate presence and values of flags.\n\tif len(microcksURL) == 0 {\n\t\tfmt.Println(\"--microcksURL flag is mandatory. Check Usage.\")\n\t\tos.Exit(1)\n\t}\n\tif len(keycloakClientID) == 0 {\n\t\tfmt.Println(\"--keycloakClientId flag is mandatory. Check Usage.\")\n\t\tos.Exit(1)\n\t}\n\tif len(keycloakClientSecret) == 0 {\n\t\tfmt.Println(\"--keycloakClientSecret flag is mandatory. Check Usage.\")\n\t\tos.Exit(1)\n\t}\n\tif &waitFor == nil || (!strings.HasSuffix(waitFor, \"milli\") && !strings.HasSuffix(waitFor, \"sec\") && !strings.HasSuffix(waitFor, \"min\")) {\n\t\tfmt.Println(\"--waitFor format is wrong. Applying default 5sec\")\n\t\twaitFor = \"5sec\"\n\t}\n\n\t// Collect optional HTTPS transport flags.\n\tif insecureTLS {\n\t\tconfig.InsecureTLS = true\n\t}\n\tif len(caCertPaths) > 0 {\n\t\tconfig.CaCertPaths = caCertPaths\n\t}\n\tif verbose {\n\t\tconfig.Verbose = true\n\t}\n\n\t// Compute time to wait in milliseconds.\n\tvar waitForMilliseconds int64 = 5000\n\tif strings.HasSuffix(waitFor, \"milli\") {\n\t\twaitForMilliseconds, _ = strconv.ParseInt(waitFor[:len(waitFor)-5], 0, 64)\n\t} else if strings.HasSuffix(waitFor, \"sec\") {\n\t\twaitForMilliseconds, _ = strconv.ParseInt(waitFor[:len(waitFor)-3], 0, 64)\n\t\twaitForMilliseconds = waitForMilliseconds * 1000\n\t} else if strings.HasSuffix(waitFor, \"min\") {\n\t\twaitForMilliseconds, _ = strconv.ParseInt(waitFor[:len(waitFor)-3], 0, 64)\n\t\twaitForMilliseconds = waitForMilliseconds * 60 * 1000\n\t}\n\n\t// Now we seems to be good ...\n\t// First - retrieve the Keycloak URL from Microcks configuration.\n\tmc := connectors.NewMicrocksClient(microcksURL)\n\tkeycloakURL, err := mc.GetKeycloakURL()\n\tif err != nil {\n\t\tfmt.Printf(\"Got error when invoking Microcks client retrieving config: %s\", err)\n\t\tos.Exit(1)\n\t}\n\n\tvar oauthToken string = \"unauthentifed-token\"\n\tif keycloakURL != \"null\" {\n\t\t// If Keycloak is enabled, retrieve an OAuth token using Keycloak Client.\n\t\tkc := connectors.NewKeycloakClient(keycloakURL, keycloakClientID, keycloakClientSecret)\n\n\t\toauthToken, err = kc.ConnectAndGetToken()\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Got error when invoking Keycloack client: %s\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\t//fmt.Printf(\"Retrieve OAuthToken: %s\", oauthToken)\n\t}\n\n\t// Then - launch the test on Microcks Server.\n\tmc.SetOAuthToken(oauthToken)\n\n\tvar testResultID string\n\ttestResultID, err = mc.CreateTestResult(serviceRef, testEndpoint, runnerType, secretName, waitForMilliseconds, filteredOperations, operationsHeaders)\n\tif err != nil {\n\t\tfmt.Printf(\"Got error when invoking Microcks client creating Test: %s\", err)\n\t\tos.Exit(1)\n\t}\n\t//fmt.Printf(\"Retrieve TestResult ID: %s\", testResultID)\n\n\t// Finally - wait before checking and loop for some time\n\ttime.Sleep(1 * time.Second)\n\n\t// Add 10.000ms to wait time as it's now representing the server timeout.\n\tnow := nowInMilliseconds()\n\tfuture := now + waitForMilliseconds + 10000\n\n\tvar success = false\n\tfor nowInMilliseconds() < future {\n\t\ttestResultSummary, err := mc.GetTestResult(testResultID)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Got error when invoking Microcks client check TestResult: %s\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tsuccess = testResultSummary.Success\n\t\tinProgress := testResultSummary.InProgress\n\t\tfmt.Printf(\"MicrocksClient got status for test \\\"%s\\\" - success: %s, inProgress: %s \\n\", testResultID, fmt.Sprint(success), fmt.Sprint(inProgress))\n\n\t\tif !inProgress {\n\t\t\tbreak\n\t\t}\n\n\t\tfmt.Println(\"MicrocksTester waiting for 2 seconds before checking again or exiting.\")\n\t\ttime.Sleep(2 * time.Second)\n\t}\n\n\tfmt.Printf(\"Full TestResult details are available here: %s/#/tests/%s \\n\", strings.Split(microcksURL, \"/api\")[0], testResultID)\n\n\tif !success {\n\t\tos.Exit(1)\n\t}\n}", "func Execute() {\n\n\tif len(flag.Args()) == 0 {\n\t\tshowHelp(nil)\n\t\tos.Exit(1)\n\t}\n\n\t// Check if the first argument is a native command\n\tfor _, nc := range nativeCmds {\n\t\tif nc.ID == flag.Arg(0) {\n\t\t\tnc.Cmd(flag.Args()[1:]...)\n\t\t\tos.Exit(0)\n\t\t}\n\t}\n\tfor _, a := range flag.Args() {\n\t\tartifact.Call(a)\n\t}\n}", "func Execute(v string, b string) {\n\tversion = v\n\tbuild = b\n\tif err := rootCmd.Execute(); err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n}", "func Execute() {\n\tif err := cliCommand.Execute(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func Execute() {\n\tif err := rootCmd.Execute(); err != nil {\n\t\tos.Exit(1) // skipcq: RVV-A0003\n\t}\n}", "func Execute(ctx context.OrionContext, action *Base, fn ExecuteFn) errors.Error {\n\t// ctx.StartAction()\n\tevalCtx := ctx.EvalContext()\n\twhen, err := helper.GetExpressionValueAsBool(evalCtx, action.when, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !when {\n\t\treturn nil\n\t}\n\tif action.count != nil && !action.count.Range().Empty() {\n\t\treturn doCount(ctx, action, fn)\n\t}\n\tif action.while != nil && !action.while.Range().Empty() {\n\t\treturn doWhile(ctx, action, fn)\n\t}\n\treturn fn(ctx)\n}", "func (x *CtlCommand) Execute(args []string) error {\n\tif len(args) == 0 {\n\t\treturn nil\n\t}\n\n\trpcc := x.createRPCClient()\n\tverb := args[0]\n\n\tswitch verb {\n\n\t////////////////////////////////////////////////////////////////////////////////\n\t// STATUS\n\t////////////////////////////////////////////////////////////////////////////////\n\tcase \"status\":\n\t\tx.status(rpcc, args[1:])\n\n\t\t////////////////////////////////////////////////////////////////////////////////\n\t\t// START or STOP\n\t\t////////////////////////////////////////////////////////////////////////////////\n\tcase \"start\", \"stop\":\n\t\tx.startStopProcesses(rpcc, verb, args[1:])\n\n\t\t////////////////////////////////////////////////////////////////////////////////\n\t\t// SHUTDOWN\n\t\t////////////////////////////////////////////////////////////////////////////////\n\tcase \"shutdown\":\n\t\tx.shutdown(rpcc)\n\tcase \"reload\":\n\t\tx.reload(rpcc)\n\tcase \"signal\":\n\t\tsigName, processes := args[1], args[2:]\n\t\tx.signal(rpcc, sigName, processes)\n\tcase \"pid\":\n\t\tx.getPid(rpcc, args[1])\n\tdefault:\n\t\tfmt.Println(\"unknown command\")\n\t}\n\n\treturn nil\n}", "func (c *VolumeRemove) Execute(args []string) error {\n\tApp.initializeLogging()\n\tdirectory := GetDefaultDriver(string(c.Path))\n\tdriver, err := InitDriverIfExists(directory)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlogger := log.WithFields(log.Fields{\n\t\t\"directory\": driver.Root(),\n\t\t\"type\": driver.DriverType(),\n\t\t\"volume\": c.Args.Name,\n\t})\n\tif !driver.Exists(c.Args.Name) {\n\t\tlogger.Fatal(\"Volume does not exist\")\n\t}\n\tlogger.Info(\"Removeing volume\")\n\tif err := driver.Remove(c.Args.Name); err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\tlogger.Info(\"Volume deleted\")\n\treturn nil\n}", "func Execute(v string, bh string, bd string) {\n\tversion = v\n\tbuildHash = bh\n\tbuildDate = bd\n\n\tif err := rootCmd.Execute(); err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n}", "func Execute(v string, bh string, bd string) {\n\tversion = v\n\tbuildHash = bh\n\tbuildDate = bd\n\n\tif err := rootCmd.Execute(); err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n}", "func (actor *Actor) Execute(data *ChannelManager, syncRepo bool) bool {\n\tif actor.Definition.Remote != nil {\n\t\treturn actor.ExecuteRemote(data, *actor.Definition.Remote.Host, *actor.Definition.Remote.User, syncRepo)\n\t}\n\texecute := actor.Definition.Execute\n\n\tcmd := exec.Command(execute.Executable)\n\tif execute.ScriptFile != nil {\n\t\tcmd.Args = append(cmd.Args, *execute.ScriptFile)\n\t}\n\tif execute.Arguments != nil {\n\t\tcmd.Args = append(cmd.Args, execute.Arguments...)\n\t}\n\n\tstdInPipe, _ := cmd.StdinPipe()\n\tstdOutPipe, _ := cmd.StdoutPipe()\n\tstdErrPipe, _ := cmd.StdoutPipe()\n\n\tactor.handleStdin(stdInPipe, data)\n\tstdInPipe.Close()\n\n\tcmd.Run()\n\n\tactor.handleStdout(stdOutPipe, data)\n\tstdOutPipe.Close()\n\tactor.handleStderr(stdErrPipe, data)\n\tstdErrPipe.Close()\n\n\treturn cmd.ProcessState.Success()\n}", "func (p *RollbarPlugin) ExecuteCommand(c *plugin.Context, args *model.CommandArgs) (*model.CommandResponse, *model.AppError) {\n\ttokens := strings.Split(args.Command, \" \")\n\n\tif len(tokens) < 2 || len(tokens) > 3 {\n\t\treturn getCommandResponse(usageErrorMessage), nil\n\t}\n\n\tchannelId := args.ChannelId\n\texistingUsers, err := p.API.KVGet(channelId)\n\tif err != nil {\n\t\treturn p.returnGenericError(err), nil\n\t}\n\n\t// Users that are currently being notified\n\tusersMap := make(map[string]bool)\n\tif len(existingUsers) > 0 {\n\t\tif err := json.Unmarshal(existingUsers, &usersMap); err != nil {\n\t\t\treturn p.returnGenericError(err), nil\n\t\t}\n\t}\n\n\taction := tokens[1]\n\tswitch action {\n\tcase \"list\":\n\t\tif len(tokens) != 2 {\n\t\t\treturn getCommandResponse(\"Usage: `/rollbar list`\"), nil\n\t\t}\n\t\treturn getCommandResponse(fmt.Sprintf(usersListMessage, GetUsernameList(usersMap))), nil\n\tcase \"notify\", \"remove\":\n\t\tif len(tokens) != 3 {\n\t\t\treturn getCommandResponse(fmt.Sprintf(\"Usage: `/rollbar %s @username`\", action)), nil\n\t\t}\n\n\t\tusername := tokens[2]\n\t\tusername = strings.TrimPrefix(username, \"@\")\n\t\tuser, _ := p.API.GetUserByUsername(username)\n\t\tif user == nil {\n\t\t\treturn getCommandResponse(fmt.Sprintf(\"User `%s` not found.\", username)), nil\n\t\t}\n\n\t\tif action == \"remove\" {\n\t\t\tif usersMap[username] {\n\t\t\t\tdelete(usersMap, username)\n\t\t\t} else {\n\t\t\t\treturn getCommandResponse(fmt.Sprintf(\"User `%s` is already not being notified.\", username)), nil\n\t\t\t}\n\t\t} else if action == \"notify\" {\n\t\t\tif !usersMap[username] {\n\t\t\t\tusersMap[username] = true\n\t\t\t} else {\n\t\t\t\treturn getCommandResponse(fmt.Sprintf(\"User `%s` is already being notified.\", username)), nil\n\t\t\t}\n\t\t}\n\n\t\tnewValue, _ := json.Marshal(usersMap)\n\t\tif err := p.API.KVSet(channelId, newValue); err != nil {\n\t\t\treturn p.returnGenericError(err), nil\n\t\t}\n\n\t\treturn getCommandResponse(fmt.Sprintf(usersListMessage, GetUsernameList(usersMap))), nil\n\tdefault:\n\t\treturn getCommandResponse(usageErrorMessage), nil\n\t}\n}", "func Execute(cmd *cobra.Command) {\n\tif err := cmd.Execute(); err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(-1)\n\t}\n}", "func (r *RunCommand) Execute(args []string) (err error) {\n\t// If we run as a service, we need to catch panics.\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tcerberus.Logger.Fatalln(r)\n\t\t}\n\t}()\n\n\tif err := r.RootCommand.Execute(args); err != nil {\n\t\tcerberus.Logger.Fatalln(err)\n\t}\n\n\tif err := cerberus.RunService(r.Args.Name); err != nil {\n\t\tcerberus.Logger.Fatalln(err)\n\t}\n\n\treturn nil\n}", "func Execute() {\n\tsetupControllerCommand()\n\tsetupStoreCommand()\n\tsetupServiceCommand()\n\tif err := rootCmd.Execute(); err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n}", "func (c Command) Execute(ctx context.Context, payload xml.TokenReader, s *xmpp.Session) (Response, xmlstream.TokenReadCloser, error) {\n\treturn c.ExecuteIQ(ctx, stanza.IQ{\n\t\tType: stanza.SetIQ,\n\t\tTo: c.JID,\n\t}, payload, s)\n}", "func (upd *Update) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {\n\tif upd.QueryTimeout != 0 {\n\t\tcancel := vcursor.SetContextTimeout(time.Duration(upd.QueryTimeout) * time.Millisecond)\n\t\tdefer cancel()\n\t}\n\n\tswitch upd.Opcode {\n\tcase Unsharded:\n\t\treturn upd.execUpdateUnsharded(vcursor, bindVars)\n\tcase Equal:\n\t\treturn upd.execUpdateEqual(vcursor, bindVars)\n\tcase In:\n\t\treturn upd.execUpdateIn(vcursor, bindVars)\n\tcase Scatter:\n\t\treturn upd.execUpdateByDestination(vcursor, bindVars, key.DestinationAllShards{})\n\tcase ByDestination:\n\t\treturn upd.execUpdateByDestination(vcursor, bindVars, upd.TargetDestination)\n\tdefault:\n\t\t// Unreachable.\n\t\treturn nil, fmt.Errorf(\"unsupported opcode: %v\", upd)\n\t}\n}", "func (c Command) Execute() error {\n\tcmd := exec.Command(c.Path, c.Args...)\n\n\tstdout, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer stdout.Close()\n\n\tstderr, err := cmd.StderrPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer stderr.Close()\n\n\t// line readers for log data\n\tif c.Stdout != nil {\n\t\tgo c.lineReader(stdout)\n\t\tgo c.lineReader(stderr)\n\t}\n\n\treturn cmd.Run()\n}", "func Execute() {\r\n\r\n\t// Create a database connection (Don't require DB for now)\r\n\tif err := database.Connect(applicationName); err != nil {\r\n\t\tchalker.Log(chalker.ERROR, fmt.Sprintf(\"Error connecting to database: %s\", err.Error()))\r\n\t} else {\r\n\t\t// Set this flag for caching detection\r\n\t\tdatabaseEnabled = true\r\n\r\n\t\t// Defer the database disconnection\r\n\t\tdefer func() {\r\n\t\t\tdbErr := database.GarbageCollection()\r\n\t\t\tif dbErr != nil {\r\n\t\t\t\tchalker.Log(chalker.ERROR, fmt.Sprintf(\"Error in database GarbageCollection: %s\", dbErr.Error()))\r\n\t\t\t}\r\n\r\n\t\t\tif dbErr = database.Disconnect(); dbErr != nil {\r\n\t\t\t\tchalker.Log(chalker.ERROR, fmt.Sprintf(\"Error in database Disconnect: %s\", dbErr.Error()))\r\n\t\t\t}\r\n\t\t}()\r\n\t}\r\n\r\n\t// Run root command\r\n\ter(rootCmd.Execute())\r\n\r\n\t// Generate documentation from all commands\r\n\tif generateDocs {\r\n\t\tgenerateDocumentation()\r\n\t}\r\n\r\n\t// Flush cache?\r\n\tif flushCache && databaseEnabled {\r\n\t\tif dbErr := database.Flush(); dbErr != nil {\r\n\t\t\tchalker.Log(chalker.ERROR, fmt.Sprintf(\"Error in database Flush: %s\", dbErr.Error()))\r\n\t\t} else {\r\n\t\t\tchalker.Log(chalker.SUCCESS, \"Successfully flushed the local database cache\")\r\n\t\t}\r\n\t}\r\n}", "func (e *TranslateCommandExecutor) ExecuteCommand(command string, arg ...string) error {\n\ttransCommand, transArgs := e.Translator(command, arg...)\n\treturn e.Executor.ExecuteCommand(transCommand, transArgs...)\n}", "func (l *Labeler) Execute() error {\n\terr := l.checkPreconditions()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Debugf(\"executing with owner=%s repo=%s event=%s\", *l.Owner, *l.Repo, *l.Event)\n\n\tc, err := l.retrieveConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.config = c\n\n\tswitch *l.Event {\n\tcase issue:\n\t\terr = l.processIssue()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tcase pullRequestTarget, pullRequest:\n\t\terr = l.processPullRequest()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func Execute(bTime, gHash string) {\n\tbuildTime = bTime\n\tgitHash = gHash\n\tif err := rootCmd.Execute(); err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n}", "func Execute(ctx context.Context) {\n\tif err := NewPgcmCommand(ctx).Execute(); err != nil {\n\t\tlogger.Log(\"event\", \"execute.error\", \"error\", err, \"msg\", \"execution failed, exiting with error\")\n\t\tos.Exit(1)\n\t}\n}", "func Execute(cmd *cobra.Command) {\n\tif err := cmd.Execute(); err != nil {\n\t\tfmt.Println(err)\n\t}\n}", "func (e *executor) Execute() error {\n\tif len(e.executables) < 1 {\n\t\treturn errors.New(\"nothing to Work\")\n\t}\n\n\tlog(e.id).Infof(\"processing %d item(s)\", len(e.executables))\n\treturn nil\n}", "func (d *Device) executeCommand(name string, params ...interface{}) (*CommandResult, error) {\n\treturn d.execute(d.newCommand(name, params))\n}", "func (m *MockFinder) Execute(ctx context.Context, query string, from int64, until int64) error {\n\tm.query = query\n\treturn nil\n}", "func Execute() {\n\tif err := rootCmd.Execute(); err != nil {\n\t\tlog.Assert(err.Error())\n\t}\n}", "func (e *CustomExecutor) Execute(s api.DiscordSession, channel model.Snowflake, command *model.Command) {\n\tif command.Custom == nil {\n\t\tlog.Fatal(\"Incorrectly generated learn command\", errors.New(\"wat\"))\n\t}\n\n\thas, err := e.commandMap.Has(command.Custom.Call)\n\tif err != nil {\n\t\tlog.Fatal(\"Error testing custom feature\", err)\n\t}\n\tif !has {\n\t\tlog.Fatal(\"Accidentally found a mismatched call/response pair\", errors.New(\"call response mismatch\"))\n\t}\n\n\tresponse, err := e.commandMap.Get(command.Custom.Call)\n\tif err != nil {\n\t\tlog.Fatal(\"Error reading custom response\", err)\n\t}\n\n\t// Perform command substitutions.\n\tif strings.Contains(response, \"$1\") {\n\t\tif command.Custom.Args == \"\" {\n\t\t\tresponse = MsgCustomNeedsArgs\n\t\t} else {\n\t\t\tresponse = strings.Replace(response, \"$1\", command.Custom.Args, 4)\n\t\t}\n\t} else if matches := giphyRegexp.FindStringSubmatch(response); len(matches) > 2 {\n\t\turl := matches[2]\n\t\tresponse = fmt.Sprintf(MsgGiphyLink, url)\n\t}\n\n\ts.ChannelMessageSend(channel.Format(), response)\n}", "func NewConditionCommand() *ConditionCommand {\n\treturn &ConditionCommand{}\n}", "func (opts *CopyCommand) Execute(args []string) error {\n\n\tconnectionOptions := &s3tools.S3ConnectionOptions{Region: &opts.Region}\n\n\tsess, err := s3tools.CreateS3Session(connectionOptions)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := s3tools.CheckOrCreateBucket(sess, opts.Bucket); err != nil {\n\t\tpanic(err)\n\t}\n\tbucketPath := fmt.Sprintf(\"%s/%s\", opts.Bucket, opts.Branch)\n\tfmt.Printf(\"Copying coverage information into %s bucket...\\n\", bucketPath)\n\n\tuploadKey := fmt.Sprintf(\"%s/coverage.xml\", opts.Branch)\n\tif err := s3tools.UploadFile(sess, opts.Bucket, uploadKey, opts.CoverageFile); err != nil {\n\t\tpanic(err)\n\t}\n\treturn nil\n}", "func Execute() {\n\tif err := initSubCommands(); err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\tif err := rootCmd.Execute(); err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n}", "func Execute() {\n\tif err := rootCmd.Execute(); err != nil {\n\t\teh.ExitOnError(err)\n\t}\n\n}", "func (r *Client) ExecuteCommand(cr *redisv1alpha1.Redis, cmd []string) error {\n\tpod := &corev1.Pod{}\n\tpodKey := types.NamespacedName{Name: cr.ObjectMeta.Name + \"-master-0\", Namespace: cr.Namespace}\n\tif err := r.Get(context.Background(), podKey, pod); err != nil {\n\t\tklog.Errorf(\"Could not get pod info: %v\", err)\n\t\treturn err\n\t}\n\tif err := r.Execer.ExecCommandInPod(pod, cmd...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (opts *DeployEnvironmentOpts) Execute() error {\n\tif opts.DryRun {\n\t\treturn opts.dryRunEnvironment()\n\t} else {\n\t\treturn opts.deployEnvironment()\n\t}\n}", "func Execute(ctx context.Context) error {\n\treturn rootCmd.ExecuteContext(ctx)\n}", "func (e *EnableInstance) Execute(ctx *ctxt.Context) error {\n\texec, found := ctx.GetExecutor(e.host)\n\tif !found {\n\t\treturn ErrNoExecutor\n\t}\n\taction := module.OperatorDisable\n\tif e.isEnable {\n\t\taction = module.OperatorEnable\n\t}\n\tif err := systemctl(exec, e.serviceName, action, e.executeTimeout); err != nil {\n\t\treturn toFailedActionError(err, action, e.host, e.instanceName, e.serviceName, e.logDir)\n\t}\n\tdmgrutil.Logger.Info(\"Enable/Disable instance success\",\n\t\tzap.String(\"instance\", e.instanceName), zap.Bool(\"enabled\", e.isEnable))\n\treturn nil\n}", "func (e *ldapExecutor) Execute(ctx context.Context, config *ldapconf.Config) error {\n\treturn nil\n}", "func (ins *GreaterThanString) Execute(registers map[string]*ast.Literal, _ *int, _ *VM) error {\n\tregisters[ins.Result] = asttest.NewLiteralBool(\n\t\tregisters[ins.Left].Value > registers[ins.Right].Value,\n\t)\n\n\treturn nil\n}", "func Execute(main *cobra.Command) {\n\t// If we were invoked via a multicall entrypoint run it instead.\n\t// TODO(marineam): should we figure out a way to initialize logging?\n\texec.MaybeExec()\n\n\tmain.AddCommand(versionCmd)\n\n\t// TODO(marineam): pflags defines the Value interface differently,\n\t// update capnslog accordingly...\n\tmain.PersistentFlags().Var(&logLevel, \"log-level\",\n\t\t\"Set global log level.\")\n\tmain.PersistentFlags().BoolVarP(&logVerbose, \"verbose\", \"v\", false,\n\t\t\"Alias for --log-level=INFO\")\n\tmain.PersistentFlags().BoolVarP(&logDebug, \"debug\", \"d\", false,\n\t\t\"Alias for --log-level=DEBUG\")\n\n\tWrapPreRun(main, func(cmd *cobra.Command, args []string) error {\n\t\tstartLogging(cmd)\n\t\treturn nil\n\t})\n\n\tif err := main.Execute(); err != nil {\n\t\t// If this isn't a warn:true test failure then go ahead and die\n\t\tif err != kola.ErrWarnOnTestFail {\n\t\t\tplog.Fatal(err)\n\t\t}\n\t\t// Now check if the user wants exit code 77 on warn:true test fail\n\t\t// If they do then we'll exit 77. If they don't we'll do nothing\n\t\t// and drop out to the os.Exit(0)\n\t\tif kola.Options.UseWarnExitCode77 {\n\t\t\tplog.Warning(err)\n\t\t\tos.Exit(77)\n\t\t}\n\t}\n\tos.Exit(0)\n}", "func (c *CheckPointExecutor) Execute(ctx context.Context, cmd string, sudo bool, timeout ...time.Duration) (stdout []byte, stderr []byte, err error) {\n\tpoint := checkpoint.Acquire(ctx, sshPoint, map[string]any{\n\t\t\"host\": c.config.Host,\n\t\t\"port\": c.config.Port,\n\t\t\"user\": c.config.User,\n\t\t\"sudo\": sudo,\n\t\t\"cmd\": cmd,\n\t})\n\tdefer func() {\n\t\tpoint.Release(err,\n\t\t\tzap.String(\"host\", c.config.Host),\n\t\t\tzap.Int(\"port\", c.config.Port),\n\t\t\tzap.String(\"user\", c.config.User),\n\t\t\tzap.Bool(\"sudo\", sudo),\n\t\t\tzap.String(\"cmd\", cmd),\n\t\t\tzap.String(\"stdout\", string(stdout)),\n\t\t\tzap.String(\"stderr\", string(stderr)),\n\t\t)\n\t}()\n\tif point.Hit() != nil {\n\t\treturn []byte(point.Hit()[\"stdout\"].(string)), []byte(point.Hit()[\"stderr\"].(string)), nil\n\t}\n\n\treturn c.Executor.Execute(ctx, cmd, sudo, timeout...)\n}", "func Execute() {\n\trootCmd.Version = config.BuildVersion()\n\tfilePath, err := config.FilePath()\n\tif err != nil {\n\t\tcli.DieIf(err, closePlugins)\n\t}\n\trootCmd.PersistentFlags().StringVar(&cfgFile, \"config\", filePath, \"config file\")\n\tdefer closePlugins()\n\n\tif err := rootCmd.Execute(); err != nil {\n\t\tcli.DieIf(err, closePlugins)\n\t}\n}", "func (client *Client) Execute(command string) {\n\tclient.SendResponse(command)\n}", "func (c *SetPCControl) Execute(ctx Context) error {\n\tserialNumber, err := getSerialNumber(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tenable := true\n\tif len(flag.Args()) > 2 {\n\t\tv := strings.ToLower(flag.Arg(2))\n\t\tif matches, _ := regexp.MatchString(\"true|false\", v); !matches {\n\t\t\treturn fmt.Errorf(\"invalid command - expected 'true' or 'false', got '%v'\", flag.Arg(2))\n\t\t}\n\n\t\tif v == \"false\" {\n\t\t\tenable = false\n\t\t}\n\t}\n\n\tsucceeded, err := ctx.uhppote.SetPCControl(serialNumber, enable)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !succeeded {\n\t\tif enable {\n\t\t\treturn fmt.Errorf(\"failed to enable 'set PC control' on %v\", serialNumber)\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"failed to disable 'set PC control' on %v\", serialNumber)\n\t\t}\n\t}\n\n\tfmt.Printf(\"%v %v\\n\", serialNumber, enable)\n\n\treturn nil\n}", "func (r *RunCmd) Execute(cfg *config.Config) error {\n\n\tvar exitCode int\n\n\tdatabase, err := cfg.OpenDatabase()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// get tool\n\ttools := tool.New(config.Database{DB: database})\n\tmounts := mount.New(config.Database{DB: database})\n\tcaches := cache.New(config.Database{DB: database})\n\n\tto, err := tools.Get(r.registry, r.tool)\n\tif err != nil {\n\t\treturn err\n\t}\n\tmos, err := mounts.List()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpullDone := make(chan error, 1)\n\tcloseDB := make(chan bool, 1)\n\n\tversion, err := r.selectVersion(cfg.Docker, database, to, pullDone, closeDB)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontainerID, err := caches.Container.Get(to, version, cfg, mos)\n\tif err != nil {\n\t\treturn err\n\t}\n\t<-closeDB\n\tlogrus.Info(\"Closing database\")\n\t// close db\n\tcfg.CloseDatabase()\n\n\tif len(version) == 0 {\n\t\treturn ErrorNoVersionFound\n\t}\n\n\targuments := r.arguments\n\tif len(arguments) == 1 && len(arguments[0]) == 0 {\n\t\targuments = []string{}\n\t}\n\n\texecutionOptions := &tool.ExecutionOptions{\n\t\tIO: cfg.IO,\n\t\tDocker: &cfg.Docker,\n\t\tTool: to,\n\t\tVersion: version,\n\t\tArguments: r.arguments,\n\t\tMounts: mos,\n\t}\n\n\tif containerID == \"\" {\n\t\tlogrus.Info(\"Starting and executing tool\")\n\t\texitCode, err = tool.StartAndExecute(executionOptions)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tlogrus.Debug(\"Tool has been started as daemon, executing\")\n\t\texitCode, err = tool.Execute(containerID, executionOptions)\n\t\tlogrus.Debugln(\"executing done...\")\n\t\tif err != nil {\n\t\t\tif _, ok := err.(*docker.NoSuchContainer); ok {\n\t\t\t\t// container not found, clear cache for this entry and start daemon\n\t\t\t\t// open a new database connection because nothing else will help...\n\t\t\t\tdatabase, err := cfg.OpenDatabase()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tdefer cfg.CloseDatabase()\n\t\t\t\tcaches := cache.New(config.Database{DB: database})\n\t\t\t\tcaches.Container.Clear(to, version)\n\t\t\t\tcontainerID, err := caches.Container.Get(to, version, cfg, mos)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tdatabase.Close()\n\t\t\t\texitCode, err = tool.Execute(containerID, executionOptions)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Wait until potential pulls are done, otherwise the pull will stop midexecution -> race condition\n\terr = <-pullDone\n\tlogrus.Info(\"Potential pull done\")\n\n\tcfg.Output.ExitCode = exitCode\n\treturn err\n}", "func Execute(cfn ConfigFunc) error {\n\trootCmd.PersistentPreRun = func(cmd *cobra.Command, args []string) {\n\t\tcfn(rootCmd.PersistentFlags())\n\t}\n\n\treturn rootCmd.Execute()\n}", "func (r *remove) Execute(cfg *config.Config, logger *log.Logger) error {\n\tlogger.Printf(\"Removing %s\\n\", r.args[0])\n\n\tpathToDelete := r.args[0]\n\tif expandedPath, err := pathutil.Expand(pathToDelete); err == nil {\n\t\tpathToDelete = expandedPath\n\t}\n\treturn os.RemoveAll(pathToDelete)\n}", "func Execute(vers string, writeKey string) {\n\tchamberVersion = vers\n\n\tanalyticsWriteKey = writeKey\n\tanalyticsEnabled = analyticsWriteKey != \"\"\n\n\tif cmd, err := RootCmd.ExecuteC(); err != nil {\n\t\tif strings.Contains(err.Error(), \"arg(s)\") || strings.Contains(err.Error(), \"usage\") {\n\t\t\tcmd.Usage()\n\t\t}\n\t\tos.Exit(1)\n\t}\n}" ]
[ "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.56137", "0.56095433", "0.5601583", "0.5560212", "0.5559241", "0.5540715", "0.55331063", "0.55141866", "0.5508172", "0.55011404", "0.5485318", "0.547758", "0.54731494", "0.5471604", "0.5467846", "0.546129", "0.5455929", "0.5454822", "0.54506314", "0.5449201", "0.5438696", "0.5428131", "0.5417148", "0.54162455", "0.5411346", "0.54070526", "0.5384996", "0.5383459", "0.53805286", "0.53798777", "0.5379537", "0.5376874", "0.5367521", "0.5365123", "0.5354875", "0.5342029", "0.5338851", "0.5337583", "0.53355736", "0.5335289", "0.5335289", "0.53349614", "0.53342205", "0.5323654", "0.5319662", "0.5318404", "0.5318386", "0.5315666", "0.5314077", "0.5313697", "0.5307305", "0.52992123", "0.52963275", "0.52926165", "0.528754", "0.5285044", "0.5278139", "0.5277187", "0.5271034", "0.52704984", "0.5268128", "0.52641743", "0.5264101", "0.52619857", "0.5261084", "0.5257862", "0.52493155", "0.5245156", "0.52445674", "0.5242742", "0.5237795", "0.52361864", "0.5229696", "0.52291", "0.52217555", "0.5220164", "0.5216912", "0.52122295", "0.5208731" ]
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 := tx.\n\t\t\tModel(&model.User{ID: b.BotUserID}).\n\t\t\tUpdate(\"status\", model.UserAccountStatusDeactivated).\n\t\t\tError; err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := tx.Delete(&model.BotJoinChannel{}, &model.BotJoinChannel{BotID: id}).Error; err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := tx.Delete(&model.OAuth2Token{}, &model.OAuth2Token{ID: b.AccessTokenID}).Error; err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn tx.Delete(&model.Bot{}, &model.Bot{ID: id}).Error\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\trepo.hub.Publish(hub.Message{\n\t\tName: event.BotDeleted,\n\t\tFields: hub.Fields{\n\t\t\t\"bot_id\": id,\n\t\t},\n\t})\n\treturn nil\n}", "func ExampleBotsClient_Delete() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armbotservice.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\t_, err = clientFactory.NewBotsClient().Delete(ctx, \"OneResourceGroupName\", \"samplebotname\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n}", "func (repo *GormRepository) DeleteBot(id uuid.UUID) error {\n\tif id == uuid.Nil {\n\t\treturn 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\terrs := tx.Model(&model.User{ID: b.BotUserID}).Update(\"status\", model.UserAccountStatusDeactivated).New().\n\t\t\tDelete(&model.BotJoinChannel{}, &model.BotJoinChannel{BotID: id}).\n\t\t\tDelete(&model.OAuth2Token{}, &model.OAuth2Token{ID: b.AccessTokenID}).\n\t\t\tDelete(&model.Bot{}, &model.Bot{ID: id}).\n\t\t\tGetErrors()\n\t\tif len(errs) > 0 {\n\t\t\treturn errs[0]\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\trepo.hub.Publish(hub.Message{\n\t\tName: event.BotDeleted,\n\t\tFields: hub.Fields{\n\t\t\t\"bot_id\": id,\n\t\t},\n\t})\n\treturn nil\n}", "func (a *API) DeleteBot(id string) error {\n\treturn a.Call(\"delete_bot\", &deleteBotRequest{\n\t\tBotID: id,\n\t}, &emptyResponse{})\n}", "func ExampleBotConnectionClient_Delete() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armbotservice.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\t_, err = clientFactory.NewBotConnectionClient().Delete(ctx, \"OneResourceGroupName\", \"samplebotname\", \"sampleConnection\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n}", "func (c *Client) DeleteSecretAndVersions(ctx context.Context, secretName string, projectId string) error {\n\tdeleteSecretReq := pb.DeleteSecretRequest{\n\t\tName: fmt.Sprintf(\"projects/%v/secrets/%v\", projectId, secretName),\n\t}\n\t\n\terr := c.smc.DeleteSecret(ctx, &deleteSecretReq)\n\tif err == nil {\n\t\tlog.Printf(\"Secret Deleted Successfully\")\n\t}\n\t\n\treturn err\n}", "func AgbotDelete(urlSuffix, credentials string, goodHttpCodes []int) (httpCode int) {\n\t// get message printer\n\tmsgPrinter := i18n.GetMessagePrinter()\n\n\t// check the agbot url\n\tagbot_url := GetAgbotSecureAPIUrlBase()\n\tif agbot_url == \"\" {\n\t\tFatal(HTTP_ERROR, msgPrinter.Sprintf(\"HZN_AGBOT_URL is not defined\"))\n\t}\n\n\t// query the agbot secure api\n\thttpCode = ExchangeDelete(\"Agbot\", agbot_url, urlSuffix, credentials, goodHttpCodes)\n\n\t// ExchangeDelete checks the http code, so we can just directly return\n\treturn httpCode\n}", "func (d *DatabaseConnection) DeleteLifelessBottles() error {\n\tsqlStatement := `DELETE from bottles where lives = 0;`\n\n\t_, err := d.db.Exec(sqlStatement)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (a *DefaultClient) DeleteAllVersions(file vfs.File) error {\n\tURL, err := url.Parse(file.Location().(*Location).ContainerURL())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontainerURL := azblob.NewContainerURL(*URL, a.pipeline)\n\tblobURL := containerURL.NewBlockBlobURL(utils.RemoveLeadingSlash(file.Path()))\n\n\tversions, err := a.getBlobVersions(containerURL, utils.RemoveLeadingSlash(file.Path()))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, version := range versions {\n\t\t// Delete a specific version\n\t\t_, err = blobURL.WithVersionID(*version).Delete(context.Background(), azblob.DeleteSnapshotsOptionNone, azblob.BlobAccessConditions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn err\n}", "func (api *APIClient) DeleteVault(vaultName string) error {\n\tdeleteVaultRequest := graphql.NewRequest(deleteVaultRequestString)\n\tdeleteVaultInput := DeleteVaultInput{\n\t\tAffiliationName: api.Affiliation,\n\t\tVaultName: vaultName,\n\t}\n\tdeleteVaultRequest.Var(\"deleteVaultInput\", deleteVaultInput)\n\n\tvar deleteVaultResponse DeleteVaultResponse\n\tif err := api.RunGraphQlMutation(deleteVaultRequest, &deleteVaultResponse); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (bm *BlobsManifest) Delete() error {\n\n\tfor _, chunk := range bm.Chunks {\n\t\t// for Huge Blob mode, no need remove blobs\n\t\t_, _, length := utils.ParseBlobDigest(chunk)\n\t\tif length != 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tb := blobs.GetBlobPartial(\"\", chunk)\n\t\tif b != nil {\n\t\t\tb.Delete()\n\t\t}\n\t}\n\n\t// to remove Huge Blob Image\n\timageDir := configuration.RootDirectory() + manifest.ManifestDir + \"/\" + bm.BlobSum\n\tutils.RemoveDir(imageDir)\n\n\tutils.Remove(blobsManifestPath(bm.BlobSum))\n\n\treturn nil\n}", "func (bot *Bot) DeleteWebhook() (err error) {\n\t_, resBody, err := bot.client.PostForm(methodDeleteWebhook, nil, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"DeleteWebhook: %w\", err)\n\t}\n\n\tres := &response{}\n\terr = json.Unmarshal(resBody, res)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"DeleteWebhook: %w\", err)\n\t}\n\n\treturn nil\n}", "func (c *client) Delete(ctx context.Context, group, name, vaultName string) error {\n\tsecret, err := c.Get(ctx, group, name, vaultName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(*secret) == 0 {\n\t\treturn fmt.Errorf(\"Keysecret [%s] not found\", name)\n\t}\n\n\trequest, err := getSecretRequest(wssdcloudcommon.Operation_DELETE, name, vaultName, group, &(*secret)[0])\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = c.SecretAgentClient.Invoke(ctx, request)\n\treturn err\n}", "func (w *ServerInterfaceWrapper) DeleteAllOrders(ctx echo.Context) error {\n\tvar err error\n\n\tctx.Set(ApiKeyAuthScopes, []string{\"\"})\n\n\t// Parameter object where we will unmarshal all parameters from the context\n\tvar params DeleteAllOrdersParams\n\t// ------------- Optional query parameter \"symbol\" -------------\n\n\terr = runtime.BindQueryParameter(\"form\", true, false, \"symbol\", ctx.QueryParams(), &params.Symbol)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter symbol: %s\", err))\n\t}\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.DeleteAllOrders(ctx, params)\n\treturn err\n}", "func (c *Client) DeleteBottle(path string) (*http.Response, error) {\n\tvar body io.Reader\n\tu := url.URL{Host: c.Host, Scheme: c.Scheme, Path: path}\n\treq, err := http.NewRequest(\"DELETE\", u.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader := req.Header\n\theader.Set(\"Content-Type\", \"application/json\")\n\treturn c.Client.Do(req)\n}", "func (a *Autocompleter) DeleteTerms(terms ...Suggestion) error {\n\tconn := a.pool.Get()\n\tdefer conn.Close()\n\n\ti := 0\n\tfor _, term := range terms {\n\n\t\targs := redis.Args{a.name, term.Term}\n\t\tif err := conn.Send(\"FT.SUGDEL\", args...); err != nil {\n\t\t\treturn err\n\t\t}\n\t\ti++\n\t}\n\tif err := conn.Flush(); err != nil {\n\t\treturn err\n\t}\n\tfor i > 0 {\n\t\tif _, err := conn.Receive(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\ti--\n\t}\n\treturn nil\n}", "func DeleteBotProxyWebHook(id string) (*webhook.DeleteWebhooksWebhookIDOK, error) {\n\tclient := getBotProxyClient()\n\tparams := webhook.NewDeleteWebhooksWebhookIDParams()\n\tparams.WebhookID = id\n\n\treturn client.Webhook.DeleteWebhooksWebhookID(params)\n}", "func (bot *bot) onGuildDelete(s *discordgo.Session, msg *discordgo.GuildDelete) {\n\tbot.logger.Debugf(\"Got GuildDelete event: %s\", msg.ID)\n\tbot.removeGuildChannels(guildID(msg.ID))\n}", "func (client GroupClient) DeleteAllSecretsSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client,\n\t\treq,\n\t\tautorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "func (client *Client) DeleteWebHook() *VoidResponse {\n\tendpoint := client.baseURL + fmt.Sprintf(EndpointDeleteWebHook, client.accessToken)\n\trequest := gorequest.New().Get(endpoint).Set(UserAgentHeader, UserAgent+\"/\"+Version)\n\n\treturn &VoidResponse{\n\t\tClient: client,\n\t\tRequest: request,\n\t}\n}", "func (client GroupClient) DeleteAllSecrets(accountName string, databaseName string) (result autorest.Response, err error) {\n\treq, err := client.DeleteAllSecretsPreparer(accountName, databaseName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"catalog.GroupClient\", \"DeleteAllSecrets\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.DeleteAllSecretsSender(req)\n\tif err != nil {\n\t\tresult.Response = resp\n\t\terr = autorest.NewErrorWithError(err, \"catalog.GroupClient\", \"DeleteAllSecrets\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.DeleteAllSecretsResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"catalog.GroupClient\", \"DeleteAllSecrets\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func (s *service) DeleteAll(ctx context.Context, req *pb.Request, res *pb.Response) error {\n\tdone, err := s.repo.DeleteAll(\"\")\n\tif err != nil {\n\t\ttheerror := fmt.Sprintf(\"%v --from souscription_service\", err)\n\t\treturn errors.New(theerror)\n\t}\n\tres.Done = done\n\treturn nil\n}", "func (p *xlStorageDiskIDCheck) DeleteVersions(ctx context.Context, volume string, versions []FileInfoVersions) (errs []error) {\n\t// Merely for tracing storage\n\tpath := \"\"\n\tif len(versions) > 0 {\n\t\tpath = versions[0].Name\n\t}\n\terrs = make([]error, len(versions))\n\tctx, done, err := p.TrackDiskHealth(ctx, storageMetricDeleteVersions, volume, path)\n\tif err != nil {\n\t\tfor i := range errs {\n\t\t\terrs[i] = ctx.Err()\n\t\t}\n\t\treturn errs\n\t}\n\tdefer done(&err)\n\terrs = p.storage.DeleteVersions(ctx, volume, versions)\n\tfor i := range errs {\n\t\tif errs[i] != nil {\n\t\t\terr = errs[i]\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn errs\n}", "func (gc *GraphClient) DeleteRelations(relations []knowledge.Relation) error {\n\trequestBody := DeleteGraphRelationRequestBody{}\n\trequestBody.Relations = relations\n\n\tb, err := json.Marshal(requestBody)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Unable to marshall request body\")\n\t}\n\n\treq, err := gc.newRequest(context.Background(), \"DELETE\", \"/api/graph/relations\", bytes.NewBuffer(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, err := gc.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode == http.StatusUnauthorized {\n\t\treturn fmt.Errorf(\"Unauthorized access. Check your auth token\")\n\t} else if res.StatusCode == http.StatusTooManyRequests {\n\t\treturn ErrTooManyRequests\n\t} else if res.StatusCode != http.StatusOK {\n\t\treturn handleUnexpectedResponse(res)\n\t}\n\treturn nil\n}", "func (o *Vote) Delete(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Vote provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), votePrimaryKeyMapping)\n\tsql := \"DELETE FROM `vote` WHERE `id`=?\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete from vote\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (b *Executor) Delete() (err error) {\n\tif b.builder != nil {\n\t\terr = b.builder.Delete()\n\t\tb.builder = nil\n\t}\n\treturn err\n}", "func (o VoteSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no Vote slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(voteBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), votePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `vote` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, votePrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from vote slice\")\n\t}\n\n\tif len(voteAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (client VersionsClient) DeleteSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "func (c *Client) DeleteSecretVersion(secretBlindName string, version string) error {\n\trawURL := fmt.Sprintf(pathSecretVersion, c.base.String(), secretBlindName, version)\n\terr := c.delete(rawURL, true, nil)\n\treturn errio.Error(err)\n}", "func DeleteAllBlogPostVersion(ctx context.Context) error {\n\tq := datastore.NewQuery(blogPostVersionKind).KeysOnly()\n\tk, err := q.GetAll(ctx, nil)\n\tdatastore.DeleteMulti(ctx, k)\n\treturn err\n}", "func (s Secret) Delete() error {\n\treturn Delete(s.client, getSecret(s.Name, s.Namespace, s.labels))\n}", "func (c *Client) Delete(labels map[string]string, wait bool) error {\n\n\t// convert labels to selector\n\tselector := util.ConvertLabelsToSelector(labels)\n\tklog.V(3).Infof(\"Selectors used for deletion: %s\", selector)\n\n\tvar errorList []string\n\tvar deletionPolicy = metav1.DeletePropagationBackground\n\n\t// for --wait flag, it deletes component dependents first and then delete component\n\tif wait {\n\t\tdeletionPolicy = metav1.DeletePropagationForeground\n\t}\n\t// Delete Deployments\n\tklog.V(3).Info(\"Deleting Deployments\")\n\terr := c.appsClient.Deployments(c.Namespace).DeleteCollection(context.TODO(), metav1.DeleteOptions{PropagationPolicy: &deletionPolicy}, metav1.ListOptions{LabelSelector: selector})\n\tif err != nil {\n\t\terrorList = append(errorList, \"unable to delete deployments\")\n\t}\n\n\t// for --wait it waits for component to be deleted\n\t// TODO: Need to modify for `odo app delete`, currently wait flag is added only in `odo component delete`\n\t// so only one component gets passed in selector\n\tif wait {\n\t\terr = c.WaitForComponentDeletion(selector)\n\t\tif err != nil {\n\t\t\terrorList = append(errorList, err.Error())\n\t\t}\n\t}\n\n\t// Error string\n\terrString := strings.Join(errorList, \",\")\n\tif len(errString) != 0 {\n\t\treturn errors.New(errString)\n\t}\n\treturn nil\n\n}", "func (c *BotsClient) Close() error {\n\treturn c.internalClient.Close()\n}", "func ExampleLexModelBuildingService_GetBots_shared00() {\n\tsvc := lexmodelbuildingservice.New(session.New())\n\tinput := &lexmodelbuildingservice.GetBotsInput{\n\t\tMaxResults: aws.Int64(5),\n\t\tNextToken: aws.String(\"\"),\n\t}\n\n\tresult, err := svc.GetBots(input)\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\n\t\t\tcase lexmodelbuildingservice.ErrCodeNotFoundException:\n\t\t\t\tfmt.Println(lexmodelbuildingservice.ErrCodeNotFoundException, aerr.Error())\n\t\t\tcase lexmodelbuildingservice.ErrCodeLimitExceededException:\n\t\t\t\tfmt.Println(lexmodelbuildingservice.ErrCodeLimitExceededException, aerr.Error())\n\t\t\tcase lexmodelbuildingservice.ErrCodeInternalFailureException:\n\t\t\t\tfmt.Println(lexmodelbuildingservice.ErrCodeInternalFailureException, aerr.Error())\n\t\t\tcase lexmodelbuildingservice.ErrCodeBadRequestException:\n\t\t\t\tfmt.Println(lexmodelbuildingservice.ErrCodeBadRequestException, aerr.Error())\n\t\t\tdefault:\n\t\t\t\tfmt.Println(aerr.Error())\n\t\t\t}\n\t\t} else {\n\t\t\t// Print the error, cast err to awserr.Error to get the Code and\n\t\t\t// Message from an error.\n\t\t\tfmt.Println(err.Error())\n\t\t}\n\t\treturn\n\t}\n\n\tfmt.Println(result)\n}", "func Delete(s *discordgo.Session, m *discordgo.MessageCreate) {\n}", "func (c *Client) PathDestroyVersions(i *PathInput, versions []int) error {\n\tvar err error\n\n\t// Initialize the input\n\ti.opType = \"destroyversions\"\n\terr = c.InitPathInput(i)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to init destroy path %s: %w\", i.Path, err)\n\t}\n\n\td := map[string]interface{}{\n\t\t\"versions\": versions,\n\t}\n\n\t// Do the actual destroy\n\t_, err = c.Logical().Write(i.opPath, d)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to destroy secret at %s: %w\", i.opPath, err)\n\t}\n\n\treturn err\n}", "func (o ChannelSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(channelBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), channelPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"channels\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, channelPrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from channel slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for channels\")\n\t}\n\n\tif len(channelAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (d *Demo) DeleteAll(g *gom.Gom) {\n\ttoolkit.Println(\"===== Delete All =====\")\n\n\tvar err error\n\tif d.useParams {\n\t\t_, err = g.Set(&gom.SetParams{\n\t\t\tTableName: \"hero\",\n\t\t\tFilter: gom.EndWith(\"Name\", \"man\"),\n\t\t\tTimeout: 10,\n\t\t}).Cmd().DeleteAll()\n\t} else {\n\t\t_, err = g.Set(nil).Table(\"hero\").Timeout(10).Filter(gom.EndWith(\"Name\", \"man\")).Cmd().DeleteAll()\n\t}\n\n\tif err != nil {\n\t\ttoolkit.Println(err.Error())\n\t\treturn\n\t}\n}", "func Delete(ctx context.Context) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"delete <name>\",\n\t\tShort: \"Delete a namespace\",\n\t\tArgs: utils.MaximumNArgsAccepted(1, \"\"),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif err := contextCMD.NewContextCommand().Run(ctx, &contextCMD.ContextOptions{}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tnsToDelete := okteto.Context().Namespace\n\t\t\tif len(args) > 0 {\n\t\t\t\tnsToDelete = args[0]\n\t\t\t}\n\n\t\t\tif !okteto.IsOkteto() {\n\t\t\t\treturn oktetoErrors.ErrContextIsNotOktetoCluster\n\t\t\t}\n\n\t\t\tnsCmd, err := NewCommand()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = nsCmd.ExecuteDeleteNamespace(ctx, nsToDelete)\n\t\t\tanalytics.TrackDeleteNamespace(err == nil)\n\t\t\treturn err\n\t\t},\n\t}\n\treturn cmd\n}", "func (b *Bot) DeleteWebhook() bool {\n\turl := fmt.Sprintf(\"https://api.telegram.com/bot%s/deleteWebhook\", b.Token)\n\t_, err := http.Get(url)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "func (hc *Hailconfig) Delete(alias string) error {\n\tif !hc.IsPresent(alias) {\n\t\treturn fmt.Errorf(\"alias is not found\")\n\t}\n\tdelete(hc.Scripts, alias)\n\treturn nil\n}", "func (c *Client) Delete(indexName string) {\n\tclient := c.client\n\n\tr, err := client.DeleteIndex(indexName).Do()\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"%s\\n\", err.Error())\n\t\tos.Exit(1)\n\t}\n\tfmt.Fprintf(os.Stdout, \"%+v\\n\", r)\n}", "func (s *server) Delete(ctx context.Context, body *pb.NameHolder) (*pb.DeletionResponse, error) {\n\tappName := body.GetName()\n\tfilter := types.M{\n\t\tmongo.NameKey: appName,\n\t\tmongo.InstanceTypeKey: mongo.AppInstance,\n\t}\n\n\tnode, _ := redis.FetchAppNode(appName)\n\tgo redis.DecrementServiceLoad(ServiceName, node)\n\tgo redis.RemoveApp(appName)\n\tgo diskCleanup(appName)\n\n\tif configs.CloudflareConfig.PlugIn {\n\t\tgo cloudflare.DeleteRecord(appName, mongo.AppInstance)\n\t}\n\n\t_, err := mongo.DeleteInstance(filter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pb.DeletionResponse{Success: true}, nil\n}", "func ExampleVaultsClient_Delete() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armkeyvault.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\t_, err = clientFactory.NewVaultsClient().Delete(ctx, \"sample-resource-group\", \"sample-vault\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n}", "func (o OauthClientSlice) DeleteAll(exec boil.Executor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(oauthClientBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), oauthClientPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM `oauth_clients` WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, oauthClientPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\tresult, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from oauthClient slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for oauth_clients\")\n\t}\n\n\tif len(oauthClientAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rowsAff, nil\n}", "func (o *AuthToken) Delete(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no AuthToken provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), authTokenPrimaryKeyMapping)\n\tsql := \"DELETE FROM \\\"auth_tokens\\\" WHERE \\\"token\\\"=$1\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete from auth_tokens\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (be *s3) Delete() error {\n\talltypes := []backend.Type{\n\t\tbackend.Data,\n\t\tbackend.Key,\n\t\tbackend.Lock,\n\t\tbackend.Snapshot,\n\t\tbackend.Index}\n\n\tfor _, t := range alltypes {\n\t\terr := be.removeKeys(t)\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn be.Remove(backend.Config, \"\")\n}", "func (api *versionAPI) Delete(obj *cluster.Version) error {\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = apicl.ClusterV1().Version().Delete(context.Background(), &obj.ObjectMeta)\n\t\treturn err\n\t}\n\n\tapi.ct.handleVersionEvent(&kvstore.WatchEvent{Object: obj, Type: kvstore.Deleted})\n\treturn nil\n}", "func DeleteGame(w http.ResponseWriter, r *http.Request) {\n\timdbID := chi.URLParam(r, \"imdbID\")\n\n\terr := watchlist.DeleteGame(imdbID, r)\n\n\tif err != nil {\n\t\thttpext.AbortAPI(w, \"Deleting Game failed\", 500)\n\t\treturn\n\t}\n\n\thttpext.SuccessAPI(w, \"Game deleted succesfully\")\n}", "func ExampleBotsClient_Update() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armbotservice.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := clientFactory.NewBotsClient().Update(ctx, \"OneResourceGroupName\", \"samplebotname\", armbotservice.Bot{\n\t\tEtag: to.Ptr(\"etag1\"),\n\t\tKind: to.Ptr(armbotservice.KindSdk),\n\t\tLocation: to.Ptr(\"West US\"),\n\t\tSKU: &armbotservice.SKU{\n\t\t\tName: to.Ptr(armbotservice.SKUNameS1),\n\t\t},\n\t\tTags: map[string]*string{\n\t\t\t\"tag1\": to.Ptr(\"value1\"),\n\t\t\t\"tag2\": to.Ptr(\"value2\"),\n\t\t},\n\t\tProperties: &armbotservice.BotProperties{\n\t\t\tDescription: to.Ptr(\"The description of the bot\"),\n\t\t\tCmekKeyVaultURL: to.Ptr(\"https://myCmekKey\"),\n\t\t\tDeveloperAppInsightKey: to.Ptr(\"appinsightskey\"),\n\t\t\tDeveloperAppInsightsAPIKey: to.Ptr(\"appinsightsapikey\"),\n\t\t\tDeveloperAppInsightsApplicationID: to.Ptr(\"appinsightsappid\"),\n\t\t\tDisableLocalAuth: to.Ptr(true),\n\t\t\tDisplayName: to.Ptr(\"The Name of the bot\"),\n\t\t\tEndpoint: to.Ptr(\"http://mybot.coffee\"),\n\t\t\tIconURL: to.Ptr(\"http://myicon\"),\n\t\t\tIsCmekEnabled: to.Ptr(true),\n\t\t\tLuisAppIDs: []*string{\n\t\t\t\tto.Ptr(\"luisappid1\"),\n\t\t\t\tto.Ptr(\"luisappid2\")},\n\t\t\tLuisKey: to.Ptr(\"luiskey\"),\n\t\t\tMsaAppID: to.Ptr(\"msaappid\"),\n\t\t\tMsaAppMSIResourceID: to.Ptr(\"/subscriptions/foo/resourcegroups/bar/providers/microsoft.managedidentity/userassignedidentities/sampleId\"),\n\t\t\tMsaAppTenantID: to.Ptr(\"msaapptenantid\"),\n\t\t\tMsaAppType: to.Ptr(armbotservice.MsaAppTypeUserAssignedMSI),\n\t\t\tPublicNetworkAccess: to.Ptr(armbotservice.PublicNetworkAccessEnabled),\n\t\t\tSchemaTransformationVersion: to.Ptr(\"1.0\"),\n\t\t},\n\t}, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.Bot = armbotservice.Bot{\n\t// \tName: to.Ptr(\"samplebotname\"),\n\t// \tType: to.Ptr(\"Microsoft.BotService/botServices\"),\n\t// \tEtag: to.Ptr(\"etag1\"),\n\t// \tID: to.Ptr(\"/subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.BotService/botServices/samplebotname\"),\n\t// \tKind: to.Ptr(armbotservice.KindSdk),\n\t// \tLocation: to.Ptr(\"West US\"),\n\t// \tTags: map[string]*string{\n\t// \t\t\"tag1\": to.Ptr(\"value1\"),\n\t// \t\t\"tag2\": to.Ptr(\"value2\"),\n\t// \t},\n\t// \tProperties: &armbotservice.BotProperties{\n\t// \t\tDescription: to.Ptr(\"The description of the bot\"),\n\t// \t\tCmekKeyVaultURL: to.Ptr(\"https://myCmekKey\"),\n\t// \t\tConfiguredChannels: []*string{\n\t// \t\t\tto.Ptr(\"facebook\"),\n\t// \t\t\tto.Ptr(\"groupme\")},\n\t// \t\t\tDeveloperAppInsightKey: to.Ptr(\"appinsightskey\"),\n\t// \t\t\tDeveloperAppInsightsApplicationID: to.Ptr(\"appinsightsappid\"),\n\t// \t\t\tDisableLocalAuth: to.Ptr(true),\n\t// \t\t\tDisplayName: to.Ptr(\"The Name of the bot\"),\n\t// \t\t\tEnabledChannels: []*string{\n\t// \t\t\t\tto.Ptr(\"facebook\")},\n\t// \t\t\t\tEndpoint: to.Ptr(\"http://mybot.coffee\"),\n\t// \t\t\t\tEndpointVersion: to.Ptr(\"version\"),\n\t// \t\t\t\tIconURL: to.Ptr(\"http://myicon\"),\n\t// \t\t\t\tIsCmekEnabled: to.Ptr(true),\n\t// \t\t\t\tLuisAppIDs: []*string{\n\t// \t\t\t\t\tto.Ptr(\"luisappid1\"),\n\t// \t\t\t\t\tto.Ptr(\"luisappid2\")},\n\t// \t\t\t\t\tMsaAppID: to.Ptr(\"msaappid\"),\n\t// \t\t\t\t\tMsaAppMSIResourceID: to.Ptr(\"/subscriptions/foo/resourcegroups/bar/providers/microsoft.managedidentity/userassignedidentities/sampleId\"),\n\t// \t\t\t\t\tMsaAppTenantID: to.Ptr(\"msaapptenantid\"),\n\t// \t\t\t\t\tMsaAppType: to.Ptr(armbotservice.MsaAppTypeUserAssignedMSI),\n\t// \t\t\t\t\tPublicNetworkAccess: to.Ptr(armbotservice.PublicNetworkAccessEnabled),\n\t// \t\t\t\t\tSchemaTransformationVersion: to.Ptr(\"1.0\"),\n\t// \t\t\t\t},\n\t// \t\t\t}\n}", "func (q dMessageEmbedQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"models: no dMessageEmbedQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from d_message_embeds\")\n\t}\n\n\treturn nil\n}", "func (t *TestUtil) DeleteAllSlackChannels(namespace string) {\n\t// Specify namespace in list Options\n\tlistOptions := &client.ListOptions{Namespace: namespace}\n\n\t// List channels in a specified namespace\n\tchannelList := &slackv1alpha1.ChannelList{}\n\terr := t.k8sClient.List(context.TODO(), channelList, listOptions)\n\tif err != nil {\n\t\tginkgo.Fail(err.Error())\n\t}\n\n\tfor _, channel := range channelList.Items {\n\t\tchannel.Finalizers = []string{}\n\n\t\terr := t.k8sClient.Update(t.ctx, &channel)\n\t\tif err != nil {\n\t\t\tif err.Error() == fmt.Sprintf(mockdata.ChannelObjectModifiedError, channel.Name) {\n\t\t\t\tcurrentChannel := t.GetChannel(channel.Name, namespace)\n\t\t\t\tcurrentChannel.Finalizers = []string{}\n\t\t\t\tif err != nil {\n\t\t\t\t\tginkgo.Fail(err.Error())\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tginkgo.Fail(err.Error())\n\t\t\t}\n\t\t}\n\n\t\tt.TryDeleteChannel(channel.Name, namespace)\n\t}\n}", "func (client *Client) DeleteSnapshot(names ...string) (*Response, *ResponseStatus, error) {\n\treturn client.FormattedRequest(\"/delete/snapshot/%q\", strings.Join(names, \",\"))\n}", "func (o DMessageEmbedSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no DMessageEmbed slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), dMessageEmbedPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"d_message_embeds\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, dMessageEmbedPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(dMessageEmbedPrimaryKeyColumns), 1, len(dMessageEmbedPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from dMessageEmbed slice\")\n\t}\n\n\treturn nil\n}", "func (a *apiServer) DeleteAll(ctx context.Context, request *emptypb.Empty) (response *emptypb.Empty, retErr error) {\n\tif _, err := a.DeletePipelines(ctx, &pps.DeletePipelinesRequest{All: true, Force: true}); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := a.env.KubeClient.CoreV1().Secrets(a.namespace).DeleteCollection(ctx, metav1.DeleteOptions{}, metav1.ListOptions{\n\t\tLabelSelector: \"secret-source=pachyderm-user\",\n\t}); err != nil {\n\t\treturn nil, errors.EnsureStack(err)\n\t}\n\treturn &emptypb.Empty{}, nil\n}", "func (rc *ResourceCommand) Delete(ctx context.Context, client auth.ClientI) (err error) {\n\tsingletonResources := []string{\n\t\ttypes.KindClusterAuthPreference,\n\t\ttypes.KindClusterMaintenanceConfig,\n\t\ttypes.KindClusterNetworkingConfig,\n\t\ttypes.KindSessionRecordingConfig,\n\t\ttypes.KindInstaller,\n\t\ttypes.KindUIConfig,\n\t}\n\tif !slices.Contains(singletonResources, rc.ref.Kind) && (rc.ref.Kind == \"\" || rc.ref.Name == \"\") {\n\t\treturn trace.BadParameter(\"provide a full resource name to delete, for example:\\n$ tctl rm cluster/east\\n\")\n\t}\n\n\tswitch rc.ref.Kind {\n\tcase types.KindNode:\n\t\tif err = client.DeleteNode(ctx, apidefaults.Namespace, rc.ref.Name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"node %v has been deleted\\n\", rc.ref.Name)\n\tcase types.KindUser:\n\t\tif err = client.DeleteUser(ctx, rc.ref.Name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"user %q has been deleted\\n\", rc.ref.Name)\n\tcase types.KindRole:\n\t\tif err = client.DeleteRole(ctx, rc.ref.Name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"role %q has been deleted\\n\", rc.ref.Name)\n\tcase types.KindToken:\n\t\tif err = client.DeleteToken(ctx, rc.ref.Name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"token %q has been deleted\\n\", rc.ref.Name)\n\tcase types.KindSAMLConnector:\n\t\tif err = client.DeleteSAMLConnector(ctx, rc.ref.Name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"SAML connector %v has been deleted\\n\", rc.ref.Name)\n\tcase types.KindOIDCConnector:\n\t\tif err = client.DeleteOIDCConnector(ctx, rc.ref.Name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"OIDC connector %v has been deleted\\n\", rc.ref.Name)\n\tcase types.KindGithubConnector:\n\t\tif err = client.DeleteGithubConnector(ctx, rc.ref.Name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"github connector %q has been deleted\\n\", rc.ref.Name)\n\tcase types.KindReverseTunnel:\n\t\tif err := client.DeleteReverseTunnel(rc.ref.Name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"reverse tunnel %v has been deleted\\n\", rc.ref.Name)\n\tcase types.KindTrustedCluster:\n\t\tif err = client.DeleteTrustedCluster(ctx, rc.ref.Name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"trusted cluster %q has been deleted\\n\", rc.ref.Name)\n\tcase types.KindRemoteCluster:\n\t\tif err = client.DeleteRemoteCluster(ctx, rc.ref.Name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"remote cluster %q has been deleted\\n\", rc.ref.Name)\n\tcase types.KindSemaphore:\n\t\tif rc.ref.SubKind == \"\" || rc.ref.Name == \"\" {\n\t\t\treturn trace.BadParameter(\n\t\t\t\t\"full semaphore path must be specified (e.g. '%s/%s/[email protected]')\",\n\t\t\t\ttypes.KindSemaphore, types.SemaphoreKindConnection,\n\t\t\t)\n\t\t}\n\t\terr := client.DeleteSemaphore(ctx, types.SemaphoreFilter{\n\t\t\tSemaphoreKind: rc.ref.SubKind,\n\t\t\tSemaphoreName: rc.ref.Name,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"semaphore '%s/%s' has been deleted\\n\", rc.ref.SubKind, rc.ref.Name)\n\tcase types.KindClusterAuthPreference:\n\t\tif err = resetAuthPreference(ctx, client); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"cluster auth preference has been reset to defaults\\n\")\n\tcase types.KindClusterMaintenanceConfig:\n\t\tif err := client.DeleteClusterMaintenanceConfig(ctx); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"cluster maintenance configuration has been deleted\\n\")\n\tcase types.KindClusterNetworkingConfig:\n\t\tif err = resetClusterNetworkingConfig(ctx, client); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"cluster networking configuration has been reset to defaults\\n\")\n\tcase types.KindSessionRecordingConfig:\n\t\tif err = resetSessionRecordingConfig(ctx, client); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"session recording configuration has been reset to defaults\\n\")\n\tcase types.KindLock:\n\t\tname := rc.ref.Name\n\t\tif rc.ref.SubKind != \"\" {\n\t\t\tname = rc.ref.SubKind + \"/\" + name\n\t\t}\n\t\tif err = client.DeleteLock(ctx, name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"lock %q has been deleted\\n\", name)\n\tcase types.KindDatabaseServer:\n\t\tservers, err := client.GetDatabaseServers(ctx, apidefaults.Namespace)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tresDesc := \"database server\"\n\t\tservers = filterByNameOrPrefix(servers, rc.ref.Name)\n\t\tname, err := getOneResourceNameToDelete(servers, rc.ref, resDesc)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfor _, s := range servers {\n\t\t\terr := client.DeleteDatabaseServer(ctx, apidefaults.Namespace, s.GetHostID(), name)\n\t\t\tif err != nil {\n\t\t\t\treturn trace.Wrap(err)\n\t\t\t}\n\t\t}\n\t\tfmt.Printf(\"%s %q has been deleted\\n\", resDesc, name)\n\tcase types.KindNetworkRestrictions:\n\t\tif err = resetNetworkRestrictions(ctx, client); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"network restrictions have been reset to defaults (allow all)\\n\")\n\tcase types.KindApp:\n\t\tif err = client.DeleteApp(ctx, rc.ref.Name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"application %q has been deleted\\n\", rc.ref.Name)\n\tcase types.KindDatabase:\n\t\tdatabases, err := client.GetDatabases(ctx)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tresDesc := \"database\"\n\t\tdatabases = filterByNameOrPrefix(databases, rc.ref.Name)\n\t\tname, err := getOneResourceNameToDelete(databases, rc.ref, resDesc)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tif err := client.DeleteDatabase(ctx, name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"%s %q has been deleted\\n\", resDesc, name)\n\tcase types.KindKubernetesCluster:\n\t\tclusters, err := client.GetKubernetesClusters(ctx)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tresDesc := \"kubernetes cluster\"\n\t\tclusters = filterByNameOrPrefix(clusters, rc.ref.Name)\n\t\tname, err := getOneResourceNameToDelete(clusters, rc.ref, resDesc)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tif err := client.DeleteKubernetesCluster(ctx, name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"%s %q has been deleted\\n\", resDesc, name)\n\tcase types.KindWindowsDesktopService:\n\t\tif err = client.DeleteWindowsDesktopService(ctx, rc.ref.Name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"windows desktop service %q has been deleted\\n\", rc.ref.Name)\n\tcase types.KindWindowsDesktop:\n\t\tdesktops, err := client.GetWindowsDesktops(ctx,\n\t\t\ttypes.WindowsDesktopFilter{Name: rc.ref.Name})\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tif len(desktops) == 0 {\n\t\t\treturn trace.NotFound(\"no desktops with name %q were found\", rc.ref.Name)\n\t\t}\n\t\tdeleted := 0\n\t\tvar errs []error\n\t\tfor _, desktop := range desktops {\n\t\t\tif desktop.GetName() == rc.ref.Name {\n\t\t\t\tif err = client.DeleteWindowsDesktop(ctx, desktop.GetHostID(), rc.ref.Name); err != nil {\n\t\t\t\t\terrs = append(errs, err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tdeleted++\n\t\t\t}\n\t\t}\n\t\tif deleted == 0 {\n\t\t\terrs = append(errs,\n\t\t\t\ttrace.Errorf(\"failed to delete any desktops with the name %q, %d were found\",\n\t\t\t\t\trc.ref.Name, len(desktops)))\n\t\t}\n\t\tfmts := \"%d windows desktops with name %q have been deleted\"\n\t\tif err := trace.NewAggregate(errs...); err != nil {\n\t\t\tfmt.Printf(fmts+\" with errors while deleting\\n\", deleted, rc.ref.Name)\n\t\t\treturn err\n\t\t}\n\t\tfmt.Printf(fmts+\"\\n\", deleted, rc.ref.Name)\n\tcase types.KindCertAuthority:\n\t\tif rc.ref.SubKind == \"\" || rc.ref.Name == \"\" {\n\t\t\treturn trace.BadParameter(\n\t\t\t\t\"full %s path must be specified (e.g. '%s/%s/clustername')\",\n\t\t\t\ttypes.KindCertAuthority, types.KindCertAuthority, types.HostCA,\n\t\t\t)\n\t\t}\n\t\terr := client.DeleteCertAuthority(ctx, types.CertAuthID{\n\t\t\tType: types.CertAuthType(rc.ref.SubKind),\n\t\t\tDomainName: rc.ref.Name,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"%s '%s/%s' has been deleted\\n\", types.KindCertAuthority, rc.ref.SubKind, rc.ref.Name)\n\tcase types.KindKubeServer:\n\t\tservers, err := client.GetKubernetesServers(ctx)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tresDesc := \"kubernetes server\"\n\t\tservers = filterByNameOrPrefix(servers, rc.ref.Name)\n\t\tname, err := getOneResourceNameToDelete(servers, rc.ref, resDesc)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfor _, s := range servers {\n\t\t\terr := client.DeleteKubernetesServer(ctx, s.GetHostID(), name)\n\t\t\tif err != nil {\n\t\t\t\treturn trace.Wrap(err)\n\t\t\t}\n\t\t}\n\t\tfmt.Printf(\"%s %q has been deleted\\n\", resDesc, name)\n\tcase types.KindUIConfig:\n\t\terr := client.DeleteUIConfig(ctx)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"%s has been deleted\\n\", types.KindUIConfig)\n\tcase types.KindInstaller:\n\t\terr := client.DeleteInstaller(ctx, rc.ref.Name)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tif rc.ref.Name == installers.InstallerScriptName {\n\t\t\tfmt.Printf(\"%s has been reset to a default value\\n\", rc.ref.Name)\n\t\t} else {\n\t\t\tfmt.Printf(\"%s has been deleted\\n\", rc.ref.Name)\n\t\t}\n\tcase types.KindLoginRule:\n\t\tloginRuleClient := client.LoginRuleClient()\n\t\t_, err := loginRuleClient.DeleteLoginRule(ctx, &loginrulepb.DeleteLoginRuleRequest{\n\t\t\tName: rc.ref.Name,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn trail.FromGRPC(err)\n\t\t}\n\t\tfmt.Printf(\"login rule %q has been deleted\\n\", rc.ref.Name)\n\tcase types.KindSAMLIdPServiceProvider:\n\t\tif err := client.DeleteSAMLIdPServiceProvider(ctx, rc.ref.Name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"SAML IdP service provider %q has been deleted\\n\", rc.ref.Name)\n\tcase types.KindDevice:\n\t\tremote := client.DevicesClient()\n\t\tdevice, err := findDeviceByIDOrTag(ctx, remote, rc.ref.Name)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\n\t\tif _, err := remote.DeleteDevice(ctx, &devicepb.DeleteDeviceRequest{\n\t\t\tDeviceId: device[0].Id,\n\t\t}); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"Device %q removed\\n\", rc.ref.Name)\n\n\tcase types.KindIntegration:\n\t\tif err := client.DeleteIntegration(ctx, rc.ref.Name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"Integration %q removed\\n\", rc.ref.Name)\n\n\tcase types.KindAppServer:\n\t\tappServers, err := client.GetApplicationServers(ctx, rc.namespace)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tdeleted := false\n\t\tfor _, server := range appServers {\n\t\t\tif server.GetName() == rc.ref.Name {\n\t\t\t\tif err := client.DeleteApplicationServer(ctx, server.GetNamespace(), server.GetHostID(), server.GetName()); err != nil {\n\t\t\t\t\treturn trace.Wrap(err)\n\t\t\t\t}\n\t\t\t\tdeleted = true\n\t\t\t}\n\t\t}\n\t\tif !deleted {\n\t\t\treturn trace.NotFound(\"application server %q not found\", rc.ref.Name)\n\t\t}\n\t\tfmt.Printf(\"application server %q has been deleted\\n\", rc.ref.Name)\n\tcase types.KindOktaImportRule:\n\t\tif err := client.OktaClient().DeleteOktaImportRule(ctx, rc.ref.Name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"Okta import rule %q has been deleted\\n\", rc.ref.Name)\n\tcase types.KindUserGroup:\n\t\tif err := client.DeleteUserGroup(ctx, rc.ref.Name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"User group %q has been deleted\\n\", rc.ref.Name)\n\tcase types.KindProxy:\n\t\tif err := client.DeleteProxy(ctx, rc.ref.Name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"Proxy %q has been deleted\\n\", rc.ref.Name)\n\tcase types.KindAccessList:\n\t\tif err := client.AccessListClient().DeleteAccessList(ctx, rc.ref.Name); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tfmt.Printf(\"Access list %q has been deleted\\n\", rc.ref.Name)\n\tdefault:\n\t\treturn trace.BadParameter(\"deleting resources of type %q is not supported\", rc.ref.Kind)\n\t}\n\treturn nil\n}", "func (game *Game) Delete() error {\n\treturn os.RemoveAll(game.Directory)\n}", "func DeleteBlogVersionsViaLastUpdated(iLastUpdated time.Time) (err error) {\n\tvar has bool\n\tvar _BlogVersions = &BlogVersions{LastUpdated: iLastUpdated}\n\tif has, err = Engine.Get(_BlogVersions); (has == true) && (err == nil) {\n\t\tif row, err := Engine.Where(\"last_updated = ?\", iLastUpdated).Delete(new(BlogVersions)); (err != nil) || (row <= 0) {\n\t\t\treturn err\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn\n}", "func (o AuthTokenSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no AuthToken slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(authTokenBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), authTokenPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"auth_tokens\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, authTokenPrimaryKeyColumns, len(o))\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from authToken slice\")\n\t}\n\n\tif len(authTokenAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (a *Client) DeleteRuntimes(params *DeleteRuntimesParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteRuntimesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteRuntimesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"DeleteRuntimes\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/v1/runtimes\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &DeleteRuntimesReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*DeleteRuntimesOK), nil\n\n}", "func (s *APIServer) DeleteApps(c *gin.Context) {\n\tenvName := c.Param(\"envName\")\n\tenvMeta, err := env.GetEnvByName(envName)\n\tif err != nil {\n\t\tutil.HandleError(c, util.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tappName := c.Param(\"appName\")\n\n\to := common.DeleteOptions{\n\t\tClient: s.KubeClient,\n\t\tEnv: envMeta,\n\t\tAppName: appName,\n\t}\n\tmessage, err := o.DeleteApp()\n\tutil.AssembleResponse(c, message, err)\n}", "func (s *Storage) DeleteAll() error {\n\treturn s.restcli.Delete().RequestURI(s.listURI()).\n\t\tDo().Error()\n}", "func DeleteBlogVersionsViaDbVersion(iDbVersion string) (err error) {\n\tvar has bool\n\tvar _BlogVersions = &BlogVersions{DbVersion: iDbVersion}\n\tif has, err = Engine.Get(_BlogVersions); (has == true) && (err == nil) {\n\t\tif row, err := Engine.Where(\"db_version = ?\", iDbVersion).Delete(new(BlogVersions)); (err != nil) || (row <= 0) {\n\t\t\treturn err\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn\n}", "func (s *TokenStorage) Delete(refresh string) error {\n\tif refresh == \"\" {\n\t\treturn errors.New(\"RefreshToken is mandatory for DB delete\")\n\t}\n\n\tcollection := s.client.MD.Collection(TokenCollectionName)\n\n\t_, err := collection.DeleteOne(nil, bson.M{\"refresh\": refresh})\n\tif err != nil {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\t\"function\": \"Token.Delete\",\n\t\t\t\"error\": err,\n\t\t}).Debug(\"mongo request failed\")\n\t}\n\n\treturn err\n}", "func (o VoteSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif len(o) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), votePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := \"DELETE FROM \\\"vote\\\" WHERE \" +\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 1, votePrimaryKeyColumns, len(o))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from vote slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for vote\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (_BaseContent *BaseContentTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseContent.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "func Delete(params DeleteParams) error {\n\tif err := params.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\t_, _, err := params.V1API.PlatformConfigurationSnapshots.DeleteSnapshotRepository(\n\t\tplatform_configuration_snapshots.NewDeleteSnapshotRepositoryParams().\n\t\t\tWithRepositoryName(params.Name),\n\t\tparams.AuthWriter,\n\t)\n\n\treturn api.UnwrapError(err)\n}", "func (s *DeleteSlotTypeInput) SetBotVersion(v string) *DeleteSlotTypeInput {\n\ts.BotVersion = &v\n\treturn s\n}", "func (r *AppsModulesVersionsService) Delete(appsId string, modulesId string, versionsId string) *AppsModulesVersionsDeleteCall {\n\tc := &AppsModulesVersionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.appsId = appsId\n\tc.modulesId = modulesId\n\tc.versionsId = versionsId\n\treturn c\n}", "func (c *Command) DeleteAll() (int64, error) {\n\tclient := c.set.gom.GetClient()\n\n\tcollection := client.Database(c.set.gom.GetDatabase()).Collection(c.set.tableName)\n\n\tctx, cancelFunc := c.set.GetContext()\n\tdefer cancelFunc()\n\n\tres, err := collection.DeleteMany(ctx, c.set.filter)\n\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn res.DeletedCount, nil\n}", "func (m *Manager) Delete(vote models.Vote) error {\n\treturn m.Store.Database.Delete(&vote).Error\n}", "func (o *Cvtermsynonym) Delete(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no Cvtermsynonym provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cvtermsynonymPrimaryKeyMapping)\n\tsql := \"DELETE FROM \\\"cvtermsynonym\\\" WHERE \\\"cvtermsynonym_id\\\"=$1\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete from cvtermsynonym\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *FakeRobots) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {\n\t_, err := c.Fake.\n\t\tInvokes(testing.NewDeleteAction(robotsResource, c.ns, name), &v1alpha1.Robot{})\n\n\treturn err\n}", "func (_BaseContentSpace *BaseContentSpaceTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseContentSpace.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "func (n *NodeServiceImpl) DeleteNodeAppVersion(tx interface{}, namespace string, app *specV1.Application) ([]string, error) {\n\tif app.Selector == \"\" {\n\t\treturn nil, nil\n\t}\n\n\t// list nodes\n\tnodeList, err := n.Node.ListNode(tx, namespace, &models.ListOptions{LabelSelector: app.Selector})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// update nodes\n\tvar nodes []string\n\tfor idx := range nodeList.Items {\n\t\tnode := &nodeList.Items[idx]\n\t\tnodes = append(nodes, node.Name)\n\t}\n\terr = n.UpdateDesire(tx, namespace, nodes, app, DeleteNodeDesireByApp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn nodes, nil\n}", "func (n *NodeClient) Delete(twin, deployment uint32) (err error) {\n\turl := n.url(\"deployment\", fmt.Sprint(twin), fmt.Sprint(deployment))\n\n\trequest, err := http.NewRequest(http.MethodDelete, url, nil)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to build request\")\n\t}\n\n\tif err := n.client.authorize(request); err != nil {\n\t\treturn errors.Wrap(err, \"failed to sign request\")\n\t}\n\n\tresponse, err := http.DefaultClient.Do(request)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := n.response(response, nil, http.StatusAccepted); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (q voteQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"models: no voteQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete all from vote\")\n\t}\n\n\treturn nil\n}", "func (bot *DiscordBot) Close() error {\n\tvar closeErr error\n\n\tif err := bot.watcher.Close(); err != nil {\n\t\tcloseErr = err\n\t}\n\tif err := bot.state.Session.Close(); err != nil {\n\t\tcloseErr = err\n\t}\n\n\treturn closeErr\n}", "func (c *Chart) Delete(ctx context.Context, version string) error {\n\tlock := c.Space.SpaceManager.Lock.Get(c.Space.Name(), c.Name(), version)\n\tif !lock.Lock(c.Space.SpaceManager.LockTimeout) {\n\t\treturn ErrorLocking.Format(\"version\", c.Space.Name()+\"/\"+c.Name()+\"/\"+version)\n\t}\n\terr := deleteKeys(ctx, c.Space.SpaceManager.Backend, path.Join(c.Prefix, version), true)\n\t// unlock before return\n\tlock.Unlock()\n\tif err != nil {\n\t\treturn err\n\t}\n\tversions, err := c.List(ctx)\n\tif err == nil && len(versions) <= 0 {\n\t\t// delete chart if has no version\n\t\treturn c.Space.Delete(ctx, c.Chart)\n\t}\n\treturn err\n}", "func (keeper Keeper) DeleteVotes(ctx sdk.Context, proposalID uint64) {\n\tvotes := keeper.GetVotes(ctx, proposalID)\n\tfor _, vote := range votes {\n\t\tkeeper.deleteVote(ctx, vote.ProposalID, vote.Voter)\n\t}\n}", "func (r *ChatRequest) Delete(ctx context.Context) error {\n\treturn r.JSONRequest(ctx, \"DELETE\", \"\", nil, nil)\n}", "func (o *Vote) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif o == nil {\n\t\treturn 0, errors.New(\"models: no Vote provided for delete\")\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), votePrimaryKeyMapping)\n\tsql := \"DELETE FROM \\\"vote\\\" WHERE \\\"hash\\\"=$1\"\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete from vote\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by delete for vote\")\n\t}\n\n\treturn rowsAff, nil\n}", "func deleteAllHelm(root, profile string) error {\n\tparser := yaml.NewParser()\n\terr := parser.Parse(profile)\n\tif err != nil {\n\t\tlog.Fatalf(\"parser.Parse profile error: err=%s\", err)\n\t}\n\texec := exec.NewExec(root)\n\tfor _, su := range parser.Profile.ServiceUnits {\n\t\tfor _, app := range su.Applications {\n\t\t\tshell := exec.Delete(app.Name)\n\t\t\tlog.Infof(\"DeleteAllCharts: root=%s, profile=%s, su=%s, app=%s, shell=%v\",\n\t\t\t\troot, profile, su.Name, app.Name, shell)\n\t\t\terr := exec.Do(shell)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Helm delete error: err=%s\", err)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n\n}", "func (s *Service) DeleteManyBuilds(bucket string, status string) *DeleteManyBuildsCall {\n\tc := &DeleteManyBuildsCall{s: s, urlParams_: make(gensupport.URLParams)}\n\tc.bucket = bucket\n\tc.urlParams_.Set(\"status\", status)\n\treturn c\n}", "func (l *Language) Delete() error {\n\treturn l.post(\"/languages/delete\", nil, nil, nil)\n}", "func (s *DeleteSlotInput) SetBotVersion(v string) *DeleteSlotInput {\n\ts.BotVersion = &v\n\treturn s\n}", "func (serv *AppServer) DeleteTwoot(dID int) {\n\tserv.ServerRequest([]string{\"DeleteTwoot\", strconv.Itoa(dID)})\n}", "func (o *DMessageEmbed) Delete(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no DMessageEmbed provided for delete\")\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), dMessageEmbedPrimaryKeyMapping)\n\tsql := \"DELETE FROM \\\"d_message_embeds\\\" WHERE \\\"id\\\"=$1\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args...)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to delete from d_message_embeds\")\n\t}\n\n\treturn nil\n}", "func ExampleBotsClient_Create() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armbotservice.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := clientFactory.NewBotsClient().Create(ctx, \"OneResourceGroupName\", \"samplebotname\", armbotservice.Bot{\n\t\tEtag: to.Ptr(\"etag1\"),\n\t\tKind: to.Ptr(armbotservice.KindSdk),\n\t\tLocation: to.Ptr(\"West US\"),\n\t\tSKU: &armbotservice.SKU{\n\t\t\tName: to.Ptr(armbotservice.SKUNameS1),\n\t\t},\n\t\tTags: map[string]*string{\n\t\t\t\"tag1\": to.Ptr(\"value1\"),\n\t\t\t\"tag2\": to.Ptr(\"value2\"),\n\t\t},\n\t\tProperties: &armbotservice.BotProperties{\n\t\t\tDescription: to.Ptr(\"The description of the bot\"),\n\t\t\tCmekKeyVaultURL: to.Ptr(\"https://myCmekKey\"),\n\t\t\tDeveloperAppInsightKey: to.Ptr(\"appinsightskey\"),\n\t\t\tDeveloperAppInsightsAPIKey: to.Ptr(\"appinsightsapikey\"),\n\t\t\tDeveloperAppInsightsApplicationID: to.Ptr(\"appinsightsappid\"),\n\t\t\tDisableLocalAuth: to.Ptr(true),\n\t\t\tDisplayName: to.Ptr(\"The Name of the bot\"),\n\t\t\tEndpoint: to.Ptr(\"http://mybot.coffee\"),\n\t\t\tIconURL: to.Ptr(\"http://myicon\"),\n\t\t\tIsCmekEnabled: to.Ptr(true),\n\t\t\tLuisAppIDs: []*string{\n\t\t\t\tto.Ptr(\"luisappid1\"),\n\t\t\t\tto.Ptr(\"luisappid2\")},\n\t\t\tLuisKey: to.Ptr(\"luiskey\"),\n\t\t\tMsaAppID: to.Ptr(\"exampleappid\"),\n\t\t\tMsaAppMSIResourceID: to.Ptr(\"/subscriptions/foo/resourcegroups/bar/providers/microsoft.managedidentity/userassignedidentities/sampleId\"),\n\t\t\tMsaAppTenantID: to.Ptr(\"exampleapptenantid\"),\n\t\t\tMsaAppType: to.Ptr(armbotservice.MsaAppTypeUserAssignedMSI),\n\t\t\tPublicNetworkAccess: to.Ptr(armbotservice.PublicNetworkAccessEnabled),\n\t\t\tSchemaTransformationVersion: to.Ptr(\"1.0\"),\n\t\t},\n\t}, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.Bot = armbotservice.Bot{\n\t// \tName: to.Ptr(\"samplebotname\"),\n\t// \tType: to.Ptr(\"Microsoft.BotService/botServices\"),\n\t// \tEtag: to.Ptr(\"etag1\"),\n\t// \tID: to.Ptr(\"/subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.BotService/botServices/samplebotname\"),\n\t// \tKind: to.Ptr(armbotservice.KindSdk),\n\t// \tLocation: to.Ptr(\"West US\"),\n\t// \tTags: map[string]*string{\n\t// \t\t\"tag1\": to.Ptr(\"value1\"),\n\t// \t\t\"tag2\": to.Ptr(\"value2\"),\n\t// \t},\n\t// \tProperties: &armbotservice.BotProperties{\n\t// \t\tDescription: to.Ptr(\"The description of the bot\"),\n\t// \t\tCmekKeyVaultURL: to.Ptr(\"https://myCmekKey\"),\n\t// \t\tConfiguredChannels: []*string{\n\t// \t\t\tto.Ptr(\"facebook\"),\n\t// \t\t\tto.Ptr(\"groupme\")},\n\t// \t\t\tDeveloperAppInsightKey: to.Ptr(\"appinsightskey\"),\n\t// \t\t\tDeveloperAppInsightsApplicationID: to.Ptr(\"appinsightsappid\"),\n\t// \t\t\tDisableLocalAuth: to.Ptr(true),\n\t// \t\t\tDisplayName: to.Ptr(\"The Name of the bot\"),\n\t// \t\t\tEnabledChannels: []*string{\n\t// \t\t\t\tto.Ptr(\"facebook\")},\n\t// \t\t\t\tEndpoint: to.Ptr(\"http://mybot.coffee\"),\n\t// \t\t\t\tEndpointVersion: to.Ptr(\"version\"),\n\t// \t\t\t\tIconURL: to.Ptr(\"http://myicon\"),\n\t// \t\t\t\tIsCmekEnabled: to.Ptr(true),\n\t// \t\t\t\tLuisAppIDs: []*string{\n\t// \t\t\t\t\tto.Ptr(\"luisappid1\"),\n\t// \t\t\t\t\tto.Ptr(\"luisappid2\")},\n\t// \t\t\t\t\tMsaAppID: to.Ptr(\"msaappid\"),\n\t// \t\t\t\t\tMsaAppMSIResourceID: to.Ptr(\"/subscriptions/foo/resourcegroups/bar/providers/microsoft.managedidentity/userassignedidentities/sampleId\"),\n\t// \t\t\t\t\tMsaAppTenantID: to.Ptr(\"msaapptenantid\"),\n\t// \t\t\t\t\tMsaAppType: to.Ptr(armbotservice.MsaAppTypeUserAssignedMSI),\n\t// \t\t\t\t\tPublicNetworkAccess: to.Ptr(armbotservice.PublicNetworkAccessEnabled),\n\t// \t\t\t\t\tSchemaTransformationVersion: to.Ptr(\"1.0\"),\n\t// \t\t\t\t},\n\t// \t\t\t}\n}", "func (m *Manager) Delete(ctx context.Context, name string) error {\n\tquery := \"select delete_chart_repository($1::uuid, $2::text)\"\n\tuserID := ctx.Value(hub.UserIDKey).(string)\n\t_, err := m.db.Exec(ctx, query, userID, name)\n\treturn err\n}", "func (tm *TagMemo) Delete(ctx context.Context) *spanner.Mutation {\n\tvalues, _ := tm.columnsToValues(TagMemoPrimaryKeys())\n\treturn spanner.Delete(\"TagMemo\", spanner.Key(values))\n}", "func (q oauthClientQuery) DeleteAll(exec boil.Executor) (int64, error) {\n\tif q.Query == nil {\n\t\treturn 0, errors.New(\"models: no oauthClientQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\tresult, err := q.Query.Exec(exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to delete all from oauth_clients\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by deleteall for oauth_clients\")\n\t}\n\n\treturn rowsAff, nil\n}", "func (q stockCvtermQuery) DeleteAll() error {\n\tif q.Query == nil {\n\t\treturn errors.New(\"chado: no stockCvtermQuery provided for delete all\")\n\t}\n\n\tqueries.SetDelete(q.Query)\n\n\t_, err := q.Query.Exec()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from stock_cvterm\")\n\t}\n\n\treturn nil\n}", "func (w *Webhook) Delete() error {\n\treturn w.DeleteContext(context.TODO())\n}", "func (o CvtermsynonymSlice) DeleteAll(exec boil.Executor) error {\n\tif o == nil {\n\t\treturn errors.New(\"chado: no Cvtermsynonym slice provided for delete all\")\n\t}\n\n\tif len(o) == 0 {\n\t\treturn nil\n\t}\n\n\tif len(cvtermsynonymBeforeDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doBeforeDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvar args []interface{}\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), cvtermsynonymPrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\n\t\t\"DELETE FROM \\\"cvtermsynonym\\\" WHERE (%s) IN (%s)\",\n\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, cvtermsynonymPrimaryKeyColumns), \",\"),\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, len(o)*len(cvtermsynonymPrimaryKeyColumns), 1, len(cvtermsynonymPrimaryKeyColumns)),\n\t)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, args)\n\t}\n\n\t_, err := exec.Exec(sql, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"chado: unable to delete all from cvtermsynonym slice\")\n\t}\n\n\tif len(cvtermsynonymAfterDeleteHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterDeleteHooks(exec); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (s *DeleteIntentInput) SetBotVersion(v string) *DeleteIntentInput {\n\ts.BotVersion = &v\n\treturn s\n}", "func (_BaseAccessWallet *BaseAccessWalletTransactor) DeleteVersion(opts *bind.TransactOpts, _versionHash string) (*types.Transaction, error) {\n\treturn _BaseAccessWallet.contract.Transact(opts, \"deleteVersion\", _versionHash)\n}", "func (vao *VAO) Delete() {\n\t// delete buffers\n\tif vao.vertexBuffers != nil {\n\t\tfor _, vertBuf := range vao.vertexBuffers {\n\t\t\tvertBuf.Delete()\n\t\t}\n\t}\n\tvao.indexBuffer.Delete()\n\n\t// delete vertex array\n\tgl.DeleteVertexArrays(1, &vao.handle)\n}", "func (c *ConversationsRepo) Delete(conversation *models.Conversation) error {\n _, err := c.DB.Model(conversation).Where(\"id = ?\", conversation.ID).Delete()\n return err\n}", "func (e *ApiClientService) Delete(name string) (err error) {\n\terr = e.client.magicRequestDecoder(\"DELETE\", \"clients/\"+name, nil, nil)\n\treturn\n}" ]
[ "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.459303", "0.45890468", "0.45832822", "0.45823863", "0.45756292", "0.45669994", "0.4563815", "0.4557794", "0.45535803", "0.45493418", "0.45218608", "0.45075315", "0.44915146", "0.44874942", "0.44740427", "0.44669858", "0.44368327", "0.4428805", "0.4427882", "0.44249472", "0.44232172", "0.4416739", "0.44049022", "0.43990585", "0.43980563", "0.43932354", "0.43921527", "0.43917385", "0.43886954", "0.43865874", "0.43854004", "0.4384236", "0.43837476", "0.43812284", "0.4375231", "0.4374743", "0.43746585", "0.4372466", "0.43710527", "0.43707585", "0.43581858", "0.4356369", "0.43559733", "0.4355252", "0.4352667", "0.43524185", "0.43481994", "0.43477923", "0.43455753", "0.43411872", "0.43365243", "0.43345743", "0.4332981", "0.43301627", "0.4326739", "0.4325403", "0.4317901", "0.43168795", "0.43122664", "0.4311829", "0.43083042", "0.43072358", "0.42945036", "0.42909652", "0.42874753", "0.42863965", "0.42861488", "0.42851353", "0.42817187", "0.4277311", "0.42755514", "0.42744085", "0.42690402", "0.42679194", "0.42677924", "0.42646933", "0.4263389", "0.4262029", "0.42620054", "0.4261734" ]
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}", "func (r *K3sControlPlaneTemplate) ValidateUpdate(oldRaw runtime.Object) error {\n\tvar allErrs field.ErrorList\n\told, ok := oldRaw.(*K3sControlPlaneTemplate)\n\tif !ok {\n\t\treturn apierrors.NewBadRequest(fmt.Sprintf(\"expected a K3sControlPlaneTemplate but got a %T\", oldRaw))\n\t}\n\n\tif !reflect.DeepEqual(r.Spec.Template.Spec, old.Spec.Template.Spec) {\n\t\tallErrs = append(allErrs,\n\t\t\tfield.Invalid(field.NewPath(\"spec\", \"template\", \"spec\"), r, k3sControlPlaneTemplateImmutableMsg),\n\t\t)\n\t}\n\n\tif len(allErrs) == 0 {\n\t\treturn nil\n\t}\n\treturn apierrors.NewInvalid(GroupVersion.WithKind(\"K3sControlPlaneTemplate\").GroupKind(), r.Name, allErrs)\n}", "func (h *Handler) ValidateUpdate(ctx context.Context, _, newObj runtime.Object) error {\n\treturn h.handle(ctx, newObj)\n}", "func (r *AWSMachineTemplateWebhook) ValidateUpdate(ctx context.Context, oldRaw runtime.Object, newRaw runtime.Object) error {\n\tnewAWSMachineTemplate, ok := newRaw.(*AWSMachineTemplate)\n\tif !ok {\n\t\treturn apierrors.NewBadRequest(fmt.Sprintf(\"expected a AWSMachineTemplate but got a %T\", newRaw))\n\t}\n\toldAWSMachineTemplate, ok := oldRaw.(*AWSMachineTemplate)\n\tif !ok {\n\t\treturn apierrors.NewBadRequest(fmt.Sprintf(\"expected a AWSMachineTemplate but got a %T\", oldRaw))\n\t}\n\n\treq, err := admission.RequestFromContext(ctx)\n\tif err != nil {\n\t\treturn apierrors.NewBadRequest(fmt.Sprintf(\"expected a admission.Request inside context: %v\", err))\n\t}\n\n\tvar allErrs field.ErrorList\n\n\tif !topology.ShouldSkipImmutabilityChecks(req, newAWSMachineTemplate) && !cmp.Equal(newAWSMachineTemplate.Spec, oldAWSMachineTemplate.Spec) {\n\t\tif oldAWSMachineTemplate.Spec.Template.Spec.InstanceMetadataOptions == nil {\n\t\t\toldAWSMachineTemplate.Spec.Template.Spec.InstanceMetadataOptions = newAWSMachineTemplate.Spec.Template.Spec.InstanceMetadataOptions\n\t\t}\n\n\t\tif !cmp.Equal(newAWSMachineTemplate.Spec.Template.Spec, oldAWSMachineTemplate.Spec.Template.Spec) {\n\t\t\tallErrs = append(allErrs,\n\t\t\t\tfield.Invalid(field.NewPath(\"spec\", \"template\", \"spec\"), newAWSMachineTemplate, \"AWSMachineTemplate.Spec is immutable\"),\n\t\t\t)\n\t\t}\n\t}\n\n\treturn aggregateObjErrors(newAWSMachineTemplate.GroupVersionKind().GroupKind(), newAWSMachineTemplate.Name, allErrs)\n}", "func (r *GCPMachineTemplate) ValidateUpdate(old runtime.Object) error {\n\toldGCPMachineTemplate := old.(*GCPMachineTemplate)\n\tif !reflect.DeepEqual(r.Spec, oldGCPMachineTemplate.Spec) {\n\t\treturn errors.New(\"gcpMachineTemplateSpec is immutable\")\n\t}\n\n\treturn nil\n}", "func (t *TeamResource) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (o *ContainerUpdateBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// validation for a type composition with models.Resources\n\tif err := o.Resources.Validate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateRestartPolicy(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}", "func (m *IoArgoprojWorkflowV1alpha1WorkflowTemplateUpdateRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateTemplate(ctx, 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}", "func (p *PostTag) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (t *Task) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (o *PostTemplateTemplateIDCopyBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (r *KeystoneAPI) ValidateUpdate(old runtime.Object) error {\n\tkeystoneapilog.Info(\"validate update\", \"name\", r.Name)\n\n\t// TODO(user): fill in your validation logic upon object update.\n\treturn nil\n}", "func (m *ResourceControlUpdateRequest) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (r *Water) ValidateUpdate(old runtime.Object) error {\n\t//waterlog.Info(\"validate update\", \"name\", r.Name)\n\n\t// TODO(user): fill in your validation logic upon object update.\n\treturn nil\n}", "func (o *PostTemplateTemplateIDCopyOKBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (t *Term) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (t *Tax) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (d *UpdateDTO) Validate() error {\n\treturn v.ValidateStruct(d, v.Field(&d.IsForeman, v.Skip.When(d.IsForeman == nil)))\n}", "func (p *Photo) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (r updateReq) Validate() error {\n\terr := r.addReq.Validate()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif r.ServiceAccountID != r.Body.ID {\n\t\treturn fmt.Errorf(\"service account ID mismatch, you requested to update ServiceAccount = %s but body contains ServiceAccount = %s\", r.ServiceAccountID, r.Body.ID)\n\t}\n\treturn nil\n}", "func (m *UpdateResponse) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\t// no validation rules for Id\n\n\t// no validation rules for Username\n\n\t// no validation rules for Email\n\n\t// no validation rules for Role\n\n\treturn nil\n}", "func (t *Thing) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (m *UpdateRequest) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\t// no validation rules for Id\n\n\t// no validation rules for Username\n\n\t// no validation rules for Password\n\n\t// no validation rules for Email\n\n\t// no validation rules for Role\n\n\treturn nil\n}", "func (w *Widget) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (uv ResourceValidator) ValidateForUpdate() error {\n\t// Name\n\tok0 := uv.ValidateRequiredName()\n\tok1 := uv.ValidateRequiredPath()\n\n\tif ok0 && ok1 {\n\t\treturn nil\n\t}\n\n\treturn errors.New(\"resource has errors\")\n}", "func (t *Target) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (r *Review) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (a *SkillUpdate) Validate() error {\n\tif a.Name == \"\" {\n\t\treturn server.BadRequestHTTPError\n\t}\n\n\treturn nil\n}", "func (u Update) Validate() error {\n\tif !bson.IsObjectIdHex(u.ReqPayload.ID.ID) {\n\t\treturn apperr.Validation{\n\t\t\tWhere: \"Product\",\n\t\t\tField: \"id\",\n\t\t\tCause: apperr.ValidationInvalid,\n\t\t}\n\t}\n\n\treturn nil\n}", "func (f *Featured) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (s *Single) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (z *Zamowienium) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (q *Quest) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (f *Form1299) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (f *Form1299) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (k *Kategorie) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (pu *PostUpdate) check() error {\n\tif v, ok := pu.mutation.UserID(); ok {\n\t\tif err := post.UserIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"user_id\", err: fmt.Errorf(`ent: validator failed for field \"Post.user_id\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := pu.mutation.Title(); ok {\n\t\tif err := post.TitleValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"title\", err: fmt.Errorf(`ent: validator failed for field \"Post.title\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := pu.mutation.Content(); ok {\n\t\tif err := post.ContentValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"content\", err: fmt.Errorf(`ent: validator failed for field \"Post.content\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := pu.mutation.Status(); ok {\n\t\tif err := post.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(`ent: validator failed for field \"Post.status\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := pu.mutation.ReplyNum(); ok {\n\t\tif err := post.ReplyNumValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"reply_num\", err: fmt.Errorf(`ent: validator failed for field \"Post.reply_num\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := pu.mutation.UpdateAt(); ok {\n\t\tif err := post.UpdateAtValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"update_at\", err: fmt.Errorf(`ent: validator failed for field \"Post.update_at\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := pu.mutation.Pin(); ok {\n\t\tif err := post.PinValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"pin\", err: fmt.Errorf(`ent: validator failed for field \"Post.pin\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "func (m *UpdateTenantV1Response) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\t// no validation rules for Updated\n\n\treturn nil\n}", "func (v UpdateTransactionalEndpointRequest) Validate() error {\n\treturn validation.Errors{\n\t\t\"ConfigID\": validation.Validate(v.ConfigID, validation.Required),\n\t\t\"Version\": validation.Validate(v.Version, validation.Required),\n\t\t\"SecurityPolicyID\": validation.Validate(v.SecurityPolicyID, validation.Required),\n\t\t\"OperationID\": validation.Validate(v.OperationID, validation.Required),\n\t\t\"JsonPayload\": validation.Validate(v.JsonPayload, validation.Required),\n\t}.Filter()\n}", "func (m *EnclosureUpdateBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func ValidateUpdateRequest(message *taskspb.UpdateRequest) (err error) {\n\tif message.Task == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"task\", \"message\"))\n\t}\n\tif message.Task != nil {\n\t\tif err2 := ValidateStoredTask(message.Task); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\treturn\n}", "func (t *Technology) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (c *KubeadmConfig) ValidateUpdate(_ runtime.Object) (admission.Warnings, error) {\n\treturn nil, c.Spec.validate(c.Name)\n}", "func (req *TPLUpdateRequest) Verify() error {\n\tif req.ID == 0 {\n\t\treturn errors.New(\"Miss param: tpl_id\")\n\t}\n\tif len(req.Content) == 0 {\n\t\treturn errors.New(\"Miss param: tpl_content\")\n\t}\n\treturn nil\n}", "func (m *UpdateRequest) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif m.GetWidget() == nil {\n\t\treturn UpdateRequestValidationError{\n\t\t\tfield: \"Widget\",\n\t\t\treason: \"value is required\",\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetWidget()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn UpdateRequestValidationError{\n\t\t\t\tfield: \"Widget\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\tif m.GetUpdateMask() == nil {\n\t\treturn UpdateRequestValidationError{\n\t\t\tfield: \"UpdateMask\",\n\t\t\treason: \"value is required\",\n\t\t}\n\t}\n\n\tif v, ok := interface{}(m.GetUpdateMask()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn UpdateRequestValidationError{\n\t\t\t\tfield: \"UpdateMask\",\n\t\t\t\treason: \"embedded message failed validation\",\n\t\t\t\tcause: err,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (t *Transaction) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (g *Group) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (setting *MongodbDatabaseCollectionThroughputSetting) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {\n\tvalidations := setting.updateValidations()\n\tvar temp any = setting\n\tif runtimeValidator, ok := temp.(genruntime.Validator); ok {\n\t\tvalidations = append(validations, runtimeValidator.UpdateValidations()...)\n\t}\n\treturn genruntime.ValidateUpdate(old, validations)\n}", "func (r *Storage) ValidateUpdate(_ runtime.Object) error {\n\tstoragelog.Info(\"validate update\", \"name\", r.Name)\n\treturn r.valid()\n}", "func (o *ContainerUpdateOKBody) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (ut *updateUserPayload) Validate() (err error) {\n\tif ut.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"name\"))\n\t}\n\tif ut.Email == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"email\"))\n\t}\n\tif ut.Bio == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"bio\"))\n\t}\n\tif ut.Email != nil {\n\t\tif err2 := goa.ValidateFormat(goa.FormatEmail, *ut.Email); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidFormatError(`request.email`, *ut.Email, goa.FormatEmail, err2))\n\t\t}\n\t}\n\tif ut.Name != nil {\n\t\tif ok := goa.ValidatePattern(`\\S`, *ut.Name); !ok {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidPatternError(`request.name`, *ut.Name, `\\S`))\n\t\t}\n\t}\n\tif ut.Name != nil {\n\t\tif utf8.RuneCountInString(*ut.Name) > 256 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`request.name`, *ut.Name, utf8.RuneCountInString(*ut.Name), 256, false))\n\t\t}\n\t}\n\treturn\n}", "func (t *Test1) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (o *RenderTemplate) Validate() error {\n\n\terrors := elemental.Errors{}\n\trequiredErrors := elemental.Errors{}\n\n\tif len(requiredErrors) > 0 {\n\t\treturn requiredErrors\n\t}\n\n\tif len(errors) > 0 {\n\t\treturn errors\n\t}\n\n\treturn nil\n}", "func (s *Student) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func ValidateUpdateForm(form *CreationForm, postCurrent Post) (string, error) {\n\tif form.Title == \"\" {\n\t\tform.Title = postCurrent.Title\n\t}\n\tif form.Content != \"\" {\n\t\tif !IsContentValid(form.Content) {\n\t\t\treturn \"content\", core.ErrValidation\n\t\t}\n\t} else {\n\t\tform.Content = postCurrent.Content\n\t}\n\tif form.Description != \"\" {\n\t\tif !IsContentValid(form.Description) {\n\t\t\treturn \"description\", core.ErrValidation\n\t\t}\n\t} else {\n\t\tform.Description = postCurrent.Description\n\t}\n\tif form.Cover != \"\" {\n\t\tif !core.IsURL(form.Cover) {\n\t\t\treturn \"cover\", core.ErrValidation\n\t\t}\n\t} else {\n\t\tform.Cover = postCurrent.Cover\n\t}\n\tif form.Token == \"\" {\n\t\treturn \"token\", core.ErrValidation\n\t}\n\treturn \"ok\", nil\n}", "func (r *ScalewayWebhook) ValidateUpdate(ctx context.Context, oldObj runtime.Object, obj runtime.Object) (field.ErrorList, error) {\n\treturn r.ScalewayManager.ValidateUpdate(ctx, oldObj, obj)\n}", "func (p *Provider) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (b BlueprintReference) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (p *PlayerShot) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (t *Thali) Validate(v ...interface{}) error {\n\n\tif len(v) == 0 { // CREATE\n\t\tname := t.Name\n\t\tif len(name) < 3 {\n\t\t\treturn DSErr{When: time.Now(), What: \"validate venue invalid name \"}\n\t\t}\n\t\tif t.VenueId == int64(0) || t.UserId == int64(0) {\n\t\t\treturn DSErr{When: time.Now(), What: \"validate thali missing venue id \"}\n\t\t}\n\t\treturn nil\n\t} else { // UPDATE\n\t\tv0 := v[0]\n\t\tif reflect.TypeOf(v0).Kind() != reflect.Ptr {\n\t\t\treturn DSErr{When: time.Now(), What: \"validate thali pointer reqd\"}\n\t\t}\n\t\ts := reflect.TypeOf(v0).Elem()\n\t\tif _, ok := entities[s.Name()]; !ok {\n\t\t\treturn DSErr{When: time.Now(), What: \"validate want thali got \" + s.Name()}\n\t\t}\n\t\tswitch s.Name() {\n\t\tcase \"Thali\":\n\t\t\tv0v := reflect.ValueOf(v0).Elem()\n\t\t\tif v0v.Kind() != reflect.Struct {\n\t\t\t\treturn DSErr{When: time.Now(), What: \"validate needs struct arg got \" + v0v.Kind().String()}\n\t\t\t}\n\t\t\tif t.Id == int64(-999) {\n\t\t\t\tif t.Name == v0v.FieldByName(\"Name\").String() {\n\t\t\t\t\treturn nil\n\t\t\t\t} else {\n\t\t\t\t\treturn DSErr{When: time.Now(), What: \"delete validate name \" + t.Name}\n\t\t\t\t}\n\t\t\t}\n\t\t\tset := 0\n\t\t\tfor i := 0; i < v0v.NumField(); i++ {\n\t\t\t\tuu := reflect.ValueOf(t).Elem()\n\t\t\t\tfi := uu.Field(i)\n\t\t\t\tvi := v0v.Field(i)\n\t\t\t\tif reflect.DeepEqual(fi.Interface(), reflect.Zero(fi.Type()).Interface()) {\n\t\t\t\t\tif vi.IsValid() {\n\t\t\t\t\t\tfi.Set(vi)\n\t\t\t\t\t\tset++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tname := t.Name\n\t\t\tif len(name) < 3 {\n\t\t\t\treturn DSErr{When: time.Now(), What: \"validate venue invalid name \"}\n\t\t\t}\n\t\t\tif t.VenueId == int64(0) || t.UserId == int64(0) {\n\t\t\t\treturn DSErr{When: time.Now(), What: \"validate thali missing venue id \"}\n\t\t\t}\n\t\t\treturn nil\n\t\tdefault:\n\t\t\treturn DSErr{When: time.Now(), What: \"validate want thali got : \" + s.Name()}\n\t\t}\n\t\treturn nil\n\t}\n\n}", "func (u *User) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (u *User) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (u *User) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (u *User) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (u *User) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (d *Datasource) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (r *Room) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (j *Job) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (r *Unit) ValidateUpdate(old runtime.Object) error {\n\tunitlog.Info(\"validate update\", \"name\", r.Name)\n\n\t// TODO(user): fill in your validation logic upon object update.\n\treturn nil\n}", "func (m *Map) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (o *OrganizerInvitation) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (r *ApplicationTemplateRequest) Update(ctx context.Context, reqObj *ApplicationTemplate) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (c *Contract) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (dto *UpdateTaskRequest) IsValid() *base.ErrorResponse {\n\terrorResp := base.NewErrorResponseUnknownPropertyValue()\n\tif dto.Percentage != nil && *dto.Percentage > 100 {\n\t\treturn errorResp\n\t}\n\tif dto.ExecutionState != nil && !model.IsValidExecutionState(*dto.ExecutionState) {\n\t\treturn errorResp\n\t}\n\tif dto.ExecutionResult != nil && dto.ExecutionResult.State != nil && !model.IsValidExecutionResultState(*dto.ExecutionResult.State) {\n\t\treturn errorResp\n\t}\n\treturn nil\n}", "func (a *Application) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (r *RoomOccupancy) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func ValidateUpdate(client client.Client, new *v1alpha1.RolloutPlan, prev *v1alpha1.RolloutPlan,\n\trootPath *field.Path) field.ErrorList {\n\t// TODO: Enforce that only a few fields can change after a rollout plan is set\n\tvar allErrs field.ErrorList\n\n\treturn allErrs\n}", "func (p *PullrequestAssignee) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (c *Chat) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (m *UpdateStateRequest) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\t// no validation rules for AccessToken\n\n\t// no validation rules for EntityId\n\n\treturn nil\n}", "func (r *Role) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func ValidateUpdateBadReqResponseBody(body *UpdateBadReqResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Message == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"message\", \"body\"))\n\t}\n\tif body.Temporary == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"temporary\", \"body\"))\n\t}\n\tif body.Timeout == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"timeout\", \"body\"))\n\t}\n\tif body.Fault == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"fault\", \"body\"))\n\t}\n\treturn\n}", "func ValidateUpdateBadReqResponseBody(body *UpdateBadReqResponseBody) (err error) {\n\tif body.Name == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"name\", \"body\"))\n\t}\n\tif body.ID == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"id\", \"body\"))\n\t}\n\tif body.Message == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"message\", \"body\"))\n\t}\n\tif body.Temporary == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"temporary\", \"body\"))\n\t}\n\tif body.Timeout == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"timeout\", \"body\"))\n\t}\n\tif body.Fault == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingFieldError(\"fault\", \"body\"))\n\t}\n\treturn\n}", "func (v UpdateReputationProfileActionRequest) Validate() error {\n\treturn validation.Errors{\n\t\t\"ConfigID\": validation.Validate(v.ConfigID, validation.Required),\n\t\t\"Version\": validation.Validate(v.Version, validation.Required),\n\t\t\"PolicyID\": validation.Validate(v.PolicyID, validation.Required),\n\t\t\"ReputationProfileID\": validation.Validate(v.ReputationProfileID, validation.Required),\n\t}.Filter()\n}", "func (machine *VirtualMachine) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {\n\tvalidations := machine.updateValidations()\n\tvar temp any = machine\n\tif runtimeValidator, ok := temp.(genruntime.Validator); ok {\n\t\tvalidations = append(validations, runtimeValidator.UpdateValidations()...)\n\t}\n\treturn genruntime.ValidateUpdate(old, validations)\n}", "func (e *ExternalCfp) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (record *PrivateDnsZonesSRVRecord) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {\n\tvalidations := record.updateValidations()\n\tvar temp any = record\n\tif runtimeValidator, ok := temp.(genruntime.Validator); ok {\n\t\tvalidations = append(validations, runtimeValidator.UpdateValidations()...)\n\t}\n\treturn genruntime.ValidateUpdate(old, validations)\n}", "func (m *TemplatedEmailSendRequest) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "func (r *updateRequest) Validate() *validation.Output {\n\to := &validation.Output{Valid: true}\n\tvar err error\n\t// cek document status so\n\tif r.SalesOrder.DocumentStatus != \"new\" {\n\t\to.Failure(\"document_status\", \"document_status should be new\")\n\t}\n\n\tcheckDuplicate := make(map[string]bool)\n\tcheckVariant := make(map[int64]*model.ItemVariant)\n\n\ttz := time.Time{}\n\tif r.EtaDate == tz {\n\t\to.Failure(\"eta_date\", \"Field is required.\")\n\t}\n\n\tfor _, row := range r.SalesOrderItem {\n\t\tIVariantID, _ := common.Decrypt(row.ItemVariantID)\n\t\tivar := &model.ItemVariant{ID: IVariantID}\n\t\tivar.Read(\"ID\")\n\t\t////////////////////////////////\n\t\tif checkVariant[ivar.ID] == nil {\n\t\t\tivar.CommitedStock -= row.Quantity\n\t\t\tcheckVariant[ivar.ID] = ivar\n\t\t} else {\n\t\t\tvariant := checkVariant[ivar.ID]\n\t\t\tvariant.CommitedStock -= row.Quantity\n\t\t\tcheckVariant[ivar.ID] = variant\n\t\t}\n\t\t////////////////////////////////\n\t}\n\n\t// cek setiap sales order item\n\tfor i, row := range r.SalesOrderItem {\n\t\t// validasi id\n\t\tif row.ID != \"\" {\n\t\t\tif ID, err := common.Decrypt(row.ID); err != nil {\n\t\t\t\to.Failure(fmt.Sprintf(\"sales_order_item.%d.id.invalid\", i), \"id is not valid\")\n\t\t\t} else {\n\t\t\t\tsoItem := &model.SalesOrderItem{ID: ID}\n\t\t\t\tif err := soItem.Read(); err != nil {\n\t\t\t\t\to.Failure(fmt.Sprintf(\"sales_order_item.%d.id.invalid\", i), \"id is not found\")\n\t\t\t\t}\n\n\t\t\t\t//check duplicate sales order item id\n\t\t\t\tif checkDuplicate[row.ID] == true {\n\t\t\t\t\to.Failure(fmt.Sprintf(\"sales_order_item.%d.id.invalid\", i), \"id duplicate\")\n\t\t\t\t} else {\n\t\t\t\t\tcheckDuplicate[row.ID] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar UnitA float64\n\t\tvar PricingID, IVariantID int64\n\t\tvar ItemVariant *model.ItemVariant\n\t\tvar IVPrice *model.ItemVariantPrice\n\t\t// cek pricing type\n\t\tPricingID, err = common.Decrypt(row.PricingType)\n\t\tif err != nil {\n\t\t\to.Failure(fmt.Sprintf(\"sales_order_item.%d.pricing_type.invalid\", i), \"Pricing type id is invalid\")\n\t\t} else {\n\t\t\tif _, err = pricingType.GetPricingTypeByID(PricingID); err != nil {\n\t\t\t\to.Failure(fmt.Sprintf(\"sales_order_item.%d.pricing_type.invalid\", i), \"Pricing type id is not found\")\n\t\t\t}\n\t\t}\n\n\t\tIVariantID, err = common.Decrypt(row.ItemVariantID)\n\t\tif err != nil {\n\t\t\to.Failure(fmt.Sprintf(\"sales_order_item.%d.item_variant.invalid\", i), \"Item Variant id is invalid\")\n\t\t}\n\n\t\tvar pt = &model.PricingType{ID: PricingID}\n\t\tpt.Read(\"ID\")\n\t\tvar iv = &model.ItemVariant{ID: IVariantID}\n\t\tiv.Read(\"ID\")\n\n\t\tIVPrice, err = getItemVariantPricing(pt, iv)\n\t\tif err == nil {\n\t\t\tif pt.ParentType != nil {\n\t\t\t\tif pt.RuleType == \"increment\" {\n\t\t\t\t\tif pt.IsPercentage == int8(1) {\n\t\t\t\t\t\ttemp := (pt.Nominal * IVPrice.UnitPrice) / float64(100)\n\t\t\t\t\t\tUnitA = IVPrice.UnitPrice + temp\n\t\t\t\t\t} else {\n\t\t\t\t\t\tUnitA = IVPrice.UnitPrice + pt.Nominal\n\t\t\t\t\t}\n\n\t\t\t\t\tif row.UnitPrice < UnitA {\n\t\t\t\t\t\to.Failure(fmt.Sprintf(\"sales_order_item.%d.unit_price.invalid\", i), \"Unit price is too small\")\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif pt.IsPercentage == int8(1) {\n\t\t\t\t\t\ttemp := (pt.Nominal * IVPrice.UnitPrice) / float64(100)\n\t\t\t\t\t\tUnitA = IVPrice.UnitPrice - temp\n\t\t\t\t\t} else {\n\t\t\t\t\t\tUnitA = IVPrice.UnitPrice - pt.Nominal\n\t\t\t\t\t}\n\n\t\t\t\t\tif UnitA < 0 {\n\t\t\t\t\t\to.Failure(fmt.Sprintf(\"sales_order_item.%d.pricing_type.invalid\", i), \"Pricing type can make price become zero\")\n\t\t\t\t\t}\n\n\t\t\t\t\tif row.UnitPrice < UnitA {\n\t\t\t\t\t\to.Failure(fmt.Sprintf(\"sales_order_item.%d.unit_price.invalid\", i), \"Unit price is too small\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif row.UnitPrice < IVPrice.UnitPrice {\n\t\t\t\t\to.Failure(fmt.Sprintf(\"sales_order_item.%d.unit_price.invalid\", i), \"Unit price is too small\")\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\to.Failure(fmt.Sprintf(\"sales_order_item.%d.unit_price.invalid\", i), \"item variant price doesn't exist\")\n\t\t}\n\n\t\tItemVariant, err = inventory.GetDetailItemVariant(\"id\", IVariantID)\n\t\tif err != nil || ItemVariant == nil || ItemVariant.IsDeleted == int8(1) || ItemVariant.IsArchived == int8(1) {\n\t\t\to.Failure(fmt.Sprintf(\"sales_order_item.%d.item_variant_id.invalid\", i), \"Item variant id not found\")\n\t\t} else {\n\n\t\t\tSoItemID, _ := common.Decrypt(row.ID)\n\t\t\tSoItem := &model.SalesOrderItem{ID: SoItemID}\n\t\t\tif e := SoItem.Read(\"ID\"); e != nil {\n\t\t\t\tSoItem.Quantity = 0\n\t\t\t}\n\n\t\t\t// cek stock item variant\n\t\t\tif ((checkVariant[ItemVariant.ID].AvailableStock - checkVariant[ItemVariant.ID].CommitedStock) + SoItem.Quantity) < row.Quantity {\n\t\t\t\to.Failure(fmt.Sprintf(\"sales_order_item.%d.quantity.invalid\", i), \"Stock item is not enough to be sold\")\n\t\t\t}\n\n\t\t\tcheckVariant[ItemVariant.ID].CommitedStock += row.Quantity\n\n\t\t\t//check duplicate item variant id\n\t\t\tif checkDuplicate[row.ItemVariantID] == true {\n\t\t\t\to.Failure(fmt.Sprintf(\"sales_order_item.%d.item_variant_id.invalid\", i), \" item variant id duplicate\")\n\t\t\t} else {\n\t\t\t\tcheckDuplicate[row.ItemVariantID] = true\n\t\t\t}\n\n\t\t}\n\n\t\t// Calculate total price\n\t\tdiscamount := (row.UnitPrice * float64(row.Discount)) / float64(100)\n\t\tcuramount := row.UnitPrice * float64(row.Quantity)\n\t\tsubtotal := common.FloatPrecision(curamount-discamount, 0)\n\n\t\tr.TotalPrice += subtotal\n\t}\n\n\tif r.IsPercentageDiscount == int8(1) {\n\t\tif r.Discount < 0 || r.Discount > float32(100) {\n\t\t\to.Failure(\"discount\", \"discount is less than and equal 0 or greater than 100\")\n\t\t}\n\t}\n\n\treturn o\n}", "func (o *OrderItem) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func TaskUpdateValidation(title string, description string) (bool, error) {\n\tform := &taskUpdate{\n\t\tTitle: title,\n\t\tDescription: description,\n\t}\n\treturn govalidator.ValidateStruct(form)\n}", "func (podPresetStrategy) ValidateUpdate(ctx genericapirequest.Context, obj, old runtime.Object) field.ErrorList {\n\tvalidationErrorList := validation.ValidatePodPreset(obj.(*settings.PodPreset))\n\tupdateErrorList := validation.ValidatePodPresetUpdate(obj.(*settings.PodPreset), old.(*settings.PodPreset))\n\treturn append(validationErrorList, updateErrorList...)\n}", "func (i *Import) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (c *CourseCode) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "func (m *UpdateMessageResponse) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\t// no validation rules for Updated\n\n\treturn nil\n}", "func (m *SecurityPolicyUpdateParams) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateApplyTo(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateEgress(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateIngress(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePolicyMode(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}", "func (r *Policy) ValidateUpdate(old runtime.Object) error {\n\tLog.Info(\"validate update\", \"name\", r.Name)\n\n\tcollectedErrors := new(customErrors.ErrorCollector)\n\n\terr := r.CheckForAPIKeyOrSecret()\n\tif err != nil {\n\t\tcollectedErrors.Collect(err)\n\t}\n\n\terr = r.CheckForDuplicateConditions()\n\tif err != nil {\n\t\tcollectedErrors.Collect(err)\n\t}\n\n\terr = r.ValidateIncidentPreference()\n\tif err != nil {\n\t\tcollectedErrors.Collect(err)\n\t}\n\n\tif len(*collectedErrors) > 0 {\n\t\tLog.Info(\"Errors encountered validating policy\", \"collectedErrors\", collectedErrors)\n\t\treturn collectedErrors\n\t}\n\n\treturn nil\n}", "func (obj *RabbitQueue) ValidateUpdate(old runtime.Object) error {\n\trabbitQueueLog.Info(\"validate update\", \"name\", obj.Name, \"namespace\", obj.Namespace)\n\treturn obj.validate()\n}", "func (puo *PostUpdateOne) check() error {\n\tif v, ok := puo.mutation.UserID(); ok {\n\t\tif err := post.UserIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"user_id\", err: fmt.Errorf(`ent: validator failed for field \"Post.user_id\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := puo.mutation.Title(); ok {\n\t\tif err := post.TitleValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"title\", err: fmt.Errorf(`ent: validator failed for field \"Post.title\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := puo.mutation.Content(); ok {\n\t\tif err := post.ContentValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"content\", err: fmt.Errorf(`ent: validator failed for field \"Post.content\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := puo.mutation.Status(); ok {\n\t\tif err := post.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(`ent: validator failed for field \"Post.status\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := puo.mutation.ReplyNum(); ok {\n\t\tif err := post.ReplyNumValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"reply_num\", err: fmt.Errorf(`ent: validator failed for field \"Post.reply_num\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := puo.mutation.UpdateAt(); ok {\n\t\tif err := post.UpdateAtValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"update_at\", err: fmt.Errorf(`ent: validator failed for field \"Post.update_at\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := puo.mutation.Pin(); ok {\n\t\tif err := post.PinValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"pin\", err: fmt.Errorf(`ent: validator failed for field \"Post.pin\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "func (a *PasswordUpdateParams) Validate() *render.ValidationError {\n\ta.New = strings.TrimSpace(a.New)\n\ta.Old = strings.TrimSpace(a.Old)\n\n\tve := validator.EnsurePassword(a.New)\n\tif ve != nil {\n\t\treturn ve\n\t}\n\n\treturn validator.\n\t\tNew(\"oldPassword\").\n\t\tRequired().\n\t\tValidate(a.Old)\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.58531135", "0.5844546", "0.583457", "0.5818002", "0.5808413", "0.5805003", "0.5802962", "0.57860386", "0.57798696", "0.57552016", "0.574905", "0.574826", "0.57267046", "0.57267046", "0.57266057", "0.57265", "0.57154024", "0.5698505", "0.56928587", "0.5692169", "0.56822366", "0.56768197", "0.5629216", "0.56287396", "0.5621636", "0.5621562", "0.56191", "0.56174266", "0.56085956", "0.5594763", "0.55947095", "0.5594598", "0.5587356", "0.55760086", "0.5575037", "0.5570827", "0.55695486", "0.55658835", "0.55654025", "0.555729", "0.555729", "0.555729", "0.555729", "0.555729", "0.5552008", "0.5549673", "0.553986", "0.55396754", "0.5531641", "0.5523915", "0.5514054", "0.5502954", "0.5502319", "0.5500965", "0.5495526", "0.5492585", "0.5490611", "0.5476229", "0.54737467", "0.54725325", "0.546953", "0.546953", "0.54601234", "0.5456316", "0.5455115", "0.5455101", "0.5453409", "0.54476", "0.54441595", "0.5438906", "0.5438361", "0.54262793", "0.54175436", "0.5401119", "0.5397524", "0.539217", "0.53918844", "0.5383561", "0.5374294" ]
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(\"name\", name)\n\tfor _, depend := range depends {\n\t\tdependSvc, exists := c.Processes[depend]\n\t\tif !exists {\n\t\t\tlog.WithField(\"depend\", depend).Fatal(\"Dependent service do not exists.\")\n\t\t}\n\t\tfor !dependSvc.Ready() {\n\t\t\tlog.WithField(\"depend\", depend).Info(\"Waiting dependencies\")\n\t\t\tif dependSvc.Terminated() {\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t}\n\t}\n\tgo c.Processes[name].Start(ctx, cancel)\n}", "func waitManagerDeploymentsReady(ctx context.Context, opts InstallOptions, installQueue []repository.Components, proxy Proxy) error {\n\tfor _, components := range installQueue {\n\t\tfor _, obj := range components.Objs() {\n\t\t\tif util.IsDeploymentWithManager(obj) {\n\t\t\t\tif err := waitDeploymentReady(ctx, obj, opts.WaitProviderTimeout, proxy); err != nil {\n\t\t\t\t\treturn errors.Wrapf(err, \"deployment %q is not ready after %s\", obj.GetName(), opts.WaitProviderTimeout)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (store *Engine) Workflows(offset, limit string) ([]Workflow, error) {\n\tresult := workflowsResult{}\n\tfilters := Params{\n\t\tOffset: offset,\n\t\tLimit: limit,\n\t}\n\n\t_, err := store.api.\n\t\tURL(\"/workflow-engine/api/v1/workflows\").\n\t\tQuery(&filters).\n\t\tGet(&result)\n\n\treturn result.Items, err\n}", "func (m *Manager) Wait(ctx context.Context, uuid string) error {\n\t// Find the workflow.\n\trw, err := m.runningWorkflow(uuid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Just wait for it.\n\tselect {\n\tcase <-rw.done:\n\t\tbreak\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\t}\n\treturn nil\n}", "func (m *MockDdbClient) ListWorkflows(ctx context.Context, project, user string) ([]ddb.WorkflowSummary, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListWorkflows\", ctx, project, user)\n\tret0, _ := ret[0].([]ddb.WorkflowSummary)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (ws *WorkflowStore) GetWorkflows(ctx context.Context, name *string) (result []*domain.Workflow) {\n\tresult = []*domain.Workflow{}\n\tif name != nil {\n\t\tif wf, ok := ws.items[*name]; ok {\n\t\t\tresult = append(result, wf)\n\t\t}\n\t\treturn\n\t}\n\tfor _, wf := range ws.items {\n\t\tresult = append(result, wf)\n\t}\n\treturn\n}", "func (h *KubernetesHelper) WaitUntilDeployReady(deploys map[string]DeploySpec) {\n\tctx := context.Background()\n\tfor deploy, spec := range deploys {\n\t\tif err := h.CheckPods(ctx, spec.Namespace, deploy, 1); err != nil {\n\t\t\tvar out string\n\t\t\t//nolint:errorlint\n\t\t\tif rce, ok := err.(*RestartCountError); ok {\n\t\t\t\tout = fmt.Sprintf(\"Error running test: failed to wait for deploy/%s to become 'ready', too many restarts (%v)\\n\", deploy, rce)\n\t\t\t} else {\n\t\t\t\tout = fmt.Sprintf(\"Error running test: failed to wait for deploy/%s to become 'ready', timed out waiting for condition\\n\", deploy)\n\t\t\t}\n\t\t\tos.Stderr.Write([]byte(out))\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n}", "func (c *ThirdPartyClient) Workflows(namespace string) WorkflowInterface {\n\treturn newWorkflows(c, namespace)\n}", "func (m *MockDdbClient) ListWorkflowInstancesByName(ctx context.Context, project, user, workflowName string, limit int) ([]ddb.WorkflowInstance, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListWorkflowInstancesByName\", ctx, project, user, workflowName, limit)\n\tret0, _ := ret[0].([]ddb.WorkflowInstance)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (c *TkgClient) WaitForAddonsDeployments(clusterClient clusterclient.Client) error {\n\tgroup, _ := errgroup.WithContext(context.Background())\n\n\tgroup.Go(\n\t\tfunc() error {\n\t\t\terr := clusterClient.WaitForDeployment(constants.TkrControllerDeploymentName, constants.TkrNamespace)\n\t\t\tif err != nil {\n\t\t\t\tlog.V(3).Warningf(\"Failed waiting for deployment %s\", constants.TkrControllerDeploymentName)\n\t\t\t}\n\t\t\treturn err\n\t\t})\n\n\tgroup.Go(\n\t\tfunc() error {\n\t\t\terr := clusterClient.WaitForDeployment(constants.KappControllerDeploymentName, constants.KappControllerNamespace)\n\t\t\tif err != nil {\n\t\t\t\tlog.V(3).Warningf(\"Failed waiting for deployment %s\", constants.KappControllerDeploymentName)\n\t\t\t}\n\t\t\treturn err\n\t\t})\n\n\tgroup.Go(\n\t\tfunc() error {\n\t\t\terr := clusterClient.WaitForDeployment(constants.AddonsManagerDeploymentName, constants.KappControllerNamespace)\n\t\t\tif err != nil {\n\t\t\t\tlog.V(3).Warningf(\"Failed waiting for deployment %s\", constants.AddonsManagerDeploymentName)\n\t\t\t}\n\t\t\treturn err\n\t\t})\n\n\terr := group.Wait()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Failed waiting for at least one CRS deployment, check logs for more detail.\")\n\t}\n\treturn nil\n}", "func (c *TkgClient) WaitForAddonsDeployments(clusterClient clusterclient.Client) error {\n\tgroup, _ := errgroup.WithContext(context.Background())\n\n\tgroup.Go(\n\t\tfunc() error {\n\t\t\terr := clusterClient.WaitForDeployment(constants.TkrControllerDeploymentName, constants.TkrNamespace)\n\t\t\tif err != nil {\n\t\t\t\tlog.V(3).Warningf(\"Failed waiting for deployment %s\", constants.TkrControllerDeploymentName)\n\t\t\t}\n\t\t\treturn err\n\t\t})\n\n\tgroup.Go(\n\t\tfunc() error {\n\t\t\terr := clusterClient.WaitForDeployment(constants.KappControllerDeploymentName, constants.KappControllerNamespace)\n\t\t\tif err != nil {\n\t\t\t\tlog.V(3).Warningf(\"Failed waiting for deployment %s\", constants.KappControllerDeploymentName)\n\t\t\t}\n\t\t\treturn err\n\t\t})\n\n\tgroup.Go(\n\t\tfunc() error {\n\t\t\terr := clusterClient.WaitForDeployment(constants.AddonsManagerDeploymentName, constants.KappControllerNamespace)\n\t\t\tif err != nil {\n\t\t\t\tlog.V(3).Warningf(\"Failed waiting for deployment %s\", constants.AddonsManagerDeploymentName)\n\t\t\t}\n\t\t\treturn err\n\t\t})\n\n\terr := group.Wait()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Failed waiting for at least one CRS deployment, check logs for more detail.\")\n\t}\n\treturn nil\n}", "func WaitForAllRoutines() {\n\turls := []string{\n\t\t\"https://www.google.com\",\n\t\t\"https://www.vg.no\",\n\t\t\"https://kode24.no\",\n\t}\n\n\tvar wg sync.WaitGroup\n\twg.Add(len(urls))\n\n\tfor _, val := range urls {\n\t\tgo getURL(val, &wg)\n\t}\n\twg.Wait()\n}", "func (s policyTestStep) waitChecks(t *testing.T, contextMap map[string]string) {\n\tif base.ShouldPolicyWaitOnGet() {\n\t\terr := waitAllGetChecks(s.getChecks, contextMap)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"GET check wait failed: %v\", err)\n\t\t}\n\t} else {\n\t\tif len(s.getChecks) > 0 {\n\t\t\tlog.Printf(\"Running single GET checks, as configured on the environment\")\n\t\t\tfor _, check := range s.getChecks {\n\t\t\t\tok, err := check.check(contextMap)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrMsg := fmt.Sprintf(\"GET check %v failed: %v\", check, err)\n\t\t\t\t\tlog.Print(errMsg)\n\t\t\t\t\tt.Errorf(errMsg)\n\t\t\t\t}\n\t\t\t\tif !ok {\n\t\t\t\t\terrMsg := fmt.Sprintf(\"GET check %v returned incorrect response\", check)\n\t\t\t\t\tlog.Print(errMsg)\n\t\t\t\t\tt.Errorf(errMsg)\n\t\t\t\t}\n\t\t\t}\n\t\t\tlog.Printf(\"All tests pass\")\n\t\t}\n\t}\n}", "func WaitAll(tasks ...Task) {\n\tt := WhenAll(tasks...)\n\tt.Wait()\n}", "func (d DB) ListWorkflows(fn func(wf db.Workflow) error) error {\n\treturn nil\n}", "func (i *Instance) Wait(max time.Duration) error {\n\ts3Client := s3.New(i.Config())\n\tstart := time.Now()\n\tinput := s3.ListBucketsInput{}\n\tfor {\n\t\tif _, err := s3Client.ListBucketsRequest(&input).Send(context.TODO()); err != nil {\n\t\t\tif time.Now().Add(-1 * max).After(start) {\n\t\t\t\treturn errors.New(\"localstack failed to respond in time\")\n\t\t\t}\n\n\t\t\ttime.Sleep(500 * time.Millisecond)\n\t\t\tcontinue\n\t\t}\n\n\t\treturn nil\n\t}\n}", "func (w *WaitGroup) Wait() {\n\tfor w.counter > 0 {\n\t\tw.waiters++\n\t\tw.wait.Wait()\n\t\tw.waiters--\n\t}\n}", "func waitForUnitStates(units []string, js job.JobState, maxAttempts int, out io.Writer) chan error {\n\terrchan := make(chan error)\n\tvar wg sync.WaitGroup\n\tfor _, name := range units {\n\t\twg.Add(1)\n\t\tgo checkUnitState(name, js, maxAttempts, out, &wg, errchan)\n\t}\n\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(errchan)\n\t}()\n\n\treturn errchan\n}", "func (a *Client) PostWorkflows(params *PostWorkflowsParams, authInfo runtime.ClientAuthInfoWriter) (*PostWorkflowsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostWorkflowsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostWorkflows\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/workflows\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/x-gzip\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &PostWorkflowsReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*PostWorkflowsOK), nil\n}", "func (mock *WorkflowHandlerMock) HandleWorkflowCalls() []struct {\n\tContextMoqParam context.Context\n\tWorkflowMoqParam workflow.Workflow\n\tRecorder event.Recorder\n} {\n\tvar calls []struct {\n\t\tContextMoqParam context.Context\n\t\tWorkflowMoqParam workflow.Workflow\n\t\tRecorder event.Recorder\n\t}\n\tmock.lockHandleWorkflow.RLock()\n\tcalls = mock.calls.HandleWorkflow\n\tmock.lockHandleWorkflow.RUnlock()\n\treturn calls\n}", "func (manager *Manager) Wait() {\n\tlogger.FromCtx(manager.ctx, logger.Flow).WithField(\"flow\", manager.Name).Info(\"Awaiting till all processes are completed\")\n\tmanager.wg.Wait()\n}", "func WaitTerminations(done chan bool) {\n\tremaining := SegmentListeners\n\tfor remaining > 0 {\n\t\tlog.Printf(\"WaitTerminations: waiting for %d listeners\\n\", remaining)\n\t\t_ = <-done\n\t\tremaining--\n\t}\n}", "func waitAllGetChecks(checks []policyGetCheck, contextMap map[string]string) error {\n\tif len(checks) == 0 {\n\t\t// nothing to check\n\t\treturn nil\n\t}\n\tvar attempts int\n\tctx, cancelFn := context.WithTimeout(context.Background(), time.Minute*2)\n\tdefer cancelFn()\n\terr := utils.RetryWithContext(ctx, time.Second, func() (bool, error) {\n\t\tattempts++\n\t\tlog.Printf(\"Running GET checks -- attempt %v\", attempts)\n\t\tif base.IsTestInterrupted() {\n\t\t\treturn false, fmt.Errorf(\"test interrupted by user\")\n\t\t}\n\t\tvar allGood = true\n\t\tfor _, check := range checks {\n\t\t\tok, err := check.check(contextMap)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Error on GET check: %v\", err)\n\t\t\t\tallGood = false\n\t\t\t}\n\t\t\tif !ok {\n\t\t\t\tlog.Printf(\"Check %+v failed validation\", check)\n\t\t\t\tallGood = false\n\t\t\t}\n\t\t}\n\t\tif allGood {\n\t\t\tlog.Printf(\"All checks pass\")\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, nil\n\t})\n\n\treturn err\n\n}", "func (o TriggerBuildStepOutput) WaitFors() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v TriggerBuildStep) []string { return v.WaitFors }).(pulumi.StringArrayOutput)\n}", "func Wait() {\n\tfor sched0.tasks.length() != 0 {\n\t\truntime.Gosched()\n\t}\n}", "func (c *Cluster) FindWorkflows(ctx context.Context, keyspaces []string, opts FindWorkflowsOptions) (*vtadminpb.ClusterWorkflows, error) {\n\tspan, ctx := trace.NewSpan(ctx, \"Cluster.FindWorkflows\")\n\tdefer span.Finish()\n\n\tAnnotateSpan(c, span)\n\tspan.Annotate(\"active_only\", opts.ActiveOnly)\n\n\tif err := c.Vtctld.Dial(ctx); err != nil {\n\t\treturn nil, fmt.Errorf(\"FindWorkflows(cluster = %v, keyspaces = %v, opts = %v) dial failed: %w\", c.ID, keyspaces, opts, err)\n\t}\n\n\treturn c.findWorkflows(ctx, keyspaces, opts)\n}", "func waitFor(fns ...func()) {\n\tvar wg sync.WaitGroup\n\n\tfor _, fn1 := range fns {\n\t\twg.Add(1)\n\t\tgo func(fn2 func()) {\n\t\t\tfn2()\n\t\t\twg.Done()\n\t\t}(fn1)\n\t}\n\n\twg.Wait()\n}", "func (m *Machine) WaitForExtendedStatefulSets(namespace string, labels string) error {\n\treturn wait.PollImmediate(m.PollInterval, m.PollTimeout, func() (bool, error) {\n\t\treturn m.ExtendedStatefulSetExists(namespace, labels)\n\t})\n}", "func workflows(db *gorp.DbMap, store cache.Store) error {\n\tquery := \"SELECT id, project_id FROM workflow WHERE to_delete = true ORDER BY id ASC\"\n\tres := []struct {\n\t\tID int64 `db:\"id\"`\n\t\tProjectID int64 `db:\"project_id\"`\n\t}{}\n\n\tif _, err := db.Select(&res, query); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn nil\n\t\t}\n\t\treturn sdk.WrapError(err, \"purge.Workflows> Unable to load workflows\")\n\t}\n\n\tvar wrkflws = make([]sdk.Workflow, len(res))\n\tvar projects = map[int64]sdk.Project{}\n\n\tfor i, r := range res {\n\t\tproj, has := projects[r.ProjectID]\n\t\tif !has {\n\t\t\tp, err := project.LoadByID(db, store, r.ProjectID, nil)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"purge.Workflows> unable to load project %d: %v\", r.ProjectID, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tprojects[r.ProjectID] = *p\n\t\t\tproj = *p\n\t\t}\n\n\t\tw, err := workflow.LoadByID(db, store, &proj, r.ID, nil, workflow.LoadOptions{})\n\t\tif err != nil {\n\t\t\treturn sdk.WrapError(err, \"purge.Workflows> unable to load workflow %d\", r.ID)\n\t\t}\n\t\twrkflws[i] = *w\n\t}\n\n\tfor _, w := range wrkflws {\n\t\tproj, has := projects[w.ProjectID]\n\t\tif !has {\n\t\t\tcontinue\n\t\t}\n\n\t\ttx, err := db.Begin()\n\t\tif err != nil {\n\t\t\treturn sdk.WrapError(err, \"purge.Workflows> unable to start tx\")\n\t\t}\n\n\t\tif err := workflow.Delete(tx, store, &proj, &w); err != nil {\n\t\t\tlog.Error(\"purge.Workflows> unable to delete workflow %d: %v\", w.ID, err)\n\t\t\t_ = tx.Rollback()\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := tx.Commit(); err != nil {\n\t\t\tlog.Error(\"purge.Workflows> unable to commit tx: %v\", err)\n\t\t\t_ = tx.Rollback()\n\t\t\tcontinue\n\t\t}\n\t}\n\n\treturn nil\n}", "func PollForPendingWorkflowsAndUpdateStore(ctx context.Context, wm WorkflowManager, thestore store.Store, sqsapi sqsiface.SQSAPI, sqsQueueURL string) {\n\tfor {\n\t\tif shouldBackoff {\n\t\t\tlog.WarnD(\"poll-for-pending-workflows-backoff\", logger.M{\"duration\": backoffDuration.String()})\n\t\t\ttime.Sleep(backoffDuration)\n\t\t}\n\t\tshouldBackoff = false\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tlog.Info(\"poll-for-pending-workflows-done\")\n\t\t\treturn\n\t\tdefault:\n\t\t\tout, err := sqsapi.ReceiveMessageWithContext(ctx, &sqs.ReceiveMessageInput{\n\t\t\t\tMaxNumberOfMessages: aws.Int64(10),\n\t\t\t\tQueueUrl: aws.String(sqsQueueURL),\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tlog.ErrorD(\"poll-for-pending-workflows\", logger.M{\"error\": err.Error()})\n\t\t\t}\n\n\t\t\tfor _, message := range out.Messages {\n\t\t\t\tif id, err := updatePendingWorkflow(ctx, message, wm, thestore, sqsapi, sqsQueueURL); err != nil {\n\t\t\t\t\tlog.ErrorD(\"update-pending-workflow\", logger.M{\"id\": id, \"error\": err.Error()})\n\n\t\t\t\t\t// If we're seeing DynamoDB throttling, let's wait before running our next poll loop\n\t\t\t\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\t\t\t\tswitch aerr.Code() {\n\t\t\t\t\t\tcase dynamodb.ErrCodeProvisionedThroughputExceededException:\n\t\t\t\t\t\t\tshouldBackoff = true\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tlog.InfoD(\"update-pending-workflow\", logger.M{\"id\": id})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func waitForTransactions(syncer *transactionSyncer) error {\n\treturn wait.PollImmediate(time.Microsecond, 5*time.Second, func() (bool, error) {\n\t\tif len(syncer.transactions.Keys()) == 0 {\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, nil\n\t})\n}", "func Wait() {\n\tclose(jobs)\n\tfor a := 1; a <= workers; a++ {\n\t\t<-finished\n\t}\n}", "func (c *Client) GetWorkflows() ([]*Workflow, error) {\n\tspath := \"/api/workflows\"\n\n\tvar ww *workflowsWrapper\n\tresp, err := c.NewRequest(http.MethodGet, spath, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := decodeBody(resp, &ww); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ww.Workflows, nil\n}", "func monitor(ctx context.Context, repoNames []string, uploads []uploadMeta) error {\n\tvar oldState map[string]repoState\n\twaitMessageDisplayed := make(map[string]struct{}, len(repoNames))\n\tfinishedMessageDisplayed := make(map[string]struct{}, len(repoNames))\n\n\tfmt.Printf(\"[%5s] %s Waiting for uploads to finish processing\\n\", internal.TimeSince(start), internal.EmojiLightbulb)\n\n\tfor {\n\t\tstate, err := queryRepoState(ctx, repoNames, uploads)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif verbose {\n\t\t\tparts := make([]string, 0, len(repoNames))\n\t\t\tfor _, repoName := range repoNames {\n\t\t\t\tstates := make([]string, 0, len(state[repoName].uploadStates))\n\t\t\t\tfor _, uploadState := range state[repoName].uploadStates {\n\t\t\t\t\tstates = append(states, fmt.Sprintf(\"%s=%-10s\", uploadState.upload.commit[:7], uploadState.state))\n\t\t\t\t}\n\t\t\t\tsort.Strings(states)\n\n\t\t\t\tparts = append(parts, fmt.Sprintf(\"%s\\tstale=%v\\t%s\", repoName, state[repoName].stale, strings.Join(states, \"\\t\")))\n\t\t\t}\n\n\t\t\tfmt.Printf(\"[%5s] %s\\n\", internal.TimeSince(start), strings.Join(parts, \"\\n\\t\"))\n\t\t}\n\n\t\tnumReposCompleted := 0\n\n\t\tfor repoName, data := range state {\n\t\t\toldData := oldState[repoName]\n\n\t\t\tnumUploadsCompleted := 0\n\t\t\tfor _, uploadState := range data.uploadStates {\n\t\t\t\tif uploadState.state == \"ERRORED\" {\n\t\t\t\t\treturn fmt.Errorf(\"failed to process (%s)\", uploadState.failure)\n\t\t\t\t}\n\n\t\t\t\tif uploadState.state == \"COMPLETED\" {\n\t\t\t\t\tnumUploadsCompleted++\n\n\t\t\t\t\tvar oldState string\n\t\t\t\t\tfor _, oldUploadState := range oldData.uploadStates {\n\t\t\t\t\t\tif oldUploadState.upload.id == uploadState.upload.id {\n\t\t\t\t\t\t\toldState = oldUploadState.state\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif oldState != \"COMPLETED\" {\n\t\t\t\t\t\tfmt.Printf(\"[%5s] %s Finished processing index for %s@%s\\n\", internal.TimeSince(start), internal.EmojiSuccess, repoName, uploadState.upload.commit[:7])\n\t\t\t\t\t}\n\t\t\t\t} else if uploadState.state != \"QUEUED\" && uploadState.state != \"PROCESSING\" {\n\t\t\t\t\treturn fmt.Errorf(\"unexpected state '%s'\", uploadState.state)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif numUploadsCompleted == len(data.uploadStates) {\n\t\t\t\tif !data.stale {\n\t\t\t\t\tnumReposCompleted++\n\n\t\t\t\t\tif _, ok := finishedMessageDisplayed[repoName]; !ok {\n\t\t\t\t\t\tfinishedMessageDisplayed[repoName] = struct{}{}\n\t\t\t\t\t\tfmt.Printf(\"[%5s] %s Commit graph refreshed for %s\\n\", internal.TimeSince(start), internal.EmojiSuccess, repoName)\n\t\t\t\t\t}\n\t\t\t\t} else if _, ok := waitMessageDisplayed[repoName]; !ok {\n\t\t\t\t\twaitMessageDisplayed[repoName] = struct{}{}\n\t\t\t\t\tfmt.Printf(\"[%5s] %s Waiting for commit graph to refresh for %s\\n\", internal.TimeSince(start), internal.EmojiLightbulb, repoName)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif numReposCompleted == len(repoNames) {\n\t\t\tbreak\n\t\t}\n\n\t\toldState = state\n\n\t\tselect {\n\t\tcase <-time.After(pollInterval):\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\t}\n\t}\n\n\tfmt.Printf(\"[%5s] %s All uploads processed\\n\", internal.TimeSince(start), internal.EmojiSuccess)\n\treturn nil\n}", "func GetWorkflows(kv *api.KV, deploymentID string) ([]string, error) {\n\tworkflowsPath := path.Join(consulutil.DeploymentKVPrefix, deploymentID, \"workflows\")\n\tkeys, _, err := kv.Keys(workflowsPath+\"/\", \"/\", nil)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, consulutil.ConsulGenericErrMsg)\n\t}\n\tresults := make([]string, len(keys))\n\tfor i := range keys {\n\t\tresults[i] = path.Base(keys[i])\n\t}\n\treturn results, nil\n}", "func (o *OutputManager) AwaitTransactionsConfirmation(txIDs []string, maxGoroutines int) {\n\twg := sync.WaitGroup{}\n\tsemaphore := make(chan bool, maxGoroutines)\n\n\tfor _, txID := range txIDs {\n\t\twg.Add(1)\n\t\tgo func(txID string) {\n\t\t\tdefer wg.Done()\n\t\t\tsemaphore <- true\n\t\t\tdefer func() {\n\t\t\t\t<-semaphore\n\t\t\t}()\n\t\t\terr := o.AwaitTransactionToBeAccepted(txID, waitForConfirmation)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}(txID)\n\t}\n\twg.Wait()\n}", "func (tm *Manager) WaitForPendingTasks() {\n\ttm.wg.Wait()\n}", "func (w Waiter) Wait() error {\n\tw.logger.Debug(waiterLogTag, \"Waiting for instance to reach running state\")\n\tw.logger.Debug(waiterLogTag, \"Using schedule %v\", w.watchSchedule)\n\n\tfor _, timeGap := range w.watchSchedule {\n\t\tw.logger.Debug(waiterLogTag, \"Sleeping for %v\", timeGap)\n\t\tw.sleepFunc(timeGap)\n\n\t\tstate, err := w.agentClient.GetState()\n\t\tif err != nil {\n\t\t\treturn bosherr.WrapError(err, \"Sending get_state\")\n\t\t}\n\n\t\t// todo stopped state\n\t\tif state.JobState == \"running\" {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn ErrNotRunning\n}", "func (wait *WaitCommand) runWait(args []string) error {\n\tctx := context.Background()\n\tapiClient := wait.cli.Client()\n\n\tvar errs []string\n\tfor _, name := range args {\n\t\tresponse, err := apiClient.ContainerWait(ctx, name)\n\t\tif err != nil {\n\t\t\terrs = append(errs, err.Error())\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Printf(\"%d\\n\", response.StatusCode)\n\t}\n\n\tif len(errs) > 0 {\n\t\treturn errors.New(strings.Join(errs, \"\\n\"))\n\t}\n\n\treturn nil\n}", "func wait_group() {\n\tno := 3\n\tvar wg sync.WaitGroup\n\tfor i := 0; i < no; i++ {\n\t\twg.Add(1)\n\t\tgo process_wg(i, &wg)\n\t}\n\twg.Wait()\n\tfmt.Println(\"All go routines finished executing\")\n}", "func (se *StateEngine) Wait() {\n\tse.mgrLock.Lock()\n\tdefer se.mgrLock.Unlock()\n\tif se.stopped {\n\t\treturn\n\t}\n\tfor _, m := range se.managers {\n\t\tif waiter, ok := m.(StateWaiter); ok {\n\t\t\twaiter.Wait()\n\t\t}\n\t}\n}", "func WaitForPodsWithSchedulingGates(c clientset.Interface, ns string, num int, timeout time.Duration, schedulingGates []v1.PodSchedulingGate) error {\n\tmatched := 0\n\terr := wait.PollImmediate(poll, timeout, func() (done bool, err error) {\n\t\tpods, err := c.CoreV1().Pods(ns).List(context.TODO(), metav1.ListOptions{})\n\t\tif err != nil {\n\t\t\treturn handleWaitingAPIError(err, true, \"listing pods\")\n\t\t}\n\t\tmatched = 0\n\t\tfor _, pod := range pods.Items {\n\t\t\tif reflect.DeepEqual(pod.Spec.SchedulingGates, schedulingGates) {\n\t\t\t\tmatched++\n\t\t\t}\n\t\t}\n\t\tif matched == num {\n\t\t\treturn true, nil\n\t\t}\n\t\tframework.Logf(\"expect %d pods carry the expected scheduling gates, but got %v\", num, matched)\n\t\treturn false, nil\n\t})\n\treturn maybeTimeoutError(err, \"waiting for pods to carry the expected scheduling gates (want %d, matched %d)\", num, matched)\n}", "func WaitTasks(taskBroker *schedule.TaskBroker, run *models.Run) error {\n\tlogrus.Info(\"Begin monitoring task execution ...\")\n\n\tch, err := taskBroker.GetChannel()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tjobName := run.Details[common.KeyJobName]\n\tpodListOpt := metav1.ListOptions{LabelSelector: fmt.Sprintf(\"job-name=%s\", jobName)}\n\tapi := clientset.CoreV1()\n\n\tfor {\n\t\ttime.Sleep(interval)\n\n\t\tqueue, err := ch.QueueInspect(jobName)\n\t\tif err != nil {\n\t\t\tlogrus.Info(\"The queue doesn't exist. All tasks have been executed.\")\n\t\t\tbreak\n\t\t}\n\t\tlogrus.Infof(\"Queue: messages %d.\", queue.Messages)\n\n\t\tif queue.Messages != 0 {\n\t\t\t// there are tasks to be run\n\t\t\tcontinue\n\t\t}\n\n\t\t// the number of the message in the queue is zero. make sure all the\n\t\t// pods in this job have finished\n\t\tpodList, err := api.Pods(namespace).List(podListOpt)\n\t\tif err != nil {\n\t\t\tlogrus.Warnf(\"Fail to list pod of %s: %s\", jobName, err)\n\t\t\tcontinue\n\t\t}\n\n\t\trunningPods := 0\n\t\tfor _, pod := range podList.Items {\n\t\t\tif pod.Status.Phase == corev1.PodRunning {\n\t\t\t\trunningPods++\n\t\t\t}\n\t\t}\n\n\t\tif runningPods != 0 {\n\t\t\tlogrus.Infof(\"%d pod are still running.\", runningPods)\n\t\t\tcontinue\n\t\t}\n\n\t\t// zero task in the queue and all pod stop.\n\t\tbreak\n\t}\n\n\treturn nil\n}", "func (c *Client) WaitForResources(timeout time.Duration, resources []*manifest.MappingResult) error {\n\treturn wait.Poll(5*time.Second, timeout, func() (bool, error) {\n\t\tstatefulSets := []appsv1.StatefulSet{}\n\t\tdeployments := []deployment{}\n\t\tfor _, r := range resources {\n\t\t\tswitch r.Metadata.Kind {\n\t\t\tcase \"ConfigMap\":\n\t\t\tcase \"Service\":\n\t\t\tcase \"ReplicationController\":\n\t\t\tcase \"Pod\":\n\t\t\tcase \"Deployment\":\n\t\t\t\tcurrentDeployment, err := c.clientset.AppsV1().Deployments(r.Metadata.ObjectMeta.Namespace).Get(context.TODO(), r.Metadata.ObjectMeta.Name, metav1.GetOptions{})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn false, err\n\t\t\t\t}\n\t\t\t\t// Find RS associated with deployment\n\t\t\t\tnewReplicaSet, err := c.getNewReplicaSet(currentDeployment)\n\t\t\t\tif err != nil || newReplicaSet == nil {\n\t\t\t\t\treturn false, err\n\t\t\t\t}\n\t\t\t\tnewDeployment := deployment{\n\t\t\t\t\tnewReplicaSet,\n\t\t\t\t\tcurrentDeployment,\n\t\t\t\t}\n\t\t\t\tdeployments = append(deployments, newDeployment)\n\t\t\tcase \"StatefulSet\":\n\t\t\t\tsf, err := c.clientset.AppsV1().StatefulSets(r.Metadata.ObjectMeta.Namespace).Get(context.TODO(), r.Metadata.ObjectMeta.Name, metav1.GetOptions{})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn false, err\n\t\t\t\t}\n\t\t\t\tstatefulSets = append(statefulSets, *sf)\n\t\t\t}\n\t\t}\n\t\tisReady := c.statefulSetsReady(statefulSets) && c.deploymentsReady(deployments)\n\t\treturn isReady, nil\n\t})\n}", "func (client *Client) WaitForBrokersReady() error {\n\tnamespace := client.Namespace\n\tbrokers, err := client.Eventing.EventingV1alpha1().Brokers(namespace).List(metav1.ListOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, broker := range brokers.Items {\n\t\tif err := client.WaitForBrokerReady(broker.Name); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (mock *WorkflowHandlerMock) CancelWorkflowCalls() []struct {\n\tWorkflowID string\n} {\n\tvar calls []struct {\n\t\tWorkflowID string\n\t}\n\tmock.lockCancelWorkflow.RLock()\n\tcalls = mock.calls.CancelWorkflow\n\tmock.lockCancelWorkflow.RUnlock()\n\treturn calls\n}", "func (ow *ordered[T, U]) Wait() []U {\n\tow.wg.Wait()\n\treturn ow.results\n}", "func (d DB) GetWorkflowActions(ctx context.Context, wfID string) (*pb.WorkflowActionList, error) {\n\tif wfID == invalidID {\n\t\treturn nil, errors.New(\"SELECT from worflow_state\")\n\t}\n\tif wfID == secondWorkflowID {\n\t\treturn &pb.WorkflowActionList{\n\t\t\tActionList: []*pb.WorkflowAction{\n\t\t\t\t{\n\t\t\t\t\tWorkerId: workerWithWorkflow,\n\t\t\t\t\tImage: secondActionName,\n\t\t\t\t\tName: secondActionName,\n\t\t\t\t\tTimeout: int64(90),\n\t\t\t\t\tTaskName: taskName,\n\t\t\t\t\tVolumes: volumes,\n\t\t\t\t},\n\t\t\t},\n\t\t}, nil\n\t}\n\tif wfID == firstWorkflowID {\n\t\treturn &pb.WorkflowActionList{\n\t\t\tActionList: []*pb.WorkflowAction{\n\t\t\t\t{\n\t\t\t\t\tWorkerId: workerWithWorkflow,\n\t\t\t\t\tImage: firstActionName,\n\t\t\t\t\tName: firstActionName,\n\t\t\t\t\tTimeout: int64(90),\n\t\t\t\t\tTaskName: taskName,\n\t\t\t\t\tVolumes: volumes,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tWorkerId: workerWithWorkflow,\n\t\t\t\t\tImage: secondActionName,\n\t\t\t\t\tName: secondActionName,\n\t\t\t\t\tTimeout: int64(90),\n\t\t\t\t\tTaskName: taskName,\n\t\t\t\t\tVolumes: volumes,\n\t\t\t\t},\n\t\t\t},\n\t\t}, nil\n\t}\n\treturn nil, nil\n}", "func WaitForDeploymentsAvailable(ctx context.Context, input WaitForDeploymentsAvailableInput, intervals ...interface{}) {\n\tBy(fmt.Sprintf(\"waiting for deployment %s/%s to be available\", input.Deployment.GetNamespace(), input.Deployment.GetName()))\n\tEventually(func() bool {\n\t\tdeployment := &appsv1.Deployment{}\n\t\tkey := client.ObjectKey{\n\t\t\tNamespace: input.Deployment.GetNamespace(),\n\t\t\tName: input.Deployment.GetName(),\n\t\t}\n\t\tif err := input.Getter.Get(ctx, key, deployment); err != nil {\n\t\t\treturn false\n\t\t}\n\t\tfor _, c := range deployment.Status.Conditions {\n\t\t\tif c.Type == appsv1.DeploymentAvailable && c.Status == corev1.ConditionTrue {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\n\t}, intervals...).Should(BeTrue(), \"Deployment %s/%s failed to get status.Available = True condition\", input.Deployment.GetNamespace(), input.Deployment.GetName())\n}", "func (c *Cluster) GetWorkflows(ctx context.Context, keyspaces []string, opts GetWorkflowsOptions) (*vtadminpb.ClusterWorkflows, error) {\n\tspan, ctx := trace.NewSpan(ctx, \"Cluster.GetWorkflows\")\n\tdefer span.Finish()\n\n\tAnnotateSpan(c, span)\n\tspan.Annotate(\"active_only\", opts.ActiveOnly)\n\n\tif err := c.Vtctld.Dial(ctx); err != nil {\n\t\treturn nil, fmt.Errorf(\"GetWorkflows(cluster = %v, keyspaces = %v, opts = %v) dial failed: %w\", c.ID, keyspaces, opts, err)\n\t}\n\n\treturn c.findWorkflows(ctx, keyspaces, FindWorkflowsOptions{\n\t\tActiveOnly: opts.ActiveOnly,\n\t\tIgnoreKeyspaces: opts.IgnoreKeyspaces,\n\t\tFilter: func(_ *vtadminpb.Workflow) bool { return true },\n\t})\n}", "func (s WorkerSemaphore) Wait(n int) bool {\n\tfor i := 0; i < n; i++ {\n\t\t<-s.permits\n\t}\n\treturn true\n}", "func (c *Client) Wait(cluster, service, arn string) error {\n\tt := time.NewTicker(c.pollInterval)\n\tfor {\n\t\tselect {\n\t\tcase <-t.C:\n\t\t\ts, err := c.GetDeployment(cluster, service, arn)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tc.logger.Printf(\"[info] --> desired: %d, pending: %d, running: %d\", *s.DesiredCount, *s.PendingCount, *s.RunningCount)\n\t\t\tif *s.RunningCount == *s.DesiredCount {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}\n}", "func (ws *JWorkers) Wait() {\n\tws.wg.Wait()\n}", "func waitForDaemonSets(c kubernetes.Interface, ns string, allowedNotReadyNodes int32, timeout time.Duration) error {\n\tif allowedNotReadyNodes == -1 {\n\t\treturn nil\n\t}\n\n\tstart := time.Now()\n\tframework.Logf(\"Waiting up to %v for all daemonsets in namespace '%s' to start\",\n\t\ttimeout, ns)\n\n\treturn wait.PollImmediate(framework.Poll, timeout, func() (bool, error) {\n\t\tdsList, err := c.AppsV1().DaemonSets(ns).List(context.TODO(), metav1.ListOptions{})\n\t\tif err != nil {\n\t\t\tframework.Logf(\"Error getting daemonsets in namespace: '%s': %v\", ns, err)\n\t\t\treturn false, err\n\t\t}\n\t\tvar notReadyDaemonSets []string\n\t\tfor _, ds := range dsList.Items {\n\t\t\tframework.Logf(\"%d / %d pods ready in namespace '%s' in daemonset '%s' (%d seconds elapsed)\", ds.Status.NumberReady, ds.Status.DesiredNumberScheduled, ns, ds.ObjectMeta.Name, int(time.Since(start).Seconds()))\n\t\t\tif ds.Status.DesiredNumberScheduled-ds.Status.NumberReady > allowedNotReadyNodes {\n\t\t\t\tnotReadyDaemonSets = append(notReadyDaemonSets, ds.ObjectMeta.Name)\n\t\t\t}\n\t\t}\n\n\t\tif len(notReadyDaemonSets) > 0 {\n\t\t\tframework.Logf(\"there are not ready daemonsets: %v\", notReadyDaemonSets)\n\t\t\treturn false, nil\n\t\t}\n\n\t\treturn true, nil\n\t})\n}", "func WaitAll(futures []*Future) {\r\n\tfor _,future:= range futures {\r\n\t\tfuture.Join()\r\n\t}\r\n\tfor _,future:= range futures {\r\n\t\tif !future.Success() && !future.Cancelled() {\r\n\t\t\terr:= future.Error()\r\n\t\t\tif err != nil {\r\n\t\t\t\tpanic(err)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "func WaitForMultipleObjects(nCount DWORD, lpHandles /*const*/ *HANDLE, bWaitAll bool, dwMilliseconds DWORD) DWORD {\n\tret1 := syscall6(waitForMultipleObjects, 4,\n\t\tuintptr(nCount),\n\t\tuintptr(unsafe.Pointer(lpHandles)),\n\t\tgetUintptrFromBool(bWaitAll),\n\t\tuintptr(dwMilliseconds),\n\t\t0,\n\t\t0)\n\treturn DWORD(ret1)\n}", "func checkPromises() {\n\tallDefault := true\n\t//allNotDefault := true\n\tfor _, pMsg := range promiseList {\n\t\tif pMsg.LASTACCEPTEDVALUE != \"-1\" {\n\t\t\tallDefault = false\n\t\t}\n\t}\n\tif allDefault == true {\n\t\tsendAccept()\n\t\tpromiseList = make([]message.Promise, 0)\n\t} else {\n\t\tpickValueFromProposeList()\n\t}\n}", "func (b *Botanist) WaitForControllersToBeActive(ctx context.Context) error {\n\ttype controllerInfo struct {\n\t\tname string\n\t\tlabels map[string]string\n\t}\n\n\ttype checkOutput struct {\n\t\tcontrollerName string\n\t\tready bool\n\t\terr error\n\t}\n\n\tvar (\n\t\tcontrollers = []controllerInfo{}\n\t\tpollInterval = 5 * time.Second\n\t)\n\n\t// Check whether the kube-controller-manager deployment exists\n\tif err := b.K8sSeedClient.Client().Get(ctx, kutil.Key(b.Shoot.SeedNamespace, v1beta1constants.DeploymentNameKubeControllerManager), &appsv1.Deployment{}); err == nil {\n\t\tcontrollers = append(controllers, controllerInfo{\n\t\t\tname: v1beta1constants.DeploymentNameKubeControllerManager,\n\t\t\tlabels: map[string]string{\n\t\t\t\t\"app\": \"kubernetes\",\n\t\t\t\t\"role\": \"controller-manager\",\n\t\t\t},\n\t\t})\n\t} else if client.IgnoreNotFound(err) != nil {\n\t\treturn err\n\t}\n\n\treturn retry.UntilTimeout(context.TODO(), pollInterval, 90*time.Second, func(ctx context.Context) (done bool, err error) {\n\t\tvar (\n\t\t\twg sync.WaitGroup\n\t\t\tout = make(chan *checkOutput)\n\t\t)\n\n\t\tfor _, controller := range controllers {\n\t\t\twg.Add(1)\n\n\t\t\tgo func(controller controllerInfo) {\n\t\t\t\tdefer wg.Done()\n\n\t\t\t\tpodList := &corev1.PodList{}\n\t\t\t\terr := b.K8sSeedClient.Client().List(ctx, podList,\n\t\t\t\t\tclient.InNamespace(b.Shoot.SeedNamespace),\n\t\t\t\t\tclient.MatchingLabels(controller.labels))\n\t\t\t\tif err != nil {\n\t\t\t\t\tout <- &checkOutput{controllerName: controller.name, err: err}\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Check that only one replica of the controller exists.\n\t\t\t\tif len(podList.Items) != 1 {\n\t\t\t\t\tb.Logger.Infof(\"Waiting for %s to have exactly one replica\", controller.name)\n\t\t\t\t\tout <- &checkOutput{controllerName: controller.name}\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// Check that the existing replica is not in getting deleted.\n\t\t\t\tif podList.Items[0].DeletionTimestamp != nil {\n\t\t\t\t\tb.Logger.Infof(\"Waiting for a new replica of %s\", controller.name)\n\t\t\t\t\tout <- &checkOutput{controllerName: controller.name}\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Check if the controller is active by reading its leader election record.\n\t\t\t\tleaderElectionRecord, err := common.ReadLeaderElectionRecord(b.K8sShootClient, resourcelock.EndpointsResourceLock, metav1.NamespaceSystem, controller.name)\n\t\t\t\tif err != nil {\n\t\t\t\t\tout <- &checkOutput{controllerName: controller.name, err: err}\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif delta := metav1.Now().UTC().Sub(leaderElectionRecord.RenewTime.Time.UTC()); delta <= pollInterval-time.Second {\n\t\t\t\t\tout <- &checkOutput{controllerName: controller.name, ready: true}\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tb.Logger.Infof(\"Waiting for %s to be active\", controller.name)\n\t\t\t\tout <- &checkOutput{controllerName: controller.name}\n\t\t\t}(controller)\n\t\t}\n\n\t\tgo func() {\n\t\t\twg.Wait()\n\t\t\tclose(out)\n\t\t}()\n\n\t\tfor result := range out {\n\t\t\tif result.err != nil {\n\t\t\t\treturn retry.SevereError(fmt.Errorf(\"could not check whether controller %s is active: %+v\", result.controllerName, result.err))\n\t\t\t}\n\t\t\tif !result.ready {\n\t\t\t\treturn retry.MinorError(fmt.Errorf(\"controller %s is not active\", result.controllerName))\n\t\t\t}\n\t\t}\n\n\t\treturn retry.Ok()\n\t})\n}", "func (m *Machine) WaitForStatefulSet(namespace string, labels string) error {\n\treturn wait.PollImmediate(m.PollInterval, m.PollTimeout, func() (bool, error) {\n\t\treturn m.StatefulSetRunning(namespace, labels)\n\t})\n}", "func WaitForNRestartablePods(ps *testutils.PodStore, expect int, timeout time.Duration) ([]string, error) {\n\tvar pods []*v1.Pod\n\tvar errLast error\n\tfound := wait.Poll(poll, timeout, func() (bool, error) {\n\t\tallPods := ps.List()\n\t\tpods = FilterNonRestartablePods(allPods)\n\t\tif len(pods) != expect {\n\t\t\terrLast = fmt.Errorf(\"expected to find %d pods but found only %d\", expect, len(pods))\n\t\t\tframework.Logf(\"Error getting pods: %v\", errLast)\n\t\t\treturn false, nil\n\t\t}\n\t\treturn true, nil\n\t}) == nil\n\tpodNames := make([]string, len(pods))\n\tfor i, p := range pods {\n\t\tpodNames[i] = p.ObjectMeta.Name\n\t}\n\tif !found {\n\t\treturn podNames, fmt.Errorf(\"couldn't find %d pods within %v; last error: %v\",\n\t\t\texpect, timeout, errLast)\n\t}\n\treturn podNames, nil\n}", "func loadWorkflows() (Workflows, error) {\n\tstart := time.Now()\n\tpath := filepath.Join(wf.Dir(), workflowJSON)\n\t// Unmarshal workflows.json\n\tdata, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tworkflows := Workflows{}\n\tif err := json.Unmarshal(data, &workflows); err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't unmarshal JSON (%s): %v\", path, err)\n\t}\n\tlog.Printf(\"[cache] loaded %d workflows in %v\", len(workflows), util.ReadableDuration(time.Now().Sub(start)))\n\treturn workflows, nil\n}", "func (e *Executor) Wait() {\n\tif e.waited {\n\t\treturn\n\t}\n\te.waited = true\n\n\tfor _, j := range e.Job {\n\t\tif !j.Background || j.NoWait {\n\t\t\tcontinue\n\t\t}\n\t\tj.Wait()\n\t\tif err := j.Command.Wait(); err != nil {\n\t\t\te.onError(j, err)\n\t\t}\n\t}\n}", "func (o *WorkflowSolutionActionDefinition) SetValidationWorkflows(v []WorkflowActionWorkflowDefinition) {\n\to.ValidationWorkflows = v\n}", "func waitInspect(name, expr, expected string, timeout time.Duration) error {\n\treturn daemon.WaitInspectWithArgs(dockerBinary, name, expr, expected, timeout)\n}", "func (a API) SearchRawTransactionsWait(cmd *btcjson.SearchRawTransactionsCmd) (out *[]btcjson.SearchRawTransactionsResult, e error) {\n\tRPCHandlers[\"searchrawtransactions\"].Call <-API{a.Ch, cmd, nil}\n\tselect {\n\tcase <-time.After(time.Second*5):\n\t\tbreak\n\tcase o := <-a.Ch.(chan SearchRawTransactionsRes):\n\t\tout, e = o.Res, o.Err\n\t}\n\treturn\n}", "func (client *Client) WaitForTriggersReady() error {\n\tnamespace := client.Namespace\n\ttriggers, err := client.Eventing.EventingV1alpha1().Triggers(namespace).List(metav1.ListOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, trigger := range triggers.Items {\n\t\tif err := client.WaitForTriggerReady(trigger.Name); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func wait(stop chan bool, timeout time.Duration, workers int) {\n\ttime.Sleep(timeout)\n\tclose(stop)\n}", "func (w *GroupNotExistsWaiter) Wait(ctx context.Context, params *DescribeAutoScalingGroupsInput, maxWaitDur time.Duration, optFns ...func(*GroupNotExistsWaiterOptions)) error {\n\t_, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...)\n\treturn err\n}", "func (s *Suite) WaitForEventsToProcess(n int64) {\n\twait := 0\n\n\tfor {\n\t\tif suite.Ingester.EventsProcessed() >= n {\n\t\t\tbreak\n\t\t}\n\n\t\ttime.Sleep(10 * time.Millisecond)\n\n\t\twait = wait + 10\n\n\t\tif wait >= maxWaitTimeMs {\n\t\t\tfmt.Printf(\"Error: wait time exceeded (time:%dms) [WaitForEventsToProcess]\\n\", wait)\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n}", "func (twrkr *twerk) Wait() {\n\tif twrkr.stop {\n\t\treturn\n\t}\n\tticker := time.NewTicker(100 * time.Microsecond)\n\tdefer ticker.Stop()\n\n\tfor range ticker.C {\n\t\tif len(twrkr.jobListener) == 0 && twrkr.liveWorkersNum.Get() == 0 && twrkr.currentlyWorkingNum.Get() == 0 {\n\t\t\treturn\n\t\t}\n\t}\n}", "func (s *ScheduledWorkload) WaitForRunnersProposals(_ context.Context, scheduledWorkloadId string) error {\n\terr := s.storage.SetBackOff(scheduledWorkloadId, time.Second*10)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tscheduledWorkload, err := s.storage.Get(scheduledWorkloadId)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Info().\n\t\tStr(\"scheduledWorkloadId\", scheduledWorkloadId).\n\t\tTime(\"backOffUntil\", time.Unix(scheduledWorkload.State.BackOffTimestamp, 0)).\n\t\tMsg(\"Waiting for runners ContractProposal.\")\n\n\treturn nil\n}", "func (c *Client) WaitForStatefulSet(ns, name string, timeout time.Duration) error {\n\tif c.ApplyDryRun {\n\t\treturn nil\n\t}\n\tclient, err := c.GetClientset()\n\tif err != nil {\n\t\treturn err\n\t}\n\tstatefulsets := client.AppsV1().StatefulSets(ns)\n\tid := Name{Kind: \"Statefulset\", Namespace: ns, Name: name}\n\tstart := time.Now()\n\tmsg := false\n\tfor {\n\t\tstatefulset, _ := statefulsets.Get(context.TODO(), name, metav1.GetOptions{})\n\t\tif start.Add(timeout).Before(time.Now()) {\n\t\t\treturn fmt.Errorf(\"timeout exceeded waiting for statefulset to become ready %s\", name)\n\t\t}\n\t\tif statefulset != nil && statefulset.Status.ReadyReplicas >= 1 {\n\t\t\treturn nil\n\t\t}\n\n\t\tif !msg {\n\t\t\tc.Infof(\"%s ⏳ waiting for at least 1 pod\", id)\n\t\t\tmsg = true\n\t\t}\n\n\t\ttime.Sleep(2 * time.Second)\n\t}\n}", "func (c *myClient) waitForEnvironmentsReady(p, t int, envList ...string) (err error) {\n\n\tlogger.Infof(\"Waiting up to %v seconds for the environments to be ready\", t)\n\ttimeOut := 0\n\tfor timeOut < t {\n\t\tlogger.Info(\"Waiting for the environments\")\n\t\ttime.Sleep(time.Duration(p) * time.Second)\n\t\ttimeOut = timeOut + p\n\t\tif err = c.checkForBusyEnvironments(envList); err == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\tif timeOut >= t {\n\t\terr = fmt.Errorf(\"waitForEnvironmentsReady timed out\")\n\t}\n\treturn err\n}", "func (c *TaskChain) Wait() error {\n\treturn errors.EnsureStack(c.eg.Wait())\n}", "func (d TinkDB) ListWorkflows(fn func(wf Workflow) error) error {\n\trows, err := d.instance.Query(`\n\tSELECT id, template, devices, created_at, updated_at\n\tFROM workflow\n\tWHERE\n\t\tdeleted_at IS NULL;\n\t`)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer rows.Close()\n\tvar (\n\t\tid, tmp, tar string\n\t\tcrAt, upAt time.Time\n\t)\n\n\tfor rows.Next() {\n\t\terr = rows.Scan(&id, &tmp, &tar, &crAt, &upAt)\n\t\tif err != nil {\n\t\t\terr = errors.Wrap(err, \"SELECT\")\n\t\t\td.logger.Error(err)\n\t\t\treturn err\n\t\t}\n\n\t\twf := Workflow{\n\t\t\tID: id,\n\t\t\tTemplate: tmp,\n\t\t\tHardware: tar,\n\t\t}\n\t\twf.CreatedAt, _ = ptypes.TimestampProto(crAt)\n\t\twf.UpdatedAt, _ = ptypes.TimestampProto(upAt)\n\t\terr = fn(wf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\terr = rows.Err()\n\tif err == sql.ErrNoRows {\n\t\terr = nil\n\t}\n\treturn err\n}", "func waitForNPods(ps *podStore, expect int, timeout time.Duration) ([]string, error) {\n\t// Loop until we find expect pods or timeout is passed.\n\tvar pods []*api.Pod\n\tvar errLast error\n\tfound := wait.Poll(poll, timeout, func() (bool, error) {\n\t\tpods = ps.List()\n\t\tif len(pods) != expect {\n\t\t\terrLast = fmt.Errorf(\"expected to find %d pods but found only %d\", expect, len(pods))\n\t\t\tLogf(\"Error getting pods: %v\", errLast)\n\t\t\treturn false, nil\n\t\t}\n\t\treturn true, nil\n\t}) == nil\n\t// Extract the names of all found pods.\n\tpodNames := make([]string, len(pods))\n\tfor i, p := range pods {\n\t\tpodNames[i] = p.ObjectMeta.Name\n\t}\n\tif !found {\n\t\treturn podNames, fmt.Errorf(\"couldn't find %d pods within %v; last error: %v\",\n\t\t\texpect, timeout, errLast)\n\t}\n\treturn podNames, nil\n}", "func (w *InstanceRunningWaiter) Wait(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceRunningWaiterOptions)) error {\n\t_, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...)\n\treturn err\n}", "func Wait() {\n\tdefaultManager.Wait()\n}", "func (w *Work) WaitWork() {\n\tfor {\n\t\tselect {\n\t\tcase entry := <-w.CalendarChan:\n\t\t\tgo w.Calendar(entry)\n\t\tcase work := <-w.WorkChan:\n\t\t\tgo w.Process(work)\n\t\tcase err := <-w.ErrChan:\n\t\t\tlog.Error(err.Error())\n\t\t}\n\t}\n}", "func (c *AuditClient) WaitForPendingACKs() error {\n\tfor _, reqID := range c.pendingAcks {\n\t\tack, err := c.getReply(reqID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif ack.Header.Type != syscall.NLMSG_ERROR {\n\t\t\treturn fmt.Errorf(\"unexpected ACK to SET, type=%d\", ack.Header.Type)\n\t\t}\n\t\tif err := ParseNetlinkError(ack.Data); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (w *WaitState) Wait() error {\n\tif w.Finish == 0 {\n\t\tw.Finish = 100\n\t}\n\n\tif w.PollerInterval == 0 {\n\t\tw.PollerInterval = 20 * time.Second\n\t}\n\n\tif w.Timeout == 0 {\n\t\tw.Timeout = 7 * time.Minute\n\t}\n\n\tif w.Start >= w.Finish {\n\t\treturn errors.New(\"start value can't be lower than finish value\")\n\t}\n\n\ttimeout := time.After(w.Timeout)\n\n\tticker := time.NewTicker(w.PollerInterval)\n\tdefer ticker.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\t// add a delay of -10 so start doesn't get ever larger than finish\n\t\t\tif w.Start <= w.Finish-10 {\n\t\t\t\tw.Start += 10\n\t\t\t}\n\n\t\t\tstate, err := w.StateFunc(w.Start)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif state == w.DesiredState {\n\t\t\t\treturn nil\n\t\t\t}\n\t\tcase <-time.After(time.Second * 30):\n\t\t\t// cancel the current ongoing process if it takes too long\n\t\t\tfmt.Println(\"Canceling current event asking\")\n\t\t\tcontinue\n\t\tcase <-timeout:\n\t\t\treturn ErrWaitTimeout\n\t\t}\n\t}\n\n}", "func (m *StateSwitcherMock) Wait(timeout time.Duration) {\n\tm.MinimockWait(timeout)\n}", "func WaitForPodsSchedulingGated(c clientset.Interface, ns string, num int, timeout time.Duration) error {\n\tmatched := 0\n\terr := wait.PollImmediate(poll, timeout, func() (done bool, err error) {\n\t\tpods, err := c.CoreV1().Pods(ns).List(context.TODO(), metav1.ListOptions{})\n\t\tif err != nil {\n\t\t\treturn handleWaitingAPIError(err, true, \"listing pods\")\n\t\t}\n\t\tmatched = 0\n\t\tfor _, pod := range pods.Items {\n\t\t\tfor _, condition := range pod.Status.Conditions {\n\t\t\t\tif condition.Type == v1.PodScheduled && condition.Reason == v1.PodReasonSchedulingGated {\n\t\t\t\t\tmatched++\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif matched == num {\n\t\t\treturn true, nil\n\t\t}\n\t\tframework.Logf(\"expect %d pods in scheduling gated state, but got %v\", num, matched)\n\t\treturn false, nil\n\t})\n\treturn maybeTimeoutError(err, \"waiting for pods to be scheduling gated (want %d, matched %d)\", num, matched)\n}", "func FindOrphanWorks(c client.Client, bindingNamespace, bindingName string, clusterNames []string, scope apiextensionsv1.ResourceScope) ([]workv1alpha1.Work, error) {\n\tworkList := &workv1alpha1.WorkList{}\n\tif scope == apiextensionsv1.NamespaceScoped {\n\t\tselector := labels.SelectorFromSet(labels.Set{\n\t\t\tutil.ResourceBindingNamespaceLabel: bindingNamespace,\n\t\t\tutil.ResourceBindingNameLabel: bindingName,\n\t\t})\n\n\t\tif err := c.List(context.TODO(), workList, &client.ListOptions{LabelSelector: selector}); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tselector := labels.SelectorFromSet(labels.Set{\n\t\t\tutil.ClusterResourceBindingLabel: bindingName,\n\t\t})\n\n\t\tif err := c.List(context.TODO(), workList, &client.ListOptions{LabelSelector: selector}); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tvar orphanWorks []workv1alpha1.Work\n\texpectClusters := sets.NewString(clusterNames...)\n\tfor _, work := range workList.Items {\n\t\tworkTargetCluster, err := names.GetClusterName(work.GetNamespace())\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"Failed to get cluster name which Work %s/%s belongs to. Error: %v.\",\n\t\t\t\twork.GetNamespace(), work.GetName(), err)\n\t\t\treturn nil, err\n\t\t}\n\t\tif !expectClusters.Has(workTargetCluster) {\n\t\t\torphanWorks = append(orphanWorks, work)\n\t\t}\n\t}\n\treturn orphanWorks, nil\n}", "func (f *TestFramework) getWindowsMachines(vmCount int, skipVMSetup bool) ([]mapi.Machine, error) {\n\tlog.Print(\"Waiting for Machines...\")\n\twindowsOSLabel := \"machine.openshift.io/os-id\"\n\tvar provisionedMachines []mapi.Machine\n\t// it takes approximately 12 minutes in the CI for all the machines to appear.\n\ttimeOut := 12 * time.Minute\n\tif skipVMSetup {\n\t\ttimeOut = 1 * time.Minute\n\t}\n\tstartTime := time.Now()\n\tfor i := 0; time.Since(startTime) <= timeOut; i++ {\n\t\tallMachines := &mapi.MachineList{}\n\t\tallMachines, err := f.machineClient.Machines(\"openshift-machine-api\").List(context.TODO(), metav1.ListOptions{LabelSelector: windowsOSLabel})\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to list machines: %v\", err)\n\t\t}\n\t\tprovisionedMachines = []mapi.Machine{}\n\n\t\tphaseProvisioned := \"Provisioned\"\n\n\t\tfor _, machine := range allMachines.Items {\n\t\t\tinstanceStatus := machine.Status\n\t\t\tif instanceStatus.Phase != nil && *instanceStatus.Phase == phaseProvisioned {\n\t\t\t\tprovisionedMachines = append(provisionedMachines, machine)\n\t\t\t}\n\t\t}\n\t\ttime.Sleep(5 * time.Second)\n\t}\n\tif skipVMSetup {\n\t\tif vmCount == 0 {\n\t\t\treturn nil, fmt.Errorf(\"no Windows VMs found\")\n\t\t}\n\t\treturn provisionedMachines, nil\n\t}\n\tif vmCount == len(provisionedMachines) {\n\t\treturn provisionedMachines, nil\n\t}\n\treturn nil, fmt.Errorf(\"expected VM count %d but got %d\", vmCount, len(provisionedMachines))\n}", "func (r SortedRunner) Wait() error {\n\treturn nil\n}", "func (l *Latches) WaitForLatches(keysToLatch [][]byte) {\n\tfor {\n\t\twg := l.AcquireLatches(keysToLatch)\n\t\tif wg == nil {\n\t\t\treturn\n\t\t}\n\t\twg.Wait()\n\t}\n}", "func Wait(dev *model.Dev, okStatusList []config.UpState) error {\n\toktetoLog.Spinner(\"Activating your development container...\")\n\toktetoLog.StartSpinner()\n\tdefer oktetoLog.StopSpinner()\n\n\tstop := make(chan os.Signal, 1)\n\tsignal.Notify(stop, os.Interrupt)\n\texit := make(chan error, 1)\n\n\tgo func() {\n\n\t\tticker := time.NewTicker(500 * time.Millisecond)\n\t\tfor {\n\t\t\tstatus, err := config.GetState(dev.Name, dev.Namespace)\n\t\t\tif err != nil {\n\t\t\t\texit <- err\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif status == config.Failed {\n\t\t\t\texit <- fmt.Errorf(\"your development container has failed\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor _, okStatus := range okStatusList {\n\t\t\t\tif status == okStatus {\n\t\t\t\t\texit <- nil\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\t<-ticker.C\n\t\t}\n\t}()\n\n\tselect {\n\tcase <-stop:\n\t\toktetoLog.Infof(\"CTRL+C received, starting shutdown sequence\")\n\t\toktetoLog.StopSpinner()\n\t\treturn oktetoErrors.ErrIntSig\n\tcase err := <-exit:\n\t\tif err != nil {\n\t\t\toktetoLog.Infof(\"exit signal received due to error: %s\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (recovery *Recovery) WaitApply(ctx context.Context) (err error) {\n\teg, ectx := errgroup.WithContext(ctx)\n\ttotalStores := len(recovery.allStores)\n\tworkers := utils.NewWorkerPool(uint(mathutil.Min(totalStores, common.MaxStoreConcurrency)), \"wait apply\")\n\n\tfor _, store := range recovery.allStores {\n\t\tif err := ectx.Err(); err != nil {\n\t\t\tbreak\n\t\t}\n\t\tstoreAddr := getStoreAddress(recovery.allStores, store.Id)\n\t\tstoreId := store.Id\n\n\t\tworkers.ApplyOnErrorGroup(eg, func() error {\n\t\t\trecoveryClient, conn, err := recovery.newRecoveryClient(ectx, storeAddr)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Trace(err)\n\t\t\t}\n\t\t\tdefer conn.Close()\n\t\t\tlog.Info(\"send wait apply to tikv\", zap.String(\"tikv address\", storeAddr), zap.Uint64(\"store id\", storeId))\n\t\t\treq := &recovpb.WaitApplyRequest{StoreId: storeId}\n\t\t\t_, err = recoveryClient.WaitApply(ectx, req)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"wait apply failed\", zap.Uint64(\"store id\", storeId))\n\t\t\t\treturn errors.Trace(err)\n\t\t\t}\n\n\t\t\trecovery.progress.Inc()\n\t\t\tlog.Info(\"wait apply execution success\", zap.Uint64(\"store id\", storeId))\n\t\t\treturn nil\n\t\t})\n\t}\n\t// Wait for all TiKV instances force leader and wait apply to last log.\n\treturn eg.Wait()\n}", "func WaitDestroy(s *state.State) error {\n\ts.Logger.Info(\"Waiting for all machines to get deleted...\")\n\n\treturn wait.PollUntilContextTimeout(s.Context, 5*time.Second, 5*time.Minute, false, func(ctx context.Context) (bool, error) {\n\t\tlist := &clusterv1alpha1.MachineList{}\n\t\tif err := s.DynamicClient.List(ctx, list, dynclient.InNamespace(resources.MachineControllerNameSpace)); err != nil {\n\t\t\treturn false, fail.KubeClient(err, \"getting %T\", list)\n\t\t}\n\t\tif len(list.Items) != 0 {\n\t\t\treturn false, nil\n\t\t}\n\n\t\treturn true, nil\n\t})\n}", "func (w *InstanceStoppedWaiter) Wait(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceStoppedWaiterOptions)) error {\n\t_, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...)\n\treturn err\n}", "func (s *Syncthing) WaitForScanning(ctx context.Context, local bool) error {\n\tfor _, folder := range s.Folders {\n\t\tif err := s.waitForFolderScanning(ctx, folder, local); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func WaitForNamespacesDeleted(ctx context.Context, c clientset.Interface, namespaces []string, timeout time.Duration) error {\n\tginkgo.By(fmt.Sprintf(\"Waiting for namespaces %+v to vanish\", namespaces))\n\tnsMap := map[string]bool{}\n\tfor _, ns := range namespaces {\n\t\tnsMap[ns] = true\n\t}\n\t//Now POLL until all namespaces have been eradicated.\n\treturn wait.PollWithContext(ctx, 2*time.Second, timeout,\n\t\tfunc(ctx context.Context) (bool, error) {\n\t\t\tnsList, err := c.CoreV1().Namespaces().List(ctx, metav1.ListOptions{})\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\tfor _, item := range nsList.Items {\n\t\t\t\tif _, ok := nsMap[item.Name]; ok {\n\t\t\t\t\treturn false, nil\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true, nil\n\t\t})\n}", "func (o *OutputManager) AwaitOutputsToBeSolid(outputs []string, clt Client, maxGoroutines int) (allSolid bool) {\n\twg := sync.WaitGroup{}\n\tsemaphore := make(chan bool, maxGoroutines)\n\tallSolid = true\n\n\tfor _, outID := range outputs {\n\t\twg.Add(1)\n\t\tgo func(outID string) {\n\t\t\tdefer wg.Done()\n\t\t\tsemaphore <- true\n\t\t\tdefer func() {\n\t\t\t\t<-semaphore\n\t\t\t}()\n\t\t\terr := o.AwaitOutputToBeSolid(outID, clt, waitForSolidification)\n\t\t\tif err != nil {\n\t\t\t\tallSolid = false\n\t\t\t\treturn\n\t\t\t}\n\t\t}(outID)\n\t}\n\twg.Wait()\n\treturn\n}", "func (tfcm *TestFCM) wait(count int) {\n\ttime.Sleep(time.Duration(count) * tfcm.timeout)\n}", "func (c *TkgClient) WaitForPackages(regionalClusterClient, currentClusterClient clusterclient.Client, clusterName, namespace string) error {\n\t// Adding kapp-controller package to the exclude list\n\t// For management cluster, kapp-controller is deployed using CRS and addon secret does not exist\n\t// For workload cluster, kapp-controller is deployed by addons manager. Even though the\n\t// addon secret for kapp-controller exists, it is not deployed using PackageInstall.\n\t// Hence skipping it while waiting for packages.\n\tListExcludePackageInstallsFromWait := []string{constants.KappControllerPackageName}\n\n\t// Get the list of addons secrets\n\tsecretList := &corev1.SecretList{}\n\terr := regionalClusterClient.ListResources(secretList, &crtclient.ListOptions{Namespace: namespace})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to get list of secrets\")\n\t}\n\n\t// From the addons secret get the names of package installs for each addon secret\n\t// This is determined from the \"tkg.tanzu.vmware.com/addon-name\" label on the secret\n\tpackageInstallNames := []string{}\n\tfor i := range secretList.Items {\n\t\tif secretList.Items[i].Type == constants.AddonSecretType {\n\t\t\tif cn, exists := secretList.Items[i].Labels[constants.ClusterNameLabel]; exists && cn == clusterName {\n\t\t\t\tif addonName, exists := secretList.Items[i].Labels[constants.AddonNameLabel]; exists {\n\t\t\t\t\tif !utils.ContainsString(ListExcludePackageInstallsFromWait, addonName) {\n\t\t\t\t\t\tpackageInstallNames = append(packageInstallNames, addonName)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Start waiting for all packages in parallel using group.Wait\n\t// Note: As PackageInstall resources are created in the cluster itself\n\t// we are using currentClusterClient which will point to correct cluster\n\tgroup, _ := errgroup.WithContext(context.Background())\n\n\tfor _, packageName := range packageInstallNames {\n\t\tpn := packageName\n\t\tlog.V(3).Warningf(\"Waiting for package: %s\", pn)\n\t\tgroup.Go(\n\t\t\tfunc() error {\n\t\t\t\terr := currentClusterClient.WaitForPackageInstall(pn, constants.TkgNamespace, c.getPackageInstallTimeoutFromConfig())\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.V(3).Warningf(\"Failure while waiting for package '%s'\", pn)\n\t\t\t\t} else {\n\t\t\t\t\tlog.V(3).Infof(\"Successfully reconciled package: %s\", pn)\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t})\n\t}\n\n\terr = group.Wait()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Failure while waiting for packages to be installed\")\n\t}\n\n\treturn nil\n}", "func (wewq *WorkflowEventsWaitQuery) All(ctx context.Context) ([]*WorkflowEventsWait, error) {\n\tif err := wewq.prepareQuery(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\treturn wewq.sqlAll(ctx)\n}", "func (c *Client) WaitForReposToBeCloned(repos ...string) error {\n\ttimeout := 30 * time.Second\n\tctx, cancel := context.WithTimeout(context.Background(), timeout)\n\tdefer cancel()\n\n\tvar name string\n\tvar missing []string\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn errors.Errorf(\"timed out in %s, still missing %v\", timeout, missing)\n\t\tdefault:\n\t\t}\n\n\t\tconst query = `\nquery Repositories {\n\trepositories(first: 1000, cloned: true, notCloned: false) {\n\t\tnodes {\n\t\t\tname\n\t\t}\n\t}\n}\n`\n\t\tvar err error\n\t\tmissing, err = c.waitForReposByQuery(name, query, repos...)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"wait for repos\")\n\t\t}\n\t\tif len(missing) == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\t// We want to log the very fist query of this kind, but don't want to create log spam\n\t\t// for subsequent queries.\n\t\tif name == \"\" {\n\t\t\tname = \"WaitForReposToBeCloned\"\n\t\t}\n\n\t\ttime.Sleep(100 * time.Millisecond)\n\t}\n\treturn nil\n}", "func tryWaitForUnitStates(units []string, state string, js job.JobState, maxAttempts int, out io.Writer) error {\n\t// We do not wait just assume we reached the desired state\n\tif maxAttempts <= -1 {\n\t\tfor _, name := range units {\n\t\t\tstdout(\"Triggered unit %s %s\", name, state)\n\t\t}\n\t\treturn nil\n\t}\n\n\terrchan := waitForUnitStates(units, js, maxAttempts, out)\n\tfor err := range errchan {\n\t\tstderr(\"Error waiting for units: %v\", err)\n\t\treturn err\n\t}\n\n\treturn nil\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.47419065", "0.47200108", "0.47150674", "0.47065392", "0.4705548", "0.47033438", "0.46916682", "0.4666811", "0.46649176", "0.46641645", "0.46568307", "0.46549264", "0.46325946", "0.46312955", "0.45832142", "0.45646402", "0.45533076", "0.4533725", "0.45316648", "0.45167413", "0.45143297", "0.44981325", "0.44620425", "0.44466007", "0.44432396", "0.44402546", "0.44292724", "0.44266477", "0.4425643", "0.44139895", "0.44044366", "0.44033408", "0.43877172", "0.43840832", "0.4381472", "0.43785495", "0.43523848", "0.43501067", "0.43383723", "0.43345293", "0.43103108", "0.4304469", "0.43038562", "0.4280738", "0.42792222", "0.42727518", "0.427051", "0.42679453", "0.42634687", "0.4255958", "0.42516026", "0.4238435", "0.423669", "0.42325553", "0.422941", "0.4227544", "0.4217861", "0.42174083", "0.42162526", "0.42137462", "0.4210576", "0.41949078", "0.4193907", "0.41935828", "0.4188732", "0.41876778", "0.41783", "0.41758063", "0.41753975", "0.41732013", "0.41727707", "0.4166876", "0.41655782", "0.41617352", "0.41602734", "0.41590735", "0.415883", "0.41561535", "0.4151349", "0.41434357" ]
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.Config, rpcdaos *service.RPCDaos) *Service {\n\ts := &Service{\n\t\tc: c,\n\t\tdm: danmu.New(c),\n\t\tacc: rpcdaos.Acc,\n\t\tarc: rpcdaos.Arc,\n\t\tsub: rpcdaos.Sub,\n\t\telec: elec.New(c),\n\t}\n\treturn s\n}", "func newService(cr *argoprojv1a1.ArgoCD) *corev1.Service {\n\treturn &corev1.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name,\n\t\t\tNamespace: cr.Namespace,\n\t\t\tLabels: argoutil.LabelsForCluster(cr),\n\t\t},\n\t}\n}", "func New(c *conf.Config) (s *Service) {\n\ts = &Service{\n\t\tconf: c,\n\t\tdao: dao.New(c),\n\t\tarcRPC: arcCli.New2(c.ArchiveRPC),\n\t\tassRPC: assCli.New(c.AssistRPC),\n\t\tcoinRPC: coinCli.New(c.CoinRPC),\n\t\trelRPC: relCli.New(c.RelationRPC),\n\t\tlocationRPC: locCli.New(c.LocationRPC),\n\t\tcache: fanout.New(\"cache\", fanout.Worker(1), fanout.Buffer(1024)),\n\t\trealname: make(map[int64]int64),\n\t\tarcTypes: make(map[int16]int16),\n\t\tbroadcastChan: make(chan *broadcast, 1024),\n\t\tlocalCache: make(map[string][]byte),\n\t\tseqDmArg: &seqMdl.ArgBusiness{BusinessID: c.Seq.DM.BusinessID, Token: c.Seq.DM.Token},\n\t\tseqSubtitleArg: &seqMdl.ArgBusiness{BusinessID: c.Seq.Subtitle.BusinessID, Token: c.Seq.Subtitle.Token},\n\t\tseqRPC: seqCli.New2(c.SeqRPC),\n\t\tassistLogChan: make(chan *assMdl.ArgAssistLogAdd, 1024),\n\t\tdmOperationLogSvc: infoc.New(c.Infoc2),\n\t\topsLogCh: make(chan *oplog.Infoc, 1024),\n\t\tmoniOidMap: make(map[int64]struct{}),\n\t\tmemberRPC: memberCli.New(c.MemberRPC),\n\t\tfigureRPC: figureCli.New(c.FigureRPC),\n\t\tspyRPC: spyCli.New(c.SpyRPC),\n\t\tgarbageDanmu: c.Switch.GarbageDanmu,\n\t\tbroadcastLimit: c.BroadcastLimit.Limit,\n\t\tbroadcastlimitInterval: c.BroadcastLimit.Interval,\n\t\tlocalViewCache: make(map[string]*model.ViewDm),\n\t\taidSheild: make(map[int64]struct{}),\n\t\tmidsSheild: make(map[int64]struct{}),\n\t}\n\tfor idStr, cid := range s.conf.Realname.Threshold {\n\t\tids, err := xstr.SplitInts(idStr)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tfor _, id := range ids {\n\t\t\tif _, ok := s.realname[id]; !ok {\n\t\t\t\ts.realname[id] = cid\n\t\t\t}\n\t\t}\n\t}\n\taccountRPC, err := accountCli.NewClient(c.AccountRPC)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ts.accountRPC = accountRPC\n\tugcPayRPC, err := ugcPayCli.NewClient(c.UgcPayRPC)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ts.ugcPayRPC = ugcPayRPC\n\tfilterRPC, err := filterCli.NewClient(s.conf.FilterRPC)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ts.filterRPC = filterRPC\n\tseasonRPC, err := seasonCli.NewClient(c.SeasonRPC)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"seasonCli.NewClient.error(%v)\", err))\n\t}\n\ts.seasonRPC = seasonRPC\n\tthumbupRPC, err := thumbupApi.NewClient(c.ThumbupRPC)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ts.thumbupRPC = thumbupRPC\n\tsubtitleLans, err := s.dao.SubtitleLans(context.Background())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ts.subtitleLans = model.SubtitleLans(subtitleLans)\n\tgo s.broadcastproc()\n\tgo s.archiveTypeproc()\n\tgo s.localcacheproc()\n\tgo s.assistLogproc()\n\tgo s.oplogproc()\n\tgo s.monitorproc()\n\tgo s.viewProc()\n\tgo s.shieldProc()\n\treturn\n}", "func NewService(m map[string]interface{}) Service {\n\treturn m\n}", "func New() endly.Service {\n\tvar result = &service{\n\t\tAbstractService: endly.NewAbstractService(ServiceID),\n\t}\n\tresult.AbstractService.Service = result\n\tresult.registerRoutes()\n\treturn result\n}", "func New() endly.Service {\n\tvar result = &service{\n\t\tAbstractService: endly.NewAbstractService(ServiceID),\n\t}\n\tresult.AbstractService.Service = result\n\tresult.registerRoutes()\n\treturn result\n}", "func New() endly.Service {\n\tvar result = &service{\n\t\tAbstractService: endly.NewAbstractService(ServiceID),\n\t}\n\tresult.AbstractService.Service = result\n\tresult.registerRoutes()\n\treturn result\n}", "func NewService(connection portainer.Connection) (*Service, error) {\n\terr := connection.SetServiceName(BucketName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := &Service{\n\t\tconnection: connection,\n\t\tidxEdgeID: make(map[string]portainer.EndpointID),\n\t}\n\n\tes, err := s.endpoints()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, e := range es {\n\t\tif len(e.EdgeID) > 0 {\n\t\t\ts.idxEdgeID[e.EdgeID] = e.ID\n\t\t}\n\n\t\ts.heartbeats.Store(e.ID, e.LastCheckInDate)\n\t}\n\n\treturn s, nil\n}", "func (k *Kube) createServiceObj(s *v1.Service, namespace string, hostname string, internalname string) *v1.Service {\n\ts.Spec.Type = \"ExternalName\"\n\ts.Spec.ExternalName = hostname\n\n\ts.Name = internalname\n\ts.Annotations = map[string]string{\"origin\": \"rds\"}\n\ts.Namespace = namespace\n\treturn s\n}", "func NewService(name string, options types.ServiceCreateOptions) (*Service, error) {\n\tuuid, err := generateEntityID()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\turls := strings.Split(options.URLs, \",\")\n\n\tfor _, u := range urls {\n\t\tu = strings.Trim(u, \" \")\n\t}\n\n\ts := Service{\n\t\tID: uuid,\n\t\tName: name,\n\t\tURLs: urls,\n\t\tTargetVersion: \"\",\n\t\tBalancingMethod: options.Balancing,\n\t\tIsEnabled: options.Enable,\n\t}\n\n\treturn &s, nil\n}", "func NewService(log zerolog.Logger, config *rest.Config, builder APIBuilder) (*Service, error) {\n\tvar c client.Client\n\tctx := context.Background()\n\tif err := retry.Do(ctx, func(ctx context.Context) error {\n\t\tvar err error\n\t\tc, err = client.New(config, client.Options{})\n\t\treturn err\n\t}, retry.Timeout(constants.TimeoutK8sClient)); err != nil {\n\t\treturn nil, err\n\t}\n\tns, err := constants.GetNamespace()\n\tif err != nil {\n\t\treturn nil, maskAny(err)\n\t}\n\tpodName, err := constants.GetPodName()\n\tif err != nil {\n\t\treturn nil, maskAny(err)\n\t}\n\tpipelineName, err := constants.GetPipelineName()\n\tif err != nil {\n\t\treturn nil, maskAny(err)\n\t}\n\tlinkName, err := constants.GetLinkName()\n\tif err != nil {\n\t\treturn nil, maskAny(err)\n\t}\n\tport, err := constants.GetAPIPort()\n\tif err != nil {\n\t\treturn nil, maskAny(err)\n\t}\n\tdnsName, err := constants.GetDNSName()\n\tif err != nil {\n\t\treturn nil, maskAny(err)\n\t}\n\tvar p corev1.Pod\n\tpodKey := client.ObjectKey{\n\t\tName: podName,\n\t\tNamespace: ns,\n\t}\n\tif err := retry.Do(ctx, func(ctx context.Context) error {\n\t\treturn c.Get(ctx, podKey, &p)\n\t}, retry.Timeout(constants.TimeoutAPIServer)); err != nil {\n\t\tlog.Error().Err(err).Msg(\"Failed to get own pod\")\n\t\treturn nil, maskAny(err)\n\t}\n\tavReg, err := avclient.NewAnnotatedValueRegistryClient()\n\tif err != nil {\n\t\tlog.Error().Err(err).Msg(\"Failed to create annotated value registry client\")\n\t\treturn nil, maskAny(err)\n\t}\n\tagentReg, err := pipelinecl.CreateAgentRegistryClient()\n\tif err != nil {\n\t\tlog.Error().Err(err).Msg(\"Failed to create agent registry client\")\n\t\treturn nil, maskAny(err)\n\t}\n\tstatsSink, err := trackingcl.CreateStatisticsSinkClient()\n\tif err != nil {\n\t\tlog.Error().Err(err).Msg(\"Failed to create statistics sink client\")\n\t\treturn nil, maskAny(err)\n\t}\n\turi := newLinkURI(dnsName, port, &p)\n\tstatistics := &tracking.LinkStatistics{\n\t\tName: linkName,\n\t\tURI: uri,\n\t}\n\tdeps := APIDependencies{\n\t\tClient: c,\n\t\tPipelineName: pipelineName,\n\t\tLinkName: linkName,\n\t\tNamespace: ns,\n\t\tURI: uri,\n\t\tAnnotatedValueRegistry: avReg,\n\t\tAgentRegistry: agentReg,\n\t\tStatistics: statistics,\n\t}\n\tavPublisher, err := builder.NewAnnotatedValuePublisher(deps)\n\tif err != nil {\n\t\treturn nil, maskAny(err)\n\t}\n\tavSource, err := builder.NewAnnotatedValueSource(deps)\n\tif err != nil {\n\t\treturn nil, maskAny(err)\n\t}\n\treturn &Service{\n\t\tlog: log,\n\t\tport: port,\n\t\tlinkName: linkName,\n\t\turi: uri,\n\t\tstatistics: statistics,\n\t\tavPublisher: avPublisher,\n\t\tavSource: avSource,\n\t\tavRegistry: avReg,\n\t\tagentRegistry: agentReg,\n\t\tstatisticsSink: statsSink,\n\t}, nil\n}", "func newService(c *onet.Context) (onet.Service, error) {\n\ts := &ServiceState{\n\t\tServiceProcessor: onet.NewServiceProcessor(c),\n\t}\n\thelloMsg := network.RegisterMessage(HelloMsg{})\n\tstopMsg := network.RegisterMessage(StopProtocol{})\n\tconnMsg := network.RegisterMessage(ConnectionRequest{})\n\tdisconnectMsg := network.RegisterMessage(DisconnectionRequest{})\n\n\tc.RegisterProcessorFunc(helloMsg, s.HandleHelloMsg)\n\tc.RegisterProcessorFunc(stopMsg, s.HandleStop)\n\tc.RegisterProcessorFunc(connMsg, s.HandleConnection)\n\tc.RegisterProcessorFunc(disconnectMsg, s.HandleDisconnection)\n\n\tif err := s.tryLoad(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn s, nil\n}", "func New(config *Config) Service {\n\tconfig.Init()\n\treturn &service{\n\t\tfs: afs.New(),\n\t\tConfig: config,\n\t}\n}", "func New() endly.Service {\n\tvar result = &service{\n\t\tjdkService: &jdkService{},\n\t\tgoService: &goService{},\n\t\tnodeService: &nodeService{},\n\t\tAbstractService: endly.NewAbstractService(ServiceID),\n\t}\n\tresult.AbstractService.Service = result\n\tresult.registerRoutes()\n\treturn result\n}", "func createService(cluster *client.VanClient, name string, annotations map[string]string) (*corev1.Service, error) {\n\n\tsvc := &corev1.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"app\": \"nginx\",\n\t\t\t},\n\t\t\tAnnotations: annotations,\n\t\t},\n\t\tSpec: corev1.ServiceSpec{\n\t\t\tPorts: []corev1.ServicePort{\n\t\t\t\t{Name: \"web\", Port: 8080},\n\t\t\t},\n\t\t\tSelector: map[string]string{\n\t\t\t\t\"app\": \"nginx\",\n\t\t\t},\n\t\t\tType: corev1.ServiceTypeLoadBalancer,\n\t\t},\n\t}\n\n\t// Creating the new service\n\tsvc, err := cluster.KubeClient.CoreV1().Services(cluster.Namespace).Create(context.TODO(), svc, metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Populate services map by namespace\n\tservices := []string{svc.Name}\n\tvar ok bool\n\tif services, ok = servicesMap[cluster.Namespace]; ok {\n\t\tservices = append(services, svc.Name)\n\t}\n\tservicesMap[cluster.Namespace] = services\n\n\treturn svc, nil\n}", "func newService(namespace, name string) *v1.Service {\n\treturn &v1.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t\tLabels: labelMap(),\n\t\t},\n\t\tSpec: v1.ServiceSpec{\n\t\t\tSelector: labelMap(),\n\t\t\tPorts: []v1.ServicePort{\n\t\t\t\t{Name: \"port-1338\", Port: 1338, Protocol: \"TCP\", TargetPort: intstr.FromInt(1338)},\n\t\t\t\t{Name: \"port-1337\", Port: 1337, Protocol: \"TCP\", TargetPort: intstr.FromInt(1337)},\n\t\t\t},\n\t\t},\n\t}\n\n}", "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.AccountActiveAdSummaries = NewAccountActiveAdSummariesService(s)\n\ts.AccountPermissionGroups = NewAccountPermissionGroupsService(s)\n\ts.AccountPermissions = NewAccountPermissionsService(s)\n\ts.AccountUserProfiles = NewAccountUserProfilesService(s)\n\ts.Accounts = NewAccountsService(s)\n\ts.Ads = NewAdsService(s)\n\ts.AdvertiserGroups = NewAdvertiserGroupsService(s)\n\ts.AdvertiserLandingPages = NewAdvertiserLandingPagesService(s)\n\ts.Advertisers = NewAdvertisersService(s)\n\ts.Browsers = NewBrowsersService(s)\n\ts.CampaignCreativeAssociations = NewCampaignCreativeAssociationsService(s)\n\ts.Campaigns = NewCampaignsService(s)\n\ts.ChangeLogs = NewChangeLogsService(s)\n\ts.Cities = NewCitiesService(s)\n\ts.ConnectionTypes = NewConnectionTypesService(s)\n\ts.ContentCategories = NewContentCategoriesService(s)\n\ts.Conversions = NewConversionsService(s)\n\ts.Countries = NewCountriesService(s)\n\ts.CreativeAssets = NewCreativeAssetsService(s)\n\ts.CreativeFieldValues = NewCreativeFieldValuesService(s)\n\ts.CreativeFields = NewCreativeFieldsService(s)\n\ts.CreativeGroups = NewCreativeGroupsService(s)\n\ts.Creatives = NewCreativesService(s)\n\ts.DimensionValues = NewDimensionValuesService(s)\n\ts.DirectorySites = NewDirectorySitesService(s)\n\ts.DynamicTargetingKeys = NewDynamicTargetingKeysService(s)\n\ts.EventTags = NewEventTagsService(s)\n\ts.Files = NewFilesService(s)\n\ts.FloodlightActivities = NewFloodlightActivitiesService(s)\n\ts.FloodlightActivityGroups = NewFloodlightActivityGroupsService(s)\n\ts.FloodlightConfigurations = NewFloodlightConfigurationsService(s)\n\ts.InventoryItems = NewInventoryItemsService(s)\n\ts.Languages = NewLanguagesService(s)\n\ts.Metros = NewMetrosService(s)\n\ts.MobileApps = NewMobileAppsService(s)\n\ts.MobileCarriers = NewMobileCarriersService(s)\n\ts.OperatingSystemVersions = NewOperatingSystemVersionsService(s)\n\ts.OperatingSystems = NewOperatingSystemsService(s)\n\ts.OrderDocuments = NewOrderDocumentsService(s)\n\ts.Orders = NewOrdersService(s)\n\ts.PlacementGroups = NewPlacementGroupsService(s)\n\ts.PlacementStrategies = NewPlacementStrategiesService(s)\n\ts.Placements = NewPlacementsService(s)\n\ts.PlatformTypes = NewPlatformTypesService(s)\n\ts.PostalCodes = NewPostalCodesService(s)\n\ts.Projects = NewProjectsService(s)\n\ts.Regions = NewRegionsService(s)\n\ts.RemarketingListShares = NewRemarketingListSharesService(s)\n\ts.RemarketingLists = NewRemarketingListsService(s)\n\ts.Reports = NewReportsService(s)\n\ts.Sites = NewSitesService(s)\n\ts.Sizes = NewSizesService(s)\n\ts.Subaccounts = NewSubaccountsService(s)\n\ts.TargetableRemarketingLists = NewTargetableRemarketingListsService(s)\n\ts.TargetingTemplates = NewTargetingTemplatesService(s)\n\ts.UserProfiles = NewUserProfilesService(s)\n\ts.UserRolePermissionGroups = NewUserRolePermissionGroupsService(s)\n\ts.UserRolePermissions = NewUserRolePermissionsService(s)\n\ts.UserRoles = NewUserRolesService(s)\n\ts.VideoFormats = NewVideoFormatsService(s)\n\treturn s, nil\n}", "func (s Obj_value) NewService() (ServiceInfo, error) {\n\ts.Struct.SetUint16(4, 7)\n\tss, err := NewServiceInfo(s.Struct.Segment())\n\tif err != nil {\n\t\treturn ServiceInfo{}, err\n\t}\n\terr = s.Struct.SetPtr(0, ss.Struct.ToPtr())\n\treturn ss, err\n}", "func New(c *configs.Config) (s *Service) {\n\t//var ac = new(paladin.TOML)\n\t//if err := paladin.Watch(\"application.toml\", ac); err != nil {\n\t//\tpanic(err)\n\t//}\n\ts = &Service{\n\t\tc: c,\n\t\tdao: dao.New(c),\n\t}\n\treturn s\n}", "func New() *service {\n\treturn &service{}\n}", "func NewService(serviceName string) *ServiceObject {\n\tserviceObject := ServiceObject{}\n\tserviceObject.serviceName = serviceName\n\tserviceObject.serviceStatusHandle = 0\n\tserviceObject.serviceExit = make(chan bool)\n\treturn &serviceObject\n}", "func NewService(config Config) *Service {\n\treturn &Service{\n\t\tinstances: new(sync.Map),\n\t\tconfig: config,\n\t}\n}", "func NewService(cfg aws.Config) *Service {\n\treturn &Service{\n\t\tacm: acm.NewFromConfig(cfg), // v2\n\t\trds: rds.NewFromConfig(cfg), // v2\n\t\tiam: iam.NewFromConfig(cfg), // v2\n\t\ts3: s3.NewFromConfig(cfg), // v2\n\t\troute53: route53.NewFromConfig(cfg), // v2\n\t\tsecretsManager: secretsmanager.NewFromConfig(cfg), // v2\n\t\tresourceGroupsTagging: resourcegroupstaggingapi.NewFromConfig(cfg), // v2\n\t\tec2: ec2.NewFromConfig(cfg), // v2\n\t\tkms: kms.NewFromConfig(cfg), // v2\n\t\tdynamodb: dynamodb.NewFromConfig(cfg), // v2\n\t\tsts: sts.NewFromConfig(cfg), // v2\n\t\teks: eks.NewFromConfig(cfg), // v2\n\t\telb: newElasticLoadbalancerFromConfig(cfg),\n\t}\n}", "func New(conf Config) (*Service, error) {\n\tvar service Service\n\n\t// launch server\n\tserver, err := transport.Launch(conf.Addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// prepare backend and configure logger\n\tbackend := newBackend(conf)\n\tbackend.Logger = service.eventHandler\n\n\t// prepare engine\n\tengine := broker.NewEngine(backend)\n\n\t// prepare server client for publishing outbox to device\n\tserverClient := client.New()\n\tcid := fmt.Sprintf(\"%s-%d\", serverClientID, time.Now().Unix())\n\t_, err = serverClient.Connect(client.NewConfigWithClientID(conf.Addr, cid))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tengine.Accept(server)\n\n\t// compose service\n\tservice.config = conf\n\tservice.client = serverClient\n\tservice.stats.ActiveClients = map[string]time.Time{}\n\tservice.activeClientFn = func(string) {}\n\tservice.closeFn = func() error {\n\t\tif err = serverClient.Disconnect(); err != nil {\n\t\t\treturn fmt.Errorf(\"closing client error\")\n\t\t}\n\n\t\tif !backend.Close(2 * time.Second) {\n\t\t\treturn fmt.Errorf(\"closing backend timed-out\")\n\t\t}\n\n\t\tif err = server.Close(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tengine.Close()\n\t\treturn nil\n\t}\n\treturn &service, nil\n}", "func NewService(cfg *ServiceConfig) (*Service, error) {\n\tswitch {\n\tcase cfg.Backend == nil:\n\t\treturn nil, trace.BadParameter(\"backend is required\")\n\tcase cfg.Embeddings == nil:\n\t\treturn nil, trace.BadParameter(\"embeddings is required\")\n\tcase cfg.Authorizer == nil:\n\t\treturn nil, trace.BadParameter(\"authorizer is required\")\n\tcase cfg.ResourceGetter == nil:\n\t\treturn nil, trace.BadParameter(\"resource getter is required\")\n\tcase cfg.Logger == nil:\n\t\tcfg.Logger = logrus.WithField(trace.Component, \"assist.service\")\n\t}\n\t// Embedder can be nil is the OpenAI API key is not set.\n\n\treturn &Service{\n\t\tbackend: cfg.Backend,\n\t\tembeddings: cfg.Embeddings,\n\t\tembedder: cfg.Embedder,\n\t\tauthorizer: cfg.Authorizer,\n\t\tresourceGetter: cfg.ResourceGetter,\n\t\tlog: cfg.Logger,\n\t}, nil\n}", "func (c PGClient) NewService(name string, binsIB int64, host string, port int, typeService string, runSTR string, projects []string, owner string) (err error) {\n\t_, err = c.DB.Query(\"select new_service_function($1,$2,$3,$4,$5,$6,$7,$8)\", name, binsIB, host, port, typeService, runSTR, pg.Array(projects), owner)\n\treturn err\n}", "func newService(kogitoApp *v1alpha1.KogitoApp, deploymentConfig *appsv1.DeploymentConfig) (service *corev1.Service) {\n\tif deploymentConfig == nil {\n\t\t// we can't create a service without a DC\n\t\treturn nil\n\t}\n\n\tports := buildServicePorts(deploymentConfig)\n\tif len(ports) == 0 {\n\t\treturn nil\n\t}\n\n\tservice = &corev1.Service{\n\t\tObjectMeta: *deploymentConfig.ObjectMeta.DeepCopy(),\n\t\tSpec: corev1.ServiceSpec{\n\t\t\tSelector: deploymentConfig.Spec.Selector,\n\t\t\tType: corev1.ServiceTypeClusterIP,\n\t\t\tPorts: ports,\n\t\t},\n\t}\n\n\tmeta.SetGroupVersionKind(&service.TypeMeta, meta.KindService)\n\taddDefaultMeta(&service.ObjectMeta, kogitoApp)\n\taddServiceLabels(&service.ObjectMeta, kogitoApp)\n\timportPrometheusAnnotations(deploymentConfig, service)\n\tservice.ResourceVersion = \"\"\n\treturn service\n}", "func New(c *conf.Config) (s *Service) {\n\ts = &Service{\n\t\tc: c,\n\t}\n\tcardRPC, err := v1.NewClient(c.CardClient)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ts.cardRPC = cardRPC\n\treturn\n}", "func NewArmadoraService() ArmadoraService {\n\tpartiesRepository := party.NewPartiesMongoRepository(\n\t\tconfig.GetConfiguration(\"MONGO_PARTY_COLLECTION_NAME\"),\n\t)\n\n\treturn ArmadoraService{\n\t\teventStore: storage.NewEventStore(),\n\t\tpartiesManager: party.NewPartiesManager(partiesRepository),\n\t}\n}", "func newService(c *onet.Context) (onet.Service, error) {\n\ts := &Service{\n\t\tServiceProcessor: onet.NewServiceProcessor(c),\n\t}\n\ts.RegisterProcessorFunc(cosiSendRawID, s.HandleRaw)\n\t_, err := c.ProtocolRegister(protoName, s.NewDefaultProtocol)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := s.RegisterHandlers(s.GenesisTx, s.Setup, s.TreesBLSCoSi, s.MemoryAllocated); err != nil {\n\t\treturn nil, errors.New(\"Couldn't register messages\")\n\t}\n\n\ts.propagateF, s.mypi, err = propagate.NewPropagationFunc(c, \"Propagate\", s.propagateHandler, -1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.trees = make(map[onet.TreeID]*onet.Tree)\n\ts.coinToAtomic = make(map[string]int)\n\ts.atomicCoinReserved = make([]int32, 0)\n\n\tdb, bucketNameTx := s.GetAdditionalBucket([]byte(\"Tx\"))\n\t_, bucketNameLastTx := s.GetAdditionalBucket([]byte(\"LastTx\"))\n\ts.bucketNameTx = bucketNameTx\n\ts.bucketNameLastTx = bucketNameLastTx\n\ts.db = db\n\treturn s, nil\n}", "func NewService(vendor string, product string, version string, url string) (*Service, error) {\n\ts := Service{\n\t\tvendor: vendor,\n\t\tproduct: product,\n\t\tversion: version,\n\t\turl: url,\n\t\tinterfaces: make(map[string]dispatcher),\n\t\tdescriptions: make(map[string]string),\n\t}\n\terr := s.RegisterInterface(orgvarlinkserviceNew())\n\n\treturn &s, err\n}", "func New(annict annict.Service) Service {\n\treturn &service{\n\t\tannict: annict,\n\t}\n}", "func New(c *rpc.ClientConfig) (s *Service) {\n\ts = &Service{}\n\ts.client = rpc.NewDiscoveryCli(_appid, c)\n\treturn\n}", "func NewAptxService(creator usecase.CreateShortURL, getter usecase.GetURL) *AptxService {\n\treturn &AptxService{\n\t\tcreator: creator,\n\t\tgetter: getter,\n\t}\n}", "func NewService(logger kitlog.Logger, o Options) (Service, error) {\n\tdb, err := o.Driver(o.DbAddr)\n\tif err != nil {\n\t\treturn Service{}, nil\n\t}\n\tif logger == nil {\n\t\tlogger = kitlog.NewNopLogger()\n\t}\n\ts := Service{\n\t\to.Domain,\n\t\to.Port,\n\t\tchi.NewRouter(),\n\t\tdb,\n\t\to.DbAddr,\n\t\tlogger,\n\t\tbpool.NewBufferPool(64),\n\t}\n\ts.InitRouter()\n\treturn s, nil\n}", "func New() (s *Service, err error) {\n\tvar (\n\t\trpcClient warden.ClientConfig\n\t\tct paladin.TOML\n\t)\n\tif err = paladin.Get(\"grpc.toml\").Unmarshal(&ct); err != nil {\n\t\treturn\n\t}\n\tif err = ct.Get(\"Client\").UnmarshalTOML(&rpcClient); err != nil {\n\t\treturn\n\t}\n\terr = paladin.Watch(\"application.toml\", s.ac)\n\treturn\n}", "func newServiceWithName(name string, component string, cr *argoprojv1a1.ArgoCD) *corev1.Service {\n\tsvc := newService(cr)\n\tsvc.ObjectMeta.Name = name\n\n\tlbls := svc.ObjectMeta.Labels\n\tlbls[common.ArgoCDKeyName] = name\n\tlbls[common.ArgoCDKeyComponent] = component\n\tsvc.ObjectMeta.Labels = lbls\n\n\treturn svc\n}", "func NewSAMSARAAPI() SAMSARAAPI {\r\n samsaraAPIClient := new(SAMSARAAPI_IMPL)\r\n samsaraAPIClient.config = configuration_pkg.NewCONFIGURATION()\r\n\r\n return samsaraAPIClient\r\n}", "func NewService(ctx context.Context) (*Service, error) {\n\tclient, _, err := htransport.NewClient(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsvc := &Service{client: client, BasePath: basePath}\n\tsvc.API = New(svc)\n\n\treturn svc, nil\n}", "func NewService(args []string, p person.Service, ns serializer.Serializer) error {\n\tcli := service{args, p, ns}\n\tif err := cli.checkArgs(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := cli.runArgs(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func New(c *cli.Cli) (s *Service, cf func(), err error) {\n\ts = &Service{\n\t\tac: &paladin.Map{},\n\t\tdao: c.Dao,\n\t\tcfg: &cfg{},\n\t}\n\tcf = s.Close\n\tif err = paladin.Get(\"application.toml\").Unmarshal(s.ac); err != nil {\n\t\treturn\n\t}\n\tif err = config.Env(s.ac, s.cfg, \"App\"); err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func NewService(db *bolt.DB) (*Service, error) {\n\terr := internal.CreateBucket(db, BucketName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Service{\n\t\tdb: db,\n\t}, nil\n}", "func NewService(db *bolt.DB) (*Service, error) {\n\terr := internal.CreateBucket(db, BucketName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Service{\n\t\tdb: db,\n\t}, nil\n}", "func New(d *dao.Dao) (s *Service, cf func(), err error) {\n\ts = &Service{\n\t\tac: &paladin.TOML{},\n\t\tdao: d,\n\t}\n\tcf = s.Close\n\terr = paladin.Watch(\"application.toml\", s.ac)\n\treturn\n}", "func newService(m *influxdatav1alpha1.Influxdb) *corev1.Service {\n\tls := labelsForInfluxdb(m.Name)\n\n\treturn &corev1.Service{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tAPIVersion: \"v1\",\n\t\t\tKind: \"Service\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: m.Name + \"-svc\",\n\t\t\tNamespace: m.Namespace,\n\t\t\tLabels: ls,\n\t\t},\n\t\tSpec: corev1.ServiceSpec{\n\t\t\tSelector: ls,\n\t\t\tType: \"ClusterIP\",\n\t\t\tPorts: newServicePorts(m),\n\t\t},\n\t}\n}", "func NewService(driver neo4j.Driver) *Service {\n\treturn &Service{\n\t\tdriver: driver,\n\t}\n}", "func NewService(\n\tconf *config.ChaosServerConfig,\n\tcli client.Client,\n\tarchive core.ExperimentStore,\n\tevent core.EventStore,\n) *Service {\n\treturn &Service{\n\t\tconf: conf,\n\t\tkubeCli: cli,\n\t\tarchive: archive,\n\t\tevent: event,\n\t}\n}", "func NewService(etcdServerUrl, serverName string) *ServiceLB {\n\treturn &ServiceLB{EtcdServerUrl: etcdServerUrl, ServerName: serverName}\n}", "func newService(serviceName string) *Service {\n\treturn &Service{\n\t\tpluginDir: serverless.PluginDir,\n\t\tname: serviceName,\n\t\tinterf: nil,\n\t}\n}", "func NewService(repo repository) *Service {\n\tmapper := mapper{}\n\treturn &Service{\n\t\terrCtx: \"service\",\n\t\tcreator: repo,\n\t\tretriever: repo,\n\t\teraser: repo,\n\t\tinputMapper: mapper,\n\t\toutputMapper: mapper,\n\t}\n}", "func NewService(addr string) *Service {\n\treturn &Service{\n\t\taddr: addr,\n\t}\n}", "func New() Service {\n\tvar svc Service\n\t{\n\t\tsvc = NewBasicService()\n\t}\n\treturn svc\n}", "func NewService(host, port, book, samhost, samport string, subs []string, useh bool) {\n\ts, err := NewServerFromOptions(\n\t\tSetServerHost(host),\n\t\tSetServerPort(port),\n\t\tSetServerAddressBookPath(book),\n\t\tSetServerUseHelper(useh),\n\t\tSetServerJumpHelperHost(samhost),\n\t\tSetServerJumpHelperPort(samport),\n\t\tSetServerSubscription(subs),\n\t)\n\tif err != nil {\n\t\tlog.Fatal(err, \"Error starting server\")\n\t}\n\tgo s.Serve()\n}", "func New(pairs ...*types.Pair) (s *Service, err error) {\n\tconst errorMessage = \"%s New: %w\"\n\n\ts = &Service{}\n\n\topt, err := parseServicePairNew(pairs...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(errorMessage, s, err)\n\t}\n\n\tcredProtocol, cred := opt.Credential.Protocol(), opt.Credential.Value()\n\tif credProtocol != credential.ProtocolHmac {\n\t\treturn nil, fmt.Errorf(errorMessage, s, err)\n\t}\n\n\tmac := qbox.NewMac(cred[0], cred[1])\n\tcfg := &qs.Config{}\n\ts.service = qs.NewBucketManager(mac, cfg)\n\treturn\n}", "func constructService(cmd *cobra.Command, editFlags ConfigurationEditFlags, name string, namespace string) (*servingv1.Service,\n\terror) {\n\n\tif name == \"\" || namespace == \"\" {\n\t\treturn nil, errors.New(\"internal: no name or namespace provided when constructing a service\")\n\t}\n\n\tservice := servingv1.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t},\n\t}\n\n\tservice.Spec.Template = servingv1.RevisionTemplateSpec{\n\t\tSpec: servingv1.RevisionSpec{},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tAnnotations: map[string]string{\n\t\t\t\tservinglib.UserImageAnnotationKey: \"\", // Placeholder. Will be replaced or deleted as we apply mutations.\n\t\t\t},\n\t\t},\n\t}\n\tservice.Spec.Template.Spec.Containers = []corev1.Container{{}}\n\n\terr := editFlags.Apply(&service, nil, cmd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &service, nil\n}", "func NewService(connection connection.Connection) *Service {\n\treturn &Service{\n\t\tconnection: connection,\n\t}\n}", "func NewService(connection connection.Connection) *Service {\n\treturn &Service{\n\t\tconnection: connection,\n\t}\n}", "func NewService(fileName string) (*Service, error) {\n\tif klog.V(5) {\n\t\tklog.Info(\"Initializing message service...\")\n\t\tdefer klog.Info(\"Done initializing message service\")\n\t}\n\n\ted, err := readEventDefinition(fileName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := &Service{\n\t\ted,\n\t\tmake(map[string]Provider),\n\t}\n\n\t// Create the messaging providers\n\tfor _, provider := range ed.Providers {\n\t\tif klog.V(6) {\n\t\t\tklog.Infof(\"Creating %s provider '%s'\", provider.ProviderType, provider.Name)\n\t\t}\n\n\t\tvar newProvider Provider\n\t\tswitch provider.ProviderType {\n\t\tcase \"nats\":\n\t\t\tnewProvider, err = newNATSProvider(provider)\n\t\tcase \"rest\":\n\t\t\tnewProvider, err = newRESTProvider(provider)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"provider '%s' for '%s' is not recognized\", provider.ProviderType, provider.Name)\n\t\t}\n\n\t\t/* Error from trying to create new provider */\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to create %s provider '%s': %v\", provider.ProviderType, provider.Name, err)\n\t\t}\n\n\t\terr = s.Register(provider.Name, newProvider)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to register %s provider '%s': %v\", provider.ProviderType, provider.Name, err)\n\t\t}\n\t}\n\n\treturn s, nil\n}", "func New(d *dao.Dao) (s *Service, cf func(), err error) {\n\ts = &Service{\n\t\tac: &paladin.TOML{},\n\t\tdao: d,\n\t}\n\tcf = func() {}\n\terr = paladin.Watch(\"application.toml\", s.ac)\n\treturn\n}", "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Dms = NewDmsService(s)\n\ts.Media = NewMediaService(s)\n\ts.Rooms = NewRoomsService(s)\n\ts.Spaces = NewSpacesService(s)\n\treturn s, nil\n}", "func NewService() Service {\n\treturn Service{}\n}", "func New(d dao.Dao) (s *Service, cf func(), err error) {\n\ts = &Service{\n\t\tac: &paladin.TOML{},\n\t\tdao: d,\n\t}\n\tcf = s.Close\n\terr = paladin.Watch(\"application.toml\", s.ac)\n\treturn\n}", "func NewService(config *api.APIConfig, cloudsourceapiClient cloudsourceapi.Client, pubsubapiClient pubsubapi.Client, estafetteService estafette.Service, queueService queue.Service) Service {\n\treturn &service{\n\t\tconfig: config,\n\t\tcloudsourceapiClient: cloudsourceapiClient,\n\t\tpubsubapiClient: pubsubapiClient,\n\t\testafetteService: estafetteService,\n\t\tqueueService: queueService,\n\t}\n}", "func New() Service {\n\treturn &service{}\n}", "func New() Service {\n\treturn &service{}\n}", "func newService(name, project, image string, envs map[string]string, options options) *runapi.Service {\n\tvar envVars []*runapi.EnvVar\n\tfor k, v := range envs {\n\t\tenvVars = append(envVars, &runapi.EnvVar{Name: k, Value: v})\n\t}\n\n\tsvc := &runapi.Service{\n\t\tApiVersion: \"serving.knative.dev/v1\",\n\t\tKind: \"Service\",\n\t\tMetadata: &runapi.ObjectMeta{\n\t\t\tAnnotations: make(map[string]string),\n\t\t\tName: name,\n\t\t\tNamespace: project,\n\t\t},\n\t\tSpec: &runapi.ServiceSpec{\n\t\t\tTemplate: &runapi.RevisionTemplate{\n\t\t\t\tMetadata: &runapi.ObjectMeta{\n\t\t\t\t\tName: generateRevisionName(name, 0),\n\t\t\t\t\tAnnotations: make(map[string]string),\n\t\t\t\t},\n\t\t\t\tSpec: &runapi.RevisionSpec{\n\t\t\t\t\tContainerConcurrency: int64(options.Concurrency),\n\t\t\t\t\tContainers: []*runapi.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tImage: image,\n\t\t\t\t\t\t\tEnv: envVars,\n\t\t\t\t\t\t\tResources: optionsToResourceRequirements(options),\n\t\t\t\t\t\t\tPorts: []*runapi.ContainerPort{optionsToContainerSpec(options)},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tForceSendFields: nil,\n\t\t\t\tNullFields: nil,\n\t\t\t},\n\t\t},\n\t}\n\n\tapplyMeta(svc.Metadata, image)\n\tapplyMeta(svc.Spec.Template.Metadata, image)\n\tapplyScaleMeta(svc.Spec.Template.Metadata, \"maxScale\", options.MaxInstances)\n\n\treturn svc\n}", "func NewService(c *aws.Config) (*Service, error) {\n\tsess, err := session.NewSession(c)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to create new session\")\n\t}\n\treturn &Service{ec2.New(sess)}, nil\n}", "func New(configPath string) *Aetos {\n\tcfg := loadConfig(configPath)\n\tvalidateConfig(cfg)\n\tns := initialize(cfg)\n\n\treturn &Aetos{\n\t\tcfg: cfg,\n\t\tnamespaces: ns,\n\t}\n}", "func New(c *conf.Config) (s *Service) {\n\tif c.Job.BatchNumber <= 0 {\n\t\tc.Job.BatchNumber = 2000\n\t}\n\tsearchHTTPClient = xhttp.NewClient(c.HTTPClient)\n\twardenClient := warden.DefaultClient()\n\tcc, err := wardenClient.Dial(context.Background(), \"discovery://default/season.service\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tbangumiClient := eprpc.NewEpisodeClient(cc)\n\ts = &Service{\n\t\tc: c,\n\t\tbangumiSrv: bangumiClient,\n\t\twaiter: new(sync.WaitGroup),\n\t\tsearchChan: make(chan *searchFlush, 1024),\n\t\tdataConsumer: databus.New(c.Databus.Consumer),\n\t\tlikeConsumer: databus.New(c.Databus.Like),\n\t\t//rpc\n\t\tarcSrv: arcrpc.New2(c.RPCClient2.Archive),\n\t\tarticleSrv: artrpc.New(c.RPCClient2.Article),\n\t\tassistSrv: assrpc.New(c.RPCClient2.Assist),\n\t\tmessageDao: message.NewMessageDao(c),\n\t\tsearchDao: search.New(c),\n\t\tnoticeDao: notice.New(c),\n\t\t// stat\n\t\tstatDao: stat.New(c),\n\t\t// init reply dao\n\t\tdao: reply.New(c),\n\t\t// init spam cache\n\t\tbatchNumber: c.Job.BatchNumber,\n\t\tspam: spam.NewCache(c.Redis.Config),\n\t\tnotify: fanout.New(\"cache\", fanout.Worker(1), fanout.Buffer(2048)),\n\t\ttypeMapping: make(map[int32]string),\n\t\taliasMapping: make(map[string]int32),\n\t\tes: es.NewElastic(c.Es),\n\t\tmarker: fanout.New(\"marker\", fanout.Worker(1), fanout.Buffer(1024)),\n\t}\n\taccSvc, err := accrpc.NewClient(c.AccountClient)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ts.accSrv = accSvc\n\ttime.Sleep(time.Second)\n\t_rpChs = make([]chan *databus.Message, c.Job.Proc)\n\t_likeChs = make([]chan *databus.Message, c.Job.Proc)\n\tfor i := 0; i < c.Job.Proc; i++ {\n\t\t_rpChs[i] = make(chan *databus.Message, _chLen)\n\t\t_likeChs[i] = make(chan *databus.Message, _chLen)\n\t\ts.waiter.Add(1)\n\t\tgo s.consumeproc(i)\n\t\ts.waiter.Add(1)\n\t\tgo s.consumelikeproc(i)\n\t}\n\ts.waiter.Add(1)\n\tgo s.likeConsume()\n\ts.waiter.Add(1)\n\tgo s.dataConsume()\n\n\tgo s.searchproc()\n\tgo s.mappingproc()\n\treturn\n}", "func NewServiceAnnouncement()(*ServiceAnnouncement) {\n m := &ServiceAnnouncement{\n Entity: *NewEntity(),\n }\n return m\n}", "func (u *Unmarshal) NewService() (s tenable.Service) {\n\treturn u.service(true, true)\n}", "func NewService(coreConfig *core.Config, basefs *basefs.BaseFS) *Service {\n\n\tserviceConfig := Config{}\n\tlog.Println(\"Initializing\", pname, \"service\")\n\tlog.Println(\"Source config:\", coreConfig.Source)\n\n\terr := coreutil.ParseConfig(coreConfig.Source, &serviceConfig)\n\tif err != nil {\n\t\terrlog.Fatalf(\"Unable to read <source>: %v\", err)\n\t}\n\t// Initialize cloud service here\n\tm := mega.New()\n\tm.Login(serviceConfig.Credentials.Email, serviceConfig.Credentials.Password)\n\n\treturn &Service{m, basefs}\n\n}", "func NewService(connection portainer.Connection) (*Service, error) {\n\terr := connection.SetServiceName(BucketName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Service{\n\t\tconnection: connection,\n\t}, nil\n}", "func NewService(connection portainer.Connection) (*Service, error) {\n\terr := connection.SetServiceName(BucketName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Service{\n\t\tconnection: connection,\n\t}, nil\n}", "func NewService(connection portainer.Connection) (*Service, error) {\n\terr := connection.SetServiceName(BucketName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Service{\n\t\tconnection: connection,\n\t}, nil\n}", "func NewService(connection portainer.Connection) (*Service, error) {\n\terr := connection.SetServiceName(BucketName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Service{\n\t\tconnection: connection,\n\t}, nil\n}", "func NewService() (northbound.Service, error) {\n\tdeviceStore, err := NewAtomixStore()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Service{\n\t\tstore: deviceStore,\n\t}, nil\n}", "func New(awsConfig client.ConfigProvider, logger *zap.SugaredLogger) (*Service, error) {\n\t// set up database\n\tdb, err := database.New(awsConfig, logger)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to init database: %s\", err.Error())\n\t}\n\n\t// create service\n\treturn &Service{\n\t\tl: logger.Named(\"service\"),\n\t\tdb: db,\n\t}, nil\n}", "func NewService(conf Config) Service {\n\tonce.Do(func() {\n\t\tservice = &serviceImpl{\n\t\t\tconf: conf,\n\t\t\tdeserializer: json.FactoryJSONImpl{}.GetDeserializerJSON(),\n\t\t\tserializer: json.FactoryJSONImpl{}.GetSerializerJSON(),\n\t\t\tproducerFactory: kafka.ProducerFactoryImpl{},\n\t\t\tconsumerFactory: kafka.ConsumerFactoryImpl{},\n\t\t}\n\t})\n\treturn service\n}", "func New(client client.ConfigProvider) *Service {\n\treturn &Service{\n\t\tBus: bus.New(client),\n\t\tRule: rule.New(client),\n\t}\n}", "func New(dis *discovery.Discovery) (s *Service) {\n\tvar (\n\t\tappConf = new(paladin.TOML)\n\t\tsrvConf = new(ServerConfig)\n\t\tsrvBackoff = new(ServerBackoff)\n\t\tregions map[string][]string\n\t\tinfocConf struct {\n\t\t\tStats *infoc.Config\n\t\t}\n\t\tgrpcConf struct {\n\t\t\tClient *warden.ClientConfig\n\t\t}\n\t)\n\tcheckErr(paladin.Watch(\"application.toml\", appConf))\n\tcheckErr(appConf.Get(\"server\").UnmarshalTOML(srvConf))\n\tcheckErr(appConf.Get(\"regions\").UnmarshalTOML(&regions))\n\tcheckErr(appConf.Get(\"backoff\").UnmarshalTOML(srvBackoff))\n\tcheckErr(paladin.Get(\"infoc.toml\").UnmarshalTOML(&infocConf))\n\tif err := paladin.Get(\"grpc.toml\").UnmarshalTOML(&grpcConf); err != nil {\n\t\tif err != paladin.ErrNotExist {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\tidtv1, err := identify.NewClient(grpcConf.Client, grpc.WithBalancerName(wrr.Name))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tlocConn, err := warden.NewClient(grpcConf.Client).Dial(context.Background(), \"discovery://default/location.service\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ts = &Service{\n\t\tc: appConf,\n\t\tsrvConf: srvConf,\n\t\tsrvBackoff: srvBackoff,\n\t\tdis: dis,\n\t\tdao: dao.New(),\n\t\tcache: cache.New(64, 10240),\n\t\tstats: infoc.New(infocConf.Stats),\n\t\tidentifyCli: idtv1,\n\t\tlocationCli: location.NewLocationClient(locConn),\n\t\tloadBalancer: NewLoadBalancer(),\n\t\tregions: make(map[string]string),\n\t}\n\ts.initRegions(regions)\n\ts.initServer()\n\ts.loadOnline()\n\tgo s.onlineproc()\n\treturn s\n}", "func New() *Service {\n\ts := Service{}\n\ts.app = core.New()\n\n\treturn &s\n}", "func NewService(authenticator common.Authenticator) Service {\n\treturn Service{authenticator: authenticator}\n}", "func CreateService(ctx *gin.Context) {\n\tlog := logger.RuntimeLog\n\tvar svcModel *model.Service\n\tif err := ctx.BindJSON(&svcModel); err != nil {\n\t\tSendResponse(ctx, err, \"Request Body Invalid\")\n\t}\n\n\tsvcNamespace := strings.ToLower(svcModel.SvcMeta.Namespace)\n\tsvcZone := svcModel.SvcMeta.AppMeta.ZoneName\n\tsvcName := svcModel.SvcMeta.Name\n\n\t// fetch k8s-client hander by zoneName\n\tkclient, err := GetClientByAzCode(svcZone)\n\tif err != nil {\n\t\tlog.WithError(err)\n\t\tSendResponse(ctx, errno.ErrTokenInvalid, nil)\n\t\treturn\n\t}\n\n\tstartAt := time.Now() // used to record operation time cost\n\t_, err = kclient.CoreV1().Services(svcNamespace).Create(makeupServiceData(ctx, svcModel))\n\tif err != nil {\n\t\tSendResponse(ctx, err, \"create Service fail.\")\n\t\treturn\n\t}\n\tlogger.MetricsEmit(\n\t\tSVC_CONST.K8S_LOG_Method_CreateService,\n\t\tutil.GetReqID(ctx),\n\t\tfloat32(time.Since(startAt)/time.Millisecond),\n\t\terr == err,\n\t)\n\tSendResponse(ctx, errno.OK, fmt.Sprintf(\"Create Service %s success.\", svcName))\n}", "func New() *Service {\n\treturn &Service{}\n}", "func New() *Service {\n\treturn &Service{}\n}", "func New() *Service {\n\treturn &Service{}\n}", "func newAzureMachineService(machineScope *scope.MachineScope, clusterScope *scope.ClusterScope) *azureMachineService {\n\treturn &azureMachineService{\n\t\tmachineScope: machineScope,\n\t\tclusterScope: clusterScope,\n\t\tavailabilityZonesSvc: availabilityzones.NewService(clusterScope),\n\t\tnetworkInterfacesSvc: networkinterfaces.NewService(clusterScope),\n\t\tpublicIPSvc: publicips.NewService(clusterScope),\n\t\tvirtualMachinesSvc: virtualmachines.NewService(clusterScope, machineScope),\n\t\tvirtualMachinesExtSvc: virtualmachineextensions.NewService(clusterScope),\n\t\tdisksSvc: disks.NewService(clusterScope),\n\t}\n}", "func NewService(u UUID) *Service {\n\treturn &Service{uuid: u}\n}", "func (c *agama) AddAgamaService(ctx context.Context, agama Agama) error {\n\t//fmt.Println(\"customer\")\n\terr := c.writer.AddAgama(agama)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func NewService(config Config) *Service {\n\n\treturn &Service{\n\t\tclient: NewClient(config),\n\t}\n}", "func New(s *service.Service) (engine *bm.Engine) {\n\tvar (\n\t\thc struct {\n\t\t\tServer *bm.ServerConfig\n\t\t}\n\t)\n\tif err := paladin.Get(\"http.toml\").UnmarshalTOML(&hc); err != nil {\n\t\tif err != paladin.ErrNotExist {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\tsvc = s\n\tengine = bm.DefaultServer(hc.Server)\n\tinitRouter(engine)\n\tif err := engine.Start(); err != nil {\n\t\tpanic(err)\n\t}\n\treturn\n}", "func (m *CoapFactory) New(protocol string, c core.Config, ch chan base.ServiceCommand) (base.Service, error) {\n\tvar localAddrs []string = []string{}\n\t// Get all local ip address\n\taddrs, err := net.InterfaceAddrs()\n\tif err != nil {\n\t\tglog.Errorf(\"Failed to get local address:%s\", err)\n\t\treturn nil, err\n\t}\n\tfor _, addr := range addrs {\n\t\tif ipnet, ok := addr.(*net.IPNet); ok && ipnet.IP.To4() != nil {\n\t\t\tlocalAddrs = append(localAddrs, ipnet.IP.String())\n\t\t}\n\t}\n\tif len(localAddrs) == 0 {\n\t\treturn nil, errors.New(\"Failed to get local address\")\n\t}\n\tt := &coapService{\n\t\tServiceBase: core.ServiceBase{\n\t\t\tConfig: c,\n\t\t\tQuit: ch,\n\t\t\tWaitGroup: sync.WaitGroup{},\n\t\t},\n\t\tindex: -1,\n\t\tsessions: make(map[string]base.Session),\n\t\tprotocol: 2,\n\t\tlocalAddrs: localAddrs,\n\t}\n\treturn t, nil\n}", "func New(o *Options) (Interface, error) {\n\tvar (\n\t\tregistration = o.registration()\n\t\tpath = o.path()\n\t\tserviceName = o.serviceName()\n\t\tregistrar sd.Registrar\n\t\tlogger = logging.DefaultCaller(o.logger(), \"serviceName\", o.serviceName(), \"path\", path, \"registration\", registration)\n\n\t\t// use the internal singleton factory function, which is set to zk.NewClient normally\n\t\tclient, err = zkClientFactory(\n\t\t\to.servers(),\n\t\t\tlogger,\n\t\t\tzk.ConnectTimeout(o.connectTimeout()),\n\t\t\tzk.SessionTimeout(o.sessionTimeout()),\n\t\t)\n\t)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(registration) > 0 {\n\t\tregistrar = zk.NewRegistrar(\n\t\t\tclient,\n\t\t\tzk.Service{\n\t\t\t\tPath: path,\n\t\t\t\tName: serviceName,\n\t\t\t\tData: []byte(registration),\n\t\t\t},\n\t\t\tlogger,\n\t\t)\n\t}\n\n\tlogger.Log(level.Key(), level.InfoValue(), logging.MessageKey(), \"service discovery initialized\")\n\n\treturn &zkFacade{\n\t\tlogger: logger,\n\t\tclient: client,\n\t\tpath: path,\n\t\tregistrar: registrar,\n\t}, nil\n}", "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Hybrid = NewHybridService(s)\n\ts.Organizations = NewOrganizationsService(s)\n\ts.Projects = NewProjectsService(s)\n\treturn s, nil\n}", "func NewAerospike() (as *aerospike.Client, err error) {\n\tvar target string\n\tif AerospikeFromConsulFlag.Get() {\n\t\tfor retry := 0; retry < 15; retry++ {\n\t\t\ttarget, _, err = scale.DereferenceService(\"aerospike\")\n\t\t\tif err == nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif err == scale.ErrServiceNotFound ||\n\t\t\t\tstrings.Contains(err.Error(), \"network is unreachable\") ||\n\t\t\t\tstrings.Contains(err.Error(), \"no such host\") {\n\t\t\t\ttime.Sleep(1 * time.Second)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\ttarget = AerospikeFixedAddrFlag.Get()\n\t}\n\n\tipPort := strings.Split(target, \":\")\n\tport, err := strconv.Atoi(ipPort[1])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor retry := 0; retry < 15; retry++ {\n\t\tas, err = aerospike.NewClient(ipPort[0], port)\n\t\tif err == nil {\n\t\t\treturn as, nil\n\t\t}\n\t\tif strings.Contains(err.Error(), \"Failed to connect\") {\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t\tcontinue\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn nil, err\n}", "func New() (*Agent, error) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tg, gctx := errgroup.WithContext(ctx)\n\n\tvar err error\n\ta := Agent{\n\t\tgroup: g,\n\t\tgroupCtx: gctx,\n\t\tgroupCancel: cancel,\n\t\tservices: make(map[string]services.Service),\n\t\tsignalCh: make(chan os.Signal, 10),\n\t}\n\n\terr = config.Validate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t{ // AWS\n\t\tawssvc, err := awsservice.New(a.groupCtx)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"creating AWS client\")\n\t\t}\n\t\tif awssvc.Enabled() {\n\t\t\ta.services[\"aws\"] = awssvc\n\t\t}\n\t}\n\n\t{ // Azure\n\t\tazuresvc, err := azureservice.New(a.groupCtx)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"creating Azure client\")\n\t\t}\n\t\tif azuresvc.Enabled() {\n\t\t\ta.services[\"azure\"] = azuresvc\n\t\t}\n\t}\n\n\t{ // GCP\n\t\tgcpsvc, err := gcpservice.New(a.groupCtx)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"creating GCP client\")\n\t\t}\n\t\tif gcpsvc.Enabled() {\n\t\t\ta.services[\"gcp\"] = gcpsvc\n\t\t}\n\t}\n\n\tif len(a.services) == 0 {\n\t\tlog.Fatal().Msg(\"no cloud services enabled, must enable at least ONE\")\n\t}\n\n\ta.signalNotifySetup()\n\n\treturn &a, nil\n}", "func newArborService(settings SettingsService) (ArborService, error) {\n\ts, err := func() (forest.Store, error) {\n\t\tpath := settings.DataPath()\n\t\tif err := os.MkdirAll(path, 0770); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"preparing data directory for store: %v\", err)\n\t\t}\n\t\tif settings.UseOrchardStore() {\n\t\t\to, err := orchard.Open(filepath.Join(path, \"orchard.db\"))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"opening Orchard store: %v\", err)\n\t\t\t}\n\t\t\treturn o, nil\n\t\t}\n\t\tg, err := grove.New(path)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"opening Grove store: %v\", err)\n\t\t}\n\t\tg.SetCorruptNodeHandler(func(id string) {\n\t\t\tlog.Printf(\"Grove: corrupt node %s\", id)\n\t\t})\n\t\treturn g, nil\n\t}()\n\tif err != nil {\n\t\ts = store.NewMemoryStore()\n\t}\n\tlog.Printf(\"Store: %T\\n\", s)\n\ta := &arborService{\n\t\tSettingsService: settings,\n\t\tgrove: store.NewArchive(s),\n\t\tdone: make(chan struct{}),\n\t}\n\tcl, err := ds.NewCommunityList(a.grove)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ta.cl = cl\n\texpiration.ExpiredPurger{\n\t\tLogger: log.New(log.Writer(), \"purge \", log.Flags()),\n\t\tExtendedStore: a.grove,\n\t\tPurgeInterval: time.Hour,\n\t}.Start(a.done)\n\treturn a, nil\n}", "func NewService(opts *ConfigOpts, cfg *config.TemporalConfig) (*Service, error) {\n\tta := text.NewTextAnalyzer(opts.UseChainAlgorithm)\n\tpx, err := planetary.NewPlanetaryExtractor(cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tss, err := searcher.NewService(opts.DataStorePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\timagesOpts := &images.ConfigOpts{ModelLocation: \"/tmp\"}\n\tia, err := images.NewAnalyzer(imagesOpts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Service{\n\t\tTA: ta,\n\t\tIA: ia,\n\t\tPX: px,\n\t\tSS: ss,\n\t}, nil\n}" ]
[ "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.56602085", "0.56469285", "0.564307", "0.5641296", "0.56321365", "0.562872", "0.56245786", "0.5623068", "0.5616791", "0.55957144", "0.559256", "0.5569549", "0.5560933", "0.5547613", "0.5544699", "0.5541089", "0.55369675", "0.5525745", "0.55215377", "0.55188614", "0.55094093", "0.54961646", "0.54961646", "0.54775465", "0.5473034", "0.54694337", "0.54687965", "0.5463283", "0.5451422", "0.5450867", "0.5445506", "0.5428295", "0.5427587", "0.5426878", "0.5422778", "0.5421679", "0.5421679", "0.5419353", "0.54174596", "0.5416789", "0.5416136", "0.54149127", "0.54075843", "0.53972244", "0.53972244", "0.5394455", "0.5394411", "0.5394127", "0.53934944", "0.53915876", "0.53851783", "0.5380059", "0.5374818", "0.5374818", "0.5374818", "0.5374818", "0.5373827", "0.5369504", "0.53675306", "0.53656507", "0.5358412", "0.5355883", "0.53555644", "0.53520906", "0.53492266", "0.53492266", "0.53492266", "0.53397375", "0.5338531", "0.533717", "0.5336452", "0.53264314", "0.53212166", "0.53195614", "0.531394", "0.5312957", "0.5308966", "0.5303762", "0.53014606" ]
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 errors.New(\"Cannot set filter on admin operations.\")\n}", "func (r ApiGetIqnpoolPoolMemberListRequest) Filter(filter string) ApiGetIqnpoolPoolMemberListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (r ApiGetHyperflexLocalCredentialPolicyListRequest) Filter(filter string) ApiGetHyperflexLocalCredentialPolicyListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (_ElvTradableLocal *ElvTradableLocalFilterer) FilterSetTokenURI(opts *bind.FilterOpts, tokenId []*big.Int) (*ElvTradableLocalSetTokenURIIterator, error) {\n\n\tvar tokenIdRule []interface{}\n\tfor _, tokenIdItem := range tokenId {\n\t\ttokenIdRule = append(tokenIdRule, tokenIdItem)\n\t}\n\n\tlogs, sub, err := _ElvTradableLocal.contract.FilterLogs(opts, \"SetTokenURI\", tokenIdRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ElvTradableLocalSetTokenURIIterator{contract: _ElvTradableLocal.contract, event: \"SetTokenURI\", logs: logs, sub: sub}, nil\n}", "func IdFilter(regexp string) Filter {\n\treturn Param(\"id\", regexp)\n}", "func (w *ListWidget) SetFilter(filterString string) {\n\tfilteredItems := []*expanders.TreeNode{}\n\tfor _, item := range w.items {\n\t\tif strings.Contains(strings.ToLower(item.Display), filterString) {\n\t\t\tfilteredItems = append(filteredItems, item)\n\t\t}\n\t}\n\n\tw.selected = 0\n\tw.filterString = filterString\n\tw.filteredItems = filteredItems\n\n\tw.g.Update(func(gui *gocui.Gui) error {\n\t\treturn nil\n\t})\n}", "func (r ApiGetIqnpoolPoolListRequest) Filter(filter string) ApiGetIqnpoolPoolListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (c *jsiiProxy_CfnFilter) OverrideLogicalId(newLogicalId *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"overrideLogicalId\",\n\t\t[]interface{}{newLogicalId},\n\t)\n}", "func (r ApiGetHyperflexClusterReplicationNetworkPolicyListRequest) Filter(filter string) ApiGetHyperflexClusterReplicationNetworkPolicyListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func TraceFilter(id Id) {\n\tif id < Nids {\n\t\tunfilter[id] = false\n\t} else {\n\t\tfor i, _ := range unfilter {\n\t\t\tunfilter[i] = false\n\t\t}\n\t}\n}", "func (o _GroupingObjs) FilterId(op string, p int64, ps ...int64) gmq.Filter {\n\tparams := make([]interface{}, 1+len(ps))\n\tparams[0] = p\n\tfor i := range ps {\n\t\tparams[i+1] = ps[i]\n\t}\n\treturn o.newFilter(\"id\", op, params...)\n}", "func (r ApiGetHyperflexInitiatorGroupListRequest) Filter(filter string) ApiGetHyperflexInitiatorGroupListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func SetFilter(instrs []linux.BPFInstruction) error {\n\t// PR_SET_NO_NEW_PRIVS is required in order to enable seccomp. See\n\t// seccomp(2) for details.\n\t//\n\t// PR_SET_NO_NEW_PRIVS is specific to the calling thread, not the whole\n\t// thread group, so between PR_SET_NO_NEW_PRIVS and seccomp() below we must\n\t// remain on the same thread. no_new_privs will be propagated to other\n\t// threads in the thread group by seccomp(SECCOMP_FILTER_FLAG_TSYNC), in\n\t// kernel/seccomp.c:seccomp_sync_threads().\n\truntime.LockOSThread()\n\tdefer runtime.UnlockOSThread()\n\tif _, _, errno := unix.RawSyscall6(unix.SYS_PRCTL, linux.PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0, 0); errno != 0 {\n\t\treturn errno\n\t}\n\n\tsockProg := linux.SockFprog{\n\t\tLen: uint16(len(instrs)),\n\t\tFilter: (*linux.BPFInstruction)(unsafe.Pointer(&instrs[0])),\n\t}\n\ttid, errno := seccomp(linux.SECCOMP_SET_MODE_FILTER, linux.SECCOMP_FILTER_FLAG_TSYNC, unsafe.Pointer(&sockProg))\n\tif errno != 0 {\n\t\treturn errno\n\t}\n\t// \"On error, if SECCOMP_FILTER_FLAG_TSYNC was used, the return value is\n\t// the ID of the thread that caused the synchronization failure. (This ID\n\t// is a kernel thread ID of the type returned by clone(2) and gettid(2).)\"\n\t// - seccomp(2)\n\tif tid != 0 {\n\t\treturn fmt.Errorf(\"couldn't synchronize filter to TID %d\", tid)\n\t}\n\treturn nil\n}", "func (c *cur) SetFilter(fltF model.FilterF) {\n\tc.logger.Debug(\"SetFilter (fltF == nil?): \", fltF == nil)\n\tfor _, ji := range c.its {\n\t\tji.FltF = fltF\n\t}\n}", "func (c *jsiiProxy_CfnPreset) OverrideLogicalId(newLogicalId *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"overrideLogicalId\",\n\t\t[]interface{}{newLogicalId},\n\t)\n}", "func (d *Deployer) setRootID(f *v1.FilterSpec) error {\n\tif f.RootID != \"\" {\n\t\treturn nil\n\t}\n\trootId, err := d.getRootId(f.Image)\n\tif err != nil {\n\t\treturn err\n\t}\n\tf.RootID = rootId\n\treturn nil\n}", "func RequestIDFilter(request *restful.Request, response *restful.Response, chain *restful.FilterChain) {\n\trequestID := request.Request.Header.Get(string(utils.ContextValueKeyRequestID))\n\tif len(requestID) == 0 {\n\t\trequestID = uuid.New().String()\n\t}\n\tctx := context.WithValue(request.Request.Context(), utils.ContextValueKeyRequestID, requestID)\n\trequest.Request = request.Request.WithContext(ctx)\n\tchain.ProcessFilter(request, response)\n}", "func (c *jsiiProxy_CfnIPSet) OverrideLogicalId(newLogicalId *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"overrideLogicalId\",\n\t\t[]interface{}{newLogicalId},\n\t)\n}", "func (r ApiGetIqnpoolLeaseListRequest) Filter(filter string) ApiGetIqnpoolLeaseListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (r ApiGetHyperflexProxySettingPolicyListRequest) Filter(filter string) ApiGetHyperflexProxySettingPolicyListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (client *BaseClient) SetFilter(filter ...Filter) Client {\n\tclient.filterManager.SetFilter(filter...)\n\treturn client\n}", "func (r ApiGetHyperflexFeatureLimitExternalListRequest) Filter(filter string) ApiGetHyperflexFeatureLimitExternalListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (r ApiGetHyperflexFeatureLimitInternalListRequest) Filter(filter string) ApiGetHyperflexFeatureLimitInternalListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (r ApiGetEtherPhysicalPortListRequest) Filter(filter string) ApiGetEtherPhysicalPortListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (r ApiGetResourcepoolPoolMemberListRequest) Filter(filter string) ApiGetResourcepoolPoolMemberListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func resetFilterOptions(lo *storage.LookupOptions) {\n\tlo.FilterOptions = (*filter.StorageOptions)(nil)\n}", "func (r ApiGetIqnpoolUniverseListRequest) Filter(filter string) ApiGetIqnpoolUniverseListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func ResetIPList(list []string) {\n\tIPList = list\n\tTake()\n}", "func TraceUnfilter(id Id) {\n\tif id < Nids {\n\t\tunfilter[id] = true\n\t} else {\n\t\tfor i, _ := range unfilter {\n\t\t\tunfilter[i] = true\n\t\t}\n\t}\n}", "func (_UsersData *UsersDataFilterer) FilterOnSetIdCartNoHash(opts *bind.FilterOpts) (*UsersDataOnSetIdCartNoHashIterator, error) {\n\n\tlogs, sub, err := _UsersData.contract.FilterLogs(opts, \"onSetIdCartNoHash\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &UsersDataOnSetIdCartNoHashIterator{contract: _UsersData.contract, event: \"onSetIdCartNoHash\", logs: logs, sub: sub}, nil\n}", "func (_ElvTradable *ElvTradableFilterer) FilterSetTokenURI(opts *bind.FilterOpts, tokenId []*big.Int) (*ElvTradableSetTokenURIIterator, error) {\n\n\tvar tokenIdRule []interface{}\n\tfor _, tokenIdItem := range tokenId {\n\t\ttokenIdRule = append(tokenIdRule, tokenIdItem)\n\t}\n\n\tlogs, sub, err := _ElvTradable.contract.FilterLogs(opts, \"SetTokenURI\", tokenIdRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ElvTradableSetTokenURIIterator{contract: _ElvTradable.contract, event: \"SetTokenURI\", logs: logs, sub: sub}, nil\n}", "func (r ApiGetIqnpoolReservationListRequest) Filter(filter string) ApiGetIqnpoolReservationListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (r ApiGetHyperflexDataProtectionPeerListRequest) Filter(filter string) ApiGetHyperflexDataProtectionPeerListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func RandomFilterOffsetMapID(b *testing.B, numLinks, i int) *store.SegmentFilter {\n\treturn &store.SegmentFilter{\n\t\tPagination: store.Pagination{\n\t\t\tOffset: rand.Int() % numLinks,\n\t\t\tLimit: store.DefaultLimit,\n\t\t},\n\t\tMapIDs: []string{fmt.Sprintf(\"%d\", i%10)},\n\t}\n}", "func (d *Daemon) SetPrefilter(preFilter datapath.PreFilter) {\n\td.preFilter = preFilter\n}", "func (m *SharepointIds) SetListId(value *string)() {\n err := m.GetBackingStore().Set(\"listId\", value)\n if err != nil {\n panic(err)\n }\n}", "func (r ApiGetHyperflexServiceAuthTokenListRequest) Filter(filter string) ApiGetHyperflexServiceAuthTokenListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (r ApiGetHyperflexUcsmConfigPolicyListRequest) Filter(filter string) ApiGetHyperflexUcsmConfigPolicyListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (api *PrivateStorageHostManagerAPI) SetFilterMode(fm string, hostInfos []enode.ID) (resp string, err error) {\n\tvar filterMode FilterMode\n\tif filterMode, err = ToFilterMode(fm); err != nil {\n\t\terr = fmt.Errorf(\"failed to set the filter mode: %s\", err.Error())\n\t\treturn\n\t}\n\n\tif err = api.shm.SetFilterMode(filterMode, hostInfos); err != nil {\n\t\terr = fmt.Errorf(\"failed to set the filter mode: %s\", err.Error())\n\t\treturn\n\t}\n\n\tresp = fmt.Sprintf(\"the filter mode has been successfully set to %s\", fm)\n\treturn\n}", "func ApplyFilter(u *task.List, f func(uint64, int) bool) {\n\tout := u.Uids[:0]\n\tfor i, uid := range u.Uids {\n\t\tif f(uid, i) {\n\t\t\tout = append(out, uid)\n\t\t}\n\t}\n\tu.Uids = out\n}", "func (r ApiGetHyperflexClusterReplicationNetworkPolicyDeploymentListRequest) Filter(filter string) ApiGetHyperflexClusterReplicationNetworkPolicyDeploymentListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (r ApiGetHyperflexNodeConfigPolicyListRequest) Filter(filter string) ApiGetHyperflexNodeConfigPolicyListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (r ApiGetHyperflexHxdpVersionListRequest) Filter(filter string) ApiGetHyperflexHxdpVersionListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (o *GetLogicalPortParams) SetLportID(lportID string) {\n\to.LportID = lportID\n}", "func (c AccountFiltersClient) preparerForAccountFiltersList(ctx context.Context, id MediaServiceId) (*http.Request, error) {\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": defaultApiVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(c.baseUri),\n\t\tautorest.WithPath(fmt.Sprintf(\"%s/accountFilters\", id.ID())),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "func (m *SharepointIds) SetListItemId(value *string)() {\n err := m.GetBackingStore().Set(\"listItemId\", value)\n if err != nil {\n panic(err)\n }\n}", "func initList(myId id) []id {\n\tvar MembershipList []id\n\tMembershipList = append(MembershipList, myId)\n\treturn MembershipList\n}", "func (c *jsiiProxy_CfnRegistryPolicy) OverrideLogicalId(newLogicalId *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"overrideLogicalId\",\n\t\t[]interface{}{newLogicalId},\n\t)\n}", "func (m *AuthenticationListener) SetSourceFilter(value AuthenticationSourceFilterable)() {\n err := m.GetBackingStore().Set(\"sourceFilter\", value)\n if err != nil {\n panic(err)\n }\n}", "func (client *RecommendationsClient) resetAllFiltersCreateRequest(ctx context.Context, options *RecommendationsClientResetAllFiltersOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-03-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func setDeviceFilter(handle *pcap.Handle, filterIP string, filterPort uint16) error {\n\tvar bpfFilter = \"tcp\"\n\tif filterPort != 0 {\n\t\tbpfFilter += \" port \" + strconv.Itoa(int(filterPort))\n\t}\n\tif filterIP != \"\" {\n\t\tbpfFilter += \" ip host \" + filterIP\n\t}\n\treturn handle.SetBPFFilter(bpfFilter)\n}", "func setDeviceFilter(handle *pcap.Handle, filterIP string, filterPort uint16) error {\n\tvar bpfFilter = \"tcp\"\n\tif filterPort != 0 {\n\t\tbpfFilter += \" port \" + strconv.Itoa(int(filterPort))\n\t}\n\tif filterIP != \"\" {\n\t\tbpfFilter += \" ip host \" + filterIP\n\t}\n\treturn handle.SetBPFFilter(bpfFilter)\n}", "func (r ApiGetHyperflexClusterNetworkPolicyListRequest) Filter(filter string) ApiGetHyperflexClusterNetworkPolicyListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (r ApiGetHyperflexVcenterConfigPolicyListRequest) Filter(filter string) ApiGetHyperflexVcenterConfigPolicyListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (c *jsiiProxy_CfnMember) OverrideLogicalId(newLogicalId *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"overrideLogicalId\",\n\t\t[]interface{}{newLogicalId},\n\t)\n}", "func SETPL(mr operand.Op) { ctx.SETPL(mr) }", "func (client *RecommendationsClient) resetAllFiltersCreateRequest(ctx context.Context, options *RecommendationsResetAllFiltersOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-02-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func IDFilter(ID interface{}) Filter {\n\treturn Filter{\"id\": ID}\n}", "func (filterdev *NetworkTap) SetFilter(i []syscall.BpfInsn) error {\n\tvar p syscall.BpfProgram\n\tp.Len = uint32(len(i))\n\tp.Insns = (*syscall.BpfInsn)(unsafe.Pointer(&i[0]))\n\t_, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(filterdev.device.Fd()), syscall.BIOCSETF, uintptr(unsafe.Pointer(&p)))\n\tif err != 0 {\n\t\treturn syscall.Errno(err)\n\t}\n\treturn nil\n}", "func (r ApiGetHyperflexVmImportOperationListRequest) Filter(filter string) ApiGetHyperflexVmImportOperationListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (h *Handle) setFilter() error {\n\t/*\n\t * Try to install the kernel filter.\n\t */\n\tprog := BpfProgram{\n\t\tLen: uint16(len(h.filter)),\n\t\tFilter: (*bpf.RawInstruction)(unsafe.Pointer(&h.filter[0])),\n\t}\n\tif err := ioctlPtr(h.fd, syscall.BIOCSETF, unsafe.Pointer(&prog)); err != nil {\n\t\treturn fmt.Errorf(\"unable to set filter: %v\", err)\n\t}\n\n\treturn nil\n}", "func (s *server) MFilter(ctx context.Context, req *v1.MFilterReq) (*v1.MFilterReply, error) {\n\tres, err := s.svr.RPCMultiFilter(ctx, req.Area, req.MsgMap, req.TypeId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treplys := make(map[string]*v1.FilterReply)\n\tfor k, v := range res {\n\t\tr := &v1.FilterReply{\n\t\t\tResult: v.Result,\n\t\t\tLevel: int32(v.Level),\n\t\t\tLimit: int64(v.Limit),\n\t\t}\n\t\treplys[k] = r\n\t}\n\treturn &v1.MFilterReply{\n\t\tRMap: replys,\n\t}, nil\n}", "func UIDFilter() hador.FilterFunc {\n\treturn func(ctx *hador.Context, next hador.Handler) {\n\t\tuid, err := ctx.Params().GetInt(\"user-id\")\n\t\tif err != nil {\n\t\t\tctx.OnError(http.StatusBadRequest, err)\n\t\t\treturn\n\t\t}\n\t\tctx.Set(\"user-id\", uid)\n\t\tdefer ctx.Delete(\"user-id\")\n\n\t\tnext.Serve(ctx)\n\t}\n}", "func (c *jsiiProxy_CfnPublicRepository) OverrideLogicalId(newLogicalId *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"overrideLogicalId\",\n\t\t[]interface{}{newLogicalId},\n\t)\n}", "func (r ApiGetResourcepoolPoolListRequest) Filter(filter string) ApiGetResourcepoolPoolListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (l *Libvirt) NwfilterUndefine(OptNwfilter Nwfilter) (err error) {\n\tvar buf []byte\n\n\targs := NwfilterUndefineArgs {\n\t\tOptNwfilter: OptNwfilter,\n\t}\n\n\tbuf, err = encode(&args)\n\tif err != nil {\n\t\treturn\n\t}\n\n\n\t_, err = l.requestStream(181, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (msf *ModuleSetFlag) Set(str string) (err error) {\n\tmsf.identifiers.identifiers = nil // reset identifiers\n\tfor _, id := range str {\n\t\t// append all module identifiers in the given order\n\t\terr = msf.AppendModuleIdentifier(ModuleIdentifier(id))\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\treturn msf.availableModules.ValidateIdentifierSet(msf.identifiers)\n}", "func (r ApiGetEtherNetworkPortListRequest) Filter(filter string) ApiGetEtherNetworkPortListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (r ApiGetIqnpoolBlockListRequest) Filter(filter string) ApiGetIqnpoolBlockListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func SetFilterInChild(instrs []linux.BPFInstruction) unix.Errno {\n\tif _, _, errno := unix.RawSyscall6(unix.SYS_PRCTL, linux.PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0, 0); errno != 0 {\n\t\treturn errno\n\t}\n\n\tsockProg := linux.SockFprog{\n\t\tLen: uint16(len(instrs)),\n\t\tFilter: (*linux.BPFInstruction)(unsafe.Pointer(&instrs[0])),\n\t}\n\ttid, errno := seccomp(linux.SECCOMP_SET_MODE_FILTER, linux.SECCOMP_FILTER_FLAG_TSYNC, unsafe.Pointer(&sockProg))\n\tif errno != 0 {\n\t\treturn errno\n\t}\n\tif tid != 0 {\n\t\t// Return an errno that seccomp(2) doesn't to uniquely identify this\n\t\t// case. Since this case occurs if another thread has a conflicting\n\t\t// filter set, \"name not unique on network\" is at least suggestive?\n\t\treturn unix.ENOTUNIQ\n\t}\n\treturn 0\n}", "func (w *ListWidget) ClearFilter() {\n\tw.filterString = \"\"\n}", "func (h *afpacketHandle) SetBPFFilter(filter string, snaplen int) (err error) {\n\tpcapBPF, err := pcap.CompileBPFFilter(layers.LinkTypeEthernet, snaplen, filter)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbpfIns := []bpf.RawInstruction{}\n\tfor _, ins := range pcapBPF {\n\t\tbpfIns2 := bpf.RawInstruction{\n\t\t\tOp: ins.Code,\n\t\t\tJt: ins.Jt,\n\t\t\tJf: ins.Jf,\n\t\t\tK: ins.K,\n\t\t}\n\t\tbpfIns = append(bpfIns, bpfIns2)\n\t}\n\tif h.TPacket.SetBPF(bpfIns); err != nil {\n\t\treturn err\n\t}\n\treturn h.TPacket.SetBPF(bpfIns)\n}", "func (o *ExtrasSavedFiltersListParams) SetIDn(iDn *string) {\n\to.IDn = iDn\n}", "func (c *jsiiProxy_CfnStackSet) OverrideLogicalId(newLogicalId *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"overrideLogicalId\",\n\t\t[]interface{}{newLogicalId},\n\t)\n}", "func (_ERC721Contract *ERC721ContractFilterer) FilterMint(opts *bind.FilterOpts, _to []common.Address, _tokenId []*big.Int) (*ERC721ContractMintIterator, error) {\n\n\tvar _toRule []interface{}\n\tfor _, _toItem := range _to {\n\t\t_toRule = append(_toRule, _toItem)\n\t}\n\tvar _tokenIdRule []interface{}\n\tfor _, _tokenIdItem := range _tokenId {\n\t\t_tokenIdRule = append(_tokenIdRule, _tokenIdItem)\n\t}\n\n\tlogs, sub, err := _ERC721Contract.contract.FilterLogs(opts, \"Mint\", _toRule, _tokenIdRule)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ERC721ContractMintIterator{contract: _ERC721Contract.contract, event: \"Mint\", logs: logs, sub: sub}, nil\n}", "func (c *jsiiProxy_CfnDataflowEndpointGroup) OverrideLogicalId(newLogicalId *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"overrideLogicalId\",\n\t\t[]interface{}{newLogicalId},\n\t)\n}", "func (r ApiGetBulkMoDeepClonerListRequest) Filter(filter string) ApiGetBulkMoDeepClonerListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (c *jsiiProxy_CfnMLTransform) OverrideLogicalId(newLogicalId *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"overrideLogicalId\",\n\t\t[]interface{}{newLogicalId},\n\t)\n}", "func (c *jsiiProxy_CfnProfilingGroup) OverrideLogicalId(newLogicalId *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"overrideLogicalId\",\n\t\t[]interface{}{newLogicalId},\n\t)\n}", "func setNonPrimitiveParams(params *CmdLineParams) {\n\n\tif params.StartDateStr != \"\" {\n\t\tparams.StartDate = parseDate(params.StartDateStr)\n\t}\n\n\tif params.EndDateStr != \"\" {\n\t\tparams.EndDate = parseDate(params.EndDateStr)\n\t} else {\n\t\tparams.EndDate = time.Now()\n\t}\n\n\tif params.FilterFpr != \"\" {\n\t\tfprs := strings.Split(params.FilterFpr, \",\")\n\t\tfor _, fpr := range fprs {\n\t\t\tparams.Filter.AddFingerprint(tor.Fingerprint(fpr))\n\t\t}\n\t}\n\n\tif params.FilterAddr != \"\" {\n\t\taddrs := strings.Split(params.FilterAddr, \",\")\n\t\tfor _, addr := range addrs {\n\t\t\tparams.Filter.AddIPAddr(net.ParseIP(addr))\n\t\t}\n\t}\n\n\tif params.FilterNickname != \"\" {\n\t\tnicks := strings.Split(params.FilterNickname, \",\")\n\t\tfor _, nick := range nicks {\n\t\t\tparams.Filter.AddNickname(nick)\n\t\t}\n\t}\n\n\tlog.Printf(\"Object filter is empty: %t\", params.Filter.IsEmpty())\n}", "func (r ApiGetHyperflexSysConfigPolicyListRequest) Filter(filter string) ApiGetHyperflexSysConfigPolicyListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (r ApiGetHyperflexVmRestoreOperationListRequest) Filter(filter string) ApiGetHyperflexVmRestoreOperationListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (umm *UpdateManyModel) SetFilter(filter interface{}) *UpdateManyModel {\n\tumm.Filter = filter\n\treturn umm\n}", "func FilterPoolIDs(entries *csp.CSPList, opts []buildOption) ([]string, error) {\n\tplist, err := Filter(entries, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn plist.GetPoolUIDs(), nil\n}", "func (piu *ProviderIDUpdate) SetNillableParticpantID(id *string) *ProviderIDUpdate {\n\tif id != nil {\n\t\tpiu = piu.SetParticpantID(*id)\n\t}\n\treturn piu\n}", "func NewPLMNID(mcc, mnc string) *IE {\n\tencoded, err := utils.EncodePLMN(mcc, mnc)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\treturn New(PLMNID, 0x00, encoded)\n}", "func (l *Logger) SetFilter(f Filter) {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\tl.filter = f\n}", "func SetWhitelist(w []string) {\n\tfor _, v := range w {\n\t\twhitelist[v] = nil\n\t}\n\n\tif len(whitelist) > 0 {\n\t\tenableWhitelist = true\n\t}\n}", "func (r ApiGetResourcepoolLeaseListRequest) Filter(filter string) ApiGetResourcepoolLeaseListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (c *jsiiProxy_CfnLayer) OverrideLogicalId(newLogicalId *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"overrideLogicalId\",\n\t\t[]interface{}{newLogicalId},\n\t)\n}", "func RandomFilterOffsetMapIDs(b *testing.B, numLinks, i int) *store.SegmentFilter {\n\treturn &store.SegmentFilter{\n\t\tPagination: store.Pagination{\n\t\t\tOffset: rand.Int() % numLinks,\n\t\t\tLimit: store.DefaultLimit,\n\t\t},\n\t\tMapIDs: []string{fmt.Sprintf(\"%d\", i%10), fmt.Sprintf(\"%d\", (i+1)%10)},\n\t}\n}", "func ResetIPSetEntries() {\n\tnumIPSetEntries.Set(0)\n\tfor setName := range ipsetInventoryMap {\n\t\tremoveFromIPSetInventory(setName)\n\t}\n\tipsetInventoryMap = make(map[string]int)\n}", "func (r ApiGetHyperflexServerModelListRequest) Filter(filter string) ApiGetHyperflexServerModelListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (pu *PatientrecordUpdate) SetNillablePrenameID(id *int) *PatientrecordUpdate {\n\tif id != nil {\n\t\tpu = pu.SetPrenameID(*id)\n\t}\n\treturn pu\n}", "func (c *jsiiProxy_CfnModuleVersion) OverrideLogicalId(newLogicalId *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"overrideLogicalId\",\n\t\t[]interface{}{newLogicalId},\n\t)\n}", "func (c *jsiiProxy_CfnRegistry) OverrideLogicalId(newLogicalId *string) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"overrideLogicalId\",\n\t\t[]interface{}{newLogicalId},\n\t)\n}", "func (r ApiGetHyperflexHealthCheckPackageChecksumListRequest) Filter(filter string) ApiGetHyperflexHealthCheckPackageChecksumListRequest {\n\tr.filter = &filter\n\treturn r\n}", "func (pre *preRoundTracker) FilterSet(set *Set) {\n\tfor bid := range set.values {\n\t\tif !pre.CanProveValue(bid) { // not enough witnesses\n\t\t\tset.Remove(bid)\n\t\t}\n\t}\n}" ]
[ "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.4602001", "0.45988262", "0.45874006", "0.45698974", "0.45682397", "0.4561975", "0.45525885", "0.45273814", "0.45248082", "0.45169714", "0.45028636", "0.4495711", "0.44936383", "0.44825116", "0.44789308", "0.44726405", "0.44542128", "0.4450591", "0.44432583", "0.44412735", "0.4424269", "0.44192708", "0.4416152", "0.4416102", "0.4412897", "0.44084468", "0.44028232", "0.44002604", "0.43995792", "0.43781042", "0.43750763", "0.43742862", "0.43697357", "0.43697357", "0.43695745", "0.43662712", "0.43596673", "0.4342914", "0.43415806", "0.43339938", "0.4333071", "0.43199185", "0.43191725", "0.43180835", "0.43160596", "0.43123406", "0.43061078", "0.42965677", "0.429619", "0.4288434", "0.42871824", "0.42846394", "0.42831478", "0.42743686", "0.42704484", "0.42647856", "0.42634538", "0.42602944", "0.42498356", "0.42463952", "0.42431387", "0.42424458", "0.42346933", "0.42221695", "0.42152858", "0.42142665", "0.42139566", "0.4207016", "0.42045188", "0.42020628", "0.41987222", "0.41954005", "0.41921276", "0.4187798", "0.4186214", "0.41748163", "0.41665298", "0.41625175", "0.41613477", "0.41589096" ]
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) IsPmpid() bool { return me.String() == \"pmpid\" }", "func (i *IE) PLMNID() (string, error) {\n\tif i.Type != PLMNID {\n\t\treturn \"\", &InvalidTypeError{Type: i.Type}\n\t}\n\tif len(i.Payload) < 3 {\n\t\treturn \"\", io.ErrUnexpectedEOF\n\t}\n\n\tmcc, mnc, err := utils.DecodePLMN(i.Payload)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn mcc + mnc, nil\n}", "func (me TArtIdTypeUnion2) IsPmcpid() bool { return me.String() == \"pmcpid\" }", "func (i identity) pidValid() bool {\n\treturn rePID.MatchString(i.PID)\n}", "func (a FirewallExclusions) CheckByMOID(moid string) bool {\n\tfor _, member := range a.Members {\n\t\tif member.MOID == moid {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (_TTFT20 *TTFT20Caller) IsMintID(opts *bind.CallOpts, _txid string) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _TTFT20.contract.Call(opts, out, \"isMintID\", _txid)\n\treturn *ret0, err\n}", "func checkInList(id string, legacyID string, list []string) bool {\n\tfor _, codeIgnored := range list {\n\t\tif codeIgnored == id || codeIgnored == legacyID {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (m *PlmnIdentity) Validate() error {\n\treturn m.validate(false)\n}", "func NewPLMNID(mcc, mnc string) *IE {\n\tencoded, err := utils.EncodePLMN(mcc, mnc)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\treturn New(PLMNID, 0x00, encoded)\n}", "func (me TAttlistELocationIDEIdType) IsPii() bool { return me.String() == \"pii\" }", "func (req LoginReq) Check() error {\n\tif _, err := ulid.Parse(req.ID); err != nil {\n\t\treturn errors.ErrInvalidField{Field: \"id\", Value: req.ID}\n\t}\n\treturn nil\n}", "func (me TAttlistOtherIDSource) IsNlm() bool { return me.String() == \"NLM\" }", "func (o *EquipmentFanModule) GetModuleIdOk() (*int64, bool) {\n\tif o == nil || o.ModuleId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ModuleId, true\n}", "func (me TisoLanguageCodes) IsPl() bool { return me.String() == \"PL\" }", "func ClaimInListExistsP(exec boil.Executor, iD uint64) bool {\n\te, err := ClaimInListExists(exec, iD)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "func (me TArtIdTypeUnion4) IsPmc() bool { return me.String() == \"pmc\" }", "func IsMalicious(db sql.Executor, nodeID types.NodeID) (bool, error) {\n\trows, err := db.Exec(\"select 1 from identities where pubkey = ?1;\",\n\t\tfunc(stmt *sql.Statement) {\n\t\t\tstmt.BindBytes(1, nodeID.Bytes())\n\t\t}, nil)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"is malicious %v: %w\", nodeID, err)\n\t}\n\treturn rows > 0, nil\n}", "func CheckPID(kind, pid string) CheckFn {\n\treturn func(logger LogFn) error {\n\t\tp, err := gql.SearchProjectID(pid, true)\n\t\tif err != nil {\n\t\t\tlogger(\"Project could not be found! Error:\", err)\n\t\t\treturn err\n\t\t}\n\t\tnotFound := func() error {\n\t\t\tlogger(\"%q project could nont be found!\", kind)\n\t\t\treturn errors.ErrProjNotFound\n\t\t}\n\t\tswitch kind {\n\t\tcase \"image\":\n\t\tcase \"meta\":\n\t\t\tif p.IsImported {\n\t\t\t\treturn notFound()\n\t\t\t}\n\t\tcase \"model\":\n\t\t\tif !p.IsImported {\n\t\t\t\treturn notFound()\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n}", "func (me TArtIdTypeUnion1) IsPii() bool { return me.String() == \"pii\" }", "func (me TpubStatusInt) IsPmc() bool { return me.String() == \"pmc\" }", "func (_TTFT20 *TTFT20CallerSession) IsMintID(_txid string) (bool, error) {\n\treturn _TTFT20.Contract.IsMintID(&_TTFT20.CallOpts, _txid)\n}", "func (o *EquipmentFanModule) HasModuleId() bool {\n\tif o != nil && o.ModuleId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (g GoldDiffStoreMapper) IsValidImgID(imgID string) bool {\n\treturn validation.IsValidDigest(imgID)\n}", "func (r *PackageAggRow) HasValidID() bool { return r.Data.ID != nil }", "func Checkidavailable(c *gin.Context) {\r\n\r\n\tvar resp models.Response\r\n\tid := c.Params.ByName(\"id\")\r\n\tif id != \"\" {\r\n\t\tp, err := models.Askdata()\r\n\t\tif err != nil {\r\n\t\t\tc.AbortWithStatus(http.StatusInternalServerError)\r\n\t\t} else {\r\n\t\t\tfor _, val := range p {\r\n\t\t\t\tif val.Id == id {\r\n\t\t\t\t\tresp.Message = \"The Customer ID exists ,Try a different one\"\r\n\t\t\t\t\tbreak\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif resp.Message == \"\" {\r\n\t\t\t\tresp.Message = \"The Customer ID is available\"\r\n\t\t\t}\r\n\t\t\tc.JSON(http.StatusOK, resp)\r\n\t\t}\r\n\t} else {\r\n\t\tresp.Message = \"enter a Customer ID to check\"\r\n\t\tc.JSON(http.StatusOK, resp)\r\n\t}\r\n}", "func RecipeLipidExists(ctx context.Context, exec boil.ContextExecutor, iD int) (bool, error) {\n\tvar exists bool\n\tsql := \"select exists(select 1 from \\\"recipe_lipid\\\" where \\\"id\\\"=$1 limit 1)\"\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, iD)\n\t}\n\trow := exec.QueryRowContext(ctx, sql, iD)\n\n\terr := row.Scan(&exists)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: unable to check if recipe_lipid exists\")\n\t}\n\n\treturn exists, nil\n}", "func (p Passport) checkPid() bool {\n\tpid := *p.pid\n\tif len(pid) > 9 {\n\t\treturn false\n\t}\n\tmatch, _ := regexp.MatchString(\"[0-9]{9}\", pid)\n\n\tif !match {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (me TartIdTypeInt) IsPmcbook() bool { return me.String() == \"pmcbook\" }", "func (r *ProductRow) HasValidID() bool { return r.Data.ID != nil }", "func (o *EquipmentIoCardBase) GetModuleIdOk() (*int64, bool) {\n\tif o == nil || o.ModuleId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ModuleId, true\n}", "func (o *IamUserPreferenceAllOf) HasIdp() bool {\n\tif o != nil && o.Idp != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m MarketDataRequestReject) HasMDReqID() bool {\n\treturn m.Has(tag.MDReqID)\n}", "func checkIfValid(p Passport) bool {\n\tif !intBetween(1920, 2002, p.Byr) {\n\t\treturn false\n\t}\n\tif !intBetween(2010, 2020, p.Iyr) {\n\t\treturn false\n\t}\n\tif !intBetween(2020, 2030, p.Eyr) {\n\t\treturn false\n\t}\n\tif len(p.Pid) != 9 {\n\t\treturn false\n\t}\n\n\t_, err := strconv.Atoi(p.Pid)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tif !(p.Ecl == \"amb\" || p.Ecl == \"blu\" || p.Ecl == \"brn\" || p.Ecl == \"gry\" || p.Ecl == \"grn\" || p.Ecl == \"hzl\" || p.Ecl == \"oth\") {\n\t\treturn false\n\t}\n\tif !checkHeight(p.Hgt) {\n\t\treturn false\n\t}\n\tif !checkHair(p.Hcl) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (p *passportData) isPassportIDValid() bool {\n\treturn len(p.passportID) == 9 && regexp.MustCompile(`^[0-9]{9}$`).MatchString(p.passportID)\n}", "func (_TTFT20 *TTFT20Session) IsMintID(_txid string) (bool, error) {\n\treturn _TTFT20.Contract.IsMintID(&_TTFT20.CallOpts, _txid)\n}", "func (g GoldDiffStoreMapper) IsValidImgID(imgID string) bool {\n\tif strings.HasPrefix(imgID, GS_PREFIX) {\n\t\treturn ValidGCSImageID(imgID)\n\t}\n\treturn validation.IsValidDigest(imgID)\n}", "func isRootKeyFiltered(id string) bool {\n\tselectedRootKeyId := os.Getenv(\"NOTARY_LUNA_ROOT_KEY\")\n\tif selectedRootKeyId != \"\" && selectedRootKeyId != id {\n\t\treturn true\n\t}\n\treturn false\n}", "func (o *LocalDatabaseProvider) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func isFoundationIDInList(foundationSFID string, projectsSFIDs []string) bool {\n\tfor _, projectSFID := range projectsSFIDs {\n\t\tif projectSFID == foundationSFID {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (o *WorkflowServiceItemActionInstance) HasIdp() bool {\n\tif o != nil && o.Idp != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func dataSourceIBMIsLbPoolMembersID(d *schema.ResourceData) string {\n\treturn time.Now().UTC().String()\n}", "func (o *EtherHostPort) GetModuleIdOk() (*int64, bool) {\n\tif o == nil || o.ModuleId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ModuleId, true\n}", "func CheckWhitelist(ipString string, whitelistedCountry []string) (bool, error) {\n\twhitelisted := false\n\tcountry, err := GetCountryData(ipString)\n\tif err != nil {\n\t\tLog(log.ErrorLevel, err.Error(), flag.Lookup(\"test.v\") == nil)\n\t\treturn whitelisted, err\n\t}\n\tfor _, v := range whitelistedCountry {\n\t\tif strings.ToUpper(v) == strings.ToUpper(country.Name) {\n\t\t\twhitelisted = true\n\t\t}\n\t}\n\treturn whitelisted, nil\n}", "func isULID(fl FieldLevel) bool {\n\treturn uLIDRegex.MatchString(fl.Field().String())\n}", "func (api *ProductServerAPI) IsValidPlan(core int, memGB int) (bool, error) {\n\n\tplanID, err := api.getPlanIDBySpec(core, memGB)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tproductServer, err := api.Read(planID)\n\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif productServer != nil {\n\t\treturn true, nil\n\t}\n\n\treturn false, fmt.Errorf(\"Server Plan[%d] Not Found\", planID)\n\n}", "func (me TAttlistOtherIDSource) IsArpl() bool { return me.String() == \"ARPL\" }", "func (me TpubStatusInt) IsPmcr() bool { return me.String() == \"pmcr\" }", "func Valid(id string) bool {\n\treturn Validate(id) != nil\n}", "func checkIsIBMCloud(client client.Client) (bool, error) {\n\tnodes := &corev1.NodeList{}\n\terr := client.List(context.TODO(), nodes)\n\tif err != nil {\n\t\tlog.Error(err, \"failed to get nodes list\")\n\t\treturn false, err\n\t}\n\tif len(nodes.Items) == 0 {\n\t\tlog.Error(err, \"failed to list any nodes\")\n\t\treturn false, nil\n\t}\n\n\tproviderID := nodes.Items[0].Spec.ProviderID\n\tif strings.Contains(providerID, \"ibm\") {\n\t\treturn true, nil\n\t}\n\n\treturn false, nil\n}", "func (o *LocalDatabaseProvider) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func ClaimInListExists(exec boil.Executor, iD uint64) (bool, error) {\n\tvar exists bool\n\tsql := \"select exists(select 1 from `claim_in_list` where `id`=? limit 1)\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, iD)\n\t}\n\n\trow := exec.QueryRow(sql, iD)\n\n\terr := row.Scan(&exists)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"model: unable to check if claim_in_list exists\")\n\t}\n\n\treturn exists, nil\n}", "func (o *EquipmentIoCardBase) HasModuleId() bool {\n\tif o != nil && o.ModuleId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (n PidMode) Valid() bool {\n\treturn n == \"\" || n.IsHost() || validContainer(string(n))\n}", "func IllnessExists(ctx context.Context, exec boil.ContextExecutor, illnessID int) (bool, error) {\n\tvar exists bool\n\tsql := \"select exists(select 1 from \\\"illness\\\" where \\\"illness_id\\\"=$1 limit 1)\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, illnessID)\n\t}\n\n\trow := exec.QueryRowContext(ctx, sql, illnessID)\n\n\terr := row.Scan(&exists)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: unable to check if illness exists\")\n\t}\n\n\treturn exists, nil\n}", "func (gt GtwyMgr) IsPermitted(ctx context.Context, appcontext, remoteAddress string) (bool, error) {\n\tif EnvDebugOn {\n\t\tlblog.LogEvent(\"GtwyMgr\", \"IsPermitted\", \"info\", \"start\")\n\t}\n\n\t//check the approval list\n\tq := datastore.NewQuery(gt.bc.GetConfigValue(ctx, \"EnvGtwayDsKind\")).\n\t\tNamespace(gt.bc.GetConfigValue(ctx, \"EnvGtwayDsNamespace\")).\n\t\tFilter(\"appcontext =\", appcontext).\n\t\tFilter(\"remoteaddress =\", remoteAddress).\n\t\tKeysOnly()\n\n\t//get the count\n\tn, err := gt.ds.Count(ctx, q)\n\t//if there was an error return it and false\n\tif err != nil {\n\t\tif err != datastore.ErrNoSuchEntity {\n\t\t\treturn false, err\n\t\t}\n\t\treturn false, nil\n\t}\n\n\t//return false if the count was zero\n\tif n == 0 {\n\t\treturn false, nil\n\t}\n\n\tif EnvDebugOn {\n\t\tlblog.LogEvent(\"GtwyMgr\", \"IsPermitted\", \"info\", strconv.Itoa(n))\n\t\tlblog.LogEvent(\"GtwyMgr\", \"IsPermitted\", \"info\", \"end\")\n\t}\n\n\t//otherwise the address is valid\n\treturn true, nil\n}", "func (idMap *IdentityMap) CheckIdentity(id string, login map[string]string) error {\n\tfor name, pattern := range *idMap {\n\t\tif !pattern.MatchString(id) {\n\t\t\tcontinue\n\t\t}\n\n\t\tlogin[name] = id\n\t\tlogin[\"type\"] = \"account\"\n\t\tlogin[\"verifyCode\"] = \"\"\n\n\t\treturn nil\n\t}\n\n\treturn ErrIdentity\n}", "func (me TAttlistKeywordListOwner) IsNlm() bool { return me.String() == \"NLM\" }", "func (context *context) IsSOLM(t Token) bool {\n\treturn whisper.Token(t.Id) == context.model.ctx.Whisper_token_solm()\n}", "func checkId(id string) bool {\n\tidExists := false\n\tfor i := 0; i < len(_struct.IDs); i++ {\n\t\tif _struct.IDs[i] == strings.ToUpper(id) {\n\t\t\tidExists = true\n\t\t\tbreak\n\t\t}\n\t}\n\treturn idExists\n}", "func IsMPTValid(mpt MerklePatriciaTrieI) error {\n\treturn mpt.Iterate(context.TODO(), func(ctxt context.Context, path Path, key Key, node Node) error { return nil }, NodeTypeLeafNode|NodeTypeFullNode|NodeTypeExtensionNode)\n}", "func (id ID) Valid() bool {\n\treturn id >= MinID && id <= MaxID\n}", "func CheckMatchesLabletoPolicy(c client.Client, labels map[string]string,\n\tnamespace string) (string, bool) {\n\tmatches := false\n\tvar snatPolicyName string\n\tsnatPolicyList := &aciv1.SnatPolicyList{}\n\tif err := c.List(context.TODO(), &client.ListOptions{Namespace: \"\"}, snatPolicyList); err != nil {\n\t\treturn snatPolicyName, matches\n\t}\n\tfor _, item := range snatPolicyList.Items {\n\t\tif item.Status.State != aciv1.Ready {\n\t\t\tcontinue\n\t\t}\n\t\tif MatchLabels(item.Spec.Selector.Labels, labels) {\n\t\t\tlog.Info(\"Matches\", \"Labels: \", item.Spec.Selector.Labels)\n\t\t\tif item.Spec.Selector.Namespace != \"\" && item.Spec.Selector.Namespace == namespace {\n\t\t\t\tmatches = true\n\t\t\t\tsnatPolicyName = item.ObjectMeta.Name\n\t\t\t\tbreak\n\t\t\t} else if item.Spec.Selector.Namespace == \"\" {\n\t\t\t\tmatches = true\n\t\t\t\tsnatPolicyName = item.ObjectMeta.Name\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn snatPolicyName, matches\n}", "func (p Passport) checkIyr() bool {\n\tif len(*p.iyr) != 4 {\n\t\treturn false\n\t}\n\ti, err := strconv.Atoi(*p.iyr)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tif i < 2010 || i > 2020 {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func weaponIDIsBlacklisted(weaponID int) bool {\n\tfor _, wid := range weaponIDBlacklist {\n\t\tif weaponID == wid {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func InitIPWhitelist(cfg *types.RPC) {\r\n\tif len(cfg.Whitelist) == 0 && len(cfg.Whitlist) == 0 {\r\n\t\tremoteIPWhitelist[\"127.0.0.1\"] = true\r\n\t\treturn\r\n\t}\r\n\tif len(cfg.Whitelist) == 1 && cfg.Whitelist[0] == \"*\" {\r\n\t\tremoteIPWhitelist[\"0.0.0.0\"] = true\r\n\t\treturn\r\n\t}\r\n\tif len(cfg.Whitlist) == 1 && cfg.Whitlist[0] == \"*\" {\r\n\t\tremoteIPWhitelist[\"0.0.0.0\"] = true\r\n\t\treturn\r\n\t}\r\n\tif len(cfg.Whitelist) != 0 {\r\n\t\tfor _, addr := range cfg.Whitelist {\r\n\t\t\tremoteIPWhitelist[addr] = true\r\n\t\t}\r\n\t\treturn\r\n\t}\r\n\tif len(cfg.Whitlist) != 0 {\r\n\t\tfor _, addr := range cfg.Whitlist {\r\n\t\t\tremoteIPWhitelist[addr] = true\r\n\t\t}\r\n\t\treturn\r\n\t}\r\n\r\n}", "func (ctx *TestContext) IHaveValidatedItemWithID(item string) error {\n\treturn ctx.UserHaveValidatedItemWithID(ctx.user, item)\n}", "func IsIDValid(id string) bool {\n\tif _, err := ulid.Parse(id); err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "func (o *StorageExternalParityGroupAllOf) HasMpBladeId() bool {\n\tif o != nil && o.MpBladeId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func InitIPWhitelist(cfg *types.RPC) {\n\tif len(cfg.Whitelist) == 0 && len(cfg.Whitlist) == 0 {\n\t\tremoteIPWhitelist[\"127.0.0.1\"] = true\n\t\treturn\n\t}\n\tif len(cfg.Whitelist) == 1 && cfg.Whitelist[0] == \"*\" {\n\t\tremoteIPWhitelist[\"0.0.0.0\"] = true\n\t\treturn\n\t}\n\tif len(cfg.Whitlist) == 1 && cfg.Whitlist[0] == \"*\" {\n\t\tremoteIPWhitelist[\"0.0.0.0\"] = true\n\t\treturn\n\t}\n\tif len(cfg.Whitelist) != 0 {\n\t\tfor _, addr := range cfg.Whitelist {\n\t\t\tremoteIPWhitelist[addr] = true\n\t\t}\n\t\treturn\n\t}\n\tif len(cfg.Whitlist) != 0 {\n\t\tfor _, addr := range cfg.Whitlist {\n\t\t\tremoteIPWhitelist[addr] = true\n\t\t}\n\t\treturn\n\t}\n\n}", "func (db *DBNonRealtional) CheckDatabaseProjectId() error {\n\tif db.ProjectId == \"\" {\n\t\treturn errors.New(\"ProjectId not valid.\")\n\t}\n\treturn nil\n}", "func dataSourceIBMIsSecurityGroupRulesID(d *schema.ResourceData) string {\n\treturn time.Now().UTC().String()\n}", "func (o *StorageSpaceAllOf) GetLdevIdOk() (*string, bool) {\n\tif o == nil || o.LdevId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.LdevId, true\n}", "func (id ID) Valid() error {\n\treturn validate.OneOf(\"LimitID\", id,\n\t\tNotificationRulesPerUser,\n\t\tContactMethodsPerUser,\n\t\tEPStepsPerPolicy,\n\t\tEPActionsPerStep,\n\t\tParticipantsPerRotation,\n\t\tRulesPerSchedule,\n\t\tIntegrationKeysPerService,\n\t\tUnackedAlertsPerService,\n\t\tTargetsPerSchedule,\n\t\tHeartbeatMonitorsPerService,\n\t\tUserOverridesPerSchedule,\n\t)\n}", "func (id GID) Valid() bool {\n\treturn len(id) == 12\n}", "func (l *ipCheckerServer) CheckIp(ctx context.Context, ipMesg *checker.IP) (resp *checker.Response, err error) {\n\tisAllowed := false\n\tresp = &checker.Response{}\n\tresp.IsBlacklisted = true\n\n\tlog.Printf(\"CheckIP: %#v\", ipMesg)\n\tif isAllowed, err = lookup(ipMesg, resp); isAllowed && err == nil {\n\t\tlog.Println(\"Not blacklisted: \", err)\n\t\tresp.IsBlacklisted = false\n\t\treturn\n\t}\n\tlog.Println(\"Not allowed: \", err)\n\tlog.Print(ipMesg.Countries)\n\treturn\n}", "func (c *Config) IsKMIP() bool { return c.Provider == TypeKMIP }", "func (o *StorageHitachiVolumeMigrationPair) HasPvolLdevId() bool {\n\tif o != nil && o.PvolLdevId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func validateMultiIPForDonorIntf(d *db.DB, ifName *string) bool {\n\n\ttables := [2]string{\"INTERFACE\", \"PORTCHANNEL_INTERFACE\"}\n\tdonor_intf := false\n\tlog.Info(\"validateMultiIPForDonorIntf : intfName\", ifName)\n\tfor _, table := range tables {\n\t\tintfTble, err := d.GetTable(&db.TableSpec{Name:table})\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tintfKeys, err := intfTble.GetKeys()\n\t\tfor _, intfName := range intfKeys {\n\t\t\tintfEntry, err := d.GetEntry(&db.TableSpec{Name: table}, intfName)\n\t\t\tif(err != nil) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tunnumbered, ok := intfEntry.Field[\"unnumbered\"]\n\t\t\tif ok {\n\t\t\t\tif unnumbered == *ifName {\n\t\t\t\t\tdonor_intf = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif donor_intf {\n\t\tloIntfTble, err := d.GetTable(&db.TableSpec{Name:\"LOOPBACK_INTERFACE\"})\n\t\tif err != nil {\n\t\t\tlog.Info(\"Table read error : return false\")\n\t\t\treturn false\n\t\t}\n\n\t\tloIntfKeys, err := loIntfTble.GetKeys()\n\t\tfor _, loIntfName := range loIntfKeys {\n\t\t\tif len(loIntfName.Comp) > 1 && strings.Contains(loIntfName.Comp[0], *ifName){\n\t\t\t\tif strings.Contains(loIntfName.Comp[1], \".\") {\n\t\t\t\t\tlog.Info(\"Multi IP exists\")\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn false\n}", "func (p *PlayoutID) ValidateToken(token string) (bool, error) {\n\ttok := []sql.NullString{}\n\terr := p.DB.DB.Select(&tok, `\n\t\tSELECT playout.token AS token\n\t\tFROM playout\n\t\tWHERE playout.id = ?\n\t`, p.ID)\n\tif err != nil {\n\t\treturn false, errors.Wrapf(err, \"Failed Select\")\n\t}\n\tif len(tok) < 1 {\n\t\treturn false, errors.New(\"Missing Playout\")\n\t}\n\treturn tok[0].String == token, nil\n}", "func (r *RegisterMonitor) checkID() string {\n\treturn fmt.Sprintf(\"%s-ttl\", r.serviceID())\n}", "func IsValidPid(val string) bool {\n\treturn pidPattern.MatchString(val)\n}", "func CheckPreRelID(id string) error {\n\tif numericOnlyRE.MatchString(id) {\n\t\tif !goodNumericRE.MatchString(id) {\n\t\t\treturn errors.New(\"the Pre-Rel ID: '\" + id +\n\t\t\t\t\"' must have no leading zero if it's all numeric\")\n\t\t}\n\t\treturn nil\n\t}\n\tif !idRE.MatchString(id) {\n\t\treturn errors.New(\"the Pre-Rel ID: '\" + id + \"' must be \" + GoodIDDesc)\n\t}\n\treturn nil\n}", "func (a *AbuseIPDB) IsOK() bool {\n\treturn a.Data.TotalReports == 0 || a.Data.IsWhitelisted || a.Data.AbuseConfidenceScore <= 25\n}", "func ClaimInListExistsGP(iD uint64) bool {\n\te, err := ClaimInListExists(boil.GetDB(), iD)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn e\n}", "func (r Restrictions) VerifyForOther(tx *sqlx.Tx, ip string, id mtid.MTID) bool {\n\tif len(r) == 0 {\n\t\treturn true\n\t}\n\treturn len(r.GetValidForOther(tx, ip, id)) > 0\n}", "func IsWhiteListed(number string, allowed *[]string) bool {\n\tfor _, n := range *allowed {\n\t\tif n == number {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func isIDExist(currentArticles Articles, reqID string) (bool, string) {\n\tfor idx, article := range currentArticles {\n\t\tif article.ArticleID == reqID {\n\t\t\treturn true, strconv.Itoa(idx)\n\t\t}\n\t}\n\treturn false, \"not exist\"\n}", "func (ipuc IsPrivilegedUserCheck) Check() (warnings, errorList []error) {\n\terrorList = []error{}\n\n\tresult, err := ipuc.CombinedOutput(\"id -u\")\n\tif err != nil {\n\t\terrorList = append(errorList, err)\n\t\treturn\n\t}\n\tuid, err := strconv.Atoi(strings.TrimSpace(string(result)))\n\tif err != nil {\n\t\terrorList = append(errorList, err)\n\t\treturn\n\t}\n\n\tif uid != 0 {\n\t\terrorList = append(errorList, errors.New(\"user is not running as root\"))\n\t}\n\n\treturn nil, errorList\n}", "func checkObjectID(whichObject string, theID int) (bool, string) {\n\tidReturned := false\n\treturnedError := \"\"\n\tswitch whichObject {\n\tcase \"Player\":\n\t\t//Search Mongo to see if ID appears\n\t\tplayerCollection := mongoClient.Database(\"learningdb\").Collection(\"players\") //Here's our collection\n\t\tvar thePlayer Player\n\t\t//Give 0 values to determine if these IDs are found\n\t\ttheFilter := bson.M{\n\t\t\t\"$or\": []interface{}{\n\t\t\t\tbson.M{\"UserID\": theID},\n\t\t\t},\n\t\t}\n\t\ttheErr := playerCollection.FindOne(theContext, theFilter).Decode(&thePlayer)\n\t\tif theErr != nil {\n\t\t\tif strings.Contains(theErr.Error(), \"no documents in result\") {\n\t\t\t\tidReturned = false //No ID found, it's good to use\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"DEBUG: We have another error for finding a unique UserID: \\n%v\\n\", theErr)\n\t\t\t\terrMessage := \"Another error for finding unique player ID: \" + theErr.Error()\n\t\t\t\treturnedError = errMessage\n\t\t\t\tlogWriter(errMessage)\n\t\t\t\tidReturned = true\n\t\t\t}\n\t\t}\n\t\tbreak\n\tdefault:\n\t\terrMessage := \"DEBUG: Error determining whichObject in checkObjectID, wrong whichObject: \" + whichObject\n\t\treturnedError = errMessage\n\t\tfmt.Printf(errMessage)\n\t\tlogWriter(errMessage)\n\t\tidReturned = true\n\t}\n\n\treturn idReturned, returnedError\n}", "func aclFilter(direction string, externalIDs map[string]string) func(acl *ovnnb.ACL) bool {\n\treturn func(acl *ovnnb.ACL) bool {\n\t\tif len(acl.ExternalIDs) < len(externalIDs) {\n\t\t\treturn false\n\t\t}\n\n\t\tif len(acl.ExternalIDs) != 0 {\n\t\t\tfor k, v := range externalIDs {\n\t\t\t\t// if only key exist but not value in externalIDs, we should include this lsp,\n\t\t\t\t// it's equal to shell command `ovn-nbctl --columns=xx find acl external_ids:key!=\\\"\\\"`\n\t\t\t\tif len(v) == 0 {\n\t\t\t\t\tif len(acl.ExternalIDs[k]) == 0 {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif acl.ExternalIDs[k] != v {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif len(direction) != 0 && acl.Direction != direction {\n\t\t\treturn false\n\t\t}\n\n\t\treturn true\n\t}\n}", "func IsValidMSP(mspID string, msps map[string]msp.MSP) bool {\n\tif mspID == implicitpolicy.ImplicitOrg {\n\t\treturn true\n\t}\n\n\t_, ok := msps[mspID]\n\treturn ok\n}", "func (me TAttlistGeneralNoteOwner) IsNlm() bool { return me.String() == \"NLM\" }", "func GetPlmnIdAndSupiFromSuci(buf []byte) (plmnId, supi string) {\n\n\tsupiFormat := (buf[0] & 0xf0) >> 4\n\n\tvar prefix string\n\n\tswitch supiFormat {\n\tcase 0x00: // imsi\n\t\tprefix = \"imsi-\"\n\tcase 0x01: // Network Specific Identifier\n\t\tprefix = \"nai-\"\n\tdefault: // All other values are interpreted as IMSI by this version of the protocol\n\t\tprefix = \"imsi-\"\n\t}\n\n\t// TODO: process Network Specific Identifier\n\n\tplmnId = PlmnIDToString(buf[1:4])\n\n\tvar tmpBytes []byte\n\tif buf[6] == 0x00 { // protectionSchemeID is \"Null scheme\"\n\t\tfor _, rawMsin := range buf[8:] {\n\t\t\tdata := ((rawMsin & 0x0f) << 4) | ((rawMsin & 0xf0) >> 4)\n\t\t\ttmpBytes = append(tmpBytes, uint8(data))\n\t\t}\n\t}\n\n\tmsin := hex.EncodeToString(tmpBytes)\n\tif msin[len(msin)-1] == 'f' {\n\t\tmsin = msin[:len(msin)-1] // cut unused digit\n\t}\n\n\tsupi = prefix + plmnId + msin\n\treturn\n}", "func (ch Int32Check) Check(item int32) (bool, error) { return ch(item) }", "func (o *LinkPublicIpRequest) HasVmId() bool {\n\tif o != nil && o.VmId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func validateL3ConfigExists(d *db.DB, ifName *string) error {\n intfType, _, ierr := getIntfTypeByName(*ifName)\n if intfType == IntfTypeUnset || ierr != nil {\n return errors.New(\"Invalid interface type IntfTypeUnset\");\n }\n intTbl := IntfTypeTblMap[intfType]\n IntfMap, _ := d.GetMapAll(&db.TableSpec{Name:intTbl.cfgDb.intfTN+\"|\"+*ifName})\n if IntfMap.IsPopulated() {\n errStr := \"L3 Configuration exists for Interface: \" + *ifName\n log.Error(errStr)\n return tlerr.InvalidArgsError{Format:errStr}\n }\n return nil\n}", "func checkAppidLock(appid string, logId int64) bool {\n\tconn := initDbConn(logId)\n\tdefer conn.Close()\n\tsqlc := \"select count(*) from appidActLock where appid = '\" + appid + \"'\"\n\trows, errc := conn.Query(sqlc)\n\tif errc != nil {\n\t\taddErrorLog(logId, \"check appid if locked error:\", errc)\n\t\treturn false\n\t}\n\tvar appnum int\n\tfor rows.Next() {\n\t\tif err := rows.Scan(&appnum); err == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\tif appnum > 0 {\n\t\taddLog(logId, \"The appid has already locked!\", appid)\n\t\treturn false\n\t}\n\n\treturn true\n}" ]
[ "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.4592283", "0.45044896", "0.45038325", "0.44950655", "0.4464205", "0.4438194", "0.44213873", "0.44206628", "0.44124693", "0.44104403", "0.4405601", "0.43995678", "0.43986878", "0.43785077", "0.43783468", "0.43654457", "0.43378365", "0.43303573", "0.4328551", "0.43155727", "0.42844975", "0.42538", "0.42501712", "0.4238358", "0.4235743", "0.4226027", "0.42249188", "0.42244697", "0.42229596", "0.42178938", "0.42161208", "0.42111447", "0.4203827", "0.4203152", "0.41921824", "0.41835055", "0.41815996", "0.41792536", "0.41732097", "0.4170198", "0.41681477", "0.41666535", "0.41520512", "0.41445512", "0.413693", "0.41368842", "0.4135012", "0.4129185", "0.41247696", "0.41241172", "0.4121384", "0.41182575", "0.411757", "0.4110825", "0.4100087", "0.40996882", "0.40971354", "0.40917084", "0.40889457", "0.40873918", "0.408493", "0.40824103", "0.40754002", "0.40731192", "0.40689984", "0.40673158", "0.40668198", "0.40617204", "0.4061205", "0.40419814", "0.40403438", "0.40401214", "0.40384653", "0.40365377", "0.4035395", "0.4033754", "0.40336064", "0.40323007", "0.40272722", "0.4026138" ]
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, \"unlock\", token, partner, transferred_amount, expiration, amount, secret_hash, merkle_proof)\n}", "func (il *internalLocker) Unlock(ctx context.Context) error {\n\tif err := il.mu.Unlock(ctx); err != nil {\n\t\tlog.Logger.Error(err)\n\t\treturn err\n\t}\n\n\treturn il.session.Close()\n}", "func (_LockProxy *LockProxyTransactor) Unlock(opts *bind.TransactOpts, argsBs []byte, fromContractAddr []byte, fromChainId uint64) (*types.Transaction, error) {\n\treturn _LockProxy.contract.Transact(opts, \"unlock\", argsBs, fromContractAddr, fromChainId)\n}", "func (t *trivial) Unlock() {\n\tt.c <- struct{}{}\n}", "func (c *crdLock) Unlock(ctx context.Context) error {\n\treturn nil\n}", "func Unlock() {\n\t// TO DO\n}", "func (_LockProxy *LockProxyTransactorSession) Unlock(argsBs []byte, fromContractAddr []byte, fromChainId uint64) (*types.Transaction, error) {\n\treturn _LockProxy.Contract.Unlock(&_LockProxy.TransactOpts, argsBs, fromContractAddr, fromChainId)\n}", "func (om *Sdk) Unlock() error {\n\tom.logger.Println(\"decrypting Ops Manager\")\n\n\tunlockReq := UnlockRequest{om.creds.DecryptionPhrase}\n\tbody, err := json.Marshal(&unlockReq)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = om.api.Curl(api.RequestServiceCurlInput{\n\t\tPath: \"/api/v0/unlock\",\n\t\tMethod: \"PUT\",\n\t\tData: bytes.NewReader(body),\n\t})\n\n\treturn err\n}", "func (_LockProxy *LockProxySession) Unlock(argsBs []byte, fromContractAddr []byte, fromChainId uint64) (*types.Transaction, error) {\n\treturn _LockProxy.Contract.Unlock(&_LockProxy.TransactOpts, argsBs, fromContractAddr, fromChainId)\n}", "func (tm *TabletManager) unlock() {\n\ttm.actionSema.Release(1)\n}", "func (_TokensNetwork *TokensNetworkTransactorSession) Unlock(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.Unlock(&_TokensNetwork.TransactOpts, token, partner, transferred_amount, expiration, amount, secret_hash, merkle_proof)\n}", "func (l *etcdLock) Unlock() {\n\tif l.cancel != nil {\n\t\tl.cancel()\n\t}\n}", "func (w *xcWallet) Unlock(crypter encrypt.Crypter) error {\n\tif w.isDisabled() { // cannot unlock disabled wallet.\n\t\treturn fmt.Errorf(walletDisabledErrStr, strings.ToUpper(unbip(w.AssetID)))\n\t}\n\tif w.parent != nil {\n\t\treturn w.parent.Unlock(crypter)\n\t}\n\tif !w.connected() {\n\t\treturn errWalletNotConnected\n\t}\n\n\ta, is := w.Wallet.(asset.Authenticator)\n\tif !is {\n\t\treturn nil\n\t}\n\n\tif len(w.encPW()) == 0 {\n\t\tif a.Locked() {\n\t\t\treturn fmt.Errorf(\"wallet reporting as locked, but no password has been set\")\n\t\t}\n\t\treturn nil\n\t}\n\tpw, err := crypter.Decrypt(w.encPW())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%s unlockWallet decryption error: %w\", unbip(w.AssetID), err)\n\t}\n\terr = a.Unlock(pw) // can be slow - no timeout and NOT in the critical section!\n\tif err != nil {\n\t\treturn err\n\t}\n\tw.mtx.Lock()\n\tw.pw = pw\n\tw.mtx.Unlock()\n\treturn nil\n}", "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\tlog.L.Error(\"store: failed to unlock context: %v\", err)\n\t\treturn\n\t} else if locked {\n\t\tlog.L.Error(\"store: failed to unlock store context: the calling session is not the session which holds the lock!\")\n\t\treturn\n\t}\n\n\t// Unlock the lock.\n\terr = dbUnlock(id)\n\tif err != nil {\n\t\tlog.L.Error(\"store: failed to unlock context: %v\", err)\n\t\treturn\n\t}\n\n\t// Broadcast changes to other sessions in edit mode.\n\tbroadcastChangedContext(id, session)\n}", "func (_TokensNetwork *TokensNetworkSession) Unlock(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.Unlock(&_TokensNetwork.TransactOpts, token, partner, transferred_amount, expiration, amount, secret_hash, merkle_proof)\n}", "func (m mysqlDialect) Unlock(ctx context.Context, tx Queryer, tableName string) error {\n\tlockID := m.advisoryLockID(tableName)\n\tquery := fmt.Sprintf(`SELECT RELEASE_LOCK('%s')`, lockID)\n\t_, err := tx.ExecContext(ctx, query)\n\treturn err\n}", "func (m *InMemManager) Unlock(_ context.Context, token string) error {\n\tm.rw.RLock()\n\trw, ok := m.acqu[token]\n\tm.rw.RUnlock()\n\n\tif ok {\n\t\trw.Unlock()\n\t}\n\n\treturn nil\n}", "func (u unlocker) Unlock() error {\n\tkvp, meta, err := u.session.client.KV().Get(u.key, nil)\n\tif err != nil {\n\t\treturn NewKVError(\"get\", u.key, err)\n\t}\n\tif kvp == nil {\n\t\treturn nil\n\t}\n\tif kvp.Session != u.session.session {\n\t\treturn AlreadyLockedError{Key: u.key}\n\t}\n\n\tsuccess, _, err := u.session.client.KV().DeleteCAS(&api.KVPair{\n\t\tKey: u.key,\n\t\tModifyIndex: meta.LastIndex,\n\t}, nil)\n\tif err != nil {\n\t\treturn NewKVError(\"deletecas\", u.key, err)\n\t}\n\tif !success {\n\t\t// the key has been mutated since we checked it - probably someone\n\t\t// overrode our lock on it or deleted it themselves\n\t\treturn AlreadyLockedError{Key: u.key}\n\t}\n\treturn nil\n}", "func Unlock() {\n\tmutex.Unlock()\n}", "func (wt *Wallet) Unlock(passphrase []byte, lock <-chan time.Time) error {\n\tlog.Trace(\"wallet Unlock\")\n\terr := make(chan error, 1)\n\twt.unlockRequests <- unlockRequest{\n\t\tpassphrase: passphrase,\n\t\tlockAfter: lock,\n\t\terr: err,\n\t}\n\tlog.Trace(\"wallet Unlock end\")\n\treturn <-err\n}", "func Unlock() {\n\tlock.Unlock()\n}", "func (s *service) Unlock(ctx context.Context, req *provider.UnlockRequest) (*provider.UnlockResponse, error) {\n\tref, _, _, st, err := s.translatePublicRefToCS3Ref(ctx, req.Ref)\n\tswitch {\n\tcase err != nil:\n\t\treturn nil, err\n\tcase st != nil:\n\t\treturn &provider.UnlockResponse{\n\t\t\tStatus: st,\n\t\t}, nil\n\t}\n\tgatewayClient, err := s.gatewaySelector.Next()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn gatewayClient.Unlock(ctx, &provider.UnlockRequest{Opaque: req.Opaque, Ref: ref, Lock: req.Lock})\n}", "func (p postgresDialect) Unlock(ctx context.Context, tx Queryer, tableName string) error {\n\tlockID := p.advisoryLockID(tableName)\n\tquery := fmt.Sprintf(\"SELECT pg_advisory_unlock(%s)\", lockID)\n\t_, err := tx.ExecContext(ctx, query)\n\treturn err\n}", "func (l *Lock) Unlock(ctx context.Context) (err error) {\n\tl.logger.Debug(\"node %s unlocking consul lock\", l.id)\n\n\tif l.stop != nil {\n\t\tl.logger.Debug(\"node %s sending message to lock abort channel\", l.id)\n\t\tgo func() { l.stop <- struct{}{} }()\n\t}\n\tif l.cc != nil {\n\t\tl.logger.Debug(\"node %s sending message to close channel\", l.id)\n\t\tgo func() { l.cc <- struct{}{} }()\n\t}\n\n\tif err = l.lock.Unlock(); err != nil {\n\t\tif err == api.ErrLockNotHeld {\n\t\t\terr = nil\n\t\t\treturn\n\t\t}\n\t\tl.logger.Error(\"node %s failed to unlock consul lock: %s\", l.id, err)\n\t\treturn\n\t}\n\n\tl.logger.Debug(\"node %s unlocked consul lock\", l.id)\n\treturn\n}", "func (channelTree *ChannelTree) Unlock() {\n\tchannelTree.mutex.Unlock()\n}", "func (l *Lock) Unlock(ctx context.Context) error {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\n\tconn, err := l.Pool.GetContext(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer conn.Close()\n\tif l.token == nil {\n\t\tl.token = randomToken()\n\t}\n\n\treply, err := redis.Int(unlockScript.Do(conn, l.Key, l.token))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif reply != 1 {\n\t\treturn ErrNotHeld\n\t}\n\tl.token = nil\n\treturn nil\n}", "func (c *CycleState) Unlock() {\n\tc.mx.Unlock()\n}", "func (w *Wallet) Unlock(passphrase []byte, lock <-chan time.Time) er.R {\n\terr := make(chan er.R, 1)\n\tw.unlockRequests <- unlockRequest{\n\t\tpassphrase: passphrase,\n\t\tlockAfter: lock,\n\t\terr: err,\n\t}\n\treturn <-err\n}", "func (c Mutex) Unlock() {\n\tselect {\n\tcase c.ch <- struct{}{}:\n\tdefault:\n\t\tpanic(\"unlock on unlocked mutex\")\n\t}\n}", "func (s *VCStore) Unlock(token string) error {\n\treturn s.state.ItemUnlock(Lock, token)\n}", "func Unlock(ctx context.Context, lockContext, lockID string) {\n\tgetLock(ctx, lockID).Unlock()\n\tLogc(ctx).WithField(\"lock\", lockID).Debugf(\"Released shared lock (%s).\", lockContext)\n}", "func (l *lock) Unlock() error {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\n\tif !l.locked {\n\t\treturn fmt.Errorf(\"attempted to unlock when no lock has been acquired\")\n\t}\n\tif l.tx == nil {\n\t\treturn fmt.Errorf(\"attempted to unlock but no transaction is populdated in scanLock\")\n\t}\n\n\t// commiting the transaction will free the pg_advisory lock allowing other\n\t// instances utilizing a lock to proceed\n\terr := l.tx.Commit()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to commit transaction and free lock: %v\", err)\n\t}\n\tl.locked = false\n\n\treturn nil\n}", "func (self *Conn) Unlock() {\n\tif self.mainloop != nil && self.isLocked {\n\t\tC.pa_threaded_mainloop_unlock(self.mainloop)\n\t\tself.isLocked = false\n\t}\n}", "func (s *SharedState) unlock() {\n s.mutex.Unlock()\n}", "func (dcr *ExchangeWallet) Unlock(pw string) error {\n\treturn translateRPCCancelErr(dcr.node.WalletPassphrase(dcr.ctx, pw, int64(time.Duration(math.MaxInt64)/time.Second)))\n}", "func (t *TrudyPipe) Unlock() {\n\tt.userMutex.Unlock()\n}", "func (r *Request) Unlock(ctx context.Context, token string) error {\n\tif _, ok := r.wLocks[token]; !ok {\n\t\treturn nil\n\t}\n\n\terr := r.m.Unlock(ctx, token)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdelete(r.wLocks, token)\n\n\treturn nil\n}", "func (lock *ALock) Unlock() {\n\tslot := atomic.LoadInt32(&lock.slot)\n\tlock.Flags[(slot+1)%lock.nThreads] = true\n}", "func (f *volatileFile) Unlock(lock C.int) C.int {\n\tf.mu.Lock()\n\tdefer f.mu.Unlock()\n\n\tswitch lock {\n\tcase C.SQLITE_LOCK_NONE:\n\t\tf.none--\n\tcase C.SQLITE_LOCK_SHARED:\n\t\tf.shared--\n\tcase C.SQLITE_LOCK_RESERVED:\n\t\tf.reserved--\n\tcase C.SQLITE_LOCK_PENDING:\n\t\tf.pending--\n\tcase C.SQLITE_LOCK_EXCLUSIVE:\n\t\tf.exclusive--\n\tdefault:\n\t\treturn C.SQLITE_ERROR\n\t}\n\n\treturn C.SQLITE_OK\n}", "func (cs *ConsulStorage) Unlock(_ context.Context, key string) error {\n\t// check if we own it and unlock\n\tlock, exists := cs.GetLock(key)\n\tif !exists {\n\t\treturn errors.Errorf(\"lock %s not found\", cs.prefixKey(key))\n\t}\n\n\terr := lock.Unlock()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"unable to unlock %s\", cs.prefixKey(key))\n\t}\n\n\tcs.muLocks.Lock()\n\tdelete(cs.locks, key)\n\tcs.muLocks.Unlock()\n\n\treturn nil\n}", "func (btc *ExchangeWallet) Unlock(pw string, dur time.Duration) error {\n\treturn btc.wallet.Unlock(pw, dur)\n}", "func (nc *NexusConn) Unlock(lock string) (bool, error) {\n\tpar := ei.M{\n\t\t\"lock\": lock,\n\t}\n\tres, err := nc.Exec(\"sync.unlock\", par)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn ei.N(res).M(\"ok\").BoolZ(), nil\n}", "func (li *localLockInstance) Unlock() {\n\treadLock := false\n\tli.ns.unlock(li.volume, li.path, li.opsID, readLock)\n}", "func (el *Lock) Unlock() error {\n\treturn el.Delete(el.key())\n}", "func (b *baseKVStoreBatch) Unlock() {\n\tb.mutex.Unlock()\n}", "func (b *baseKVStoreBatch) Unlock() {\n\tb.mutex.Unlock()\n}", "func (r *RedisDL) Unlock() error {\n\tr.m.Lock()\n\tdefer r.m.Unlock()\n\treturn r.deleteToken()\n}", "func (c *ChannelBucket) Unlock() {\n\tc.mutex.Unlock()\n}", "func (e *Enumerate) unlock() {\n\te.u.m.Unlock()\n}", "func (l *Locker) Unlock(ctx context.Context, key string) error {\n\tl.init.Do(l.getState)\n\tentryNotExist := fmt.Sprintf(\"attribute_not_exists(%s)\", l.state.tableKey)\n\towned := \"nodeId = :nodeId\"\n\n\tdynamoKey := map[string]*dynamodb.AttributeValue{}\n\tdynamoKey[l.state.tableKey] = &dynamodb.AttributeValue{S: aws.String(key)}\n\treq := &dynamodb.DeleteItemInput{\n\t\tKey: dynamoKey,\n\t\tConditionExpression: aws.String(fmt.Sprintf(\"(%s) OR (%s)\", entryNotExist, owned)),\n\t\tExpressionAttributeValues: map[string]*dynamodb.AttributeValue{\n\t\t\t\":nodeId\": &dynamodb.AttributeValue{S: aws.String(l.state.nodeID)},\n\t\t},\n\t\tTableName: aws.String(l.state.tableName),\n\t}\n\t_, err := l.state.db.DeleteItemWithContext(ctx, req)\n\tif err != nil {\n\t\tif awserr, ok := err.(awserr.Error); ok {\n\t\t\tif awserr.Code() == \"ConditionalCheckFailedException\" {\n\t\t\t\t// Either the lock didn't exist or it's owned by someone else\n\t\t\t\treturn fmt.Errorf(\"Key '%s' does not exist or is locked by another node.\", key)\n\t\t\t} else {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (cb *cachedBatch) Unlock() {\n\tcb.lock.Unlock()\n}", "func (cb *cachedBatch) Unlock() {\n\tcb.lock.Unlock()\n}", "func (l *lock) Unlock() error {\n\treturn l.file.Close()\n}", "func (l *Lock) Unlock() {\n\tselect {\n\tcase <-l.ch:\n\tdefault:\n\t\tpanic(\"unlock called when not locked\")\n\t}\n}", "func (g *glock) Unlock() {\n\tdefer func() {\n\t\t// Cancel the context when this returns\n\t\tif g.cancel != nil {\n\t\t\tg.cancel()\n\t\t\tg.cancel = nil\n\t\t}\n\t}()\n\tif !g.locked {\n\t\t// Called Unlock without actually having the lock,\n\t\t// do nothing or risk overriding someone else's lock\n\t\treturn\n\t}\n\tdefer g.mt.Unlock()\n\tg.waiting = false\n\n\tfor {\n\t\t// ensure the lock is ours\n\t\tkv, err := g.gok.Get(context.Background(), g.key)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Sanity check, that the lock is ours\n\t\tif string(kv.Value) != \"locked_\"+g.processID {\n\t\t\treturn\n\t\t}\n\n\t\terr = g.gok.Set(context.Background(), g.key, []byte(\"unlocked\"))\n\t\tif err == nil {\n\t\t\tg.locked = false\n\t\t\treturn\n\t\t}\n\t}\n}", "func unlockTrans(multiport bool, portConfig int) {\n\tif multiport && portConfig >= 0 && portConfig < 128 {\n\t\tmultiportTransLock[portConfig].Unlock()\n\t} else {\n\t\ttransLock.Unlock()\n\t}\n}", "func (tl Noop) Unlock(_ types.JobID, targets []*target.Target) error {\n\tlog.Infof(\"Unlocked %d targets by doing nothing\", len(targets))\n\treturn nil\n}", "func Unlock(client *gophercloud.ServiceClient, id string) (r UnlockResult) {\n\t_, r.Err = client.Post(actionURL(client, id), map[string]interface{}{\"unlock\": nil}, nil, nil)\n\treturn\n}", "func (m *Mutex) Unlock() {\n\t<-m.in\n}", "func Unlock(client *gophercloud.ServiceClient, id string) (r UnlockResult) {\n\t_, r.Err = client.Post(extensions.ActionURL(client, id), map[string]interface{}{\"unlock\": nil}, nil, nil)\n\treturn\n}", "func (w *Wrapper) Unlock(tableNames ...string) (err error) {\n\terr = w.RawQuery(\"UNLOCK TABLES\")\n\treturn\n}", "func checkKeyspaceLockUnblocks(t *testing.T, ts topo.Server) {\n\tunblock := make(chan struct{})\n\tfinished := make(chan struct{})\n\n\t// as soon as we're unblocked, we try to lock the keyspace\n\tgo func() {\n\t\t<-unblock\n\t\tctx := context.Background()\n\t\tlockPath, err := ts.LockKeyspaceForAction(ctx, \"test_keyspace\", \"fake-content\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"LockKeyspaceForAction(test_keyspace) failed: %v\", err)\n\t\t}\n\t\tif err = ts.UnlockKeyspaceForAction(\"test_keyspace\", lockPath, \"fake-results\"); err != nil {\n\t\t\tt.Errorf(\"UnlockKeyspaceForAction(test_keyspace): %v\", err)\n\t\t}\n\t\tclose(finished)\n\t}()\n\n\t// lock the keyspace\n\tctx := context.Background()\n\tlockPath2, err := ts.LockKeyspaceForAction(ctx, \"test_keyspace\", \"fake-content\")\n\tif err != nil {\n\t\tt.Fatalf(\"LockKeyspaceForAction(test_keyspace) failed: %v\", err)\n\t}\n\n\t// unblock the go routine so it starts waiting\n\tclose(unblock)\n\n\t// sleep for a while so we're sure the go routine is blocking\n\ttime.Sleep(timeUntilLockIsTaken)\n\n\tif err = ts.UnlockKeyspaceForAction(\"test_keyspace\", lockPath2, \"fake-results\"); err != nil {\n\t\tt.Fatalf(\"UnlockKeyspaceForAction(test_keyspace): %v\", err)\n\t}\n\n\ttimeout := time.After(10 * time.Second)\n\tselect {\n\tcase <-finished:\n\tcase <-timeout:\n\t\tt.Fatalf(\"unlocking timed out\")\n\t}\n}", "func (rs *RedisService) Unlock(lock storages.Lock) error {\n\tlock.Unlock()\n\n\trs.selfmutex.Lock()\n\tdelete(rs.unlockMe, lock.Identifier())\n\trs.selfmutex.Unlock()\n\n\treturn nil\n}", "func (c *MockedHTTPContext) Unlock() {\n\tif c.MockedUnlock != nil {\n\t\tc.MockedUnlock()\n\t}\n}", "func (service LockService) Unlock(group *scaley.Group) error {\n\tif service.Locked(group) {\n\t\terr := Root.Remove(lockfile(group))\n\t\tif err != nil {\n\t\t\treturn scaley.UnlockFailure{Group: group}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (b *bearerTokenPolicy) unlock() {\n\tb.cond.Broadcast()\n\tb.cond.L.Unlock()\n}", "func (o *Encrypted) Unlock(ctx context.Context, passphrase string, options map[string]dbus.Variant) (cleartextDevice dbus.ObjectPath, err error) {\n\terr = o.object.CallWithContext(ctx, InterfaceEncrypted+\".Unlock\", 0, passphrase, options).Store(&cleartextDevice)\n\treturn\n}", "func (l *NullPathLocker) Unlock() {}", "func (_Lmc *LmcSession) ExitAndUnlock() (*types.Transaction, error) {\n\treturn _Lmc.Contract.ExitAndUnlock(&_Lmc.TransactOpts)\n}", "func (ls *LockServer) Unlock(args *UnlockArgs, reply *UnlockReply) error {\n\tls.mu.Lock()\n\tdefer ls.mu.Unlock()\n\n\tkey := OpKey{args.Lockname, args.Lockid}\n\tres, ok := ls.operations[key]\n\tif ok {\n\t\treply.OK = res\n\t\treturn nil\n\t}\n\n\t/*\tfmt.Println(ls.locks)\n\t\tfmt.Println(ls.operations)*/\n\tlocked := ls.locks[args.Lockname]\n\tif locked {\n\t\treply.OK = true\n\t\tls.locks[args.Lockname] = false\n\t} else {\n\t\treply.OK = false\n\t}\n\tif ls.am_primary {\n\t\tvar re LockReply\n\t\tok := call(ls.backup, \"LockServer.Unlock\", args, &re)\n\t\tif !ok {\n\t\t\tfmt.Println(\"Cannot call backup:\", args)\n\t\t}\n\t}\n\n\tls.operations[key] = reply.OK\n\treturn nil\n}", "func (lt *LockTimeout) Unlock() {\n\tatomic.StoreInt32(&lt.frontLock, 0)\n}", "func (d *Dam) Unlock() {\n\td.freeze.Unlock()\n}", "func (r *RedisLock) Unlock(ctx context.Context) error {\n\tif r.l == nil {\n\t\treturn redislock.ErrLockNotHeld\n\t}\n\n\tlockCtx, cancel := context.WithTimeout(ctx, r.ttl)\n\tdefer cancel()\n\treturn r.l.Release(lockCtx)\n}", "func unlock(lock *flock.Flock) {\n\terr := lock.Unlock()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func (s *session) unlock() {\n\tif s.state == stateAuthorization {\n\t\treturn // we didn't yet even have a chance to lock the maildrop\n\t}\n\tif err := s.handler.UnlockMaildrop(); err != nil {\n\t\ts.handler.HandleSessionError(err)\n\t}\n}", "func (w *Writer) unlock() {\n\tw.mutex.Unlock()\n}", "func (_Lmc *LmcTransactorSession) ExitAndUnlock() (*types.Transaction, error) {\n\treturn _Lmc.Contract.ExitAndUnlock(&_Lmc.TransactOpts)\n}", "func (f *file) Unlock() error {\n\treturn nil\n}", "func (d *dMutex) unlock(i interface{}) {\n\n\t// acquire global lock\n\td.globalMutex.Lock()\n\n\t// unlock instance mutex\n\td.mutexes[i].mutex.Unlock()\n\n\t// decrease the count, as we are no longer interested in this instance\n\t// mutex\n\td.mutexes[i].count--\n\n\t// if we are the last one interested in this instance mutex delete the\n\t// cMutex\n\tif d.mutexes[i].count == 0 {\n\t\tdelete(d.mutexes, i)\n\t}\n\n\t// release the global lock\n\td.globalMutex.Unlock()\n}", "func (l *Locker) Unlock() {\n\tif l.locker != -1 {\n\t\tpanic(\"db: Unlock of unlocked Locker\")\n\t}\n\tatomic.StoreInt32(&l.locker, 0)\n}", "func (g MutexGuard[T, M]) Unlock() {\n\tg.m.Unlock()\n}", "func (sp *SpinLock) Unlock(lockKeys []*LockKey) {\n\tN := len(lockKeys)\n\tfor i := N - 1; i >= 0; i-- {\n\t\tlkType := lockKeys[i].lockType\n\t\tk := lockKeys[i].key\n\t\tif lkType == exclusiveLock {\n\t\t\tsp.m.Delete(k)\n\t\t} else if lkType == sharedLock { //共享锁要考虑引用计数\n\t\t\tif sp.refCounter.Release(k) == 0 {\n\t\t\t\tsp.m.Delete(lockKeys[i].key)\n\t\t\t}\n\t\t}\n\t}\n}", "func (t *Mutex) Unlock() {\n\tt.m.Lock()\n\tdefer t.m.Unlock()\n\tif !t.locked {\n\t\tpanic(\"double call to unlock\")\n\t}\n\tt.locked = false\n}", "func (di *distLockInstance) Unlock() {\n\tdi.rwMutex.Unlock()\n}", "func (m *Metric) Unlock() {\n\tif m.mapSync == nil {\n\t\treturn\n\t}\n\tm.mapSync.Unlock()\n}", "func (c *ContextLock) Unlock(ctx context.Context) (context.Context, error) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tif c.id == 0 {\n\t\treturn ctx, nil\n\t}\n\n\tdepth := c._depth(ctx)\n\n\tswitch depth {\n\tcase 0:\n\t\tif !c.held {\n\t\t\treturn ctx, nil\n\t\t}\n\t\tfallthrough\n\n\tcase 1:\n\t\tc.held = false\n\t\tc.cond.Signal()\n\t\tfallthrough\n\n\tdefault:\n\t\tif depth > 0 {\n\t\t\tdepth--\n\t\t}\n\t}\n\n\treturn c._withDepth(ctx, depth)\n}", "func (srv *Server) Unlock(password string) error {\n\tif srv.node.Wallet == nil {\n\t\treturn errors.New(\"server doesn't have a wallet\")\n\t}\n\tvar validKeys []crypto.CipherKey\n\tdicts := []mnemonics.DictionaryID{\"english\", \"german\", \"japanese\"}\n\tfor _, dict := range dicts {\n\t\tseed, err := modules.StringToSeed(password, dict)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tvalidKeys = append(validKeys, crypto.NewWalletKey(crypto.HashObject(seed)))\n\t}\n\tvalidKeys = append(validKeys, crypto.NewWalletKey(crypto.HashObject(password)))\n\tfor _, key := range validKeys {\n\t\tif err := srv.node.Wallet.Unlock(key); err == nil {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn modules.ErrBadEncryptionKey\n}", "func (obj *Field) Unlock(ctx context.Context) (bool, error) {\n\tresult := &struct {\n\t\tReturn bool `json:\"qReturn\"`\n\t}{}\n\terr := obj.RPC(ctx, \"Unlock\", result)\n\treturn result.Return, err\n}", "func (lm *LMutex) Unlock() {\n\tif !atomic.CompareAndSwapInt64(&lm.state, WRITELOCK, NOLOCKS) {\n\t\tpanic(\"Trying to Unlock() while no Lock() is active\")\n\t}\n}", "func TestUnlockUnlocked(t *testing.T) {\n\tvar mu ctxsync.Mutex\n\tassert.Panics(t, func() { mu.Unlock() })\n}", "func (x *XcChaincode) unlock(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tif len(args) < 5 {\n\t\treturn shim.Error(\"Params Error\")\n\t}\n\n\tfromPlatform := strings.ToLower(args[0])\n\tfromAccount := strings.ToLower(args[1])\n\tamount := big.NewInt(0)\n\t_, ok := amount.SetString(args[2], 10)\n\tfmt.Println(args[2])\n\ttoAccount := strings.ToLower(args[3])\n\tpubTxId := strings.ToLower(args[4])\n\n\tif !ok {\n\t\treturn shim.Error(\"Expecting integer value for amount\")\n\t}\n\t//try to get state from book which key is variable fromPlatform's value\n\tplatState, err := stub.GetState(fromPlatform)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to get platform: \" + err.Error())\n\t} else if platState == nil {\n\t\treturn shim.Error(\"The platform named \" + fromPlatform + \" is not registered\")\n\t}\n\n\tvalidateTxRes, err := x.validateTxId(fromPlatform, pubTxId)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t} else if !validateTxRes {\n\t\treturn shim.Error(fmt.Sprintf(\"The txId from %s platform's tdId %s validat faild\", fromPlatform, pubTxId))\n\t}\n\n\t//build state key\n\tkey := fromPlatform + \"|\" + pubTxId\n\t//validate txId has not been processed\n\txcMs, err := stub.GetState(key)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t} else if xcMs != nil {\n\t\treturn shim.Error(\"This transaction has been processed\")\n\t}\n\n\t//do transfer `wait to change`\n\t//@todo function change to the other function that used to transfer from token address to toAccount\n\terr = stub.Transfer(toAccount, \"TAB\", amount)\n\tif err != nil {\n\t\treturn shim.Error(\"transfer error \" + err.Error())\n\t}\n\n\ttxTimestamp, err := stub.GetTxTimestamp()\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\ttimeStr := fmt.Sprintf(\"%d\", txTimestamp.GetSeconds())\n\t//build turn in state and change to json\n\tstate := x.buildTurnInMessage(stub.GetTxID(), fromAccount, fromPlatform, amount, toAccount, pubTxId, timeStr)\n\terr = stub.PutState(key, state)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t//build composite key\n\tindexName := \"type~address~datetime~platform~key\"\n\tindexKey, err := stub.CreateCompositeKey(indexName, []string{\"in\", toAccount, timeStr, fromPlatform, key})\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\tvalue := []byte{0x00}\n\tstub.PutState(indexKey, value)\n\n\treturn shim.Success([]byte(\"unlockSuccess\"))\n}", "func (*Item) Unlock() {}", "func (m *MutexSafe) unlock() {\n\tm.Mutex.Unlock()\n}", "func (lf *LockFile) Unlock() error {\n\n\tlog.Printf(\"Deleting lockfile at this key '%s'\", lf.Path)\n\n\tif lf.ConsulAddress == \"\" {\n\t\t// Delete the file\n\t\terr := os.Remove(lf.Path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tlf.locked = false\n\t\treturn nil\n\t}\n\n\t// Delete the KV pair\n\terr := DeleteValueFromConsul(lf.ConsulAddress, lf.Path)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlf.locked = false\n\treturn nil\n}", "func (l *Lock) Unlock() error {\n\tkv := l.Client.KV()\n\n\t// --writers\n\t// readers -> 0\n\n\t// decrease the number of pending/active writers on the lock\n\tfor {\n\t\twritersKV, _, err := kv.Get(l.WritersKey, nil /* QueryOptions */)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif writersKV == nil {\n\t\t\treturn fmt.Errorf(\"Unexpected missing key %s\", l.WritersKey)\n\t\t}\n\n\t\tnewCount := writersKV.Value[0] - 1\n\t\tlog.Printf(\"Setting %s to %d (%d)\", l.WritersKey,\n\t\t\tint(newCount), writersKV.ModifyIndex)\n\n\t\tnewWriters := consulApi.KVPair{\n\t\t\tKey: l.WritersKey,\n\t\t\tModifyIndex: writersKV.ModifyIndex,\n\t\t\tValue: []byte{newCount},\n\t\t}\n\n\t\tok, _ /* WriteMeta */, err := kv.CAS(&newWriters, nil /* WriteOptions */)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif ok {\n\t\t\tbreak\n\t\t}\n\n\t\tlog.Println(\"Failed to CAS lock, retry\")\n\t\ttime.Sleep(time.Millisecond * 500)\n\t}\n\n\t// set the number of active readers to 0\n\t// here any pending readers are blocking on this value currently being 0xff\n\t// so we can put directly here without needing to CAS\n\t_, err := kv.Put(&consulApi.KVPair{\n\t\tKey: l.ReadersKey,\n\t\tValue: []byte{byte(0)},\n\t}, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (drv SQLiteDriver) Unlock(db *sql.DB) {\n\t// no-op\n}", "func (m *LocalDLock) Unlock(key string) error {\n\tkey = strings.ToLower(key)\n\n\tl := m.lockMeta(key)\n\tif l == nil {\n\t\treturn ErrDidNotUnlock\n\t}\n\n\tm.release(key)\n\n\treturn nil\n}", "func (m *Mutex) Unlock() {\n\tm.in.Unlock()\n}", "func TaskUnlock() {\n\tinternal.Syscall0(TASKUNLOCK)\n}", "func (n *nsLockMap) Unlock(volume, path, opsID string) {\n\treadLock := false\n\tn.unlock(volume, path, opsID, readLock)\n}" ]
[ "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.6600546", "0.655545", "0.6553548", "0.6528052", "0.6512366", "0.6472486", "0.6427943", "0.6399758", "0.6386359", "0.635634", "0.6345423", "0.6333002", "0.6324415", "0.6316421", "0.63088626", "0.6279117", "0.6277629", "0.62612617", "0.62514067", "0.624103", "0.624006", "0.6234299", "0.6230995", "0.62091535", "0.61864716", "0.61864716", "0.6175567", "0.6173478", "0.6153648", "0.6148462", "0.61207414", "0.61207414", "0.611631", "0.60963774", "0.60943425", "0.6084319", "0.6081998", "0.6075519", "0.6066928", "0.60548925", "0.60427016", "0.60347486", "0.6026063", "0.6021681", "0.60195893", "0.60139793", "0.60109097", "0.6009432", "0.60091865", "0.5997961", "0.59951365", "0.59895533", "0.5988212", "0.5979543", "0.5977822", "0.5973294", "0.59701735", "0.59671193", "0.5965595", "0.5958205", "0.59267884", "0.5925238", "0.5899432", "0.5897909", "0.58776164", "0.58627266", "0.5857828", "0.5852166", "0.58507556", "0.5847919", "0.5841802", "0.5837623", "0.58337533", "0.5830578", "0.58293664", "0.58283764", "0.58138156", "0.5802429", "0.57975787", "0.57966244" ]
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}", "func (w *xcWallet) state() *WalletState {\n\twinfo := w.Info()\n\n\tw.mtx.RLock()\n\tvar peerCount uint32\n\tif w.peerCount > 0 { // initialized to -1 initially, means no count yet\n\t\tpeerCount = uint32(w.peerCount)\n\t}\n\n\tvar tokenApprovals map[uint32]asset.ApprovalStatus\n\tif w.connector.On() {\n\t\ttokenApprovals = w.ApprovalStatus()\n\t}\n\n\tstate := &WalletState{\n\t\tSymbol: unbip(w.AssetID),\n\t\tAssetID: w.AssetID,\n\t\tVersion: winfo.Version,\n\t\tOpen: len(w.encPass) == 0 || len(w.pw) > 0,\n\t\tRunning: w.connector.On(),\n\t\tBalance: w.balance,\n\t\tAddress: w.address,\n\t\tUnits: winfo.UnitInfo.AtomicUnit,\n\t\tEncrypted: len(w.encPass) > 0,\n\t\tPeerCount: peerCount,\n\t\tSynced: w.synced,\n\t\tSyncProgress: w.syncProgress,\n\t\tWalletType: w.walletType,\n\t\tTraits: w.traits,\n\t\tDisabled: w.disabled,\n\t\tApproved: tokenApprovals,\n\t}\n\tw.mtx.RUnlock()\n\n\tif w.parent != nil {\n\t\tw.parent.mtx.RLock()\n\t\tstate.Open = len(w.parent.encPass) == 0 || len(w.parent.pw) > 0\n\t\tw.parent.mtx.RUnlock()\n\t}\n\n\treturn state\n}", "func (cs *ConnectivityState) GetCurrentState() int64 {\n\treturn cs.state\n}", "func GetCurrentState() {\n\n}", "func (wc *WasmContext) state() kv.KVStoreReader {\n\tctx := wc.wcSandbox.ctx\n\tif ctx != nil {\n\t\treturn ctx.State()\n\t}\n\tctxView := wc.wcSandbox.ctxView\n\tif ctxView != nil {\n\t\treturn ctxView.StateR()\n\t}\n\tpanic(\"cannot access state\")\n}", "func (c *Context) State() *State {\n\treturn c.state.DeepCopy()\n}", "func (c *Conn) State() State {\n\treturn c.state\n}", "func (cc *ClientConn) GetState() connectivity.State {\n\treturn cc.csMgr.getState()\n}", "func (c *Context) Ctx() context.Context {\n\treturn context.WithValue(c.state.ctx, contextKey{}, c)\n}", "func (e *BaseExecutor) Ctx() sessionctx.Context {\n\treturn e.ctx\n}", "func (options *Options) Ctx() interface{} {\n\treturn options.eval.curCtx().Interface()\n}", "func (peer *Peer) CurrentState() uint64 {\n\tpeer.lock.RLock()\n\tdefer peer.lock.RUnlock()\n\treturn peer.state\n}", "func (t *SmartTripper) State() State {\n\tt.mu.Lock()\n\tdefer t.mu.Unlock()\n\n\treturn t.state\n}", "func (c *Client) State() ConnState {\n\treturn c.state\n}", "func (c *Client) State() State {\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\treturn c.state\n}", "func (s *DeterminationWithContext) State() State {\n\treturn s.stat.get()\n}", "func (c *Cursor) State() (StateData, error) {\n\tc.computeMutex.Lock()\n\tdefer c.computeMutex.Unlock()\n\tif !c.ready {\n\t\treturn nil, errors.New(\"Computation is not ready.\")\n\t}\n\treturn c.computedState.StateData, nil\n}", "func (p *Pool) Ctx() context.Context {\n\treturn p.baseCtx\n}", "func (r *ClusterTopologyReconciler) getCurrentState(ctx context.Context, cluster *clusterv1.Cluster) (*clusterTopologyState, error) {\n\t// TODO: add get class logic; also remove nolint exception from clusterTopologyState and machineDeploymentTopologyState\n\treturn nil, nil\n}", "func (cc *ClientConn) State() ClientConnState {\n\tcc.wmu.Lock()\n\tmaxConcurrent := cc.maxConcurrentStreams\n\tif !cc.seenSettings {\n\t\tmaxConcurrent = 0\n\t}\n\tcc.wmu.Unlock()\n\n\tcc.mu.Lock()\n\tdefer cc.mu.Unlock()\n\treturn ClientConnState{\n\t\tClosed: cc.closed,\n\t\tClosing: cc.closing || cc.singleUse || cc.doNotReuse || cc.goAway != nil,\n\t\tStreamsActive: len(cc.streams),\n\t\tStreamsReserved: cc.streamsReserved,\n\t\tStreamsPending: cc.pendingRequests,\n\t\tLastIdle: cc.lastIdle,\n\t\tMaxConcurrentStreams: maxConcurrent,\n\t}\n}", "func (evpool *EvidencePool) State() State {\n\tevpool.mtx.Lock()\n\tdefer evpool.mtx.Unlock()\n\treturn evpool.state\n}", "func (tbl RecordTable) Ctx() context.Context {\n\treturn tbl.ctx\n}", "func (e *dockerExec) getState() (execState, error) {\n\te.mu.Lock()\n\tdefer e.mu.Unlock()\n\treturn e.State, e.err\n}", "func (tbl DbCompoundTable) Ctx() context.Context {\n\treturn tbl.ctx\n}", "func (se *StateEngine) State() States {\n\tco := se.curr\n\n\tif co == nil {\n\t\t// return se.owner\n\t\treturn nil\n\t}\n\n\treturn co.Engine().State()\n}", "func (c *Client) Ctx() context.Context {\n\treturn c.ctx\n}", "func (t *Txn) State() fsm.State {\n\treturn t.machine.Subject.CurrentState()\n}", "func (cb *Breaker) State() State {\n\tcb.mutex.Lock()\n\tdefer cb.mutex.Unlock()\n\n\tnow := time.Now()\n\tstate, _ := cb.currentState(now)\n\treturn state\n}", "func (obj *BrainkeyHardenedPoint) Ctx() uintptr {\n\treturn uintptr(unsafe.Pointer(obj.cCtx))\n}", "func (m *ExternalConnection) GetState()(*ConnectionState) {\n return m.state\n}", "func (e *localfileExec) getState() (execState, error) {\n\te.mu.Lock()\n\tdefer e.mu.Unlock()\n\treturn e.state, e.err\n}", "func (se *StateEngine) State() *state.State {\n\treturn se.state\n}", "func (ms *StatusImpl) StateContext() (state orderer.ConsensusType_MigrationState, context uint64) {\n\tms.mutex.Lock()\n\tdefer ms.mutex.Unlock()\n\treturn ms.state, ms.context\n}", "func (b Bot) CurrentState() RobotState {\n\tb.mu.Lock()\n\tdefer b.mu.Unlock()\n\tlog.Println(b.state)\n\treturn b.state\n}", "func (t *task) State() State {\n\tv := atomic.LoadInt32(&t.state)\n\treturn State(v)\n}", "func (m *VppToken) GetState()(*VppTokenState) {\n return m.state\n}", "func (s *stateMachine) State() (*State, time.Time) {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\treturn s.state, s.ts\n}", "func (lc *Closer) Ctx() context.Context {\n\treturn lc.ctx\n}", "func (s *Server) State() State {\n\ts.mu.RLock()\n\tst := s.state\n\ts.mu.RUnlock()\n\treturn st\n}", "func (r *DynamoDBTaskReader) State() (tes.State, error) {\n\tt, err := r.client.GetTask(context.Background(), &tes.GetTaskRequest{\n\t\tId: r.taskID,\n\t\tView: tes.TaskView_MINIMAL,\n\t})\n\treturn t.GetState(), err\n}", "func (b *BTC) State() types.State {\n\t// not currently supported for btcd\n\treturn types.State{}\n}", "func (c *Connection) GetState() State {\n\treturn c.state\n}", "func (c *GRPCClient) GetState(ctx context.Context, store, key string) (out []byte, etag string, err error) {\n\treturn c.GetStateWithConsistency(ctx, store, key, StateConsistencyStrong)\n}", "func (bc *BlockChain) State() (*state.StateDBManage, error) {\n\treturn bc.StateAt(bc.CurrentBlock().Root())\n}", "func (bc *BlockChain) State() (*state.StateDBManage, error) {\n\treturn bc.StateAt(bc.CurrentBlock().Root())\n}", "func (obj *MessengerFileCipher) Ctx() uintptr {\n\treturn uintptr(unsafe.Pointer(obj.cCtx))\n}", "func idle() State_t {\n\t\n}", "func StateCommand(_ context.Context, deps *depspkg.HTTPDeps,\n\t_ *models.ExecuteParam, stmt stmtpkg.Statement) (interface{}, error) {\n\tstateStmt := stmt.(*stmtpkg.State)\n\tswitch stateStmt.Type {\n\tcase stmtpkg.Master:\n\t\treturn deps.Master.GetMaster(), nil\n\tcase stmtpkg.BrokerAlive:\n\t\treturn deps.StateMgr.GetLiveNodes(), nil\n\tcase stmtpkg.StorageAlive:\n\t\treturn deps.StateMgr.GetStorageList(), nil\n\tcase stmtpkg.Replication:\n\t\treturn getStateFromStorage(deps, stateStmt, \"/state/replica\", func() interface{} {\n\t\t\tvar state []models.FamilyLogReplicaState\n\t\t\treturn &state\n\t\t})\n\tcase stmtpkg.MemoryDatabase:\n\t\treturn getStateFromStorage(deps, stateStmt, \"/state/tsdb/memory\", func() interface{} {\n\t\t\tvar state []models.DataFamilyState\n\t\t\treturn &state\n\t\t})\n\tcase stmtpkg.BrokerMetric:\n\t\tliveNodes := deps.StateMgr.GetLiveNodes()\n\t\tvar nodes []models.Node\n\t\tfor idx := range liveNodes {\n\t\t\tnodes = append(nodes, &liveNodes[idx])\n\t\t}\n\t\treturn metricCli.FetchMetricData(nodes, stateStmt.MetricNames)\n\tcase stmtpkg.StorageMetric:\n\t\tstorageName := strings.TrimSpace(stateStmt.StorageName)\n\t\tif storageName == \"\" {\n\t\t\treturn nil, constants.ErrStorageNameRequired\n\t\t}\n\t\tif storage, ok := deps.StateMgr.GetStorage(storageName); ok {\n\t\t\tliveNodes := storage.LiveNodes\n\t\t\tvar nodes []models.Node\n\t\t\tfor id := range liveNodes {\n\t\t\t\tn := liveNodes[id]\n\t\t\t\tnodes = append(nodes, &n)\n\t\t\t}\n\t\t\treturn metricCli.FetchMetricData(nodes, stateStmt.MetricNames)\n\t\t}\n\t\treturn nil, nil\n\tdefault:\n\t\treturn nil, nil\n\t}\n}", "func GetState(key string) interface{} {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\treturn state[key]\n}", "func (client *SyncClient) State() SyncClientState {\n\treturn SyncClientState(C.obx_sync_state(client.cClient))\n}", "func (m *AccessPackageCatalog) GetState()(*AccessPackageCatalogState) {\n return m.state\n}", "func (c *connection) state_active(pc net.PacketConn, tq *timerQueue, cd *connectionData) connectionState {\n\n\tvar (\n\t\tincoming, outgoing []Packet\n\t\tprevTimeout time.Time\n\t\treadTimeout = timer{\n\t\t\tCond: &c.Cond,\n\t\t}\n\t)\n\n\tfor {\n\t\t// wait for something to do\n\t\tc.L.Lock()\n\t\tfor c.shouldWaitOnCV(tq, cd) && !c.closeCalled && c.readData.timeout.Equal(prevTimeout) {\n\t\t\tc.Wait()\n\t\t}\n\t\tnewTimeout := c.readData.timeout\n\t\tcloseCalled := c.closeCalled\n\t\tincoming = append(incoming, c.Incoming...)\n\t\toutgoing = append(outgoing, c.Outgoing...)\n\t\tc.Incoming, c.Outgoing = c.Incoming[:0], c.Outgoing[:0]\n\n\t\t// did the read operation timeout?\n\t\treadTimedout := c.locked_readOperationTimedOut(tq, cd)\n\t\tif readTimedout {\n\t\t\tif c.ReadErr == nil {\n\t\t\t\tc.ReadErr = ErrReadTimeout\n\t\t\t}\n\n\t\t\treadTimedout = c.readData.p != nil // need an unblock?\n\t\t\tc.readData.p = nil\n\t\t\tc.readData.timeout = time.Time{}\n\t\t}\n\n\t\tc.L.Unlock()\n\n\t\t// need to unblock a timedout Read?\n\t\tif readTimedout {\n\t\t\ttq.StopTimer(&readTimeout)\n\t\t\tc.readData.Done()\n\t\t}\n\n\t\t// Start new read timeout\n\t\tif !newTimeout.Equal(prevTimeout) {\n\t\t\tprevTimeout = newTimeout\n\t\t\ttq.StopTimer(&readTimeout)\n\t\t\tif !newTimeout.IsZero() {\n\t\t\t\td := newTimeout.Sub(tq.Now())\n\t\t\t\tif d > 0 {\n\t\t\t\t\ttq.StartTimer(&readTimeout, d)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// process client data and release packets\n\t\terr := cd.Process(pc, c.addr, tq, incoming, outgoing)\n\t\tfor _, p := range incoming {\n\t\t\tp.Free()\n\t\t}\n\t\tfor _, p := range outgoing {\n\t\t\tp.Free()\n\t\t}\n\t\tincoming, outgoing = incoming[:0], outgoing[:0]\n\n\t\t// process any failures\n\t\tif err != nil {\n\t\t\tc.L.Lock()\n\t\t\tc.ReadErr = err\n\t\t\tc.WriteErr = err\n\t\t\tc.L.Unlock()\n\t\t\treturn connectionAbort\n\t\t}\n\n\t\t// deliver any application data\n\t\tc.deliverApplicationData(cd)\n\n\t\t// it's an error to receive a SHUTDOWN-ACK packet here\n\t\tif cd.ReceivedShutdownAck {\n\t\t\tc.L.Lock()\n\t\t\tc.ReadErr = ProtocolPacketError{Type: PacketShutdownAck}\n\t\t\tc.WriteErr = c.ReadErr\n\t\t\tc.L.Unlock()\n\t\t\treturn connectionAbort\n\t\t}\n\n\t\t// received a Close() notification\n\t\tif closeCalled {\n\t\t\treturn connectionShutdownPending\n\t\t}\n\n\t\tif cd.ReceivedShutdown {\n\t\t\treturn connectionShutdownReceived\n\t\t}\n\t}\n}", "func (obj *KeyHandlerList) Ctx() uintptr {\n\treturn uintptr(unsafe.Pointer(obj.cCtx))\n}", "func (tbl AssociationTable) Ctx() context.Context {\n\treturn tbl.ctx\n}", "func (message *Message) Ctx() context.Context {\n\tmessage.mutex.RLock()\n\tdefer message.mutex.RUnlock()\n\treturn message.ctx\n}", "func (k Keeper) State(c context.Context, req *types.QueryStateRequest) (*types.QueryStateResponse, error) {\n\tctx := sdk.UnwrapSDKContext(c)\n\tstate := k.GetState(ctx)\n\n\treturn &types.QueryStateResponse{State: state}, nil\n}", "func (rf *Raft) GetState() (int, bool) {\n\n var term int\n var isleader bool\n // Your code here (2A).\n rf.mu.Lock()\n term = rf.currentTerm\n isleader = (rf.state == StateLeader)\n rf.mu.Unlock()\n return term, isleader\n}", "func (ts *TaskService) State(requestCtx context.Context, req *taskAPI.StateRequest) (*taskAPI.StateResponse, error) {\n\tdefer logPanicAndDie(log.G(requestCtx))\n\tlog.G(requestCtx).WithFields(logrus.Fields{\"id\": req.ID, \"exec_id\": req.ExecID}).Debug(\"state\")\n\n\tresp, err := ts.runcService.State(requestCtx, req)\n\tif err != nil {\n\t\tlog.G(requestCtx).WithError(err).Error(\"state failed\")\n\t\treturn nil, err\n\t}\n\n\tlog.G(requestCtx).WithFields(logrus.Fields{\n\t\t\"id\": resp.ID,\n\t\t\"bundle\": resp.Bundle,\n\t\t\"pid\": resp.Pid,\n\t\t\"status\": resp.Status,\n\t}).Debug(\"state succeeded\")\n\treturn resp, nil\n}", "func (s *StanServer) State() State {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\treturn s.state\n}", "func (tp *ThreadPool) State() map[string]interface{} {\n\n\tgetIdsFromWorkerMap := func(m map[uint64]*ThreadPoolWorker) []uint64 {\n\t\tvar ret []uint64\n\t\tfor k := range m {\n\t\t\tret = append(ret, k)\n\t\t}\n\t\treturn ret\n\t}\n\n\ttp.workerMapLock.Lock()\n\tdefer tp.workerMapLock.Unlock()\n\n\treturn map[string]interface{}{\n\t\t\"TaskQueueSize\": tp.queue.Size(),\n\t\t\"TotalWorkerThreads\": getIdsFromWorkerMap(tp.workerMap),\n\t\t\"IdleWorkerThreads\": getIdsFromWorkerMap(tp.workerIdleMap),\n\t}\n}", "func (ctl *taskController) State() *task.State {\n\treturn &ctl.state\n}", "func (e HybridKFEstimate) State() *mat64.Vector {\n\treturn e.state\n}", "func (m *InMemory) Current() (qaclana.State, error) {\n\treturn m.s, nil\n}", "func (_DelegationController *DelegationControllerCallerSession) GetState(delegationId *big.Int) (uint8, error) {\n\treturn _DelegationController.Contract.GetState(&_DelegationController.CallOpts, delegationId)\n}", "func (r *RollDPoS) CurrentState() fsm.State {\n\treturn r.cfsm.CurrentState()\n}", "func (c *Conn) Ctx(ctx context.Context) *Conn {\n\tc.ctx = ctx\n\treturn c\n}", "func State() (*db.Source, int, time.Time) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\treturn current, ingestDelaySeconds, nextIngest\n}", "func (p AMQPClient) State() chan bool {\n\treturn p.stateUpdates\n}", "func (dao *SysConfigDao) Ctx(ctx context.Context) *gdb.Model {\n\treturn dao.DB().Model(dao.table).Safe().Ctx(ctx)\n}", "func (r *RPCTaskReader) State() (tes.State, error) {\n\tt, err := r.client.GetTask(context.Background(), &tes.GetTaskRequest{\n\t\tId: r.taskID,\n\t\tView: tes.TaskView_MINIMAL,\n\t})\n\treturn t.GetState(), err\n}", "func (obj *MessengerUser) Ctx() uintptr {\n\treturn uintptr(unsafe.Pointer(obj.cCtx))\n}", "func GetAndLockState(q sqlx.Ext, customerId, checkId string) (*State, error) {\n\tstate := &State{}\n\terr := sqlx.Get(q, state, \"SELECT states.state_id, states.customer_id, states.check_id, states.state_name, states.time_entered, states.last_updated, checks.min_failing_count, checks.min_failing_time, states.failing_count, states.response_count FROM check_states AS states JOIN checks ON (checks.id = states.check_id) WHERE states.customer_id = $1 AND checks.id = $2 FOR UPDATE OF states\", customerId, checkId)\n\tif err != nil && err != sql.ErrNoRows {\n\t\treturn nil, err\n\t}\n\n\tif err == sql.ErrNoRows {\n\t\t// Get the check so that we can get MinFailingCount and MinFailingTime\n\t\t// Return an error if the check doesn't exist\n\t\t// check, err := store.GetCheck(customerId, checkId)\n\t\tcheck := &schema.Check{}\n\t\terr := sqlx.Get(q, check, \"SELECT id, customer_id, min_failing_count, min_failing_time FROM checks WHERE customer_id = $1 AND id = $2\", customerId, checkId)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tstate = &State{\n\t\t\tCheckId: checkId,\n\t\t\tCustomerId: customerId,\n\t\t\tId: StateOK,\n\t\t\tState: StateOK.String(),\n\t\t\tTimeEntered: time.Now(),\n\t\t\tLastUpdated: time.Now(),\n\t\t\tMinFailingCount: check.MinFailingCount,\n\t\t\tMinFailingTime: time.Duration(check.MinFailingTime) * time.Second,\n\t\t\tFailingCount: 0,\n\t\t}\n\t}\n\n\tstate.MinFailingTime = state.MinFailingTime * time.Second\n\n\treturn state, nil\n}", "func (req *SetRequest) Ctx() context.Context {\n\treturn req.impl.Ctx()\n}", "func (m *AccessPackageAssignment) GetState()(*AccessPackageAssignmentState) {\n return m.state\n}", "func (c *Consumer) State() (api.ConsumerInfo, error) {\n\ts, err := c.mgr.loadConsumerInfo(c.stream, c.name)\n\tif err != nil {\n\t\treturn api.ConsumerInfo{}, err\n\t}\n\n\tc.Lock()\n\tc.lastInfo = &s\n\tc.Unlock()\n\n\treturn s, nil\n}", "func (s *RaftStateMachine) State(ctx context.Context) *kronospb.OracleState {\n\treturn s.stateMachine.State(ctx)\n}", "func (bot *ExchangeBot) State() *ExchangeBotState {\n\tbot.RLock()\n\tdefer bot.RUnlock()\n\treturn bot.stateCopy\n}", "func (cli *Client) State() State {\n\treturn State(cli.ref.Get(\"readyState\").Int())\n}", "func (dao *ConfigAuditProcessDao) Ctx(ctx context.Context) *gdb.Model {\n\treturn dao.DB().Model(dao.table).Safe().Ctx(ctx)\n}", "func (h *HTTP) State() *ConnectivityState {\n\treturn h.ConnectivityState\n}", "func (m *Machine) State() State {\n\treturn m.currentState\n}", "func (c *ConsoleWrapper) CurrentState() string {\n\treturn c.state.String()\n}", "func (c *ConsoleWrapper) CurrentState() string {\n\treturn c.state.String()\n}", "func (req *GetRequest) Ctx() context.Context {\n\treturn req.impl.Ctx()\n}", "func (s *SketchLimiter) State() LoadState {\n\ts.m.RLock()\n\tdefer s.m.RUnlock()\n\treturn s.current\n}", "func (s *SketchLimiter) State() LoadState {\n\ts.m.RLock()\n\tdefer s.m.RUnlock()\n\treturn s.current\n}", "func (s *SketchLimiter) State() LoadState {\n\ts.m.RLock()\n\tdefer s.m.RUnlock()\n\treturn s.current\n}", "func (ed *EvalDetails) State() interpreter.EvalState {\n\treturn ed.state\n}", "func (sb *shardBuffer) testGetState() bufferState {\n\tsb.mu.RLock()\n\tdefer sb.mu.RUnlock()\n\treturn sb.state\n}", "func getState(app *BaseApp, isCheckTx bool) *state {\n\tif isCheckTx {\n\t\treturn app.checkState\n\t}\n\n\treturn app.deliverState\n}", "func (c *Client) GetState() (int, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), c.rpcTimeout)\n\tdefer cancel()\n\treq := &pb.EmptyReq{}\n\tres, err := c.rpcClient.GetState(ctx, req)\n\treturn int(res.GetState()), err\n}", "func (rf *Raft) GetState() (int, bool) {\n\n var term int\n var isleader bool\n // Your code here (2A).\n rf.mu.Lock()\n defer rf.mu.Unlock()\n term = rf.currentTerm\n isleader = false\n if rf.state == LEADER {\n isleader = true\n }\n return term, isleader\n}", "func (dao *InfoDao) Ctx(ctx context.Context) *gdb.Model {\n\treturn dao.DB().Model(dao.Table).Safe().Ctx(ctx)\n}", "func (rf *Raft) GetState() (int, bool) {\n var term int\n var isleader bool\n \n rf.mu.Lock()\n term = rf.currentTerm\n isleader = (rf.state == \"Leader\")\n rf.mu.Unlock()\n\n return term, isleader\n}", "func (c *Context) AppState() *ApplicationState {\n\treturn c.state\n}", "func (pool *Pool) State() (state PoolState, err error) {\n\tif pool.list == nil {\n\t\terr = errors.New(msgPoolIsNil)\n\t} else {\n\t\tstate = PoolState(C.zpool_read_state(pool.list.zph))\n\t}\n\treturn\n}", "func (o JobOutput) CurrentState() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Job) pulumi.StringOutput { return v.CurrentState }).(pulumi.StringOutput)\n}", "func (se *StateEngine) ShallowState() States {\n\tif se.curr == nil {\n\t\treturn nil\n\t}\n\n\treturn se.curr\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.5779495", "0.5769855", "0.57526183", "0.57495534", "0.57475066", "0.573516", "0.5716686", "0.571527", "0.5708866", "0.5708847", "0.57072914", "0.5696642", "0.5672067", "0.5655771", "0.5641515", "0.5600771", "0.5591697", "0.5575659", "0.5568988", "0.55395186", "0.55287015", "0.55235285", "0.5517971", "0.55122817", "0.55112284", "0.55112284", "0.5510811", "0.55057925", "0.5440209", "0.54343253", "0.5426007", "0.54197323", "0.5396812", "0.5377292", "0.53742427", "0.5371694", "0.5361151", "0.5349341", "0.53483325", "0.5343375", "0.5337595", "0.5336292", "0.5336125", "0.53328854", "0.53257823", "0.53208995", "0.5319929", "0.53194267", "0.5307902", "0.5307197", "0.53065825", "0.53060454", "0.5304779", "0.5302487", "0.5293089", "0.5289646", "0.5289257", "0.5287647", "0.528545", "0.5284109", "0.5282101", "0.52746177", "0.5273261", "0.5273261", "0.52547294", "0.52425563", "0.52425563", "0.52425563", "0.5242131", "0.5241278", "0.5232823", "0.522513", "0.5224576", "0.5223314", "0.522257", "0.5222227", "0.522075", "0.5209962", "0.52024657" ]
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}", "func (v *Component) SetState(c *Change) {\n\tks := c.Keys()\n\tfor _, k := range ks {\n\t\to := c.Get(k)\n\t\tv.State().Set(k, o)\n\t}\n\tgo v.redraw()\n}", "func (c *Client) setState(s ConnState) {\n\tprev := c.state\n\tif prev == s || prev == Closed {\n\t\treturn\n\t}\n\tc.state = s\n\tif s != Selected {\n\t\tc.Logf(LogState, \"State change: %v -> %v\", prev, s)\n\t\tc.Mailbox = nil\n\t\tif s == Closed {\n\t\t\tif c.cch != nil {\n\t\t\t\tclose(c.cch)\n\t\t\t\truntime.Gosched()\n\t\t\t}\n\t\t\tc.setCaps(nil)\n\t\t\tc.deliver(abort)\n\t\t}\n\t} else if c.debugLog.mask&LogState != 0 {\n\t\tmb, rw := c.Mailbox.Name, \"[RW]\"\n\t\tif c.Mailbox.ReadOnly {\n\t\t\trw = \"[RO]\"\n\t\t}\n\t\tc.Logf(LogState, \"State change: %v -> %v (%+q %s)\", prev, s, mb, rw)\n\t}\n}", "func (m *AccessPackageCatalog) SetState(value *AccessPackageCatalogState)() {\n m.state = value\n}", "func (m *VppToken) SetState(value *VppTokenState)() {\n m.state = value\n}", "func (m *ExternalConnection) SetState(value *ConnectionState)() {\n m.state = value\n}", "func (m *DeviceEnrollmentWindowsHelloForBusinessConfiguration) SetState(value *Enablement)() {\n err := m.GetBackingStore().Set(\"state\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *MacOSSoftwareUpdateStateSummary) SetState(value *MacOSSoftwareUpdateState)() {\n err := m.GetBackingStore().Set(\"state\", value)\n if err != nil {\n panic(err)\n }\n}", "func (cmd *Start) SetState(agg types.Aggregate) error {\n\tif s, ok := agg.(*aggregates.Session); ok {\n\t\tcmd.session = s\n\t\treturn nil\n\t} else {\n\t\treturn errors.New(\"can't cast\")\n\t}\n}", "func (p *TransportBasePriv) SetState(st TransportState) {\n\tif p.b.state == st {\n\t\treturn\n\t}\n\tp.b.state = st\n\tp.b.emitter.EmitSync(evtStateChange, st)\n}", "func (cm *connManager) setState(nc net.Conn, state http.ConnState) {\n\tcm.mu.Lock()\n\tdefer cm.mu.Unlock()\n\tif cm.activeConns == nil {\n\t\tcm.activeConns = make(map[net.Conn]*atomic.Value)\n\t}\n\tswitch state {\n\tcase http.StateNew:\n\t\tcm.activeConns[nc] = &atomic.Value{}\n\tcase http.StateHijacked, http.StateClosed:\n\t\tdelete(cm.activeConns, nc)\n\t}\n\tif v, ok := cm.activeConns[nc]; ok {\n\t\tv.Store(state)\n\t}\n}", "func (m *AccessPackageAssignment) SetState(value *AccessPackageAssignmentState)() {\n m.state = value\n}", "func (e *dockerExec) setState(state execState, err error) {\n\te.mu.Lock()\n\te.State = state\n\te.err = err\n\te.cond.Broadcast()\n\te.mu.Unlock()\n}", "func (s *ServiceManager) setState(st ManagerStateEnum) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\ts.state = st\n}", "func (s *SimpleBlockFactory) SetStateDB(sdb *state.ChainStateDB) {\n}", "func (d *Dao) SetTransferState(c context.Context, id int64, state int8) (affect int64, err error) {\n\trow, err := d.biliDM.Exec(c, _uptTransferSQL, state, id)\n\tif err != nil {\n\t\tlog.Error(\"d.biliDM.Exec(%s,%d) error(%v)\", _uptTransferSQL, id, err)\n\t\treturn\n\t}\n\treturn row.RowsAffected()\n}", "func (e *localfileExec) setState(state execState, err error) {\n\te.mu.Lock()\n\te.state = state\n\te.err = err\n\te.cond.Broadcast()\n\te.mu.Unlock()\n}", "func (db *CassandraDB) SetState(userid gocql.UUID, state State) error {\n\tif err := db.Session.Query(`\n UPDATE user set gamesPlayed = ?, score = ? where id = ?`,\n\t\tstate.GamesPlayed, state.Highscore, state.Id).Exec(); err != nil {\n\t}\n\treturn nil\n}", "func (r *ReconcileHumioCluster) setState(ctx context.Context, state string, hc *corev1alpha1.HumioCluster) error {\n\tr.logger.Infof(\"setting cluster state to %s\", state)\n\thc.Status.State = state\n\terr := r.client.Status().Update(ctx, hc)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func SetState(state bool, macAdd string) {\n\tvar statebit string\n\tif state == true {\n\t\tstatebit = \"01\"\n\t} else {\n\t\tstatebit = \"00\"\n\t}\n\tsendMessage(\"686400176463\"+macAdd+twenties+\"00000000\"+statebit, sockets[macAdd].IP)\n\tgo func() { Events <- EventStruct{\"stateset\", *sockets[macAdd]} }()\n}", "func SetState(state State) {\n\tC.bgfx_set_state(C.uint64_t(state), 0)\n}", "func (obj *StateObject) SetState(db Database, key, value math.Hash) {\n\t// If the new value is the same as old, don't set\n\tprev := obj.GetState(db, key)\n\tif prev == value {\n\t\treturn\n\t}\n\n\tobj.setState(key, value)\n}", "func (m *AgreementAcceptance) SetState(value *AgreementAcceptanceState)() {\n m.state = value\n}", "func (csm *RedisCsm) Set(sessionID int64, state string) {\n\tkey := csm.key(sessionID)\n\toldData := csm.getOrCreate(key)\n\n\toldData[\"__state__\"] = state\n\n\tbody, err := json.Marshal(oldData)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tcsm.set(key, string(body))\n\n}", "func setState(state *bytes.Buffer) error {\n\tcmd := exec.Command(\"stty\", state.String())\n\tcmd.Stdin = os.Stdin\n\tcmd.Stdout = os.Stdout\n\treturn cmd.Run()\n}", "func (m *ScheduleChangeRequest) SetState(value *ScheduleChangeState)() {\n err := m.GetBackingStore().Set(\"state\", value)\n if err != nil {\n panic(err)\n }\n}", "func (p *ComputationPlugin) SetState(state []byte,\n\tresponse *string) error {\n\tp.mx.Lock()\n\tdefer p.mx.Unlock()\n\t*response = \"ok\"\n\terr := p.impl.SetState(state)\n\treturn err\n}", "func (t *Textarea) SetState(val string, selStart, selEnd int) {\n\tt.Set(\"value\", val)\n\tt.SetSelectionStart(selStart)\n\tt.SetSelectionEnd(selEnd)\n}", "func SetState(newState map[string]interface{}) {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\tfor key, value := range newState {\n\t\tstate[key] = value\n\t}\n}", "func (rl *RateLimiter) SetState(state State) {\n\trl.lock.Lock()\n\tdefer rl.lock.Unlock()\n\tif rl.state == state {\n\t\treturn\n\t}\n\tif rl.state == StateDisabled {\n\t\trl.cycle = 0\n\t\trl.tokens = 0\n\t\trl.startTime = nowFunc()\n\t}\n\trl.state = state\n}", "func (nm *NodeMonitor) setState(state *models.MonitorStatus) {\n\tnm.mutex.Lock()\n\tnm.state = state\n\tnm.mutex.Unlock()\n}", "func (m *StateSwitcherMock) setState(p State) {\n\tatomic.AddUint64(&m.setStatePreCounter, 1)\n\tdefer atomic.AddUint64(&m.setStateCounter, 1)\n\n\tif m.setStateMock.mockExpectations != nil {\n\t\ttestify_assert.Equal(m.t, *m.setStateMock.mockExpectations, StateSwitcherMocksetStateParams{p},\n\t\t\t\"StateSwitcher.setState got unexpected parameters\")\n\n\t\tif m.setStateFunc == nil {\n\n\t\t\tm.t.Fatal(\"No results are set for the StateSwitcherMock.setState\")\n\n\t\t\treturn\n\t\t}\n\t}\n\n\tif m.setStateFunc == nil {\n\t\tm.t.Fatal(\"Unexpected call to StateSwitcherMock.setState\")\n\t\treturn\n\t}\n\n\tm.setStateFunc(p)\n}", "func (delegateObject *delegateObject) SetState(db Database, key, value common.Hash) {\n\tdelegateObject.db.journal = append(delegateObject.db.journal, storageChange{\n\t\taccount: &delegateObject.address,\n\t\tkey: key,\n\t\tprevalue: delegateObject.GetState(db, key),\n\t})\n\tdelegateObject.setState(key, value)\n}", "func (s *server) setState(state string) {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\n\t// Temporarily store previous values.\n\t//prevState := s.state\n\t//prevLeader := s.leader\n\n\t// Update state and leader.\n\ts.state = state\n\tif state == Leader {\n\t\ts.leader = s.Name()\n\t\ts.syncedPeer = make(map[string]bool)\n\t}\n\t\t//\n\t\t//// Dispatch state and leader change events.\n\t\t//s.DispatchEvent(newEvent(StateChangeEventType, s.state, prevState))\n\t\t//\n\t\t//if prevLeader != s.leader {\n\t\t//\ts.DispatchEvent(newEvent(LeaderChangeEventType, s.leader, prevLeader))\n\t\t//}\n}", "func (w *Watcher) SetState(key string, value any) {\n\tw.lock.Lock()\n\tdefer w.lock.Unlock()\n\n\tw.stateCache[key] = value\n}", "func (cs *ConnectivityState) SetState(state string) error {\n\tcs.mu.Lock()\n\tdefer cs.mu.Unlock()\n\n\tif _, ok := connectivityStates[state]; !ok {\n\t\treturn fmt.Errorf(\"Invalid connectivity state provided (provided: %s)\", state)\n\t}\n\n\tcs.state = connectivityStates[state]\n\treturn nil\n}", "func Stx(c *CPU) {\n\tc.Set(c.EffAddr, c.X)\n}", "func (nm *NodeMonitor) setState(state *models.MonitorStatus) {\n\tnm.Mutex.Lock()\n\tnm.state = state\n\tnm.Mutex.Unlock()\n}", "func (impl *Server) SetState(ID string, state string) (base.ModelInterface, error) {\n\tvar (\n\t\tc = impl.TemplateImpl.GetConnection()\n\t\tserver = new(entity.Server)\n\t)\n\ttx := c.Begin()\n\tif err := tx.Error; err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"id\": ID,\n\t\t\t\"op\": \"SetState\",\n\t\t\t\"error\": err,\n\t\t}).Warn(\"DB operation failed, start transaction failed.\")\n\t\treturn nil, base.ErrorTransaction\n\t}\n\tfound, err := impl.GetInternal(tx, ID, server)\n\tif !found || err != nil {\n\t\ttx.Rollback()\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"id\": ID,\n\t\t\t\"op\": \"SetState\",\n\t\t}).Warn(\"DB operation failed, load server failed.\")\n\t\treturn nil, base.ErrorTransaction\n\t}\n\tif err := tx.Model(server).UpdateColumn(\"State\", state).Error; err != nil {\n\t\ttx.Rollback()\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"id\": ID,\n\t\t\t\"op\": \"SetState\",\n\t\t\t\"error\": err,\n\t\t}).Warn(\"DB opertion failed, update server failed, transaction rollback.\")\n\t\treturn nil, base.ErrorTransaction\n\t}\n\tif err := tx.Commit().Error; err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"id\": ID,\n\t\t\t\"op\": \"SetState\",\n\t\t\t\"error\": err,\n\t\t}).Warn(\"DB opertion failed, commit failed.\")\n\t\treturn nil, base.ErrorTransaction\n\t}\n\treturn server.ToModel(), nil\n}", "func (peer *Peer) SetState(state uint64) {\n\tpeer.lock.Lock()\n\tdefer peer.lock.Unlock()\n\tpeer.state = state\n}", "func (m *User) SetState(value *string)() {\n m.state = value\n}", "func (s *ocmClient) SetState(value string, description string, policyId string, clusterId string) error {\n\n\tpolicyState := UpgradePolicyStateRequest{\n\t\tValue: string(value),\n\t\tDescription: description,\n\t}\n\n\t// Create the URL path to send to\n\treqUrl, err := url.Parse(s.ocmBaseUrl.String())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't read OCM API url: %v\", err)\n\t}\n\treqUrl.Path = path.Join(reqUrl.Path, CLUSTERS_V1_PATH, clusterId, UPGRADEPOLICIES_V1_PATH, policyId, STATE_V1_PATH)\n\n\tresponse, err := s.httpClient.R().\n\t\tSetHeader(\"Content-Type\", \"application/json\").\n\t\tSetBody(policyState).\n\t\tExpectContentType(\"application/json\").\n\t\tPatch(reqUrl.String())\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't set upgrade policy state: request to '%v' returned error '%v'\", reqUrl.String(), err)\n\t}\n\toperationId := response.Header().Get(OPERATION_ID_HEADER)\n\tif response.IsError() {\n\t\treturn fmt.Errorf(\"request to '%v' received error code %v, operation id '%v'\", reqUrl.String(), response.StatusCode(), operationId)\n\t}\n\n\treturn nil\n}", "func (s *StateMgr) SetState(n State) {\n\ts.current = n\n}", "func (t *SignalingState) Set(state SignalingState) {\n\tatomic.StoreInt32((*int32)(t), int32(state))\n}", "func (remote *SerialRemote) SetState(state bool) error {\n\treturn remote.port.SetRTS(state)\n}", "func (fuo *FlowUpdateOne) SetState(u uuid.UUID) *FlowUpdateOne {\n\tfuo.mutation.SetState(u)\n\treturn fuo\n}", "func SetState(conn db.Connection, channel string, state State) error {\n\tif testStateSaveError != nil {\n\t\treturn testStateSaveError\n\t}\n\n\treturn db.SetWithTTL(conn, StateKey(channel), state, StateTTL)\n}", "func SetState(conn db.Connection, channel string, state State) error {\n\tif testStateSaveError != nil {\n\t\treturn testStateSaveError\n\t}\n\n\treturn db.SetWithTTL(conn, StateKey(channel), state, StateTTL)\n}", "func SetState(conn db.Connection, channel string, state State) error {\n\tif testStateSaveError != nil {\n\t\treturn testStateSaveError\n\t}\n\n\treturn db.SetWithTTL(conn, StateKey(channel), state, StateTTL)\n}", "func (state *State) SetState(newState bool) error {\n\tnewNum := uint32(0)\n\n\tif newState {\n\t\tnewNum = 1\n\t}\n\n\tpreviousState := atomic.SwapUint32((*uint32)(state), newNum)\n\n\tif previousState == 0 && !newState ||\n\t\tpreviousState == 1 && newState {\n\t\treturn errors.New(\"Already set.\")\n\t}\n\n\treturn nil\n}", "func GuiTextBoxSetState(state GuiTextBoxState) {\n\tcstate := *state.cptr()\n\tC.GuiTextBoxSetState(cstate)\n}", "func (og *OpacityGauge) SetState() string {\n\tfor {\n\t\tuiEvents := ui.PollEvents()\n\t\te := <-uiEvents\n\t\tswitch e.ID {\n\t\tcase \"<C-c>\", \"q\", \"A\", \"S\", \"W\", \"D\":\n\t\t\treturn e.ID\n\t\tcase \"a\", \"d\":\n\t\t\tnewOpacity := og.toggleOpacity(e.ID)\n\t\t\tnewPercent := int(newOpacity / float64(255) * 100)\n\t\t\tog.Widget.Percent = newPercent\n\n\t\t\t(*og.settingsConfig)[opacityProperty] = newOpacity\n\t\t\tutils.WriteFileJSON(og.settingsConfig)\n\n\t\t\tui.Render(og.Widget)\n\t\t}\n\t}\n}", "func (actor *Actor) SetState(newState consensus.State) (consensus.State, error) {\n\t// figure out if this is an Op.\n\top, ok := newState.(consensus.Op)\n\tif ok {\n\t\treturn actor.commitOp(op)\n\t}\n\treturn actor.commitOp(&stateOp{newState})\n}", "func (m *Mob) SetState(state MobStateType) {\n\tnext := time.Now().UnixMilli()\n\n\tswitch state {\n\tcase MobStateFind:\n\t\tnext += m.FindInterval\n\tcase MobStateMove:\n\t\tnext += m.MoveInterval\n\t}\n\n\tm.mutex.Lock()\n\tm.state = state\n\tm.nextRun = next\n\tm.findRemain = m.FindCount\n\tm.mutex.Unlock()\n}", "func (r *HumioClusterReconciler) setState(ctx context.Context, state string, hc *humiov1alpha1.HumioCluster) error {\n\tif hc.Status.State == state {\n\t\treturn nil\n\t}\n\tr.Log.Info(fmt.Sprintf(\"setting cluster state to %s\", state))\n\t// TODO: fix the logic in ensureMismatchedPodsAreDeleted() to allow it to work without doing setStateOptimistically().\n\tif err := r.setStateOptimistically(ctx, state, hc); err != nil {\n\t\terr := retry.RetryOnConflict(retry.DefaultRetry, func() error {\n\t\t\terr := r.getLatestHumioCluster(ctx, hc)\n\t\t\tif err != nil {\n\t\t\t\tif !k8serrors.IsNotFound(err) {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\thc.Status.State = state\n\t\t\treturn r.Status().Update(ctx, hc)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn r.logErrorAndReturn(err, \"failed to update resource status\")\n\t\t}\n\t}\n\treturn nil\n}", "func (cs *ConnectivityState) SetStateIdle() {\n\tcs.SetState(\"idle\")\n}", "func (l *ChainLedger) SetState(addr types.Address, key []byte, v []byte) {\n\taccount := l.GetOrCreateAccount(addr)\n\taccount.SetState(key, v)\n}", "func (obj *Device) SetSamplerState(\n\tsampler uint32,\n\ttyp SAMPLERSTATETYPE,\n\tvalue uint32,\n) Error {\n\tret, _, _ := syscall.Syscall6(\n\t\tobj.vtbl.SetSamplerState,\n\t\t4,\n\t\tuintptr(unsafe.Pointer(obj)),\n\t\tuintptr(sampler),\n\t\tuintptr(typ),\n\t\tuintptr(value),\n\t\t0,\n\t\t0,\n\t)\n\treturn toErr(ret)\n}", "func (c *Change) State(on bool) *Change {\n\tc.params[\"on\"] = on\n\treturn c\n}", "func (aruo *AuthRequestUpdateOne) SetState(s string) *AuthRequestUpdateOne {\n\taruo.mutation.SetState(s)\n\treturn aruo\n}", "func (b *Backend) updateState(signature *tasks.Signature, update bson.M) error {\n\top, err := b.connect()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn op.Do(func() error {\n\t\tupdate = bson.M{\"$set\": update}\n\t\t_, err := op.tasksCollection.UpsertId(signature.UUID, update)\n\t\treturn err\n\t})\n}", "func (self Context) SetActive(active bool) {\n\tif active {\n\t\tC.sfContext_setActive(self.Cref, C.sfBool(1))\n\t} else {\n\t\tC.sfContext_setActive(self.Cref, C.sfBool(0))\n\t}\n}", "func SetStateDb() {\n\tgenCode(flagSetStateDb)\n}", "func (fu *FlowUpdate) SetState(u uuid.UUID) *FlowUpdate {\n\tfu.mutation.SetState(u)\n\treturn fu\n}", "func (l *LED) SetState(s State) error {\n\tvar v int\n\tv, ok := l.states[s]\n\tif !ok {\n\t\treturn fmt.Errorf(\"unrecognized %s LED state %q [%d]\", l.spi.Name(), s, s)\n\t}\n\n\treturn l.spi.Write(v)\n}", "func (stateObj *stateObject) SetState(db StateDatabase, key, value common.Hash) {\n\t// If the fake storage is set, put the temporary state update here.\n\tif stateObj.fakeStorage != nil {\n\t\tstateObj.fakeStorage[key] = value\n\t\treturn\n\t}\n\t// If the new value is the same as old, don't set\n\tprev := stateObj.GetState(db, key)\n\tif prev == value {\n\t\treturn\n\t}\n\t// New value is different, update and journal the change\n\tstateObj.db.journal.append(storageChange{\n\t\taccount: &stateObj.address,\n\t\tkey: key,\n\t\tprevalue: prev,\n\t})\n\tstateObj.setState(key, value)\n}", "func (m *PrintJobStatus) SetState(value *PrintJobProcessingState)() {\n m.state = value\n}", "func (p *Resolver) SetState(state int64) {\n\tp.state.Store(state)\n}", "func (p *GORMPersistence) SetState(pk tm.PersistenceKey, state string) {\n\tp.DB.Clauses(clause.OnConflict{\n\t\tUpdateAll: true,\n\t}).Create(&ConversationState{\n\t\tPersistenceKey: pk,\n\t\tState: state,\n\t})\n}", "func SetState(stub shim.ChaincodeStubInterface) peer.Response {\r\n\targs := stub.GetStringArgs()\r\n\r\n\tif len(args) != 3 {\r\n\t\treturn shim.Error(\"Incorrect arguments. Expecting two arguments 'name of state' & 'state code'\")\r\n\t}\r\n\r\n\t_, err := strconv.Atoi(args[2])\r\n\tif err != nil {\r\n\t\treturn shim.Error(\"Incorrect data type state code should be a number!!!\")\r\n\t}\r\n\r\n\tkey := strings.ToLower(args[1])\r\n\tstub.PutState(key, []byte(args[2]))\r\n\r\n\treturn shim.Success([]byte(\"true\"))\r\n}", "func (ledger *Ledger) SetState(chaincodeID string, key string, value []byte) error {\n\tif key == \"\" || value == nil {\n\t\treturn newLedgerError(ErrorTypeInvalidArgument,\n\t\t\tfmt.Sprintf(\"An empty string key or a nil value is not supported. Method invoked with key='%s', value='%#v'\", key, value))\n\t}\n\treturn ledger.chaincodeState.Set(chaincodeID, key, value)\n}", "func (aru *AuthRequestUpdate) SetState(s string) *AuthRequestUpdate {\n\taru.mutation.SetState(s)\n\treturn aru\n}", "func (b *Button) SetState(state bool) {\n\tb.state = state\n}", "func SETCS(mr operand.Op) { ctx.SETCS(mr) }", "func (c *CmdBuff) SetActive(b bool) {\n\tc.mx.Lock()\n\t{\n\t\tc.active = b\n\t}\n\tc.mx.Unlock()\n\n\tc.fireActive(c.active)\n}", "func (c *Client) SetTransferState(t *Transfer, state string) error {\n\n\tllog.Tracef(\"[%v] [%v] Setting state %v\", c.shortId, t.id, state)\n\n\tcql := c.setTransferState\n\tcql.Bind(state, t.id, c.clientId)\n\trow := Row{}\n\tif applied, err := cql.MapScanCAS(row); err != nil || !applied {\n\t\tif err != nil {\n\t\t\treturn merry.Wrap(err)\n\t\t}\n\t\trowClientId, exists := row[\"client_id\"]\n\t\tif !exists || rowClientId == nilUuid {\n\t\t\tllog.Tracef(\"[%v] [%v] Failed to set state: no such transfer\",\n\t\t\t\tc.shortId, t.id)\n\t\t\treturn merry.Wrap(gocql.ErrNotFound)\n\t\t}\n\t\treturn merry.New(fmt.Sprintf(\"our id %v, previous id %v\",\n\t\t\tc.clientId, rowClientId))\n\t}\n\tt.state = state\n\treturn nil\n}", "func GuiSetState(state int) {\n\tC.GuiSetState(C.int(int32(state)))\n}", "func (f FooBarDef) SetState(state FooBarState) {\n\tf.ComponentDef.SetState(state)\n}", "func (self *StateObject) SetState(db trie.Database, key, value helper.Hash) {\n\tself.db.journal = append(self.db.journal, storageChange{\n\t\taccount: &self.address,\n\t\tkey: key,\n\t\tprevalue: self.GetState(db, key),\n\t})\n\tself.setState(key, value)\n}", "func (mg *MoveGen) SetState(st *GameState) {\n\tmg.state = st\n\n\t// reset any data associated with the old state\n\tmg.Clear()\n}", "func (c ChooserDef) SetState(state ChooserState) {\n\tc.ComponentDef.SetState(state)\n}", "func (r *Runner) SetState(state RunnerState) {\n\tr.state = state\n\tswitch r.state {\n\tcase Idle:\n\t\tr.animation.Play(\"Idle\")\n\tcase Running:\n\t\tr.animation.Play(\"Run\")\n\t}\n}", "func (r OperationStateFunc) SetOperationState(ctx context.Context, key SiteOperationKey, req SetOperationStateRequest) error {\n\treturn r(ctx, key, req)\n}", "func GuiSetState(state int32) {\n\tcstate, _ := (C.int)(state), cgoAllocsUnknown\n\tC.GuiSetState(cstate)\n}", "func (d *Dao) TxUpdateUserState(c context.Context, tx *sql.Tx, info *model.UserInfo) (err error) {\n\tif _, err = d.db.Exec(c, fmt.Sprintf(_updateUserStateSQL, hitInfo(info.Mid)), info.State, info.Mid); err != nil {\n\t\tlog.Error(\"TxUpdateUserState db.Exec(%d, %v) error(%v)\", info.Mid, info, err)\n\t\treturn\n\t}\n\treturn\n}", "func (ledger *Ledger) SetTxSetState(txSetID string, txSetStateValue *protos.TxSetStateValue) error {\n\tif txSetStateValue == nil {\n\t\treturn newLedgerError(ErrorTypeInvalidArgument,\n\t\t\tfmt.Sprintf(\"An empty transaction set state value is not supported. Method invoked with stateValue='%#v'\", txSetStateValue))\n\t}\n\tpreviousValue, err := ledger.GetTxSetState(txSetID, true)\n\tif err != nil {\n\t\treturn newLedgerError(ErrorTypeResourceNotFound,\n\t\t\tfmt.Sprintf(\"Error while trying to retrieve the previous state for txSetID='%s', err='%#v'\", txSetID, err))\n\t}\n\tif previousValue == nil {\n\t\tpreviousValue = &protos.TxSetStateValue{}\n\t}\n\tif txSetStateValue.Nonce != previousValue.Nonce+1 {\n\t\treturn newLedgerError(ErrorTypeInvalidArgument,\n\t\t\tfmt.Sprintf(\"Wrong nonce update. Previous nonce: %d, new nonce: %d\", previousValue.Nonce, txSetStateValue.Nonce))\n\t}\n\tif previousValue.IntroBlock != 0 && previousValue.IntroBlock != txSetStateValue.IntroBlock {\n\t\treturn newLedgerError(ErrorTypeInvalidArgument,\n\t\t\tfmt.Sprintf(\"A mutant transaction or an extension to a set cannot modify the intro block. Prev Intro Block: [%d], New Intro Block: [%d]\", previousValue.IntroBlock, txSetStateValue.IntroBlock))\n\t}\n\tif previousValue.IntroBlock != 0 && previousValue.Index != txSetStateValue.Index {\n\t\terr = previousValue.IsValidMutation(txSetStateValue)\n\t\tif err != nil {\n\t\t\treturn newLedgerError(ErrorTypeInvalidArgument, err.Error())\n\t\t}\n\t} else {\n\t\terr = previousValue.IsValidBlockExtension(txSetStateValue)\n\t\tif err != nil {\n\t\t\treturn newLedgerError(ErrorTypeInvalidArgument, err.Error())\n\t\t}\n\t}\n\treturn ledger.txSetState.Set(txSetID, txSetStateValue)\n}", "func (ftc *FileTypeCreate) SetState(f filetype.State) *FileTypeCreate {\n\tftc.mutation.SetState(f)\n\treturn ftc\n}", "func (b *Button) SetState(highlight bool) {\n\twParam := 0\n\tif highlight {\n\t\twParam = 1\n\t}\n\tb.SendMessage(win.BM_SETSTATE, uintptr(wParam), 0)\n}", "func (s *Tplink) ChangeState(state bool) error {\n\tvar payload changeState\n\n\tif state {\n\t\tpayload.System.SetRelayState.State = 1\n\t} else {\n\t\tpayload.System.SetRelayState.State = 0\n\t}\n\n\tj, _ := json.Marshal(payload)\n\tdata := encrypt(string(j))\n\tif _, err := send(s.Host, data); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (b *ClusterUpgradeBuilder) State(value string) *ClusterUpgradeBuilder {\n\tb.state = value\n\tb.bitmap_ |= 2\n\treturn b\n}", "func (ms *StatusImpl) SetStateContext(state orderer.ConsensusType_MigrationState, context uint64) {\n\tms.mutex.Lock()\n\tdefer ms.mutex.Unlock()\n\tms.state = state\n\tms.context = context\n}", "func (d *Database) UpdateState(r *models.RemoteData) error {\n\tstate := d.State\n\tstate.Operation = r.Operation\n\tstate.Mode = r.Mode\n\tif r.Temp != 0 {\n\t\tstate.ModeData[state.Mode].Temp = r.Temp\n\t}\n\tstate.ModeData[state.Mode].Fan = r.Fan\n\tstate.ModeData[state.Mode].HorizontalVane = r.HorizontalVane\n\n\t// Disabled: this option only use for send. KEEP DEFAULT VALUE.\n\t//state.ModeData[state.Mode].VerticalVane = r.VerticalVane\n\treturn nil\n}", "func (g *Group) SetStateContext(ctx context.Context, s State) error {\n\t_, err := g.bridge.SetGroupStateContext(ctx, g.ID, s)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.State = &s\n\treturn nil\n}", "func (c *Controller) MarkSparseBlockDeviceStateActive(sparseFile string, sparseFileSize int64) {\n\t// Fill in the details of the sparse disk\n\tBlockDeviceDetails := NewDeviceInfo()\n\tBlockDeviceDetails.UUID = GetSparseBlockDeviceUUID(c.NodeAttributes[HostNameKey], sparseFile)\n\tBlockDeviceDetails.NodeAttributes = c.NodeAttributes\n\n\tBlockDeviceDetails.DeviceType = blockdevice.SparseBlockDeviceType\n\tBlockDeviceDetails.Path = sparseFile\n\n\tsparseFileInfo, err := util.SparseFileInfo(sparseFile)\n\tif err != nil {\n\t\tklog.Info(\"Error fetching the size of sparse file: \", err)\n\t\tklog.Error(\"Failed to create a block device CR for sparse file: \", sparseFile)\n\t\treturn\n\t}\n\n\tBlockDeviceDetails.Capacity = uint64(sparseFileInfo.Size())\n\n\t//If a BlockDevice CR already exits, update it. If not create a new one.\n\tklog.Info(\"Updating the BlockDevice CR for Sparse file: \", BlockDeviceDetails.UUID)\n\tbd, err := BlockDeviceDetails.ToDevice(c)\n\tif err != nil {\n\t\tklog.Error(\"Failed to create a block device resource CR, Error: \", err)\n\t\treturn\n\t}\n\n\terr = c.CreateBlockDevice(bd)\n\tif err != nil {\n\t\tklog.Error(\"Failed to create a block device resource in etcd, Error: \", err)\n\t}\n}", "func (ws *workingSet) SetContractState(addr hash.PKHash, key, value hash.Hash32B) error {\n\tif contract, ok := ws.cachedContract[addr]; ok {\n\t\treturn contract.SetState(key, value[:])\n\t}\n\tcontract, err := ws.getContract(addr)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to SetContractState for contract %x\", addr)\n\t}\n\treturn contract.SetState(key, value[:])\n}", "func (p *PhidgetDigitalOutput) SetState(state bool) error {\n\treturn p.phidgetError(C.PhidgetDigitalOutput_setState(p.handle, boolToCInt(state)))\n}", "func (ec EncryptedStateContext) State() state.State {\n\ts, _ := StateWithTransientKey(ec)\n\treturn s\n}", "func (uc *UserCreate) SetState(s string) *UserCreate {\n\tuc.mutation.SetState(s)\n\treturn uc\n}", "func SetState(pinNum int, state int) error {\n\tvar err error\n\n\t//Validate function input\n\tif state != 1 || state != 0 {\n\t\treturn ErrNoState\n\t}\n\n\t//Open gpio memory range\n\terr = rpio.Open()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rpio.Close() //Close gpio memory range when function ends\n\n\t//Convert pin Number to pin\n\tpin := rpio.Pin(pinNum)\n\t//Set pin mode to write\n\tpin.Mode(rpio.Output)\n\t//Write mode to gpio pin\n\tpin.Write(rpio.State(state))\n\n\tfmt.Println(pinNum)\n\treturn nil\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.55562073", "0.5548135", "0.55433047", "0.5535438", "0.5526308", "0.55237657", "0.5505326", "0.5489259", "0.54855806", "0.5438931", "0.54154235", "0.540999", "0.53943795", "0.53789717", "0.53784513", "0.5375267", "0.536518", "0.53627366", "0.53619474", "0.53473276", "0.53212124", "0.53207284", "0.5312473", "0.53036034", "0.5267719", "0.5265048", "0.52618784", "0.52618784", "0.52618784", "0.5261292", "0.5221948", "0.5219208", "0.5203863", "0.5203034", "0.51982", "0.5197856", "0.5189059", "0.51863164", "0.5160585", "0.5157986", "0.515754", "0.5141639", "0.5129751", "0.51231396", "0.51087344", "0.509197", "0.50900406", "0.507554", "0.5074461", "0.50686455", "0.5049944", "0.50439084", "0.50393033", "0.5034286", "0.50297123", "0.50294113", "0.5020332", "0.50121707", "0.50077486", "0.49997205", "0.49947923", "0.49928257", "0.4983068", "0.49809933", "0.4969598", "0.4965317", "0.4963209", "0.49620914", "0.495119", "0.49447936", "0.4940437", "0.49380505", "0.4931114", "0.49137706", "0.4879326", "0.4835969", "0.48284093", "0.48228487", "0.48212638" ]
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 }).(pulumi.StringOutput)\n}", "func (c *Counter) CreationTime() time.Time {\n\treturn c.creationTime\n}", "func (e GenericPersistable) GetTimeCreated() time.Time {\n\t\treturn time.Now()\n\t}", "func (o SslCertOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SslCert) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o NodeOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Node) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (store *sqlStore) CreationTime() time.Time {\n\treturn store.cache.CreationTime()\n}", "func (o DatastoreOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Datastore) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (b *base) DateCreatedUTC() time.Time { return b.DateCreatedUTCx }", "func (o DebugSessionOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *DebugSession) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (p *Process) CreateTime() (int64, error) {\n\treturn p.CreateTimeWithContext(context.Background())\n}", "func (o ConnectionProfileOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ConnectionProfile) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (m *TeamsAsyncOperation) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n return m.createdDateTime\n}", "func (o ShareOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Share) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o LaunchOutput) CreatedTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Launch) pulumi.StringOutput { return v.CreatedTime }).(pulumi.StringOutput)\n}", "func (o TargetProjectOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *TargetProject) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o TaskOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Task) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o DatabaseOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Database) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o ConnectorOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Connector) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o GetChainsChainOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetChainsChain) string { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o TrackerOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Tracker) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o InstanceServerCaCertOutput) CreateTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v InstanceServerCaCert) *string { return v.CreateTime }).(pulumi.StringPtrOutput)\n}", "func (o LookupConnectivityTestResultOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupConnectivityTestResult) string { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (g *Generator) Created() time.Time {\n\tif g.image.Created == nil {\n\t\t// TODO: Maybe we should be returning pointers?\n\t\treturn time.Time{}\n\t}\n\treturn *g.image.Created\n}", "func (s *StreamInfo) CreationTime() time.Time {\n\treturn s.creationTime\n}", "func (m *AccessPackageCatalog) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n return m.createdDateTime\n}", "func (o KeyOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Key) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (m *AccessPackage) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n return m.createdDateTime\n}", "func (o InstanceOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o InstanceOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o InstanceOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o TrustConfigOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *TrustConfig) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o BareMetalAdminClusterOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *BareMetalAdminCluster) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o LookupInstanceResultOutput) CreatedTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupInstanceResult) string { return v.CreatedTime }).(pulumi.StringOutput)\n}", "func (o JobOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Job) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o WorkflowOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Workflow) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o EntitlementOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Entitlement) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o ConversationModelOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ConversationModel) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o CapacityReservationOutput) CreationTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *CapacityReservation) pulumi.StringOutput { return v.CreationTime }).(pulumi.StringOutput)\n}", "func (m *CallTranscript) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"createdDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}", "func (m *ThreatAssessmentRequest) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n return m.createdDateTime\n}", "func (o LienOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Lien) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o AppGatewayOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *AppGateway) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o *SSHAuthority) GetCreateTime() time.Time {\n\n\treturn o.CreateTime\n}", "func (id ObjectId) CreationTime() int64 {\n\tif len(id) != 12 {\n\t\treturn 0\n\t}\n\treturn int64(id[0])<<24 + int64(id[1])<<16 + int64(id[2])<<8 + int64(id[3])\n}", "func (c *conn) Created() time.Time {\n\t// We don't need to lock because the key never changes after creation\n\treturn c.key.Time()\n}", "func (o LakeOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Lake) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o WorkerPoolOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *WorkerPool) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o WorkerPoolOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *WorkerPool) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (m *Vulnerability) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"createdDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}", "func (o TlsCertificateResponseOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v TlsCertificateResponse) string { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o LookupProjectResultOutput) CreationTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LookupProjectResult) *string { return v.CreationTime }).(pulumi.StringPtrOutput)\n}", "func (o BackupOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Backup) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (m *ThreatAssessmentResult) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n return m.createdDateTime\n}", "func (m *ProgramControl) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"createdDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}", "func (m *ThreatAssessmentRequest) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"createdDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}", "func (o LookupTestCaseResultOutput) CreationTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupTestCaseResult) string { return v.CreationTime }).(pulumi.StringOutput)\n}", "func (o *SparseSSHAuthority) GetCreateTime() (out time.Time) {\n\n\tif o.CreateTime == nil {\n\t\treturn\n\t}\n\n\treturn *o.CreateTime\n}", "func (o SslCertificateOutput) CreationTimestamp() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SslCertificate) pulumi.StringOutput { return v.CreationTimestamp }).(pulumi.StringOutput)\n}", "func (o GetClustersClusterOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetClustersCluster) string { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o LookupDatasetResultOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupDatasetResult) string { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o DiskReplicaPairOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *DiskReplicaPair) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o PreventionDeidentifyTemplateOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *PreventionDeidentifyTemplate) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (m *NamedLocation) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n return m.createdDateTime\n}", "func (o ReservedInstanceOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ReservedInstance) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o LookupConnectionProfileResultOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupConnectionProfileResult) string { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o LookupTargetProjectResultOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupTargetProjectResult) string { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o AiFeatureStoreEntityTypeFeatureOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *AiFeatureStoreEntityTypeFeature) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o StudyOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Study) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o LookupModelBiasJobDefinitionResultOutput) CreationTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LookupModelBiasJobDefinitionResult) *string { return v.CreationTime }).(pulumi.StringPtrOutput)\n}", "func (o *PendingDeleteCluster) CreationTimestamp() time.Time {\n\tif o != nil && o.bitmap_&32 != 0 {\n\t\treturn o.creationTimestamp\n\t}\n\treturn time.Time{}\n}", "func (c *PoolConn) CreatedAt() time.Time {\n\treturn c.createdAt\n}", "func (o LookupPipelineResultOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupPipelineResult) string { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (m *Application) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n return m.createdDateTime\n}", "func (o ModelExplainabilityJobDefinitionOutput) CreationTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ModelExplainabilityJobDefinition) pulumi.StringOutput { return v.CreationTime }).(pulumi.StringOutput)\n}", "func (m *LongRunningOperation) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"createdDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}", "func (m *ManagementTemplateStep) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"createdDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}", "func (m *CarMutation) CreateTime() (r time.Time, exists bool) {\n\tv := m.create_time\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "func (o EvaluationOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Evaluation) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o LookupOrganizationSinkResultOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupOrganizationSinkResult) string { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (h *Histogram) CreationTime() time.Time {\n\treturn h.creationTime\n}", "func (c *MsgConnection) Created() time.Time {\n\treturn c.created\n}", "func (o DirectoryConfigOutput) CreatedTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *DirectoryConfig) pulumi.StringOutput { return v.CreatedTime }).(pulumi.StringOutput)\n}", "func (o LookupFeatureResultOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupFeatureResult) string { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o PatchDeploymentOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *PatchDeployment) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o LookupClientTlsPolicyResultOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupClientTlsPolicyResult) string { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o GetChartRepositoriesRepositoryOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetChartRepositoriesRepository) string { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (m *ManagedAppPolicy) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n return m.createdDateTime\n}", "func (m *Group) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n return m.createdDateTime\n}", "func (t Tweet) CreatedAtTime() (time.Time, error) {\n\treturn time.Parse(\"2006-01-02T15:04:05.000Z\", t.CreatedAt)\n}", "func (m *User) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n return m.createdDateTime\n}", "func (o LookupProxyConfigResultOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupProxyConfigResult) string { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o GetVpdsVpdOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetVpdsVpd) string { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (img Image) GetCreated() time.Time {\n\treturn img.Created\n}", "func (o LookupSecretResultOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupSecretResult) string { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o AuthorizationPolicyOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *AuthorizationPolicy) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (o LookupDeliveryPipelineResultOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupDeliveryPipelineResult) string { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (m *ManagementTemplateStepTenantSummary) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"createdDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}", "func (o LookupExecutionResultOutput) CreateTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupExecutionResult) string { return v.CreateTime }).(pulumi.StringOutput)\n}", "func (m *CustomAccessPackageWorkflowExtension) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {\n val, err := m.GetBackingStore().Get(\"createdDateTime\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)\n }\n return nil\n}" ]
[ "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.63616353", "0.63456243", "0.632983", "0.63236094", "0.6322891", "0.6316823", "0.6299857", "0.6290136", "0.6290136", "0.6290136", "0.6282737", "0.6281997", "0.62553674", "0.62541044", "0.6253554", "0.6236947", "0.62366366", "0.62319523", "0.62224424", "0.62135005", "0.62093663", "0.6208361", "0.6197251", "0.61955786", "0.618838", "0.61798793", "0.6159765", "0.6159765", "0.6144489", "0.6142599", "0.6140457", "0.6137427", "0.6136768", "0.6119461", "0.6101485", "0.60889524", "0.6086429", "0.60825944", "0.6082129", "0.6075632", "0.6075102", "0.6072439", "0.6071073", "0.60709596", "0.60705066", "0.6069742", "0.60599655", "0.60450953", "0.6041566", "0.60372555", "0.6033422", "0.60285425", "0.6028347", "0.6026353", "0.6026049", "0.6021441", "0.60122424", "0.6002605", "0.60015774", "0.599345", "0.59905237", "0.59893656", "0.59866583", "0.5978554", "0.59709567", "0.59647787", "0.5946234", "0.59378546", "0.5936568", "0.5935401", "0.59340227", "0.59302396", "0.5929941", "0.59283423", "0.5920068", "0.591819", "0.591422", "0.59111047", "0.5909761" ]
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 time.Now().Sub(t)\n}", "func (i *Interest) Lifetime() time.Duration {\n\treturn i.lifetime\n}", "func (r *Route) lifetime() time.Duration {\n\tif !r.Deprecated {\n\t\treturn r.Lifetime\n\t}\n\n\tif r.Epoch.IsZero() {\n\t\tpanic(\"plugin: cannot calculate deprecated Route lifetimes with zero epoch\")\n\t}\n\n\tnow := r.TimeNow()\n\tlt := r.Epoch.Add(r.Lifetime)\n\n\tif now.Equal(lt) || now.After(lt) {\n\t\treturn 0\n\t}\n\n\treturn lt.Sub(now)\n}", "func (o CertificateOutput) Lifetime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Certificate) pulumi.StringPtrOutput { return v.Lifetime }).(pulumi.StringPtrOutput)\n}", "func (i *Incarnation) TTL() time.Duration {\n\tr := time.Duration(0)\n\tif i.status != nil {\n\t\tr = time.Duration(i.status.TTL) * time.Second\n\t}\n\treturn r\n}", "func (cont *Container) AllocatedTime() time.Duration {\n\treturn delta(cont.Destroy, cont.Create)\n}", "func GetLifetime(agentID uuid.UUID) (time.Duration, error) {\n\tif core.Debug {\n\t\tmessage(\"debug\", \"Entering into agents.GetLifeTime\")\n\t}\n\t// Check to make sure it is a known agent\n\tif !isAgent(agentID) {\n\t\treturn 0, fmt.Errorf(\"%s is not a known agent\", agentID)\n\t}\n\n\t// Check to see if PID is set to know if the first AgentInfo message has been sent\n\tif Agents[agentID].Pid == 0 {\n\t\treturn 0, nil\n\t}\n\n\tsleep, errSleep := time.ParseDuration(Agents[agentID].WaitTime)\n\tif errSleep != nil {\n\t\treturn 0, fmt.Errorf(\"there was an error parsing the agent WaitTime to a duration:\\r\\n%s\", errSleep.Error())\n\t}\n\tif sleep == 0 {\n\t\treturn 0, fmt.Errorf(\"agent WaitTime is equal to zero\")\n\t}\n\n\tretry := Agents[agentID].MaxRetry\n\tif retry == 0 {\n\t\treturn 0, fmt.Errorf(\"agent MaxRetry is equal to zero\")\n\t}\n\n\tskew := time.Duration(Agents[agentID].Skew) * time.Millisecond\n\tmaxRetry := Agents[agentID].MaxRetry\n\n\t// Calculate the worst case scenario that an agent could be alive before dying\n\tlifetime := sleep + skew\n\tfor maxRetry > 1 {\n\t\tlifetime = lifetime + (sleep + skew)\n\t\tmaxRetry--\n\t}\n\n\tif Agents[agentID].KillDate > 0 {\n\t\tif time.Now().Add(lifetime).After(time.Unix(Agents[agentID].KillDate, 0)) {\n\t\t\treturn 0, fmt.Errorf(\"the agent lifetime will exceed the killdate\")\n\t\t}\n\t}\n\n\tif core.Debug {\n\t\tmessage(\"debug\", \"Leaving agents.GetLifeTime without error\")\n\t}\n\n\treturn lifetime, nil\n\n}", "func (tm *CompilationTelemetry) CompilationDurationNS() int64 {\n\treturn tm.compilationDuration.Nanoseconds()\n}", "func (tj *TensorFlowJob) Duration() time.Duration {\n\tjob := tj.tfjob\n\n\tif job.Status.StartTime == nil ||\n\t\tjob.Status.StartTime.IsZero() {\n\t\treturn 0\n\t}\n\n\tif !job.Status.CompletionTime.IsZero() {\n\t\treturn job.Status.CompletionTime.Time.Sub(job.Status.StartTime.Time)\n\t}\n\n\tif tj.GetStatus() == \"FAILED\" {\n\t\tcond := getPodLatestCondition(tj.chiefPod)\n\t\tif !cond.LastTransitionTime.IsZero() {\n\t\t\treturn cond.LastTransitionTime.Time.Sub(job.Status.StartTime.Time)\n\t\t} else {\n\t\t\tlog.Debugf(\"the latest condition's time is zero of pod %s\", tj.chiefPod.Name)\n\t\t}\n\t}\n\n\treturn metav1.Now().Sub(job.Status.StartTime.Time)\n}", "func ExampleLifetime() {\n\t// Create a lifetime and initialises it.\n\tlt := lifetime.New(context.Background()).\n\t\tInit()\n\n\tfmt.Printf(\"Starting services\\n\")\n\n\t// Service A takes 100ms to start up and 800ms to shutdown.\n\tserviceA := &testService{\n\t\tname: \"a\",\n\t\tstartupDuration: time.Millisecond * 100,\n\t\tshutdownDuration: time.Millisecond * 800,\n\t}\n\t// Service B takes 800ms to start up and 100ms to shutdown.\n\tserviceB := &testService{\n\t\tname: \"b\",\n\t\tstartupDuration: time.Millisecond * 800,\n\t\tshutdownDuration: time.Millisecond * 100,\n\t}\n\n\t// Start both services.\n\tlt.Start(serviceA)\n\tlt.Start(serviceB)\n\n\t// Wait some time and trigger an application shutdown.\n\tgo func() {\n\t\t<-time.After(time.Millisecond * 1500)\n\t\tfmt.Printf(\"Shutting down\\n\")\n\t\tlt.Shutdown()\n\t}()\n\n\t// Wait for all services to stop.\n\tlt.Wait()\n\n\tfmt.Printf(\"Shutdown\\n\")\n\n\t// Output:\n\t// Starting services\n\t// a: Started\n\t// b: Started\n\t// Shutting down\n\t// b: Stopped\n\t// a: Stopped\n\t// Shutdown\n}", "func (tj *TensorFlowJob) Age() time.Duration {\n\tjob := tj.tfjob\n\n\tif job.Status.StartTime == nil ||\n\t\tjob.Status.StartTime.IsZero() {\n\t\treturn 0\n\t}\n\treturn metav1.Now().Sub(job.Status.StartTime.Time)\n}", "func (item *CacheItem) LifeSpan() time.Duration {\n\treturn item.lifeSpan\n}", "func (b BaseDefender) ConstructionTime(nbr, universeSpeed int64, facilities Facilities, hasTechnocrat, isDiscoverer bool) time.Duration {\n\tshipyardLvl := float64(facilities.Shipyard)\n\tnaniteLvl := float64(facilities.NaniteFactory)\n\thours := float64(b.StructuralIntegrity) / (2500 * (1 + shipyardLvl) * float64(universeSpeed) * math.Pow(2, naniteLvl))\n\tsecs := math.Max(1, hours*3600)\n\treturn time.Duration(int64(math.Floor(secs))*nbr) * time.Second\n}", "func (spec *Spec) CAExpireTime() time.Time {\n\treturn spec.expiry.CA\n}", "func (spec *Spec) CAExpireTime() time.Time {\n\treturn spec.expiry.CA\n}", "func (f *lazyCallReq) TTL() time.Duration {\n\tttl := binary.BigEndian.Uint32(f.Payload[_ttlIndex : _ttlIndex+_ttlLen])\n\treturn time.Duration(ttl) * time.Millisecond\n}", "func (c Certificate) Duration() time.Duration {\n\treturn c.ExpiresAt.Sub(c.IssuedAt)\n}", "func CfgGcLifeTime(lifeTime int64) ManagerConfigOpt {\n\treturn func(config *ManagerConfig) {\n\t\tconfig.Gclifetime = lifeTime\n\t}\n}", "func computeRenewLeaseTimerDuration(ttlInSeconds int64) time.Duration {\n\treturn time.Duration(ttlInSeconds-4 /* seconds is enough for renew */) * time.Second\n}", "func now() time.Duration { return time.Since(startTime) }", "func (p *Config) SessionLifespan(ctx context.Context) time.Duration {\n\treturn p.GetProvider(ctx).DurationF(ViperKeySessionLifespan, time.Hour*24)\n}", "func seconds(ttl time.Duration) int64 {\n\ti := int64(ttl / time.Second)\n\tif i <= 0 {\n\t\ti = 1\n\t}\n\treturn i\n}", "func (c *Counter) CreationTime() time.Time {\n\treturn c.creationTime\n}", "func (p *Prefix) lifetimes() (valid, pref time.Duration) {\n\tif !p.Deprecated {\n\t\treturn p.ValidLifetime, p.PreferredLifetime\n\t}\n\n\tif p.Epoch.IsZero() {\n\t\tpanic(\"plugin: cannot calculate deprecated Prefix lifetimes with zero epoch\")\n\t}\n\n\tnow := p.TimeNow()\n\n\tvar (\n\t\tvalidT = p.Epoch.Add(p.ValidLifetime)\n\t\tprefT = p.Epoch.Add(p.PreferredLifetime)\n\t)\n\n\tif now.Equal(validT) || now.After(validT) {\n\t\tvalid = 0\n\t} else {\n\t\tvalid = validT.Sub(now)\n\t}\n\n\tif now.Equal(prefT) || now.After(prefT) {\n\t\tpref = 0\n\t} else {\n\t\tpref = prefT.Sub(now)\n\t}\n\n\treturn valid, pref\n}", "func timeExpired() int64 {\n\ttimeExpired := timeStamp() + 60\n\n\treturn timeExpired\n}", "func (state *RuntimeState) GetCertExpirationtime(eachDir string) {\n\tfileNewPath := filepath.Join(state.Config.CertStoreName, eachDir, RenewalfileName)\n\tyamlFile, err := ioutil.ReadFile(fileNewPath)\n\tif err != nil {\n\t\tlog.Printf(\"yamlFile \", err)\n\t\treturn\n\t}\n\trenew := RenewalInfo{}\n\terr = yaml.Unmarshal(yamlFile, &renew)\n\tif err != nil {\n\t\tlog.Println(\"Unmarshal: %v\", err)\n\t\treturn\n\t}\n\tstate.RenewalInfoMutex.Lock()\n\tstate.Renewalinfo[eachDir] = renew\n\tstate.RenewalInfoMutex.Unlock()\n}", "func (c *Context) GetTime() float64 {\n\treturn float64(C.glfwGetTime())\n}", "func (c *Context) GetTime() float64 {\n\treturn float64(C.glfwGetTime())\n}", "func (spec *Spec) CertExpireTime() time.Time {\n\treturn spec.expiry.Cert\n}", "func (spec *Spec) CertExpireTime() time.Time {\n\treturn spec.expiry.Cert\n}", "func (c *ProcessorConfig) PoolConnLifetimeSecs() *int {\n\treturn c.PersisterPostgresConnLife\n}", "func (i *TelemetryStorage) GetSessionLength() int64 {\n\treturn atomic.LoadInt64(&i.records.session)\n}", "func (c *Compiler) emitLifetimeEnd(ptr, size llvm.Value) {\n\tllvmutil.EmitLifetimeEnd(c.builder, c.mod, ptr, size)\n}", "func (s UpdateStatement) TTL() time.Duration {\n\tif s.ttl < time.Duration(1) {\n\t\treturn time.Duration(0)\n\t}\n\treturn s.ttl\n}", "func (p *Package) LifetimeOf(obj types.Object) ObjectLifetime {\n\treturn p.lifetimes[obj]\n}", "func (s *Suite) TestAttemptLifetime(c *check.C) {\n\tvar (\n\t\terr error\n\t\tdata map[string]interface{}\n\t\tattempt, attempt2 coordinate.Attempt\n\t\taStatus coordinate.AttemptStatus\n\t\tspec coordinate.WorkSpec\n\t\tunit coordinate.WorkUnit\n\t\tworker coordinate.Worker\n\t\tuStatus coordinate.WorkUnitStatus\n\t)\n\tspec, worker = s.makeWorkSpecAndWorker(c)\n\n\t// Create a work unit\n\tunit, err = spec.AddWorkUnit(\"a\", map[string]interface{}{}, 0.0)\n\tc.Assert(err, check.IsNil)\n\n\t// The work unit should be \"available\"\n\tuStatus, err = unit.Status()\n\tc.Assert(err, check.IsNil)\n\tc.Check(uStatus, check.Equals, coordinate.AvailableUnit)\n\n\t// The work unit data should be defined but empty\n\tdata, err = unit.Data()\n\tc.Assert(err, check.IsNil)\n\tc.Check(data, check.HasLen, 0)\n\n\t// Get an attempt for it\n\tattempts, err := worker.RequestAttempts(coordinate.AttemptRequest{})\n\tc.Assert(err, check.IsNil)\n\tc.Assert(attempts, check.HasLen, 1)\n\tattempt = attempts[0]\n\n\t// The work unit should be \"pending\"\n\tuStatus, err = unit.Status()\n\tc.Assert(err, check.IsNil)\n\tc.Check(uStatus, check.Equals, coordinate.PendingUnit)\n\n\t// The attempt should be \"pending\" too\n\taStatus, err = attempt.Status()\n\tc.Assert(err, check.IsNil)\n\tc.Check(aStatus, check.Equals, coordinate.Pending)\n\n\t// The active attempt for the unit should match this\n\tattempt2, err = unit.ActiveAttempt()\n\tc.Assert(err, check.IsNil)\n\tc.Check(attempt2, AttemptMatches, attempt)\n\n\t// There should be one active attempt for the worker and it should\n\t// also match\n\tattempts, err = worker.ActiveAttempts()\n\tc.Assert(err, check.IsNil)\n\tc.Check(attempts, check.HasLen, 1)\n\tif len(attempts) > 0 {\n\t\tc.Check(attempts[0], AttemptMatches, attempt)\n\t}\n\n\t// The work unit data should (still) be defined but empty\n\tdata, err = unit.Data()\n\tc.Assert(err, check.IsNil)\n\tc.Check(data, check.HasLen, 0)\n\n\t// Now finish the attempt with some updated data\n\terr = attempt.Finish(map[string]interface{}{\n\t\t\"outputs\": []string{\"yes\"},\n\t})\n\tc.Assert(err, check.IsNil)\n\n\t// The unit should report \"finished\"\n\tuStatus, err = unit.Status()\n\tc.Assert(err, check.IsNil)\n\tc.Check(uStatus, check.Equals, coordinate.FinishedUnit)\n\n\t// The attempt should report \"finished\"\n\taStatus, err = attempt.Status()\n\tc.Assert(err, check.IsNil)\n\tc.Check(aStatus, check.Equals, coordinate.Finished)\n\n\t// The attempt should still be the active attempt for the unit\n\tattempt2, err = unit.ActiveAttempt()\n\tc.Assert(err, check.IsNil)\n\tc.Check(attempt2, AttemptMatches, attempt)\n\n\t// The attempt should not be in the active attempt list for the worker\n\tattempts, err = worker.ActiveAttempts()\n\tc.Assert(err, check.IsNil)\n\tc.Check(attempts, check.HasLen, 0)\n\n\t// Both the unit and the worker should have one archived attempt\n\tattempts, err = unit.Attempts()\n\tc.Assert(err, check.IsNil)\n\tc.Check(attempts, check.HasLen, 1)\n\tif len(attempts) > 0 {\n\t\tc.Check(attempts[0], AttemptMatches, attempt)\n\t}\n\n\tattempts, err = worker.AllAttempts()\n\tc.Assert(err, check.IsNil)\n\tc.Check(attempts, check.HasLen, 1)\n\tif len(attempts) > 0 {\n\t\tc.Check(attempts[0], AttemptMatches, attempt)\n\t}\n\n\t// This should have updated the visible work unit data too\n\tdata, err = unit.Data()\n\tc.Assert(err, check.IsNil)\n\tc.Check(data, check.HasLen, 1)\n\tc.Check(data[\"outputs\"], check.HasLen, 1)\n\tc.Check(reflect.ValueOf(data[\"outputs\"]).Index(0).Interface(),\n\t\tcheck.Equals, \"yes\")\n\n\t// For bonus points, force-clear the active attempt\n\terr = unit.ClearActiveAttempt()\n\tc.Assert(err, check.IsNil)\n\n\t// This should have pushed the unit back to available\n\tuStatus, err = unit.Status()\n\tc.Assert(err, check.IsNil)\n\tc.Check(uStatus, check.Equals, coordinate.AvailableUnit)\n\n\t// This also should have reset the work unit data\n\tdata, err = unit.Data()\n\tc.Assert(err, check.IsNil)\n\tc.Check(data, check.HasLen, 0)\n\n\t// But, this should not have reset the historical attempts\n\tattempts, err = unit.Attempts()\n\tc.Assert(err, check.IsNil)\n\tc.Check(attempts, check.HasLen, 1)\n\tif len(attempts) > 0 {\n\t\tc.Check(attempts[0], AttemptMatches, attempt)\n\t}\n\n\tattempts, err = worker.AllAttempts()\n\tc.Assert(err, check.IsNil)\n\tc.Check(attempts, check.HasLen, 1)\n\tif len(attempts) > 0 {\n\t\tc.Check(attempts[0], AttemptMatches, attempt)\n\t}\n}", "func (transaction *TokenUpdateTransaction) GetTransactionValidDuration() time.Duration {\n\treturn transaction.Transaction.GetTransactionValidDuration()\n}", "func (m *LengthtimeMutation) Lengthtime() (r string, exists bool) {\n\tv := m.lengthtime\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "func TTL(t time.Duration) func(Call) error {\n\treturn func(o Call) error {\n\t\tm, ok := o.(*Mutate)\n\t\tif !ok {\n\t\t\treturn errors.New(\"'TTL' option can only be used with mutation queries\")\n\t\t}\n\n\t\tbuf := make([]byte, 8)\n\t\tbinary.BigEndian.PutUint64(buf, uint64(t.Nanoseconds()/1e6))\n\t\tm.ttl = buf\n\n\t\treturn nil\n\t}\n}", "func (s InsertStatement) TTL() time.Duration {\n\tif s.ttl < time.Duration(1) {\n\t\treturn time.Duration(0)\n\t}\n\treturn s.ttl\n}", "func (m PeerMeta) TTL() time.Duration {\n\tif m.Designated {\n\t\treturn DesignatedNodeTTL\n\t}\n\treturn DefaultNodeTTL\n}", "func TestInfoStoreGetInfoTTL(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\tstopper := stop.NewStopper()\n\tdefer stopper.Stop()\n\tis := newInfoStore(1, emptyAddr, stopper)\n\ti := is.newInfo(nil, time.Nanosecond)\n\tif err := is.addInfo(\"a\", i); err != nil {\n\t\tt.Error(err)\n\t}\n\ttime.Sleep(time.Nanosecond)\n\tif is.getInfo(\"a\") != nil {\n\t\tt.Error(\"shouldn't be able to get info with short TTL\")\n\t}\n}", "func (tcertBlock *TCertBlock) isExpired() bool {\n\ttsNow := time.Now()\n\tnotAfter := tcertBlock.GetTCert().GetCertificate().NotAfter\n\tpoolLogger.Debugf(\"#isExpired: %s now: %s deadline: %s \\n \", tsNow.Add(fivemin).After(notAfter), tsNow, notAfter)\n\tif tsNow.Add(fivemin).After(notAfter) {\n\t\treturn true\n\t}\n\treturn false\n}", "func gcInterval(cfg *config.Config) time.Duration {\n\tgcInterval := defaultGCInterval\n\tif time.Duration(cfg.GlobalConfig.ScrapeInterval)+gcIntervalDelta > gcInterval {\n\t\tgcInterval = time.Duration(cfg.GlobalConfig.ScrapeInterval) + gcIntervalDelta\n\t}\n\tfor _, scrapeConfig := range cfg.ScrapeConfigs {\n\t\tif time.Duration(scrapeConfig.ScrapeInterval)+gcIntervalDelta > gcInterval {\n\t\t\tgcInterval = time.Duration(scrapeConfig.ScrapeInterval) + gcIntervalDelta\n\t\t}\n\t}\n\treturn gcInterval\n}", "func (self *PhysicsP2) UseElapsedTime() bool{\n return self.Object.Get(\"useElapsedTime\").Bool()\n}", "func (tcertBlock *TCertBlock) isUpdateExpired(reusedUpdateSecond int) bool {\n\tnotAfter := tcertBlock.GetTCert().GetCertificate().NotAfter\n\ttsNow := time.Now()\n\tif reusedUpdateSecond == 0 {\n\n\t\t//default reusedUpdateSecond is one week or 1/3 of the cert life, the shorter takes\n\t\tnotBefore := tcertBlock.GetTCert().GetCertificate().NotBefore\n\t\ttimeDel := notAfter.Sub(notBefore) / 3\n\n\t\tif timeDel < time.Duration(oneweek) {\n\t\t\treusedUpdateSecond = int(timeDel)\n\t\t} else {\n\t\t\treusedUpdateSecond = int(oneweek)\n\t\t}\n\t}\n\n\tpoolLogger.Debugf(\"#isUpdateExpired now: %s deadline: %s \\n \", tsNow, notAfter)\n\n\treturn tsNow.Add(time.Duration(reusedUpdateSecond)).After(notAfter)\n\n}", "func (c *Client) IDTokenLifetime() time.Duration {\n\treturn c.idTokenDuration\n}", "func (r RecordTTL) Duration() time.Duration {\n\treturn (time.Second * time.Duration(int(r)))\n}", "func TTL(duration time.Duration) Setter {\n\treturn func(cgm Congomap) error {\n\t\treturn cgm.TTL(duration)\n\t}\n}", "func (NilTimer) Count() int64 { return 0 }", "func (s *ParticleSystem) Duration(now time.Time) time.Duration {\n\treturn now.Sub(s.startTime)\n}", "func now() int64 {\n\treturn time.Nanoseconds()\n}", "func (lc *LruCache) TTL(key string) (time.Duration, error) {\n\t_, err := lc.LruStore.Retrieve(key)\n\t// Return 0 and error when the key is not in the store\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tttl, err := lc.MemoryExpiry.GetTTL(key)\n\tif err != nil {\n\t\treturn 0, cache.ErrNoExpiry\n\t}\n\treturn ttl, nil\n}", "func (t *Track) Alive() int {\n\tvar alive int\n\tfor _, c := range t.Carts {\n\t\tif !c.Crashed {\n\t\t\talive++\n\t\t}\n\t}\n\treturn alive\n}", "func (s Status) Age() time.Duration { return s.age }", "func GetEffectiveLifespan(c Client, gt GrantType, tt TokenType, fallback time.Duration) time.Duration {\n\tif clc, ok := c.(ClientWithCustomTokenLifespans); ok {\n\t\treturn clc.GetEffectiveLifespan(gt, tt, fallback)\n\t}\n\treturn fallback\n}", "func (v value) expired(c *Cache) bool{\n return time.Since(v.time)>c.expire\n}", "func (n *Namespace) Expiry() time.Time {\n\treturn n.Metadata.Expiry()\n}", "func (provider *AdhocProvider) isStale(certificate *tls.Certificate) bool {\n\tttlOffset := provider.TTLOffset\n\tif ttlOffset == 0 {\n\t\tttlOffset = DefaultTTLOffset\n\t}\n\n\texpiresAt := certificate.Leaf.NotAfter.Add(ttlOffset)\n\n\treturn time.Now().After(expiresAt)\n}", "func goodFor(cert *x509.Certificate) (time.Duration, bool) {\n\t// If we got called with a cert that doesn't exist, just say there's no\n\t// time left, and it needs to be renewed\n\tif cert == nil {\n\t\treturn 0, false\n\t}\n\t// These are all int64's with Seconds since the Epoch, handy for the math\n\tstart, end := cert.NotBefore.Unix(), cert.NotAfter.Unix()\n\tnow := time.Now().UTC().Unix()\n\tif end <= now { // already expired\n\t\treturn 0, false\n\t}\n\tlifespan := end - start // full ttl of cert\n\tduration := end - now // duration remaining\n\tgooddur := (duration * 9) / 10 // 90% of duration\n\tmindur := (lifespan / 10) // 10% of lifespan\n\tif gooddur <= mindur {\n\t\treturn 0, false // almost expired, get a new one\n\t}\n\tif gooddur > 100 { // 100 seconds\n\t\t// add jitter if big enough for it to matter\n\t\tr := rand.New(rand.NewSource(time.Now().UnixNano()))\n\t\t// between 87% and 93%\n\t\tgooddur = gooddur + ((gooddur / 100) * int64(r.Intn(6)-3))\n\t}\n\tsleepFor := time.Duration(gooddur * 1e9) // basically: gooddur*time.Second\n\treturn sleepFor, true\n}", "func getElapsed(start time.Time) string {\n\treturn fmt.Sprintf(\"(%.3fs)\", time.Since(start).Seconds())\n}", "func (r *RedisStorage) getTTL() int64 {\n\tr.ttlOnce.Do(func() {\n\t\tr.ttlInSeconds = int64(r.TTL / time.Second)\n\t})\n\n\treturn r.ttlInSeconds\n}", "func (transaction *FileCreateTransaction) GetTransactionValidDuration() time.Duration {\n\treturn transaction.Transaction.GetTransactionValidDuration()\n}", "func (e EnvVars) Duration(ctx context.Context) (*time.Duration, error) {\n\tvars := e.vars(ctx)\n\n\tif vars.Has(e.Key) {\n\t\tvalue, err := vars.Duration(e.Key)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &value, nil\n\t}\n\treturn nil, nil\n}", "func (b *OGame) ConstructionTime(id ogame.ID, nbr int64, facilities ogame.Facilities) time.Duration {\n\treturn b.constructionTime(id, nbr, facilities)\n}", "func (tx *Tx) TTL(key string) (ttl int64) {\n\tdeadline := tx.db.getTTL(String, key)\n\tif deadline == nil {\n\t\treturn\n\t}\n\n\tif tx.db.hasExpired(key, String) {\n\t\ttx.db.evict(key, String)\n\t\treturn\n\t}\n\n\treturn deadline.(int64) - time.Now().Unix()\n}", "func (staticMgr *staticManager) TimeTilNextPayment(host *host.Host) time.Duration {\n\treturn time.Duration(0)\n}", "func calculateDurationUntilNextReload(lastErcotReload string) (time.Duration, error) {\n\n\tmyLocation, loadLocationError := time.LoadLocation(\"America/Chicago\")\n\tif loadLocationError != nil {\n\t\treturn time.Duration(0), loadLocationError\n\t}\n\n\tasOfTimestamp, _ := time.ParseInLocation(ercot.RtLmpLastUpdatedTimestampLayOut, lastErcotReload, myLocation)\n\t//fmt.Printf(\"As-Of time: %v\\n\", asOfTimestamp)\n\ttargetReload := asOfTimestamp.Add(time.Minute * 5).Add(time.Second * 30)\n\t//fmt.Printf(\"Target reload time: %v\\n\", targetReload)\n\n\tnow := time.Now()\n\t//fmt.Println(now)\n\tdifference := targetReload.Sub(now)\n\t//fmt.Printf(\"Wait time: %v\\n\", difference)\n\n\tif difference < 0 {\n\t\t// This means that the ERCOT webpage should have already reloaded by now\n\t\t// We'll give it 10 seconds and check again\n\t\tdifference = time.Duration(10) * time.Second\n\t}\n\n\treturn difference, nil\n}", "func (c DatabaseOptions) ConnMaxLifetime() time.Duration {\n\treturn time.Duration(c.ConnMaxLifetimeSeconds) * time.Second\n}", "func RefreshDuration(expiration time.Time) time.Duration {\n\tcalledAt := now()\n\tif expiration.Before(calledAt) {\n\t\treturn time.Duration(0)\n\t}\n\td := expiration.Sub(calledAt)\n\tif d > 4*time.Second {\n\t\td = time.Duration(float64(d) * .75)\n\t} else {\n\t\td -= time.Second\n\t\tif d < time.Duration(0) {\n\t\t\td = time.Duration(0) // Force immediate refresh.\n\t\t}\n\t}\n\n\treturn d\n}", "func Age(seconds float64, planet Planet) float64 {\n\treturn seconds / (earthDays * orbitalPeriod[planet])\n}", "func (p *CTEDefinition) MemoryUsage() (sum int64) {\n\tif p == nil {\n\t\treturn\n\t}\n\n\tsum = p.physicalSchemaProducer.MemoryUsage() + p.cteAsName.MemoryUsage()\n\tif p.SeedPlan != nil {\n\t\tsum += p.SeedPlan.MemoryUsage()\n\t}\n\tif p.RecurPlan != nil {\n\t\tsum += p.RecurPlan.MemoryUsage()\n\t}\n\tif p.CTE != nil {\n\t\tsum += p.CTE.MemoryUsage()\n\t}\n\treturn\n}", "func (o *Gojwt) GetNumHoursDuration()(time.Duration){\n return o.numHoursDuration\n}", "func (c deploymentChecker) EndTime() uint64 {\n\treturn c.deployment.ExpireTime\n}", "func (b *redisBackend) Latency() time.Duration { return time.Duration(atomic.LoadInt64(&b.latency)) }", "func (b NDPRouterAdvert) RouterLifetime() time.Duration {\n\t// The field is the time in seconds, as per RFC 4861 section 4.2.\n\treturn time.Second * time.Duration(binary.BigEndian.Uint16(b[ndpRARouterLifetimeOffset:]))\n}", "func (this *cyclingActivityStruct) Duration() time.Duration {\n\tdur := this.duration\n\treturn dur\n}", "func (s *Stat) AcquireDuration() time.Duration {\n\treturn s.s.AcquireDuration()\n}", "func (o *Operator) ElapsedTime() time.Duration {\n\treturn time.Since(o.createTime)\n}", "func (p Profile) Duration() time.Duration {\n\treturn p.Finish.Sub(p.Start)\n}", "func calcRuntime(t time.Time, f string) {\n\t//now := time.Now()\n\t//log.Printf(\"%s cost %f millisecond\\n\", f, now.Sub(t).Seconds() * 1000)\n\t//log.Printf()\n}", "func (p *parser) duration() Node {\n\ttoken := p.expect(TokenDuration)\n\tnum, err := newDur(token.pos, token.val)\n\tif err != nil {\n\t\tp.error(err)\n\t}\n\treturn num\n}", "func NanoTime() int64", "func (f File) CTime() (uint32, uint32) {\n\treturn 0, 0\n}", "func (d Download) TotalCost() time.Duration {\n\treturn time.Now().Sub(d.startedAt)\n}", "func tNow() uint64 {\n\treturn uint64(time.Now().In(time.UTC).UnixNano())\n}", "func (_ChpRegistry *ChpRegistryCaller) CORESTAKINGDURATION(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ChpRegistry.contract.Call(opts, out, \"CORE_STAKING_DURATION\")\n\treturn *ret0, err\n}", "func (c Choco) Expired() bool {\n\treturn time.Since(c.TimeStamp) > time.Second\n}", "func fresh(c *cacheEntry) bool {\n\telapsed := time.Since(c.stat.ModTime()).Minutes()\n\treturn elapsed < float64(*cacheLength)*3\n}", "func (_ChpRegistry *ChpRegistrySession) CORESTAKINGDURATION() (*big.Int, error) {\n\treturn _ChpRegistry.Contract.CORESTAKINGDURATION(&_ChpRegistry.CallOpts)\n}", "func cooldown(neurone Neurone, serialPort io.ReadWriteCloser) (sF stateFn, newNeurone Neurone) {\n\tdt := calcDt(neurone)\n\n\t// LERP neurone energy from -1.0 to 0.0 over the duration of the cooldown.\n\tnewEnergy := float32(dt / neurone.duration)\n\n\t// If the time elapsed is longer than the duration of the cooldown, enter the accumulate state.\n\tif dt >= neurone.duration {\n\t\treturn accumulate, Neurone{0.0, neurone.deltaE, 0.0, time.Now().UnixNano(), neurone.config}\n\t}\n\n\tcooldownArduino(newEnergy, serialPort)\n\treturn cooldown, Neurone{newEnergy, neurone.deltaE, neurone.duration, neurone.start, neurone.config}\n}", "func (c *ETHController) CommitmentTime(domain string, owner common.Address, secret [32]byte) (*big.Int, error) {\n\thash, err := c.CommitmentHash(domain, owner, secret)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.Contract.Commitments(nil, hash)\n}", "func (s *Stats) GetCPUTimes() {\n\n if s.CPUInfo == nil {\n s.CPUInfo = new(CPUInfo)\n }\n\n s.CPUInfo.PrevCPUTimes = s.CPUInfo.PerCPUTimes\n s.CPUInfo.PerCPUTimes, _ = cpu.Times(true)\n\n if len(s.CPUInfo.PrevCPUTimes) == 0 {\n s.CPUInfo.PrevCPUTimes = s.CPUInfo.PerCPUTimes\n }\n}", "func contention(d time.Duration) {\n\tcontentionImpl(d)\n}", "func (o ClusterBuildStrategySpecBuildStepsReadinessProbePtrOutput) PeriodSeconds() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *ClusterBuildStrategySpecBuildStepsReadinessProbe) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.PeriodSeconds\n\t}).(pulumi.IntPtrOutput)\n}", "func (o ClusterBuildStrategySpecBuildStepsLivenessProbePtrOutput) PeriodSeconds() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *ClusterBuildStrategySpecBuildStepsLivenessProbe) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.PeriodSeconds\n\t}).(pulumi.IntPtrOutput)\n}", "func (c *TimeoutCache) Len() int {\n\tc.lock.RLock()\n\tdefer c.lock.RUnlock()\n\treturn c.evictList.Len()\n}", "func (o WebTestPropertiesValidationRulesPtrOutput) SSLCertRemainingLifetimeCheck() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *WebTestPropertiesValidationRules) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.SSLCertRemainingLifetimeCheck\n\t}).(pulumi.IntPtrOutput)\n}", "func Age(seconds float64, planet Planet) float64 {\n\treturn seconds / (planet.getOrbitalPeriod() * earthYearInSeconds)\n}" ]
[ "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.512962", "0.5096567", "0.5064352", "0.50254476", "0.5013386", "0.4992442", "0.4978208", "0.49592185", "0.49592185", "0.4939317", "0.4939317", "0.48730573", "0.48564658", "0.48412156", "0.48375577", "0.47989598", "0.47903383", "0.47874343", "0.47830233", "0.4781685", "0.4771168", "0.47676098", "0.47615266", "0.4733347", "0.47322342", "0.47319403", "0.47171244", "0.47137958", "0.47131923", "0.4708488", "0.47065997", "0.47055128", "0.4693242", "0.468644", "0.4663688", "0.4651906", "0.46500254", "0.4636487", "0.4634292", "0.46313545", "0.46242678", "0.46202183", "0.4615025", "0.46126142", "0.46121347", "0.46088147", "0.46068704", "0.46027222", "0.45941743", "0.4593736", "0.45902076", "0.45845795", "0.4582196", "0.45810395", "0.45785952", "0.45748687", "0.45734832", "0.45721927", "0.4570243", "0.45536694", "0.4548321", "0.45432475", "0.45424905", "0.45377654", "0.4537679", "0.4535416", "0.45330057", "0.45251477", "0.4524483", "0.45201224", "0.451689", "0.4513712", "0.45109335", "0.4509988", "0.45005384", "0.44948658", "0.44924653", "0.44907713", "0.4489779", "0.44894975" ]
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 || strings.ContainsAny(err.Error(), \"already exists\") {\n\t\treturn nil\n\t}\n\n\treturn err\n}", "func InitSession() {\n\tstatCount(\"users.init_session\")\n\tgob.Register(&Authentication{})\n\tkinli.SessionName = \"_git_notify1\"\n\tkinli.HomePathNonAuthed = \"/home\"\n\tkinli.HomePathAuthed = \"/\"\n\n\tvar store = sessions.NewFilesystemStore(\"./sessions\", []byte(os.Getenv(\"SESSION_FS_STORE\")))\n\t// TODO mark session as httpOnly, secure\n\t// http://www.gorillatoolkit.org/pkg/sessions#Options\n\tstore.Options = &sessions.Options{\n\t\tPath: \"/\",\n\t\t// Domain: config.serverHostWithoutPort(), // take from config\n\t\tMaxAge: 86400 * 30, // 30 days\n\t\tHttpOnly: true, // to avoid cookie stealing and session is on server side\n\t\tSecure: (config.ServerProto == \"https\"), // for https\n\t}\n\n\tkinli.SessionStore = store\n\n\t// init Gothic\n\tgothic.Store = store\n\tgothic.GetProviderName = getProviderName\n\n}", "func (pder *MemProvider) SessionInit(maxlifetime int64, savePath string) error {\n\treturn (*session.MemProvider)(pder).SessionInit(context.Background(), maxlifetime, savePath)\n}", "func InitSession() {\n\tsessionManager = session.NewSessionManager(cookieName, 3600)\n}", "func InitSession() {\n\tkinli.SessionStore = sessions.NewFilesystemStore(\"./sessions\", []byte(os.Getenv(\"SESSION_STORE\")))\n\tkinli.SessionName = common.Config.SessionName\n\tkinli.IsAuthed = service.IsUserAuthed\n}", "func InitSession(config RedisConfig) *RedisSession {\r\n\ts := RedisSession{}\r\n\ts.debug = config.Debug\r\n\ts.config = config\r\n\ts.candidates = make(map[string]string)\r\n\tclnt, err := s.getClient()\r\n\tif err != nil {\r\n\t\tpanic(err.Error())\r\n\t}\r\n\ts.client = clnt\r\n\treturn &s\r\n}", "func InitSession(r *http.Request) *sessions.Session {\n\tif appSession != nil {\n\t\t// there already is a global session so use that\n\t\treturn appSession\n\t}\n\tsession, err := store.Get(r, uploadSessionName)\n\tappSession = session // set global session\n\tHandle(err)\n\treturn session\n}", "func (rp *Provider) SessionInit(ctx context.Context, maxlifetime int64, url string) (err error) {\n\trp.maxlifetime = maxlifetime * int64(time.Second)\n\trp.c, err = redis.New(cache.Options{Address: url, Codec: codec})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif ctx == nil {\n\t\tctx = context.TODO()\n\t}\n\treturn rp.c.Ping(ctx)\n}", "func (m *Milight) initSession() error {\n\tif m.sessionID[0] == 0 && m.sessionID[1] == 0 {\n\t\terr := m.createSession()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tgo m.keepAliveLoop()\n\t}\n\treturn nil\n}", "func newSession(g Game, sessId int, host *HostUser) (*Session, error) {\n\tsession := Session{\n\t\tsessionId: sessId,\n\t\tgame: g,\n\t\tLobbyHost: host,\n\t\tuserMap: make(map[string]*AnonUser),\n\t\tPlayerMap: make([]User, 0, g.MaxUsers() + 1),\n\t\t//PlayerMap: make(map[int]*User, g.MaxUsers() + 1),\n\t\tSend: make(chan []byte),\n\t\tReceive: make(chan interface{}),\n\t\tData: make(chan interface{}),\n\t\tExit: make(chan bool, 1),\n\t}\n\thost.SetSession(&session)\n\thost.SetPlayer(0)\n\tsession.PlayerMap = append(session.PlayerMap, session.LobbyHost) //set index 0 as host\n\t//session.PlayerMap[0] = session.LobbyHost\n\n\tgo session.dataHandler()\n\treturn &session, nil\n}", "func (p *Provider) Init(sid string) Session {\n\tnewSession := p.NewSession(sid)\n\telem := p.list.PushBack(newSession)\n\tp.mu.Lock()\n\tp.sessions[sid] = elem\n\tp.mu.Unlock()\n\treturn newSession\n}", "func (_PermInterface *PermInterfaceSession) Init(_breadth *big.Int, _depth *big.Int) (*types.Transaction, error) {\n\treturn _PermInterface.Contract.Init(&_PermInterface.TransactOpts, _breadth, _depth)\n}", "func InitDb() *r.Session {\n\tdbName := os.Getenv(\"DB_NAME\")\n\n\tsession, err := r.Connect(r.ConnectOpts{\n\t\tAddress: os.Getenv(\"RETHINKDB_URL\"),\n\t\tDatabase: dbName,\n\t\tMaxIdle: 10,\n\t\tIdleTimeout: time.Second * 10,\n\t})\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\terr = r.DbCreate(dbName).Exec(session)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\t_, err = r.Db(dbName).TableCreate(\"users\").RunWrite(session)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\t_, err = r.Db(dbName).TableCreate(\"sessions\").RunWrite(session)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tvar baseUser User\n\t_, err = r.Db(dbName).Table(\"users\").Insert(User{Username: \"[email protected]\", Password: baseUser.HashPassword(\"powell5112\")}).RunWrite(session)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\treturn session\n}", "func InitSessionManager(clean, timeout time.Duration, db *sql.DB, debug bool) {\n\tvar err error\n\tSessionManager.ReqSessionMem = make(chan int)\n\tSessionManager.ReqSessionMemAck = make(chan int)\n\tSessionManager.SessionCleanupTime = clean\n\tSessionManager.SessionTimeout = timeout\n\tSessions = make(map[string]*Session)\n\tSessionManager.SecurityDebug = debug\n\tSessionManager.db = db\n\tSessionManager.ZoneUTC, err = time.LoadLocation(\"UTC\")\n\tif err != nil {\n\t\tlib.Ulog(\"InitSessionManager: error reading timezone: \", err.Error())\n\t}\n\tgo SessionDispatcher()\n\tgo SessionCleanup()\n\tgo ExpiredCookieCleaner()\n}", "func (s *Client) Init(username string) *sessions.UserData {\n\tuser, err := s.GetAny(username)\n\tif err != nil {\n\t\tfunc() {\n\n\t\t\ts.lock.Lock()\n\t\t\tdefer s.lock.Unlock()\n\n\t\t\ttx, _ := s.db.Begin()\n\t\t\tstmt, _ := tx.Prepare(`INSERT OR IGNORE INTO users (username, last_match) VALUES (?,\"\");`)\n\t\t\tdefer stmt.Close()\n\t\t\tstmt.Exec(username)\n\t\t\ttx.Commit()\n\t\t}()\n\n\t\ts.Set(username, map[string]string{\n\t\t\t\"topic\": \"random\",\n\t\t})\n\n\t\treturn &sessions.UserData{\n\t\t\tVariables: map[string]string{\n\t\t\t\t\"topic\": \"random\",\n\t\t\t},\n\t\t\tLastMatch: \"\",\n\t\t\tHistory: sessions.NewHistory(),\n\t\t}\n\t}\n\treturn user\n}", "func (session *Session) Init() {\n\tsession.Statement.Init()\n\tsession.Statement.Engine = session.Engine\n\tsession.IsAutoCommit = true\n\tsession.IsCommitedOrRollbacked = false\n\tsession.IsAutoClose = false\n\tsession.AutoResetStatement = true\n\tsession.prepareStmt = false\n\n\t// !nashtsai! is lazy init better?\n\tsession.afterInsertBeans = make(map[interface{}]*[]func(interface{}), 0)\n\tsession.afterUpdateBeans = make(map[interface{}]*[]func(interface{}), 0)\n\tsession.afterDeleteBeans = make(map[interface{}]*[]func(interface{}), 0)\n\tsession.beforeClosures = make([]func(interface{}), 0)\n\tsession.afterClosures = make([]func(interface{}), 0)\n\n\tsession.lastSQLArgs = []interface{}{}\n}", "func (c *arbiterClient) InitSession(id ID, voteOpt []Addr) StatusCode {\n\tclient, err := rpc.Dial(\"tcp\", c.remoteAddr.ToStr())\n\tif err != nil {\n\t\t*c.netErr = err\n\t\treturn StatusDefault\n\t}\n\tdefer client.Close()\n\targs := InitSessionArgs{ID: id, VoteOpt: voteOpt}\n\tresp := StatusDefault\n\t*c.netErr = client.Call(\"ArbiterServer.InitSession\", args, &resp)\n\treturn resp\n}", "func NewSession(scfg *SessionConfig) (*Session, error) {\n\tif scfg.Log == nil {\n\t\treturn nil, errors.New(\"missing logger\")\n\t}\n\n\t// Open TPM connection\n\trwc, err := OpenTPM(scfg.DevicePath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot open TPM at %q: %w\", scfg.DevicePath, err)\n\t}\n\n\t// Create session\n\ttpm := &Session{\n\t\trwc: rwc,\n\t\tlog: scfg.Log,\n\t\tendorsementHierarchyPassword: scfg.Passwords.EndorsementHierarchy,\n\t\townerHierarchyPassword: scfg.Passwords.OwnerHierarchy,\n\t}\n\n\t// Close session in case of error\n\tdefer func() {\n\t\tif err != nil {\n\t\t\ttpm.Close()\n\t\t}\n\t}()\n\n\t// Create SRK password\n\tsrkPassword, err := newRandomPassword()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot generate random password for storage root key: %w\", err)\n\t}\n\n\t// Load DevID\n\ttpm.devID, err = tpm.loadKey(\n\t\tscfg.DevIDPub,\n\t\tscfg.DevIDPriv,\n\t\tsrkPassword,\n\t\tscfg.Passwords.DevIDKey)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot load DevID key on TPM: %w\", err)\n\t}\n\n\t// Create Attestation Key\n\takPassword, err := newRandomPassword()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot generate random password for attesation key: %w\", err)\n\t}\n\takPriv, akPub, err := tpm.createAttestationKey(srkPassword, akPassword)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot create attestation key: %w\", err)\n\t}\n\ttpm.akPub = akPub\n\n\t// Load Attestation Key\n\ttpm.ak, err = tpm.loadKey(\n\t\takPub,\n\t\takPriv,\n\t\tsrkPassword,\n\t\takPassword)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot load attestation key: %w\", err)\n\t}\n\n\t// Regenerate Endorsement Key using the default RSA template\n\ttpm.ekHandle, tpm.ekPub, _, _, _, _, err =\n\t\ttpm2.CreatePrimaryEx(rwc, tpm2.HandleEndorsement,\n\t\t\ttpm2.PCRSelection{},\n\t\t\tscfg.Passwords.EndorsementHierarchy,\n\t\t\t\"\",\n\t\t\tclient.DefaultEKTemplateRSA())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot create endorsement key: %w\", err)\n\t}\n\n\treturn tpm, nil\n}", "func SessionStart(w http.ResponseWriter, r *http.Request) *Session {\n\tSessionMapLock.Lock()\n\tdefer SessionMapLock.Unlock()\n\n\tSID, err := GetCookieValue(r, \"OG_SESSION_ID\")\n\tif err != nil || SID == \"\" || !SessionExists(SID) {\n\t\toldSID := SID\n\t\ttaken := true\n\t\tfor taken {\n\t\t\tSID = GetRandomString(64)\n\t\t\t_, taken = SessionMap[SID]\n\t\t}\n\n\t\tlogging.Debug(&map[string]string{\n\t\t\t\"file\": \"session.go\",\n\t\t\t\"Function\": \"SessionStart\",\n\t\t\t\"event\": \"Create session\",\n\t\t\t\"old_SID\": oldSID,\n\t\t\t\"new_SID\": SID,\n\t\t})\n\n\t\tSetCookie(w, \"OG_SESSION_ID\", SID, http.SameSiteStrictMode, time.Duration(config.SessionLifetime))\n\n\t\tsession := Session{\n\t\t\tSID: SID,\n\t\t\tTimeAccessed: time.Now(),\n\t\t\tValues: make(map[string]interface{}),\n\t\t}\n\n\t\tSessionMap[SID] = &session\n\t\treturn &session\n\t}\n\n\tlogging.Debug(&map[string]string{\n\t\t\"file\": \"session.go\",\n\t\t\"Function\": \"SessionStart\",\n\t\t\"event\": \"Use existing session\",\n\t\t\"SID\": SID,\n\t})\n\tSessionMap[SID].Used(w)\n\treturn SessionMap[SID]\n}", "func DynamoSessionInit() *dynamo.DB {\n\tconfig := &aws.Config{\n\t\tRegion: aws.String(\"us-east-1\"),\n\t}\n\tsess := session.Must(session.NewSession(config))\n\tdb := dynamo.New(sess, config)\n\treturn db\n}", "func (_PermInterface *PermInterfaceTransactorSession) Init(_breadth *big.Int, _depth *big.Int) (*types.Transaction, error) {\n\treturn _PermInterface.Contract.Init(&_PermInterface.TransactOpts, _breadth, _depth)\n}", "func (_Rootchain *RootchainSession) Init() (*types.Transaction, error) {\n\treturn _Rootchain.Contract.Init(&_Rootchain.TransactOpts)\n}", "func Init() Users {\r\n\treturn Users(make(map[int64]User))\r\n}", "func StartSession(w http.ResponseWriter, r *http.Request, u GSUser) {\n\tuID, _ := uuid.NewV4()\n\tcookie, err := r.Cookie(\"session\")\n\tif err == nil {\n\t\t//Value of cookie which named session, is checking\n\t\t_, err := uuid.FromString(cookie.Value)\n\t\tif err != nil {\n\t\t\t//invalid uuid(Cookie/Session Value) is detected by *Satori* and value is changed\n\t\t\tdelMaps(cookie.Value, u)\n\t\t\tcookie.Value = uID.String()\n\t\t\tcookie.MaxAge = SessionTime\n\t\t\thttp.SetCookie(w, cookie)\n\t\t}\n\t\t//System already have a session now. Checking harmony between uuid and RAM(dbUsers, dbSessions)\n\t\tif !checkDatabases(cookie.Value) {\n\t\t\t//RAM is cleared, now system have a cookie but RAM cleared by 'checkDatabases'(internal command)\n\t\t\t//fmt.Println(\"içerideyiz\", uID.String())\n\t\t\tcookie.Value = uID.String()\n\t\t\tcookie.MaxAge = SessionTime\n\t\t\thttp.SetCookie(w, cookie)\n\t\t\taddMaps(cookie.Value, u)\n\t\t\t//OK, everything is fine. Session value(uuid) is valid and RAM and Session are pointed by each other.\n\t\t} else {\n\t\t\t//OK, everything is fine. Session value(uuid) is valid and RAM and Session are pointed by each other.\n\t\t}\n\t} else {\n\t\t//System has no any cookie which named session and everything is created from A to Z\n\t\t//In this command, RAM isn't check because 1 session can point 1 user object.\n\t\t//but\n\t\t//1 user object can pointed more than one session(uuid)\n\t\t//\n\t\t//Why?: User have mobile, desktop, tablet devices which can login by.\n\t\tcreateSessionCookie(w, r, uID.String())\n\t\taddMaps(uID.String(), u)\n\t\t//OK, everything is fine. Session value(uuid) is valid and RAM and Session are pointed by each other.\n\t}\n}", "func (s *SessionRegistry) OpenSession(ch ssh.Channel, req *ssh.Request, ctx *ServerContext) error {\n\tif ctx.session != nil {\n\t\t// emit \"joined session\" event:\n\t\tctx.session.recorder.alog.EmitAuditEvent(events.SessionJoinEvent, events.EventFields{\n\t\t\tevents.SessionEventID: string(ctx.session.id),\n\t\t\tevents.EventNamespace: s.srv.GetNamespace(),\n\t\t\tevents.EventLogin: ctx.Identity.Login,\n\t\t\tevents.EventUser: ctx.Identity.TeleportUser,\n\t\t\tevents.LocalAddr: ctx.Conn.LocalAddr().String(),\n\t\t\tevents.RemoteAddr: ctx.Conn.RemoteAddr().String(),\n\t\t\tevents.SessionServerID: ctx.srv.ID(),\n\t\t})\n\t\tctx.Infof(\"Joining existing session %v.\", ctx.session.id)\n\t\t_, err := ctx.session.join(ch, req, ctx)\n\t\treturn trace.Wrap(err)\n\t}\n\t// session not found? need to create one. start by getting/generating an ID for it\n\tsid, found := ctx.GetEnv(sshutils.SessionEnvVar)\n\tif !found {\n\t\tsid = string(rsession.NewID())\n\t\tctx.SetEnv(sshutils.SessionEnvVar, sid)\n\t}\n\t// This logic allows concurrent request to create a new session\n\t// to fail, what is ok because we should never have this condition\n\tsess, err := newSession(rsession.ID(sid), s, ctx)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tctx.session = sess\n\ts.addSession(sess)\n\tctx.Infof(\"Creating session %v.\", sid)\n\n\tif err := sess.start(ch, ctx); err != nil {\n\t\tsess.Close()\n\t\treturn trace.Wrap(err)\n\t}\n\treturn nil\n}", "func Init(logger *logging.Logger) *discordgo.Session {\n\t//var err error\n\t// set the config reference\n\tlog = logger\n\n\tlog.Debug(\"Registering message handler\")\n\t// type discordgo.Session (not a ref)\n\tsession = discordgo.Session{\n\t\tOnMessageCreate: handler.MessageHandler,\n\t}\n\n\tgo loginFlow(&session)\n\n\ttime.Sleep(1 * time.Second)\n\tfor {\n\t\tif session.Token != \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn &session\n}", "func Session() HandlerFunc {\n\treturn func(c *Context) {\n\t\tif sessionManager == nil {\n\t\t\tpanic(\"please call gow.InitSession()\")\n\t\t}\n\t\tsessionID = sessionManager.Start(c.Writer, c.Req)\n\t\tsessionManager.Extension(c.Writer, c.Req)\n\t\tc.Next()\n\t}\n}", "func createUserSession(c *gin.Context, userId int) bool {\n // get a new session id\n bytes, err := generateRandomId(SessionTokenBytes)\n if err != nil {\n return false\n }\n\n // setup session in redis\n con := stores.redisPool.Get()\n defer con.Close()\n\n // get session length\n ttl := int(SessionMaxLength.Seconds())\n\n // hash session id for storage (sha256 - no need for bcrypt here)\n shaSum := sha256.Sum256(bytes)\n sessionHash := base64.URLEncoding.EncodeToString(shaSum[:])\n\n // set session token to user id\n con.Send(\"MULTI\")\n con.Send(\"SETNX\", \"session:\" + sessionHash, userId)\n con.Send(\"EXPIRE\", \"session:\" + sessionHash, ttl)\n r, err := redis.Ints(con.Do(\"EXEC\"))\n if err != nil || r[0] == 0 || r[1] == 0 {\n con.Do(\"DEL\", \"session:\" + sessionHash)\n return false\n }\n\n // base64 encode session id for cookie\n token := base64.URLEncoding.EncodeToString(bytes)\n\n // send session to user\n http.SetCookie(c.Writer, createSessionCookie(token, 0))\n return true\n}", "func (m *SessionManager) Create(user User) (session Session) {\n\t// Set the expires from the cookie config\n\tsession = Session{\n\t\tExpires: m.nowFunc().Add(m.cookie.Age),\n\t\tUserID: user.ID,\n\t\tmanager: m,\n\t}\n\n\t// Generate a new random session key\n\tfor {\n\t\tsession.Key = m.keyFunc()\n\n\t\t// No duplicates - generate a new key if this key already exists\n\t\tvar duplicate string\n\t\tstmt := sol.Select(\n\t\t\tSessions.C(\"key\"),\n\t\t).Where(Sessions.C(\"key\").Equals(session.Key)).Limit(1)\n\t\tm.conn.Query(stmt, &duplicate)\n\t\tif duplicate == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Insert the session\n\tm.conn.Query(Sessions.Insert().Values(session))\n\treturn\n}", "func (_Rootchain *RootchainTransactorSession) Init() (*types.Transaction, error) {\n\treturn _Rootchain.Contract.Init(&_Rootchain.TransactOpts)\n}", "func newSession(id rsession.ID, r *SessionRegistry, ctx *ServerContext) (*session, error) {\n\tserverSessions.Inc()\n\trsess := rsession.Session{\n\t\tID: id,\n\t\tTerminalParams: rsession.TerminalParams{\n\t\t\tW: teleport.DefaultTerminalWidth,\n\t\t\tH: teleport.DefaultTerminalHeight,\n\t\t},\n\t\tLogin: ctx.Identity.Login,\n\t\tCreated: time.Now().UTC(),\n\t\tLastActive: time.Now().UTC(),\n\t\tServerID: ctx.srv.ID(),\n\t\tNamespace: r.srv.GetNamespace(),\n\t}\n\tterm := ctx.GetTerm()\n\tif term != nil {\n\t\twinsize, err := term.GetWinSize()\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t\trsess.TerminalParams.W = int(winsize.Width)\n\t\trsess.TerminalParams.H = int(winsize.Height)\n\t}\n\n\t// get the session server where session information lives. if the recording\n\t// proxy is being used and this is a node, then a discard session server will\n\t// be returned here.\n\tsessionServer := r.srv.GetSessionServer()\n\n\terr := sessionServer.CreateSession(rsess)\n\tif err != nil {\n\t\tif trace.IsAlreadyExists(err) {\n\t\t\t// if session already exists, make sure they are compatible\n\t\t\t// Login matches existing login\n\t\t\texisting, err := sessionServer.GetSession(r.srv.GetNamespace(), id)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\tif existing.Login != rsess.Login {\n\t\t\t\treturn nil, trace.AccessDenied(\n\t\t\t\t\t\"can't switch users from %v to %v for session %v\",\n\t\t\t\t\trsess.Login, existing.Login, id)\n\t\t\t}\n\t\t}\n\t\t// return nil, trace.Wrap(err)\n\t\t// No need to abort. Perhaps the auth server is down?\n\t\t// Log the error and continue:\n\t\tr.log.Errorf(\"Failed to create new session: %v.\", err)\n\t}\n\n\tsess := &session{\n\t\tlog: logrus.WithFields(logrus.Fields{\n\t\t\ttrace.Component: teleport.Component(teleport.ComponentSession, r.srv.Component()),\n\t\t}),\n\t\tid: id,\n\t\tregistry: r,\n\t\tparties: make(map[rsession.ID]*party),\n\t\twriter: newMultiWriter(),\n\t\tlogin: ctx.Identity.Login,\n\t\tcloseC: make(chan bool),\n\t\tlingerTTL: defaults.SessionIdlePeriod,\n\t}\n\treturn sess, nil\n}", "func Init(sfn string, keep time.Duration) (err error) {\n var si *sessInfo\n sessPool.m.Lock()\n defer sessPool.m.Unlock()\n\n if keep > 0 {\n sessPool.keep = keep\n }\n // sfn == \"\", data keep in memory\n if sfn == \"\" { return }\n\n if sessPool.path == \"\" { // load from disk\n logging.Debug(\"load session from disk\")\n sessPool.path = sfn\n fs, e := filepath.Glob(filepath.Join(sfn, \"*.sess\"))\n if e != nil { return e }\n for _, f := range fs {\n si, err = readOneSessFile(f)\n if err != nil {\n logging.Error(err)\n } else if si != nil {\n sessPool.sess[si.id] = si\n }\n }\n } else { // save to disk\n logging.Debug(\"save session to disk\")\n for _, si = range sessPool.sess {\n err = saveOneSessFile(sfn, si)\n if err != nil {\n logging.Error(si.id, \": \", err)\n }\n }\n }\n _ = time.AfterFunc(time.Minute, func(){ _ = Init(sfn, 0) })\n return nil\n}", "func pvtNewSession(c *db.SessionCookie, firstname string, rid int, updateSessionTable bool) *Session {\n\t// lib.Ulog(\"Entering NewSession: %s (%d)\\n\", username, uid)\n\tuid := int(c.UID)\n\ts := new(Session)\n\ts.Token = c.Cookie\n\ts.Username = c.UserName\n\ts.Firstname = firstname\n\ts.UID = c.UID\n\ts.UIDorig = c.UID\n\ts.ImageURL = ui.GetImageLocation(uid)\n\ts.Breadcrumbs = make([]ui.Crumb, 0)\n\ts.Expire = c.Expire\n\ts.IP = c.IP\n\ts.UserAgent = c.UserAgent\n\tauthz.GetRoleInfo(rid, &s.PMap)\n\n\tif authz.Authz.SecurityDebug {\n\t\tfor i := 0; i < len(s.PMap.Urole.Perms); i++ {\n\t\t\tlib.Ulog(\"f: %s, perm: %02x\\n\", s.PMap.Urole.Perms[i].Field, s.PMap.Urole.Perms[i].Perm)\n\t\t}\n\t}\n\n\tvar d db.PersonDetail\n\td.UID = uid\n\n\terr := SessionManager.db.QueryRow(fmt.Sprintf(\"SELECT CoCode FROM people WHERE UID=%d\", uid)).Scan(&s.CoCode)\n\tif nil != err {\n\t\tlib.Ulog(\"Unable to read CoCode for userid=%d, err = %v\\n\", uid, err)\n\t}\n\n\tif updateSessionTable {\n\t\tlib.Console(\"JUST BEFORE InsertSessionCookie: s.IP = %s, s.UserAgent = %s\\n\", s.IP, s.UserAgent)\n\t\terr = InsertSessionCookie(s)\n\t\tif err != nil {\n\t\t\tlib.Ulog(\"Unable to save session for UID = %d to database, err = %s\\n\", uid, err.Error())\n\t\t}\n\t}\n\n\tSessionManager.ReqSessionMem <- 1 // ask to access the shared mem, blocks until granted\n\t<-SessionManager.ReqSessionMemAck // make sure we got it\n\tSessions[c.Cookie] = s\n\tSessionManager.ReqSessionMemAck <- 1 // tell SessionDispatcher we're done with the data\n\n\treturn s\n}", "func (e *engine) loadSession(ctx *Context) {\n\tif AppSessionManager().IsStateful() {\n\t\tctx.subject.Session = AppSessionManager().GetSession(ctx.Req.Unwrap())\n\t}\n}", "func (e *Engine) StartSession(ctx context.Context) (types.SessionID, error) {\n\n\tspnResolve, ctx := opentracing.StartSpanFromContext(ctx, \"engine.StartSession\")\n\tdefer spnResolve.Finish()\n\n\tsidStr, err := e.idFactory()\n\tsid := types.SessionID(sidStr)\n\tif err != nil {\n\t\treturn sid, Error{\"generate-id-for-session\", err, \"id factory returned an error when genrating an id\"}\n\t}\n\n\tspnUnmarshal := opentracing.StartSpan(\"marshal start session command from anon struct\", opentracing.ChildOf(spnResolve.Context()))\n\tpath := fmt.Sprintf(\"session/%s\", sid)\n\n\tif e.depot.Exists(types.PartitionName(path)) {\n\t\treturn sid, Error{\"guard-unique-session-id\", err, \"session id was not unique in depot, can't start.\"}\n\t}\n\n\tclaimCtx, cancel := context.WithTimeout(ctx, e.claimTimeout)\n\tdefer cancel()\n\n\te.depot.Claim(claimCtx, path)\n\tdefer e.depot.Release(path)\n\n\tb, err := json.Marshal(struct {\n\t\tPath string `json:\"path\"`\n\t\tCmdName string `json:\"name\"`\n\t}{path, \"Start\"})\n\tif err != nil {\n\t\treturn sid, Error{\"marshal-session-start-cmd\", err, \"can't marshal session start command to JSON for resolver\"}\n\t}\n\tspnUnmarshal.SetTag(\"payload\", string(b))\n\tspnUnmarshal.Finish()\n\n\tsessionStart, err := e.resolver(ctx, e.depot, b)\n\tif err != nil {\n\t\treturn sid, Error{\"resolve-session-start-cmd\", err, \"can't resolve session start command\"}\n\t}\n\n\tsessionStartedEvents, err := sessionStart(ctx, nil, e.depot)\n\tif err != nil {\n\t\treturn sid, Error{\"execute-session-start-cmd\", err, \"error calling session start command\"}\n\t}\n\n\treturn sid, e.persistEvs(path, sessionStartedEvents)\n\n\t// spnAppendEvs, ctx := opentracing.StartSpanFromContext(ctx, \"store generated events in depot\")\n\t// // n, err := e.depot.AppendEvs(path, evs)\n\t// // if n != len(evs) {\n\t// // \treturn sid, Error{\"depot-partial-store\", err, \"depot encountered error storing events for aggregate\"}\n\t// // }\n\t// spnAppendEvs.Finish()\n\n\t// return sid, nil\n}", "func InitUser(username string, password string) (userdataptr *User, err error) {\r\n\tvar userdata User\r\n\r\n\tvar rsa_public userlib.PKEEncKey\r\n\tvar rsa_secret userlib.PKEDecKey\r\n\trsa_public, rsa_secret, _ = userlib.PKEKeyGen()\r\n\r\n\tuserlib.KeystoreSet(username, rsa_public)\r\n\r\n\tuserdata.Username = username\r\n\tuserdata.RSA_Secret_Key = rsa_secret\r\n\t//userdata.Storage_Key = userlib.Argon2Key([]byte(password), []byte(username), uint32(len(username)))\r\n\tpadded_username := Pad([]byte(username), 16)\r\n\tuserdata.UUID = bytesToUUID([]byte(padded_username))\r\n\r\n\tuserdata.Personal_Key = userlib.Argon2Key([]byte(password), []byte(username), uint32(userlib.AESBlockSizeBytes))\r\n\tuserdata.HMAC_Key = userlib.Argon2Key([]byte(password), []byte(username), uint32(16))\r\n\tuserdata.Files = make(map[string]FileStorage)\r\n\r\n\tmarshal, _ := json.Marshal(userdata)\r\n\tpadded_marshal := Pad(marshal, 16)\r\n\tiv := userlib.RandomBytes(userlib.AESBlockSizeBytes)\r\n\tencrypted_marshal := userlib.SymEnc(userdata.Personal_Key, iv, padded_marshal)\r\n\r\n\thmac_tag, _ := userlib.HMACEval(userdata.HMAC_Key, encrypted_marshal)\r\n\tsecure_message := append(encrypted_marshal, hmac_tag...)\r\n\r\n\tuserlib.DatastoreSet(userdata.UUID, secure_message)\r\n\tuserdataptr = &userdata\r\n\treturn &userdata, err\r\n}", "func (app *App) StartSession() error {\n\tif app.APIKey == \"\" {\n\t\treturn errors.New(\"API key is not present\")\n\t}\n\n\tapp.session = toggl.OpenSession(app.APIKey)\n\treturn nil\n}", "func beginNewSession(context *HandlerContext, user *users.User, w http.ResponseWriter) {\n\tsessionState := SessionState{\n\t\tBeginTime: time.Now(),\n\t\tUser: user,\n\t}\n\n\t// begin new session and save seesion state to the store\n\t_, err := sessions.BeginSession(context.SigningKey, context.SessionStore, sessionState, w)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"error beginning session: %s\", err), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Add(headerContentType, contentTypeJSON)\n\tw.WriteHeader(http.StatusCreated)\n\n\terr = json.NewEncoder(w).Encode(user)\n\tif err != nil {\n\t\thttp.Error(w, \"error encoding User struct to JSON\", http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func (db *UserDatabase) Init() error {\n\tvar err error\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, stmt := range schemaV1 {\n\t\tlog.Println(stmt)\n\t\ttx.MustExec(stmt)\n\t}\n\tdefaultPassword := getDefaultPassword()\n\t_, err = tx.CreateUser(claudia.ApplicationAdminUsername, defaultPassword)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsessionAuthKey := securecookie.GenerateRandomKey(32)\n\tsessionCryptKey := securecookie.GenerateRandomKey(32)\n\tcrt, key := util.GenerateSelfSignedCert()\n\ttx.MustExec(\"INSERT INTO configuration (schema_version, session_auth_key, session_crypt_key, private_key, public_certificate) VALUES ($1, $2, $3, $4, $5)\",\n\t\tSchemaVersion, sessionAuthKey, sessionCryptKey, key, crt)\n\ttx.Commit()\n\ttx, err = db.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\tconf, err := tx.GetConfiguration()\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn err\n\t}\n\ttx.Commit()\n\tlog.Printf(\"Successfully initialized database (schema: %d)\", conf.SchemaVersion)\n\treturn nil\n}", "func (e *Entity) NewSession() string {\n\te.AssertUser()\n\tkey := base.GenerateHexSecret(32)\n\tuserId := e.Id()\n\tdata := member.SessionData{\n\t\tKey: key,\n\t\tUserId: &userId,\n\t\tCreated: time.Now(),\n\t\tLastActivity: time.Now(),\n\t}\n\tif err := scol.Insert(data); err != nil {\n\t\tlog.Printf(\"NewSession(): scol.Insert(): %s\", err)\n\t}\n\treturn key\n}", "func InitUserPool() {\n\tGlobalUserPool = NewUserPool()\n}", "func (c *Controller) StartSession() session.Store {\n\tif c.CruSession == nil {\n\t\tc.CruSession = c.Ctx.Input.CruSession\n\t}\n\treturn c.CruSession\n}", "func GetSessionAndUser(sessions *session.Sessions, users *user.Users, writer http.ResponseWriter, request *http.Request) (*session.Session, *user.User) {\n\tsessionId, err := db.ParsePK(request.Header.Get(\"sid\"))\n\tif err != nil {\n\t\thttp.Error(writer, \"invalid session id format\", http.StatusForbidden)\n\t\treturn nil, nil\n\t}\n\n\t//check session\n\tsession, err := sessions.Get(sessionId)\n\tif err != nil {\n\t\thttp.Error(writer, \"invalid session id\", http.StatusForbidden)\n\t\treturn nil, nil\n\t}\n\n\t//re-check if user actually still exists\n\tuser, err := users.Get(session.User)\n\tif err != nil {\n\t\thttp.Error(writer, err.Error(), http.StatusForbidden)\n\t\treturn nil, nil\n\t}\n\n\t//check inactive\n\tif !user.Active {\n\t\thttp.Error(writer, \"user is inactive\", http.StatusForbidden)\n\t\treturn nil, nil\n\t}\n\n\treturn session, user\n}", "func Init(url string) {\n\tmgoSession = connect(url)\n\treadOnlySession = mgoSession.Clone()\n\treadOnlySession.SetMode(mgo.Eventual, false)\n\n}", "func Init(host string, port int, username, password, database string, timeout int) (Session, error) {\n\tif timeout <= 0 {\n\t\ttimeout = 5\n\t}\n\tdialInfo := &mgo.DialInfo{\n\t\tAddrs: []string{host + \":\" + strconv.Itoa(port)},\n\t\tTimeout: time.Duration(timeout) * time.Second,\n\t\tDatabase: database,\n\t\tUsername: username,\n\t\tPassword: password,\n\t}\n\n\ts, err := mgo.DialWithInfo(dialInfo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn Session(s), nil\n}", "func (m *MMClient) initUser() error {\n\tm.Lock()\n\tdefer m.Unlock()\n\tinitLoad, err := m.Client.GetInitialLoad()\n\tif err != nil {\n\t\treturn err\n\t}\n\tinitData := initLoad.Data.(*model.InitialLoad)\n\tm.User = initData.User\n\t// we only load all team data on initial login.\n\t// all other updates are for channels from our (primary) team only.\n\t//m.log.Debug(\"initUser(): loading all team data\")\n\tfor _, v := range initData.Teams {\n\t\tm.Client.SetTeamId(v.Id)\n\t\tmmusers, _ := m.Client.GetProfiles(0, 50000, \"\")\n\t\tt := &Team{Team: v, Users: mmusers.Data.(map[string]*model.User), Id: v.Id}\n\t\tmmchannels, _ := m.Client.GetChannels(\"\")\n\t\tt.Channels = mmchannels.Data.(*model.ChannelList)\n\t\tmmchannels, _ = m.Client.GetMoreChannels(\"\")\n\t\tt.MoreChannels = mmchannels.Data.(*model.ChannelList)\n\t\tm.OtherTeams = append(m.OtherTeams, t)\n\t\tif v.Name == m.Credentials.Team {\n\t\t\tm.Team = t\n\t\t\tm.log.Debugf(\"initUser(): found our team %s (id: %s)\", v.Name, v.Id)\n\t\t}\n\t\t// add all users\n\t\tfor k, v := range t.Users {\n\t\t\tm.Users[k] = v\n\t\t}\n\t}\n\treturn nil\n}", "func (d *Service) GetSessionUser(ctx context.Context, SessionId string) (*thunderdome.User, error) {\n\tUser := &thunderdome.User{}\n\n\te := d.DB.QueryRowContext(ctx, `\n\t\tSELECT\n u.id,\n u.name,\n u.email,\n u.type,\n u.avatar,\n u.verified,\n u.notifications_enabled,\n COALESCE(u.country, ''),\n COALESCE(u.locale, ''),\n COALESCE(u.company, ''),\n COALESCE(u.job_title, ''),\n u.created_date,\n u.updated_date,\n u.last_active\n FROM thunderdome.user_session us\n LEFT JOIN thunderdome.users u ON u.id = us.user_id\n WHERE us.session_id = $1 AND NOW() < us.expire_date`,\n\t\tSessionId,\n\t).Scan(\n\t\t&User.Id,\n\t\t&User.Name,\n\t\t&User.Email,\n\t\t&User.Type,\n\t\t&User.Avatar,\n\t\t&User.Verified,\n\t\t&User.NotificationsEnabled,\n\t\t&User.Country,\n\t\t&User.Locale,\n\t\t&User.Company,\n\t\t&User.JobTitle,\n\t\t&User.CreatedDate,\n\t\t&User.UpdatedDate,\n\t\t&User.LastActive)\n\tif e != nil {\n\t\tif !errors.Is(e, sql.ErrNoRows) {\n\t\t\td.Logger.Ctx(ctx).Error(\"user_session_get query error\", zap.Error(e))\n\t\t}\n\t\treturn nil, errors.New(\"active session match not found\")\n\t}\n\n\tUser.GravatarHash = db.CreateGravatarHash(User.Email)\n\n\treturn User, nil\n}", "func NewSession(conn *Conn) *Session {\n\tsession := &Session{\n\t\tID: uuid.New().String(),\n\t\tconn: conn,\n\t\tsettings: make(map[string]interface{}),\n\t\tParser:NewCodec(),\n\t}\n\tsession.settings[\"db\"] = 0\n\tsession.settings[\"auth\"] = true\n\treturn session\n}", "func (pool *SessionPool) init() error {\n\t// check the hosts status\n\tif err := checkAddresses(pool.conf.timeOut, pool.conf.serviceAddrs, pool.conf.sslConfig, pool.conf.useHTTP2); err != nil {\n\t\treturn fmt.Errorf(\"failed to initialize the session pool, %s\", err.Error())\n\t}\n\n\t// create sessions to fulfill the min pool size\n\tfor i := 0; i < pool.conf.minSize; i++ {\n\t\tsession, err := pool.newSession()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to initialize the session pool, %s\", err.Error())\n\t\t}\n\n\t\tsession.returnedAt = time.Now()\n\t\tpool.addSessionToIdle(session)\n\t}\n\n\treturn nil\n}", "func NewSession(cfg *gocql.ClusterConfig) (*JallyORM, error) {\n\torm := &JallyORM{}\n\tsession, err := cfg.CreateSession()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\torm.Session = session\n\treturn orm, nil\n}", "func (pdr *ProviderMySQL) SessionNew(sid string) (session.Store, error) {\n\tc := pdr.connectInit()\n\trow := c.QueryRow(\"select session_data from \"+TableName+\" where session_key=?\", sid)\n\tvar data []byte\n\terr := row.Scan(&data)\n\tif err == sql.ErrNoRows {\n\t\t_, err = c.Exec(\"insert into \"+TableName+\"(`session_key`,`session_data`,`session_expiry`) values(?,?,?)\",\n\t\t\tsid, \"\", time.Now().Unix())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tvar kv map[interface{}]interface{}\n\tif len(data) == 0 {\n\t\tkv = make(map[interface{}]interface{})\n\t} else {\n\t\tkv, err = session.DecodeGob(data)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\trs := &SessionStoreMySQL{conn: c, sid: sid, values: kv}\n\treturn rs, nil\n}", "func (us *UserAppSession) New(UserID uint) error {\n\tus.UserID = UserID\n\tif err := us.DeleteAll(); err != nil {\n\t\treturn err\n\t}\n\tif err := us.Create(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func gwLogin(c *gin.Context) {\n\ts := getHostServer(c)\n\treqId := getRequestId(s, c)\n\tvar err error\n\tvar hasCheckPass = false\n\tvar checker = s.AuthParamChecker\n\tvar authParam AuthParameter\n\tfor _, resolver := range s.AuthParamResolvers {\n\t\tauthParam = resolver.Resolve(c)\n\t\tif err = checker.Check(authParam); err == nil {\n\t\t\thasCheckPass = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif !hasCheckPass {\n\t\tc.JSON(http.StatusBadRequest, s.RespBodyBuildFunc(http.StatusBadRequest, reqId, err, nil))\n\t\tc.Abort()\n\t\treturn\n\t}\n\n\t// Login\n\tuser, err := s.AuthManager.Login(authParam)\n\tif err != nil || user.IsEmpty() {\n\t\tc.JSON(http.StatusNotFound, s.RespBodyBuildFunc(http.StatusNotFound, reqId, err.Error(), nil))\n\t\tc.Abort()\n\t\treturn\n\t}\n\tsid, credential, ok := encryptSid(s, authParam)\n\tif !ok {\n\t\tc.JSON(http.StatusInternalServerError, s.RespBodyBuildFunc(http.StatusInternalServerError, reqId, \"Create session ID fail.\", nil))\n\t\tc.Abort()\n\t\treturn\n\t}\n\tif err := s.SessionStateManager.Save(sid, user); err != nil {\n\t\tc.JSON(http.StatusInternalServerError, s.RespBodyBuildFunc(http.StatusInternalServerError, reqId, \"Save session fail.\", err.Error()))\n\t\tc.Abort()\n\t\treturn\n\t}\n\tvar userPerms []gin.H\n\tfor _, p := range user.Permissions {\n\t\tuserPerms = append(userPerms, gin.H{\n\t\t\t\"Key\": p.Key,\n\t\t\t\"Name\": p.Name,\n\t\t\t\"Desc\": p.Descriptor,\n\t\t})\n\t}\n\tcks := s.conf.Security.Auth.Cookie\n\texpiredAt := time.Duration(cks.MaxAge) * time.Second\n\tvar userRoles = gin.H{\n\t\t\"Id\": 0,\n\t\t\"name\": \"\",\n\t\t\"desc\": \"\",\n\t}\n\tpayload := gin.H{\n\t\t\"Credentials\": gin.H{\n\t\t\t\"Token\": credential,\n\t\t\t\"ExpiredAt\": time.Now().Add(expiredAt).Unix(),\n\t\t},\n\t\t\"Roles\": userRoles,\n\t\t\"Permissions\": userPerms,\n\t}\n\tbody := s.RespBodyBuildFunc(0, reqId, nil, payload)\n\tc.SetCookie(cks.Key, credential, cks.MaxAge, cks.Path, cks.Domain, cks.Secure, cks.HttpOnly)\n\tc.JSON(http.StatusOK, body)\n}", "func CreateSession() {\n\n\tconst MT = \"init\"\n\t// Initialize a session that the SDK uses to load\n\t// credentials from the shared credentials file ~/.aws/credentials\n\t// and configuration from the shared configuration file ~/.aws/config.\n\t/*s, err := session.NewSessionWithOptions(session.Options{\n\t\tSharedConfigState: session.SharedConfigEnable,\n\t\tProfile: \"tfm-develop\",\n\t})*/\n\n\ts, err := session.NewSession(&aws.Config{\n\t\tRegion: aws.String(\"eu-central-1\")},\n\t)\n\n\tif err != nil {\n\t\tlog.Println(\"Couldn't create AWS session\", err)\n\t}\n\tawsSession = s\n\tlog.Println(\"AWS Session successfully created.\")\n\n}", "func (d *Abstraction) InitSession(n string) error {\n\tvar err error\n\tvar conn *dbus.Conn\n\n\tif d.Conn != nil {\n\t\treturn errors.New(\"[DBUS ABSTRACTION ERROR - initSession - Session already initialized]\")\n\t}\n\tconn, err = GetDbus()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif n != \"\" {\n\t\treply, err := conn.RequestName(n, dbus.NameFlagDoNotQueue)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif reply != dbus.RequestNameReplyPrimaryOwner {\n\t\t\treturn errors.New(\"[DBUS ABSTRACTION ERROR - initSession - name already taken]\")\n\t\t}\n\t}\n\n\td.Conn = conn\n\td.Sigmap = make(map[string]chan *AbsSignal)\n\td.Recv = make(chan *dbus.Signal, 1024)\n\tgo d.signalsHandler()\n\treturn nil\n}", "func (o *VirtualSessionProvider) Init(gclifetime int64, config string) error {\n\tvar opts session.Options\n\tif err := json.Unmarshal([]byte(config), &opts); err != nil {\n\t\treturn err\n\t}\n\t// Note that these options are unprepared so we can't just use NewManager here.\n\t// Nor can we access the provider map in session.\n\t// So we will just have to do this by hand.\n\t// This is only slightly more wrong than modules/setting/session.go:23\n\tswitch opts.Provider {\n\tcase \"memory\":\n\t\to.provider = &session.MemProvider{}\n\tcase \"file\":\n\t\to.provider = &session.FileProvider{}\n\tcase \"redis\":\n\t\to.provider = &RedisProvider{}\n\tcase \"db\":\n\t\to.provider = &DBProvider{}\n\tcase \"mysql\":\n\t\to.provider = &mysql.MysqlProvider{}\n\tcase \"postgres\":\n\t\to.provider = &postgres.PostgresProvider{}\n\tcase \"couchbase\":\n\t\to.provider = &couchbase.CouchbaseProvider{}\n\tcase \"memcache\":\n\t\to.provider = &memcache.MemcacheProvider{}\n\tdefault:\n\t\treturn fmt.Errorf(\"VirtualSessionProvider: Unknown Provider: %s\", opts.Provider)\n\t}\n\treturn o.provider.Init(gclifetime, opts.ProviderConfig)\n}", "func (sc *SessionContext) GetSession() (*sessions.Session, error) {\n\tif sc.request == nil || sc.response == nil {\n\t\treturn nil, errors.New(\"Runtime tried to sccess a session before this SessionContext was fully initialized.\")\n\t}\n\n\t//TODO: Lazy load session here.\n\tsession, _ := sc.store.Get(sc.request, \"user\")\n\n\treturn session, nil\n}", "func (sv *globalSystemVariables) NewSessionMap() map[string]sql.SystemVarValue {\n\tsv.mutex.RLock()\n\tdefer sv.mutex.RUnlock()\n\tsessionVals := make(map[string]sql.SystemVarValue, len(sv.sysVarVals))\n\tfor key, val := range sv.sysVarVals {\n\t\tsessionVals[key] = val\n\t}\n\treturn sessionVals\n}", "func InitUser(username string, password string) (userdataptr *User, err error) {\n\tvar userdata User\n\tuserdataptr = &userdata\n\n\tuserdata.Username = username\n\tuserdata.Password = password\n\n\t//map for all the files\n\thm := make(map[string]FileKeys)\n\tuserdata.Files = hm\n\n\t//map for sharedFiles\n\tsf := make(map[string]userlib.UUID)\n\tuserdata.SharedFiles = sf\n\n\t//map for receivedFiles\n\t//rf := make(map[string]AccessRecord)\n\t//userdata.ReceivedFiles = rf\n\n\t//map for recordKeys\n\trk := make(map[string][]byte)\n\tuserdata.RecordKeys = rk\n\n\t//RSA key\n\t//generate public encryption keys and digital signature keys\n\tpublicEncryptionKey, publicDecryptionKey, _ := userlib.PKEKeyGen()\n\tdigitalPrivateKey, digitalPublicKey, _ := userlib.DSKeyGen()\n\n\t//set users private RSA key and private DS Key\n\tuserdata.RSA = publicDecryptionKey\n\tuserdata.DS = digitalPrivateKey\n\n\t//check if username already exists\n\t_, duplicate := userlib.KeystoreGet(username + \"PK\")\n\tif (duplicate) {\n\t\treturn nil, errors.New(\"This user already exists\")\n\t}\n\n\t//set users public RSA key\n\tuserlib.KeystoreSet(username + \"PK\", publicEncryptionKey)\n\tuserlib.KeystoreSet(username + \"DS\", digitalPublicKey)\n\n\t//create salt and generate the key using this salt\n\tsalt := userlib.Hash([]byte(username + password))\n\n\t//userKey is the key used to store the user struct in Datastore\n\tvar userKey []byte\n\tuserKey = userlib.Argon2Key([]byte(password), salt[:16], uint32(userlib.AESKeySize))\n\n\t//UUID should be userKEy\n\tnew_UUID, _ := uuid.FromBytes([]byte(userKey))\n\n\t//data should be marshaled version of the user struct\n\tdata, _ := json.Marshal(userdata)\n\n\t//padding for userstruct, must be multiple of AESBlockSize\n\tdata = padFile(data)\n\n\t//generate IV\n\tIV := userlib.RandomBytes(userlib.AESKeySize)\n\n\t//generate key for Symmetric encryption\n\tsalt2 := userlib.Hash([]byte(password + username))\n\tencryptionKey := userlib.Argon2Key([]byte(password), salt2[:16], uint32(userlib.AESKeySize))\n\n\t//encrypt the user struct\n\tencryptedMessage := userlib.SymEnc(encryptionKey, IV, data)\n\n\t//Get the HMAC key\n\thashKey := userlib.Argon2Key([]byte(password), salt2[16:], uint32(userlib.AESKeySize))\n\tUser_HMAC, _ := userlib.HMACEval(hashKey, []byte(encryptedMessage))\n\n\t//store everything in the datastore\n\t//make a slice containing HMAC, and encrypted struct\n\t//then marshal this 2D slice so it converts into []byte format\n\tvar output Stored\n\toutput.HMAC = User_HMAC\n\toutput.EncryptedM = encryptedMessage\n\n\t//output := [][]byte{User_HMAC, encryptedMessage}\n\tmarshalOutput, _ := json.Marshal(output)\n\n\tuserlib.DatastoreSet(new_UUID, marshalOutput)\n\treturn &userdata, nil\n}", "func (am AuthManager) Login(userID string, ctx *Ctx) (session *Session, err error) {\n\t// create a new session value\n\tsessionValue := NewSessionID()\n\t// userID and sessionID are required\n\tsession = NewSession(userID, sessionValue)\n\tif am.SessionTimeoutProvider != nil {\n\t\tsession.ExpiresUTC = am.SessionTimeoutProvider(session)\n\t}\n\tsession.UserAgent = webutil.GetUserAgent(ctx.Request)\n\tsession.RemoteAddr = webutil.GetRemoteAddr(ctx.Request)\n\n\t// call the perist handler if one's been provided\n\tif am.PersistHandler != nil {\n\t\terr = am.PersistHandler(ctx.Context(), session)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// if we're in jwt mode, serialize the jwt.\n\tif am.SerializeSessionValueHandler != nil {\n\t\tsessionValue, err = am.SerializeSessionValueHandler(ctx.Context(), session)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// inject cookies into the response\n\tam.injectCookie(ctx, am.CookieNameOrDefault(), sessionValue, session.ExpiresUTC)\n\treturn session, nil\n}", "func (s *UserSession) Load(session map[string]string) bool {\n s.AesKey = session[app.STR_KEY]\n s.UserName = session[app.STR_NAME]\n s.Password = session[app.STR_PASSWORD]\n s.Expire = session[app.STR_EXPIRE]\n s.Encrypted = true\n\n return s.Decrypt()\n}", "func (c *Client) StartSession(ctx context.Context) (*Session, error) {\n\tstreamClient, err := c.client.Update(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Session{\n\t\tclosed: make(chan struct{}),\n\t\tstreamClient: streamClient,\n\t}, nil\n}", "func (me *GJUser) StartSession(){\n\tme.qreq(\"sessions/open\",\"\")\n}", "func NewSession() Session {\n\treturn Session{\n\t\tID: utils.NewBytes32ID(),\n\t\tLastUsed: Time{Time: time.Now()},\n\t}\n}", "func NewSession(conn net.Conn) *Session {\n\tvar suuid = atomic.AddUint64(&uuid, 1)\n\n\tsession := &Session{\n\t\tsid: suuid,\n\t\tuid: 0, // 可以为用户的id\n\n\t\trawConn: conn,\n\t\tsendCh: make(chan []byte, 100),\n\t\tdone: make(chan error),\n\t\tmessageCh: make(chan any, 100),\n\t}\n\n\treturn session\n}", "func (m *Mongo) Init() (session *mgo.Session, err error) {\n\tif session != nil {\n\t\treturn nil, errors.New(\"session already exists\")\n\t}\n\n\tif session, err = mgo.Dial(m.URI); err != nil {\n\t\treturn nil, err\n\t}\n\n\tsession.EnsureSafe(&mgo.Safe{WMode: \"majority\"})\n\tsession.SetMode(mgo.Strong, true)\n\treturn session, nil\n}", "func (pool *SessionPool) newSession() (*pureSession, error) {\n\tgraphAddr := pool.getNextAddr()\n\tcn := connection{\n\t\tseverAddress: graphAddr,\n\t\ttimeout: 0 * time.Millisecond,\n\t\treturnedAt: time.Now(),\n\t\tsslConfig: pool.conf.sslConfig,\n\t\tuseHTTP2: pool.conf.useHTTP2,\n\t\tgraph: nil,\n\t}\n\n\t// open a new connection\n\tif err := cn.open(cn.severAddress, pool.conf.timeOut, pool.conf.sslConfig, pool.conf.useHTTP2); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create a net.Conn-backed Transport,: %s\", err.Error())\n\t}\n\n\t// authenticate with username and password to get a new session\n\tauthResp, err := cn.authenticate(pool.conf.username, pool.conf.password)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create a new session: %s\", err.Error())\n\t}\n\n\t// If the authentication failed, close the session pool because the pool must have a valid user to work\n\tif authResp.GetErrorCode() != 0 {\n\t\tif authResp.GetErrorCode() == nebula.ErrorCode_E_BAD_USERNAME_PASSWORD ||\n\t\t\tauthResp.GetErrorCode() == nebula.ErrorCode_E_USER_NOT_FOUND {\n\t\t\tpool.Close()\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"failed to authenticate the user, error code: %d, error message: %s, the pool has been closed\",\n\t\t\t\tauthResp.ErrorCode, authResp.ErrorMsg)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"failed to create a new session: %s\", authResp.GetErrorMsg())\n\t}\n\n\tsessID := authResp.GetSessionID()\n\ttimezoneOffset := authResp.GetTimeZoneOffsetSeconds()\n\ttimezoneName := authResp.GetTimeZoneName()\n\t// Create new session\n\tnewSession := pureSession{\n\t\tsessionID: sessID,\n\t\tconnection: &cn,\n\t\tsessPool: pool,\n\t\ttimezoneInfo: timezoneInfo{timezoneOffset, timezoneName},\n\t\tspaceName: pool.conf.spaceName,\n\t}\n\n\t// Switch to the default space\n\tstmt := fmt.Sprintf(\"USE %s\", pool.conf.spaceName)\n\tuseSpaceRs, err := newSession.execute(stmt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif useSpaceRs.GetErrorCode() != ErrorCode_SUCCEEDED {\n\t\tnewSession.close()\n\t\treturn nil, fmt.Errorf(\"failed to use space %s: %s\",\n\t\t\tpool.conf.spaceName, useSpaceRs.GetErrorMsg())\n\t}\n\treturn &newSession, nil\n}", "func getSession(ctx context.Context, id string) (middleware.Session, error) {\n\tsessionUUID, err := uuid.FromString(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsession, err := loader.Loader.GetSession(ctx, sessionUUID)\n\n\treturn Session{Row: session}, err\n}", "func CreateAndInitializeNewSession(graph *tf.Graph) *tf.Session{\n\tsession, err := tf.NewSession(graph, nil)\n\n\tif err != nil {\n\t\tfmt.Printf(\"[ERROR]: Create and Initialize New Session\\n\" + err.Error())\n\t\tos.Exit(1)\n\t}\n\n\treturn session\n}", "func CreateSession(e *Engine, username string) (string, error) {\n\tt := time.Now().Unix()\n\n\tsession_id, err := bcrypt.GenerateFromPassword([]byte(username + strconv.FormatInt(t, 10) + \"8LF5NjBRiL9e1jmOCh53\"), 10)\n\t_, err = e.RawInsert(InsertQuery{\n\t\tTable: \"autoscope_user_sessions\",\n\t\tData: map[string]interface{}{\n\t\t\t\"username\": username,\n\t\t\t\"time\": t,\n\t\t\t\"session_id\": string(session_id),\n\t\t},\n\t})\n\treturn string(session_id), err\n}", "func makeNewSessionRequest(userId uint64) *store.ChangeRequest {\n\tchset := make([]store.Change, 5)\n\n\t// Create new entity.\n\t// Entity ID 1 now refers to this within the changeset.\n\tchset[0].TargetEntity = 1\n\tchset[0].Key = \"id\"\n\tchset[0].Value = strconv.FormatUint(chset[0].TargetEntity, 10)\n\n\t// Make new entity a session entity.\n\tchset[1].TargetEntity = 1\n\tchset[1].Key = \"kind\"\n\tchset[1].Value = \"session\"\n\n\t// Attach session entity to user.\n\tchset[2].TargetEntity = userId\n\tchset[2].Key = \"attach 1\"\n\tchset[2].Value = \"true\"\n\n\t// Attach node ID to session entity.\n\tidStr := strconv.FormatUint(uint64(config.Id()), 10)\n\tchset[3].TargetEntity = 1\n\tchset[3].Key = \"attach \" + idStr\n\tchset[3].Value = \"true\"\n\n\t// Set session entity as transient.\n\tchset[4].TargetEntity = 1\n\tchset[4].Key = \"transient\"\n\tchset[4].Value = \"true\"\n\n\treturn makeRequest(chset)\n}", "func OpenSession(c *gin.Context) {\n\tsession := models.Session{\n\t\tCode: random.RandomString(4),\n\t\tStatus: \"open\",\n\t}\n\tif err := models.DB.Create(&session).Error; err != nil {\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"data\": session})\n}", "func GetSession(ctx appengine.Context) (session *Session, err error) {\n\treqId := appengine.RequestID(ctx)\n\tsession, ok := authenticatedSessions[reqId]\n\tif ok {\n\t\treturn\n\t}\n\treturn nil, Unauthenticated\n}", "func SetCtx(p PTR, _ctxid int64, rpc *memrpc.Server) {\n\tC.set_ctxid(C.PTR(p), C.int64_t(_ctxid))\n\tsessionBuf[_ctxid] = &session{ctxId: _ctxid, rpcServer: rpc}\n}", "func init() {\n\tsession.Register(\"memcache\", memcProvider)\n}", "func NewSession(cfg Config) (*Session, error) {\n\tif cfg.PortBegin >= cfg.PortEnd {\n\t\treturn nil, errors.New(\"invalid port range\")\n\t}\n\tvar err error\n\tcfg.Database, err = homedir.Expand(cfg.Database)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcfg.DataDir, err = homedir.Expand(cfg.DataDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = os.MkdirAll(filepath.Dir(cfg.Database), 0750)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tl := logger.New(\"session\")\n\tdb, err := bolt.Open(cfg.Database, 0640, &bolt.Options{Timeout: time.Second})\n\tif err == bolt.ErrTimeout {\n\t\treturn nil, errors.New(\"resume database is locked by another process\")\n\t} else if err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tdb.Close()\n\t\t}\n\t}()\n\tvar ids []string\n\terr = db.Update(func(tx *bolt.Tx) error {\n\t\t_, err2 := tx.CreateBucketIfNotExists(sessionBucket)\n\t\tif err2 != nil {\n\t\t\treturn err2\n\t\t}\n\t\tb, err2 := tx.CreateBucketIfNotExists(torrentsBucket)\n\t\tif err2 != nil {\n\t\t\treturn err2\n\t\t}\n\t\treturn b.ForEach(func(k, _ []byte) error {\n\t\t\tids = append(ids, string(k))\n\t\t\treturn nil\n\t\t})\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres, err := boltdbresumer.New(db, torrentsBucket)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar dhtNode *dht.DHT\n\tif cfg.DHTEnabled {\n\t\tdhtConfig := dht.NewConfig()\n\t\tdhtConfig.Address = cfg.DHTHost\n\t\tdhtConfig.Port = int(cfg.DHTPort)\n\t\tdhtConfig.DHTRouters = strings.Join(cfg.DHTBootstrapNodes, \",\")\n\t\tdhtConfig.SaveRoutingTable = false\n\t\tdhtNode, err = dht.New(dhtConfig)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = dhtNode.Start()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tports := make(map[int]struct{})\n\tfor p := cfg.PortBegin; p < cfg.PortEnd; p++ {\n\t\tports[int(p)] = struct{}{}\n\t}\n\tbl := blocklist.New()\n\tc := &Session{\n\t\tconfig: cfg,\n\t\tdb: db,\n\t\tresumer: res,\n\t\tblocklist: bl,\n\t\ttrackerManager: trackermanager.New(bl, cfg.DNSResolveTimeout),\n\t\tlog: l,\n\t\ttorrents: make(map[string]*Torrent),\n\t\ttorrentsByInfoHash: make(map[dht.InfoHash][]*Torrent),\n\t\tavailablePorts: ports,\n\t\tdht: dhtNode,\n\t\tpieceCache: piececache.New(cfg.PieceCacheSize, cfg.PieceCacheTTL, cfg.ParallelReads),\n\t\tram: resourcemanager.New(cfg.MaxActivePieceBytes),\n\t\tcreatedAt: time.Now(),\n\t\tcloseC: make(chan struct{}),\n\t\twebseedClient: http.Client{\n\t\t\tTransport: &http.Transport{\n\t\t\t\tDialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {\n\t\t\t\t\tip, port, err := resolver.Resolve(ctx, addr, cfg.DNSResolveTimeout, bl)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\tvar d net.Dialer\n\t\t\t\t\ttaddr := &net.TCPAddr{IP: ip, Port: port}\n\t\t\t\t\tdctx, cancel := context.WithTimeout(ctx, cfg.WebseedDialTimeout)\n\t\t\t\t\tdefer cancel()\n\t\t\t\t\treturn d.DialContext(dctx, network, taddr.String())\n\t\t\t\t},\n\t\t\t\tTLSHandshakeTimeout: cfg.WebseedTLSHandshakeTimeout,\n\t\t\t\tResponseHeaderTimeout: cfg.WebseedResponseHeaderTimeout,\n\t\t\t},\n\t\t},\n\t}\n\text, err := bitfield.NewBytes(c.extensions[:], 64)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\text.Set(61) // Fast Extension (BEP 6)\n\text.Set(43) // Extension Protocol (BEP 10)\n\tif cfg.DHTEnabled {\n\t\text.Set(63) // DHT Protocol (BEP 5)\n\t}\n\terr = c.startBlocklistReloader()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif cfg.DHTEnabled {\n\t\tc.dhtPeerRequests = make(map[*torrent]struct{})\n\t\tgo c.processDHTResults()\n\t}\n\tc.loadExistingTorrents(ids)\n\tif c.config.RPCEnabled {\n\t\tc.rpc = newRPCServer(c)\n\t\terr = c.rpc.Start(c.config.RPCHost, c.config.RPCPort)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tgo c.updateStatsLoop()\n\treturn c, nil\n}", "func NewSession(userID int, password string, client string) (*Session, error) {\n\t// Generate session\n\tsession := new(Session)\n\tsession.UserID = userID\n\tsession.Client = client\n\n\t// Make session expire in one day, without use\n\tsession.Expire = time.Now().Add(time.Duration(24 * time.Hour)).Unix()\n\n\t// Generate salts for use with PBKDF2\n\tsaltBuf := make([]byte, 16)\n\tif _, err := rand.Read(saltBuf); err != nil {\n\t\treturn nil, err\n\t}\n\tsalt1 := saltBuf\n\n\tsaltBuf = make([]byte, 16)\n\tif _, err := rand.Read(saltBuf); err != nil {\n\t\treturn nil, err\n\t}\n\tsalt2 := saltBuf\n\n\t// Use PBKDF2 to generate a public key and secret key based off the user's password\n\tsession.PublicKey = fmt.Sprintf(\"%x\", pbkdf2.Key([]byte(password), salt1, 4096, 16, sha1.New))\n\tsession.SecretKey = fmt.Sprintf(\"%x\", pbkdf2.Key([]byte(password), salt2, 4096, 16, sha1.New))\n\n\t// Save session\n\tif err := session.Save(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn session, nil\n}", "func GetSession(token string) (Session, error) {\n\tif m == nil {\n\t\treturn emptySession(), errors.New(\"Sessions not started\")\n\t}\n\n\tsession, err := m.provider.Read(token)\n\n\tif err != nil {\n\t\treturn emptySession(), err\n\t}\n\n\tsession.lifetime = time.Now().Add(m.maxLifetime) // reset lifetime\n\terr = m.updateSession(&session)\n\n\tif err != nil {\n\t\treturn emptySession(), err\n\t}\n\n\treturn session, nil\n}", "func newSessionCache(loader sessionLoaderFunc, policy *CryptoPolicy) sessionCache {\n\twrapper := func(id string) (*Session, error) {\n\t\ts, err := loader(id)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t_, ok := s.encryption.(*sharedEncryption)\n\t\tif !ok {\n\t\t\tmu := new(sync.Mutex)\n\t\t\torig := s.encryption\n\t\t\twrapped := &sharedEncryption{\n\t\t\t\tEncryption: orig,\n\t\t\t\tmu: mu,\n\t\t\t\tcond: sync.NewCond(mu),\n\t\t\t}\n\n\t\t\tsessionInjectEncryption(s, wrapped)\n\t\t}\n\n\t\treturn s, nil\n\t}\n\n\tswitch eng := policy.SessionCacheEngine; eng {\n\tcase \"\", \"default\", \"ristretto\":\n\t\treturn newRistrettoCache(wrapper, policy)\n\tcase \"mango\":\n\t\treturn newMangoCache(wrapper, policy)\n\tdefault:\n\t\tpanic(\"invalid session cache engine: \" + eng)\n\t}\n}", "func (pder *MemProvider) SessionUpdate(sid string) error {\n\treturn (*session.MemProvider)(pder).SessionUpdate(context.Background(), sid)\n}", "func InitUser(username string, password string) (userdataptr *User, err error) {\r\n\tvar userdata User\r\n\tvar verify_key userlib.DSVerifyKey //for digital signature verification\r\n\tuserdataptr = &userdata\r\n\r\n\tif username == \"\" || password == \"\" {\r\n\t\treturn nil, errors.New(\"Empty username or password\")\r\n\t}\r\n\t//RETURN ERROR IF USERNAME EXISTS, must generate UUID first\r\n\tpw_hash := userlib.Argon2Key([]byte(password), []byte(username), 16)\r\n\tkey_gen, _ := userlib.HMACEval(pw_hash, []byte(username))\r\n\tkey_gen = key_gen[:16]\r\n\tuuid_, _ := uuid.FromBytes(key_gen) // byte slice since HMACEval produces 64 byte HMAC\r\n\t_, ok := userlib.DatastoreGet(uuid_) // shouldnt exist\r\n\r\n\tif ok {\r\n\t\treturn nil, errors.New(\"Username already exists\")\r\n\t}\r\n\r\n\tuserdata.Username = username\r\n\t//password hashing: salt = username\r\n\tuserdata.PasswordHash = pw_hash\r\n\t//use hashed password to generate UUID/rest of keys\r\n\tuserdata.UUID_ = uuid_\r\n\r\n\t//generate private signing key\r\n\tvar public_RSAKey userlib.PKEEncKey\r\n\tuserdata.PrivSignKey, verify_key, _ = userlib.DSKeyGen()\r\n\tpublic_RSAKey, userdata.PrivRSAKey, _ = userlib.PKEKeyGen()\r\n\tuserlib.KeystoreSet(username+\"public_key\", public_RSAKey) //store public key in store\r\n\tuserlib.KeystoreSet(username+\"ds\", verify_key) // store public signature in store\r\n\t//generate private encryption key\r\n\tenc_pw := append(pw_hash, []byte(\"encryption\")...)\r\n\tuserdata.EncKey = userlib.Argon2Key(enc_pw, []byte(username), 16)\r\n\r\n\t//create filespace for future use\r\n\tuserdata.Filespace = make(map[string]FileKey)\r\n\tuserdata.FilesOwned = make(map[string]FileKey)\r\n\tuserdata.AccessTokens = make(map[string]uuid.UUID)\r\n\t//need HMAC for later\r\n\thmac_pw := append([]byte(password), []byte(\"mac\")...)\r\n\thmac_key := userlib.Argon2Key(hmac_pw, []byte(username), 16)\r\n\tuserdata.HMACKey = hmac_key\r\n\r\n\t//marshal, generate HMAC + encrypt, and send to datastore\r\n\tuser_bytes, _ := json.Marshal(userdata)\r\n\r\n\tenc_IV := userlib.RandomBytes(userlib.AESBlockSizeBytes) //if IV isnt random, not secure\r\n\tenc_data := userlib.SymEnc(userdata.EncKey, enc_IV, PKCS(user_bytes, \"add\"))\r\n\tds, _ := userlib.HMACEval(hmac_key, enc_data)\r\n\r\n\tenc_data_hmac := append(enc_data, ds...) //append HMAC at end of encrypted data\r\n\tuserlib.DatastoreSet(userdata.UUID_, enc_data_hmac)\r\n\r\n\treturn &userdata, nil\r\n}", "func SessionGetUser(session *session.Session, r *http.Request) *models.User {\n\tid := (*session).Get(\"id\").(int)\n\tname := (*session).Get(\"name\").(string)\n\temail := (*session).Get(\"email\").(string)\n\tu := models.User{Id: id, Name: name, Email: email}\n\treturn &u\n}", "func (m *Manager) LoadSession(context interface{}, id []byte, state *vlpersistence.SessionState) error {\n\tsID := string(id)\n\tctx := context.(*loadContext)\n\n\tdefer func() {\n\t\tctx.bar.IncrBy(1, time.Since(ctx.startTs))\n\t}()\n\n\tif len(state.Errors) != 0 {\n\t\tm.log.Error(\"Session load\", zap.String(\"ClientID\", sID), zap.Errors(\"errors\", state.Errors))\n\t\t// if err := m.persistence.SubscriptionsDelete(id); err != nil && err != persistence.ErrNotFound {\n\t\t//\tm.log.Error(\"Persisted subscriber delete\", zap.Error(err))\n\t\t// }\n\n\t\treturn nil\n\t}\n\n\tvar err error\n\n\tstatus := &systree.SessionCreatedStatus{\n\t\tClean: false,\n\t\tTimestamp: state.Timestamp,\n\t}\n\n\tif err = m.decodeSessionExpiry(ctx, sID, state); err != nil {\n\t\tm.log.Error(\"Decode session expiry\", zap.String(\"ClientID\", sID), zap.Error(err))\n\t}\n\n\tif err = m.decodeSubscriber(ctx, sID, state.Subscriptions); err != nil {\n\t\tm.log.Error(\"Decode subscriber\", zap.String(\"ClientID\", sID), zap.Error(err))\n\t\tif err = m.persistence.SubscriptionsDelete(id); err != nil && err != vlpersistence.ErrNotFound {\n\t\t\tm.log.Error(\"Persisted subscriber delete\", zap.Error(err))\n\t\t}\n\t}\n\n\tif cfg, ok := ctx.preloadConfigs[sID]; ok && cfg.exp != nil {\n\t\tstatus.WillDelay = strconv.FormatUint(uint64(cfg.exp.willIn), 10)\n\t\tif cfg.exp.expireIn != nil {\n\t\t\tstatus.ExpiryInterval = strconv.FormatUint(uint64(*cfg.exp.expireIn), 10)\n\t\t}\n\t}\n\n\tm.Systree.Sessions().Created(sID, status)\n\treturn nil\n}", "func SetupSessionManagers(redisPool *redis.Pool, useSecureCookie bool, idleTimeout time.Duration, lifetime time.Duration) AppSessionManagers {\n\tvar milSession, adminSession, officeSession *scs.SessionManager\n\tgob.Register(Session{})\n\n\t// we need to ensure each session manager has its own store so\n\t// that sessions don't leak between apps. If a redisPool is\n\t// provided, we can use a prefix to ensure sessions are separated.\n\t// If redis is not configured, this would be local testing of some\n\t// kind in which case we can create a separate memory store for\n\t// each app\n\tnewSessionStoreFn := func(prefix string) scs.Store {\n\t\tif redisPool != nil {\n\t\t\treturn redisstore.NewWithPrefix(redisPool, prefix)\n\t\t}\n\t\t// For local testing, we don't need a background thread\n\t\t// cleaning up session\n\t\treturn memstore.NewWithCleanupInterval(time.Duration(0))\n\t}\n\n\tmilSession = scs.New()\n\tmilSession.Store = newSessionStoreFn(\"mil\")\n\tmilSession.Cookie.Name = \"mil_session_token\"\n\n\tadminSession = scs.New()\n\tadminSession.Store = newSessionStoreFn(\"admin\")\n\tadminSession.Cookie.Name = \"admin_session_token\"\n\n\tofficeSession = scs.New()\n\tofficeSession.Store = newSessionStoreFn(\"office\")\n\tofficeSession.Cookie.Name = \"office_session_token\"\n\n\t// IdleTimeout controls the maximum length of time a session can be inactive\n\t// before it expires. The default is 15 minutes. To disable idle timeout in\n\t// a non-production environment, set SESSION_IDLE_TIMEOUT_IN_MINUTES to 0.\n\tmilSession.IdleTimeout = idleTimeout\n\tadminSession.IdleTimeout = idleTimeout\n\tofficeSession.IdleTimeout = idleTimeout\n\n\t// Lifetime controls the maximum length of time that a session is valid for\n\t// before it expires. The lifetime is an 'absolute expiry' which is set when\n\t// the session is first created or renewed (such as when a user signs in)\n\t// and does not change. The default value is 24 hours.\n\tmilSession.Lifetime = lifetime\n\tadminSession.Lifetime = lifetime\n\tofficeSession.Lifetime = lifetime\n\n\tmilSession.Cookie.Path = \"/\"\n\tadminSession.Cookie.Path = \"/\"\n\tofficeSession.Cookie.Path = \"/\"\n\n\t// A value of false means the session cookie will be deleted when the\n\t// browser is closed.\n\tmilSession.Cookie.Persist = false\n\tadminSession.Cookie.Persist = false\n\tofficeSession.Cookie.Persist = false\n\n\tif useSecureCookie {\n\t\tmilSession.Cookie.Secure = true\n\t\tadminSession.Cookie.Secure = true\n\t\tofficeSession.Cookie.Secure = true\n\t}\n\n\treturn AppSessionManagers{\n\t\tMil: ScsSessionManagerWrapper{\n\t\t\tScsSessionManager: milSession,\n\t\t},\n\t\tOffice: ScsSessionManagerWrapper{\n\t\t\tScsSessionManager: officeSession,\n\t\t},\n\t\tAdmin: ScsSessionManagerWrapper{\n\t\t\tScsSessionManager: adminSession,\n\t\t},\n\t}\n}", "func GetSession(c context.Context, r *http.Request) context.Session {\n\tif val, ok := c.Get(r, context.BaseCtxKey(\"session\")); ok {\n\t\treturn val.(context.Session)\n\t}\n\n\tconf := GetConfig(c)\n\tvar abspath string\n\n\tif filepath.IsAbs(conf.Session.Dir) {\n\t\tabspath = conf.Session.Dir\n\t} else {\n\t\tvar err error\n\t\tabspath, err = filepath.Abs(path.Join(filepath.Dir(os.Args[0]), conf.Session.Dir))\n\n\t\tif err != nil {\n\t\t\tabspath = os.TempDir()\n\t\t}\n\t}\n\n\tsess := context.NewSession([]byte(conf.Session.Secret), []byte(conf.Session.Cipher), abspath)\n\tsess.SetName(util.UUID())\n\treturn sess\n}", "func (sessionRepo *mockSessionRepo) Initialize(ctx context.Context, db *sql.DB) {}", "func (s *Store) Init(sessionID []byte, defaultExpiration time.Duration) {\n\ts.sessionID = sessionID\n\ts.defaultExpiration = defaultExpiration\n\n\tif s.data == nil { // Ensure the store always has a valid pointer of Dict\n\t\ts.data = new(Dict)\n\t}\n}", "func (t *SessionManager) CreateSessionForUser(uid int64) (string, error) {\n\tsession_uuid := uuid.New()\n\n\t// Get the user's info\n\tuser_data, err := GetUserById(t.db, uid)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Create the session object and put it in the local cache\n\tUserSession := new(Session)\n\tUserSession.User = user_data\n\tUserSession.Expires = time.Now().Add(60 * 24 * time.Hour)\n\n\t// Store the token in the database\n\t_, err = t.db.Exec(`INSERT INTO UserSession (\n\t\tToken, User_id, Expire_time ) VALUES (?, ?, ?)`, session_uuid, uid, UserSession.Expires)\n\tif err != nil {\n\t\t// This isn't a fatal error since the session will be known by this API\n\t\t// server, but the session will be lost if the api server is restarted.\n\t\t// Can also lead to premature expiry in highly available API clusters.\n\t\tlog.Println(\"CreateSessionForUser\", err)\n\t}\n\n\treturn session_uuid, nil\n}", "func (s Sessions) Create(nu *user.User) (*session.Session, error) {\n\tdefer s.Log.Emit(sinks.Info(\"Create New Session\").WithFields(sink.Fields{\n\t\t\"user_email\": nu.Email,\n\t\t\"user_id\": nu.PublicID,\n\t}).Trace(\"Sessions.Create\").End())\n\n\tcurrentTime := time.Now()\n\n\tvar newSession session.Session\n\n\t// Attempt to retrieve session from db if we still have an outstanding non-expired session.\n\tif err := s.DB.Get(s.TableIdentity, &newSession, session.UniqueIndex, nu.PublicID); err == nil {\n\n\t\t// We have an existing session and the time of expiring is still counting, simly return\n\t\tif !newSession.Expires.IsZero() && currentTime.Before(newSession.Expires) {\n\t\t\treturn &newSession, nil\n\t\t}\n\n\t\t// \tIf we still have active session, then simply kick it and return safely.\n\t\tif newSession.Expires.IsZero() || currentTime.After(newSession.Expires) {\n\n\t\t\t// Delete this sessions\n\t\t\tif err := s.DB.Delete(s.TableIdentity, session.UniqueIndex, nu.PublicID); err != nil {\n\t\t\t\ts.Log.Emit(sinks.Error(\"Failed to delete old session: %+q\", err).WithFields(sink.Fields{\"user_email\": nu.Email, \"user_id\": nu.PublicID}))\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Create new session and store session into db.\n\tnewSession = *session.New(nu.PublicID, time.Now().Add(s.Expiration))\n\n\tif err := s.DB.Save(s.TableIdentity, &newSession); err != nil {\n\t\ts.Log.Emit(sinks.Error(\"Failed to save new session: %+q\", err).WithFields(sink.Fields{\"user_email\": nu.Email, \"user_id\": nu.PublicID}))\n\t\treturn nil, err\n\t}\n\n\treturn &newSession, nil\n}", "func (m *MMClient) initUser() error {\n\tm.Lock()\n\tdefer m.Unlock()\n\t// we only load all team data on initial login.\n\t// all other updates are for channels from our (primary) team only.\n\t//m.logger.Debug(\"initUser(): loading all team data\")\n\tteams, resp := m.Client.GetTeamsForUser(m.User.Id, \"\")\n\tif resp.Error != nil {\n\t\treturn resp.Error\n\t}\n\tfor _, team := range teams {\n\t\tidx := 0\n\t\tmax := 200\n\t\tusermap := make(map[string]*model.User)\n\t\tmmusers, resp := m.Client.GetUsersInTeam(team.Id, idx, max, \"\")\n\t\tif resp.Error != nil {\n\t\t\treturn errors.New(resp.Error.DetailedError)\n\t\t}\n\t\tfor len(mmusers) > 0 {\n\t\t\tfor _, user := range mmusers {\n\t\t\t\tusermap[user.Id] = user\n\t\t\t}\n\t\t\tmmusers, resp = m.Client.GetUsersInTeam(team.Id, idx, max, \"\")\n\t\t\tif resp.Error != nil {\n\t\t\t\treturn errors.New(resp.Error.DetailedError)\n\t\t\t}\n\t\t\tidx++\n\t\t\ttime.Sleep(time.Millisecond * 200)\n\t\t}\n\t\tm.logger.Infof(\"found %d users in team %s\", len(usermap), team.Name)\n\n\t\tt := &Team{Team: team, Users: usermap, Id: team.Id}\n\n\t\tmmchannels, resp := m.Client.GetChannelsForTeamForUser(team.Id, m.User.Id, false, \"\")\n\t\tif resp.Error != nil {\n\t\t\treturn resp.Error\n\t\t}\n\t\tt.Channels = mmchannels\n\t\tmmchannels, resp = m.Client.GetPublicChannelsForTeam(team.Id, 0, 5000, \"\")\n\t\tif resp.Error != nil {\n\t\t\treturn resp.Error\n\t\t}\n\t\tt.MoreChannels = mmchannels\n\t\tm.OtherTeams = append(m.OtherTeams, t)\n\t\tif team.Name == m.Credentials.Team {\n\t\t\tm.Team = t\n\t\t\tm.logger.Debugf(\"initUser(): found our team %s (id: %s)\", team.Name, team.Id)\n\t\t}\n\t\t// add all users\n\t\tfor k, v := range t.Users {\n\t\t\tm.Users[k] = v\n\t\t}\n\t}\n\treturn nil\n}", "func Create(userID string) *ClientSession {\n\n\tnewOpSession := new(ClientSession)\n\tnewOpSession.CreatedAt = time.Now().Unix()\n\tnewOpSession.UpdatedAt = time.Now().Unix()\n\tnewOpSession.ExpiresAt = time.Now().Add(time.Hour * 240).Unix()\n\n\tsessionUUID := uuid.Must(uuid.NewRandom())\n\tnewOpSession.SessionID = sessionUUID.String()\n\n\treturn newOpSession\n}", "func NewSession(conn net.Conn, server *Server) *AyiSession {\n\n\tsession := &AyiSession{\n\t\tConn: conn,\n\t\tProtocolVersion: 0, // Use v1 by default\n\t\tUserId: 0,\n\t\tIsAuth: false,\n\t\treadReadyChan: make(chan *proto.AyiPacket, 1),\n\t\terrorChan: make(chan error, 1),\n\t\texitChan: make(chan bool, 1),\n\t\twriteChan: make(chan *WriteMsg, 1),\n\t\tServer: server,\n\t\tlastRecvMsg: time.Now().UTC(),\n\t\tpendingResp: make(map[uint16]chan bool),\n\t}\n\n\treturn session\n}", "func GetSession(ctx iris.Context) *sessions.Session {\n\treturn manager.Start(ctx)\n}", "func InitializeSession(c *cli.Context) (session.Session, error) {\n\tedgerc, err := GetEdgegridConfig(c)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not retrieve edgegrid configuration: %s\", err)\n\t}\n\ts, err := session.New(\n\t\tsession.WithSigner(edgerc),\n\t\tsession.WithHTTPTracing(os.Getenv(\"AKAMAI_HTTP_TRACE_ENABLED\") == \"true\"),\n\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to initialize edgegrid session: %s\", err)\n\t}\n\treturn s, nil\n}", "func (d *Service) CreateSession(ctx context.Context, UserId string) (string, error) {\n\tSessionId, err := db.RandomBase64String(32)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif _, sessionErr := d.DB.ExecContext(ctx, `\n\t\tINSERT INTO thunderdome.user_session (session_id, user_id, disabled) VALUES ($1, $2, (SELECT mfa_enabled FROM thunderdome.users WHERE id = $2));\n\t\t`,\n\t\tSessionId,\n\t\tUserId,\n\t); sessionErr != nil {\n\t\td.Logger.Ctx(ctx).Error(\"Unable to create a user session\", zap.Error(sessionErr))\n\t\treturn \"\", sessionErr\n\t}\n\n\treturn SessionId, nil\n}", "func InitUser(username string, password string) (userdataptr *User, err error) {\n\tvar Userdata User\n\t\n\t//Generating RSA Keys\n\tRSAKey, err1 := userlib.GenerateRSAKey()\n\tif(err1!=nil){\n\t\treturn nil, err1\n\t}\n\t\n\t//Generating key for encryption and HMAC\n\tKey :=userlib.Argon2Key([]byte(password),[]byte(username),16)\n\n\t// Populating User data structure\n\tUserdata.Username =username\n\tUserdata.Password =password\n\tUserdata.RSAKey=RSAKey\n\n\t// Marshalling User data structure to JSON representation\n\tstr,_ := json.Marshal(Userdata)\n\n\t// Calculating HMAC\n\thmac := userlib.NewHMAC(Key)\n\thmac.Write([]byte(str))\n\tUserdata.Hmac=hmac.Sum(nil)\n\n\t//Final Marshalled User data structure\n\tstr,_=json.Marshal(Userdata)\n\n\t//Storing Public Key in Keystore\n\tpubkey := RSAKey.PublicKey\n\tuserlib.KeystoreSet(username,pubkey)\n\n\t//Calculating hash(password+username) (Location of User data structure in Datastore)\n\tIndex:= getAddress([]byte(password+username))\n\n\t// Encrypting User data structure with Key\n\tciphertext := encryptAES([]byte(str),Key) \n\n\t// Storing data on Datastore\n\tuserlib.DatastoreSet(Index,ciphertext)\n\n\treturn &Userdata, err\n}", "func (sta StandardAuthenticator) CreateSession(username, password string) (*Session, error) {\n\t//Let's validate the user's credentials against CouchDB\n\tba := &couchdb.BasicAuth{\n\t\tUsername: username,\n\t\tPassword: password,\n\t}\n\tauthInfo, err := database.Connection.GetAuthInfo(ba)\n\tif err != nil || authInfo == nil {\n\t\treturn nil, UnauthenticatedError()\n\t} else if !authInfo.Ok || authInfo.UserCtx.Name == \"\" {\n\t\treturn nil, UnauthenticatedError()\n\t}\n\treturn NewSession(&authInfo.UserCtx, \"standard\"), nil\n}", "func SetSession(id interface{}, user interface{}) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tsession := sessions.Default(c)\n\t\tsession.Set(\"id\", id)\n\t\tsession.Set(\"username\", user)\n\t\tsession.Save()\n\t}\n}", "func setupSessions(slot uint) error {\n\tsessionPoolMutex.Lock()\n\tif _, ok := sessionPools[slot]; !ok {\n\t\tsessionPools[slot] = pools.NewResourcePool(\n\t\t\tfunc() (pools.Resource, error) {\n\t\t\t\treturn newSession(slot)\n\t\t\t},\n\t\t\tmaxSessions,\n\t\t\tmaxSessions,\n\t\t\tidleTimeout,\n\t\t)\n\t}\n\tsessionPoolMutex.Unlock()\n\n\treturn nil\n}" ]
[ "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.5347291", "0.53427273", "0.5335449", "0.5313234", "0.5307929", "0.53061867", "0.52919644", "0.529093", "0.52682525", "0.5227339", "0.52126485", "0.52123886", "0.5208997", "0.5192668", "0.51895905", "0.51827985", "0.5174144", "0.5168592", "0.51590925", "0.5151889", "0.51492864", "0.5143872", "0.51373273", "0.51366085", "0.5115017", "0.5114596", "0.511061", "0.50980705", "0.5087635", "0.5074815", "0.50732297", "0.50707823", "0.5061557", "0.5058999", "0.50309163", "0.50305545", "0.5030338", "0.502615", "0.50193423", "0.50142175", "0.50132936", "0.5008696", "0.50079423", "0.50051457", "0.500449", "0.49995258", "0.49981838", "0.49310964", "0.49267897", "0.4925718", "0.49157804", "0.49134985", "0.4908379", "0.49079433", "0.49067867", "0.4893116", "0.4887468", "0.48854214", "0.488241", "0.48768443", "0.4871303", "0.48689282", "0.48667192", "0.48665226", "0.4863043", "0.48579222", "0.4856703", "0.4854103", "0.48509377", "0.48486176", "0.4844443", "0.48435345", "0.4835962", "0.48337448", "0.48330665", "0.48326597", "0.4825025", "0.48209795", "0.4820404", "0.47860718" ]
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\tlog.L.Error(\"store: failed to unlock context: %v\", err)\n\t\treturn\n\t} else if locked {\n\t\tlog.L.Error(\"store: failed to unlock store context: the calling session is not the session which holds the lock!\")\n\t\treturn\n\t}\n\n\t// Unlock the lock.\n\terr = dbUnlock(id)\n\tif err != nil {\n\t\tlog.L.Error(\"store: failed to unlock context: %v\", err)\n\t\treturn\n\t}\n\n\t// Broadcast changes to other sessions in edit mode.\n\tbroadcastChangedContext(id, session)\n}", "func SetCtx(p PTR, _ctxid int64, rpc *memrpc.Server) {\n\tC.set_ctxid(C.PTR(p), C.int64_t(_ctxid))\n\tsessionBuf[_ctxid] = &session{ctxId: _ctxid, rpcServer: rpc}\n}", "func (il *internalLocker) Unlock(ctx context.Context) error {\n\tif err := il.mu.Unlock(ctx); err != nil {\n\t\tlog.Logger.Error(err)\n\t\treturn err\n\t}\n\n\treturn il.session.Close()\n}", "func (lockedCtx *UserCtx) Unlock() {\n\tif !lockedCtx.locked {\n\t\tpanic(\"Expected locked\")\n\t}\n\tlockedCtx.locked = false\n\tlockedCtx.mu.Unlock()\n}", "func (srv *CentralSessionController) UpdateSession(\n\tctx context.Context,\n\trequest *protos.UpdateSessionRequest,\n) (*protos.UpdateSessionResponse, error) {\n\t// Then send out updates\n\tvar wg sync.WaitGroup\n\twg.Add(2)\n\n\tvar (\n\t\tgxUpdateResponses []*protos.UsageMonitoringUpdateResponse\n\t\tgyUpdateResponses []*protos.CreditUpdateResponse\n\t\tgxTgppCtx = make([]struct {\n\t\t\tsid string\n\t\t\tctx *protos.TgppContext\n\t\t}, 0, len(request.UsageMonitors))\n\t\tgyTgppCtx = map[string]*protos.TgppContext{}\n\t)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tif srv.cfg.DisableGx {\n\t\t\treturn\n\t\t}\n\t\trequests := gx.FromUsageMonitorUpdates(request.UsageMonitors)\n\t\tgxUpdateResponses = srv.sendMultipleGxRequestsWithTimeout(requests, srv.cfg.RequestTimeoutGx)\n\t\tfor _, mur := range gxUpdateResponses {\n\t\t\tif mur != nil {\n\t\t\t\tif mur.TgppCtx != nil {\n\t\t\t\t\tgxTgppCtx = append(gxTgppCtx, struct {\n\t\t\t\t\t\tsid string\n\t\t\t\t\t\tctx *protos.TgppContext\n\t\t\t\t\t}{mur.Sid, mur.TgppCtx})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tif srv.cfg.DisableGy {\n\t\t\treturn\n\t\t}\n\t\trequests := gy.FromCreditUsageUpdates(request.Updates)\n\t\tgyUpdateResponses = srv.sendMultipleGyRequestsWithTimeout(requests, srv.cfg.RequestTimeoutGy)\n\t\tfor _, cur := range gyUpdateResponses {\n\t\t\tif cur != nil {\n\t\t\t\tif cur.TgppCtx != nil {\n\t\t\t\t\tgyTgppCtx[cur.GetSid()] = cur.TgppCtx\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\twg.Wait()\n\n\t// Update destination hosts in all results with common SIDs\n\tif len(gxTgppCtx) > 0 && len(gyTgppCtx) > 0 {\n\t\tfor _, pair := range gxTgppCtx {\n\t\t\tif gyCtx, ok := gyTgppCtx[pair.sid]; ok {\n\t\t\t\tif len(pair.ctx.GxDestHost) > 0 {\n\t\t\t\t\tgyCtx.GxDestHost = pair.ctx.GxDestHost\n\t\t\t\t}\n\t\t\t\tif len(gyCtx.GyDestHost) > 0 {\n\t\t\t\t\tpair.ctx.GyDestHost = gyCtx.GyDestHost\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &protos.UpdateSessionResponse{\n\t\tResponses: gyUpdateResponses,\n\t\tUsageMonitorResponses: gxUpdateResponses,\n\t}, nil\n}", "func (s *EapAkaSrv) InitSession(sessionId string, imsi aka.IMSI) (lockedUserContext *UserCtx) {\n\tvar (\n\t\toldSessionTimer *time.Timer\n\t\toldSessionState aka.AkaState\n\t)\n\t// create new session with long session wide timeout\n\tt := time.Now()\n\tnewSession := &SessionCtx{UserCtx: &UserCtx{\n\t\tcreated: t, Imsi: imsi, state: aka.StateCreated, stateTime: t, locked: true, SessionId: sessionId}}\n\n\tnewSession.mu.Lock()\n\n\tnewSession.CleanupTimer = time.AfterFunc(s.SessionTimeout(), func() {\n\t\tsessionTimeoutCleanup(s, sessionId, newSession)\n\t})\n\tuc := newSession.UserCtx\n\n\ts.rwl.Lock()\n\tif oldSession, ok := s.sessions[sessionId]; ok && oldSession != nil {\n\t\toldSessionTimer, oldSession.CleanupTimer = oldSession.CleanupTimer, nil\n\t\toldSessionState = oldSession.state\n\t}\n\ts.sessions[sessionId] = newSession\n\ts.rwl.Unlock()\n\n\tif oldSessionTimer != nil {\n\t\toldSessionTimer.Stop()\n\t\t// Copy Redirected state to a new session to avoid auth thrashing between EAP methods\n\t\tif oldSessionState == aka.StateRedirected {\n\t\t\tnewSession.state = aka.StateRedirected\n\t\t}\n\t}\n\treturn uc\n}", "func SessionCleanup() {\n\tfor {\n\t\tselect {\n\t\tcase <-time.After(SessionManager.SessionCleanupTime * time.Minute):\n\t\t\tSessionManager.ReqSessionMem <- 1 // ask to access the shared mem, blocks until granted\n\t\t\t<-SessionManager.ReqSessionMemAck // make sure we got it\n\t\t\tss := make(map[string]*Session, 0) // here's the new Session list\n\t\t\tn := 0 // total number removed\n\t\t\tfor k, v := range Sessions { // look at every Session\n\t\t\t\tif time.Now().After(v.Expire) { // if it's still active...\n\t\t\t\t\tn++ // removed another\n\t\t\t\t} else {\n\t\t\t\t\tss[k] = v // ...copy it to the new list\n\t\t\t\t}\n\t\t\t}\n\t\t\tSessions = ss // set the new list\n\t\t\tSessionManager.ReqSessionMemAck <- 1 // tell SessionDispatcher we're done with the data\n\t\t\t//fmt.Printf(\"SessionCleanup completed. %d removed. Current Session list size = %d\\n\", n, len(Sessions))\n\t\t}\n\t}\n}", "func (st *SessionStoreMySQL) SessionRelease() {\n\tdefer func() {\n\t\terr := st.conn.Close()\n\t\tif err != nil {\n\t\t\tsession.SLogger.Println(err)\n\t\t}\n\t}()\n\n\tb, err := session.EncodeGob(st.values)\n\tif err != nil {\n\t\tsession.SLogger.Println(err)\n\t\treturn\n\t}\n\t_, err = st.conn.Exec(\"UPDATE \"+TableName+\" set `session_data`=?, `session_expiry`=? where session_key=?\",\n\t\tb, time.Now().Unix(), st.sid)\n\tif err != nil {\n\t\tsession.SLogger.Println(err)\n\t\treturn\n\t}\n}", "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} else {\n\t\t\toldTimer, oldSession.CleanupTimer = oldSession.CleanupTimer, nil\n\t\t\tnewSession, oldSession.UserCtx = &SessionCtx{UserCtx: oldSession.UserCtx}, nil\n\t\t\ts.sessions[sessionId] = newSession\n\t\t\tnewSession.CleanupTimer = time.AfterFunc(timeout, func() {\n\t\t\t\tsessionTimeoutCleanup(s, sessionId, newSession)\n\t\t\t})\n\t\t}\n\t}\n\ts.rwl.Unlock()\n\n\tif oldTimer != nil {\n\t\toldTimer.Stop()\n\t}\n\treturn exist\n}", "func (l *GCSLock) ForceUnlockContext(ctx context.Context) error {\n\tif err := l.checkInit(); err != nil {\n\t\treturn err\n\t}\n\treturn l.deleteObject(ctx, true /* forceUnlock */)\n}", "func closeCtx(k *http.Request) {\n\tpk := privateKey(k)\n\tif _, has := internalCtx.Get(pk); has {\n\t\tinternalCtx.Remove(pk)\n\t}\n}", "func (s *StorageFile) updateSessionTTl(ctx context.Context, sessionId string) error {\n\tintlog.Printf(ctx, \"StorageFile.updateSession: %s\", sessionId)\n\tpath := s.sessionFilePath(sessionId)\n\tfile, err := gfile.OpenWithFlag(path, os.O_WRONLY)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err = file.WriteAt(gbinary.EncodeInt64(gtime.TimestampMilli()), 0); err != nil {\n\t\terr = gerror.Wrapf(err, `write data failed to file \"%s\"`, path)\n\t\treturn err\n\t}\n\treturn file.Close()\n}", "func (m *InMemManager) Unlock(_ context.Context, token string) error {\n\tm.rw.RLock()\n\trw, ok := m.acqu[token]\n\tm.rw.RUnlock()\n\n\tif ok {\n\t\trw.Unlock()\n\t}\n\n\treturn nil\n}", "func (pder *MemProvider) SessionUpdate(sid string) error {\n\treturn (*session.MemProvider)(pder).SessionUpdate(context.Background(), sid)\n}", "func (e *BaseExecutor) ReleaseSysSession(ctx context.Context, sctx sessionctx.Context) {\n\tif sctx == nil {\n\t\treturn\n\t}\n\tdom := domain.GetDomain(e.Ctx())\n\tsysSessionPool := dom.SysSessionPool()\n\tif _, err := sctx.(sqlexec.SQLExecutor).ExecuteInternal(ctx, \"rollback\"); err != nil {\n\t\tsctx.(pools.Resource).Close()\n\t\treturn\n\t}\n\tsysSessionPool.Put(sctx.(pools.Resource))\n}", "func (s *SessionManager) SessionRelease(ctx *bm.Context, sv *Session) {\n\t// set http cookie\n\ts.setHTTPCookie(ctx, s.c.CookieName, sv.Sid)\n\t// set mc\n\tconn := s.mc.Get(ctx)\n\tdefer conn.Close()\n\tkey := sv.Sid\n\titem := &memcache.Item{\n\t\tKey: key,\n\t\tObject: sv,\n\t\tFlags: memcache.FlagJSON,\n\t\tExpiration: int32(s.c.CookieLifeTime),\n\t}\n\tif err := conn.Set(item); err != nil {\n\t\tlog.Error(\"SessionManager set error(%s,%v)\", key, err)\n\t}\n}", "func (c *Session) Close() {\n\tif c.devID != nil {\n\t\terr := c.devID.Close()\n\t\tif err != nil {\n\t\t\tc.log.Warn(fmt.Sprintf(\"Failed to close DevID handle: %v\", err))\n\t\t}\n\t}\n\n\tif c.ak != nil {\n\t\terr := c.ak.Close()\n\t\tif err != nil {\n\t\t\tc.log.Warn(fmt.Sprintf(\"Failed to close attestation key handle: %v\", err))\n\t\t}\n\t}\n\n\tif c.ekHandle != 0 {\n\t\tc.flushContext(c.ekHandle)\n\t}\n\n\tif c.rwc != nil {\n\t\tif closeTPM(c.rwc) {\n\t\t\treturn\n\t\t}\n\n\t\terr := c.rwc.Close()\n\t\tif err != nil {\n\t\t\tc.log.Warn(fmt.Sprintf(\"Failed to close TPM: %v\", err))\n\t\t}\n\t}\n}", "func sessionConfigTimeoutHandler(_ *task.SessionConfigTask, env *task.Env) {\n\tlog.Info(\"Session config refresh timeout\")\n\tenv.StopSessionConfig()\n}", "func (_LockProxy *LockProxySession) Unlock(argsBs []byte, fromContractAddr []byte, fromChainId uint64) (*types.Transaction, error) {\n\treturn _LockProxy.Contract.Unlock(&_LockProxy.TransactOpts, argsBs, fromContractAddr, fromChainId)\n}", "func (s *session) unlock() {\n\tif s.state == stateAuthorization {\n\t\treturn // we didn't yet even have a chance to lock the maildrop\n\t}\n\tif err := s.handler.UnlockMaildrop(); err != nil {\n\t\ts.handler.HandleSessionError(err)\n\t}\n}", "func unlockTable(tbInfo *model.TableInfo, arg *LockTablesArg) (needUpdateTableInfo bool) {\n\tif !tbInfo.IsLocked() {\n\t\treturn false\n\t}\n\tif arg.IsCleanup {\n\t\ttbInfo.Lock = nil\n\t\treturn true\n\t}\n\n\tsessionIndex := findSessionInfoIndex(tbInfo.Lock.Sessions, arg.SessionInfo)\n\tif sessionIndex < 0 {\n\t\t// When session clean table lock, session maybe send unlock table even the table lock maybe not hold by the session.\n\t\t// so just ignore and return here.\n\t\treturn false\n\t}\n\toldSessionInfo := tbInfo.Lock.Sessions\n\ttbInfo.Lock.Sessions = oldSessionInfo[:sessionIndex]\n\ttbInfo.Lock.Sessions = append(tbInfo.Lock.Sessions, oldSessionInfo[sessionIndex+1:]...)\n\tif len(tbInfo.Lock.Sessions) == 0 {\n\t\ttbInfo.Lock = nil\n\t}\n\treturn true\n}", "func (client BastionClient) updateSession(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {\n\thttpRequest, err := request.HTTPRequest(http.MethodPut, \"/sessions/{sessionId}\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response UpdateSessionResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func (st *MemSessionStore) SessionRelease(w http.ResponseWriter) {\n\t(*session.MemSessionStore)(st).SessionRelease(context.Background(), w)\n}", "func (c *MockedHTTPContext) Unlock() {\n\tif c.MockedUnlock != nil {\n\t\tc.MockedUnlock()\n\t}\n}", "func ReleaseActCtx(hActCtx HANDLE) {\n\tsyscall3(releaseActCtx, 1,\n\t\tuintptr(hActCtx),\n\t\t0,\n\t\t0)\n}", "func (_Lmc *LmcSession) ExitAndUnlock() (*types.Transaction, error) {\n\treturn _Lmc.Contract.ExitAndUnlock(&_Lmc.TransactOpts)\n}", "func (authSvc *AuthService) invalidateSessionId(sessionId string) {\n\tauthSvc.Sessions[sessionId] = nil\n}", "func (sessionStorer *SessionStorer) Update(w http.ResponseWriter, req *http.Request, claims *claims.Claims) error {\n\ttoken := sessionStorer.SignedToken(claims)\n\treturn sessionStorer.SessionManager.Add(w, req, sessionStorer.SessionName, token)\n}", "func (s *EapAkaSrv) ResetSessionTimeout(sessionId string, newTimeout time.Duration) {\n\tvar oldTimer *time.Timer\n\n\ts.rwl.Lock()\n\tsession, exist := s.sessions[sessionId]\n\tif exist {\n\t\tif session != nil {\n\t\t\toldTimer, session.CleanupTimer = session.CleanupTimer, time.AfterFunc(newTimeout, func() {\n\t\t\t\tsessionTimeoutCleanup(s, sessionId, session)\n\t\t\t})\n\t\t}\n\t}\n\ts.rwl.Unlock()\n\n\tif oldTimer != nil {\n\t\toldTimer.Stop()\n\t}\n}", "func (m *InMemManager) RUnlock(_ context.Context, token string) error {\n\tm.rw.RLock()\n\trw, ok := m.acqu[token]\n\tm.rw.RUnlock()\n\n\tif ok {\n\t\trw.RUnlock()\n\t}\n\n\treturn nil\n}", "func (_LockProxy *LockProxyTransactorSession) Unlock(argsBs []byte, fromContractAddr []byte, fromChainId uint64) (*types.Transaction, error) {\n\treturn _LockProxy.Contract.Unlock(&_LockProxy.TransactOpts, argsBs, fromContractAddr, fromChainId)\n}", "func (m *Macross) ReleaseContext(c *Context) {\n\tc.Response.Header.SetServer(\"Macross\")\n\tm.pool.Put(c)\n}", "func RemoveSession(ctxid int64) {\n\tdelete(sessionBuf, ctxid)\n}", "func (c *crdLock) Unlock(ctx context.Context) error {\n\treturn nil\n}", "func testTimeoutReplacement(ctx context.Context, t *testing.T, w *Wallet) {\n\ttimeChan1 := make(chan time.Time)\n\ttimeChan2 := make(chan time.Time)\n\terr := w.Unlock(ctx, testPrivPass, timeChan1)\n\tif err != nil {\n\t\tt.Fatal(\"failed to unlock wallet\")\n\t}\n\terr = w.Unlock(ctx, testPrivPass, timeChan2)\n\tif err != nil {\n\t\tt.Fatal(\"failed to unlock wallet\")\n\t}\n\ttimeChan2 <- time.Time{}\n\ttime.Sleep(100 * time.Millisecond) // Allow time for lock in background\n\tif !w.Locked() {\n\t\tt.Fatal(\"wallet did not lock using replacement timeout\")\n\t}\n\tselect {\n\tcase timeChan1 <- time.Time{}:\n\tdefault:\n\t\tt.Fatal(\"previous timeout was not read in background\")\n\t}\n}", "func (ds *Dsync) finalizeReceive(sess *session) error {\n\tlog.Debug(\"finalizing receive session\", sess.id)\n\tif err := ds.finalCheck(sess.ctx, *sess.info, sess.meta); err != nil {\n\t\tlog.Error(\"final check error\", err)\n\t\treturn err\n\t}\n\n\tif ds.infoStore != nil {\n\t\tdi := sess.info\n\t\tif err := ds.infoStore.PutDAGInfo(sess.ctx, sess.info.Manifest.Nodes[0], di); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif sess.pin {\n\t\tif err := ds.pin.Add(sess.ctx, path.New(sess.info.Manifest.Nodes[0])); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tdefer func() {\n\t\tds.sessionLock.Lock()\n\t\tds.sessionCancels[sess.id]()\n\t\tdelete(ds.sessionPool, sess.id)\n\t\tds.sessionLock.Unlock()\n\t}()\n\n\tif ds.onCompleteHook != nil {\n\t\tif err := ds.onCompleteHook(sess.ctx, *sess.info, sess.meta); err != nil {\n\t\t\tlog.Errorf(\"completed hook error: %s\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c *ContextLock) Unlock(ctx context.Context) (context.Context, error) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tif c.id == 0 {\n\t\treturn ctx, nil\n\t}\n\n\tdepth := c._depth(ctx)\n\n\tswitch depth {\n\tcase 0:\n\t\tif !c.held {\n\t\t\treturn ctx, nil\n\t\t}\n\t\tfallthrough\n\n\tcase 1:\n\t\tc.held = false\n\t\tc.cond.Signal()\n\t\tfallthrough\n\n\tdefault:\n\t\tif depth > 0 {\n\t\t\tdepth--\n\t\t}\n\t}\n\n\treturn c._withDepth(ctx, depth)\n}", "func (_obj *WebApiAuth) SysUser_SetPwdWithContext(tarsCtx context.Context, oldPassword string, newPassword string, req *SysUser, res *bool, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_string(oldPassword, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_string(newPassword, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = req.WriteBlock(_os, 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_bool((*res), 4)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"SysUser_SetPwd\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = _is.Read_bool(&(*res), 4, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func (rp *Provider) SessionGC(ctx context.Context) {\n}", "func Unlock(ctx context.Context, lockContext, lockID string) {\n\tgetLock(ctx, lockID).Unlock()\n\tLogc(ctx).WithField(\"lock\", lockID).Debugf(\"Released shared lock (%s).\", lockContext)\n}", "func (_obj *WebApiAuth) SysUser_UpdateWithContext(tarsCtx context.Context, id int32, req *SysUser, res *SysUser, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_int32(id, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = req.WriteBlock(_os, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = (*res).WriteBlock(_os, 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"SysUser_Update\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = (*res).ReadBlock(_is, 3, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func (s *s6aProxy) updateSession(sid string, ch chan interface{}) chan interface{} {\n\ts.sessionsMu.Lock()\n\toldCh, ok := s.sessions[sid]\n\ts.sessions[sid] = ch\n\ts.sessionsMu.Unlock()\n\tif ok {\n\t\tif oldCh != nil {\n\t\t\tclose(oldCh)\n\t\t}\n\t\treturn oldCh\n\t}\n\treturn nil\n}", "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 != nil {\n\t\t\tintlog.Errorf(context.TODO(), `%+v`, err)\n\t\t}\n\t}\n}", "func (rs *Store) SessionRelease(ctx context.Context, w http.ResponseWriter) {\n\tb, err := session.EncodeGob(rs.values)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif ctx == nil {\n\t\tctx = context.TODO()\n\t}\n\tmaxlifetime := time.Duration(systemSessionTimeout(ctx, rs.maxlifetime))\n\tif rdb, ok := rs.c.(*redis.Cache); ok {\n\t\tcmd := rdb.Client.Set(ctx, rs.sid, string(b), maxlifetime)\n\t\tif cmd.Err() != nil {\n\t\t\tlog.Debugf(\"release session error: %v\", err)\n\t\t}\n\t}\n}", "func (_Lmc *LmcTransactorSession) ExitAndUnlock() (*types.Transaction, error) {\n\treturn _Lmc.Contract.ExitAndUnlock(&_Lmc.TransactOpts)\n}", "func delayUnregister(session *model.Session) {\n\ttime.Sleep(time.Second * 5)\n\t//TODO do something better perhaps a seperate queue for the messages that will be deleted.\n\tdefer mutex.Unlock()\n\tmutex.Lock()\n\n\tdelete(tokenAvailable, session.SessionToken)\n\tdelete(sessionCache, session.SocketID)\n\tdelete(userCache, session.UserID)\n\tmodel.DB().Delete(session) //Remove the session\n\n}", "func checkKeyspaceLockUnblocks(t *testing.T, ts topo.Server) {\n\tunblock := make(chan struct{})\n\tfinished := make(chan struct{})\n\n\t// as soon as we're unblocked, we try to lock the keyspace\n\tgo func() {\n\t\t<-unblock\n\t\tctx := context.Background()\n\t\tlockPath, err := ts.LockKeyspaceForAction(ctx, \"test_keyspace\", \"fake-content\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"LockKeyspaceForAction(test_keyspace) failed: %v\", err)\n\t\t}\n\t\tif err = ts.UnlockKeyspaceForAction(\"test_keyspace\", lockPath, \"fake-results\"); err != nil {\n\t\t\tt.Errorf(\"UnlockKeyspaceForAction(test_keyspace): %v\", err)\n\t\t}\n\t\tclose(finished)\n\t}()\n\n\t// lock the keyspace\n\tctx := context.Background()\n\tlockPath2, err := ts.LockKeyspaceForAction(ctx, \"test_keyspace\", \"fake-content\")\n\tif err != nil {\n\t\tt.Fatalf(\"LockKeyspaceForAction(test_keyspace) failed: %v\", err)\n\t}\n\n\t// unblock the go routine so it starts waiting\n\tclose(unblock)\n\n\t// sleep for a while so we're sure the go routine is blocking\n\ttime.Sleep(timeUntilLockIsTaken)\n\n\tif err = ts.UnlockKeyspaceForAction(\"test_keyspace\", lockPath2, \"fake-results\"); err != nil {\n\t\tt.Fatalf(\"UnlockKeyspaceForAction(test_keyspace): %v\", err)\n\t}\n\n\ttimeout := time.After(10 * time.Second)\n\tselect {\n\tcase <-finished:\n\tcase <-timeout:\n\t\tt.Fatalf(\"unlocking timed out\")\n\t}\n}", "func (pdr *ProviderMySQL) SessionGC() {\n\tc := pdr.connectInit()\n\tdefer func() {\n\t\terr := c.Close()\n\t\tif err != nil {\n\t\t\tsession.SLogger.Println(err)\n\t\t}\n\t}()\n\n\t_, err := c.Exec(\"DELETE from \"+TableName+\" where session_expiry < ?\", time.Now().Unix()-pdr.lifetime)\n\tif err != nil {\n\t\tsession.SLogger.Println(err)\n\t}\n}", "func (self *Conn) Unlock() {\n\tif self.mainloop != nil && self.isLocked {\n\t\tC.pa_threaded_mainloop_unlock(self.mainloop)\n\t\tself.isLocked = false\n\t}\n}", "func PurgeSessions() {\n\tsessions.Lock()\n\tdefer sessions.Unlock()\n\n\t// Update all sessions in the database.\n\tfor id, session := range sessions.sessions {\n\t\tPersistence.SaveSession(id, session)\n\t\t// We only do this to update the last access time. Errors are not that\n\t\t// bad.\n\t}\n\n\tsessions.sessions = make(map[string]*Session, MaxSessionCacheSize)\n}", "func (c *minecraftConn) setSessionHandler0(handler sessionHandler) {\n\tif c.sessionHandler != nil {\n\t\tc.sessionHandler.deactivated()\n\t}\n\tc.sessionHandler = handler\n\thandler.activated()\n}", "func (_obj *WebApiAuth) SysConfig_UpdateWithContext(tarsCtx context.Context, id int32, req *SysConfig, res *SysConfig, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_int32(id, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = req.WriteBlock(_os, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = (*res).WriteBlock(_os, 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"SysConfig_Update\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = (*res).ReadBlock(_is, 3, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func (ctx *RequestContext) DestroySession() {\n\tctx.destroyingSession = true\n}", "func (st *MemStore) TouchSession(sid string) {\n\tst.mx.Lock()\n\tdefer st.mx.Unlock()\n\ts := st.sessions[sid]\n\tif s != nil {\n\t\ts.atime = time.Now()\n\t}\n}", "func (_obj *WebApiAuth) LoginLog_UpdateWithContext(tarsCtx context.Context, id int32, req *LoginLog, res *LoginLog, _opt ...map[string]string) (err error) {\n\n\tvar length int32\n\tvar have bool\n\tvar ty byte\n\t_os := codec.NewBuffer()\n\terr = _os.Write_int32(id, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = req.WriteBlock(_os, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = (*res).WriteBlock(_os, 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"LoginLog_Update\", _os.ToBytes(), _status, _context, _resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_is := codec.NewReader(tools.Int8ToByte(_resp.SBuffer))\n\terr = (*res).ReadBlock(_is, 3, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range _resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range _resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\n\t}\n\t_ = length\n\t_ = have\n\t_ = ty\n\treturn nil\n}", "func (s *Store) kvsUnlockTxn(tx *memdb.Txn, idx uint64, entry *structs.DirEntry) (bool, error) {\n\t// Verify that a session is present.\n\tif entry.Session == \"\" {\n\t\treturn false, fmt.Errorf(\"missing session\")\n\t}\n\n\t// Retrieve the existing entry.\n\texisting, err := tx.First(\"kvs\", \"id\", entry.Key)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed kvs lookup: %s\", err)\n\t}\n\n\t// Bail if there's no existing key.\n\tif existing == nil {\n\t\treturn false, nil\n\t}\n\n\t// Make sure the given session is the lock holder.\n\te := existing.(*structs.DirEntry)\n\tif e.Session != entry.Session {\n\t\treturn false, nil\n\t}\n\n\t// Clear the lock and update the entry.\n\tentry.Session = \"\"\n\tentry.LockIndex = e.LockIndex\n\tentry.CreateIndex = e.CreateIndex\n\tentry.ModifyIndex = idx\n\n\t// If we made it this far, we should perform the set.\n\tif err := s.kvsSetTxn(tx, idx, entry, true); err != nil {\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "func (s *service) manageSessions(c context.Context, sessionServices []trafficmgr.SessionService) error {\n\t// The d.quit is called when we receive a Quit. Since it\n\t// terminates this function, it terminates the whole process.\n\twg := sync.WaitGroup{}\n\tc, s.quit = context.WithCancel(c)\nnextSession:\n\tfor {\n\t\t// Wait for a connection request\n\t\tvar cr *rpc.ConnectRequest\n\t\tselect {\n\t\tcase <-c.Done():\n\t\t\tbreak nextSession\n\t\tcase cr = <-s.connectRequest:\n\t\t}\n\n\t\tvar session trafficmgr.Session\n\t\tvar rsp *rpc.ConnectInfo\n\n\t\ts.sessionLock.Lock() // Locked during creation\n\t\tif c.Err() == nil { // If by the time we've got the session lock we're cancelled, then don't create the session and just leave by way of the select below\n\t\t\tif s.session != nil {\n\t\t\t\t// UpdateStatus sets rpc.ConnectInfo_ALREADY_CONNECTED if successful\n\t\t\t\trsp = s.session.UpdateStatus(s.sessionContext, cr)\n\t\t\t} else {\n\t\t\t\tsCtx, sCancel := context.WithCancel(c)\n\t\t\t\tsession, rsp = trafficmgr.NewSession(sCtx, s.scout, cr, s, sessionServices)\n\t\t\t\tif sCtx.Err() == nil && rsp.Error == rpc.ConnectInfo_UNSPECIFIED {\n\t\t\t\t\ts.sessionContext = session.WithK8sInterface(sCtx)\n\t\t\t\t\ts.sessionCancel = sCancel\n\t\t\t\t\ts.session = session\n\t\t\t\t} else {\n\t\t\t\t\tsCancel()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ts.sessionLock.Unlock()\n\n\t\tselect {\n\t\tcase <-c.Done():\n\t\t\tbreak nextSession\n\t\tcase s.connectResponse <- rsp:\n\t\tdefault:\n\t\t\t// Nobody there to read the response? That's fine. The user may have got\n\t\t\t// impatient.\n\t\t\ts.cancelSession()\n\t\t\tcontinue\n\t\t}\n\t\tif rsp.Error != rpc.ConnectInfo_UNSPECIFIED {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Run the session asynchronously. We must be able to respond to connect (with UpdateStatus) while\n\t\t// the session is running. The s.sessionCancel is called from Disconnect\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tif err := s.session.Run(s.sessionContext); err != nil {\n\t\t\t\tdlog.Error(c, err)\n\t\t\t}\n\t\t}()\n\t}\n\twg.Wait()\n\treturn nil\n}", "func (mgr ScsManager) Use(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tvar data []byte\n\t\tvar temp string\n\t\t// get the session. All of our session data is stored in only one key in the session manager.\n\t\tsession := mgr.Manager.Load(r)\n\t\tif err := session.Touch(w); err != nil { // Make sure to get a cookie in our header if we don't have one\n\t\t\tlog.Errorf(\"Error loading session: %s\", err.Error()) // we can't panic here, because our panic handlers have not been set up\n\t\t}\n\t\tdata, _ = session.GetBytes(scsSessionDataKey)\n\t\tsessionData := NewSession()\n\t\tif data != nil {\n\t\t\tif err := sessionData.UnmarshalBinary(data); err != nil {\n\t\t\t\tlog.Errorf(\"Error unpacking session data: %s\", err.Error())\n\t\t\t}\n\t\t}\n\n\t\tif sessionData.Has(sessionResetKey) {\n\t\t\t// Our previous session requested a reset. We can't reset after writing, so we reset here at the start of the next request.\n\t\t\tsessionData.Delete(sessionResetKey)\n\t\t\tif err := session.RenewToken(w); err != nil {\n\t\t\t\tlog.Errorf(\"Error renewing session token: %s\", err.Error())\n\t\t\t}\n\t\t}\n\n\t\tctx := r.Context()\n\t\tctx = context.WithValue(ctx, sessionContext, sessionData)\n\t\tr = r.WithContext(ctx)\n\t\tnext.ServeHTTP(w, r)\n\n\t\t// write out the changed session. The below will attempt to write a cookie, but it can't because headers have already been written.\n\t\t// That is OK, because of our Touch above.\n\t\tif sessionData.Len() > 0 {\n\t\t\tvar err error\n\t\t\tdata, err = sessionData.MarshalBinary()\n\t\t\tif err != nil {\n\t\t\t\t// This is an application error. We put data into the session which is not serializable.\n\t\t\t\ts := \"Error marshalling session data: %s\" + err.Error()\n\t\t\t\tlog.Error(s)\n\t\t\t\thttp.Error(w, s, 500)\n\t\t\t}\n\t\t\ttemp = string(data)\n\t\t\t_ = temp\n\t\t\tif err := session.PutBytes(w, scsSessionDataKey, data); err != nil {\n\t\t\t\tlog.Errorf(\"Error putting session data: %s\", err.Error())\n\t\t\t}\n\t\t} else {\n\t\t\tif err := session.Clear(w); err != nil {\n\t\t\t\tlog.Errorf(\"Error clearing session: %s\", err.Error())\n\t\t\t}\n\t\t}\n\t}\n\treturn mgr.Manager.Use(http.HandlerFunc(fn))\n}", "func (ks *KeyStore) CloseSession(session pkcs11.SessionHandle) {\n\terr := pkcs11Ctx.CloseSession(session)\n\tif err != nil {\n\t\tlogrus.Debugf(\"Error closing session: %s\", err.Error())\n\t}\n}", "func (n *nsLockMap) ForceUnlock(volume, path string) {\n\tn.lockMapMutex.Lock()\n\tdefer n.lockMapMutex.Unlock()\n\n\t// Clarification on operation:\n\t// - In case of FS or XL we call ForceUnlock on the local globalNSMutex\n\t// (since there is only a single server) which will cause the 'stuck'\n\t// mutex to be removed from the map. Existing operations for this\n\t// will continue to be blocked (and timeout). New operations on this\n\t// resource will use a new mutex and proceed normally.\n\t//\n\t// - In case of Distributed setup (using dsync), there is no need to call\n\t// ForceUnlock on the server where the lock was acquired and is presumably\n\t// 'stuck'. Instead dsync.ForceUnlock() will release the underlying locks\n\t// that participated in granting the lock. Any pending dsync locks that\n\t// are blocking can now proceed as normal and any new locks will also\n\t// participate normally.\n\tif n.isDistXL { // For distributed mode, broadcast ForceUnlock message.\n\t\tdsync.NewDRWMutex(context.Background(), pathJoin(volume, path), globalDsync).ForceUnlock()\n\t}\n\n\t// Remove lock from the map.\n\tdelete(n.lockMap, nsParam{volume, path})\n}", "func Close(ctx context.Context) {\n\tmw := ctx.Value(mwContextKey{}).(sessionMiddleware)\n\tid := ctx.Value(sessionIdContextKey{}).(string)\n\tdelete(mw.sessions, id)\n}", "func rLockUnlock(c *client, s *Server, cb func() (string, error)) (string, error) {\n\tif c.hasLock {\n\t\treturn cb()\n\t} else {\n\t\ts.mu.RLock()\n\t\tc.Lock()\n\t\tdefer c.Unlock()\n\t\tdefer s.mu.RUnlock()\n\t\treturn cb()\n\t}\n}", "func (me *GJUser) CloseSession(){\n\tme.qreq(\"sessions/close\",\"\")\n}", "func (n *nsLockMap) unlock(volume, path, opsID string, readLock bool) {\n\tparam := nsParam{volume, path}\n\tn.lockMapMutex.RLock()\n\tnsLk, found := n.lockMap[param]\n\tn.lockMapMutex.RUnlock()\n\tif !found {\n\t\treturn\n\t}\n\tif readLock {\n\t\tnsLk.RUnlock()\n\t} else {\n\t\tnsLk.Unlock()\n\t}\n\tn.lockMapMutex.Lock()\n\tif nsLk.ref == 0 {\n\t\tlogger.LogIf(context.Background(), errors.New(\"Namespace reference count cannot be 0\"))\n\t} else {\n\t\tnsLk.ref--\n\t\tif nsLk.ref == 0 {\n\t\t\t// Remove from the map if there are no more references.\n\t\t\tdelete(n.lockMap, param)\n\t\t}\n\t}\n\tn.lockMapMutex.Unlock()\n}", "func (_TokensNetwork *TokensNetworkTransactorSession) Unlock(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.Unlock(&_TokensNetwork.TransactOpts, token, partner, transferred_amount, expiration, amount, secret_hash, merkle_proof)\n}", "func (dba *DBAccess) UpdateSession(id string, update *model.Session) error {\n\n\tc := dba.Session.DB(\"athenadb\").C(\"session\")\n\tbsonID := bson.ObjectIdHex(id)\n\n\t// find existing session and update\n\tif session, err := dba.GetSessionByID(id); err != nil {\n\n\t\t// only update player stats\n\t\tfor _, player := range update.Players {\n\t\t\tfor _, p := range session.Players {\n\t\t\t\tif p.Name == player.Name {\n\n\t\t\t\t\tfor key, value := range player.Stats {\n\t\t\t\t\t\t// override stat with new value\n\t\t\t\t\t\tp.Stats[key] = value\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif err := c.UpdateId(bsonID, session); err != nil {\n\t\t\tfmt.Println(\"Error Updating session with id: \" + id)\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (pdr *ProviderMySQL) SessionDestroy(sid string) error {\n\tc := pdr.connectInit()\n\tdefer func() {\n\t\terr := c.Close()\n\t\tif err != nil {\n\t\t\tsession.SLogger.Println(err)\n\t\t}\n\t}()\n\n\t_, err := c.Exec(\"DELETE FROM \"+TableName+\" where session_key=?\", sid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (u unlocker) Unlock() error {\n\tkvp, meta, err := u.session.client.KV().Get(u.key, nil)\n\tif err != nil {\n\t\treturn NewKVError(\"get\", u.key, err)\n\t}\n\tif kvp == nil {\n\t\treturn nil\n\t}\n\tif kvp.Session != u.session.session {\n\t\treturn AlreadyLockedError{Key: u.key}\n\t}\n\n\tsuccess, _, err := u.session.client.KV().DeleteCAS(&api.KVPair{\n\t\tKey: u.key,\n\t\tModifyIndex: meta.LastIndex,\n\t}, nil)\n\tif err != nil {\n\t\treturn NewKVError(\"deletecas\", u.key, err)\n\t}\n\tif !success {\n\t\t// the key has been mutated since we checked it - probably someone\n\t\t// overrode our lock on it or deleted it themselves\n\t\treturn AlreadyLockedError{Key: u.key}\n\t}\n\treturn nil\n}", "func (s *s6aProxy) cleanupSession(sid string) chan interface{} {\n\ts.sessionsMu.Lock()\n\toldCh, ok := s.sessions[sid]\n\tif ok {\n\t\tdelete(s.sessions, sid)\n\t\ts.sessionsMu.Unlock()\n\t\tif oldCh != nil {\n\t\t\tclose(oldCh)\n\t\t}\n\t\treturn oldCh\n\t}\n\ts.sessionsMu.Unlock()\n\treturn nil\n}", "func lockUnlock(c *client, s *Server, cb func() (string, error)) (string, error) {\n\tif c.hasLock {\n\t\treturn cb()\n\t} else {\n\t\ts.mu.Lock()\n\t\tc.Lock()\n\t\tdefer c.Unlock()\n\t\tdefer s.mu.Unlock()\n\t\treturn cb()\n\t}\n}", "func (tm *TabletManager) unlock() {\n\ttm.actionSema.Release(1)\n}", "func SetSessionContextKey(ctx context.Context, s *Session) context.Context {\n\treturn context.WithValue(ctx, sessionCtxKey, s)\n}", "func (r *Request) Unlock(ctx context.Context, token string) error {\n\tif _, ok := r.wLocks[token]; !ok {\n\t\treturn nil\n\t}\n\n\terr := r.m.Unlock(ctx, token)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdelete(r.wLocks, token)\n\n\treturn nil\n}", "func (mng *InMemSessManager) OnSessionClosed(client *wwr.Client) error {\n\tmng.lock.Lock()\n\tdelete(mng.sessions, client.SessionKey())\n\tmng.lock.Unlock()\n\treturn nil\n}", "func (o *SessionDataUpdateParams) WithContext(ctx context.Context) *SessionDataUpdateParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (s *Session) manageCloseConditions() (sessErr error) {\n\tdefer func() {\n\t\tl := s.log\n\t\tif sessErr != nil {\n\t\t\tl = l.WithError(sessErr)\n\t\t}\n\t\tif s.childContextCancel != nil {\n\t\t\ts.childContextCancel()\n\t\t}\n\t\tfor _, cb := range s.closedCallbacks {\n\t\t\tgo cb(s, sessErr)\n\t\t}\n\t\ts.closedCallbacks = nil\n\t\tif s.session != nil {\n\t\t\t// s.session.Close(sessErr)\n\t\t\ts.session.Close()\n\t\t}\n\t\tif s.manager != nil {\n\t\t\ts.manager.OnSessionClosed(s, sessErr)\n\t\t}\n\t\tl.Debug(\"Session closed\")\n\t}()\n\n\ts.log.\n\t\tWithField(\"addr\", s.session.RemoteAddr().String()).\n\t\tWithField(\"initiator\", s.session.Initiator()).\n\t\tDebug(\"Session started\")\n\n\tselect {\n\tcase <-s.context.Done():\n\t\treturn context.Canceled\n\t//case <-s.inactivityTimer.C: TODO: re-enable inactivity timeout\n\t// \treturn errors.New(\"inactivity timeout reached\")\n\tcase err := <-s.pumpErrors:\n\t\treturn err\n\t}\n}", "func (hc *httpContext) clearSession() {\n\tsession := hc.getSession()\n\tif session == nil {\n\t\treturn\n\t}\n\n\tsession.Values[sv[\"provider\"]] = nil\n\tsession.Values[sv[\"name\"]] = nil\n\tsession.Values[sv[\"email\"]] = nil\n\tsession.Values[sv[\"user\"]] = nil\n\tsession.Values[sv[\"token\"]] = nil\n\n\thc.saveSession(session)\n}", "func SetSessionInContext(ctx context.Context, session *Session) context.Context {\n\treturn context.WithValue(ctx, sessionContextKey, session)\n}", "func (m *Driver) UpdateSession(sessID string, metadata interface{}) (*models.Session, error) {\n\treturn nil, errors.New(\"not implemented\")\n}", "func (_TokensNetwork *TokensNetworkSession) Unlock(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.Unlock(&_TokensNetwork.TransactOpts, token, partner, transferred_amount, expiration, amount, secret_hash, merkle_proof)\n}", "func (o *SessionDataUpdateParams) WithTimeout(timeout time.Duration) *SessionDataUpdateParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (s *TrafficOpsSessionThreadsafe) Update(\n\turl string,\n\tusername string,\n\tpassword string,\n\tinsecure bool,\n\tuserAgent string,\n\tuseCache bool,\n\ttimeout time.Duration,\n) error {\n\tif s == nil {\n\t\treturn errors.New(\"cannot update nil session\")\n\t}\n\ts.m.Lock()\n\tdefer s.m.Unlock()\n\n\t// always set unauthenticated sessions first which can eventually authenticate themselves when attempting requests\n\tif err := s.setSession(url, username, password, insecure, userAgent, useCache, timeout); err != nil {\n\t\treturn err\n\t}\n\tif err := s.setLegacySession(url, username, password, insecure, userAgent, useCache, timeout); err != nil {\n\t\treturn err\n\t}\n\n\tsession, _, err := client.LoginWithAgent(url, username, password, insecure, userAgent, useCache, timeout)\n\tif err != nil {\n\t\tlog.Errorf(\"logging in using up-to-date client: %v\", err)\n\t\tlegacySession, _, err := legacyClient.LoginWithAgent(url, username, password, insecure, userAgent, useCache, timeout)\n\t\tif err != nil || legacySession == nil {\n\t\t\terr = fmt.Errorf(\"logging in using legacy client: %v\", err)\n\t\t\treturn err\n\t\t}\n\t\t*s.legacySession = legacySession\n\t} else {\n\t\t*s.session = session\n\t}\n\n\treturn nil\n}", "func (s *BasePlSqlParserListener) ExitLock_mode(ctx *Lock_modeContext) {}", "func (db *DB) DeactivateSession(ctx context.Context, key string) error {\n\t_, err := db.sql.QueryContext(ctx, `UPDATE \n\t\t\t\t\t\t\t\t\t\tsessions\n\t\t\t\t\t\t\t\t\t\tSET (active) = (false)\n\t\t\t\t\t\t\t\t\t\tWHERE key = $1;`, key)\n\n\treturn err\n}", "func SessionDestroy(SID string) {\n\tSessionMapLock.Lock()\n\tdefer SessionMapLock.Unlock()\n\n\tlogging.Debug(&map[string]string{\n\t\t\"file\": \"session.go\",\n\t\t\"Function\": \"SessionDestroy\",\n\t\t\"event\": \"Destroy session\",\n\t\t\"SID\": SID,\n\t})\n\tdelete(SessionMap, SID)\n}", "func updateContextClaims(ctx context.Context, authenticator *auth.Authenticator, claims auth.Claims) (context.Context, error) {\n\ttkn, err := authenticator.GenerateToken(claims)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\tsess := webcontext.ContextSession(ctx)\n\tsess = webcontext.SessionUpdateAccessToken(sess, tkn)\n\n\tctx = context.WithValue(ctx, auth.Key, claims)\n\n\treturn ctx, nil\n}", "func (cl *APIClient) ReuseSession(sessionobj map[string]interface{}) *APIClient {\n\tcfg := sessionobj[\"socketcfg\"].(map[string]string)\n\tcl.socketConfig.SetSystemEntity(cfg[\"entity\"])\n\tcl.SetSession(cfg[\"session\"])\n\treturn cl\n}", "func (d *Abstraction) CloseSession() {\n\tfor k, v := range d.Sigmap {\n\t\tdelete(d.Sigmap, k)\n\t\tclose(v)\n\t}\n\td.Conn.RemoveSignal(d.Recv)\n\td.Conn.Close()\n}", "func (s *SharedState) unlock() {\n s.mutex.Unlock()\n}", "func (s *Session) Update() *errors.Error {\n\tconnPool, err := GetDBConnectionFunc(sessionStore)\n\tif err != nil {\n\t\treturn errors.PackError(err.ErrNo(), \"error while trying to connecting to DB: \", err.Error())\n\t}\n\tif _, err = connPool.Update(\"session\", s.Token, s); err != nil {\n\t\treturn errors.PackError(err.ErrNo(), \"error while trying to update session: \", err.Error())\n\t}\n\treturn nil\n}", "func (r *Request) RUnlock(ctx context.Context, token string) error {\n\tif _, ok := r.rLocks[token]; !ok {\n\t\treturn nil\n\t}\n\n\terr := r.m.RUnlock(ctx, token)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdelete(r.rLocks, token)\n\n\treturn nil\n}", "func (_m *DBClient) CloseSession() {\n\t_m.Called()\n}", "func (c *GSSAPIContext) dispose() error {\n\tif c.contextId != nil {\n\t\treturn c.contextId.Unload()\n\t}\n\treturn nil\n}", "func (om *Sdk) Unlock() error {\n\tom.logger.Println(\"decrypting Ops Manager\")\n\n\tunlockReq := UnlockRequest{om.creds.DecryptionPhrase}\n\tbody, err := json.Marshal(&unlockReq)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = om.api.Curl(api.RequestServiceCurlInput{\n\t\tPath: \"/api/v0/unlock\",\n\t\tMethod: \"PUT\",\n\t\tData: bytes.NewReader(body),\n\t})\n\n\treturn err\n}", "func UpdateSessionKeys() string {\n\tcfg := readCredentialsFile()\n\tvar tokenCode string\n\tfmt.Print(\"Please enter mfa code: \")\n\tfmt.Scanln(&tokenCode)\n\tserialNumber := getMfaSerialNumber()\n\tsessionLifespan := int64(60 * 60 * 36)\n\n\tsess := session.Must(session.NewSessionWithOptions(session.Options{\n\t\tSharedConfigState: session.SharedConfigEnable,\n\t\tProfile: \"default_original\",\n\t}))\n\tclient := sts.New(sess)\n\toutput, err := client.GetSessionToken(&sts.GetSessionTokenInput{\n\t\tSerialNumber: &serialNumber,\n\t\tTokenCode: &tokenCode,\n\t\tDurationSeconds: &sessionLifespan,\n\t})\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\n\t\t\tcase \"InvalidClientTokenId\":\n\t\t\t\taccessKey := cfg.Section(\"default_original\").Key(\"aws_access_key_id\").String()\n\t\t\t\tlog.Fatal(\"check your security credentials at https://console.aws.amazon.com/iam/home to ensure that access key \", accessKey, \" is active\")\n\t\t\tdefault:\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\n\tcfg.Section(\"default\").Key(\"aws_access_key_id\").SetValue(*output.Credentials.AccessKeyId)\n\tcfg.Section(\"default\").Key(\"aws_secret_access_key\").SetValue(*output.Credentials.SecretAccessKey)\n\tcfg.Section(\"default\").Key(\"aws_session_token\").SetValue(*output.Credentials.SessionToken)\n\tlocation := writeCredentialsFile(cfg)\n\treturn location\n}", "func (l *Lock) Unlock(ctx context.Context) error {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\n\tconn, err := l.Pool.GetContext(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer conn.Close()\n\tif l.token == nil {\n\t\tl.token = randomToken()\n\t}\n\n\treply, err := redis.Int(unlockScript.Do(conn, l.Key, l.token))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif reply != 1 {\n\t\treturn ErrNotHeld\n\t}\n\tl.token = nil\n\treturn nil\n}", "func testNoNilTimeoutReplacement(ctx context.Context, t *testing.T, w *Wallet) {\n\terr := w.Unlock(ctx, testPrivPass, nil)\n\tif err != nil {\n\t\tt.Fatal(\"failed to unlock wallet\")\n\t}\n\ttimeChan := make(chan time.Time)\n\terr = w.Unlock(ctx, testPrivPass, timeChan)\n\tif err != nil {\n\t\tt.Fatal(\"failed to unlock wallet with time channel\")\n\t}\n\tselect {\n\tcase timeChan <- time.Time{}:\n\tcase <-time.After(100 * time.Millisecond):\n\t\tt.Fatal(\"time channel was not read in 100ms\")\n\t}\n\tif w.Locked() {\n\t\tt.Fatal(\"expected wallet to remain unlocked due to previous unlock without timeout\")\n\t}\n}", "func releaseVulkanDevice(ctx context.Context, d adb.Device, m *flock.Mutex) error {\n\tif m != nil {\n\t\tctx = keys.Clone(context.Background(), ctx)\n\t\tif err := d.SetSystemProperty(ctx, vkImplicitLayersProp, \"\"); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tm.Unlock()\n\t}\n\treturn nil\n}", "func (s *BasePlSqlParserListener) ExitLock_table_statement(ctx *Lock_table_statementContext) {}", "func (ms *MemStore) CleanupSessionKeys(t uint64) error {\n\tvar oldKeys []string\n\tfor hash, sk := range ms.sessionKeys {\n\t\tif sk.cleanupTime < t {\n\t\t\toldKeys = append(oldKeys, hash)\n\t\t}\n\t}\n\tfor _, hash := range oldKeys {\n\t\tdelete(ms.sessionKeys, hash)\n\t}\n\treturn nil\n}" ]
[ "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.46474347", "0.4636123", "0.46301275", "0.4609557", "0.4609153", "0.46081457", "0.45950758", "0.45681477", "0.4565334", "0.45597628", "0.45462614", "0.45328608", "0.45249888", "0.45050535", "0.4496699", "0.4491387", "0.4491322", "0.4461073", "0.44533202", "0.44520226", "0.44460678", "0.44454435", "0.44430766", "0.44297892", "0.44228715", "0.44039968", "0.4393608", "0.43812132", "0.43721324", "0.4368954", "0.43655345", "0.43599707", "0.43577322", "0.43527555", "0.4349146", "0.4344017", "0.4342771", "0.43229952", "0.43226787", "0.43205968", "0.43053567", "0.4302042", "0.42886403", "0.4279771", "0.4278762", "0.4257873", "0.4256381", "0.42550877", "0.4247761", "0.4234548", "0.42277855", "0.42228368", "0.42204198", "0.42195988", "0.42163333", "0.4215023", "0.42109603", "0.42108378", "0.420841", "0.42058387", "0.42043647", "0.42014965", "0.42003784", "0.4199", "0.41982892", "0.41958547", "0.41852853", "0.41843605", "0.4183234", "0.41829482", "0.41820616", "0.4177014", "0.417678", "0.41588274", "0.41501093", "0.4149862", "0.41438934", "0.41414526", "0.41316167", "0.41217574" ]
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 != nil {\n\t\t\tintlog.Errorf(context.TODO(), `%+v`, err)\n\t\t}\n\t}\n}", "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.CleanupTimer = sessionCtx.Imsi, sessionCtx.CleanupTimer, nil\n\t\t}\n\t}\n\ts.rwl.Unlock()\n\tif timer != nil {\n\t\ttimer.Stop()\n\t}\n\treturn imsi, exist\n}", "func (s *EapAkaSrv) ResetSessionTimeout(sessionId string, newTimeout time.Duration) {\n\tvar oldTimer *time.Timer\n\n\ts.rwl.Lock()\n\tsession, exist := s.sessions[sessionId]\n\tif exist {\n\t\tif session != nil {\n\t\t\toldTimer, session.CleanupTimer = session.CleanupTimer, time.AfterFunc(newTimeout, func() {\n\t\t\t\tsessionTimeoutCleanup(s, sessionId, session)\n\t\t\t})\n\t\t}\n\t}\n\ts.rwl.Unlock()\n\n\tif oldTimer != nil {\n\t\toldTimer.Stop()\n\t}\n}", "func (s *EapAkaSrv) UpdateSessionUnlockCtx(lockedCtx *UserCtx, timeout time.Duration) {\n\tif !lockedCtx.locked {\n\t\tpanic(\"Expected locked\")\n\t}\n\tvar (\n\t\toldSession, newSession *SessionCtx\n\t\texist bool\n\t\toldTimer *time.Timer\n\t)\n\tnewSession = &SessionCtx{UserCtx: lockedCtx}\n\tsessionId := lockedCtx.SessionId\n\tlockedCtx.Unlock()\n\n\tnewSession.CleanupTimer = time.AfterFunc(timeout, func() {\n\t\tsessionTimeoutCleanup(s, sessionId, newSession)\n\t})\n\n\ts.rwl.Lock()\n\n\toldSession, exist = s.sessions[sessionId]\n\ts.sessions[sessionId] = newSession\n\tif exist && oldSession != nil {\n\t\toldSession.UserCtx = nil\n\t\tif oldSession.CleanupTimer != nil {\n\t\t\toldTimer, oldSession.CleanupTimer = oldSession.CleanupTimer, nil\n\t\t}\n\t}\n\ts.rwl.Unlock()\n\n\tif oldTimer != nil {\n\t\toldTimer.Stop()\n\t}\n}", "func (t *Timeout) isTimeout() bool {\n\tif time.Since(t.lastTime.Load().(time.Time)) <= t.timeGap {\n\t\treturn false\n\t}\n\n\tif t.autoUpdate {\n\t\tt.lastTime.Store(time.Now())\n\t}\n\treturn true\n}", "func (c Config) SessionTimeoutOrDefault() time.Duration {\n\tif c.SessionTimeout > 0 {\n\t\treturn c.SessionTimeout\n\t}\n\treturn DefaultSessionTimeout\n}", "func (s *EapAkaSrv) FindSession(sessionId string) (aka.IMSI, *UserCtx, bool) {\n\tvar (\n\t\timsi aka.IMSI\n\t\tlockedCtx *UserCtx\n\t\ttimer *time.Timer\n\t)\n\ts.rwl.RLock()\n\tsessionCtx, exist := s.sessions[sessionId]\n\tif exist && sessionCtx != nil {\n\t\tlockedCtx, timer, sessionCtx.CleanupTimer = sessionCtx.UserCtx, sessionCtx.CleanupTimer, nil\n\t}\n\ts.rwl.RUnlock()\n\n\tif lockedCtx != nil {\n\t\tlockedCtx.mu.Lock()\n\t\tlockedCtx.SessionId = sessionId // just in case - should always match\n\t\timsi = lockedCtx.Imsi\n\t\tlockedCtx.locked = true\n\t}\n\n\tif timer != nil {\n\t\ttimer.Stop()\n\t}\n\treturn imsi, lockedCtx, exist\n}", "func (env *Env) CheckSessionReplacement() (bool) {\n if env.replacingSession != nil {\n session := env.session\n log.Debugf(\"The new session (str=%+v) is replacing the current one (str=%+v)\", env.replacingSession.String(), env.session.String())\n env.RenewEnv(env.context, env.replacingSession)\n session.SessionRelease()\n\t\tlog.Debugf(\"Restarted connection successfully with new session: %+v.\", env.session.String())\n return true\n }\n return false\n}", "func WithSessionTimeout(timeout time.Duration) SessionOption {\n\treturn sessionTimeoutOption{timeout: timeout}\n}", "func IsTimeout(err error) bool", "func (m *TimeoutMap) UpdateID(id string) {\n\tm.mu.RLock()\n\tdefer m.mu.RUnlock()\n\tvalue, exists := m.elements[id] //查询此id是否存在\n\tif exists { //如果存在\n\t\tvalue.Update(nil, value.GetTimeout()) //则更新\n\t}\n}", "func (dba *DBAccess) UpdateSession(id string, update *model.Session) error {\n\n\tc := dba.Session.DB(\"athenadb\").C(\"session\")\n\tbsonID := bson.ObjectIdHex(id)\n\n\t// find existing session and update\n\tif session, err := dba.GetSessionByID(id); err != nil {\n\n\t\t// only update player stats\n\t\tfor _, player := range update.Players {\n\t\t\tfor _, p := range session.Players {\n\t\t\t\tif p.Name == player.Name {\n\n\t\t\t\t\tfor key, value := range player.Stats {\n\t\t\t\t\t\t// override stat with new value\n\t\t\t\t\t\tp.Stats[key] = value\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif err := c.UpdateId(bsonID, session); err != nil {\n\t\t\tfmt.Println(\"Error Updating session with id: \" + id)\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (m *MemorySessionStore) Check(sessionID string) (status bool, err error) {\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\tif t, ok := m.store[sessionID]; ok {\n\t\tif t.After(time.Now()) {\n\t\t\treturn true, nil\n\t\t}\n\t\tdelete(m.store, sessionID)\n\t}\n\treturn false, nil\n}", "func SessionExists(SID string) bool {\n\t_, exists := SessionMap[SID]\n\treturn exists\n}", "func (m *Driver) UpdateSession(sessID string, metadata interface{}) (*models.Session, error) {\n\treturn nil, errors.New(\"not implemented\")\n}", "func (tm *TimerManager) ClearTimeout(id int) bool {\n\n\tfor pos, t := range tm.timers {\n\t\tif t.id == id {\n\t\t\tcopy(tm.timers[pos:], tm.timers[pos+1:])\n\t\t\ttm.timers[len(tm.timers)-1] = timeout{}\n\t\t\ttm.timers = tm.timers[:len(tm.timers)-1]\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func sessionConfigTimeoutHandler(_ *task.SessionConfigTask, env *task.Env) {\n\tlog.Info(\"Session config refresh timeout\")\n\tenv.StopSessionConfig()\n}", "func (h *SessionHandler) UpdateSession(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tvar session models.Session\n\tjson.NewDecoder(r.Body).Decode(&session)\n\tcreatedSession, err := h.SessionCore.UpdateSession(params[\"id\"], session.IsActive)\n\tswitch {\n\tcase err == nil:\n\t\tjson.NewEncoder(w).Encode(&createdSession)\n\tdefault:\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "func WithSessionTimeout(tm time.Duration) Option {\n\treturn func(o *config) {\n\t\to.SessionTimeout = tm\n\t}\n}", "func (o *SessionDataUpdateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (client BastionClient) UpdateSession(ctx context.Context, request UpdateSessionRequest) (response UpdateSessionResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.updateSession, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = UpdateSessionResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = UpdateSessionResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(UpdateSessionResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into UpdateSessionResponse\")\n\t}\n\treturn\n}", "func (handler *IdentityProviderHandler) CheckSession(sessionID string, userAgent string, remoteAddr string) (r bool, err error) {\n\thandler.log.Printf(\"checkSession(%v, %v, %v)\", sessionID, userAgent, remoteAddr)\n\n\tsession, err := handler.SessionInteractor.Find(sessionID)\n\tif err != nil {\n\t\te := err.(*errs.Error)\n\t\treturn false, errorToServiceError(e)\n\t}\n\n\tif !session.Domain.Enabled || !session.User.Enabled {\n\t\te := services.NewUnauthorizedError()\n\t\te.Msg = \"Domain and/or user disabled\"\n\t\treturn false, e\n\t}\n\n\tif session.UserAgent != userAgent || session.RemoteAddr != remoteAddr {\n\t\te := services.NewNotFoundError()\n\t\te.Msg = \"Session not found\"\n\t\treturn false, e\n\t}\n\n\tif session.IsExpired() {\n\t\te := services.NewUnauthorizedError()\n\t\te.Msg = \"Session expired\"\n\t\treturn false, e\n\t}\n\n\terr = handler.SessionInteractor.Retain(*session)\n\tif err != nil {\n\t\te := err.(*errs.Error)\n\t\treturn false, errorToServiceError(e)\n\t}\n\n\treturn true, nil\n}", "func systemSessionTimeout(ctx context.Context, beegoTimeout int64) int64 {\n\t// read from system config if it is meaningful to support change session timeout in runtime for user.\n\t// otherwise, use parameters beegoTimeout which set from beego.\n\ttimeout := beegoTimeout\n\tif sysTimeout := config.SessionTimeout(ctx); sysTimeout > 0 {\n\t\ttimeout = sysTimeout * int64(time.Minute)\n\t}\n\n\treturn timeout\n}", "func (client BastionClient) updateSession(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {\n\thttpRequest, err := request.HTTPRequest(http.MethodPut, \"/sessions/{sessionId}\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response UpdateSessionResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func (t *Task) IsTimeout() bool {\n\treturn time.Now().Sub(t.AssignedAt) > TIMEOUT\n}", "func (s *State) SessionDone(id string) <-chan struct{} {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tsess, ok := s.sessions[id]\n\tif !ok {\n\t\tret := make(chan struct{})\n\t\tclose(ret)\n\t\treturn ret\n\t}\n\treturn sess.Done\n}", "func (rp *Provider) SessionExist(ctx context.Context, sid string) (bool, error) {\n\tif ctx == nil {\n\t\tctx = context.TODO()\n\t}\n\treturn rp.c.Contains(ctx, sid), nil\n}", "func IsTimeout(err error) bool {\n\treturn err == errTimeout\n}", "func (m *MockDatabase) UpdateSessionID(ID, SessionID string) error {\n\targs := m.Called(ID, SessionID)\n\treturn args.Error(0)\n}", "func (o *SessionDataUpdateParams) WithTimeout(timeout time.Duration) *SessionDataUpdateParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func CheckRunningSession(userID int64) bool {\n\tif err := GetSessionByUserID(&Session{}, userID); err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "func (p *OIDCIBMProvider) RefreshSessionIfNeeded(s *SessionState) (bool, error) {\n\tfmt.Printf(\"RefreshSessionIfNeeded() - %v\\n\", s)\n\tif s == nil || s.ExpiresOn.After(time.Now()) || s.RefreshToken == \"\" {\n\t\t// the two commented lines below are hard coding the session timeout to two minutes\n\t\t//if s == nil || s.ExpiresOn.After(time.Now().Add(time.Hour*time.Duration(1)+\n\t\t//\ttime.Minute*time.Duration(58))) || s.RefreshToken == \"\" {\n\t\tfmt.Printf(\"RefreshSessionIfNeeded() - Expiry not yet reached, no session, or refresh token.\\n\")\n\t\treturn false, nil\n\t}\n\t//return false, fmt.Errorf(\"Clear Session and start again\")\n\n\torigExpiration := s.ExpiresOn\n\n\terr := p.redeemRefreshToken(s)\n\tif err != nil {\n\t\tfmt.Printf(\"RefreshSessionIfNeeded() - Error: %v\\n\", err)\n\t\treturn false, fmt.Errorf(\"unable to redeem refresh token: %v\", err)\n\t}\n\n\tfmt.Printf(\"refreshed id token %s (expired on %s)\\n\", s, origExpiration)\n\treturn true, nil\n}", "func (s *State) SessionDone(id string) (<-chan struct{}, error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tsess, ok := s.sessions[id]\n\tif !ok {\n\t\treturn nil, status.Errorf(codes.NotFound, \"session %q not found\", id)\n\t}\n\treturn sess.Done(), nil\n}", "func (c _StoreImpl) Session_ById(Id int) (*Session, bool) {\n\to, ok := RowCacheIndex.Get(\"Session_Id:\" + fmt.Sprintf(\"%v\", Id))\n\tif ok {\n\t\tif obj, ok := o.(*Session); ok {\n\t\t\treturn obj, true\n\t\t}\n\t}\n\n\trow, err := NewSession_Selector().Id_Eq(Id).GetRow(base.DB)\n\tif err == nil {\n\t\tRowCacheIndex.Set(\"Session_Id:\"+fmt.Sprintf(\"%v\", row.Id), row, 0)\n\t\treturn row, true\n\t}\n\n\tXOLogErr(err)\n\treturn nil, false\n}", "func (*TimeoutError) IsTimeout() bool {\n\treturn true\n}", "func (st *State) Session(id string) *cache.Session {\n\tfor _, s := range st.Sessions() {\n\t\tif s.ID() == id {\n\t\t\treturn s\n\t\t}\n\t}\n\treturn nil\n}", "func (uuo *UserUpdateOne) SetSessionID(id int) *UserUpdateOne {\n\tuuo.mutation.SetSessionID(id)\n\treturn uuo\n}", "func (set RoleSet) AdjustSessionTTL(ttl time.Duration) time.Duration {\n\tfor _, role := range set {\n\t\tif ttl > role.GetMaxSessionTTL().Duration {\n\t\t\tttl = role.GetMaxSessionTTL().Duration\n\t\t}\n\t}\n\treturn ttl\n}", "func (s *StorageFile) UpdateTTL(ctx context.Context, sessionId string, ttl time.Duration) error {\n\tintlog.Printf(ctx, \"StorageFile.UpdateTTL: %s, %v\", sessionId, ttl)\n\tif ttl >= DefaultStorageFileUpdateTTLInterval {\n\t\ts.updatingIdSet.Add(sessionId)\n\t}\n\treturn nil\n}", "func (s *s6aProxy) updateSession(sid string, ch chan interface{}) chan interface{} {\n\ts.sessionsMu.Lock()\n\toldCh, ok := s.sessions[sid]\n\ts.sessions[sid] = ch\n\ts.sessionsMu.Unlock()\n\tif ok {\n\t\tif oldCh != nil {\n\t\t\tclose(oldCh)\n\t\t}\n\t\treturn oldCh\n\t}\n\treturn nil\n}", "func (m *TestFixClient) WaitForSession(sid string) error {\n\tfound := false\n\tfor i := 0; i < 20; i++ {\n\t\tif session, ok := m.Sessions[sid]; ok {\n\t\t\tif session.LoggedOn {\n\t\t\t\tlog.Printf(\"found session %s\", sid)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tfound = true\n\t\t}\n\t\ttime.Sleep(time.Millisecond * 250)\n\t}\n\tfor _, s := range m.Sessions {\n\t\tlog.Printf(\"test fix client session: %s\", s.ID.String())\n\t}\n\tif found {\n\t\treturn fmt.Errorf(\"session found but not logged on: %s\", sid)\n\t}\n\treturn fmt.Errorf(\"could not find session: %s\", sid)\n}", "func IsSessionClosed(s *mgo.Session) (res bool) {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tlog.Print(\"[MGO2_IS_SESSION_CLOSED] check session closed panic:\", err)\n\t\t}\n\t}()\n\tres = true\n\treturn s.Ping() != nil\n}", "func (s *service) UpdateSession(session *Session) (*Session, []error) {\n\tsession.LastAccessTime = time.Now()\n\treturn (*s.repo).UpdateSession(session)\n}", "func (m *RequestValidator) sessionTTL(ctx context.Context, identity tlsca.Identity, r types.AccessRequest) (time.Duration, error) {\n\tttl, err := m.truncateTTL(ctx, identity, r.GetAccessExpiry(), r.GetRoles())\n\tif err != nil {\n\t\treturn 0, trace.BadParameter(\"invalid session TTL: %v\", err)\n\t}\n\n\t// Before returning the TTL, validate that the value requested was smaller\n\t// than the maximum value allowed. Used to return a sensible error to the\n\t// user.\n\trequestedTTL := r.GetAccessExpiry().Sub(m.clock.Now().UTC())\n\tif !r.GetAccessExpiry().IsZero() && requestedTTL > ttl {\n\t\treturn 0, trace.BadParameter(\"invalid session TTL: %v greater than maximum allowed (%v)\", requestedTTL.Round(time.Minute), ttl.Round(time.Minute))\n\t}\n\n\treturn ttl, nil\n}", "func CheckSessionIDexists(sessionID string, FileCarveSessionMap map[string]*FilCarveSession) bool {\n\tif _, exist := FileCarveSessionMap[sessionID]; !exist {\n\t\tfor k := range FileCarveSessionMap {\n\t\t\tlog.Println(k)\n\t\t}\n\t\treturn false\n\t}\n\treturn true\n}", "func LookupSession(id string) (Account, error) {\n\ts, err := persistenceInstance.session(id)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif time.Now().After(s.expires) {\n\t\tDeleteSession(id)\n\t\treturn nil, errors.New(\"Session Expired\")\n\t}\n\n\treturn s.account, nil\n}", "func (gs *Service) IsSessionCreated(_ context.Context, req *api.IsSessionCreatedRequest, rsp *api.IsSessionCreatedResponse) error {\n\trsp.IsRunning = 2 // Stands for false.\n\tfor _, value := range gs.sessions {\n\t\tif value.currentGameID == req.GameId {\n\t\t\trsp.IsRunning = 1\n\t\t\trsp.SessionId = value.sessionID\n\t\t\trsp.ChatSocketAddress = value.chatAddress\n\t\t\trsp.SessionSocketAddress = value.sessionAddress\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func VerifySession(sid string) bool {\n\tvar session Session\n\tif err := cache.Get(SessionId+SESSION_KEY, &session); err != nil {\n\t\treturn false\n\t}\n\treturn sid == session.Id\n}", "func (m *UserMutation) SessionID() (id int, exists bool) {\n\tif m.session != nil {\n\t\treturn *m.session, true\n\t}\n\treturn\n}", "func (p *AzureProvider) RefreshSessionIfNeeded(ctx context.Context, s *sessions.SessionState) (bool, error) {\n\tif s == nil || s.ExpiresOn.After(time.Now()) || s.RefreshToken == \"\" {\n\t\treturn false, nil\n\t}\n\n\torigExpiration := s.ExpiresOn\n\n\terr := p.redeemRefreshToken(ctx, s)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"unable to redeem refresh token: %v\", err)\n\t}\n\n\tlogger.Printf(\"refreshed id token %s (expired on %s)\\n\", s, origExpiration)\n\treturn true, nil\n}", "func (uu *UserUpdate) SetSessionID(id int) *UserUpdate {\n\tuu.mutation.SetSessionID(id)\n\treturn uu\n}", "func (mc *mgmtClient) RenewSessionLock(ctx context.Context, sessionID string) (time.Time, error) {\n\tbody := map[string]interface{}{\n\t\t\"session-id\": sessionID,\n\t}\n\n\tmsg := &amqp.Message{\n\t\tValue: body,\n\t\tApplicationProperties: map[string]interface{}{\n\t\t\t\"operation\": \"com.microsoft:renew-session-lock\",\n\t\t},\n\t}\n\n\tresp, err := mc.doRPCWithRetry(ctx, msg, 5, 5*time.Second)\n\n\tif err != nil {\n\t\treturn time.Time{}, err\n\t}\n\n\tm, ok := resp.Message.Value.(map[string]interface{})\n\n\tif !ok {\n\t\treturn time.Time{}, NewErrIncorrectType(\"Message.Value\", map[string]interface{}{}, resp.Message.Value)\n\t}\n\n\tlockedUntil, ok := m[\"expiration\"].(time.Time)\n\n\tif !ok {\n\t\treturn time.Time{}, NewErrIncorrectType(\"Message.Value[\\\"expiration\\\"] as times\", time.Time{}, resp.Message.Value)\n\t}\n\n\treturn lockedUntil, nil\n}", "func (c *consulClient) renewSession(ttl string, session string, renewChan chan struct{}) {\n\n\tsessionDestroyAttempts := 0\n\tmaxSessionDestroyAttempts := 5\n\n\tparsedTTL, err := time.ParseDuration(ttl)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-time.After(parsedTTL / 2):\n\t\t\t\tentry, _, err := c.consul.Session().Renew(session, nil)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogging.Error(\"client/consul: unable to renew the Consul session %s: %v\", session, err)\n\t\t\t\t\truntime.Goexit()\n\t\t\t\t}\n\t\t\t\tif entry == nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Consul may return a TTL value higher than the one specified during\n\t\t\t\t// session creation. This indicates the server is under high load and\n\t\t\t\t// is requesting clients renew less often. If this happens we need to\n\t\t\t\t// ensure we track the new TTL.\n\t\t\t\tparsedTTL, _ = time.ParseDuration(entry.TTL)\n\t\t\t\tlogging.Debug(\"client/consul: the Consul session %s has been renewed\", session)\n\n\t\t\tcase <-renewChan:\n\t\t\t\t_, err := c.consul.Session().Destroy(session, nil)\n\t\t\t\tif err == nil {\n\t\t\t\t\tlogging.Info(\"client/consul: the Consul session %s has been released\", session)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif sessionDestroyAttempts >= maxSessionDestroyAttempts {\n\t\t\t\t\tlogging.Error(\"client/consul: unable to successfully destroy the Consul session %s\", session)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// We can't destroy the session so we will wait and attempt again until\n\t\t\t\t// we hit the threshold.\n\t\t\t\tsessionDestroyAttempts++\n\t\t\t\ttime.Sleep(parsedTTL)\n\t\t\t}\n\t\t}\n\t}()\n}", "func (p *OktaProvider) RefreshSessionIfNeeded(s *sessions.SessionState) (bool, error) {\n\tif s == nil || !s.RefreshPeriodExpired() || s.RefreshToken == \"\" {\n\t\treturn false, nil\n\t}\n\tnewToken, duration, err := p.RefreshAccessToken(s.RefreshToken)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tlogger := log.NewLogEntry()\n\n\ts.AccessToken = newToken\n\n\ts.RefreshDeadline = time.Now().Add(duration).Truncate(time.Second)\n\tlogger.WithUser(s.Email).WithRefreshDeadline(s.RefreshDeadline).Info(\"refreshed access token\")\n\n\treturn true, nil\n}", "func (r *SmscSessionRepository) ExistsById(ID string) bool {\n\treturn app.BuntDBInMemory.View(func(tx *buntdb.Tx) error {\n\t\t_, err := tx.Get(SMSC_SESSION_PREFIX + ID)\n\t\treturn err\n\t}) == nil\n}", "func IsTimeoutErr(err error) bool {\n\tif sysErr, ok := err.(*os.SyscallError); ok {\n\t\tif errno, ok := sysErr.Err.(syscall.Errno); ok {\n\t\t\treturn errno == cERROR_TIMEOUT\n\t\t}\n\t}\n\treturn false\n}", "func FindSession(name string) (*Session, error) {\n\tss, err := FindSessionFunc(func(s *Session) (match bool, cont bool) {\n\t\treturn s.Name == name, s.Name != name\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(ss) == 0 {\n\t\treturn nil, nil\n\t}\n\n\treturn ss[0], nil\n}", "func (session *Session) IsValid() error {\n\tif err := mongo.Execute(\"monotonic\", SessionCollectionName(session.TenantID),\n\t\tfunc(collection *mgo.Collection) error {\n\t\t\tselector := bson.M{\n\t\t\t\t\"token\": session.Token,\n\t\t\t}\n\t\t\treturn collection.Find(selector).One(session)\n\t\t}); err != nil {\n\t\treturn fmt.Errorf(\"Error[%s] while finding session with token[%s]\", err, session.Token)\n\t}\n\t// if session.Expired() {\n\t// \treturn fmt.Errorf(\"Session expired\")\n\t// }\n\t// extend expired Time\n\tselector := bson.M{\n\t\t\"_id\": session.ID,\n\t}\n\tupdator := bson.M{\n\t\t\"$set\": bson.M{\n\t\t\t\"e_at\": time.Now().Add(time.Duration(1) * time.Hour),\n\t\t\t\"u_at\": time.Now(),\n\t\t},\n\t}\n\treturn session.Update(session.TenantID, selector, updator)\n}", "func NewUpdateSessionNotFound() *UpdateSessionNotFound {\n\treturn &UpdateSessionNotFound{}\n}", "func (worker *K8SPodWorker) IsTimeout() (bool, time.Duration) {\n\tnow := time.Now()\n\tif now.After(worker.dueTime) {\n\t\treturn true, time.Duration(0)\n\t}\n\treturn false, worker.dueTime.Sub(now)\n}", "func (b *base) waitTimeout() bool {\n\tc := make(chan struct{})\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-time.After(time.Second):\n\t\t\t\t//Send an update to the clients\n\t\t\t\tb.funcSyncPlayer()\n\t\t\tcase <-c:\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tcnt := context.Background()\n\tcnt, b.cancelWait = context.WithTimeout(cnt, time.Millisecond*time.Duration(b.timeImage))\n\terr := b.waitingResponse.Acquire(cnt, b.nbWaitingResponses)\n\tb.cancelWait()\n\n\tclose(c)\n\n\tif err == nil {\n\t\tb.receivingGuesses.UnSet()\n\t\treturn false // completed normally\n\t}\n\n\tb.receivingGuesses.UnSet()\n\treturn true // timed out\n}", "func (o *HasFlowRunningByFlowIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func GoodSession(r *http.Request) bool {\n\tstore, err := pgstore.NewPGStore(os.Getenv(\"PGURL\"), key)\n\tcheck(err)\n\tdefer store.Close()\n\n\tsession, err := store.Get(r, \"scheduler-session\")\n\tcheck(err)\n\n\t// Check if user is authenticated\n\tif auth, ok := session.Values[\"authenticated\"].(bool); !ok || !auth {\n\t\tlog.Info(\"Stale session rejected: \", session)\n\t\treturn false\n\t}\n\tlog.Info(\"Session OK: \", session)\n\treturn true\n}", "func IsLockedByAnotherSession(c *template.Context) bool {\n\tid := c.ID()\n\tinstanceID := c.Session().InstanceID()\n\n\t// Lock the mutex.\n\tlockMutex.Lock()\n\tdefer lockMutex.Unlock()\n\n\t// Check if locked by the current session.\n\tlocked, err := dbIsLockedByAnotherValue(id, instanceID)\n\tif err != nil {\n\t\tlog.L.Error(\"store: failed to get lock state: %v\", err)\n\t\treturn true\n\t}\n\n\treturn locked\n}", "func isServerSslSessionTimeoutDirective(directive string) bool {\n\tif isEqualString(directive, ServerSslSessionTimeoutDirective) {\n\t\treturn true\n\t}\n\treturn false\n}", "func (pder *MemProvider) SessionExist(sid string) bool {\n\tres, _ := (*session.MemProvider)(pder).SessionExist(context.Background(), sid)\n\treturn res\n}", "func (s *State) MarkSession(req *rpc.RemainRequest, now time.Time) (ok bool) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tsessionID := req.Session.SessionId\n\n\tif sess, ok := s.sessions[sessionID]; ok {\n\t\tsess.SetLastMarked(now)\n\t\tif req.ApiKey != \"\" {\n\t\t\tif client, ok := s.clients.Load(sessionID); ok {\n\t\t\t\tclient.ApiKey = req.ApiKey\n\t\t\t\ts.clients.Store(sessionID, client)\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\n\treturn false\n}", "func HasUserSession(userID uuid.UUID) bool {\n\tdefer mutex.Unlock()\n\tmutex.Lock()\n\n\treturn hasUserSession(userID)\n}", "func (pc *PFCPConnection) ForgetSession(seid SEID) bool {\n\tpc.Lock()\n\tdefer pc.Unlock()\n\t_, found := pc.sessions[seid]\n\tif !found {\n\t\treturn false\n\t}\n\tdelete(pc.sessions, seid)\n\treturn true\n}", "func IsTimeout(err error) bool {\n\ttype timeouter interface {\n\t\tTimeout() bool\n\t}\n\treturn isErrorPredicate(err, func(err error) bool {\n\t\te, ok := err.(timeouter)\n\t\treturn ok && e.Timeout()\n\t})\n}", "func UpdateSession(session *Session) error {\n\tdb := GetDB()\n\n\tif err := db.Table(\"sessions\").Where(\"user_id = ?\", session.UserID).Updates(map[string]interface{}{\"session_end_at\": session.SessionEndAt, \"state\": session.State}).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (hb *HeartBeatTracker) TimedOut(id string) bool {\n\thb.lock()\n\tt, ok := hb.last[id]\n\thb.unlock()\n\treturn !ok || time.Since(t) > hb.interval\n}", "func (*adminCtrl) findSessionByID(c *elton.Context) (err error) {\n\tstore := cache.GetRedisSession()\n\tdata, err := store.Get(c.Param(\"id\"))\n\tif err != nil {\n\t\treturn\n\t}\n\tc.Body = &findSessionResp{\n\t\tData: string(data),\n\t}\n\treturn\n}", "func (hb *HeartBeatTracker) TimedOut(id string) bool {\n\thb.lock()\n\tdefer hb.unlock()\n\n\tt, ok := hb.last[id]\n\treturn !ok || time.Since(t) > hb.interval\n}", "func (o *ScheduledPlanRunOnceByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (s *State) MarkSession(req *rpc.RemainRequest, now time.Time) (ok bool) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tsessionID := req.Session.SessionId\n\n\tif sess, ok := s.sessions[sessionID]; ok {\n\t\tsess.LastMarked = now\n\t\tif req.ApiKey != \"\" {\n\t\t\tif client, ok := s.clients.Load(sessionID); ok {\n\t\t\t\tclient.ApiKey = req.ApiKey\n\t\t\t\ts.clients.Store(sessionID, client)\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\n\treturn false\n}", "func IsTimeout(err error) bool {\n\tif err == nil {\n\t\treturn false\n\t}\n\tif t, ok := errs.Cause(err).(timeout); ok {\n\t\treturn t.Timeout()\n\t}\n\treturn false\n}", "func hasUserSession(userID uuid.UUID) bool {\n\t_, ok := userCache[userID]\n\treturn ok\n}", "func NewSessionDataUpdateParamsWithTimeout(timeout time.Duration) *SessionDataUpdateParams {\n\tvar ()\n\treturn &SessionDataUpdateParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func returnSessionErr(w http.ResponseWriter, r *http.Request) bool {\n\ts, _ := session.GetCurrentSession(r)\n\treturn s.Active()\n}", "func (pder *MemProvider) SessionUpdate(sid string) error {\n\treturn (*session.MemProvider)(pder).SessionUpdate(context.Background(), sid)\n}", "func (rep *UserRepository) UpdateLastSession(userID int64) (err error) {\n\ttimeNow := utils.GetTimestampNow()\n\terr = databaseConnection.Model(&models.User{ID: userID}).Update(\"updated\", timeNow).Update(\"last_session\", timeNow).Error\n\tif err != nil {\n\t\tlog.Error(0, \"Could not update users last session: %v\", err)\n\t\treturn\n\t}\n\treturn\n}", "func (c *Client) Update(ctx context.Context, id string) error {\n\targ := &ngrok.TunnelSessionsUpdate{ID: id}\n\n\tvar path bytes.Buffer\n\tif err := template.Must(template.New(\"update_path\").Parse(\"/tunnel_sessions/{{ .ID }}/update\")).Execute(&path, arg); err != nil {\n\t\tpanic(err)\n\t}\n\targ.ID = \"\"\n\tvar (\n\t\tapiURL = &url.URL{Path: path.String()}\n\t\tbodyArg interface{}\n\t)\n\tapiURL.Path = path.String()\n\tbodyArg = arg\n\n\tif err := c.apiClient.Do(ctx, \"POST\", apiURL, bodyArg, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (o *UpdateCustomIDPParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (a *App) ExtendSessionExpiryIfNeeded(session *model.Session) bool {\n\tif !*a.Config().ServiceSettings.ExtendSessionLengthWithActivity {\n\t\treturn false\n\t}\n\n\tif session == nil || session.IsExpired() {\n\t\treturn false\n\t}\n\n\tsessionLength := a.GetSessionLengthInMillis(session)\n\n\t// Only extend the expiry if the lessor of 1% or 1 day has elapsed within the\n\t// current session duration.\n\tthreshold := int64(math.Min(float64(sessionLength)*0.01, float64(model.DayInMilliseconds)))\n\t// Minimum session length is 1 day as of this writing, therefore a minimum ~14 minutes threshold.\n\t// However we'll add a sanity check here in case that changes. Minimum 5 minute threshold,\n\t// meaning we won't write a new expiry more than every 5 minutes.\n\tif threshold < 5*60*1000 {\n\t\tthreshold = 5 * 60 * 1000\n\t}\n\n\tnow := model.GetMillis()\n\telapsed := now - (session.ExpiresAt - sessionLength)\n\tif elapsed < threshold {\n\t\treturn false\n\t}\n\n\tauditRec := a.MakeAuditRecord(\"extendSessionExpiry\", audit.Fail)\n\tdefer a.LogAuditRec(auditRec, nil)\n\tauditRec.AddMeta(\"session\", session)\n\n\tnewExpiry := now + sessionLength\n\tif err := a.ch.srv.platform.ExtendSessionExpiry(session, newExpiry); err != nil {\n\t\tmlog.Error(\"Failed to update ExpiresAt\", mlog.String(\"user_id\", session.UserId), mlog.String(\"session_id\", session.Id), mlog.Err(err))\n\t\tauditRec.AddMeta(\"err\", err.Error())\n\t\treturn false\n\t}\n\n\tmlog.Debug(\"Session extended\", mlog.String(\"user_id\", session.UserId), mlog.String(\"session_id\", session.Id),\n\t\tmlog.Int64(\"newExpiry\", newExpiry), mlog.Int64(\"session_length\", sessionLength))\n\n\tauditRec.Success()\n\tauditRec.AddMeta(\"extended_session\", session)\n\treturn true\n}", "func TestSessionTtlGreaterThan30Days(t *testing.T) {\n\n\trt := NewRestTester(t, nil)\n\tdefer rt.Close()\n\n\ta := auth.NewAuthenticator(rt.MetadataStore(), nil, rt.GetDatabase().AuthenticatorOptions())\n\tuser, err := a.GetUser(\"\")\n\tassert.NoError(t, err)\n\tuser.SetDisabled(true)\n\terr = a.Save(user)\n\tassert.NoError(t, err)\n\n\tuser, err = a.GetUser(\"\")\n\tassert.NoError(t, err)\n\tassert.True(t, user.Disabled())\n\n\tresponse := rt.SendRequest(\"PUT\", \"/db/doc\", `{\"hi\": \"there\"}`)\n\tRequireStatus(t, response, 401)\n\n\tuser, err = a.NewUser(\"pupshaw\", \"letmein\", channels.BaseSetOf(t, \"*\"))\n\trequire.NoError(t, err)\n\tassert.NoError(t, a.Save(user))\n\n\t// create a session with the maximum offset ttl value (30days) 2592000 seconds\n\tresponse = rt.SendAdminRequest(\"POST\", \"/db/_session\", `{\"name\":\"pupshaw\", \"ttl\":2592000}`)\n\tRequireStatus(t, response, 200)\n\n\tlayout := \"2006-01-02T15:04:05\"\n\n\tvar body db.Body\n\trequire.NoError(t, base.JSONUnmarshal(response.Body.Bytes(), &body))\n\n\tlog.Printf(\"expires %s\", body[\"expires\"].(string))\n\texpires, err := time.Parse(layout, body[\"expires\"].(string)[:19])\n\tassert.NoError(t, err)\n\n\t// create a session with a ttl value one second greater thatn the max offset ttl 2592001 seconds\n\tresponse = rt.SendAdminRequest(\"POST\", \"/db/_session\", `{\"name\":\"pupshaw\", \"ttl\":2592001}`)\n\tRequireStatus(t, response, 200)\n\n\tbody = nil\n\trequire.NoError(t, base.JSONUnmarshal(response.Body.Bytes(), &body))\n\tlog.Printf(\"expires2 %s\", body[\"expires\"].(string))\n\texpires2, err := time.Parse(layout, body[\"expires\"].(string)[:19])\n\tassert.NoError(t, err)\n\n\t// Allow a ten second drift between the expires dates, to pass test on slow servers\n\tacceptableTimeDelta := time.Duration(10) * time.Second\n\n\t// The difference between the two expires dates should be less than the acceptable time delta\n\tassert.True(t, expires2.Sub(expires) < acceptableTimeDelta)\n}", "func (db *DB) Session(id string) (*Session, error) {\n\tvar s Session\n\tres := db.db.First(&s, \"id = ?\", id)\n\tif res.Error != nil {\n\t\treturn nil, ignoreNotFound(res)\n\t}\n\treturn &s, nil\n}", "func (o *PostSessionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (m *memoryStorage) sessionChecker() {\n\tfor {\n\t\tm.mutex.Lock()\n\t\tfor sessionID, v := range m.sessions {\n\t\t\tif v.expires < time.Now().Unix() {\n\t\t\t\tdelete(m.sessions, sessionID)\n\t\t\t}\n\t\t}\n\t\tfor nonce, expires := range m.nonces {\n\t\t\tif time.Now().After(expires) {\n\t\t\t\tdelete(m.nonces, nonce)\n\t\t\t}\n\t\t}\n\t\tm.mutex.Unlock()\n\t\ttime.Sleep(sessionCheckInterval * time.Second)\n\t}\n}", "func (srv *server) Session(id string) Session {\n\tsrv.mu.Lock()\n\tdefer srv.mu.Unlock()\n\n\treturn srv.s[id]\n}", "func (t *SessionManager) get_session_from_db(session_uuid string) (exists bool, user_id int64, expire_time time.Time, err error) {\n\n\trows, err := t.db.Query(`\n\t\tSELECT User_id, Expire_time\n\t\tFROM UserSession\n\t\tWHERE Token = ? AND Expire_time > CURRENT_TIMESTAMP()`, session_uuid)\n\tif err != nil {\n\t\treturn false, 0, time.Now(), err\n\t}\n\tdefer rows.Close()\n\n\tnum_rows := 0\n\tfor rows.Next() {\n\t\tnum_rows++\n\t\tif err := rows.Scan(&user_id, &expire_time); err != nil {\n\t\t\treturn false, 0, time.Now(), err\n\t\t}\n\t}\n\tif err := rows.Err(); err != nil {\n\t\treturn false, 0, time.Now(), err\n\t}\n\t// If we got no rows, the session is invalid / expired.\n\tif num_rows == 0 {\n\t\treturn false, 0, time.Now(), nil\n\t}\n\n\t// Otherwise, we got a valid token\n\treturn true, user_id, expire_time, nil\n}", "func (r *RoleV2) GetMaxSessionTTL() Duration {\n\treturn r.Spec.MaxSessionTTL\n}", "func (t *SessionManager) get_guest_session_from_db_by_id(guest_id int64) (exists bool, session string, err error) {\n\n\trow, err := t.db.Query(`\n\t\tSELECT Token\n\t\tFROM GuestSession\n\t\tWHERE Guest_id = ? AND Expires > CURRENT_TIMESTAMP()`, guest_id)\n\tif err != nil {\n\t\treturn false, \"\", err\n\t}\n\tdefer row.Close()\n\t// if err := row.Scan(&session); err != nil {\n\t// \treturn false, \"\", err\n\t// }\n\t// Otherwise, we got a valid token\n\treturn true, session, nil\n}", "func (s *StorageBase) UpdateTTL(ctx context.Context, sessionId string, ttl time.Duration) error {\n\treturn ErrorDisabled\n}", "func (m *SessionManager) UpdateSessionData(sessionID string, data map[string]interface{}) error {\n\t_, ok := m.sessions[sessionID]\n\tif !ok {\n\t\treturn ErrSessionNotFound\n\t}\n\n\t// Hint: you should renew expiry of the session here\n\tm.sessions[sessionID] = Session{\n\t\tData: data,\n\t\tAccessed: time.Now(), // XXX rm\n\t}\n\n\treturn nil\n}", "func FindSessionFunc(fn func(*Session) (match bool, cont bool)) (Sessions, error) {\n\tss, err := ListSessions()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsessions := []*Session{}\n\tfor _, s := range ss {\n\t\tmatch, cont := fn(s)\n\t\tif match {\n\t\t\tsessions = append(sessions, s)\n\t\t}\n\t\tif !cont {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn sessions, nil\n}", "func (e *Exit) HasTimeout() bool {\n\treturn e.timeout != 0\n}", "func (p *AzureProvider) RefreshSessionIfNeeded(s *sessions.SessionState) (bool, error) {\n\tif s != nil {\n\t\tlog.Printf(\"RefreshSessionIfNeeded: refresh_token_len: %d, expires_on: %v, after: %t\", len(s.RefreshToken), s.ExpiresOn, s.ExpiresOn.After(time.Now()))\n\t} else {\n\t\tlog.Println(\"RefreshSessionIfNeeded: session is nil!\")\n\t}\n\tif s == nil || s.ExpiresOn.After(time.Now()) || s.RefreshToken == \"\" {\n\t\tlog.Println(\"RefreshSessionIfNeeded: should not refresh!\")\n\t\treturn false, nil\n\t}\n\n\tnewSession, err := p.redeemRefreshToken(s.RefreshToken)\n\tif err != nil {\n\t\tlogger.Printf(\"AZURE: redeem failed: %v\", err)\n\t\treturn false, err\n\t}\n\n\torigExpiration := s.ExpiresOn\n\ts.AccessToken = newSession.AccessToken\n\ts.RefreshToken = newSession.RefreshToken\n\ts.Email = newSession.Email\n\ts.CreatedAt = newSession.CreatedAt\n\ts.ExpiresOn = newSession.ExpiresOn\n\n\tlogger.Printf(\"AZURE: refreshed access token (expired on %s, next: %s)\", origExpiration, s.ExpiresOn)\n\treturn true, nil\n}", "func SetSessionExpiration(sessionID string, ttl int) error {\n\tkey := stringutil.Build(\"sessionid:\", sessionID, \":userid\")\n\terr := Expire(key, ttl)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot expire key in Redis\")\n\t}\n\treturn nil\n}", "func (handler *IdentityProviderHandler) DeleteSession(sessionID string, userAgent string, remoteAddr string) (r bool, err error) {\n\thandler.log.Printf(\"deleteSession(%v, %v, %v)\", sessionID, userAgent, remoteAddr)\n\n\tsession, err := handler.SessionInteractor.Find(sessionID)\n\tif err != nil {\n\t\te := err.(*errs.Error)\n\t\treturn false, errorToServiceError(e)\n\t}\n\n\tif !session.Domain.Enabled || !session.User.Enabled {\n\t\te := services.NewUnauthorizedError()\n\t\te.Msg = \"Domain and/or user disabled\"\n\t\treturn false, e\n\t}\n\n\tif session.UserAgent != userAgent || session.RemoteAddr != remoteAddr {\n\t\te := services.NewNotFoundError()\n\t\te.Msg = \"Session not found\"\n\t\treturn false, e\n\t}\n\n\tif session.IsExpired() {\n\t\te := services.NewUnauthorizedError()\n\t\te.Msg = \"Session expired\"\n\t\treturn false, e\n\t}\n\n\terr = handler.SessionInteractor.Delete(*session)\n\tif err != nil {\n\t\te := err.(*errs.Error)\n\t\treturn false, errorToServiceError(e)\n\t}\n\n\treturn true, nil\n}" ]
[ "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.5120982", "0.5118237", "0.5110377", "0.50839907", "0.5076811", "0.50696677", "0.505125", "0.50482565", "0.5045304", "0.50214356", "0.5020741", "0.5009413", "0.49915966", "0.49872038", "0.49868345", "0.4969507", "0.49693474", "0.4939926", "0.4926252", "0.49218974", "0.49213776", "0.4908856", "0.48854142", "0.48819375", "0.48725715", "0.48683634", "0.4859952", "0.4819902", "0.48096764", "0.48082858", "0.4807359", "0.47906056", "0.47902298", "0.47683427", "0.47666016", "0.47515488", "0.47511584", "0.47494677", "0.47477007", "0.47388747", "0.47374246", "0.47370815", "0.4731483", "0.47167662", "0.47123536", "0.46922913", "0.4691656", "0.46884426", "0.4688127", "0.4684581", "0.46811578", "0.46766216", "0.46734422", "0.46715042", "0.46621618", "0.46579397", "0.46481356", "0.4642135", "0.46398664", "0.46371245", "0.4633403", "0.46324342", "0.4630877", "0.4628533", "0.46218386", "0.4610215", "0.45934376", "0.4587374", "0.4586292", "0.4583816", "0.4582364", "0.4579872", "0.45787925", "0.45765597", "0.45762116", "0.45760965", "0.45347247", "0.4534415", "0.4534169", "0.45305538" ]
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.CleanupTimer = sessionCtx.Imsi, sessionCtx.CleanupTimer, nil\n\t\t}\n\t}\n\ts.rwl.Unlock()\n\tif timer != nil {\n\t\ttimer.Stop()\n\t}\n\treturn imsi, exist\n}", "func FindSession(name string) (*Session, error) {\n\tss, err := FindSessionFunc(func(s *Session) (match bool, cont bool) {\n\t\treturn s.Name == name, s.Name != name\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(ss) == 0 {\n\t\treturn nil, nil\n\t}\n\n\treturn ss[0], nil\n}", "func (p *PersistentStorage) FindSimSession(simID string) (*SimulatorSession, error) {\n\tdefer func(now time.Time) {\n\t\trequestTime.With(\"method\", findSimSession, \"data_store\", redisStore).Observe(time.Since(now).Seconds() * 1e3)\n\t}(time.Now())\n\n\tkey := fmt.Sprintf(simSessionKeyFmt, simID)\n\tsimSession := new(SimulatorSession)\n\terr := p.getRedisJSON(\"GET\", key, \"\", simSession)\n\tif err != nil {\n\t\tif err == redis.ErrNil {\n\t\t\treturn nil, ErrNoSimSession\n\t\t}\n\n\t\treturn nil, err\n\t}\n\n\treturn simSession, nil\n}", "func (l *localSimHostStorage) FindSimSession(simID string) (*SimulatorSession, error) {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\n\tsimSession, ok := l.simSessions[simID]\n\tif !ok {\n\t\treturn nil, ErrNoSimSession\n\t}\n\treturn simSession, nil\n}", "func FindSession(clientId string) (*Session, error) {\n\tmeta := broker.GetService(ServiceName).(*MetadataService)\n\treturn meta.findSession(clientId)\n}", "func (m *Driver) FindSession(filter *models.SessionFilter) ([]models.Session, error) {\n\t// DB-specific session struct\n\tvar mSesses []Session\n\n\texpression := `^` + filter.Keyword\n\n\tobjectIDStart := bson.NewObjectIdWithTime(filter.TimestampStart)\n\tobjectIDEnd := bson.NewObjectIdWithTime(filter.TimestampEnd)\n\n\t// check whether valid session\n\terr := m.DB.C(\"sessions\").Find(\n\t\tbson.M{\"$and\": []bson.M{\n\t\t\tbson.M{\"keyword\": bson.M{\"$regex\": bson.RegEx{Pattern: expression, Options: \"\"}}},\n\t\t\tbson.M{\"_id\": bson.M{\"$gte\": objectIDStart}},\n\t\t\tbson.M{\"_id\": bson.M{\"$lte\": objectIDEnd}}}}).All(&mSesses)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// transform into DB-neural struct\n\tsesses := make([]models.Session, len(mSesses))\n\tfor i, s := range mSesses {\n\t\tsesses[i] = models.Session{\n\t\t\tID: s.ID.Hex(),\n\t\t\tKeyword: s.Keyword,\n\t\t\tVersion: s.Version,\n\t\t\tTimestamp: s.ID.Time(),\n\t\t\tSchemas: s.Schemas,\n\t\t\tMetadata: s.Metadata,\n\t\t}\n\t}\n\n\treturn sesses, nil\n}", "func FindSessionFunc(fn func(*Session) (match bool, cont bool)) (Sessions, error) {\n\tss, err := ListSessions()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsessions := []*Session{}\n\tfor _, s := range ss {\n\t\tmatch, cont := fn(s)\n\t\tif match {\n\t\t\tsessions = append(sessions, s)\n\t\t}\n\t\tif !cont {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn sessions, nil\n}", "func (pg *PGClient) LookupSession(token string) (*int, error) {\n\tsess := model.Session{}\n\terr := pg.DB.Get(&sess, lookupSession, token)\n\tif err == sql.ErrNoRows {\n\t\treturn nil, ErrSessionNotFound\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sess.TherapistID, nil\n}", "func (m *TestFixClient) WaitForSession(sid string) error {\n\tfound := false\n\tfor i := 0; i < 20; i++ {\n\t\tif session, ok := m.Sessions[sid]; ok {\n\t\t\tif session.LoggedOn {\n\t\t\t\tlog.Printf(\"found session %s\", sid)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tfound = true\n\t\t}\n\t\ttime.Sleep(time.Millisecond * 250)\n\t}\n\tfor _, s := range m.Sessions {\n\t\tlog.Printf(\"test fix client session: %s\", s.ID.String())\n\t}\n\tif found {\n\t\treturn fmt.Errorf(\"session found but not logged on: %s\", sid)\n\t}\n\treturn fmt.Errorf(\"could not find session: %s\", sid)\n}", "func LookupSession(id string) (Account, error) {\n\ts, err := persistenceInstance.session(id)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif time.Now().After(s.expires) {\n\t\tDeleteSession(id)\n\t\treturn nil, errors.New(\"Session Expired\")\n\t}\n\n\treturn s.account, nil\n}", "func findSessionInfoIndex(sessions []model.SessionInfo, sessionInfo model.SessionInfo) int {\n\tfor i := range sessions {\n\t\tif sessions[i].ServerID == sessionInfo.ServerID && sessions[i].SessionID == sessionInfo.SessionID {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func (st *State) Session(id string) *cache.Session {\n\tfor _, s := range st.Sessions() {\n\t\tif s.ID() == id {\n\t\t\treturn s\n\t\t}\n\t}\n\treturn nil\n}", "func FindSessionCookie(cookies []*http.Cookie) *http.Cookie {\n\tfor _, c := range cookies {\n\t\tif c.Name == \"clsession\" {\n\t\t\treturn c\n\t\t}\n\t}\n\n\treturn nil\n}", "func (sr *SessionGormRepo) Session(sessionID string) (*entity.Session, []error) {\n\tsession := entity.Session{}\n\terrs := sr.conn.Find(&session, \"uuid=?\", sessionID).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn &session, errs\n}", "func (r *SmscSessionRepository) FindById(ID string) (*openapi.SmscSession, error) {\n\tentity := openapi.NewSmscSessionWithDefaults()\n\terr := app.BuntDBInMemory.View(func(tx *buntdb.Tx) error {\n\t\tvalue, err := tx.Get(SMSC_SESSION_PREFIX + ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := json.Unmarshal([]byte(value), entity); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n\treturn entity, err\n}", "func FindCounterIdBySession(countersReader *counters.Reader, sessionId int32) int32 {\n\treturn countersReader.FindCounter(RECORDING_POSITION_COUNTER_TYPE_ID, func(keyBuffer *atomic.Buffer) bool {\n\t\treturn keyBuffer.GetInt32(SESSION_ID_OFFSET) == sessionId\n\t})\n}", "func (authSvc *AuthService) identifySession(sessionId string) *apitypes.SessionToken {\n\t\n\tvar credentials *apitypes.Credentials = authSvc.Sessions[sessionId]\n\t\n\tif credentials == nil {\n\t\tfmt.Println(\"No session found for session id\", sessionId)\n\t\treturn nil\n\t}\n\t\n\treturn apitypes.NewSessionToken(sessionId, credentials.UserId)\n}", "func (*adminCtrl) findSessionByID(c *elton.Context) (err error) {\n\tstore := cache.GetRedisSession()\n\tdata, err := store.Get(c.Param(\"id\"))\n\tif err != nil {\n\t\treturn\n\t}\n\tc.Body = &findSessionResp{\n\t\tData: string(data),\n\t}\n\treturn\n}", "func SessionGet(token string) (*Session, bool) {\n\ts, ok := Sessions[token]\n\treturn s, ok\n}", "func (mconn *MConn) Session() (*MSession, error) {\n\t// Start race (waiting-for-binding vs. timeout)\n\tc := make(chan struct{})\n\tgo func() {\n\t\tdefer close(c)\n\t\tmconn.bindWaitGroup.Wait()\n\t\t//TODO: ping to prolong session life? Because session can be aborted\n\t}()\n\tselect {\n\tcase <-c:\n\t\treturn mconn.session, nil\n\tcase <-time.After(TIMEOUT_SESSION_BINDING):\n\t\treturn nil, fmt.Errorf(\"No Session: session binding timeout\")\n\t}\n}", "func returnSessionErr(w http.ResponseWriter, r *http.Request) bool {\n\ts, _ := session.GetCurrentSession(r)\n\treturn s.Active()\n}", "func (s *SessionStore) Find(q *SessionQuery) (*SessionResultSet, error) {\n\trs, err := s.Store.Find(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewSessionResultSet(rs), nil\n}", "func (pder *MemProvider) SessionExist(sid string) bool {\n\tres, _ := (*session.MemProvider)(pder).SessionExist(context.Background(), sid)\n\treturn res\n}", "func (mng *InMemSessManager) OnSessionLookup(key string) (*wwr.Session, error) {\n\tmng.lock.RLock()\n\tdefer mng.lock.RUnlock()\n\tif clt, exists := mng.sessions[key]; exists {\n\t\treturn clt.Session(), nil\n\t}\n\treturn nil, nil\n}", "func (session *SafeSession) Find(keyspace, shard string, tabletType topodatapb.TabletType) int64 {\n\tif session == nil {\n\t\treturn 0\n\t}\n\tsession.mu.Lock()\n\tdefer session.mu.Unlock()\n\tfor _, shardSession := range session.ShardSessions {\n\t\tif keyspace == shardSession.Target.Keyspace && tabletType == shardSession.Target.TabletType && shard == shardSession.Target.Shard {\n\t\t\treturn shardSession.TransactionId\n\t\t}\n\t}\n\treturn 0\n}", "func (srv *server) Session(id string) Session {\n\tsrv.mu.Lock()\n\tdefer srv.mu.Unlock()\n\n\treturn srv.s[id]\n}", "func (cl *APIClient) GetSession() (string, error) {\n\tsessid := cl.socketConfig.GetSession()\n\tif len(sessid) == 0 {\n\t\treturn \"\", errors.New(\"Could not find an active session\")\n\t}\n\treturn sessid, nil\n}", "func (s *SessionManager) ValidateSession(w http.ResponseWriter, r *http.Request) (*SessionInfo, error) {\n\tsession, err := s.Store.Get(r, \"session\")\n\tif err != nil {\n\t\terr = errors.Errorf(errors.CodeUnauthorized, \"Previous session no longer valid: %s\", err)\n\t\tlog.Println(err)\n\t\ts.DeleteSession(w, r)\n\t\tutil.ErrorHandler(err, w)\n\t\treturn nil, err\n\t}\n\tif session.IsNew {\n\t\terr = errors.Errorf(errors.CodeUnauthorized, \"No valid session\")\n\t\tlog.Println(err)\n\t\tutil.ErrorHandler(err, w)\n\t\treturn nil, err\n\t}\n\tvar si SessionInfo\n\tvar exists bool\n\tusername, exists := session.Values[\"username\"]\n\tif !exists || username.(string) == \"\" {\n\t\terr = errors.Errorf(errors.CodeUnauthorized, \"Existing session invalid: (username: %s)\", si.Username)\n\t\tlog.Println(err)\n\t\ts.DeleteSession(w, r)\n\t\tutil.ErrorHandler(err, w)\n\t\treturn nil, err\n\t}\n\tsi.Username = username.(string)\n\tuserID, exists := session.Values[\"user_id\"]\n\tif !exists || userID == nil || userID.(string) == \"\" {\n\t\terr = errors.Errorf(errors.CodeUnauthorized, \"Existing session invalid: (id: %s)\", si.UserID)\n\t\tlog.Println(err)\n\t\ts.DeleteSession(w, r)\n\t\tutil.ErrorHandler(err, w)\n\t\treturn nil, err\n\t}\n\tsi.UserID = userID.(string)\n\treturn &si, nil\n}", "func getSessionStoredInTheWorkItem(workItem messaging.WorkItem) (session *Session, found bool) {\r\n\r\n\tvar sessionKeyStr string\r\n\tsessionKeyStr, found = workItem.GetValues()[\"sessionId\"]\r\n\tif found == false {\r\n\t\treturn\r\n\t}\r\n\tsessionKey, err := strconv.ParseUint(sessionKeyStr, 10, 64)\r\n\tif err == nil {\r\n\t\tsession, err = getSession(sessionKey)\r\n\t}\r\n\tfound = err == nil\r\n\treturn\r\n}", "func (f *Find) Session(session *session.Client) *Find {\n\tif f == nil {\n\t\tf = new(Find)\n\t}\n\n\tf.session = session\n\treturn f\n}", "func GetSession(goRoutine string) (*mgo.Session, error) {\n\tvar err error\n\tdefer helper.CatchPanic(&err, goRoutine, \"GetSession\")\n\thelper.WriteStdout(goRoutine, \"mongo.GetSession\", \"Started\")\n\n\t// Establish a session MongoDB\n\tmongoSession, err := mgo.DialWithInfo(mm.MongoDBDialInfo)\n\tif err != nil {\n\t\thelper.WriteStdoutf(goRoutine, \"mongo.GetSession\", \"ERROR : %s\", err)\n\t\treturn nil, err\n\t}\n\n\t// Reads and writes will always be made to the master server using a\n\t// unique connection so that reads and writes are fully consistent,\n\t// ordered, and observing the most up-to-date data.\n\tmongoSession.SetMode(mgo.Strong, true)\n\n\t// Have the session check for errors.\n\tmongoSession.SetSafe(&mgo.Safe{})\n\n\t// Don't want any longer than 10 second for an operation to complete.\n\tmongoSession.SetSyncTimeout(10 * time.Second)\n\n\thelper.WriteStdout(goRoutine, \"mongo.GetSession\", \"Completed\")\n\treturn mongoSession, err\n}", "func FindPrivateKey(clientID string) (string, *exception.Exception) {\n\texits, ex := redisservice.Exits(clientID)\n\tif ex != nil {\n\t\treturn \"\", ex.ResetCode(1001)\n\t}\n\n\tif !exits {\n\t\treturn \"\", exception.NewException(exception.Error, 1002, \"This client security session was not found.\")\n\t}\n\n\tkey, ex1 := redisservice.Get(clientID)\n\tif ex1 != nil {\n\t\treturn \"\", ex1.ResetCode(1001)\n\t}\n\n\treturn key, nil\n}", "func GetSession(token string) (*Session, bool) {\n\tconst q = `SELECT * FROM Sessions WHERE token=$1 AND expires > now()`\n\n\tsession := &Session{}\n\terr := database.Get(session, q, token)\n\tif err != nil && err != sql.ErrNoRows {\n\t\tpanic(err)\n\t}\n\n\treturn session, err == nil\n}", "func (handler *IdentityProviderHandler) GetSession(sessionID string, userAgent string, remoteAddr string) (r *services.Session, err error) {\n\thandler.log.Printf(\"getSession(%v, %v, %v)\", sessionID, userAgent, remoteAddr)\n\n\tsession, err := handler.SessionInteractor.Find(sessionID)\n\tif err != nil {\n\t\te := err.(*errs.Error)\n\t\treturn nil, errorToServiceError(e)\n\t}\n\n\tif !session.Domain.Enabled || !session.User.Enabled {\n\t\te := services.NewUnauthorizedError()\n\t\te.Msg = \"Domain and/or user disabled\"\n\t\treturn nil, e\n\t}\n\n\tif session.UserAgent != userAgent || session.RemoteAddr != remoteAddr {\n\t\te := services.NewNotFoundError()\n\t\te.Msg = \"Session not found\"\n\t\treturn nil, e\n\t}\n\n\tif session.IsExpired() {\n\t\te := services.NewUnauthorizedError()\n\t\te.Msg = \"Session expired\"\n\t\treturn nil, e\n\t}\n\n\terr = handler.SessionInteractor.Retain(*session)\n\tif err != nil {\n\t\te := err.(*errs.Error)\n\t\treturn nil, errorToServiceError(e)\n\t}\n\n\treturn sessionToResponse(session), nil\n}", "func (ss *SessionServiceImpl) Session(sessionID string) (*entities.Session, []error) {\n\treturn ss.sessionRepo.Session(sessionID)\n}", "func (pdr *ProviderMySQL) SessionExist(sid string) bool {\n\tc := pdr.connectInit()\n\tdefer func() {\n\t\terr := c.Close()\n\t\tif err != nil {\n\t\t\tsession.SLogger.Println(err)\n\t\t}\n\t}()\n\n\trow := c.QueryRow(\"select session_data from \"+TableName+\" where session_key=?\", sid)\n\tvar data []byte\n\terr := row.Scan(&data)\n\treturn err != sql.ErrNoRows\n}", "func (service *SessionService) Session(sessionID string) (*entity.Session, error) {\n\tsess, err := service.conn.Session(sessionID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sess, err\n}", "func IsErrSessionNotFound(err error) bool {\n\t_, ok := err.(ErrSessionNotFound)\n\treturn ok\n}", "func (pder *MemSessionProvider) GetSession(sid string) (Session, error) {\r\n\tpder.lock.RLock()\r\n\tdefer pder.lock.RUnlock()\r\n\r\n\tif element, ok := pder.sessions[sid]; ok {\r\n\t\tsw := element.Value.(Session)\r\n\t\tif sw == nil {\r\n\t\t\treturn nil, nil\r\n\t\t}\r\n\t\tattributes := sw.Attributes().(*MemSessionAttributes)\r\n\t\tif attributes != nil {\r\n\t\t\tattributes.timeAccessed = time.Now()\r\n\t\t}\r\n\t\treturn sw, nil\r\n\t} else {\r\n\t\treturn nil, nil\r\n\t}\r\n}", "func (rp *Provider) SessionExist(ctx context.Context, sid string) (bool, error) {\n\tif ctx == nil {\n\t\tctx = context.TODO()\n\t}\n\treturn rp.c.Contains(ctx, sid), nil\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.sessions, sessionId)\n\t\tif sessionCtx != nil {\n\t\t\timsi, timer, sessionCtx.CleanupTimer, sessionCtx.UserCtx =\n\t\t\t\tsessionCtx.Imsi, sessionCtx.CleanupTimer, nil, nil\n\t\t}\n\t}\n\ts.rwl.Unlock()\n\n\tif timer != nil {\n\t\ttimer.Stop()\n\t}\n\treturn imsi\n}", "func (e TPMFmt1Error) Session() (bool, int) {\n\tif e.subject != sessionRelated {\n\t\treturn false, 0\n\t}\n\treturn true, e.index\n}", "func (s *Server) GetSession(sessionId string) (tp.Session, bool) {\n\treturn s.peer.GetSession(sessionId)\n}", "func (s *State) SessionDone(id string) (<-chan struct{}, error) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tsess, ok := s.sessions[id]\n\tif !ok {\n\t\treturn nil, status.Errorf(codes.NotFound, \"session %q not found\", id)\n\t}\n\treturn sess.Done(), nil\n}", "func (c *connectionService) SessionID() SID {\n\ts := SID(atomic.AddUint32(&c.sid, 1))\n\tg := SID(env.GateID) << gateIDShift\n\treturn g | s\n}", "func (ss *SessionServiceImpl) Session(sessionID string) (*entity.Session, error) {\n\tsess, err := ss.sessionRepo.Session(sessionID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sess, err\n}", "func (mgr *MemorySessionManager) Session(sid string) (Session, error) {\n\tmgr.lock.RLock()\n\tif s, ok := mgr.sessions[sid]; ok {\n\t\ts.createdAt = time.Now()\n\t\tmgr.lock.RUnlock()\n\t\treturn s, nil\n\t}\n\tmgr.lock.RUnlock()\n\treturn nil, fmt.Errorf(\"Can not retrieve session with id %s\", sid)\n}", "func (arr *SRArr) FindSess(sp *SessionPair) (SRNode, error) {\n\tdid := sp.did\n\tfindPos := sort.Search(len(*arr), func(i int) bool {\n\t\treturn (*arr)[i].Did >= did\n\t})\n\n\tif findPos < len(*arr) {\n\t\tfor ; findPos < len(*arr); findPos++ {\n\t\t\tif (*arr)[findPos].SpPtr.SessionID == sp.SessionID {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif findPos < len(*arr) {\n\t\t\treturn (*arr)[findPos], nil\n\t\t} else {\n\t\t\treturn SRNode{}, errors.New(\"no session found\")\n\t\t}\n\t} else {\n\t\treturn SRNode{}, errors.New(\"no session found\")\n\t}\n\n}", "func (image *image) SessionID() int32 {\n\treturn image.sessionID\n}", "func (m *MySQLStore) Find(token string) ([]byte, bool, error) {\n\tvar b []byte\n\trow := m.DB.QueryRow(\"SELECT data FROM sessions WHERE token = ? AND UTC_TIMESTAMP(6) < expiry\", token)\n\terr := row.Scan(&b)\n\tif err == sql.ErrNoRows {\n\t\treturn nil, false, nil\n\t} else if err != nil {\n\t\treturn nil, false, err\n\t}\n\treturn b, true, nil\n}", "func GetSession(token string) (Session, *errors.Error) {\n\tvar session Session\n\tconnPool, err := GetDBConnectionFunc(sessionStore)\n\tif err != nil {\n\t\treturn session, errors.PackError(err.ErrNo(), \"error while trying to connecting to DB: \", err.Error())\n\t}\n\tsessionData, err := connPool.Read(\"session\", token)\n\tif err != nil {\n\t\treturn session, errors.PackError(err.ErrNo(), \"error while trying to get the session from DB: \", err.Error())\n\t}\n\tif jerr := json.Unmarshal([]byte(sessionData), &session); jerr != nil {\n\t\treturn session, errors.PackError(errors.UndefinedErrorType, \"error while trying to unmarshal session data: \", jerr)\n\t}\n\treturn session, nil\n}", "func GetSession(token string) (Session, error) {\n\tif m == nil {\n\t\treturn emptySession(), errors.New(\"Sessions not started\")\n\t}\n\n\tsession, err := m.provider.Read(token)\n\n\tif err != nil {\n\t\treturn emptySession(), err\n\t}\n\n\tsession.lifetime = time.Now().Add(m.maxLifetime) // reset lifetime\n\terr = m.updateSession(&session)\n\n\tif err != nil {\n\t\treturn emptySession(), err\n\t}\n\n\treturn session, nil\n}", "func (m *Driver) GetSession(sessID string) (*models.Session, error) {\n\t// DB-specific session struct\n\tvar mSess Session\n\n\t// check whether valid session ID\n\tif !bson.IsObjectIdHex(sessID) {\n\t\treturn nil, errors.New(\"invalid session id\")\n\t}\n\n\t// lookup the database\n\terr := m.DB.C(sessCol).Find(bson.M{\"_id\": bson.ObjectIdHex(sessID)}).One(&mSess)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsess := &models.Session{\n\t\tID: mSess.ID.Hex(),\n\t\tKeyword: mSess.Keyword,\n\t\tVersion: mSess.Version,\n\t\tTimestamp: mSess.ID.Time(),\n\t\tSchemas: mSess.Schemas,\n\t\tMetadata: mSess.Metadata,\n\t}\n\n\treturn sess, nil\n}", "func (client BastionClient) getSession(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/sessions/{sessionId}\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response GetSessionResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func (xmlmc *XmlmcInstStruct) GetSessionID() string {\n\treturn xmlmc.sessionID\n}", "func SessionExists(SID string) bool {\n\t_, exists := SessionMap[SID]\n\treturn exists\n}", "func (e *Engine) StartSession(ctx context.Context) (types.SessionID, error) {\n\n\tspnResolve, ctx := opentracing.StartSpanFromContext(ctx, \"engine.StartSession\")\n\tdefer spnResolve.Finish()\n\n\tsidStr, err := e.idFactory()\n\tsid := types.SessionID(sidStr)\n\tif err != nil {\n\t\treturn sid, Error{\"generate-id-for-session\", err, \"id factory returned an error when genrating an id\"}\n\t}\n\n\tspnUnmarshal := opentracing.StartSpan(\"marshal start session command from anon struct\", opentracing.ChildOf(spnResolve.Context()))\n\tpath := fmt.Sprintf(\"session/%s\", sid)\n\n\tif e.depot.Exists(types.PartitionName(path)) {\n\t\treturn sid, Error{\"guard-unique-session-id\", err, \"session id was not unique in depot, can't start.\"}\n\t}\n\n\tclaimCtx, cancel := context.WithTimeout(ctx, e.claimTimeout)\n\tdefer cancel()\n\n\te.depot.Claim(claimCtx, path)\n\tdefer e.depot.Release(path)\n\n\tb, err := json.Marshal(struct {\n\t\tPath string `json:\"path\"`\n\t\tCmdName string `json:\"name\"`\n\t}{path, \"Start\"})\n\tif err != nil {\n\t\treturn sid, Error{\"marshal-session-start-cmd\", err, \"can't marshal session start command to JSON for resolver\"}\n\t}\n\tspnUnmarshal.SetTag(\"payload\", string(b))\n\tspnUnmarshal.Finish()\n\n\tsessionStart, err := e.resolver(ctx, e.depot, b)\n\tif err != nil {\n\t\treturn sid, Error{\"resolve-session-start-cmd\", err, \"can't resolve session start command\"}\n\t}\n\n\tsessionStartedEvents, err := sessionStart(ctx, nil, e.depot)\n\tif err != nil {\n\t\treturn sid, Error{\"execute-session-start-cmd\", err, \"error calling session start command\"}\n\t}\n\n\treturn sid, e.persistEvs(path, sessionStartedEvents)\n\n\t// spnAppendEvs, ctx := opentracing.StartSpanFromContext(ctx, \"store generated events in depot\")\n\t// // n, err := e.depot.AppendEvs(path, evs)\n\t// // if n != len(evs) {\n\t// // \treturn sid, Error{\"depot-partial-store\", err, \"depot encountered error storing events for aggregate\"}\n\t// // }\n\t// spnAppendEvs.Finish()\n\n\t// return sid, nil\n}", "func (handler *IdentityProviderHandler) CheckSession(sessionID string, userAgent string, remoteAddr string) (r bool, err error) {\n\thandler.log.Printf(\"checkSession(%v, %v, %v)\", sessionID, userAgent, remoteAddr)\n\n\tsession, err := handler.SessionInteractor.Find(sessionID)\n\tif err != nil {\n\t\te := err.(*errs.Error)\n\t\treturn false, errorToServiceError(e)\n\t}\n\n\tif !session.Domain.Enabled || !session.User.Enabled {\n\t\te := services.NewUnauthorizedError()\n\t\te.Msg = \"Domain and/or user disabled\"\n\t\treturn false, e\n\t}\n\n\tif session.UserAgent != userAgent || session.RemoteAddr != remoteAddr {\n\t\te := services.NewNotFoundError()\n\t\te.Msg = \"Session not found\"\n\t\treturn false, e\n\t}\n\n\tif session.IsExpired() {\n\t\te := services.NewUnauthorizedError()\n\t\te.Msg = \"Session expired\"\n\t\treturn false, e\n\t}\n\n\terr = handler.SessionInteractor.Retain(*session)\n\tif err != nil {\n\t\te := err.(*errs.Error)\n\t\treturn false, errorToServiceError(e)\n\t}\n\n\treturn true, nil\n}", "func (v *Voice) GetSession(guildID discord.GuildID) (*Session, bool) {\n\tv.mapmutex.Lock()\n\tdefer v.mapmutex.Unlock()\n\n\t// For some reason you cannot just put `return v.sessions[]` and return a bool D:\n\tconn, ok := v.sessions[guildID]\n\treturn conn, ok\n}", "func handleSession(wsc *wsClient, icmd interface{}) (interface{}, error) {\n\treturn &btcjson.SessionResult{SessionID: wsc.sessionID}, nil\n}", "func (s *ServerConnection) SessionWhoAmI() (*UserDetails, error) {\n\tdata, err := s.CallRaw(\"Session.whoAmI\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tuserDetails := struct {\n\t\tResult struct {\n\t\t\tUserDetails `json:\"userDetails\"`\n\t\t} `json:\"result\"`\n\t}{}\n\terr = json.Unmarshal(data, &userDetails)\n\treturn &userDetails.Result.UserDetails, err\n}", "func (db *DB) Session(id string) (*Session, error) {\n\tvar s Session\n\tres := db.db.First(&s, \"id = ?\", id)\n\tif res.Error != nil {\n\t\treturn nil, ignoreNotFound(res)\n\t}\n\treturn &s, nil\n}", "func findDashboardSession(username string) (bson.M, error) {\n\n\tlog.Debugf(\"find dashboard session for user %s\", username)\n\tre, err := mongo.FindOneDocument(mongo.STRATUS_DASHBOARD_SESSIONS_COLL,\n\t\tbson.M{\"username\": username})\n\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to find dashboard session. %v\", err)\n\t\treturn nil, err\n\t}\n\n\treturn re, err\n}", "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} else {\n\t\t\toldTimer, oldSession.CleanupTimer = oldSession.CleanupTimer, nil\n\t\t\tnewSession, oldSession.UserCtx = &SessionCtx{UserCtx: oldSession.UserCtx}, nil\n\t\t\ts.sessions[sessionId] = newSession\n\t\t\tnewSession.CleanupTimer = time.AfterFunc(timeout, func() {\n\t\t\t\tsessionTimeoutCleanup(s, sessionId, newSession)\n\t\t\t})\n\t\t}\n\t}\n\ts.rwl.Unlock()\n\n\tif oldTimer != nil {\n\t\toldTimer.Stop()\n\t}\n\treturn exist\n}", "func GetSession() *mgo.Session {\n\tif session == nil {\n\t\tvar err error\n\t\tsession, err = mgo.DialWithInfo(&mgo.DialInfo{\n\t\t\tAddrs: []string{AppConfig.MongoDBHost},\n\t\t\tUsername: AppConfig.DBUser,\n\t\t\tPassword: AppConfig.DBPwd,\n\t\t\tTimeout: 60 * time.Second,\n\t\t})\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"[GetSession]: %s\\n\", err)\n\t\t}\n\t}\n\treturn session\n}", "func (s *service) GetSession(sessionID string) (*Session, []error) {\n\tsess, errs := (*s.repo).GetSession(sessionID)\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\t// use UpdateSession to refresh last access time\n\tsess, errs = s.UpdateSession(sess)\n\tsess.sessionService = s\n\tsess.syncFromArrayToMap()\n\treturn sess, errs\n}", "func (pc *PFCPConnection) ForgetSession(seid SEID) bool {\n\tpc.Lock()\n\tdefer pc.Unlock()\n\t_, found := pc.sessions[seid]\n\tif !found {\n\t\treturn false\n\t}\n\tdelete(pc.sessions, seid)\n\treturn true\n}", "func (wd *remoteWD) SessionID() string {\n\treturn wd.id\n}", "func (a Sessions) FindByName(name string) *Session {\n\tfor _, s := range a {\n\t\tif s.Name == name {\n\t\t\treturn s\n\t\t}\n\t}\n\treturn nil\n}", "func GetSession(sessionID string) (session *Session) {\n\tsession = &Session{ID: sessionID}\n\n\tconn := redisConnPool.Get()\n\tdefer conn.Close()\n\n\tkey := fmt.Sprintf(\"sessions:%s\", sessionID)\n\treply, err := redis.String(conn.Do(\"GET\", key))\n\tif err != nil {\n\t\t// NOTE: This is a normal situation, if the session is not stored in the cache, it will hit this condition.\n\t\treturn\n\t}\n\n\terr = json.Unmarshal([]byte(reply), session)\n\n\treturn\n}", "func (c *Config) Session() (*Session, diag.Diagnostics) {\n\tsess := &Session{\n\t\tjunosIP: c.junosIP,\n\t\tjunosPort: c.junosPort,\n\t\tjunosUserName: c.junosUserName,\n\t\tjunosPassword: c.junosPassword,\n\t\tjunosSSHKeyPEM: c.junosSSHKeyPEM,\n\t\tjunosSSHKeyFile: c.junosSSHKeyFile,\n\t\tjunosKeyPass: c.junosKeyPass,\n\t\tjunosGroupIntDel: c.junosGroupIntDel,\n\t\tjunosLogFile: c.junosDebugNetconfLogPath,\n\t\tjunosSleep: c.junosCmdSleepLock,\n\t\tjunosSleepShort: c.junosCmdSleepShort,\n\t}\n\n\treturn sess, nil\n}", "func GetSession(db *sql.DB, session string) (s Session, err error) {\n\tquery := `\n\t\n\t\tSELECT \n\t\t\tses.[name],\n\t\t\t--sesf.[event_session_id],\n\t\t\t--sesf.[object_id],\n\t\t\t-- sesf.[name],\n\t\t\tCAST(sesf.[value] AS NVARCHAR(1024)) AS [value]\n\t\tFROM sys.server_event_sessions ses \n\t\tJOIN sys.server_event_session_targets sest ON sest.event_session_id = ses.event_session_id\n\t\tJOIN sys.server_event_session_fields sesf ON sesf.event_session_id = ses.event_session_id\n\t\t\t\t\t\t\t\t\t\t\t\tAND sesf.object_id = sest.target_id \n\t\tWHERE\tsesf.[name] = 'filename'\n\t\tAND\t\tses.[name] = ?\n\t`\n\terr = db.QueryRow(query, session).Scan(&s.Name, &s.Filename)\n\tif err != nil {\n\t\treturn s, errors.Wrap(err, \"db.queryrow.scan\")\n\t}\n\n\t// if no extension, add one\n\text := filepath.Ext(s.Filename)\n\tif ext == \"\" {\n\t\ts.Filename += \".xel\"\n\t}\n\n\t// build the wildcard\n\tbasePath := strings.TrimSuffix(s.Filename, path.Ext(s.Filename))\n\ts.WildCard = basePath + \"*\" + path.Ext(s.Filename)\n\n\treturn s, err\n}", "func GetSessionID() {\n\thash := getMD5Hash(DevID + \"createsession\" + AuthKey + getTimestamp())\n\turl := \"http://api.smitegame.com/smiteapi.svc/createsessionJson/\" + DevID + \"/\" + hash + \"/\" + getTimestamp()\n\n\tresponse, err := http.Get(url)\n\tif err != nil {\n\t\tperror(err)\n\t} else {\n\t\tdefer response.Body.Close()\n\t\tcontents, err := ioutil.ReadAll(response.Body)\n\t\tif err != nil {\n\t\t\tperror(err)\n\t\t} else {\n\t\t\tvar session session\n\t\t\tjson.Unmarshal(contents, &session)\n\t\t\tSessionID = session.SessionID\n\t\t}\n\t}\n}", "func LoginIScsiTargetEx(targetName string, initiatorInstance string, initiatorPortNumber uint32, targetPortal *ISCSI_TARGET_PORTAL, headerDigest ISCSI_DIGEST_TYPES, dataDigest ISCSI_DIGEST_TYPES, chapUsername string, chapPassword string, isPersistent bool) (uniqueSessionID *ISCSI_UNIQUE_SESSION_ID, uniqueConnectionID *ISCSI_UNIQUE_CONNECTION_ID, err error) {\n\tlog.Trace(\">>>>> LoginIScsiTargetEx\")\n\tdefer log.Trace(\"<<<<< LoginIScsiTargetEx\")\n\n\t// Start by calling our base loginIScsiTarget routine with \"isPersistent\" set to false. We do this\n\t// so that we actually make a connection. If we set \"isPersistent\" to true, it would just make a\n\t// persistent connection without actually logging into the target.\n\tuniqueSessionID, uniqueConnectionID, err = loginIScsiTarget(targetName, initiatorInstance, initiatorPortNumber, targetPortal, headerDigest, dataDigest, chapUsername, chapPassword, false)\n\n\t// If the connection was successful, and \"isPersistent\" was set to true, now try to make it a\n\t// persistent connection.\n\tif (err == nil) && isPersistent {\n\n\t\t// NWT-3305: One second delay before setting persistent connection to work around Windows API issue\n\t\ttime.Sleep(1000 * time.Millisecond)\n\n\t\t// Now make the persistent connection. We don't do anything with the error should it occur. The\n\t\t// routine we're calling will log the error in the unlikely event it does occur. The more critical\n\t\t// task, that of logging into the target, was successful.\n\t\tloginIScsiTarget(targetName, initiatorInstance, initiatorPortNumber, targetPortal, headerDigest, dataDigest, chapUsername, chapPassword, true)\n\t}\n\n\treturn uniqueSessionID, uniqueConnectionID, err\n}", "func ExampleDeviceFarm_GetRemoteAccessSession_shared00() {\n\tsvc := devicefarm.New(session.New())\n\tinput := &devicefarm.GetRemoteAccessSessionInput{\n\t\tArn: aws.String(\"arn:aws:devicefarm:us-west-2:123456789101:session:EXAMPLE-GUID-123-456\"),\n\t}\n\n\tresult, err := svc.GetRemoteAccessSession(input)\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\n\t\t\tcase devicefarm.ErrCodeArgumentException:\n\t\t\t\tfmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error())\n\t\t\tcase devicefarm.ErrCodeNotFoundException:\n\t\t\t\tfmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error())\n\t\t\tcase devicefarm.ErrCodeLimitExceededException:\n\t\t\t\tfmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error())\n\t\t\tcase devicefarm.ErrCodeServiceAccountException:\n\t\t\t\tfmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error())\n\t\t\tdefault:\n\t\t\t\tfmt.Println(aerr.Error())\n\t\t\t}\n\t\t} else {\n\t\t\t// Print the error, cast err to awserr.Error to get the Code and\n\t\t\t// Message from an error.\n\t\t\tfmt.Println(err.Error())\n\t\t}\n\t\treturn\n\t}\n\n\tfmt.Println(result)\n}", "func NewUpdateSessionNotFound() *UpdateSessionNotFound {\n\treturn &UpdateSessionNotFound{}\n}", "func (oc *Client) validateSession(loginDetails *creds.LoginDetails) error {\n\tlogger.Debug(\"validate session func called\")\n\n\tif loginDetails == nil {\n\t\tlogger.Debug(\"unable to validate the okta session, nil input\")\n\t\treturn fmt.Errorf(\"unable to validate the okta session, nil input\")\n\t}\n\n\tsessionCookie := loginDetails.OktaSessionCookie\n\n\toktaURL, err := url.Parse(loginDetails.URL)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error building oktaURL\")\n\t}\n\n\toktaOrgHost := oktaURL.Host\n\n\tsessionReqURL := fmt.Sprintf(\"https://%s/api/v1/sessions/me\", oktaOrgHost) // This api endpoint returns user details\n\tsessionReqBody := new(bytes.Buffer)\n\n\treq, err := http.NewRequest(\"GET\", sessionReqURL, sessionReqBody)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error building new session request\")\n\t}\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Accept\", \"application/json\")\n\treq.Header.Add(\"Cookie\", fmt.Sprintf(\"sid=%s\", sessionCookie))\n\n\tres, err := oc.client.Do(req)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error retrieving session response\")\n\t}\n\n\tbody, err := io.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error retrieving body from response\")\n\t}\n\n\tresp := string(body)\n\n\tif res.StatusCode != 200 {\n\t\tlogger.Debug(\"invalid okta session\")\n\t\treturn fmt.Errorf(\"invalid okta session\")\n\t} else {\n\t\tsessionResponseStatus := gjson.Get(resp, \"status\").String()\n\t\tswitch sessionResponseStatus {\n\t\tcase \"ACTIVE\":\n\t\t\tlogger.Debug(\"okta session established\")\n\t\tcase \"MFA_REQUIRED\":\n\t\t\t_, err := verifyMfa(oc, oktaOrgHost, loginDetails, resp)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"error verifying MFA\")\n\t\t\t}\n\t\tcase \"MFA_ENROLL\":\n\t\t\t// Not yet fully implemented, so just return the status as the error string...\n\t\t\treturn fmt.Errorf(\"MFA_ENROLL\")\n\t\t}\n\t}\n\n\tlogger.Debug(\"valid okta session\")\n\treturn nil\n}", "func (db *MongoDB) GetUserSession(id string) (*UserSession, error) {\n\tresult := db.instance.Collection(sessionCollection).FindOne(context.Background(), bson.M{\"sid\": id})\n\tif result.Err() != nil {\n\t\tif result.Err() == mongo.ErrNoDocuments {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, result.Err()\n\t}\n\tvar session UserSession\n\tif err := result.Decode(&session); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &session, nil\n}", "func (me *Server) FindStream(appName string, instName string, name string) *Stream {\n\tme.mtx.RLock()\n\tdefer me.mtx.RUnlock()\n\n\tapp, ok := me.applications[appName]\n\tif ok {\n\t\treturn app.FindStream(instName, name)\n\t}\n\n\treturn nil\n}", "func (a *Account) GetSession() (*Session, bool, error) {\n\tif a.Session != nil && !a.Session.IsExpired() {\n\t\tif a.Session.IsValid() {\n\t\t\treturn a.Session, false, nil\n\t\t} else {\n\t\t\treturn nil, false, fmt.Errorf(\"session is not valid!\")\n\t\t}\n\t}\n\n\tsessIDBytes, err := hash.GenerateRandomBytes(SessionIDBytes)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\ta.Session = &Session{\n\t\tSessionID: hex.EncodeToString(sessIDBytes),\n\t\tSessionStart: time.Now(),\n\t}\n\treturn a.Session, true, nil\n}", "func (s *SessionStore) FindOne(q *SessionQuery) (*Session, error) {\n\tq.Limit(1)\n\tq.Offset(0)\n\trs, err := s.Find(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !rs.Next() {\n\t\treturn nil, kallax.ErrNotFound\n\t}\n\n\trecord, err := rs.Get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := rs.Close(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn record, nil\n}", "func (k Keeper) Sessions(c context.Context, req *types.SessionsRequest) (*types.SessionsResponse, error) {\n\tdefer telemetry.MeasureSince(time.Now(), types.ModuleName, \"query\", \"Sessions\")\n\tif req == nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"empty request\")\n\t}\n\n\tretval := types.SessionsResponse{Request: req}\n\n\tctx := sdk.UnwrapSDKContext(c)\n\n\tvar scopeAddr, sessionAddr, recordAddr types.MetadataAddress\n\n\tif len(req.ScopeId) > 0 {\n\t\tvar err error\n\t\tscopeAddr, err = ParseScopeID(req.ScopeId)\n\t\tif err != nil {\n\t\t\treturn &retval, status.Error(codes.InvalidArgument, err.Error())\n\t\t}\n\t}\n\tif len(req.RecordAddr) > 0 {\n\t\tvar err error\n\t\trecordAddr, err = ParseRecordAddr(req.RecordAddr)\n\t\tif err != nil {\n\t\t\treturn &retval, status.Error(codes.InvalidArgument, err.Error())\n\t\t}\n\t\tscopeAddr2 := recordAddr.MustGetAsScopeAddress()\n\t\tif scopeAddr.Empty() {\n\t\t\tscopeAddr = scopeAddr2\n\t\t} else if !scopeAddr.Equals(scopeAddr2) {\n\t\t\treturn &retval, status.Errorf(codes.InvalidArgument, \"record %s is not part of scope %s\", recordAddr, scopeAddr)\n\t\t}\n\t}\n\tif len(req.SessionId) > 0 {\n\t\tvar err error\n\t\tscopeIDForParsing := req.ScopeId\n\t\tif len(scopeIDForParsing) == 0 && !scopeAddr.Empty() {\n\t\t\tscopeIDForParsing = scopeAddr.String()\n\t\t}\n\t\tsessionAddr, err = ParseSessionID(scopeIDForParsing, req.SessionId)\n\t\tif err != nil {\n\t\t\treturn &retval, status.Error(codes.InvalidArgument, err.Error())\n\t\t}\n\t\t// ParseSessionID ensures that this will not return an error.\n\t\tscopeAddr2 := sessionAddr.MustGetAsScopeAddress()\n\t\tswitch {\n\t\tcase !recordAddr.Empty():\n\t\t\t// This assumes that we have checked and set scopeAddr while processing the recordAddr.\n\t\t\tscopeAddr3 := recordAddr.MustGetAsScopeAddress()\n\t\t\tif !scopeAddr2.Equals(scopeAddr3) {\n\t\t\t\treturn &retval, status.Errorf(codes.InvalidArgument, \"session %s and record %s are not associated with the same scope\", sessionAddr, recordAddr)\n\t\t\t}\n\t\tcase scopeAddr.Empty():\n\t\t\tscopeAddr = scopeAddr2\n\t\tcase !scopeAddr.Equals(scopeAddr2):\n\t\t\treturn &retval, status.Errorf(codes.InvalidArgument, \"session %s is not part of scope %s\", recordAddr, scopeAddr)\n\t\t}\n\t}\n\tif len(req.RecordName) > 0 {\n\t\tif scopeAddr.Empty() {\n\t\t\t// assumes scopeAddr is set previously while parsing other input.\n\t\t\treturn &retval, status.Error(codes.InvalidArgument, \"a scope is required to look up sessions by record name\")\n\t\t}\n\t\t// We know that scopeAddr is legit, and that we have a name. So this won't give an error.\n\t\trecordAddr2 := scopeAddr.MustGetAsRecordAddress(req.RecordName)\n\t\tif recordAddr.Empty() {\n\t\t\trecordAddr = recordAddr2\n\t\t} else if !recordAddr.Equals(recordAddr2) {\n\t\t\treturn &retval, status.Errorf(codes.InvalidArgument, \"record %s does not have name %s\", recordAddr, req.RecordName)\n\t\t}\n\t}\n\n\t// If a record was identified in the search, we need to get it and either use it to set the sessionAddr,\n\t// or make sure the provided sessionAddr matches what the record has.\n\tif !recordAddr.Empty() {\n\t\trecord, found := k.GetRecord(ctx, recordAddr)\n\t\tswitch {\n\t\tcase !found:\n\t\t\treturn &retval, status.Errorf(codes.InvalidArgument, \"record %s does not exist\", recordAddr)\n\t\tcase !sessionAddr.Empty():\n\t\t\tif !sessionAddr.Equals(record.SessionId) {\n\t\t\t\treturn &retval, status.Errorf(codes.InvalidArgument, \"record %s belongs to session %s (not %s)\",\n\t\t\t\t\trecordAddr, record.SessionId, sessionAddr)\n\t\t\t}\n\t\tdefault:\n\t\t\tsessionAddr = record.SessionId\n\t\t}\n\t}\n\n\t// Get all the sessions based on the input, and set things up for extra info.\n\tswitch {\n\tcase !sessionAddr.Empty():\n\t\tsession, found := k.GetSession(ctx, sessionAddr)\n\t\tif found {\n\t\t\tretval.Sessions = append(retval.Sessions, types.WrapSession(&session))\n\t\t} else {\n\t\t\tretval.Sessions = append(retval.Sessions, types.WrapSessionNotFound(sessionAddr))\n\t\t}\n\tcase !scopeAddr.Empty():\n\t\titErr := k.IterateSessions(ctx, scopeAddr, func(s types.Session) (stop bool) {\n\t\t\tretval.Sessions = append(retval.Sessions, types.WrapSession(&s))\n\t\t\treturn false\n\t\t})\n\t\tif itErr != nil {\n\t\t\treturn &retval, status.Error(codes.Unavailable, fmt.Sprintf(\"error getting sessions for scope with address %s\", scopeAddr))\n\t\t}\n\tdefault:\n\t\treturn &retval, status.Error(codes.InvalidArgument, \"empty request parameters\")\n\t}\n\n\tif req.IncludeScope {\n\t\tscope, found := k.GetScope(ctx, scopeAddr)\n\t\tif found {\n\t\t\tretval.Scope = types.WrapScope(&scope)\n\t\t} else {\n\t\t\tretval.Scope = types.WrapScopeNotFound(scopeAddr)\n\t\t}\n\t}\n\n\tif req.IncludeRecords {\n\t\t// Get all the session ids\n\t\tsessionAddrs := []types.MetadataAddress{}\n\t\tfor _, s := range retval.Sessions {\n\t\t\tif s.Session != nil {\n\t\t\t\tsessionAddrs = append(sessionAddrs, s.Session.SessionId)\n\t\t\t}\n\t\t}\n\t\t// Iterate the records for the whole scope, and just keep the ones for our sessions.\n\t\terr := k.IterateRecords(ctx, scopeAddr, func(r types.Record) (stop bool) {\n\t\t\tkeep := false\n\t\t\tfor _, a := range sessionAddrs {\n\t\t\t\tif r.SessionId.Equals(a) {\n\t\t\t\t\tkeep = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif keep {\n\t\t\t\tretval.Records = append(retval.Records, types.WrapRecord(&r))\n\t\t\t}\n\t\t\treturn false\n\t\t})\n\t\tif err != nil {\n\t\t\treturn &retval, status.Errorf(codes.Unavailable, \"error iterating scope [%s] records: %s\", scopeAddr, err.Error())\n\t\t}\n\t}\n\n\treturn &retval, nil\n}", "func (l *RemoteProvider) GetSession(req *http.Request) error {\n\tts, err := l.GetToken(req)\n\tif err != nil || ts == \"\" {\n\t\tlogrus.Infof(\"session not found\")\n\t\treturn err\n\t}\n\n\t_, err = l.VerifyToken(ts)\n\tif err != nil {\n\t\tlogrus.Infof(\"Token validation error : %v\", err.Error())\n\t\tnewts, err := l.refreshToken(ts)\n\t\tif err != nil {\n\t\t\treturn ErrTokenRefresh(err)\n\t\t}\n\t\t_, err = l.VerifyToken(newts)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"Validation of refreshed token failed : %v\", err.Error())\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (n *Network) GetSession(idx uint16) *Session {\n\tn.lock.RLock()\n\tfor _, value := range n.clients {\n\t\tif value.UserIdx == idx {\n\t\t\tn.lock.RUnlock()\n\t\t\treturn value\n\t\t}\n\t}\n\tn.lock.RUnlock()\n\n\treturn nil\n}", "func (c *FakeZkConn) SessionID() int64 {\n\tc.history.addToHistory(\"SessionID\")\n\treturn int64(0)\n}", "func (c _StoreImpl) Session_BySessionUuid(SessionUuid string) (*Session, bool) {\n\to, ok := RowCacheIndex.Get(\"Session_SessionUuid2:\" + fmt.Sprintf(\"%v\", SessionUuid))\n\tif ok {\n\t\tif obj, ok := o.(*Session); ok {\n\t\t\treturn obj, true\n\t\t}\n\t}\n\n\trow, err := NewSession_Selector().SessionUuid_Eq(SessionUuid).GetRow(base.DB)\n\tif err == nil {\n\t\tRowCacheIndex.Set(\"Session_SessionUuid2:\"+fmt.Sprintf(\"%v\", row.SessionUuid), row, 0)\n\t\treturn row, true\n\t}\n\n\tXOLogErr(err)\n\treturn nil, false\n}", "func (t *SessionManager) get_session_from_db(session_uuid string) (exists bool, user_id int64, expire_time time.Time, err error) {\n\n\trows, err := t.db.Query(`\n\t\tSELECT User_id, Expire_time\n\t\tFROM UserSession\n\t\tWHERE Token = ? AND Expire_time > CURRENT_TIMESTAMP()`, session_uuid)\n\tif err != nil {\n\t\treturn false, 0, time.Now(), err\n\t}\n\tdefer rows.Close()\n\n\tnum_rows := 0\n\tfor rows.Next() {\n\t\tnum_rows++\n\t\tif err := rows.Scan(&user_id, &expire_time); err != nil {\n\t\t\treturn false, 0, time.Now(), err\n\t\t}\n\t}\n\tif err := rows.Err(); err != nil {\n\t\treturn false, 0, time.Now(), err\n\t}\n\t// If we got no rows, the session is invalid / expired.\n\tif num_rows == 0 {\n\t\treturn false, 0, time.Now(), nil\n\t}\n\n\t// Otherwise, we got a valid token\n\treturn true, user_id, expire_time, nil\n}", "func (sc *Client) getSession(sessionId int) *clientSession {\n\tif sessionId < 0 {\n\t\treturn nil\n\t}\n\tc := make(chan *clientSession)\n\trequest := getSessionInfo{sessionId, c}\n\tselect {\n\tcase sc.getSessionChan <- request:\n\tcase <-sc.quit:\n\t\treturn nil\n\t}\n\tsession := <-c\n\treturn session\n}", "func RetrieveSession(c *gin.Context) {\n\tcode := c.Param(\"code\")\n\tsession, err := FindSessionForCode(&Session{Code: code})\n\tif err != nil {\n\t\tc.JSON(http.StatusNotFound, common.NewError(\"session\", errors.New(\"Invalid session code\")))\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, session)\n}", "func (t *Cases) FindBySessionID(sessionID string) []models.Case {\n\tvar cases []models.Case\n\n\tquery := func(db *gorm.DB) {\n\t\tdb.Where(&models.Case{SessionID: sessionID}).Find(&cases)\n\t}\n\n\terror := t.context.Execute(query)\n\n\tif error != nil {\n\t\treturn nil\n\t}\n\n\treturn cases\n}", "func (sm *SessionMap) Get(sessionID string) (*Session, bool) {\n\tsm.Lock.RLock()\n\tdefer sm.Lock.RUnlock()\n\n\tsession, ok := sm.Sessions[sessionID]\n\treturn session, ok\n}", "func (t *SessionManager) GetSession(session_uuid string) (session *Session, err error) {\n\terr = nil\n\n\t// If it wasn't loaded into the cache, check if it's in the database.\n\tin_db, uid, expires, err := t.get_session_from_db(session_uuid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif in_db {\n\t\t// Load the session back into the cache and return it\n\t\tUserSession := new(Session)\n\t\tUserSession.User, err = GetUserById(t.db, uid)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tUserSession.Expires = expires\n\t\treturn UserSession, nil\n\t}\n\t// If it isn't in cache or DB, return false.\n\treturn nil, errors.New(\"Could not locate session in DB\")\n}", "func GetSession(cm *kuberlogicv1.KuberLogicService, client kubernetes.Interface, db string) (session interfaces.Session, err error) {\n\top, err := GetCluster(cm)\n\tif err != nil {\n\t\treturn\n\t}\n\tsession, err = op.GetSession(cm, client, db)\n\treturn\n}", "func (a *Client) GetSessionInfo(params *GetSessionInfoParams) (*GetSessionInfoOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetSessionInfoParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getSessionInfo\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/SessionService/Sessions/{identifier}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &GetSessionInfoReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetSessionInfoOK), nil\n\n}", "func (gs *Service) IsSessionCreated(_ context.Context, req *api.IsSessionCreatedRequest, rsp *api.IsSessionCreatedResponse) error {\n\trsp.IsRunning = 2 // Stands for false.\n\tfor _, value := range gs.sessions {\n\t\tif value.currentGameID == req.GameId {\n\t\t\trsp.IsRunning = 1\n\t\t\trsp.SessionId = value.sessionID\n\t\t\trsp.ChatSocketAddress = value.chatAddress\n\t\t\trsp.SessionSocketAddress = value.sessionAddress\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (s *Server) FindChannel(n string) (ChannelInterface, error) {\n ch, ok := s.Channels.Load(n)\n\n if !ok {\n return &Channel{}, errors.New(\"channel \" + n + \" does not exist\")\n }\n\n return ch.(ChannelInterface), nil\n}", "func New(conn *grpc.ClientConn, tracer stdopentracing.Tracer, logger log.Logger, opts ...Option) Service {\n\tclientOpts := &options{\n\t\tlimiterRate: 100,\n\t\tlimiterCapacity: 100,\n\t}\n\tfor _, opt := range opts {\n\t\topt(clientOpts)\n\t}\n\tlimiter := ratelimit.NewTokenBucketLimiter(jujuratelimit.NewBucketWithRate(clientOpts.limiterRate, clientOpts.limiterCapacity))\n\tcircuitbreaker := circuitbreaker.Gobreaker(gobreaker.NewCircuitBreaker(gobreaker.Settings{Name: \"SessionManagement\"}))\n\tvar createSessionEndpoint endpoint.Endpoint\n\t{\n\t\tcreateSessionEndpoint = grpctransport.NewClient(\n\t\t\tconn,\n\t\t\t\"SessionManagement\",\n\t\t\t\"CreateSession\",\n\t\t\tnoop,\n\t\t\tnoop,\n\t\t\tpb.CreateSessionReply{},\n\t\t\tgrpctransport.ClientBefore(kitty.ToGRPCRequest(tracer, logger)),\n\t\t).Endpoint()\n\t\tcreateSessionEndpoint = opentracing.TraceClient(tracer, \"Create session\")(createSessionEndpoint)\n\t\tcreateSessionEndpoint = kitty.EndpointTracingMiddleware(createSessionEndpoint)\n\t\tcreateSessionEndpoint = limiter(createSessionEndpoint)\n\t\tcreateSessionEndpoint = circuitbreaker(createSessionEndpoint)\n\t}\n\tvar findSessionByTokenEndpoint endpoint.Endpoint\n\t{\n\t\tfindSessionByTokenEndpoint = grpctransport.NewClient(\n\t\t\tconn,\n\t\t\t\"SessionManagement\",\n\t\t\t\"FindSessionByToken\",\n\t\t\tnoop,\n\t\t\tnoop,\n\t\t\tpb.FindSessionByTokenReply{},\n\t\t\tgrpctransport.ClientBefore(kitty.ToGRPCRequest(tracer, logger)),\n\t\t).Endpoint()\n\t\tfindSessionByTokenEndpoint = opentracing.TraceClient(tracer, \"Find session by token\")(findSessionByTokenEndpoint)\n\t\tfindSessionByTokenEndpoint = kitty.EndpointTracingMiddleware(findSessionByTokenEndpoint)\n\t\tfindSessionByTokenEndpoint = limiter(findSessionByTokenEndpoint)\n\t\tfindSessionByTokenEndpoint = circuitbreaker(findSessionByTokenEndpoint)\n\t}\n\tvar deleteSessionByTokenEndpoint endpoint.Endpoint\n\t{\n\t\tdeleteSessionByTokenEndpoint = grpctransport.NewClient(\n\t\t\tconn,\n\t\t\t\"SessionManagement\",\n\t\t\t\"DeleteSessionByToken\",\n\t\t\tnoop,\n\t\t\tnoop,\n\t\t\tpb.DeleteSessionByTokenReply{},\n\t\t\tgrpctransport.ClientBefore(kitty.ToGRPCRequest(tracer, logger)),\n\t\t).Endpoint()\n\t\tdeleteSessionByTokenEndpoint = opentracing.TraceClient(tracer, \"Delete session by token\")(deleteSessionByTokenEndpoint)\n\t\tdeleteSessionByTokenEndpoint = kitty.EndpointTracingMiddleware(deleteSessionByTokenEndpoint)\n\t\tdeleteSessionByTokenEndpoint = limiter(deleteSessionByTokenEndpoint)\n\t\tdeleteSessionByTokenEndpoint = circuitbreaker(deleteSessionByTokenEndpoint)\n\t}\n\tvar deleteSessionsByOwnerTokenEndpoint endpoint.Endpoint\n\t{\n\t\tdeleteSessionsByOwnerTokenEndpoint = grpctransport.NewClient(\n\t\t\tconn,\n\t\t\t\"SessionManagement\",\n\t\t\t\"DeleteSessionsByOwnerToken\",\n\t\t\tnoop,\n\t\t\tnoop,\n\t\t\tpb.DeleteSessionsByOwnerTokenReply{},\n\t\t\tgrpctransport.ClientBefore(kitty.ToGRPCRequest(tracer, logger)),\n\t\t).Endpoint()\n\t\tdeleteSessionsByOwnerTokenEndpoint = opentracing.TraceClient(tracer, \"Delete sessions by owner token\")(deleteSessionsByOwnerTokenEndpoint)\n\t\tdeleteSessionsByOwnerTokenEndpoint = kitty.EndpointTracingMiddleware(deleteSessionsByOwnerTokenEndpoint)\n\t\tdeleteSessionsByOwnerTokenEndpoint = limiter(deleteSessionsByOwnerTokenEndpoint)\n\t\tdeleteSessionsByOwnerTokenEndpoint = circuitbreaker(deleteSessionsByOwnerTokenEndpoint)\n\t}\n\n\treturn Endpoints{\n\t\tCreateSessionEndpoint: createSessionEndpoint,\n\t\tFindSessionByTokenEndpoint: findSessionByTokenEndpoint,\n\t\tDeleteSessionByTokenEndpoint: deleteSessionByTokenEndpoint,\n\t\tDeleteSessionsByOwnerTokenEndpoint: deleteSessionsByOwnerTokenEndpoint,\n\t}\n}", "func (pdr *ProviderMySQL) SessionRead(sid string) (session.Store, error) {\n\tc := pdr.connectInit()\n\trow := c.QueryRow(\"select session_data from \"+TableName+\" where session_key=?\", sid)\n\tvar data []byte\n\terr := row.Scan(&data)\n\t//if err == sql.ErrNoRows {\n\t//\tconn.Exec(\"insert into \"+TableName+\"(`session_key`,`session_data`,`session_expiry`) values(?,?,?)\",\n\t//\t\tsid, \"\", time.Now().Unix())\n\t//}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar kv map[interface{}]interface{}\n\tif len(data) == 0 {\n\t\tkv = make(map[interface{}]interface{})\n\t} else {\n\t\tkv, err = session.DecodeGob(data)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\trs := &SessionStoreMySQL{conn: c, sid: sid, values: kv}\n\treturn rs, nil\n}", "func SessionStart(w http.ResponseWriter, r *http.Request) *Session {\n\tSessionMapLock.Lock()\n\tdefer SessionMapLock.Unlock()\n\n\tSID, err := GetCookieValue(r, \"OG_SESSION_ID\")\n\tif err != nil || SID == \"\" || !SessionExists(SID) {\n\t\toldSID := SID\n\t\ttaken := true\n\t\tfor taken {\n\t\t\tSID = GetRandomString(64)\n\t\t\t_, taken = SessionMap[SID]\n\t\t}\n\n\t\tlogging.Debug(&map[string]string{\n\t\t\t\"file\": \"session.go\",\n\t\t\t\"Function\": \"SessionStart\",\n\t\t\t\"event\": \"Create session\",\n\t\t\t\"old_SID\": oldSID,\n\t\t\t\"new_SID\": SID,\n\t\t})\n\n\t\tSetCookie(w, \"OG_SESSION_ID\", SID, http.SameSiteStrictMode, time.Duration(config.SessionLifetime))\n\n\t\tsession := Session{\n\t\t\tSID: SID,\n\t\t\tTimeAccessed: time.Now(),\n\t\t\tValues: make(map[string]interface{}),\n\t\t}\n\n\t\tSessionMap[SID] = &session\n\t\treturn &session\n\t}\n\n\tlogging.Debug(&map[string]string{\n\t\t\"file\": \"session.go\",\n\t\t\"Function\": \"SessionStart\",\n\t\t\"event\": \"Use existing session\",\n\t\t\"SID\": SID,\n\t})\n\tSessionMap[SID].Used(w)\n\treturn SessionMap[SID]\n}", "func findServiceNode(data proto.FindServiceParams) (interface{}, *nprotoo.Error) {\n\tservice := data.Service\n\tmid := data.MID\n\trid := data.RID\n\n\tif mid != \"\" {\n\t\tmkey := proto.MediaInfo{\n\t\t\tDC: dc,\n\t\t\tRID: rid,\n\t\t}.BuildKey()\n\t\tlog.Infof(\"Find mids by mkey %s\", mkey)\n\t\tfor _, key := range redis.Keys(mkey + \"*\") {\n\t\t\tlog.Infof(\"Got: key => %s\", key)\n\t\t\tminfo, err := proto.ParseMediaInfo(key)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfor _, node := range services {\n\t\t\t\tname := node.Info[\"name\"]\n\t\t\t\tid := node.Info[\"id\"]\n\t\t\t\tif service == node.Info[\"service\"] && minfo.NID == id {\n\t\t\t\t\trpcID := discovery.GetRPCChannel(node)\n\t\t\t\t\teventID := discovery.GetEventChannel(node)\n\t\t\t\t\tresp := proto.GetSFURPCParams{Name: name, RPCID: rpcID, EventID: eventID, Service: service, ID: id}\n\t\t\t\t\tlog.Infof(\"findServiceNode: by node ID %s, [%s] %s => %s\", minfo.NID, service, name, rpcID)\n\t\t\t\t\treturn resp, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// If we don't have a MID, we must place the stream in a room\n\t// This mutex prevents a race condition which could cause\n\t// rooms to split between SFU's\n\troomMutex.Lock()\n\tdefer roomMutex.Unlock()\n\n\t// When we have a RID check for other pubs to colocate streams\n\tif rid != \"\" {\n\t\tlog.Infof(\"findServiceNode: got room id: %s, checking for existing streams\", rid)\n\t\trid := data.RID //util.Val(data, \"rid\")\n\t\tkey := proto.MediaInfo{\n\t\t\tDC: dc,\n\t\t\tRID: rid,\n\t\t}.BuildKey()\n\t\tlog.Infof(\"findServiceNode: RID root key=%s\", key)\n\n\t\tfor _, path := range redis.Keys(key + \"*\") {\n\n\t\t\tlog.Infof(\"findServiceNode media info path = %s\", path)\n\t\t\tminfo, err := proto.ParseMediaInfo(path)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Error parsing media info = %v\", err)\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tfor _, node := range services {\n\t\t\t\tname := node.Info[\"name\"]\n\t\t\t\tid := node.Info[\"id\"]\n\t\t\t\tif service == node.Info[\"service\"] && minfo.NID == id {\n\t\t\t\t\trpcID := discovery.GetRPCChannel(node)\n\t\t\t\t\teventID := discovery.GetEventChannel(node)\n\t\t\t\t\tresp := proto.GetSFURPCParams{Name: name, RPCID: rpcID, EventID: eventID, Service: service, ID: id}\n\t\t\t\t\tlog.Infof(\"findServiceNode: by node ID %s, [%s] %s => %s\", minfo.NID, service, name, rpcID)\n\t\t\t\t\treturn resp, nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n\n\t// MID/RID Doesn't exist in Redis\n\t// Find least packed SFU to return\n\tsfuID := \"\"\n\tminStreamCount := math.MaxInt32\n\tfor _, sfu := range services {\n\t\tif service == sfu.Info[\"service\"] {\n\t\t\t// get stream count\n\t\t\tsfuKey := proto.MediaInfo{\n\t\t\t\tDC: dc,\n\t\t\t\tNID: sfu.Info[\"id\"],\n\t\t\t}.BuildKey()\n\t\t\tstreamCount := len(redis.Keys(sfuKey))\n\n\t\t\tlog.Infof(\"findServiceNode looking up sfu stream count [%s] = %v\", sfuKey, streamCount)\n\t\t\tif streamCount <= minStreamCount {\n\t\t\t\tsfuID = sfu.ID\n\t\t\t\tminStreamCount = streamCount\n\t\t\t}\n\t\t}\n\t}\n\tlog.Infof(\"findServiceNode: selecting SFU [%s] = %v\", sfuID, minStreamCount)\n\n\tif node, ok := services[sfuID]; ok {\n\t\tlog.Infof(\"findServiceNode: found best candidate SFU [%s]\", node)\n\t\trpcID := discovery.GetRPCChannel(node)\n\t\teventID := discovery.GetEventChannel(node)\n\t\tname := node.Info[\"name\"]\n\t\tid := node.Info[\"id\"]\n\t\tresp := proto.GetSFURPCParams{Name: name, RPCID: rpcID, EventID: eventID, Service: service, ID: id}\n\t\tlog.Infof(\"findServiceNode: [%s] %s => %s\", service, name, rpcID)\n\t\treturn resp, nil\n\t}\n\n\treturn nil, util.NewNpError(404, fmt.Sprintf(\"Service node [%s] not found\", service))\n}" ]
[ "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.53344536", "0.53293234", "0.5246839", "0.52382934", "0.5223773", "0.5217092", "0.5199757", "0.5197422", "0.5179559", "0.51562536", "0.51521754", "0.5151549", "0.5145008", "0.51434624", "0.51302135", "0.5128851", "0.512799", "0.51272726", "0.5125689", "0.5120645", "0.51174486", "0.51092094", "0.51069206", "0.51003146", "0.506243", "0.5054484", "0.50533193", "0.5051753", "0.5031539", "0.50312775", "0.5027768", "0.5026448", "0.5024594", "0.50144637", "0.50049835", "0.49771926", "0.4963115", "0.4962951", "0.49591842", "0.49526897", "0.49325886", "0.49304324", "0.49292272", "0.49241278", "0.49221224", "0.49016085", "0.489687", "0.4895372", "0.48933443", "0.48847753", "0.48781312", "0.4867705", "0.4858731", "0.48573884", "0.48430023", "0.48403224", "0.48367074", "0.48349497", "0.4816179", "0.48159415", "0.4813747", "0.48100945", "0.4809943", "0.4809828", "0.48090133", "0.48015282", "0.48004416", "0.47954956", "0.47939956", "0.47906306", "0.47851178", "0.4782542", "0.47744957", "0.4751634", "0.47429195", "0.47292608", "0.47291407", "0.47181395", "0.47140956" ]
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 *State) RemoveSession(sessionID string) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\ts.unlockedRemoveSession(sessionID)\n}", "func (p *PersistentStorage) RemoveSimSession(simID string) error {\n\tdefer func(now time.Time) {\n\t\trequestTime.With(\"method\", removeSimSession, \"data_store\", redisStore).Observe(time.Since(now).Seconds() * 1e3)\n\t}(time.Now())\n\n\tconn := p.pool.Get()\n\tdefer conn.Close()\n\n\tkey := fmt.Sprintf(simSessionKeyFmt, simID)\n\t_, err := conn.Do(\"DEL\", key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *State) RemoveSession(ctx context.Context, sessionID string) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tdlog.Debugf(ctx, \"Session %s removed. Explicit removal\", sessionID)\n\n\ts.unlockedRemoveSession(sessionID)\n}", "func (h *Hub) RemoveSession(s *Session) {\n\th.register <- HubRegistration{event: \"remove\", session: s}\n}", "func (v *Voice) RemoveSession(guildID discord.GuildID) {\n\tv.mapmutex.Lock()\n\tdefer v.mapmutex.Unlock()\n\n\t// Ensure that the session is disconnected.\n\tif ses, ok := v.sessions[guildID]; ok {\n\t\tses.Disconnect()\n\t}\n\n\tdelete(v.sessions, guildID)\n}", "func (sim *SessionInterestManager) RemoveSession(ses uint64) []cid.Cid {\n\tsim.lk.Lock()\n\tdefer sim.lk.Unlock()\n\n\t// The keys that no session is interested in\n\tdeletedKs := make([]cid.Cid, 0)\n\n\t// For each known key\n\tfor c := range sim.wants {\n\t\t// Remove the session from the list of sessions that want the key\n\t\tdelete(sim.wants[c], ses)\n\n\t\t// If there are no more sessions that want the key\n\t\tif len(sim.wants[c]) == 0 {\n\t\t\t// Clean up the list memory\n\t\t\tdelete(sim.wants, c)\n\t\t\t// Add the key to the list of keys that no session is interested in\n\t\t\tdeletedKs = append(deletedKs, c)\n\t\t}\n\t}\n\n\treturn deletedKs\n}", "func (l *localSimHostStorage) RemoveSimSession(simID string) error {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\n\tdelete(l.simSessions, simID)\n\n\treturn nil\n}", "func (session *Session) Remove() {\r\n\tsessionMutex.Lock()\r\n\tdelete(sessions, session.ID)\r\n\tsessionMutex.Unlock()\r\n}", "func SessionDestroy(SID string) {\n\tSessionMapLock.Lock()\n\tdefer SessionMapLock.Unlock()\n\n\tlogging.Debug(&map[string]string{\n\t\t\"file\": \"session.go\",\n\t\t\"Function\": \"SessionDestroy\",\n\t\t\"event\": \"Destroy session\",\n\t\t\"SID\": SID,\n\t})\n\tdelete(SessionMap, SID)\n}", "func (h *WebDriverHub) RemoveSession(id string) {\n\th.mu.Lock()\n\tdefer h.mu.Unlock()\n\tif h.sessions == nil {\n\t\treturn\n\t}\n\tdelete(h.sessions, id)\n}", "func RemoveSessions() {\n\tus := models.UserSession{}\n\tc := dbSession.Find(bson.M{}).Iter()\n\tfor c.Next(&us) {\n\t\tif time.Now().Sub(us.CreatedAt).Seconds() >= 3600 {\n\t\t\tdbSession.Remove(struct{ UUID string }{UUID: string(us.UUID)})\n\t\t\tfmt.Println(\"dropping sessions...\")\n\t\t}\n\t}\n\tif err := c.Close(); err != nil {\n\t\tfmt.Println(\"Iterations completed\")\n\t\treturn\n\t}\n\tfmt.Println(\"Closed successfully\")\n}", "func SessionCleanup() {\n\tfor {\n\t\tselect {\n\t\tcase <-time.After(SessionManager.SessionCleanupTime * time.Minute):\n\t\t\tSessionManager.ReqSessionMem <- 1 // ask to access the shared mem, blocks until granted\n\t\t\t<-SessionManager.ReqSessionMemAck // make sure we got it\n\t\t\tss := make(map[string]*Session, 0) // here's the new Session list\n\t\t\tn := 0 // total number removed\n\t\t\tfor k, v := range Sessions { // look at every Session\n\t\t\t\tif time.Now().After(v.Expire) { // if it's still active...\n\t\t\t\t\tn++ // removed another\n\t\t\t\t} else {\n\t\t\t\t\tss[k] = v // ...copy it to the new list\n\t\t\t\t}\n\t\t\t}\n\t\t\tSessions = ss // set the new list\n\t\t\tSessionManager.ReqSessionMemAck <- 1 // tell SessionDispatcher we're done with the data\n\t\t\t//fmt.Printf(\"SessionCleanup completed. %d removed. Current Session list size = %d\\n\", n, len(Sessions))\n\t\t}\n\t}\n}", "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.CleanupTimer = sessionCtx.Imsi, sessionCtx.CleanupTimer, nil\n\t\t}\n\t}\n\ts.rwl.Unlock()\n\tif timer != nil {\n\t\ttimer.Stop()\n\t}\n\treturn imsi, exist\n}", "func (c *Controller) DelSession(name interface{}) error {\n\tif c.CruSession == nil {\n\t\tc.StartSession()\n\t}\n\treturn c.CruSession.Delete(context2.Background(), name)\n}", "func (matcher *JoinSession) RemoveSessionID(sessionID SessionID) error {\n\t_, ok := matcher.SessionData.Participants[sessionID]\n\tif ok {\n\t\tdelete(matcher.SessionData.Participants, sessionID)\n\t\tlog.Infof(\"SessionID %v disconnected, remove from join session\", sessionID)\n\t\treturn nil\n\t}\n\treturn ErrSessionIDNotFound\n}", "func (m *Session) Remove(ctx context.Context, req *proto.SessionRequest, rsp *proto.SessionResponse) error {\n\tservice.Remove(req.Account)\n\treturn nil\n}", "func DeleteSession(session *Session) {\r\n\tsessionListMutex.Lock()\r\n\tdefer sessionListMutex.Unlock()\r\n\r\n\tdelete(sessionList, session.Key)\r\n\tfmt.Printf(\"Delete session %d\\n\", session.Key)\r\n}", "func DeleteSession(sessionID string) error {\n\tkey := stringutil.Build(\"sessionid:\", sessionID, \":userid\")\n\terr := Delete(key)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot delete key from Redis\")\n\t}\n\treturn nil\n}", "func (s *Server) removeSession(conn net.Conn) {\n\tif conn != nil {\n\t\tcommon.LogI(\"Session removed for client: %s\", conn.RemoteAddr().String())\n\t\tconn.Close()\n\t\ts.clients.Delete(conn)\n\t}\n}", "func (pool *SessionPool) removeSessionFromActive(session *pureSession) {\n\tpool.rwLock.Lock()\n\tdefer pool.rwLock.Unlock()\n\tl := &pool.activeSessions\n\tfor ele := l.Front(); ele != nil; ele = ele.Next() {\n\t\tif ele.Value.(*pureSession) == session {\n\t\t\tl.Remove(ele)\n\t\t}\n\t}\n}", "func (st *MemStore) KillSession(sid string) {\n\tst.mx.Lock()\n\tdefer st.mx.Unlock()\n\tdelete(st.sessions, sid)\n}", "func (me *GJUser) CloseSession(){\n\tme.qreq(\"sessions/close\",\"\")\n}", "func (s *s6aProxy) cleanupSession(sid string) chan interface{} {\n\ts.sessionsMu.Lock()\n\toldCh, ok := s.sessions[sid]\n\tif ok {\n\t\tdelete(s.sessions, sid)\n\t\ts.sessionsMu.Unlock()\n\t\tif oldCh != nil {\n\t\t\tclose(oldCh)\n\t\t}\n\t\treturn oldCh\n\t}\n\ts.sessionsMu.Unlock()\n\treturn nil\n}", "func RemoveSessionByID(id bson.ObjectId) (err error) {\n\tsessions, err := collection.Sessions()\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn err\n\t}\n\tdefer sessions.Close()\n\n\terr = sessions.Remove(bson.M{\"_id\": id})\n\tif err != nil && err != mgo.ErrNotFound {\n\t\tlogger.Error(err)\n\t}\n\n\treturn\n}", "func removeNodeSession(id int64) error {\n\tkv, err := etcdkv.NewEtcdKV(Params.EtcdEndpoints, Params.MetaRootPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = kv.Remove(fmt.Sprintf(\"session/\"+typeutil.QueryNodeRole+\"-%d\", id))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (t *SessionManager) DestroySession(session_uuid string) error {\n\t_, err := t.db.Exec(\"DELETE FROM UserSession WHERE Token = ?\", session_uuid)\n\treturn err\n}", "func (ss *SessionStore) removeSessionFromLRU(session *Session) {\n\tif(session.next != nil) {\n\t\tsession.next.prev = session.prev\n\t}\n\tif(session.prev != nil) {\n\t\tsession.prev.next = session.next\n\t}\n\tif(ss.listLRU.head == session) {\n\t\tss.listLRU.head = session.next\n\t}\n\tif(ss.listLRU.tail == session) {\n\t\tss.listLRU.head = session.prev\n\t}\n\tsession.next = nil\n\tsession.prev = nil\n}", "func RemoveUserSession(userID int, sessionID string) error {\n\tkey := stringutil.Build(\"userid:\", strconv.Itoa(userID), \":sessionids\")\n\terr := SetRemoveMember(key, sessionID)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot remove member from set in Redis\")\n\t}\n\treturn nil\n}", "func ClearSession(sessionID string) {\n\n\tconn := redisConnPool.Get()\n\tdefer conn.Close()\n\n\tkey := fmt.Sprintf(\"sessions:%s\", sessionID)\n\t_, err := conn.Do(\"DEL\", key)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to delete the session from the Redis cache: \", err.Error())\n\t}\n}", "func (d *Abstraction) CloseSession() {\n\tfor k, v := range d.Sigmap {\n\t\tdelete(d.Sigmap, k)\n\t\tclose(v)\n\t}\n\td.Conn.RemoveSignal(d.Recv)\n\td.Conn.Close()\n}", "func (p *Plex) KillTranscodeSession(sessionKey string) (bool, error) {\n\trequestInfo.headers.Token = p.token\n\n\tif sessionKey == \"\" {\n\t\treturn false, errors.New(\"Missing sessionKey\")\n\t}\n\n\tquery := p.URL + \"/video/:/transcode/universal/stop?session=\" + sessionKey\n\n\tresp, respErr := requestInfo.get(query)\n\n\tif respErr != nil {\n\t\treturn false, respErr\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode == 401 {\n\t\treturn false, errors.New(\"You are not authorized to access this server\")\n\t} else if resp.StatusCode != 200 {\n\t\tstatusCode := strconv.Itoa(resp.StatusCode)\n\t\treturn false, errors.New(\"Server replied with \" + statusCode + \" status code\")\n\t}\n\n\treturn true, nil\n}", "func (dsm DSM) EndSession() {\n\turl := fmt.Sprintf(\"%sauthentication/logout\", dsm.RestURL)\n\t_, err := grequests.Delete(url, &grequests.RequestOptions{HTTPClient: &dsm.RestClient, Params: map[string]string{\"sID\": dsm.SessionID}})\n\n\tif err != nil {\n\t\tlog.Println(\"Unable to make request\", err)\n\t}\n\n}", "func (s *SessionManager) DeleteSession(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"Deleting session\")\n\tsession, _ := s.Store.Get(r, \"session\")\n\tdelete(session.Values, \"user_id\")\n\tdelete(session.Values, \"username\")\n\tsession.Options.MaxAge = -1\n\tsession.Save(r, w)\n}", "func (u *CryptohomeClient) CleanupSession(ctx context.Context, authSessionID string) error {\n\t// Kill the AuthSession.\n\tif _, err := u.binary.invalidateAuthSession(ctx, authSessionID); err != nil {\n\t\treturn errors.Wrap(err, \"failed to invaldiate AuthSession\")\n\t}\n\t// Clean up obsolete state, in case there's any.\n\tif err := u.UnmountAll(ctx); err != nil {\n\t\treturn errors.Wrap(err, \"failed to unmount vaults for cleanup\")\n\t}\n\treturn nil\n}", "func (session *NetSession) CloseSession() error {\n\tsession.Bufio.Flush()\n\tsession.Conn.Close()\n\tsession.Conn = nil\n\tvar returnErr error = nil\n\tif pps, ok := session.PusherPullersSessionMap[session.ReourcePath]; ok {\n\t\tif errs := pps.StopSession(&session.ID); len(errs) != 0 {\n\t\t\tfor index, err := range errs {\n\t\t\t\treturnErr = fmt.Errorf(\"%v\\nindex = %v,error = %v\", returnErr, index, err)\n\t\t\t}\n\t\t}\n\t\tif session.SessionType == PusherClient {\n\t\t\t// if this session is pusher ,\n\t\t\t// we need free all resource include puller's resource\n\t\t\tsession.PusherPullersSessionMapMutex.Lock()\n\t\t\tdelete(session.PusherPullersSessionMap, session.ReourcePath)\n\t\t\tsession.PusherPullersSessionMapMutex.Unlock()\n\t\t}\n\t}\n\treturn returnErr\n}", "func (sim *SessionInterestManager) RemoveSessionWants(ses uint64, ks []cid.Cid) {\n\tsim.lk.Lock()\n\tdefer sim.lk.Unlock()\n\n\t// For each key\n\tfor _, c := range ks {\n\t\t// If the session wanted the block\n\t\tif wanted, ok := sim.wants[c][ses]; ok && wanted {\n\t\t\t// Mark the block as unwanted\n\t\t\tsim.wants[c][ses] = false\n\t\t}\n\t}\n}", "func EndSession(sessionKey string, rs RedisStore, sid string) (string, error) {\n\t\n\t_, err := ValidateID(sid, sessionKey)\n\n\tif err != nil {\n\t\treturn \"\", errors.New(\"Invalid Session ID\")\n\t}\n\n\trs.Delete(sid)\n\n\treturn sid, nil\n}", "func SessionDelete(s *Session) {\n\tfmt.Printf(\"Session being deleted: %s\\n\", s.ToString())\n\t// fmt.Printf(\"sess.Sessions before delete:\\n\")\n\t// DumpSessions()\n\n\tif err := db.DeleteSessionCookie(s.Token); err != nil {\n\t\tlib.Ulog(\"Error deleting session cookie: %s\\n\", err.Error())\n\t}\n\n\tss := make(map[string]*Session, 0)\n\n\tSessionManager.ReqSessionMem <- 1 // ask to access the shared mem, blocks until granted\n\t<-SessionManager.ReqSessionMemAck // make sure we got it\n\tfor k, v := range Sessions {\n\t\tif s.Token != k {\n\t\t\tss[k] = v\n\t\t}\n\t}\n\tSessions = ss\n\tSessionManager.ReqSessionMemAck <- 1 // tell SessionDispatcher we're done with the data\n\t// fmt.Printf(\"sess.Sessions after delete:\\n\")\n\t// DumpSessions()\n}", "func (ms *MemStore) CleanupSessionKeys(t uint64) error {\n\tvar oldKeys []string\n\tfor hash, sk := range ms.sessionKeys {\n\t\tif sk.cleanupTime < t {\n\t\t\toldKeys = append(oldKeys, hash)\n\t\t}\n\t}\n\tfor _, hash := range oldKeys {\n\t\tdelete(ms.sessionKeys, hash)\n\t}\n\treturn nil\n}", "func delayUnregister(session *model.Session) {\n\ttime.Sleep(time.Second * 5)\n\t//TODO do something better perhaps a seperate queue for the messages that will be deleted.\n\tdefer mutex.Unlock()\n\tmutex.Lock()\n\n\tdelete(tokenAvailable, session.SessionToken)\n\tdelete(sessionCache, session.SocketID)\n\tdelete(userCache, session.UserID)\n\tmodel.DB().Delete(session) //Remove the session\n\n}", "func (db *MongoDB) DeleteUserSession(id string) error {\n\t_, err := db.instance.Collection(sessionCollection).DeleteOne(context.Background(), bson.M{\"sid\": id})\n\treturn err\n}", "func (pdr *ProviderMySQL) SessionDestroy(sid string) error {\n\tc := pdr.connectInit()\n\tdefer func() {\n\t\terr := c.Close()\n\t\tif err != nil {\n\t\t\tsession.SLogger.Println(err)\n\t\t}\n\t}()\n\n\t_, err := c.Exec(\"DELETE FROM \"+TableName+\" where session_key=?\", sid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (authSvc *AuthService) invalidateSessionId(sessionId string) {\n\tauthSvc.Sessions[sessionId] = nil\n}", "func (s *Sessions) DelByID(sessionID string) {\n\t// Lock for mutex\n\ts.Lock()\n\tdefer s.Unlock()\n\t// check for session exist in map and delete\n\t_, ok := s.sessions[sessionID]\n\tif !ok {\n\t\tlog.Println(\"Trying to remove unexistent sessionID:\", sessionID)\n\t\treturn\n\t}\n\t//close websocket\n\ts.sessions[sessionID].Actualizer.CloseChan <- true\n\tdelete(s.sessions, sessionID)\n}", "func (s *Session) Remove() error {\n\tres := SessionCollection.Find(s.Constraint())\n\n\tif c, _ := res.Count(); c < 1 {\n\t\treturn errmsg.ErrNoSuchSession\n\t}\n\n\treturn res.Remove()\n}", "func (sta StandardAuthenticator) DestroySession(sessionId string) error {\n\treturn nil\n}", "func DeleteSession(c echo.Context) {\n\tsession, _ := session.Get(sessionID, c)\n\tsession.Options.MaxAge = -1\n\tsession.Save(c.Request(), c.Response())\n}", "func (m *MockInterface) RemoveSession(arg0 *userService.Sid) (*userService.Uid, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RemoveSession\", arg0)\n\tret0, _ := ret[0].(*userService.Uid)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (gs *Service) closeSession(session Session) {\n\t//TODO: delete Chat connection\n\tfor client := range session.hub.Clients {\n\t\t_ = client.Conn.Close()\n\t}\n\tdelete(gs.sessions, session.sessionID)\n}", "func (s *BoltState) RemoveContainerExecSessions(ctr *Container) error {\n\tif !s.valid {\n\t\treturn define.ErrDBClosed\n\t}\n\n\tif !ctr.valid {\n\t\treturn define.ErrCtrRemoved\n\t}\n\n\tdb, err := s.getDBCon()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer s.deferredCloseDBCon(db)\n\n\tctrID := []byte(ctr.ID())\n\tsessions := []string{}\n\n\terr = db.Update(func(tx *bolt.Tx) error {\n\t\texecBucket, err := getExecBucket(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tctrBucket, err := getCtrBucket(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdbCtr := ctrBucket.Bucket(ctrID)\n\t\tif dbCtr == nil {\n\t\t\tctr.valid = false\n\t\t\treturn define.ErrNoSuchCtr\n\t\t}\n\n\t\tctrExecSessions := dbCtr.Bucket(execBkt)\n\t\tif ctrExecSessions == nil {\n\t\t\treturn nil\n\t\t}\n\n\t\terr = ctrExecSessions.ForEach(func(id, unused []byte) error {\n\t\t\tsessions = append(sessions, string(id))\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, session := range sessions {\n\t\t\tif err := ctrExecSessions.Delete([]byte(session)); err != nil {\n\t\t\t\treturn fmt.Errorf(\"removing container %s exec session %s from database: %w\", ctr.ID(), session, err)\n\t\t\t}\n\t\t\t// Check if the session exists in the global table\n\t\t\t// before removing. It should, but in cases where the DB\n\t\t\t// has become inconsistent, we should try and proceed\n\t\t\t// so we can recover.\n\t\t\tsessionExists := execBucket.Get([]byte(session))\n\t\t\tif sessionExists == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif string(sessionExists) != ctr.ID() {\n\t\t\t\treturn fmt.Errorf(\"database mismatch: exec session %s is associated with containers %s and %s: %w\", session, ctr.ID(), string(sessionExists), define.ErrInternal)\n\t\t\t}\n\t\t\tif err := execBucket.Delete([]byte(session)); err != nil {\n\t\t\t\treturn fmt.Errorf(\"removing container %s exec session %s from exec sessions: %w\", ctr.ID(), session, err)\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\treturn err\n}", "func Logout(w http.ResponseWriter, r *http.Request) {\n\tif sessions.GoodSession(r) != true {\n\t\tjson.NewEncoder(w).Encode(\"Session Expired. Log out and log back in.\")\n\t}\n\tstore, err := pgstore.NewPGStore(os.Getenv(\"PGURL\"), key)\n\tcheck(err)\n\tdefer store.Close()\n\n\tsession, err := store.Get(r, \"scheduler-session\")\n\tcheck(err)\n\t// Revoke users authentication\n\tsession.Values[\"authenticated\"] = false\n\tw.WriteHeader(http.StatusOK)\n\tsession.Options.MaxAge = -1\n\tsession.Save(r, w)\n}", "func (sm *SessionMap) Delete(sessionID string) {\n\tsm.Lock.Lock()\n\tdefer sm.Lock.Unlock()\n\n\tif _, ok := sm.Sessions[sessionID]; ok {\n\t\tdelete(sm.Sessions, sessionID)\n\t}\n}", "func (client BastionClient) deleteSession(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {\n\thttpRequest, err := request.HTTPRequest(http.MethodDelete, \"/sessions/{sessionId}\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response DeleteSessionResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func (tb *TaskBuilder) RemoveSessionParameters(params map[string]interface{}) string {\n\tsortedKeys := make([]string, 0)\n\tfor k := range params {\n\t\tsortedKeys = append(sortedKeys, k)\n\t}\n\tsort.Strings(sortedKeys)\n\n\treturn fmt.Sprintf(`ALTER TASK %v UNSET %v`, tb.QualifiedName(), strings.Join(sortedKeys, \", \"))\n}", "func DeleteSession(urlPrefix, id string) error {\n\tu, err := url.Parse(urlPrefix)\n\tif err != nil {\n\t\treturn err\n\t}\n\tu.Path = path.Join(u.Path, \"session\", id)\n\treturn voidCommand(\"DELETE\", u.String(), nil)\n}", "func (t *Terminal) KillSession(r *kite.Request) (interface{}, error) {\n\tvar params struct {\n\t\tSession string\n\t}\n\n\tif r.Args.One().Unmarshal(&params) != nil {\n\t\treturn nil, errors.New(\"{ session: [string] }\")\n\t}\n\n\tif params.Session == \"\" {\n\t\treturn nil, errors.New(\"session is empty\")\n\t}\n\n\tif err := killSession(params.Session); err != nil {\n\t\treturn nil, err\n\t}\n\n\tt.DeleteUserSession(r.Username, params.Session)\n\n\treturn true, nil\n}", "func (s *Server) DeleteSession() http.HandlerFunc {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\ttoken := mux.Vars(r)[\"token\"]\n\t\terr := s.Db.RefreshTokens().Delete(token)\n\t\tif err != nil && err.Error() == mgo.ErrNotFound.Error() {\n\t\t\thttp.NotFound(w, r)\n\t\t\treturn\n\t\t}\n\t\tif err != nil {\n\t\t\ts.ErrorResponse(w, r, http.StatusInternalServerError, \"db error\")\n\t\t\treturn\n\t\t}\n\t\trespond.With(w, r, http.StatusNoContent, nil)\n\t})\n}", "func (srv *CentralSessionController) TerminateSession(\n\tctx context.Context,\n\trequest *protos.SessionTerminateRequest,\n) (*protos.SessionTerminateResponse, error) {\n\tvar wg sync.WaitGroup\n\twg.Add(2)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tif srv.cfg.DisableGx {\n\t\t\treturn\n\t\t}\n\t\t_, err := srv.sendTerminationGxRequest(request)\n\t\tmetrics.ReportTerminateGxSession(err)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Error sending gx termination: %s\", err)\n\t\t\treturn\n\t\t}\n\n\t}()\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tif srv.cfg.DisableGy {\n\t\t\treturn\n\t\t}\n\t\t_, err := srv.sendSingleCreditRequest(getTerminateRequestFromUsage(request))\n\t\tmetrics.ReportTerminateGySession(err)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Error sending gy termination: %s\", err)\n\t\t\treturn\n\t\t}\n\t}()\n\twg.Wait()\n\t// in the event of any errors on Gx or Gy, the session should regardless be\n\t// terminated, so there are no errors sent back\n\treturn &protos.SessionTerminateResponse{\n\t\tSid: request.GetCommonContext().GetSid().GetId(),\n\t\tSessionId: request.SessionId,\n\t}, nil\n}", "func CloseSession(s *Server) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tvar data = struct {\n\t\t\tToken string `json:\"token\" binding:\"required\"`\n\t\t}{}\n\n\t\tif err := c.BindJSON(&data); err != nil {\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\"status\": \"JSON Body is missing fields\"})\n\t\t\treturn\n\t\t}\n\n\t\tif _, redisErr := s.Redis.Do(\"DEL\", data.Token); redisErr != nil {\n\t\t\tc.JSON(http.StatusInternalServerError, gin.H{\"status\": \"Internal error\"})\n\t\t\treturn\n\t\t}\n\n\t\tc.JSON(http.StatusOK, gin.H{\"result\": \"ok\"})\n\t}\n}", "func (ks *KeyStore) CloseSession(session pkcs11.SessionHandle) {\n\terr := pkcs11Ctx.CloseSession(session)\n\tif err != nil {\n\t\tlogrus.Debugf(\"Error closing session: %s\", err.Error())\n\t}\n}", "func RemoveSessionByUUID(uuid string) (err error) {\n\tsessions, err := collection.Sessions()\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn err\n\t}\n\tdefer sessions.Close()\n\n\terr = sessions.Remove(bson.M{\"uuid\": uuid})\n\tif err != nil && err != mgo.ErrNotFound {\n\t\tlogger.Error(err)\n\t}\n\n\treturn\n}", "func (b *BaseHandler) CleanSession() {\n\tb.sessionStore.Clean(b)\n}", "func (sp *SessionProvider) Remove(db, c string, q interface{}) error {\n\tsession, err := sp.GetSession()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer session.Close()\n\t_, err = session.DB(db).C(c).RemoveAll(q)\n\treturn err\n}", "func Close(ctx context.Context) {\n\tmw := ctx.Value(mwContextKey{}).(sessionMiddleware)\n\tid := ctx.Value(sessionIdContextKey{}).(string)\n\tdelete(mw.sessions, id)\n}", "func Logout(session *Session) error {\n\tif err := cache.Execute(session.Del); err != nil {\n\t\tlogger.Error(\"Logout.DelSessionError\",\n\t\t\tlogger.String(\"Session\", session.String()),\n\t\t\tlogger.Err(err),\n\t\t)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *Container) removeTimer() error {\n\treturn define.ErrNotImplemented\n}", "func SessionDelMiddleware(ctx iris.Context) {\n\tctx.Next()\n\tctxt := ctx.Request().Context()\n\n\tsessionID := ctx.Request().Header.Get(\"Session-ID\")\n\tsessionToken := ctx.Request().Header.Get(\"X-Auth-Token\")\n\tif sessionID != \"\" {\n\t\tresp, err := rpc.DeleteSessionRequest(ctxt, sessionID, sessionToken)\n\t\tif err != nil && resp == nil {\n\t\t\terrorMessage := \"error: something went wrong with the RPC calls: \" + err.Error()\n\t\t\tl.LogWithFields(ctxt).Error(errorMessage)\n\t\t\treturn\n\t\t}\n\t}\n}", "func (s *BoltState) RemoveExecSession(session *ExecSession) error {\n\tif !s.valid {\n\t\treturn define.ErrDBClosed\n\t}\n\n\tdb, err := s.getDBCon()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer s.deferredCloseDBCon(db)\n\n\tsessionID := []byte(session.ID())\n\tcontainerID := []byte(session.ContainerID())\n\terr = db.Update(func(tx *bolt.Tx) error {\n\t\texecBucket, err := getExecBucket(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tctrBucket, err := getCtrBucket(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tsessionExists := execBucket.Get(sessionID)\n\t\tif sessionExists == nil {\n\t\t\treturn define.ErrNoSuchExecSession\n\t\t}\n\t\t// Check that container ID matches\n\t\tif string(sessionExists) != session.ContainerID() {\n\t\t\treturn fmt.Errorf(\"database inconsistency: exec session %s points to container %s in state but %s in database: %w\", session.ID(), session.ContainerID(), string(sessionExists), define.ErrInternal)\n\t\t}\n\n\t\tif err := execBucket.Delete(sessionID); err != nil {\n\t\t\treturn fmt.Errorf(\"removing exec session %s from database: %w\", session.ID(), err)\n\t\t}\n\n\t\tdbCtr := ctrBucket.Bucket(containerID)\n\t\tif dbCtr == nil {\n\t\t\t// State is inconsistent. We refer to a container that\n\t\t\t// is no longer in the state.\n\t\t\t// Return without error, to attempt to recover.\n\t\t\treturn nil\n\t\t}\n\n\t\tctrExecBucket := dbCtr.Bucket(execBkt)\n\t\tif ctrExecBucket == nil {\n\t\t\t// Again, state is inconsistent. We should have an exec\n\t\t\t// bucket, and it should have this session.\n\t\t\t// Again, nothing we can do, so proceed and try to\n\t\t\t// recover.\n\t\t\treturn nil\n\t\t}\n\n\t\tctrSessionExists := ctrExecBucket.Get(sessionID)\n\t\tif ctrSessionExists != nil {\n\t\t\tif err := ctrExecBucket.Delete(sessionID); err != nil {\n\t\t\t\treturn fmt.Errorf(\"removing exec session %s from container %s in database: %w\", session.ID(), session.ContainerID(), err)\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\treturn err\n}", "func (sim *SessionInterestManager) RemoveSessionInterested(ses uint64, ks []cid.Cid) []cid.Cid {\n\tsim.lk.Lock()\n\tdefer sim.lk.Unlock()\n\n\t// The keys that no session is interested in\n\tdeletedKs := make([]cid.Cid, 0, len(ks))\n\n\t// For each key\n\tfor _, c := range ks {\n\t\t// If there is a list of sessions that want the key\n\t\tif _, ok := sim.wants[c]; ok {\n\t\t\t// Remove the session from the list of sessions that want the key\n\t\t\tdelete(sim.wants[c], ses)\n\n\t\t\t// If there are no more sessions that want the key\n\t\t\tif len(sim.wants[c]) == 0 {\n\t\t\t\t// Clean up the list memory\n\t\t\t\tdelete(sim.wants, c)\n\t\t\t\t// Add the key to the list of keys that no session is interested in\n\t\t\t\tdeletedKs = append(deletedKs, c)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn deletedKs\n}", "func (authentication *Authentication) ClearSession(res http.ResponseWriter, req *http.Request) {\n\tcookie, _ := cookies.GetCookie(req, \"session\")\n\t// delete the session\n\tdelete(authentication.loginUser, authentication.userSession[cookie.Value].email)\n\tdelete(authentication.userSession, cookie.Value)\n\t// remove the cookie\n\tcookie = &http.Cookie{\n\t\tName: \"session\",\n\t\tValue: \"\",\n\t\tPath: \"/\",\n\t\tMaxAge: -1,\n\t}\n\thttp.SetCookie(res, cookie)\n\n\t// clean up dbSessions\n\tif time.Now().Sub(sessionsCleaned) > (time.Second * 30) {\n\t\tfor sessionID, session := range authentication.userSession {\n\t\t\tif time.Now().Sub(session.lastActivity) > (time.Second * 30) {\n\t\t\t\tdelete(authentication.loginUser, session.email)\n\t\t\t\tdelete(authentication.userSession, sessionID)\n\t\t\t}\n\t\t}\n\t\tsessionsCleaned = time.Now()\n\t}\n}", "func (m *MockUserDB) RemoveSession(sid string) (error, uint64) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RemoveSession\", sid)\n\tret0, _ := ret[0].(error)\n\tret1, _ := ret[1].(uint64)\n\treturn ret0, ret1\n}", "func (handler *IdentityProviderHandler) DeleteSession(sessionID string, userAgent string, remoteAddr string) (r bool, err error) {\n\thandler.log.Printf(\"deleteSession(%v, %v, %v)\", sessionID, userAgent, remoteAddr)\n\n\tsession, err := handler.SessionInteractor.Find(sessionID)\n\tif err != nil {\n\t\te := err.(*errs.Error)\n\t\treturn false, errorToServiceError(e)\n\t}\n\n\tif !session.Domain.Enabled || !session.User.Enabled {\n\t\te := services.NewUnauthorizedError()\n\t\te.Msg = \"Domain and/or user disabled\"\n\t\treturn false, e\n\t}\n\n\tif session.UserAgent != userAgent || session.RemoteAddr != remoteAddr {\n\t\te := services.NewNotFoundError()\n\t\te.Msg = \"Session not found\"\n\t\treturn false, e\n\t}\n\n\tif session.IsExpired() {\n\t\te := services.NewUnauthorizedError()\n\t\te.Msg = \"Session expired\"\n\t\treturn false, e\n\t}\n\n\terr = handler.SessionInteractor.Delete(*session)\n\tif err != nil {\n\t\te := err.(*errs.Error)\n\t\treturn false, errorToServiceError(e)\n\t}\n\n\treturn true, nil\n}", "func (t *DRMAATracker) DestroySession() error {\n\treturn t.session.Exit()\n}", "func (uu *UserUpdate) ClearSession() *UserUpdate {\n\tuu.mutation.ClearSession()\n\treturn uu\n}", "func (s *service) DeleteSession(sessionID string) (*Session, []error) {\n\treturn (*s.repo).DeleteSession(sessionID)\n}", "func (c *Controller) DestroySession() error {\n\terr := c.Ctx.Input.CruSession.Flush(nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.Ctx.Input.CruSession = nil\n\tGlobalSessions.SessionDestroy(c.Ctx.ResponseWriter, c.Ctx.Request)\n\treturn nil\n}", "func SessionGC() {\n\t// Lock and defer unlock of session map\n\tSessionMapLock.Lock()\n\tdefer SessionMapLock.Unlock()\n\n\tlogging.Debug(&map[string]string{\n\t\t\"file\": \"session.go\",\n\t\t\"Function\": \"SessionGC\",\n\t\t\"event\": \"Run garbage collector job\",\n\t})\n\n\t// Destory session if last access older than configured session lifetime\n\tfor SID, value := range SessionMap {\n\t\tif value.TimeAccessed.Add(time.Duration(config.SessionLifetime)*time.Minute).Unix() <= time.Now().Unix() {\n\t\t\tSessionDestroy(SID)\n\t\t}\n\t}\n\n\t// Wait one minute to repeat job\n\ttime.AfterFunc(time.Duration(config.SessionLifetime+1)*time.Minute, func() { SessionGC() })\n}", "func (t *Terminal) DeleteUserSession(username, session string) {\n\tt.Lock()\n\tdefer t.Unlock()\n\n\tuser, ok := t.Users[username]\n\tif !ok {\n\t\treturn // nothing to do\n\t}\n\n\tuser.DeleteSession(session)\n\n\tif len(user.Sessions) == 0 {\n\t\tdelete(t.Users, username)\n\t}\n}", "func (p *PostgresDb) DeleteUserSession(token string) error {\n\tquery := `\n\t\tDELETE FROM usersession \n\t\tWHERE token=$1\n\t`\n\t_, err := p.dbConn.Exec(query, token)\n\treturn err\n}", "func (rp *Provider) SessionDestroy(ctx context.Context, sid string) error {\n\tif ctx == nil {\n\t\tctx = context.TODO()\n\t}\n\treturn rp.c.Delete(ctx, sid)\n}", "func (s *EapAkaSrv) ResetSessionTimeout(sessionId string, newTimeout time.Duration) {\n\tvar oldTimer *time.Timer\n\n\ts.rwl.Lock()\n\tsession, exist := s.sessions[sessionId]\n\tif exist {\n\t\tif session != nil {\n\t\t\toldTimer, session.CleanupTimer = session.CleanupTimer, time.AfterFunc(newTimeout, func() {\n\t\t\t\tsessionTimeoutCleanup(s, sessionId, session)\n\t\t\t})\n\t\t}\n\t}\n\ts.rwl.Unlock()\n\n\tif oldTimer != nil {\n\t\toldTimer.Stop()\n\t}\n}", "func (db *DB) DeactivateSession(ctx context.Context, key string) error {\n\t_, err := db.sql.QueryContext(ctx, `UPDATE \n\t\t\t\t\t\t\t\t\t\tsessions\n\t\t\t\t\t\t\t\t\t\tSET (active) = (false)\n\t\t\t\t\t\t\t\t\t\tWHERE key = $1;`, key)\n\n\treturn err\n}", "func ClearSessions(db AutoscopeDB, duration int64) error {\n\t//TODO\n\treturn nil\n}", "func (nh *NodeHost) CloseSession(ctx context.Context,\n\tsession *client.Session) error {\n\ttimeout, err := getTimeoutFromContext(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsession.PrepareForUnregister()\n\trs, err := nh.ProposeSession(session, timeout)\n\tif err != nil {\n\t\treturn err\n\t}\n\tselect {\n\tcase r := <-rs.CompletedC:\n\t\tif r.Completed() && r.GetResult() == session.ClientID {\n\t\t\treturn nil\n\t\t} else if r.Rejected() {\n\t\t\treturn ErrRejected\n\t\t} else if r.Timeout() {\n\t\t\treturn ErrTimeout\n\t\t} else if r.Terminated() {\n\t\t\treturn ErrClusterClosed\n\t\t}\n\t\tplog.Panicf(\"unknown v code %v, client id %d\",\n\t\t\tr, session.ClientID)\n\tcase <-ctx.Done():\n\t\tif ctx.Err() == context.Canceled {\n\t\t\treturn ErrCanceled\n\t\t} else if ctx.Err() == context.DeadlineExceeded {\n\t\t\treturn ErrTimeout\n\t\t}\n\t}\n\tpanic(\"should never reach here\")\n}", "func (s *Store) Remove(clientID string) error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tdelete(s.sess, clientID)\n\treturn nil\n}", "func (session ClientSession) Remove(w http.ResponseWriter) {\n\tc := http.Cookie{\n\t\tName: os.Getenv(entity.AppCookieName),\n\t\tMaxAge: -1,\n\t\tExpires: time.Unix(1, 0),\n\t\tValue: \"\",\n\t\tPath: \"/\",\n\t}\n\thttp.SetCookie(w, &c)\n}", "func (*adminCtrl) cleanSessionByID(c *elton.Context) (err error) {\n\tstore := cache.GetRedisSession()\n\terr = store.Destroy(c.Param(\"id\"))\n\tif err != nil {\n\t\treturn\n\t}\n\tc.NoContent()\n\treturn\n}", "func (d *DeviceGoUSB) CloseSession() error {\n\tvar req, rep Container\n\treq.Code = OC_CloseSession\n\terr := d.RunTransaction(&req, &rep, nil, nil, 0)\n\td.session = nil\n\treturn err\n}", "func (s *EapAkaSrv) UpdateSessionUnlockCtx(lockedCtx *UserCtx, timeout time.Duration) {\n\tif !lockedCtx.locked {\n\t\tpanic(\"Expected locked\")\n\t}\n\tvar (\n\t\toldSession, newSession *SessionCtx\n\t\texist bool\n\t\toldTimer *time.Timer\n\t)\n\tnewSession = &SessionCtx{UserCtx: lockedCtx}\n\tsessionId := lockedCtx.SessionId\n\tlockedCtx.Unlock()\n\n\tnewSession.CleanupTimer = time.AfterFunc(timeout, func() {\n\t\tsessionTimeoutCleanup(s, sessionId, newSession)\n\t})\n\n\ts.rwl.Lock()\n\n\toldSession, exist = s.sessions[sessionId]\n\ts.sessions[sessionId] = newSession\n\tif exist && oldSession != nil {\n\t\toldSession.UserCtx = nil\n\t\tif oldSession.CleanupTimer != nil {\n\t\t\toldTimer, oldSession.CleanupTimer = oldSession.CleanupTimer, nil\n\t\t}\n\t}\n\ts.rwl.Unlock()\n\n\tif oldTimer != nil {\n\t\toldTimer.Stop()\n\t}\n}", "func Logout(res http.ResponseWriter, req *http.Request) error {\n\tsession, err := Store.Get(req, SessionName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsession.Options.MaxAge = -1\n\tsession.Values = make(map[interface{}]interface{})\n\terr = session.Save(req, res)\n\tif err != nil {\n\t\treturn errors.New(\"Could not delete user session \")\n\t}\n\treturn nil\n}", "func (mp *MessageProcessor) CloseSession() {\n\tlog.Info(\"Telling device to stop streaming..\")\n\tmp.usbWriter.WriteDataToUsb(packet.NewAsynHPA0(mp.deviceAudioClockRef))\n\tmp.usbWriter.WriteDataToUsb(packet.NewAsynHPD0())\n\tlog.Info(\"Waiting for device to tell us to stop..\")\n\tfor i := 0; i < 2; i++ {\n\t\tselect {\n\t\tcase <-mp.releaseWaiter:\n\t\tcase <-time.After(3 * time.Second):\n\t\t\tlog.Warn(\"Timed out waiting for device closing\")\n\t\t\treturn\n\t\t}\n\t}\n\tmp.usbWriter.WriteDataToUsb(packet.NewAsynHPD0())\n\tlog.Info(\"OK. Ready to release USB Device.\")\n}", "func (asr *sessionRegistry) deregister(clt *Client) {\n\tasr.lock.Lock()\n\tdelete(asr.registry, clt.Session.Key)\n\tasr.lock.Unlock()\n}", "func ClearSession(req *http.Request, sessionKey string) bool {\n\tctx := appengine.NewContext(req)\n\tif sessionKey == \"\" {\n\t\tsessionKey = sessionKeyFromRequest(req)\n\t\tif sessionKey == \"\" {\n\t\t\treturn false\n\t\t}\n\t}\n\tmemcache.Delete(ctx, \"session-\"+sessionKey)\n\tif session, ok := sessions[sessionKey]; ok {\n\t\tdelete(sessions, sessionKey)\n\n\t\tif _, ok = sessionToAccount[session]; ok {\n\t\t\tdelete(sessionToAccount, session)\n\t\t}\n\n\t\treturn true\n\t}\n\treturn false\n}", "func Stop(s *sessions.Session) {\n\t// Remove the edit mode session data value.\n\ts.InstanceDelete(sessionValueKeyIsActive)\n\n\t// Disable the session context store again.\n\ttemplate.DisableSessionContextStore(s)\n\n\t// Remove the confirm message on exit.\n\ts.ResetExitMessage()\n\n\t// Remove the session from the active sessions.\n\tremoveSession(s)\n\n\t// Reload the current page.\n\ts.Reload()\n}", "func (tw *TimeWheel) RemoveTimer(key interface{}) {\n\tif key == nil {\n\t\treturn\n\t}\n\ttw.removeTaskChan <- key\n}", "func DeleteOutdatedSession(session *Session) error {\n\tdb := GetDB()\n\tif err := db.Where(\"server_id = ?\", session.ServerID).Delete(session).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (pder *MemProvider) SessionDestroy(sid string) error {\n\treturn (*session.MemProvider)(pder).SessionDestroy(context.Background(), sid)\n}" ]
[ "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.6107807", "0.6094295", "0.60708755", "0.6059067", "0.6046801", "0.6008879", "0.5999251", "0.59687793", "0.5881751", "0.58814096", "0.5868437", "0.58224934", "0.5814834", "0.58052224", "0.5795909", "0.5786596", "0.57675457", "0.5748904", "0.57132286", "0.56493425", "0.56440157", "0.56401485", "0.56310487", "0.5613327", "0.561194", "0.56115353", "0.558983", "0.55825526", "0.5519855", "0.55150026", "0.5513478", "0.5507123", "0.5479883", "0.54730296", "0.5472937", "0.54712915", "0.54701173", "0.5456817", "0.54541725", "0.5449063", "0.5430225", "0.54078686", "0.54067147", "0.5400091", "0.53956497", "0.5392759", "0.5379378", "0.5371451", "0.5365845", "0.53657556", "0.5363107", "0.53607863", "0.5358226", "0.5345288", "0.5320623", "0.5319711", "0.5305486", "0.5287004", "0.528587", "0.5272621", "0.52653015", "0.5261971", "0.52560556", "0.5255646", "0.52405727", "0.5232558", "0.52257675", "0.5214102", "0.5212748", "0.52120495", "0.5208122", "0.5202258", "0.519389", "0.51892644", "0.51796025", "0.51782113", "0.5177422", "0.51563394", "0.51500684", "0.51468194" ]
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.sessions, sessionId)\n\t\tif sessionCtx != nil {\n\t\t\timsi, timer, sessionCtx.CleanupTimer, sessionCtx.UserCtx =\n\t\t\t\tsessionCtx.Imsi, sessionCtx.CleanupTimer, nil, nil\n\t\t}\n\t}\n\ts.rwl.Unlock()\n\n\tif timer != nil {\n\t\ttimer.Stop()\n\t}\n\treturn imsi\n}", "func (sim *SessionInterestManager) RemoveSession(ses uint64) []cid.Cid {\n\tsim.lk.Lock()\n\tdefer sim.lk.Unlock()\n\n\t// The keys that no session is interested in\n\tdeletedKs := make([]cid.Cid, 0)\n\n\t// For each known key\n\tfor c := range sim.wants {\n\t\t// Remove the session from the list of sessions that want the key\n\t\tdelete(sim.wants[c], ses)\n\n\t\t// If there are no more sessions that want the key\n\t\tif len(sim.wants[c]) == 0 {\n\t\t\t// Clean up the list memory\n\t\t\tdelete(sim.wants, c)\n\t\t\t// Add the key to the list of keys that no session is interested in\n\t\t\tdeletedKs = append(deletedKs, c)\n\t\t}\n\t}\n\n\treturn deletedKs\n}", "func (s *Session) Remove() error {\n\tres := SessionCollection.Find(s.Constraint())\n\n\tif c, _ := res.Count(); c < 1 {\n\t\treturn errmsg.ErrNoSuchSession\n\t}\n\n\treturn res.Remove()\n}", "func (s *EapAkaSrv) FindSession(sessionId string) (aka.IMSI, *UserCtx, bool) {\n\tvar (\n\t\timsi aka.IMSI\n\t\tlockedCtx *UserCtx\n\t\ttimer *time.Timer\n\t)\n\ts.rwl.RLock()\n\tsessionCtx, exist := s.sessions[sessionId]\n\tif exist && sessionCtx != nil {\n\t\tlockedCtx, timer, sessionCtx.CleanupTimer = sessionCtx.UserCtx, sessionCtx.CleanupTimer, nil\n\t}\n\ts.rwl.RUnlock()\n\n\tif lockedCtx != nil {\n\t\tlockedCtx.mu.Lock()\n\t\tlockedCtx.SessionId = sessionId // just in case - should always match\n\t\timsi = lockedCtx.Imsi\n\t\tlockedCtx.locked = true\n\t}\n\n\tif timer != nil {\n\t\ttimer.Stop()\n\t}\n\treturn imsi, lockedCtx, exist\n}", "func RemoveSession(ctxid int64) {\n\tdelete(sessionBuf, ctxid)\n}", "func (session *Session) Remove() {\r\n\tsessionMutex.Lock()\r\n\tdelete(sessions, session.ID)\r\n\tsessionMutex.Unlock()\r\n}", "func (p *PersistentStorage) RemoveSimSession(simID string) error {\n\tdefer func(now time.Time) {\n\t\trequestTime.With(\"method\", removeSimSession, \"data_store\", redisStore).Observe(time.Since(now).Seconds() * 1e3)\n\t}(time.Now())\n\n\tconn := p.pool.Get()\n\tdefer conn.Close()\n\n\tkey := fmt.Sprintf(simSessionKeyFmt, simID)\n\t_, err := conn.Do(\"DEL\", key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (m *Session) Remove(ctx context.Context, req *proto.SessionRequest, rsp *proto.SessionResponse) error {\n\tservice.Remove(req.Account)\n\treturn nil\n}", "func RemoveSessions() {\n\tus := models.UserSession{}\n\tc := dbSession.Find(bson.M{}).Iter()\n\tfor c.Next(&us) {\n\t\tif time.Now().Sub(us.CreatedAt).Seconds() >= 3600 {\n\t\t\tdbSession.Remove(struct{ UUID string }{UUID: string(us.UUID)})\n\t\t\tfmt.Println(\"dropping sessions...\")\n\t\t}\n\t}\n\tif err := c.Close(); err != nil {\n\t\tfmt.Println(\"Iterations completed\")\n\t\treturn\n\t}\n\tfmt.Println(\"Closed successfully\")\n}", "func (l *localSimHostStorage) RemoveSimSession(simID string) error {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\n\tdelete(l.simSessions, simID)\n\n\treturn nil\n}", "func (ctx *MqttSrvContext) RemoveSession(fd int) {\n\tctx.Clock.Lock()\n\tdelete(ctx.Connections, fd)\n\tctx.Clock.Unlock()\n}", "func (pool *SessionPool) removeSessionFromActive(session *pureSession) {\n\tpool.rwLock.Lock()\n\tdefer pool.rwLock.Unlock()\n\tl := &pool.activeSessions\n\tfor ele := l.Front(); ele != nil; ele = ele.Next() {\n\t\tif ele.Value.(*pureSession) == session {\n\t\t\tl.Remove(ele)\n\t\t}\n\t}\n}", "func (sm *SessionMap) Delete(sessionID string) {\n\tsm.Lock.Lock()\n\tdefer sm.Lock.Unlock()\n\n\tif _, ok := sm.Sessions[sessionID]; ok {\n\t\tdelete(sm.Sessions, sessionID)\n\t}\n}", "func SessionDestroy(SID string) {\n\tSessionMapLock.Lock()\n\tdefer SessionMapLock.Unlock()\n\n\tlogging.Debug(&map[string]string{\n\t\t\"file\": \"session.go\",\n\t\t\"Function\": \"SessionDestroy\",\n\t\t\"event\": \"Destroy session\",\n\t\t\"SID\": SID,\n\t})\n\tdelete(SessionMap, SID)\n}", "func SessionCleanup() {\n\tfor {\n\t\tselect {\n\t\tcase <-time.After(SessionManager.SessionCleanupTime * time.Minute):\n\t\t\tSessionManager.ReqSessionMem <- 1 // ask to access the shared mem, blocks until granted\n\t\t\t<-SessionManager.ReqSessionMemAck // make sure we got it\n\t\t\tss := make(map[string]*Session, 0) // here's the new Session list\n\t\t\tn := 0 // total number removed\n\t\t\tfor k, v := range Sessions { // look at every Session\n\t\t\t\tif time.Now().After(v.Expire) { // if it's still active...\n\t\t\t\t\tn++ // removed another\n\t\t\t\t} else {\n\t\t\t\t\tss[k] = v // ...copy it to the new list\n\t\t\t\t}\n\t\t\t}\n\t\t\tSessions = ss // set the new list\n\t\t\tSessionManager.ReqSessionMemAck <- 1 // tell SessionDispatcher we're done with the data\n\t\t\t//fmt.Printf(\"SessionCleanup completed. %d removed. Current Session list size = %d\\n\", n, len(Sessions))\n\t\t}\n\t}\n}", "func FindSession(name string) (*Session, error) {\n\tss, err := FindSessionFunc(func(s *Session) (match bool, cont bool) {\n\t\treturn s.Name == name, s.Name != name\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(ss) == 0 {\n\t\treturn nil, nil\n\t}\n\n\treturn ss[0], nil\n}", "func removeNodeSession(id int64) error {\n\tkv, err := etcdkv.NewEtcdKV(Params.EtcdEndpoints, Params.MetaRootPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = kv.Remove(fmt.Sprintf(\"session/\"+typeutil.QueryNodeRole+\"-%d\", id))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (sim *SessionInterestManager) RemoveSessionInterested(ses uint64, ks []cid.Cid) []cid.Cid {\n\tsim.lk.Lock()\n\tdefer sim.lk.Unlock()\n\n\t// The keys that no session is interested in\n\tdeletedKs := make([]cid.Cid, 0, len(ks))\n\n\t// For each key\n\tfor _, c := range ks {\n\t\t// If there is a list of sessions that want the key\n\t\tif _, ok := sim.wants[c]; ok {\n\t\t\t// Remove the session from the list of sessions that want the key\n\t\t\tdelete(sim.wants[c], ses)\n\n\t\t\t// If there are no more sessions that want the key\n\t\t\tif len(sim.wants[c]) == 0 {\n\t\t\t\t// Clean up the list memory\n\t\t\t\tdelete(sim.wants, c)\n\t\t\t\t// Add the key to the list of keys that no session is interested in\n\t\t\t\tdeletedKs = append(deletedKs, c)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn deletedKs\n}", "func SessionDelete(s *Session) {\n\tfmt.Printf(\"Session being deleted: %s\\n\", s.ToString())\n\t// fmt.Printf(\"sess.Sessions before delete:\\n\")\n\t// DumpSessions()\n\n\tif err := db.DeleteSessionCookie(s.Token); err != nil {\n\t\tlib.Ulog(\"Error deleting session cookie: %s\\n\", err.Error())\n\t}\n\n\tss := make(map[string]*Session, 0)\n\n\tSessionManager.ReqSessionMem <- 1 // ask to access the shared mem, blocks until granted\n\t<-SessionManager.ReqSessionMemAck // make sure we got it\n\tfor k, v := range Sessions {\n\t\tif s.Token != k {\n\t\t\tss[k] = v\n\t\t}\n\t}\n\tSessions = ss\n\tSessionManager.ReqSessionMemAck <- 1 // tell SessionDispatcher we're done with the data\n\t// fmt.Printf(\"sess.Sessions after delete:\\n\")\n\t// DumpSessions()\n}", "func (client BastionClient) deleteSession(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {\n\thttpRequest, err := request.HTTPRequest(http.MethodDelete, \"/sessions/{sessionId}\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response DeleteSessionResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func LookupSession(id string) (Account, error) {\n\ts, err := persistenceInstance.session(id)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif time.Now().After(s.expires) {\n\t\tDeleteSession(id)\n\t\treturn nil, errors.New(\"Session Expired\")\n\t}\n\n\treturn s.account, nil\n}", "func (s *s6aProxy) cleanupSession(sid string) chan interface{} {\n\ts.sessionsMu.Lock()\n\toldCh, ok := s.sessions[sid]\n\tif ok {\n\t\tdelete(s.sessions, sid)\n\t\ts.sessionsMu.Unlock()\n\t\tif oldCh != nil {\n\t\t\tclose(oldCh)\n\t\t}\n\t\treturn oldCh\n\t}\n\ts.sessionsMu.Unlock()\n\treturn nil\n}", "func (s *State) RemoveSession(sessionID string) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\ts.unlockedRemoveSession(sessionID)\n}", "func (h *Hub) RemoveSession(s *Session) {\n\th.register <- HubRegistration{event: \"remove\", session: s}\n}", "func (matcher *JoinSession) RemoveSessionID(sessionID SessionID) error {\n\t_, ok := matcher.SessionData.Participants[sessionID]\n\tif ok {\n\t\tdelete(matcher.SessionData.Participants, sessionID)\n\t\tlog.Infof(\"SessionID %v disconnected, remove from join session\", sessionID)\n\t\treturn nil\n\t}\n\treturn ErrSessionIDNotFound\n}", "func DeleteSession(session *Session) {\r\n\tsessionListMutex.Lock()\r\n\tdefer sessionListMutex.Unlock()\r\n\r\n\tdelete(sessionList, session.Key)\r\n\tfmt.Printf(\"Delete session %d\\n\", session.Key)\r\n}", "func FindSessionFunc(fn func(*Session) (match bool, cont bool)) (Sessions, error) {\n\tss, err := ListSessions()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsessions := []*Session{}\n\tfor _, s := range ss {\n\t\tmatch, cont := fn(s)\n\t\tif match {\n\t\t\tsessions = append(sessions, s)\n\t\t}\n\t\tif !cont {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn sessions, nil\n}", "func (mmap *stateSyncMap) remove(key string) error {\n\treturn mmap.Remove(key)\n}", "func (arr *SRArr) DelRSNode(sp *SessionPair) error {\n\n\tdid := sp.did\n\t//fmt.Println(\"DelRSNode did=\", did, \"sid=\", sp.SessionID)\n\tfindPos := sort.Search(len(*arr), func(i int) bool {\n\t\treturn (*arr)[i].Did >= did\n\t})\n\n\tif findPos < len(*arr) {\n\t\tfor ; findPos < len(*arr); findPos++ {\n\t\t\tif (*arr)[findPos].SpPtr.SessionID == sp.SessionID {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif findPos < len(*arr) {\n\t\t\tdelNode(arr, findPos)\n\t\t} else {\n\t\t\treturn errors.New(\"no session found\")\n\t\t}\n\t} else {\n\t\treturn errors.New(\"no session found\")\n\t}\n\n\t// Check if has deleted in the SRArr\n\tfindPos = sort.Search(len(*arr), func(i int) bool {\n\t\treturn (*arr)[i].Did >= did\n\t})\n\n\t// Double Check\n\t_, findErr := arr.FindSess(sp)\n\tif findErr != nil {\n\t\terrMsg := \"remove session fail sessionid=\" + string(sp.SessionID) + \"and session exist\"\n\t\treturn errors.New(errMsg)\n\t}\n\treturn nil\n}", "func RemoveSessionByID(id bson.ObjectId) (err error) {\n\tsessions, err := collection.Sessions()\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn err\n\t}\n\tdefer sessions.Close()\n\n\terr = sessions.Remove(bson.M{\"_id\": id})\n\tif err != nil && err != mgo.ErrNotFound {\n\t\tlogger.Error(err)\n\t}\n\n\treturn\n}", "func (s *Server) removeSession(conn net.Conn) {\n\tif conn != nil {\n\t\tcommon.LogI(\"Session removed for client: %s\", conn.RemoteAddr().String())\n\t\tconn.Close()\n\t\ts.clients.Delete(conn)\n\t}\n}", "func CheckSessionIDexists(sessionID string, FileCarveSessionMap map[string]*FilCarveSession) bool {\n\tif _, exist := FileCarveSessionMap[sessionID]; !exist {\n\t\tfor k := range FileCarveSessionMap {\n\t\t\tlog.Println(k)\n\t\t}\n\t\treturn false\n\t}\n\treturn true\n}", "func (p *PersistentStorage) FindSimSession(simID string) (*SimulatorSession, error) {\n\tdefer func(now time.Time) {\n\t\trequestTime.With(\"method\", findSimSession, \"data_store\", redisStore).Observe(time.Since(now).Seconds() * 1e3)\n\t}(time.Now())\n\n\tkey := fmt.Sprintf(simSessionKeyFmt, simID)\n\tsimSession := new(SimulatorSession)\n\terr := p.getRedisJSON(\"GET\", key, \"\", simSession)\n\tif err != nil {\n\t\tif err == redis.ErrNil {\n\t\t\treturn nil, ErrNoSimSession\n\t\t}\n\n\t\treturn nil, err\n\t}\n\n\treturn simSession, nil\n}", "func (sp *SessionProvider) Remove(db, c string, q interface{}) error {\n\tsession, err := sp.GetSession()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer session.Close()\n\t_, err = session.DB(db).C(c).RemoveAll(q)\n\treturn err\n}", "func (opt *GuacamoleHTTPTunnelMap) Remove(uuid string) (*GuacamoleHTTPTunnel, bool) {\n\n\topt.tunnelMapLock.RLock()\n\tv, ok := opt.tunnelMap[uuid]\n\topt.tunnelMapLock.RUnlock()\n\n\tif ok {\n\t\topt.tunnelMapLock.Lock()\n\t\tdelete(opt.tunnelMap, uuid)\n\t\topt.tunnelMapLock.Unlock()\n\t}\n\treturn v, ok\n}", "func (sim *SessionInterestManager) RemoveSessionWants(ses uint64, ks []cid.Cid) {\n\tsim.lk.Lock()\n\tdefer sim.lk.Unlock()\n\n\t// For each key\n\tfor _, c := range ks {\n\t\t// If the session wanted the block\n\t\tif wanted, ok := sim.wants[c][ses]; ok && wanted {\n\t\t\t// Mark the block as unwanted\n\t\t\tsim.wants[c][ses] = false\n\t\t}\n\t}\n}", "func (s Session) removePlayer(index int) {\n\ts.PlayerMap, s.PlayerMap[len(s.PlayerMap)-1] = append(s.PlayerMap[:index], s.PlayerMap[index+1:]...), nil\n\t//Update all player numbers greater than deleted index\n\tfor i := index; i < len(s.PlayerMap); i++ {\n\t\ts.PlayerMap[i].SetPlayer(i)\n\t}\n}", "func (*adminCtrl) findSessionByID(c *elton.Context) (err error) {\n\tstore := cache.GetRedisSession()\n\tdata, err := store.Get(c.Param(\"id\"))\n\tif err != nil {\n\t\treturn\n\t}\n\tc.Body = &findSessionResp{\n\t\tData: string(data),\n\t}\n\treturn\n}", "func EndSession(sessionKey string, rs RedisStore, sid string) (string, error) {\n\t\n\t_, err := ValidateID(sid, sessionKey)\n\n\tif err != nil {\n\t\treturn \"\", errors.New(\"Invalid Session ID\")\n\t}\n\n\trs.Delete(sid)\n\n\treturn sid, nil\n}", "func (s *Sessions) DelByID(sessionID string) {\n\t// Lock for mutex\n\ts.Lock()\n\tdefer s.Unlock()\n\t// check for session exist in map and delete\n\t_, ok := s.sessions[sessionID]\n\tif !ok {\n\t\tlog.Println(\"Trying to remove unexistent sessionID:\", sessionID)\n\t\treturn\n\t}\n\t//close websocket\n\ts.sessions[sessionID].Actualizer.CloseChan <- true\n\tdelete(s.sessions, sessionID)\n}", "func (l *localSimHostStorage) FindSimSession(simID string) (*SimulatorSession, error) {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\n\tsimSession, ok := l.simSessions[simID]\n\tif !ok {\n\t\treturn nil, ErrNoSimSession\n\t}\n\treturn simSession, nil\n}", "func (h *WebDriverHub) RemoveSession(id string) {\n\th.mu.Lock()\n\tdefer h.mu.Unlock()\n\tif h.sessions == nil {\n\t\treturn\n\t}\n\tdelete(h.sessions, id)\n}", "func RemoveSessionByUUID(uuid string) (err error) {\n\tsessions, err := collection.Sessions()\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn err\n\t}\n\tdefer sessions.Close()\n\n\terr = sessions.Remove(bson.M{\"uuid\": uuid})\n\tif err != nil && err != mgo.ErrNotFound {\n\t\tlogger.Error(err)\n\t}\n\n\treturn\n}", "func FindCounterIdBySession(countersReader *counters.Reader, sessionId int32) int32 {\n\treturn countersReader.FindCounter(RECORDING_POSITION_COUNTER_TYPE_ID, func(keyBuffer *atomic.Buffer) bool {\n\t\treturn keyBuffer.GetInt32(SESSION_ID_OFFSET) == sessionId\n\t})\n}", "func (r *SmscSessionRepository) FindById(ID string) (*openapi.SmscSession, error) {\n\tentity := openapi.NewSmscSessionWithDefaults()\n\terr := app.BuntDBInMemory.View(func(tx *buntdb.Tx) error {\n\t\tvalue, err := tx.Get(SMSC_SESSION_PREFIX + ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := json.Unmarshal([]byte(value), entity); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n\treturn entity, err\n}", "func (d *Abstraction) CloseSession() {\n\tfor k, v := range d.Sigmap {\n\t\tdelete(d.Sigmap, k)\n\t\tclose(v)\n\t}\n\td.Conn.RemoveSignal(d.Recv)\n\td.Conn.Close()\n}", "func (wectxs *WorkflowContextsMap) Remove(id int64) int64 {\n\twectxs.safeMap.Delete(id)\n\treturn id\n}", "func (m *MockInterface) RemoveSession(arg0 *userService.Sid) (*userService.Uid, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RemoveSession\", arg0)\n\tret0, _ := ret[0].(*userService.Uid)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (m *Driver) FindSession(filter *models.SessionFilter) ([]models.Session, error) {\n\t// DB-specific session struct\n\tvar mSesses []Session\n\n\texpression := `^` + filter.Keyword\n\n\tobjectIDStart := bson.NewObjectIdWithTime(filter.TimestampStart)\n\tobjectIDEnd := bson.NewObjectIdWithTime(filter.TimestampEnd)\n\n\t// check whether valid session\n\terr := m.DB.C(\"sessions\").Find(\n\t\tbson.M{\"$and\": []bson.M{\n\t\t\tbson.M{\"keyword\": bson.M{\"$regex\": bson.RegEx{Pattern: expression, Options: \"\"}}},\n\t\t\tbson.M{\"_id\": bson.M{\"$gte\": objectIDStart}},\n\t\t\tbson.M{\"_id\": bson.M{\"$lte\": objectIDEnd}}}}).All(&mSesses)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// transform into DB-neural struct\n\tsesses := make([]models.Session, len(mSesses))\n\tfor i, s := range mSesses {\n\t\tsesses[i] = models.Session{\n\t\t\tID: s.ID.Hex(),\n\t\t\tKeyword: s.Keyword,\n\t\t\tVersion: s.Version,\n\t\t\tTimestamp: s.ID.Time(),\n\t\t\tSchemas: s.Schemas,\n\t\t\tMetadata: s.Metadata,\n\t\t}\n\t}\n\n\treturn sesses, nil\n}", "func (pg *PGClient) LookupSession(token string) (*int, error) {\n\tsess := model.Session{}\n\terr := pg.DB.Get(&sess, lookupSession, token)\n\tif err == sql.ErrNoRows {\n\t\treturn nil, ErrSessionNotFound\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn sess.TherapistID, nil\n}", "func (pool *SessionPool) returnSession(session *pureSession) {\n\tpool.rwLock.Lock()\n\tdefer pool.rwLock.Unlock()\n\tl := &pool.activeSessions\n\tfor ele := l.Front(); ele != nil; ele = ele.Next() {\n\t\tif ele.Value.(*pureSession) == session {\n\t\t\tl.Remove(ele)\n\t\t}\n\t}\n\tl = &pool.idleSessions\n\tl.PushBack(session)\n\tsession.returnedAt = time.Now()\n}", "func (s *State) RemoveSession(ctx context.Context, sessionID string) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tdlog.Debugf(ctx, \"Session %s removed. Explicit removal\", sessionID)\n\n\ts.unlockedRemoveSession(sessionID)\n}", "func (w *WindowedMap) Remove(uid UID) (interface{}, bool) {\n\tw.ExpireOldEntries()\n\titem, ok := w.uidMap[uid]\n\tif !ok {\n\t\treturn nil, false\n\t}\n\theap.Remove(&w.uidList, item.index)\n\tdelete(w.uidMap, uid)\n\treturn item.value, true\n}", "func (mng *InMemSessManager) OnSessionLookup(key string) (*wwr.Session, error) {\n\tmng.lock.RLock()\n\tdefer mng.lock.RUnlock()\n\tif clt, exists := mng.sessions[key]; exists {\n\t\treturn clt.Session(), nil\n\t}\n\treturn nil, nil\n}", "func (ms *MemStore) CleanupSessionKeys(t uint64) error {\n\tvar oldKeys []string\n\tfor hash, sk := range ms.sessionKeys {\n\t\tif sk.cleanupTime < t {\n\t\t\toldKeys = append(oldKeys, hash)\n\t\t}\n\t}\n\tfor _, hash := range oldKeys {\n\t\tdelete(ms.sessionKeys, hash)\n\t}\n\treturn nil\n}", "func SessionExists(SID string) bool {\n\t_, exists := SessionMap[SID]\n\treturn exists\n}", "func (s *BoltState) RemoveExecSession(session *ExecSession) error {\n\tif !s.valid {\n\t\treturn define.ErrDBClosed\n\t}\n\n\tdb, err := s.getDBCon()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer s.deferredCloseDBCon(db)\n\n\tsessionID := []byte(session.ID())\n\tcontainerID := []byte(session.ContainerID())\n\terr = db.Update(func(tx *bolt.Tx) error {\n\t\texecBucket, err := getExecBucket(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tctrBucket, err := getCtrBucket(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tsessionExists := execBucket.Get(sessionID)\n\t\tif sessionExists == nil {\n\t\t\treturn define.ErrNoSuchExecSession\n\t\t}\n\t\t// Check that container ID matches\n\t\tif string(sessionExists) != session.ContainerID() {\n\t\t\treturn fmt.Errorf(\"database inconsistency: exec session %s points to container %s in state but %s in database: %w\", session.ID(), session.ContainerID(), string(sessionExists), define.ErrInternal)\n\t\t}\n\n\t\tif err := execBucket.Delete(sessionID); err != nil {\n\t\t\treturn fmt.Errorf(\"removing exec session %s from database: %w\", session.ID(), err)\n\t\t}\n\n\t\tdbCtr := ctrBucket.Bucket(containerID)\n\t\tif dbCtr == nil {\n\t\t\t// State is inconsistent. We refer to a container that\n\t\t\t// is no longer in the state.\n\t\t\t// Return without error, to attempt to recover.\n\t\t\treturn nil\n\t\t}\n\n\t\tctrExecBucket := dbCtr.Bucket(execBkt)\n\t\tif ctrExecBucket == nil {\n\t\t\t// Again, state is inconsistent. We should have an exec\n\t\t\t// bucket, and it should have this session.\n\t\t\t// Again, nothing we can do, so proceed and try to\n\t\t\t// recover.\n\t\t\treturn nil\n\t\t}\n\n\t\tctrSessionExists := ctrExecBucket.Get(sessionID)\n\t\tif ctrSessionExists != nil {\n\t\t\tif err := ctrExecBucket.Delete(sessionID); err != nil {\n\t\t\t\treturn fmt.Errorf(\"removing exec session %s from container %s in database: %w\", session.ID(), session.ContainerID(), err)\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\treturn err\n}", "func DeleteSession(sessionID string) error {\n\tkey := stringutil.Build(\"sessionid:\", sessionID, \":userid\")\n\terr := Delete(key)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot delete key from Redis\")\n\t}\n\treturn nil\n}", "func FindSession(clientId string) (*Session, error) {\n\tmeta := broker.GetService(ServiceName).(*MetadataService)\n\treturn meta.findSession(clientId)\n}", "func (ss *SessionStore) removeSessionFromLRU(session *Session) {\n\tif(session.next != nil) {\n\t\tsession.next.prev = session.prev\n\t}\n\tif(session.prev != nil) {\n\t\tsession.prev.next = session.next\n\t}\n\tif(ss.listLRU.head == session) {\n\t\tss.listLRU.head = session.next\n\t}\n\tif(ss.listLRU.tail == session) {\n\t\tss.listLRU.head = session.prev\n\t}\n\tsession.next = nil\n\tsession.prev = nil\n}", "func (ks *MemoryStore) Remove(name string) (err error) {\n\tif _, ok := ks.Keys[name]; !ok {\n\t\treturn errors.New(\"Not found\")\n\t}\n\n\tdelete(ks.Keys, name)\n\tdelete(ks.KeyIdMap, name)\n\treturn\n}", "func findSessionInfoIndex(sessions []model.SessionInfo, sessionInfo model.SessionInfo) int {\n\tfor i := range sessions {\n\t\tif sessions[i].ServerID == sessionInfo.ServerID && sessions[i].SessionID == sessionInfo.SessionID {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func (session *NetSession) CloseSession() error {\n\tsession.Bufio.Flush()\n\tsession.Conn.Close()\n\tsession.Conn = nil\n\tvar returnErr error = nil\n\tif pps, ok := session.PusherPullersSessionMap[session.ReourcePath]; ok {\n\t\tif errs := pps.StopSession(&session.ID); len(errs) != 0 {\n\t\t\tfor index, err := range errs {\n\t\t\t\treturnErr = fmt.Errorf(\"%v\\nindex = %v,error = %v\", returnErr, index, err)\n\t\t\t}\n\t\t}\n\t\tif session.SessionType == PusherClient {\n\t\t\t// if this session is pusher ,\n\t\t\t// we need free all resource include puller's resource\n\t\t\tsession.PusherPullersSessionMapMutex.Lock()\n\t\t\tdelete(session.PusherPullersSessionMap, session.ReourcePath)\n\t\t\tsession.PusherPullersSessionMapMutex.Unlock()\n\t\t}\n\t}\n\treturn returnErr\n}", "func (c *Controller) DelSession(name interface{}) error {\n\tif c.CruSession == nil {\n\t\tc.StartSession()\n\t}\n\treturn c.CruSession.Delete(context2.Background(), name)\n}", "func (p *Plex) KillTranscodeSession(sessionKey string) (bool, error) {\n\trequestInfo.headers.Token = p.token\n\n\tif sessionKey == \"\" {\n\t\treturn false, errors.New(\"Missing sessionKey\")\n\t}\n\n\tquery := p.URL + \"/video/:/transcode/universal/stop?session=\" + sessionKey\n\n\tresp, respErr := requestInfo.get(query)\n\n\tif respErr != nil {\n\t\treturn false, respErr\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode == 401 {\n\t\treturn false, errors.New(\"You are not authorized to access this server\")\n\t} else if resp.StatusCode != 200 {\n\t\tstatusCode := strconv.Itoa(resp.StatusCode)\n\t\treturn false, errors.New(\"Server replied with \" + statusCode + \" status code\")\n\t}\n\n\treturn true, nil\n}", "func (pc *PFCPConnection) ForgetSession(seid SEID) bool {\n\tpc.Lock()\n\tdefer pc.Unlock()\n\t_, found := pc.sessions[seid]\n\tif !found {\n\t\treturn false\n\t}\n\tdelete(pc.sessions, seid)\n\treturn true\n}", "func (m *MockUserDB) RemoveSession(sid string) (error, uint64) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RemoveSession\", sid)\n\tret0, _ := ret[0].(error)\n\tret1, _ := ret[1].(uint64)\n\treturn ret0, ret1\n}", "func (js *jsonfileSessionRepository) Remove(name string) error {\n\tpath := PathFromName(name)\n\texists, err := checkFile(path)\n\tif !exists {\n\t\treturn nil\n\t}\n\tif err != nil {\n\t\treturn errors.Errorf(\"cannot remove session file '%s': %v\", path, err)\n\t}\n\terr = os.Remove(path)\n\tif err != nil {\n\t\treturn errors.Errorf(\"cannot remove session file '%s': %v\", path, err)\n\t}\n\n\treturn nil\n}", "func (sr *SessionGormRepo) Session(sessionID string) (*entity.Session, []error) {\n\tsession := entity.Session{}\n\terrs := sr.conn.Find(&session, \"uuid=?\", sessionID).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn &session, errs\n}", "func (pdr *ProviderMySQL) SessionDestroy(sid string) error {\n\tc := pdr.connectInit()\n\tdefer func() {\n\t\terr := c.Close()\n\t\tif err != nil {\n\t\t\tsession.SLogger.Println(err)\n\t\t}\n\t}()\n\n\t_, err := c.Exec(\"DELETE FROM \"+TableName+\" where session_key=?\", sid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (sm *SessionMap) Get(sessionID string) (*Session, bool) {\n\tsm.Lock.RLock()\n\tdefer sm.Lock.RUnlock()\n\n\tsession, ok := sm.Sessions[sessionID]\n\treturn session, ok\n}", "func (st *State) Session(id string) *cache.Session {\n\tfor _, s := range st.Sessions() {\n\t\tif s.ID() == id {\n\t\t\treturn s\n\t\t}\n\t}\n\treturn nil\n}", "func (s *Session) Remove(key *Key) (err error) {\n\tatomic.AddUint64(&cDeletes, 1)\n\n\tvar cflags C.uint64_t\n\tvar ioflags C.uint64_t\n\terr = Error(C.dnet_remove_object_now(s.session, &key.id, cflags, ioflags))\n\treturn\n}", "func (sr *SessionGormRepo) DeleteSession(sessionID string) (*entity.Session, []error) {\n\tsess, errs := sr.Session(sessionID)\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\terrs = sr.conn.Delete(sess, sess.ID).GetErrors()\n\tif len(errs) > 0 {\n\t\treturn nil, errs\n\t}\n\treturn sess, errs\n}", "func (s *service) DeleteSession(sessionID string) (*Session, []error) {\n\treturn (*s.repo).DeleteSession(sessionID)\n}", "func (j *JPNSoftwareMap) Del(ID string) (ok bool) {\n\tdelete(*j, ID)\n\tok = j.Has(ID) == false\n\treturn\n}", "func Remove(collection string, query interface{}) error {\n\tsession, db, err := GetGlobalSessionFactory().GetSession()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer session.Close()\n\n\treturn db.C(collection).Remove(query)\n}", "func (dsm DSM) EndSession() {\n\turl := fmt.Sprintf(\"%sauthentication/logout\", dsm.RestURL)\n\t_, err := grequests.Delete(url, &grequests.RequestOptions{HTTPClient: &dsm.RestClient, Params: map[string]string{\"sID\": dsm.SessionID}})\n\n\tif err != nil {\n\t\tlog.Println(\"Unable to make request\", err)\n\t}\n\n}", "func TestTwoFactorSessionDelete(t *testing.T) {\n\tevents := metrics.New()\n\tif testing.Verbose() {\n\t\tevents = metrics.New(custom.StackDisplay(os.Stdout))\n\t}\n\tapi := mdb.New(testCol, events, mdb.NewMongoDB(config))\n\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\telem, err := fixtures.LoadTwoFactorSessionJSON(fixtures.TwoFactorSessionJSON)\n\tif err != nil {\n\t\ttests.Failed(\"Successfully loaded JSON for TwoFactorSession record: %+q.\", err)\n\t}\n\ttests.Passed(\"Successfully loaded JSON for TwoFactorSession record\")\n\n\tif err := api.Create(ctx, elem); err != nil {\n\t\ttests.Failed(\"Successfully added record for TwoFactorSession into db: %+q.\", err)\n\t}\n\ttests.Passed(\"Successfully added record for TwoFactorSession into db.\")\n\n\tif err := api.Delete(ctx, elem.PublicID); err != nil {\n\t\ttests.Failed(\"Successfully removed record for TwoFactorSession into db: %+q.\", err)\n\t}\n\ttests.Passed(\"Successfully removed record for TwoFactorSession into db.\")\n\n\tif _, err = api.Get(ctx, elem.PublicID); err == nil {\n\t\ttests.Failed(\"Successfully failed to get deleted record for TwoFactorSession into db.\")\n\t}\n\ttests.Passed(\"Successfully failed to get deleted record for TwoFactorSession into db.\")\n}", "func (client BastionClient) updateSession(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {\n\thttpRequest, err := request.HTTPRequest(http.MethodPut, \"/sessions/{sessionId}\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response UpdateSessionResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func RemoveUserSession(userID int, sessionID string) error {\n\tkey := stringutil.Build(\"userid:\", strconv.Itoa(userID), \":sessionids\")\n\terr := SetRemoveMember(key, sessionID)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot remove member from set in Redis\")\n\t}\n\treturn nil\n}", "func (k Keeper) RemoveCalim(ctx sdk.Context, id uint64) {\n\tstore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CalimKey))\n\tstore.Delete(GetCalimIDBytes(id))\n}", "func (asr *sessionRegistry) deregister(clt *Client) {\n\tasr.lock.Lock()\n\tdelete(asr.registry, clt.Session.Key)\n\tasr.lock.Unlock()\n}", "func (sta StandardAuthenticator) DestroySession(sessionId string) error {\n\treturn nil\n}", "func (handler *IdentityProviderHandler) DeleteSession(sessionID string, userAgent string, remoteAddr string) (r bool, err error) {\n\thandler.log.Printf(\"deleteSession(%v, %v, %v)\", sessionID, userAgent, remoteAddr)\n\n\tsession, err := handler.SessionInteractor.Find(sessionID)\n\tif err != nil {\n\t\te := err.(*errs.Error)\n\t\treturn false, errorToServiceError(e)\n\t}\n\n\tif !session.Domain.Enabled || !session.User.Enabled {\n\t\te := services.NewUnauthorizedError()\n\t\te.Msg = \"Domain and/or user disabled\"\n\t\treturn false, e\n\t}\n\n\tif session.UserAgent != userAgent || session.RemoteAddr != remoteAddr {\n\t\te := services.NewNotFoundError()\n\t\te.Msg = \"Session not found\"\n\t\treturn false, e\n\t}\n\n\tif session.IsExpired() {\n\t\te := services.NewUnauthorizedError()\n\t\te.Msg = \"Session expired\"\n\t\treturn false, e\n\t}\n\n\terr = handler.SessionInteractor.Delete(*session)\n\tif err != nil {\n\t\te := err.(*errs.Error)\n\t\treturn false, errorToServiceError(e)\n\t}\n\n\treturn true, nil\n}", "func delayUnregister(session *model.Session) {\n\ttime.Sleep(time.Second * 5)\n\t//TODO do something better perhaps a seperate queue for the messages that will be deleted.\n\tdefer mutex.Unlock()\n\tmutex.Lock()\n\n\tdelete(tokenAvailable, session.SessionToken)\n\tdelete(sessionCache, session.SocketID)\n\tdelete(userCache, session.UserID)\n\tmodel.DB().Delete(session) //Remove the session\n\n}", "func (m *Manager) Remove(globalid string) error {\n\treturn m.collection.Remove(bson.M{\"globalid\": globalid})\n}", "func (pder *MemProvider) SessionExist(sid string) bool {\n\tres, _ := (*session.MemProvider)(pder).SessionExist(context.Background(), sid)\n\treturn res\n}", "func (v *Voice) RemoveSession(guildID discord.GuildID) {\n\tv.mapmutex.Lock()\n\tdefer v.mapmutex.Unlock()\n\n\t// Ensure that the session is disconnected.\n\tif ses, ok := v.sessions[guildID]; ok {\n\t\tses.Disconnect()\n\t}\n\n\tdelete(v.sessions, guildID)\n}", "func RealmIDFromSession(session *sessions.Session) uint {\n\tv := sessionGet(session, sessionKeyRealmID)\n\tif v == nil {\n\t\treturn 0\n\t}\n\n\tt, ok := v.(uint)\n\tif !ok {\n\t\tdelete(session.Values, sessionKeyRealmID)\n\t\treturn 0\n\t}\n\n\treturn t\n}", "func removeClass(id int) (int, error) {\n\tcdb.mu.Lock()\n\tdefer cdb.mu.Unlock()\n\n\tif _, ok := cdb.classMap[id]; ok {\n\t\tdelete(cdb.classMap, id)\n\t\treturn id, nil\n\t}\n\treturn -1, fmt.Errorf(\"Class not found in database\")\n\n}", "func (r *SmscSessionRepository) Delete(entity *openapi.SmscSession) error {\n\treturn app.BuntDBInMemory.Update(func(tx *buntdb.Tx) error {\n\t\t_, err := tx.Delete(SMSC_SESSION_PREFIX + entity.GetId())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}", "func (e *Entry) remove(c connection.Connection) {\n\te.connSync.Lock()\n\tdefer e.connSync.Unlock()\n\tif _, ok := e.idle[c.String()]; ok {\n\t\tc.Remove(e.listener[c.String()])\n\t\tdelete(e.idle, c.String())\n\t\tdelete(e.listener, c.String())\n\t}\n\treturn\n}", "func (s *BoltState) RemoveContainerExecSessions(ctr *Container) error {\n\tif !s.valid {\n\t\treturn define.ErrDBClosed\n\t}\n\n\tif !ctr.valid {\n\t\treturn define.ErrCtrRemoved\n\t}\n\n\tdb, err := s.getDBCon()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer s.deferredCloseDBCon(db)\n\n\tctrID := []byte(ctr.ID())\n\tsessions := []string{}\n\n\terr = db.Update(func(tx *bolt.Tx) error {\n\t\texecBucket, err := getExecBucket(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tctrBucket, err := getCtrBucket(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdbCtr := ctrBucket.Bucket(ctrID)\n\t\tif dbCtr == nil {\n\t\t\tctr.valid = false\n\t\t\treturn define.ErrNoSuchCtr\n\t\t}\n\n\t\tctrExecSessions := dbCtr.Bucket(execBkt)\n\t\tif ctrExecSessions == nil {\n\t\t\treturn nil\n\t\t}\n\n\t\terr = ctrExecSessions.ForEach(func(id, unused []byte) error {\n\t\t\tsessions = append(sessions, string(id))\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, session := range sessions {\n\t\t\tif err := ctrExecSessions.Delete([]byte(session)); err != nil {\n\t\t\t\treturn fmt.Errorf(\"removing container %s exec session %s from database: %w\", ctr.ID(), session, err)\n\t\t\t}\n\t\t\t// Check if the session exists in the global table\n\t\t\t// before removing. It should, but in cases where the DB\n\t\t\t// has become inconsistent, we should try and proceed\n\t\t\t// so we can recover.\n\t\t\tsessionExists := execBucket.Get([]byte(session))\n\t\t\tif sessionExists == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif string(sessionExists) != ctr.ID() {\n\t\t\t\treturn fmt.Errorf(\"database mismatch: exec session %s is associated with containers %s and %s: %w\", session, ctr.ID(), string(sessionExists), define.ErrInternal)\n\t\t\t}\n\t\t\tif err := execBucket.Delete([]byte(session)); err != nil {\n\t\t\t\treturn fmt.Errorf(\"removing container %s exec session %s from exec sessions: %w\", ctr.ID(), session, err)\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\treturn err\n}", "func (pq *packetQueue) remove(s *sender, seqno int64, scope int) {\n\tpq.Lock()\n\tdefer pq.Unlock()\n\tfor next := pq.Front(); next != nil; next = next.Next() {\n\t\tp := next.Value.(*Packet)\n\t\tif p.sender.getID() == s.id && p.seqno == seqno && p.scope == scope {\n\t\t\tpq.Remove(next)\n\t\t\tbreak\n\t\t}\n\t}\n}", "func (t Tremove) Rremove(err error) {\n\tt.session.conn.sessionFid.Del(t.fid)\n\tt.session.files.Del(t.fid)\n\n\tt.session.unhandled = false\n\tif !t.session.conn.clearTag(t.tag) {\n\t\t// cancelled, do not send response\n\t\treturn\n\t}\n\n\t// NOTE(droyo): This is not entirely correct; if the server wants\n\t// to implement unix-like semantics (the file hangs around as\n\t// long as there's 1 descriptor for it), we should not delete the\n\t// qid until *all* references to it are removed. We'll need to implement\n\t// reference counting for that :\\\n\tif err != nil {\n\t\tt.session.conn.Rerror(t.tag, \"%s\", err)\n\t} else {\n\t\tt.session.conn.qidpool.Del(t.Path())\n\t\tt.session.conn.Rremove(t.tag)\n\t}\n\n\tif !t.session.DecRef() {\n\t\tt.session.close()\n\t}\n}", "func (cctxs *ChildContextsMap) Remove(id int64) int64 {\n\tcctxs.safeMap.Delete(id)\n\treturn id\n}", "func (m *ttlMap) Remove(key interface{}) (Item, bool) {\n\top := &opRemove{\n\t\tkey: key,\n\t\tchanResponse: make(chan *opFetchResult, 1),\n\t}\n\tgo func() {\n\t\tm.processOnce()\n\t\tm.chanOp <- op\n\t}()\n\tr := <-op.chanResponse\n\treturn r.item, r.existed\n}", "func VerifySession(key string, user int) bool {\n\tvar sessions []Session\n\tdb.Where(\"user is ?\", user).Find(&sessions)\n\tfor i := range sessions {\n\t\tif sessions[i].Key == key {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}" ]
[ "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.5277773", "0.5265506", "0.52426374", "0.52415115", "0.52295405", "0.5227168", "0.52180237", "0.51819867", "0.51749617", "0.5171975", "0.5148011", "0.50961155", "0.509505", "0.5085657", "0.50790304", "0.50762665", "0.5068943", "0.5067443", "0.5065085", "0.505904", "0.50560474", "0.5052872", "0.5040597", "0.5035198", "0.501338", "0.5008361", "0.49946922", "0.49648812", "0.49542692", "0.49497095", "0.4944912", "0.4924982", "0.49183986", "0.49113566", "0.48999825", "0.4896517", "0.4894427", "0.48902646", "0.48846993", "0.4881775", "0.48688897", "0.4841954", "0.48376155", "0.482637", "0.48257297", "0.4810967", "0.4810471", "0.4803912", "0.4789882", "0.4787072", "0.4783502", "0.47658998", "0.47487107", "0.47423866", "0.47402447", "0.47281417", "0.47264388", "0.46967697", "0.46835908", "0.46832097", "0.46828443", "0.4679533", "0.4678994", "0.46789032", "0.4678406", "0.46750087", "0.4669044", "0.46652752", "0.46593845", "0.46568656", "0.46510664", "0.4643533", "0.4642716", "0.462946", "0.46210033", "0.461865", "0.46169603", "0.46080106", "0.46045625", "0.4604036" ]
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} else {\n\t\t\toldTimer, oldSession.CleanupTimer = oldSession.CleanupTimer, nil\n\t\t\tnewSession, oldSession.UserCtx = &SessionCtx{UserCtx: oldSession.UserCtx}, nil\n\t\t\ts.sessions[sessionId] = newSession\n\t\t\tnewSession.CleanupTimer = time.AfterFunc(timeout, func() {\n\t\t\t\tsessionTimeoutCleanup(s, sessionId, newSession)\n\t\t\t})\n\t\t}\n\t}\n\ts.rwl.Unlock()\n\n\tif oldTimer != nil {\n\t\toldTimer.Stop()\n\t}\n\treturn exist\n}", "func (s *Session) ResetInactivityTimeout(dur time.Duration) {\n\tif dur == 0 {\n\t\tdur = s.inactivityTimeout\n\t} else {\n\t\ts.inactivityTimeout = dur\n\t}\n\n\ts.inactivityTimer.Reset(dur)\n}", "func (tm *TimerManager) ClearTimeout(id int) bool {\n\n\tfor pos, t := range tm.timers {\n\t\tif t.id == id {\n\t\t\tcopy(tm.timers[pos:], tm.timers[pos+1:])\n\t\t\ttm.timers[len(tm.timers)-1] = timeout{}\n\t\t\ttm.timers = tm.timers[:len(tm.timers)-1]\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (f *Sink) resetTimeoutTimer() {\n\tif f.timeoutList.Len() == 0 {\n\t\tf.timeoutTimer.Stop()\n\t\treturn\n\t}\n\n\ttimeout := f.timeoutList.Front().Value.(*Timeout)\n\tlog.Debug(\"Timeout timer reset - due at %v\", timeout.timeoutDue)\n\tf.timeoutTimer.Reset(timeout.timeoutDue.Sub(time.Now()))\n}", "func (collector *Collector) resetTimeout() {\n\t// We only need to do something if there actually is a ticker (ie: if an interval was specified)\n\tif collector.ticker != nil {\n\t\t// Stop the ticker so it can be garbage collected\n\t\tcollector.ticker.Stop()\n\n\t\t// From everything I've read the only real way to reset a ticker is to recreate it\n\t\tcollector.ticker = time.NewTicker(collector.config.Timeout.Interval)\n\t\tcollector.timeoutChannel = collector.ticker.C\n\t}\n}", "func sessionConfigTimeoutHandler(_ *task.SessionConfigTask, env *task.Env) {\n\tlog.Info(\"Session config refresh timeout\")\n\tenv.StopSessionConfig()\n}", "func (s *Service) CancelTimer(id int) error {\n\tif timer, ok := s.timers[id]; ok {\n\t\ttimer.Cancel()\n\t\tdelete(s.timers, id)\n\n\t\treturn nil\n\t} else {\n\t\treturn TimerNotFoundError{}\n\t}\n}", "func (o *ScheduledPlanRunOnceByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (r *Raft) ResetTimer(){\n\t//fmt.Println(\"Election TImer Reset\")\n\tif r.Id==0 {\n \tElectionTimer.Reset(time.Millisecond*10000) \t\n\t}else if r.Id==1 {\n \tElectionTimer.Reset(time.Millisecond*3000)\n }else if r.Id==2 {\n \tElectionTimer.Reset(time.Millisecond*12000)\n\t}else if r.Id==3 {\n \tElectionTimer.Reset(time.Millisecond*14000)\n }else if r.Id==4 {\n \tElectionTimer.Reset(time.Millisecond*16000)\n\t}else {\n\tElectionTimer.Reset(time.Millisecond*18000)\n\t}\n\n}", "func (tm *TimerManager) SetTimeout(td time.Duration, arg interface{}, cb TimerCallback) int {\n\n\treturn tm.setTimer(td, false, arg, cb)\n}", "func ResetKillClock(t *time.Timer, d time.Duration) {\n\tif d == 0 {\n\t\treturn\n\t}\n\tif !t.Stop() {\n\t\t<-t.C\n\t}\n\tt.Reset(d)\n}", "func (o *PatchV1ScheduledMaintenancesScheduledMaintenanceIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (v *connection) ResetSession(ctx context.Context) error {\n\tif v.dead {\n\t\treturn driver.ErrBadConn\n\t}\n\treturn v.Ping(ctx)\n}", "func (s *EapAkaSrv) UpdateSessionUnlockCtx(lockedCtx *UserCtx, timeout time.Duration) {\n\tif !lockedCtx.locked {\n\t\tpanic(\"Expected locked\")\n\t}\n\tvar (\n\t\toldSession, newSession *SessionCtx\n\t\texist bool\n\t\toldTimer *time.Timer\n\t)\n\tnewSession = &SessionCtx{UserCtx: lockedCtx}\n\tsessionId := lockedCtx.SessionId\n\tlockedCtx.Unlock()\n\n\tnewSession.CleanupTimer = time.AfterFunc(timeout, func() {\n\t\tsessionTimeoutCleanup(s, sessionId, newSession)\n\t})\n\n\ts.rwl.Lock()\n\n\toldSession, exist = s.sessions[sessionId]\n\ts.sessions[sessionId] = newSession\n\tif exist && oldSession != nil {\n\t\toldSession.UserCtx = nil\n\t\tif oldSession.CleanupTimer != nil {\n\t\t\toldTimer, oldSession.CleanupTimer = oldSession.CleanupTimer, nil\n\t\t}\n\t}\n\ts.rwl.Unlock()\n\n\tif oldTimer != nil {\n\t\toldTimer.Stop()\n\t}\n}", "func (c *consulClient) renewSession(ttl string, session string, renewChan chan struct{}) {\n\n\tsessionDestroyAttempts := 0\n\tmaxSessionDestroyAttempts := 5\n\n\tparsedTTL, err := time.ParseDuration(ttl)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-time.After(parsedTTL / 2):\n\t\t\t\tentry, _, err := c.consul.Session().Renew(session, nil)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogging.Error(\"client/consul: unable to renew the Consul session %s: %v\", session, err)\n\t\t\t\t\truntime.Goexit()\n\t\t\t\t}\n\t\t\t\tif entry == nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Consul may return a TTL value higher than the one specified during\n\t\t\t\t// session creation. This indicates the server is under high load and\n\t\t\t\t// is requesting clients renew less often. If this happens we need to\n\t\t\t\t// ensure we track the new TTL.\n\t\t\t\tparsedTTL, _ = time.ParseDuration(entry.TTL)\n\t\t\t\tlogging.Debug(\"client/consul: the Consul session %s has been renewed\", session)\n\n\t\t\tcase <-renewChan:\n\t\t\t\t_, err := c.consul.Session().Destroy(session, nil)\n\t\t\t\tif err == nil {\n\t\t\t\t\tlogging.Info(\"client/consul: the Consul session %s has been released\", session)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif sessionDestroyAttempts >= maxSessionDestroyAttempts {\n\t\t\t\t\tlogging.Error(\"client/consul: unable to successfully destroy the Consul session %s\", session)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// We can't destroy the session so we will wait and attempt again until\n\t\t\t\t// we hit the threshold.\n\t\t\t\tsessionDestroyAttempts++\n\t\t\t\ttime.Sleep(parsedTTL)\n\t\t\t}\n\t\t}\n\t}()\n}", "func (t *tkgctl) restoreAfterSettingTimeout(currentTimeout time.Duration) func() {\n\tt.tkgClient.ConfigureTimeout(currentTimeout)\n\treturn func() {\n\t\tt.tkgClient.ConfigureTimeout(constants.DefaultOperationTimeout)\n\t}\n}", "func (rf *Raft) resetElectionTimeout() {\n\trf.electionTimeoutStartTime = time.Now()\n\t// randomize election timeout, 300~400ms\n\trf.electionTimeoutInterval = time.Duration(time.Millisecond * time.Duration(500+rand.Intn(300)))\n}", "func (o *PutNetworksNetworkIDPoliciesRulesRuleIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostLolChampSelectV1SessionActionsByIDCompleteParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (cs *ConsensusState) scheduleTimeout(duration time.Duration, height int64, round int, step ttypes.RoundStepType) {\n\tcs.timeoutTicker.ScheduleTimeout(timeoutInfo{duration, height, round, step})\n}", "func (authSvc *AuthService) invalidateSessionId(sessionId string) {\n\tauthSvc.Sessions[sessionId] = nil\n}", "func (i *idlenessManagerImpl) handleIdleTimeout() {\n\tif i.isClosed() {\n\t\treturn\n\t}\n\n\tif atomic.LoadInt32(&i.activeCallsCount) > 0 {\n\t\ti.resetIdleTimer(time.Duration(i.timeout))\n\t\treturn\n\t}\n\n\t// There has been activity on the channel since we last got here. Reset the\n\t// timer and return.\n\tif atomic.LoadInt32(&i.activeSinceLastTimerCheck) == 1 {\n\t\t// Set the timer to fire after a duration of idle timeout, calculated\n\t\t// from the time the most recent RPC completed.\n\t\tatomic.StoreInt32(&i.activeSinceLastTimerCheck, 0)\n\t\ti.resetIdleTimer(time.Duration(atomic.LoadInt64(&i.lastCallEndTime) + i.timeout - time.Now().UnixNano()))\n\t\treturn\n\t}\n\n\t// This CAS operation is extremely likely to succeed given that there has\n\t// been no activity since the last time we were here. Setting the\n\t// activeCallsCount to -math.MaxInt32 indicates to onCallBegin() that the\n\t// channel is either in idle mode or is trying to get there.\n\tif !atomic.CompareAndSwapInt32(&i.activeCallsCount, 0, -math.MaxInt32) {\n\t\t// This CAS operation can fail if an RPC started after we checked for\n\t\t// activity at the top of this method, or one was ongoing from before\n\t\t// the last time we were here. In both case, reset the timer and return.\n\t\ti.resetIdleTimer(time.Duration(i.timeout))\n\t\treturn\n\t}\n\n\t// Now that we've set the active calls count to -math.MaxInt32, it's time to\n\t// actually move to idle mode.\n\tif i.tryEnterIdleMode() {\n\t\t// Successfully entered idle mode. No timer needed until we exit idle.\n\t\treturn\n\t}\n\n\t// Failed to enter idle mode due to a concurrent RPC that kept the channel\n\t// active, or because of an error from the channel. Undo the attempt to\n\t// enter idle, and reset the timer to try again later.\n\tatomic.AddInt32(&i.activeCallsCount, math.MaxInt32)\n\ti.resetIdleTimer(time.Duration(i.timeout))\n}", "func SetTimeout(fn func(args ...interface{}), duration int, args ...interface{}) *Timer {\n\ttimer := &Timer{\n\t\trunning: false,\n\t\tinterval: time.Duration(duration) * time.Millisecond,\n\t\tfn: fn,\n\t\targs: args,\n\t\tmaxIntervals: 0,\n\t}\n\n\ttimer.Start()\n\n\treturn timer\n}", "func (t *Timer) SetTimeout(secs int, cb TimeoutCallback) (int, error) {\n\tt.lock.Lock()\n\tdefer t.lock.Unlock()\n\tvar tid int\n\tvar err error\n\ttid, err = t.evtTree.Insert(cb, t.tick+int(secs*SECOND/TICK_INTERVAL))\n\treturn tid, err\n}", "func SetSessionExpiration(sessionID string, ttl int) error {\n\tkey := stringutil.Build(\"sessionid:\", sessionID, \":userid\")\n\terr := Expire(key, ttl)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"cannot expire key in Redis\")\n\t}\n\treturn nil\n}", "func (c *Controller) SessionRegenerateID() error {\n\tif c.CruSession != nil {\n\t\tc.CruSession.SessionRelease(context2.Background(), c.Ctx.ResponseWriter)\n\t}\n\tvar err error\n\tc.CruSession, err = GlobalSessions.SessionRegenerateID(c.Ctx.ResponseWriter, c.Ctx.Request)\n\tc.Ctx.Input.CruSession = c.CruSession\n\treturn err\n}", "func (o *CreatePolicyResetItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (c Config) SessionTimeoutOrDefault() time.Duration {\n\tif c.SessionTimeout > 0 {\n\t\treturn c.SessionTimeout\n\t}\n\treturn DefaultSessionTimeout\n}", "func (o *UpdateCustomIDPParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (i *idlenessManagerImpl) resetIdleTimer(d time.Duration) {\n\ti.idleMu.Lock()\n\tdefer i.idleMu.Unlock()\n\n\tif i.timer == nil {\n\t\t// Only close sets timer to nil. We are done.\n\t\treturn\n\t}\n\n\t// It is safe to ignore the return value from Reset() because this method is\n\t// only ever called from the timer callback, which means the timer has\n\t// already fired.\n\ti.timer.Reset(d)\n}", "func (o *GetRouteByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func SetTimeout(callback func(), delay time.Duration) (cancel func()) {\n\treturn SetTimeoutWithContext(context.Background(), callback, delay)\n}", "func (o *PutAclsRidGroupsGidActionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutSitesByIDCampaignsByIDCustomerGroupsByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (c *Client) ScheduleTimeout(timeout time.Duration, task func()) error {\n\treturn c.schedule(task, time.After(timeout))\n}", "func (o *DeleteSyslogPoliciesMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (set RoleSet) AdjustSessionTTL(ttl time.Duration) time.Duration {\n\tfor _, role := range set {\n\t\tif ttl > role.GetMaxSessionTTL().Duration {\n\t\t\tttl = role.GetMaxSessionTTL().Duration\n\t\t}\n\t}\n\treturn ttl\n}", "func (mc *Client) SetTimeout(timeout time.Duration) {\n\n\tmc.timeout = timeout\n\tmc.Session.SetClientTimeout(mc.timeout)\n}", "func (o *GetIPAMCustomerIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func systemSessionTimeout(ctx context.Context, beegoTimeout int64) int64 {\n\t// read from system config if it is meaningful to support change session timeout in runtime for user.\n\t// otherwise, use parameters beegoTimeout which set from beego.\n\ttimeout := beegoTimeout\n\tif sysTimeout := config.SessionTimeout(ctx); sysTimeout > 0 {\n\t\ttimeout = sysTimeout * int64(time.Minute)\n\t}\n\n\treturn timeout\n}", "func (o *GetContextsIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (filterdev *NetworkTap) SetTimeout(fd int, tv *syscall.Timeval) error {\n\t_, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(filterdev.device.Fd()), syscall.BIOCSRTIMEOUT, uintptr(unsafe.Pointer(tv)))\n\tif err != 0 {\n\t\treturn syscall.Errno(err)\n\t}\n\treturn nil\n}", "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 != nil {\n\t\t\tintlog.Errorf(context.TODO(), `%+v`, err)\n\t\t}\n\t}\n}", "func (t *AuthenticateUserTask) ResetAccessTokenTTL() error {\n\tif err := ResetAccessTokenTTL(t.AccessToken, t.UserID); err != nil {\n\t\tlogex.Log.Error(err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (b *B) ResetTimer()", "func (context *handlerContext) SetNoSessionTimeout() {\n\tcontext.noSessionTimeout = true\n}", "func (manager *SessionManager) SessionRegenerateID(w http.ResponseWriter, r *http.Request) (session SessionStore) {\n\tsid, err := manager.sessionID()\n\tif err != nil {\n\t\treturn\n\t}\n\tcookie, err := r.Cookie(manager.config.CookieName)\n\tif err != nil || cookie.Value == \"\" {\n\t\t//delete old cookie\n\t\tsession, _ = manager.provider.SessionRead(sid)\n\t\tcookie = &http.Cookie{Name: manager.config.CookieName,\n\t\t\tValue: url.QueryEscape(sid),\n\t\t\tPath: \"/\",\n\t\t\tHttpOnly: manager.config.HttpOnly,\n\t\t\tSecure: manager.isSecure(r),\n\t\t\tDomain: manager.config.Domain,\n\t\t}\n\t} else {\n\t\toldsid, _ := url.QueryUnescape(cookie.Value)\n\t\tsession, _ = manager.provider.SessionRegenerate(oldsid, sid)\n\t\tcookie.Value = url.QueryEscape(sid)\n\t\tcookie.HttpOnly = true\n\t\tcookie.Path = \"/\"\n\t}\n\tif manager.config.CookieLifeTime > 0 {\n\t\tcookie.MaxAge = manager.config.CookieLifeTime\n\t\tcookie.Expires = time.Now().Add(time.Duration(manager.config.CookieLifeTime) * time.Second)\n\t}\n\tif manager.config.EnableSetCookie {\n\t\thttp.SetCookie(w, cookie)\n\t}\n\tr.AddCookie(cookie)\n\treturn\n}", "func (wd *Watchdog) reset(timeoutNanoSecs int64) {\n\twd.resets <- timeoutNanoSecs + time.Now().UnixNano()\n}", "func (s *Service) ResumeTimer(id int) error {\n\tif timer, err := s.GetTimer(id); err == nil {\n\t\ttimer.Resume(s.channel)\n\n\t\treturn nil\n\t} else {\n\t\treturn err\n\t}\n}", "func (rf *Raft) resetElectionTimeout() time.Duration {\n\trand.Seed(time.Now().UTC().UnixNano())\n\trf.randomizedElectionTimeout = rf.electionTimeout + time.Duration(rand.Int63n(rf.electionTimeout.Nanoseconds()))\n\treturn rf.randomizedElectionTimeout\n}", "func (c *channel) resetDeleteTimer(newDuration time.Duration) {\n\ta := c.activity\n\tif a.timer == nil {\n\t\ta.timer = time.AfterFunc(newDuration, func() {\n\t\t\tc.stan.sendDeleteChannelRequest(c)\n\t\t})\n\t} else {\n\t\ta.timer.Reset(newDuration)\n\t}\n\tif c.stan.debug {\n\t\tc.stan.log.Debugf(\"Channel %q delete timer set to fire in %v\", c.name, newDuration)\n\t}\n\ta.timerSet = true\n}", "func (m *MemoryStorage) SetTimeout(checkID string, timeout int) (Job, error) {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\n\tjob, ok := m.checks[checkID]\n\tif !ok {\n\t\treturn Job{}, errors.New(\"error setting timeout for unexisting job\")\n\t}\n\n\tjob.Ctx, job.Cancel = context.WithTimeout(job.Ctx, time.Duration(timeout)*time.Second)\n\n\tm.checks[job.CheckID] = job\n\n\treturn job, nil\n}", "func gocKillTimer(hwnd, id Value) Value {\n\trtn := goc.Syscall2(killTimer,\n\t\tintArg(hwnd),\n\t\tintArg(id))\n\treturn boolRet(rtn)\n}", "func (o *PutSitesByIDCampaignsByIDSourceCodeGroupsByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ResetPasswordTokenParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SessionDataUpdateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RetrievePortalSessionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (*adminCtrl) cleanSessionByID(c *elton.Context) (err error) {\n\tstore := cache.GetRedisSession()\n\terr = store.Destroy(c.Param(\"id\"))\n\tif err != nil {\n\t\treturn\n\t}\n\tc.NoContent()\n\treturn\n}", "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.CleanupTimer = sessionCtx.Imsi, sessionCtx.CleanupTimer, nil\n\t\t}\n\t}\n\ts.rwl.Unlock()\n\tif timer != nil {\n\t\ttimer.Stop()\n\t}\n\treturn imsi, exist\n}", "func (c *Conn) ResetSession(ctx context.Context) error {\n\tif c.session != nil {\n\t\tif err := c.session.Close(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tc.session = nil\n\t}\n\treturn nil\n}", "func (o *observer) manageJobTimeout(\n\tctx context.Context,\n\tpod *corev1.Pod,\n\tphase sdk.JobPhase,\n) {\n\tnamespacedPodName := namespacedPodName(pod.Namespace, pod.Name)\n\tcancelFn, timed := o.timedPodsSet[namespacedPodName]\n\tif phase.IsTerminal() && timed {\n\t\tcancelFn() // Stop the clock\n\t\treturn\n\t}\n\tif !phase.IsTerminal() && !timed {\n\t\t// Start the clock\n\t\tctx, o.timedPodsSet[namespacedPodName] = context.WithCancel(ctx)\n\t\tgo o.runJobTimerFn(ctx, pod)\n\t}\n}", "func (p *PruneTask) ClearTimeout() {}", "func (o *VerifyCallerIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (xmlmc *XmlmcInstStruct) SetTimeout(timeout int) {\n\txmlmc.timeout = timeout\n}", "func (uuo *UserUpdateOne) SetSessionID(id int) *UserUpdateOne {\n\tuuo.mutation.SetSessionID(id)\n\treturn uuo\n}", "func (o *DeleteLTENetworkIDNetworkProbeTasksTaskIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutRolesByIDUsersByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (s *EapAkaSrv) InitSession(sessionId string, imsi aka.IMSI) (lockedUserContext *UserCtx) {\n\tvar (\n\t\toldSessionTimer *time.Timer\n\t\toldSessionState aka.AkaState\n\t)\n\t// create new session with long session wide timeout\n\tt := time.Now()\n\tnewSession := &SessionCtx{UserCtx: &UserCtx{\n\t\tcreated: t, Imsi: imsi, state: aka.StateCreated, stateTime: t, locked: true, SessionId: sessionId}}\n\n\tnewSession.mu.Lock()\n\n\tnewSession.CleanupTimer = time.AfterFunc(s.SessionTimeout(), func() {\n\t\tsessionTimeoutCleanup(s, sessionId, newSession)\n\t})\n\tuc := newSession.UserCtx\n\n\ts.rwl.Lock()\n\tif oldSession, ok := s.sessions[sessionId]; ok && oldSession != nil {\n\t\toldSessionTimer, oldSession.CleanupTimer = oldSession.CleanupTimer, nil\n\t\toldSessionState = oldSession.state\n\t}\n\ts.sessions[sessionId] = newSession\n\ts.rwl.Unlock()\n\n\tif oldSessionTimer != nil {\n\t\toldSessionTimer.Stop()\n\t\t// Copy Redirected state to a new session to avoid auth thrashing between EAP methods\n\t\tif oldSessionState == aka.StateRedirected {\n\t\t\tnewSession.state = aka.StateRedirected\n\t\t}\n\t}\n\treturn uc\n}", "func (eCtx *ExecutionContext) CancelTimer(repeating bool) {\n\tact := eCtx.currentStage().act\n\n\tstate := eCtx.pipeline.sm.GetState(eCtx.discriminator)\n\n\tif repeating {\n\t\tstate.RemoveTicker(act)\n\t} else {\n\t\tstate.RemoveTimer(act)\n\t}\n}", "func (mc *mgmtClient) RenewSessionLock(ctx context.Context, sessionID string) (time.Time, error) {\n\tbody := map[string]interface{}{\n\t\t\"session-id\": sessionID,\n\t}\n\n\tmsg := &amqp.Message{\n\t\tValue: body,\n\t\tApplicationProperties: map[string]interface{}{\n\t\t\t\"operation\": \"com.microsoft:renew-session-lock\",\n\t\t},\n\t}\n\n\tresp, err := mc.doRPCWithRetry(ctx, msg, 5, 5*time.Second)\n\n\tif err != nil {\n\t\treturn time.Time{}, err\n\t}\n\n\tm, ok := resp.Message.Value.(map[string]interface{})\n\n\tif !ok {\n\t\treturn time.Time{}, NewErrIncorrectType(\"Message.Value\", map[string]interface{}{}, resp.Message.Value)\n\t}\n\n\tlockedUntil, ok := m[\"expiration\"].(time.Time)\n\n\tif !ok {\n\t\treturn time.Time{}, NewErrIncorrectType(\"Message.Value[\\\"expiration\\\"] as times\", time.Time{}, resp.Message.Value)\n\t}\n\n\treturn lockedUntil, nil\n}", "func MessageThreadTimeoutRetrasmit(messageId int) {\n\tLog(\"Starting TimeoutRetrasmit thread of message id: \" + strconv.Itoa(messageId))\n\n\tstart := time.Now()\n\tfor {\n\t\tfor i := 0; i < s.Size(); i++ {\n\n\t\t\tLog(\"TimeoutRetrasmit thread of message id: \" + strconv.Itoa(messageId))\n\n\t\t\tif time.Now().After(start.Add(time.Second * TIMEOUT_RETRASMIT)) {\n\t\t\t\tstart = time.Now()\n\n\t\t\t\tif s.items[i].ID == messageId && s.items[i].Status == SENT {\n\t\t\t\t\ts.items[i].Status = INQUEUE\n\t\t\t\t\tLog(\"Retrasmit of message id: \" + strconv.Itoa(messageId))\n\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif s.items[i].ID == messageId && (s.items[i].Status == RECEIVED || s.items[i].Status == ELABORATED) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t}\n\t}\n}", "func (s *s6aProxy) cleanupSession(sid string) chan interface{} {\n\ts.sessionsMu.Lock()\n\toldCh, ok := s.sessions[sid]\n\tif ok {\n\t\tdelete(s.sessions, sid)\n\t\ts.sessionsMu.Unlock()\n\t\tif oldCh != nil {\n\t\t\tclose(oldCh)\n\t\t}\n\t\treturn oldCh\n\t}\n\ts.sessionsMu.Unlock()\n\treturn nil\n}", "func (t *Tangle) ResetMilestoneTimeoutTicker() {\n\tif t.milestoneTimeoutTicker != nil {\n\t\tt.milestoneTimeoutTicker.Shutdown()\n\t\tt.milestoneTimeoutTicker.WaitForGracefulShutdown()\n\t}\n\n\tt.milestoneTimeoutTicker = timeutil.NewTicker(func() {\n\t\tt.Events.MilestoneTimeout.Trigger()\n\t}, t.milestoneTimeout)\n}", "func (o *PutCustomersCustomerFidSubscriptionsSubscriptionFidAutoCancelDaysParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (c *canceler) Cancel(ctx context.Context, id string) error {\n\tc.Lock()\n\tdefer c.Unlock()\n\tc.cancelled[id] = time.Now().Add(5 * time.Minute)\n\tif sub, ok := c.subsciber[id]; ok {\n\t\tclose(sub)\n\t}\n\tc.clear()\n\treturn nil\n}", "func (m *MemoryStorage) SetTimeoutIfAbort(checkID string) error {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\n\tjob, ok := m.checks[checkID]\n\tif !ok {\n\t\treturn errors.New(\"error setting state for unexisting job\")\n\t}\n\tjob.WillTimeout = true\n\tm.checks[checkID] = job\n\treturn nil\n}", "func (o *PostSessionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RemoveControlFromGroupParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PatchV1ChangesEventsChangeEventIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetPrivateToggleSubaccountLoginParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (d *Dnsfilter) ResetHTTPTimeout() {\n\td.client.Timeout = defaultHTTPTimeout\n}", "func (o *GetInstancesEventByEventIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (r *FailBack) startResetTimer() chan struct{} {\n\tfailCh := make(chan struct{}, 1)\n\tgo func() {\n\t\ttimer := time.NewTimer(r.opt.ResetAfter)\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-failCh:\n\t\t\t\tif !timer.Stop() {\n\t\t\t\t\t<-timer.C\n\t\t\t\t}\n\t\t\tcase <-timer.C:\n\t\t\t\tr.mu.Lock()\n\t\t\t\tr.active = 0\n\t\t\t\tLog.WithField(\"resolver\", r.resolvers[r.active].String()).Debug(\"failing back to resolver\")\n\t\t\t\tr.mu.Unlock()\n\t\t\t\tr.metrics.available.Add(1)\n\t\t\t\t// we just reset to the first resolver, let's wait for another failure before running again\n\t\t\t\t<-failCh\n\t\t\t}\n\t\t\ttimer.Reset(r.opt.ResetAfter)\n\t\t}\n\t}()\n\treturn failCh\n}", "func SetTimeout(ctx context.Context, timeout uint) context.Context {\n\treturn context.WithValue(ctx, TimeoutContextKey, timeout)\n}", "func (o *AutoscaleStopInstancesByCrnParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (e *Executor) SetTimeout(timeout time.Duration) {\n\te.lock.Lock()\n\te.timeo = timeout\n\te.lock.Unlock()\n}", "func (state *ServerState) ResetStateTimer() {\n\tt := time.Duration(MINTIME+rand.Intn(TIMERANGE)) * TIMESCALE\n\tfmt.Println(t)\n\tstate.timer.Reset(t)\n}", "func (o *GetLolReplaysV1RoflsPathDefaultParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (c *Client) resetGatewaySession() {\n\tc.sessionID = \"\"\n\tc.sequence.Store(0)\n}", "func (o *UpdateSettingsAclsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetCwfNetworkIDGatewaysGatewayIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutSitesByIDCampaignsByIDPromotionsByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (p *OIDCIBMProvider) RefreshSessionIfNeeded(s *SessionState) (bool, error) {\n\tfmt.Printf(\"RefreshSessionIfNeeded() - %v\\n\", s)\n\tif s == nil || s.ExpiresOn.After(time.Now()) || s.RefreshToken == \"\" {\n\t\t// the two commented lines below are hard coding the session timeout to two minutes\n\t\t//if s == nil || s.ExpiresOn.After(time.Now().Add(time.Hour*time.Duration(1)+\n\t\t//\ttime.Minute*time.Duration(58))) || s.RefreshToken == \"\" {\n\t\tfmt.Printf(\"RefreshSessionIfNeeded() - Expiry not yet reached, no session, or refresh token.\\n\")\n\t\treturn false, nil\n\t}\n\t//return false, fmt.Errorf(\"Clear Session and start again\")\n\n\torigExpiration := s.ExpiresOn\n\n\terr := p.redeemRefreshToken(s)\n\tif err != nil {\n\t\tfmt.Printf(\"RefreshSessionIfNeeded() - Error: %v\\n\", err)\n\t\treturn false, fmt.Errorf(\"unable to redeem refresh token: %v\", err)\n\t}\n\n\tfmt.Printf(\"refreshed id token %s (expired on %s)\\n\", s, origExpiration)\n\treturn true, nil\n}", "func (it *IdleTimer) recomputeDurations() (idleTimeout, quitTimeout time.Duration) {\n\ttotalTimeout := DefaultTotalTimeout\n\t// if they have the resume cap, wait longer before pinging them out\n\t// to give them a chance to resume their connection\n\tif it.client.capabilities.Has(caps.Resume) {\n\t\ttotalTimeout = ResumeableTotalTimeout\n\t}\n\n\tidleTimeout = DefaultIdleTimeout\n\tif it.client.isTor {\n\t\tidleTimeout = TorIdleTimeout\n\t}\n\n\tquitTimeout = totalTimeout - idleTimeout\n\treturn\n}", "func (s *Stream) closeTimeout() {\n\t// Close our side forcibly\n\ts.forceClose()\n\n\t// Free the stream from the session map\n\ts.session.closeStream(s.id)\n\n\t// Send a RST so the remote side closes too.\n\ts.sendLock.Lock()\n\tdefer s.sendLock.Unlock()\n\ts.sendHdr.encode(typeWindowUpdate, flagRST, s.id, 0)\n\ts.session.sendNoWait(s.sendHdr)\n}", "func (o *UpdateStockReceiptParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutCwfNetworkIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *HasFlowRunningByFlowIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *DeleteCwfNetworkIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (uu *UserUpdate) SetSessionID(id int) *UserUpdate {\n\tuu.mutation.SetSessionID(id)\n\treturn uu\n}" ]
[ "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.4907662", "0.48770937", "0.48658", "0.48587036", "0.48366866", "0.4823089", "0.48071477", "0.47922918", "0.47710267", "0.47686884", "0.47604826", "0.47585875", "0.4745291", "0.47346407", "0.4732969", "0.4730128", "0.47289625", "0.47257367", "0.47253156", "0.47228038", "0.47025767", "0.47025105", "0.46980986", "0.46708393", "0.46577513", "0.46546462", "0.4651934", "0.46491113", "0.46470737", "0.46413392", "0.464017", "0.46318847", "0.4621173", "0.46166927", "0.46166438", "0.46140862", "0.4610881", "0.46074238", "0.46036515", "0.46000415", "0.45871687", "0.45783907", "0.45716035", "0.45712873", "0.45665798", "0.4562214", "0.4553148", "0.45477006", "0.454662", "0.45458698", "0.45394394", "0.45337844", "0.45301428", "0.4527741", "0.4523967", "0.4519896", "0.4504201", "0.45024008", "0.4498793", "0.44974548", "0.44959718", "0.4492436", "0.44918898", "0.44894373", "0.4485827", "0.44834572", "0.44823885", "0.4475759", "0.44726157", "0.44583344", "0.4458087", "0.44567892", "0.44553098", "0.4454578", "0.44529173", "0.44502962", "0.44462493", "0.4435893", "0.44344118", "0.4431505" ]
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\tnormalised := strings.ToUpper(strings.TrimSuffix(actionInput, \"\\n\"))\n\tif len(normalised) < 1 {\n\t\treturn -1, errors.New(\"No action specified\")\n\t}\n\n\tswitch normalised[0] {\n\tcase 'E':\n\t\treturn Explore, nil\n\n\tcase 'F':\n\t\treturn Flag, nil\n\n\tdefault:\n\t\treturn -1, errors.New(\"Invalid action\")\n\t}\n}", "func ConvertAnyMessage(m AnyMessage) (ActionMessage, error) {\n\ta := m.Action()\n\tswitch a {\n\t// TODO support other Actions?\n\tcase ActionChatMessage:\n\t\treturn ParseChatMessage(m, a)\n\tcase ActionReadMessage:\n\t\treturn ParseReadMessage(m, a)\n\tcase ActionTypeStart:\n\t\treturn ParseTypeStart(m, a)\n\tcase ActionTypeEnd:\n\t\treturn ParseTypeEnd(m, a)\n\tcase ActionEmpty:\n\t\treturn m, errors.New(\"JSON object must have any action field\")\n\t}\n\treturn m, errors.New(\"unknown action: \" + string(a))\n}", "func Action(message string) string {\n\treturn Encode(ACTION, message)\n}", "func (m *MembershipEvent) GetAction() string {\n\tif m == nil || m.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *m.Action\n}", "func (m *MilestoneEvent) GetAction() string {\n\tif m == nil || m.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *m.Action\n}", "func (m *UnifiedRoleAssignmentScheduleRequest) GetAction()(*UnifiedRoleScheduleRequestActions) {\n return m.action\n}", "func (m *MessageRule) GetActions()(MessageRuleActionsable) {\n return m.actions\n}", "func (i *IssuesEvent) GetAction() string {\n\tif i == nil || i.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *i.Action\n}", "func (t *TeamEvent) GetAction() string {\n\tif t == nil || t.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Action\n}", "func (a *Action) Get(i int) string {\n if a==nil || i<0 || i>= len(a.actions) {\n return \"\"\n }\n return a.actions[i]\n}", "func (m *MemberEvent) GetAction() string {\n\tif m == nil || m.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *m.Action\n}", "func (oe *OraErr) Action() string { return oe.action }", "func Get(actionType string) Action {\n\treturn actions[actionType]\n}", "func (i *InstallationEvent) GetAction() string {\n\tif i == nil || i.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *i.Action\n}", "func (o *OrganizationEvent) GetAction() string {\n\tif o == nil || o.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *o.Action\n}", "func (w *WatchEvent) GetAction() string {\n\tif w == nil || w.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *w.Action\n}", "func GetActionAction(c *gin.Context) {\n\tresult := render.NewResult()\n\tdefer c.JSON(http.StatusOK, result)\n\n\tidArg := c.Param(\"id\")\n\tid, err := strconv.ParseUint(idArg, 10, 64)\n\tif nil != err {\n\t\tresult.Error(err)\n\n\t\treturn\n\t}\n\n\tsrv := service.FromContext(c)\n\tdata, err := srv.Actions.Find(c, id)\n\tif nil == data {\n\t\tresult.Error(err)\n\n\t\treturn\n\t}\n\n\tresult.Result = data\n}", "func (o *OrgBlockEvent) GetAction() string {\n\tif o == nil || o.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *o.Action\n}", "func GetAction(name string) (Action, error) {\n\tvar a Action\n\n\tpath := fmt.Sprintf(\"/action/%s\", name)\n\tdata, _, err := Request(\"GET\", path, nil)\n\tif err != nil {\n\t\treturn a, err\n\t}\n\n\tif err := json.Unmarshal(data, &a); err != nil {\n\t\treturn a, err\n\t}\n\n\treturn a, nil\n}", "func (c *CheckSuiteEvent) GetAction() string {\n\tif c == nil || c.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *c.Action\n}", "func ParseAction(b string) (MessageAction, error) {\n\tma := MessageAction{}\n\n\tform, err := url.ParseQuery(b)\n\tif err != nil {\n\t\treturn ma, errors.Wrap(err, \"failed to parse request body\")\n\t}\n\n\terr = json.Unmarshal([]byte(form.Get(\"payload\")), &ma)\n\tif err != nil {\n\t\treturn ma, errors.Wrap(err, \"failed to parse request body\")\n\t}\n\treturn ma, err\n}", "func (r *RepositoryEvent) GetAction() string {\n\tif r == nil || r.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *r.Action\n}", "func (c *CheckRunEvent) GetAction() string {\n\tif c == nil || c.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *c.Action\n}", "func (p *ProjectCardEvent) GetAction() string {\n\tif p == nil || p.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *p.Action\n}", "func (i *InstallationRepositoriesEvent) GetAction() string {\n\tif i == nil || i.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *i.Action\n}", "func (m *WebhookActionBody) Action() Action {\n\treturn m.actionField\n}", "func (p *ProjectEvent) GetAction() string {\n\tif p == nil || p.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *p.Action\n}", "func ParseAction(re *regexp.Regexp, line string) interface{} {\n\t// Regex: `:\\x01ACTION (\\w*) <your bot>\\x01`\n\taction := re.FindStringSubmatch(line)\n\tif len(action) == 0 {\n\t\treturn nil\n\t}\n\n\tuser := get_user(line)\n\tm := make(map[string]string)\n\tm[\"user\"] = user\n\tm[\"action\"] = action[1]\n\treturn m\n}", "func (self *NXOutput) GetActionMessage() openflow13.Action {\n\tofsNbits := self.fieldRange.ToOfsBits()\n\ttargetField := self.field\n\t// Create NX output Register action\n\treturn openflow13.NewOutputFromField(targetField, ofsNbits)\n}", "func (p *Page) GetAction() string {\n\tif p == nil || p.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *p.Action\n}", "func matchAction(ivr string) (string, error) {\n\tinput_words := strings.Split(strings.ToLower(ivr), \" \")\n\tactions := map[string]string{\n\t\t\"on\": \"On\",\n\t\t\"off\": \"Off\",\n\t}\n\n\tfor key, value := range actions {\n\t\tif contains(input_words, key) {\n\t\t\treturn value, nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"no matching action\")\n}", "func (core *coreService) Action(actionHash string, checkPending bool) (*iotexapi.ActionInfo, error) {\n\tif err := core.checkActionIndex(); err != nil {\n\t\treturn nil, err\n\t}\n\tactHash, err := hash.HexStringToHash256(actionHash)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, err.Error())\n\t}\n\tact, err := core.getAction(actHash, checkPending)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Unavailable, err.Error())\n\t}\n\treturn act, nil\n}", "func (p *ProjectColumnEvent) GetAction() string {\n\tif p == nil || p.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *p.Action\n}", "func (r *ReleaseEvent) GetAction() string {\n\tif r == nil || r.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *r.Action\n}", "func (i *IssueCommentEvent) GetAction() string {\n\tif i == nil || i.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *i.Action\n}", "func (o ConnectedRegistryNotificationOutput) Action() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ConnectedRegistryNotification) string { return v.Action }).(pulumi.StringOutput)\n}", "func (c MethodsCollection) ActionGet() pActionGet {\n\treturn pActionGet{\n\t\tMethod: c.MustGet(\"ActionGet\"),\n\t}\n}", "func Get(name string) (Action, error) {\n\tif initFunc, exists := actions[name]; exists {\n\t\treturn initFunc()\n\t}\n\n\treturn nil, fmt.Errorf(\"action %q does not exist as a supported action\", name)\n}", "func (m *MarketplacePurchaseEvent) GetAction() string {\n\tif m == nil || m.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *m.Action\n}", "func (q *QLearning) GetAction(s State) Action {\n\taction := Action(0)\n\tmax := q.qt[s][0]\n\n\tfor i := 1; i < q.actns; i++ {\n\t\tif max < q.qt[s][Action(i)] {\n\t\t\tmax = q.qt[s][Action(i)]\n\t\t\taction = Action(i)\n\t\t}\n\t}\n\treturn action\n}", "func (p *PullRequestEvent) GetAction() string {\n\tif p == nil || p.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *p.Action\n}", "func (s UserSet) ActionGet() *actions.Action {\n\tres := s.Collection().Call(\"ActionGet\")\n\tresTyped, _ := res.(*actions.Action)\n\treturn resTyped\n}", "func (l *LabelEvent) GetAction() string {\n\tif l == nil || l.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *l.Action\n}", "func (c *CommitCommentEvent) GetAction() string {\n\tif c == nil || c.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *c.Action\n}", "func (act *ActionTrace) Action() (*ActionTrace, error) {\n\treturn act, nil\n}", "func (game *Game) DoActorAction(words []string, action *Action) string {\n\tif len(words) == 0 {\n\t\treturn strings.Title(action.Name) + \" who?\"\n\t}\n\n\troom := game.Rooms[game.Location]\n\titems := visibleItems(room.BasicRoom().Items, false, true)\n\tactors := filterActors(items)\n\n\tif len(actors) == 0 {\n\t\treturn \"There is nobody to \" + action.Name + \".\"\n\t}\n\n\tactor := actors[0]\n\tif len(actors) > 1 {\n\t\tvar msg string\n\t\tmsg, actor, words = findActor(words, actors)\n\t\tif msg != \"\" {\n\t\t\treturn msg\n\t\t}\n\t}\n\n\tif action.IsTopicRequired {\n\t\tfor _, topic := range findTopics(words, actor) {\n\t\t\tif strings.Contains(topic.Action, action.Name) {\n\t\t\t\treturn actor.OnTopic(topic, action, nil)\n\t\t\t}\n\t\t}\n\t\treturn actor.OnTopic(nil, action, nil)\n\t}\n\n\tif action.Syntax != \"\" {\n\t\twords, _ = findSyntax(words, action.Syntax)\n\t}\n\n\tif action.IsTargetRequired && len(words) == 0 && action.Syntax != \"\" {\n\t\treturn strings.Title(action.Name) + \" \" + action.Syntax + \" what?\"\n\t}\n\n\tmsg, target, _ := findTarget(words, items, !action.IsTargetRequired)\n\n\tif !action.IsTargetRequired {\n\t\tmsg, _ := actor.OnAction(action, target)\n\t\treturn msg\n\t}\n\n\tif msg != \"\" {\n\t\treturn msg\n\t}\n\n\tif target == nil {\n\t\treturn strings.Title(action.Name) + \" \" + action.Syntax + \" what?\"\n\t}\n\n\tmsg, _ = actor.OnAction(action, target)\n\treturn msg\n}", "func (o Outside) GetAction(ctx context.Context, c *github.Client, owner, repo string) string {\n\toc, rc := getConfig(ctx, c, owner, repo)\n\tmc := mergeConfig(oc, rc, repo)\n\treturn mc.Action\n}", "func (o *WorkflowServiceItemActionInstance) GetAction() string {\n\tif o == nil || o.Action == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Action\n}", "func (o LookupIntentResultOutput) Action() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupIntentResult) string { return v.Action }).(pulumi.StringOutput)\n}", "func (o IPRuleResponseOutput) Action() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IPRuleResponse) *string { return v.Action }).(pulumi.StringPtrOutput)\n}", "func (ai *actionItem) Action() llapi.HsmAction {\n\treturn ai.hai.Action\n}", "func (c *Client) Action(msg *Message) bool {\n\tif msg.ActionID() == \"\" {\n\t\tmsg.AddActionID()\n\t}\n\n\tif err := c.write(msg.Bytes()); err != nil {\n\t\tc.emitError(err)\n\t\treturn false\n\t}\n\treturn true\n}", "func (o IntentOutput) Action() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Intent) pulumi.StringOutput { return v.Action }).(pulumi.StringOutput)\n}", "func GetAction(method string) Action {\n\tswitch strings.ToUpper(method) {\n\tcase http.MethodGet:\n\t\treturn ReadAction\n\tcase http.MethodHead:\n\t\treturn ReadAction\n\tcase http.MethodPost:\n\t\treturn CreateAction\n\tcase http.MethodPut:\n\t\treturn UpdateAction\n\tcase http.MethodDelete:\n\t\treturn DeleteAction\n\tcase http.MethodPatch:\n\t\treturn UpdateAction\n\tcase http.MethodOptions:\n\t\treturn ReadAction\n\tdefault:\n\t\treturn UnknownAction\n\t}\n}", "func (m *Messenger) classify(info MessageInfo) Action {\n\tif info.Message != nil {\n\t\treturn TextAction\n\t} else if info.Delivery != nil {\n\t\treturn DeliveryAction\n\t} else if info.Read != nil {\n\t\treturn ReadAction\n\t} else if info.PostBack != nil {\n\t\treturn PostBackAction\n\t} else if info.OptIn != nil {\n\t\treturn OptInAction\n\t} else if info.ReferralMessage != nil {\n\t\treturn ReferralAction\n\t} else if info.AccountLinking != nil {\n\t\treturn AccountLinkingAction\n\t}\n\treturn UnknownAction\n}", "func (p *PullRequestReviewEvent) GetAction() string {\n\tif p == nil || p.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *p.Action\n}", "func (o ScheduledQueryRulesAlertV2Output) Action() ScheduledQueryRulesAlertV2ActionPtrOutput {\n\treturn o.ApplyT(func(v *ScheduledQueryRulesAlertV2) ScheduledQueryRulesAlertV2ActionPtrOutput { return v.Action }).(ScheduledQueryRulesAlertV2ActionPtrOutput)\n}", "func (r *TestRequest) Action() llapi.HsmAction {\n\treturn r.action\n}", "func (f *List) Action(addr turn.Addr) Action {\n\tfor i := range f.rules {\n\t\ta := f.rules[i].Action(addr)\n\t\tif a == Pass {\n\t\t\tcontinue\n\t\t}\n\t\treturn a\n\t}\n\treturn f.action\n}", "func (_ EventFilterAliases) Action(p graphql.ResolveParams) (EventFilterAction, error) {\n\tval, err := graphql.DefaultResolver(p.Source, p.Info.FieldName)\n\tret, ok := EventFilterAction(val.(string)), true\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\tif !ok {\n\t\treturn ret, errors.New(\"unable to coerce value for field 'action'\")\n\t}\n\treturn ret, err\n}", "func (p *PullRequestReviewCommentEvent) GetAction() string {\n\tif p == nil || p.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *p.Action\n}", "func (m *ScheduleChangeRequest) GetManagerActionMessage()(*string) {\n val, err := m.GetBackingStore().Get(\"managerActionMessage\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (me XsdGoPkgHasAttr_Action_TactionType_Other) ActionDefault() TactionType {\n\treturn TactionType(\"other\")\n}", "func GetAction(client *whisk.Client, actionName string) func() (*whisk.Action, error) {\n\treturn func() (*whisk.Action, error) {\n\t\taction, _, err := client.Actions.Get(actionName, true)\n\t\tif err == nil {\n\t\t\treturn action, nil\n\t\t}\n\t\treturn nil, err\n\t}\n}", "func (o *WorkflowServiceItemActionInstance) GetActionOk() (*string, bool) {\n\tif o == nil || o.Action == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Action, true\n}", "func (ra *RecoverableAction) Action(action Action) string {\n\tra.actionChan <- action\n\n\treturn <-ra.replyChan\n}", "func (r *RequestKeys) Action() string {\n\treturn ActionKeys\n}", "func (c *Config) handleActionDeleteMessage(client MQTT.Client, message MQTT.Message) {\n\tactionsToBeDeleted := []actionmanager.Action{}\n\terr := json.Unmarshal(message.Payload(), &actionsToBeDeleted)\n\tif err != nil {\n\t\tklog.Errorf(\"Error in unmarshalling: %s\", err)\n\t}\n\tfor _, actionToBeDeleted := range actionsToBeDeleted {\n\t\tactionExists := false\n\t\tfor index, action := range c.ActionManager.Actions {\n\t\t\tif strings.EqualFold(action.Name, actionToBeDeleted.Name) {\n\t\t\t\tactionExists = true\n\t\t\t\tcopy(c.ActionManager.Actions[index:], c.ActionManager.Actions[index+1:])\n\t\t\t\tc.ActionManager.Actions = c.ActionManager.Actions[:len(c.ActionManager.Actions)-1]\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tconfiguration.Config.ActionManager = c.ActionManager\n\t\tif !actionExists {\n\t\t\tklog.Errorf(\"Action: %s did not exist\", actionToBeDeleted.Name)\n\t\t} else {\n\t\t\tklog.Infof(\"Action: %s has been deleted \", actionToBeDeleted.Name)\n\t\t}\n\t}\n}", "func (m *metadata) Action(method string) Action {\n\n\tmethod = cleanMethod(method)\n\n\t// check if action exists\n\tif _, ok := m.actions[method]; !ok {\n\t\tna := NewAction()\n\n\t\t// if debug is enabled, action must too\n\t\tif m.isDebug() {\n\t\t\tna.Debug()\n\t\t}\n\n\t\tm.actions[method] = na\n\t}\n\n\treturn m.actions[method]\n}", "func (o FirewallPolicyRuleOutput) Action() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FirewallPolicyRule) *string { return v.Action }).(pulumi.StringPtrOutput)\n}", "func (client *ClientImpl) GetConsumerAction(ctx context.Context, args GetConsumerActionArgs) (*ConsumerAction, error) {\n\trouteValues := make(map[string]string)\n\tif args.ConsumerId == nil || *args.ConsumerId == \"\" {\n\t\treturn nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.ConsumerId\"}\n\t}\n\trouteValues[\"consumerId\"] = *args.ConsumerId\n\tif args.ConsumerActionId == nil || *args.ConsumerActionId == \"\" {\n\t\treturn nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.ConsumerActionId\"}\n\t}\n\trouteValues[\"consumerActionId\"] = *args.ConsumerActionId\n\n\tqueryParams := url.Values{}\n\tif args.PublisherId != nil {\n\t\tqueryParams.Add(\"publisherId\", *args.PublisherId)\n\t}\n\tlocationId, _ := uuid.Parse(\"c3428e90-7a69-4194-8ed8-0f153185ee0d\")\n\tresp, err := client.Client.Send(ctx, http.MethodGet, locationId, \"7.1-preview.1\", routeValues, queryParams, nil, \"\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue ConsumerAction\n\terr = client.Client.UnmarshalBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "func promptAction() GameAction {\n\treader := bufio.NewReader(os.Stdin)\n\tfmt.Print(\"Select an action ((E)xplore or (F)lag)\\n> \")\n\tactionInput, err := reader.ReadString('\\n')\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\taction, actionErr := toAction(actionInput)\n\n\tfor actionErr != nil {\n\t\tfmt.Print(\n\t\t\t\"Invalid action, please try again.\\n\" +\n\t\t\t\t\"Valid actions are (E)xplore or (F)lag\\n> \",\n\t\t)\n\t\tactionInput, err := reader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\taction, actionErr = toAction(actionInput)\n\t}\n\n\treturn action\n}", "func (o RuleResponseOutput) Action() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RuleResponse) string { return v.Action }).(pulumi.StringOutput)\n}", "func (o GetResolverFirewallRulesFirewallRuleOutput) Action() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetResolverFirewallRulesFirewallRule) string { return v.Action }).(pulumi.StringOutput)\n}", "func (o FirewallPolicyRuleResponseOutput) Action() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FirewallPolicyRuleResponse) string { return v.Action }).(pulumi.StringOutput)\n}", "func getAction(form string) string {\r\n\tformTagParts := strings.Split(form, \"action=\\\"\")\r\n\treturn strings.Split(formTagParts[1], \"\\\"\")[0]\r\n}", "func (c *Config) handleActionCreateMessage(client MQTT.Client, message MQTT.Message) {\n\tnewActions := []actionmanager.Action{}\n\terr := json.Unmarshal(message.Payload(), &newActions)\n\tif err != nil {\n\t\tklog.Errorf(\"Error in unmarshalling: %s\", err)\n\t}\n\tfor _, newAction := range newActions {\n\t\tactionExists := false\n\t\tfor actionIndex, action := range c.ActionManager.Actions {\n\t\t\tif action.Name == newAction.Name {\n\t\t\t\tc.ActionManager.Actions[actionIndex] = newAction\n\t\t\t\tactionExists = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif actionExists {\n\t\t\tklog.Infof(\"Action: %s has been updated\", newAction.Name)\n\t\t\tklog.Infof(\"Updated Action: %v\", newAction)\n\t\t} else {\n\t\t\tc.ActionManager.Actions = append(c.ActionManager.Actions, newAction)\n\t\t\tklog.Infof(\"Action: %s has been added \", newAction.Name)\n\t\t\tklog.Infof(\"New Action: %v\", newAction)\n\t\t}\n\t\tconfiguration.Config.ActionManager = c.ActionManager\n\t\tif newAction.PerformImmediately {\n\t\t\tnewAction.PerformOperation(c.Converter.DataRead)\n\t\t}\n\t}\n}", "func (o FirewallNetworkRuleCollectionOutput) Action() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *FirewallNetworkRuleCollection) pulumi.StringOutput { return v.Action }).(pulumi.StringOutput)\n}", "func (b Branch) GetAction(ctx context.Context, c *github.Client, owner, repo string) string {\n\toc, rc := getConfig(ctx, c, owner, repo)\n\tmc := mergeConfig(oc, rc, repo)\n\treturn mc.Action\n}", "func getActionInfo(action *driveactivity.ActionDetail) string {\n\treturn getOneOf(*action)\n}", "func (o IPRuleOutput) Action() ActionPtrOutput {\n\treturn o.ApplyT(func(v IPRule) *Action { return v.Action }).(ActionPtrOutput)\n}", "func (s *Scanner) Action(state State, char byte) (a Action) {\n\n\tswitch state {\n\n\tcase StartState:\n\t\tswitch {\n\n\t\tcase s.isAlpha(char), s.isNumeric(char), s.isColon(char),\n\t\t\ts.isDash(char):\n\t\t\ta = MoveAppend\n\n\t\tcase s.isWhitespace(char):\n\t\t\ta = MoveNoAppend\n\n\t\tcase s.isPlus(char), s.isSemicolon(char), s.isLParen(char),\n\t\t\ts.isRParen(char), s.isComma(char), s.isEquals(char):\n\t\t\ta = HaltAppend\n\n\t\tcase s.isEof(char):\n\t\t\ta = HaltNoAppend\n\n\t\tdefault:\n\t\t\ta = ActionError\n\t\t}\n\n\tcase ScanAlpha:\n\t\tif s.isAlpha(char) || s.isNumeric(char) || s.isUnderscore(char) {\n\t\t\ta = MoveAppend\n\t\t} else {\n\t\t\ta = HaltReuse\n\t\t}\n\n\tcase ScanWhitespace:\n\t\tif s.isWhitespace(char) {\n\t\t\ta = MoveNoAppend\n\t\t} else {\n\t\t\ta = MoveAppend\n\t\t}\n\n\tcase ScanNumeric:\n\t\tif s.isNumeric(char) {\n\t\t\ta = MoveAppend\n\t\t} else {\n\t\t\ta = HaltReuse\n\t\t}\n\n\tcase ScanColon:\n\t\tif s.isEquals(char) {\n\t\t\ta = HaltAppend\n\t\t} else {\n\t\t\ta = ActionError\n\t\t}\n\n\tcase ScanDash:\n\t\tif s.isDash(char) {\n\t\t\ta = MoveAppend\n\t\t} else {\n\t\t\ta = HaltReuse\n\t\t}\n\n\tcase ProcessPlusOp, ProcessSemicolon, ProcessLParen, ProcessRParen,\n\t\tProcessComma, ProcessAssign, ProcessComment:\n\t\ta = HaltReuse\n\n\tcase ScanComment:\n\t\ta = MoveNoAppend\n\n\tdefault:\n\t\ta = ActionError\n\t}\n\n\treturn\n}", "func (o *TemplateApplyAction) GetActionOk() (*TemplateApplyActionKind, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Action, true\n}", "func (o ApiOutput) Action() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Api) pulumi.StringPtrOutput { return v.Action }).(pulumi.StringPtrOutput)\n}", "func (o VirtualNetworkRuleResponseOutput) Action() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v VirtualNetworkRuleResponse) *string { return v.Action }).(pulumi.StringPtrOutput)\n}", "func GetActions(obj_name string) (acts []Action) {\n\tapiversion, _ := beego.AppConfig.String(\"apiversion\")\n\tif _, ok := ActionsMap[obj_name]; !ok {\n\t\treturn\n\t}\n\tacts = ActionsMap[obj_name]\n\tfor i := 0; i < len(acts); i++ {\n\t\tacts[i].URI = \"/\" + apiversion + \"/\" + obj_name\n\t\tif acts[i].Primary != \"\" {\n\t\t\tacts[i].URI += \"/:\" + acts[i].Primary\n\t\t}\n\t}\n\treturn\n}", "func (c *Config) FindActionByName(actionName string) (bool, *Action) {\n\n\tfor _, action := range c.Actions {\n\t\tif actionName == action.Name {\n\t\t\treturn true, &action\n\t\t}\n\t}\n\treturn false, nil\n}", "func (r *Rule) action(key item, l *lexer) error {\n\tif key.typ != itemAction {\n\t\tpanic(\"item is not an action\")\n\t}\n\tif !inSlice(key.value, []string{\"alert\", \"drop\", \"pass\"}) {\n\t\treturn fmt.Errorf(\"invalid action: %v\", key.value)\n\t}\n\tr.Action = key.value\n\treturn nil\n}", "func RandomAction() Action {\n\treturn actions[rand.Intn(len(actions))]\n}", "func (o *TemplateApplyAction) GetAction() TemplateApplyActionKind {\n\tif o == nil {\n\t\tvar ret TemplateApplyActionKind\n\t\treturn ret\n\t}\n\n\treturn o.Action\n}", "func UnmarshalAction(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(Action)\n\terr = core.UnmarshalPrimitive(m, \"name\", &obj.Name)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"description\", &obj.Description)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"location\", &obj.Location)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"resource_group\", &obj.ResourceGroup)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"tags\", &obj.Tags)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"user_state\", &obj.UserState, UnmarshalUserState)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_readme_url\", &obj.SourceReadmeURL)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"source\", &obj.Source, UnmarshalExternalSource)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_type\", &obj.SourceType)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"command_parameter\", &obj.CommandParameter)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"bastion\", &obj.Bastion, UnmarshalTargetResourceset)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"targets_ini\", &obj.TargetsIni)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"credentials\", &obj.Credentials, UnmarshalVariableData)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"inputs\", &obj.Inputs, UnmarshalVariableData)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"outputs\", &obj.Outputs, UnmarshalVariableData)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"settings\", &obj.Settings, UnmarshalVariableData)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"trigger_record_id\", &obj.TriggerRecordID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"id\", &obj.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"crn\", &obj.Crn)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"account\", &obj.Account)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_created_at\", &obj.SourceCreatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_created_by\", &obj.SourceCreatedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_updated_at\", &obj.SourceUpdatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_updated_by\", &obj.SourceUpdatedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"created_at\", &obj.CreatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"created_by\", &obj.CreatedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"updated_at\", &obj.UpdatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"updated_by\", &obj.UpdatedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"namespace\", &obj.Namespace)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"state\", &obj.State, UnmarshalActionState)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"playbook_names\", &obj.PlaybookNames)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"sys_lock\", &obj.SysLock, UnmarshalSystemLock)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func (d *DeltaTrace) Action() (*ActionTrace, error) {\n\treturn nil, NotActionError{}\n}", "func (core *coreService) ActionByActionHash(h hash.Hash256) (action.SealedEnvelope, hash.Hash256, uint64, uint32, error) {\n\tif err := core.checkActionIndex(); err != nil {\n\t\treturn action.SealedEnvelope{}, hash.ZeroHash256, 0, 0, status.Error(codes.NotFound, blockindex.ErrActionIndexNA.Error())\n\t}\n\n\tactIndex, err := core.indexer.GetActionIndex(h[:])\n\tif err != nil {\n\t\treturn action.SealedEnvelope{}, hash.ZeroHash256, 0, 0, errors.Wrap(ErrNotFound, err.Error())\n\t}\n\tblk, err := core.dao.GetBlockByHeight(actIndex.BlockHeight())\n\tif err != nil {\n\t\treturn action.SealedEnvelope{}, hash.ZeroHash256, 0, 0, errors.Wrap(ErrNotFound, err.Error())\n\t}\n\tselp, index, err := core.dao.GetActionByActionHash(h, actIndex.BlockHeight())\n\tif err != nil {\n\t\treturn action.SealedEnvelope{}, hash.ZeroHash256, 0, 0, errors.Wrap(ErrNotFound, err.Error())\n\t}\n\treturn selp, blk.HashBlock(), actIndex.BlockHeight(), index, nil\n}", "func (node *RenameTable) GetAction() DDLAction {\n\treturn RenameDDLAction\n}", "func KnownActions() []string {\n\tvar res []string\n\tfor k := range actions {\n\t\tres = append(res, k)\n\t}\n\tsort.Strings(res)\n\treturn res\n}", "func (o *WorkflowSolutionActionDefinition) GetActionTypeOk() (*string, bool) {\n\tif o == nil || o.ActionType == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ActionType, true\n}", "func (s *ExperimentSpec) GetAction() ActionType {\n\tif s.ManualOverride != nil {\n\t\treturn s.ManualOverride.Action\n\t}\n\treturn ActionType(\"\")\n}", "func (m *SecureScoreControlProfile) GetActionType()(*string) {\n return m.actionType\n}", "func (game *Game) DoItemAction(words []string, action *Action) string {\n\tif len(words) == 0 {\n\t\treturn strings.Title(action.Name) + \" what?\"\n\t}\n\n\troom := game.Rooms[game.Location]\n\titems := visibleItems(append(game.Inventory, room.BasicRoom().Items...), false, true)\n\n\tmsg, item, words := findTarget(words, items, false)\n\n\tif msg != \"\" {\n\t\treturn msg\n\t}\n\n\tisSyntaxFound := false\n\tif action.Syntax != \"\" {\n\t\twords, isSyntaxFound = findSyntax(words, action.Syntax)\n\t}\n\n\tif action.IsTargetRequired && len(words) == 0 && action.Syntax != \"\" {\n\t\treturn strings.Title(action.Name) + \" \" + action.Syntax + \" what?\"\n\t}\n\n\tif action.IsActorTarget {\n\t\tactors := filterActors(items)\n\t\tvar actor Actor\n\t\tvar msg string\n\n\t\tif len(actors) == 1 && !isSyntaxFound && action.Syntax != \"\" {\n\t\t\tactor = actors[0]\n\t\t} else {\n\t\t\tmsg, actor, _ = findActor(words, actors)\n\t\t\tif msg != \"\" {\n\t\t\t\treturn msg\n\t\t\t}\n\t\t}\n\n\t\tif action.IsTopicRequired {\n\t\t\tfor _, topic := range findTopics(strings.Split(item.Basic().Name, \" \"), actor) {\n\t\t\t\tif strings.Contains(topic.Action, action.Name) {\n\t\t\t\t\tif topic.IsItemConsumed {\n\t\t\t\t\t\tgame.ChangeParent(item, \"\")\n\t\t\t\t\t}\n\t\t\t\t\tmsg = actor.OnTopic(topic, action, item)\n\t\t\t\t\treturn msg\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn actor.OnTopic(nil, action, item)\n\t\t}\n\n\t\treturn game.finalizeItemAction(item, actor, action)\n\t}\n\n\tmsg, target, _ := findTarget(words, items, !action.IsTargetRequired)\n\n\tif !action.IsTargetRequired {\n\t\treturn game.finalizeItemAction(item, target, action)\n\t}\n\n\tif msg != \"\" {\n\t\treturn msg\n\t}\n\n\tif target == nil {\n\t\treturn strings.Title(action.Name) + \" \" + action.Syntax + \" what?\"\n\t}\n\n\treturn game.finalizeItemAction(item, target, action)\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.60837555", "0.6066628", "0.60654604", "0.60504407", "0.603678", "0.60341877", "0.6033532", "0.6014043", "0.60112613", "0.59933287", "0.5984069", "0.59759426", "0.5964852", "0.59637815", "0.5962538", "0.5956454", "0.5951283", "0.5926363", "0.5919571", "0.5918547", "0.5918324", "0.58858895", "0.5885203", "0.5868583", "0.58585733", "0.5832534", "0.58142596", "0.58142084", "0.57910883", "0.5763934", "0.5747105", "0.5736037", "0.5735037", "0.5720992", "0.571119", "0.56893015", "0.5663015", "0.5659821", "0.5654102", "0.56510514", "0.56503856", "0.5647221", "0.5645987", "0.56298333", "0.5607329", "0.56021386", "0.5597633", "0.55843824", "0.5580696", "0.55638236", "0.5561889", "0.5560874", "0.5553819", "0.555185", "0.5536305", "0.5535009", "0.55296946", "0.54983586", "0.54956436", "0.54942876", "0.5483247", "0.54814017", "0.54732865", "0.54707503", "0.54402816", "0.54233897", "0.54079795", "0.540191", "0.5388372", "0.53716433", "0.53680813", "0.5349716", "0.53490835", "0.5330529", "0.5329904", "0.53226256", "0.53098625", "0.5299832", "0.52996147", "0.52886474" ]
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.(*Action), nil\n\t}\n\tobj := new(Action)\n\treturn obj, m.unmarshalPayload(obj)\n}", "func messageToAny(t *testing.T, msg proto.Message) *any.Any {\n\ts, err := ptypes.MarshalAny(msg)\n\tif err != nil {\n\t\tt.Fatalf(\"transfer failed: %v\", err)\n\t\treturn nil\n\t}\n\treturn s\n}", "func MessageToAny(msg proto.Message) *anypb.Any {\n\tout, err := MessageToAnyWithError(msg)\n\tif err != nil {\n\t\tlogger.Sugar().Error(fmt.Sprintf(\"error marshaling Any %s: %v\", msg.String(), err))\n\t\treturn nil\n\t}\n\treturn out\n}", "func toAction(actionInput string) (GameAction, error) {\n\tnormalised := strings.ToUpper(strings.TrimSuffix(actionInput, \"\\n\"))\n\tif len(normalised) < 1 {\n\t\treturn -1, errors.New(\"No action specified\")\n\t}\n\n\tswitch normalised[0] {\n\tcase 'E':\n\t\treturn Explore, nil\n\n\tcase 'F':\n\t\treturn Flag, nil\n\n\tdefault:\n\t\treturn -1, errors.New(\"Invalid action\")\n\t}\n}", "func messageToAny(msg proto.Message) *anypb.Any {\n\tout, err := messageToAnyWithError(msg)\n\tif err != nil {\n\t\tlog.Error(fmt.Sprintf(\"error marshaling Any %s: %v\", prototext.Format(msg), err))\n\t\treturn nil\n\t}\n\treturn out\n}", "func ParseAction(b string) (MessageAction, error) {\n\tma := MessageAction{}\n\n\tform, err := url.ParseQuery(b)\n\tif err != nil {\n\t\treturn ma, errors.Wrap(err, \"failed to parse request body\")\n\t}\n\n\terr = json.Unmarshal([]byte(form.Get(\"payload\")), &ma)\n\tif err != nil {\n\t\treturn ma, errors.Wrap(err, \"failed to parse request body\")\n\t}\n\treturn ma, err\n}", "func NewAction(payload interface{}) Action {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Error: %v\\n\", r)\n\t\t\tfmt.Fprintf(os.Stderr, \"Payload: %v\\n\", payload)\n\t\t}\n\t}()\n\n\tvar a Action\n\ta.payload = payload\n\ta.headers = make(map[string]string)\n\n\tfor k, v := range payload.(map[interface{}]interface{}) {\n\t\tswitch k {\n\t\tcase \"catch\":\n\t\t\ta.catch = v.(string)\n\t\tcase \"warnings\":\n\t\t\t// TODO\n\t\t\tcontinue\n\t\tcase \"allowed_warnings\":\n\t\t\t// TODO\n\t\t\tcontinue\n\t\tcase \"node_selector\":\n\t\t\tcontinue\n\t\tcase \"headers\":\n\t\t\tfor kk, vv := range v.(map[interface{}]interface{}) {\n\t\t\t\ta.headers[kk.(string)] = vv.(string)\n\t\t\t}\n\t\tdefault:\n\t\t\ta.method = k.(string)\n\t\t\ta.params = v.(map[interface{}]interface{})\n\t\t}\n\t}\n\n\treturn a\n}", "func Action(message string) string {\n\treturn Encode(ACTION, message)\n}", "func UnmarshalAction(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(Action)\n\terr = core.UnmarshalPrimitive(m, \"name\", &obj.Name)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"description\", &obj.Description)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"location\", &obj.Location)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"resource_group\", &obj.ResourceGroup)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"tags\", &obj.Tags)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"user_state\", &obj.UserState, UnmarshalUserState)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_readme_url\", &obj.SourceReadmeURL)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"source\", &obj.Source, UnmarshalExternalSource)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_type\", &obj.SourceType)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"command_parameter\", &obj.CommandParameter)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"bastion\", &obj.Bastion, UnmarshalTargetResourceset)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"targets_ini\", &obj.TargetsIni)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"credentials\", &obj.Credentials, UnmarshalVariableData)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"inputs\", &obj.Inputs, UnmarshalVariableData)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"outputs\", &obj.Outputs, UnmarshalVariableData)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"settings\", &obj.Settings, UnmarshalVariableData)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"trigger_record_id\", &obj.TriggerRecordID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"id\", &obj.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"crn\", &obj.Crn)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"account\", &obj.Account)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_created_at\", &obj.SourceCreatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_created_by\", &obj.SourceCreatedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_updated_at\", &obj.SourceUpdatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_updated_by\", &obj.SourceUpdatedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"created_at\", &obj.CreatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"created_by\", &obj.CreatedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"updated_at\", &obj.UpdatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"updated_by\", &obj.UpdatedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"namespace\", &obj.Namespace)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"state\", &obj.State, UnmarshalActionState)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"playbook_names\", &obj.PlaybookNames)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"sys_lock\", &obj.SysLock, UnmarshalSystemLock)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func (c *Client) Action(msg *Message) bool {\n\tif msg.ActionID() == \"\" {\n\t\tmsg.AddActionID()\n\t}\n\n\tif err := c.write(msg.Bytes()); err != nil {\n\t\tc.emitError(err)\n\t\treturn false\n\t}\n\treturn true\n}", "func (self *NXOutput) GetActionMessage() openflow13.Action {\n\tofsNbits := self.fieldRange.ToOfsBits()\n\ttargetField := self.field\n\t// Create NX output Register action\n\treturn openflow13.NewOutputFromField(targetField, ofsNbits)\n}", "func (a *Action) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"parameters\":\n\t\t\terr = unpopulate(val, \"Parameters\", &a.Parameters)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &a.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (m *WebhookActionBody) Action() Action {\n\treturn m.actionField\n}", "func (c *Config) handleActionCreateMessage(client MQTT.Client, message MQTT.Message) {\n\tnewActions := []actionmanager.Action{}\n\terr := json.Unmarshal(message.Payload(), &newActions)\n\tif err != nil {\n\t\tklog.Errorf(\"Error in unmarshalling: %s\", err)\n\t}\n\tfor _, newAction := range newActions {\n\t\tactionExists := false\n\t\tfor actionIndex, action := range c.ActionManager.Actions {\n\t\t\tif action.Name == newAction.Name {\n\t\t\t\tc.ActionManager.Actions[actionIndex] = newAction\n\t\t\t\tactionExists = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif actionExists {\n\t\t\tklog.Infof(\"Action: %s has been updated\", newAction.Name)\n\t\t\tklog.Infof(\"Updated Action: %v\", newAction)\n\t\t} else {\n\t\t\tc.ActionManager.Actions = append(c.ActionManager.Actions, newAction)\n\t\t\tklog.Infof(\"Action: %s has been added \", newAction.Name)\n\t\t\tklog.Infof(\"New Action: %v\", newAction)\n\t\t}\n\t\tconfiguration.Config.ActionManager = c.ActionManager\n\t\tif newAction.PerformImmediately {\n\t\t\tnewAction.PerformOperation(c.Converter.DataRead)\n\t\t}\n\t}\n}", "func (rr *HashedRouter) Action(addr Addr, msg Envelope) {\n\tswitch msg.Data.(type) {\n\tcase AddRoute:\n\t\tif msg.Sender != nil && msg.Sender.ID() != addr.ID() {\n\t\t\tif rr.addrs.Add(msg.Sender) {\n\t\t\t\trr.hashes.Add(rr.ref(msg.Sender))\n\t\t\t}\n\t\t}\n\tcase RemoveRoute:\n\t\tif msg.Sender != nil && msg.Sender.ID() != addr.ID() {\n\t\t\tif rr.addrs.RemoveAddr(msg.Sender) {\n\t\t\t\trr.hashes.Remove(rr.ref(msg.Sender))\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tif hashed, ok := msg.Data.(Hashed); ok {\n\t\t\tif targetAddr, found := rr.hashes.Get(hashed.Hash()); found {\n\t\t\t\tif target, got := rr.addrs.Get(targetAddr); got {\n\t\t\t\t\tif err := target.Forward(msg); err != nil {\n\t\t\t\t\t\tlog.Printf(\"[Hashed:Routing] Failed to route message %q to addr %q: %#v\", msg.Ref.String(), addr.Addr(), err)\n\t\t\t\t\t}\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tlog.Printf(\"[Hashed:Routing] Failed get node for addr %q to route message %q\", targetAddr, msg.Ref.String())\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlog.Printf(\"[Hashed:Routing] Message %q data with hash %q has no routable address\", msg.Ref.String(), hashed.Hash())\n\t\t\treturn\n\t\t}\n\n\t\tlog.Printf(\"[Hashed:Routing] Message %q data of type %T must implement Hashed interface: %#v\", msg.Ref.String(), msg.Data, msg)\n\t}\n}", "func newActionMsg(action Action) ActionMsg {\n\treturn ActionMsg{\n\t\tAction: action,\n\t\tTime: time.Now(),\n\t}\n}", "func (rr *BroadcastRouter) Action(addr Addr, msg Envelope) {\n\tswitch msg.Data.(type) {\n\tcase AddRoute:\n\t\tif msg.Sender != nil && msg.Sender.ID() != addr.ID() {\n\t\t\trr.addrs.Add(msg.Sender)\n\t\t}\n\tcase RemoveRoute:\n\t\tif msg.Sender != nil && msg.Sender.ID() != addr.ID() {\n\t\t\trr.addrs.RemoveAddr(msg.Sender)\n\t\t}\n\tdefault:\n\t\trr.addrs.ForEach(func(addr Addr, i int) bool {\n\t\t\tif err := addr.Forward(msg); err != nil {\n\t\t\t\tlog.Printf(\"[Broadcast:Routing] Failed to route message %q to addr %q: %#v\", msg.Ref.String(), addr.Addr(), err)\n\t\t\t}\n\t\t\treturn true\n\t\t})\n\t}\n}", "func (m *TamAction) UnmarshalJSON(raw []byte) error {\n\t// AO0\n\tvar dataAO0 struct {\n\t\tAffectedObjectType string `json:\"AffectedObjectType,omitempty\"`\n\n\t\tAlertType *string `json:\"AlertType,omitempty\"`\n\n\t\tIdentifiers []*TamIdentifiers `json:\"Identifiers\"`\n\n\t\tOperationType *string `json:\"OperationType,omitempty\"`\n\n\t\tQueries []*TamQueryEntry `json:\"Queries\"`\n\n\t\tType *string `json:\"Type,omitempty\"`\n\t}\n\tif err := swag.ReadJSON(raw, &dataAO0); err != nil {\n\t\treturn err\n\t}\n\n\tm.AffectedObjectType = dataAO0.AffectedObjectType\n\n\tm.AlertType = dataAO0.AlertType\n\n\tm.Identifiers = dataAO0.Identifiers\n\n\tm.OperationType = dataAO0.OperationType\n\n\tm.Queries = dataAO0.Queries\n\n\tm.Type = dataAO0.Type\n\n\treturn nil\n}", "func (a *Action) UnmarshalJSON(b []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(b, &s); err != nil {\n\t\treturn err\n\t}\n\tif s == \"\" {\n\t\t*a = Action(\"apply\")\n\t} else {\n\t\t*a = Action(s)\n\t}\n\treturn nil\n}", "func NewFileActionFromMSG(msg *nats.Msg) (*FileAction, error) {\n\tfa := new(FileAction)\n\n\terr := json.Unmarshal(msg.Data, &fa)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn fa, nil\n}", "func (c WafAction) ToPtr() *WafAction {\n\treturn &c\n}", "func (core *coreService) SendAction(ctx context.Context, in *iotextypes.Action) (string, error) {\n\tlog.Logger(\"api\").Debug(\"receive send action request\")\n\tselp, err := (&action.Deserializer{}).SetEvmNetworkID(core.EVMNetworkID()).ActionToSealedEnvelope(in)\n\tif err != nil {\n\t\treturn \"\", status.Error(codes.InvalidArgument, err.Error())\n\t}\n\n\t// reject action if chainID is not matched at KamchatkaHeight\n\tif err := core.validateChainID(in.GetCore().GetChainID()); err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Add to local actpool\n\tctx = protocol.WithRegistry(ctx, core.registry)\n\thash, err := selp.Hash()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tl := log.Logger(\"api\").With(zap.String(\"actionHash\", hex.EncodeToString(hash[:])))\n\tif err = core.ap.Add(ctx, selp); err != nil {\n\t\ttxBytes, serErr := proto.Marshal(in)\n\t\tif serErr != nil {\n\t\t\tl.Error(\"Data corruption\", zap.Error(serErr))\n\t\t} else {\n\t\t\tl.With(zap.String(\"txBytes\", hex.EncodeToString(txBytes))).Error(\"Failed to accept action\", zap.Error(err))\n\t\t}\n\t\tst := status.New(codes.Internal, err.Error())\n\t\tbr := &errdetails.BadRequest{\n\t\t\tFieldViolations: []*errdetails.BadRequest_FieldViolation{\n\t\t\t\t{\n\t\t\t\t\tField: \"Action rejected\",\n\t\t\t\t\tDescription: action.LoadErrorDescription(err),\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\tst, err := st.WithDetails(br)\n\t\tif err != nil {\n\t\t\tlog.Logger(\"api\").Panic(\"Unexpected error attaching metadata\", zap.Error(err))\n\t\t}\n\t\treturn \"\", st.Err()\n\t}\n\t// If there is no error putting into local actpool,\n\t// Broadcast it to the network\n\tmsg := in\n\tif ge := core.bc.Genesis(); ge.IsQuebec(core.bc.TipHeight()) {\n\t\terr = core.messageBatcher.Put(&batch.Message{\n\t\t\tChainID: core.bc.ChainID(),\n\t\t\tTarget: nil,\n\t\t\tData: msg,\n\t\t})\n\t} else {\n\t\t//TODO: remove height check after activated\n\t\terr = core.broadcastHandler(ctx, core.bc.ChainID(), msg)\n\t}\n\tif err != nil {\n\t\tl.Warn(\"Failed to broadcast SendAction request.\", zap.Error(err))\n\t}\n\treturn hex.EncodeToString(hash[:]), nil\n}", "func (rr *RoundRobinRouter) Action(addr Addr, msg Envelope) {\n\tswitch msg.Data.(type) {\n\tcase AddRoute:\n\t\tif msg.Sender != nil && msg.Sender.ID() != addr.ID() {\n\t\t\tif rr.addrs.RemoveAddr(msg.Sender) {\n\t\t\t\trr.set.Remove(msg.Sender.Addr())\n\t\t\t}\n\t\t}\n\tcase RemoveRoute:\n\t\tif msg.Sender != nil && msg.Sender.ID() != addr.ID() {\n\t\t\tif rr.addrs.Add(msg.Sender) {\n\t\t\t\trr.set.Add(msg.Sender.Addr())\n\t\t\t}\n\t\t}\n\tdefault:\n\t\ttargetAddr := rr.set.Get()\n\t\tif target, ok := rr.addrs.Get(targetAddr); ok {\n\t\t\tif err := target.Forward(msg); err != nil {\n\t\t\t\tlog.Printf(\"[RoundRobin:Routing] Failed to route message %q to addr %q: %#v\", msg.Ref.String(), addr.Addr(), err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tlog.Printf(\"[RoundRobin:Routing] Failed get node for addr %q to route message %q\", targetAddr, msg.Ref.String())\n\t}\n}", "func (m *WebhookActionBody) UnmarshalJSON(raw []byte) error {\n\tvar data struct {\n\t\tAction json.RawMessage `json:\"action\"`\n\n\t\tApplication *Application `json:\"application\"`\n\n\t\tDevice *WebhookActionDevice `json:\"device\"`\n\n\t\tRule *Rule `json:\"rule\"`\n\n\t\tTimestamp *strfmt.DateTime `json:\"timestamp\"`\n\t}\n\tbuf := bytes.NewBuffer(raw)\n\tdec := json.NewDecoder(buf)\n\tdec.UseNumber()\n\n\tif err := dec.Decode(&data); err != nil {\n\t\treturn err\n\t}\n\n\tpropAction, err := UnmarshalAction(bytes.NewBuffer(data.Action), runtime.JSONConsumer())\n\tif err != nil && err != io.EOF {\n\t\treturn err\n\t}\n\n\tvar result WebhookActionBody\n\n\t// action\n\tresult.actionField = propAction\n\n\t// application\n\tresult.Application = data.Application\n\n\t// device\n\tresult.Device = data.Device\n\n\t// rule\n\tresult.Rule = data.Rule\n\n\t// timestamp\n\tresult.Timestamp = data.Timestamp\n\n\t*m = result\n\n\treturn nil\n}", "func (action *Action) UnmarshalJSON(data []byte) error {\n\tvar s string\n\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\n\ta := Action(s)\n\tif !a.IsValid() {\n\t\treturn fmt.Errorf(\"invalid action '%v'\", s)\n\t}\n\n\t*action = a\n\n\treturn nil\n}", "func (rr *RandomRouter) Action(addr Addr, msg Envelope) {\n\tswitch msg.Data.(type) {\n\tcase AddRoute:\n\t\tif msg.Sender != nil && msg.Sender.ID() != addr.ID() {\n\t\t\tif rr.addrs.Add(msg.Sender) {\n\t\t\t\trr.rand.Add(msg.Sender.Addr())\n\t\t\t}\n\t\t}\n\tcase RemoveRoute:\n\t\tif msg.Sender != nil && msg.Sender.ID() != addr.ID() {\n\t\t\tif rr.addrs.RemoveAddr(msg.Sender) {\n\t\t\t\trr.rand.Remove(msg.Sender.Addr())\n\t\t\t}\n\t\t}\n\tdefault:\n\t\ttargetAddr := rr.rand.Get()\n\t\tif target, ok := rr.addrs.Get(targetAddr); ok {\n\t\t\tif err := target.Forward(msg); err != nil {\n\t\t\t\tlog.Printf(\"[Random:Routing] Failed to route message %q to addr %q: %#v\", msg.Ref.String(), addr.Addr(), err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tlog.Printf(\"[Random:Routing] Failed get node for addr %q to route message %q\", targetAddr, msg.Ref.String())\n\t}\n}", "func (o IPRuleOutput) Action() ActionPtrOutput {\n\treturn o.ApplyT(func(v IPRule) *Action { return v.Action }).(ActionPtrOutput)\n}", "func SendMessage(state interface{}, action boutique.Action) interface{} {\n\ts := state.(data.State)\n\n\tswitch action.Type {\n\tcase actions.ActSendMessage:\n\t\tmsg := action.Update.(data.Message)\n\t\tmsg.ID = s.NextMsgID\n\t\ts.Messages = boutique.CopyAppendSlice(s.Messages, msg).([]data.Message)\n\t\ts.NextMsgID = s.NextMsgID + 1\n\t}\n\treturn s\n}", "func (c DeliveryRuleAction) ToPtr() *DeliveryRuleAction {\n\treturn &c\n}", "func (o IPRuleResponseOutput) Action() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IPRuleResponse) *string { return v.Action }).(pulumi.StringPtrOutput)\n}", "func (a *EmailAction) FromMap(result map[string]string) (EmailAction, error) {\n\tdelay, err := time.ParseDuration(result[\"Delay\"])\n\tif err != nil {\n\t\treturn *a, errors.Wrap(err, \"cannot convert Delay value to integer\")\n\t}\n\ttimestamp, err := time.Parse(TimeFormat, result[\"Timestamp\"])\n\tif err != nil {\n\t\treturn *a, errors.Wrap(err, \"cannot convert timestamp\")\n\t}\n\ta.Action = Action{ID: result[\"ID\"], UserID: result[\"UserID\"], Delay: time.Duration(delay) * time.Second, Timestamp: timestamp}\n\ta.To = result[\"To\"]\n\ta.Body = result[\"Body\"]\n\ta.Subject = result[\"Subject\"]\n\treturn *a, err\n}", "func (_ EventFilterAliases) Action(p graphql.ResolveParams) (EventFilterAction, error) {\n\tval, err := graphql.DefaultResolver(p.Source, p.Info.FieldName)\n\tret, ok := EventFilterAction(val.(string)), true\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\tif !ok {\n\t\treturn ret, errors.New(\"unable to coerce value for field 'action'\")\n\t}\n\treturn ret, err\n}", "func (o FirewallPolicyRuleOutput) Action() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FirewallPolicyRule) *string { return v.Action }).(pulumi.StringPtrOutput)\n}", "func (a *ActStatus) ToMessage(msg types.IMessage, height uint64) error {\n\ta.mutex.Lock()\n\tdefer a.mutex.Unlock()\n\n\tvar toAct types.IAccount\n\ttoAct = a.db.Account(msg.MsgBody().MsgTo())\n\terr := toAct.UpdateLocked(a.confirmed)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = toAct.ToMessage(msg, height)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// publish token need consume FM\n\tif fmtypes.MessageType(msg.Type()) == fmtypes.Token {\n\t\tif msg.MsgBody().MsgTo() == config.Param.EaterAddress {\n\t\t\terr = toAct.EaterMessage(msg, height)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\teater := a.db.Account(config.Param.EaterAddress)\n\t\t\terr := eater.UpdateLocked(a.confirmed)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = eater.EaterMessage(msg, height)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ta.setAccount(eater)\n\t\t}\n\t}\n\n\ta.setAccount(toAct)\n\treturn nil\n}", "func ConvertStringToAction(in string) (configs.Action, error) {\n\tswitch in {\n\tcase \"SCMP_ACT_KILL\":\n\t\treturn configs.Kill, nil\n\tcase \"SCMP_ACT_ERRNO\":\n\t\treturn configs.Errno, nil\n\tcase \"SCMP_ACT_TRAP\":\n\t\treturn configs.Trap, nil\n\tcase \"SCMP_ACT_ALLOW\":\n\t\treturn configs.Allow, nil\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"string %s is not a valid action for seccomp\", in)\n\t}\n}", "func ParseData(req *http.Request) (Action, error) {\n\t// parse bytes from req object\n\tbodyBytes, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\treturn Action{}, err\n\t}\n\n\t// build struct from byte array\n\tvar body Action\n\terr = json.Unmarshal(bodyBytes, &body)\n\tif err != nil {\n\t\treturn Action{}, err\n\t}\n\n\treturn body, nil // return new Action struct\n}", "func (oe *OraErr) Action() string { return oe.action }", "func (o VirtualNetworkRuleOutput) Action() ActionPtrOutput {\n\treturn o.ApplyT(func(v VirtualNetworkRule) *Action { return v.Action }).(ActionPtrOutput)\n}", "func NewAnyMessage(data map[string]interface{}) msgs.Message {\n\tvar msg Any = data\n\treturn &msg\n}", "func (act *ActionTrace) Action() (*ActionTrace, error) {\n\treturn act, nil\n}", "func NewUDPAction(a map[interface{}]interface{}) (UDPAction, bool) {\n\tvalid := true\n\n\tif a[\"title\"] == \"\" || a[\"title\"] == nil {\n\t\tlog.Error(\"UDPAction must define a title.\")\n\t\ta[\"title\"] = \"\"\n\t\tvalid = false\n\t}\n\tif a[\"address\"] == \"\" || a[\"address\"] == nil {\n\t\tlog.Error(\"UDPAction must define a target address.\")\n\t\ta[\"address\"] = \"\"\n\t\tvalid = false\n\t}\n\tif a[\"payload\"] != nil && a[\"payload64\"] != nil {\n\t\tlog.Error(\"Either payload or payload64 can be defined in a UDPAction.\")\n\t\ta[\"payload\"] = \"\"\n\t\ta[\"payload_bytes\"] = []byte{}\n\t\tvalid = false\n\t}\n\tif a[\"payload\"] == nil {\n\t\ta[\"payload\"] = \"\"\n\t}\n\tif a[\"payload64\"] == nil {\n\t\ta[\"payload_bytes\"] = []byte{}\n\t} else {\n\t\tdata, err := base64.StdEncoding.DecodeString(a[\"payload64\"].(string))\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error while decoding payload64 value: %s (%s)\", a[\"payload64\"], err.Error())\n\t\t\ta[\"payload_bytes\"] = []byte{}\n\t\t\tvalid = false\n\t\t} else {\n\t\t\ta[\"payload_bytes\"] = data\n\t\t}\n\t}\n\n\tudpAction := UDPAction{\n\t\tAddress: a[\"address\"].(string),\n\t\tPayload: a[\"payload\"].(string),\n\t\tPayload_bytes: a[\"payload_bytes\"].([]byte),\n\t\tTitle: a[\"title\"].(string),\n\t}\n\n\tlog.Debugf(\"UDPAction: %v\", udpAction)\n\n\treturn udpAction, valid\n}", "func (a *Action) Invoke(action *models.Action, body string) error {\n\t_, err := a.GetClient().Post(fmt.Sprintf(ACTION_INVOKE, action.GetDevice().ID, action.Name), body, &models.ClientOptions{\n\t\tTextPlain: true,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (state *State) ActionToString(player int, action int) string {\n\tcs := C.StateActionToString(state.state, C.int(player), C.int(action))\n\tstr := C.GoString(cs)\n\tC.free(unsafe.Pointer(cs))\n\treturn str\n}", "func UnmarshalActionLite(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(ActionLite)\n\terr = core.UnmarshalPrimitive(m, \"name\", &obj.Name)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"description\", &obj.Description)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"id\", &obj.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"crn\", &obj.Crn)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"location\", &obj.Location)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"resource_group\", &obj.ResourceGroup)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"namespace\", &obj.Namespace)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"tags\", &obj.Tags)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"playbook_name\", &obj.PlaybookName)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"user_state\", &obj.UserState, UnmarshalUserState)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"state\", &obj.State, UnmarshalActionLiteState)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"sys_lock\", &obj.SysLock, UnmarshalSystemLock)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"created_at\", &obj.CreatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"created_by\", &obj.CreatedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"updated_at\", &obj.UpdatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"updated_by\", &obj.UpdatedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func JSONtoRequest(js []byte) (Action, error) {\n\tact := Action{}\n\terr := json.Unmarshal(js, &act)\n\treturn act, err\n}", "func (ec *executionContext) unmarshalInputActionsRuleActionInput(ctx context.Context, obj interface{}) (models.ActionsRuleActionInput, error) {\n\tvar it models.ActionsRuleActionInput\n\tvar asMap = obj.(map[string]interface{})\n\n\tfor k, v := range asMap {\n\t\tswitch k {\n\t\tcase \"actionID\":\n\t\t\tvar err error\n\t\t\tit.ActionID, err = ec.unmarshalNActionID2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋpkgᚋactionsᚋcoreᚐActionID(ctx, v)\n\t\t\tif err != nil {\n\t\t\t\treturn it, err\n\t\t\t}\n\t\tcase \"data\":\n\t\t\tvar err error\n\t\t\tit.Data, err = ec.unmarshalNString2string(ctx, v)\n\t\t\tif err != nil {\n\t\t\t\treturn it, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn it, nil\n}", "func (a *AzureFirewallRCAction) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &a.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "func NewAction(line string) (Action, error) {\n action := Action{}\n isValid := utf8.ValidString(line)\n if !isValid {\n return action, errors.New(\"Action string contains invalid encoded UTF-8\")\n }\n\n instructionRune, length := utf8.DecodeRuneInString(line)\n v, err := strconv.Atoi(line[length:])\n\n if err != nil {\n return action, err\n }\n\n action.Instruction = string(instructionRune)\n action.Value = v\n return action, nil\n}", "func (o RouterNatRuleResponseOutput) Action() RouterNatRuleActionResponseOutput {\n\treturn o.ApplyT(func(v RouterNatRuleResponse) RouterNatRuleActionResponse { return v.Action }).(RouterNatRuleActionResponseOutput)\n}", "func NewAction(action EngineAction) *PacketUnstable {\n\tpkt := &PacketUnstable{}\n\tswitch action := action.(type) {\n\tcase ButtonPressedAction:\n\t\tpkt.Cmd = CmdButtonPressedAction\n\tcase ButtonReleasedAction:\n\t\tpkt.Cmd = CmdButtonReleasedAction\n\tdefault:\n\t\tpanic(fmt.Errorf(\"support for action %T not yet implemented\", action))\n\t}\n\tbuf := &bytes.Buffer{}\n\tif err := binary.Write(buf, binary.LittleEndian, action); err != nil {\n\t\tdie(err)\n\t}\n\tpkt.Data = buf.Bytes()\n\treturn pkt\n}", "func (a *Action) UnmarshalText(text []byte) error {\n\tif _, exists := actions[Action(text)]; exists {\n\t\t*a = Action(text)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unrecognized action type %q\", string(text))\n}", "func (o FirewallPolicyRuleResponseOutput) Action() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FirewallPolicyRuleResponse) string { return v.Action }).(pulumi.StringOutput)\n}", "func (o VirtualNetworkRuleResponseOutput) Action() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v VirtualNetworkRuleResponse) *string { return v.Action }).(pulumi.StringPtrOutput)\n}", "func ParseAction(re *regexp.Regexp, line string) interface{} {\n\t// Regex: `:\\x01ACTION (\\w*) <your bot>\\x01`\n\taction := re.FindStringSubmatch(line)\n\tif len(action) == 0 {\n\t\treturn nil\n\t}\n\n\tuser := get_user(line)\n\tm := make(map[string]string)\n\tm[\"user\"] = user\n\tm[\"action\"] = action[1]\n\treturn m\n}", "func (o GetResolverFirewallRulesFirewallRuleOutput) Action() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetResolverFirewallRulesFirewallRule) string { return v.Action }).(pulumi.StringOutput)\n}", "func (s *Scanner) Action(state State, char byte) (a Action) {\n\n\tswitch state {\n\n\tcase StartState:\n\t\tswitch {\n\n\t\tcase s.isAlpha(char), s.isNumeric(char), s.isColon(char),\n\t\t\ts.isDash(char):\n\t\t\ta = MoveAppend\n\n\t\tcase s.isWhitespace(char):\n\t\t\ta = MoveNoAppend\n\n\t\tcase s.isPlus(char), s.isSemicolon(char), s.isLParen(char),\n\t\t\ts.isRParen(char), s.isComma(char), s.isEquals(char):\n\t\t\ta = HaltAppend\n\n\t\tcase s.isEof(char):\n\t\t\ta = HaltNoAppend\n\n\t\tdefault:\n\t\t\ta = ActionError\n\t\t}\n\n\tcase ScanAlpha:\n\t\tif s.isAlpha(char) || s.isNumeric(char) || s.isUnderscore(char) {\n\t\t\ta = MoveAppend\n\t\t} else {\n\t\t\ta = HaltReuse\n\t\t}\n\n\tcase ScanWhitespace:\n\t\tif s.isWhitespace(char) {\n\t\t\ta = MoveNoAppend\n\t\t} else {\n\t\t\ta = MoveAppend\n\t\t}\n\n\tcase ScanNumeric:\n\t\tif s.isNumeric(char) {\n\t\t\ta = MoveAppend\n\t\t} else {\n\t\t\ta = HaltReuse\n\t\t}\n\n\tcase ScanColon:\n\t\tif s.isEquals(char) {\n\t\t\ta = HaltAppend\n\t\t} else {\n\t\t\ta = ActionError\n\t\t}\n\n\tcase ScanDash:\n\t\tif s.isDash(char) {\n\t\t\ta = MoveAppend\n\t\t} else {\n\t\t\ta = HaltReuse\n\t\t}\n\n\tcase ProcessPlusOp, ProcessSemicolon, ProcessLParen, ProcessRParen,\n\t\tProcessComma, ProcessAssign, ProcessComment:\n\t\ta = HaltReuse\n\n\tcase ScanComment:\n\t\ta = MoveNoAppend\n\n\tdefault:\n\t\ta = ActionError\n\t}\n\n\treturn\n}", "func (f *FirewallPolicyFilterRuleCollectionAction) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &f.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (o ApiOutput) Action() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Api) pulumi.StringPtrOutput { return v.Action }).(pulumi.StringPtrOutput)\n}", "func (c ActionType) ToPtr() *ActionType {\n\treturn &c\n}", "func (o ConnectedRegistryNotificationOutput) Action() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ConnectedRegistryNotification) string { return v.Action }).(pulumi.StringOutput)\n}", "func (o RouterNatRuleOutput) Action() RouterNatRuleActionPtrOutput {\n\treturn o.ApplyT(func(v RouterNatRule) *RouterNatRuleAction { return v.Action }).(RouterNatRuleActionPtrOutput)\n}", "func (a *Ability) websocketListenerAction(c *astiws.Client, eventName string, payload json.RawMessage) error {\n\t// Ability is not activated\n\ta.m.Lock()\n\tactivated := a.activated\n\ta.m.Unlock()\n\tif !activated {\n\t\tastilog.Error(\"astimousing: ability is not activated\")\n\t\treturn nil\n\t}\n\n\t// Unmarshal payload\n\tvar p PayloadAction\n\tif err := json.Unmarshal(payload, &p); err != nil {\n\t\tastilog.Error(errors.Wrapf(err, \"astimousing: json unmarshaling %s into %#v failed\", payload, p))\n\t\treturn nil\n\t}\n\n\t// Switch on action\n\tswitch p.Action {\n\tcase actionClickLeft:\n\t\tastilog.Debugf(\"astimousing: clicking left mouse button with double %v\", p.Double)\n\t\ta.ms.ClickLeft(p.Double)\n\tcase actionClickMiddle:\n\t\tastilog.Debugf(\"astimousing: clicking middle mouse button with double %v\", p.Double)\n\t\ta.ms.ClickMiddle(p.Double)\n\tcase actionClickRight:\n\t\tastilog.Debugf(\"astimousing: clicking right mouse button with double %v\", p.Double)\n\t\ta.ms.ClickRight(p.Double)\n\tcase actionMove:\n\t\tastilog.Debugf(\"astimousing: moving mouse to %dx%d\", p.X, p.Y)\n\t\ta.ms.Move(p.X, p.Y)\n\tcase actionScrollDown:\n\t\tastilog.Debugf(\"astimousing: scrolling down with x %d\", p.X)\n\t\ta.ms.ScrollDown(p.X)\n\tcase actionScrollUp:\n\t\tastilog.Debugf(\"astimousing: scrolling up with x %d\", p.X)\n\t\ta.ms.ScrollUp(p.X)\n\tdefault:\n\t\tastilog.Errorf(\"astimousing: unknown action %s\", p.Action)\n\t}\n\treturn nil\n}", "func (c *Message) Validate(action string) map[string]string {\n\tvar errorMessages = make(map[string]string)\n\tvar err error\n\n\tswitch strings.ToLower(action) {\n\tcase \"update\":\n\t\tif c.Body == \"\" {\n\t\t\terr = errors.New(\"Required Body in a Message\")\n\t\t\terrorMessages[\"Required_body\"] = err.Error()\n\t\t}\n\tdefault:\n\t\tif c.Body == \"\" {\n\t\t\terr = errors.New(\"Required body to Message\")\n\t\t\terrorMessages[\"Required_body\"] = err.Error()\n\t\t}\n\t}\n\treturn errorMessages\n}", "func (ats *ActionService) CreateContactAction(request *ContactActionDataInputModel) (*Result, error) {\n\trequestBody, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse, err := ats.client.makeRequestWithHeaders(\n\t\t\"POST\",\n\t\t\"/action/contact\",\n\t\tbytes.NewBuffer(requestBody),\n\t\tmap[string]string{\n\t\t\t\"Content-Type\": \"application/json-patch+json\",\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer response.Body.Close()\n\tresponseBody := new(Result)\n\tjson.NewDecoder(response.Body).Decode(responseBody)\n\n\tif len(responseBody.ValidationErrors) > 0 {\n\t\terrors := Errors{}\n\t\tfor _, err := range responseBody.ValidationErrors {\n\t\t\terrors = append(errors, fmt.Errorf(\"%s: %s\", err.Field, err.Message))\n\t\t}\n\t\treturn nil, errors\n\t}\n\n\tif _, ok := responseBody.Data.(ActionOutputModel); ok {\n\t\treturn responseBody, nil\n\t}\n\treturn nil, Errors{errors.New(\"response.data is not of type Action\")}\n}", "func UnmarshalActionState(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(ActionState)\n\terr = core.UnmarshalPrimitive(m, \"status_code\", &obj.StatusCode)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"status_job_id\", &obj.StatusJobID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"status_message\", &obj.StatusMessage)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func (core *coreService) Action(actionHash string, checkPending bool) (*iotexapi.ActionInfo, error) {\n\tif err := core.checkActionIndex(); err != nil {\n\t\treturn nil, err\n\t}\n\tactHash, err := hash.HexStringToHash256(actionHash)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, err.Error())\n\t}\n\tact, err := core.getAction(actHash, checkPending)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Unavailable, err.Error())\n\t}\n\treturn act, nil\n}", "func (m *Basic) Action(card *model.Card, face *int, startTime time.Time, payload interface{}) (bool, error) {\n\tquery := convertQuery(payload)\n\tlog.Debugf(\"Submit recieved for face %d: %v\\n\", *face, query)\n\tbutton := studyview.Button(query.Submit)\n\tlog.Debugf(\"Button %s pressed\\n\", button)\n\tswitch *face {\n\tcase QuestionFace:\n\t\t// Any input is fine; the only options are the right button, or 'ENTER' in a text field.\n\tcase AnswerFace:\n\t\tkey := buttonsKey(card, *face)\n\t\tif _, valid := buttonMaps[key][button]; !valid {\n\t\t\treturn false, errors.Errorf(\"Unexpected button press %s\", button)\n\t\t}\n\tdefault:\n\t\treturn false, errors.Errorf(\"Unexpected face %d\", *face)\n\t}\n\tswitch *face {\n\tcase QuestionFace:\n\t\t*face++\n\t\ttypedAnswers := query.TypedAnswers\n\t\tif len(typedAnswers) > 0 {\n\t\t\tresults := make(map[string]answer)\n\t\t\tfor _, fieldName := range card.Fields() {\n\t\t\t\tif typedAnswer, ok := typedAnswers[fieldName]; ok {\n\t\t\t\t\tfv := card.FieldValue(fieldName)\n\t\t\t\t\tif fv == nil {\n\t\t\t\t\t\tpanic(\"No field value for field\")\n\t\t\t\t\t}\n\t\t\t\t\tcorrect, d := diff.Diff(fv.Text, typedAnswer)\n\t\t\t\t\tresults[fieldName] = answer{\n\t\t\t\t\t\tText: d,\n\t\t\t\t\t\tCorrect: correct,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcard.Context = map[string]interface{}{\n\t\t\t\tcontextKeyTypedAnswers: results,\n\t\t\t}\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, nil\n\tcase AnswerFace:\n\t\tlog.Debugf(\"Old schedule: Due %s, Interval: %s, Ease: %f, ReviewCount: %d\\n\", card.Due, card.Interval, card.EaseFactor, card.ReviewCount)\n\t\tif err := model.Schedule(card, time.Now().Sub(startTime), quality(button)); err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tlog.Debugf(\"New schedule: Due %s, Interval: %s, Ease: %f, ReviewCount: %d\\n\", card.Due, card.Interval, card.EaseFactor, card.ReviewCount)\n\t\tcard.Context = nil // Clear any saved answers\n\t\treturn true, nil\n\t}\n\tlog.Printf(\"Unexpected face/button combo: %d / %+v\\n\", *face, button)\n\treturn false, nil\n}", "func applyAction(userValue reflect.Value, e fsmEvent, cb callback) error {\n\tif cb.action == nil {\n\t\treturn nil\n\t}\n\tvalues := make([]reflect.Value, 0, len(e.args)+1)\n\tvalues = append(values, userValue)\n\tfor _, arg := range e.args {\n\t\tvalues = append(values, reflect.ValueOf(arg))\n\t}\n\tres := reflect.ValueOf(cb.action).Call(values)\n\n\tif res[0].Interface() != nil {\n\t\treturn xerrors.Errorf(\"Error applying event transition `%+v`: %w\", e.name, res[0].Interface().(error))\n\t}\n\treturn nil\n}", "func (o RuleOutput) Action() RuleActionPtrOutput {\n\treturn o.ApplyT(func(v Rule) *RuleAction { return v.Action }).(RuleActionPtrOutput)\n}", "func (agent *ActionAgent) dispatchAction(actionPath, data string) error {\n\tagent.actionMutex.Lock()\n\tdefer agent.actionMutex.Unlock()\n\n\tlog.Infof(\"action dispatch %v\", actionPath)\n\tactionNode, err := actionnode.ActionNodeFromJson(data, actionPath)\n\tif err != nil {\n\t\tlog.Errorf(\"action decode failed: %v %v\", actionPath, err)\n\t\treturn nil\n\t}\n\n\tcmd := []string{\n\t\tagent.vtActionBinFile,\n\t\t\"-action\", actionNode.Action,\n\t\t\"-action-node\", actionPath,\n\t\t\"-action-guid\", actionNode.ActionGuid,\n\t}\n\tcmd = append(cmd, logutil.GetSubprocessFlags()...)\n\tcmd = append(cmd, topo.GetSubprocessFlags()...)\n\tcmd = append(cmd, dbconfigs.GetSubprocessFlags()...)\n\tcmd = append(cmd, mysqlctl.GetSubprocessFlags()...)\n\tlog.Infof(\"action launch %v\", cmd)\n\tvtActionCmd := exec.Command(cmd[0], cmd[1:]...)\n\n\tstdOut, vtActionErr := vtActionCmd.CombinedOutput()\n\tif vtActionErr != nil {\n\t\tlog.Errorf(\"agent action failed: %v %v\\n%s\", actionPath, vtActionErr, stdOut)\n\t\t// If the action failed, preserve single execution path semantics.\n\t\treturn vtActionErr\n\t}\n\n\tlog.Infof(\"Agent action completed %v %s\", actionPath, stdOut)\n\tagent.afterAction(actionPath, actionNode.Action == actionnode.TABLET_ACTION_APPLY_SCHEMA)\n\treturn nil\n}", "func (d *DeltaTrace) Action() (*ActionTrace, error) {\n\treturn nil, NotActionError{}\n}", "func NewRecvAction(args any) *Action {\n\treturn &Action{Args: args}\n}", "func (msg *Any) Decode(representation msgs.Representation, content []byte) error {\n\tswitch representation {\n\tcase msgs.JSONRepresentation:\n\t\treturn json.Unmarshal(content, msg)\n\tdefault:\n\t\tpanic(fmt.Errorf(\"Decode error: unknown representational format '%s'\", representation))\n\t}\n}", "func (o FirewallNetworkRuleCollectionOutput) Action() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *FirewallNetworkRuleCollection) pulumi.StringOutput { return v.Action }).(pulumi.StringOutput)\n}", "func (conn *Conn) Action(t, msg string) { conn.Ctcp(t, ACTION, msg) }", "func (o ScheduledQueryRulesAlertV2Output) Action() ScheduledQueryRulesAlertV2ActionPtrOutput {\n\treturn o.ApplyT(func(v *ScheduledQueryRulesAlertV2) ScheduledQueryRulesAlertV2ActionPtrOutput { return v.Action }).(ScheduledQueryRulesAlertV2ActionPtrOutput)\n}", "func (s *GRPCServer) HandleAction(ctx context.Context, handleActionRequest *dashboard.HandleActionRequest) (*dashboard.HandleActionResponse, error) {\n\tvar payload action.Payload\n\tif err := json.Unmarshal(handleActionRequest.Payload, &payload); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := s.Impl.HandleAction(ctx, payload); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &dashboard.HandleActionResponse{}, nil\n}", "func ParseAction(v string) (ActionSpec, error) {\n\tparts := strings.Fields(v)\n\tswitch len(parts) {\n\tcase 0:\n\t\treturn ActionSpec{}, fmt.Errorf(\"missing definition: \\\"%s\\\"\", v)\n\tcase 1:\n\t\treturn ActionSpec{Type: parts[0]}, nil\n\tdefault:\n\t\treturn ActionSpec{Type: parts[0], Args: parts[1:]}, nil\n\t}\n}", "func PersistenceActionFromUnstructured(r *unstructured.Unstructured) (*PersistenceAction, error) {\n\tb, err := json.Marshal(r.Object)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar s PersistenceAction\n\tif err := json.Unmarshal(b, &s); err != nil {\n\t\treturn nil, err\n\t}\n\ts.TypeMeta.Kind = TPRPersistenceActionsKind\n\ts.TypeMeta.APIVersion = TPRGroup + \"/\" + TPRVersion\n\treturn &s, nil\n}", "func (game *Game) DoActorAction(words []string, action *Action) string {\n\tif len(words) == 0 {\n\t\treturn strings.Title(action.Name) + \" who?\"\n\t}\n\n\troom := game.Rooms[game.Location]\n\titems := visibleItems(room.BasicRoom().Items, false, true)\n\tactors := filterActors(items)\n\n\tif len(actors) == 0 {\n\t\treturn \"There is nobody to \" + action.Name + \".\"\n\t}\n\n\tactor := actors[0]\n\tif len(actors) > 1 {\n\t\tvar msg string\n\t\tmsg, actor, words = findActor(words, actors)\n\t\tif msg != \"\" {\n\t\t\treturn msg\n\t\t}\n\t}\n\n\tif action.IsTopicRequired {\n\t\tfor _, topic := range findTopics(words, actor) {\n\t\t\tif strings.Contains(topic.Action, action.Name) {\n\t\t\t\treturn actor.OnTopic(topic, action, nil)\n\t\t\t}\n\t\t}\n\t\treturn actor.OnTopic(nil, action, nil)\n\t}\n\n\tif action.Syntax != \"\" {\n\t\twords, _ = findSyntax(words, action.Syntax)\n\t}\n\n\tif action.IsTargetRequired && len(words) == 0 && action.Syntax != \"\" {\n\t\treturn strings.Title(action.Name) + \" \" + action.Syntax + \" what?\"\n\t}\n\n\tmsg, target, _ := findTarget(words, items, !action.IsTargetRequired)\n\n\tif !action.IsTargetRequired {\n\t\tmsg, _ := actor.OnAction(action, target)\n\t\treturn msg\n\t}\n\n\tif msg != \"\" {\n\t\treturn msg\n\t}\n\n\tif target == nil {\n\t\treturn strings.Title(action.Name) + \" \" + action.Syntax + \" what?\"\n\t}\n\n\tmsg, _ = actor.OnAction(action, target)\n\treturn msg\n}", "func (c HeaderAction) ToPtr() *HeaderAction {\n\treturn &c\n}", "func (p *EpFF) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error) {\n\tif len(upstreams) == 0 {\n\t\treturn nil, fs.ErrorObjectNotFound\n\t}\n\tupstreams = filterRO(upstreams)\n\tif len(upstreams) == 0 {\n\t\treturn nil, fs.ErrorPermissionDenied\n\t}\n\tu, err := p.epff(ctx, upstreams, path)\n\treturn []*upstream.Fs{u}, err\n}", "func (me XsdGoPkgHasAttr_Action_TactionType_Other) ActionDefault() TactionType {\n\treturn TactionType(\"other\")\n}", "func (fields *ChatActionFields) ParseFields(m AnyMessage) {\n\tfields.SenderID = uint64(m.Number(KeySenderID))\n\tfields.RoomID = uint64(m.Number(KeyRoomID))\n}", "func (f *Flame) Action(h Handler) {\n\tf.action = validateAndWrapHandler(h, nil)\n}", "func UnmarshalAny(s *jsonplugin.UnmarshalState) *anypb.Any {\n\tif s.ReadNil() {\n\t\treturn nil\n\t}\n\n\t// Read the raw object and create a sub-unmarshaler for it.\n\tdata := s.ReadRawMessage()\n\tif s.Err() != nil {\n\t\treturn nil\n\t}\n\tsub := s.Sub(data)\n\n\t// Read the first field in the object. This should be @type.\n\tif key := sub.ReadObjectField(); key != \"@type\" {\n\t\ts.SetErrorf(\"first field in Any is not @type, but %q\", key)\n\t\treturn nil\n\t}\n\ttypeURL := sub.ReadString()\n\tif err := sub.Err(); err != nil {\n\t\treturn nil\n\t}\n\n\t// Find the message type by the type URL.\n\tt, err := protoregistry.GlobalTypes.FindMessageByURL(typeURL)\n\tif err != nil {\n\t\ts.SetError(err)\n\t\treturn nil\n\t}\n\n\t// Allocate a new message of that type.\n\tmsg := t.New().Interface()\n\n\tswitch unmarshaler := msg.(type) {\n\tdefault:\n\t\t// Delegate unmarshaling to protojson.\n\t\tvar any anypb.Any\n\t\tif err := (&protojson.UnmarshalOptions{\n\t\t\tDiscardUnknown: true,\n\t\t}).Unmarshal(data, &any); err != nil {\n\t\t\ts.SetErrorf(\"failed to unmarshal Any from JSON: %w\", err)\n\t\t\treturn nil\n\t\t}\n\t\treturn &any\n\tcase jsonplugin.Unmarshaler:\n\t\t// Create another sub-unmarshaler for the raw data and unmarshal the message.\n\t\tsub = s.Sub(data)\n\t\tunmarshaler.UnmarshalProtoJSON(sub)\n\tcase *durationpb.Duration,\n\t\t*fieldmaskpb.FieldMask,\n\t\t*structpb.Struct,\n\t\t*structpb.Value,\n\t\t*structpb.ListValue,\n\t\t*timestamppb.Timestamp:\n\t\tif field := sub.ReadObjectField(); field != \"value\" {\n\t\t\ts.SetErrorf(\"unexpected %q field in Any\", field)\n\t\t\treturn nil\n\t\t}\n\t\tswitch msg.(type) {\n\t\tcase *durationpb.Duration:\n\t\t\tmsg = UnmarshalDuration(sub)\n\t\tcase *fieldmaskpb.FieldMask:\n\t\t\tmsg = UnmarshalFieldMask(sub)\n\t\tcase *structpb.Struct:\n\t\t\tmsg = UnmarshalStruct(sub)\n\t\tcase *structpb.Value:\n\t\t\tmsg = UnmarshalValue(sub)\n\t\tcase *structpb.ListValue:\n\t\t\tmsg = UnmarshalListValue(sub)\n\t\tcase *timestamppb.Timestamp:\n\t\t\tmsg = UnmarshalTimestamp(sub)\n\t\t}\n\t}\n\n\tif err := sub.Err(); err != nil {\n\t\treturn nil\n\t}\n\n\tif field := sub.ReadObjectField(); field != \"\" {\n\t\ts.SetErrorf(\"unexpected %q field in Any\", field)\n\t\treturn nil\n\t}\n\n\t// Wrap the unmarshaled message in an Any and return that.\n\tv, err := anypb.New(msg)\n\tif err != nil {\n\t\ts.SetError(err)\n\t\treturn nil\n\t}\n\treturn v\n}", "func (o *SearchTxParams) SetMessageAction(messageAction *string) {\n\to.MessageAction = messageAction\n}", "func NewChallengeAction(msg *Message) (*ChallengeAction, error) {\n\taction := &ChallengeAction{*msg}\n\n\treturn action, nil\n}", "func (o RuleResponseOutput) Action() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RuleResponse) string { return v.Action }).(pulumi.StringOutput)\n}", "func (ra *RecoverableAction) Action(action Action) string {\n\tra.actionChan <- action\n\n\treturn <-ra.replyChan\n}", "func (m *MissionSpec) UnmarshalJSON(data []byte) error {\n\t// Ignore null, like in the main JSON package.\n\tif string(data) == \"null\" || string(data) == `\"\"` {\n\t\treturn nil\n\t}\n\n\tvar objMap map[string]*json.RawMessage\n\n\terr := json.Unmarshal(data, &objMap)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Unmarshal TimeOutSec if present\n\tif timeoutRaw, ok := objMap[\"timeOutSec\"]; ok {\n\t\terr = json.Unmarshal(*timeoutRaw, &m.TimeOutSec)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Unmarshal Actions\n\tvar rawActions []*json.RawMessage\n\terr = json.Unmarshal(*objMap[\"actions\"], &rawActions)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tm.Actions = make([]Action, len(rawActions))\n\n\t// Check the data type of each rawAction in array\n\tfor i, rawAction := range rawActions {\n\n\t\tvar a map[string]interface{}\n\t\terr = json.Unmarshal(*rawAction, &a)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif _, ok := a[\"charge\"]; ok {\n\t\t\tvar action ChargeAction\n\t\t\terr = json.Unmarshal(*rawAction, &action)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tm.Actions[i] = &action\n\t\t} else if _, ok := a[\"moveToNamedPosition\"]; ok {\n\t\t\tvar action MoveToNamedPositionAction\n\t\t\terr = json.Unmarshal(*rawAction, &action)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tm.Actions[i] = &action\n\t\t} else if _, ok := a[\"getTrolley\"]; ok {\n\t\t\tvar action GetTrolleyAction\n\t\t\terr = json.Unmarshal(*rawAction, &action)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tm.Actions[i] = &action\n\t\t} else if _, ok := a[\"returnTrolley\"]; ok {\n\t\t\tvar action ReturnTrolleyAction\n\t\t\terr = json.Unmarshal(*rawAction, &action)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tm.Actions[i] = &action\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"%v is an unknown action\", a)\n\t\t}\n\n\t}\n\n\treturn nil\n}", "func DlpJobTriggerInspectJobActionsToProto(o *dlp.JobTriggerInspectJobActions) *dlppb.DlpJobTriggerInspectJobActions {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &dlppb.DlpJobTriggerInspectJobActions{}\n\tp.SetSaveFindings(DlpJobTriggerInspectJobActionsSaveFindingsToProto(o.SaveFindings))\n\tp.SetPubSub(DlpJobTriggerInspectJobActionsPubSubToProto(o.PubSub))\n\tp.SetPublishSummaryToCscc(DlpJobTriggerInspectJobActionsPublishSummaryToCsccToProto(o.PublishSummaryToCscc))\n\tp.SetPublishFindingsToCloudDataCatalog(DlpJobTriggerInspectJobActionsPublishFindingsToCloudDataCatalogToProto(o.PublishFindingsToCloudDataCatalog))\n\tp.SetJobNotificationEmails(DlpJobTriggerInspectJobActionsJobNotificationEmailsToProto(o.JobNotificationEmails))\n\tp.SetPublishToStackdriver(DlpJobTriggerInspectJobActionsPublishToStackdriverToProto(o.PublishToStackdriver))\n\treturn p\n}", "func ProtoToDlpJobTriggerInspectJobActions(p *dlppb.DlpJobTriggerInspectJobActions) *dlp.JobTriggerInspectJobActions {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &dlp.JobTriggerInspectJobActions{\n\t\tSaveFindings: ProtoToDlpJobTriggerInspectJobActionsSaveFindings(p.GetSaveFindings()),\n\t\tPubSub: ProtoToDlpJobTriggerInspectJobActionsPubSub(p.GetPubSub()),\n\t\tPublishSummaryToCscc: ProtoToDlpJobTriggerInspectJobActionsPublishSummaryToCscc(p.GetPublishSummaryToCscc()),\n\t\tPublishFindingsToCloudDataCatalog: ProtoToDlpJobTriggerInspectJobActionsPublishFindingsToCloudDataCatalog(p.GetPublishFindingsToCloudDataCatalog()),\n\t\tJobNotificationEmails: ProtoToDlpJobTriggerInspectJobActionsJobNotificationEmails(p.GetJobNotificationEmails()),\n\t\tPublishToStackdriver: ProtoToDlpJobTriggerInspectJobActionsPublishToStackdriver(p.GetPublishToStackdriver()),\n\t}\n\treturn obj\n}", "func NewActionDTO() *ActionDTO {\n\tthis := ActionDTO{}\n\treturn &this\n}", "func (a *Action) Zap() zapcore.Field {\n\treturn zap.Any(common.KEY_ACTION, a)\n}", "func (f *FirewallPolicyNatRuleCollectionAction) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &f.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t\t}\n\t}\n\treturn nil\n}", "func UnmarshalJobDataAction(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(JobDataAction)\n\terr = core.UnmarshalPrimitive(m, \"action_name\", &obj.ActionName)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"inputs\", &obj.Inputs, UnmarshalVariableData)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"outputs\", &obj.Outputs, UnmarshalVariableData)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"settings\", &obj.Settings, UnmarshalVariableData)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"updated_at\", &obj.UpdatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func ConvertStringToAction(in string) (configs.Action, error) {\n\tif act, ok := actions[in]; ok {\n\t\treturn act, nil\n\t}\n\treturn 0, fmt.Errorf(\"string %s is not a valid action for seccomp\", in)\n}", "func checkAction(expected, actual core.Action, t *testing.T) {\n\tif !(expected.Matches(actual.GetVerb(), actual.GetResource().Resource) && actual.GetSubresource() == expected.GetSubresource()) {\n\t\tt.Errorf(\"Expected\\n\\t%#v\\ngot\\n\\t%#v\", expected, actual)\n\t\treturn\n\t}\n\n\tif reflect.TypeOf(actual) != reflect.TypeOf(expected) {\n\t\tt.Errorf(\"Action has wrong type. Expected: %t. Got: %t\", expected, actual)\n\t\treturn\n\t}\n\n\tswitch a := actual.(type) {\n\tcase core.CreateAction:\n\t\te, _ := expected.(core.CreateAction)\n\t\texpObject := filterLastTransitionTime(e.GetObject())\n\t\tobject := filterLastTransitionTime(a.GetObject())\n\n\t\tif !equality.Semantic.DeepEqual(expObject, object) {\n\t\t\tt.Errorf(\"Action %s %s has wrong object\\nDiff:\\n %s\",\n\t\t\t\ta.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintDiff(expObject, object))\n\t\t}\n\tcase core.UpdateAction:\n\t\te, _ := expected.(core.UpdateAction)\n\t\texpObject := filterLastTransitionTime(e.GetObject())\n\t\tobject := filterLastTransitionTime(a.GetObject())\n\n\t\tif !equality.Semantic.DeepEqual(expObject, object) {\n\t\t\tt.Errorf(\"Action %s %s has wrong object\\nDiff:\\n %s\",\n\t\t\t\ta.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintDiff(expObject, object))\n\t\t}\n\tcase core.PatchAction:\n\t\te, _ := expected.(core.PatchAction)\n\t\texpPatch := e.GetPatch()\n\t\tpatch := a.GetPatch()\n\n\t\tif !equality.Semantic.DeepEqual(expPatch, expPatch) {\n\t\t\tt.Errorf(\"Action %s %s has wrong patch\\nDiff:\\n %s\",\n\t\t\t\ta.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintDiff(expPatch, patch))\n\t\t}\n\t}\n}" ]
[ "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.5178641", "0.51721174", "0.51245195", "0.510987", "0.50807333", "0.5070228", "0.5066828", "0.5030737", "0.49614346", "0.4956397", "0.4927015", "0.49194282", "0.49151707", "0.49033037", "0.48862067", "0.4863872", "0.48544356", "0.48467714", "0.48407662", "0.48211777", "0.4820513", "0.48074436", "0.4806456", "0.48044297", "0.4781153", "0.47752157", "0.4764446", "0.4763389", "0.4757463", "0.47572324", "0.47491723", "0.47425103", "0.47411248", "0.4737529", "0.47315866", "0.47251287", "0.47227067", "0.47192731", "0.4719044", "0.47127348", "0.47062957", "0.46886587", "0.46840137", "0.4682028", "0.4664838", "0.46582186", "0.4644761", "0.46380875", "0.4629727", "0.46227106", "0.46158594", "0.46157265", "0.4615613", "0.46096864", "0.46047804", "0.4603414", "0.45931292", "0.4591244", "0.45903483", "0.45885643", "0.45793995", "0.4572281", "0.45649514", "0.45602435", "0.45597336", "0.45594802", "0.45488545", "0.45377406", "0.45375347", "0.45362586", "0.45337823", "0.45337412", "0.4531912", "0.45236352", "0.45235083", "0.45220864", "0.45218146", "0.4517668", "0.4516328" ]
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 ActionChatMessage:\n\t\treturn ParseChatMessage(m, a)\n\tcase ActionReadMessage:\n\t\treturn ParseReadMessage(m, a)\n\tcase ActionTypeStart:\n\t\treturn ParseTypeStart(m, a)\n\tcase ActionTypeEnd:\n\t\treturn ParseTypeEnd(m, a)\n\tcase ActionEmpty:\n\t\treturn m, errors.New(\"JSON object must have any action field\")\n\t}\n\treturn m, errors.New(\"unknown action: \" + string(a))\n}", "func UnmarshalAction(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(Action)\n\terr = core.UnmarshalPrimitive(m, \"name\", &obj.Name)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"description\", &obj.Description)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"location\", &obj.Location)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"resource_group\", &obj.ResourceGroup)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"tags\", &obj.Tags)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"user_state\", &obj.UserState, UnmarshalUserState)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_readme_url\", &obj.SourceReadmeURL)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"source\", &obj.Source, UnmarshalExternalSource)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_type\", &obj.SourceType)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"command_parameter\", &obj.CommandParameter)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"bastion\", &obj.Bastion, UnmarshalTargetResourceset)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"targets_ini\", &obj.TargetsIni)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"credentials\", &obj.Credentials, UnmarshalVariableData)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"inputs\", &obj.Inputs, UnmarshalVariableData)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"outputs\", &obj.Outputs, UnmarshalVariableData)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"settings\", &obj.Settings, UnmarshalVariableData)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"trigger_record_id\", &obj.TriggerRecordID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"id\", &obj.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"crn\", &obj.Crn)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"account\", &obj.Account)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_created_at\", &obj.SourceCreatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_created_by\", &obj.SourceCreatedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_updated_at\", &obj.SourceUpdatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"source_updated_by\", &obj.SourceUpdatedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"created_at\", &obj.CreatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"created_by\", &obj.CreatedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"updated_at\", &obj.UpdatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"updated_by\", &obj.UpdatedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"namespace\", &obj.Namespace)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"state\", &obj.State, UnmarshalActionState)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"playbook_names\", &obj.PlaybookNames)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"sys_lock\", &obj.SysLock, UnmarshalSystemLock)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func ParseAction(b string) (MessageAction, error) {\n\tma := MessageAction{}\n\n\tform, err := url.ParseQuery(b)\n\tif err != nil {\n\t\treturn ma, errors.Wrap(err, \"failed to parse request body\")\n\t}\n\n\terr = json.Unmarshal([]byte(form.Get(\"payload\")), &ma)\n\tif err != nil {\n\t\treturn ma, errors.Wrap(err, \"failed to parse request body\")\n\t}\n\treturn ma, err\n}", "func ParseAction(re *regexp.Regexp, line string) interface{} {\n\t// Regex: `:\\x01ACTION (\\w*) <your bot>\\x01`\n\taction := re.FindStringSubmatch(line)\n\tif len(action) == 0 {\n\t\treturn nil\n\t}\n\n\tuser := get_user(line)\n\tm := make(map[string]string)\n\tm[\"user\"] = user\n\tm[\"action\"] = action[1]\n\treturn m\n}", "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 (a *Action) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"parameters\":\n\t\t\terr = unpopulate(val, \"Parameters\", &a.Parameters)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &a.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (m *Message) extract(b []byte) {\n\tslices := bytes.Split(b, []byte{'|'})\n\ti := bytes.Index(b, []byte{'|'})\n\tm.Type = \"default\"\n\tif i != -1 {\n\t\t// well I know how I'd do it in python\n\t\t// this seems a little awkward\n\t\tm.dirtyfields = make(map[int]bool)\n\t\tif res, err := get(0, slices); err == nil {\n\t\t\tm.setField(0, string(res))\n\t\t}\n\t}\n\tif res, err := get(1, slices); err == nil {\n\t\tif string(res) != \"\" {\n\t\t\tm.setField(1, string(res))\n\t\t}\n\t}\n\tif res, err := get(2, slices); err == nil {\n\t\tm.setField(2, string(res))\n\t}\n\tif res, err := get(3, slices); err == nil {\n\t\tif t, err2 := strconv.Atoi(string(res)); err2 == nil {\n\t\t\tTimeout, _ := time.ParseDuration(fmt.Sprintf(\"%ds\", t))\n\t\t\tm.setField(3, Timeout)\n\t\t} else {\n\t\t\tif d, err3 := time.ParseDuration(string(res)); err3 == nil {\n\t\t\t\tm.setField(3, d)\n\t\t\t}\n\t\t}\n\t}\n}", "func (Action) Fields() []ent.Field {\n\treturn []ent.Field{\n\t\tfield.String(\"action\"),\n\t\tfield.String(\"category\"),\n\t\tfield.String(\"action_label\").StorageKey(\"label\").Optional(),\n\t\tfield.String(\"property\").Optional(),\n\t\tfield.Bytes(\"value\").Optional(),\n\t}\n}", "func (fa *FieldAction) Unpack(v string) error {\n\tswitch strings.ToLower(v) {\n\tcase \"\", \"append\":\n\t\t*fa = ActionAppend\n\tcase \"replace\":\n\t\t*fa = ActionReplace\n\tdefault:\n\t\treturn errors.Errorf(\"invalid dns field action value '%v'\", v)\n\t}\n\treturn nil\n}", "func (this *TriggerAction) Get(field string) interface{} {\n switch field {\n case \"id\":\n return this.Id()\n case \"agentName\":\n return this.agentName\n case \"propertyName\":\n return this.propertyName\n case \"propertyValue\":\n return this.propertyValue\n }\n\n return nil\n}", "func (e *Env) parseFields(flat *dota.CSVCMsg_FlattenedSerializer) error {\n\te.fields = make([]field, len(flat.GetFields()))\n\tfor i, ff := range flat.GetFields() {\n\t\tf := &e.fields[i]\n\t\tif err := f.fromProto(ff, e); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\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.(*Action), nil\n\t}\n\tobj := new(Action)\n\treturn obj, m.unmarshalPayload(obj)\n}", "func UnmarshalActionLite(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(ActionLite)\n\terr = core.UnmarshalPrimitive(m, \"name\", &obj.Name)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"description\", &obj.Description)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"id\", &obj.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"crn\", &obj.Crn)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"location\", &obj.Location)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"resource_group\", &obj.ResourceGroup)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"namespace\", &obj.Namespace)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"tags\", &obj.Tags)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"playbook_name\", &obj.PlaybookName)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"user_state\", &obj.UserState, UnmarshalUserState)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"state\", &obj.State, UnmarshalActionLiteState)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"sys_lock\", &obj.SysLock, UnmarshalSystemLock)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"created_at\", &obj.CreatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"created_by\", &obj.CreatedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"updated_at\", &obj.UpdatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"updated_by\", &obj.UpdatedBy)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func getActionArgs(s string) (action string, args1, args2, args3 map[string]interface{}, er error) {\n\targsPointerSlice := []*map[string]interface{}{&args1, &args2, &args3}\n\tactiond := strings.Split(s, \"(\")\n\taction = actiond[0]\n\targs := strings.Trim(actiond[1], \")\")\n\tif len(args) == 0 {\n\t\treturn\n\t}\n\targsSlice := strings.SplitAfter(args, \"},\")\n\tfor i, v := range argsSlice {\n\t\tv = strings.TrimRight(v, \",\")\n\t\t// Here we dont need to args1.assert(map[string]interface{})\n\t\t// becuse we dont pass interface{} to Unmarshal but the right type.\n\t\terr := json.Unmarshal([]byte(v), argsPointerSlice[i])\n\t\tif err != nil {\n\t\t\ter = err\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func (m *SecurityActionState) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"appId\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetAppId(val)\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n res[\"status\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetEnumValue(ParseOperationStatus)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetStatus(val.(*OperationStatus))\n }\n return nil\n }\n res[\"updatedDateTime\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetTimeValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetUpdatedDateTime(val)\n }\n return nil\n }\n res[\"user\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetUser(val)\n }\n return nil\n }\n return res\n}", "func ParseAction(v string) (ActionSpec, error) {\n\tparts := strings.Fields(v)\n\tswitch len(parts) {\n\tcase 0:\n\t\treturn ActionSpec{}, fmt.Errorf(\"missing definition: \\\"%s\\\"\", v)\n\tcase 1:\n\t\treturn ActionSpec{Type: parts[0]}, nil\n\tdefault:\n\t\treturn ActionSpec{Type: parts[0], Args: parts[1:]}, nil\n\t}\n}", "func ParseData(req *http.Request) (Action, error) {\n\t// parse bytes from req object\n\tbodyBytes, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\treturn Action{}, err\n\t}\n\n\t// build struct from byte array\n\tvar body Action\n\terr = json.Unmarshal(bodyBytes, &body)\n\tif err != nil {\n\t\treturn Action{}, err\n\t}\n\n\treturn body, nil // return new Action struct\n}", "func (state ZenformState) ActualActionFieldValue(fieldType string, triggerAction TriggerActionConfig) interface{} {\n\tswitch fieldType {\n\tcase \"notification_user\": // []string\n\t\treturn triggerAction.Value\n\tcase \"ticket_form_id\": // convert slug to ticket form ID\n\t\treturn state.TicketForms[triggerAction.Value[0]].ID\n\tdefault: // string\n\t\treturn triggerAction.Value[0]\n\t}\n}", "func (ec *executionContext) unmarshalInputActionDetailsInput(ctx context.Context, obj interface{}) (ActionDetailsInput, error) {\n\tvar it ActionDetailsInput\n\tvar asMap = obj.(map[string]interface{})\n\n\tfor k, v := range asMap {\n\t\tswitch k {\n\t\tcase \"name\":\n\t\t\tvar err error\n\n\t\t\tctx := graphql.WithPathContext(ctx, graphql.NewPathWithField(\"name\"))\n\t\t\tit.Name, err = ec.unmarshalNString2string(ctx, v)\n\t\t\tif err != nil {\n\t\t\t\treturn it, err\n\t\t\t}\n\t\tcase \"input\":\n\t\t\tvar err error\n\n\t\t\tctx := graphql.WithPathContext(ctx, graphql.NewPathWithField(\"input\"))\n\t\t\tit.Input, err = ec.unmarshalOActionInputData2ᚖcapactᚗioᚋcapactᚋpkgᚋengineᚋapiᚋgraphqlᚐActionInputData(ctx, v)\n\t\t\tif err != nil {\n\t\t\t\treturn it, err\n\t\t\t}\n\t\tcase \"actionRef\":\n\t\t\tvar err error\n\n\t\t\tctx := graphql.WithPathContext(ctx, graphql.NewPathWithField(\"actionRef\"))\n\t\t\tit.ActionRef, err = ec.unmarshalNManifestReferenceInput2ᚖcapactᚗioᚋcapactᚋpkgᚋengineᚋapiᚋgraphqlᚐManifestReferenceInput(ctx, v)\n\t\t\tif err != nil {\n\t\t\t\treturn it, err\n\t\t\t}\n\t\tcase \"dryRun\":\n\t\t\tvar err error\n\n\t\t\tctx := graphql.WithPathContext(ctx, graphql.NewPathWithField(\"dryRun\"))\n\t\t\tit.DryRun, err = ec.unmarshalOBoolean2ᚖbool(ctx, v)\n\t\t\tif err != nil {\n\t\t\t\treturn it, err\n\t\t\t}\n\t\tcase \"advancedRendering\":\n\t\t\tvar err error\n\n\t\t\tctx := graphql.WithPathContext(ctx, graphql.NewPathWithField(\"advancedRendering\"))\n\t\t\tit.AdvancedRendering, err = ec.unmarshalOBoolean2ᚖbool(ctx, v)\n\t\t\tif err != nil {\n\t\t\t\treturn it, err\n\t\t\t}\n\t\tcase \"renderedActionOverride\":\n\t\t\tvar err error\n\n\t\t\tctx := graphql.WithPathContext(ctx, graphql.NewPathWithField(\"renderedActionOverride\"))\n\t\t\tit.RenderedActionOverride, err = ec.unmarshalOJSON2ᚖcapactᚗioᚋcapactᚋpkgᚋengineᚋapiᚋgraphqlᚐJSON(ctx, v)\n\t\t\tif err != nil {\n\t\t\t\treturn it, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn it, nil\n}", "func (m *TamAction) UnmarshalJSON(raw []byte) error {\n\t// AO0\n\tvar dataAO0 struct {\n\t\tAffectedObjectType string `json:\"AffectedObjectType,omitempty\"`\n\n\t\tAlertType *string `json:\"AlertType,omitempty\"`\n\n\t\tIdentifiers []*TamIdentifiers `json:\"Identifiers\"`\n\n\t\tOperationType *string `json:\"OperationType,omitempty\"`\n\n\t\tQueries []*TamQueryEntry `json:\"Queries\"`\n\n\t\tType *string `json:\"Type,omitempty\"`\n\t}\n\tif err := swag.ReadJSON(raw, &dataAO0); err != nil {\n\t\treturn err\n\t}\n\n\tm.AffectedObjectType = dataAO0.AffectedObjectType\n\n\tm.AlertType = dataAO0.AlertType\n\n\tm.Identifiers = dataAO0.Identifiers\n\n\tm.OperationType = dataAO0.OperationType\n\n\tm.Queries = dataAO0.Queries\n\n\tm.Type = dataAO0.Type\n\n\treturn nil\n}", "func (s Action) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.CloudwatchAlarm != nil {\n\t\tv := s.CloudwatchAlarm\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"cloudwatchAlarm\", v, metadata)\n\t}\n\tif s.CloudwatchMetric != nil {\n\t\tv := s.CloudwatchMetric\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"cloudwatchMetric\", v, metadata)\n\t}\n\tif s.DynamoDB != nil {\n\t\tv := s.DynamoDB\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"dynamoDB\", v, metadata)\n\t}\n\tif s.DynamoDBv2 != nil {\n\t\tv := s.DynamoDBv2\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"dynamoDBv2\", v, metadata)\n\t}\n\tif s.Elasticsearch != nil {\n\t\tv := s.Elasticsearch\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"elasticsearch\", v, metadata)\n\t}\n\tif s.Firehose != nil {\n\t\tv := s.Firehose\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"firehose\", v, metadata)\n\t}\n\tif s.Http != nil {\n\t\tv := s.Http\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"http\", v, metadata)\n\t}\n\tif s.IotAnalytics != nil {\n\t\tv := s.IotAnalytics\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"iotAnalytics\", v, metadata)\n\t}\n\tif s.IotEvents != nil {\n\t\tv := s.IotEvents\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"iotEvents\", v, metadata)\n\t}\n\tif s.IotSiteWise != nil {\n\t\tv := s.IotSiteWise\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"iotSiteWise\", v, metadata)\n\t}\n\tif s.Kinesis != nil {\n\t\tv := s.Kinesis\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"kinesis\", v, metadata)\n\t}\n\tif s.Lambda != nil {\n\t\tv := s.Lambda\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"lambda\", v, metadata)\n\t}\n\tif s.Republish != nil {\n\t\tv := s.Republish\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"republish\", v, metadata)\n\t}\n\tif s.S3 != nil {\n\t\tv := s.S3\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"s3\", v, metadata)\n\t}\n\tif s.Salesforce != nil {\n\t\tv := s.Salesforce\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"salesforce\", v, metadata)\n\t}\n\tif s.Sns != nil {\n\t\tv := s.Sns\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"sns\", v, metadata)\n\t}\n\tif s.Sqs != nil {\n\t\tv := s.Sqs\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"sqs\", v, metadata)\n\t}\n\tif s.StepFunctions != nil {\n\t\tv := s.StepFunctions\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"stepFunctions\", v, metadata)\n\t}\n\treturn nil\n}", "func Parse(message *flowmessage.FlowMessage) (map[string]interface{}, time.Time, error) {\n\tm := make(map[string]interface{})\n\n\ttimestamp := time.Unix(int64(message.TimeReceived), 0)\n\n\tif t := message.Type.String(); t != \"\" {\n\t\tif t != \"FLOWUNKNOWN\" {\n\t\t\tm[\"type\"] = t\n\t\t}\n\t}\n\n\tif message.SequenceNum > 0 {\n\t\tm[\"sequencenum\"] = int(message.SequenceNum)\n\t}\n\n\tif message.SamplingRate > 0 {\n\t\tm[\"samplingrate\"] = int64(message.SamplingRate)\n\t}\n\n\tif message.HasFlowDirection {\n\t\tm[\"flowdirection\"] = int(message.FlowDirection)\n\t}\n\n\tif len(message.SamplerAddress) > 0 {\n\t\tkey := \"sampleraddress\"\n\t\tip, err := bytesToIP(message.SamplerAddress)\n\t\tif err != nil {\n\t\t\treturn nil, timestamp, errors.Wrap(err, fmt.Sprintf(\"error converting %s to string\", key))\n\t\t}\n\t\tm[key] = ip.String()\n\t}\n\n\tif message.TimeFlowStart > 0 {\n\t\tm[\"timeflowstart\"] = int64(message.TimeFlowStart)\n\t}\n\n\tif message.TimeFlowEnd > 0 {\n\t\tm[\"timeflowend\"] = int64(message.TimeFlowEnd)\n\t}\n\n\tif message.Bytes > 0 {\n\t\tm[\"bytes\"] = int64(message.Bytes)\n\t}\n\n\tif message.Packets > 0 {\n\t\tm[\"packets\"] = int64(message.Packets)\n\t}\n\n\tif len(message.SrcAddr) > 0 {\n\t\tkey := \"srcaddr\"\n\t\tip, err := bytesToIP(message.SrcAddr)\n\t\tif err != nil {\n\t\t\treturn nil, timestamp, errors.Wrap(err, fmt.Sprintf(\"error converting %s to string\", key))\n\t\t}\n\t\tm[key] = ip.String()\n\t}\n\n\tif len(message.DstAddr) > 0 {\n\t\tkey := \"dstaddr\"\n\t\tip, err := bytesToIP(message.DstAddr)\n\t\tif err != nil {\n\t\t\treturn nil, timestamp, errors.Wrap(err, fmt.Sprintf(\"error converting %s to string\", key))\n\t\t}\n\t\tm[key] = ip.String()\n\t}\n\n\tif len(message.NextHop) > 0 {\n\t\tkey := \"nexthop\"\n\t\tip, err := bytesToIP(message.NextHop)\n\t\tif err != nil {\n\t\t\treturn nil, timestamp, errors.Wrap(err, fmt.Sprintf(\"error converting %s to string\", key))\n\t\t}\n\t\tm[key] = ip.String()\n\t}\n\n\tif message.Etype > 0 {\n\t\tm[\"etype\"] = int(message.Etype)\n\t}\n\n\t// Goflow input does not support HOPOPT as it maps to 0, meaning HOPOPT would\n\t// be set anytime the proto field is not present.\n\tif message.Proto > 0 {\n\t\tm[\"proto\"] = int(message.Proto)\n\t\tm[\"proto_name\"] = protoName(int(message.Proto))\n\t}\n\n\tif message.SrcPort > 0 {\n\t\tm[\"srcport\"] = int(message.SrcPort)\n\t}\n\n\tif message.DstPort > 0 {\n\t\tm[\"dstport\"] = int(message.DstPort)\n\t}\n\n\t// Always set inif and outif\n\tm[\"inif\"] = int(message.InIf)\n\tm[\"outif\"] = int(message.OutIf)\n\n\tif message.SrcMac > 0 {\n\t\tm[\"srcmac\"] = int64(message.SrcMac)\n\t}\n\n\tif message.DstMac > 0 {\n\t\tm[\"dstmac\"] = int64(message.DstMac)\n\t}\n\n\tif message.SrcVlan > 0 {\n\t\tm[\"srcvlan\"] = int(message.SrcVlan)\n\t}\n\n\tif message.DstVlan > 0 {\n\t\tm[\"dstvlan\"] = int(message.DstVlan)\n\t}\n\n\tif message.VlanId > 0 {\n\t\tm[\"vlanid\"] = int(message.VlanId)\n\t}\n\n\tif message.IngressVrfID > 0 {\n\t\tm[\"ingressvrfid\"] = int(message.IngressVrfID)\n\t}\n\n\tif message.EgressVrfID > 0 {\n\t\tm[\"egressvrfid\"] = int(message.EgressVrfID)\n\t}\n\n\tif message.IPTos > 0 {\n\t\tm[\"iptos\"] = int(message.IPTos)\n\t}\n\n\tif message.ForwardingStatus > 0 {\n\t\tm[\"forwardingstatus\"] = int(message.ForwardingStatus)\n\t}\n\n\tif message.IPTTL > 0 {\n\t\tm[\"ipttl\"] = int(message.IPTTL)\n\t}\n\n\tif message.TCPFlags > 0 {\n\t\tm[\"tcpflags\"] = int(message.TCPFlags)\n\t}\n\n\tif message.IcmpType > 0 {\n\t\tm[\"icmptype\"] = int(message.IcmpType)\n\t}\n\n\tif message.IcmpCode > 0 {\n\t\tm[\"icmpcode\"] = int(message.IcmpCode)\n\t}\n\n\tif message.IPv6FlowLabel > 0 {\n\t\tm[\"ipv6flowlabel\"] = int(message.IPv6FlowLabel)\n\t}\n\n\tif message.FragmentId > 0 {\n\t\tm[\"fragmentid\"] = int(message.FragmentId)\n\t}\n\n\tif message.FragmentOffset > 0 {\n\t\tm[\"fragmentoffset\"] = int(message.FragmentOffset)\n\t}\n\n\tif message.HasBiFlowDirection {\n\t\tm[\"biflowdirection\"] = int(message.BiFlowDirection)\n\t}\n\n\tif message.SrcAS > 0 {\n\t\tm[\"srcas\"] = int(message.SrcAS)\n\t}\n\n\tif message.DstAS > 0 {\n\t\tm[\"dstnas\"] = int(message.DstAS)\n\t}\n\n\tif message.NextHopAS > 0 {\n\t\tm[\"nexthopas\"] = int(message.NextHopAS)\n\t}\n\n\tif message.SrcNet > 0 {\n\t\tm[\"srcnet\"] = int(message.SrcNet)\n\t}\n\n\tif message.DstNet > 0 {\n\t\tm[\"dstnet\"] = int(message.DstNet)\n\t}\n\n\t// Add Encap fields if present\n\tif message.HasEncap {\n\t\tkey := \"srcaddrencap\"\n\t\tip, err := bytesToIP(message.SrcAddrEncap)\n\t\tif err != nil {\n\t\t\treturn nil, timestamp, errors.Wrap(err, fmt.Sprintf(\"error converting %s to string\", key))\n\t\t}\n\t\tm[key] = ip.String()\n\n\t\tkey = \"dstaddrencap\"\n\t\tip, err = bytesToIP(message.DstAddrEncap)\n\t\tif err != nil {\n\t\t\treturn nil, timestamp, errors.Wrap(err, fmt.Sprintf(\"error converting %s to string\", key))\n\t\t}\n\t\tm[key] = ip.String()\n\n\t\tm[\"protoencap\"] = int(message.ProtoEncap)\n\t\tm[\"etypeencap\"] = int(message.EtypeEncap)\n\t\tm[\"iptosencap\"] = int(message.IPTosEncap)\n\t\tm[\"ipttlencap\"] = int(message.IPTTLEncap)\n\t\tm[\"ipv6flowlabelencap\"] = int(message.IPv6FlowLabelEncap)\n\t\tm[\"fragmentidencap\"] = int(message.FragmentIdEncap)\n\t\tm[\"fragmentoffsetencap\"] = int(message.FragmentOffsetEncap)\n\t}\n\n\t// Add MPLS fields if present\n\tif message.HasMPLS {\n\t\tm[\"mplscount\"] = int(message.MPLSCount)\n\t\tm[\"mpls1ttl\"] = int(message.MPLS1TTL)\n\t\tm[\"mpls1label\"] = int(message.MPLS1Label)\n\t\tm[\"mpls2ttl\"] = int(message.MPLS2TTL)\n\t\tm[\"mpls2label\"] = int(message.MPLS2Label)\n\t\tm[\"mpls3ttl\"] = int(message.MPLS3TTL)\n\t\tm[\"mpls3label\"] = int(message.MPLS3Label)\n\t\tm[\"mplslastttl\"] = int(message.MPLSLastTTL)\n\t\tm[\"mplslastlabel\"] = int(message.MPLSLastLabel)\n\t}\n\n\t// Add PPP fields if present\n\tif message.HasPPP {\n\t\tm[\"sampling_rate\"] = int(message.PPPAddressControl)\n\t}\n\n\treturn m, timestamp, nil\n}", "func (e ActionValidationError) Field() string { return e.field }", "func (j *DSGit) ParseAction(ctx *Ctx, data map[string]string) {\n\tvar (\n\t\tmodesAry []string\n\t\tindexesAry []string\n\t)\n\tmodes, modesPresent := data[\"modes\"]\n\tif modesPresent && modes != \"\" {\n\t\tmodesAry = strings.Split(strings.TrimSpace(modes), \" \")\n\t}\n\tindexes, indexesPresent := data[\"indexes\"]\n\tif indexesPresent && indexes != \"\" {\n\t\tindexesAry = strings.Split(strings.TrimSpace(indexes), \" \")\n\t}\n\tfileName := data[\"file\"]\n\t_, ok := j.CommitFiles[fileName]\n\tif !ok {\n\t\tj.CommitFiles[fileName] = make(map[string]interface{})\n\t}\n\tj.CommitFiles[fileName][\"modes\"] = modesAry\n\tj.CommitFiles[fileName][\"indexes\"] = indexesAry\n\tj.CommitFiles[fileName][\"action\"] = data[\"action\"]\n\tj.CommitFiles[fileName][\"file\"] = fileName\n\tj.CommitFiles[fileName][\"newfile\"] = data[\"newfile\"]\n}", "func (m *LabelActionBase) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"name\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetName(val)\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n return res\n}", "func NewFileActionFromMSG(msg *nats.Msg) (*FileAction, error) {\n\tfa := new(FileAction)\n\n\terr := json.Unmarshal(msg.Data, &fa)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn fa, nil\n}", "func (m *UserExperienceAnalyticsDeviceScopesItemTriggerDeviceScopeActionPostRequestBody) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"actionName\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetActionName(val)\n }\n return nil\n }\n res[\"deviceScopeId\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetDeviceScopeId(val)\n }\n return nil\n }\n return res\n}", "func (m *PortalNotification) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"alertImpact\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetObjectValue(CreateAlertImpactFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetAlertImpact(val.(AlertImpactable))\n }\n return nil\n }\n res[\"alertRecordId\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetAlertRecordId(val)\n }\n return nil\n }\n res[\"alertRuleId\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetAlertRuleId(val)\n }\n return nil\n }\n res[\"alertRuleName\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetAlertRuleName(val)\n }\n return nil\n }\n res[\"alertRuleTemplate\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetEnumValue(ParseAlertRuleTemplate)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetAlertRuleTemplate(val.(*AlertRuleTemplate))\n }\n return nil\n }\n res[\"id\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetId(val)\n }\n return nil\n }\n res[\"isPortalNotificationSent\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetBoolValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetIsPortalNotificationSent(val)\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n res[\"severity\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetEnumValue(ParseRuleSeverityType)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetSeverity(val.(*RuleSeverityType))\n }\n return nil\n }\n return res\n}", "func NewAction(payload interface{}) Action {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Error: %v\\n\", r)\n\t\t\tfmt.Fprintf(os.Stderr, \"Payload: %v\\n\", payload)\n\t\t}\n\t}()\n\n\tvar a Action\n\ta.payload = payload\n\ta.headers = make(map[string]string)\n\n\tfor k, v := range payload.(map[interface{}]interface{}) {\n\t\tswitch k {\n\t\tcase \"catch\":\n\t\t\ta.catch = v.(string)\n\t\tcase \"warnings\":\n\t\t\t// TODO\n\t\t\tcontinue\n\t\tcase \"allowed_warnings\":\n\t\t\t// TODO\n\t\t\tcontinue\n\t\tcase \"node_selector\":\n\t\t\tcontinue\n\t\tcase \"headers\":\n\t\t\tfor kk, vv := range v.(map[interface{}]interface{}) {\n\t\t\t\ta.headers[kk.(string)] = vv.(string)\n\t\t\t}\n\t\tdefault:\n\t\t\ta.method = k.(string)\n\t\t\ta.params = v.(map[interface{}]interface{})\n\t\t}\n\t}\n\n\treturn a\n}", "func parseMessage(msg *slackevents.MessageEvent) Msg {\n\tvar parsed Msg\n\tvar ok bool\n\n\tparsed, ok = ParseHelpMsg(msg)\n\tif ok {\n\t\treturn parsed\n\t}\n\n\tparsed, ok = ParseGameStartMsg(msg)\n\tif ok {\n\t\treturn parsed\n\t}\n\n\tparsed, ok = ParseMoveMsg(msg)\n\tif ok {\n\t\treturn parsed\n\t}\n\n\tparsed, ok = ParseBoardMsg(msg)\n\tif ok {\n\t\treturn parsed\n\t}\n\n\treturn nil\n\n}", "func UnmarshalAnalyticsEngineCustomAction(m map[string]interface{}) (result *AnalyticsEngineCustomAction, err error) {\n\tobj := new(AnalyticsEngineCustomAction)\n\tobj.Name, err = core.UnmarshalString(m, \"name\")\n\tif err != nil {\n\t\treturn\n\t}\n\tobj.Type, err = core.UnmarshalString(m, \"type\")\n\tif err != nil {\n\t\treturn\n\t}\n\tobj.Script, err = UnmarshalAnalyticsEngineCustomActionScriptAsProperty(m, \"script\")\n\tif err != nil {\n\t\treturn\n\t}\n\tobj.ScriptParams, err = core.UnmarshalStringSlice(m, \"script_params\")\n\tif err != nil {\n\t\treturn\n\t}\n\tresult = obj\n\treturn\n}", "func (c *Controller) Parse(b []byte) (message util.Message, err error) {\n\tswitch b[0] {\n\tcase openflow13.VERSION:\n\t\tmessage, err = openflow13.Parse(b)\n\tdefault:\n\t\tlog.Errorf(\"Received unsupported openflow version: %d\", b[0])\n\t}\n\treturn\n}", "func parseFlowbit(s string) (*Flowbit, error) {\n\tparts := strings.Split(s, \",\")\n\tif len(parts) < 1 {\n\t\treturn nil, fmt.Errorf(\"couldn't parse flowbit string: %s\", s)\n\t}\n\t// Ensure all actions are of valid type.\n\ta := strings.TrimSpace(parts[0])\n\tif !inSlice(a, []string{\"noalert\", \"isset\", \"isnotset\", \"set\", \"unset\", \"toggle\"}) {\n\t\treturn nil, fmt.Errorf(\"invalid action for flowbit: %s\", a)\n\t}\n\tfb := &Flowbit{\n\t\tAction: a,\n\t}\n\tif fb.Action == \"noalert\" && len(parts) > 1 {\n\t\treturn nil, fmt.Errorf(\"noalert shouldn't have a value\")\n\t}\n\tif len(parts) == 2 {\n\t\tfb.Value = strings.TrimSpace(parts[1])\n\t}\n\treturn fb, nil\n}", "func toAction(actionInput string) (GameAction, error) {\n\tnormalised := strings.ToUpper(strings.TrimSuffix(actionInput, \"\\n\"))\n\tif len(normalised) < 1 {\n\t\treturn -1, errors.New(\"No action specified\")\n\t}\n\n\tswitch normalised[0] {\n\tcase 'E':\n\t\treturn Explore, nil\n\n\tcase 'F':\n\t\treturn Flag, nil\n\n\tdefault:\n\t\treturn -1, errors.New(\"Invalid action\")\n\t}\n}", "func (fa FieldAction) String() string {\n\tname, found := fieldActionNames[fa]\n\tif found {\n\t\treturn name\n\t}\n\treturn \"unknown (\" + strconv.Itoa(int(fa)) + \")\"\n}", "func (a *AzureFirewallRCAction) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &a.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "func getActionInfo(action *driveactivity.ActionDetail) string {\n\treturn getOneOf(*action)\n}", "func (msg *globalActionRequest) Decode(buf *goetty.ByteBuf) {\n\tmsg.XID = ReadXID(buf)\n\tmsg.ExtraData = ReadString(buf)\n}", "func LoadAction(path string) (*xapb.ExtraActionInfo, error) {\n\txa, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"reading extra action info: %v\", err)\n\t}\n\tvar info xapb.ExtraActionInfo\n\tif err := proto.Unmarshal(xa, &info); err != nil {\n\t\treturn nil, fmt.Errorf(\"parsing extra action info: %v\", err)\n\t}\n\tlog.Infof(\"Read %d bytes from extra action file %q\", len(xa), path)\n\treturn &info, nil\n}", "func (ec *executionContext) unmarshalInputActionsRuleActionInput(ctx context.Context, obj interface{}) (models.ActionsRuleActionInput, error) {\n\tvar it models.ActionsRuleActionInput\n\tvar asMap = obj.(map[string]interface{})\n\n\tfor k, v := range asMap {\n\t\tswitch k {\n\t\tcase \"actionID\":\n\t\t\tvar err error\n\t\t\tit.ActionID, err = ec.unmarshalNActionID2githubᚗcomᚋfacebookincubatorᚋsymphonyᚋpkgᚋactionsᚋcoreᚐActionID(ctx, v)\n\t\t\tif err != nil {\n\t\t\t\treturn it, err\n\t\t\t}\n\t\tcase \"data\":\n\t\t\tvar err error\n\t\t\tit.Data, err = ec.unmarshalNString2string(ctx, v)\n\t\t\tif err != nil {\n\t\t\t\treturn it, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn it, nil\n}", "func getSubActionArgs(s string) (action, args string) {\n\tactiond := strings.Split(s, \"(\")\n\taction = actiond[0]\n\targs = strings.Trim(actiond[1], \")\")\n\treturn\n}", "func (f *tokenFormat) readAction(customVerbs []string) (token, error) {\n\tvar verb bytes.Buffer\n\n\tfor {\n\t\tr, _, err := f.stream.ReadRune()\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tverb.Write([]byte(string([]rune{r})))\n\n\t\tif t, ok := tokenFromString(verb.String(), customVerbs); ok {\n\t\t\treturn t, nil\n\t\t}\n\n\t\tif f.readSeparator() {\n\t\t\tif t, ok := tokenFromString(verb.String(), customVerbs); ok {\n\t\t\t\treturn t, nil\n\t\t\t}\n\n\t\t\treturn literalToken{\":\" + verb.String()}, nil\n\t\t}\n\t}\n}", "func (m *Messenger) dispatch(r Receive) {\n\tfor _, entry := range r.Entry {\n\t\tfor _, info := range entry.Messaging {\n\t\t\ta := m.classify(info)\n\t\t\tif a == UnknownAction {\n\t\t\t\tfmt.Println(\"Unknown action:\", info)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tresp := &Response{\n\t\t\t\tto: Recipient{info.Sender.ID},\n\t\t\t\ttoken: m.token,\n\t\t\t}\n\n\t\t\tswitch a {\n\t\t\tcase TextAction:\n\t\t\t\tfor _, f := range m.messageHandlers {\n\t\t\t\t\tmessage := *info.Message\n\t\t\t\t\tmessage.Sender = info.Sender\n\t\t\t\t\tmessage.Recipient = info.Recipient\n\t\t\t\t\tmessage.Time = time.Unix(info.Timestamp/int64(time.Microsecond), 0)\n\t\t\t\t\tf(message, resp)\n\t\t\t\t}\n\t\t\tcase DeliveryAction:\n\t\t\t\tfor _, f := range m.deliveryHandlers {\n\t\t\t\t\tf(*info.Delivery, resp)\n\t\t\t\t}\n\t\t\tcase ReadAction:\n\t\t\t\tfor _, f := range m.readHandlers {\n\t\t\t\t\tf(*info.Read, resp)\n\t\t\t\t}\n\t\t\tcase PostBackAction:\n\t\t\t\tfor _, f := range m.postBackHandlers {\n\t\t\t\t\tmessage := *info.PostBack\n\t\t\t\t\tmessage.Sender = info.Sender\n\t\t\t\t\tmessage.Recipient = info.Recipient\n\t\t\t\t\tmessage.Time = time.Unix(info.Timestamp/int64(time.Microsecond), 0)\n\t\t\t\t\tf(message, resp)\n\t\t\t\t}\n\t\t\tcase OptInAction:\n\t\t\t\tfor _, f := range m.optInHandlers {\n\t\t\t\t\tmessage := *info.OptIn\n\t\t\t\t\tmessage.Sender = info.Sender\n\t\t\t\t\tmessage.Recipient = info.Recipient\n\t\t\t\t\tmessage.Time = time.Unix(info.Timestamp/int64(time.Microsecond), 0)\n\t\t\t\t\tf(message, resp)\n\t\t\t\t}\n\t\t\tcase ReferralAction:\n\t\t\t\tfor _, f := range m.referralHandlers {\n\t\t\t\t\tmessage := *info.ReferralMessage\n\t\t\t\t\tmessage.Sender = info.Sender\n\t\t\t\t\tmessage.Recipient = info.Recipient\n\t\t\t\t\tmessage.Time = time.Unix(info.Timestamp/int64(time.Microsecond), 0)\n\t\t\t\t\tf(message, resp)\n\t\t\t\t}\n\t\t\tcase AccountLinkingAction:\n\t\t\t\tfor _, f := range m.accountLinkingHandlers {\n\t\t\t\t\tmessage := *info.AccountLinking\n\t\t\t\t\tmessage.Sender = info.Sender\n\t\t\t\t\tmessage.Recipient = info.Recipient\n\t\t\t\t\tmessage.Time = time.Unix(info.Timestamp/int64(time.Microsecond), 0)\n\t\t\t\t\tf(message, resp)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "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()\n\tisoBitmap.parsedMsg = parsedMsg\n\n\tvar err error\n\n\tfor _, pFieldIdValue := range fieldValArr {\n\n\t\tfield := msg.fieldByIdMap[pFieldIdValue.Id]\n\t\tif field == nil {\n\t\t\treturn nil, ErrUnknownField\n\t\t}\n\n\t\tlog.Tracef(\"Setting field value %s:=> %s\\n\", field.Name, pFieldIdValue.Value)\n\n\t\tfieldData := new(FieldData)\n\t\tfieldData.Field = field\n\n\t\tif field.FieldInfo.Type == Bitmapped {\n\t\t\tfieldData.Bitmap = isoBitmap\n\t\t\tisoBitmap.field = field\n\t\t\tparsedMsg.FieldDataMap[field.Id] = fieldData\n\t\t} else {\n\t\t\tif fieldData.Data, err = field.ValueFromString(pFieldIdValue.Value); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"isosim: failed to set value for field :%s :%w\", field.Name, err)\n\t\t\t}\n\n\t\t\tif field.FieldInfo.Type == Fixed && len(fieldData.Data) != field.FieldInfo.FieldSize {\n\t\t\t\t//this is an error, field length exceeds max length\n\t\t\t\treturn nil, fmt.Errorf(\"fixed field - [%s] doesn't match fixed length of %d (supplied length = %d)\",\n\t\t\t\t\tfield.Name, field.FieldInfo.FieldSize, len(fieldData.Data))\n\t\t\t} else if field.FieldInfo.Type == Variable {\n\t\t\t\tif field.FieldInfo.MaxSize != 0 && len(fieldData.Data) > field.FieldInfo.MaxSize {\n\t\t\t\t\t//error\n\t\t\t\t\treturn nil, fmt.Errorf(\"variable field - [%s] exceeds max length of %d (supplied length = %d)\",\n\t\t\t\t\t\tfield.Name, field.FieldInfo.MaxSize, len(fieldData.Data))\n\t\t\t\t}\n\t\t\t\tif field.FieldInfo.MinSize != 0 && len(fieldData.Data) < field.FieldInfo.MinSize {\n\t\t\t\t\t//error\n\t\t\t\t\treturn nil, fmt.Errorf(\"variable field - [%s] exceeds min length of %d (supplied length = %d)\",\n\t\t\t\t\t\tfield.Name, field.FieldInfo.MinSize, len(fieldData.Data))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif field.ParentId != -1 {\n\t\t\t\tparentField := msg.fieldByIdMap[field.ParentId]\n\t\t\t\tif parentField.FieldInfo.Type == Bitmapped {\n\t\t\t\t\tlog.Tracef(\"Setting bit-on for field position - %d\\n\", field.Position)\n\t\t\t\t\tisoBitmap.Set(field.Position, pFieldIdValue.Value)\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tparsedMsg.FieldDataMap[field.Id] = fieldData\n\n\t\t}\n\n\t}\n\n\treturn parsedMsg, nil\n\n}", "func BuildMessage(content string) *Message {\n msg := new(Message)\n fields := strings.Split(content, \"][\")\n for idx, field := range fields {\n s := strings.Trim(field, \"[]\")\n switch idx {\n case 0:\n msg.Priority = s\n case 1:\n msg.Status = s\n case 2:\n msg.Endpoint = s\n case 3:\n case 4:\n msg.Content = s\n case 5:\n l := strings.Split(s, \" \")\n t := l[1:]\n ts := strings.Join(t, \"T\")\n msg.Timestamp = ts\n default:\n }\n }\n return msg\n}", "func parseFlowint(s string) (*Flowint, error) {\n\tparts := strings.Split(s, \",\")\n\t// All flowints must have a name and modifier\n\tif len(parts) < 2 {\n\t\treturn nil, fmt.Errorf(\"not enough parts for flowint: %s\", s)\n\t}\n\t// Ensure all actions are of valid type.\n\tm := strings.TrimSpace(parts[1])\n\tif !inSlice(m, []string{\"+\", \"-\", \"=\", \">\", \"<\", \">=\", \"<=\", \"==\", \"!=\", \"isset\", \"isnotset\"}) {\n\t\treturn nil, fmt.Errorf(\"invalid modifier for flowint: %s\", m)\n\t}\n\tfi := &Flowint{\n\t\tName: strings.TrimSpace(parts[0]),\n\t\tModifier: m,\n\t}\n\n\tif len(parts) == 3 {\n\t\tfi.Value = strings.TrimSpace(parts[2])\n\t}\n\n\treturn fi, nil\n}", "func TestActionMisname(t *testing.T) {\n\tjson := `{\"acton\":\"jump\", \"time\":100}`\n\t_, err := ParseEventJSON(json)\n\tif err == nil {\n\t\tt.Errorf(\"JSON parsing of %v should have generated error, but didn't\", json)\n\t} else if _, ok := err.(MissingJSONElementError); !ok {\n\t\tt.Errorf(\"JSON parsing of %v should have generated a MissingJSONElementError error, but didn't\", json)\n\t} else if e, _ := err.(MissingJSONElementError); e.element != \"action\" {\n\t\tt.Errorf(\"JSON parsing of %v generated a MissingJSONElementError with the wrong element: %s\", json, e.element)\n\t}\n}", "func (c *Config) handleActionCreateMessage(client MQTT.Client, message MQTT.Message) {\n\tnewActions := []actionmanager.Action{}\n\terr := json.Unmarshal(message.Payload(), &newActions)\n\tif err != nil {\n\t\tklog.Errorf(\"Error in unmarshalling: %s\", err)\n\t}\n\tfor _, newAction := range newActions {\n\t\tactionExists := false\n\t\tfor actionIndex, action := range c.ActionManager.Actions {\n\t\t\tif action.Name == newAction.Name {\n\t\t\t\tc.ActionManager.Actions[actionIndex] = newAction\n\t\t\t\tactionExists = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif actionExists {\n\t\t\tklog.Infof(\"Action: %s has been updated\", newAction.Name)\n\t\t\tklog.Infof(\"Updated Action: %v\", newAction)\n\t\t} else {\n\t\t\tc.ActionManager.Actions = append(c.ActionManager.Actions, newAction)\n\t\t\tklog.Infof(\"Action: %s has been added \", newAction.Name)\n\t\t\tklog.Infof(\"New Action: %v\", newAction)\n\t\t}\n\t\tconfiguration.Config.ActionManager = c.ActionManager\n\t\tif newAction.PerformImmediately {\n\t\t\tnewAction.PerformOperation(c.Converter.DataRead)\n\t\t}\n\t}\n}", "func extractFields(raw []byte) any {\n\tvar resp map[string]any\n\n\terr := json.Unmarshal(raw, &resp)\n\tif err != nil {\n\t\tvar arrResp []map[string]any\n\n\t\terr := json.Unmarshal(raw, &arrResp)\n\t\tif err != nil {\n\t\t\treturn string(raw)\n\t\t}\n\n\t\treturn arrResp\n\t}\n\n\treturn resp\n}", "func UnmarshalAny(s *jsonplugin.UnmarshalState) *anypb.Any {\n\tif s.ReadNil() {\n\t\treturn nil\n\t}\n\n\t// Read the raw object and create a sub-unmarshaler for it.\n\tdata := s.ReadRawMessage()\n\tif s.Err() != nil {\n\t\treturn nil\n\t}\n\tsub := s.Sub(data)\n\n\t// Read the first field in the object. This should be @type.\n\tif key := sub.ReadObjectField(); key != \"@type\" {\n\t\ts.SetErrorf(\"first field in Any is not @type, but %q\", key)\n\t\treturn nil\n\t}\n\ttypeURL := sub.ReadString()\n\tif err := sub.Err(); err != nil {\n\t\treturn nil\n\t}\n\n\t// Find the message type by the type URL.\n\tt, err := protoregistry.GlobalTypes.FindMessageByURL(typeURL)\n\tif err != nil {\n\t\ts.SetError(err)\n\t\treturn nil\n\t}\n\n\t// Allocate a new message of that type.\n\tmsg := t.New().Interface()\n\n\tswitch unmarshaler := msg.(type) {\n\tdefault:\n\t\t// Delegate unmarshaling to protojson.\n\t\tvar any anypb.Any\n\t\tif err := (&protojson.UnmarshalOptions{\n\t\t\tDiscardUnknown: true,\n\t\t}).Unmarshal(data, &any); err != nil {\n\t\t\ts.SetErrorf(\"failed to unmarshal Any from JSON: %w\", err)\n\t\t\treturn nil\n\t\t}\n\t\treturn &any\n\tcase jsonplugin.Unmarshaler:\n\t\t// Create another sub-unmarshaler for the raw data and unmarshal the message.\n\t\tsub = s.Sub(data)\n\t\tunmarshaler.UnmarshalProtoJSON(sub)\n\tcase *durationpb.Duration,\n\t\t*fieldmaskpb.FieldMask,\n\t\t*structpb.Struct,\n\t\t*structpb.Value,\n\t\t*structpb.ListValue,\n\t\t*timestamppb.Timestamp:\n\t\tif field := sub.ReadObjectField(); field != \"value\" {\n\t\t\ts.SetErrorf(\"unexpected %q field in Any\", field)\n\t\t\treturn nil\n\t\t}\n\t\tswitch msg.(type) {\n\t\tcase *durationpb.Duration:\n\t\t\tmsg = UnmarshalDuration(sub)\n\t\tcase *fieldmaskpb.FieldMask:\n\t\t\tmsg = UnmarshalFieldMask(sub)\n\t\tcase *structpb.Struct:\n\t\t\tmsg = UnmarshalStruct(sub)\n\t\tcase *structpb.Value:\n\t\t\tmsg = UnmarshalValue(sub)\n\t\tcase *structpb.ListValue:\n\t\t\tmsg = UnmarshalListValue(sub)\n\t\tcase *timestamppb.Timestamp:\n\t\t\tmsg = UnmarshalTimestamp(sub)\n\t\t}\n\t}\n\n\tif err := sub.Err(); err != nil {\n\t\treturn nil\n\t}\n\n\tif field := sub.ReadObjectField(); field != \"\" {\n\t\ts.SetErrorf(\"unexpected %q field in Any\", field)\n\t\treturn nil\n\t}\n\n\t// Wrap the unmarshaled message in an Any and return that.\n\tv, err := anypb.New(msg)\n\tif err != nil {\n\t\ts.SetError(err)\n\t\treturn nil\n\t}\n\treturn v\n}", "func (a *Action) Zap() zapcore.Field {\n\treturn zap.Any(common.KEY_ACTION, a)\n}", "func UnmarshalActionState(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(ActionState)\n\terr = core.UnmarshalPrimitive(m, \"status_code\", &obj.StatusCode)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"status_job_id\", &obj.StatusJobID)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"status_message\", &obj.StatusMessage)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func (m *WebhookActionBody) Action() Action {\n\treturn m.actionField\n}", "func ForgetAllFields(t *testing.T, originalMessage proto.Message) proto.Message {\n\tt.Helper()\n\n\temptyMessage := &pb2_latest.Empty{}\n\n\tbinaryMessage, err := proto.Marshal(originalMessage)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\terr = proto.Unmarshal(binaryMessage, emptyMessage)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\treturn emptyMessage\n}", "func (m *ChatMessageAttachment) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"content\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetContent(val)\n }\n return nil\n }\n res[\"contentType\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetContentType(val)\n }\n return nil\n }\n res[\"contentUrl\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetContentUrl(val)\n }\n return nil\n }\n res[\"id\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetId(val)\n }\n return nil\n }\n res[\"name\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetName(val)\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n res[\"teamsAppId\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetTeamsAppId(val)\n }\n return nil\n }\n res[\"thumbnailUrl\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetThumbnailUrl(val)\n }\n return nil\n }\n return res\n}", "func Parse(b []byte) (Message, error) {\n\tvar g Message\n\n\tswitch b[1] {\n\tcase MsgTypeEchoRequest:\n\t\tg = &EchoRequest{}\n\tcase MsgTypeEchoResponse:\n\t\tg = &EchoResponse{}\n\t/* XXX - Implement!\n\tcase MsgTypeVersionNotSupported:\n\t\tg = &VerNotSupported{}\n\tcase MsgTypeNodeAliveRequest:\n\t\tg = &NodeAliveReq{}\n\tcase MsgTypeNodeAliveResponse:\n\t\tg = &NodeAliveRes{}\n\tcase MsgTypeRedirectionRequest:\n\t\tg = &RedirectionReq{}\n\tcase MsgTypeRedirectionResponse:\n\t\tg = &RedirectionRes{}\n\t*/\n\tcase MsgTypeCreatePDPContextRequest:\n\t\tg = &CreatePDPContextRequest{}\n\tcase MsgTypeCreatePDPContextResponse:\n\t\tg = &CreatePDPContextResponse{}\n\tcase MsgTypeUpdatePDPContextRequest:\n\t\tg = &UpdatePDPContextRequest{}\n\tcase MsgTypeUpdatePDPContextResponse:\n\t\tg = &UpdatePDPContextResponse{}\n\tcase MsgTypeDeletePDPContextRequest:\n\t\tg = &DeletePDPContextRequest{}\n\tcase MsgTypeDeletePDPContextResponse:\n\t\tg = &DeletePDPContextResponse{}\n\t/* XXX - Implement!\n\tcase MsgTypeCreateAAPDPContextRequest:\n\t\tg = &CreateAAPDPContextReq{}\n\tcase MsgTypeCreateAAPDPContextResponse:\n\t\tg = &CreateAAPDPContextRes{}\n\tcase MsgTypeDeleteAAPDPContextRequest:\n\t\tg = &DeleteAAPDPContextReq{}\n\tcase MsgTypeDeleteAAPDPContextResponse:\n\t\tg = &DeleteAAPDPContextRes{}\n\tcase MsgTypeErrorIndication:\n\t\tg = &ErrorInd{}\n\tcase MsgTypePDUNotificationRequest:\n\t\tg = &PDUNotificationReq{}\n\tcase MsgTypePDUNotificationResponse:\n\t\tg = &PDUNotificationRes{}\n\tcase MsgTypePDUNotificationRejectRequest:\n\t\tg = &PDUNotificationRejectReq{}\n\tcase MsgTypePDUNotificationRejectResponse:\n\t\tg = &PDUNotificationRejectRes{}\n\tcase MsgTypeSendRouteingInformationforGPRSRequest:\n\t\tg = &SendRouteingInformationforGPRSReq{}\n\tcase MsgTypeSendRouteingInformationforGPRSResponse:\n\t\tg = &SendRouteingInformationforGPRSRes{}\n\tcase MsgTypeFailureReportRequest:\n\t\tg = &FailureReportReq{}\n\tcase MsgTypeFailureReportResponse:\n\t\tg = &FailureReportRes{}\n\tcase MsgTypeNoteMSGPRSPresentRequest:\n\t\tg = &NoteMSGPRSPresentReq{}\n\tcase MsgTypeNoteMSGPRSPresentResponse:\n\t\tg = &NoteMSGPRSPresentRes{}\n\tcase MsgTypeIdentificationRequest:\n\t\tg = &IdentificationReq{}\n\tcase MsgTypeIdentificationResponse:\n\t\tg = &IdentificationRes{}\n\tcase MsgTypeSGSNContextRequest:\n\t\tg = &SGSNContextReq{}\n\tcase MsgTypeSGSNContextResponse:\n\t\tg = &SGSNContextRes{}\n\tcase MsgTypeSGSNContextAcknowledge:\n\t\tg = &SGSNContextAck{}\n\tcase MsgTypeDataRecordTransferRequest:\n\t\tg = &DataRecordTransferReq{}\n\tcase MsgTypeDataRecordTransferResponse:\n\t\tg = &DataRecordTransferRes{}\n\t*/\n\tcase MsgTypeTPDU:\n\t\tg = &TPDU{}\n\tdefault:\n\t\tg = &Generic{}\n\t}\n\n\tif err := g.UnmarshalBinary(b); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to Parse Message: %w\", err)\n\t}\n\treturn g, nil\n}", "func PersistenceActionFromUnstructured(r *unstructured.Unstructured) (*PersistenceAction, error) {\n\tb, err := json.Marshal(r.Object)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar s PersistenceAction\n\tif err := json.Unmarshal(b, &s); err != nil {\n\t\treturn nil, err\n\t}\n\ts.TypeMeta.Kind = TPRPersistenceActionsKind\n\ts.TypeMeta.APIVersion = TPRGroup + \"/\" + TPRVersion\n\treturn &s, nil\n}", "func (event *Event) Populate(message *Message) error {\n\tLogger.Println(\"Populating a event from a message\")\n\n\tevent.Headers = make(map[string]string)\n\tvar throw error\n\nheaders:\n\tfor key, value := range message.Headers {\n\t\tstr := string(value)\n\n\t\tswitch key {\n\t\tcase ActionHeader:\n\t\t\tevent.Action = str\n\t\t\tcontinue headers\n\t\tcase ParentHeader:\n\t\t\tparent, err := uuid.FromString(str)\n\n\t\t\tif err != nil {\n\t\t\t\tthrow = err\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tevent.Parent = parent\n\t\t\tcontinue headers\n\t\tcase IDHeader:\n\t\t\tid, err := uuid.FromString(str)\n\n\t\t\tif err != nil {\n\t\t\t\tthrow = err\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tevent.ID = id\n\t\t\tcontinue headers\n\t\tcase StatusHeader:\n\t\t\tstatus, err := strconv.ParseInt(str, 10, 16)\n\n\t\t\tif err != nil {\n\t\t\t\tthrow = err\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tevent.Status = StatusCode(int16(status))\n\t\t\tcontinue headers\n\t\tcase VersionHeader:\n\t\t\tversion, err := strconv.ParseInt(str, 10, 8)\n\t\t\tif err != nil {\n\t\t\t\tthrow = err\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tevent.Version = int8(version)\n\t\t\tcontinue headers\n\t\tcase MetaHeader:\n\t\t\tevent.Meta = str\n\t\t\tcontinue headers\n\t\tcase CommandTimestampHeader:\n\t\t\tunix, err := strconv.ParseInt(str, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\tthrow = err\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ttime := time.Unix(unix, 0)\n\t\t\tevent.CommandTimestamp = time\n\t\t\tcontinue headers\n\t\t}\n\n\t\tevent.Headers[key] = str\n\t}\n\n\tif len(event.Action) == 0 {\n\t\tthrow = errors.New(\"No event action is set\")\n\t}\n\n\tevent.Key = message.Key\n\tevent.Data = message.Value\n\tevent.Origin = message.Topic\n\tevent.Offset = message.Offset\n\tevent.Partition = message.Partition\n\tevent.Timestamp = message.Timestamp\n\n\tif throw != nil {\n\t\tLogger.Println(\"A error was thrown when populating the command message:\", throw)\n\t}\n\n\treturn throw\n}", "func (c *Message) Validate(action string) map[string]string {\n\tvar errorMessages = make(map[string]string)\n\tvar err error\n\n\tswitch strings.ToLower(action) {\n\tcase \"update\":\n\t\tif c.Body == \"\" {\n\t\t\terr = errors.New(\"Required Body in a Message\")\n\t\t\terrorMessages[\"Required_body\"] = err.Error()\n\t\t}\n\tdefault:\n\t\tif c.Body == \"\" {\n\t\t\terr = errors.New(\"Required body to Message\")\n\t\t\terrorMessages[\"Required_body\"] = err.Error()\n\t\t}\n\t}\n\treturn errorMessages\n}", "func (_ EventFilterAliases) Action(p graphql.ResolveParams) (EventFilterAction, error) {\n\tval, err := graphql.DefaultResolver(p.Source, p.Info.FieldName)\n\tret, ok := EventFilterAction(val.(string)), true\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\tif !ok {\n\t\treturn ret, errors.New(\"unable to coerce value for field 'action'\")\n\t}\n\treturn ret, err\n}", "func (a *Action) UnmarshalText(text []byte) error {\n\tif _, exists := actions[Action(text)]; exists {\n\t\t*a = Action(text)\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unrecognized action type %q\", string(text))\n}", "func (m *CloudPcBulkActionSummary) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"failedCount\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetInt32Value()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetFailedCount(val)\n }\n return nil\n }\n res[\"inProgressCount\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetInt32Value()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetInProgressCount(val)\n }\n return nil\n }\n res[\"notSupportedCount\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetInt32Value()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetNotSupportedCount(val)\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n res[\"pendingCount\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetInt32Value()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetPendingCount(val)\n }\n return nil\n }\n res[\"successfulCount\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetInt32Value()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetSuccessfulCount(val)\n }\n return nil\n }\n return res\n}", "func messageToAny(t *testing.T, msg proto.Message) *any.Any {\n\ts, err := ptypes.MarshalAny(msg)\n\tif err != nil {\n\t\tt.Fatalf(\"transfer failed: %v\", err)\n\t\treturn nil\n\t}\n\treturn s\n}", "func (c *Complex) Parse(dict map[string]interface{}) error {\n\tswitch name, exists, err := mustString(dict, \"name\"); {\n\tcase err != nil:\n\t\treturn errors.Trace(err)\n\tcase !exists:\n\t\treturn errors.Annotatef(errors.ErrKeyNotExists, \"name\")\n\tcase len(name) < 1:\n\t\treturn errors.Annotatef(errors.ErrInvalidValue, \"name is empty\")\n\tdefault:\n\t\tc.Name = name\n\t}\n\n\tif raw, exists := dict[KeyParams]; exists {\n\t\tdict, ok := raw.(map[string]interface{})\n\t\tif !ok {\n\t\t\treturn errors.Annotatef(errors.ErrInvalidType,\n\t\t\t\t\"must be map[string]interface{} type, but %v\", raw)\n\t\t}\n\n\t\tif err := c.Params.Parse(dict); err != nil {\n\t\t\treturn errors.Trace(err)\n\t\t}\n\t}\n\n\tvar err error\n\tif raw, exists := dict[KeyGroups]; exists {\n\t\terr = errors.Trace(c.Groups.Parse(raw))\n\t} else {\n\t\terr = errors.Trace(c.parseAction(dict))\n\t}\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\n\treturn c.Check()\n}", "func (e GetMessageRequestValidationError) Field() string { return e.field }", "func read(r io.Reader, de *msgDecoder, fs map[string]interface{}, val reflect.Value) error {\n\tname, t, err := readPrefix(r, de)\n\tfor ; t != 0; name, t, err = readPrefix(r, de) {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ti, ok := fs[name]\n\t\tif !ok {\n\t\t\terr := skip(r, de)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif f, ok := i.(field); ok {\n\t\t\tif t != f.requiredType {\n\t\t\t\treturn ErrorIncorrectType\n\t\t\t}\n\t\t\tval := val.Field(f.sField)\n\t\t\terr := f.read(r, de, val)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tif t != 10 {\n\t\t\t\treturn ErrorIncorrectType\n\t\t\t}\n\t\t\tf := i.(fieldStruct)\n\t\t\tval := val.Field(f.sField)\n\t\t\terr := read(r, de, f.m, val)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (s FindingAction) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.ActionType) > 0 {\n\t\tv := s.ActionType\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"actionType\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.ApiCallDetails != nil {\n\t\tv := s.ApiCallDetails\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetFields(protocol.BodyTarget, \"apiCallDetails\", v, metadata)\n\t}\n\treturn nil\n}", "func (m *InvitedUserMessageInfo) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"ccRecipients\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetCollectionOfObjectValues(CreateRecipientFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n res := make([]Recipientable, len(val))\n for i, v := range val {\n if v != nil {\n res[i] = v.(Recipientable)\n }\n }\n m.SetCcRecipients(res)\n }\n return nil\n }\n res[\"customizedMessageBody\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetCustomizedMessageBody(val)\n }\n return nil\n }\n res[\"messageLanguage\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetMessageLanguage(val)\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n return res\n}", "func (w *wrapper) loadDeviceAction(data map[string]interface{}) {\n\taction := &triggerActionDevice{}\n\terr := w.loadAction(data, action)\n\tif err != nil {\n\t\treturn\n\t}\n\n\taction.prepEntity, err = glob.Compile(action.Entity)\n\tif err != nil {\n\t\tw.logger.Error(\"Failed to compile regexp\", err)\n\t\treturn\n\t}\n\n\taction.cmd, err = enums.CommandString(action.Command)\n\tif err != nil {\n\t\tw.logger.Error(\"Failed to validate action properties: unknown command\", err,\n\t\t\tcommon.LogDeviceCommandToken, action.Command)\n\t\treturn\n\t}\n\n\taction.Args, err = helpers.CommandPropertyFixYaml(action.Args, action.cmd)\n\tif err != nil {\n\t\tw.logger.Error(\"Failed to validate action properties\", err)\n\t\treturn\n\t}\n\n\taction.prepArgs = make(map[string]interface{})\n\tif nil != action.Args {\n\t\ttmp, err := yaml.Marshal(action.Args)\n\t\tif err != nil {\n\t\t\tw.logger.Error(\"Failed to parse device action: marshal error\", err)\n\t\t\treturn\n\t\t}\n\n\t\terr = yaml.Unmarshal(tmp, action.prepArgs)\n\t\tif err != nil {\n\t\t\tw.logger.Error(\"Failed to parse device action: un-marshal error\", err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tw.deviceActions = append(w.deviceActions, action)\n}", "func (m *CloudPcAuditEvent) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := m.Entity.GetFieldDeserializers()\n res[\"activity\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetActivity(val)\n }\n return nil\n }\n res[\"activityDateTime\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetTimeValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetActivityDateTime(val)\n }\n return nil\n }\n res[\"activityOperationType\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetEnumValue(ParseCloudPcAuditActivityOperationType)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetActivityOperationType(val.(*CloudPcAuditActivityOperationType))\n }\n return nil\n }\n res[\"activityResult\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetEnumValue(ParseCloudPcAuditActivityResult)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetActivityResult(val.(*CloudPcAuditActivityResult))\n }\n return nil\n }\n res[\"activityType\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetActivityType(val)\n }\n return nil\n }\n res[\"actor\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetObjectValue(CreateCloudPcAuditActorFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetActor(val.(CloudPcAuditActorable))\n }\n return nil\n }\n res[\"category\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetEnumValue(ParseCloudPcAuditCategory)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetCategory(val.(*CloudPcAuditCategory))\n }\n return nil\n }\n res[\"componentName\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetComponentName(val)\n }\n return nil\n }\n res[\"correlationId\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetCorrelationId(val)\n }\n return nil\n }\n res[\"displayName\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetDisplayName(val)\n }\n return nil\n }\n res[\"resources\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetCollectionOfObjectValues(CreateCloudPcAuditResourceFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n res := make([]CloudPcAuditResourceable, len(val))\n for i, v := range val {\n if v != nil {\n res[i] = v.(CloudPcAuditResourceable)\n }\n }\n m.SetResources(res)\n }\n return nil\n }\n return res\n}", "func ParseMessage(msg string) Message {\n\tvar message Message\n\tmsgBytes := []byte(msg)\n\terr := json.Unmarshal(msgBytes, &message)\n\thandleErr(err)\n\tfmt.Println(\"Person\", message)\n\treturn message\n}", "func (e ApplicationPubSub_MessageValidationError) Field() string { return e.field }", "func parseWebhook(r *http.Request) (payload interface{}, err error) {\n\teventType := r.Header.Get(EventTypeHeader)\n\tswitch eventType {\n\tcase PostCommitEvent:\n\t\tpayload = &PostCommit{}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"event type %v not support\", eventType)\n\t}\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"fail to read request body\")\n\t}\n\n\tif err := json.Unmarshal(body, &payload); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn payload, nil\n}", "func (m *WebhookActionBody) UnmarshalJSON(raw []byte) error {\n\tvar data struct {\n\t\tAction json.RawMessage `json:\"action\"`\n\n\t\tApplication *Application `json:\"application\"`\n\n\t\tDevice *WebhookActionDevice `json:\"device\"`\n\n\t\tRule *Rule `json:\"rule\"`\n\n\t\tTimestamp *strfmt.DateTime `json:\"timestamp\"`\n\t}\n\tbuf := bytes.NewBuffer(raw)\n\tdec := json.NewDecoder(buf)\n\tdec.UseNumber()\n\n\tif err := dec.Decode(&data); err != nil {\n\t\treturn err\n\t}\n\n\tpropAction, err := UnmarshalAction(bytes.NewBuffer(data.Action), runtime.JSONConsumer())\n\tif err != nil && err != io.EOF {\n\t\treturn err\n\t}\n\n\tvar result WebhookActionBody\n\n\t// action\n\tresult.actionField = propAction\n\n\t// application\n\tresult.Application = data.Application\n\n\t// device\n\tresult.Device = data.Device\n\n\t// rule\n\tresult.Rule = data.Rule\n\n\t// timestamp\n\tresult.Timestamp = data.Timestamp\n\n\t*m = result\n\n\treturn nil\n}", "func transformEvent(event *APIEvents) {\n\t// if event version is <= 1.21 there will be no Action and no Type\n\tif event.Action == \"\" && event.Type == \"\" {\n\t\tevent.Action = event.Status\n\t\tevent.Actor.ID = event.ID\n\t\tevent.Actor.Attributes = map[string]string{}\n\t\tswitch event.Status {\n\t\tcase \"delete\", \"import\", \"pull\", \"push\", \"tag\", \"untag\":\n\t\t\tevent.Type = \"image\"\n\t\tdefault:\n\t\t\tevent.Type = \"container\"\n\t\t\tif event.From != \"\" {\n\t\t\t\tevent.Actor.Attributes[\"image\"] = event.From\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif event.Status == \"\" {\n\t\t\tif event.Type == \"image\" || event.Type == \"container\" {\n\t\t\t\tevent.Status = event.Action\n\t\t\t} else {\n\t\t\t\t// Because just the Status has been overloaded with different Types\n\t\t\t\t// if an event is not for an image or a container, we prepend the type\n\t\t\t\t// to avoid problems for people relying on actions being only for\n\t\t\t\t// images and containers\n\t\t\t\tevent.Status = event.Type + \":\" + event.Action\n\t\t\t}\n\t\t}\n\t\tif event.ID == \"\" {\n\t\t\tevent.ID = event.Actor.ID\n\t\t}\n\t\tif event.From == \"\" {\n\t\t\tevent.From = event.Actor.Attributes[\"image\"]\n\t\t}\n\t}\n}", "func (b *builder) handleMessageField(w *strings.Builder, field proto.Visitee) error {\n\tvar (\n\t\tname string\n\t\ttyp string\n\t\tsequence int\n\t\trepeated bool\n\t\tcomment *proto.Comment\n\t)\n\n\tswitch field.(type) {\n\tcase *proto.NormalField:\n\t\tft := field.(*proto.NormalField)\n\t\tname = ft.Name\n\t\ttyp = b.goType(ft.Type)\n\t\tsequence = ft.Sequence\n\t\tcomment = ft.Comment\n\t\trepeated = ft.Repeated\n\tcase *proto.MapField:\n\t\tft := field.(*proto.MapField)\n\t\tname = ft.Field.Name\n\t\tsequence = ft.Field.Sequence\n\t\tcomment = ft.Comment\n\t\tkeyType := b.goType(ft.KeyType)\n\t\tfieldType := b.goType(ft.Field.Type)\n\t\ttyp = fmt.Sprintf(\"map[%s]%s\", keyType, fieldType)\n\tdefault:\n\t\treturn fmt.Errorf(\"unhandled message field type %T\", field)\n\t}\n\n\tif repeated {\n\t\ttyp = \"[]\" + typ\n\t}\n\n\t// TODO(vishen): Is this correct to explicitly camelcase the variable name and\n\t// snakecase the json name???\n\t// If we do, gunk should probably have an option to set the variable name\n\t// in the proto to something else? That way we can use best practises for\n\t// each language???\n\tb.format(w, 1, comment, \"%s %s\", snaker.ForceCamelIdentifier(name), typ)\n\tb.format(w, 0, nil, \" `pb:\\\"%d\\\" json:\\\"%s\\\"`\\n\", sequence, snaker.CamelToSnake(name))\n\treturn nil\n}", "func (state ZenformState) ActualActionFieldName(systemFieldTypeOrSlug string) string {\n\tfor i := zendesk.ActionFieldStatus; i <= zendesk.ActionFieldTicketFormID; i++ {\n\t\tif zendesk.ActionFieldText(i) == systemFieldTypeOrSlug {\n\t\t\treturn systemFieldTypeOrSlug\n\t\t}\n\t}\n\treturn fmt.Sprintf(\"custom_fields_%d\", state.TicketFields[systemFieldTypeOrSlug].ID)\n}", "func (m *PresenceStatusMessage) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"expiryDateTime\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetObjectValue(CreateDateTimeTimeZoneFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetExpiryDateTime(val.(DateTimeTimeZoneable))\n }\n return nil\n }\n res[\"message\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetObjectValue(CreateItemBodyFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetMessage(val.(ItemBodyable))\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n res[\"publishedDateTime\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetTimeValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetPublishedDateTime(val)\n }\n return nil\n }\n return res\n}", "func (m *MessageRule) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := m.Entity.GetFieldDeserializers()\n res[\"actions\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetObjectValue(CreateMessageRuleActionsFromDiscriminatorValue , m.SetActions)\n res[\"conditions\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetObjectValue(CreateMessageRulePredicatesFromDiscriminatorValue , m.SetConditions)\n res[\"displayName\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetStringValue(m.SetDisplayName)\n res[\"exceptions\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetObjectValue(CreateMessageRulePredicatesFromDiscriminatorValue , m.SetExceptions)\n res[\"hasError\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetBoolValue(m.SetHasError)\n res[\"isEnabled\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetBoolValue(m.SetIsEnabled)\n res[\"isReadOnly\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetBoolValue(m.SetIsReadOnly)\n res[\"sequence\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetInt32Value(m.SetSequence)\n return res\n}", "func (f *FirewallPolicyFilterRuleCollectionAction) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &f.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (action *Action) UnmarshalJSON(data []byte) error {\n\tvar s string\n\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\n\ta := Action(s)\n\tif !a.IsValid() {\n\t\treturn fmt.Errorf(\"invalid action '%v'\", s)\n\t}\n\n\t*action = a\n\n\treturn nil\n}", "func (m idMap) extract(msg proto.Message) proto.Message {\n\tif msg.ProtoReflect().Descriptor().Name() == idFieldName {\n\t\treturn msg\n\t}\n\tref := msg.ProtoReflect()\n\tif fd := m[ref.Type()]; fd != nil && ref.Has(fd) {\n\t\treturn ref.Get(fd).Message().Interface()\n\t}\n\treturn nil\n}", "func (e *Envelope) Field(fieldpath []string) (string, bool) {\n\tif len(fieldpath) == 0 {\n\t\treturn \"\", false\n\t}\n\n\tswitch fieldpath[0] {\n\t// unhandled: timestamp\n\tcase \"namespace\":\n\t\treturn e.Namespace, len(e.Namespace) > 0\n\tcase \"topic\":\n\t\treturn e.Topic, len(e.Topic) > 0\n\tcase \"event\":\n\t\tdecoded, err := typeurl.UnmarshalAny(e.Event)\n\t\tif err != nil {\n\t\t\treturn \"\", false\n\t\t}\n\n\t\tadaptor, ok := decoded.(interface {\n\t\t\tField([]string) (string, bool)\n\t\t})\n\t\tif !ok {\n\t\t\treturn \"\", false\n\t\t}\n\t\treturn adaptor.Field(fieldpath[1:])\n\t}\n\treturn \"\", false\n}", "func messageToAny(msg proto.Message) *anypb.Any {\n\tout, err := messageToAnyWithError(msg)\n\tif err != nil {\n\t\tlog.Error(fmt.Sprintf(\"error marshaling Any %s: %v\", prototext.Format(msg), err))\n\t\treturn nil\n\t}\n\treturn out\n}", "func (s ElasticsearchAction) MarshalFields(e protocol.FieldEncoder) error {\n\tif s.Endpoint != nil {\n\t\tv := *s.Endpoint\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"endpoint\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Id != nil {\n\t\tv := *s.Id\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"id\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Index != nil {\n\t\tv := *s.Index\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"index\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.RoleArn != nil {\n\t\tv := *s.RoleArn\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"roleArn\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\tif s.Type != nil {\n\t\tv := *s.Type\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"type\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "func (p userActionProps) serialize() actionlog.Meta {\n\tvar (\n\t\tm = make(actionlog.Meta)\n\t)\n\n\tif p.user != nil {\n\t\tm.Set(\"user.handle\", p.user.Handle, true)\n\t\tm.Set(\"user.email\", p.user.Email, true)\n\t\tm.Set(\"user.name\", p.user.Name, true)\n\t\tm.Set(\"user.username\", p.user.Username, true)\n\t\tm.Set(\"user.ID\", p.user.ID, true)\n\t}\n\tif p.new != nil {\n\t\tm.Set(\"new.handle\", p.new.Handle, true)\n\t\tm.Set(\"new.email\", p.new.Email, true)\n\t\tm.Set(\"new.name\", p.new.Name, true)\n\t\tm.Set(\"new.username\", p.new.Username, true)\n\t\tm.Set(\"new.ID\", p.new.ID, true)\n\t}\n\tif p.update != nil {\n\t\tm.Set(\"update.handle\", p.update.Handle, true)\n\t\tm.Set(\"update.email\", p.update.Email, true)\n\t\tm.Set(\"update.name\", p.update.Name, true)\n\t\tm.Set(\"update.username\", p.update.Username, true)\n\t\tm.Set(\"update.ID\", p.update.ID, true)\n\t}\n\tif p.existing != nil {\n\t\tm.Set(\"existing.handle\", p.existing.Handle, true)\n\t\tm.Set(\"existing.email\", p.existing.Email, true)\n\t\tm.Set(\"existing.name\", p.existing.Name, true)\n\t\tm.Set(\"existing.username\", p.existing.Username, true)\n\t\tm.Set(\"existing.ID\", p.existing.ID, true)\n\t}\n\tif p.filter != nil {\n\t\tm.Set(\"filter.query\", p.filter.Query, true)\n\t\tm.Set(\"filter.userID\", p.filter.UserID, true)\n\t\tm.Set(\"filter.roleID\", p.filter.RoleID, true)\n\t\tm.Set(\"filter.handle\", p.filter.Handle, true)\n\t\tm.Set(\"filter.email\", p.filter.Email, true)\n\t\tm.Set(\"filter.username\", p.filter.Username, true)\n\t\tm.Set(\"filter.deleted\", p.filter.Deleted, true)\n\t\tm.Set(\"filter.suspended\", p.filter.Suspended, true)\n\t\tm.Set(\"filter.sort\", p.filter.Sort, true)\n\t}\n\n\treturn m\n}", "func (m *ChatMessage) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := m.Entity.GetFieldDeserializers()\n res[\"attachments\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreateChatMessageAttachmentFromDiscriminatorValue , m.SetAttachments)\n res[\"body\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetObjectValue(CreateItemBodyFromDiscriminatorValue , m.SetBody)\n res[\"channelIdentity\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetObjectValue(CreateChannelIdentityFromDiscriminatorValue , m.SetChannelIdentity)\n res[\"chatId\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetStringValue(m.SetChatId)\n res[\"createdDateTime\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetTimeValue(m.SetCreatedDateTime)\n res[\"deletedDateTime\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetTimeValue(m.SetDeletedDateTime)\n res[\"etag\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetStringValue(m.SetEtag)\n res[\"eventDetail\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetObjectValue(CreateEventMessageDetailFromDiscriminatorValue , m.SetEventDetail)\n res[\"from\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetObjectValue(CreateChatMessageFromIdentitySetFromDiscriminatorValue , m.SetFrom)\n res[\"hostedContents\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreateChatMessageHostedContentFromDiscriminatorValue , m.SetHostedContents)\n res[\"importance\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetEnumValue(ParseChatMessageImportance , m.SetImportance)\n res[\"lastEditedDateTime\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetTimeValue(m.SetLastEditedDateTime)\n res[\"lastModifiedDateTime\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetTimeValue(m.SetLastModifiedDateTime)\n res[\"locale\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetStringValue(m.SetLocale)\n res[\"mentions\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreateChatMessageMentionFromDiscriminatorValue , m.SetMentions)\n res[\"messageType\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetEnumValue(ParseChatMessageType , m.SetMessageType)\n res[\"policyViolation\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetObjectValue(CreateChatMessagePolicyViolationFromDiscriminatorValue , m.SetPolicyViolation)\n res[\"reactions\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreateChatMessageReactionFromDiscriminatorValue , m.SetReactions)\n res[\"replies\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreateChatMessageFromDiscriminatorValue , m.SetReplies)\n res[\"replyToId\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetStringValue(m.SetReplyToId)\n res[\"subject\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetStringValue(m.SetSubject)\n res[\"summary\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetStringValue(m.SetSummary)\n res[\"webUrl\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetStringValue(m.SetWebUrl)\n return res\n}", "func unmarshal(bt []byte) (proto.Message, error) {\n\tany := new(pb3.Any)\n\tif err := proto.Unmarshal(bt, any); err != nil {\n\t\treturn nil, err\n\t}\n\ttyp, err := TypeReg.Get(any.TypeUrl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpm := typ.(proto.Message)\n\terr = proto.Unmarshal(any.Value, pm)\n\treturn pm, err\n}", "func MessageParse(text string) string{\n\n\t//create a string array to then parse out the message from the ID and IP info\n\tinput := strings.Split(text, \" \")\n\n\t//extract text after declarations\n\tMessageActual := input[2:]\n\n\t//convert the array to a simple string\n\ttext = strings.Join(MessageActual, \" \")\n\n\treturn text\n}", "func Decode(msg []byte) (Message, error) {\n\tvar m Message\n\n\tl := len(msg)\n\n\t// trim trailing carriage return if present\n\tif l > 0 && msg[l-1] == '\\r' {\n\t\tl--\n\t\tmsg = msg[:l]\n\t}\n\n\tif l < 2 {\n\t\treturn m, errors.New(\"Decode: message too short\")\n\t}\n\n\tm.typ = codeToMsg[string(msg[:2])]\n\tif m.typ == MsgUnknown {\n\t\treturn m, fmt.Errorf(\"Decode: unknown message code: %q\", string(msg[:2]))\n\t}\n\n\tif l < minMsgLength[m.typ] {\n\t\treturn m, fmt.Errorf(\"Decode: message too short to contain required fields for %v: %d < %d\", m.typ, len(msg), minMsgLength[m.typ])\n\t}\n\n\tm.fields = make(map[fieldType]string)\n\tm.repeateableFields = make(map[fieldType][]string)\n\n\t// Parse fixed-length fields:\n\tp := 2 // byte position in message\n\tfor _, f := range msgDefinitions[m.typ].RequiredFixed {\n\t\tend := p + fixedFieldLengths[f] // end of token\n\t\tm.fields[f] = string(msg[p:end])\n\t\tp = end\n\t}\n\n\t// Parse variable-length fields:\nouter:\n\tfor len(msg) > p {\n\t\tstart := p + 2 // start of current field\n\t\tf := codeToField[string(msg[p:start])]\n\t\tp = start\n\t\tif f == FieldUnknown {\n\t\t\t// store unknown codes in message value\n\t\t\tstart -= 2\n\t\t}\n\n\t\tfor {\n\t\t\tr, w := utf8.DecodeRune(msg[p:])\n\t\t\tp += w\n\t\t\tif r == '|' {\n\t\t\t\tif repeatableField[f] {\n\t\t\t\t\tm.repeateableFields[f] = append(m.repeateableFields[f], string(msg[start:p-1]))\n\t\t\t\t} else {\n\t\t\t\t\tm.fields[f] = string(msg[start : p-1])\n\t\t\t\t}\n\t\t\t\tif p == l {\n\t\t\t\t\tbreak outer\n\t\t\t\t}\n\t\t\t\tcontinue outer\n\t\t\t} else if p == l {\n\t\t\t\tif repeatableField[f] {\n\t\t\t\t\tm.repeateableFields[f] = append(m.repeateableFields[f], string(msg[start:l]))\n\t\t\t\t} else {\n\t\t\t\t\tm.fields[f] = string(msg[start:l])\n\t\t\t\t}\n\t\t\t\tbreak outer\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn m, nil\n}", "func (a *Action) UnmarshalJSON(b []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(b, &s); err != nil {\n\t\treturn err\n\t}\n\tif s == \"\" {\n\t\t*a = Action(\"apply\")\n\t} else {\n\t\t*a = Action(s)\n\t}\n\treturn nil\n}", "func (msg *Message) Parse(msgData []byte) (*ParsedMsg, error) {\n\n\tbuf := bytes.NewBuffer(msgData)\n\tparsedMsg := &ParsedMsg{Msg: msg, FieldDataMap: make(map[int]*FieldData, 64)}\n\tfor _, field := range msg.fields {\n\t\tif err := parse(buf, parsedMsg, field); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif buf.Len() > 0 {\n\t\tlog.Warningln(\"Unprocessed Data =\" + hex.EncodeToString(buf.Bytes()))\n\t\treturn nil, ErrUnreadDataRemaining\n\t}\n\n\treturn parsedMsg, nil\n\n}", "func (a *EmailAction) FromMap(result map[string]string) (EmailAction, error) {\n\tdelay, err := time.ParseDuration(result[\"Delay\"])\n\tif err != nil {\n\t\treturn *a, errors.Wrap(err, \"cannot convert Delay value to integer\")\n\t}\n\ttimestamp, err := time.Parse(TimeFormat, result[\"Timestamp\"])\n\tif err != nil {\n\t\treturn *a, errors.Wrap(err, \"cannot convert timestamp\")\n\t}\n\ta.Action = Action{ID: result[\"ID\"], UserID: result[\"UserID\"], Delay: time.Duration(delay) * time.Second, Timestamp: timestamp}\n\ta.To = result[\"To\"]\n\ta.Body = result[\"Body\"]\n\ta.Subject = result[\"Subject\"]\n\treturn *a, err\n}", "func (e HealthCheck_PayloadValidationError) Field() string { return e.field }", "func messageFromEvent(event accounts.MessageEvent) *Message {\n\tp := getMessage(event.Post.MessageID)\n\tif p == nil {\n\t\tp = NewMessage(nil)\n\t}\n\n\tp.Forward = event.Forward\n\tp.Mention = event.Mention\n\tp.Like = event.Like\n\tp.Followed = event.Followed\n\tp.Reply = event.Reply\n\n\tif event.Post.MessageID != \"\" {\n\t\tp.MessageID = event.Post.MessageID\n\t\tp.PostID = event.Post.PostID\n\t\tp.PostURL = event.Post.URL\n\t\tp.Name = event.Post.AuthorName\n\t\tp.Author = event.Post.Author\n\t\tp.AuthorURL = event.Post.AuthorURL\n\t\tp.AuthorID = event.Post.AuthorID\n\t\tp.Avatar = event.Post.Avatar\n\t\tp.Body = strings.TrimSpace(event.Post.Body)\n\t\tp.Sensitive = event.Post.Sensitive\n\t\tp.Warning = event.Post.Warning\n\t\tp.CreatedAt = event.Post.CreatedAt\n\t\tp.ReplyToID = event.Post.ReplyToID\n\t\tp.ReplyToAuthor = event.Post.ReplyToAuthor\n\t\tp.Actor = event.Post.Actor\n\t\tp.ActorName = event.Post.ActorName\n\t\tp.ActorID = event.Post.ActorID\n\t\tp.Liked = event.Post.Liked\n\t\tp.Shared = event.Post.Shared\n\t\tp.RepliesCount = event.Post.RepliesCount\n\t\tp.SharesCount = event.Post.SharesCount\n\t\tp.LikesCount = event.Post.LikesCount\n\t\tp.Visibility = event.Post.Visibility\n\n\t\t// parse attachments\n\t\tp.MediaPreview = []string{}\n\t\tp.MediaURL = []string{}\n\t\tfor _, v := range event.Media {\n\t\t\tp.MediaPreview = append(p.MediaPreview, v.Preview)\n\t\t\tp.MediaURL = append(p.MediaURL, v.URL)\n\t\t}\n\n\t\tp.MentionIDs = []string{}\n\t\tp.MentionNames = []string{}\n\t\tfor _, v := range event.Post.Mentions {\n\t\t\tp.MentionIDs = append(p.MentionIDs, v.ID)\n\t\t\tp.MentionNames = append(p.MentionNames, v.Name)\n\t\t}\n\t}\n\n\tif event.Followed {\n\t\tp.MessageID = event.Follow.Account\n\t\tp.Actor = event.Follow.Account\n\t\tp.ActorName = event.Follow.Name\n\t\tp.Avatar = event.Follow.Avatar\n\t\tp.AuthorURL = event.Follow.ProfileURL\n\t\tp.AuthorID = event.Follow.ProfileID\n\t\tp.Following = event.Follow.Following\n\t\tp.FollowedBy = event.Follow.FollowedBy\n\t}\n\n\tif p.MessageID == \"\" {\n\t\tspw := &spew.ConfigState{Indent: \" \", DisableCapacities: true, DisablePointerAddresses: true}\n\t\tlog.Println(\"Invalid message received:\", spw.Sdump(event))\n\t}\n\treturn p\n}", "func (e GetMovableObjectRequestValidationError) Field() string { return e.field }", "func NewAction(line string) (Action, error) {\n action := Action{}\n isValid := utf8.ValidString(line)\n if !isValid {\n return action, errors.New(\"Action string contains invalid encoded UTF-8\")\n }\n\n instructionRune, length := utf8.DecodeRuneInString(line)\n v, err := strconv.Atoi(line[length:])\n\n if err != nil {\n return action, err\n }\n\n action.Instruction = string(instructionRune)\n action.Value = v\n return action, nil\n}", "func (f *Handler) dispatch(msg *provisioners.Message) error {\n\tf.logger.Info(\"Message to be sent = \", zap.Any(\"msg\", msg))\n\t f.logger.Info(\"Message Payload\", zap.Any(\"payload\", string(msg.Payload[:])))\n\t\n\t jStr := string(msg.Payload[:])\n\t fmt.Println(jStr)\n \n\t type Payload struct {\n\t\t Id string `json:\"id\"`\n\t\t Data string `json:\"data\"`\n\t }\n\t \n\t var payload Payload\n \n\t json.Unmarshal([]byte(jStr), &payload)\n\t fmt.Printf(\"%+v\\n\", payload.Data)\n\t dataDec, _ := b64.StdEncoding.DecodeString(payload.Data)\n\t fmt.Printf(\"%+v\\n\", string(dataDec))\n\t \n\t type Data struct {\n\t\t Source string `json:\"source\"`\n\t\t Type string `json:\"type\"`\n\t }\n\t \n\t var data Data\n\t \n\t \n\t json.Unmarshal([]byte(string(dataDec)), &data)\n\t fmt.Printf(\"%+v\\n\", data)\n\t var destination = f.destination\n\t if data.Source == \"GITHUB\" {\n\t\tdestination = getRequiredEnv(\"GITHUB_CHANNEL_URL\")\n\t } else if data.Source == \"FRESHBOOKS\" {\n\t\t destination = getRequiredEnv(\"FRESHBOOKS_CHANNEL_URL\")\n\t } else {\n\t\t destination = getRequiredEnv(\"COMMON_CHANNEL_URL\")\n\t }\n\t fmt.Printf(\"%+v\\n\", destination)\n\n\t err := f.dispatcher.DispatchMessage(msg, destination, \"\", provisioners.DispatchDefaults{})\n\t if err != nil {\n\t\t f.logger.Error(\"Error dispatching message\", zap.String(\"destination\", destination))\n\t\t f.logger.Error(\"Error received\", zap.Error(err))\n\t }\n\t return err\n }", "func (f *EventFilter) Update(from *EventFilter, fields ...string) error {\n\tfor _, field := range fields {\n\t\tswitch field {\n\t\tcase \"Action\":\n\t\t\tf.Action = from.Action\n\t\tcase \"When\":\n\t\t\tf.When = from.When\n\t\tcase \"Expressions\":\n\t\t\tf.Expressions = append(f.Expressions[0:0], from.Expressions...)\n\t\tcase \"RuntimeAssets\":\n\t\t\tf.RuntimeAssets = append(f.RuntimeAssets[0:0], from.RuntimeAssets...)\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unsupported field: %q\", f)\n\t\t}\n\t}\n\treturn nil\n}" ]
[ "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.51525277", "0.51415366", "0.513458", "0.51294994", "0.51227087", "0.50493175", "0.5039263", "0.503923", "0.50101644", "0.49994305", "0.49941587", "0.49935615", "0.4985948", "0.49835533", "0.4968364", "0.4966712", "0.49513364", "0.49505413", "0.4936618", "0.49320883", "0.49141043", "0.49131233", "0.49040687", "0.487977", "0.48752627", "0.4871259", "0.48684505", "0.48606828", "0.4857996", "0.4847212", "0.48325065", "0.48193234", "0.4803289", "0.48026302", "0.47999173", "0.47984815", "0.47894663", "0.4787967", "0.47829542", "0.47734332", "0.4770645", "0.47688597", "0.47682926", "0.4756906", "0.47565404", "0.47555533", "0.4747417", "0.47436014", "0.4739268", "0.473628", "0.47348982", "0.4732418", "0.47267663", "0.47217372", "0.47217125", "0.47140518", "0.47140446", "0.47128233", "0.47102815", "0.47101814", "0.4709056", "0.47066513", "0.46687067", "0.4654543", "0.46507022", "0.46426505", "0.46272084", "0.46269196", "0.46248963", "0.4621939", "0.46216357", "0.4620713", "0.46179995", "0.46133175", "0.46026182", "0.4593671", "0.4592833", "0.45910385", "0.45866206" ]
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()\n\tisoBitmap.parsedMsg = parsedMsg\n\n\tvar err error\n\n\tfor _, pFieldIdValue := range fieldValArr {\n\n\t\tfield := msg.fieldByIdMap[pFieldIdValue.Id]\n\t\tif field == nil {\n\t\t\treturn nil, ErrUnknownField\n\t\t}\n\n\t\tlog.Tracef(\"Setting field value %s:=> %s\\n\", field.Name, pFieldIdValue.Value)\n\n\t\tfieldData := new(FieldData)\n\t\tfieldData.Field = field\n\n\t\tif field.FieldInfo.Type == Bitmapped {\n\t\t\tfieldData.Bitmap = isoBitmap\n\t\t\tisoBitmap.field = field\n\t\t\tparsedMsg.FieldDataMap[field.Id] = fieldData\n\t\t} else {\n\t\t\tif fieldData.Data, err = field.ValueFromString(pFieldIdValue.Value); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"isosim: failed to set value for field :%s :%w\", field.Name, err)\n\t\t\t}\n\n\t\t\tif field.FieldInfo.Type == Fixed && len(fieldData.Data) != field.FieldInfo.FieldSize {\n\t\t\t\t//this is an error, field length exceeds max length\n\t\t\t\treturn nil, fmt.Errorf(\"fixed field - [%s] doesn't match fixed length of %d (supplied length = %d)\",\n\t\t\t\t\tfield.Name, field.FieldInfo.FieldSize, len(fieldData.Data))\n\t\t\t} else if field.FieldInfo.Type == Variable {\n\t\t\t\tif field.FieldInfo.MaxSize != 0 && len(fieldData.Data) > field.FieldInfo.MaxSize {\n\t\t\t\t\t//error\n\t\t\t\t\treturn nil, fmt.Errorf(\"variable field - [%s] exceeds max length of %d (supplied length = %d)\",\n\t\t\t\t\t\tfield.Name, field.FieldInfo.MaxSize, len(fieldData.Data))\n\t\t\t\t}\n\t\t\t\tif field.FieldInfo.MinSize != 0 && len(fieldData.Data) < field.FieldInfo.MinSize {\n\t\t\t\t\t//error\n\t\t\t\t\treturn nil, fmt.Errorf(\"variable field - [%s] exceeds min length of %d (supplied length = %d)\",\n\t\t\t\t\t\tfield.Name, field.FieldInfo.MinSize, len(fieldData.Data))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif field.ParentId != -1 {\n\t\t\t\tparentField := msg.fieldByIdMap[field.ParentId]\n\t\t\t\tif parentField.FieldInfo.Type == Bitmapped {\n\t\t\t\t\tlog.Tracef(\"Setting bit-on for field position - %d\\n\", field.Position)\n\t\t\t\t\tisoBitmap.Set(field.Position, pFieldIdValue.Value)\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tparsedMsg.FieldDataMap[field.Id] = fieldData\n\n\t\t}\n\n\t}\n\n\treturn parsedMsg, nil\n\n}", "func Unmarshal(bts []byte) *Message {\n\tmsg := new(Message)\n\tbuf := bytes.NewBuffer(bts)\n\tvar ipbts [4]byte\n\tbinary.Read(buf, binary.BigEndian, &msg.Head.Version)\n\tbinary.Read(buf, binary.BigEndian, &msg.Head.Type)\n\tbinary.Read(buf, binary.BigEndian, &msg.Head.Pap)\n\tbinary.Read(buf, binary.BigEndian, &msg.Head.Rsv)\n\tbinary.Read(buf, binary.BigEndian, &msg.Head.SerialNo)\n\tbinary.Read(buf, binary.BigEndian, &msg.Head.ReqIdentifier)\n\tfor i := 0; i < 4; i++ {\n\t\tbinary.Read(buf, binary.BigEndian, &ipbts[i])\n\t}\n\tmsg.Head.UserIP = net.IPv4(ipbts[0], ipbts[1], ipbts[2], ipbts[3])\n\tbinary.Read(buf, binary.BigEndian, &msg.Head.UserPort)\n\tbinary.Read(buf, binary.BigEndian, &msg.Head.ErrCode)\n\tbinary.Read(buf, binary.BigEndian, &msg.Head.AttrNum)\n\tvar auth [16]byte\n\tbinary.Read(buf, binary.BigEndian, &auth)\n\tmsg.Head.Authenticator = auth[:]\n\tmsg.Attrs = make([]Attr, msg.Head.AttrNum)\n\tfor i := byte(0); i < msg.Head.AttrNum; i++ {\n\t\tattr := &msg.Attrs[i]\n\t\tbinary.Read(buf, binary.BigEndian, &attr.Type)\n\t\tbinary.Read(buf, binary.BigEndian, &attr.Len)\n\t\tattr.Len -= 2\n\t\tattr.Str = make([]byte, attr.Len)\n\t\tbinary.Read(buf, binary.BigEndian, attr.Str)\n\t}\n\treturn msg\n}", "func (m *Message) extract(b []byte) {\n\tslices := bytes.Split(b, []byte{'|'})\n\ti := bytes.Index(b, []byte{'|'})\n\tm.Type = \"default\"\n\tif i != -1 {\n\t\t// well I know how I'd do it in python\n\t\t// this seems a little awkward\n\t\tm.dirtyfields = make(map[int]bool)\n\t\tif res, err := get(0, slices); err == nil {\n\t\t\tm.setField(0, string(res))\n\t\t}\n\t}\n\tif res, err := get(1, slices); err == nil {\n\t\tif string(res) != \"\" {\n\t\t\tm.setField(1, string(res))\n\t\t}\n\t}\n\tif res, err := get(2, slices); err == nil {\n\t\tm.setField(2, string(res))\n\t}\n\tif res, err := get(3, slices); err == nil {\n\t\tif t, err2 := strconv.Atoi(string(res)); err2 == nil {\n\t\t\tTimeout, _ := time.ParseDuration(fmt.Sprintf(\"%ds\", t))\n\t\t\tm.setField(3, Timeout)\n\t\t} else {\n\t\t\tif d, err3 := time.ParseDuration(string(res)); err3 == nil {\n\t\t\t\tm.setField(3, d)\n\t\t\t}\n\t\t}\n\t}\n}", "func _messsageDecode(b *[]byte) (*Message, error) {\n\n\tmessage := Message{}\n\n\tmsg := bytes.Split(*b, elemSep)\n\t// if the length of msg slice is less than the message is invalid\n\tif len(msg) < 2 {\n\t\treturn nil, errors.New(fmt.Sprintf(\"Invalid message : invalid msg len %d\", len(msg)))\n\t}\n\n\t// elemCount counts the number of elements added to the message like MsgType,Msg etc..\n\t// the elemCount should be equal to len(msg) after the loop coming\n\tvar elemCount int\n\n\t// loop until the last element\n\t// the last element is the payload\n\tfor index, element := range msg {\n\n\t\tif (index + 1) == len(msg) {\n\n\t\t\tmessage.Msg = element\n\t\t\telemCount++\n\t\t\tbreak\n\n\t\t}\n\n\t\telem := bytes.Split(element, keyValSep)\n\n\t\tif len(elem) < 2 {\n\t\t\treturn nil, errors.New(fmt.Sprintf(\"Invalid message : invalid length %d elemCounted %d\",len(elem),elemCount))\n\t\t}\n\n\t\t// find the approprite elem of message\n\t\t// if unknown elem is sent then this is an errors\n\t\tswitch string(elem[0]) {\n\n\t\tcase \"ClientID\":\n\n\t\t\tmessage.ClientID = string(elem[1])\n\t\t\telemCount++\n\n\t\tcase \"ReceiverID\":\n\n\t\t\tmessage.ReceiverID = string(elem[1])\n\t\t\telemCount++\n\n\t\tcase \"RoomID\":\n\n\t\t\tmessage.RoomID = string(elem[1])\n\t\t\telemCount++\n\n\t\tcase \"Info\":\n\n\t\t\tmessage.Info = string(elem[1])\n\t\t\telemCount++\n\n\t\tcase \"MsgType\":\n\n\t\t\tmsgType, err := strconv.ParseInt(string(elem[1]), 10, 16)\n\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tmessage.MsgType = int(msgType)\n\t\t\telemCount++\n\n\t\tdefault: // unknown elemetn which is a error\n\n\t\t\treturn nil, errors.New(fmt.Sprintf(\"Invalid message : Unknown Elem(%s)\", string(elem[0])))\n\n\t\t} // switch case ends\n\n\t} // for loop ends\n\n\tif elemCount != len(msg) {\n\t\treturn nil, errors.New(\"Invalid message\")\n\t}\n\n\t// Now we have a valid message\n\n\treturn &message, nil\n\n}", "func (e *Env) parseFields(flat *dota.CSVCMsg_FlattenedSerializer) error {\n\te.fields = make([]field, len(flat.GetFields()))\n\tfor i, ff := range flat.GetFields() {\n\t\tf := &e.fields[i]\n\t\tif err := f.fromProto(ff, e); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (m *Message) parse(r io.Reader) error {\n\tvar err error\n\tmessage, _ := mail.ReadMessage(r)\n\n\t// Get headers\n\tm.To = message.Header.Get(\"To\")\n\tm.encoding = message.Header.Get(\"Content-Type\")\n\tvar sReceived string = message.Header.Get(\"Received\")\n\n\t// Verify sender before continuing\n\tif OptSPFCheck {\n\t\tvar sSPFRes string\n\t\tsSPFRes, err = BuildJSONGet(OptSPFAPI, []byte(fmt.Sprintf(\n\t\t\t`{\"apiKey\": \"%s\", \"email\": \"%s\", \"received\": \"%s\"}`,\n\t\t\tOptSPFAPIKey, m.From, sReceived)))\n\t\tif err != nil {\n\t\t\tm.SPF = \"TempError\"\n\t\t} else {\n\t\t\tvar SPFRes map[string]string\n\t\t\terr = json.Unmarshal([]byte(sSPFRes), &SPFRes)\n\t\t\tif err != nil {\n\t\t\t\tm.SPF = \"TempError\"\n\t\t\t} else {\n\t\t\t\tm.SPF = SPFRes[\"result\"]\n\t\t\t\tm.IP = SPFRes[\"sender-IP\"]\n\t\t\t}\n\t\t}\n\t} else {\n\t\tm.SPF = \"None\"\n\t}\n\n\t// If configured to require SPF pass only and this message doesn't pass, stop with error\n\tif OptRequireSPFPass && m.SPF != \"Pass\" {\n\t\treturn fmt.Errorf(\"Error: SPF not pass for sender %s\", m.From)\n\t}\n\n\t// Set time\n\tm.Time = time.Now().UTC().Format(time.RFC3339)\n\n\t// Parse to\n\tm.spath, m.sdomain = SplitToAddress(m.To)\n\n\t// Get subject\n\tm.Subject = message.Header.Get(\"Subject\")\n\n\t// Get body\n\ttempbuf := new(bytes.Buffer)\n\ttempbuf.ReadFrom(message.Body)\n\tmediaType, args, _ := mime.ParseMediaType(m.encoding)\n\tif strings.HasPrefix(mediaType, \"multipart\") {\n\t\tpart := multipart.NewReader(tempbuf, args[\"boundary\"])\n\t\tfor {\n\t\t\tnPart, err := part.NextPart()\n\t\t\t// If reached end of message, stop looping\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t// Pass errors\n\t\t\t} else if err != nil {\n\t\t\t\treturn err\n\t\t\t// Grab the text/plain version\n\t\t\t} else if strings.Contains(nPart.Header.Get(\"Content-Type\"), \"text/plain\") {\n\t\t\t\ttempPart, _ := ioutil.ReadAll(nPart)\n\t\t\t\tm.Body = strings.Replace(strings.Replace(strings.TrimSpace(string(tempPart)), \"\\r\\n\", \" \", -1), \"\\n\", \" \", -1)\n\t\t\t\tbreak\n\t\t\t// Message had no text/plain formatting\n\t\t\t//TODO: One day add html parsing to strip tags\n\t\t\t} else {\n\t\t\t\treturn errors.New(\"Error: No text/plain formatting of message.\")\n\t\t\t}\n\t\t}\n\t}\n\n\t// Extract URLs from body\n\tre := regexp.MustCompile(`([a-zA-Z]+:\\/\\/[^<> ]+[a-zA-Z0-9\\/])`)\n\tm.Links = re.FindAllString(m.Body, -1)\n\n\treturn nil\n}", "func populateMessage(message models.Message, msgType models.MessageType, channel, text, timeStamp string, threadTimestamp string, mentioned bool, user *slack.User, bot *models.Bot) models.Message {\n\tswitch msgType {\n\tcase models.MsgTypeDirect, models.MsgTypeChannel, models.MsgTypePrivateChannel:\n\t\t// Populate message attributes\n\t\tmessage.Type = msgType\n\t\tmessage.Service = models.MsgServiceChat\n\t\tmessage.ChannelID = channel\n\t\tmessage.Input = text\n\t\tmessage.Output = \"\"\n\t\tmessage.Timestamp = timeStamp\n\t\tmessage.ThreadTimestamp = threadTimestamp\n\t\tmessage.BotMentioned = mentioned\n\t\tmessage.Attributes[\"ws_token\"] = bot.SlackWorkspaceToken\n\n\t\t// If the message read was not a dm, get the name of the channel it came from\n\t\tif msgType != models.MsgTypeDirect {\n\t\t\tname, ok := findKey(bot.Rooms, channel)\n\t\t\tif !ok {\n\t\t\t\tbot.Log.Warnf(\"populateMessage: Could not find name of channel '%s'.\", channel)\n\t\t\t}\n\t\t\tmessage.ChannelName = name\n\t\t}\n\n\t\t// make channel variables available\n\t\tmessage.Vars[\"_channel.id\"] = message.ChannelID\n\t\tmessage.Vars[\"_channel.name\"] = message.ChannelName // will be empty if it came via DM\n\n\t\t// Populate message with user information (i.e. who sent the message)\n\t\t// These will be accessible on rules via ${_user.email}, ${_user.id}, etc.\n\t\tif user != nil { // nil user implies a message from an api/bot (i.e. not an actual user)\n\t\t\tmessage.Vars[\"_user.email\"] = user.Profile.Email\n\t\t\tmessage.Vars[\"_user.firstname\"] = user.Profile.FirstName\n\t\t\tmessage.Vars[\"_user.lastname\"] = user.Profile.LastName\n\t\t\tmessage.Vars[\"_user.name\"] = user.Name\n\t\t\tmessage.Vars[\"_user.id\"] = user.ID\n\t\t}\n\n\t\tmessage.Debug = true // TODO: is this even needed?\n\t\treturn message\n\tdefault:\n\t\tbot.Log.Debugf(\"Read message of unsupported type '%T'. Unable to populate message attributes\", msgType)\n\t\treturn message\n\t}\n}", "func Parse(message *flowmessage.FlowMessage) (map[string]interface{}, time.Time, error) {\n\tm := make(map[string]interface{})\n\n\ttimestamp := time.Unix(int64(message.TimeReceived), 0)\n\n\tif t := message.Type.String(); t != \"\" {\n\t\tif t != \"FLOWUNKNOWN\" {\n\t\t\tm[\"type\"] = t\n\t\t}\n\t}\n\n\tif message.SequenceNum > 0 {\n\t\tm[\"sequencenum\"] = int(message.SequenceNum)\n\t}\n\n\tif message.SamplingRate > 0 {\n\t\tm[\"samplingrate\"] = int64(message.SamplingRate)\n\t}\n\n\tif message.HasFlowDirection {\n\t\tm[\"flowdirection\"] = int(message.FlowDirection)\n\t}\n\n\tif len(message.SamplerAddress) > 0 {\n\t\tkey := \"sampleraddress\"\n\t\tip, err := bytesToIP(message.SamplerAddress)\n\t\tif err != nil {\n\t\t\treturn nil, timestamp, errors.Wrap(err, fmt.Sprintf(\"error converting %s to string\", key))\n\t\t}\n\t\tm[key] = ip.String()\n\t}\n\n\tif message.TimeFlowStart > 0 {\n\t\tm[\"timeflowstart\"] = int64(message.TimeFlowStart)\n\t}\n\n\tif message.TimeFlowEnd > 0 {\n\t\tm[\"timeflowend\"] = int64(message.TimeFlowEnd)\n\t}\n\n\tif message.Bytes > 0 {\n\t\tm[\"bytes\"] = int64(message.Bytes)\n\t}\n\n\tif message.Packets > 0 {\n\t\tm[\"packets\"] = int64(message.Packets)\n\t}\n\n\tif len(message.SrcAddr) > 0 {\n\t\tkey := \"srcaddr\"\n\t\tip, err := bytesToIP(message.SrcAddr)\n\t\tif err != nil {\n\t\t\treturn nil, timestamp, errors.Wrap(err, fmt.Sprintf(\"error converting %s to string\", key))\n\t\t}\n\t\tm[key] = ip.String()\n\t}\n\n\tif len(message.DstAddr) > 0 {\n\t\tkey := \"dstaddr\"\n\t\tip, err := bytesToIP(message.DstAddr)\n\t\tif err != nil {\n\t\t\treturn nil, timestamp, errors.Wrap(err, fmt.Sprintf(\"error converting %s to string\", key))\n\t\t}\n\t\tm[key] = ip.String()\n\t}\n\n\tif len(message.NextHop) > 0 {\n\t\tkey := \"nexthop\"\n\t\tip, err := bytesToIP(message.NextHop)\n\t\tif err != nil {\n\t\t\treturn nil, timestamp, errors.Wrap(err, fmt.Sprintf(\"error converting %s to string\", key))\n\t\t}\n\t\tm[key] = ip.String()\n\t}\n\n\tif message.Etype > 0 {\n\t\tm[\"etype\"] = int(message.Etype)\n\t}\n\n\t// Goflow input does not support HOPOPT as it maps to 0, meaning HOPOPT would\n\t// be set anytime the proto field is not present.\n\tif message.Proto > 0 {\n\t\tm[\"proto\"] = int(message.Proto)\n\t\tm[\"proto_name\"] = protoName(int(message.Proto))\n\t}\n\n\tif message.SrcPort > 0 {\n\t\tm[\"srcport\"] = int(message.SrcPort)\n\t}\n\n\tif message.DstPort > 0 {\n\t\tm[\"dstport\"] = int(message.DstPort)\n\t}\n\n\t// Always set inif and outif\n\tm[\"inif\"] = int(message.InIf)\n\tm[\"outif\"] = int(message.OutIf)\n\n\tif message.SrcMac > 0 {\n\t\tm[\"srcmac\"] = int64(message.SrcMac)\n\t}\n\n\tif message.DstMac > 0 {\n\t\tm[\"dstmac\"] = int64(message.DstMac)\n\t}\n\n\tif message.SrcVlan > 0 {\n\t\tm[\"srcvlan\"] = int(message.SrcVlan)\n\t}\n\n\tif message.DstVlan > 0 {\n\t\tm[\"dstvlan\"] = int(message.DstVlan)\n\t}\n\n\tif message.VlanId > 0 {\n\t\tm[\"vlanid\"] = int(message.VlanId)\n\t}\n\n\tif message.IngressVrfID > 0 {\n\t\tm[\"ingressvrfid\"] = int(message.IngressVrfID)\n\t}\n\n\tif message.EgressVrfID > 0 {\n\t\tm[\"egressvrfid\"] = int(message.EgressVrfID)\n\t}\n\n\tif message.IPTos > 0 {\n\t\tm[\"iptos\"] = int(message.IPTos)\n\t}\n\n\tif message.ForwardingStatus > 0 {\n\t\tm[\"forwardingstatus\"] = int(message.ForwardingStatus)\n\t}\n\n\tif message.IPTTL > 0 {\n\t\tm[\"ipttl\"] = int(message.IPTTL)\n\t}\n\n\tif message.TCPFlags > 0 {\n\t\tm[\"tcpflags\"] = int(message.TCPFlags)\n\t}\n\n\tif message.IcmpType > 0 {\n\t\tm[\"icmptype\"] = int(message.IcmpType)\n\t}\n\n\tif message.IcmpCode > 0 {\n\t\tm[\"icmpcode\"] = int(message.IcmpCode)\n\t}\n\n\tif message.IPv6FlowLabel > 0 {\n\t\tm[\"ipv6flowlabel\"] = int(message.IPv6FlowLabel)\n\t}\n\n\tif message.FragmentId > 0 {\n\t\tm[\"fragmentid\"] = int(message.FragmentId)\n\t}\n\n\tif message.FragmentOffset > 0 {\n\t\tm[\"fragmentoffset\"] = int(message.FragmentOffset)\n\t}\n\n\tif message.HasBiFlowDirection {\n\t\tm[\"biflowdirection\"] = int(message.BiFlowDirection)\n\t}\n\n\tif message.SrcAS > 0 {\n\t\tm[\"srcas\"] = int(message.SrcAS)\n\t}\n\n\tif message.DstAS > 0 {\n\t\tm[\"dstnas\"] = int(message.DstAS)\n\t}\n\n\tif message.NextHopAS > 0 {\n\t\tm[\"nexthopas\"] = int(message.NextHopAS)\n\t}\n\n\tif message.SrcNet > 0 {\n\t\tm[\"srcnet\"] = int(message.SrcNet)\n\t}\n\n\tif message.DstNet > 0 {\n\t\tm[\"dstnet\"] = int(message.DstNet)\n\t}\n\n\t// Add Encap fields if present\n\tif message.HasEncap {\n\t\tkey := \"srcaddrencap\"\n\t\tip, err := bytesToIP(message.SrcAddrEncap)\n\t\tif err != nil {\n\t\t\treturn nil, timestamp, errors.Wrap(err, fmt.Sprintf(\"error converting %s to string\", key))\n\t\t}\n\t\tm[key] = ip.String()\n\n\t\tkey = \"dstaddrencap\"\n\t\tip, err = bytesToIP(message.DstAddrEncap)\n\t\tif err != nil {\n\t\t\treturn nil, timestamp, errors.Wrap(err, fmt.Sprintf(\"error converting %s to string\", key))\n\t\t}\n\t\tm[key] = ip.String()\n\n\t\tm[\"protoencap\"] = int(message.ProtoEncap)\n\t\tm[\"etypeencap\"] = int(message.EtypeEncap)\n\t\tm[\"iptosencap\"] = int(message.IPTosEncap)\n\t\tm[\"ipttlencap\"] = int(message.IPTTLEncap)\n\t\tm[\"ipv6flowlabelencap\"] = int(message.IPv6FlowLabelEncap)\n\t\tm[\"fragmentidencap\"] = int(message.FragmentIdEncap)\n\t\tm[\"fragmentoffsetencap\"] = int(message.FragmentOffsetEncap)\n\t}\n\n\t// Add MPLS fields if present\n\tif message.HasMPLS {\n\t\tm[\"mplscount\"] = int(message.MPLSCount)\n\t\tm[\"mpls1ttl\"] = int(message.MPLS1TTL)\n\t\tm[\"mpls1label\"] = int(message.MPLS1Label)\n\t\tm[\"mpls2ttl\"] = int(message.MPLS2TTL)\n\t\tm[\"mpls2label\"] = int(message.MPLS2Label)\n\t\tm[\"mpls3ttl\"] = int(message.MPLS3TTL)\n\t\tm[\"mpls3label\"] = int(message.MPLS3Label)\n\t\tm[\"mplslastttl\"] = int(message.MPLSLastTTL)\n\t\tm[\"mplslastlabel\"] = int(message.MPLSLastLabel)\n\t}\n\n\t// Add PPP fields if present\n\tif message.HasPPP {\n\t\tm[\"sampling_rate\"] = int(message.PPPAddressControl)\n\t}\n\n\treturn m, timestamp, nil\n}", "func ParseRFC2822Message(body []byte) (string, []string, string, string, error) {\n\t// From: senderDisplayName <sender email>\n\t// Subject: subject\n\t// To: A Display Name <[email protected]>, B <[email protected]>\n\tmatch := fromRegex.FindSubmatch(body)\n\tif match == nil || len(match) < 2 {\n\t\treturn \"\", nil, \"\", \"\", skerr.Fmt(\"Failed to find a From: line in message.\")\n\t}\n\tfrom := string(match[1])\n\n\tmatch = subjectRegex.FindSubmatch(body)\n\tsubject := defaultSubject\n\tif len(match) >= 2 {\n\t\tsubject = string(bytes.TrimSpace(match[1]))\n\t}\n\n\tmatch = toRegex.FindSubmatch(body)\n\tif match == nil || len(match) < 2 {\n\t\treturn \"\", nil, \"\", \"\", skerr.Fmt(\"Failed to find a To: line in message.\")\n\t}\n\tto := []string{}\n\tfor _, addr := range bytes.Split(match[1], []byte(\",\")) {\n\t\ttoAsString := string(bytes.TrimSpace(addr))\n\t\tif toAsString != \"\" {\n\t\t\tto = append(to, toAsString)\n\t\t}\n\t}\n\tif len(to) < 1 {\n\t\treturn \"\", nil, \"\", \"\", skerr.Fmt(\"Failed to find any To: addresses.\")\n\t}\n\n\tparts := doubleNewLine.Split(string(body), 2)\n\tif len(parts) != 2 {\n\t\treturn \"\", nil, \"\", \"\", skerr.Fmt(\"Failed to find the body of the message.\")\n\t}\n\tmessageBody := parts[1]\n\n\treturn from, to, subject, messageBody, nil\n}", "func Decode(msg []byte) (Message, error) {\n\tvar m Message\n\n\tl := len(msg)\n\n\t// trim trailing carriage return if present\n\tif l > 0 && msg[l-1] == '\\r' {\n\t\tl--\n\t\tmsg = msg[:l]\n\t}\n\n\tif l < 2 {\n\t\treturn m, errors.New(\"Decode: message too short\")\n\t}\n\n\tm.typ = codeToMsg[string(msg[:2])]\n\tif m.typ == MsgUnknown {\n\t\treturn m, fmt.Errorf(\"Decode: unknown message code: %q\", string(msg[:2]))\n\t}\n\n\tif l < minMsgLength[m.typ] {\n\t\treturn m, fmt.Errorf(\"Decode: message too short to contain required fields for %v: %d < %d\", m.typ, len(msg), minMsgLength[m.typ])\n\t}\n\n\tm.fields = make(map[fieldType]string)\n\tm.repeateableFields = make(map[fieldType][]string)\n\n\t// Parse fixed-length fields:\n\tp := 2 // byte position in message\n\tfor _, f := range msgDefinitions[m.typ].RequiredFixed {\n\t\tend := p + fixedFieldLengths[f] // end of token\n\t\tm.fields[f] = string(msg[p:end])\n\t\tp = end\n\t}\n\n\t// Parse variable-length fields:\nouter:\n\tfor len(msg) > p {\n\t\tstart := p + 2 // start of current field\n\t\tf := codeToField[string(msg[p:start])]\n\t\tp = start\n\t\tif f == FieldUnknown {\n\t\t\t// store unknown codes in message value\n\t\t\tstart -= 2\n\t\t}\n\n\t\tfor {\n\t\t\tr, w := utf8.DecodeRune(msg[p:])\n\t\t\tp += w\n\t\t\tif r == '|' {\n\t\t\t\tif repeatableField[f] {\n\t\t\t\t\tm.repeateableFields[f] = append(m.repeateableFields[f], string(msg[start:p-1]))\n\t\t\t\t} else {\n\t\t\t\t\tm.fields[f] = string(msg[start : p-1])\n\t\t\t\t}\n\t\t\t\tif p == l {\n\t\t\t\t\tbreak outer\n\t\t\t\t}\n\t\t\t\tcontinue outer\n\t\t\t} else if p == l {\n\t\t\t\tif repeatableField[f] {\n\t\t\t\t\tm.repeateableFields[f] = append(m.repeateableFields[f], string(msg[start:l]))\n\t\t\t\t} else {\n\t\t\t\t\tm.fields[f] = string(msg[start:l])\n\t\t\t\t}\n\t\t\t\tbreak outer\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn m, nil\n}", "func (msg *Message) GetArgs() {\n\tif !strings.HasPrefix(msg.raw, \"|\") || strings.HasPrefix(msg.raw, \"||\") {\n\t\t// generic typeless message\n\t\tmsg.msgType = \"\"\n\t\tmsg.args = []string{strings.TrimPrefix(msg.raw, \"||\")}\n\t} else {\n\t\tmsgData := strings.Split(msg.raw, \"|\")\n\t\tmsg.msgType = msgData[1] // first should be \"\"\n\n\t\tswitch msg.msgType {\n\t\tcase \"c\", \"chat\": // certain messages can contain | in them\n\t\t\tmsg.args = append(msgData[2:3],\n\t\t\t\tstrings.TrimSpace(strings.Join(msgData[3:], \"|\")))\n\t\tcase \"c:\":\n\t\t\t// move the timestamp to the end\n\t\t\tmsg.args = append(msgData[3:4],\n\t\t\t\tstrings.TrimSpace(strings.Join(msgData[4:], \"|\")),\n\t\t\t\tmsgData[2])\n\t\tcase \"pm\":\n\t\t\t// PMs get treated differently so that they can be run through\n\t\t\t// commands the same way a normal chat message can be\n\t\t\tmsg.room = \"user:\" + msgData[2]\n\t\t\t// discard the bot's name\n\t\t\tmsg.args = append(msgData[2:3], msgData[4:]...)\n\t\tdefault:\n\t\t\tmsg.args = msgData[2:]\n\t\t}\n\t}\n}", "func Parse(str string) (Message, error) {\n\tvar fields [4]string\n\tsplit := strings.Split(str, messageDelimiter)\n\n\tif len(split) > 4 || len(split) < 2 {\n\t\treturn Message{}, errors.New(fmt.Sprint(\"Unable to parse message: got\", len(split), \"fields\"))\n\t}\n\n\tfor i := range split {\n\t\tfields[i] = split[i]\n\t}\n\n\tid, err := strconv.Atoi(fields[0])\n\tif err != nil {\n\t\treturn Message{}, err\n\t}\n\treturn Message{Timestamp: id, Type: fields[1], FromID: fields[2], ToID: fields[3], originalMessage:str}, nil\n}", "func MessageParse(text string) string{\n\n\t//create a string array to then parse out the message from the ID and IP info\n\tinput := strings.Split(text, \" \")\n\n\t//extract text after declarations\n\tMessageActual := input[2:]\n\n\t//convert the array to a simple string\n\ttext = strings.Join(MessageActual, \" \")\n\n\treturn text\n}", "func ParseMessage(msg string) Message {\n\tvar message Message\n\tmsgBytes := []byte(msg)\n\terr := json.Unmarshal(msgBytes, &message)\n\thandleErr(err)\n\tfmt.Println(\"Person\", message)\n\treturn message\n}", "func BuildMessage(content string) *Message {\n msg := new(Message)\n fields := strings.Split(content, \"][\")\n for idx, field := range fields {\n s := strings.Trim(field, \"[]\")\n switch idx {\n case 0:\n msg.Priority = s\n case 1:\n msg.Status = s\n case 2:\n msg.Endpoint = s\n case 3:\n case 4:\n msg.Content = s\n case 5:\n l := strings.Split(s, \" \")\n t := l[1:]\n ts := strings.Join(t, \"T\")\n msg.Timestamp = ts\n default:\n }\n }\n return msg\n}", "func (m *Message) Fields() map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"groupId\": m.GroupID,\n\t\t\"memberId\": m.MemberID,\n\t\t\"trial\": m.Trial,\n\t}\n}", "func (b *builder) handleMessageField(w *strings.Builder, field proto.Visitee) error {\n\tvar (\n\t\tname string\n\t\ttyp string\n\t\tsequence int\n\t\trepeated bool\n\t\tcomment *proto.Comment\n\t)\n\n\tswitch field.(type) {\n\tcase *proto.NormalField:\n\t\tft := field.(*proto.NormalField)\n\t\tname = ft.Name\n\t\ttyp = b.goType(ft.Type)\n\t\tsequence = ft.Sequence\n\t\tcomment = ft.Comment\n\t\trepeated = ft.Repeated\n\tcase *proto.MapField:\n\t\tft := field.(*proto.MapField)\n\t\tname = ft.Field.Name\n\t\tsequence = ft.Field.Sequence\n\t\tcomment = ft.Comment\n\t\tkeyType := b.goType(ft.KeyType)\n\t\tfieldType := b.goType(ft.Field.Type)\n\t\ttyp = fmt.Sprintf(\"map[%s]%s\", keyType, fieldType)\n\tdefault:\n\t\treturn fmt.Errorf(\"unhandled message field type %T\", field)\n\t}\n\n\tif repeated {\n\t\ttyp = \"[]\" + typ\n\t}\n\n\t// TODO(vishen): Is this correct to explicitly camelcase the variable name and\n\t// snakecase the json name???\n\t// If we do, gunk should probably have an option to set the variable name\n\t// in the proto to something else? That way we can use best practises for\n\t// each language???\n\tb.format(w, 1, comment, \"%s %s\", snaker.ForceCamelIdentifier(name), typ)\n\tb.format(w, 0, nil, \" `pb:\\\"%d\\\" json:\\\"%s\\\"`\\n\", sequence, snaker.CamelToSnake(name))\n\treturn nil\n}", "func parseMessage(buff []byte,len int) []string {\n\tanalMsg := make([]string, 0)\n\tstrNow := \"\"\n\tfor i := 0; i < len; i++ {\n\t\tif string(buff[i:i + 1]) == \":\" {\n\t\t\tanalMsg = append(analMsg, strNow)\n\t\t\tstrNow = \"\"\n\t\t} else {\n\t\t\tstrNow += string(buff[i:i + 1])\n\t\t}\n\t}\n\tanalMsg = append(analMsg, strNow)\n\treturn analMsg\n}", "func (msg *Message) Parse(msgData []byte) (*ParsedMsg, error) {\n\n\tbuf := bytes.NewBuffer(msgData)\n\tparsedMsg := &ParsedMsg{Msg: msg, FieldDataMap: make(map[int]*FieldData, 64)}\n\tfor _, field := range msg.fields {\n\t\tif err := parse(buf, parsedMsg, field); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif buf.Len() > 0 {\n\t\tlog.Warningln(\"Unprocessed Data =\" + hex.EncodeToString(buf.Bytes()))\n\t\treturn nil, ErrUnreadDataRemaining\n\t}\n\n\treturn parsedMsg, nil\n\n}", "func parseMessageIdOnly(params []string) (string, *mpqerr.ErrorResponse) {\n\tif len(params) == 1 {\n\t\tif mpqproto.ValidateItemId(params[0]) {\n\t\t\treturn params[0], nil\n\t\t} else {\n\t\t\treturn \"\", mpqerr.ERR_ID_IS_WRONG\n\t\t}\n\t} else if len(params) == 0 {\n\t\treturn \"\", mpqerr.ERR_MSG_ID_NOT_DEFINED\n\t}\n\treturn \"\", mpqerr.ERR_ONE_ID_ONLY\n}", "func parseMessage(msg *slackevents.MessageEvent) Msg {\n\tvar parsed Msg\n\tvar ok bool\n\n\tparsed, ok = ParseHelpMsg(msg)\n\tif ok {\n\t\treturn parsed\n\t}\n\n\tparsed, ok = ParseGameStartMsg(msg)\n\tif ok {\n\t\treturn parsed\n\t}\n\n\tparsed, ok = ParseMoveMsg(msg)\n\tif ok {\n\t\treturn parsed\n\t}\n\n\tparsed, ok = ParseBoardMsg(msg)\n\tif ok {\n\t\treturn parsed\n\t}\n\n\treturn nil\n\n}", "func (bot *Bot) ParseRawMessage(rawMsg string) []Message {\n\tmessages := make([]Message, 0)\n\tmsgList := strings.Split(rawMsg, \"\\n\")\n\n\tvar room string\n\tfor _, msg := range msgList {\n\t\tif strings.HasPrefix(msg, \">\") {\n\t\t\t// a message of the form \">ROOMID\"\n\t\t\troom = strings.TrimPrefix(msg, \">\")\n\t\t\tcontinue\n\t\t}\n\n\t\tmessages = append(messages, NewMessage(room, msg))\n\t\tif strings.HasPrefix(msg, \"|init|\") {\n\t\t\t// we don't actually care about the rest of the messages in this\n\t\t\t// they're all messages from before the joining, so we don't want\n\t\t\t// to respond to them\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn messages\n}", "func (m *InvitedUserMessageInfo) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"ccRecipients\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetCollectionOfObjectValues(CreateRecipientFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n res := make([]Recipientable, len(val))\n for i, v := range val {\n if v != nil {\n res[i] = v.(Recipientable)\n }\n }\n m.SetCcRecipients(res)\n }\n return nil\n }\n res[\"customizedMessageBody\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetCustomizedMessageBody(val)\n }\n return nil\n }\n res[\"messageLanguage\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetMessageLanguage(val)\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n return res\n}", "func Parse(station string, message []byte) (*Message, error) {\n\tmsg := &Message{Station: station}\n\n\tparts := bytes.Split(message, []byte(\",\"))\n\tif len(parts) != 22 {\n\t\treturn nil, fmt.Errorf(\"message contains incorrect number of parts. expected=22, got=%d\", len(parts))\n\t}\n\n\tmsg.Type = parseType(parts[msgType])\n\tif msg.Type == Msg {\n\t\tval, err := strconv.ParseUint(string(parts[txType]), 10, 8)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"unable to parse TxType\")\n\t\t}\n\t\tmsg.TxType = uint8(val)\n\t}\n\n\tval, err := strconv.ParseUint(string(parts[icao]), 16, 32)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to parse ICAO number\")\n\t}\n\tmsg.Icao = uint(val)\n\n\td, err := parseDateTime(parts[dGen : tGen+1])\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to parse generated date\")\n\t}\n\tmsg.GenDate = d\n\td, err = parseDateTime(parts[dLog : tLog+1])\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to parse logged date\")\n\t}\n\tmsg.LogDate = d\n\n\tif msg.Type == Sel || msg.Type == Id {\n\t\tmsg.CallSign = string(parts[callSign])\n\t}\n\n\tif msg.Type != Msg {\n\t\treturn msg, nil\n\t}\n\n\tswitch msg.TxType {\n\tcase 1:\n\t\tmsg.CallSign = string(parts[callSign])\n\tcase 2:\n\t\terr = parseMsg2(msg, parts)\n\tcase 3:\n\t\terr = parseMsg3(msg, parts)\n\tcase 4:\n\t\terr = parseMsg4(msg, parts)\n\tcase 5:\n\t\terr = parseMsg5(msg, parts)\n\tcase 6:\n\t\terr = parseMsg6(msg, parts)\n\tcase 7:\n\t\terr = parseMsg7(msg, parts)\n\tcase 8:\n\t\terr = parseMsg8(msg, parts)\n\t}\n\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"unable to parse msg type: %d\", msg.TxType)\n\t}\n\n\treturn msg, nil\n}", "func buildMessageStruct(message string) interface{} {\n\tvar data map[string]interface{}\n\terr := json.Unmarshal([]byte(message), &data)\n\n\tif err == nil {\n\t\t// Save parsed json\n\t\tdata[\"datetime\"] = time.Now().UTC()\n\t\treturn data\n\t} else {\n\t\t// Could not parse json, save entire message.\n\t\treturn common.LogRecord{\n\t\t\tMessage: message,\n\t\t\tDatetime: time.Now().UTC(),\n\t\t}\n\t}\n}", "func (ef *EmbdFields) ParseFields(m AnyMessage) {\n\tef.ActionName = m.Action()\n}", "func (m idMap) extract(msg proto.Message) proto.Message {\n\tif msg.ProtoReflect().Descriptor().Name() == idFieldName {\n\t\treturn msg\n\t}\n\tref := msg.ProtoReflect()\n\tif fd := m[ref.Type()]; fd != nil && ref.Has(fd) {\n\t\treturn ref.Get(fd).Message().Interface()\n\t}\n\treturn nil\n}", "func messageFromEvent(event accounts.MessageEvent) *Message {\n\tp := getMessage(event.Post.MessageID)\n\tif p == nil {\n\t\tp = NewMessage(nil)\n\t}\n\n\tp.Forward = event.Forward\n\tp.Mention = event.Mention\n\tp.Like = event.Like\n\tp.Followed = event.Followed\n\tp.Reply = event.Reply\n\n\tif event.Post.MessageID != \"\" {\n\t\tp.MessageID = event.Post.MessageID\n\t\tp.PostID = event.Post.PostID\n\t\tp.PostURL = event.Post.URL\n\t\tp.Name = event.Post.AuthorName\n\t\tp.Author = event.Post.Author\n\t\tp.AuthorURL = event.Post.AuthorURL\n\t\tp.AuthorID = event.Post.AuthorID\n\t\tp.Avatar = event.Post.Avatar\n\t\tp.Body = strings.TrimSpace(event.Post.Body)\n\t\tp.Sensitive = event.Post.Sensitive\n\t\tp.Warning = event.Post.Warning\n\t\tp.CreatedAt = event.Post.CreatedAt\n\t\tp.ReplyToID = event.Post.ReplyToID\n\t\tp.ReplyToAuthor = event.Post.ReplyToAuthor\n\t\tp.Actor = event.Post.Actor\n\t\tp.ActorName = event.Post.ActorName\n\t\tp.ActorID = event.Post.ActorID\n\t\tp.Liked = event.Post.Liked\n\t\tp.Shared = event.Post.Shared\n\t\tp.RepliesCount = event.Post.RepliesCount\n\t\tp.SharesCount = event.Post.SharesCount\n\t\tp.LikesCount = event.Post.LikesCount\n\t\tp.Visibility = event.Post.Visibility\n\n\t\t// parse attachments\n\t\tp.MediaPreview = []string{}\n\t\tp.MediaURL = []string{}\n\t\tfor _, v := range event.Media {\n\t\t\tp.MediaPreview = append(p.MediaPreview, v.Preview)\n\t\t\tp.MediaURL = append(p.MediaURL, v.URL)\n\t\t}\n\n\t\tp.MentionIDs = []string{}\n\t\tp.MentionNames = []string{}\n\t\tfor _, v := range event.Post.Mentions {\n\t\t\tp.MentionIDs = append(p.MentionIDs, v.ID)\n\t\t\tp.MentionNames = append(p.MentionNames, v.Name)\n\t\t}\n\t}\n\n\tif event.Followed {\n\t\tp.MessageID = event.Follow.Account\n\t\tp.Actor = event.Follow.Account\n\t\tp.ActorName = event.Follow.Name\n\t\tp.Avatar = event.Follow.Avatar\n\t\tp.AuthorURL = event.Follow.ProfileURL\n\t\tp.AuthorID = event.Follow.ProfileID\n\t\tp.Following = event.Follow.Following\n\t\tp.FollowedBy = event.Follow.FollowedBy\n\t}\n\n\tif p.MessageID == \"\" {\n\t\tspw := &spew.ConfigState{Indent: \" \", DisableCapacities: true, DisablePointerAddresses: true}\n\t\tlog.Println(\"Invalid message received:\", spw.Sdump(event))\n\t}\n\treturn p\n}", "func (m *ChatMessageAttachment) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"content\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetContent(val)\n }\n return nil\n }\n res[\"contentType\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetContentType(val)\n }\n return nil\n }\n res[\"contentUrl\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetContentUrl(val)\n }\n return nil\n }\n res[\"id\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetId(val)\n }\n return nil\n }\n res[\"name\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetName(val)\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n res[\"teamsAppId\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetTeamsAppId(val)\n }\n return nil\n }\n res[\"thumbnailUrl\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetThumbnailUrl(val)\n }\n return nil\n }\n return res\n}", "func (m *ZmqMessage) unpack() {\n\tif len(m.fields) > 0 {\n\t\treturn\n\t}\n\tfields := make([]json.RawMessage, 0)\n\t_ = json.Unmarshal(m.body, &fields)\n\tfor _, v := range fields {\n\t\tm.fields = append(m.fields, string(bytes.Trim(v, \"\\\"\")))\n\t}\n}", "func ForgetAllFields(t *testing.T, originalMessage proto.Message) proto.Message {\n\tt.Helper()\n\n\temptyMessage := &pb2_latest.Empty{}\n\n\tbinaryMessage, err := proto.Marshal(originalMessage)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\terr = proto.Unmarshal(binaryMessage, emptyMessage)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\treturn emptyMessage\n}", "func retrieveMessageProperties(r *http.Request) (*MessageProperties, error) {\n\tcontents, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar msg chat.Message\n\terr = json.Unmarshal(contents, &msg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif msg.Space == nil {\n\t\treturn nil, errors.New(\"no space provided in request\")\n\t}\n\tvar thread string\n\tif msg.Thread != nil {\n\t\tthread = msg.Thread.Name\n\t}\n\treturn &MessageProperties{\n\t\tSpace: msg.Space.Name,\n\t\tThread: thread,\n\t}, nil\n}", "func parseMsgSpec(packageName, name string, data []byte) (*MsgSpec, error) {\n\tspec := new(MsgSpec)\n\tspec.Raw = string(data)\n\tmd5sum, err := exec.Command(\"rosmsg\", \"md5\", fmt.Sprintf(\"%s/%s\", packageName, name)).Output()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tspec.MD5Sum = strings.Trim(string(md5sum), \" \\n\")\n\tspec.PackageName = packageName\n\tspec.Name = name\n\n\tspec.packageMap = map[string]struct{}{uribase + \"/rosgo/ros\": struct{}{}}\n\n\t// Read the data line by line\n\tbuf := bytes.NewBuffer(data)\n\tscanner := bufio.NewScanner(buf)\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tline = strings.TrimSpace(line)\n\n\t\t// Check constant first\n\t\titems := constMatcher.FindStringSubmatch(line)\n\t\tif items != nil {\n\t\t\t//log.Println(\"constant\", line)\n\t\t\t//log.Printf(\"items(%d): %+v\", len(items), items)\n\t\t\t//for i := 0; i < len(items); i++ {\n\t\t\t//\tlog.Printf(\"items[%d]: %+v\", i, items[i])\n\t\t\t//}\n\t\t\t//items(4): [string HOGE=hoge string HOGE hoge]\n\t\t\t//items[0]: string HOGE=hoge\n\t\t\t//items[1]: string\n\t\t\t//items[2]: HOGE\n\t\t\t//items[3]: hoge\n\t\t\trosName := items[2]\n\t\t\trosType := items[1]\n\t\t\trosValue := items[3]\n\t\t\tconstant := newMsgConstant(spec.Name, rosName, rosType, rosValue)\n\t\t\t//log.Printf(\"constant: %+v\", constant)\n\t\t\tspec.Constants = append(spec.Constants, constant)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Now check field\n\t\titems = fieldMatcher.FindStringSubmatch(line)\n\t\tif items != nil {\n\t\t\t//log.Println(\"field\", line)\n\t\t\t//log.Printf(\"items(%d): %+v\", len(items), items)\n\t\t\t//for i := 0; i < len(items); i++ {\n\t\t\t//\tlog.Printf(\"items[%d]: %+v\", i, items[i])\n\t\t\t//}\n\t\t\t// Parse go options\n\t\t\tgoOptions := make(map[string]string)\n\t\t\tfor _, option := range goOptionMatcher.FindAllStringSubmatch(line, -1) {\n\t\t\t\tgoOptions[option[1]] = option[2]\n\t\t\t}\n\t\t\t//log.Println(\"goOptions\", goOptions)\n\t\t\t//items(5): [uint32[2] fix_ary uint32 [2] 2 fix_ary]\n\t\t\t//items[0]: uint32[2] fix_ary\n\t\t\t//items[1]: uint32\n\t\t\t//items[2]: [2]\n\t\t\t//items[3]: 2\n\t\t\t//items[4]: fix_ary\n\t\t\trosName := items[4]\n\t\t\trosType := items[1]\n\t\t\tisSliceOrArray := len(items[2]) > 0\n\t\t\tarraySize := items[3]\n\t\t\tfield := newMsgField(rosName, rosType, isSliceOrArray, arraySize)\n\t\t\tif field.BuiltIn {\n\t\t\t\tspec.HasBuiltIn = true\n\t\t\t}\n\t\t\tif field.IsArray {\n\t\t\t\tspec.HasSlice = true\n\t\t\t\tif field.ArraySize > 0 {\n\t\t\t\t\tspec.HasArray = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif field.GoImportName != \"\" && field.GoImportName != packageName {\n\t\t\t\tif pkg, ok := goOptions[\"package\"]; ok {\n\t\t\t\t\tspec.packageMap[pkg] = struct{}{}\n\t\t\t\t} else if pkg, ok := builtInImports[field.GoImportName]; ok {\n\t\t\t\t\tspec.packageMap[pkg] = struct{}{}\n\t\t\t\t} else {\n\t\t\t\t\tlog.Printf(\"WARNING: go import name not found in go:package option nor built-in imports: %s\", field.GoImportName)\n\t\t\t\t}\n\t\t\t}\n\t\t\t//log.Printf(\"field: %+v\", field)\n\t\t\tspec.Fields = append(spec.Fields, field)\n\t\t\tcontinue\n\t\t}\n\n\t\tif len(line) != 0 && !strings.HasPrefix(line, \"#\") {\n\t\t\treturn nil, fmt.Errorf(\"unrecognized msg line: %s\", line)\n\t\t}\n\t}\n\n\tif err := scanner.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn spec, nil\n}", "func extractFields(raw []byte) any {\n\tvar resp map[string]any\n\n\terr := json.Unmarshal(raw, &resp)\n\tif err != nil {\n\t\tvar arrResp []map[string]any\n\n\t\terr := json.Unmarshal(raw, &arrResp)\n\t\tif err != nil {\n\t\t\treturn string(raw)\n\t\t}\n\n\t\treturn arrResp\n\t}\n\n\treturn resp\n}", "func (m *Message) UnmarshalJSON(j []byte) error {\n\tvar rawStrings map[string]string\n\n\terr := json.Unmarshal(j, &rawStrings)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor k, v := range rawStrings {\n\t\tif strings.ToLower(k) == \"to\" {\n\t\t\tm.To = v\n\t\t}\n\t\tif strings.ToLower(k) == \"from\" {\n\t\t\tm.From = v\n\t\t}\n\t\tif strings.ToLower(k) == \"title\" {\n\t\t\tm.Title = v\n\t\t}\n\t\tif strings.ToLower(k) == \"content\" {\n\t\t\tm.Content = v\n\t\t}\n\t\t// properly parse Date field\n\t\tif strings.ToLower(k) == \"date\" {\n\t\t\tt, err := time.Parse(\"Jan 2, 2006 at 3:04pm (MST)\", v)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tm.Date = t\n\t\t}\n\t}\n\treturn nil\n}", "func (m *Message) parse(mb *Mailbox) {\n\twe, e := mb.wd.FindElement(selenium.ByTagName, \"body\")\n\tif e != nil {\n\t\tpanic(e)\n\t}\n\n\tvar w selenium.WebElement\n\n\tw, e = we.FindElement(selenium.ByXPATH, \"(.//div[@id='mailhaut']/div)[1]\")\n\tif e != nil {\n\t\tlog.Print(e)\n\t} else {\n\t\tm.topic, _ = w.Text()\n\t}\n\n\tw, _ = we.FindElement(selenium.ByXPATH, \"(.//div[@id='mailhaut']/div)[2]\")\n\tif e != nil {\n\t\tlog.Print(e)\n\t} else {\n\t\ttt, _ := w.Text()\n\t\tm.from = strings.Split(tt, \"From: \")[1]\n\t}\n\n\tw, _ = we.FindElement(selenium.ByXPATH, \"(.//div[@id='mailhaut']/div)[4]\")\n\tif e != nil {\n\t\tlog.Print(e)\n\t} else {\n\t\ttt, _ := w.Text()\n\t\tm.received, _ = time.Parse(YopTimeFormat, tt)\n\t}\n\n\tw, _ = we.FindElement(selenium.ByXPATH, \".//div[@id='mailmillieu']\")\n\tif e != nil {\n\t\tlog.Print(e)\n\t} else {\n\t\tm.content, _ = w.Text()\n\t\tm.htmlContent, _ = w.GetAttribute(\"innerHTML\")\n\t}\n}", "func getStand(handler *handler) *fcm.Message {\n\tvar msg fcm.Message\n\t//remove type first\n\tvar b *bytes.Buffer\n\tif handler.types == FromTypeJson {\n\t\tb, _ = interfaceToByteArray(handler.raw)\n\t} else {\n\t\tb, _ = interfaceToByteArray(handler.from)\n\t}\n\tjson.Unmarshal(b.Bytes(), msg)\n\treturn &msg\n}", "func parseLinkMessage(from i2p.I2PAddr, payload []byte) (msg *linkMessage, err error) {\n m := new(linkMessage)\n buff := bytes.NewBuffer(payload)\n err = m.Frame.Decode(buff)\n if err == nil {\n msg = m\n msg.Addr = from\n }\n buff.Reset()\n return\n}", "func (Message) Fields() []ent.Field {\n\treturn []ent.Field{\n\t\tfield.String(\"uid\").\n\t\t\tMaxLen(26).\n\t\t\tNotEmpty().\n\t\t\tUnique().\n\t\t\tImmutable(),\n\t\tfield.Text(\"text\"),\n\t\tfield.Time(\"created_at\").\n\t\t\tDefault(time.Now),\n\t\tfield.Time(\"updated_at\").\n\t\t\tDefault(time.Now).\n\t\t\tUpdateDefault(time.Now),\n\t}\n}", "func (u *UpdateShortChatMessage) FillFrom(from interface {\n\tGetOut() (value bool)\n\tGetMentioned() (value bool)\n\tGetMediaUnread() (value bool)\n\tGetSilent() (value bool)\n\tGetID() (value int)\n\tGetFromID() (value int64)\n\tGetChatID() (value int64)\n\tGetMessage() (value string)\n\tGetPts() (value int)\n\tGetPtsCount() (value int)\n\tGetDate() (value int)\n\tGetFwdFrom() (value MessageFwdHeader, ok bool)\n\tGetViaBotID() (value int64, ok bool)\n\tGetReplyTo() (value MessageReplyHeaderClass, ok bool)\n\tGetEntities() (value []MessageEntityClass, ok bool)\n\tGetTTLPeriod() (value int, ok bool)\n}) {\n\tu.Out = from.GetOut()\n\tu.Mentioned = from.GetMentioned()\n\tu.MediaUnread = from.GetMediaUnread()\n\tu.Silent = from.GetSilent()\n\tu.ID = from.GetID()\n\tu.FromID = from.GetFromID()\n\tu.ChatID = from.GetChatID()\n\tu.Message = from.GetMessage()\n\tu.Pts = from.GetPts()\n\tu.PtsCount = from.GetPtsCount()\n\tu.Date = from.GetDate()\n\tif val, ok := from.GetFwdFrom(); ok {\n\t\tu.FwdFrom = val\n\t}\n\n\tif val, ok := from.GetViaBotID(); ok {\n\t\tu.ViaBotID = val\n\t}\n\n\tif val, ok := from.GetReplyTo(); ok {\n\t\tu.ReplyTo = val\n\t}\n\n\tif val, ok := from.GetEntities(); ok {\n\t\tu.Entities = val\n\t}\n\n\tif val, ok := from.GetTTLPeriod(); ok {\n\t\tu.TTLPeriod = val\n\t}\n\n}", "func (m *ChatMessage) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := m.Entity.GetFieldDeserializers()\n res[\"attachments\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreateChatMessageAttachmentFromDiscriminatorValue , m.SetAttachments)\n res[\"body\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetObjectValue(CreateItemBodyFromDiscriminatorValue , m.SetBody)\n res[\"channelIdentity\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetObjectValue(CreateChannelIdentityFromDiscriminatorValue , m.SetChannelIdentity)\n res[\"chatId\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetStringValue(m.SetChatId)\n res[\"createdDateTime\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetTimeValue(m.SetCreatedDateTime)\n res[\"deletedDateTime\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetTimeValue(m.SetDeletedDateTime)\n res[\"etag\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetStringValue(m.SetEtag)\n res[\"eventDetail\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetObjectValue(CreateEventMessageDetailFromDiscriminatorValue , m.SetEventDetail)\n res[\"from\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetObjectValue(CreateChatMessageFromIdentitySetFromDiscriminatorValue , m.SetFrom)\n res[\"hostedContents\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreateChatMessageHostedContentFromDiscriminatorValue , m.SetHostedContents)\n res[\"importance\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetEnumValue(ParseChatMessageImportance , m.SetImportance)\n res[\"lastEditedDateTime\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetTimeValue(m.SetLastEditedDateTime)\n res[\"lastModifiedDateTime\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetTimeValue(m.SetLastModifiedDateTime)\n res[\"locale\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetStringValue(m.SetLocale)\n res[\"mentions\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreateChatMessageMentionFromDiscriminatorValue , m.SetMentions)\n res[\"messageType\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetEnumValue(ParseChatMessageType , m.SetMessageType)\n res[\"policyViolation\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetObjectValue(CreateChatMessagePolicyViolationFromDiscriminatorValue , m.SetPolicyViolation)\n res[\"reactions\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreateChatMessageReactionFromDiscriminatorValue , m.SetReactions)\n res[\"replies\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetCollectionOfObjectValues(CreateChatMessageFromDiscriminatorValue , m.SetReplies)\n res[\"replyToId\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetStringValue(m.SetReplyToId)\n res[\"subject\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetStringValue(m.SetSubject)\n res[\"summary\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetStringValue(m.SetSummary)\n res[\"webUrl\"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetStringValue(m.SetWebUrl)\n return res\n}", "func loadmessage(mesg string) IP2Locationrecord {\n\tvar x IP2Locationrecord\n\n\tx.Country_short = mesg\n\tx.Country_long = mesg\n\tx.Region = mesg\n\tx.City = mesg\n\tx.Isp = mesg\n\tx.Domain = mesg\n\tx.Zipcode = mesg\n\tx.Timezone = mesg\n\tx.Netspeed = mesg\n\tx.Iddcode = mesg\n\tx.Areacode = mesg\n\tx.Weatherstationcode = mesg\n\tx.Weatherstationname = mesg\n\tx.Mcc = mesg\n\tx.Mnc = mesg\n\tx.Mobilebrand = mesg\n\tx.Usagetype = mesg\n\tx.Addresstype = mesg\n\tx.Category = mesg\n\tx.District = mesg\n\tx.Asn = mesg\n\tx.As = mesg\n\n\treturn x\n}", "func (s MessageState) MessageParts() []string {\n\treturn strings.Split(s.Event.Message.Content, \" \")\n}", "func toMessage(m *pubsub.Message) (models.Message, error) {\n\tmessage := models.NewMessage()\n\n\tvar event chat.DeprecatedEvent\n\n\terr := json.Unmarshal(m.Data, &event)\n\tif err != nil {\n\t\treturn message, fmt.Errorf(\"google_chat was unable to parse event %s: %w\", m.ID, err)\n\t}\n\n\tmsgType, err := getMessageType(event)\n\tif err != nil {\n\t\treturn message, err\n\t}\n\n\tmessage.Type = msgType\n\tmessage.Timestamp = event.EventTime\n\n\tif event.Type == \"MESSAGE\" {\n\t\tmessage.Input = strings.TrimPrefix(event.Message.ArgumentText, \" \")\n\t\tmessage.ID = event.Message.Name\n\t\tmessage.Service = models.MsgServiceChat\n\t\tmessage.ChannelName = event.Space.DisplayName\n\t\tmessage.ChannelID = event.Space.Name\n\t\tmessage.BotMentioned = true // Google Chat only supports @bot mentions\n\t\tmessage.DirectMessageOnly = event.Space.SingleUserBotDm\n\n\t\tif event.Space.Threaded {\n\t\t\tmessage.ThreadID = event.Message.Thread.Name\n\t\t\tmessage.ThreadTimestamp = event.EventTime\n\t\t}\n\n\t\t// make channel variables available\n\t\tmessage.Vars[\"_channel.name\"] = message.ChannelName // will be empty if it came via DM\n\t\tmessage.Vars[\"_channel.id\"] = message.ChannelID\n\t\tmessage.Vars[\"_thread.id\"] = message.ThreadID\n\n\t\t// make timestamp information available\n\t\tmessage.Vars[\"_source.timestamp\"] = event.EventTime\n\t}\n\n\tif event.User != nil {\n\t\tmessage.Vars[\"_user.name\"] = event.User.DisplayName\n\t\tmessage.Vars[\"_user.id\"] = event.User.Name\n\t\tmessage.Vars[\"_user.displayname\"] = event.User.DisplayName\n\n\t\t// Try parsing as a domain message to get user email\n\t\tvar domainEvent DomainEvent\n\t\tif err := json.Unmarshal(m.Data, &domainEvent); err == nil {\n\t\t\tmessage.Vars[\"_user.id\"] = domainEvent.User.Email\n\t\t}\n\t}\n\n\treturn message, nil\n}", "func Decode(msg string) MessageTemp {\n var r = make([]string,15)\n r = strings.Split(msg, \";\")\n var result = MessageTemp{}\n for _,v := range r {\n key_value := strings.Split(v,\"=\")\n switch key_value[0] {\n case \"35\":\n if key_value[1]==\"8\"{ // 35=8; 股票交易相关信息\n result.order_type = \"trade\"\n } else if key_value[1]==\"9\"{ // 35=9; 用户相关信息\n result.order_type = \"user\"\n } else if key_value[1]==\"10\"{ //35=10; 查询order book\n result.order_type = \"view\"\n }\n case \"44\":\n result.price, _ = strconv.Atoi(key_value[1])\n case \"11\":\n result.stock_id, _ = strconv.Atoi(key_value[1])\n case \"38\":\n result.quantity, _ = strconv.Atoi(key_value[1])\n case \"54\":\n if key_value[1]==\"1\"{\n result.trade_type = \"buy\"\n } else if key_value[1]==\"2\"{\n result.trade_type = \"sell\"\n }\n case \"5001\":\n result.username = key_value[1]\n case \"5002\":\n result.password = key_value[1]\n }\n }\n //fmt.Println(result)\n return result\n}", "func Parse(self *slack.UserDetails, ev *slack.MessageEvent, rtm *slack.RTM, api *slack.Client, db *SQLite) {\n\tvar evText string\n\tvar evUser string\n\tlog.Debug(ev)\n\tif ev.Msg.Text != \"\" {\n\t\tevText = ev.Msg.Text\n\t\tevUser = ev.Msg.User\n\t} else if ev.Msg.DeletedTimestamp == \"\" && ev.Msg.Attachments == nil { //not a delete event\n\t\t// get thread tex\n\t\tevText = ev.SubMessage.Text\n\t\tevUser = ev.SubMessage.User\n\t}\n\tif strings.EqualFold(evText, \"!addme\") {\n\t\tlog.Debug()\n\t\tdb.InsertUser(evUser)\n\t} else if strings.EqualFold(evText, \"!score\") {\n\t\tscore := db.GetKudos(evUser)\n\t\tuserInfo, err := api.GetUserInfo(evUser)\n\t\tif err != nil {\n\t\t\tlog.Error(\"could not get user data for %s\", evUser)\n\t\t}\n\t\toutput := fmt.Sprintf(\"%s, you have %d kudos\", userInfo.Profile.RealName, score)\n\t\trtm.SendMessage(rtm.NewOutgoingMessage(output, ev.Msg.Channel))\n\t} else if strings.EqualFold(evText, \"!vote\") {\n\t\tlog.Info(\"vote!\")\n\t}\n\t// rtm.SendMessage(rtm.NewOutgoingMessage(\"hello\", ev.Msg.Channel))\n}", "func(this *UdpServer) parse(buf []byte , to int) (*model.Message, error){\n\tfmt.Print(\"Server: Message arrived,\")\n\tfmt.Println(\" content: \"+string(buf[0:to]))\n\tmsg := model.Message{}\n\terr := json.Unmarshal(buf[0:to],&msg) // DECODE THE MESSAGE\n\tif(err != nil){ // IN CASE OF ERROR, SEND BACK AN ERROR MESSAGE\n\t\treturn model.NewMessage(0,SERVER_ADDR, \"\", util.ERROR, util.RESPONSE,err), err // TODO reduce to 1 line\n\t}\n\tswitch msg.Header { // VERIFY THE MESSAGE HEADER\n\t\tcase util.REQUEST: // IN CASE OF A REQUEST FROM TYPE\n\t\t\tswitch msg.Type {\n\t\t\t\tcase util.GROUP:// GROUP\n\t\t\t\t\tgroup := this.groups[strconv.Itoa(this.next_group)] // GET THE REQUESTED GROUP`S POINTER\n\t\t\t\t\tif len(group.Peers) < 4{ // (DEFINES A LIMIT TO THE GROUP SIZE)\n\t\t\t\t\t\tmListener := model.NewMulticastListener(len(group.Peers)+1, group.Address)\n\t\t\t\t\t\tpeer := model.NewPeer(msg.SenderAddr, mListener) // PARSE THE PEER RECEIVED FROM THE MESSAGE, RESETTING NETWORK SETTINGS\n\t\t\t\t\t\tif group.Leader.HostAddr == \"\" && len(group.Peers) == 0 { // IF THE CURRENT GROUP HAS NO ACTIVE LEADER\n\t\t\t\t\t\t\tgroup.Leader = *peer // MAKE THE PEER THE GROUP LEADER\n\t\t\t\t\t\t}\n\t\t\t\t\t\tgroup.Peers[peer.HostAddr] = peer // THEN REGISTER THE PEER IN THE GROUP\n\t\t\t\t\t\t//this.next_group += 1 // todo review (next user will be conected to the next available group with this line)\n\t\t\t\t\t\tfmt.Println(\"Server: Client group request received, retrieving...\")\n\t\t\t\t\t\treturn model.NewMessage(0, SERVER_ADDR, peer.HostAddr, util.RESPONSE, util.GROUP, *group), nil // RETURNS THE GROUP TO THE USER\n\t\t\t\t\t}\n\t\t\t\t\treturn model.NewMessage(0, SERVER_ADDR, msg.SenderAddr, util.RESPONSE, util.ERROR, nil), nil // RETURNS AN ERROR (FULL GROUP)\n\t\t\t}\n\t}\n\treturn model.NewMessage(0,SERVER_ADDR, msg.SenderAddr , util.ERROR, util.RESPONSE,err), err\n}", "func IdentifierFromMsg(msg chat1.MsgSummary) string {\n\tswitch msg.Channel.MembersType {\n\tcase \"team\":\n\t\treturn msg.Channel.Name\n\tdefault:\n\t\treturn msg.Sender.Username\n\t}\n}", "func UnmarshalMessage(data string) *Message {\n\trv := &Message{}\n\n\tfor i, part := range strings.Split(data, \" \") {\n\t\t// Prefix\n\t\tif i == 0 && strings.Index(part, \":\") == 0 {\n\t\t\trv.Prefix = part[1:]\n\t\t\tcontinue\n\t\t}\n\t\t// Command\n\t\tif rv.Command == \"\" {\n\t\t\trv.Command = part\n\t\t\tcontinue\n\t\t}\n\t\t// Parameter\n\t\trv.Params = append(rv.Params, part)\n\t}\n\n\t// If a parameter starts with a colon is considered to be the last\n\t// parameter and may contain spaces\n\tfor i, param := range rv.Params {\n\t\tif strings.Index(param, \":\") == 0 {\n\t\t\t// Create a list with params before the one containing a colon\n\t\t\tparams := rv.Params[:i]\n\t\t\t// Join the remaining parameters, remove the first character\n\t\t\tparams = append(params, strings.Join(rv.Params[i:], \" \")[1:])\n\t\t\trv.Params = params\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn rv\n}", "func ParseMessageOnWire(bytes []byte) (*Message, error) {\n\tmsg := &Message{Payload: new(json.RawMessage), Raw: true}\n\terr := json.Unmarshal(bytes[MsgHeadLen:], &msg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"message error - fail to unmarshal bytes to message, error: %v\\n%v\", err, string(bytes))\n\t}\n\treturn msg, msg.substantiatePayload()\n}", "func parsePresence(value string) (username, sessionID string, timestamp time.Time, err error) {\n\tparts := strings.Split(value, \"\\n\")\n\tif len(parts) < 3 {\n\t\terr = fmt.Errorf(\"invalid presence/here message: %s\", value)\n\t\treturn\n\t}\n\tusername = parts[0]\n\tif username == \"\" {\n\t\terr = fmt.Errorf(\"Username cannot be the empty string\")\n\t\treturn\n\t}\n\tsessionID = parts[1]\n\tif sessionID == \"\" {\n\t\terr = fmt.Errorf(\"SessionID cannot be the empty string\")\n\t\treturn\n\t}\n\ttimeString := parts[2]\n\ttimeInt, err := strconv.Atoi(timeString)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Error decoding timestamp in presence/here message: %s\", value)\n\t\treturn\n\t}\n\ttimestamp = time.Unix(int64(timeInt), 0)\n\treturn\n}", "func Parse(r io.Reader) (\n\theader *Header,\n\tsubject string,\n\tmessage string,\n\tattachments []*Attachment,\n\terr error,\n) {\n\tvar h Header\n\t// read message\n\tmsg, err := mail.ReadMessage(r)\n\tif err != nil {\n\t\treturn nil, \"\", \"\", nil, log.Error(err)\n\t}\n\t// parse 'From'\n\th.From = msg.Header.Get(\"From\")\n\tif h.From == \"\" {\n\t\treturn nil, \"\", \"\", nil, log.Error(\"mime: 'From' not defined\")\n\t}\n\t// parse 'To'\n\th.To = msg.Header.Get(\"To\")\n\tif h.To == \"\" {\n\t\treturn nil, \"\", \"\", nil, log.Error(\"mime: 'To' not defined\")\n\t}\n\t// parse 'Cc'\n\taddressList, err := msg.Header.AddressList(\"Cc\")\n\tif err != nil && err != mail.ErrHeaderNotPresent {\n\t\treturn nil, \"\", \"\", nil, log.Error(err)\n\t}\n\tif err != mail.ErrHeaderNotPresent {\n\t\tfor _, address := range addressList {\n\t\t\th.Cc = append(h.Cc, address.Address)\n\t\t}\n\t}\n\t// parse subject\n\tsubj := msg.Header.Get(\"Subject\")\n\tif subj == \"\" {\n\t\treturn nil, \"\", \"\", nil, log.Error(\"mime: 'Subject' not defined\")\n\t}\n\tdec := new(mime.WordDecoder)\n\tsubject, err = dec.DecodeHeader(subj)\n\tif err != nil {\n\t\treturn nil, \"\", \"\", nil, log.Error(err)\n\t}\n\t// parse 'Message-ID'\n\th.MessageID = msg.Header.Get(\"Message-ID\")\n\tif h.MessageID == \"\" {\n\t\treturn nil, \"\", \"\", nil, log.Error(\"mime: 'Message-ID' not defined\")\n\t}\n\t// parse 'In-Reply-To'\n\th.InReplyTo = msg.Header.Get(\"In-Reply-To\")\n\t// parse 'MIME-Version'\n\tif msg.Header.Get(\"MIME-Version\") != \"1.0\" {\n\t\treturn nil, \"\", \"\", nil, log.Error(\"mime: wrong 'MIME-Version' header\")\n\t}\n\t// parse 'Content-Type'\n\tmediaType, params, err := mime.ParseMediaType(msg.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\treturn nil, \"\", \"\", nil, log.Error(err)\n\t} else if mediaType != \"multipart/mixed\" {\n\t\treturn nil, \"\", \"\", nil, log.Error(\"mime: wrong 'Content-Type' header \")\n\t}\n\t// read first MIME part (message)\n\tmr := multipart.NewReader(msg.Body, params[\"boundary\"])\n\tp, err := mr.NextPart()\n\tif err != nil {\n\t\treturn nil, \"\", \"\", nil, log.Error(err)\n\t}\n\t// check 'Content-Type'\n\tif p.Header.Get(\"Content-Type\") != \"text/plain\" {\n\t\treturn nil, \"\", \"\", nil,\n\t\t\tlog.Error(\"mime: expected 'text/plain' Content-Type\")\n\t}\n\t// check 'Content-Transfer-Encoding'\n\tif p.Header.Get(\"Content-Transfer-Encoding\") != \"base64\" {\n\t\treturn nil, \"\", \"\", nil,\n\t\t\tlog.Error(\"mime: expected 'base64' Content-Transfer-Encoding\")\n\t}\n\t// read message\n\tenc, err := ioutil.ReadAll(p)\n\tif err != nil {\n\t\treturn nil, \"\", \"\", nil, log.Error(err)\n\t}\n\tcontent, err := base64.Decode(string(enc))\n\tif err != nil {\n\t\treturn nil, \"\", \"\", nil, log.Error(err)\n\t}\n\tmessage = string(content)\n\t// read optional additional MIME parts (attachments)\n\tfor {\n\t\tp, err := mr.NextPart()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\t// parse header\n\t\tcontentType := p.Header.Get(\"Content-Type\")\n\t\tif contentType == \"\" {\n\t\t\treturn nil, \"\", \"\", nil,\n\t\t\t\tlog.Error(\"mime: Content-Type undefined for attachment\")\n\t\t}\n\t\tvar filename string\n\t\tvar inline bool\n\t\tfor _, disposition := range p.Header[\"Content-Disposition\"] {\n\t\t\tmediaType, params, err := mime.ParseMediaType(disposition)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, \"\", \"\", nil, log.Error(err)\n\t\t\t}\n\t\t\tswitch mediaType {\n\t\t\tcase \"attachment\":\n\t\t\t\tfilename = params[\"filename\"]\n\t\t\tcase \"inline\":\n\t\t\t\tinline = true\n\t\t\tdefault:\n\t\t\t\treturn nil, \"\", \"\", nil,\n\t\t\t\t\tlog.Errorf(\"mime: unknown Content-Disposition in attachment: %s\",\n\t\t\t\t\t\tmediaType)\n\t\t\t}\n\t\t}\n\t\tif filename == \"\" {\n\t\t\tlog.Error(\"mime: filename undefined for attachment\")\n\t\t}\n\n\t\t// parse body\n\t\tif err != nil {\n\t\t\treturn nil, \"\", \"\", nil, log.Error(err)\n\t\t}\n\t\tenc, err := ioutil.ReadAll(p)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", \"\", nil, log.Error(err)\n\t\t}\n\t\tcontent, err := base64.Decode(string(enc))\n\t\tif err != nil {\n\t\t\treturn nil, \"\", \"\", nil, log.Error(err)\n\t\t}\n\t\t// reconstruct attachment\n\t\tattachment := &Attachment{\n\t\t\tFilename: filename,\n\t\t\tReader: bytes.NewBuffer(content),\n\t\t\tContentType: contentType,\n\t\t\tInline: inline,\n\t\t}\n\t\tattachments = append(attachments, attachment)\n\t}\n\n\theader = &h\n\treturn\n}", "func init() {\n\tmessageMixin := schema.Message{}.Mixin()\n\tmessageMixinFields0 := messageMixin[0].Fields()\n\t_ = messageMixinFields0\n\tmessageFields := schema.Message{}.Fields()\n\t_ = messageFields\n\t// messageDescCreated is the schema descriptor for created field.\n\tmessageDescCreated := messageMixinFields0[0].Descriptor()\n\t// message.DefaultCreated holds the default value on creation for the created field.\n\tmessage.DefaultCreated = messageDescCreated.Default.(time.Time)\n\t// messageDescUpdated is the schema descriptor for updated field.\n\tmessageDescUpdated := messageMixinFields0[1].Descriptor()\n\t// message.DefaultUpdated holds the default value on creation for the updated field.\n\tmessage.DefaultUpdated = messageDescUpdated.Default.(time.Time)\n\t// message.UpdateDefaultUpdated holds the default value on update for the updated field.\n\tmessage.UpdateDefaultUpdated = messageDescUpdated.UpdateDefault.(func() time.Time)\n\t// messageDescSessionKey is the schema descriptor for sessionKey field.\n\tmessageDescSessionKey := messageFields[1].Descriptor()\n\t// message.SessionKeyValidator is a validator for the \"sessionKey\" field. It is called by the builders before save.\n\tmessage.SessionKeyValidator = messageDescSessionKey.Validators[0].(func(string) error)\n\t// messageDescTo is the schema descriptor for to field.\n\tmessageDescTo := messageFields[3].Descriptor()\n\t// message.ToValidator is a validator for the \"to\" field. It is called by the builders before save.\n\tmessage.ToValidator = messageDescTo.Validators[0].(func(string) error)\n\t// messageDescClientMsgID is the schema descriptor for client_msg_id field.\n\tmessageDescClientMsgID := messageFields[5].Descriptor()\n\t// message.ClientMsgIDValidator is a validator for the \"client_msg_id\" field. It is called by the builders before save.\n\tmessage.ClientMsgIDValidator = messageDescClientMsgID.Validators[0].(func(string) error)\n\t// messageDescMsgData is the schema descriptor for msg_data field.\n\tmessageDescMsgData := messageFields[8].Descriptor()\n\t// message.MsgDataValidator is a validator for the \"msg_data\" field. It is called by the builders before save.\n\tmessage.MsgDataValidator = messageDescMsgData.Validators[0].(func(string) error)\n\tsessionMixin := schema.Session{}.Mixin()\n\tsessionMixinFields0 := sessionMixin[0].Fields()\n\t_ = sessionMixinFields0\n\tsessionFields := schema.Session{}.Fields()\n\t_ = sessionFields\n\t// sessionDescCreated is the schema descriptor for created field.\n\tsessionDescCreated := sessionMixinFields0[0].Descriptor()\n\t// session.DefaultCreated holds the default value on creation for the created field.\n\tsession.DefaultCreated = sessionDescCreated.Default.(time.Time)\n\t// sessionDescUpdated is the schema descriptor for updated field.\n\tsessionDescUpdated := sessionMixinFields0[1].Descriptor()\n\t// session.DefaultUpdated holds the default value on creation for the updated field.\n\tsession.DefaultUpdated = sessionDescUpdated.Default.(time.Time)\n\t// session.UpdateDefaultUpdated holds the default value on update for the updated field.\n\tsession.UpdateDefaultUpdated = sessionDescUpdated.UpdateDefault.(func() time.Time)\n\t// sessionDescUserID is the schema descriptor for user_id field.\n\tsessionDescUserID := sessionFields[1].Descriptor()\n\t// session.UserIDValidator is a validator for the \"user_id\" field. It is called by the builders before save.\n\tsession.UserIDValidator = sessionDescUserID.Validators[0].(func(string) error)\n\t// sessionDescPeerID is the schema descriptor for peer_id field.\n\tsessionDescPeerID := sessionFields[2].Descriptor()\n\t// session.PeerIDValidator is a validator for the \"peer_id\" field. It is called by the builders before save.\n\tsession.PeerIDValidator = sessionDescPeerID.Validators[0].(func(string) error)\n}", "func (c *Common) HandleReceivedMessage(message messages.Messager) {\n\n switch message.(type) {\n case *messages.LocationMessage:\n c.rp.HandleLocationMessage(message.(*messages.LocationMessage))\n case *messages.MotorSpeedMessage:\n c.rp.HandleMotorSpeedMessage(message.(*messages.MotorSpeedMessage))\n }\n\n}", "func (m *Module) processMessage(msg pgs.Message, nameWithAlias func(n pgs.Entity) string, wantFields ...bool) *MessageData {\n\tmsgData := &MessageData{\n\t\tName: m.ctx.Name(msg).String(),\n\t\tWithAlias: nameWithAlias(msg),\n\t\tFields: make([]*FieldData, 0, len(msg.Fields())*2),\n\t}\n\n\t// check message ignore options\n\tmsgData.Ignore = false\n\tm.must(msg.Extension(redact.E_Ignored, &msgData.Ignore))\n\tif msgData.Ignore {\n\t\treturn msgData\n\t}\n\n\t// check message nil options\n\tmsgData.ToNil = false\n\tm.must(msg.Extension(redact.E_Nil, &msgData.ToNil))\n\n\t// check message empty options\n\tmsgData.ToEmpty = false\n\tm.must(msg.Extension(redact.E_Empty, &msgData.ToEmpty))\n\n\tif len(wantFields) > 0 {\n\t\tfor _, field := range msg.Fields() {\n\t\t\tmsgData.Fields = append(msgData.Fields, m.processFields(field, nameWithAlias))\n\t\t}\n\t}\n\treturn msgData\n}", "func ParseRoomPayload(payload []byte, ver version.Version) (*cont.Room, error) {\n\tswitch ver {\n\tcase version.One:\n\t\treturn versionOnePayloadParser(payload)\n\tcase version.Two:\n\t\treturn versionTwoPayloadParser(payload)\n\tdefault:\n\t\treturn nil, errors.New(\"unknown version requested to parse\")\n\t}\n}", "func GetMessageHeaders(id, dirPath string) (map[string]string, error){\n dirPath = strings.TrimPrefix(dirPath, \"\\\"\")\n dirPath = strings.TrimRight(dirPath, \"\\\";\")\n fileHandler, err := os.Open(dirPath+\"/\"+id)\n defer fileHandler.Close()\n result := map[string]string{}\n if err == nil {\n reader := bufio.NewReader(fileHandler)\n tr := textproto.NewReader(reader)\n parse, _ := tr.ReadMIMEHeader()\n result[\"from\"] = parse[\"From\"][0]\n result[\"to\"] = parse[\"To\"][0]\n result[\"subject\"] = parse[\"Subject\"][0] \n }\n return result, err\n}", "func parseMessage(m *mail.Message) (githubEventID, error) {\n\tmessageID := trimAngle(m.Header.Get(\"Message-ID\"))\n\tif orig := m.Header.Get(\"X-Google-Original-Message-ID\"); orig != \"\" {\n\t\tmessageID = trimAngle(orig)\n\t}\n\tif !strings.HasSuffix(messageID, \"@github.com\") {\n\t\treturn githubEventID{}, fmt.Errorf(\"no @github.com suffix in messageID %q\", messageID)\n\t}\n\tparts := strings.Split(messageID[:len(messageID)-len(\"@github.com\")], \"/\") // TODO: no allocs\n\tswitch {\n\tcase len(parts) == 4 && parts[2] == \"issues\":\n\t\t// An issue.\n\t\tissueID, err := strconv.ParseUint(parts[3], 10, 64)\n\t\tif err != nil {\n\t\t\treturn githubEventID{}, err\n\t\t}\n\t\treturn githubEventID{Owner: parts[0], Repo: parts[1], IssueID: issueID}, nil\n\tcase len(parts) == 6 && parts[2] == \"issue\" && parts[4] == \"issue_event\":\n\t\t// An issue event.\n\t\teventID, err := strconv.ParseUint(parts[5], 10, 64)\n\t\tif err != nil {\n\t\t\treturn githubEventID{}, err\n\t\t}\n\t\tplain, err := parseTextPlain(m)\n\t\tif err != nil {\n\t\t\treturn githubEventID{}, err\n\t\t}\n\t\tswitch {\n\t\tcase strings.HasPrefix(plain, \"Closed \"):\n\t\t\treturn githubEventID{ClosedEventID: eventID}, nil\n\t\tcase strings.HasPrefix(plain, \"Reopened \"):\n\t\t\treturn githubEventID{ReopenedEventID: eventID}, nil\n\t\tcase strings.HasPrefix(plain, \"Assigned \"):\n\t\t\t// TODO: consider handling it, etc.\n\t\t\treturn githubEventID{}, nil\n\t\tdefault:\n\t\t\treturn githubEventID{}, fmt.Errorf(\"unknown event type in %q\", plain)\n\t\t}\n\tcase len(parts) == 5 && parts[2] == \"issues\":\n\t\t// An issue comment.\n\t\tissueCommentID, err := strconv.ParseUint(parts[4], 10, 64)\n\t\tif err != nil {\n\t\t\treturn githubEventID{}, err\n\t\t}\n\t\treturn githubEventID{IssueCommentID: issueCommentID}, nil\n\n\tcase len(parts) == 4 && parts[2] == \"pull\":\n\t\t// A pull request.\n\t\tprID, err := strconv.ParseUint(parts[3], 10, 64)\n\t\tif err != nil {\n\t\t\treturn githubEventID{}, err\n\t\t}\n\t\treturn githubEventID{Owner: parts[0], Repo: parts[1], PullRequestID: prID}, nil\n\tcase len(parts) == 5 && parts[2] == \"pull\" && strings.HasPrefix(parts[4], \"c\"):\n\t\t// A pull request comment.\n\t\tprCommentID, err := strconv.ParseUint(parts[4][len(\"c\"):], 10, 64)\n\t\tif err != nil {\n\t\t\treturn githubEventID{}, err\n\t\t}\n\t\treturn githubEventID{PRCommentID: prCommentID}, nil\n\tcase len(parts) == 6 && parts[2] == \"pull\" && parts[4] == \"review\":\n\t\t// A pull request review.\n\t\tprReviewID, err := strconv.ParseUint(parts[5], 10, 64)\n\t\tif err != nil {\n\t\t\treturn githubEventID{}, err\n\t\t}\n\t\t// TODO: parse text to determine whatever needs to be determined?\n\t\treturn githubEventID{PRReviewID: prReviewID}, nil\n\tcase len(parts) == 6 && parts[2] == \"pull\" && parts[4] == \"issue_event\":\n\t\t// A pull request event.\n\t\teventID, err := strconv.ParseUint(parts[5], 10, 64)\n\t\tif err != nil {\n\t\t\treturn githubEventID{}, err\n\t\t}\n\t\tplain, err := parseTextPlain(m)\n\t\tif err != nil {\n\t\t\treturn githubEventID{}, err\n\t\t}\n\t\tswitch {\n\t\tcase strings.HasPrefix(plain, \"Closed \"):\n\t\t\treturn githubEventID{PRClosedEventID: eventID}, nil\n\t\tcase strings.HasPrefix(plain, \"Merged \"):\n\t\t\treturn githubEventID{PRMergedEventID: eventID}, nil\n\t\tcase strings.HasPrefix(plain, \"Reopened \"):\n\t\t\treturn githubEventID{PRReopenedEventID: eventID}, nil\n\t\tcase strings.HasPrefix(plain, \"Assigned \"):\n\t\t\t// TODO: consider handling it, etc.\n\t\t\treturn githubEventID{}, nil\n\t\tcase strings.Contains(plain, \" requested your review \"):\n\t\t\t// TODO: consider handling it, etc.\n\t\t\treturn githubEventID{}, nil\n\t\tdefault:\n\t\t\treturn githubEventID{}, fmt.Errorf(\"unknown event type in %q\", plain)\n\t\t}\n\tcase len(parts) == 4 && parts[2] == \"comments\": // A comment on a gist. E.g., \"dmitshur/gist:6927554/comments/3076334\".\n\t\t// TODO: consider supporting comments on gists\n\t\treturn githubEventID{}, nil\n\n\tdefault:\n\t\treturn githubEventID{}, nil\n\t}\n}", "func (e *EncryptedChatRequested) FillFrom(from interface {\n\tGetFolderID() (value int, ok bool)\n\tGetID() (value int)\n\tGetAccessHash() (value int64)\n\tGetDate() (value int)\n\tGetAdminID() (value int)\n\tGetParticipantID() (value int)\n\tGetGA() (value []byte)\n}) {\n\tif val, ok := from.GetFolderID(); ok {\n\t\te.FolderID = val\n\t}\n\n\te.ID = from.GetID()\n\te.AccessHash = from.GetAccessHash()\n\te.Date = from.GetDate()\n\te.AdminID = from.GetAdminID()\n\te.ParticipantID = from.GetParticipantID()\n\te.GA = from.GetGA()\n}", "func (s *BaseEvent) ParseBody( body []byte, parseAll bool ) error {\n s.part1.EventType = EV_UNKNOWN;\n var numSections,part1Size,part2Size,sysSize,execSize uint\n\n if numParams,err:=fmt.Sscanf(string(body), \"%02d,1,%06d,1,%06d,1,%06d,1,%06d\\n\",&numSections,&part1Size,&part2Size,&sysSize,&execSize); numParams!=5 {\n s.errString = fmt.Sprintf( \"ParseBody error: only parsed %d parameters from frame:'%s' - err:\", numParams, body ) + err.Error()\n return s\n } // if\n if numSections != 4 {\n s.errString = fmt.Sprintf( \"ParseBody error expected 4 sections found %d\", numSections )\n return s\n } // if\n if part1Size == 0 {\n s.errString = \"ParseBody error part1 cannot be empty\"\n return s\n } // if\n\n startOffset := uint(BLOCK_HEADER_LEN);\n s.part1Json = body[startOffset:startOffset+part1Size]\n startOffset += part1Size\n if err:=s.parsePart1(); err != nil { return err }\n \n if part2Size > 0 {\n s.part2Json = body[startOffset:startOffset+part2Size]\n startOffset += part2Size\n if parseAll {\n if err:=s.parsePart2(); err != nil { return err }\n s.part2JsonExtracted = true\n } else {\n s.part2JsonExtracted = false\n } // else parseAll\n\n } // if\n if sysSize > 0 {\n s.sysParamsJson = body[startOffset:startOffset+sysSize]\n startOffset += sysSize\n if parseAll {\n if err:=s.parseSysParams(); err != nil { return err }\n s.sysParamsExtracted = true\n } else {\n s.sysParamsExtracted = false\n } // else parseAll\n } // if\n if execSize > 0 {\n s.execParamsJson = body[startOffset:startOffset+execSize]\n startOffset += execSize\n if parseAll {\n if err:=s.parseExecParams(); err != nil { return err }\n s.execParamsExtracted = true\n } else {\n s.execParamsExtracted = false\n } // else parseAll\n } // if\n\n Log.Printf( \"parseBody: sections:%d part1Size:%d part2Size:%d sysSize:%d execSize:%d\",numSections,part1Size,part2Size,sysSize,execSize )\n return nil\n}", "func (m *DynamicMessage) UnmarshalJSON(buf []byte) error {\n\n\t//Delcaring temp variables to be used across the unmarshaller\n\tvar err error\n\tvar goField libtypes.Field\n\tvar keyName []byte\n\tvar oldMsgType string\n\tvar msg *DynamicMessage\n\tvar msgType *DynamicMessageType\n\tvar data interface{}\n\tvar fieldExists bool\n\n\t//Declaring jsonparser unmarshalling functions\n\tvar arrayHandler func([]byte, jsonparser.ValueType, int, error)\n\tvar objectHandler func([]byte, []byte, jsonparser.ValueType, int) error\n\n\t//JSON key is an array\n\tarrayHandler = func(key []byte, dataType jsonparser.ValueType, offset int, err error) {\n\t\tswitch dataType.String() {\n\t\t//We have a string array\n\t\tcase \"string\":\n\t\t\tif goField.GoType == \"float32\" || goField.GoType == \"float64\" {\n\t\t\t\tdata, err = strconv.ParseFloat(string(key), 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrors.Wrap(err, \"Field: \"+goField.Name)\n\t\t\t\t}\n\t\t\t\tif goField.GoType == \"float32\" {\n\t\t\t\t\tm.data[goField.Name] = append(m.data[goField.Name].([]JsonFloat32), JsonFloat32{F: float32((data.(float64)))})\n\t\t\t\t} else {\n\t\t\t\t\tm.data[goField.Name] = append(m.data[goField.Name].([]JsonFloat64), JsonFloat64{F: data.(float64)})\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tm.data[goField.Name] = append(m.data[goField.Name].([]string), string(key))\n\t\t\t}\n\t\t//We have a number or int array.\n\t\tcase \"number\":\n\t\t\t//We have a float to parse\n\t\t\tif goField.GoType == \"float64\" || goField.GoType == \"float32\" {\n\t\t\t\tdata, err = strconv.ParseFloat(string(key), 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrors.Wrap(err, \"Field: \"+goField.Name)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdata, err = strconv.ParseInt(string(key), 0, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrors.Wrap(err, \"Field: \"+goField.Name)\n\t\t\t\t}\n\t\t\t}\n\t\t\t//Append field to data array\n\t\t\tswitch goField.GoType {\n\t\t\tcase \"int8\":\n\t\t\t\tm.data[goField.Name] = append(m.data[goField.Name].([]int8), int8((data.(int64))))\n\t\t\tcase \"int16\":\n\t\t\t\tm.data[goField.Name] = append(m.data[goField.Name].([]int16), int16((data.(int64))))\n\t\t\tcase \"int32\":\n\t\t\t\tm.data[goField.Name] = append(m.data[goField.Name].([]int32), int32((data.(int64))))\n\t\t\tcase \"int64\":\n\t\t\t\tm.data[goField.Name] = append(m.data[goField.Name].([]int64), int64((data.(int64))))\n\t\t\tcase \"uint8\":\n\t\t\t\tm.data[goField.Name] = append(m.data[goField.Name].([]uint8), uint8((data.(int64))))\n\t\t\tcase \"uint16\":\n\t\t\t\tm.data[goField.Name] = append(m.data[goField.Name].([]uint16), uint16((data.(int64))))\n\t\t\tcase \"uint32\":\n\t\t\t\tm.data[goField.Name] = append(m.data[goField.Name].([]uint32), uint32((data.(int64))))\n\t\t\tcase \"uint64\":\n\t\t\t\tm.data[goField.Name] = append(m.data[goField.Name].([]uint64), uint64((data.(int64))))\n\t\t\tcase \"float32\":\n\t\t\t\tm.data[goField.Name] = append(m.data[goField.Name].([]JsonFloat32), JsonFloat32{F: float32((data.(float64)))})\n\t\t\tcase \"float64\":\n\t\t\t\tm.data[goField.Name] = append(m.data[goField.Name].([]JsonFloat64), JsonFloat64{F: data.(float64)})\n\t\t\t}\n\t\t//We have a bool array\n\t\tcase \"boolean\":\n\t\t\tdata, err := jsonparser.GetBoolean(buf, string(key))\n\t\t\t_ = err\n\t\t\tm.data[goField.Name] = append(m.data[goField.Name].([]bool), data)\n\t\t//We have an object array\n\t\tcase \"object\":\n\t\t\tswitch goField.GoType {\n\t\t\t//We have a time object\n\t\t\tcase \"ros.Time\":\n\t\t\t\ttmpTime := Time{}\n\t\t\t\tsec, err := jsonparser.GetInt(key, \"Sec\")\n\t\t\t\tnsec, err := jsonparser.GetInt(key, \"NSec\")\n\t\t\t\tif err == nil {\n\t\t\t\t\ttmpTime.Sec = uint32(sec)\n\t\t\t\t\ttmpTime.NSec = uint32(nsec)\n\t\t\t\t}\n\t\t\t\tm.data[goField.Name] = append(m.data[goField.Name].([]Time), tmpTime)\n\t\t\t//We have a duration object\n\t\t\tcase \"ros.Duration\":\n\t\t\t\ttmpDuration := Duration{}\n\t\t\t\tsec, err := jsonparser.GetInt(key, \"Sec\")\n\t\t\t\tnsec, err := jsonparser.GetInt(key, \"NSec\")\n\t\t\t\tif err == nil {\n\t\t\t\t\ttmpDuration.Sec = uint32(sec)\n\t\t\t\t\ttmpDuration.NSec = uint32(nsec)\n\t\t\t\t}\n\t\t\t\tm.data[goField.Name] = append(m.data[goField.Name].([]Duration), tmpDuration)\n\t\t\t//We have a nested message\n\t\t\tdefault:\n\t\t\t\tnewMsgType := goField.GoType\n\t\t\t\t//Check if the message type is the same as last iteration\n\t\t\t\t//This avoids generating a new type for each array item\n\t\t\t\tif oldMsgType != \"\" && oldMsgType == newMsgType {\n\t\t\t\t\t//We've already generated this type\n\t\t\t\t} else {\n\t\t\t\t\tmsgType, err = newDynamicMessageTypeNested(goField.Type, goField.Package)\n\t\t\t\t\t_ = err\n\t\t\t\t}\n\t\t\t\tmsg = msgType.NewMessage().(*DynamicMessage)\n\t\t\t\terr = msg.UnmarshalJSON(key)\n\t\t\t\tm.data[goField.Name] = append(m.data[goField.Name].([]Message), msg)\n\t\t\t\t//Store msg type\n\t\t\t\toldMsgType = newMsgType\n\t\t\t\t//No error handling in array, see next comment\n\t\t\t\t_ = err\n\n\t\t\t}\n\t\t}\n\n\t\t//Null error as it is not returned in ArrayEach, requires package modification\n\t\t_ = err\n\t\t//Null keyName to prevent repeat scenarios of same key usage\n\t\t_ = keyName\n\n\t}\n\n\t//JSON key handler\n\tobjectHandler = func(key []byte, value []byte, dataType jsonparser.ValueType, offset int) error {\n\t\t//Store keyName for usage in ArrayEach function\n\t\tkeyName = key\n\t\tfieldExists = false\n\t\t//Find message spec field that matches JSON key\n\t\tfor _, field := range m.dynamicType.spec.Fields {\n\t\t\tif string(key) == field.Name {\n\t\t\t\tgoField = field\n\t\t\t\tfieldExists = true\n\t\t\t}\n\t\t}\n\t\tif fieldExists == true {\n\t\t\t//Scalars First\n\t\t\tswitch dataType.String() {\n\t\t\t//We have a JSON string\n\t\t\tcase \"string\":\n\t\t\t\t//Special case where we have a byte array encoded as JSON string\n\t\t\t\tif goField.GoType == \"uint8\" {\n\t\t\t\t\tdata, err := base64.StdEncoding.DecodeString(string(value))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn errors.Wrap(err, \"Byte Array Field: \"+goField.Name)\n\t\t\t\t\t}\n\t\t\t\t\tm.data[goField.Name] = data\n\t\t\t\t\t//Case where we have marshalled a special float as a string\n\t\t\t\t} else if goField.GoType == \"float32\" || goField.GoType == \"float64\" {\n\t\t\t\t\tdata, err = strconv.ParseFloat(string(value), 64)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\terrors.Wrap(err, \"Field: \"+goField.Name)\n\t\t\t\t\t}\n\t\t\t\t\tif goField.GoType == \"float32\" {\n\t\t\t\t\t\tm.data[goField.Name] = JsonFloat32{F: float32(data.(float64))}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tm.data[goField.Name] = JsonFloat64{F: data.(float64)}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tm.data[goField.Name] = string(value)\n\t\t\t\t}\n\t\t\t//We have a JSON number or int\n\t\t\tcase \"number\":\n\t\t\t\t//We have a float to parse\n\t\t\t\tif goField.GoType == \"float64\" || goField.GoType == \"float32\" {\n\t\t\t\t\tdata, err = jsonparser.GetFloat(buf, string(key))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn errors.Wrap(err, \"Field: \"+goField.Name)\n\t\t\t\t\t}\n\t\t\t\t\t//We have an int to parse\n\t\t\t\t} else {\n\t\t\t\t\tdata, err = jsonparser.GetInt(buf, string(key))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn errors.Wrap(err, \"Field: \"+goField.Name)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//Copy number value to message field\n\t\t\t\tswitch goField.GoType {\n\t\t\t\tcase \"int8\":\n\t\t\t\t\tm.data[goField.Name] = int8(data.(int64))\n\t\t\t\tcase \"int16\":\n\t\t\t\t\tm.data[goField.Name] = int16(data.(int64))\n\t\t\t\tcase \"int32\":\n\t\t\t\t\tm.data[goField.Name] = int32(data.(int64))\n\t\t\t\tcase \"int64\":\n\t\t\t\t\tm.data[goField.Name] = int64(data.(int64))\n\t\t\t\tcase \"uint8\":\n\t\t\t\t\tm.data[goField.Name] = uint8(data.(int64))\n\t\t\t\tcase \"uint16\":\n\t\t\t\t\tm.data[goField.Name] = uint16(data.(int64))\n\t\t\t\tcase \"uint32\":\n\t\t\t\t\tm.data[goField.Name] = uint32(data.(int64))\n\t\t\t\tcase \"uint64\":\n\t\t\t\t\tm.data[goField.Name] = uint64(data.(int64))\n\t\t\t\tcase \"float32\":\n\t\t\t\t\tm.data[goField.Name] = JsonFloat32{F: float32(data.(float64))}\n\t\t\t\tcase \"float64\":\n\t\t\t\t\tm.data[goField.Name] = JsonFloat64{F: data.(float64)}\n\t\t\t\t}\n\t\t\t//We have a JSON bool\n\t\t\tcase \"boolean\":\n\t\t\t\tdata, err := jsonparser.GetBoolean(buf, string(key))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.Wrap(err, \"Field: \"+goField.Name)\n\t\t\t\t}\n\t\t\t\tm.data[goField.Name] = data\n\t\t\t//We have a JSON object\n\t\t\tcase \"object\":\n\t\t\t\tswitch goField.GoType {\n\t\t\t\t//We have a time object\n\t\t\t\tcase \"ros.Time\":\n\t\t\t\t\ttmpTime := Time{}\n\t\t\t\t\tsec, err := jsonparser.GetInt(value, \"Sec\")\n\t\t\t\t\tnsec, err := jsonparser.GetInt(value, \"NSec\")\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\ttmpTime.Sec = uint32(sec)\n\t\t\t\t\t\ttmpTime.NSec = uint32(nsec)\n\t\t\t\t\t}\n\t\t\t\t\tm.data[goField.Name] = tmpTime\n\t\t\t\t//We have a duration object\n\t\t\t\tcase \"ros.Duration\":\n\t\t\t\t\ttmpDuration := Duration{}\n\t\t\t\t\tsec, err := jsonparser.GetInt(value, \"Sec\")\n\t\t\t\t\tnsec, err := jsonparser.GetInt(value, \"NSec\")\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\ttmpDuration.Sec = uint32(sec)\n\t\t\t\t\t\ttmpDuration.NSec = uint32(nsec)\n\t\t\t\t\t}\n\t\t\t\t\tm.data[goField.Name] = tmpDuration\n\t\t\t\tdefault:\n\t\t\t\t\t//We have a nested message\n\t\t\t\t\tmsgType, err := newDynamicMessageTypeNested(goField.Type, goField.Package)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn errors.Wrap(err, \"Field: \"+goField.Name)\n\t\t\t\t\t}\n\t\t\t\t\tmsg := msgType.NewMessage().(*DynamicMessage)\n\t\t\t\t\tif err = msg.UnmarshalJSON(value); err != nil {\n\t\t\t\t\t\treturn errors.Wrap(err, \"Field: \"+goField.Name)\n\t\t\t\t\t}\n\t\t\t\t\tm.data[goField.Name] = msg\n\t\t\t\t}\n\t\t\t//We have a JSON array\n\t\t\tcase \"array\":\n\t\t\t\t//Redeclare message array fields incase they do not exist\n\t\t\t\tswitch goField.GoType {\n\t\t\t\tcase \"bool\":\n\t\t\t\t\tm.data[goField.Name] = make([]bool, 0)\n\t\t\t\tcase \"int8\":\n\t\t\t\t\tm.data[goField.Name] = make([]int8, 0)\n\t\t\t\tcase \"int16\":\n\t\t\t\t\tm.data[goField.Name] = make([]int16, 0)\n\t\t\t\tcase \"int32\":\n\t\t\t\t\tm.data[goField.Name] = make([]int32, 0)\n\t\t\t\tcase \"int64\":\n\t\t\t\t\tm.data[goField.Name] = make([]int64, 0)\n\t\t\t\tcase \"uint8\":\n\t\t\t\t\tm.data[goField.Name] = make([]uint8, 0)\n\t\t\t\tcase \"uint16\":\n\t\t\t\t\tm.data[goField.Name] = make([]uint16, 0)\n\t\t\t\tcase \"uint32\":\n\t\t\t\t\tm.data[goField.Name] = make([]uint32, 0)\n\t\t\t\tcase \"uint64\":\n\t\t\t\t\tm.data[goField.Name] = make([]uint64, 0)\n\t\t\t\tcase \"float32\":\n\t\t\t\t\tm.data[goField.Name] = make([]JsonFloat32, 0)\n\t\t\t\tcase \"float64\":\n\t\t\t\t\tm.data[goField.Name] = make([]JsonFloat64, 0)\n\t\t\t\tcase \"string\":\n\t\t\t\t\tm.data[goField.Name] = make([]string, 0)\n\t\t\t\tcase \"ros.Time\":\n\t\t\t\t\tm.data[goField.Name] = make([]Time, 0)\n\t\t\t\tcase \"ros.Duration\":\n\t\t\t\t\tm.data[goField.Name] = make([]Duration, 0)\n\t\t\t\tdefault:\n\t\t\t\t\t//goType is a nested Message array\n\t\t\t\t\tm.data[goField.Name] = make([]Message, 0)\n\t\t\t\t}\n\t\t\t\t//Parse JSON array\n\t\t\t\tjsonparser.ArrayEach(value, arrayHandler)\n\t\t\tdefault:\n\t\t\t\t//We do nothing here as blank fields may return value type NotExist or Null\n\t\t\t\terr = errors.Wrap(err, \"Null field: \"+string(key))\n\t\t\t}\n\t\t} else {\n\t\t\treturn errors.New(\"Field Unknown: \" + string(key))\n\t\t}\n\t\treturn err\n\t}\n\t//Perform JSON object handler function\n\terr = jsonparser.ObjectEach(buf, objectHandler)\n\treturn err\n}", "func (a *Aggregate) makeFields(parts []string) map[string]string {\n\tfields := make(map[string]string, len(parts))\n\tfor _, part := range parts {\n\t\tkv := strings.SplitN(part, protocol.AggregateKVDelimiter, 2)\n\t\tif len(kv) != 2 {\n\t\t\tcontinue\n\t\t}\n\t\tfields[kv[0]] = kv[1]\n\t}\n\treturn fields\n}", "func (g *MessagesGetDiscussionMessageRequest) FillFrom(from interface {\n\tGetPeer() (value InputPeerClass)\n\tGetMsgID() (value int)\n}) {\n\tg.Peer = from.GetPeer()\n\tg.MsgID = from.GetMsgID()\n}", "func checkMessageStringFields(msg *rainslib.RainsMessage) bool {\n\tif msg == nil || !checkCapabilites(msg.Capabilities) {\n\t\treturn false\n\t}\n\tfor _, s := range msg.Content {\n\t\tif !checkStringFields(s) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func getMessage(handler *handler) *fcm.Message {\n\tdata := []byte(handler.GetFromKey(\"message\"))\n\n\tvar message map[string]interface{}\n\terr := json.Unmarshal(data, &message)\n\tif err != nil {\n\t\tpanic(\"message body error\" + string(data[:]) + \"! error:\" + err.Error())\n\t}\n\treturn &fcm.Message{\n\t\tData: message,\n\t}\n}", "func MsgPrepare(common Common, tx *Transfer) base.Message {\n\tif tx.MessageType == 2 && common.PrivateKey != \"\" {\n\t\treturn base.Message{\n\t\t\tType: 2,\n\t\t\tPayload: \"\",\n\t\t}\n\t} else if tx.MessageType == 2 && common.IsHW {\n\t\treturn base.Message{\n\t\t\tType: 2,\n\t\t\tPayload: utils.Utf8ToHex(tx.Message),\n\t\t\tPublicKey: tx.RecipientPublicKey,\n\t\t}\n\n\t} else if tx.MessageType == 0 && utils.IsHexadecimal(tx.Message) {\n\t\treturn base.Message{\n\t\t\tType: 1,\n\t\t\tPayload: \"fe\" + tx.Message,\n\t\t}\n\t} else {\n\t\treturn base.Message{\n\t\t\tType: 1,\n\t\t\tPayload: utils.Utf8ToHex(tx.Message),\n\t\t}\n\t}\n}", "func parseStunMessage(data []byte) (*stunMessage, error) {\n\tmsg := parseStunHeader(data)\n\tif msg == nil {\n\t\treturn nil, errSTUNInvalidMessage\n\t}\n\n\t// Parse attributes.\n\tb := bytes.NewBuffer(data[stunHeaderLength:])\n\tfor b.Len() > 0 {\n\t\tattr, err := parseStunAttribute(b)\n\t\tif err != nil {\n\t\t\treturn msg, err\n\t\t}\n\n\t\t// TODO: check message integrity and fingerprint\n\t\tmsg.attributes = append(msg.attributes, attr)\n\t}\n\treturn msg, nil\n}", "func (e *EmailID) ParseIDs() {\n\te.ID = DecodeUUIDBase64(e.IDStr)\n}", "func parseBody(body io.Reader) map[string]interface{} {\n\tfields := map[string]interface{}{}\n\tsc := bufio.NewScanner(body)\n\tfor sc.Scan() {\n\t\tline := sc.Text()\n\t\tif strings.Contains(line, \"=\") {\n\t\t\tparts := strings.SplitN(line, \"=\", 2)\n\t\t\t// skip if this line isn't long enough\n\t\t\tif len(parts) != 2 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// skip sample_time\n\t\t\tif parts[0] == \"sample_time\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tkey := strings.TrimSpace(parts[0])\n\t\t\tkey = strings.Replace(key, \".\", \"_\", -1)\n\t\t\tvalueStr := strings.TrimSpace(parts[1])\n\n\t\t\t// src/mgr/CountersAction.h defines these all as double,\n\t\t\t// so turn them into 64-bit floats\n\t\t\tvalue, err := strconv.ParseFloat(valueStr, 64)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// store this field\n\t\t\tfields[key] = value\n\t\t}\n\t}\n\treturn fields\n}", "func (u *UpdateShortSentMessage) FillFrom(from interface {\n\tGetOut() (value bool)\n\tGetID() (value int)\n\tGetPts() (value int)\n\tGetPtsCount() (value int)\n\tGetDate() (value int)\n\tGetMedia() (value MessageMediaClass, ok bool)\n\tGetEntities() (value []MessageEntityClass, ok bool)\n\tGetTTLPeriod() (value int, ok bool)\n}) {\n\tu.Out = from.GetOut()\n\tu.ID = from.GetID()\n\tu.Pts = from.GetPts()\n\tu.PtsCount = from.GetPtsCount()\n\tu.Date = from.GetDate()\n\tif val, ok := from.GetMedia(); ok {\n\t\tu.Media = val\n\t}\n\n\tif val, ok := from.GetEntities(); ok {\n\t\tu.Entities = val\n\t}\n\n\tif val, ok := from.GetTTLPeriod(); ok {\n\t\tu.TTLPeriod = val\n\t}\n\n}", "func decodeMessage(bz []byte) (msgType byte, msg interface{}) {\n\tn, err := new(int64), new(error)\n\t// log.Debug(\"decoding msg bytes: %X\", bz)\n\tmsgType = bz[0]\n\tswitch msgType {\n\tcase msgTypeBlockPart:\n\t\tmsg = readBlockPartMessage(bytes.NewReader(bz[1:]), n, err)\n\tcase msgTypeKnownBlockParts:\n\t\tmsg = readKnownBlockPartsMessage(bytes.NewReader(bz[1:]), n, err)\n\tcase msgTypeVote:\n\t\tmsg = ReadVote(bytes.NewReader(bz[1:]), n, err)\n\tcase msgTypeVoteAskRank:\n\t\tmsg = ReadVote(bytes.NewReader(bz[1:]), n, err)\n\tcase msgTypeVoteRank:\n\t\tmsg = readVoteRankMessage(bytes.NewReader(bz[1:]), n, err)\n\tdefault:\n\t\tmsg = nil\n\t}\n\treturn\n}", "func (db *Database) GetMessageDetails(id int) (string, *ChatMessage, error) {\n\trow := db.db.QueryRow(`\n\t\tSELECT\n\t\t\tm.message,\n\t\t\tm.dt,\n\t\t\tm.pings,\n\t\t\ta.username author,\n\t\t\tm.author_id,\n\t\t\tc.name channel\n\t\tFROM melodious.messages m\n\t\tINNER JOIN melodious.accounts a ON m.author_id = a.id\n\t\tINNER JOIN melodious.channels c ON m.chan_id = c.id\n\t\tWHERE m.id=$1;\n\t`, id)\n\tvar pings pq.StringArray\n\tvar channel string\n\tmsg := &ChatMessage{}\n\terr := row.Scan(&(msg.Message), &(msg.Timestamp), &pings, &(msg.Author), &(msg.AuthorID), &channel)\n\tif err != nil {\n\t\treturn \"\", &ChatMessage{}, err\n\t}\n\tmsg.Pings = []string(pings)\n\tmsg.ID = id\n\treturn channel, msg, nil\n}", "func (m *PresenceStatusMessage) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"expiryDateTime\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetObjectValue(CreateDateTimeTimeZoneFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetExpiryDateTime(val.(DateTimeTimeZoneable))\n }\n return nil\n }\n res[\"message\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetObjectValue(CreateItemBodyFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n m.SetMessage(val.(ItemBodyable))\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n res[\"publishedDateTime\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetTimeValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetPublishedDateTime(val)\n }\n return nil\n }\n return res\n}", "func checkRequiredFields(pb proto.Message) error {\n\t// Most well-known type messages do not contain required fields. The \"Any\" type may contain\n\t// a message that has required fields.\n\t//\n\t// When an Any message is being marshaled, the code will invoked proto.Unmarshal on Any.Value\n\t// field in order to transform that into BSON, and that should have returned an error if a\n\t// required field is not set in the embedded message.\n\t//\n\t// When an Any message is being unmarshaled, the code will have invoked proto.Marshal on the\n\t// embedded message to store the serialized message in Any.Value field, and that should have\n\t// returned an error if a required field is not set.\n\tif _, ok := pb.(wkt); ok {\n\t\treturn nil\n\t}\n\n\tv := reflect.ValueOf(pb)\n\t// Skip message if it is not a struct pointer.\n\tif v.Kind() != reflect.Ptr {\n\t\treturn nil\n\t}\n\tv = v.Elem()\n\tif v.Kind() != reflect.Struct {\n\t\treturn nil\n\t}\n\n\tfor i := 0; i < v.NumField(); i++ {\n\t\tfield := v.Field(i)\n\t\tsfield := v.Type().Field(i)\n\n\t\tif sfield.PkgPath != \"\" {\n\t\t\t// blank PkgPath means the field is exported; skip if not exported\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.HasPrefix(sfield.Name, \"XXX_\") {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Oneof field is an interface implemented by wrapper structs containing the actual oneof\n\t\t// field, i.e. an interface containing &T{real_value}.\n\t\tif sfield.Tag.Get(\"protobuf_oneof\") != \"\" {\n\t\t\tif field.Kind() != reflect.Interface {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tv := field.Elem()\n\t\t\tif v.Kind() != reflect.Ptr || v.IsNil() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tv = v.Elem()\n\t\t\tif v.Kind() != reflect.Struct || v.NumField() < 1 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfield = v.Field(0)\n\t\t\tsfield = v.Type().Field(0)\n\t\t}\n\n\t\tprotoTag := sfield.Tag.Get(\"protobuf\")\n\t\tif protoTag == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tvar prop proto.Properties\n\t\tprop.Init(sfield.Type, sfield.Name, protoTag, &sfield)\n\n\t\tswitch field.Kind() {\n\t\tcase reflect.Map:\n\t\t\tif field.IsNil() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Check each map value.\n\t\t\tkeys := field.MapKeys()\n\t\t\tfor _, k := range keys {\n\t\t\t\tv := field.MapIndex(k)\n\t\t\t\tif err := checkRequiredFieldsInValue(v); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\tcase reflect.Slice:\n\t\t\t// Handle non-repeated type, e.g. bytes.\n\t\t\tif !prop.Repeated {\n\t\t\t\tif prop.Required && field.IsNil() {\n\t\t\t\t\treturn fmt.Errorf(\"required field %q is not set\", prop.Name)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Handle repeated type.\n\t\t\tif field.IsNil() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Check each slice item.\n\t\t\tfor i := 0; i < field.Len(); i++ {\n\t\t\t\tv := field.Index(i)\n\t\t\t\tif err := checkRequiredFieldsInValue(v); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\tcase reflect.Ptr:\n\t\t\tif field.IsNil() {\n\t\t\t\tif prop.Required {\n\t\t\t\t\treturn fmt.Errorf(\"required field %q is not set\", prop.Name)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := checkRequiredFieldsInValue(field); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Handle proto2 extensions.\n\tfor _, ext := range proto.RegisteredExtensions(pb) {\n\t\tif !proto.HasExtension(pb, ext) {\n\t\t\tcontinue\n\t\t}\n\t\tep, err := proto.GetExtension(pb, ext)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = checkRequiredFieldsInValue(reflect.ValueOf(ep))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (h *Handler) parseRequest(c websocket.Connection, msg interface{}, dst interface{}) (string, bool) {\n\t// Ignore the message is not a map[string]interface{}\n\tm, ok := msg.(map[string]interface{})\n\tif !ok {\n\t\treturn \"\", false\n\t}\n\n\t// Return an error if the requestId can't be casted to string\n\trequestId, ok := m[\"requestId\"].(string)\n\tif !ok {\n\t\treturn \"\", false\n\t}\n\n\t// Coerce msg into req\n\tencoded, err := json.Marshal(m[\"body\"])\n\tif err != nil {\n\t\tc.Emit(\"error\", WsResponse{\n\t\t\tRequestId: requestId,\n\t\t\tBody: response.NewError(iris.StatusBadRequest),\n\t\t})\n\t\treturn \"\", false\n\t}\n\n\tif err := json.Unmarshal(encoded, dst); err != nil {\n\t\tc.Emit(\"error\", WsResponse{\n\t\t\tRequestId: requestId,\n\t\t\tBody: response.NewError(iris.StatusBadRequest),\n\t\t})\n\t\treturn \"\", false\n\t}\n\treturn requestId, true\n}", "func unmarshalAgentMsg(packet []byte) (interface{}, uint8, error) {\r\n\tif len(packet) < 1 {\r\n\t\treturn nil, 0, ParseError{0}\r\n\t}\r\n\tvar msg interface{}\r\n\tswitch packet[0] {\r\n\tcase agentFailure:\r\n\t\tmsg = new(failureAgentMsg)\r\n\tcase agentSuccess:\r\n\t\tmsg = new(successAgentMsg)\r\n\tcase agentIdentitiesAnswer:\r\n\t\tmsg = new(identitiesAnswerAgentMsg)\r\n\tcase agentSignResponse:\r\n\t\tmsg = new(signResponseAgentMsg)\r\n\tdefault:\r\n\t\treturn nil, 0, UnexpectedMessageError{0, packet[0]}\r\n\t}\r\n\tif err := unmarshal(msg, packet, packet[0]); err != nil {\r\n\t\treturn nil, 0, err\r\n\t}\r\n\treturn msg, packet[0], nil\r\n}", "func (u *UpdateShortMessage) FillFrom(from interface {\n\tGetOut() (value bool)\n\tGetMentioned() (value bool)\n\tGetMediaUnread() (value bool)\n\tGetSilent() (value bool)\n\tGetID() (value int)\n\tGetUserID() (value int64)\n\tGetMessage() (value string)\n\tGetPts() (value int)\n\tGetPtsCount() (value int)\n\tGetDate() (value int)\n\tGetFwdFrom() (value MessageFwdHeader, ok bool)\n\tGetViaBotID() (value int64, ok bool)\n\tGetReplyTo() (value MessageReplyHeaderClass, ok bool)\n\tGetEntities() (value []MessageEntityClass, ok bool)\n\tGetTTLPeriod() (value int, ok bool)\n}) {\n\tu.Out = from.GetOut()\n\tu.Mentioned = from.GetMentioned()\n\tu.MediaUnread = from.GetMediaUnread()\n\tu.Silent = from.GetSilent()\n\tu.ID = from.GetID()\n\tu.UserID = from.GetUserID()\n\tu.Message = from.GetMessage()\n\tu.Pts = from.GetPts()\n\tu.PtsCount = from.GetPtsCount()\n\tu.Date = from.GetDate()\n\tif val, ok := from.GetFwdFrom(); ok {\n\t\tu.FwdFrom = val\n\t}\n\n\tif val, ok := from.GetViaBotID(); ok {\n\t\tu.ViaBotID = val\n\t}\n\n\tif val, ok := from.GetReplyTo(); ok {\n\t\tu.ReplyTo = val\n\t}\n\n\tif val, ok := from.GetEntities(); ok {\n\t\tu.Entities = val\n\t}\n\n\tif val, ok := from.GetTTLPeriod(); ok {\n\t\tu.TTLPeriod = val\n\t}\n\n}", "func formatIncomingMessage(incomingMessage *models.IncomingMessage) ([]models.DestinationMessage, error) {\n\n\tif incomingMessage == nil {\n\t\treturn nil, errors.New(\"Incoming message is empty\")\n\t}\n\n\tdestinationMessages := make([]models.DestinationMessage, len(incomingMessage.Message.Partitions))\n\n\tfor i := 0; i < len(incomingMessage.Message.Partitions); i++ {\n\t\tdestinationMessages[i].Data.Name = incomingMessage.Message.Partitions[i].Name\n\t\tdestinationMessages[i].Data.DriveType = incomingMessage.Message.Partitions[i].DriveType\n\t\tdestinationMessages[i].Data.UsedSpaceBytes = incomingMessage.Message.Partitions[i].Metric.UsedSpaceBytes\n\t\tdestinationMessages[i].Data.TotalSpaceBytes = incomingMessage.Message.Partitions[i].Metric.TotalSpaceBytes\n\t\tdestinationMessages[i].Data.CreateAtTimeUTC = incomingMessage.Message.CreateAtTimeUTC\n\t}\n\n\treturn destinationMessages, nil\n}", "func (u *UnityServer) parseMessage(msg string) {\n\tu.Logger.Infof(\"Recieved: %v\", msg)\n\n\t// Convert json to struct\n\tvar r receipt\n\terr := json.Unmarshal([]byte(msg), &r)\n\tif err != nil {\n\t\tu.Logger.Errorf(\"Error: Trying to parse message - %v\", err)\n\t\treturn\n\t}\n\n\t// Check if the image exists\n\tif _, err := os.Stat(r.Filepath); err == nil {\n\t\tu.Logger.Debug(\"File does exist\")\n\t}\n\tu.Logger.Debugf(\"Setting currentFilepath: %v\", r.Filepath)\n\tu.currentFilePath <- r.Filepath\n}", "func ParseMessage(line string) (*Message, error) {\n\t// Trim the line and make sure we have data\n\tline = strings.TrimRight(line, \"\\r\\n\")\n\tif len(line) == 0 {\n\t\treturn nil, ErrZeroLengthMessage\n\t}\n\n\tc := &Message{\n\t\tTags: Tags{},\n\t\tPrefix: &Prefix{},\n\t}\n\n\tif line[0] == '@' {\n\t\tloc := strings.Index(line, \" \")\n\t\tif loc == -1 {\n\t\t\treturn nil, ErrMissingDataAfterTags\n\t\t}\n\n\t\tc.Tags = ParseTags(line[1:loc])\n\t\tline = line[loc+1:]\n\t}\n\n\tif line[0] == ':' {\n\t\tloc := strings.Index(line, \" \")\n\t\tif loc == -1 {\n\t\t\treturn nil, ErrMissingDataAfterPrefix\n\t\t}\n\n\t\t// Parse the identity, if there was one\n\t\tc.Prefix = ParsePrefix(line[1:loc])\n\t\tline = line[loc+1:]\n\t}\n\n\t// Split out the trailing then the rest of the args. Because\n\t// we expect there to be at least one result as an arg (the\n\t// command) we don't need to special case the trailing arg and\n\t// can just attempt a split on \" :\"\n\tsplit := strings.SplitN(line, \" :\", 2)\n\tc.Params = strings.FieldsFunc(split[0], func(r rune) bool {\n\t\treturn r == ' '\n\t})\n\n\t// If there are no args, we need to bail because we need at\n\t// least the command.\n\tif len(c.Params) == 0 {\n\t\treturn nil, ErrMissingCommand\n\t}\n\n\t// If we had a trailing arg, append it to the other args\n\tif len(split) == 2 {\n\t\tc.Params = append(c.Params, split[1])\n\t}\n\n\t// Because of how it's parsed, the Command will show up as the\n\t// first arg.\n\tc.Command = strings.ToUpper(c.Params[0])\n\tc.Params = c.Params[1:]\n\n\t// If there are no params, set it to nil, to make writing tests and other\n\t// things simpler.\n\tif len(c.Params) == 0 {\n\t\tc.Params = nil\n\t}\n\n\treturn c, nil\n}", "func (*Message) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase message.FieldID, message.FieldFrom, message.FieldSessionType, message.FieldServerMsgSeq, message.FieldMsgType, message.FieldMsgResCode, message.FieldMsgFeature, message.FieldMsgStatus, message.FieldCreateTime:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase message.FieldSessionKey, message.FieldTo, message.FieldClientMsgID, message.FieldMsgData:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase message.FieldCreated, message.FieldUpdated:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Message\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "func (c *ChatParticipant) FillFrom(from interface {\n\tGetUserID() (value int)\n\tGetInviterID() (value int)\n\tGetDate() (value int)\n}) {\n\tc.UserID = from.GetUserID()\n\tc.InviterID = from.GetInviterID()\n\tc.Date = from.GetDate()\n}", "func validateMessage(data []byte) (message, error) {\n\tvar msg message\n\n\tif err := json.Unmarshal(data, &msg); err != nil {\n\t\treturn msg, errors.Wrap(err, \"Unmarshaling message\")\n\t}\n\n\tif msg.Handle == \"\" && msg.Text == \"\" {\n\t\treturn msg, errors.New(\"Message has no Handle or Text\")\n\t}\n\n\treturn msg, nil\n}", "func parseMessage(bytes []byte) (*Message, error) {\n\tif len(bytes) >= 2 {\n\t\tversion := binary.BigEndian.Uint16(bytes[:2])\n\t\tif version != 3 {\n\t\t\treturn nil, fmt.Errorf(\"Can only handle message version 3, %d received\", version)\n\t\t}\n\t}\n\n\t// // ensure we're dealing with a proper v3 message via length\n\tif len(bytes) != nagiosMessageLen {\n\t\treturn nil, fmt.Errorf(\"Expected message of %d bytes, received %d\", nagiosMessageLen, len(bytes))\n\t}\n\n\t// discard CRC for now. not sure what to do with it just yet\n\t// TODO: figure out the right way to validate this\n\tbinary.BigEndian.Uint32(bytes[4:8])\n\n\t// read the timestamp\n\ttimestamp := binary.BigEndian.Uint32(bytes[8:12])\n\t// TODO: validate timestamp as semi-current ?? (maybe?)\n\n\t// read the return-code (state)\n\treturnCode := binary.BigEndian.Uint16(bytes[12:14])\n\tif returnCode != stateOk &&\n\t\treturnCode != stateWarning &&\n\t\treturnCode != stateCritical &&\n\t\treturnCode != stateUnknown {\n\n\t\tLogger().Trace.Printf(\"Unknown return code received %d\", returnCode)\n\t\treturn nil, fmt.Errorf(\"Unknown return code received %d\", returnCode)\n\t}\n\n\t// read hostname (64 bytes)\n\thostname := string(bytes[14:78])\n\n\t// read service description / name (128 bytes)\n\tservice := string(bytes[78:206])\n\n\t// read the description (512 bytes)\n\tdescription := string(bytes[206:718])\n\n\t// last two bytes are padding so we don't have to worry about them too much\n\n\treturn &Message{\n\t\tTimestamp: timestamp,\n\t\tState: returnCode,\n\t\tHost: hostname,\n\t\tService: service,\n\t\tMessage: description,\n\t}, nil\n}", "func messageFromMap(input *dynamic.Message, data *map[string]interface{}) error {\n\tstrData, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = jsonpb.UnmarshalString(string(strData), input)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (m *Message) unmarshalInterface(v interface{}) error {\n\tstrdata, err := stringMap(v)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range strdata {\n\t\tswitch strings.ToLower(k) {\n\t\tcase \"id\":\n\t\t\tm.ID = v\n\t\tcase \"description\":\n\t\t\tm.Description = v\n\t\tcase \"hash\":\n\t\t\tm.Hash = v\n\t\tcase \"leftdelim\":\n\t\t\tm.LeftDelim = v\n\t\tcase \"rightdelim\":\n\t\t\tm.RightDelim = v\n\t\tcase \"zero\":\n\t\t\tm.Zero = v\n\t\tcase \"one\":\n\t\t\tm.One = v\n\t\tcase \"two\":\n\t\t\tm.Two = v\n\t\tcase \"few\":\n\t\t\tm.Few = v\n\t\tcase \"many\":\n\t\t\tm.Many = v\n\t\tcase \"other\":\n\t\t\tm.Other = v\n\t\t}\n\t}\n\treturn nil\n}", "func (e *EncryptedChat) FillFrom(from interface {\n\tGetID() (value int)\n\tGetAccessHash() (value int64)\n\tGetDate() (value int)\n\tGetAdminID() (value int)\n\tGetParticipantID() (value int)\n\tGetGAOrB() (value []byte)\n\tGetKeyFingerprint() (value int64)\n}) {\n\te.ID = from.GetID()\n\te.AccessHash = from.GetAccessHash()\n\te.Date = from.GetDate()\n\te.AdminID = from.GetAdminID()\n\te.ParticipantID = from.GetParticipantID()\n\te.GAOrB = from.GetGAOrB()\n\te.KeyFingerprint = from.GetKeyFingerprint()\n}", "func fields(s string) (map[string]interface{}, error) {\n\tfields := strings.Split(strings.TrimSpace(s), \"\\t\")\n\tif len(fields) < 1 {\n\t\treturn nil, fmt.Errorf(\"must have at least 1 field\")\n\t}\n\n\tif len(fields)%2 != 1 {\n\t\tfmt.Println(fields)\n\t\treturn nil, fmt.Errorf(\"expected odd number of elements, found %d\", len(fields))\n\t}\n\n\tm := map[string]interface{}{\"event\": fields[0]}\n\n\tfor i := 1; i < len(fields); i += 2 {\n\t\tk := removeQuotes(fields[i])\n\n\t\tv, err := getVal(fields[i+1])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tm[k] = v\n\t}\n\n\treturn m, nil\n}", "func (handler *protocolHandler) Unwrap(msgBytes []byte) (msg interface{}, msgStr string, err error) {\n\twrappedMsg := &messages.Message{}\n\tif err := proto.Unmarshal(msgBytes, wrappedMsg); err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\tmsg = messages.UnwrapMessage(wrappedMsg)\n\tmsgStr = messageString(msg)\n\n\treturn msg, msgStr, nil\n}", "func (mgmt *Management) handlePeersMessage(received []byte) {\n\tvar cm collaborationMessage\n\terr := json.Unmarshal(received, &cm)\n\tif err != nil {\n\t\tlog.Println(\"Error while unmarshalling collaborationMessage:\", err)\n\t}\n\tlog.Println(cm, \"parsed FrontendtoMgmt\")\n\n\tswitch cm.Event {\n\tcase \"ABTU\":\n\t\tmgmt.doc.PeersToABTU <- cm.Content\n\tcase \"AccessControl\":\n\t//\tTODO Handle access control messages\n\tcase \"Cursor\":\n\t//\tTODO Handle cursor messages\n\t}\n}", "func (t *Translator) fromMessage(req *TranslationRequest) *JSONMessage {\n\theader := req.Message.Header()\n\n\t// Load the profile of the sender into the object.\n\tfromProfile, ok := req.Profiles[header.From.String()]\n\tif !ok {\n\t\tfromProfile = t.FromProfile(\n\t\t\theader.From.Alias, header.From.String(),\n\t\t\tnil)\n\t}\n\n\t// Load the profile of the recipients into the object.\n\ttoProfiles := make([]*JSONProfile, len(header.To))\n\tfor i, addr := range header.To {\n\t\ttoProfiles[i], ok = req.Profiles[addr.String()]\n\t\tif !ok {\n\t\t\ttoProfiles[i] = t.FromProfile(\n\t\t\t\taddr.Alias, addr.String(),\n\t\t\t\tnil)\n\t\t}\n\t}\n\n\t// For legacy reasons, we will set a 'random' string\n\t// as the name of the message if it doesn't have one.\n\t// TODO: Change to GUID.\n\tnamed := req.Message.Name\n\tif named == \"\" && req.Name != \"\" {\n\t\tnamed = req.Name\n\t} else if named == \"\" {\n\t\tnamed = fmt.Sprintf(\"__%d\", time.Now().Unix())\n\t}\n\n\t// Convert the request context (binary) to strings.\n\tcontext := make(map[string]string)\n\tfor key, v := range req.Context {\n\t\tcontext[key] = string(v)\n\t}\n\n\t// Output the object as a JSONMessage\n\treturn &JSONMessage{\n\t\tName: named,\n\t\tDate: time.Unix(req.Message.Header().Timestamp, 0),\n\t\tTo: toProfiles,\n\t\tFrom: fromProfile,\n\t\tPublic: req.Public,\n\t\tComponents: t.fromComponents(req.Message.Components),\n\t\tContext: context,\n\t}\n}", "func parse(b []byte) *Message {\n var servername, nick, user, host string\n var command, target, msg string\n words := bytes.Split(b, bytes.NewBufferString(\" \").Bytes())\n\n if len(words) >= 4 {\n if match, _ := regexp.Match(\"^:\", words[0]); match {\n if match, _ := regexp.Match(\"!|@\", words[0]); match {\n i := 1\n for words[0][i] != '!' { i++ }\n nick = bytes.NewBuffer(words[0][1:i]).String()\n j := i+1\n for words[0][j] != '@' { j++ }\n var wordstart int = i + 1\n if words[0][i+1] == '~' {\n wordstart = i+2\n }\n\n user = bytes.NewBuffer(words[0][wordstart:j]).String()\n k := j+1\n host = bytes.NewBuffer(words[0][k:len(words[0])]).String()\n } else {\n servername = bytes.NewBuffer(words[0][1:len(words[0])]).String()\n }\n }\n command = bytes.NewBuffer(words[1]).String()\n target = bytes.NewBuffer(words[2]).String()\n str := bytes.Join(words[3:len(words)], bytes.NewBufferString(\" \").Bytes())\n msg = bytes.NewBuffer(str[1:len(str)]).String()\n } else {\n if match, _ := regexp.Match(\"PING\", words[0]); match {\n command = \"PING\"\n host= bytes.NewBuffer(words[1][1:len(words[1])]).String()\n fmt.Println(host)\n }\n }\n\n return &Message{\n Servername: servername,\n Nickname: nick,\n Username: user,\n Hostname: host,\n Command: command,\n Target: target,\n Message: msg,\n }\n}", "func (m *Message) UnmarshalJSON(data []byte) error {\n\ttype MessageAlias Message\n\taux := &struct {\n\t\tTime string `json:\"time\"`\n\t\t*MessageAlias\n\t}{\n\t\tMessageAlias: (*MessageAlias)(m),\n\t}\n\tif err := json.Unmarshal(data, &aux); err != nil {\n\t\treturn err\n\t}\n\tmessageTime, _ := time.Parse(time.RFC3339, aux.Time)\n\t_, timeOffset := messageTime.Zone()\n\tm.Time = messageTime.Unix()\n\tm.TZ = timeOffset\n\treturn nil\n}", "func (m *OnlineMeetingInfo) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {\n res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))\n res[\"conferenceId\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetConferenceId(val)\n }\n return nil\n }\n res[\"joinUrl\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetJoinUrl(val)\n }\n return nil\n }\n res[\"@odata.type\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetOdataType(val)\n }\n return nil\n }\n res[\"phones\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetCollectionOfObjectValues(CreatePhoneFromDiscriminatorValue)\n if err != nil {\n return err\n }\n if val != nil {\n res := make([]Phoneable, len(val))\n for i, v := range val {\n if v != nil {\n res[i] = v.(Phoneable)\n }\n }\n m.SetPhones(res)\n }\n return nil\n }\n res[\"quickDial\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetQuickDial(val)\n }\n return nil\n }\n res[\"tollFreeNumbers\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetCollectionOfPrimitiveValues(\"string\")\n if err != nil {\n return err\n }\n if val != nil {\n res := make([]string, len(val))\n for i, v := range val {\n if v != nil {\n res[i] = *(v.(*string))\n }\n }\n m.SetTollFreeNumbers(res)\n }\n return nil\n }\n res[\"tollNumber\"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {\n val, err := n.GetStringValue()\n if err != nil {\n return err\n }\n if val != nil {\n m.SetTollNumber(val)\n }\n return nil\n }\n return res\n}", "func ParseGossipingMessage(gossipRawMsg string) (int, string) {\n\tparams := strings.Split(gossipRawMsg, \",\")\n\tround, _ := strconv.Atoi(params[1])\n\trawMsg := params[2]\n\treturn round, rawMsg\n}", "func newReceivedEventData(amqpMsg *amqp.Message) (*ReceivedEventData, error) {\n\tre := &ReceivedEventData{\n\t\tRawAMQPMessage: newAMQPAnnotatedMessage(amqpMsg),\n\t}\n\n\tif len(amqpMsg.Data) == 1 {\n\t\tre.Body = amqpMsg.Data[0]\n\t}\n\n\tif amqpMsg.Properties != nil {\n\t\tif id, ok := amqpMsg.Properties.MessageID.(string); ok {\n\t\t\tre.MessageID = &id\n\t\t}\n\n\t\tre.ContentType = amqpMsg.Properties.ContentType\n\t\tre.CorrelationID = amqpMsg.Properties.CorrelationID\n\t}\n\n\tif amqpMsg.ApplicationProperties != nil {\n\t\tre.Properties = make(map[string]any, len(amqpMsg.ApplicationProperties))\n\t\tfor key, value := range amqpMsg.ApplicationProperties {\n\t\t\tre.Properties[key] = value\n\t\t}\n\t}\n\n\tif err := updateFromAMQPAnnotations(amqpMsg, re); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn re, nil\n}", "func parseMentions(s *SlackService, msg string) string {\n\tr := regexp.MustCompile(`\\<@(\\w+\\|*\\w+)\\>`)\n\n\treturn r.ReplaceAllStringFunc(\n\t\tmsg, func(str string) string {\n\t\t\trs := r.FindStringSubmatch(str)\n\t\t\tif len(rs) < 1 {\n\t\t\t\treturn str\n\t\t\t}\n\n\t\t\tvar userID string\n\t\t\tsplit := strings.Split(rs[1], \"|\")\n\t\t\tif len(split) > 0 {\n\t\t\t\tuserID = split[0]\n\t\t\t} else {\n\t\t\t\tuserID = rs[1]\n\t\t\t}\n\n\t\t\tname, ok := s.getCachedUser(userID)\n\t\t\tif !ok {\n\t\t\t\tuser, err := s.Client.GetUserInfo(userID)\n\t\t\t\tif err != nil {\n\t\t\t\t\tname = \"unknown\"\n\t\t\t\t\ts.setCachedUser(userID, name)\n\t\t\t\t} else {\n\t\t\t\t\tname = user.Name\n\t\t\t\t\ts.setCachedUser(userID, user.Name)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif name == \"\" {\n\t\t\t\tname = \"unknown\"\n\t\t\t}\n\n\t\t\treturn \"@\" + name\n\t\t},\n\t)\n}", "func (m *TestAllTypes_NestedMessage) UnmarshalFromReader(reader jspb.Reader) *TestAllTypes_NestedMessage {\n\tfor reader.Next() {\n\t\tif m == nil {\n\t\t\tm = &TestAllTypes_NestedMessage{}\n\t\t}\n\n\t\tswitch reader.GetFieldNumber() {\n\t\tcase 1:\n\t\t\tm.B = reader.ReadInt32()\n\t\tdefault:\n\t\t\treader.SkipField()\n\t\t}\n\t}\n\n\treturn m\n}", "func ConvertAnyMessage(m AnyMessage) (ActionMessage, error) {\n\ta := m.Action()\n\tswitch a {\n\t// TODO support other Actions?\n\tcase ActionChatMessage:\n\t\treturn ParseChatMessage(m, a)\n\tcase ActionReadMessage:\n\t\treturn ParseReadMessage(m, a)\n\tcase ActionTypeStart:\n\t\treturn ParseTypeStart(m, a)\n\tcase ActionTypeEnd:\n\t\treturn ParseTypeEnd(m, a)\n\tcase ActionEmpty:\n\t\treturn m, errors.New(\"JSON object must have any action field\")\n\t}\n\treturn m, errors.New(\"unknown action: \" + string(a))\n}", "func ReadAMessage(bufReader *bufio.Reader) (proto.Message, error) {\n\tfirst4bytes, err := bufReader.Peek(4)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tLen, err := readInt32(first4bytes);\n\tif err != nil || Len > MaxLen {\n\t\treturn nil, errors.New(\"first 4 bytes error\")\n\t}\n\n\t// 示例代理不优化性能 TODO\n\trbuf := make([]byte, Len+4 /*include first4bytes*/)\n\n\trn, err := io.ReadFull(bufReader, rbuf)\n\tif err != nil || rn != len(rbuf) {\n\t\treturn nil, err\n\t}\n\n\tcheksum := int32(adler32.Checksum(rbuf[:len(rbuf)-4]))\n\t_ = cheksum\n\n\tpacket := &Packet{}\n\tpacket.Len, _ = readInt32(rbuf[:4])\n\tpacket.NameLen, _ = readInt32(rbuf[4:8])\n\tpacket.TypeName = rbuf[8 : 8+packet.NameLen]\n\tpacket.ProtobufData = rbuf[8+packet.NameLen : len(rbuf)-4]\n\tpacket.CheckSum, _ = readInt32(rbuf[len(rbuf)-4:])\n\n\t// don't check\n\tif cheksum != packet.CheckSum {\n\t\treturn nil, errors.New(\"checksum error\")\n\t}\n\n\t// TypeName 必须是\\0末尾的\n\tvar TypeName string\n\tif len(packet.TypeName) > 0 && (packet.TypeName[len(packet.TypeName)-1] == 0) {\n\t\tTypeName = string(packet.TypeName[:len(packet.TypeName)-1])\n\t} else {\n\t\treturn nil, errors.New(\"TypeName error\")\n\t}\n\n\tmessage, err := createMessage(TypeName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = proto.Unmarshal(packet.ProtobufData, message)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn message, nil\n}" ]
[ "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.52563834", "0.5245065", "0.5237495", "0.52315193", "0.5218193", "0.51945895", "0.5190999", "0.5182672", "0.5176317", "0.51752037", "0.5171208", "0.5164882", "0.5163916", "0.5155302", "0.51267916", "0.510938", "0.5094985", "0.5094597", "0.50751543", "0.50713354", "0.50627863", "0.50585604", "0.5056105", "0.50312686", "0.50180525", "0.50171024", "0.50042546", "0.5002556", "0.50020075", "0.49985254", "0.4987197", "0.49782434", "0.4970739", "0.49505097", "0.49382016", "0.49262315", "0.4924033", "0.49216968", "0.49119496", "0.49089935", "0.49056286", "0.49054986", "0.49031392", "0.4897834", "0.48703635", "0.48690712", "0.48441458", "0.48298225", "0.48168707", "0.48104385", "0.4803759", "0.48026773", "0.4796405", "0.4793484", "0.4792489", "0.47920185", "0.47766376", "0.47737107", "0.47687128", "0.47686595", "0.47602382", "0.47593042", "0.47560665", "0.47497508", "0.47482446", "0.4747314", "0.4745952", "0.47455525", "0.47420967", "0.4740284", "0.47389635", "0.47270417", "0.47254318", "0.47184724", "0.47105876", "0.4706567", "0.47006404", "0.46920952", "0.46907815" ]
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) WithContext(ctx context.Context) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetQuoteGuestCartManagementV1AssignCustomerPutBody(quoteGuestCartManagementV1AssignCustomerPutBody QuoteGuestCartManagementV1AssignCustomerPutBody) {\n\to.QuoteGuestCartManagementV1AssignCustomerPutBody = quoteGuestCartManagementV1AssignCustomerPutBody\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithQuoteGuestCartManagementV1AssignCustomerPutBody(quoteGuestCartManagementV1AssignCustomerPutBody QuoteGuestCartManagementV1AssignCustomerPutBody) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetQuoteGuestCartManagementV1AssignCustomerPutBody(quoteGuestCartManagementV1AssignCustomerPutBody)\n\treturn o\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithHTTPClient(client *http.Client) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithContext(ctx context.Context) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithCartID(cartID string) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetCartID(cartID)\n\treturn o\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) 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\t// path param cartId\n\tif err := r.SetPathParam(\"cartId\", o.CartID); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.QuoteGuestCartManagementV1AssignCustomerPutBody); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewGetIPAMCustomerIDParams() *GetIPAMCustomerIDParams {\n\tvar ()\n\treturn &GetIPAMCustomerIDParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewCreateCustomerTenantsParams() *CreateCustomerTenantsParams {\n\tvar ()\n\treturn &CreateCustomerTenantsParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) WithContext(ctx context.Context) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewAssignUserToCustomerGroupUsingPATCH1Params() *AssignUserToCustomerGroupUsingPATCH1Params {\n\tvar ()\n\treturn &AssignUserToCustomerGroupUsingPATCH1Params{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewCompanyCreditCreditHistoryManagementV1UpdatePutParamsWithHTTPClient(client *http.Client) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\tvar ()\n\treturn &CompanyCreditCreditHistoryManagementV1UpdatePutParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewCompanyCreditCreditHistoryManagementV1UpdatePutParams() *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\tvar ()\n\treturn &CompanyCreditCreditHistoryManagementV1UpdatePutParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewAssignUserToCustomerGroupUsingPATCH1ParamsWithHTTPClient(client *http.Client) *AssignUserToCustomerGroupUsingPATCH1Params {\n\tvar ()\n\treturn &AssignUserToCustomerGroupUsingPATCH1Params{\n\t\tHTTPClient: client,\n\t}\n}", "func (rrc *ReserveRoomCreate) SetCustomer(c *Customer) *ReserveRoomCreate {\n\treturn rrc.SetCustomerID(c.ID)\n}", "func NewCompanyCreditCreditHistoryManagementV1UpdatePutParamsWithTimeout(timeout time.Duration) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\tvar ()\n\treturn &CompanyCreditCreditHistoryManagementV1UpdatePutParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewGetIPAMCustomerIDParamsWithHTTPClient(client *http.Client) *GetIPAMCustomerIDParams {\n\tvar ()\n\treturn &GetIPAMCustomerIDParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewAssignUserToCustomerGroupUsingPATCH1ParamsWithContext(ctx context.Context) *AssignUserToCustomerGroupUsingPATCH1Params {\n\tvar ()\n\treturn &AssignUserToCustomerGroupUsingPATCH1Params{\n\n\t\tContext: ctx,\n\t}\n}", "func NewCreateCustomerTenantsParamsWithHTTPClient(client *http.Client) *CreateCustomerTenantsParams {\n\tvar ()\n\treturn &CreateCustomerTenantsParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (cc *CheckoutCreate) SetCustomer(c *Customer) *CheckoutCreate {\n\treturn cc.SetCustomerID(c.ID)\n}", "func NewAssignUserToCustomerGroupUsingPATCH1ParamsWithTimeout(timeout time.Duration) *AssignUserToCustomerGroupUsingPATCH1Params {\n\tvar ()\n\treturn &AssignUserToCustomerGroupUsingPATCH1Params{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *GetIPAMsubnetsParams) SetCustomer(customer *string) {\n\to.Customer = customer\n}", "func NewListCustomersParams() ListCustomersParams {\n\n\treturn ListCustomersParams{}\n}", "func NewPutZoneParams() *PutZoneParams {\n\tvar ()\n\treturn &PutZoneParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *PostMultiNodeDeviceParams) SetCustomer(customer *string) {\n\to.Customer = customer\n}", "func (o *PcloudIkepoliciesPutParams) WithContext(ctx context.Context) *PcloudIkepoliciesPutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewGetIPAMCustomerIDParamsWithTimeout(timeout time.Duration) *GetIPAMCustomerIDParams {\n\tvar ()\n\treturn &GetIPAMCustomerIDParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *GetIPAMCustomerIDParams) WithContext(ctx context.Context) *GetIPAMCustomerIDParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewPutParams() *PutParams {\n\tvar ()\n\treturn &PutParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (m *CarserviceMutation) SetCustomer(s string) {\n\tm.customer = &s\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) WithHTTPClient(client *http.Client) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) WithContext(ctx context.Context) *AssignUserToCustomerGroupUsingPATCH1Params {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewCompanyCreditCreditHistoryManagementV1UpdatePutParamsWithContext(ctx context.Context) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\tvar ()\n\treturn &CompanyCreditCreditHistoryManagementV1UpdatePutParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewCreateCustomerTenantsParamsWithTimeout(timeout time.Duration) *CreateCustomerTenantsParams {\n\tvar ()\n\treturn &CreateCustomerTenantsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CreateCustomerTenantsParams) WithContext(ctx context.Context) *CreateCustomerTenantsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) WithCompanyCreditCreditHistoryManagementV1UpdatePutBody(companyCreditCreditHistoryManagementV1UpdatePutBody CompanyCreditCreditHistoryManagementV1UpdatePutBody) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\to.SetCompanyCreditCreditHistoryManagementV1UpdatePutBody(companyCreditCreditHistoryManagementV1UpdatePutBody)\n\treturn o\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) WithTimeout(timeout time.Duration) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewQuotePaymentMethodManagementV1SetPutMineParams() *QuotePaymentMethodManagementV1SetPutMineParams {\n\tvar ()\n\treturn &QuotePaymentMethodManagementV1SetPutMineParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (bc *BillCreate) SetCustomer(c *Customer) *BillCreate {\n\treturn bc.SetCustomerID(c.ID)\n}", "func NewPostMeOvhAccountOvhAccountIDCreditOrderParams() *PostMeOvhAccountOvhAccountIDCreditOrderParams {\n\tvar ()\n\treturn &PostMeOvhAccountOvhAccountIDCreditOrderParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (ck *TeamData) PutParams() map[string]string {\n\tt := map[string]string{\n\t\t\"name\": ck.Name,\n\t}\n\n\t// Ignore if not defined\n\tif ck.UserIds != \"\" {\n\t\tt[\"userids\"] = ck.UserIds\n\t}\n\n\treturn t\n}", "func (pc *ProblemCreate) SetCustomer(c *Customer) *ProblemCreate {\n\treturn pc.SetCustomerID(c.ID)\n}", "func (c *Culqi) CreateCustomer(params *CustomerParams) (*Customer, error) {\n\n\tif params == nil {\n\t\treturn nil, fmt.Errorf(\"params are empty\")\n\t}\n\n\treqJSON, err := json.Marshal(params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", defaultBaseURL+\"v2/\"+customerBase, bytes.NewBuffer(reqJSON))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Bearer \"+c.Conf.APIKey)\n\treq.Header.Set(\"User-Agent\", userAgent)\n\n\tresp, err := c.HTTP.Do(req)\n\n\tif resp.StatusCode >= 400 {\n\t\treturn nil, extractError(resp)\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tt := Customer{}\n\n\tif err := json.Unmarshal(body, &t); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &t, nil\n}", "func NewPutBasketsByIDCustomerBadRequest() *PutBasketsByIDCustomerBadRequest {\n\treturn &PutBasketsByIDCustomerBadRequest{}\n}", "func NewPcloudIkepoliciesPutParams() *PcloudIkepoliciesPutParams {\n\treturn &PcloudIkepoliciesPutParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewEstimateCoinBuyParams() *EstimateCoinBuyParams {\n\treturn &EstimateCoinBuyParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *Rental) SetCustomerP(exec boil.Executor, insert bool, related *Customer) {\n\tif err := o.SetCustomer(exec, insert, related); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o *GetIPAMsubnetsParams) WithCustomer(customer *string) *GetIPAMsubnetsParams {\n\to.SetCustomer(customer)\n\treturn o\n}", "func NewPostMeOvhAccountOvhAccountIDCreditOrderParamsWithHTTPClient(client *http.Client) *PostMeOvhAccountOvhAccountIDCreditOrderParams {\n\tvar ()\n\treturn &PostMeOvhAccountOvhAccountIDCreditOrderParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) SetCompanyCreditCreditHistoryManagementV1UpdatePutBody(companyCreditCreditHistoryManagementV1UpdatePutBody CompanyCreditCreditHistoryManagementV1UpdatePutBody) {\n\to.CompanyCreditCreditHistoryManagementV1UpdatePutBody = companyCreditCreditHistoryManagementV1UpdatePutBody\n}", "func NewQuoteBillingAddressManagementV1AssignPostMineOK() *QuoteBillingAddressManagementV1AssignPostMineOK {\n\treturn &QuoteBillingAddressManagementV1AssignPostMineOK{}\n}", "func NewRetrieveCustomerGroupParams() *RetrieveCustomerGroupParams {\n\treturn &RetrieveCustomerGroupParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewAssignPostRequestBody()(*AssignPostRequestBody) {\n m := &AssignPostRequestBody{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "func NewReplacechangeaspecificCustomerRequest(server string, id string, body ReplacechangeaspecificCustomerJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewReplacechangeaspecificCustomerRequestWithBody(server, id, \"application/json\", bodyReader)\n}", "func NewQuotePaymentMethodManagementV1SetPutMineParamsWithHTTPClient(client *http.Client) *QuotePaymentMethodManagementV1SetPutMineParams {\n\tvar ()\n\treturn &QuotePaymentMethodManagementV1SetPutMineParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewQuotePaymentMethodManagementV1SetPutMineParamsWithTimeout(timeout time.Duration) *QuotePaymentMethodManagementV1SetPutMineParams {\n\tvar ()\n\treturn &QuotePaymentMethodManagementV1SetPutMineParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (oiu *OrderInfoUpdate) SetCustomer(c *Customer) *OrderInfoUpdate {\n\treturn oiu.SetCustomerID(c.ID)\n}", "func NewPutBasketsByIDCustomerNotFound() *PutBasketsByIDCustomerNotFound {\n\treturn &PutBasketsByIDCustomerNotFound{}\n}", "func (o *SMSCampaignsCancelBySMSCampaignIDPutParams) WithContext(ctx context.Context) *SMSCampaignsCancelBySMSCampaignIDPutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewPutBasketsByIDCustomerDefault(code int) *PutBasketsByIDCustomerDefault {\n\treturn &PutBasketsByIDCustomerDefault{\n\t\t_statusCode: code,\n\t}\n}", "func NewReplacechangeaspecificCustomerPreferenceRequest(server string, id string, body ReplacechangeaspecificCustomerPreferenceJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewReplacechangeaspecificCustomerPreferenceRequestWithBody(server, id, \"application/json\", bodyReader)\n}", "func NewCustomer(customer map[string]interface{}) (id int64, err error) {\r\n\tif result, err := MaptoInsert(customer, \"customers\"); err == nil {\r\n\t\tif id, err = Insert(result); err != nil {\r\n\t\t\tCheckError(\"Error inserting the Customer(s).\", err, false)\r\n\t\t}\r\n\t} else {\r\n\t\tCheckError(\"Error mapping the Customer(s) to SQL.\", err, false)\r\n\t\treturn 0, err\r\n\t}\r\n\r\n\treturn\r\n}", "func (r *V1Service) InitializeCustomer(initializecustomerrequest *InitializeCustomerRequest) *V1InitializeCustomerCall {\n\tc := &V1InitializeCustomerCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.initializecustomerrequest = initializecustomerrequest\n\treturn c\n}", "func (o *PutParams) WithContext(ctx context.Context) *PutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *CreateCognitoIDPParams) WithContext(ctx context.Context) *CreateCognitoIDPParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewPartnerCustomerCreateRequestWithDefaults() *PartnerCustomerCreateRequest {\n\tthis := PartnerCustomerCreateRequest{}\n\treturn &this\n}", "func (o *PcloudIkepoliciesPutParams) WithDefaults() *PcloudIkepoliciesPutParams {\n\to.SetDefaults()\n\treturn o\n}", "func NewPartnerCustomerCreateRequest(companyName string, isDiligenceAttested bool, products []Products, legalEntityName string, website string, applicationName string, address PartnerEndCustomerAddress, isBankAddendumCompleted bool) *PartnerCustomerCreateRequest {\n\tthis := PartnerCustomerCreateRequest{}\n\tthis.CompanyName = companyName\n\tthis.IsDiligenceAttested = isDiligenceAttested\n\tthis.Products = products\n\tthis.LegalEntityName = legalEntityName\n\tthis.Website = website\n\tthis.ApplicationName = applicationName\n\tthis.Address = address\n\tthis.IsBankAddendumCompleted = isBankAddendumCompleted\n\treturn &this\n}", "func NewUpdateCustomerRequest(server string, id string, body UpdatedCustomer) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewUpdateCustomerRequestWithBody(server, id, \"application/json\", bodyReader)\n}", "func (oiuo *OrderInfoUpdateOne) SetCustomer(c *Customer) *OrderInfoUpdateOne {\n\treturn oiuo.SetCustomerID(c.ID)\n}", "func NewPutClusterForAutoscaleParams() *PutClusterForAutoscaleParams {\n\tvar ()\n\treturn &PutClusterForAutoscaleParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewQuoteBillingAddressManagementV1AssignPostMineBadRequest() *QuoteBillingAddressManagementV1AssignPostMineBadRequest {\n\treturn &QuoteBillingAddressManagementV1AssignPostMineBadRequest{}\n}", "func (o *PostMultiNodeDeviceParams) WithCustomer(customer *string) *PostMultiNodeDeviceParams {\n\to.SetCustomer(customer)\n\treturn o\n}", "func (coc *CoClustering) SetParams(params base.Params) {\n\tcoc.Base.SetParams(params)\n\t// Setup hyper-parameters\n\tcoc.nUserClusters = coc.Params.GetInt(base.NUserClusters, 3)\n\tcoc.nItemClusters = coc.Params.GetInt(base.NItemClusters, 3)\n\tcoc.nEpochs = coc.Params.GetInt(base.NEpochs, 20)\n}", "func (coc *CoClustering) SetParams(params base.Params) {\n\tcoc.Base.SetParams(params)\n\t// Setup hyper-parameters\n\tcoc.nUserClusters = coc.Params.GetInt(base.NUserClusters, 3)\n\tcoc.nItemClusters = coc.Params.GetInt(base.NItemClusters, 3)\n\tcoc.nEpochs = coc.Params.GetInt(base.NEpochs, 20)\n}", "func NewPutProductsNameParams() *PutProductsNameParams {\n\treturn &PutProductsNameParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *PutZoneParams) WithContext(ctx context.Context) *PutZoneParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *CatalogProductRepositoryV1SavePutParams) WithContext(ctx context.Context) *CatalogProductRepositoryV1SavePutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (rrq *ReserveRoomQuery) WithCustomer(opts ...func(*CustomerQuery)) *ReserveRoomQuery {\n\tquery := &CustomerQuery{config: rrq.config}\n\tfor _, opt := range opts {\n\t\topt(query)\n\t}\n\trrq.withCustomer = query\n\treturn rrq\n}", "func NewPutCustomersIdRequest(server string, id string, body PutCustomersIdJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewPutCustomersIdRequestWithBody(server, id, \"application/json\", bodyReader)\n}", "func (o *CreateCustomerTenantsParams) WithCustomerTenant(customerTenant *models.CustomerTenantDetailed) *CreateCustomerTenantsParams {\n\to.SetCustomerTenant(customerTenant)\n\treturn o\n}", "func (o *Rental) SetCustomerGP(insert bool, related *Customer) {\n\tif err := o.SetCustomer(boil.GetDB(), insert, related); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetCartID(cartID string) {\n\to.CartID = cartID\n}", "func NewImportParams() *ImportParams {\n\tp := &ImportParams{}\n\tp.FailOnError.Set(true)\n\treturn p\n}", "func (o *PcloudIkepoliciesPutParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (pc *Participants) CreateCustomer(ctx *helpers.TransactionContext, id string, forename string, surname string, bankID string, companyName string) error {\n\tbank, err := ctx.GetBank(bankID)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcustomer := new(defs.Customer)\n\tcustomer.ID = id\n\tcustomer.Forename = forename\n\tcustomer.Surname = surname\n\tcustomer.Bank = *bank\n\tcustomer.CompanyName = companyName\n\n\treturn ctx.CreateCustomer(customer)\n}", "func NewPcloudIkepoliciesPutParamsWithHTTPClient(client *http.Client) *PcloudIkepoliciesPutParams {\n\treturn &PcloudIkepoliciesPutParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewPutOrdersOrderFidProductsOrderProductFidSetInitialTermParams() *PutOrdersOrderFidProductsOrderProductFidSetInitialTermParams {\n\treturn &PutOrdersOrderFidProductsOrderProductFidSetInitialTermParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewEmployeesByIDContractrulePutParams() *EmployeesByIDContractrulePutParams {\n\tvar ()\n\treturn &EmployeesByIDContractrulePutParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewCompanyACLV1AssignRolesPutOK() *CompanyACLV1AssignRolesPutOK {\n\treturn &CompanyACLV1AssignRolesPutOK{}\n}", "func NewPutZoneParamsWithHTTPClient(client *http.Client) *PutZoneParams {\n\tvar ()\n\treturn &PutZoneParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewSetRoleParams() *SetRoleParams {\n\treturn &SetRoleParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (ct *customer) CreateCustomer(c echo.Context) error {\n\tctx, err := middleware.WellsFarGoContext(c)\n\tif err != nil {\n\t\treturn errors.Wrapf(errs.ErrWellsFarGoContext, \"err : '%s'\", err)\n\t}\n\n\tvar newCustomer model.Customer\n\tif err = ctx.Bind(&newCustomer); err != nil {\n\t\treturn errors.Wrapf(errs.ErrBindRequest, \"err : '%s'\", err)\n\t}\n\n\tcustomer, err := ct.cs.CreateNewCustomer(&newCustomer)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"create new customer\")\n\t}\n\n\treturn ctx.JSON(http.StatusOK, customer)\n}", "func NewPutStackParams() *PutStackParams {\n\tvar ()\n\treturn &PutStackParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}" ]
[ "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.49185053", "0.49107686", "0.48641858", "0.48601303", "0.47215578", "0.46838397", "0.46798962", "0.46705902", "0.46445605", "0.4595828", "0.4586413", "0.45478815", "0.45317686", "0.4509989", "0.45018095", "0.4500242", "0.44846922", "0.4482911", "0.44795823", "0.44617704", "0.44135895", "0.44124135", "0.43927372", "0.43848193", "0.4377848", "0.43604484", "0.43564788", "0.43522406", "0.43209183", "0.43153805", "0.43151647", "0.43038505", "0.42999175", "0.42993644", "0.42975807", "0.42906615", "0.42898086", "0.42795527", "0.42793474", "0.4254944", "0.4246707", "0.4239602", "0.42369458", "0.4228167", "0.42260396", "0.4225902", "0.42200312", "0.41941074", "0.419287", "0.41892374", "0.41840607", "0.4172093", "0.41672936", "0.41594353", "0.41492656", "0.41488466", "0.41389546", "0.41251948", "0.41226238", "0.41068986", "0.41068986", "0.41044995", "0.4098902", "0.40969858", "0.40954792", "0.4080079", "0.40725598", "0.40615174", "0.4050278", "0.40501517", "0.40388218", "0.40347975", "0.40314373", "0.40312123", "0.4027368", "0.40173084", "0.40167764", "0.40157357", "0.40145046", "0.39958522" ]
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}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithContext(ctx context.Context) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *PutParams) WithTimeout(timeout time.Duration) *PutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParams() *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithHTTPClient(client *http.Client) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithHTTPClient(client *http.Client) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewPutZoneParamsWithTimeout(timeout time.Duration) *PutZoneParams {\n\tvar ()\n\treturn &PutZoneParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewPutParamsWithTimeout(timeout time.Duration) *PutParams {\n\tvar ()\n\treturn &PutParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewGetIPAMCustomerIDParamsWithTimeout(timeout time.Duration) *GetIPAMCustomerIDParams {\n\tvar ()\n\treturn &GetIPAMCustomerIDParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) WithTimeout(timeout time.Duration) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewPutZoneParams() *PutZoneParams {\n\tvar ()\n\treturn &PutZoneParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) 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\t// path param cartId\n\tif err := r.SetPathParam(\"cartId\", o.CartID); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.QuoteGuestCartManagementV1AssignCustomerPutBody); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func NewCreateCustomerTenantsParamsWithTimeout(timeout time.Duration) *CreateCustomerTenantsParams {\n\tvar ()\n\treturn &CreateCustomerTenantsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewSetCartDeliveryModeUsingPUTParamsWithTimeout(timeout time.Duration) *SetCartDeliveryModeUsingPUTParams {\n\tvar ()\n\treturn &SetCartDeliveryModeUsingPUTParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *PcloudIkepoliciesPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutZoneParams) WithTimeout(timeout time.Duration) *PutZoneParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *PcloudIkepoliciesPutParams) WithTimeout(timeout time.Duration) *PcloudIkepoliciesPutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *PutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewEditL3ServiceProfileUsingPUTParamsWithTimeout(timeout time.Duration) *EditL3ServiceProfileUsingPUTParams {\n\tvar ()\n\treturn &EditL3ServiceProfileUsingPUTParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CreateCustomerTenantsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewCompanyCreditCreditHistoryManagementV1UpdatePutParamsWithTimeout(timeout time.Duration) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\tvar ()\n\treturn &CompanyCreditCreditHistoryManagementV1UpdatePutParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CreateCustomerTenantsParams) WithTimeout(timeout time.Duration) *CreateCustomerTenantsParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *GetIPAMCustomerIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetIPAMCustomerIDParams) WithTimeout(timeout time.Duration) *GetIPAMCustomerIDParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewPutMenuItemParamsWithTimeout(timeout time.Duration) *PutMenuItemParams {\n\tvar ()\n\treturn &PutMenuItemParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewPutParams() *PutParams {\n\tvar ()\n\treturn &PutParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewPcloudIkepoliciesPutParamsWithTimeout(timeout time.Duration) *PcloudIkepoliciesPutParams {\n\treturn &PcloudIkepoliciesPutParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *PutZoneParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithQuoteGuestCartManagementV1AssignCustomerPutBody(quoteGuestCartManagementV1AssignCustomerPutBody QuoteGuestCartManagementV1AssignCustomerPutBody) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetQuoteGuestCartManagementV1AssignCustomerPutBody(quoteGuestCartManagementV1AssignCustomerPutBody)\n\treturn o\n}", "func NewSetRoleParamsWithTimeout(timeout time.Duration) *SetRoleParams {\n\treturn &SetRoleParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *SMSCampaignsCancelBySMSCampaignIDPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SetCartDeliveryModeUsingPUTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *LedgerVoucherPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EditL3ServiceProfileUsingPUTParams) WithTimeout(timeout time.Duration) *EditL3ServiceProfileUsingPUTParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *CatalogProductRepositoryV1SavePutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewPutCwfNetworkIDParamsWithTimeout(timeout time.Duration) *PutCwfNetworkIDParams {\n\tvar ()\n\treturn &PutCwfNetworkIDParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewPutStackParamsWithTimeout(timeout time.Duration) *PutStackParams {\n\tvar ()\n\treturn &PutStackParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *PortalsPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetQuoteGuestCartManagementV1AssignCustomerPutBody(quoteGuestCartManagementV1AssignCustomerPutBody QuoteGuestCartManagementV1AssignCustomerPutBody) {\n\to.QuoteGuestCartManagementV1AssignCustomerPutBody = quoteGuestCartManagementV1AssignCustomerPutBody\n}", "func (o *EditL3ServiceProfileUsingPUTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCouponParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewPutClusterForAutoscaleParamsWithTimeout(timeout time.Duration) *PutClusterForAutoscaleParams {\n\tvar ()\n\treturn &PutClusterForAutoscaleParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CreateCognitoIDPParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SetCartDeliveryModeUsingPUTParams) WithTimeout(timeout time.Duration) *SetCartDeliveryModeUsingPUTParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewAssignUserToCustomerGroupUsingPATCH1ParamsWithTimeout(timeout time.Duration) *AssignUserToCustomerGroupUsingPATCH1Params {\n\tvar ()\n\treturn &AssignUserToCustomerGroupUsingPATCH1Params{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) WithTimeout(timeout time.Duration) *AssignUserToCustomerGroupUsingPATCH1Params {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewPutNmsUpdateParamsWithTimeout(timeout time.Duration) *PutNmsUpdateParams {\n\treturn &PutNmsUpdateParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewEmployeesByIDContractrulePutParamsWithTimeout(timeout time.Duration) *EmployeesByIDContractrulePutParams {\n\tvar ()\n\treturn &EmployeesByIDContractrulePutParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewAuthorizeV3ParamsWithTimeout(timeout time.Duration) *AuthorizeV3Params {\n\tvar (\n\t\tcodeChallengeMethodDefault = string(\"plain\")\n\t\tresponseTypeDefault = string(\"code\")\n\t\tscopeDefault = string(\"commerce account social publishing analytics\")\n\t)\n\treturn &AuthorizeV3Params{\n\t\tCodeChallengeMethod: &codeChallengeMethodDefault,\n\t\tResponseType: responseTypeDefault,\n\t\tScope: &scopeDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *UpdateZoneProjectsUsingPUTParams) WithTimeout(timeout time.Duration) *UpdateZoneProjectsUsingPUTParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewRetrieveCustomerGroupParamsWithTimeout(timeout time.Duration) *RetrieveCustomerGroupParams {\n\treturn &RetrieveCustomerGroupParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewCustomerGatewayUpdateOwnershipParamsWithTimeout(timeout time.Duration) *CustomerGatewayUpdateOwnershipParams {\n\tvar ()\n\treturn &CustomerGatewayUpdateOwnershipParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *EmployeesByIDContractrulePutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PortalsPutParams) WithTimeout(timeout time.Duration) *PortalsPutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewContainerRenameParamsWithTimeout(timeout time.Duration) *ContainerRenameParams {\n\tvar ()\n\treturn &ContainerRenameParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewUpdateZoneProjectsUsingPUTParamsWithTimeout(timeout time.Duration) *UpdateZoneProjectsUsingPUTParams {\n\treturn &UpdateZoneProjectsUsingPUTParams{\n\t\ttimeout: timeout,\n\t}\n}", "func NewAuthorizeV3ParamsWithTimeout(timeout time.Duration) *AuthorizeV3Params {\n\tvar (\n\t\tcodeChallengeMethodDefault = string(\"plain\")\n\t\tcreateHeadlessDefault = bool(true)\n\t\tscopeDefault = string(\"commerce account social publishing analytics\")\n\t\tuseRedirectUriAsLoginUrlWhenLockedDefault = bool(false)\n\t\tresponseTypeDefault = string(\"code\")\n\t)\n\treturn &AuthorizeV3Params{\n\t\tCodeChallengeMethod: &codeChallengeMethodDefault,\n\t\tCreateHeadless: &createHeadlessDefault,\n\t\tScope: &scopeDefault,\n\t\tUseRedirectURIAsLoginURLWhenLocked: &useRedirectUriAsLoginUrlWhenLockedDefault,\n\t\tResponseType: responseTypeDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateZoneProjectsUsingPUTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCrossConnectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutMenuItemParams) WithTimeout(timeout time.Duration) *PutMenuItemParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *SMSCampaignsCancelBySMSCampaignIDPutParams) WithTimeout(timeout time.Duration) *SMSCampaignsCancelBySMSCampaignIDPutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewPortalsPutParamsWithTimeout(timeout time.Duration) *PortalsPutParams {\n\tvar ()\n\treturn &PortalsPutParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewPutProductsNameParamsWithTimeout(timeout time.Duration) *PutProductsNameParams {\n\treturn &PutProductsNameParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CreateCognitoIDPParams) WithTimeout(timeout time.Duration) *CreateCognitoIDPParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewCreateCrossConnectParamsWithTimeout(timeout time.Duration) *CreateCrossConnectParams {\n\tvar ()\n\treturn &CreateCrossConnectParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewCreateCouponParamsWithTimeout(timeout time.Duration) *CreateCouponParams {\n\tvar ()\n\treturn &CreateCouponParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewProvisionNetworkClientsParamsWithTimeout(timeout time.Duration) *ProvisionNetworkClientsParams {\n\tvar ()\n\treturn &ProvisionNetworkClientsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateInstantPaymentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewContainerUpdateParamsWithTimeout(timeout time.Duration) *ContainerUpdateParams {\n\tvar ()\n\treturn &ContainerUpdateParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *EmployeeEntitlementGrantEntitlementsByTemplateGrantEntitlementsByTemplateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCartUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewCatalogTierPriceStorageV1ReplacePutParamsWithTimeout(timeout time.Duration) *CatalogTierPriceStorageV1ReplacePutParams {\n\tvar ()\n\treturn &CatalogTierPriceStorageV1ReplacePutParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *PostMeOvhAccountOvhAccountIDCreditOrderParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func NewPostMeOvhAccountOvhAccountIDCreditOrderParamsWithTimeout(timeout time.Duration) *PostMeOvhAccountOvhAccountIDCreditOrderParams {\n\tvar ()\n\treturn &PostMeOvhAccountOvhAccountIDCreditOrderParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewSetPlanParamsWithTimeout(timeout time.Duration) *SetPlanParams {\n\tvar ()\n\treturn &SetPlanParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewPutZoneParamsWithHTTPClient(client *http.Client) *PutZoneParams {\n\tvar ()\n\treturn &PutZoneParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *CatalogTierPriceStorageV1ReplacePutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewUpdateIncidentParamsWithTimeout(timeout time.Duration) *UpdateIncidentParams {\n\tvar ()\n\treturn &UpdateIncidentParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewLedgerVoucherPutParamsWithTimeout(timeout time.Duration) *LedgerVoucherPutParams {\n\tvar (\n\t\tsendToLedgerDefault = bool(true)\n\t)\n\treturn &LedgerVoucherPutParams{\n\t\tSendToLedger: &sendToLedgerDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *PcloudIkepoliciesPutParams) WithContext(ctx context.Context) *PcloudIkepoliciesPutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewPutFlagSettingParamsWithTimeout(timeout time.Duration) *PutFlagSettingParams {\n\tvar ()\n\treturn &PutFlagSettingParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CapacityPoolGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *LedgerVoucherPutParams) WithTimeout(timeout time.Duration) *LedgerVoucherPutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *CreateCrossConnectParams) WithTimeout(timeout time.Duration) *CreateCrossConnectParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *SafeContactCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *AuthorizeV3Params) WithTimeout(timeout time.Duration) *AuthorizeV3Params {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *AuthorizeV3Params) WithTimeout(timeout time.Duration) *AuthorizeV3Params {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *EmployeesByIDContractrulePutParams) WithTimeout(timeout time.Duration) *EmployeesByIDContractrulePutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewCloudTargetCreateParamsWithTimeout(timeout time.Duration) *CloudTargetCreateParams {\n\treturn &CloudTargetCreateParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CatalogProductRepositoryV1SavePutParams) WithTimeout(timeout time.Duration) *CatalogProductRepositoryV1SavePutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewUpdateCustomIDPParamsWithTimeout(timeout time.Duration) *UpdateCustomIDPParams {\n\tvar (\n\t\taidDefault = string(\"default\")\n\t\tiidDefault = string(\"default\")\n\t\ttidDefault = string(\"default\")\n\t)\n\treturn &UpdateCustomIDPParams{\n\t\tAid: aidDefault,\n\t\tIid: iidDefault,\n\t\tTid: tidDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CloudTargetCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PetCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewCreateCartUsingPOSTParamsWithTimeout(timeout time.Duration) *CreateCartUsingPOSTParams {\n\tvar (\n\t\tfieldsDefault = string(\"DEFAULT\")\n\t)\n\treturn &CreateCartUsingPOSTParams{\n\t\tFields: &fieldsDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewGetIPAMCustomerIDParams() *GetIPAMCustomerIDParams {\n\tvar ()\n\treturn &GetIPAMCustomerIDParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\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.5619297", "0.561916", "0.56099975", "0.5597064", "0.5558385", "0.5557066", "0.5543386", "0.5530668", "0.55123633", "0.5498366", "0.54945266", "0.5494272", "0.5491131", "0.5473132", "0.5472927", "0.54599136", "0.5450057", "0.5449653", "0.54400074", "0.543077", "0.54226303", "0.5416828", "0.53862137", "0.5379377", "0.53750646", "0.5347125", "0.5334233", "0.5327874", "0.5292467", "0.52907825", "0.5283135", "0.5274573", "0.5259131", "0.5248008", "0.52471876", "0.5243369", "0.52429825", "0.5220414", "0.5218398", "0.5216492", "0.5215547", "0.51893604", "0.51867074", "0.5158109", "0.51451546", "0.514187", "0.5140968", "0.5128501", "0.51226985", "0.5096349", "0.50959885", "0.50869423", "0.5064591", "0.50557065", "0.50530165", "0.5049264", "0.50486964", "0.50366586", "0.5031203", "0.5018618", "0.5011699", "0.5007236", "0.50065154", "0.49978366", "0.49971604", "0.49965167", "0.49948487", "0.4991205", "0.49870637", "0.49853545", "0.49853545", "0.49700448", "0.4955857", "0.4952265", "0.49522042", "0.49365407", "0.49303183", "0.49284953", "0.49249715" ]
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) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParams() *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithQuoteGuestCartManagementV1AssignCustomerPutBody(quoteGuestCartManagementV1AssignCustomerPutBody QuoteGuestCartManagementV1AssignCustomerPutBody) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetQuoteGuestCartManagementV1AssignCustomerPutBody(quoteGuestCartManagementV1AssignCustomerPutBody)\n\treturn o\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetQuoteGuestCartManagementV1AssignCustomerPutBody(quoteGuestCartManagementV1AssignCustomerPutBody QuoteGuestCartManagementV1AssignCustomerPutBody) {\n\to.QuoteGuestCartManagementV1AssignCustomerPutBody = quoteGuestCartManagementV1AssignCustomerPutBody\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithHTTPClient(client *http.Client) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithCartID(cartID string) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetCartID(cartID)\n\treturn o\n}", "func NewGetIPAMCustomerIDParamsWithContext(ctx context.Context) *GetIPAMCustomerIDParams {\n\tvar ()\n\treturn &GetIPAMCustomerIDParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewAssignUserToCustomerGroupUsingPATCH1ParamsWithContext(ctx context.Context) *AssignUserToCustomerGroupUsingPATCH1Params {\n\tvar ()\n\treturn &AssignUserToCustomerGroupUsingPATCH1Params{\n\n\t\tContext: ctx,\n\t}\n}", "func NewCreateCustomerTenantsParamsWithContext(ctx context.Context) *CreateCustomerTenantsParams {\n\tvar ()\n\treturn &CreateCustomerTenantsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewCompanyCreditCreditHistoryManagementV1UpdatePutParamsWithContext(ctx context.Context) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\tvar ()\n\treturn &CompanyCreditCreditHistoryManagementV1UpdatePutParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *GetIPAMCustomerIDParams) WithContext(ctx context.Context) *GetIPAMCustomerIDParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewRetrieveCustomerGroupParamsWithContext(ctx context.Context) *RetrieveCustomerGroupParams {\n\treturn &RetrieveCustomerGroupParams{\n\t\tContext: ctx,\n\t}\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) WithContext(ctx context.Context) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewSetCartDeliveryModeUsingPUTParamsWithContext(ctx context.Context) *SetCartDeliveryModeUsingPUTParams {\n\tvar ()\n\treturn &SetCartDeliveryModeUsingPUTParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewGetIPAMCustomerIDParamsWithHTTPClient(client *http.Client) *GetIPAMCustomerIDParams {\n\tvar ()\n\treturn &GetIPAMCustomerIDParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) 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\t// path param cartId\n\tif err := r.SetPathParam(\"cartId\", o.CartID); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.QuoteGuestCartManagementV1AssignCustomerPutBody); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func NewPutParamsWithContext(ctx context.Context) *PutParams {\n\tvar ()\n\treturn &PutParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewGetIPAMCustomerIDParams() *GetIPAMCustomerIDParams {\n\tvar ()\n\treturn &GetIPAMCustomerIDParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *CreateCustomerTenantsParams) WithContext(ctx context.Context) *CreateCustomerTenantsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *PutParams) WithContext(ctx context.Context) *PutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewEditL3ServiceProfileUsingPUTParamsWithContext(ctx context.Context) *EditL3ServiceProfileUsingPUTParams {\n\tvar ()\n\treturn &EditL3ServiceProfileUsingPUTParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewPcloudIkepoliciesPutParamsWithContext(ctx context.Context) *PcloudIkepoliciesPutParams {\n\treturn &PcloudIkepoliciesPutParams{\n\t\tContext: ctx,\n\t}\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (rrc *ReserveRoomCreate) SetCustomer(c *Customer) *ReserveRoomCreate {\n\treturn rrc.SetCustomerID(c.ID)\n}", "func NewPutZoneParamsWithContext(ctx context.Context) *PutZoneParams {\n\tvar ()\n\treturn &PutZoneParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewPutMenuItemParamsWithContext(ctx context.Context) *PutMenuItemParams {\n\tvar ()\n\treturn &PutMenuItemParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewCreateCustomerTenantsParamsWithHTTPClient(client *http.Client) *CreateCustomerTenantsParams {\n\tvar ()\n\treturn &CreateCustomerTenantsParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewCreateCustomerTenantsParams() *CreateCustomerTenantsParams {\n\tvar ()\n\treturn &CreateCustomerTenantsParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewSMSCampaignsCancelBySMSCampaignIDPutParamsWithContext(ctx context.Context) *SMSCampaignsCancelBySMSCampaignIDPutParams {\n\tvar ()\n\treturn &SMSCampaignsCancelBySMSCampaignIDPutParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *PcloudIkepoliciesPutParams) WithContext(ctx context.Context) *PcloudIkepoliciesPutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (cc *CheckoutCreate) SetCustomer(c *Customer) *CheckoutCreate {\n\treturn cc.SetCustomerID(c.ID)\n}", "func NewSetRoleParamsWithContext(ctx context.Context) *SetRoleParams {\n\treturn &SetRoleParams{\n\t\tContext: ctx,\n\t}\n}", "func NewAssignUserToCustomerGroupUsingPATCH1ParamsWithHTTPClient(client *http.Client) *AssignUserToCustomerGroupUsingPATCH1Params {\n\tvar ()\n\treturn &AssignUserToCustomerGroupUsingPATCH1Params{\n\t\tHTTPClient: client,\n\t}\n}", "func NewPublicInteractiveLoginCredentialParamsWithContext(ctx context.Context) *PublicInteractiveLoginCredentialParams {\n\tvar ()\n\treturn &PublicInteractiveLoginCredentialParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *RetrieveCustomerGroupParams) WithContext(ctx context.Context) *RetrieveCustomerGroupParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewPostMeOvhAccountOvhAccountIDCreditOrderParamsWithContext(ctx context.Context) *PostMeOvhAccountOvhAccountIDCreditOrderParams {\n\tvar ()\n\treturn &PostMeOvhAccountOvhAccountIDCreditOrderParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) WithContext(ctx context.Context) *AssignUserToCustomerGroupUsingPATCH1Params {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewPutStackParamsWithContext(ctx context.Context) *PutStackParams {\n\tvar ()\n\treturn &PutStackParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *SMSCampaignsCancelBySMSCampaignIDPutParams) WithContext(ctx context.Context) *SMSCampaignsCancelBySMSCampaignIDPutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewMetroclusterInterconnectGetParamsWithContext(ctx context.Context) *MetroclusterInterconnectGetParams {\n\treturn &MetroclusterInterconnectGetParams{\n\t\tContext: ctx,\n\t}\n}", "func NewEmployeesByIDContractrulePutParamsWithContext(ctx context.Context) *EmployeesByIDContractrulePutParams {\n\tvar ()\n\treturn &EmployeesByIDContractrulePutParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *SetRoleParams) WithContext(ctx context.Context) *SetRoleParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewSafeContactInfoParamsWithContext(ctx context.Context) *SafeContactInfoParams {\n\tvar ()\n\treturn &SafeContactInfoParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewCompanyCreditCreditHistoryManagementV1UpdatePutParamsWithHTTPClient(client *http.Client) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\tvar ()\n\treturn &CompanyCreditCreditHistoryManagementV1UpdatePutParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewCustomerGatewayUpdateOwnershipParamsWithContext(ctx context.Context) *CustomerGatewayUpdateOwnershipParams {\n\tvar ()\n\treturn &CustomerGatewayUpdateOwnershipParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewSendTransacSMSParamsWithContext(ctx context.Context) *SendTransacSMSParams {\n\tvar ()\n\treturn &SendTransacSMSParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *SMSCampaignsCancelBySMSCampaignIDPutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func NewSyncCmOnDatalakeClusterParamsWithContext(ctx context.Context) *SyncCmOnDatalakeClusterParams {\n\tvar ()\n\treturn &SyncCmOnDatalakeClusterParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewAssignUserToCustomerGroupUsingPATCH1Params() *AssignUserToCustomerGroupUsingPATCH1Params {\n\tvar ()\n\treturn &AssignUserToCustomerGroupUsingPATCH1Params{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewGetIPAMCustomerIDParamsWithTimeout(timeout time.Duration) *GetIPAMCustomerIDParams {\n\tvar ()\n\treturn &GetIPAMCustomerIDParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewQuotePaymentMethodManagementV1SetPutMineParamsWithContext(ctx context.Context) *QuotePaymentMethodManagementV1SetPutMineParams {\n\tvar ()\n\treturn &QuotePaymentMethodManagementV1SetPutMineParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewUpdateZoneProjectsUsingPUTParamsWithContext(ctx context.Context) *UpdateZoneProjectsUsingPUTParams {\n\treturn &UpdateZoneProjectsUsingPUTParams{\n\t\tContext: ctx,\n\t}\n}", "func (m *CarserviceMutation) SetCustomer(s string) {\n\tm.customer = &s\n}", "func (o *GetIPAMsubnetsParams) SetCustomer(customer *string) {\n\to.Customer = customer\n}", "func (o *CatalogProductRepositoryV1SavePutParams) WithContext(ctx context.Context) *CatalogProductRepositoryV1SavePutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewListCustomersParams() ListCustomersParams {\n\n\treturn ListCustomersParams{}\n}", "func NewPutClusterForAutoscaleParamsWithContext(ctx context.Context) *PutClusterForAutoscaleParams {\n\tvar ()\n\treturn &PutClusterForAutoscaleParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (bc *BillCreate) SetCustomer(c *Customer) *BillCreate {\n\treturn bc.SetCustomerID(c.ID)\n}", "func (o *CreateCognitoIDPParams) WithContext(ctx context.Context) *CreateCognitoIDPParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewEstimateCoinBuyParamsWithContext(ctx context.Context) *EstimateCoinBuyParams {\n\treturn &EstimateCoinBuyParams{\n\t\tContext: ctx,\n\t}\n}", "func (c *ECS) PutClusterCapacityProvidersWithContext(ctx aws.Context, input *PutClusterCapacityProvidersInput, opts ...request.Option) (*PutClusterCapacityProvidersOutput, error) {\n\treq, out := c.PutClusterCapacityProvidersRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (o *PcloudIkepoliciesPutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func NewPutFlagSettingParamsWithContext(ctx context.Context) *PutFlagSettingParams {\n\tvar ()\n\treturn &PutFlagSettingParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewGetPortfolioAccountIDPositionConidParamsWithContext(ctx context.Context) *GetPortfolioAccountIDPositionConidParams {\n\tvar ()\n\treturn &GetPortfolioAccountIDPositionConidParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewCatalogProductRepositoryV1SavePutParamsWithContext(ctx context.Context) *CatalogProductRepositoryV1SavePutParams {\n\tvar ()\n\treturn &CatalogProductRepositoryV1SavePutParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewAuthorizeV3ParamsWithContext(ctx context.Context) *AuthorizeV3Params {\n\tvar (\n\t\tcodeChallengeMethodDefault = string(\"plain\")\n\t\tresponseTypeDefault = string(\"code\")\n\t\tscopeDefault = string(\"commerce account social publishing analytics\")\n\t)\n\treturn &AuthorizeV3Params{\n\t\tCodeChallengeMethod: &codeChallengeMethodDefault,\n\t\tResponseType: responseTypeDefault,\n\t\tScope: &scopeDefault,\n\n\t\tContext: ctx,\n\t}\n}", "func NewGetRequestDetailsParamsWithContext(ctx context.Context) *GetRequestDetailsParams {\n\tvar ()\n\treturn &GetRequestDetailsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (rrq *ReserveRoomQuery) WithCustomer(opts ...func(*CustomerQuery)) *ReserveRoomQuery {\n\tquery := &CustomerQuery{config: rrq.config}\n\tfor _, opt := range opts {\n\t\topt(query)\n\t}\n\trrq.withCustomer = query\n\treturn rrq\n}", "func NewCreateCognitoIDPParamsWithContext(ctx context.Context) *CreateCognitoIDPParams {\n\tvar (\n\t\taidDefault = string(\"default\")\n\t\ttidDefault = string(\"default\")\n\t)\n\treturn &CreateCognitoIDPParams{\n\t\tAid: aidDefault,\n\t\tTid: tidDefault,\n\n\t\tContext: ctx,\n\t}\n}", "func NewProvisionNetworkClientsParamsWithContext(ctx context.Context) *ProvisionNetworkClientsParams {\n\tvar ()\n\treturn &ProvisionNetworkClientsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewPutCwfNetworkIDParamsWithContext(ctx context.Context) *PutCwfNetworkIDParams {\n\tvar ()\n\treturn &PutCwfNetworkIDParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewAPIServiceEstimateCoinBuyParamsWithContext(ctx context.Context) *APIServiceEstimateCoinBuyParams {\n\tvar ()\n\treturn &APIServiceEstimateCoinBuyParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewPortalsPutParamsWithContext(ctx context.Context) *PortalsPutParams {\n\tvar ()\n\treturn &PortalsPutParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *PostMultiNodeDeviceParams) SetCustomer(customer *string) {\n\to.Customer = customer\n}", "func (o *CatalogProductRepositoryV1SavePutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func NewCompanyCreditCreditHistoryManagementV1UpdatePutParams() *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\tvar ()\n\treturn &CompanyCreditCreditHistoryManagementV1UpdatePutParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *GetIPAMCustomerIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (pc *ProblemCreate) SetCustomer(c *Customer) *ProblemCreate {\n\treturn pc.SetCustomerID(c.ID)\n}", "func (oiu *OrderInfoUpdate) SetCustomer(c *Customer) *OrderInfoUpdate {\n\treturn oiu.SetCustomerID(c.ID)\n}", "func (o *PutMenuItemParams) WithContext(ctx context.Context) *PutMenuItemParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *PutZoneParams) WithContext(ctx context.Context) *PutZoneParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewPutNmsUpdateParamsWithContext(ctx context.Context) *PutNmsUpdateParams {\n\treturn &PutNmsUpdateParams{\n\t\tContext: ctx,\n\t}\n}", "func (o *GetIPAMsubnetsParams) WithCustomer(customer *string) *GetIPAMsubnetsParams {\n\to.SetCustomer(customer)\n\treturn o\n}", "func NewConversationsSendToConversationParamsWithContext(ctx context.Context) *ConversationsSendToConversationParams {\n\tvar ()\n\treturn &ConversationsSendToConversationParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewPutProductsNameParamsWithContext(ctx context.Context) *PutProductsNameParams {\n\treturn &PutProductsNameParams{\n\t\tContext: ctx,\n\t}\n}", "func NewRetrieveCustomerGroupParamsWithHTTPClient(client *http.Client) *RetrieveCustomerGroupParams {\n\treturn &RetrieveCustomerGroupParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewGetSearchClinicsParamsWithContext(ctx context.Context) *GetSearchClinicsParams {\n\tvar ()\n\treturn &GetSearchClinicsParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *Rental) SetCustomerP(exec boil.Executor, insert bool, related *Customer) {\n\tif err := o.SetCustomer(exec, insert, related); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o *GetIPAMCustomerIDParams) WithHTTPClient(client *http.Client) *GetIPAMCustomerIDParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewLedgerVoucherPutParamsWithContext(ctx context.Context) *LedgerVoucherPutParams {\n\tvar (\n\t\tsendToLedgerDefault = bool(true)\n\t)\n\treturn &LedgerVoucherPutParams{\n\t\tSendToLedger: &sendToLedgerDefault,\n\n\t\tContext: ctx,\n\t}\n}", "func NewEavAttributeSetRepositoryV1GetGetParamsWithContext(ctx context.Context) *EavAttributeSetRepositoryV1GetGetParams {\n\tvar ()\n\treturn &EavAttributeSetRepositoryV1GetGetParams{\n\n\t\tContext: ctx,\n\t}\n}", "func NewCreatePolicyResetItemParamsWithContext(ctx context.Context) *CreatePolicyResetItemParams {\n\tvar ()\n\treturn &CreatePolicyResetItemParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *EmployeesByIDContractrulePutParams) WithContext(ctx context.Context) *EmployeesByIDContractrulePutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *QuotePaymentMethodManagementV1SetPutMineParams) WithContext(ctx context.Context) *QuotePaymentMethodManagementV1SetPutMineParams {\n\to.SetContext(ctx)\n\treturn o\n}" ]
[ "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.5182346", "0.51340234", "0.51028883", "0.5055446", "0.50181454", "0.49453634", "0.4938471", "0.48789322", "0.48355797", "0.48223653", "0.47624156", "0.4761446", "0.47237015", "0.47181287", "0.4692122", "0.46666297", "0.4645406", "0.46356127", "0.46195182", "0.4614289", "0.46100745", "0.46027732", "0.45978874", "0.45783216", "0.4571221", "0.45671165", "0.45607707", "0.4553059", "0.45327342", "0.45313904", "0.45182642", "0.45155844", "0.44993693", "0.44921798", "0.44785643", "0.44657922", "0.4464909", "0.44647884", "0.44576854", "0.4431789", "0.4427137", "0.442685", "0.44009918", "0.4392728", "0.4389755", "0.43853274", "0.43788478", "0.4375104", "0.4374736", "0.43712145", "0.43398076", "0.43351883", "0.43305823", "0.4327575", "0.43272042", "0.43246916", "0.4323749", "0.43236074", "0.43216628", "0.43093255", "0.4307972", "0.4302851", "0.43012005", "0.4296998", "0.42932546", "0.42929912", "0.42722502", "0.42661104", "0.42636955", "0.4261524", "0.42454106", "0.42408225", "0.4236028", "0.4229334", "0.42262655", "0.42253724", "0.42235222", "0.42207873", "0.42105216", "0.42086223" ]
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 = client\n}", "func (o *PutParams) WithHTTPClient(client *http.Client) *PutParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithContext(ctx context.Context) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewPutParamsWithHTTPClient(client *http.Client) *PutParams {\n\tvar ()\n\treturn &PutParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParams() *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *PcloudIkepoliciesPutParams) WithHTTPClient(client *http.Client) *PcloudIkepoliciesPutParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PcloudIkepoliciesPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithQuoteGuestCartManagementV1AssignCustomerPutBody(quoteGuestCartManagementV1AssignCustomerPutBody QuoteGuestCartManagementV1AssignCustomerPutBody) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetQuoteGuestCartManagementV1AssignCustomerPutBody(quoteGuestCartManagementV1AssignCustomerPutBody)\n\treturn o\n}", "func (o *CatalogProductRepositoryV1SavePutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewPutStackParamsWithHTTPClient(client *http.Client) *PutStackParams {\n\tvar ()\n\treturn &PutStackParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *EditL3ServiceProfileUsingPUTParams) WithHTTPClient(client *http.Client) *EditL3ServiceProfileUsingPUTParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewPutZoneParamsWithHTTPClient(client *http.Client) *PutZoneParams {\n\tvar ()\n\treturn &PutZoneParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *PortalsPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetQuoteGuestCartManagementV1AssignCustomerPutBody(quoteGuestCartManagementV1AssignCustomerPutBody QuoteGuestCartManagementV1AssignCustomerPutBody) {\n\to.QuoteGuestCartManagementV1AssignCustomerPutBody = quoteGuestCartManagementV1AssignCustomerPutBody\n}", "func (o *EditL3ServiceProfileUsingPUTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SMSCampaignsCancelBySMSCampaignIDPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) WithHTTPClient(client *http.Client) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *PortalsPutParams) WithHTTPClient(client *http.Client) *PortalsPutParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *LedgerVoucherPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SetCartDeliveryModeUsingPUTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EmployeeEntitlementGrantEntitlementsByTemplateGrantEntitlementsByTemplateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCognitoIDPParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutMenuItemParams) WithHTTPClient(client *http.Client) *PutMenuItemParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewPutMenuItemParamsWithHTTPClient(client *http.Client) *PutMenuItemParams {\n\tvar ()\n\treturn &PutMenuItemParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *EmployeesByIDContractrulePutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateZoneProjectsUsingPUTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutZoneParams) WithHTTPClient(client *http.Client) *PutZoneParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *CreateCustomerTenantsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutZoneParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewProvisionNetworkClientsParamsWithHTTPClient(client *http.Client) *ProvisionNetworkClientsParams {\n\tvar ()\n\treturn &ProvisionNetworkClientsParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *SetCartDeliveryModeUsingPUTParams) WithHTTPClient(client *http.Client) *SetCartDeliveryModeUsingPUTParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *GetIPAMCustomerIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCognitoIDPParams) WithHTTPClient(client *http.Client) *CreateCognitoIDPParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *PutStackParams) WithHTTPClient(client *http.Client) *PutStackParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewSetRoleParamsWithHTTPClient(client *http.Client) *SetRoleParams {\n\treturn &SetRoleParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewEditL3ServiceProfileUsingPUTParamsWithHTTPClient(client *http.Client) *EditL3ServiceProfileUsingPUTParams {\n\tvar ()\n\treturn &EditL3ServiceProfileUsingPUTParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *GetIPAMCustomerIDParams) WithHTTPClient(client *http.Client) *GetIPAMCustomerIDParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *PostMeOvhAccountOvhAccountIDCreditOrderParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewGetIPAMCustomerIDParamsWithHTTPClient(client *http.Client) *GetIPAMCustomerIDParams {\n\tvar ()\n\treturn &GetIPAMCustomerIDParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *CreateCouponParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *LedgerVoucherPutParams) WithHTTPClient(client *http.Client) *LedgerVoucherPutParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *UpdateZoneProjectsUsingPUTParams) WithHTTPClient(client *http.Client) *UpdateZoneProjectsUsingPUTParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *CreateCrossConnectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewPortalsPutParamsWithHTTPClient(client *http.Client) *PortalsPutParams {\n\tvar ()\n\treturn &PortalsPutParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewSetCartDeliveryModeUsingPUTParamsWithHTTPClient(client *http.Client) *SetCartDeliveryModeUsingPUTParams {\n\tvar ()\n\treturn &SetCartDeliveryModeUsingPUTParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *AuthorizeV3Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AuthorizeV3Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateInstantPaymentParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PetCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CatalogTierPriceStorageV1ReplacePutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCustomerTenantsParams) WithHTTPClient(client *http.Client) *CreateCustomerTenantsParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewPcloudIkepoliciesPutParamsWithHTTPClient(client *http.Client) *PcloudIkepoliciesPutParams {\n\treturn &PcloudIkepoliciesPutParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *CatalogProductTierPriceManagementV1AddPostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewSetPlanParamsWithHTTPClient(client *http.Client) *SetPlanParams {\n\tvar ()\n\treturn &SetPlanParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *CatalogProductRepositoryV1SavePutParams) WithHTTPClient(client *http.Client) *CatalogProductRepositoryV1SavePutParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *PcloudV1CloudinstancesCosimagesPostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PcloudSystempoolsGetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *APIServiceEstimateCoinBuyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SafeContactCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EstimateCoinBuyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCartUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutStackParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *BatchUpsertCatalogObjectsParams) WithHTTPClient(client *http.Client) *BatchUpsertCatalogObjectsParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *CheckoutPaymentInformationManagementV1SavePaymentInformationAndPlaceOrderPostMineParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CapacityPoolGetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *QuotePaymentMethodManagementV1SetPutMineParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(httpClient *http.Client) ClientOption {\n\treturn func(c *client) error {\n\t\tif httpClient == nil {\n\t\t\treturn errors.InvalidParameterError{Parameter: \"httpClient\", Reason: \"cannot be empty\"}\n\t\t}\n\n\t\tc.requester.Client = httpClient\n\t\treturn nil\n\t}\n}", "func NewCreateCustomerTenantsParamsWithHTTPClient(client *http.Client) *CreateCustomerTenantsParams {\n\tvar ()\n\treturn &CreateCustomerTenantsParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *EditParams) WithHTTPClient(client *http.Client) *EditParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *BatchUpsertCatalogObjectsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewPutClusterForAutoscaleParamsWithHTTPClient(client *http.Client) *PutClusterForAutoscaleParams {\n\tvar ()\n\treturn &PutClusterForAutoscaleParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *PutCwfNetworkIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *IntegrationsManualHTTPSCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutMenuItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateTokenParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewEditParamsWithHTTPClient(client *http.Client) *EditParams {\n\treturn &EditParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *AuthorizeV3Params) WithHTTPClient(client *http.Client) *AuthorizeV3Params {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *AuthorizeV3Params) WithHTTPClient(client *http.Client) *AuthorizeV3Params {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *CloudTargetCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PublicWebLinkPlatformEstablishParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ProvisionNetworkClientsParams) WithHTTPClient(client *http.Client) *ProvisionNetworkClientsParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewWithHTTPClient(env common.Environment, apiKey string, processingChannelId *string, httpClient *http.Client) *CheckoutComClient {\n\treturn &CheckoutComClient{\n\t\tapiKey: apiKey,\n\t\thttpClient: httpClient,\n\t\tenv: GetEnv(env),\n\t\tprocessingChannelId: processingChannelId,\n\t}\n}", "func (o *TicketProjectsImportProjectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewPutCwfNetworkIDParamsWithHTTPClient(client *http.Client) *PutCwfNetworkIDParams {\n\tvar ()\n\treturn &PutCwfNetworkIDParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *CreateCrossConnectParams) WithHTTPClient(client *http.Client) *CreateCrossConnectParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *CreatePublicIPAdressUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreatePolicyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostAPIV10PeerReviewsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SMSCampaignsCancelBySMSCampaignIDPutParams) WithHTTPClient(client *http.Client) *SMSCampaignsCancelBySMSCampaignIDPutParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *SupplierInvoiceForApprovalGetApprovalInvoicesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *IgroupInitiatorCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithContext(ctx context.Context) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *SetPlanParams) WithHTTPClient(client *http.Client) *SetPlanParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *PutProductsNameParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}" ]
[ "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.60136515", "0.60104966", "0.60066617", "0.5978497", "0.5969105", "0.5956123", "0.5939714", "0.59149206", "0.5878935", "0.58691436", "0.5838003", "0.5823639", "0.58121526", "0.5807339", "0.57960397", "0.57925856", "0.579219", "0.57803226", "0.5778894", "0.57609195", "0.5746868", "0.57293475", "0.57069385", "0.56913453", "0.5689412", "0.5657855", "0.5644607", "0.5632976", "0.56153476", "0.56129754", "0.5593269", "0.5593269", "0.55929923", "0.55901206", "0.5579903", "0.55716205", "0.55684143", "0.55622923", "0.5557182", "0.555252", "0.5541785", "0.5539978", "0.55378264", "0.55312806", "0.5531174", "0.5499423", "0.54991484", "0.5497931", "0.54948455", "0.5485391", "0.5482426", "0.5474252", "0.54730123", "0.5471136", "0.5468113", "0.5462921", "0.5458086", "0.5450443", "0.5422503", "0.54188716", "0.5416635", "0.5408616", "0.5397656", "0.5397656", "0.539486", "0.53924036", "0.5384685", "0.5382308", "0.53750795", "0.53744495", "0.5370984", "0.53669596", "0.5360309", "0.5359509", "0.53509474", "0.5345914", "0.5342954", "0.5333545", "0.5325211", "0.5323581" ]
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.timeout = timeout\n}", "func (o *SetCartDeliveryModeUsingPUTParams) WithTimeout(timeout time.Duration) *SetCartDeliveryModeUsingPUTParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *PutParams) WithTimeout(timeout time.Duration) *PutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *LedgerVoucherPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCartUsingPOSTParams) WithTimeout(timeout time.Duration) *CreateCartUsingPOSTParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *PutProductsNameParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutMenuItemParams) WithTimeout(timeout time.Duration) *PutMenuItemParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func WithTimeout(ctx context.Context, time time.Duration) (ret context.Context) {\n\tret = context.WithValue(ctx, liverpc.KeyTimeout, time)\n\treturn\n}", "func (o *PostMeOvhAccountOvhAccountIDCreditOrderParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *PcloudIkepoliciesPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCustomerTenantsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *StoreProductParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PcloudIkepoliciesPutParams) WithTimeout(timeout time.Duration) *PcloudIkepoliciesPutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *CreateCouponParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateInstantPaymentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EditL3ServiceProfileUsingPUTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CatalogProductRepositoryV1SavePutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (s *Store) SetWithTimeout(ctx context.Context, key interface{}, v json.Marshaler, timeout time.Duration) error {\n\treturn s.SetWithDeadline(ctx, key, v, time.Now().Add(timeout))\n}", "func (o *PutZoneParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetAnOrderProductParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewSetCartDeliveryModeUsingPUTParamsWithTimeout(timeout time.Duration) *SetCartDeliveryModeUsingPUTParams {\n\tvar ()\n\treturn &SetCartDeliveryModeUsingPUTParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *PutZoneParams) WithTimeout(timeout time.Duration) *PutZoneParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (c *CentralCacheTestImpl) SetWithTimeout(item Item, serialize bool, compress bool, ttl int32) error {\n\treturn nil\n}", "func (o *PutMenuItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetIPAMCustomerIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PortalsPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *QuotePaymentMethodManagementV1SetPutMineParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EmployeesByIDContractrulePutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CatalogTierPriceStorageV1ReplacePutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutProductsNameParams) WithTimeout(timeout time.Duration) *PutProductsNameParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *CatalogProductTierPriceManagementV1AddPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCognitoIDPParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EstimateCoinBuyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *LedgerVoucherPutParams) WithTimeout(timeout time.Duration) *LedgerVoucherPutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func NewPutZoneParamsWithTimeout(timeout time.Duration) *PutZoneParams {\n\tvar ()\n\treturn &PutZoneParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *PutStackParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EditL3ServiceProfileUsingPUTParams) WithTimeout(timeout time.Duration) *EditL3ServiceProfileUsingPUTParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func WithTimeout(t time.Duration) apiOption {\n\treturn func(m *Management) {\n\t\tm.timeout = t\n\t}\n}", "func (o *APIServiceEstimateCoinBuyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ChargeAddonInvoiceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetProductsByIDPromotionsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateZoneProjectsUsingPUTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GiftMessageCartRepositoryV1SavePostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CheckoutPaymentInformationManagementV1SavePaymentInformationAndPlaceOrderPostMineParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SMSCampaignsCancelBySMSCampaignIDPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutTravelExpensePassengerIDParams) WithTimeout(timeout time.Duration) *PutTravelExpensePassengerIDParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *GetProductsCodeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutStackParams) WithTimeout(timeout time.Duration) *PutStackParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *CreateChannelSpacesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *QueueCommandUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SkuPackPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewPutMenuItemParamsWithTimeout(timeout time.Duration) *PutMenuItemParams {\n\tvar ()\n\treturn &PutMenuItemParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CreateMigrationInvoiceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetBundleByKeyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCrossConnectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RegenerateDeployKeyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *InventoryStocktakingSearchParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (c *OrganizationsEnvironmentsApisRevisionsDebugsessionsCreateCall) Timeout(timeout int64) *OrganizationsEnvironmentsApisRevisionsDebugsessionsCreateCall {\n\tc.urlParams_.Set(\"timeout\", fmt.Sprint(timeout))\n\treturn c\n}", "func (o *PutCwfNetworkIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetPrivateOrderstateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateOrganizationBillingAddressParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SetPlanParams) WithTimeout(timeout time.Duration) *SetPlanParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *GetReceiptsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EmployeeEntitlementGrantEntitlementsByTemplateGrantEntitlementsByTemplateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GiftRegistryGuestCartShippingMethodManagementV1EstimateByRegistryIDPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *InventoryStocktakingSearchParams) WithTimeout(timeout time.Duration) *InventoryStocktakingSearchParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *GetInstrumentsInstrumentOrderBookParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewCreateCartUsingPOSTParamsWithTimeout(timeout time.Duration) *CreateCartUsingPOSTParams {\n\tvar (\n\t\tfieldsDefault = string(\"DEFAULT\")\n\t)\n\treturn &CreateCartUsingPOSTParams{\n\t\tFields: &fieldsDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *StoreProductParams) WithTimeout(timeout time.Duration) *StoreProductParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *PutTravelExpensePassengerIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PortalsPutParams) WithTimeout(timeout time.Duration) *PortalsPutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CatalogTierPriceStorageV1ReplacePutParams) WithTimeout(timeout time.Duration) *CatalogTierPriceStorageV1ReplacePutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *SafeContactCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PayAllInvoicesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PayAllInvoicesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateCustomIDPParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreatePublicIPAdressUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateInstantPaymentParams) WithTimeout(timeout time.Duration) *CreateInstantPaymentParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *AddItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *BudgetAddParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func Put(key string, val interface{}, timeout time.Duration) error {\n\tif C != nil {\n\t\treturn C.Put(key, val, timeout)\n\t}\n\treturn nil\n}", "func (o *CreateCardPaymentSourceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCustomerTenantsParams) WithTimeout(timeout time.Duration) *CreateCustomerTenantsParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *ExportProductsUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RevertProductSnapshotRequestUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateStockReceiptParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetOrderParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetRemotesupportConnectemcParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func NewPutStackParamsWithTimeout(timeout time.Duration) *PutStackParams {\n\tvar ()\n\treturn &PutStackParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewPutProductsNameParamsWithTimeout(timeout time.Duration) *PutProductsNameParams {\n\treturn &PutProductsNameParams{\n\t\ttimeout: timeout,\n\t}\n}", "func (o *PetCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) 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\t// path param cartId\n\tif err := r.SetPathParam(\"cartId\", o.CartID); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.QuoteGuestCartManagementV1AssignCustomerPutBody); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SupplierInvoiceForApprovalGetApprovalInvoicesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}" ]
[ "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.56080216", "0.559647", "0.55601317", "0.5555261", "0.5537446", "0.5537149", "0.55235296", "0.54944605", "0.54850024", "0.5479243", "0.544046", "0.5410509", "0.54062563", "0.5401076", "0.5398998", "0.539887", "0.5397498", "0.538136", "0.53612065", "0.53503454", "0.53434676", "0.5332909", "0.531682", "0.5289678", "0.5286653", "0.5282142", "0.5249889", "0.520982", "0.52086633", "0.52028424", "0.51947016", "0.51891875", "0.5188914", "0.51726484", "0.5158599", "0.51480937", "0.5132267", "0.5129108", "0.51242095", "0.5122131", "0.5119448", "0.509696", "0.5094646", "0.50863653", "0.50855684", "0.5085507", "0.5084734", "0.5080151", "0.5070838", "0.5070529", "0.5070324", "0.50631505", "0.5057633", "0.5055611", "0.5052648", "0.5051172", "0.50489384", "0.5048857", "0.50425434", "0.50303006", "0.50303006", "0.50300986", "0.5007313", "0.5005004", "0.50047094", "0.5003687", "0.49994192", "0.499671", "0.49963343", "0.49953753", "0.49930835", "0.49899504", "0.49856877", "0.49849114", "0.4984035", "0.49661016", "0.4964756", "0.49642143", "0.49608728" ]
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}", "func (o *StoreProductParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostMeOvhAccountOvhAccountIDCreditOrderParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *LedgerVoucherPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetAnOrderProductParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetIPAMCustomerIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCustomerTenantsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutZoneParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PcloudIkepoliciesPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CatalogProductRepositoryV1SavePutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateInstantPaymentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutMenuItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCouponParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ChargeAddonInvoiceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CatalogProductTierPriceManagementV1AddPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EditL3ServiceProfileUsingPUTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetProductsByIDPromotionsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EstimateCoinBuyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PortalsPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetPrivateOrderstateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CatalogTierPriceStorageV1ReplacePutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GiftMessageCartRepositoryV1SavePostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetRemotesupportConnectemcParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetProductsCodeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetReceiptsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *PutStackParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCognitoIDPParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EmployeesByIDContractrulePutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *QueueCommandUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *APIServiceEstimateCoinBuyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateMigrationInvoiceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutCwfNetworkIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetGCParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CheckoutPaymentInformationManagementV1SavePaymentInformationAndPlaceOrderPostMineParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RegenerateDeployKeyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateOrganizationBillingAddressParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *QuotePaymentMethodManagementV1SetPutMineParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SkuPackPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateCustomIDPParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateStockReceiptParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *InventoryStocktakingSearchParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutTravelExpensePassengerIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateChannelSpacesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateCrossConnectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (pool *ComplexPool) SetTimeout(timeout time.Duration) {\n\tlogger.Debugf(\"prox (%p): setting timeout: %v\", pool, timeout)\n\tpool.timeout = timeout\n}", "func (o *GetBundleByKeyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetOrderParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GiftRegistryGuestCartShippingMethodManagementV1EstimateByRegistryIDPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *RevertProductSnapshotRequestUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetInstrumentsInstrumentOrderBookParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *BatchUpsertCatalogObjectsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *ExportProductsUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SendTransacSMSParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SetPlanParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateZoneProjectsUsingPUTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SetCartDeliveryModeUsingPUTParams) WithTimeout(timeout time.Duration) *SetCartDeliveryModeUsingPUTParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *AddVMParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetBillingOrgIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PayAllInvoicesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PayAllInvoicesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetCurrentGenerationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutFlagSettingParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (m *RedirectPostRequestBody) SetTimeout(value *int32)() {\n m.timeout = value\n}", "func (o *CreateCardPaymentSourceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SharedCatalogSharedCatalogRepositoryV1SavePostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *APIServiceSendTransactionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostLolRsoAuthV1AuthorizationGasParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PcloudV1CloudinstancesCosimagesPostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PutLolPerksV1CurrentpageParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *StartGatewayBundleUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PostHyperflexAutoSupportPoliciesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CustomerGatewayUpdateOwnershipParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PcloudSystempoolsGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EditParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *BundleProductOptionManagementV1SavePostParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetCatalogXMLParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SupplierInvoiceForApprovalGetApprovalInvoicesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *AddItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *FreezeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *AddOrUpdateNodePoolConfigItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EmployeeEntitlementGrantEntitlementsByTemplateGrantEntitlementsByTemplateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetNutritionForSingleParsedPlainTextIngredientParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CreatePolicyResetItemParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PopContainerToDebugParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SizeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *SMSCampaignsCancelBySMSCampaignIDPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetProductsByIDVariationAttributesByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *UpdateDeploymentTargetSpacesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *EstimateCoinSellParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetPrivateGetOpenOrdersByCurrencyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *PatchSepainstantIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CheckTransactionCreditLimitParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}" ]
[ "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.6386551", "0.63860303", "0.63513106", "0.633519", "0.6324522", "0.632436", "0.63187665", "0.63134336", "0.6312129", "0.6305425", "0.6298286", "0.6291459", "0.6278436", "0.627061", "0.62557995", "0.62549406", "0.6248209", "0.6244749", "0.6226743", "0.6222127", "0.62220293", "0.6214394", "0.62139094", "0.6208445", "0.6205644", "0.61828405", "0.61804175", "0.617382", "0.6170236", "0.61503357", "0.614642", "0.6145098", "0.6131561", "0.6129502", "0.6105703", "0.60880893", "0.608615", "0.60770273", "0.6075201", "0.60522926", "0.6048207", "0.60463905", "0.6044843", "0.6043295", "0.6031486", "0.6031486", "0.60301083", "0.6022615", "0.60188043", "0.60159373", "0.60110784", "0.6004259", "0.6003747", "0.6001333", "0.5994284", "0.5989547", "0.5983963", "0.5977218", "0.5971995", "0.59688526", "0.5968294", "0.5966596", "0.59645945", "0.5963572", "0.596327", "0.5961302", "0.5961222", "0.5960602", "0.59599996", "0.5958294", "0.5954428", "0.5950607", "0.5948597", "0.5942905", "0.59401304", "0.59345764", "0.5933397", "0.5927913", "0.5926655", "0.5918794" ]
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\n}", "func (o *EditL3ServiceProfileUsingPUTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (a *Application) PutContext(r *http.Request) *http.Request {\n\treturn page.PutContext(r, os.Args[1:])\n}", "func (o *EmployeesByIDContractrulePutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CatalogTierPriceStorageV1ReplacePutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PutMenuItemParams) WithContext(ctx context.Context) *PutMenuItemParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *CreateCartUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func setupTestWithContext(valMinGasPrice string, minGasPrice sdk.Dec, baseFee sdkmath.Int) (*ethsecp256k1.PrivKey, banktypes.MsgSend) {\n\tprivKey, msg := setupTest(valMinGasPrice + s.denom)\n\tparams := types.DefaultParams()\n\tparams.MinGasPrice = minGasPrice\n\ts.app.FeeMarketKeeper.SetParams(s.ctx, params)\n\ts.app.FeeMarketKeeper.SetBaseFee(s.ctx, baseFee.BigInt())\n\ts.Commit()\n\n\treturn privKey, msg\n}", "func (o *PutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PortalsPutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (db *merkleDB) PutContext(ctx context.Context, k, v []byte) error {\n\tdb.commitLock.Lock()\n\tdefer db.commitLock.Unlock()\n\n\tif db.closed {\n\t\treturn database.ErrClosed\n\t}\n\n\tview, err := db.newUntrackedView([]database.BatchOp{\n\t\t{\n\t\t\tKey: k,\n\t\t\tValue: v,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn view.commitToDB(ctx)\n}", "func (o *LedgerVoucherPutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CatalogProductRepositoryV1SavePutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PutZoneParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PutMenuItemParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetMsgauthGrantersGranterAddressGranteesGranteeAddressGrantsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CatalogProductTierPriceManagementV1AddPostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (c *Contexter) PutContext(newContext *Context) (error) {\n\tif !newContext.validate(c.mode) {\n\t\treturn errors.Errorf(\"invalid config\")\n\t}\n\tmutableMutex.Lock()\n defer mutableMutex.Unlock()\n\tc.replaceContext(newContext)\n\treturn nil\n}", "func (o *GetProductsByIDPromotionsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *QuotePaymentMethodManagementV1SetPutMineParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PutParams) WithContext(ctx context.Context) *PutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func AddToContext(ctx context.Context, reqID string) context.Context {\n\treturn context.WithValue(ctx, reqIDKey, reqID)\n}", "func (o *GiftRegistryGuestCartShippingMethodManagementV1EstimateByRegistryIDPostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetRemotesupportConnectemcParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CustomerGatewayUpdateOwnershipParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *UpdateZoneProjectsUsingPUTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetIPAMCustomerIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PutProductsNameParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (req *UpsertObjectRequest) Context(ctx context.Context) *UpsertObjectRequest {\n\treq.impl = req.impl.Context(ctx)\n\n\treturn req\n}", "func (o *PutLolPerksV1CurrentpageParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *StoreProductParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *RevertProductSnapshotRequestUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *AddOrUpdateNodePoolConfigItemParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetProductsByIDVariationAttributesByIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreatePublicIPAdressUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetV1IntegrationsAwsCloudtrailBatchesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetReceiptsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (_mr *MockECRAPIMockRecorder) PutImageWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\t_s := append([]interface{}{arg0, arg1}, arg2...)\n\treturn _mr.mock.ctrl.RecordCall(_mr.mock, \"PutImageWithContext\", _s...)\n}", "func (o *GetLolInventoryV1PlayersByPuuidInventoryParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (_obj *Apipayments) AddServantWithContext(imp _impApipaymentsWithContext, obj string) {\n\ttars.AddServantWithContext(_obj, imp, obj)\n}", "func (c *PutCall) Context(ctx context.Context) *PutCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *PatchStorageVirtualDriveExtensionsMoidParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreateCognitoIDPParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *AddItemParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostMeOvhAccountOvhAccountIDCreditOrderParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *EmployeeEntitlementGrantEntitlementsByTemplateGrantEntitlementsByTemplateParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetApplianceUpgradePoliciesMoidParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GiftRegistryShippingMethodManagementV1EstimateByRegistryIDPostMineParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func With(ctx context.Context, kvs ...interface{}) context.Context {\n\tl := fromCtx(ctx)\n\tl = l.With(kvs...)\n\treturn toCtx(ctx, l)\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (req *UpsertRequest) Context(ctx context.Context) *UpsertRequest {\n\treq.impl = req.impl.Context(ctx)\n\n\treturn req\n}", "func (o *PostAPIV3MachinesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func MetaWithContext(ctx context.Context, newMeta map[string]interface{}) context.Context {\n\tprevMeta := MetaFromContext(ctx)\n\n\tif prevMeta == nil {\n\t\tprevMeta = make(map[string]interface{})\n\t}\n\n\tfor k, v := range newMeta {\n\t\tprevMeta[k] = v\n\t}\n\n\treturn context.WithValue(ctx, MetaCtxKey, prevMeta)\n}", "func (o *CloudNFSExportAddParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) 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\t// path param cartId\n\tif err := r.SetPathParam(\"cartId\", o.CartID); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.QuoteGuestCartManagementV1AssignCustomerPutBody); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PcloudIkepoliciesPutParams) WithContext(ctx context.Context) *PcloudIkepoliciesPutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *InventoryStocktakingSearchParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (m *MockSQSAPI) SetQueueAttributesWithContext(arg0 context.Context, arg1 *sqs.SetQueueAttributesInput, arg2 ...request.Option) (*sqs.SetQueueAttributesOutput, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"SetQueueAttributesWithContext\", varargs...)\n\tret0, _ := ret[0].(*sqs.SetQueueAttributesOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (c *LicenseAssignmentsInsertCall) Context(ctx context.Context) *LicenseAssignmentsInsertCall {\n\tc.ctx_ = ctx\n\treturn c\n}", "func (o *GetMarketsRegionIDHistoryParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (obj *ShopSys) FakerBuyWithContext(ctx context.Context, input Faker, _opt ...map[string]string) (output Faker, err error) {\n\tvar inputMarshal []byte\n\tinputMarshal, err = proto.Marshal(&input)\n\tif err != nil {\n\t\treturn output, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\n\tresp := new(requestf.ResponsePacket)\n\n\terr = obj.s.Tars_invoke(ctx, 0, \"FakerBuy\", inputMarshal, _status, _context, resp)\n\tif err != nil {\n\t\treturn output, err\n\t}\n\tif err = proto.Unmarshal(tools.Int8ToByte(resp.SBuffer), &output); err != nil {\n\t\treturn output, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\t}\n\n\treturn output, nil\n}", "func (obj *ShopSys) FakerBuyWithContext(ctx context.Context, input Faker, _opt ...map[string]string) (output Faker, err error) {\n\tvar inputMarshal []byte\n\tinputMarshal, err = proto.Marshal(&input)\n\tif err != nil {\n\t\treturn output, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\n\tresp := new(requestf.ResponsePacket)\n\n\terr = obj.s.Tars_invoke(ctx, 0, \"FakerBuy\", inputMarshal, _status, _context, resp)\n\tif err != nil {\n\t\treturn output, err\n\t}\n\tif err = proto.Unmarshal(tools.Int8ToByte(resp.SBuffer), &output); err != nil {\n\t\treturn output, err\n\t}\n\n\tif len(_opt) == 1 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t} else if len(_opt) == 2 {\n\t\tfor k := range _context {\n\t\t\tdelete(_context, k)\n\t\t}\n\t\tfor k, v := range resp.Context {\n\t\t\t_context[k] = v\n\t\t}\n\t\tfor k := range _status {\n\t\t\tdelete(_status, k)\n\t\t}\n\t\tfor k, v := range resp.Status {\n\t\t\t_status[k] = v\n\t\t}\n\t}\n\n\treturn output, nil\n}", "func (o *CreateCustomerTenantsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *UpdateCustomIDPParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *AddVMParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetAnOrderProductParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostLolRsoAuthV1AuthorizationGasParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *UpdateOrganizationBillingAddressParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetPublicsRecipeParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetBundleByKeyParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PatchSepainstantIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostAPI24ProtectionGroupSnapshotsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *UpdateStockReceiptParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *AdminCreateJusticeUserParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *SkuPackPostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *APIServiceAddressParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetBillingOrgIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetOutagesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ChargeAddonInvoiceParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func WithContext(ctx context.Context) CallOpt {\n\treturn func(c *call) error {\n\t\tc.req = c.req.WithContext(ctx)\n\t\treturn nil\n\t}\n}", "func (_obj *Apilangpack) AddServantWithContext(imp _impApilangpackWithContext, obj string) {\n\ttars.AddServantWithContext(_obj, imp, obj)\n}", "func (o *QueueCommandUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PayAllInvoicesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PayAllInvoicesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreateInstantPaymentParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetIPAMsubnetsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetPrivateOrderstateParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *EditL3ServiceProfileUsingPUTParams) WithContext(ctx context.Context) *EditL3ServiceProfileUsingPUTParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (_m *MockECRAPI) PutImageWithContext(_param0 aws.Context, _param1 *ecr.PutImageInput, _param2 ...request.Option) (*ecr.PutImageOutput, error) {\n\t_s := []interface{}{_param0, _param1}\n\tfor _, _x := range _param2 {\n\t\t_s = append(_s, _x)\n\t}\n\tret := _m.ctrl.Call(_m, \"PutImageWithContext\", _s...)\n\tret0, _ := ret[0].(*ecr.PutImageOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (o *CheckoutPaymentInformationManagementV1SavePaymentInformationAndPlaceOrderPostMineParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetMeCreditBalanceBalanceNameMouvementMouvementIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostHostStorageSectorsDeleteMerklerootParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (r *Request) WithContext(ctx context.Context) *Request", "func (o *BudgetAddParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreateWidgetParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *APIServiceEstimateCoinBuyParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}" ]
[ "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.5232308", "0.52077675", "0.5204922", "0.51944846", "0.517282", "0.51695615", "0.51506436", "0.5138893", "0.513638", "0.5115564", "0.5111183", "0.5104228", "0.5103178", "0.5102199", "0.51020795", "0.51016384", "0.5098194", "0.5091862", "0.5086865", "0.50846285", "0.50817645", "0.5073176", "0.50707865", "0.50705326", "0.50640935", "0.50599635", "0.50547796", "0.50536186", "0.5038483", "0.50347555", "0.5033734", "0.50321203", "0.5030878", "0.5024162", "0.5020537", "0.5010134", "0.50091684", "0.5007793", "0.5006002", "0.5004546", "0.50015223", "0.49951574", "0.49867335", "0.49852216", "0.49852216", "0.49840093", "0.4981411", "0.4980811", "0.49750176", "0.49672914", "0.49661967", "0.49628806", "0.49603587", "0.49589843", "0.49551997", "0.49296752", "0.4928533", "0.49263915", "0.49261713", "0.4926152", "0.49198034", "0.491871", "0.49138653", "0.4912512", "0.49124515", "0.49080548", "0.49059218", "0.49059218", "0.49051815", "0.49044108", "0.49034303", "0.49027303", "0.48998386", "0.4896465", "0.4895439", "0.4893619", "0.48909003", "0.48882553", "0.48810592", "0.4874273" ]
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 *PutZoneParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CatalogProductTierPriceManagementV1AddPostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CatalogTierPriceStorageV1ReplacePutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CatalogProductRepositoryV1SavePutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetProductsByIDPromotionsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PutProductsNameParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostMeOvhAccountOvhAccountIDCreditOrderParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *RevertProductSnapshotRequestUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *StoreProductParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetIPAMCustomerIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *EmployeesByIDContractrulePutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *EditL3ServiceProfileUsingPUTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *AddItemParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *LedgerVoucherPutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PutMenuItemParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostAPIV3MachinesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreatePublicIPAdressUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *AddVMParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetReceiptsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GiftRegistryGuestCartShippingMethodManagementV1EstimateByRegistryIDPostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *QueueCommandUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetRemotesupportConnectemcParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetMarketsRegionIDHistoryParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GiftMessageCartRepositoryV1SavePostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreateCognitoIDPParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PortalsPutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetAnOrderProductParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PatchStorageVirtualDriveExtensionsMoidParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreateCustomerTenantsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *SkuPackPostParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *UpdateCustomIDPParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *MarketDataSubscribeMarketDataParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetPrivateOrderstateParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetV1IntegrationsAwsCloudtrailBatchesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostPartsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *APIServiceEstimateCoinBuyParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *SetPlanParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PutStackParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *AddOrUpdateNodePoolConfigItemParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *EstimateCoinBuyParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetLolInventoryV1PlayersByPuuidInventoryParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *BatchUpsertCatalogObjectsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *UpdateStockReceiptParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetBundleByKeyParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *UpdateOrganizationBillingAddressParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PayAllInvoicesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PayAllInvoicesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *UpdateZoneProjectsUsingPUTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetCurrentGenerationParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetMeCreditBalanceBalanceNameMouvementMouvementIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ChargeAddonInvoiceParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreateInstantPaymentParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *FreezeParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetProductsCodeParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *RegenerateDeployKeyParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreateRegionSubscriptionParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreateChannelSpacesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *UpdatePriceListParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetRackTopoesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostGenerateAddressesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CheckoutPaymentInformationManagementV1SavePaymentInformationAndPlaceOrderPostMineParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostLolRsoAuthV1AuthorizationGasParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CloudNFSExportAddParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *StartGatewayBundleUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PutLolPerksV1CurrentpageParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetOutagesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreateCouponParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetProductsByIDVariationAttributesByIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetDeploymentPreview1Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CustomerGatewayUpdateOwnershipParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostIPLoadbalancingServiceNameHTTPFrontendParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PatchZoneParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetPublicsRecipeParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *APIServiceSendTransactionParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *InventoryStocktakingSearchParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *QuotePaymentMethodManagementV1SetPutMineParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetIPAMsubnetsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GiftRegistryShippingMethodManagementV1EstimateByRegistryIDPostMineParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PostHyperflexAutoSupportPoliciesParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PatchSepainstantIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetIngredientVersionRevisionParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *SizeParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreateMigrationInvoiceParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *SendJobCommandParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PutTravelExpensePassengerIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *PetCreateParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CreateWidgetParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetInstrumentsInstrumentOrderBookParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *BudgetAddParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *GetBillingOrgIDParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *ImportStore1Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *EditParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}" ]
[ "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.64214176", "0.64163065", "0.64158046", "0.6410169", "0.64056724", "0.64038116", "0.6401707", "0.63955164", "0.63805324", "0.63738096", "0.63497204", "0.63419217", "0.6340017", "0.6332004", "0.6325259", "0.632449", "0.63228136", "0.6311212", "0.6294774", "0.6292165", "0.62858295", "0.6282452", "0.6282095", "0.62790745", "0.62775546", "0.62613076", "0.6254598", "0.62544763", "0.6250047", "0.6246457", "0.6241188", "0.6241182", "0.6241182", "0.62386364", "0.6238205", "0.62366956", "0.6234503", "0.6233035", "0.62258667", "0.6224845", "0.6224326", "0.62229127", "0.62193555", "0.62183464", "0.62046874", "0.6204018", "0.6203923", "0.62034637", "0.6203439", "0.62005067", "0.61949426", "0.6193405", "0.61903363", "0.61848557", "0.61825657", "0.61804855", "0.6177334", "0.6176911", "0.6162337", "0.6159599", "0.61542845", "0.61498857", "0.614903", "0.61476034", "0.614426", "0.61425173", "0.61418104", "0.6138265", "0.6131831", "0.6131582", "0.6128212", "0.6124968", "0.6122422", "0.6112526", "0.61120373", "0.61092955", "0.6103714", "0.6096984", "0.60968465", "0.6091684" ]
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) {\n\to.HTTPClient = client\n}", "func (o *PostMeOvhAccountOvhAccountIDCreditOrderParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PcloudIkepoliciesPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *LedgerVoucherPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutParams) WithHTTPClient(client *http.Client) *PutParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *CatalogProductTierPriceManagementV1AddPostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(httpClient *http.Client) ClientOption {\n\treturn func(c *client) error {\n\t\tif httpClient == nil {\n\t\t\treturn errors.InvalidParameterError{Parameter: \"httpClient\", Reason: \"cannot be empty\"}\n\t\t}\n\n\t\tc.requester.Client = httpClient\n\t\treturn nil\n\t}\n}", "func (o *PortalsPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutMenuItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EditL3ServiceProfileUsingPUTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutZoneParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCustomerTenantsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *QueueCommandUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GiftMessageCartRepositoryV1SavePostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetIPAMCustomerIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutTravelExpensePassengerIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutMenuItemParams) WithHTTPClient(client *http.Client) *PutMenuItemParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *EmployeesByIDContractrulePutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EmployeeEntitlementGrantEntitlementsByTemplateGrantEntitlementsByTemplateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func AddClient(nbmaster string, httpClient *http.Client, jwt string) {\r\n fmt.Printf(\"\\nSending a PUT request to add client %s to policy %s...\\n\", testClientName, testPolicyName)\r\n\r\n client := map[string]interface{}{\r\n \"data\": map[string]interface{}{\r\n \"type\": \"client\",\r\n \"attributes\": map[string]string{\r\n \"hardware\": \"VMware\",\r\n \"hostName\": \"MEDIA_SERVER\",\r\n \"OS\": \"VMware\"}}}\r\n\r\n clientRequest, _ := json.Marshal(client)\r\n\r\n uri := \"https://\" + nbmaster + \":\" + port + \"/netbackup/\" + policiesUri + testPolicyName + \"/clients/\" + testClientName\r\n\r\n request, _ := http.NewRequest(http.MethodPut, uri, bytes.NewBuffer(clientRequest))\r\n request.Header.Add(\"Content-Type\", contentTypeV2);\r\n request.Header.Add(\"Authorization\", jwt);\r\n request.Header.Add(\"If-Match\", \"1\");\r\n request.Header.Add(\"X-NetBackup-Audit-Reason\", \"added client \" + testClientName + \" to policy \" + testPolicyName);\r\n\r\n response, err := httpClient.Do(request)\r\n\r\n if err != nil {\r\n fmt.Printf(\"The HTTP request failed with error: %s\\n\", err)\r\n panic(\"Unable to add client to policy.\\n\")\r\n } else {\r\n if response.StatusCode != 201 {\r\n printErrorResponse(response)\r\n } else {\r\n fmt.Printf(\"%s added to %s successfully.\\n\", testClientName, testPolicyName);\r\n responseDetails, _ := httputil.DumpResponse(response, true);\r\n fmt.Printf(string(responseDetails))\r\n }\r\n }\r\n}", "func (o *CreateInstantPaymentParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GiftRegistryGuestCartShippingMethodManagementV1EstimateByRegistryIDPostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EstimateCoinBuyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PcloudIkepoliciesPutParams) WithHTTPClient(client *http.Client) *PcloudIkepoliciesPutParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *CatalogProductRepositoryV1SavePutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreatePublicIPAdressUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SkuPackPostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CatalogTierPriceStorageV1ReplacePutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCognitoIDPParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CheckoutPaymentInformationManagementV1SavePaymentInformationAndPlaceOrderPostMineParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutStackParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *APIServiceEstimateCoinBuyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SetCartDeliveryModeUsingPUTParams) WithHTTPClient(client *http.Client) *SetCartDeliveryModeUsingPUTParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *PutProductsNameParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCouponParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetProductsByIDPromotionsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateOrganizationBillingAddressParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateZoneProjectsUsingPUTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ChargeAddonInvoiceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostPartsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutCwfNetworkIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *QuotePaymentMethodManagementV1SetPutMineParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostContextsAddPhpParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *APIServiceSendTransactionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetRequestDetailsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PayAllInvoicesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PayAllInvoicesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetMsgauthGrantersGranterAddressGranteesGranteeAddressGrantsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (m *PlayPromptPostRequestBody) SetClientContext(value *string)() {\n m.clientContext = value\n}", "func (o *StoreProductParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetReceiptsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateCustomIDPParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostEmailParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AuthorizeV3Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AuthorizeV3Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCrossConnectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCartUsingPOSTParams) WithHTTPClient(client *http.Client) *CreateCartUsingPOSTParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *RevertProductSnapshotRequestUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *InventoryStocktakingSearchParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetAnOrderProductParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetBundleByKeyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostHyperflexAutoSupportPoliciesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *BudgetAddParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddOrUpdateNodePoolConfigItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SetPlanParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostLolRsoAuthV1AuthorizationGasParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateSwiftPasswordParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostGenerateAddressesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EditParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetInstrumentsInstrumentOrderBookParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *IntegrationsManualHTTPSCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *BatchUpsertCatalogObjectsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutAttachmentsIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateMigrationInvoiceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreatePolicyResetItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PcloudV1CloudinstancesCosimagesPostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CheckTransactionCreditLimitParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateChannelSpacesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostConditionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SMSCampaignsCancelBySMSCampaignIDPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func WithHTTPClient(client *http.Client) func(c *Client) error {\n\treturn func(c *Client) error {\n\t\tif client == nil {\n\t\t\treturn errors.New(\"HTTP client is nil\")\n\t\t}\n\t\tc.client = client\n\t\treturn nil\n\t}\n}", "func (o *GetOrderParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutFlagSettingParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateStockReceiptParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetItemByAppIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SendTransacSMSParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SharedCatalogSharedCatalogRepositoryV1SavePostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RegenerateDeployKeyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostMenuItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutLolPerksV1CurrentpageParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PcloudSystempoolsGetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DecryptParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateTokenParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}" ]
[ "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.5905386", "0.5904004", "0.58962816", "0.5880198", "0.5873159", "0.5871519", "0.5864017", "0.58578306", "0.5853667", "0.58400625", "0.58373994", "0.58308595", "0.5825489", "0.58195674", "0.58177406", "0.58117515", "0.5811517", "0.5809045", "0.57770944", "0.5771812", "0.5760298", "0.57579446", "0.57563007", "0.574886", "0.5741455", "0.5733896", "0.5728108", "0.57142746", "0.5711629", "0.570917", "0.5707122", "0.5700469", "0.5700469", "0.5680154", "0.56778246", "0.5665603", "0.566253", "0.565866", "0.56480753", "0.5645646", "0.5645646", "0.56405747", "0.56389683", "0.5636416", "0.5633043", "0.5622896", "0.5615227", "0.5612942", "0.5608646", "0.55982697", "0.5594194", "0.55817497", "0.55743057", "0.5572761", "0.55707574", "0.5567472", "0.55636245", "0.5559313", "0.5558531", "0.5552429", "0.55504745", "0.5548421", "0.5538906", "0.5538081", "0.5536788", "0.5533791", "0.55327237", "0.55311155", "0.55311024", "0.55278593", "0.5527146", "0.5525678", "0.55231595", "0.5523055", "0.55165493", "0.55164194", "0.55143815", "0.550764", "0.55044", "0.5501229" ]
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\to.HTTPClient = client\n}", "func (o *PcloudIkepoliciesPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *LedgerVoucherPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CatalogProductTierPriceManagementV1AddPostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *QueueCommandUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GiftMessageCartRepositoryV1SavePostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetIPAMCustomerIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutMenuItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutZoneParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EditL3ServiceProfileUsingPUTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PortalsPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EstimateCoinBuyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCustomerTenantsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CatalogProductRepositoryV1SavePutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GiftRegistryGuestCartShippingMethodManagementV1EstimateByRegistryIDPostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutStackParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutTravelExpensePassengerIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SkuPackPostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CatalogTierPriceStorageV1ReplacePutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetProductsByIDPromotionsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *APIServiceSendTransactionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutProductsNameParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *RevertProductSnapshotRequestUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *APIServiceEstimateCoinBuyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ChargeAddonInvoiceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *StoreProductParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateInstantPaymentParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreatePublicIPAdressUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EmployeesByIDContractrulePutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostPartsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetRequestDetailsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutCwfNetworkIDParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCognitoIDPParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateOrganizationBillingAddressParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CheckoutPaymentInformationManagementV1SavePaymentInformationAndPlaceOrderPostMineParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AddOrUpdateNodePoolConfigItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetReceiptsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *IntegrationsManualHTTPSCreateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SetPlanParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PayAllInvoicesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PayAllInvoicesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *BatchUpsertCatalogObjectsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func SetHTTPClient(httpClient *http.Client) func(*Client) error {\n\treturn func(client *Client) error {\n\t\tclient.client = httpClient\n\n\t\treturn nil\n\t}\n}", "func (o *PostHyperflexAutoSupportPoliciesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCrossConnectParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateCouponParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateCustomIDPParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EditParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateStockReceiptParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostContextsAddPhpParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostLolRsoAuthV1AuthorizationGasParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetRemotesupportConnectemcParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateMigrationInvoiceParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *UpdateZoneProjectsUsingPUTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func SetHTTPClient(client *http.Client) {\n\thttpClient = client\n}", "func (o *SendTransacSMSParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PcloudV1CloudinstancesCosimagesPostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetAnOrderProductParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *EmployeeEntitlementGrantEntitlementsByTemplateGrantEntitlementsByTemplateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetBundleByKeyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SaveTemplateParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreatePolicyResetItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *InventoryStocktakingSearchParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CreateChannelSpacesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *FreezeParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AuthorizeV3Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *AuthorizeV3Params) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func SetHTTPClient(newClient *http.Client) {\n\thttpClient = newClient\n}", "func (o *RegenerateDeployKeyParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutFlagSettingParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SharedCatalogSharedCatalogRepositoryV1SavePostParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *CheckTransactionCreditLimitParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ExportProductsUsingGETParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *StartGatewayBundleUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostEmailParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetInstrumentsInstrumentOrderBookParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *QuotePaymentMethodManagementV1SetPutMineParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostConditionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PutLolPerksV1CurrentpageParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ToggleNetworkGeneratorsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PcloudSystempoolsGetParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostAsyncParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *ImportApplicationUsingPOSTParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetMsgauthGrantersGranterAddressGranteesGranteeAddressGrantsParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostIPLoadbalancingServiceNameHTTPFrontendParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *DecryptParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostGenerateAddressesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *SendJobCommandParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostAPIV3MachinesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetOrderParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostMenuItemParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *GetGCParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *PostIPAMSwitchesParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = 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.6808575", "0.68062276", "0.68007797", "0.6790961", "0.6784163", "0.6777891", "0.6771315", "0.6763933", "0.67625815", "0.6754573", "0.67541075", "0.674032", "0.6737717", "0.6719032", "0.6718832", "0.6712283", "0.67109925", "0.67101103", "0.6707075", "0.6707035", "0.6697216", "0.66970754", "0.6691259", "0.6683515", "0.667945", "0.66777086", "0.66777086", "0.6676408", "0.66609263", "0.66539794", "0.6652606", "0.6652314", "0.66490287", "0.6647567", "0.66430056", "0.66319937", "0.6618123", "0.6617508", "0.6613544", "0.6613175", "0.66129225", "0.66060483", "0.66054606", "0.6605264", "0.6599952", "0.65912396", "0.6590767", "0.6578274", "0.6571773", "0.6565222", "0.65641993", "0.6563175", "0.6563175", "0.65624034", "0.65582067", "0.6557549", "0.65550923", "0.65505725", "0.6548442", "0.6546856", "0.6545622", "0.65366936", "0.65333337", "0.65318954", "0.65124136", "0.65114826", "0.6505751", "0.64974546", "0.6496698", "0.6495567", "0.6492167", "0.64880973", "0.64867526", "0.6483712", "0.6482923", "0.6472944", "0.647124", "0.6466716", "0.64647645" ]
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.GetCart(cart_id)\n\n item := rest.GoCart.GetItem(item_id)\n item.SetItemQuantity(quantity)\n\n cart.Add(*item)\n rest.GoCart.SaveCart(*cart)\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetCartID(cartID string) {\n\to.CartID = cartID\n}", "func (o *SetCartDeliveryModeUsingPUTParams) WithCartID(cartID string) *SetCartDeliveryModeUsingPUTParams {\n\to.SetCartID(cartID)\n\treturn o\n}", "func (m *MockCartDBAPI) AddCartID(arg0 string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"AddCartID\", arg0)\n}", "func (o *GiftRegistryGuestCartShippingMethodManagementV1EstimateByRegistryIDPostParams) SetCartID(cartID string) {\n\to.CartID = cartID\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) 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\t// path param cartId\n\tif err := r.SetPathParam(\"cartId\", o.CartID); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.QuoteGuestCartManagementV1AssignCustomerPutBody); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func AddItemToCart(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{\"message\": \"NOT IMPLEMENTED\"})\n}", "func (o *GiftMessageCartRepositoryV1SavePostParams) SetCartID(cartID int64) {\n\to.CartID = cartID\n}", "func (m *MockCartDBAPI) AddCartItemID(arg0, arg1 string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"AddCartItemID\", arg0, arg1)\n}", "func (o *CreateCartUsingPOSTParams) WithOldCartID(oldCartID *string) *CreateCartUsingPOSTParams {\n\to.SetOldCartID(oldCartID)\n\treturn o\n}", "func (mr *MockCartDBAPIMockRecorder) AddCartID(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddCartID\", reflect.TypeOf((*MockCartDBAPI)(nil).AddCartID), arg0)\n}", "func (app *application) AddToCart(w http.ResponseWriter, r *http.Request) {\r\n\t// a seller does not have a shopping cart\r\n\tisSeller := app.isSeller(r)\r\n\tif isSeller {\r\n\t\tw.WriteHeader(http.StatusUnauthorized)\r\n\t\tapp.render(w, r, \"error.page.tmpl\", &templateData{\r\n\t\t\tError: http.StatusText(http.StatusUnauthorized),\r\n\t\t})\r\n\t\treturn\r\n\t}\r\n\r\n\t// retrieve userid from session cookie\r\n\tuserid := app.session.GetString(r, \"userid\")\r\n\r\n\t// retrieve ProductID from url\r\n\t// the ProducID should be valid\r\n\tproductID, err := strconv.Atoi(r.URL.Query().Get(\"productid\"))\r\n\tif err != nil {\r\n\t\tw.WriteHeader(http.StatusBadRequest)\r\n\t\tapp.render(w, r, \"error.page.tmpl\", &templateData{\r\n\t\t\tError: http.StatusText(http.StatusBadRequest),\r\n\t\t})\r\n\t\treturn\r\n\t}\r\n\r\n\t// perform the insert at the database\r\n\terr = app.cart.InsertItem(userid, productID)\r\n\tif err != nil {\r\n\t\tapp.errorLog.Println(err)\r\n\t\tw.WriteHeader(http.StatusInternalServerError)\r\n\t\tapp.render(w, r, \"error.page.tmpl\", &templateData{\r\n\t\t\tError: http.StatusText(http.StatusInternalServerError),\r\n\t\t})\r\n\t\treturn\r\n\t}\r\n\r\n\tapp.session.Put(r, \"flash\", \"Product successfully added to cart.\")\r\n\r\n\thttp.Redirect(w, r, r.Referer(), http.StatusSeeOther)\r\n}", "func (o *CreateCartUsingPOSTParams) 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\t// path param baseSiteId\n\tif err := r.SetPathParam(\"baseSiteId\", o.BaseSiteID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.OldCartID != nil {\n\n\t\t// query param oldCartId\n\t\tvar qrOldCartID string\n\t\tif o.OldCartID != nil {\n\t\t\tqrOldCartID = *o.OldCartID\n\t\t}\n\t\tqOldCartID := qrOldCartID\n\t\tif qOldCartID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"oldCartId\", qOldCartID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.ToMergeCartGUID != nil {\n\n\t\t// query param toMergeCartGuid\n\t\tvar qrToMergeCartGUID string\n\t\tif o.ToMergeCartGUID != nil {\n\t\t\tqrToMergeCartGUID = *o.ToMergeCartGUID\n\t\t}\n\t\tqToMergeCartGUID := qrToMergeCartGUID\n\t\tif qToMergeCartGUID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"toMergeCartGuid\", qToMergeCartGUID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param userId\n\tif err := r.SetPathParam(\"userId\", o.UserID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SetCartDeliveryModeUsingPUTParams) 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\t// path param baseSiteId\n\tif err := r.SetPathParam(\"baseSiteId\", o.BaseSiteID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param cartId\n\tif err := r.SetPathParam(\"cartId\", o.CartID); err != nil {\n\t\treturn err\n\t}\n\n\t// query param deliveryModeId\n\tqrDeliveryModeID := o.DeliveryModeID\n\tqDeliveryModeID := qrDeliveryModeID\n\tif qDeliveryModeID != \"\" {\n\t\tif err := r.SetQueryParam(\"deliveryModeId\", qDeliveryModeID); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param userId\n\tif err := r.SetPathParam(\"userId\", o.UserID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GiftMessageCartRepositoryV1SavePostParams) WithCartID(cartID int64) *GiftMessageCartRepositoryV1SavePostParams {\n\to.SetCartID(cartID)\n\treturn o\n}", "func CreateCart(cr cart.Repository) http.Handler {\n\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tkey := r.URL.Query().Get(\"key\")\n\t\tif key == \"\" {\n\t\t\thttp.Error(w, \"missing key in query string\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tnewCart := cart.New(key)\n\t\terr := cr.Store(newCart)\n\t\tif err != nil {\n\t\t\t//error handling\n\t\t}\n\t\tval := []byte{}\n\t\terr2 := json.Unmarshal(val, newCart)\n\t\tif err2 != nil {\n\t\t\t//\n\t\t}\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tw.Write(val)\n\t})\n}", "func UpdateCartItem(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{\"message\": \"NOT IMPLEMENTED\"})\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func AddCartItem(service Service, userService users.Service) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := r.Context()\n\t\tlogger := loglib.GetLogger(ctx)\n\t\tusername, err := auth.GetLoggedInUsername(r)\n\t\tif err != nil {\n\t\t\thttpresponse.ErrorResponseJSON(ctx, w, http.StatusForbidden, errorcode.ErrorsInRequestData, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tuser, err := userService.RetrieveUserByUsername(ctx, username)\n\t\tif err != nil || user == nil {\n\t\t\thttpresponse.ErrorResponseJSON(ctx, w, http.StatusUnauthorized, errorcode.UserNotFound, \"User not found\")\n\t\t\treturn\n\t\t}\n\n\t\tlogger.Infof(\"user is %v\", user.Username)\n\t\t// unmarshal request\n\t\treq := addCartItemRequest{}\n\t\tif err := json.NewDecoder(r.Body).Decode(&req); (err != nil || req == addCartItemRequest{}) {\n\t\t\thttpresponse.ErrorResponseJSON(ctx, w, http.StatusBadRequest, errorcode.ErrorsInRequestData, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// validate request\n\t\tif err := req.Validate(); err != nil {\n\t\t\thttpresponse.ErrorResponseJSON(ctx, w, http.StatusBadRequest, errorcode.ErrorsInRequestData, err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tcart, err := service.AddItemCart(ctx, user.ID, req.ProductID, req.Quantity)\n\t\tif err != nil {\n\t\t\thttpresponse.ErrorResponseJSON(ctx, w, http.StatusInternalServerError, \"internal_error\", err.Error())\n\t\t\treturn\n\t\t}\n\n\t\thttpresponse.RespondJSON(w, http.StatusOK, cart, nil)\n\t}\n}", "func AddCart() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\trequestBody := model.ChatfuelCarts{}\n\t\tc.Bind(&requestBody)\n\n\t\tcart := model.Carts{\n\t\t\tMessengerUserID: requestBody.MessengerUserID,\n\t\t\tFirstName: requestBody.FirstName,\n\t\t\tProductID: requestBody.ProductID,\n\t\t\tProductName: requestBody.ProductName,\n\t\t\tQty: requestBody.Qty,\n\t\t\tPrice: requestBody.Price,\n\t\t}\n\n\t\tdb.Db.Create(&cart)\n\n\t\ttext := []model.Text{}\n\t\ttext = append(text, model.Text{\n\t\t\tText: \"加入購物車成功\",\n\t\t})\n\n\t\tmessage := model.Message{\n\t\t\tMessage: text,\n\t\t}\n\n\t\tc.JSON(http.StatusOK, message)\n\t}\n}", "func (store *Store) AddToCart(ctx *gin.Context) (bool, error) {\n\tctx.String(200, \"You are trying to add items to the cart.\")\n\treturn true, nil\n}", "func (e *PlaceOrderServiceAdapter) ReserveOrderID(ctx context.Context, cart *cartDomain.Cart) (string, error) {\n\treturn cart.ID, nil\n}", "func prepareCartWithDeliveries(t *testing.T, e *httpexpect.Expect) {\n\tt.Helper()\n\thelper.GraphQlRequest(t, e, loadGraphQL(t, \"cart_add_to_cart\", map[string]string{\"MARKETPLACE_CODE\": \"fake_simple\", \"DELIVERY_CODE\": \"delivery1\"})).Expect().Status(http.StatusOK)\n\thelper.GraphQlRequest(t, e, loadGraphQL(t, \"cart_add_to_cart\", map[string]string{\"MARKETPLACE_CODE\": \"fake_simple\", \"DELIVERY_CODE\": \"delivery2\"})).Expect().Status(http.StatusOK)\n}", "func (m *MockCartDBAPI) AddCartItemInfo(arg0, arg1 string, arg2 map[string]interface{}) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"AddCartItemInfo\", arg0, arg1, arg2)\n}", "func InsertProductIntoCart(id_user, id_product int, product model.Product, qty int) (interface{}, error) {\n\t// insert and select data product to cart\n\tshoppingCart := model.Shopping_cart{\n\t\tUser_id: id_user,\n\t\tProduct_id: id_product,\n\t\tName: product.Name,\n\t\tCategory: product.Category,\n\t\tType: product.Type,\n\t\tPrice: product.Price,\n\t\tQty: qty,\n\t}\n\tif err := config.DB.Save(&shoppingCart).Error; err != nil {\n\t\treturn shoppingCart, err\n\t}\n\treturn shoppingCart, nil\n}", "func SetID(ctx context.Context, requestID string) context.Context {\n\treturn context.WithValue(ctx, requestIDKey, requestID)\n}", "func (rest *RestApi) GetCart(w http.ResponseWriter, r *http.Request, id int64) error {\n gc := rest.GoCart\n cart := gc.GetCart(id)\n\n bytes, err := json.Marshal(cart)\n if err != nil {\n panic(err)\n }\n\n response := string(bytes)\n fmt.Fprintln(w, response)\n return nil\n}", "func (mr *MockCartDBAPIMockRecorder) AddCartItemID(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddCartItemID\", reflect.TypeOf((*MockCartDBAPI)(nil).AddCartItemID), arg0, arg1)\n}", "func (o *CreateCartUsingPOSTParams) SetOldCartID(oldCartID *string) {\n\to.OldCartID = oldCartID\n}", "func (o *GiftRegistryGuestCartShippingMethodManagementV1EstimateByRegistryIDPostParams) WithCartID(cartID string) *GiftRegistryGuestCartShippingMethodManagementV1EstimateByRegistryIDPostParams {\n\to.SetCartID(cartID)\n\treturn o\n}", "func NewPutCustomersIdRequest(server string, id string, body PutCustomersIdJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewPutCustomersIdRequestWithBody(server, id, \"application/json\", bodyReader)\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func GetCartByID(c *gin.Context) {\r\n\tid := c.Params.ByName(\"id\")\r\n\tvar cart []Models.Cart\r\n\terr := Models.GetCartByID(&cart, id)\r\n\tif err != nil {\r\n\t\tc.AbortWithStatus(http.StatusNotFound)\r\n\t} else {\r\n\t\tc.JSON(http.StatusOK, cart)\r\n\t}\r\n}", "func (w *ServerInterfaceWrapper) PutCustomersId(ctx echo.Context) error {\n\tvar err error\n\t// ------------- Path parameter \"id\" -------------\n\tvar id string\n\n\terr = runtime.BindStyledParameter(\"simple\", false, \"id\", ctx.Param(\"id\"), &id)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter id: %s\", err))\n\t}\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.PutCustomersId(ctx, id)\n\treturn err\n}", "func (o *SetCartDeliveryModeUsingPUTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (r *ReqAcceptMR) AddProjectID(val interface{}) *ReqAcceptMR {\n\t(*r)[KeyDataID] = fmt.Sprintf(\"%v\", val)\n\treturn r\n}", "func (o *NegotiableQuoteCouponManagementV1RemoveDeleteParams) SetCartID(cartID int64) {\n\to.CartID = cartID\n}", "func UpdateCart(cartID int, productID int, quantity int) (*Cart, error) {\n\ttx := db.Model(&Cart{}).Where(\"ID = ?\", cartID).Take(&Cart{}).UpdateColumns(\n\t\tmap[string]interface{}{\n\t\t\t\"ProductID\": productID,\n\t\t\t\"Quantity\": quantity,\n\t\t\t\"UpdatedAt\": time.Now(),\n\t\t},\n\t)\n\tif tx.Error != nil {\n\t\treturn &Cart{}, tx.Error\n\t}\n\n\t// check the updated cart\n\tvar cart Cart\n\terr := tx.Model(&Cart{}).Where(\"ID = ?\", cartID).Take(&cart).Error\n\tif err != nil && err != gorm.ErrRecordNotFound {\n\t\treturn nil, err\n\t}\n\n\treturn &cart, nil\n}", "func TestCartScenario(t *testing.T) {\n\t\n\te := httpexpect.New(t, API_URL)\n\t\n\tprintComment(\"SC20001\", \"Test Add 2 items of Unlimited 1 GB for $24.90\")\n\tcart := map[string]interface{}{\n\t\t\"code\": \"ult_small\",\n\t\t\"name\": \"Unlimited 1GB\",\n\t\t\"price\": 24.90,\n\t\t\"items\": 2,\n\t}\n\n\te.POST(\"/cart\").\n\t\tWithJSON(cart).\n\t\tExpect().\n\t\tStatus(http.StatusOK)\n\n}", "func UpdateProductCartByUserIdController(c echo.Context) error {\n\tdonorId , _ := strconv.Atoi(c.Request().Header.Get(\"userId\"))\n\t\n\tvar userCart []models.ProductCart\n\tc.Bind(&userCart)\n\t\n\terr := libdb.UpdateProductCartByUserId(userCart, donorId)\t\n\n\tif err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, response.Create(\"failed\", err.Error(), nil))\n\t}\n\n\treturn c.JSON(http.StatusOK, response.Create(\"success\", \"product cart is updated!\", nil))\n}", "func (o *SetCartDeliveryModeUsingPUTParams) WithContext(ctx context.Context) *SetCartDeliveryModeUsingPUTParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func TestCartScenario2(t *testing.T) {\n\t\n\te := httpexpect.New(t, API_URL)\n\t\n\tprintComment(\"SC20001\", \"Test Add 4 items of Unlimited 5 GB for $209.40\")\n\tcart := map[string]interface{}{\n\t\t\"code\": \"ult_large\",\n\t\t\"name\": \"Unlimited 5GB\",\n\t\t\"price\": 44.90,\n\t\t\"items\": 4,\n\t}\n\n\te.POST(\"/cart\").\n\t\tWithJSON(cart).\n\t\tExpect().\n\t\tStatus(http.StatusOK)\n\n}", "func (m *PgModel) AddCartCoupon(ctx context.Context, cartUUID, couponUUID string) (*CartCouponJoinRow, error) {\n\tcontextLogger := log.WithContext(ctx)\n\tcontextLogger.Debugf(\"postgres: AddCartCoupon(ctx context.Context, cartUUID=%q, couponUUID=%q string) started\", cartUUID, couponUUID)\n\n\t// 1. Check the cart exists\n\tq1 := \"SELECT id FROM cart WHERE uuid = $1\"\n\tvar cartID int\n\terr := m.db.QueryRowContext(ctx, q1, cartUUID).Scan(&cartID)\n\tif err == sql.ErrNoRows {\n\t\treturn nil, ErrCartNotFound\n\t}\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"postgres: query row context failed for q1=%q\", q1)\n\t}\n\n\t// 2. Check the coupon exists\n\tq2 := `\n\t\tSELECT\n\t\t c.id, c.coupon_code, void, reusable, spend_count, r.uuid as promo_rule_uuid,\n\t\t r.start_at, r.end_at\n\t\tFROM coupon AS c\n\t\tINNER JOIN promo_rule AS r\n\t\t ON r.id = c.promo_rule_id\n\t\tWHERE c.uuid = $1\n\t`\n\tvar void bool\n\tvar reusable bool\n\tvar spendCount int\n\tvar startAt *time.Time\n\tvar endAt *time.Time\n\n\tvar c CartCouponJoinRow\n\tc.cartID = cartID\n\tc.CartUUID = cartUUID\n\tc.CouponUUID = couponUUID\n\terr = m.db.QueryRowContext(ctx, q2, couponUUID).Scan(&c.couponID, &c.CouponCode, &void, &reusable, &spendCount, &c.PromoRuleUUID, &startAt, &endAt)\n\tif err == sql.ErrNoRows {\n\t\treturn nil, ErrCouponNotFound\n\t}\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"postgres: query row context failed for q2=%q\", q2)\n\t}\n\n\t// 3. Check the coupon has not already been applied to the cart.\n\tq3 := \"SELECT EXISTS(SELECT 1 FROM cart_coupon WHERE cart_id = $1 AND coupon_id = $2) AS exists\"\n\tvar exists bool\n\terr = m.db.QueryRowContext(ctx, q3, cartID, c.couponID).Scan(&exists)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"postgres: m.db.QueryRowContext(ctx, q3=%q, cartID=%d, c.couponID=%d).Scan(...) failed\", q3, cartID, c.couponID)\n\t}\n\n\tif exists {\n\t\treturn nil, ErrCartCouponExists\n\t}\n\n\t// Check if the coupon has been voided\n\tif void {\n\t\tcontextLogger.Debugf(\"postgres: coupon is void (couponUUID=%q)\", couponUUID)\n\t\treturn nil, ErrCouponVoid\n\t}\n\n\t// Check if the coupon has been used. (Only applies to non-reusable coupons)\n\tif !reusable && spendCount > 0 {\n\t\tcontextLogger.Debug(\"postgres: coupon is not reusable and spendCount > 0. The coupon has been already used.\")\n\t\treturn nil, ErrCouponUsed\n\t}\n\n\t// Check if the coupon has expired\n\tif startAt != nil && endAt != nil {\n\t\tnow := time.Now()\n\n\t\tdiffStart := now.Sub(*startAt)\n\n\t\t// if the difference is a negative value,\n\t\t// then the coupon hasn't yet started\n\t\thoursToStart := diffStart.Hours()\n\t\tif hoursToStart < 0 {\n\t\t\tcontextLogger.Infof(\"postgres: coupon is %.1f hours before start at date\", hoursToStart)\n\t\t\treturn nil, ErrCouponNotAtStartDate\n\t\t}\n\n\t\t// if the difference is a positive value,\n\t\t// then the coupon has expired.\n\t\tdiffEnd := now.Sub(*endAt)\n\t\thoursOverEnd := diffEnd.Hours()\n\t\tif hoursOverEnd > 0 {\n\t\t\tcontextLogger.Infof(\"postgres: coupon is %.1f hours over the end at date\", hoursOverEnd)\n\t\t\treturn nil, ErrCouponExpired\n\t\t}\n\n\t\tformat := \"2006-01-02 15:04:05 GMT\"\n\t\tcontextLogger.Infof(\"postgres: coupon is between %s and %s.\", startAt.In(loc).Format(format), endAt.In(loc).Format(format))\n\t} else {\n\t\tcontextLogger.Debugf(\"postgres: startAt for promo rule %q is nil\", c.PromoRuleUUID)\n\t}\n\n\t// 4. Insert the cart coupon.\n\tq4 := `\n\t\tINSERT INTO cart_coupon\n\t\t (cart_id, coupon_id)\n\t\tVALUES\n\t\t ($1, $2)\n\t\tRETURNING\n\t\t id, uuid, cart_id, coupon_id, created, modified\n\t`\n\trow := m.db.QueryRowContext(ctx, q4, cartID, c.couponID)\n\tif err := row.Scan(&c.id, &c.UUID, &c.cartID, &c.couponID, &c.Created, &c.Modified); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"postgres: query scan failed q4=%q\", q4)\n\t}\n\n\treturn &c, nil\n}", "func (v *Vending) Put(c echo.Context) error {\n\tcoins, err := strconv.Atoi(c.Param(\"amount\"))\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, \"Thats not a coin! No chocolate for you!\")\n\t}\n\tcustomerAmount := coins / v.cost\n\tif customerAmount > v.chocolate {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, \"There is not enough chocolate to give you\")\n\t}\n\tv.chocolate -= customerAmount\n\tv.coins += coins\n\treturn c.String(http.StatusOK, fmt.Sprintf(\"You now have %v pieces of chocolate\", customerAmount))\n}", "func (sc *StockCreate) SetZoneproductID(id int) *StockCreate {\n\tsc.mutation.SetZoneproductID(id)\n\treturn sc\n}", "func (db *DB) AddItemToCart(ctx context.Context, cartID, productName string, quantity float64) (*service.CartItem, error) {\n\tcartObjID, err := primitive.ObjectIDFromHex(cartID)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"could not convert %s to ObjectID\", cartID)\n\t}\n\tcartItemID := primitive.NewObjectID()\n\tupdateResult, err := db.Carts.UpdateOne(\n\t\tctx,\n\t\tbson.M{\"_id\": cartObjID},\n\t\tbson.D{\n\t\t\tbson.E{Key: \"$addToSet\", Value: bson.D{\n\t\t\t\tbson.E{Key: \"items\", Value: bson.M{\n\t\t\t\t\t\"id\": cartItemID,\n\t\t\t\t\t\"cart_id\": cartObjID,\n\t\t\t\t\t\"product\": productName,\n\t\t\t\t\t\"quantity\": quantity,\n\t\t\t\t}},\n\t\t\t}},\n\t\t})\n\tswitch {\n\tcase err != nil:\n\t\treturn nil, errors.Wrap(err, \"could not add item to cart\")\n\tcase updateResult.MatchedCount == 0:\n\t\treturn nil, errors.Wrap(ErrNotFound, \"no carts\")\n\tcase updateResult.ModifiedCount == 0:\n\t\treturn nil, errors.New(\"could not add item\")\n\tdefault:\n\t\treturn &service.CartItem{\n\t\t\tID: cartItemID,\n\t\t\tCartID: cartObjID,\n\t\t\tProductName: productName,\n\t\t\tQuantity: quantity,\n\t\t}, nil\n\t}\n}", "func (_UsersData *UsersDataTransactor) SetIdCartNoHash(opts *bind.TransactOpts, uuid [16]byte, idCartNoHash [32]byte) (*types.Transaction, error) {\n\treturn _UsersData.contract.Transact(opts, \"setIdCartNoHash\", uuid, idCartNoHash)\n}", "func (handler *Handler) createShoppingCart(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tuser, err := handler.authUser(r)\n\tif err != nil {\n\t\thandler.Error(w, r, err)\n\t\treturn\n\t}\n\n\tcart := shoppingcart.ShoppingCart{\n\t\tUserID: user.ID,\n\t}\n\n\tif err := handler.shoppingCartService.Create(r.Context(), &cart); err != nil {\n\t\thandler.Error(w, r, err)\n\t\tlogrus.Errorf(\"Unable to create shopping cart for user %d: %s\", user.ID, err)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusCreated)\n\tif err := json.NewEncoder(w).Encode(cart); err != nil {\n\t\tlogrus.Errorf(\"Unable to respond with cart %s\", err)\n\t}\n}", "func WithRqID(ctx context.Context, requestID string) context.Context {\n\treturn context.WithValue(ctx, requestIDKey, requestID)\n}", "func (o *SetCartDeliveryModeUsingPUTParams) WithTimeout(timeout time.Duration) *SetCartDeliveryModeUsingPUTParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *PutZoneParams) WithServerID(serverID string) *PutZoneParams {\n\to.SetServerID(serverID)\n\treturn o\n}", "func (m *MockCartDBAPI) RemoveCartItemID(arg0, arg1 string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"RemoveCartItemID\", arg0, arg1)\n}", "func CreateCart(name string) error {\n\tcart := domain.NewCart()\n\tcart.SetName(name)\n\tst := storage.NewMemoryStore()\n\treturn st.Save(cart.ID, cart.UncommitedChanges())\n}", "func (r *ReqGetCommitList) AddProjectID(val interface{}) *ReqGetCommitList {\n\t(*r)[KeyDataID] = fmt.Sprintf(\"%v\", val)\n\treturn r\n}", "func VPCID(vpcID string) RequestOptionFunc {\n\treturn func(body *RequestBody) error {\n\t\tbody.VpcId = vpcID\n\t\treturn nil\n\t}\n}", "func NewPutCustomersIdRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/customers/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"PUT\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "func (o *SetCartDeliveryModeUsingPUTParams) WithBaseSiteID(baseSiteID string) *SetCartDeliveryModeUsingPUTParams {\n\to.SetBaseSiteID(baseSiteID)\n\treturn o\n}", "func (m *MockCartDBAPI) AddToMergedCartIDs(arg0 string, arg1 ...string) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0}\n\tfor _, a := range arg1 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tm.ctrl.Call(m, \"AddToMergedCartIDs\", varargs...)\n}", "func withZoneproductID(id int) zoneproductOption {\n\treturn func(m *ZoneproductMutation) {\n\t\tvar (\n\t\t\terr error\n\t\t\tonce sync.Once\n\t\t\tvalue *Zoneproduct\n\t\t)\n\t\tm.oldValue = func(ctx context.Context) (*Zoneproduct, error) {\n\t\t\tonce.Do(func() {\n\t\t\t\tif m.done {\n\t\t\t\t\terr = fmt.Errorf(\"querying old values post mutation is not allowed\")\n\t\t\t\t} else {\n\t\t\t\t\tvalue, err = m.Client().Zoneproduct.Get(ctx, id)\n\t\t\t\t}\n\t\t\t})\n\t\t\treturn value, err\n\t\t}\n\t\tm.id = &id\n\t}\n}", "func GenerateUniqueCart(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{\"message\": \"NOT IMPLEMENTED\"})\n}", "func updateCart(locker *redislock.Client, c chan int, ctx context.Context, i int) {\n\n\tbackoff := redislock.LinearBackoff(10 * time.Millisecond)\n\tlock, err := locker.Obtain(ctx, \"my-key\", 2*time.Second, &redislock.Options{\n\t\tRetryStrategy: backoff,\n\t})\n\tif err == redislock.ErrNotObtained {\n\t\tfmt.Println(\"Could not obtain lock!\", lock)\n\t} else if err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tfmt.Println(\"lock saya\", i)\n\tlock.Release(ctx)\n\tfmt.Println(\"release\", i)\n\tc <- 1\n}", "func (a *IamProjectApiService) IamProjectTagPut(ctx context.Context, projectId string) ApiIamProjectTagPutRequest {\n\treturn ApiIamProjectTagPutRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tprojectId: projectId,\n\t}\n}", "func (cartData *CartData) CreateCartItem(CartID, UserID uint64) error {\n\tconn, err := db.MySQLConnect()\n\t// defer conn.Close()\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tconn.Close()\n\t\treturn err\n\t}\n\n\tcartItem := CartItem{\n\t\tCartID: CartID,\n\t}\n\n\tlog.Printf(\"Duzina: %d\", len(cartData.Items))\n\tfor _, item := range cartData.Items {\n\t\tcartItem.ItemID = item.ItemID\n\t\tcartItem.Amount = item.Amount\n\t\tlog.Printf(\"ITEMID: %d\", item.ItemID)\n\t\tconn.Create(&cartItem)\n\t\t// if createErr != nil {\n\t\t// \tlog.Println(\"Drugi fail\")\n\t\t// \tlog.Println(createErr.Error)\n\t\t// \tconn.Close()\n\t\t// \treturn createErr.Error\n\t\t// }\n\t\t// portions := GetPortionByCategoryID(item.CategoryID)\n\t\t// image := GetImageByItemID(item.ItemID)\n\t\t// ingredients := GetIngredientsByItemID(item.ItemID)\n\t\t// homeItem := HomeItem{\n\t\t// \tItem: item,\n\t\t// \tPortion: portions,\n\t\t// \tIngredient: ingredients,\n\t\t// \tImage: image,\n\t\t// }\n\t\t// homeItems = append(homeItems, homeItem)\n\t}\n\n\tdeliveryAt := time.Now().Add(DefaultOrderWaitTime).Format(\"H:i:s\")\n\tparsedDeliveryAt, parseErr := time.Parse(\"H:i:s\", deliveryAt)\n\tif parseErr != nil {\n\t\tlog.Println(parseErr.Error())\n\t}\n\n\torder := Order{\n\t\tUserID: UserID,\n\t\tCartID: CartID,\n\t\tIsCanceled: 0,\n\t\tIsDelivered: 0,\n\t\tIsAccepted: \"pending\",\n\t\tDeliveryAt: parsedDeliveryAt,\n\t\tCreatedAt: time.Now(),\n\t}\n\n\tconn.Create(&order)\n\t// if createErr != nil {\n\t// \tlog.Println(\"CreateERR\")\n\t// \tlog.Println(createErr.Error)\n\t// }\n\tconn.Close()\n\n\treturn nil\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithContext(ctx context.Context) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (s *Server) CreateCart(ctx context.Context, req *proto.CartCreateRequest) (*proto.CartResponse, error) {\n\tcart, err := s.carts.Create(ctx, req.UserId)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"failed to create the Cart: %s\", err)\n\t}\n\n\tpCart, err := toProtoCart(cart)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"failed to convert the Cart: %s\", err)\n\t}\n\n\treturn &proto.CartResponse{Cart: pCart}, nil\n}", "func (o *GiftMessageCartRepositoryV1SavePostParams) 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\t// path param cartId\n\tif err := r.SetPathParam(\"cartId\", swag.FormatInt64(o.CartID)); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.GiftMessageCartRepositoryV1SavePostBody); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (rest *RestApi) Init() error {\n rest.GoCart.loadConfig()\n mysql := MysqlConnection{\n host: rest.GoCart.Config.Database.Host,\n port: rest.GoCart.Config.Database.Port,\n user: rest.GoCart.Config.Database.Username,\n password: rest.GoCart.Config.Database.Password,\n database: rest.GoCart.Config.Database.Database,\n table: rest.GoCart.Config.Database.Cart.Table,\n table_index: rest.GoCart.Config.Database.Cart.Mappings.Index,\n }\n mysql.EnsureCartTable()\n\n rest.GoCart = GoCart{\n Connection: mysql,\n }\n router := mux.NewRouter()\n\n /**\n * GET request\n */\n //http.HandleFunc(\"/gocart/getCart\", func(w http.ResponseWriter, r *http.Request) {\n router.HandleFunc(\"/gocart/getCart\", func(w http.ResponseWriter, r *http.Request) {\n cart_id, err := strconv.ParseInt(r.URL.Query().Get(\"cart_id\"), 10, 64)\n if err != nil {\n panic(err)\n }\n rest.GetCart(w, r, cart_id)\n }).Methods(\"GET\")\n\n /**\n * POST request\n */\n router.HandleFunc(\"/gocart/addToCart\", func(w http.ResponseWriter, r *http.Request) {\n cart_id, err := strconv.ParseInt(r.URL.Query().Get(\"cart_id\"), 10, 64)\n if err != nil {\n panic(err)\n }\n items_qsp := r.URL.Query().Get(\"items\")\n item_quantity := r.URL.Query().Get(\"quantity\")\n\n ids := strings.Split(items_qsp, \",\")\n for _, item_id := range ids {\n item_id, err := strconv.ParseInt(item_id, 10, 64)\n if err != nil {\n panic(err)\n }\n item_quantity, err := strconv.ParseInt(item_quantity, 10, 64)\n if err != nil {\n panic(err)\n }\n rest.AddToCart(w, r, cart_id, item_id, item_quantity)\n }\n // @TODO: Print some error/success message\n }).Methods(\"POST\")\n\n log.Fatal(http.ListenAndServe(\":9090\", router))\n return nil\n}", "func (cc *CommandRestClient) Put(id string, cID string, body string, ctx context.Context) (string, error) {\n\treturn clients.PutRequest(cc.url+\"/\"+id+\"/command/\"+cID, []byte(body), ctx)\n}", "func (w *ServerInterfaceWrapper) PutInvoicesId(ctx echo.Context) error {\n\tvar err error\n\t// ------------- Path parameter \"id\" -------------\n\tvar id string\n\n\terr = runtime.BindStyledParameter(\"simple\", false, \"id\", ctx.Param(\"id\"), &id)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter id: %s\", err))\n\t}\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.PutInvoicesId(ctx, id)\n\treturn err\n}", "func (e *PlaceOrderServiceAdapter) PlaceGuestCart(ctx context.Context, cart *cartDomain.Cart, payment *placeorder.Payment) (placeorder.PlacedOrderInfos, error) {\n\treturn e.placeOrder(ctx, cart, payment)\n}", "func (_UsersData *UsersDataTransactorSession) SetIdCartNoHash(uuid [16]byte, idCartNoHash [32]byte) (*types.Transaction, error) {\n\treturn _UsersData.Contract.SetIdCartNoHash(&_UsersData.TransactOpts, uuid, idCartNoHash)\n}", "func (o *PcloudIkepoliciesPutParams) WithContext(ctx context.Context) *PcloudIkepoliciesPutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func GetCart(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{\"message\": \"NOT IMPLEMENTED\"})\n}", "func NewSetCartEntryUsingPUT1OK() *SetCartEntryUsingPUT1OK {\n\treturn &SetCartEntryUsingPUT1OK{}\n}", "func NewSetCartEntryUsingPUT1Forbidden() *SetCartEntryUsingPUT1Forbidden {\n\treturn &SetCartEntryUsingPUT1Forbidden{}\n}", "func NewSetCartDeliveryModeUsingPUTParamsWithTimeout(timeout time.Duration) *SetCartDeliveryModeUsingPUTParams {\n\tvar ()\n\treturn &SetCartDeliveryModeUsingPUTParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CreateCartUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *SetCartDeliveryModeUsingPUTParams) WithDeliveryModeID(deliveryModeID string) *SetCartDeliveryModeUsingPUTParams {\n\to.SetDeliveryModeID(deliveryModeID)\n\treturn o\n}", "func (w *ServerInterfaceWrapper) PutExpensesId(ctx echo.Context) error {\n\tvar err error\n\t// ------------- Path parameter \"id\" -------------\n\tvar id string\n\n\terr = runtime.BindStyledParameter(\"simple\", false, \"id\", ctx.Param(\"id\"), &id)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter id: %s\", err))\n\t}\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.PutExpensesId(ctx, id)\n\treturn err\n}", "func (w *Wallet) Put(label string, id Identity) error {\n\tcontent, err := id.toJSON()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn w.store.Put(label, content)\n}", "func (_UsersData *UsersDataSession) SetIdCartNoHash(uuid [16]byte, idCartNoHash [32]byte) (*types.Transaction, error) {\n\treturn _UsersData.Contract.SetIdCartNoHash(&_UsersData.TransactOpts, uuid, idCartNoHash)\n}", "func (o *CreateCartUsingPOSTParams) WithBaseSiteID(baseSiteID string) *CreateCartUsingPOSTParams {\n\to.SetBaseSiteID(baseSiteID)\n\treturn o\n}", "func (o *PutZoneParams) WithContext(ctx context.Context) *PutZoneParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func AddToContext(ctx context.Context, reqID string) context.Context {\n\treturn context.WithValue(ctx, reqIDKey, reqID)\n}", "func (o *PutZoneParams) WithZoneID(zoneID string) *PutZoneParams {\n\to.SetZoneID(zoneID)\n\treturn o\n}", "func (e *PlaceOrderServiceAdapter) PlaceCustomerCart(ctx context.Context, auth auth.Identity, cart *cartDomain.Cart, payment *placeorder.Payment) (placeorder.PlacedOrderInfos, error) {\n\treturn e.placeOrder(ctx, cart, payment)\n}", "func (cart *Cart) SaveCart() (*Cart, error) {\n\terr := db.Create(&cart).Error\n\tif err != nil && err != gorm.ErrRecordNotFound {\n\t\treturn nil, err\n\t}\n\n\treturn cart, nil\n}", "func (mr *MockCartDBAPIMockRecorder) CartIDIsPresent(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CartIDIsPresent\", reflect.TypeOf((*MockCartDBAPI)(nil).CartIDIsPresent), arg0)\n}", "func NewSetCartDeliveryModeUsingPUTParams() *SetCartDeliveryModeUsingPUTParams {\n\tvar ()\n\treturn &SetCartDeliveryModeUsingPUTParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (a *IamProjectRoleApiService) IamProjectRoleTagPut(ctx context.Context, projectId string, roleId string) ApiIamProjectRoleTagPutRequest {\n\treturn ApiIamProjectRoleTagPutRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tprojectId: projectId,\n\t\troleId: roleId,\n\t}\n}", "func (app *application) customerCart(w http.ResponseWriter, r *http.Request) {\n\tcustomerID := app.authenticatedCustomer(r)\n\tcart := app.carts[customerID]\n\n\tcartRowSlice := make([]cartRow, 0)\n\ttotal := 0\n\n\tfor listID, quantity := range cart {\n\t\tlisting, err := app.listings.Get(listID)\n\t\tif err != nil {\n\t\t\tapp.serverError(w, err)\n\t\t}\n\t\trow := cartRow{\n\t\t\tListingID: listing.ID,\n\t\t\tName: listing.Name,\n\t\t\tPrice: listing.Price,\n\t\t\tQuantity: quantity,\n\t\t\tAmount: quantity * listing.Price,\n\t\t}\n\t\tcartRowSlice = append(cartRowSlice, row)\n\t\ttotal += quantity * listing.Price\n\t}\n\tapp.render(w, r, \"customercart.page.tmpl\", &templateData{\n\t\tCart: cartRowSlice,\n\t\tCartTotal: total,\n\t})\n\treturn\n}", "func (cc *Chaincode) addInvestigationID(stub shim.ChaincodeStubInterface, params []string) sc.Response {\n\t// Check Access\n\tcreatorOrg, creatorCertIssuer, err := getTxCreatorInfo(stub)\n\tif !authenticatePolice(creatorOrg, creatorCertIssuer) {\n\t\treturn shim.Error(\"{\\\"Error\\\":\\\"Access Denied!\\\",\\\"Payload\\\":{\\\"MSP\\\":\\\"\" + creatorOrg + \"\\\",\\\"CA\\\":\\\"\" + creatorCertIssuer + \"\\\"}}\")\n\t}\n\n\t// Check if sufficient Params passed\n\tif len(params) != 2 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 2!\")\n\t}\n\n\t// Check if Params are non-empty\n\tfor a := 0; a < 2; a++ {\n\t\tif len(params[a]) <= 0 {\n\t\t\treturn shim.Error(\"Argument must be a non-empty string\")\n\t\t}\n\t}\n\n\t// Copy the Values from params[]\n\tID := params[0]\n\tNewInvestigationID := params[1]\n\n\t// Check if ChargeSheet exists with Key => ID\n\tchargeSheetAsBytes, err := stub.GetState(ID)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to get ChargeSheet Details!\")\n\t} else if chargeSheetAsBytes == nil {\n\t\treturn shim.Error(\"Error: ChargeSheet Does NOT Exist!\")\n\t}\n\n\t// Create Update struct var\n\tchargeSheetToUpdate := chargeSheet{}\n\terr = json.Unmarshal(chargeSheetAsBytes, &chargeSheetToUpdate) //unmarshal it aka JSON.parse()\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t// Check if Judgement is Complete or NOT\n\tif chargeSheetToUpdate.Complete {\n\t\treturn shim.Error(\"Error: ChargeSheet is Complete & Locked!\")\n\t}\n\n\t// Update ChargeSheet.InvestigationIDs to append => NewInvestigationID\n\tchargeSheetToUpdate.InvestigationIDs = append(chargeSheetToUpdate.InvestigationIDs, NewInvestigationID)\n\n\t// Convert to JSON bytes\n\tchargeSheetJSONasBytes, err := json.Marshal(chargeSheetToUpdate)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t// Put State of newly generated ChargeSheet with Key => ID\n\terr = stub.PutState(ID, chargeSheetJSONasBytes)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t// Returned on successful execution of the function\n\treturn shim.Success(chargeSheetJSONasBytes)\n}", "func WithTraceID(ctx context.Context, val interface{}) context.Context {\n\treturn context.WithValue(ctx, contextTraceID, val)\n}", "func (o *PcloudIkepoliciesPutParams) WithCloudInstanceID(cloudInstanceID string) *PcloudIkepoliciesPutParams {\n\to.SetCloudInstanceID(cloudInstanceID)\n\treturn o\n}", "func (o *SetCartDeliveryModeUsingPUTParams) WithUserID(userID string) *SetCartDeliveryModeUsingPUTParams {\n\to.SetUserID(userID)\n\treturn o\n}", "func (o *EmployeesByIDContractrulePutParams) WithContext(ctx context.Context) *EmployeesByIDContractrulePutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func WithRequestID(ctx context.Context, reqid string) context.Context {\n\treturn context.WithValue(ctx, reqidKey, reqid)\n}", "func (o *CreateCartUsingPOSTParams) WithContext(ctx context.Context) *CreateCartUsingPOSTParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewSetCartEntryUsingPUT1Created() *SetCartEntryUsingPUT1Created {\n\treturn &SetCartEntryUsingPUT1Created{}\n}" ]
[ "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.49105367", "0.49052542", "0.48776928", "0.4862299", "0.48366556", "0.48204342", "0.48097715", "0.48057014", "0.4793926", "0.47751504", "0.4764392", "0.47606197", "0.47543338", "0.4750464", "0.47351682", "0.47251862", "0.4720622", "0.4718508", "0.47118905", "0.47105712", "0.4701377", "0.46970382", "0.4667751", "0.46636507", "0.46538058", "0.4606184", "0.4587968", "0.45822474", "0.45693335", "0.45662603", "0.45600003", "0.455908", "0.45546684", "0.45534042", "0.45524406", "0.45369732", "0.45329878", "0.451921", "0.45128843", "0.4500013", "0.44946903", "0.44943702", "0.44796953", "0.44655728", "0.44579667", "0.44432092", "0.44280127", "0.4421054", "0.4418917", "0.44156936", "0.44130614", "0.4410797", "0.44077387", "0.44072214", "0.4406449", "0.43980503", "0.43750277", "0.43744072", "0.437078", "0.43536842", "0.43470886", "0.43449724", "0.43368918", "0.4332514", "0.4326371", "0.43256497", "0.43055785", "0.4304952", "0.43025947", "0.43011916", "0.4300207", "0.42806977", "0.42793244", "0.42766786", "0.42762893", "0.42728582", "0.42726418", "0.42678392", "0.42598528", "0.425651" ]
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 int64) {\n\to.CartID = cartID\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithCartID(cartID string) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetCartID(cartID)\n\treturn o\n}", "func (o *SetCartDeliveryModeUsingPUTParams) WithCartID(cartID string) *SetCartDeliveryModeUsingPUTParams {\n\to.SetCartID(cartID)\n\treturn o\n}", "func (o *NegotiableQuoteCouponManagementV1RemoveDeleteParams) SetCartID(cartID int64) {\n\to.CartID = cartID\n}", "func (m *MockCartDBAPI) AddCartID(arg0 string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"AddCartID\", arg0)\n}", "func (o *GiftMessageCartRepositoryV1SavePostParams) WithCartID(cartID int64) *GiftMessageCartRepositoryV1SavePostParams {\n\to.SetCartID(cartID)\n\treturn o\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.GetCart(cart_id)\n\n item := rest.GoCart.GetItem(item_id)\n item.SetItemQuantity(quantity)\n\n cart.Add(*item)\n rest.GoCart.SaveCart(*cart)\n}", "func (o *CreateCartUsingPOSTParams) SetOldCartID(oldCartID *string) {\n\to.OldCartID = oldCartID\n}", "func (mr *MockCartDBAPIMockRecorder) AddCartID(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddCartID\", reflect.TypeOf((*MockCartDBAPI)(nil).AddCartID), arg0)\n}", "func (o *GiftRegistryGuestCartShippingMethodManagementV1EstimateByRegistryIDPostParams) WithCartID(cartID string) *GiftRegistryGuestCartShippingMethodManagementV1EstimateByRegistryIDPostParams {\n\to.SetCartID(cartID)\n\treturn o\n}", "func GetCartByID(c *gin.Context) {\r\n\tid := c.Params.ByName(\"id\")\r\n\tvar cart []Models.Cart\r\n\terr := Models.GetCartByID(&cart, id)\r\n\tif err != nil {\r\n\t\tc.AbortWithStatus(http.StatusNotFound)\r\n\t} else {\r\n\t\tc.JSON(http.StatusOK, cart)\r\n\t}\r\n}", "func (o *CreateCartUsingPOSTParams) WithOldCartID(oldCartID *string) *CreateCartUsingPOSTParams {\n\to.SetOldCartID(oldCartID)\n\treturn o\n}", "func SetID(ctx context.Context, requestID string) context.Context {\n\treturn context.WithValue(ctx, requestIDKey, requestID)\n}", "func (m *MockCartDBAPI) AddCartItemID(arg0, arg1 string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"AddCartItemID\", arg0, arg1)\n}", "func (_UsersData *UsersDataTransactor) SetIdCartNoHash(opts *bind.TransactOpts, uuid [16]byte, idCartNoHash [32]byte) (*types.Transaction, error) {\n\treturn _UsersData.contract.Transact(opts, \"setIdCartNoHash\", uuid, idCartNoHash)\n}", "func (sc *StockCreate) SetZoneproductID(id int) *StockCreate {\n\tsc.mutation.SetZoneproductID(id)\n\treturn sc\n}", "func (_UsersData *UsersDataTransactorSession) SetIdCartNoHash(uuid [16]byte, idCartNoHash [32]byte) (*types.Transaction, error) {\n\treturn _UsersData.Contract.SetIdCartNoHash(&_UsersData.TransactOpts, uuid, idCartNoHash)\n}", "func (rest *RestApi) GetCart(w http.ResponseWriter, r *http.Request, id int64) error {\n gc := rest.GoCart\n cart := gc.GetCart(id)\n\n bytes, err := json.Marshal(cart)\n if err != nil {\n panic(err)\n }\n\n response := string(bytes)\n fmt.Fprintln(w, response)\n return nil\n}", "func (_UsersData *UsersDataSession) SetIdCartNoHash(uuid [16]byte, idCartNoHash [32]byte) (*types.Transaction, error) {\n\treturn _UsersData.Contract.SetIdCartNoHash(&_UsersData.TransactOpts, uuid, idCartNoHash)\n}", "func (e *PlaceOrderServiceAdapter) ReserveOrderID(ctx context.Context, cart *cartDomain.Cart) (string, error) {\n\treturn cart.ID, nil\n}", "func (cs *cpuState) SetCartRAM(ram []byte) error {\n\tif len(cs.Mem.CartRAM) == len(ram) {\n\t\tcopy(cs.Mem.CartRAM, ram)\n\t\treturn nil\n\t}\n\t// TODO: better checks if possible (e.g. real format, cart title/checksum, etc.)\n\treturn fmt.Errorf(\"ram size mismatch\")\n}", "func UpdateCart(cartID int, productID int, quantity int) (*Cart, error) {\n\ttx := db.Model(&Cart{}).Where(\"ID = ?\", cartID).Take(&Cart{}).UpdateColumns(\n\t\tmap[string]interface{}{\n\t\t\t\"ProductID\": productID,\n\t\t\t\"Quantity\": quantity,\n\t\t\t\"UpdatedAt\": time.Now(),\n\t\t},\n\t)\n\tif tx.Error != nil {\n\t\treturn &Cart{}, tx.Error\n\t}\n\n\t// check the updated cart\n\tvar cart Cart\n\terr := tx.Model(&Cart{}).Where(\"ID = ?\", cartID).Take(&cart).Error\n\tif err != nil && err != gorm.ErrRecordNotFound {\n\t\treturn nil, err\n\t}\n\n\treturn &cart, nil\n}", "func (rc *RentalCreate) SetCarID(u uuid.UUID) *RentalCreate {\n\trc.mutation.SetCarID(u)\n\treturn rc\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) 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\t// path param cartId\n\tif err := r.SetPathParam(\"cartId\", o.CartID); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.QuoteGuestCartManagementV1AssignCustomerPutBody); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func CreateCart(cr cart.Repository) http.Handler {\n\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tkey := r.URL.Query().Get(\"key\")\n\t\tif key == \"\" {\n\t\t\thttp.Error(w, \"missing key in query string\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tnewCart := cart.New(key)\n\t\terr := cr.Store(newCart)\n\t\tif err != nil {\n\t\t\t//error handling\n\t\t}\n\t\tval := []byte{}\n\t\terr2 := json.Unmarshal(val, newCart)\n\t\tif err2 != nil {\n\t\t\t//\n\t\t}\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tw.Write(val)\n\t})\n}", "func SetCtxID(ctx context.Context, contextID string) context.Context {\n\treturn context.WithValue(ctx, contextKeyID, contextID)\n}", "func UpdateProductCartByUserIdController(c echo.Context) error {\n\tdonorId , _ := strconv.Atoi(c.Request().Header.Get(\"userId\"))\n\t\n\tvar userCart []models.ProductCart\n\tc.Bind(&userCart)\n\t\n\terr := libdb.UpdateProductCartByUserId(userCart, donorId)\t\n\n\tif err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, response.Create(\"failed\", err.Error(), nil))\n\t}\n\n\treturn c.JSON(http.StatusOK, response.Create(\"success\", \"product cart is updated!\", nil))\n}", "func (m *MockCartDBAPI) RemoveCartItemID(arg0, arg1 string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"RemoveCartItemID\", arg0, arg1)\n}", "func (w *ServerInterfaceWrapper) PutCustomersId(ctx echo.Context) error {\n\tvar err error\n\t// ------------- Path parameter \"id\" -------------\n\tvar id string\n\n\terr = runtime.BindStyledParameter(\"simple\", false, \"id\", ctx.Param(\"id\"), &id)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter id: %s\", err))\n\t}\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.PutCustomersId(ctx, id)\n\treturn err\n}", "func (mr *MockCartDBAPIMockRecorder) AddCartItemID(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddCartItemID\", reflect.TypeOf((*MockCartDBAPI)(nil).AddCartItemID), arg0, arg1)\n}", "func (app *application) AddToCart(w http.ResponseWriter, r *http.Request) {\r\n\t// a seller does not have a shopping cart\r\n\tisSeller := app.isSeller(r)\r\n\tif isSeller {\r\n\t\tw.WriteHeader(http.StatusUnauthorized)\r\n\t\tapp.render(w, r, \"error.page.tmpl\", &templateData{\r\n\t\t\tError: http.StatusText(http.StatusUnauthorized),\r\n\t\t})\r\n\t\treturn\r\n\t}\r\n\r\n\t// retrieve userid from session cookie\r\n\tuserid := app.session.GetString(r, \"userid\")\r\n\r\n\t// retrieve ProductID from url\r\n\t// the ProducID should be valid\r\n\tproductID, err := strconv.Atoi(r.URL.Query().Get(\"productid\"))\r\n\tif err != nil {\r\n\t\tw.WriteHeader(http.StatusBadRequest)\r\n\t\tapp.render(w, r, \"error.page.tmpl\", &templateData{\r\n\t\t\tError: http.StatusText(http.StatusBadRequest),\r\n\t\t})\r\n\t\treturn\r\n\t}\r\n\r\n\t// perform the insert at the database\r\n\terr = app.cart.InsertItem(userid, productID)\r\n\tif err != nil {\r\n\t\tapp.errorLog.Println(err)\r\n\t\tw.WriteHeader(http.StatusInternalServerError)\r\n\t\tapp.render(w, r, \"error.page.tmpl\", &templateData{\r\n\t\t\tError: http.StatusText(http.StatusInternalServerError),\r\n\t\t})\r\n\t\treturn\r\n\t}\r\n\r\n\tapp.session.Put(r, \"flash\", \"Product successfully added to cart.\")\r\n\r\n\thttp.Redirect(w, r, r.Referer(), http.StatusSeeOther)\r\n}", "func (cc *ConstructionCreate) SetCityID(id int) *ConstructionCreate {\n\tcc.mutation.SetCityID(id)\n\treturn cc\n}", "func SetID(clientID string) {\n\tfmt.Println(\"Setting clientID\")\n\ttID = clientID\n}", "func NewPutCustomersIdRequest(server string, id string, body PutCustomersIdJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewPutCustomersIdRequestWithBody(server, id, \"application/json\", bodyReader)\n}", "func (mr *MockCartDBAPIMockRecorder) CartIDIsPresent(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"CartIDIsPresent\", reflect.TypeOf((*MockCartDBAPI)(nil).CartIDIsPresent), arg0)\n}", "func (this *XplusYeqZ) SetID(propID core.PropId) {\n\tthis.id = propID\n}", "func (p *Process) CmdSetID(pac teoapi.Packet) (err error) {\n\tdata := pac.RemoveTrailingZero(pac.Data())\n\trequest := cdb.KeyValue{Cmd: pac.Cmd()}\n\tif err = request.UnmarshalText(data); err != nil {\n\t\treturn\n\t} else if err = p.tcdb.SetID(request.Key, request.Value); err != nil {\n\t\treturn\n\t}\n\t// Return only Value for text requests and all fields for json\n\tresponce := request\n\tresponce.Value = nil\n\tif !request.RequestInJSON {\n\t\t_, err = p.tcdb.con.SendAnswer(pac, pac.Cmd(), responce.Value)\n\t} else if retdata, err := responce.MarshalText(); err == nil {\n\t\t_, err = p.tcdb.con.SendAnswer(pac, pac.Cmd(), retdata)\n\t}\n\treturn\n}", "func AddCart() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\trequestBody := model.ChatfuelCarts{}\n\t\tc.Bind(&requestBody)\n\n\t\tcart := model.Carts{\n\t\t\tMessengerUserID: requestBody.MessengerUserID,\n\t\t\tFirstName: requestBody.FirstName,\n\t\t\tProductID: requestBody.ProductID,\n\t\t\tProductName: requestBody.ProductName,\n\t\t\tQty: requestBody.Qty,\n\t\t\tPrice: requestBody.Price,\n\t\t}\n\n\t\tdb.Db.Create(&cart)\n\n\t\ttext := []model.Text{}\n\t\ttext = append(text, model.Text{\n\t\t\tText: \"加入購物車成功\",\n\t\t})\n\n\t\tmessage := model.Message{\n\t\t\tMessage: text,\n\t\t}\n\n\t\tc.JSON(http.StatusOK, message)\n\t}\n}", "func CreateCart(name string) error {\n\tcart := domain.NewCart()\n\tcart.SetName(name)\n\tst := storage.NewMemoryStore()\n\treturn st.Save(cart.ID, cart.UncommitedChanges())\n}", "func (o *PostMultiNodeDeviceParams) SetContractID(contractID *int64) {\n\to.ContractID = contractID\n}", "func (m *MockCartDBAPI) SetCartType(arg0 string, arg1 byte) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"SetCartType\", arg0, arg1)\n}", "func SetTraceID(ctx context.Context, traceID string) context.Context {\n\treturn context.WithValue(ctx, traceIDKey, traceID)\n}", "func (epc *EntryPointCreate) SetCid(s string) *EntryPointCreate {\n\tepc.mutation.SetCid(s)\n\treturn epc\n}", "func (cc *CheckoutCreate) SetCustomerID(id int) *CheckoutCreate {\n\tcc.mutation.SetCustomerID(id)\n\treturn cc\n}", "func SetCtxRequestID(c *gin.Context, requestid string) {\n\t// set in context\n\tc.Set(RequestIDKey, requestid)\n\t// set in header\n\tc.Writer.Header().Set(RequestIDKey, requestid)\n}", "func (tcdb *Teocdb) SetID(key string, value []byte) (err error) {\n\tnextID, err := strconv.Atoi(string(value))\n\tif err != nil {\n\t\treturn\n\t}\n\treturn tcdb.session.Query(`UPDATE ids SET next_id = ? WHERE id_name = ?`,\n\t\tnextID, key).Exec()\n}", "func (rb *ResourceBuilder) SetContainerID(val string) {\n\tif rb.config.ContainerID.Enabled {\n\t\trb.res.Attributes().PutStr(\"container.id\", val)\n\t}\n}", "func InsertProductIntoCart(id_user, id_product int, product model.Product, qty int) (interface{}, error) {\n\t// insert and select data product to cart\n\tshoppingCart := model.Shopping_cart{\n\t\tUser_id: id_user,\n\t\tProduct_id: id_product,\n\t\tName: product.Name,\n\t\tCategory: product.Category,\n\t\tType: product.Type,\n\t\tPrice: product.Price,\n\t\tQty: qty,\n\t}\n\tif err := config.DB.Save(&shoppingCart).Error; err != nil {\n\t\treturn shoppingCart, err\n\t}\n\treturn shoppingCart, nil\n}", "func (sc *StockCreate) SetIDstock(s string) *StockCreate {\n\tsc.mutation.SetIDstock(s)\n\treturn sc\n}", "func AddItemToCart(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{\"message\": \"NOT IMPLEMENTED\"})\n}", "func (mr *MockCartDBAPIMockRecorder) SetCartType(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetCartType\", reflect.TypeOf((*MockCartDBAPI)(nil).SetCartType), arg0, arg1)\n}", "func GetCart(c *gin.Context) {\r\n\tvar cart []Models.Cart\r\n\terr := Models.GetCart(&cart)\r\n\tif err != nil {\r\n\t\tc.AbortWithStatus(http.StatusNotFound)\r\n\t} else {\r\n\t\tc.JSON(http.StatusOK, cart)\r\n\t}\r\n}", "func (tx *Transaction) SetID() error {\n\tvar encoded bytes.Buffer\n\tvar hash [32]byte\n\n\tenc := json.NewEncoder(&encoded)\n\tif err := enc.Encode(tx); err != nil {\n\t\treturn err\n\t}\n\n\thash = sha256.Sum256(encoded.Bytes())\n\ttx.id = hash[:]\n\treturn nil\n}", "func (e *PlaceOrderServiceAdapter) PlaceGuestCart(ctx context.Context, cart *cartDomain.Cart, payment *placeorder.Payment) (placeorder.PlacedOrderInfos, error) {\n\treturn e.placeOrder(ctx, cart, payment)\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (s *Server) CreateCart(ctx context.Context, req *proto.CartCreateRequest) (*proto.CartResponse, error) {\n\tcart, err := s.carts.Create(ctx, req.UserId)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"failed to create the Cart: %s\", err)\n\t}\n\n\tpCart, err := toProtoCart(cart)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"failed to convert the Cart: %s\", err)\n\t}\n\n\treturn &proto.CartResponse{Cart: pCart}, nil\n}", "func SetCspanID(ctx context.Context, cspanID string) context.Context {\n\treturn context.WithValue(ctx, cspanIDKey, cspanID)\n}", "func (o *PutZoneParams) SetServerID(serverID string) {\n\to.ServerID = serverID\n}", "func (bc *BlockCreate) SetCid(s string) *BlockCreate {\n\tbc.mutation.SetCid(s)\n\treturn bc\n}", "func (o *GetAnOrderProductParams) SetID(id string) {\n\to.ID = id\n}", "func (cart *Cart) SaveCart() (*Cart, error) {\n\terr := db.Create(&cart).Error\n\tif err != nil && err != gorm.ErrRecordNotFound {\n\t\treturn nil, err\n\t}\n\n\treturn cart, nil\n}", "func (o *PutZoneParams) WithServerID(serverID string) *PutZoneParams {\n\to.SetServerID(serverID)\n\treturn o\n}", "func (c *container) SetNameAndID(oldID string) error {\n\tif c.config == nil {\n\t\treturn errors.New(\"config is not set\")\n\t}\n\n\tif c.sboxConfig == nil {\n\t\treturn errors.New(\"sandbox config is nil\")\n\t}\n\n\tif c.sboxConfig.Metadata == nil {\n\t\treturn errors.New(\"sandbox metadata is nil\")\n\t}\n\n\tvar id string\n\tif oldID == \"\" {\n\t\tid = stringid.GenerateNonCryptoID()\n\t} else {\n\t\tid = oldID\n\t}\n\tname := strings.Join([]string{\n\t\t\"k8s\",\n\t\tc.config.Metadata.Name,\n\t\tc.sboxConfig.Metadata.Name,\n\t\tc.sboxConfig.Metadata.Namespace,\n\t\tc.sboxConfig.Metadata.Uid,\n\t\tfmt.Sprintf(\"%d\", c.config.Metadata.Attempt),\n\t}, \"_\")\n\n\tc.id = id\n\tc.name = name\n\treturn nil\n}", "func (e *PlaceOrderServiceAdapter) PlaceCustomerCart(ctx context.Context, auth auth.Identity, cart *cartDomain.Cart, payment *placeorder.Payment) (placeorder.PlacedOrderInfos, error) {\n\treturn e.placeOrder(ctx, cart, payment)\n}", "func (o *NegotiableQuoteCouponManagementV1RemoveDeleteParams) WithCartID(cartID int64) *NegotiableQuoteCouponManagementV1RemoveDeleteParams {\n\to.SetCartID(cartID)\n\treturn o\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (m *StockMutation) SetZoneproductID(id int) {\n\tm.zoneproduct = &id\n}", "func NewCart() console.Cartridge {\n\treturn &cartridge{\n\t\tBaseCartridge: console.NewBaseCart(),\n\t}\n}", "func (m *AuthenticationContext) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "func (o *SetCartDeliveryModeUsingPUTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (plgf PLGridFacade) SetId(smRecord *SMRecord, id string) {\n\tsmRecord.JobID = id\n}", "func (ec *EquipmentCreate) SetZoneID(id int) *EquipmentCreate {\n\tec.mutation.SetZoneID(id)\n\treturn ec\n}", "func (m *AgedAccountsPayable) SetId(value *i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "func (app *application) customerCart(w http.ResponseWriter, r *http.Request) {\n\tcustomerID := app.authenticatedCustomer(r)\n\tcart := app.carts[customerID]\n\n\tcartRowSlice := make([]cartRow, 0)\n\ttotal := 0\n\n\tfor listID, quantity := range cart {\n\t\tlisting, err := app.listings.Get(listID)\n\t\tif err != nil {\n\t\t\tapp.serverError(w, err)\n\t\t}\n\t\trow := cartRow{\n\t\t\tListingID: listing.ID,\n\t\t\tName: listing.Name,\n\t\t\tPrice: listing.Price,\n\t\t\tQuantity: quantity,\n\t\t\tAmount: quantity * listing.Price,\n\t\t}\n\t\tcartRowSlice = append(cartRowSlice, row)\n\t\ttotal += quantity * listing.Price\n\t}\n\tapp.render(w, r, \"customercart.page.tmpl\", &templateData{\n\t\tCart: cartRowSlice,\n\t\tCartTotal: total,\n\t})\n\treturn\n}", "func (o *UpdateZoneProjectsUsingPUTParams) SetID(id strfmt.UUID) {\n\to.ID = id\n}", "func (m *StockMutation) SetIDstock(s string) {\n\tm._IDstock = &s\n}", "func (store *Store) AddToCart(ctx *gin.Context) (bool, error) {\n\tctx.String(200, \"You are trying to add items to the cart.\")\n\treturn true, nil\n}", "func (transaction *ContractUpdateTransaction) SetContractID(contractID ContractID) *ContractUpdateTransaction {\n\ttransaction.pb.ContractID = contractID.toProtobuf()\n\treturn transaction\n}", "func TestCartScenario(t *testing.T) {\n\t\n\te := httpexpect.New(t, API_URL)\n\t\n\tprintComment(\"SC20001\", \"Test Add 2 items of Unlimited 1 GB for $24.90\")\n\tcart := map[string]interface{}{\n\t\t\"code\": \"ult_small\",\n\t\t\"name\": \"Unlimited 1GB\",\n\t\t\"price\": 24.90,\n\t\t\"items\": 2,\n\t}\n\n\te.POST(\"/cart\").\n\t\tWithJSON(cart).\n\t\tExpect().\n\t\tStatus(http.StatusOK)\n\n}", "func (store *Store) Cart(ctx *gin.Context) (bool, error) {\n\tctx.String(200, \"You have requested the cart.\")\n\treturn true, nil\n}", "func (db *DB) AddItemToCart(ctx context.Context, cartID, productName string, quantity float64) (*service.CartItem, error) {\n\tcartObjID, err := primitive.ObjectIDFromHex(cartID)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"could not convert %s to ObjectID\", cartID)\n\t}\n\tcartItemID := primitive.NewObjectID()\n\tupdateResult, err := db.Carts.UpdateOne(\n\t\tctx,\n\t\tbson.M{\"_id\": cartObjID},\n\t\tbson.D{\n\t\t\tbson.E{Key: \"$addToSet\", Value: bson.D{\n\t\t\t\tbson.E{Key: \"items\", Value: bson.M{\n\t\t\t\t\t\"id\": cartItemID,\n\t\t\t\t\t\"cart_id\": cartObjID,\n\t\t\t\t\t\"product\": productName,\n\t\t\t\t\t\"quantity\": quantity,\n\t\t\t\t}},\n\t\t\t}},\n\t\t})\n\tswitch {\n\tcase err != nil:\n\t\treturn nil, errors.Wrap(err, \"could not add item to cart\")\n\tcase updateResult.MatchedCount == 0:\n\t\treturn nil, errors.Wrap(ErrNotFound, \"no carts\")\n\tcase updateResult.ModifiedCount == 0:\n\t\treturn nil, errors.New(\"could not add item\")\n\tdefault:\n\t\treturn &service.CartItem{\n\t\t\tID: cartItemID,\n\t\t\tCartID: cartObjID,\n\t\t\tProductName: productName,\n\t\t\tQuantity: quantity,\n\t\t}, nil\n\t}\n}", "func SetRequestID(ctx context.Context, id int) context.Context {\n\treturn context.WithValue(ctx, requestIDKey, id)\n}", "func (r *AlibabaAliqinFcIotRechargeCardAPIRequest) SetIccid(_iccid string) error {\n\tr._iccid = _iccid\n\tr.Set(\"iccid\", _iccid)\n\treturn nil\n}", "func (m *PaymentTerm) SetId(value *i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "func (t *Transaction) SetID() {\n\t// Create some data as a buffer and a hash variable\n\tvar d bytes.Buffer\n\tvar h [32]byte\n\n\t// Create a new encoder, passing the data to it\n\tvar e = gob.NewEncoder(&d)\n\n\t// Encode the transaction, handling any errors\n\terr := e.Encode(t)\n\tHandleError(err)\n\n\t// Create a hash with the datas bytes and assign to the transaction\n\th = sha256.Sum256(d.Bytes())\n\tt.ID = h[:]\n\n}", "func (m *PgModel) AddCartCoupon(ctx context.Context, cartUUID, couponUUID string) (*CartCouponJoinRow, error) {\n\tcontextLogger := log.WithContext(ctx)\n\tcontextLogger.Debugf(\"postgres: AddCartCoupon(ctx context.Context, cartUUID=%q, couponUUID=%q string) started\", cartUUID, couponUUID)\n\n\t// 1. Check the cart exists\n\tq1 := \"SELECT id FROM cart WHERE uuid = $1\"\n\tvar cartID int\n\terr := m.db.QueryRowContext(ctx, q1, cartUUID).Scan(&cartID)\n\tif err == sql.ErrNoRows {\n\t\treturn nil, ErrCartNotFound\n\t}\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"postgres: query row context failed for q1=%q\", q1)\n\t}\n\n\t// 2. Check the coupon exists\n\tq2 := `\n\t\tSELECT\n\t\t c.id, c.coupon_code, void, reusable, spend_count, r.uuid as promo_rule_uuid,\n\t\t r.start_at, r.end_at\n\t\tFROM coupon AS c\n\t\tINNER JOIN promo_rule AS r\n\t\t ON r.id = c.promo_rule_id\n\t\tWHERE c.uuid = $1\n\t`\n\tvar void bool\n\tvar reusable bool\n\tvar spendCount int\n\tvar startAt *time.Time\n\tvar endAt *time.Time\n\n\tvar c CartCouponJoinRow\n\tc.cartID = cartID\n\tc.CartUUID = cartUUID\n\tc.CouponUUID = couponUUID\n\terr = m.db.QueryRowContext(ctx, q2, couponUUID).Scan(&c.couponID, &c.CouponCode, &void, &reusable, &spendCount, &c.PromoRuleUUID, &startAt, &endAt)\n\tif err == sql.ErrNoRows {\n\t\treturn nil, ErrCouponNotFound\n\t}\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"postgres: query row context failed for q2=%q\", q2)\n\t}\n\n\t// 3. Check the coupon has not already been applied to the cart.\n\tq3 := \"SELECT EXISTS(SELECT 1 FROM cart_coupon WHERE cart_id = $1 AND coupon_id = $2) AS exists\"\n\tvar exists bool\n\terr = m.db.QueryRowContext(ctx, q3, cartID, c.couponID).Scan(&exists)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"postgres: m.db.QueryRowContext(ctx, q3=%q, cartID=%d, c.couponID=%d).Scan(...) failed\", q3, cartID, c.couponID)\n\t}\n\n\tif exists {\n\t\treturn nil, ErrCartCouponExists\n\t}\n\n\t// Check if the coupon has been voided\n\tif void {\n\t\tcontextLogger.Debugf(\"postgres: coupon is void (couponUUID=%q)\", couponUUID)\n\t\treturn nil, ErrCouponVoid\n\t}\n\n\t// Check if the coupon has been used. (Only applies to non-reusable coupons)\n\tif !reusable && spendCount > 0 {\n\t\tcontextLogger.Debug(\"postgres: coupon is not reusable and spendCount > 0. The coupon has been already used.\")\n\t\treturn nil, ErrCouponUsed\n\t}\n\n\t// Check if the coupon has expired\n\tif startAt != nil && endAt != nil {\n\t\tnow := time.Now()\n\n\t\tdiffStart := now.Sub(*startAt)\n\n\t\t// if the difference is a negative value,\n\t\t// then the coupon hasn't yet started\n\t\thoursToStart := diffStart.Hours()\n\t\tif hoursToStart < 0 {\n\t\t\tcontextLogger.Infof(\"postgres: coupon is %.1f hours before start at date\", hoursToStart)\n\t\t\treturn nil, ErrCouponNotAtStartDate\n\t\t}\n\n\t\t// if the difference is a positive value,\n\t\t// then the coupon has expired.\n\t\tdiffEnd := now.Sub(*endAt)\n\t\thoursOverEnd := diffEnd.Hours()\n\t\tif hoursOverEnd > 0 {\n\t\t\tcontextLogger.Infof(\"postgres: coupon is %.1f hours over the end at date\", hoursOverEnd)\n\t\t\treturn nil, ErrCouponExpired\n\t\t}\n\n\t\tformat := \"2006-01-02 15:04:05 GMT\"\n\t\tcontextLogger.Infof(\"postgres: coupon is between %s and %s.\", startAt.In(loc).Format(format), endAt.In(loc).Format(format))\n\t} else {\n\t\tcontextLogger.Debugf(\"postgres: startAt for promo rule %q is nil\", c.PromoRuleUUID)\n\t}\n\n\t// 4. Insert the cart coupon.\n\tq4 := `\n\t\tINSERT INTO cart_coupon\n\t\t (cart_id, coupon_id)\n\t\tVALUES\n\t\t ($1, $2)\n\t\tRETURNING\n\t\t id, uuid, cart_id, coupon_id, created, modified\n\t`\n\trow := m.db.QueryRowContext(ctx, q4, cartID, c.couponID)\n\tif err := row.Scan(&c.id, &c.UUID, &c.cartID, &c.couponID, &c.Created, &c.Modified); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"postgres: query scan failed q4=%q\", q4)\n\t}\n\n\treturn &c, nil\n}", "func (m *MockCartDBAPI) CartIDIsPresent(arg0 string) bool {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CartIDIsPresent\", arg0)\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "func (dc *DentistCreate) SetCardid(s string) *DentistCreate {\n\tdc.mutation.SetCardid(s)\n\treturn dc\n}", "func (tx *Transaction) SetID() {\n\tvar encoded bytes.Buffer\n\tvar hash [32]byte\n\tencoder := gob.NewEncoder(&encoded)\n\terr := encoder.Encode(tx)\n\tHandle(err)\n\thash = sha256.Sum256(encoded.Bytes())\n\ttx.ID = hash[:]\n}", "func GetCart(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{\"message\": \"NOT IMPLEMENTED\"})\n}", "func (myTagKey *TagKey) SetID(val string) {\n\tmyTagKey.IDvar = val\n}", "func (mr *MockCartDBAPIMockRecorder) RemoveCartItemID(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"RemoveCartItemID\", reflect.TypeOf((*MockCartDBAPI)(nil).RemoveCartItemID), arg0, arg1)\n}", "func (rest *RestApi) Init() error {\n rest.GoCart.loadConfig()\n mysql := MysqlConnection{\n host: rest.GoCart.Config.Database.Host,\n port: rest.GoCart.Config.Database.Port,\n user: rest.GoCart.Config.Database.Username,\n password: rest.GoCart.Config.Database.Password,\n database: rest.GoCart.Config.Database.Database,\n table: rest.GoCart.Config.Database.Cart.Table,\n table_index: rest.GoCart.Config.Database.Cart.Mappings.Index,\n }\n mysql.EnsureCartTable()\n\n rest.GoCart = GoCart{\n Connection: mysql,\n }\n router := mux.NewRouter()\n\n /**\n * GET request\n */\n //http.HandleFunc(\"/gocart/getCart\", func(w http.ResponseWriter, r *http.Request) {\n router.HandleFunc(\"/gocart/getCart\", func(w http.ResponseWriter, r *http.Request) {\n cart_id, err := strconv.ParseInt(r.URL.Query().Get(\"cart_id\"), 10, 64)\n if err != nil {\n panic(err)\n }\n rest.GetCart(w, r, cart_id)\n }).Methods(\"GET\")\n\n /**\n * POST request\n */\n router.HandleFunc(\"/gocart/addToCart\", func(w http.ResponseWriter, r *http.Request) {\n cart_id, err := strconv.ParseInt(r.URL.Query().Get(\"cart_id\"), 10, 64)\n if err != nil {\n panic(err)\n }\n items_qsp := r.URL.Query().Get(\"items\")\n item_quantity := r.URL.Query().Get(\"quantity\")\n\n ids := strings.Split(items_qsp, \",\")\n for _, item_id := range ids {\n item_id, err := strconv.ParseInt(item_id, 10, 64)\n if err != nil {\n panic(err)\n }\n item_quantity, err := strconv.ParseInt(item_quantity, 10, 64)\n if err != nil {\n panic(err)\n }\n rest.AddToCart(w, r, cart_id, item_id, item_quantity)\n }\n // @TODO: Print some error/success message\n }).Methods(\"POST\")\n\n log.Fatal(http.ListenAndServe(\":9090\", router))\n return nil\n}", "func (qiu *QueueItemUpdate) SetCityID(id int) *QueueItemUpdate {\n\tqiu.mutation.SetCityID(id)\n\treturn qiu\n}", "func (o *PutStackParams) SetID(id int64) {\n\to.ID = id\n}", "func (mr *MockCartMockRecorder) GetCart(ctx, userId interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetCart\", reflect.TypeOf((*MockCart)(nil).GetCart), ctx, userId)\n}", "func (o *CreateCartUsingPOSTParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func UpdateCartItem(c *gin.Context) {\n\tc.JSON(http.StatusOK, gin.H{\"message\": \"NOT IMPLEMENTED\"})\n}" ]
[ "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.5021661", "0.501142", "0.49601832", "0.48196527", "0.48175153", "0.48162588", "0.4788825", "0.47888032", "0.47683886", "0.47579926", "0.47378618", "0.47090933", "0.47088704", "0.47064927", "0.4706185", "0.46722937", "0.4670649", "0.46679726", "0.46579868", "0.4650363", "0.46499646", "0.46398053", "0.4637143", "0.46231818", "0.46161276", "0.46102396", "0.46079022", "0.46003562", "0.45900357", "0.45816934", "0.45741194", "0.45702305", "0.45663837", "0.45541304", "0.45527047", "0.45520094", "0.4539599", "0.45279583", "0.4522118", "0.45216757", "0.4521001", "0.4515953", "0.4515431", "0.45127857", "0.45049554", "0.4500492", "0.44905502", "0.4488486", "0.44846174", "0.44823202", "0.4478704", "0.44692758", "0.4467524", "0.44665405", "0.44571403", "0.44548133", "0.4448149", "0.44364485", "0.44280162", "0.44260773", "0.44258907", "0.44244015", "0.44236553", "0.44167084", "0.4416636", "0.44107205", "0.44054678", "0.44025156", "0.43937382", "0.4393678", "0.43861967", "0.43848687", "0.4382871", "0.4377254", "0.43665725", "0.43624568", "0.43607637", "0.43603992", "0.43601927" ]
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}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithContext(ctx context.Context) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithHTTPClient(client *http.Client) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParams() *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithHTTPClient(client *http.Client) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithCartID(cartID string) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetCartID(cartID)\n\treturn o\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) 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\t// path param cartId\n\tif err := r.SetPathParam(\"cartId\", o.CartID); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.QuoteGuestCartManagementV1AssignCustomerPutBody); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithContext(ctx context.Context) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) WithContext(ctx context.Context) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *GetIPAMsubnetsParams) SetCustomer(customer *string) {\n\to.Customer = customer\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) WithContext(ctx context.Context) *AssignUserToCustomerGroupUsingPATCH1Params {\n\to.SetContext(ctx)\n\treturn o\n}", "func (rrc *ReserveRoomCreate) SetCustomer(c *Customer) *ReserveRoomCreate {\n\treturn rrc.SetCustomerID(c.ID)\n}", "func (o *PostMultiNodeDeviceParams) SetCustomer(customer *string) {\n\to.Customer = customer\n}", "func (m *CarserviceMutation) SetCustomer(s string) {\n\tm.customer = &s\n}", "func (cc *CheckoutCreate) SetCustomer(c *Customer) *CheckoutCreate {\n\treturn cc.SetCustomerID(c.ID)\n}", "func NewAssignUserToCustomerGroupUsingPATCH1Params() *AssignUserToCustomerGroupUsingPATCH1Params {\n\tvar ()\n\treturn &AssignUserToCustomerGroupUsingPATCH1Params{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewAssignUserToCustomerGroupUsingPATCH1ParamsWithHTTPClient(client *http.Client) *AssignUserToCustomerGroupUsingPATCH1Params {\n\tvar ()\n\treturn &AssignUserToCustomerGroupUsingPATCH1Params{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *Rental) SetCustomerP(exec boil.Executor, insert bool, related *Customer) {\n\tif err := o.SetCustomer(exec, insert, related); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o *Rental) SetCustomerGP(insert bool, related *Customer) {\n\tif err := o.SetCustomer(boil.GetDB(), insert, related); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func NewQuoteBillingAddressManagementV1AssignPostMineOK() *QuoteBillingAddressManagementV1AssignPostMineOK {\n\treturn &QuoteBillingAddressManagementV1AssignPostMineOK{}\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) WithCompanyCreditCreditHistoryManagementV1UpdatePutBody(companyCreditCreditHistoryManagementV1UpdatePutBody CompanyCreditCreditHistoryManagementV1UpdatePutBody) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\to.SetCompanyCreditCreditHistoryManagementV1UpdatePutBody(companyCreditCreditHistoryManagementV1UpdatePutBody)\n\treturn o\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) WithHTTPClient(client *http.Client) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (a *Client) SharedCatalogCompanyManagementV1AssignCompaniesPost(params *SharedCatalogCompanyManagementV1AssignCompaniesPostParams) (*SharedCatalogCompanyManagementV1AssignCompaniesPostOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewSharedCatalogCompanyManagementV1AssignCompaniesPostParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"sharedCatalogCompanyManagementV1AssignCompaniesPost\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/V1/sharedCatalog/{sharedCatalogId}/assignCompanies\",\n\t\tProducesMediaTypes: []string{\"\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &SharedCatalogCompanyManagementV1AssignCompaniesPostReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*SharedCatalogCompanyManagementV1AssignCompaniesPostOK), nil\n\n}", "func (o *Rental) SetCustomer(exec boil.Executor, insert bool, related *Customer) error {\n\tvar err error\n\tif insert {\n\t\tif err = related.Insert(exec); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to insert into foreign table\")\n\t\t}\n\t}\n\n\tupdateQuery := fmt.Sprintf(\n\t\t\"UPDATE `rental` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, []string{\"customer_id\"}),\n\t\tstrmangle.WhereClause(\"`\", \"`\", 0, rentalPrimaryKeyColumns),\n\t)\n\tvalues := []interface{}{related.CustomerID, o.RentalID}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, updateQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tif _, err = exec.Exec(updateQuery, values...); err != nil {\n\t\treturn errors.Wrap(err, \"failed to update local table\")\n\t}\n\n\to.CustomerID = related.CustomerID\n\n\tif o.R == nil {\n\t\to.R = &rentalR{\n\t\t\tCustomer: related,\n\t\t}\n\t} else {\n\t\to.R.Customer = related\n\t}\n\n\tif related.R == nil {\n\t\trelated.R = &customerR{\n\t\t\tRentals: RentalSlice{o},\n\t\t}\n\t} else {\n\t\trelated.R.Rentals = append(related.R.Rentals, o)\n\t}\n\n\treturn nil\n}", "func (bc *BillCreate) SetCustomer(c *Customer) *BillCreate {\n\treturn bc.SetCustomerID(c.ID)\n}", "func (pc *ProblemCreate) SetCustomer(c *Customer) *ProblemCreate {\n\treturn pc.SetCustomerID(c.ID)\n}", "func (oiu *OrderInfoUpdate) SetCustomer(c *Customer) *OrderInfoUpdate {\n\treturn oiu.SetCustomerID(c.ID)\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) WithHTTPClient(client *http.Client) *AssignUserToCustomerGroupUsingPATCH1Params {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (oiuo *OrderInfoUpdateOne) SetCustomer(c *Customer) *OrderInfoUpdateOne {\n\treturn oiuo.SetCustomerID(c.ID)\n}", "func NewAssignPostRequestBody()(*AssignPostRequestBody) {\n m := &AssignPostRequestBody{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) WithTimeout(timeout time.Duration) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) WithTimeout(timeout time.Duration) *AssignUserToCustomerGroupUsingPATCH1Params {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (svc SSHKeysService) AssignToCluster(ctx context.Context, prj, dc, cls, id string) (*SSHKey, *http.Response, error) {\n\tret := new(SSHKey)\n\tpath := clusterSSHKeyPath(prj, dc, cls, id)\n\treq, err := svc.client.NewRequest(http.MethodPut, path, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tresp, err := svc.client.Do(ctx, req, ret)\n\treturn ret, resp, err\n}", "func (o *GetIPAMsubnetsParams) WithCustomer(customer *string) *GetIPAMsubnetsParams {\n\to.SetCustomer(customer)\n\treturn o\n}", "func NewReplacechangeaspecificCustomerRequest(server string, id string, body ReplacechangeaspecificCustomerJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewReplacechangeaspecificCustomerRequestWithBody(server, id, \"application/json\", bodyReader)\n}", "func (c *Client) Assign(ctx context.Context, id uint64, role NodeRole) error {\n\trequest := protocol.Message{}\n\tresponse := protocol.Message{}\n\n\trequest.Init(4096)\n\tresponse.Init(4096)\n\n\tprotocol.EncodeAssign(&request, id, uint64(role))\n\n\tif err := c.protocol.Call(ctx, &request, &response); err != nil {\n\t\treturn err\n\t}\n\n\tif err := protocol.DecodeEmpty(&response); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (r a) Assign(company string, team string, engagement string, params map[string]string) (*http.Response, []byte) {\n return r.client.Put(\"/otask/v1/tasks/companies/\" + company + \"/teams/\" + team + \"/engagements/\" + engagement + \"/tasks\", params)\n}", "func NewReplacechangeaspecificCustomerRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/customers/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"PUT\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "func NewAssignUserToCustomerGroupUsingPATCH1ParamsWithTimeout(timeout time.Duration) *AssignUserToCustomerGroupUsingPATCH1Params {\n\tvar ()\n\treturn &AssignUserToCustomerGroupUsingPATCH1Params{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) SetCompanyCreditCreditHistoryManagementV1UpdatePutBody(companyCreditCreditHistoryManagementV1UpdatePutBody CompanyCreditCreditHistoryManagementV1UpdatePutBody) {\n\to.CompanyCreditCreditHistoryManagementV1UpdatePutBody = companyCreditCreditHistoryManagementV1UpdatePutBody\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetCartID(cartID string) {\n\to.CartID = cartID\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) WithGroupID(groupID string) *AssignUserToCustomerGroupUsingPATCH1Params {\n\to.SetGroupID(groupID)\n\treturn o\n}", "func (o *PutZoneParams) WithContext(ctx context.Context) *PutZoneParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *PcloudIkepoliciesPutParams) WithContext(ctx context.Context) *PcloudIkepoliciesPutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func Assign(c *gin.Context) {\n\tservice := CreditService{credit: *credito.New()}\n\tvar json data\n\tif err := c.ShouldBindJSON(&json); err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": \"Bad parameter, expected 'investment' type integer\"})\n\t\treturn\n\t}\n\tinvest := int32(json.Investment)\n\t/* aqui pongo un mensaje solo por practica para saber que esta pasando, no se me va bien solo negar peticiones :) */\n\t_, _, _, err := service.credit.Assign(invest)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\tc.JSON(200, service.credit)\n}", "func (o *GetIPAMCustomerIDParams) WithContext(ctx context.Context) *GetIPAMCustomerIDParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewAssignUserToCustomerGroupUsingPATCH1ParamsWithContext(ctx context.Context) *AssignUserToCustomerGroupUsingPATCH1Params {\n\tvar ()\n\treturn &AssignUserToCustomerGroupUsingPATCH1Params{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *PostMultiNodeDeviceParams) WithCustomer(customer *string) *PostMultiNodeDeviceParams {\n\to.SetCustomer(customer)\n\treturn o\n}", "func NewChangeaspecificCustomerPreferenceRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/customerpreferences/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"PATCH\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "func NewReplacechangeaspecificCustomerPreferenceRequest(server string, id string, body ReplacechangeaspecificCustomerPreferenceJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewReplacechangeaspecificCustomerPreferenceRequestWithBody(server, id, \"application/json\", bodyReader)\n}", "func NewCompanyCreditCreditHistoryManagementV1UpdatePutParamsWithHTTPClient(client *http.Client) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\tvar ()\n\treturn &CompanyCreditCreditHistoryManagementV1UpdatePutParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewQuoteBillingAddressManagementV1AssignPostMineBadRequest() *QuoteBillingAddressManagementV1AssignPostMineBadRequest {\n\treturn &QuoteBillingAddressManagementV1AssignPostMineBadRequest{}\n}", "func (o *QuotePaymentMethodManagementV1SetPutMineParams) SetQuotePaymentMethodManagementV1SetPutBody(quotePaymentMethodManagementV1SetPutBody QuotePaymentMethodManagementV1SetPutMineBody) {\n\to.QuotePaymentMethodManagementV1SetPutBody = quotePaymentMethodManagementV1SetPutBody\n}", "func NewReplacechangeaspecificCustomerPreferenceRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/customerpreferences/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"PUT\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "func NewChangeaspecificCustomerRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/customers/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"PATCH\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "func NewReplacechangeaspecificCustomerContactRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/customercontacts/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"PUT\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "func NewReplacechangeaspecificCustomerContactRequest(server string, id string, body ReplacechangeaspecificCustomerContactJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewReplacechangeaspecificCustomerContactRequestWithBody(server, id, \"application/json\", bodyReader)\n}", "func (m *ScheduleChangeRequest) SetAssignedTo(value *ScheduleChangeRequestActor)() {\n err := m.GetBackingStore().Set(\"assignedTo\", value)\n if err != nil {\n panic(err)\n }\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (_PermInterface *PermInterfaceTransactorSession) AssignAdminRole(_orgId string, _account common.Address, _roleId string) (*types.Transaction, error) {\n\treturn _PermInterface.Contract.AssignAdminRole(&_PermInterface.TransactOpts, _orgId, _account, _roleId)\n}", "func (g *GitHubImpl) SetAssignee(assignee string, issue int) (err error) {\n\n\tURL := fmt.Sprintf(g.URLNoEsc(urls.assigneeURL), g.org, g.repo, issue)\n\n\tjsonBytes, _ := json.Marshal(Assignee{Assignees: []string{assignee}})\n\treq, _ := http.NewRequest(\"POST\", URL, bytes.NewBuffer(jsonBytes))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"token \"+g.token)\n\n\t_, err = NewPWRequest().Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (o *PostMeOvhAccountOvhAccountIDCreditOrderParams) WithContext(ctx context.Context) *PostMeOvhAccountOvhAccountIDCreditOrderParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (pc *Participants) CreateCustomer(ctx *helpers.TransactionContext, id string, forename string, surname string, bankID string, companyName string) error {\n\tbank, err := ctx.GetBank(bankID)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcustomer := new(defs.Customer)\n\tcustomer.ID = id\n\tcustomer.Forename = forename\n\tcustomer.Surname = surname\n\tcustomer.Bank = *bank\n\tcustomer.CompanyName = companyName\n\n\treturn ctx.CreateCustomer(customer)\n}", "func (o *SMSCampaignsCancelBySMSCampaignIDPutParams) WithContext(ctx context.Context) *SMSCampaignsCancelBySMSCampaignIDPutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (rb *ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomersRequestBuilder) Post(body MyBusinessUnitAssociateDraft) *ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomersRequestMethodPost {\n\treturn &ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomersRequestMethodPost{\n\t\tbody: body,\n\t\turl: fmt.Sprintf(\"/%s/in-business-unit/key=%s/me/customers\", rb.projectKey, rb.businessUnitKey),\n\t\tclient: rb.client,\n\t}\n}", "func (_PermInterface *PermInterfaceTransactorSession) AssignAccountRole(_account common.Address, _orgId string, _roleId string) (*types.Transaction, error) {\n\treturn _PermInterface.Contract.AssignAccountRole(&_PermInterface.TransactOpts, _account, _orgId, _roleId)\n}", "func (_PermInterface *PermInterfaceTransactor) AssignAccountRole(opts *bind.TransactOpts, _account common.Address, _orgId string, _roleId string) (*types.Transaction, error) {\n\treturn _PermInterface.contract.Transact(opts, \"assignAccountRole\", _account, _orgId, _roleId)\n}", "func (m *EducationAssignment) SetAssignTo(value EducationAssignmentRecipientable)() {\n m.assignTo = value\n}", "func NewReplacechangeaspecificCustomerBalanceRequest(server string, id string, body ReplacechangeaspecificCustomerBalanceJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewReplacechangeaspecificCustomerBalanceRequestWithBody(server, id, \"application/json\", bodyReader)\n}", "func (o *MachinePool) Set(required *MachinePool) {\n\tif required == nil || o == nil {\n\t\treturn\n\t}\n\n\tif required.FlavorName != \"\" {\n\t\to.FlavorName = required.FlavorName\n\t}\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) WithBaseSiteID(baseSiteID string) *AssignUserToCustomerGroupUsingPATCH1Params {\n\to.SetBaseSiteID(baseSiteID)\n\treturn o\n}", "func (o *PcloudIkepoliciesPutParams) WithBody(body *models.IKEPolicyUpdate) *PcloudIkepoliciesPutParams {\n\to.SetBody(body)\n\treturn o\n}", "func (o *GetIPAMCustomerIDParams) WithHTTPClient(client *http.Client) *GetIPAMCustomerIDParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (m *VirtualEndpointUserSettingsCloudPcUserSettingItemRequestBuilder) Assign()(*VirtualEndpointUserSettingsItemAssignRequestBuilder) {\n return NewVirtualEndpointUserSettingsItemAssignRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func (o *EmployeesByIDContractrulePutParams) WithContext(ctx context.Context) *EmployeesByIDContractrulePutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *SetCartDeliveryModeUsingPUTParams) WithHTTPClient(client *http.Client) *SetCartDeliveryModeUsingPUTParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewCompanyCreditCreditHistoryManagementV1UpdatePutParamsWithTimeout(timeout time.Duration) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\tvar ()\n\treturn &CompanyCreditCreditHistoryManagementV1UpdatePutParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func NewChangeaspecificCustomerContactRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/customercontacts/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"PATCH\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "func (c *Culqi) CreateCustomer(params *CustomerParams) (*Customer, error) {\n\n\tif params == nil {\n\t\treturn nil, fmt.Errorf(\"params are empty\")\n\t}\n\n\treqJSON, err := json.Marshal(params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", defaultBaseURL+\"v2/\"+customerBase, bytes.NewBuffer(reqJSON))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Bearer \"+c.Conf.APIKey)\n\treq.Header.Set(\"User-Agent\", userAgent)\n\n\tresp, err := c.HTTP.Do(req)\n\n\tif resp.StatusCode >= 400 {\n\t\treturn nil, extractError(resp)\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tt := Customer{}\n\n\tif err := json.Unmarshal(body, &t); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &t, nil\n}", "func NewCompanyACLV1AssignRolesPutOK() *CompanyACLV1AssignRolesPutOK {\n\treturn &CompanyACLV1AssignRolesPutOK{}\n}", "func (o *QuoteBillingAddressManagementV1AssignPostMineBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateAddress(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}", "func (o *PutClusterForAutoscaleParams) WithContext(ctx context.Context) *PutClusterForAutoscaleParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *PutZoneParams) WithHTTPClient(client *http.Client) *PutZoneParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (ct *customer) CreateCustomer(c echo.Context) error {\n\tctx, err := middleware.WellsFarGoContext(c)\n\tif err != nil {\n\t\treturn errors.Wrapf(errs.ErrWellsFarGoContext, \"err : '%s'\", err)\n\t}\n\n\tvar newCustomer model.Customer\n\tif err = ctx.Bind(&newCustomer); err != nil {\n\t\treturn errors.Wrapf(errs.ErrBindRequest, \"err : '%s'\", err)\n\t}\n\n\tcustomer, err := ct.cs.CreateNewCustomer(&newCustomer)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"create new customer\")\n\t}\n\n\treturn ctx.JSON(http.StatusOK, customer)\n}", "func (o *SMSCampaignsCancelBySMSCampaignIDPutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CatalogProductTierPriceManagementV1AddPostParams) SetCustomerGroupID(customerGroupID string) {\n\to.CustomerGroupID = customerGroupID\n}", "func NewQuoteBillingAddressManagementV1AssignPostMineDefault(code int) *QuoteBillingAddressManagementV1AssignPostMineDefault {\n\treturn &QuoteBillingAddressManagementV1AssignPostMineDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (b *ControlPlaneMachineSetTemplateObjectMetaApplyConfiguration) WithAnnotations(entries map[string]string) *ControlPlaneMachineSetTemplateObjectMetaApplyConfiguration {\n\tif b.Annotations == nil && len(entries) > 0 {\n\t\tb.Annotations = make(map[string]string, len(entries))\n\t}\n\tfor k, v := range entries {\n\t\tb.Annotations[k] = v\n\t}\n\treturn b\n}", "func (_PermInterface *PermInterfaceSession) AssignAccountRole(_account common.Address, _orgId string, _roleId string) (*types.Transaction, error) {\n\treturn _PermInterface.Contract.AssignAccountRole(&_PermInterface.TransactOpts, _account, _orgId, _roleId)\n}", "func (o *PostMeOvhAccountOvhAccountIDCreditOrderParams) WithHTTPClient(client *http.Client) *PostMeOvhAccountOvhAccountIDCreditOrderParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *SetCartDeliveryModeUsingPUTParams) WithContext(ctx context.Context) *SetCartDeliveryModeUsingPUTParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewQuoteBillingAddressManagementV1AssignPostMineUnauthorized() *QuoteBillingAddressManagementV1AssignPostMineUnauthorized {\n\treturn &QuoteBillingAddressManagementV1AssignPostMineUnauthorized{}\n}", "func (o *CreateCustomerTenantsParams) WithContext(ctx context.Context) *CreateCustomerTenantsParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (_PermInterface *PermInterfaceTransactor) AssignAdminRole(opts *bind.TransactOpts, _orgId string, _account common.Address, _roleId string) (*types.Transaction, error) {\n\treturn _PermInterface.contract.Transact(opts, \"assignAdminRole\", _orgId, _account, _roleId)\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.45621243", "0.45318878", "0.4498856", "0.44750905", "0.44045433", "0.439213", "0.43860754", "0.43834588", "0.43532863", "0.43496534", "0.4343304", "0.4314268", "0.43108833", "0.43065318", "0.43006516", "0.42567405", "0.4250503", "0.42434946", "0.42390394", "0.4238419", "0.42349762", "0.42301917", "0.42218956", "0.421761", "0.42089862", "0.4206105", "0.41703734", "0.41620472", "0.41614866", "0.4141289", "0.41375804", "0.41306186", "0.40906042", "0.40519485", "0.4048655", "0.4040774", "0.40178955", "0.40150586", "0.40132165", "0.4009874", "0.40071037", "0.39939466", "0.39709508", "0.39653242", "0.39630964", "0.3951504", "0.395134", "0.39511615", "0.39427897", "0.39400262", "0.3939477", "0.39388394", "0.3923466", "0.39230633", "0.3920217", "0.39111334", "0.38975278", "0.38955432", "0.3876467", "0.38738602", "0.38726202", "0.38627386", "0.3858657", "0.38566464", "0.38537294", "0.38470438", "0.3839044", "0.38361704", "0.38283738", "0.38106865", "0.38090008", "0.3807367", "0.3800932", "0.3799577", "0.37993714", "0.37940654", "0.3794019", "0.3793423", "0.3791872", "0.37891558" ]
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.SetQuoteGuestCartManagementV1AssignCustomerPutBody(quoteGuestCartManagementV1AssignCustomerPutBody)\n\treturn o\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithContext(ctx context.Context) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithHTTPClient(client *http.Client) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParams() *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithHTTPClient(client *http.Client) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\t\tHTTPClient: client,\n\t}\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithTimeout(timeout time.Duration) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) WithCartID(cartID string) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\to.SetCartID(cartID)\n\treturn o\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) 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\t// path param cartId\n\tif err := r.SetPathParam(\"cartId\", o.CartID); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.QuoteGuestCartManagementV1AssignCustomerPutBody); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func NewQuoteGuestCartManagementV1AssignCustomerPutParamsWithContext(ctx context.Context) *QuoteGuestCartManagementV1AssignCustomerPutParams {\n\tvar ()\n\treturn &QuoteGuestCartManagementV1AssignCustomerPutParams{\n\n\t\tContext: ctx,\n\t}\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "func (o *GetIPAMsubnetsParams) SetCustomer(customer *string) {\n\to.Customer = customer\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) WithContext(ctx context.Context) *AssignUserToCustomerGroupUsingPATCH1Params {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) WithContext(ctx context.Context) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (rrc *ReserveRoomCreate) SetCustomer(c *Customer) *ReserveRoomCreate {\n\treturn rrc.SetCustomerID(c.ID)\n}", "func (o *PostMultiNodeDeviceParams) SetCustomer(customer *string) {\n\to.Customer = customer\n}", "func (m *CarserviceMutation) SetCustomer(s string) {\n\tm.customer = &s\n}", "func (cc *CheckoutCreate) SetCustomer(c *Customer) *CheckoutCreate {\n\treturn cc.SetCustomerID(c.ID)\n}", "func (o *QuoteGuestCartManagementV1AssignCustomerPutParams) SetCartID(cartID string) {\n\to.CartID = cartID\n}", "func (o *Rental) SetCustomerGP(insert bool, related *Customer) {\n\tif err := o.SetCustomer(boil.GetDB(), insert, related); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func (o *Rental) SetCustomerP(exec boil.Executor, insert bool, related *Customer) {\n\tif err := o.SetCustomer(exec, insert, related); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "func NewAssignUserToCustomerGroupUsingPATCH1Params() *AssignUserToCustomerGroupUsingPATCH1Params {\n\tvar ()\n\treturn &AssignUserToCustomerGroupUsingPATCH1Params{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func NewQuoteBillingAddressManagementV1AssignPostMineOK() *QuoteBillingAddressManagementV1AssignPostMineOK {\n\treturn &QuoteBillingAddressManagementV1AssignPostMineOK{}\n}", "func NewAssignPostRequestBody()(*AssignPostRequestBody) {\n m := &AssignPostRequestBody{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) WithCompanyCreditCreditHistoryManagementV1UpdatePutBody(companyCreditCreditHistoryManagementV1UpdatePutBody CompanyCreditCreditHistoryManagementV1UpdatePutBody) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\to.SetCompanyCreditCreditHistoryManagementV1UpdatePutBody(companyCreditCreditHistoryManagementV1UpdatePutBody)\n\treturn o\n}", "func NewAssignUserToCustomerGroupUsingPATCH1ParamsWithHTTPClient(client *http.Client) *AssignUserToCustomerGroupUsingPATCH1Params {\n\tvar ()\n\treturn &AssignUserToCustomerGroupUsingPATCH1Params{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) SetCompanyCreditCreditHistoryManagementV1UpdatePutBody(companyCreditCreditHistoryManagementV1UpdatePutBody CompanyCreditCreditHistoryManagementV1UpdatePutBody) {\n\to.CompanyCreditCreditHistoryManagementV1UpdatePutBody = companyCreditCreditHistoryManagementV1UpdatePutBody\n}", "func (bc *BillCreate) SetCustomer(c *Customer) *BillCreate {\n\treturn bc.SetCustomerID(c.ID)\n}", "func (a *Client) SharedCatalogCompanyManagementV1AssignCompaniesPost(params *SharedCatalogCompanyManagementV1AssignCompaniesPostParams) (*SharedCatalogCompanyManagementV1AssignCompaniesPostOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewSharedCatalogCompanyManagementV1AssignCompaniesPostParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"sharedCatalogCompanyManagementV1AssignCompaniesPost\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/V1/sharedCatalog/{sharedCatalogId}/assignCompanies\",\n\t\tProducesMediaTypes: []string{\"\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &SharedCatalogCompanyManagementV1AssignCompaniesPostReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*SharedCatalogCompanyManagementV1AssignCompaniesPostOK), nil\n\n}", "func (pc *ProblemCreate) SetCustomer(c *Customer) *ProblemCreate {\n\treturn pc.SetCustomerID(c.ID)\n}", "func (oiuo *OrderInfoUpdateOne) SetCustomer(c *Customer) *OrderInfoUpdateOne {\n\treturn oiuo.SetCustomerID(c.ID)\n}", "func (c *Client) Assign(ctx context.Context, id uint64, role NodeRole) error {\n\trequest := protocol.Message{}\n\tresponse := protocol.Message{}\n\n\trequest.Init(4096)\n\tresponse.Init(4096)\n\n\tprotocol.EncodeAssign(&request, id, uint64(role))\n\n\tif err := c.protocol.Call(ctx, &request, &response); err != nil {\n\t\treturn err\n\t}\n\n\tif err := protocol.DecodeEmpty(&response); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (oiu *OrderInfoUpdate) SetCustomer(c *Customer) *OrderInfoUpdate {\n\treturn oiu.SetCustomerID(c.ID)\n}", "func (o *Rental) SetCustomer(exec boil.Executor, insert bool, related *Customer) error {\n\tvar err error\n\tif insert {\n\t\tif err = related.Insert(exec); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to insert into foreign table\")\n\t\t}\n\t}\n\n\tupdateQuery := fmt.Sprintf(\n\t\t\"UPDATE `rental` SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, []string{\"customer_id\"}),\n\t\tstrmangle.WhereClause(\"`\", \"`\", 0, rentalPrimaryKeyColumns),\n\t)\n\tvalues := []interface{}{related.CustomerID, o.RentalID}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, updateQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tif _, err = exec.Exec(updateQuery, values...); err != nil {\n\t\treturn errors.Wrap(err, \"failed to update local table\")\n\t}\n\n\to.CustomerID = related.CustomerID\n\n\tif o.R == nil {\n\t\to.R = &rentalR{\n\t\t\tCustomer: related,\n\t\t}\n\t} else {\n\t\to.R.Customer = related\n\t}\n\n\tif related.R == nil {\n\t\trelated.R = &customerR{\n\t\t\tRentals: RentalSlice{o},\n\t\t}\n\t} else {\n\t\trelated.R.Rentals = append(related.R.Rentals, o)\n\t}\n\n\treturn nil\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) WithHTTPClient(client *http.Client) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) WithHTTPClient(client *http.Client) *AssignUserToCustomerGroupUsingPATCH1Params {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) WithTimeout(timeout time.Duration) *AssignUserToCustomerGroupUsingPATCH1Params {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (o *QuotePaymentMethodManagementV1SetPutMineParams) SetQuotePaymentMethodManagementV1SetPutBody(quotePaymentMethodManagementV1SetPutBody QuotePaymentMethodManagementV1SetPutMineBody) {\n\to.QuotePaymentMethodManagementV1SetPutBody = quotePaymentMethodManagementV1SetPutBody\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) WithGroupID(groupID string) *AssignUserToCustomerGroupUsingPATCH1Params {\n\to.SetGroupID(groupID)\n\treturn o\n}", "func NewReplacechangeaspecificCustomerRequest(server string, id string, body ReplacechangeaspecificCustomerJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewReplacechangeaspecificCustomerRequestWithBody(server, id, \"application/json\", bodyReader)\n}", "func NewReplacechangeaspecificCustomerRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/customers/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"PUT\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) WithBaseSiteID(baseSiteID string) *AssignUserToCustomerGroupUsingPATCH1Params {\n\to.SetBaseSiteID(baseSiteID)\n\treturn o\n}", "func NewQuoteBillingAddressManagementV1AssignPostMineBadRequest() *QuoteBillingAddressManagementV1AssignPostMineBadRequest {\n\treturn &QuoteBillingAddressManagementV1AssignPostMineBadRequest{}\n}", "func (_PermInterface *PermInterfaceTransactorSession) AssignAdminRole(_orgId string, _account common.Address, _roleId string) (*types.Transaction, error) {\n\treturn _PermInterface.Contract.AssignAdminRole(&_PermInterface.TransactOpts, _orgId, _account, _roleId)\n}", "func NewAssignUserToCustomerGroupUsingPATCH1ParamsWithTimeout(timeout time.Duration) *AssignUserToCustomerGroupUsingPATCH1Params {\n\tvar ()\n\treturn &AssignUserToCustomerGroupUsingPATCH1Params{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (r a) Assign(company string, team string, engagement string, params map[string]string) (*http.Response, []byte) {\n return r.client.Put(\"/otask/v1/tasks/companies/\" + company + \"/teams/\" + team + \"/engagements/\" + engagement + \"/tasks\", params)\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) WithTimeout(timeout time.Duration) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (svc SSHKeysService) AssignToCluster(ctx context.Context, prj, dc, cls, id string) (*SSHKey, *http.Response, error) {\n\tret := new(SSHKey)\n\tpath := clusterSSHKeyPath(prj, dc, cls, id)\n\treq, err := svc.client.NewRequest(http.MethodPut, path, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tresp, err := svc.client.Do(ctx, req, ret)\n\treturn ret, resp, err\n}", "func Assign(c *gin.Context) {\n\tservice := CreditService{credit: *credito.New()}\n\tvar json data\n\tif err := c.ShouldBindJSON(&json); err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": \"Bad parameter, expected 'investment' type integer\"})\n\t\treturn\n\t}\n\tinvest := int32(json.Investment)\n\t/* aqui pongo un mensaje solo por practica para saber que esta pasando, no se me va bien solo negar peticiones :) */\n\t_, _, _, err := service.credit.Assign(invest)\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\tc.JSON(200, service.credit)\n}", "func (o *MachinePool) Set(required *MachinePool) {\n\tif required == nil || o == nil {\n\t\treturn\n\t}\n\n\tif required.FlavorName != \"\" {\n\t\to.FlavorName = required.FlavorName\n\t}\n}", "func NewAssignUserToCustomerGroupUsingPATCH1ParamsWithContext(ctx context.Context) *AssignUserToCustomerGroupUsingPATCH1Params {\n\tvar ()\n\treturn &AssignUserToCustomerGroupUsingPATCH1Params{\n\n\t\tContext: ctx,\n\t}\n}", "func (_PermInterface *PermInterfaceTransactorSession) AssignAccountRole(_account common.Address, _orgId string, _roleId string) (*types.Transaction, error) {\n\treturn _PermInterface.Contract.AssignAccountRole(&_PermInterface.TransactOpts, _account, _orgId, _roleId)\n}", "func (o *QuoteBillingAddressManagementV1AssignPostMineBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateAddress(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}", "func (_PermInterface *PermInterfaceTransactor) AssignAccountRole(opts *bind.TransactOpts, _account common.Address, _orgId string, _roleId string) (*types.Transaction, error) {\n\treturn _PermInterface.contract.Transact(opts, \"assignAccountRole\", _account, _orgId, _roleId)\n}", "func NewChangeaspecificCustomerPreferenceRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/customerpreferences/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"PATCH\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "func NewQuoteBillingAddressManagementV1AssignPostMineDefault(code int) *QuoteBillingAddressManagementV1AssignPostMineDefault {\n\treturn &QuoteBillingAddressManagementV1AssignPostMineDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (o *PcloudIkepoliciesPutParams) SetBody(body *models.IKEPolicyUpdate) {\n\to.Body = body\n}", "func (o *PcloudV1CloudinstancesCosimagesPostParams) SetBody(body *models.CreateCosImageImportJob) {\n\to.Body = body\n}", "func NewChangeaspecificCustomerRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/customers/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"PATCH\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "func (o *PostMultiNodeDeviceParams) WithCustomer(customer *string) *PostMultiNodeDeviceParams {\n\to.SetCustomer(customer)\n\treturn o\n}", "func (m *ScheduleChangeRequest) SetAssignedTo(value *ScheduleChangeRequestActor)() {\n err := m.GetBackingStore().Set(\"assignedTo\", value)\n if err != nil {\n panic(err)\n }\n}", "func (o *GetIPAMsubnetsParams) WithCustomer(customer *string) *GetIPAMsubnetsParams {\n\to.SetCustomer(customer)\n\treturn o\n}", "func (o *SetRoleParams) WithBody(body SetRoleBody) *SetRoleParams {\n\to.SetBody(body)\n\treturn o\n}", "func (m *EducationAssignment) SetAssignTo(value EducationAssignmentRecipientable)() {\n m.assignTo = value\n}", "func (_PermInterface *PermInterfaceTransactor) AssignAdminRole(opts *bind.TransactOpts, _orgId string, _account common.Address, _roleId string) (*types.Transaction, error) {\n\treturn _PermInterface.contract.Transact(opts, \"assignAdminRole\", _orgId, _account, _roleId)\n}", "func NewCompanyCreditCreditHistoryManagementV1UpdatePutParamsWithHTTPClient(client *http.Client) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\tvar ()\n\treturn &CompanyCreditCreditHistoryManagementV1UpdatePutParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (o *PcloudIkepoliciesPutParams) WithBody(body *models.IKEPolicyUpdate) *PcloudIkepoliciesPutParams {\n\to.SetBody(body)\n\treturn o\n}", "func NewReplacechangeaspecificCustomerPreferenceRequest(server string, id string, body ReplacechangeaspecificCustomerPreferenceJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewReplacechangeaspecificCustomerPreferenceRequestWithBody(server, id, \"application/json\", bodyReader)\n}", "func (o *PostMeOvhAccountOvhAccountIDCreditOrderParams) SetMeOvhAccountCreditOrderPost(meOvhAccountCreditOrderPost *models.PostMeOvhAccountOvhAccountIDCreditOrderParamsBody) {\n\to.MeOvhAccountCreditOrderPost = meOvhAccountCreditOrderPost\n}", "func (o *CompanyCreditCreditHistoryManagementV1UpdatePutParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func (o *CatalogProductTierPriceManagementV1AddPostParams) SetCustomerGroupID(customerGroupID string) {\n\to.CustomerGroupID = customerGroupID\n}", "func (o *GetIPAMCustomerIDParams) WithContext(ctx context.Context) *GetIPAMCustomerIDParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func NewReplacechangeaspecificCustomerPreferenceRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/customerpreferences/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"PUT\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "func NewQuoteBillingAddressManagementV1AssignPostMineUnauthorized() *QuoteBillingAddressManagementV1AssignPostMineUnauthorized {\n\treturn &QuoteBillingAddressManagementV1AssignPostMineUnauthorized{}\n}", "func (_PermInterface *PermInterfaceSession) AssignAccountRole(_account common.Address, _orgId string, _roleId string) (*types.Transaction, error) {\n\treturn _PermInterface.Contract.AssignAccountRole(&_PermInterface.TransactOpts, _account, _orgId, _roleId)\n}", "func (o *PutZoneParams) WithContext(ctx context.Context) *PutZoneParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (_PermInterface *PermInterfaceSession) AssignAdminRole(_orgId string, _account common.Address, _roleId string) (*types.Transaction, error) {\n\treturn _PermInterface.Contract.AssignAdminRole(&_PermInterface.TransactOpts, _orgId, _account, _roleId)\n}", "func (o *PostMeOvhAccountOvhAccountIDCreditOrderParams) WithContext(ctx context.Context) *PostMeOvhAccountOvhAccountIDCreditOrderParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (g *GitHubImpl) SetAssignee(assignee string, issue int) (err error) {\n\n\tURL := fmt.Sprintf(g.URLNoEsc(urls.assigneeURL), g.org, g.repo, issue)\n\n\tjsonBytes, _ := json.Marshal(Assignee{Assignees: []string{assignee}})\n\treq, _ := http.NewRequest(\"POST\", URL, bytes.NewBuffer(jsonBytes))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"token \"+g.token)\n\n\t_, err = NewPWRequest().Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (o *MarketDataSubscribeMarketDataParams) SetBody(body *models.SubscribeMarketDataRequestDefinition) {\n\to.Body = body\n}", "func NewReplacechangeaspecificCustomerContactRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/customercontacts/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"PUT\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "func NewReplacechangeaspecificCustomerBalanceRequest(server string, id string, body ReplacechangeaspecificCustomerBalanceJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewReplacechangeaspecificCustomerBalanceRequestWithBody(server, id, \"application/json\", bodyReader)\n}", "func NewReplacechangeaspecificCustomerContactRequest(server string, id string, body ReplacechangeaspecificCustomerContactJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewReplacechangeaspecificCustomerContactRequestWithBody(server, id, \"application/json\", bodyReader)\n}", "func (o *PcloudIkepoliciesPutParams) WithContext(ctx context.Context) *PcloudIkepoliciesPutParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (o *PublicInteractiveLoginCredentialParams) WithBody(body *model.CredentialRequest) *PublicInteractiveLoginCredentialParams {\n\to.SetBody(body)\n\treturn o\n}", "func (pu *ProjectUtil) AssignRole(projectName, username string) error {\n\tif len(strings.TrimSpace(projectName)) == 0 ||\n\t\tlen(strings.TrimSpace(username)) == 0 {\n\t\treturn errors.New(\"Project name and username are required for assigning role\")\n\t}\n\n\tpid := pu.GetProjectID(projectName)\n\tif pid == -1 {\n\t\treturn fmt.Errorf(\"Failed to get project ID with name %s\", projectName)\n\t}\n\n\tm := models.Member{\n\t\tRoleID: 2,\n\t\tMemberUser: &models.MemUser{\n\t\t\tUserName: username,\n\t\t},\n\t}\n\n\tbody, err := json.Marshal(&m)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\turl := fmt.Sprintf(\"%s%s%d%s\", pu.rootURI, \"/api/v2.0/projects/\", pid, \"/members\")\n\tif err := pu.testingClient.Post(url, body); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func NewQuoteCartManagementV1PlaceOrderPutMineOK() *QuoteCartManagementV1PlaceOrderPutMineOK {\n\treturn &QuoteCartManagementV1PlaceOrderPutMineOK{}\n}", "func (pc *Participants) CreateCustomer(ctx *helpers.TransactionContext, id string, forename string, surname string, bankID string, companyName string) error {\n\tbank, err := ctx.GetBank(bankID)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcustomer := new(defs.Customer)\n\tcustomer.ID = id\n\tcustomer.Forename = forename\n\tcustomer.Surname = surname\n\tcustomer.Bank = *bank\n\tcustomer.CompanyName = companyName\n\n\treturn ctx.CreateCustomer(customer)\n}", "func NewCompanyACLV1AssignRolesPutOK() *CompanyACLV1AssignRolesPutOK {\n\treturn &CompanyACLV1AssignRolesPutOK{}\n}", "func (o *AssignUserToCustomerGroupUsingPATCH1Params) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "func NewCompanyCreditCreditHistoryManagementV1UpdatePutParamsWithTimeout(timeout time.Duration) *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\tvar ()\n\treturn &CompanyCreditCreditHistoryManagementV1UpdatePutParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (_CrToken *CrTokenTransactor) SetReserveFactor(opts *bind.TransactOpts, newReserveFactorMantissa *big.Int) (*types.Transaction, error) {\n\treturn _CrToken.contract.Transact(opts, \"_setReserveFactor\", newReserveFactorMantissa)\n}", "func (m *VirtualEndpointUserSettingsCloudPcUserSettingItemRequestBuilder) Assign()(*VirtualEndpointUserSettingsItemAssignRequestBuilder) {\n return NewVirtualEndpointUserSettingsItemAssignRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "func (o *PublicInteractiveLoginCredentialParams) SetBody(body *model.CredentialRequest) {\n\to.Body = body\n}", "func (e *PlaceOrderServiceAdapter) PlaceCustomerCart(ctx context.Context, auth auth.Identity, cart *cartDomain.Cart, payment *placeorder.Payment) (placeorder.PlacedOrderInfos, error) {\n\treturn e.placeOrder(ctx, cart, payment)\n}", "func NewChangeaspecificCustomerContactRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := fmt.Sprintf(\"/customercontacts/%s\", pathParam0)\n\tif basePath[0] == '/' {\n\t\tbasePath = basePath[1:]\n\t}\n\n\tqueryUrl, err = queryUrl.Parse(basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"PATCH\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "func NewCompanyCreditCreditHistoryManagementV1UpdatePutParams() *CompanyCreditCreditHistoryManagementV1UpdatePutParams {\n\tvar ()\n\treturn &CompanyCreditCreditHistoryManagementV1UpdatePutParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (o *PostMeOvhAccountOvhAccountIDCreditOrderParams) WithHTTPClient(client *http.Client) *PostMeOvhAccountOvhAccountIDCreditOrderParams {\n\to.SetHTTPClient(client)\n\treturn o\n}" ]
[ "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.44576144", "0.4402824", "0.43899328", "0.43867308", "0.43812346", "0.43794528", "0.4338544", "0.4316253", "0.43080997", "0.42776436", "0.426694", "0.42325655", "0.42046782", "0.41936824", "0.41873696", "0.4136146", "0.41351864", "0.41299477", "0.40920964", "0.4091769", "0.40730774", "0.4052888", "0.40519786", "0.40497494", "0.40436497", "0.40370303", "0.4033196", "0.40320045", "0.40202338", "0.39884847", "0.39807433", "0.39798933", "0.39660874", "0.3950796", "0.39483973", "0.39364704", "0.39178672", "0.39032683", "0.3898624", "0.3892405", "0.3888108", "0.38877925", "0.38851708", "0.3874475", "0.3872958", "0.38677672", "0.38602394", "0.3857708", "0.38490635", "0.38334534", "0.3832875", "0.3831595", "0.38302308", "0.3828861", "0.38282746", "0.3826959", "0.38259158", "0.38247275", "0.38207597", "0.3817494", "0.38043305", "0.38006768", "0.3792863", "0.3779479", "0.37751248", "0.37686917", "0.37556788", "0.37367058", "0.37171975", "0.37144592", "0.37111902", "0.37010163", "0.36994043", "0.36985713", "0.36982635", "0.36981225", "0.3691064", "0.36904055", "0.3679477", "0.36747643" ]
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 {\n\t\t\tqrByteOffset = *o.ByteOffset\n\t\t}\n\t\tqByteOffset := swag.FormatInt64(qrByteOffset)\n\t\tif qByteOffset != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"byte_offset\", qByteOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif o.Info != nil {\n\t\tif err := r.SetBodyParam(o.Info); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Overwrite != nil {\n\n\t\t// query param overwrite\n\t\tvar qrOverwrite bool\n\n\t\tif o.Overwrite != nil {\n\t\t\tqrOverwrite = *o.Overwrite\n\t\t}\n\t\tqOverwrite := swag.FormatBool(qrOverwrite)\n\t\tif qOverwrite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"overwrite\", qOverwrite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param path\n\tif err := r.SetPathParam(\"path\", o.Path); err != nil {\n\t\treturn err\n\t}\n\n\tif o.ReturnRecords != nil {\n\n\t\t// query param return_records\n\t\tvar qrReturnRecords bool\n\n\t\tif o.ReturnRecords != nil {\n\t\t\tqrReturnRecords = *o.ReturnRecords\n\t\t}\n\t\tqReturnRecords := swag.FormatBool(qrReturnRecords)\n\t\tif qReturnRecords != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"return_records\", qReturnRecords); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StreamName != nil {\n\n\t\t// query param stream_name\n\t\tvar qrStreamName string\n\n\t\tif o.StreamName != nil {\n\t\t\tqrStreamName = *o.StreamName\n\t\t}\n\t\tqStreamName := qrStreamName\n\t\tif qStreamName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"stream_name\", qStreamName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param volume.uuid\n\tif err := r.SetPathParam(\"volume.uuid\", o.VolumeUUID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetParams) 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\t// header param Device-Id\n\tif err := r.SetHeaderParam(\"Device-Id\", o.DeviceID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.DeviceOS != nil {\n\n\t\t// header param Device-OS\n\t\tif err := r.SetHeaderParam(\"Device-OS\", *o.DeviceOS); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t// path param fiscalDocumentNumber\n\tif err := r.SetPathParam(\"fiscalDocumentNumber\", swag.FormatUint64(o.FiscalDocumentNumber)); err != nil {\n\t\treturn err\n\t}\n\n\t// path param fiscalDriveNumber\n\tif err := r.SetPathParam(\"fiscalDriveNumber\", swag.FormatUint64(o.FiscalDriveNumber)); err != nil {\n\t\treturn err\n\t}\n\n\t// query param fiscalSign\n\tqrFiscalSign := o.FiscalSign\n\tqFiscalSign := swag.FormatUint64(qrFiscalSign)\n\tif qFiscalSign != \"\" {\n\t\tif err := r.SetQueryParam(\"fiscalSign\", qFiscalSign); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.SendToEmail != nil {\n\n\t\t// query param sendToEmail\n\t\tvar qrSendToEmail string\n\t\tif o.SendToEmail != nil {\n\t\t\tqrSendToEmail = *o.SendToEmail\n\t\t}\n\t\tqSendToEmail := qrSendToEmail\n\t\tif qSendToEmail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sendToEmail\", qSendToEmail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *StartV1Params) 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.Environment != nil {\n\n\t\t// query param environment\n\t\tvar qrEnvironment string\n\t\tif o.Environment != nil {\n\t\t\tqrEnvironment = *o.Environment\n\t\t}\n\t\tqEnvironment := qrEnvironment\n\t\tif qEnvironment != \"\" {\n\t\t\tif err := r.SetQueryParam(\"environment\", qEnvironment); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdateAutoTagParams) 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.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID.String()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetIntrospectionParams) 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\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\tif o.ResponseAsJwt != nil {\n\n\t\t// query param response_as_jwt\n\t\tvar qrResponseAsJwt bool\n\t\tif o.ResponseAsJwt != nil {\n\t\t\tqrResponseAsJwt = *o.ResponseAsJwt\n\t\t}\n\t\tqResponseAsJwt := swag.FormatBool(qrResponseAsJwt)\n\t\tif qResponseAsJwt != \"\" {\n\t\t\tif err := r.SetQueryParam(\"response_as_jwt\", qResponseAsJwt); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param token\n\tqrToken := o.Token\n\tqToken := qrToken\n\tif qToken != \"\" {\n\t\tif err := r.SetQueryParam(\"token\", qToken); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.TokenTypeHint != nil {\n\n\t\t// query param token_type_hint\n\t\tvar qrTokenTypeHint string\n\t\tif o.TokenTypeHint != nil {\n\t\t\tqrTokenTypeHint = *o.TokenTypeHint\n\t\t}\n\t\tqTokenTypeHint := qrTokenTypeHint\n\t\tif qTokenTypeHint != \"\" {\n\t\t\tif err := r.SetQueryParam(\"token_type_hint\", qTokenTypeHint); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PostContextsAddPhpParams) 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\t// query param name\n\tqrName := o.Name\n\tqName := qrName\n\tif qName != \"\" {\n\n\t\tif err := r.SetQueryParam(\"name\", qName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Private != nil {\n\n\t\t// query param private\n\t\tvar qrPrivate int64\n\n\t\tif o.Private != nil {\n\t\t\tqrPrivate = *o.Private\n\t\t}\n\t\tqPrivate := swag.FormatInt64(qrPrivate)\n\t\tif qPrivate != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"private\", qPrivate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetInstancesDocsParams) 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\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\tif o.OperationID != nil {\n\n\t\t// query param operationId\n\t\tvar qrOperationID string\n\t\tif o.OperationID != nil {\n\t\t\tqrOperationID = *o.OperationID\n\t\t}\n\t\tqOperationID := qrOperationID\n\t\tif qOperationID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"operationId\", qOperationID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Version != nil {\n\n\t\t// query param version\n\t\tvar qrVersion string\n\t\tif o.Version != nil {\n\t\t\tqrVersion = *o.Version\n\t\t}\n\t\tqVersion := qrVersion\n\t\tif qVersion != \"\" {\n\t\t\tif err := r.SetQueryParam(\"version\", qVersion); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *CloudTargetCreateParams) 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.CheckOnly != nil {\n\n\t\t// query param check_only\n\t\tvar qrCheckOnly bool\n\n\t\tif o.CheckOnly != nil {\n\t\t\tqrCheckOnly = *o.CheckOnly\n\t\t}\n\t\tqCheckOnly := swag.FormatBool(qrCheckOnly)\n\t\tif qCheckOnly != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"check_only\", qCheckOnly); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.IgnoreWarnings != nil {\n\n\t\t// query param ignore_warnings\n\t\tvar qrIgnoreWarnings bool\n\n\t\tif o.IgnoreWarnings != nil {\n\t\t\tqrIgnoreWarnings = *o.IgnoreWarnings\n\t\t}\n\t\tqIgnoreWarnings := swag.FormatBool(qrIgnoreWarnings)\n\t\tif qIgnoreWarnings != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ignore_warnings\", qIgnoreWarnings); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif o.Info != nil {\n\t\tif err := r.SetBodyParam(o.Info); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.ReturnRecords != nil {\n\n\t\t// query param return_records\n\t\tvar qrReturnRecords bool\n\n\t\tif o.ReturnRecords != nil {\n\t\t\tqrReturnRecords = *o.ReturnRecords\n\t\t}\n\t\tqReturnRecords := swag.FormatBool(qrReturnRecords)\n\t\tif qReturnRecords != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"return_records\", qReturnRecords); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ReturnTimeout != nil {\n\n\t\t// query param return_timeout\n\t\tvar qrReturnTimeout int64\n\n\t\tif o.ReturnTimeout != nil {\n\t\t\tqrReturnTimeout = *o.ReturnTimeout\n\t\t}\n\t\tqReturnTimeout := swag.FormatInt64(qrReturnTimeout)\n\t\tif qReturnTimeout != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"return_timeout\", qReturnTimeout); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SayParams) 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 err := r.SetBodyParam(o.Body); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Sinkid != nil {\n\n\t\t// query param sinkid\n\t\tvar qrSinkid string\n\t\tif o.Sinkid != nil {\n\t\t\tqrSinkid = *o.Sinkid\n\t\t}\n\t\tqSinkid := qrSinkid\n\t\tif qSinkid != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sinkid\", qSinkid); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Voiceid != nil {\n\n\t\t// query param voiceid\n\t\tvar qrVoiceid string\n\t\tif o.Voiceid != nil {\n\t\t\tqrVoiceid = *o.Voiceid\n\t\t}\n\t\tqVoiceid := qrVoiceid\n\t\tif qVoiceid != \"\" {\n\t\t\tif err := r.SetQueryParam(\"voiceid\", qVoiceid); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *HandleGetAboutUsingGETParams) 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\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// query param apiVersion\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\n\tif err := r.SetQueryParam(\"apiVersion\", qAPIVersion); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetFileSystemParametersInternalParams) 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.AccountID != nil {\n\n\t\t// query param accountId\n\t\tvar qrAccountID string\n\t\tif o.AccountID != nil {\n\t\t\tqrAccountID = *o.AccountID\n\t\t}\n\t\tqAccountID := qrAccountID\n\t\tif qAccountID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"accountId\", qAccountID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.AccountName != nil {\n\n\t\t// query param accountName\n\t\tvar qrAccountName string\n\t\tif o.AccountName != nil {\n\t\t\tqrAccountName = *o.AccountName\n\t\t}\n\t\tqAccountName := qrAccountName\n\t\tif qAccountName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"accountName\", qAccountName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.AttachedCluster != nil {\n\n\t\t// query param attachedCluster\n\t\tvar qrAttachedCluster bool\n\t\tif o.AttachedCluster != nil {\n\t\t\tqrAttachedCluster = *o.AttachedCluster\n\t\t}\n\t\tqAttachedCluster := swag.FormatBool(qrAttachedCluster)\n\t\tif qAttachedCluster != \"\" {\n\t\t\tif err := r.SetQueryParam(\"attachedCluster\", qAttachedCluster); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param blueprintName\n\tqrBlueprintName := o.BlueprintName\n\tqBlueprintName := qrBlueprintName\n\tif qBlueprintName != \"\" {\n\t\tif err := r.SetQueryParam(\"blueprintName\", qBlueprintName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param clusterName\n\tqrClusterName := o.ClusterName\n\tqClusterName := qrClusterName\n\tif qClusterName != \"\" {\n\t\tif err := r.SetQueryParam(\"clusterName\", qClusterName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param fileSystemType\n\tqrFileSystemType := o.FileSystemType\n\tqFileSystemType := qrFileSystemType\n\tif qFileSystemType != \"\" {\n\t\tif err := r.SetQueryParam(\"fileSystemType\", qFileSystemType); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Secure != nil {\n\n\t\t// query param secure\n\t\tvar qrSecure bool\n\t\tif o.Secure != nil {\n\t\t\tqrSecure = *o.Secure\n\t\t}\n\t\tqSecure := swag.FormatBool(qrSecure)\n\t\tif qSecure != \"\" {\n\t\t\tif err := r.SetQueryParam(\"secure\", qSecure); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param storageName\n\tqrStorageName := o.StorageName\n\tqStorageName := qrStorageName\n\tif qStorageName != \"\" {\n\t\tif err := r.SetQueryParam(\"storageName\", qStorageName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param workspaceId\n\tif err := r.SetPathParam(\"workspaceId\", swag.FormatInt64(o.WorkspaceID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ServeBuildFieldShortParams) 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\t// path param btLocator\n\tif err := r.SetPathParam(\"btLocator\", o.BtLocator); err != nil {\n\t\treturn err\n\t}\n\n\t// path param buildLocator\n\tif err := r.SetPathParam(\"buildLocator\", o.BuildLocator); err != nil {\n\t\treturn err\n\t}\n\n\t// path param field\n\tif err := r.SetPathParam(\"field\", o.Field); err != nil {\n\t\treturn err\n\t}\n\n\t// path param projectLocator\n\tif err := r.SetPathParam(\"projectLocator\", o.ProjectLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetRequestDetailsParams) 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\t// path param extra\n\tif err := r.SetPathParam(\"extra\", o.Extra); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetWorkItemParams) 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.DollarExpand != nil {\n\n\t\t// query param $expand\n\t\tvar qrNrDollarExpand string\n\t\tif o.DollarExpand != nil {\n\t\t\tqrNrDollarExpand = *o.DollarExpand\n\t\t}\n\t\tqNrDollarExpand := qrNrDollarExpand\n\t\tif qNrDollarExpand != \"\" {\n\t\t\tif err := r.SetQueryParam(\"$expand\", qNrDollarExpand); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.AsOf != nil {\n\n\t\t// query param asOf\n\t\tvar qrAsOf strfmt.DateTime\n\t\tif o.AsOf != nil {\n\t\t\tqrAsOf = *o.AsOf\n\t\t}\n\t\tqAsOf := qrAsOf.String()\n\t\tif qAsOf != \"\" {\n\t\t\tif err := r.SetQueryParam(\"asOf\", qAsOf); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt32(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param project\n\tif err := r.SetPathParam(\"project\", o.Project); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *IntegrationsManualHTTPSCreateParams) 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 err := r.SetBodyParam(o.Data); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ValidateParams) 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\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PostSecdefSearchParams) 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 err := r.SetBodyParam(o.Symbol); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UserShowV1Params) 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\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\t// path param name\n\tif err := r.SetPathParam(\"name\", o.Name); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetLogsParams) 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.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.From != nil {\n\n\t\t// query param from\n\t\tvar qrFrom string\n\t\tif o.From != nil {\n\t\t\tqrFrom = *o.From\n\t\t}\n\t\tqFrom := qrFrom\n\t\tif qFrom != \"\" {\n\t\t\tif err := r.SetQueryParam(\"from\", qFrom); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludeFields != nil {\n\n\t\t// query param include_fields\n\t\tvar qrIncludeFields bool\n\t\tif o.IncludeFields != nil {\n\t\t\tqrIncludeFields = *o.IncludeFields\n\t\t}\n\t\tqIncludeFields := swag.FormatBool(qrIncludeFields)\n\t\tif qIncludeFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"include_fields\", qIncludeFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludeTotals != nil {\n\n\t\t// query param include_totals\n\t\tvar qrIncludeTotals bool\n\t\tif o.IncludeTotals != nil {\n\t\t\tqrIncludeTotals = *o.IncludeTotals\n\t\t}\n\t\tqIncludeTotals := swag.FormatBool(qrIncludeTotals)\n\t\tif qIncludeTotals != \"\" {\n\t\t\tif err := r.SetQueryParam(\"include_totals\", qIncludeTotals); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int64\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt64(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PerPage != nil {\n\n\t\t// query param per_page\n\t\tvar qrPerPage int64\n\t\tif o.PerPage != nil {\n\t\t\tqrPerPage = *o.PerPage\n\t\t}\n\t\tqPerPage := swag.FormatInt64(qrPerPage)\n\t\tif qPerPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"per_page\", qPerPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Q != nil {\n\n\t\t// query param q\n\t\tvar qrQ string\n\t\tif o.Q != nil {\n\t\t\tqrQ = *o.Q\n\t\t}\n\t\tqQ := qrQ\n\t\tif qQ != \"\" {\n\t\t\tif err := r.SetQueryParam(\"q\", qQ); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Sort != nil {\n\n\t\t// query param sort\n\t\tvar qrSort string\n\t\tif o.Sort != nil {\n\t\t\tqrSort = *o.Sort\n\t\t}\n\t\tqSort := qrSort\n\t\tif qSort != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sort\", qSort); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Take != nil {\n\n\t\t// query param take\n\t\tvar qrTake int64\n\t\tif o.Take != nil {\n\t\t\tqrTake = *o.Take\n\t\t}\n\t\tqTake := swag.FormatInt64(qrTake)\n\t\tif qTake != \"\" {\n\t\t\tif err := r.SetQueryParam(\"take\", qTake); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PostGetOneParams) 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\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\tvaluesRelated := o.Related\n\n\tjoinedRelated := swag.JoinByFormat(valuesRelated, \"\")\n\t// query array param related\n\tif err := r.SetQueryParam(\"related\", joinedRelated...); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *BarParams) 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 err := r.SetBodyParam(o.Body); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ConfigGetParams) 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.Option != nil {\n\n\t\t// binding items for option\n\t\tjoinedOption := o.bindParamOption(reg)\n\n\t\t// query array param option\n\t\tif err := r.SetQueryParam(\"option\", joinedOption...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.ProjectID != nil {\n\n\t\t// query param project_id\n\t\tvar qrProjectID int64\n\n\t\tif o.ProjectID != nil {\n\t\t\tqrProjectID = *o.ProjectID\n\t\t}\n\t\tqProjectID := swag.FormatInt64(qrProjectID)\n\t\tif qProjectID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"project_id\", qProjectID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.UserID != nil {\n\n\t\t// query param user_id\n\t\tvar qrUserID int64\n\n\t\tif o.UserID != nil {\n\t\t\tqrUserID = *o.UserID\n\t\t}\n\t\tqUserID := swag.FormatInt64(qrUserID)\n\t\tif qUserID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"user_id\", qUserID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetSsoParams) 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\t// query param code\n\tqrCode := o.Code\n\tqCode := qrCode\n\tif qCode != \"\" {\n\t\tif err := r.SetQueryParam(\"code\", qCode); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// query param resource_id\n\tqrResourceID := o.ResourceID\n\tqResourceID := qrResourceID\n\tif qResourceID != \"\" {\n\t\tif err := r.SetQueryParam(\"resource_id\", qResourceID); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *AllLookmlTestsParams) 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.FileID != nil {\n\n\t\t// query param file_id\n\t\tvar qrFileID string\n\t\tif o.FileID != nil {\n\t\t\tqrFileID = *o.FileID\n\t\t}\n\t\tqFileID := qrFileID\n\t\tif qFileID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"file_id\", qFileID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param project_id\n\tif err := r.SetPathParam(\"project_id\", o.ProjectID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *APIServiceHaltsParams) 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.Height != nil {\n\n\t\t// query param height\n\t\tvar qrHeight string\n\t\tif o.Height != nil {\n\t\t\tqrHeight = *o.Height\n\t\t}\n\t\tqHeight := qrHeight\n\t\tif qHeight != \"\" {\n\t\t\tif err := r.SetQueryParam(\"height\", qHeight); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetUsersParams) 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.Connection != nil {\n\n\t\t// query param connection\n\t\tvar qrConnection string\n\t\tif o.Connection != nil {\n\t\t\tqrConnection = *o.Connection\n\t\t}\n\t\tqConnection := qrConnection\n\t\tif qConnection != \"\" {\n\t\t\tif err := r.SetQueryParam(\"connection\", qConnection); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludeFields != nil {\n\n\t\t// query param include_fields\n\t\tvar qrIncludeFields bool\n\t\tif o.IncludeFields != nil {\n\t\t\tqrIncludeFields = *o.IncludeFields\n\t\t}\n\t\tqIncludeFields := swag.FormatBool(qrIncludeFields)\n\t\tif qIncludeFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"include_fields\", qIncludeFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IncludeTotals != nil {\n\n\t\t// query param include_totals\n\t\tvar qrIncludeTotals bool\n\t\tif o.IncludeTotals != nil {\n\t\t\tqrIncludeTotals = *o.IncludeTotals\n\t\t}\n\t\tqIncludeTotals := swag.FormatBool(qrIncludeTotals)\n\t\tif qIncludeTotals != \"\" {\n\t\t\tif err := r.SetQueryParam(\"include_totals\", qIncludeTotals); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int64\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt64(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PerPage != nil {\n\n\t\t// query param per_page\n\t\tvar qrPerPage int64\n\t\tif o.PerPage != nil {\n\t\t\tqrPerPage = *o.PerPage\n\t\t}\n\t\tqPerPage := swag.FormatInt64(qrPerPage)\n\t\tif qPerPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"per_page\", qPerPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Q != nil {\n\n\t\t// query param q\n\t\tvar qrQ string\n\t\tif o.Q != nil {\n\t\t\tqrQ = *o.Q\n\t\t}\n\t\tqQ := qrQ\n\t\tif qQ != \"\" {\n\t\t\tif err := r.SetQueryParam(\"q\", qQ); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.SearchEngine != nil {\n\n\t\t// query param search_engine\n\t\tvar qrSearchEngine string\n\t\tif o.SearchEngine != nil {\n\t\t\tqrSearchEngine = *o.SearchEngine\n\t\t}\n\t\tqSearchEngine := qrSearchEngine\n\t\tif qSearchEngine != \"\" {\n\t\t\tif err := r.SetQueryParam(\"search_engine\", qSearchEngine); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Sort != nil {\n\n\t\t// query param sort\n\t\tvar qrSort string\n\t\tif o.Sort != nil {\n\t\t\tqrSort = *o.Sort\n\t\t}\n\t\tqSort := qrSort\n\t\tif qSort != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sort\", qSort); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetBlockGeneratorResultParams) 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\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *CreateRuntimeMapParams) 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.FileUpload != nil {\n\n\t\tif o.FileUpload != nil {\n\n\t\t\t// form file param file_upload\n\t\t\tif err := r.SetFileParam(\"file_upload\", o.FileUpload); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetPlatformsParams) 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.Extended != nil {\n\n\t\t// query param extended\n\t\tvar qrExtended bool\n\t\tif o.Extended != nil {\n\t\t\tqrExtended = *o.Extended\n\t\t}\n\t\tqExtended := swag.FormatBool(qrExtended)\n\t\tif qExtended != \"\" {\n\t\t\tif err := r.SetQueryParam(\"extended\", qExtended); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetUserUsageParams) 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.Cloud != nil {\n\n\t\t// query param cloud\n\t\tvar qrCloud string\n\t\tif o.Cloud != nil {\n\t\t\tqrCloud = *o.Cloud\n\t\t}\n\t\tqCloud := qrCloud\n\t\tif qCloud != \"\" {\n\t\t\tif err := r.SetQueryParam(\"cloud\", qCloud); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Filterenddate != nil {\n\n\t\t// query param filterenddate\n\t\tvar qrFilterenddate int64\n\t\tif o.Filterenddate != nil {\n\t\t\tqrFilterenddate = *o.Filterenddate\n\t\t}\n\t\tqFilterenddate := swag.FormatInt64(qrFilterenddate)\n\t\tif qFilterenddate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filterenddate\", qFilterenddate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Since != nil {\n\n\t\t// query param since\n\t\tvar qrSince int64\n\t\tif o.Since != nil {\n\t\t\tqrSince = *o.Since\n\t\t}\n\t\tqSince := swag.FormatInt64(qrSince)\n\t\tif qSince != \"\" {\n\t\t\tif err := r.SetQueryParam(\"since\", qSince); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Zone != nil {\n\n\t\t// query param zone\n\t\tvar qrZone string\n\t\tif o.Zone != nil {\n\t\t\tqrZone = *o.Zone\n\t\t}\n\t\tqZone := qrZone\n\t\tif qZone != \"\" {\n\t\t\tif err := r.SetQueryParam(\"zone\", qZone); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetOrderParams) 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\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.MerchantID != nil {\n\n\t\t// query param merchantId\n\t\tvar qrMerchantID int64\n\t\tif o.MerchantID != nil {\n\t\t\tqrMerchantID = *o.MerchantID\n\t\t}\n\t\tqMerchantID := swag.FormatInt64(qrMerchantID)\n\t\tif qMerchantID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"merchantId\", qMerchantID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetPropertyDescriptorParams) 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\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\t// query param propertyName\n\tqrPropertyName := o.PropertyName\n\tqPropertyName := qrPropertyName\n\tif qPropertyName != \"\" {\n\n\t\tif err := r.SetQueryParam(\"propertyName\", qPropertyName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetCurrentGenerationParams) 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 len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *CreateGitWebhookUsingPOSTParams) 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\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// query param apiVersion\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\n\tif err := r.SetQueryParam(\"apiVersion\", qAPIVersion); err != nil {\n\t\treturn err\n\t}\n\tif err := r.SetBodyParam(o.GitWebhookSpec); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ViewsGetByIDParams) 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\t// path param identifier\n\tif err := r.SetPathParam(\"identifier\", o.Identifier); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdateDeviceParams) 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\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param deviceId\n\tif err := r.SetPathParam(\"deviceId\", o.DeviceID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.UpdateDeviceRequest != nil {\n\t\tif err := r.SetBodyParam(o.UpdateDeviceRequest); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SaveTemplateParams) 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\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param project\n\tif err := r.SetPathParam(\"project\", o.Project); err != nil {\n\t\treturn err\n\t}\n\n\t// path param templateId\n\tif err := r.SetPathParam(\"templateId\", o.TemplateID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ConvertParams) 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\t// path param from.currency_code\n\tif err := r.SetPathParam(\"from.currency_code\", o.FromCurrencyCode); err != nil {\n\t\treturn err\n\t}\n\n\tif o.FromNanos != nil {\n\n\t\t// query param from.nanos\n\t\tvar qrFromNanos int32\n\t\tif o.FromNanos != nil {\n\t\t\tqrFromNanos = *o.FromNanos\n\t\t}\n\t\tqFromNanos := swag.FormatInt32(qrFromNanos)\n\t\tif qFromNanos != \"\" {\n\t\t\tif err := r.SetQueryParam(\"from.nanos\", qFromNanos); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.FromUnits != nil {\n\n\t\t// query param from.units\n\t\tvar qrFromUnits string\n\t\tif o.FromUnits != nil {\n\t\t\tqrFromUnits = *o.FromUnits\n\t\t}\n\t\tqFromUnits := qrFromUnits\n\t\tif qFromUnits != \"\" {\n\t\t\tif err := r.SetQueryParam(\"from.units\", qFromUnits); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param to_code\n\tif err := r.SetPathParam(\"to_code\", o.ToCode); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SystemEventsParams) 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.Filters != nil {\n\n\t\t// query param filters\n\t\tvar qrFilters string\n\t\tif o.Filters != nil {\n\t\t\tqrFilters = *o.Filters\n\t\t}\n\t\tqFilters := qrFilters\n\t\tif qFilters != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filters\", qFilters); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Since != nil {\n\n\t\t// query param since\n\t\tvar qrSince string\n\t\tif o.Since != nil {\n\t\t\tqrSince = *o.Since\n\t\t}\n\t\tqSince := qrSince\n\t\tif qSince != \"\" {\n\t\t\tif err := r.SetQueryParam(\"since\", qSince); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Until != nil {\n\n\t\t// query param until\n\t\tvar qrUntil string\n\t\tif o.Until != nil {\n\t\t\tqrUntil = *o.Until\n\t\t}\n\t\tqUntil := qrUntil\n\t\tif qUntil != \"\" {\n\t\t\tif err := r.SetQueryParam(\"until\", qUntil); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetBundleByKeyParams) 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.Audit != nil {\n\n\t\t// query param audit\n\t\tvar qrAudit string\n\n\t\tif o.Audit != nil {\n\t\t\tqrAudit = *o.Audit\n\t\t}\n\t\tqAudit := qrAudit\n\t\tif qAudit != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"audit\", qAudit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// query param externalKey\n\tqrExternalKey := o.ExternalKey\n\tqExternalKey := qrExternalKey\n\tif qExternalKey != \"\" {\n\n\t\tif err := r.SetQueryParam(\"externalKey\", qExternalKey); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.IncludedDeleted != nil {\n\n\t\t// query param includedDeleted\n\t\tvar qrIncludedDeleted bool\n\n\t\tif o.IncludedDeleted != nil {\n\t\t\tqrIncludedDeleted = *o.IncludedDeleted\n\t\t}\n\t\tqIncludedDeleted := swag.FormatBool(qrIncludedDeleted)\n\t\tif qIncludedDeleted != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"includedDeleted\", qIncludedDeleted); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// header param WithProfilingInfo\n\tif o.WithProfilingInfo != nil && len(*o.WithProfilingInfo) > 0 {\n\t\tif err := r.SetHeaderParam(\"X-Killbill-Profiling-Req\", *o.WithProfilingInfo); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// header param withStackTrace\n\tif o.WithStackTrace != nil && *o.WithStackTrace {\n\t\tif err := r.SetQueryParam(\"withStackTrace\", \"true\"); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SwarmUpdateParams) 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.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.RotateManagerToken != nil {\n\n\t\t// query param rotateManagerToken\n\t\tvar qrRotateManagerToken bool\n\t\tif o.RotateManagerToken != nil {\n\t\t\tqrRotateManagerToken = *o.RotateManagerToken\n\t\t}\n\t\tqRotateManagerToken := swag.FormatBool(qrRotateManagerToken)\n\t\tif qRotateManagerToken != \"\" {\n\t\t\tif err := r.SetQueryParam(\"rotateManagerToken\", qRotateManagerToken); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.RotateManagerUnlockKey != nil {\n\n\t\t// query param rotateManagerUnlockKey\n\t\tvar qrRotateManagerUnlockKey bool\n\t\tif o.RotateManagerUnlockKey != nil {\n\t\t\tqrRotateManagerUnlockKey = *o.RotateManagerUnlockKey\n\t\t}\n\t\tqRotateManagerUnlockKey := swag.FormatBool(qrRotateManagerUnlockKey)\n\t\tif qRotateManagerUnlockKey != \"\" {\n\t\t\tif err := r.SetQueryParam(\"rotateManagerUnlockKey\", qRotateManagerUnlockKey); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.RotateWorkerToken != nil {\n\n\t\t// query param rotateWorkerToken\n\t\tvar qrRotateWorkerToken bool\n\t\tif o.RotateWorkerToken != nil {\n\t\t\tqrRotateWorkerToken = *o.RotateWorkerToken\n\t\t}\n\t\tqRotateWorkerToken := swag.FormatBool(qrRotateWorkerToken)\n\t\tif qRotateWorkerToken != \"\" {\n\t\t\tif err := r.SetQueryParam(\"rotateWorkerToken\", qRotateWorkerToken); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param version\n\tqrVersion := o.Version\n\tqVersion := swag.FormatInt64(qrVersion)\n\tif qVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"version\", qVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ServiceInstanceGetParams) 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.XBrokerAPIOriginatingIdentity != nil {\n\n\t\t// header param X-Broker-API-Originating-Identity\n\t\tif err := r.SetHeaderParam(\"X-Broker-API-Originating-Identity\", *o.XBrokerAPIOriginatingIdentity); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// header param X-Broker-API-Version\n\tif err := r.SetHeaderParam(\"X-Broker-API-Version\", o.XBrokerAPIVersion); err != nil {\n\t\treturn err\n\t}\n\n\t// path param instance_id\n\tif err := r.SetPathParam(\"instance_id\", o.InstanceID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ShowPackageParams) 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\t// path param media_type\n\tif err := r.SetPathParam(\"media_type\", o.MediaType); err != nil {\n\t\treturn err\n\t}\n\n\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\t// path param package\n\tif err := r.SetPathParam(\"package\", o.Package); err != nil {\n\t\treturn err\n\t}\n\n\t// path param release\n\tif err := r.SetPathParam(\"release\", o.Release); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SizeParams) 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 err := r.SetBodyParam(o.Parameters); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetOutagesParams) 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\t// query param count\n\tqrCount := o.Count\n\tqCount := swag.FormatFloat64(qrCount)\n\tif qCount != \"\" {\n\n\t\tif err := r.SetQueryParam(\"count\", qCount); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.DeviceID != nil {\n\n\t\t// query param deviceId\n\t\tvar qrDeviceID string\n\n\t\tif o.DeviceID != nil {\n\t\t\tqrDeviceID = *o.DeviceID\n\t\t}\n\t\tqDeviceID := qrDeviceID\n\t\tif qDeviceID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"deviceId\", qDeviceID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.InProgress != nil {\n\n\t\t// query param inProgress\n\t\tvar qrInProgress bool\n\n\t\tif o.InProgress != nil {\n\t\t\tqrInProgress = *o.InProgress\n\t\t}\n\t\tqInProgress := swag.FormatBool(qrInProgress)\n\t\tif qInProgress != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"inProgress\", qInProgress); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// query param page\n\tqrPage := o.Page\n\tqPage := swag.FormatFloat64(qrPage)\n\tif qPage != \"\" {\n\n\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Period != nil {\n\n\t\t// query param period\n\t\tvar qrPeriod float64\n\n\t\tif o.Period != nil {\n\t\t\tqrPeriod = *o.Period\n\t\t}\n\t\tqPeriod := swag.FormatFloat64(qrPeriod)\n\t\tif qPeriod != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"period\", qPeriod); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Query != nil {\n\n\t\t// query param query\n\t\tvar qrQuery string\n\n\t\tif o.Query != nil {\n\t\t\tqrQuery = *o.Query\n\t\t}\n\t\tqQuery := qrQuery\n\t\tif qQuery != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"query\", qQuery); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Type != nil {\n\n\t\t// query param type\n\t\tvar qrType string\n\n\t\tif o.Type != nil {\n\t\t\tqrType = *o.Type\n\t\t}\n\t\tqType := qrType\n\t\tif qType != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"type\", qType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *TerminateParams) 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\t// path param extractorId\n\tif err := r.SetPathParam(\"extractorId\", o.ExtractorID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param inputId\n\tif err := r.SetPathParam(\"inputId\", o.InputID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ServeFieldParams) 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\t// path param field\n\tif err := r.SetPathParam(\"field\", o.Field); err != nil {\n\t\treturn err\n\t}\n\n\t// path param vcsRootLocator\n\tif err := r.SetPathParam(\"vcsRootLocator\", o.VcsRootLocator); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PostV1DevicesParams) 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\t// form param device_identifier\n\tfrDeviceIdentifier := o.DeviceIdentifier\n\tfDeviceIdentifier := frDeviceIdentifier\n\tif fDeviceIdentifier != \"\" {\n\t\tif err := r.SetFormParam(\"device_identifier\", fDeviceIdentifier); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// form param kind\n\tfrKind := o.Kind\n\tfKind := frKind\n\tif fKind != \"\" {\n\t\tif err := r.SetFormParam(\"kind\", fKind); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// form param name\n\tfrName := o.Name\n\tfName := frName\n\tif fName != \"\" {\n\t\tif err := r.SetFormParam(\"name\", fName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.NotificationIdentifier != nil {\n\n\t\t// form param notification_identifier\n\t\tvar frNotificationIdentifier string\n\t\tif o.NotificationIdentifier != nil {\n\t\t\tfrNotificationIdentifier = *o.NotificationIdentifier\n\t\t}\n\t\tfNotificationIdentifier := frNotificationIdentifier\n\t\tif fNotificationIdentifier != \"\" {\n\t\t\tif err := r.SetFormParam(\"notification_identifier\", fNotificationIdentifier); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.SubscribeNotification != nil {\n\n\t\t// form param subscribe_notification\n\t\tvar frSubscribeNotification bool\n\t\tif o.SubscribeNotification != nil {\n\t\t\tfrSubscribeNotification = *o.SubscribeNotification\n\t\t}\n\t\tfSubscribeNotification := swag.FormatBool(frSubscribeNotification)\n\t\tif fSubscribeNotification != \"\" {\n\t\t\tif err := r.SetFormParam(\"subscribe_notification\", fSubscribeNotification); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *QueryFirewallFieldsParams) 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.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset string\n\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := qrOffset\n\t\tif qOffset != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.PlatformID != nil {\n\n\t\t// query param platform_id\n\t\tvar qrPlatformID string\n\n\t\tif o.PlatformID != nil {\n\t\t\tqrPlatformID = *o.PlatformID\n\t\t}\n\t\tqPlatformID := qrPlatformID\n\t\tif qPlatformID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"platform_id\", qPlatformID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetCatalogXMLParams) 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.AccountID != nil {\n\n\t\t// query param accountId\n\t\tvar qrAccountID strfmt.UUID\n\n\t\tif o.AccountID != nil {\n\t\t\tqrAccountID = *o.AccountID\n\t\t}\n\t\tqAccountID := qrAccountID.String()\n\t\tif qAccountID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"accountId\", qAccountID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.RequestedDate != nil {\n\n\t\t// query param requestedDate\n\t\tvar qrRequestedDate strfmt.DateTime\n\n\t\tif o.RequestedDate != nil {\n\t\t\tqrRequestedDate = *o.RequestedDate\n\t\t}\n\t\tqRequestedDate := qrRequestedDate.String()\n\t\tif qRequestedDate != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"requestedDate\", qRequestedDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// header param WithProfilingInfo\n\tif o.WithProfilingInfo != nil && len(*o.WithProfilingInfo) > 0 {\n\t\tif err := r.SetHeaderParam(\"X-Killbill-Profiling-Req\", *o.WithProfilingInfo); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// header param withStackTrace\n\tif o.WithStackTrace != nil && *o.WithStackTrace {\n\t\tif err := r.SetQueryParam(\"withStackTrace\", \"true\"); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetClockParams) 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\t// header param X-Killbill-ApiKey\n\tif err := r.SetHeaderParam(\"X-Killbill-ApiKey\", o.XKillbillAPIKey); err != nil {\n\t\treturn err\n\t}\n\n\t// header param X-Killbill-ApiSecret\n\tif err := r.SetHeaderParam(\"X-Killbill-ApiSecret\", o.XKillbillAPISecret); err != nil {\n\t\treturn err\n\t}\n\n\t// header param WithProfilingInfo\n\tif o.WithProfilingInfo != nil && len(*o.WithProfilingInfo) > 0 {\n\t\tif err := r.SetHeaderParam(\"X-Killbill-Profiling-Req\", *o.WithProfilingInfo); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// header param withStackTrace\n\tif o.WithStackTrace != nil && *o.WithStackTrace {\n\t\tif err := r.SetQueryParam(\"withStackTrace\", \"true\"); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *AdminCreateJusticeUserParams) 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\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\t// path param targetNamespace\n\tif err := r.SetPathParam(\"targetNamespace\", o.TargetNamespace); err != nil {\n\t\treturn err\n\t}\n\n\t// path param userId\n\tif err := r.SetPathParam(\"userId\", o.UserID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdateWidgetParams) 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.Accept != nil {\n\n\t\t// header param Accept\n\t\tif err := r.SetHeaderParam(\"Accept\", *o.Accept); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.ContentType != nil {\n\n\t\t// header param Content-Type\n\t\tif err := r.SetHeaderParam(\"Content-Type\", *o.ContentType); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t// path param uuid\n\tif err := r.SetPathParam(\"uuid\", o.UUID.String()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.WidgetBody); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *TestEndpointParams) 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 len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetLogsParams) 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.XRequestID != nil {\n\n\t\t// header param X-Request-Id\n\t\tif err := r.SetHeaderParam(\"X-Request-Id\", *o.XRequestID); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int64\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt64(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PageSize != nil {\n\n\t\t// query param page_size\n\t\tvar qrPageSize int64\n\t\tif o.PageSize != nil {\n\t\t\tqrPageSize = *o.PageSize\n\t\t}\n\t\tqPageSize := swag.FormatInt64(qrPageSize)\n\t\tif qPageSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page_size\", qPageSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param project_name\n\tif err := r.SetPathParam(\"project_name\", o.ProjectName); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Q != nil {\n\n\t\t// query param q\n\t\tvar qrQ string\n\t\tif o.Q != nil {\n\t\t\tqrQ = *o.Q\n\t\t}\n\t\tqQ := qrQ\n\t\tif qQ != \"\" {\n\t\t\tif err := r.SetQueryParam(\"q\", qQ); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ListSourceFileOfProjectVersionParams) 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.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param parentId\n\tif err := r.SetPathParam(\"parentId\", swag.FormatInt64(o.ParentID)); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Q != nil {\n\n\t\t// query param q\n\t\tvar qrQ string\n\t\tif o.Q != nil {\n\t\t\tqrQ = *o.Q\n\t\t}\n\t\tqQ := qrQ\n\t\tif qQ != \"\" {\n\t\t\tif err := r.SetQueryParam(\"q\", qQ); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetDrgParams) 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\t// path param drgId\n\tif err := r.SetPathParam(\"drgId\", o.DrgID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdateFlowParams) 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\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param bucketId\n\tif err := r.SetPathParam(\"bucketId\", o.BucketID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param flowId\n\tif err := r.SetPathParam(\"flowId\", o.FlowID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *CreateWidgetParams) 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.Accept != nil {\n\n\t\t// header param Accept\n\t\tif err := r.SetHeaderParam(\"Accept\", *o.Accept); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.ContentType != nil {\n\n\t\t// header param Content-Type\n\t\tif err := r.SetHeaderParam(\"Content-Type\", *o.ContentType); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif err := r.SetBodyParam(o.WidgetBody); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetBodyResourceByDatePeriodParams) 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\t// path param date\n\tif err := r.SetPathParam(\"date\", o.Date.String()); err != nil {\n\t\treturn err\n\t}\n\n\t// path param period\n\tif err := r.SetPathParam(\"period\", o.Period); err != nil {\n\t\treturn err\n\t}\n\n\t// path param resource-path\n\tif err := r.SetPathParam(\"resource-path\", o.ResourcePath); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetAboutUserParams) 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\tvaluesSelect := o.Select\n\n\tjoinedSelect := swag.JoinByFormat(valuesSelect, \"csv\")\n\t// query array param select\n\tif err := r.SetQueryParam(\"select\", joinedSelect...); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ExtractionListV1Params) 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\t// query param id\n\tqrID := o.ID\n\tqID := qrID\n\tif qID != \"\" {\n\n\t\tif err := r.SetQueryParam(\"id\", qID); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset string\n\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := qrOffset\n\t\tif qOffset != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetAuditEventsParams) 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.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int32\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt32(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param resourceCrn\n\tqrResourceCrn := o.ResourceCrn\n\tqResourceCrn := qrResourceCrn\n\tif qResourceCrn != \"\" {\n\t\tif err := r.SetQueryParam(\"resourceCrn\", qResourceCrn); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Size != nil {\n\n\t\t// query param size\n\t\tvar qrSize int32\n\t\tif o.Size != nil {\n\t\t\tqrSize = *o.Size\n\t\t}\n\t\tqSize := swag.FormatInt32(qrSize)\n\t\tif qSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"size\", qSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PcloudSystempoolsGetParams) 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\t// path param cloud_instance_id\n\tif err := r.SetPathParam(\"cloud_instance_id\", o.CloudInstanceID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *WaitListParams) 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\t// path param address\n\tif err := r.SetPathParam(\"address\", o.Address); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Height != nil {\n\n\t\t// query param height\n\t\tvar qrHeight uint64\n\n\t\tif o.Height != nil {\n\t\t\tqrHeight = *o.Height\n\t\t}\n\t\tqHeight := swag.FormatUint64(qrHeight)\n\t\tif qHeight != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"height\", qHeight); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.PublicKey != nil {\n\n\t\t// query param public_key\n\t\tvar qrPublicKey string\n\n\t\tif o.PublicKey != nil {\n\t\t\tqrPublicKey = *o.PublicKey\n\t\t}\n\t\tqPublicKey := qrPublicKey\n\t\tif qPublicKey != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"public_key\", qPublicKey); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *BudgetAddParams) 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\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetGCParams) 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\t// path param gc_id\n\tif err := r.SetPathParam(\"gc_id\", swag.FormatInt64(o.GcID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PartialUpdateAppParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\t// path param app_id\n\tif err := r.SetPathParam(\"app_id\", swag.FormatInt64(o.AppID)); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\treturn err\n\t}\n\n\t// path param team_id\n\tif err := r.SetPathParam(\"team_id\", swag.FormatInt64(o.TeamID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *StartPacketCaptureParams) 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\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *TaskSchemasIDGetParams) 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\t// path param identifier\n\tif err := r.SetPathParam(\"identifier\", o.Identifier); err != nil {\n\t\treturn err\n\t}\n\n\tif o.ResolveRef != nil {\n\n\t\t// query param resolveRef\n\t\tvar qrResolveRef bool\n\t\tif o.ResolveRef != nil {\n\t\t\tqrResolveRef = *o.ResolveRef\n\t\t}\n\t\tqResolveRef := swag.FormatBool(qrResolveRef)\n\t\tif qResolveRef != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resolveRef\", qResolveRef); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UploadTaskFileParams) 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.Description != nil {\n\n\t\t// form param description\n\t\tvar frDescription string\n\t\tif o.Description != nil {\n\t\t\tfrDescription = *o.Description\n\t\t}\n\t\tfDescription := frDescription\n\t\tif fDescription != \"\" {\n\t\t\tif err := r.SetFormParam(\"description\", fDescription); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.File != nil {\n\n\t\tif o.File != nil {\n\t\t\t// form file param file\n\t\t\tif err := r.SetFileParam(\"file\", o.File); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PetCreateParams) 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\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *QueryChangesParams) 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.Filter != nil {\n\n\t\t// query param filter\n\t\tvar qrFilter string\n\n\t\tif o.Filter != nil {\n\t\t\tqrFilter = *o.Filter\n\t\t}\n\t\tqFilter := qrFilter\n\t\tif qFilter != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"filter\", qFilter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Sort != nil {\n\n\t\t// query param sort\n\t\tvar qrSort string\n\n\t\tif o.Sort != nil {\n\t\t\tqrSort = *o.Sort\n\t\t}\n\t\tqSort := qrSort\n\t\tif qSort != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"sort\", qSort); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetInstrumentsInstrumentOrderBookParams) 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.AcceptDatetimeFormat != nil {\n\n\t\t// header param Accept-Datetime-Format\n\t\tif err := r.SetHeaderParam(\"Accept-Datetime-Format\", *o.AcceptDatetimeFormat); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param instrument\n\tif err := r.SetPathParam(\"instrument\", o.Instrument); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Time != nil {\n\n\t\t// query param time\n\t\tvar qrTime string\n\t\tif o.Time != nil {\n\t\t\tqrTime = *o.Time\n\t\t}\n\t\tqTime := qrTime\n\t\tif qTime != \"\" {\n\t\t\tif err := r.SetQueryParam(\"time\", qTime); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetScopeConfigurationParams) 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\t// path param scope_id\n\tif err := r.SetPathParam(\"scope_id\", o.ScopeID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param site_id\n\tif err := r.SetPathParam(\"site_id\", o.SiteID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param stack_id\n\tif err := r.SetPathParam(\"stack_id\", o.StackID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdateEventParams) 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.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param eventId\n\tif err := r.SetPathParam(\"eventId\", o.EventID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param koronaAccountId\n\tif err := r.SetPathParam(\"koronaAccountId\", o.KoronaAccountID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetV1FunctionalitiesParams) 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.Impacted != nil {\n\n\t\t// query param impacted\n\t\tvar qrImpacted string\n\n\t\tif o.Impacted != nil {\n\t\t\tqrImpacted = *o.Impacted\n\t\t}\n\t\tqImpacted := qrImpacted\n\t\tif qImpacted != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"impacted\", qImpacted); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Labels != nil {\n\n\t\t// query param labels\n\t\tvar qrLabels string\n\n\t\tif o.Labels != nil {\n\t\t\tqrLabels = *o.Labels\n\t\t}\n\t\tqLabels := qrLabels\n\t\tif qLabels != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"labels\", qLabels); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Lite != nil {\n\n\t\t// query param lite\n\t\tvar qrLite bool\n\n\t\tif o.Lite != nil {\n\t\t\tqrLite = *o.Lite\n\t\t}\n\t\tqLite := swag.FormatBool(qrLite)\n\t\tif qLite != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"lite\", qLite); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Name != nil {\n\n\t\t// query param name\n\t\tvar qrName string\n\n\t\tif o.Name != nil {\n\t\t\tqrName = *o.Name\n\t\t}\n\t\tqName := qrName\n\t\tif qName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"name\", qName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Owner != nil {\n\n\t\t// query param owner\n\t\tvar qrOwner string\n\n\t\tif o.Owner != nil {\n\t\t\tqrOwner = *o.Owner\n\t\t}\n\t\tqOwner := qrOwner\n\t\tif qOwner != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"owner\", qOwner); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int32\n\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt32(qrPage)\n\t\tif qPage != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.PerPage != nil {\n\n\t\t// query param per_page\n\t\tvar qrPerPage int32\n\n\t\tif o.PerPage != nil {\n\t\t\tqrPerPage = *o.PerPage\n\t\t}\n\t\tqPerPage := swag.FormatInt32(qrPerPage)\n\t\tif qPerPage != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"per_page\", qPerPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Query != nil {\n\n\t\t// query param query\n\t\tvar qrQuery string\n\n\t\tif o.Query != nil {\n\t\t\tqrQuery = *o.Query\n\t\t}\n\t\tqQuery := qrQuery\n\t\tif qQuery != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"query\", qQuery); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ContainerUpdateParams) 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\t// path param id\n\tif err := r.SetPathParam(\"id\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetBodyParam(o.Update); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetPointsByQueryParams) 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.DollarSkip != nil {\n\n\t\t// query param $skip\n\t\tvar qrNrDollarSkip int32\n\t\tif o.DollarSkip != nil {\n\t\t\tqrNrDollarSkip = *o.DollarSkip\n\t\t}\n\t\tqNrDollarSkip := swag.FormatInt32(qrNrDollarSkip)\n\t\tif qNrDollarSkip != \"\" {\n\t\t\tif err := r.SetQueryParam(\"$skip\", qNrDollarSkip); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.DollarTop != nil {\n\n\t\t// query param $top\n\t\tvar qrNrDollarTop int32\n\t\tif o.DollarTop != nil {\n\t\t\tqrNrDollarTop = *o.DollarTop\n\t\t}\n\t\tqNrDollarTop := swag.FormatInt32(qrNrDollarTop)\n\t\tif qNrDollarTop != \"\" {\n\t\t\tif err := r.SetQueryParam(\"$top\", qNrDollarTop); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param project\n\tif err := r.SetPathParam(\"project\", o.Project); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SyncStatusUsingGETParams) 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\t// path param namespaceSelfLinkId\n\tif err := r.SetPathParam(\"namespaceSelfLinkId\", o.NamespaceSelfLinkID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param requestId\n\tif err := r.SetPathParam(\"requestId\", o.RequestID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ResolveBatchParams) 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.Account != nil {\n\n\t\t// query param account\n\t\tvar qrAccount string\n\t\tif o.Account != nil {\n\t\t\tqrAccount = *o.Account\n\t\t}\n\t\tqAccount := qrAccount\n\t\tif qAccount != \"\" {\n\t\t\tif err := r.SetQueryParam(\"account\", qAccount); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Environment != nil {\n\n\t\t// query param environment\n\t\tvar qrEnvironment string\n\t\tif o.Environment != nil {\n\t\t\tqrEnvironment = *o.Environment\n\t\t}\n\t\tqEnvironment := qrEnvironment\n\t\tif qEnvironment != \"\" {\n\t\t\tif err := r.SetQueryParam(\"environment\", qEnvironment); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.From != nil {\n\n\t\t// query param from\n\t\tvar qrFrom string\n\t\tif o.From != nil {\n\t\t\tqrFrom = *o.From\n\t\t}\n\t\tqFrom := qrFrom\n\t\tif qFrom != \"\" {\n\t\t\tif err := r.SetQueryParam(\"from\", qFrom); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Page != nil {\n\n\t\t// query param page\n\t\tvar qrPage int32\n\t\tif o.Page != nil {\n\t\t\tqrPage = *o.Page\n\t\t}\n\t\tqPage := swag.FormatInt32(qrPage)\n\t\tif qPage != \"\" {\n\t\t\tif err := r.SetQueryParam(\"page\", qPage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Region != nil {\n\n\t\t// query param region\n\t\tvar qrRegion string\n\t\tif o.Region != nil {\n\t\t\tqrRegion = *o.Region\n\t\t}\n\t\tqRegion := qrRegion\n\t\tif qRegion != \"\" {\n\t\t\tif err := r.SetQueryParam(\"region\", qRegion); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.To != nil {\n\n\t\t// query param to\n\t\tvar qrTo string\n\t\tif o.To != nil {\n\t\t\tqrTo = *o.To\n\t\t}\n\t\tqTo := qrTo\n\t\tif qTo != \"\" {\n\t\t\tif err := r.SetQueryParam(\"to\", qTo); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetAccountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\tif o.Authorization != nil {\n\n\t\t// header param Authorization\n\t\tif err := r.SetHeaderParam(\"Authorization\", *o.Authorization); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\tif o.Country != nil {\n\n\t\t// query param country\n\t\tvar qrCountry string\n\t\tif o.Country != nil {\n\t\t\tqrCountry = *o.Country\n\t\t}\n\t\tqCountry := qrCountry\n\t\tif qCountry != \"\" {\n\t\t\tif err := r.SetQueryParam(\"country\", qCountry); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Email != nil {\n\n\t\t// query param email\n\t\tvar qrEmail string\n\t\tif o.Email != nil {\n\t\t\tqrEmail = *o.Email\n\t\t}\n\t\tqEmail := qrEmail\n\t\tif qEmail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"email\", qEmail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tvaluesFields := o.Fields\n\n\tjoinedFields := swag.JoinByFormat(valuesFields, \"csv\")\n\t// query array param fields\n\tif err := r.SetQueryParam(\"fields\", joinedFields...); err != nil {\n\t\treturn err\n\t}\n\n\tif o.PersonID != nil {\n\n\t\t// query param person_id\n\t\tvar qrPersonID string\n\t\tif o.PersonID != nil {\n\t\t\tqrPersonID = *o.PersonID\n\t\t}\n\t\tqPersonID := qrPersonID\n\t\tif qPersonID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"person_id\", qPersonID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetDeviceHealthParams) 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\t// header param Authorization\n\tif err := r.SetHeaderParam(\"Authorization\", o.Authorization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param deviceId\n\tif err := r.SetPathParam(\"deviceId\", o.DeviceID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdatePatientParams) 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\t// path param ID\n\tif err := r.SetPathParam(\"ID\", o.ID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Patient != nil {\n\t\tif err := r.SetBodyParam(o.Patient); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *UpdateCustomIDPParams) 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.CustomIDP != nil {\n\t\tif err := r.SetBodyParam(o.CustomIDP); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param aid\n\tif err := r.SetPathParam(\"aid\", o.Aid); err != nil {\n\t\treturn err\n\t}\n\n\t// path param iid\n\tif err := r.SetPathParam(\"iid\", o.Iid); err != nil {\n\t\treturn err\n\t}\n\n\t// path param tid\n\tif err := r.SetPathParam(\"tid\", o.Tid); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetSeriesIDFilterParams) 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.AcceptLanguage != nil {\n\n\t\t// header param Accept-Language\n\t\tif err := r.SetHeaderParam(\"Accept-Language\", *o.AcceptLanguage); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\t// query param keys\n\tqrKeys := o.Keys\n\tqKeys := qrKeys\n\tif qKeys != \"\" {\n\t\tif err := r.SetQueryParam(\"keys\", qKeys); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *CreateBlueprintInWorkspaceInternalParams) 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.AccountID != nil {\n\n\t\t// query param accountId\n\t\tvar qrAccountID string\n\t\tif o.AccountID != nil {\n\t\t\tqrAccountID = *o.AccountID\n\t\t}\n\t\tqAccountID := qrAccountID\n\t\tif qAccountID != \"\" {\n\t\t\tif err := r.SetQueryParam(\"accountId\", qAccountID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param workspaceId\n\tif err := r.SetPathParam(\"workspaceId\", swag.FormatInt64(o.WorkspaceID)); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *OrgGetParams) 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\t// path param org\n\tif err := r.SetPathParam(\"org\", o.Org); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *ExtrasGraphsReadParams) 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\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Name != nil {\n\n\t\t// query param name\n\t\tvar qrName string\n\t\tif o.Name != nil {\n\t\t\tqrName = *o.Name\n\t\t}\n\t\tqName := qrName\n\t\tif qName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"name\", qName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Type != nil {\n\n\t\t// query param type\n\t\tvar qrType string\n\t\tif o.Type != nil {\n\t\t\tqrType = *o.Type\n\t\t}\n\t\tqType := qrType\n\t\tif qType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"type\", qType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetVersioningPolicyParams) 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.Description != nil {\n\n\t\t// query param Description\n\t\tvar qrDescription string\n\t\tif o.Description != nil {\n\t\t\tqrDescription = *o.Description\n\t\t}\n\t\tqDescription := qrDescription\n\t\tif qDescription != \"\" {\n\t\t\tif err := r.SetQueryParam(\"Description\", qDescription); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.IgnoreFilesGreaterThan != nil {\n\n\t\t// query param IgnoreFilesGreaterThan\n\t\tvar qrIgnoreFilesGreaterThan string\n\t\tif o.IgnoreFilesGreaterThan != nil {\n\t\t\tqrIgnoreFilesGreaterThan = *o.IgnoreFilesGreaterThan\n\t\t}\n\t\tqIgnoreFilesGreaterThan := qrIgnoreFilesGreaterThan\n\t\tif qIgnoreFilesGreaterThan != \"\" {\n\t\t\tif err := r.SetQueryParam(\"IgnoreFilesGreaterThan\", qIgnoreFilesGreaterThan); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.MaxSizePerFile != nil {\n\n\t\t// query param MaxSizePerFile\n\t\tvar qrMaxSizePerFile string\n\t\tif o.MaxSizePerFile != nil {\n\t\t\tqrMaxSizePerFile = *o.MaxSizePerFile\n\t\t}\n\t\tqMaxSizePerFile := qrMaxSizePerFile\n\t\tif qMaxSizePerFile != \"\" {\n\t\t\tif err := r.SetQueryParam(\"MaxSizePerFile\", qMaxSizePerFile); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.MaxTotalSize != nil {\n\n\t\t// query param MaxTotalSize\n\t\tvar qrMaxTotalSize string\n\t\tif o.MaxTotalSize != nil {\n\t\t\tqrMaxTotalSize = *o.MaxTotalSize\n\t\t}\n\t\tqMaxTotalSize := qrMaxTotalSize\n\t\tif qMaxTotalSize != \"\" {\n\t\t\tif err := r.SetQueryParam(\"MaxTotalSize\", qMaxTotalSize); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Name != nil {\n\n\t\t// query param Name\n\t\tvar qrName string\n\t\tif o.Name != nil {\n\t\t\tqrName = *o.Name\n\t\t}\n\t\tqName := qrName\n\t\tif qName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"Name\", qName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param Uuid\n\tif err := r.SetPathParam(\"Uuid\", o.UUID); err != nil {\n\t\treturn err\n\t}\n\n\tif o.VersionsDataSourceBucket != nil {\n\n\t\t// query param VersionsDataSourceBucket\n\t\tvar qrVersionsDataSourceBucket string\n\t\tif o.VersionsDataSourceBucket != nil {\n\t\t\tqrVersionsDataSourceBucket = *o.VersionsDataSourceBucket\n\t\t}\n\t\tqVersionsDataSourceBucket := qrVersionsDataSourceBucket\n\t\tif qVersionsDataSourceBucket != \"\" {\n\t\t\tif err := r.SetQueryParam(\"VersionsDataSourceBucket\", qVersionsDataSourceBucket); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.VersionsDataSourceName != nil {\n\n\t\t// query param VersionsDataSourceName\n\t\tvar qrVersionsDataSourceName string\n\t\tif o.VersionsDataSourceName != nil {\n\t\t\tqrVersionsDataSourceName = *o.VersionsDataSourceName\n\t\t}\n\t\tqVersionsDataSourceName := qrVersionsDataSourceName\n\t\tif qVersionsDataSourceName != \"\" {\n\t\t\tif err := r.SetQueryParam(\"VersionsDataSourceName\", qVersionsDataSourceName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetBuildPropertiesParams) 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\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param buildId\n\tif err := r.SetPathParam(\"buildId\", swag.FormatInt32(o.BuildID)); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Filter != nil {\n\n\t\t// query param filter\n\t\tvar qrFilter string\n\t\tif o.Filter != nil {\n\t\t\tqrFilter = *o.Filter\n\t\t}\n\t\tqFilter := qrFilter\n\t\tif qFilter != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter\", qFilter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// path param project\n\tif err := r.SetPathParam(\"project\", o.Project); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *AdminGetBannedDevicesV4Params) 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\t// path param namespace\n\tif err := r.SetPathParam(\"namespace\", o.Namespace); err != nil {\n\t\treturn err\n\t}\n\n\tif o.DeviceType != nil {\n\n\t\t// query param deviceType\n\t\tvar qrDeviceType string\n\t\tif o.DeviceType != nil {\n\t\t\tqrDeviceType = *o.DeviceType\n\t\t}\n\t\tqDeviceType := qrDeviceType\n\t\tif qDeviceType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"deviceType\", qDeviceType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.EndDate != nil {\n\n\t\t// query param endDate\n\t\tvar qrEndDate string\n\t\tif o.EndDate != nil {\n\t\t\tqrEndDate = *o.EndDate\n\t\t}\n\t\tqEndDate := qrEndDate\n\t\tif qEndDate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"endDate\", qEndDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.StartDate != nil {\n\n\t\t// query param startDate\n\t\tvar qrStartDate string\n\t\tif o.StartDate != nil {\n\t\t\tqrStartDate = *o.StartDate\n\t\t}\n\t\tqStartDate := qrStartDate\n\t\tif qStartDate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"startDate\", qStartDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// setting the default header value\n\tif err := r.SetHeaderParam(\"User-Agent\", utils.UserAgentGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := r.SetHeaderParam(\"X-Amzn-Trace-Id\", utils.AmazonTraceIDGen()); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\n\treturn nil\n}", "func (o *BikePointGetAllParams) 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 len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *DecryptParams) 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 err := r.SetBodyParam(o.Parameters); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *DeleteRequestsRequestNameParams) 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\t// query param api-version\n\tqrAPIVersion := o.APIVersion\n\tqAPIVersion := qrAPIVersion\n\tif qAPIVersion != \"\" {\n\t\tif err := r.SetQueryParam(\"api-version\", qAPIVersion); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param organization\n\tif err := r.SetPathParam(\"organization\", o.Organization); err != nil {\n\t\treturn err\n\t}\n\n\t// query param requestName\n\tqrRequestName := o.RequestName\n\tqRequestName := qrRequestName\n\tif qRequestName != \"\" {\n\t\tif err := r.SetQueryParam(\"requestName\", qRequestName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Synchronous != nil {\n\n\t\t// query param synchronous\n\t\tvar qrSynchronous bool\n\t\tif o.Synchronous != nil {\n\t\t\tqrSynchronous = *o.Synchronous\n\t\t}\n\t\tqSynchronous := swag.FormatBool(qrSynchronous)\n\t\tif qSynchronous != \"\" {\n\t\t\tif err := r.SetQueryParam(\"synchronous\", qSynchronous); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *SearchAbsoluteParams) 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.Decorate != nil {\n\n\t\t// query param decorate\n\t\tvar qrDecorate bool\n\t\tif o.Decorate != nil {\n\t\t\tqrDecorate = *o.Decorate\n\t\t}\n\t\tqDecorate := swag.FormatBool(qrDecorate)\n\t\tif qDecorate != \"\" {\n\t\t\tif err := r.SetQueryParam(\"decorate\", qDecorate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// query param fields\n\t\tvar qrFields string\n\t\tif o.Fields != nil {\n\t\t\tqrFields = *o.Fields\n\t\t}\n\t\tqFields := qrFields\n\t\tif qFields != \"\" {\n\t\t\tif err := r.SetQueryParam(\"fields\", qFields); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Filter != nil {\n\n\t\t// query param filter\n\t\tvar qrFilter string\n\t\tif o.Filter != nil {\n\t\t\tqrFilter = *o.Filter\n\t\t}\n\t\tqFilter := qrFilter\n\t\tif qFilter != \"\" {\n\t\t\tif err := r.SetQueryParam(\"filter\", qFilter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param from\n\tqrFrom := o.From\n\tqFrom := qrFrom\n\tif qFrom != \"\" {\n\t\tif err := r.SetQueryParam(\"from\", qFrom); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Offset != nil {\n\n\t\t// query param offset\n\t\tvar qrOffset int64\n\t\tif o.Offset != nil {\n\t\t\tqrOffset = *o.Offset\n\t\t}\n\t\tqOffset := swag.FormatInt64(qrOffset)\n\t\tif qOffset != \"\" {\n\t\t\tif err := r.SetQueryParam(\"offset\", qOffset); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param query\n\tqrQuery := o.Query\n\tqQuery := qrQuery\n\tif qQuery != \"\" {\n\t\tif err := r.SetQueryParam(\"query\", qQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Sort != nil {\n\n\t\t// query param sort\n\t\tvar qrSort string\n\t\tif o.Sort != nil {\n\t\t\tqrSort = *o.Sort\n\t\t}\n\t\tqSort := qrSort\n\t\tif qSort != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sort\", qSort); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param to\n\tqrTo := o.To\n\tqTo := qrTo\n\tif qTo != \"\" {\n\t\tif err := r.SetQueryParam(\"to\", qTo); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *GetCountersParams) 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.ClusterNodeID != nil {\n\n\t\t// query param clusterNodeId\n\t\tvar qrClusterNodeID string\n\n\t\tif o.ClusterNodeID != nil {\n\t\t\tqrClusterNodeID = *o.ClusterNodeID\n\t\t}\n\t\tqClusterNodeID := qrClusterNodeID\n\t\tif qClusterNodeID != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"clusterNodeId\", qClusterNodeID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Nodewise != nil {\n\n\t\t// query param nodewise\n\t\tvar qrNodewise bool\n\n\t\tif o.Nodewise != nil {\n\t\t\tqrNodewise = *o.Nodewise\n\t\t}\n\t\tqNodewise := swag.FormatBool(qrNodewise)\n\t\tif qNodewise != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"nodewise\", qNodewise); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *MetroclusterInterconnectGetParams) 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\t// path param adapter\n\tif err := r.SetPathParam(\"adapter\", o.Adapter); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Fields != nil {\n\n\t\t// binding items for fields\n\t\tjoinedFields := o.bindParamFields(reg)\n\n\t\t// query array param fields\n\t\tif err := r.SetQueryParam(\"fields\", joinedFields...); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param node.uuid\n\tif err := r.SetPathParam(\"node.uuid\", o.NodeUUID); err != nil {\n\t\treturn err\n\t}\n\n\t// path param partner_type\n\tif err := r.SetPathParam(\"partner_type\", o.PartnerType); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *PutParams) 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.Item != nil {\n\t\tif err := r.SetBodyParam(o.Item); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param itemId\n\tif err := r.SetPathParam(\"itemId\", o.ItemID); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *CreateAccessPolicyParams) 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\tif o.Body != nil {\n\t\tif err := r.SetBodyParam(o.Body); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func (o *DeleteDataSourceParams) 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.APIKey != nil {\n\n\t\t// query param ApiKey\n\t\tvar qrAPIKey string\n\n\t\tif o.APIKey != nil {\n\t\t\tqrAPIKey = *o.APIKey\n\t\t}\n\t\tqAPIKey := qrAPIKey\n\t\tif qAPIKey != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ApiKey\", qAPIKey); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.APISecret != nil {\n\n\t\t// query param ApiSecret\n\t\tvar qrAPISecret string\n\n\t\tif o.APISecret != nil {\n\t\t\tqrAPISecret = *o.APISecret\n\t\t}\n\t\tqAPISecret := qrAPISecret\n\t\tif qAPISecret != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ApiSecret\", qAPISecret); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.CreationDate != nil {\n\n\t\t// query param CreationDate\n\t\tvar qrCreationDate int32\n\n\t\tif o.CreationDate != nil {\n\t\t\tqrCreationDate = *o.CreationDate\n\t\t}\n\t\tqCreationDate := swag.FormatInt32(qrCreationDate)\n\t\tif qCreationDate != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"CreationDate\", qCreationDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Disabled != nil {\n\n\t\t// query param Disabled\n\t\tvar qrDisabled bool\n\n\t\tif o.Disabled != nil {\n\t\t\tqrDisabled = *o.Disabled\n\t\t}\n\t\tqDisabled := swag.FormatBool(qrDisabled)\n\t\tif qDisabled != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"Disabled\", qDisabled); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.EncryptionKey != nil {\n\n\t\t// query param EncryptionKey\n\t\tvar qrEncryptionKey string\n\n\t\tif o.EncryptionKey != nil {\n\t\t\tqrEncryptionKey = *o.EncryptionKey\n\t\t}\n\t\tqEncryptionKey := qrEncryptionKey\n\t\tif qEncryptionKey != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"EncryptionKey\", qEncryptionKey); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.EncryptionMode != nil {\n\n\t\t// query param EncryptionMode\n\t\tvar qrEncryptionMode string\n\n\t\tif o.EncryptionMode != nil {\n\t\t\tqrEncryptionMode = *o.EncryptionMode\n\t\t}\n\t\tqEncryptionMode := qrEncryptionMode\n\t\tif qEncryptionMode != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"EncryptionMode\", qEncryptionMode); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.FlatStorage != nil {\n\n\t\t// query param FlatStorage\n\t\tvar qrFlatStorage bool\n\n\t\tif o.FlatStorage != nil {\n\t\t\tqrFlatStorage = *o.FlatStorage\n\t\t}\n\t\tqFlatStorage := swag.FormatBool(qrFlatStorage)\n\t\tif qFlatStorage != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"FlatStorage\", qFlatStorage); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.LastSynchronizationDate != nil {\n\n\t\t// query param LastSynchronizationDate\n\t\tvar qrLastSynchronizationDate int32\n\n\t\tif o.LastSynchronizationDate != nil {\n\t\t\tqrLastSynchronizationDate = *o.LastSynchronizationDate\n\t\t}\n\t\tqLastSynchronizationDate := swag.FormatInt32(qrLastSynchronizationDate)\n\t\tif qLastSynchronizationDate != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"LastSynchronizationDate\", qLastSynchronizationDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// path param Name\n\tif err := r.SetPathParam(\"Name\", o.Name); err != nil {\n\t\treturn err\n\t}\n\n\tif o.ObjectsBaseFolder != nil {\n\n\t\t// query param ObjectsBaseFolder\n\t\tvar qrObjectsBaseFolder string\n\n\t\tif o.ObjectsBaseFolder != nil {\n\t\t\tqrObjectsBaseFolder = *o.ObjectsBaseFolder\n\t\t}\n\t\tqObjectsBaseFolder := qrObjectsBaseFolder\n\t\tif qObjectsBaseFolder != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ObjectsBaseFolder\", qObjectsBaseFolder); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ObjectsBucket != nil {\n\n\t\t// query param ObjectsBucket\n\t\tvar qrObjectsBucket string\n\n\t\tif o.ObjectsBucket != nil {\n\t\t\tqrObjectsBucket = *o.ObjectsBucket\n\t\t}\n\t\tqObjectsBucket := qrObjectsBucket\n\t\tif qObjectsBucket != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ObjectsBucket\", qObjectsBucket); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ObjectsHost != nil {\n\n\t\t// query param ObjectsHost\n\t\tvar qrObjectsHost string\n\n\t\tif o.ObjectsHost != nil {\n\t\t\tqrObjectsHost = *o.ObjectsHost\n\t\t}\n\t\tqObjectsHost := qrObjectsHost\n\t\tif qObjectsHost != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ObjectsHost\", qObjectsHost); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ObjectsPort != nil {\n\n\t\t// query param ObjectsPort\n\t\tvar qrObjectsPort int32\n\n\t\tif o.ObjectsPort != nil {\n\t\t\tqrObjectsPort = *o.ObjectsPort\n\t\t}\n\t\tqObjectsPort := swag.FormatInt32(qrObjectsPort)\n\t\tif qObjectsPort != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ObjectsPort\", qObjectsPort); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ObjectsSecure != nil {\n\n\t\t// query param ObjectsSecure\n\t\tvar qrObjectsSecure bool\n\n\t\tif o.ObjectsSecure != nil {\n\t\t\tqrObjectsSecure = *o.ObjectsSecure\n\t\t}\n\t\tqObjectsSecure := swag.FormatBool(qrObjectsSecure)\n\t\tif qObjectsSecure != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ObjectsSecure\", qObjectsSecure); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.ObjectsServiceName != nil {\n\n\t\t// query param ObjectsServiceName\n\t\tvar qrObjectsServiceName string\n\n\t\tif o.ObjectsServiceName != nil {\n\t\t\tqrObjectsServiceName = *o.ObjectsServiceName\n\t\t}\n\t\tqObjectsServiceName := qrObjectsServiceName\n\t\tif qObjectsServiceName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"ObjectsServiceName\", qObjectsServiceName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.PeerAddress != nil {\n\n\t\t// query param PeerAddress\n\t\tvar qrPeerAddress string\n\n\t\tif o.PeerAddress != nil {\n\t\t\tqrPeerAddress = *o.PeerAddress\n\t\t}\n\t\tqPeerAddress := qrPeerAddress\n\t\tif qPeerAddress != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"PeerAddress\", qPeerAddress); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.SkipSyncOnRestart != nil {\n\n\t\t// query param SkipSyncOnRestart\n\t\tvar qrSkipSyncOnRestart bool\n\n\t\tif o.SkipSyncOnRestart != nil {\n\t\t\tqrSkipSyncOnRestart = *o.SkipSyncOnRestart\n\t\t}\n\t\tqSkipSyncOnRestart := swag.FormatBool(qrSkipSyncOnRestart)\n\t\tif qSkipSyncOnRestart != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"SkipSyncOnRestart\", qSkipSyncOnRestart); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.StorageType != nil {\n\n\t\t// query param StorageType\n\t\tvar qrStorageType string\n\n\t\tif o.StorageType != nil {\n\t\t\tqrStorageType = *o.StorageType\n\t\t}\n\t\tqStorageType := qrStorageType\n\t\tif qStorageType != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"StorageType\", qStorageType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.VersioningPolicyName != nil {\n\n\t\t// query param VersioningPolicyName\n\t\tvar qrVersioningPolicyName string\n\n\t\tif o.VersioningPolicyName != nil {\n\t\t\tqrVersioningPolicyName = *o.VersioningPolicyName\n\t\t}\n\t\tqVersioningPolicyName := qrVersioningPolicyName\n\t\tif qVersioningPolicyName != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"VersioningPolicyName\", qVersioningPolicyName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.Watch != nil {\n\n\t\t// query param Watch\n\t\tvar qrWatch bool\n\n\t\tif o.Watch != nil {\n\t\t\tqrWatch = *o.Watch\n\t\t}\n\t\tqWatch := swag.FormatBool(qrWatch)\n\t\tif qWatch != \"\" {\n\n\t\t\tif err := r.SetQueryParam(\"Watch\", qWatch); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}" ]
[ "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.68300045", "0.68283993", "0.68213093", "0.68209827", "0.681858", "0.6810088", "0.67938024", "0.6792597", "0.67860335", "0.6781293", "0.6778168", "0.67739195", "0.676121", "0.676101", "0.6760405", "0.675646", "0.67500865", "0.67439634", "0.6743771", "0.6742206", "0.67405975", "0.67344606", "0.67331755", "0.67328155", "0.67320985", "0.67255586", "0.6724229", "0.67159885", "0.67127234", "0.67094815", "0.67085487", "0.6705413", "0.67020816", "0.6698303", "0.66938454", "0.6692077", "0.66849154", "0.6677396", "0.66709644", "0.6670931", "0.6670394", "0.6666765", "0.6666114", "0.6665216", "0.6662671", "0.66568", "0.6653157", "0.6646967", "0.6645966", "0.6642767", "0.6640608", "0.6638263", "0.6634605", "0.66345316", "0.6625767", "0.66217625", "0.6619463", "0.66181296", "0.66144806", "0.6606646", "0.6605777", "0.66039085", "0.659942", "0.6598786", "0.65961313", "0.65951705", "0.6591678", "0.6586235", "0.65826946", "0.658246", "0.6574939", "0.6572858", "0.6569902", "0.6568091", "0.65670824", "0.65661305", "0.6565009", "0.6561903", "0.65615994", "0.6560924", "0.6557316" ]
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 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 Newgeo(conf GeoConfig,\n\tlog log.Modular, stats metrics.Type,\n) (types.Processor, error) {\n\tdb, err := geoip2.Open(conf.File)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tm := &geo{\n\t\tfile: conf.File,\n\t\tlog: log,\n\t\tfield: conf.Field,\n\t\tgeoip2DB: db,\n\t\tstats: stats,\n\t}\n\treturn m, nil\n}", "func New(latitude, longitude float64, name string) *Place {\n\treturn &Place{saneAngle(0, latitude), saneAngle(0, longitude), name}\n}", "func New(latitude float64, longitude float64) *LocTask {\n\treturn &LocTask{location: NewLocation(latitude, longitude), cronSch: cron.New()}\n}", "func NewGeoIP(filePath string) (*GeoIP, error) {\n\t// 判断文件是否存在\n\t_, err := os.Stat(filePath)\n\tif err != nil && os.IsNotExist(err) {\n\t\tlog.Println(\"文件不存在,请自行下载 Geoip2 City库,并保存在\", filePath)\n\t\treturn nil, err\n\t} else {\n\t\tdb, err := geoip2.Open(filePath)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\treturn &GeoIP{db: db}, nil\n\t}\n}", "func New(text string) error {\n\treturn errorString(text)\n}", "func (s StaticInfoExtn) NewGeo() (StaticInfoExtn_GeoInfo, error) {\n\tss, err := NewStaticInfoExtn_GeoInfo(s.Struct.Segment())\n\tif err != nil {\n\t\treturn StaticInfoExtn_GeoInfo{}, err\n\t}\n\terr = s.Struct.SetPtr(1, ss.Struct.ToPtr())\n\treturn ss, err\n}", "func New(text string) error {\n\treturn &errorString{text}\n}", "func New(text string) error {\n\treturn errors.New(text)\n}", "func New(text string) error {\n\treturn errors.New(text)\n}", "func New(text string) error {\n\treturn errors.New(text)\n}", "func NewLocation(p Point, data []byte) *Location {\n\treturn &Location{p, data}\n}", "func newLocation(lat, long coordinate) *location {\n\treturn &location{lat.decimal(), long.decimal()}\n}", "func NewLocation(vs byte) *Location {\n\treturn &Location{\n\t\tstyle: vs,\n\t\tparsed: false,\n\t}\n}", "func New(text string) error {\n\treturn &Error{\n\t\tstack: callers(),\n\t\ttext: text,\n\t\tcode: gcode.CodeNil,\n\t}\n}", "func New(text string) error {\n\treturn &Error{Message: text}\n}", "func NewGeoLocationCmd(q *redis.GeoRadiusQuery, args ...interface{}) *redis.GeoLocationCmd {\n\treturn redis.NewGeoLocationCmd(q, args...)\n}", "func NewLocation(x int, y int, z int, world string) *Location {\n\treturn &Location{\n\t\tX: x,\n\t\tY: y,\n\t\tZ: z,\n\t\tWorld: world,\n\t}\n}", "func NewText(pathname string, name dns.Name) *Text {\n\treturn &Text{\n\t\tMemory: NewMemory(),\n\t\tname: name,\n\t\tpathname: pathname,\n\t}\n}", "func New(name, text string) *Template {\n\tlt := &Template{name: name, text: text}\n\tif inTest {\n\t\t// In tests, always parse the templates early.\n\t\tlt.tp()\n\t}\n\treturn lt\n}", "func New(str string) (*PN, error) {\n\tcur := &PN{}\n\tfor _, line := range strings.Split(str, \"\\n\") {\n\t\tm := reTreeLine.FindStringSubmatch(line)\n\t\tif len(line) != len(m[0]) {\n\t\t\treturn nil, ErrBadTreeString\n\t\t}\n\t\tif m[1] == \"}\" {\n\t\t\tcur = cur.P\n\t\t}\n\t\tif m[2] != \"\" {\n\t\t\tkind := stringsymbol.Symbol(m[2])\n\t\t\tval := handleSlash.Replace(m[3])\n\t\t\tch := &PN{\n\t\t\t\tLexeme: lexeme.New(kind).Set(val),\n\t\t\t\tP: cur,\n\t\t\t}\n\t\t\tcur.C = append(cur.C, ch)\n\t\t\tif m[4] == \"{\" {\n\t\t\t\tcur = ch\n\t\t\t}\n\t\t}\n\t}\n\tcur = cur.C[0]\n\tcur.P = nil\n\treturn cur, nil\n}", "func New(cfg config.Config, log *logrus.Logger) error {\n\tvar tpl bytes.Buffer\n\tvars := map[string]interface{}{\n\t\t\"typename\": getTypeName(cfg.Repository.URL),\n\t}\n\n\tindexMappingTemplate, _ := template.New(\"geo_mapping\").Parse(`{\n\t\t\"mappings\": {\n\t\t\t\"{{ .typename }}\": {\n\t\t\t\t\"properties\": {\n\t\t\t\t\t\"geometry\": {\n\t\t\t\t\t\t\"type\": \"geo_shape\"\n\t\t\t\t\t},\n \"collection\": {\n \"type\": \"text\",\n \"fielddata\": true\n }\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}`)\n\n\tindexMappingTemplate.Execute(&tpl, vars)\n\n\tctx := context.Background()\n\n\tclient, err := createClient(&cfg.Repository)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tindexName := getIndexName(cfg.Repository.URL)\n\n\tcreateIndex, err := client.CreateIndex(indexName).Body(tpl.String()).Do(ctx)\n\tif err != nil {\n\t\terrorText := fmt.Sprintf(\"Cannot create repository: %v\\n\", err)\n\t\tlog.Errorf(errorText)\n\t\treturn errors.New(errorText)\n\t}\n\tif !createIndex.Acknowledged {\n\t\treturn errors.New(\"CreateIndex was not acknowledged. Check that timeout value is correct.\")\n\t}\n\n\tlog.Debug(\"Creating Repository\" + cfg.Repository.URL)\n\tlog.Debug(\"Type: \" + cfg.Repository.Type)\n\tlog.Debug(\"URL: \" + cfg.Repository.URL)\n\n\treturn nil\n}", "func New(key string) *YaGeoInstance {\n\treturn &YaGeoInstance{Key: key}\n}", "func NewLocation(latitude, longitude, driverID int) Location {\n\treturn &Coordinates{\n\t\tLatitude: latitude,\n\t\tLongitude: longitude,\n\t\tDriverID: driverID,\n\t}\n}", "func NewAddr(s string) Addr {\n\treturn addr(strings.ToLower(s))\n}", "func NewAddr(s string) Addr {\n\treturn addr(strings.ToLower(s))\n}", "func NewGeoLite2() (Locator, error) {\n\tdb, err := geoip2.Open(dbFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &geoLite2{\n\t\tdb: db,\n\t}, nil\n}", "func New(ipAddress, ipStackAPIToken string, sensitivity int) (*Geofence, error) {\n\t// Create new client for ipstack.com\n\tipStackClient, err := ipstack.New(ipStackAPIToken)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Ensure sensitivity is between 1 - 5\n\terr = validateSensitivity(sensitivity)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// New Geofence object\n\tgeofence := &Geofence{\n\t\tIPStackClient: ipStackClient,\n\t\tSensitivity: sensitivity,\n\t}\n\n\t// If no ip address passed, get current device location details\n\tif ipAddress == \"\" {\n\t\tcurrentHostLocation, err := geofence.IPStackClient.Me()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tgeofence.Latitude = currentHostLocation.Latitide\n\t\tgeofence.Longitude = currentHostLocation.Longitude\n\t\t// If address is passed, fetch details for it\n\t} else {\n\t\terr = validateIPAddress(ipAddress)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tremoteHostLocation, err := geofence.IPStackClient.IP(ipAddress)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tgeofence.Latitude = remoteHostLocation.Latitide\n\t\tgeofence.Longitude = remoteHostLocation.Longitude\n\t}\n\treturn geofence, nil\n}", "func NewLocation(cfg *Config, node ast.Node) Location {\n\tstart := cfg.FileSet.Position(node.Pos())\n\tend := cfg.FileSet.Position(node.End())\n\n\treturn Location{\n\t\tStart: Position{start.Line, start.Column},\n\t\tEnd: Position{end.Line, end.Column},\n\t\tFilepath: start.Filename,\n\t\tWorkDir: cfg.WorkDir,\n\t\tRepo: cfg.Repo,\n\t}\n}", "func NewLocation(row int, col int) (Location, error) {\n\tif row >= 0 && row <= 7 && col >= 0 && col <= 7 {\n\t\treturn Location{\n\t\t\trow: row,\n\t\t\tcol: col,\n\t\t}, nil\n\t}\n\treturn Location{}, errors.New(\"invalid row/col\")\n}", "func New(domains []string, outputLocation string, prefix string) *provider.Provider {\n\tloc := &Local{\n\t\tdomains: domains,\n\t\tprefix: prefix,\n\t\toutputLocation: outputLocation,\n\t}\n\tprov := provider.Provider(loc)\n\treturn &prov\n}", "func NewGeoPosCmd(args ...interface{}) *redis.GeoPosCmd {\n\treturn redis.NewGeoPosCmd(args...)\n}", "func parseRawPlace(raw string) (p rawPlace) {\n\tsplit := len(raw) - 2\n\tp.city = strings.Title(strings.TrimSpace(raw[:split]))\n\tp.state = strings.ToUpper(strings.TrimSpace(raw[split:]))\n\treturn\n}", "func NewFromString(addr string) (*Address, error) {\n\tlegaddr, err := legacy.Decode(addr)\n\tif err == nil {\n\t\taddr, err := NewFromLegacy(legaddr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn addr, nil\n\t}\n\n\tcashaddr, err := cashaddress.Decode(addr, cashaddress.MainNet)\n\tif err == nil {\n\t\taddr, err := NewFromCashAddress(cashaddr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn addr, nil\n\t}\n\n\treturn nil, errors.New(\"unable to decode address\")\n}", "func NewPosition(line, column int, file string) *Position {\n\treturn &Position{\n\t\tLine: line,\n\t\tColumn: column,\n\t\tfile: &file,\n\t}\n}", "func New(server io.Server, registry packages.Registry) packages.ApplicationPackageHandler {\n\treturn &GeolocationPackage{\n\t\tserver: server,\n\t\tregistry: registry,\n\t}\n}", "func New() *Text {\n\treturn &Text{}\n}", "func NewLocator(src, dest, destPkg string) (*Locator, error) {\n\tloc := &Locator{}\n\treturn loc, loc.Init(src, dest, destPkg)\n}", "func newPointFromLatLngStrings(latStr string, lngStr string) (*geo.Point, error) {\n\tlat, err1 := strconv.ParseFloat(latStr, 64)\n\tlng, err2 := strconv.ParseFloat(lngStr, 64)\n\tvar p *geo.Point\n\tif err1 != nil || err2 != nil {\n\t\tmsg := []string{\"Unable to convert \", latStr, \",\", lngStr, \" to a Point\"}\n\t\treturn nil, errors.New(strings.Join(msg, \"\"))\n\t}\n\tp = geo.NewPointFromLatLng(lat, lng)\n\treturn p, nil\n}", "func NewNoPos(text string) (err error) {\n\treturn &ErrInfo{Err: errors.New(text)}\n}", "func New(config Config) (weather.Provider, error) {\n\tif config.APIKey == \"\" {\n\t\treturn nil, ErrAPIKeyMissing\n\t}\n\n\tc := openweathermap.New(config.APIKey)\n\n\tswitch {\n\tcase config.CityID != \"\":\n\t\treturn c.CityID(config.CityID), nil\n\tcase config.ZipCode != \"\":\n\t\treturn c.Zipcode(config.ZipCode, config.CountryCode), nil\n\tcase config.CityName != \"\":\n\t\treturn c.CityName(config.CityName, config.CountryCode), nil\n\tdefault:\n\t\treturn c.Coords(config.Latitude, config.Longitude), nil\n\t}\n}", "func New(provider string) (Provider, error) {\n\tswitch provider {\n\tcase \"freeGeoIP\":\n\t\tpr := new(freeGeoIP)\n\t\treturn pr, nil\n\t}\n\treturn nil, ErrNoSuchProvider\n}", "func NewText(text string) error {\n\tif text == \"\" {\n\t\treturn nil\n\t}\n\treturn &errorWrapper{\n\t\ts: text,\n\t}\n}", "func NewGeoLite2() (Locator, error) {\n\tif _, err := os.Stat(dbPath + geoLite2DbName); os.IsNotExist(err) {\n\t\tif os.Getenv(\"MAXMIND_LICENSE\") != \"\" {\n\t\t\terr := downloadGeoLite2Db(os.Getenv(\"MAXMIND_LICENSE\"))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t} else {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tdb, err := geoip2.Open(dbPath + geoLite2DbName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &geoLite2{\n\t\tdb: db,\n\t}, nil\n}", "func NewReaderFromText(name string, text string) *Reader {\n\tnoExternalNewlines := strings.Trim(text, \"\\n\")\n\treturn &Reader{\n\t\tname: &name,\n\t\tlines: strings.Split(noExternalNewlines, \"\\n\"),\n\t\tlock: &sync.Mutex{},\n\t}\n}", "func NewText() (Text, error) {\n\ttxt := C.sfText_create()\n\tif txt == nil {\n\t\treturn Text{nil}, errors.New(\"Couldn't make a text\")\n\t}\n\treturn Text{txt}, nil\n}", "func NewTextRegionPos(st, ed TextPos) TextRegion {\n\ttr := TextRegion{Start: st, End: ed}\n\ttr.TimeNow()\n\treturn tr\n}", "func NewLatLng(lat, lng float64) *LatLng {\n\tInitialize()\n\treturn &LatLng{\n\t\tValue: L.Call(\"latLng\", lat, lng),\n\t}\n}", "func NewPoint(latitude float64, longitude float64) *Point {\n return &Point{latitude: latitude, longitude: longitude}\n}", "func NewGeospatial(baseURL string) Geospatial {\n\treturn &geospatialService{baseURL}\n}", "func New(text string) (err error) {\n\treturn backendErr(errors.New(text))\n}", "func New(s string) (*PegQuery, error) {\n\tp := &QueryParser{\n\t\tBuffer: s,\n\t}\n\tp.Expression.explainer = func(format string, args ...interface{}) {\n\t\tfmt.Printf(format, args...)\n\t}\n\tp.Init()\n\terr := p.Parse()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp.Execute()\n\treturn &PegQuery{str: s, parser: p}, nil\n}", "func NewFromString(s string) (*Tree, error) {\n\treturn New(strings.NewReader(s))\n}", "func NewAddress(street string) *Address {\n // Just return a dummy for STUB\n return &Address{}\n}", "func NewLocation(bucket, object string) Location {\n\treturn Location{\n\t\tBucket: bucket,\n\t\tObject: object}\n}", "func NewGeoField(field string, latitude float32, longitude float32) GeoField {\n\treturn GeoField{\n\t\tGeoLocation: GeoLocation{Latitude: latitude, Longitude: longitude},\n\t\tField: field}\n}", "func New(t opentracing.Tracer, geoconn, rateconn *grpc.ClientConn) *Search {\n\treturn &Search{\n\t\tgeoClient: geo.NewGeoClient(geoconn),\n\t\trateClient: rate.NewRateClient(rateconn),\n\t\ttracer: t,\n\t}\n}", "func New(text string) error {\n\terr := &wrappedError{\n\t\ttraceMessage: text,\n\t}\n\tif IncludeCaller {\n\t\terr.addCaller(1)\n\t}\n\treturn err\n}", "func ExtractCoordinates(text string) (string, Coordinates) {\n\tvar (\n\t\t// <a href=\"geo:49.976136, 36.267256\">49.976136, 36.267256</a>\n\t\tgeoHrefRe = regexp.MustCompile(\"<a.+?href=\\\"geo:(\\\\d{2}[.,]\\\\d{3,}),?\\\\s*(\\\\d{2}[.,]\\\\d{3,})\\\">(.+?)</a>\")\n\t\t// <a href=\"https://www.google.com.ua/maps/@50.0363257,36.2120039,19z\" target=\"blank\">50.036435 36.211914</a>\n\t\threfRe = regexp.MustCompile(\"<a.+?href=\\\"https?://.+?(\\\\d{2}[.,]\\\\d{3,}),?\\\\s*(\\\\d{2}[.,]\\\\d{3,}).*?\\\">(.+?)</a>\")\n\t\t// 49.976136, 36.267256\n\t\tnumbersRe = regexp.MustCompile(\"(\\\\d{2}[.,]\\\\d{3,}),?\\\\s*(\\\\d{2}[.,]\\\\d{3,})\")\n\n\t\tres = text\n\t\tcoords = Coordinates{}\n\t\ttmpCoords Coordinates\n\t)\n\n\tlog.Print(\"[INFO] Extract coordinates from task text\")\n\tfor _, re := range []*regexp.Regexp{geoHrefRe, hrefRe, numbersRe} {\n\t\tres, tmpCoords = extractCoordinates(res, re)\n\t\tcoords = append(coords, tmpCoords...)\n\t}\n\n\tfor _, coord := range coords {\n\t\tres = strings.Replace(res, \"#coords#\", coord.OriginalString, 1)\n\t}\n\tif DEBUG {\n\t\tlog.Printf(\"[DEBUG] Found %d coordinates\", len(coords))\n\t}\n\n\treturn res, coords\n}", "func NewPoint(lat, lng float64) Location {\r\n\treturn Location{\r\n\t\t\"Point\",\r\n\t\t[]float64{lng, lat},\r\n\t}\r\n}", "func (s StaticInfoExtn_GeoInfo_Location) NewGpsData() (StaticInfoExtn_GeoInfo_Location_Coordinates, error) {\n\tss, err := NewStaticInfoExtn_GeoInfo_Location_Coordinates(s.Struct.Segment())\n\tif err != nil {\n\t\treturn StaticInfoExtn_GeoInfo_Location_Coordinates{}, err\n\t}\n\terr = s.Struct.SetPtr(0, ss.Struct.ToPtr())\n\treturn ss, err\n}", "func New(value interface{}) error {\n\tif value == nil {\n\t\treturn nil\n\t}\n\treturn NewText(gconv.String(value))\n}", "func New(loc Locator) (t Transport, e error) {\n\tif e := loc.Validate(); e != nil {\n\t\treturn nil, fmt.Errorf(\"loc.Validate %w\", e)\n\t}\n\tloc.ApplyDefaults(RoleClient)\n\n\ttr := &transport{}\n\ttr.TransportBase, tr.p = l3.NewTransportBase(l3.TransportBaseConfig{\n\t\tMTU: loc.Dataroom,\n\t\tInitialState: l3.TransportDown,\n\t})\n\n\tif tr.handle, e = newHandle(loc, tr.p.SetState); e != nil {\n\t\treturn nil, e\n\t}\n\treturn tr, nil\n}", "func NewFromString(htmlString string) (r *Recipe, err error) {\n\tr = &Recipe{FileName: \"string\"}\n\tr.FileContent = htmlString\n\terr = r.parseHTML()\n\treturn\n}", "func NewFormatGeoFormat() *FormatGeoFormat {\n\treturn &FormatGeoFormat{}\n}", "func New() *Parser {\n\treturn &Parser{\n\t\tWords: make(map[string]*wordRef),\n\t}\n}", "func (s StaticInfoExtn_GeoInfo) NewLocations(n int32) (StaticInfoExtn_GeoInfo_Location_List, error) {\n\tl, err := NewStaticInfoExtn_GeoInfo_Location_List(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn StaticInfoExtn_GeoInfo_Location_List{}, err\n\t}\n\terr = s.Struct.SetPtr(0, l.List.ToPtr())\n\treturn l, err\n}", "func NewGeoDB(zipfile string) (GeoFinder, error) {\n\tf, err := os.Open(zipfile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\tfi, err := f.Stat()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tzf, err := zip.NewReader(f, fi.Size())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar blocks, countries *zip.File\n\tfor _, f := range zf.File {\n\t\tif strings.HasSuffix(f.Name, \"-Blocks-IPv4.csv\") {\n\t\t\tblocks = f\n\t\t} else if strings.HasSuffix(f.Name, \"-Country-Locations-en.csv\") {\n\t\t\tcountries = f\n\t\t}\n\t}\n\tif blocks == nil || countries == nil {\n\t\treturn nil, errors.New(\"ZIP does not contains blocks or countries\")\n\t}\n\n\tdb := geodb{}\n\tcn := map[string]string{}\n\n\tif err := readCSV(countries, []string{\"geoname_id\", \"country_iso_code\"}, func(row []string) error {\n\t\tcn[row[0]] = row[1]\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := readCSV(blocks, []string{\"network\", \"geoname_id\"}, func(row []string) error {\n\t\tnetwork, id := row[0], row[1]\n\t\tcountry, ok := cn[id]\n\t\tif !ok {\n\t\t\t// Some ranges may not contain country data\n\t\t\treturn nil\n\t\t}\n\t\t_, ipnet, err := net.ParseCIDR(network)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdb = append(db, ipRange{Net: ipnet, Country: country})\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\treturn db, nil\n}", "func NewGeoConfig() *GeoConfig {\n\treturn &GeoConfig{}\n}", "func NewTextRegion(stLn, stCh, edLn, edCh int) TextRegion {\n\ttr := TextRegion{Start: TextPos{Ln: stLn, Ch: stCh}, End: TextPos{Ln: edLn, Ch: edCh}}\n\ttr.TimeNow()\n\treturn tr\n}", "func NewFromFile(file string, name string) (*Trie, error) {\n\tif len(file) == 0 {\n\t\treturn nil, fmt.Errorf(\"file is required\")\n\t}\n\tfh, err := os.Open(file)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not read file %s: %s\", file, err)\n\t}\n\tdefer fh.Close()\n\n\tfs := bufio.NewScanner(fh)\n\ttr := New(name)\n\n\tfor fs.Scan() {\n\t\tword := fs.Text()\n\t\tif len(word) > 0 {\n\t\t\ttr.Add(word, \"\")\n\t\t}\n\t}\n\n\treturn tr, nil\n}", "func NewCountryNamedLocation()(*CountryNamedLocation) {\n m := &CountryNamedLocation{\n NamedLocation: *NewNamedLocation(),\n }\n return m\n}", "func (sys *System) newLocation(ctx *Context, name string) (*Location, error) {\n\n\tstorage, err := sys.ensureStorage(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar state State\n\tif sys.config.UnindexedState {\n\t\tLog(INFO, ctx, \"System.newLocation\", \"stateType\", \"linear\")\n\t\tstate, err = NewLinearState(ctx, name, storage)\n\t} else {\n\t\tLog(INFO, ctx, \"System.newLocation\", \"stateType\", \"indexed\")\n\t\tstate, err = NewIndexedState(ctx, name, storage)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcron.AddHooks(ctx, sys.cron, state)\n\n\tloc, err := NewLocation(ctx, name, state, sys.LocControl(ctx, name))\n\tif err != nil {\n\t\tLog(ERROR, ctx, \"System.newLocation\", \"error\", err)\n\t\treturn nil, err\n\t}\n\n\tloc.Provider = sys\n\n\treturn loc, nil\n}", "func (f *FFS) NewAddr(ctx context.Context, name string, options ...NewAddressOption) (string, error) {\n\tr := &rpc.NewAddrRequest{Name: name}\n\tfor _, opt := range options {\n\t\topt(r)\n\t}\n\tresp, err := f.client.NewAddr(ctx, r)\n\treturn resp.Addr, err\n}", "func NewFromFile(path string) (*License, error) {\n\tlicenseText, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tl := &License{\n\t\tText: string(licenseText),\n\t\tFile: path,\n\t}\n\n\tif err := l.GuessType(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn l, nil\n}", "func New(input string) *Lexer {\n\tl := &Lexer{input: input} //instantiate and return its location\n\tl.readChar()\n\treturn l\n}", "func New(text string) (Key, error) {\n\treturn decode(nil, []byte(text))\n}", "func (s PathMetadata) NewAsLocations(n int32) (PathMetadata_Geo_List, error) {\n\tl, err := NewPathMetadata_Geo_List(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn PathMetadata_Geo_List{}, err\n\t}\n\terr = s.Struct.SetPtr(1, l.List.ToPtr())\n\treturn l, err\n}", "func NewField(y, x, len int, text string) (*Field, error) {\r\n\tf := field{\r\n\t\tx: x,\r\n\t\ty: y,\r\n\t\tlen: len,\r\n\t}\r\n\terr := f.Update(text)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\treturn &Field{f}, nil\r\n}", "func NewPosition(x int, y int, passedAt time.Time) *Position {\n\treturn &Position{\n\t\tX: x,\n\t\tY: y,\n\t\tPassedAt: &passedAt,\n\t\tCommon: Common{\n\t\t\tUID: \"_:\" + PositionUID,\n\t\t\tDType: []string{\"Position\"},\n\t\t\tCreatedAt: now(),\n\t\t},\n\t}\n}", "func NewGeoIPDB(name string, loader BlocklistLoader, geoDBFile string) (*GeoIPDB, error) {\n\tif geoDBFile == \"\" {\n\t\tgeoDBFile = \"/usr/share/GeoIP/GeoLite2-City.mmdb\"\n\t}\n\tgeoDB, err := maxminddb.Open(geoDBFile)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open geo location database file: %w\", err)\n\t}\n\n\trules, err := loader.Load()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdb := make(map[uint64]struct{})\n\tfor _, r := range rules {\n\t\tr = strings.TrimSpace(r)\n\t\tif strings.HasPrefix(r, \"#\") || r == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tr = strings.Split(r, \"#\")[0] // possible comment at the end of the line\n\t\tr = strings.TrimSpace(r)\n\t\tvalue, err := strconv.ParseUint(r, 10, 64) // GeoNames ID\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to parse geoname id in rule '%s': %w\", r, err)\n\t\t}\n\t\tdb[value] = struct{}{}\n\t}\n\treturn &GeoIPDB{\n\t\tname: name,\n\t\tgeoDB: geoDB,\n\t\tgeoDBFile: geoDBFile,\n\t\tdb: db,\n\t\tloader: loader,\n\t}, nil\n}", "func New(r bool, f *os.File) *Parse {\n\treturn &Parse{\n\t\tcomments: make(map[string]string),\n\t\tmappings: make(map[string][]field),\n\t\tembeds: make(map[string][]string),\n\t\tbaseMappings: make(map[string]field),\n\t\tFiles: []string{},\n\t\trecursive: r,\n\t\toutfile: f,\n\t}\n}", "func NewGeoPoint(lat float64, lng float64) GeoPoint {\n\treturn GeoPoint{lat: lat, lng: lng}\n}", "func (mc *MomentClient) NewLocation(lat float32, long float32) (l *Location) {\n\tif mc.err != nil {\n\t\treturn\n\t}\n\n\tl = new(Location)\n\n\tl.setLatitude(lat)\n\tl.setLongitude(long)\n\tif l.err != nil {\n\t\tError.Println(l.err)\n\t\tmc.err = l.err\n\t\treturn\n\t}\n\n\treturn\n}", "func ParseString(str string, algorithm geo.Algorithm) (*geo.GPX, error) {\n\treturn gxml.ParseBytes([]byte(str), algorithm)\n}", "func NewText(str string) *TextElement {\n\tt := TextElement(str)\n\treturn &t\n}", "func NewCountry(val string) CountryField {\n\treturn CountryField{quickfix.FIXString(val)}\n}", "func NewFromString(input string) Scanner {\n\ttoks := lexer.ParseString(input)\n\treturn &scanner{toks: toks}\n}", "func NewWithLocation(location *time.Location, pool *redis.Pool) *Cron {\n\treturn &Cron{\n\t\tentries: nil,\n\t\tadd: make(chan *Entry),\n\t\tstop: make(chan struct{}),\n\t\tsnapshot: make(chan []*Entry),\n\t\trunning: false,\n\t\tErrorLog: nil,\n\t\tlocation: location,\n\t\tpool: pool,\n\t\tkeyPrefix: DefaultKeyPrefix,\n\t\tkeyCleared: DefaultKeyCleared,\n\t}\n}", "func NewAddPosition(customer, user, password string) *AddPosition {\n\treturn &AddPosition{\n\t\tSoapEnv: \"http://schemas.xmlsoap.org/soap/envelope/\",\n\t\tTem: \"http://tempuri.org/\",\n\t\tCustomer: customer,\n\t\tUser: user,\n\t\tPassword: password,\n\t\tPositions: Positions{},\n\t}\n}", "func NewText(content string) *Element {\n\treturn &Element{\n\t\tType: TextType,\n\t\tContent: content,\n\t}\n}", "func NewTextMarker(pos s2.LatLng, text string) *TextMarker {\n\ts := new(TextMarker)\n\ts.Position = pos\n\ts.Text = text\n\ts.TipSize = 8.0\n\n\td := &font.Drawer{\n\t\tFace: basicfont.Face7x13,\n\t}\n\ts.TextWidth = float64(d.MeasureString(s.Text) >> 6)\n\ts.TextHeight = 13.0\n\treturn s\n}", "func New(possible []string, subsetSize []int) *ClosestMatch {\n\tcm := new(ClosestMatch)\n\tcm.SubstringSizes = subsetSize\n\tcm.SubstringToID = make(map[string]map[uint32]struct{})\n\tcm.ID = make(map[uint32]IDInfo)\n\tfor i, s := range possible {\n\t\tsubstrings := cm.splitWord(strings.ToLower(s))\n\t\tcm.ID[uint32(i)] = IDInfo{Key: s, NumSubstrings: len(substrings)}\n\t\tfor substring := range substrings {\n\t\t\tif _, ok := cm.SubstringToID[substring]; !ok {\n\t\t\t\tcm.SubstringToID[substring] = make(map[uint32]struct{})\n\t\t\t}\n\t\t\tcm.SubstringToID[substring][uint32(i)] = struct{}{}\n\t\t}\n\t}\n\n\treturn cm\n}", "func NewText(text string) *Text {\n\tt := &Text{\n\t\tBasicEntity: ecs.NewBasic(),\n\t\tButtonControlComponent: ButtonControlComponent{},\n\t\tMouseComponent: common.MouseComponent{},\n\t\tText: text,\n\t\tFont: &common.Font{\n\t\t\tURL: \"fonts/Undefined.ttf\",\n\t\t\tFG: color.White,\n\t\t\tBG: color.Transparent,\n\t\t\tSize: 14,\n\t\t},\n\t}\n\n\tt.Font.CreatePreloaded()\n\treturn t\n}", "func Parse(location string) (Location, error) {\n\tparts := strings.Split(location, \"-\")\n\tif len(parts) < 2 {\n\t\treturn Location{}, errors.New(\"invalid location\")\n\t}\n\tregion := strings.Join(parts[:2], \"-\")\n\tvar zone *string\n\tif len(parts) == 3 {\n\t\tzone = &parts[2]\n\t}\n\treturn Location{\n\t\tRegion: region,\n\t\tZone: zone,\n\t}, nil\n}", "func NewText(text string) *Text {\n\treturn &Text{text, css.NewCSS(), make(map[string]string)}\n}", "func LoadLocationFromTZData(name string, data []byte) (*Location, error) {}", "func GetLocalLongLat() (*LongLatResult, error) {\n url := fmt.Sprintf(\"https://www.googleapis.com/geolocation/v1/geolocate?key=%v\",GCreds.ApiKey)\n res, err := http.Post(url, \"text\", nil)\n if err != nil {\n return nil, fmt.Errorf(\"failed longlat google api call!: %v\",err)\n }\n defer res.Body.Close()\n body, err := ioutil.ReadAll(res.Body)\n //fmt.Println(string(body))\n var result LongLatResult\n err = json.Unmarshal(body, &result)\n if err != nil {\n return nil, fmt.Errorf(\"failed unmarshalling google longlat response: %v\",err)\n } else {\n return &result, nil\n }\n}" ]
[ "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.49743915", "0.49604514", "0.490832", "0.4906837", "0.4897851", "0.48960084", "0.48930925", "0.48930925", "0.48876098", "0.48646525", "0.4857685", "0.4848115", "0.48370108", "0.4826437", "0.48244467", "0.48230064", "0.48147917", "0.48101652", "0.48053876", "0.4789005", "0.47886184", "0.47606364", "0.47544715", "0.47437647", "0.47306034", "0.47302586", "0.47273117", "0.4726533", "0.4723759", "0.4720426", "0.47176492", "0.47074687", "0.47069347", "0.47064862", "0.47063905", "0.46941972", "0.46896225", "0.46755472", "0.46739277", "0.46618018", "0.46495122", "0.46433145", "0.4633347", "0.46315137", "0.46212712", "0.4605779", "0.45984095", "0.45979795", "0.45865563", "0.45773384", "0.45758417", "0.45617872", "0.45551196", "0.45400444", "0.45275855", "0.45267233", "0.45247537", "0.45169756", "0.45161095", "0.45106238", "0.44960824", "0.44927934", "0.44889587", "0.44879842", "0.44772905", "0.44719076", "0.4470222", "0.44663593", "0.4457704", "0.4452323", "0.44458637", "0.44453913", "0.4443863", "0.44421527", "0.44410607", "0.44398728", "0.44374782", "0.44361734", "0.44329628", "0.44265497" ]
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 located = \" +\n\t\t\"false\")\n\n\t// Check if no results\n\tif err == sql.ErrNoRows {\n\t\t// If not results, return raw error so we can identify\n\t\treturn locs, err\n\t} else if err != nil {\n\t\t// Other error\n\t\treturn locs, fmt.Errorf(\"error querying for unlocated GeoLocs\"+\n\t\t\t\": %s\", err.Error())\n\t}\n\n\t// Parse rows into GeoLocs\n\tfor rows.Next() {\n\t\t// Parse\n\t\tloc, err := NewUnlocatedGeoLoc(rows)\n\t\tif err != nil {\n\t\t\treturn locs, fmt.Errorf(\"error creating unlocated \"+\n\t\t\t\t\"GeoLoc from row: %s\", err.Error())\n\t\t}\n\n\t\t// Add to list\n\t\tlocs = append(locs, loc)\n\t}\n\n\t// Close\n\tif err = rows.Close(); err != nil {\n\t\treturn locs, fmt.Errorf(\"error closing query: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// Success\n\treturn locs, nil\n}", "func NewGeoLoc(raw string) *GeoLoc {\n\treturn &GeoLoc{\n\t\tLocated: false,\n\t\tRaw: raw,\n\t}\n}", "func (l *Location) FromRows(rows *sql.Rows) error {\n\tvar scanl struct {\n\t\tID int\n\t\tCreateTime sql.NullTime\n\t\tUpdateTime sql.NullTime\n\t\tName sql.NullString\n\t\tExternalID sql.NullString\n\t\tLatitude sql.NullFloat64\n\t\tLongitude sql.NullFloat64\n\t\tSiteSurveyNeeded sql.NullBool\n\t}\n\t// the order here should be the same as in the `location.Columns`.\n\tif err := rows.Scan(\n\t\t&scanl.ID,\n\t\t&scanl.CreateTime,\n\t\t&scanl.UpdateTime,\n\t\t&scanl.Name,\n\t\t&scanl.ExternalID,\n\t\t&scanl.Latitude,\n\t\t&scanl.Longitude,\n\t\t&scanl.SiteSurveyNeeded,\n\t); err != nil {\n\t\treturn err\n\t}\n\tl.ID = strconv.Itoa(scanl.ID)\n\tl.CreateTime = scanl.CreateTime.Time\n\tl.UpdateTime = scanl.UpdateTime.Time\n\tl.Name = scanl.Name.String\n\tl.ExternalID = scanl.ExternalID.String\n\tl.Latitude = scanl.Latitude.Float64\n\tl.Longitude = scanl.Longitude.Float64\n\tl.SiteSurveyNeeded = scanl.SiteSurveyNeeded.Bool\n\treturn nil\n}", "func NewLocation(row int, col int) (Location, error) {\n\tif row >= 0 && row <= 7 && col >= 0 && col <= 7 {\n\t\treturn Location{\n\t\t\trow: row,\n\t\t\tcol: col,\n\t\t}, nil\n\t}\n\treturn Location{}, errors.New(\"invalid row/col\")\n}", "func New(latitude float64, longitude float64) *LocTask {\n\treturn &LocTask{location: NewLocation(latitude, longitude), cronSch: cron.New()}\n}", "func newLocation(lat, long coordinate) *location {\n\treturn &location{lat.decimal(), long.decimal()}\n}", "func LocationClean() {\n\trows, err := db.Query(\"SELECT gid FROM locations WHERE loc != POINTFROMTEXT(?) AND upTime < DATE_SUB(UTC_TIMESTAMP(), INTERVAL 3 HOUR)\", \"POINT(0 0)\")\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\n\tvar gid GoogleID\n\tfor rows.Next() {\n\t\tif err = rows.Scan(&gid); err != nil {\n\t\t\tlog.Error(err)\n\t\t\tcontinue\n\t\t}\n\t\tif _, err = db.Exec(\"UPDATE locations SET loc = POINTFROMTEXT(?), upTime = UTC_TIMESTAMP() WHERE gid = ?\", \"POINT(0 0)\", gid); err != nil {\n\t\t\tlog.Error(err)\n\t\t\tcontinue\n\t\t}\n\t}\n}", "func (l *GeoLoc) Query() error {\n\t// Get db instance\n\tdb, err := dstore.NewDB()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error retrieving db instance: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// Query\n\trow := db.QueryRow(\"SELECT id FROM geo_locs WHERE raw = $1\", l.Raw)\n\n\t// Get ID\n\terr = row.Scan(&l.ID)\n\n\t// Check if row found\n\tif err == sql.ErrNoRows {\n\t\t// If not, return so we can identify\n\t\treturn err\n\t} else if err != nil {\n\t\treturn fmt.Errorf(\"error reading GeoLoc ID from row: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// Success\n\treturn nil\n}", "func (l *GeoLoc) Insert() error {\n\t// Get db instance\n\tdb, err := dstore.NewDB()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error retrieving DB instance: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// Insert\n\tvar row *sql.Row\n\n\t// Check if GeoLoc has been parsed\n\tif l.Located {\n\t\t// Check accuracy value\n\t\tif l.Accuracy == AccuracyErr {\n\t\t\treturn fmt.Errorf(\"invalid accuracy value: %s\",\n\t\t\t\tl.Accuracy)\n\t\t}\n\n\t\t// If so, save all fields\n\t\trow = db.QueryRow(\"INSERT INTO geo_locs (located, gapi_success\"+\n\t\t\t\", lat, long, postal_addr, accuracy, bounds_provided, \"+\n\t\t\t\"bounds_id, viewport_bounds_id, gapi_place_id, raw) \"+\n\t\t\t\"VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) \"+\n\t\t\t\"RETURNING id\",\n\t\t\tl.Located, l.GAPISuccess, l.Lat, l.Long, l.PostalAddr,\n\t\t\tl.Accuracy, l.BoundsProvided, l.BoundsID,\n\t\t\tl.ViewportBoundsID, l.GAPIPlaceID, l.Raw)\n\t} else {\n\t\t// If not, only save a couple, and leave rest null\n\t\trow = db.QueryRow(\"INSERT INTO geo_locs (located, raw) VALUES\"+\n\t\t\t\" ($1, $2) RETURNING id\",\n\t\t\tl.Located, l.Raw)\n\t}\n\n\t// Get inserted row ID\n\terr = row.Scan(&l.ID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error inserting row, Located: %t, err: %s\",\n\t\t\tl.Located, err.Error())\n\t}\n\n\treturn nil\n}", "func NewLocation(latitude, longitude, driverID int) Location {\n\treturn &Coordinates{\n\t\tLatitude: latitude,\n\t\tLongitude: longitude,\n\t\tDriverID: driverID,\n\t}\n}", "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_locs SET located = $1, raw = \"+\n\t\t\t\"$2 WHERE raw = $2 RETURNING id\", l.Located, l.Raw)\n\t} else {\n\t\t// Check accuracy value\n\t\tif l.Accuracy == AccuracyErr {\n\t\t\treturn fmt.Errorf(\"invalid accuracy value: %s\",\n\t\t\t\tl.Accuracy)\n\t\t}\n\t\t// If located\n\t\trow = db.QueryRow(\"UPDATE geo_locs SET located = $1, \"+\n\t\t\t\"gapi_success = $2, lat = $3, long = $4, \"+\n\t\t\t\"postal_addr = $5, accuracy = $6, bounds_provided = $7,\"+\n\t\t\t\"bounds_id = $8, viewport_bounds_id = $9, \"+\n\t\t\t\"gapi_place_id = $10, raw = $11 WHERE raw = $11 \"+\n\t\t\t\"RETURNING id\",\n\t\t\tl.Located, l.GAPISuccess, l.Lat, l.Long, l.PostalAddr,\n\t\t\tl.Accuracy, l.BoundsProvided, l.BoundsID,\n\t\t\tl.ViewportBoundsID, l.GAPIPlaceID, l.Raw)\n\t}\n\n\t// Set ID\n\terr = row.Scan(&l.ID)\n\n\t// If doesn't exist\n\tif err == sql.ErrNoRows {\n\t\t// Return error so we can identify\n\t\treturn err\n\t} else if err != nil {\n\t\t// Other error\n\t\treturn fmt.Errorf(\"error updating GeoLoc, located: %t, err: %s\",\n\t\t\tl.Located, err.Error())\n\t}\n\n\t// Success\n\treturn nil\n}", "func NewLocation(p Point, data []byte) *Location {\n\treturn &Location{p, data}\n}", "func (l *Locations) FromRows(rows *sql.Rows) error {\n\tfor rows.Next() {\n\t\tscanl := &Location{}\n\t\tif err := scanl.FromRows(rows); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*l = append(*l, scanl)\n\t}\n\treturn nil\n}", "func Loc(row int, col int) Location {\n\treturn Location{Row: row, Col: col}\n}", "func (s *internalPointPtrView) New() (PointPtr, error) {\n\tslice, allocErr := s.state.makeSlice(1)\n\tif allocErr != nil {\n\t\treturn PointPtr{}, allocErr\n\t}\n\tptr := PointPtr{ptr: slice.data}\n\treturn ptr, nil\n}", "func (s StaticInfoExtn_GeoInfo) NewLocations(n int32) (StaticInfoExtn_GeoInfo_Location_List, error) {\n\tl, err := NewStaticInfoExtn_GeoInfo_Location_List(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn StaticInfoExtn_GeoInfo_Location_List{}, err\n\t}\n\terr = s.Struct.SetPtr(0, l.List.ToPtr())\n\treturn l, err\n}", "func NewLocation(text []byte, file string, row int, col int) *Location {\n\treturn location.NewLocation(text, file, row, col)\n}", "func NewCreateLocationUnprocessableEntity() *CreateLocationUnprocessableEntity {\n\treturn &CreateLocationUnprocessableEntity{}\n}", "func (mc *MomentClient) NewLocation(lat float32, long float32) (l *Location) {\n\tif mc.err != nil {\n\t\treturn\n\t}\n\n\tl = new(Location)\n\n\tl.setLatitude(lat)\n\tl.setLongitude(long)\n\tif l.err != nil {\n\t\tError.Println(l.err)\n\t\tmc.err = l.err\n\t\treturn\n\t}\n\n\treturn\n}", "func Get_latitude(ipaddress string) IP2Locationrecord {\n\treturn handleError(defaultDB.query(ipaddress, latitude))\n}", "func NewLocation(x int, y int, z int, world string) *Location {\n\treturn &Location{\n\t\tX: x,\n\t\tY: y,\n\t\tZ: z,\n\t\tWorld: world,\n\t}\n}", "func NewLastLocSingleTruck(core utils.QueryGenerator) utils.QueryFiller {\n\treturn &LastLocSingleTruck{\n\t\tcore: core,\n\t}\n}", "func (db *merkleDB) newUntrackedView(batchOps []database.BatchOp) (*trieView, error) {\n\tif db.closed {\n\t\treturn nil, database.ErrClosed\n\t}\n\n\tnewView, err := newTrieView(db, db, db.root.clone(), batchOps)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn newView, nil\n}", "func (s *InventoryApiService) NewLocation(location Location, w http.ResponseWriter) error {\n\tif location.Name == \"\" {\n\t\treturn requiredFieldMissing(\"name\", w)\n\t}\n\tif location.Warehouse == \"\" {\n\t\treturn requiredFieldMissing(\"warehouse\", w)\n\t}\n\n\tctx := context.Background()\n\tr, err := s.db.NewLocation(ctx, &location)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstatus := http.StatusCreated\n\treturn EncodeJSONResponse(r, &status, w)\n}", "func NewCreateLocationUnauthorized() *CreateLocationUnauthorized {\n\treturn &CreateLocationUnauthorized{}\n}", "func NewGeoIP(filePath string) (*GeoIP, error) {\n\t// 判断文件是否存在\n\t_, err := os.Stat(filePath)\n\tif err != nil && os.IsNotExist(err) {\n\t\tlog.Println(\"文件不存在,请自行下载 Geoip2 City库,并保存在\", filePath)\n\t\treturn nil, err\n\t} else {\n\t\tdb, err := geoip2.Open(filePath)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\treturn &GeoIP{db: db}, nil\n\t}\n}", "func (dao *LocationDAO) GetPickupLocation(pul_id string) (models.PickupLocation, error) {\n\tvar c models.PickupLocation\n\n\terr := dao.DB.Get(&c,\n\t\t`SELECT pul_id, pul_type, pul_display_name, pul_current_cars\n\t\tFROM pickup_locations\n WHERE pul_id = $1;`, pul_id)\n\treturn c, err\n}", "func NewGeoLocationCmd(q *redis.GeoRadiusQuery, args ...interface{}) *redis.GeoLocationCmd {\n\treturn redis.NewGeoLocationCmd(q, args...)\n}", "func (g grid) getRandomUnoccupiedPixel() (position, error) {\n\tif g.isCompletelyOccupied() {\n\t\treturn position{}, errors.New(\"grid is completely occupied\")\n\t}\n\n\tseed := rand.NewSource(time.Now().UnixNano())\n\tgen := rand.New(seed)\n\n\tx := gen.Intn(g.width)\n\ty := gen.Intn(g.height)\n\n\t// if pixel is not occupied\n\tif !g.g[y][x] {\n\t\treturn position{x, y}, nil\n\t} else {\n\t\treturn g.getRandomUnoccupiedPixel()\n\t}\n}", "func (dao *LocationDAO) CreatePickupLocation(c models.PickupLocation) (models.PickupLocation, error) {\n\trows, err := dao.DB.NamedQuery(\n\t\t`INSERT INTO pickup_locations (pul_type, pul_display_name, pul_current_cars)\n VALUES (:pul_type, :pul_display_name, :pul_current_cars)\n RETURNING pul_id`,\n\t\tc)\n\tif err != nil {\n\t\treturn c, err\n\t}\n\tid, err := extractLastInsertId(rows)\n\tc.Id = id\n\treturn c, err\n}", "func NewLocation(id uid.UID, name, desc string, cmdCh chan *Command, moveCh chan ThingMove) *Location {\n\treturn &Location{\n\t\tThing: NewThing(id, name, desc, Aliases{}),\n\t\tmoveCh: moveCh,\n\t\tcmdCh: cmdCh,\n\t}\n}", "func (l *Location) Unwrap() *Location {\n\ttx, ok := l.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Location is not a transactional entity\")\n\t}\n\tl.config.driver = tx.drv\n\treturn l\n}", "func (l *Location) Unwrap() *Location {\n\ttx, ok := l.config.driver.(*txDriver)\n\tif !ok {\n\t\tpanic(\"ent: Location is not a transactional entity\")\n\t}\n\tl.config.driver = tx.drv\n\treturn l\n}", "func main() {\n\ta := Gps4dLoc{}\n\ta.Lati = 23.333\n\ta.Long = 123.3333\n\n\tugi := UserGpsInfo{}\n\tugi.CurrentLoc.Lati = 12.3\n\tugi.CurrentLoc.Long = 123.333\n\ttestloc := Gps2dLoc{12.3, 22.3}\n\n\tif ugi.CameraLoc.Loc == nil {\n\t\tfmt.Println(\"cameraloc is nil\")\n\t\tfmt.Println(ugi.CameraLoc)\n\t\tugi.CameraLoc.Loc = append(ugi.CameraLoc.Loc, testloc)\n\t\tfmt.Println(len(ugi.CameraLoc.Loc))\n\t\tfmt.Println(\"shoelati\", ugi.CameraLoc.Loc[0].Lati)\n\t} else {\n\t\tfmt.Println(\"shoelati\", ugi.CameraLoc.Loc[0].Lati)\n\t}\n\n\tif ugi.CreateLoc.Timestamp == 0 {\n\t\tfmt.Println(\"create loc is nil\")\n\t}\n\n}", "func NewPoint(latitude float64, longitude float64) *Point {\n return &Point{latitude: latitude, longitude: longitude}\n}", "func (lq *LocationQuery) Clone() *LocationQuery {\n\treturn &LocationQuery{\n\t\tconfig: lq.config,\n\t\tlimit: lq.limit,\n\t\toffset: lq.offset,\n\t\torder: append([]Order{}, lq.order...),\n\t\tunique: append([]string{}, lq.unique...),\n\t\tpredicates: append([]predicate.Location{}, lq.predicates...),\n\t\t// clone intermediate query.\n\t\tsql: lq.sql.Clone(),\n\t}\n}", "func LoadNpcLocations() {\n\tctx := context.Background()\n\trows, err := DefaultEntityService.sqlOpen(config.WorldDB()).QueryContext(ctx, \"SELECT id, startX, minX, maxX, startY, minY, maxY FROM npc_locations\")\n\tif err != nil {\n\t\tlog.Warn(\"Couldn't load SQLite3 database:\", err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tvar id, startX, minX, maxX, startY, minY, maxY int\n\tfor rows.Next() {\n\t\trows.Scan(&id, &startX, &minX, &maxX, &startY, &minY, &maxY)\n\t\tworld.AddNpc(world.NewNpc(id, startX, startY, minX, maxX, minY, maxY))\n\t}\n}", "func (m *Map) FromLocation(loc Location) (Row, Col int) {\n\tRow = int(loc) / m.Cols\n\tCol = int(loc) % m.Cols\n\treturn\n}", "func Get_longitude(ipaddress string) IP2Locationrecord {\n\treturn handleError(defaultDB.query(ipaddress, longitude))\n}", "func NewNoRowsAffected(sql string) error {\n\treturn NoRowsAffected{sql: sql}\n}", "func (d *DB) Get_latitude(ipaddress string) (IP2Locationrecord, error) {\n\treturn d.query(ipaddress, latitude)\n}", "func (scsuo *SurveyCellScanUpdateOne) ClearLocation() *SurveyCellScanUpdateOne {\n\tscsuo.clearedLocation = true\n\treturn scsuo\n}", "func LoadNpcLocations() {\n\tnpcCounter := 0\n\tdatabase := Open(config.WorldDB())\n\tdefer database.Close()\n\trows, err := database.Query(\"SELECT `id`, `startX`, `minX`, `maxX`, `startY`, `minY`, `maxY` FROM `npc_locations`\")\n\tif err != nil {\n\t\tlog.Error.Println(\"Couldn't load SQLite3 database:\", err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tvar id, startX, minX, maxX, startY, minY, maxY int\n\tfor rows.Next() {\n\t\trows.Scan(&id, &startX, &minX, &maxX, &startY, &minY, &maxY)\n\t\tnpcCounter++\n\t\tworld.AddNpc(world.NewNpc(id, startX, startY, minX, maxX, minY, maxY))\n\t}\n}", "func (g *DB) Lookup(ip net.IP) (*GeoIP, error) {\n\tif ip == nil {\n\t\treturn nil, fmt.Errorf(\"ip is nil\")\n\t}\n\n\tg.mutex.Lock()\n\tdefer g.mutex.Unlock()\n\n\tres := &GeoIP{\n\t\tIP: ip,\n\t}\n\n\t// ANONYMOUS IP\n\t//\n\tanon, err := g.reader.AnonymousIP(ip)\n\tif err == nil {\n\t\tres.Anonymous = Anonymous{\n\t\t\tIsAnonymous: anon.IsAnonymous,\n\t\t\tIsAnonymousVPN: anon.IsAnonymousVPN,\n\t\t\tIsHostingProvider: anon.IsHostingProvider,\n\t\t\tIsPublicProxy: anon.IsPublicProxy,\n\t\t\tIsTorExitNode: anon.IsTorExitNode,\n\t\t}\n\t}\n\n\t// CITY\n\t//\n\tcity, err := g.reader.City(ip)\n\tif err == nil {\n\t\tsubdivisions := make([]string, len(city.Subdivisions), len(city.Subdivisions))\n\t\tfor i, sd := range city.Subdivisions {\n\t\t\tsubdivisions[i] = sd.Names[\"en\"]\n\t\t}\n\n\t\tres.City = City{\n\t\t\tAccuracyRadius: city.Location.AccuracyRadius,\n\t\t\tContinent: city.Continent.Names[\"en\"],\n\t\t\tContinentCode: city.Continent.Code,\n\t\t\tCountry: city.Country.Names[\"en\"],\n\t\t\tCountryCode: city.Country.IsoCode,\n\t\t\tIsAnonymousProxy: city.Traits.IsAnonymousProxy,\n\t\t\tIsSatelliteProvider: city.Traits.IsSatelliteProvider,\n\t\t\tLatitude: city.Location.Latitude,\n\t\t\tLongitude: city.Location.Longitude,\n\t\t\tMetroCode: city.Location.MetroCode,\n\t\t\tName: city.City.Names[\"en\"],\n\t\t\tPostcode: city.Postal.Code,\n\t\t\tRegisteredCountry: city.RegisteredCountry.Names[\"en\"],\n\t\t\tRegisteredCountryCode: city.RegisteredCountry.IsoCode,\n\t\t\tRepresentedCountry: city.RepresentedCountry.Names[\"en\"],\n\t\t\tRepresentedCountryCode: city.RepresentedCountry.IsoCode,\n\t\t\tRepresentedCountryType: city.RepresentedCountry.Type,\n\t\t\tSubdivisions: subdivisions,\n\t\t\tTimezone: city.Location.TimeZone,\n\t\t}\n\t} else {\n\t\treturn nil, fmt.Errorf(\"failed to load city data for %s\", ip)\n\t}\n\n\t// COUNTRY\n\t//\n\tcountry, err := g.reader.Country(ip)\n\tif err == nil {\n\t\tres.Country = Country{\n\t\t\tContinent: country.Continent.Names[\"en\"],\n\t\t\tContinentCode: country.Continent.Code,\n\t\t\tCountry: country.Country.Names[\"en\"],\n\t\t\tCountryCode: country.Country.IsoCode,\n\t\t\tIsAnonymousProxy: country.Traits.IsAnonymousProxy,\n\t\t\tIsSatelliteProvider: country.Traits.IsSatelliteProvider,\n\t\t\tRegisteredCountry: country.RegisteredCountry.Names[\"en\"],\n\t\t\tRegisteredCountryCode: country.RegisteredCountry.IsoCode,\n\t\t\tRepresentedCountry: country.RepresentedCountry.Names[\"en\"],\n\t\t\tRepresentedCountryCode: country.RepresentedCountry.IsoCode,\n\t\t\tRepresentedCountryType: country.RepresentedCountry.Type,\n\t\t}\n\t} else {\n\t\treturn nil, fmt.Errorf(\"failed to load country data for %s\", ip)\n\t}\n\n\treturn res, nil\n}", "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 = sanitize.SingleLineString(row.LocationHash)\n\n\t// Validate LocationHash.\n\tif err := validate.NonEmptyString(row.LocationHash); err != nil {\n\t\te := err.(errors.Error)\n\t\treturn e.Wrap(\"Validation failed on LocationHash.\")\n\t}\n\n\t// Sanitize LocationString.\n\trow.LocationString = sanitize.SingleLineString(row.LocationString)\n\n\t// Validate LocationString.\n\tif err := validate.NonEmptyString(row.LocationString); err != nil {\n\t\te := err.(errors.Error)\n\t\treturn e.Wrap(\"Validation failed on LocationString.\")\n\t}\n\n\t// Execute query.\n\t_, err = db.Exec(insertQuery_Location,\n\t\trow.DatasetID,\n\t\trow.LocationHash,\n\t\trow.LocationString,\n\t\trow.ParsedCountryCode,\n\t\trow.ParsedPostalCode,\n\t\trow.GeonamesPostalCodes,\n\t\trow.GeonameID,\n\t\trow.GeonamesHierarchy,\n\t\trow.Approved,\n\t\trow.CreatedAt)\n\n\tif err == nil {\n\t\treturn nil\n\t}\n\n\tif err := translateDBError(err); err != nil {\n\t\treturn err\n\t}\n\n\treturn errors.Unexpected.\n\t\tWrap(\"Location.Insert failed: %w\", err).\n\t\tAlert()\n}", "func tryAndGetTheLocationFromARoom(lo *LocationInfo) *db.Loc {\n\tbaseURL, err := url.Parse(\"https://www.kent.ac.uk/timetabling/rooms/room.html\")\n\tif err != nil {\n\t\treturn nil\n\t}\n\t// Prepare Query Parameters\n\tparams := url.Values{}\n\tparams.Add(\"room\", lo.ID)\n\n\t// Add Query Parameters to the URL\n\tbaseURL.RawQuery = params.Encode() // Escape Query Parameters\n\n\t// Get the timetable html page\n\tresp, err := http.Get(baseURL.String())\n\tif err != nil {\n\t\treturn nil\n\t}\n\tdefer resp.Body.Close()\n\tbody, readErr := ioutil.ReadAll(resp.Body)\n\tif readErr != nil {\n\t\treturn nil\n\t}\n\n\t// Get the google maps url from this page\n\tre := regexp.MustCompile(`https:\\/\\/maps\\.google\\.co\\.uk\\/maps[^\"]*`)\n\tresult := re.Find(body)\n\tif result == nil {\n\t\treturn nil\n\t}\n\n\t// Get the query params from the google maps url, we are looking for \"ll\"\n\tu, err := url.Parse(string(result))\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tqueries := u.Query()\n\tll := queries.Get(\"ll\")\n\tls := strings.Split(ll, \",\")\n\tlat, err := strconv.ParseFloat(ls[0], 64)\n\tif err != nil {\n\t\treturn nil\n\t}\n\tlon, err := strconv.ParseFloat(ls[1], 64)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tg := &db.Loc{\n\t\tType: \"Point\",\n\t\tCoords: []float64{lon, lat},\n\t}\n\n\t// g := geom.NewPointFlat(geom.XY, []float64{lat, lon})\n\n\t// Finally, if nothing has failed, then return the coordinates\n\treturn g\n}", "func NewMockQueryCoord(t interface {\n\tmock.TestingT\n\tCleanup(func())\n}) *MockQueryCoord {\n\tmock := &MockQueryCoord{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "func NewNamedLocation()(*NamedLocation) {\n m := &NamedLocation{\n Entity: *NewEntity(),\n }\n return m\n}", "func NewRawMapper(sh *Shard, stmt *influxql.SelectStatement) *RawMapper {\n\treturn &RawMapper{\n\t\tshard: sh,\n\t\tstmt: stmt,\n\t}\n}", "func (scsu *SurveyCellScanUpdate) ClearLocation() *SurveyCellScanUpdate {\n\tscsu.clearedLocation = true\n\treturn scsu\n}", "func (address *Address) GetLocation() *Location {\n\n // Just return a dummy for STUB\n\n return &Location{0,0}\n}", "func (s PathMetadata) NewAsLocations(n int32) (PathMetadata_Geo_List, error) {\n\tl, err := NewPathMetadata_Geo_List(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn PathMetadata_Geo_List{}, err\n\t}\n\terr = s.Struct.SetPtr(1, l.List.ToPtr())\n\treturn l, err\n}", "func NewLocation(s *Store, lat, lng float64) Location {\n\treturn Location{\n\t\tKey: s.Key,\n\t\tLat: lat,\n\t\tLng: lng,\n\t}\n}", "func (euo *EquipmentUpdateOne) ClearLocation() *EquipmentUpdateOne {\n\teuo.clearedLocation = true\n\treturn euo\n}", "func (s StaticInfoExtn_GeoInfo_Location) NewGpsData() (StaticInfoExtn_GeoInfo_Location_Coordinates, error) {\n\tss, err := NewStaticInfoExtn_GeoInfo_Location_Coordinates(s.Struct.Segment())\n\tif err != nil {\n\t\treturn StaticInfoExtn_GeoInfo_Location_Coordinates{}, err\n\t}\n\terr = s.Struct.SetPtr(0, ss.Struct.ToPtr())\n\treturn ss, err\n}", "func Ul(tileid TileID) Point {\n\tn := math.Pow(2.0, float64(tileid.Z))\n\tlon_deg := float64(tileid.X)/n*360.0 - 180.0\n\tlat_rad := math.Atan(math.Sinh(math.Pi * (1 - 2*float64(tileid.Y)/n)))\n\tlat_deg := (180.0 / math.Pi) * lat_rad\n\treturn Point{lon_deg, lat_deg}\n}", "func GetLocalLongLat() (*LongLatResult, error) {\n url := fmt.Sprintf(\"https://www.googleapis.com/geolocation/v1/geolocate?key=%v\",GCreds.ApiKey)\n res, err := http.Post(url, \"text\", nil)\n if err != nil {\n return nil, fmt.Errorf(\"failed longlat google api call!: %v\",err)\n }\n defer res.Body.Close()\n body, err := ioutil.ReadAll(res.Body)\n //fmt.Println(string(body))\n var result LongLatResult\n err = json.Unmarshal(body, &result)\n if err != nil {\n return nil, fmt.Errorf(\"failed unmarshalling google longlat response: %v\",err)\n } else {\n return &result, nil\n }\n}", "func NewLocation(latitude, longitude float64) Location {\n\tl := new(Location)\n\tl.Latitude = latitude\n\tl.Longitude = longitude\n\treturn *l\n}", "func (scsuo *SurveyCellScanUpdateOne) ClearLongitude() *SurveyCellScanUpdateOne {\n\tscsuo.longitude = nil\n\tscsuo.clearlongitude = true\n\treturn scsuo\n}", "func NewAllTimezonesNotFound() *AllTimezonesNotFound {\n return &AllTimezonesNotFound{\n }\n}", "func (this *Row_UServ_SelectUserById) Unwrap(pointerToMsg proto.Message) error {\n\tif this.err != nil {\n\t\treturn this.err\n\t}\n\tif o, ok := (pointerToMsg).(*User); ok {\n\t\tif o == nil {\n\t\t\treturn fmt.Errorf(\"must initialize *User before giving to Unwrap()\")\n\t\t}\n\t\tres, _ := this.User()\n\t\t_ = res\n\t\to.Id = res.Id\n\t\to.Name = res.Name\n\t\to.Friends = res.Friends\n\t\to.CreatedOn = res.CreatedOn\n\t\to.Id2 = res.Id2\n\t\to.Counts = res.Counts\n\t\treturn nil\n\t}\n\n\tif o, ok := (pointerToMsg).(*User); ok {\n\t\tif o == nil {\n\t\t\treturn fmt.Errorf(\"must initialize *User before giving to Unwrap()\")\n\t\t}\n\t\tres, _ := this.User()\n\t\t_ = res\n\t\to.Id = res.Id\n\t\to.Name = res.Name\n\t\to.Friends = res.Friends\n\t\to.CreatedOn = res.CreatedOn\n\t\to.Id2 = res.Id2\n\t\to.Counts = res.Counts\n\t\treturn nil\n\t}\n\n\treturn nil\n}", "func New(latitude, longitude float64, name string) *Place {\n\treturn &Place{saneAngle(0, latitude), saneAngle(0, longitude), name}\n}", "func (l Location) Locate() Location {\n\treturn l\n}", "func (o *NewData) GetLocationOk() (*Location, bool) {\n\tif o == nil || o.Location == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Location, true\n}", "func LongitudeIsNil() predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.IsNull(s.C(FieldLongitude)))\n\t})\n}", "func LatitudeIsNil() predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.IsNull(s.C(FieldLatitude)))\n\t})\n}", "func NewPoint(lat, lng float64) Location {\r\n\treturn Location{\r\n\t\t\"Point\",\r\n\t\t[]float64{lng, lat},\r\n\t}\r\n}", "func (c *Client) Location(ip string) (*Location, error) {\n\tbody, err := c.getbody(\"geo\", ip)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tl := &Location{}\n\tif err := json.Unmarshal(body, l); err != nil {\n\t\treturn nil, err\n\t}\n\treturn l, nil\n}", "func (db *geoDB) location(ip string) *geoLocation {\n\tlocation := db.lookup(net.ParseIP(ip))\n\treturn &geoLocation{\n\t\tCountry: location.Country.Names.English,\n\t\tCity: location.City.Names.English,\n\t\tLatitude: location.Location.Latitude,\n\t\tLongitude: location.Location.Longitude,\n\t}\n}", "func FetchLocationWeather(cityName string) (QueryResult, error) {\n\tquery := `\n\t\tselect\n\t\t\tid,\n\t\t\tcity_name,\n\t\t\tquery_count,\n\t\t\tlocation_id,\n\t\t\tlabels,\n\t\t\ttemp_high,\n\t\t\ttemp_low,\n\t\t\tat_time\n\t\tfrom\n\t\t\tlocations, weather\n\t\twhere\n\t\t\tcity_name = $1\n\t\t\tand at_time = (select max(at_time) from weather)`\n\n\tlr := &LocationRow{}\n\twr := &WeatherRow{}\n\n\trow := GlobalConn.QueryRow(query, cityName)\n\n\tswitch err := row.Scan(\n\t\t&lr.ID,\n\t\t&lr.CityName,\n\t\t&lr.QueryCount,\n\t\t&wr.LocationRowID,\n\t\t&wr.Labels,\n\t\t&wr.TempHigh,\n\t\t&wr.TempLow,\n\t\t&wr.AtTime); err {\n\tcase sql.ErrNoRows:\n\t\treturn nil, nil\n\tcase err:\n\t\treturn nil, err\n\tdefault:\n\t\treturn QueryResult{\n\t\t\t\"location\": lr,\n\t\t\t\"weather\": wr,\n\t\t}, nil\n\t}\n}", "func (mc *MomentClient) NewMomentsRow(l *Location, uID string, p bool, h bool, c *time.Time) (m *MomentsRow) {\n\tif mc.err != nil {\n\t\treturn\n\t}\n\n\tm = new(MomentsRow)\n\n\tm.setLocation(l)\n\tm.setCreateDate(c)\n\tm.setUserID(uID)\n\tif m.err != nil {\n\t\tError.Println(m.err)\n\t\tmc.err = m.err\n\t\treturn\n\t}\n\n\tm.hidden = h\n\tm.public = p\n\tif m.hidden && !m.public {\n\t\tError.Println(ErrorPrivateHiddenMoment)\n\t\tmc.err = ErrorPrivateHiddenMoment\n\t\treturn\n\t}\n\n\treturn\n}", "func NewLocation(vs byte) *Location {\n\treturn &Location{\n\t\tstyle: vs,\n\t\tparsed: false,\n\t}\n}", "func NewUnknown(pool Pooler, name string) *Unknown {\n\treturn &Unknown{newCommand(pool, name)}\n}", "func (eu *EquipmentUpdate) ClearLocation() *EquipmentUpdate {\n\teu.clearedLocation = true\n\treturn eu\n}", "func (sys *System) newLocation(ctx *Context, name string) (*Location, error) {\n\n\tstorage, err := sys.ensureStorage(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar state State\n\tif sys.config.UnindexedState {\n\t\tLog(INFO, ctx, \"System.newLocation\", \"stateType\", \"linear\")\n\t\tstate, err = NewLinearState(ctx, name, storage)\n\t} else {\n\t\tLog(INFO, ctx, \"System.newLocation\", \"stateType\", \"indexed\")\n\t\tstate, err = NewIndexedState(ctx, name, storage)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcron.AddHooks(ctx, sys.cron, state)\n\n\tloc, err := NewLocation(ctx, name, state, sys.LocControl(ctx, name))\n\tif err != nil {\n\t\tLog(ERROR, ctx, \"System.newLocation\", \"error\", err)\n\t\treturn nil, err\n\t}\n\n\tloc.Provider = sys\n\n\treturn loc, nil\n}", "func (scsu *SurveyCellScanUpdate) ClearLongitude() *SurveyCellScanUpdate {\n\tscsu.longitude = nil\n\tscsu.clearlongitude = true\n\treturn scsu\n}", "func (pool *ComplexPool) New() (Proxy, error) {\n\tlength := pool.SizeUnused()\n\n\tif length == 0 {\n\t\tif !pool.Config.ReloadWhenEmpty {\n\t\t\treturn Proxy{}, fmt.Errorf(\"prox (%p): cannot select proxy, no unused proxies left in pool\", pool)\n\t\t}\n\n\t\terr := pool.Load()\n\t\tif err != nil {\n\t\t\treturn Proxy{}, fmt.Errorf(\"prox (%p): cannot select unused proxy, error occurred while reloading pool: %v\", pool, err)\n\t\t}\n\n\t\tlength = pool.SizeUnused()\n\t\tif length == 0 {\n\t\t\treturn Proxy{}, fmt.Errorf(\"prox (%p): cannot select proxy, no unused proxies even after reload\", pool)\n\t\t}\n\t}\n\n\trawProxy := pool.Unused.Random()\n\tpool.Unused.Remove(rawProxy)\n\n\treturn *CastProxy(rawProxy), nil\n}", "func (i InputInlineQueryResultLocation) construct() InputInlineQueryResultClass { return &i }", "func (oupq *OrgUnitPositionQuery) Clone() *OrgUnitPositionQuery {\n\tif oupq == nil {\n\t\treturn nil\n\t}\n\treturn &OrgUnitPositionQuery{\n\t\tconfig: oupq.config,\n\t\tlimit: oupq.limit,\n\t\toffset: oupq.offset,\n\t\torder: append([]OrderFunc{}, oupq.order...),\n\t\tpredicates: append([]predicate.OrgUnitPosition{}, oupq.predicates...),\n\t\twithCreateBy: oupq.withCreateBy.Clone(),\n\t\twithUpdateBy: oupq.withUpdateBy.Clone(),\n\t\twithBelongToOrgUnitMembers: oupq.withBelongToOrgUnitMembers.Clone(),\n\t\twithBelongToOrgUnit: oupq.withBelongToOrgUnit.Clone(),\n\t\t// clone intermediate query.\n\t\tsql: oupq.sql.Clone(),\n\t\tpath: oupq.path,\n\t}\n}", "func NewWithLocation(location *time.Location, pool *redis.Pool) *Cron {\n\treturn &Cron{\n\t\tentries: nil,\n\t\tadd: make(chan *Entry),\n\t\tstop: make(chan struct{}),\n\t\tsnapshot: make(chan []*Entry),\n\t\trunning: false,\n\t\tErrorLog: nil,\n\t\tlocation: location,\n\t\tpool: pool,\n\t\tkeyPrefix: DefaultKeyPrefix,\n\t\tkeyCleared: DefaultKeyCleared,\n\t}\n}", "func New(server io.Server, registry packages.Registry) packages.ApplicationPackageHandler {\n\treturn &GeolocationPackage{\n\t\tserver: server,\n\t\tregistry: registry,\n\t}\n}", "func (u *User) GetLocation(tx *pop.Connection) (*Location, error) {\n\tif !u.LocationID.Valid {\n\t\treturn nil, nil\n\t}\n\tlocation := Location{}\n\tif err := tx.Find(&location, u.LocationID); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &location, nil\n}", "func MustLoadLoc(tz TimeZone) *time.Location {\n\tloc, err := time.LoadLocation(string(tz))\n\tif err != nil {\n\t\tlog.Fatalf(\"bad location %q: %v\\n\", tz, err)\n\t}\n\treturn loc\n}", "func UpdateCachedLocationWeather(cityName string, tempMin, tempMax float64, labels ...string) (QueryResult, error) {\n\tvar (\n\t\tquery string\n\t\tstmt *sql.Stmt\n\t\trow *sql.Row\n\t\terr error\n\t)\n\n\ttxn, txnError := GlobalConn.Begin()\n\tif txnError != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer func() {\n\t\tif err != nil {\n\t\t\ttxn.Rollback()\n\t\t\treturn\n\t\t}\n\n\t\terr = txn.Commit()\n\t}()\n\n\tquery = `\n\t\tinsert into locations (city_name, query_count)\n\t\t\tvalues ($1, $2)\n\t\ton conflict (city_name) do\n\t\t\tupdate\n\t\t\t\tset query_count = locations.query_count + 1\n\t\treturning\n\t\t\tid, city_name, query_count`\n\n\tstmt, err = txn.Prepare(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlr := &LocationRow{}\n\n\trow = stmt.QueryRow(cityName, 1)\n\tif err = row.Scan(&lr.ID, &lr.CityName, &lr.QueryCount); err != nil {\n\t\treturn nil, err\n\t}\n\n\tstmt.Close()\n\n\tquery = `\n\t\tinsert into weather (location_id, labels, temp_low, temp_high, at_time)\n\t\t\tvalues ($1, $2, $3, $4, $5)\n\t\treturning\n\t\t\tlocation_id, labels, temp_high, temp_low, at_time`\n\n\tstmt, err = txn.Prepare(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\twr := &WeatherRow{}\n\n\trow = stmt.QueryRow(lr.ID, pq.StringArray(labels), tempMin, tempMax, time.Now())\n\tif err := row.Scan(\n\t\t&wr.LocationRowID,\n\t\t&wr.Labels,\n\t\t&wr.TempHigh,\n\t\t&wr.TempLow,\n\t\t&wr.AtTime); err != nil {\n\t\treturn nil, err\n\t}\n\n\tstmt.Close()\n\n\treturn QueryResult{\n\t\t\"location\": lr,\n\t\t\"weather\": wr,\n\t}, nil\n}", "func New(x, y int) *Point {\n\treturn &Point{\n\t\tx: x,\n\t\ty: y,\n\t}\n}", "func (d *DB) Get_longitude(ipaddress string) (IP2Locationrecord, error) {\n\treturn d.query(ipaddress, longitude)\n}", "func LocationIsNil() predicate.User {\n\treturn predicate.User(sql.FieldIsNull(FieldLocation))\n}", "func NewCountryNamedLocation()(*CountryNamedLocation) {\n m := &CountryNamedLocation{\n NamedLocation: *NewNamedLocation(),\n }\n return m\n}", "func NewNoPos(text string) (err error) {\n\treturn &ErrInfo{Err: errors.New(text)}\n}", "func (s StaticInfoExtn_GeoInfo_Location) NewInterfaces(n int32) (capnp.UInt64List, error) {\n\tl, err := capnp.NewUInt64List(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn capnp.UInt64List{}, err\n\t}\n\terr = s.Struct.SetPtr(1, l.List.ToPtr())\n\treturn l, err\n}", "func (s PathMetadata_Geo) NewRouterLocations(n int32) (PathMetadata_Geo_GPSData_List, error) {\n\tl, err := NewPathMetadata_Geo_GPSData_List(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn PathMetadata_Geo_GPSData_List{}, err\n\t}\n\terr = s.Struct.SetPtr(0, l.List.ToPtr())\n\treturn l, err\n}", "func LatitudeLTE(v float64) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldLatitude), v))\n\t})\n}", "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 = sanitize.SingleLineString(row.LocationHash)\n\n\t// Validate LocationHash.\n\tif err := validate.NonEmptyString(row.LocationHash); err != nil {\n\t\te := err.(errors.Error)\n\t\treturn e.Wrap(\"Validation failed on LocationHash.\")\n\t}\n\n\t// Sanitize LocationString.\n\trow.LocationString = sanitize.SingleLineString(row.LocationString)\n\n\t// Validate LocationString.\n\tif err := validate.NonEmptyString(row.LocationString); err != nil {\n\t\te := err.(errors.Error)\n\t\treturn e.Wrap(\"Validation failed on LocationString.\")\n\t}\n\n\t// Execute query.\n\tresult, err := db.Exec(updateQuery_Location,\n\t\trow.ParsedCountryCode,\n\t\trow.ParsedPostalCode,\n\t\trow.GeonamesPostalCodes,\n\t\trow.GeonameID,\n\t\trow.GeonamesHierarchy,\n\t\trow.Approved,\n\t\trow.DatasetID,\n\t\trow.LocationHash)\n\tif err == nil {\n\t\tn, err := result.RowsAffected()\n\t\tif err != nil {\n\t\t\treturn errors.Unexpected.\n\t\t\t\tWrap(\"Location update rows affected failed: %w\", err).\n\t\t\t\tAlert()\n\t\t}\n\t\tswitch n {\n\t\tcase 1:\n\t\t\treturn nil\n\n\t\tcase 0:\n\t\t\treturn errors.DBNotFound\n\n\t\tdefault:\n\t\t\treturn errors.Unexpected.\n\t\t\t\tWrap(\"Location update affected %d rows.\", n).\n\t\t\t\tAlert()\n\t\t}\n\t}\n\n\t// Return application error.\n\tif err := translateDBError(err); err != nil {\n\t\treturn err\n\t}\n\n\treturn errors.Unexpected.\n\t\tWrap(\"Location update failed: %w\", err).\n\t\tAlert()\n}", "func LatitudeLTE(v float64) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldLatitude), v))\n\t},\n\t)\n}", "func (mng *csvClient) GetLocations() (model.LocationRows, model.Error) {\n\tvar rows model.LocationRows\n\tif err := gocsv.UnmarshalFile(mng.cltFl, &rows); err != nil {\n\t\treturn nil, model.NewErrorServer(\"Error parsing file\").WithError(err)\n\t}\n\treturn rows, model.NewErrorNil()\n}", "func (s StaticInfoExtn) NewGeo() (StaticInfoExtn_GeoInfo, error) {\n\tss, err := NewStaticInfoExtn_GeoInfo(s.Struct.Segment())\n\tif err != nil {\n\t\treturn StaticInfoExtn_GeoInfo{}, err\n\t}\n\terr = s.Struct.SetPtr(1, ss.Struct.ToPtr())\n\treturn ss, err\n}", "func (w *SimU) NewWorld(addr string, initTrucks int32) (id int64, err error) {\n\tconnect := &ups.Connect{\n\t\tNumTrucksInit: &initTrucks,\n\t}\n\tconnected := new(ups.Connected)\n\terr = w.Connect(addr, connect, connected)\n\tif err != nil {\n\t\treturn\n\t}\n\tid = connected.GetWorldId()\n\treturn\n}", "func (wou *WorkOrderUpdate) ClearLocation() *WorkOrderUpdate {\n\twou.clearedLocation = true\n\treturn wou\n}", "func New(loc Locator) (t Transport, e error) {\n\tif e := loc.Validate(); e != nil {\n\t\treturn nil, fmt.Errorf(\"loc.Validate %w\", e)\n\t}\n\tloc.ApplyDefaults(RoleClient)\n\n\ttr := &transport{}\n\ttr.TransportBase, tr.p = l3.NewTransportBase(l3.TransportBaseConfig{\n\t\tMTU: loc.Dataroom,\n\t\tInitialState: l3.TransportDown,\n\t})\n\n\tif tr.handle, e = newHandle(loc, tr.p.SetState); e != nil {\n\t\treturn nil, e\n\t}\n\treturn tr, nil\n}", "func (d UserData) UnsetLongitude() m.UserData {\n\td.ModelData.Unset(models.NewFieldName(\"Longitude\", \"longitude\"))\n\treturn d\n}" ]
[ "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.42910534", "0.42809114", "0.4265265", "0.42231333", "0.4218944", "0.42106378", "0.4208053", "0.42069352", "0.41986147", "0.4175553", "0.41714534", "0.4170636", "0.4170636", "0.41547173", "0.41478124", "0.41429478", "0.4105727", "0.40828323", "0.40607864", "0.40558204", "0.404345", "0.40420273", "0.40289998", "0.40185937", "0.39866766", "0.39629427", "0.39587885", "0.39530286", "0.39376956", "0.39315495", "0.3927866", "0.39210778", "0.39202988", "0.39114884", "0.39113548", "0.3906813", "0.39047524", "0.39041054", "0.3896778", "0.38892153", "0.3882997", "0.38825315", "0.38823175", "0.38820684", "0.3881872", "0.38808072", "0.38689998", "0.38646555", "0.3861858", "0.38595757", "0.3855262", "0.3843965", "0.38433325", "0.38397297", "0.38278487", "0.38251215", "0.38215542", "0.38137156", "0.38129297", "0.38119546", "0.37989268", "0.37987563", "0.37825713", "0.3781736", "0.37787995", "0.3759786", "0.37555686", "0.37532458", "0.37493795", "0.3744676", "0.37378427", "0.3727062", "0.37206247", "0.37203023", "0.37189093", "0.3711003", "0.37066087", "0.3704822", "0.3702538", "0.3696613" ]
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_locs SET located = $1, raw = \"+\n\t\t\t\"$2 WHERE raw = $2 RETURNING id\", l.Located, l.Raw)\n\t} else {\n\t\t// Check accuracy value\n\t\tif l.Accuracy == AccuracyErr {\n\t\t\treturn fmt.Errorf(\"invalid accuracy value: %s\",\n\t\t\t\tl.Accuracy)\n\t\t}\n\t\t// If located\n\t\trow = db.QueryRow(\"UPDATE geo_locs SET located = $1, \"+\n\t\t\t\"gapi_success = $2, lat = $3, long = $4, \"+\n\t\t\t\"postal_addr = $5, accuracy = $6, bounds_provided = $7,\"+\n\t\t\t\"bounds_id = $8, viewport_bounds_id = $9, \"+\n\t\t\t\"gapi_place_id = $10, raw = $11 WHERE raw = $11 \"+\n\t\t\t\"RETURNING id\",\n\t\t\tl.Located, l.GAPISuccess, l.Lat, l.Long, l.PostalAddr,\n\t\t\tl.Accuracy, l.BoundsProvided, l.BoundsID,\n\t\t\tl.ViewportBoundsID, l.GAPIPlaceID, l.Raw)\n\t}\n\n\t// Set ID\n\terr = row.Scan(&l.ID)\n\n\t// If doesn't exist\n\tif err == sql.ErrNoRows {\n\t\t// Return error so we can identify\n\t\treturn err\n\t} else if err != nil {\n\t\t// Other error\n\t\treturn fmt.Errorf(\"error updating GeoLoc, located: %t, err: %s\",\n\t\t\tl.Located, err.Error())\n\t}\n\n\t// Success\n\treturn nil\n}", "func (l *GeoLoc) Insert() error {\n\t// Get db instance\n\tdb, err := dstore.NewDB()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error retrieving DB instance: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// Insert\n\tvar row *sql.Row\n\n\t// Check if GeoLoc has been parsed\n\tif l.Located {\n\t\t// Check accuracy value\n\t\tif l.Accuracy == AccuracyErr {\n\t\t\treturn fmt.Errorf(\"invalid accuracy value: %s\",\n\t\t\t\tl.Accuracy)\n\t\t}\n\n\t\t// If so, save all fields\n\t\trow = db.QueryRow(\"INSERT INTO geo_locs (located, gapi_success\"+\n\t\t\t\", lat, long, postal_addr, accuracy, bounds_provided, \"+\n\t\t\t\"bounds_id, viewport_bounds_id, gapi_place_id, raw) \"+\n\t\t\t\"VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) \"+\n\t\t\t\"RETURNING id\",\n\t\t\tl.Located, l.GAPISuccess, l.Lat, l.Long, l.PostalAddr,\n\t\t\tl.Accuracy, l.BoundsProvided, l.BoundsID,\n\t\t\tl.ViewportBoundsID, l.GAPIPlaceID, l.Raw)\n\t} else {\n\t\t// If not, only save a couple, and leave rest null\n\t\trow = db.QueryRow(\"INSERT INTO geo_locs (located, raw) VALUES\"+\n\t\t\t\" ($1, $2) RETURNING id\",\n\t\t\tl.Located, l.Raw)\n\t}\n\n\t// Get inserted row ID\n\terr = row.Scan(&l.ID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error inserting row, Located: %t, err: %s\",\n\t\t\tl.Located, err.Error())\n\t}\n\n\treturn nil\n}", "func Get_latitude(ipaddress string) IP2Locationrecord {\n\treturn handleError(defaultDB.query(ipaddress, latitude))\n}", "func (t LocationTable) Get(\n\tdb DBi,\n\tDatasetID string,\n\tLocationHash string,\n) (\n\trow Location,\n\terr error,\n) {\n\tsrc := db.QueryRow(getQuery_Location,\n\t\tDatasetID,\n\t\tLocationHash)\n\n\treturn t.Scan(src)\n}", "func (d *DB) Get_latitude(ipaddress string) (IP2Locationrecord, error) {\n\treturn d.query(ipaddress, latitude)\n}", "func (db *GeoDB) Get(q *GeoQuery) (*GeoPos, error) {\n\tconn := db.pool.Get()\n\tdefer conn.Close()\n\n\tres, err := redis.Positions(conn.Do(\"GEOPOS\", q.Key, q.Member))\n\temptyCoord := res[0] == nil\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif emptyCoord {\n\t\treturn nil, types.ErrMemberNotFound\n\t}\n\n\treturn &GeoPos{Lon: res[0][0], Lat: res[0][1]}, nil\n}", "func (lq *LocationQuery) First(ctx context.Context) (*Location, error) {\n\tls, err := lq.Limit(1).All(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(ls) == 0 {\n\t\treturn nil, &ErrNotFound{location.Label}\n\t}\n\treturn ls[0], nil\n}", "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 = sanitize.SingleLineString(row.LocationHash)\n\n\t// Validate LocationHash.\n\tif err := validate.NonEmptyString(row.LocationHash); err != nil {\n\t\te := err.(errors.Error)\n\t\treturn e.Wrap(\"Validation failed on LocationHash.\")\n\t}\n\n\t// Sanitize LocationString.\n\trow.LocationString = sanitize.SingleLineString(row.LocationString)\n\n\t// Validate LocationString.\n\tif err := validate.NonEmptyString(row.LocationString); err != nil {\n\t\te := err.(errors.Error)\n\t\treturn e.Wrap(\"Validation failed on LocationString.\")\n\t}\n\n\t// Execute query.\n\tresult, err := db.Exec(updateQuery_Location,\n\t\trow.ParsedCountryCode,\n\t\trow.ParsedPostalCode,\n\t\trow.GeonamesPostalCodes,\n\t\trow.GeonameID,\n\t\trow.GeonamesHierarchy,\n\t\trow.Approved,\n\t\trow.DatasetID,\n\t\trow.LocationHash)\n\tif err == nil {\n\t\tn, err := result.RowsAffected()\n\t\tif err != nil {\n\t\t\treturn errors.Unexpected.\n\t\t\t\tWrap(\"Location update rows affected failed: %w\", err).\n\t\t\t\tAlert()\n\t\t}\n\t\tswitch n {\n\t\tcase 1:\n\t\t\treturn nil\n\n\t\tcase 0:\n\t\t\treturn errors.DBNotFound\n\n\t\tdefault:\n\t\t\treturn errors.Unexpected.\n\t\t\t\tWrap(\"Location update affected %d rows.\", n).\n\t\t\t\tAlert()\n\t\t}\n\t}\n\n\t// Return application error.\n\tif err := translateDBError(err); err != nil {\n\t\treturn err\n\t}\n\n\treturn errors.Unexpected.\n\t\tWrap(\"Location update failed: %w\", err).\n\t\tAlert()\n}", "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 located = \" +\n\t\t\"false\")\n\n\t// Check if no results\n\tif err == sql.ErrNoRows {\n\t\t// If not results, return raw error so we can identify\n\t\treturn locs, err\n\t} else if err != nil {\n\t\t// Other error\n\t\treturn locs, fmt.Errorf(\"error querying for unlocated GeoLocs\"+\n\t\t\t\": %s\", err.Error())\n\t}\n\n\t// Parse rows into GeoLocs\n\tfor rows.Next() {\n\t\t// Parse\n\t\tloc, err := NewUnlocatedGeoLoc(rows)\n\t\tif err != nil {\n\t\t\treturn locs, fmt.Errorf(\"error creating unlocated \"+\n\t\t\t\t\"GeoLoc from row: %s\", err.Error())\n\t\t}\n\n\t\t// Add to list\n\t\tlocs = append(locs, loc)\n\t}\n\n\t// Close\n\tif err = rows.Close(); err != nil {\n\t\treturn locs, fmt.Errorf(\"error closing query: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// Success\n\treturn locs, nil\n}", "func Get_isp(ipaddress string) IP2Locationrecord {\n\treturn handleError(defaultDB.query(ipaddress, isp))\n}", "func (entity *Entity) Find(query string) (result *Entity) {\n\trows, err := Connection.Db.Query(\"SELECT id,uuid,url,aws_link,status FROM entities WHERE url=? LIMIT 1\", query)\n\tif err != nil {\n\t\tlog.Println(\"Query error in find: \", err)\n\t}\n\n\tfor rows.Next() {\n\t\tvar s sql.NullString\n\t\tif err := rows.Scan(&entity.Id, &entity.UUID, &entity.Url, &s, &entity.Status); err != nil {\n\t\t\tlog.Println(\"Scan error in find: \", err)\n\t\t}\n\n\t\t// handling null strings with the sql driver is highly irritating\n\t\tif s.Valid {\n\t\t\tentity.AwsLink = s.String\n\t\t} else {\n\t\t\tentity.AwsLink = \"\"\n\t\t}\n\n\t\treturn entity\n\t}\n\n\tif err := rows.Err(); err != nil {\n\t\tlog.Println(\"Row error in find: \", err)\n\t}\n\n\treturn entity\n}", "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 (l *Location) FromRows(rows *sql.Rows) error {\n\tvar scanl struct {\n\t\tID int\n\t\tCreateTime sql.NullTime\n\t\tUpdateTime sql.NullTime\n\t\tName sql.NullString\n\t\tExternalID sql.NullString\n\t\tLatitude sql.NullFloat64\n\t\tLongitude sql.NullFloat64\n\t\tSiteSurveyNeeded sql.NullBool\n\t}\n\t// the order here should be the same as in the `location.Columns`.\n\tif err := rows.Scan(\n\t\t&scanl.ID,\n\t\t&scanl.CreateTime,\n\t\t&scanl.UpdateTime,\n\t\t&scanl.Name,\n\t\t&scanl.ExternalID,\n\t\t&scanl.Latitude,\n\t\t&scanl.Longitude,\n\t\t&scanl.SiteSurveyNeeded,\n\t); err != nil {\n\t\treturn err\n\t}\n\tl.ID = strconv.Itoa(scanl.ID)\n\tl.CreateTime = scanl.CreateTime.Time\n\tl.UpdateTime = scanl.UpdateTime.Time\n\tl.Name = scanl.Name.String\n\tl.ExternalID = scanl.ExternalID.String\n\tl.Latitude = scanl.Latitude.Float64\n\tl.Longitude = scanl.Longitude.Float64\n\tl.SiteSurveyNeeded = scanl.SiteSurveyNeeded.Bool\n\treturn nil\n}", "func (a *APIv1) GetLocation(id interface{}, qo *odata.QueryOptions, path string) (*entities.Location, error) {\n\t_, err := a.QueryOptionsSupported(qo, &entities.Location{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tl, err := a.db.GetLocation(id, qo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ta.ProcessGetRequest(l, qo)\n\treturn l, nil\n}", "func (lq *LocationQuery) Exist(ctx context.Context) (bool, error) {\n\treturn lq.sqlExist(ctx)\n}", "func (dao *LocationDAO) GetPickupLocation(pul_id string) (models.PickupLocation, error) {\n\tvar c models.PickupLocation\n\n\terr := dao.DB.Get(&c,\n\t\t`SELECT pul_id, pul_type, pul_display_name, pul_current_cars\n\t\tFROM pickup_locations\n WHERE pul_id = $1;`, pul_id)\n\treturn c, err\n}", "func (pr *Project) QueryLocation() *LocationQuery {\n\treturn (&ProjectClient{pr.config}).QueryLocation(pr)\n}", "func tryAndGetTheLocationFromARoom(lo *LocationInfo) *db.Loc {\n\tbaseURL, err := url.Parse(\"https://www.kent.ac.uk/timetabling/rooms/room.html\")\n\tif err != nil {\n\t\treturn nil\n\t}\n\t// Prepare Query Parameters\n\tparams := url.Values{}\n\tparams.Add(\"room\", lo.ID)\n\n\t// Add Query Parameters to the URL\n\tbaseURL.RawQuery = params.Encode() // Escape Query Parameters\n\n\t// Get the timetable html page\n\tresp, err := http.Get(baseURL.String())\n\tif err != nil {\n\t\treturn nil\n\t}\n\tdefer resp.Body.Close()\n\tbody, readErr := ioutil.ReadAll(resp.Body)\n\tif readErr != nil {\n\t\treturn nil\n\t}\n\n\t// Get the google maps url from this page\n\tre := regexp.MustCompile(`https:\\/\\/maps\\.google\\.co\\.uk\\/maps[^\"]*`)\n\tresult := re.Find(body)\n\tif result == nil {\n\t\treturn nil\n\t}\n\n\t// Get the query params from the google maps url, we are looking for \"ll\"\n\tu, err := url.Parse(string(result))\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tqueries := u.Query()\n\tll := queries.Get(\"ll\")\n\tls := strings.Split(ll, \",\")\n\tlat, err := strconv.ParseFloat(ls[0], 64)\n\tif err != nil {\n\t\treturn nil\n\t}\n\tlon, err := strconv.ParseFloat(ls[1], 64)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tg := &db.Loc{\n\t\tType: \"Point\",\n\t\tCoords: []float64{lon, lat},\n\t}\n\n\t// g := geom.NewPointFlat(geom.XY, []float64{lat, lon})\n\n\t// Finally, if nothing has failed, then return the coordinates\n\treturn g\n}", "func (q boardsSectionsPositionQuery) One(ctx context.Context, exec boil.ContextExecutor) (*BoardsSectionsPosition, error) {\n\to := &BoardsSectionsPosition{}\n\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Bind(ctx, exec, o)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"rdb: failed to execute a one query for boards_sections_positions\")\n\t}\n\n\tif err := o.doAfterSelectHooks(ctx, exec); err != nil {\n\t\treturn o, err\n\t}\n\n\treturn o, nil\n}", "func TestSuccessfulSingleQuery(t *testing.T) {\n\tlocations, err := metaweather.QueryLocations(\"london\")\n\tif err != nil {\n\t\tt.Fatalf(\"query returned error: %v\", err)\n\t}\n\tif len(locations) != 1 {\n\t\tt.Fatalf(\"number of query results is %d\", len(locations))\n\t}\n\tif locations[0].Title != \"London\" {\n\t\tt.Fatalf(\"query results returned wrong location: %v\", locations[0])\n\t}\n}", "func (sys *System) Query(ctx *Context, location string, query string) (*QueryResult, error) {\n\tthen := Now()\n\tatomic.AddUint64(&sys.stats.TotalCalls, uint64(1))\n\tLog(INFO, ctx, \"System.Query\", \"location\", location, \"query\", query)\n\ttimer := NewTimer(ctx, \"SystemQuery\")\n\tdefer timer.Stop()\n\n\tloc, err := sys.findLocation(ctx, location, true)\n\tdefer sys.releaseLocation(ctx, location)\n\tvar qr *QueryResult\n\tif err == nil {\n\t\tqr, err = loc.Query(ctx, query)\n\t}\n\tif err != nil {\n\t\tLog(ERROR, ctx, \"System.Query\", \"location\", location, \"query\", query, \"error\", err)\n\t}\n\tatomic.AddUint64(&sys.stats.TotalTime, uint64(Now()-then))\n\treturn qr, sys.stats.IncErrors(err)\n}", "func (c *PositionClient) Get(ctx context.Context, id int) (*Position, error) {\n\treturn c.Query().Where(position.ID(id)).Only(ctx)\n}", "func (c *PositionClient) Get(ctx context.Context, id int) (*Position, error) {\n\treturn c.Query().Where(position.ID(id)).Only(ctx)\n}", "func (c *PositionClient) Get(ctx context.Context, id int) (*Position, error) {\n\treturn c.Query().Where(position.ID(id)).Only(ctx)\n}", "func (q addressQuery) One() (*Address, error) {\n\to := &Address{}\n\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Bind(o)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"sqlboiler: failed to execute a one query for address\")\n\t}\n\n\tif err := o.doAfterSelectHooks(queries.GetExecutor(q.Query)); err != nil {\n\t\treturn o, err\n\t}\n\n\treturn o, nil\n}", "func (dao *LocationDAO) GetStockingLocation(stl_id string) (models.StockingLocation, error) {\n\tvar location models.StockingLocation\n\n\terr := dao.DB.Get(&location,\n\t\t`SELECT stl_id, stl_temperature_zone, stl_type, stl_pick_segment, stl_aisle, stl_bay, stl_shelf,\n stl_shelf_slot, stl_height, stl_width, stl_depth, stl_assigned_sku, stl_needs_qc, stl_last_qc_date\n FROM stocking_locations\n WHERE stl_id = $1;`, stl_id)\n\treturn location, err\n}", "func (db *AppDB) RetrieveLocationInfo(location Location, chargerType []string) (PointInfoJS, error) {\r\n\tctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\r\n\tdefer cancel()\r\n\r\n\tvar results PointInfoJS\r\n\tfilter := bson.D{\r\n\t\tprimitive.E{Key: \"location\", Value: bson.D{\r\n\t\t\tprimitive.E{Key: \"$near\", Value: bson.D{\r\n\t\t\t\tprimitive.E{Key: \"$geometry\", Value: location},\r\n\t\t\t}},\r\n\t\t}},\r\n\t}\r\n\r\n\tcur, err := db.MDB.Collection(db.Env.DBPointColl).Find(ctx, filter)\r\n\tif err != nil {\r\n\t\treturn PointInfoJS{}, err\r\n\t}\r\n\tfor cur.Next(ctx) {\r\n\t\tvar p Point\r\n\t\terr := cur.Decode(&p)\r\n\t\tif err != nil {\r\n\t\t\tlogger.Error.Println(\"retrieveLocationInfo-decoding: \", err)\r\n\t\t\treturn PointInfoJS{}, err\r\n\t\t}\r\n\t\tpJS := parsePointInfo(p, chargerType)\r\n\t\treturn pJS, nil\r\n\t}\r\n\r\n\treturn results, nil\r\n}", "func (d *DB) Get_isp(ipaddress string) (IP2Locationrecord, error) {\n\treturn d.query(ipaddress, isp)\n}", "func (scs *SurveyCellScan) QueryLocation() *LocationQuery {\n\treturn (&SurveyCellScanClient{scs.config}).QueryLocation(scs)\n}", "func (scs *SurveyCellScan) QueryLocation() *LocationQuery {\n\treturn (&SurveyCellScanClient{scs.config}).QueryLocation(scs)\n}", "func (q originQuery) One(ctx context.Context, exec boil.ContextExecutor) (*Origin, error) {\n\to := &Origin{}\n\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Bind(ctx, exec, o)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: failed to execute a one query for origins\")\n\t}\n\n\tif err := o.doAfterSelectHooks(ctx, exec); err != nil {\n\t\treturn o, err\n\t}\n\n\treturn o, nil\n}", "func (u *User) GetLocation(tx *pop.Connection) (*Location, error) {\n\tif !u.LocationID.Valid {\n\t\treturn nil, nil\n\t}\n\tlocation := Location{}\n\tif err := tx.Find(&location, u.LocationID); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &location, nil\n}", "func (e *Equipment) QueryLocation() *LocationQuery {\n\treturn (&EquipmentClient{e.config}).QueryLocation(e)\n}", "func (t LocationTable) Scan(\n\tsrc interface {\n\t\tScan(args ...interface{}) error\n\t},\n) (\n\trow Location,\n\terr error,\n) {\n\terr = src.Scan(\n\t\t&row.DatasetID,\n\t\t&row.LocationHash,\n\t\t&row.LocationString,\n\t\t&row.ParsedCountryCode,\n\t\t&row.ParsedPostalCode,\n\t\t&row.GeonamesPostalCodes,\n\t\t&row.GeonameID,\n\t\t&row.GeonamesHierarchy,\n\t\t&row.Approved,\n\t\t&row.CreatedAt,\n\t\t&row.Name,\n\t\t&row.Population,\n\t\t&row.CountryCode,\n\t\t&row.ParentName,\n\t\t&row.ParentPopulation,\n\t\t&row.ParentGeonameID)\n\n\tif err == nil {\n\t\treturn\n\t}\n\n\tif err == sql.ErrNoRows {\n\t\treturn row, errors.DBNotFound\n\t}\n\n\treturn row, errors.Unexpected.\n\t\tWrap(\"Failed to scan Location: %w\", err).\n\t\tAlert()\n}", "func (c *PositionInPharmacistClient) Get(ctx context.Context, id int) (*PositionInPharmacist, error) {\n\treturn c.Query().Where(positioninpharmacist.ID(id)).Only(ctx)\n}", "func Get_all(ipaddress string) IP2Locationrecord {\n\treturn handleError(defaultDB.query(ipaddress, all))\n}", "func (lq *LocationQuery) FirstX(ctx context.Context) *Location {\n\tl, err := lq.First(ctx)\n\tif err != nil && !IsNotFound(err) {\n\t\tpanic(err)\n\t}\n\treturn l\n}", "func (m *Mongo) FindLocationByID(ctx context.Context, ID string) (Location, error) {\n\tvar locs Location\n\tcollection := m.Client.Database(m.Database).Collection(m.locationCollection())\n\tfilter := bson.M{\"_id\": ID}\n\tresult := collection.FindOne(ctx, filter)\n\tif result.Err() != nil {\n\t\treturn locs, MongoQueryErr{Reason: \"location.FindOne failed\", Inner: result.Err()}\n\t}\n\tvar cs Location\n\tif err := result.Decode(&cs); err != nil {\n\t\treturn locs, MongoQueryErr{\n\t\t\tReason: \"error decoding location\",\n\t\t\tInner: err,\n\t\t}\n\t}\n\n\treturn locs, nil\n}", "func (ls *LocationService) Get(locID string) (l Location, err error) {\n\t// GET: /location/:locationID\n\tvar req *http.Request\n\treq, err = ls.c.NewRequest(\"GET\", \"/location/\"+locID, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tresp := struct {\n\t\tStatus string\n\t\tData Location\n\t\tMessage string\n\t}{}\n\terr = ls.c.Do(req, &resp)\n\treturn resp.Data, err\n}", "func (r *RepositoryStruct) First(obj interface{}, query string, args ...interface{}) (interface{}, error) {\n\n\tresult := r.Connection.Where(query, args).First(obj)\n\tif result.Error != nil && result.Error.Error() == \"record not found\" {\n\t\treturn nil, nil\n\t}\n\treturn obj, result.Error\n}", "func (s *LocationsOp) Get(ctx context.Context, locationID int) (*Location, *http.Response, error) {\n\tpath := fmt.Sprintf(\"%s/%d\", locationsPath, locationID)\n\n\treq, err := s.client.NewRequest(ctx, http.MethodGet, path, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tlocation := new(Location)\n\tresp, err := s.client.Do(ctx, req, location)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn location, resp, err\n}", "func (g *DB) Lookup(ip net.IP) (*GeoIP, error) {\n\tif ip == nil {\n\t\treturn nil, fmt.Errorf(\"ip is nil\")\n\t}\n\n\tg.mutex.Lock()\n\tdefer g.mutex.Unlock()\n\n\tres := &GeoIP{\n\t\tIP: ip,\n\t}\n\n\t// ANONYMOUS IP\n\t//\n\tanon, err := g.reader.AnonymousIP(ip)\n\tif err == nil {\n\t\tres.Anonymous = Anonymous{\n\t\t\tIsAnonymous: anon.IsAnonymous,\n\t\t\tIsAnonymousVPN: anon.IsAnonymousVPN,\n\t\t\tIsHostingProvider: anon.IsHostingProvider,\n\t\t\tIsPublicProxy: anon.IsPublicProxy,\n\t\t\tIsTorExitNode: anon.IsTorExitNode,\n\t\t}\n\t}\n\n\t// CITY\n\t//\n\tcity, err := g.reader.City(ip)\n\tif err == nil {\n\t\tsubdivisions := make([]string, len(city.Subdivisions), len(city.Subdivisions))\n\t\tfor i, sd := range city.Subdivisions {\n\t\t\tsubdivisions[i] = sd.Names[\"en\"]\n\t\t}\n\n\t\tres.City = City{\n\t\t\tAccuracyRadius: city.Location.AccuracyRadius,\n\t\t\tContinent: city.Continent.Names[\"en\"],\n\t\t\tContinentCode: city.Continent.Code,\n\t\t\tCountry: city.Country.Names[\"en\"],\n\t\t\tCountryCode: city.Country.IsoCode,\n\t\t\tIsAnonymousProxy: city.Traits.IsAnonymousProxy,\n\t\t\tIsSatelliteProvider: city.Traits.IsSatelliteProvider,\n\t\t\tLatitude: city.Location.Latitude,\n\t\t\tLongitude: city.Location.Longitude,\n\t\t\tMetroCode: city.Location.MetroCode,\n\t\t\tName: city.City.Names[\"en\"],\n\t\t\tPostcode: city.Postal.Code,\n\t\t\tRegisteredCountry: city.RegisteredCountry.Names[\"en\"],\n\t\t\tRegisteredCountryCode: city.RegisteredCountry.IsoCode,\n\t\t\tRepresentedCountry: city.RepresentedCountry.Names[\"en\"],\n\t\t\tRepresentedCountryCode: city.RepresentedCountry.IsoCode,\n\t\t\tRepresentedCountryType: city.RepresentedCountry.Type,\n\t\t\tSubdivisions: subdivisions,\n\t\t\tTimezone: city.Location.TimeZone,\n\t\t}\n\t} else {\n\t\treturn nil, fmt.Errorf(\"failed to load city data for %s\", ip)\n\t}\n\n\t// COUNTRY\n\t//\n\tcountry, err := g.reader.Country(ip)\n\tif err == nil {\n\t\tres.Country = Country{\n\t\t\tContinent: country.Continent.Names[\"en\"],\n\t\t\tContinentCode: country.Continent.Code,\n\t\t\tCountry: country.Country.Names[\"en\"],\n\t\t\tCountryCode: country.Country.IsoCode,\n\t\t\tIsAnonymousProxy: country.Traits.IsAnonymousProxy,\n\t\t\tIsSatelliteProvider: country.Traits.IsSatelliteProvider,\n\t\t\tRegisteredCountry: country.RegisteredCountry.Names[\"en\"],\n\t\t\tRegisteredCountryCode: country.RegisteredCountry.IsoCode,\n\t\t\tRepresentedCountry: country.RepresentedCountry.Names[\"en\"],\n\t\t\tRepresentedCountryCode: country.RepresentedCountry.IsoCode,\n\t\t\tRepresentedCountryType: country.RepresentedCountry.Type,\n\t\t}\n\t} else {\n\t\treturn nil, fmt.Errorf(\"failed to load country data for %s\", ip)\n\t}\n\n\treturn res, nil\n}", "func Get_weatherstationcode(ipaddress string) IP2Locationrecord {\n\treturn handleError(defaultDB.query(ipaddress, weatherstationcode))\n}", "func GetDosenLocation(w http.ResponseWriter, r *http.Request) {\n\tvar lokasi StatusLocation\n\tuserID := pat.Param(r, \"id\")\n\n\tquery := `SELECT users.id as UserID, users.nama, status.posisi, status.last_update as LastUpdate\n\tFROM users JOIN status\n\tWHERE users.id = ? AND users.id = status.user_id;`\n\n\tif err := models.Dbm.SelectOne(&lokasi, query, userID); err != nil {\n\t\terrors.NewError(\"Can't fetch location\", http.StatusInternalServerError).WriteTo(w)\n\t\treturn\n\t}\n\n\tjson.NewEncoder(w).Encode(lokasi)\n}", "func (lq *LocationQuery) All(ctx context.Context) ([]*Location, error) {\n\treturn lq.sqlAll(ctx)\n}", "func QueryOne(ctx context.Context, queryable Queryable, mapper RowMapper, query string, args ...interface{}) (interface{}, error) {\n\tvar err error\n\tstart := time.Now()\n\tdefer func(e error) {\n\t\tlatency := time.Since(start)\n\t\tzap.L().Info(\"queryOne\", zap.Int(\"latency\", int(latency.Seconds()*1000)), zap.Bool(\"success\", e == sql.ErrNoRows || e == nil), zap.String(\"activityId\", GetTraceID(ctx)))\n\t}(err)\n\trows, err := queryable.QueryContext(ctx, query, args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer rows.Close()\n\tif !rows.Next() {\n\t\treturn nil, nil\n\t}\n\n\tobj, err := mapper.Map(rows)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn obj, nil\n}", "func Get_longitude(ipaddress string) IP2Locationrecord {\n\treturn handleError(defaultDB.query(ipaddress, longitude))\n}", "func (d *DB) Get_as(ipaddress string) (IP2Locationrecord, error) {\n\treturn d.query(ipaddress, as)\n}", "func (stmt *Stmt) QueryOne(model interface{}, params ...interface{}) (Result, error) {\n\treturn stmt.queryOne(context.Background(), model, params...)\n}", "func UpdateCachedLocationWeather(cityName string, tempMin, tempMax float64, labels ...string) (QueryResult, error) {\n\tvar (\n\t\tquery string\n\t\tstmt *sql.Stmt\n\t\trow *sql.Row\n\t\terr error\n\t)\n\n\ttxn, txnError := GlobalConn.Begin()\n\tif txnError != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer func() {\n\t\tif err != nil {\n\t\t\ttxn.Rollback()\n\t\t\treturn\n\t\t}\n\n\t\terr = txn.Commit()\n\t}()\n\n\tquery = `\n\t\tinsert into locations (city_name, query_count)\n\t\t\tvalues ($1, $2)\n\t\ton conflict (city_name) do\n\t\t\tupdate\n\t\t\t\tset query_count = locations.query_count + 1\n\t\treturning\n\t\t\tid, city_name, query_count`\n\n\tstmt, err = txn.Prepare(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlr := &LocationRow{}\n\n\trow = stmt.QueryRow(cityName, 1)\n\tif err = row.Scan(&lr.ID, &lr.CityName, &lr.QueryCount); err != nil {\n\t\treturn nil, err\n\t}\n\n\tstmt.Close()\n\n\tquery = `\n\t\tinsert into weather (location_id, labels, temp_low, temp_high, at_time)\n\t\t\tvalues ($1, $2, $3, $4, $5)\n\t\treturning\n\t\t\tlocation_id, labels, temp_high, temp_low, at_time`\n\n\tstmt, err = txn.Prepare(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\twr := &WeatherRow{}\n\n\trow = stmt.QueryRow(lr.ID, pq.StringArray(labels), tempMin, tempMax, time.Now())\n\tif err := row.Scan(\n\t\t&wr.LocationRowID,\n\t\t&wr.Labels,\n\t\t&wr.TempHigh,\n\t\t&wr.TempLow,\n\t\t&wr.AtTime); err != nil {\n\t\treturn nil, err\n\t}\n\n\tstmt.Close()\n\n\treturn QueryResult{\n\t\t\"location\": lr,\n\t\t\"weather\": wr,\n\t}, nil\n}", "func LocationClean() {\n\trows, err := db.Query(\"SELECT gid FROM locations WHERE loc != POINTFROMTEXT(?) AND upTime < DATE_SUB(UTC_TIMESTAMP(), INTERVAL 3 HOUR)\", \"POINT(0 0)\")\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\n\tvar gid GoogleID\n\tfor rows.Next() {\n\t\tif err = rows.Scan(&gid); err != nil {\n\t\t\tlog.Error(err)\n\t\t\tcontinue\n\t\t}\n\t\tif _, err = db.Exec(\"UPDATE locations SET loc = POINTFROMTEXT(?), upTime = UTC_TIMESTAMP() WHERE gid = ?\", \"POINT(0 0)\", gid); err != nil {\n\t\t\tlog.Error(err)\n\t\t\tcontinue\n\t\t}\n\t}\n}", "func (oauthClient *OauthClient) GetOneByQuery(db *gorm.DB, query string, where ...interface{}) error {\n\tif err := db.Where(query, where...).First(&oauthClient).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (provider *YahooWeatherProvider) Query(location string, unit UoM) (*Weather, error) {\n\tvar err error = nil\n\n\tif location != provider.lastLocation || unit != provider.lastUnit ||\n\t\ttime.Now().UTC().Unix()-provider.lastQueryTime > MinUpdateTimeoutSeconds {\n\t\tprovider.lastLocation = location\n\t\tprovider.lastLocationNorm = strings.ReplaceAll(strings.ToLower(location), \", \", \",\")\n\t\tprovider.lastUnit = unit\n\t\tif unit == Metric {\n\t\t\tprovider.lastUnitStr = \"c\"\n\t\t} else {\n\t\t\tprovider.lastUnitStr = \"f\"\n\t\t}\n\n\t\terr = provider.update()\n\t}\n\n\treturn provider.lastData, err\n}", "func (q rawVisitQuery) One(ctx context.Context, exec boil.ContextExecutor) (*RawVisit, error) {\n\to := &RawVisit{}\n\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Bind(ctx, exec, o)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: failed to execute a one query for raw_visits\")\n\t}\n\n\tif err := o.doAfterSelectHooks(ctx, exec); err != nil {\n\t\treturn o, err\n\t}\n\n\treturn o, nil\n}", "func (lc LocationController) GetLocation(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\t// Grab id\n\tid := p.ByName(\"id\")\n\n\t// Verify id is ObjectId, otherwise bail\n\tif !bson.IsObjectIdHex(id) {\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\n\t// Grab id\n\toid := bson.ObjectIdHex(id)\n\n\t// Stub Location\n\tvar locationObject Location\n\n\t// Fetch user\n\tif err := lc.session.DB(\"go_rest_api_assignment2\").C(\"locations\").FindId(oid).One(&locationObject); err != nil {\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\n\t// Marshal provided interface into JSON structure\n\tuj, _ := json.Marshal(locationObject)\n\n\t// Write content-type, statuscode, payload\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(200)\n\tfmt.Fprintf(w, \"%s\", uj)\n}", "func (d *DB) Get_all(ipaddress string) (IP2Locationrecord, error) {\n\treturn d.query(ipaddress, all)\n}", "func (s *PersonStore) FindOne(q *PersonQuery) (*Person, error) {\n\tq.Limit(1)\n\tq.Offset(0)\n\trs, err := s.Find(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !rs.Next() {\n\t\treturn nil, kallax.ErrNotFound\n\t}\n\n\trecord, err := rs.Get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := rs.Close(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn record, nil\n}", "func (cls *CachedLocations) Open(ctx *Context, sys *System, name string, check bool) (*Location, error) {\n\tLog(INFO, ctx, \"CachedLocations.Open\", \"name\", name)\n\tcls.Lock()\n\n\tloc, dead := cls.expire(ctx, sys, name, false)\n\n\tvar err error\n\tif loc == nil || dead {\n\t\tLog(INFO, ctx, \"CachedLocations.Open\", \"name\", name, \"cached\", \"empty\")\n\t\tctl := sys.Control()\n\t\tttl := ctl.LocationTTL\n\n\t\texpires := EndOfTime\n\t\tif ttl != Forever {\n\t\t\texpires = time.Now().Add(ttl)\n\t\t}\n\t\tLog(INFO, ctx, \"CachedLocations.Open\", \"name\", name, \"expires\", expires.String())\n\t\tcl := &CachedLocation{\n\t\t\tExpires: expires,\n\t\t}\n\n\t\tif ttl != Never || ctl.CachePending {\n\t\t\tcls.locs[name] = cl\n\t\t}\n\n\t\t// The clever (?) move here: now we only need a lock\n\t\t// for the given location (instead of system-wide\n\t\t// lock). That's important because loading a location\n\t\t// can take a long time. We'd like to be able to open\n\t\t// locations concurrently.\n\t\tcls.Unlock()\n\t\treturn cl.Get(ctx, sys, name, check)\n\t}\n\n\tcls.Unlock()\n\treturn loc, err\n}", "func FindRawVisit(ctx context.Context, exec boil.ContextExecutor, iD int, selectCols ...string) (*RawVisit, error) {\n\trawVisitObj := &RawVisit{}\n\n\tsel := \"*\"\n\tif len(selectCols) > 0 {\n\t\tsel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), \",\")\n\t}\n\tquery := fmt.Sprintf(\n\t\t\"select %s from \\\"raw_visits\\\" where \\\"id\\\"=$1\", sel,\n\t)\n\n\tq := queries.Raw(query, iD)\n\n\terr := q.Bind(ctx, exec, rawVisitObj)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: unable to select from raw_visits\")\n\t}\n\n\tif err = rawVisitObj.doAfterSelectHooks(ctx, exec); err != nil {\n\t\treturn rawVisitObj, err\n\t}\n\n\treturn rawVisitObj, nil\n}", "func (c *Connection) RawQuery(stmt string, args ...interface{}) *Query {\n\treturn Q(c).RawQuery(stmt, args...)\n}", "func (dao *LocationDAO) GetPickContainerLocation(pcl_id string) (models.PickContainerLocation, error) {\n\tvar c models.PickContainerLocation\n\n\terr := dao.DB.Get(&c,\n\t\t`SELECT pcl_id, pcl_type, pcl_temperature_zone, pcl_aisle, pcl_bay, pcl_shelf, pcl_shelf_slot\n FROM pick_container_locations\n WHERE pcl_id = $1;`, pcl_id)\n\treturn c, err\n}", "func (dao *VillageDAO) Query(rs app.RequestScope, offset, limit int, districtID int) ([]models.Village, error) {\n\tvillages := []models.Village{}\n\terr := rs.Tx().Select().Where(dbx.HashExp{\"district_id\": districtID}).OrderBy(\"id\").Offset(int64(offset)).Limit(int64(limit)).All(&villages)\n\treturn villages, err\n}", "func (db *geoDB) location(ip string) *geoLocation {\n\tlocation := db.lookup(net.ParseIP(ip))\n\treturn &geoLocation{\n\t\tCountry: location.Country.Names.English,\n\t\tCity: location.City.Names.English,\n\t\tLatitude: location.Location.Latitude,\n\t\tLongitude: location.Location.Longitude,\n\t}\n}", "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 = sanitize.SingleLineString(row.LocationHash)\n\n\t// Validate LocationHash.\n\tif err := validate.NonEmptyString(row.LocationHash); err != nil {\n\t\te := err.(errors.Error)\n\t\treturn e.Wrap(\"Validation failed on LocationHash.\")\n\t}\n\n\t// Sanitize LocationString.\n\trow.LocationString = sanitize.SingleLineString(row.LocationString)\n\n\t// Validate LocationString.\n\tif err := validate.NonEmptyString(row.LocationString); err != nil {\n\t\te := err.(errors.Error)\n\t\treturn e.Wrap(\"Validation failed on LocationString.\")\n\t}\n\n\t// Execute query.\n\t_, err = db.Exec(insertQuery_Location,\n\t\trow.DatasetID,\n\t\trow.LocationHash,\n\t\trow.LocationString,\n\t\trow.ParsedCountryCode,\n\t\trow.ParsedPostalCode,\n\t\trow.GeonamesPostalCodes,\n\t\trow.GeonameID,\n\t\trow.GeonamesHierarchy,\n\t\trow.Approved,\n\t\trow.CreatedAt)\n\n\tif err == nil {\n\t\treturn nil\n\t}\n\n\tif err := translateDBError(err); err != nil {\n\t\treturn err\n\t}\n\n\treturn errors.Unexpected.\n\t\tWrap(\"Location.Insert failed: %w\", err).\n\t\tAlert()\n}", "func (q recipeLipidQuery) One(ctx context.Context, exec boil.ContextExecutor) (*RecipeLipid, error) {\n\to := &RecipeLipid{}\n\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Bind(ctx, exec, o)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: failed to execute a one query for recipe_lipid\")\n\t}\n\n\tif err := o.doAfterSelectHooks(ctx, exec); err != nil {\n\t\treturn o, err\n\t}\n\n\treturn o, nil\n}", "func (s *PollStore) FindOne(q *PollQuery) (*Poll, error) {\n\tq.Limit(1)\n\tq.Offset(0)\n\trs, err := s.Find(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !rs.Next() {\n\t\treturn nil, kallax.ErrNotFound\n\t}\n\n\trecord, err := rs.Get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := rs.Close(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn record, nil\n}", "func (q sourceQuery) One() (*Source, error) {\n\to := &Source{}\n\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Bind(o)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"mdbmdbmodels: failed to execute a one query for sources\")\n\t}\n\n\treturn o, nil\n}", "func (search *Search) Location(lat, lng, location string) (*SearchResult, error) {\n\tinsta := search.inst\n\tq := map[string]string{\n\t\t\"rank_token\": insta.rankToken,\n\t\t\"latitude\": lat,\n\t\t\"longitude\": lng,\n\t\t\"ranked_content\": \"true\",\n\t}\n\n\tif location != \"\" {\n\t\tq[\"search_query\"] = location\n\t} else {\n\t\tq[\"timestamp\"] = strconv.FormatInt(time.Now().Unix(), 10)\n\t}\n\n\tbody, err := insta.sendRequest(\n\t\t&reqOptions{\n\t\t\tEndpoint: urlSearchLocation,\n\t\t\tQuery: q,\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres := &SearchResult{}\n\terr = json.Unmarshal(body, res)\n\treturn res, err\n}", "func Get_areacode(ipaddress string) IP2Locationrecord {\n\treturn handleError(defaultDB.query(ipaddress, areacode))\n}", "func (bdb *StormDBInstance) Find(fieldName string, value interface{}, to interface{}) error {\n\terr := bdb.DB.One(fieldName, value, to)\n\treturn err\n}", "func (q weatherQuery) One(ctx context.Context, exec boil.ContextExecutor) (*Weather, error) {\n\to := &Weather{}\n\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Bind(ctx, exec, o)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"db: failed to execute a one query for weather\")\n\t}\n\n\tif err := o.doAfterSelectHooks(ctx, exec); err != nil {\n\t\treturn o, err\n\t}\n\n\treturn o, nil\n}", "func (q storestateQuery) One(exec boil.Executor) (*Storestate, error) {\n\to := &Storestate{}\n\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Bind(nil, exec, o)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"stellarcore: failed to execute a one query for storestate\")\n\t}\n\n\tif err := o.doAfterSelectHooks(exec); err != nil {\n\t\treturn o, err\n\t}\n\n\treturn o, nil\n}", "func query(proj string, ctx context.Context) (*bigquery.RowIterator, error) {\n\n\tclient, err := bigquery.NewClient(ctx, proj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tquery := client.Query(\n\t\t`SELECT * FROM ` +\n\t\t\t\"`bigquery-public-data.cloud_storage_geo_index.sentinel_2_index`\" +\n\t\t\t` WHERE west_lon = 32.0470531263` +\n\t\t\t` LIMIT 10;`)\n\t// Use standard SQL syntax for queries.\n\t// See: https://cloud.google.com/bigquery/sql-reference/\n\tquery.QueryConfig.UseStandardSQL = true\n\treturn query.Read(ctx)\n}", "func (qs SysDBQuerySet) One(ret *SysDB) error {\n\treturn qs.db.First(ret).Error\n}", "func Get_region(ipaddress string) IP2Locationrecord {\n\treturn handleError(defaultDB.query(ipaddress, region))\n}", "func Get_zipcode(ipaddress string) IP2Locationrecord {\n\treturn handleError(defaultDB.query(ipaddress, zipcode))\n}", "func TestSuccessfulEmptyQuery(t *testing.T) {\n\tlocations, err := metaweather.QueryLocations(\"thisissomestrangelocationwhichdoesnotexist\")\n\tif err != nil {\n\t\tt.Fatalf(\"query returned error: %v\", err)\n\t}\n\tif len(locations) != 0 {\n\t\tt.Fatalf(\"number of query results is %d\", len(locations))\n\t}\n}", "func (luo *LocationUpdateOne) Save(ctx context.Context) (*Location, error) {\n\tif luo.update_time == nil {\n\t\tv := location.UpdateDefaultUpdateTime()\n\t\tluo.update_time = &v\n\t}\n\tif luo.name != nil {\n\t\tif err := location.NameValidator(*luo.name); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %v\", err)\n\t\t}\n\t}\n\tif luo.latitude != nil {\n\t\tif err := location.LatitudeValidator(*luo.latitude); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"ent: validator failed for field \\\"latitude\\\": %v\", err)\n\t\t}\n\t}\n\tif luo.longitude != nil {\n\t\tif err := location.LongitudeValidator(*luo.longitude); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"ent: validator failed for field \\\"longitude\\\": %v\", err)\n\t\t}\n\t}\n\tif len(luo._type) > 1 {\n\t\treturn nil, errors.New(\"ent: multiple assignments on a unique edge \\\"type\\\"\")\n\t}\n\tif luo.clearedType && luo._type == nil {\n\t\treturn nil, errors.New(\"ent: clearing a unique edge \\\"type\\\"\")\n\t}\n\tif len(luo.parent) > 1 {\n\t\treturn nil, errors.New(\"ent: multiple assignments on a unique edge \\\"parent\\\"\")\n\t}\n\treturn luo.sqlSave(ctx)\n}", "func (dao *LocationDAO) GetReceivingLocation(rcl_id string) (models.ReceivingLocation, error) {\n\tvar location models.ReceivingLocation\n\n\terr := dao.DB.Get(&location,\n\t\t`SELECT rcl_id, rcl_type,\n rcl_temperature_zone, rcl_shi_shipment_code\n FROM receiving_locations\n WHERE rcl_id = $1;`, rcl_id)\n\treturn location, err\n}", "func (base *User) QueryByID(conn *gorm.DB) (*User, error) {\n\n\tuser := &User{}\n\n\tresult := conn.Where(\"id = ?\", base.ID).First(&user)\n\n\tif result.Error != nil {\n\n\t\treturn user, result.Error\n\t}\n\n\treturn user, nil\n}", "func (s *PersonStore) Find(q *PersonQuery) (*PersonResultSet, error) {\n\trs, err := s.Store.Find(q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn NewPersonResultSet(rs), nil\n}", "func (swfs *SurveyWiFiScan) QueryLocation() *LocationQuery {\n\treturn (&SurveyWiFiScanClient{swfs.config}).QueryLocation(swfs)\n}", "func (t LocationTable) GetByLocationHash(\n\tdb DBi,\n\tLocationHash string,\n) (\n\trow Location,\n\terr error,\n) {\n\n\tsrc := db.QueryRow(getQuery_Location_byLocationHash,\n\t\tLocationHash)\n\n\treturn t.Scan(src)\n}", "func FindAddress(exec boil.Executor, addressID uint16, selectCols ...string) (*Address, error) {\n\taddressObj := &Address{}\n\n\tsel := \"*\"\n\tif len(selectCols) > 0 {\n\t\tsel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), \",\")\n\t}\n\tquery := fmt.Sprintf(\n\t\t\"select %s from `address` where `address_id`=?\", sel,\n\t)\n\n\tq := queries.Raw(exec, query, addressID)\n\n\terr := q.Bind(addressObj)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"sqlboiler: unable to select from address\")\n\t}\n\n\treturn addressObj, nil\n}", "func (gs *GeoSearch) Query(lat, lng float64) map[string]string {\n\tq := s2.CellIDFromLatLng(s2.LatLngFromDegrees(lat, lng))\n\ti := &S2Interval{CellID: q}\n\tr := gs.Tree.Query(i)\n\n\tmatchLoopID := -1\n\n\tfor _, itv := range r {\n\t\tsitv := itv.(*S2Interval)\n\t\tif gs.Debug {\n\t\t\tfmt.Println(\"found\", sitv, sitv.LoopIDs)\n\t\t}\n\n\t\t// a region can include a smaller region\n\t\t// return only the one that is contained in the other\n\n\t\tfor _, loopID := range sitv.LoopIDs {\n\n\t\t\tif gs.rm[loopID].L.ContainsPoint(q.Point()) {\n\n\t\t\t\tif matchLoopID == -1 {\n\t\t\t\t\tmatchLoopID = loopID\n\t\t\t\t} else {\n\t\t\t\t\tfoundLoop := gs.rm[loopID].L\n\t\t\t\t\tpreviousLoop := gs.rm[matchLoopID].L\n\n\t\t\t\t\t// we take the 1st vertex of the foundloop if it is contained in previousLoop\n\t\t\t\t\t// foundLoop one is more precise\n\t\t\t\t\tif previousLoop.ContainsPoint(foundLoop.Vertex(0)) {\n\t\t\t\t\t\tmatchLoopID = loopID\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif matchLoopID != -1 {\n\t\tregion := gs.rm[matchLoopID]\n\t\treturn region.Data\n\t}\n\n\treturn nil\n}", "func getIngredientPosition(ingredient_id int) (int, int) {\n \n db := getDBConnection()\n defer db.Close()\n \n sqlstr := `select d.id, d.rail_position\n from dispenser d\n inner join ingredient i on i.id = d.ingredient_id\n where i.id = ?\n `\n row := db.QueryRow(sqlstr, ingredient_id)\n\n var dispenser_id int\n var rail_position int\n\n err := row.Scan(&dispenser_id, &rail_position)\n if err == sql.ErrNoRows {\n fmt.Printf(\"getIngredientPosition: ingredient_id = %d not found!\\n\", ingredient_id)\n return -1, -1\n }\n if err != nil {\n panic(fmt.Sprintf(\"getIngredientPosition failed: %v\", err))\n }\n fmt.Printf(\"getIngredientPosition: ingredient_id=[%d] is on dispenser_id=[%d], position=[%d]\\n\", ingredient_id, dispenser_id, rail_position)\n\n return rail_position,dispenser_id\n}", "func (t *Tool) QueryLocation() *LocationQuery {\n\treturn (&ToolClient{config: t.config}).QueryLocation(t)\n}", "func (s *PersonStore) MustFindOne(q *PersonQuery) *Person {\n\trecord, err := s.FindOne(q)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn record\n}", "func (s *service) GetByGeo(lat, lon float32) (*Status, error) {\n\treturn s.adapter.GetByGeo(lat, lon)\n}", "func (wo *WorkOrder) QueryLocation() *LocationQuery {\n\treturn (&WorkOrderClient{wo.config}).QueryLocation(wo)\n}", "func (c *PositionClient) Query() *PositionQuery {\n\treturn &PositionQuery{config: c.config}\n}", "func (c *PositionClient) Query() *PositionQuery {\n\treturn &PositionQuery{config: c.config}\n}", "func (c *PositionClient) Query() *PositionQuery {\n\treturn &PositionQuery{config: c.config}\n}", "func (db *AppDB) RetrieveLocationByProvider(provider string, chargerType []string) ([]PointInfoJS, error) {\r\n\tresults := []PointInfoJS{}\r\n\r\n\tctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\r\n\tdefer cancel()\r\n\r\n\tcur, err := db.MDB.Collection(db.Env.DBPointColl).Find(ctx, bson.M{\r\n\t\t// bson.M{\"provider\": provider})\r\n\t\t\"$or\": []bson.M{{\"provider\": provider}, {\"operator\": provider}}})\r\n\r\n\tif err != nil {\r\n\t\tlogger.Error.Println(\"retrieveInfoByProvider-query: \", err)\r\n\t\treturn []PointInfoJS{}, err\r\n\t}\r\n\tfor cur.Next(ctx) {\r\n\t\tvar p Point\r\n\t\terr := cur.Decode(&p)\r\n\t\tif err != nil {\r\n\t\t\tlogger.Error.Println(\"retrieveInfoByProvider-decoding: \", err)\r\n\t\t\treturn []PointInfoJS{}, err\r\n\t\t}\r\n\t\tpJS := parsePointInfo(p, chargerType)\r\n\t\tresults = append(results, pJS)\r\n\t}\r\n\r\n\treturn results, nil\r\n}", "func Get_city(ipaddress string) IP2Locationrecord {\n\treturn handleError(defaultDB.query(ipaddress, city))\n}", "func (l Location) GetLocation() (r Location, err error) {\n\tclient := &http.Client{}\n\treqAdd := fmt.Sprintf(\"https://maps.googleapis.com/maps/api/geocode/json?key=%s&address=%s\", os.Getenv(\"GOOGLE_API_KEY\"), strings.Replace(l.PostCode, \" \", \"%20\", -1))\n\treq, err := http.NewRequest(\"GET\", reqAdd, nil)\n\tif err != nil {\n\t\tfmt.Printf(\"Request: %v\", err)\n\t\treturn r, err\n\t}\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tfmt.Printf(\"Do: %v\", err)\n\t\treturn r, err\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tfmt.Printf(\"Body: %v\", err)\n\t\treturn r, err\n\t}\n\n\tj := GoogleResponse{}\n\terr = json.Unmarshal(body, &j)\n\tif err != nil {\n\t\tfmt.Printf(\"Unmarshal: %v\", err)\n\t\treturn r, err\n\t}\n\n\tif len(j.Results) >= 1 {\n\t\tr := Location{\n\t\t\tPostCode: l.PostCode,\n\t\t\tLongitude: j.Results[0].Geometry.Location.Longitude,\n\t\t\tLatitude: j.Results[0].Geometry.Location.Latitude,\n\t\t\tStreet: j.Results[0].AddressComponents[1].ShortName,\n\t\t}\n\t\treturn r, nil\n\t}\n\n\treturn r, errors.New(\"invalid postcode\")\n}", "func Get_mnc(ipaddress string) IP2Locationrecord {\n\treturn handleError(defaultDB.query(ipaddress, mnc))\n}", "func (l *Location) QueryParent() *LocationQuery {\n\treturn (&LocationClient{config: l.config}).QueryParent(l)\n}", "func (d *DB) Get_longitude(ipaddress string) (IP2Locationrecord, error) {\n\treturn d.query(ipaddress, longitude)\n}", "func (lq *LocationQuery) Count(ctx context.Context) (int, error) {\n\treturn lq.sqlCount(ctx)\n}" ]
[ "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.46138018", "0.46106666", "0.46106666", "0.46106666", "0.45905092", "0.4590358", "0.4577575", "0.4569475", "0.4549341", "0.4549341", "0.45481512", "0.45481354", "0.45479202", "0.45475218", "0.45431235", "0.4536967", "0.45349762", "0.45201033", "0.449004", "0.44838557", "0.44775924", "0.44446275", "0.44396058", "0.44375074", "0.44346216", "0.4433543", "0.44281086", "0.44238922", "0.44160542", "0.44134358", "0.4412589", "0.44022268", "0.44020307", "0.43976977", "0.43959087", "0.4392176", "0.43919808", "0.43847027", "0.43676767", "0.43675306", "0.43528664", "0.43443766", "0.4343527", "0.43157715", "0.4306446", "0.43063146", "0.43049976", "0.4303522", "0.43033442", "0.42984053", "0.4297144", "0.42968974", "0.42944634", "0.42905572", "0.42867622", "0.4285569", "0.42819512", "0.42782494", "0.42740196", "0.42638505", "0.42626297", "0.42595544", "0.42552295", "0.42529687", "0.4248685", "0.42483944", "0.4246382", "0.42453912", "0.42324892", "0.42269504", "0.42233193", "0.42233193", "0.42233193", "0.4219092", "0.42188117", "0.42065826", "0.4199339", "0.4198359", "0.41942284", "0.41820315" ]
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 = sanitize.SingleLineString(row.LocationHash)\n\n\t// Validate LocationHash.\n\tif err := validate.NonEmptyString(row.LocationHash); err != nil {\n\t\te := err.(errors.Error)\n\t\treturn e.Wrap(\"Validation failed on LocationHash.\")\n\t}\n\n\t// Sanitize LocationString.\n\trow.LocationString = sanitize.SingleLineString(row.LocationString)\n\n\t// Validate LocationString.\n\tif err := validate.NonEmptyString(row.LocationString); err != nil {\n\t\te := err.(errors.Error)\n\t\treturn e.Wrap(\"Validation failed on LocationString.\")\n\t}\n\n\t// Execute query.\n\tresult, err := db.Exec(updateQuery_Location,\n\t\trow.ParsedCountryCode,\n\t\trow.ParsedPostalCode,\n\t\trow.GeonamesPostalCodes,\n\t\trow.GeonameID,\n\t\trow.GeonamesHierarchy,\n\t\trow.Approved,\n\t\trow.DatasetID,\n\t\trow.LocationHash)\n\tif err == nil {\n\t\tn, err := result.RowsAffected()\n\t\tif err != nil {\n\t\t\treturn errors.Unexpected.\n\t\t\t\tWrap(\"Location update rows affected failed: %w\", err).\n\t\t\t\tAlert()\n\t\t}\n\t\tswitch n {\n\t\tcase 1:\n\t\t\treturn nil\n\n\t\tcase 0:\n\t\t\treturn errors.DBNotFound\n\n\t\tdefault:\n\t\t\treturn errors.Unexpected.\n\t\t\t\tWrap(\"Location update affected %d rows.\", n).\n\t\t\t\tAlert()\n\t\t}\n\t}\n\n\t// Return application error.\n\tif err := translateDBError(err); err != nil {\n\t\treturn err\n\t}\n\n\treturn errors.Unexpected.\n\t\tWrap(\"Location update failed: %w\", err).\n\t\tAlert()\n}", "func (dao *LocationDAO) UpdatePickupLocation(c models.PickupLocation, dict map[string]interface{}) error {\n\tstmt := buildPatchUpdate(\"pickup_locations\", \"pul_id\", dict)\n\terr := execCheckRows(dao.DB, stmt, c)\n\treturn err\n}", "func (d *DynamoConn) UpdateLocation(userID string, location []float64) error {\n\tvar LocationUpdate struct {\n\t\tLastKnownLocation []float64 `json:\":l\"`\n\t}\n\n\t// Marshal the update expression struct for DynamoDB\n\tLocationUpdate.LastKnownLocation = location\n\texpr, err := dynamodbattribute.MarshalMap(LocationUpdate)\n\tif err != nil {\n\t\treturn err\n\n\t}\n\n\t// Define table schema's key\n\tkey := map[string]*dynamodb.AttributeValue{\n\t\t\"user_id\": {\n\t\t\tS: aws.String(userID),\n\t\t},\n\t}\n\n\t// Use marshalled map for UpdateItemInput\n\titem := &dynamodb.UpdateItemInput{\n\t\tExpressionAttributeValues: expr,\n\t\tTableName: aws.String(common.UsersTableName),\n\t\tKey: key,\n\t\tReturnValues: aws.String(\"UPDATED_NEW\"),\n\t\tUpdateExpression: aws.String(\"set last_known_location = :l\"),\n\t}\n\n\t_, err = d.Client.UpdateItem(item)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func UpdateLocation(data models.Location, LicenseNo string)(int64, error){\n\tresult, err := updateLocationStmt.Exec(\n\t\tdata.Latitude,\n\t\tdata.Longitude,\n\t\tdata.Speed, \n\t\tdata.Heading, \n\t\tLicenseNo,\n\t)\n\t\n\trowsAffected , _ := result.RowsAffected()\n\treturn rowsAffected , err\n}", "func (o *RawVisit) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\trawVisitUpdateCacheMut.RLock()\n\tcache, cached := rawVisitUpdateCache[key]\n\trawVisitUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\trawVisitAllColumns,\n\t\t\trawVisitPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update raw_visits, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"raw_visits\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, rawVisitPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(rawVisitType, rawVisitMapping, append(wl, rawVisitPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update raw_visits row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for raw_visits\")\n\t}\n\n\tif !cached {\n\t\trawVisitUpdateCacheMut.Lock()\n\t\trawVisitUpdateCache[key] = cache\n\t\trawVisitUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (o *Weather) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tweatherUpdateCacheMut.RLock()\n\tcache, cached := weatherUpdateCache[key]\n\tweatherUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tweatherColumns,\n\t\t\tweatherPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"db: unable to update weather, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"prh\\\".\\\"weather\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, weatherPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(weatherType, weatherMapping, append(wl, weatherPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"db: unable to update weather row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"db: failed to get rows affected by update for weather\")\n\t}\n\n\tif !cached {\n\t\tweatherUpdateCacheMut.Lock()\n\t\tweatherUpdateCache[key] = cache\n\t\tweatherUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (s *LocationsOp) Update(ctx context.Context, locationID int, update LocationUpdate) (*Location, *http.Response, error) {\n\tpath := fmt.Sprintf(\"%s/%d\", locationsPath, locationID)\n\n\treq, err := s.client.NewRequest(ctx, http.MethodPut, path, update)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tlocation := new(Location)\n\tresp, err := s.client.Do(ctx, req, location)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn location, resp, err\n}", "func (ls *LocationService) Update(locID string, l *Location) error {\n\t// PUT: /location/:locationID\n\tif l == nil {\n\t\treturn fmt.Errorf(\"nil Location\")\n\t}\n\treq, err := ls.c.NewRequest(\"PUT\", \"/location/\"+locID, l)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO: return any response?\n\treturn ls.c.Do(req, nil)\n}", "func (h *LocationHandler) update(w http.ResponseWriter, r *http.Request) {\n\tvar location Location\n\tdecoder := json.NewDecoder(r.Body)\n\tif err := decoder.Decode(&location); err != nil {\n\t\tRespondWithError(w, http.StatusBadRequest, \"Invalid Location Data\")\n\t\treturn\n\t}\n\n\tif err := h.locRepo.updateLocation(&location); err != nil {\n\t\tRespondWithError(w, http.StatusInternalServerError, \"Unable to update location\")\n\t\treturn\n\t}\n\tRespondWithJSON(w, http.StatusCreated, nil)\n}", "func (l *Location) Update() *LocationUpdateOne {\n\treturn (&LocationClient{config: l.config}).UpdateOne(l)\n}", "func (l *Location) Update() *LocationUpdateOne {\n\treturn (&LocationClient{l.config}).UpdateOne(l)\n}", "func (r *Entity) Update() (result sql.Result, err error) {\n\treturn Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()\n}", "func (r *Entity) Update() (result sql.Result, err error) {\n\treturn Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()\n}", "func (r *Entity) Update() (result sql.Result, err error) {\n\treturn Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()\n}", "func (r *Entity) Update() (result sql.Result, err error) {\n\treturn Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()\n}", "func (r *Entity) Update() (result sql.Result, err error) {\n\treturn Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()\n}", "func (controller *LocationController) Update(c *gin.Context) {\n\tvar location models.UpdateLocationRequest\n\terr := c.ShouldBindJSON(&location)\n\tif err != nil {\n\t\tcontroller.HandleError(c, err)\n\t\treturn\n\t}\n\n\t// Check if editing own user\n\tid, err := controller.GetRequestID(c, \"id\")\n\tif err != nil {\n\t\tcontroller.HandleError(c, err)\n\t\treturn\n\t}\n\tsessionID, isLogged := c.Get(\"userID\")\n\tif !isLogged {\n\t\tcontroller.HandleError(c, core.ErrorNotLogged)\n\t\treturn\n\t}\n\tif id != sessionID {\n\t\tcontroller.HandleError(c, core.ErrorNoPermission)\n\t\treturn\n\t}\n\n\t// Update the location of the user\n\tpreviousLocation, err := controller.LocationService.Get(id)\n\tif previousLocation == nil ||\n\t\terr != nil {\n\t\t_, err = controller.LocationService.Create(id, location.Latitude, location.Longitude)\n\t\tif err != nil {\n\t\t\tcontroller.HandleError(c, err)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\terr = controller.LocationService.Update(id, location.Latitude, location.Longitude)\n\t\tif err != nil {\n\t\t\tcontroller.HandleError(c, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tc.Status(http.StatusNoContent)\n}", "func (lu *LocationUpdate) Save(ctx context.Context) (int, error) {\n\tif lu.update_time == nil {\n\t\tv := location.UpdateDefaultUpdateTime()\n\t\tlu.update_time = &v\n\t}\n\tif lu.name != nil {\n\t\tif err := location.NameValidator(*lu.name); err != nil {\n\t\t\treturn 0, fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %v\", err)\n\t\t}\n\t}\n\tif lu.latitude != nil {\n\t\tif err := location.LatitudeValidator(*lu.latitude); err != nil {\n\t\t\treturn 0, fmt.Errorf(\"ent: validator failed for field \\\"latitude\\\": %v\", err)\n\t\t}\n\t}\n\tif lu.longitude != nil {\n\t\tif err := location.LongitudeValidator(*lu.longitude); err != nil {\n\t\t\treturn 0, fmt.Errorf(\"ent: validator failed for field \\\"longitude\\\": %v\", err)\n\t\t}\n\t}\n\tif len(lu._type) > 1 {\n\t\treturn 0, errors.New(\"ent: multiple assignments on a unique edge \\\"type\\\"\")\n\t}\n\tif lu.clearedType && lu._type == nil {\n\t\treturn 0, errors.New(\"ent: clearing a unique edge \\\"type\\\"\")\n\t}\n\tif len(lu.parent) > 1 {\n\t\treturn 0, errors.New(\"ent: multiple assignments on a unique edge \\\"parent\\\"\")\n\t}\n\treturn lu.sqlSave(ctx)\n}", "func (r *Entity) Update() (result sql.Result, err error) {\n\twhere, args, err := gdb.GetWhereConditionOfStruct(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn Model.Data(r).Where(where, args).Update()\n}", "func (luo *LocationUpdateOne) Save(ctx context.Context) (*Location, error) {\n\tif luo.update_time == nil {\n\t\tv := location.UpdateDefaultUpdateTime()\n\t\tluo.update_time = &v\n\t}\n\tif luo.name != nil {\n\t\tif err := location.NameValidator(*luo.name); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %v\", err)\n\t\t}\n\t}\n\tif luo.latitude != nil {\n\t\tif err := location.LatitudeValidator(*luo.latitude); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"ent: validator failed for field \\\"latitude\\\": %v\", err)\n\t\t}\n\t}\n\tif luo.longitude != nil {\n\t\tif err := location.LongitudeValidator(*luo.longitude); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"ent: validator failed for field \\\"longitude\\\": %v\", err)\n\t\t}\n\t}\n\tif len(luo._type) > 1 {\n\t\treturn nil, errors.New(\"ent: multiple assignments on a unique edge \\\"type\\\"\")\n\t}\n\tif luo.clearedType && luo._type == nil {\n\t\treturn nil, errors.New(\"ent: clearing a unique edge \\\"type\\\"\")\n\t}\n\tif len(luo.parent) > 1 {\n\t\treturn nil, errors.New(\"ent: multiple assignments on a unique edge \\\"parent\\\"\")\n\t}\n\treturn luo.sqlSave(ctx)\n}", "func (o *Origin) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\t}\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\toriginUpdateCacheMut.RLock()\n\tcache, cached := originUpdateCache[key]\n\toriginUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\toriginColumns,\n\t\t\toriginPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update origins, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"origins\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, originPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(originType, originMapping, append(wl, originPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update origins row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for origins\")\n\t}\n\n\tif !cached {\n\t\toriginUpdateCacheMut.Lock()\n\t\toriginUpdateCache[key] = cache\n\t\toriginUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func UpdateCachedLocationWeather(cityName string, tempMin, tempMax float64, labels ...string) (QueryResult, error) {\n\tvar (\n\t\tquery string\n\t\tstmt *sql.Stmt\n\t\trow *sql.Row\n\t\terr error\n\t)\n\n\ttxn, txnError := GlobalConn.Begin()\n\tif txnError != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer func() {\n\t\tif err != nil {\n\t\t\ttxn.Rollback()\n\t\t\treturn\n\t\t}\n\n\t\terr = txn.Commit()\n\t}()\n\n\tquery = `\n\t\tinsert into locations (city_name, query_count)\n\t\t\tvalues ($1, $2)\n\t\ton conflict (city_name) do\n\t\t\tupdate\n\t\t\t\tset query_count = locations.query_count + 1\n\t\treturning\n\t\t\tid, city_name, query_count`\n\n\tstmt, err = txn.Prepare(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlr := &LocationRow{}\n\n\trow = stmt.QueryRow(cityName, 1)\n\tif err = row.Scan(&lr.ID, &lr.CityName, &lr.QueryCount); err != nil {\n\t\treturn nil, err\n\t}\n\n\tstmt.Close()\n\n\tquery = `\n\t\tinsert into weather (location_id, labels, temp_low, temp_high, at_time)\n\t\t\tvalues ($1, $2, $3, $4, $5)\n\t\treturning\n\t\t\tlocation_id, labels, temp_high, temp_low, at_time`\n\n\tstmt, err = txn.Prepare(query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\twr := &WeatherRow{}\n\n\trow = stmt.QueryRow(lr.ID, pq.StringArray(labels), tempMin, tempMax, time.Now())\n\tif err := row.Scan(\n\t\t&wr.LocationRowID,\n\t\t&wr.Labels,\n\t\t&wr.TempHigh,\n\t\t&wr.TempLow,\n\t\t&wr.AtTime); err != nil {\n\t\treturn nil, err\n\t}\n\n\tstmt.Close()\n\n\treturn QueryResult{\n\t\t\"location\": lr,\n\t\t\"weather\": wr,\n\t}, nil\n}", "func (rc ResponseController) UpdateLocation(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tid := p.ByName(\"id\")\n\tfmt.Println(\"PUT Request: ID:\", id)\n\t\n\tvar req PostRequest\n\tvar resp Response\n\n\tif !bson.IsObjectIdHex(id) {\n\t\tw.WriteHeader(404)\n\t\tfmt.Println(\"Response: 404 Not Found\")\n\t\treturn\n\t}\n\n\tdefer r.Body.Close()\n\tjsonIn, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tfmt.Println(\"[email protected]\")\n\t\tpanic(err)\n\t}\n\n\tjson.Unmarshal([]byte(jsonIn), &req)\n\tfmt.Println(\"PUT Request:\", req)\n\t\n\tresp.Coordinate = req.Coordinate\n\toid := bson.ObjectIdHex(id)\n\tresp.ID = oid;\n\n\tif err := rc.session.DB(\"cmpe277\").C(\"userlocations\").UpdateId(oid, resp); err != nil {\n\t\tw.WriteHeader(404)\n\t\tfmt.Println(\"Response: 404 Not Found\")\n\t\treturn\n\t}\n\n\tjsonOut, _ := json.Marshal(resp)\n\thttpResponse(w, jsonOut, 201)\n\tfmt.Println(\"Response:\", string(jsonOut), \" 201 OK\")\n}", "func (r *NamedLocationRequest) Update(ctx context.Context, reqObj *NamedLocation) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func UpdateLocation(c context.Context) {\n\tlog.Println(c.Request().URL)\n\t// log.Println(c.CO)\n\tvar res structs.Response\n\n\tloc := &api.UpdateLocation{}\n\tif err := c.ReadJSON(loc); err != nil {\n\t\tlog.Println(err)\n\n\t\treturn\n\t}\n\tlog.Println(loc)\n\tuserIDint, errStrConv := strconv.Atoi(c.Params().Get(\"id\"))\n\thelper.CheckError(\"failed convert user id\", errStrConv)\n\n\tupdateLocationData := models.HistoryPosition{\n\t\tLatitude: loc.Latitude,\n\t\tLongitude: loc.Longitude,\n\t\tAccuracy: loc.Accuracy,\n\t\tUserID: userIDint,\n\t}\n\n\tuser.UpdateNewPositionDriver(\n\t\tupdateLocationData,\n\t\t&res.Errors,\n\t)\n\n\tif len(res.Errors) > 0 {\n\t\tc.StatusCode(iris.StatusBadRequest)\n\t}\n\n\t_, errWrite := c.JSON(res)\n\thelper.CheckError(\"Failed write response json \", errWrite)\n}", "func (o *RentalRower) Update(exec boil.Executor, columns boil.Columns) (int64, error) {\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\to.UpdatedAt = currTime\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\trentalRowerUpdateCacheMut.RLock()\n\tcache, cached := rentalRowerUpdateCache[key]\n\trentalRowerUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\trentalRowerColumns,\n\t\t\trentalRowerPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update rental_rowers, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"rental_rowers\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, rentalRowerPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(rentalRowerType, rentalRowerMapping, append(wl, rentalRowerPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update rental_rowers row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for rental_rowers\")\n\t}\n\n\tif !cached {\n\t\trentalRowerUpdateCacheMut.Lock()\n\t\trentalRowerUpdateCache[key] = cache\n\t\trentalRowerUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(exec)\n}", "func (u *InformationRepository) Update(model *models.Information, data map[string]interface{}) error {\n\tquery := u.InformationTable().Model(model).Updates(data)\n\tif err := query.Error; err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *FloorStorage) Update(c model.Floor) error {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\n\t_, exists := s.data[c.ID]\n\tif !exists {\n\t\treturn fmt.Errorf(\"Floor with id %s does not exist\", c.ID)\n\t}\n\ts.data[c.ID] = &c\n\n\treturn nil\n}", "func (Model) Update(model interface{}, field string, value interface{}) {\n\twhereValues := make(map[string]interface{})\n\twhereValues[field] = value\n\tdb.Update(model, whereValues)\n}", "func (lc *LocationController) UpdateDriverLocation(\n\tdriverID int32,\n\tcur_loc_lat float32,\n\tcur_loc_lng float32) (interface{}, error) {\n\n\t// get current driver status\n\tdriverExistObj, err := lc.locationService.GetObject(Object_Collection_Fleet, driverID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// check if response object is empty\n\tif driverExistObj == nil {\n\t\treturn nil, errors.New(\"response object is empty\")\n\t}\n\n\t// check if ok is false\n\t// example: id not found\n\tif driverExistObj.Ok == false {\n\t\treturn nil, errors.New(driverExistObj.Error)\n\t}\n\n\t// if driver is currently not available, throw error: cannot update driver location when driver is not available\n\tif driverExistObj.Ok && driverExistObj.Fields.DriverID != 0 && driverExistObj.Fields.Status == DriverStatus_NOTAVAILABLE {\n\t\treturn nil, errors.New(\"cannot update driver location when driver is not available\")\n\t}\n\n\t// Construct LocationObject in GeoJSON format\n\tlocationObj := new(LocationObject)\n\tlocationObj.Type = LocationObject_Type_Point\n\tlocationObj.Coordinates = [2]float32{cur_loc_lat, cur_loc_lng}\n\ttimeNow := time.Now().Unix()\n\tfields := LocationObject_Fields{\n\t\t//\"driverid\": driverID,\n\t\t//\"providerid\": providerID,\n\t\t//\"driverstatus\": int32(status),\n\t\t//\"jobid\": jobId,\n\t\t//\"activeserviceid\": 0,\n\t\t//\"activeservicetypeid\": 0,\n\t\t//\"priority\": 0,\n\t\t\"lastupdatedtime\": timeNow,\n\t}\n\n\t// Update objects of fleet collection, with fleet type and driver id\n\tres, err := lc.locationService.SetObject(Object_Collection_Fleet, driverID, locationObj, fields)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// check if ok is false\n\tif res.Ok == false {\n\t\treturn nil, errors.New(res.Error)\n\t}\n\n\tlog.Printf(\"Driver location updated: %v\\n\", res.Ok)\n\treturn res, nil\n}", "func (o *RestaurantRank) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\trestaurantRankUpdateCacheMut.RLock()\n\tcache, cached := restaurantRankUpdateCache[key]\n\trestaurantRankUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\trestaurantRankAllColumns,\n\t\t\trestaurantRankPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update restaurant_rank, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"restaurant_rank\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, restaurantRankPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(restaurantRankType, restaurantRankMapping, append(wl, restaurantRankPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update restaurant_rank row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for restaurant_rank\")\n\t}\n\n\tif !cached {\n\t\trestaurantRankUpdateCacheMut.Lock()\n\t\trestaurantRankUpdateCache[key] = cache\n\t\trestaurantRankUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (rt *RTree) Update(mmsi uint32, oldLat, oldLong, newLat, newLong float64) {\n\toldR, err := NewRectangle(oldLat, oldLong, oldLat, oldLong)\n\tCheckErr(err, \"Illegal coordinates, please use <latitude, longitude> coodinates\")\n\terr = rt.delete(mmsi, oldR)\n\tCheckErr(err, \"Deletion failed\")\n\terr = rt.InsertData(newLat, newLong, mmsi)\n\tCheckErr(err, \"The Update func had some trouble updating the position of the boat\")\n}", "func (dao *LocationDAO) UpdateReceivingLocation(location models.ReceivingLocation, dict map[string]interface{}) error {\n\tstmt := buildPatchUpdate(\"receiving_locations\", \"rcl_id\", dict)\n\terr := execCheckRows(dao.DB, stmt, location)\n\treturn err\n}", "func (lc LocationController) ModifyLocation(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\t// Grab id\n\tid := p.ByName(\"id\")\n\n\t// Verify id is ObjectId, otherwise bail\n\tif !bson.IsObjectIdHex(id) {\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\n\t// Grab id\n\toid := bson.ObjectIdHex(id)\n\t// Stub a location to be populated from the body\n\n\tvar locationObject Location\n\tvar retrivedObject Location\n\n\t//String to store address\n\tvar queryParamBuilder string\n\t// Populate the user data\n\tjson.NewDecoder(r.Body).Decode(&locationObject)\n\n\taddressKeys := strings.Fields(locationObject.Address)\n\tcityKeys := strings.Fields(locationObject.City)\n\tstateKeys := strings.Fields(locationObject.State)\n\tkeys := append(addressKeys, cityKeys...)\n\tlocationKeys := append(keys, stateKeys...)\n\tfor i := 0; i < len(locationKeys); i++ {\n\t\tif i == len(locationKeys)-1 {\n\t\t\tqueryParamBuilder += locationKeys[i]\n\t\t} else {\n\t\t\tqueryParamBuilder += locationKeys[i] + \"+\"\n\t\t}\n\t}\n\turl := fmt.Sprintf(\"http://maps.google.com/maps/api/geocode/json?address=%s&sensor=false\", queryParamBuilder)\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// read json http response\n\tjsonDataFromHTTP, err := ioutil.ReadAll(resp.Body)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tvar coordinates CoordinateResponse\n\n\terr = json.Unmarshal(jsonDataFromHTTP, &coordinates) // here!\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif len(coordinates.Results) == 0 {\n\t\tw.WriteHeader(400)\n\t\treturn\n\t}\n\tlocationObject.Coordinate.Lat = coordinates.Results[0].Geometry.Location.Lat\n\tlocationObject.Coordinate.Lng = coordinates.Results[0].Geometry.Location.Lng\n\n\t//Fetch user\n\tif err := lc.session.DB(\"go_rest_api_assignment2\").C(\"locations\").FindId(oid).One(&retrivedObject); err != nil {\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\tlocationObject.Name = retrivedObject.Name\n\tlocationObject.ID = retrivedObject.ID\n\tif locationObject.City == \"\" {\n\t\tlocationObject.City = retrivedObject.City\n\t}\n\tif locationObject.Address == \"\" {\n\t\tlocationObject.Address = retrivedObject.Address\n\t}\n\tif locationObject.State == \"\" {\n\t\tlocationObject.State = retrivedObject.State\n\t}\n\tif locationObject.Zip == \"\" {\n\t\tlocationObject.Zip = retrivedObject.Zip\n\t}\n\tif err := lc.session.DB(\"go_rest_api_assignment2\").C(\"locations\").RemoveId(oid); err != nil {\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\t// Write the user to mongo\n\tlc.session.DB(\"go_rest_api_assignment2\").C(\"locations\").Insert(locationObject)\n\n\t// Marshal provided interface into JSON structure\n\n\tuj, _ := json.Marshal(locationObject)\n\n\t// Write content-type, statuscode, payload\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(201)\n\tfmt.Fprintf(w, \"%s\", uj)\n\n}", "func (o *Address) Update(exec boil.Executor, whitelist ...string) error {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn err\n\t}\n\tkey := makeCacheKey(whitelist, nil)\n\taddressUpdateCacheMut.RLock()\n\tcache, cached := addressUpdateCache[key]\n\taddressUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(\n\t\t\taddressColumns,\n\t\t\taddressPrimaryKeyColumns,\n\t\t\twhitelist,\n\t\t)\n\n\t\tif len(whitelist) == 0 {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"sqlboiler: unable to update address, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `address` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, addressPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(addressType, addressMapping, append(wl, addressPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sqlboiler: unable to update address row\")\n\t}\n\n\tif !cached {\n\t\taddressUpdateCacheMut.Lock()\n\t\taddressUpdateCache[key] = cache\n\t\taddressUpdateCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpdateHooks(exec)\n}", "func (u *Union) Update(row Row) error {\n\tfor i := range u.Extractors {\n\t\tif err := u.Extractors[i].Update(row); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (t *DataTable) Update(at int, row Row) error {\n\tif row == nil {\n\t\trow = make(Row, 0)\n\t}\n\n\tfor _, col := range t.cols {\n\t\tif col.IsComputed() {\n\t\t\tcontinue\n\t\t}\n\t\tcell, ok := row[col.name]\n\t\tif ok {\n\t\t\tif err := col.serie.Set(at, cell); err != nil {\n\t\t\t\terr := errors.Wrapf(err, \"col %s\", col.name)\n\t\t\t\treturn errors.Wrap(err, ErrUpdateRow.Error())\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif err := col.serie.Set(at, nil); err != nil {\n\t\t\terr := errors.Wrapf(err, \"col %s\", col.name)\n\t\t\treturn errors.Wrap(err, ErrUpdateRow.Error())\n\t\t}\n\t}\n\n\treturn nil\n}", "func (dao *LocationDAO) UpdateStockingLocation(location models.StockingLocation, dict map[string]interface{}) error {\n\tstmt := buildPatchUpdate(\"stocking_locations\", \"stl_id\", dict)\n\terr := execCheckRows(dao.DB, stmt, location)\n\treturn err\n}", "func (s *Session) UpdateRow(param map[string]interface{}) (int64, error) {\n\tif param == nil {\n\t\treturn 0, UpdateRowParamMustHaveValue\n\t}\n\ts.statement.stType = UpdateStatement\n\tif len(s.statement.conditions) == 0 || s.statement.table == \"\" {\n\t\treturn 0, UpdateRowMustWithConditionAndTableName\n\t}\n\tupdateFields := make([]string, 0)\n\tval := make([]interface{}, 0)\n\tfor k, v := range param {\n\t\tupdateFields = append(updateFields, k)\n\t\tval = append(val, v)\n\t}\n\ts.Columns(updateFields...)\n\ts.statement.Values(val)\n\tsql, args, err := s.statement.ToSQL()\n\ts.logger.Debugf(\"[Session UpdateRow] sql: %s, args: %v\", sql, args)\n\ts.initCtx()\n\tsResult, err := s.ExecContext(s.ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn sResult.RowsAffected()\n}", "func (s *InventoryApiService) UpdateLocation(id string, location Location, w http.ResponseWriter) error {\n\tif id != location.Id {\n\t\tmessage := fmt.Sprintf(\"Mismatched path id: %s and location.Id: %s \", id, location.Id)\n\t\treturn EncodeJSONStatus(http.StatusBadRequest, message, w)\n\t}\n\tif location.Name == \"\" {\n\t\treturn requiredFieldMissing(\"name\", w)\n\t}\n\tif location.Warehouse == \"\" {\n\t\treturn requiredFieldMissing(\"warehouse\", w)\n\t}\n\n\tctx := context.Background()\n\tr, err := s.db.UpdateLocation(ctx, &location)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn EncodeJSONResponse(r, nil, w)\n}", "func (w *Wrapper) Update(data interface{}) (err error) {\n\tw.query = w.buildUpdate(data)\n\t_, err = w.executeQuery()\n\treturn\n}", "func (o *Store) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\to.UpdatedAt = currTime\n\t}\n\n\tvar err error\n\tkey := makeCacheKey(columns, nil)\n\tstoreUpdateCacheMut.RLock()\n\tcache, cached := storeUpdateCache[key]\n\tstoreUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tstoreAllColumns,\n\t\t\tstorePrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update stores, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"stores\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, storePrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(storeType, storeMapping, append(wl, storePrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update stores row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for stores\")\n\t}\n\n\tif !cached {\n\t\tstoreUpdateCacheMut.Lock()\n\t\tstoreUpdateCache[key] = cache\n\t\tstoreUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, nil\n}", "func (o *Doc) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\t}\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tdocUpdateCacheMut.RLock()\n\tcache, cached := docUpdateCache[key]\n\tdocUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tdocAllColumns,\n\t\t\tdocPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update doc, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `doc` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, docPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(docType, docMapping, append(wl, docPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update doc row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for doc\")\n\t}\n\n\tif !cached {\n\t\tdocUpdateCacheMut.Lock()\n\t\tdocUpdateCache[key] = cache\n\t\tdocUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (o *Jet) Update(exec boil.Executor, whitelist ...string) error {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn err\n\t}\n\tkey := makeCacheKey(whitelist, nil)\n\tjetUpdateCacheMut.RLock()\n\tcache, cached := jetUpdateCache[key]\n\tjetUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(\n\t\t\tjetColumns,\n\t\t\tjetPrimaryKeyColumns,\n\t\t\twhitelist,\n\t\t)\n\n\t\tif len(whitelist) == 0 {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"models: unable to update jets, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `jets` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, jetPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(jetType, jetMapping, append(wl, jetPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update jets row\")\n\t}\n\n\tif !cached {\n\t\tjetUpdateCacheMut.Lock()\n\t\tjetUpdateCache[key] = cache\n\t\tjetUpdateCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpdateHooks(exec)\n}", "func (config *CrocConfig) EditLocation(editLocation LocationAttributes, locationID int) (Location, error) {\n\tvar locationDetails Location\n\tendpoint := fmt.Sprintf(\"locations/%d\", locationID)\n\n\telbytes, err := json.Marshal(editLocation)\n\tif err != nil {\n\t\treturn locationDetails, err\n\t}\n\n\t// get json bytes from the panel.\n\tlbytes, err := config.queryPanelAPI(endpoint, \"patch\", elbytes)\n\tif err != nil {\n\t\treturn locationDetails, err\n\t}\n\n\t// Get server info from the panel\n\t// Unmarshal the bytes to a usable struct.\n\terr = json.Unmarshal(lbytes, &locationDetails)\n\tif err != nil {\n\t\treturn locationDetails, err\n\t}\n\n\treturn locationDetails, nil\n}", "func (f *FakeTable) UpdateRow(ovs *libovsdb.OvsdbClient, ovsdbRow map[string]interface{}, condition []string) error {\n\treturn nil\n}", "func (o *BoardsSectionsPosition) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tboardsSectionsPositionUpdateCacheMut.RLock()\n\tcache, cached := boardsSectionsPositionUpdateCache[key]\n\tboardsSectionsPositionUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tboardsSectionsPositionAllColumns,\n\t\t\tboardsSectionsPositionPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"rdb: unable to update boards_sections_positions, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `boards_sections_positions` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, boardsSectionsPositionPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(boardsSectionsPositionType, boardsSectionsPositionMapping, append(wl, boardsSectionsPositionPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"rdb: unable to update boards_sections_positions row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"rdb: failed to get rows affected by update for boards_sections_positions\")\n\t}\n\n\tif !cached {\n\t\tboardsSectionsPositionUpdateCacheMut.Lock()\n\t\tboardsSectionsPositionUpdateCache[key] = cache\n\t\tboardsSectionsPositionUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (o *Project) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\t}\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tprojectUpdateCacheMut.RLock()\n\tcache, cached := projectUpdateCache[key]\n\tprojectUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tprojectAllColumns,\n\t\t\tprojectPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update projects, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `projects` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, projectPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(projectType, projectMapping, append(wl, projectPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update projects row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for projects\")\n\t}\n\n\tif !cached {\n\t\tprojectUpdateCacheMut.Lock()\n\t\tprojectUpdateCache[key] = cache\n\t\tprojectUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (ds *MySQL) Update(q QueryMap, payload map[string]interface{}) (interface{}, error) {\n\tbuilder := ds.adapter.Builder()\n\tSQL := builder.Update(ds.source).Set(payload).Where(q).Limit(1, 0).Build()\n\tif ds.debug {\n\t\tfmt.Println(\"Update SQL: \", SQL)\n\t}\n\t_, err := ds.adapter.Exec(SQL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar p ParamsMap\n\t// Checking for updated fields\n\tfor key, v := range payload {\n\t\tif _, ok := q[key]; ok {\n\t\t\tq[key] = v\n\t\t}\n\t}\n\treturn ds.Find(q, p)\n}", "func (table *Table) Update(db DB, record Map) (Result, error) {\n\tc := Context{StateUpdate, db, table, table, record, Field{}}\n\treturn table.execAction(c, table.OnUpdate, table.DefaultUpdate)\n}", "func (o *Latency) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\to.UpdatedAt = currTime\n\t}\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tlatencyUpdateCacheMut.RLock()\n\tcache, cached := latencyUpdateCache[key]\n\tlatencyUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tlatencyAllColumns,\n\t\t\tlatencyPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update latencies, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"latencies\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, latencyPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(latencyType, latencyMapping, append(wl, latencyPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update latencies row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for latencies\")\n\t}\n\n\tif !cached {\n\t\tlatencyUpdateCacheMut.Lock()\n\t\tlatencyUpdateCache[key] = cache\n\t\tlatencyUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (dao *LocationDAO) UpdatePickContainerLocation(c models.PickContainerLocation, dict map[string]interface{}) error {\n\tstmt := buildPatchUpdate(\"pick_container_locations\", \"pcl_id\", dict)\n\terr := execCheckRows(dao.DB, stmt, c)\n\treturn err\n}", "func (o *Building) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\to.UpdatedAt = currTime\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tbuildingUpdateCacheMut.RLock()\n\tcache, cached := buildingUpdateCache[key]\n\tbuildingUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tbuildingColumns,\n\t\t\tbuildingPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"record: unable to update buildings, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"buildings\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, buildingPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(buildingType, buildingMapping, append(wl, buildingPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: unable to update buildings row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: failed to get rows affected by update for buildings\")\n\t}\n\n\tif !cached {\n\t\tbuildingUpdateCacheMut.Lock()\n\t\tbuildingUpdateCache[key] = cache\n\t\tbuildingUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (ps *PlayerStore) Update(ctx context.Context, player store.Player) (*store.Player, error) {\n\tquery := `\n UPDATE players\n SET\n roster_id = COALESCE(NULLIF($2, CAST(0 AS BIGINT)), players.roster_id),\n first_name = COALESCE(NULLIF($3, ''), players.first_name),\n last_name = COALESCE(NULLIF($4, ''), players.last_name),\n alias = COALESCE(NULLIF($5, ''), players.alias),\n\tstatus = COALESCE(NULLIF($6, ''), players.status)\n WHERE id = $1\n RETURNING *`\n\n\tdb := ps.db.GetDB()\n\tctx, cancel := ps.db.RequestContext(ctx)\n\tdefer cancel()\n\n\tvar p store.Player\n\terr := db.QueryRowContext(ctx, query,\n\t\tplayer.PlayerID,\n\t\tplayer.RosterID,\n\t\tplayer.FirstName,\n\t\tplayer.LastName,\n\t\tplayer.Alias,\n\t\tplayer.Status).\n\t\tScan(\n\t\t\t&p.PlayerID,\n\t\t\t&p.RosterID,\n\t\t\t&p.FirstName,\n\t\t\t&p.LastName,\n\t\t\t&p.Alias,\n\t\t\t&p.Status)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &p, nil\n}", "func (o *HoldenAt) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tkey := makeCacheKey(columns, nil)\n\tholdenAtUpdateCacheMut.RLock()\n\tcache, cached := holdenAtUpdateCache[key]\n\tholdenAtUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tholdenAtAllColumns,\n\t\t\tholdenAtPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update HoldenAt, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"HoldenAt\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, holdenAtPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(holdenAtType, holdenAtMapping, append(wl, holdenAtPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update HoldenAt row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for HoldenAt\")\n\t}\n\n\tif !cached {\n\t\tholdenAtUpdateCacheMut.Lock()\n\t\tholdenAtUpdateCache[key] = cache\n\t\tholdenAtUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, nil\n}", "func (o *Item) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tkey := makeCacheKey(columns, nil)\n\titemUpdateCacheMut.RLock()\n\tcache, cached := itemUpdateCache[key]\n\titemUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\titemAllColumns,\n\t\t\titemPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update items, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"items\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 0, itemPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(itemType, itemMapping, append(wl, itemPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update items row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for items\")\n\t}\n\n\tif !cached {\n\t\titemUpdateCacheMut.Lock()\n\t\titemUpdateCache[key] = cache\n\t\titemUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, nil\n}", "func (r *route) Update(routeGUID string, req RouteUpdateRequest, opts ...bool) (*RouteFields, error) {\n\tasync := true\n\tif len(opts) > 0 {\n\t\tasync = opts[0]\n\t}\n\trawURL := fmt.Sprintf(\"/v2/routes/%s?async=%t\", routeGUID, async)\n\trouteFields := RouteFields{}\n\t_, err := r.client.Put(rawURL, req, &routeFields)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &routeFields, nil\n}", "func (l *GeoLoc) Insert() error {\n\t// Get db instance\n\tdb, err := dstore.NewDB()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error retrieving DB instance: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// Insert\n\tvar row *sql.Row\n\n\t// Check if GeoLoc has been parsed\n\tif l.Located {\n\t\t// Check accuracy value\n\t\tif l.Accuracy == AccuracyErr {\n\t\t\treturn fmt.Errorf(\"invalid accuracy value: %s\",\n\t\t\t\tl.Accuracy)\n\t\t}\n\n\t\t// If so, save all fields\n\t\trow = db.QueryRow(\"INSERT INTO geo_locs (located, gapi_success\"+\n\t\t\t\", lat, long, postal_addr, accuracy, bounds_provided, \"+\n\t\t\t\"bounds_id, viewport_bounds_id, gapi_place_id, raw) \"+\n\t\t\t\"VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) \"+\n\t\t\t\"RETURNING id\",\n\t\t\tl.Located, l.GAPISuccess, l.Lat, l.Long, l.PostalAddr,\n\t\t\tl.Accuracy, l.BoundsProvided, l.BoundsID,\n\t\t\tl.ViewportBoundsID, l.GAPIPlaceID, l.Raw)\n\t} else {\n\t\t// If not, only save a couple, and leave rest null\n\t\trow = db.QueryRow(\"INSERT INTO geo_locs (located, raw) VALUES\"+\n\t\t\t\" ($1, $2) RETURNING id\",\n\t\t\tl.Located, l.Raw)\n\t}\n\n\t// Get inserted row ID\n\terr = row.Scan(&l.ID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error inserting row, Located: %t, err: %s\",\n\t\t\tl.Located, err.Error())\n\t}\n\n\treturn nil\n}", "func (o *Friendship) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tfriendshipUpdateCacheMut.RLock()\n\tcache, cached := friendshipUpdateCache[key]\n\tfriendshipUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tfriendshipAllColumns,\n\t\t\tfriendshipPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update friendship, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `friendship` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, friendshipPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(friendshipType, friendshipMapping, append(wl, friendshipPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update friendship row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for friendship\")\n\t}\n\n\tif !cached {\n\t\tfriendshipUpdateCacheMut.Lock()\n\t\tfriendshipUpdateCache[key] = cache\n\t\tfriendshipUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (p *PartialMutation) Update(sess sqlbuilder.SQLBuilder, structPtr interface{}, whereColumn, whereValue string, fieldMask []string, extraFields map[string]interface{}) error {\n\tif structPtr == nil || reflect.TypeOf(structPtr).Kind() != reflect.Ptr {\n\t\treturn fmt.Errorf(\"expecting a pointer but got %T\", structPtr)\n\t}\n\n\tvar (\n\t\tcolumns []string\n\t\tvalues []interface{}\n\t\terr error\n\t)\n\n\tincludeFields := p.includeFields\n\tif p.includeUpdateFields != nil {\n\t\tincludeFields = p.includeUpdateFields\n\t}\n\n\texcludeFields := p.excludeFields\n\tif p.excludeUpdateFields != nil {\n\t\texcludeFields = p.excludeUpdateFields\n\t}\n\n\tfieldMaskLen := len(fieldMask)\n\n\tif len(includeFields) > 0 {\n\t\tif fieldMaskLen > 0 {\n\t\t\tmapIncludeFields := make(map[string]bool)\n\t\t\tfor _, v := range includeFields {\n\t\t\t\tmapIncludeFields[v] = true\n\t\t\t}\n\n\t\t\tvar newIncludeFields []string\n\t\t\tfor _, v := range fieldMask {\n\t\t\t\tif _, ok := mapIncludeFields[v]; ok {\n\t\t\t\t\tnewIncludeFields = append(newIncludeFields, v)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tincludeFields = newIncludeFields\n\t\t}\n\t\tcolumns, values, err = p.getColumnsValuesIncluding(structPtr, includeFields)\n\t} else {\n\t\tif fieldMaskLen == 0 {\n\t\t\tcolumns, values, err = p.getColumnsValuesExcluding(structPtr, excludeFields)\n\t\t} else {\n\t\t\tmapExludeFields := make(map[string]bool)\n\t\t\tfor _, v := range excludeFields {\n\t\t\t\tmapExludeFields[v] = true\n\t\t\t}\n\n\t\t\tvar includeFields []string\n\t\t\tfor _, v := range fieldMask {\n\t\t\t\tif _, ok := mapExludeFields[v]; !ok {\n\t\t\t\t\tincludeFields = append(includeFields, v)\n\t\t\t\t}\n\t\t\t}\n\t\t\tcolumns, values, err = p.getColumnsValuesIncluding(structPtr, includeFields)\n\t\t}\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor k, v := range extraFields {\n\t\tcolumns = append(columns, k)\n\t\tvalues = append(values, v)\n\t}\n\n\tlenColumns := len(columns)\n\tlenValues := len(values)\n\tif lenColumns == 0 || lenValues == 0 {\n\t\treturn errors.New(\"query with zero columns and values\")\n\t}\n\n\tif lenColumns != lenValues {\n\t\treturn errors.New(\"columns and values length missmatch\")\n\t}\n\n\tmapValues := make(map[string]interface{})\n\tfor i := range columns {\n\t\tmapValues[columns[i]] = values[i]\n\t}\n\n\tquery := sess.Update(p.table).Set(mapValues).Where(whereColumn, whereValue)\n\tres, err := query.Exec()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif n, _ := res.RowsAffected(); n == 0 {\n\t\treturn errors.E(errors.Errorf(\"operation update can not be performed, not exist, resource %s\", whereValue), errors.NotExist)\n\t}\n\n\tif _, ok := sess.(sqlbuilder.Tx); ok {\n\t\treturn nil\n\t}\n\n\treturn p.col().Find(whereColumn, whereValue).Limit(1).One(structPtr)\n}", "func (c *Client) Update(node string, other *Coordinate, rtt time.Duration) (*Coordinate, error) {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\n\tif err := c.checkCoordinate(other); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// The code down below can handle zero RTTs, which we have seen in\n\t// https://github.com/hashicorp/consul/issues/3789, presumably in\n\t// environments with coarse-grained monotonic clocks (we are still\n\t// trying to pin this down). In any event, this is ok from a code PoV\n\t// so we don't need to alert operators with spammy messages. We did\n\t// add a counter so this is still observable, though.\n\tconst maxRTT = 10 * time.Second\n\tif rtt < 0 || rtt > maxRTT {\n\t\treturn nil, fmt.Errorf(\"round trip time not in valid range, duration %v is not a positive value less than %v \", rtt, maxRTT)\n\t}\n\tif rtt == 0 {\n\t\tmetrics.IncrCounter([]string{\"serf\", \"coordinate\", \"zero-rtt\"}, 1)\n\t}\n\n\trttSeconds := c.latencyFilter(node, rtt.Seconds())\n\tc.updateVivaldi(other, rttSeconds)\n\tc.updateAdjustment(other, rttSeconds)\n\tc.updateGravity()\n\tif !c.coord.IsValid() {\n\t\tc.stats.Resets++\n\t\tc.coord = NewCoordinate(c.config)\n\t}\n\n\treturn c.coord.Clone(), nil\n}", "func ClientLocationUpdate(cll models.ClientListLocation, m *models.Message) {\n\tif cll.ID <= 0 {\n\t\tm.Code = http.StatusBadRequest\n\t\tm.Message = \"especifique localizacion\"\n\t\treturn\n\t}\n\tdb := configuration.GetConnection()\n\tdefer db.Close()\n\terr := updateClientLocation(&cll, db)\n\tif err != nil {\n\t\tm.Code = http.StatusBadRequest\n\t\tm.Message = \"descripcion de ubicacion no se actualizo\"\n\t\treturn\n\t}\n\tm.Code = http.StatusOK\n\tm.Message = \"se actualizo descripcion de ubicacion\"\n\tm.Data = cll\n}", "func (l *Location) FromRows(rows *sql.Rows) error {\n\tvar scanl struct {\n\t\tID int\n\t\tCreateTime sql.NullTime\n\t\tUpdateTime sql.NullTime\n\t\tName sql.NullString\n\t\tExternalID sql.NullString\n\t\tLatitude sql.NullFloat64\n\t\tLongitude sql.NullFloat64\n\t\tSiteSurveyNeeded sql.NullBool\n\t}\n\t// the order here should be the same as in the `location.Columns`.\n\tif err := rows.Scan(\n\t\t&scanl.ID,\n\t\t&scanl.CreateTime,\n\t\t&scanl.UpdateTime,\n\t\t&scanl.Name,\n\t\t&scanl.ExternalID,\n\t\t&scanl.Latitude,\n\t\t&scanl.Longitude,\n\t\t&scanl.SiteSurveyNeeded,\n\t); err != nil {\n\t\treturn err\n\t}\n\tl.ID = strconv.Itoa(scanl.ID)\n\tl.CreateTime = scanl.CreateTime.Time\n\tl.UpdateTime = scanl.UpdateTime.Time\n\tl.Name = scanl.Name.String\n\tl.ExternalID = scanl.ExternalID.String\n\tl.Latitude = scanl.Latitude.Float64\n\tl.Longitude = scanl.Longitude.Float64\n\tl.SiteSurveyNeeded = scanl.SiteSurveyNeeded.Bool\n\treturn nil\n}", "func (scs *SurveyCellScan) Update() *SurveyCellScanUpdateOne {\n\treturn (&SurveyCellScanClient{scs.config}).UpdateOne(scs)\n}", "func (scs *SurveyCellScan) Update() *SurveyCellScanUpdateOne {\n\treturn (&SurveyCellScanClient{scs.config}).UpdateOne(scs)\n}", "func (o *Project) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tprojectUpdateCacheMut.RLock()\n\tcache, cached := projectUpdateCache[key]\n\tprojectUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tprojectAllColumns,\n\t\t\tprojectPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update project, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `project` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, projectPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(projectType, projectMapping, append(wl, projectPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update project row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for project\")\n\t}\n\n\tif !cached {\n\t\tprojectUpdateCacheMut.Lock()\n\t\tprojectUpdateCache[key] = cache\n\t\tprojectUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (o *Rental) Update(exec boil.Executor, whitelist ...string) error {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn err\n\t}\n\tkey := makeCacheKey(whitelist, nil)\n\trentalUpdateCacheMut.RLock()\n\tcache, cached := rentalUpdateCache[key]\n\trentalUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(\n\t\t\trentalColumns,\n\t\t\trentalPrimaryKeyColumns,\n\t\t\twhitelist,\n\t\t)\n\n\t\tif len(whitelist) == 0 {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"sqlboiler: unable to update rental, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `rental` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, rentalPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(rentalType, rentalMapping, append(wl, rentalPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sqlboiler: unable to update rental row\")\n\t}\n\n\tif !cached {\n\t\trentalUpdateCacheMut.Lock()\n\t\trentalUpdateCache[key] = cache\n\t\trentalUpdateCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpdateHooks(exec)\n}", "func (e *Entity) Update(originalEntity, updatedEntity reflect.Value, allowedUpdates []string) error {\n\tpayload := getPatchPayloadFromUpdate(originalEntity, updatedEntity)\n\n\t// See if we are attempting to update anything that is not allowed\n\tfor field := range payload {\n\t\tfound := false\n\t\tfor _, name := range allowedUpdates {\n\t\t\tif name == field {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif !found {\n\t\t\treturn fmt.Errorf(\"%s field is read only\", field)\n\t\t}\n\t}\n\n\t// If there are any allowed updates, try to send updates to the system and\n\t// return the result.\n\tif len(payload) > 0 {\n\t\treturn e.Patch(e.ODataID, payload)\n\t}\n\n\treturn nil\n}", "func (m *UserModel) UpdateFields(ctx context.Context, kv query.KV, builders ...query.SQLBuilder) (int64, error) {\n\tif len(kv) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tkv[\"updated_at\"] = time.Now()\n\n\tsqlStr, params := m.query.Merge(builders...).AppendCondition(m.applyScope()).\n\t\tTable(m.tableName).\n\t\tResolveUpdate(kv)\n\n\tres, err := m.db.ExecContext(ctx, sqlStr, params...)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn res.RowsAffected()\n}", "func (ts *Server) UpdateCellInfoFields(ctx context.Context, cell string, update func(*topodatapb.CellInfo) error) error {\n\tfilePath := pathForCellInfo(cell)\n\tfor {\n\t\tci := &topodatapb.CellInfo{}\n\n\t\t// Read the file, unpack the contents.\n\t\tcontents, version, err := ts.globalCell.Get(ctx, filePath)\n\t\tswitch {\n\t\tcase err == nil:\n\t\t\tif err := ci.UnmarshalVT(contents); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase IsErrType(err, NoNode):\n\t\t\t// Nothing to do.\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\n\t\t// Call update method.\n\t\tif err = update(ci); err != nil {\n\t\t\tif IsErrType(err, NoUpdateNeeded) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\t// Pack and save.\n\t\tcontents, err = ci.MarshalVT()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err = ts.globalCell.Update(ctx, filePath, contents, version); !IsErrType(err, BadVersion) {\n\t\t\t// This includes the 'err=nil' case.\n\t\t\treturn err\n\t\t}\n\t}\n}", "func (o *UserGoogle) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\to.UpdatedAt = currTime\n\t}\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tuserGoogleUpdateCacheMut.RLock()\n\tcache, cached := userGoogleUpdateCache[key]\n\tuserGoogleUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tuserGoogleAllColumns,\n\t\t\tuserGooglePrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"model2: unable to update user_google, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `user_google` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, userGooglePrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(userGoogleType, userGoogleMapping, append(wl, userGooglePrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model2: unable to update user_google row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model2: failed to get rows affected by update for user_google\")\n\t}\n\n\tif !cached {\n\t\tuserGoogleUpdateCacheMut.Lock()\n\t\tuserGoogleUpdateCache[key] = cache\n\t\tuserGoogleUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (d *dbBase) Update(ctx context.Context, q dbQuerier, mi *modelInfo, ind reflect.Value, tz *time.Location, cols []string) (int64, error) {\n\tpkName, pkValue, ok := getExistPk(mi, ind)\n\tif !ok {\n\t\treturn 0, ErrMissPK\n\t}\n\n\tvar setNames []string\n\n\t// if specify cols length is zero, then commit all columns.\n\tif len(cols) == 0 {\n\t\tcols = mi.fields.dbcols\n\t\tsetNames = make([]string, 0, len(mi.fields.dbcols)-1)\n\t} else {\n\t\tsetNames = make([]string, 0, len(cols))\n\t}\n\n\tsetValues, _, err := d.collectValues(mi, ind, cols, true, false, &setNames, tz)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tvar findAutoNowAdd, findAutoNow bool\n\tvar index int\n\tfor i, col := range setNames {\n\t\tif mi.fields.GetByColumn(col).autoNowAdd {\n\t\t\tindex = i\n\t\t\tfindAutoNowAdd = true\n\t\t}\n\t\tif mi.fields.GetByColumn(col).autoNow {\n\t\t\tfindAutoNow = true\n\t\t}\n\t}\n\tif findAutoNowAdd {\n\t\tsetNames = append(setNames[0:index], setNames[index+1:]...)\n\t\tsetValues = append(setValues[0:index], setValues[index+1:]...)\n\t}\n\n\tif !findAutoNow {\n\t\tfor col, info := range mi.fields.columns {\n\t\t\tif info.autoNow {\n\t\t\t\tsetNames = append(setNames, col)\n\t\t\t\tsetValues = append(setValues, time.Now())\n\t\t\t}\n\t\t}\n\t}\n\n\tsetValues = append(setValues, pkValue)\n\n\tQ := d.ins.TableQuote()\n\n\tsep := fmt.Sprintf(\"%s = ?, %s\", Q, Q)\n\tsetColumns := strings.Join(setNames, sep)\n\n\tquery := fmt.Sprintf(\"UPDATE %s%s%s SET %s%s%s = ? WHERE %s%s%s = ?\", Q, mi.table, Q, Q, setColumns, Q, Q, pkName, Q)\n\n\td.ins.ReplaceMarks(&query)\n\n\tres, err := q.ExecContext(ctx, query, setValues...)\n\tif err == nil {\n\t\treturn res.RowsAffected()\n\t}\n\treturn 0, err\n}", "func (o *Utxo) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tutxoUpdateCacheMut.RLock()\n\tcache, cached := utxoUpdateCache[key]\n\tutxoUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tutxoAllColumns,\n\t\t\tutxoPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update utxo, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"utxo\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, utxoPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(utxoType, utxoMapping, append(wl, utxoPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update utxo row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for utxo\")\n\t}\n\n\tif !cached {\n\t\tutxoUpdateCacheMut.Lock()\n\t\tutxoUpdateCache[key] = cache\n\t\tutxoUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (o *Stock) Update(exec boil.Executor, whitelist ...string) error {\n\tvar err error\n\tkey := makeCacheKey(whitelist, nil)\n\tstockUpdateCacheMut.RLock()\n\tcache, cached := stockUpdateCache[key]\n\tstockUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(\n\t\t\tstockColumns,\n\t\t\tstockPrimaryKeyColumns,\n\t\t\twhitelist,\n\t\t)\n\n\t\tif len(whitelist) == 0 {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"models: unable to update stock, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `stock` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, stockPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(stockType, stockMapping, append(wl, stockPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update stock row\")\n\t}\n\n\tif !cached {\n\t\tstockUpdateCacheMut.Lock()\n\t\tstockUpdateCache[key] = cache\n\t\tstockUpdateCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "func (o *DestinationRank) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tdestinationRankUpdateCacheMut.RLock()\n\tcache, cached := destinationRankUpdateCache[key]\n\tdestinationRankUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tdestinationRankAllColumns,\n\t\t\tdestinationRankPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update destination_rank, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"destination_rank\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, destinationRankPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(destinationRankType, destinationRankMapping, append(wl, destinationRankPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update destination_rank row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for destination_rank\")\n\t}\n\n\tif !cached {\n\t\tdestinationRankUpdateCacheMut.Lock()\n\t\tdestinationRankUpdateCache[key] = cache\n\t\tdestinationRankUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func Update(client *gophercloud.ServiceClient, regionID string, opts UpdateOptsBuilder) (r UpdateResult) {\n\tb, err := opts.ToRegionUpdateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\tresp, err := client.Patch(updateURL(client, regionID), &b, &r.Body, &gophercloud.RequestOpts{\n\t\tOkCodes: []int{200},\n\t})\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "func (h *Hotel) Update(a *config.AppContext) error {\n\treturn a.Db.Model(h).Updates(map[string]interface{}{\n\t\t\"name\": h.Name,\n\t\t\"Description\": h.Description,\n\t\t\"GoogleLocation\": h.GoogleLocation,\n\t\t\"Address\": h.Address,\n\t\t\"Contact\": h.Contact,\n\t}).Error\n}", "func (o *Repository) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\trepositoryUpdateCacheMut.RLock()\n\tcache, cached := repositoryUpdateCache[key]\n\trepositoryUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\trepositoryAllColumns,\n\t\t\trepositoryPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update repositories, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `repositories` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, repositoryPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(repositoryType, repositoryMapping, append(wl, repositoryPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update repositories row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for repositories\")\n\t}\n\n\tif !cached {\n\t\trepositoryUpdateCacheMut.Lock()\n\t\trepositoryUpdateCache[key] = cache\n\t\trepositoryUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (db *DBTuktuk) UpdateRide(ctx context.Context, rideModel RideDetailModel) (int64, error) {\n\t//validations neeed to be inserted here\n\treturn rideModel.GetTable().UpdateRideDetails(ctx)\n}", "func (o *Offer) Update(exec boil.Executor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tofferUpdateCacheMut.RLock()\n\tcache, cached := offerUpdateCache[key]\n\tofferUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tofferColumns,\n\t\t\tofferPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"stellarcore: unable to update offers, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"offers\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, offerPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(offerType, offerMapping, append(wl, offerPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"stellarcore: unable to update offers row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"stellarcore: failed to get rows affected by update for offers\")\n\t}\n\n\tif !cached {\n\t\tofferUpdateCacheMut.Lock()\n\t\tofferUpdateCache[key] = cache\n\t\tofferUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(exec)\n}", "func (o *Inventory) Update(exec boil.Executor, whitelist ...string) error {\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\to.UpdatedAt = currTime\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn err\n\t}\n\tkey := makeCacheKey(whitelist, nil)\n\tinventoryUpdateCacheMut.RLock()\n\tcache, cached := inventoryUpdateCache[key]\n\tinventoryUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(\n\t\t\tinventoryColumns,\n\t\t\tinventoryPrimaryKeyColumns,\n\t\t\twhitelist,\n\t\t)\n\n\t\tif len(whitelist) == 0 {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"models: unable to update inventory, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `inventory` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, inventoryPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(inventoryType, inventoryMapping, append(wl, inventoryPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update inventory row\")\n\t}\n\n\tif !cached {\n\t\tinventoryUpdateCacheMut.Lock()\n\t\tinventoryUpdateCache[key] = cache\n\t\tinventoryUpdateCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpdateHooks(exec)\n}", "func (u *__Room_Updater) Update(db XODB) (int, error) {\n\tvar err error\n\n\tvar updateArgs []interface{}\n\tvar sqlUpdateArr []string\n\tfor up, newVal := range u.updates {\n\t\tsqlUpdateArr = append(sqlUpdateArr, up)\n\t\tupdateArgs = append(updateArgs, newVal)\n\t}\n\tsqlUpdate := strings.Join(sqlUpdateArr, \",\")\n\n\tsqlWherrs, whereArgs := whereClusesToSql(u.wheres, u.whereSep)\n\n\tvar allArgs []interface{}\n\tallArgs = append(allArgs, updateArgs...)\n\tallArgs = append(allArgs, whereArgs...)\n\n\tsqlstr := `UPDATE ms.room SET ` + sqlUpdate\n\n\tif len(strings.Trim(sqlWherrs, \" \")) > 0 { //2 for safty\n\t\tsqlstr += \" WHERE \" + sqlWherrs\n\t}\n\n\tXOLog(sqlstr, allArgs)\n\tres, err := db.Exec(sqlstr, allArgs...)\n\tif err != nil {\n\t\tXOLogErr(err)\n\t\treturn 0, err\n\t}\n\n\tnum, err := res.RowsAffected()\n\tif err != nil {\n\t\tXOLogErr(err)\n\t\treturn 0, err\n\t}\n\n\treturn int(num), nil\n}", "func (du *DatsetUserMapping) Update(a *config.AppContext) error {\n\treturn a.Db.Model(du).Updates(map[string]interface{}{\"access_type\": du.AccessType}).Error\n}", "func (p *AccumuloProxyClient) UpdateRowConditionally(login []byte, tableName string, row []byte, updates *ConditionalUpdates) (r ConditionalStatus, err error) {\n\tif err = p.sendUpdateRowConditionally(login, tableName, row, updates); err != nil {\n\t\treturn\n\t}\n\treturn p.recvUpdateRowConditionally()\n}", "func (m *File) Update(attr string, value interface{}) error {\n\treturn UnscopedDb().Model(m).UpdateColumn(attr, value).Error\n}", "func (o *BraceletPhoto) Update(exec boil.Executor, whitelist ...string) error {\n\tvar err error\n\tkey := makeCacheKey(whitelist, nil)\n\tbraceletPhotoUpdateCacheMut.RLock()\n\tcache, cached := braceletPhotoUpdateCache[key]\n\tbraceletPhotoUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(braceletPhotoColumns, braceletPhotoPrimaryKeyColumns, whitelist)\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"models: unable to update bracelet_photo, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `bracelet_photo` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, braceletPhotoPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(braceletPhotoType, braceletPhotoMapping, append(wl, braceletPhotoPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\t_, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to update bracelet_photo row\")\n\t}\n\n\tif !cached {\n\t\tbraceletPhotoUpdateCacheMut.Lock()\n\t\tbraceletPhotoUpdateCache[key] = cache\n\t\tbraceletPhotoUpdateCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "func (o *Peer) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\t}\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tpeerUpdateCacheMut.RLock()\n\tcache, cached := peerUpdateCache[key]\n\tpeerUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tpeerAllColumns,\n\t\t\tpeerPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"model: unable to update peers, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `peers` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, peerPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(peerType, peerMapping, append(wl, peerPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: unable to update peers row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"model: failed to get rows affected by update for peers\")\n\t}\n\n\tif !cached {\n\t\tpeerUpdateCacheMut.Lock()\n\t\tpeerUpdateCache[key] = cache\n\t\tpeerUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (c *MySQLClient) Update(p *purchase.Purchase) error {\n\tif p.ID == 0 {\n\t\treturn fmt.Errorf(\"purchase must have a preexisting ID\")\n\t}\n\n\tbuyBytes, err := json.Marshal(p.BuyOrder)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to marshal buy order: %v\", err)\n\t}\n\n\tsellBytes, err := json.Marshal(p.SellOrder)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to marshal sell order: %v\", err)\n\t}\n\n\tquery := `UPDATE trader_one\n SET\n buy_order = ?,\n sell_order = ?,\n updated_at = NOW()\n WHERE\n id = ?`\n\tctx, cancelFunc := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancelFunc()\n\tstmt, err := c.db.PrepareContext(ctx, query)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to prepare SQL statement: %v\", err)\n\t}\n\tdefer stmt.Close()\n\n\t_, err = stmt.ExecContext(ctx, jsonString(buyBytes), jsonString(sellBytes), p.ID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to update row: %v\", err)\n\t}\n\treturn nil\n}", "func (m *UserExtModel) UpdateFields(ctx context.Context, kv query.KV, builders ...query.SQLBuilder) (int64, error) {\n\tif len(kv) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tkv[\"updated_at\"] = time.Now()\n\n\tsqlStr, params := m.query.Merge(builders...).AppendCondition(m.applyScope()).\n\t\tTable(m.tableName).\n\t\tResolveUpdate(kv)\n\n\tres, err := m.db.ExecContext(ctx, sqlStr, params...)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn res.RowsAffected()\n}", "func (r *CountryRegionRequest) Update(ctx context.Context, reqObj *CountryRegion) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "func (o *Kvstore) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tkvstoreUpdateCacheMut.RLock()\n\tcache, cached := kvstoreUpdateCache[key]\n\tkvstoreUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tkvstoreAllColumns,\n\t\t\tkvstorePrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update kvstore, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"kvstore\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, kvstorePrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(kvstoreType, kvstoreMapping, append(wl, kvstorePrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update kvstore row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for kvstore\")\n\t}\n\n\tif !cached {\n\t\tkvstoreUpdateCacheMut.Lock()\n\t\tkvstoreUpdateCache[key] = cache\n\t\tkvstoreUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (d *DbBackendCouch) Update(params dragonfruit.QueryParams, operation int) (interface{},\n\terror) {\n\n\tpathmap, doc, id, v, err := d.getPathSpecificStuff(params)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnewdoc, partial, err := findSubDoc(pathmap[1:],\n\t\tparams,\n\t\treflect.ValueOf(doc.Value),\n\t\treflect.ValueOf(v),\n\t\toperation)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdatabase := getDatabaseName(params)\n\t_, out, err := d.save(database, id, newdoc.Interface())\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tout, err = sanitizeDoc(partial.Interface())\n\n\treturn out, err\n\n}", "func (m *Module) InternalUpdate(ctx context.Context, dbAlias, project, col string, req *model.UpdateRequest) error {\n\tm.RLock()\n\tdefer m.RUnlock()\n\n\t// validate the update operation\n\tdbType, err := m.getDBType(dbAlias)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := helpers.ValidateUpdateOperation(ctx, dbAlias, dbType, col, req.Operation, req.Update, req.Find, m.schemaDoc); err != nil {\n\t\treturn err\n\t}\n\n\tcrud, err := m.getCrudBlock(dbAlias)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := crud.IsClientSafe(ctx); err != nil {\n\t\treturn err\n\t}\n\n\t// Adjust where clause\n\tif err := helpers.AdjustWhereClause(ctx, dbAlias, model.DBType(dbType), col, m.schemaDoc, req.Find); err != nil {\n\t\treturn err\n\t}\n\n\t// Perform the update operation\n\tn, err := crud.Update(ctx, col, req)\n\n\t// Invoke the metric hook if the operation was successful\n\tif err == nil {\n\t\tm.metricHook(m.project, dbAlias, col, n, model.Update)\n\t}\n\n\treturn err\n}", "func (o *OauthClient) Update(exec boil.Executor, columns boil.Columns) (int64, error) {\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\toauthClientUpdateCacheMut.RLock()\n\tcache, cached := oauthClientUpdateCache[key]\n\toauthClientUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\toauthClientAllColumns,\n\t\t\toauthClientPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update oauth_clients, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `oauth_clients` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, oauthClientPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(oauthClientType, oauthClientMapping, append(wl, oauthClientPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update oauth_clients row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for oauth_clients\")\n\t}\n\n\tif !cached {\n\t\toauthClientUpdateCacheMut.Lock()\n\t\toauthClientUpdateCache[key] = cache\n\t\toauthClientUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(exec)\n}", "func (o *RecipeLipid) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\to.UpdatedAt = currTime\n\t}\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\trecipeLipidUpdateCacheMut.RLock()\n\tcache, cached := recipeLipidUpdateCache[key]\n\trecipeLipidUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\trecipeLipidAllColumns,\n\t\t\trecipeLipidPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update recipe_lipid, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"recipe_lipid\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, recipeLipidPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(recipeLipidType, recipeLipidMapping, append(wl, recipeLipidPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update recipe_lipid row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for recipe_lipid\")\n\t}\n\n\tif !cached {\n\t\trecipeLipidUpdateCacheMut.Lock()\n\t\trecipeLipidUpdateCache[key] = cache\n\t\trecipeLipidUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (ptp *PTP) Update(row Row) error {\n\tif err := ptp.min.Update(row); err != nil {\n\t\treturn err\n\t}\n\treturn ptp.max.Update(row)\n}", "func (db *Mngo) Update(c *store.Context, filter bson.M, model store.Model, opts ...store.UpdateOption) error {\n\toptValues := store.GetUpdateOptions(opts...)\n\tutils.EnsurePointer(model)\n\tmongoModel := store.EnsureGenericModel(model)\n\tcollection := db.database.Collection(mongoModel.GetCollection())\n\n\t// flatten field to update for mongodb driver\n\tfields, err := flatbson.Flatten(model)\n\t// filter out fields if OnlyFields is set\n\tif len(optValues.OnlyFields) > 0 {\n\t\tfor key := range fields {\n\t\t\tif !utils.FindStringInSlice(key, optValues.OnlyFields) {\n\t\t\t\tdelete(fields, key)\n\t\t\t}\n\t\t}\n\t}\n\n\tif err != nil {\n\t\tlogrus.WithError(err).Errorln(\"cannot flatten model\")\n\t\treturn errors.Wrap(err, \"cannot flatten model\")\n\t}\n\n\tresult, err := collection.UpdateOne(context.TODO(), filter,\n\t\tbson.M{\"$set\": fields}, options.Update().SetUpsert(optValues.CreateIfNotExists))\n\n\tif err != nil {\n\t\tlogrus.WithError(err).Errorln(\"cannot update model\")\n\t\treturn errors.Wrap(err, \"cannot update model\")\n\t}\n\n\tif result.MatchedCount != 0 {\n\t\tlogrus.Debugln(\"matched and replaced an existing document\")\n\t\treturn nil\n\t}\n\tif result.UpsertedCount != 0 {\n\t\tlogrus.WithField(\"id\", result.UpsertedID).Debugln(\"inserted a new document\")\n\t\treturn nil\n\t}\n\n\treturn nil\n}", "func (o *Storestate) Update(exec boil.Executor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tstorestateUpdateCacheMut.RLock()\n\tcache, cached := storestateUpdateCache[key]\n\tstorestateUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tstorestateColumns,\n\t\t\tstorestatePrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"stellarcore: unable to update storestate, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"storestate\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, storestatePrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(storestateType, storestateMapping, append(wl, storestatePrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.Exec(cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"stellarcore: unable to update storestate row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"stellarcore: failed to get rows affected by update for storestate\")\n\t}\n\n\tif !cached {\n\t\tstorestateUpdateCacheMut.Lock()\n\t\tstorestateUpdateCache[key] = cache\n\t\tstorestateUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(exec)\n}", "func (s *Session) Update(dest interface{}) (int64, error) {\n\ts.initStatemnt()\n\ts.statement.Update()\n\tscanner, err := NewScanner(dest)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tdefer scanner.Close()\n\tif s.statement.table == \"\" {\n\t\ts.statement.From(scanner.GetTableName())\n\t}\n\tupdateFields := make([]string, 0)\n\tpks := make([]interface{}, 0)\n\tprimaryKey := \"\"\n\tfor n, f := range scanner.Model.Fields {\n\t\tif !f.IsReadOnly && !f.IsPrimaryKey {\n\t\t\tupdateFields = append(updateFields, n)\n\t\t}\n\t\tif f.IsPrimaryKey {\n\t\t\tprimaryKey = n\n\t\t}\n\t}\n\tif primaryKey == \"\" {\n\t\treturn 0, ModelMustHavePrimaryKey\n\t}\n\ts.Columns(updateFields...)\n\tif scanner.entityPointer.Kind() == reflect.Slice {\n\t\tfor i := 0; i < scanner.entityPointer.Len(); i++ {\n\t\t\tval := make([]interface{}, 0)\n\t\t\tsub := scanner.entityPointer.Index(i)\n\t\t\tif sub.Kind() == reflect.Ptr {\n\t\t\t\tsubElem := sub.Elem()\n\t\t\t\tfor _, fn := range updateFields {\n\t\t\t\t\tf, ok := scanner.Model.Fields[fn]\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tfv := subElem.Field(f.idx)\n\t\t\t\t\tval = append(val, fv.Interface())\n\t\t\t\t}\n\t\t\t\tprimaryF, _ := scanner.Model.Fields[primaryKey]\n\t\t\t\tfv := subElem.Field(primaryF.idx)\n\t\t\t\tpks = append(pks, fv.Interface())\n\t\t\t} else {\n\t\t\t\tfor _, fn := range updateFields {\n\t\t\t\t\tf, ok := scanner.Model.Fields[fn]\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tfv := sub.Field(f.idx)\n\t\t\t\t\tval = append(val, fv.Interface())\n\t\t\t\t}\n\t\t\t\tprimaryF, _ := scanner.Model.Fields[primaryKey]\n\t\t\t\tfv := sub.Field(primaryF.idx)\n\t\t\t\tpks = append(pks, fv.Interface())\n\t\t\t}\n\t\t\ts.statement.Values(val)\n\t\t}\n\n\t} else if scanner.entityPointer.Kind() == reflect.Struct {\n\t\tval := make([]interface{}, 0)\n\t\tfor _, fn := range updateFields {\n\t\t\tf, ok := scanner.Model.Fields[fn]\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfv := scanner.entityPointer.Field(f.idx)\n\t\t\tval = append(val, fv.Interface())\n\t\t}\n\t\tprimaryF, _ := scanner.Model.Fields[primaryKey]\n\t\tfv := scanner.entityPointer.Field(primaryF.idx)\n\t\tpks = append(pks, fv.Interface())\n\t\ts.statement.Values(val)\n\t} else {\n\t\treturn 0, UpdateExpectSliceOrStruct\n\t}\n\ts.Where(Eq{scanner.Model.PkName: pks})\n\tsql, args, err := s.statement.ToSQL()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\ts.logger.Debugf(\"[Session Update] sql: %s, args: %v\", sql, args)\n\ts.initCtx()\n\tsResult, err := s.ExecContext(s.ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn sResult.RowsAffected()\n}", "func (o *ItemSide) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tkey := makeCacheKey(columns, nil)\n\titemSideUpdateCacheMut.RLock()\n\tcache, cached := itemSideUpdateCache[key]\n\titemSideUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\titemSideAllColumns,\n\t\t\titemSidePrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update item_sides, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"item_sides\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 0, itemSidePrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(itemSideType, itemSideMapping, append(wl, itemSidePrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update item_sides row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for item_sides\")\n\t}\n\n\tif !cached {\n\t\titemSideUpdateCacheMut.Lock()\n\t\titemSideUpdateCache[key] = cache\n\t\titemSideUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, nil\n}" ]
[ "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.53777784", "0.5370789", "0.53481114", "0.5200019", "0.5128952", "0.5069456", "0.5047279", "0.50443023", "0.5041306", "0.4999903", "0.49840358", "0.49749205", "0.49639893", "0.49529287", "0.49436694", "0.48930195", "0.48878968", "0.48727682", "0.4862502", "0.48557916", "0.48538688", "0.48071414", "0.47927296", "0.47865108", "0.4764938", "0.47372502", "0.47334227", "0.47326517", "0.4729556", "0.4729324", "0.47279534", "0.47276735", "0.47273517", "0.46971244", "0.4683918", "0.4674538", "0.4665641", "0.46629533", "0.4662555", "0.46543065", "0.4651858", "0.46460646", "0.46313456", "0.46313456", "0.46312505", "0.46310228", "0.46235457", "0.46224618", "0.46105236", "0.4610044", "0.46090436", "0.45997584", "0.45916378", "0.45866758", "0.45758197", "0.45740163", "0.45738927", "0.45711547", "0.45631045", "0.45602322", "0.45573136", "0.45564267", "0.45524755", "0.45514512", "0.45437908", "0.4543139", "0.45416886", "0.45381624", "0.45285943", "0.45246235", "0.45242202", "0.45178336", "0.45158258", "0.45148003", "0.45131156", "0.4512637", "0.45113212", "0.45111492", "0.45094034" ]
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 TestSuccessfulEmptyQuery(t *testing.T) {\n\tlocations, err := metaweather.QueryLocations(\"thisissomestrangelocationwhichdoesnotexist\")\n\tif err != nil {\n\t\tt.Fatalf(\"query returned error: %v\", err)\n\t}\n\tif len(locations) != 0 {\n\t\tt.Fatalf(\"number of query results is %d\", len(locations))\n\t}\n}", "func LocationClean() {\n\trows, err := db.Query(\"SELECT gid FROM locations WHERE loc != POINTFROMTEXT(?) AND upTime < DATE_SUB(UTC_TIMESTAMP(), INTERVAL 3 HOUR)\", \"POINT(0 0)\")\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\n\tvar gid GoogleID\n\tfor rows.Next() {\n\t\tif err = rows.Scan(&gid); err != nil {\n\t\t\tlog.Error(err)\n\t\t\tcontinue\n\t\t}\n\t\tif _, err = db.Exec(\"UPDATE locations SET loc = POINTFROMTEXT(?), upTime = UTC_TIMESTAMP() WHERE gid = ?\", \"POINT(0 0)\", gid); err != nil {\n\t\t\tlog.Error(err)\n\t\t\tcontinue\n\t\t}\n\t}\n}", "func LocationNotIn(vs ...string) predicate.User {\n\treturn predicate.User(sql.FieldNotIn(FieldLocation, vs...))\n}", "func LatitudeNotIn(vs ...float64) predicate.Location {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldLatitude), v...))\n\t})\n}", "func LatitudeNotIn(vs ...float64) predicate.Location {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(vs) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldLatitude), v...))\n\t},\n\t)\n}", "func (ps *PgStore) GetGatewaysLoc(ctx context.Context) ([]GatewayLocation, error) {\n\tvar gwsLoc []GatewayLocation\n\n\terr := sqlx.SelectContext(ctx, ps.db, &gwsLoc, `\n\t\tSELECT latitude, longitude, altitude\n\t\tFROM gateway\n\t\tWHERE latitude != 0 OR longitude != 0`,\n\t)\n\treturn gwsLoc, err\n}", "func getEmptyMap() []models.Location {\n\tresult := make([]models.Location, Width * Height)\n\tfor w := 0; w < Width; w++ {\n\t\tfor h := 0; h < Height; h++ {\n\t\t\tresult[h * Width + w] = models.NewEmptyField(w, h)\n\t\t}\n\t}\n\treturn result\n}", "func CLUBELOCATIONADDRESSNotIn(vs ...string) predicate.Location {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldCLUBELOCATIONADDRESS), v...))\n\t})\n}", "func (l *GeoLoc) Query() error {\n\t// Get db instance\n\tdb, err := dstore.NewDB()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error retrieving db instance: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// Query\n\trow := db.QueryRow(\"SELECT id FROM geo_locs WHERE raw = $1\", l.Raw)\n\n\t// Get ID\n\terr = row.Scan(&l.ID)\n\n\t// Check if row found\n\tif err == sql.ErrNoRows {\n\t\t// If not, return so we can identify\n\t\treturn err\n\t} else if err != nil {\n\t\treturn fmt.Errorf(\"error reading GeoLoc ID from row: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// Success\n\treturn nil\n}", "func LocationIsNil() predicate.User {\n\treturn predicate.User(sql.FieldIsNull(FieldLocation))\n}", "func (repository *GormRepository) GetAllUnscoped(uow *UnitOfWork, out interface{}, queryProcessors []QueryProcessor) microappError.DatabaseError {\n\tdb := uow.DB\n\n\tif queryProcessors != nil {\n\t\tvar err error\n\t\tfor _, queryProcessor := range queryProcessors {\n\t\t\tdb, err = queryProcessor(db, out)\n\t\t\tif err != nil {\n\t\t\t\treturn microappError.NewDatabaseError(err)\n\t\t\t}\n\t\t}\n\t}\n\tif err := db.Unscoped().Find(out).Error; err != nil {\n\t\treturn microappError.NewDatabaseError(err)\n\t}\n\treturn nil\n}", "func (o *SyntheticMonitorUpdate) GetLocationsOk() (*[]string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Locations, true\n}", "func LocationNotNil() predicate.User {\n\treturn predicate.User(sql.FieldNotNull(FieldLocation))\n}", "func (k *KRPC) notQueried(queriedNodes *boom.BloomFilter, contacts []bucket.ContactIdentifier) []bucket.ContactIdentifier {\n\tif contacts == nil {\n\t\treturn []bucket.ContactIdentifier{}\n\t}\n\tk.mu.Lock()\n\tdefer k.mu.Unlock()\n\tret := []bucket.ContactIdentifier{}\n\tfor _, c := range contacts {\n\t\tif !queriedNodes.TestAndAdd([]byte(c.GetAddr().String())) {\n\t\t\tret = append(ret, c)\n\t\t}\n\t}\n\treturn ret\n}", "func (a *Client) QueryNetworkLocations(params *QueryNetworkLocationsParams, opts ...ClientOption) (*QueryNetworkLocationsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewQueryNetworkLocationsParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"query-network-locations\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/fwmgr/queries/network-locations/v1\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &QueryNetworkLocationsReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*QueryNetworkLocationsOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for query-network-locations: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func TestEmptyQueryValue(t *testing.T) {\n\t_, err := metaweather.QueryLocations(\"\")\n\tif err == nil {\n\t\tt.Fatalf(\"error is nil\")\n\t}\n\tif !strings.Contains(err.Error(), \"JSON\") {\n\t\tt.Fatalf(\"error is %v\", err)\n\t}\n}", "func (s FileLocationClassArray) AsFileLocationUnavailable() (to FileLocationUnavailableArray) {\n\tfor _, elem := range s {\n\t\tvalue, ok := elem.(*FileLocationUnavailable)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tto = append(to, *value)\n\t}\n\n\treturn to\n}", "func (dao *LocationDAO) GetReceivingLocations(temperature_zone string, has_product bool, location_type string) ([]models.ReceivingLocation, error) {\n\tvar locations []models.ReceivingLocation\n\n\targs := struct {\n\t\tTemperatureZone string `json:\"temperature_zone\"`\n\t\tLocationType string `json:\"location_type\"`\n\t}{temperature_zone, location_type}\n\n\tsql_string := `SELECT rcl_id, rcl_type,\n rcl_temperature_zone, rcl_shi_shipment_code\n FROM receiving_locations\n `\n\n\t// slice of where clause conditions based on whether params are set to their 0-value or not\n\tvar conditions []string\n\tif has_product {\n\t\tconditions = append(conditions, \"rcl_shi_shipment_code IS NOT NULL\")\n\t}\n\tif len(temperature_zone) > 0 {\n\t\tconditions = append(conditions, \"rcl_temperature_zone = :temperature_zone\")\n\t}\n\tif len(location_type) > 0 {\n\t\tconditions = append(conditions, \"rcl_type = :location_type\")\n\t}\n\n\tsql_string += buildWhereFromConditions(conditions) + \" ORDER BY rcl_id\"\n\n\trows, err := dao.DB.NamedQuery(sql_string, args)\n\tif err != nil {\n\t\treturn locations, err\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar l models.ReceivingLocation\n\t\terr = rows.StructScan(&l)\n\t\tif err != nil {\n\t\t\treturn locations, err\n\t\t}\n\t\tlocations = append(locations, l)\n\t}\n\terr = rows.Err()\n\n\tif err == nil && len(locations) == 0 {\n\t\treturn locations, sql.ErrNoRows\n\t}\n\n\treturn locations, err\n}", "func LatitudeIsNil() predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.IsNull(s.C(FieldLatitude)))\n\t})\n}", "func (c Client) GetLocationItems(query url.Values) ([]Location, error) {\n\tvar res struct {\n\t\tRecords []Location\n\t}\n\terr := c.GetRecordsFor(TableLocation, query, &res)\n\treturn res.Records, err\n}", "func LongitudeNotIn(vs ...float64) predicate.Location {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldLongitude), v...))\n\t})\n}", "func (config *InitialConfig) Locations() error {\n\tn, countErr := config.DBClient.CountNodesWithFieldUnsafe(\"location.id\")\n\tif countErr != nil {\n\t\treturn countErr\n\t}\n\tif *n == 0 {\n\t\tapiLocations, apiErr := downloadAndMarshal()\n\t\tif apiErr != nil {\n\t\t\treturn apiErr\n\t\t}\n\n\t\tfor _, loc := range *apiLocations {\n\t\t\ttempLoc := db.Location{\n\t\t\t\tID: loc.ID,\n\t\t\t\tName: loc.UFName,\n\t\t\t\tDisabledAccess: yesNoToBool(loc.DisabledAccess),\n\t\t\t\tDType: []string{\"Location\"},\n\t\t\t}\n\n\t\t\t// If it can find the location, then add the damn location\n\t\t\tlatlon := tryAndGetTheLocationFromARoom(&loc)\n\t\t\tif latlon != nil {\n\t\t\t\ttempLoc.Location = *latlon\n\t\t\t}\n\n\t\t\t_, er1 := config.DBClient.UpsertLocation(tempLoc)\n\t\t\tif er1 != nil {\n\t\t\t\treturn er1\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func LongitudeIsNil() predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.IsNull(s.C(FieldLongitude)))\n\t})\n}", "func LongitudeNotIn(vs ...float64) predicate.Location {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(vs) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldLongitude), v...))\n\t},\n\t)\n}", "func (s *service) Locs(server api.NetworkControlService_LocsServer) error {\n\treturn fmt.Errorf(\"deprecated\")\n}", "func (locService *LocationService) GetLocations() ([]*Location, error) {\n\tlocations, err := locService.Repo.FindAll()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn locations, nil\n}", "func (e Elem) RecentLocations(raw *tg.Client) *messages.GetRecentLocationsQueryBuilder {\n\treturn messages.NewQueryBuilder(raw).GetRecentLocations(e.Peer)\n}", "func NewGetBackupLocationsUnauthorized() *GetBackupLocationsUnauthorized {\n\n\treturn &GetBackupLocationsUnauthorized{}\n}", "func LatitudeNotNil() predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.NotNull(s.C(FieldLatitude)))\n\t})\n}", "func (lq *LocationQuery) AllX(ctx context.Context) []*Location {\n\tls, err := lq.All(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ls\n}", "func ExampleSnowball_ListPickupLocations_shared00() {\n\tsvc := snowball.New(session.New())\n\tinput := &snowball.ListPickupLocationsInput{}\n\n\tresult, err := svc.ListPickupLocations(input)\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\n\t\t\tcase snowball.ErrCodeInvalidResourceException:\n\t\t\t\tfmt.Println(snowball.ErrCodeInvalidResourceException, aerr.Error())\n\t\t\tdefault:\n\t\t\t\tfmt.Println(aerr.Error())\n\t\t\t}\n\t\t} else {\n\t\t\t// Print the error, cast err to awserr.Error to get the Code and\n\t\t\t// Message from an error.\n\t\t\tfmt.Println(err.Error())\n\t\t}\n\t\treturn\n\t}\n\n\tfmt.Println(result)\n}", "func MissingLocalPaths(ctx context.Context, mappings []PathMapping) (missing, rest []PathMapping, err error) {\n\tfor _, mapping := range mappings {\n\t\t_, err := os.Stat(mapping.LocalPath)\n\t\tif err == nil {\n\t\t\trest = append(rest, mapping)\n\t\t\tcontinue\n\t\t}\n\n\t\tif os.IsNotExist(err) {\n\t\t\tmissing = append(missing, mapping)\n\t\t} else {\n\t\t\treturn nil, nil, errors.Wrap(err, \"MissingLocalPaths\")\n\t\t}\n\t}\n\treturn missing, rest, nil\n}", "func (repository *GormRepository) GetAllUnscopedForTenant(uow *UnitOfWork, out interface{}, tenantID uuid.UUID, queryProcessors []QueryProcessor) microappError.DatabaseError {\n\tqueryProcessors = append([]QueryProcessor{Filter(\"tenantID = ?\", tenantID)}, queryProcessors...)\n\treturn repository.GetAllUnscoped(uow, out, queryProcessors)\n}", "func LongitudeNotNil() predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.NotNull(s.C(FieldLongitude)))\n\t})\n}", "func (s *Server) GetMissing(ctx context.Context, req *pbcdp.GetMissingRequest) (*pbcdp.GetMissingResponse, error) {\n\tresp := &pbcdp.GetMissingResponse{}\n\n\tfor _, id := range []int32{242018, 288751, 812802, 242017, 857449, 673768, 1782105} {\n\t\tmissing, err := s.rc.getRecordsInFolder(ctx, id)\n\t\tif err != nil {\n\t\t\treturn resp, err\n\t\t}\n\n\t\tripped, _ := s.GetRipped(ctx, &pbcdp.GetRippedRequest{})\n\n\t\tfor _, r := range missing {\n\t\t\thasCD := false\n\t\t\tfor _, f := range r.GetRelease().GetFormats() {\n\t\t\t\tif f.Name == \"CD\" || f.Name == \"File\" || f.Name == \"CDr\" {\n\t\t\t\t\thasCD = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif hasCD {\n\t\t\t\tfound := false\n\t\t\t\tfor _, ri := range ripped.GetRipped() {\n\t\t\t\t\tif ri.Id == r.GetRelease().Id {\n\t\t\t\t\t\tfound = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !found {\n\t\t\t\t\tresp.Missing = append(resp.GetMissing(), r)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resp, nil\n}", "func (g Grid) Unoccupied() bool {\n\tfor _, row := range g.cells {\n\t\tfor _, col := range row {\n\t\t\tif col.occupied {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true\n}", "func (u *Util) GetExpiredPins() ([]models.Upload, error) {\n\tuploads := []models.Upload{}\n\tcurrentDate := time.Now()\n\tif err := u.UP.DB.Model(&models.Upload{}).Where(\n\t\t\"garbage_collect_date < ?\", currentDate,\n\t).Find(&uploads).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tif len(uploads) == 0 {\n\t\treturn nil, errors.New(\"no expired pins\")\n\t}\n\treturn uploads, nil\n}", "func GeoLocations(reply interface{}, err error) ([]*GeoLocation, error) {\n\tvalues, err := redis.Values(reply, err)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlist := make([]*GeoLocation, len(values))\n\tfor i, v := range values {\n\t\tlist[i], err = convertToGeoLocation(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn list, nil\n}", "func (c *MulticastController) GetMissingEntries(grpIP net.IP) bool {\n\tdestsIPs, ok := c.gmTable.Get(grpIP)\n\tif !ok {\n\t\tlog.Panic(\"must have the destsIPs!\")\n\t}\n\n\t// To get missing entries start sending join query from the source\n\tc.sendJoinQuery(grpIP, destsIPs)\n\n\t// Add max timeout to fill Forward Table\n\tt1 := c.timers.Add(FillForwardTableTimeout, func() {\n\t\tfor i := 0; i < len(destsIPs); i++ {\n\t\t\tc.ch <- 0\n\t\t}\n\t})\n\n\t// Wait until timeout or recieve join reply from a destination\n\tvar dstsCount byte = 0\n\tfor i := 0; i < len(destsIPs); i++ {\n\t\tdstsCount += <-c.ch\n\t}\n\t// stop timer\n\tt1.Stop()\n\t// true if destination(s) is/are found, false if didn't recieve a join reply from a destination\n\treturn dstsCount > 0\n}", "func (_TokensNetwork *TokensNetworkCaller) QueryUnlockedLocks(opts *bind.CallOpts, token common.Address, participant common.Address, partner common.Address, lockhash [32]byte) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _TokensNetwork.contract.Call(opts, out, \"queryUnlockedLocks\", token, participant, partner, lockhash)\n\treturn *ret0, err\n}", "func (d *remoteDB) GetUnfinishedBuilds(m string) ([]*Build, error) {\n\treq := &rpc.Master{\n\t\tMaster: m,\n\t}\n\tresp, err := d.client.GetUnfinishedBuilds(context.Background(), req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trv := make([]*Build, 0, len(resp.Builds))\n\tfor _, build := range resp.Builds {\n\t\tvar b Build\n\t\tif err := gob.NewDecoder(bytes.NewBuffer(build.Build)).Decode(&b); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tb.fixup()\n\t\trv = append(rv, &b)\n\t}\n\treturn rv, nil\n}", "func (o *SyntheticMonitorUpdate) GetLocations() []string {\n\tif o == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\n\treturn o.Locations\n}", "func GetEmergencyServices(location []float64, db *database.DynamoConn) (string, error) {\n\t// Every element in the response body will have these attributes\n\ttype LocationItem struct {\n\t\tLocation maps.LatLng `json:\"location\"`\n\t\tName string `json:\"name\"`\n\t\tIcon string `json:\"icon\"`\n\t\tOpen bool `json:\"open\"`\n\t}\n\n\t// Retrive maps key\n\tgmapsKey := db.MustGetGMapsKey()\n\n\t// Authenticate a new Maps API client\n\tc, err := maps.NewClient(maps.WithAPIKey(gmapsKey))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Create a search for nearby places using the current location\n\t// Reference: https://github.com/googlemaps/google-maps-services-go/blob/master/places.go#L134\n\tpharmacyRequest := &maps.NearbySearchRequest{\n\t\tLocation: &maps.LatLng{\n\t\t\tLat: location[0],\n\t\t\tLng: location[1],\n\t\t},\n\t\tRadius: uint(20), // 20 mile radius\n\t\tKeyword: \"pharmacy\",\n\t}\n\n\t// Make request to Google Places API\n\tpharmacyResponse, err := c.NearbySearch(context.Background(), pharmacyRequest)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Extract only necessary attributes from pharmacy query\n\tlocationItems := []LocationItem{}\n\topen := false\n\tfor _, i := range pharmacyResponse.Results {\n\t\tif i.OpeningHours != nil {\n\t\t\tif i.OpeningHours.OpenNow != nil {\n\t\t\t\topen = *i.OpeningHours.OpenNow\n\t\t\t}\n\t\t}\n\t\titem := LocationItem{\n\t\t\tLocation: i.Geometry.Location,\n\t\t\tName: i.Name,\n\t\t\tIcon: i.Icon,\n\t\t\tOpen: open,\n\t\t}\n\t\tlocationItems = append(locationItems, item)\n\t}\n\tfmt.Printf(\"%+v\", locationItems)\n\n\t// Do the same thing for hospital query\n\thospitalRequest := &maps.NearbySearchRequest{\n\t\tLocation: &maps.LatLng{\n\t\t\tLat: location[0],\n\t\t\tLng: location[1],\n\t\t},\n\t\tRadius: uint(20),\n\t\tKeyword: \"hospital\",\n\t}\n\n\t// Make request to Google Places API\n\thospitalResponse, err := c.NearbySearch(context.Background(), hospitalRequest)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// continue appending to locationItems slice previously declared\n\topen = false\n\tfor _, i := range hospitalResponse.Results {\n\t\tif i.OpeningHours != nil {\n\t\t\tif i.OpeningHours.OpenNow != nil {\n\t\t\t\topen = *i.OpeningHours.OpenNow\n\t\t\t}\n\t\t}\n\t\titem := LocationItem{\n\t\t\tLocation: i.Geometry.Location,\n\t\t\tName: i.Name,\n\t\t\tIcon: i.Icon,\n\t\t\tOpen: open,\n\t\t}\n\t\tlocationItems = append(locationItems, item)\n\t}\n\n\tj, err := json.Marshal(locationItems)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(j), nil\n}", "func (o *FiltersApiLog) GetQueryIpAddressesOk() ([]string, bool) {\n\tif o == nil || o.QueryIpAddresses == nil {\n\t\tvar ret []string\n\t\treturn ret, false\n\t}\n\treturn *o.QueryIpAddresses, true\n}", "func (client *NginxClient) GetLocationZones() (*LocationZones, error) {\n\tvar locationZones LocationZones\n\tif client.version < 5 {\n\t\treturn &locationZones, nil\n\t}\n\terr := client.get(\"http/location_zones\", &locationZones)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get location zones: %w\", err)\n\t}\n\n\treturn &locationZones, err\n}", "func (l Location) GetLocations() []Locatable {\n\ta := make([]Locatable, 1)\n\ta[0] = l\n\treturn a\n}", "func (l *Location) Exits() Exits {\n\tl.linkMtx.Lock()\n\tdefer l.linkMtx.Unlock()\n\n\te := make(Exits, len(l.exits))\n\tcopy(e, l.exits)\n\treturn e\n}", "func (store *DBStore) GetUnassignedBoxes() ([]*entity.Box, error) {\n\tvar boxes []*entity.Box\n\tstore.DB.Where(\"face_id = 0\").Find(&boxes)\n\treturn boxes, nil\n}", "func (r *RepoImpl) GetUnfinished() ([]Session, error) {\n\tvar result []Session\n\n\terr := r.DB.\n\t\tWhere(\"finished != TRUE\").\n\t\tPreload(\"Payment\").\n\t\tFind(&result).\n\t\tError\n\n\treturn result, err\n}", "func (l *Location) QueryChildren() *LocationQuery {\n\treturn (&LocationClient{config: l.config}).QueryChildren(l)\n}", "func LatitudeValNotIn(vs ...float64) predicate.Property {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Property(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldLatitudeVal), v...))\n\t})\n}", "func TestGetUnsolvedProblemsValidUserid(t *testing.T) {\n\tts := initAPITestServer(t)\n\tdefer test.CloseServer(ts)\n\n\tproblems := GetUnsolvedProblems(userID, \"star\")\n\tif len(problems) != nUnsolvedProblems {\n\t\tt.Fatalf(\"Expected %d problems to solve, got %d\", nUnsolvedProblems, len(problems))\n\t}\n}", "func (lq *LocationQuery) All(ctx context.Context) ([]*Location, error) {\n\treturn lq.sqlAll(ctx)\n}", "func (s *Server) UnconnectedPeers() []string {\n\treturn s.discovery.UnconnectedPeers()\n}", "func (a *APIv1) GetLocations(qo *odata.QueryOptions, path string) (*models.ArrayResponse, error) {\n\t_, err := a.QueryOptionsSupported(qo, &entities.Location{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocations, count, err := a.db.GetLocations(qo)\n\treturn processLocations(a, locations, qo, path, count, err)\n}", "func (l *Location) QueryChildren() *LocationQuery {\n\treturn (&LocationClient{l.config}).QueryChildren(l)\n}", "func (c *OrganizationsEnvironmentsQueriesListCall) InclQueriesWithoutReport(inclQueriesWithoutReport string) *OrganizationsEnvironmentsQueriesListCall {\n\tc.urlParams_.Set(\"inclQueriesWithoutReport\", inclQueriesWithoutReport)\n\treturn c\n}", "func GetSurroundingPoints(lat float64, lng float64, queryRange float64) []hanapi.Location {\n\tpoints := []hanapi.Location{}\n\tfor degrees := float64(0); degrees < 360; degrees += 90 {\n\t\t// search 5 kilometers in each direction\n\t\tp := geo.NewPoint(lat, lng)\n\t\t// find another point that's at the edge of the previous query\n\t\tnewPoint := p.PointAtDistanceAndBearing(queryRange/1000, degrees)\n\t\tpoints = append(points, *hanapi.NewLocation(newPoint.Lat(), newPoint.Lng()))\n\t}\n\treturn points\n}", "func (c *Category) QueryUnsavedPosts() *UnsavedPostQuery {\n\treturn (&CategoryClient{config: c.config}).QueryUnsavedPosts(c)\n}", "func (api InstagramAPI) LocationsNear(lat, long, distance float64) []Location {\n\tparams := getEmptyMap()\n\tif distance > 0 {\n\t\tparams[\"distance\"] = fmt.Sprintf(\"%f\", distance)\n\t}\n\tparams[\"lat\"] = fmt.Sprintf(\"%f\", lat)\n\tparams[\"lng\"] = fmt.Sprintf(\"%f\", long)\n\tresults := api.DoRequest(\"locations/search\", params)\n\tdata := results.ObjectArray(\"data\")\n\tlocations := make([]Location, 0)\n\tfor _, loc := range data {\n\t\tlocations = append(locations, LocationFromAPI(loc))\n\t}\n\treturn locations\n}", "func (s *Swarm) filterKnownUndialables(p peer.ID, addrs []ma.Multiaddr) []ma.Multiaddr {\n\tlisAddrs, _ := s.InterfaceListenAddresses()\n\tvar ourAddrs []ma.Multiaddr\n\tfor _, addr := range lisAddrs {\n\t\tprotos := addr.Protocols()\n\t\t// we're only sure about filtering out /ip4 and /ip6 addresses, so far\n\t\tif protos[0].Code == ma.P_IP4 || protos[0].Code == ma.P_IP6 {\n\t\t\tourAddrs = append(ourAddrs, addr)\n\t\t}\n\t}\n\n\treturn maybeRemoveWebTransportAddrs(ma.FilterAddrs(addrs,\n\t\tfunc(addr ma.Multiaddr) bool { return !ma.Contains(ourAddrs, addr) },\n\t\ts.canDial,\n\t\t// TODO: Consider allowing link-local addresses\n\t\tfunc(addr ma.Multiaddr) bool { return !manet.IsIP6LinkLocal(addr) },\n\t\tfunc(addr ma.Multiaddr) bool {\n\t\t\treturn s.gater == nil || s.gater.InterceptAddrDial(p, addr)\n\t\t},\n\t))\n}", "func tryAndGetTheLocationFromARoom(lo *LocationInfo) *db.Loc {\n\tbaseURL, err := url.Parse(\"https://www.kent.ac.uk/timetabling/rooms/room.html\")\n\tif err != nil {\n\t\treturn nil\n\t}\n\t// Prepare Query Parameters\n\tparams := url.Values{}\n\tparams.Add(\"room\", lo.ID)\n\n\t// Add Query Parameters to the URL\n\tbaseURL.RawQuery = params.Encode() // Escape Query Parameters\n\n\t// Get the timetable html page\n\tresp, err := http.Get(baseURL.String())\n\tif err != nil {\n\t\treturn nil\n\t}\n\tdefer resp.Body.Close()\n\tbody, readErr := ioutil.ReadAll(resp.Body)\n\tif readErr != nil {\n\t\treturn nil\n\t}\n\n\t// Get the google maps url from this page\n\tre := regexp.MustCompile(`https:\\/\\/maps\\.google\\.co\\.uk\\/maps[^\"]*`)\n\tresult := re.Find(body)\n\tif result == nil {\n\t\treturn nil\n\t}\n\n\t// Get the query params from the google maps url, we are looking for \"ll\"\n\tu, err := url.Parse(string(result))\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tqueries := u.Query()\n\tll := queries.Get(\"ll\")\n\tls := strings.Split(ll, \",\")\n\tlat, err := strconv.ParseFloat(ls[0], 64)\n\tif err != nil {\n\t\treturn nil\n\t}\n\tlon, err := strconv.ParseFloat(ls[1], 64)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tg := &db.Loc{\n\t\tType: \"Point\",\n\t\tCoords: []float64{lon, lat},\n\t}\n\n\t// g := geom.NewPointFlat(geom.XY, []float64{lat, lon})\n\n\t// Finally, if nothing has failed, then return the coordinates\n\treturn g\n}", "func (o *SyntheticsBrowserTest) GetLocationsOk() (*[]string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Locations, true\n}", "func (locs Locations) RemoveRedundant(d float64) Locations {\n\tn0 := len(locs)\n\tPrintln(\n\t\t\"Removing redundancies from %d raw locations, might take a while\", n0)\n\tt0 := time.Now()\n\tddeg := RadToDeg(DistToRad(d/1000.0))\n\tkeep := []int{}\n\tfound := false\n\tvar i, j int\n\tfor i = 0; i<len(locs); i++ {\n\t\tfound = false\n\t\tfor j = 0; j < i; j++ {\n\t\t\tif math.Abs(locs[i].Lat-locs[j].Lat) < ddeg &&\n\t\t\t\tmath.Abs(locs[i].Long-locs[j].Long) < ddeg {\n\t\t\t\tfound = true\n\t\t\t\t// Favor keeping airports over waypoints\n\t\t\t\tif locs[i].Type == LOCTYPE[\"Waypoint\"].Tag &&\n\t\t\t\t\tlocs[j].Type == LOCTYPE[\"Airport\"].Tag {\n\t\t\t\t\tlocs[i] = locs[j]\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tkeep = append(keep, i)\n\t\t}\n\t}\n\tresult := Locations([]Location{})\n\tfor _, i = range keep {\n\t\tresult = append(result, locs[i])\n\t}\n\tt1 := time.Now()\n\tn1 := len(result)\n\tPrintln(\n\t\t\"Now have %d locations, removed %d (%.1f%%) in %v\",\n\t\tn1, n0-n1, 100.0*float64(n0-n1)/float64(n0), t1.Sub(t0))\n\treturn result\n}", "func FindGeoFencesExceptByUser(centerLat float64, centerLon float64, radius int64, excludeBy int) ([]models.Fence, error) {\n\tquery := elastic.NewBoolQuery()\n\tquery = query.MustNot(elastic.NewTermQuery(\"owner\", excludeBy))\n\tquery.Filter(elastic.NewGeoDistanceQuery(\"center\").Distance(fmt.Sprintf(\"%d m\", radius)).Lat(centerLat).Lon(centerLon))\n\n\tsearchResult, err := ElasticInstance.Search().\n\t\tIndex(IndexGeoFences).\n\t\tQuery(query).\n\t\tDo()\n\n\t// Check whether an error appeared or not.\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif searchResult.Hits != nil {\n\t\tfences := make([]int64, searchResult.TotalHits(), searchResult.TotalHits())\n\t\tfmt.Printf(\"Found a total of %d GeoFences\\n\", searchResult.Hits.TotalHits)\n\n\t\t// Iterate through results\n\t\tfor i, hit := range searchResult.Hits.Hits {\n\t\t\tstringID, _ := strconv.ParseInt(hit.Id, 10, 64)\n\t\t\tfences[i] = stringID\n\t\t}\n\t\treturn models.FindFencesByIDs(fences)\n\t}\n\n\tfmt.Print(\"Found no fences\\n\")\n\tvar empty []models.Fence\n\treturn empty, nil\n}", "func (c *OrganizationsHostQueriesListCall) InclQueriesWithoutReport(inclQueriesWithoutReport string) *OrganizationsHostQueriesListCall {\n\tc.urlParams_.Set(\"inclQueriesWithoutReport\", inclQueriesWithoutReport)\n\treturn c\n}", "func (_TokensNetwork *TokensNetworkSession) QueryUnlockedLocks(token common.Address, participant common.Address, partner common.Address, lockhash [32]byte) (bool, error) {\n\treturn _TokensNetwork.Contract.QueryUnlockedLocks(&_TokensNetwork.CallOpts, token, participant, partner, lockhash)\n}", "func NewGetUniverseAncestriesServiceUnavailable() *GetUniverseAncestriesServiceUnavailable {\n\treturn &GetUniverseAncestriesServiceUnavailable{}\n}", "func (a *Client) GetNetworkLocations(params *GetNetworkLocationsParams, opts ...ClientOption) (*GetNetworkLocationsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetNetworkLocationsParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"get-network-locations\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/fwmgr/entities/network-locations/v1\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetNetworkLocationsReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetNetworkLocationsOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for get-network-locations: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func GetUnsubscribedContacts(c context.Context, r *http.Request) ([]models.ContactUnsubscribe, interface{}, int, int, error) {\n\t// Now if user is not querying then check\n\tuser, err := controllers.GetCurrentUser(c, r)\n\tif err != nil {\n\t\tlog.Errorf(c, \"%v\", err)\n\t\treturn []models.ContactUnsubscribe{}, nil, 0, 0, err\n\t}\n\n\tif !user.IsAdmin {\n\t\treturn []models.ContactUnsubscribe{}, nil, 0, 0, errors.New(\"Forbidden\")\n\t}\n\n\tquery := datastore.NewQuery(\"ContactUnsubscribe\")\n\tquery = controllers.ConstructQuery(query, r)\n\n\tks, err := query.KeysOnly().GetAll(c, nil)\n\tif err != nil {\n\t\tlog.Errorf(c, \"%v\", err)\n\t\treturn []models.ContactUnsubscribe{}, nil, 0, 0, err\n\t}\n\n\tvar unsubscribedContacts []models.ContactUnsubscribe\n\tunsubscribedContacts = make([]models.ContactUnsubscribe, len(ks))\n\terr = nds.GetMulti(c, ks, unsubscribedContacts)\n\tif err != nil {\n\t\tlog.Infof(c, \"%v\", err)\n\t\treturn unsubscribedContacts, nil, 0, 0, err\n\t}\n\n\tfor i := 0; i < len(unsubscribedContacts); i++ {\n\t\tunsubscribedContacts[i].Format(ks[i], \"unsubscribedcontacts\")\n\t}\n\n\treturn unsubscribedContacts, nil, len(unsubscribedContacts), 0, nil\n}", "func Unreachable(db *DB) bool {\n\tif db == nil {\n\t\treturn false\n\t}\n\treturn db.checker.unreachable()\n}", "func (c *AdminClient) QueryUnsavedPosts(a *Admin) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := a.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(admin.Table, admin.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, admin.UnsavedPostsTable, admin.UnsavedPostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(a.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "func (t *Tortoise) GetMissingActiveSet(epoch types.EpochID, atxs []types.ATXID) []types.ATXID {\n\tt.mu.Lock()\n\tdefer t.mu.Unlock()\n\tedata, exists := t.trtl.epochs[epoch]\n\tif !exists {\n\t\treturn atxs\n\t}\n\tvar missing []types.ATXID\n\tfor _, atx := range atxs {\n\t\t_, exists := edata.atxs[atx]\n\t\tif !exists {\n\t\t\tmissing = append(missing, atx)\n\t\t}\n\t}\n\treturn missing\n}", "func (page LocationListResultPage) NotDone() bool {\n\treturn !page.llr.IsEmpty()\n}", "func TestGetUnsolvedProblemsCPBookInvalidResponse(t *testing.T) {\n\tts := initAPITestServerInvalid(t, []string{\"[]\", \"[]\", \"\"})\n\tdefer test.CloseServer(ts)\n\n\tproblems := GetUnsolvedProblemsCPBook(userID, \"star\")\n\tif len(problems) != 0 {\n\t\tt.Fatalf(\"Expected empty problem list\")\n\t}\n}", "func (mng *csvClient) GetLocations() (model.LocationRows, model.Error) {\n\tvar rows model.LocationRows\n\tif err := gocsv.UnmarshalFile(mng.cltFl, &rows); err != nil {\n\t\treturn nil, model.NewErrorServer(\"Error parsing file\").WithError(err)\n\t}\n\treturn rows, model.NewErrorNil()\n}", "func (r *questionsRepo) LoadUnansweredQuestions(userID uint) ([]*models.Question, error) {\n\tresult := make([]*models.Question, 0, len(r.data))\n\tfor _, uq := range r.userQuestion[userID] {\n\t\tif uq.AnswerID == nil {\n\t\t\tresult = append(result, uq)\n\t\t}\n\t}\n\treturn result, nil\n}", "func (_TokensNetwork *TokensNetworkCallerSession) QueryUnlockedLocks(token common.Address, participant common.Address, partner common.Address, lockhash [32]byte) (bool, error) {\n\treturn _TokensNetwork.Contract.QueryUnlockedLocks(&_TokensNetwork.CallOpts, token, participant, partner, lockhash)\n}", "func (g *GistStats) GetPrivateGists() int {\n\tif g == nil || g.PrivateGists == nil {\n\t\treturn 0\n\t}\n\treturn *g.PrivateGists\n}", "func (p *Proc) GetLostInstances() ([]*Instance, error) {\n\tsp, err := p.GetSnapshot().FastForward()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tids, err := sp.Getdir(p.lostInstancesPath())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn getSerialisedInstances(ids, InsStatusLost, p, sp)\n}", "func (serv *LocationServices) GetSatellites() (location models.Location) {\n\tlocation = models.Location{}\n\n\trepo := repository.GetInstace()\n\tsatellites := repo.GetSatellites()\n\tlocation = serv.ReadLocation(satellites)\n\n\treturn location\n}", "func getGeoLocation(locations []interface{}) *[]insights.WebTestGeolocation {\n\tvar geoLocations []insights.WebTestGeolocation\n\tfor _, v := range locations {\n\t\tl := v.(string)\n\t\tgeoLocations = append(geoLocations, insights.WebTestGeolocation{\n\t\t\tLocation: &l,\n\t\t})\n\t}\n\treturn &geoLocations\n}", "func (lq *LocationQuery) OnlyX(ctx context.Context) *Location {\n\tl, err := lq.Only(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn l\n}", "func GetLastDeviceLocations(c context.Context, id string) ([]*models.Location, error) {\n\treturn FromContext(c).GetLastDeviceLocations(id)\n}", "func TimezoneNotNil() predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.NotNull(s.C(FieldTimezone)))\n\t})\n}", "func (o *Object) NotContainsMap(value interface{}) *Object {\n\treturn o.NotContainsSubset(value)\n}", "func WithoutWG(sites []string) {\n\tstart := time.Now()\n\tfor _, site := range sites {\n\t\tfmt.Println(site)\n\t\tbegin := time.Now()\n\t\tif _, err := http.Get(site); err != nil {\n\t\t\tfmt.Println(site, err)\n\t\t\treturn\n\t\t}\n\t\tfmt.Printf(\"Site %q took %s to retrieve.\\n\", site, time.Since(begin))\n\t}\n\tfmt.Printf(\"Entire process took %s\\n\", time.Since(start))\n}", "func NewGetSovereigntyStructuresServiceUnavailable() *GetSovereigntyStructuresServiceUnavailable {\n\treturn &GetSovereigntyStructuresServiceUnavailable{}\n}", "func ListUnspentInfo(rsp http.ResponseWriter, req *http.Request) {\r\n\terrcode := ListUnspentInfo_ErrorCode\r\n\tvars := mux.Vars(req)\r\n\tmh, err := gHandle.MongoHandle(vars[\"type\"])\r\n\tif err != nil {\r\n\t\trsp.Write(common.MakeResponseWithErr(errcode-1, err))\r\n\t\treturn\r\n\t}\r\n\tfragment := common.StartTrace(\"ListUnspentInfo db1\")\r\n\trst, err := mh.GetAddrUnspentInfo(vars[\"address\"])\r\n\tfragment.StopTrace(0)\r\n\tif err != nil {\r\n\t\trsp.Write(common.MakeResponseWithErr(errcode-2, err))\r\n\t\treturn\r\n\t}\r\n\r\n\trsp.Write(common.MakeOkRspByData(rst))\r\n}", "func (p *ExperimentalPlayground) LocationOccupied(location engine.Location) bool {\n\treturn p.gameMap.HasAll(location)\n}", "func LastContactAtNotIn(vs ...time.Time) predicate.GameServer {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.GameServer(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldLastContactAt), v...))\n\t})\n}", "func GetUnboundRPs(\n\tctx context.Context, resourcePools []string,\n) ([]string, error) {\n\tvar boundResourcePools []string\n\t_, err := Bun().NewSelect().\n\t\tColumn(\"pool_name\").\n\t\tTable(\"rp_workspace_bindings\").\n\t\tDistinct().\n\t\tExec(ctx, &boundResourcePools)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tboundRPsMap := map[string]bool{}\n\tfor _, boundRP := range boundResourcePools {\n\t\tboundRPsMap[boundRP] = true\n\t}\n\n\tvar unboundRPs []string\n\tfor _, resourcePool := range resourcePools {\n\t\tif !boundRPsMap[resourcePool] {\n\t\t\tunboundRPs = append(unboundRPs, resourcePool)\n\t\t}\n\t}\n\n\treturn unboundRPs, nil\n}", "func TimezoneNotIn(vs ...string) predicate.Location {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\t// if not arguments were provided, append the FALSE constants,\n\t\t// since we can't apply \"IN ()\". This will make this predicate falsy.\n\t\tif len(v) == 0 {\n\t\t\ts.Where(sql.False())\n\t\t\treturn\n\t\t}\n\t\ts.Where(sql.NotIn(s.C(FieldTimezone), v...))\n\t})\n}", "func (m MarketDataSnapshotFullRefresh) GetNoMDEntries() (NoMDEntriesRepeatingGroup, quickfix.MessageRejectError) {\n\tf := NewNoMDEntriesRepeatingGroup()\n\terr := m.GetGroup(f)\n\treturn f, err\n}", "func FindUnprocessedEvents(limit int) ([]EventLogEntry, error) {\n\tout := []EventLogEntry{}\n\tquery := db.Query(unprocessedEvents()).Sort([]string{TimestampKey})\n\tif limit > 0 {\n\t\tquery = query.Limit(limit)\n\t}\n\terr := db.FindAllQ(EventCollection, query, &out)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"fetching unprocessed events\")\n\t}\n\n\treturn out, nil\n}", "func GetLocationListFailErrMocked(t *testing.T, locationsIn []*types.Location) []*types.Location {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewLocationService(cs)\n\tassert.Nil(err, \"Couldn't load location service\")\n\tassert.NotNil(ds, \"Location service not instanced\")\n\n\t// to json\n\tdIn, err := json.Marshal(locationsIn)\n\tassert.Nil(err, \"Location test data corrupted\")\n\n\t// call service\n\tcs.On(\"Get\", \"/wizard/locations\").Return(dIn, 200, fmt.Errorf(\"mocked error\"))\n\tlocationsOut, err := ds.GetLocationList()\n\n\tassert.NotNil(err, \"We are expecting an error\")\n\tassert.Nil(locationsOut, \"Expecting nil output\")\n\tassert.Equal(err.Error(), \"mocked error\", \"Error should be 'mocked error'\")\n\n\treturn locationsOut\n}", "func GetLocationListFailStatusMocked(t *testing.T, locationsIn []*types.Location) []*types.Location {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewLocationService(cs)\n\tassert.Nil(err, \"Couldn't load location service\")\n\tassert.NotNil(ds, \"Location service not instanced\")\n\n\t// to json\n\tdIn, err := json.Marshal(locationsIn)\n\tassert.Nil(err, \"Location test data corrupted\")\n\n\t// call service\n\tcs.On(\"Get\", \"/wizard/locations\").Return(dIn, 499, nil)\n\tlocationsOut, err := ds.GetLocationList()\n\n\tassert.NotNil(err, \"We are expecting an status code error\")\n\tassert.Nil(locationsOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"499\", \"Error should contain http code 499\")\n\n\treturn locationsOut\n}", "func (c *remoteConn) findDisconnectedProxies() ([]services.Server, error) {\n\t// Find all proxies that have connection from the remote domain.\n\tconns, err := c.accessPoint.GetTunnelConnections(c.clusterName, services.SkipValidation())\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tconnected := make(map[string]bool)\n\tfor _, conn := range conns {\n\t\tif c.isOnline(conn) {\n\t\t\tconnected[conn.GetProxyName()] = true\n\t\t}\n\t}\n\n\t// Build a list of local proxies that do not have a remote connection to them.\n\tvar missing []services.Server\n\tproxies, err := c.accessPoint.GetProxies()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tfor i := range proxies {\n\t\tproxy := proxies[i]\n\n\t\t// A proxy should never add itself to the list of missing proxies.\n\t\tif proxy.GetName() == c.proxyName {\n\t\t\tcontinue\n\t\t}\n\n\t\tif !connected[proxy.GetName()] {\n\t\t\tmissing = append(missing, proxy)\n\t\t}\n\t}\n\n\treturn missing, nil\n}", "func (c *CategoryClient) QueryUnsavedPosts(ca *Category) *UnsavedPostQuery {\n\tquery := &UnsavedPostQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := ca.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(category.Table, category.FieldID, id),\n\t\t\tsqlgraph.To(unsavedpost.Table, unsavedpost.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, category.UnsavedPostsTable, category.UnsavedPostsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(ca.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}" ]
[ "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.44651303", "0.4457923", "0.44446677", "0.4438357", "0.44303966", "0.4352599", "0.43289828", "0.43186396", "0.4316377", "0.43010128", "0.42930314", "0.42801717", "0.42706862", "0.42670637", "0.4245951", "0.42372108", "0.42289796", "0.42284995", "0.42224413", "0.4221634", "0.42084143", "0.42084122", "0.4206463", "0.41624376", "0.41555867", "0.4144641", "0.41442537", "0.41432345", "0.41356322", "0.41310483", "0.41310033", "0.41298944", "0.40992346", "0.40927115", "0.40774065", "0.40764517", "0.40758854", "0.406878", "0.40592375", "0.40574974", "0.4045423", "0.40349957", "0.40253934", "0.4017749", "0.4011398", "0.39941388", "0.39888313", "0.39846343", "0.39716804", "0.39711702", "0.39697647", "0.39641282", "0.39635083", "0.39613947", "0.395923", "0.39576066", "0.3950675", "0.3934512", "0.3931681", "0.39178243", "0.39176613", "0.39129135", "0.3909609", "0.3905308", "0.39050245", "0.3903589", "0.38950947", "0.38945878", "0.38933647", "0.38893765", "0.38857982", "0.38769466", "0.38746643", "0.38745043", "0.3870277", "0.38695562", "0.38689134", "0.385864", "0.38571528", "0.38529113" ]
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 = sanitize.SingleLineString(row.LocationHash)\n\n\t// Validate LocationHash.\n\tif err := validate.NonEmptyString(row.LocationHash); err != nil {\n\t\te := err.(errors.Error)\n\t\treturn e.Wrap(\"Validation failed on LocationHash.\")\n\t}\n\n\t// Sanitize LocationString.\n\trow.LocationString = sanitize.SingleLineString(row.LocationString)\n\n\t// Validate LocationString.\n\tif err := validate.NonEmptyString(row.LocationString); err != nil {\n\t\te := err.(errors.Error)\n\t\treturn e.Wrap(\"Validation failed on LocationString.\")\n\t}\n\n\t// Execute query.\n\t_, err = db.Exec(insertQuery_Location,\n\t\trow.DatasetID,\n\t\trow.LocationHash,\n\t\trow.LocationString,\n\t\trow.ParsedCountryCode,\n\t\trow.ParsedPostalCode,\n\t\trow.GeonamesPostalCodes,\n\t\trow.GeonameID,\n\t\trow.GeonamesHierarchy,\n\t\trow.Approved,\n\t\trow.CreatedAt)\n\n\tif err == nil {\n\t\treturn nil\n\t}\n\n\tif err := translateDBError(err); err != nil {\n\t\treturn err\n\t}\n\n\treturn errors.Unexpected.\n\t\tWrap(\"Location.Insert failed: %w\", err).\n\t\tAlert()\n}", "func InsertRoutePoint(db *sql.DB, routeid string, Lat float64, Lon float64, P int) {\n\tid, err := GenerateRandomString(32)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tquery := fmt.Sprintf(\"INSERT INTO RoutePoints VALUES ('%s', '%s', %.10f, %.10f, %d, %d, %d, %d, %d, %d)\", id, routeid, Lat, Lon, time.Now().Day(), time.Now().Month(), time.Now().Year(), time.Now().Hour(), time.Now().Minute(), P)\n\t_, err = db.Query(query)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to execute SQL command:\", err)\n\t\tlog.Fatalln(\"Failed to execute SQL command:\", err)\n\t}\n\tfmt.Println(\"Point for Route ID - \", routeid, \"successfully inserted.\")\n}", "func (Model) Insert(model interface{}) {\n\tdb.Insert(model)\n}", "func (rc ResponseController) CreateLocation(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tvar resp Response\n\tvar req PostRequest\n\n\tdefer r.Body.Close()\n\tjsonIn, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tfmt.Println(\"[email protected]\")\n\t\tpanic(err)\n\t}\n\n\tjson.Unmarshal([]byte(jsonIn), &req)\n\tfmt.Println(\"POST Request:\", req)\n\n\tresp.ID = bson.NewObjectId()\n\t\n\tresp.Coordinate = req.Coordinate\n\tif err := rc.session.DB(\"cmpe277\").C(\"userlocations\").Insert(resp); err != nil {\n\t httpResponse(w, nil, 500)\n\t\tfmt.Println(\"[email protected]\")\n\t\tpanic(err)\n\t}\n\tjsonOut, _ := json.Marshal(resp)\n\thttpResponse(w, jsonOut, 201)\n\tfmt.Println(\"Response:\", string(jsonOut), \" 201 OK\")\n}", "func AddLocation(l Location) {\n\n\t_, err := GetDBRSession(nil).\n\t\tInsertInto(\"locations\").\n\t\tColumns(\"name\", \"address\").\n\t\tValues(l.Name, l.Address).\n\t\tExec()\n\n\tifErr.Panic(\"Can't insert location\", err)\n}", "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_locs SET located = $1, raw = \"+\n\t\t\t\"$2 WHERE raw = $2 RETURNING id\", l.Located, l.Raw)\n\t} else {\n\t\t// Check accuracy value\n\t\tif l.Accuracy == AccuracyErr {\n\t\t\treturn fmt.Errorf(\"invalid accuracy value: %s\",\n\t\t\t\tl.Accuracy)\n\t\t}\n\t\t// If located\n\t\trow = db.QueryRow(\"UPDATE geo_locs SET located = $1, \"+\n\t\t\t\"gapi_success = $2, lat = $3, long = $4, \"+\n\t\t\t\"postal_addr = $5, accuracy = $6, bounds_provided = $7,\"+\n\t\t\t\"bounds_id = $8, viewport_bounds_id = $9, \"+\n\t\t\t\"gapi_place_id = $10, raw = $11 WHERE raw = $11 \"+\n\t\t\t\"RETURNING id\",\n\t\t\tl.Located, l.GAPISuccess, l.Lat, l.Long, l.PostalAddr,\n\t\t\tl.Accuracy, l.BoundsProvided, l.BoundsID,\n\t\t\tl.ViewportBoundsID, l.GAPIPlaceID, l.Raw)\n\t}\n\n\t// Set ID\n\terr = row.Scan(&l.ID)\n\n\t// If doesn't exist\n\tif err == sql.ErrNoRows {\n\t\t// Return error so we can identify\n\t\treturn err\n\t} else if err != nil {\n\t\t// Other error\n\t\treturn fmt.Errorf(\"error updating GeoLoc, located: %t, err: %s\",\n\t\t\tl.Located, err.Error())\n\t}\n\n\t// Success\n\treturn nil\n}", "func (r *Entity) Insert() (result sql.Result, err error) {\n\treturn Model.Data(r).Insert()\n}", "func (r *Entity) Insert() (result sql.Result, err error) {\n\treturn Model.Data(r).Insert()\n}", "func (r *Entity) Insert() (result sql.Result, err error) {\n\treturn Model.Data(r).Insert()\n}", "func (r *Entity) Insert() (result sql.Result, err error) {\n\treturn Model.Data(r).Insert()\n}", "func (r *Entity) Insert() (result sql.Result, err error) {\n\treturn Model.Data(r).Insert()\n}", "func (r *Entity) Insert() (result sql.Result, err error) {\n\treturn Model.Data(r).Insert()\n}", "func (r *RoomDAO) Insert(room RoomDTO) error {\n\terr := r.db.C(r.collection).Insert(&room)\n\treturn err\n}", "func (p *ProviderDAO) Insert(provider models.Provider) error {\n\terr := db.C(COLLECTION).Insert(&provider)\n\treturn err\n}", "func (lc LocationController) CreateLocation(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\t// Stub a location to be populated from the body\n\n\tvar locationObject Location\n\t//String to store address\n\tvar queryParamBuilder string\n\t// Populate the user data\n\tjson.NewDecoder(r.Body).Decode(&locationObject)\n\n\taddressKeys := strings.Fields(locationObject.Address)\n\tcityKeys := strings.Fields(locationObject.City)\n\tstateKeys := strings.Fields(locationObject.State)\n\tkeys := append(addressKeys, cityKeys...)\n\tlocationKeys := append(keys, stateKeys...)\n\tfor i := 0; i < len(locationKeys); i++ {\n\t\tif i == len(locationKeys)-1 {\n\t\t\tqueryParamBuilder += locationKeys[i]\n\t\t} else {\n\t\t\tqueryParamBuilder += locationKeys[i] + \"+\"\n\t\t}\n\t}\n\turl := fmt.Sprintf(\"http://maps.google.com/maps/api/geocode/json?address=%s&sensor=false\", queryParamBuilder)\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// read json http response\n\tjsonDataFromHTTP, err := ioutil.ReadAll(resp.Body)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tvar coordinates CoordinateResponse\n\n\terr = json.Unmarshal(jsonDataFromHTTP, &coordinates) // here!\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif len(coordinates.Results) == 0 {\n\t\tw.WriteHeader(400)\n\t\treturn\n\t}\n\tlocationObject.Coordinate.Lat = coordinates.Results[0].Geometry.Location.Lat\n\tlocationObject.Coordinate.Lng = coordinates.Results[0].Geometry.Location.Lng\n\n\t// Add an Id\n\tlocationObject.ID = bson.NewObjectId()\n\n\t// Write the user to mongo\n\tlc.session.DB(\"go_rest_api_assignment2\").C(\"locations\").Insert(locationObject)\n\n\t// Marshal provided interface into JSON structure\n\tuj, _ := json.Marshal(locationObject)\n\n\t// Write content-type, statuscode, payload\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(201)\n\tfmt.Fprintf(w, \"%s\", uj)\n}", "func (o *Latency) Insert(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no latencies provided for insertion\")\n\t}\n\n\tvar err error\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.UpdatedAt.IsZero() {\n\t\t\to.UpdatedAt = currTime\n\t\t}\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t}\n\n\tif err := o.doBeforeInsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(latencyColumnsWithDefault, o)\n\n\tkey := makeCacheKey(columns, nzDefaults)\n\tlatencyInsertCacheMut.RLock()\n\tcache, cached := latencyInsertCache[key]\n\tlatencyInsertCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl, returnColumns := columns.InsertColumnSet(\n\t\t\tlatencyAllColumns,\n\t\t\tlatencyColumnsWithDefault,\n\t\t\tlatencyColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(latencyType, latencyMapping, wl)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcache.retMapping, err = queries.BindMapping(latencyType, latencyMapping, returnColumns)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(wl) != 0 {\n\t\t\tcache.query = fmt.Sprintf(\"INSERT INTO \\\"latencies\\\" (\\\"%s\\\") %%sVALUES (%s)%%s\", strings.Join(wl, \"\\\",\\\"\"), strmangle.Placeholders(dialect.UseIndexPlaceholders, len(wl), 1, 1))\n\t\t} else {\n\t\t\tcache.query = \"INSERT INTO \\\"latencies\\\" %sDEFAULT VALUES%s\"\n\t\t}\n\n\t\tvar queryOutput, queryReturning string\n\n\t\tif len(cache.retMapping) != 0 {\n\t\t\tqueryReturning = fmt.Sprintf(\" RETURNING \\\"%s\\\"\", strings.Join(returnColumns, \"\\\",\\\"\"))\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(cache.query, queryOutput, queryReturning)\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(queries.PtrsFromMapping(value, cache.retMapping)...)\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to insert into latencies\")\n\t}\n\n\tif !cached {\n\t\tlatencyInsertCacheMut.Lock()\n\t\tlatencyInsertCache[key] = cache\n\t\tlatencyInsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterInsertHooks(ctx, exec)\n}", "func (p *Patch) Insert() error {\n\treturn db.Insert(Collection, p)\n}", "func (p *Patch) Insert() error {\n\treturn db.Insert(Collection, p)\n}", "func (db *DB) Insert(model ...interface{}) error {\n\treturn db.inner.Insert(model...)\n}", "func (t *Territory) Insert(ctx context.Context, db DB) error {\n\tswitch {\n\tcase t._exists: // already exists\n\t\treturn logerror(&ErrInsertFailed{ErrAlreadyExists})\n\tcase t._deleted: // deleted\n\t\treturn logerror(&ErrInsertFailed{ErrMarkedForDeletion})\n\t}\n\t// insert (manual)\n\tconst sqlstr = `INSERT INTO territories (` +\n\t\t`territory_id, territory_description, region_id` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3` +\n\t\t`)`\n\t// run\n\tlogf(sqlstr, t.TerritoryID, t.TerritoryDescription, t.RegionID)\n\tif _, err := db.ExecContext(ctx, sqlstr, t.TerritoryID, t.TerritoryDescription, t.RegionID); err != nil {\n\t\treturn logerror(err)\n\t}\n\t// set exists\n\tt._exists = true\n\treturn nil\n}", "func (b *Build) Insert() error {\n\treturn db.Insert(Collection, b)\n}", "func (this *Route) Insert() (isInsert bool, err error) {\n\tif this.Url == \"\" {\n\t\treturn false, errors.New(\"路由地址不能为空\")\n\t}\n\n\tself := Route{}\n\tself.FindByUrl(this.Url)\n\tif self.Id > 0 {\n\t\treturn false, errors.New(\"路由地址已经存在\")\n\t}\n\n\tthis.CreateAt = int32(time.Now().Unix())\n\to := orm.NewOrm()\n\n\tid, err := o.Insert(this)\n\n\treturn id > 0, err\n}", "func (r *Repository) Insert(ctx context.Context, registrant Registrant) error {\n\ttx := r.db.Begin()\n\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\ttx.Rollback()\n\t\t}\n\t}()\n\n\tif err := tx.Error; err != nil {\n\t\treturn err\n\t}\n\n\tif err := tx.Create(&registrant).Error; err != nil {\n\t\ttx.Rollback()\n\t\treturn err\n\t}\n\n\treturn tx.Commit().Error\n}", "func Insert(w http.ResponseWriter, r *http.Request) {\n\tdb := dbConn()\n\tif r.Method == \"POST\" {\n\t\tname := r.FormValue(\"name\")\n\t\tcity := r.FormValue(\"city\")\n\t\tinsForm, err := db.Prepare(\"INSERT INTO Employee(name, city) VALUES(?,?)\")\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tinsForm.Exec(name, city)\n\t\tlog.Println(\"INSERT: Name: \" + name + \" | City: \" + city)\n\t}\n\tdefer db.Close()\n\thttp.Redirect(w, r, \"/\", 301)\n}", "func (s *LocationsOp) Create(ctx context.Context, locCreate LocationCreate) (*Location, *http.Response, error) {\n\tpath := locationsPath\n\n\treq, err := s.client.NewRequest(ctx, http.MethodPost, path, locCreate)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tlocation := new(Location)\n\tresp, err := s.client.Do(ctx, req, location)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn location, resp, err\n}", "func (pg *PGStorage) Insert(a *Address) error {\n\tvar err error\n\terr = pg.con.QueryRow(`\n\t\tINSERT INTO address(hash, income, outcome, ballance)\n\t\tvalues($1, $2, $3, $4)\n\t\tRETURNING ID`,\n\t\ta.Hash,\n\t\ta.Income,\n\t\ta.Outcome,\n\t\ta.Ballance).Scan(\n\t\t&a.ID)\n\treturn err\n}", "func (luo *LocationUpdateOne) Save(ctx context.Context) (*Location, error) {\n\tif luo.update_time == nil {\n\t\tv := location.UpdateDefaultUpdateTime()\n\t\tluo.update_time = &v\n\t}\n\tif luo.name != nil {\n\t\tif err := location.NameValidator(*luo.name); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %v\", err)\n\t\t}\n\t}\n\tif luo.latitude != nil {\n\t\tif err := location.LatitudeValidator(*luo.latitude); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"ent: validator failed for field \\\"latitude\\\": %v\", err)\n\t\t}\n\t}\n\tif luo.longitude != nil {\n\t\tif err := location.LongitudeValidator(*luo.longitude); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"ent: validator failed for field \\\"longitude\\\": %v\", err)\n\t\t}\n\t}\n\tif len(luo._type) > 1 {\n\t\treturn nil, errors.New(\"ent: multiple assignments on a unique edge \\\"type\\\"\")\n\t}\n\tif luo.clearedType && luo._type == nil {\n\t\treturn nil, errors.New(\"ent: clearing a unique edge \\\"type\\\"\")\n\t}\n\tif len(luo.parent) > 1 {\n\t\treturn nil, errors.New(\"ent: multiple assignments on a unique edge \\\"parent\\\"\")\n\t}\n\treturn luo.sqlSave(ctx)\n}", "func InsertRoute(db *sql.DB, id string, U string) {\n\tquery := fmt.Sprintf(\"INSERT INTO Routes VALUES ('%s', '%s', NULL, NULL, NULL)\", id, U)\n\t_, err := db.Query(query)\n\tif err != nil {\n\t\tlog.Fatalln(\"Failed to execute SQL command:\", err)\n\t}\n\tfmt.Println(\"Route ID - \", id, \"successfully inserted.\")\n}", "func (dao *LocationDAO) CreatePickupLocation(c models.PickupLocation) (models.PickupLocation, error) {\n\trows, err := dao.DB.NamedQuery(\n\t\t`INSERT INTO pickup_locations (pul_type, pul_display_name, pul_current_cars)\n VALUES (:pul_type, :pul_display_name, :pul_current_cars)\n RETURNING pul_id`,\n\t\tc)\n\tif err != nil {\n\t\treturn c, err\n\t}\n\tid, err := extractLastInsertId(rows)\n\tc.Id = id\n\treturn c, err\n}", "func CreateLocation(warehouseID int64, name string) (*Location, error) {\r\n\trow := database.GetDB().QueryRow(\"INSERT INTO wms.locations (warehouse_id, location) VALUES($1, $2) RETURNING location, warehouse_id\", warehouseID, name)\r\n\tvar location Location\r\n\terr := row.Scan(&location.ID, &location.WarehouseID)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\treturn &location, nil\r\n}", "func (table *Table) Insert(db DB, record Map) (Result, error) {\n\tc := Context{StateInsert, db, table, table, record, Field{}}\n\treturn table.execAction(c, table.OnInsert, table.DefaultInsert)\n}", "func (m *MovieModel) Insert(movie *Movie) error {\n\t// Define the SQL query for inserting a new record in the movies table and returning the system generated data\n\tquery := `INSERT INTO movies (title, year, runtime, genres) \n\t\t\t\t\t\tVALUES ($1, $2, $3, $4)\n\t\t\t\t\t\tRETURNING id, created_at, version`\n\n\t// Create an args slice containing the values for the placeholder parameters from the movie struct\n\targs := []interface{}{movie.Title, movie.Year, movie.Runtime, pq.Array(movie.Genres)}\n\n\tctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n\tdefer cancel()\n\n\t// Execute the query.\n\treturn m.DB.QueryRowContext(ctx, query, args...).Scan(&movie.ID, &movie.CreatedAt, &movie.Version)\n}", "func (r *Repository) InsertAddress(data *Address) (err error) {\n\n\terr = r.db.Create(data).Error\n\n\treturn\n}", "func (lu *LocationUpdate) Save(ctx context.Context) (int, error) {\n\tif lu.update_time == nil {\n\t\tv := location.UpdateDefaultUpdateTime()\n\t\tlu.update_time = &v\n\t}\n\tif lu.name != nil {\n\t\tif err := location.NameValidator(*lu.name); err != nil {\n\t\t\treturn 0, fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %v\", err)\n\t\t}\n\t}\n\tif lu.latitude != nil {\n\t\tif err := location.LatitudeValidator(*lu.latitude); err != nil {\n\t\t\treturn 0, fmt.Errorf(\"ent: validator failed for field \\\"latitude\\\": %v\", err)\n\t\t}\n\t}\n\tif lu.longitude != nil {\n\t\tif err := location.LongitudeValidator(*lu.longitude); err != nil {\n\t\t\treturn 0, fmt.Errorf(\"ent: validator failed for field \\\"longitude\\\": %v\", err)\n\t\t}\n\t}\n\tif len(lu._type) > 1 {\n\t\treturn 0, errors.New(\"ent: multiple assignments on a unique edge \\\"type\\\"\")\n\t}\n\tif lu.clearedType && lu._type == nil {\n\t\treturn 0, errors.New(\"ent: clearing a unique edge \\\"type\\\"\")\n\t}\n\tif len(lu.parent) > 1 {\n\t\treturn 0, errors.New(\"ent: multiple assignments on a unique edge \\\"parent\\\"\")\n\t}\n\treturn lu.sqlSave(ctx)\n}", "func (m *BookingModel) Insert(booking models.Booking) (*mongo.InsertOneResult, error) {\n\treturn m.C.InsertOne(context.TODO(), booking)\n}", "func Insert(stmt bolt.Stmt, data interface{}) error {\n\n\tm := structs.Map(data)\n\n\tflag := false\n\tfor _, v := range m {\n\t\tif reflect.ValueOf(v).Kind() == reflect.Map {\n\t\t\tflag = true\n\t\t}\n\t}\n\tif flag {\n\t\tm = flatMap(m, \"\")\n\t}\n\n\t// Parses data struct to a map before sending it to ExeNeo()\n\tresult, err := stmt.ExecNeo(m)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnumResult, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Printf(\"CREATED ROWS: %d\\n\", numResult)\n\treturn nil\n}", "func Insert(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tif r.Body == nil {\n\t\thttp.Error(w, http.StatusText(400), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tstnds, err := insertDB(r)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tsjson, err := json.Marshal(stnds)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusCreated) // 201\n\tfmt.Fprintf(w, \"%s\\n\", sjson)\n}", "func (r *Elasticsearch) Insert(record metadata.Record) error {\n\tctx := context.Background()\n\trecord.Properties.Geocatalogo.Inserted = time.Now()\n\t_, err := r.Index.Index().\n\t\tIndex(r.IndexName).\n\t\tType(r.TypeName).\n\t\tId(record.Identifier).\n\t\tBodyJson(record).\n\t\tDo(ctx)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (m BooksModel) Insert(books *Books) error {\n\tquery := `INSERT INTO books (title, year, pages)\n\t\t\tVALUES ($1, $2, $3)\n\t\t\tRETURNING id, created_at, version`\n\n\targs := []interface{}{books.Title, books.Year, books.Pages}\n\n\tctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n\tdefer cancel()\n\n\treturn m.DB.QueryRowContext(ctx, query, args...).Scan(&books.ID, &books.CreatedAt, &books.Version)\n}", "func (m *SnippetModel) Insert(title, content, expires string) (int, error) {\n\t// Create the SQL statement we want to execute. It's split over several lines\n\t// for readability - so it's surrounded by backquotes instead of normal double quotes\n\tstmt := `INSERT INTO snippets (title, content, created, expires)\n\tvalues (?, ?, UTC_TIMESTAMP(), DATE_ADD(UTC_TIMESTAMP, INTERVAL ? DAY))`\n\n\t// Use the Exec() method on the embedded connection pool to execute the statement.\n\t// The first parameter is the SQL statement followed by the table fields.\n\t// The method returns a sql.Result object which contains some basic information\n\t// about what happened when the statement was executed\n\tresult, err := m.DB.Exec(stmt, title, content, expires)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t// Use the LastInsertId() method on the result object to get the ID of our\n\t// newly inserted record in the snippets table.\n\tid, err := result.LastInsertId()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t// The ID returned has the type int64 so we convert it to an int type before returning\n\treturn int(id), nil\n}", "func (r *WorkplaceRepository) Add(ctx context.Context, entity *model.WorkplaceInfo) error {\n\tdata, err := json.Marshal(entity)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error to marshal workplace info\")\n\t}\n\t_, err = r.db.Conn.Exec(ctx, \"INSERT INTO workplace(info) VALUES($1) ON CONFLICT (info) DO UPDATE SET updated_at=now()\", data)\n\treturn err\n}", "func (a *Advert) Insert(e *models.Advert) error {\n\tvar result sql.Result\n\tresult, err := Storage.Run(\"INSERT INTO advert (locality, link, hash_id, price, name, description, status, created) VALUES( ?, ?, ?, ?, ?, ?, ?, ? )\",\n\t\te.Locality, e.Link, e.HashID, e.Price, e.Name, e.Description, e.Status, e.GetCreated().Unix())\n\tif err != nil {\n\t\treturn err\n\t}\n\te.ID, err = result.LastInsertId()\n\treturn err\n}", "func (g *GameDBModel) Insert(game Game) error {\n\tgame.ID = bson.NewObjectId()\n\terr := database.C(COLLECTION).Insert(&game)\n\n\treturn err\n}", "func (d *dbBase) Insert(ctx context.Context, q dbQuerier, mi *modelInfo, ind reflect.Value, tz *time.Location) (int64, error) {\n\tnames := make([]string, 0, len(mi.fields.dbcols))\n\tvalues, autoFields, err := d.collectValues(mi, ind, mi.fields.dbcols, false, true, &names, tz)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tid, err := d.InsertValue(ctx, q, mi, false, names, values)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tif len(autoFields) > 0 {\n\t\terr = d.ins.setval(ctx, q, mi, autoFields)\n\t}\n\treturn id, err\n}", "func (u *User) Insert() error {\n\treturn db.Create(&u).Error\n}", "func Insert(r *http.Request, col *tiedot.Col) (id int, err error) {\n\tdata := map[string]interface{}{}\n\tdecoder := json.NewDecoder(r.Body)\n\tdecoder.Decode(&data)\n\n\tid, err = col.Insert(data)\n\treturn\n}", "func (o *Store) Insert(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no stores provided for insertion\")\n\t}\n\n\tvar err error\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\tif o.UpdatedAt.IsZero() {\n\t\t\to.UpdatedAt = currTime\n\t\t}\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(storeColumnsWithDefault, o)\n\n\tkey := makeCacheKey(columns, nzDefaults)\n\tstoreInsertCacheMut.RLock()\n\tcache, cached := storeInsertCache[key]\n\tstoreInsertCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl, returnColumns := columns.InsertColumnSet(\n\t\t\tstoreAllColumns,\n\t\t\tstoreColumnsWithDefault,\n\t\t\tstoreColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(storeType, storeMapping, wl)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcache.retMapping, err = queries.BindMapping(storeType, storeMapping, returnColumns)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(wl) != 0 {\n\t\t\tcache.query = fmt.Sprintf(\"INSERT INTO \\\"stores\\\" (\\\"%s\\\") %%sVALUES (%s)%%s\", strings.Join(wl, \"\\\",\\\"\"), strmangle.Placeholders(dialect.UseIndexPlaceholders, len(wl), 1, 1))\n\t\t} else {\n\t\t\tcache.query = \"INSERT INTO \\\"stores\\\" %sDEFAULT VALUES%s\"\n\t\t}\n\n\t\tvar queryOutput, queryReturning string\n\n\t\tif len(cache.retMapping) != 0 {\n\t\t\tqueryReturning = fmt.Sprintf(\" RETURNING \\\"%s\\\"\", strings.Join(returnColumns, \"\\\",\\\"\"))\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(cache.query, queryOutput, queryReturning)\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(queries.PtrsFromMapping(value, cache.retMapping)...)\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to insert into stores\")\n\t}\n\n\tif !cached {\n\t\tstoreInsertCacheMut.Lock()\n\t\tstoreInsertCache[key] = cache\n\t\tstoreInsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "func (c Client) Insert(entity interface{}, ptrResult interface{}) error {\n\treturn c.InsertInto(entity, ptrResult, reflect.TypeOf(entity).Name())\n}", "func (ps *PlayerStore) Insert(ctx context.Context, player store.Player) (*store.Player, error) {\n\tquery := `\n INSERT INTO players(roster_id,first_name,last_name,alias,status)\n VALUES($1,$2,$3,$4,$5)\n RETURNING *\n `\n\tdb := ps.db.GetDB()\n\tctx, cancel := ps.db.RequestContext(ctx)\n\tdefer cancel()\n\n\tvar p store.Player\n\terr := db.QueryRowContext(ctx, query,\n\t\tplayer.RosterID,\n\t\tplayer.FirstName,\n\t\tplayer.LastName,\n\t\tplayer.Alias,\n\t\tplayer.Status).\n\t\tScan(\n\t\t\t&p.PlayerID,\n\t\t\t&p.RosterID,\n\t\t\t&p.FirstName,\n\t\t\t&p.LastName,\n\t\t\t&p.Alias,\n\t\t\t&p.Status)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &p, nil\n}", "func (dao *LocationDAO) CreateStockingLocation(stl models.StockingLocation) (models.StockingLocation, error) {\n\t_, err := dao.DB.NamedExec(\n\t\t`INSERT INTO stocking_locations (stl_id, stl_temperature_zone, stl_type, stl_pick_segment, stl_aisle, stl_bay,\n stl_shelf, stl_shelf_slot, stl_height, stl_width, stl_depth, stl_assigned_sku, stl_needs_qc, stl_last_qc_date)\n VALUES (:stl_id, :stl_temperature_zone, :stl_type, :stl_pick_segment, :stl_aisle, :stl_bay, :stl_shelf,\n :stl_shelf_slot, :stl_height, :stl_width, :stl_depth, :stl_assigned_sku, :stl_needs_qc, :stl_last_qc_date)`,\n\t\tstl)\n\treturn stl, err\n}", "func (o *Operation) insertMarker(m *Marker) error {\n\t_, err := db.Exec(\"INSERT INTO marker (ID, opID, PortalID, type, comment) VALUES (?, ?, ?, ?, ?)\",\n\t\tm.ID, o.ID, m.PortalID, m.Type, m.Comment)\n\tif err != nil {\n\t\tLog.Error(err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (ds *MySQLDatastore) InsertRoute(ctx context.Context, route *models.Route) (*models.Route, error) {\n\thbyte, err := json.Marshal(route.Headers)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcbyte, err := json.Marshal(route.Config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = ds.Tx(func(tx *sql.Tx) error {\n\t\tr := tx.QueryRow(`SELECT 1 FROM apps WHERE name=?`, route.AppName)\n\t\tif err := r.Scan(new(int)); err != nil {\n\t\t\tif err == sql.ErrNoRows {\n\t\t\t\treturn models.ErrAppsNotFound\n\t\t\t}\n\t\t}\n\t\tsame, err := tx.Query(`SELECT 1 FROM routes WHERE app_name=? AND path=?`,\n\t\t\troute.AppName, route.Path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer same.Close()\n\t\tif same.Next() {\n\t\t\treturn models.ErrRoutesAlreadyExists\n\t\t}\n\n\t\t_, err = tx.Exec(`\n\t\tINSERT INTO routes (\n\t\t\tapp_name,\n\t\t\tpath,\n\t\t\timage,\n\t\t\tformat,\n\t\t\tmaxc,\n\t\t\tmemory,\n\t\t\ttype,\n\t\t\ttimeout,\n\t\t\tidle_timeout,\n\t\t\theaders,\n\t\t\tconfig\n\t\t)\n\t\tVALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`,\n\t\t\troute.AppName,\n\t\t\troute.Path,\n\t\t\troute.Image,\n\t\t\troute.Format,\n\t\t\troute.MaxConcurrency,\n\t\t\troute.Memory,\n\t\t\troute.Type,\n\t\t\troute.Timeout,\n\t\t\troute.IdleTimeout,\n\t\t\tstring(hbyte),\n\t\t\tstring(cbyte),\n\t\t)\n\t\treturn err\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn route, nil\n}", "func (r *Room) Insert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif r._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql insert query, primary key must be provided\n\tconst sqlstr = `INSERT INTO ms.room (` +\n\t\t`RoomId, RoomKey, RoomTypeEnum, UserId, LastSeqSeen, LastSeqDelete, PeerUserId, GroupId, CreatedTime, CurrentSeq` +\n\t\t`) VALUES (` +\n\t\t`?, ?, ?, ?, ?, ?, ?, ?, ?, ?` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, r.RoomId, r.RoomKey, r.RoomTypeEnum, r.UserId, r.LastSeqSeen, r.LastSeqDelete, r.PeerUserId, r.GroupId, r.CreatedTime, r.CurrentSeq)\n\t_, err = db.Exec(sqlstr, r.RoomId, r.RoomKey, r.RoomTypeEnum, r.UserId, r.LastSeqSeen, r.LastSeqDelete, r.PeerUserId, r.GroupId, r.CreatedTime, r.CurrentSeq)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\tr._exists = true\n\n\tOnRoom_AfterInsert(r)\n\n\treturn nil\n}", "func (c *Company) Insert() error {\n\tresult := initdb.DbInstance.Create(c)\n\tlog.Println(\"Created -> \", result)\n\treturn result.Error\n}", "func (c *Catalog) Insert(r *Record) error {\n\tif r.Origin == \"\" {\n\t\treturn ErrEmptyOrigin\n\t} else if r.Source == \"\" {\n\t\treturn ErrEmptySource\n\t} else if r.Metric == \"\" {\n\t\treturn ErrEmptyMetric\n\t}\n\n\torigin, ok := c.Origins[r.Origin]\n\tif !ok {\n\t\tc.Origins[r.Origin] = &Origin{\n\t\t\tName: r.Origin,\n\t\t\tSources: make(map[string]*Source),\n\t\t\tcatalog: c,\n\t\t}\n\t\torigin = c.Origins[r.Origin]\n\t}\n\n\tsource, ok := origin.Sources[r.Source]\n\tif !ok {\n\t\torigin.Sources[r.Source] = &Source{\n\t\t\tName: r.Source,\n\t\t\tMetrics: make(map[string]*Metric),\n\t\t\torigin: origin,\n\t\t}\n\t\tsource = origin.Sources[r.Source]\n\t}\n\n\t_, ok = source.Metrics[r.Metric]\n\tif !ok {\n\t\tsource.Metrics[r.Metric] = &Metric{\n\t\t\tName: r.Metric,\n\t\t\tAttributes: r.Attributes,\n\t\t\tsource: source,\n\t\t}\n\t}\n\n\treturn nil\n}", "func (d *DeliveryCity) Insert() (code int, err error) {\n mConn := mymongo.Conn()\n defer mConn.Close()\n\n c := mConn.DB(\"\").C(DBTableDeliveryCity)\n d.ID = bson.NewObjectId()\n\n err = c.Insert(d)\n if err != nil {\n if mgo.IsDup(err) {\n code = ErrDupRows\n } else {\n code = ErrDatabase\n }\n } else {\n code = 0\n }\n\n return\n}", "func (db Database) InsertPlacement() Placement {\n\tresult := Placement{ID: db.nextID()}\n\tdb.insert(result)\n\treturn result\n}", "func (locService *LocationService) AddLocation(loc *Location) (*Location, error) {\n\tlocation, err := locService.Repo.Save(loc)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn location, err\n}", "func (o *Operation) insertPortal(p *Portal) error {\n\t_, err := db.Exec(\"INSERT IGNORE INTO portal (ID, opID, name, loc) VALUES (?, ?, ?, POINT(?, ?))\",\n\t\tp.ID, o.ID, p.Name, p.Lon, p.Lat)\n\tif err != nil {\n\t\tLog.Error(err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func Insert() error {\n\tuser := &TbUser{\n\t\tName: \"viney\",\n\t\tEmail: \"[email protected]\",\n\t\tCreated: time.Now().Format(\"2006-01-02 15:04:05\"),\n\t}\n\treturn orm.Save(user)\n}", "func (conn *Connection) Insert(doc interface{}) error {\n\treturn conn.collection.Insert(doc)\n}", "func (c *CoursesDAO) Insert(course models.Course) error {\n\terr := db.C(COLLECTION).Insert(&course)\n\treturn err\n}", "func (m *SnippetModel) Insert(title, content, expires string) (int, error) {\n\t// Start a transaction\n\t// Each action that is done is atomic in nature:\n\t// All statements are executed successfully or no statement is executed\n\ttx, err := m.DB.Begin()\n\tif err != nil {\n\t\treturn 0, nil\n\t}\n\n\t// Statement to insert data to the database\n\tstmt := `INSERT INTO snippets (title, content, created, expires)\n\tVALUES(?, ?, UTC_TIMESTAMP(), DATE_ADD(UTC_TIMESTAMP(), INTERVAL ? DAY))`\n\t// Pass in the placeholder parameters aka the ? in the stmt\n\tresult, err := tx.Exec(stmt, title, content, expires)\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn 0, err\n\t}\n\t// Return the id of the inserted record in the snippets table\n\tid, err := result.LastInsertId()\n\tif err != nil {\n\t\ttx.Rollback()\n\t\treturn 0, err\n\t}\n\n\t// id is an int64 to convert it to a int\n\terr = tx.Commit()\n\treturn int(id), err\n\n}", "func (a *APIv1) PostLocation(location *entities.Location) (*entities.Location, []error) {\n\t_, err := location.ContainsMandatoryParams()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsupported, err2 := entities.CheckEncodingSupported(location, location.EncodingType)\n\tif !supported || err2 != nil {\n\t\treturn nil, []error{err2}\n\t}\n\n\tl, err2 := a.db.PostLocation(location)\n\tif err2 != nil {\n\t\treturn nil, []error{err2}\n\t}\n\tl.SetAllLinks(a.config.GetExternalServerURI())\n\treturn l, nil\n}", "func (pc *PlaceCreate) Save(ctx context.Context) (*Place, error) {\n\tif _, ok := pc.mutation.PLACE(); !ok {\n\t\treturn nil, &ValidationError{Name: \"PLACE\", err: errors.New(\"ent: missing required field \\\"PLACE\\\"\")}\n\t}\n\tif v, ok := pc.mutation.PLACE(); ok {\n\t\tif err := place.PLACEValidator(v); err != nil {\n\t\t\treturn nil, &ValidationError{Name: \"PLACE\", err: fmt.Errorf(\"ent: validator failed for field \\\"PLACE\\\": %w\", err)}\n\t\t}\n\t}\n\tvar (\n\t\terr error\n\t\tnode *Place\n\t)\n\tif len(pc.hooks) == 0 {\n\t\tnode, err = pc.sqlSave(ctx)\n\t} else {\n\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\tmutation, ok := m.(*PlaceMutation)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t}\n\t\t\tpc.mutation = mutation\n\t\t\tnode, err = pc.sqlSave(ctx)\n\t\t\tmutation.done = true\n\t\t\treturn node, err\n\t\t})\n\t\tfor i := len(pc.hooks) - 1; i >= 0; i-- {\n\t\t\tmut = pc.hooks[i](mut)\n\t\t}\n\t\tif _, err := mut.Mutate(ctx, pc.mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn node, err\n}", "func (p *Project) Insert(session *xorm.Session) (int, error) {\n\taffected, err := session.Insert(p)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn 0, err\n\t}\n\treturn int(affected), nil\n}", "func (mapper *Mapper) Insert() {\n\tDB.Create(mapper)\n\tmapsets, err := mapper.GetMapsets()\n\tif err != nil {\n\t\tlog.Printf(\"Mapsets could not be retrieved for %s\\n\", mapper.Username)\n\t\treturn\n\t}\n\n\t// Add the mapper's mapsets to the DB.\n\tinserted := []*Mapset{}\n\tfor _, mapset := range mapsets {\n\t\tif !HasMapset(inserted, mapset) {\n\t\t\tinserted = append(inserted, mapset)\n\t\t\tmapset.MapperID = mapper.ID\n\t\t\tDB.Create(&mapset)\n\t\t}\n\t}\n}", "func (model *SnippetModel) Insert(title, content, expires string) (int, error) {\n\tstmt := `INSERT INTO snippets (title, content, created, expires)\n\tVALUES(?, ?, UTC_TIMESTAMP(), DATE_ADD(UTC_TIMESTAMP(), INTERVAL ? DAY))`\n\n\tresult, err := model.DB.Exec(stmt, title, content, expires)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tid, err := result.LastInsertId()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn int(id), nil\n}", "func (s *Stock) Insert(stockModel model.Model) *errors.Error {\n\tstockModelObj, ok := stockModel.(*model.Stock)\n\tif false == ok {\n\t\treturn errors.Wrap(fmt.Errorf(\"Failed asserting to *model.Stock\"), 0)\n\t}\n\tfoundModel, _ := s.FindByID(stockModel.GetID())\n\tif foundModel != nil {\n\t\treturn errors.Wrap(fmt.Errorf(\"cannot insert, model with id: %v already exists\", stockModel.GetID()), 0)\n\t}\n\tstmt, err := s.db.Prepare(\"INSERT INTO stock(SKU, NAME, QUANTITY, BUY_PRICE, SELL_PRICE) values(?,?,?,?,?)\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, 0)\n\t}\n\tdefer stmt.Close()\n\t_, err = stmt.Exec(stockModelObj.Sku, stockModelObj.Name, stockModelObj.Quantity, stockModelObj.BuyPrice, stockModelObj.SellPrice)\n\tif err != nil {\n\t\treturn errors.Wrap(err, 0)\n\t}\n\treturn nil\n}", "func (o *Origin) Insert(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no origins provided for insertion\")\n\t}\n\n\tvar err error\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif queries.MustTime(o.CreatedAt).IsZero() {\n\t\t\tqueries.SetScanner(&o.CreatedAt, currTime)\n\t\t}\n\t\tif queries.MustTime(o.UpdatedAt).IsZero() {\n\t\t\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\t\t}\n\t}\n\n\tif err := o.doBeforeInsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(originColumnsWithDefault, o)\n\n\tkey := makeCacheKey(columns, nzDefaults)\n\toriginInsertCacheMut.RLock()\n\tcache, cached := originInsertCache[key]\n\toriginInsertCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl, returnColumns := columns.InsertColumnSet(\n\t\t\toriginColumns,\n\t\t\toriginColumnsWithDefault,\n\t\t\toriginColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(originType, originMapping, wl)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcache.retMapping, err = queries.BindMapping(originType, originMapping, returnColumns)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(wl) != 0 {\n\t\t\tcache.query = fmt.Sprintf(\"INSERT INTO \\\"origins\\\" (\\\"%s\\\") %%sVALUES (%s)%%s\", strings.Join(wl, \"\\\",\\\"\"), strmangle.Placeholders(dialect.UseIndexPlaceholders, len(wl), 1, 1))\n\t\t} else {\n\t\t\tcache.query = \"INSERT INTO \\\"origins\\\" %sDEFAULT VALUES%s\"\n\t\t}\n\n\t\tvar queryOutput, queryReturning string\n\n\t\tif len(cache.retMapping) != 0 {\n\t\t\tqueryReturning = fmt.Sprintf(\" RETURNING \\\"%s\\\"\", strings.Join(returnColumns, \"\\\",\\\"\"))\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(cache.query, queryOutput, queryReturning)\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(queries.PtrsFromMapping(value, cache.retMapping)...)\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to insert into origins\")\n\t}\n\n\tif !cached {\n\t\toriginInsertCacheMut.Lock()\n\t\toriginInsertCache[key] = cache\n\t\toriginInsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterInsertHooks(ctx, exec)\n}", "func (c *Conn) Insert(ctx context.Context, i Item) (err error) {\n\t_, err = c.db.Exec(ctx, \"INSERT INTO jobs (url) VALUES ($1)\", i.URL)\n\treturn\n}", "func (p *Personal) Insert(ctx context.Context, document *PersonalData) (interface{}, error) {\n\ti, err := p.DB.Insert(ctx, document)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not insert personal data\")\n\t}\n\treturn i, nil\n}", "func (h *UrlHandler) Insert(c *gin.Context) {\n\tvar urlSh models.URLShorten\n\n\terr := c.ShouldBindWith(&urlSh, binding.FormPost)\n\tif err != nil {\n\t\te := NewAPIError(400, CodeBadRequest, err.Error(), errors.New(\"Bad Request\"))\n\t\tc.JSON(e.Status, e)\n\t\treturn\n\t}\n\n\tif !utils.IsRequestURL(urlSh.LongURL) {\n\t\te := NewAPIError(422, CodeInvalidParam, \"\", fmt.Errorf(\"Invalid longUrl: %s\", urlSh.LongURL))\n\t\tc.JSON(e.Status, e)\n\t\treturn\n\t}\n\n\tres, err := h.service.Insert(c, &urlSh)\n\tif err != nil {\n\t\tif IsNotFound(err) {\n\t\t\tc.JSON(404, ErrAPINotFound)\n\t\t\treturn\n\t\t}\n\n\t\tlogrus.Error(err)\n\t\tc.JSON(500, ErrAPIInternal)\n\t\treturn\n\t}\n\n\tjsonData(c, http.StatusCreated, res)\n}", "func Insert() error {\n\tuser := &Users{\n\t\tUid: 1,\n\t\tName: \"viney\",\n\t\tEmail: \"[email protected]\",\n\t\tCreated: time.Now(),\n\t}\n\n\tid, err := engine.InsertOne(user)\n\tif err != nil {\n\t\treturn err\n\t} else if id <= 0 {\n\t\treturn errors.New(\"插入失败\")\n\t}\n\n\treturn nil\n}", "func (r Item) Insert() error {\n\tr.ID = bson.NewObjectId()\n\terr := db.C(\"item\").Insert(&r)\n\treturn err\n}", "func (m *PersonDAO) Insert(person Person) error {\n\terr := db.C(COLLECTION).Insert(&person)\n\treturn err\n}", "func (m ComicsModel) Insert(comics *Comics) error {\n\tquery := `INSERT INTO comics (title, year, pages)\n\t\t\tVALUES ($1, $2, $3)\n\t\t\tRETURNING id, created_at, version`\n\n\targs := []interface{}{comics.Title, comics.Year, comics.Pages}\n\n\tctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n\tdefer cancel()\n\n\treturn m.DB.QueryRowContext(ctx, query, args...).Scan(&comics.ID, &comics.CreatedAt, &comics.Version)\n}", "func (s *PetStore) Insert(record *Pet) error {\n\treturn s.Store.Insert(Schema.Pet.BaseSchema, record)\n}", "func (sks *SQLSKUStore) Insert(s *model.SKU) (*model.SKU, error) {\n\ts.SKUID = uuid.NewV4().String()\n\ts.CreatedAt = time.Now().UnixNano()\n\ts.UpdatedAt = s.CreatedAt\n\terr := sks.SQLStore.Tx.Insert(s)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"[SQLKUStore] error in calling Insert: %v\", err)\n\t}\n\n\treturn s, err\n}", "func (l *GeoLoc) Query() error {\n\t// Get db instance\n\tdb, err := dstore.NewDB()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error retrieving db instance: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// Query\n\trow := db.QueryRow(\"SELECT id FROM geo_locs WHERE raw = $1\", l.Raw)\n\n\t// Get ID\n\terr = row.Scan(&l.ID)\n\n\t// Check if row found\n\tif err == sql.ErrNoRows {\n\t\t// If not, return so we can identify\n\t\treturn err\n\t} else if err != nil {\n\t\treturn fmt.Errorf(\"error reading GeoLoc ID from row: %s\",\n\t\t\terr.Error())\n\t}\n\n\t// Success\n\treturn nil\n}", "func (dao *LocationDAO) CreatePickContainerLocation(c models.PickContainerLocation) (models.PickContainerLocation, error) {\n\t_, err := dao.DB.NamedExec(\n\t\t`INSERT INTO pick_container_locations (pcl_id, pcl_type, pcl_temperature_zone, pcl_aisle, pcl_bay, pcl_shelf, pcl_shelf_slot)\n VALUES (:pcl_id, :pcl_type, :pcl_temperature_zone, :pcl_aisle, :pcl_bay, :pcl_shelf, :pcl_shelf_slot)`,\n\t\tc)\n\treturn c, err\n}", "func (db *DB) Insert(c *models.Currency) {\n\tdb.Lock()\n\tdefer db.Unlock()\n\n\tdb.store[c.ID] = c\n}", "func (b *Book) Insert() error {\n\tconn, ctx, err := domain.GetConn()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tstmt, err := conn.PrepareContext(ctx, insertQuery)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar returnedID int\n\n\tif err := stmt.QueryRowContext(ctx, b.Name, b.Genre, b.AuthorID).Scan(&returnedID); err != nil {\n\t\treturn err\n\t}\n\tb.ID = returnedID\n\treturn nil\n}", "func (so *SQLOrderItemStore) Insert(oi *model.OrderItem) (*model.OrderItem, error) {\n\toi.OrderItemID = uuid.NewV4().String()\n\toi.CreatedAt = time.Now().UnixNano()\n\toi.UpdatedAt = oi.CreatedAt\n\terr := so.SQLStore.Tx.Insert(oi)\n\treturn oi, err\n}", "func (user User) Insert() (User, error) {\n\tdigest, err := GenerateHash(user.Password)\n\tif err != nil {\n\t\treturn user, err\n\t}\n\t_, err = time.LoadLocation(user.Location)\n\tif err != nil {\n\t\treturn user, errors.New(\"user location invalid\")\n\t}\n\tuser.Digest = digest\n\t_, err = db.NamedExec(\"INSERT INTO users (name, digest, email, location) VALUES (:name, :digest, :email, :location)\", user)\n\tif err != nil {\n\t\tif err.Error() == \"UNIQUE constraint failed: users.email\" || err.Error() == `pq: duplicate key value violates unique constraint \"users_email_key\"` {\n\t\t\treturn user, errors.New(\"user email exists\")\n\t\t}\n\t\treturn user, err\n\t}\n\treturn user, nil\n}", "func (dao *PlayerDAO) Insert(player models.Player) error {\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\t_, err := db.Collection(PCOLLECTION).InsertOne(ctx, bson.D{\n\t\t{\"firstname\", player.FirstName},\n\t\t{\"lastname\", player.LastName},\n\t\t{\"nickname\", player.NickName},\n\t\t{\"skilllevel\", player.SkillLevel},\n\t})\n\treturn err\n}", "func (d Database) Insert(key string, value string) error {\n\tif d.connection == nil {\n\t\treturn errors.New(\"connection not initialized\")\n\t}\n\t_, err := d.connection.Set(d.ctx, key, value, 0).Result()\n\treturn err\n}", "func (md *MapData) InsertNewMapData(session *mgo.Session) {\n\tmd.ID = bson.NewObjectId()\n\n\tsession.DB(\"scratch_map\").C(\"map_data\").Insert(md)\n}", "func (config *CrocConfig) CreateLocation(newLocation LocationAttributes) (Location, error) {\n\tvar locationDetails Location\n\n\tnlbytes, err := json.Marshal(newLocation)\n\tif err != nil {\n\t\treturn locationDetails, err\n\t}\n\n\t// get json bytes from the panel.\n\tlbytes, err := config.queryPanelAPI(\"locations/\", \"post\", nlbytes)\n\tif err != nil {\n\t\treturn locationDetails, err\n\t}\n\n\t// Get server info from the panel\n\t// Unmarshal the bytes to a usable struct.\n\terr = json.Unmarshal(lbytes, &locationDetails)\n\tif err != nil {\n\t\treturn locationDetails, err\n\t}\n\n\treturn locationDetails, nil\n}", "func (r *PlacementsService) Insert(profileId int64, placement *Placement) *PlacementsInsertCall {\n\tc := &PlacementsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\tc.placement = placement\n\treturn c\n}", "func (m MariaDB) Insert(ctx context.Context, document entity.PersonalData) (entity.PersonalData, error) {\n\tp := receive(document)\n\tsqlQuery := \"INSERT INTO person (id, name, last_name, phone, email, year_od_birth ) VALUES (?,?,?,?,?,?)\"\n\t_, err := m.Person.ExecContext(ctx, sqlQuery, p.ID, p.Name, p.LastName, p.Phone, p.Email, p.YearOfBirth)\n\tif err != nil {\n\t\treturn entity.PersonalData{}, errors.Wrap(err, \"could not exec query statement\")\n\t}\n\treturn document, nil\n}", "func (tc *TeamResourceModel) Insert(orms ...orm.Ormer) (uint32, error) {\n\tvar o orm.Ormer\n\tif len(orms) != 1 {\n\t\to = orm.NewOrm()\n\t} else {\n\t\to = orms[0]\n\t}\n\n\tsql := \"INSERT INTO tenx_team_resource_ref (team_id, resource_id, resource_type) VALUES (?, ?, ?);\"\n\t_, err := o.Raw(sql, tc.TeamID, tc.ResourceID, tc.ResourceType).Exec()\n\treturn sqlstatus.ParseErrorCode(err)\n}", "func (o *<%= classedName %>) Insert() error {\n\tif _, err := orm.NewOrm().Insert(o); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func Insert(session *mgo.Session, dbName string, collectionName string, query interface{}) error {\n\n\tc := openCollection(session, dbName, collectionName)\n\terr := c.Insert(query)\n\treturn err\n}", "func (m *GameModel) Insert(game *models.Game) (*models.Game, error) {\n\tvar err error\n\tif game.FranshiseID == \"\" {\n\t\t_, err = m.DB.Exec(`INSERT INTO GAMES (name) VALUES ($1)`, game.Name)\n\t} else {\n\t\t_, err = m.DB.Exec(`INSERT INTO GAMES (name, franchise_id) VALUES ($1, $2)`, game.Name, game.FranshiseID)\n\t}\n\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), `duplicate key value violates unique constraint \"games_name_key\"`) {\n\t\t\treturn nil, ErrNameAlreadyExists\n\t\t}\n\t\treturn nil, fmt.Errorf(\"error while inserting record into the database: %w\", err)\n\t}\n\n\tvar g models.Game\n\tvar fID sql.NullString\n\tif err := m.DB.QueryRow(`SELECT G.ID, G.NAME, G.FRANCHISE_ID FROM GAMES G WHERE G.NAME = $1`, game.Name).Scan(&g.ID, &g.Name, &fID); err != nil {\n\t\treturn nil, fmt.Errorf(\"error while inserting record into the database: %w\", err)\n\t}\n\tg.FranshiseID = fID.String\n\n\treturn &g, nil\n}", "func Insert(w http.ResponseWriter, r *http.Request) {\r\n\tdb := dbconn()\r\n\tif r.Method == \"POST\" {\r\n\t\tfirstname := r.FormValue(\"firstname\")\r\n\t\tlastname := r.FormValue(\"lasttname\")\r\n\t\tage := r.FormValue(\"age\")\r\n\t\tbloodgroup := r.FormValue(\"bloodgroup\")\r\n\t\tinsForm, err := db.Prepare(\"INSERT INTO person(firstname, lastname, age, bloodgroup) VALUES(?,?)\")\r\n\t\tif err != nil {\r\n\t\t\tpanic(err.Error())\r\n\t\t}\r\n\t\tinsForm.Exec(firstname, lastname, age, bloodgroup)\r\n\t\tlog.Println(\"INSERT: fisrtname: \" + firstname + \" | lastname: \" + lastname + \" | age: \" + age + \" | bloodgroup: \" + bloodgroup)\r\n\t}\r\n\tdefer db.Close()\r\n\thttp.Redirect(w, r, \"/\", 301)\r\n}", "func (o *Weather) Insert(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"db: no weather provided for insertion\")\n\t}\n\n\tvar err error\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t}\n\n\tif err := o.doBeforeInsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(weatherColumnsWithDefault, o)\n\n\tkey := makeCacheKey(columns, nzDefaults)\n\tweatherInsertCacheMut.RLock()\n\tcache, cached := weatherInsertCache[key]\n\tweatherInsertCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl, returnColumns := columns.InsertColumnSet(\n\t\t\tweatherColumns,\n\t\t\tweatherColumnsWithDefault,\n\t\t\tweatherColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(weatherType, weatherMapping, wl)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcache.retMapping, err = queries.BindMapping(weatherType, weatherMapping, returnColumns)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(wl) != 0 {\n\t\t\tcache.query = fmt.Sprintf(\"INSERT INTO \\\"prh\\\".\\\"weather\\\" (\\\"%s\\\") %%sVALUES (%s)%%s\", strings.Join(wl, \"\\\",\\\"\"), strmangle.Placeholders(dialect.UseIndexPlaceholders, len(wl), 1, 1))\n\t\t} else {\n\t\t\tcache.query = \"INSERT INTO \\\"prh\\\".\\\"weather\\\" %sDEFAULT VALUES%s\"\n\t\t}\n\n\t\tvar queryOutput, queryReturning string\n\n\t\tif len(cache.retMapping) != 0 {\n\t\t\tqueryReturning = fmt.Sprintf(\" RETURNING \\\"%s\\\"\", strings.Join(returnColumns, \"\\\",\\\"\"))\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(cache.query, queryOutput, queryReturning)\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(queries.PtrsFromMapping(value, cache.retMapping)...)\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"db: unable to insert into weather\")\n\t}\n\n\tif !cached {\n\t\tweatherInsertCacheMut.Lock()\n\t\tweatherInsertCache[key] = cache\n\t\tweatherInsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterInsertHooks(ctx, exec)\n}", "func Insert(db *mongo.Client, r Record) (Record, error) {\n\tctx, _ := context.WithTimeout(context.Background(), 3*time.Second)\n\tres, err := db.Database(\"url-shortener\").Collection(\"urls\").InsertOne(ctx, r)\n\t\n\tif err != nil {\n\t\treturn Record{}, err\n\t}\n\tlog.Printf(\"New record created with the ID: %s\", res.InsertedID)\n\treturn r, nil\n}", "func (m *MongoDAL) Insert(collectionName string, docs ...interface{}) error {\n\treturn m.c(collectionName).Insert(docs)\n}", "func (r *KNNRetriever) Insert(point *embedding.Embedding) error {\n\tif point.Dimensions() != r.vectorsDimension {\n\t\treturn trace.BadParameter(\"point has wrong dimension\")\n\t}\n\tr.tree.Insert(point)\n\tr.mapping[point.GetName()] = point\n\n\treturn nil\n}" ]
[ "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.5280761", "0.5270052", "0.5256842", "0.5250562", "0.5228935", "0.5219381", "0.52095157", "0.5199639", "0.51996326", "0.5198912", "0.5183599", "0.5170931", "0.51503354", "0.5141955", "0.5133579", "0.5114318", "0.5111734", "0.5097566", "0.5086915", "0.5084518", "0.50795394", "0.5072807", "0.5062948", "0.505991", "0.5057117", "0.5051228", "0.5046137", "0.50235367", "0.50056875", "0.49991462", "0.4996596", "0.49964508", "0.49960876", "0.49941394", "0.49870002", "0.49820656", "0.49718136", "0.49700332", "0.49630615", "0.4962327", "0.4961991", "0.4957875", "0.4955095", "0.4954251", "0.4952804", "0.4951135", "0.49374366", "0.49306798", "0.49144197", "0.49100995", "0.490758", "0.49011362", "0.48978427", "0.4896676", "0.48951137", "0.48755798", "0.48717895", "0.486712", "0.48604134", "0.4857663", "0.4853731", "0.48515776", "0.48479697", "0.48461667", "0.48305854", "0.48108962", "0.48058432", "0.48027354", "0.4801566", "0.4799055", "0.47979912", "0.47965878", "0.47926825", "0.4790986", "0.47906744", "0.47867343", "0.478194", "0.47813904", "0.4777215", "0.47751907" ]
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\treturn m\n}", "func NewMetrics() *Metrics {\n\tm := &Metrics{\n\t\tTimeMetrics: make(map[string]*TimeStats),\n\t\tNumberMetrics: make(map[string]*NumberStats),\n\t\tBoolMetrics: make(map[string]*BoolStats),\n\t}\n\treturn m\n}", "func NewMetrics(scope tally.Scope) Metrics {\n\tscope = scope.SubScope(\"aggregation\")\n\treturn Metrics{\n\t\tCounter: newCounterMetrics(scope.SubScope(\"counters\")),\n\t\tGauge: newGaugeMetrics(scope.SubScope(\"gauges\")),\n\t}\n}", "func New() *Metrics {\n\treturn &Metrics{\n\t\tSectionCounts: make(map[string]int),\n\t}\n}", "func NewMetrics(consume ConsumeMetricsFunc, options ...Option) (Metrics, error) {\n\tif consume == nil {\n\t\treturn nil, errNilFunc\n\t}\n\treturn &baseMetrics{\n\t\tbaseImpl: newBaseImpl(options...),\n\t\tConsumeMetricsFunc: consume,\n\t}, nil\n}", "func NewMetrics() *Metrics {\n\tmtrcs := &Metrics{\n\t\tcounters: make(map[MetricName]int),\n\t\tSidecarSyncErrors: SidecarSyncErrors,\n\t\tSidecarVaultTokenErrors: SidecarVaultTokenErrors,\n\t\tSidecarSecretErrors: SidecarSecretErrors,\n\t}\n\n\treturn mtrcs\n}", "func NewMetrics() *Metrics {\n\treturn &Metrics{\n\t\tPath: defaultPath,\n\t\tAddr: defaultAddr,\n\t\textraLabels: []extraLabel{},\n\t}\n}", "func NewMetrics(reg prometheus.Registerer) *Metrics {\n\tvar m Metrics\n\tm.reg = reg\n\n\tm.dockerEntries = prometheus.NewCounter(prometheus.CounterOpts{\n\t\tNamespace: \"promtail\",\n\t\tName: \"docker_target_entries_total\",\n\t\tHelp: \"Total number of successful entries sent to the Docker target\",\n\t})\n\tm.dockerErrors = prometheus.NewCounter(prometheus.CounterOpts{\n\t\tNamespace: \"promtail\",\n\t\tName: \"docker_target_parsing_errors_total\",\n\t\tHelp: \"Total number of parsing errors while receiving Docker messages\",\n\t})\n\n\tif reg != nil {\n\t\treg.MustRegister(\n\t\t\tm.dockerEntries,\n\t\t\tm.dockerErrors,\n\t\t)\n\t}\n\n\treturn &m\n}", "func newMetrics(hostAndPort string) *metrics {\n\tm := metrics{\n\t\tmetricsCh: make(chan metricType),\n\t\thostAndPort: hostAndPort,\n\t}\n\n\treturn &m\n}", "func NewMetrics(namespace string, logger Logger) Metrics {\n\tlog := logger.GetLogger()\n\n\treturn &metricsImpl{\n\t\tinternalMetrics: metrics.NewMetrics(\"\", log),\n\t\texternalMetrics: metrics.NewMetrics(strings.ToLower(namespace), log),\n\t}\n}", "func NewMetrics(component string, sampleRate float64, client metrics.Client) BaseMetrics {\n\treturn BaseMetrics{\n\t\tcomponent: component,\n\t\trate: sampleRate,\n\t\tmetrics: client,\n\t\tmetMap: map[string]string{\n\t\t\t\"latency\": \"comp.\" + component + \".requests.latency\",\n\t\t\t\"request\": \"comp.\" + component + \".requests.%d\",\n\t\t\t\"mLatency\": \"comp.\" + component + \".requests.%s.latency\",\n\t\t\t\"mRequest\": \"comp.\" + component + \".requests.%s.%d\",\n\t\t},\n\t}\n}", "func NewMetrics(name string, r prometheus.Registerer) *Metrics {\n\treg := prometheus.WrapRegistererWith(prometheus.Labels{\"controller\": name}, r)\n\tm := Metrics{\n\t\treg: reg,\n\t\treconcileErrorsCounter: prometheus.NewCounter(prometheus.CounterOpts{\n\t\t\tName: \"prometheus_operator_reconcile_errors_total\",\n\t\t\tHelp: \"Number of errors that occurred while reconciling the statefulset\",\n\t\t}),\n\t\ttriggerByCounter: prometheus.NewCounterVec(prometheus.CounterOpts{\n\t\t\tName: \"prometheus_operator_triggered_total\",\n\t\t\tHelp: \"Number of times a Kubernetes object add, delete or update event\" +\n\t\t\t\t\" triggered the Prometheus Operator to reconcile an object\",\n\t\t}, []string{\"triggered_by\", \"action\"}),\n\t\tstsDeleteCreateCounter: prometheus.NewCounter(prometheus.CounterOpts{\n\t\t\tName: \"prometheus_operator_reconcile_sts_delete_create_total\",\n\t\t\tHelp: \"Number of times that reconciling a statefulset required deleting and re-creating it\",\n\t\t}),\n\t\tlistCounter: prometheus.NewCounter(prometheus.CounterOpts{\n\t\t\tName: \"prometheus_operator_list_operations_total\",\n\t\t\tHelp: \"Total number of list operations\",\n\t\t}),\n\t\tlistFailedCounter: prometheus.NewCounter(prometheus.CounterOpts{\n\t\t\tName: \"prometheus_operator_list_operations_failed_total\",\n\t\t\tHelp: \"Total number of list operations that failed\",\n\t\t}),\n\t\twatchCounter: prometheus.NewCounter(prometheus.CounterOpts{\n\t\t\tName: \"prometheus_operator_watch_operations_total\",\n\t\t\tHelp: \"Total number of watch operations\",\n\t\t}),\n\t\twatchFailedCounter: prometheus.NewCounter(prometheus.CounterOpts{\n\t\t\tName: \"prometheus_operator_watch_operations_failed_total\",\n\t\t\tHelp: \"Total number of watch operations that failed\",\n\t\t}),\n\t}\n\tm.reg.MustRegister(\n\t\tm.reconcileErrorsCounter,\n\t\tm.triggerByCounter,\n\t\tm.stsDeleteCreateCounter,\n\t\tm.listCounter,\n\t\tm.listFailedCounter,\n\t\tm.watchCounter,\n\t\tm.watchFailedCounter,\n\t)\n\treturn &m\n}", "func NewMetrics(factory metrics.Factory, globalTags map[string]string) *Metrics {\n\tm := &Metrics{}\n\tmetrics.Init(m, factory.Namespace(\"jaeger\", nil), globalTags)\n\treturn m\n}", "func NewMetrics(factory promutil.Factory) *Metrics {\n\treturn &Metrics{\n\t\tImporterEngineCounter: factory.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"importer_engine\",\n\t\t\t\tHelp: \"counting open and closed importer engines\",\n\t\t\t}, []string{\"type\"}),\n\n\t\tIdleWorkersGauge: factory.NewGaugeVec(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"idle_workers\",\n\t\t\t\tHelp: \"counting idle workers\",\n\t\t\t}, []string{\"name\"}),\n\n\t\tKvEncoderCounter: factory.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"kv_encoder\",\n\t\t\t\tHelp: \"counting kv open and closed kv encoder\",\n\t\t\t}, []string{\"type\"}),\n\n\t\tTableCounter: factory.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"tables\",\n\t\t\t\tHelp: \"count number of tables processed\",\n\t\t\t}, []string{\"state\", \"result\"}),\n\n\t\tProcessedEngineCounter: factory.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"engines\",\n\t\t\t\tHelp: \"count number of engines processed\",\n\t\t\t}, []string{\"state\", \"result\"}),\n\n\t\tChunkCounter: factory.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"chunks\",\n\t\t\t\tHelp: \"count number of chunks processed\",\n\t\t\t}, []string{\"state\"}),\n\n\t\tBytesCounter: factory.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"bytes\",\n\t\t\t\tHelp: \"count of total bytes\",\n\t\t\t}, []string{\"state\"}),\n\t\t// state can be one of:\n\t\t// - estimated (an estimation derived from the file size)\n\t\t// - pending\n\t\t// - running\n\t\t// - finished\n\t\t// - failed\n\n\t\tRowsCounter: factory.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"rows\",\n\t\t\t\tHelp: \"count of total rows\",\n\t\t\t}, []string{\"state\", \"table\"}),\n\n\t\tImportSecondsHistogram: factory.NewHistogram(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"import_seconds\",\n\t\t\t\tHelp: \"time needed to import a table\",\n\t\t\t\tBuckets: prometheus.ExponentialBuckets(0.125, 2, 6),\n\t\t\t}),\n\n\t\tChunkParserReadBlockSecondsHistogram: factory.NewHistogram(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"chunk_parser_read_block_seconds\",\n\t\t\t\tHelp: \"time needed for chunk parser read a block\",\n\t\t\t\tBuckets: prometheus.ExponentialBuckets(0.001, 3.1622776601683795, 10),\n\t\t\t}),\n\n\t\tApplyWorkerSecondsHistogram: factory.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"apply_worker_seconds\",\n\t\t\t\tHelp: \"time needed to apply a worker\",\n\t\t\t\tBuckets: prometheus.ExponentialBuckets(0.001, 3.1622776601683795, 10),\n\t\t\t}, []string{\"name\"}),\n\n\t\tRowReadSecondsHistogram: factory.NewHistogram(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"row_read_seconds\",\n\t\t\t\tHelp: \"time needed to parse a row\",\n\t\t\t\tBuckets: prometheus.ExponentialBuckets(0.001, 3.1622776601683795, 7),\n\t\t\t}),\n\n\t\tRowReadBytesHistogram: factory.NewHistogram(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"row_read_bytes\",\n\t\t\t\tHelp: \"number of bytes being read out from data source\",\n\t\t\t\tBuckets: prometheus.ExponentialBuckets(1024, 2, 8),\n\t\t\t}),\n\n\t\tRowEncodeSecondsHistogram: factory.NewHistogram(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"row_encode_seconds\",\n\t\t\t\tHelp: \"time needed to encode a row\",\n\t\t\t\tBuckets: prometheus.ExponentialBuckets(0.001, 3.1622776601683795, 10),\n\t\t\t}),\n\t\tRowKVDeliverSecondsHistogram: factory.NewHistogram(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"row_kv_deliver_seconds\",\n\t\t\t\tHelp: \"time needed to deliver kvs of a single row\",\n\t\t\t\tBuckets: prometheus.ExponentialBuckets(0.001, 3.1622776601683795, 10),\n\t\t\t}),\n\n\t\tBlockDeliverSecondsHistogram: factory.NewHistogram(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"block_deliver_seconds\",\n\t\t\t\tHelp: \"time needed to deliver a block\",\n\t\t\t\tBuckets: prometheus.ExponentialBuckets(0.001, 3.1622776601683795, 10),\n\t\t\t}),\n\t\tBlockDeliverBytesHistogram: factory.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"block_deliver_bytes\",\n\t\t\t\tHelp: \"number of bytes being sent out to importer\",\n\t\t\t\tBuckets: prometheus.ExponentialBuckets(512, 2, 10),\n\t\t\t}, []string{\"kind\"}),\n\t\tBlockDeliverKVPairsHistogram: factory.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"block_deliver_kv_pairs\",\n\t\t\t\tHelp: \"number of KV pairs being sent out to importer\",\n\t\t\t\tBuckets: prometheus.ExponentialBuckets(1, 2, 10),\n\t\t\t}, []string{\"kind\"}),\n\t\tChecksumSecondsHistogram: factory.NewHistogram(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"checksum_seconds\",\n\t\t\t\tHelp: \"time needed to complete the checksum stage\",\n\t\t\t\tBuckets: prometheus.ExponentialBuckets(1, 2.2679331552660544, 10),\n\t\t\t}),\n\t\tSSTSecondsHistogram: factory.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"sst_seconds\",\n\t\t\t\tHelp: \"time needed to complete the sst operations\",\n\t\t\t\tBuckets: prometheus.ExponentialBuckets(1, 2.2679331552660544, 10),\n\t\t\t}, []string{\"kind\"}),\n\n\t\tLocalStorageUsageBytesGauge: factory.NewGaugeVec(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"local_storage_usage_bytes\",\n\t\t\t\tHelp: \"disk/memory size currently occupied by intermediate files in local backend\",\n\t\t\t}, []string{\"medium\"}),\n\n\t\tProgressGauge: factory.NewGaugeVec(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: \"lightning\",\n\t\t\t\tName: \"progress\",\n\t\t\t\tHelp: \"progress of lightning phase\",\n\t\t\t}, []string{\"phase\"}),\n\t}\n}", "func NewMetrics(app, metricsPrefix, version, hash, date string) *Metrics {\n\tlabels := map[string]string{\n\t\t\"app\": app,\n\t\t\"version\": version,\n\t\t\"hash\": hash,\n\t\t\"buildTime\": date,\n\t}\n\n\tif metricsPrefix != \"\" {\n\t\tmetricsPrefix += \"_\"\n\t}\n\n\tpm := &Metrics{\n\t\tresponseTime: prometheus.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tName: metricsPrefix + \"response_time_seconds\",\n\t\t\t\tHelp: \"Description\",\n\t\t\t\tConstLabels: labels,\n\t\t\t},\n\t\t\t[]string{\"endpoint\"},\n\t\t),\n\t\ttotalRequests: prometheus.NewCounterVec(prometheus.CounterOpts{\n\t\t\tName: metricsPrefix + \"requests_total\",\n\t\t\tHelp: \"number of requests\",\n\t\t\tConstLabels: labels,\n\t\t}, []string{\"code\", \"method\", \"endpoint\"}),\n\t\tduration: prometheus.NewHistogramVec(prometheus.HistogramOpts{\n\t\t\tName: metricsPrefix + \"requests_duration_seconds\",\n\t\t\tHelp: \"duration of a requests in seconds\",\n\t\t\tConstLabels: labels,\n\t\t}, []string{\"code\", \"method\", \"endpoint\"}),\n\t\tresponseSize: prometheus.NewHistogramVec(prometheus.HistogramOpts{\n\t\t\tName: metricsPrefix + \"response_size_bytes\",\n\t\t\tHelp: \"size of the responses in bytes\",\n\t\t\tConstLabels: labels,\n\t\t}, []string{\"code\", \"method\"}),\n\t\trequestSize: prometheus.NewHistogramVec(prometheus.HistogramOpts{\n\t\t\tName: metricsPrefix + \"requests_size_bytes\",\n\t\t\tHelp: \"size of the requests in bytes\",\n\t\t\tConstLabels: labels,\n\t\t}, []string{\"code\", \"method\"}),\n\t\thandlerStatuses: prometheus.NewCounterVec(prometheus.CounterOpts{\n\t\t\tName: metricsPrefix + \"requests_statuses_total\",\n\t\t\tHelp: \"count number of responses per status\",\n\t\t\tConstLabels: labels,\n\t\t}, []string{\"method\", \"status_bucket\"}),\n\t}\n\n\terr := prometheus.Register(pm)\n\tif e := new(prometheus.AlreadyRegisteredError); errors.As(err, e) {\n\t\treturn pm\n\t} else if err != nil {\n\t\tpanic(err)\n\t}\n\n\tgrpcPrometheus.EnableHandlingTimeHistogram()\n\n\treturn pm\n}", "func newMetricsFrom(opts *MetricsOpts) *Metrics {\n\tmetrics := &Metrics{\n\t\tcounters: make(map[string]prometheus.Counter, 512),\n\t\tgauges: make(map[string]prometheus.Gauge, 512),\n\t\thistorams: make(map[string]prometheus.Histogram, 512),\n\t\tsummaries: make(map[string]prometheus.Summary, 512),\n\t\tdefBuckets: opts.DefBuckets,\n\t\tdefQuantile: opts.DefQuantile,\n\t\tregistry: prometheus.NewRegistry(),\n\t}\n\treturn metrics\n}", "func NewMetrics(registry metrics.Registry) Metrics {\n\treturn &defaultMetrics{registry: registry}\n}", "func newCustomMetrics() ICustomMetrics {\n\n\tcounters := make(map[string]prometheus.Counter)\n\tgauges := make(map[string]prometheus.Gauge)\n\tsummaries := make(map[string]prometheus.Summary)\n\thistograms := make(map[string]prometheus.Histogram)\n\n\treturn &customMetrics{\n\t\tcounters: counters,\n\t\tgauges: gauges,\n\t\tsummaries: summaries,\n\t\thistograms: histograms,\n\t}\n}", "func NewMetrics(reg *prometheus.Registry, namespace, subsystem string, methodsFrom interface{}) (metric Metrics) {\n\tmetric.callErrTotal = prometheus.NewCounterVec(\n\t\tprometheus.CounterOpts{\n\t\t\tNamespace: namespace,\n\t\t\tSubsystem: subsystem,\n\t\t\tName: \"errors_total\",\n\t\t\tHelp: \"Amount of DAL errors.\",\n\t\t},\n\t\t[]string{methodLabel},\n\t)\n\treg.MustRegister(metric.callErrTotal)\n\tmetric.callDuration = prometheus.NewHistogramVec(\n\t\tprometheus.HistogramOpts{\n\t\t\tNamespace: namespace,\n\t\t\tSubsystem: subsystem,\n\t\t\tName: \"call_duration_seconds\",\n\t\t\tHelp: \"DAL call latency.\",\n\t\t},\n\t\t[]string{methodLabel},\n\t)\n\treg.MustRegister(metric.callDuration)\n\n\tfor _, methodName := range reflectx.MethodsOf(methodsFrom) {\n\t\tl := prometheus.Labels{\n\t\t\tmethodLabel: methodName,\n\t\t}\n\t\tmetric.callErrTotal.With(l)\n\t\tmetric.callDuration.With(l)\n\t}\n\n\treturn metric\n}", "func NewMetrics(consume ConsumeMetricsFunc, options ...Option) (consumer.Metrics, error) {\n\tif consume == nil {\n\t\treturn nil, errNilFunc\n\t}\n\treturn &baseMetrics{\n\t\tbaseConsumer: newBaseConsumer(options...),\n\t\tConsumeMetricsFunc: consume,\n\t}, nil\n}", "func NewMetric(rtype string) Metric {\n\treturn Metric{\n\t\tType: rtype,\n\t\tCurrent: map[string]int{},\n\t\tOwners: map[string]int{},\n\t}\n}", "func NewMetrics() *MetricsHolder {\n\tm := &MetricsHolder{\n\t\tlines: make(map[string]*Reading),\n\t\tchannel: make(chan interface{}),\n\t}\n\tgo func() {\n\t\tfor {\n\t\t\tw, ok := <-m.channel\n\t\t\treading := w.(*Reading)\n\t\t\tif !ok {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif val, ok := m.lines[reading.Key]; ok {\n\t\t\t\tm.lines[reading.Key] = val.Accept(reading)\n\t\t\t} else {\n\t\t\t\tm.lines[reading.Key] = reading\n\t\t\t}\n\t\t}\n\t}()\n\treturn m\n}", "func NewMetrics(p fabricmetrics.Provider) *Metrics {\n\treturn &Metrics{\n\t\tRefreshTimer: p.NewHistogram(refreshTimer),\n\t}\n}", "func New(name string, rate float64, tags ...string) Metric {\n\treturn Metric{name, rate, tags}\n}", "func NewMetrics(period time.Duration, maxQueueSize int) (*Metrics, error) {\n\tmetrics := &Metrics{\n\t\tmaxQueueSize: maxQueueSize,\n\t\tperiod: period,\n\t\tinitialized: true,\n\t\tqueue: make([]Measurement, 0),\n\t\tlastSendingDate: -1,\n\t}\n\n\tif UseGlobalEngine {\n\t\tmetrics.Engine = Engine\n\t} else {\n\t\tmetrics.Engine = &req.Engine{}\n\t}\n\n\terr := validateMetrics(metrics)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif sources == nil {\n\t\tsources = make([]DataSource, 0)\n\t\tgo sendingLoop()\n\t}\n\n\tsources = append(sources, metrics)\n\n\treturn metrics, nil\n}", "func New(d *docker.Docker, containersInterval, metricsInterval time.Duration) *Metrics {\n\treturn &Metrics{\n\t\tdocker: d,\n\t\tmetricsMap: &metricsMap{\n\t\t\tmetrics: make(map[string]*docker.ContainerStats),\n\t\t},\n\t\tcInterval: containersInterval,\n\t\tmInterval: metricsInterval,\n\t}\n}", "func NewMetrics(ctx context.Context, output string, tenant string, refreshRate time.Duration) Metrics {\n\treturn Metrics{\n\t\tDaemonSupport: utils.NewDaemonSupport(ctx, \"metrics\"),\n\t\tstorage: localfs.NewPlaintextStorage(output),\n\t\ttenant: tenant,\n\t\trefreshRate: refreshRate,\n\t\tpromisesAccepted: metrics.NewCounter(),\n\t\tcommitsAccepted: metrics.NewCounter(),\n\t\trollbacksAccepted: metrics.NewCounter(),\n\t\tcreatedAccounts: metrics.NewCounter(),\n\t\tupdatedSnapshots: metrics.NewMeter(),\n\t\tsnapshotCronLatency: metrics.NewTimer(),\n\t}\n}", "func New() *Metrics {\n\tm := &Metrics{\n\t\tBuildInfo: prometheus.NewGaugeVec(prometheus.GaugeOpts{\n\t\t\tNamespace: Namespace,\n\t\t\tSubsystem: Subsystem,\n\t\t\tName: \"build_info\",\n\t\t\tHelp: \"Build information\",\n\t\t}, []string{\"version\"}),\n\t}\n\n\t_ = prometheus.Register(m.BuildInfo)\n\t// TODO: implement metrics\n\treturn m\n}", "func NewMetrics(scope tally.Scope) *Metrics {\n\tsuccessScope := scope.Tagged(map[string]string{\"result\": \"success\"})\n\tfailScope := scope.Tagged(map[string]string{\"result\": \"fail\"})\n\ttimeoutScope := scope.Tagged(map[string]string{\"result\": \"timeout\"})\n\tapiScope := scope.SubScope(\"api\")\n\tserverScope := scope.SubScope(\"server\")\n\tplacement := scope.SubScope(\"placement\")\n\trecovery := scope.SubScope(\"recovery\")\n\n\treturn &Metrics{\n\t\tAPIEnqueueGangs: apiScope.Counter(\"enqueue_gangs\"),\n\t\tEnqueueGangSuccess: successScope.Counter(\"enqueue_gang\"),\n\t\tEnqueueGangFail: failScope.Counter(\"enqueue_gang\"),\n\n\t\tAPIDequeueGangs: apiScope.Counter(\"dequeue_gangs\"),\n\t\tDequeueGangSuccess: successScope.Counter(\"dequeue_gangs\"),\n\t\tDequeueGangTimeout: timeoutScope.Counter(\"dequeue_gangs\"),\n\n\t\tAPIGetPreemptibleTasks: apiScope.Counter(\"get_preemptible_tasks\"),\n\t\tGetPreemptibleTasksSuccess: successScope.Counter(\"get_preemptible_tasks\"),\n\t\tGetPreemptibleTasksTimeout: timeoutScope.Counter(\"get_preemptible_tasks\"),\n\n\t\tAPISetPlacements: apiScope.Counter(\"set_placements\"),\n\t\tSetPlacementSuccess: successScope.Counter(\"set_placements\"),\n\t\tSetPlacementFail: failScope.Counter(\"set_placements\"),\n\n\t\tAPIGetPlacements: apiScope.Counter(\"get_placements\"),\n\t\tGetPlacementSuccess: successScope.Counter(\"get_placements\"),\n\t\tGetPlacementFail: failScope.Counter(\"get_placements\"),\n\n\t\tAPILaunchedTasks: apiScope.Counter(\"launched_tasks\"),\n\n\t\tRecoverySuccess: successScope.Counter(\"recovery\"),\n\t\tRecoveryFail: failScope.Counter(\"recovery\"),\n\t\tRecoveryRunningSuccessCount: successScope.Counter(\"task_count\"),\n\t\tRecoveryRunningFailCount: failScope.Counter(\"task_count\"),\n\t\tRecoveryEnqueueFailedCount: failScope.Counter(\"enqueue_task_count\"),\n\t\tRecoveryEnqueueSuccessCount: successScope.Counter(\"enqueue_task_count\"),\n\t\tRecoveryTimer: recovery.Timer(\"running_tasks\"),\n\n\t\tPlacementQueueLen: placement.Gauge(\"placement_queue_length\"),\n\t\tPlacementFailed: placement.Counter(\"fail\"),\n\n\t\tElected: serverScope.Gauge(\"elected\"),\n\t}\n}", "func NewMetrics(subsystem string) *Metrics {\n\tbase := metrics.NewBase(subsystem, \"\")\n\treturn &Metrics{\n\t\tBase: base,\n\t\tFailedDatabaseMethods: promauto.NewCounterVec(prometheus.CounterOpts{\n\t\t\tName: \"failed_database_operations\",\n\t\t\tHelp: \"Tracks the number of database failures\",\n\t\t\tSubsystem: base.SubsystemName(),\n\t\t}, []string{methodLabel}),\n\t\tDepositIDMismatch: promauto.NewGauge(prometheus.GaugeOpts{\n\t\t\tName: \"deposit_id_mismatch\",\n\t\t\tHelp: \"Set to 1 when the postgres and the disrburser contract \" +\n\t\t\t\t\"disagree on the next deposit id, and 0 otherwise\",\n\t\t\tSubsystem: base.SubsystemName(),\n\t\t}),\n\t\tMissingDisbursements: promauto.NewGauge(prometheus.GaugeOpts{\n\t\t\tName: \"missing_disbursements\",\n\t\t\tHelp: \"Number of deposits that are missing disbursements in \" +\n\t\t\t\t\"postgres below our supposed next deposit id\",\n\t\t\tSubsystem: base.SubsystemName(),\n\t\t}),\n\t\tSuccessfulDisbursements: promauto.NewGauge(prometheus.GaugeOpts{\n\t\t\tName: \"successful_disbursements\",\n\t\t\tHelp: \"Number of disbursements that emit a success event \" +\n\t\t\t\t\"from a given tx\",\n\t\t\tSubsystem: base.SubsystemName(),\n\t\t}),\n\t\tFailedDisbursements: promauto.NewGauge(prometheus.GaugeOpts{\n\t\t\tName: \"failed_disbursements\",\n\t\t\tHelp: \"Number of disbursements that emit a failed event \" +\n\t\t\t\t\"from a given tx\",\n\t\t\tSubsystem: base.SubsystemName(),\n\t\t}),\n\t\tPostgresLastDisbursedID: promauto.NewGauge(prometheus.GaugeOpts{\n\t\t\tName: \"postgres_last_disbursed_id\",\n\t\t\tHelp: \"Latest recorded disbursement id in postgres\",\n\t\t\tSubsystem: base.SubsystemName(),\n\t\t}),\n\t\tContractNextDisbursementID: promauto.NewGauge(prometheus.GaugeOpts{\n\t\t\tName: \"contract_next_disbursement_id\",\n\t\t\tHelp: \"Next disbursement id expected by the disburser contract\",\n\t\t\tSubsystem: base.SubsystemName(),\n\t\t}),\n\t\tContractNextDepositID: promauto.NewGauge(prometheus.GaugeOpts{\n\t\t\tName: \"contract_next_deposit_id\",\n\t\t\tHelp: \"next deposit id expected by the deposit contract\",\n\t\t\tSubsystem: base.SubsystemName(),\n\t\t}),\n\t\tDisburserBalance: promauto.NewGauge(prometheus.GaugeOpts{\n\t\t\tName: \"disburser_balance\",\n\t\t\tHelp: \"Balance in Wei of Teleportr's disburser wallet\",\n\t\t\tSubsystem: base.SubsystemName(),\n\t\t}),\n\t\tDepositContractBalance: promauto.NewGauge(prometheus.GaugeOpts{\n\t\t\tName: \"deposit_contract_balance\",\n\t\t\tHelp: \"Balance in Wei of Teleportr's deposit contract\",\n\t\t\tSubsystem: base.SubsystemName(),\n\t\t}),\n\t\tFailedTXSubmissions: promauto.NewCounterVec(prometheus.CounterOpts{\n\t\t\tName: \"failed_tx_submissions\",\n\t\t\tHelp: \"Number of failed transaction submissions\",\n\t\t\tSubsystem: base.SubsystemName(),\n\t\t}, []string{\n\t\t\t\"type\",\n\t\t}),\n\t}\n}", "func newMonitoringMetrics() monitoringMetrics {\n\treturn monitoringMetrics{\n\t\tCSR: csrCounts.With(prometheus.Labels{}),\n\t\tAuthnError: authnErrorCounts.With(prometheus.Labels{}),\n\t\tSuccess: successCounts.With(prometheus.Labels{}),\n\t\tCSRError: csrParsingErrorCounts.With(prometheus.Labels{}),\n\t\tIDExtractionError: idExtractionErrorCounts.With(prometheus.Labels{}),\n\t\tcertSignErrors: certSignErrorCounts,\n\t}\n}", "func NewMetrics() *Metrics {\n\treturn &Metrics{\n\t\tInputBytesTotal: promauto.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"router_input_bytes_total\",\n\t\t\t\tHelp: \"Total number of bytes received\",\n\t\t\t},\n\t\t\t[]string{\"interface\", \"isd_as\", \"neighbor_isd_as\"},\n\t\t),\n\t\tOutputBytesTotal: promauto.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"router_output_bytes_total\",\n\t\t\t\tHelp: \"Total number of bytes sent.\",\n\t\t\t},\n\t\t\t[]string{\"interface\", \"isd_as\", \"neighbor_isd_as\"},\n\t\t),\n\t\tInputPacketsTotal: promauto.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"router_input_pkts_total\",\n\t\t\t\tHelp: \"Total number of packets received\",\n\t\t\t},\n\t\t\t[]string{\"interface\", \"isd_as\", \"neighbor_isd_as\"},\n\t\t),\n\t\tOutputPacketsTotal: promauto.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"router_output_pkts_total\",\n\t\t\t\tHelp: \"Total number of packets sent.\",\n\t\t\t},\n\t\t\t[]string{\"interface\", \"isd_as\", \"neighbor_isd_as\"},\n\t\t),\n\t\tDroppedPacketsTotal: promauto.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"router_dropped_pkts_total\",\n\t\t\t\tHelp: \"Total number of packets dropped by the router. This metric reports \" +\n\t\t\t\t\t\"the number of packets that were dropped because of errors.\",\n\t\t\t},\n\t\t\t[]string{\"interface\", \"isd_as\", \"neighbor_isd_as\"},\n\t\t),\n\t\tInterfaceUp: promauto.NewGaugeVec(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tName: \"router_interface_up\",\n\t\t\t\tHelp: \"Either zero or one depending on whether the interface is up.\",\n\t\t\t},\n\t\t\t[]string{\"interface\", \"isd_as\", \"neighbor_isd_as\"},\n\t\t),\n\t\tBFDInterfaceStateChanges: promauto.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"router_bfd_state_changes_total\",\n\t\t\t\tHelp: \"Total number of BFD state changes.\",\n\t\t\t},\n\t\t\t[]string{\"interface\", \"isd_as\", \"neighbor_isd_as\"},\n\t\t),\n\t\tBFDPacketsSent: promauto.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"router_bfd_sent_packets_total\",\n\t\t\t\tHelp: \"Number of BFD packets sent.\",\n\t\t\t},\n\t\t\t[]string{\"interface\", \"isd_as\", \"neighbor_isd_as\"},\n\t\t),\n\t\tBFDPacketsReceived: promauto.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"router_bfd_received_packets_total\",\n\t\t\t\tHelp: \"Number of BFD packets received.\",\n\t\t\t},\n\t\t\t[]string{\"interface\", \"isd_as\", \"neighbor_isd_as\"},\n\t\t),\n\t\tServiceInstanceCount: promauto.NewGaugeVec(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tName: \"router_service_instance_count\",\n\t\t\t\tHelp: \"Number of service instances known by the data plane.\",\n\t\t\t},\n\t\t\t[]string{\"service\", \"isd_as\"},\n\t\t),\n\t\tServiceInstanceChanges: promauto.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"router_service_instance_changes_total\",\n\t\t\t\tHelp: \"Number of total service instance changes. Both addition and removal of a \" +\n\t\t\t\t\t\"service instance is accumulated.\",\n\t\t\t},\n\t\t\t[]string{\"service\", \"isd_as\"},\n\t\t),\n\t\tSiblingReachable: promauto.NewGaugeVec(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tName: \"router_sibling_reachable\",\n\t\t\t\tHelp: \"Either zero or one depending on whether a sibling router \" +\n\t\t\t\t\t\"instance is reachable.\",\n\t\t\t},\n\t\t\t[]string{\"sibling\", \"isd_as\"},\n\t\t),\n\t\tSiblingBFDPacketsSent: promauto.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"router_bfd_sent_sibling_packets_total\",\n\t\t\t\tHelp: \"Number of BFD packets sent to sibling router instance.\",\n\t\t\t},\n\t\t\t[]string{\"sibling\", \"isd_as\"},\n\t\t),\n\t\tSiblingBFDPacketsReceived: promauto.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"router_bfd_received_sibling_packets_total\",\n\t\t\t\tHelp: \"Number of BFD packets received from sibling router instance.\",\n\t\t\t},\n\t\t\t[]string{\"sibling\", \"isd_as\"},\n\t\t),\n\t\tSiblingBFDStateChanges: promauto.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"router_bfd_sibling_state_changes_total\",\n\t\t\t\tHelp: \"Total number of BFD state changes for sibling router instances\",\n\t\t\t},\n\t\t\t[]string{\"sibling\", \"isd_as\"},\n\t\t),\n\t}\n}", "func New(name errors.Op) *Metric {\n\treturn &Metric{\n\t\tName: name,\n\t}\n}", "func (m *podMetrics) New() runtime.Object {\n\treturn &metrics.PodMetrics{}\n}", "func NewMetrics(scope tally.Scope) *Metrics {\n\tm := &Metrics{\n\t\tProcedures: map[string]*PerProcedureMetrics{},\n\t}\n\tfor _, procedure := range _procedures {\n\t\tresponseCodes := make(map[api.ResponseCode]*PerResponseCodeMetrics)\n\t\tfor _, responseCode := range api.ResponseCode_Values() {\n\t\t\tresponseCodeText, exists := _responseCodeToText[responseCode]\n\t\t\tif !exists {\n\t\t\t\tresponseCodeText = \"unknown-error\"\n\t\t\t}\n\t\t\ttag := map[string]string{\n\t\t\t\tTagProcedure: procedure,\n\t\t\t\tTagResponseCode: responseCodeText,\n\t\t\t\t// Fill empty string here so that prometheus won't panic\n\t\t\t\t// when the number of tags is changed inside subscope\n\t\t\t\tTagService: \"\",\n\t\t\t}\n\t\t\tsubscope := scope.Tagged(tag)\n\t\t\tresponseCodes[responseCode] = &PerResponseCodeMetrics{\n\t\t\t\tScope: subscope,\n\t\t\t\tCalls: subscope.Counter(MetricNameCalls),\n\t\t\t\tCallLatency: subscope.Timer(MetricNameCallLatency),\n\t\t\t}\n\t\t}\n\t\tm.Procedures[procedure] = &PerProcedureMetrics{\n\t\t\tResponseCodes: responseCodes,\n\t\t}\n\t}\n\treturn m\n}", "func NewMetrics(scope tally.Scope) *Metrics {\n\treadyScope := scope.SubScope(\"ready\")\n\ttrackerScope := scope.SubScope(\"tracker\")\n\ttaskStateScope := scope.SubScope(\"tasks_state\")\n\n\treconcilerScope := scope.SubScope(\"reconciler\")\n\tleakScope := reconcilerScope.SubScope(\"leaks\")\n\tsuccessScope := reconcilerScope.Tagged(map[string]string{\"result\": \"success\"})\n\tfailScope := reconcilerScope.Tagged(map[string]string{\"result\": \"fail\"})\n\n\treturn &Metrics{\n\t\tReadyQueueLen: readyScope.Gauge(\"ready_queue_length\"),\n\t\tTasksCountInTracker: trackerScope.Gauge(\"task_len_tracker\"),\n\t\tTaskStatesGauge: map[task.TaskState]tally.Gauge{\n\t\t\ttask.TaskState_PENDING: taskStateScope.Gauge(\n\t\t\t\t\"task_state_pending\"),\n\t\t\ttask.TaskState_READY: taskStateScope.Gauge(\n\t\t\t\t\"task_state_ready\"),\n\t\t\ttask.TaskState_PLACING: taskStateScope.Gauge(\n\t\t\t\t\"task_state_placing\"),\n\t\t\ttask.TaskState_PLACED: taskStateScope.Gauge(\n\t\t\t\t\"task_state_placed\"),\n\t\t\ttask.TaskState_LAUNCHING: taskStateScope.Gauge(\n\t\t\t\t\"task_state_launching\"),\n\t\t\ttask.TaskState_LAUNCHED: taskStateScope.Gauge(\n\t\t\t\t\"task_state_launched\"),\n\t\t\ttask.TaskState_RUNNING: taskStateScope.Gauge(\n\t\t\t\t\"task_state_running\"),\n\t\t\ttask.TaskState_SUCCEEDED: taskStateScope.Gauge(\n\t\t\t\t\"task_state_succeeded\"),\n\t\t\ttask.TaskState_FAILED: taskStateScope.Gauge(\n\t\t\t\t\"task_state_failed\"),\n\t\t\ttask.TaskState_KILLED: taskStateScope.Gauge(\n\t\t\t\t\"task_state_killed\"),\n\t\t\ttask.TaskState_LOST: taskStateScope.Gauge(\n\t\t\t\t\"task_state_lost\"),\n\t\t\ttask.TaskState_PREEMPTING: taskStateScope.Gauge(\n\t\t\t\t\"task_state_preempting\"),\n\t\t},\n\t\tResourcesHeldByTaskState: map[task.TaskState]scalar.GaugeMaps{\n\t\t\ttask.TaskState_READY: scalar.NewGaugeMaps(\n\t\t\t\tscope.SubScope(\"task_state_ready\"),\n\t\t\t),\n\t\t\ttask.TaskState_PLACING: scalar.NewGaugeMaps(\n\t\t\t\tscope.SubScope(\"task_state_placing\"),\n\t\t\t),\n\t\t\ttask.TaskState_PLACED: scalar.NewGaugeMaps(\n\t\t\t\tscope.SubScope(\"task_state_placed\"),\n\t\t\t),\n\t\t\ttask.TaskState_LAUNCHING: scalar.NewGaugeMaps(\n\t\t\t\tscope.SubScope(\"task_state_launching\"),\n\t\t\t),\n\t\t\ttask.TaskState_LAUNCHED: scalar.NewGaugeMaps(\n\t\t\t\tscope.SubScope(\"task_state_launched\"),\n\t\t\t),\n\t\t\ttask.TaskState_RUNNING: scalar.NewGaugeMaps(\n\t\t\t\tscope.SubScope(\"task_state_running\"),\n\t\t\t),\n\t\t\ttask.TaskState_STARTING: scalar.NewGaugeMaps(\n\t\t\t\tscope.SubScope(\"task_state_starting\"),\n\t\t\t),\n\t\t\ttask.TaskState_PREEMPTING: scalar.NewGaugeMaps(\n\t\t\t\tscope.SubScope(\"task_state_preempting\"),\n\t\t\t),\n\t\t\ttask.TaskState_KILLING: scalar.NewGaugeMaps(\n\t\t\t\tscope.SubScope(\"task_state_killing\"),\n\t\t\t),\n\t\t},\n\t\tLeakedResources: scalar.NewGaugeMaps(leakScope),\n\t\tReconciliationSuccess: successScope.Counter(\"run\"),\n\t\tReconciliationFail: failScope.Counter(\"run\"),\n\t\tOrphanTasks: scope.Gauge(\"orphan_tasks\"),\n\t}\n}", "func New() *SystemMetrics {\n\treturn &SystemMetrics{}\n}", "func New(opts ...Option) *Metric {\n\tvar options Options\n\tfor _, opt := range opts {\n\t\topt(&options)\n\t}\n\tm := &Metric{\n\t\tOptions: options,\n\t\thistograms: make(map[string]metrics.Histogram),\n\t\tkeyLabels: make(map[string]map[string]string),\n\t}\n\tgo m.watch()\n\treturn m\n}", "func New() (*Metrics, error) {\n\treturn NewCapa(DefaultBufferSize, DefaultSamplingFactor)\n}", "func New(config *Config) (*Metrics, error) {\n\tm := &Metrics{\n\t\tconfig: config,\n\t\tcounters: make(map[string]prometheus.Counter),\n\t\tcounterVecs: make(map[string]*prometheus.CounterVec),\n\t\tgauges: make(map[string]prometheus.Gauge),\n\t\tgaugeVecs: make(map[string]*prometheus.GaugeVec),\n\t}\n\n\tif config.Enable {\n\t\tgo func() {\n\t\t\thttp.Handle(\"/metrics\", promhttp.Handler())\n\t\t\terr := http.ListenAndServe(config.Addr, http.DefaultServeMux)\n\t\t\tlog.Error().Err(err).Msg(\"could not start metrics HTTP server\")\n\t\t}()\n\t}\n\n\treturn m, nil\n}", "func NewMetrics() *Metrics {\n\treturn &Metrics{\n\t\tRangeFeedCatchupScanNanos: metric.NewCounter(metaRangeFeedCatchupScanNanos),\n\t\tRangeFeedSlowClosedTimestampLogN: log.Every(5 * time.Second),\n\t\tRangeFeedSlowClosedTimestampNudgeSem: make(chan struct{}, 1024),\n\t}\n}", "func newMetrics() metrics {\n\treturn metrics{\n\t\tsize: prometheus.NewGauge(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: \"openebs\",\n\t\t\t\tName: \"pool_size\",\n\t\t\t\tHelp: \"Size of pool\",\n\t\t\t},\n\t\t),\n\n\t\tstatus: prometheus.NewGaugeVec(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: \"openebs\",\n\t\t\t\tName: \"pool_status\",\n\t\t\t\tHelp: `Status of pool (0, 1, 2, 3, 4, 5, 6)= {\"Offline\", \"Online\", \"Degraded\", \"Faulted\", \"Removed\", \"Unavail\", \"NoPoolsAvailable\"}`,\n\t\t\t},\n\t\t\t[]string{\"pool\"},\n\t\t),\n\n\t\tusedCapacity: prometheus.NewGauge(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: \"openebs\",\n\t\t\t\tName: \"used_pool_capacity\",\n\t\t\t\tHelp: \"Capacity used by pool\",\n\t\t\t},\n\t\t),\n\n\t\tfreeCapacity: prometheus.NewGauge(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: \"openebs\",\n\t\t\t\tName: \"free_pool_capacity\",\n\t\t\t\tHelp: \"Free capacity in pool\",\n\t\t\t},\n\t\t),\n\n\t\tusedCapacityPercent: prometheus.NewGauge(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: \"openebs\",\n\t\t\t\tName: \"used_pool_capacity_percent\",\n\t\t\t\tHelp: \"Capacity used by pool in percent\",\n\t\t\t},\n\t\t),\n\n\t\tzpoolListparseErrorCounter: prometheus.NewGauge(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: \"openebs\",\n\t\t\t\tName: \"zpool_list_parse_error_count\",\n\t\t\t\tHelp: \"Total no of parsing errors\",\n\t\t\t},\n\t\t),\n\n\t\tzpoolRejectRequestCounter: prometheus.NewGauge(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: \"openebs\",\n\t\t\t\tName: \"zpool_reject_request_count\",\n\t\t\t\tHelp: \"Total no of rejected requests of zpool command\",\n\t\t\t},\n\t\t),\n\n\t\tzpoolCommandErrorCounter: prometheus.NewGauge(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: \"openebs\",\n\t\t\t\tName: \"zpool_command_error\",\n\t\t\t\tHelp: \"Total no of zpool command errors\",\n\t\t\t},\n\t\t),\n\n\t\tnoPoolAvailableErrorCounter: prometheus.NewGauge(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: \"openebs\",\n\t\t\t\tName: \"no_pool_available_error\",\n\t\t\t\tHelp: \"Total no of no pool available errors\",\n\t\t\t},\n\t\t),\n\n\t\tincompleteOutputErrorCounter: prometheus.NewGauge(\n\t\t\tprometheus.GaugeOpts{\n\t\t\t\tNamespace: \"openebs\",\n\t\t\t\tName: \"zpool_list_incomplete_stdout_error\",\n\t\t\t\tHelp: \"Total no of incomplete stdout of zpool list command errors\",\n\t\t\t},\n\t\t),\n\t}\n}", "func newMetricsMetadata(cluster *string, containerInstance *string) *ecstcs.MetricsMetadata {\n\treturn &ecstcs.MetricsMetadata{\n\t\tCluster: cluster,\n\t\tContainerInstance: containerInstance,\n\t}\n}", "func newListMetrics() *listMetrics {\n\treturn new(listMetrics)\n}", "func NewMetric(id string, name string, uri string) *Metric {\n\tthis := Metric{}\n\tthis.Id = id\n\tthis.Name = name\n\tthis.Uri = uri\n\treturn &this\n}", "func newDatabaseMetrics(db *database, opts *pluginOpts) (*databaseMetrics, error) {\n\tgauges, err := newDatabaseGauges(opts.prometheusNamespace)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not create database gauges\")\n\t}\n\n\treturn &databaseMetrics{\n\t\tgauges: gauges,\n\t\tdb: db,\n\t}, nil\n}", "func NewMetrics(registry metrics.Registry, exchanges []openrtb_ext.BidderName, disableAccountMetrics config.DisabledMetrics, syncerKeys []string, moduleStageNames map[string][]string) *Metrics {\n\tnewMetrics := NewBlankMetrics(registry, exchanges, disableAccountMetrics, moduleStageNames)\n\tnewMetrics.ConnectionCounter = metrics.GetOrRegisterCounter(\"active_connections\", registry)\n\tnewMetrics.TMaxTimeoutCounter = metrics.GetOrRegisterCounter(\"tmax_timeout\", registry)\n\tnewMetrics.ConnectionAcceptErrorMeter = metrics.GetOrRegisterMeter(\"connection_accept_errors\", registry)\n\tnewMetrics.ConnectionCloseErrorMeter = metrics.GetOrRegisterMeter(\"connection_close_errors\", registry)\n\tnewMetrics.ImpMeter = metrics.GetOrRegisterMeter(\"imps_requested\", registry)\n\n\tnewMetrics.ImpsTypeBanner = metrics.GetOrRegisterMeter(\"imp_banner\", registry)\n\tnewMetrics.ImpsTypeVideo = metrics.GetOrRegisterMeter(\"imp_video\", registry)\n\tnewMetrics.ImpsTypeAudio = metrics.GetOrRegisterMeter(\"imp_audio\", registry)\n\tnewMetrics.ImpsTypeNative = metrics.GetOrRegisterMeter(\"imp_native\", registry)\n\n\tnewMetrics.NoCookieMeter = metrics.GetOrRegisterMeter(\"no_cookie_requests\", registry)\n\tnewMetrics.AppRequestMeter = metrics.GetOrRegisterMeter(\"app_requests\", registry)\n\tnewMetrics.DebugRequestMeter = metrics.GetOrRegisterMeter(\"debug_requests\", registry)\n\tnewMetrics.RequestTimer = metrics.GetOrRegisterTimer(\"request_time\", registry)\n\tnewMetrics.DNSLookupTimer = metrics.GetOrRegisterTimer(\"dns_lookup_time\", registry)\n\tnewMetrics.TLSHandshakeTimer = metrics.GetOrRegisterTimer(\"tls_handshake_time\", registry)\n\tnewMetrics.PrebidCacheRequestTimerSuccess = metrics.GetOrRegisterTimer(\"prebid_cache_request_time.ok\", registry)\n\tnewMetrics.PrebidCacheRequestTimerError = metrics.GetOrRegisterTimer(\"prebid_cache_request_time.err\", registry)\n\tnewMetrics.StoredResponsesMeter = metrics.GetOrRegisterMeter(\"stored_responses\", registry)\n\tnewMetrics.OverheadTimer = makeOverheadTimerMetrics(registry)\n\tnewMetrics.BidderServerResponseTimer = metrics.GetOrRegisterTimer(\"bidder_server_response_time_seconds\", registry)\n\n\tfor _, dt := range StoredDataTypes() {\n\t\tfor _, ft := range StoredDataFetchTypes() {\n\t\t\ttimerName := fmt.Sprintf(\"stored_%s_fetch_time.%s\", string(dt), string(ft))\n\t\t\tnewMetrics.StoredDataFetchTimer[dt][ft] = metrics.GetOrRegisterTimer(timerName, registry)\n\t\t}\n\t\tfor _, e := range StoredDataErrors() {\n\t\t\tmeterName := fmt.Sprintf(\"stored_%s_error.%s\", string(dt), string(e))\n\t\t\tnewMetrics.StoredDataErrorMeter[dt][e] = metrics.GetOrRegisterMeter(meterName, registry)\n\t\t}\n\t}\n\n\tnewMetrics.AmpNoCookieMeter = metrics.GetOrRegisterMeter(\"amp_no_cookie_requests\", registry)\n\n\tnewMetrics.CookieSyncMeter = metrics.GetOrRegisterMeter(\"cookie_sync_requests\", registry)\n\tfor _, s := range CookieSyncStatuses() {\n\t\tnewMetrics.CookieSyncStatusMeter[s] = metrics.GetOrRegisterMeter(fmt.Sprintf(\"cookie_sync_requests.%s\", s), registry)\n\t}\n\n\tnewMetrics.SetUidMeter = metrics.GetOrRegisterMeter(\"setuid_requests\", registry)\n\tfor _, s := range SetUidStatuses() {\n\t\tnewMetrics.SetUidStatusMeter[s] = metrics.GetOrRegisterMeter(fmt.Sprintf(\"setuid_requests.%s\", s), registry)\n\t}\n\n\tfor _, syncerKey := range syncerKeys {\n\t\tnewMetrics.SyncerRequestsMeter[syncerKey] = make(map[SyncerCookieSyncStatus]metrics.Meter)\n\t\tfor _, status := range SyncerRequestStatuses() {\n\t\t\tnewMetrics.SyncerRequestsMeter[syncerKey][status] = metrics.GetOrRegisterMeter(fmt.Sprintf(\"syncer.%s.request.%s\", syncerKey, status), registry)\n\t\t}\n\n\t\tnewMetrics.SyncerSetsMeter[syncerKey] = make(map[SyncerSetUidStatus]metrics.Meter)\n\t\tfor _, status := range SyncerSetUidStatuses() {\n\t\t\tnewMetrics.SyncerSetsMeter[syncerKey][status] = metrics.GetOrRegisterMeter(fmt.Sprintf(\"syncer.%s.set.%s\", syncerKey, status), registry)\n\t\t}\n\t}\n\n\tfor _, a := range exchanges {\n\t\tregisterAdapterMetrics(registry, \"adapter\", string(a), newMetrics.AdapterMetrics[a])\n\t}\n\n\tfor typ, statusMap := range newMetrics.RequestStatuses {\n\t\tfor stat := range statusMap {\n\t\t\tstatusMap[stat] = metrics.GetOrRegisterMeter(\"requests.\"+string(stat)+\".\"+string(typ), registry)\n\t\t}\n\t}\n\n\tfor _, cacheRes := range CacheResults() {\n\t\tnewMetrics.StoredReqCacheMeter[cacheRes] = metrics.GetOrRegisterMeter(fmt.Sprintf(\"stored_request_cache_%s\", string(cacheRes)), registry)\n\t\tnewMetrics.StoredImpCacheMeter[cacheRes] = metrics.GetOrRegisterMeter(fmt.Sprintf(\"stored_imp_cache_%s\", string(cacheRes)), registry)\n\t\tnewMetrics.AccountCacheMeter[cacheRes] = metrics.GetOrRegisterMeter(fmt.Sprintf(\"account_cache_%s\", string(cacheRes)), registry)\n\t}\n\n\tnewMetrics.RequestsQueueTimer[\"video\"][true] = metrics.GetOrRegisterTimer(\"queued_requests.video.accepted\", registry)\n\tnewMetrics.RequestsQueueTimer[\"video\"][false] = metrics.GetOrRegisterTimer(\"queued_requests.video.rejected\", registry)\n\n\tnewMetrics.TimeoutNotificationSuccess = metrics.GetOrRegisterMeter(\"timeout_notification.ok\", registry)\n\tnewMetrics.TimeoutNotificationFailure = metrics.GetOrRegisterMeter(\"timeout_notification.failed\", registry)\n\n\tnewMetrics.PrivacyCCPARequest = metrics.GetOrRegisterMeter(\"privacy.request.ccpa.specified\", registry)\n\tnewMetrics.PrivacyCCPARequestOptOut = metrics.GetOrRegisterMeter(\"privacy.request.ccpa.opt-out\", registry)\n\tnewMetrics.PrivacyCOPPARequest = metrics.GetOrRegisterMeter(\"privacy.request.coppa\", registry)\n\tnewMetrics.PrivacyLMTRequest = metrics.GetOrRegisterMeter(\"privacy.request.lmt\", registry)\n\tfor _, version := range TCFVersions() {\n\t\tnewMetrics.PrivacyTCFRequestVersion[version] = metrics.GetOrRegisterMeter(fmt.Sprintf(\"privacy.request.tcf.%s\", string(version)), registry)\n\t}\n\n\tnewMetrics.AdsCertRequestsSuccess = metrics.GetOrRegisterMeter(\"ads_cert_requests.ok\", registry)\n\tnewMetrics.AdsCertRequestsFailure = metrics.GetOrRegisterMeter(\"ads_cert_requests.failed\", registry)\n\tnewMetrics.adsCertSignTimer = metrics.GetOrRegisterTimer(\"ads_cert_sign_time\", registry)\n\n\tfor module, stages := range moduleStageNames {\n\t\tregisterModuleMetrics(registry, module, stages, newMetrics.ModuleMetrics[module])\n\t}\n\n\treturn newMetrics\n}", "func newMetricsWriter(w http.ResponseWriter, r *http.Request, collector collector) *metricWriter {\n\tinfo := &Info{TimeStart: time.Now(), Request: r, Header: w.Header()}\n\treturn &metricWriter{w: w, info: info, collector: collector}\n}", "func newProcessMetrics(id string) *processMetrics {\n\tcommonTags := tags{TAG_INGESTER_ID: id, TAG_INGESTER_SOURCE: \"poll\"}\n\treturn &processMetrics{\n\t\tignoredByPollingGauge: metrics2.GetInt64Metric(MEASUREMENT_INGESTION, commonTags, tags{TAG_INGESTION_METRIC: \"ignored\"}),\n\t\tprocessedByPollingGauge: metrics2.GetInt64Metric(MEASUREMENT_INGESTION, commonTags, tags{TAG_INGESTION_METRIC: \"processed\"}),\n\t\tliveness: metrics2.NewLiveness(id, tags{TAG_INGESTER_SOURCE: \"poll\", TAG_INGESTION_METRIC: \"since-last-run\"}),\n\t}\n}", "func CreateMetrics(protocol string, host string, port int, tag string) (*Metrics, error) {\n\tvar m *Metrics\n\tswitch protocol {\n\tcase \"tcp\":\n\t\tm = &Metrics{Host: host, Port: port, Protocol: \"tcp\", Tag: tag}\n\tcase \"udp\":\n\t\tm = &Metrics{Host: host, Port: port, Protocol: \"udp\", Tag: tag}\n\t}\n\t// Initialize values\n\tm.Timeout = 0\n\tm.conn = nil\n\tm.Counters = make(map[string]Counter)\n\t// Connect\n\tif err := m.Connect(); err != nil {\n\t\treturn m, err\n\t}\n\tm.Ready = true\n\treturn m, nil\n}", "func setupMetrics() *Metrics {\n\t// Requests duration\n\tduration := prometheus.NewHistogramVec(prometheus.HistogramOpts{\n\t\tName: \"http_request_duration\",\n\t\tHelp: \"Duration of the http requests processed.\",\n\t},\n\t\t[]string{\"status\", \"method\", \"path\"},\n\t)\n\tprometheus.MustRegister(duration)\n\n\treturn &Metrics{\n\t\tduration: duration,\n\t}\n}", "func newHttpMetrics() *httpMetrics {\n\treturn &httpMetrics{\n\t\tRequestsTotal: promauto.NewCounterVec(prometheus.CounterOpts{\n\t\t\tSubsystem: \"provider\",\n\t\t\tName: \"http_requests_total\",\n\t\t\tHelp: \"Total number of HTTP requests.\",\n\t\t}, []string{\"code\", \"method\", \"path\"}),\n\t\tRequestDurationHistogram: promauto.NewHistogramVec(prometheus.HistogramOpts{\n\t\t\tSubsystem: \"provider\",\n\t\t\tName: \"http_request_duration_seconds\",\n\t\t\tHelp: \"Seconds spent serving HTTP requests.\",\n\t\t\tBuckets: prometheus.DefBuckets,\n\t\t}, []string{\"code\", \"method\", \"path\"}),\n\t}\n}", "func (it *Mcmc4intmcMetricsIterator) Create(key uint64) (*Mcmc4intmcMetrics, error) {\n\ttmtr := &Mcmc4intmcMetrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &Mcmc4intmcMetrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\n}", "func createMetricsToMetrics(\n\t_ context.Context,\n\tset connector.CreateSettings,\n\tcfg component.Config,\n\tnextConsumer consumer.Metrics,\n) (connector.Metrics, error) {\n\treturn nil, nil\n}", "func (it *Mcmc4mchintmcMetricsIterator) Create(key uint64) (*Mcmc4mchintmcMetrics, error) {\n\ttmtr := &Mcmc4mchintmcMetrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &Mcmc4mchintmcMetrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\n}", "func (it *Mcmc7intmcMetricsIterator) Create(key uint64) (*Mcmc7intmcMetrics, error) {\n\ttmtr := &Mcmc7intmcMetrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &Mcmc7intmcMetrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\n}", "func (it *Mcmc5intmcMetricsIterator) Create(key uint64) (*Mcmc5intmcMetrics, error) {\n\ttmtr := &Mcmc5intmcMetrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &Mcmc5intmcMetrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\n}", "func NewMetrics(healthyChan chan bool, config *openapi.AlgoRunnerConfig) Metrics {\n\n\tgo func() {\n\t\tfor h := range healthyChan {\n\t\t\thealthy = h\n\t\t}\n\t}()\n\n\tregisterMetrics(config)\n\n\treturn Metrics{\n\t\tRunnerRuntimeHistogram: runnerRuntimeHistogram,\n\t\tAlgoRuntimeHistogram: algoRuntimeHistogram,\n\t\tMsgBytesInputCounter: msgBytesInputCounter,\n\t\tMsgBytesOutputCounter: msgBytesOutputCounter,\n\t\tDataBytesInputCounter: dataBytesInputCounter,\n\t\tDataBytesOutputCounter: dataBytesOutputCounter,\n\t\tRetryCounter: retryCounter,\n\t\tDlqCounter: dlqCounter,\n\t\tAlgoErrorCounter: algoErrorCounter,\n\t\tRunnerErrorCounter: runnerErrorCounter,\n\t\tMsgOK: msgOK,\n\t\tMsgNOK: msgNOK,\n\t\tMsgDropped: msgDropped,\n\t\tProducerQueueLen: &producerQueueLen,\n\t\tEventIgnored: eventIgnored,\n\t\tMsgInTransit: msgInTransit,\n\t\tLibRdKafkaVersion: libRdKafkaVersion,\n\t\tLastProducerStartTime: &lastProducerStartTime,\n\t\tMetricCertExpirationTime: &metricCertExpirationTime,\n\t\tMetricCaExpirationTime: &metricCaExpirationTime,\n\t\tMetricKafkaEventsQueueLen: &metricKafkaEventsQueueLen,\n\t\tMetricRDKafkaGlobal: metricRDKafkaGlobal,\n\t\tMetricRDKafkaBroker: metricRDKafkaBroker,\n\t\tMetricRDKafkaTopic: metricRDKafkaTopic,\n\t\tMetricRDKafkaPartition: metricRDKafkaPartition,\n\n\t\tDeploymentLabel: deploymentLabel,\n\t\tPipelineLabel: pipelineLabel,\n\t\tComponentLabel: componentLabel,\n\t\tAlgoLabel: algoLabel,\n\t\tAlgoVersionLabel: algoVersionLabel,\n\t\tAlgoIndexLabel: algoIndexLabel,\n\t}\n}", "func newmetric(name string, kind metricKind, tags []string, common bool) *metric {\n\treturn &metric{\n\t\tname: name,\n\t\tkind: kind,\n\t\ttags: append([]string{}, tags...),\n\t\tcommon: common,\n\t}\n}", "func (it *Mcmc5mchintmcMetricsIterator) Create(key uint64) (*Mcmc5mchintmcMetrics, error) {\n\ttmtr := &Mcmc5mchintmcMetrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &Mcmc5mchintmcMetrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\n}", "func (it *Mcmc6intmcMetricsIterator) Create(key uint64) (*Mcmc6intmcMetrics, error) {\n\ttmtr := &Mcmc6intmcMetrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &Mcmc6intmcMetrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\n}", "func (it *Mcmc6mchintmcMetricsIterator) Create(key uint64) (*Mcmc6mchintmcMetrics, error) {\n\ttmtr := &Mcmc6mchintmcMetrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &Mcmc6mchintmcMetrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\n}", "func New(metrics ...interface{}) Master {\n\tvar sentries []Sentry\n\tvar entries []Metrics\n\n\tfor _, item := range metrics {\n\t\tswitch rItem := item.(type) {\n\t\tcase Metrics:\n\t\t\tentries = append(entries, rItem)\n\t\tcase Sentry:\n\t\t\tsentries = append(sentries, rItem)\n\t\t}\n\t}\n\n\treturn Master{\n\t\tmetrics: append(entries, Sentries(sentries...)),\n\t}\n}", "func (it *Mcmc7mchintmcMetricsIterator) Create(key uint64) (*Mcmc7mchintmcMetrics, error) {\n\ttmtr := &Mcmc7mchintmcMetrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &Mcmc7mchintmcMetrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\n}", "func (it *Mcmc1mchintmcMetricsIterator) Create(key uint64) (*Mcmc1mchintmcMetrics, error) {\n\ttmtr := &Mcmc1mchintmcMetrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &Mcmc1mchintmcMetrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\n}", "func (it *Mcmc1intmcMetricsIterator) Create(key uint64) (*Mcmc1intmcMetrics, error) {\n\ttmtr := &Mcmc1intmcMetrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &Mcmc1intmcMetrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\n}", "func NewMetrics(conf *probepb.HermesProbeDef, target *probepb.Target) (*Metrics, error) {\n\tm := &Metrics{\n\t\tProbeOpLatency: make(map[ProbeOperation]map[ExitStatus]*metrics.EventMetrics, len(ProbeOpName)),\n\t\tAPICallLatency: make(map[APICall]map[ExitStatus]*metrics.EventMetrics, len(APICallName)),\n\t}\n\n\tprobeOpLatDist, err := metrics.NewDistributionFromProto(conf.GetProbeLatencyDistribution())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid argument: error creating probe latency distribution from the specification (%v): %w\", conf.GetProbeLatencyDistribution(), err)\n\t}\n\n\tfor op := range ProbeOpName {\n\t\tm.ProbeOpLatency[op] = make(map[ExitStatus]*metrics.EventMetrics, len(ExitStatusName))\n\t\tfor e := range ExitStatusName {\n\t\t\tm.ProbeOpLatency[op][e] = metrics.NewEventMetrics(time.Now()).\n\t\t\t\tAddMetric(\"hermes_probe_latency_seconds\", probeOpLatDist.Clone()).\n\t\t\t\tAddLabel(\"storage_system\", target.GetTargetSystem().String()).\n\t\t\t\tAddLabel(\"target\", fmt.Sprintf(\"%s:%s\", target.GetName(), target.GetBucketName())).\n\t\t\t\tAddLabel(\"probe_operation\", ProbeOpName[op]).\n\t\t\t\tAddLabel(\"exit_status\", ExitStatusName[e])\n\t\t}\n\t}\n\n\tapiCallLatDist, err := metrics.NewDistributionFromProto(conf.GetApiCallLatencyDistribution())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid argument: error creating probe latency distribution from the specification (%v): %v\", conf.GetApiCallLatencyDistribution(), err)\n\t}\n\n\tfor call := range APICallName {\n\t\tm.APICallLatency[call] = make(map[ExitStatus]*metrics.EventMetrics, len(ExitStatusName))\n\t\tfor e := range ExitStatusName {\n\t\t\tm.APICallLatency[call][e] = metrics.NewEventMetrics(time.Now()).\n\t\t\t\tAddMetric(\"hermes_api_latency_seconds\", apiCallLatDist.Clone()).\n\t\t\t\tAddLabel(\"storage_system\", target.GetTargetSystem().String()).\n\t\t\t\tAddLabel(\"target\", fmt.Sprintf(\"%s:%s\", target.GetName(), target.GetBucketName())).\n\t\t\t\tAddLabel(\"api_call\", APICallName[call]).\n\t\t\t\tAddLabel(\"exit_status\", ExitStatusName[e])\n\t\t}\n\t}\n\n\treturn m, nil\n}", "func (Metrics) MetricStruct() {}", "func (it *Mcmc0mchintmcMetricsIterator) Create(key uint64) (*Mcmc0mchintmcMetrics, error) {\n\ttmtr := &Mcmc0mchintmcMetrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &Mcmc0mchintmcMetrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\n}", "func NewPrometheusMetrics(namespace string, registry metrics.RegisterGatherer) *prometheusMetrics {\n\tm := &prometheusMetrics{\n\t\tregistry: registry,\n\t}\n\n\tm.AvailableIPs = prometheus.NewGaugeVec(prometheus.GaugeOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: ipamSubsystem,\n\t\tName: \"available_ips\",\n\t\tHelp: \"Total available IPs on Node for IPAM allocation\",\n\t}, []string{LabelTargetNodeName})\n\n\tm.UsedIPs = prometheus.NewGaugeVec(prometheus.GaugeOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: ipamSubsystem,\n\t\tName: \"used_ips\",\n\t\tHelp: \"Total used IPs on Node for IPAM allocation\",\n\t}, []string{LabelTargetNodeName})\n\n\tm.NeededIPs = prometheus.NewGaugeVec(prometheus.GaugeOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: ipamSubsystem,\n\t\tName: \"needed_ips\",\n\t\tHelp: \"Number of IPs that are needed on the Node to satisfy IPAM allocation requests\",\n\t}, []string{LabelTargetNodeName})\n\n\tm.IPsAllocated = prometheus.NewGaugeVec(prometheus.GaugeOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: ipamSubsystem,\n\t\tName: \"ips\",\n\t\tHelp: \"Number of IPs allocated\",\n\t}, []string{\"type\"})\n\n\tm.AllocateIpOps = prometheus.NewCounterVec(prometheus.CounterOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: ipamSubsystem,\n\t\tName: \"ip_allocation_ops\",\n\t\tHelp: \"Number of IP allocation operations\",\n\t}, []string{\"subnet_id\"})\n\n\tm.ReleaseIpOps = prometheus.NewCounterVec(prometheus.CounterOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: ipamSubsystem,\n\t\tName: \"ip_release_ops\",\n\t\tHelp: \"Number of IP release operations\",\n\t}, []string{\"subnet_id\"})\n\n\tm.AllocateInterfaceOps = prometheus.NewCounterVec(prometheus.CounterOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: ipamSubsystem,\n\t\tName: \"interface_creation_ops\",\n\t\tHelp: \"Number of interfaces allocated\",\n\t}, []string{\"subnet_id\"})\n\n\tm.AvailableInterfaces = prometheus.NewGauge(prometheus.GaugeOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: ipamSubsystem,\n\t\tName: \"available_interfaces\",\n\t\tHelp: \"Number of interfaces with addresses available\",\n\t})\n\n\tm.InterfaceCandidates = prometheus.NewGauge(prometheus.GaugeOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: ipamSubsystem,\n\t\tName: \"interface_candidates\",\n\t\tHelp: \"Number of attached interfaces with IPs available for allocation\",\n\t})\n\n\tm.EmptyInterfaceSlots = prometheus.NewGauge(prometheus.GaugeOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: ipamSubsystem,\n\t\tName: \"empty_interface_slots\",\n\t\tHelp: \"Number of empty interface slots available for interfaces to be attached\",\n\t})\n\n\tm.AvailableIPsPerSubnet = prometheus.NewGaugeVec(prometheus.GaugeOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: ipamSubsystem,\n\t\tName: \"available_ips_per_subnet\",\n\t\tHelp: \"Number of available IPs per subnet ID\",\n\t}, []string{\"subnet_id\", \"availability_zone\"})\n\n\tm.Nodes = prometheus.NewGaugeVec(prometheus.GaugeOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: ipamSubsystem,\n\t\tName: \"nodes\",\n\t\tHelp: \"Number of nodes by category { total | in-deficit | at-capacity }\",\n\t}, []string{\"category\"})\n\n\tm.Resync = prometheus.NewCounter(prometheus.CounterOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: ipamSubsystem,\n\t\tName: \"resync_total\",\n\t\tHelp: \"Number of resync operations to synchronize and resolve IP deficit of nodes\",\n\t})\n\n\tm.Allocation = prometheus.NewHistogramVec(prometheus.HistogramOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: ipamSubsystem,\n\t\tName: \"allocation_duration_seconds\",\n\t\tHelp: \"Allocation ip or interface latency in seconds\",\n\t\tBuckets: merge(\n\t\t\tprometheus.LinearBuckets(0.25, 0.25, 2), // 0.25s, 0.50s\n\t\t\tprometheus.LinearBuckets(1, 1, 60), // 1s, 2s, 3s, ... 60s,\n\t\t),\n\t}, []string{\"type\", \"status\", \"subnet_id\"})\n\n\tm.Release = prometheus.NewHistogramVec(prometheus.HistogramOpts{\n\t\tNamespace: namespace,\n\t\tSubsystem: ipamSubsystem,\n\t\tName: \"release_duration_seconds\",\n\t\tHelp: \"Release ip or interface latency in seconds\",\n\t\tBuckets: merge(\n\t\t\tprometheus.LinearBuckets(0.25, 0.25, 2), // 0.25s, 0.50s\n\t\t\tprometheus.LinearBuckets(1, 1, 60), // 1s, 2s, 3s, ... 60s,\n\t\t),\n\t}, []string{\"type\", \"status\", \"subnet_id\"})\n\n\t// pool_maintainer is a more generic name, but for backward compatibility\n\t// of dashboard, keep the metric name deficit_resolver unchanged\n\tm.poolMaintainer = NewTriggerMetrics(namespace, \"deficit_resolver\")\n\tm.k8sSync = NewTriggerMetrics(namespace, \"k8s_sync\")\n\tm.resync = NewTriggerMetrics(namespace, \"resync\")\n\n\tregistry.MustRegister(m.AvailableIPs)\n\tregistry.MustRegister(m.UsedIPs)\n\tregistry.MustRegister(m.NeededIPs)\n\n\tregistry.MustRegister(m.IPsAllocated)\n\tregistry.MustRegister(m.AllocateIpOps)\n\tregistry.MustRegister(m.ReleaseIpOps)\n\tregistry.MustRegister(m.AllocateInterfaceOps)\n\tregistry.MustRegister(m.AvailableInterfaces)\n\tregistry.MustRegister(m.InterfaceCandidates)\n\tregistry.MustRegister(m.EmptyInterfaceSlots)\n\tregistry.MustRegister(m.AvailableIPsPerSubnet)\n\tregistry.MustRegister(m.Nodes)\n\tregistry.MustRegister(m.Resync)\n\tregistry.MustRegister(m.Allocation)\n\tregistry.MustRegister(m.Release)\n\tm.poolMaintainer.Register(registry)\n\tm.k8sSync.Register(registry)\n\tm.resync.Register(registry)\n\n\treturn m\n}", "func (*Metrics) MetricStruct() {}", "func (it *Mcmc3intmcMetricsIterator) Create(key uint64) (*Mcmc3intmcMetrics, error) {\n\ttmtr := &Mcmc3intmcMetrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &Mcmc3intmcMetrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\n}", "func (it *Mcmc0intmcMetricsIterator) Create(key uint64) (*Mcmc0intmcMetrics, error) {\n\ttmtr := &Mcmc0intmcMetrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &Mcmc0intmcMetrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\n}", "func (it *Msmsintprp5MetricsIterator) Create(key uint64) (*Msmsintprp5Metrics, error) {\n\ttmtr := &Msmsintprp5Metrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &Msmsintprp5Metrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\n}", "func (m Metrics) MetricStruct() {}", "func New(cfg *Config) (*CirconusMetrics, error) {\n\n\tif cfg == nil {\n\t\treturn nil, errors.New(\"invalid configuration (nil)\")\n\t}\n\n\tcm := &CirconusMetrics{\n\t\tcounters: make(map[string]uint64),\n\t\tcounterFuncs: make(map[string]func() uint64),\n\t\tgauges: make(map[string]interface{}),\n\t\tgaugeFuncs: make(map[string]func() int64),\n\t\thistograms: make(map[string]*Histogram),\n\t\ttext: make(map[string]string),\n\t\ttextFuncs: make(map[string]func() string),\n\t\tcustom: make(map[string]Metric),\n\t\tlastMetrics: &prevMetrics{},\n\t}\n\n\t// Logging\n\t{\n\t\tcm.Debug = cfg.Debug\n\t\tcm.DumpMetrics = cfg.DumpMetrics\n\t\tcm.Log = cfg.Log\n\n\t\tif (cm.Debug || cm.DumpMetrics) && cm.Log == nil {\n\t\t\tcm.Log = log.New(os.Stderr, \"\", log.LstdFlags)\n\t\t}\n\t\tif cm.Log == nil {\n\t\t\tcm.Log = log.New(ioutil.Discard, \"\", log.LstdFlags)\n\t\t}\n\t}\n\n\t// Flush Interval\n\t{\n\t\tfi := defaultFlushInterval\n\t\tif cfg.Interval != \"\" {\n\t\t\tfi = cfg.Interval\n\t\t}\n\n\t\tdur, err := time.ParseDuration(fi)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"parsing flush interval\")\n\t\t}\n\t\tcm.flushInterval = dur\n\t}\n\n\t// metric resets\n\n\tcm.resetCounters = true\n\tif cfg.ResetCounters != \"\" {\n\t\tsetting, err := strconv.ParseBool(cfg.ResetCounters)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"parsing reset counters\")\n\t\t}\n\t\tcm.resetCounters = setting\n\t}\n\n\tcm.resetGauges = true\n\tif cfg.ResetGauges != \"\" {\n\t\tsetting, err := strconv.ParseBool(cfg.ResetGauges)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"parsing reset gauges\")\n\t\t}\n\t\tcm.resetGauges = setting\n\t}\n\n\tcm.resetHistograms = true\n\tif cfg.ResetHistograms != \"\" {\n\t\tsetting, err := strconv.ParseBool(cfg.ResetHistograms)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"parsing reset histograms\")\n\t\t}\n\t\tcm.resetHistograms = setting\n\t}\n\n\tcm.resetText = true\n\tif cfg.ResetText != \"\" {\n\t\tsetting, err := strconv.ParseBool(cfg.ResetText)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"parsing reset text\")\n\t\t}\n\t\tcm.resetText = setting\n\t}\n\n\t// check manager\n\t{\n\t\tcfg.CheckManager.Debug = cm.Debug\n\t\tcfg.CheckManager.Log = cm.Log\n\n\t\tcheck, err := checkmgr.New(&cfg.CheckManager)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"creating new check manager\")\n\t\t}\n\t\tcm.check = check\n\t}\n\n\t// start initialization (serialized or background)\n\tif err := cm.check.Initialize(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// if automatic flush is enabled, start it.\n\t// NOTE: submit will jettison metrics until initialization has completed.\n\tif cm.flushInterval > time.Duration(0) {\n\t\tgo func() {\n\t\t\tfor range time.NewTicker(cm.flushInterval).C {\n\t\t\t\tcm.Flush()\n\t\t\t}\n\t\t}()\n\t}\n\n\treturn cm, nil\n}", "func New() handler.MetricHandler {\n\treturn &collectdMetricsHandler{}\n}", "func (it *Mcmc3mchintmcMetricsIterator) Create(key uint64) (*Mcmc3mchintmcMetrics, error) {\n\ttmtr := &Mcmc3mchintmcMetrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &Mcmc3mchintmcMetrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\n}", "func (it *Mcmc2intmcMetricsIterator) Create(key uint64) (*Mcmc2intmcMetrics, error) {\n\ttmtr := &Mcmc2intmcMetrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &Mcmc2intmcMetrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\n}", "func NewMock() *MockMetrics {\n\treturn &MockMetrics{}\n}", "func New() *CloudMetrics {\n\treturn &CloudMetrics{\n\t\tAPIRequestsCounter: promauto.NewCounter(prometheus.CounterOpts{\n\t\t\tNamespace: provisionerNamespace,\n\t\t\tSubsystem: provisionerSubsystemAPI,\n\t\t\tName: \"requests_total\",\n\t\t\tHelp: \"The total number of http API requests\",\n\t\t}),\n\n\t\tAPITimesHistograms: promauto.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: provisionerNamespace,\n\t\t\t\tSubsystem: provisionerSubsystemAPI,\n\t\t\t\tName: \"requests_duration\",\n\t\t\t\tHelp: \"The duration of http API requests\",\n\t\t\t},\n\t\t\t[]string{\"handler\", \"method\", \"status_code\"},\n\t\t),\n\n\t\tInstallationCreationDurationHist: promauto.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: provisionerNamespace,\n\t\t\t\tSubsystem: provisionerSubsystemApp,\n\t\t\t\tName: \"installation_creation_duration_seconds\",\n\t\t\t\tHelp: \"The duration of installation creation tasks\",\n\t\t\t\tBuckets: standardDurationBuckets(),\n\t\t\t},\n\t\t\t[]string{\"group\"},\n\t\t),\n\n\t\tInstallationUpdateDurationHist: promauto.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: provisionerNamespace,\n\t\t\t\tSubsystem: provisionerSubsystemApp,\n\t\t\t\tName: \"installation_update_duration_seconds\",\n\t\t\t\tHelp: \"The duration of installation update tasks\",\n\t\t\t\tBuckets: standardDurationBuckets(),\n\t\t\t},\n\t\t\t[]string{\"group\"},\n\t\t),\n\n\t\tInstallationHibernationDurationHist: promauto.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: provisionerNamespace,\n\t\t\t\tSubsystem: provisionerSubsystemApp,\n\t\t\t\tName: \"installation_hibernation_duration_seconds\",\n\t\t\t\tHelp: \"The duration of installation hibernation tasks\",\n\t\t\t\tBuckets: standardDurationBuckets(),\n\t\t\t},\n\t\t\t[]string{\"group\"},\n\t\t),\n\n\t\tInstallationWakeUpDurationHist: promauto.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: provisionerNamespace,\n\t\t\t\tSubsystem: provisionerSubsystemApp,\n\t\t\t\tName: \"installation_wakeup_duration_seconds\",\n\t\t\t\tHelp: \"The duration of installation wake up tasks\",\n\t\t\t\tBuckets: standardDurationBuckets(),\n\t\t\t},\n\t\t\t[]string{\"group\"},\n\t\t),\n\n\t\tInstallationDeletionDurationHist: promauto.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: provisionerNamespace,\n\t\t\t\tSubsystem: provisionerSubsystemApp,\n\t\t\t\tName: \"installation_deletion_duration_seconds\",\n\t\t\t\tHelp: \"The duration of installation deletion tasks\",\n\t\t\t\tBuckets: standardDurationBuckets(),\n\t\t\t},\n\t\t\t[]string{\"group\"},\n\t\t),\n\n\t\tClusterInstallationReconcilingDurationHist: promauto.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: provisionerNamespace,\n\t\t\t\tSubsystem: provisionerSubsystemApp,\n\t\t\t\tName: \"cluster_installation_reconciling_duration_seconds\",\n\t\t\t\tHelp: \"The duration of cluster installation reconciliation tasks\",\n\t\t\t\tBuckets: standardDurationBuckets(),\n\t\t\t},\n\t\t\t[]string{\"cluster\"},\n\t\t),\n\n\t\tClusterInstallationDeletionDurationHist: promauto.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: provisionerNamespace,\n\t\t\t\tSubsystem: provisionerSubsystemApp,\n\t\t\t\tName: \"cluster_installation_deletion_duration_seconds\",\n\t\t\t\tHelp: \"The duration of cluster installation deletion tasks\",\n\t\t\t\tBuckets: standardDurationBuckets(),\n\t\t\t},\n\t\t\t[]string{\"cluster\"},\n\t\t),\n\t\tClusterCreationDurationHist: promauto.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: provisionerNamespace,\n\t\t\t\tSubsystem: provisionerSubsystemApp,\n\t\t\t\tName: \"cluster_creation_duration_seconds\",\n\t\t\t\tHelp: \"The duration of cluster creation tasks\",\n\t\t\t\tBuckets: standardDurationBuckets(),\n\t\t\t},\n\t\t\t[]string{},\n\t\t),\n\t\tClusterUpgradeDurationHist: promauto.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: provisionerNamespace,\n\t\t\t\tSubsystem: provisionerSubsystemApp,\n\t\t\t\tName: \"cluster_upgrade_duration_seconds\",\n\t\t\t\tHelp: \"The duration of cluster upgrade tasks\",\n\t\t\t\tBuckets: standardDurationBuckets(),\n\t\t\t},\n\t\t\t[]string{},\n\t\t),\n\t\tClusterProvisioningDurationHist: promauto.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: provisionerNamespace,\n\t\t\t\tSubsystem: provisionerSubsystemApp,\n\t\t\t\tName: \"cluster_provisioning_duration_seconds\",\n\t\t\t\tHelp: \"The duration of cluster provisioning tasks\",\n\t\t\t\tBuckets: standardDurationBuckets(),\n\t\t\t},\n\t\t\t[]string{},\n\t\t),\n\t\tClusterResizeDurationHist: promauto.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: provisionerNamespace,\n\t\t\t\tSubsystem: provisionerSubsystemApp,\n\t\t\t\tName: \"cluster_resize_duration_seconds\",\n\t\t\t\tHelp: \"The duration of cluster resize tasks\",\n\t\t\t\tBuckets: standardDurationBuckets(),\n\t\t\t},\n\t\t\t[]string{},\n\t\t),\n\t\tClusterDeletionDurationHist: promauto.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: provisionerNamespace,\n\t\t\t\tSubsystem: provisionerSubsystemApp,\n\t\t\t\tName: \"cluster_deletion_duration_seconds\",\n\t\t\t\tHelp: \"The duration of cluster deletion tasks\",\n\t\t\t\tBuckets: standardDurationBuckets(),\n\t\t\t},\n\t\t\t[]string{},\n\t\t),\n\t}\n}", "func initMetrics() *metrics.Manager {\n\treturn metrics.New(\"calert\")\n}", "func newMigratorMetrics(registerFunc func(k8smetrics.Registerable) error) *migratorMetrics {\n\t// objectMigrates is defined in kube-storave-version-migrator\n\tobjectsMigrated := k8smetrics.NewCounterVec(\n\t\t&k8smetrics.CounterOpts{\n\t\t\tNamespace: namespace,\n\t\t\tSubsystem: subsystem,\n\t\t\tName: \"migrated_objects\",\n\t\t\tHelp: \"The total number of objects that have been migrated, labeled with the full resource name\",\n\t\t}, []string{\"resource\"})\n\tregisterFunc(objectsMigrated)\n\n\t// migration is defined in kube-storave-version-migrator\n\tmigration := k8smetrics.NewCounterVec(\n\t\t&k8smetrics.CounterOpts{\n\t\t\tNamespace: namespace,\n\t\t\tSubsystem: subsystem,\n\t\t\tName: \"migrations\",\n\t\t\tHelp: \"The total number of completed migration, labeled with the full resource name, and the status of the migration (failed or succeeded)\",\n\t\t}, []string{\"resource\", \"status\"})\n\tregisterFunc(migration)\n\n\t// migrationDuration is not defined upstream but uses the same Namespace and Subsystem\n\t// as the other metrics that are defined in kube-storave-version-migrator\n\tmigrationDuration := k8smetrics.NewHistogramVec(\n\t\t&k8smetrics.HistogramOpts{\n\t\t\tNamespace: namespace,\n\t\t\tSubsystem: subsystem,\n\t\t\tName: \"migration_duration_seconds\",\n\t\t\tHelp: \"How long a successful migration takes in seconds, labeled with the full resource name\",\n\t\t\tBuckets: prometheus.ExponentialBuckets(120, 2, 7),\n\t\t}, []string{\"resource\"})\n\tregisterFunc(migrationDuration)\n\n\treturn &migratorMetrics{\n\t\tobjectsMigrated: objectsMigrated,\n\t\tmigration: migration,\n\t\tmigrationDuration: migrationDuration,\n\t}\n}", "func ExampleMetricSetFactory() {}", "func (MetricsHandler) Create(c echo.Context) error {\n\tvar response *contracts.CreateMetricsResponse\n\tvar err *contracts.Error\n\trequestID := c.Get(\"RequestID\").(string)\n\tmethod := c.Get(\"Method\").(string)\n\tctx := types.NewContext(c.Request().Context(), requestID)\n\tctx = ctx.Set(\"path\", \"metrics\")\n\tctx = ctx.Set(\"action\", strings.ToLower(method))\n\tctx = ctx.Set(\"requestIP\", c.RealIP())\n\treq := new(contracts.CreateMetricsRequest)\n\tif err = req.ExtractFromHTTP(c); err == nil {\n\t\treq.Request = &contracts.Request{RequestID: &requestID, Method: &method}\n\t\terr = req.Validate()\n\t}\n\tif err != nil {\n\t\tresponse = new(contracts.CreateMetricsResponse)\n\t\tresponseDataItem := new(contracts.SingleMetricsResponse)\n\t\tresponseDataItem.SingleResponse.SetErrorData(err)\n\t\tresponse.ResponseData = []*contracts.SingleMetricsResponse{responseDataItem}\n\t\treturn Response(c, response, *responseDataItem.SingleResponse.Code)\n\t}\n\t//set the authenticator in context\n\tctx = ctx.Set(\"auth\", nil)\n\tif ok := throttle.BasicThrottler(1000, \"1*M\").Throttle(ctx); !ok {\n\t\terr = contracts.ErrTooManyRequests()\n\t}\n\tif err != nil {\n\t\tresponse = new(contracts.CreateMetricsResponse)\n\t\tresponseDataItem := new(contracts.SingleMetricsResponse)\n\t\tresponseDataItem.SingleResponse.SetErrorData(err)\n\t\tresponse.ResponseData = []*contracts.SingleMetricsResponse{responseDataItem}\n\t\treturn Response(c, response, *responseDataItem.SingleResponse.Code)\n\t}\n\tresponse, err = metrics.Create(ctx, *req)\n\tif err != nil {\n\t\tresponse = new(contracts.CreateMetricsResponse)\n\t\tresponseDataItem := new(contracts.SingleMetricsResponse)\n\t\tresponseDataItem.SingleResponse.SetErrorData(err)\n\t\tresponse.ResponseData = []*contracts.SingleMetricsResponse{responseDataItem}\n\t\treturn Response(c, response, *responseDataItem.SingleResponse.Code)\n\t}\n\tvar status int\n\tif response.Metadata != nil && response.Metadata.Success != nil && response.Metadata.Failed != nil {\n\t\tstatus = http.StatusMultiStatus\n\t} else {\n\t\tstatus = http.StatusOK\n\t}\n\treturn Response(c, response, status)\n}", "func NewMetric(name string, prog string, kind Kind, keys ...string) *Metric {\n\tm := &Metric{Name: name, Program: prog, Kind: kind,\n\t\tKeys: make([]string, len(keys), len(keys)),\n\t\tLabelValues: make([]*LabelValue, 0)}\n\tcopy(m.Keys, keys)\n\treturn m\n}", "func (it *MsmsintmsMetricsIterator) Create(key uint64) (*MsmsintmsMetrics, error) {\n\ttmtr := &MsmsintmsMetrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &MsmsintmsMetrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\n}", "func NewMetric(name string, fields []MetricField, tags []MetricTag) (Metric, error) {\n\tif err := ValidateMetricName(name, \"metric\"); err != nil {\n\t\treturn Metric{}, err\n\t}\n\n\tif len(fields) == 0 {\n\t\treturn Metric{}, errors.New(\"one or more metric fields are required\")\n\t}\n\n\tfor _, field := range fields {\n\t\tif err := ValidateMetricName(field.Name, \"field\"); err != nil {\n\t\t\treturn Metric{}, err\n\t\t}\n\t}\n\n\tif len(tags) > 0 {\n\t\tfor _, tag := range tags {\n\t\t\tif err := ValidateMetricName(tag.Name, \"tag\"); err != nil {\n\t\t\t\treturn Metric{}, err\n\t\t\t}\n\t\t}\n\t}\n\n\tmetric := Metric{\n\t\tVersionable: common.NewVersionable(),\n\t\tName: name,\n\t\tFields: fields,\n\t\tTimestamp: time.Now().UnixNano(),\n\t\tTags: tags,\n\t}\n\n\treturn metric, nil\n}", "func NewMetricsController(datasource common.IDatasource, config *core.ConsumeConfiguration, logger *log.Logger) *MetricsController {\n\treturn &MetricsController{\n\t\tController: core.Controller{},\n\t\tdatasource: datasource,\n\t\tconfig: config,\n\t\tlogger: logger,\n\t}\n}", "func (it *Mcmc2mchintmcMetricsIterator) Create(key uint64) (*Mcmc2mchintmcMetrics, error) {\n\ttmtr := &Mcmc2mchintmcMetrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &Mcmc2mchintmcMetrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\n}", "func NewMockMetrics(ctrl *gomock.Controller) *MockMetrics {\n\tmock := &MockMetrics{ctrl: ctrl}\n\tmock.recorder = &MockMetricsMockRecorder{mock}\n\treturn mock\n}", "func NewMockMetrics(ctrl *gomock.Controller) *MockMetrics {\n\tmock := &MockMetrics{ctrl: ctrl}\n\tmock.recorder = &MockMetricsMockRecorder{mock}\n\treturn mock\n}", "func NewMockMetrics(ctrl *gomock.Controller) *MockMetrics {\n\tmock := &MockMetrics{ctrl: ctrl}\n\tmock.recorder = &MockMetricsMockRecorder{mock}\n\treturn mock\n}", "func NewMockMetrics(ctrl *gomock.Controller) *MockMetrics {\n\tmock := &MockMetrics{ctrl: ctrl}\n\tmock.recorder = &MockMetricsMockRecorder{mock}\n\treturn mock\n}", "func NewMockMetrics(ctrl *gomock.Controller) *MockMetrics {\n\tmock := &MockMetrics{ctrl: ctrl}\n\tmock.recorder = &MockMetricsMockRecorder{mock}\n\treturn mock\n}", "func NewMetric(asset, method string, backend MetricsBackend) Metric {\n\tm := Metric{}\n\n\tm.backend = backend\n\tm.methodName = method\n\tm.startTime = time.Now()\n\tm.asset = asset\n\n\tm.backend.AddMethod(m.asset, method)\n\treturn m\n}", "func (it *Msmsintprp1MetricsIterator) Create(key uint64) (*Msmsintprp1Metrics, error) {\n\ttmtr := &Msmsintprp1Metrics{}\n\n\tmtr := it.iter.Create(gometrics.EncodeScalarKey(key), tmtr.Size())\n\n\ttmtr = &Msmsintprp1Metrics{metrics: mtr, key: key}\n\ttmtr.Unmarshal()\n\treturn tmtr, nil\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.7179326", "0.71776175", "0.7132675", "0.711033", "0.7095065", "0.7068368", "0.7044363", "0.7039876", "0.70343345", "0.69694376", "0.6929873", "0.69260615", "0.6912803", "0.68581086", "0.68230474", "0.67767704", "0.6762274", "0.6720372", "0.66993266", "0.6685694", "0.6632504", "0.66128147", "0.66085696", "0.65735036", "0.6558332", "0.6557086", "0.65245724", "0.6517194", "0.65121627", "0.6511101", "0.65022093", "0.6457413", "0.64513725", "0.64306986", "0.6415914", "0.6368704", "0.63490254", "0.63304144", "0.6317678", "0.6309653", "0.6308617", "0.6299559", "0.6283903", "0.6252204", "0.6248366", "0.6244013", "0.62338954", "0.6221562", "0.6216651", "0.6216039", "0.6212241", "0.6211608", "0.62081665", "0.6207075", "0.6206572", "0.62042123", "0.61831254", "0.61739004", "0.61679983", "0.61649233", "0.6158422", "0.6154954", "0.61538476", "0.6145701", "0.6126142", "0.61174494", "0.61161906", "0.6110107", "0.6106087", "0.61032", "0.608754", "0.6078633", "0.6077869", "0.6077869", "0.6077869", "0.6077869", "0.6077869", "0.6069169", "0.60613495" ]
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}", "func newMutex() *mutex {\n\treturn (*mutex)(semaphore.NewWeighted(1))\n}", "func (m *Mutex) AssertHeld() {\n}", "func TestMutexesLockAndRelease(t *testing.T) {\n\tm := newMutexes()\n\tvar done bool\n\tgo func() {\n\t\tm.Lock(\"key\")\n\t\tm.Unlock(\"key\")\n\t\tdone = true\n\t}()\n\ttime.Sleep(10 * time.Millisecond)\n\tif !done {\n\t\tt.Error(\"Mutex still blocking despite release\")\n\t}\n}", "func mutex(c echo.Context) error {\n\tpprof.Handler(\"mutex\").ServeHTTP(c.Response().Writer, c.Request())\n\treturn nil\n}", "func (rw *RWMutex) AssertHeld() {\n}", "func TestMutexUncontended(t *testing.T) {\n\tvar mu sync.Mutex\n\n\t// Lock and unlock the mutex a few times.\n\tfor i := 0; i < 3; i++ {\n\t\tmu.Lock()\n\t\tmu.Unlock()\n\t}\n}", "func MLock(s string) {\n\tif Waits[s] == nil {\n\t\tWaits[s] = &Mutex{}\n\t}\n\tWaits[s].Lock()\n}", "func (c *MockedHTTPContext) Lock() {\n\tif c.MockedLock != nil {\n\t\tc.MockedLock()\n\t}\n}", "func TestPrewriteLocked4A(t *testing.T) {\n}", "func MutexLock(scope *Scope, mutex tf.Output) (mutex_lock tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"MutexLock\",\n\t\tInput: []tf.Input{\n\t\t\tmutex,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (m *MockMempool) Lock() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Lock\")\n}", "func TestMutexesDifferentKeys(t *testing.T) {\n\tm := newMutexes()\n\tvar (\n\t\tresult string\n\t\twg sync.WaitGroup\n\t)\n\tgo0 := make(chan bool)\n\tgo1 := make(chan bool)\n\twg.Add(2)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tm.Lock(\"key1\")\n\t\tdefer m.Unlock(\"key1\")\n\t\tresult += \"1\"\n\t\tgo0 <- true\n\t}()\n\tgo func() {\n\t\tdefer wg.Done()\n\t\t<-go1\n\t\tm.Lock(\"key2\")\n\t\tdefer m.Unlock(\"key2\")\n\t\tresult += \"2\"\n\t}()\n\t<-go0\n\tgo1 <- true\n\twg.Wait()\n\tif result != \"12\" {\n\t\tt.Errorf(\"Locking not as expected: %s\", result)\n\t}\n}", "func MakeMutex() Mutex {\n\tch := make(chan struct{}, 1)\n\tch <- struct{}{}\n\treturn Mutex{ch: ch}\n}", "func TestMutexesTwoLocks(t *testing.T) {\n\tm := newMutexes()\n\tvar (\n\t\tresult string\n\t\twg sync.WaitGroup\n\t)\n\tgo0 := make(chan bool)\n\tgo1 := make(chan bool)\n\tgo2 := make(chan bool)\n\tfor i := 0; i < 5; i++ {\n\t\twg.Add(2)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tm.Lock(\"key\")\n\t\t\tdefer m.Unlock(\"key\")\n\t\t\tgo0 <- true\n\t\t\t<-go1\n\t\t\tresult += \"1\"\n\t\t}()\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\t<-go2\n\t\t\tm.Lock(\"key\")\n\t\t\tdefer m.Unlock(\"key\")\n\t\t\tresult += \"2\"\n\t\t}()\n\t\t<-go0\n\t\tgo2 <- true\n\t\tgo1 <- true\n\t\twg.Wait()\n\t}\n\tif result != \"1212121212\" {\n\t\tt.Errorf(\"Locking not as expected: %s\", result)\n\t}\n}", "func (m *MutexSafe) lock() {\n\tm.Mutex.Lock()\n}", "func TestUnlockUnlocked(t *testing.T) {\n\tvar mu ctxsync.Mutex\n\tassert.Panics(t, func() { mu.Unlock() })\n}", "func (m *Mutex) AssertHeld() {\n\tif atomic.LoadInt32(&m.wLocked) == 0 {\n\t\tpanic(\"mutex is not write locked\")\n\t}\n}", "func (rw *RWMutex) AssertRHeld() {\n}", "func TestMutexesLongLock(t *testing.T) {\n\tm := newMutexes()\n\tvar (\n\t\tmutex sync.Mutex\n\t\tresult string\n\t\twg sync.WaitGroup\n\t\tsg sync.WaitGroup\n\t)\n\tgo1 := make(chan bool)\n\tfor i := 0; i < 10; i++ {\n\t\twg.Add(1)\n\t\tsg.Add(1)\n\t\tgo func(nr int) {\n\t\t\tsg.Done()\n\t\t\tdefer wg.Done()\n\t\t\t<-go1\n\t\t\tm.Lock(\"key\")\n\t\t\tmutex.Lock()\n\t\t\tresult += strconv.Itoa(nr)\n\t\t\tmutex.Unlock()\n\t\t\tm.Unlock(\"key\")\n\t\t}(i)\n\t}\n\tsg.Wait()\n\tm.Lock(\"key\")\n\tclose(go1)\n\ttime.Sleep(time.Millisecond)\n\tif len(result) > 0 {\n\t\tt.Errorf(\"Some goroutines already wrote despite locks: %s\", result)\n\t}\n\tm.Unlock(\"key\")\n\twg.Wait()\n\tif len(result) != 10 {\n\t\tt.Errorf(\"Some goroutines did not write despite released lock: %s\", result)\n\t}\n}", "func TestGetLock(t *testing.T) {\n\tlockfile := lockOrFail(t)\n\tdefer removeTestLock(lockfile)\n}", "func TestNamespaceForceUnlockTest(t *testing.T) {\n\tisDistXL := false\n\tinitNSLock(isDistXL)\n\t// Create lock.\n\tlock := globalNSMutex.NewNSLock(context.Background(), \"bucket\", \"object\")\n\tif lock.GetLock(newDynamicTimeout(60*time.Second, time.Second)) != nil {\n\t\tt.Fatalf(\"Failed to get lock\")\n\t}\n\t// Forcefully unlock lock.\n\tglobalNSMutex.ForceUnlock(\"bucket\", \"object\")\n\n\tch := make(chan struct{}, 1)\n\n\tgo func() {\n\t\t// Try to claim lock again.\n\t\tanotherLock := globalNSMutex.NewNSLock(context.Background(), \"bucket\", \"object\")\n\t\tif anotherLock.GetLock(newDynamicTimeout(60*time.Second, time.Second)) != nil {\n\t\t\tt.Errorf(\"Failed to get lock\")\n\t\t\treturn\n\t\t}\n\t\t// And signal success.\n\t\tch <- struct{}{}\n\t}()\n\n\tselect {\n\tcase <-ch:\n\t\t// Signaled so all is fine.\n\t\tbreak\n\n\tcase <-time.After(100 * time.Millisecond):\n\t\t// In case we hit the time out, the lock has not been cleared.\n\t\tt.Errorf(\"Lock not cleared.\")\n\t}\n\n\t// Clean up lock.\n\tglobalNSMutex.ForceUnlock(\"bucket\", \"object\")\n}", "func (c Mutex) Lock() {\n\t<-c.ch\n}", "func (c Mutex) LockContext(context doneContext) error {\n\tselect {\n\tcase <-context.Done():\n\t\treturn context.Err()\n\tdefault:\n\t}\n\n\tselect {\n\tcase <-c.ch:\n\t\treturn nil\n\tcase <-context.Done():\n\t\treturn context.Err()\n\t}\n}", "func SyncRuntimeSemacquireMutex(s *uint32, lifo bool)", "func testNonNilTimeoutLock(ctx context.Context, t *testing.T, w *Wallet) {\n\ttimeChan := make(chan time.Time)\n\terr := w.Unlock(ctx, testPrivPass, timeChan)\n\tif err != nil {\n\t\tt.Fatal(\"failed to unlock wallet\")\n\t}\n\ttimeChan <- time.Time{}\n\ttime.Sleep(100 * time.Millisecond) // Allow time for lock in background\n\tif !w.Locked() {\n\t\tt.Fatal(\"wallet should have locked after timeout\")\n\t}\n}", "func (m Mutex2[T]) Lock() MutexGuard[T, *sync.Mutex] {\n\tm.m.Lock()\n\treturn MutexGuard[T, *sync.Mutex]{\n\t\tm: m.m,\n\t\tT: m.value,\n\t}\n}", "func Test_FailureDo(t *testing.T) {\n\tkey := \"Test_FailureDo\"\n\tconn := Redigomock{}\n\n\tconn.FailureCall = func(cmd string) (interface{}, error) {\n\t\treturn nil, errors.New(\"mock error\")\n\t}\n\n\tlock := New(Redigoconn(&conn), key, 2000)\n\n\t_, err := lock.Lock()\n\n\tif err == nil {\n\t\tt.Error(\"redigolock should have errored\")\n\t}\n}", "func testMutex() {\n\n\tvar wg sync.WaitGroup\n\tfmt.Println(runtime.NumCPU)\n\tfmt.Println(runtime.NumGoroutine)\n\n\tcounter := 0\n\tgs := 10\n\twg.Add(gs)\n\tvar m sync.Mutex\n\tfor i := 0; i < gs; i++ {\n\t\tgo func() {\n\t\t\tm.Lock()\n\t\t\tv := counter\n\t\t\truntime.Gosched()\n\t\t\tv++\n\t\t\tcounter = v\n\t\t\tfmt.Println(counter)\n\t\t\tm.Unlock()\n\t\t\twg.Done()\n\t\t}()\n\t}\n\n\twg.Wait()\n\tfmt.Println(\"End Value Mutex !!! \", counter)\n\n}", "func (m *ModifierMock) MinimockWait(timeout time.Duration) {\n\ttimeoutCh := time.After(timeout)\n\tfor {\n\t\tok := true\n\t\tok = ok && m.SetFinished()\n\n\t\tif ok {\n\t\t\treturn\n\t\t}\n\n\t\tselect {\n\t\tcase <-timeoutCh:\n\n\t\t\tif !m.SetFinished() {\n\t\t\t\tm.t.Error(\"Expected call to ModifierMock.Set\")\n\t\t\t}\n\n\t\t\tm.t.Fatalf(\"Some mocks were not called on time: %s\", timeout)\n\t\t\treturn\n\t\tdefault:\n\t\t\ttime.Sleep(time.Millisecond)\n\t\t}\n\t}\n}", "func (d *dMutex) lock(i interface{}) {\n\n\t// acquire global lock\n\td.globalMutex.Lock()\n\n\t// if there is no cMutex for i, create it\n\tif _, ok := d.mutexes[i]; !ok {\n\t\td.mutexes[i] = new(cMutex)\n\t}\n\n\t// increase the count in order to show, that we are interested in this\n\t// instance mutex (thus now one deletes it)\n\td.mutexes[i].count++\n\n\t// remember the mutex for later\n\tmutex := &d.mutexes[i].mutex\n\n\t// as the cMutex is there, we have increased the count, and we know the\n\t// instance mutex, we can release the global lock\n\td.globalMutex.Unlock()\n\n\t// and wait on the instance mutex\n\t(*mutex).Lock()\n}", "func (s *KVS) TestLock() {\n\tlockReq, err := acomm.NewRequest(acomm.RequestOptions{\n\t\tTask: \"kv-lock\",\n\t\tArgs: LockArgs{\n\t\t\tKey: s.PrefixKey(\"some-lock\"),\n\t\t\tTTL: 1 * time.Second,\n\t\t},\n\t})\n\ts.Require().NoError(err)\n\n\t// acquire lock\n\tres, streamURL, err := s.KV.lock(lockReq)\n\ts.Require().NoError(err, \"should be able to acquire lock\")\n\ts.Require().Nil(streamURL)\n\ts.Require().NotNil(res)\n\n\tlock := res.(Cookie)\n\n\tres, streamURL, err = s.KV.lock(lockReq)\n\ts.Require().Error(err, \"should not be able to acquire an acquired lock\")\n\ts.Require().Nil(streamURL)\n\ts.Require().Nil(res)\n\n\t// unlocking\n\tunlockReq, err := acomm.NewRequest(acomm.RequestOptions{\n\t\tTask: \"kv-unlock\",\n\t\tArgs: lock,\n\t})\n\tres, streamURL, err = s.KV.unlock(unlockReq)\n\ts.Require().NoError(err, \"unlocking should not fail\")\n\ts.Require().Nil(streamURL)\n\ts.Require().Nil(res)\n\n\tres, streamURL, err = s.KV.unlock(unlockReq)\n\ts.Require().Error(err, \"unlocking lost lock should fail\")\n\ts.Require().Nil(streamURL)\n\ts.Require().Nil(res)\n\n\tres, streamURL, err = s.KV.lock(lockReq)\n\ts.Require().NoError(err, \"acquiring an unlocked lock should pass\")\n\ts.Require().Nil(streamURL)\n\ts.Require().NotNil(res)\n\n\tlock = res.(Cookie)\n\n\trenewReq, err := acomm.NewRequest(acomm.RequestOptions{\n\t\tTask: \"kv-renew\",\n\t\tArgs: lock,\n\t})\n\tfor i := 0; i < 5; i++ {\n\t\tres, streamURL, err = s.KV.renew(renewReq)\n\t\ts.Require().NoError(err, \"renewing a lock should pass\")\n\t\ts.Require().Nil(streamURL)\n\t\ts.Require().Nil(res)\n\t\ttime.Sleep(1 * time.Second)\n\t}\n\n\ttime.Sleep(3 * time.Second)\n\tres, streamURL, err = s.KV.renew(renewReq)\n\ts.Require().Error(err, \"renewing an expired lock should fail\")\n\ts.Require().Nil(streamURL)\n\ts.Require().Nil(res)\n\n\t// consul's default lock-delay\n\t// see lock-delay at https://www.consul.io/docs/internals/sessions.html\n\ttime.Sleep(15 * time.Second)\n\n\tres, streamURL, err = s.KV.lock(lockReq)\n\ts.Require().NoError(err, \"should be able to acquire previously expired lock\")\n\ts.Require().Nil(streamURL)\n\ts.Require().NotNil(res)\n}", "func TestFieldValues(t *testing.T) {\n\tvar m Mutex\n\tm.Lock()\n\tif got := *m.state(); got != mutexLocked {\n\t\tt.Errorf(\"got locked sync.Mutex.state = %d, want = %d\", got, mutexLocked)\n\t}\n\tm.Unlock()\n\tif got := *m.state(); got != mutexUnlocked {\n\t\tt.Errorf(\"got unlocked sync.Mutex.state = %d, want = %d\", got, mutexUnlocked)\n\t}\n}", "func (m RWMutex2[T]) Lock() MutexGuard[T, *sync.RWMutex] {\n\tm.rw.Lock()\n\treturn MutexGuard[T, *sync.RWMutex]{\n\t\tm: m.rw,\n\t\tT: m.value,\n\t}\n}", "func checkTrylockMainProcess(t *testing.T) {\n\tvar err error\n\tlockfile := lockOrFail(t)\n\tdefer removeTestLock(lockfile)\n\tlockdir := filepath.Dir(lockfile.File.Name())\n\totherAcquired, message, err := forkAndGetLock(lockdir)\n\tif err != nil {\n\t\tt.Fatalf(\"Unexpected error in subprocess trying to lock uncontested fileLock: %v. Subprocess output: %q\", err, message)\n\t}\n\tif !otherAcquired {\n\t\tt.Fatalf(\"Subprocess failed to lock uncontested fileLock. Subprocess output: %q\", message)\n\t}\n\n\terr = lockfile.tryLock()\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to lock fileLock: %v\", err)\n\t}\n\n\treacquired, message, err := forkAndGetLock(filepath.Dir(lockfile.File.Name()))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif reacquired {\n\t\tt.Fatalf(\"Permitted locking fileLock twice. Subprocess output: %q\", message)\n\t}\n\n\terr = lockfile.Unlock()\n\tif err != nil {\n\t\tt.Fatalf(\"Error unlocking fileLock: %v\", err)\n\t}\n\n\treacquired, message, err = forkAndGetLock(filepath.Dir(lockfile.File.Name()))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !reacquired {\n\t\tt.Fatalf(\"Subprocess failed to acquire lock after it was released by the main process. Subprocess output: %q\", message)\n\t}\n}", "func TestOtherGoroutineUnlock(t *testing.T) {\n\tconst N = 100\n\tvar (\n\t\tmu ctxsync.Mutex\n\t\tg errgroup.Group\n\t\tchLocked = make(chan struct{})\n\t\tx int\n\t)\n\t// Run N goroutines each trying to lock the mutex. Run another N\n\t// goroutines, one of which is selected to unlock the mutex after each time\n\t// it is successfully locked.\n\tfor i := 0; i < N; i++ {\n\t\tg.Go(func() error {\n\t\t\tif err := mu.Lock(context.Background()); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tx++\n\t\t\tchLocked <- struct{}{}\n\t\t\treturn nil\n\t\t})\n\t\tg.Go(func() error {\n\t\t\t<-chLocked\n\t\t\tx++\n\t\t\tmu.Unlock()\n\t\t\treturn nil\n\t\t})\n\t}\n\tassert.NoError(t, g.Wait())\n\t// We run N*2 goroutines, each incrementing x by 1 while the lock is held.\n\tassert.Equal(t, N*2, x)\n}", "func (m *StateSwitcherMock) MinimockWait(timeout time.Duration) {\n\ttimeoutCh := time.After(timeout)\n\tfor {\n\t\tok := true\n\t\tok = ok && (m.GetStateFunc == nil || atomic.LoadUint64(&m.GetStateCounter) > 0)\n\t\tok = ok && (m.SetPulsarFunc == nil || atomic.LoadUint64(&m.SetPulsarCounter) > 0)\n\t\tok = ok && (m.SwitchToStateFunc == nil || atomic.LoadUint64(&m.SwitchToStateCounter) > 0)\n\t\tok = ok && (m.setStateFunc == nil || atomic.LoadUint64(&m.setStateCounter) > 0)\n\n\t\tif ok {\n\t\t\treturn\n\t\t}\n\n\t\tselect {\n\t\tcase <-timeoutCh:\n\n\t\t\tif m.GetStateFunc != nil && atomic.LoadUint64(&m.GetStateCounter) == 0 {\n\t\t\t\tm.t.Error(\"Expected call to StateSwitcherMock.GetState\")\n\t\t\t}\n\n\t\t\tif m.SetPulsarFunc != nil && atomic.LoadUint64(&m.SetPulsarCounter) == 0 {\n\t\t\t\tm.t.Error(\"Expected call to StateSwitcherMock.SetPulsar\")\n\t\t\t}\n\n\t\t\tif m.SwitchToStateFunc != nil && atomic.LoadUint64(&m.SwitchToStateCounter) == 0 {\n\t\t\t\tm.t.Error(\"Expected call to StateSwitcherMock.SwitchToState\")\n\t\t\t}\n\n\t\t\tif m.setStateFunc != nil && atomic.LoadUint64(&m.setStateCounter) == 0 {\n\t\t\t\tm.t.Error(\"Expected call to StateSwitcherMock.setState\")\n\t\t\t}\n\n\t\t\tm.t.Fatalf(\"Some mocks were not called on time: %s\", timeout)\n\t\t\treturn\n\t\tdefault:\n\t\t\ttime.Sleep(time.Millisecond)\n\t\t}\n\t}\n}", "func (rw *RWMutex) AssertHeld() {\n\tif atomic.LoadInt32(&rw.wLocked) == 0 {\n\t\tpanic(\"mutex is not write locked\")\n\t}\n}", "func newLockBased() Interface {\n\tgate := &lockBased{}\n\tgate.mux.Lock()\n\treturn gate\n}", "func (rs *RedisService) getMutexName(system string, collection string) string {\n\treturn \"coordination:mutex#\" + system + \"_\" + collection\n}", "func (m *RWMutex) Lock() {\n\tatomic.AddInt64(&m.pendingWriters, 1)\n\tm.mutex.Lock()\n\tatomic.AddInt64(&m.writers, 1)\n\tatomic.AddInt64(&m.pendingWriters, -1)\n\n\tstackBufLen := RWMutexStackBufferLength()\n\n\tm.stateMutex.Lock()\n\tif len(m.stackBuf) < stackBufLen {\n\t\tm.stackBuf = make([]byte, stackBufLen)\n\t}\n\tn := runtime.Stack(m.stackBuf, false)\n\tm.lastLockStack = m.stackBuf[:n]\n\tm.stateMutex.Unlock()\n}", "func Blocking() MutexOpts {\n\treturn MutexOpts{\n\t\tExpiry: 8 * time.Second,\n\t\tTries: 32,\n\t\tDelay: 500 * time.Millisecond,\n\t\tFactor: 0.01,\n\t}\n}", "func (m *MockClient) Lock() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Lock\")\n}", "func TestMutexesMultipleLocks(t *testing.T) {\n\tn := 10\n\tm := newMutexes()\n\tvar (\n\t\tresult string\n\t\twg sync.WaitGroup\n\t)\n\tgo0 := make(chan bool)\n\tgo1 := make(chan bool)\n\tgo2 := make(chan bool)\n\tfor i := 0; i < n; i++ {\n\t\twg.Add(1)\n\t\tgo func(nr int) {\n\t\t\tdefer wg.Done()\n\t\t\t<-go1 // Will fire when go1 is closed.\n\t\t\tm.Lock(\"key\")\n\t\t\tdefer m.Unlock(\"key\")\n\t\t\tresult += strconv.Itoa(nr)\n\t\t}(i)\n\t}\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tm.Lock(\"key\")\n\t\tdefer m.Unlock(\"key\")\n\t\tgo0 <- true\n\t\t<-go2\n\t\tresult += \"F\"\n\t}()\n\t<-go0\n\tclose(go1)\n\tgo2 <- true\n\twg.Wait()\n\tt.Log(result)\n\tif len(result) != n+1 {\n\t\tt.Error(\"Some goroutines still haven't finished\")\n\t}\n\tif result[0:1] != \"F\" {\n\t\tt.Error(\"Locks were processed in the wrong order\")\n\t}\n\tif m.getItem(\"key\").locks != 0 {\n\t\tt.Error(\"Locks are still held\")\n\t}\n}", "func TestAcquiringLockHelperProcess(t *testing.T) {\n\tif os.Getenv(\"GO_WANT_HELPER_PROCESS\") != \"1\" {\n\t\treturn\n\t}\n\n\tfileName := os.Args[len(os.Args)-1]\n\tsh := newShellForTest(t)\n\n\tlog.Printf(\"Locking %s\", fileName)\n\tif _, err := sh.LockFile(fileName, time.Second*10); err != nil {\n\t\tos.Exit(1)\n\t}\n\n\tlog.Printf(\"Acquired lock %s\", fileName)\n\tc := make(chan struct{})\n\t<-c\n}", "func (m *RWMutex) Lock() {\n\tlocking.AddGLock(genericMarkIndex, -1)\n\tm.mu.Lock()\n}", "func Lock() {\n\tmutex.Lock()\n}", "func newProcessLocksAndIdles(env testEnv, t *testing.T) *exec.Cmd {\n\to := testHarnessOptions{\n\t\tconfig: env.mutexConfig,\n\t\tloopForever: true,\n\t}\n\ttestHarness := compileTestHarness(env, o, t)\n\n\t// Need to start test harness async. We need to be able to\n\t// test exactly when the harness acquires the mutex, otherwise\n\t// there is a race condition between the harness and the unit\n\t// test when acquiring the mutex.\n\tstdout := bytes.NewBuffer(nil)\n\ttestHarness.Stdout = stdout\n\tstderr := bytes.NewBuffer(nil)\n\ttestHarness.Stderr = stderr\n\n\terr := testHarness.Start()\n\tif err != nil {\n\t\tt.Fatalf(\"test harness failed to start - %s\", err.Error())\n\t}\n\n\tstart := time.Now()\n\tfor {\n\t\tif testHarness.ProcessState != nil && testHarness.ProcessState.Exited() {\n\t\t\tt.Fatalf(\"test harness exited unexpectedly - output: %s\", stderr.String())\n\t\t}\n\t\tif stdout.Len() > 0 {\n\t\t\tbreak\n\t\t}\n\t\tduration := time.Since(start)\n\t\tif duration >= 5 * time.Second {\n\t\t\ttestHarness.Process.Kill()\n\t\t\tt.Fatalf(\"test harness failed to lock the mutex after %s - output: %s\",\n\t\t\t\tduration.String(), stderr.String())\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t}\n\n\treturn testHarness\n}", "func TestCancel(t *testing.T) {\n\tvar (\n\t\tmu ctxsync.Mutex\n\t\twg sync.WaitGroup\n\t\terrWaiter error\n\t)\n\trequire.NoError(t, mu.Lock(context.Background()))\n\tctx, cancel := context.WithCancel(context.Background())\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tif errWaiter = mu.Lock(ctx); errWaiter != nil {\n\t\t\treturn\n\t\t}\n\t\tmu.Unlock()\n\t}()\n\tcancel()\n\twg.Wait()\n\tmu.Unlock()\n\t// Verify that we can still lock and unlock after the canceled attempt.\n\tif assert.NoError(t, mu.Lock(context.Background())) {\n\t\tmu.Unlock()\n\t}\n\t// Verify that Lock returned the expected non-nil error from the canceled\n\t// attempt.\n\tassert.True(t, errors.Is(errors.Canceled, errWaiter), \"expected errors.Canceled\")\n}", "func (rs *RedisService) doLock(system string, collection string, options ...redsync.Option) (storages.Lock, error) {\n\tidentifier := rs.getMutexName(system, collection)\n\n\tmutex := rs.redsync.NewMutex(identifier, options...)\n\tif err := mutex.LockContext(rs.ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\tproxy := &MutexProxy{mutex: mutex}\n\tlock := storages.NewRetryableLock(identifier, proxy, nil, nil, 5)\n\n\trs.selfmutex.Lock()\n\trs.unlockMe[identifier] = lock\n\trs.selfmutex.Unlock()\n\n\treturn lock, nil\n}", "func TestLockAndUnlock(t *testing.T) {\n\tf, err := ioutil.TempFile(\"\", \"lock\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tf.Close()\n\tdefer func() {\n\t\terr = os.Remove(f.Name())\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}()\n\n\t// lock the file\n\tl, err := LockedOpenFile(f.Name(), os.O_WRONLY, 0600)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// unlock the file\n\tif err = l.Close(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// try lock the unlocked file\n\tdupl, err := LockedOpenFile(f.Name(), os.O_WRONLY|os.O_CREATE, 0600)\n\tif err != nil {\n\t\tt.Errorf(\"err = %v, want %v\", err, nil)\n\t}\n\n\t// blocking on locked file\n\tlocked := make(chan struct{}, 1)\n\tgo func() {\n\t\tbl, blerr := LockedOpenFile(f.Name(), os.O_WRONLY, 0600)\n\t\tif blerr != nil {\n\t\t\tt.Error(blerr)\n\t\t\treturn\n\t\t}\n\t\tlocked <- struct{}{}\n\t\tif blerr = bl.Close(); blerr != nil {\n\t\t\tt.Error(blerr)\n\t\t\treturn\n\t\t}\n\t}()\n\n\tselect {\n\tcase <-locked:\n\t\tt.Error(\"unexpected unblocking\")\n\tcase <-time.After(100 * time.Millisecond):\n\t}\n\n\t// unlock\n\tif err = dupl.Close(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// the previously blocked routine should be unblocked\n\tselect {\n\tcase <-locked:\n\tcase <-time.After(1 * time.Second):\n\t\tt.Error(\"unexpected blocking\")\n\t}\n}", "func TestControlLockMain(t *testing.T) {\n\t// create cli app for testing\n\tapp := cli.NewApp()\n\tapp.Commands = []cli.Command{controlCmd}\n\n\t// start test server\n\ttestServer := StartTestServer(t, \"XL\")\n\n\t// schedule cleanup at the end\n\tdefer testServer.Stop()\n\n\t// initializing the locks.\n\tinitNSLock(false)\n\t// set debug lock info to `nil` so that other tests do not see\n\t// such modified env settings.\n\tdefer func() {\n\t\tnsMutex.debugLockMap = nil\n\t}()\n\n\t// fetch http server endpoint\n\turl := testServer.Server.URL\n\n\t// create args to call\n\targs := []string{\"./minio\", \"control\", \"lock\", url}\n\n\t// run app\n\terr := app.Run(args)\n\tif err != nil {\n\t\tt.Errorf(\"Control-Lock-Main test failed with - %s\", err.Error())\n\t}\n}", "func testLockCountingTo(index int) (lock *countLock) {\n\treturn &countLock{nextIndex: 0, successIndex: index}\n}", "func Test_BlockedLock(t *testing.T) {\n\tkey := \"Test_BlockedLock\"\n\tconn, err := redigo.Dial(\"tcp\", RedisHost)\n\n\tif err != nil {\n\t\tt.Error(fmt.Sprintf(\"redigo.Dial failure [%s]\", err))\n\t}\n\n\tlock1 := New(conn, key, 2001, 2000)\n\n\tstatus, err := lock1.Lock()\n\tdefer lock1.UnlockIfLocked()\n\n\tif err != nil {\n\t\tt.Error(fmt.Sprintf(\"lock operation failed [%s]\", err))\n\t}\n\n\tif !status {\n\t\tt.Error(\"lock acquisition failed\")\n\t}\n\n\tlock2 := New(conn, key, 1000)\n\n\tstatus, err = lock2.Lock()\n\tdefer lock2.UnlockIfLocked()\n\n\tif err != nil {\n\t\tt.Error(fmt.Sprintf(\"lock operation failed [%s]\", err))\n\t}\n\n\tif status {\n\t\tt.Error(\"lock acquisition succeeded\")\n\t}\n}", "func (m *IndexBucketModifierMock) MinimockWait(timeout time.Duration) {\n\ttimeoutCh := time.After(timeout)\n\tfor {\n\t\tok := true\n\t\tok = ok && m.SetBucketFinished()\n\n\t\tif ok {\n\t\t\treturn\n\t\t}\n\n\t\tselect {\n\t\tcase <-timeoutCh:\n\n\t\t\tif !m.SetBucketFinished() {\n\t\t\t\tm.t.Error(\"Expected call to IndexBucketModifierMock.SetBucket\")\n\t\t\t}\n\n\t\t\tm.t.Fatalf(\"Some mocks were not called on time: %s\", timeout)\n\t\t\treturn\n\t\tdefault:\n\t\t\ttime.Sleep(time.Millisecond)\n\t\t}\n\t}\n}", "func (service *LockServiceMock) Lock(resourceID string) bool {\n\treturn service.defaultValue\n}", "func NonBlocking() MutexOpts {\n\treturn MutexOpts{\n\t\tExpiry: 8 * time.Second,\n\t\tTries: 1,\n\t\tDelay: 10 * time.Millisecond,\n\t\tFactor: 0.01,\n\t}\n}", "func NewSynchronizable(t interface {\n\tmock.TestingT\n\tCleanup(func())\n}) *Synchronizable {\n\tmock := &Synchronizable{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "func TestNamespaceLockTest(t *testing.T) {\n\tisDistXL := false\n\tinitNSLock(isDistXL)\n\t// List of test cases.\n\ttestCases := []struct {\n\t\tlk func(s1, s2, s3 string, t time.Duration) bool\n\t\tunlk func(s1, s2, s3 string)\n\t\trlk func(s1, s2, s3 string, t time.Duration) bool\n\t\trunlk func(s1, s2, s3 string)\n\t\tlockedRefCount uint\n\t\tunlockedRefCount uint\n\t\tshouldPass bool\n\t}{\n\t\t{\n\t\t\tlk: globalNSMutex.Lock,\n\t\t\tunlk: globalNSMutex.Unlock,\n\t\t\tlockedRefCount: 1,\n\t\t\tunlockedRefCount: 0,\n\t\t\tshouldPass: true,\n\t\t},\n\t\t{\n\t\t\trlk: globalNSMutex.RLock,\n\t\t\trunlk: globalNSMutex.RUnlock,\n\t\t\tlockedRefCount: 4,\n\t\t\tunlockedRefCount: 2,\n\t\t\tshouldPass: true,\n\t\t},\n\t\t{\n\t\t\trlk: globalNSMutex.RLock,\n\t\t\trunlk: globalNSMutex.RUnlock,\n\t\t\tlockedRefCount: 1,\n\t\t\tunlockedRefCount: 0,\n\t\t\tshouldPass: true,\n\t\t},\n\t}\n\n\t// Run all test cases.\n\n\t// Write lock tests.\n\ttestCase := testCases[0]\n\tif !testCase.lk(\"a\", \"b\", \"c\", 60*time.Second) { // lock once.\n\t\tt.Fatalf(\"Failed to acquire lock\")\n\t}\n\tnsLk, ok := globalNSMutex.lockMap[nsParam{\"a\", \"b\"}]\n\tif !ok && testCase.shouldPass {\n\t\tt.Errorf(\"Lock in map missing.\")\n\t}\n\t// Validate locked ref count.\n\tif testCase.lockedRefCount != nsLk.ref && testCase.shouldPass {\n\t\tt.Errorf(\"Test %d fails, expected to pass. Wanted ref count is %d, got %d\", 1, testCase.lockedRefCount, nsLk.ref)\n\t}\n\ttestCase.unlk(\"a\", \"b\", \"c\") // unlock once.\n\tif testCase.unlockedRefCount != nsLk.ref && testCase.shouldPass {\n\t\tt.Errorf(\"Test %d fails, expected to pass. Wanted ref count is %d, got %d\", 1, testCase.unlockedRefCount, nsLk.ref)\n\t}\n\t_, ok = globalNSMutex.lockMap[nsParam{\"a\", \"b\"}]\n\tif ok && !testCase.shouldPass {\n\t\tt.Errorf(\"Lock map found after unlock.\")\n\t}\n\n\t// Read lock tests.\n\ttestCase = testCases[1]\n\tif !testCase.rlk(\"a\", \"b\", \"c\", 60*time.Second) { // lock once.\n\t\tt.Fatalf(\"Failed to acquire first read lock\")\n\t}\n\tif !testCase.rlk(\"a\", \"b\", \"c\", 60*time.Second) { // lock second time.\n\t\tt.Fatalf(\"Failed to acquire second read lock\")\n\t}\n\tif !testCase.rlk(\"a\", \"b\", \"c\", 60*time.Second) { // lock third time.\n\t\tt.Fatalf(\"Failed to acquire third read lock\")\n\t}\n\tif !testCase.rlk(\"a\", \"b\", \"c\", 60*time.Second) { // lock fourth time.\n\t\tt.Fatalf(\"Failed to acquire fourth read lock\")\n\t}\n\tnsLk, ok = globalNSMutex.lockMap[nsParam{\"a\", \"b\"}]\n\tif !ok && testCase.shouldPass {\n\t\tt.Errorf(\"Lock in map missing.\")\n\t}\n\t// Validate locked ref count.\n\tif testCase.lockedRefCount != nsLk.ref && testCase.shouldPass {\n\t\tt.Errorf(\"Test %d fails, expected to pass. Wanted ref count is %d, got %d\", 1, testCase.lockedRefCount, nsLk.ref)\n\t}\n\n\ttestCase.runlk(\"a\", \"b\", \"c\") // unlock once.\n\ttestCase.runlk(\"a\", \"b\", \"c\") // unlock second time.\n\tif testCase.unlockedRefCount != nsLk.ref && testCase.shouldPass {\n\t\tt.Errorf(\"Test %d fails, expected to pass. Wanted ref count is %d, got %d\", 2, testCase.unlockedRefCount, nsLk.ref)\n\t}\n\t_, ok = globalNSMutex.lockMap[nsParam{\"a\", \"b\"}]\n\tif !ok && testCase.shouldPass {\n\t\tt.Errorf(\"Lock map not found.\")\n\t}\n\n\t// Read lock 0 ref count.\n\ttestCase = testCases[2]\n\tif !testCase.rlk(\"a\", \"c\", \"d\", 60*time.Second) { // lock once.\n\t\tt.Fatalf(\"Failed to acquire read lock\")\n\t}\n\n\tnsLk, ok = globalNSMutex.lockMap[nsParam{\"a\", \"c\"}]\n\tif !ok && testCase.shouldPass {\n\t\tt.Errorf(\"Lock in map missing.\")\n\t}\n\t// Validate locked ref count.\n\tif testCase.lockedRefCount != nsLk.ref && testCase.shouldPass {\n\t\tt.Errorf(\"Test %d fails, expected to pass. Wanted ref count is %d, got %d\", 3, testCase.lockedRefCount, nsLk.ref)\n\t}\n\ttestCase.runlk(\"a\", \"c\", \"d\") // unlock once.\n\tif testCase.unlockedRefCount != nsLk.ref && testCase.shouldPass {\n\t\tt.Errorf(\"Test %d fails, expected to pass. Wanted ref count is %d, got %d\", 3, testCase.unlockedRefCount, nsLk.ref)\n\t}\n\t_, ok = globalNSMutex.lockMap[nsParam{\"a\", \"c\"}]\n\tif ok && !testCase.shouldPass {\n\t\tt.Errorf(\"Lock map not found.\")\n\t}\n}", "func NewMutex() *Mutex {\n\treturn &Mutex{\n\t\tl: 0,\n\t}\n}", "func (f *fragment) handleMutex(rowID, columnID uint64) error {\n\tif existingRowID, found, err := f.mutexVector.Get(columnID); err != nil {\n\t\treturn errors.Wrap(err, \"getting mutex vector data\")\n\t} else if found && existingRowID != rowID {\n\t\tif _, err := f.unprotectedClearBit(existingRowID, columnID); err != nil {\n\t\t\treturn errors.Wrap(err, \"clearing mutex value\")\n\t\t}\n\t}\n\treturn nil\n}", "func (mu *RWMutex) Lock(timeout time.Duration) error {\n\treturn mu.lock(timeout, true)\n}", "func (onuTP *OnuUniTechProf) lockTpProcMutex() {\n\tonuTP.tpProcMutex.Lock()\n}", "func (r *MockRepoManager) mockUpdate() {\n\tr.mtx.Lock()\n\tdefer r.mtx.Unlock()\n\tr.updateCount++\n}", "func (g *Github) modLock() {\n\tg.modMutex.Lock()\n\tshouldWait := time.Second - time.Since(g.lastModRequest)\n\tif shouldWait > 0 {\n\t\tlog.Debugf(\"Waiting %s to not hit GitHub ratelimit\", shouldWait)\n\t\ttime.Sleep(shouldWait)\n\t}\n}", "func TestMutexConcurrent(t *testing.T) {\n\tvar mu sync.Mutex\n\tvar active uint\n\tvar completed uint\n\tok := true\n\n\tconst n = 10\n\tfor i := 0; i < n; i++ {\n\t\tj := i\n\t\tgo func() {\n\t\t\t// Delay a bit.\n\t\t\tfor k := j; k > 0; k-- {\n\t\t\t\truntime.Gosched()\n\t\t\t}\n\n\t\t\tmu.Lock()\n\n\t\t\t// Increment the active counter.\n\t\t\tactive++\n\n\t\t\tif active > 1 {\n\t\t\t\t// Multiple things are holding the lock at the same time.\n\t\t\t\tok = false\n\t\t\t} else {\n\t\t\t\t// Delay a bit.\n\t\t\t\tfor k := j; k < n; k++ {\n\t\t\t\t\truntime.Gosched()\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Decrement the active counter.\n\t\t\tactive--\n\n\t\t\t// This is completed.\n\t\t\tcompleted++\n\n\t\t\tmu.Unlock()\n\t\t}()\n\t}\n\n\t// Wait for everything to finish.\n\tvar done bool\n\tfor !done {\n\t\t// Wait a bit for other things to run.\n\t\truntime.Gosched()\n\n\t\t// Acquire the lock and check whether everything has completed.\n\t\tmu.Lock()\n\t\tdone = completed == n\n\t\tmu.Unlock()\n\t}\n\tif !ok {\n\t\tt.Error(\"lock held concurrently\")\n\t}\n}", "func (s *SysbenchMutex) flags(b *testing.B) []string {\n\tvar cmd []string\n\tcmd = append(cmd, s.baseFlags(b, false /* useEvents */)...)\n\tif s.Num > 0 {\n\t\tcmd = append(cmd, fmt.Sprintf(\"--mutex-num=%d\", s.Num))\n\t}\n\tif s.Loops > 0 {\n\t\tcmd = append(cmd, fmt.Sprintf(\"--mutex-loops=%d\", s.Loops))\n\t}\n\t// Sysbench does not respect --events for mutex tests. From [1]:\n\t// \"Here --time or --events are completely ignored. Sysbench always\n\t// runs one event per thread.\"\n\t// [1] https://tomfern.com/posts/sysbench-guide-1\n\tcmd = append(cmd, fmt.Sprintf(\"--mutex-locks=%d\", b.N))\n\treturn cmd\n}", "func MutexV2(scope *Scope, optional ...MutexV2Attr) (resource tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\tattrs := map[string]interface{}{}\n\tfor _, a := range optional {\n\t\ta(attrs)\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"MutexV2\",\n\n\t\tAttrs: attrs,\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (m *ShifterMock) MinimockWait(timeout time.Duration) {\n\ttimeoutCh := time.After(timeout)\n\tfor {\n\t\tok := true\n\t\tok = ok && m.ShiftFinished()\n\n\t\tif ok {\n\t\t\treturn\n\t\t}\n\n\t\tselect {\n\t\tcase <-timeoutCh:\n\n\t\t\tif !m.ShiftFinished() {\n\t\t\t\tm.t.Error(\"Expected call to ShifterMock.Shift\")\n\t\t\t}\n\n\t\t\tm.t.Fatalf(\"Some mocks were not called on time: %s\", timeout)\n\t\t\treturn\n\t\tdefault:\n\t\t\ttime.Sleep(time.Millisecond)\n\t\t}\n\t}\n}", "func LockOSThread() {\n}", "func Test_Lock(t *testing.T) {\n\tkey := \"Test_Lock\"\n\tconn, err := redigo.Dial(\"tcp\", RedisHost)\n\n\tif err != nil {\n\t\tt.Error(fmt.Sprintf(\"redigo.Dial failure [%s]\", err))\n\t}\n\n\tlock := New(conn, key)\n\n\tstatus, err := lock.Lock()\n\tdefer lock.UnlockIfLocked()\n\n\tif err != nil {\n\t\tt.Error(fmt.Sprintf(\"lock operation failed [%s]\", err))\n\t}\n\n\tif !status {\n\t\tt.Error(\"lock acquisition failed\")\n\t}\n}", "func (m *mutex) TryLock(ctx context.Context) error {\n\treturn (*semaphore.Weighted)(m).Acquire(ctx, 1)\n}", "func testNoNilTimeoutReplacement(ctx context.Context, t *testing.T, w *Wallet) {\n\terr := w.Unlock(ctx, testPrivPass, nil)\n\tif err != nil {\n\t\tt.Fatal(\"failed to unlock wallet\")\n\t}\n\ttimeChan := make(chan time.Time)\n\terr = w.Unlock(ctx, testPrivPass, timeChan)\n\tif err != nil {\n\t\tt.Fatal(\"failed to unlock wallet with time channel\")\n\t}\n\tselect {\n\tcase timeChan <- time.Time{}:\n\tcase <-time.After(100 * time.Millisecond):\n\t\tt.Fatal(\"time channel was not read in 100ms\")\n\t}\n\tif w.Locked() {\n\t\tt.Fatal(\"expected wallet to remain unlocked due to previous unlock without timeout\")\n\t}\n}", "func (rw *RWMutex) Lock() {\n\tnoteLock(unsafe.Pointer(rw))\n\trw.m.Lock()\n}", "func (*NoCopy) Lock() {}", "func (c Mutex) TryLock() bool {\n\tselect {\n\tcase <-c.ch:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "func New(\n\tctx context.Context,\n\tdb *sql.DB,\n\toptions ...MutexOption,\n) (*Mutex, error) {\n\tmo := initMutexOptions(options...)\n\tvar err error\n\tif mo.driver == nil {\n\t\tmo.driver, err = driver.ResolveDriver(ctx, db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif mo.createMissingTable {\n\t\terr = createMutexTableIfNotExists(ctx, db, mo.driver, mo.tableName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif !mo.delayAddMutexRow {\n\t\terr = mo.driver.CreateMutexEntryIfNotExists(ctx, db, mo.tableName, mo.mutexName)\n\t\tif err != nil {\n\t\t\t// mysql can fail on concurrent inserts :( so try one more time.\n\t\t\t// Error 1213: Deadlock found when trying to get lock; try restarting transaction\n\t\t\terr2 := mo.driver.CreateMutexEntryIfNotExists(ctx, db, mo.tableName, mo.mutexName)\n\t\t\tif err2 != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\thostname = \"unknown\"\n\t}\n\tif len(hostname) > driver.MaxHostnameLength {\n\t\thostname = hostname[:driver.MaxHostnameLength]\n\t}\n\tpid := os.Getpid()\n\n\treturn &Mutex{\n\t\toptions: mo,\n\t\tdb: db,\n\t\tlock: &sync.Mutex{},\n\t\thostname: hostname,\n\t\tpid: pid,\n\t\tlockerId: uuid.New().String(),\n\t}, nil\n}", "func Mock(fake string) func() {\n\tmutex.Lock()\n\tdefer mutex.Unlock()\n\torigin := backend\n\tbackend = fake\n\treturn func() { Mock(origin) }\n}", "func (m *InMemManager) Lock(ctx context.Context, token string) error {\n\tm.rw.RLock()\n\trw, ok := m.acqu[token]\n\tm.rw.RUnlock()\n\n\tif ok {\n\t\trw.Lock()\n\t\treturn nil\n\t}\n\n\tvar mutex sync.RWMutex\n\tmutex.Lock()\n\n\tif !m.setTokenMutex(token, &mutex) {\n\t\t// set operation failed, because the token now exists. Recursively call\n\t\t// ourself again. Next time we should end in OK and try to acquire the\n\t\t// correct mutex's lock.\n\t\treturn m.Lock(ctx, token)\n\t}\n\n\treturn nil\n}", "func (m *ParcelMock) MinimockWait(timeout time.Duration) {\n\ttimeoutCh := time.After(timeout)\n\tfor {\n\t\tok := true\n\t\tok = ok && m.AllowedSenderObjectAndRoleFinished()\n\t\tok = ok && m.ContextFinished()\n\t\tok = ok && m.DefaultRoleFinished()\n\t\tok = ok && m.DefaultTargetFinished()\n\t\tok = ok && m.DelegationTokenFinished()\n\t\tok = ok && m.GetCallerFinished()\n\t\tok = ok && m.GetSenderFinished()\n\t\tok = ok && m.GetSignFinished()\n\t\tok = ok && m.MessageFinished()\n\t\tok = ok && m.PulseFinished()\n\t\tok = ok && m.SetSenderFinished()\n\t\tok = ok && m.TypeFinished()\n\n\t\tif ok {\n\t\t\treturn\n\t\t}\n\n\t\tselect {\n\t\tcase <-timeoutCh:\n\n\t\t\tif !m.AllowedSenderObjectAndRoleFinished() {\n\t\t\t\tm.t.Error(\"Expected call to ParcelMock.AllowedSenderObjectAndRole\")\n\t\t\t}\n\n\t\t\tif !m.ContextFinished() {\n\t\t\t\tm.t.Error(\"Expected call to ParcelMock.Context\")\n\t\t\t}\n\n\t\t\tif !m.DefaultRoleFinished() {\n\t\t\t\tm.t.Error(\"Expected call to ParcelMock.DefaultRole\")\n\t\t\t}\n\n\t\t\tif !m.DefaultTargetFinished() {\n\t\t\t\tm.t.Error(\"Expected call to ParcelMock.DefaultTarget\")\n\t\t\t}\n\n\t\t\tif !m.DelegationTokenFinished() {\n\t\t\t\tm.t.Error(\"Expected call to ParcelMock.DelegationToken\")\n\t\t\t}\n\n\t\t\tif !m.GetCallerFinished() {\n\t\t\t\tm.t.Error(\"Expected call to ParcelMock.GetCaller\")\n\t\t\t}\n\n\t\t\tif !m.GetSenderFinished() {\n\t\t\t\tm.t.Error(\"Expected call to ParcelMock.GetSender\")\n\t\t\t}\n\n\t\t\tif !m.GetSignFinished() {\n\t\t\t\tm.t.Error(\"Expected call to ParcelMock.GetSign\")\n\t\t\t}\n\n\t\t\tif !m.MessageFinished() {\n\t\t\t\tm.t.Error(\"Expected call to ParcelMock.Message\")\n\t\t\t}\n\n\t\t\tif !m.PulseFinished() {\n\t\t\t\tm.t.Error(\"Expected call to ParcelMock.Pulse\")\n\t\t\t}\n\n\t\t\tif !m.SetSenderFinished() {\n\t\t\t\tm.t.Error(\"Expected call to ParcelMock.SetSender\")\n\t\t\t}\n\n\t\t\tif !m.TypeFinished() {\n\t\t\t\tm.t.Error(\"Expected call to ParcelMock.Type\")\n\t\t\t}\n\n\t\t\tm.t.Fatalf(\"Some mocks were not called on time: %s\", timeout)\n\t\t\treturn\n\t\tdefault:\n\t\t\ttime.Sleep(time.Millisecond)\n\t\t}\n\t}\n}", "func (mmLock *mIndexLockerMockLock) Expect(id insolar.ID) *mIndexLockerMockLock {\n\tif mmLock.mock.funcLock != nil {\n\t\tmmLock.mock.t.Fatalf(\"IndexLockerMock.Lock mock is already set by Set\")\n\t}\n\n\tif mmLock.defaultExpectation == nil {\n\t\tmmLock.defaultExpectation = &IndexLockerMockLockExpectation{}\n\t}\n\n\tmmLock.defaultExpectation.params = &IndexLockerMockLockParams{id}\n\tfor _, e := range mmLock.expectations {\n\t\tif minimock.Equal(e.params, mmLock.defaultExpectation.params) {\n\t\t\tmmLock.mock.t.Fatalf(\"Expectation set by When has same params: %#v\", *mmLock.defaultExpectation.params)\n\t\t}\n\t}\n\n\treturn mmLock\n}", "func mockNeverRun() bool { return false }", "func (oo *OmciCC) RLockMutexMonReq() {\n\too.mutexMonReq.RLock()\n}", "func MutexNewLocker() sync.Locker {\n\treturn new(sync.Mutex)\n}", "func futexsleep(addr *uint32, val uint32, ns int64)", "func (s *MockManagedThread) SuspendUnsafe() {}", "func TestMultiInstanceRace(t *testing.T) {\n\tt.Skipf(\"Skipping %v until file lock is implemented\", t.Name())\n\tcli := ce.NewContainerClient()\n\tqmsharedlogs := createVolume(t, cli, \"qmsharedlogs\")\n\tdefer removeVolume(t, cli, qmsharedlogs)\n\tqmshareddata := createVolume(t, cli, \"qmshareddata\")\n\tdefer removeVolume(t, cli, qmshareddata)\n\n\tqmsChannel := make(chan QMChan)\n\n\tgo singleMultiInstanceQueueManager(t, cli, qmsharedlogs, qmshareddata, qmsChannel)\n\tgo singleMultiInstanceQueueManager(t, cli, qmsharedlogs, qmshareddata, qmsChannel)\n\n\tqm1a := <-qmsChannel\n\tif qm1a.Error != nil {\n\t\tt.Fatal(qm1a.Error)\n\t}\n\n\tqm1b := <-qmsChannel\n\tif qm1b.Error != nil {\n\t\tt.Fatal(qm1b.Error)\n\t}\n\n\tqm1aId, qm1aData := qm1a.QMId, qm1a.QMData\n\tqm1bId, qm1bData := qm1b.QMId, qm1b.QMData\n\n\tdefer removeVolume(t, cli, qm1aData)\n\tdefer removeVolume(t, cli, qm1bData)\n\tdefer cleanContainer(t, cli, qm1aId)\n\tdefer cleanContainer(t, cli, qm1bId)\n\n\twaitForReady(t, cli, qm1aId)\n\twaitForReady(t, cli, qm1bId)\n\n\terr, _, _ := getActiveStandbyQueueManager(t, cli, qm1aId, qm1bId)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "func initNSLock(isDistXL bool) {\n\tglobalNSMutex = newNSLock(isDistXL)\n}", "func (m Mutex2[T]) TryLock() resultext.Result[MutexGuard[T, *sync.Mutex], struct{}] {\n\tif m.m.TryLock() {\n\t\treturn resultext.Ok[MutexGuard[T, *sync.Mutex], struct{}](MutexGuard[T, *sync.Mutex]{\n\t\t\tm: m.m,\n\t\t\tT: m.value,\n\t\t})\n\t} else {\n\t\treturn resultext.Err[MutexGuard[T, *sync.Mutex], struct{}](struct{}{})\n\t}\n}", "func (this *UserService) MatterLock(userUuid string) {\n\n\tcacheItem, err := this.locker.Value(userUuid)\n\tif err != nil {\n\t\tthis.logger.Error(\"error while get cache\" + err.Error())\n\t}\n\n\tif cacheItem != nil && cacheItem.Data() != nil {\n\t\tpanic(result.BadRequest(\"file is being operating, retry later\"))\n\t}\n\n\tduration := 12 * time.Hour\n\tthis.locker.Add(userUuid, duration, true)\n}", "func (db *TriasDB) Mutex() *sync.Mutex {\n\treturn &(db.mtx)\n}", "func (m *IndexLockerMock) MinimockWait(timeout mm_time.Duration) {\n\ttimeoutCh := mm_time.After(timeout)\n\tfor {\n\t\tif m.minimockDone() {\n\t\t\treturn\n\t\t}\n\t\tselect {\n\t\tcase <-timeoutCh:\n\t\t\tm.MinimockFinish()\n\t\t\treturn\n\t\tcase <-mm_time.After(10 * mm_time.Millisecond):\n\t\t}\n\t}\n}", "func (a *API) MutexProfile(file string, nsec uint) error {\n\ta.logger.Debug(\"debug_mutexProfile\", \"file\", file, \"nsec\", nsec)\n\truntime.SetMutexProfileFraction(1)\n\ttime.Sleep(time.Duration(nsec) * time.Second)\n\tdefer runtime.SetMutexProfileFraction(0)\n\treturn writeProfile(\"mutex\", file, a.logger)\n}", "func TestConcurrencyLimit(t *testing.T) {\n\tt.Parallel()\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tt.Cleanup(cancel)\n\n\tconfig := Config{MaxConcurrency: 4}\n\tcountdown := NewCountdown(config.MaxConcurrency * 2)\n\tprocess := NewMockEventsProcess(ctx, t, config, func(ctx context.Context, event types.Event) error {\n\t\tdefer countdown.Decrement()\n\t\ttime.Sleep(time.Second)\n\t\treturn trace.Wrap(ctx.Err())\n\t})\n\n\ttimeBefore := time.Now()\n\tfor i := 0; i < config.MaxConcurrency; i++ {\n\t\tresource, err := types.NewAccessRequest(fmt.Sprintf(\"REQ-%v\", i+1), \"foo\", \"admin\")\n\t\trequire.NoError(t, err)\n\n\t\tfor j := 0; j < 2; j++ {\n\t\t\tprocess.Events.Fire(types.Event{Type: types.OpPut, Resource: resource})\n\t\t}\n\t}\n\trequire.NoError(t, countdown.Wait(ctx))\n\n\ttimeAfter := time.Now()\n\tassert.InDelta(t, 4*time.Second, timeAfter.Sub(timeBefore), float64(750*time.Millisecond))\n}", "func (m *Mutex) Lock() {\n\t// Fast path: grab unlocked mutex.\n\tif atomic.CompareAndSwapInt32(&m.state, 0, mutexLocked) {\n\t\tif raceenabled {\n\t\t\traceAcquire(unsafe.Pointer(m))\n\t\t}\n\t\treturn\n\t}\n\n\tawoke := false\n\tfor {\n\t\told := m.state\n\t\tnew := old | mutexLocked\n\t\tif old&mutexLocked != 0 {\n\t\t\tnew = old + 1<<mutexWaiterShift\n\t\t}\n\t\tif awoke {\n\t\t\t// The goroutine has been woken from sleep,\n\t\t\t// so we need to reset the flag in either case.\n\t\t\tnew &^= mutexWoken\n\t\t}\n\t\tif atomic.CompareAndSwapInt32(&m.state, old, new) {\n\t\t\tif old&mutexLocked == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\truntime_Semacquire(&m.sema)\n\t\t\tawoke = true\n\t\t}\n\t}\n\n\tif raceenabled {\n\t\traceAcquire(unsafe.Pointer(m))\n\t}\n}", "func writersLock() {\n\tlog.Info(\"Acquiring lock\")\n\tmutex.Lock()\n\tlog.Info(\"Acquired\")\n}", "func testTimeoutReplacement(ctx context.Context, t *testing.T, w *Wallet) {\n\ttimeChan1 := make(chan time.Time)\n\ttimeChan2 := make(chan time.Time)\n\terr := w.Unlock(ctx, testPrivPass, timeChan1)\n\tif err != nil {\n\t\tt.Fatal(\"failed to unlock wallet\")\n\t}\n\terr = w.Unlock(ctx, testPrivPass, timeChan2)\n\tif err != nil {\n\t\tt.Fatal(\"failed to unlock wallet\")\n\t}\n\ttimeChan2 <- time.Time{}\n\ttime.Sleep(100 * time.Millisecond) // Allow time for lock in background\n\tif !w.Locked() {\n\t\tt.Fatal(\"wallet did not lock using replacement timeout\")\n\t}\n\tselect {\n\tcase timeChan1 <- time.Time{}:\n\tdefault:\n\t\tt.Fatal(\"previous timeout was not read in background\")\n\t}\n}", "func (*S) Lock() {}", "func TestSetupReplaceMock(t *testing.T) {\n\tt.SkipNow()\n\tstudent, mocks, err := MockCluster(false, nil, t)\n\tif err != nil {\n\t\tt.Error(\"Couldn't set up mock cluster\", err)\n\t}\n\n\t// Create a new impl for an rpc function\n\tdenyVote := func(ctx context.Context, req *RequestVoteRequest) (*RequestVoteReply, error) {\n\t\treturn &RequestVoteReply{Term: req.Term, VoteGranted: false}, nil\n\t}\n\n\t// replace the existing impl\n\tmocks[0].RequestVote = denyVote\n\tmocks[1].RequestVote = denyVote\n\n\tmocks[0].JoinCluster()\n\tmocks[1].JoinCluster()\n\n\ttime.Sleep(DefaultConfig().ElectionTimeout * 4)\n\n\tt.Log(\"Student node is:\", student.State)\n\n\tif student.State != CANDIDATE_STATE {\n\t\tt.Error(\"student state was not candidate, was:\", student.State)\n\t}\n\n\t// test as part of an rpc function\n\tmocks[0].RequestVote = func(ctx context.Context, req *RequestVoteRequest) (*RequestVoteReply, error) {\n\t\tt.Logf(\"Mock 0 recieved request vote: last_idx: %v term: %v\", req.GetLastLogIndex(), req.GetLastLogTerm())\n\t\tif req.GetLastLogIndex() != 0 || req.GetLastLogTerm() != 0 {\n\t\t\tt.Errorf(\"Student node failed to request vote correctly: last_idx: %v term: %v\", req.GetLastLogIndex(), req.GetLastLogTerm())\n\t\t}\n\n\t\tif term := student.GetCurrentTerm(); req.GetTerm() != term {\n\t\t\tt.Errorf(\"Student node sent the wrong term: (sent %v, expecting %v)\", req.GetTerm(), term)\n\t\t}\n\t\treturn denyVote(ctx, req)\n\t}\n\n\ttime.Sleep(DefaultConfig().ElectionTimeout * 5)\n}", "func newDMutex() *dMutex {\n\treturn &dMutex{\n\t\tmutexes: make(map[interface{}]*cMutex),\n\t}\n}" ]
[ "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.5431887", "0.5423051", "0.5410029", "0.53661954", "0.53642726", "0.53623605", "0.53366953", "0.5327089", "0.53102875", "0.53081894", "0.5264059", "0.5263767", "0.52633446", "0.5257197", "0.5256435", "0.5253836", "0.52527696", "0.5250891", "0.52205706", "0.5217453", "0.5214083", "0.52137375", "0.52127683", "0.5199288", "0.51987976", "0.51963454", "0.5191593", "0.5190282", "0.5183704", "0.5170635", "0.516708", "0.5165786", "0.51550627", "0.5144979", "0.5144405", "0.5143605", "0.5140007", "0.51352566", "0.5134326", "0.5124014", "0.5123573", "0.5110058", "0.5098515", "0.50838584", "0.50795174", "0.5079142", "0.50771517", "0.507552", "0.5073332", "0.5066645", "0.50599277", "0.50572777", "0.5051672", "0.504012", "0.5035266", "0.5030234", "0.5030046", "0.50279546", "0.5027618", "0.5021701", "0.5011284", "0.50083154", "0.5005749", "0.50041807", "0.5000428", "0.49985266", "0.49969384", "0.49945077", "0.4979575", "0.49693754", "0.49647155", "0.49637008", "0.49607912", "0.49572915", "0.49425372", "0.49370012", "0.49358723", "0.4935243", "0.49329865" ]
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) string {\n\treturn strings.ToLower(str)\n}", "func filterLower(ctx stick.Context, val stick.Value, args ...stick.Value) stick.Value {\n\treturn strings.ToLower(stick.CoerceString(val))\n}", "func (s String) GoLowerCase() string {\n\treturn gocase.To(strcase.ToLowerCamel(string(s)))\n}", "func IsLowerCase(str string) bool {\n\tif IsNull(str) {\n\t\treturn true\n\t}\n\treturn str == strings.ToLower(str)\n}", "func ToLower(operand string) string { return strings.ToLower(operand) }", "func (g *Generator) toLowerCase() {\n\tfor _, runeValue := range g.Input {\n\t\tg.lowerCased = g.lowerCased + string(unicode.ToLower(runeValue))\n\t}\n\n\tg.lowerCased = helpers.CleanString(g.lowerCased)\n}", "func ToLower(r rune) rune", "func StrLower(s string) string {\n\treturn strings.ToLower(s)\n}", "func TokenizeLowerCase(s string) []string {\n\ttokens := Tokenize(s)\n\tfor i := range tokens {\n\t\ttokens[i] = strings.ToLower(tokens[i])\n\t}\n\treturn tokens\n}", "func (a AssertableString) IsLowerCase() AssertableString {\n\ta.t.Helper()\n\tif !a.actual.IsLowerCase() {\n\t\ta.t.Error(shouldBeLowerCase(a.actual))\n\t}\n\treturn a\n}", "func toLowerCase(value string) (interface{}, bool) {\n\treturn strings.ToLower(value), false\n}", "func LowerCase(str string) bool {\n\tif len(str) == 0 {\n\t\treturn true\n\t}\n\treturn str == strings.ToLower(str)\n}", "func toLower(word string) (string, error) {\n\t// Builder pattern was taken from `strings.ToLower()`\n\tvar b strings.Builder\n\tb.Grow(len(word))\n\n\tfor _, r := range word {\n\t\tif !alphabetic(r) {\n\t\t\treturn \"\", fmt.Errorf(\"word `%s`: %w\", word, ErrUnexpectedCharacters)\n\t\t}\n\t\tb.WriteByte(byte(unicode.ToLower(r)))\n\t}\n\n\treturn b.String(), nil\n}", "func toLower(tk token.Token) token.Token {\n\ts := strings.ToLower(tk.Text())\n\treturn token.UpdateText(tk, s)\n}", "func (t Type) GoLowerCase() string {\n\treturn gocase.To(strcase.ToLowerCamel(string(t)))\n}", "func ToLower() (desc string, f predicate.TransformFunc) {\n\tdesc = \"ToLower({})\"\n\tf = func(v interface{}) (r interface{}, ctx []predicate.ContextValue, err error) {\n\t\ts, ok := v.(string)\n\t\tif !ok {\n\t\t\treturn nil, nil, fmt.Errorf(\n\t\t\t\t\"value of type '%T' cannot be transformed to lowercase\", v)\n\t\t}\n\t\ts = strings.ToLower(s)\n\t\treturn s, []predicate.ContextValue{\n\t\t\t{Name: \"lower\", Value: s, Pre: false},\n\t\t}, nil\n\t}\n\treturn\n}", "func ToLowercase(str []byte) []byte {\n\tfor i, s := range str {\n\t\tif s > 64 && s < 91 {\n\t\t\tstr[i] = s + 32\n\t\t}\n\t}\n\treturn str\n}", "func (s *Stringish) ToLower() *Stringish {\n\ts.str = strings.ToLower(s.str)\n\treturn s\n}", "func FirstToLower(in string) string {\n\tif in == \"\" {\n\t\treturn in\n\t}\n\tr, size := utf8.DecodeRuneInString(in)\n\tif r == utf8.RuneError {\n\t\treturn in\n\t}\n\treturn string(unicode.ToLower(r)) + in[size:]\n}", "func toLowerCamelCase(s string) string {\n\treturn toCamelInitCase(s, false)\n}", "func HasLowerCase(str string) bool {\n\treturn regexp.MustCompile(PatternHasLowerCase).MatchString(str)\n}", "func (f *StringSetFilter) ToLower() *StringSetFilter {\r\n\tf.strcase = STRING_LOWERCASE\r\n\treturn f\r\n}", "func ToLowerSnakeCase(s string) string {\n\treturn strings.ToLower(ToSnakeCase(s))\n}", "func ToLowerCamelCase(in string) string {\n\tout := toCamelCase([]rune(in))\n\tlength := len(out)\n\tfor i := 0; i < length; i++ {\n\t\tisUpper := unicode.IsUpper(out[i])\n\t\tif isUpper && (i == 0 || i+1 == length || unicode.IsUpper(out[i+1])) {\n\t\t\tout[i] -= 'A' - 'a'\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n\treturn string(out)\n}", "func (s *Str) ToLower() *Str {\n\ts.val = strings.ToLower(s.val)\n\treturn s\n}", "func LowerCamelCase(s string) string {\n\tif s == \"\" {\n\t\treturn \"\"\n\t}\n\trunes := []rune(s)\n\treturn string(append([]rune{unicode.ToLower(runes[0])}, runes[1:]...))\n}", "func HasLowerCase(s string) bool {\n\tif s == \"\" {\n\t\treturn false\n\t}\n\treturn rxHasLowerCase.MatchString(s)\n}", "func IsLowercase(s string) bool {\n\tif s == \"\" {\n\t\treturn false\n\t}\n\treturn strings.ToLower(s) == s\n}", "func HasLowerCase(str string) bool {\n\tif IsNull(str) {\n\t\treturn true\n\t}\n\treturn rxHasLowerCase.MatchString(str)\n}", "func FirstLower(s string) string {\n\treturn strings.ToLower(string(s[0])) + s[1:]\n}", "func lowerPrefix(s string) (lower string) {\n\tfor pos, char := range s {\n\t\tif unicode.IsUpper(char) {\n\t\t\tlower = lower + string(unicode.ToLower(char))\n\t\t} else {\n\t\t\tif pos > 1 {\n\t\t\t\tlower = lower[:len(lower)-1] + s[pos-1:]\n\t\t\t} else {\n\t\t\t\tlower = lower + s[pos:]\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "func IsLower(r rune) bool", "func isLowercase(fl FieldLevel) bool {\n\tfield := fl.Field()\n\n\tif field.Kind() == reflect.String {\n\t\tif field.String() == \"\" {\n\t\t\treturn false\n\t\t}\n\t\treturn field.String() == strings.ToLower(field.String())\n\t}\n\n\tpanic(fmt.Sprintf(\"Bad field type %T\", field.Interface()))\n}", "func lowerInitial(str string) string {\n\tfor i, v := range str {\n\t\treturn string(unicode.ToLower(v)) + str[i+1:]\n\t}\n\treturn \"\"\n}", "func LowerSnakeCase(s string) string {\n\tparts := []string{}\n\tfor _, part := range SplitSymbol(s) {\n\t\tif part == \"\" {\n\t\t\tparts = append(parts, \"_\")\n\t\t\tcontinue\n\t\t}\n\t\tparts = append(parts, strings.ToLower(part))\n\t}\n\treturn strings.Join(parts, \"_\")\n}", "func filterToLower(b byte) byte {\n\n\tif b >= 'A' && b <= 'Z' {\n\t\treturn 'a' + (b - 'A')\n\t} else if b >= 'a' && b <= 'z' {\n\t\treturn b\n\t} else {\n\t\treturn ' ' // binary etc converted to space\n\t}\n}", "func LowerFirst(v string) string {\n\tfor i, r := range v { // run loop to get first rune.\n\t\treturn string(unicode.ToLower(r)) + v[i+1:]\n\t}\n\n\treturn \"\"\n}", "func ToLowerFirst(str string) string {\n\tfor i, v := range str {\n\t\treturn string(unicode.ToLower(v)) + str[i+1:]\n\t}\n\treturn str\n}", "func (t Level) Lowercase() string {\n\tswitch t {\n\tcase LevelTrace:\n\t\treturn \"trace\"\n\tcase LevelDebug:\n\t\treturn \"debug\"\n\tcase LevelInfo:\n\t\treturn \"info\"\n\tcase LevelWarn:\n\t\treturn \"warn\"\n\tcase LevelError:\n\t\treturn \"error\"\n\tcase LevelOut:\n\t\treturn \"out\"\n\tdefault:\n\t\treturn \"<unknown>\"\n\t}\n}", "func ToLowerSnake(s string) (string, bool) {\n\tsnake := strcase.ToSnake(strings.ToLower(s))\n\treturn snake, s == snake\n}", "func ToLowerCamel(s string) string {\n\treturn snaker(s, rune(0), unicode.ToLower, unicode.ToUpper, noop)\n}", "func firstLowercase(s string) string {\n\ta := []rune(s)\n\ta[0] = unicode.ToLower(a[0])\n\treturn string(a)\n}", "func LowerFirst(s string) string {\n\tif len(s) == 0 {\n\t\treturn \"\"\n\t}\n\tc := s[0]\n\tif ('A' <= c) && (c <= 'Z') {\n\t\treturn string(rune(int(c)+32)) + SubString(s, 1, len(s)-1)\n\t}\n\treturn s\n}", "func StringLower(scope *Scope, input tf.Output, optional ...StringLowerAttr) (output tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\tattrs := map[string]interface{}{}\n\tfor _, a := range optional {\n\t\ta(attrs)\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"StringLower\",\n\t\tInput: []tf.Input{\n\t\t\tinput,\n\t\t},\n\t\tAttrs: attrs,\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (t *StringDataType) ToLower() *StringDataType {\n\treturn t.Formatter(func(s string) string {\n\t\treturn strings.ToLower(s)\n\t})\n}", "func ToLower(rune int) int {\n\tif rune < 0x80 {\t// quick ASCII check\n\t\tif 'A' <= rune && rune <= 'Z' {\n\t\t\trune += 'a' - 'A'\n\t\t}\n\t\treturn rune;\n\t}\n\treturn To(LowerCase, rune);\n}", "func ToLower(v interface{}) {\n\tif !mustbePtr(v) {\n\t\tfmt.Printf(\"ToLower param(%s) not type of pointer\\n\",\n\t\t\treflect.ValueOf(v).Kind().String())\n\t\treturn\n\t}\n\t// must be pointer\n\tvalue := reflect.ValueOf(v).Elem()\n\tif !typeEqual(value, reflect.Struct) {\n\t\tfmt.Println(\"ToLower param not type of struct\")\n\t\treturn\n\t}\n\n\t// range and toLower\n\tfor i := 0; i < value.NumField(); i++ {\n\t\tfield := value.Field(i)\n\t\tswitch field.Type().Kind() {\n\t\tcase reflect.String:\n\t\t\tfield.SetString(\n\t\t\t\tstrings.ToLower(field.String()),\n\t\t\t)\n\t\tcase reflect.Ptr:\n\t\t\tToLower(field.Interface())\n\t\t}\n\t}\n}", "func fnLower(ctx Context, doc *JDoc, params []string) interface{} {\n\tstats := ctx.Value(EelTotalStats).(*ServiceStats)\n\tif params == nil || len(params) != 1 {\n\t\tctx.Log().Error(\"error_type\", \"func_lower\", \"op\", \"lower\", \"cause\", \"wrong_number_of_parameters\", \"params\", params)\n\t\tstats.IncErrors()\n\t\tAddError(ctx, SyntaxError{fmt.Sprintf(\"wrong number of parameters in call to lower function\"), \"lower\", params})\n\t\treturn \"\"\n\t}\n\treturn strings.ToLower(extractStringParam(params[0]))\n}", "func LowerCamelCase(s string) string {\n\tfirst := true\n\tparts := []string{}\n\tfor _, part := range SplitSymbol(s) {\n\t\tif part == \"\" {\n\t\t\tparts = append(parts, \"_\")\n\t\t\tcontinue\n\t\t}\n\t\tif first {\n\t\t\tparts = append(parts, strings.ToLower(part))\n\t\t\tfirst = false\n\t\t} else {\n\t\t\t// Merge trailing s\n\t\t\tif part == \"s\" && len(parts) > 0 {\n\t\t\t\tparts[len(parts)-1] += part\n\t\t\t} else {\n\t\t\t\tif commonInitialisms[strings.ToUpper(part)] {\n\t\t\t\t\tpart = strings.ToUpper(part)\n\t\t\t\t} else {\n\t\t\t\t\tpart = title(part)\n\t\t\t\t}\n\t\t\t\tparts = append(parts, part)\n\t\t\t}\n\t\t}\n\t}\n\treturn strings.Join(parts, \"\")\n}", "func SnakeToLowerCamel(original string) string {\n\treturn toCamel(original, snakeDelimiter, false)\n}", "func ToLowerCamel(s string) (string, bool) {\n\tcamel := strcase.ToLowerCamel(s)\n\tsnake := strcase.ToSnake(camel)\n\treturn camel, s == snake\n}", "func lowercaseFilter(tokens []string) []string {\n\tr := make([]string, len(tokens))\n\tfor i, token := range tokens {\n\t\tr[i] = strings.ToLower(token)\n\t}\n\treturn r\n}", "func SpecialCaseToLower(special unicode.SpecialCase, r rune) rune", "func LowerFirst(s string) string {\n\tif len(s) == 0 {\n\t\treturn s\n\t}\n\tr, n := utf8.DecodeRuneInString(s)\n\treturn string(unicode.ToLower(r)) + s[n:]\n}", "func toLowerASCII(s string) string {\n\tvar b []byte\n\tfor i := 0; i < len(s); i++ {\n\t\tif c := s[i]; 'A' <= c && c <= 'Z' {\n\t\t\tif b == nil {\n\t\t\t\tb = make([]byte, len(s))\n\t\t\t\tcopy(b, s)\n\t\t\t}\n\t\t\tb[i] = s[i] + ('a' - 'A')\n\t\t}\n\t}\n\n\tif b == nil {\n\t\treturn s\n\t}\n\n\treturn string(b)\n}", "func caseInsensitiveLess(a, b string) bool {\n\tfor i := 0; i < len(a) && i < len(b); i++ {\n\t\tif a[i] >= 'A' && a[i] <= 'Z' {\n\t\t\tif b[i] >= 'A' && b[i] <= 'Z' {\n\t\t\t\t// both are uppercase, do nothing\n\t\t\t\tif a[i] < b[i] {\n\t\t\t\t\treturn true\n\t\t\t\t} else if a[i] > b[i] {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// a is uppercase, convert a to lowercase\n\t\t\t\tif a[i]+32 < b[i] {\n\t\t\t\t\treturn true\n\t\t\t\t} else if a[i]+32 > b[i] {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t} else if b[i] >= 'A' && b[i] <= 'Z' {\n\t\t\t// b is uppercase, convert b to lowercase\n\t\t\tif a[i] < b[i]+32 {\n\t\t\t\treturn true\n\t\t\t} else if a[i] > b[i]+32 {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} else {\n\t\t\t// neither are uppercase\n\t\t\tif a[i] < b[i] {\n\t\t\t\treturn true\n\t\t\t} else if a[i] > b[i] {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn len(a) < len(b)\n}", "func templateFunctionLower(value string) string {\n\treturn strings.ToLower(value)\n}", "func TrainCase(t string) string {\n\treturn KebabCase(t, true, false)\n}", "func StartsWithIgnoreCase(str string, prefix string) bool {\n\treturn internalStartsWith(str, prefix, true)\n}", "func ToLowerCamel(s string) string {\n\treturn ToLowerCamelWithInitialisms(s, CommonInitialisms)\n}", "func bytesToLowerCase(inputBytes []byte) []byte {\r\n\r\n\tmixedcaseBytes := make([]byte, len(inputBytes))\r\n\r\n\tfor i := 0; i < len(inputBytes); i++ {\r\n\t\tif uppercase := isUppercase(inputBytes[i]); uppercase {\r\n\t\t\t// Convert to lowercase\r\n\t\t\tmixedcaseBytes[i] = inputBytes[i] + 0x20\r\n\t\t}\r\n\t}\r\n\treturn mixedcaseBytes\r\n}", "func LowerFirst(value string) string {\n\tfor i, v := range value {\n\t\treturn string(unicode.ToLower(v)) + value[i+1:]\n\t}\n\treturn \"\"\n}", "func LowerCasedString(i interface{}, k string) ([]string, []error) {\n\tv, ok := i.(string)\n\tif !ok {\n\t\treturn nil, []error{fmt.Errorf(\"expected type of %q to be string\", k)}\n\t}\n\n\tif strings.TrimSpace(v) == \"\" {\n\t\treturn nil, []error{fmt.Errorf(\"%q must not be empty\", k)}\n\t}\n\n\tif strings.ToLower(v) != v {\n\t\treturn nil, []error{fmt.Errorf(\"%q must be a lower-cased string\", k)}\n\t}\n\n\tif strings.ContainsAny(v, \" \") {\n\t\treturn nil, []error{fmt.Errorf(\"%q cannot contain whitespace\", k)}\n\t}\n\n\treturn nil, nil\n}", "func LowercaseFirstLetter(s string) string {\n\trunes := []rune(s)\n\trunes[0] = unicode.ToLower(runes[0])\n\treturn string(runes)\n}", "func LowerFirstChar(str string) string {\n\tfor i, v := range str {\n\t\treturn string(unicode.ToLower(v)) + str[i+1:]\n\t}\n\treturn str\n}", "func ToLowerCamelWithInitialisms(s string, initialisms map[string]bool) string {\n\tif s == \"\" {\n\t\treturn s\n\t}\n\tif initialisms == nil {\n\t\tinitialisms = map[string]bool{}\n\t}\n\tss := SplitIntoWordsWithInitialisms(s, initialisms)\n\tfor i, s := range ss {\n\t\tif i == 0 {\n\t\t\tss[i] = strings.ToLower(s)\n\t\t\tcontinue\n\t\t}\n\t\tif initialisms[strings.ToLower(s)] {\n\t\t\tss[i] = strings.ToUpper(s)\n\t\t\tcontinue\n\t\t}\n\t\tif strings.ToLower(s[len(s)-1:]) == \"s\" && initialisms[strings.ToLower(s[:len(s)-1])] {\n\t\t\tss[i] = strings.ToUpper(s[:len(s)-1]) + \"s\"\n\t\t\tcontinue\n\t\t}\n\t\tss[i] = strings.ToUpper(s[:1]) + strings.ToLower(s[1:])\n\t}\n\treturn strings.Join(ss, \"\")\n}", "func (fn *formulaFuncs) LOWER(argsList *list.List) formulaArg {\n\tif argsList.Len() != 1 {\n\t\treturn newErrorFormulaArg(formulaErrorVALUE, \"LOWER requires 1 argument\")\n\t}\n\treturn newStringFormulaArg(strings.ToLower(argsList.Front().Value.(formulaArg).String))\n}", "func SnakeCase(str string) string {\n\treturn xstrings.ToSnakeCase(str)\n}", "func EqualsIgnoreCase(strFirst, strSecond string) bool {\n\tstrFirst = ToLower(strFirst)\n\tstrSecond = ToLower(strSecond)\n\treturn strFirst == strSecond\n}", "func ToLowerStrings(in []string) []string {\n\tfor i := range in {\n\t\tin[i] = strings.ToLower(in[i])\n\t}\n\treturn in\n}", "func LowercaseFirstChar(s string) string {\n\tfor i, v := range s {\n\t\treturn string(unicode.ToLower(v)) + s[i+1:]\n\t}\n\treturn \"\"\n}", "func ToLower(b []byte) []byte {\n\tconst decr = 'a' - 'A'\n\tfor i, c := range b {\n\t\tif c >= 'A' && c <= 'Z' {\n\t\t\tb[i] += decr\n\t\t}\n\t}\n\treturn b\n}", "func Lowercase(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tr.URL.Path = strings.ToLower(r.URL.Path)\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "func isOnlyLowerCase(text string) bool {\n\tconst chars = \"0123456789abcdefghijklmnopqrstuvwxyz.+-*/%&!# _,;:()[]{}\"\n\tfor _, c := range text {\n\t\tif !strings.Contains(chars, string(c)) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func ToLowerCamel(s string) string {\n\tif s == \"\" {\n\t\treturn s\n\t}\n\tif uppercaseAcronym[s] {\n\t\ts = strings.ToLower(s)\n\t}\n\tif r := rune(s[0]); r == '_' {\n\t\ts = s[1:]\n\t}\n\tif r := rune(s[0]); r >= 'A' && r <= 'Z' {\n\t\ts = strings.ToLower(string(r)) + s[1:]\n\t}\n\treturn toCamelInitCase(s, false)\n}", "func (ent *Entity) GetLowerCasePrefixLetter() string {\n\tif len(ent.Header.Value) > 0 {\n\t\treturn string(ent.Header.Value[0])\n\t}\n\treturn \"e\"\n}", "func SnakeCase(in string) string {\n\trunes := []rune(in)\n\tlength := len(runes)\n\n\tvar out []rune\n\tfor i := 0; i < length; i++ {\n\t\tif i > 0 && unicode.IsUpper(runes[i]) && ((i+1 < length && unicode.IsLower(runes[i+1])) || unicode.IsLower(runes[i-1])) {\n\t\t\tout = append(out, '_')\n\t\t}\n\t\tout = append(out, unicode.ToLower(runes[i]))\n\t}\n\n\treturn string(out)\n}", "func ToLowerFirstRune(s string) string {\n\tif utf8.RuneCountInString(s) == 0 {\n\t\treturn s\n\t}\n\trunes := []rune(s)\n\trunes[0] = unicode.ToLower(runes[0])\n\treturn string(runes)\n}", "func IgnoringCase() StringOpt {\n\treturn func(c *AssertableString) {\n\t\tc.actual = c.actual.AddDecorator(strings.ToLower)\n\t}\n}", "func TestPositiveEqualsIgnoreCaseFunc(t *testing.T) {\n\tfirstInput := \"Bola\"\n\tsecondInput := \"bola\"\n\n\tresult := EqualsIgnoreCase(firstInput, secondInput)\n\n\tassert.Equal(t, true, result, \"Result should return true, but actual get \"+result)\n}", "func (v Version) LowerThanString(compareTo string) bool {\n\tcompare := Parse(compareTo)\n\treturn v.LowerThan(compare)\n}", "func isLower(c byte) bool {\n return c >= 97 && c <= 122\n}", "func IsLower(rune int) bool {\n\tif rune < 0x80 {\t// quick ASCII check\n\t\treturn 'a' <= rune && rune <= 'z'\n\t}\n\treturn Is(Lower, rune);\n}", "func ToSnakeCase(str string) string {\n\tvar output []rune\n\tvar segment []rune\n\tfor _, r := range str {\n\t\tif !unicode.IsLower(r) {\n\t\t\toutput = addSegment(output, segment)\n\t\t\tsegment = nil\n\t\t}\n\t\tsegment = append(segment, unicode.ToLower(r))\n\t}\n\toutput = addSegment(output, segment)\n\treturn string(output)\n}", "func transformToSnakeCase(input string) string {\n\twords := sliceIntoWords(input)\n\n\t// my kingdom for LINQ\n\tlowerWords := make([]string, 0, len(words))\n\tfor _, word := range words {\n\t\tif len(word) > 0 {\n\t\t\tlowerWords = append(lowerWords, strings.ToLower(word))\n\t\t}\n\t}\n\n\treturn strings.Join(lowerWords, \"_\")\n}", "func lowCamelName(s string) string {\n\ts = gogen.CamelCase(s)\n\tnew := []rune(s)\n\tif len(new) < 1 {\n\t\treturn s\n\t}\n\trv := []rune{}\n\trv = append(rv, unicode.ToLower(new[0]))\n\trv = append(rv, new[1:]...)\n\treturn string(rv)\n}", "func ToLowerFirstCamelCase(s string) string {\n\tif s == \"\" {\n\t\treturn s\n\t}\n\tif len(s) == 1 {\n\t\treturn strings.ToLower(string(s[0]))\n\t}\n\treturn strings.ToLower(string(s[0])) + ToCamelCase(s)[1:]\n}", "func NormalizeString(rawString string) string {\n\treturn strings.ToLower(rawString)\n}", "func IsLowerSnakeCase(s string, extraRunes ...rune) bool {\n\tif s == \"\" {\n\t\treturn false\n\t}\n\tif s[0] == '_' {\n\t\treturn false\n\t}\n\tif s[len(s)-1] == '_' {\n\t\treturn false\n\t}\n\tfor _, c := range s {\n\t\tif !((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '_') && !containsRune(c, extraRunes) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func transformToSnakeCase(input string) string {\n\twords := sliceIntoWords(input)\n\n\t// my kingdom for LINQ\n\tvar lowerWords []string\n\tfor _, word := range words {\n\t\tlowerWords = append(lowerWords, strings.ToLower(word))\n\t}\n\n\treturn strings.Join(lowerWords, \"_\")\n}", "func transformToSnakeCase(input string) string {\n\twords := sliceIntoWords(input)\n\n\t// my kingdom for LINQ\n\tvar lowerWords []string\n\tfor _, word := range words {\n\t\tlowerWords = append(lowerWords, strings.ToLower(word))\n\t}\n\n\treturn strings.Join(lowerWords, \"_\")\n}", "func (b *Builder) ToLower() *Builder {\n\tb.p.RegisterTransformation(impl.ToLower())\n\treturn b\n}", "func ToLowerCamelCase(name string) string {\n\tparts := nameParts(name)\n\tfor i := range parts {\n\t\tif i == 0 {\n\t\t\tparts[i] = strings.ToLower(parts[i])\n\t\t} else {\n\t\t\tparts[i] = strings.Title(strings.ToLower(parts[i]))\n\t\t}\n\t\tif parts[i] == \"\" {\n\t\t\tparts[i] = \"_\"\n\t\t}\n\t}\n\treturn strings.Join(parts, \"\")\n}", "func ToLowerSpecial(c unicode.SpecialCase) MapFunc {\n\treturn func(s string) string { return strings.ToLowerSpecial(c, s) }\n}", "func lowerSlice(input []string) []string {\n\tvar output []string\n\tfor _, v := range input {\n\t\toutput = append(output, strings.ToLower(v))\n\t}\n\treturn output\n}", "func ignoreCaseStateFunc(val interface{}) string {\n\treturn strings.ToLower(val.(string))\n}" ]
[ "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.653572", "0.6532516", "0.6486465", "0.6443392", "0.6428731", "0.6426145", "0.6375048", "0.63502085", "0.6341933", "0.6325059", "0.6323301", "0.6269133", "0.6265758", "0.6263963", "0.62493086", "0.62224054", "0.6204766", "0.6198965", "0.61986774", "0.6196193", "0.61956984", "0.6193065", "0.6186284", "0.61249936", "0.61099386", "0.6091175", "0.6090077", "0.60599256", "0.60566485", "0.6053319", "0.60423017", "0.60386163", "0.60356265", "0.60252196", "0.601398", "0.5970181", "0.5969297", "0.5944473", "0.5941042", "0.59131235", "0.5885906", "0.58853894", "0.58529216", "0.584949", "0.583291", "0.5818476", "0.5811785", "0.5796811", "0.57799906", "0.57767427", "0.5768224", "0.5730141", "0.57285047", "0.5727815", "0.5709886", "0.5693809", "0.56927985", "0.5689691", "0.5678456", "0.56764334", "0.5670569", "0.56588125", "0.5646134", "0.563466", "0.5580083", "0.5562641", "0.5550874", "0.5533891", "0.5516871", "0.5513186", "0.5511771", "0.5486604", "0.54708177", "0.5467473", "0.5467473", "0.5461001", "0.5448563", "0.5447824", "0.5445016", "0.5416994" ]
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\t//each position in s is a rune (a sequence of bytes)\n\t//in case of ascii this would be the same as the character\n\t//however this is not true for other encodings\n\tfor i := 0; i < len(s); i++ {\n\t\tif HasPrefix(s[i:], substr) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Contains(s, substr string) bool {\n\tfor i := range s {\n\t\tif HasPrefix(s[i:], substr) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Contains(substr string) MatchFunc {\n\treturn func(s string) bool { return strings.Contains(s, substr) }\n}", "func substringContainedInSlice(str string, substrs []string) bool {\n\tfor _, s := range substrs {\n\t\tif strings.Contains(str, s) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func ContainsAny(chars, operand string) bool { return strings.ContainsAny(operand, chars) }", "func Contains(t *testing.T, s, substring string) {\n\tt.Helper()\n\n\tif !strings.Contains(s, substring) {\n\t\tt.Errorf(`%s: string \"%s\" does not contain \"%s\"`, t.Name(), s, substring)\n\t}\n}", "func contains(s string, substr string) bool {\n if len(substr) == 0 {\n return true\n }\n s = strings.ToLower(s)\n split := strings.Split(s, \"-\")\n s = strings.Join(split, \"\") + \" \" + strings.Join(split, \" \")\n\n substr = strings.ToLower(substr)\n substr = strings.Join(strings.Split(substr, \"-\"), \"\")\n\n index := strings.Index(s, substr)\n if index == -1 {\n return false\n }\n if index + len(substr) < len(s) {\n char := s[index + len(substr)]\n if char >= 'a' && char <= 'z' || char >= '0' && char <= '9' {\n return false\n }\n }\n if index > 0 {\n char := s[index - 1]\n if char >= 'a' && char <= 'z' || char >= '0' && char <= '9' {\n return false\n }\n }\n return true\n}", "func StringContains(s, sub string) bool {\n\treturn s != \"\" && strings.Contains(s, sub)\n}", "func SubStringIn(subString string, strs []string) bool {\n\tfor _, s := range strs {\n\t\tif strings.Contains(s, subString) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func StringContains(s, sub string) bool {\n\tif s == \"\" {\n\t\treturn false\n\t}\n\n\treturn strings.Contains(s, sub)\n}", "func (a AssertableString) Contains(substring string) AssertableString {\n\ta.t.Helper()\n\tif a.actual.DoesNotContain(substring) {\n\t\ta.t.Error(shouldContain(a.actual, substring))\n\t}\n\treturn a\n}", "func containsDemo(a string, b string) bool {\n\treturn strings.Contains(a, b)\n}", "func StringContainedIn(target string, strs []string) bool {\n\tfor _, s := range strs {\n\t\tif s == target {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (r *runestring) Contains(start int, length int, criteria ...string) bool {\n\tsubstring := r.SafeSubstr(start, length)\n\tfor _, c := range criteria {\n\t\tif substring == c {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func HasSuffix(suffix, operand string) bool { return strings.HasSuffix(operand, suffix) }", "func StringContains(column string, sub 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.Contains(\"\", sub))\n\t})\n}", "func Contains(s, substring string) bool {\n\tfor i := 0; i < len(s); i++ {\n\t\tif HasPrefix(s[i:], substring) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func containsString(slice []string, element string) bool {\n\treturn posString(slice, element) != -1\n}", "func containsString(slice []string, element string) bool {\n\treturn !(posString(slice, element) == -1)\n}", "func containsString(slice []string, element string) bool {\n\treturn !(posString(slice, element) == -1)\n}", "func containsString(slice []string, element string) bool {\n\treturn !(posString(slice, element) == -1)\n}", "func containsString(slice []string, element string) bool {\n\treturn !(posString(slice, element) == -1)\n}", "func containsString(slice []string, element string) bool {\n\treturn !(posString(slice, element) == -1)\n}", "func containsString(slice []string, element string) bool {\n\treturn !(posString(slice, element) == -1)\n}", "func ShouldContainSubstring(actual interface{}, expected ...interface{}) error {\n\tvar arg string\n\tfor _, e := range expected {\n\t\targ += fmt.Sprintf(\"%v \", e)\n\t}\n\n\ts, err := cast.ToStringE(actual)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tss := strings.TrimSpace(arg)\n\n\tif strings.Contains(s, ss) {\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"expected '%v' to contain '%v' but it wasn't\", s, ss)\n}", "func (s *singleCapture) AssertContains(t Tester, substr string) {\n\tif s.captured == nil {\n\t\tt.Errorf(\"Expected string containing '%s'; got nil%s\", substr, PrintStack(mockTesterStackDepth))\n\t\treturn\n\t}\n\n\tif !strings.Contains(*s.captured, substr) {\n\t\tt.Errorf(\"Expected string containing '%s'; got '%s'%s\", substr, *s.captured, PrintStack(mockTesterStackDepth))\n\t}\n}", "func (a *Assertions) Contains(corpus, substring string, userMessageComponents ...interface{}) bool {\n\ta.assertion()\n\tif didFail, message := shouldContain(corpus, substring); didFail {\n\t\treturn a.fail(message, userMessageComponents...)\n\t}\n\treturn true\n}", "func Index(substr, operand string) int { return strings.Index(operand, substr) }", "func StringSliceContains(s []string, e string) bool {\n\tfor _, a := range s {\n\t\tif a == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func StringSliceContains(slice []string, str string) bool {\n\tfor _, s := range slice {\n\t\tif s == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func containsStringInList(list []string, substrList []string) bool {\n\tfor _, s := range list {\n\t\tfor _, substr := range substrList {\n\t\t\tif strings.Contains(s, substr) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "func (f functionStringContains) Calculate(ctx *Context) (AttributeValue, error) {\n\tstr, err := ctx.calculateStringExpression(f.str)\n\tif err != nil {\n\t\treturn UndefinedValue, bindError(bindError(err, \"string argument\"), f.describe())\n\t}\n\n\tsubstr, err := ctx.calculateStringExpression(f.substr)\n\tif err != nil {\n\t\treturn UndefinedValue, bindError(bindError(err, \"substring argument\"), f.describe())\n\t}\n\n\treturn MakeBooleanValue(strings.Contains(str, substr)), nil\n}", "func ContainsString(slice []string, s string, modifier func(s string) string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t\tif modifier != nil && modifier(item) == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func stringContains(first, second string) bool {\n\tif strings.Contains(strings.ToUpper(first), strings.ToUpper(second)) {\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n}", "func StringSliceContains(haystack []string, needle string) bool {\n\tfor _, str := range haystack {\n\t\tif str == needle {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func StringSliceContains(slice []string, elem string) bool {\n\tfor _, v := range slice {\n\t\tif v == elem {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func containsString(s []string, e string) bool {\n\treturn sliceIndex(s, e) > -1\n}", "func main() {\n\n\tstring1 := \"Odit, lorem ipsum dolor sit amet, consectetur adipisicing elit.\"\n\n\tfmt.Printf(\"strings.Contains? 'elit': %v \\n\", strings.Contains(string1, \"elit\"))\n\tfmt.Printf(\"strings.Contains? 'elitZ': %v \\n\", strings.Contains(string1, \"elitZ\"))\n\n\tfmt.Printf(\"strings.Index? 'elit': %v \\n\", strings.Index(string1, \"elit\"))\n\n\tfmt.Printf(\"strings.Count? 'p': %v \\n\", strings.Count(string1, \"p\"))\n\n\tfmt.Printf(\"strings.HasPrefix? 'lit.': %v \\n\", strings.HasPrefix(string1, \"lit.\"))\n\tfmt.Printf(\"strings.HasSuffix? 'lit.': %v \\n\", strings.HasSuffix(string1, \"lit.\"))\n\n\tfmt.Println(strings.Replace(string1, \"adipisicing\", \"REPLACED!\", 1))\n}", "func StringContains(t *testing.T, actual string, expected string) {\n\tt.Helper()\n\tif !strings.Contains(actual, expected) {\n\t\tt.Errorf(\"expected %s to contain %s\", actual, expected)\n\t\tt.FailNow()\n\t}\n}", "func HasPrefix(prefix, operand string) bool { return strings.HasPrefix(operand, prefix) }", "func TestContainsString(t *testing.T) {\n\tt.Parallel()\n\n\ttests := []struct {\n\t\tname string\n\t\tstr string\n\t\twant bool\n\t}{\n\t\t{\n\t\t\t\"Returns true if []string contains str\",\n\t\t\t\"contains-me\",\n\t\t\ttrue,\n\t\t},\n\t\t{\n\t\t\t\"Returns false if []string doesn't contain str\",\n\t\t\t\"contains-me-not\",\n\t\t\tfalse,\n\t\t},\n\t\t{\n\t\t\t\"Returns false if []string doesn't contain substring of str\",\n\t\t\t\"con\",\n\t\t\tfalse,\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\ttt := tt\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tt.Parallel()\n\t\t\tif got := ContainsString([]string{\"test\", \"contains-me\", \"test2\"}, tt.str); got != tt.want {\n\t\t\t\tt.Errorf(\"ContainsString() = %v, want %v\", got, tt.want)\n\t\t\t}\n\t\t})\n\t}\n}", "func contains(a string, x byte) bool {\n\t// Detects if a string contains a character (or sub string)\n\tfor _, n := range a {\n\t\tif x == byte(n) { // if the byte is in there\n\t\t\treturn true // then return true\n\t\t}\n\t}\n\treturn false // otherwise false\n}", "func StringsContains(target []string, src string) bool {\n\tfor _, t := range target {\n\t\tif strings.Contains(t, src) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func StringSliceContains(list []string, s string) bool {\n\tfor _, v := range list {\n\t\tif v == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func StringSliceContains(list []string, s string) bool {\n\tfor _, v := range list {\n\t\tif v == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func StringSliceContains(s []string, val string) bool {\n\tif s != nil && val != \"\" {\n\t\tfor _, v := range s {\n\t\t\tif val == v {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false\n}", "func (a AssertableString) ContainsOnly(substring string) AssertableString {\n\ta.t.Helper()\n\tif !a.actual.ContainsOnly(substring) {\n\t\ta.t.Error(shouldContainOnly(a.actual, substring))\n\t}\n\treturn a\n}", "func stringSliceContains(ss []string, s string) bool {\n\tfor _, v := range ss {\n\t\tif v == s {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func StrIn(str string, slice []string) bool {\n\tpred := func(strx string) bool { return (strx == str) }\n\treturn AnySatisfies(pred, slice)\n}", "func (s *Stringish) Contains(str string) bool {\n\treturn strings.Contains(s.str, str)\n}", "func containsStr(s []string, e string) bool {\n\tfor _, a := range s {\n\t\tif a == e {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func SliceContainsString(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Contains(str string, search string) bool {\n\treturn strings.Contains(str, search)\n}", "func ContainsString(slice []string, needle string) bool {\n\tfor _, s := range slice {\n\t\tif s == needle {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func EndsWithStr(str, target string) bool {\n\tstrLen := len(str)\n\ttarLen := len(target)\n\tchunk := str[strLen-tarLen:]\n\treturn chunk == target\n}", "func stringSliceContains(strings []string, s string) bool {\n\treturn indexOfStringSlice(strings, s) != -1\n}", "func ContainsInSlice(s []string, str string) bool {\n\tfor _, val := range s {\n\t\tif val == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func ContainsString(slice []string, contains string) bool {\n\tfor _, value := range slice {\n\t\tif value == contains {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (v *verifier) Contains(inner string) *verifier {\n\treturn v.addVerification(\"Contains\", strings.Contains(v.Query, inner))\n}", "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func containsString(slice []string, s string) bool {\n\tfor _, item := range slice {\n\t\tif item == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func ShouldNotContainSubstring(actual interface{}, expected ...interface{}) error {\n\tvar arg string\n\tfor _, e := range expected {\n\t\targ += fmt.Sprintf(\"%v \", e)\n\t}\n\n\ts, err := cast.ToStringE(actual)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tss := strings.TrimSpace(arg)\n\n\tif strings.Contains(s, ss) {\n\t\treturn fmt.Errorf(\"expected '%v' to not contain '%v' but it was\", s, ss)\n\t}\n\n\treturn nil\n}", "func StringInSlice(requestID, str string, list []string) bool {\n\n\tfor _, v := range list {\n\t\tif v == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func ContainsString(slice []string, value string) bool {\n\tfor _, v := range slice {\n\t\tif v == value {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func StringsSliceContains(a []string, b string) bool {\n\tif !sort.StringsAreSorted(a) {\n\t\tsort.Strings(a)\n\t}\n\ti := sort.SearchStrings(a, b)\n\treturn i < len(a) && a[i] == b\n}", "func ContainsStr(haystack []string, needle string) bool {\n\treturn -1 == IndexStr(haystack, needle)\n}", "func ContainsString(slice []string, value string) bool {\n\tfor _, v := range slice {\n\t\tif value == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func SearchString() {\n\ts := \"this is a test\"\n\n\tfmt.Println(strings.Contains(s, \"this\"))\n\n\tfmt.Println(strings.ContainsAny(s, \"bca\"))\n\n\tfmt.Println(strings.HasPrefix(s, \"this\"))\n\n\tfmt.Println(strings.HasSuffix(s, \"test\"))\n}", "func Contains(a []string, x string) bool {\n\tfor _, n := range a {\n\t\tif strings.Contains(x, n) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func SubContains(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldSub), v))\n\t})\n}", "func hasSuffixDemo(a string, b string) bool {\n\treturn strings.HasSuffix(a, b)\n}", "func containsString(s string, slice []string) bool {\n\tfor _, s2 := range slice {\n\t\tif s2 == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func StringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func StringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func StringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func StringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func StringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func StringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func StringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func StringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func StringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (a AssertableString) IsSubstringOf(someString string) AssertableString {\n\ta.t.Helper()\n\tif !a.actual.IsSubstringOf(someString) {\n\t\ta.t.Error(shouldBeSubstringOf(a.actual, someString))\n\t}\n\treturn a\n}", "func (slice StringSlice) Contains(str string) bool {\n\tfor _, iStr := range slice {\n\t\tif iStr == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func sliceContainsString(s string, sl []string) bool {\n\tfor _, v := range sl {\n\t\tif v == s {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func SliceContainsString(sl []string, st string) bool {\n\tfor _, s := range sl {\n\t\tif s == st {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func stringInSlice(a string, list []string) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\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.62346405", "0.62346405", "0.62346405", "0.62346405", "0.62346405", "0.62116206", "0.6191493", "0.6166494", "0.61419904", "0.6122055", "0.61205906", "0.60915804", "0.60730547", "0.6071408", "0.6061856", "0.6057624", "0.6037603", "0.6036474", "0.6017689", "0.60132164", "0.59915936", "0.5985673", "0.5974964", "0.5960537", "0.59540087", "0.59540087", "0.5953887", "0.59501624", "0.59381646", "0.5937188", "0.5936656", "0.59333146", "0.5923643", "0.5921025", "0.59148484", "0.5911855", "0.5898866", "0.58710325", "0.58641875", "0.58620334", "0.5851961", "0.5851961", "0.5851961", "0.5851961", "0.5851961", "0.5851961", "0.5851961", "0.5851961", "0.5851961", "0.5851961", "0.5851961", "0.5851961", "0.5851961", "0.5851961", "0.5846421", "0.5843252", "0.58389", "0.5836201", "0.5833252", "0.5827943", "0.58085537", "0.58016217", "0.5794518", "0.5792086", "0.5787895", "0.57716876", "0.57716876", "0.57716876", "0.57716876", "0.57716876", "0.57716876", "0.57716876", "0.57716876", "0.57716876", "0.57669455", "0.5751201", "0.57334375", "0.57324505", "0.57281035" ]
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(str, (string)(s)) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func StringContainsAny(str string, subStrings []string) bool {\n\tfor _, subString := range subStrings {\n\t\tif strings.Contains(str, subString) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Contains(substr, operand string) bool { return strings.Contains(operand, substr) }", "func ContainsAny(text string, slice []string) bool {\n\tfor _, s := range slice {\n\t\tif strings.Contains(text, s) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func ContainsAnyCharacter(str string, search string) bool {\n\tfor _, c := range search {\n\t\tif Contains(str, (string)(c)) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func ExecContainsAnyString(command string, contains []string) error {\n\tstdOut, _, err := Exec(command)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn ContainsAnyString(stdOut, contains)\n}", "func stringMatchAny(x string, y []string) bool {\n\tfor _, v := range y {\n\t\tif x == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (cs *CStore) AnyContains(needle string) bool {\n\tfor key := range cs.store {\n\t\tif strings.Contains(key, needle) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (t *Test) ExecContainsAnyString(contains ...string) error {\n\terr := ExecContainsAnyString(t.Command, contains)\n\tif err != nil {\n\t\tt.Result.Error(err)\n\t\treturn err\n\t}\n\tt.Result.Success()\n\treturn nil\n}", "func ContainsAnyString(stdOut *bytes.Buffer, contains []string) error {\n\tvar containsAny bool\n\tso := stdOut.String()\n\n\tfor _, str := range contains {\n\t\tcontainsAny = containsAny || strings.Contains(so, str)\n\t}\n\n\tif !containsAny {\n\t\treturn fmt.Errorf(\"stdOut %q did not contain of the following %q\", so, contains)\n\t}\n\treturn nil\n}", "func (a *Assertions) AnyOfString(target []string, predicate PredicateOfString, userMessageComponents ...interface{}) bool {\n\ta.assertion()\n\tif didFail, message := shouldAnyOfString(target, predicate); didFail {\n\t\treturn a.fail(message, userMessageComponents...)\n\t}\n\treturn true\n}", "func Any(submatches ...Matcher) Matcher {\n\treturn func(cmp string) bool {\n\t\tfor _, submatch := range submatches {\n\t\t\tif submatch(cmp) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n}", "func IncludesAnyStr(needles []string, haystack []string) bool {\n\tfor _, needle := range needles {\n\t\tif ok, _ := InArray(needle, haystack); ok {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (s StringSet) IncludesAny(values []string) bool {\n\tfor _, v := range values {\n\t\tif _, ok := s[v]; ok {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (v *VerbalExpression) Any(s string) *VerbalExpression {\n\treturn v.add(`(?:[` + quote(s) + `])`)\n}", "func AnyString(f func(string, int) bool, input []string) (output bool) {\n\toutput = false\n\tfor idx, data := range input {\n\t\toutput = output || f(data, idx)\n\t\tif output {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "func AnyString(vs []string, f func(string) bool) bool {\n for _, v := range vs {\n if f(v) {\n return true\n }\n }\n return false\n}", "func Any(vs []string, f func(string) bool) bool {\n\tfor _, v := range vs {\n\t\tif f(v) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func matchAnyRune(source rune, targets ...rune) bool {\n\tvar result bool\n\tfor _, r := range targets {\n\t\tresult = result || (source == r)\n\t}\n\treturn result\n}", "func whereAny(entries interface{}, key, sep string, cmp []string) (interface{}, error) {\n\treturn generalizedWhere(\"whereAny\", entries, key, func(value interface{}) bool {\n\t\tif value == nil {\n\t\t\treturn false\n\t\t} else {\n\t\t\titems := strings.Split(value.(string), sep)\n\t\t\treturn len(intersect(cmp, items)) > 0\n\t\t}\n\t})\n}", "func MatchAny(values ...string) Matcher {\n\tdistinct := make([]string, 0, len(values))\n\tdistinct = misc.AppendDistinct(distinct, values...)\n\tfor i, s := range distinct {\n\t\tdistinct[i] = regexp.QuoteMeta(s)\n\t}\n\tpattern := fmt.Sprintf(`^(%s)$`, strings.Join(distinct, \"|\"))\n\trx, _ := regexp.Compile(pattern)\n\treturn rx\n}", "func containsRegisty(arr []string, str string) bool {\n\tfor _, a := range arr {\n\t\tif a == str || strings.Contains(str, a) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func LikeAny(col, search string) (where string) {\n\tvar wheres []string\n\n\twords := txt.UniqueKeywords(search)\n\n\tif len(words) == 0 {\n\t\treturn \"\"\n\t}\n\n\tfor _, w := range words {\n\t\tif len(w) > 3 {\n\t\t\twheres = append(wheres, fmt.Sprintf(\"%s LIKE '%s%%'\", col, w))\n\t\t} else {\n\t\t\twheres = append(wheres, fmt.Sprintf(\"%s = '%s'\", col, w))\n\t\t}\n\n\t\tsingular := inflection.Singular(w)\n\n\t\tif singular != w {\n\t\t\twheres = append(wheres, fmt.Sprintf(\"%s = '%s'\", col, singular))\n\t\t}\n\t}\n\n\treturn strings.Join(wheres, \" OR \")\n}", "func EndsWithAny(str string, suffixes ...string) bool {\n\tfor _, suffix := range suffixes {\n\t\tif internalEndsWith(str, (string)(suffix), false) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func TestAnyString(t *testing.T) {\n\tt.Parallel()\n\tvar tests = []struct {\n\t\ts []string\n\t\texpected bool\n\t}{\n\t\t{[]string{\"foo\", \"\\u0062\\u0061\\u0072\", \"baz\"}, true},\n\t\t{[]string{\"boo\", \"bar\", \"baz\"}, false},\n\t\t{[]string{\"foo\", \"far\", \"baz\"}, true},\n\t}\n\tfor _, test := range tests {\n\t\tactual := primitives.AnyString(test.s, func(s string) bool {\n\t\t\treturn strings.HasPrefix(s, \"f\")\n\t\t})\n\t\tassert.Equal(t, test.expected, actual, \"expected value '%v' | actual : '%v'\", test.expected, actual)\n\t}\n}", "func containsStr(s []string, e string) bool {\n\tfor _, a := range s {\n\t\tif a == e {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func SliceContainsAny(haystack []string, needles ...string) bool {\n\tfor _, a := range haystack {\n\t\tfor _, needle := range needles {\n\t\t\tif a == needle {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "func containsAny(fl FieldLevel) bool {\n\treturn strings.ContainsAny(fl.Field().String(), fl.Param())\n}", "func (v *VerbalExpression) AnyOf(s string) *VerbalExpression {\n\treturn v.Any(s)\n}", "func (s *Uint64) ContainsAny(vals ...uint64) bool {\n\tfor _, v := range vals {\n\t\tif _, ok := s.m[v]; ok {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (s *Int64) ContainsAny(vals ...int64) bool {\n\tfor _, v := range vals {\n\t\tif _, ok := s.m[v]; ok {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func contains(s []string, elt string) bool {\n\tfor _, e := range s {\n\t\tif strings.EqualFold(e, elt) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Contains(a []string, x string) bool {\n\tfor _, n := range a {\n\t\tif strings.Contains(x, n) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func contains(arr []string, str string) bool {\n\tfor _, a := range arr {\n\t\tif a == str || strings.Contains(a, str) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Contains(s []string, str string) bool {\n\tfor _, v := range s {\n\t\tif v == str {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func StartsWithAny(str string, prefixes ...string) bool {\n\tfor _, prefix := range prefixes {\n\t\tif internalStartsWith(str, (string)(prefix), false) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (pef pathExpressionFlag) containsAnyAsterisk() bool {\n\tpef &= pathExpressionContainsAsterisk | pathExpressionContainsDoubleAsterisk\n\treturn byte(pef) != 0\n}", "func MatchAny(slice []string, match MatchFunc) bool {\n\tfor _, s := range slice {\n\t\tif match(s) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (cs *CStore) AnyContainsReverse(haystack string) bool {\n\tfor key := range cs.store {\n\t\tif strings.Contains(haystack, key) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func contains(s []string, str string) bool {\n\tfor _, v := range s {\n\t\tif v == str {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func contains(s []string, str string) bool {\n\tfor _, v := range s {\n\t\tif v == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (m *ExactMatcher) MatchAnyString(strs interface{}) bool {\n\treturn matchAnyStrings(m.stringMatcher, strs)\n}", "func Any(operands ...Operand) OrOperator {\n\treturn Or(operands...)\n}", "func (m *Matcher) MatchAnyString(strs interface{}) bool {\n\treturn matchAnyStrings(m.stringMatcher, strs)\n}", "func contains(str string, arr []string) bool{\n\tfor _, a := range arr {\n\t\tif a == str {\n\t\t\t return true\n\t\t}\n\t}\n\treturn false\n}", "func Any(ss []string) bool {\n\treturn len(ss) != 0\n}", "func AnyValueInStringSlice(Slice1, Slice2 []string) bool {\n\tif len(Slice1) == 0 || len(Slice2) == 0 {\n\t\treturn false\n\t}\n\tfor _, x := range Slice1 {\n\t\tif IsValueInStringSlice(x, Slice2) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func contains(s string) bool {\n\tfor _, value := range ufs {\n\t\tif strings.EqualFold(s, value) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (l *Lexer) acceptAny(any string) bool {\n\tif strings.IndexRune(any, l.next()) >= 0 {\n\t\treturn true\n\t}\n\tl.backup()\n\treturn false\n}", "func Contains(s []string, e string) bool {\n\tfor _, v := range s {\n\t\tif e == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func AnyString(values ...string) string {\n\tfor _, v := range values {\n\t\tif v != \"\" {\n\t\t\treturn v\n\t\t}\n\t}\n\treturn \"\"\n}", "func AnySatisfies(pred StringPredicate, slice []string) bool {\n\tfor _, sliceString := range slice {\n\t\tif pred(sliceString) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Contains(s []string, e string) bool {\n\tfor _, se := range s {\n\t\tif se == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Contains(s []string, e string) bool {\n\tfor _, a := range s {\n\t\tif a == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Contains(s []string, e string) bool {\n\tfor _, a := range s {\n\t\tif a == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Contains(s []string, e string) bool {\n\tfor _, a := range s {\n\t\tif a == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Contains(s []string, e string) bool {\n\tfor _, a := range s {\n\t\tif a == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Contains(s []string, e string) bool {\n\tfor _, a := range s {\n\t\tif a == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func StringsContains(target []string, src string) bool {\n\tfor _, t := range target {\n\t\tif strings.Contains(t, src) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (l *littr) Contains(s []string, e string) bool {\n\tfor _, a := range s {\n\t\tif a == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func contains(arr []string, str string) bool {\n\tfor _, el := range arr {\n\t\tif str == el {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (c *Comparator) contains(s []string, str string) bool {\n\tfor _, v := range s {\n\t\tif v == str {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func contains(s []string, e string) bool {\n\tfor _, a := range s {\n\t\tif a == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func contains(s []string, e string) bool {\n\tfor _, a := range s {\n\t\tif a == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func contains(s []string, e string) bool {\n\tfor _, a := range s {\n\t\tif a == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func contains(s []string, e string) bool {\n\tfor _, a := range s {\n\t\tif a == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func contains(s []string, e string) bool {\n\tfor _, a := range s {\n\t\tif a == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func contains(s [8]string, e string) bool {\n\tfor _, a := range s {\n\t\tif a == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Contains(arr []string, str string) bool {\n\tfor _, a := range arr {\n\t\tif a == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func All(p func(rune) bool, s string) bool {\n\tfor _, r := range s {\n\t\tif !p(r) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func StringContainedIn(target string, strs []string) bool {\n\tfor _, s := range strs {\n\t\tif s == target {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func ContainsAllWords(str string, words ...string) bool {\n\tif str == \"\" || len(words) == 0 {\n\t\treturn false\n\t}\n\tfound := 0\n\tfor _, word := range words {\n\t\tif regexp.MustCompile(`.*\\b` + word + `\\b.*`).MatchString(str) {\n\t\t\tfound++\n\t\t}\n\t}\n\treturn found == len(words)\n}", "func contains(arr []string, str string) bool {\n\tfor _, a := range arr {\n\t\tif a == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func contains(arr []string, str string) bool {\n\tfor _, a := range arr {\n\t\tif a == str {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func arrContains(str string) bool {\n\tfor _, compare := range []string{\"CREATE\", \"REMOVE\", \"RENAME\"} {\n\t\tif strings.Contains(strings.ToUpper(str), compare) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (pe PathExpression) ContainsAnyAsterisk() bool {\n\treturn pe.flags.containsAnyAsterisk()\n}", "func Contains(s string, substr string) bool {\n\treturn Index(s, substr) >= 0\n}", "func applyContains(l, r Expr) (*BooleanLiteral, error) {\n\treturn applyIN(r, l)\n}", "func Contains(substr string) MatchFunc {\n\treturn func(s string) bool { return strings.Contains(s, substr) }\n}", "func contains(haystack []string, needle string) bool {\n\tfor _, a := range haystack {\n\t\tif strings.EqualFold(a, needle) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func contains(a string, x byte) bool {\n\t// Detects if a string contains a character (or sub string)\n\tfor _, n := range a {\n\t\tif x == byte(n) { // if the byte is in there\n\t\t\treturn true // then return true\n\t\t}\n\t}\n\treturn false // otherwise false\n}", "func contains(s []string, e string) bool {\n for _, a := range s {\n if a == e {\n return true\n }\n }\n return false\n}", "func Contains(str, substr string) bool {\n\treturn strings.Contains(str, substr)\n}", "func StringContains(column string, sub 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.Contains(\"\", sub))\n\t})\n}", "func (a *Assertions) AllOfString(target []string, predicate PredicateOfString, userMessageComponents ...interface{}) bool {\n\ta.assertion()\n\tif didFail, message := shouldAllOfString(target, predicate); didFail {\n\t\treturn a.fail(message, userMessageComponents...)\n\t}\n\treturn true\n}", "func RuneIn(set string) Function {\n\tname := \"any rune in '\" + set + \"'\"\n\treturn func(pi Input) Result {\n\t\treturn runeWhere(pi, name, func(r rune) bool { return strings.ContainsRune(set, r) })\n\t}\n}", "func Contains(a []string, x string) bool {\n\tfor _, n := range a {\n\t\tif x == n {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Contains(a []string, x string) bool {\n\tfor _, n := range a {\n\t\tif x == n {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Contains(a []string, x string) bool {\n\tfor _, n := range a {\n\t\tif x == n {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Contains(a []string, x string) bool {\n\tfor _, n := range a {\n\t\tif x == n {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Contains(a []string, x string) bool {\n\tfor _, n := range a {\n\t\tif x == n {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Contains(a []string, x string) bool {\n\tfor _, n := range a {\n\t\tif x == n {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func stringContains(data []string, value string) bool {\n\tfor _, elem := range data {\n\t\tif elem == value {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func EndsWithAnyIgnoreCase(str string, suffixes ...string) bool {\n\tfor _, suffix := range suffixes {\n\t\tif internalEndsWith(str, (string)(suffix), true) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func containsDemo(a string, b string) bool {\n\treturn strings.Contains(a, b)\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\t//each position in s is a rune (a sequence of bytes)\n\t//in case of ascii this would be the same as the character\n\t//however this is not true for other encodings\n\tfor i := 0; i < len(s); i++ {\n\t\tif HasPrefix(s[i:], substr) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func LastIndexAny(chars, operand string) int { return strings.LastIndexAny(operand, chars) }", "func Contains(a []string, x string) bool {\n\tfor _, value := range a {\n\t\tif x == value {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}" ]
[ "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.59973896", "0.5994326", "0.59774876", "0.5966637", "0.5953129", "0.58997655", "0.58673847", "0.585361", "0.584898", "0.58206564", "0.580489", "0.58037716", "0.5795405", "0.5777751", "0.57557553", "0.57462674", "0.57458246", "0.57336307", "0.5730458", "0.5699102", "0.5698465", "0.56965864", "0.56920284", "0.5691737", "0.567973", "0.56613994", "0.5650842", "0.5638154", "0.5625935", "0.56067055", "0.55986845", "0.5591408", "0.5582179", "0.5575851", "0.55753446", "0.55753446", "0.55753446", "0.55753446", "0.55753446", "0.5536255", "0.5533221", "0.5525313", "0.5523326", "0.55126345", "0.55126345", "0.55126345", "0.55126345", "0.55126345", "0.54921156", "0.5473679", "0.5463945", "0.5463783", "0.544145", "0.544114", "0.544114", "0.54375386", "0.5423603", "0.54124045", "0.54078674", "0.5394516", "0.53909427", "0.5390234", "0.5383356", "0.53704196", "0.53694284", "0.53591454", "0.53362966", "0.532629", "0.532629", "0.532629", "0.532629", "0.532629", "0.532629", "0.53242946", "0.53237534", "0.53236115", "0.5323233", "0.5311854", "0.53058445" ]
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.Count(a, b)\n}", "func Count(s string) int {\n\t// write the code for this func\n\treturn len(strings.Fields(s))\n}", "func (StringService) Count(s string) int {\n\treturn len(s)\n}", "func Count(subString, fullString string) int {\n\tcount := 0\n\tfor _, s := range utils.AllSubstrings(fullString) {\n\t\tif MatchString(subString, s) { // need to reconstruct the nfa for each substring\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}", "func NumOccurrences(s string, c byte) int {\n\tvar n int\n\tfor i := 0; i < len(s); i++ {\n\t\tif s[i] == c {\n\t\t\tn++\n\t\t}\n\t}\n\treturn n\n}", "func (s *String) Count() int {\n\treturn len(s.s)\n}", "func Count(s string) int {\n\txs := strings.Fields(s)\n\treturn len(xs)\n}", "func Count(s string) int {\n\txs := strings.Fields(s)\n\treturn len(xs)\n}", "func calcStringCountSum(countText bool, count, sum float64, num, arg formulaArg) (float64, float64) {\n\tif countText && num.Type == ArgError && arg.String != \"\" {\n\t\tcount++\n\t}\n\tif num.Type == ArgNumber {\n\t\tsum += num.Number\n\t\tcount++\n\t}\n\treturn count, sum\n}", "func Count(s string) int {\n\treturn utf8.RuneCountInString(s)\n}", "func In(text string) int {\n\n\t// Prepare input text by converting to lowercase\n\t// and removing all non-alphabetic runes\n\ttext = strings.ToLower(text)\n\ttext = expressionNonalphabetic.ReplaceAllString(text, \"\")\n\n\t// Return early when possible\n\tif len(text) < 1 {\n\t\treturn 0\n\t}\n\tif len(text) < 3 {\n\t\treturn 1\n\t}\n\n\t// If value is part of cornercases,\n\t// return hardcoded value\n\tif syllables, ok := cornercases[text]; ok {\n\t\treturn syllables\n\t}\n\n\t// Initialize counter\n\tc := counter{}\n\n\t// Count and remove matched prefixes and suffixes\n\ttext = expressionTriple.ReplaceAllStringFunc(text, c.countAndRemove(3))\n\ttext = expressionDouble.ReplaceAllStringFunc(text, c.countAndRemove(2))\n\ttext = expressionSingle.ReplaceAllStringFunc(text, c.countAndRemove(1))\n\n\t// Count multiple consanants\n\tc.parts = consanants.Split(text, -1)\n\tc.index = 0\n\tc.length = len(c.parts)\n\n\tfor ; c.index < c.length; c.index++ {\n\t\tif c.parts[c.index] != \"\" {\n\t\t\tc.count++\n\t\t}\n\t}\n\n\t// Subtract one for maches which should be\n\t// counted as one but are counted as two\n\tsubtractOne := c.countInPlace(-1)\n\texpressionMonosyllabicOne.ReplaceAllStringFunc(text, subtractOne)\n\texpressionMonosyllabicTwo.ReplaceAllStringFunc(text, subtractOne)\n\n\t// Add one for maches which should be\n\t// counted as two but are counted as one\n\taddOne := c.countInPlace(1)\n\texpressionDoubleSyllabicOne.ReplaceAllStringFunc(text, addOne)\n\texpressionDoubleSyllabicTwo.ReplaceAllStringFunc(text, addOne)\n\texpressionDoubleSyllabicThree.ReplaceAllStringFunc(text, addOne)\n\texpressionDoubleSyllabicFour.ReplaceAllStringFunc(text, addOne)\n\n\tif c.count < 1 {\n\t\treturn 1\n\t}\n\treturn c.count\n}", "func findCountStr(str, regExpression string) []rowStore {\n\tstoreElements := []rowStore{}\n\tre := regexp.MustCompile(regExpression)\n\tsubmatchall := re.FindAllString(str, -1)\n\tfor _, element := range submatchall {\n\t\tcounted := strings.Count(str, element)\n\t\tstoreElements = appendIfMissing(storeElements, rowStore{counted, 0, 0, element}) // fmt.Sprintf(`%q`, element)})\n\t}\n\t// Sort slice higher to lower\n\tsort.Slice(storeElements, func(i, j int) bool {\n\t\treturn storeElements[i].Idx > storeElements[j].Idx\n\t})\n\treturn storeElements\n}", "func CountTwo(s string) int {\n\tc := 0\n\tm := UseCount(s)\n\tfor _, v := range m {\n\t\tc += v\n\t}\n\treturn c\n}", "func (it MyString) MyCount() int {\n\treturn len(it)\n}", "func Counter(str string) int {\n\tif len(str) == 0 {\n\t\treturn 0\n\t}\n\t\n\tvar count, index, brk int\n\trunes := []rune(str)\n\t\n\tl := len(runes)\n\t\n\tfor {\n\t\tbrk = nextBreak(str, index)\n\t\tif brk < l {\n\t\t\tindex = brk\n\t\t\tcount++\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\t\n\tif index < l {\n\t\tcount++\n\t}\n\treturn count\n}", "func Count(spin string) int {\n\tcount := 1\n\tmatches := re.FindAllString(spin, -1)\n\tfor _, match := range matches {\n\t\tparts := strings.Split(match[1:len(match)-1], \"|\")\n\t\tif len(parts) >= 1 {\n\t\t\tcount *= len(parts)\n\t\t}\n\t}\n\treturn count\n}", "func execRuneCountInString(_ int, p *gop.Context) {\n\targs := p.GetArgs(1)\n\tret := utf8.RuneCountInString(args[0].(string))\n\tp.Ret(1, ret)\n}", "func CountI(s, substr string) int {\n\treturn strings.Count(ToLower(s), ToLower(substr))\n}", "func countSubstrings(s string) int {\n\tl := len(s)\n\tif l <= 0 {\n\t\treturn 0\n\t}\n\n\tcount := 0\n\n\textend := func(left int, right int) {\n\t\tfor left >= 0 && right < l && s[left] == s[right] {\n\t\t\tleft--\n\t\t\tright++\n\t\t\tcount++\n\t\t}\n\t}\n\n\tfor mid := 0; mid < l; mid++ {\n\t\textend(mid, mid)\n\t\textend(mid, mid+1)\n\t}\n\n\treturn count\n}", "func Count(numStr string) (total float64) {\n\ts := strings.Split(numStr, \",\")\n\tfor num := range s {\n\t\ttotal += float64(num)\n\t}\n\treturn\n}", "func wordCount(str string) int {\n\treturn len(strings.Fields(str))\n}", "func CountDiff(firstchar string, secondchar string) int {\n\tc1 := sha256.Sum256([]byte(firstchar))\n\tc2 := sha256.Sum256([]byte(secondchar))\n\tfor i := range c1 {\n\t\tc1[i] = c1[i] ^ c2[i]\n\t}\n\treturn countbitByte(c1)\n}", "func (s StringCount) Len() int {\n return len(s)\n}", "func stringConstruction(a, b string) int {\n\tcount := 0\n\n\trepetitions := make(map[rune]int)\n\tfor _, char := range b {\n\t\trepetitions[char]++\n\t}\n\n\tfor {\n\t\tfor _, char := range a {\n\t\t\tif repetitions[char] > 0 {\n\t\t\t\trepetitions[char]--\n\t\t\t} else {\n\t\t\t\treturn count\n\t\t\t}\n\t\t}\n\t\tcount++\n\t}\n}", "func Count(name string, usage string) *int {\n\treturn CommandLine.CountP(name, \"\", usage)\n}", "func Count(diagrama []string) int {\n\n\t\n\taltura := len(diagrama)\n\n\tif altura == 0 {\n\t\treturn 0\n\t}\n\n\tlargura, count := len(diagrama[0]), 0\n\n\t\n\tfor y := 0; y < altura-1; y++ {\n\t\tfor x := 0; x < largura-1; x++ {\n\t\t\tif diagrama[y][x] == '+' {\n\t\t\t\t\n\t\t\t\tcount += Search(x, y, largura, altura, diagrama)\n\t\t\t}\n\t\t}\n\t}\n\treturn count\n}", "func parseCount(s string) int {\n\tvar n int64 = 1\n\tvar err error\n\tif len(s) > 0 {\n\t\tn, err = strconv.ParseInt(s, 10, 32)\n\t\tif err != nil {\n\t\t\tpanic(\"could not parse action multiplier\")\n\t\t}\n\t}\n\treturn int(n)\n}", "func countWords(str string) int {\n\tword := regexp.MustCompile(\"\\\\S+\")\n\ts := word.FindAllString(str, -1)\n\treturn len(s)\n}", "func execRuneCount(_ int, p *gop.Context) {\n\targs := p.GetArgs(1)\n\tret := utf8.RuneCount(args[0].([]byte))\n\tp.Ret(1, ret)\n}", "func CountEscapeCharacters(str string) (result int) {\n\tactive := false\n\tfor _, s := range str {\n\t\tif !active && s == '\\\\' {\n\t\t\tresult++\n\t\t\tactive = true\n\t\t} else {\n\t\t\tactive = false\n\t\t}\n\t}\n\treturn result\n}", "func countRegexFrequency(matcher, text string) int {\n\tregex := regexp.MustCompile(matcher)\n\tmatches := regex.FindAllStringSubmatch(text, -1)\n\n\treturn len(matches)\n}", "func countingValleys(n int32, s string) int32 {\n\n l, v := 0, 0\n s = strings.ToLower(s)\n for _, r := range s {\n\n if r == 'u' {\n if l < 0 && l+1 == 0 {\n v++\n }\n l++\n\n } else {\n l--\n }\n }\n return int32(v)\n}", "func (insn X86Instruction) OpCount(optype uint) int {\n\tcount := 0\n\tfor _, op := range insn.Operands {\n\t\tif op.Type == optype {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}", "func (m MultiSet) Count (val string) int {\n\tcount := 0\n\tfor _, num := range m {\n\t\tint_val, _ := strconv.Atoi(val)\n\t\tif num == int_val {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}", "func countFreq(s string) map[rune]int {\n\tfreqMap := make(map[rune]int)\n\tfor _, c := range s {\n\t\tfreqMap[c] += 1\n\t}\n\treturn freqMap\n}", "func handleCount(args ...string) (string, error) {\n\tval := args[0]\n\n\tcnt, err := GetCurrentStore().Count(val)\n\treturn fmt.Sprintf(\"%d\", cnt), err\n}", "func countSubstrings(s string) int {\n\tsSplit := strings.Split(s, \"\")\n\tprevData := make([][]bool, len(sSplit))\n\tvar trueCount int\n\tfor i := 0; i < len(prevData); i++ {\n\t\tprevData[i] = make([]bool, len(sSplit))\n\t\tprevData[i][i] = true\n\t\ttrueCount++\n\t}\n\tfor i := 1; i < len(sSplit); i++ {\n\t\tfor j := 0; j < len(sSplit)-i; j++ {\n\t\t\tstartIndex := j\n\t\t\tendIndex := j + i\n\t\t\tif startIndex+1 >= endIndex {\n\t\t\t\tif sSplit[startIndex] == sSplit[endIndex] {\n\t\t\t\t\tprevData[startIndex][endIndex] = true\n\t\t\t\t\ttrueCount++\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif prevData[startIndex+1][endIndex-1] == true && sSplit[startIndex] == sSplit[endIndex] {\n\t\t\t\tprevData[startIndex][endIndex] = true\n\t\t\t\ttrueCount++\n\t\t\t}\n\t\t}\n\t}\n\treturn trueCount\n}", "func (String) Length(c *compiler.Compiler, this compiler.Expression) (expression compiler.Expression) {\n\texpression = c.NewExpression()\n\texpression.Type = Integer{}\n\texpression.Go.WriteString(`ctx.CountString(`)\n\texpression.Go.WriteB(this.Go)\n\texpression.Go.WriteString(`)`)\n\treturn expression\n}", "func CountStrInList(StrList []string, str string) (cnt int) {\n logger.Debug(\"start\")\n\n //----------------------------------------------------------------------------\n // Define variables\n //----------------------------------------------------------------------------\n // Declare variables\n // var cnt int <- named return value\n\n // Set variables\n cnt = 0\n\n //----------------------------------------------------------------------------\n // Confiure function for recover\n //----------------------------------------------------------------------------\n defer func() {\n logger.Debug(\"defer start\")\n r := recover()\n if r != nil {\n logger.Error(\"err = %v\", r)\n }\n logger.Debug(\"defer end\")\n }()\n\n //----------------------------------------------------------------------------\n // Check whether str is in str_list\n //----------------------------------------------------------------------------\n for _, s := range StrList {\n if str == s {\n logger.Debug(\"MATCH : [%v]\", s)\n cnt++\n } else {\n logger.Debug(\"NOT MATCH: [%v]\", s)\n }\n }\n\n logger.Debug(\"start\")\n return cnt\n}", "func (d *DeltaStrSet) Count() int {\n\treturn len(d.items)\n}", "func countOccurences(cards []string, thing string) int {\n\tcount := 0\n\tfor _, item := range cards {\n\t\tif item == thing {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}", "func UseCount(s string) map[string]int {\n\txs := strings.Fields(s)\n\tm := make(map[string]int)\n\tfor _, v := range xs {\n\t\tm[v]++\n\t}\n\treturn m\n}", "func UseCount(s string) map[string]int {\n\txs := strings.Fields(s)\n\tm := make(map[string]int)\n\tfor _, v := range xs {\n\t\tm[v]++\n\t}\n\treturn m\n}", "func UseCount(s string) map[string]int {\n\txs := strings.Fields(s)\n\tm := make(map[string]int)\n\tfor _, v := range xs {\n\t\tm[v]++\n\t}\n\treturn m\n}", "func countCharsFast(s string, want int) int {\n\tfor _, c := range s {\n\t\tif count := strings.Count(s, string(c)); count == want {\n\t\t\treturn 1\n\t\t}\n\t}\n\n\treturn 0\n}", "func countSubstrings(s string) int {\n\t// 马拉车算法:马拉车算法可以在线性时间内找出以任何位置为中心的最大回文串\n\n\n\t// 中心法:在长度为 N 的字符串中,可能的回文串中心位置有 2N-1 个:字母,或两个字母中间\n\t//count := 0\n\t//n := len(s)\n\t//for i := 0; i < (n<<1 - 1); i++ {\n\t//\tfor l, r := i>>1, (i+1)>>1; l >= 0 && r < n && s[l] == s[r]; l, r = l-1, r+1 {\n\t//\t\tcount++\n\t//\t}\n\t//}\n\t//return count\n\n\t// 双指针\n\t//length := 0\n\t//n := len(s)\n\t//for i := 0; i < n-1; i++ {\n\t//\tfor j := i + 1; j < n; j++ {\n\t//\t\tfor m, n := i, j; m < n; m, n = m+1, n-1 {\n\t//\t\t\tif s[m] != s[n] {\n\t//\t\t\t\tgoto out\n\t//\t\t\t}\n\t//\t\t}\n\t//\t\tlength++\n\t//\tout:\n\t//\t}\n\t//}\n\t//return length + n\n}", "func countWordLenByAppend(str string) []int {\n\tcount := []int{}\n\tfor _, s := range strings.Split(str, \" \") {\n\t\tcount = append(count, len(s))\n\t}\n\treturn count\n}", "func (m *mcq) countAND() int {\n\tcount := 0\n\tfor _, v := range m.answer {\n\t\tif v == m.groupsize {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}", "func countCharsSlow(s string, want int) int {\n\tchars := strings.Split(s, \"\")\n\n\tfor _, c := range chars {\n\t\tif count := strings.Count(s, c); count == want {\n\t\t\treturn 1\n\t\t}\n\t}\n\n\treturn 0\n}", "func countCharacters(words []string, chars string) int {\n sum := 0\n m := [26]byte{}\n for _, v := range chars {\n m[v-'a']+=1\n }\n for _, v := range words {\n sum += len(v)\n m2 := [26]byte{}\n for _, j := range v {\n m2[j-'a']+=1\n if m2[j-'a'] > m[j-'a'] {\n sum -= len(v)\n break\n }\n }\n }\n return sum\n}", "func calculate(s string) int {\n\tlastOperand := \" \"\n\tvar result int\n\tfields := strings.Split(strings.ReplaceAll(strings.ReplaceAll(s, \"(\", \"\"), \")\", \"\"), \" \")\n\tfor _, c := range fields {\n\t\tif c == \"+\" || c == \"*\" {\n\t\t\tlastOperand = c\n\t\t} else {\n\t\t\tnumber := toInt(c)\n\t\t\tswitch lastOperand {\n\t\t\tcase \" \":\n\t\t\t\tresult = number\n\t\t\tcase \"+\":\n\t\t\t\tresult += number\n\t\t\tcase \"*\":\n\t\t\t\tresult *= number\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func WordCount(s string) Frequency {\n\twords := wordRegex.FindAllString(s, -1)\n\tresult := make(Frequency)\n\tfor _, word := range words {\n\t\tresult[strings.ToLower(word)]++\n\t}\n\treturn result\n}", "func countInitialOccurrences(s []byte, x byte) int {\n\tfor i, c := range s {\n\t\tif c != x {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn len(s)\n}", "func Count() AggregateFunc {\n\treturn func(start, end string) (string, *dsl.Traversal) {\n\t\tif end == \"\" {\n\t\t\tend = DefaultCountLabel\n\t\t}\n\t\treturn end, __.As(start).Count(dsl.Local).As(end)\n\t}\n}", "func main() {\n\t// currently it prints 17\n\t// it should print 5\n\n\tname := \"inanç \"\n\tfmt.Println(utf8.RuneCountInString(strings.TrimRight(name, \" \")))\n}", "func CountUniqueCharacters(str string) int {\n\tcounter := make(map[int32]int)\n\n\tfor _, value := range str {\n\t\tcounter[value]++\n\t}\n\n\treturn len(counter)\n}", "func Count_character(input_str string) int {\n\ttemp_str := Clean_up(input_str)\n\ttemp_arr := strings.Split(temp_str, \"\")\n\treturn len(temp_arr) \n}", "func diffStrings(a, b string) (string, int) {\n\tcount := 0\n\tsame := \"\"\n\n\tfor i := 0; i < len(a); i++ {\n\t\tif a[i] == b[i] {\n\t\t\tsame += string(a[i])\n\t\t} else {\n\t\t\tcount++\n\t\t}\n\t}\n\n\treturn same, count\n}", "func numDistinct(s string, t string) int {\n\tdp := make([][]int, 0)\n\tfor i := 0; i <= len(s); i ++ {\n\t\ttmp := make([]int, len(t)+1, len(t)+1)\n\t\tdp = append(dp, tmp)\n\t}\n\n\tfor i := 0; i < len(s); i ++ {\n\t\tdp[i][0] = 1\n\t}\n\n\tfor i := 1; i <= len(s); i ++ {\n\t\tfor j := 1; j <= len(t); j ++ {\n\t\t\tif s[i-1] == t[j-1] {\n\t\t\t\tdp[i][j] = dp[i-1][j-1] + dp[i-1][j]\n\t\t\t} else {\n\t\t\t\tdp[i][j] = dp[i-1][j]\n\t\t\t}\n\t\t}\n\t}\n\treturn dp[len(s)][len(t)]\n}", "func (s *String) BitCount(begin, end int) (int, error) {\n\tbegin, end = initCursor(begin, end, len(s.Meta.Value))\n\tif begin > end {\n\t\treturn 0, nil\n\t}\n\treturn redisPopcount(s.Meta.Value[begin : end+1]), nil\n}", "func countWordLenCallByReference(count []int, ss []string) []int {\n\tif len(ss) == 0 {\n\t\treturn count\n\t}\n\treturn countWordLenCallByReference(append(count, len(ss[0])), ss[1:])\n}", "func countWordLenByCounter(str string) []int {\n\tif len(str) == 0 {\n\t\treturn []int{0}\n\t}\n\tstr = strings.Replace(str, \",\", \"\", -1)\n\n\tcount := []int{}\n\tcounter := 0\n\tfor _, s := range str {\n\t\tif (s != ' ') && (s != '.') {\n\t\t\tcounter++\n\t\t\tcontinue\n\t\t}\n\t\tcount = append(count, counter)\n\t\tcounter = 0\n\t}\n\treturn count\n}", "func (c *Counter) Count(b []byte) {\n\tfor i := 0; i < len(b); i++ {\n\t\tswitch b[i] {\n\t\t// '\\' means to concat next line\n\t\tcase '\\\\':\n\t\t\t//len(b)-2 because len(b)-1 is \"\\n\", we take line-break into consideration\n\t\t\tif i == len(b)-1 || i == len(b)-2 {\n\t\t\t\tc.NextLineConcats = 1\n\t\t\t\tbreak\n\t\t\t}\n\t\tcase '{':\n\t\t\tc.CurlyBrackets++\n\t\tcase '}':\n\t\t\tc.CurlyBrackets--\n\t\tcase '(':\n\t\t\tc.Parentheses++\n\t\tcase ')':\n\t\t\tc.Parentheses--\n\t\tcase '[':\n\t\t\tc.SquareBrackets++\n\t\tcase ']':\n\t\t\tc.SquareBrackets--\n\t\t}\n\t}\n}", "func countBinarySubstrings(s string) int {\n\tcount := 0\n\tfor i := 0; i < len(s)-1; i++ {\n\t\tif s[i]^s[i+1] == 1 {\n\t\t\tindex := 0\n\t\t\tfor i-index >= 0 && i+1+index < len(s) &&\n\t\t\t\ts[i] == s[i-index] && s[i+1] == s[i+1+index] {\n\t\t\t\tcount++\n\t\t\t\tindex++\n\t\t\t}\n\t\t}\n\t}\n\treturn count\n}", "func countingValleys(n int32, s string) int32 {\n depth := 0\n valley := 0\n for i := 0; int32(i) < n; i++ {\n if s[i] == 'U' {\n depth++\n }\n if s[i] == 'D' {\n depth--\n }\n\n if depth == 0 && s[i] == 'U' {\n valley++\n }\n }\n return int32(valley)\n}", "func CountP(name, shorthand string, usage string) *int {\n\treturn CommandLine.CountP(name, shorthand, usage)\n}", "func dupCount2(word string) (c int) {\n\th := map[rune]int{}\n\tstr := strings.ToLower(word)\n\tfor _, r := range str {\n\t\tif h[r]++; h[r] == 2 {\n\t\t\tc++\n\t\t}\n\t}\n\treturn\n}", "func Distance(a, b string) (int, error) {\n if len(a) != len(b) {\n return 0, errors.New(\"Input string have different lengths.\")\n }\n var distance int\n for index, char := range a {\n if string(char) != string(b[index]){\n distance += 1\n }\n }\n return distance, nil\n}", "func CountIgnoreCase(haystack io.Reader, needle string) (int, error) {\n\toccurrences, err := FindIgnoreCase(haystack, needle)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn len(occurrences), nil\n}", "func (c *cBinaryExpr) stringsCount0() {\n\tc.stringsBytesCount0(\"strings\")\n}", "func Frequency(s string) FreqMap {\n m := FreqMap{}\n for _, r := range s {\n m[r]++\n }\n return m\n}", "func Counter(phrases []string, accumulator func(string) bool) int {\n\tch := make(chan int, len(phrases))\n\tnum := 0\n\tfor _, pp := range phrases {\n\t\tgo func(phrase string) {\n\t\t\tif accumulator(phrase) {\n\t\t\t\tch <- 1\n\t\t\t} else {\n\t\t\t\tch <- 0\n\t\t\t}\n\t\t}(pp)\n\t}\n\tfor range phrases {\n\t\tnum += <-ch\n\t}\n\treturn num\n}", "func countCompress(str string) (count int) {\n\tfor i := 0; i < len(str); {\n\t\tn := compressFrom(str, i)\n\t\ti += n\n\t\tcount += 2\n\t}\n\treturn\n}", "func countOccurrences(msg string) map[string]int {\n\thashMap := make(map[string]int)\n\ttChar := strings.Split(msg, \"\")\n\tfor _, char := range tChar {\n\t\tif hashMap[char] == 0 {\n\t\t\thashMap[char] = 1\n\t\t} else {\n\t\t\thashMap[char]++\n\t\t}\n\t}\n\treturn hashMap\n}", "func Repeat(count int, operand string) string { return strings.Repeat(operand, count) }", "func Count(metric_in, m1Prefix string) (metric_out string) {\n\tv := GetVersion(metric_in)\n\tif v == M20 {\n\t\tparts := strings.Split(metric_in, \".\")\n\t\tttSeen := false\n\t\tfor i, part := range parts {\n\t\t\tif strings.HasPrefix(part, \"target_type=\") {\n\t\t\t\tttSeen = true\n\t\t\t\tparts[i] = \"target_type=count\"\n\t\t\t}\n\t\t}\n\t\tif !ttSeen {\n\t\t\tparts = append(parts, \"target_type=count\")\n\t\t}\n\t\tmetric_out = strings.Join(parts, \".\")\n\t} else if v == M20NoEquals {\n\t\tparts := strings.Split(metric_in, \".\")\n\t\tttSeen := false\n\t\tfor i, part := range parts {\n\t\t\tif strings.HasPrefix(part, \"target_type_is_\") {\n\t\t\t\tttSeen = true\n\t\t\t\tparts[i] = \"target_type_is_count\"\n\t\t\t}\n\t\t}\n\t\tif !ttSeen {\n\t\t\tparts = append(parts, \"target_type_is_count\")\n\t\t}\n\t\tmetric_out = strings.Join(parts, \".\")\n\t} else {\n\t\tmetric_out = m1Prefix + metric_in + \".count\"\n\t}\n\treturn\n}", "func CountChars(str string, noSpace ...bool) map[string]int {\n\tm := make(map[string]int)\n\tcountSpace := true\n\tif len(noSpace) > 0 && noSpace[0] {\n\t\tcountSpace = false\n\t}\n\tfor _, r := range []rune(str) {\n\t\tif !countSpace && unicode.IsSpace(r) {\n\t\t\tcontinue\n\t\t}\n\t\tm[string(r)]++\n\t}\n\treturn m\n}", "func Distance(a, b string) (int, error) {\n\tif len(a) != len(b) {\n\t\treturn 0, errors.New(\"strings must be of equal length\")\n\t}\n\n\tcount := 0\n\tfor i := 0; i < len(a); i++ {\n\t\tif a[i] != b[i] {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count, nil\n}", "func (cMap *MyStruct) GetCount(word string) int{\n\tcMap.asking <- word\n\tcount := <- cMap.temp\n\tfmt.Println(\"Word Count for \",word, \"is \",count)\n\treturn count\n}", "func Test_Count(t *testing.T) {\n\tparser := NewDefault()\n\tdocument, _, err := parser.Parse(\"count.tf\", []byte(count))\n\trequire.NoError(t, err)\n\trequire.Len(t, document, 1)\n\trequire.Contains(t, document[0], \"resource\")\n\trequire.Contains(t, document[0][\"resource\"].(model.Document)[\"aws_instance\"], \"server1\")\n\trequire.NotContains(t, document[0][\"resource\"].(model.Document)[\"aws_instance\"], \"server\")\n}", "func (word ControlWord) Count() int {\n\treturn int((uint32(word) >> 20) & 0xF)\n}", "func findCount(st string) []letterCount {\r\n\tletterCountStorage := []letterCount{}\r\n\tvar i int\r\n\tfor i < len(st) {\r\n\t\ttmp := st[i]\r\n\t\tj := 1\r\n\t\tfor ; i+j < len(st) && tmp == st[i+j]; j++ {\r\n\t\t}\r\n\t\tletterCountStorage = append(letterCountStorage, letterCount{Letter: st[i], Count: j})\r\n\t\ti += j\r\n\t}\r\n\treturn letterCountStorage\r\n}", "func Distance(a, b string) (int, error) {\n\tif len(a) != len(b) {\n\t\treturn 0, errors.New(\"shit's on fire yo (and the strings should be the same length)\")\n\t}\n\n\tctr := 0\n\tfor i := 0; i < len(a); i++ {\n\t\tif a[i] != b[i] {\n\t\t\tctr++\n\t\t}\n\t}\n\treturn ctr, nil\n}", "func vowelCount(str string) int {\n\tarr := [5]string{\"a\", \"e\", \"i\", \"o\", \"u\"}\n\tcount := 0\n\tsplitStr := strings.Split(str, \"\")\n\tfor i := 0; i < len(splitStr); i++ {\n\t\tfor _, val := range arr {\n\t\t\tif splitStr[i] == val {\n\t\t\t\tcount += 1\n\t\t\t}\n\t\t}\n\t}\n\treturn count\n}", "func (dna DNA) Count(nucleotide string) (int, error) {\n\tnucleotides := map[string]bool{\"A\": true, \"T\": true, \"G\": true, \"C\": true}\n\n\tif !nucleotides[nucleotide] {\n\t\treturn 0, fmt.Errorf(\"INVALID NUCLEOTIDE ENTRY: %s\", nucleotide)\n\t}\n\n\tcumsum := 0\n\tfor _, value := range dna.sequence {\n\t\tif nucleotide == string(value) {\n\t\t\tcumsum++\n\t\t}\n\t}\n\treturn cumsum, nil\n}", "func LenStrs(ss []string) int {\n\tn := 2\n\tfor _, s := range ss {\n\t\tn += LenStr(s)\n\t}\n\treturn n\n}", "func numDistinct(s string, t string) int {\n\tm, n := len(s), len(t)\n\tdp := make([]int, m+1)\n\tfor i := 0; i <= m; i++ {\n\t\tdp[i] = 1\n\t}\n\n\tvar prev int\n\tfor j := 0; j < n; j++ {\n\t\tdp[j], prev = 0, dp[j]\n\n\t\tfor i := j + 1; i <= m; i++ {\n\t\t\tif t[j] == s[i-1] {\n\t\t\t\tdp[i], prev = dp[i-1]+prev, dp[i]\n\t\t\t} else {\n\t\t\t\tdp[i], prev = dp[i-1], dp[i]\n\t\t\t}\n\t\t}\n\t}\n\treturn dp[m]\n}", "func WordCount(phrase string) Frequency {\n\tvar f Frequency = make(Frequency)\n\tphrase = strings.ToLower(phrase)\n\n\tre := regexp.MustCompile(\"[a-z0-9]+('[a-z0-9]+|[a-z0-9]*)\")\n\twords := re.FindAllString(phrase, -1)\n\n\tfor _, v := range words {\n\t\tif len(v) > 0 {\n\t\t\tf[v]++\n\t\t}\n\n\t}\n\treturn f\n}", "func WordsCount() {\n\tvar mutex = &sync.Mutex{}\n\tvar counter = make(map[string]int)\n\tvar inputs = readInputParams()\n\tvar paths = getValidPaths(inputs)\n\n\tresources := make([]interface{}, len(paths))\n\tfor i, path := range paths {\n\t\tresources[i] = path\n\t}\n\tpool := workerpool.NewPool(numWorkers)\n\tpool.Start(resources, count(counter, mutex), resultsCollector)\n\n\tfmt.Println(counter)\n}", "func wordCount(s string) map[string]int {\n\tt := re.FindAllStringSubmatch(s, -1)\n\tif t == nil {\n\t\treturn nil\n\t}\n\n\thash := make(map[string]int)\n\tfor i := 0; i < len(t); i++ {\n\t\tword := t[i][1]\n\t\tif _, ok := hash[word]; ok {\n\t\t\thash[word]++\n\t\t} else {\n\t\t\thash[word] = 1\n\t\t}\n\t}\n\n\treturn hash\n}", "func StringsCountMoreThan(s []string, c string, n int) bool {\n\tfor _, x := range s {\n\t\tif strings.Count(x, c) > n {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (wq *WordQuery) Count(ctx context.Context) (int, error) {\n\tif err := wq.prepareQuery(ctx); err != nil {\n\t\treturn 0, err\n\t}\n\treturn wq.sqlCount(ctx)\n}", "func Count(v Value) int {\n\tif c, ok := v.(CountedSequence); ok {\n\t\treturn c.Count()\n\t}\n\tpanic(ErrStr(ExpectedCounted, v))\n}", "func Operator(input string) int {\n\tvar o string = \"+-*/%^\"\n\n\treturn strings.IndexAny(input, o)\n}", "func WordCount(s string) map[string]int {\n \n\twords := strings.Fields(s)\n wordCountMap := make(map[string]int)\n \n for _,word := range words{\n wordCountMap[word]++ \n }\n \n return wordCountMap\n}", "func TestCountPalindromicSubstring() {\n\tfmt.Println(countPalindromicSubstring(\"abdbca\"))\n\tfmt.Println(countPalindromicSubstring(\"cddpd\"))\n\tfmt.Println(countPalindromicSubstring(\"pqr\"))\n\tfmt.Println(countPalindromicSubstring(\"qqq\"))\n}", "func Distance(a, b string) (int, error) {\n\tcounter := 0\n\tar, br := []rune(a), []rune(b)\n\tif len(ar) != len(br) {\n\t\treturn 0, errors.New(\"The length of the strands are different\")\n\t}\n\tfor i := range ar {\n\t\tif ar[i] != br[i] {\n\t\t\tcounter++\n\t\t}\n\t}\n\treturn counter, nil\n}" ]
[ "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.5894888", "0.5837097", "0.5759546", "0.57099354", "0.56818", "0.5675904", "0.5667394", "0.5645932", "0.56444377", "0.5644043", "0.56241834", "0.56089336", "0.55794686", "0.55626136", "0.55623573", "0.5532968", "0.5527368", "0.55183196", "0.54945594", "0.54780096", "0.5465832", "0.54399604", "0.5436888", "0.5421557", "0.5421557", "0.5421557", "0.5415607", "0.5391332", "0.5388891", "0.53810656", "0.5377161", "0.53580874", "0.53478897", "0.53439444", "0.53263324", "0.53258425", "0.5325273", "0.5323937", "0.531052", "0.53020555", "0.5300798", "0.5293686", "0.5291213", "0.5285628", "0.52802294", "0.5269021", "0.52665114", "0.5265407", "0.52544355", "0.52478254", "0.524316", "0.5237428", "0.52182066", "0.5210505", "0.52053565", "0.520124", "0.51984406", "0.519757", "0.5193268", "0.5191189", "0.51905143", "0.5190504", "0.51737595", "0.5156197", "0.5144803", "0.5133043", "0.5128586", "0.51268554", "0.51243", "0.5107436", "0.5101347", "0.5098404", "0.50960815", "0.50925887", "0.5084339", "0.50753427", "0.5071128", "0.50669885", "0.50629085" ]
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\tcontinue\n\t\t}\n\t\tdata = append(data, v)\n\t}\n\n\treturn data\n}", "func splitFields(line string) []string {\n\tparts := strings.Fields(line)\n\n\t// Add empty field if the last field was completed.\n\tif len(line) > 0 && unicode.IsSpace(rune(line[len(line)-1])) {\n\t\tparts = append(parts, \"\")\n\t}\n\n\t// Treat the last field if it is of the form \"a=b\"\n\tparts = splitLastEqual(parts)\n\treturn parts\n}", "func (s *SplitScanner) Fields() []string {\n\treturn strings.Split(s.Text(), s.sep)\n}", "func getFields(fields string) []string {\n\treturn strings.Split(fields, \",\")\n}", "func parseFields(s string) (fs []Widget) {\n\tfor _, p := range pairs(s) {\n\t\tfs = append(fs, Widget{Field: Field{Label: p[0], Content: p[1]}})\n\t}\n\treturn\n}", "func SplitQuotedFields(in string) []string {\n\ttype stateEnum int\n\tconst (\n\t\tinSpace stateEnum = iota\n\t\tinField\n\t\tinQuote\n\t\tinQuoteEscaped\n\t)\n\tstate := inSpace\n\tr := []string{}\n\tvar buf bytes.Buffer\n\n\tfor _, ch := range in {\n\t\tswitch state {\n\t\tcase inSpace:\n\t\t\tif ch == '\\'' {\n\t\t\t\tstate = inQuote\n\t\t\t} else if !unicode.IsSpace(ch) {\n\t\t\t\tbuf.WriteRune(ch)\n\t\t\t\tstate = inField\n\t\t\t}\n\n\t\tcase inField:\n\t\t\tif ch == '\\'' {\n\t\t\t\tstate = inQuote\n\t\t\t} else if unicode.IsSpace(ch) {\n\t\t\t\tr = append(r, buf.String())\n\t\t\t\tbuf.Reset()\n\t\t\t} else {\n\t\t\t\tbuf.WriteRune(ch)\n\t\t\t}\n\n\t\tcase inQuote:\n\t\t\tif ch == '\\'' {\n\t\t\t\tstate = inField\n\t\t\t} else if ch == '\\\\' {\n\t\t\t\tstate = inQuoteEscaped\n\t\t\t} else {\n\t\t\t\tbuf.WriteRune(ch)\n\t\t\t}\n\n\t\tcase inQuoteEscaped:\n\t\t\tbuf.WriteRune(ch)\n\t\t\tstate = inQuote\n\t\t}\n\t}\n\n\tif buf.Len() != 0 {\n\t\tr = append(r, buf.String())\n\t}\n\n\treturn r\n}", "func splitFields(line []byte) []string {\n\tallFields := make([]string, 0, 8)\n\tvar curField strings.Builder\n\tvar curDigs strings.Builder\n\tvar surrogatePairFirst int\n\n\ttype State int\n\tconst (\n\t\tCopy State = iota\n\t\tCopy2 // Special copy-char state indicating we JUST processed a ':' field separator\n\t\tEsc\n\t\tHex\n\t\tUni\n\t)\n\n\tstate := Copy\n\tsurrogatePairFirst = -1\n\tfor _, c := range line {\n\t\tswitch state {\n\t\tcase Copy:\n\t\t\tif c == '\\\\' {\n\t\t\t\tstate = Esc\n\t\t\t} else if c == ':' {\n\t\t\t\tallFields = append(allFields, curField.String())\n\t\t\t\tcurField.Reset()\n\t\t\t\tstate = Copy2\n\t\t\t} else {\n\t\t\t\tcurField.WriteByte(c)\n\t\t\t}\n\t\tcase Copy2:\n\t\t\tif c == '\\\\' {\n\t\t\t\tstate = Esc\n\t\t\t} else if c == ':' {\n\t\t\t\tallFields = append(allFields, \"\")\n\t\t\t} else {\n\t\t\t\tcurField.WriteByte(c)\n\t\t\t\tstate = Copy\n\t\t\t}\n\t\tcase Esc:\n\t\t\tif c == 'x' {\n\t\t\t\tstate = Hex\n\t\t\t\tcurDigs.Reset()\n\t\t\t} else if c == 'u' {\n\t\t\t\tstate = Uni\n\t\t\t\tcurDigs.Reset()\n\t\t\t} else {\n\t\t\t\tcurField.WriteByte(c)\n\t\t\t\tstate = Copy\n\t\t\t}\n\t\tcase Hex:\n\t\t\tcurDigs.WriteByte(c)\n\t\t\tif curDigs.Len() == 2 {\n\t\t\t\tcode, _ := strconv.ParseUint(curDigs.String(), 16, 8)\n\t\t\t\tcurField.WriteRune(rune(code))\n\t\t\t\tstate = Copy\n\t\t\t}\n\t\tcase Uni:\n\t\t\tcurDigs.WriteByte(c)\n\t\t\tif curDigs.Len() == 4 {\n\t\t\t\t// A 16-bit Unicode codepoint--how hard could it be?\n\t\t\t\trcode, _ := strconv.ParseUint(curDigs.String(), 16, 16)\n\t\t\t\tcode := int(rcode)\n\n\t\t\t\t// Oh the joys of UTF16...\n\t\t\t\tif surrogatePairFirst >= 0 {\n\t\t\t\t\tcode = (code - 0xdc00) + surrogatePairFirst + 0x10000\n\t\t\t\t\tsurrogatePairFirst = -1\n\t\t\t\t}\n\t\t\t\tif (code >= 0xd800) && (code <= 0xdfff) {\n\t\t\t\t\tsurrogatePairFirst = (code - 0xd800) * 0x400\n\t\t\t\t} else {\n\t\t\t\t\tcurField.WriteRune(rune(code))\n\t\t\t\t}\n\t\t\t\tstate = Copy\n\t\t\t}\n\t\t}\n\t}\n\t// Add on one last field if:\n\t// * there is trailing data (normal case)\n\t// * we ended on a ':' separator (corner case)\n\tif (curField.Len() > 0) || (state == Copy2) {\n\t\tallFields = append(allFields, curField.String())\n\t}\n\n\treturn allFields\n}", "func fieldliterals(fields ...string) []Field {\n\tfs := make([]Field, len(fields))\n\tfor i := range fields {\n\t\tfs[i] = FieldLiteral(fields[i])\n\t}\n\treturn fs\n}", "func printFields(input string, delimiter string, fields []int) {\n\tif len(fields) == 0 {\n\t\t// print all the fields, we don't need to split anything\n\t\tfmt.Println(input)\n\t} else {\n\t\tparts := strings.Split(input, delimiter)\n\t\tordered := []string{}\n\t\tfor i := 0; i < len(fields); i++ {\n\t\t\tfield := fields[i] - 1\n\t\t\tif field < len(parts) {\n\t\t\t\tordered = append(ordered, parts[field])\n\t\t\t}\n\t\t}\n\t\tfmt.Println(strings.Join(ordered, delimiter))\n\t}\n}", "func pragmaFields(s string) []string {\n\tvar a []string\n\tinQuote := false\n\tfieldStart := -1 // Set to -1 when looking for start of field.\n\tfor i, c := range s {\n\t\tswitch {\n\t\tcase c == '\"':\n\t\t\tif inQuote {\n\t\t\t\tinQuote = false\n\t\t\t\ta = append(a, s[fieldStart:i+1])\n\t\t\t\tfieldStart = -1\n\t\t\t} else {\n\t\t\t\tinQuote = true\n\t\t\t\tif fieldStart >= 0 {\n\t\t\t\t\ta = append(a, s[fieldStart:i])\n\t\t\t\t}\n\t\t\t\tfieldStart = i\n\t\t\t}\n\t\tcase !inQuote && isSpace(c):\n\t\t\tif fieldStart >= 0 {\n\t\t\t\ta = append(a, s[fieldStart:i])\n\t\t\t\tfieldStart = -1\n\t\t\t}\n\t\tdefault:\n\t\t\tif fieldStart == -1 {\n\t\t\t\tfieldStart = i\n\t\t\t}\n\t\t}\n\t}\n\tif !inQuote && fieldStart >= 0 { // Last field might end at the end of the string.\n\t\ta = append(a, s[fieldStart:])\n\t}\n\treturn a\n}", "func _fields(args ...interface{}) *ast.FieldList {\n\tlist := []*ast.Field{}\n\tnames := []*ast.Ident{}\n\tlasti := interface{}(nil)\n\tmaybePop := func() {\n\t\tif len(names) > 0 {\n\t\t\tvar last ast.Expr\n\t\t\tif lastte_, ok := lasti.(string); ok {\n\t\t\t\tlast = _x(lastte_)\n\t\t\t} else {\n\t\t\t\tlast = lasti.(ast.Expr)\n\t\t\t}\n\t\t\tlist = append(list, &ast.Field{\n\t\t\t\tNames: names,\n\t\t\t\tType: last,\n\t\t\t})\n\t\t\tnames = []*ast.Ident{}\n\t\t}\n\t}\n\tfor i := 0; i < len(args); i++ {\n\t\tname, ok := args[i].(*ast.Ident)\n\t\tif !ok {\n\t\t\tname = _i(args[i].(string))\n\t\t}\n\t\tte_ := args[i+1]\n\t\ti += 1\n\t\t// NOTE: This comparison could be improved, to say, deep equality,\n\t\t// but is that the behavior we want?\n\t\tif lasti == te_ {\n\t\t\tnames = append(names, name)\n\t\t\tcontinue\n\t\t} else {\n\t\t\tmaybePop()\n\t\t\tnames = append(names, name)\n\t\t\tlasti = te_\n\t\t}\n\t}\n\tmaybePop()\n\treturn &ast.FieldList{\n\t\tList: list,\n\t}\n}", "func fields(s string) (map[string]interface{}, error) {\n\tfields := strings.Split(strings.TrimSpace(s), \"\\t\")\n\tif len(fields) < 1 {\n\t\treturn nil, fmt.Errorf(\"must have at least 1 field\")\n\t}\n\n\tif len(fields)%2 != 1 {\n\t\tfmt.Println(fields)\n\t\treturn nil, fmt.Errorf(\"expected odd number of elements, found %d\", len(fields))\n\t}\n\n\tm := map[string]interface{}{\"event\": fields[0]}\n\n\tfor i := 1; i < len(fields); i += 2 {\n\t\tk := removeQuotes(fields[i])\n\n\t\tv, err := getVal(fields[i+1])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tm[k] = v\n\t}\n\n\treturn m, nil\n}", "func splitTerms(fieldSelector string) []string {\n\tif len(fieldSelector) == 0 {\n\t\treturn nil\n\t}\n\n\tterms := make([]string, 0, 1)\n\tstartIndex := 0\n\tinSlash := false\n\tfor i, c := range fieldSelector {\n\t\tswitch {\n\t\tcase inSlash:\n\t\t\tinSlash = false\n\t\tcase c == '\\\\':\n\t\t\tinSlash = true\n\t\tcase c == ',':\n\t\t\tterms = append(terms, fieldSelector[startIndex:i])\n\t\t\tstartIndex = i + 1\n\t\t}\n\t}\n\n\tterms = append(terms, fieldSelector[startIndex:])\n\n\treturn terms\n}", "func (ds *DefaultSyntax) validateFields(input string) error {\n\ttokens := strings.Split(input, ds.separator)\n\tif len(tokens) != ds.fields {\n\t\treturn errors.New(fmt.Sprintf(\"Number of fields incorrect for %s, found %d and expected %d\", ds.name, len(tokens), ds.fields))\n\t}\n\treturn nil\n}", "func filterFields(mi *modelInfo, fields, filters []string) []string {\n\tvar res []string\n\tfor _, field := range fields {\n\t\tfieldExprs := jsonizeExpr(mi, strings.Split(field, ExprSep))\n\t\tfield = strings.Join(fieldExprs, ExprSep)\n\t\tif len(filters) == 0 {\n\t\t\tres = append(res, field)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, filter := range filters {\n\t\t\tfilterExprs := jsonizeExpr(mi, strings.Split(filter, ExprSep))\n\t\t\tfilter = strings.Join(filterExprs, ExprSep)\n\t\t\tif field == filter {\n\t\t\t\tres = append(res, field)\n\t\t\t}\n\t\t}\n\t}\n\treturn res\n}", "func (ef *EmbdFields) ParseFields(m AnyMessage) {\n\tef.ActionName = m.Action()\n}", "func csvFields(s string) []string {\n\tfields := strings.Split(s, \",\")\n\tfor i, f := range fields {\n\t\tfields[i] = strings.TrimSpace(f)\n\t}\n\treturn fields\n}", "func convertFields(str string) string {\n\tarr := strings.Split(str, \",\")\n\tresult := make([]string, len(arr))\n\tfor i, v := range arr {\n\t\tresult[i] = toSnakeCase(v)\n\t}\n\treturn strings.Join(result, \",\")\n}", "func extractFields(r *rest.Request) ([]string, error) {\n\tif _, filteringRequested := r.URL.Query()[\"fields\"]; !filteringRequested {\n\t\treturn nil, nil\n\t}\n\n\tfieldsValue := r.URL.Query().Get(\"fields\")\n\tif fieldsValue == \"\" {\n\t\treturn []string{}, nil\n\t}\n\n\tfieldsSplit := strings.Split(fieldsValue, \",\")\n\tfields := make([]string, len(fieldsSplit))\n\tfor i, fld := range fieldsSplit {\n\t\tfldName, ok := instanceQueryValuesToFieldNames[fld]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"Field %s is not a valid field\", fld)\n\t\t}\n\n\t\tfields[i] = fldName\n\t}\n\n\treturn fields, nil\n}", "func processField(field string) string {\n\tif isValidOperator(field) {\n\t\treturn field\n\t} else {\n\t\treturn fmt.Sprintf(\"%v.%v\", dataWrapper, field)\n\t}\n}", "func (s *SingleFieldScanner) Fields() []string {\n\tfs := s.LineScanner.Fields()\n\tif n := s.N; n >= 0 && n < len(fs) {\n\t\treturn fs[n : n+1]\n\t}\n\treturn nil\n}", "func formatField(key string, data string) (string, error) {\n\tdelimeter := \"\\n \"\n\tvar buff bytes.Buffer\n\n\t// Initiate it by writing the proper key.\n\twriteLen, err := buff.WriteString(fmt.Sprintf(\"%s: \", key))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tsplitCounter := writeLen\n\n\twords := strings.Split(data, \" \")\n\n\tfor word := range words {\n\t\tif splitCounter+len(words[word]) > 79 {\n\t\t\tsplitCounter, err = buff.WriteString(delimeter)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\t\twriteLen, err = buff.WriteString(strings.Join([]string{\" \", words[word]}, \"\"))\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tsplitCounter += writeLen\n\n\t}\n\n\treturn buff.String(), nil\n}", "func Scan(s string) []string {\n\treturn strings.Split(s, \" \") // wrong\n\t// return strings.Fields(s) // correct\n}", "func readFields(r io.Reader)(o rune,t rune,b int,e int,f int,s string,err error){\nvar l int\nif _,err= fmt.Fscanf(r,\"%c%c%d %d %d %d\",&o,&t,&b,&e,&f,&l);err!=nil{\nreturn\n}\nif l!=0{\nrs:=make([]rune,l)\nfor i:=0;i<l;i++{\nif _,err= fmt.Fscanf(r,\"%c\",&rs[i]);err!=nil{\nreturn\n}\n}\ns= string(rs)\n}\nvar nl[1]byte\nif _,err= r.Read(nl[:]);err!=nil{\nreturn\n}\nreturn\n}", "func (m *SplitMutation) Fields() []string {\n\tfields := make([]string, 0, 3)\n\tif m.execution_date != nil {\n\t\tfields = append(fields, split.FieldExecutionDate)\n\t}\n\tif m.from != nil {\n\t\tfields = append(fields, split.FieldFrom)\n\t}\n\tif m.to != nil {\n\t\tfields = append(fields, split.FieldTo)\n\t}\n\treturn fields\n}", "func StructFields(t reflect.Type) string {\n\tfields := make([]string, 0)\n\tif t.Kind() == reflect.Struct {\n\t\tfor i := 0; i < t.NumField(); i ++ {\n\t\t\tname := t.Field(i).Name\n\t\t\tif t.Field(i).Type.Kind() == reflect.Struct {\n\t\t\t\ts := StructFields(t.Field(i).Type)\n\t\t\t\tf := strings.Split(s, \", \")\n\t\t\t\tleft := FirstLower(name)\n\t\t\t\tfor _, v := range f {\n\t\t\t\t\tfields = append(fields, fmt.Sprintf(\"%s.%s\", left, FirstLower(v)))\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfields = append(fields, FirstLower(name))\n\t\t}\n\t}\n\n\treturn strings.Join(fields, \", \")\n}", "func fieldsASCII(s string) []string {\n\tfn := func(r rune) bool {\n\t\tswitch r {\n\t\tcase '\\t', '\\n', '\\f', '\\r', ' ':\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\treturn strings.FieldsFunc(s, fn)\n}", "func (m *Model) GetFieldsExStr(fields string, prefix ...string) string {\n\tprefixStr := \"\"\n\tif len(prefix) > 0 {\n\t\tprefixStr = prefix[0]\n\t}\n\ttableFields, err := m.TableFields(m.tablesInit)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif len(tableFields) == 0 {\n\t\tpanic(fmt.Sprintf(`empty table fields for table \"%s\"`, m.tables))\n\t}\n\tfieldsExSet := gset.NewStrSetFrom(gstr.SplitAndTrim(fields, \",\"))\n\tfieldsArray := make([]string, len(tableFields))\n\tfor k, v := range tableFields {\n\t\tfieldsArray[v.Index] = k\n\t}\n\tnewFields := \"\"\n\tfor _, k := range fieldsArray {\n\t\tif fieldsExSet.Contains(k) {\n\t\t\tcontinue\n\t\t}\n\t\tif len(newFields) > 0 {\n\t\t\tnewFields += \",\"\n\t\t}\n\t\tnewFields += prefixStr + k\n\t}\n\tnewFields = m.db.GetCore().QuoteString(newFields)\n\treturn newFields\n}", "func sugarFields(args ...interface{}) []zap.Field {\n\tfields := make([]zap.Field, 0, len(args))\n\tfor i := 0; i < len(args); {\n\t\t// This is a strongly-typed field. Consume it and move on.\n\t\tif f, ok := args[i].(zap.Field); ok {\n\t\t\tfields = append(fields, f)\n\t\t\ti++\n\t\t\tcontinue\n\t\t}\n\n\t\t// Make sure this element isn't a dangling key.\n\t\tif i == len(args)-1 {\n\t\t\t// Log as dangling key\n\t\t\tfields = append(fields, zap.Any(\"dangling-key\", args[i]))\n\t\t\tbreak\n\t\t}\n\n\t\t// Consume this value and the next, treating them as a key-value pair. If the\n\t\t// key isn't a string, add this pair to the slice of invalid pairs.\n\t\tkey, val := args[i], args[i+1]\n\t\tif keyStr, ok := key.(string); !ok {\n\t\t\tinvalid := struct {\n\t\t\t\tPos int\n\t\t\t\tKey interface{}\n\t\t\t\tValue interface{}\n\t\t\t}{i, key, val}\n\t\t\tfields = append(fields, zap.Any(\"invalid\", invalid))\n\t\t} else {\n\t\t\tfields = append(fields, zap.Any(keyStr, val))\n\t\t}\n\t\ti += 2\n\t}\n\treturn fields\n}", "func toStringFields(value reflect.Value, fieldNames []string) string {\n\tvar w bytes.Buffer\n\t// If value is a nil pointer, Indirect returns a zero Value!\n\t// Therefor we need to check for a zero value,\n\t// as CreateFieldByName could panic\n\tif indirectValue := reflect.Indirect(value); indirectValue.IsValid() {\n\t\tfor _, fieldName := range fieldNames {\n\t\t\tif fieldValue := indirectValue.FieldByName(fieldName); fieldValue.IsValid() {\n\t\t\t\ts := toString(fieldValue.Interface())\n\t\t\t\tif s == \"\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif w.Len() == 0 {\n\t\t\t\t\tw.WriteString(s)\n\t\t\t\t} else {\n\t\t\t\t\tw.WriteString(\"_\" + s)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn w.String()\n}", "func (Operationroom) Fields() []ent.Field {\n return []ent.Field{\n field.String(\"operationroom_name\").NotEmpty(),\n }\n}", "func (m *Model) GetFieldsStr(prefix ...string) string {\n\tprefixStr := \"\"\n\tif len(prefix) > 0 {\n\t\tprefixStr = prefix[0]\n\t}\n\ttableFields, err := m.TableFields(m.tablesInit)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif len(tableFields) == 0 {\n\t\tpanic(fmt.Sprintf(`empty table fields for table \"%s\"`, m.tables))\n\t}\n\tfieldsArray := make([]string, len(tableFields))\n\tfor k, v := range tableFields {\n\t\tfieldsArray[v.Index] = k\n\t}\n\tnewFields := \"\"\n\tfor _, k := range fieldsArray {\n\t\tif len(newFields) > 0 {\n\t\t\tnewFields += \",\"\n\t\t}\n\t\tnewFields += prefixStr + k\n\t}\n\tnewFields = m.db.GetCore().QuoteString(newFields)\n\treturn newFields\n}", "func (m *OperativeMutation) Fields() []string {\n\tfields := make([]string, 0, 1)\n\tif m.operative_Name != nil {\n\t\tfields = append(fields, operative.FieldOperativeName)\n\t}\n\treturn fields\n}", "func (r *Reader) Fields(fields ...string) *Reader {\n\tif r != nil {\n\t\tif r.XMLName.Local != readMoreXMLName.Local {\n\t\t\tr.FieldList = strings.Join(fields, \",\")\n\t\t}\n\t}\n\treturn r\n}", "func isFieldStringable(tpe ast.Expr) bool {\n\tif ident, ok := tpe.(*ast.Ident); ok {\n\t\tswitch ident.Name {\n\t\tcase \"int\", \"int8\", \"int16\", \"int32\", \"int64\",\n\t\t\t\"uint\", \"uint8\", \"uint16\", \"uint32\", \"uint64\",\n\t\t\t\"float64\", \"string\", \"bool\":\n\t\t\treturn true\n\t\t}\n\t} else if starExpr, ok := tpe.(*ast.StarExpr); ok {\n\t\treturn isFieldStringable(starExpr.X)\n\t} else {\n\t\treturn false\n\t}\n\treturn false\n}", "func (*slicingFieldParser) nextField(str *[]byte, sep []byte, expectMoreFields bool) (field string, err error) {\n\tdefer panicToErr(\"parsing next field\", &err) // Catch any unexpected slicing errors without panicking\n\n\tif len(*str) == 0 { // There can't be a field if there is no more data!\n\t\treturn \"\", io.ErrUnexpectedEOF\n\t}\n\n\tidx := bytes.Index(*str, sep)\n\tif idx == -1 {\n\t\tif expectMoreFields {\n\t\t\treturn \"\", io.ErrUnexpectedEOF\n\t\t}\n\n\t\t// If the next seperator is not found, assume that the next token is the last in the str\n\t\tfield = string((*str)[:len(*str)])\n\t\t*str = (*str)[len(*str):] // Consume the bytes from the stream just for parity with the other case\n\t\treturn field, io.EOF\n\t}\n\n\tfield = string((*str)[:idx])\n\t*str = (*str)[idx+len(sep):] // Consume the bytes from the stream so the next read begins after this field\n\n\tif len(field) == 0 {\n\t\treturn \"\", errEmptyField\n\t}\n\n\treturn field, nil\n}", "func parseTagFields(file *os.File) ([]TagField, []error) {\n\tvar errors []error\n\tre, err := regexp.Compile(`^(\\S*\\:)?(\\s.*)?$`)\n\tif err != nil {\n\t\terrors = append(errors, err)\n\t\treturn nil, errors\n\t}\n\n\tscanner := bufio.NewScanner(file)\n\tvar fields []TagField\n\tvar field TagField\n\n\t// Parse the remaining lines.\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\t// See http://play.golang.org/p/zLqvg2qo1D for some testing on the field match.\n\t\tif re.MatchString(line) {\n\t\t\tdata := re.FindStringSubmatch(line)\n\t\t\tdata[1] = strings.Replace(data[1], \":\", \"\", 1)\n\t\t\tif data[1] != \"\" {\n\t\t\t\tif field.Label() != \"\" {\n\t\t\t\t\tfields = append(fields, field)\n\t\t\t\t}\n\t\t\t\tfield = *NewTagField(data[1], strings.Trim(data[2], \" \"))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvalue := strings.Trim(data[2], \" \")\n\t\t\tfield.SetValue(strings.Join([]string{field.Value(), value}, \" \"))\n\n\t\t} else {\n\t\t\terr := fmt.Errorf(\"Unable to parse tag data from line: %s\", line)\n\t\t\terrors = append(errors, err)\n\t\t}\n\t}\n\tif field.Label() != \"\" {\n\t\tfields = append(fields, field)\n\t}\n\n\tif scanner.Err() != nil {\n\t\terrors = append(errors, scanner.Err())\n\t}\n\n\t// See http://play.golang.org/p/nsw9zsAEPF for some testing on the field match.\n\treturn fields, errors\n}", "func lexField(l *lexer) stateFn {\n\treturn lexFieldOrVariable(l, itemField)\n}", "func (t *Type) FieldSlice() []*Field", "func lexField(l *lexer) stateFunc {\n\tl.skipSpace()\n\tfor {\n\t\tif s, ok := l.nextTermWithDot(); s != \"\" && ok {\n\t\t\tif agg, ok := AggragationToType[s]; ok {\n\t\t\t\tl.emit(agg)\n\t\t\t\tl.skipSpace()\n\t\t\t\tif !l.accept(MarkLeftParen) {\n\t\t\t\t\treturn l.errorf(\"syntax error: aggragation error, %q\", l.input[l.pos:])\n\t\t\t\t}\n\t\t\t\tl.emit(itemLeftParen)\n\t\t\t\t// TODO: take count(*) into consideration\n\t\t\t\tif aggField, ok := l.nextTermWithDot(); aggField != \"\" && ok {\n\t\t\t\t\tl.emit(itemIdentifier)\n\t\t\t\t\tl.skipSpace()\n\t\t\t\t\tif !l.accept(MarkRightParen) {\n\t\t\t\t\t\treturn l.errorf(\"syntax error: aggragation error, %q\", l.input[l.pos:])\n\t\t\t\t\t}\n\t\t\t\t\tl.emit(itemRightParen)\n\t\t\t\t\tl.skipSpace()\n\t\t\t\t\tif !l.accept(MakrComma) {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t} else {\n\t\t\t\t\t\tl.emit(itemComma)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn l.errorf(\"syntax error: aggragation error, %q\", l.input[l.pos:])\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tl.emit(itemIdentifier)\n\t\t\t\tl.skipSpace()\n\t\t\t\t// if n := l.nextTerm(); n == KeyAs {\n\t\t\t\t//\n\t\t\t\t// }\n\t\t\t\tif !l.accept(MakrComma) {\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\tl.emit(itemComma)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\treturn l.errorf(\"syntax error: query field %q not valid\", l.input[l.pos:])\n\t\t}\n\t}\n\tswitch l.peekTerm() {\n\tcase KeyFrom:\n\t\treturn lexFrom\n\tcase KeyWhere:\n\t\treturn lexWhere\n\tcase KeyGroupBy:\n\t\treturn lexGroupBy\n\tcase KeyOrderBy:\n\t\treturn lexOrderBy\n\t}\n\treturn lexCheckEnd\n}", "func (s *ScanOp) Fields(fields []string) *ScanOp {\n\ts.fieldsToRead = fields\n\treturn s\n}", "func (a *Aggregate) makeFields(parts []string) map[string]string {\n\tfields := make(map[string]string, len(parts))\n\tfor _, part := range parts {\n\t\tkv := strings.SplitN(part, protocol.AggregateKVDelimiter, 2)\n\t\tif len(kv) != 2 {\n\t\t\tcontinue\n\t\t}\n\t\tfields[kv[0]] = kv[1]\n\t}\n\treturn fields\n}", "func parseFieldParameters(str string) (params fieldParameters) {}", "func FieldsWithPrefix(prefix string, paths ...string) []string {\n\tret := make([]string, 0, len(paths))\n\tfor _, p := range paths {\n\t\tret = append(ret, prefix+\".\"+p)\n\t}\n\treturn ret\n}", "func parseFields(criteria *measurev1.QueryRequest, metadata *commonv1.Metadata, groupByEntity bool) logical.UnresolvedPlan {\n\tprojFields := make([]*logical.Field, len(criteria.GetFieldProjection().GetNames()))\n\tfor i, fieldNameProj := range criteria.GetFieldProjection().GetNames() {\n\t\tprojFields[i] = logical.NewField(fieldNameProj)\n\t}\n\ttimeRange := criteria.GetTimeRange()\n\treturn indexScan(timeRange.GetBegin().AsTime(), timeRange.GetEnd().AsTime(), metadata,\n\t\tlogical.ToTags(criteria.GetTagProjection()), projFields, groupByEntity, criteria.GetCriteria())\n}", "func (pf *PathFilter) Fields(contentPath string) map[string]string {\n\tout := make(map[string]string)\n\n\tmatch := pf.re.FindStringSubmatch(contentPath)\n\tnames := pf.re.SubexpNames()\n\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tfmt.Println(\"path filter fields is crashing the app\")\n\t\t\tspew.Dump(contentPath, pf.filterPath, pf.re.String(), match, names)\n\t\t\tpanic(\"i'm done\")\n\t\t}\n\t}()\n\n\tfor i, name := range names {\n\t\tif i != 0 && name != \"\" {\n\t\t\tout[name] = match[i]\n\t\t}\n\t}\n\n\treturn out\n}", "func (e *Extractor) fields(s reflect.Value) []field {\n\tfields := make([]field, 0, s.NumField())\n\n\tfor i := 0; i < s.NumField(); i++ {\n\t\tif isIgnored(s.Type().Field(i).Name, e.ignoredFields) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif s.Type().Field(i).Anonymous {\n\t\t\tif e.useEmbeddedStructs {\n\t\t\t\tfields = append(fields, e.fields(s.Field(i))...)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\ttag := s.Type().Field(i).Tag\n\t\tname := s.Type().Field(i).Name\n\t\tvalue := s.Field(i)\n\t\tfields = append(fields, field{value, name, tag})\n\t}\n\n\treturn fields\n}", "func (MedicalProcedure) Fields() []ent.Field {\n\treturn []ent.Field{\n\t\tfield.String(\"procedureOrder\").Validate(func(s string) error {\n match, _ := regexp.MatchString(\"[U]+[N]+[S]\\\\d{6}\" ,s)\n if !match {\n return errors.New(\"รูปแบบรหัสไม่ถูกต้อง\")\n }\n return nil\n }),\n\t\tfield.String(\"procedureRoom\").MaxLen(4).MinLen(4),\n\t\tfield.Time(\"Addtime\"),\n\t\tfield.String(\"procedureDescripe\").NotEmpty(),\n\t}\n}", "func (f fields) string() string {\n\treturnValue := make([]string, 0, f.orig.Len())\n\tf.orig.Range(func(k string, v pcommon.Value) bool {\n\t\treturnValue = append(\n\t\t\treturnValue,\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"%s=%s\",\n\t\t\t\tf.sanitizeField(k),\n\t\t\t\tf.sanitizeField(v.AsString()),\n\t\t\t),\n\t\t)\n\t\treturn true\n\t})\n\tsort.Strings(returnValue)\n\n\treturn strings.Join(returnValue, \", \")\n}", "func Split(sep, operand string) []string { return strings.Split(operand, sep) }", "func Strings(k string, v []string) Field {\n\treturn Field{Key: k, Value: valf.Strings(v)}\n}", "func (sc *Scanner) Fields() []string {\n\treturn sc.fields\n}", "func BenchmarkFields(b *testing.B) {\n\tfor n := 0; n < b.N; n++ {\n\t\tstrings.Fields(longBenchmarkText)\n\t}\n}", "func fieldsWithNames(f *ast.Field) (fields []*ast.Field) {\n\tif f == nil {\n\t\treturn nil\n\t}\n\n\tif len(f.Names) == 0 {\n\t\tfields = append(fields, &ast.Field{\n\t\t\tDoc: f.Doc,\n\t\t\tNames: []*ast.Ident{{Name: printIdentField(f)}},\n\t\t\tType: f.Type,\n\t\t\tTag: f.Tag,\n\t\t\tComment: f.Comment,\n\t\t})\n\t\treturn\n\t}\n\tfor _, ident := range f.Names {\n\t\tfields = append(fields, &ast.Field{\n\t\t\tDoc: f.Doc,\n\t\t\tNames: []*ast.Ident{ident},\n\t\t\tType: f.Type,\n\t\t\tTag: f.Tag,\n\t\t\tComment: f.Comment,\n\t\t})\n\t}\n\treturn\n}", "func (f *FieldsWithValue) Fields() []string {\n\tfields := make([]string, len(f.fields))\n\tfor i := range f.fields {\n\t\tfields[i] = f.fields[i].Name\n\t}\n\treturn fields\n}", "func (m *CleanernameMutation) Fields() []string {\n\tfields := make([]string, 0, 1)\n\tif m.cleanername != nil {\n\t\tfields = append(fields, cleanername.FieldCleanername)\n\t}\n\treturn fields\n}", "func Fields(msg proto.Message, processors ...FieldProcessor) Results {\n\tif len(processors) == 0 {\n\t\treturn nil\n\t}\n\t// 32 is a guess at how deep the Path could get.\n\t//\n\t// There's really no way to know ahead of time (since proto messages could\n\t// have a recursive structure, allowing the expression of trees, etc.)\n\treturn fieldsImpl(make(reflectutil.Path, 0, 32), msg.ProtoReflect(), lookupProcBundles(processors...))\n}", "func (m *CleaningroomMutation) Fields() []string {\n\tfields := make([]string, 0, 4)\n\tif m.note != nil {\n\t\tfields = append(fields, cleaningroom.FieldNote)\n\t}\n\tif m.dateandstarttime != nil {\n\t\tfields = append(fields, cleaningroom.FieldDateandstarttime)\n\t}\n\tif m.phonenumber != nil {\n\t\tfields = append(fields, cleaningroom.FieldPhonenumber)\n\t}\n\tif m.numofem != nil {\n\t\tfields = append(fields, cleaningroom.FieldNumofem)\n\t}\n\treturn fields\n}", "func (m *PetruleMutation) Fields() []string {\n\tfields := make([]string, 0, 1)\n\tif m.petrule != nil {\n\t\tfields = append(fields, petrule.FieldPetrule)\n\t}\n\treturn fields\n}", "func (game Game) Field() [9]string {\n\treturn game.field\n}", "func emptyFields(fields ...string) bool {\r\n\tfor _, field := range fields {\r\n\t\tif len(field) == 0 {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\tif len(strings.Replace(field, \" \", \"\", -1)) == 0 {\r\n\t\t\treturn true\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}", "func (Examinationroom) Fields() []ent.Field {\n return []ent.Field{\n field.String(\"examinationroom_name\").NotEmpty(),\n }\n }", "func (Financier) Fields() []ent.Field {\n\treturn []ent.Field{\n\t\tfield.String(\"name\").NotEmpty(),\n\t}\n}", "func mapFieldTags(tag string) []StructTag {\n\tvar res []StructTag\n\n\tfor tag != \"\" {\n\t\t// Skip leading space.\n\t\ti := 0\n\t\tfor i < len(tag) && tag[i] == ' ' {\n\t\t\ti++\n\t\t}\n\t\ttag = tag[i:]\n\t\tif tag == \"\" {\n\t\t\tbreak\n\t\t}\n\n\t\t// Scan to colon. A space, a quote or a control character is a syntax error.\n\t\t// Strictly speaking, control chars include the range [0x7f, 0x9f], not just\n\t\t// [0x00, 0x1f], but in practice, we ignore the multi-byte control characters\n\t\t// as it is simpler to inspect the tag's bytes than the tag's runes.\n\t\ti = 0\n\t\tfor i < len(tag) && tag[i] > ' ' && tag[i] != ':' && tag[i] != '\"' && tag[i] != 0x7f {\n\t\t\ti++\n\t\t}\n\t\tif i == 0 || i+1 >= len(tag) || tag[i] != ':' || tag[i+1] != '\"' {\n\t\t\tbreak\n\t\t}\n\t\tname := string(tag[:i])\n\t\ttag = tag[i+1:]\n\n\t\t// Scan quoted string to find value.\n\t\ti = 1\n\t\tfor i < len(tag) && tag[i] != '\"' {\n\t\t\tif tag[i] == '\\\\' {\n\t\t\t\ti++\n\t\t\t}\n\t\t\ti++\n\t\t}\n\t\tif i >= len(tag) {\n\t\t\tbreak\n\t\t}\n\t\tqvalue := string(tag[:i+1])\n\t\ttag = tag[i+1:]\n\n\t\tvalue, err := strconv.Unquote(qvalue)\n\t\tif err != nil {\n\t\t\treturn nil // does this ever happen with the check above?\n\t\t}\n\n\t\t//dunno why this has a broken name, the original code seems to have this as a defacto-bug\n\t\tif strings.HasPrefix(name, \",\") {\n\t\t\tname = name[1:]\n\t\t}\n\n\t\ttag := StructTag{\n\t\t\tName: name,\n\t\t\tValues: strings.Split(value, \",\"),\n\t\t}\n\n\t\tfor i, v := range tag.Values {\n\t\t\ttag.Values[i] = strings.TrimSpace(v)\n\t\t}\n\n\t\tres = append(res, tag)\n\t}\n\n\treturn res\n}", "func (m *Model) FieldsEx(fieldNamesOrMapStruct ...interface{}) *Model {\n\tlength := len(fieldNamesOrMapStruct)\n\tif length == 0 {\n\t\treturn m\n\t}\n\tfields := m.getFieldsFrom(fieldNamesOrMapStruct...)\n\tif len(fields) == 0 {\n\t\treturn m\n\t}\n\treturn m.appendFieldsExByStr(gstr.Join(fields, \",\"))\n}", "func (m *ToolMutation) Fields() []string {\n\tfields := make([]string, 0, 1)\n\tif m._Tool_Name != nil {\n\t\tfields = append(fields, tool.FieldToolName)\n\t}\n\treturn fields\n}", "func (Patientrecord) Fields() []ent.Field {\n\treturn []ent.Field{\n\n field.String(\"Name\"),\n\n }\n}", "func (m *LengthtimeMutation) Fields() []string {\n\tfields := make([]string, 0, 1)\n\tif m.lengthtime != nil {\n\t\tfields = append(fields, lengthtime.FieldLengthtime)\n\t}\n\treturn fields\n}", "func (m *CarMutation) Fields() []string {\n\tfields := make([]string, 0, 0)\n\treturn fields\n}", "func (Tag) Fields() []ent.Field {\n\treturn []ent.Field{\n\t\tfield.String(\"value\"),\n\t}\n}", "func (BaseMixin) Fields() []ent.Field {\n\treturn []ent.Field{\n\t\tfield.UUID(\"id\", uuid.UUID{}).Default(uuid.New),\n\t\tfield.String(\"some_field\"),\n\t}\n}", "func (wfgb *WithFieldsGroupBy) Strings(ctx context.Context) ([]string, error) {\n\tif len(wfgb.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: WithFieldsGroupBy.Strings is not achievable when grouping more than 1 field\")\n\t}\n\tvar v []string\n\tif err := wfgb.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "func (m *ShowMeasurementsMapper) Fields() []string { return []string{\"name\"} }", "func fields(spec *ast.TypeSpec) []*ast.Field {\n\ts := make([]*ast.Field, 0)\n\tif structType, ok := spec.Type.(*ast.StructType); ok {\n\t\tfor _, field := range structType.Fields.List {\n\t\t\tif keyname(field) != \"\" {\n\t\t\t\ts = append(s, field)\n\t\t\t}\n\t\t}\n\t}\n\treturn s\n}", "func (m *DiscountMutation) Fields() []string {\n\tfields := make([]string, 0, 1)\n\tif m.sale != nil {\n\t\tfields = append(fields, discount.FieldSale)\n\t}\n\treturn fields\n}", "func (DrugAllergy) Fields() []ent.Field {\n return []ent.Field{\n \n }\n }", "func (m *PromotionMutation) Fields() []string {\n\tfields := make([]string, 0, 4)\n\tif m._NAME != nil {\n\t\tfields = append(fields, promotion.FieldNAME)\n\t}\n\tif m._DESC != nil {\n\t\tfields = append(fields, promotion.FieldDESC)\n\t}\n\tif m._CODE != nil {\n\t\tfields = append(fields, promotion.FieldCODE)\n\t}\n\tif m._DATE != nil {\n\t\tfields = append(fields, promotion.FieldDATE)\n\t}\n\treturn fields\n}", "func Field(typ ast.Expr, names ...*ast.Ident) *ast.Field {\n\treturn &ast.Field{\n\t\tNames: names,\n\t\tType: typ,\n\t}\n}", "func Fields(v interface{}) []*Fieldx {\n\treturn New(v).Fields()\n}", "func (s *FieldStatsService) Fields(fields ...string) *FieldStatsService {\n\ts.fields = append(s.fields, fields...)\n\treturn s\n}", "func (c *SpacesGetCall) Fields(s ...googleapi.Field) *SpacesGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func split(str string) []string {\n\tisSpliting := true\n\treturn strings.FieldsFunc(str, func(char rune) bool {\n\t\tif char == '\"' {\n\t\t\tisSpliting = !isSpliting\n\t\t}\n\t\treturn unicode.IsSpace(char) && isSpliting\n\t})\n}", "func (m *RepairingMutation) Fields() []string {\n\tfields := make([]string, 0, 1)\n\tif m.repairpart != nil {\n\t\tfields = append(fields, repairing.FieldRepairpart)\n\t}\n\treturn fields\n}", "func (s StringFilter) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.Comparison) > 0 {\n\t\tv := s.Comparison\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Comparison\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Value != nil {\n\t\tv := *s.Value\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"Value\", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)\n\t}\n\treturn nil\n}", "func (Test) Fields() []ent.Field {\n\treturn []ent.Field{\n\t\tfield.Enum(\"test\").\n\t\t\tValues(\"a\", \"b\"),\n\t}\n}", "func (Label) Fields() []ent.Field {\n\treturn []ent.Field{\n\t\tfield.String(\"labl\").\n\t\t\tNotEmpty().\n\t\t\tUnique(),\n\t}\n}", "func (builder QueryBuilder) Fields(predicates ...interface{}) QueryBuilder {\n\treturn builder.Select(predicates...)\n}", "func (m *StreetMutation) Fields() []string {\n\tfields := make([]string, 0, 1)\n\tif m.name != nil {\n\t\tfields = append(fields, street.FieldName)\n\t}\n\treturn fields\n}", "func (m *ExchangeMutation) Fields() []string {\n\tfields := make([]string, 0, 2)\n\tif m.code != nil {\n\t\tfields = append(fields, exchange.FieldCode)\n\t}\n\tif m.name != nil {\n\t\tfields = append(fields, exchange.FieldName)\n\t}\n\treturn fields\n}", "func (m *FinancialMutation) Fields() []string {\n\tfields := make([]string, 0, 0)\n\treturn fields\n}", "func (c *SpacesListCall) Fields(s ...googleapi.Field) *SpacesListCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "func insertFields(tableName string, fields string) string {\n\treturn strings.Replace(fields, \"\\\"\"+tableName+\"\\\".\", \"\", -1)\n}", "func (m *InsuranceMutation) Fields() []string {\n\tfields := make([]string, 0, 1)\n\tif m.company != nil {\n\t\tfields = append(fields, insurance.FieldCompany)\n\t}\n\treturn fields\n}", "func (Machine) Fields() []ent.Field {\n\treturn []ent.Field{\n\t\tfield.String(\"hwid\").NotEmpty().\n\t\t\tAnnotations(entproto.Field(2)),\n\t\tfield.String(\"hostname\").NotEmpty().\n\t\t\tAnnotations(entproto.Field(3)),\n\t\tfield.String(\"fingerprint\").NotEmpty().\n\t\t\tAnnotations(entproto.Field(4)),\n\t}\n}", "func (wfs *WithFieldsSelect) Strings(ctx context.Context) ([]string, error) {\n\tif len(wfs.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: WithFieldsSelect.Strings is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []string\n\tif err := wfs.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "func (m *ExaminationroomMutation) Fields() []string {\n\tfields := make([]string, 0, 1)\n\tif m.examinationroom_name != nil {\n\t\tfields = append(fields, examinationroom.FieldExaminationroomName)\n\t}\n\treturn fields\n}", "func (Dentist) Fields() []ent.Field {\n\treturn []ent.Field{\n\t\tfield.String(\"Dentist_name\").NotEmpty(),\n\t \n\t}\n}", "func (d Dependencies) FieldsString() string {\n\tvar result strings.Builder\n\tfor i := 0; i < len(d); i++ {\n\t\tif i != 0 {\n\t\t\t_, _ = result.WriteString(d[i].Name())\n\t\t\t_, _ = result.WriteString(\"Suite \")\n\t\t}\n\t\t_, _ = result.WriteString(d[i].Name())\n\t\t_, _ = result.WriteString(\".Suite\")\n\t\tif i+1 < len(d) {\n\t\t\t_, _ = result.WriteString(\"\\n\")\n\t\t}\n\t}\n\n\treturn result.String()\n}", "func (Carservice) Fields() []ent.Field {\n\treturn []ent.Field{\n\t\tfield.String(\"customer\").Validate(func(s string) error {\n\t\t\tmatch, _ := regexp.MatchString(\"^[ก-๙a-zA-Z-\\\\s]+$\",s)\n\t\t\tif !match {\n\t\t\t\treturn errors.New(\"รูปแบบไม่ถูกต้อง\")\n\t\t\t}\n\t\t\treturn nil\n\t\t}),\n\t\tfield.Int(\"age\").Positive(),\n\n\t\tfield.String(\"location\").Validate(func(s string) error {\n\t\t\tmatch, _ := regexp.MatchString(\"^[ก-๙0-9a-zA-Z-\\\\s]+$\",s)\n\t\t\tif !match {\n\t\t\t\treturn errors.New(\"รูปแบบไม่ถูกต้อง\")\n\t\t\t}\n\t\t\treturn nil\n\t\t}),\n\t\tfield.String(\"serviceinfo\").Validate(func(s string) error {\n\t\t\tmatch, _ := regexp.MatchString(\"^[ก-๙0-9a-zA-Z-\\\\s]+$\",s)\n\t\t\tif !match {\n\t\t\t\treturn errors.New(\"รูปแบบไม่ถูกต้อง\")\n\t\t\t}\n\t\t\treturn nil\n\t\t}),\n\t\tfield.Time(\"Datetime\"),\n\t}\n}" ]
[ "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.565738", "0.56200653", "0.5617845", "0.5604787", "0.55970526", "0.55927134", "0.5540468", "0.55298936", "0.55092984", "0.5509155", "0.5507032", "0.5493313", "0.54900736", "0.5483352", "0.54674256", "0.54527456", "0.5444904", "0.54443926", "0.54208165", "0.54027164", "0.5401884", "0.5398547", "0.53879166", "0.5375558", "0.5374832", "0.5370106", "0.53668445", "0.53600043", "0.53460765", "0.53423977", "0.5341131", "0.53334105", "0.53289425", "0.5318521", "0.53047734", "0.52979857", "0.5290775", "0.52862513", "0.5282272", "0.5279976", "0.5274094", "0.52667755", "0.52566457", "0.52467513", "0.5241808", "0.52317804", "0.5228945", "0.5226051", "0.5222195", "0.5221065", "0.52209646", "0.5214627", "0.5204483", "0.51932925", "0.5189638", "0.5186512", "0.5186107", "0.5183259", "0.51808345", "0.5179134", "0.517658", "0.5173605", "0.5173526", "0.5172783", "0.517273", "0.51720566", "0.517191", "0.5171127", "0.51699877", "0.51699245", "0.5168819", "0.5162151", "0.516198", "0.5157553", "0.51560295", "0.51462245", "0.5139635", "0.5138445", "0.51346755" ]
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.HasPrefix(\"\", prefix))\n\t})\n}", "func KinNameHasPrefix(v string) predicate.Rent {\n\treturn predicate.Rent(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldKinName), v))\n\t})\n}", "func Test_HasPrefix(t *testing.T) {\n\tvalue := \"main.go\"\n\tprefix := \"main\"\n\tif !strings.HasPrefix(value, prefix) {\n\t\tt.Fatalf(\"expected %s to have prefix %s\", value, prefix)\n\t}\n}", "func startsWithFunc(a, b string) bool {\n\treturn strings.HasPrefix(a, b)\n}", "func NameHasPrefix(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldName), v))\n\t},\n\t)\n}", "func NameHasPrefix(v string) predicate.Product {\n\treturn predicate.Product(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldName), v))\n\t})\n}", "func StringsHasPrefix(s []string, p string) bool {\n\tfor _, x := range s {\n\t\tif !strings.HasPrefix(x, p) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func StringValHasPrefix(v string) predicate.Property {\n\treturn predicate.Property(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldStringVal), v))\n\t})\n}", "func HasPrefix(prefix string) MatchFunc {\n\treturn func(s string) bool { return strings.HasPrefix(s, prefix) }\n}", "func NameHasPrefix(v string) predicate.Conversion {\n\treturn predicate.Conversion(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldName), v))\n\t})\n}", "func StartsWith(str, prefix string) bool {\n\treturn strings.HasPrefix(str, prefix)\n}", "func WorkplaceHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldWorkplace), v))\n\t})\n}", "func NameHasPrefix(v string) predicate.GameServer {\n\treturn predicate.GameServer(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldName), v))\n\t})\n}", "func CorrectionHasPrefix(v string) predicate.TradeCorrection {\n\treturn predicate.TradeCorrection(sql.FieldHasPrefix(FieldCorrection, v))\n}", "func KinTelHasPrefix(v string) predicate.Rent {\n\treturn predicate.Rent(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldKinTel), v))\n\t})\n}", "func WorkplaceHasPrefix(v string) predicate.User {\n\treturn predicate.User(sql.FieldHasPrefix(FieldWorkplace, v))\n}", "func StartsWith(str string, prefix string) bool {\n\treturn internalStartsWith(str, prefix, false)\n}", "func MannerNameHasPrefix(v string) predicate.Manner {\n\treturn predicate.Manner(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldMannerName), v))\n\t})\n}", "func withPrefix(pfx string) func(string) bool {\n\treturn func(link string) bool {\n\t\treturn strings.HasPrefix(link, pfx)\n\t}\n}", "func NameHasPrefix(v string) predicate.Ref {\n\treturn predicate.Ref(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldName), v))\n\t})\n}", "func NameHasPrefix(v string) predicate.Book {\n\treturn predicate.Book(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldName), v))\n\t})\n}", "func NameHasPrefix(v string) predicate.ValidMessage {\n\treturn predicate.ValidMessage(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldName), v))\n\t})\n}", "func URLHasPrefix(v string) predicate.Token {\n\treturn predicate.Token(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldURL), v))\n\t},\n\t)\n}", "func LocationHasPrefix(v string) predicate.User {\n\treturn predicate.User(sql.FieldHasPrefix(FieldLocation, v))\n}", "func NicknameHasPrefix(v string) predicate.User {\n\treturn predicate.User(sql.FieldHasPrefix(FieldNickname, v))\n}", "func internalStartsWith(str string, prefix string, ignoreCase bool) bool {\n\tif str == \"\" || prefix == \"\" {\n\t\treturn (str == \"\" && prefix == \"\")\n\t}\n\tif utf8.RuneCountInString(prefix) > utf8.RuneCountInString(str) {\n\t\treturn false\n\t}\n\tif ignoreCase {\n\t\treturn strings.HasPrefix(strings.ToLower(str), strings.ToLower(prefix))\n\t}\n\treturn strings.HasPrefix(str, prefix)\n}", "func MixedStringHasPrefix(v string) predicate.User {\n\treturn predicate.User(sql.FieldHasPrefix(FieldMixedString, v))\n}", "func NicknameHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldNickname), v))\n\t})\n}", "func SubHasPrefix(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldSub), v))\n\t})\n}", "func NameHasPrefix(v string) predicate.AllocationStrategy {\n\treturn predicate.AllocationStrategy(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldName), v))\n\t})\n}", "func HasPrefix(s string, p ...string) bool {\n\tfor _, i := range p {\n\t\tif strings.HasPrefix(s, i) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func ShortHasPrefix(v string) predicate.Ethnicity {\n\treturn predicate.Ethnicity(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldShort), v))\n\t})\n}", "func NameHasPrefix(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldName), v))\n\t})\n}", "func MednoHasPrefix(v string) predicate.Medicalfile {\n\treturn predicate.Medicalfile(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldMedno), v))\n\t})\n}", "func NameHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldName), v))\n\t})\n}", "func NameHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldName), v))\n\t})\n}", "func NameHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldName), v))\n\t})\n}", "func NickNameHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldNickName), v))\n\t})\n}", "func MixedStringHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldMixedString), v))\n\t})\n}", "func StreetHasPrefix(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldStreet), v))\n\t})\n}", "func BenefitsHasPrefix(v string) predicate.Job {\n\treturn predicate.Job(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldBenefits), v))\n\t})\n}", "func CountryHasPrefix(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldCountry), v))\n\t})\n}", "func NetHasPrefix(v string) predicate.IP {\n\treturn predicate.IP(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldNet), v))\n\t})\n}", "func PhoneHasPrefix(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldPhone), v))\n\t})\n}", "func HasPrefix(s string, prefixes ...string) bool {\n\tfor _, p := range prefixes {\n\t\tif strings.HasPrefix(s, p) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func NameHasPrefix(v string) predicate.User {\n\treturn predicate.User(sql.FieldHasPrefix(FieldName, v))\n}", "func NameHasPrefix(v string) predicate.User {\n\treturn predicate.User(sql.FieldHasPrefix(FieldName, v))\n}", "func NetworkIDHasPrefix(v string) predicate.Blob {\n\treturn predicate.Blob(\n\t\tfunc(s *sql.Selector) {\n\t\t\ts.Where(sql.HasPrefix(s.C(FieldNetworkID), v))\n\t\t},\n\t)\n}", "func CLUBELOCATIONNAMEHasPrefix(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldCLUBELOCATIONNAME), v))\n\t})\n}", "func PhoneHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldPhone), v))\n\t})\n}", "func PhoneHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldPhone), v))\n\t})\n}", "func PhoneHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldPhone), v))\n\t})\n}", "func PhoneHasPrefix(v string) predicate.Surgeryappointment {\n\treturn predicate.Surgeryappointment(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldPhone), v))\n\t})\n}", "func BunameHasPrefix(v string) predicate.Building {\n\treturn predicate.Building(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldBuname), v))\n\t})\n}", "func CarmaintenanceHasPrefix(v string) predicate.CarRepairrecord {\n\treturn predicate.CarRepairrecord(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldCarmaintenance), v))\n\t})\n}", "func ZipcodeHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldZipcode), v))\n\t})\n}", "func LocaleHasPrefix(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldLocale), v))\n\t})\n}", "func URLShortenedHasPrefix(v string) predicate.Token {\n\treturn predicate.Token(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldURLShortened), v))\n\t},\n\t)\n}", "func PhoneHasPrefix(v string) predicate.User {\n\treturn predicate.User(sql.FieldHasPrefix(FieldPhone, v))\n}", "func hasPrefix(s, prefix string) bool {\n\treturn len(prefix) <= len(s) && s[:len(prefix)] == prefix\n}", "func ZipcodeHasPrefix(v string) predicate.Delivery {\n\treturn predicate.Delivery(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldZipcode), v))\n\t})\n}", "func RemarkHasPrefix(v string) predicate.Order {\n\treturn predicate.Order(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldRemark), v))\n\t})\n}", "func (a *Assertions) NotHasPrefix(corpus, prefix string, userMessageComponents ...interface{}) bool {\n\ta.assertion()\n\tif didFail, message := shouldNotHasPrefix(corpus, prefix); didFail {\n\t\treturn a.fail(message, userMessageComponents...)\n\t}\n\treturn true\n}", "func StreetHasPrefix(v string) predicate.Delivery {\n\treturn predicate.Delivery(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldStreet), v))\n\t})\n}", "func BequipmentHasPrefix(v string) predicate.Repairinvoice {\n\treturn predicate.Repairinvoice(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldBequipment), v))\n\t})\n}", "func TrimPrefix(prefix, operand string) string { return strings.TrimPrefix(operand, prefix) }", "func UrlHasPrefix(prefix string) ReqConditionFunc {\n\treturn func(req *http.Request, ctx *ProxyCtx) bool {\n\t\treturn strings.HasPrefix(req.URL.Path, prefix) ||\n\t\t\tstrings.HasPrefix(req.URL.Host+req.URL.Path, prefix) ||\n\t\t\tstrings.HasPrefix(req.URL.Scheme+req.URL.Host+req.URL.Path, prefix)\n\t}\n}", "func UPidHasPrefix(v string) predicate.OnlineSession {\n\treturn predicate.OnlineSession(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldUPid), v))\n\t})\n}", "func NameHasPrefix(v string) predicate.Watchlist {\n\treturn predicate.Watchlist(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldName), v))\n\t})\n}", "func (this *Trie) StartsWith(prefix string) bool {\n\tfor k, ws := range this.words {\n\t\tif k < len(prefix) {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, w := range ws {\n\t\t\tif strings.HasPrefix(w, prefix) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "func AddressHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldAddress), v))\n\t})\n}", "func EmtellHasPrefix(v string) predicate.Repairinvoice {\n\treturn predicate.Repairinvoice(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldEmtell), v))\n\t})\n}", "func KeyHasPrefix(v string) predicate.Blob {\n\treturn predicate.Blob(\n\t\tfunc(s *sql.Selector) {\n\t\t\ts.Where(sql.HasPrefix(s.C(FieldKey), v))\n\t\t},\n\t)\n}", "func FirstnameHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldFirstname), v))\n\t})\n}", "func ReserveHasPrefix(v string) predicate.Order {\n\treturn predicate.Order(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldReserve), v))\n\t})\n}", "func PostalcodeHasPrefix(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldPostalcode), v))\n\t})\n}", "func (this *Trie) StartsWith(prefix string) bool {\n\tt := this\n\tfor i := range prefix {\n\t\tif t.trie == nil {\n\t\t\treturn false\n\t\t}\n\t\tif !t.trie[prefix[i]-'a'].exist {\n\t\t\treturn false\n\t\t}\n\t\tt = &t.trie[prefix[i]-'a'].trie\n\t}\n\treturn true\n}", "func CLUBELOCATIONADDRESSHasPrefix(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldCLUBELOCATIONADDRESS), v))\n\t})\n}", "func RegionHasPrefix(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldRegion), v))\n\t})\n}", "func (s *Stringish) HasPrefix(prefix string) bool {\n\treturn strings.HasPrefix(s.str, prefix)\n}", "func hasPrefix(s, prefix string) bool {\n\treturn len(s) >= len(prefix) && s[:len(prefix)] == prefix\n}", "func IPAddressHasPrefix(v string) predicate.GameServer {\n\treturn predicate.GameServer(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldIPAddress), v))\n\t})\n}", "func NameHasPrefix(v string) predicate.Project {\n\treturn predicate.Project(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldName), v))\n\t})\n}", "func NameHasPrefix(v string) predicate.Project {\n\treturn predicate.Project(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldName), v))\n\t})\n}", "func TaxIDHasPrefix(v string) predicate.Watchlist {\n\treturn predicate.Watchlist(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldTaxID), v))\n\t})\n}", "func HelloHasPrefix(v string) predicate.DuplicateNumberMessage {\n\treturn predicate.DuplicateNumberMessage(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldHello), v))\n\t})\n}", "func BaseHasPrefix(v string) predicate.MetaSchema {\n\treturn predicate.MetaSchema(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldBase), v))\n\t},\n\t)\n}", "func (this *Trie) StartsWith(prefix string) bool {\n\tfor i := 0; i < len(prefix); i++ {\n\t\tif this.son[prefix[i]-'a'] == nil {\n\t\t\treturn false\n\t\t}\n\t\tthis = this.son[prefix[i]-'a']\n\t}\n\treturn true\n}", "func FirstNameHasPrefix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldFirstName), v))\n\t})\n}", "func NoteHasPrefix(v string) predicate.Surgeryappointment {\n\treturn predicate.Surgeryappointment(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldNote), v))\n\t})\n}", "func ContentHasPrefix(v string) predicate.Post {\n\treturn predicate.Post(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldContent), v))\n\t})\n}", "func IsStartWithOp(input string) bool {\n\top := []string{\"*\", \"+\", \"-\", \"/\", \"%\", \"^\"}\n\n\tfor _, v := range op {\n\t\tif strings.HasPrefix(input, v) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func MandantidHasPrefix(v string) predicate.Project {\n\treturn predicate.Project(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldMandantid), v))\n\t})\n}", "func RequirementsHasPrefix(v string) predicate.Job {\n\treturn predicate.Job(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldRequirements), v))\n\t})\n}", "func PatientNameHasPrefix(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldPatientName), v))\n\t})\n}", "func DeviceCodeHasPrefix(v string) predicate.DeviceRequest {\n\treturn predicate.DeviceRequest(sql.FieldHasPrefix(FieldDeviceCode, v))\n}", "func NameHasPrefix(v string) predicate.Watchlisthistory {\n\treturn predicate.Watchlisthistory(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldName), v))\n\t})\n}", "func BuyerHasPrefix(v string) predicate.Order {\n\treturn predicate.Order(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldBuyer), v))\n\t})\n}", "func TagHasPrefix(t kappnavv1.Tag, prefix string) bool {\n\treturn strings.HasPrefix(string(t), prefix)\n}" ]
[ "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.70498", "0.70365125", "0.7018013", "0.7004951", "0.6999139", "0.69895303", "0.698578", "0.6979281", "0.697009", "0.69650275", "0.6954677", "0.69506925", "0.6950089", "0.694404", "0.69425195", "0.6932623", "0.6932623", "0.6932623", "0.6904047", "0.68888927", "0.68801594", "0.6877862", "0.68774664", "0.68731254", "0.687269", "0.6870402", "0.68674767", "0.68674767", "0.68657744", "0.6862528", "0.68579024", "0.68579024", "0.68579024", "0.6850801", "0.6842341", "0.6822972", "0.6818125", "0.68177634", "0.6816606", "0.68018717", "0.6776762", "0.67747307", "0.6762204", "0.67600715", "0.6750047", "0.6748828", "0.6748031", "0.6744369", "0.6728604", "0.672682", "0.6723297", "0.6715624", "0.6702314", "0.6696069", "0.6694422", "0.6694218", "0.66940814", "0.6693022", "0.6692604", "0.668671", "0.668644", "0.6684162", "0.66809213", "0.66736525", "0.66736525", "0.6664997", "0.66618687", "0.66547984", "0.665295", "0.66516316", "0.6650184", "0.6646696", "0.66412485", "0.66405934", "0.6640297", "0.6633376", "0.6632909", "0.66279256", "0.66242003", "0.6622875" ]
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)-len(suffix):] == suffix\n}", "func hasSuffix(s string, suffix string) bool {\n\treturn strings.HasSuffix(s, suffix)\n}", "func (n Name) HasSuffix(r Name) bool {\n\toffset := len(n) - len(r)\n\tif offset < 0 {\n\t\treturn false\n\t}\n\treturn n[offset:].Equal(r)\n}", "func hasSuffixDemo(a string, b string) bool {\n\treturn strings.HasSuffix(a, b)\n}", "func HasSuffix(suffix string) MatchFunc {\n\treturn func(s string) bool { return strings.HasSuffix(s, suffix) }\n}", "func (s *Stringish) HasSuffix(suffix string) bool {\n\treturn strings.HasSuffix(s.str, suffix)\n}", "func (b *Builder) HasSuffix(rhs interface{}) *predicate.Predicate {\n\tb.p.RegisterPredicate(impl.HasSuffix(rhs))\n\tif b.t != nil {\n\t\tb.t.Helper()\n\t\tEvaluate(b)\n\t}\n\treturn &b.p\n}", "func (semver *Semver) HasSuffix() bool {\n\treturn semver.Suffix != \"\"\n}", "func (a *Assertions) HasSuffix(corpus, suffix string, userMessageComponents ...interface{}) bool {\n\ta.assertion()\n\tif didFail, message := shouldHasSuffix(corpus, suffix); didFail {\n\t\treturn a.fail(message, userMessageComponents...)\n\t}\n\treturn true\n}", "func StringHasSuffix(column string, suffix 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.HasSuffix(\"\", suffix))\n\t})\n}", "func EndsWith(str, suffix string) bool {\n\treturn strings.HasSuffix(str, suffix)\n}", "func EndsWith(str string, suffix string) bool {\n\treturn internalEndsWith(str, suffix, false)\n}", "func (o *SignalPersonName) HasSuffix() bool {\n\tif o != nil && o.Suffix.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func fnHasSuffix(ctx Context, doc *JDoc, params []string) interface{} {\n\tstats := ctx.Value(EelTotalStats).(*ServiceStats)\n\tif params == nil || len(params) != 2 {\n\t\tctx.Log().Error(\"error_type\", \"func_hassuffix\", \"op\", \"match\", \"cause\", \"wrong_number_of_parameters\", \"params\", params)\n\t\tstats.IncErrors()\n\t\tAddError(ctx, SyntaxError{fmt.Sprintf(\"wrong number of parameters in call to hassuffix function\"), \"hassuffix\", params})\n\t\treturn nil\n\t}\n\treturn strings.HasSuffix(extractStringParam(params[0]), extractStringParam(params[1]))\n}", "func endsWithFunc(a, b string) bool {\n\treturn strings.HasSuffix(a, b)\n}", "func main() {\n\tvar endWith = strings.HasSuffix(\"This is an example string\", \"ng\")\n\tfmt.Println(endWith)\n}", "func (a *Assertions) NotHasSuffix(corpus, suffix string, userMessageComponents ...interface{}) bool {\n\ta.assertion()\n\tif didFail, message := shouldNotHasSuffix(corpus, suffix); didFail {\n\t\treturn a.fail(message, userMessageComponents...)\n\t}\n\treturn true\n}", "func IsSuffixSupported(value string) bool {\n\tfor _, ext := range supportedExtensions {\n\t\tif strings.HasSuffix(value, ext) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func internalEndsWith(str string, suffix string, ignoreCase bool) bool {\n\tif str == \"\" || suffix == \"\" {\n\t\treturn (str == \"\" && suffix == \"\")\n\t}\n\tif utf8.RuneCountInString(suffix) > utf8.RuneCountInString(str) {\n\t\treturn false\n\t}\n\tif ignoreCase {\n\t\treturn strings.HasSuffix(strings.ToLower(str), strings.ToLower(suffix))\n\t}\n\treturn strings.HasSuffix(str, suffix)\n}", "func NameHasSuffix(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldName), v))\n\t},\n\t)\n}", "func Test_HasSuffix(t *testing.T) {\n\tvalue := \"main.go\"\n\tif !strings.HasSuffix(value, \".go\") {\n\t\tt.Fatalf(\"expected %s to have suffix %s\", value, \".go\")\n\t}\n}", "func NameHasSuffix(v string) predicate.GameServer {\n\treturn predicate.GameServer(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldName), v))\n\t})\n}", "func EndsWith(s, sub string) bool {\n\treturn s != \"\" && strings.HasSuffix(s, sub)\n}", "func EndsWith(s, sub string) bool {\n\tif s == \"\" {\n\t\treturn false\n\t}\n\n\treturn strings.HasSuffix(s, sub)\n}", "func LastNameHasSuffix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldLastName), v))\n\t})\n}", "func TrimSuffix(suffix, operand string) string { return strings.TrimSuffix(operand, suffix) }", "func SubHasSuffix(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldSub), v))\n\t})\n}", "func NameHasSuffix(v string) predicate.Conversion {\n\treturn predicate.Conversion(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldName), v))\n\t})\n}", "func LastnameHasSuffix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldLastname), v))\n\t})\n}", "func NameHasSuffix(v string) predicate.Product {\n\treturn predicate.Product(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldName), v))\n\t})\n}", "func NameHasSuffix(v string) predicate.Ref {\n\treturn predicate.Ref(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldName), v))\n\t})\n}", "func NameHasSuffix(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldName), v))\n\t})\n}", "func CorrectionHasSuffix(v string) predicate.TradeCorrection {\n\treturn predicate.TradeCorrection(sql.FieldHasSuffix(FieldCorrection, v))\n}", "func WorkplaceHasSuffix(v string) predicate.User {\n\treturn predicate.User(sql.FieldHasSuffix(FieldWorkplace, v))\n}", "func NameHasSuffix(v string) predicate.ValidMessage {\n\treturn predicate.ValidMessage(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldName), v))\n\t})\n}", "func NameHasSuffix(v string) predicate.Book {\n\treturn predicate.Book(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldName), v))\n\t})\n}", "func MannerNameHasSuffix(v string) predicate.Manner {\n\treturn predicate.Manner(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldMannerName), v))\n\t})\n}", "func NameHasSuffix(v string) predicate.AllocationStrategy {\n\treturn predicate.AllocationStrategy(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldName), v))\n\t})\n}", "func TagHasSuffix(t kappnavv1.Tag, suffix string) bool {\n\treturn strings.HasSuffix(string(t), suffix)\n}", "func MednoHasSuffix(v string) predicate.Medicalfile {\n\treturn predicate.Medicalfile(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldMedno), v))\n\t})\n}", "func NameHasSuffix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldName), v))\n\t})\n}", "func NameHasSuffix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldName), v))\n\t})\n}", "func NameHasSuffix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldName), v))\n\t})\n}", "func PhoneHasSuffix(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldPhone), v))\n\t})\n}", "func PhoneHasSuffix(v string) predicate.Surgeryappointment {\n\treturn predicate.Surgeryappointment(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldPhone), v))\n\t})\n}", "func SubtypeHasSuffix(v string) predicate.Block {\n\treturn predicate.Block(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldSubtype), v))\n\t})\n}", "func NameHasSuffix(v string) predicate.Watchlist {\n\treturn predicate.Watchlist(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldName), v))\n\t})\n}", "func (f *File) matchesSuffix(path string, suffixes []string) bool {\n\tfor _, suffix := range suffixes {\n\t\tif suffix != \"\" && strings.HasSuffix(path, suffix) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func WorkplaceHasSuffix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldWorkplace), v))\n\t})\n}", "func TargetHasSuffix(v string) predicate.Permission {\n\treturn predicate.Permission(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldTarget), v))\n\t})\n}", "func AilmentHasSuffix(v string) predicate.Patientofphysician {\n\treturn predicate.Patientofphysician(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldAilment), v))\n\t})\n}", "func NameHasSuffix(v string) predicate.Watchlisthistory {\n\treturn predicate.Watchlisthistory(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldName), v))\n\t})\n}", "func DetialHasSuffix(v string) predicate.Medicalfile {\n\treturn predicate.Medicalfile(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldDetial), v))\n\t})\n}", "func EndsWithStr(str, target string) bool {\n\tstrLen := len(str)\n\ttarLen := len(target)\n\tchunk := str[strLen-tarLen:]\n\treturn chunk == target\n}", "func StreetHasSuffix(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldStreet), v))\n\t})\n}", "func ProcedureNameHasSuffix(v string) predicate.ProcedureType {\n\treturn predicate.ProcedureType(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldProcedureName), v))\n\t})\n}", "func ContentHasSuffix(v string) predicate.Post {\n\treturn predicate.Post(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldContent), v))\n\t})\n}", "func PatientNameHasSuffix(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldPatientName), v))\n\t})\n}", "func errHasSuffix(err, errSuffix error) bool {\n\treturn err != nil && strings.HasSuffix(err.Error(), errSuffix.Error())\n}", "func ZipcodeHasSuffix(v string) predicate.Delivery {\n\treturn predicate.Delivery(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldZipcode), v))\n\t})\n}", "func NameHasSuffix(v string) predicate.User {\n\treturn predicate.User(sql.FieldHasSuffix(FieldName, v))\n}", "func NameHasSuffix(v string) predicate.User {\n\treturn predicate.User(sql.FieldHasSuffix(FieldName, v))\n}", "func BenefitsHasSuffix(v string) predicate.Job {\n\treturn predicate.Job(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldBenefits), v))\n\t})\n}", "func NameHasSuffix(v string) predicate.GithubRelease {\n\treturn predicate.GithubRelease(sql.FieldHasSuffix(FieldName, v))\n}", "func StringValHasSuffix(v string) predicate.Property {\n\treturn predicate.Property(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldStringVal), v))\n\t})\n}", "func ReasonHasSuffix(v string) predicate.ProfileUKM {\n\treturn predicate.ProfileUKM(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldReason), v))\n\t})\n}", "func STATUSBABYNAMEHasSuffix(v string) predicate.Babystatus {\n\treturn predicate.Babystatus(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldSTATUSBABYNAME), v))\n\t})\n}", "func TimezoneHasSuffix(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldTimezone), v))\n\t})\n}", "func NickNameHasSuffix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldNickName), v))\n\t})\n}", "func DirHasSuffix(dir, suffix string) bool {\n\tdir = path.Clean(dir)\n\tsuffix = path.Clean(suffix)\n\treturn strings.HasSuffix(dir, suffix)\n}", "func EndsWithIgnoreCase(str string, suffix string) bool {\n\treturn internalEndsWith(str, suffix, true)\n}", "func PhoneHasSuffix(v string) predicate.User {\n\treturn predicate.User(sql.FieldHasSuffix(FieldPhone, v))\n}", "func stringSuffixIndexFunc(s string, f func(c rune) bool) (i int) {\n var hasSuffix bool\n i = strings.LastIndexFunc(s, func(c rune) (done bool) {\n if done = !f(c); !hasSuffix {\n hasSuffix = !done\n }\n return\n })\n if i++; !hasSuffix {\n i = -1\n }\n return\n}", "func ZipcodeHasSuffix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldZipcode), v))\n\t})\n}", "func NicknameHasSuffix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldNickname), v))\n\t})\n}", "func MatchSuffix(suffixes ...string) MatcherFunc { return MatchSuffixes(suffixes) }", "func NicknameHasSuffix(v string) predicate.User {\n\treturn predicate.User(sql.FieldHasSuffix(FieldNickname, v))\n}", "func (o BucketLifecycleRuleItemConditionPtrOutput) MatchesSuffix() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *BucketLifecycleRuleItemCondition) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MatchesSuffix\n\t}).(pulumi.StringArrayOutput)\n}", "func StreetHasSuffix(v string) predicate.Delivery {\n\treturn predicate.Delivery(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldStreet), v))\n\t})\n}", "func ScriptHasSuffix(v string) predicate.AllocationStrategy {\n\treturn predicate.AllocationStrategy(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldScript), v))\n\t})\n}", "func BequipmentHasSuffix(v string) predicate.Repairinvoice {\n\treturn predicate.Repairinvoice(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldBequipment), v))\n\t})\n}", "func PhoneHasSuffix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldPhone), v))\n\t})\n}", "func PhoneHasSuffix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldPhone), v))\n\t})\n}", "func PhoneHasSuffix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldPhone), v))\n\t})\n}", "func URLHasSuffix(v string) predicate.Token {\n\treturn predicate.Token(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldURL), v))\n\t},\n\t)\n}", "func BunameHasSuffix(v string) predicate.Building {\n\treturn predicate.Building(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldBuname), v))\n\t})\n}", "func HasExt(fname, suffix string) bool {\n\treturn strings.HasSuffix(fname, \".\"+suffix) && (!strings.HasPrefix(fname, \".\") || strings.HasPrefix(fname, \"_\"))\n}", "func TagNameHasSuffix(v string) predicate.GithubRelease {\n\treturn predicate.GithubRelease(sql.FieldHasSuffix(FieldTagName, v))\n}", "func LocationHasSuffix(v string) predicate.User {\n\treturn predicate.User(sql.FieldHasSuffix(FieldLocation, v))\n}", "func (o BucketLifecycleRuleItemConditionOutput) MatchesSuffix() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v BucketLifecycleRuleItemCondition) []string { return v.MatchesSuffix }).(pulumi.StringArrayOutput)\n}", "func (o *WhatsAppNameWhatsAppApiContent) HasNameSuffix() bool {\n\tif o != nil && o.NameSuffix != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func NoteHasSuffix(v string) predicate.Surgeryappointment {\n\treturn predicate.Surgeryappointment(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldNote), v))\n\t})\n}", "func NetworkIDHasSuffix(v string) predicate.Blob {\n\treturn predicate.Blob(\n\t\tfunc(s *sql.Selector) {\n\t\t\ts.Where(sql.HasSuffix(s.C(FieldNetworkID), v))\n\t\t},\n\t)\n}", "func AddressHasSuffix(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldAddress), v))\n\t})\n}", "func StateHasSuffix(v string) predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldState), v))\n\t})\n}", "func KinNameHasSuffix(v string) predicate.Rent {\n\treturn predicate.Rent(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldKinName), v))\n\t})\n}", "func VersionHasSuffix(v string) predicate.Agent {\n\treturn predicate.Agent(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldVersion), v))\n\t})\n}", "func URLShortenedHasSuffix(v string) predicate.Token {\n\treturn predicate.Token(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldURLShortened), v))\n\t},\n\t)\n}" ]
[ "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.70741785", "0.70560384", "0.7010844", "0.6933531", "0.6924527", "0.6889086", "0.68876415", "0.6873491", "0.6851684", "0.6844303", "0.68420047", "0.68294525", "0.6819447", "0.67657214", "0.6751997", "0.6739258", "0.67275125", "0.6726801", "0.6712513", "0.67123055", "0.6636159", "0.66284525", "0.6613821", "0.6613821", "0.6613821", "0.6611495", "0.66102666", "0.65986013", "0.65942705", "0.6589877", "0.6582228", "0.65683925", "0.655789", "0.65575886", "0.6554399", "0.6551576", "0.6547202", "0.6541333", "0.6537976", "0.65352905", "0.6521293", "0.65189475", "0.6502789", "0.6502789", "0.64632875", "0.6450684", "0.6440077", "0.6432355", "0.6430982", "0.6428802", "0.64246255", "0.6421865", "0.642057", "0.641896", "0.6415688", "0.6411927", "0.6404379", "0.6395542", "0.63953954", "0.63909185", "0.63544935", "0.63457525", "0.6342555", "0.63369304", "0.63369304", "0.63369304", "0.6330501", "0.6325641", "0.63245165", "0.6291882", "0.62909555", "0.62826884", "0.62740755", "0.62643194", "0.6257429", "0.6251942", "0.62505347", "0.6246501", "0.6230051", "0.6227624" ]
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 {\n\treturn strings.Index(s.str, str)\n}", "func TestStringsIndex(t *testing.T) {\n\ttcs := []struct {\n\t\tword string\n\t\tsubstr string\n\t\texp int\n\t}{\n\t\t{word: \"Gophers are amazing!\", substr: \"are\", exp: 8},\n\t\t{word: \"Testing in Go is fun.\", substr: \"fun\", exp: 17},\n\t\t{word: \"The answer is 42.\", substr: \"is\", exp: 11},\n\t}\n\n\tfor i := range tcs {\n\t\ttc := tcs[i]\n\t\tt.Run(tc.word, func(t *testing.T) {\n\t\t\tt.Parallel()\n\t\t\tgot := strings.Index(tc.word, tc.substr)\n\t\t\tt.Logf(\"testing %q\", tc.word)\n\t\t\tif got != tc.exp {\n\t\t\t\tt.Errorf(\"unexpected value '%s' index of '%s' got: %d, exp: %d\", tc.substr, tc.word, got, tc.exp)\n\t\t\t}\n\t\t})\n\t}\n}", "func Index(s string, substr string) int {\n\td := CalculateSlideTable(substr)\n\treturn IndexWithTable(&d, s, substr)\n}", "func Test_Index(t *testing.T) {\n\ttt := []struct {\n\t\tValue string\n\t\tSubstring string\n\t\tAnswer int\n\t}{\n\t\t{\n\t\t\t\"Gophers are amazing!\",\n\t\t\t\"are\",\n\t\t\t8,\n\t\t},\n\t\t{\n\t\t\t\"Testing in Go is fun.\",\n\t\t\t\"fun\",\n\t\t\t17,\n\t\t},\n\t\t{\n\t\t\t\"The answer is 42.\",\n\t\t\t\"is\",\n\t\t\t11,\n\t\t},\n\t}\n\n\tfor _, test := range tt {\n\t\tif actual := strings.Index(test.Value, test.Substring); actual != test.Answer {\n\t\t\tt.Fatalf(\"expected index of substring '%s' in string '%s' to be %v\", test.Substring, test.Value, test.Answer)\n\t\t}\n\t}\n}", "func LastIndex(substr, operand string) int { return strings.LastIndex(operand, substr) }", "func indexInSlice(slice []string, substr string) int {\n\tfor i := range slice {\n\t\tif strings.Contains(slice[i], substr) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func IndexAny(chars, operand string) int { return strings.IndexAny(operand, chars) }", "func (t *StringSlice) Index(s string) int {\n\tret := -1\n\tfor i, item := range t.items {\n\t\tif s == item {\n\t\t\tret = i\n\t\t\tbreak\n\t\t}\n\t}\n\treturn ret\n}", "func IndexOf(str1, str2 string, off int) int {\n\tindex := strings.Index(str1[off:], str2)\n\tif index == -1 {\n\t\treturn -1\n\t}\n\treturn index + off\n}", "func Index(a []string, s string) int {\n\tif len(a) == 0 {\n\t\treturn -1\n\t}\n\tfor i, v := range a {\n\t\tif v == s {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func IndexStr(haystack []string, needle string) int {\n\tfor idx, s := range haystack {\n\t\tif s == needle {\n\t\t\treturn idx\n\t\t}\n\t}\n\treturn -1\n}", "func GetStringIndex(slice []string, target string) int {\n\tfor i := range slice {\n\t\tif slice[i] == target {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func IndexOf(str string, sub string, start int) int {\n\n\tif start < 0 {\n\t\tstart = 0\n\t}\n\n\tif len(str) < start {\n\t\treturn INDEX_NOT_FOUND\n\t}\n\n\tif IsEmpty(str) || IsEmpty(sub) {\n\t\treturn INDEX_NOT_FOUND\n\t}\n\n\tpartialIndex := strings.Index(str[start:len(str)], sub)\n\tif partialIndex == -1 {\n\t\treturn INDEX_NOT_FOUND\n\t}\n\treturn partialIndex + start\n}", "func IndexFrom(s, substr []byte, from int) int {\n\tif from >= len(s) {\n\t\treturn -1\n\t}\n\tif from <= 0 {\n\t\treturn bytes.Index(s, substr)\n\t}\n\ti := bytes.Index(s[from:], substr)\n\tif i == -1 {\n\t\treturn -1\n\t}\n\treturn from + i\n}", "func (c *compiler) stringIndex(s, i *LLVMValue) *LLVMValue {\n\tptr := c.builder.CreateExtractValue(s.LLVMValue(), 0, \"\")\n\tptr = c.builder.CreateGEP(ptr, []llvm.Value{i.LLVMValue()}, \"\")\n\treturn c.NewValue(c.builder.CreateLoad(ptr, \"\"), types.Typ[types.Byte])\n}", "func Index(ss []string, s string) int {\n\tfor i, b := range ss {\n\t\tif b == s {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func (k *Kmp) Index(s string) int {\n\tlen1, len2 := len(s), len(k.pattern)\n\ti, j := 0, 0\n\tfor i < len1 && j < len2 {\n\t\tif j == -1 || s[i] == k.pattern[j] {\n\t\t\ti++\n\t\t\tj++\n\t\t} else {\n\t\t\tj = k.next[j]\n\t\t}\n\t}\n\tif j == len2 {\n\t\treturn i - j\n\t} else {\n\t\treturn -1\n\t}\n}", "func IndexWithTable(d *[256]int, s string, substr string) int {\n\tlsub := len(substr)\n\tls := len(s)\n\t// fmt.Println(ls, lsub)\n\tswitch {\n\tcase lsub == 0:\n\t\treturn 0\n\tcase lsub > ls:\n\t\treturn -1\n\tcase lsub == ls:\n\t\tif s == substr {\n\t\t\treturn 0\n\t\t}\n\t\treturn -1\n\t}\n\n\ti := 0\n\tfor i+lsub-1 < ls {\n\t\tj := lsub - 1\n\t\tfor ; j >= 0 && s[i+j] == substr[j]; j-- {\n\t\t}\n\t\tif j < 0 {\n\t\t\treturn i\n\t\t}\n\n\t\tslid := j - d[s[i+j]]\n\t\tif slid < 1 {\n\t\t\tslid = 1\n\t\t}\n\t\ti += slid\n\t}\n\treturn -1\n}", "func (String) Index(c *compiler.Compiler, this compiler.Expression, indices ...compiler.Expression) (expression compiler.Expression, err error) {\n\texpression = c.NewExpression()\n\n\tif len(indices) != 1 {\n\t\treturn expression, c.NewError(\"array takes 1 symbol index\")\n\t}\n\n\tvar index = indices[0]\n\n\texpression.Type = Symbol{}\n\texpression.Go.WriteString(`ctx.Strindex(`)\n\texpression.Go.WriteB(this.Go)\n\texpression.Go.WriteString(`,`)\n\texpression.Go.WriteB(index.Go)\n\texpression.Go.WriteString(`)`)\n\n\treturn expression, nil\n}", "func TestStringIndex(t *testing.T) {\n\tt.Parallel()\n\tvar tests = []struct {\n\t\thaystack []string\n\t\tneedle string\n\t\texpected int\n\t}{\n\t\t{[]string{\"foo\", \"bar\"}, \"foo\", 0},\n\t\t{[]string{\"foo\", \"bar\"}, \"bar\", 1},\n\t\t{[]string{\"foo\", \"bar\"}, \"\\u0062\\u0061\\u0072\", 1},\n\t\t{[]string{\"foo\", \"bar\"}, \"\", -1},\n\t\t{[]string{\"foo\", \"bar\"}, \"blah\", -1},\n\t}\n\tfor _, test := range tests {\n\t\tactual := primitives.Index(&test.haystack, test.needle)\n\t\tassert.Equal(t, test.expected, actual, \"expected value '%v' | actual : '%v'\", test.expected, actual)\n\t}\n}", "func StringsIndex(s []string, want string) int {\n\tfor i, str := range s {\n\t\tif str == want {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func getStrIndex(strings []string, s string) int {\n\tfor i, col := range strings {\n\t\tif col == s {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func Index(s, t string) int {\n\tx := 0\n\ty := 0\n\tfor _, c := range s {\n\t\tif c == c {\n\t\t\tx++\n\t\t}\n\t}\n\tfor _, c := range t {\n\t\tif c == c {\n\t\t\ty++\n\t\t}\n\t}\n\tfor i := 0; i < x; i++ {\n\t\tif y != 0 && s[i] == t[0] {\n\t\t\tok := true\n\t\t\tmok := 0\n\t\t\tfor j := 0; j < y; j++ {\n\t\t\t\tif i+mok >= x || t[j] != s[i+mok] {\n\t\t\t\t\tok = false\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tmok++\n\t\t\t}\n\t\t\tif ok == true {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t}\n\treturn -1\n}", "func IndexString(vs []string, t string) int {\n for i, v := range vs {\n if v == t {\n return i\n }\n }\n return -1\n}", "func sliceIndex(slice []string, x string) int {\n\tfor i, v := range slice {\n\t\tif v == x {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func index(slice []string, item string) int {\n\tfor i := range slice {\n\t\tif slice[i] == item {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func TestFindStringIndex(t *testing.T) {\n\tregex := regexp.MustCompile(\"Brian\")\n\tsubject := \"Hello Brian\"\n\tindex := regex.FindStringIndex(subject)\n\tAssert(6, index[0], t)\n\tAssert(11, index[1], t)\n}", "func StringSliceIndex(slice []string, str string) int {\n\tfor i := range slice {\n\t\tif slice[i] == str {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func (b *profileBuilder) stringIndex(s string) int64 {\n\tid, ok := b.stringMap[s]\n\tif !ok {\n\t\tid = len(b.strings)\n\t\tb.strings = append(b.strings, s)\n\t\tb.stringMap[s] = id\n\t}\n\treturn int64(id)\n}", "func strStr(haystack string, needle string) int {\n\tif len(haystack) == 0{\n\t\treturn 0\n\t}\n\tindex := strings.Index(haystack , needle)\n\treturn index\n}", "func (re *RegexpStd) FindStringIndex(s string) (loc []int) {\n\t// a := re.doExecute(nil, nil, s, 0, 2, nil)\n\t// if a == nil {\n\t// \treturn nil\n\t// }\n\t// return a[0:2]\n\tpanic(\"\")\n}", "func posString(slice []string, element string) int {\n\tfor index, elem := range slice {\n\t\tif elem == element {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn -1\n}", "func posString(slice []string, element string) int {\n\tfor index, elem := range slice {\n\t\tif elem == element {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn -1\n}", "func posString(slice []string, element string) int {\n\tfor index, elem := range slice {\n\t\tif elem == element {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn -1\n}", "func posString(slice []string, element string) int {\n\tfor index, elem := range slice {\n\t\tif elem == element {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn -1\n}", "func posString(slice []string, element string) int {\n\tfor index, elem := range slice {\n\t\tif elem == element {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn -1\n}", "func (slice StringSlice) IndexOf(str string) int {\n\tfor p, v := range slice {\n\t\tif v == str {\n\t\t\treturn p\n\t\t}\n\t}\n\treturn -1\n}", "func (c *compiler) strIndex(s string) int {\n\tif index, ok := c.indexes.strs[s]; ok {\n\t\treturn index // reuse existing constant\n\t}\n\tindex := len(c.program.Strs)\n\tc.program.Strs = append(c.program.Strs, s)\n\tc.indexes.strs[s] = index\n\treturn index\n}", "func (re *RegexpStd) SubexpIndex(name string) int {\n\treturn 0\n}", "func indexOfString(h []string, n string) int {\n\tfor i, v := range h {\n\t\tif v == n {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn -1\n}", "func StringSliceIndexOf(slice []string, s string) int {\n\treturn strings.IndexOf(slice, s)\n}", "func IndexedApply(s Indexed, args Sequence) Value {\n\ti := AssertArityRange(args, 1, 2)\n\tidx := AssertInteger(args.First())\n\tif r, ok := s.ElementAt(idx); ok {\n\t\treturn r\n\t}\n\tif i == 2 {\n\t\treturn args.Rest().First()\n\t}\n\tpanic(ErrStr(IndexNotFound, strconv.Itoa(idx)))\n}", "func (s *Set) Index(v string) (int, bool) {\n\tslot, found := s.findSlot(v)\n\tif !found {\n\t\treturn 0, false\n\t}\n\n\tindexPlusOne := s.table[slot]\n\treturn int(indexPlusOne - 1), true\n}", "func Index(tokens []Token, kind Kind, text string) Position {\n\tfor i, token := range tokens {\n\t\tif token.Kind == kind && token.Text() == text {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn -1\n}", "func Test_Index_WithSubTest(t *testing.T) {\n\ttt := []struct {\n\t\tValue string\n\t\tSubstring string\n\t\tAnswer int\n\t}{\n\t\t{\n\t\t\t\"Gophers are amazing!\",\n\t\t\t\"are\",\n\t\t\t8,\n\t\t},\n\t\t{\n\t\t\t\"Testing in Go is fun.\",\n\t\t\t\"fun\",\n\t\t\t17,\n\t\t},\n\t\t{\n\t\t\t\"The answer is 42.\",\n\t\t\t\"is\",\n\t\t\t11,\n\t\t},\n\t}\n\n\tfor i, test := range tt {\n\n\t\tt.Run(fmt.Sprintf(\"sub test (%d)\", i), func(st *testing.T) {\n\t\t\tif actual := strings.Index(test.Value, test.Substring); actual != test.Answer {\n\t\t\t\tst.Fatalf(\"expected index of substring '%s' in string '%s' to be %v\", test.Substring, test.Value, test.Answer)\n\t\t\t}\n\t\t})\n\t}\n}", "func IndexOf(ss []string, e string) int {\n\tfor i, s := range ss {\n\t\tif s == e {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func index(n string) int {\n\tfor i, v := range allNotes {\n\t\tif n == v {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func LastIndexAny(chars, operand string) int { return strings.LastIndexAny(operand, chars) }", "func buildIndex(oprnd string) (string, bool) {\n\t//Get the text from the inside of the parentheses\n\tre := regexp.MustCompile(\"\\\\(([^)]+)\\\\)\")\n\n\tr := re.FindString(oprnd)\n\t//Remove the ( and ) from the string\n\tr = strings.Replace(r, \"(\", \"\", -1)\n\tr = strings.Replace(r, \")\", \"\", -1)\n\n\t//Split the arguments of the operand (time arguments and index)\n\targs := strings.Split(r, \",\")\n\n\t//Timestring (will remain null if the index does not have a time function attached)\n\tts := \"\"\n\t//Length of arguments must be greater than 1 (time function) (not true if virtual index)\n\tif len(args) > 1 {\n\t\t//Pass the time arguments to build the index suffix (exclude the index istelf)\n\t\t//Time string is in the format YYYYMMDDHHMMSS\n\t\tts = buildTimestring(args[0 : len(args)-1])\n\t}\n\t//Check to see if the index is negated or not\n\tindex := args[len(args)-1]\n\tlog.Println(index)\n\tif string(index[0]) == \"~\" {\n\t\t//Remove the tilde\n\t\tindex := strings.Replace(index, \"~\", \"\", -1)\n\t\t//Remove the single quotes\n\t\tindex = strings.Replace(index, \"'\", \"\", -1)\n\t\t//Return the index with the timestring and negation set to true\n\t\tif ts != \"\" {\n\t\t\treturn index + \":\" + ts, true\n\t\t} else {\n\t\t\treturn index, true\n\t\t}\n\t} else { //Not negated\n\t\t//Remove the single quotes\n\t\tindex := strings.Replace(index, \"'\", \"\", -1)\n\t\t//Return the index with the timestring and negation set to false\n\t\tif ts != \"\" {\n\t\t\treturn index + \":\" + ts, false\n\t\t\t} else {\n\t\t\t\treturn index, false\n\t\t\t}\n\t}\n}", "func (s *Stringish) LastIndex(str string) int {\n\treturn strings.LastIndex(s.str, str)\n}", "func SliceIndex(haystack []string, needle string) int {\n\tfor i, item := range haystack {\n\t\tif item == needle {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func indexOfSingleDiff(s1 string, s2 string) int {\r\n\tfor i, val := range s1 {\r\n\t\tif val != rune(s2[i]) {\r\n\t\t\treturn i\r\n\t\t}\r\n\t}\r\n\treturn -1\r\n}", "func TestFindIndex(t *testing.T) {\n\tregex := regexp.MustCompile(\"Brian\")\n\tsubject := []byte(\"My name is Brian, pleased to meet you\")\n\tindex := regex.FindIndex(subject)\n\tAssert(index[0], 11, t)\n\tAssert(index[1], 16, t)\n}", "func (slice stringSlice) pos(value string) int {\n\tfor p, v := range slice {\n\t\tif v == value {\n\t\t\treturn p\n\t\t}\n\t}\n\n\treturn -1\n}", "func stringSuffixIndexFunc(s string, f func(c rune) bool) (i int) {\n var hasSuffix bool\n i = strings.LastIndexFunc(s, func(c rune) (done bool) {\n if done = !f(c); !hasSuffix {\n hasSuffix = !done\n }\n return\n })\n if i++; !hasSuffix {\n i = -1\n }\n return\n}", "func indexOfStringSlice(strings []string, s string) int {\n\tfor i, b := range strings {\n\t\tif b == s {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func IndexOfString(value string, list []string) int {\n\tfor i, match := range list {\n\t\tif match == value {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func (re *RegexpStd) FindStringSubmatchIndex(s string) []int {\n\t//return re.pad(re.doExecute(nil, nil, s, 0, re.prog.NumCap, nil))\n\tpanic(\"\")\n}", "func (ins *StringIndex) Execute(_ *int, vm *VM) error {\n\tindex := number.Int64(number.NewNumber(vm.Get(ins.Index).Value))\n\n\t// TODO(elliot): This won't work with multibyte characters.\n\tvm.Set(ins.Result, asttest.NewLiteralChar([]rune(vm.Get(ins.Str).Value)[index]))\n\n\treturn nil\n}", "func TestFindAllStringIndex(t *testing.T) {\n\tregex := regexp.MustCompile(\"Brian\")\n\tsubject := \"Brian. Meet Brian\"\n\tindexes := regex.FindAllStringIndex(subject, 2)\n\tAssert(0, indexes[0][0], t)\n\tAssert(5, indexes[0][1], t)\n\tAssert(12, indexes[1][0], t)\n\tAssert(17, indexes[1][1], t)\n}", "func main() {\n\trv := substr(\"abc\", \"abc\")\n\tfmt.Println(rv)\n}", "func indexOf(index string) (int, error) {\n\tif index[0] != '#' {\n\t\treturn 0, errors.New(\"no index\")\n\t}\n\treturn strconv.Atoi(index[1:])\n}", "func stringPositionInSlice(a string, list []string) (int, error) {\n\tfor i, v := range list {\n\t\tmatch, _ := regexp.MatchString(a, v)\n\t\tif match {\n\t\t\treturn i, nil\n\t\t}\n\t}\n\treturn 0, fmt.Errorf(\"No matching headers\")\n}", "func getOperandIndex(op string) (index int) {\n\t// get tier 3 operands\n\tfor i, c := range op {\n\t\tif c == '^' {\n\t\t\tif !isOpInBrackets(op[i:]) {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t}\n\n\t// get tier 2 operands\n\tfor i, c := range op {\n\t\tif c == '*' || c == '/' {\n\t\t\tif !isOpInBrackets(op[i:]) {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t}\n\n\t// get tier 1 operands\n\tfor i, c := range op {\n\t\tif c == '+' || c == '-' {\n\t\t\tif !isOpInBrackets(op[i:]) {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t}\n\n\t// nothing was found\n\treturn 0\n}", "func strStr(haystack string, needle string) int {\n if needle == \"\" {\n return 0\n }\n if haystack == \"\" {\n return -1\n }\n lh := len(haystack)\n ln := len(needle)\n check := needle[0]\n start := 0\n \n for start + ln <= lh {\n if string(haystack[start:start+ln]) == needle {\n return start\n }\n start++\n for start < lh && haystack[start] != check {\n start++\n }\n }\n return -1\n}", "func StringIdxOff(list []string, indices []int, element string, offset int) (int, int, bool) {\n\tleft := 0\n\tright := len(indices) - 1\n\tif len(element) > 0 {\n\t\tfor left <= right {\n\t\t\tmiddle := (left + right) / 2\n\t\t\tvalueIndex := indices[middle]\n\t\t\tvalue := list[valueIndex]\n\t\t\tif len(value) >= offset {\n\t\t\t\tvalue = value[offset:]\n\t\t\t\tif element > value {\n\t\t\t\t\tleft = middle + 1\n\t\t\t\t} else if strings.HasPrefix(value, element) {\n\t\t\t\t\tfrom := stringIdxOffL(list, indices, element, left, middle-1, offset)\n\t\t\t\t\tto := stringIdxOffR(list, indices, element, middle+1, right, offset)\n\t\t\t\t\treturn from, to, true\n\t\t\t\t} else {\n\t\t\t\t\tright = middle - 1\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tleft = middle + 1\n\t\t\t}\n\t\t}\n\t} else if len(list) > 0 {\n\t\treturn 0, len(list), true\n\t}\n\treturn left, left + 1, false\n}", "func IndexOfString(array []string, val string) int {\n\tfor index, arrayVal := range array {\n\t\tif arrayVal == val {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn -1\n}", "func IndexOfDifference(str1 string, str2 string) int {\n\tif str1 == str2 {\n\t\treturn INDEX_NOT_FOUND\n\t}\n\tif IsEmpty(str1) || IsEmpty(str2) {\n\t\treturn 0\n\t}\n\tvar i int\n\tfor i = 0; i < len(str1) && i < len(str2); i++ {\n\t\tif rune(str1[i]) != rune(str2[i]) {\n\t\t\tbreak\n\t\t}\n\t}\n\tif i < len(str2) || i < len(str1) {\n\t\treturn i\n\t}\n\treturn INDEX_NOT_FOUND\n}", "func IndexStringInSlice(a string, l []string) (int, bool) {\n\tfor i, b := range l {\n\t\tif b == a {\n\t\t\treturn i, true\n\t\t}\n\t}\n\treturn -1, false\n}", "func (t Text) Index(k interface{}) (interface{}, error) {\n\tindex, err := vals.ConvertListIndex(k, len(t))\n\tif err != nil {\n\t\treturn nil, err\n\t} else if index.Slice {\n\t\treturn t[index.Lower:index.Upper], nil\n\t} else {\n\t\treturn t[index.Lower], nil\n\t}\n}", "func StringIdx(list []string, indices []int, element string) (int, bool) {\n\tleft := 0\n\tright := len(indices) - 1\n\tfor left <= right {\n\t\tmiddle := (left + right) / 2\n\t\tvalueIndex := indices[middle]\n\t\tvalue := list[valueIndex]\n\t\tif element > value {\n\t\t\tleft = middle + 1\n\t\t} else if element < value {\n\t\t\tright = middle - 1\n\t\t} else {\n\t\t\treturn middle, true\n\t\t}\n\t}\n\treturn left, false\n}", "func findIndex(v []string, s string, i int) int {\n\tif s == \"\" {\n\t\tif i < len(v) {\n\t\t\treturn i\n\t\t}\n\t\treturn -1\n\t}\n\treturn indexOf(v, s)\n}", "func indexValueOf(args []string, flag string) (int, int, error) {\n for i := 0; i < len(args); i ++ {\n s := args[i]\n\n if len(s) == 0 || s[0] != '-' || len(s) == 1 {\n continue\n }\n\n num_minuses := 1\n if s[1] == '-' {\n num_minuses++\n if len(s) == 2 { // \"--\" terminates the flags\n i ++\n break\n }\n }\n\n name := s[num_minuses:]\n if len(name) == 0 || name[0] == '-' || name[0] == '=' {\n continue\n }\n\n // it's a flag. does it have an argument?\n has_value := false\n var j int\n for j = 1; j < len(name); j ++ { // equals cannot be first\n if name[j] == '=' {\n has_value = true\n name = name[0:j]\n break\n }\n }\n\n if name == flag {\n if !has_value {\n if i + 1 < len(args) {\n // value is the current arg\n has_value = true\n return i + 1, 0, nil\n }\n\n return -1, -1, fmt.Errorf(\"flag needs an argument: -%s\", name)\n }\n\n return i, num_minuses + j + 1, nil\n }\n }\n\n return -1, -1, fmt.Errorf(\"not found\")\n}", "func (r *Rope) Index(at int) rune {\n\ts := skiplist{r: r}\n\tvar k *knot\n\tvar offset int\n\tvar err error\n\n\tif k, offset, _, err = s.find(at); err != nil {\n\t\treturn -1\n\t}\n\tif offset == BucketSize {\n\t\tchar, _ := utf8.DecodeRune(k.nexts[0].data[0:])\n\t\treturn char\n\t}\n\tchar, _ := utf8.DecodeRune(k.data[offset:])\n\treturn char\n}", "func (re *RegexpStd) FindIndex(b []byte) (loc []int) {\n\t// a := re.doExecute(nil, b, \"\", 0, 2, nil)\n\t// if a == nil {\n\t// \treturn nil\n\t// }\n\t// return a[0:2]\n\tpanic(\"\")\n}", "func StringLastIndex(a, b string) int { return strings.LastIndex(a, b) }", "func getMatchingBracketIndex(op string, brindex int) (index int) {\n\topenBracketCount := 0\n\tfor i, c := range op[brindex:] {\n\t\tif c == '(' {\n\t\t\topenBracketCount++\n\t\t} else if c == ')' {\n\t\t\topenBracketCount--\n\t\t}\n\n\t\t// if the bracket count is 0, it means the bracket requested\n\t\t// was closed (or never opened)\n\t\tif openBracketCount == 0 {\n\t\t\treturn i\n\t\t}\n\t}\n\n\t// nothing was found\n\treturn 0\n}", "func GetStringIndexInSlice(strToFind string, sliceOfStrings []string) int {\n\tfor strInd, str := range sliceOfStrings {\n\t\tif str == strToFind {\n\t\t\treturn strInd\n\t\t}\n\t}\n\treturn -1\n}", "func DetectSubStr(str, substr string) int {\n\tidx, j := 0, 0\n\tflag := false\n\n\tfor i := range str {\n\t\tif str[i] == substr[j] && !flag {\n\t\t\tidx = i\n\t\t\tj++\n\t\t\tflag = true\n\t\t} else if str[i] == substr[j] && flag {\n\t\t\tj++\n\t\t} else if str[i] != substr[j] && flag {\n\t\t\tj = 0\n\t\t\tflag = false\n\t\t}\n\n\t\tif j == len(substr)-1 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif flag {\n\t\treturn idx\n\t}\n\n\treturn -1\n}", "func runeIndex(rs, rsep []rune) int {\n\tif len(rs) < len(rsep) {\n\t\treturn -1\n\t}\n\tfor i, _ := range rs {\n\t\tmatched := true\n\t\tp := i\n\t\tfor j, _ := range rsep {\n\t\t\tif rs[p] != rsep[j] {\n\t\t\t\tmatched = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tp++\n\t\t}\n\t\tif matched {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn -1\n}", "func (arr StringArray) IndexOf(v string) int {\n\tfor i, s := range arr {\n\t\tif v == s {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn -1\n}", "func (self *kmp) FindStringIndex(s string) int {\n\t// sanity check\n\tif len(s) < self.size {\n\t\treturn -1\n\t}\n\tm, i := 0, 0\n\tfor m+i < len(s) {\n\t\tif self.pattern[i] == s[m+i] {\n\t\t\tif i == self.size-1 {\n\t\t\t\treturn m\n\t\t\t}\n\t\t\ti++\n\t\t} else {\n\t\t\tm += i - self.next[i]\n\t\t\tif self.next[i] > -1 {\n\t\t\t\ti = self.next[i]\n\t\t\t} else {\n\t\t\t\ti = 0\n\t\t\t}\n\t\t}\n\t}\n\treturn -1\n}", "func Index(a, b []byte) int", "func Index(s, pattern string) int {\n\tkmp := New(pattern)\n\treturn kmp.Index(s)\n}", "func IndexOf(slice []string, needle string) int {\n\tfor idx, s := range slice {\n\t\tif s == needle {\n\t\t\treturn idx\n\t\t}\n\t}\n\n\treturn -1\n}", "func getTextByIndex(myText string) byte {\n\t//\n\tvar textIndex byte = myText[0]\n\treturn textIndex \n}", "func (c testCase) offset() int {\n\tswitch x := c.substrOrOffset.(type) {\n\tcase int:\n\t\treturn x\n\tcase string:\n\t\ti := strings.Index(c.content, x)\n\t\tif i < 0 {\n\t\t\tpanic(fmt.Sprintf(\"%q does not contain substring %q\", c.content, x))\n\t\t}\n\t\treturn i\n\t}\n\tpanic(\"substrOrIndex must be an integer or string\")\n}", "func indexList(s string, list []string) int {\n\tfor i, l := range list {\n\t\tif l == s {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func IndexString(name string) (less func(a, b string) bool) {\n\tt, opts := parseCollation(name)\n\tc := collate.New(t, opts...)\n\treturn func(a, b string) bool {\n\t\treturn c.CompareString(a, b) == -1\n\t}\n}", "func getIndexOfCmdWithString(node *parse.PipeNode) (int, *parse.StringNode) {\n\tfor i, cmd := range node.Cmds {\n\t\tif len(cmd.Args) == 1 { // not sure about that, worth to be restrictive.\n\t\t\tif s, ok := cmd.Args[0].(*parse.StringNode); ok {\n\t\t\t\treturn i, s\n\t\t\t}\n\t\t}\n\t}\n\treturn -1, nil\n}", "func indexOf(v []string, s string) int {\n\ts = strings.TrimSpace(s)\n\tif i, err := strconv.Atoi(s); err == nil {\n\t\ti--\n\t\tif i >= 0 && i < len(v) {\n\t\t\treturn i\n\t\t}\n\t\treturn -1\n\t}\n\tfor i, vv := range v {\n\t\tif strings.EqualFold(s, strings.TrimSpace(vv)) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func (r *View) Index(needle []byte) int64 {\n\tif r.Remaining() == 0 {\n\t\treturn -1\n\t}\n\tif len(needle) == 0 {\n\t\treturn 0\n\t}\n\n\trc := r.Clone()\n\tif !rc.indexDestructive(needle) {\n\t\treturn -1\n\t}\n\treturn rc.consumed - r.consumed\n}", "func GetIndexFromStringSlice(slice []string, val string) (int, bool) {\n\tfor i, item := range slice {\n\t\tif item == val {\n\t\t\treturn i, true\n\t\t}\n\t}\n\treturn -1, false\n}", "func strStr(haystack string, needle string) int {\n\tif needle == \"\" {\n\t\treturn 0\n\t}\n\n\tif len(haystack) < len(needle) {\n\t\treturn -1\n\t}\n\n\tfor i := 0; i <= len(haystack)-len(needle); i++ {\n\t\tfor j := 0; j < len(needle) && needle[j] == haystack[j+i]; j++ {\n\t\t\tif j == len(needle)-1 {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn -1\n}", "func inStrSlice(a []string, x string, caseSensitive bool) int {\n\tfor idx, n := range a {\n\t\tif !caseSensitive && strings.EqualFold(x, n) {\n\t\t\treturn idx\n\t\t}\n\t\tif x == n {\n\t\t\treturn idx\n\t\t}\n\t}\n\treturn -1\n}", "func Strpos(haystack, needle string) int {\n\tpos := strings.Index(haystack, needle)\n\tif pos < 0 {\n\t\treturn pos\n\t}\n\n\trs := []rune(haystack[0:pos])\n\n\treturn len(rs)\n}", "func (c *cBinaryExpr) stringsIndex1() {\n\tc.stringsBytesIndex1(\"strings\")\n}" ]
[ "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.6464091", "0.644239", "0.64316785", "0.6408472", "0.63985425", "0.6379553", "0.63772434", "0.63537973", "0.6310543", "0.6264324", "0.6256691", "0.6237505", "0.62251115", "0.6224634", "0.6214435", "0.6214435", "0.6214435", "0.6214435", "0.6214435", "0.6159909", "0.61335987", "0.60309494", "0.59859025", "0.5980582", "0.5975747", "0.5946232", "0.5945811", "0.5940189", "0.59099346", "0.59009945", "0.5900233", "0.58913493", "0.5888387", "0.5885044", "0.58760136", "0.5868099", "0.58670354", "0.58667946", "0.58606505", "0.58472884", "0.58408153", "0.58306026", "0.58230555", "0.58228713", "0.58054", "0.58039343", "0.57988346", "0.5796813", "0.5791114", "0.57885176", "0.5763222", "0.5712996", "0.57081556", "0.5686909", "0.568128", "0.56805503", "0.56786376", "0.56734896", "0.56486946", "0.5618593", "0.5606687", "0.5598384", "0.55952543", "0.55888814", "0.55831647", "0.5570909", "0.5570504", "0.55692995", "0.55555284", "0.55435824", "0.55415523", "0.5538432", "0.5532595", "0.552713", "0.551738", "0.5516914", "0.5507991", "0.550362", "0.54904944", "0.54880226" ]
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) bool, input []string) (output bool) {\n\toutput = false\n\tfor idx, data := range input {\n\t\toutput = output || f(data, idx)\n\t\tif output {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "func Operator(input string) int {\n\tvar o string = \"+-*/%^\"\n\n\treturn strings.IndexAny(input, o)\n}", "func ContainsAny(chars string) MatchFunc {\n\treturn func(s string) bool { return strings.ContainsAny(s, chars) }\n}", "func getOperandIndex(op string) (index int) {\n\t// get tier 3 operands\n\tfor i, c := range op {\n\t\tif c == '^' {\n\t\t\tif !isOpInBrackets(op[i:]) {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t}\n\n\t// get tier 2 operands\n\tfor i, c := range op {\n\t\tif c == '*' || c == '/' {\n\t\t\tif !isOpInBrackets(op[i:]) {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t}\n\n\t// get tier 1 operands\n\tfor i, c := range op {\n\t\tif c == '+' || c == '-' {\n\t\t\tif !isOpInBrackets(op[i:]) {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t}\n\n\t// nothing was found\n\treturn 0\n}", "func StringsIndex(s []string, want string) int {\n\tfor i, str := range s {\n\t\tif str == want {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func matchOperator(runes []rune, index int) int {\n\tmatchindex := -1\n\tmatchscore := 0\n\tr := runes[index]\n\n\tfor i, op := range Operators {\n\t\tscore := 0\n\t\tif r != rune(op[0]) { continue }\n\t\tif index + len(op) > len(runes) { continue }\n\n\t\topstr := string(runes[index:index + len(op)])\n\t\tif op == opstr { score = len(op) }\n\n\t\tif score > matchscore {\n\t\t\tmatchscore = score\n\t\t\tmatchindex = i\n\t\t}\n\t}\n\n\treturn matchindex\n}", "func inStrSlice(a []string, x string, caseSensitive bool) int {\n\tfor idx, n := range a {\n\t\tif !caseSensitive && strings.EqualFold(x, n) {\n\t\t\treturn idx\n\t\t}\n\t\tif x == n {\n\t\t\treturn idx\n\t\t}\n\t}\n\treturn -1\n}", "func AnyPrefixMatcher(strs ...string) MatcherFunc {\n\ttree := ternary_search_tree.New(strs...)\n\treturn func(_ io.Writer, r io.Reader) bool {\n\t\tbuf := make([]byte, tree.Depth())\n\t\tn, _ := io.ReadFull(r, buf)\n\t\t_, _, ok := tree.Follow(string(buf[:n]))\n\t\treturn ok\n\t}\n}", "func TestStringsIndex(t *testing.T) {\n\ttcs := []struct {\n\t\tword string\n\t\tsubstr string\n\t\texp int\n\t}{\n\t\t{word: \"Gophers are amazing!\", substr: \"are\", exp: 8},\n\t\t{word: \"Testing in Go is fun.\", substr: \"fun\", exp: 17},\n\t\t{word: \"The answer is 42.\", substr: \"is\", exp: 11},\n\t}\n\n\tfor i := range tcs {\n\t\ttc := tcs[i]\n\t\tt.Run(tc.word, func(t *testing.T) {\n\t\t\tt.Parallel()\n\t\t\tgot := strings.Index(tc.word, tc.substr)\n\t\t\tt.Logf(\"testing %q\", tc.word)\n\t\t\tif got != tc.exp {\n\t\t\t\tt.Errorf(\"unexpected value '%s' index of '%s' got: %d, exp: %d\", tc.substr, tc.word, got, tc.exp)\n\t\t\t}\n\t\t})\n\t}\n}", "func Index(a []string, s string) int {\n\tif len(a) == 0 {\n\t\treturn -1\n\t}\n\tfor i, v := range a {\n\t\tif v == s {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\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 stringMatchAny(x string, y []string) bool {\n\tfor _, v := range y {\n\t\tif x == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func matchAnyRune(source rune, targets ...rune) bool {\n\tvar result bool\n\tfor _, r := range targets {\n\t\tresult = result || (source == r)\n\t}\n\treturn result\n}", "func getStrIndex(strings []string, s string) int {\n\tfor i, col := range strings {\n\t\tif col == s {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func ContainsAny(str string, search ...string) bool {\n\tfor _, s := range search {\n\t\tif Contains(str, (string)(s)) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Test_Index(t *testing.T) {\n\ttt := []struct {\n\t\tValue string\n\t\tSubstring string\n\t\tAnswer int\n\t}{\n\t\t{\n\t\t\t\"Gophers are amazing!\",\n\t\t\t\"are\",\n\t\t\t8,\n\t\t},\n\t\t{\n\t\t\t\"Testing in Go is fun.\",\n\t\t\t\"fun\",\n\t\t\t17,\n\t\t},\n\t\t{\n\t\t\t\"The answer is 42.\",\n\t\t\t\"is\",\n\t\t\t11,\n\t\t},\n\t}\n\n\tfor _, test := range tt {\n\t\tif actual := strings.Index(test.Value, test.Substring); actual != test.Answer {\n\t\t\tt.Fatalf(\"expected index of substring '%s' in string '%s' to be %v\", test.Substring, test.Value, test.Answer)\n\t\t}\n\t}\n}", "func indexValueOf(args []string, flag string) (int, int, error) {\n for i := 0; i < len(args); i ++ {\n s := args[i]\n\n if len(s) == 0 || s[0] != '-' || len(s) == 1 {\n continue\n }\n\n num_minuses := 1\n if s[1] == '-' {\n num_minuses++\n if len(s) == 2 { // \"--\" terminates the flags\n i ++\n break\n }\n }\n\n name := s[num_minuses:]\n if len(name) == 0 || name[0] == '-' || name[0] == '=' {\n continue\n }\n\n // it's a flag. does it have an argument?\n has_value := false\n var j int\n for j = 1; j < len(name); j ++ { // equals cannot be first\n if name[j] == '=' {\n has_value = true\n name = name[0:j]\n break\n }\n }\n\n if name == flag {\n if !has_value {\n if i + 1 < len(args) {\n // value is the current arg\n has_value = true\n return i + 1, 0, nil\n }\n\n return -1, -1, fmt.Errorf(\"flag needs an argument: -%s\", name)\n }\n\n return i, num_minuses + j + 1, nil\n }\n }\n\n return -1, -1, fmt.Errorf(\"not found\")\n}", "func indexOfSingleDiff(s1 string, s2 string) int {\r\n\tfor i, val := range s1 {\r\n\t\tif val != rune(s2[i]) {\r\n\t\t\treturn i\r\n\t\t}\r\n\t}\r\n\treturn -1\r\n}", "func IndexString(vs []string, t string) int {\n for i, v := range vs {\n if v == t {\n return i\n }\n }\n return -1\n}", "func MatchAny(slice []string, match MatchFunc) bool {\n\tfor _, s := range slice {\n\t\tif match(s) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func IndexString(a, b string) int", "func Contains(substr, operand string) bool { return strings.Contains(operand, substr) }", "func ContainsAnyCharacter(str string, search string) bool {\n\tfor _, c := range search {\n\t\tif Contains(str, (string)(c)) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func IndexOf(ss []string, e string) int {\n\tfor i, s := range ss {\n\t\tif s == e {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func ContainsAny(text string, slice []string) bool {\n\tfor _, s := range slice {\n\t\tif strings.Contains(text, s) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func Any(submatches ...Matcher) Matcher {\n\treturn func(cmp string) bool {\n\t\tfor _, submatch := range submatches {\n\t\t\tif submatch(cmp) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n}", "func IndexStr(haystack []string, needle string) int {\n\tfor idx, s := range haystack {\n\t\tif s == needle {\n\t\t\treturn idx\n\t\t}\n\t}\n\treturn -1\n}", "func (s StringSet) Ni(x string) bool { _, y := s[x]; return y }", "func TestStringIndex(t *testing.T) {\n\tt.Parallel()\n\tvar tests = []struct {\n\t\thaystack []string\n\t\tneedle string\n\t\texpected int\n\t}{\n\t\t{[]string{\"foo\", \"bar\"}, \"foo\", 0},\n\t\t{[]string{\"foo\", \"bar\"}, \"bar\", 1},\n\t\t{[]string{\"foo\", \"bar\"}, \"\\u0062\\u0061\\u0072\", 1},\n\t\t{[]string{\"foo\", \"bar\"}, \"\", -1},\n\t\t{[]string{\"foo\", \"bar\"}, \"blah\", -1},\n\t}\n\tfor _, test := range tests {\n\t\tactual := primitives.Index(&test.haystack, test.needle)\n\t\tassert.Equal(t, test.expected, actual, \"expected value '%v' | actual : '%v'\", test.expected, actual)\n\t}\n}", "func (String) Index(c *compiler.Compiler, this compiler.Expression, indices ...compiler.Expression) (expression compiler.Expression, err error) {\n\texpression = c.NewExpression()\n\n\tif len(indices) != 1 {\n\t\treturn expression, c.NewError(\"array takes 1 symbol index\")\n\t}\n\n\tvar index = indices[0]\n\n\texpression.Type = Symbol{}\n\texpression.Go.WriteString(`ctx.Strindex(`)\n\texpression.Go.WriteB(this.Go)\n\texpression.Go.WriteString(`,`)\n\texpression.Go.WriteB(index.Go)\n\texpression.Go.WriteString(`)`)\n\n\treturn expression, nil\n}", "func Index(ss []string, s string) int {\n\tfor i, b := range ss {\n\t\tif b == s {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func SliceContainsAny(haystack []string, needles ...string) bool {\n\tfor _, a := range haystack {\n\t\tfor _, needle := range needles {\n\t\t\tif a == needle {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "func Any(operands ...Operand) OrOperator {\n\treturn Or(operands...)\n}", "func ContainsIndex(arr []string, s string) int {\n\tfor idx, el := range arr {\n\t\tif el == s {\n\t\t\treturn idx\n\t\t}\n\t}\n\treturn -1\n}", "func AnyString(vs []string, f func(string) bool) bool {\n for _, v := range vs {\n if f(v) {\n return true\n }\n }\n return false\n}", "func indexInSlice(slice []string, substr string) int {\n\tfor i := range slice {\n\t\tif strings.Contains(slice[i], substr) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func ContainsString(array []string, val string) (index int) {\n index = -1\n for i := 0; i < len(array); i++ {\n if array[i] == val {\n index = i\n return\n }\n }\n return\n}", "func StartsWithAny(str string, prefixes ...string) bool {\n\tfor _, prefix := range prefixes {\n\t\tif internalStartsWith(str, (string)(prefix), false) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func posString(slice []string, element string) int {\n\tfor index, elem := range slice {\n\t\tif elem == element {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn -1\n}", "func posString(slice []string, element string) int {\n\tfor index, elem := range slice {\n\t\tif elem == element {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn -1\n}", "func posString(slice []string, element string) int {\n\tfor index, elem := range slice {\n\t\tif elem == element {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn -1\n}", "func posString(slice []string, element string) int {\n\tfor index, elem := range slice {\n\t\tif elem == element {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn -1\n}", "func posString(slice []string, element string) int {\n\tfor index, elem := range slice {\n\t\tif elem == element {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn -1\n}", "func Any(arr interface{}, fn func(i int, v interface{}) bool) bool {\n\tif arr == nil {\n\t\treturn false\n\t}\n\tarrV := sutil.PtrValue(reflect.ValueOf(arr))\n\tn := arrV.Len()\n\tfor i := 0; i < n; i++ {\n\t\tele := arrV.Index(i)\n\t\tif fn(i, ele.Interface()) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func StringContainsAny(str string, subStrings []string) bool {\n\tfor _, subString := range subStrings {\n\t\tif strings.Contains(str, subString) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (v *VerbalExpression) Any(s string) *VerbalExpression {\n\treturn v.add(`(?:[` + quote(s) + `])`)\n}", "func ExecContainsAnyString(command string, contains []string) error {\n\tstdOut, _, err := Exec(command)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn ContainsAnyString(stdOut, contains)\n}", "func (t *Test) ExecContainsAnyString(contains ...string) error {\n\terr := ExecContainsAnyString(t.Command, contains)\n\tif err != nil {\n\t\tt.Result.Error(err)\n\t\treturn err\n\t}\n\tt.Result.Success()\n\treturn nil\n}", "func Index(s, t string) int {\n\tx := 0\n\ty := 0\n\tfor _, c := range s {\n\t\tif c == c {\n\t\t\tx++\n\t\t}\n\t}\n\tfor _, c := range t {\n\t\tif c == c {\n\t\t\ty++\n\t\t}\n\t}\n\tfor i := 0; i < x; i++ {\n\t\tif y != 0 && s[i] == t[0] {\n\t\t\tok := true\n\t\t\tmok := 0\n\t\t\tfor j := 0; j < y; j++ {\n\t\t\t\tif i+mok >= x || t[j] != s[i+mok] {\n\t\t\t\t\tok = false\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tmok++\n\t\t\t}\n\t\t\tif ok == true {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t}\n\treturn -1\n}", "func (c *compiler) index(index []ast.Expr) {\n\tfor _, expr := range index {\n\t\tif e, ok := expr.(*ast.NumExpr); ok && e.Value == float64(int(e.Value)) {\n\t\t\t// If index expression is integer constant, optimize to string \"n\"\n\t\t\t// to avoid toString() at runtime.\n\t\t\ts := strconv.Itoa(int(e.Value))\n\t\t\tc.expr(&ast.StrExpr{Value: s})\n\t\t\tcontinue\n\t\t}\n\t\tc.expr(expr)\n\t}\n\tif len(index) > 1 {\n\t\tc.add(IndexMulti, opcodeInt(len(index)))\n\t}\n}", "func sliceIndex(slice []string, x string) int {\n\tfor i, v := range slice {\n\t\tif v == x {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func indexOf(list []string, word string) int {\n\tfor i := range list {\n\t\tif strings.EqualFold(word, list[i]) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func runeIndex(rs, rsep []rune) int {\n\tif len(rs) < len(rsep) {\n\t\treturn -1\n\t}\n\tfor i, _ := range rs {\n\t\tmatched := true\n\t\tp := i\n\t\tfor j, _ := range rsep {\n\t\t\tif rs[p] != rsep[j] {\n\t\t\t\tmatched = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tp++\n\t\t}\n\t\tif matched {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn -1\n}", "func (c *cBinaryExpr) stringsIndex1() {\n\tc.stringsBytesIndex1(\"strings\")\n}", "func TestIndexOf(t *testing.T) {\n\tfor _, testCond := range stringData {\n\t\tt.Run(testCond.name, func(t *testing.T) {\n\t\t\tvar testIndex Array = Array{testCond.values}\n\t\t\tif testCond.expected != testIndex.IndexOf(testCond.search) {\n\t\t\t\tt.Fatalf(\"Expected output for test named %v is %v\", testCond.name, testCond.expected)\n\t\t\t}\n\t\t})\n\t}\n\n}", "func Count(str, operand string) int { return strings.Count(operand, str) }", "func TestAnyString(t *testing.T) {\n\tt.Parallel()\n\tvar tests = []struct {\n\t\ts []string\n\t\texpected bool\n\t}{\n\t\t{[]string{\"foo\", \"\\u0062\\u0061\\u0072\", \"baz\"}, true},\n\t\t{[]string{\"boo\", \"bar\", \"baz\"}, false},\n\t\t{[]string{\"foo\", \"far\", \"baz\"}, true},\n\t}\n\tfor _, test := range tests {\n\t\tactual := primitives.AnyString(test.s, func(s string) bool {\n\t\t\treturn strings.HasPrefix(s, \"f\")\n\t\t})\n\t\tassert.Equal(t, test.expected, actual, \"expected value '%v' | actual : '%v'\", test.expected, actual)\n\t}\n}", "func indexOfRuneInTonesArray(r rune) int {\n for i, v := range tones[0] {\n if vr, _ := utf8.DecodeRuneInString(v); vr == r {\n return i\n }\n }\n return -1\n}", "func AnySatisfies(pred StringPredicate, slice []string) bool {\n\tfor _, sliceString := range slice {\n\t\tif pred(sliceString) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func stringSuffixIndexFunc(s string, f func(c rune) bool) (i int) {\n var hasSuffix bool\n i = strings.LastIndexFunc(s, func(c rune) (done bool) {\n if done = !f(c); !hasSuffix {\n hasSuffix = !done\n }\n return\n })\n if i++; !hasSuffix {\n i = -1\n }\n return\n}", "func AnyString(values ...string) string {\n\tfor _, v := range values {\n\t\tif v != \"\" {\n\t\t\treturn v\n\t\t}\n\t}\n\treturn \"\"\n}", "func Any(vs []string, f func(string) bool) bool {\n\tfor _, v := range vs {\n\t\tif f(v) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (s *Int64) ContainsAny(vals ...int64) bool {\n\tfor _, v := range vals {\n\t\tif _, ok := s.m[v]; ok {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func IndexOfSingleToken(token string) (val byte, ok bool) {\n\tval, ok = mdSingleByteTokenIndex[token]\n\treturn\n}", "func index(slice []string, item string) int {\n\tfor i := range slice {\n\t\tif slice[i] == item {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func StringContains(arr []string, val string) (index int) {\n\tindex = -1\n\tfor i := 0; i < len(arr); i++ {\n\t\tif arr[i] == val {\n\t\t\tindex = i\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func StartsWithAnyIgnoreCase(str string, prefixes ...string) bool {\n\tfor _, prefix := range prefixes {\n\t\tif internalStartsWith(str, (string)(prefix), true) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func MatchAny(values ...string) Matcher {\n\tdistinct := make([]string, 0, len(values))\n\tdistinct = misc.AppendDistinct(distinct, values...)\n\tfor i, s := range distinct {\n\t\tdistinct[i] = regexp.QuoteMeta(s)\n\t}\n\tpattern := fmt.Sprintf(`^(%s)$`, strings.Join(distinct, \"|\"))\n\trx, _ := regexp.Compile(pattern)\n\treturn rx\n}", "func (s *Stringish) Index(str string) int {\n\treturn strings.Index(s.str, str)\n}", "func TestEmptySearchStringReturns0(t *testing.T) {\n\tif Index(weekdays, \"\") != 0 {\n\t\tt.Fail()\n\t}\n}", "func IndexOfString(array []string, val string) int {\n\tfor index, arrayVal := range array {\n\t\tif arrayVal == val {\n\t\t\treturn index\n\t\t}\n\t}\n\treturn -1\n}", "func (state *State) CheckAny(index int) Value {\n\tif state.TypeAt(index) == NoneType {\n\t\targError(state, index, \"value expected\")\n\t}\n\treturn state.get(index)\n}", "func strStr(haystack string, needle string) int {\n\tif len(haystack) == 0{\n\t\treturn 0\n\t}\n\tindex := strings.Index(haystack , needle)\n\treturn index\n}", "func (slice StringSlice) IndexOf(str string) int {\n\tfor p, v := range slice {\n\t\tif v == str {\n\t\t\treturn p\n\t\t}\n\t}\n\treturn -1\n}", "func IndexOfString(value string, list []string) int {\n\tfor i, match := range list {\n\t\tif match == value {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func LastIndex(substr, operand string) int { return strings.LastIndex(operand, substr) }", "func MatchAny(n *Node, expr *xpath.Expr) bool {\n\treturn QueryIter(n, expr).MoveNext()\n}", "func IndexOf(data interface{}, search interface{}, args ...int) (int, error) {\n\tvar err error\n\n\tresult := func(err *error) int {\n\t\tdefer catch(err)\n\n\t\tif !isNonNilData(err, \"data\", data) {\n\t\t\treturn -1\n\t\t}\n\n\t\tdataValue, _, _, dataValueLen := inspectData(data)\n\n\t\tif !isSlice(err, \"data\", dataValue) {\n\t\t\treturn -1\n\t\t}\n\n\t\tstartIndex := 0\n\t\tif len(args) > 0 {\n\t\t\tstartIndex = args[0]\n\t\t}\n\n\t\tif startIndex >= dataValueLen {\n\t\t\treturn -1\n\t\t}\n\n\t\tif dataValueLen == 0 {\n\t\t\treturn -1\n\t\t}\n\n\t\tresult := -1\n\n\t\tforEachSliceStoppable(dataValue, dataValueLen, func(each reflect.Value, i int) bool {\n\t\t\tif startIndex > -1 {\n\t\t\t\tif startIndex > 0 && i < startIndex {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\n\t\t\t\tif each.Interface() == search && result == -1 {\n\t\t\t\t\tresult = i\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif i > (startIndex*-1)-1 {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\n\t\t\t\tiFromRight := dataValueLen - i - 1\n\t\t\t\teachFromRight := dataValue.Index(iFromRight)\n\n\t\t\t\tif eachFromRight.Interface() == search {\n\t\t\t\t\tresult = iFromRight\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true\n\t\t})\n\n\t\treturn result\n\t}(&err)\n\n\treturn result, err\n}", "func LikeAny(col, search string) (where string) {\n\tvar wheres []string\n\n\twords := txt.UniqueKeywords(search)\n\n\tif len(words) == 0 {\n\t\treturn \"\"\n\t}\n\n\tfor _, w := range words {\n\t\tif len(w) > 3 {\n\t\t\twheres = append(wheres, fmt.Sprintf(\"%s LIKE '%s%%'\", col, w))\n\t\t} else {\n\t\t\twheres = append(wheres, fmt.Sprintf(\"%s = '%s'\", col, w))\n\t\t}\n\n\t\tsingular := inflection.Singular(w)\n\n\t\tif singular != w {\n\t\t\twheres = append(wheres, fmt.Sprintf(\"%s = '%s'\", col, singular))\n\t\t}\n\t}\n\n\treturn strings.Join(wheres, \" OR \")\n}", "func IndexedApply(s Indexed, args Sequence) Value {\n\ti := AssertArityRange(args, 1, 2)\n\tidx := AssertInteger(args.First())\n\tif r, ok := s.ElementAt(idx); ok {\n\t\treturn r\n\t}\n\tif i == 2 {\n\t\treturn args.Rest().First()\n\t}\n\tpanic(ErrStr(IndexNotFound, strconv.Itoa(idx)))\n}", "func TestFindAllStringIndex(t *testing.T) {\n\tregex := regexp.MustCompile(\"Brian\")\n\tsubject := \"Brian. Meet Brian\"\n\tindexes := regex.FindAllStringIndex(subject, 2)\n\tAssert(0, indexes[0][0], t)\n\tAssert(5, indexes[0][1], t)\n\tAssert(12, indexes[1][0], t)\n\tAssert(17, indexes[1][1], t)\n}", "func (ins *StringIndex) Execute(_ *int, vm *VM) error {\n\tindex := number.Int64(number.NewNumber(vm.Get(ins.Index).Value))\n\n\t// TODO(elliot): This won't work with multibyte characters.\n\tvm.Set(ins.Result, asttest.NewLiteralChar([]rune(vm.Get(ins.Str).Value)[index]))\n\n\treturn nil\n}", "func Any(ss []string) bool {\n\treturn len(ss) != 0\n}", "func buildIndex(oprnd string) (string, bool) {\n\t//Get the text from the inside of the parentheses\n\tre := regexp.MustCompile(\"\\\\(([^)]+)\\\\)\")\n\n\tr := re.FindString(oprnd)\n\t//Remove the ( and ) from the string\n\tr = strings.Replace(r, \"(\", \"\", -1)\n\tr = strings.Replace(r, \")\", \"\", -1)\n\n\t//Split the arguments of the operand (time arguments and index)\n\targs := strings.Split(r, \",\")\n\n\t//Timestring (will remain null if the index does not have a time function attached)\n\tts := \"\"\n\t//Length of arguments must be greater than 1 (time function) (not true if virtual index)\n\tif len(args) > 1 {\n\t\t//Pass the time arguments to build the index suffix (exclude the index istelf)\n\t\t//Time string is in the format YYYYMMDDHHMMSS\n\t\tts = buildTimestring(args[0 : len(args)-1])\n\t}\n\t//Check to see if the index is negated or not\n\tindex := args[len(args)-1]\n\tlog.Println(index)\n\tif string(index[0]) == \"~\" {\n\t\t//Remove the tilde\n\t\tindex := strings.Replace(index, \"~\", \"\", -1)\n\t\t//Remove the single quotes\n\t\tindex = strings.Replace(index, \"'\", \"\", -1)\n\t\t//Return the index with the timestring and negation set to true\n\t\tif ts != \"\" {\n\t\t\treturn index + \":\" + ts, true\n\t\t} else {\n\t\t\treturn index, true\n\t\t}\n\t} else { //Not negated\n\t\t//Remove the single quotes\n\t\tindex := strings.Replace(index, \"'\", \"\", -1)\n\t\t//Return the index with the timestring and negation set to false\n\t\tif ts != \"\" {\n\t\t\treturn index + \":\" + ts, false\n\t\t\t} else {\n\t\t\t\treturn index, false\n\t\t\t}\n\t}\n}", "func stringBinarySearch(slice []string, elem string) int {\n\tidx := sort.SearchStrings(slice, elem)\n\n\tif idx != len(slice) && slice[idx] == elem {\n\t\treturn idx\n\t} else {\n\t\treturn -1\n\t}\n}", "func (p *Parser) operand(tok token.Token, indexOK bool) value.Expr {\n\tvar expr value.Expr\n\tswitch tok.Type {\n\tcase token.Identifier:\n\t\t// TODO\n\t\tfallthrough\n\tcase token.Number, token.Rational, token.String, token.LeftParen:\n\t\texpr = p.numberOrVector(tok)\n\tdefault:\n\t\tp.errorf(\"unexpected %s\", tok)\n\t}\n\tif indexOK {\n\t\texpr = p.index(expr)\n\t}\n\treturn expr\n}", "func indexOfStringSlice(strings []string, s string) int {\n\tfor i, b := range strings {\n\t\tif b == s {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func (k *Kmp) Index(s string) int {\n\tlen1, len2 := len(s), len(k.pattern)\n\ti, j := 0, 0\n\tfor i < len1 && j < len2 {\n\t\tif j == -1 || s[i] == k.pattern[j] {\n\t\t\ti++\n\t\t\tj++\n\t\t} else {\n\t\t\tj = k.next[j]\n\t\t}\n\t}\n\tif j == len2 {\n\t\treturn i - j\n\t} else {\n\t\treturn -1\n\t}\n}", "func whereAny(entries interface{}, key, sep string, cmp []string) (interface{}, error) {\n\treturn generalizedWhere(\"whereAny\", entries, key, func(value interface{}) bool {\n\t\tif value == nil {\n\t\t\treturn false\n\t\t} else {\n\t\t\titems := strings.Split(value.(string), sep)\n\t\t\treturn len(intersect(cmp, items)) > 0\n\t\t}\n\t})\n}", "func InstMatchRunePos(i *syntax.Inst, r rune) int", "func (t *StringSlice) Index(s string) int {\n\tret := -1\n\tfor i, item := range t.items {\n\t\tif s == item {\n\t\t\tret = i\n\t\t\tbreak\n\t\t}\n\t}\n\treturn ret\n}", "func ContainsAnyString(stdOut *bytes.Buffer, contains []string) error {\n\tvar containsAny bool\n\tso := stdOut.String()\n\n\tfor _, str := range contains {\n\t\tcontainsAny = containsAny || strings.Contains(so, str)\n\t}\n\n\tif !containsAny {\n\t\treturn fmt.Errorf(\"stdOut %q did not contain of the following %q\", so, contains)\n\t}\n\treturn nil\n}", "func indexOf(v []string, s string) int {\n\ts = strings.TrimSpace(s)\n\tif i, err := strconv.Atoi(s); err == nil {\n\t\ti--\n\t\tif i >= 0 && i < len(v) {\n\t\t\treturn i\n\t\t}\n\t\treturn -1\n\t}\n\tfor i, vv := range v {\n\t\tif strings.EqualFold(s, strings.TrimSpace(vv)) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func (c *compiler) stringIndex(s, i *LLVMValue) *LLVMValue {\n\tptr := c.builder.CreateExtractValue(s.LLVMValue(), 0, \"\")\n\tptr = c.builder.CreateGEP(ptr, []llvm.Value{i.LLVMValue()}, \"\")\n\treturn c.NewValue(c.builder.CreateLoad(ptr, \"\"), types.Typ[types.Byte])\n}", "func indexOfString(h []string, n string) int {\n\tfor i, v := range h {\n\t\tif v == n {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn -1\n}", "func getMatchingBracketIndex(op string, brindex int) (index int) {\n\topenBracketCount := 0\n\tfor i, c := range op[brindex:] {\n\t\tif c == '(' {\n\t\t\topenBracketCount++\n\t\t} else if c == ')' {\n\t\t\topenBracketCount--\n\t\t}\n\n\t\t// if the bracket count is 0, it means the bracket requested\n\t\t// was closed (or never opened)\n\t\tif openBracketCount == 0 {\n\t\t\treturn i\n\t\t}\n\t}\n\n\t// nothing was found\n\treturn 0\n}", "func (pef pathExpressionFlag) containsAnyAsterisk() bool {\n\tpef &= pathExpressionContainsAsterisk | pathExpressionContainsDoubleAsterisk\n\treturn byte(pef) != 0\n}" ]
[ "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.5122632", "0.5121089", "0.51079434", "0.50893456", "0.5087353", "0.5074698", "0.5042369", "0.5012556", "0.5010994", "0.50106424", "0.5001619", "0.49863988", "0.49709427", "0.4969959", "0.49614593", "0.49601266", "0.49536434", "0.49457914", "0.49126926", "0.49120307", "0.4904327", "0.48830643", "0.48830643", "0.48830643", "0.48830643", "0.48830643", "0.48830006", "0.48775786", "0.48749006", "0.48638934", "0.48572105", "0.48514587", "0.48441142", "0.48318237", "0.4810361", "0.4809033", "0.47935846", "0.4773818", "0.47691724", "0.47603518", "0.4740424", "0.4736138", "0.4735167", "0.4731297", "0.47139615", "0.47086188", "0.47066113", "0.47020942", "0.4701752", "0.46990398", "0.4695657", "0.4687119", "0.46840018", "0.46774343", "0.4673047", "0.46729115", "0.46713212", "0.46654668", "0.46591172", "0.46464068", "0.46424505", "0.46409565", "0.46337596", "0.46199316", "0.46182367", "0.46117043", "0.46090153", "0.46037522", "0.460065", "0.45991907", "0.45979443", "0.4590057", "0.45894235", "0.45856315", "0.45774013", "0.45756227", "0.4573063", "0.45726496", "0.45675159", "0.45637822" ]
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\t\t\tif v[:1] != \"{\" {\n\t\t\t\tarr[i] = \"/\" + v\n\t\t\t}\n\t\t}\n\t\tstr = filepath.Join(strings.Join(arr, \"\"))\n\n\tcase \"#\", \"?\", \".\", \";\", \"&\":\n\t\tm := opmap[o]\n\t\tfor i, v := range arr {\n\t\t\tif i > 0 && v[:1] != \"{\" {\n\t\t\t\tarr[i] = m[1] + v\n\t\t\t}\n\t\t}\n\t\tstr = m[0] + strings.Join(arr, \"\")\n\n\t\t// TODO revisit, not particularly pretty\n\t\tif str[:2] == \"&{\" {\n\t\t\tstr = str[1:] // remove extra &\n\t\t}\n\n\tdefault: // handles +, `{+var}` and blank, `{var}`\n\t\tstr = strings.Join(arr, \",\")\n\t}\n\n\treturn str\n}", "func join(sep string, a ...string) string {\n\tswitch len(a) {\n\tcase 0:\n\t\treturn \"\"\n\tcase 1:\n\t\treturn a[0]\n\t}\n\n\tres := bytes.NewBufferString(a[0])\n\tfor _, s := range a[1:] {\n\t\tres.WriteString(sep + s)\n\t}\n\n\treturn res.String()\n}", "func StringJoin(a []string, sep string) string { return strings.Join(a, sep) }", "func Join(sep string, strs ...string) string {\n\tvar buf bytes.Buffer\n\tif len(strs) == 0 {\n\t\treturn \"\"\n\t}\n\tfor _, str := range strs {\n\t\tbuf.WriteString(str + sep)\n\t}\n\treturn strings.TrimRight(buf.String(), sep)\n}", "func Join(a []string, sep string) string {\n\treturn strings.Join(a, sep)\n}", "func Join(sep string, strs ...string) string {\n\tswitch len(strs) {\n\tcase 0:\n\t\treturn \"\"\n\tcase 1:\n\t\treturn strs[0]\n\tcase 2:\n\t\t// Special case for common small values.\n\t\t// Remove if golang.org/issue/6714 is fixed\n\t\treturn strs[0] + sep + strs[1]\n\tcase 3:\n\t\t// Special case for common small values.\n\t\t// Remove if golang.org/issue/6714 is fixed\n\t\treturn strs[0] + sep + strs[1] + sep + strs[2]\n\t}\n\tn := len(sep) * (len(strs) - 1)\n\tfor i := 0; i < len(strs); i++ {\n\t\tn += len(strs[i])\n\t}\n\n\tb := make([]byte, n)\n\tbp := copy(b, strs[0])\n\tfor _, s := range strs[1:] {\n\t\tbp += copy(b[bp:], sep)\n\t\tbp += copy(b[bp:], s)\n\t}\n\treturn string(b)\n}", "func Join(sep string, parts ...string) string {\n\treturn strings.Join(parts, sep)\n}", "func joins(sep string, inputs Inputs) (string, error) {\n\tvar buf bytes.Buffer\n\tvar errJoin error\n\tfirst := true\n\tinputs(func(v interface{}) {\n\t\tif errJoin != nil {\n\t\t\treturn\n\t\t}\n\t\tif s, ok := v.(string); ok {\n\t\t\tif first {\n\t\t\t\tfirst = false\n\t\t\t} else {\n\t\t\t\tbuf.WriteString(sep)\n\t\t\t}\n\t\t\tbuf.WriteString(s)\n\t\t} else {\n\t\t\terrJoin = fmt.Errorf(\"join wants string input, got %s\", vals.Kind(v))\n\t\t}\n\t})\n\treturn buf.String(), errJoin\n}", "func QuoteJoin(elems []string, sep string) string {\n\tswitch len(elems) {\n\tcase 0:\n\t\treturn \"\"\n\tcase 1:\n\t\treturn elems[0]\n\t}\n\tn := len(sep) * (len(elems) - 1)\n\tfor i := 0; i < len(elems); i++ {\n\t\tn += len(elems[i]) + 2\n\t}\n\n\tvar b strings.Builder\n\tb.Grow(n)\n\tb.WriteByte('\"')\n\tb.WriteString(elems[0])\n\tb.WriteByte('\"')\n\tfor _, s := range elems[1:] {\n\t\tb.WriteString(sep)\n\t\tb.WriteByte('\"')\n\t\tb.WriteString(s)\n\t\tb.WriteByte('\"')\n\t}\n\treturn b.String()\n}", "func joinStrings(sep string, a ...interface{}) (o string) {\n\tfor i := range a {\n\t\to += fmt.Sprint(a[i])\n\t\tif i < len(a)-1 {\n\t\t\to += sep\n\t\t}\n\t}\n\treturn\n}", "func join(str ...string) string {\n\tvar joined string\n\n\tfor n, s := range str {\n\t\tswitch n {\n\t\t\tcase 0: joined = s\n\t\t\tcase 1: joined = joined + \" \" + s\n\t\t\tdefault: joined = joined + \", \" + s\n\t\t}\n\t}\n\treturn joined\n}", "func Join(elem ...string) string {\n\treturn std.Join(elem...)\n}", "func (lss *ListStrings) Join(lsep string, ssep string) (s string) {\n\tlsslen := len(*lss) - 1\n\n\tfor x, ls := range *lss {\n\t\ts += strings.Join(ls, ssep)\n\n\t\tif x < lsslen {\n\t\t\ts += lsep\n\t\t}\n\t}\n\treturn\n}", "func SliceJoin(a []Stringer, sep string) string {\n\tswitch len(a) {\n\tcase 0:\n\t\treturn \"\"\n\tcase 1:\n\t\treturn a[0].String()\n\tcase 2:\n\t\t// Special case for common small values.\n\t\t// Remove if golang.org/issue/6714 is fixed\n\t\treturn a[0].String() + sep + a[1].String()\n\tcase 3:\n\t\t// Special case for common small values.\n\t\t// Remove if golang.org/issue/6714 is fixed\n\t\treturn a[0].String() + sep + a[1].String() + sep + a[2].String()\n\t}\n\tn := len(sep) * (len(a) - 1)\n\tfor i := 0; i < len(a); i++ {\n\t\tn += len(a[i].String())\n\t}\n\n\tb := make([]byte, n)\n\tbp := copy(b, a[0].String())\n\tfor _, s := range a[1:] {\n\t\tbp += copy(b[bp:], sep)\n\t\tbp += copy(b[bp:], s.String())\n\t}\n\treturn string(b)\n}", "func (m MultiString) Join(separator string) string {\n\treturn strings.Join(m, separator)\n}", "func (s *IntSlicer) Join(separator string) string {\n\tvar builder strings.Builder\n\n\t// Shortcut no elements\n\tif len(s.slice) == 0 {\n\t\treturn \"\"\n\t}\n\n\t// Iterate over length - 1\n\tindex := 0\n\tfor index = 0; index < len(s.slice)-1; index++ {\n\t\tbuilder.WriteString(fmt.Sprintf(\"%v%s\", s.slice[index], separator))\n\t}\n\tbuilder.WriteString(fmt.Sprintf(\"%v\", s.slice[index]))\n\tresult := builder.String()\n\treturn result\n}", "func QuotedJoin(terms []string, conjunction, none string) string {\n\tswitch len(terms) {\n\tcase 0:\n\t\treturn none\n\tcase 1:\n\t\treturn fmt.Sprintf(\"%q\", terms[0])\n\tcase 2:\n\t\treturn fmt.Sprintf(\"%q %s %q\", terms[0], conjunction, terms[1])\n\tdefault:\n\t\ti := 1\n\t\tinner := \"\"\n\t\tfor ; i < len(terms)-1; i++ {\n\t\t\tinner = fmt.Sprintf(\"%s, %q\", inner, terms[i])\n\t\t}\n\t\t// first, inner, inner, and/or last\n\t\treturn fmt.Sprintf(\"%q%s, %s %q\", terms[0], inner, conjunction, terms[i])\n\t}\n}", "func Join(words []string) string {\n\tvar buf bytes.Buffer\n\tfor i, w := range words {\n\t\tif i != 0 {\n\t\t\tbuf.WriteByte(' ')\n\t\t}\n\t\tbuf.WriteString(Escape(w))\n\t}\n\treturn buf.String()\n}", "func Of(s ...string) string { return strings.Join(s, \" \") }", "func (c StringArrayCollection) Join(delimiter string) string {\n\ts := \"\"\n\tfor i := 0; i < len(c.value); i++ {\n\t\tif i != len(c.value)-1 {\n\t\t\ts += c.value[i] + delimiter\n\t\t} else {\n\t\t\ts += c.value[i]\n\t\t}\n\t}\n\treturn s\n}", "func StringerJoin(elems []interface{ String() string }, sep string) string {\n\tswitch len(elems) {\n\tcase 0:\n\t\treturn \"\"\n\tcase 1:\n\t\treturn elems[0].String()\n\t}\n\tn := len(sep) * (len(elems) - 1)\n\tfor i := 0; i < len(elems); i++ {\n\t\tn += len(elems[i].String())\n\t}\n\n\tvar b strings.Builder\n\tb.Grow(n)\n\tb.WriteString(elems[0].String())\n\tfor _, s := range elems[1:] {\n\t\tb.WriteString(sep)\n\t\tb.WriteString(s.String())\n\t}\n\treturn b.String()\n}", "func join(a string, b string, separator string) string {\n\tvals := make([]byte, 0, 10)\n\tvals = append(vals, a...)\n\tvals = append(vals, separator...)\n\tvals = append(vals, b...)\n\treturn string(vals)\n}", "func (array Array) Join(separator string) string {\n\tstr := fmt.Sprint()\n\tfor i, v := range array {\n\t\tstr += fmt.Sprintf(\"%v\", v)\n\t\tif i != len(array) - 1 {\n\t\t\tstr += fmt.Sprintf(\"%s\", separator)\n\t\t}\n\t}\n\treturn str\n}", "func Join(fs FileSystem, elem ...string) string {\n\tsep := string(fs.PathSeparator())\n\tfor i, e := range elem {\n\t\tif e != \"\" {\n\t\t\treturn filepath.Clean(strings.Join(elem[i:], sep))\n\t\t}\n\t}\n\treturn \"\"\n}", "func join(elems ...string) string {\n\tvar result string\n\tfor i, v := range elems {\n\t\tif len(v) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif i == 0 {\n\t\t\tresult = strings.TrimRight(v, \"/\")\n\t\t\tcontinue\n\t\t}\n\t\tresult += \"/\" + strings.Trim(v, \"/\")\n\t}\n\treturn result\n}", "func NormalizeJoin(l []string, d, f string) string {\n n := len(l)\n var s string\n for i, e := range l {\n if i > 0 {\n if n - (i + 1) == 0 {\n s += f\n }else{\n s += d\n }\n }\n s += e\n }\n return s\n}", "func join(ins []rune, c rune) (result []string) {\n\tfor i := 0; i <= len(ins); i++ {\n\t\tresult = append(result, string(ins[:i])+string(c)+string(ins[i:]))\n\t}\n\treturn\n}", "func Join(data interface{}, separator string) (string, error) {\n\tvar err error\n\n\tresult := func(err *error) string {\n\t\tdefer catch(err)\n\n\t\tif !isNonNilData(err, \"data\", data) {\n\t\t\treturn \"\"\n\t\t}\n\n\t\tdataValue, _, _, dataValueLen := inspectData(data)\n\n\t\tif !isSlice(err, \"data\", dataValue) {\n\t\t\treturn \"\"\n\t\t}\n\n\t\tif val, ok := data.([]string); ok {\n\t\t\treturn strings.Join(val, separator)\n\t\t}\n\n\t\tif dataValueLen == 0 {\n\t\t\treturn \"\"\n\t\t}\n\n\t\tdataInStringSlice := make([]string, 0)\n\n\t\tforEachSlice(dataValue, dataValueLen, func(each reflect.Value, i int) {\n\n\t\t\tif each.Interface() != nil {\n\t\t\t\ttarget := each\n\n\t\t\t\tif each.Kind() == reflect.Interface {\n\t\t\t\t\ttarget = each.Elem()\n\t\t\t\t}\n\n\t\t\t\tif target.Kind() == reflect.String {\n\t\t\t\t\tdataInStringSlice = append(dataInStringSlice, target.String())\n\t\t\t\t} else {\n\t\t\t\t\tdataInStringSlice = append(dataInStringSlice, fmt.Sprintf(\"%v\", target.Interface()))\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\tif len(dataInStringSlice) == 0 {\n\t\t\treturn \"\"\n\t\t}\n\n\t\treturn strings.Join(dataInStringSlice, separator)\n\t}(&err)\n\n\treturn result, err\n}", "func joinConst(s interface{}, sep string) string {\n\tv := reflect.ValueOf(s)\n\tif v.Kind() != reflect.Slice && v.Kind() != reflect.Array {\n\t\tpanic(\"s wasn't a slice or array\")\n\t}\n\tss := make([]string, 0, v.Len())\n\tfor i := 0; i < v.Len(); i++ {\n\t\tss = append(ss, v.Index(i).String())\n\t}\n\treturn strings.Join(ss, sep)\n}", "func joinConst(s interface{}, sep string) string {\n\tv := reflect.ValueOf(s)\n\tif v.Kind() != reflect.Slice && v.Kind() != reflect.Array {\n\t\tpanic(\"s wasn't a slice or array\")\n\t}\n\tss := make([]string, 0, v.Len())\n\tfor i := 0; i < v.Len(); i++ {\n\t\tss = append(ss, v.Index(i).String())\n\t}\n\treturn strings.Join(ss, sep)\n}", "func (p *IntArray) Join(sep string) string {\n\ttmp := *p\n\tvar str_ary []string\n\n\tfor _, v := range tmp {\n\t\tstr_ary = append(str_ary, fmt.Sprint(v))\n\t}\n\tstr := strings.Join(str_ary, sep)\n\treturn str\n}", "func spaceJoin(a string, b string) string {\n\treturn join(a, b, ` `)\n}", "func StringJoin(scope *Scope, inputs []tf.Output, optional ...StringJoinAttr) (output tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\tattrs := map[string]interface{}{}\n\tfor _, a := range optional {\n\t\ta(attrs)\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"StringJoin\",\n\t\tInput: []tf.Input{\n\t\t\ttf.OutputList(inputs),\n\t\t},\n\t\tAttrs: attrs,\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func Join[T any](tt []T) string {\n\tvar str []string\n\tfor _, t := range tt {\n\t\tstr = append(str, fmt.Sprintf(\"%v\", t))\n\t}\n\n\treturn strings.Join(str, \", \")\n}", "func textJoin(arg *list.Element, arr []string, ignoreEmpty bool) ([]string, formulaArg) {\n\tfor arg.Next(); arg != nil; arg = arg.Next() {\n\t\tswitch arg.Value.(formulaArg).Type {\n\t\tcase ArgError:\n\t\t\treturn arr, arg.Value.(formulaArg)\n\t\tcase ArgString, ArgEmpty:\n\t\t\tval := arg.Value.(formulaArg).Value()\n\t\t\tif val != \"\" || !ignoreEmpty {\n\t\t\t\tarr = append(arr, val)\n\t\t\t}\n\t\tcase ArgNumber:\n\t\t\tarr = append(arr, arg.Value.(formulaArg).Value())\n\t\tcase ArgMatrix:\n\t\t\tfor _, row := range arg.Value.(formulaArg).Matrix {\n\t\t\t\targList := list.New().Init()\n\t\t\t\tfor _, ele := range row {\n\t\t\t\t\targList.PushBack(ele)\n\t\t\t\t}\n\t\t\t\tif argList.Len() > 0 {\n\t\t\t\t\targs, _ := textJoin(argList.Front(), []string{}, ignoreEmpty)\n\t\t\t\t\tarr = append(arr, args...)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn arr, newBoolFormulaArg(true)\n}", "func JoinQuery(c *Context, sep string, values []interface{}) string {\n\ts := make([]interface{}, len(values)*2-1)\n\tfor k, v := range values {\n\t\tif k > 0 {\n\t\t\ts[k*2-1] = sep\n\t\t}\n\t\ts[k*2] = MakeField(v)\n\t}\n\n\treturn ConcatQuery(c, s...)\n}", "func JoinStrings(separator string, stringArray ...string) string {\n\n\tvar buffer bytes.Buffer\n\tvar max int = len(stringArray) - 1\n\tfor vi, v := range stringArray {\n\t\tbuffer.WriteString(v)\n\t\tif vi < max {\n\t\t\tbuffer.WriteString(separator)\n\t\t}\n\t}\n\treturn buffer.String()\n\n}", "func trimSpaceAndJoin(args []string, sep string) string {\n\ttrimmedArgs := make([]string, len(args))\n\tfor i, arg := range args {\n\t\ttrimmedArgs[i] = strings.TrimSpace(arg)\n\t}\n\treturn strings.TrimSpace(strings.Join(trimmedArgs, sep))\n}", "func joinDemo(l []string, s string) string {\n\treturn strings.Join(l, s)\n}", "func prefixJoin(prefix string, array []string, separator string) (result string) {\n\tif len(array) == 0 {\n\t\treturn\n\t}\n\tfor index, val := range array {\n\t\tif index == 0 {\n\t\t\tresult = val\n\t\t} else {\n\t\t\tresult = join(result, concat(prefix, val), separator)\n\t\t}\n\t}\n\treturn\n}", "func (op *JoinOperator) String() string {\n\tif op.Comma.IsValid() {\n\t\treturn \", \"\n\t}\n\n\tvar buf bytes.Buffer\n\tif op.Left.IsValid() {\n\t\tbuf.WriteString(\" LEFT\")\n\t\tif op.Outer.IsValid() {\n\t\t\tbuf.WriteString(\" OUTER\")\n\t\t}\n\t} else if op.Inner.IsValid() {\n\t\tbuf.WriteString(\" INNER\")\n\t\t// } else if op.Cross.IsValid() {\n\t\t// \tbuf.WriteString(\" CROSS\")\n\t}\n\tbuf.WriteString(\" JOIN \")\n\n\treturn buf.String()\n}", "func join(fields []string) string {\n\tvar b strings.Builder\n\tc := csv.NewWriter(&b)\n\terr := c.Write(fields)\n\tif err != nil {\n\t\tpanic(err) // this ideally shouldn't happen!\n\t}\n\tc.Flush()\n\treturn strings.TrimSpace(b.String())\n}", "func spaceJoins(values ...string) string {\n\tif len(values) == 0 {\n\t\treturn ``\n\t}\n\tvals := make([]byte, 0, 10)\n\tfor index, val := range values {\n\t\tif index == 0 {\n\t\t\tvals = append(vals, val...)\n\t\t} else {\n\t\t\tvals = append(vals, ' ')\n\t\t\tvals = append(vals, val...)\n\t\t}\n\t}\n\treturn string(vals)\n}", "func StringJoinSeparator(value string) StringJoinAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"separator\"] = value\n\t}\n}", "func Split(sep, operand string) []string { return strings.Split(operand, sep) }", "func join(prefix, suffix string) string {\n\tif prefix == \"/\" {\n\t\treturn suffix\n\t}\n\tif suffix == \"/\" {\n\t\treturn prefix\n\t}\n\treturn prefix + suffix\n}", "func ShellJoin(args ...string) string {\n\tvar buf bytes.Buffer\n\tfor i, arg := range args {\n\t\tif i != 0 {\n\t\t\tbuf.WriteByte(' ')\n\t\t}\n\t\tquote(arg, &buf)\n\t}\n\treturn buf.String()\n}", "func (array *Array) Join(separator string) string {\n\tstr := \"\"\n\tfor _, object := range array.data {\n\t\tstr = fmt.Sprintf(\"%s%s%v\", str, separator, object)\n\t}\n\treturn str\n}", "func JoinIPs(ips []net.IP, sep string) string {\n\tb := &strings.Builder{}\n\tfor i, ip := range ips {\n\t\tif i != 0 {\n\t\t\tb.WriteString(sep)\n\t\t}\n\t\tb.WriteString(ip.String())\n\t}\n\treturn b.String()\n}", "func joinQuote(values []applicationmonitoring.BlackboxtargetData) string {\n\tvar result []string\n\tfor _, s := range values {\n\t\tresult = append(result, fmt.Sprintf(\"\\\"%v@%v@%v\\\"\", s.Module, s.Service, s.Url))\n\t}\n\treturn strings.Join(result, \", \")\n}", "func JoinWithDot(ks []string) string { return strings.Join(ks, \".\") }", "func FnJoin(name string, input interface{}, template interface{}) interface{} {\n\n\tresult := \"\"\n\n\t// Check the input is an array\n\tif arr, ok := input.([]interface{}); ok {\n\t\tfor _, value := range arr {\n\t\t\tif str, ok := value.(string); ok {\n\t\t\t\tresult += str\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result\n\n}", "func Join(k, v string) string {\n\treturn fmt.Sprintf(\"%s=%s\", k, v)\n}", "func joinStrings(str ...string) string {\n\treturn strings.Join(str, \"\")\n}", "func (o *OS) Join(elem ...string) string {\n\treturn filepath.Join(elem...)\n}", "func JoinString(arr []string, delimiter string) string {\n\treturn strings.Join(arr, delimiter)\n}", "func JoinWordSeries(items []string) string {\n\tif len(items) == 0 {\n\t\treturn \"\"\n\t} else if len(items) == 1 {\n\t\treturn items[0]\n\t} else {\n\t\treturn strings.Join(items[:len(items)-1], \", \") + \", and \" + items[len(items)-1]\n\t}\n}", "func Join(paths ...string) string {\n\tunnormalized := make([]string, len(paths))\n\tfor i, path := range paths {\n\t\tunnormalized[i] = Unnormalize(path)\n\t}\n\tvalue := filepath.Join(unnormalized...)\n\tif value == \"\" {\n\t\treturn \"\"\n\t}\n\treturn Normalize(value)\n}", "func ReduceJoinSeparator(value string) ReduceJoinAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"separator\"] = value\n\t}\n}", "func joinQuote(values []monitoring_v1alpha1.BlackboxtargetData) string {\n\tvar result []string\n\tfor _, s := range values {\n\t\tresult = append(result, fmt.Sprintf(\"\\\"%v@%v@%v\\\"\", s.Module, s.Service, s.Url))\n\t}\n\treturn strings.Join(result, \", \")\n}", "func (sc SameCaseConvention) Join(names []string) string {\n\treturn strings.Join(names, \"\")\n}", "func joinInts(xs []int, sep string) string {\n\tvar s, t string\n\tfor _, x := range xs {\n\t\ts += t\n\t\ts += strconv.Itoa(x)\n\t\tt = sep\n\t}\n\treturn s\n}", "func joinFilters(filters ...string) string {\n\tnonEmpty := []string{}\n\tfor _, f := range filters {\n\t\tif f != \"\" {\n\t\t\tnonEmpty = append(nonEmpty, f)\n\t\t}\n\t}\n\treturn strings.Join(nonEmpty, \" AND \")\n}", "func SplitAfter(sep, operand string) []string { return strings.SplitAfter(operand, sep) }", "func TestJoinWithCommas(t *testing.T) {\n\ttests := []testData{\n\t\ttestData{list: []string{}, want: \"\"},\n\t\ttestData{list: []string{\"apple\"}, want: \"apple\"},\n\t\ttestData{list: []string{\"apple\", \"orange\"}, want: \"apple and orange\"},\n\t\ttestData{list: []string{\"apple\", \"orange\", \"pear\"}, want: \"apple, orange, and pear\"},\n\t}\n\tfor _, test := range tests {\n\t\tgot := JoinWithCommas(test.list)\n\t\tif got != test.want {\n\t\t\tt.Error(errorString(test.list, got, test.want)) // call a method on the testing.T to fail the test\n\t\t}\n\t}\n}", "func Implode(glue string, pieces []string) string {\n\treturn strings.Join(pieces, glue)\n}", "func (lc LowerCaseConvention) Join(names []string) string {\n\treturn strings.Join(names, \"\")\n}", "func join(elem ...string) string {\n\tresult := path.Join(elem...)\n\tif result == \".\" {\n\t\treturn \"\"\n\t}\n\tif len(result) > 0 && result[0] == '/' {\n\t\tresult = result[1:]\n\t}\n\treturn result\n}", "func JoinString(p Path, elem ...string) Path {\n\treturn Join(p, ToPaths(elem)...)\n}", "func TestJoinWithCommas(t *testing.T){\n\t//create a string of testData\n\ttests := []testData{\n\t\t//you can omit testData as go know the type from parent\n\t\t{list: []string{}, want: \"\"},\n\t\t{list: []string{\"apple\"}, want: \"apple\"},\n\t\t{list: []string{\"apple\",\"orange\"}, want: \"apple and orange\"},\n\t\t{list: []string{\"apple\",\"orange\",\"pear\"}, want: \"apple, orange and pear\"},\n\t}\n\t//for each test\n\tfor _,test := range tests{\n\t\t//get the string from the list\n\t\tgot := JoinWithCommas(test.list)\n\t\t//test if what you got is what you want\n\t\tif got != test.want {\n\t\t\tt.Errorf(errorString(test.list,got,test.want))\n\t\t}\n\t}\n}", "func (fn *formulaFuncs) TEXTJOIN(argsList *list.List) formulaArg {\n\tif argsList.Len() < 3 {\n\t\treturn newErrorFormulaArg(formulaErrorVALUE, \"TEXTJOIN requires at least 3 arguments\")\n\t}\n\tif argsList.Len() > 252 {\n\t\treturn newErrorFormulaArg(formulaErrorVALUE, \"TEXTJOIN accepts at most 252 arguments\")\n\t}\n\tdelimiter := argsList.Front().Value.(formulaArg)\n\tignoreEmpty := argsList.Front().Next().Value.(formulaArg)\n\tif ignoreEmpty.Type != ArgNumber || !ignoreEmpty.Boolean {\n\t\treturn newErrorFormulaArg(formulaErrorVALUE, formulaErrorVALUE)\n\t}\n\targs, ok := textJoin(argsList.Front().Next().Next(), []string{}, ignoreEmpty.Number != 0)\n\tif ok.Type != ArgNumber {\n\t\treturn ok\n\t}\n\tresult := strings.Join(args, delimiter.Value())\n\tif len(result) > TotalCellChars {\n\t\treturn newErrorFormulaArg(formulaErrorVALUE, fmt.Sprintf(\"TEXTJOIN function exceeds %d characters\", TotalCellChars))\n\t}\n\treturn newStringFormulaArg(result)\n}", "func Join(m interface{}, sep interface{}) walkerFn {\n\tlog.Println(\"Preparing join matcher with \", reflect.TypeOf(m).Name())\n\texpectFn := fnFromType(m)\n\tsepFn := fnFromType(sep)\n\treturn func(it *Iter) walkerFn {\n\t\tr := expectFn(it)\n\t\tif r != nil {\n\t\t\t// Not sure what to do\n\n\t\t}\n\t\tit.Next()\n\t\tr = sepFn(it) // Should we move next here or before?\n\t\tif r == nil {\n\t\t\t// Not sure what to do\n\n\t\t}\n\t\tlog.Printf(\"Matching the join func Expecting: %v, separated by : %v\", m, sep)\n\n\t\treturn nil\n\t}\n}", "func (*Mysqlfs) Join(elem ...string) string {\n\treturn filepath.Join(elem...)\n}", "func simpleJoin(dir, path string) string {\n\treturn dir + string(filepath.Separator) + path\n}", "func (filter *CombinedFilter) joinFilters(separator string, structMap TableAndColumnLocater, dialect gorp.Dialect, startBindIdx int) (string, []interface{}, error) {\n\tbuffer := bytes.Buffer{}\n\targs := make([]interface{}, 0, len(filter.subFilters))\n\tif len(filter.subFilters) > 1 {\n\t\tbuffer.WriteString(\"(\")\n\t}\n\tfor index, subFilter := range filter.subFilters {\n\t\tnextWhere, nextArgs, err := subFilter.Where(structMap, dialect, startBindIdx+len(args))\n\t\tif err != nil {\n\t\t\treturn \"\", nil, err\n\t\t}\n\t\targs = append(args, nextArgs...)\n\t\tif index != 0 {\n\t\t\tbuffer.WriteString(separator)\n\t\t}\n\t\tbuffer.WriteString(nextWhere)\n\t}\n\tif len(filter.subFilters) > 1 {\n\t\tbuffer.WriteString(\")\")\n\t}\n\treturn buffer.String(), args, nil\n}", "func RepeatJoin(s string, count int, sep string) string {\n\tif s == \"\" || count == 0 {\n\t\treturn \"\"\n\t}\n\tif count == 1 {\n\t\treturn s\n\t}\n\n\tvar b strings.Builder\n\tb.Grow(len(s)*count + len(sep)*(count-1))\n\tfor i := 0; i < count; i++ {\n\t\tb.WriteString(s)\n\t\tif i < count-1 {\n\t\t\tb.WriteString(sep)\n\t\t}\n\t}\n\n\treturn b.String()\n}", "func JoinIPNets(ipnets []*net.IPNet, sep string) string {\n\tb := &strings.Builder{}\n\tfor i, ipnet := range ipnets {\n\t\tif i != 0 {\n\t\t\tb.WriteString(sep)\n\t\t}\n\t\tb.WriteString(ipnet.String())\n\t}\n\treturn b.String()\n}", "func DotJoiner(strs []string) string {\n\treturn strings.Join(strs, \".\")\n}", "func (s *StringsObj) Join(line string, args ...Object) Object {\n\targLen := len(args)\n\tif argLen != 1 && argLen != 2 {\n\t\treturn NewError(line, ARGUMENTERROR, \"1|2\", argLen)\n\t}\n\n\tsep := \"\"\n\ta, ok := args[0].(*Array)\n\tif !ok {\n\t\treturn NewError(line, PARAMTYPEERROR, \"first\", \"join\", \"*Array\", args[0].Type())\n\t}\n\n\tif argLen == 2 {\n\t\tv, ok := args[1].(*String)\n\t\tif !ok {\n\t\t\treturn NewError(line, PARAMTYPEERROR, \"second\", \"join\", \"*String\", args[1].Type())\n\t\t}\n\t\tsep = v.String\n\t}\n\n\tvar tmp []string\n\tfor _, item := range a.Members {\n\t\ttmp = append(tmp, item.Inspect())\n\t}\n\n\tret := strings.Join(tmp, sep)\n\treturn NewString(ret)\n}", "func (p *SliceOfMap) Join(separator ...string) (str *Object) {\n\tif p == nil || len(*p) == 0 {\n\t\tstr = &Object{\"\"}\n\t\treturn\n\t}\n\tsep := \",\"\n\tif len(separator) > 0 {\n\t\tsep = separator[0]\n\t}\n\n\tvar builder strings.Builder\n\tfor i := range *p {\n\t\tbuilder.WriteString(ToString((*p)[i]))\n\t\tif i+1 < len(*p) {\n\t\t\tbuilder.WriteString(sep)\n\t\t}\n\t}\n\tstr = &Object{builder.String()}\n\treturn\n}", "func BenchmarkStringsJoin(b *testing.B) {\n\tfor i := 0; i < b.N; i++ {\n\t\t_ = strings.Join(arr, \",\")\n\t}\n}", "func (l AuditSubjectTypeList) Join(separator string) string {\n\toutput := \"\"\n\tfor i, t := range l {\n\t\toutput += string(t)\n\t\tif i < len(l)-1 {\n\t\t\toutput += separator\n\t\t}\n\t}\n\treturn output\n}", "func JoinStrings(ss ...string) string {\n\treturn strings.Join(ss, \"\")\n}", "func JoinStringsReversed(separator string, stringArray ...string) string {\n\n\tvar buffer bytes.Buffer\n\n\tfor vi := len(stringArray) - 1; vi >= 0; vi-- {\n\t\tbuffer.WriteString(stringArray[vi])\n\t\tif vi > 0 {\n\t\t\tbuffer.WriteString(separator)\n\t\t}\n\t}\n\n\treturn buffer.String()\n\n}", "func SliceJoins(v interface{}, delimiter string) string {\n\treturn strings.Trim(strings.Replace(fmt.Sprint(v), \" \", delimiter, -1), \"[]\")\n}", "func JoinGenerator(sep string, mapping func(s string) string) func(r string) string {\n\tvar written bool\n\treturn func(s string) string {\n\t\tif mapping != nil {\n\t\t\ts = mapping(s)\n\t\t}\n\t\tif written {\n\t\t\ts = sep + s\n\t\t}\n\t\twritten = true\n\t\treturn s\n\t}\n}", "func JoinString(array []string, slim string) string {\n\tstr := array[0]\n\tfor index, val := range array {\n\t\tif index != 0 {\n\t\t\tstr = fmt.Sprintf(\"%s%s%s\", str, slim, val)\n\t\t}\n\t}\n\treturn str\n}", "func joinIDs(ids []WKID, separator string) string {\n\tvar s string\n\n\tfor i, n := range ids {\n\t\tif i != 0 {\n\t\t\ts += \",\"\n\t\t}\n\n\t\ts += strconv.FormatInt(int64(n), 10)\n\t}\n\n\treturn s\n}", "func (v Value) Join() string {\n\treturn strings.Join(v.Values, \"\\n\")\n}", "func errorString(list []string, got string, want string) string {\n\treturn fmt.Sprintf(\"JoinWithCommas(%#v) = \\\"%s\\\", want \\\"%s\\\"\", list, got, want)\n}", "func Concat(strings []string) string {\n\ts, sep := \"\", \"\"\n\tfor _, str := range strings {\n\t\ts += sep + str // NB: inefficient!\n\t\tsep = \" \"\n\t}\n\treturn s\n}", "func JoinWithLeftAssociativeOp(op OpCode, a Expr, b Expr) Expr {\n\t// \"(a, b) op c\" => \"a, b op c\"\n\tif comma, ok := a.Data.(*EBinary); ok && comma.Op == BinOpComma {\n\t\tcomma.Right = JoinWithLeftAssociativeOp(op, comma.Right, b)\n\t\treturn a\n\t}\n\n\t// \"a op (b op c)\" => \"(a op b) op c\"\n\t// \"a op (b op (c op d))\" => \"((a op b) op c) op d\"\n\tif binary, ok := b.Data.(*EBinary); ok && binary.Op == op {\n\t\treturn JoinWithLeftAssociativeOp(\n\t\t\top,\n\t\t\tJoinWithLeftAssociativeOp(op, a, binary.Left),\n\t\t\tbinary.Right,\n\t\t)\n\t}\n\n\t// \"a op b\" => \"a op b\"\n\t// \"(a op b) op c\" => \"(a op b) op c\"\n\treturn Expr{Loc: a.Loc, Data: &EBinary{Op: op, Left: a, Right: b}}\n}", "func Join(paths ...PathRetriever) PathRetriever {\n\tvar components []string\n\tvar err error\n\tfor _, path := range paths {\n\t\tvar component string\n\t\tcomponent, err = path()\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tcomponents = append(components, component)\n\t}\n\tpath := filepath.Join(components...)\n\n\treturn func() (string, error) {\n\t\treturn path, err\n\t}\n}", "func joinCols(cols []string) string {\n\treturn fmt.Sprintf(\"| %s |\", strings.Join(cols, \" | \"))\n}", "func Concat(input []string) string {\n\treturn strings.Join(input, \" \")\n}", "func repeatJoin(a string, separator string, count int) string {\n\tif count == 0 {\n\t\treturn ``\n\t}\n\tvals := make([]byte, 0, 10)\n\tvals = append(vals, a...)\n\tfor i := 1; i < count; i++ {\n\t\tvals = append(vals, separator...)\n\t\tvals = append(vals, a...)\n\t}\n\treturn string(vals)\n}", "func JoinToMaxLength(toJoin []string, sep string, maxLength int) []string {\n\tvar out []string\n\n\tcurBuilder := strings.Builder{}\n\tcurBuilder.Grow(maxLength)\n\n\tfor _, s := range toJoin {\n\t\tentryLen := len(s)\n\t\tif curBuilder.Len() == 0 && entryLen > maxLength {\n\t\t\tout = append(out, s)\n\t\t\tcontinue\n\t\t}\n\n\t\tif curBuilder.Len() > 0 && curBuilder.Len()+len(sep)+entryLen > maxLength {\n\t\t\tout = append(out, curBuilder.String())\n\t\t\tcurBuilder.Reset()\n\t\t}\n\n\t\tif curBuilder.Len() != 0 {\n\t\t\tcurBuilder.WriteString(sep)\n\t\t}\n\n\t\tcurBuilder.WriteString(s)\n\t}\n\n\tif curBuilder.Len() > 0 {\n\t\tout = append(out, curBuilder.String())\n\t}\n\n\treturn out\n}", "func JoinPath(segments []string, root string) string {\n\tres := \"\"\n\tif segments != nil {\n\t\tfor i := 0; i < len(segments); i++ {\n\t\t\tres = res + segments[i]\n\t\t\tif i < len(segments)-1 {\n\t\t\t\tres = res + \"/\"\n\t\t\t}\n\t\t}\n\t}\n\tif root != \"\" {\n\t\tif len(segments) > 0 {\n\t\t\tres = root + \"/\" + res\n\t\t} else {\n\t\t\tres = root\n\t\t}\n\t}\n\treturn res\n}", "func JoinWords(w string, words ...string) (path string) {\n\tpath = w\n\tif path[0] != '/' {\n\t\tpath = \"/\" + path\n\t}\n\tfor _, s := range words {\n\t\tpath += \"/\" + s\n\t}\n\treturn\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.6539709", "0.65086454", "0.6506533", "0.6504392", "0.6447527", "0.64150053", "0.64145184", "0.64086574", "0.64011306", "0.634337", "0.634337", "0.63178164", "0.6308232", "0.62890303", "0.6284945", "0.62837994", "0.6263834", "0.6261971", "0.62292945", "0.6199857", "0.61390805", "0.6122909", "0.6115999", "0.6112898", "0.6100701", "0.6071469", "0.6026266", "0.60117453", "0.6003846", "0.59989", "0.5996471", "0.5972453", "0.5958259", "0.5924806", "0.59166265", "0.59030855", "0.58751446", "0.58744794", "0.58610165", "0.5857084", "0.58321923", "0.5831862", "0.5818514", "0.58082056", "0.5806005", "0.5803949", "0.58003026", "0.5789036", "0.57837945", "0.57762986", "0.5775177", "0.5768533", "0.57531893", "0.5740029", "0.56979656", "0.56871235", "0.5685581", "0.567783", "0.56644267", "0.5663756", "0.56551415", "0.5649111", "0.564494", "0.5605273", "0.55849665", "0.5577309", "0.5572927", "0.55649936", "0.5562361", "0.5535896", "0.55230665", "0.5509166", "0.5486353", "0.5470343", "0.5426438", "0.54067314", "0.540417", "0.53857154", "0.5380201", "0.53707" ]
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\treturn key[strings.LastIndexAny(key, \"/\")+1:]\n}", "func LastIndexOfString(array []string, val string) int {\n\torderIndex := IndexOfString(array, val)\n\tif orderIndex == -1 {\n\t\treturn -1\n\t}\n\treturn len(array) - 1 - orderIndex\n}", "func LastIndexOf(slice []string, needle string) int {\n\tfor idx := len(slice) - 1; idx >= 0; idx-- {\n\t\tif slice[idx] == needle {\n\t\t\treturn idx\n\t\t}\n\t}\n\n\treturn -1\n}", "func (s StringSlice) Last() string {\n\tif len(s) == 0 {\n\t\treturn \"\"\n\t}\n\treturn s[len(s)-1]\n}", "func (t *StringSlice) Last() string {\n\tvar ret string\n\tif len(t.items) > 0 {\n\t\tret = t.items[len(t.items)-1]\n\t}\n\treturn ret\n}", "func stringSuffixIndexFunc(s string, f func(c rune) bool) (i int) {\n var hasSuffix bool\n i = strings.LastIndexFunc(s, func(c rune) (done bool) {\n if done = !f(c); !hasSuffix {\n hasSuffix = !done\n }\n return\n })\n if i++; !hasSuffix {\n i = -1\n }\n return\n}", "func SubstringAfterLast(str string, sep string) string {\n\tidx := strings.LastIndex(str, sep)\n\tif idx == -1 {\n\t\treturn str\n\t}\n\treturn str[idx+len(sep):]\n}", "func nolast(x string) string {\n\treturn x[:len(x)-1]\n}", "func nolast(x string) string {\n\treturn x[:len(x)-1]\n}", "func nolast(x string) string {\n\treturn x[:len(x)-1]\n}", "func nolast(x string) string {\n\treturn x[:len(x)-1]\n}", "func nolast(x string) string {\n\treturn x[:len(x)-1]\n}", "func nolast(x string) string {\n\treturn x[:len(x)-1]\n}", "func nolast(x string) string {\n\treturn x[:len(x)-1]\n}", "func nolast(x string) string {\n\treturn x[:len(x)-1]\n}", "func lastComponent(s string) string {\n\tlastSlash := strings.LastIndex(s, \"/\")\n\tif lastSlash != -1 {\n\t\ts = s[lastSlash+1:]\n\t}\n\treturn s\n}", "func LastWordInString(s string) int {\n\treturn WordBeginInString(s, len(s)-1)\n}", "func Last(ss []string) string {\n\tif len(ss) >= 1 {\n\t\treturn ss[len(ss)-1]\n\t}\n\treturn \"\"\n}", "func (g *gnmiPath) LastStringElem() (string, error) {\n\treturn g.StringElemAt(g.Len() - 1)\n}", "func lastIndex(s, sep []byte) int {\n\tn := len(sep)\n\tif n == 0 {\n\t\treturn len(s)\n\t}\n\tc := sep[0]\n\tfor i := len(s) - n; i >= 0; i-- {\n\t\tif s[i] == c && (n == 1 || bytes.Equal(s[i:i+n], sep)) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func Last(s string) rune {\n\tif s == \"\" {\n\t\tpanic(\"empty list\")\n\t}\n\n\tr, _ := utf8.DecodeLastRuneInString(s)\n\treturn r\n}", "func lastArg(args []string) string {\n\tl := len(args)\n\tif l >= 2 {\n\t\treturn args[l-1]\n\t}\n\tif l == 1 {\n\t\treturn args[0]\n\t}\n\treturn \"\"\n}", "func lastWord(in string) string {\n\tif ss := strings.Fields(in); len(ss) > 0 {\n\t\treturn ss[len(ss)-1]\n\t}\n\treturn \"\"\n}", "func LastArg(args []string) string {\n\tif len(args) > 0 {\n\t\treturn args[len(args)-1]\n\t}\n\treturn \"\"\n}", "func (list *ArrayList[T]) LastIndexOf(ele T) int {\n\tfor i := list.Size() - 1; i >= 0; i-- {\n\t\tif ele == list.elems[i] {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func (b *BadgerStore) LastIndex() (uint64, error) {\n\treturn b.firstIndex(true)\n}", "func (b *BadgerStore) LastIndex() (uint64, error) {\n\treturn b.firstIndex(true)\n}", "func (ms *MemoryStorage) LastIndex() (uint64, error) {\n\tms.Lock()\n\tdefer ms.Unlock()\n\treturn ms.lastIndex(), nil\n}", "func LastIndexByte(s string, c byte) int {\n\tfor i:=len(s)-1;i>=0;i-- {\n\t\tif s[i] == c {\n\t\t\treturn i\n\t\t}\n\t}\n\t// not found\n\treturn -1\n}", "func (l *List) Last() *string {\n\tif l == nil || len(*l) == 0 {\n\t\treturn nil\n\t}\n\treturn &(*l)[len(*l)-1]\n}", "func (r *raftLog) LastIndex() (uint64, error) {\n\treturn r.getIndex(false)\n}", "func (l *LexInner) Last() rune {\n\tif l.Len() == 0 {\n\t\treturn Eof\n\t}\n\tr, _ := utf8.DecodeLastRuneInString(l.Get())\n\treturn r\n}", "func LastWord(bytes []byte) int {\n\treturn WordBegin(bytes, len(bytes)-1)\n}", "func wordEndInString(s string, l0Pos int) int {\n\tl := len(s)\n\n\tl1, l1Pos := wLastSequenceInString(s[:l0Pos])\n\tl0, r0Delta := wFirstSequenceInString(s[l0Pos:])\n\tlOddRI := wIsOpenRIInString(s[:l1Pos], l1, l0)\n\tr0Pos := l0Pos + r0Delta\n\tr0, r1Delta := wFirstSequenceInString(s[r0Pos:])\n\n\tfor r0Pos < l {\n\t\tr1, r2Delta := wFirstSequenceInString(s[r0Pos+r1Delta:])\n\t\tif wDecision(l1, l0, lOddRI, r0, r1) {\n\t\t\treturn r0Pos\n\t\t}\n\t\tl1 = l0\n\t\tl0 = r0\n\t\tr0 = r1\n\t\tr0Pos += r1Delta\n\t\tr1Delta = r2Delta\n\t\tlOddRI = l0 == wClassRI && !lOddRI\n\t}\n\treturn l\n}", "func Index(substr, operand string) int { return strings.Index(operand, substr) }", "func SubstringBeforeLast(str string, sep string) string {\n\tidx := strings.LastIndex(str, sep)\n\tif idx == -1 {\n\t\treturn str\n\t}\n\treturn str[:idx]\n}", "func (i *LogStore) LastIndex() (uint64, error) {\n\ti.l.RLock()\n\tdefer i.l.RUnlock()\n\treturn i.highIndex, nil\n}", "func (l *RaftLog) LastIndex() uint64 {\n\t// Your Code Here (2A).\n\treturn l.snapIndex + uint64(len(l.entries))\n}", "func indexFragment(s string) int {\n\tmax := -1\n\tfor _, sep := range []string{\". \", \": \", \"; \", \", \", \"! \", \"? \", \"\\\" \", \"' \"} {\n\t\tif idx := strings.LastIndex(s, sep); idx > max {\n\t\t\tmax = idx\n\t\t}\n\t}\n\tif max > 0 {\n\t\treturn max + 2\n\t}\n\tif idx := strings.LastIndex(s, \" \"); idx > 0 {\n\t\treturn idx + 1\n\t}\n\treturn -1\n}", "func getLastChar(s string) byte {\n\treturn s[len(s)-1]\n}", "func lastElement(key string) string {\n\tkey = strings.TrimRight(key, \"/\\\\\")\n\tindex := strings.LastIndexAny(key, \"/\\\\\")\n\tif index >= 0 {\n\t\tkey = key[index+1:]\n\t}\n\treturn key\n}", "func (i *InmemStore) LastIndex() (uint64, error) {\n\ti.l.RLock()\n\tdefer i.l.RUnlock()\n\treturn i.highIndex, nil\n}", "func LastIndexOf(data interface{}, search interface{}, args ...int) (int, error) {\n\tvar err error\n\n\tresult := func(err *error) int {\n\t\tdefer catch(err)\n\n\t\tif !isNonNilData(err, \"data\", data) {\n\t\t\treturn -1\n\t\t}\n\n\t\tdataValue, _, _, dataValueLen := inspectData(data)\n\n\t\tif !isSlice(err, \"data\", dataValue) {\n\t\t\treturn -1\n\t\t}\n\n\t\tstartIndex := dataValueLen - 1\n\t\tif len(args) > 0 {\n\t\t\tstartIndex = args[0]\n\t\t}\n\n\t\tif dataValueLen == 0 {\n\t\t\treturn -1\n\t\t}\n\n\t\tresult := -1\n\n\t\tforEachSliceStoppable(dataValue, dataValueLen, func(each reflect.Value, i int) bool {\n\t\t\tif startIndex > -1 {\n\t\t\t\tiFromRight := startIndex - i\n\t\t\t\tif iFromRight > (dataValueLen-1) || iFromRight < 0 {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\n\t\t\t\teachFromRight := dataValue.Index(iFromRight)\n\t\t\t\tif eachFromRight.Interface() == search && result == -1 {\n\t\t\t\t\tresult = iFromRight\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tiFromRight := dataValueLen + startIndex - i\n\t\t\t\tif iFromRight > (dataValueLen-1) || iFromRight < 0 {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\n\t\t\t\teachFromRight := dataValue.Index(iFromRight)\n\t\t\t\tif eachFromRight.Interface() == search && result == -1 {\n\t\t\t\t\tresult = iFromRight\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true\n\t\t})\n\n\t\treturn result\n\t}(&err)\n\n\treturn result, err\n}", "func (dl *DelegatorList) lastIndex() uint64 {\n\t// negative count?\n\tif dl.count < 0 {\n\t\tif dl.cursor > 0 {\n\t\t\treturn dl.cursor\n\t\t}\n\t\treturn 0\n\t}\n\n\t// adjust for the list position\n\tval := dl.cursor + uint64(dl.count)\n\tif val > uint64(len(dl.list)) {\n\t\tval = uint64(len(dl.list))\n\t}\n\n\treturn val\n}", "func LengthOfLastWord(s string) int {\n\tstrArr := strings.Split(s, \" \")\n\ti := 1\n\tl := 0\n\tfor {\n\t\tif i > len(strArr) {\n\t\t\tbreak\n\t\t}\n\t\tif len(strArr[len(strArr)-i]) == 0 {\n\t\t\ti++\n\t\t} else {\n\t\t\tl = len(strArr[len(strArr)-i])\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn l\n}", "func (this *LinkedList) LastIndexOf(ele interface{}) int {\n\tlastIndex := -1\n\tpe := this.head\n\tindex := -1\n\tfor pe != nil {\n\t\tindex++\n\t\tif pe.elem == ele {\n\t\t\tlastIndex = index\n\t\t}\n\t\tpe = pe.next\n\t}\n\treturn lastIndex\n}", "func (w *WaterMark) LastIndex() uint64 {\n\treturn w.lastIndex.Load()\n}", "func FindLastIndex(data, callback interface{}, args ...int) (int, error) {\n\tvar err error\n\n\tresult := func(err *error) int {\n\t\tdefer catch(err)\n\n\t\tif !isNonNilData(err, \"data\", data) {\n\t\t\treturn -1\n\t\t}\n\n\t\tdataValue, _, _, dataValueLen := inspectData(data)\n\n\t\tif !isSlice(err, \"data\", dataValue) {\n\t\t\treturn -1\n\t\t}\n\n\t\tcallbackValue, callbackType := inspectFunc(err, callback)\n\t\tif *err != nil {\n\t\t\treturn -1\n\t\t}\n\n\t\tcallbackTypeNumIn := validateFuncInputForSliceLoop(err, callbackType, dataValue)\n\t\tif *err != nil {\n\t\t\treturn -1\n\t\t}\n\n\t\tvalidateFuncOutputOneVarBool(err, callbackType, true)\n\t\tif *err != nil {\n\t\t\treturn -1\n\t\t}\n\n\t\tif dataValueLen == 0 {\n\t\t\treturn -1\n\t\t}\n\n\t\tendIndex := dataValueLen\n\t\tif len(args) > 0 {\n\t\t\tendIndex = args[0]\n\t\t}\n\n\t\tresult := -1\n\n\t\tforEachSliceStoppable(dataValue, dataValueLen, func(each reflect.Value, i int) bool {\n\t\t\tif i > endIndex {\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tres := callFuncSliceLoop(callbackValue, each, i, callbackTypeNumIn)\n\t\t\tif res[0].Bool() {\n\t\t\t\tresult = i\n\t\t\t}\n\n\t\t\treturn true\n\t\t})\n\n\t\tif result < 0 {\n\t\t\treturn result\n\t\t}\n\n\t\treturn result\n\t}(&err)\n\n\treturn result, err\n}", "func (p *pipeline) LastIndexOf(comp func(Handler) bool) int {\n\n\ttail := p.tail\n\n\tfor i := p.size - 1; ; i-- {\n\t\tif comp(tail.handler) {\n\t\t\treturn i\n\t\t}\n\t\tif tail = tail.prev; tail == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn -1\n}", "func (e Expr) LastArg() Expr {\n\treturn e.Args[len(e.Args)-1]\n}", "func (l *LevelDB) LastIndex() (uint64, error) {\n\titer := l.db.NewIterator(&util.Range{Start: nil, Limit: nil}, nil)\n\tdefer iter.Release()\n\titer.Last()\n\titer.Prev()\n\n\tfor iter.Next() {\n\t\tkey := binary.LittleEndian.Uint64(iter.Key())\n\t\treturn key, nil\n\t}\n\n\treturn 0, nil\n}", "func (ls *LevelDBStore) LastIndex() (uint64, error) {\n\tls.rwMtx.Lock()\n\tdefer ls.rwMtx.Unlock()\n\titer := ls.ldb.NewIterator(nil, nil)\n\tdefer iter.Release()\n\tif iter.Last() {\n\t\tkey := iter.Key()\n\t\treturn bytesToUint64(key), nil\n\t}\n\treturn 0, nil\n}", "func longestNonIncreasingSuffix(data sort.Interface) int {\n\tn := data.Len()\n\tfor i := n - 1; i-1 >= 0; i-- {\n\t\tif data.Less(i-1, i) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func Strrpos(haystack, needle string) int {\n\n\tpos := strings.LastIndex(haystack, needle)\n\n\tif pos < 0 {\n\t\treturn pos\n\t}\n\n\trs := []rune(haystack[0:pos])\n\n\treturn len(rs)\n}", "func splitLastPath(fullName string) (string, string, error) {\n\tif fullName == \"\" {\n\t\treturn \"\", \"\", fmt.Errorf(\"cannot split last path from empty string\")\n\t}\n\tparts := strings.Split(fullName, \"/\")\n\tif len(parts) == 1 {\n\t\treturn \"\", parts[0], nil\n\t}\n\tpathPrefix := strings.Join(parts[:(len(parts)-1)], \"/\")\n\tlastPath := parts[(len(parts) - 1)]\n\treturn pathPrefix, lastPath, nil\n}", "func findLastBreak(str string, pos int) int {\n\tfor i := pos; i >= 0; i-- {\n\t\tif str[i] == ' ' || str[i] == '\\t' || str[i] == '\\n' {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func (l *Log) LastCommandIndex() (uint64, error) {\n\tfi, li, err := l.Indexes()\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"get indexes: %s\", err)\n\t}\n\n\t// Check for empty log.\n\tif li == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar rl raft.Log\n\tfor i := li; i >= fi; i-- {\n\t\tif err := l.GetLog(i, &rl); err != nil {\n\t\t\treturn 0, fmt.Errorf(\"get log at index %d: %s\", i, err)\n\t\t}\n\t\tif rl.Type == raft.LogCommand {\n\t\t\treturn i, nil\n\t\t}\n\t}\n\treturn 0, nil\n}", "func last(input interface{}) interface{} {\n\tif input == nil {\n\t\treturn nil\n\t}\n\tarr := reflect.ValueOf(input)\n\tif arr.Len() == 0 {\n\t\treturn nil\n\t}\n\treturn arr.Index(arr.Len() - 1).Interface()\n}", "func detectEnd(text string) (string, bool) {\n\tends := []string{\".\", \"!\", \";\", \"?\"}\n\tfor _, s := range ends {\n\t\tlast := strings.LastIndex(text, s)\n\t\tif last > 0 {\n\t\t\ttext = text[0 : last+1]\n\t\t\treturn text, true\n\t\t}\n\t}\n\n\treturn text, false\n}", "func (n *Name) LastPart() string {\n\ts := n.Value\n\tif n.IsFullyQualified() {\n\t\ts = s[len(`\\`):]\n\t}\n\tlastSlash := strings.LastIndexByte(s, '\\\\')\n\tif lastSlash == -1 {\n\t\treturn s\n\t}\n\treturn s[len(`\\`)+lastSlash:]\n}", "func IndexAfter(s, sep []byte) int {\n\tpos := bytes.Index(s, sep)\n\tif pos == -1 {\n\t\treturn -1\n\t}\n\treturn pos + len(sep)\n}", "func GetWordsAfterLastChar(str string, lastChar string) string {\n\tres := str\n\tlastCharIdx := 0\n\tfor i, char := range str {\n\t\tif string(char) == lastChar {\n\t\t\tlastCharIdx = i\n\t\t}\n\t}\n\tif lastCharIdx > 0 && len(str) > lastCharIdx+1 {\n\t\tres = str[(lastCharIdx + 1):]\n\t}\n\n\treturn res\n}", "func (master *MasterIndex) LastIndex() Index {\n\treturn master.indexCache[len(master.indexCache)-1]\n}", "func lengthOfLastWord(s string) int {\n // Find right most non space symbol.\n j := len(s) - 1\n for ; ' ' == s[j]; j -= 1{ }\n // Find next space moving from j.\n i := j\n for ; 0 <= i && ' ' != s[i]; i -= 1{ }\n return j - i\n}", "func (array Array) LastIndexOf(value interface{}, fromIndex int) int {\n\tif fromIndex < 0 || fromIndex > len(array) - 1 {\n\t\tfromIndex = len(array) - 1\n\t}\n\tfor i := fromIndex; i >= 0; i-- {\n\t\tv := array[i]\n\t\tif v == value {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func (me Tokens) Last(matches func(*Token) bool) *Token {\n\tif len(me) == 0 {\n\t\treturn nil\n\t}\n\tif matches != nil {\n\t\tfor i := len(me) - 1; i >= 0; i-- {\n\t\t\tif t := &me[i]; matches(t) {\n\t\t\t\treturn t\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\treturn &me[len(me)-1]\n}", "func (b *raftBadger) LastIndex() (uint64, error) {\n\tstore := b.gs.GetStore().(*badger.DB)\n\tlast := uint64(0)\n\tif err := store.View(func(txn *badger.Txn) error {\n\t\topts := badger.DefaultIteratorOptions\n\t\topts.Reverse = true\n\t\tit := txn.NewIterator(opts)\n\t\tdefer it.Close()\n\t\t// see https://github.com/dgraph-io/badger/issues/436\n\t\t// and https://github.com/dgraph-io/badger/issues/347\n\t\tseekKey := append(dbLogPrefix, 0xFF)\n\t\tit.Seek(seekKey)\n\t\tif it.ValidForPrefix(dbLogPrefix) {\n\t\t\titem := it.Item()\n\t\t\tk := string(item.Key()[len(dbLogPrefix):])\n\t\t\tidx, err := strconv.ParseUint(k, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlast = idx\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\treturn 0, err\n\t}\n\treturn last, nil\n}", "func findLongestSuffix(s string, suffixes []string) (string) {\n\tsort.Sort(byDecLength(suffixes))\n\tfor _, suffix := range suffixes {\n\t\tif strings.HasSuffix(s, suffix) {\n\t\t\treturn suffix\n\t\t}\n\t}\n\treturn \"\"\n}", "func Last(data interface{}) (interface{}, error) {\n\tvar err error\n\n\tresult := func(err *error) interface{} {\n\t\tdefer catch(err)\n\n\t\tif !isNonNilData(err, \"data\", data) {\n\t\t\treturn nil\n\t\t}\n\n\t\tdataValue, _, _, dataValueLen := inspectData(data)\n\n\t\tif !isSlice(err, \"data\", dataValue) {\n\t\t\treturn nil\n\t\t}\n\n\t\tif dataValueLen == 0 {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn dataValue.Index(dataValueLen - 1).Interface()\n\t}(&err)\n\n\treturn result, err\n}", "func (r *RelativePath) LastElement() string {\n\tif len(r.stack) == 0 {\n\t\tlog.Println(\"RelativePath: WARNING: empty stack!\")\n\t\treturn \"\"\n\t}\n\t// make sure we remain within safe values\n\telement := len(r.stack) - 1\n\tif element < 0 {\n\t\telement = 0\n\t}\n\treturn r.stack[element]\n}", "func trimLast(text string) string {\n\ttextLen := len(text)\n\tif textLen == 0 {\n\t\treturn text\n\t}\n\treturn text[:textLen-1]\n}", "func (v *Version) LastName() string {\n\tif len(v.Names) == 0 {\n\t\treturn \"\"\n\t}\n\treturn v.Names[len(v.Names)-1]\n}", "func (r Roster) RetrieveLastIndex() int {\n\treturn len(r) - 1\n}", "func (s FileLocationArray) Last() (v FileLocation, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "func (l *Lexer) LastPos() int64 {\n\treturn l.lastPos\n}", "func extractLastDigit(licensePlate string) (int, error) {\n\tif validateLicensePlate(licensePlate) == true {\n\t\tlastDigit, _ := strconv.Atoi(licensePlate[len(licensePlate) - 1:])\n\t\treturn lastDigit, nil\n\t} else {\n\t\treturn -1, errors.New(\"Invalid license plate\")\n\t}\n}", "func LastToken(node phrase.AstNode) *lexer.Token {\n\tif t, ok := node.(*lexer.Token); ok {\n\t\treturn t\n\t}\n\tif e, ok := node.(*phrase.ParseError); ok {\n\t\treturn e.Unexpected\n\t}\n\tif p, ok := node.(*phrase.Phrase); ok && len(p.Children) != 0 {\n\t\treturn LastToken(p.Children[len(p.Children)-1])\n\t}\n\treturn nil\n}", "func (l *List) GetLast(v interface{} /* val */) *El {\n\tcur := l.search(v, false, false)\n\n\tif cur == &l.zero || l.less(cur.val, v) {\n\t\treturn nil\n\t}\n\n\treturn cur\n}", "func lengthOfLastWord(s string) int {\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\n\tl := len(s)\n\tfor l > 0 && s[l-1] == ' ' {\n\t\tl--\n\t}\n\n\tcnt := 0\n\tfor l > 0 && s[l-1] != ' ' {\n\t\tcnt++\n\t\tl--\n\t}\n\n\treturn cnt\n}", "func (l *Lexer) Last() (r rune, width int) {\n\treturn l.last, l.width\n}", "func LastURLPart(url string) string {\n\turlArray := strings.Split(url, \"/\")\n\treturn urlArray[len(urlArray)-1]\n}", "func (pe PathExpression) popOneLastLeg() (PathExpression, pathLeg) {\n\tlastLegIdx := len(pe.legs) - 1\n\tlastLeg := pe.legs[lastLegIdx]\n\t// It is used only in modification, it has been checked that there is no asterisks.\n\treturn PathExpression{legs: pe.legs[:lastLegIdx]}, lastLeg\n}", "func findLastPostition(q []int, x int) int {\n\tif len(q) == 0 {\n\t\treturn -1\n\t}\n\tl := 0\n\tr := len(q) - 1\n\tfor l+1 < r {\n\t\tmid := (l + r) >> 1\n\t\tif q[mid] > x {\n\t\t\tr = mid\n\t\t} else {\n\t\t\tl = mid\n\t\t}\n\t}\n\tif q[r] == x {\n\t\treturn r\n\t}\n\tif q[l] == x {\n\t\treturn l\n\t}\n\treturn -1\n}", "func Last(input interface{}, data map[string]interface{}) interface{} {\n\tvalue := reflect.ValueOf(input)\n\tkind := value.Kind()\n\n\tif kind != reflect.Array && kind != reflect.Slice {\n\t\treturn input\n\t}\n\tlen := value.Len()\n\tif len == 0 {\n\t\treturn input\n\t}\n\treturn value.Index(len - 1).Interface()\n}", "func getLastOctet(s string) int {\n\tsplit := strings.Split(s, \".\")\n\tlastOctet, _ := strconv.Atoi(split[len(split)-1])\n\treturn lastOctet\n}", "func (e Entry) LastName() string {\n\tnames := strings.Split(e.FullName, \" \")\n\treturn names[len(names)-1]\n}", "func lastNonWhiteSpace(s []byte) byte {\n\tfor i := len(s) - 1; i >= 0; i-- {\n\t\tif x := s[i]; (x != ' ') && (x != '\\t') {\n\t\t\treturn x\n\t\t}\n\t}\n\treturn 0\n}", "func (r *radNode) getLast() *radNode {\n\tn := r.desc\n\tif n == nil {\n\t\treturn nil\n\t}\n\tif n.sis == nil {\n\t\treturn n\n\t}\n\tkey := string(n.prefix)\n\tfor d := n.sis; d != nil; d = d.sis {\n\t\tk := string(d.prefix)\n\t\tif k > key {\n\t\t\tn = d\n\t\t\tkey = k\n\t\t}\n\t}\n\treturn 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 lengthOfLastWord(s string) int {\n\tarr := strings.Split(strings.Trim(s, \" \"), \" \")\n\tlength := len(arr)\n\tres := 0\n\tfor i := length - 1; i >= 0; i-- {\n\t\tif arr[i] == \" \" {\n\t\t\tcontinue\n\t\t} else {\n\t\t\tres = len(arr[i])\n\t\t\tbreak\n\t\t}\n\t}\n\treturn res\n}", "func (a errorMsgs) Last() *Error {\n\tif length := len(a); length > 0 {\n\t\treturn a[length-1]\n\t}\n\treturn nil\n}", "func lengthOfLongestSubstring(s string) int {\n n := len(s)\n res := 0\n idx := [256]int{0}\n for i, j := 0, 0; j < n; j++ {\n i = max(idx[int(s[j])], i) //\n res = max(res, j - i + 1) //store max length to res\n idx[int(s[j])] = j + 1 //set character index\n fmt.Print(s[j], idx[int(s[j])], i, j - i + 1)\n fmt.Println()\n }\n return res\n}", "func (a Slice[T]) Last() *T {\n\treturn a.At(len(a) - 1)\n}", "func (l *Log) LastTerm() uint64 {\n\tt, err := l.Term(l.LastIndex())\n\tif err != nil {\n\t\tpanicf(\"unexpected error when getting the last term (%v)\", err)\n\t}\n\treturn t\n}", "func lastAddr(n *net.IPNet) (net.IP, error) { // works when the n is a prefix, otherwise...\n\tif n.IP.To4() == nil {\n\t\treturn net.IP{}, errors.New(\"does not support IPv6 addresses.\")\n\t}\n\tip := make(net.IP, len(n.IP.To4()))\n\tbinary.BigEndian.PutUint32(ip, binary.BigEndian.Uint32(n.IP.To4())|^binary.BigEndian.Uint32(net.IP(n.Mask).To4()))\n\treturn ip, nil\n}", "func stringReplaceLast(s string, old string, replacement string, n int) string {\n\treturn stringReverse(strings.Replace(stringReverse(s), stringReverse(old), stringReverse(replacement), n))\n}", "func main() {\n\tvar endWith = strings.HasSuffix(\"This is an example string\", \"ng\")\n\tfmt.Println(endWith)\n}" ]
[ "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.66308993", "0.6617252", "0.6584626", "0.6550716", "0.65271574", "0.6511688", "0.6488469", "0.64058095", "0.6393143", "0.6393143", "0.63725895", "0.63585556", "0.6319927", "0.6293721", "0.62612945", "0.6229924", "0.62206703", "0.61603683", "0.614778", "0.61340654", "0.6132477", "0.6131305", "0.6101338", "0.6096678", "0.60886955", "0.6070028", "0.60623217", "0.60561645", "0.6031341", "0.6004935", "0.6002304", "0.59880006", "0.5985095", "0.598327", "0.5963055", "0.5960231", "0.5941212", "0.5931165", "0.5915604", "0.5905812", "0.5878446", "0.58746", "0.5874065", "0.5870853", "0.5853887", "0.5851271", "0.58135337", "0.58003354", "0.5799017", "0.5796019", "0.57916903", "0.578844", "0.5772433", "0.5755846", "0.57335013", "0.5717761", "0.57068205", "0.56894815", "0.56818026", "0.5675648", "0.567163", "0.56642866", "0.56527776", "0.56471264", "0.56404936", "0.56379753", "0.5633734", "0.56291276", "0.56283754", "0.55790406", "0.5578528", "0.55775154", "0.55728483", "0.55657744", "0.55600387", "0.5548872", "0.5548676", "0.5546661", "0.5538609", "0.5521038" ]
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\treturn strings.LastIndex(s.str, str)\n}", "func stringSuffixIndexFunc(s string, f func(c rune) bool) (i int) {\n var hasSuffix bool\n i = strings.LastIndexFunc(s, func(c rune) (done bool) {\n if done = !f(c); !hasSuffix {\n hasSuffix = !done\n }\n return\n })\n if i++; !hasSuffix {\n i = -1\n }\n return\n}", "func LastIndex(key string) string {\n\treturn key[strings.LastIndexAny(key, \"/\")+1:]\n}", "func LastIndexOf(slice []string, needle string) int {\n\tfor idx := len(slice) - 1; idx >= 0; idx-- {\n\t\tif slice[idx] == needle {\n\t\t\treturn idx\n\t\t}\n\t}\n\n\treturn -1\n}", "func LastIndexOfString(array []string, val string) int {\n\torderIndex := IndexOfString(array, val)\n\tif orderIndex == -1 {\n\t\treturn -1\n\t}\n\treturn len(array) - 1 - orderIndex\n}", "func Last(s string) rune {\n\tif s == \"\" {\n\t\tpanic(\"empty list\")\n\t}\n\n\tr, _ := utf8.DecodeLastRuneInString(s)\n\treturn r\n}", "func LastIndexOf(data interface{}, search interface{}, args ...int) (int, error) {\n\tvar err error\n\n\tresult := func(err *error) int {\n\t\tdefer catch(err)\n\n\t\tif !isNonNilData(err, \"data\", data) {\n\t\t\treturn -1\n\t\t}\n\n\t\tdataValue, _, _, dataValueLen := inspectData(data)\n\n\t\tif !isSlice(err, \"data\", dataValue) {\n\t\t\treturn -1\n\t\t}\n\n\t\tstartIndex := dataValueLen - 1\n\t\tif len(args) > 0 {\n\t\t\tstartIndex = args[0]\n\t\t}\n\n\t\tif dataValueLen == 0 {\n\t\t\treturn -1\n\t\t}\n\n\t\tresult := -1\n\n\t\tforEachSliceStoppable(dataValue, dataValueLen, func(each reflect.Value, i int) bool {\n\t\t\tif startIndex > -1 {\n\t\t\t\tiFromRight := startIndex - i\n\t\t\t\tif iFromRight > (dataValueLen-1) || iFromRight < 0 {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\n\t\t\t\teachFromRight := dataValue.Index(iFromRight)\n\t\t\t\tif eachFromRight.Interface() == search && result == -1 {\n\t\t\t\t\tresult = iFromRight\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tiFromRight := dataValueLen + startIndex - i\n\t\t\t\tif iFromRight > (dataValueLen-1) || iFromRight < 0 {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\n\t\t\t\teachFromRight := dataValue.Index(iFromRight)\n\t\t\t\tif eachFromRight.Interface() == search && result == -1 {\n\t\t\t\t\tresult = iFromRight\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true\n\t\t})\n\n\t\treturn result\n\t}(&err)\n\n\treturn result, err\n}", "func (l *LexInner) Last() rune {\n\tif l.Len() == 0 {\n\t\treturn Eof\n\t}\n\tr, _ := utf8.DecodeLastRuneInString(l.Get())\n\treturn r\n}", "func (s StringSlice) Last() string {\n\tif len(s) == 0 {\n\t\treturn \"\"\n\t}\n\treturn s[len(s)-1]\n}", "func LastArg(args []string) string {\n\tif len(args) > 0 {\n\t\treturn args[len(args)-1]\n\t}\n\treturn \"\"\n}", "func Index(substr, operand string) int { return strings.Index(operand, substr) }", "func nolast(x string) string {\n\treturn x[:len(x)-1]\n}", "func nolast(x string) string {\n\treturn x[:len(x)-1]\n}", "func nolast(x string) string {\n\treturn x[:len(x)-1]\n}", "func nolast(x string) string {\n\treturn x[:len(x)-1]\n}", "func nolast(x string) string {\n\treturn x[:len(x)-1]\n}", "func nolast(x string) string {\n\treturn x[:len(x)-1]\n}", "func nolast(x string) string {\n\treturn x[:len(x)-1]\n}", "func nolast(x string) string {\n\treturn x[:len(x)-1]\n}", "func ContainsAny(chars, operand string) bool { return strings.ContainsAny(operand, chars) }", "func lastArg(args []string) string {\n\tl := len(args)\n\tif l >= 2 {\n\t\treturn args[l-1]\n\t}\n\tif l == 1 {\n\t\treturn args[0]\n\t}\n\treturn \"\"\n}", "func Last(ss []string) string {\n\tif len(ss) >= 1 {\n\t\treturn ss[len(ss)-1]\n\t}\n\treturn \"\"\n}", "func (t *StringSlice) Last() string {\n\tvar ret string\n\tif len(t.items) > 0 {\n\t\tret = t.items[len(t.items)-1]\n\t}\n\treturn ret\n}", "func lastIndex(s, sep []byte) int {\n\tn := len(sep)\n\tif n == 0 {\n\t\treturn len(s)\n\t}\n\tc := sep[0]\n\tfor i := len(s) - n; i >= 0; i-- {\n\t\tif s[i] == c && (n == 1 || bytes.Equal(s[i:i+n], sep)) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func FindLastIndex(data, callback interface{}, args ...int) (int, error) {\n\tvar err error\n\n\tresult := func(err *error) int {\n\t\tdefer catch(err)\n\n\t\tif !isNonNilData(err, \"data\", data) {\n\t\t\treturn -1\n\t\t}\n\n\t\tdataValue, _, _, dataValueLen := inspectData(data)\n\n\t\tif !isSlice(err, \"data\", dataValue) {\n\t\t\treturn -1\n\t\t}\n\n\t\tcallbackValue, callbackType := inspectFunc(err, callback)\n\t\tif *err != nil {\n\t\t\treturn -1\n\t\t}\n\n\t\tcallbackTypeNumIn := validateFuncInputForSliceLoop(err, callbackType, dataValue)\n\t\tif *err != nil {\n\t\t\treturn -1\n\t\t}\n\n\t\tvalidateFuncOutputOneVarBool(err, callbackType, true)\n\t\tif *err != nil {\n\t\t\treturn -1\n\t\t}\n\n\t\tif dataValueLen == 0 {\n\t\t\treturn -1\n\t\t}\n\n\t\tendIndex := dataValueLen\n\t\tif len(args) > 0 {\n\t\t\tendIndex = args[0]\n\t\t}\n\n\t\tresult := -1\n\n\t\tforEachSliceStoppable(dataValue, dataValueLen, func(each reflect.Value, i int) bool {\n\t\t\tif i > endIndex {\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tres := callFuncSliceLoop(callbackValue, each, i, callbackTypeNumIn)\n\t\t\tif res[0].Bool() {\n\t\t\t\tresult = i\n\t\t\t}\n\n\t\t\treturn true\n\t\t})\n\n\t\tif result < 0 {\n\t\t\treturn result\n\t\t}\n\n\t\treturn result\n\t}(&err)\n\n\treturn result, err\n}", "func (p *pipeline) LastIndexOf(comp func(Handler) bool) int {\n\n\ttail := p.tail\n\n\tfor i := p.size - 1; ; i-- {\n\t\tif comp(tail.handler) {\n\t\t\treturn i\n\t\t}\n\t\tif tail = tail.prev; tail == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn -1\n}", "func getOperandIndex(op string) (index int) {\n\t// get tier 3 operands\n\tfor i, c := range op {\n\t\tif c == '^' {\n\t\t\tif !isOpInBrackets(op[i:]) {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t}\n\n\t// get tier 2 operands\n\tfor i, c := range op {\n\t\tif c == '*' || c == '/' {\n\t\t\tif !isOpInBrackets(op[i:]) {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t}\n\n\t// get tier 1 operands\n\tfor i, c := range op {\n\t\tif c == '+' || c == '-' {\n\t\t\tif !isOpInBrackets(op[i:]) {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t}\n\n\t// nothing was found\n\treturn 0\n}", "func lastWord(in string) string {\n\tif ss := strings.Fields(in); len(ss) > 0 {\n\t\treturn ss[len(ss)-1]\n\t}\n\treturn \"\"\n}", "func (g *gnmiPath) LastStringElem() (string, error) {\n\treturn g.StringElemAt(g.Len() - 1)\n}", "func (e Expr) LastArg() Expr {\n\treturn e.Args[len(e.Args)-1]\n}", "func LastLexicalToken(sql string) (lastTok int, ok bool) {\n\ts := makeScanner(sql)\n\tvar lval sqlSymType\n\tfor {\n\t\tlast := lval.id\n\t\ts.scan(&lval)\n\t\tif lval.id == 0 {\n\t\t\treturn int(last), last != 0\n\t\t}\n\t}\n}", "func findLastPostition(q []int, x int) int {\n\tif len(q) == 0 {\n\t\treturn -1\n\t}\n\tl := 0\n\tr := len(q) - 1\n\tfor l+1 < r {\n\t\tmid := (l + r) >> 1\n\t\tif q[mid] > x {\n\t\t\tr = mid\n\t\t} else {\n\t\t\tl = mid\n\t\t}\n\t}\n\tif q[r] == x {\n\t\treturn r\n\t}\n\tif q[l] == x {\n\t\treturn l\n\t}\n\treturn -1\n}", "func (list *ArrayList[T]) LastIndexOf(ele T) int {\n\tfor i := list.Size() - 1; i >= 0; i-- {\n\t\tif ele == list.elems[i] {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func LastIndexByte(s string, c byte) int {\n\tfor i:=len(s)-1;i>=0;i-- {\n\t\tif s[i] == c {\n\t\t\treturn i\n\t\t}\n\t}\n\t// not found\n\treturn -1\n}", "func (me Tokens) Last(matches func(*Token) bool) *Token {\n\tif len(me) == 0 {\n\t\treturn nil\n\t}\n\tif matches != nil {\n\t\tfor i := len(me) - 1; i >= 0; i-- {\n\t\t\tif t := &me[i]; matches(t) {\n\t\t\t\treturn t\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\treturn &me[len(me)-1]\n}", "func LengthOfLastWord(s string) int {\n\tstrArr := strings.Split(s, \" \")\n\ti := 1\n\tl := 0\n\tfor {\n\t\tif i > len(strArr) {\n\t\t\tbreak\n\t\t}\n\t\tif len(strArr[len(strArr)-i]) == 0 {\n\t\t\ti++\n\t\t} else {\n\t\t\tl = len(strArr[len(strArr)-i])\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn l\n}", "func EndsWithAny(str string, suffixes ...string) bool {\n\tfor _, suffix := range suffixes {\n\t\tif internalEndsWith(str, (string)(suffix), false) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func last(input interface{}) interface{} {\n\tif input == nil {\n\t\treturn nil\n\t}\n\tarr := reflect.ValueOf(input)\n\tif arr.Len() == 0 {\n\t\treturn nil\n\t}\n\treturn arr.Index(arr.Len() - 1).Interface()\n}", "func lastComponent(s string) string {\n\tlastSlash := strings.LastIndex(s, \"/\")\n\tif lastSlash != -1 {\n\t\ts = s[lastSlash+1:]\n\t}\n\treturn s\n}", "func (l *Lexer) Last() (r rune, width int) {\n\treturn l.last, l.width\n}", "func Test_lengthOfLastWord(t *testing.T) {\n\tconvey.Convey(\"Test_lengthOfLastWord\", t, func() {\n\t\tconvey.So(IntShouldEqual(lengthOfLastWord(\"Hello World\"), 5), convey.ShouldBeTrue)\n\t\tconvey.So(IntShouldEqual(lengthOfLastWord(\"Hello World \"), 5), convey.ShouldBeTrue)\n\t})\n}", "func indexOfFirstRightBracket(key string) int {\n\treturn (rightBracketRegExp.FindStringIndex(key)[1] - 1)\n}", "func (this *LinkedList) LastIndexOf(ele interface{}) int {\n\tlastIndex := -1\n\tpe := this.head\n\tindex := -1\n\tfor pe != nil {\n\t\tindex++\n\t\tif pe.elem == ele {\n\t\t\tlastIndex = index\n\t\t}\n\t\tpe = pe.next\n\t}\n\treturn lastIndex\n}", "func (ms *MemoryStorage) LastIndex() (uint64, error) {\n\tms.Lock()\n\tdefer ms.Unlock()\n\treturn ms.lastIndex(), nil\n}", "func LastWord(bytes []byte) int {\n\treturn WordBegin(bytes, len(bytes)-1)\n}", "func lengthOfLastWord(s string) int {\n // Find right most non space symbol.\n j := len(s) - 1\n for ; ' ' == s[j]; j -= 1{ }\n // Find next space moving from j.\n i := j\n for ; 0 <= i && ' ' != s[i]; i -= 1{ }\n return j - i\n}", "func (pe PathExpression) popOneLastLeg() (PathExpression, pathLeg) {\n\tlastLegIdx := len(pe.legs) - 1\n\tlastLeg := pe.legs[lastLegIdx]\n\t// It is used only in modification, it has been checked that there is no asterisks.\n\treturn PathExpression{legs: pe.legs[:lastLegIdx]}, lastLeg\n}", "func LastWordInString(s string) int {\n\treturn WordBeginInString(s, len(s)-1)\n}", "func detectEnd(text string) (string, bool) {\n\tends := []string{\".\", \"!\", \";\", \"?\"}\n\tfor _, s := range ends {\n\t\tlast := strings.LastIndex(text, s)\n\t\tif last > 0 {\n\t\t\ttext = text[0 : last+1]\n\t\t\treturn text, true\n\t\t}\n\t}\n\n\treturn text, false\n}", "func (dl *DelegatorList) lastIndex() uint64 {\n\t// negative count?\n\tif dl.count < 0 {\n\t\tif dl.cursor > 0 {\n\t\t\treturn dl.cursor\n\t\t}\n\t\treturn 0\n\t}\n\n\t// adjust for the list position\n\tval := dl.cursor + uint64(dl.count)\n\tif val > uint64(len(dl.list)) {\n\t\tval = uint64(len(dl.list))\n\t}\n\n\treturn val\n}", "func HasSuffix(suffix, operand string) bool { return strings.HasSuffix(operand, suffix) }", "func nolastif(x []string) []string {\n\tif x[len(x)-1] != \"\" {\n\t\treturn x\n\t}\n\treturn x[:len(x)-1]\n}", "func Last(data interface{}) (interface{}, error) {\n\tvar err error\n\n\tresult := func(err *error) interface{} {\n\t\tdefer catch(err)\n\n\t\tif !isNonNilData(err, \"data\", data) {\n\t\t\treturn nil\n\t\t}\n\n\t\tdataValue, _, _, dataValueLen := inspectData(data)\n\n\t\tif !isSlice(err, \"data\", dataValue) {\n\t\t\treturn nil\n\t\t}\n\n\t\tif dataValueLen == 0 {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn dataValue.Index(dataValueLen - 1).Interface()\n\t}(&err)\n\n\treturn result, err\n}", "func finalValueAfterOperations(operations []string) int {\n\tr := 0\n\tfor _, o := range operations {\n\t\tif o[0] == '-' || o[2] == '-' {\n\t\t\tr--\n\t\t} else {\n\t\t\tr++\n\t\t}\n\t}\n\treturn r\n}", "func HasSingleMeasurementNoOR(expr influxql.Expr) (string, bool) {\n\tvar lastMeasurement string\n\tfoundOnce := true\n\tvar invalidOP bool\n\n\tinfluxql.WalkFunc(expr, func(node influxql.Node) {\n\t\tif !foundOnce || invalidOP {\n\t\t\treturn\n\t\t}\n\n\t\tif be, ok := node.(*influxql.BinaryExpr); ok {\n\t\t\tif be.Op == influxql.OR {\n\t\t\t\tinvalidOP = true\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif ref, ok := be.LHS.(*influxql.VarRef); ok {\n\t\t\t\tif ref.Val == measurementRemap[measurementKey] {\n\t\t\t\t\tif be.Op != influxql.EQ {\n\t\t\t\t\t\tinvalidOP = true\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tif lastMeasurement != \"\" {\n\t\t\t\t\t\tfoundOnce = false\n\t\t\t\t\t}\n\n\t\t\t\t\t// Check that RHS is a literal string\n\t\t\t\t\tif ref, ok := be.RHS.(*influxql.StringLiteral); ok {\n\t\t\t\t\t\tlastMeasurement = ref.Val\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn lastMeasurement, len(lastMeasurement) > 0 && foundOnce && !invalidOP\n}", "func (b *BadgerStore) LastIndex() (uint64, error) {\n\treturn b.firstIndex(true)\n}", "func (b *BadgerStore) LastIndex() (uint64, error) {\n\treturn b.firstIndex(true)\n}", "func (r *raftLog) LastIndex() (uint64, error) {\n\treturn r.getIndex(false)\n}", "func (s FileLocationArray) Last() (v FileLocation, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "func getLastChar(s string) byte {\n\treturn s[len(s)-1]\n}", "func wordEndInString(s string, l0Pos int) int {\n\tl := len(s)\n\n\tl1, l1Pos := wLastSequenceInString(s[:l0Pos])\n\tl0, r0Delta := wFirstSequenceInString(s[l0Pos:])\n\tlOddRI := wIsOpenRIInString(s[:l1Pos], l1, l0)\n\tr0Pos := l0Pos + r0Delta\n\tr0, r1Delta := wFirstSequenceInString(s[r0Pos:])\n\n\tfor r0Pos < l {\n\t\tr1, r2Delta := wFirstSequenceInString(s[r0Pos+r1Delta:])\n\t\tif wDecision(l1, l0, lOddRI, r0, r1) {\n\t\t\treturn r0Pos\n\t\t}\n\t\tl1 = l0\n\t\tl0 = r0\n\t\tr0 = r1\n\t\tr0Pos += r1Delta\n\t\tr1Delta = r2Delta\n\t\tlOddRI = l0 == wClassRI && !lOddRI\n\t}\n\treturn l\n}", "func FindReverseBinaryOperator(symbol string) (string, bool) {\n\top, found := operatorMap[symbol]\n\tif !found || op.arity != 2 {\n\t\treturn \"\", false\n\t}\n\tif op.displayName == \"\" {\n\t\treturn \"\", false\n\t}\n\treturn op.displayName, true\n}", "func main() {\n\tvar endWith = strings.HasSuffix(\"This is an example string\", \"ng\")\n\tfmt.Println(endWith)\n}", "func (s UserAuthPasswordArray) Last() (v UserAuthPassword, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "func lengthOfLastWord(s string) int {\n\tarr := strings.Split(strings.Trim(s, \" \"), \" \")\n\tlength := len(arr)\n\tres := 0\n\tfor i := length - 1; i >= 0; i-- {\n\t\tif arr[i] == \" \" {\n\t\t\tcontinue\n\t\t} else {\n\t\t\tres = len(arr[i])\n\t\t\tbreak\n\t\t}\n\t}\n\treturn res\n}", "func indexFragment(s string) int {\n\tmax := -1\n\tfor _, sep := range []string{\". \", \": \", \"; \", \", \", \"! \", \"? \", \"\\\" \", \"' \"} {\n\t\tif idx := strings.LastIndex(s, sep); idx > max {\n\t\t\tmax = idx\n\t\t}\n\t}\n\tif max > 0 {\n\t\treturn max + 2\n\t}\n\tif idx := strings.LastIndex(s, \" \"); idx > 0 {\n\t\treturn idx + 1\n\t}\n\treturn -1\n}", "func (c StringArrayCollection) Last(cbs ...CB) interface{} {\n\tif len(cbs) > 0 {\n\t\tvar last interface{}\n\t\tfor key, value := range c.value {\n\t\t\tif cbs[0](key, value) {\n\t\t\t\tlast = value\n\t\t\t}\n\t\t}\n\t\treturn last\n\t} else {\n\t\tif len(c.value) > 0 {\n\t\t\treturn c.value[len(c.value)-1]\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n}", "func (l *List) Last() *string {\n\tif l == nil || len(*l) == 0 {\n\t\treturn nil\n\t}\n\treturn &(*l)[len(*l)-1]\n}", "func (ls *LevelDBStore) LastIndex() (uint64, error) {\n\tls.rwMtx.Lock()\n\tdefer ls.rwMtx.Unlock()\n\titer := ls.ldb.NewIterator(nil, nil)\n\tdefer iter.Release()\n\tif iter.Last() {\n\t\tkey := iter.Key()\n\t\treturn bytesToUint64(key), nil\n\t}\n\treturn 0, nil\n}", "func IsLastArray(s string) bool {\n\tfor _, b := range s {\n\t\tswitch b {\n\t\tcase '[':\n\t\t\treturn true\n\t\tcase '*':\n\t\t\tbreak\n\t\t}\n\t}\n\treturn false\n}", "func lengthOfLastWord(s string) int {\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\n\tl := len(s)\n\tfor l > 0 && s[l-1] == ' ' {\n\t\tl--\n\t}\n\n\tcnt := 0\n\tfor l > 0 && s[l-1] != ' ' {\n\t\tcnt++\n\t\tl--\n\t}\n\n\treturn cnt\n}", "func Operator(input string) int {\n\tvar o string = \"+-*/%^\"\n\n\treturn strings.IndexAny(input, o)\n}", "func GetWordsAfterLastChar(str string, lastChar string) string {\n\tres := str\n\tlastCharIdx := 0\n\tfor i, char := range str {\n\t\tif string(char) == lastChar {\n\t\t\tlastCharIdx = i\n\t\t}\n\t}\n\tif lastCharIdx > 0 && len(str) > lastCharIdx+1 {\n\t\tres = str[(lastCharIdx + 1):]\n\t}\n\n\treturn res\n}", "func SubstringAfterLast(str string, sep string) string {\n\tidx := strings.LastIndex(str, sep)\n\tif idx == -1 {\n\t\treturn str\n\t}\n\treturn str[idx+len(sep):]\n}", "func Last(obj interface{}) interface{} {\n\ttypeOfObj := reflect.TypeOf(obj)\n\tvalueOfObj := reflect.ValueOf(obj)\n\tif typeOfObj.Kind() != reflect.Array && typeOfObj.Kind() != reflect.Slice {\n\t\tpanic(\"make sure obj is array or slice\")\n\t}\n\tif valueOfObj.Len() == 0 {\n\t\tpanic(\"make sure obj is array not empty\")\n\t}\n\n\treturn valueOfObj.Index(valueOfObj.Len() - 1).Interface()\n}", "func lastElement(key string) string {\n\tkey = strings.TrimRight(key, \"/\\\\\")\n\tindex := strings.LastIndexAny(key, \"/\\\\\")\n\tif index >= 0 {\n\t\tkey = key[index+1:]\n\t}\n\treturn key\n}", "func (i *LogStore) LastIndex() (uint64, error) {\n\ti.l.RLock()\n\tdefer i.l.RUnlock()\n\treturn i.highIndex, nil\n}", "func (l *Log) LastCommandIndex() (uint64, error) {\n\tfi, li, err := l.Indexes()\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"get indexes: %s\", err)\n\t}\n\n\t// Check for empty log.\n\tif li == 0 {\n\t\treturn 0, nil\n\t}\n\n\tvar rl raft.Log\n\tfor i := li; i >= fi; i-- {\n\t\tif err := l.GetLog(i, &rl); err != nil {\n\t\t\treturn 0, fmt.Errorf(\"get log at index %d: %s\", i, err)\n\t\t}\n\t\tif rl.Type == raft.LogCommand {\n\t\t\treturn i, nil\n\t\t}\n\t}\n\treturn 0, nil\n}", "func (l *RaftLog) LastIndex() uint64 {\n\t// Your Code Here (2A).\n\treturn l.snapIndex + uint64(len(l.entries))\n}", "func (s FileLocationUnavailableArray) Last() (v FileLocationUnavailable, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[len(s)-1], true\n}", "func lastNonWhiteSpace(s []byte) byte {\n\tfor i := len(s) - 1; i >= 0; i-- {\n\t\tif x := s[i]; (x != ' ') && (x != '\\t') {\n\t\t\treturn x\n\t\t}\n\t}\n\treturn 0\n}", "func lengthOfLastWordMy(s string) int {\n\tl := 0\n\tfor i, v := range s {\n\t\tif v != 32 {\n\t\t\tif i > 1 {\n\t\t\t\tlast := s[i-1]\n\t\t\t\tif last == ' ' {\n\t\t\t\t\tl = 1\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tl++\n\t\t} else {\n\t\t\tcontinue\n\t\t}\n\t}\n\treturn l\n}", "func Last(arr interface{}) interface{} {\n\tvalue := redirectValue(reflect.ValueOf(arr))\n\tvalueType := value.Type()\n\n\tkind := value.Kind()\n\n\tif kind == reflect.Array || kind == reflect.Slice {\n\t\tif value.Len() == 0 {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn value.Index(value.Len() - 1).Interface()\n\t}\n\n\tpanic(fmt.Sprintf(\"Type %s is not supported by Last\", valueType.String()))\n}", "func findLongestSuffix(s string, suffixes []string) (string) {\n\tsort.Sort(byDecLength(suffixes))\n\tfor _, suffix := range suffixes {\n\t\tif strings.HasSuffix(s, suffix) {\n\t\t\treturn suffix\n\t\t}\n\t}\n\treturn \"\"\n}", "func (s *Stack[T]) Last() (T, bool) {\n\tif s.IsEmpty() {\n\t\treturn *new(T), false\n\t}\n\treturn (*s)[(len(*s) - 1)], true\n}", "func Last(input interface{}, data map[string]interface{}) interface{} {\n\tvalue := reflect.ValueOf(input)\n\tkind := value.Kind()\n\n\tif kind != reflect.Array && kind != reflect.Slice {\n\t\treturn input\n\t}\n\tlen := value.Len()\n\tif len == 0 {\n\t\treturn input\n\t}\n\treturn value.Index(len - 1).Interface()\n}", "func (i *InmemStore) LastIndex() (uint64, error) {\n\ti.l.RLock()\n\tdefer i.l.RUnlock()\n\treturn i.highIndex, nil\n}", "func getMatchingBracketIndex(op string, brindex int) (index int) {\n\topenBracketCount := 0\n\tfor i, c := range op[brindex:] {\n\t\tif c == '(' {\n\t\t\topenBracketCount++\n\t\t} else if c == ')' {\n\t\t\topenBracketCount--\n\t\t}\n\n\t\t// if the bracket count is 0, it means the bracket requested\n\t\t// was closed (or never opened)\n\t\tif openBracketCount == 0 {\n\t\t\treturn i\n\t\t}\n\t}\n\n\t// nothing was found\n\treturn 0\n}", "func LastToken(node phrase.AstNode) *lexer.Token {\n\tif t, ok := node.(*lexer.Token); ok {\n\t\treturn t\n\t}\n\tif e, ok := node.(*phrase.ParseError); ok {\n\t\treturn e.Unexpected\n\t}\n\tif p, ok := node.(*phrase.Phrase); ok && len(p.Children) != 0 {\n\t\treturn LastToken(p.Children[len(p.Children)-1])\n\t}\n\treturn nil\n}", "func (w *WaterMark) LastIndex() uint64 {\n\treturn w.lastIndex.Load()\n}", "func execDecodeLastRune(_ int, p *gop.Context) {\n\targs := p.GetArgs(1)\n\tret, ret1 := utf8.DecodeLastRune(args[0].([]byte))\n\tp.Ret(1, ret, ret1)\n}", "func (l *Log) LastTerm() uint64 {\n\tt, err := l.Term(l.LastIndex())\n\tif err != nil {\n\t\tpanicf(\"unexpected error when getting the last term (%v)\", err)\n\t}\n\treturn t\n}", "func Strrpos(haystack, needle string) int {\n\n\tpos := strings.LastIndex(haystack, needle)\n\n\tif pos < 0 {\n\t\treturn pos\n\t}\n\n\trs := []rune(haystack[0:pos])\n\n\treturn len(rs)\n}", "func (g *gnmiPath) LastPathElem() (*gnmipb.PathElem, error) {\n\treturn g.PathElemAt(g.Len() - 1)\n}", "func (array Array) LastIndexOf(value interface{}, fromIndex int) int {\n\tif fromIndex < 0 || fromIndex > len(array) - 1 {\n\t\tfromIndex = len(array) - 1\n\t}\n\tfor i := fromIndex; i >= 0; i-- {\n\t\tv := array[i]\n\t\tif v == value {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func (l *LevelDB) LastIndex() (uint64, error) {\n\titer := l.db.NewIterator(&util.Range{Start: nil, Limit: nil}, nil)\n\tdefer iter.Release()\n\titer.Last()\n\titer.Prev()\n\n\tfor iter.Next() {\n\t\tkey := binary.LittleEndian.Uint64(iter.Key())\n\t\treturn key, nil\n\t}\n\n\treturn 0, nil\n}", "func matchOperator(runes []rune, index int) int {\n\tmatchindex := -1\n\tmatchscore := 0\n\tr := runes[index]\n\n\tfor i, op := range Operators {\n\t\tscore := 0\n\t\tif r != rune(op[0]) { continue }\n\t\tif index + len(op) > len(runes) { continue }\n\n\t\topstr := string(runes[index:index + len(op)])\n\t\tif op == opstr { score = len(op) }\n\n\t\tif score > matchscore {\n\t\t\tmatchscore = score\n\t\t\tmatchindex = i\n\t\t}\n\t}\n\n\treturn matchindex\n}" ]
[ "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.5548754", "0.5548754", "0.5511077", "0.5489161", "0.54771227", "0.5448935", "0.5437363", "0.5401657", "0.5380297", "0.5337419", "0.5328248", "0.52739465", "0.52502865", "0.5238618", "0.5228355", "0.52005124", "0.51944876", "0.5194333", "0.5088899", "0.5087218", "0.50672007", "0.50647163", "0.5045571", "0.5041889", "0.5020171", "0.5016332", "0.5011324", "0.5010683", "0.5007381", "0.50070894", "0.50061655", "0.49939108", "0.49655107", "0.49502963", "0.492793", "0.49274164", "0.49057248", "0.49007273", "0.48987463", "0.48987463", "0.48948997", "0.48939306", "0.48883325", "0.48848248", "0.48767054", "0.4868709", "0.48670748", "0.48510092", "0.48241672", "0.48234093", "0.4816454", "0.4814143", "0.48111957", "0.4804647", "0.48018742", "0.4800143", "0.4797728", "0.47871247", "0.4779034", "0.47777858", "0.4775709", "0.47754875", "0.47740778", "0.4770584", "0.47665268", "0.47525442", "0.47520316", "0.4747932", "0.4747566", "0.47420746", "0.47362065", "0.47286287", "0.4711695", "0.4698647", "0.46946052", "0.4676052", "0.4675184", "0.46691632", "0.46633244", "0.46501267" ]
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 = append(lines, data[pos:i])\n\t\t\tpos = i + 1\n\t\t}\n\t\tlast = c\n\t}\n\tif pos != len(lines) {\n\t\tlines = append(lines, data[pos:])\n\t}\n\treturn lines\n}", "func splitLines(document []byte) []string {\n\tlines := strings.Split(string(document), \"\\n\")\n\t// Skip trailing empty string from Split-ing\n\tif len(lines) > 0 && lines[len(lines)-1] == \"\" {\n\t\tlines = lines[:len(lines)-1]\n\t}\n\treturn lines\n}", "func splitLines(data []byte, atEOF bool) (advance int, token []byte, err error) {\n\tif atEOF && len(data) == 0 {\n\t\treturn 0, nil, bufio.ErrFinalToken\n\t}\n\n\tidx := bytes.IndexAny(data, \"\\r\\n\")\n\tswitch {\n\tcase atEOF && idx < 0:\n\t\treturn len(data), data, bufio.ErrFinalToken\n\n\tcase idx < 0:\n\t\treturn 0, nil, nil\n\t}\n\n\t// consume CR or LF\n\teol := idx + 1\n\t// detect CRLF\n\tif len(data) > eol && data[eol-1] == '\\r' && data[eol] == '\\n' {\n\t\teol++\n\t}\n\n\treturn eol, data[:idx], nil\n}", "func (s *Str) SplitLines() []string {\n\treturn strings.Split(s.val, \"\\n\")\n}", "func (hdlr Latex) Lines(txt string) []string {\n\ttxt = strings.TrimRight(txt, \"\\n\")\n\treturn strings.Split(txt, \"\\n\")\n}", "func splitAfterNewline(p []byte) ([][]byte, []byte) {\n\tchunk := p\n\tvar lines [][]byte\n\n\tfor len(chunk) > 0 {\n\t\tidx := bytes.Index(chunk, newLine)\n\t\tif idx == -1 {\n\t\t\treturn lines, chunk\n\t\t}\n\n\t\tlines = append(lines, chunk[:idx+1])\n\n\t\tif idx == len(chunk)-1 {\n\t\t\tchunk = nil\n\t\t\tbreak\n\t\t}\n\n\t\tchunk = chunk[idx+1:]\n\t}\n\n\treturn lines, chunk\n}", "func SplitLines(tokens []string, widthFromLineNo widthFunc) [][]string {\n\tlines := make([][]string, 0)\n\tline_no := 0\n\ttoken_no := 0\n\tfor token_no < len(tokens) {\n\t\tlines = append(lines, make([]string, 0))\n\t\twidth := widthFromLineNo(line_no)\n\t\tif width <= 0 {\n\t\t\tlog.Printf(\"Negative width, defaulting to 1 : %d on line %d\\n\", width, line_no)\n\t\t\twidth = 1\n\t\t}\n\t\tfor TotalLength(lines[line_no]) < width {\n\t\t\tlines[line_no] = append(lines[line_no], tokens[token_no])\n\t\t\ttoken_no++\n\t\t\tif token_no == len(tokens) {\n\t\t\t\treturn lines\n\t\t\t}\n\t\t}\n\t\t// advance line number and take off the last token of previous line\n\t\t// since the last token pushed the string over the square width\n\t\t// unless the last line was only one token long\n\t\tif len(lines[line_no]) > 1 {\n\t\t\tlines[line_no] = lines[line_no][:len(lines[line_no])-1]\n\t\t\ttoken_no--\n\t\t}\n\t\tline_no++\n\t}\n\treturn lines\n}", "func SplitLines(data []byte, atEOF bool) (adv int, token []byte, err error) {\n\tif atEOF && len(data) == 0 {\n\t\treturn 0, nil, nil\n\t}\n\tif i := bytes.IndexAny(data, \"\\r\\n\"); i >= 0 {\n\t\tif data[i] == '\\n' {\n\t\t\treturn i + 1, data[0:i], nil\n\t\t}\n\t\tadv = i + 1\n\t\tif len(data) > i+1 && data[i+1] == '\\n' {\n\t\t\tadv++\n\t\t}\n\t\treturn adv, data[0:i], nil\n\t}\n\tif atEOF {\n\t\treturn len(data), data, nil\n\t}\n\treturn 0, nil, nil\n}", "func (s *Command) ExecToLines() ([]string, error) {\n\toutput, err := s.Exec()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlines := make([]string, 0)\n\tscanner := bufio.NewScanner(bytes.NewReader(output))\n\tskipUntilMarker := true\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tswitch {\n\t\tcase line == marker:\n\t\t\t// This will mean the following lines will be collected, but not the current 'marker' line:\n\t\t\tskipUntilMarker = false\n\t\tcase !skipUntilMarker:\n\t\t\tlines = append(lines, line)\n\t\t}\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\tlog.WithFields(log.Fields{\"Err\": err, \"Lines (so far)\": lines}).Debug(\"Failed to parse the output\")\n\t\treturn nil, errwrap.Wrap(errors.Errorf(\"Failed to parse the command output into lines\"), err)\n\t}\n\n\tlog.WithField(\"Lines\", lines).Debug(\"Parsed into lines\")\n\treturn lines, nil\n}", "func TestSplitLines(t *testing.T) {\n\ttype scenario struct {\n\t\tmultilineString string\n\t\texpected []string\n\t}\n\n\tscenarios := []scenario{\n\t\t{\n\t\t\t\"\",\n\t\t\t[]string{},\n\t\t},\n\t\t{\n\t\t\t\"\\n\",\n\t\t\t[]string{},\n\t\t},\n\t\t{\n\t\t\t\"hello world !\\nhello universe !\\n\",\n\t\t\t[]string{\n\t\t\t\t\"hello world !\",\n\t\t\t\t\"hello universe !\",\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, s := range scenarios {\n\t\tassert.EqualValues(t, s.expected, SplitLines(s.multilineString))\n\t}\n}", "func SplitLines(s string) []string {\n\tvar lines []string\n\tsc := bufio.NewScanner(strings.NewReader(s))\n\tfor sc.Scan() {\n\t\tlines = append(lines, sc.Text())\n\t}\n\treturn lines\n}", "func getLines(input []byte, commentMarker []byte) [][]byte {\n\tlines := bytes.Split(input, []byte(\"\\n\"))\n\tvar output [][]byte\n\tfor _, currentLine := range lines {\n\t\tcommentIndex := bytes.Index(currentLine, commentMarker)\n\t\tif commentIndex == -1 {\n\t\t\toutput = append(output, currentLine)\n\t\t} else {\n\t\t\toutput = append(output, currentLine[:commentIndex])\n\t\t}\n\t}\n\treturn output\n}", "func (b *Buffer) Lines(start, end int) []string {\n\tlines := b.lines[start:end]\n\tslice := make([]string, len(lines))\n\tfor _, line := range lines {\n\t\tslice = append(slice, string(line.data))\n\t}\n\treturn slice\n}", "func splitByLines(input string, limit int) (results []string) {\n\tif utf8.RuneCountInString(input) <= limit {\n\t\treturn []string{input}\n\t}\n\n\tmessageRunes := []rune(input)\n\tvar splitMessage [][]rune\n\n\tstartIndex := 0\n\tfor {\n\t\tcutIndex := startIndex + limit - 1\n\t\tif cutIndex > len(messageRunes)-1 {\n\t\t\tcutIndex = len(messageRunes) - 1\n\t\t}\n\t\tfullLine := false\n\t\tfor i := cutIndex; i >= startIndex; i-- {\n\t\t\tif messageRunes[i] == '\\n' {\n\t\t\t\tsplitMessage = append(splitMessage, messageRunes[startIndex:i+1])\n\t\t\t\tstartIndex = i + 1\n\t\t\t\tfullLine = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !fullLine {\n\t\t\tsplitMessage = append(splitMessage, messageRunes[startIndex:cutIndex+1])\n\t\t\tstartIndex = cutIndex + 1\n\t\t}\n\t\tif startIndex == len(messageRunes) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, v := range splitMessage {\n\t\tmsg := strings.Trim(string(v), \" \\n\")\n\t\tif len(msg) != 0 {\n\t\t\tresults = append(results, msg)\n\t\t}\n\t}\n\treturn\n}", "func getLines(input []byte) [][]byte {\n\tlines := bytes.Split(input, []byte(\"\\n\"))\n\tvar output [][]byte\n\tfor _, currentLine := range lines {\n\t\tcommentIndex := bytes.Index(currentLine, []byte(\"#\"))\n\t\tif commentIndex == -1 {\n\t\t\toutput = append(output, currentLine)\n\t\t} else {\n\t\t\toutput = append(output, currentLine[:commentIndex])\n\t\t}\n\t}\n\treturn output\n}", "func lines(s string) []string {\n\treturn strings.Split(s, \"\\n\")\n}", "func (t *ReaderTokeniser) tokeniseUntilLine() (line []string, lineok bool) {\n\tvar nread int\n\tfor t.pos < t.max && !lineok {\n\t\tnread, lineok, line = t.tok.TokeniseBytes(t.buf[t.pos:t.max])\n\t\tt.pos += nread\n\t}\n\treturn\n}", "func Lines(output string) []string {\n\treturn strings.Split(strings.TrimSpace(output), \"\\n\")\n}", "func (f *File) Lines() ([]string, error) {\n\tcontent, err := f.Contents()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsplits := strings.Split(content, \"\\n\")\n\t// remove the last line if it is empty\n\tif splits[len(splits)-1] == \"\" {\n\t\treturn splits[:len(splits)-1], nil\n\t}\n\n\treturn splits, nil\n}", "func (f *File) Lines() ([]string, error) {\n\tcontent, err := f.Contents()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsplits := strings.Split(content, \"\\n\")\n\t// remove the last line if it is empty\n\tif splits[len(splits)-1] == \"\" {\n\t\treturn splits[:len(splits)-1], nil\n\t}\n\n\treturn splits, nil\n}", "func contentToLinesArray(str string) (results []string) {\n\t// - strings.Fields function to split a string into substrings removing any space characters, including newlines.\n\t// - strings.Split function to split a string into its comma separated values\n\t// output := strings.Join(lines, \"\\n\") //puts array to string\n\tresults = strings.Split(str, \"\\n\") //split strings by line\n\treturn\n}", "func ParseLines(input []string) []Instr {\n\tvar in []Instr\n\tfor _, line := range input {\n\t\ti := []byte(line[0:1])[0]\n\t\tn, _ := strconv.Atoi(line[1:])\n\t\tin = append(in, Instr{i: i, n: n})\n\t}\n\treturn in\n}", "func LinesByParagraph(lines []string) [][]string {\n\tvar result [][]string\n\tvar chunk []string\n\n\tfor _, line := range lines {\n\t\tif line == \"\" {\n\t\t\tif chunk != nil {\n\t\t\t\tresult = append(result, chunk)\n\t\t\t\tchunk = nil\n\t\t\t}\n\t\t} else {\n\t\t\tchunk = append(chunk, line)\n\t\t}\n\t}\n\tif chunk != nil {\n\t\tresult = append(result, chunk)\n\t}\n\treturn result\n}", "func readLines(r io.Reader) []string {\n\tvar a []string\n\tb := bufio.NewReader(r)\n\tfor {\n\t\tline, err := b.ReadString('\\n')\n\t\tif len(line) > 0 {\n\t\t\ta = append(a, strings.TrimSuffix(line, \"\\n\"))\n\t\t}\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn a\n}", "func (io *Io) NextLines(n int) []string {\n\tres := make([]string, n)\n\tfor i := 0; i < n; i++ {\n\t\tres[i] = io.NextLine()\n\t}\n\treturn res\n}", "func readLine(br *bufio.Reader) ([]byte, error) {\n\tline := make([]byte, 0, 64)\n\n\tfor {\n\t\tpart, err := br.ReadSlice('\\n')\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif bytes.HasSuffix(part, crlf) {\n\t\t\tline = append(line, part[:len(part)-2]...)\n\t\t\tbreak\n\t\t}\n\t\tline = append(line, part...)\n\t}\n\n\treturn line, nil\n}", "func NewLineEndSplitFunc(re *regexp.Regexp) bufio.SplitFunc {\n\treturn func(data []byte, atEOF bool) (advance int, token []byte, err error) {\n\t\tloc := re.FindIndex(data)\n\t\tif loc == nil {\n\t\t\treturn 0, nil, nil // read more data and try again\n\t\t}\n\n\t\t// If the match goes up to the end of the current buffer, do another\n\t\t// read until we can capture the entire match\n\t\tif loc[1] == len(data)-1 && !atEOF {\n\t\t\treturn 0, nil, nil\n\t\t}\n\n\t\tadvance = loc[1]\n\t\ttoken = data[:loc[1]]\n\t\terr = nil\n\t\treturn\n\t}\n}", "func codeLines(src []byte, start, end int) (lines []codeLine) {\n\tstartLine := 1\n\tfor i, b := range src {\n\t\tif i == start {\n\t\t\tbreak\n\t\t}\n\t\tif b == '\\n' {\n\t\t\tstartLine++\n\t\t}\n\t}\n\ts := bufio.NewScanner(bytes.NewReader(src[start:end]))\n\tfor n := startLine; s.Scan(); n++ {\n\t\tl := s.Text()\n\t\tif strings.HasSuffix(l, \"OMIT\") {\n\t\t\tcontinue\n\t\t}\n\t\tlines = append(lines, codeLine{L: l, N: n})\n\t}\n\t// Trim leading and trailing blank lines.\n\tfor len(lines) > 0 && len(lines[0].L) == 0 {\n\t\tlines = lines[1:]\n\t}\n\tfor len(lines) > 0 && len(lines[len(lines)-1].L) == 0 {\n\t\tlines = lines[:len(lines)-1]\n\t}\n\treturn\n}", "func ScanLines(b []byte) []byte {\n\treturn NewROutputFilter(false)(b)\n}", "func splitAuditLine(byteLen *int) bufio.SplitFunc {\n\treturn func(data []byte, atEOF bool) (advance int, token []byte, err error) {\n\t\tadvance, token, err = bufio.ScanLines(data, atEOF)\n\t\t*byteLen += advance\n\t\treturn advance, token, err\n\t}\n}", "func (t *tail) GetLines(dst []string) {\n\tt.readAsMuchAsPossible()\n\tfor i := 0; i < len(dst) && i < len(t.lines); i++ {\n\t\tif i < len(t.lines) {\n\t\t\tdst[len(dst)-i-1] = t.lines[len(t.lines)-i-1]\n\t\t} else {\n\t\t\tdst[len(dst)-i-1] = \"\"\n\t\t}\n\t}\n}", "func getLines(s string) []string {\n\tvar lines []string\n\n\tfor _, line := range strings.Split(strings.TrimSpace(s), nl) {\n\t\tlines = append(lines, line)\n\t}\n\treturn lines\n}", "func SplitLines(lines []string) <-chan string {\n\toutput := make(chan string, 5)\n\tgo func() {\n\t\tdefer close(output)\n\t\tfor _, line := range lines {\n\t\t\tfor _, word := range strings.Split(line, \" \") {\n\t\t\t\toutput <- word\n\t\t\t}\n\t\t}\n\t}()\n\treturn output\n}", "func (p *Parser) Line() ([]value.Expr, bool) {\n\tvar ok bool\n\tif !p.readTokensToNewline() {\n\t\treturn nil, false\n\t}\n\ttok := p.peek()\n\tswitch tok.Type {\n\tcase scan.EOF:\n\t\treturn nil, true\n\tcase scan.RightParen:\n\t\tp.special()\n\t\tp.context.SetConstants()\n\t\treturn nil, true\n\tcase scan.Op:\n\t\tp.functionDefn()\n\t\treturn nil, true\n\tcase scan.OpDelete:\n\t\tp.functionDefn()\n\t\treturn nil, true\n\t}\n\texprs, ok := p.expressionList()\n\tif !ok {\n\t\treturn nil, false\n\t}\n\treturn exprs, true\n}", "func trimEOL(b []byte) []byte {\n lns := len(b)\n if lns > 0 && b[lns-1] == '\\n' {\n lns--\n if lns > 0 && b[lns-1] == '\\r' {\n lns--\n }\n }\n return b[:lns]\n}", "func (p *Parser) Line() ([]value.Expr, bool) {\n\ttok := p.peek()\n\tswitch tok.Type {\n\tcase token.RightParen:\n\t\t// TODO\n\t\treturn nil, true\n\tcase token.Op:\n\t\t// TODO\n\t\treturn nil, true\n\t}\n\t// TODO\n\n\texprs, ok := p.expressionList()\n\tif !ok {\n\t\treturn nil, false\n\t}\n\treturn exprs, true\n}", "func (r Ruler) LineSlice(start Point, end Point, l Line) Line {\n\tp1 := r.PointOnLine(l, start)\n\tp2 := r.PointOnLine(l, end)\n\n\tif p1.index > p2.index || (p1.index == p2.index && p1.t < p2.t) {\n\t\tp1, p2 = p2, p1\n\t}\n\n\tvar slice Line = []Point{p1.point}\n\n\tleft := p1.index + 1\n\tright := p2.index\n\n\tif l[left] != slice[0] && left <= right {\n\t\tslice = append(slice, l[left])\n\t}\n\n\tfor i := left + 1; i <= right; i++ {\n\t\tslice = append(slice, l[i])\n\t}\n\n\tif l[right] != p2.point {\n\t\tslice = append(slice, p2.point)\n\t}\n\n\treturn slice\n}", "func lines(a ...string) string {\n\treturn strings.Join(a, \"\\n\") + \"\\n\"\n}", "func GetLines(s string) []string {\n\treturn strings.Split(s, \"\\n\")\n}", "func GetLines(s string) []string {\n\treturn strings.Split(s, \" \")\n}", "func extractTableLines(b []byte) ([]charLine, error) {\n\tdoc, err := html.Parse(bytes.NewReader(b))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlines := make([]charLine, 0, 21800)\n\n\tvar f func(*html.Node)\n\tf = func(n *html.Node) {\n\t\tif n.Type == html.ElementNode && n.Data == \"pre\" {\n\t\t\ts := strings.Split(cleanNode(n), \"\\n\")\n\t\t\tif len(s) > 0 {\n\t\t\t\tlines = append(lines, stringsToCharLines(s)...)\n\t\t\t}\n\t\t}\n\t\tfor c := n.FirstChild; c != nil; c = c.NextSibling {\n\t\t\tf(c)\n\t\t}\n\t}\n\tf(doc)\n\treturn lines, nil\n}", "func ScanLFTerminatedLines(data []byte, atEOF bool) (advance int, token []byte, err error) {\n\tif atEOF && len(data) == 0 {\n\t\treturn 0, nil, nil\n\t}\n\tif i := bytes.IndexByte(data, '\\n'); i != -1 {\n\t\treturn i + 1, data[0:i], nil\n\t}\n\tif atEOF {\n\t\treturn len(data), data, nil\n\t}\n\treturn 0, nil, nil\n}", "func (cutr Cutter) Split(s []byte) ([]byte, []byte) {\n\tif ieol := cutr.nextEOL(s); ieol >= 0 {\n\t\treturn s[:ieol], s[ieol:]\n\t}\n\n\treturn nil, s\n}", "func getLines(input string) []string {\n\tlines := strings.Split(input, \"\\n\")\n\tfor i, l := range lines {\n\t\tl = strings.TrimSpace(l)\n\t\tif strings.HasPrefix(l, \"#\") {\n\t\t\tl = \"\"\n\t\t}\n\t\tlines[i] = l\n\t}\n\treturn lines\n}", "func (ctx *context) removeEmptyLines(result []byte) []byte {\n\tfor {\n\t\tnewResult := bytes.Replace(result, []byte{'\\n', '\\n', '\\n'}, []byte{'\\n', '\\n'}, -1)\n\t\tnewResult = bytes.Replace(newResult, []byte{'\\n', '\\n', '\\t'}, []byte{'\\n', '\\t'}, -1)\n\t\tnewResult = bytes.Replace(newResult, []byte{'\\n', '\\n', ' '}, []byte{'\\n', ' '}, -1)\n\t\tif len(newResult) == len(result) {\n\t\t\treturn result\n\t\t}\n\t\tresult = newResult\n\t}\n}", "func keepLines(s string, n int) string {\n result := strings.Join(strings.Split(s, \"\\n\")[:n], \"\\n\")\n return strings.Replace(result, \"\\r\", \"\", -1)\n}", "func Lines(abc *models.Art, b *models.Buf) (count int) {\n\ttext := false\n\tfor _, symbol := range abc.Text.Rune {\n\t\tif symbol == '\\n' {\n\t\t\tif text {\n\t\t\t\tcount += b.Height + 1 // with newline\n\t\t\t\ttext = false\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcount++\n\t\t} else {\n\t\t\ttext = true\n\t\t}\n\t}\n\treturn count\n}", "func SplitLineIntoParts(line string) []string {\n\tvar lineParts []string\n\tvar buffer string\n\tvar isSpace bool\n\tvar isTrailing bool\n\tvar haveHadCommand bool\n\n\tfor i, charRune := range line {\n\t\tchar := string(charRune)\n\n\t\tif i == 0 && char == \" \" {\n\t\t\tisSpace = true\n\t\t}\n\n\t\t// trailing behaviour\n\t\tif isTrailing {\n\t\t\tbuffer += char\n\t\t\tcontinue\n\t\t}\n\n\t\t// check for changes\n\t\tif isSpace && char != \" \" {\n\t\t\tisSpace = false\n\t\t\tlineParts = append(lineParts, buffer)\n\t\t\tbuffer = char\n\t\t\tif haveHadCommand && char == \":\" {\n\t\t\t\tisTrailing = true\n\t\t\t}\n\t\t\tcontinue\n\t\t} else if !isSpace && char == \" \" {\n\t\t\tisSpace = true\n\t\t\tlineParts = append(lineParts, buffer)\n\t\t\tif !haveHadCommand && buffer[0] != '@' && buffer[0] != ':' {\n\t\t\t\thaveHadCommand = true\n\t\t\t}\n\t\t\tbuffer = char\n\t\t\tcontinue\n\t\t}\n\n\t\t// no changes, just append\n\t\tbuffer += char\n\t}\n\tlineParts = append(lineParts, buffer)\n\n\treturn lineParts\n}", "func (i *Input) Lines() []string {\n\treturn i.lines\n}", "func ScanLines(data []byte, atEOF bool) (advance int, token []byte, err error) {\n\tif atEOF && len(data) == 0 {\n\t\treturn 0, nil, nil\n\t}\n\tif i := bytes.IndexByte(data, '\\n'); i >= 0 {\n\t\tj := i\n\t\tif i > 0 && data[i-1] == '\\r' {\n\t\t\tj = j - 1\n\t\t}\n\t\treturn i + 1, data[0:j], nil\n\t}\n\tif i := bytes.IndexByte(data, '\\r'); i >= 0 {\n\t\treturn i + 1, data[0:i], nil\n\t}\n\tif atEOF {\n\t\treturn len(data), data, nil\n\t}\n\treturn 0, nil, nil\n}", "func removeArmoringDelimiters(lines []string) []string {\n\treturn lines[4 : len(lines)-2]\n}", "func (b *Buffer) LineRunes(n int) []rune {\n\tif n >= len(b.lines) {\n\t\treturn []rune{}\n\t}\n\treturn toRunes(b.lines[n].data)\n}", "func SplitLine(s string) []string {\n\tn := (len(s) + 1) / 2\n\tlenSep := 1\n\tstart := 0\n\ta := make([]string, n)\n\tna := 0\n\tinString := 0\n\tescape := 0\n\tlastQuot := byte(0)\n\tfor i := 0; i+lenSep <= len(s) && na+1 < n; i++ {\n\t\t// consider \" xxx 'yyy' zzz\" as a single string\n\t\t// \" xxxx yyyy \" case, do not include \\\"\n\t\tif (s[i] == '\\'' || s[i] == '\"') && (inString%2 == 0 || lastQuot == s[i]) {\n\t\t\tinString++\n\t\t\tescape = 0\n\t\t\tlastQuot = s[i]\n\t\t} else {\n\t\t\tif !isSpace(s[i]) {\n\t\t\t\tescape = 0\n\t\t\t}\n\t\t}\n\t\tif inString%2 == 0 && isSpace(s[i]) {\n\t\t\tif start == i { //escape continuous space\n\t\t\t\tstart += lenSep\n\t\t\t} else {\n\t\t\t\ta[na] = s[start+escape : i-escape]\n\t\t\t\tna++\n\t\t\t\tstart = i + lenSep\n\t\t\t\ti += lenSep - 1\n\t\t\t}\n\t\t}\n\t}\n\tif start < len(s) {\n\t\ta[na] = s[start+escape : len(s)-escape]\n\t} else {\n\t\tna--\n\t}\n\n\treturn a[0 : na+1]\n}", "func NewNewlineSplitFunc(encoding encoding.Encoding) (bufio.SplitFunc, error) {\n\tnewline, err := encodedNewline(encoding)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcarriageReturn, err := encodedCarriageReturn(encoding)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn func(data []byte, atEOF bool) (advance int, token []byte, err error) {\n\t\tif atEOF && len(data) == 0 {\n\t\t\treturn 0, nil, nil\n\t\t}\n\n\t\tif i := bytes.Index(data, newline); i >= 0 {\n\t\t\t// We have a full newline-terminated line.\n\t\t\treturn i + len(newline), bytes.TrimSuffix(data[:i], carriageReturn), nil\n\t\t}\n\n\t\t// Request more data.\n\t\treturn 0, nil, nil\n\t}, nil\n}", "func StringToLines(s string) []string {\n\tlines := strings.Split(s, \"\\n\")\n\n\tfor i, line := range lines {\n\t\tn := len(line) - 1\n\t\tif n >= 0 {\n\t\t\tif line[n:] == \"\\r\" {\n\t\t\t\tlines[i] = line[:n]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn lines\n}", "func ScanLines(data []byte, atEOF bool) (advance int, token []byte, eol bool, err error) {\n\tif atEOF && len(data) == 0 {\n\t\treturn 0, nil, false, nil\n\t}\n\tif i := bytes.IndexByte(data, '\\n'); i >= 0 {\n\t\t// We have a full newline-terminated line.\n\t\treturn i + 1, dropCR(data[0:i]), true, nil\n\t}\n\t// If we're at EOF, we have a final, non-terminated line. Return it.\n\tif atEOF {\n\t\treturn len(data), dropCR(data), false, nil\n\t}\n\t// Request more data.\n\treturn 0, nil, false, nil\n}", "func annotateLines(text *string) []Annotation {\n\tpattern := regexp.MustCompile(\"\\\\A|\\n+|\\\\z\")\n\treturn annotateByDelimiter(LINE, pattern, text)\n}", "func splitPartitionLines(contents []string) []*Partition {\n\tmatch := regexp.MustCompile(\"^shell\\\\swrite\\\\spartition\\\\s.*\")\n\n\tpartitions := make([]*Partition, 0)\n\n\tfor _, v := range contents {\n\t\tr := match.FindString(v)\n\t\tif len(r) != 0 {\n\t\t\tarray := strings.Split(v, spaceSep)\n\t\t\tif len(array) != 4 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tsublines, err := getPartitionLines(array[3], contents)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"[INFO] get partition %s lines failed. error: %s\\n\", array[3], err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpartitions = append(partitions, &Partition{Name: array[3], Contents: sublines})\n\t\t}\n\t}\n\n\tif len(partitions) == 0 {\n\t\tpartitions = append(partitions, &Partition{Name: defaultPartitionName, Contents: contents})\n\t}\n\n\treturn partitions\n}", "func TestNewLines(t *testing.T) {\n\ttests := []struct {\n\t\ttoken token.Token\n\t\tliteral string\n\t\tline int\n\t}{\n\t\t{token.INT, \"100\", 1},\n\t\t{token.NEWLINE, \"NEWLINE\", 1},\n\t\t{token.LET, \"let\", 4},\n\t\t{token.IDVAL, \"hey\", 4},\n\t\t{token.ASSIGN, \"=\", 4},\n\t\t{token.INT, \"200\", 4},\n\t\t{token.NEWLINE, \"NEWLINE\", 4},\n\t\t{token.LET, \"let\", 5},\n\t\t{token.IDVAL, \"x\", 5},\n\t\t{token.ASSIGN, \"=\", 5},\n\t\t{token.INT, \"0xff\", 5},\n\t\t{token.GEQUALS, \">=\", 5},\n\t\t{token.INT, \"5000\", 5},\n\t\t{token.NEWLINE, \"NEWLINE\", 5},\n\t\t{token.STRING, \"bye\", 12},\n\t\t{token.EOF, \"EOF\", 12},\n\t}\n\tscanner := Init(`\n100\n\n# Hopefully the lines are now working.\nlet hey = 200\nlet x = 0xff >= 5000\n\n\n# we only want 1 NEWLINE to be seen just\n# after content and then ignore the rest.\n\n\n\"bye\"`)\n\tfor i, tt := range tests {\n\t\ttok, literal, lineno := scanner.NextToken()\n\t\tif tok != tt.token {\n\t\t\tt.Fatalf(\"test[%d] - Invalid Token. expected=%q, got=%q\",\n\t\t\t\ti, tt.token.String(), tok.String())\n\t\t}\n\t\tif literal != tt.literal {\n\t\t\tt.Fatalf(\"test[%d] - Invalid Literal. expected=%q, got=%q\",\n\t\t\t\ti, tt.literal, literal)\n\t\t}\n\t\tif lineno != tt.line {\n\t\t\tt.Fatalf(\"test[%d](%s) - Invalid line index. expected=%d, got=%d.\\n-> `%s`\",\n\t\t\t\ti, tt.literal, tt.line, lineno, literal)\n\t\t}\n\t}\n}", "func (ex *Extractor) getTextLines(text string) {\n\tvar reSpace = regexp.MustCompile(`\\s+`) // Spaces re\n\n\tlines := strings.Split(text, \"\\n\")\n\n\tfor _, line := range lines {\n\t\tif line != \"\" {\n\t\t\tline = reSpace.ReplaceAllString(line, \"\")\n\t\t\tex.textLines = append(ex.textLines, line)\n\t\t}\n\t}\n}", "func readLines(r io.Reader) ([]string, error) {\n\tlines := []string{}\n\tscanner := bufio.NewScanner(r)\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tline = removeComment(line, \"#\")\n\t\t// ignore empty lines\n\t\tif line == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tlines = append(lines, line)\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn lines, nil\n}", "func LinesParser(l *[]Line, ts TransitSource) error {\n\tlog.Printf(\"Parsing lines\")\n\tLinesIgnored = LoadIgnoreLineIds()\n\tloadLineNumberMapping()\n\tagencyLines, err := getAgencyLines(ts.Path, ts.Uri)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*l = *agencyLines\n\treturn nil\n}", "func Split(sep, operand string) []string { return strings.Split(operand, sep) }", "func LinesFromReader(r io.Reader) ([]string, error) {\n\tvar lines []string\n\tscanner := bufio.NewScanner(r)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn lines, nil\n}", "func ScanLines(data []byte, atEOF bool) (advance int, token []byte, err error) {\n\tif atEOF && len(data) == 0 {\n\t\treturn 0, nil, nil\n\t}\n\n\tif i := bytes.IndexByte(data, '\\n'); i >= 0 {\n\t\treturn i + 1, data[:i+1], nil\n\t}\n\tif i := bytes.IndexByte(data, '\\r'); i >= 0 {\n\t\treturn i + 1, data[:i+1], nil\n\t}\n\n\t// If we're at EOF, we have a final, non-terminated line. Return it.\n\tif atEOF {\n\t\treturn len(data), data, nil\n\t}\n\t// Request more data.\n\treturn 0, nil, nil\n}", "func GetLines(file *os.File, n int) ([]string, error) {\n\tvar lines []string\n\tvar part []byte\n\tvar prefix bool\n\tvar err error\n\treader := bufio.NewReader(file)\n\tbuffer := new(bytes.Buffer)\n\tfor n != len(lines) || n == 0 {\n\t\tif part, prefix, err = reader.ReadLine(); err != nil {\n\t\t\treturn lines, err\n\t\t}\n\t\tbuffer.Write(part)\n\t\tif !prefix {\n\t\t\tlines = append(lines, buffer.String())\n\t\t\tbuffer.Reset()\n\t\t}\n\t}\n\treturn lines, nil\n}", "func (v *VerbalExpression) LineBreak() *VerbalExpression {\n\treturn v.add(`(?:(?:\\n)|(?:\\r\\n))`)\n}", "func CRLF() operators.Operator {\n\treturn operators.Alts(\n\t\t\"CRLF\",\n\t\toperators.Concat(\n\t\t\t\"CR LF\",\n\t\t\tCR(),\n\t\t\tLF(),\n\t\t),\n\t\tLF(),\n\t)\n}", "func (lx *Lexer) lineTerminator(r rune) {\n\tif r == '\\n' {\n\t\tlx.pos.Column = 0\n\t\tlx.pos.Linum += 1\n\t\tlx.rawPos = lx.pos\n\t} else if r == '\\r' {\n\t\tn, _ := lx.nextChar()\n\t\tif n != '\\n' {\n\t\t\tpanic(lx.errf(\"Invalid line endings, expected to be LF or CRLF but only got CR.\"))\n\t\t} else {\n\t\t\t//recurse to increment line number\n\t\t\tlx.lineTerminator(n)\n\t\t}\n\t}\n}", "func (r *ride) unshiftLines() Line {\n\tline, lines := r.lines[0], r.lines[1:]\n\tr.lines = lines\n\treturn line\n}", "func (r Reply) Lines() []string {\n\tvar lines []string\n\n\tif len(r.lines) == 0 {\n\t\tl := strconv.Itoa(r.Status)\n\t\tlines = append(lines, l+\"\\n\")\n\t\treturn lines\n\t}\n\n\tfor i, line := range r.lines {\n\t\tl := \"\"\n\t\tif i == len(r.lines)-1 {\n\t\t\tl = strconv.Itoa(r.Status) + \" \" + line + \"\\r\\n\"\n\t\t} else {\n\t\t\tl = strconv.Itoa(r.Status) + \"-\" + line + \"\\r\\n\"\n\t\t}\n\t\tlines = append(lines, l)\n\t}\n\n\treturn lines\n}", "func (tb *TextBuf) BytesToLines() {\n\tif len(tb.Txt) == 0 {\n\t\ttb.New(1)\n\t\treturn\n\t}\n\ttb.LinesMu.Lock()\n\tlns := bytes.Split(tb.Txt, []byte(\"\\n\"))\n\ttb.NLines = len(lns)\n\tif len(lns[tb.NLines-1]) == 0 { // lines have lf at end typically\n\t\ttb.NLines--\n\t\tlns = lns[:tb.NLines]\n\t}\n\ttb.LinesMu.Unlock()\n\ttb.New(tb.NLines)\n\ttb.LinesMu.Lock()\n\tbo := 0\n\tfor ln, txt := range lns {\n\t\ttb.ByteOffs[ln] = bo\n\t\ttb.Lines[ln] = bytes.Runes(txt)\n\t\ttb.LineBytes[ln] = make([]byte, len(txt))\n\t\tcopy(tb.LineBytes[ln], txt)\n\t\ttb.Markup[ln] = HTMLEscapeBytes(tb.LineBytes[ln])\n\t\tbo += len(txt) + 1 // lf\n\t}\n\ttb.TotalBytes = bo\n\ttb.LinesMu.Unlock()\n}", "func Lines(r io.Reader, callback func(line string) error) (err error) {\n\tscanner := bufio.NewScanner(r)\n\tfor scanner.Scan() {\n\t\terr = callback(scanner.Text())\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn scanner.Err()\n}", "func getLines() ([]string, error) {\n\n\toutput, err := os.ReadFile(Path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read %s: %s\", Path, err)\n\t}\n\n\tlines := make([]string, 0)\n\n\tfor _, line := range strings.Split(string(output), \"\\n\") {\n\n\t\tswitch true {\n\t\tcase line == \"\":\n\t\t\tcontinue\n\t\tcase []byte(line)[0] == '#':\n\t\t\tcontinue\n\t\t}\n\n\t\tlines = append(lines, line)\n\t}\n\n\treturn lines, nil\n}", "func ScanLines(data []byte, atEOF bool) (advance int, token []byte, err error) {\n\tif atEOF && len(data) == 0 {\n\t\treturn 0, nil, nil\n\t}\n\n\tif i := bytes.IndexByte(data, '\\n'); i >= 0 {\n\t\t// We have a full newline-terminated line.\n\t\treturn i + 1, data[0 : i+1], nil\n\t}\n\t// If we're at EOF, we have a final, non-terminated line. Return it.\n\tif atEOF {\n\t\treturn len(data), data, nil\n\t}\n\t// Request more data.\n\treturn 0, nil, nil\n}", "func ScanLines(data []byte, atEOF bool) (advance int, token []byte, err error) {\n\tif atEOF && len(data) == 0 {\n\t\treturn 0, nil, nil\n\t}\n\tif i := bytes.IndexByte(data, '\\n'); i >= 0 {\n\t\t// We have a full newline-terminated line.\n\t\treturn i + 1, data[0 : i+1], nil\n\t}\n\t// If we're at EOF, we have a final, non-terminated line. Return it.\n\tif atEOF {\n\t\treturn len(data), data, nil\n\t}\n\t// Request more data.\n\treturn 0, nil, nil\n}", "func removeNewLines(raw []byte) []byte {\n\t// check if a `\\r` is present and save the position.\n\t// if no `\\r` is found, check if a `\\n` is present.\n\tfoundR := bytes.IndexByte(raw, rChar)\n\tfoundN := bytes.IndexByte(raw, nChar)\n\tstart := 0\n\n\tswitch {\n\tcase foundN != -1:\n\t\tif foundR > foundN {\n\t\t\tstart = foundN\n\t\t} else if foundR != -1 {\n\t\t\tstart = foundR\n\t\t}\n\tcase foundR != -1:\n\t\tstart = foundR\n\tdefault:\n\t\treturn raw\n\t}\n\n\tfor i := start; i < len(raw); i++ {\n\t\tswitch raw[i] {\n\t\tcase rChar, nChar:\n\t\t\traw[i] = ' '\n\t\tdefault:\n\t\t\tcontinue\n\t\t}\n\t}\n\treturn raw\n}", "func NewLineScanner(b []byte) func() ([]byte, int) {\n\tstart := -1\n\tend := -1\n\tmax := len(b)\n\treturn func() ([]byte, int) {\n\t\tend++\n\t\tif end >= max {\n\t\t\treturn nil, 0\n\t\t}\n\t\tfor start = end; end < max; end++ {\n\t\t\tif b[end] == nl { // look for newline char\n\t\t\t\treturn b[start:end], end - start\n\t\t\t}\n\t\t}\n\t\treturn b[start:max], max - start\n\t}\n}", "func (s *LogStore) toLogLines(options logOptions) []LogLine {\n\tresult := []LogLine{}\n\tvar lineBuilder *logLineBuilder\n\n\tvar consumeLineBuilder = func() {\n\t\tif lineBuilder == nil {\n\t\t\treturn\n\t\t}\n\t\tresult = append(result, lineBuilder.build(options)...)\n\t\tlineBuilder = nil\n\t}\n\n\t// We want to print the log line-by-line, but we don't actually store the logs\n\t// line-by-line. We store them as segments.\n\t//\n\t// This means we need to:\n\t// 1) At segment x,\n\t// 2) If x starts a new line, print it, then run ahead to print the rest of the line\n\t// until the entire line is consumed.\n\t// 3) If x does not start a new line, skip it, because we assume it was handled\n\t// in a previous line.\n\t//\n\t// This can have some O(n^2) perf characteristics in the worst case, but\n\t// for normal inputs should be fine.\n\tstartIndex, lastIndex := s.startAndLastIndices(options.spans)\n\tif startIndex == -1 {\n\t\treturn nil\n\t}\n\n\tisFirstLine := true\n\tfor i := startIndex; i <= lastIndex; i++ {\n\t\tsegment := s.segments[i]\n\t\tif !segment.StartsLine() {\n\t\t\tcontinue\n\t\t}\n\n\t\tspanID := segment.SpanID\n\t\tspan := s.spans[spanID]\n\t\tif _, ok := options.spans[spanID]; !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\t// If the last segment never completed, print a newline now, so that the\n\t\t// logs from different sources don't blend together.\n\t\tif lineBuilder != nil {\n\t\t\tlineBuilder.needsTrailingNewline = true\n\t\t\tconsumeLineBuilder()\n\t\t}\n\n\t\tlineBuilder = newLogLineBuilder(span, segment, isFirstLine)\n\t\tisFirstLine = false\n\n\t\t// If this segment is not complete, run ahead and try to complete it.\n\t\tif lineBuilder.isComplete() {\n\t\t\tconsumeLineBuilder()\n\t\t\tcontinue\n\t\t}\n\n\t\tfor currentIndex := i + 1; currentIndex <= span.LastSegmentIndex; currentIndex++ {\n\t\t\tcurrentSeg := s.segments[currentIndex]\n\t\t\tif currentSeg.SpanID != spanID {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif !currentSeg.CanContinueLine(lineBuilder.lastSegment()) {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tlineBuilder.addSegment(currentSeg)\n\t\t\tif lineBuilder.isComplete() {\n\t\t\t\tconsumeLineBuilder()\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tconsumeLineBuilder()\n\treturn result\n}", "func GetLines(start int64, lines int, fileName string) ([][]byte, int64, error) {\n\tvar output [][]byte\n\n\tfile, err := os.Open(fileName)\n\tdefer file.Close()\n\tif err != nil {\n\t\treturn output, start, err\n\t}\n\n\tif _, err := file.Seek(start, io.SeekStart); err != nil {\n\t\treturn output, start, err\n\t}\n\n\tscanner := bufio.NewScanner(file)\n\n\tvar offset int64 = 0\n\tfor i := 0; i < lines; i++ {\n\t\tif scanner.Scan() {\n\t\t\tbytes := scanner.Bytes()\n\t\t\toffset += int64(len(bytes) + 1) // 1 here is for the newline byte\n\t\t\toutput = append(output, bytes)\n\t\t} else if err := scanner.Err(); err != nil {\n\t\t\treturn [][]byte{}, offset, err\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn output, offset, nil\n}", "func splitLine(line string) {\n\t//token := strings.TrimSpace(line)\n\ttoken := line\n\ttoken1 := \"\"\n\tline1 := \"\"\n\tfor i := 0; i < len(token); i++ {\n\t\tif token[i] == ' ' || token[i] == '\t' {\n\t\t\tcontinue\n\t\t} else {\n\t\t\ttoken1 = token1 + string(token[i])\n\t\t}\n\t}\n\t//fmt.Println(token1)\n\tif len(token1) > 11 {\n\t\tif token1[:12] == \"//PROXYBEGIN\" {\n\t\t\tproxycounter = 0\n\t\t\tline1 = strings.TrimSpace(token[13:])\n\t\t\tfmt.Printf(\"%-28s\\t\", line1)\n\t\t\tfmt.Print(\"1\\t\\t\")\n\t\t}\n\t}\n\tif len(token1) > 9 {\n\t\tif token1[:10] == \"//PROXYEND\" {\n\t\t\tfmt.Println(proxycounter - 1)\n\t\t}\n\t}\n\n}", "func (s *Store) LineRange(ln, cnt int) ([]string, error) {\n\tif ln < 0 || ln+cnt >= len(s.lines) {\n\t\treturn nil, fmt.Errorf(\"LineRange: line %v out of range\", ln)\n\t}\n\tstrs := []string{}\n\tfor i := 0; i < cnt; i++ {\n\t\tstrs = append(strs, s.lines[ln+i].String())\n\t}\n\treturn strs, nil\n}", "func (r renderer) LineBreak(out *bytes.Buffer) {}", "func readLines(path string) ([]string, error) {\n\n\tcontent, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlines := strings.Split(string(content), \"\\n\\n\")\n\tfor i, line := range lines {\n\t\tlines[i] = strings.ReplaceAll(line, \"\\n\", \" \")\n\t\tlines[i] = strings.Trim(lines[i], \" \")\n\t}\n\treturn lines, nil\n}", "func (dialect *Dialect) Split(line string) (tokens []string) {\n\ttokens = make([]string, 0, 8)\n\n\tvar token []rune\n\tvar state = []rune{' '}\n\n\tfor r, w := utf8.DecodeRuneInString(line); 0 != w; {\n\t\tline = line[w:]\n\t\tr0, w0 := utf8.DecodeRuneInString(line)\n\n\t\ts := state[len(state)-1]\n\t\tvar e rune\n\t\tif 0 != w0 {\n\t\t\te = dialect.Escape(s, r, r0)\n\t\t} else {\n\t\t\te = dialect.Escape(s, r, EmptyRune)\n\t\t}\n\t\tif NoEscape != e {\n\t\t\tif 0 != w0 {\n\t\t\t\tline = line[w0:]\n\t\t\t\tr0, w0 = utf8.DecodeRuneInString(line)\n\t\t\t}\n\t\t\tif EmptyRune == e {\n\t\t\t\tr, w = r0, w0\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tswitch s {\n\t\tcase Space:\n\t\t\tswitch {\n\t\t\tcase NoEscape != e:\n\t\t\t\tstate = append(state, Word)\n\t\t\t\ttoken = append(token, e)\n\t\t\tcase dialect.IsQuote(r):\n\t\t\t\tstate = append(state, Word, r)\n\t\t\t\ttoken = make([]rune, 0)\n\t\t\tcase !dialect.IsSpace(r):\n\t\t\t\tstate = append(state, Word)\n\t\t\t\ttoken = append(token, r)\n\t\t\t}\n\t\tcase Word:\n\t\t\tswitch {\n\t\t\tcase NoEscape != e:\n\t\t\t\ttoken = append(token, e)\n\t\t\tcase dialect.IsQuote(r):\n\t\t\t\tstate = append(state, r)\n\t\t\tcase dialect.IsSpace(r):\n\t\t\t\tstate = state[:len(state)-1]\n\t\t\t\ttokens = append(tokens, string(token))\n\t\t\t\ttoken = nil\n\t\t\tdefault:\n\t\t\t\ttoken = append(token, r)\n\t\t\t}\n\t\tdefault: // quote\n\t\t\tswitch {\n\t\t\tcase NoEscape != e:\n\t\t\t\ttoken = append(token, e)\n\t\t\tcase s == r:\n\t\t\t\tstate = state[:len(state)-1]\n\t\t\tdefault:\n\t\t\t\ttoken = append(token, r)\n\t\t\t}\n\t\t}\n\n\t\tif NoEscape == e && nil != dialect.LongEscape {\n\t\t\tif er, line1, r1, w1 := dialect.LongEscape(s, r, line); nil != er {\n\t\t\t\ttoken = append(token, er...)\n\t\t\t\tline = line1\n\t\t\t\tr0 = r1\n\t\t\t\tw0 = w1\n\t\t\t}\n\t\t}\n\n\t\tr, w = r0, w0\n\t}\n\n\tif nil != token {\n\t\ttokens = append(tokens, string(token))\n\t}\n\n\treturn\n}", "func NextRunesLine() []rune {\n\treturn []rune(NextLine())\n}", "func NewMultiLineParser(flushTimeout time.Duration, parser parser.Parser, lineHandler LineHandler, lineLimit int) *MultiLineParser {\n\treturn &MultiLineParser{\n\t\tinputChan: make(chan *DecodedInput),\n\t\tbuffer: bytes.NewBuffer(nil),\n\t\tflushTimeout: flushTimeout,\n\t\tlineHandler: lineHandler,\n\t\tlineLimit: lineLimit,\n\t\tparser: parser,\n\t}\n}", "func ParseLines(parser Parser, r io.Reader, storer storage.Storer, rawFlag bool, flushFlag bool, noCleanFlag bool) (err error) {\n\tscanner := bufio.NewScanner(r)\n\tfor scanner.Scan() {\n\t\tb := scanner.Bytes()\n\t\tn := len(b)\n\t\tif !noCleanFlag {\n\t\t\t// Remove unwanted ASCII characters\n\t\t\tn = Whitelist(b, n)\n\t\t}\n\t\tline := string(b[:n])\n\n\t\tif rawFlag {\n\t\t\t// Save raw text for each line\n\t\t\terr = storer.WriteString(RawName, line+\"\\n\")\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error writing unparsed text: %v\", err)\n\t\t\t}\n\t\t}\n\n\t\td := parser.ParseLine(line)\n\t\tfor _, err := range d.Errors {\n\t\t\tlog.Printf(\"%v\", err)\n\t\t}\n\t\tif d.OK() {\n\t\t\t// Save data if properly parsed and not throttled\n\t\t\terr = storer.WriteString(UnderwayName, d.Line(\"\\t\")+\"\\n\")\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error writing parsed data: %v\", err)\n\t\t\t}\n\t\t}\n\n\t\tif flushFlag {\n\t\t\terr = storer.Flush()\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error flushing data: %v\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\tif err := scanner.Err(); err != nil {\n\t\treturn fmt.Errorf(\"error reading lines: %v\", err)\n\t}\n\treturn nil\n}", "func readLastLines(ctx context.Context, file *os.File, endCursor int64) ([]string, int, error) {\n\tvar lines []byte\n\tvar firstNonNewlinePos int\n\tvar cursor = endCursor\n\tvar size int64 = 256\n\tfor {\n\t\t// stop if we are at the begining\n\t\t// check it in the start to avoid read beyond the size\n\t\tif cursor <= 0 {\n\t\t\tbreak\n\t\t}\n\n\t\t// enlarge the read cache to avoid too many memory move.\n\t\tsize = size * 2\n\t\tif size > maxReadCacheSize {\n\t\t\tsize = maxReadCacheSize\n\t\t}\n\t\tif cursor < size {\n\t\t\tsize = cursor\n\t\t}\n\t\tcursor -= size\n\n\t\t_, err := file.Seek(cursor, io.SeekStart)\n\t\tif err != nil {\n\t\t\treturn nil, 0, ctx.Err()\n\t\t}\n\t\tchars := make([]byte, size)\n\t\t_, err = file.Read(chars)\n\t\tif err != nil {\n\t\t\treturn nil, 0, ctx.Err()\n\t\t}\n\t\tlines = append(chars, lines...)\n\n\t\t// find first '\\n' or '\\r'\n\t\tfor i := 0; i < len(chars)-1; i++ {\n\t\t\t// reach the line end\n\t\t\t// the first newline may be in the line end at the first round\n\t\t\tif i >= len(lines)-1 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif (chars[i] == 10 || chars[i] == 13) && chars[i+1] != 10 && chars[i+1] != 13 {\n\t\t\t\tfirstNonNewlinePos = i + 1\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif firstNonNewlinePos > 0 {\n\t\t\tbreak\n\t\t}\n\t\tif isCtxDone(ctx) {\n\t\t\treturn nil, 0, ctx.Err()\n\t\t}\n\t}\n\tfinalStr := string(lines[firstNonNewlinePos:])\n\treturn strings.Split(strings.ReplaceAll(finalStr, \"\\r\\n\", \"\\n\"), \"\\n\"), len(finalStr), nil\n}", "func (v *VerbalExpression) EndOfLine() *VerbalExpression {\n\tif !strings.HasSuffix(v.suffixes, \"$\") {\n\t\tv.suffixes += \"$\"\n\t}\n\treturn v\n}", "func SplitLinesAndRemoveComments(source string) ([]string, []string) {\n\tverbatim := strings.Split(source, \"\\n\")\n\tnoComments := stripBlockComments(verbatim)\n\tnoComments = stripCommentedOutLines(noComments)\n\treturn verbatim, noComments\n}", "func parseLines(lines [][]string) []problem {\n\tret := make([]problem, len(lines))\n\tfor i, line := range lines {\n\t\tret[i] = problem{\n\t\t\tq: line[0],\n\t\t\ta: strings.TrimSpace(line[1]),\n\t\t}\n\t}\n\treturn ret\n}", "func cutNewLines(s string) string {\n\tr := strings.SplitN(s, \"\\r\", 2)\n\tr = strings.SplitN(r[0], \"\\n\", 2)\n\treturn r[0]\n}", "func delimiterForEveryLine(text string, delimiter string) string {\n\tlines := strings.Split(text, \"\\n\")\n\n\tfor i, line := range lines {\n\t\tline = strings.TrimSpace(line)\n\t\tif line == \"\" {\n\t\t\t// Skip empty lines\n\t\t\tcontinue\n\t\t}\n\n\t\tlines[i] = delimiter + line + delimiter\n\t}\n\treturn strings.Join(lines, \"\\n\")\n}", "func LineEdits(before string, edits []TextEdit) []TextEdit {\n\tif len(edits) == 0 {\n\t\treturn nil\n\t}\n\tc, edits, partial := prepareEdits(before, edits)\n\tif partial {\n\t\tedits = lineEdits(before, c, edits)\n\t}\n\treturn edits\n}", "func Decode_Line(geom []uint32) [][][]int {\n\tpos := 0\n\tcurrentpt := []int{0, 0}\n\tnewline := [][]int{}\n\tlines := [][][]int{}\n\tfor pos < len(geom) {\n\t\tgeomval := geom[pos]\n\n\t\tcmd, length := Get_Command_Length(geomval)\n\n\t\t// conde for a move to cmd\n\t\tif cmd == 1 {\n\t\t\txdelta := DecodeDelta(geom[pos+1])\n\t\t\tydelta := DecodeDelta(geom[pos+2])\n\t\t\tcurrentpt = []int{currentpt[0] + xdelta, currentpt[1] + ydelta}\n\t\t\tpos += 2\n\n\t\t\tif pos == len(geom)-1 {\n\t\t\t\tlines = append(lines, [][]int{currentpt})\n\t\t\t}\n\t\t} else if cmd == 2 {\n\t\t\tnewline = [][]int{currentpt}\n\t\t\tcurrentpos := pos + 1\n\t\t\tendpos := currentpos + int(length*2)\n\t\t\tfor currentpos < endpos {\n\t\t\t\txdelta := DecodeDelta(geom[currentpos])\n\t\t\t\tydelta := DecodeDelta(geom[currentpos+1])\n\t\t\t\tcurrentpt = []int{currentpt[0] + xdelta, currentpt[1] + ydelta}\n\t\t\t\tnewline = append(newline, currentpt)\n\t\t\t\tcurrentpos += 2\n\t\t\t}\n\n\t\t\tpos = currentpos - 1\n\t\t\tlines = append(lines, newline)\n\n\t\t}\n\t\tnewline = [][]int{}\n\t\t//fmt.Println(cmd,length)\n\t\tpos += 1\n\t}\n\treturn lines\n}", "func (l LogItems) Lines() []string {\n\tll := make([]string, len(l))\n\tfor i, item := range l {\n\t\tll[i] = string(item.Render(0, false))\n\t}\n\n\treturn ll\n}", "func (g *GDB) stdoutLines() []string {\n\tresult := g.consumeLines(g.stdout, defaultWait)\n\tfor i, l := range result {\n\t\tresult[i] = strings.Replace(l, \"(gdb) \", \"\", 1)\n\t}\n\treturn result\n}", "func EqualLines(tb testing.TB, exp, act string) {\n\n\t// remove windows line endings\n\t//exp0 := strings.ReplaceAll(exp, \"\\r\", \"\")\n\t//act0 := strings.ReplaceAll(act, \"\\r\", \"\")\n\t//exp1 := strings.ReplaceAll(exp0, \"\\t\", \" \")\n\t//act1 := strings.ReplaceAll(act0, \"\\t\", \" \")\n\t//exp2 := strings.ReplaceAll(exp1, \" \", \" \")\n\t//act2 := strings.ReplaceAll(act1, \" \", \" \")\n\n\texpS := strings.Split(exp, \"\\n\")\n\tactS := strings.Split(act, \"\\n\")\n\n\t//fmt.Println(\"lines:\", len(expS), len(actS))\n\t//assert.True(tb, len(expS) == len(actS))\n\n\t//if len(expS) != len(actS) {\n\t//\ttb.Fail()\n\t//\treturn\n\t//}\n\tfor i := range actS {\n\t\te := standardizeSpaces(expS[i])\n\t\ta := standardizeSpaces(actS[i])\n\t\tif e != a {\n\t\t\tfmt.Println(i, \"expLine:\"+e)\n\t\t\tfmt.Println(i, \"actLine:\"+a)\n\t\t\tfmt.Println(i, \"expLine:\"+expS[i])\n\t\t\tfmt.Println(i, \"actLine:\"+actS[i])\n\t\t\ttb.Fail()\n\t\t\treturn\n\t\t}\n\t}\n}", "func ReadLines(scanner *bufio.Scanner, numOfLines int) (lines []string, err error) {\n i := 0\n for scanner.Scan() {\n i++\n if i <= numOfLines {\n lines = append(lines, scanner.Text())\n if i == numOfLines {\n return lines, scanner.Err()\n }\n }\n }\n\n return lines, io.EOF\n}" ]
[ "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.5569378", "0.5538619", "0.5511614", "0.5494068", "0.54709744", "0.5457459", "0.5456802", "0.54436636", "0.5441131", "0.5432833", "0.5422469", "0.54063696", "0.5394241", "0.53831077", "0.5375147", "0.5360543", "0.535919", "0.5355626", "0.52688545", "0.52581006", "0.5239824", "0.5234746", "0.52265185", "0.52143735", "0.521262", "0.5190648", "0.51725453", "0.5167503", "0.5165874", "0.5146474", "0.512507", "0.5115855", "0.5101272", "0.5091779", "0.5091419", "0.5086448", "0.508563", "0.5082895", "0.5063603", "0.50605613", "0.50581086", "0.5053196", "0.50407046", "0.5034902", "0.5030885", "0.50229543", "0.5021232", "0.5020604", "0.5017234", "0.5014417", "0.50013506", "0.49900332", "0.49898648", "0.4986008", "0.4973811", "0.4972711", "0.49645844", "0.49574748", "0.4957416", "0.49527273", "0.4949339", "0.49425784", "0.49394703", "0.49371266", "0.49335277", "0.49253723", "0.49228266", "0.49214795", "0.491781", "0.49156952", "0.49084204", "0.49060035", "0.49049532", "0.49029112", "0.49019533", "0.49010152", "0.4900827", "0.48973733", "0.4889935" ]
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 string(q)\n\t} else if cp {\n\t\tb = append([]byte(nil), b...)\n\t}\n\treturn NewLiteral(b)\n}", "func Quote(str string) string {\n\t// empty string gets special treatment\n\tif str == \"\" {\n\t\treturn \"''\"\n\t}\n\n\t// if there are no unsafe characters, no quoting is required\n\tif unsafe.FindStringIndex(str) == nil {\n\t\treturn str\n\t}\n\n\t// use single quotes, and double-quote embedded single quotes\n\treturn \"'\" + strings.Replace(str, \"'\", \"'\\\"'\\\"'\", -1) + \"'\"\n}", "func Unquote(operand string) (unquoted string, err error) { return strconv.Unquote(operand) }", "func (n NamespaceStar) Quote() string { return `'` + n.Value() + `'` }", "func Quote(s string) Node {\n\tends := `\"`\n\tswitch {\n\tcase !strings.Contains(s, `\"`):\n\t\tends = `\"`\n\tcase !strings.Contains(s, `'`):\n\t\tends = `'`\n\tcase !strings.Contains(s, \"`\"):\n\t\tends = \"`\"\n\tdefault:\n\t\ts = strings.ReplaceAll(s, `\"`, `\\\"`)\n\t}\n\n\treturn Node{ast.Quote{Val: ends + s + ends}}\n}", "func (iop *internalOp) Quote(el Element, env *Environment) Element {\n\t// TODO is env needed for internal ops?\n\tif iop.quoter == nil {\n\t\tif el.IsAtom() {\n\t\t\treturn Elem(Cons(Atomize(iop), Cons(el.AsAtom(), nil)))\n\t\t}\n\t\treturn Elem(Cons(Atomize(iop), el.AsList()))\n\t}\n\treturn iop.quoter(el)\n}", "func (n NamespaceNode) Quote() string { return `'` + n.Value() + `'` }", "func Quote(id string) string {\n\treturn fmt.Sprintf(`\"%s\"`, strings.Replace(id, `\"`, `\\\"`, -1))\n}", "func (c *Conn) Quote(str string) string {\n\tvar res, sep string\n\tvar spl []string\n\tif strings.Contains(str, \",\") {\n\t\tsep = \", \"\n\t\tspl = strings.Split(str, \",\")\n\t} else if strings.Contains(str, \".\") {\n\t\tsep = \".\"\n\t\tspl = strings.Split(str, \".\")\n\t} else {\n\t\treturn \"`\" + str + \"`\"\n\t}\n\tfor _, item := range spl {\n\t\tif len(res) > 0 {\n\t\t\tres += sep\n\t\t}\n\t\tres += \"`\" + strings.TrimSpace(item) + \"`\"\n\t}\n\treturn res\n}", "func (p *Parser) quote() *Expr {\n\treturn Cons(atomExpr(tokQuote), Cons(p.List(), nil))\n}", "func lexOpQuoted(l *lexer) lexFn {\n\tomitSpaces(l)\n\n\tl.acceptRun(_OpValueRunes)\n\tl.emit(OPV_QUOTED)\n\n\treturn lexText\n}", "func (n NamespaceTrace) Quote() string { return `'` + n.Value() + `'` }", "func Quote(s string) string {\n var n int\n var p []byte\n\n /* check for empty string */\n if s == \"\" {\n return `\"\"`\n }\n\n /* allocate space for result */\n n = len(s) + 2\n p = make([]byte, 0, n)\n\n /* call the encoder */\n _ = encodeString(&p, s)\n return rt.Mem2Str(p)\n}", "func quote(str string, quote byte) string {\n\tif strings.IndexByte(str, '\\n') < 0 {\n\t\tbuf := []byte{quote}\n\t\tbuf = appendEscaped(buf, str, quote, true)\n\t\tbuf = append(buf, quote)\n\t\treturn string(buf)\n\t}\n\tbuf := []byte{quote, quote, quote}\n\tbuf = append(buf, multiSep...)\n\tbuf = appendEscapeMulti(buf, str, quote)\n\tbuf = append(buf, quote, quote, quote)\n\treturn string(buf)\n}", "func Quote(s string) []byte {\n\treturn appendQuote(nil, s, false)\n}", "func quote(s string) string {\n\tif s == \"\" {\n\t\treturn \"''\"\n\t}\n\tif !needsQuote(s) {\n\t\treturn s\n\t}\n\tvar b strings.Builder\n\tb.Grow(10 + len(s)) // Enough room for few quotes\n\tb.WriteByte(quoteChar)\n\tfor i := 0; i < len(s); i++ {\n\t\tc := s[i]\n\t\tif c == quoteChar {\n\t\t\tb.WriteByte(quoteChar)\n\t\t}\n\t\tb.WriteByte(c)\n\t}\n\tb.WriteByte(quoteChar)\n\treturn b.String()\n}", "func QuoteRegex(operand string) string { return regexp.QuoteMeta(operand) }", "func QuoteRune(r rune) string {}", "func (self *T) mQUOTE() {\r\n \r\n \r\n\t\t_type := T_QUOTE\r\n\t\t_channel := antlr3rt.DEFAULT_TOKEN_CHANNEL\r\n\t\t// C:/dev/antlr.github/antlr/runtime/Go/antlr/test/T.g:11:6: ( '\\\"' )\r\n\t\t// C:/dev/antlr.github/antlr/runtime/Go/antlr/test/T.g:11:9: '\\\"'\r\n\t\t{\r\n\t\tself.MatchChar('\"') \r\n\r\n\r\n\t\t}\r\n\r\n\t\tself.State().SetType( _type )\r\n\t\tself.State().SetChannel( _channel )\r\n}", "func quote(s string) string {\n\tquoted := strings.Builder{}\n\tquoted.WriteRune('\"')\n\tfor _, c := range s {\n\t\tif strings.ContainsRune(charsToQuote, c) {\n\t\t\tquoted.WriteRune('\\\\')\n\t\t}\n\t\tquoted.WriteRune(c)\n\t}\n\tquoted.WriteRune('\"')\n\treturn quoted.String()\n}", "func quote(s string) string {\n\treturn regexp.QuoteMeta(s)\n}", "func WriteQuote(w bfr.B, text string) {\n\tw.WriteByte('\\'')\n\tw.WriteString(strings.Replace(text, \"'\", \"''\", -1))\n\tw.WriteByte('\\'')\n}", "func Quote(b []byte, mark byte) []byte {\n\tfor i, j := 0, len(b); i < j; i++ {\n\t\tif b[i] == mark || b[i] == '\\\\' {\n\t\t\tb = append(b, 0)\n\t\t\tcopy(b[i+1:], b[i:])\n\t\t\tb[i] = '\\\\'\n\t\t\ti++\n\t\t\tj++\n\t\t}\n\t}\n\tb = append(b, 0, 0)\n\tcopy(b[1:], b)\n\tb[0] = mark\n\tb[len(b)-1] = mark\n\treturn b\n}", "func (o JobLoadOutput) Quote() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v JobLoad) *string { return v.Quote }).(pulumi.StringPtrOutput)\n}", "func lexQuote(l *lexer) stateFn {\nLoop:\n\tfor {\n\t\tswitch l.next() {\n\t\tcase '\\\\':\n\t\t\tif r := l.next(); r != eof && r != '\\n' {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfallthrough\n\t\tcase eof, '\\n':\n\t\t\treturn l.errorf(\"unterminated quoted string\")\n\t\tcase '\"':\n\t\t\tbreak Loop\n\t\t}\n\t}\n\tl.emit(itemString)\n\treturn lexInsideAction\n}", "func quoteStr(name string) string {\n\treturn \"'\" + strings.ReplaceAll(name, \"'\", \"''\") + \"'\"\n}", "func escapeQuotes(s string) string {\n\treturn quoteEscaper.Replace(s)\n}", "func escapeQuotes(s string) string {\n\treturn quoteEscaper.Replace(s)\n}", "func (c *Core) QuoteString(s string) string {\n\tcharLeft, charRight := c.db.GetChars()\n\treturn doQuoteString(s, charLeft, charRight)\n}", "func (o JobLoadPtrOutput) Quote() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *JobLoad) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Quote\n\t}).(pulumi.StringPtrOutput)\n}", "func Quote(l *Lexer, t ItemType, emit bool) (success bool) {\n\tr := l.Next()\n\tif r != '\"' {\n\t\tl.Errorf(\"expected '\\\"', got %q\", r)\n\t\tl.Backup()\n\t\treturn false\n\t}\n\tfor {\n\t\tswitch l.Next() {\n\t\tcase '\\\\':\n\t\t\tl.Next()\n\t\tcase '\\n':\n\t\t\tl.Errorf(\"unterminated quote\")\n\t\t\tl.Backup()\n\t\t\treturn false\n\t\tcase EOF:\n\t\t\tl.Errorf(\"unterminated quote\")\n\t\t\treturn false\n\t\tcase '\"':\n\t\t\tif emit {\n\t\t\t\tl.Emit(t)\n\t\t\t} else {\n\t\t\t\tl.Skip()\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t}\n}", "func QuoteString(str string) string {\n\treturn \"'\" + strings.Replace(str, \"'\", \"''\", -1) + \"'\"\n}", "func (d *dbBasePostgres) TableQuote() string {\n\treturn `\"`\n}", "func quoteChar(c byte) string {\n\t// special cases - different from quoted strings\n\tif c == '\\'' {\n\t\treturn `'\\''`\n\t}\n\tif c == '\"' {\n\t\treturn `'\"'`\n\t}\n\t// use quoted string with different quotation marks\n\ts := strconv.Quote(string(c))\n\treturn \"'\" + s[1:len(s)-1] + \"'\"\n}", "func LiteralQuoteEscape(quote rune, literal string) string {\n\tif len(literal) > 1 {\n\t\tquoteb := byte(quote)\n\t\tif literal[0] == quoteb && literal[len(literal)-1] == quoteb {\n\t\t\t// Already escaped??\n\t\t\treturn literal\n\t\t}\n\t}\n\tvar buf bytes.Buffer\n\tLiteralQuoteEscapeBuf(&buf, quote, literal)\n\treturn buf.String()\n}", "func (p *Parser) lexQuote(l *lex.Lexer) lex.StateFn {\n\t// lexQuote is called for ', \", and `.\n\tif l.Next() != '\"' {\n\t\treturn l.Errorf(\"only support double-quoted strings\")\n\t}\n\tl.Ignore()\n\nloop:\n\tfor {\n\t\tswitch l.Next() {\n\t\tcase '\\\\':\n\t\t\tif r := l.Next(); r != lex.EOF && r != '\\n' {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfallthrough\n\t\tcase lex.EOF, '\\n':\n\t\t\treturn l.Errorf(\"unterminated quoted string\")\n\t\tcase '\"':\n\t\t\tbreak loop\n\t\t}\n\t}\n\tl.Dec(1)\n\tl.Emit(typeString)\n\tl.Inc(1)\n\tl.Ignore()\n\treturn p.lexInsideAction\n}", "func (p *Lexer) Quoted(ind int) (string, bool, error) {\n\n\tc1, _ := p.Byte()\n\tif c1 != '\"' && c1 != '\\'' && c1 != '`' {\n\t\tp.UnreadByte()\n\t\treturn \"\", false, nil\n\t}\n\n\tvar buf []byte\n\tvar c2 byte\n\n\tfor {\n\t\tc, _ := p.Byte()\n\t\tif IsEndChar(c) {\n\t\t\treturn \"\", false, ErrUnterminatedQuotedString\n\t\t}\n\n\t\tif c == c1 && c1 == '`' {\n\t\t\tbreak\n\t\t}\n\n\t\tif c == c1 && c2 != '\\\\' {\n\t\t\tbreak\n\t\t}\n\n\t\tif c1 != '`' {\n\t\t\tif c == '\\\\' {\n\t\t\t\tc2 = c\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// \\\" -> \"\n\t\t\t// \\' -> '\n\t\t\tif c2 == '\\\\' && !(c != '\\'' || c == '\"') {\n\t\t\t\tbuf = append(buf, '\\\\')\n\t\t\t}\n\t\t}\n\n\t\tbuf = append(buf, c)\n\n\t\tif c == 10 {\n\t\t\tn, u := p.Space()\n\t\t\tif u == 0 {\n\t\t\t\treturn \"\", false, ErrSpaceNotUniform\n\t\t\t}\n\t\t\t// There are n spaces. Skip lnl spaces and add rest.\n\t\t\tfor ; n-ind > 0; n-- {\n\t\t\t\tbuf = append(buf, u)\n\t\t\t}\n\t\t}\n\t\tc2 = c\n\t}\n\n\treturn string(buf), true, nil\n}", "func AppendQuote(dest []byte, s string) []byte {\n\treturn appendQuote(dest, s, false)\n}", "func (this *JsonWriter) Quoted(v []byte) *JsonWriter { // {{{\n\treturn this.writeByte('\"').escape(v).writeByte('\"')\n}", "func quoted(s string) string {\n\tswitch strings.ToLower(s) {\n\tcase \"true\":\n\t\treturn \"True\"\n\tcase \"false\":\n\t\treturn \"False\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"'%s'\", s)\n\t}\n}", "func Quote(rw io.ReadWriter, handle tpmutil.Handle, data []byte, pcrNums []int, aikAuth []byte) ([]byte, []byte, error) {\n\t// Run OSAP for the handle, reading a random OddOSAP for our initial\n\t// command and getting back a secret and a response.\n\tsharedSecret, osapr, err := newOSAPSession(rw, etKeyHandle, handle, aikAuth)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tdefer osapr.Close(rw)\n\tdefer zeroBytes(sharedSecret[:])\n\n\t// Hash the data to get the value to pass to quote2.\n\thash := sha1.Sum(data)\n\tpcrSel, err := newPCRSelection(pcrNums)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tauthIn := []interface{}{ordQuote, hash, pcrSel}\n\tca, err := newCommandAuth(osapr.AuthHandle, osapr.NonceEven, nil, sharedSecret[:], authIn)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tpcrc, sig, ra, ret, err := quote(rw, handle, hash, pcrSel, ca)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// Check response authentication.\n\traIn := []interface{}{ret, ordQuote, pcrc, tpmutil.U32Bytes(sig)}\n\tif err := ra.verify(ca.NonceOdd, sharedSecret[:], raIn); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn sig, pcrc.Values, nil\n}", "func lexQuote(l *lexer) stateFn {\nLoop:\n\tfor {\n\t\tswitch l.next() {\n\t\tcase '\\\\':\n\t\t\tif r := l.next(); r != token.Eof && r != '\\n' {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfallthrough\n\t\tcase token.Eof, '\\n':\n\t\t\treturn l.errorf(\"unterminated quoted string\")\n\t\tcase '\"':\n\t\t\tbreak Loop\n\t\t}\n\t}\n\tl.emit(token.ItemString)\n\treturn lexInsideList\n}", "func ShellQuote(s string) string {\n\tif len(s) > 0 && !strings.ContainsAny(s, shellmeta) {\n\t\treturn s // fast path for common case\n\t}\n\tdouble := strings.Contains(s, \"\\\"\")\n\tsingle := strings.Contains(s, \"'\")\n\tif double && single {\n\t\tif shellreplacer == nil {\n\t\t\tpairs := make([]string, len(shellmeta)*2)\n\t\t\tfor i := 0; i < len(shellmeta); i++ {\n\t\t\t\tpairs[i*2] = string(shellmeta[i])\n\t\t\t\tpairs[i*2+1] = \"\\\\\" + string(shellmeta[i])\n\t\t\t}\n\t\t\tshellreplacer = strings.NewReplacer(pairs...)\n\t\t}\n\t\treturn shellreplacer.Replace(s)\n\t} else if single {\n\t\t// use double quotes, but be careful of $\n\t\treturn \"\\\"\" + strings.Replace(s, \"$\", \"\\\\$\", -1) + \"\\\"\"\n\t} else {\n\t\t// use single quotes\n\t\treturn \"'\" + s + \"'\"\n\t}\n\tpanic(\"unreachable code\")\n}", "func (_RouterV2 *RouterV2Caller) Quote(opts *bind.CallOpts, amountA *big.Int, reserveA *big.Int, reserveB *big.Int) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _RouterV2.contract.Call(opts, &out, \"quote\", amountA, reserveA, reserveB)\n\n\tif err != nil {\n\t\treturn *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\n\n\treturn out0, err\n\n}", "func quote(dest *bytes.Buffer, bs []byte) {\n\tdest.WriteByte('\"')\n\tfor _, b := range bs {\n\t\tif b == '\\n' {\n\t\t\tdest.WriteString(`\\n`)\n\t\t\tcontinue\n\t\t}\n\t\tif b == '\\\\' {\n\t\t\tdest.WriteString(`\\\\`)\n\t\t\tcontinue\n\t\t}\n\t\tif b == '\"' {\n\t\t\tdest.WriteString(`\\\"`)\n\t\t\tcontinue\n\t\t}\n\t\tif (b >= 32 && b <= 126) || b == '\\t' {\n\t\t\tdest.WriteByte(b)\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Fprintf(dest, \"\\\\x%02x\", b)\n\t}\n\tdest.WriteByte('\"')\n}", "func (o TableExternalDataConfigurationCsvOptionsOutput) Quote() pulumi.StringOutput {\n\treturn o.ApplyT(func(v TableExternalDataConfigurationCsvOptions) string { return v.Quote }).(pulumi.StringOutput)\n}", "func quote(key string) string {\n\t// strconv.Quote does not quote an empty string so we need this.\n\tif key == \"\" {\n\t\treturn `\"\"`\n\t}\n\n\t// Replace spaces in the map keys with underscores.\n\tkey = strings.ReplaceAll(key, \" \", \"_\")\n\n\tquoted := strconv.Quote(key)\n\t// If the key doesn't need to be quoted, don't quote it.\n\t// We do not use strconv.CanBackquote because it doesn't\n\t// account tabs.\n\tif quoted[1:len(quoted)-1] == key {\n\t\treturn key\n\t}\n\treturn quoted\n}", "func sqlQuote(x interface{}) string {\n\tswitch x := x.(type) {\n\tcase nil:\n\t\treturn \"NULL\"\n\tcase int, uint:\n\t\treturn fmt.Sprintf(\"%d\", x) // X has type interface{}.\n\tcase bool:\n\t\tif x {\n\t\t\treturn \"TRUE\"\n\t\t}\n\t\treturn \"FALSE\"\n\t// string and other types ...\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unexpected type %T: %v\", x, x))\n\t}\n}", "func (q *Quote) String() string {\n\ts := fmt.Sprintf(\"\\\"%s\\\"\\n\\n(%s\", q.Text, q.Author)\n\tif q.Source != \"\" {\n\t\ts += fmt.Sprintf(\", %s\", q.Source)\n\t}\n\ts += fmt.Sprint(\")\\n\")\n\treturn s\n}", "func lexQuote(l *reader) stateFn {\nLoop:\n\tfor {\n\t\tswitch l.next() {\n\t\tcase '\\\\':\n\t\t\tif r := l.next(); r != eof && r != '\\n' {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfallthrough\n\t\tcase eof, '\\n':\n\t\t\treturn l.errorf(\"unterminated quoted string\")\n\t\tcase '\"':\n\t\t\tbreak Loop\n\t\t}\n\t}\n\tl.emit(itemString)\n\treturn lexPunctuation\n}", "func lexQuote(l *lexer) stateFn {\n\tfor {\n\t\tswitch l.next() {\n\t\t//case '\\\\':\n\t\t//\tif r := l.next(); r != eof && r != '\\n' {\n\t\t//\t\tbreak\n\t\t//\t}\n\t\t//\tfallthrough\n\t\tcase eof, '\\n':\n\t\t\treturn l.errorf(\"unterminated quoted string\")\n\t\tcase '\"':\n\t\t\tl.emit(itemStrLit)\n\t\t\treturn lexSchema\n\t\t}\n\t}\n}", "func TestQuoteString(t *testing.T) {\n\tfor i, tc := range quoteTestcases {\n\t\tresult, err := QuoteString(tc.Input)\n\t\tif err != tc.ExpectedError {\n\t\t\tt.Errorf(\"Expected error '%s' in testcase %d, got '%s'\", tc.ExpectedError,\n\t\t\t\ti, err)\n\t\t}\n\t\tif result != tc.Output {\n\t\t\tt.Errorf(\"Expected '%s' in testcase %d, got '%s'\", tc.Output, i, result)\n\t\t}\n\t}\n}", "func quoteArgs(args []string) string {\n\tvar b strings.Builder\n\tfor i, arg := range args {\n\t\tif i > 0 {\n\t\t\tb.WriteString(\" \")\n\t\t}\n\t\tif strings.ContainsAny(arg, \"'\"+argSepChars) {\n\t\t\t// Quote the argument to a form that would be parsed as a single argument.\n\t\t\tb.WriteString(\"'\")\n\t\t\tb.WriteString(strings.ReplaceAll(arg, \"'\", \"''\"))\n\t\t\tb.WriteString(\"'\")\n\t\t} else {\n\t\t\tb.WriteString(arg)\n\t\t}\n\t}\n\treturn b.String()\n}", "func (statement *Statement) ReplaceQuote(sql string) string {\n\tif sql == \"\" || statement.dialect.URI().DBType == schemas.MYSQL ||\n\t\tstatement.dialect.URI().DBType == schemas.SQLITE {\n\t\treturn sql\n\t}\n\treturn statement.dialect.Quoter().Replace(sql)\n}", "func quoteStringIfNeeded(str string) string {\n\tif stringNeedsQuoting(str) {\n\t\treturn strconv.Quote(str)\n\t}\n\treturn str\n}", "func QuoteName(name string) string {\n\treturn \"`\" + EscapeName(name) + \"`\"\n}", "func (s *ss) quotedString() string {\n\ts.notEOF()\n\tquote := s.getRune()\n\tswitch quote {\n\tcase '`':\n\t\t// Back-quoted: Anything goes until EOF or back quote.\n\t\tfor {\n\t\t\tr := s.mustReadRune()\n\t\t\tif r == quote {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\ts.buf.WriteRune(r)\n\t\t}\n\t\treturn string(s.buf)\n\tcase '\"':\n\t\t// Double-quoted: Include the quotes and let strconv.Unquote do the backslash escapes.\n\t\ts.buf.WriteByte('\"')\n\t\tfor {\n\t\t\tr := s.mustReadRune()\n\t\t\ts.buf.WriteRune(r)\n\t\t\tif r == '\\\\' {\n\t\t\t\t// In a legal backslash escape, no matter how long, only the character\n\t\t\t\t// immediately after the escape can itself be a backslash or quote.\n\t\t\t\t// Thus we only need to protect the first character after the backslash.\n\t\t\t\ts.buf.WriteRune(s.mustReadRune())\n\t\t\t} else if r == '\"' {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tresult, err := strconv.Unquote(string(s.buf))\n\t\tif err != nil {\n\t\t\ts.error(err)\n\t\t}\n\t\treturn result\n\tdefault:\n\t\ts.errorString(\"expected quoted string\")\n\t}\n\treturn \"\"\n}", "func (q Quotes) randomQuote() string {\n\treturn q[rand.Intn(len(q))]\n}", "func (drv *Driver) quoteIdentifier(s string) string {\n\treturn pq.QuoteIdentifier(s)\n}", "func quoteLiteral(s string) string {\n\tvar b strings.Builder\n\tb.Grow(len(s)*2 + 3)\n\n\tb.WriteRune('E')\n\tb.WriteRune('\\'')\n\n\thasSlash := false\n\tfor _, c := range s {\n\t\tif c == '\\\\' {\n\t\t\tb.WriteString(`\\\\`)\n\t\t\thasSlash = true\n\t\t} else if c == '\\'' {\n\t\t\tb.WriteString(`''`)\n\t\t} else {\n\t\t\tb.WriteRune(c)\n\t\t}\n\t}\n\n\tb.WriteRune('\\'')\n\n\ts = b.String()\n\tif !hasSlash {\n\t\t// remove unnecessary E at the beginning\n\t\treturn s[1:]\n\t}\n\treturn s\n}", "func (q Quote) Serialize() ([]byte, error) {\n\tvar b bytes.Buffer\n\tenc := gob.NewEncoder(&b)\n\terr := enc.Encode(q)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Serialize: encoding failed for %v\", q)\n\t}\n\treturn b.Bytes(), nil\n}", "func Htmlquote(text string) string {\n\t//HTML编码为实体符号\n\t/*\n\t Encodes `text` for raw use in HTML.\n\t >>> htmlquote(\"<'&\\\\\">\")\n\t '&lt;&#39;&amp;&quot;&gt;'\n\t*/\n\n\ttext = html.EscapeString(text)\n\ttext = strings.NewReplacer(\n\t\t`“`, \"&ldquo;\",\n\t\t`”`, \"&rdquo;\",\n\t\t` `, \"&nbsp;\",\n\t).Replace(text)\n\n\treturn strings.TrimSpace(text)\n}", "func (o TableExternalDataConfigurationCsvOptionsPtrOutput) Quote() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TableExternalDataConfigurationCsvOptions) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Quote\n\t}).(pulumi.StringPtrOutput)\n}", "func EncodeQuoted(s []byte, t string) (string, error) {\n\t// =?{charset}?{encoding}?{encoded_text}?=\n\tvar encodedTxt string\n\tvar encoding string\n\tswitch t {\n\tcase EncodingB:\n\t\tencoding = t\n\t\tencodedTxt = base64.StdEncoding.EncodeToString(s)\n\t\tbreak\n\tcase EncodingQ:\n\t\tencoding = t\n\t\tbuf := new(bytes.Buffer)\n\t\tw := quotedprintable.NewWriter(buf)\n\n\t\tif _, err := w.Write(s); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tif err := w.Close(); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tencodedTxt = buf.String()\n\t\tbreak\n\tdefault:\n\t\treturn \"\", errors.New(\"encoding type NOT in [B|Q]\")\n\t}\n\n\treturn fmt.Sprintf(\"=?UTF-8?%s?%s?=\", encoding, encodedTxt), nil\n}", "func escape(input string) string {\n\treturn strings.ReplaceAll(strings.ReplaceAll(input, `\\`, `\\\\`), \"'\", `\\'`)\n}", "func WithQuote(quote rune) Option {\n\treturn option{\n\t\tunaligned: func(enc *UnalignedEncoder) error {\n\t\t\tenc.quote = quote\n\t\t\treturn nil\n\t\t},\n\t}\n}", "func interpretString(s string, quote byte) (string, error) {\n\tswitch quote {\n\tcase '\\'', '\"':\n\t\t// OK\n\tdefault:\n\t\tpanic(\"invalid quote type\")\n\t}\n\n\tif !strings.Contains(s, `\\`) {\n\t\t// Fast path: nothing to replace.\n\t\treturn s, nil\n\t}\n\n\t// To understand what's going on, consult the manual:\n\t// https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.double\n\n\tif quote == '\"' {\n\t\treturn interpretStringQ2(s)\n\t}\n\treturn interpretStringQ1(s)\n}", "func (m *MockDriver) RightQuote() byte {\n\treturn '\"'\n}", "func escape(s []byte) string {\n\ta := string(s)\n\tb := strconv.Quote(a)\n\tb = b[1 : len(b)-1]\n\tif a != b {\n\t\tb += \" (esc)\"\n\t}\n\treturn b\n}", "func appendShellSafeQuote(buf []byte, s string) []byte {\n\tbuf = append(buf, '\"')\n\tfor width := 0; len(s) > 0; s = s[width:] {\n\t\tr := rune(s[0])\n\t\twidth = 1\n\t\tif r >= utf8.RuneSelf {\n\t\t\tr, width = utf8.DecodeRuneInString(s)\n\t\t}\n\t\tif width == 1 {\n\t\t\tswitch r {\n\t\t\tcase utf8.RuneError:\n\t\t\t\tbuf = append(buf, '\\\\')\n\t\t\t\tbuf = append(buf, '0'+s[0]>>6)\n\t\t\t\tbuf = append(buf, '0'+((s[0]>>3)&7))\n\t\t\t\tbuf = append(buf, '0'+(s[0]&7))\n\t\t\t// Stuff which should be escaped\n\t\t\tcase '\\\\':\n\t\t\t\tbuf = append(buf, `\\\\`...)\n\t\t\tcase '\"':\n\t\t\t\tbuf = append(buf, `\\\"`...)\n\t\t\tcase '$':\n\t\t\t\tbuf = append(buf, `\\$`...)\n\t\t\tdefault:\n\t\t\t\tbuf = append(buf, byte(r))\n\t\t\t}\n\t\t} else {\n\t\t\tvar runeTmp [utf8.UTFMax]byte\n\t\t\tn := utf8.EncodeRune(runeTmp[:], r)\n\t\t\tbuf = append(buf, runeTmp[:n]...)\n\t\t}\n\t}\n\treturn append(buf, '\"')\n}", "func fixQuotes(target string) string {\n\t// TODO if the string contains double quotes, they should be escaped\n\t// e.g. '\"Foo\"Bar\"' is a problem, it becomes \"\"Foo\"Bar\"\", but\n\t// should become \"\\\"Foo\\\"Bar\\\"\"\n\treturn strings.Replace(target, \"'\", \"\\\"\", -1)\n}", "func unquote(s string) string {\n\tif strings.HasPrefix(s, `\"`) && strings.HasSuffix(s, `\"`) {\n\t\ts, err := strconv.Unquote(s)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"unable to unquote %q; %v\", s, err))\n\t\t}\n\t\treturn s\n\t}\n\treturn s\n}", "func lexRawQuote(l *lexer) stateFn {\nLoop:\n\tfor {\n\t\tswitch l.next() {\n\t\tcase eof, '\\n':\n\t\t\treturn l.errorf(\"unterminated raw quoted string\")\n\t\tcase '`':\n\t\t\tbreak Loop\n\t\t}\n\t}\n\tl.emit(itemRawString)\n\treturn lexInsideAction\n}", "func (_RouterV2 *RouterV2CallerSession) Quote(amountA *big.Int, reserveA *big.Int, reserveB *big.Int) (*big.Int, error) {\n\treturn _RouterV2.Contract.Quote(&_RouterV2.CallOpts, amountA, reserveA, reserveB)\n}", "func StringEscape(quote rune, literal string) string {\n\tvar buf bytes.Buffer\n\tescapeQuote(&buf, quote, literal)\n\treturn buf.String()\n}", "func LiteralQuoteEscapeBuf(buf *bytes.Buffer, quote rune, literal string) {\n\tif len(literal) > 1 {\n\t\tquoteb := byte(quote)\n\t\tif literal[0] == quoteb && literal[len(literal)-1] == quoteb {\n\t\t\t// Already escaped??\n\t\t\tio.WriteString(buf, literal)\n\t\t\treturn\n\t\t}\n\t}\n\tbuf.WriteByte(byte(quote))\n\tescapeQuote(buf, quote, literal)\n\tif quote == '[' {\n\t\tbuf.WriteByte(']')\n\t} else {\n\t\tbuf.WriteByte(byte(quote))\n\t}\n}", "func (sb *StatementBuilder) AddQuote(component string) {\n\tif component != \"\" {\n\t\tsb.Components = append(sb.Components, fmt.Sprintf(\"`%s`\", component))\n\t}\n}", "func QuotifyString(str string) string {\n\treturn \"\\\"\" + str + \"\\\"\"\n}", "func QuoteIdentifier(name string) string {\n\treturn `\"` + strings.Replace(name, `\"`, `\"\"`, -1) + `\"`\n}", "func (_RouterV2 *RouterV2Session) Quote(amountA *big.Int, reserveA *big.Int, reserveB *big.Int) (*big.Int, error) {\n\treturn _RouterV2.Contract.Quote(&_RouterV2.CallOpts, amountA, reserveA, reserveB)\n}", "func QuoteMeta(s string) string {\n\tvar buf bytes.Buffer\n\n\tfor _, ch := range s {\n\t\tswitch ch {\n\t\tcase '.', '+', '\\\\', '(', '$', ')', '[', '^', ']', '*', '?':\n\t\t\tbuf.WriteRune('\\\\')\n\t\t}\n\n\t\tbuf.WriteRune(ch)\n\t}\n\n\treturn buf.String()\n}", "func quoteParameterValue(name, val string) string {\n\tstart := val[0]\n\tend := val[len(val)-1]\n\tif name == \"search_path\" {\n\t\t// strip single quotes from the search_path. Those are required in the YAML configuration\n\t\t// to quote values containing commas, as otherwise NewFromMap would treat each comma-separated\n\t\t// part of such string as a separate map entry. However, a search_path is interpreted as a list\n\t\t// only if it is not quoted, otherwise it is treated as a single value. Therefore, we strip\n\t\t// single quotes here. Note that you can still use double quotes in order to escape schemas\n\t\t// containing spaces (but something more complex, like double quotes inside double quotes or spaces\n\t\t// in the schema name would break the parsing code in the operator.)\n\t\tif start == '\\'' && end == '\\'' {\n\t\t\treturn val[1 : len(val)-1]\n\t\t}\n\n\t\treturn val\n\t}\n\tif (start == '\"' && end == '\"') || (start == '\\'' && end == '\\'') {\n\t\treturn val\n\t}\n\treturn fmt.Sprintf(`'%s'`, strings.Trim(val, \" \"))\n}", "func (_IUniswapV2Router01 *IUniswapV2Router01Caller) Quote(opts *bind.CallOpts, amountA *big.Int, reserveA *big.Int, reserveB *big.Int) (*big.Int, error) {\r\n\tvar out []interface{}\r\n\terr := _IUniswapV2Router01.contract.Call(opts, &out, \"quote\", amountA, reserveA, reserveB)\r\n\r\n\tif err != nil {\r\n\t\treturn *new(*big.Int), err\r\n\t}\r\n\r\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\r\n\r\n\treturn out0, err\r\n\r\n}", "func EncloseInSingleQuotes(str string) string {\n\treturn \"'\" + str + \"'\"\n}", "func RegexpSlashQuote(sb *strings.Builder, str string) {\n\tutil.WriteByte(sb, '/')\n\tfor _, c := range str {\n\t\tswitch c {\n\t\tcase '\\t':\n\t\t\tutil.WriteString(sb, `\\t`)\n\t\tcase '\\n':\n\t\t\tutil.WriteString(sb, `\\n`)\n\t\tcase '\\r':\n\t\t\tutil.WriteString(sb, `\\r`)\n\t\tcase '/':\n\t\t\tutil.WriteString(sb, `\\/`)\n\t\tcase '\\\\':\n\t\t\tutil.WriteString(sb, `\\\\`)\n\t\tdefault:\n\t\t\tif c < 0x20 {\n\t\t\t\tutil.Fprintf(sb, `\\u{%X}`, c)\n\t\t\t} else {\n\t\t\t\tutil.WriteRune(sb, c)\n\t\t\t}\n\t\t}\n\t}\n\tutil.WriteByte(sb, '/')\n}", "func (s *ReadOptions) SetQuote(v string) *ReadOptions {\n\ts.Quote = &v\n\treturn s\n}", "func EscapeAllQuotes(s string) string {\n return strings.Replace(s, \"\\\"\", \"\\\\\\\"\", -1)\n}", "func writeQuoted(w writer, s string) error {\n\tvar q byte = '\"'\n\tif strings.Contains(s, `\"`) {\n\t\tq = '\\''\n\t}\n\tif err := w.WriteByte(q); err != nil {\n\t\treturn err\n\t}\n\tif _, err := w.WriteString(s); err != nil {\n\t\treturn err\n\t}\n\tif err := w.WriteByte(q); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (p *CockroachDriver) RightQuote() byte {\n\treturn '\"'\n}", "func (p postgresDialect) QuotedIdent(ident string) string {\n\tif ident == \"\" {\n\t\treturn \"\"\n\t}\n\n\tvar sb strings.Builder\n\tsb.WriteRune('\"')\n\tfor _, r := range ident {\n\t\tswitch {\n\t\tcase unicode.IsSpace(r):\n\t\t\t// Skip spaces\n\t\t\tcontinue\n\t\tcase r == '\"':\n\t\t\t// Escape double-quotes with repeated double-quotes\n\t\t\tsb.WriteString(`\"\"`)\n\t\tcase r == ';':\n\t\t\t// Ignore the command termination character\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tsb.WriteRune(r)\n\t\t}\n\t}\n\tsb.WriteRune('\"')\n\treturn sb.String()\n}", "func appendQuote(dest []byte, s string, escapeHTML bool) []byte {\n\tdest = append(dest, '\"')\n\tstart := 0\n\tfor i := 0; i < len(s); {\n\t\tif b := s[i]; b < utf8.RuneSelf {\n\t\t\tif htmlSafeSet[b] || (!escapeHTML && safeSet[b]) {\n\t\t\t\ti++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif start < i {\n\t\t\t\tdest = append(dest, s[start:i]...)\n\t\t\t}\n\t\t\tdest = append(dest, '\\\\')\n\t\t\tswitch b {\n\t\t\tcase '\\\\', '\"':\n\t\t\t\tdest = append(dest, b)\n\t\t\tcase '\\n':\n\t\t\t\tdest = append(dest, 'n')\n\t\t\tcase '\\r':\n\t\t\t\tdest = append(dest, 'r')\n\t\t\tcase '\\t':\n\t\t\t\tdest = append(dest, 't')\n\t\t\tdefault:\n\t\t\t\t// This encodes bytes < 0x20 except for \\t, \\n and \\r.\n\t\t\t\t// If escapeHTML is set, it also escapes <, >, and &\n\t\t\t\t// because they can lead to security holes when\n\t\t\t\t// user-controlled strings are rendered into JSON\n\t\t\t\t// and served to some browsers.\n\t\t\t\tdest = append(dest, []byte(`u00`)...)\n\t\t\t\tdest = append(dest, hex[b>>4])\n\t\t\t\tdest = append(dest, hex[b&0xF])\n\t\t\t}\n\t\t\ti++\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\t\tc, size := utf8.DecodeRuneInString(s[i:])\n\t\tif c == utf8.RuneError && size == 1 {\n\t\t\tif start < i {\n\t\t\t\tdest = append(dest, s[start:i]...)\n\t\t\t}\n\t\t\tdest = append(dest, []byte(`\\ufffd`)...)\n\t\t\ti += size\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\t\t// U+2028 is LINE SEPARATOR.\n\t\t// U+2029 is PARAGRAPH SEPARATOR.\n\t\t// They are both technically valid characters in JSON strings,\n\t\t// but don't work in JSONP, which has to be evaluated as JavaScript,\n\t\t// and can lead to security holes there. It is valid JSON to\n\t\t// escape them, so we do so unconditionally.\n\t\t// See http://timelessrepo.com/json-isnt-a-javascript-subset for discussion.\n\t\tif c == '\\u2028' || c == '\\u2029' {\n\t\t\tif start < i {\n\t\t\t\tdest = append(dest, s[start:i]...)\n\t\t\t}\n\t\t\tdest = append(dest, []byte(`\\u202`)...)\n\t\t\tdest = append(dest, hex[c&0xF])\n\t\t\ti += size\n\t\t\tstart = i\n\t\t\tcontinue\n\t\t}\n\t\ti += size\n\t}\n\tif start < len(s) {\n\t\tdest = append(dest, s[start:]...)\n\t}\n\tdest = append(dest, '\"')\n\treturn dest\n}", "func (c *Core) QuoteWord(s string) string {\n\tcharLeft, charRight := c.db.GetChars()\n\treturn doQuoteWord(s, charLeft, charRight)\n}", "func quotedEnvValue( value string ) ( quotedValue string ) {\n\tmatcher := regexp.MustCompile( `\\s+` )\n\tmatch := matcher.FindString( value )\n\n\tif len( match ) > 0 {\n\t\tmatcher = regexp.MustCompile( `\"` )\n\t\tmatch = matcher.FindString( value )\n\n\t\tif len( match ) > 0 {\n\t\t\tquotedValue = `'` + value + `'`\n\t\t} else {\n\t\t\tquotedValue = `\"` + value + `\"`\n\t\t}\n\t} else {\n\t\tquotedValue = value\n\t}\n\n\treturn\n}", "func (_UniswapV2Router02 *UniswapV2Router02Caller) Quote(opts *bind.CallOpts, amountA *big.Int, reserveA *big.Int, reserveB *big.Int) (*big.Int, error) {\r\n\tvar out []interface{}\r\n\terr := _UniswapV2Router02.contract.Call(opts, &out, \"quote\", amountA, reserveA, reserveB)\r\n\r\n\tif err != nil {\r\n\t\treturn *new(*big.Int), err\r\n\t}\r\n\r\n\tout0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)\r\n\r\n\treturn out0, err\r\n\r\n}", "func ShellEscape(input string) string {\n\tif input == \"\" {\n\t\treturn \"''\"\n\t}\n\n\tvar sb strings.Builder\n\tsb.Grow(len(input) * 2)\n\n\tescape := false\n\tfor _, c := range []byte(input) {\n\t\tmode := modeTable[c]\n\t\tswitch mode {\n\t\tcase lit:\n\t\t\tsb.WriteByte(c)\n\t\tcase quo:\n\t\t\tsb.WriteByte(c)\n\t\t\tescape = true\n\t\tcase \"\":\n\t\t\tsb.Write([]byte{'\\\\', 'x', hextable[c>>4], hextable[c&0x0f]})\n\t\t\tescape = true\n\t\tdefault:\n\t\t\tsb.WriteString(string(mode))\n\t\t\tescape = true\n\t\t}\n\t}\n\n\tif escape {\n\t\treturn \"$'\" + sb.String() + \"'\"\n\t}\n\n\treturn sb.String()\n}", "func (app *App) quoteString(raw string) string {\n\tbb := bytebufferpool.Get()\n\t// quoted := string(fasthttp.AppendQuotedArg(bb.B, getBytes(raw)))\n\tquoted := app.getString(fasthttp.AppendQuotedArg(bb.B, app.getBytes(raw)))\n\tbytebufferpool.Put(bb)\n\treturn quoted\n}", "func (sq quoteAnalyzerParam) QuoteAnalyzer() string {\n\treturn sq.quoteAnalyzer\n}", "func quote4shell(s string) string {\n\treturn \"'\" + strings.Join(strings.Split(s, \"'\"), `'\\''`) + \"'\"\n}", "func ShellQuoteSingle(str string) string {\n\t// Quote anything that looks slightly complicated.\n\tif shellWordRe.FindStringIndex(str) == nil {\n\t\treturn \"'\" + strings.Replace(str, \"'\", \"'\\\\''\", -1) + \"'\"\n\t}\n\treturn str\n}", "func ShellQuoteSingle(str string) string {\n\t// Quote anything that looks slightly complicated.\n\tif shellWordRe.FindStringIndex(str) == nil {\n\t\treturn \"'\" + strings.Replace(str, \"'\", \"'\\\\''\", -1) + \"'\"\n\t}\n\treturn str\n}" ]
[ "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.6012469", "0.59994537", "0.59802103", "0.5942123", "0.587217", "0.58553296", "0.57931715", "0.57931715", "0.5776315", "0.57548", "0.57311565", "0.5724247", "0.5723667", "0.57074034", "0.5700553", "0.5669209", "0.5617622", "0.5614358", "0.56112415", "0.5588539", "0.556965", "0.5564948", "0.5564372", "0.5562", "0.5514942", "0.5466364", "0.54617167", "0.54305744", "0.5406363", "0.5380741", "0.5379731", "0.53403914", "0.5319417", "0.53113574", "0.52894115", "0.52745885", "0.526189", "0.5251358", "0.524225", "0.5241284", "0.5234868", "0.5223752", "0.5195768", "0.51940143", "0.5189235", "0.5187949", "0.51545954", "0.515252", "0.513951", "0.5108407", "0.5104398", "0.5090007", "0.5089459", "0.50778323", "0.5076648", "0.5076162", "0.5075066", "0.50662214", "0.50542086", "0.504463", "0.50326574", "0.50301945", "0.50235134", "0.5022811", "0.5015765", "0.49778074", "0.49626413", "0.49594992", "0.49559188", "0.49463528", "0.4944759", "0.49240476", "0.49233294", "0.49053255", "0.48980853", "0.4890303", "0.4889283", "0.48824358", "0.48705575", "0.48705575" ]
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 int) string {\n\t// TODO: handle when count < 0\n\tvar repeated string\n\n\tfor i := 0; i < count; i++ {\n\t\trepeated += s\n\t}\n\n\treturn repeated\n}", "func Repeat(s string, count int) string {\n\treturn strings.Repeat(s, count)\n}", "func Repeat(count int, str string) string {\n\tvar ret string\n\tfor i := 0; i < count; i++ {\n\t\tret += str\n\t}\n\treturn ret\n}", "func Repeat(input string, repeatCount int) (rs string) {\n\tfor i := 0; i < repeatCount; i++ {\n\t\trs += input\n\t}\n\treturn\n}", "func Repeat(word string, repeat int) string {\n\tvar result string\n\n\tif repeat == 0 {\n\t\trepeat = repeatCount\n\t}\n\n\tfor i := 0; i < repeat; i++ {\n\t\tresult += word\n\t}\n\treturn result\n}", "func Repeat(character string, count int) string {\n\tvar repeated string\n\tfor i := 0; i < count; i++ {\n\t\trepeated += character\n\t}\n\treturn repeated\n}", "func Repeat(v string, repeatNtimes int) string {\n\tvar repeated string\n\tfor i := 1; i <= repeatNtimes; i++ {\n\t\trepeated += v\n\t}\n\treturn repeated\n}", "func Repeat(char string, count int) string {\n\tvar result string = \"\"\n\n\tfor i := 0; i < count; i++ {\n\t\tresult += char\n\t}\n\n\treturn result\n}", "func Repeat(\n\ttext StringExpression, n NumericExpression,\n) StringExpression {\n\treturn NewStringExpressionFunction(\"REPEAT\", text, n)\n}", "func Repeat(input string, n int) (repeated string) {\n\tfor i := 0; i < n; i++ {\n\t\trepeated += input\n\t}\n\treturn\n}", "func Repeat(char string, count int) string {\n\tvar repeated string\n\n\tfor i := 0; i < count; i++ {\n\t\trepeated += char\n\t}\n\n\treturn repeated\n}", "func Repeat(str string, repeat int) string {\n\tbuff := \"\"\n\tfor repeat > 0 {\n\t\trepeat = repeat - 1\n\t\tbuff += str\n\t}\n\treturn buff\n}", "func Repeat(character string, repeatCount int) string {\n\tvar repeated string\n\tfor i := 0; i < repeatCount; i++ {\n\t\trepeated += character\n\t}\n\treturn repeated\n}", "func Repeat(character string, repeatCount int) string {\n\tresult := \"\"\n\tfor i := 0; i < repeatCount; i++ {\n\t\tresult += character\n\t}\n\treturn result\n}", "func Repeat(character string, times int) string {\n\treturn strings.Repeat(character, times)\n}", "func Repeat(character string, times int) string {\n\tvar repeated string\n\tfor i := 0; i < times; i++ {\n\t\trepeated += character\n\t}\n\treturn repeated\n}", "func Repeat(character string, times int) string {\n\tvar repeated string\n\n\tfor i := 0; i < times; i++ {\n\t\trepeated += character\n\t}\n\n\treturn repeated\n}", "func MyRepeat(c string, n int) string {\n\tvar s string\n\tfor i := 0; i < n; i++ {\n\t\ts += c\n\t}\n\treturn s\n}", "func (m *memStats) repeat(s string, n int) string {\n\tvar v string\n\tfor i := 0; i < n; i++ {\n\t\tv += s\n\t}\n\treturn v\n}", "func Repeat(count int) MapFunc {\n\treturn func(s string) string { return strings.Repeat(s, count) }\n}", "func ExampleRepeat() {\n\tsum := Repeat(\"a\", 5)\n\tfmt.Println(sum)\n\t// Output: aaaaa\n}", "func repeatWord(word string, repetitions int) string {\n\tvar response string\n\tvar i int\n\n\tif repetitions < 0 {\n\t\tlog.Fatal(\"Can not repeat a word a negative number of times\\n\")\n\t} else if repetitions == 0 {\n\t\treturn \"\"\n\t}\n\n\t// we are now dealing with the case that we must\n\t// repeat the word one, or more, times\n\tresponse = word\n\tfor i = 1; i < repetitions; i++ {\n\t\tresponse = fmt.Sprintf(\"%s %s\", response, word)\n\t}\n\n\treturn response\n}", "func Repeater(char string, times int) string {\n\tvar finalString string\n\tfor index := 1; index <= times; index++ {\n\t\tfinalString += char\n\t}\n\treturn finalString\n}", "func CoolRepeatStr(repititions int, value string) string {\n\tvar buffer bytes.Buffer\n\n\tfor i := 0; i < repititions; i++ {\n\t\tbuffer.WriteString(value)\n\t}\n\treturn buffer.String()\n}", "func repeatText(n int, text string) string {\n\tout := \"\"\n\n\tfor ; n > 0; n-- {\n\t\tout += text\n\t}\n\n\treturn out\n}", "func repeatedString(s string, n int64) int64 {\n l := float64(len(s))\n baseA := int64(0)\n for _, letter := range s {\n if letter == 'a' {\n baseA++\n }\n }\n incompleteRepeat := math.Floor(float64(n)/l)\n incompleteLength := incompleteRepeat * l\n\n\n reminder := n - int64(incompleteLength)\n\n reminderA := int64(0)\n for index := int64(0); index < reminder; index++ {\n if s[index] == 'a' {\n reminderA++\n }\n }\n\n return (baseA * int64(incompleteRepeat)) + reminderA\n}", "func repeatedString(s string, n int64) int64 {\n\tsLen := len(s)\n\twantLen := int(n)\n\tnumCharsDiff := wantLen - sLen\n\tnumRepeats := math.Ceil(float64(numCharsDiff) / float64(len(s)))\n\tnewStr := strings.Repeat(s, int(numRepeats))\n\tnewStr = newStr[:wantLen-1]\n\tfinalStr := newStr + string(s[len(s)-1])\n\treturn countLetterA(finalStr)\n}", "func repeatedString(s string, n int64) int64 {\n\ts_len := int64(len(s))\n\tquotient := n / s_len\n\tremainder := n % s_len\n\n\taCount, aCountRemainder := int64(0), int64(0)\n\tfor i, char := range s {\n\t\tif char == 'a' {\n\t\t\tif int64(i) < remainder {\n\t\t\t\taCountRemainder++\n\t\t\t}\n\t\t\taCount++\n\t\t}\n\t}\n\n\treturn aCount*quotient + aCountRemainder\n}", "func RepeatString(s string, n int) (r []string) {\n\tfor i := 0; i < n; i++ {\n\t\tr = append(r, s)\n\t}\n\treturn r\n}", "func appendRepeat(buf []byte, s string, n int) []byte {\n\tfor i := 0; i < n; i++ {\n\t\tbuf = append(buf, s...)\n\t}\n\treturn buf\n}", "func repeatedString(s string, n int64) (count int64) {\n\tinSub := int64(strings.Count(s, \"a\"))\n\ttail := s[:n%int64(len(s))]\n\tinTail := int64(strings.Count(tail, \"a\"))\n\treturn inSub*(n/int64(len(s))) + inTail\n}", "func BenchmarkStringsRepeat(b *testing.B) {\n\tfor i := 0; i < b.N; i++ {\n\t\t_ = strings.Repeat(\"もっちもっちにゃんにゃん!\", 20)\n\t}\n}", "func repeated(res ...*regexp.Regexp) *regexp.Regexp {\n\treturn match(group(expression(res...)).String() + `+`)\n}", "func repeated(res ...*regexp.Regexp) *regexp.Regexp {\n\treturn match(group(expression(res...)).String() + `+`)\n}", "func repeated(res ...*regexp.Regexp) *regexp.Regexp {\n\treturn match(group(expression(res...)).String() + `+`)\n}", "func repeatJoin(a string, separator string, count int) string {\n\tif count == 0 {\n\t\treturn ``\n\t}\n\tvals := make([]byte, 0, 10)\n\tvals = append(vals, a...)\n\tfor i := 1; i < count; i++ {\n\t\tvals = append(vals, separator...)\n\t\tvals = append(vals, a...)\n\t}\n\treturn string(vals)\n}", "func RepeatStringN(v string, n int) <-chan string {\n\tch := make(chan string, 1)\n\tgo func() {\n\t\tfor i := 0; i < n; i++ {\n\t\t\tch <- v\n\t\t}\n\t}()\n\treturn ch\n}", "func Bvrepeat(t TermT, n uint32) TermT {\n\treturn TermT(C.yices_bvrepeat(C.term_t(t), C.uint32_t(n)))\n}", "func repeatOpcode(opcode uint8, numRepeats int) []byte {\n\treturn bytes.Repeat([]byte{opcode}, numRepeats)\n}", "func repeatOpcode(opcode uint8, numRepeats int) []byte {\n\treturn bytes.Repeat([]byte{opcode}, numRepeats)\n}", "func RepeatJoin(s string, count int, sep string) string {\n\tif s == \"\" || count == 0 {\n\t\treturn \"\"\n\t}\n\tif count == 1 {\n\t\treturn s\n\t}\n\n\tvar b strings.Builder\n\tb.Grow(len(s)*count + len(sep)*(count-1))\n\tfor i := 0; i < count; i++ {\n\t\tb.WriteString(s)\n\t\tif i < count-1 {\n\t\t\tb.WriteString(sep)\n\t\t}\n\t}\n\n\treturn b.String()\n}", "func RepeatWithSeparator(str string, sep string, repeat int) string {\n\tbuff := \"\"\n\tfor repeat > 0 {\n\t\trepeat = repeat - 1\n\t\tbuff += str\n\t\tif repeat > 0 {\n\t\t\tbuff += sep\n\t\t}\n\t}\n\treturn buff\n}", "func BenchmarkRepeat(b *testing.B) {\n\tfor i := 0; i < b.N; i++ {\n\t\tRepeat(\"a\")\n\t}\n}", "func Repeat(p Pattern, n int) Pattern {\n\tif n <= 0 {\n\t\treturn &EmptyNode{}\n\t}\n\n\tacc := p\n\tfor i := 1; i < n; i++ {\n\t\tacc = &SeqNode{\n\t\t\tLeft: acc,\n\t\t\tRight: p,\n\t\t}\n\t}\n\treturn acc\n}", "func (w *Writer) Repeat(n, c int64)", "func countAndSay(n int) string {\n\tif n == 1 { // special case\n\t\treturn \"1\"\n\t}\n\tpre, cur := \"\", \"1\"\n\thead, tail := 0, 0\n\n\ttmp := cur[0]\n\tlength := len(cur)\n\n\tfor i := 1; i < n; i++ { // 1 -> n -1\n\t\tlength = len(cur) // reset length\n\t\ttmp = cur[0] // reset tmp\n\t\thead = 0 // reset head and tail 0 0\n\t\tfor tail = 0; tail < length; tail++ {\n\t\t\tif cur[tail] == tmp { // find same as cache\n\t\t\t\thead++\n\t\t\t} else { // not found add tmp and cache pre then mark head -> 1\n\t\t\t\tpre = pre + strconv.Itoa(head) + string(tmp)\n\t\t\t\ttmp = cur[tail]\n\t\t\t\thead = 1\n\t\t\t}\n\n\t\t\tif tail == length-1 { // special case length-1 cache pre\n\t\t\t\tpre = pre + strconv.Itoa(head) + string(tmp)\n\t\t\t}\n\t\t}\n\t\tcur = pre // cur now\n\t\tpre = \"\" //reset\n\t}\n\treturn cur\n}", "func repeatRune(stream []rune, r rune, n int) []rune {\n\n\t// reapeat + append\n\tfor i := 0; i < n; i++ {\n\t\tstream = append(stream, r)\n\t}\n\n\t// result\n\treturn stream\n}", "func FuncRepeat(newmatch, subsrc, dnstreq fgbase.Edge, oldmatch, subdst, upstreq fgbase.Edge, min, max int) fgbase.Node {\n\n\tnode := fgbase.MakeNode(\"repeat\", []*fgbase.Edge{&newmatch, &subsrc, &dnstreq}, []*fgbase.Edge{&oldmatch, &subdst, &upstreq}, repeatRdy, repeatFire)\n\tnode.Aux = repeatStruct{entries: make(map[string]*repeatEntry), min: min, max: max}\n\treturn node\n\n}", "func countAndSay(n int) string {\n if n < 1 { return \"\" }\n \n result := \"1\"\n for i := 1; i < n; i++ {\n result = findNext(result)\n }\n \n return result\n}", "func RepeatMe(words ...string) {\n\tfmt.Println(words)\n}", "func CountAndSay(n int) string {\n\tres := \"1\"\n\tfor i := 0; i < n-1; i++ {\n\t\tres = translate(res)\n\t}\n\treturn res\n}", "func RepeatFasta(s []byte, count int) {\n pos := 0\n s2 := make([]byte, len(s)+WIDTH)\n copy(s2, s)\n copy(s2[len(s):], s)\n for count > 0 {\n line := min(WIDTH, count)\n out.Write(s2[pos : pos+line])\n out.WriteByte('\\n')\n pos += line\n if pos >= len(s) {\n pos -= len(s)\n }\n count -= line\n }\n}", "func countAndSay(n int) string {\n\tif n <= 1{\n\t\treturn \"1\"\n\t}\n\tvar last string = \"1\"\n\tfor i := 2;i <= n;i++{\n\t\tslow := 0\n\t\tfast := slow + 1\n\t\t//var cur string\n\t\tvar cur bytes.Buffer\n\t\tl := len(last)\n\t\tfor fast <= l{\n\t\t\tif fast < len(last) && last[slow] == last[fast]{\n\t\t\t\tfast++\n\t\t\t}else{\n\t\t\t\t//l := fast - slow\n\t\t\t\t//cnt := strconv.Itoa(l)\n\t\t\t\t//num := string(last[slow])\n\t\t\t\t//cur += cnt + num\n\t\t\t\tcur.WriteString(strconv.Itoa(fast - slow))\n\t\t\t\tcur.WriteByte(last[slow])\n\t\t\t\tslow = fast\n\t\t\t\tfast++\n\t\t\t}\n\t\t}\n\t\tlast = cur.String()\n\t\tif i == n{\n\t\t\treturn last\n\t\t}\n\t}\n\treturn last\n}", "func Repeat[T any](t T, n int) (tt []T) {\n\tfor i := 0; i < n; i++ {\n\t\ttt = append(tt, t)\n\t}\n\treturn tt\n}", "func Count(str, operand string) int { return strings.Count(operand, str) }", "func RepeatString(\n\tctx context.Context,\n\tvalues ...string,\n) <-chan string {\n\tch := make(chan string)\n\n\tgo func() {\n\t\tdefer close(ch)\n\n\t\tfor {\n\t\t\tfor _, v := range values {\n\t\t\t\tselect {\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn\n\t\t\t\tcase ch <- v:\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn ch\n}", "func generatePlaceholders(n int) string {\n\tplaceholders := strings.Builder{}\n\tfor i := 1; i <= n; i++ {\n\t\tif i > 1 {\n\t\t\tplaceholders.WriteByte(',')\n\t\t}\n\t\tplaceholders.WriteString(fmt.Sprintf(\"$%d\", i))\n\t}\n\treturn placeholders.String()\n}", "func (c codePoint) repeat(w int) {\n\tfor i := 0; i < w; i++ {\n\t\tWriter.Write(c)\n\t}\n}", "func concatRepetition(r *syntax.Regexp) (bool, *syntax.Regexp) {\n\tif r.Op != syntax.OpConcat {\n\t\t// don't iterate sub-expressions if top-level is no OpConcat\n\t\treturn false, r\n\t}\n\n\t// check if concatenated op is already a repetition\n\tif isConcatRepetition(r) {\n\t\treturn false, r\n\t}\n\n\t// concatenate repetitions in sub-expressions first\n\tvar subs []*syntax.Regexp\n\tchanged := false\n\tfor _, sub := range r.Sub {\n\t\tchangedSub, tmp := concatRepetition(sub)\n\t\tchanged = changed || changedSub\n\t\tsubs = append(subs, tmp)\n\t}\n\n\tvar concat []*syntax.Regexp\n\tlastMerged := -1\n\tfor i, j := 0, 1; j < len(subs); i, j = j, j+1 {\n\t\tif subs[i].Op == syntax.OpRepeat && eqRegex(subs[i].Sub[0], subs[j]) {\n\t\t\tr := subs[i]\n\t\t\tconcat = append(concat,\n\t\t\t\t&syntax.Regexp{\n\t\t\t\t\tOp: syntax.OpRepeat,\n\t\t\t\t\tSub: r.Sub,\n\t\t\t\t\tMin: r.Min + 1,\n\t\t\t\t\tMax: r.Max + 1,\n\t\t\t\t\tFlags: r.Flags,\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tlastMerged = j\n\t\t\tchanged = true\n\t\t\tj++\n\t\t\tcontinue\n\t\t}\n\n\t\tif isConcatRepetition(subs[i]) && eqRegex(subs[i].Sub[0], subs[j]) {\n\t\t\tr := subs[i]\n\t\t\tconcat = append(concat,\n\t\t\t\t&syntax.Regexp{\n\t\t\t\t\tOp: syntax.OpConcat,\n\t\t\t\t\tSub: append(r.Sub, r.Sub[0]),\n\t\t\t\t\tFlags: r.Flags,\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tlastMerged = j\n\t\t\tchanged = true\n\t\t\tj++\n\t\t\tcontinue\n\t\t}\n\n\t\tif eqRegex(subs[i], subs[j]) {\n\t\t\tr := subs[i]\n\t\t\tconcat = append(concat,\n\t\t\t\t&syntax.Regexp{\n\t\t\t\t\tOp: syntax.OpRepeat,\n\t\t\t\t\tSub: []*syntax.Regexp{r},\n\t\t\t\t\tMin: 2,\n\t\t\t\t\tMax: 2,\n\t\t\t\t\tFlags: r.Flags,\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tlastMerged = j\n\t\t\tchanged = true\n\t\t\tj++\n\t\t\tcontinue\n\t\t}\n\n\t\tconcat = append(concat, subs[i])\n\t}\n\n\tif lastMerged+1 != len(subs) {\n\t\tconcat = append(concat, subs[len(subs)-1])\n\t}\n\n\tr = &syntax.Regexp{\n\t\tOp: syntax.OpConcat,\n\t\tSub: concat,\n\t\tFlags: r.Flags,\n\t}\n\treturn changed, r\n}", "func main() {\n\tvar oi string\n\tfor i := 0; i < 10; i++ {\n\t\toi += strconv.Itoa(i + 1)\n\t\tfmt.Printf(\"%d\\n\", oi)\n\t}\n\n}", "func RepeatString(v string) <-chan string {\n\tch := make(chan string, 1)\n\tgo func() {\n\t\tfor {\n\t\t\tch <- v\n\t\t}\n\t}()\n\treturn ch\n}", "func NumberRepeat(vm *VM, target, locals Interface, msg *Message) (result Interface) {\n\tif len(msg.Args) < 1 {\n\t\treturn vm.RaiseException(\"Number repeat requires 1 or 2 arguments\")\n\t}\n\tcounter, eval := msg.ArgAt(0), msg.ArgAt(1)\n\tc := counter.Name()\n\tif eval == nil {\n\t\t// One argument was supplied.\n\t\tcounter, eval = nil, counter\n\t}\n\tmax := int(math.Ceil(target.(*Number).Value))\n\tfor i := 0; i < max; i++ {\n\t\tif counter != nil {\n\t\t\tSetSlot(locals, c, vm.NewNumber(float64(i)))\n\t\t}\n\t\tresult = eval.Eval(vm, locals)\n\t\tif rr, ok := CheckStop(result, NoStop); !ok {\n\t\t\tswitch s := rr.(Stop); s.Status {\n\t\t\tcase ContinueStop:\n\t\t\t\tresult = s.Result\n\t\t\tcase BreakStop:\n\t\t\t\treturn s.Result\n\t\t\tcase ReturnStop, ExceptionStop:\n\t\t\t\treturn rr\n\t\t\tdefault:\n\t\t\t\tpanic(fmt.Sprintf(\"iolang: invalid Stop: %#v\", rr))\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "func (gn *Gen) CatNoRepeat(strs []string) string {\n\tcatstr := \"\"\n\tprv := -1\n\tcnt := 0\n\tfor cnt < gn.n {\n\t\tidx := rand.Intn(len(strs))\n\t\tif idx != prv {\n\t\t\tcatstr += strs[idx]\n\t\t\tcnt++\n\t\t\tprv = idx\n\t\t}\n\t}\n\treturn catstr\n}", "func Solution1(str string) string {\n\n\tcount := 0\n\tresult := \"\"\n\n\tfor i := 0; i < len(str); i++ {\n\t\tvar a = string(str[i])\n\t\tcount = 1\n\n\t\tfor i+1 < len(str) && string(str[i]) == string(str[i+1]) {\n\t\t\tcount++\n\t\t\ti++\n\t\t}\n\n\t\tif count == 1 {\n\t\t\tresult += fmt.Sprintf(\"%s\", a)\n\t\t} else {\n\t\t\tresult += fmt.Sprintf(\"%d%s\", count, a)\n\t\t}\n\t}\n\n\treturn result\n}", "func emitRepeat(dst []byte, offset, length int) int {\n\t// Repeat offset, make length cheaper\n\tlength -= 4\n\tif length <= 4 {\n\t\tdst[0] = uint8(length)<<2 | tagCopy1\n\t\tdst[1] = 0\n\t\treturn 2\n\t}\n\tif length < 8 && offset < 2048 {\n\t\t// Encode WITH offset\n\t\tdst[1] = uint8(offset)\n\t\tdst[0] = uint8(offset>>8)<<5 | uint8(length)<<2 | tagCopy1\n\t\treturn 2\n\t}\n\tif length < (1<<8)+4 {\n\t\tlength -= 4\n\t\tdst[2] = uint8(length)\n\t\tdst[1] = 0\n\t\tdst[0] = 5<<2 | tagCopy1\n\t\treturn 3\n\t}\n\tif length < (1<<16)+(1<<8) {\n\t\tlength -= 1 << 8\n\t\tdst[3] = uint8(length >> 8)\n\t\tdst[2] = uint8(length >> 0)\n\t\tdst[1] = 0\n\t\tdst[0] = 6<<2 | tagCopy1\n\t\treturn 4\n\t}\n\tconst maxRepeat = (1 << 24) - 1\n\tlength -= 1 << 16\n\tleft := 0\n\tif length > maxRepeat {\n\t\tleft = length - maxRepeat + 4\n\t\tlength = maxRepeat - 4\n\t}\n\tdst[4] = uint8(length >> 16)\n\tdst[3] = uint8(length >> 8)\n\tdst[2] = uint8(length >> 0)\n\tdst[1] = 0\n\tdst[0] = 7<<2 | tagCopy1\n\tif left > 0 {\n\t\treturn 5 + emitRepeat(dst[5:], offset, left)\n\t}\n\treturn 5\n}", "func MakeNString(n int, s string) string {\n\tresString := \"\"\n\tfor i := 0; i < n; i++ {\n\t\tresString += s\n\t}\n\treturn resString\n}", "func expand(s string, i, j int) int {\n\n}", "func Accum(s string) string {\n\tvar result []string\n\tfor index, r := range s {\n\t\tstr := string(r)\n\t\tresult = append(result, strings.ToUpper(str)+strings.Repeat(strings.ToLower(str), index))\n\t}\n\treturn strings.Join(result, \"-\")\n}", "func NewRepeat(P Process) *Repeat {\n\treturn &Repeat{Proc: P}\n}", "func repeatExecs(f *flow.Flow, n int) (*flow.Flow, error) {\n\tr := repeater{root: f, times: n, repeated: newFlowMap(), skippedSet: newFlowMap()}\n\treturn r.Comparer()\n}", "func s(n int) string {\n\tif n < 0 {\n\t\tn = 1\n\t}\n\treturn strings.Repeat(\" \", n)\n}", "func RepStandard(c string, n int) string {\n\treturn strings.Repeat(c, n)\n}", "func main() {\n\t// func Replace(s, old, new string, n int) string\n\tfmt.Println(strings.Replace(\"aaaa\", \"a\", \"b\", 2)) // 2 indicates how many times to do the replacement\n\t// => \"bbaa\"\n\n}", "func concat(i Instruction, ls *LuaState) {\n\ta, b, c := i.ABC()\n\ta += 1\n\tb += 1\n\tc += 1\n\n\tn := c - b + 1\n\tluaCheckStack(ls, n)\n\tfor i := b; i <= c; i++ {\n\t\tluaPushValue(ls, i)\n\t}\n\tluaConcat(ls, n)\n\tluaReplace(ls, a)\n}", "func multString(a, b string) string {\n\ta2, _ := strconv.Atoi(a)\n\tb2, _ := strconv.Atoi(b)\n\tvar c int\n\tfor i := 0; i < b2; i++ {\n\t\tc += a2\n\t}\n\treturn fmt.Sprintf(\"%d\", c)\n}", "func solve1(input string) string {\n\tlist := parseInput(input)\n\ti := 0\n\tn := 0\n\tfor i >= 0 && i < len(list) {\n\t\tj := list[i]\n\t\tlist[i]++\n\t\ti += j\n\t\tn++\n\t}\n\treturn fmt.Sprint(n)\n}", "func GenStrs(strs []string) func() string {\n\ti := 0\n\tn := len(strs)\n\treturn func() string {\n\t\tnextVal := strs[i%n]\n\t\ti++\n\t\treturn nextVal\n\t}\n}", "func Repeat[T Clonable[T]](count int, initial T) []T {\n\tresult := make([]T, 0, count)\n\n\tfor i := 0; i < count; i++ {\n\t\tresult = append(result, initial.Clone())\n\t}\n\n\treturn result\n}", "func Repeat(ops ...Operation) error {\n\tvar err error\n\n\top := ComposeSlice(ops)\n\tfor {\n\t\terr = op(err)\n\t\tswitch e := err.(type) {\n\t\tcase nil:\n\t\tcase *TemporaryError:\n\t\tcase *StopError:\n\t\t\treturn e.Cause\n\t\tdefault:\n\t\t\treturn e\n\t\t}\n\t}\n}", "func shift(a string, n int) string {\n\tfor i := 0; i < n; i++ {\n\t\ta = a + \"0\"\n\t}\n\treturn a\n}", "func strobogrammatic(numCount int) []string {\n\tsbgNumbers := []int{1, 6, 8, 9, 0}\n\tn := numCount % 2\n\n\tvar numList []string\n\tvar f func(str string)\n\tf = func(str string) {\n\t\tif len(str) == numCount {\n\t\t\tnumList = append(numList, str)\n\t\t\treturn\n\t\t}\n\t\tfor _, x := range sbgNumbers {\n\t\t\ty := strconv.Itoa(x)\n\t\t\tif str == \"\" && n > 0 {\n\t\t\t\tif x == 6 || x == 9 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tf(y)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif len(str) == numCount-2 && x == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tz := y\n\t\t\tif x == 6 {\n\t\t\t\tz = \"9\"\n\t\t\t}\n\t\t\tif x == 9 {\n\t\t\t\tz = \"6\"\n\t\t\t}\n\t\t\tf(y + str + z)\n\t\t}\n\t}\n\tf(\"\")\n\n\treturn numList\n}", "func (self *Tween) Repeat1O(total int, repeat int) *Tween{\n return &Tween{self.Object.Call(\"repeat\", total, repeat)}\n}", "func (ns *NumStar) Concat(m, n string, s int) string {\n\tmLines := strings.Split(m, \"\\n\")\n\tnLines := strings.Split(n, \"\\n\")\n\tmLineCount := len(mLines)\n\tnLineCount := len(nLines)\n\tmWidth := len(mLines[0])\n\tnWidth := len(nLines[0])\n\n\tif mWidth == 0 {\n\t\treturn n\n\t}\n\n\tif nWidth == 0 {\n\t\treturn m\n\t}\n\n\tspaces := strings.Repeat(ns.space, s)\n\tif mLineCount < nLineCount {\n\t\tfor i := mLineCount; i < nLineCount; i++ {\n\t\t\tmLines = append(mLines, strings.Repeat(ns.space, mWidth))\n\t\t}\n\t} else {\n\t\tif nLineCount < mLineCount {\n\t\t\tfor i := nLineCount; i < mLineCount; i++ {\n\t\t\t\tnLines = append(nLines, strings.Repeat(ns.space, nWidth))\n\t\t\t}\n\t\t}\n\t}\n\n\tbuff := []string{}\n\n\tfor i, n := 0, len(mLines); i < n; i++ {\n\t\tbuff = append(buff, mLines[i]+spaces+nLines[i])\n\t}\n\n\treturn strings.Join(buff, \"\\n\")\n}", "func stringConstruction(a, b string) int {\n\tcount := 0\n\n\trepetitions := make(map[rune]int)\n\tfor _, char := range b {\n\t\trepetitions[char]++\n\t}\n\n\tfor {\n\t\tfor _, char := range a {\n\t\t\tif repetitions[char] > 0 {\n\t\t\t\trepetitions[char]--\n\t\t\t} else {\n\t\t\t\treturn count\n\t\t\t}\n\t\t}\n\t\tcount++\n\t}\n}", "func (r *Random) Repeat(min, max int, do func()) int {\n\tn := r.IntB(min, max)\n\tfor i := 0; i < n; i++ {\n\t\tdo()\n\t}\n\treturn n\n}", "func solveN(input string, n int) string {\n\t// iterate over the \"trimmed\" string.\n\tinput = strings.TrimSpace(input)\n\tbuf := make([]rune, n)\n\t//fmt.Println(\"input:\", input)\niteration:\n\tfor i, r := range input {\n\t\tbuf[i%n] = r\n\t\tif i < n-1 {\n\t\t\tcontinue\n\t\t}\n\t\t// if the buf contains ALL different values we are good.\n\t\t//fmt.Println(\"index:\", i, \"buf:\", string(buf[]))\n\t\tfor x := 0; x < n-1; x++ {\n\t\t\tfor y := x + 1; y < n; y++ {\n\t\t\t\t//fmt.Println(\"testing, x:\", x, \"y:\", y, \"buf[x]:\", buf[x], \"buf[y]:\", buf[y])\n\t\t\t\tif buf[x] == buf[y] {\n\t\t\t\t\tcontinue iteration\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// if we got here, we are done.\n\t\treturn fmt.Sprint(i + 1)\n\t}\n\tpanic(\"no solution\")\n}", "func flattenRepetition(r *syntax.Regexp) (bool, *syntax.Regexp) {\n\tif r.Op != syntax.OpConcat {\n\t\t// don't iterate sub-expressions if top-level is no OpConcat\n\t\treturn false, r\n\t}\n\n\tsub := r.Sub\n\tinRepetition := false\n\tif isConcatRepetition(r) {\n\t\tsub = sub[:1]\n\t\tinRepetition = true\n\n\t\t// create flattened regex repetition multiplying count\n\t\t// if nexted expression is also a repetition\n\t\tif s := sub[0]; isConcatRepetition(s) {\n\t\t\tcount := len(s.Sub) * len(r.Sub)\n\t\t\treturn true, &syntax.Regexp{\n\t\t\t\tOp: syntax.OpRepeat,\n\t\t\t\tSub: s.Sub[:1],\n\t\t\t\tMin: count,\n\t\t\t\tMax: count,\n\t\t\t\tFlags: r.Flags | s.Flags,\n\t\t\t}\n\t\t}\n\t}\n\n\t// recursively check if we can flatten sub-expressions\n\tchanged := false\n\tfor i, s := range sub {\n\t\tupd, tmp := flattenRepetition(s)\n\t\tchanged = changed || upd\n\t\tsub[i] = tmp\n\t}\n\n\tif !changed {\n\t\treturn false, r\n\t}\n\n\t// fix up top-level repetition with modified one\n\ttmp := *r\n\tif inRepetition {\n\t\tfor i := range r.Sub {\n\t\t\ttmp.Sub[i] = sub[0]\n\t\t}\n\t} else {\n\t\ttmp.Sub = sub\n\t}\n\treturn changed, &tmp\n}", "func generator() func(n int, times int) string {\n\n\thistory := make(map[string]bool)\n\n\treturn func(n int, times int) string {\n\t\tret := \"\"\n\t\tfor {\n\t\t\tl := rand.Intn(n) + 1\n\t\t\tfor t := 0; t != times; t++ {\n\t\t\t\tb := make([]rune, l)\n\t\t\t\tfor i := range b {\n\t\t\t\t\tb[i] = alphabet[rand.Intn(len(alphabet))]\n\t\t\t\t}\n\t\t\t\tret += \"/\" + string(b)\n\t\t\t}\n\t\t\tif history[ret] {\n\t\t\t\tret = \"\"\n\t\t\t} else {\n\t\t\t\thistory[ret] = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn ret\n\t}\n}", "func repeatedSubstringPattern(s string) bool {\r\n\ti, l := 0, len(s)\r\n\tif l < 2 {\r\n\t\treturn false\r\n\t}\r\n\tfor i = 0; i < l / 2; i++ {\r\n\t\tif l % (i+1) == 0 {\r\n\t\t\tif isRepeatedSubstring(s[:i+1], s) {\r\n\t\t\t\tbreak\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn i != l / 2\r\n}", "func RepeatUintN(v uint, n int) <-chan uint {\n\tch := make(chan uint, 1)\n\tgo func() {\n\t\tfor i := 0; i < n; i++ {\n\t\t\tch <- v\n\t\t}\n\t}()\n\treturn ch\n}", "func duplicateZeros(n int) string {\n\tvar zero string\n\tfor i := 0; i < n; i++ {\n\t\tzero += \"f0\"\n\t}\n\n\treturn zero\n}", "func ByteRepeat(repeatByte byte, n int) []byte {\r\n\r\n\tif n < 0 {\r\n\t\tpanic(\"negative repeat count\")\r\n\t}\r\n\r\n\toutput := make([]byte, n)\r\n\r\n\tfor i := 0; i < n; i++ {\r\n\t\toutput[i] = repeatByte\r\n\t}\r\n\r\n\treturn output\r\n}", "func RepeatFnString(\n\tctx context.Context,\n\tfn func() string,\n) <-chan string {\n\tch := make(chan string)\n\n\tgo func() {\n\t\tdefer close(ch)\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tcase ch <- fn():\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn ch\n}", "func RepeatKeyPress(ctx context.Context, kw *input.KeyboardEventWriter, key string, delay time.Duration, n int) error {\n\treturn uiauto.Repeat(\n\t\tn,\n\t\taction.Combine(\"press \"+key+\" and sleep\",\n\t\t\tkw.AccelAction(key),\n\t\t\taction.Sleep(delay),\n\t\t),\n\t)(ctx)\n}", "func TestRepeatXORKey(t *testing.T) {\n\tres := \"0b3637272a2b2e63622c2e69692a23693a2a3c6324202d623d63343c2a26226324272765272\" +\n\t\t\"a282b2f20430a652e2c652a3124333a653e2b2027630c692b20283165286326302e27282f\"\n\tpt := []byte(\"Burning 'em, if you ain't quick and nimble\\n\" +\n\t\t\"I go crazy when I hear a cymbal\")\n\tt.Log(\"plain text: \" + string(pt))\n\tcht := crytin.ToHex(crytin.XOR(pt, []byte(\"ICE\")))\n\tt.Log(\"cipher text: \" + cht)\n\tif res != cht {\n\t\tt.Error(\"Failed to perform : repeat XOR\")\n\t}\n}", "func NewRepeated(less LessFunc) *List {\n\tl := New(less)\n\tl.repeat = true\n\treturn l\n}", "func (eval *evaluator) Replicate(ctIn *Ciphertext, batchSize, n int, ctOut *Ciphertext) {\n\teval.InnerSum(ctIn, -batchSize, n, ctOut)\n}", "func String(n int, letters ...string) string {\n\tvar letterRunes []rune\n\tif len(letters) == 0 {\n\t\tletterRunes = defLetters\n\t} else {\n\t\tletterRunes = []rune(letters[0])\n\t}\n\n\tvar bb bytes.Buffer\n\tbb.Grow(n)\n\tl := uint32(len(letterRunes))\n\t// on each loop, generate one random rune and append to output\n\tfor i := 0; i < n; i++ {\n\t\tbb.WriteRune(letterRunes[binary.BigEndian.Uint32(Bytes(4))%l])\n\t}\n\treturn bb.String()\n}" ]
[ "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.7565077", "0.7467275", "0.7349311", "0.6917058", "0.6778702", "0.6775681", "0.67638284", "0.6744203", "0.6705067", "0.6694038", "0.6692013", "0.6633394", "0.6557991", "0.64464444", "0.6418512", "0.6418512", "0.6418512", "0.6329715", "0.63118017", "0.6209581", "0.62020266", "0.62020266", "0.61697304", "0.6145575", "0.6119008", "0.6021101", "0.5957112", "0.59362763", "0.59091187", "0.5899689", "0.58744156", "0.5821295", "0.5814315", "0.57882875", "0.5771986", "0.5696552", "0.56754816", "0.56717104", "0.56579643", "0.56462485", "0.55645853", "0.55615216", "0.5503409", "0.5463913", "0.54572815", "0.5440179", "0.5379959", "0.5316012", "0.5278417", "0.5266997", "0.52630216", "0.521997", "0.521283", "0.5204823", "0.5172791", "0.513131", "0.51262796", "0.51232845", "0.5118388", "0.50985175", "0.5094699", "0.5077239", "0.50622827", "0.50562584", "0.5043137", "0.504199", "0.5026028", "0.49759322", "0.4967574", "0.49579328", "0.4957916", "0.4957314", "0.49565488", "0.4939168", "0.49336916", "0.4931873", "0.49263766", "0.4924847", "0.4907378", "0.4900366" ]
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, new, n) }\n}", "func main() {\n\t// func Replace(s, old, new string, n int) string\n\tfmt.Println(strings.Replace(\"aaaa\", \"a\", \"b\", 2)) // 2 indicates how many times to do the replacement\n\t// => \"bbaa\"\n\n}", "func stringReplaceLast(s string, old string, replacement string, n int) string {\n\treturn stringReverse(strings.Replace(stringReverse(s), stringReverse(old), stringReverse(replacement), n))\n}", "func replaceDemo(src string, sub string, str string, i int) string {\n\treturn strings.Replace(src, sub, str, i)\n}", "func ReplaceAt(str string, replace string, begin int, end int) string {\n\treturn str[:begin] + replace + str[end:]\n}", "func (s *Stringish) ReplaceAll(old, new string) *Stringish {\n\treturn s.ReplaceN(old, new, -1)\n}", "func (d *DataPacket) replace(startIndex int, replacement []byte) {\n\td.data = append(d.data[:startIndex],\n\t\tappend(replacement, d.data[len(replacement)+startIndex:]...)...)\n}", "func ReplaceAtIndex(in string, r rune, i int) string {\n out := []rune(in)\n out[i] = r\n return string(out)\n}", "func Replace(haystack, needle, gold string) string {\n\treturn strings.Replace(haystack, needle, gold, -1)\n}", "func Replace(str string, repls map[string]string) string {\n\tfor k, v := range repls {\n\t\tstr = strings.Replace(str, k, v, -1)\n\t}\n\treturn str\n}", "func Replace(log string, oldRune, newRune rune) string {\n builder := new(strings.Builder)\n\tfor _, r := range log {\n if r == oldRune {\n builder.WriteRune(newRune)\n } else {\n builder.WriteRune(r)\n }\n }\n\n return builder.String()\n}", "func replace(n, replacement int, pos uint) int {\n\ti1 := n & MASKARRAY[pos]\n\tmask2 := replacement << (4 * pos)\n\treturn (i1 ^ mask2)\n}", "func (s stringSource) ReplaceRunes(byteOffset, runeCount int64, str string) {\n}", "func (s *Store) Replace(ln, from, to int, st string) error {\n\tif ln < 0 || ln >= len(s.lines) {\n\t\treturn fmt.Errorf(\"Replace: line %v out of range\", ln)\n\t}\n\ts.lines[ln].replaceString(from, to, st)\n\ts.AddUndoSet(s.lines[ln].changeSet(ln, s.undoFac))\n\treturn nil\n}", "func (v *VerbalExpression) Replace(src string, dst string) string {\n\treturn v.Regex().ReplaceAllString(src, dst)\n}", "func (op *Operation) replaceIndex(\n\tinput string,\n\tcount int,\n\tnv numberVar,\n) string {\n\tif len(op.numberOffset) == 0 {\n\t\tfor range nv.submatches {\n\t\t\top.numberOffset = append(op.numberOffset, 0)\n\t\t}\n\t}\n\n\tfor i := range nv.submatches {\n\t\tcurrent := nv.values[i]\n\n\t\top.startNumber = current.startNumber\n\t\tnum := op.startNumber + (count * current.step) + op.numberOffset[i]\n\t\tif len(current.skip) != 0 {\n\t\touter:\n\t\t\tfor {\n\t\t\t\tfor _, v := range current.skip {\n\t\t\t\t\tif num >= v.min && num <= v.max {\n\t\t\t\t\t\tnum += current.step\n\t\t\t\t\t\top.numberOffset[i] += current.step\n\t\t\t\t\t\tcontinue outer\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tn := int64(num)\n\t\tvar r string\n\t\tswitch current.format {\n\t\tcase \"r\":\n\t\t\tr = integerToRoman(num)\n\t\tcase \"h\":\n\t\t\tr = strconv.FormatInt(n, 16)\n\t\tcase \"o\":\n\t\t\tr = strconv.FormatInt(n, 8)\n\t\tcase \"b\":\n\t\t\tr = strconv.FormatInt(n, 2)\n\t\tdefault:\n\t\t\tr = fmt.Sprintf(current.index, num)\n\t\t}\n\n\t\tinput = current.regex.ReplaceAllString(input, r)\n\t}\n\n\treturn input\n}", "func replaceWithFours(theStr string, index int, currentPossibilities []string) []string {\n\tif index == len(theStr) {\n\t\treturn currentPossibilities\n\t}\n\n\tif theStr[index] == '1' {\n\t\ttheStr = replaceAtIndex(theStr, '4', index)\n\t\tif !contains(currentPossibilities, theStr) {\n\t\t\tcurrentPossibilities = append(currentPossibilities, theStr)\n\t\t}\n\t\tcurrentPossibilities = replaceWithFours(theStr, index+1, currentPossibilities)\n\n\t\ttheStr = replaceAtIndex(theStr, '1', index)\n\t\tcurrentPossibilities = replaceWithFours(theStr, index+1, currentPossibilities)\n\t} else {\n\t\tcurrentPossibilities = replaceWithFours(theStr, index+1, currentPossibilities)\n\t}\n\treturn currentPossibilities\n}", "func (re *RegexpStd) ReplaceAll(src, repl []byte) []byte {\n\t// n := 2\n\t// if bytes.IndexByte(repl, '$') >= 0 {\n\t// \tn = 2 * (re.numSubexp + 1)\n\t// }\n\t// srepl := \"\"\n\t// b := re.replaceAll(src, \"\", n, func(dst []byte, match []int) []byte {\n\t// \tif len(srepl) != len(repl) {\n\t// \t\tsrepl = string(repl)\n\t// \t}\n\t// \treturn re.expand(dst, srepl, src, \"\", match)\n\t// })\n\t// return b\n\tpanic(\"\")\n}", "func ReplaceAll(old, new string) MapFunc {\n\treturn func(s string) string { return strings.ReplaceAll(s, old, new) }\n}", "func Force(s string, n int) string {\n\tb := strings.Builder{}\n\ti := 0\n\tfor i+n < len(s) {\n\t\tb.WriteString(s[i : i+n])\n\t\tb.WriteByte('\\n')\n\t\ti += n\n\t}\n\tb.WriteString(s[i:])\n\treturn b.String()\n}", "func Replace(search interface{}, replace interface{}, subject interface{}, count int) (interface{}, error) {\n\n\tswitch search.(type) {\n\tcase string:\n\t\tswitch replace.(type) {\n\t\tcase string:\n\t\t\tswitch subject.(type) {\n\t\t\tcase string:\n\t\t\t\treturn strings.Replace(subject.(string), search.(string), replace.(string), count), nil\n\t\t\tcase []string:\n\t\t\t\tvar slice []string\n\t\t\t\tfor _, v := range subject.([]string) {\n\t\t\t\t\tslice = append(slice, strings.Replace(v, search.(string), replace.(string), count))\n\t\t\t\t}\n\t\t\t\treturn slice, nil\n\t\t\tdefault:\n\t\t\t\treturn nil, errors.New(\"Invalid parameters\")\n\t\t\t}\n\t\tdefault:\n\t\t\treturn nil, errors.New(\"Invalid parameters\")\n\t\t}\n\tcase []string:\n\t\tswitch replace.(type) {\n\t\tcase string:\n\t\t\tswitch subject.(type) {\n\t\t\tcase string:\n\t\t\t\tsub := subject.(string)\n\n\t\t\t\tfor _, v := range search.([]string) {\n\t\t\t\t\tsub = strings.Replace(sub, v, replace.(string), count)\n\t\t\t\t}\n\t\t\t\treturn sub, nil\n\n\t\t\tcase []string:\n\t\t\t\tvar slice []string\n\t\t\t\tfor _, v := range subject.([]string) {\n\t\t\t\t\tsli, err := Replace(search, replace, v, count)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\tslice = append(slice, sli.(string))\n\t\t\t\t}\n\t\t\t\treturn slice, nil\n\t\t\tdefault:\n\t\t\t\treturn nil, errors.New(\"Invalid parameters\")\n\t\t\t}\n\t\tcase []string:\n\t\t\tswitch subject.(type) {\n\t\t\tcase string:\n\t\t\t\trep := replace.([]string)\n\t\t\t\tsub := subject.(string)\n\t\t\t\tfor i, s := range search.([]string) {\n\t\t\t\t\tif i < len(rep) {\n\t\t\t\t\t\tsub = strings.Replace(sub, s, rep[i], count)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsub = strings.Replace(sub, s, \"\", count)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn sub, nil\n\t\t\tcase []string:\n\t\t\t\tvar slice []string\n\t\t\t\tfor _, v := range subject.([]string) {\n\t\t\t\t\tsli, err := Replace(search, replace, v, count)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\tslice = append(slice, sli.(string))\n\t\t\t\t}\n\t\t\t\treturn slice, nil\n\t\t\tdefault:\n\t\t\t\treturn nil, errors.New(\"Invalid parameters\")\n\t\t\t}\n\t\tdefault:\n\t\t\treturn nil, errors.New(\"Invalid parameters\")\n\t\t}\n\tdefault:\n\t\treturn nil, errors.New(\"Invalid parameters\")\n\t}\n}", "func (c *CodeInstance) Replace(s *style.Shortcut) (reqs []*docs.Request) {\n\tfor {\n\t\tif res := s.Regex.FindStringSubmatchIndex(c.Code); res != nil {\n\t\t\tutf8DelStart, utf8DelEnd := res[0], res[1]\n\t\t\tutf16DelStart, utf16DelEnd := getUTF16SubstrIndices(c.Code[utf8DelStart:utf8DelEnd], c.Code, *c.StartIndex)\n\n\t\t\t// delete target and insert replacement string\n\t\t\tutf16DelRange := request.GetRange(utf16DelStart, utf16DelEnd, \"\")\n\t\t\treqs = append(reqs, request.Delete(utf16DelRange))\n\t\t\treqs = append(reqs, request.Insert(s.Replace, utf16DelStart))\n\n\t\t\t// update end index for utf16 difference\n\t\t\tutf16InsSize := GetUtf16StringSize(s.Replace)\n\t\t\tnewEndIndex := *c.EndIndex + utf16InsSize - (utf16DelEnd - utf16DelStart)\n\t\t\tc.EndIndex = &newEndIndex\n\n\t\t\t// replace c.Code\n\t\t\tc.Code = c.Code[:utf8DelStart] + s.Replace + c.Code[utf8DelEnd:]\n\t\t\tcontinue\n\t\t}\n\t\treturn\n\t}\n}", "func replace(s split, save func(string)) {\n\tif len(s.R) > 0 {\n\t\tfor _, b := range letters {\n\t\t\tc := string(b)\n\t\t\tsave(s.L + c + s.R[1:])\n\t\t}\n\t}\n}", "func Replace(log string, oldRune, newRune rune) string {\n\treplacer := func(char rune) rune {\n\t\tif char == oldRune {\n\t\t\treturn newRune\n\t\t}\n\t\treturn char\n\t}\n\n\treturn strings.Map(replacer, log)\n}", "func replace_string(src []byte, what string, to string) []byte {\n\tvar result = []byte{}\n\twhat_b := []byte(what)\n\tto_b := []byte(to)\n\ti := bytes.Index(src, what_b)\n\tj := 0\n\tfor i >= 0 {\n\t\ti = i + j\n\t\tresult = append(result, src[j:i]...)\n\t\tresult = append(result, to_b...)\n\t\tif i+len(what_b) < len(src) {\n\t\t\tj = i + len(what_b)\n\t\t\ti = bytes.Index(src[i+len(what_b):], what_b)\n\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\n\t}\n\tresult = append(result, src[j:]...)\n\treturn result\n}", "func (br BytesReplacer) Replace(p []byte) []byte {\n\tfor _, pair := range br {\n\t\tp = bytes.Replace(p, pair[0], pair[1], -1)\n\t}\n\treturn p\n}", "func (s *stringIndexBasedReplacer) Replace(url string, macroProvider *macroProvider) (string, error) {\n\ttmplt := s.getTemplate(url)\n\n\tvar result strings.Builder\n\tcurrentIndex := 0\n\tdelimLen := len(delimiter)\n\tfor i, index := range tmplt.startingIndices {\n\t\tmacro := url[index : tmplt.endingIndices[i]+1]\n\t\t// copy prev part\n\t\tresult.WriteString(url[currentIndex : index-delimLen])\n\t\tvalue := macroProvider.GetMacro(macro)\n\t\tif value != \"\" {\n\t\t\tresult.WriteString(value)\n\t\t}\n\t\tcurrentIndex = index + len(macro) + delimLen\n\t}\n\tresult.WriteString(url[currentIndex:])\n\treturn result.String(), nil\n}", "func (t *T) Replace(needle string) (string, error) {\n\tvar out strings.Builder\n\tcur := 0\n\tif err := t.Search(needle, func(start, end int, match string) error {\n\t\tout.WriteString(needle[cur:start])\n\t\tout.WriteString(match)\n\t\tcur = end\n\t\treturn nil\n\t}); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn out.String(), nil\n}", "func StringReplace(src, rep, sub string) (n string) {\n\t// make sure the src has the char we want to replace. \n\tif strings.Count(src, rep) > 0 {\n\t\trunes := src // convert to utf-8 runes. \n\t\tfor i := 0; i < len(runes); i++ {\n\t\t\tl := string(runes[i]) // grab our rune and convert back to string. \n\t\t\tif l == rep {\n\t\t\t\tn += sub\n\t\t\t} else {\n\t\t\t\tn += l\n\t\t\t}\n\t\t}\n\t\treturn n\n\t}\n\treturn src\n}", "func (nd *namedDirectories) Replace(s string) string {\n\tif match := nd.match(s); match != \"\" {\n\t\tif !strings.HasSuffix(match, \"/\") {\n\t\t\tmatch = match + \"/\"\n\t\t}\n\t\treturn match + strings.SplitN(s, \"/\", 2)[1]\n\t}\n\treturn s\n}", "func (s *Str) ReplaceAll(old, new string) *Str {\n\ts.val = strings.ReplaceAll(s.val, old, new)\n\treturn s\n}", "func replace(input, target, replacement string) string {\n\tif idx := strings.LastIndex(input, target); idx >= 0 {\n\t\treturn input[0:idx] + replacement\n\t}\n\n\treturn input\n}", "func replace(v []uint64, n int, x uint64) []uint64 {\n\tif n == 0 {\n\t\tif len(v) > 0 && v[0] == x {\n\t\t\treturn v\n\t\t}\n\t\tv = append(v, 0)\n\t\tcopy(v[1:], v)\n\t} else if n < len(v) {\n\t\tcopy(v[1:], v[n:])\n\t\tv = v[:len(v)-(n-1)]\n\t} else if len(v) == 0 {\n\t\treturn []uint64{x}\n\t} else {\n\t\tv = v[:1]\n\t}\n\tv[0] = x\n\treturn v\n}", "func replace(vbytes []byte, replace, part string, index int) (old, new string, loc []int, newcontents []byte, err error) {\n\tre := regexp.MustCompile(semverMatcher)\n\tif index == 0 {\n\t\tloc = re.FindIndex(vbytes)\n\t} else {\n\t\tlocs := re.FindAllIndex(vbytes, -1)\n\t\tif locs == nil {\n\t\t\treturn \"\", \"\", nil, nil, fmt.Errorf(\"Did not find semantic version\")\n\t\t}\n\t\tlocsLen := len(locs)\n\t\tif index >= locsLen {\n\t\t\treturn \"\", \"\", nil, nil, fmt.Errorf(\"semver index to replace out of range. Found %v, want %v\", locsLen, index)\n\t\t}\n\t\tif index < 0 {\n\t\t\tloc = locs[locsLen+index]\n\t\t} else {\n\t\t\tloc = locs[index]\n\t\t}\n\t}\n\t// fmt.Println(loc)\n\tif loc == nil {\n\t\treturn \"\", \"\", nil, nil, fmt.Errorf(\"Did not find semantic version\")\n\t}\n\tvs := string(vbytes[loc[0]:loc[1]])\n\n\tif replace == \"\" {\n\t\tv := semver.New(vs)\n\t\tswitch part {\n\t\tcase \"major\":\n\t\t\tv.BumpMajor()\n\t\tcase \"minor\":\n\t\t\tv.BumpMinor()\n\t\tdefault:\n\t\t\tv.BumpPatch()\n\t\t}\n\t\treplace = v.String()\n\t}\n\n\tlen1 := loc[1] - loc[0]\n\tadditionalBytes := len(replace) - len1\n\t// Create and fill an extended buffer\n\tb := make([]byte, len(vbytes)+additionalBytes)\n\tcopy(b[:loc[0]], vbytes[:loc[0]])\n\tcopy(b[loc[0]:loc[1]+additionalBytes], replace)\n\tcopy(b[loc[1]+additionalBytes:], vbytes[loc[1]:])\n\t// fmt.Printf(\"writing: '%v'\", string(b))\n\n\treturn vs, replace, loc, b, nil\n}", "func ReplaceSlice(b []byte, start, end int, repl []byte) []byte {\n\tdst := make([]byte, 0, len(b)-end+start+len(repl))\n\tdst = append(dst, b[:start]...)\n\tdst = append(dst, repl...)\n\tdst = append(dst, b[end:]...)\n\treturn dst\n}", "func Replace[T comparable](collection []T, old T, new T, n int) []T {\n\tsize := len(collection)\n\tresult := make([]T, 0, size)\n\n\tfor _, item := range collection {\n\t\tif item == old && n != 0 {\n\t\t\tresult = append(result, new)\n\t\t\tn--\n\t\t} else {\n\t\t\tresult = append(result, item)\n\t\t}\n\t}\n\n\treturn result\n}", "func Replace(toReplace string, Replaceval string, regx string) string {\n\tre := regexp.MustCompile(regx)\n\treturn re.ReplaceAllString(toReplace, Replaceval)\n}", "func (c *cache) Replace(k string, x []byte, d time.Duration) error {\n\to, found := c.Get(k)\n\tif !found {\n\t\treturn fmt.Errorf(\"Item %s doesn't exist\", k)\n\t}\n\tsize := int32(len(o.([]byte)))\n\tatomic.AddInt32(&c.Statistic.ReplaceCount, 1)\n\tatomic.AddInt32(&c.Statistic.Size, int32(len(x))-size)\n\tc.set(k, x, d)\n\treturn nil\n}", "func (tv *TextView) QReplaceReplace(midx int) {\n\tnm := len(tv.QReplace.Matches)\n\tif midx >= nm {\n\t\treturn\n\t}\n\tm := tv.QReplace.Matches[midx]\n\treg := tv.Buf.AdjustReg(m.Reg)\n\tpos := reg.Start\n\ttv.Buf.DeleteText(reg.Start, reg.End, true, true)\n\ttv.Buf.InsertText(pos, []byte(tv.QReplace.Replace), true, true)\n\ttv.Highlights[midx] = TextRegionNil\n\ttv.SetCursor(pos)\n\ttv.SavePosHistory(tv.CursorPos)\n\ttv.ScrollCursorToCenterIfHidden()\n\ttv.QReplaceSig()\n}", "func replace(s string) string {\n\treturn matches[s]\n}", "func textReplace(data string) string {\n\tfor k, v := range textReplaceMap {\n\t\tdata = strings.Replace(data, k, v, -1)\n\t}\n\treturn data\n}", "func main() {\n\tm1 := \"Hello word\"\n\t//m2 := \"word\"\n\tfmt.Println(strings.ReplaceAll(m1, \"Hello\", \"My\"))\n}", "func TestReplace(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\tstrftime string\n\t\torigtime string\n\t}{\n\t\t{\"kitchen\", \"%H:%M%p\", \"12:00PM\"},\n\t\t{\"RFC3339\", \"%Y-%m-%dT%H:%M:%S\", \"2002-10-02T12:00:00\"},\n\t\t{\"syslog1\", \"%b %e %H:%M:%S\", \"Dec 5 07:52:10\"},\n\t\t{\"syslog2\", \"%b %e %H:%M:%S\", \"Dec 10 07:52:10\"},\n\t\t{\"syslog3\", \"%b %e %H:%M:%S\", \"Dec 10 13:52:10\"},\n\t\t{\"RFC1123Z\", \"%a, %d %b %Y %H:%M:%S %z\", \"Mon, 02 Jan 2006 15:04:05 -0700\"},\n\t}\n\tfor _, test := range tests {\n\t\ttestReplace(t, test.name, test.strftime, test.origtime)\n\t}\n}", "func replace(src, dst string) error {\n\tkernel32, err := syscall.LoadLibrary(\"kernel32.dll\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer syscall.FreeLibrary(kernel32)\n\tmoveFileExUnicode, err := syscall.GetProcAddress(kernel32, \"MoveFileExW\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsrcString, err := syscall.UTF16PtrFromString(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdstString, err := syscall.UTF16PtrFromString(dst)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsrcPtr := uintptr(unsafe.Pointer(srcString))\n\tdstPtr := uintptr(unsafe.Pointer(dstString))\n\n\tMOVEFILE_REPLACE_EXISTING := 0x1\n\tflag := uintptr(MOVEFILE_REPLACE_EXISTING)\n\n\t_, _, callErr := syscall.Syscall(uintptr(moveFileExUnicode), 3, srcPtr, dstPtr, flag)\n\tif callErr != 0 {\n\t\treturn callErr\n\t}\n\n\treturn nil\n}", "func ReplaceTransliterationsMaxLen(str string, maxLen int) string {\n\tvar b strings.Builder\n\tif len(str) < maxLen {\n\t\tb.Grow(len(str))\n\t} else {\n\t\tb.Grow(maxLen)\n\t}\n\tl := 0\n\tfor _, r := range str {\n\t\tif r == unicode.ReplacementChar {\n\t\t\tcontinue // Ignore invalid UTF-8 sequences\n\t\t}\n\t\tif repl, ok := transliterations[r]; ok {\n\t\t\tb.WriteString(repl)\n\t\t\tl += len(repl)\n\t\t} else {\n\t\t\tb.WriteRune(r)\n\t\t\tl++\n\t\t}\n\t\tif l >= maxLen {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn b.String()\n}", "func ReplaceTransliterations(str string) string {\n\treturn ReplaceTransliterationsMaxLen(str, math.MaxInt)\n}", "func ReplaceSubstring(str, beg, end, rep string) string {\n\tresult := str\n\tstartIndex := strings.Index(str, beg)\n\tif startIndex != -1 {\n\t\tstartIndex += len(beg)\n\t\tendIndex := strings.Index(str[startIndex:], end)\n\t\tif endIndex != -1 {\n\t\t\tendIndex += len(str[:startIndex])\n\t\t\tresult = str[:startIndex] + rep + str[endIndex:]\n\t\t}\n\t}\n\treturn result\n}", "func Replace(fstTmpl *fasttemplate.Template, replaceMap map[string]string, allowUnresolved bool, prefixFilter string) (string, error) {\n\tvar unresolvedErr error\n\treplacedTmpl := fstTmpl.ExecuteFuncString(func(w io.Writer, tag string) (int, error) {\n\t\tif !strings.HasPrefix(tag, prefixFilter) {\n\t\t\treturn w.Write([]byte(fmt.Sprintf(\"{{%s}}\", tag)))\n\t\t}\n\t\treplacement, ok := replaceMap[tag]\n\t\tif !ok {\n\t\t\tif allowUnresolved {\n\t\t\t\t// just write the same string back\n\t\t\t\treturn w.Write([]byte(fmt.Sprintf(\"{{%s}}\", tag)))\n\t\t\t}\n\t\t\tunresolvedErr = errors.Errorf(errors.CodeBadRequest, \"failed to resolve {{%s}}\", tag)\n\t\t\treturn 0, nil\n\t\t}\n\t\t// The following escapes any special characters (e.g. newlines, tabs, etc...)\n\t\t// in preparation for substitution\n\t\treplacement = strconv.Quote(replacement)\n\t\treplacement = replacement[1 : len(replacement)-1]\n\t\treturn w.Write([]byte(replacement))\n\t})\n\tif unresolvedErr != nil {\n\t\treturn \"\", unresolvedErr\n\t}\n\treturn replacedTmpl, nil\n}", "func (c *Seaweed) Replace(fileID string, newContent io.Reader, fileName string, size int64, collection, ttl string, deleteFirst bool) (err error) {\n\tfp := NewFilePartFromReader(ioutil.NopCloser(newContent), fileName, size)\n\tfp.Collection, fp.TTL = collection, ttl\n\tfp.FileID = fileID\n\terr = c.ReplaceFilePart(fp, deleteFirst)\n\treturn\n}", "func replaceRange(in []byte, sub []byte, start, end int) []byte {\n\tout := make([]byte, 0, len(in)+len(sub)+start-end)\n\tout = append(out, in[:start]...)\n\tout = append(out, sub...)\n\tout = append(out, in[end:]...)\n\treturn out\n}", "func newlReplacer(s string) string {\n\ts = strings.Replace(s, \"\\n\", `\\n`, -1)\n\ts = strings.Replace(s, \"\\r\", `\\r`, -1)\n\treturn s\n}", "func (re *RegexpStd) ReplaceAllString(src, repl string) string {\n\trep, err := re.p.Replace(src, repl, 0, -1)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn src\n\t}\n\treturn rep\n}", "func replace() {\n\tfor k, v := range replacements {\n\t\t//Get all the indexes for a Key\n\t\tindexes := allIndiciesForString(k, molecule)\n\t\tfor _, i := range indexes {\n\t\t\t//Save the head up to the index\n\t\t\thead := molecule[:i]\n\t\t\t//Save the tail from the index + lenght of the searched key\n\t\t\ttail := molecule[i+len(k):]\n\n\t\t\t//Create a string for all the replacement possbilities\n\t\t\tfor _, com := range v {\n\t\t\t\tnewMol := head + com + tail\n\t\t\t\tif !arrayutils.ContainsString(combinations, newMol) {\n\t\t\t\t\tcombinations = append(combinations, newMol)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (l *LexInner) Replace(start Mark, with string) {\n\tif with != \"\" {\n\t\tl.mark.replace = &Replacer{start, l.mark, with}\n\t}\n}", "func (ed *Editor) Replace(s string) {\n\ted.initTransformation()\n\ted.putString(s)\n\ted.commitTransformation()\n\ted.autoscroll()\n\ted.dirty = true\n}", "func RepStandard(c string, n int) string {\n\treturn strings.Repeat(c, n)\n}", "func (fn *formulaFuncs) replace(name string, argsList *list.List) formulaArg {\n\tif argsList.Len() != 4 {\n\t\treturn newErrorFormulaArg(formulaErrorVALUE, fmt.Sprintf(\"%s requires 4 arguments\", name))\n\t}\n\tsourceText, targetText := argsList.Front().Value.(formulaArg).Value(), argsList.Back().Value.(formulaArg).Value()\n\tstartNumArg, numCharsArg := argsList.Front().Next().Value.(formulaArg).ToNumber(), argsList.Front().Next().Next().Value.(formulaArg).ToNumber()\n\tif startNumArg.Type != ArgNumber {\n\t\treturn startNumArg\n\t}\n\tif numCharsArg.Type != ArgNumber {\n\t\treturn numCharsArg\n\t}\n\tsourceTextLen, startIdx := len(sourceText), int(startNumArg.Number)\n\tif startIdx > sourceTextLen {\n\t\tstartIdx = sourceTextLen + 1\n\t}\n\tendIdx := startIdx + int(numCharsArg.Number)\n\tif endIdx > sourceTextLen {\n\t\tendIdx = sourceTextLen + 1\n\t}\n\tif startIdx < 1 || endIdx < 1 {\n\t\treturn newErrorFormulaArg(formulaErrorVALUE, formulaErrorVALUE)\n\t}\n\tresult := sourceText[:startIdx-1] + targetText + sourceText[endIdx-1:]\n\treturn newStringFormulaArg(result)\n}", "func (el *EL) RotateN(s string, n int) (string, error) {\n\tvar str string\n\ts = toUpper(s)\n\n\tisValid, err := el.isValidString(s)\n\tif !isValid {\n\t\treturn \"\", err\n\t}\n\n\tfor _, c := range []rune(s) {\n\t\tif unicode.IsSpace(c) || unicode.IsSymbol(c) || unicode.IsPunct(c) {\n\t\t\tstr += string(c)\n\t\t\tcontinue\n\t\t}\n\n\t\tnewVal := (el.runeAlphabet[c] + n) % el.alphabetLength\n\t\tstr += string(el.intAlphabet[newVal])\n\t}\n\treturn str, nil\n}", "func (tv *TextView) QReplaceReplaceAll(midx int) {\n\tnm := len(tv.QReplace.Matches)\n\tif midx >= nm {\n\t\treturn\n\t}\n\tfor mi := midx; mi < nm; mi++ {\n\t\ttv.QReplaceReplace(mi)\n\t}\n}", "func StringReplaceBySlice(subject string, search, replace []string) string {\n\tif len(search) != len(replace) {\n\t\tlog.Printf(\"Unable to replace in string by slice, length of search and replace slices are not equals!\"+\n\t\t\t\" string: %s, search: %v, replace: %v \", subject, search, replace)\n\n\t\treturn subject\n\t}\n\n\treplaceData := make([]string, 0)\n\tfor key, srch := range search {\n\t\treplaceData = append(replaceData, srch)\n\t\treplaceData = append(replaceData, replace[key])\n\t}\n\n\treplacer := strings.NewReplacer(replaceData...)\n\tsubject = replacer.Replace(subject)\n\n\treturn subject\n}", "func Wrap(s string, n int) string {\n\tb := strings.Builder{}\n\twrap(s, n, &b)\n\treturn b.String()\n}", "func AdjustStr(f S, index int, slice []string) []string {\n\tr := make([]string, len(slice))\n\tr = slice[:]\n\ttmp := f(r[index])\n\tr[index] = tmp\n\n\treturn r\n}", "func ExampleReplaceTable() {\n\tt := ReplaceStringTable{\n\t\t\"Hello\", \"Hi\",\n\t\t\"World\", \"Gophers\",\n\t}\n\tr := transform.NewReader(strings.NewReader(\"Hello, World\"), ReplaceAll(t))\n\tio.Copy(os.Stdout, r)\n\t// Output: Hi, Gophers\n}", "func (re *RegexpStd) ReplaceAllStringFunc(src string, repl func(string) string) string {\n\trep, err := re.p.ReplaceFunc(src, makeRepFunc(repl), 0, -1)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn src\n\t}\n\treturn rep\n}", "func (r *Render) Replace(fstTmpl *fasttemplate.Template, replaceMap map[string]string, allowUnresolved bool) (string, error) {\n\tvar unresolvedErr error\n\treplacedTmpl := fstTmpl.ExecuteFuncString(func(w io.Writer, tag string) (int, error) {\n\n\t\ttrimmedTag := strings.TrimSpace(tag)\n\n\t\treplacement, ok := replaceMap[trimmedTag]\n\t\tif len(trimmedTag) == 0 || !ok {\n\t\t\tif allowUnresolved {\n\t\t\t\t// just write the same string back\n\t\t\t\treturn w.Write([]byte(fmt.Sprintf(\"{{%s}}\", tag)))\n\t\t\t}\n\t\t\tunresolvedErr = fmt.Errorf(\"failed to resolve {{%s}}\", tag)\n\t\t\treturn 0, nil\n\t\t}\n\t\t// The following escapes any special characters (e.g. newlines, tabs, etc...)\n\t\t// in preparation for substitution\n\t\treplacement = strconv.Quote(replacement)\n\t\treplacement = replacement[1 : len(replacement)-1]\n\t\treturn w.Write([]byte(replacement))\n\t})\n\tif unresolvedErr != nil {\n\t\treturn \"\", unresolvedErr\n\t}\n\n\treturn replacedTmpl, nil\n}", "func replace(b []byte, matches [][][]byte) []byte {\n\treturn replacer.ReplaceAllFunc(b, func(b []byte) []byte {\n\t\ti, err := strconv.Atoi(string(b[1:]))\n\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\treturn matches[0][i]\n\t})\n}", "func Replace_strings(inFile string, kvMap map[string]string) (string, error) {\n\n\t// read original file contents into buffer\n\tbuffer, err := ioutil.ReadFile(inFile)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tcontents := string(buffer)\n\n\t// replace strings using a map\n\t// keys k are the old values being replaced\n\t// values v are the values replacing the coresponding keys\n\tfor k, v := range kvMap {\n\t\tcontents = strings.Replace(contents, k, v, -1)\n\t}\n\n\treturn contents, nil\n}", "func TestReplace(t *testing.T) {\n\tdb, err := Open(db_filename, \"c\")\n\tdefer db.Close()\n\tdefer os.Remove(db_filename)\n\n\tif err != nil {\n\t\tt.Error(\"Couldn't create database\")\n\t}\n\n\terr = db.Insert(\"foo\", \"bar\")\n\terr = db.Replace(\"foo\", \"biz\")\n\tkey, err := db.Fetch(\"foo\")\n\tif err != nil || key != \"biz\" {\n\t\tt.Error(\"Replace didn't update key correctly\")\n\t}\n}", "func (r *Replacer) Replace(start, stop int, word string) {\n\tr.ReplaceBy(NewReplacement(start, stop, word))\n}", "func ReplaceFirst(re *regexp.Regexp, src, repl []byte) []byte {\n\tif m := re.FindSubmatchIndex(src); m != nil {\n\t\tout := make([]byte, m[0])\n\t\tcopy(out, src[0:m[0]])\n\t\tout = re.Expand(out, repl, src, m)\n\t\tif m[1] < len(src) {\n\t\t\tout = append(out, src[m[1]:]...)\n\t\t}\n\t\treturn out\n\t}\n\tout := make([]byte, len(src))\n\tcopy(out, src)\n\treturn out\n}", "func ReplaceCodes(s string) string {\n\tloadMap()\n\treturn codeReplacer.Replace(s)\n}", "func (re *RegexpStd) ReplaceAllFunc(src []byte, repl func([]byte) []byte) []byte {\n\t// return re.replaceAll(src, \"\", 2, func(dst []byte, match []int) []byte {\n\t// \treturn append(dst, repl(src[match[0]:match[1]])...)\n\t// })\n\tpanic(\"\")\n}", "func (fn *formulaFuncs) REPLACE(argsList *list.List) formulaArg {\n\treturn fn.replace(\"REPLACE\", argsList)\n}", "func InReplace(text, allowed []byte, c byte) []byte {\n\tif len(text) == 0 {\n\t\treturn nil\n\t}\n\n\tvar found bool\n\tfor x := 0; x < len(text); x++ {\n\t\tfound = false\n\t\tfor y := 0; y < len(allowed); y++ {\n\t\t\tif text[x] == allowed[y] {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\ttext[x] = c\n\t\t}\n\t}\n\treturn text\n}", "func ReplaceInContent(vbytes []byte, replaceWith string, index int) (old, new string, loc []int, newcontents []byte, err error) {\n\treturn replace(vbytes, replaceWith, \"\", index)\n}", "func Replace(s string) (string, bool) {\n\tvar matched bool\n\tfor _, m := range Config.Mappings {\n\t\tif m.re.MatchString(s) {\n\t\t\ts, matched = m.Replace(s)\n\n\t\t\t// If we get an exit on match, ditch it.\n\t\t\t// TODO: This should be refactored.\n\t\t\tif m.ExitOnMatch {\n\t\t\t\treturn s, matched\n\t\t\t}\n\t\t}\n\t}\n\n\treturn s, matched\n}", "func Replace(filePath string, replacements ...PlaceholderReplacement) error {\n\tcontent, err := ReadFile(filePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, replacement := range replacements {\n\t\tcontent = strings.ReplaceAll(content, replacement.PlaceholderValue, replacement.DesiredValue)\n\t}\n\n\treturn ioutil.WriteFile(filePath, []byte(content), 0666)\n}", "func Substitute(str string, mapping map[string]string) string {\n\tfor key, val := range mapping {\n\t\tstr = strings.Replace(str, key, val, -1)\n\t}\n\treturn str\n}", "func (cc *computer) replaceInstruction(ind int, instr instruction) {\n\tif ind < 0 || ind >= len(cc.instructions) {\n\t\treturn\n\t}\n\tcc.instructions[ind] = instr\n}", "func Replace() *ReplaceOptions {\n\treturn &ReplaceOptions{}\n}", "func ReplaceByMap(origin string, replaces map[string]string) string {\n\tfor k, v := range replaces {\n\t\torigin = strings.Replace(origin, k, v, -1)\n\t}\n\treturn origin\n}", "func SwapNumeral(group string, i int) string {\n\tnum := []string{\n\t\t\"zero\", \"one\", \"two\", \"three\", \"four\", \"five\",\n\t\t\"six\", \"seven\", \"eight\", \"nine\", \"ten\", \"eleven\", \"twelve\",\n\t}\n\tif i > len(num) {\n\t\treturn \"\"\n\t}\n\tre := regexp.MustCompile(strconv.Itoa(i))\n\ts := re.ReplaceAllString(group, num[i])\n\treturn Format(s)\n}", "func wrapN(i, slop int, s string) (string, string) {\n\tif i+slop > len(s) {\n\t\treturn s, \"\"\n\t}\n\n\tw := strings.LastIndexAny(s[:i], \" \\t\\n\")\n\tif w <= 0 {\n\t\treturn s, \"\"\n\t}\n\tnlPos := strings.LastIndex(s[:i], \"\\n\")\n\tif nlPos > 0 && nlPos < w {\n\t\treturn s[:nlPos], s[nlPos+1:]\n\t}\n\treturn s[:w], s[w+1:]\n}", "func ReplaceRune(str string, new rune, index int) string {\n\treturn ReplaceAt(str, string(new), index, index+1)\n}", "func (dt DateTime) Replace(year int, month int, day int, hour int, minute int, second int, nanosecond int) DateTime {\n\treturn dt.ReplaceYear(year).\n\t\tReplaceMonth(month).\n\t\tReplaceDay(day).\n\t\tReplaceHour(hour).\n\t\tReplaceMinute(minute).\n\t\tReplaceSecond(second).\n\t\tReplaceNanosecond(nanosecond)\n}", "func (g *TemplateGenerator) Replace(args []string) ([]string, error) {\n\tcompiled := make([]string, len(args))\n\tfor i, a := range args {\n\t\tstr, err := g.replaceArgument(a)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to compile argument at position %d\", i)\n\t\t}\n\t\tcompiled[i] = str\n\t}\n\n\treturn compiled, nil\n}", "func main() {\n\tfmt.Println(replaceElements([]int{17, 18, 5, 4, 6, 1}))\n}", "func (c FakeClassList) Replace(oldClass, newClass string) {\n\tc.Remove(oldClass)\n\tc.Add(newClass)\n}", "func (re *RegexpStd) ReplaceAllLiteralString(src, repl string) string {\n\t// return string(re.ReplaceAll(nil, src, 2, func(dst []byte, match []int) []byte {\n\t// \treturn append(dst, repl...)\n\t// }))\n\tpanic(\"\")\n}", "func Replace(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tif r.Body == nil {\n\t\thttp.Error(w, http.StatusText(400), http.StatusBadRequest)\n\t\treturn\n\t}\n\tleague := p.ByName(\"league\")\n\tvenue := p.ByName(\"venue\")\n\tseason := p.ByName(\"season\")\n\tconference := p.ByName(\"conference\")\n\tiSeason, err := strconv.Atoi(season)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// remove from DB, conference NULL = no conferences in league\n\tnum, err := removeFromDB(league, venue, conference, iSeason)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif num < 1 {\n\t\thttp.Error(w, \"no documents found to replace\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\tfmt.Printf(\"removed %d documents from %s, %d:\\n\", num, league, iSeason)\n\n\t// After removing from DB insert new standings\n\tstnds, err := insertDB(r)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tsjson, err := json.Marshal(stnds)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusCreated) // 201\n\tfmt.Fprintf(w, \"%s\\n\", sjson)\n}", "func juggle(s string, n int) string {\n\tn = n % len(s)\n\tif n == 0 {\n\t\treturn s\n\t}\n\tbuf := make([]byte, len(s))\n\tcopy(buf, s)\n\tfor i := 0; i < n; i++ {\n\t\tvar (\n\t\t\ttmp byte\n\t\t\tj int\n\t\t)\n\t\ttmp = buf[i]\n\t\tfor j = i; j < len(buf)-n; j += n {\n\t\t\tbuf[j] = buf[j+n]\n\t\t}\n\t\tif i != 0 {\n\t\t\tbuf[j] = buf[len(buf)-1]\n\t\t}\n\t\tbuf[len(buf)-1] = tmp\n\t}\n\treturn string(buf)\n}", "func NewReplacement(start, stop int, word string) Replacement {\n\treturn Replacement{start, stop, word}\n}", "func (v *SourceSearchContext) Replace(start, end *gtk.TextIter, replace string) (bool, error) {\n\tvar err *C.GError = nil\n\tcstr := C.CString(replace)\n\tdefer C.free(unsafe.Pointer(cstr))\n\n\tc := C.gtk_source_search_context_replace(\n\t\tv.native(),\n\t\tnativeTextIter(start), nativeTextIter(end),\n\t\t(*C.gchar)(cstr),\n\t\tC.gint(len(replace)),\n\t\t&err)\n\n\tif err != nil {\n\t\tdefer C.g_error_free(err)\n\t\treturn gobool(c), errors.New(goString(err.message))\n\t}\n\treturn gobool(c), nil\n}", "func RepeatStringN(v string, n int) <-chan string {\n\tch := make(chan string, 1)\n\tgo func() {\n\t\tfor i := 0; i < n; i++ {\n\t\t\tch <- v\n\t\t}\n\t}()\n\treturn ch\n}", "func (n Notification) Replace(id uint32) (newID uint32, err error) {\n\treturn notify(n.Name, n.Summary, n.Body, n.IconPath, id, nil, n.Urgency.asHint(), n.timeoutInMS())\n}", "func (tb *Textbox) Replace(a, b rune) (int, error) {\n\tif !utf8.ValidRune(a) {\n\t\treturn 0, errors.New(\"invalid rune\")\n\t}\n\n\tcount := 0\n\tfor i := range tb.pixels {\n\t\tif tb.pixels[i] == a {\n\t\t\ttb.pixels[i] = b\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count, nil\n}", "func (that *StrAnyMap) Replace(data map[string]interface{}) {\n\tthat.mu.Lock()\n\tthat.data = data\n\tthat.mu.Unlock()\n}", "func (re *RegexpStd) ReplaceAllLiteral(src, repl []byte) []byte {\n\t// return re.replaceAll(src, \"\", 2, func(dst []byte, match []int) []byte {\n\t// \treturn append(dst, repl...)\n\t// })\n\tpanic(\"\")\n}" ]
[ "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.5569235", "0.5556703", "0.5539715", "0.55287886", "0.5492159", "0.54786444", "0.5460441", "0.54317105", "0.541887", "0.5389922", "0.5388912", "0.53686535", "0.53513265", "0.5341791", "0.53190494", "0.5314194", "0.53106403", "0.5292226", "0.52916646", "0.528705", "0.5250278", "0.52464455", "0.52182126", "0.5175694", "0.512414", "0.51139337", "0.5113605", "0.51069224", "0.5105154", "0.51010025", "0.5097348", "0.5073356", "0.5062323", "0.50466734", "0.5037714", "0.5035541", "0.5012479", "0.500861", "0.5002783", "0.49995744", "0.49974254", "0.49905527", "0.49882284", "0.4984067", "0.49735016", "0.4966447", "0.49228647", "0.49198222", "0.49150243", "0.49143365", "0.48853633", "0.48837203", "0.4870774", "0.48677987", "0.48640695", "0.48410836", "0.48367324", "0.48241004", "0.48040763", "0.47887564", "0.47855905", "0.47817913", "0.47740194", "0.47683746", "0.47648516", "0.47509885", "0.47481588", "0.47395548", "0.47279793", "0.47196525", "0.46961352", "0.46854034", "0.46837446", "0.46834633", "0.46505377", "0.4649135", "0.46330613", "0.4631759", "0.4628743", "0.46180943" ]
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}\n\treturn\n}", "func split(s string, sep string) []string {\n\tvar a []string\n\tfor _, v := range strings.Split(s, sep) {\n\t\tif v = strings.TrimSpace(v); v != \"\" {\n\t\t\ta = append(a, v)\n\t\t}\n\t}\n\treturn a\n}", "func str_split(s, sep string) []string {\n\tstrs := strings.Split(s, sep)\n\tout := make([]string, 0, len(strs))\n\tfor _, str := range strs {\n\t\tstr = strings.Trim(str, \" \\t\")\n\t\tif len(str) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tout = append(out, str)\n\t}\n\treturn out\n}", "func split(str, sep string) (a, b string) {\n\tparts := strings.SplitN(str, sep, 2)\n\ta = strings.TrimSpace(parts[0])\n\tif len(parts) == 2 {\n\t\tb = strings.TrimSpace(parts[1])\n\t}\n\treturn\n}", "func (f File) Split(sep string) []string {\n\tpat := fmt.Sprintf(\"\\r?\\n{0,1}%s\\r?\\n{0,1}\", regexp.QuoteMeta(sep))\n\tre := regexp.MustCompile(pat)\n\treturn re.Split(f.String(), -1)\n}", "func SplitAt(args []string, sep string) ([]string, []string) {\n\tindex := -1\n\tfor i, a := range args {\n\t\tif a == sep {\n\t\t\tindex = i\n\t\t\tbreak\n\t\t}\n\t}\n\tif index == -1 {\n\t\treturn args, []string{}\n\t}\n\treturn args[:index], args[index+1:]\n}", "func splitString(s, sep string) []string {\n\tif s == \"\" {\n\t\treturn []string{}\n\t}\n\treturn strings.Split(s, sep)\n}", "func SplitAfter(sep, operand string) []string { return strings.SplitAfter(operand, sep) }", "func StringSplit2(s, sep string) (head, tail string) {\n\tindex := strings.Index(s, sep)\n\tif index < 0 {\n\t\treturn s, \"\"\n\t}\n\treturn string(s[:index]), string(s[index+1:])\n}", "func Split(delim, escape rune, v string) []string {\n\tif delim == 0 || escape == 0 {\n\t\treturn []string{v}\n\t}\n\tscanner := bufio.NewScanner(strings.NewReader(v))\n\ts := &splitter{delim: delim, escape: escape}\n\tscanner.Split(s.scan)\n\n\tout := []string{}\n\tfor scanner.Scan() {\n\t\tout = append(out, scanner.Text())\n\t}\n\treturn out\n}", "func Split(in *pongo2.Value, param *pongo2.Value) (*pongo2.Value, *pongo2.Error) {\n\tif !in.CanSlice() {\n\t\treturn in, nil\n\t}\n\ts := in.String()\n\tsep := param.String()\n\n\tresult := make([]string, 0, len(s))\n\tfor _, c := range s {\n\t\tresult = append(result, string(c))\n\t}\n\treturn pongo2.AsValue(strings.Split(s, sep)), nil\n}", "func splitTrim(s string, sep string) []string {\n\tsplitItems := strings.Split(s, sep)\n\ttrimItems := make([]string, 0, len(splitItems))\n\tfor _, item := range splitItems {\n\t\tif item = strings.TrimSpace(item); item != \"\" {\n\t\t\ttrimItems = append(trimItems, item)\n\t\t}\n\t}\n\treturn trimItems\n}", "func (t *StringsTestSuite) TestSplit() {\n\tgot := Split(\"a/b/c\", \"/\")\n\twant := []string{\"a\", \"b\", \"c\"}\n\tt.Equal(want, got)\n}", "func splitOrEmpty(s string, sep string) []string {\n\tif len(s) < 1 {\n\t\treturn []string{}\n\t} else {\n\t\treturn strings.Split(s, sep)\n\t}\n}", "func splitVersion(s, sep string) (string, string) {\n\tspl := strings.SplitN(s, sep, 2)\n\tif len(spl) < 2 {\n\t\treturn s, \"\"\n\t}\n\treturn spl[0], spl[1]\n}", "func split(s string, d string) []string {\n\tif s == \"\" {\n\t\treturn nil\n\t}\n\treturn strings.Split(s, d)\n}", "func (cutr Cutter) Split(s []byte) ([]byte, []byte) {\n\tif ieol := cutr.nextEOL(s); ieol >= 0 {\n\t\treturn s[:ieol], s[ieol:]\n\t}\n\n\treturn nil, s\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\tsplits = append(splits, \"\")\n\t}\n\treturn splits\n}", "func Split(s string, d string) []string {\n\treturn strings.Split(s, d)\n}", "func splitOnce(s, sep string) (string, string) {\n\tn := strings.Index(s, sep)\n\tif n == -1 {\n\t\treturn s, \"\"\n\t}\n\treturn s[:n], s[n+len(sep):]\n}", "func splitPath(s string, sep rune, vars bool) (string, string) {\n\tvar invar bool\n\tfor i, e := range s {\n\t\tif e == sep && !invar {\n\t\t\treturn s[:i], s[i+1:]\n\t\t} else if vars && e == '{' {\n\t\t\tinvar = true\n\t\t} else if vars && e == '}' {\n\t\t\tinvar = false\n\t\t}\n\t}\n\treturn s, \"\"\n}", "func Split(art string) []string {\n\treturn strings.Split(art, \":\")\n}", "func splitter(url string) []string {\n\treturn strings.Split(strings.TrimPrefix(url, PathDelimeter), PathDelimeter)\n}", "func Split(path string) []string {\n\tvar parts []string\n\tpath = filepath.Clean(path)\n\tparts = append(parts, filepath.Base(path))\n\tsep := string(filepath.Separator)\n\tvolName := filepath.VolumeName(path)\n\tpath = path[len(volName):]\n\tfor {\n\t\tpath = filepath.Dir(path)\n\t\tparts = append(parts, filepath.Base(path))\n\t\tif path == \".\" || path == sep {\n\t\t\tbreak\n\t\t}\n\t}\n\tresult := make([]string, len(parts))\n\tfor i := 0; i < len(parts); i++ {\n\t\tresult[len(parts)-(i+1)] = parts[i]\n\t}\n\tif volName != \"\" && result[0] == sep {\n\t\tresult[0] = volName + sep\n\t}\n\treturn result\n}", "func (s *Splitter) Split(text string) []string {\n\treturn s.re.Split(text, -1)\n}", "func split(s string) []string {\n\tlastRune := map[rune]int{}\n\tf := func(c rune) bool {\n\t\tswitch {\n\t\tcase lastRune[c] > 0:\n\t\t\tlastRune[c]--\n\t\t\treturn false\n\t\tcase unicode.In(c, unicode.Quotation_Mark):\n\t\t\tlastRune[c]++\n\t\t\treturn false\n\t\tcase c == '[':\n\t\t\tlastRune[']']++\n\t\t\treturn false\n\t\tcase c == '{':\n\t\t\tlastRune['}']++\n\t\t\treturn false\n\t\tcase mapGreaterThan(lastRune, 0):\n\t\t\treturn false\n\t\tdefault:\n\t\t\treturn c == ' '\n\t\t}\n\t}\n\treturn strings.FieldsFunc(s, f)\n}", "func SplitN(sep string, n int, operand string) []string { return strings.SplitN(operand, sep, n) }", "func (re *RegexpStd) Split(s string, n int) []string {\n\n\t// if n == 0 {\n\t// \treturn nil\n\t// }\n\n\t// if len(re.expr) > 0 && len(s) == 0 {\n\t// \treturn []string{\"\"}\n\t// }\n\n\t// matches := re.FindAllStringIndex(s, n)\n\t// strings := make([]string, 0, len(matches))\n\n\t// beg := 0\n\t// end := 0\n\t// for _, match := range matches {\n\t// \tif n > 0 && len(strings) >= n-1 {\n\t// \t\tbreak\n\t// \t}\n\n\t// \tend = match[0]\n\t// \tif match[1] != 0 {\n\t// \t\tstrings = append(strings, s[beg:end])\n\t// \t}\n\t// \tbeg = match[1]\n\t// }\n\n\t// if end != len(s) {\n\t// \tstrings = append(strings, s[beg:])\n\t// }\n\n\t// return strings\n\tpanic(\"\")\n}", "func (calc *Calculator) split(numbers string) (split []string) {\n\treturn strings.FieldsFunc(numbers, func(r rune) bool {\n\t\tfor _, delimiter := range calc.delimiters {\n\t\t\tif r == delimiter {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t})\n}", "func Split(text string) (s []string, err error) {\n if len(text) == 0 { return nil, nullError(\"Split\",text) }\n startpos :=0\n in_quote := inQuote{false,doubleQuote}\n result := make([]string, 0, startSize)\n for p := 0; p < len(text); p++ {\n if in_quote.True {\n if text[p] == in_quote.Char {\n in_quote.True = false\n }\n } else {\n if text[p] == delim {\n if text[p-1] == delim {\n result = append(result, \"\")\n } else {\n result = append(result, text[startpos:p])\n }\n startpos=p+1\n } else {\n if text[p] == doubleQuote || text[p] == singleQuote {\n in_quote.True = true\n in_quote.Char = text[p]\n }\n }\n }\n }\n if in_quote.True {\n return nil, quoteError(\"Split\",text)\n }\n result = append(result, text[startpos:len(text)])\n return result, nil\n}", "func splits(fm *Frame, opts maxOpt, sep, s string) {\n\tout := fm.ports[1].Chan\n\tparts := strings.SplitN(s, sep, opts.Max)\n\tfor _, p := range parts {\n\t\tout <- p\n\t}\n}", "func (d *FQDN) Split() []string {\n\tres\t:= make([]string, 1)\n\tfqdn\t:= string(*d)\n\tbegin\t:= 0\n\n\tquote\t:= false\n\tfor pos,char := range fqdn {\n\t\tswitch char {\n\t\t\tcase '\\\\':\n\t\t\t\tquote = !quote\n\n\t\t\tcase '.':\n\t\t\t\tif !quote {\n\t\t\t\t\tif len(fqdn[begin:pos]) > 0 {\n\t\t\t\t\t\tres\t= append(res, fqdn[begin:pos] )\n\t\t\t\t\t}\n\t\t\t\t\tbegin\t= pos+1\n\t\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tquote\t= false\n\t\t}\n\t}\n\n\tif begin < len(fqdn) {\n\t\tres\t= append(res, fqdn[begin:len(fqdn)] )\n\t}\n\n\treturn res\n}", "func partition(s, sep string) (string, string) {\n\tk, v, ok := strings.Cut(s, sep)\n\tif !ok {\n\t\treturn s, \"\"\n\t}\n\treturn k, v\n}", "func Split(text string) []string {\n\t// wrap GoJjieba\n\teng := gjb.NewJieba()\n\tdefer eng.Free()\n\treturn eng.Cut(text, true)\n}", "func split(x string) (string, []string, error) {\n\ti := strings.Index(x, \"(\")\n\tif i == -1 || x[len(x)-1] != ')' {\n\t\treturn \"\", nil, ErrBadTransformation\n\t}\n\targs := strings.Split(x[i+1:len(x)-1], \", \")\n\tif len(args) == 1 && args[0] == \"\" {\n\t\targs = nil\n\t}\n\treturn x[:i], args, nil\n}", "func split(buf []byte, fn func(pos int, buf []byte) error) error {\n\tvar pos int\n\tfor {\n\t\tm := bytes.IndexByte(buf, byte(' '))\n\t\tif m < 0 {\n\t\t\tbreak\n\t\t}\n\t\tif err := fn(pos, buf[:m]); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpos++\n\t\tbuf = buf[m+1:]\n\t}\n\tif err := fn(pos, buf); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func Explode(str, separator string) StringSlice {\n\treturn String(strings.Split(str, separator))\n}", "func (t Term) Split(args ...interface{}) Term {\n\treturn constructMethodTerm(t, \"Split\", p.Term_SPLIT, funcWrapArgs(args), map[string]interface{}{})\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func Split(str string) []string {\n\tvar res []string\n\tif len(str) == 0 {\n\t\treturn res\n\t}\n\t\n\tvar index, brk int\n\trunes := []rune(str)\n\tl := len(runes)\n\t\n\tfor {\n\t\tbrk = nextBreak(str, index)\n\t\tif brk < l {\n\t\t\tres = append(res, string(runes[index:brk]))\n\t\t\tindex = brk\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\t\n\tif index < l {\n\t\tres = append(res, string(runes[index:]))\n\t}\n\t\n\treturn res\n}", "func splitKV(s, sep string) (string, string) {\n\tret := strings.SplitN(s, sep, 2)\n\treturn ret[0], ret[1]\n}", "func split2(s, sep string) (string, string, bool) {\n\tspl := strings.SplitN(s, sep, 2)\n\tif len(spl) < 2 {\n\t\treturn \"\", \"\", false\n\t}\n\treturn spl[0], spl[1], true\n}", "func split2(s, sep string) (string, string, bool) {\n\tspl := strings.SplitN(s, sep, 2)\n\tif len(spl) < 2 {\n\t\treturn \"\", \"\", false\n\t}\n\treturn spl[0], spl[1], true\n}", "func Split(line string) ([]string, error) {\n\treturn sw.Parse(line)\n}", "func splitTag(tag string) []string {\n\treturn strings.Split(tag, tagSeparator)\n}", "func split(n string) (string, string) {\n\tfor _, s := range allSuffixes {\n\t\tif strings.HasSuffix(n, s) {\n\t\t\tp := strings.TrimSuffix(n, s)\n\t\t\treturn p, s\n\t\t}\n\t}\n\treturn n, \"\"\n}", "func splitWithoutToken(str string, token rune) []string {\n\treturn strings.FieldsFunc(str, func(c rune) bool {\n\t\treturn c == token\n\t})\n}", "func split(str string) []string {\n\tisSpliting := true\n\treturn strings.FieldsFunc(str, func(char rune) bool {\n\t\tif char == '\"' {\n\t\t\tisSpliting = !isSpliting\n\t\t}\n\t\treturn unicode.IsSpace(char) && isSpliting\n\t})\n}", "func Explode(delimiter, str string) []string {\n\treturn strings.Split(str, delimiter)\n}", "func customSplit(s string) []string {\n\tvar result []string\n\tvar cur string\n\tparenDepth := 0\n\tfor _, v := range strings.Split(s, \"\") {\n\t\tif v == \"(\" {\n\t\t\tparenDepth++\n\t\t}\n\t\tif v == \")\" && parenDepth > 0 {\n\t\t\tparenDepth--\n\t\t}\n\t\tif v == \".\" && parenDepth == 0 {\n\t\t\tresult = append(result, cur)\n\t\t\tcur = \"\"\n\t\t} else {\n\t\t\tcur += v\n\t\t}\n\t}\n\tif cur != \"\" {\n\t\tresult = append(result, cur)\n\t}\n\treturn result\n}", "func cut(s, sep string) (before, after string, found bool) {\n\tif i := strings.Index(s, sep); i >= 0 {\n\t\treturn s[:i], s[i+len(sep):], true\n\t}\n\treturn s, \"\", false\n}", "func SplitAndTrim(str, delimiter string, characterMask ...string) []string {\n\tarray := make([]string, 0)\n\tfor _, v := range strings.Split(str, delimiter) {\n\t\tv = Trim(v, characterMask...)\n\t\tif v != \"\" {\n\t\t\tarray = append(array, v)\n\t\t}\n\t}\n\treturn array\n}", "func TestSplit_Assert(t *testing.T) {\n\tgot := Split(\"a/b/c\", \"/\")\n\twant := []string{\"a\", \"b\", \"c\"}\n\tassert.Equal(t, want, got)\n}", "func Delimit(s string, sep rune) string {\n\tout := make([]rune, 0, len(s)+5)\n\n\tfor _, r := range s {\n\t\tswitch {\n\t\tcase unicode.IsUpper(r):\n\t\t\tif last := len(out) - 1; last >= 0 && unicode.IsLower(out[last]) {\n\t\t\t\tout = append(out, sep)\n\t\t\t}\n\n\t\tcase unicode.IsLetter(r):\n\t\t\tif i := len(out) - 1; i >= 0 {\n\t\t\t\tif last := out[i]; unicode.IsUpper(last) {\n\t\t\t\t\tout = out[:i]\n\t\t\t\t\tif i > 0 && out[i-1] != sep {\n\t\t\t\t\t\tout = append(out, sep)\n\t\t\t\t\t}\n\t\t\t\t\tout = append(out, unicode.ToLower(last))\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase !unicode.IsNumber(r):\n\t\t\tif i := len(out); i != 0 && out[i-1] != sep {\n\t\t\t\tout = append(out, sep)\n\t\t\t}\n\t\t\tcontinue\n\n\t\t}\n\t\tout = append(out, r)\n\t}\n\n\tif len(out) == 0 {\n\t\treturn \"\"\n\t}\n\n\t// trim tailing separator\n\tif i := len(out) - 1; out[i] == sep {\n\t\tout = out[:i]\n\t}\n\n\tif len(out) == 1 {\n\t\tout[0] = unicode.ToLower(out[0])\n\t}\n\n\treturn string(out)\n}", "func Split(values string) (set Set) {\n\tsep := func(c rune) bool {\n\t\treturn c == Separator || unicode.IsSpace(c)\n\t}\n\tfor _, value := range strings.FieldsFunc(values, sep) {\n\t\tset = append(set, New(value))\n\t}\n\treturn\n}", "func SplitAndTrim(s string, separator string) ([]string, error) {\n\t// Trims the spaces and then splits\n\ttrimmed := strings.TrimSpace(s)\n\tsplit := strings.Split(trimmed, separator)\n\tcleanSplit := make([]string, len(split))\n\tfor i, val := range split {\n\t\tcleanSplit[i] = strings.TrimSpace(val)\n\t}\n\n\treturn cleanSplit, nil\n}", "func splitLast(input string, sep string) []string {\n\tsplit_str := strings.Split(input, sep)\n\treturn append([]string{strings.Join(split_str[0:len(split_str)-1], sep)}, split_str[len(split_str)-1:]...)\n}", "func Partition(subject string, sep string) (string, string, string) {\n\tif i := strings.Index(subject, sep); i != -1 {\n\t\treturn subject[:i], subject[i : i+len(sep)], subject[i+len(sep):]\n\t}\n\treturn subject, \"\", \"\"\n}", "func SplitComma(v string) []string {\n\treturn Split(',', '\\\\', v)\n}", "func getHalfBySep(s, sep string, half uint) string {\n\tif split := strings.SplitN(s, sep, 2); len(split) == 2 && half < 2 {\n\t\treturn split[half]\n\t}\n\treturn s\n}", "func PathSplit(incoming string) []string { return filesys.PathSplit(incoming) }", "func Divide(str string) []string {\n\treturn strings.Split(str, \"|\")\n}", "func splitPath(path string) []string {\n\tpath = strings.TrimSpace(path)\n\tif strings.HasPrefix(path, \"/\") {\n\t\tpath = path[1:]\n\t}\n\tif strings.HasSuffix(path, \"/\") {\n\t\tpath = path[:len(path)-1]\n\t}\n\tif len(path) == 0 {\n\t\treturn []string{}\n\t}\n\treturn strings.Split(path, \"/\")\n}", "func (s *Scanner) Split(split bufio.SplitFunc) {\n\tif s.scanner != nil {\n\t\ts.scanner.Split(split)\n\t}\n}", "func splitPath(p string) []string {\n\treturn strings.Split(path.Clean(p), \"/\")\n}", "func SplitCommandName(cmd, sep string) (string, string) {\n\tfor index := range cmd {\n\t\tif strings.HasPrefix(cmd[index:], sep) {\n\t\t\treturn cmd[:index], cmd[index+1:]\n\t\t}\n\t}\n\treturn cmd, \"\"\n}", "func (n UDN) Split() (head Label, tail Name) {\n\ts := n.String()\n\ti := strings.Index(s, \".\")\n\n\thead = Label(s[:i])\n\n\tif i != -1 {\n\t\ttail = UDN(s[i:])\n\t}\n\n\treturn\n}", "func Split(s string) ([]string, error) {\n\tl, err := NewLexer(strings.NewReader(s))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsubStrings := []string{}\n\tfor {\n\t\tword, err := l.NextWord()\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\treturn subStrings, nil\n\t\t\t}\n\t\t\treturn subStrings, err\n\t\t}\n\t\tsubStrings = append(subStrings, word)\n\t}\n\treturn subStrings, nil\n}", "func (this *DynMap) GetStringSliceSplit(key, delim string) ([]string, bool) {\n\tlst, ok := this.Get(key)\n\tif !ok {\n\t\treturn nil, false\n\t}\n\tswitch v := lst.(type) {\n\tcase string:\n\t\treturn strings.Split(v, delim), true\n\t}\n\tret, ok := this.GetStringSlice(key)\n\treturn ret, ok\n}", "func ParseSeparator(s string, sep rune) Path {\n\tvar p []component\n\tvar c string\n\tfor s != \"\" {\n\t\tc, s = splitPath(s, sep, true)\n\t\tp = append(p, component(c))\n\t}\n\treturn Path{\n\t\tcmp: p,\n\t\tsep: sep,\n\t}\n}", "func SplitIgnore(text string) (parts []string) {\n\tsplitF := func(c rune) bool {\n\t\treturn c == ' '\n\t}\n\tparts = strings.FieldsFunc(text, splitF)\n\treturn\n}", "func StringSplit(scope *Scope, input tf.Output, delimiter tf.Output, optional ...StringSplitAttr) (indices tf.Output, values tf.Output, shape tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\tattrs := map[string]interface{}{}\n\tfor _, a := range optional {\n\t\ta(attrs)\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"StringSplit\",\n\t\tInput: []tf.Input{\n\t\t\tinput, delimiter,\n\t\t},\n\t\tAttrs: attrs,\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0), op.Output(1), op.Output(2)\n}", "func SplitPath(path string) []string {\n\tvar result []string\n\tif len(path) > 0 && path[0] == '/' {\n\t\tpath = path[1:]\n\t}\n\tfor len(path) > 0 {\n\t\ti := nextTokenIndex(path)\n\t\tresult = append(result, path[:i])\n\t\tpath = path[i:]\n\t\tif len(path) > 0 && path[0] == '/' {\n\t\t\tpath = path[1:]\n\t\t}\n\t}\n\treturn result\n}", "func SplitPath(path string) []string {\n\tvar result []string\n\tif len(path) > 0 && path[0] == '/' {\n\t\tpath = path[1:]\n\t}\n\tfor len(path) > 0 {\n\t\ti := nextTokenIndex(path)\n\t\tresult = append(result, path[:i])\n\t\tpath = path[i:]\n\t\tif len(path) > 0 && path[0] == '/' {\n\t\t\tpath = path[1:]\n\t\t}\n\t}\n\treturn result\n}", "func splitPath(p string) []string {\n\tparts := strings.Split(filepath.ToSlash(p), \"/\")\n\tif parts[0] == \"\" {\n\t\tparts[0] = \"/\"\n\t}\n\treturn parts\n}", "func SplitAfterN(sep string, n int, operand string) []string {\n\treturn strings.SplitAfterN(operand, sep, n)\n}", "func SplitDelimiter(objects []string, delim string) []string {\n\tvar results []string\n\tfor _, object := range objects {\n\t\tparts := strings.Split(object, delim)\n\t\tresults = append(results, parts[0]+delim)\n\t}\n\treturn results\n}", "func (t Topic) Split() (p, n string) {\n\tp, n, _ = t.SplitErr()\n\treturn\n}", "func splitTerms(fieldSelector string) []string {\n\tif len(fieldSelector) == 0 {\n\t\treturn nil\n\t}\n\n\tterms := make([]string, 0, 1)\n\tstartIndex := 0\n\tinSlash := false\n\tfor i, c := range fieldSelector {\n\t\tswitch {\n\t\tcase inSlash:\n\t\t\tinSlash = false\n\t\tcase c == '\\\\':\n\t\t\tinSlash = true\n\t\tcase c == ',':\n\t\t\tterms = append(terms, fieldSelector[startIndex:i])\n\t\t\tstartIndex = i + 1\n\t\t}\n\t}\n\n\tterms = append(terms, fieldSelector[startIndex:])\n\n\treturn terms\n}", "func (s *Str) SplitSpaces() []string {\n\treturn notSpaceRegex.Split(s.val, -1)\n}", "func splitter(s, substr string) (bef, mid, aft string) {\n\thay, needle := []byte(s), []byte(substr)\n\tbef = string(hay)\n\tif idx := bytes.Index(hay, needle); idx > -1 {\n\t\tbef = s[:idx]\n\t\tmid = s[idx : idx+len(substr)]\n\t\taft = s[idx+len((substr)):]\n\t}\n\treturn bef, mid, aft\n}", "func Split(key string) []string {\n\tif keyRe == nil {\n\t\tkeyRe = regexp.MustCompile(\"[\\\\[][^\\\\]]+[\\\\]]|[^.]+\")\n\t}\n\tfields := keyRe.FindAllString(key, -1)\n\tfor i, field := range fields {\n\t\tif field[0] == '{' {\n\t\t\tif field[len(field)-1] == '}' {\n\t\t\t\tfields[i] = field[1 : len(field)-1]\n\t\t\t}\n\t\t} else if field[0] == '[' {\n\t\t\tif field[len(field)-1] == ']' {\n\t\t\t\tfields[i] = field[1 : len(field)-1]\n\t\t\t}\n\t\t}\n\t}\n\treturn fields\n}", "func Split(path string) (dir, file string) {\n\treturn std.Split(path)\n}", "func (t *DesktopTracer) SplitPath(p string) (string, string) {\n\tif t.b.Instance().GetConfiguration().GetOS().GetKind() == device.Windows {\n\t\tif runtime.GOOS == \"windows\" {\n\t\t\treturn filepath.Split(p)\n\t\t} else {\n\t\t\tlastSlash := strings.LastIndex(p, \"\\\\\")\n\t\t\tif lastSlash == -1 {\n\t\t\t\treturn \"\", p\n\t\t\t}\n\t\t\treturn p[0 : lastSlash+1], p[lastSlash+1:]\n\t\t}\n\t} else {\n\t\treturn path.Split(p)\n\t}\n}", "func (w *World) Split(path string, components ...string) ([]string, error) {\n\tparts := make([]string, len(components))\n\tfor i, comp := range components {\n\t\tvar result string\n\t\tswitch comp {\n\t\tcase \"dir\":\n\t\t\tresult = filepath.Dir(path)\n\t\tcase \"base\":\n\t\t\tresult = filepath.Base(path)\n\t\tcase \"ext\":\n\t\t\tresult = filepath.Ext(path)\n\t\tcase \"stem\":\n\t\t\tresult = filepath.Base(path)\n\t\t\tresult = result[:len(result)-len(filepath.Ext(path))]\n\t\tcase \"fext\":\n\t\t\tresult = w.Ext(path)\n\t\t\tif result != \"\" && result != \".\" {\n\t\t\t\tresult = \".\" + result\n\t\t\t}\n\t\tcase \"fstem\":\n\t\t\text := w.Ext(path)\n\t\t\tif ext != \"\" && ext != \".\" {\n\t\t\t\text = \".\" + ext\n\t\t\t}\n\t\t\tresult = filepath.Base(path)\n\t\t\tresult = result[:len(result)-len(ext)]\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unknown argument %q\", comp)\n\t\t}\n\t\tparts[i] = result\n\t}\n\treturn parts, nil\n}", "func (n InstanceName) Split() (head names.Label, tail names.Name) {\n\thead = names.Label(n.String())\n\treturn\n}", "func (m AoS) Split(f func(s string) AoS) AoAoS {\n\tif m.IsErr() {\n\t\treturn ErrAoAoS(m.err)\n\t}\n\n\txss := make([][]string, len(m.just))\n\tfor i, v := range m.just {\n\t\txs, err := f(v).Unbox()\n\t\tif err != nil {\n\t\t\treturn ErrAoAoS(err)\n\t\t}\n\t\txss[i] = xs\n\t}\n\n\treturn JustAoAoS(xss)\n}" ]
[ "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.6450017", "0.6445712", "0.64229256", "0.6416217", "0.63824785", "0.6348809", "0.6332542", "0.6325706", "0.6305967", "0.6293923", "0.62615705", "0.62426704", "0.6185228", "0.6160001", "0.6158876", "0.6158258", "0.61550504", "0.61485696", "0.61403346", "0.6140175", "0.6140175", "0.6140175", "0.6140175", "0.6140175", "0.6140175", "0.6140175", "0.6140175", "0.6140175", "0.6140175", "0.6140175", "0.6140175", "0.61322445", "0.61224866", "0.60490143", "0.60490143", "0.6047571", "0.5991921", "0.5982175", "0.5954258", "0.59540015", "0.5953608", "0.59443694", "0.5943475", "0.5929234", "0.592379", "0.5921438", "0.5881091", "0.58794636", "0.5876698", "0.5873117", "0.5872482", "0.5861002", "0.5842394", "0.58191013", "0.5813693", "0.58132803", "0.5788252", "0.57785326", "0.57777196", "0.5776806", "0.5765128", "0.5739344", "0.56818986", "0.56817484", "0.5668908", "0.5668908", "0.56622386", "0.5637652", "0.5637641", "0.5635967", "0.5619954", "0.56100154", "0.56069523", "0.55978113", "0.5571107", "0.5568528", "0.556824", "0.5561491", "0.55552155" ]
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, predicate func(T) bool) [][]T {\n\tvar result [][]T\n\tvar building []T\n\tfor _, elem := range slice {\n\t\tbuilding = append(building, elem)\n\t\tif predicate(elem) {\n\t\t\tresult = append(result, building)\n\t\t\tbuilding = []T{}\n\t\t}\n\t}\n\tif len(building) > 0 {\n\t\tresult = append(result, building)\n\t}\n\treturn result\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\tfmt.Print(\"\\\"\" + s + \"\\\"\")\n\t\t\t\tif i < len(s)-1 {\n\t\t\t\t\tfmt.Print(\",\")\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Println()\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t})\n}", "func splitLast(input string, sep string) []string {\n\tsplit_str := strings.Split(input, sep)\n\treturn append([]string{strings.Join(split_str[0:len(split_str)-1], sep)}, split_str[len(split_str)-1:]...)\n}", "func SplitAt(args []string, sep string) ([]string, []string) {\n\tindex := -1\n\tfor i, a := range args {\n\t\tif a == sep {\n\t\t\tindex = i\n\t\t\tbreak\n\t\t}\n\t}\n\tif index == -1 {\n\t\treturn args, []string{}\n\t}\n\treturn args[:index], args[index+1:]\n}", "func Split(sep, operand string) []string { return strings.Split(operand, sep) }", "func SubstringAfterLast(str string, sep string) string {\n\tidx := strings.LastIndex(str, sep)\n\tif idx == -1 {\n\t\treturn str\n\t}\n\treturn str[idx+len(sep):]\n}", "func IndexAfter(s, sep []byte) int {\n\tpos := bytes.Index(s, sep)\n\tif pos == -1 {\n\t\treturn -1\n\t}\n\treturn pos + len(sep)\n}", "func StringSplit2(s, sep string) (head, tail string) {\n\tindex := strings.Index(s, sep)\n\tif index < 0 {\n\t\treturn s, \"\"\n\t}\n\treturn string(s[:index]), string(s[index+1:])\n}", "func Split(in *pongo2.Value, param *pongo2.Value) (*pongo2.Value, *pongo2.Error) {\n\tif !in.CanSlice() {\n\t\treturn in, nil\n\t}\n\ts := in.String()\n\tsep := param.String()\n\n\tresult := make([]string, 0, len(s))\n\tfor _, c := range s {\n\t\tresult = append(result, string(c))\n\t}\n\treturn pongo2.AsValue(strings.Split(s, sep)), nil\n}", "func splitter(url string) []string {\n\treturn strings.Split(strings.TrimPrefix(url, PathDelimeter), PathDelimeter)\n}", "func splits(fm *Frame, opts maxOpt, sep, s string) {\n\tout := fm.ports[1].Chan\n\tparts := strings.SplitN(s, sep, opts.Max)\n\tfor _, p := range parts {\n\t\tout <- p\n\t}\n}", "func splitOnce(s, sep string) (string, string) {\n\tn := strings.Index(s, sep)\n\tif n == -1 {\n\t\treturn s, \"\"\n\t}\n\treturn s[:n], s[n+len(sep):]\n}", "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 cut(s, sep string) (before, after string, found bool) {\n\tif i := strings.Index(s, sep); i >= 0 {\n\t\treturn s[:i], s[i+len(sep):], true\n\t}\n\treturn s, \"\", false\n}", "func split(str, sep string) (a, b string) {\n\tparts := strings.SplitN(str, sep, 2)\n\ta = strings.TrimSpace(parts[0])\n\tif len(parts) == 2 {\n\t\tb = strings.TrimSpace(parts[1])\n\t}\n\treturn\n}", "func splitAfterNewline(p []byte) ([][]byte, []byte) {\n\tchunk := p\n\tvar lines [][]byte\n\n\tfor len(chunk) > 0 {\n\t\tidx := bytes.Index(chunk, newLine)\n\t\tif idx == -1 {\n\t\t\treturn lines, chunk\n\t\t}\n\n\t\tlines = append(lines, chunk[:idx+1])\n\n\t\tif idx == len(chunk)-1 {\n\t\t\tchunk = nil\n\t\t\tbreak\n\t\t}\n\n\t\tchunk = chunk[idx+1:]\n\t}\n\n\treturn lines, chunk\n}", "func SubstringBeforeLast(str string, sep string) string {\n\tidx := strings.LastIndex(str, sep)\n\tif idx == -1 {\n\t\treturn str\n\t}\n\treturn str[:idx]\n}", "func split(s string, sep string) []string {\n\tvar a []string\n\tfor _, v := range strings.Split(s, sep) {\n\t\tif v = strings.TrimSpace(v); v != \"\" {\n\t\t\ta = append(a, v)\n\t\t}\n\t}\n\treturn a\n}", "func split(n string) (string, string) {\n\tfor _, s := range allSuffixes {\n\t\tif strings.HasSuffix(n, s) {\n\t\t\tp := strings.TrimSuffix(n, s)\n\t\t\treturn p, s\n\t\t}\n\t}\n\treturn n, \"\"\n}", "func splitVersion(s, sep string) (string, string) {\n\tspl := strings.SplitN(s, sep, 2)\n\tif len(spl) < 2 {\n\t\treturn s, \"\"\n\t}\n\treturn spl[0], spl[1]\n}", "func (f File) Split(sep string) []string {\n\tpat := fmt.Sprintf(\"\\r?\\n{0,1}%s\\r?\\n{0,1}\", regexp.QuoteMeta(sep))\n\tre := regexp.MustCompile(pat)\n\treturn re.Split(f.String(), -1)\n}", "func cutString(s, sep string) (before, after string, found bool) {\n\tif i := strings.Index(s, sep); i >= 0 {\n\t\treturn s[:i], s[i+len(sep):], true\n\t}\n\treturn s, \"\", false\n}", "func Delimit(s string, sep rune) string {\n\tout := make([]rune, 0, len(s)+5)\n\n\tfor _, r := range s {\n\t\tswitch {\n\t\tcase unicode.IsUpper(r):\n\t\t\tif last := len(out) - 1; last >= 0 && unicode.IsLower(out[last]) {\n\t\t\t\tout = append(out, sep)\n\t\t\t}\n\n\t\tcase unicode.IsLetter(r):\n\t\t\tif i := len(out) - 1; i >= 0 {\n\t\t\t\tif last := out[i]; unicode.IsUpper(last) {\n\t\t\t\t\tout = out[:i]\n\t\t\t\t\tif i > 0 && out[i-1] != sep {\n\t\t\t\t\t\tout = append(out, sep)\n\t\t\t\t\t}\n\t\t\t\t\tout = append(out, unicode.ToLower(last))\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase !unicode.IsNumber(r):\n\t\t\tif i := len(out); i != 0 && out[i-1] != sep {\n\t\t\t\tout = append(out, sep)\n\t\t\t}\n\t\t\tcontinue\n\n\t\t}\n\t\tout = append(out, r)\n\t}\n\n\tif len(out) == 0 {\n\t\treturn \"\"\n\t}\n\n\t// trim tailing separator\n\tif i := len(out) - 1; out[i] == sep {\n\t\tout = out[:i]\n\t}\n\n\tif len(out) == 1 {\n\t\tout[0] = unicode.ToLower(out[0])\n\t}\n\n\treturn string(out)\n}", "func SplitN(sep string, n int, operand string) []string { return strings.SplitN(operand, sep, n) }", "func (mmSplit *StorageMock) SplitAfterCounter() uint64 {\n\treturn mm_atomic.LoadUint64(&mmSplit.afterSplitCounter)\n}", "func Partition(subject string, sep string) (string, string, string) {\n\tif i := strings.Index(subject, sep); i != -1 {\n\t\treturn subject[:i], subject[i : i+len(sep)], subject[i+len(sep):]\n\t}\n\treturn subject, \"\", \"\"\n}", "func GetPageAfterID(\n\telements []Pageable,\n\tafter string,\n\tpageSize uint,\n) []Pageable {\n\tif after == \"\" {\n\t\t// zero-after indicates start with the first page\n\t\treturn elements[0:minInt(int(pageSize), len(elements))]\n\t}\n\n\tafterIdx := -1\n\tfor idx, element := range elements {\n\t\tif after == element.ExtractID() {\n\t\t\tafterIdx = idx\n\t\t}\n\t}\n\n\tif afterIdx == -1 {\n\t\treturn []Pageable{}\n\t}\n\n\tstart := afterIdx + 1\n\tend := minInt(start+int(pageSize), len(elements))\n\n\treturn elements[start:end]\n}", "func split(buf []byte, fn func(pos int, buf []byte) error) error {\n\tvar pos int\n\tfor {\n\t\tm := bytes.IndexByte(buf, byte(' '))\n\t\tif m < 0 {\n\t\t\tbreak\n\t\t}\n\t\tif err := fn(pos, buf[:m]); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpos++\n\t\tbuf = buf[m+1:]\n\t}\n\tif err := fn(pos, buf); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func splitTrim(s string, sep string) []string {\n\tsplitItems := strings.Split(s, sep)\n\ttrimItems := make([]string, 0, len(splitItems))\n\tfor _, item := range splitItems {\n\t\tif item = strings.TrimSpace(item); item != \"\" {\n\t\t\ttrimItems = append(trimItems, item)\n\t\t}\n\t}\n\treturn trimItems\n}", "func str_split(s, sep string) []string {\n\tstrs := strings.Split(s, sep)\n\tout := make([]string, 0, len(strs))\n\tfor _, str := range strs {\n\t\tstr = strings.Trim(str, \" \\t\")\n\t\tif len(str) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tout = append(out, str)\n\t}\n\treturn out\n}", "func splitPath(s string, sep rune, vars bool) (string, string) {\n\tvar invar bool\n\tfor i, e := range s {\n\t\tif e == sep && !invar {\n\t\t\treturn s[:i], s[i+1:]\n\t\t} else if vars && e == '{' {\n\t\t\tinvar = true\n\t\t} else if vars && e == '}' {\n\t\t\tinvar = false\n\t\t}\n\t}\n\treturn s, \"\"\n}", "func (s *Selection) After(selector string) *Selection {\n\treturn s.AfterMatcher(compileMatcher(selector))\n}", "func splitString(s, sep string) []string {\n\tif s == \"\" {\n\t\treturn []string{}\n\t}\n\treturn strings.Split(s, sep)\n}", "func SplitDelimiter(objects []string, delim string) []string {\n\tvar results []string\n\tfor _, object := range objects {\n\t\tparts := strings.Split(object, delim)\n\t\tresults = append(results, parts[0]+delim)\n\t}\n\treturn results\n}", "func Split(v, sep string) (sl []string) {\n\tif len(v) > 0 {\n\t\tsl = strings.Split(v, sep)\n\t}\n\treturn\n}", "func (d *FQDN) Split() []string {\n\tres\t:= make([]string, 1)\n\tfqdn\t:= string(*d)\n\tbegin\t:= 0\n\n\tquote\t:= false\n\tfor pos,char := range fqdn {\n\t\tswitch char {\n\t\t\tcase '\\\\':\n\t\t\t\tquote = !quote\n\n\t\t\tcase '.':\n\t\t\t\tif !quote {\n\t\t\t\t\tif len(fqdn[begin:pos]) > 0 {\n\t\t\t\t\t\tres\t= append(res, fqdn[begin:pos] )\n\t\t\t\t\t}\n\t\t\t\t\tbegin\t= pos+1\n\t\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tquote\t= false\n\t\t}\n\t}\n\n\tif begin < len(fqdn) {\n\t\tres\t= append(res, fqdn[begin:len(fqdn)] )\n\t}\n\n\treturn res\n}", "func DotSeparated(s string) string {\n\treturn Delimit(s, '.')\n}", "func (o *AdminSearchUsersV2Params) SetAfter(after *string) {\n\to.After = after\n}", "func removeAllAfter(s, seps string) string {\n\tfor _, c := range strings.Split(seps, \"\") {\n\t\tif c == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\ti := strings.Index(s, c)\n\t\tif i == -1 {\n\t\t\tcontinue\n\t\t}\n\n\t\ts = s[:i]\n\t}\n\n\treturn s\n}", "func Split(text string) (s []string, err error) {\n if len(text) == 0 { return nil, nullError(\"Split\",text) }\n startpos :=0\n in_quote := inQuote{false,doubleQuote}\n result := make([]string, 0, startSize)\n for p := 0; p < len(text); p++ {\n if in_quote.True {\n if text[p] == in_quote.Char {\n in_quote.True = false\n }\n } else {\n if text[p] == delim {\n if text[p-1] == delim {\n result = append(result, \"\")\n } else {\n result = append(result, text[startpos:p])\n }\n startpos=p+1\n } else {\n if text[p] == doubleQuote || text[p] == singleQuote {\n in_quote.True = true\n in_quote.Char = text[p]\n }\n }\n }\n }\n if in_quote.True {\n return nil, quoteError(\"Split\",text)\n }\n result = append(result, text[startpos:len(text)])\n return result, nil\n}", "func TestSplitLast(t *testing.T) {\n\tcases := []struct {\n\t\tpath string\n\t\tdir string\n\t\tfile string\n\t}{\n\t\t{path: \"/\", dir: \"/\", file: \".\"},\n\t\t{path: \"/.\", dir: \"/\", file: \".\"},\n\t\t{path: \"/./\", dir: \"/\", file: \".\"},\n\t\t{path: \"/./.\", dir: \"/.\", file: \".\"},\n\t\t{path: \"/././\", dir: \"/.\", file: \".\"},\n\t\t{path: \"/./..\", dir: \"/.\", file: \"..\"},\n\t\t{path: \"/./../\", dir: \"/.\", file: \"..\"},\n\t\t{path: \"/..\", dir: \"/\", file: \"..\"},\n\t\t{path: \"/../\", dir: \"/\", file: \"..\"},\n\t\t{path: \"/../.\", dir: \"/..\", file: \".\"},\n\t\t{path: \"/.././\", dir: \"/..\", file: \".\"},\n\t\t{path: \"/../..\", dir: \"/..\", file: \"..\"},\n\t\t{path: \"/../../\", dir: \"/..\", file: \"..\"},\n\n\t\t{path: \"\", dir: \".\", file: \".\"},\n\t\t{path: \".\", dir: \".\", file: \".\"},\n\t\t{path: \"./\", dir: \".\", file: \".\"},\n\t\t{path: \"./.\", dir: \".\", file: \".\"},\n\t\t{path: \"././\", dir: \".\", file: \".\"},\n\t\t{path: \"./..\", dir: \".\", file: \"..\"},\n\t\t{path: \"./../\", dir: \".\", file: \"..\"},\n\t\t{path: \"..\", dir: \".\", file: \"..\"},\n\t\t{path: \"../\", dir: \".\", file: \"..\"},\n\t\t{path: \"../.\", dir: \"..\", file: \".\"},\n\t\t{path: \".././\", dir: \"..\", file: \".\"},\n\t\t{path: \"../..\", dir: \"..\", file: \"..\"},\n\t\t{path: \"../../\", dir: \"..\", file: \"..\"},\n\n\t\t{path: \"/foo\", dir: \"/\", file: \"foo\"},\n\t\t{path: \"/foo/\", dir: \"/\", file: \"foo\"},\n\t\t{path: \"/foo/.\", dir: \"/foo\", file: \".\"},\n\t\t{path: \"/foo/./\", dir: \"/foo\", file: \".\"},\n\t\t{path: \"/foo/./.\", dir: \"/foo/.\", file: \".\"},\n\t\t{path: \"/foo/./..\", dir: \"/foo/.\", file: \"..\"},\n\t\t{path: \"/foo/..\", dir: \"/foo\", file: \"..\"},\n\t\t{path: \"/foo/../\", dir: \"/foo\", file: \"..\"},\n\t\t{path: \"/foo/../.\", dir: \"/foo/..\", file: \".\"},\n\t\t{path: \"/foo/../..\", dir: \"/foo/..\", file: \"..\"},\n\n\t\t{path: \"/foo/bar\", dir: \"/foo\", file: \"bar\"},\n\t\t{path: \"/foo/bar/\", dir: \"/foo\", file: \"bar\"},\n\t\t{path: \"/foo/bar/.\", dir: \"/foo/bar\", file: \".\"},\n\t\t{path: \"/foo/bar/./\", dir: \"/foo/bar\", file: \".\"},\n\t\t{path: \"/foo/bar/./.\", dir: \"/foo/bar/.\", file: \".\"},\n\t\t{path: \"/foo/bar/./..\", dir: \"/foo/bar/.\", file: \"..\"},\n\t\t{path: \"/foo/bar/..\", dir: \"/foo/bar\", file: \"..\"},\n\t\t{path: \"/foo/bar/../\", dir: \"/foo/bar\", file: \"..\"},\n\t\t{path: \"/foo/bar/../.\", dir: \"/foo/bar/..\", file: \".\"},\n\t\t{path: \"/foo/bar/../..\", dir: \"/foo/bar/..\", file: \"..\"},\n\n\t\t{path: \"foo\", dir: \".\", file: \"foo\"},\n\t\t{path: \"foo\", dir: \".\", file: \"foo\"},\n\t\t{path: \"foo/\", dir: \".\", file: \"foo\"},\n\t\t{path: \"foo/.\", dir: \"foo\", file: \".\"},\n\t\t{path: \"foo/./\", dir: \"foo\", file: \".\"},\n\t\t{path: \"foo/./.\", dir: \"foo/.\", file: \".\"},\n\t\t{path: \"foo/./..\", dir: \"foo/.\", file: \"..\"},\n\t\t{path: \"foo/..\", dir: \"foo\", file: \"..\"},\n\t\t{path: \"foo/../\", dir: \"foo\", file: \"..\"},\n\t\t{path: \"foo/../.\", dir: \"foo/..\", file: \".\"},\n\t\t{path: \"foo/../..\", dir: \"foo/..\", file: \"..\"},\n\t\t{path: \"foo/\", dir: \".\", file: \"foo\"},\n\t\t{path: \"foo/.\", dir: \"foo\", file: \".\"},\n\n\t\t{path: \"foo/bar\", dir: \"foo\", file: \"bar\"},\n\t\t{path: \"foo/bar/\", dir: \"foo\", file: \"bar\"},\n\t\t{path: \"foo/bar/.\", dir: \"foo/bar\", file: \".\"},\n\t\t{path: \"foo/bar/./\", dir: \"foo/bar\", file: \".\"},\n\t\t{path: \"foo/bar/./.\", dir: \"foo/bar/.\", file: \".\"},\n\t\t{path: \"foo/bar/./..\", dir: \"foo/bar/.\", file: \"..\"},\n\t\t{path: \"foo/bar/..\", dir: \"foo/bar\", file: \"..\"},\n\t\t{path: \"foo/bar/../\", dir: \"foo/bar\", file: \"..\"},\n\t\t{path: \"foo/bar/../.\", dir: \"foo/bar/..\", file: \".\"},\n\t\t{path: \"foo/bar/../..\", dir: \"foo/bar/..\", file: \"..\"},\n\t\t{path: \"foo/bar/\", dir: \"foo\", file: \"bar\"},\n\t\t{path: \"foo/bar/.\", dir: \"foo/bar\", file: \".\"},\n\t}\n\n\tfor _, c := range cases {\n\t\tdir, file := SplitLast(c.path)\n\t\tif dir != c.dir || file != c.file {\n\t\t\tt.Errorf(\"SplitLast(%q) got (%q, %q), expected (%q, %q)\", c.path, dir, file, c.dir, c.file)\n\t\t}\n\t}\n}", "func (t *StringsTestSuite) TestSplit() {\n\tgot := Split(\"a/b/c\", \"/\")\n\twant := []string{\"a\", \"b\", \"c\"}\n\tt.Equal(want, got)\n}", "func split(s string) []string {\n\tlastRune := map[rune]int{}\n\tf := func(c rune) bool {\n\t\tswitch {\n\t\tcase lastRune[c] > 0:\n\t\t\tlastRune[c]--\n\t\t\treturn false\n\t\tcase unicode.In(c, unicode.Quotation_Mark):\n\t\t\tlastRune[c]++\n\t\t\treturn false\n\t\tcase c == '[':\n\t\t\tlastRune[']']++\n\t\t\treturn false\n\t\tcase c == '{':\n\t\t\tlastRune['}']++\n\t\t\treturn false\n\t\tcase mapGreaterThan(lastRune, 0):\n\t\t\treturn false\n\t\tdefault:\n\t\t\treturn c == ' '\n\t\t}\n\t}\n\treturn strings.FieldsFunc(s, f)\n}", "func Split(text string) []string {\n\t// wrap GoJjieba\n\teng := gjb.NewJieba()\n\tdefer eng.Free()\n\treturn eng.Cut(text, true)\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\tsplits = append(splits, \"\")\n\t}\n\treturn splits\n}", "func split2(s, sep string) (string, string, bool) {\n\tspl := strings.SplitN(s, sep, 2)\n\tif len(spl) < 2 {\n\t\treturn \"\", \"\", false\n\t}\n\treturn spl[0], spl[1], true\n}", "func split2(s, sep string) (string, string, bool) {\n\tspl := strings.SplitN(s, sep, 2)\n\tif len(spl) < 2 {\n\t\treturn \"\", \"\", false\n\t}\n\treturn spl[0], spl[1], true\n}", "func tokenizeSubjectIntoSlice(tts []string, subject string) []string {\n\tstart := 0\n\tfor i := 0; i < len(subject); i++ {\n\t\tif subject[i] == btsep {\n\t\t\ttts = append(tts, subject[start:i])\n\t\t\tstart = i + 1\n\t\t}\n\t}\n\ttts = append(tts, subject[start:])\n\treturn tts\n}", "func FindDelimiter(s string) []string {\n\treturn strings.Split(s, \"/\")\n}", "func getHalfBySep(s, sep string, half uint) string {\n\tif split := strings.SplitN(s, sep, 2); len(split) == 2 && half < 2 {\n\t\treturn split[half]\n\t}\n\treturn s\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func SplitBy(s string, decider func(r rune) bool) []string {\n\n\t// split by caps\n\tvar segments []string\n\tvar currentSeg []rune\n\n\tfor rIndex, r := range s {\n\n\t\tif decider(r) {\n\t\t\t// new word\n\t\t\tif len(currentSeg) > 0 {\n\t\t\t\tsegments = append(segments, string(currentSeg))\n\t\t\t\tcurrentSeg = nil\n\t\t\t}\n\t\t}\n\n\t\tcurrentSeg = append(currentSeg, r)\n\n\t\t// is this the last one?\n\t\tif rIndex == len(s)-1 {\n\t\t\tsegments = append(segments, string(currentSeg))\n\t\t}\n\n\t}\n\n\treturn segments\n}", "func customSplit(s string) []string {\n\tvar result []string\n\tvar cur string\n\tparenDepth := 0\n\tfor _, v := range strings.Split(s, \"\") {\n\t\tif v == \"(\" {\n\t\t\tparenDepth++\n\t\t}\n\t\tif v == \")\" && parenDepth > 0 {\n\t\t\tparenDepth--\n\t\t}\n\t\tif v == \".\" && parenDepth == 0 {\n\t\t\tresult = append(result, cur)\n\t\t\tcur = \"\"\n\t\t} else {\n\t\t\tcur += v\n\t\t}\n\t}\n\tif cur != \"\" {\n\t\tresult = append(result, cur)\n\t}\n\treturn result\n}", "func selectionAfter(regexpStr, s string) string {\n\tvar re, _ = regexp.Compile(regexpStr)\n\tvar loc = re.FindStringIndex(s)\n\tif loc == nil {\n\t\treturn \"\"\n\t}\n\tvar ss = s[loc[1]:]\n\treturn insideBrackets(\"{}\", ss)\n}", "func PHCSplitString(s string) []string {\n\treturn strings.Split(s, \"$\")\n}", "func ParseSeparator(s string, sep rune) Path {\n\tvar p []component\n\tvar c string\n\tfor s != \"\" {\n\t\tc, s = splitPath(s, sep, true)\n\t\tp = append(p, component(c))\n\t}\n\treturn Path{\n\t\tcmp: p,\n\t\tsep: sep,\n\t}\n}", "func (b *PhotosReorderPhotosBuilder) After(v int) *PhotosReorderPhotosBuilder {\n\tb.Params[\"after\"] = v\n\treturn b\n}", "func Explode(delimiter, str string) []string {\n\treturn strings.Split(str, delimiter)\n}", "func (b *GroupsReorderLinkBuilder) After(v int) *GroupsReorderLinkBuilder {\n\tb.Params[\"after\"] = v\n\treturn b\n}", "func PathSplit(incoming string) []string { return filesys.PathSplit(incoming) }", "func factoryDelimiter(delimiter []byte) bufio.SplitFunc {\n\treturn func(data []byte, eof bool) (int, []byte, error) {\n\t\tif eof && len(data) == 0 {\n\t\t\treturn 0, nil, nil\n\t\t}\n\t\tif i := bytes.Index(data, delimiter); i >= 0 {\n\t\t\treturn i + len(delimiter), dropDelimiter(data[0:i], delimiter), nil\n\t\t}\n\t\tif eof {\n\t\t\treturn len(data), dropDelimiter(data, delimiter), nil\n\t\t}\n\t\treturn 0, nil, nil\n\t}\n}", "func splitTerms(fieldSelector string) []string {\n\tif len(fieldSelector) == 0 {\n\t\treturn nil\n\t}\n\n\tterms := make([]string, 0, 1)\n\tstartIndex := 0\n\tinSlash := false\n\tfor i, c := range fieldSelector {\n\t\tswitch {\n\t\tcase inSlash:\n\t\t\tinSlash = false\n\t\tcase c == '\\\\':\n\t\t\tinSlash = true\n\t\tcase c == ',':\n\t\t\tterms = append(terms, fieldSelector[startIndex:i])\n\t\t\tstartIndex = i + 1\n\t\t}\n\t}\n\n\tterms = append(terms, fieldSelector[startIndex:])\n\n\treturn terms\n}", "func (d *DNSProvider) splitDomain(fqdn string) (string, string, error) {\n\tzone, err := dns01.FindZoneByFqdn(fqdn)\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"could not find zone for FQDN %q: %w\", fqdn, err)\n\t}\n\n\tsubDomain, err := dns01.ExtractSubDomain(fqdn, zone)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\treturn dns01.UnFqdn(zone), subDomain, nil\n}", "func splitKV(s, sep string) (string, string) {\n\tret := strings.SplitN(s, sep, 2)\n\treturn ret[0], ret[1]\n}", "func SubstringBefore(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]\n}", "func partition(s, sep string) (string, string) {\n\tk, v, ok := strings.Cut(s, sep)\n\tif !ok {\n\t\treturn s, \"\"\n\t}\n\treturn k, v\n}", "func (b *PhotosReorderAlbumsBuilder) After(v int) *PhotosReorderAlbumsBuilder {\n\tb.Params[\"after\"] = v\n\treturn b\n}", "func (re *RegexpStd) Split(s string, n int) []string {\n\n\t// if n == 0 {\n\t// \treturn nil\n\t// }\n\n\t// if len(re.expr) > 0 && len(s) == 0 {\n\t// \treturn []string{\"\"}\n\t// }\n\n\t// matches := re.FindAllStringIndex(s, n)\n\t// strings := make([]string, 0, len(matches))\n\n\t// beg := 0\n\t// end := 0\n\t// for _, match := range matches {\n\t// \tif n > 0 && len(strings) >= n-1 {\n\t// \t\tbreak\n\t// \t}\n\n\t// \tend = match[0]\n\t// \tif match[1] != 0 {\n\t// \t\tstrings = append(strings, s[beg:end])\n\t// \t}\n\t// \tbeg = match[1]\n\t// }\n\n\t// if end != len(s) {\n\t// \tstrings = append(strings, s[beg:])\n\t// }\n\n\t// return strings\n\tpanic(\"\")\n}", "func (t PathType) Separator() string {\n\tswitch t {\n\tcase Relative:\n\t\treturn \".\"\n\tcase Absolute:\n\t\treturn \"/\"\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "func (cutr Cutter) Split(s []byte) ([]byte, []byte) {\n\tif ieol := cutr.nextEOL(s); ieol >= 0 {\n\t\treturn s[:ieol], s[ieol:]\n\t}\n\n\treturn nil, s\n}", "func splitWithoutToken(str string, token rune) []string {\n\treturn strings.FieldsFunc(str, func(c rune) bool {\n\t\treturn c == token\n\t})\n}", "func splitUrl(givenUrl string) []string{\n\t// parse this url and make sure there is no error\n\tu, err := url.Parse(givenUrl)\n\terrCheck(err)\n\th := strings.Split(u.Path, \"/\")\n\treturn h\n}", "func SplitCommandName(cmd, sep string) (string, string) {\n\tfor index := range cmd {\n\t\tif strings.HasPrefix(cmd[index:], sep) {\n\t\t\treturn cmd[:index], cmd[index+1:]\n\t\t}\n\t}\n\treturn cmd, \"\"\n}", "func stringsCut(s, sep string) (before, after string, found bool) {\n\tif i := strings.Index(s, sep); i >= 0 {\n\t\treturn s[:i], s[i+len(sep):], true\n\t}\n\treturn s, \"\", false\n}", "func (n UDN) Split() (head Label, tail Name) {\n\ts := n.String()\n\ti := strings.Index(s, \".\")\n\n\thead = Label(s[:i])\n\n\tif i != -1 {\n\t\ttail = UDN(s[i:])\n\t}\n\n\treturn\n}", "func extractBeforeSeparator(s string) string {\n\tloc := rtrwSeparatorRegex.FindStringIndex(s)\n\tif loc == nil {\n\t\treturn s\n\t} else {\n\t\treturn s[0:loc[0]]\n\t}\n}", "func ReverseDelimited(str string, del string) string {\n\ts := strings.Split(str, del)\n\tfor i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {\n\t\ts[i], s[j] = s[j], s[i]\n\t}\n\treturn Join(s, del)\n}", "func SplitEmail(email string) (account, host string) {\n\ti := strings.LastIndexByte(email, EmailSeparator)\n\treturn email[:i], email[i+1:]\n}", "func SplitStringSliceByLimit(in []string, limit uint) [][]string {\n\tvar stringSlice []string\n\tsliceSlice := make([][]string, 0, len(in)/int(limit)+1)\n\tfor len(in) >= int(limit) {\n\t\tstringSlice, in = in[:limit], in[limit:]\n\t\tsliceSlice = append(sliceSlice, stringSlice)\n\t}\n\tif len(in) > 0 {\n\t\tsliceSlice = append(sliceSlice, in)\n\t}\n\treturn sliceSlice\n}", "func oidSplitEnd(oid string) (string, string, error) {\n\tfinalDotPos := strings.LastIndex(oid, \".\")\n\tif finalDotPos < 0 {\n\t\treturn \"\", \"\", fmt.Errorf(\"oid '%s' does not match expected format\", oid)\n\t}\n\treturn oid[:finalDotPos], oid[(finalDotPos + 1):], nil\n}", "func splitURL(path string) (string, string) {\n\tif path == \"\" {\n\t\treturn \"\", \"\"\n\t}\n\n\tpath = strings.TrimPrefix(path, \"/\")\n\n\ti := strings.Index(path, \"/\")\n\tif i == -1 {\n\t\treturn \"\", path\n\t}\n\n\treturn path[0:i], path[i:]\n}", "func After(lib, migration string) MigrationOption {\n\treturn func(m Migration) {\n\t\tbase := m.Base()\n\t\trawAfter := make([]MigrationName, len(base.rawAfter)+1)\n\t\tcopy(rawAfter, base.rawAfter) // copy in case there is another reference\n\t\trawAfter[len(base.rawAfter)] = MigrationName{\n\t\t\tLibrary: lib,\n\t\t\tName: migration,\n\t\t}\n\t\tbase.rawAfter = rawAfter\n\t}\n}", "func SplitMaybeSubscriptedPath(fieldPath string) (string, string, bool) {\n\tif !strings.HasSuffix(fieldPath, \"']\") {\n\t\treturn fieldPath, \"\", false\n\t}\n\ts := strings.TrimSuffix(fieldPath, \"']\")\n\tparts := strings.SplitN(s, \"['\", 2)\n\tif len(parts) < 2 {\n\t\treturn fieldPath, \"\", false\n\t}\n\tif len(parts[0]) == 0 {\n\t\treturn fieldPath, \"\", false\n\t}\n\treturn parts[0], parts[1], true\n}", "func (m AoS) Split(f func(s string) AoS) AoAoS {\n\tif m.IsErr() {\n\t\treturn ErrAoAoS(m.err)\n\t}\n\n\txss := make([][]string, len(m.just))\n\tfor i, v := range m.just {\n\t\txs, err := f(v).Unbox()\n\t\tif err != nil {\n\t\t\treturn ErrAoAoS(err)\n\t\t}\n\t\txss[i] = xs\n\t}\n\n\treturn JustAoAoS(xss)\n}", "func splitter(s, substr string) (bef, mid, aft string) {\n\thay, needle := []byte(s), []byte(substr)\n\tbef = string(hay)\n\tif idx := bytes.Index(hay, needle); idx > -1 {\n\t\tbef = s[:idx]\n\t\tmid = s[idx : idx+len(substr)]\n\t\taft = s[idx+len((substr)):]\n\t}\n\treturn bef, mid, aft\n}", "func (t Term) Split(args ...interface{}) Term {\n\treturn constructMethodTerm(t, \"Split\", p.Term_SPLIT, funcWrapArgs(args), map[string]interface{}{})\n}" ]
[ "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.54193354", "0.53648627", "0.5306607", "0.52973825", "0.5277499", "0.52668184", "0.52648014", "0.5253659", "0.5253241", "0.5234701", "0.5220265", "0.5218452", "0.52018183", "0.51916265", "0.5182363", "0.51720613", "0.51353455", "0.5133886", "0.5130342", "0.51128155", "0.5086024", "0.5082296", "0.5053271", "0.5044948", "0.5025311", "0.5013507", "0.50058854", "0.5005003", "0.5005003", "0.4991107", "0.49895665", "0.49866912", "0.49753398", "0.49753398", "0.49753398", "0.49753398", "0.49753398", "0.49753398", "0.49753398", "0.49753398", "0.49753398", "0.49753398", "0.49753398", "0.49753398", "0.4952762", "0.4943767", "0.49377057", "0.49046272", "0.48870856", "0.48831725", "0.48758638", "0.48636544", "0.48323876", "0.48285738", "0.48174742", "0.47911322", "0.47898334", "0.47865817", "0.47793344", "0.47715038", "0.4763823", "0.4756217", "0.47536078", "0.4748064", "0.47330153", "0.47156736", "0.47045946", "0.47003496", "0.47002095", "0.46975762", "0.4697167", "0.46908918", "0.46906012", "0.4687205", "0.4685309", "0.4681876", "0.46818745", "0.46737108", "0.4672175" ]
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\tfmt.Print(\"\\\"\" + s + \"\\\"\")\n\t\t\t\tif i < len(s)-1 {\n\t\t\t\t\tfmt.Print(\",\")\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Println()\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t})\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\tsplits = append(splits, \"\")\n\t}\n\treturn splits\n}", "func SplitAfter(sep, operand string) []string { return strings.SplitAfter(operand, sep) }", "func (re *RegexpStd) Split(s string, n int) []string {\n\n\t// if n == 0 {\n\t// \treturn nil\n\t// }\n\n\t// if len(re.expr) > 0 && len(s) == 0 {\n\t// \treturn []string{\"\"}\n\t// }\n\n\t// matches := re.FindAllStringIndex(s, n)\n\t// strings := make([]string, 0, len(matches))\n\n\t// beg := 0\n\t// end := 0\n\t// for _, match := range matches {\n\t// \tif n > 0 && len(strings) >= n-1 {\n\t// \t\tbreak\n\t// \t}\n\n\t// \tend = match[0]\n\t// \tif match[1] != 0 {\n\t// \t\tstrings = append(strings, s[beg:end])\n\t// \t}\n\t// \tbeg = match[1]\n\t// }\n\n\t// if end != len(s) {\n\t// \tstrings = append(strings, s[beg:])\n\t// }\n\n\t// return strings\n\tpanic(\"\")\n}", "func splits(fm *Frame, opts maxOpt, sep, s string) {\n\tout := fm.ports[1].Chan\n\tparts := strings.SplitN(s, sep, opts.Max)\n\tfor _, p := range parts {\n\t\tout <- p\n\t}\n}", "func IndexN(b, sep []byte, n int) (index int) {\n\tindex, idx, sepLen := 0, -1, len(sep)\n\tfor i := 0; i < n; i++ {\n\t\tif idx = bytes.Index(b, sep); idx == -1 {\n\t\t\tbreak\n\t\t}\n\t\tb = b[idx+sepLen:]\n\t\tindex += idx\n\t}\n\n\tif idx == -1 {\n\t\tindex = -1\n\t} else {\n\t\tindex += (n - 1) * sepLen\n\t}\n\n\treturn\n}", "func split(n string) (string, string) {\n\tfor _, s := range allSuffixes {\n\t\tif strings.HasSuffix(n, s) {\n\t\t\tp := strings.TrimSuffix(n, s)\n\t\t\treturn p, s\n\t\t}\n\t}\n\treturn n, \"\"\n}", "func SplitEach(data []byte, n int) (chunks [][]byte) {\n\tif n <= 0 {\n\t\tchunks = append(chunks, data)\n\t\treturn chunks\n\t}\n\n\tvar (\n\t\tsize = len(data)\n\t\trows = (size / n)\n\t\ttotal int\n\t)\n\tfor x := 0; x < rows; x++ {\n\t\tchunks = append(chunks, data[total:total+n])\n\t\ttotal += n\n\t}\n\tif total < size {\n\t\tchunks = append(chunks, data[total:])\n\t}\n\treturn chunks\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func SliceNTokens(b []byte, tok byte, n int) (s []byte, nLeft int) {\n\tfor i := range b {\n\t\tif b[i] == tok {\n\t\t\tn--\n\t\t\tif n == 0 { return b[:i+1], 0 }\n\t\t}\n\t}\n\n\treturn b, n\n}", "func wrapN(i, slop int, s string) (string, string) {\n\tif i+slop > len(s) {\n\t\treturn s, \"\"\n\t}\n\n\tw := strings.LastIndexAny(s[:i], \" \\t\\n\")\n\tif w <= 0 {\n\t\treturn s, \"\"\n\t}\n\tnlPos := strings.LastIndex(s[:i], \"\\n\")\n\tif nlPos > 0 && nlPos < w {\n\t\treturn s[:nlPos], s[nlPos+1:]\n\t}\n\treturn s[:w], s[w+1:]\n}", "func Test_splitN(t *testing.T) {\n\tc := make(chan string, 5)\n\n\tcs := splitN(c, 2)\n\n\tgo func() {\n\t\tfor s := range cs[0] {\n\t\t\tt.Logf(\"read cs[0] value \\\"%s\\\"\\n\", s)\n\t\t}\n\t\tt.Log(\"cs[0] closed\")\n\t}()\n\n\tgo func() {\n\t\tfor s := range cs[1] {\n\t\t\tt.Logf(\"read cs[1] value \\\"%s\\\"\\n\", s)\n\t\t}\n\t\tt.Log(\"cs[1] closed\")\n\t}()\n\n\n\tc <- \"string 01\"\n\tc <- \"string 02\"\n\n\tt.Logf(\"channel c has %d/%d items\\n\", len(c), cap(c))\n\tt.Logf(\"channel cs[0] has %d/%d items\\n\", len(cs[0]), cap(cs[0]))\n\tt.Logf(\"channel cs[1] has %d/%d items\\n\", len(cs[1]), cap(cs[1]))\n\n\tclose(c)\n\n\ttime.Sleep(100 * time.Millisecond)\n\tt.Log(\"finish\")\n}", "func split(buf []byte, fn func(pos int, buf []byte) error) error {\n\tvar pos int\n\tfor {\n\t\tm := bytes.IndexByte(buf, byte(' '))\n\t\tif m < 0 {\n\t\t\tbreak\n\t\t}\n\t\tif err := fn(pos, buf[:m]); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpos++\n\t\tbuf = buf[m+1:]\n\t}\n\tif err := fn(pos, buf); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func split(str, sep string) (a, b string) {\n\tparts := strings.SplitN(str, sep, 2)\n\ta = strings.TrimSpace(parts[0])\n\tif len(parts) == 2 {\n\t\tb = strings.TrimSpace(parts[1])\n\t}\n\treturn\n}", "func SplitStringSliceByLimit(in []string, limit uint) [][]string {\n\tvar stringSlice []string\n\tsliceSlice := make([][]string, 0, len(in)/int(limit)+1)\n\tfor len(in) >= int(limit) {\n\t\tstringSlice, in = in[:limit], in[limit:]\n\t\tsliceSlice = append(sliceSlice, stringSlice)\n\t}\n\tif len(in) > 0 {\n\t\tsliceSlice = append(sliceSlice, in)\n\t}\n\treturn sliceSlice\n}", "func SplitAt(args []string, sep string) ([]string, []string) {\n\tindex := -1\n\tfor i, a := range args {\n\t\tif a == sep {\n\t\t\tindex = i\n\t\t\tbreak\n\t\t}\n\t}\n\tif index == -1 {\n\t\treturn args, []string{}\n\t}\n\treturn args[:index], args[index+1:]\n}", "func splitLast(input string, sep string) []string {\n\tsplit_str := strings.Split(input, sep)\n\treturn append([]string{strings.Join(split_str[0:len(split_str)-1], sep)}, split_str[len(split_str)-1:]...)\n}", "func splitVersion(s, sep string) (string, string) {\n\tspl := strings.SplitN(s, sep, 2)\n\tif len(spl) < 2 {\n\t\treturn s, \"\"\n\t}\n\treturn spl[0], spl[1]\n}", "func splitAfterNewline(p []byte) ([][]byte, []byte) {\n\tchunk := p\n\tvar lines [][]byte\n\n\tfor len(chunk) > 0 {\n\t\tidx := bytes.Index(chunk, newLine)\n\t\tif idx == -1 {\n\t\t\treturn lines, chunk\n\t\t}\n\n\t\tlines = append(lines, chunk[:idx+1])\n\n\t\tif idx == len(chunk)-1 {\n\t\t\tchunk = nil\n\t\t\tbreak\n\t\t}\n\n\t\tchunk = chunk[idx+1:]\n\t}\n\n\treturn lines, chunk\n}", "func All(n int, str string) (output []string) {\n\tfor i := 0; (i + n) < len(str)+1; i++ {\n\t\toutput = append(output, str[i:i+n])\n\t}\n\treturn\n}", "func Split(sep, operand string) []string { return strings.Split(operand, sep) }", "func splitOnce(s, sep string) (string, string) {\n\tn := strings.Index(s, sep)\n\tif n == -1 {\n\t\treturn s, \"\"\n\t}\n\treturn s[:n], s[n+len(sep):]\n}", "func TakeStr(n int, list []string) []string {\n\tif n < 0 {\n\t\treturn []string{}\n\t}\n\n\tnewListLen := len(list)\n\n\tif n < newListLen {\n\t\tnewListLen = n\n\t}\n\tnewList := make([]string, newListLen)\n\tfor i := 0; i < newListLen; i++ {\n\t\tnewList[i] = list[i]\n\t}\n\treturn newList\n}", "func SplitBytes(inputBytes []byte, n int) [][]byte {\r\n\r\n\tsize := len(inputBytes) / n\r\n\tif (len(inputBytes) % n) != 0 {\r\n\t\tsize += 1\r\n\t}\r\n\r\n\tsplits := make([][]byte, size)\r\n\r\n\tfor i := 0; i < len(inputBytes); i += n {\r\n\r\n\t\tif i+n > len(inputBytes) {\r\n\t\t\tsplits[i/n] = inputBytes[i:len(inputBytes)]\r\n\t\t} else {\r\n\t\t\tsplits[i/n] = inputBytes[i : i+n]\r\n\t\t}\r\n\t}\r\n\r\n\treturn splits\r\n}", "func SplitAfter[T any](slice []T, predicate func(T) bool) [][]T {\n\tvar result [][]T\n\tvar building []T\n\tfor _, elem := range slice {\n\t\tbuilding = append(building, elem)\n\t\tif predicate(elem) {\n\t\t\tresult = append(result, building)\n\t\t\tbuilding = []T{}\n\t\t}\n\t}\n\tif len(building) > 0 {\n\t\tresult = append(result, building)\n\t}\n\treturn result\n}", "func NewStringSlice(n ...string) *Slice { return NewSlice(sort.StringSlice(n)) }", "func split(klines []Kline, num int) []Kline {\n\tif len(klines) <= num {\n\t\treturn klines\n\t}\n\treturn klines[:num]\n}", "func Take(n int, s string) string {\n\tfor i := range s {\n\t\tif n <= 0 {\n\t\t\treturn s[0:i]\n\t\t}\n\t\tn--\n\t}\n\treturn s\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(s string) []string {\n\tlastRune := map[rune]int{}\n\tf := func(c rune) bool {\n\t\tswitch {\n\t\tcase lastRune[c] > 0:\n\t\t\tlastRune[c]--\n\t\t\treturn false\n\t\tcase unicode.In(c, unicode.Quotation_Mark):\n\t\t\tlastRune[c]++\n\t\t\treturn false\n\t\tcase c == '[':\n\t\t\tlastRune[']']++\n\t\t\treturn false\n\t\tcase c == '{':\n\t\t\tlastRune['}']++\n\t\t\treturn false\n\t\tcase mapGreaterThan(lastRune, 0):\n\t\t\treturn false\n\t\tdefault:\n\t\t\treturn c == ' '\n\t\t}\n\t}\n\treturn strings.FieldsFunc(s, f)\n}", "func split(n int) []int {\n\tif n <= 0 {\n\t\tpanic(\"no split for n <= 0 please\")\n\t}\n\tres := []int{}\n\tfor n > 0 {\n\t\tif n%10 > 0 {\n\t\t\tres = append([]int{n % 10}, res...)\n\t\t} else {\n\t\t\tres = append([]int{10}, res...)\n\t\t}\n\t\tn /= 10\n\t}\n\tif len(res) < 7 {\n\t\tres = append([]int{10}, res...)\n\t}\n\treturn res\n}", "func splitMessage(msg string, splitLen int) (msgs []string) {\n\t// This is quite short ;-)\n\tif splitLen < 10 {\n\t\tsplitLen = 10\n\t}\n\tfor len(msg) > splitLen {\n\t\tidx := indexFragment(msg[:splitLen])\n\t\tif idx < 0 {\n\t\t\tidx = splitLen\n\t\t}\n\t\tmsgs = append(msgs, msg[:idx] + \"...\")\n\t\tmsg = msg[idx:]\n\t}\n\treturn append(msgs, msg)\n}", "func splitArgs(n int, args []string) ( /*positional*/ []string /*flags*/, []string) {\n\tif len(args) == 0 {\n\t\treturn nil, nil\n\t}\n\n\t// no positional, or user passed only flags (e.g. \"cmd -h\")\n\tif n == 0 || (args[0] != \"\" && args[0][0] == '-') {\n\t\treturn nil, args\n\t}\n\n\tif len(args) <= n {\n\t\treturn args, nil\n\t}\n\n\treturn args[:n], args[n:]\n}", "func StringSplitV2Maxsplit(value int64) StringSplitV2Attr {\n\treturn func(m optionalAttr) {\n\t\tm[\"maxsplit\"] = value\n\t}\n}", "func onlyN(a []string, n int) []string {\n\tn = -n\n\tif n > 0 {\n\t\tif n > len(a) {\n\t\t\tn = len(a)\n\t\t}\n\t\ta = a[:n]\n\t} else {\n\t\tif -n > len(a) {\n\t\t\tn = -len(a)\n\t\t}\n\t\ta = a[len(a)+n:]\n\t}\n\treturn a\n}", "func cleanLines(n int, scanner *bufio.Scanner, writer *bufio.Writer) {\n\tif n == 0 {\n\t\ttxt := scanner.Text()\n\t\twriter.WriteString(txt)\n\t} else {\n\t\tfor scanner.Scan() {\n\t\t\ttxt := scanner.Text()\n\t\t\tind := strings.LastIndex(txt, parse.delim)\n\t\t\tnumfields_str := txt[ind+1:]\n\t\t\ttxt = txt[:ind]\n\n\t\t\tnumfields, _ := strconv.Atoi(numfields_str)\n\t\t\tk := n - numfields\n\t\t\tif k > 0 {\n\t\t\t\ttxt += strings.Repeat(parse.delim, k)\n\t\t\t}\n\t\t\twriter.WriteString(txt + \"\\n\")\n\t\t}\n\t}\n}", "func split2(s, sep string) (string, string, bool) {\n\tspl := strings.SplitN(s, sep, 2)\n\tif len(spl) < 2 {\n\t\treturn \"\", \"\", false\n\t}\n\treturn spl[0], spl[1], true\n}", "func split2(s, sep string) (string, string, bool) {\n\tspl := strings.SplitN(s, sep, 2)\n\tif len(spl) < 2 {\n\t\treturn \"\", \"\", false\n\t}\n\treturn spl[0], spl[1], true\n}", "func IndexAfter(s, sep []byte) int {\n\tpos := bytes.Index(s, sep)\n\tif pos == -1 {\n\t\treturn -1\n\t}\n\treturn pos + len(sep)\n}", "func (c StringArrayCollection) Split(num int) Collection {\n\tvar d = make([][]interface{}, int(math.Ceil(float64(len(c.value))/float64(num))))\n\n\tj := -1\n\tfor i := 0; i < len(c.value); i++ {\n\t\tif i%num == 0 {\n\t\t\tj++\n\t\t\tif i+num <= len(c.value) {\n\t\t\t\td[j] = make([]interface{}, num)\n\t\t\t} else {\n\t\t\t\td[j] = make([]interface{}, len(c.value)-i)\n\t\t\t}\n\t\t\td[j][i%num] = c.value[i]\n\t\t} else {\n\t\t\td[j][i%num] = c.value[i]\n\t\t}\n\t}\n\n\treturn MultiDimensionalArrayCollection{\n\t\tvalue: d,\n\t}\n}", "func TestAppendSplit(t *testing.T) {\n\ttests := []string{\n\t\t\"\",\n\t\t\"Hello, World\",\n\t\t\"Hello, 世界\",\n\t\tstrings.Repeat(\"Hello, 世界\", smallSize*2/len(\"Hello, 世界\")),\n\t}\n\tfor _, test := range tests {\n\t\tfor i := range test {\n\t\t\tr := Append(New(test[:i]), New(test[i:]))\n\t\t\tok := true\n\t\t\tif got := r.String(); got != test {\n\t\t\t\tt.Errorf(\"Append(%q, %q)=%q\", test[:i], test[i:], got)\n\t\t\t\tok = false\n\t\t\t}\n\t\t\tif r.Len() != int64(len(test)) {\n\t\t\t\tt.Errorf(\"Append(%q, %q).Len()=%d, want %d\",\n\t\t\t\t\ttest[:i], test[i:], r.Len(), len(test))\n\t\t\t\tok = false\n\t\t\t}\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor j := range test {\n\t\t\t\tleft, right := Split(r, int64(j))\n\t\t\t\tgotLeft := left.String()\n\t\t\t\tgotRight := right.String()\n\t\t\t\tif gotLeft != test[:j] || gotRight != test[j:] {\n\t\t\t\t\tt.Errorf(\"Split(Append(%q, %q))=%q,%q\",\n\t\t\t\t\t\ttest[:i], test[i:], gotLeft, gotRight)\n\t\t\t\t}\n\t\t\t\tif left.Len() != int64(j) {\n\t\t\t\t\tt.Errorf(\"Split(Append(%q, %q)).left.Len()=%d, want %d\",\n\t\t\t\t\t\ttest[:i], test[i:], left.Len(), j)\n\t\t\t\t}\n\t\t\t\tif right.Len() != int64(len(test)-j) {\n\t\t\t\t\tt.Errorf(\"Split(Append(%q, %q)).right.Len()=%d, want %d\",\n\t\t\t\t\t\ttest[:i], test[i:], right.Len(), len(test)-j)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func StringSplit2(s, sep string) (head, tail string) {\n\tindex := strings.Index(s, sep)\n\tif index < 0 {\n\t\treturn s, \"\"\n\t}\n\treturn string(s[:index]), string(s[index+1:])\n}", "func (mmSplit *StorageMock) SplitAfterCounter() uint64 {\n\treturn mm_atomic.LoadUint64(&mmSplit.afterSplitCounter)\n}", "func str_split(s, sep string) []string {\n\tstrs := strings.Split(s, sep)\n\tout := make([]string, 0, len(strs))\n\tfor _, str := range strs {\n\t\tstr = strings.Trim(str, \" \\t\")\n\t\tif len(str) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tout = append(out, str)\n\t}\n\treturn out\n}", "func (f File) Split(sep string) []string {\n\tpat := fmt.Sprintf(\"\\r?\\n{0,1}%s\\r?\\n{0,1}\", regexp.QuoteMeta(sep))\n\tre := regexp.MustCompile(pat)\n\treturn re.Split(f.String(), -1)\n}", "func ChunkSplit(s string)(r string, err error){\n const LENTH = 76\n var bfr, bfw *bytes.Buffer\n var data, block []byte\n\n data = make([]byte, 0)\n block = make([]byte, LENTH)\n bfr = bytes.NewBufferString(s)\n bfw = bytes.NewBuffer(data)\n var l int\n for {\n l, err = bfr.Read(block)\n if err == io.EOF{\n err = nil\n break\n }\n if err != nil{\n return\n }\n _, err = bfw.Write(block[:l])\n if err != nil{\n return\n }\n _, err = bfw.WriteString(\"\\r\\n\")\n if err != nil{\n return\n }\n }\n r = bfw.String()\n return\n}", "func ReadNTokens(rd io.Reader, tok byte, n int) []byte {\n\tbuf := make([]byte, 1<<10)\n\tout, slice := []byte{}, []byte{}\n\t\n\tfor n > 0 {\n\t\tnRead, err := io.ReadFull(rd, buf)\n\t\tif err == io.EOF { break }\n\t\tslice, n = SliceNTokens(buf[:nRead], tok, n)\n\n\t\tout = append(out, slice...)\n\t}\n\n\treturn out\n}", "func splitKV(s, sep string) (string, string) {\n\tret := strings.SplitN(s, sep, 2)\n\treturn ret[0], ret[1]\n}", "func customSplit(s string) []string {\n\tvar result []string\n\tvar cur string\n\tparenDepth := 0\n\tfor _, v := range strings.Split(s, \"\") {\n\t\tif v == \"(\" {\n\t\t\tparenDepth++\n\t\t}\n\t\tif v == \")\" && parenDepth > 0 {\n\t\t\tparenDepth--\n\t\t}\n\t\tif v == \".\" && parenDepth == 0 {\n\t\t\tresult = append(result, cur)\n\t\t\tcur = \"\"\n\t\t} else {\n\t\t\tcur += v\n\t\t}\n\t}\n\tif cur != \"\" {\n\t\tresult = append(result, cur)\n\t}\n\treturn result\n}", "func All(n int, s string) []string {\n\tout := make([]string, len(s)-n+1)\n\n\tfor i := 0; i+n <= len(s); i++ {\n\t\tout[i] = s[i : i+n]\n\t}\n\n\treturn out\n}", "func (p *Permutator) NextN(count int) interface{} { \n\tif count <= 0 || p.left() == 0 {\n\t\treturn reflect.MakeSlice(reflect.SliceOf(p.value.Type()), 0, 0).Interface()\n\t}\n \n cap := p.left()\n\tif cap > count {\n\t\tcap = count\n\t}\n\n result := reflect.MakeSlice(reflect.SliceOf(p.value.Type()), cap, cap)\n\n length := 0 \n for index := 0; index < cap; index++ { \n if _, ok := p.Next(); ok {\n length++\n list := p.copySliceValue()\n result.Index(index).Set(list)\n }\n }\n\n list := reflect.MakeSlice(result.Type(), length, length)\n reflect.Copy(list, result)\n \n return list.Interface()\n}", "func split(s string, sep string) []string {\n\tvar a []string\n\tfor _, v := range strings.Split(s, sep) {\n\t\tif v = strings.TrimSpace(v); v != \"\" {\n\t\t\ta = append(a, v)\n\t\t}\n\t}\n\treturn a\n}", "func NewNewlineSplitFunc(encoding encoding.Encoding) (bufio.SplitFunc, error) {\n\tnewline, err := encodedNewline(encoding)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcarriageReturn, err := encodedCarriageReturn(encoding)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn func(data []byte, atEOF bool) (advance int, token []byte, err error) {\n\t\tif atEOF && len(data) == 0 {\n\t\t\treturn 0, nil, nil\n\t\t}\n\n\t\tif i := bytes.Index(data, newline); i >= 0 {\n\t\t\t// We have a full newline-terminated line.\n\t\t\treturn i + len(newline), bytes.TrimSuffix(data[:i], carriageReturn), nil\n\t\t}\n\n\t\t// Request more data.\n\t\treturn 0, nil, nil\n\t}, nil\n}", "func nthString(s string, i int) (string, error) {\n\tss := strings.Split(s, \";\")\n\tif len(ss) <= i {\n\t\treturn \"\", errors.New(\"array too short\")\n\t}\n\treturn ss[i], nil\n}", "func QuickCheckStringsN(t *testing.T, n int, pred func(string) bool) {\n\tcfg := quick.Config{\n\t\tMaxCount: n,\n\t}\n\tif err := quick.Check(pred, &cfg); err != nil {\n\t\tt.Error(err)\n\t}\n}", "func MakeNString(n int, s string) string {\n\tresString := \"\"\n\tfor i := 0; i < n; i++ {\n\t\tresString += s\n\t}\n\treturn resString\n}", "func SplitString(text string, size int) []string {\n\tif len(text) < size {\n\t\treturn []string{text}\n\t}\n\n\ttextByNL := strings.SplitAfter(text, \"\\n\")\n\tif len(textByNL) == 1 {\n\t\treturn splitStringWithSize(text, size)\n\t}\n\tvar (\n\t\tchunk string\n\t)\n\tchunks := make([]string, 0)\n\tfor _, text := range textByNL {\n\t\tif (len(chunk) + len(text)) >= size {\n\t\t\tchunks = append(chunks, chunk)\n\t\t\tchunk = \"\"\n\t\t}\n\t\tif len(text) > size {\n\t\t\tchunks = append(chunks, splitStringWithSize(text, size)...)\n\t\t\tcontinue\n\t\t}\n\t\tchunk = chunk + text\n\t}\n\tif len(chunk) > 0 {\n\t\tchunks = append(chunks, chunk)\n\t}\n\n\treturn chunks\n}", "func (g *Generator) fieldSelectorN(n int) string {\n\treturn \"pb->\" + strings.Join(g.fieldNames(n), \"->\")\n}", "func helpsTestOutputSplitThreeChunks(t *testing.T, data []byte) {\n\tfor i := 1; i < len(data)-2; i++ {\n\t\tfor j := i + 1; j < len(data)-1; j++ {\n\t\t\thelpsTestOutputSplitThreeChunksAtIndex(t, data, i, j)\n\t\t}\n\t}\n}", "func RepeatStringN(v string, n int) <-chan string {\n\tch := make(chan string, 1)\n\tgo func() {\n\t\tfor i := 0; i < n; i++ {\n\t\t\tch <- v\n\t\t}\n\t}()\n\treturn ch\n}", "func getHalfBySep(s, sep string, half uint) string {\n\tif split := strings.SplitN(s, sep, 2); len(split) == 2 && half < 2 {\n\t\treturn split[half]\n\t}\n\treturn s\n}", "func countingSplitFunc(split bufio.SplitFunc, bytesRead *int64) bufio.SplitFunc {\n\treturn func(data []byte, atEOF bool) (advance int, token []byte, err error) {\n\t\tadv, tok, err := split(data, atEOF)\n\t\t(*bytesRead) += int64(adv)\n\t\treturn adv, tok, err\n\t}\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 solveN(input string, n int) string {\n\t// iterate over the \"trimmed\" string.\n\tinput = strings.TrimSpace(input)\n\tbuf := make([]rune, n)\n\t//fmt.Println(\"input:\", input)\niteration:\n\tfor i, r := range input {\n\t\tbuf[i%n] = r\n\t\tif i < n-1 {\n\t\t\tcontinue\n\t\t}\n\t\t// if the buf contains ALL different values we are good.\n\t\t//fmt.Println(\"index:\", i, \"buf:\", string(buf[]))\n\t\tfor x := 0; x < n-1; x++ {\n\t\t\tfor y := x + 1; y < n; y++ {\n\t\t\t\t//fmt.Println(\"testing, x:\", x, \"y:\", y, \"buf[x]:\", buf[x], \"buf[y]:\", buf[y])\n\t\t\t\tif buf[x] == buf[y] {\n\t\t\t\t\tcontinue iteration\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// if we got here, we are done.\n\t\treturn fmt.Sprint(i + 1)\n\t}\n\tpanic(\"no solution\")\n}", "func Drop(n int, s string) string {\n\tfor i := range s {\n\t\tif n <= 0 {\n\t\t\treturn s[i:]\n\t\t}\n\t\tn--\n\t}\n\treturn \"\"\n}", "func (s *Str) Split(sep string) []string {\n\treturn strings.Split(s.val, sep)\n}", "func All(n int, s string) []string {\n\tvar substrings []string\n\tfor i := 0; i < len(s)-n+1; i++ {\n\t\tsubstrings = append(substrings, s[i:i+n])\n\t}\n\treturn substrings\n}", "func tokenNgrams(s string, n int) (result []string) {\n\tvar buf bytes.Buffer\n\tfor _, token := range tokenizeString(s) {\n\t\tbuf.Reset()\n\t\tfor i, c := range token {\n\t\t\tif i > 0 && i%n == 0 {\n\t\t\t\tresult = append(result, buf.String())\n\t\t\t\tbuf.Reset()\n\t\t\t}\n\t\t\tbuf.WriteRune(c) // XXX: skipping error handling\n\t\t}\n\t\tresult = append(result, buf.String())\n\t}\n\treturn\n}", "func (n UDN) Split() (head Label, tail Name) {\n\ts := n.String()\n\ti := strings.Index(s, \".\")\n\n\thead = Label(s[:i])\n\n\tif i != -1 {\n\t\ttail = UDN(s[i:])\n\t}\n\n\treturn\n}", "func (cli *CLI) split(args []string) error {\n\tfor _, arg := range args {\n\t\telems := strings.Split(arg, cli.delim)\n\t\t// width of line numbers\n\t\twidth := len(elems)/10 + 1\n\n\t\tfor i, p := range elems {\n\t\t\tif !cli.nonum {\n\t\t\t\tif _, e := fmt.Fprintf(cli.outStream, \"%\"+strconv.Itoa(width)+\"d \", i+1); e != nil {\n\t\t\t\t\treturn e\n\t\t\t\t}\n\t\t\t}\n\t\t\tif _, e := fmt.Fprintf(cli.outStream, \"%s\\n\", p); e != nil {\n\t\t\t\treturn e\n\t\t\t}\n\t\t}\n\t\t// new line\n\t\tif _, e := fmt.Fprintln(cli.outStream); e != nil {\n\t\t\treturn e\n\t\t}\n\t}\n\n\treturn nil\n}", "func maybeSplitOffFrame(s *segment, n uint64) *segment {\n\tif n >= s.dataLen() {\n\t\treturn nil\n\t}\n\n\tdefer func() {\n\t\ts.data = s.data[n:]\n\t\ts.offset += n\n\t}()\n\n\treturn &segment{\n\t\toffset: s.offset,\n\t\tdata: s.data[:n],\n\t}\n}", "func factoryDelimiter(delimiter []byte) bufio.SplitFunc {\n\treturn func(data []byte, eof bool) (int, []byte, error) {\n\t\tif eof && len(data) == 0 {\n\t\t\treturn 0, nil, nil\n\t\t}\n\t\tif i := bytes.Index(data, delimiter); i >= 0 {\n\t\t\treturn i + len(delimiter), dropDelimiter(data[0:i], delimiter), nil\n\t\t}\n\t\tif eof {\n\t\t\treturn len(data), dropDelimiter(data, delimiter), nil\n\t\t}\n\t\treturn 0, nil, nil\n\t}\n}", "func helpsTestOutputSplitChunks(t *testing.T, data []byte) {\n\tfor i := 1; i < len(data)-1; i++ {\n\t\thelpsTestOutputSplitChunksAtIndex(t, i, data)\n\t}\n}", "func SplitLines(lines []string) <-chan string {\n\toutput := make(chan string, 5)\n\tgo func() {\n\t\tdefer close(output)\n\t\tfor _, line := range lines {\n\t\t\tfor _, word := range strings.Split(line, \" \") {\n\t\t\t\toutput <- word\n\t\t\t}\n\t\t}\n\t}()\n\treturn output\n}", "func SubstringAfterLast(str string, sep string) string {\n\tidx := strings.LastIndex(str, sep)\n\tif idx == -1 {\n\t\treturn str\n\t}\n\treturn str[idx+len(sep):]\n}", "func TestCheckSplitStopsTooManyInputs(t *testing.T) {\n\n\tdata := createStdTestData(20)\n\tsplit, _ := data.createTestTransactions()\n\n\tfor len(split.TxIn) < 30 {\n\t\tsplit.AddTxIn(wire.NewTxIn(&wire.OutPoint{}, 0, nil))\n\t}\n\n\terr := data.checkSplit(split)\n\tif err == nil {\n\t\tt.Fatalf(\"a split with too many inputs should not be valid\")\n\t}\n}", "func Delimit(s string, sep rune) string {\n\tout := make([]rune, 0, len(s)+5)\n\n\tfor _, r := range s {\n\t\tswitch {\n\t\tcase unicode.IsUpper(r):\n\t\t\tif last := len(out) - 1; last >= 0 && unicode.IsLower(out[last]) {\n\t\t\t\tout = append(out, sep)\n\t\t\t}\n\n\t\tcase unicode.IsLetter(r):\n\t\t\tif i := len(out) - 1; i >= 0 {\n\t\t\t\tif last := out[i]; unicode.IsUpper(last) {\n\t\t\t\t\tout = out[:i]\n\t\t\t\t\tif i > 0 && out[i-1] != sep {\n\t\t\t\t\t\tout = append(out, sep)\n\t\t\t\t\t}\n\t\t\t\t\tout = append(out, unicode.ToLower(last))\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase !unicode.IsNumber(r):\n\t\t\tif i := len(out); i != 0 && out[i-1] != sep {\n\t\t\t\tout = append(out, sep)\n\t\t\t}\n\t\t\tcontinue\n\n\t\t}\n\t\tout = append(out, r)\n\t}\n\n\tif len(out) == 0 {\n\t\treturn \"\"\n\t}\n\n\t// trim tailing separator\n\tif i := len(out) - 1; out[i] == sep {\n\t\tout = out[:i]\n\t}\n\n\tif len(out) == 1 {\n\t\tout[0] = unicode.ToLower(out[0])\n\t}\n\n\treturn string(out)\n}", "func Tail(n int, operand []string) []string {\n\tif len(operand) < n {\n\t\treturn operand\n\t}\n\treturn operand[len(operand)-n:]\n}", "func splitString(s, sep string) []string {\n\tif s == \"\" {\n\t\treturn []string{}\n\t}\n\treturn strings.Split(s, sep)\n}", "func splitMultiple(x string, s []string) []string {\n\tif len(x) == 0 {\n\t\treturn nil\n\t}\n\tif len(s) == 0 {\n\t\treturn []string{x}\n\t}\n\tr := strings.Split(x, s[0])\n\tfor _, sx := range s[1:] {\n\t\tt := make([]string, 0, len(r))\n\t\tfor _, ry := range r {\n\t\t\tt = append(t, strings.Split(ry, sx)...)\n\t\t}\n\t\tr = t\n\t}\n\tres := make([]string, 0, len(r))\n\tfor _, x := range r {\n\t\tif y := strings.TrimSpace(x); y != \"\" {\n\t\t\tres = append(res, y)\n\t\t}\n\t}\n\treturn res\n}", "func All(n int, s string) []string {\n\tc := 1 + len(s) - n // how many substrings will we generate?\n\tr := make([]string, c) // allocate our result slice\n\tfor x := 0; x < c; x++ { // populate result slice\n\t\tr[x] = s[x : x+n]\n\t}\n\treturn r\n}", "func (calc *Calculator) split(numbers string) (split []string) {\n\treturn strings.FieldsFunc(numbers, func(r rune) bool {\n\t\tfor _, delimiter := range calc.delimiters {\n\t\t\tif r == delimiter {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t})\n}", "func getSplitIndex(length int) int {\n\tif length%2 == 0 {\n\t\treturn length / 2\n\t}\n\n\treturn length/2 + 1\n}", "func helpsTestOutputSplitChunksAtIndex(t *testing.T, i int, data []byte) {\n\tt.Logf(\"\\ni=%d\", i)\n\tstdOut, _, _, mock := newBufferedMockTerm()\n\n\tt.Logf(\"\\nWriting chunk[0] == %s\", string(data[:i]))\n\tt.Logf(\"\\nWriting chunk[1] == %s\", string(data[i:]))\n\tstdOut.Write(data[:i])\n\tstdOut.Write(data[i:])\n\n\tassertTrue(t, mock.OutputCommandSequence[0].Operation == WRITE_OPERATION, \"Operation should be Write : %#v\", mock)\n\tassertBytesEqual(t, data[:i], mock.OutputCommandSequence[0].Data, \"Write data should match\")\n\n\tassertTrue(t, mock.OutputCommandSequence[1].Operation == WRITE_OPERATION, \"Operation should be Write : %#v\", mock)\n\tassertBytesEqual(t, data[i:], mock.OutputCommandSequence[1].Data, \"Write data should match\")\n}", "func splitTrim(s string, sep string) []string {\n\tsplitItems := strings.Split(s, sep)\n\ttrimItems := make([]string, 0, len(splitItems))\n\tfor _, item := range splitItems {\n\t\tif item = strings.TrimSpace(item); item != \"\" {\n\t\t\ttrimItems = append(trimItems, item)\n\t\t}\n\t}\n\treturn trimItems\n}", "func (p *SliceOfMap) DropLastN(n int) ISlice {\n\tif n == 0 {\n\t\treturn p\n\t}\n\treturn p.Drop(absNeg(n), -1)\n}", "func makeNSplitIntSliceFromString(value string, batches int) [][]int {\n\t// Match non-space character sequences.\n\tre := regexp.MustCompile(`[\\S]+`)\n\t// Find all matches and return count.\n\tresults := re.FindAllString(value, -1)\n\treturn convertStringSlice2IntegerSlice(results, batches)\n}", "func split(s string, d string) []string {\n\tif s == \"\" {\n\t\treturn nil\n\t}\n\treturn strings.Split(s, d)\n}" ]
[ "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.56552154", "0.5600241", "0.552308", "0.55150485", "0.53959155", "0.5390548", "0.53648496", "0.5359368", "0.52797735", "0.5274669", "0.5213353", "0.5167541", "0.51444894", "0.5104119", "0.5087579", "0.50682753", "0.5033692", "0.49755403", "0.49507496", "0.49403906", "0.49233744", "0.4917359", "0.49135613", "0.4889269", "0.4867335", "0.48339382", "0.4833909", "0.48324707", "0.48229006", "0.48229006", "0.48135832", "0.47888154", "0.47740117", "0.47693887", "0.47674325", "0.47591493", "0.47585323", "0.4750048", "0.47453293", "0.47419262", "0.47233072", "0.4720226", "0.4715927", "0.4695098", "0.469396", "0.46930364", "0.46649346", "0.46216717", "0.46036825", "0.46027967", "0.45976606", "0.45947412", "0.45938915", "0.45832917", "0.45810124", "0.45569292", "0.45506927", "0.45343003", "0.45339411", "0.45300677", "0.4516106", "0.4513009", "0.4494395", "0.4492662", "0.4486829", "0.4484599", "0.44843876", "0.44813004", "0.4472339", "0.4465528", "0.44508427", "0.4446769", "0.44435143", "0.4440193", "0.4439314", "0.44364905", "0.44294372", "0.442939", "0.44223282", "0.44138134" ]
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\tsplits = append(splits, \"\")\n\t}\n\treturn splits\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\tfmt.Print(\"\\\"\" + s + \"\\\"\")\n\t\t\t\tif i < len(s)-1 {\n\t\t\t\t\tfmt.Print(\",\")\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Println()\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t})\n}", "func (re *RegexpStd) Split(s string, n int) []string {\n\n\t// if n == 0 {\n\t// \treturn nil\n\t// }\n\n\t// if len(re.expr) > 0 && len(s) == 0 {\n\t// \treturn []string{\"\"}\n\t// }\n\n\t// matches := re.FindAllStringIndex(s, n)\n\t// strings := make([]string, 0, len(matches))\n\n\t// beg := 0\n\t// end := 0\n\t// for _, match := range matches {\n\t// \tif n > 0 && len(strings) >= n-1 {\n\t// \t\tbreak\n\t// \t}\n\n\t// \tend = match[0]\n\t// \tif match[1] != 0 {\n\t// \t\tstrings = append(strings, s[beg:end])\n\t// \t}\n\t// \tbeg = match[1]\n\t// }\n\n\t// if end != len(s) {\n\t// \tstrings = append(strings, s[beg:])\n\t// }\n\n\t// return strings\n\tpanic(\"\")\n}", "func IndexN(b, sep []byte, n int) (index int) {\n\tindex, idx, sepLen := 0, -1, len(sep)\n\tfor i := 0; i < n; i++ {\n\t\tif idx = bytes.Index(b, sep); idx == -1 {\n\t\t\tbreak\n\t\t}\n\t\tb = b[idx+sepLen:]\n\t\tindex += idx\n\t}\n\n\tif idx == -1 {\n\t\tindex = -1\n\t} else {\n\t\tindex += (n - 1) * sepLen\n\t}\n\n\treturn\n}", "func splits(fm *Frame, opts maxOpt, sep, s string) {\n\tout := fm.ports[1].Chan\n\tparts := strings.SplitN(s, sep, opts.Max)\n\tfor _, p := range parts {\n\t\tout <- p\n\t}\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func splitandclean(in, sep string, n int) []string {\n\tv := strings.SplitN(in, sep, n)\n\tfor i := range v {\n\t\tv[i] = strings.TrimSpace(v[i])\n\t}\n\treturn v\n}", "func SliceNTokens(b []byte, tok byte, n int) (s []byte, nLeft int) {\n\tfor i := range b {\n\t\tif b[i] == tok {\n\t\t\tn--\n\t\t\tif n == 0 { return b[:i+1], 0 }\n\t\t}\n\t}\n\n\treturn b, n\n}", "func split(str, sep string) (a, b string) {\n\tparts := strings.SplitN(str, sep, 2)\n\ta = strings.TrimSpace(parts[0])\n\tif len(parts) == 2 {\n\t\tb = strings.TrimSpace(parts[1])\n\t}\n\treturn\n}", "func SplitEach(data []byte, n int) (chunks [][]byte) {\n\tif n <= 0 {\n\t\tchunks = append(chunks, data)\n\t\treturn chunks\n\t}\n\n\tvar (\n\t\tsize = len(data)\n\t\trows = (size / n)\n\t\ttotal int\n\t)\n\tfor x := 0; x < rows; x++ {\n\t\tchunks = append(chunks, data[total:total+n])\n\t\ttotal += n\n\t}\n\tif total < size {\n\t\tchunks = append(chunks, data[total:])\n\t}\n\treturn chunks\n}", "func splitVersion(s, sep string) (string, string) {\n\tspl := strings.SplitN(s, sep, 2)\n\tif len(spl) < 2 {\n\t\treturn s, \"\"\n\t}\n\treturn spl[0], spl[1]\n}", "func split(n string) (string, string) {\n\tfor _, s := range allSuffixes {\n\t\tif strings.HasSuffix(n, s) {\n\t\t\tp := strings.TrimSuffix(n, s)\n\t\t\treturn p, s\n\t\t}\n\t}\n\treturn n, \"\"\n}", "func Test_splitN(t *testing.T) {\n\tc := make(chan string, 5)\n\n\tcs := splitN(c, 2)\n\n\tgo func() {\n\t\tfor s := range cs[0] {\n\t\t\tt.Logf(\"read cs[0] value \\\"%s\\\"\\n\", s)\n\t\t}\n\t\tt.Log(\"cs[0] closed\")\n\t}()\n\n\tgo func() {\n\t\tfor s := range cs[1] {\n\t\t\tt.Logf(\"read cs[1] value \\\"%s\\\"\\n\", s)\n\t\t}\n\t\tt.Log(\"cs[1] closed\")\n\t}()\n\n\n\tc <- \"string 01\"\n\tc <- \"string 02\"\n\n\tt.Logf(\"channel c has %d/%d items\\n\", len(c), cap(c))\n\tt.Logf(\"channel cs[0] has %d/%d items\\n\", len(cs[0]), cap(cs[0]))\n\tt.Logf(\"channel cs[1] has %d/%d items\\n\", len(cs[1]), cap(cs[1]))\n\n\tclose(c)\n\n\ttime.Sleep(100 * time.Millisecond)\n\tt.Log(\"finish\")\n}", "func Split(sep, operand string) []string { return strings.Split(operand, sep) }", "func TakeStr(n int, list []string) []string {\n\tif n < 0 {\n\t\treturn []string{}\n\t}\n\n\tnewListLen := len(list)\n\n\tif n < newListLen {\n\t\tnewListLen = n\n\t}\n\tnewList := make([]string, newListLen)\n\tfor i := 0; i < newListLen; i++ {\n\t\tnewList[i] = list[i]\n\t}\n\treturn newList\n}", "func SplitBytes(inputBytes []byte, n int) [][]byte {\r\n\r\n\tsize := len(inputBytes) / n\r\n\tif (len(inputBytes) % n) != 0 {\r\n\t\tsize += 1\r\n\t}\r\n\r\n\tsplits := make([][]byte, size)\r\n\r\n\tfor i := 0; i < len(inputBytes); i += n {\r\n\r\n\t\tif i+n > len(inputBytes) {\r\n\t\t\tsplits[i/n] = inputBytes[i:len(inputBytes)]\r\n\t\t} else {\r\n\t\t\tsplits[i/n] = inputBytes[i : i+n]\r\n\t\t}\r\n\t}\r\n\r\n\treturn splits\r\n}", "func splitArgs(n int, args []string) ( /*positional*/ []string /*flags*/, []string) {\n\tif len(args) == 0 {\n\t\treturn nil, nil\n\t}\n\n\t// no positional, or user passed only flags (e.g. \"cmd -h\")\n\tif n == 0 || (args[0] != \"\" && args[0][0] == '-') {\n\t\treturn nil, args\n\t}\n\n\tif len(args) <= n {\n\t\treturn args, nil\n\t}\n\n\treturn args[:n], args[n:]\n}", "func wrapN(i, slop int, s string) (string, string) {\n\tif i+slop > len(s) {\n\t\treturn s, \"\"\n\t}\n\n\tw := strings.LastIndexAny(s[:i], \" \\t\\n\")\n\tif w <= 0 {\n\t\treturn s, \"\"\n\t}\n\tnlPos := strings.LastIndex(s[:i], \"\\n\")\n\tif nlPos > 0 && nlPos < w {\n\t\treturn s[:nlPos], s[nlPos+1:]\n\t}\n\treturn s[:w], s[w+1:]\n}", "func split(klines []Kline, num int) []Kline {\n\tif len(klines) <= num {\n\t\treturn klines\n\t}\n\treturn klines[:num]\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(n int) []int {\n\tif n <= 0 {\n\t\tpanic(\"no split for n <= 0 please\")\n\t}\n\tres := []int{}\n\tfor n > 0 {\n\t\tif n%10 > 0 {\n\t\t\tres = append([]int{n % 10}, res...)\n\t\t} else {\n\t\t\tres = append([]int{10}, res...)\n\t\t}\n\t\tn /= 10\n\t}\n\tif len(res) < 7 {\n\t\tres = append([]int{10}, res...)\n\t}\n\treturn res\n}", "func NewStringSlice(n ...string) *Slice { return NewSlice(sort.StringSlice(n)) }", "func split(buf []byte, fn func(pos int, buf []byte) error) error {\n\tvar pos int\n\tfor {\n\t\tm := bytes.IndexByte(buf, byte(' '))\n\t\tif m < 0 {\n\t\t\tbreak\n\t\t}\n\t\tif err := fn(pos, buf[:m]); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpos++\n\t\tbuf = buf[m+1:]\n\t}\n\tif err := fn(pos, buf); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func str_split(s, sep string) []string {\n\tstrs := strings.Split(s, sep)\n\tout := make([]string, 0, len(strs))\n\tfor _, str := range strs {\n\t\tstr = strings.Trim(str, \" \\t\")\n\t\tif len(str) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tout = append(out, str)\n\t}\n\treturn out\n}", "func SplitAt(args []string, sep string) ([]string, []string) {\n\tindex := -1\n\tfor i, a := range args {\n\t\tif a == sep {\n\t\t\tindex = i\n\t\t\tbreak\n\t\t}\n\t}\n\tif index == -1 {\n\t\treturn args, []string{}\n\t}\n\treturn args[:index], args[index+1:]\n}", "func ReadNTokens(rd io.Reader, tok byte, n int) []byte {\n\tbuf := make([]byte, 1<<10)\n\tout, slice := []byte{}, []byte{}\n\t\n\tfor n > 0 {\n\t\tnRead, err := io.ReadFull(rd, buf)\n\t\tif err == io.EOF { break }\n\t\tslice, n = SliceNTokens(buf[:nRead], tok, n)\n\n\t\tout = append(out, slice...)\n\t}\n\n\treturn out\n}", "func All(n int, str string) (output []string) {\n\tfor i := 0; (i + n) < len(str)+1; i++ {\n\t\toutput = append(output, str[i:i+n])\n\t}\n\treturn\n}", "func tokenNgrams(s string, n int) (result []string) {\n\tvar buf bytes.Buffer\n\tfor _, token := range tokenizeString(s) {\n\t\tbuf.Reset()\n\t\tfor i, c := range token {\n\t\t\tif i > 0 && i%n == 0 {\n\t\t\t\tresult = append(result, buf.String())\n\t\t\t\tbuf.Reset()\n\t\t\t}\n\t\t\tbuf.WriteRune(c) // XXX: skipping error handling\n\t\t}\n\t\tresult = append(result, buf.String())\n\t}\n\treturn\n}", "func splitKV(s, sep string) (string, string) {\n\tret := strings.SplitN(s, sep, 2)\n\treturn ret[0], ret[1]\n}", "func split2(s, sep string) (string, string, bool) {\n\tspl := strings.SplitN(s, sep, 2)\n\tif len(spl) < 2 {\n\t\treturn \"\", \"\", false\n\t}\n\treturn spl[0], spl[1], true\n}", "func split2(s, sep string) (string, string, bool) {\n\tspl := strings.SplitN(s, sep, 2)\n\tif len(spl) < 2 {\n\t\treturn \"\", \"\", false\n\t}\n\treturn spl[0], spl[1], true\n}", "func SplitStringSliceByLimit(in []string, limit uint) [][]string {\n\tvar stringSlice []string\n\tsliceSlice := make([][]string, 0, len(in)/int(limit)+1)\n\tfor len(in) >= int(limit) {\n\t\tstringSlice, in = in[:limit], in[limit:]\n\t\tsliceSlice = append(sliceSlice, stringSlice)\n\t}\n\tif len(in) > 0 {\n\t\tsliceSlice = append(sliceSlice, in)\n\t}\n\treturn sliceSlice\n}", "func splitOnce(s, sep string) (string, string) {\n\tn := strings.Index(s, sep)\n\tif n == -1 {\n\t\treturn s, \"\"\n\t}\n\treturn s[:n], s[n+len(sep):]\n}", "func split(s string, sep string) []string {\n\tvar a []string\n\tfor _, v := range strings.Split(s, sep) {\n\t\tif v = strings.TrimSpace(v); v != \"\" {\n\t\t\ta = append(a, v)\n\t\t}\n\t}\n\treturn a\n}", "func (f File) Split(sep string) []string {\n\tpat := fmt.Sprintf(\"\\r?\\n{0,1}%s\\r?\\n{0,1}\", regexp.QuoteMeta(sep))\n\tre := regexp.MustCompile(pat)\n\treturn re.Split(f.String(), -1)\n}", "func (c StringArrayCollection) Split(num int) Collection {\n\tvar d = make([][]interface{}, int(math.Ceil(float64(len(c.value))/float64(num))))\n\n\tj := -1\n\tfor i := 0; i < len(c.value); i++ {\n\t\tif i%num == 0 {\n\t\t\tj++\n\t\t\tif i+num <= len(c.value) {\n\t\t\t\td[j] = make([]interface{}, num)\n\t\t\t} else {\n\t\t\t\td[j] = make([]interface{}, len(c.value)-i)\n\t\t\t}\n\t\t\td[j][i%num] = c.value[i]\n\t\t} else {\n\t\t\td[j][i%num] = c.value[i]\n\t\t}\n\t}\n\n\treturn MultiDimensionalArrayCollection{\n\t\tvalue: d,\n\t}\n}", "func onlyN(a []string, n int) []string {\n\tn = -n\n\tif n > 0 {\n\t\tif n > len(a) {\n\t\t\tn = len(a)\n\t\t}\n\t\ta = a[:n]\n\t} else {\n\t\tif -n > len(a) {\n\t\t\tn = -len(a)\n\t\t}\n\t\ta = a[len(a)+n:]\n\t}\n\treturn a\n}", "func SplitAfter(sep, operand string) []string { return strings.SplitAfter(operand, sep) }", "func split(s string) []string {\n\tlastRune := map[rune]int{}\n\tf := func(c rune) bool {\n\t\tswitch {\n\t\tcase lastRune[c] > 0:\n\t\t\tlastRune[c]--\n\t\t\treturn false\n\t\tcase unicode.In(c, unicode.Quotation_Mark):\n\t\t\tlastRune[c]++\n\t\t\treturn false\n\t\tcase c == '[':\n\t\t\tlastRune[']']++\n\t\t\treturn false\n\t\tcase c == '{':\n\t\t\tlastRune['}']++\n\t\t\treturn false\n\t\tcase mapGreaterThan(lastRune, 0):\n\t\t\treturn false\n\t\tdefault:\n\t\t\treturn c == ' '\n\t\t}\n\t}\n\treturn strings.FieldsFunc(s, f)\n}", "func makeNSplitIntSliceFromString(value string, batches int) [][]int {\n\t// Match non-space character sequences.\n\tre := regexp.MustCompile(`[\\S]+`)\n\t// Find all matches and return count.\n\tresults := re.FindAllString(value, -1)\n\treturn convertStringSlice2IntegerSlice(results, batches)\n}", "func split(k, n, i int) (int, int, int) {\n\ts := k - i\n\tif s > 0 {\n\t\treturn min(n, s), i, 0\n\t}\n\treturn 0, 0, -s\n}", "func All(n int, s string) []string {\n\tout := make([]string, len(s)-n+1)\n\n\tfor i := 0; i+n <= len(s); i++ {\n\t\tout[i] = s[i : i+n]\n\t}\n\n\treturn out\n}", "func ChunkSplit(s string)(r string, err error){\n const LENTH = 76\n var bfr, bfw *bytes.Buffer\n var data, block []byte\n\n data = make([]byte, 0)\n block = make([]byte, LENTH)\n bfr = bytes.NewBufferString(s)\n bfw = bytes.NewBuffer(data)\n var l int\n for {\n l, err = bfr.Read(block)\n if err == io.EOF{\n err = nil\n break\n }\n if err != nil{\n return\n }\n _, err = bfw.Write(block[:l])\n if err != nil{\n return\n }\n _, err = bfw.WriteString(\"\\r\\n\")\n if err != nil{\n return\n }\n }\n r = bfw.String()\n return\n}", "func NewNewlineSplitFunc(encoding encoding.Encoding) (bufio.SplitFunc, error) {\n\tnewline, err := encodedNewline(encoding)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcarriageReturn, err := encodedCarriageReturn(encoding)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn func(data []byte, atEOF bool) (advance int, token []byte, err error) {\n\t\tif atEOF && len(data) == 0 {\n\t\t\treturn 0, nil, nil\n\t\t}\n\n\t\tif i := bytes.Index(data, newline); i >= 0 {\n\t\t\t// We have a full newline-terminated line.\n\t\t\treturn i + len(newline), bytes.TrimSuffix(data[:i], carriageReturn), nil\n\t\t}\n\n\t\t// Request more data.\n\t\treturn 0, nil, nil\n\t}, nil\n}", "func solveN(input string, n int) string {\n\t// iterate over the \"trimmed\" string.\n\tinput = strings.TrimSpace(input)\n\tbuf := make([]rune, n)\n\t//fmt.Println(\"input:\", input)\niteration:\n\tfor i, r := range input {\n\t\tbuf[i%n] = r\n\t\tif i < n-1 {\n\t\t\tcontinue\n\t\t}\n\t\t// if the buf contains ALL different values we are good.\n\t\t//fmt.Println(\"index:\", i, \"buf:\", string(buf[]))\n\t\tfor x := 0; x < n-1; x++ {\n\t\t\tfor y := x + 1; y < n; y++ {\n\t\t\t\t//fmt.Println(\"testing, x:\", x, \"y:\", y, \"buf[x]:\", buf[x], \"buf[y]:\", buf[y])\n\t\t\t\tif buf[x] == buf[y] {\n\t\t\t\t\tcontinue iteration\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// if we got here, we are done.\n\t\treturn fmt.Sprint(i + 1)\n\t}\n\tpanic(\"no solution\")\n}", "func (s *Str) Split(sep string) []string {\n\treturn strings.Split(s.val, sep)\n}", "func Take(n int, s string) string {\n\tfor i := range s {\n\t\tif n <= 0 {\n\t\t\treturn s[0:i]\n\t\t}\n\t\tn--\n\t}\n\treturn s\n}", "func cleanLines(n int, scanner *bufio.Scanner, writer *bufio.Writer) {\n\tif n == 0 {\n\t\ttxt := scanner.Text()\n\t\twriter.WriteString(txt)\n\t} else {\n\t\tfor scanner.Scan() {\n\t\t\ttxt := scanner.Text()\n\t\t\tind := strings.LastIndex(txt, parse.delim)\n\t\t\tnumfields_str := txt[ind+1:]\n\t\t\ttxt = txt[:ind]\n\n\t\t\tnumfields, _ := strconv.Atoi(numfields_str)\n\t\t\tk := n - numfields\n\t\t\tif k > 0 {\n\t\t\t\ttxt += strings.Repeat(parse.delim, k)\n\t\t\t}\n\t\t\twriter.WriteString(txt + \"\\n\")\n\t\t}\n\t}\n}", "func QuickCheckStringsN(t *testing.T, n int, pred func(string) bool) {\n\tcfg := quick.Config{\n\t\tMaxCount: n,\n\t}\n\tif err := quick.Check(pred, &cfg); err != nil {\n\t\tt.Error(err)\n\t}\n}", "func splitString(s, sep string) []string {\n\tif s == \"\" {\n\t\treturn []string{}\n\t}\n\treturn strings.Split(s, sep)\n}", "func nthString(s string, i int) (string, error) {\n\tss := strings.Split(s, \";\")\n\tif len(ss) <= i {\n\t\treturn \"\", errors.New(\"array too short\")\n\t}\n\treturn ss[i], nil\n}", "func StringSplit2(s, sep string) (head, tail string) {\n\tindex := strings.Index(s, sep)\n\tif index < 0 {\n\t\treturn s, \"\"\n\t}\n\treturn string(s[:index]), string(s[index+1:])\n}", "func StringSplitV2Maxsplit(value int64) StringSplitV2Attr {\n\treturn func(m optionalAttr) {\n\t\tm[\"maxsplit\"] = value\n\t}\n}", "func splitMessage(msg string, splitLen int) (msgs []string) {\n\t// This is quite short ;-)\n\tif splitLen < 10 {\n\t\tsplitLen = 10\n\t}\n\tfor len(msg) > splitLen {\n\t\tidx := indexFragment(msg[:splitLen])\n\t\tif idx < 0 {\n\t\t\tidx = splitLen\n\t\t}\n\t\tmsgs = append(msgs, msg[:idx] + \"...\")\n\t\tmsg = msg[idx:]\n\t}\n\treturn append(msgs, msg)\n}", "func Split(v, sep string) (sl []string) {\n\tif len(v) > 0 {\n\t\tsl = strings.Split(v, sep)\n\t}\n\treturn\n}", "func All(n int, s string) []string {\n\tvar substrings []string\n\tfor i := 0; i < len(s)-n+1; i++ {\n\t\tsubstrings = append(substrings, s[i:i+n])\n\t}\n\treturn substrings\n}", "func split(s string, d string) []string {\n\tif s == \"\" {\n\t\treturn nil\n\t}\n\treturn strings.Split(s, d)\n}", "func customSplit(s string) []string {\n\tvar result []string\n\tvar cur string\n\tparenDepth := 0\n\tfor _, v := range strings.Split(s, \"\") {\n\t\tif v == \"(\" {\n\t\t\tparenDepth++\n\t\t}\n\t\tif v == \")\" && parenDepth > 0 {\n\t\t\tparenDepth--\n\t\t}\n\t\tif v == \".\" && parenDepth == 0 {\n\t\t\tresult = append(result, cur)\n\t\t\tcur = \"\"\n\t\t} else {\n\t\t\tcur += v\n\t\t}\n\t}\n\tif cur != \"\" {\n\t\tresult = append(result, cur)\n\t}\n\treturn result\n}", "func splitAfterNewline(p []byte) ([][]byte, []byte) {\n\tchunk := p\n\tvar lines [][]byte\n\n\tfor len(chunk) > 0 {\n\t\tidx := bytes.Index(chunk, newLine)\n\t\tif idx == -1 {\n\t\t\treturn lines, chunk\n\t\t}\n\n\t\tlines = append(lines, chunk[:idx+1])\n\n\t\tif idx == len(chunk)-1 {\n\t\t\tchunk = nil\n\t\t\tbreak\n\t\t}\n\n\t\tchunk = chunk[idx+1:]\n\t}\n\n\treturn lines, chunk\n}", "func splitMultiple(x string, s []string) []string {\n\tif len(x) == 0 {\n\t\treturn nil\n\t}\n\tif len(s) == 0 {\n\t\treturn []string{x}\n\t}\n\tr := strings.Split(x, s[0])\n\tfor _, sx := range s[1:] {\n\t\tt := make([]string, 0, len(r))\n\t\tfor _, ry := range r {\n\t\t\tt = append(t, strings.Split(ry, sx)...)\n\t\t}\n\t\tr = t\n\t}\n\tres := make([]string, 0, len(r))\n\tfor _, x := range r {\n\t\tif y := strings.TrimSpace(x); y != \"\" {\n\t\t\tres = append(res, y)\n\t\t}\n\t}\n\treturn res\n}", "func (p *Permutator) NextN(count int) interface{} { \n\tif count <= 0 || p.left() == 0 {\n\t\treturn reflect.MakeSlice(reflect.SliceOf(p.value.Type()), 0, 0).Interface()\n\t}\n \n cap := p.left()\n\tif cap > count {\n\t\tcap = count\n\t}\n\n result := reflect.MakeSlice(reflect.SliceOf(p.value.Type()), cap, cap)\n\n length := 0 \n for index := 0; index < cap; index++ { \n if _, ok := p.Next(); ok {\n length++\n list := p.copySliceValue()\n result.Index(index).Set(list)\n }\n }\n\n list := reflect.MakeSlice(result.Type(), length, length)\n reflect.Copy(list, result)\n \n return list.Interface()\n}", "func MakeNString(n int, s string) string {\n\tresString := \"\"\n\tfor i := 0; i < n; i++ {\n\t\tresString += s\n\t}\n\treturn resString\n}", "func splitTrim(s string, sep string) []string {\n\tsplitItems := strings.Split(s, sep)\n\ttrimItems := make([]string, 0, len(splitItems))\n\tfor _, item := range splitItems {\n\t\tif item = strings.TrimSpace(item); item != \"\" {\n\t\t\ttrimItems = append(trimItems, item)\n\t\t}\n\t}\n\treturn trimItems\n}", "func TestAppendSplit(t *testing.T) {\n\ttests := []string{\n\t\t\"\",\n\t\t\"Hello, World\",\n\t\t\"Hello, 世界\",\n\t\tstrings.Repeat(\"Hello, 世界\", smallSize*2/len(\"Hello, 世界\")),\n\t}\n\tfor _, test := range tests {\n\t\tfor i := range test {\n\t\t\tr := Append(New(test[:i]), New(test[i:]))\n\t\t\tok := true\n\t\t\tif got := r.String(); got != test {\n\t\t\t\tt.Errorf(\"Append(%q, %q)=%q\", test[:i], test[i:], got)\n\t\t\t\tok = false\n\t\t\t}\n\t\t\tif r.Len() != int64(len(test)) {\n\t\t\t\tt.Errorf(\"Append(%q, %q).Len()=%d, want %d\",\n\t\t\t\t\ttest[:i], test[i:], r.Len(), len(test))\n\t\t\t\tok = false\n\t\t\t}\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor j := range test {\n\t\t\t\tleft, right := Split(r, int64(j))\n\t\t\t\tgotLeft := left.String()\n\t\t\t\tgotRight := right.String()\n\t\t\t\tif gotLeft != test[:j] || gotRight != test[j:] {\n\t\t\t\t\tt.Errorf(\"Split(Append(%q, %q))=%q,%q\",\n\t\t\t\t\t\ttest[:i], test[i:], gotLeft, gotRight)\n\t\t\t\t}\n\t\t\t\tif left.Len() != int64(j) {\n\t\t\t\t\tt.Errorf(\"Split(Append(%q, %q)).left.Len()=%d, want %d\",\n\t\t\t\t\t\ttest[:i], test[i:], left.Len(), j)\n\t\t\t\t}\n\t\t\t\tif right.Len() != int64(len(test)-j) {\n\t\t\t\t\tt.Errorf(\"Split(Append(%q, %q)).right.Len()=%d, want %d\",\n\t\t\t\t\t\ttest[:i], test[i:], right.Len(), len(test)-j)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (cutr Cutter) Split(s []byte) ([]byte, []byte) {\n\tif ieol := cutr.nextEOL(s); ieol >= 0 {\n\t\treturn s[:ieol], s[ieol:]\n\t}\n\n\treturn nil, s\n}", "func (calc *Calculator) split(numbers string) (split []string) {\n\treturn strings.FieldsFunc(numbers, func(r rune) bool {\n\t\tfor _, delimiter := range calc.delimiters {\n\t\t\tif r == delimiter {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t})\n}", "func getSplitIndex(length int) int {\n\tif length%2 == 0 {\n\t\treturn length / 2\n\t}\n\n\treturn length/2 + 1\n}", "func (cli *CLI) split(args []string) error {\n\tfor _, arg := range args {\n\t\telems := strings.Split(arg, cli.delim)\n\t\t// width of line numbers\n\t\twidth := len(elems)/10 + 1\n\n\t\tfor i, p := range elems {\n\t\t\tif !cli.nonum {\n\t\t\t\tif _, e := fmt.Fprintf(cli.outStream, \"%\"+strconv.Itoa(width)+\"d \", i+1); e != nil {\n\t\t\t\t\treturn e\n\t\t\t\t}\n\t\t\t}\n\t\t\tif _, e := fmt.Fprintf(cli.outStream, \"%s\\n\", p); e != nil {\n\t\t\t\treturn e\n\t\t\t}\n\t\t}\n\t\t// new line\n\t\tif _, e := fmt.Fprintln(cli.outStream); e != nil {\n\t\t\treturn e\n\t\t}\n\t}\n\n\treturn nil\n}", "func All(n int, s string) []string {\n\tc := 1 + len(s) - n // how many substrings will we generate?\n\tr := make([]string, c) // allocate our result slice\n\tfor x := 0; x < c; x++ { // populate result slice\n\t\tr[x] = s[x : x+n]\n\t}\n\treturn r\n}", "func TestCheckSplitStopsTooManyInputs(t *testing.T) {\n\n\tdata := createStdTestData(20)\n\tsplit, _ := data.createTestTransactions()\n\n\tfor len(split.TxIn) < 30 {\n\t\tsplit.AddTxIn(wire.NewTxIn(&wire.OutPoint{}, 0, nil))\n\t}\n\n\terr := data.checkSplit(split)\n\tif err == nil {\n\t\tt.Fatalf(\"a split with too many inputs should not be valid\")\n\t}\n}", "func Split(str string) []string {\n\tvar res []string\n\tif len(str) == 0 {\n\t\treturn res\n\t}\n\t\n\tvar index, brk int\n\trunes := []rune(str)\n\tl := len(runes)\n\t\n\tfor {\n\t\tbrk = nextBreak(str, index)\n\t\tif brk < l {\n\t\t\tres = append(res, string(runes[index:brk]))\n\t\t\tindex = brk\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\t\n\tif index < l {\n\t\tres = append(res, string(runes[index:]))\n\t}\n\t\n\treturn res\n}", "func (t *StringsTestSuite) TestSplit() {\n\tgot := Split(\"a/b/c\", \"/\")\n\twant := []string{\"a\", \"b\", \"c\"}\n\tt.Equal(want, got)\n}", "func (n UDN) Split() (head Label, tail Name) {\n\ts := n.String()\n\ti := strings.Index(s, \".\")\n\n\thead = Label(s[:i])\n\n\tif i != -1 {\n\t\ttail = UDN(s[i:])\n\t}\n\n\treturn\n}", "func SplitLine(s string) []string {\n\tn := (len(s) + 1) / 2\n\tlenSep := 1\n\tstart := 0\n\ta := make([]string, n)\n\tna := 0\n\tinString := 0\n\tescape := 0\n\tlastQuot := byte(0)\n\tfor i := 0; i+lenSep <= len(s) && na+1 < n; i++ {\n\t\t// consider \" xxx 'yyy' zzz\" as a single string\n\t\t// \" xxxx yyyy \" case, do not include \\\"\n\t\tif (s[i] == '\\'' || s[i] == '\"') && (inString%2 == 0 || lastQuot == s[i]) {\n\t\t\tinString++\n\t\t\tescape = 0\n\t\t\tlastQuot = s[i]\n\t\t} else {\n\t\t\tif !isSpace(s[i]) {\n\t\t\t\tescape = 0\n\t\t\t}\n\t\t}\n\t\tif inString%2 == 0 && isSpace(s[i]) {\n\t\t\tif start == i { //escape continuous space\n\t\t\t\tstart += lenSep\n\t\t\t} else {\n\t\t\t\ta[na] = s[start+escape : i-escape]\n\t\t\t\tna++\n\t\t\t\tstart = i + lenSep\n\t\t\t\ti += lenSep - 1\n\t\t\t}\n\t\t}\n\t}\n\tif start < len(s) {\n\t\ta[na] = s[start+escape : len(s)-escape]\n\t} else {\n\t\tna--\n\t}\n\n\treturn a[0 : na+1]\n}", "func Split(s string, d string) []string {\n\treturn strings.Split(s, d)\n}", "func splitLast(input string, sep string) []string {\n\tsplit_str := strings.Split(input, sep)\n\treturn append([]string{strings.Join(split_str[0:len(split_str)-1], sep)}, split_str[len(split_str)-1:]...)\n}", "func SplitString(text string, size int) []string {\n\tif len(text) < size {\n\t\treturn []string{text}\n\t}\n\n\ttextByNL := strings.SplitAfter(text, \"\\n\")\n\tif len(textByNL) == 1 {\n\t\treturn splitStringWithSize(text, size)\n\t}\n\tvar (\n\t\tchunk string\n\t)\n\tchunks := make([]string, 0)\n\tfor _, text := range textByNL {\n\t\tif (len(chunk) + len(text)) >= size {\n\t\t\tchunks = append(chunks, chunk)\n\t\t\tchunk = \"\"\n\t\t}\n\t\tif len(text) > size {\n\t\t\tchunks = append(chunks, splitStringWithSize(text, size)...)\n\t\t\tcontinue\n\t\t}\n\t\tchunk = chunk + text\n\t}\n\tif len(chunk) > 0 {\n\t\tchunks = append(chunks, chunk)\n\t}\n\n\treturn chunks\n}", "func getHalfBySep(s, sep string, half uint) string {\n\tif split := strings.SplitN(s, sep, 2); len(split) == 2 && half < 2 {\n\t\treturn split[half]\n\t}\n\treturn s\n}", "func splitOrEmpty(s string, sep string) []string {\n\tif len(s) < 1 {\n\t\treturn []string{}\n\t} else {\n\t\treturn strings.Split(s, sep)\n\t}\n}", "func split(buf []*lib.SearchResult, lim int) [][]*lib.SearchResult {\n\tvar chunk []*lib.SearchResult\n\tchunks := make([][]*lib.SearchResult, 0, len(buf)/lim+1)\n\tfor len(buf) >= lim {\n\t\tchunk, buf = buf[:lim], buf[lim:]\n\t\tchunks = append(chunks, chunk)\n\t}\n\tif len(buf) > 0 {\n\t\tchunks = append(chunks, buf[:len(buf)])\n\t}\n\treturn chunks\n}", "func helpsTestOutputSplitThreeChunks(t *testing.T, data []byte) {\n\tfor i := 1; i < len(data)-2; i++ {\n\t\tfor j := i + 1; j < len(data)-1; j++ {\n\t\t\thelpsTestOutputSplitThreeChunksAtIndex(t, data, i, j)\n\t\t}\n\t}\n}", "func StringSplitV2(scope *Scope, input tf.Output, sep tf.Output, optional ...StringSplitV2Attr) (indices tf.Output, values tf.Output, shape tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\tattrs := map[string]interface{}{}\n\tfor _, a := range optional {\n\t\ta(attrs)\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"StringSplitV2\",\n\t\tInput: []tf.Input{\n\t\t\tinput, sep,\n\t\t},\n\t\tAttrs: attrs,\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0), op.Output(1), op.Output(2)\n}", "func (g *Generator) fieldSelectorN(n int) string {\n\treturn \"pb->\" + strings.Join(g.fieldNames(n), \"->\")\n}", "func (idx *IndexBuf)split(s, t int) int {\n var i, j int\n for i, j = s, s; i < t; i++ {\n if idx.less(i, t) {\n idx.swap(i, j)\n j++\n }\n }\n idx.swap(j, t)\n return j\n}", "func TakeStrPtr(n int, list []*string) []*string {\n\tif n < 0 {\n\t\treturn []*string{}\n\t}\n\n\tnewListLen := len(list)\n\n\tif n < newListLen {\n\t\tnewListLen = n\n\t}\n\tnewList := make([]*string, newListLen)\n\tfor i := 0; i < newListLen; i++ {\n\t\tnewList[i] = list[i]\n\t}\n\treturn newList\n}", "func groupDigits(groups []string, n int) ([]string, bool) {\n\tstr := groups[0]\n\tif len(str) <= n {\n\t\treturn groups, false\n\t}\n\tgroup := str[len(str)-n:]\n\tstr = str[:len(str)-n]\n\tres := []string{str, group}\n\tif len(groups) > 1 {\n\t\tres = append(res, groups[1:]...)\n\t}\n\treturn res, true\n}", "func countingSplitFunc(split bufio.SplitFunc, bytesRead *int64) bufio.SplitFunc {\n\treturn func(data []byte, atEOF bool) (advance int, token []byte, err error) {\n\t\tadv, tok, err := split(data, atEOF)\n\t\t(*bytesRead) += int64(adv)\n\t\treturn adv, tok, err\n\t}\n}", "func SplitNums(text string) string {\n\treturn strings.Join(SplitNum(text), \" \")\n}", "func Split(text string) []string {\n\t// wrap GoJjieba\n\teng := gjb.NewJieba()\n\tdefer eng.Free()\n\treturn eng.Cut(text, true)\n}" ]
[ "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.5792216", "0.5706684", "0.5672042", "0.56639653", "0.5613737", "0.56098056", "0.56065065", "0.56042075", "0.55930966", "0.5568737", "0.5564169", "0.5533898", "0.5458421", "0.54513323", "0.54453677", "0.54450357", "0.54197294", "0.54059637", "0.5401882", "0.53877175", "0.53877175", "0.5366517", "0.53624773", "0.5329299", "0.5298961", "0.52876425", "0.5275143", "0.52469707", "0.51891893", "0.51848245", "0.5166326", "0.51596016", "0.51297843", "0.511045", "0.5100808", "0.51001734", "0.5070282", "0.5068147", "0.5063795", "0.50359756", "0.50214624", "0.4987304", "0.4965378", "0.49554843", "0.4948589", "0.4946014", "0.4942734", "0.4924604", "0.49240902", "0.4923454", "0.49204397", "0.49093693", "0.488833", "0.48876297", "0.48856887", "0.48759383", "0.4873449", "0.48696148", "0.48652825", "0.48649976", "0.48648208", "0.48312598", "0.48188192", "0.47995535", "0.47952574", "0.4788684", "0.47749168", "0.47635025", "0.4761395", "0.47467667", "0.47258407", "0.47257903", "0.4708822", "0.47015017", "0.469156", "0.4682705", "0.46804994", "0.4679298", "0.46772125" ]
0.87715155
0