| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 package pubsub | |
| 6 | |
| 7 import ( | |
| 8 "google.golang.org/cloud/pubsub" | |
| 9 ) | |
| 10 | |
| 11 // Message is a Google Pub/Sub API message type. It's included here as a | |
| 12 // convenience so users don't have to import the other library in addition to | |
| 13 // this one. | |
| 14 type Message pubsub.Message | |
| 15 | |
| 16 func localMessageToPubSub(m []*Message) (ms []*pubsub.Message) { | |
| 17 if len(m) > 0 { | |
| 18 ms = make([]*pubsub.Message, len(m)) | |
| 19 for i, msg := range m { | |
| 20 ms[i] = (*pubsub.Message)(msg) | |
| 21 } | |
| 22 } | |
| 23 return | |
| 24 } | |
| 25 | |
| 26 func pubSubMessageToLocal(ms []*pubsub.Message) (m []*Message) { | |
| 27 if len(ms) > 0 { | |
| 28 m = make([]*Message, len(ms)) | |
| 29 for i, msg := range ms { | |
| 30 m[i] = (*Message)(msg) | |
| 31 } | |
| 32 } | |
| 33 return | |
| 34 } | |
| OLD | NEW |