models

package
v0.0.0-...-27dd3ae Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CallInteraction interactionType = "call"
	TextInteraction interactionType = "text"
	MeetInteraction interactionType = "meet"
)

Variables

This section is empty.

Functions

func CloseDbConnection

func CloseDbConnection() error

func ConnectToDb

func ConnectToDb() (err error)

func GetDbConnection

func GetDbConnection() *gorm.DB

func MigrateDb

func MigrateDb()

func OrderInteractionDateDesc

func OrderInteractionDateDesc(db *gorm.DB) *gorm.DB

Scopes

Types

type Interaction

type Interaction struct {
	gorm.Model

	Date     time.Time       `gorm:"not null"`
	Type     interactionType `gorm:"type:varchar(20);not null"`
	Details  string          `gorm:"not null"`
	PersonID uint            `gorm:"not null"`

	Person Person
}

func DeleteInteraction

func DeleteInteraction(id int) (Interaction, error)

func SaveInteraction

func SaveInteraction(personId uint, rawIntDate string, intType string, intDetails string) (Interaction, error)

func (*Interaction) FormDate

func (self *Interaction) FormDate() string

func (*Interaction) FormattedDate

func (self *Interaction) FormattedDate() string

type Person

type Person struct {
	gorm.Model

	Name string `gorm:"not null"`
	Bio  string

	Interactions []Interaction
}

func FetchPeople

func FetchPeople() ([]Person, error)

func FetchPerson

func FetchPerson(id int) (Person, error)

func SavePerson

func SavePerson(name string, bio string) (Person, error)

func UpdatePerson

func UpdatePerson(person Person, name string, bio string) (Person, error)

Jump to

Keyboard shortcuts

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