Documentation
¶
Index ¶
- type BrokerCredentialsRepo
- func (r *BrokerCredentialsRepo) DeleteCredentials(userID string, brokerType string) error
- func (r *BrokerCredentialsRepo) GetAccessToken(userID string, brokerType string) (string, error)
- func (r *BrokerCredentialsRepo) GetCredentials(userID string, brokerType string) (*models.Credentials, error)
- func (r *BrokerCredentialsRepo) GetCredentialsForAllUsers() ([]*models.Credentials, error)
- func (r *BrokerCredentialsRepo) GetExpiredTokens() ([]*models.Credentials, error)
- func (r *BrokerCredentialsRepo) HasCredentials(userID string, brokerType string) (bool, error)
- func (r *BrokerCredentialsRepo) SaveCredentials(userID string, brokerType string, apiKey string, apiSecret string, ...) error
- func (r *BrokerCredentialsRepo) UpdateAccessToken(userID string, brokerType string, accessToken string, expiryTime time.Time) error
- type Config
- type DB
- type PortfolioRepo
- func (r *PortfolioRepo) GetHoldings(userID string) ([]models.Holding, error)
- func (r *PortfolioRepo) GetHoldingsByType(userID string, holdingType models.HoldingType) ([]models.Holding, error)
- func (r *PortfolioRepo) GetPlatformHoldings(userID string, platform string) ([]models.Holding, error)
- func (r *PortfolioRepo) GetPortfolioLastUpdated(userID string) (time.Time, bool, error)
- func (r *PortfolioRepo) SaveHoldings(userID string, holdings []models.Holding) error
- type SessionRepo
- func (r *SessionRepo) CreateSession(session *models.UserSession) error
- func (r *SessionRepo) DeleteSession(sessionID string) error
- func (r *SessionRepo) GetSession(sessionID string) (*models.UserSession, error)
- func (r *SessionRepo) GetUserSession(userID string) (*models.UserSession, error)
- func (r *SessionRepo) UpdateLastAccessed(sessionID string) error
- type UserRepo
- func (r *UserRepo) CreateUser(userID string, email string) error
- func (r *UserRepo) FindOrCreateUserByEmail(email string) (string, error)
- func (r *UserRepo) GetUser(userID string) (bool, error)
- func (r *UserRepo) GetUserByEmail(email string) (string, bool, error)
- func (r *UserRepo) UpdateLastAccessed(userID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BrokerCredentialsRepo ¶
type BrokerCredentialsRepo struct {
// contains filtered or unexported fields
}
BrokerCredentialsRepo handles broker credentials operations in the database
func NewBrokerCredentialsRepo ¶
func NewBrokerCredentialsRepo(db *DB) *BrokerCredentialsRepo
NewBrokerCredentialsRepo creates a new broker credentials repository
func (*BrokerCredentialsRepo) DeleteCredentials ¶
func (r *BrokerCredentialsRepo) DeleteCredentials(userID string, brokerType string) error
DeleteCredentials deletes broker credentials from the database
func (*BrokerCredentialsRepo) GetAccessToken ¶
func (r *BrokerCredentialsRepo) GetAccessToken(userID string, brokerType string) (string, error)
GetAccessToken retrieves the access token for a user's broker credentials
func (*BrokerCredentialsRepo) GetCredentials ¶
func (r *BrokerCredentialsRepo) GetCredentials(userID string, brokerType string) (*models.Credentials, error)
GetCredentials retrieves broker credentials from the database
func (*BrokerCredentialsRepo) GetCredentialsForAllUsers ¶
func (r *BrokerCredentialsRepo) GetCredentialsForAllUsers() ([]*models.Credentials, error)
GetCredentialsForAllUsers retrieves all broker credentials from the database
func (*BrokerCredentialsRepo) GetExpiredTokens ¶
func (r *BrokerCredentialsRepo) GetExpiredTokens() ([]*models.Credentials, error)
GetExpiredTokens retrieves credentials with expired tokens
func (*BrokerCredentialsRepo) HasCredentials ¶
func (r *BrokerCredentialsRepo) HasCredentials(userID string, brokerType string) (bool, error)
HasCredentials checks if the user has credentials for a specific broker
func (*BrokerCredentialsRepo) SaveCredentials ¶
func (r *BrokerCredentialsRepo) SaveCredentials(userID string, brokerType string, apiKey string, apiSecret string, requestToken string, expiryTime time.Time) error
SaveCredentials saves broker credentials to the database
func (*BrokerCredentialsRepo) UpdateAccessToken ¶
func (r *BrokerCredentialsRepo) UpdateAccessToken(userID string, brokerType string, accessToken string, expiryTime time.Time) error
UpdateAccessToken updates the access token and expiry time for broker credentials
type Config ¶
type Config struct {
ConnString string // PostgreSQL connection string
}
Config holds database configuration
type PortfolioRepo ¶
type PortfolioRepo struct {
// contains filtered or unexported fields
}
PortfolioRepo handles portfolio operations in the database
func NewPortfolioRepo ¶
func NewPortfolioRepo(db *DB) *PortfolioRepo
NewPortfolioRepo creates a new portfolio repository
func (*PortfolioRepo) GetHoldings ¶
func (r *PortfolioRepo) GetHoldings(userID string) ([]models.Holding, error)
GetHoldings retrieves portfolio holdings for a user
func (*PortfolioRepo) GetHoldingsByType ¶
func (r *PortfolioRepo) GetHoldingsByType(userID string, holdingType models.HoldingType) ([]models.Holding, error)
GetHoldingsByType retrieves portfolio holdings for a user filtered by holding type
func (*PortfolioRepo) GetPlatformHoldings ¶
func (r *PortfolioRepo) GetPlatformHoldings(userID string, platform string) ([]models.Holding, error)
GetPlatformHoldings retrieves portfolio holdings for a user filtered by platform
func (*PortfolioRepo) GetPortfolioLastUpdated ¶
GetPortfolioLastUpdated gets the timestamp when the portfolio was last updated
func (*PortfolioRepo) SaveHoldings ¶
func (r *PortfolioRepo) SaveHoldings(userID string, holdings []models.Holding) error
SaveHoldings saves portfolio holdings to the database for a user
type SessionRepo ¶
type SessionRepo struct {
// contains filtered or unexported fields
}
SessionRepo handles session operations in the database
func NewSessionRepo ¶
func NewSessionRepo(db *DB) *SessionRepo
NewSessionRepo creates a new session repository
func (*SessionRepo) CreateSession ¶
func (r *SessionRepo) CreateSession(session *models.UserSession) error
CreateSession creates a new session in the database
func (*SessionRepo) DeleteSession ¶
func (r *SessionRepo) DeleteSession(sessionID string) error
DeleteSession deletes a session from the database
func (*SessionRepo) GetSession ¶
func (r *SessionRepo) GetSession(sessionID string) (*models.UserSession, error)
GetSession retrieves a session from the database
func (*SessionRepo) GetUserSession ¶
func (r *SessionRepo) GetUserSession(userID string) (*models.UserSession, error)
GetUserSession retrieves a session by user ID from the database
func (*SessionRepo) UpdateLastAccessed ¶
func (r *SessionRepo) UpdateLastAccessed(sessionID string) error
UpdateLastAccessed updates the last_accessed_at field for a session
type UserRepo ¶
type UserRepo struct {
// contains filtered or unexported fields
}
UserRepo handles user operations in the database
func (*UserRepo) CreateUser ¶
CreateUser creates a new user in the database
func (*UserRepo) FindOrCreateUserByEmail ¶
FindOrCreateUserByEmail finds a user by email or creates one if not found
func (*UserRepo) GetUserByEmail ¶
GetUserByEmail checks if a user exists with the given email
func (*UserRepo) UpdateLastAccessed ¶
UpdateLastAccessed updates the last_accessed_at field for a user