Documentation ¶
Index ¶
- type MongoConfig
- type MongoRepository
- func (r *MongoRepository) Delete(ctx context.Context, short string) error
- func (r *MongoRepository) Get(ctx context.Context, short string) (*model.URL, error)
- func (r *MongoRepository) Store(ctx context.Context, short, origin string) error
- func (r *MongoRepository) Update(ctx context.Context, short string, viewsDelta int64) error
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoConfig ¶
MongoConfig contains mongodb connection options.
type MongoRepository ¶
type MongoRepository struct {
// contains filtered or unexported fields
}
MongoRepository is a mongodb storage.
func NewMongoRepository ¶
func NewMongoRepository(ctx context.Context, cfg MongoConfig) (*MongoRepository, error)
NewMongoRepository establishes a new mongodb connection and creates a new repository with mongodb collection.
func (*MongoRepository) Delete ¶
func (r *MongoRepository) Delete(ctx context.Context, short string) error
Delete deletes an URL by short.
type Repository ¶
type Repository interface { Store(ctx context.Context, short, origin string) error Get(ctx context.Context, short string) (*model.URL, error) Update(ctx context.Context, short string, viewsDelta int64) error Delete(ctx context.Context, short string) error }
Repository represents a repository.
Click to show internal directories.
Click to hide internal directories.