Documentation
¶
Index ¶
- Constants
- func ApiAuthenticationCreate(user_id uint64, userkey, token string) error
- func DemographicAdd(user_id uint64, d Demographic) error
- func EthnicityAdd(user_id uint64, e []string) error
- func GetRemoteIP(r *http.Request) (string, error)
- func PhotoApprove(path string, user_id uint64) error
- func PhotoCreate(user_id uint64, path string, initial bool) error
- func PhotoDelete(user_id uint64, path string) error
- func PhotoReject(path string, user_id uint64, note string) error
- func PhotoStatusByPath(user_id uint64, path string) uint8
- func PhotoUnverify(path string, user_id uint64) error
- func RoleCreate(user_id int64, level_id uint8) (sql.Result, error)
- func TrackRequestAPI(user_id uint64, r *http.Request, other_user_id uint64, verified bool) error
- func TrackRequestURL(user_id uint64, r *http.Request) error
- func UserCreate(first_name, last_name, email, password string) (sql.Result, error)
- func UserEmailUpdate(user_id int64, email string) error
- func UserEmailVerificationCreate(user_id int64, hash string) error
- func UserEmailVerified(token string) (bool, error)
- func UserLoginCreate(user_id int64, r *http.Request) error
- func UserPasswordUpdate(user_id int64, password string) error
- func UserReverify(user_id int64) error
- func UserTokenCreate(user_id uint64, token string) error
- func UsernameAdd(user_id uint64, username string, site_id uint64) error
- func UsernameRemove(user_id uint64, site_id uint64) (sql.Result, error)
- type Api_authentication
- type Demographic
- type EmailExpire
- type Email_verification
- type Ethnicity
- type Ethnicity_type
- type Photo
- type Photo_info
- type Photo_status
- type Role
- type Role_level
- type Site
- type Tracking_API
- type Tracking_url
- type User
- type User_status
- type User_verification
- type Username
- type Username_info
- type Walker
Constants ¶
const ( Role_level_Administrator = uint8(1) Role_level_User = uint8(2) )
Variables ¶
This section is empty.
Functions ¶
func ApiAuthenticationCreate ¶
func DemographicAdd ¶
func DemographicAdd(user_id uint64, d Demographic) error
func EthnicityAdd ¶
func PhotoApprove ¶
func PhotoDelete ¶
func PhotoStatusByPath ¶
func PhotoUnverify ¶
func RoleCreate ¶
RoleCreate creates user with a role
func TrackRequestAPI ¶
func UserCreate ¶
UserCreate creates user
func UserEmailUpdate ¶
UserEmailUpdate updates the user's email address
func UserEmailVerificationCreate ¶
UserEmailVerificationCreate adds a token to the database for email verification
func UserEmailVerified ¶
UserEmailVerified gets if a token exists in the table, removes the token, and updates the user
func UserLoginCreate ¶
UserLoginCreate logs the successful login and IP
func UserPasswordUpdate ¶
UserPasswordUpdate updates the current user's password
func UserReverify ¶
UserUnverifiy updates the user so email verification is required to login again
func UserTokenCreate ¶
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 ¶
type Ethnicity_type ¶
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 ¶
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 ¶
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
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 ¶
UserByEmail gets user information from email
func UserEmailByUserId ¶
UserEmailByUserId gets user email from id
func UserIdByEmail ¶
UserIdByEmail gets user id from email
func UserNameById ¶
UserNameById gets user first_name and last_name from id
func UserStatusByUserId ¶
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 ¶
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)