From a501eca1fc220583651d6c3364f98656c2380c6c Mon Sep 17 00:00:00 2001 From: NoahLan <6995syu@163.com> Date: Fri, 18 Aug 2023 21:36:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=8C=96int=E6=95=B0=E7=BB=84=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ndef/types.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ndef/types.go b/ndef/types.go index dbac06d..3e517f7 100644 --- a/ndef/types.go +++ b/ndef/types.go @@ -44,3 +44,16 @@ type SortedType interface { type ScalarType interface { Int | Uint | Float | ~string | ~bool } + +type ArgInt []int + +// Get int by index from int slice +func (a ArgInt) Get(i int, args ...int) (r int) { + if i >= 0 && i < len(a) { + r = a[i] + } + if len(args) > 0 { + r = args[0] + } + return +}