model

package
v0.0.0-...-fa912fb Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package model houses the structs that are persisted in the database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Db

func Db() (*sql.DB, error)

func Gorm

func Gorm() (*gorm.DB, error)

Types

type Event

type Event struct {
	ID        int64 `gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time

	UserID    int64
	Timestamp time.Time
	Notes     string

	Tags []EventTag
	User *User
}

Event represents an event that was recorded in datawell, which are owned by a single user.

type EventTag

type EventTag struct {
	EventID int64 `gorm:"primary_key"`
	TagID   int64 `gorm:"primary_key"`
	Number  float64

	Event *Event
	Tag   *Tag
}

EventTag represents a tag that was added to an event, optionally with a number.

type Tag

type Tag struct {
	ID        int64 `gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time

	UserID int64
	Tag    string

	User *User
}

Tag represents a single tag in datawell, which are owned by a single user.

type User

type User struct {
	ID        int64 `gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time

	Username string
	Passhash string
	Name     string

	Events []Event
}

User represents a user of datawell which owns events and tags.

Jump to

Keyboard shortcuts

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