services

package
v1.0.2-0...-93c6762 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFollower

func CreateFollower(follower models.Follower) error

func CreateMessage

func CreateMessage(message models.Message) error

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 GetAllUsersFollowers(userID uint, noFollowers int) []string

func GetLatest

func GetLatest() int

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 GetUser

func GetUser(userID uint) models.User

func GetUserCount

func GetUserCount() int64

GetUserCount returns the number of users reigstered in the system

func GetUserFromUsername

func GetUserFromUsername(username string) (models.User, error)

func GetUserID

func GetUserID(username string) (uint, error)

GetUserID returns user ID for username

func GetUsersFollowedBy

func GetUsersFollowedBy(userID uint) []models.Follower

func IsUserFollower

func IsUserFollower(userID uint, followedID uint) bool

func LogError

func LogError(logObj models.Log)

func LogFatal

func LogFatal(logObj models.Log)

func LogInfo

func LogInfo(message string)

func LogPanic

func LogPanic(message string)

func LogWarn

func LogWarn(message string)

func LoginUser

func LoginUser(loginRequest models.LoginRequest) (models.User, error)

func UnfollowUser

func UnfollowUser(followingUsersID uint, userToUnfollowID uint) error

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

Jump to

Keyboard shortcuts

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