Help us shape the future of Go! Take the 2026 Go Developer Survey

snowflakeclient

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

README

snowflakeclient

安装 (mod):

require github.com/yingzhuo/snowflakeclient v1.0.1

使用:

package main

import (
	"fmt"
	cli "github.com/yingzhuo/snowflakeclient"
)

func main() {

	client := cli.NewClient(&cli.Config{
		Host:         "localhost",
		Port:         18080,
		ResponseType: cli.Protobuf,
	})

	// 生成多个ID
	for _, v := range client.NextIds(10) {
		fmt.Println(v)
	}

	// 生成单个ID
	fmt.Println(client.NextId())
}

Documentation

Index

Constants

View Source
const (
	Json     = "json"
	Protobuf = "protobuf"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(config *Config) *Client

func NewJsonClient added in v1.0.1

func NewJsonClient(host string, port int) *Client

func NewProtobufClient added in v1.0.1

func NewProtobufClient(host string, port int) *Client

func (*Client) NextId

func (cli *Client) NextId() int64

func (*Client) NextIds

func (cli *Client) NextIds(n int) []int64

type Config

type Config struct {
	Host         string
	Port         int
	ResponseType string
}

type IdList

type IdList struct {
	Ids                  []int64  `protobuf:"varint,1,rep,packed,name=ids,proto3" json:"ids,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*IdList) Descriptor

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

func (*IdList) GetIds

func (m *IdList) GetIds() []int64

func (*IdList) ProtoMessage

func (*IdList) ProtoMessage()

func (*IdList) Reset

func (m *IdList) Reset()

func (*IdList) String

func (m *IdList) String() string

func (*IdList) XXX_DiscardUnknown

func (m *IdList) XXX_DiscardUnknown()

func (*IdList) XXX_Marshal

func (m *IdList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*IdList) XXX_Merge

func (m *IdList) XXX_Merge(src proto.Message)

func (*IdList) XXX_Size

func (m *IdList) XXX_Size() int

func (*IdList) XXX_Unmarshal

func (m *IdList) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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