dgraph

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStore

func NewStore(
	host string,
	comparePassword func(hash, password string) bool,
	errorLog *log.Logger,
) store.Store

NewStore creates a new disconnected database client instance

Types

type Post

type Post struct {
	UID       string     `json:"uid"`
	ID        store.ID   `json:"Post.id"`
	Creation  time.Time  `json:"Post.creation"`
	Author    []User     `json:"Post.author"`
	Title     string     `json:"Post.title"`
	Contents  string     `json:"Post.contents"`
	Reactions []Reaction `json:"Post.reactions"`
}

Post represents a database model for the Post entity

type Reaction

type Reaction struct {
	UID       string            `json:"uid"`
	ID        store.ID          `json:"Reaction.id"`
	Subject   []ReactionSubject `json:"Reaction.subject"`
	Creation  time.Time         `json:"Reaction.creation"`
	Author    []User            `json:"Reaction.author"`
	Message   string            `json:"Reaction.message"`
	Emotion   emotion.Emotion   `json:"Reaction.emotion"`
	Reactions []Reaction        `json:"Reaction.reactions"`
}

Reaction represents a database model for the Reaction entity

type ReactionSubject

type ReactionSubject struct {
	V interface{}
}

ReactionSubject represents a union (Post | Reaction) type wrapper

func (ReactionSubject) MarshalJSON

func (u ReactionSubject) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaler interface

func (ReactionSubject) UID

func (u ReactionSubject) UID() *string

UID returns the unique entity node ID

func (*ReactionSubject) UnmarshalJSON

func (u *ReactionSubject) UnmarshalJSON(d []byte) error

UnmarshalJSON implements the Unmarshaler interface

type Session

type Session struct {
	UID       string    `json:"uid"`
	Key       string    `json:"Session.key"`
	Creation  time.Time `json:"Session.creation"`
	User      []User    `json:"Session.user"`
	RSessions []UID     `json:"~sessions"`
}

Session represents a database model for the Session entity

type UID

type UID struct {
	NodeID string `json:"uid"`
}

UID represents a Dgraph node identifier

type User

type User struct {
	UID                string     `json:"uid"`
	ID                 store.ID   `json:"User.id"`
	Creation           time.Time  `json:"User.creation"`
	Email              string     `json:"User.email"`
	DisplayName        string     `json:"User.displayName"`
	Password           string     `json:"User.password"`
	Posts              []Post     `json:"User.posts"`
	Sessions           []Session  `json:"User.sessions"`
	PublishedReactions []Reaction `json:"User.publishedReactions"`
}

User represents the database model for the User entity

Jump to

Keyboard shortcuts

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