當前位置: 首頁>>代碼示例>>Golang>>正文


Golang gauge_messages.Message類代碼示例

本文整理匯總了Golang中github.com/getgauge/gauge/gauge_messages.Message的典型用法代碼示例。如果您正苦於以下問題:Golang Message類的具體用法?Golang Message怎麽用?Golang Message使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Message類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: WriteGaugeMessage

func WriteGaugeMessage(message *gauge_messages.Message, conn net.Conn) error {
	messageId := common.GetUniqueID()
	message.MessageId = &messageId

	data, err := proto.Marshal(message)
	if err != nil {
		return err
	}
	return Write(conn, data)
}
開發者ID:universsky,項目名稱:gauge,代碼行數:10,代碼來源:network.go

示例2: sendMessage

func (p *plugin) sendMessage(message *gauge_messages.Message) error {
	messageID := common.GetUniqueID()
	message.MessageId = &messageID
	messageBytes, err := proto.Marshal(message)
	if err != nil {
		return err
	}
	err = conn.Write(p.connection, messageBytes)
	if err != nil {
		return fmt.Errorf("[Warning] Failed to send message to plugin: %s  %s", p.descriptor.ID, err.Error())
	}
	return nil
}
開發者ID:mattdotmatt,項目名稱:gauge,代碼行數:13,代碼來源:plugin.go

示例3: sendMessage

func (plugin *plugin) sendMessage(message *gauge_messages.Message) error {
	messageId := common.GetUniqueId()
	message.MessageId = &messageId
	messageBytes, err := proto.Marshal(message)
	if err != nil {
		return err
	}
	err = conn.Write(plugin.connection, messageBytes)
	if err != nil {
		return errors.New(fmt.Sprintf("[Warning] Failed to send message to plugin: %d  %s", plugin.descriptor.Id, err.Error()))
	}
	return nil
}
開發者ID:Jayasagar,項目名稱:gauge,代碼行數:13,代碼來源:plugin.go

示例4: GetResponseForGaugeMessage

func GetResponseForGaugeMessage(message *gauge_messages.Message, conn net.Conn) (*gauge_messages.Message, error) {
	messageId := common.GetUniqueID()
	message.MessageId = &messageId

	data, err := proto.Marshal(message)
	if err != nil {
		return nil, err
	}
	responseBytes, err := WriteDataAndGetResponse(conn, data)
	if err != nil {
		return nil, err
	}
	responseMessage := &gauge_messages.Message{}
	if err := proto.Unmarshal(responseBytes, responseMessage); err != nil {
		return nil, err
	}

	if err := checkUnsupportedResponseMessage(responseMessage); err != nil {
		return responseMessage, err
	}
	return responseMessage, err
}
開發者ID:universsky,項目名稱:gauge,代碼行數:22,代碼來源:network.go

示例5: checkUnsupportedResponseMessage

func checkUnsupportedResponseMessage(message *gauge_messages.Message) error {
	if message.GetMessageType() == gauge_messages.Message_UnsupportedMessageResponse {
		return fmt.Errorf("Unsupported Message response received. Message not supported. %s", message.GetUnsupportedMessageResponse().GetMessage())
	}
	return nil
}
開發者ID:universsky,項目名稱:gauge,代碼行數:6,代碼來源:network.go


注:本文中的github.com/getgauge/gauge/gauge_messages.Message類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。