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-01 11:24:22 +01:00
const ChecksumIDGenerator = "cf5fe3d14932e535744418c0aa3751c08f392f9f117bfa5e8b04f70379879131" // 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 ( ) )
}