diff --git a/go.mod b/go.mod deleted file mode 100644 index b6dd6c7..0000000 --- a/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/thedevsaddam/gojsonq diff --git a/jsonq.go b/jsonq.go index 9ecdad6..a894950 100644 --- a/jsonq.go +++ b/jsonq.go @@ -165,11 +165,11 @@ func (j *JSONQ) Offset(offset int) *JSONQ { // offset skips the records from result func (j *JSONQ) offset() *JSONQ { if list, ok := j.jsonContent.([]interface{}); ok { - if j.offsetRecords <= 0 { + if j.offsetRecords < 0 { j.addError(fmt.Errorf("%d is invalid offset", j.offsetRecords)) return j } - if len(list) > j.offsetRecords { + if len(list) >= j.offsetRecords { j.jsonContent = list[j.offsetRecords:] } else { j.jsonContent = make([]interface{}, 0)