func (ec *EventContextV1) SetID(id string) error {
	id = strings.TrimSpace(id)
	if id == "" {
		return errors.New("id is required to be a non-empty string")
	}
	ec.ID = id
	return nil
}
SetID implements EventContextWriter.SetID
package event
import (
	"errors"
	"net/url"
	"strings"
	"time"
	"github.com/cloudevents/sdk-go/v2/types"
)
var _ EventContextWriter = (*EventContextV1)(nil)
func (ec *EventContextV1) SetDataContentType(ct string) error {
	ct = strings.TrimSpace(ct)
	if ct == "" {
		ec.DataContentType = nil
	} else {
		ec.DataContentType = &ct
	}
	return nil
}
func (ec *EventContextV1) SetType(t string) error {
	t = strings.TrimSpace(t)
	ec.Type = t
	return nil
}
func (ec *EventContextV1) SetSource(u string) error {
	pu, err := url.Parse(u)
	if err != nil {
		return err
	}
	ec.Source = types.URIRef{URL: *pu}
	return nil
}
func (ec *EventContextV1) SetSubject(s string) error {
	s = strings.TrimSpace(s)
	if s == "" {
		ec.Subject = nil
	} else {
		ec.Subject = &s
	}
	return nil
}