func ExampleBucket_Insert() {
	bx, _ := buckets.Open(tempfile())
	defer os.Remove(bx.Path())
	defer bx.Close()

	letters, _ := bx.New([]byte("letters"))

	// Setup items to insert in `letters` bucket.
	items := []struct {
		Key, Value []byte
	}{
		{[]byte("A"), []byte("alpha")},
		{[]byte("B"), []byte("beta")},
		{[]byte("C"), []byte("gamma")},
	}

	// Insert items into `letters` bucket.
	if err := letters.Insert(items); err != nil {
		fmt.Println("could not insert items!")
	}

	// Get items back out in separate read-only transaction.
	results, _ := letters.Items()

	for _, item := range results {
		fmt.Printf("%s -> %s\n", item.Key, item.Value)
	}

	// Output:
	// A -> alpha
	// B -> beta
	// C -> gamma
}
// Show we can insert items into a bucket and get them back out.
Show we can insert items into a bucket and get them back out.
// Show we can insert items into a bucket and get them back out .
func ExampleBucket_Insert() {
	bx, _ := buckets.Open(tempfile())
	defer os.Remove(bx.Path())
	defer bx.Close()
	letters, _ := bx.New([]byte("letters"))
	items := []struct {
		Key, Value []byte
	}{
		{[]byte("A"), []byte("alpha")},
		{[]byte("B"), []byte("beta")},
		{[]byte("C"), []byte("gamma")},
	}
	if err := letters.Insert(items); err != nil {
		fmt.Println("could not insert items!")
	}
	results, _ := letters.Items()
	for _, item := range results {
		fmt.Printf("%s -> %s\n", item.Key, item.Value)
	}
}
func ExampleBucket_Insert ( ) { bx , _ := buckets . Open ( tempfile ( ) ) defer os . Remove ( bx . Path ( ) ) defer bx . Close ( ) letters , _ := bx . New ( [ ] byte ( " " ) ) items := [ ] struct { Key , Value [ ] byte } { { [ ] byte ( " " ) , [ ] byte ( " " ) } , { [ ] byte ( " " ) , [ ] byte ( " " ) } , { [ ] byte ( " " ) , [ ] byte ( " " ) } , } if err := letters . Insert ( items ) ; err != nil { fmt . Println ( " " ) } results , _ := letters . Items ( ) for _ , item := range results { fmt . Printf ( " \n " , item . Key , item . Value ) } }
Show we can insert items into a bucket and get them back out.
Show we can insert items into a bucket and get them back out .
// Setup items to insert in `letters` bucket. // Insert items into `letters` bucket. // Get items back out in separate read-only transaction. // Output: // A -> alpha // B -> beta // C -> gamma