Documentation ¶
Index ¶
- Constants
- type PostgresDB
- func (db *PostgresDB) AddSPGroup(group *models.SpGroup, writer string) (*models.SpGroup, error)
- func (db *PostgresDB) AddSPUserToGroup(spGroupUser *models.SpGroupUser, writer string) (*models.SpGroupUser, error)
- func (db *PostgresDB) AddSpMessage(msg *models.SpMessage, tz, writer string) (*models.SpGroupMsgData, error)
- func (db *PostgresDB) AddTweetToThread(userID, tweetID, threadID, writer string) error
- func (db *PostgresDB) CheckOTP(phone, code string, now time.Time, writer string) (*models.SpOtp, error)
- func (db *PostgresDB) CreateInvalidToken(it *models.InvalidToken) error
- func (db *PostgresDB) CreateOTP(phone string, now time.Time, writer string) error
- func (db *PostgresDB) CreateThread(userID, name, writer string) (*models.Thread, error)
- func (db *PostgresDB) CreateTwitterChallenge(token, redirectURI, writer string) (string, error)
- func (db *PostgresDB) CreateUser(u *models.User) error
- func (db *PostgresDB) DelTweetFromThread(userID, tweetID, threadID, writer string) error
- func (db *PostgresDB) Delete(table string, writer string) error
- func (db *PostgresDB) DeleteAllOTPs(writer string) error
- func (db *PostgresDB) DeleteGuestData(userID string, maxTweets int, writer string) error
- func (db *PostgresDB) DeleteOldOneTimes(expiry time.Duration, writer string) error
- func (db *PostgresDB) DeleteOldTwitterChallenges(checkpoint time.Duration)
- func (db *PostgresDB) DeleteThread(userID, threadID, writer string) (*models.Thread, error)
- func (db *PostgresDB) DeleteTweet(userID, tweetID, writer string) (*models.Tweet, error)
- func (db *PostgresDB) ExpireOTPs(now time.Time, writer string) error
- func (db *PostgresDB) FindOrCreateSPUser(phone string, writer string) (*models.SpUser, error)
- func (db *PostgresDB) FindOrCreateUser(u *models.User) (*models.User, error)
- func (db *PostgresDB) GetAllTweets(writer string, offset int, count int) ([]*models.Tweet, int, error)
- func (db *PostgresDB) GetOTP(phone, writer string) (*models.SpOtp, error)
- func (db *PostgresDB) GetOneTime(id string, expiry time.Duration, writer string) (*models.Onetime, error)
- func (db *PostgresDB) GetRawTweet(userID, tweetID, writer string) (*models.Tweet, error)
- func (db *PostgresDB) GetResources(userID, writer string) ([]*models.Resource, error)
- func (db *PostgresDB) GetSPGroupMessagesByDay(groupID string, start time.Time, tz string, limit int, writer string) ([]*models.SpGroupMsgData, error)
- func (db *PostgresDB) GetSPGroupUser(userID, groupID, writer string) (*models.SpGroupUser, error)
- func (db *PostgresDB) GetSPGroupUsers(groupID, writer string) ([]*models.SpUser, error)
- func (db *PostgresDB) GetSPGroupsForUser(userID, writer string) ([]*models.SpGroupSend, error)
- func (db *PostgresDB) GetSPServices(writer string) ([]*models.SpService, error)
- func (db *PostgresDB) GetSPUserByID(id string, writer string) (*models.SpUser, error)
- func (db *PostgresDB) GetSPUserMessagesByDay(userID string, start time.Time, tz string, limit int, writer string) ([]*models.SpGroupMsgData, error)
- func (db *PostgresDB) GetTags(userID, writer string) ([]*models.Tag, error)
- func (db *PostgresDB) GetThread(userID, threadID, writer string) (*models.ThreadData, error)
- func (db *PostgresDB) GetThreadTweets(userID, threadID, writer string) ([]*models.ThreadTweet, error)
- func (db *PostgresDB) GetTweet(userID, tweetID, writer string) (*models.Tweet, error)
- func (db *PostgresDB) GetTweetTags(userID, tweetID, writer string) ([]*models.Tag, error)
- func (db *PostgresDB) GetTweets(userID string, offset, limit int, reverse bool, writer string) ([]*models.Tweet, error)
- func (db *PostgresDB) GetTwitterChallenge(token, writer string) (string, string, error)
- func (db *PostgresDB) GetUser(userID string, writer string) (*models.User, error)
- func (db *PostgresDB) GetUserByHandle(username, writer string) (*models.User, error)
- func (db *PostgresDB) InsertTweet(tweet *models.Tweet, tags []*models.Tag, threads []*utils.ThreadDetails) (*models.Tweet, []*models.Tag, error)
- func (db *PostgresDB) IsInvalidToken(token string, writer string) (bool, error)
- func (db *PostgresDB) LockResource(req *models.Resource) (*models.Resource, error)
- func (db *PostgresDB) SaveOneTime(onetime *models.Onetime) error
- func (db *PostgresDB) SearchTweetsByTags(userID string, tags []string, offset, limit int, reverse bool, writer string) ([]*models.Tweet, error)
- func (db *PostgresDB) SetOneTime(val, writer string) (*models.Onetime, error)
- func (db *PostgresDB) SetResources(req *models.Resource, value int, writer string) (*models.Resource, error)
- func (db *PostgresDB) UnlockResource(req *models.Resource) (*models.Resource, error)
- func (db *PostgresDB) UpdateSPUser(user *models.SpUser) (*models.SpUser, error)
- func (db *PostgresDB) UpdateTweet(tweet *models.Tweet, tags []*models.Tag, threads []*utils.ThreadDetails, ...) (*models.Tweet, []*models.Tag, error)
Constants ¶
View Source
const OTP_EXPIRY_MINUTES = 20
View Source
const OTP_MAX_RETRIES = 3
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresDB ¶
type PostgresDB struct {
// contains filtered or unexported fields
}
func NewPostgresDB ¶
func NewPostgresDB() (*PostgresDB, error)
func (*PostgresDB) AddSPGroup ¶
func (*PostgresDB) AddSPUserToGroup ¶
func (db *PostgresDB) AddSPUserToGroup( spGroupUser *models.SpGroupUser, writer string) (*models.SpGroupUser, error)
func (*PostgresDB) AddSpMessage ¶
func (db *PostgresDB) AddSpMessage( msg *models.SpMessage, tz, writer string) (*models.SpGroupMsgData, error)
func (*PostgresDB) AddTweetToThread ¶
func (db *PostgresDB) AddTweetToThread(userID, tweetID, threadID, writer string) error
func (*PostgresDB) CreateInvalidToken ¶
func (db *PostgresDB) CreateInvalidToken(it *models.InvalidToken) error
func (*PostgresDB) CreateThread ¶
func (db *PostgresDB) CreateThread(userID, name, writer string) (*models.Thread, error)
func (*PostgresDB) CreateTwitterChallenge ¶
func (db *PostgresDB) CreateTwitterChallenge(token, redirectURI, writer string) (string, error)
func (*PostgresDB) CreateUser ¶
func (db *PostgresDB) CreateUser(u *models.User) error
func (*PostgresDB) DelTweetFromThread ¶
func (db *PostgresDB) DelTweetFromThread(userID, tweetID, threadID, writer string) error
func (*PostgresDB) Delete ¶
func (db *PostgresDB) Delete(table string, writer string) error
Delete deletes all entries in a table of a writer ONLY USE IN TESTS
func (*PostgresDB) DeleteAllOTPs ¶
func (db *PostgresDB) DeleteAllOTPs(writer string) error
func (*PostgresDB) DeleteGuestData ¶
func (db *PostgresDB) DeleteGuestData( userID string, maxTweets int, writer string) error
DeleteGuestData delete tweets if number of tweets > maxTweets Delete oldest ones first. Will not touch tags
func (*PostgresDB) DeleteOldOneTimes ¶
func (db *PostgresDB) DeleteOldOneTimes(expiry time.Duration, writer string) error
func (*PostgresDB) DeleteOldTwitterChallenges ¶
func (db *PostgresDB) DeleteOldTwitterChallenges(checkpoint time.Duration)
func (*PostgresDB) DeleteThread ¶
func (db *PostgresDB) DeleteThread(userID, threadID, writer string) (*models.Thread, error)
func (*PostgresDB) DeleteTweet ¶
func (db *PostgresDB) DeleteTweet(userID, tweetID, writer string) (*models.Tweet, error)
func (*PostgresDB) ExpireOTPs ¶
func (db *PostgresDB) ExpireOTPs(now time.Time, writer string) error
func (*PostgresDB) FindOrCreateSPUser ¶
func (*PostgresDB) FindOrCreateUser ¶
func (*PostgresDB) GetAllTweets ¶
func (*PostgresDB) GetOTP ¶
func (db *PostgresDB) GetOTP(phone, writer string) (*models.SpOtp, error)
func (*PostgresDB) GetOneTime ¶
func (db *PostgresDB) GetOneTime( id string, expiry time.Duration, writer string) (*models.Onetime, error)
GetOneTime Returns a one time value if it hasn't expired
func (*PostgresDB) GetRawTweet ¶
func (db *PostgresDB) GetRawTweet(userID, tweetID, writer string) (*models.Tweet, error)
GetRawTweet Ignore the delete flag and return deleted flags.
func (*PostgresDB) GetResources ¶
func (db *PostgresDB) GetResources(userID, writer string) ([]*models.Resource, error)
func (*PostgresDB) GetSPGroupMessagesByDay ¶
func (db *PostgresDB) GetSPGroupMessagesByDay( groupID string, start time.Time, tz string, limit int, writer string) ([]*models.SpGroupMsgData, error)
func (*PostgresDB) GetSPGroupUser ¶
func (db *PostgresDB) GetSPGroupUser( userID, groupID, writer string) (*models.SpGroupUser, error)
func (*PostgresDB) GetSPGroupUsers ¶
func (db *PostgresDB) GetSPGroupUsers( groupID, writer string) ([]*models.SpUser, error)
GetSPGroupUsers user.Role is overwritten to the role in the group
func (*PostgresDB) GetSPGroupsForUser ¶
func (db *PostgresDB) GetSPGroupsForUser(userID, writer string) ([]*models.SpGroupSend, error)
func (*PostgresDB) GetSPServices ¶
func (db *PostgresDB) GetSPServices(writer string) ([]*models.SpService, error)
func (*PostgresDB) GetSPUserByID ¶
func (*PostgresDB) GetSPUserMessagesByDay ¶
func (db *PostgresDB) GetSPUserMessagesByDay(userID string, start time.Time, tz string, limit int, writer string) ([]*models.SpGroupMsgData, error)
func (*PostgresDB) GetTags ¶
func (db *PostgresDB) GetTags(userID, writer string) ([]*models.Tag, error)
func (*PostgresDB) GetThread ¶
func (db *PostgresDB) GetThread(userID, threadID, writer string) (*models.ThreadData, error)
func (*PostgresDB) GetThreadTweets ¶
func (db *PostgresDB) GetThreadTweets( userID, threadID, writer string) ([]*models.ThreadTweet, error)
func (*PostgresDB) GetTweet ¶
func (db *PostgresDB) GetTweet(userID, tweetID, writer string) (*models.Tweet, error)
func (*PostgresDB) GetTweetTags ¶
func (db *PostgresDB) GetTweetTags(userID, tweetID, writer string) ([]*models.Tag, error)
func (*PostgresDB) GetTwitterChallenge ¶
func (db *PostgresDB) GetTwitterChallenge(token, writer string) (string, string, error)
func (*PostgresDB) GetUserByHandle ¶
func (db *PostgresDB) GetUserByHandle(username, writer string) (*models.User, error)
func (*PostgresDB) InsertTweet ¶
func (db *PostgresDB) InsertTweet( tweet *models.Tweet, tags []*models.Tag, threads []*utils.ThreadDetails, ) (*models.Tweet, []*models.Tag, error)
InsertTweet Inserts the tweet and all the tags and creates the necessary tweet tags as well.
func (*PostgresDB) IsInvalidToken ¶
func (db *PostgresDB) IsInvalidToken(token string, writer string) (bool, error)
func (*PostgresDB) LockResource ¶
func (*PostgresDB) SaveOneTime ¶
func (db *PostgresDB) SaveOneTime(onetime *models.Onetime) error
func (*PostgresDB) SearchTweetsByTags ¶
func (*PostgresDB) SetOneTime ¶
func (db *PostgresDB) SetOneTime(val, writer string) (*models.Onetime, error)
SetOneTime Creates a new onetime table record.
func (*PostgresDB) SetResources ¶
func (*PostgresDB) UnlockResource ¶
func (*PostgresDB) UpdateSPUser ¶
func (*PostgresDB) UpdateTweet ¶
Click to show internal directories.
Click to hide internal directories.