model

package
v0.0.0-...-c65dae7 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2017 License: MIT Imports: 6 Imported by: 6

Documentation

Index

Constants

View Source
const (
	Role_level_Administrator = uint8(1)
	Role_level_User          = uint8(2)
)

Variables

This section is empty.

Functions

func ApiAuthenticationCreate

func ApiAuthenticationCreate(user_id uint64, userkey, token string) error

func DemographicAdd

func DemographicAdd(user_id uint64, d Demographic) error

func EthnicityAdd

func EthnicityAdd(user_id uint64, e []string) error

func GetRemoteIP

func GetRemoteIP(r *http.Request) (string, error)

func PhotoApprove

func PhotoApprove(path string, user_id uint64) error

func PhotoCreate

func PhotoCreate(user_id uint64, path string, initial bool) error

func PhotoDelete

func PhotoDelete(user_id uint64, path string) error

func PhotoReject

func PhotoReject(path string, user_id uint64, note string) error

func PhotoStatusByPath

func PhotoStatusByPath(user_id uint64, path string) uint8

func PhotoUnverify

func PhotoUnverify(path string, user_id uint64) error

func RoleCreate

func RoleCreate(user_id int64, level_id uint8) (sql.Result, error)

RoleCreate creates user with a role

func TrackRequestAPI

func TrackRequestAPI(user_id uint64, r *http.Request, other_user_id uint64, verified bool) error

func TrackRequestURL

func TrackRequestURL(user_id uint64, r *http.Request) error

func UserCreate

func UserCreate(first_name, last_name, email, password string) (sql.Result, error)

UserCreate creates user

func UserEmailUpdate

func UserEmailUpdate(user_id int64, email string) error

UserEmailUpdate updates the user's email address

func UserEmailVerificationCreate

func UserEmailVerificationCreate(user_id int64, hash string) error

UserEmailVerificationCreate adds a token to the database for email verification

func UserEmailVerified

func UserEmailVerified(token string) (bool, error)

UserEmailVerified gets if a token exists in the table, removes the token, and updates the user

func UserLoginCreate

func UserLoginCreate(user_id int64, r *http.Request) error

UserLoginCreate logs the successful login and IP

func UserPasswordUpdate

func UserPasswordUpdate(user_id int64, password string) error

UserPasswordUpdate updates the current user's password

func UserReverify

func UserReverify(user_id int64) error

UserUnverifiy updates the user so email verification is required to login again

func UserTokenCreate

func UserTokenCreate(user_id uint64, token string) error

func UsernameAdd

func UsernameAdd(user_id uint64, username string, site_id uint64) error

func UsernameRemove

func UsernameRemove(user_id uint64, site_id uint64) (sql.Result, error)

Types

type Api_authentication

type Api_authentication struct {
	Id         uint32    `db:"id"`
	User_id    uint32    `db:"user_id"`
	Userkey    string    `db:"userkey"`
	Token      string    `db:"token"`
	Created_at time.Time `db:"created_at"`
	Updated_at time.Time `db:"updated_at"`
	Deleted    uint8     `db:"deleted"`
}

Api_authentication

func ApiAuthenticationByKeys

func ApiAuthenticationByKeys(userkey, token string) (Api_authentication, error)

func ApiAuthenticationByUserId

func ApiAuthenticationByUserId(user_id uint64) (Api_authentication, error)

type Demographic

type Demographic struct {
	Id            uint32    `db:"id"`
	User_id       uint32    `db:"user_id"`
	Birth_month   uint8     `db:"birth_month"`
	Birth_day     uint8     `db:"birth_day"`
	Birth_year    uint16    `db:"birth_year"`
	Gender        string    `db:"gender"`
	Height_feet   uint8     `db:"height_feet"`
	Height_inches uint8     `db:"height_inches"`
	Weight        uint16    `db:"weight"`
	Created_at    time.Time `db:"created_at"`
	Updated_at    time.Time `db:"updated_at"`
	Deleted       uint8     `db:"deleted"`
}

User table contains the information for each user

func DemographicByUserId

func DemographicByUserId(user_id uint64) (Demographic, error)

type EmailExpire

type EmailExpire struct {
	Id         uint32    `db:"id"`
	First_name string    `db:"first_name"`
	Email      string    `db:"email"`
	Expiring   bool      `db:"expiring"`
	Expired    bool      `db:"expired"`
	Updated_at time.Time `db:"updated_at"`
}

func EmailsWithVerificationIn30Days

func EmailsWithVerificationIn30Days() ([]EmailExpire, error)

UserIdByEmail gets user id from email

type Email_verification

type Email_verification struct {
	Id         uint32    `db:"id"`
	User_id    uint32    `db:"user_id"`
	Token      string    `db:"token"`
	Created_at time.Time `db:"created_at"`
	Updated_at time.Time `db:"updated_at"`
	Deleted    uint8     `db:"deleted"`
}

Email_verification table contains all verification codes for emails

func EmailVerificationTokenByUserId

func EmailVerificationTokenByUserId(user_id uint64) (Email_verification, error)

type Ethnicity

type Ethnicity struct {
	Id         uint32    `db:"id"`
	User_id    uint32    `db:"user_id"`
	Type_id    uint8     `db:"type_id"`
	Created_at time.Time `db:"created_at"`
	Updated_at time.Time `db:"updated_at"`
	Deleted    uint8     `db:"deleted"`
}

func EthnicityByUserId

func EthnicityByUserId(user_id uint64) ([]Ethnicity, error)

type Ethnicity_type

type Ethnicity_type struct {
	Id         uint8     `db:"id"`
	Name       string    `db:"name"`
	Created_at time.Time `db:"created_at"`
	Updated_at time.Time `db:"updated_at"`
	Deleted    uint8     `db:"deleted"`
}

type Photo

type Photo struct {
	Id         uint32    `db:"id"`
	Path       string    `db:"path"`
	User_id    uint32    `db:"user_id"`
	Note       string    `db:"note"`
	Initial    uint8     `db:"initial"`
	Status_id  uint8     `db:"status_id"`
	Created_at time.Time `db:"created_at"`
	Updated_at time.Time `db:"updated_at"`
	Deleted    uint8     `db:"deleted"`
}

Photo table contains the information for each photo

func PhotosByUserId

func PhotosByUserId(user_id uint64) ([]Photo, error)

type Photo_info

type Photo_info struct {
	Owner_id   uint32 `db:"owner_id"`
	Role_level uint8  `db:"role_level"`
	Status_id  uint8  `db:"status_id"`
	Initial    uint8  `db:"initial"`
}

Photo_info contains information necessary to verify access to the photo

func PhotoInfoByPath

func PhotoInfoByPath(user_id uint64, path string) (Photo_info, error)

type Photo_status

type Photo_status struct {
	Id         uint8     `db:"id"`
	Status     string    `db:"status"`
	Created_at time.Time `db:"created_at"`
	Updated_at time.Time `db:"updated_at"`
	Deleted    uint8     `db:"deleted"`
}

User_status table contains every possible user status (active/inactive)

type Role

type Role struct {
	Id         uint32    `db:"id"`
	User_id    uint32    `db:"user_id"`
	Level_id   uint8     `db:"level_id"`
	Created_at time.Time `db:"created_at"`
	Updated_at time.Time `db:"updated_at"`
	Deleted    uint8     `db:"deleted"`
}

User table contains the role of each user

func RoleByUserId

func RoleByUserId(user_id int64) (Role, error)

RoleByUserId gets the role by user_id

type Role_level

type Role_level struct {
	Id         uint8     `db:"id"`
	Name       string    `db:"name"`
	Created_at time.Time `db:"created_at"`
	Updated_at time.Time `db:"updated_at"`
	Deleted    uint8     `db:"deleted"`
}

Role_level table contains levels of access (Administrator, User, etc)

type Site

type Site struct {
	Id         uint32    `db:"id"`
	Name       string    `db:"name"`
	Url        string    `db:"url"`
	Profile    string    `db:"profile"`
	Created_at time.Time `db:"created_at"`
	Updated_at time.Time `db:"updated_at"`
	Deleted    uint8     `db:"deleted"`
}

Site table contains every possible website were usernames can be verified

func SiteList

func SiteList() ([]Site, error)

type Tracking_API

type Tracking_API struct {
	Id             uint32    `db:"id"`
	User_id        uint32    `db:"user_id"`
	Method         string    `db:"method"`
	Url            string    `db:"url"`
	RemoteAddress  string    `db:"remote_address"`
	Referer        string    `db:"referer"`
	UserAgent      string    `db:"user_agent"`
	Lookup_user_id uint32    `db:"lookup_user_id"`
	Created_at     time.Time `db:"created_at"`
	Updated_at     time.Time `db:"updated_at"`
}

User table contains the request tracking log for API

type Tracking_url

type Tracking_url struct {
	Id            uint32    `db:"id"`
	User_id       uint32    `db:"user_id"`
	Method        string    `db:"method"`
	Url           string    `db:"url"`
	RemoteAddress string    `db:"remote_address"`
	Referer       string    `db:"referer"`
	UserAgent     string    `db:"user_agent"`
	Created_at    time.Time `db:"created_at"`
	Updated_at    time.Time `db:"updated_at"`
}

User table contains the request tracking log

type User

type User struct {
	Id         uint32    `db:"id"`
	First_name string    `db:"first_name"`
	Last_name  string    `db:"last_name"`
	Email      string    `db:"email"`
	Password   string    `db:"password"`
	Status_id  uint8     `db:"status_id"`
	Created_at time.Time `db:"created_at"`
	Updated_at time.Time `db:"updated_at"`
	Deleted    uint8     `db:"deleted"`
}

User table contains the information for each user

func UserByEmail

func UserByEmail(email string) (User, error)

UserByEmail gets user information from email

func UserEmailByUserId

func UserEmailByUserId(user_id int64) (User, error)

UserEmailByUserId gets user email from id

func UserIdByEmail

func UserIdByEmail(email string) (User, error)

UserIdByEmail gets user id from email

func UserNameById

func UserNameById(id int) (User, error)

UserNameById gets user first_name and last_name from id

func UserStatusByUserId

func UserStatusByUserId(user_id int64) (User, error)

UserStatusByUserId gets user status from id

type User_status

type User_status struct {
	Id         uint8     `db:"id"`
	Status     string    `db:"status"`
	Created_at time.Time `db:"created_at"`
	Updated_at time.Time `db:"updated_at"`
	Deleted    uint8     `db:"deleted"`
}

User_status table contains every possible user status (active/inactive)

type User_verification

type User_verification struct {
	Id         uint8     `db:"id"`
	Token      string    `db:"token"`
	User_id    uint32    `db:"user_id"`
	Created_at time.Time `db:"created_at"`
	Updated_at time.Time `db:"updated_at"`
	Deleted    uint8     `db:"deleted"`
}

User_verification table contains random tokens for photos

func UserTokenByUserId

func UserTokenByUserId(user_id uint64) (User_verification, error)

type Username

type Username struct {
	Id         uint32    `db:"id"`
	Name       string    `db:"name"`
	User_id    uint32    `db:"user_id"`
	Site_id    uint32    `db:"site_id"`
	Created_at time.Time `db:"created_at"`
	Updated_at time.Time `db:"updated_at"`
	Deleted    uint8     `db:"deleted"`
}

Username table contains the usernames for each user

func UsernamesByUserId

func UsernamesByUserId(user_id uint64) ([]Username, error)

type Username_info

type Username_info struct {
	Id       uint32 `db:"id"`
	Username string `db:"username"`
	Site     string `db:"site"`
	Profile  string `db:"profile"`
	Home     string `db:"home"`
}

func UserByUsername

func UserByUsername(username string, site string) (Username_info, error)

UserByUsername gets user id from username

func UserinfoByUserId

func UserinfoByUserId(user_id uint64) ([]Username_info, error)

type Walker

type Walker struct {
	Id         uint32    `db:"id"`
	User       string    `db:"user"`
	Site_id    uint32    `db:"site_id"`
	Viewed     uint8     `db:"viewed"`
	Created_at time.Time `db:"created_at"`
	Updated_at time.Time `db:"updated_at"`
	Deleted    uint8     `db:"deleted"`
}

Walker tables contains usernames found and viewed

Jump to

Keyboard shortcuts

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