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: partition_client.go
    path of file: ./repos/azure-sdk-for-go/sdk/messaging/azeventhubs
    
    the code of the file until where you have to start completion: // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package azeventhubs

import (
	"context"
	"errors"
	"fmt"
	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/internal/log"
	"github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs/internal"
	"github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs/internal/amqpwrap"

	"github.com/Azure/go-amqp"
)

// DefaultConsumerGroup is the name of the default consumer group in the Event Hubs service.
const DefaultConsumerGroup = "$Default"

const defaultPrefetchSize = int32(300)

// defaultLinkRxBuffer is the maximum number of transfer frames we can handle
// on the Receiver. This matches the current default window size that go-amqp
// uses for sessions.
const defaultMaxCreditSize = uint32(5000)

// StartPosition indicates the position to start receiving events within a partition.
// The default position is Latest.
//
// You can set this in the options for [ConsumerClient.NewPartitionClient].
type StartPosition struct {
	// Offset will start the consumer after the specified offset. Can be exclusive
	// or inclusive, based on the Inclusive property.
	// NOTE: offsets are not stable values, and might refer to different events over time
	// as the Event Hub events reach their age limit and are discarded.
	Offset *int64

	// SequenceNumber will start the consumer after the specified sequence number. Can be exclusive
	// or inclusive, based on the Inclusive property.
	SequenceNumber *int64

	// EnqueuedTime will start the consumer before events that were enqueued on or after EnqueuedTime.
	// Can be exclusive or inclusive, based on the Inclusive property.
	EnqueuedTime *time.Time

	// Inclusive configures whether the events directly at Offset, SequenceNumber or EnqueuedTime will be included (true)
	// or excluded (false).
	Inclusive bool

	// Earliest will start the consumer at the earliest event.
	Ear
    
func (pc *PartitionClient) newEventHubConsumerLink(ctx context.Context, session amqpwrap.AMQPSession, entityPath string, partitionID string) (internal.AMQPReceiverCloser, error) {
	props := map[string]any{
		// this lets Event Hubs return error messages that identify which Receiver stole ownership (and other things) within
		// error messages.
		// Ex: (ownershiplost): link detached, reason: *Error{Condition: amqp:link:stolen, Description: New receiver 'EventHubConsumerClientTestID-Interloper' with higher epoch of '1' is created hence current receiver 'EventHubConsumerClientTestID' with epoch '0' is getting disconnected. If you are recreating the receiver, make sure a higher epoch is used. TrackingId:8031553f0000a5060009a59b63f517a0_G4_B22, SystemTracker:riparkdev:eventhub:tests~10922|$default, Timestamp:2023-02-21T19:12:41, Info: map[]}
		"com.microsoft:receiver-name": pc.instanceID,
	}

	if pc.ownerLevel != nil {
		props["com.microsoft:epoch"] = *pc.ownerLevel
	}

	receiverOptions := &amqp.ReceiverOptions{
		SettlementMode: to.Ptr(amqp.ReceiverSettleModeFirst),
		Filters: []amqp.LinkFilter{
			amqp.NewSelectorFilter(pc.offsetExpression),
		},
		Properties:    props,
		TargetAddress: pc.instanceID,
	}

	if pc.prefetch > 0 {
		log.Writef(EventConsumer, "Enabling prefetch with %d credits", pc.prefetch)
		receiverOptions.Credit = pc.prefetch
	} else if pc.prefetch == 0 {
		log.Writef(EventConsumer, "Enabling prefetch with %d credits", defaultPrefetchSize)
		receiverOptions.Credit = defaultPrefetchSize
	} else {
		// prefetch is disabled, enable manual credits and enable
		// a reasonable default max for the buffer.
		log.Writef(EventConsumer, "Disabling prefetch")
		receiverOptions.Credit = -1
	}

	log.Writef(EventConsumer, "Creating receiver:\n  source:%s\n  instanceID: %s\n  owner level: %d\n  offset: %s\n  manual: %v\n  prefetch: %d",
		entityPath,
		pc.instanceID,
		pc.ownerLevel,
		pc.offsetExpression,
		receiverOptions.Credit == -1,
		pc.prefetch)

	receiver, err := session.NewReceiver(ctx, entityPath, partitionID, receiverOptions)

	if err != nil {
		return nil, err
	}

	return receiver, nil
}