Documentation ¶
Overview ¶
Package repository contains the repository layer for the Moneybots API
Package repository contains the repository layer for the Moneybots API ¶
Package repository contains the repository layer for the Moneybots API ¶
Package repository contains the repository layer for the Moneybots API ¶
Package repository contains the repository layer for the Moneybots API ¶
Package repository contains the repository layer for the Moneybots API
Index ¶
- func ConnectPostgres(cfg *config.Config) (*gorm.DB, error)
- func ConnectRedis(cfg *config.Config) (*redis.Client, error)
- type IndexRepository
- func (r *IndexRepository) GetAllDistinctIndexSymbol() ([]models.IndexModel, error)
- func (r *IndexRepository) GetAllIndices() ([]models.IndexModel, error)
- func (r *IndexRepository) GetIndexInstruments(exchange, index string) ([]models.IndexModel, error)
- func (r *IndexRepository) GetIndicesByExchange(exchange string) ([]models.IndexModel, error)
- func (r *IndexRepository) GetIndicesRecordCount() (int64, error)
- func (r *IndexRepository) InsertIndices(indexInstruments []models.IndexModel) (int64, error)
- func (r *IndexRepository) TruncateIndicesTable() error
- type InstrumentRepository
- func (r *InstrumentRepository) GetFNOSegmentWiseExpiry(name string, limit, offset int) ([]models.InstrumentModel, error)
- func (r *InstrumentRepository) GetFNOSegmentWiseName(expiry string) ([]models.InstrumentModel, error)
- func (r *InstrumentRepository) GetInstrumentByExchangeTradingsymbol(exchange, tradingsymbol string) (models.InstrumentModel, error)
- func (r *InstrumentRepository) GetInstrumentByExchangeTradingsymbols(exchange string, tradingsymbols []string) ([]models.InstrumentModel, error)
- func (r *InstrumentRepository) GetInstrumentsByExchange(exchange string) ([]models.InstrumentModel, error)
- func (r *InstrumentRepository) GetInstrumentsByExpiry(expiry string) ([]models.InstrumentModel, error)
- func (r *InstrumentRepository) GetInstrumentsByInstrumentToken(instrumentToken string) ([]models.InstrumentModel, error)
- func (r *InstrumentRepository) GetInstrumentsByTokens(tokens []uint32) ([]models.InstrumentModel, error)
- func (r *InstrumentRepository) GetInstrumentsByTradingsymbol(tradingsymbol string) ([]models.InstrumentModel, error)
- func (r *InstrumentRepository) GetInstrumentsQuery(qip models.QueryInstrumentsParams) ([]models.InstrumentModel, error)
- func (r *InstrumentRepository) GetInstrumentsRecordCount() (int64, error)
- func (r *InstrumentRepository) InsertInstruments(records [][]string) (int64, error)
- func (r *InstrumentRepository) TruncateInstrumentsTable() error
- type SessionRepository
- func (r *SessionRepository) DeleteSession(userId, enctoken string) (int64, error)
- func (r *SessionRepository) GetSessionByEnctoken(enctoken string) (*models.SessionModel, error)
- func (r *SessionRepository) GetSessionByUserId(userId string) (*models.SessionModel, error)
- func (r *SessionRepository) UpsertSession(session *models.SessionModel) error
- type TickerRepository
- func (r *TickerRepository) Debug(eventType, message string) error
- func (r *TickerRepository) DeleteTickerInstruments(userID string, instruments []string) (int64, error)
- func (r *TickerRepository) Error(eventType, message string) error
- func (r *TickerRepository) Fatal(eventType, message string) error
- func (r *TickerRepository) GetInstrumentToken(exchange, symbol string) (uint32, error)
- func (r *TickerRepository) GetTickerInstrumentCount(userID string) (int64, error)
- func (r *TickerRepository) GetTickerInstruments(userID string) ([]models.TickerInstrument, error)
- func (r *TickerRepository) Info(eventType, message string) error
- func (r *TickerRepository) TruncateTickerData() error
- func (r *TickerRepository) TruncateTickerInstruments() (int64, error)
- func (r *TickerRepository) UpsertTickerData(tickerData []models.TickerData) error
- func (r *TickerRepository) UpsertTickerInstruments(userID string, instruments []models.InstrumentModel) (int64, int64, error)
- func (r *TickerRepository) Warn(eventType, message string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectPostgres ¶
ConnectPostgres connects to a Postgres database and returns a GORM database object
func ConnectRedis ¶
Types ¶
type IndexRepository ¶
Repository is the database repository for indices
func NewIndexRepository ¶
func NewIndexRepository(db *gorm.DB) *IndexRepository
NewIndexRepository creates a new index repository
func (*IndexRepository) GetAllDistinctIndexSymbol ¶
func (r *IndexRepository) GetAllDistinctIndexSymbol() ([]models.IndexModel, error)
GetAllDistinctIndexSymbol gets all distinct indices Used by cron
func (*IndexRepository) GetAllIndices ¶
func (r *IndexRepository) GetAllIndices() ([]models.IndexModel, error)
GetAllIndices gets all indices
func (*IndexRepository) GetIndexInstruments ¶
func (r *IndexRepository) GetIndexInstruments(exchange, index string) ([]models.IndexModel, error)
GetIndexInstruments fetches the instruments for a given index
func (*IndexRepository) GetIndicesByExchange ¶
func (r *IndexRepository) GetIndicesByExchange(exchange string) ([]models.IndexModel, error)
GetIndicesByExchange gets the names of all indices for a given exchange
func (*IndexRepository) GetIndicesRecordCount ¶
func (r *IndexRepository) GetIndicesRecordCount() (int64, error)
GetIndicesRecordCount returns the number of records in the indices table
func (*IndexRepository) InsertIndices ¶
func (r *IndexRepository) InsertIndices(indexInstruments []models.IndexModel) (int64, error)
InsertIndices inserts a batch of indices into the database
func (*IndexRepository) TruncateIndicesTable ¶
func (r *IndexRepository) TruncateIndicesTable() error
TruncateIndicesTable truncates the indices table
type InstrumentRepository ¶
InstrumentRepository is the database repository for instruments
func NewInstrumentRepository ¶
func NewInstrumentRepository(db *gorm.DB) *InstrumentRepository
NewInstrumentRepository creates a new instrument repository
func (*InstrumentRepository) GetFNOSegmentWiseExpiry ¶
func (r *InstrumentRepository) GetFNOSegmentWiseExpiry(name string, limit, offset int) ([]models.InstrumentModel, error)
GetFNOSegmentWiseExpiry returns a list of segment wise expiry for a given name
func (*InstrumentRepository) GetFNOSegmentWiseName ¶
func (r *InstrumentRepository) GetFNOSegmentWiseName(expiry string) ([]models.InstrumentModel, error)
GetFNOSegmentWiseName returns a list of segment wise name for a given expiry
func (*InstrumentRepository) GetInstrumentByExchangeTradingsymbol ¶
func (r *InstrumentRepository) GetInstrumentByExchangeTradingsymbol(exchange, tradingsymbol string) (models.InstrumentModel, error)
GetInstrumentByExchangeTradingsymbol gets an instrument by exchange and tradingsymbol
func (*InstrumentRepository) GetInstrumentByExchangeTradingsymbols ¶
func (r *InstrumentRepository) GetInstrumentByExchangeTradingsymbols(exchange string, tradingsymbols []string) ([]models.InstrumentModel, error)
GetInstrumentByExchangeTradingsymbols gets an instrument by exchange and tradingsymbols
func (*InstrumentRepository) GetInstrumentsByExchange ¶
func (r *InstrumentRepository) GetInstrumentsByExchange(exchange string) ([]models.InstrumentModel, error)
GetInstrumentsByExchange gets instruments by exchange
func (*InstrumentRepository) GetInstrumentsByExpiry ¶
func (r *InstrumentRepository) GetInstrumentsByExpiry(expiry string) ([]models.InstrumentModel, error)
GetInstrumentsByExpiry gets instruments by expiry
func (*InstrumentRepository) GetInstrumentsByInstrumentToken ¶
func (r *InstrumentRepository) GetInstrumentsByInstrumentToken(instrumentToken string) ([]models.InstrumentModel, error)
GetInstrumentsByInstrumentToken gets instruments by instrument token
func (*InstrumentRepository) GetInstrumentsByTokens ¶
func (r *InstrumentRepository) GetInstrumentsByTokens(tokens []uint32) ([]models.InstrumentModel, error)
GetInstrumentsByTokens returns instruments by tokens
func (*InstrumentRepository) GetInstrumentsByTradingsymbol ¶
func (r *InstrumentRepository) GetInstrumentsByTradingsymbol(tradingsymbol string) ([]models.InstrumentModel, error)
GetInstrumentsByTradingsymbol gets instruments by tradingsymbol
func (*InstrumentRepository) GetInstrumentsQuery ¶
func (r *InstrumentRepository) GetInstrumentsQuery(qip models.QueryInstrumentsParams) ([]models.InstrumentModel, error)
GetInstrumentsQuery queries the instruments table
func (*InstrumentRepository) GetInstrumentsRecordCount ¶
func (r *InstrumentRepository) GetInstrumentsRecordCount() (int64, error)
GetInstrumentsRecordCount returns the number of records in the instruments table
func (*InstrumentRepository) InsertInstruments ¶
func (r *InstrumentRepository) InsertInstruments(records [][]string) (int64, error)
InsertInstruments inserts a batch of instruments into the database
func (*InstrumentRepository) TruncateInstrumentsTable ¶
func (r *InstrumentRepository) TruncateInstrumentsTable() error
TruncateInstrumentsTable truncates the instruments table
type SessionRepository ¶
func NewSessionRepository ¶
func NewSessionRepository(db *gorm.DB) *SessionRepository
NewSessionRepository creates a new repository for the session API
func (*SessionRepository) DeleteSession ¶
func (r *SessionRepository) DeleteSession(userId, enctoken string) (int64, error)
DeleteSession deletes a session
func (*SessionRepository) GetSessionByEnctoken ¶
func (r *SessionRepository) GetSessionByEnctoken(enctoken string) (*models.SessionModel, error)
GetSessionByEnctoken gets a session by enctoken
func (*SessionRepository) GetSessionByUserId ¶
func (r *SessionRepository) GetSessionByUserId(userId string) (*models.SessionModel, error)
GetSessionByUserId gets a session by user ID
func (*SessionRepository) UpsertSession ¶
func (r *SessionRepository) UpsertSession(session *models.SessionModel) error
UpsertSession upserts a session into the database
type TickerRepository ¶
func NewTickerRepository ¶
func NewTickerRepository(db *gorm.DB) *TickerRepository
NewTickerRepository creates a new TickerRepository
func (*TickerRepository) Debug ¶
func (r *TickerRepository) Debug(eventType, message string) error
Debug logs a debug message
func (*TickerRepository) DeleteTickerInstruments ¶
func (r *TickerRepository) DeleteTickerInstruments(userID string, instruments []string) (int64, error)
DeleteTickerInstruments deletes the ticker instruments
func (*TickerRepository) Error ¶
func (r *TickerRepository) Error(eventType, message string) error
Error logs an error message
func (*TickerRepository) Fatal ¶
func (r *TickerRepository) Fatal(eventType, message string) error
Fatal logs a fatal message
func (*TickerRepository) GetInstrumentToken ¶
func (r *TickerRepository) GetInstrumentToken(exchange, symbol string) (uint32, error)
-------------------------------------------- Other funcs --------------------------------------------
func (*TickerRepository) GetTickerInstrumentCount ¶
func (r *TickerRepository) GetTickerInstrumentCount(userID string) (int64, error)
GetTickerInstrumentCount gets the ticker instrument count
func (*TickerRepository) GetTickerInstruments ¶
func (r *TickerRepository) GetTickerInstruments(userID string) ([]models.TickerInstrument, error)
GetTickerInstruments gets the ticker instruments
func (*TickerRepository) Info ¶
func (r *TickerRepository) Info(eventType, message string) error
Info logs an info message
func (*TickerRepository) TruncateTickerData ¶
func (r *TickerRepository) TruncateTickerData() error
-------------------------------------------- TickerData func's grouped together -------------------------------------------- TruncateTickerData truncates the ticker data
func (*TickerRepository) TruncateTickerInstruments ¶
func (r *TickerRepository) TruncateTickerInstruments() (int64, error)
-------------------------------------------- TickerInstruments func's grouped together -------------------------------------------- TruncateTickerInstruments truncates the ticker instruments
func (*TickerRepository) UpsertTickerData ¶
func (r *TickerRepository) UpsertTickerData(tickerData []models.TickerData) error
UpsertTickerData upserts the ticker data
func (*TickerRepository) UpsertTickerInstruments ¶
func (r *TickerRepository) UpsertTickerInstruments(userID string, instruments []models.InstrumentModel) (int64, int64, error)
UpsertTickerInstruments upserts the instruments
func (*TickerRepository) Warn ¶
func (r *TickerRepository) Warn(eventType, message string) error
Warn logs a warning message