From f33be4a7bff0270ddd8c0bb7e07da3fe9871b4a1 Mon Sep 17 00:00:00 2001 From: danushka96 Date: Sun, 1 Dec 2024 19:55:03 +0530 Subject: [PATCH] id type change --- README.md | 2 +- example/internal/model/post.go | 2 +- mongo_document.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dae7153..488af11 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ type User struct { Name string `bson:"name"` } -func (u User) GetID() interface{} { return u.ID } +func (u User) GetID() string { return u.ID } func (u User) SetID(id interface{}) { u.ID = id.(string) } func (u *User) GetCollectionName() string { return "users" } diff --git a/example/internal/model/post.go b/example/internal/model/post.go index 24983b5..5f8926d 100644 --- a/example/internal/model/post.go +++ b/example/internal/model/post.go @@ -16,7 +16,7 @@ type Post struct { UpdatedAt time.Time `bson:"updated_at" json:"updatedAt"` } -func (p Post) GetID() interface{} { +func (p Post) GetID() string { return p.ID } diff --git a/mongo_document.go b/mongo_document.go index ee5365d..c4a515f 100644 --- a/mongo_document.go +++ b/mongo_document.go @@ -1,6 +1,6 @@ package ginboot type Document interface { - GetID() interface{} + GetID() string GetCollectionName() string }