Skip to content

Latest commit

 

History

History
59 lines (46 loc) · 1.17 KB

README.md

File metadata and controls

59 lines (46 loc) · 1.17 KB

azqlite Go Reference

azqlite is a lightweight wrapper around github.com/Azure/azure-storage-queue-go to interact with the Azure Storage Queue service in a simpler and more idiomatic way.

Install

go get github.com/josebalius/azqlite

How to use

Instantiate a service

client, err := azqlite.NewClient(azqlite.Config{
	AccountName: "YOUR_AZURE_STORAGE_ACCOUNT_NAME_HERE",
	AccountKey:  "YOUR_AZURE_STORAGE_ACCOUNT_KEY_HERE",
})

Create a queue

q, err := client.CreateQueue(ctx, "test")

Delete a queue

err = c.DeleteQueue(ctx, "test")

Get an existing queue

q := c.GetQueue("test")

Get message count

c, err := q.MessageCount(ctx)

Enqueue a message

m, err := q.Enqueue(ctx, "my message", 1*time.Second, -time.Second)

Dequeue messages

messages, err := q.Dequeue(ctx, 30, 1*time.Second)

Peek messages

messages, err := q.Peek(ctx, 30)

Delete a message

err := q.Delete(ctx, &Message{ID: "1"})