common

package module
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: MIT Imports: 8 Imported by: 1

README

ose-common

Is the foundational package for the ose-* Go ecosystem. It provides commonly use Struct, Converter etc.

Go Reference Go Report Card License


✨ Features

  • 🧩 Json Converter – convert from JsonToAny and from AnyToJson
  • 🗺️ Metadata Converter - convert map[string]string to map[string]interface{}

📦 Installation

go get github.com/ose-micro/common

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyToJson

func AnyToJson(cast any) (string, error)

func BoolPtr added in v0.1.0

func BoolPtr(b bool) *bool

func FloatPtr added in v0.1.0

func FloatPtr(f float64) *float64

func FromAnyToPrimitive added in v0.1.2

func FromAnyToPrimitive(val *anypb.Any) interface{}

func Int2Str added in v0.0.7

func Int2Str(i int) string

func IntPtr added in v0.1.0

func IntPtr(i int) *int

func JsonToAny

func JsonToAny(raw any, cast any) error

func ParseStrPtnToStr added in v0.0.8

func ParseStrPtnToStr(str *string) string

func ParseStrToPtn added in v0.0.8

func ParseStrToPtn(val string) *string

func ParseTimeToTimestamp added in v0.0.8

func ParseTimeToTimestamp(val *time.Time) *timestamppb.Timestamp

func ParseTimestampToTimePtn added in v0.0.9

func ParseTimestampToTimePtn(val *timestamppb.Timestamp) *time.Time

func Str2Int added in v0.0.7

func Str2Int(str string) int

func StrPtr added in v0.1.0

func StrPtr(s string) *string

func TimePtr added in v0.1.0

func TimePtr(t time.Time) *time.Time

func ToAny added in v0.1.1

func ToAny(val interface{}) *anypb.Any

func ToInterfaceMap added in v0.0.2

func ToInterfaceMap(in map[string]string) map[string]interface{}

ToInterfaceMap converts map[string]string to map[string]interface{}

func ToStringMap added in v0.0.2

func ToStringMap(in map[string]interface{}) (map[string]string, error)

ToStringMap converts map[string]interface{} to map[string]string

Types

type Address added in v0.0.4

type Address struct {
	Line1       string   `json:"line1" bson:"line1"`
	Line2       string   `json:"line2,omitempty" bson:"line2,omitempty"`
	City        string   `json:"city" bson:"city"`
	State       string   `json:"state,omitempty" bson:"state,omitempty"`
	PostalCode  string   `json:"postal_code,omitempty" bson:"postal_code,omitempty"`
	CountryCode string   `json:"country_code" bson:"country_code"`
	Latitude    *float64 `json:"latitude,omitempty" bson:"latitude,omitempty"`
	Longitude   *float64 `json:"longitude,omitempty" bson:"longitude,omitempty"`
}

type State added in v0.0.4

type State int32

type Status added in v0.0.4

type Status interface {
	State() State
	Previous() *State
	OccurOn() time.Time
}

Directories

Path Synopsis
gen

Jump to

Keyboard shortcuts

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