func (qss *QingStorSigner) WriteQuerySignature(request *http.Request, expires int) error {
	query, err := qss.BuildQuerySignature(request, expires)
	if err != nil {
		return err
	}
	if request.URL.RawQuery != "" {
		query = "?" + request.URL.RawQuery + "&" + query
	} else {
		query = "?" + query
	}
	newRequest, err := http.NewRequest(request.Method,
		request.URL.Scheme+"://"+request.URL.Host+utils.URLQueryEscape(request.URL.Path)+query, nil)
	if err != nil {
		return errors.NewSDKError(
			errors.WithAction("new http request in WriteQuerySignature"),
			errors.WithError(err),
		)
	}
	request.URL = newRequest.URL
	return nil
}
WriteQuerySignature calculates signature and write it to http request url.
package signer
import (
	"crypto/hmac"
	"crypto/sha256"
	"encoding/base64"
	"fmt"
	"net/http"
	"sort"
	"strings"
	"github.com/pengsrc/go-shared/convert"
	"go.uber.org/zap"
	"github.com/qingstor/qingstor-sdk-go/v4/log"
	"github.com/qingstor/qingstor-sdk-go/v4/request/errors"
	"github.com/qingstor/qingstor-sdk-go/v4/utils"
)
type QingStorSigner struct {
	AccessKeyID            string
	SecretAccessKey        string
	EnableVirtualHostStyle bool
}
func (qss *QingStorSigner) WriteSignature(request *http.Request) error {
	authorization, err := qss.BuildSignature(request)
	if err != nil {
		return err
	}
	request.Header.Set("Authorization", authorization)
	return nil
}