func Example_fromMemory() {
	// create LSB packed bits with the following pattern:
	// 01010011 11000101
	data := memory.NewBufferBytes([]byte{0xca, 0xa3})

	// create LSB packed validity (null) bitmap, where every 4th element is null:
	// 11101110 11101110
	nullBitmap := memory.NewBufferBytes([]byte{0x77, 0x77})

	// Create a boolean array and lazily determine NullN using UnknownNullCount
	bools := array.NewBoolean(16, data, nullBitmap, array.UnknownNullCount)

	// Show the null count
	fmt.Printf("NullN()  = %d\n", bools.NullN())

	// Enumerate the values.
	n := bools.Len()
	for i := 0; i < n; i++ {
		fmt.Printf("bools[%d] = ", i)
		if bools.IsNull(i) {
			fmt.Println("(null)")
		} else {
			fmt.Printf("%t\n", bools.Value(i))
		}
	}

	// Output:
	// NullN()  = 4
	// bools[0] = false
	// bools[1] = true
	// bools[2] = false
	// bools[3] = (null)
	// bools[4] = false
	// bools[5] = false
	// bools[6] = true
	// bools[7] = (null)
	// bools[8] = true
	// bools[9] = true
	// bools[10] = false
	// bools[11] = (null)
	// bools[12] = false
	// bools[13] = true
	// bools[14] = false
	// bools[15] = (null)
}
// This example demonstrates creating an array, sourcing the values and
// null bitmaps directly from byte slices. The null count is set to
// UnknownNullCount, instructing the array to calculate the
// null count from the bitmap when NullN is called.
This example demonstrates creating an array, sourcing the values and
null bitmaps directly from byte slices. The null count is set to
UnknownNullCount, instructing the array to calculate the
null count from the bitmap when NullN is called.
// This example demonstrates creating an array sourcing the values and // null bitmaps directly from byte slices . The null count is set to // UnknownNullCount instructing the array to calculate the // null count from the bitmap when NullN is called .
func Example_fromMemory() {
	data := memory.NewBufferBytes([]byte{0xca, 0xa3})
	nullBitmap := memory.NewBufferBytes([]byte{0x77, 0x77})
	bools := array.NewBoolean(16, data, nullBitmap, array.UnknownNullCount)
	fmt.Printf("NullN()  = %d\n", bools.NullN())
	n := bools.Len()
	for i := 0; i < n; i++ {
		fmt.Printf("bools[%d] = ", i)
		if bools.IsNull(i) {
			fmt.Println("(null)")
		} else {
			fmt.Printf("%t\n", bools.Value(i))
		}
	}
}
func Example_fromMemory ( ) { data := memory . NewBufferBytes ( [ ] byte { 0xca , 0xa3 } ) nullBitmap := memory . NewBufferBytes ( [ ] byte { 0x77 , 0x77 } ) bools := array . NewBoolean ( 16 , data , nullBitmap , array . UnknownNullCount ) fmt . Printf ( " \n " , bools . NullN ( ) ) n := bools . Len ( ) for i := 0 ; i < n ; i ++ { fmt . Printf ( " " , i ) if bools . IsNull ( i ) { fmt . Println ( " " ) } else { fmt . Printf ( " \n " , bools . Value ( i ) ) } } }
This example demonstrates creating an array, sourcing the values and
null bitmaps directly from byte slices.
This example demonstrates creating an array sourcing the values and null bitmaps directly from byte slices .
// create LSB packed bits with the following pattern: // 01010011 11000101 // create LSB packed validity (null) bitmap, where every 4th element is null: // 11101110 11101110 // Create a boolean array and lazily determine NullN using UnknownNullCount // Show the null count // Enumerate the values. // Output: // NullN()  = 4 // bools[0] = false // bools[1] = true // bools[2] = false // bools[3] = (null) // bools[4] = false // bools[5] = false // bools[6] = true // bools[7] = (null) // bools[8] = true // bools[9] = true // bools[10] = false // bools[11] = (null) // bools[12] = false // bools[13] = true // bools[14] = false // bools[15] = (null)