github.com/blend/go-sdk@v1.20220411.3/collections/queue.go (about) 1 /* 2 3 Copyright (c) 2022 - 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 // 12 // With the DequeueBack method, you can also use a Queue as a stack. 13 type Queue interface { 14 Len() int 15 Enqueue(value interface{}) 16 Dequeue() interface{} 17 DequeueBack() interface{} 18 Peek() interface{} 19 PeekBack() interface{} 20 Drain() []interface{} 21 Contents() []interface{} 22 Clear() 23 24 Consume(consumer func(value interface{})) 25 Each(consumer func(value interface{})) 26 EachUntil(consumer func(value interface{}) bool) 27 ReverseEachUntil(consumer func(value interface{}) bool) 28 }