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

noted

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: MIT Imports: 7 Imported by: 0

README

noted-go

Go SDK for noted library

Using the SDK

To install, run the following command: go get github.com/thenorthnate/noted-go

Example use:

package main

import (
  "fmt"
  "github.com/golang/protobuf/proto"
  noted "github.com/thenorthnate/noted-go"
)

func main() {
  n := noted.New()
  fmt.Printf("%T\n", n)
  fmt.Println(n)
  data, err := proto.Marshal(&n)
  if err != nil {
    fmt.Println("Error occurred: ", err)
    return
  }
  fmt.Printf("%T\n", data)
  fmt.Println(data)
}

Documentation

Index

Constants

View Source
const (
	// Version is the package version
	Version = "0.3.2"
)

Variables

This section is empty.

Functions

func NewId

func NewId() string

NewId is just a wrapper around the google UUID library

func NewTime

func NewTime() string

NewTime generates a time string following RFC3339

func ParseTime

func ParseTime(timestr string) (time.Time, error)

ParseTime is a simple utility to convert the string time to a go time struct It will throw an error if the time string does not comply with RFC3339

func RegisterMailServer added in v0.4.0

func RegisterMailServer(s *grpc.Server, srv MailServer)

Types

type BatchNote

type BatchNote struct {
	Version              string   `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
	Time                 string   `protobuf:"bytes,2,opt,name=time,proto3" json:"time,omitempty"`
	Notes                []*Note  `protobuf:"bytes,3,rep,name=notes,proto3" json:"notes,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func NewBatch added in v0.3.2

func NewBatch() BatchNote

NewBatch creates a new BatchNote and sets the version and time

func (*BatchNote) Descriptor

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

func (*BatchNote) GetNotes

func (m *BatchNote) GetNotes() []*Note

func (*BatchNote) GetTime

func (m *BatchNote) GetTime() string

func (*BatchNote) GetVersion

func (m *BatchNote) GetVersion() string

func (*BatchNote) ProtoMessage

func (*BatchNote) ProtoMessage()

func (*BatchNote) Reset

func (m *BatchNote) Reset()

func (*BatchNote) String

func (m *BatchNote) String() string

func (*BatchNote) XXX_DiscardUnknown

func (m *BatchNote) XXX_DiscardUnknown()

func (*BatchNote) XXX_Marshal

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

func (*BatchNote) XXX_Merge

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

func (*BatchNote) XXX_Size

func (m *BatchNote) XXX_Size() int

func (*BatchNote) XXX_Unmarshal

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

type MailClient added in v0.4.0

type MailClient interface {
	// Sends a greeting
	Ship(ctx context.Context, in *Pakt, opts ...grpc.CallOption) (*Pakt, error)
}

MailClient is the client API for Mail service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewMailClient added in v0.4.0

func NewMailClient(cc *grpc.ClientConn) MailClient

type MailServer added in v0.4.0

type MailServer interface {
	// Sends a greeting
	Ship(context.Context, *Pakt) (*Pakt, error)
}

MailServer is the server API for Mail service.

type Note

type Note struct {
	// Version is an optional field to include the Noted version
	Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
	// Time is the time in RFC3339 format
	Time string `protobuf:"bytes,2,opt,name=time,proto3" json:"time,omitempty"`
	// Type is the message type
	Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
	// Source is the source of the note
	Source string `protobuf:"bytes,4,opt,name=source,proto3" json:"source,omitempty"`
	// Id is the unique id of the message
	Id string `protobuf:"bytes,5,opt,name=id,proto3" json:"id,omitempty"`
	// Credentials an optional field for storing credentials
	Credentials string `protobuf:"bytes,6,opt,name=credentials,proto3" json:"credentials,omitempty"`
	// DataContentType stores the content type of the data field
	DataContentType string `protobuf:"bytes,7,opt,name=data_content_type,json=dataContentType,proto3" json:"data_content_type,omitempty"`
	// Data holds any binary message including other protos
	Data                 []byte   `protobuf:"bytes,8,opt,name=data,proto3" json:"data,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Note represents the transit time message

func New

func New() Note

New creates a new note with a random ID, the current time, and the default spec version

func (*Note) Descriptor

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

func (*Note) GetCredentials

func (m *Note) GetCredentials() string

func (*Note) GetData

func (m *Note) GetData() []byte

func (*Note) GetDataContentType

func (m *Note) GetDataContentType() string

func (*Note) GetId

func (m *Note) GetId() string

func (*Note) GetSource

func (m *Note) GetSource() string

func (*Note) GetTime

func (m *Note) GetTime() string

func (*Note) GetType

func (m *Note) GetType() string

func (*Note) GetVersion

func (m *Note) GetVersion() string

func (*Note) ProtoMessage

func (*Note) ProtoMessage()

func (*Note) Reset

func (m *Note) Reset()

func (*Note) String

func (m *Note) String() string

func (*Note) XXX_DiscardUnknown

func (m *Note) XXX_DiscardUnknown()

func (*Note) XXX_Marshal

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

func (*Note) XXX_Merge

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

func (*Note) XXX_Size

func (m *Note) XXX_Size() int

func (*Note) XXX_Unmarshal

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

type Pakt added in v0.4.0

type Pakt struct {
	// Time is the RFC3339 string for datetime
	Time string `protobuf:"bytes,1,opt,name=time,proto3" json:"time,omitempty"`
	// Notes is the set of Notes that are to be sent
	Notes                []*Note  `protobuf:"bytes,2,rep,name=notes,proto3" json:"notes,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Pakt is a set of notes

func (*Pakt) Descriptor added in v0.4.0

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

func (*Pakt) GetNotes added in v0.4.0

func (m *Pakt) GetNotes() []*Note

func (*Pakt) GetTime added in v0.4.0

func (m *Pakt) GetTime() string

func (*Pakt) ProtoMessage added in v0.4.0

func (*Pakt) ProtoMessage()

func (*Pakt) Reset added in v0.4.0

func (m *Pakt) Reset()

func (*Pakt) String added in v0.4.0

func (m *Pakt) String() string

func (*Pakt) XXX_DiscardUnknown added in v0.4.0

func (m *Pakt) XXX_DiscardUnknown()

func (*Pakt) XXX_Marshal added in v0.4.0

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

func (*Pakt) XXX_Merge added in v0.4.0

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

func (*Pakt) XXX_Size added in v0.4.0

func (m *Pakt) XXX_Size() int

func (*Pakt) XXX_Unmarshal added in v0.4.0

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

Directories

Path Synopsis
v1
noted module

Jump to

Keyboard shortcuts

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