LocalhostBunny/models/ids_gen.go

104 lines
2.9 KiB
Go
Raw Normal View History

2023-12-01 09:56:06 +01:00
// Code generated by id-generate.go DO NOT EDIT.
package models
import "go.mongodb.org/mongo-driver/bson"
import "go.mongodb.org/mongo-driver/bson/bsontype"
import "go.mongodb.org/mongo-driver/bson/primitive"
import "gogs.mikescher.com/BlackForestBytes/goext/exerr"
2023-12-02 01:01:16 +01:00
const ChecksumIDGenerator = "c6ecd0c3665e4ed6d1316ccf2899ba29a28d9d06b6c6b97a86adc19c1343787e" // GoExtVersion: 0.0.288
2023-12-01 09:56:06 +01:00
// ================================ AnyID (ids.go) ================================
func (i AnyID) MarshalBSONValue() (bsontype.Type, []byte, error) {
if objId, err := primitive.ObjectIDFromHex(string(i)); err == nil {
return bson.MarshalValue(objId)
} else {
return 0, nil, exerr.New(exerr.TypeMarshalEntityID, "Failed to marshal AnyID("+i.String()+") to ObjectId").Str("value", string(i)).Type("type", i).Build()
}
}
func (i AnyID) String() string {
return string(i)
}
func (i AnyID) ObjID() (primitive.ObjectID, error) {
return primitive.ObjectIDFromHex(string(i))
}
func (i AnyID) Valid() bool {
_, err := primitive.ObjectIDFromHex(string(i))
return err == nil
}
func (i AnyID) AsAny() AnyID {
return AnyID(i)
}
func NewAnyID() AnyID {
return AnyID(primitive.NewObjectID().Hex())
}
// ================================ JobLogID (ids.go) ================================
func (i JobLogID) MarshalBSONValue() (bsontype.Type, []byte, error) {
if objId, err := primitive.ObjectIDFromHex(string(i)); err == nil {
return bson.MarshalValue(objId)
} else {
return 0, nil, exerr.New(exerr.TypeMarshalEntityID, "Failed to marshal JobLogID("+i.String()+") to ObjectId").Str("value", string(i)).Type("type", i).Build()
}
}
func (i JobLogID) String() string {
return string(i)
}
func (i JobLogID) ObjID() (primitive.ObjectID, error) {
return primitive.ObjectIDFromHex(string(i))
}
func (i JobLogID) Valid() bool {
_, err := primitive.ObjectIDFromHex(string(i))
return err == nil
}
func (i JobLogID) AsAny() AnyID {
return AnyID(i)
}
func NewJobLogID() JobLogID {
return JobLogID(primitive.NewObjectID().Hex())
}
// ================================ JobExecutionID (ids.go) ================================
func (i JobExecutionID) MarshalBSONValue() (bsontype.Type, []byte, error) {
if objId, err := primitive.ObjectIDFromHex(string(i)); err == nil {
return bson.MarshalValue(objId)
} else {
return 0, nil, exerr.New(exerr.TypeMarshalEntityID, "Failed to marshal JobExecutionID("+i.String()+") to ObjectId").Str("value", string(i)).Type("type", i).Build()
}
}
func (i JobExecutionID) String() string {
return string(i)
}
func (i JobExecutionID) ObjID() (primitive.ObjectID, error) {
return primitive.ObjectIDFromHex(string(i))
}
func (i JobExecutionID) Valid() bool {
_, err := primitive.ObjectIDFromHex(string(i))
return err == nil
}
func (i JobExecutionID) AsAny() AnyID {
return AnyID(i)
}
func NewJobExecutionID() JobExecutionID {
return JobExecutionID(primitive.NewObjectID().Hex())
}