models

package
v0.0.0-...-4b1df99 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2017 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMentorRequest

func AddMentorRequest(m *MentorRequest) (id int64, err error)

AddMentorRequest insert a new MentorRequest into database and returns last inserted Id on success.

func AddMentorTopic

func AddMentorTopic(m *MentorTopic) (id int64, err error)

AddTopic insert a new MentorTopic into database and returns last inserted Id on MentorTopic.

func AddTopic

func AddTopic(m *Topic) (id int64, err error)

AddTopic insert a new Topic into database and returns last inserted Id on success.

func AddUser

func AddUser(m *User) (id int64, err error)

AddUser insert a new User into database and returns last inserted Id on success.

func DeleteMentorRequest

func DeleteMentorRequest(mentorId int, menteeId int) (err error)

DeleteMentorRequest deletes MentorRequest by Id and returns error if the record to be deleted doesn't exist

func DeleteMentorTopic

func DeleteMentorTopic(userId int, topicId int) (err error)

DeleteTopic deletes MentorTopic by UserId and TopicId and returns error if the record to be deleted doesn't exist

func DeleteTopic

func DeleteTopic(id int) (err error)

DeleteTopic deletes Topic by Id and returns error if the record to be deleted doesn't exist

func DeleteUser

func DeleteUser(id int) (err error)

DeleteUser deletes User by Id and returns error if the record to be deleted doesn't exist

func GetAllMentorRequest

func GetAllMentorRequest(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, err error)

GetAllMentorRequest retrieves all MentorRequest matches certain condition. Returns empty list if no records exist

func GetAllMentorTopic

func GetAllMentorTopic(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, err error)

GetAllTopic retrieves all MentorTopic matches certain condition. Returns empty list if no records exist

func GetAllTopic

func GetAllTopic(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, err error)

GetAllTopic retrieves all Topic matches certain condition. Returns empty list if no records exist

func GetAllUser

func GetAllUser(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, err error)

GetAllUser retrieves all User matches certain condition. Returns empty list if no records exist

func GetMentorRequestsByMenteeId

func GetMentorRequestsByMenteeId(id int) (ml []interface{}, err error)

GetMentorRequestByMenteeId retrieves MentorRequest by MenteeId. Returns error if MenteeId doesn't exist

func GetMentorRequestsByMentorId

func GetMentorRequestsByMentorId(id int) (ml []interface{}, err error)

GetMentorRequestByMentorId retrieves MentorRequest by MentorId. Returns error if MentorId doesn't exist

func UpdateMentorRequest

func UpdateMentorRequest(m *MentorRequest) (err error)

UpdateMentorRequest updates MentorRequest by Id and returns error if the record to be updated doesn't exist

func UpdateMentorTopicById

func UpdateMentorTopicById(m *MentorTopic) (err error)

UpdateTopic updates MentorTopic by Id and returns error if the record to be updated doesn't exist

func UpdateTopicById

func UpdateTopicById(m *Topic) (err error)

UpdateTopic updates Topic by Id and returns error if the record to be updated doesn't exist

func UpdateUserById

func UpdateUserById(m *User) (err error)

UpdateUser updates User by Id and returns error if the record to be updated doesn't exist

Types

type MentorRequest

type MentorRequest struct {
	Id        int       `orm:"column(mentor_request_id);pk;auto"`
	Mentor    *User     `orm:"column(mentor_id);rel(fk)"`
	Mentee    *User     `orm:"column(mentee_id);rel(fk)"`
	Requested time.Time `orm:"column(requested);type(timestamp without time zone)"`
	Accepted  time.Time `orm:"column(accepted);type(timestamp without time zone);null"`
	Rejected  time.Time `orm:"column(rejected);type(timestamp without time zone);null"`
}

func GetMentorRequestByBothIds

func GetMentorRequestByBothIds(mentorId int, menteeId int) (v *MentorRequest, err error)

GetMentorRequestByBothIds retrieves MentorRequest by MenteeId. Returns error if MenteeId doesn't exist

func (*MentorRequest) TableName

func (t *MentorRequest) TableName() string

type MentorTopic

type MentorTopic struct {
	Id          int    `orm:"column(mentor_topic_id);pk;auto"`
	User        *User  `orm:"column(user_id);rel(fk)"`
	Topic       *Topic `orm:"column(topic_id);rel(fk)"`
	Level       int    `orm:"column(level);null"`
	Description string `orm:"column(description);null"`
}

func GetMentorTopicByIds

func GetMentorTopicByIds(userId int, topicId int) (v *MentorTopic, err error)

GetTopicById retrieves MentorTopic by UserId and TopicId. Returns error if Id doesn't exist

func (*MentorTopic) TableName

func (t *MentorTopic) TableName() string

type Topic

type Topic struct {
	Id   int    `orm:"column(id);pk;auto"`
	Name string `orm:"column(name)"`
}

func GetTopicById

func GetTopicById(id int) (v *Topic, err error)

GetTopicById retrieves Topic by Id. Returns error if Id doesn't exist

func (*Topic) TableName

func (t *Topic) TableName() string

type User

type User struct {
	Id           int       `orm:"column(id);pk;auto"`
	Username     string    `orm:"column(username);unique"`
	DisplayName  string    `orm:"column(display_name)"`
	Email        string    `orm:"column(email);unique"`
	Created      time.Time `orm:"column(created);type(timestamp without time zone);auto_now_add"`
	LastActivity time.Time `orm:"column(last_activity);type(timestamp without time zone);auto_now"`
	Password     string    `orm:"column(password);null" json:"omitempty"`
	Description  string    `orm:"column(description);null"`
	IconUrl      string    `orm:"column(icon_url);null"`
}

func GetUserByEmail

func GetUserByEmail(email string) (v *User, err error)

GetUserByEmail retrieves User by Email. Returns error if Id doesn't exist

func GetUserById

func GetUserById(id int) (v *User, err error)

GetUserById retrieves User by Id. Returns error if Id doesn't exist

func (*User) TableName

func (t *User) TableName() string

Jump to

Keyboard shortcuts

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