zegl / goriak Goto Github PK
View Code? Open in Web Editor NEWgoriak - Go language driver for Riak KV
Home Page: https://godoc.org/gopkg.in/zegl/goriak.v3
License: MIT License
goriak - Go language driver for Riak KV
Home Page: https://godoc.org/gopkg.in/zegl/goriak.v3
License: MIT License
type ConflictResolverMiddlewarer interface {
Key() string
Bucket() string
BucketType() string
Values() []Value
}
Add the option to ignore a field in auto map, so that it won't be saved to Risk.
Probably via a strict tag.
The API is too complicated to use, and not that flexible. Find a better solution.
Hello,
Could you please explain why there is a NotFound
field in Result
struct ?
For instance I see that here
Line 58 in 853c1d1
NotFound: true
field and a "not found" error.
It seems that these two are counterintuitive โ if we already return NotFound error, why do we have to return ... a basically invalid Result
?
Hope my question finds you well.
Thank you!
With AutoMaps, the only ways to not update the whole object is to either use Helper Types, or Map Operations.
In a situation where the data of a field (lets say that it is a Register) is not suitable to used in a helper type, and the map operation conversion is to cumbersome (or unreliable), there should instead be a better way.
Internally in Set()
a "path" to each object is created. This path consists of the struct field name (which can be overwritten by a struct tag), and the names of it's parents (other structs, or maps).
FilterInclude(path... string)
FilterExclude(path... string
Assuming this struct:
type User struct {
Name string
Location struct {
Country string
City string
}
}
The commands:
Set(val).FilterInclude("Name")
Set(val).FilterInclude("Location", "City")
Set(val).FilterInclude("Name").FilterInclude("Location", "City")
You can use FilterExclude and FilterInclude in combination.
If a field is specified in both an Exclude and Include, the command will be rejected, and an error is returned.
I want to have a custom *goriak.Set
type that makes it simpler to deal with sets.
Methods:
Exec(*goriak.Client)
Bytes() [][]byte
Strings() []string
AddString(string)
AddBytes([]byte)
RemoveString(string)
RemoveBytes([]byte)
The type should keep track of it's position and key (the same way as Counter), so that it's simple to only update this set without using SetMap()
Allow use for setting the consistency options executing Riak commands.
Add an additional helper type for Registers, similar to how the Set and Counter helper types already work.
Proposed API:
// Functions
NewRegister() *Register
// *Register methods
Set([]byte) *Register
SetString(string) *Register
Value() []byte
String() string
Exec(*Session) error
New helper type for Flags.
Proposed API:
// Functions
NewFlag() *Flag
// *Flag methods
Get() bool
Set(bool) *Flag
Exec(*Session) error
Single type -> Multiple types
Add support for all types of ints in automatic JSON indexes
It should be possible to use int slices as automatic index values.
I've looked at the examples folder and I saw how the connection is created:
con, err := goriak.Connect(goriak.ConnectOpts{Address: "127.0.0.1"})
Do we have to manage this somehow like defer conn.Close()
(I have not seen such API call) or is it entirely managed via underlying riak-go-client?
Their (Basho's) code does something like this:
defer func() { stopping = true close(sc) if serr := c.Stop(); serr != nil { util.ErrExit(serr) } close(sdc) close(fdc) }()
Nice repo BTW, I'm playing with it right now, good work!
Currently we're always connecting to localhost. Allow to bring your own Riak connector?
General middleware that can run on all commands
type RunMiddlewarer interface {
Key() string
Bucket() string
BucketType() string
}
Currently methods such as Key()
and AddToIndex()
needs to be performed before SetRaw()
to take affect. If they are performed afterwards they will not do anything.
Make sure that all query builder methods can be performed in any order.
I'm curious how to store and restore nested structures, for example slice/array of structs, or map where key is string and value is some other struct (arbitrarily nested). What would be the best strategy for this?
I was able to store and restore JSON as is, but what If I have some already mapped structs, is it possible to reuse them somehow?
For example:
type TB struct {
B string
DataTB map[string]string
}
type A struct {
A string
DataTA map[string]string
B TB
DataTC map[string]TC
}
At the moment, all thins except DataTC which is map[string]TC, will be stored and restored properly. Only DataTC will end up as an empty map. What is the best solution for this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.