database

package
v0.0.0-...-97fc41f Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2020 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Databases
	DBsyncapod = "syncapod"

	// Collections
	ColPodcast      = "podcast"
	ColEpisode      = "episode"
	ColSession      = "session"
	ColUser         = "user"
	ColUserEpisode  = "user_episode"
	ColSubscription = "subscription"
	ColAuthCode     = "oauth_auth_code"
	ColAccessToken  = "oauth_access_token"
)

these constants are for database actions

Variables

This section is empty.

Functions

func NewMongoClient

func NewMongoClient(cfg *config.Config) (*mongodb.MongoClient, error)

CreateMongoClient makes a connection with the mongo client

Types

type ObjectIDCodec

type ObjectIDCodec struct{}

ObjectIDCodec is the codec responsible for encoding and decoding the custom protobuf objectID to the mongodb primitive.Object

func (*ObjectIDCodec) DecodeValue

DecodeValue decodes primitive.ObjectID to protos.ObjectID

func (*ObjectIDCodec) EncodeValue

EncodeValue encodes protos.ObjectID to primitive.ObjectID

type TimestampCodec

type TimestampCodec struct{}

TimestampCodec is the codec responsible for encoding and decoding timestamp values implements ValueCodec which in turn implements ValueEncoder & ValueDecoder. All of the bsoncodec package of mongo driver

func (*TimestampCodec) DecodeValue

DecodeValue decodes the bson to timestamp

func (*TimestampCodec) EncodeValue

EncodeValue encodes a timestamp to bson

Jump to

Keyboard shortcuts

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