String base

v2
Nikita Tokarchuk 6 years ago
parent b4d4fc666e
commit 972516ff9b
  1. 22
      mongox/base/string.go
  2. 5
      mongox/common.go

@ -0,0 +1,22 @@
package base
import (
"github.com/mainnika/mongox-go-driver/mongox"
)
var _ mongox.BaseString = &String{}
// String is a structure with string as an _id field
type String struct {
ID string `bson:"_id,omitempty" json:"_id,omitempty"`
}
// GetID returns an _id
func (db *String) GetID() string {
return db.ID
}
// SetID sets an _id
func (db *String) SetID(id string) {
db.ID = id
}

@ -20,3 +20,8 @@ type BaseObjectID interface {
GetID() primitive.ObjectID
SetID(id primitive.ObjectID)
}
type BaseString interface {
GetID() string
SetID(id string)
}

Loading…
Cancel
Save