v1

package
v0.0.0-...-5e99e8e Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	AnalyticsService_Analytics_FullMethodName = "/analytics.v1.AnalyticsService/Analytics"
)

Variables

View Source
var (
	DeliveryType_name = map[int32]string{
		0: "Local",
		1: "ThinkingData",
		2: "ClickHouse",
		3: "Mixpanel",
	}
	DeliveryType_value = map[string]int32{
		"Local":        0,
		"ThinkingData": 1,
		"ClickHouse":   2,
		"Mixpanel":     3,
	}
)

Enum value maps for DeliveryType.

View Source
var AnalyticsService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "analytics.v1.AnalyticsService",
	HandlerType: (*AnalyticsServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Analytics",
			Handler:    _AnalyticsService_Analytics_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "analytics/analytics.proto",
}

AnalyticsService_ServiceDesc is the grpc.ServiceDesc for AnalyticsService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_analytics_analytics_proto protoreflect.FileDescriptor

Functions

func RegisterAnalyticsServiceHandler

func RegisterAnalyticsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterAnalyticsServiceHandler registers the http handlers for service AnalyticsService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterAnalyticsServiceHandlerClient

func RegisterAnalyticsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AnalyticsServiceClient) error

RegisterAnalyticsServiceHandlerClient registers the http handlers for service AnalyticsService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AnalyticsServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AnalyticsServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "AnalyticsServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.

func RegisterAnalyticsServiceHandlerFromEndpoint

func RegisterAnalyticsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterAnalyticsServiceHandlerFromEndpoint is same as RegisterAnalyticsServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterAnalyticsServiceHandlerServer

func RegisterAnalyticsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AnalyticsServiceServer) error

RegisterAnalyticsServiceHandlerServer registers the http handlers for service AnalyticsService to "mux". UnaryRPC :call AnalyticsServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAnalyticsServiceHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.

func RegisterAnalyticsServiceServer

func RegisterAnalyticsServiceServer(s grpc.ServiceRegistrar, srv AnalyticsServiceServer)

Types

type AnalyticsEvents

type AnalyticsEvents struct {
	Events []*Event `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"`
	// contains filtered or unexported fields
}

func (*AnalyticsEvents) Descriptor deprecated

func (*AnalyticsEvents) Descriptor() ([]byte, []int)

Deprecated: Use AnalyticsEvents.ProtoReflect.Descriptor instead.

func (*AnalyticsEvents) GetEvents

func (x *AnalyticsEvents) GetEvents() []*Event

func (*AnalyticsEvents) ProtoMessage

func (*AnalyticsEvents) ProtoMessage()

func (*AnalyticsEvents) ProtoReflect

func (x *AnalyticsEvents) ProtoReflect() protoreflect.Message

func (*AnalyticsEvents) Reset

func (x *AnalyticsEvents) Reset()

func (*AnalyticsEvents) String

func (x *AnalyticsEvents) String() string

type AnalyticsServiceClient

type AnalyticsServiceClient interface {
	// Analytics send a batch of analytics events to the analytics service,return Nothing
	// Recommend to use async/multi events at once
	// 发送一批分析事件到分析服务,返回Nothing
	// 建议使用异步+批量事件一次发送
	Analytics(ctx context.Context, in *AnalyticsEvents, opts ...grpc.CallOption) (*Nothing, error)
}

AnalyticsServiceClient is the client API for AnalyticsService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type AnalyticsServiceServer

type AnalyticsServiceServer interface {
	// Analytics send a batch of analytics events to the analytics service,return Nothing
	// Recommend to use async/multi events at once
	// 发送一批分析事件到分析服务,返回Nothing
	// 建议使用异步+批量事件一次发送
	Analytics(context.Context, *AnalyticsEvents) (*Nothing, error)
}

AnalyticsServiceServer is the server API for AnalyticsService service. All implementations should embed UnimplementedAnalyticsServiceServer for forward compatibility.

type DeliveryType

type DeliveryType int32
const (
	// Deliver to the local file
	DeliveryType_Local DeliveryType = 0
	// Deliver to ThinkingData
	// https://www.thinkingdata.cn/
	DeliveryType_ThinkingData DeliveryType = 1
	// Deliver to clickhouse
	DeliveryType_ClickHouse DeliveryType = 2
	// Deliver to Mixpanel
	// https://mixpanel.com/
	DeliveryType_Mixpanel DeliveryType = 3
)

func (DeliveryType) Descriptor

func (DeliveryType) Enum

func (x DeliveryType) Enum() *DeliveryType

func (DeliveryType) EnumDescriptor deprecated

func (DeliveryType) EnumDescriptor() ([]byte, []int)

Deprecated: Use DeliveryType.Descriptor instead.

func (DeliveryType) Number

func (DeliveryType) String

func (x DeliveryType) String() string

func (DeliveryType) Type

type Event

type Event struct {

	// The unique name for this event.  Be pragmatic with event names and store additional properties in the
	// properties field.
	// NOTE: only contain: number,letter(ignoring case) and underscore"_" ,no spaces in the configuration
	Event string `protobuf:"bytes,1,opt,name=event,proto3" json:"event,omitempty"`
	// Generic JSON property key/value pairs. {"id":"fun","age":10}
	Properties []byte `protobuf:"bytes,2,opt,name=properties,proto3" json:"properties,omitempty"`
	// Where to deliver this event to, defaults to Local.
	DeliverTo DeliveryType `protobuf:"varint,3,opt,name=deliver_to,json=deliverTo,proto3,enum=analytics.v1.DeliveryType" json:"deliver_to,omitempty"`
	// user_id is the unique identifier for the user.
	// if use thinkingdata ,distinct_id /user_id is required
	UserId string `protobuf:"bytes,4,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	// distinct_id is the unique identifier for the user/visitor.
	// if use thinkingdata ,distinct_id /user_id is required
	DistinctId string `protobuf:"bytes,5,opt,name=distinct_id,json=distinctId,proto3" json:"distinct_id,omitempty"`
	// contains filtered or unexported fields
}

AnalyticsEvent is a single analytics event to capture.

func (*Event) Descriptor deprecated

func (*Event) Descriptor() ([]byte, []int)

Deprecated: Use Event.ProtoReflect.Descriptor instead.

func (*Event) GetDeliverTo

func (x *Event) GetDeliverTo() DeliveryType

func (*Event) GetDistinctId

func (x *Event) GetDistinctId() string

func (*Event) GetEvent

func (x *Event) GetEvent() string

func (*Event) GetProperties

func (x *Event) GetProperties() []byte

func (*Event) GetUserId

func (x *Event) GetUserId() string

func (*Event) ProtoMessage

func (*Event) ProtoMessage()

func (*Event) ProtoReflect

func (x *Event) ProtoReflect() protoreflect.Message

func (*Event) Reset

func (x *Event) Reset()

func (*Event) String

func (x *Event) String() string

type Nothing

type Nothing struct {
	// contains filtered or unexported fields
}

Nothing is an empty message. Used when there's nothing to send.

func (*Nothing) Descriptor deprecated

func (*Nothing) Descriptor() ([]byte, []int)

Deprecated: Use Nothing.ProtoReflect.Descriptor instead.

func (*Nothing) ProtoMessage

func (*Nothing) ProtoMessage()

func (*Nothing) ProtoReflect

func (x *Nothing) ProtoReflect() protoreflect.Message

func (*Nothing) Reset

func (x *Nothing) Reset()

func (*Nothing) String

func (x *Nothing) String() string

type UnimplementedAnalyticsServiceServer

type UnimplementedAnalyticsServiceServer struct{}

UnimplementedAnalyticsServiceServer should be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedAnalyticsServiceServer) Analytics

type UnsafeAnalyticsServiceServer

type UnsafeAnalyticsServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeAnalyticsServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to AnalyticsServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

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