Documentation ¶
Overview ¶
Package common contains helper methods used by all store implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelSender ¶
type ChannelSender struct {
// contains filtered or unexported fields
}
ChannelSender sends data to a channel. See Write method for more details.
func NewChannelSender ¶
func NewChannelSender(channel interface{}, unmarshal UnmarshalFunc, keySplitter func(string) []string) (*ChannelSender, error)
NewChannelSender creates a ChannelSender. The passed channel type must implmement the store.KeyOpSetter interface. Additionally, if the channel is a receive-only channel, an error is returned.
func (*ChannelSender) Send ¶
Send creates a new instance of the channel's type (which must implement store.KeyOpSetter interface see NewChannelSender) and applies SetKey and SetOp method.
If channel's type implements store.KeyMarshaller and keySplitter func is not nil, MarshalKey is applied on the splitted key. This can be useful for setting struct fields from key.
If data is not empty, it is unmarshaled into the newly created instance and sends the result on the channel.
type UnmarshalFunc ¶
UnmarshalFunc is a function that can unmarshal data to an object v.