From 467c2d4cd4cd899352f40d3bb5bb9237bc044141 Mon Sep 17 00:00:00 2001 From: storezhang Date: Wed, 6 Nov 2024 15:48:21 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=A1=B9=E7=9B=AE):=20=E5=AE=9A=E4=B9=89C?= =?UTF-8?q?ollection=E5=92=8CQueue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- collection.go | 7 +++++++ go.mod | 4 ++-- queue.go | 12 ++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 collection.go create mode 100644 queue.go diff --git a/collection.go b/collection.go new file mode 100644 index 0000000..75fb867 --- /dev/null +++ b/collection.go @@ -0,0 +1,7 @@ +package collection + +// Collection 集合 +type Collection interface { + // Size 大小 + Size() int +} diff --git a/go.mod b/go.mod index 2225f00..2ce441c 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/goexl/wanip +module github.com/goexl/collection -go 1.19 +go 1.23 diff --git a/queue.go b/queue.go new file mode 100644 index 0000000..94f22d7 --- /dev/null +++ b/queue.go @@ -0,0 +1,12 @@ +package collection + +// Queue 队列 +type Queue[T any] interface { + Collection + + // Enqueue 入队 + Enqueue(T, ...T) + + // Dequeue 出队 + Dequeue() []T +}