From 5259e07a320c055d15410c96ab35b094d569d19c Mon Sep 17 00:00:00 2001 From: kercylan98 Date: Mon, 16 Oct 2023 18:43:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20generic=20=E5=8C=85=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=20IDR=E3=80=81IDW=E3=80=81IDRW=20=E7=9A=84=E6=B3=9B=E5=9E=8B?= =?UTF-8?q?=E9=80=9A=E7=94=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/generic/id.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/utils/generic/id.go b/utils/generic/id.go index 6243418..3123469 100644 --- a/utils/generic/id.go +++ b/utils/generic/id.go @@ -4,11 +4,24 @@ type IdR[ID comparable] interface { GetId() ID } +type IDR[ID comparable] interface { + GetID() ID +} + type IdW[ID comparable] interface { SetId(id ID) } -type IdRW[ID comparable] interface { +type IDW[ID comparable] interface { + SetID(id ID) +} + +type IdR2W[ID comparable] interface { IdR[ID] IdW[ID] } + +type IDR2W[ID comparable] interface { + IDR[ID] + IDW[ID] +}