Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/cdillond/cms

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/cdillond/cms

  • v0.1.4
  • Source
  • Go
  • Socket score

Version published
Created
Source

msgq

Go Reference
I created this to play around with channels in Go. It should not be considered production ready. This package is intended to be as general and adaptable as possible, so it provides very little in the way of specific features.

Example

// implement the Message interface
type ExampleMessage struct {
    Id string
    Content string
    Time time.Time
}
func (e ExampleMessage) UpdateAt() time.Time {
    return e.Time
}
func (e ExampleMessage) ContentId() string {
    return e.Id
}
// realistically, the Publish() method will contain more complicated logic
func (e ExampleMessage) Publish() error {
    fmt.Println(e.Content)
    return nil
}

// implement the ErrorHandler interface
type ExampleErrorHandler struct{}
func (e ExampleErrorHandler) HandleError(err error, msg msgq.Message) {
    fmt.Println(err.Error(), msg)
}

func main() {
    MsgQ := msgq.New()
    listenChan, done := MsgQ.Run()
    
    //TODO more complex example
    source := []ExampleMessage{{"1","content", time.Now().Add(time.Second)}, {"2", "content 2", time.Now()}}

    for _, msg := range source {
        listenChan <- msg
    }
    // wait for messages to be published
    time.Sleep(3*time.Second)
    // shut down
    close(listenChan)
    <- done
}

FAQs

Package last updated on 15 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc