Documentation ¶
Index ¶
- func CreateFollower(follower models.Follower) error
- func CreateMessage(message models.Message) error
- func CreateUser(userRequest models.UserCreateRequest) error
- func GetAllUsersFollowers(userID uint, noFollowers int) []string
- func GetLatest() int
- func GetMessageCount() int64
- func GetMessagesForUser(numberOfMessages int, userID uint) []models.MessageDto
- func GetPublicMessages(numberOfMessages int) []models.MessageDto
- func GetUser(userID uint) models.User
- func GetUserCount() int64
- func GetUserFromUsername(username string) (models.User, error)
- func GetUserID(username string) (uint, error)
- func GetUsersFollowedBy(userID uint) []models.Follower
- func IsUserFollower(userID uint, followedID uint) bool
- func LogError(logObj models.Log)
- func LogFatal(logObj models.Log)
- func LogInfo(message string)
- func LogPanic(message string)
- func LogWarn(message string)
- func LoginUser(loginRequest models.LoginRequest) (models.User, error)
- func UnfollowUser(followingUsersID uint, userToUnfollowID uint) error
- func UpdateLatest(latest int)
- type DBContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateFollower ¶
func CreateMessage ¶
CreateMessage creates a message in the database
func CreateUser ¶
func CreateUser(userRequest models.UserCreateRequest) error
CreateUser creates a new user in the database
func GetAllUsersFollowers ¶
func GetMessageCount ¶
func GetMessageCount() int64
GetMessageCount returns the number of messages in the system
func GetMessagesForUser ¶
func GetMessagesForUser(numberOfMessages int, userID uint) []models.MessageDto
GetMessagesForUser returns x number of messages for the specified user that have not been flagged, in desc order by publish date "user" is a reserved word in postgres, so it needs to be quoted in the queries
func GetPublicMessages ¶
func GetPublicMessages(numberOfMessages int) []models.MessageDto
GetPublicMessages returns x number of public messages that have not been flagged, in desc order by publish date "user" is a reserved word in postgres, so it needs to be quoted in the queries
func GetUserCount ¶
func GetUserCount() int64
GetUserCount returns the number of users reigstered in the system
func GetUsersFollowedBy ¶
func IsUserFollower ¶
func UnfollowUser ¶
func UpdateLatest ¶
func UpdateLatest(latest int)
Types ¶
type DBContext ¶
type DBContext struct {
// contains filtered or unexported fields
}
DBContext defines the application
func GetDBInstance ¶
func GetDBInstance() DBContext
GetDBInstance returns DBContext with specific environment db