8000 Tags · kelindar/column · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Tags: kelindar/column

Tags

v0.4.1

Toggle v0.4.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Return cursor index (#98)

This PR adds `Index()` function to the transaction, returning the
current cursor index.

v0.4.0

Toggle v0.4.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Fix withValue on record column type (#92)

This PR fixes issue #87 where `WithValue()` wasn't unmarshaling the
record.

v0.3.0

Toggle v0.3.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Tidy go mod (#83)

v0.2.3

Toggle v0.2.3's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
CreateTrigger and DropTrigger (#79)

This PR adds `trigger` functionality for the cases where built-in
capabilities aren't sufficient. Triggers allow you to add a callback
function that will get called whether a value is `inserted`, `updated`
or `deleted`. It functions similarly to the bitmap index.


```go
players.CreateTrigger("on_balance", "balance", func(r Reader) {
	switch {
	case r.IsDelete():
		updates = append(updates, fmt.Sprintf("delete %d", r.Index()))
	case r.IsUpsert():
		updates = append(updates, fmt.Sprintf("upsert %d=%v", r.Index(), r.Float()))
	}
})

// Perform a few deletions and insertions
for i := 0; i < 3; i++ {
	players.DeleteAt(uint32(i))
	players.Insert(func(r Row) error {
		r.SetFloat64("balance", 50.0)
		return nil
	})
}

// Must keep track of all operations
assert.Len(t, updates, 6)
assert.Equal(t, []string{
	"delete 0", 
	"upsert 500=50", 
	"delete 1", 
	"upsert 501=50", 
	"delete 2",
	"upsert 502=50",
}, updates)
```

v0.2.2

Toggle v0.2.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Fix swap and record index (#76)

## Bugfixes
* `Swap...` was not properly swapping when an underlying buffer was
re-allocated due to `append()`
* Index for `Record` types was not working when strings are being merged
due to the fact that it could not see the newly appended values.

## Optimizations
* When swapping strings, if the string is of exactly the same size as
before, it will be swapped in-place (same as for other values).

v0.2.1

Toggle v0.2.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Fixed numeric merging options (#74)

This PR fixes merging options on numerical columns, the argument was not
passed properly. Also added a few tests and removed mandatory merge
function on record column, to make the API more consistent.

v0.2.0

Toggle v0.2.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Adding record column (#73)

This PR contains some refactoring and a new `record` column that allows
you to use a `BinaryMarshaler` and `BinaryUnmarshaler` type to be
stored. As such, it supports types that implement this standard way of
encoding, for example `time.Time`.


```go
col := NewCollection()
col.CreateColumn("timestamp", ForRecord(func() *time.Time {
	return new(time.Time)
}, nil))

// Insert the time, it implements binary marshaler
idx, _ := col.Insert(func(r Row) error {
	now := time.Unix(1667745766, 0)
	r.SetRecord("timestamp", &now)
	return nil
})

// We should be able to read back the time
col.QueryAt(idx, func(r Row) error {
	ts, ok := r.Record("timestamp")
	assert.True(t, ok)
	assert.Equal(t, "November", ts.(*time.Time).UTC().Month().String())
	return nil
})
```

v0.1.0

Toggle v0.1.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Fix snapshot race (#69)

0