name

package
v0.0.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2025 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToProto

func ToProto(native *User) *userv1.UserPb

ToProto converts the idiomatic Go struct into its Protobuf representation.

Types

type User

type User struct {
	// Updated JSON tags to camelCase
	Alias string `json:"alias,omitempty"`
	Name  string `json:"name,omitempty"`
	Email string `json:"email,omitempty"`
}

func FromProto

func FromProto(proto *userv1.UserPb) (*User, error)

FromProto converts the Protobuf representation into the idiomatic Go struct.

func (User) MarshalJSON

func (u User) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

REFACTOR: This now has a VALUE RECEIVER (no *). This makes the marshaling robust and linter-friendly.

func (*User) UnmarshalJSON

func (u *User) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. This remains a POINTER RECEIVER (*u), which is correct because it needs to modify the struct it's called on.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL