Files
mostlymatter/vendor/github.com/segmentio/analytics-go/alias.go
Claudio Costa d844c52f06 MM-12389 Update segment library to v3 (#11472)
* Update analytics-go dependency

* Migrate from segment library v2 to v3

* Reinclude gorilla/handlers module

* Fix missing module

* Remove reference to outdated analytics module
2019-07-04 12:26:41 -07:00

39 строки
991 B
Go

package analytics
import "time"
// This type represents object sent in a alias call as described in
// https://segment.com/docs/libraries/http/#alias
type Alias struct {
// This field is exported for serialization purposes and shouldn't be set by
// the application, its value is always overwritten by the library.
Type string `json:"type,omitempty"`
MessageId string `json:"messageId,omitempty"`
PreviousId string `json:"previousId"`
UserId string `json:"userId"`
Timestamp time.Time `json:"timestamp,omitempty"`
Context *Context `json:"context,omitempty"`
Integrations Integrations `json:"integrations,omitempty"`
}
func (msg Alias) validate() error {
if len(msg.UserId) == 0 {
return FieldError{
Type: "analytics.Alias",
Name: "UserId",
Value: msg.UserId,
}
}
if len(msg.PreviousId) == 0 {
return FieldError{
Type: "analytics.Alias",
Name: "PreviousId",
Value: msg.PreviousId,
}
}
return nil
}