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.TypeFor[DateTime]()
)
Functions ¶
This section is empty.
Types ¶
type DateTime ¶
type DateTime string
DateTime type
type DateTimeCodec ¶
type DateTimeCodec struct{}
func (*DateTimeCodec) DecodeValue ¶
func (d *DateTimeCodec) DecodeValue(_ bson.DecodeContext, vr bson.ValueReader, val reflect.Value) error
func (*DateTimeCodec) EncodeValue ¶
func (d *DateTimeCodec) EncodeValue(_ bson.EncodeContext, vw bson.ValueWriter, val reflect.Value) error
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 bson.ObjectID `json:"_id,omitempty" bson:"_id,omitempty" yaml:"_id,omitempty"` //nolint:tagliatelle
}
Entity type
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
Click to show internal directories.
Click to hide internal directories.