mongostate

package
v0.0.0-...-14d2bb4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

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 (s *MongoDBState) CreateShrl(ctx context.Context, url *pb.ShortURL) (*pb.ShortURL, error)

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) ListShrls

func (s *MongoDBState) ListShrls(ctx context.Context, search *string, count *int64, page *int64) ([]*pb.ShortURL, int64, error)

func (*MongoDBState) UpdateShrl

func (s *MongoDBState) UpdateShrl(ctx context.Context, url *pb.ShortURL) (*pb.ShortURL, error)

type ShrlType

type ShrlType int
const (
	ShortenedUrl ShrlType = iota
	UploadedFile
	TextSnippet
)

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"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL