From d47810a661d3ccb146612108c2721e77d14798e5 Mon Sep 17 00:00:00 2001 From: Gisle Aune Date: Sat, 23 Jun 2018 16:12:46 +0200 Subject: [PATCH] Added Immutable userlist --- list/immutable.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 list/immutable.go diff --git a/list/immutable.go b/list/immutable.go new file mode 100644 index 0000000..563724d --- /dev/null +++ b/list/immutable.go @@ -0,0 +1,17 @@ +package list + +// An Immutable is a wrapper around a userlist reference that provides a limited +// set of methods for reading a userlist's content +type Immutable struct { + list *List +} + +// User gets a user by nick +func (il Immutable) User(nick string) (u User, ok bool) { + return il.list.User(nick) +} + +// Users gets all the users in the list, in order +func (il Immutable) Users() []User { + return il.list.Users() +}