model

package
v0.0.0-...-b52bd72 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *sqlx.DB

Functions

This section is empty.

Types

type Model

type Model struct {
}

Model interface defines base model interface

func (Model) GetID

func (m Model) GetID() string

type NewUser

type NewUser struct {
	Username             string `json:"username"`
	Email                string `json:"email"`
	Password             string `json:"password"`
	PasswordConfirmation string `json:"password-confirmation"`
}

type Post

type Post struct {
	ID int64 `json:"-"`

	CreatedAt time.Time `json:"created-at" db:"created_at"`
	UpdatedAt time.Time `json:"updated-at" db:"updated_at"`
	Title     string    `json:"title" db:"title"`
	Excerpt   string    `json:"excerpt" db:"excerpt"`
	Content   string    `json:"content" db:"content"`
	Permalink string    `json:"permalink" db:"permalink"`
	User      *User     `json:"-"`
	UserId    string    `json:"-" db:"user_id"`
}

func (*Post) AddToManyIDs

func (m *Post) AddToManyIDs(name string, IDs []string) error

AddToManyIDs adds some new sweets that a users loves so much

func (*Post) DeleteToManyIDs

func (m *Post) DeleteToManyIDs(name string, IDs []string) error

DeleteToManyIDs removes some sweets from a users because they made him very sick

func (Post) GetID

func (m Post) GetID() string

func (Post) GetReferencedIDs

func (m Post) GetReferencedIDs() []jsonapi.ReferenceID

GetReferencedIDs to satisfy the jsonapi.MarshalLinkedRelations interface

func (Post) GetReferencedStructs

func (m Post) GetReferencedStructs() []jsonapi.MarshalIdentifier

GetReferencedStructs to satisfy the jsonapi.MarhsalIncludedRelations interface

func (Post) GetReferences

func (m Post) GetReferences() []jsonapi.Reference

GetReferences to satisfy the jsonapi.MarshalReferences interface

func (*Post) SetID

func (m *Post) SetID(id string) error

func (*Post) SetToManyReferenceIDs

func (m *Post) SetToManyReferenceIDs(name string, IDs []string) error

SetToManyReferenceIDs sets the sweets reference IDs and satisfies the jsonapi.UnmarshalToManyRelations interface

func (Post) SetToOneReferenceID

func (m Post) SetToOneReferenceID(name, ID string) error

type User

type User struct {
	ID int64 `json:"-"`

	CreatedAt    time.Time `json:"created-at" db:"created_at"`
	UpdatedAt    time.Time `json:"updated-at" db:"updated_at"`
	Username     string    `json:"username"`
	Email        string    `json:"email"`
	PasswordHash string    `json:"-" db:"password_hash"`
}

func (User) GetID

func (m User) GetID() string

func (User) GetReferencedIDs

func (m User) GetReferencedIDs() []jsonapi.ReferenceID

GetReferencedIDs to satisfy the jsonapi.MarshalLinkedRelations interface

func (User) GetReferences

func (m User) GetReferences() []jsonapi.Reference

GetReferences to satisfy the jsonapi.MarshalReferences interface

func (*User) SetID

func (m *User) SetID(id string) error

Jump to

Keyboard shortcuts

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