Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type JSONApiServer ¶
Server
func NewJSONApiServer ¶
func NewJSONApiServer(config *config.Config, db *sql.DB, redis *redis.Client, storage Storage, redisStorage RedisStorage, logger *logrus.Logger) *JSONApiServer
Constructor
func (*JSONApiServer) Run ¶
func (s *JSONApiServer) Run()
type RedisStorage ¶
type RedisStorage interface { CreateSession(ctx context.Context, session *types.Session, expire int) (string, error) GetUserID(ctx context.Context, refreshToken string) (uuid.UUID, error) DeleteSession(ctx context.Context, refreshToken string) error }
Redis storage interface
type Storage ¶
type Storage interface { CreateAccount(ctx context.Context, reqAcc *types.RequestCreate) (*types.Account, error) GetAccount(ctx context.Context) ([]*types.Account, error) GetAccountByID(ctx context.Context, id uuid.UUID) (*types.Account, error) GetAccountByCard(ctx context.Context, card string) (*types.Account, error) UpdateAccount(ctx context.Context, reqUp *types.RequestUpdate, id uuid.UUID) (*types.Account, error) DeleteAccount(ctx context.Context, id uuid.UUID) error DepositAccount(ctx context.Context, reqDep *types.RequestDeposit) (*types.Account, error) GetAccountStatement(ctx context.Context, id uuid.UUID) ([]string, error) SavePayment(ctx context.Context, tx *sql.Tx, payment *types.Payment) (*types.Payment, error) GetPaymentByID(ctx context.Context, id uuid.UUID) (*types.Payment, error) SaveBalance(ctx context.Context, tx *sql.Tx, account *types.Account, balance, bmoney uint64) (*types.Account, error) UpdateStatement(ctx context.Context, tx *sql.Tx, id, paymentId uuid.UUID) (*types.Account, error) }
Postgres storage interface
Click to show internal directories.
Click to hide internal directories.