Documentation
¶
Index ¶
- func NewDB(ctx context.Context, dsn string) (*sqlx.DB, error)
- type AdmimRepository
- func (r *AdmimRepository) AddAdmin(ctx context.Context, key string, user *model.User) error
- func (a *AdmimRepository) DeleteLogs(ctx context.Context, project string, to time.Time) (int, error)
- func (r *AdmimRepository) Get(ctx context.Context, user *model.User, id string) (*api.Key, error)
- func (r *AdmimRepository) GetLogs(ctx context.Context, user *model.User, keyID string) ([]*api.Log, error)
- func (a *AdmimRepository) List(ctx context.Context, project string) ([]*api.Key, error)
- func (a *AdmimRepository) ListLogs(ctx context.Context, project string, to time.Time) ([]*api.Log, error)
- func (r *AdmimRepository) Reset(ctx context.Context, project string, since time.Time, limit float64) error
- func (r *AdmimRepository) RestoreUsage(ctx context.Context, project string, manual bool, request string, ...) error
- func (r *AdmimRepository) ValidateToken(ctx context.Context, token string) (*model.User, error)
- type CMSRepository
- func (r *CMSRepository) AddCredits(ctx context.Context, user *model.User, id string, in *api.CreditsInput) (*api.Key, error)
- func (r *CMSRepository) Change(ctx context.Context, user *model.User, id string) (*api.Key, error)
- func (r *CMSRepository) Create(ctx context.Context, user *model.User, in *api.CreateInput) (*api.Key, bool, error)
- func (r *CMSRepository) GetKey(ctx context.Context, user *model.User, id string) (*api.Key, error)
- func (r *CMSRepository) GetKeyID(ctx context.Context, user *model.User, id string) (*api.KeyID, error)
- func (r *CMSRepository) Stats(ctx context.Context, user *model.User, in *api.StatParams) ([]*api.Bucket, error)
- func (r *CMSRepository) Update(ctx context.Context, user *model.User, id string, in *api.UpdateInput) (*api.Key, error)
- func (r *CMSRepository) Usage(ctx context.Context, user *model.User, id string, from *time.Time, ...) (*api.Usage, error)
- type Hasher
- type ProjectSettings
- type Repository
- func (r *Repository) CheckCreateIPKey(ctx context.Context, ip string, limit float64) (string, error)
- func (r *Repository) IsValid(ctx context.Context, key string, IP string, manual bool) (bool, string, []string, error)
- func (r *Repository) Restore(ctx context.Context, key string, manual bool, qv float64) (float64, float64, error)
- func (r *Repository) SaveLog(ctx context.Context, data *api.Log) error
- func (r *Repository) SaveValidate(ctx context.Context, key string, ip string, manual bool, qv float64) (bool, float64, float64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AdmimRepository ¶
type AdmimRepository struct {
// contains filtered or unexported fields
}
Repository communicates with postgres
func NewAdmimRepository ¶
func (*AdmimRepository) DeleteLogs ¶
func (a *AdmimRepository) DeleteLogs(ctx context.Context, project string, to time.Time) (int, error)
DeleteLogs implements admin.LogProvider.
func (*AdmimRepository) ListLogs ¶
func (a *AdmimRepository) ListLogs(ctx context.Context, project string, to time.Time) ([]*api.Log, error)
ListLogs implements admin.LogProvider.
func (*AdmimRepository) RestoreUsage ¶
func (*AdmimRepository) ValidateToken ¶
type CMSRepository ¶
type CMSRepository struct {
// contains filtered or unexported fields
}
func NewCMSRepository ¶
func (*CMSRepository) AddCredits ¶
func (*CMSRepository) Stats ¶ added in v1.0.1
func (r *CMSRepository) Stats(ctx context.Context, user *model.User, in *api.StatParams) ([]*api.Bucket, error)
type ProjectSettings ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository communicates with postgres
func NewRepository ¶
func (*Repository) CheckCreateIPKey ¶
func (*Repository) IsValid ¶
func (r *Repository) IsValid(ctx context.Context, key string, IP string, manual bool) (bool, string, []string, error)
IsValid validates key
Click to show internal directories.
Click to hide internal directories.