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: referral.go
    path of file: ./repos/ente/server/pkg/controller/storagebonus
    
    the code of the file until where you have to start completion: package storagebonus

import (
	"database/sql"
	"errors"
	"fmt"

	"github.com/ente-io/museum/ente"
	entity "github.com/ente-io/museum/ente/storagebonus"
	"github.com/ente-io/museum/pkg/controller/email"
	"github.com/ente-io/museum/pkg/controller/lock"

	"github.com/ente-io/museum/pkg/repo"
	"github.com/ente-io/museum/pkg/repo/storagebonus"
	"github.com/ente-io/museum/pkg/utils/auth"
	enteTime "github.com/ente-io/museum/pkg/utils/time"
	"github.com/ente-io/stacktrace"
	"github.com/gin-gonic/gin"
)

const (
	codeLength                 = 6
	referralAmountInGb         = 10
	maxClaimableReferralAmount = 2000
	numOfDaysToClaimReferral   = 32
	defaultPlanType            = entity.TenGbOnUpgrade
)

// Controller exposes functions to interact with family
    
func generateAlphaNumString(length int) (string, error) {
	// Define the alphabet and numbers to be used in the string.
	alphabet := "ABCDEFGHIJKLMNPQRSTUVWXYZ"
	// Define the alphabet and numbers to be used in the string.
	alphaNum := fmt.Sprintf("%s123456789", alphabet)
	// Allocate a byte slice with the desired length.
	result := make([]byte, length)
	// Generate the first letter as an alphabet.
	r0, err := auth.GenerateRandomInt(int64(len(alphabet)))
	if err != nil {
		return "", stacktrace.Propagate(err, "")
	}
	result[0] = alphabet[r0]
	// Generate the remaining characters as alphanumeric.
	for i := 1; i < length; i++ {
		ri, err := auth.GenerateRandomInt(int64(len(alphaNum)))
		if err != nil {
			return "", stacktrace.Propagate(err, "")
		}
		result[i] = alphaNum[ri]
	}
	return string(result), nil
}