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: oss.go
    path of file: ./repos/open-im-server/pkg/common/db/s3/oss
    
    the code of the file until where you have to start completion: // Copyright Â© 2023 OpenIM. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package oss

import (
	"context"
	"crypto/hmac"
	"crypto/sha1"
	"encoding/base64"
	"encoding/js
    
func (o *OSS) AccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption) (string, error) {
	var opts []oss.Option
	if opt != nil {
		if opt.Image != nil {
			// Docs Address: https://help.aliyun.com/zh/oss/user-guide/resize-images-4?spm=a2c4g.11186623.0.0.4b3b1e4fWW6yji
			var format string
			switch opt.Image.Format {
			case
				imagePng,
				imageJpg,
				imageJpeg,
				imageGif,
				imageWebp:
				format = opt.Image.Format
			default:
				opt.Image.Format = imageJpg
			}
			// https://oss-console-img-demo-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/example.jpg?x-oss-process=image/resize,h_100,m_lfit
			process := "image/resize,m_lfit"
			if opt.Image.Width > 0 {
				process += ",w_" + strconv.Itoa(opt.Image.Width)
			}
			if opt.Image.Height > 0 {
				process += ",h_" + strconv.Itoa(opt.Image.Height)
			}
			process += ",format," + format
			opts = append(opts, oss.Process(process))
		}
		if !o.publicRead {
			if opt.ContentType != "" {
				opts = append(opts, oss.ResponseContentType(opt.ContentType))
			}
			if opt.Filename != "" {
				opts = append(opts, oss.ResponseContentDisposition(`attachment; filename=`+strconv.Quote(opt.Filename)))
			}
		}
	}
	if expire <= 0 {
		expire = time.Hour * 24 * 365 * 99 // 99 years
	} else if expire < time.Second {
		expire = time.Second
	}
	if !o.publicRead {
		return o.bucket.SignURL(name, http.MethodGet, int64(expire/time.Second), opts...)
	}
	rawParams, err := oss.GetRawParams(opts)
	if err != nil {
		return "", errs.Wrap(err, "AccessURL error")
	}
	params := getURLParams(*o.bucket.Client.Conn, rawParams)
	return getURL(o.um, o.bucket.BucketName, name, params).String(), nil
}