storage

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	ID     primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	Name   string             `json:"name" bson:"name"`
	URL    string             `json:"url" bson:"url"`
	Status bool               `json:"status" bson:"status"`
	Date   int64              `json:"date" bson:"date"`
}

type Storage added in v1.0.2

type Storage interface {
	GetLastEndpoint(context.Context, primitive.M) (*Endpoint, error)
	GetEndpoints(context.Context, primitive.M) ([]*Endpoint, error)
	SaveEndpoint(context.Context, *Endpoint) error
	GetNames(context.Context) ([]string, error)
	Close(context.Context)
}

func GetMongoClient

func GetMongoClient(cfg *config.Config) Storage

type Store

type Store struct {
	Client *mongo.Client
	DBName string
}

func (*Store) Close

func (s *Store) Close(ctx context.Context)

func (*Store) GetEndpoints

func (s *Store) GetEndpoints(ctx context.Context, filter primitive.M) ([]*Endpoint, error)

func (*Store) GetLastEndpoint

func (s *Store) GetLastEndpoint(ctx context.Context, filter primitive.M) (*Endpoint, error)

func (*Store) GetNames added in v1.0.2

func (s *Store) GetNames(ctx context.Context) ([]string, error)

func (*Store) SaveEndpoint

func (s *Store) SaveEndpoint(ctx context.Context, endpoint *Endpoint) error

Jump to

Keyboard shortcuts

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