graph

package
v0.0.0-...-7134dbd Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplySchema

func ApplySchema() bool

ApplySchema creates the schema in the database based on the model classes

func Connect

func Connect() bool

Connect connects to the database

func VerifySchema

func VerifySchema(quiet bool) bool

VerifySchema checks to see if the database schema matches the model objects

Types

type Novel

type Novel struct {
	DType       []string   `json:"dgraph.type,omitempty" tokenizer:"exact"`
	Name        string     `json:"name,omitempty"`
	UUID        string     `json:"uuid,omitempty" tokenizer:"hash"`
	NumChapters int        `json:"num-chapters,omitempty"`
	Since       *time.Time `json:"since,omitempty"`
	LastTurn    *time.Time `json:"last-turn,omitempty"`
	Done        bool       `json:"done,omitempty"`
	Picture     string     `json:"picture,omitempty"`
	Public      bool       `json:"public,omitempty"`
	TurnMin     int        `json:"turn-min,omitempty"`
	TurnMax     int        `json:"turn-max,omitempty"`
	TurnType    int        `json:"turn-type,omitempty"`
}

Novel node type

type Permission

type Permission struct {
	DType []string `json:"dgraph.type,omitempty" tokenizer:"exact"`
	Name  string   `json:"name,omitempty"`
}

Permission node type

type Predicate

type Predicate struct {
	Name       string   `json:"predicate,omitempty"`
	Type       string   `json:"type,omitempty"`
	IsIndex    bool     `json:"index,omitempty"`
	IsList     bool     `json:"list,omitempty"`
	HasReverse bool     `json:"reverse,omitempty"`
	Tokenizer  []string `json:"tokenizer,omitempty"`
}

Predicate from schema

func (Predicate) Equals

func (a Predicate) Equals(b Predicate) bool

Equals checks if two predicates are equal

type Role

type Role struct {
	DType       []string     `json:"dgraph.type,omitempty" tokenizer:"exact"`
	Name        string       `json:"name,omitempty"`
	Permissions []Permission `json:"perms,omitempty"` // value interface{}
}

Role node type

type SchemaData

type SchemaData struct {
	Schema []Predicate `json:"schema,omitempty"`
	Types  []Type      `json:"types,omitempty"`
}

SchemaData from schema response

type Token

type Token struct {
	DType []string   `json:"dgraph.type,omitempty" tokenizer:"exact"`
	Token string     `json:"token,omitempty" tokenizer:"hash"`
	Since *time.Time `json:"since,omitempty"`
	Until *time.Time `json:"until,omitempty"`
	User  []User     `json:"user,omitempty" reverse:"true"`
}

Token node type

type Type

type Type struct {
	Name   string `json:"name,omitempty"`
	Fields []Type `json:"fields,omitempty"`
}

Type from schema

func (Type) Equals

func (a Type) Equals(b Type) bool

Equals checks if two types are equal

type User

type User struct {
	DType         []string   `json:"dgraph.type,omitempty" tokenizer:"exact"`
	Username      string     `json:"username,omitempty" tokenizer:"hash"`
	UUID          string     `json:"uuid,omitempty" tokenizer:"hash"`
	Password      string     `json:"password,omitempty"`
	PasswordToken string     `json:"password-token,omitempty" tokenizer:"hash"`
	Email         string     `json:"email,omitempty" tokenizer:"hash"`
	EmailToken    string     `json:"email-token,omitempty" tokenizer:"hash"`
	Phone         string     `json:"phone,omitempty" tokenizer:"hash"`
	PhoneToken    string     `json:"phone-token,omitempty" tokenizer:"hash"`
	Since         *time.Time `json:"since,omitempty"`
	Picture       string     `json:"picture,omitempty"`
	Friends       []User     `json:"friends,omitempty"`               // nickname string, since *time.Time
	Roles         []Role     `json:"roles,omitempty"`                 // priority int
	Novels        []Novel    `json:"novels,omitempty" reverse:"true"` // starred, notify bool, chapter, pos, turn int
}

User node type

Jump to

Keyboard shortcuts

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