noted

package module
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: MIT Imports: 10 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

This section is empty.

Variables

This section is empty.

Functions

func RegisterMailServer added in v0.4.0

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

func UID added in v0.5.0

func UID() string

UID is just a wrapper around the google UUID library

Types

type Clue added in v0.5.1

type Clue struct {
	Addr     string
	Port     string
	UseTLS   bool
	CertPath string
	KeyPath  string
	// contains filtered or unexported fields
}

Clue is the Client Glue struct

func (*Clue) Push added in v0.5.1

func (c *Clue) Push(msg *Pakt, timeout ...int) (*Pakt, error)

Push sends a pakt to a client and returns the response via the Noted gRPC framework

type Glue added in v0.5.0

type Glue struct {
	MS       MailServer
	Addr     string
	Port     string
	UseTLS   bool
	CertPath string
	KeyPath  string
	// contains filtered or unexported fields
}

Glue holds some basic pieces to run the gRPC server. Specify UseTLS, CertPath, and KeyPath to enable TLS.

func (*Glue) Run added in v0.5.0

func (g *Glue) Run()

Run gathers the necessary info and runs the server

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 a 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 a 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 (*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 with a timestamp

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

type When added in v0.5.0

type When struct {
	// ST is the string time
	ST string
	// GT is the Go Time (time struct)
	GT time.Time
	// contains filtered or unexported fields
}

When is a struct that holds time values

func Clock added in v0.5.0

func Clock() *When

Clock returns the current time in a when struct

func ClockS added in v0.5.0

func ClockS(st string) *When

ClockS returns the given time in a when struct

func ClockT added in v0.5.0

func ClockT(t time.Time) *When

ClockT returns a when struct

func (*When) AsString added in v0.5.0

func (w *When) AsString() (string, error)

AsString returns the string value of the Clock time

func (*When) AsTime added in v0.5.0

func (w *When) AsTime() (time.Time, error)

AsTime returns the golang time struct

Directories

Path Synopsis
v1
noted Module

Jump to

Keyboard shortcuts

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