Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BSON format support #104

Open
chkp-roeym opened this issue Feb 3, 2025 · 0 comments
Open

BSON format support #104

chkp-roeym opened this issue Feb 3, 2025 · 0 comments

Comments

@chkp-roeym
Copy link

chkp-roeym commented Feb 3, 2025

Hi,

It would be great if you could add support for BSON marshal/unmarshal as an additional flag, similar to the existing '-json' or '-sql' flags. When the '-bson' flag is enabled, the generated code should include methods that implement the following APIs from the repository:

"go.mongodb.org/mongo-driver/bson"

required interfaces:

type Marshaler interface {
	MarshalBSON() ([]byte, error)
}

type ValueMarshaler interface {
	MarshalBSONValue() (bsontype.Type, []byte, error)
}

type Unmarshaler interface {
	UnmarshalBSON([]byte) error
}

type ValueUnmarshaler interface {
	UnmarshalBSONValue(bsontype.Type, []byte) error
}

also the following interfaces for using the enum as a key in a map:

"go.mongodb.org/mongo-driver/bson/bsoncodec/map_codec.go"

type KeyMarshaler interface {
	MarshalKey() (key string, err error)
}

type KeyUnmarshaler interface {
	UnmarshalKey(key string) error
}

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant