INNER CODE UNIT · Go

func

learning-cloud-native-go/myapp · model/book_status.go:41

func (s BookStatus) String() string {
	return mapBookStatusIntToStr[s]
}

func (s BookStatus) MarshalJSON() ([]byte, error) {
	v, ok := mapBookStatusIntToStr[s]
	if !ok {
		return nil, ErrBookStatusInvalid
	}

	return []byte(fmt.Sprintf("%q", v)), nil
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…