store

package
v0.0.0-...-d6a8ac4 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DateTimeLayout = "2006-01-02T15:04:05.000Z0700"

DateTimeLayout in the ISO8601 format with millisecond precision

Variables

View Source
var (
	EntityIndex = mongo.IndexModel{
		Keys: bson.D{
			{Key: "id", Value: 1},
		},
		Options: options.Index().SetUnique(true),
	}
)
View Source
var (
	EntityWithVersionsIndex = mongo.IndexModel{
		Keys: bson.D{
			{Key: "id", Value: 1},
			{Key: "version", Value: 1},
		},
		Options: options.Index().SetUnique(true),
	}
)
View Source
var (
	TDateTime = reflect.TypeOf(DateTime(""))
)

Functions

This section is empty.

Types

type DateTime

type DateTime string

DateTime type

func NewDateTime

func NewDateTime(t time.Time) DateTime

NewDateTime constructor

func (DateTime) MustTime

func (d DateTime) MustTime() time.Time

MustTime returns the date time as Time and panics on failure

func (DateTime) String

func (d DateTime) String() string

String returns the string representation

func (DateTime) Time

func (d DateTime) Time() (time.Time, error)

Time returns the date time as Time

type DateTimeCodec

type DateTimeCodec struct{}

func (*DateTimeCodec) DecodeValue

func (*DateTimeCodec) EncodeValue

type Dummy

type Dummy struct {
	Entity               `json:",inline" bson:",inline"`
	EntityWithVersions   `json:",inline" bson:",inline"`
	EntityWithTimestamps `json:",inline" bson:",inline"`
}

type Entity

type Entity struct {
	ID     string             `json:"id" bson:"id" yaml:"id"`
	BsonID primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty" yaml:"_id,omitempty"` //nolint:tagliatelle
}

Entity type

func NewEntity

func NewEntity(id string) Entity

func (*Entity) GetID

func (e *Entity) GetID() string

GetID api implementation

func (*Entity) SetID

func (e *Entity) SetID(value string)

SetID api implementation

type EntityWithTimestamps

type EntityWithTimestamps struct {
	CreatedAt time.Time `json:"createdAt" bson:"createdAt"  yaml:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"  yaml:"updatedAt"`
}

func (*EntityWithTimestamps) GetCreatedAt

func (e *EntityWithTimestamps) GetCreatedAt() time.Time

GetCreatedAt api implementation

func (*EntityWithTimestamps) GetUpdatedAt

func (e *EntityWithTimestamps) GetUpdatedAt() time.Time

GetUpdatedAt api implementation

func (*EntityWithTimestamps) SetCreatedAt

func (e *EntityWithTimestamps) SetCreatedAt(t time.Time)

SetCreatedAt api implementation

func (*EntityWithTimestamps) SetUpdatedAt

func (e *EntityWithTimestamps) SetUpdatedAt(t time.Time)

SetUpdatedAt api implementation

type EntityWithVersions

type EntityWithVersions struct {
	Version uint32 `json:"version" bson:"version"  yaml:"version"`
}

EntityWithVersions type

func (*EntityWithVersions) GetVersion

func (e *EntityWithVersions) GetVersion() uint32

GetVersion api implementation

func (*EntityWithVersions) IncreaseVersion

func (e *EntityWithVersions) IncreaseVersion() uint32

IncreaseVersion api implementation

func (*EntityWithVersions) SetVersion

func (e *EntityWithVersions) SetVersion(value uint32)

SetVersion api implementation

Jump to

Keyboard shortcuts

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