model

package
v0.0.0-...-792bc57 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ExpirationInterval = 1 * 24 * -1

1 day

View Source
const SqlCreateAction = "INSERT INTO `actions` (`service_iid`, `id`) VALUE (:service_iid, :action_id)"
View Source
const SqlCreateActionLink = "INSERT `action_links` (`action_iid`, `user_iid`) VALUE (:action_iid, :user_iid)"
View Source
const SqlCreateRole = "INSERT INTO `roles` (`team_iid`,`id`) VALUE (:team_iid, :role_id)"
View Source
const SqlCreateRoleAction = "INSERT INTO `role_actions` (`role_iid`, `action_iid`) VALUE (:role_iid, :action_iid)"
View Source
const SqlCreateRoleLink = "INSERT `role_links` (`role_iid`, `user_iid`) VALUE (:role_iid, :user_iid)"
View Source
const SqlCreateService = "INSERT INTO `services` (`id`) VALUE (:service_id)"
View Source
const SqlCreateTeam = "INSERT INTO `teams` (`id`) VALUE (:team_id)"
View Source
const SqlCreateUser = "INSERT INTO `users` (`team_iid`,`id`) VALUE (:team_iid, :user_id)"
View Source
const SqlDecrementActionLinkCount = "UPDATE `action_links` SET count = count - 1 WHERE `action_iid` = :action_iid and `user_iid` = :user_iid"

support role

View Source
const SqlDeleteActionByID = "DELETE FROM `actions` WHERE `id` = :action_id and `service_iid` = :service_iid"
View Source
const SqlDeleteActionByIID = "DELETE FROM `actions` WHERE `iid` = :action_iid and `service_iid` = :service_iid"
View Source
const SqlDeleteActionLink = "DELETE FROM `action_links` WHERE `action_iid` = :action_iid and `user_iid` = :user_iid"
View Source
const SqlDeleteRoleAction = "DELETE FROM `role_actions` WHERE `action_iid` = :action_iid and `role_iid` = :role_iid"
View Source
const SqlDeleteRoleByID = "DELETE FROM `roles` WHERE `team_iid` = :team_iid and `id` = :role_id"
View Source
const SqlDeleteRoleByIID = "DELETE FROM `roles` WHERE `iid` = :role_iid"
View Source
const SqlDeleteRoleLink = "DELETE FROM `role_links` WHERE `role_iid` = :role_iid and `user_iid` = :user_iid"
View Source
const SqlDeleteServiceByID = "DELETE FROM `services` WHERE `id` = :service_id"
View Source
const SqlDeleteServiceByIID = "DELETE FROM `services` WHERE `iid` = :service_iid"
View Source
const SqlDeleteSession = "DELETE FROM `sessions` WHERE `session` = :session_id and `user_iid` = :user_iid"
View Source
const SqlDeleteTeamByID = "DELETE FROM `teams` WHERE `id` = :team_id"
View Source
const SqlDeleteTeamByIID = "DELETE FROM `teams` WHERE `iid` = :team_iid"
View Source
const SqlDeleteUserByID = "DELETE FROM `users` WHERE `team_iid` = :team_iid and `id` = :user_id"
View Source
const SqlDeleteUserByIID = "DELETE FROM `users` WHERE `iid` = :user_iid"
View Source
const SqlGetActionByID = "SELECT `iid`, `service_iid`, `id` FROM `actions` WHERE `id` = :action_id and `service_iid` = :service_iid"
View Source
const SqlGetActionLink = "SELECT `action_iid`, `user_iid`, `count` FROM `action_links` WHERE `action_iid` = :action_iid and `user_iid` = :user_iid"
View Source
const SqlGetPasswordByID = "" /* 184-byte string literal not displayed */
View Source
const SqlGetPasswordByIID = "SELECT `password` FROM `passwords` WHERE `user_iid` = :user_iid"
View Source
const SqlGetRoleActions = "SELECT `role_iid`, `action_iid` FROM `role_actions` WHERE `role_iid` = :role_iid"
View Source
const SqlGetRoleByID = "SELECT `iid`, `team_iid`, `id` FROM `roles` WHERE `team_iid` = :team_iid and `id` = :role_id"
View Source
const SqlGetServiceByID = "SELECT `iid`, `id` FROM `services` WHERE `id` = :service_id"
View Source
const SqlGetSession = "SELECT `session`, `update_date`, `user_iid` FROM `sessions` WHERE `session` = :session_id and `user_iid` = :user_iid"
View Source
const SqlGetTeamByID = "SELECT iid, id FROM `teams` WHERE `id` = :team_id"
View Source
const SqlGetUserByID = "SELECT `iid`, `team_iid`, `id` FROM `users` WHERE `team_iid` = :team_iid and `id` = :user_id"
View Source
const SqlUpsertActionLink = "" /* 126-byte string literal not displayed */
View Source
const SqlUpsertPasswordByID = SqlUpsertPasswordInsertBase + "`users`.`team_iid` = :team_iid and `users`.`id` = :user_id " + SqlUpsertPasswordUpdateBase
View Source
const SqlUpsertPasswordByIID = SqlUpsertPasswordInsertBase + "`users`.`iid` = :user_iid " + SqlUpsertPasswordUpdateBase
View Source
const SqlUpsertPasswordInsertBase = "INSERT INTO `passwords` (`user_iid`,`password`) SELECT `users`.`iid`, :password as password FROM `users` WHERE "
View Source
const SqlUpsertPasswordUpdateBase = "ON DUPLICATE KEY UPDATE `passwords`.`password` = :password"

Variables

View Source
var ErrDuplicate = errors.New("duplicate")

Functions

func CreateActionLink(db gfsql.DB, action *Action, user *User) error

func CreateRoleAction

func CreateRoleAction(db gfsql.DB, role *Role, action *Action) error
func CreateRoleLink(db gfsql.DB, role *Role, user *User) error

func DeleteActionByID

func DeleteActionByID(db gfsql.DB, serviceIID uint32, actionID string) error

func DeleteActionByIID

func DeleteActionByIID(db gfsql.DB, serviceIID uint32, actionIID uint32) error
func DeleteActionLink(db gfsql.DB, action *Action, user *User) error

func DeleteRoleAction

func DeleteRoleAction(db gfsql.DB, role *Role, action *Action) error

func DeleteRoleByID

func DeleteRoleByID(db gfsql.DB, teamIID uint32, roleID string) error

func DeleteRoleByIID

func DeleteRoleByIID(db gfsql.DB, roleIID uint32) error
func DeleteRoleLink(db gfsql.DB, role *Role, user *User) error

func DeleteServiceByID

func DeleteServiceByID(db gfsql.DB, serviceID string) error

func DeleteServiceByIID

func DeleteServiceByIID(db gfsql.DB, serviceIID uint32) error

func DeleteTeamByID

func DeleteTeamByID(db gfsql.DB, teamID string) error

func DeleteTeamByIID

func DeleteTeamByIID(db gfsql.DB, teamIID uint32) error

func DeleteUserByID

func DeleteUserByID(db gfsql.DB, teamIID uint32, userID string) error

func DeleteUserByIID

func DeleteUserByIID(db gfsql.DB, userIID uint32) error
func UpsertActionLink(db gfsql.DB, action *Action, user *User) error

Types

type Action

type Action struct {
	IID        uint32 `db:"iid"`
	ServiceIID uint32 `db:"service_iid"`
	ID         string `db:"id"`
}

func CreateAction

func CreateAction(db gfsql.DB, serviceIID uint32, actionID string) (*Action, error)

func GetAction

func GetAction(db gfsql.DB, serviceIID uint32, actionID string) (*Action, error)

func (*Action) Delete

func (action *Action) Delete(db gfsql.DB) error
type ActionLink struct {
	ActionIID uint32 `db:"action_iid"`
	UserIID   uint32 `db:"user_iid"`
	Count     uint32 `db:"count"`
}
func GetActionLink(db gfsql.DB, action *Action, user *User) (*ActionLink, error)

func (*ActionLink) Validate

func (actionLink *ActionLink) Validate() error

type Password

type Password struct {
	Password string `db:"password"`
}

type Role

type Role struct {
	IID     uint32 `db:"iid"`
	TeamIID uint32 `db:"team_iid"`
	ID      string `db:"id"`
}

func CreateRole

func CreateRole(db gfsql.DB, teamIID uint32, roleID string) (*Role, error)

func GetRole

func GetRole(db gfsql.DB, teamIID uint32, roleID string) (*Role, error)

func (*Role) Delete

func (role *Role) Delete(db gfsql.DB) error

type RoleAction

type RoleAction struct {
	RoleIID   uint32 `db:"role_iid"`
	ActionIID uint32 `db:"action_iid"`
}

func GetRoleActions

func GetRoleActions(db gfsql.DB, role *Role) ([]RoleAction, error)
type RoleLink struct {
	RoleIID uint32 `db:"role_iid"`
	UserIID uint32 `db:"user_iid"`
}

type Service

type Service struct {
	IID uint32 `db:"iid"`
	ID  string `db:"id"`
}

func CreateService

func CreateService(db gfsql.DB, serviceID string) (*Service, error)

func GetService

func GetService(db gfsql.DB, serviceID string) (*Service, error)

func (*Service) Delete

func (service *Service) Delete(db gfsql.DB) error

type Session

type Session struct {
	SessionID  string    `db:"session"`
	UpdateDate time.Time `db:"update_date"`
	UserIID    uint32    `db:"user_iid"`
}

func GetSession

func GetSession(db gfsql.DB, userIID uint32, sessionID string) (*Session, error)

func (*Session) Delete

func (session *Session) Delete(db gfsql.DB) error

func (*Session) Validate

func (session *Session) Validate() error

type Team

type Team struct {
	IID uint32 `db:"iid"`
	ID  string `db:"id"`
}

func CreateTeam

func CreateTeam(db gfsql.DB, teamID string) (*Team, error)

func GetTeam

func GetTeam(db gfsql.DB, teamID string) (*Team, error)

func (*Team) Delete

func (team *Team) Delete(db gfsql.DB) error

type User

type User struct {
	IID     uint32 `db:"iid"`
	TeamIID uint32 `db:"team_iid"`
	ID      string `db:"id"`
}

func CreateUser

func CreateUser(db gfsql.DB, teamIID uint32, userID string) (*User, error)

func GetUser

func GetUser(db gfsql.DB, teamIID uint32, userID string) (*User, error)

func (*User) Delete

func (user *User) Delete(db gfsql.DB) error

func (*User) MatchPassword

func (user *User) MatchPassword(db gfsql.DB, password string) error

func (*User) UpdatePassword

func (user *User) UpdatePassword(db gfsql.DB, password string) error

Jump to

Keyboard shortcuts

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