Documentation ¶
Index ¶
- Variables
- type Item
- type Repository
- func (s *Repository) Add(ctx context.Context, ip net.IP, duration time.Duration, byUserID int64, ...) error
- func (s *Repository) Clear(ctx context.Context) error
- func (s *Repository) Exists(ctx context.Context, ip net.IP) (bool, error)
- func (s *Repository) GC(ctx context.Context) (int64, error)
- func (s *Repository) Get(ctx context.Context, ip net.IP) (*Item, error)
- func (s *Repository) Remove(ctx context.Context, ip net.IP) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrBanItemNotFound = errors.New("ban item not found")
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item struct { IP net.IP `json:"ip"` Until time.Time `json:"up_to"` ByUserID int64 `json:"by_user_id"` Reason string `json:"reason"` }
Item Item.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository Main Object.
func NewRepository ¶
func NewRepository(db *goqu.Database) (*Repository, error)
NewRepository constructor.
func (*Repository) Add ¶
func (s *Repository) Add(ctx context.Context, ip net.IP, duration time.Duration, byUserID int64, reason string) error
Add IP to list of banned.
func (*Repository) Clear ¶
func (s *Repository) Clear(ctx context.Context) error
Clear removes all collected data.
func (*Repository) GC ¶
func (s *Repository) GC(ctx context.Context) (int64, error)
GC Garbage Collect.
Click to show internal directories.
Click to hide internal directories.