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: amf0.go
    path of file: ./repos/lal/pkg/rtmp
    
    the code of the file until where you have to start completion: // Copyright 2019, Chef.  All rights reserved.
// https://github.com/q191201771/lal
//
// Use of this source code is governed by a MIT-style license
// that can be found in the License file.
//
// Author: Chef (191201771@qq.com)

package rtmp

// amf0.go
// @pure
// 提供amf0格式的编码与解码的操作

import (
	"bytes"
	"encoding/hex"
	"fmt"
	"github.com/q191201771/naza/pkg/nazabytes"
	"io"
	"strings"

	"github.com/q191201771/lal/pkg/base"
	"github.com/q191201771/naza/pkg/nazaerrors"

	"github.com/q191201771/naza/pkg/bele"
)

const (
	Amf0TypeMarkerNumber      = uint8(0x00)
	Amf0TypeMarkerBoolean     = uint8(0x01)
	Amf0TypeMarkerStrin
    
func (amf0) WriteObject(writer io.Writer, opa ObjectPairArray) error {
	if _, err := writer.Write([]byte{Amf0TypeMarkerObject}); err != nil {
		return err
	}
	for i := 0; i < len(opa); i++ {
		if err := bele.WriteBe(writer, uint16(len(opa[i].Key))); err != nil {
			return err
		}
		if _, err := writer.Write([]byte(opa[i].Key)); err != nil {
			return err
		}
		switch opa[i].Value.(type) {
		case string:
			if err := Amf0.WriteString(writer, opa[i].Value.(string)); err != nil {
				return err
			}
		case int, float64:
			var numberVal float64
			if intval, ok := opa[i].Value.(int); ok {
				numberVal = float64(intval)
			} else if floatVal, ok := opa[i].Value.(float64); ok {
				numberVal = floatVal
			}
			if err := Amf0.WriteNumber(writer, numberVal); err != nil {
				return err
			}
		case bool:
			if err := Amf0.WriteBoolean(writer, opa[i].Value.(bool)); err != nil {
				return err
			}
		default:
			Log.Panicf("unknown value type. i=%d, v=%+v", i, opa[i].Value)
		}
	}
	_, err := writer.Write(Amf0TypeMarkerObjectEndBytes)
	return err
}