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

Proto consideration #63

Open
nigeltiany opened this issue Mar 29, 2020 · 0 comments
Open

Proto consideration #63

nigeltiany opened this issue Mar 29, 2020 · 0 comments

Comments

@nigeltiany
Copy link

nigeltiany commented Mar 29, 2020

Thank you for the library.

Consider generating device/os/browser types from a proto file. Proto enums are easily upgraded should new device/os/browser coverage be needed. They also present the advantage of being referenced by other definitions. Take google/protobuf/empty.proto for example. A simple empty proto easy to create but referenced by many. Or google/protobuf/timestamp.proto. It is commonly used because it ensures a timestamp with milliseconds and/or nanoseconds precision is parsed around between services needing it. It would be good to parse these device/os/browser types as types and not as strings. Users not needing the proto definitions can continue to use the library as usual.

types
   | -> device
         | -> device.go
         | -> device.proto
         | -> device.pb.go
   | -> os
   ...

device.go

type Device struct {
   device DeviceType // from proto
   version string // or struct with major(), minor(), patch()
}

device.proto

syntax = "proto3";
option go_package = "github.com/avct/uasurfer/types/device";
enum DeviceType {
 unknown = 0;
 ...
};

or Device type can be a message

syntax = "proto3";
option go_package = "github.com/avct/uasurfer/types/device";
message Device {
  DeviceType deviceType = 1;
  Version version = 2;
}
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