github.com/blend/go-sdk@v1.20240719.1/collections/queue.go (about) 1 /* 2 3 Copyright (c) 2024 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package collections 9 10 // Queue is an interface for implementations of a FIFO buffer. 11 type Queue[T any] interface { 12 Len() int 13 Enqueue(T) 14 Dequeue() T 15 DequeueBack() T 16 Peek() T 17 PeekBack() T 18 Drain() []T 19 Contents() []T 20 Clear() 21 22 Consume(consumer func(value T)) 23 Each(consumer func(value T)) 24 EachUntil(consumer func(value T) bool) 25 ReverseEachUntil(consumer func(value T) bool) 26 }