models

package
v0.0.0-...-957ce15 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DATE_FORMAT     = "Jan _2, 2006"
	SQL_DATE_FORMAT = "2006-01-02"
)

Variables

View Source
var EmailRegex = regexp.MustCompile("^[a-z0-9!#$\\%&'*+\\/=?^_`{|}~.-]+@[a-z0-9-]+(\\.[a-z0-9-]+)*$")
View Source
var MentionRegex = regexp.MustCompile(`([\#\@])([A-Za-z0-9]+)`)
View Source
var NameRegex = regexp.MustCompile("^[^#@]+$")
View Source
var UserNameBlacklistRegex = regexp.MustCompile("^(account|contact|about|find|search|public|to(desktop|mobile)|log(in|out)|sign(in|up|out)|register|home|index|default|post(s)?|user(name)?(s)?|i)$")
View Source
var UserNameRegex = regexp.MustCompile("^[a-zA-Z0-9]+$")

Functions

func FormatContentMentions

func FormatContentMentions(content []byte) []byte

func ValidatePostTitle

func ValidatePostTitle(v *revel.Validation, title string) *revel.ValidationResult

func ValidateProfileDescription

func ValidateProfileDescription(v *revel.Validation, description string) *revel.ValidationResult

func ValidateProfileName

func ValidateProfileName(v *revel.Validation, name string) *revel.ValidationResult

func ValidateProfilePhotoUrl

func ValidateProfilePhotoUrl(v *revel.Validation, photoUrl string) *revel.ValidationResult

func ValidateProfileSummary

func ValidateProfileSummary(v *revel.Validation, summary string) *revel.ValidationResult

func ValidateProfileUserName

func ValidateProfileUserName(v *revel.Validation, username string) *revel.ValidationResult

func ValidateUserEmail

func ValidateUserEmail(v *revel.Validation, email string) *revel.ValidationResult

func ValidateUserPassword

func ValidateUserPassword(v *revel.Validation, password string) *revel.ValidationResult

Types

type Follower

type Follower struct {
	FollowerId   int
	UserId       int
	FollowUserId int
}

type Like

type Like struct {
	LikeId int
	PostId int
	UserId int
}

type Post

type Post struct {
	PostId         int
	ProfileId      int
	Title          string
	Content        []byte // mediumblob
	Status         string
	Date           string
	AggregateLikes int // to keep things quick in our app

	// Transient
	ContentStr string
	DateObj    time.Time
}

func (*Post) PostGet

func (post *Post) PostGet(_ gorp.SqlExecutor) error

func (*Post) PreInsert

func (post *Post) PreInsert(_ gorp.SqlExecutor) error

func (*Post) PreUpdate

func (post *Post) PreUpdate(_ gorp.SqlExecutor) error

func (*Post) Validate

func (post *Post) Validate(v *revel.Validation)

type Profile

type Profile struct {
	ProfileId          int
	UserId             int
	UserName           string
	Name               string
	Summary            string
	Description        string
	PhotoUrl           string
	AggregateFollowers int
	AggregateFollowing int

	// Transient
	User *User
}

func (*Profile) PostGet

func (p *Profile) PostGet(exe gorp.SqlExecutor) error

func (*Profile) PreInsert

func (p *Profile) PreInsert(_ gorp.SqlExecutor) error

func (*Profile) PreUpdate

func (p *Profile) PreUpdate(_ gorp.SqlExecutor) error

func (*Profile) String

func (p *Profile) String() string

func (*Profile) Validate

func (profile *Profile) Validate(v *revel.Validation)

type SimpleJSONResponse

type SimpleJSONResponse struct {
	Status  string
	Message string
}

type Token

type Token struct {
	TokenId    int
	Email      string
	Type, Hash string
}

func (*Token) String

func (t *Token) String() string

type User

type User struct {
	UserId         int
	Email          string
	HashedPassword []byte
	CreatedStr     string
	Confirmed      bool

	// Transient
	Password string
	Created  time.Time
	Profile  *Profile
}

func (*User) PostGet

func (user *User) PostGet(exe gorp.SqlExecutor) error

func (*User) PreInsert

func (user *User) PreInsert(_ gorp.SqlExecutor) error

func (*User) String

func (u *User) String() string

func (*User) Validate

func (user *User) Validate(v *revel.Validation)

Jump to

Keyboard shortcuts

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