Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 27 for NewBuffer (0.15 sec)

  1. schema/serializer.go

    		switch v := dbValue.(type) {
    		case []byte:
    			bytesValue = v
    		default:
    			return fmt.Errorf("failed to unmarshal gob value: %#v", dbValue)
    		}
    		if len(bytesValue) > 0 {
    			decoder := gob.NewDecoder(bytes.NewBuffer(bytesValue))
    			err = decoder.Decode(fieldValue.Interface())
    		}
    	}
    	field.ReflectValueOf(ctx, dst).Set(fieldValue.Elem())
    	return
    }
    
    // Value implements serializer interface
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 08:28:46 GMT 2024
    - 4.6K bytes
    - Viewed (0)
  2. internal/s3select/sql/parser_test.go

    		}
    		// repr.Println(fex, repr.Indent("  "), repr.OmitEmpty(true))
    	}
    }
    
    func TestSqlLexer(t *testing.T) {
    	// s := bytes.NewBuffer([]byte("s.['name'].*.[*].abc.[\"abc\"]"))
    	s := bytes.NewBuffer([]byte("S3Object.words.*.id"))
    	// s := bytes.NewBuffer([]byte("COUNT(Id)"))
    	lex, err := sqlLexer.Lex(s)
    	if err != nil {
    		t.Fatal(err)
    	}
    	tokens, err := lexer.ConsumeAll(lex)
    	if err != nil {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Thu Jan 18 07:03:17 GMT 2024
    - 9.2K bytes
    - Viewed (0)
  3. cni/pkg/plugin/cnieventclient.go

    	eventData, err := json.Marshal(addEvent)
    	if err != nil {
    		return err
    	}
    	var response *http.Response
    	response, err = cniClient.client.Post(cniClient.url, "application/json", bytes.NewBuffer(eventData))
    	if err != nil {
    		return err
    	}
    	defer response.Body.Close()
    
    	if response.StatusCode != http.StatusOK {
    		return fmt.Errorf("unable to push CNI event, error was %d", response.StatusCode)
    	}
    
    Go
    - Registered: Wed May 08 22:53:08 GMT 2024
    - Last Modified: Fri Jan 26 20:34:28 GMT 2024
    - 2.4K bytes
    - Viewed (0)
  4. internal/ioutil/ioutil_test.go

    		src      io.Reader
    		skipLen  int64
    		expected string
    	}{
    		{bytes.NewBuffer([]byte("")), 0, ""},
    		{bytes.NewBuffer([]byte("")), 1, ""},
    		{bytes.NewBuffer([]byte("abc")), 0, "abc"},
    		{bytes.NewBuffer([]byte("abc")), 1, "bc"},
    		{bytes.NewBuffer([]byte("abc")), 2, "c"},
    		{bytes.NewBuffer([]byte("abc")), 3, ""},
    		{bytes.NewBuffer([]byte("abc")), 4, ""},
    	}
    	for i, testCase := range testCases {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri Feb 02 11:02:31 GMT 2024
    - 5.1K bytes
    - Viewed (0)
  5. cmd/erasure-decode_test.go

    			bitrotReaders[index] = newBitrotReader(disk, nil, "testbucket", "object", tillOffset, writeAlgorithm, bitrotWriterSum(writers[index]), erasure.ShardSize())
    		}
    
    		writer := bytes.NewBuffer(nil)
    		_, err = erasure.Decode(context.Background(), writer, bitrotReaders, test.offset, test.length, test.data, nil)
    		closeBitrotReaders(bitrotReaders)
    		if err != nil && !test.shouldFail {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Tue Jan 30 20:43:25 GMT 2024
    - 21.1K bytes
    - Viewed (1)
  6. internal/config/identity/openid/jwt_test.go

              "alg":"RS256",
              "kid":"2011-04-29"}
           ]
         }`
    
    	pubKeys := publicKeys{
    		RWMutex: &sync.RWMutex{},
    		pkMap:   map[string]interface{}{},
    	}
    	err := pubKeys.parseAndAdd(bytes.NewBuffer([]byte(jsonkey)))
    	if err != nil {
    		t.Fatal("Error loading pubkeys:", err)
    	}
    	if len(pubKeys.pkMap) != 1 {
    		t.Fatalf("Expected 1 keys, got %d", len(pubKeys.pkMap))
    	}
    
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Thu Jan 18 07:03:17 GMT 2024
    - 8.3K bytes
    - Viewed (0)
  7. src/bytes/buffer_test.go

    		}
    		s += string(fub)
    		check(t, testname+" (fill 4)", buf, s)
    	}
    	return s
    }
    
    func TestNewBuffer(t *testing.T) {
    	buf := NewBuffer(testBytes)
    	check(t, "NewBuffer", buf, testString)
    }
    
    var buf Buffer
    
    // Calling NewBuffer and immediately shallow copying the Buffer struct
    // should not result in any allocations.
    // This can be used to reset the underlying []byte of an existing Buffer.
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Apr 26 13:31:36 GMT 2024
    - 18.6K bytes
    - Viewed (0)
  8. src/bytes/example_test.go

    		b = strconv.AppendInt(b, int64(i), 10)
    		b = append(b, ' ')
    		buf.Write(b)
    	}
    	os.Stdout.Write(buf.Bytes())
    	// Output: 0 1 2 3
    }
    
    func ExampleBuffer_Cap() {
    	buf1 := bytes.NewBuffer(make([]byte, 10))
    	buf2 := bytes.NewBuffer(make([]byte, 0, 10))
    	fmt.Println(buf1.Cap())
    	fmt.Println(buf2.Cap())
    	// Output:
    	// 10
    	// 10
    }
    
    func ExampleBuffer_Grow() {
    	var b bytes.Buffer
    	b.Grow(64)
    	bb := b.Bytes()
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Mar 04 15:54:40 GMT 2024
    - 15K bytes
    - Viewed (1)
  9. cmd/listen-notification-handlers.go

    	localCh := make(chan event.Event, globalAPIConfig.getRequestsPoolCapacity())
    
    	// Convert local messages to JSON and send to mergeCh
    	go func() {
    		buf := bytes.NewBuffer(grid.GetByteBuffer()[:0])
    		enc := json.NewEncoder(buf)
    		tmpEvt := struct{ Records []event.Event }{[]event.Event{{}}}
    		for {
    			select {
    			case ev := <-localCh:
    				buf.Reset()
    				tmpEvt.Records[0] = ev
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 6K bytes
    - Viewed (0)
  10. internal/s3select/csv/reader.go

    				if len(in.input) == 0 {
    					in.dst <- nil
    					continue
    				}
    				dst, ok := r.csvDstPool.Get().([][]string)
    				if !ok {
    					dst = make([][]string, 0, 1000)
    				}
    
    				cr := newReader(bytes.NewBuffer(in.input))
    				all := dst[:0]
    				err := func() error {
    					// Read all records until EOF or another error.
    					for {
    						record, err := cr.Read()
    						if err == io.EOF {
    							return nil
    						}
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Thu Feb 22 06:26:06 GMT 2024
    - 8.9K bytes
    - Viewed (0)
Back to top