schema

package
v0.0.0-...-109ffb8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2012 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(db *redis.Client, k *Key, s interface{}) error

func IsInternalError

func IsInternalError(e error) bool

func IsUserError

func IsUserError(e error) bool

Types

type InternalError

type InternalError string

func (InternalError) Error

func (e InternalError) Error() string

type Key

type Key struct {
	// contains filtered or unexported fields
}

func NewKey

func NewKey(kind string, id int64) *Key

func Put

func Put(db *redis.Client, k *Key, s interface{}) (*Key, error)

logic:

input: key, *struct

a) Check if key has Id; yes/no
    no) INCR k:count
        set value as Id in struct

b) Parse struct; returns [field, value, field, value, ...], [hashField, ...].
   the hashField slice contains any optional properties which should be applied
   to before or after setting the struct in Redis (uniquity, index).

c) Check unique fields and set unique fields

d) Add the actual data from struct to a redis hash

e) Add optional indexes

f) if c, d, e did raise an error we need to cleanup the things
   we changed in the database.

func (*Key) Count

func (k *Key) Count() string

func (*Key) Id

func (k *Key) Id() int64

func (*Key) Index

func (k *Key) Index(field, value string) string

func (*Key) String

func (k *Key) String() string

func (*Key) Unique

func (k *Key) Unique(field, value string) string

type UserError

type UserError string

func (UserError) Error

func (e UserError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL