Documentation ¶
Overview ¶
Copyright 2021 Wei (Sam) Wang <sam.wang.0723@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 Wei (Sam) Wang <sam.wang.0723@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CronjobConfig ¶
type CronjobConfig struct { // The logger to use. If not defined an output-discarding logger will // be used instead. Logger *zerolog.Logger }
Config encapsulates the settings for configuring the redis service.
type HistoricalSelectionStrategy ¶
type HistoricalSelectionStrategy struct {
// contains filtered or unexported fields
}
HistoricalSelectionStrategy implements the SelectionStrategy interface for historical selections
func (*HistoricalSelectionStrategy) ListSelections ¶
func (h *HistoricalSelectionStrategy) ListSelections( ctx context.Context, req *dto.ListSelectionRequest, ) ([]*domain.Selection, error)
type IService ¶
type IService interface { BatchUpsertDailyClose(ctx context.Context, objs *[]any) error ListDailyClose( ctx context.Context, req *dto.ListDailyCloseRequest, ) ([]*domain.DailyClose, int64, error) HasDailyClose(ctx context.Context, date string) bool BatchUpsertStocks(ctx context.Context, objs *[]any) error ListStock(ctx context.Context, req *dto.ListStockRequest) ([]*domain.Stock, int64, error) ListCategories(ctx context.Context) (objs []string, err error) ListSelections(ctx context.Context, req *dto.ListSelectionRequest) ([]*domain.Selection, error) BatchUpsertThreePrimary(ctx context.Context, objs *[]any) error ListThreePrimary( ctx context.Context, req *dto.ListThreePrimaryRequest, ) ([]*domain.ThreePrimary, int64, error) GetStakeConcentration( ctx context.Context, req *dto.GetStakeConcentrationRequest, ) (*domain.StakeConcentration, error) BatchUpsertStakeConcentration(ctx context.Context, objs *[]any) error ListeningKafkaInput(ctx context.Context) StopKafka() error StopRedis() error StartCron() StopCron() AddJob(ctx context.Context, spec string, job func()) error CronjobPresetRealtimeMonitoringKeys(ctx context.Context) error CrawlingRealTimePrice(ctx context.Context) error BatchUpsertPickedStocks(ctx context.Context, objs []*domain.PickedStock) error DeletePickedStockByID(ctx context.Context, stockID string) error ListPickedStock(ctx context.Context) ([]*domain.Selection, error) ObtainLock(ctx context.Context, key string, expire time.Duration) *redislock.Lock ListUsers( ctx context.Context, req *dto.ListUsersRequest, ) (objs []*domain.User, totalCount int64, err error) CreateUser(ctx context.Context, obj *domain.User) (err error) UpdateUser(ctx context.Context, obj *domain.User) (err error) Login(ctx context.Context, email, password string) (obj *domain.User, err error) Logout(ctx context.Context) error DeleteUser(ctx context.Context) (err error) GetUserByEmail(ctx context.Context, email string) (obj *domain.User, err error) GetUserByPhone(ctx context.Context, phone string) (obj *domain.User, err error) GetUserByID(ctx context.Context, id uuid.UUID) (obj *domain.User, err error) GetBalance(ctx context.Context) (obj *domain.BalanceView, err error) CreateTransaction( ctx context.Context, orderType string, creditAmount, debitAmount float32, ) error CreateOrder(ctx context.Context, req *dto.CreateOrderRequest) error ListOrders( ctx context.Context, req *dto.ListOrderRequest, ) (objs []*domain.Order, totalCount int64, err error) WithUserID(ctx context.Context) IService }
type KafkaConfig ¶
Config encapsulates the settings for configuring the redis service.
type Option ¶
type Option func(o *serviceImpl)
func WithCronJob ¶
func WithCronJob(cfg CronjobConfig) Option
func WithKafka ¶
func WithKafka(cfg KafkaConfig) Option
func WithLogger ¶
func WithRedis ¶
func WithRedis(cfg RedisConfig) Option
type RealTimeMonitoringTemplate ¶
type RealTimeMonitoringTemplate struct {
// contains filtered or unexported fields
}
Template for real-time monitoring
type RealTimeSelectionStrategy ¶
type RealTimeSelectionStrategy struct {
// contains filtered or unexported fields
}
RealTimeSelectionStrategy implements the SelectionStrategy interface for real-time selections
func (*RealTimeSelectionStrategy) ListSelections ¶
func (r *RealTimeSelectionStrategy) ListSelections( ctx context.Context, req *dto.ListSelectionRequest, ) ([]*domain.Selection, error)
type RedisConfig ¶
type RedisConfig struct { // The logger to use. If not defined an output-discarding logger will // be used instead. Logger *zerolog.Logger // Redis master node DNS hostname Master string // Redis password Password string // Redis sentinel addresses SentinelAddrs []string }
Config encapsulates the settings for configuring the redis service.
type SelectionStrategy ¶
type SelectionStrategy interface {
ListSelections(ctx context.Context, req *dto.ListSelectionRequest) ([]*domain.Selection, error)
}
Define the SelectionStrategy interface