Documentation ¶
Index ¶
- Variables
- type MongoDBState
- func (s *MongoDBState) CreateShrl(ctx context.Context, url *pb.ShortURL) (*pb.ShortURL, error)
- func (s *MongoDBState) DeleteShrl(ctx context.Context, ref *pb.Ref_ShortURL) error
- func (s *MongoDBState) GetShrl(ctx context.Context, ref *pb.Ref_ShortURL) (*pb.ShortURL, error)
- func (s *MongoDBState) GetShrls(ctx context.Context, ref *pb.Ref_ShortURL) ([]*pb.ShortURL, error)
- func (s *MongoDBState) ListShrls(ctx context.Context, search *string, count *int64, page *int64) ([]*pb.ShortURL, int64, error)
- func (s *MongoDBState) UpdateShrl(ctx context.Context, url *pb.ShortURL) (*pb.ShortURL, error)
- type ShrlType
- type URL
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DefaultSearch string = ".*"
)
Functions ¶
This section is empty.
Types ¶
type MongoDBState ¶
type MongoDBState struct {
// contains filtered or unexported fields
}
func New ¶
func New(c *config.Config) *MongoDBState
func (*MongoDBState) CreateShrl ¶
func (*MongoDBState) DeleteShrl ¶
func (s *MongoDBState) DeleteShrl(ctx context.Context, ref *pb.Ref_ShortURL) error
func (*MongoDBState) GetShrl ¶
func (s *MongoDBState) GetShrl(ctx context.Context, ref *pb.Ref_ShortURL) (*pb.ShortURL, error)
func (*MongoDBState) GetShrls ¶
func (s *MongoDBState) GetShrls(ctx context.Context, ref *pb.Ref_ShortURL) ([]*pb.ShortURL, error)
func (*MongoDBState) UpdateShrl ¶
type URL ¶
type URL struct { ID primitive.ObjectID `bson:"_id" json:"id"` Alias string `bson:"alias" json:"alias"` Location string `bson:"location" json:"location"` UploadLocation string `bson:"upload_location" json:"-"` SnippetTitle string `bson:"snippet_title" json:"snippet_title,omitempty"` Snippet string `bson:"snippet" json:"snippet,omitempty"` CreatedAt time.Time `bson:"created_at" json:"created_at"` Views int `bson:"views" json:"views"` Tags []string `bson:"tags" json:"tags"` Type ShrlType `bson:"type" json:"type"` }
Click to show internal directories.
Click to hide internal directories.