You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: slice_buffer.go
    path of file: ./repos/faygo/vendor/github.com/cupcake/rdb
    
    the code of the file until where you have to start completion: package rdb

import (
	"errors"
	"io"
)

type sliceBuffer struct {
	s []byte
	i int
}

func newSliceBuffer(s []byte) *sliceBuffer {
	return &sliceBuffer{s, 0}
}

func (s *sliceBuffer) Slice(n int) ([]byte, error) {
	if s.i+n > len(s.s) {
		return nil, io.EOF
	}
	b := s.s[s.i : s.i+n]
	s.i += n
	return b, nil
}

func
    
func (s *sliceBuffer) Seek(offset int64, whence int) (int64, error) {
	var abs int64
	switch whence {
	case 0:
		abs = offset
	case 1:
		abs = int64(s.i) + offset
	case 2:
		abs = int64(len(s.s)) + offset
	default:
		return 0, errors.New("invalid whence")
	}
	if abs < 0 {
		return 0, errors.New("negative position")
	}
	if abs >= 1<<31 {
		return 0, errors.New("position out of range")
	}
	s.i = int(abs)
	return abs, nil
}