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: zstd_convert.go
    path of file: ./repos/tiny-rdm/backend/utils/convert
    
    the code of the file until where you have to start completion: package convutil

import (
	"bytes"
	"github.com/klauspost/compress/zstd"
	"io"
	"strings"
)

type ZStdC
    
func (ZStdConvert) Encode(str string) (string, bool) {
	var compress = func(b []byte) (string, error) {
		var buf bytes.Buffer
		writer, err := zstd.NewWriter(&buf)
		if err != nil {
			return "", err
		}
		if _, err = writer.Write([]byte(str)); err != nil {
			writer.Close()
			return "", err
		}
		writer.Close()
		return string(buf.Bytes()), nil
	}
	if zstdStr, err := compress([]byte(str)); err == nil {
		return zstdStr, true
	}
	return str, false
}