userinfo

package module
v0.0.0-...-6c837af Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2016 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close safely close BoltDB

func Delete

func Delete(bucket, key string) error

func Init

func Init(location string, buckets []string)

Init 1 userinfo.Init("the.db", []string{"user","userdata","objects"})

func Read

func Read(bucket, key string) []byte

Read: retrieve []byte(value) of bucket[key]

func Scan

func Scan() map[string]Person

Scan updates the (memory) user map. Must be called after writes to the db

func ScanObjectBoxes

func ScanObjectBoxes() map[string]ObjectBox

Scan updates the (memory) user map. Must be called after writes to the userdata db to get the true map

func ScanObjects

func ScanObjects() map[string]UserObject

Scan updates the (memory) user map. Must be called after writes to the userdata db to get the true map

func Write

func Write(bucket, key string, value []byte) error

Write: Insert data into a bucket.

Types

type ObjectBox

type ObjectBox struct {
	OwnerID      string    // Doesn't need ObjectBox ID because each user only has one
	TimeCreated  time.Time `json:",string"`
	TimeModified time.Time `json:",string,omitempty"`
	Bucket       string    `json:",omitempty"`        // big
	Objects      []string  `json:",string,omitempty"` // big

}

type Person

type Person struct {
	ID, FirstName, LastName, NickName, Email, Data string      `json:",omitempty"`
	Gender, BodyType, Age, LookingFor              uint8       `json:",string,omitempty"`
	Height, ZipCode                                uint32      `json:",string,omitempty"`
	More                                           interface{} `json:",string,omitempty"`
}

type UserObject

type UserObject struct {
	OwnerID      string
	ObjectID     string
	Title        string
	Filename     string
	Extension    string
	Data         string    `json:",omitempty"` // base64 encoded inside json encoded
	TimeCreated  time.Time `json:",string"`
	TimeModified time.Time `json:",string,omitempty"`
	Size         int       `json:",string"`
	IsMessage    bool      `json:",string,omitempty"`
	IsMedia      bool      `json:",string,omitempty"`
	IsFile       bool      `json:",string,omitempty"`
	IsPublic     bool      `json:",string,omitempty"`
	Permissions  []string  // List of users able to view/read the databytes
	ImgSrc       string    `json:",omitempty"`
	ImgBase64    string    `json:",omitempty"`
	LinkHref     string    `json:",omitempty"`
	LinkTitle    string    `json:",omitempty"`
	Ref          string    `json:",omitempty"`
	Class        string    `json:",omitempty"` // for css
}

func (UserObject) Base64

func (ob UserObject) Base64() string

func (UserObject) RawBytes

func (ob UserObject) RawBytes() []byte

Jump to

Keyboard shortcuts

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