本文整理匯總了Golang中github.com/metaleap/go-xsd/types.String函數的典型用法代碼示例。如果您正苦於以下問題:Golang String函數的具體用法?Golang String怎麽用?Golang String使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了String函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: AddSelectionAnswerBinarySelection
// Add a binary option for a selection answer
func (question *QuestionForm) AddSelectionAnswerBinarySelection(
selectionIdentifier, mimeType, mimeSubType string,
dataURL *url.URL, altText string) {
answer := question.getCurrentAnswer()
if answer.SelectionAnswer == nil {
answer.SelectionAnswer = &questionform.TSelectionAnswerType{}
}
if answer.SelectionAnswer.Selections == nil {
answer.SelectionAnswer.Selections = &questionform.TxsdSelectionAnswerTypeSequenceSelections{}
}
selection := &questionform.TxsdSelectionAnswerTypeSequenceSelectionsSequenceSelection{}
selection.SelectionIdentifier = xsdt.String(selectionIdentifier)
selection.Binary = &questionform.TBinaryContentType{}
if mimeType != "" || mimeSubType != "" {
selection.Binary.MimeType = &questionform.TMimeType{}
if mimeType != "" {
selection.Binary.MimeType.Type = questionform.TxsdMimeTypeSequenceType(mimeType)
}
if mimeSubType != "" {
selection.Binary.MimeType.SubType = xsdt.String(mimeSubType)
}
}
selection.Binary.DataURL = questionform.TURLType(dataURL.String())
if altText != "" {
selection.Binary.AltText = xsdt.String(altText)
}
answer.SelectionAnswer.Selections.Selections = append(
answer.SelectionAnswer.Selections.Selections, selection)
}
示例2: GrantBonus
// GrantBonus issues a payment of money from your account to a Worker.
func (client amtClient) GrantBonus(workerId, assignmentId string,
bonusAmount float32, reason, uniqueRequestToken string) (
amtgen.TxsdGrantBonusResponse, error) {
// Prepare the request
var (
request amtgen.TxsdGrantBonus
args amtgen.TGrantBonusRequest
response amtgen.TxsdGrantBonusResponse
)
args.WorkerId = xsdt.String(workerId)
args.AssignmentId = xsdt.String(assignmentId)
args.BonusAmount = &amtgen.TPrice{}
args.BonusAmount.Amount = xsdt.Decimal(fmt.Sprint(bonusAmount))
args.BonusAmount.CurrencyCode = CURRENCY_USD
args.Reason = xsdt.String(reason)
args.UniqueRequestToken = xsdt.String(uniqueRequestToken)
request.Requests = append(request.Requests, &args)
// Send the request
req, err := client.signRequest("GrantBonus", &request)
if err == nil {
err = client.sendRequest(req, &response)
}
return response, err
}
示例3: CreateQualificationType
// CreateQualificationType creates a new Qualification type.
func (client amtClient) CreateQualificationType(name, description string,
keywords []string, retryDelayInSeconds int,
qualificationTypeStatus, test, answerKey string,
testDurationInSeconds int, autoGranted bool,
autoGrantedValue int) (amtgen.TxsdCreateQualificationTypeResponse, error) {
// Prepare the request
var (
request amtgen.TxsdCreateQualificationType
args amtgen.TCreateQualificationTypeRequest
response amtgen.TxsdCreateQualificationTypeResponse
)
args.Name = xsdt.String(name)
args.Description = xsdt.String(description)
args.Keywords = xsdt.String(strings.Join(keywords, ","))
args.RetryDelayInSeconds = xsdt.Long(retryDelayInSeconds)
args.QualificationTypeStatus = amtgen.TQualificationTypeStatus(
qualificationTypeStatus)
args.Test = xsdt.String(test)
args.AnswerKey = xsdt.String(answerKey)
args.TestDurationInSeconds = xsdt.Long(testDurationInSeconds)
args.AutoGranted = xsdt.Boolean(autoGranted)
args.AutoGrantedValue = xsdt.Int(autoGrantedValue)
request.Requests = append(request.Requests, &args)
// Send the request
req, err := client.signRequest("CreateQualificationType", &request)
if err == nil {
err = client.sendRequest(req, &response)
}
return response, err
}
示例4: AddQuestion
// Add a new Question item, to be populated by subsequent content-adding method
// calls.
func (question *QuestionForm) AddQuestion(questionIdentifier,
displayName string, isRequired bool) {
qq := &questionform.TxsdQuestionFormSequenceChoiceQuestion{}
qq.QuestionIdentifier = xsdt.String(questionIdentifier)
qq.DisplayName = xsdt.String(displayName)
qq.IsRequired = xsdt.Boolean(isRequired)
question.Questions = append(question.Questions, qq)
question.addedOverviewNext = append(question.addedOverviewNext, false)
}
示例5: AddSelectionAnswerFormattedContentSelection
// Add a formatted content option for a selection answer
func (question *QuestionForm) AddSelectionAnswerFormattedContentSelection(
selectionIdentifier, content string) {
answer := question.getCurrentAnswer()
if answer.SelectionAnswer == nil {
answer.SelectionAnswer = &questionform.TSelectionAnswerType{}
}
if answer.SelectionAnswer.Selections == nil {
answer.SelectionAnswer.Selections = &questionform.TxsdSelectionAnswerTypeSequenceSelections{}
}
selection := &questionform.TxsdSelectionAnswerTypeSequenceSelectionsSequenceSelection{}
selection.SelectionIdentifier = xsdt.String(selectionIdentifier)
selection.FormattedContent = xsdt.String(content)
answer.SelectionAnswer.Selections.Selections = append(
answer.SelectionAnswer.Selections.Selections, selection)
}
示例6: AddFreeTextAnswerDefaultText
// Add default text for a free text answer specification
func (question *QuestionForm) AddFreeTextAnswerDefaultText(text string) {
answer := question.getCurrentAnswer()
if answer.FreeTextAnswer == nil {
answer.FreeTextAnswer = &questionform.TFreeTextAnswerType{}
}
answer.FreeTextAnswer.DefaultText = xsdt.String(text)
}
示例7: GetAssignmentsForHIT
// GetAssignmentsForHIT retrieves completed assignments for a HIT.
func (client amtClient) GetAssignmentsForHIT(hitId string,
assignmentStatuses []string, sortProperty string, sortAscending bool,
pageSize, pageNumber int) (
amtgen.TxsdGetAssignmentsForHITResponse, error) {
// Prepare the request
var (
request amtgen.TxsdGetAssignmentsForHIT
args amtgen.TGetAssignmentsForHITRequest
response amtgen.TxsdGetAssignmentsForHITResponse
)
args.HITId = xsdt.String(hitId)
for _, status := range assignmentStatuses {
args.AssignmentStatuses = append(args.AssignmentStatuses,
amtgen.TAssignmentStatus(status))
}
args.SortProperty = amtgen.TGetAssignmentsForHITSortProperty(sortProperty)
if sortAscending {
args.SortDirection = amtgen.TSortDirection("Ascending")
} else {
args.SortDirection = amtgen.TSortDirection("Descending")
}
args.PageSize = xsdt.Int(pageSize)
args.PageNumber = xsdt.Int(pageNumber)
request.Requests = append(request.Requests, &args)
// Send the request
req, err := client.signRequest("GetAssignmentsForHIT", &request)
if err == nil {
err = client.sendRequest(req, &response)
}
return response, err
}
示例8: GetReviewResultsForHIT
// GetReviewResultsForHIT retrieves the computed results and the actions taken
// in the course of executing your Review Policies during a CreateHIT operation.
func (client amtClient) GetReviewResultsForHIT(hitId string,
policyLevels []string,
retrieveActions, retrieveResults bool,
pageSize, pageNumber int) (amtgen.TxsdGetReviewResultsForHITResponse, error) {
// Prepare the request
var (
request amtgen.TxsdGetReviewResultsForHIT
args amtgen.TGetReviewResultsForHITRequest
response amtgen.TxsdGetReviewResultsForHITResponse
)
args.HITId = xsdt.String(hitId)
for _, level := range policyLevels {
args.PolicyLevels = append(args.PolicyLevels,
amtgen.TReviewPolicyLevel(level))
}
args.RetrieveActions = xsdt.Boolean(retrieveActions)
args.RetrieveResults = xsdt.Boolean(retrieveResults)
args.PageSize = xsdt.Int(pageSize)
args.PageNumber = xsdt.Int(pageNumber)
request.Requests = append(request.Requests, &args)
// Send the request
req, err := client.signRequest("GetReviewResultsForHIT", &request)
if err == nil {
err = client.sendRequest(req, &response)
}
return response, err
}
示例9: SearchQualificationTypes
// SearchQualificationTypes searches for Qualification types using the specified
// search query, and returns a list of Qualification types.
func (client amtClient) SearchQualificationTypes(
query, sortProperty string, sortAscending bool,
pageSize, pageNumber int, mustBeRequestable, mustBeOwnedByCaller bool) (
amtgen.TxsdSearchQualificationTypesResponse, error) {
// Prepare the request
var (
request amtgen.TxsdSearchQualificationTypes
args amtgen.TSearchQualificationTypesRequest
response amtgen.TxsdSearchQualificationTypesResponse
)
args.Query = xsdt.String(query)
args.SortProperty = amtgen.TSearchQualificationTypesSortProperty(sortProperty)
if sortAscending {
args.SortDirection = amtgen.TSortDirection("Ascending")
} else {
args.SortDirection = amtgen.TSortDirection("Descending")
}
args.PageSize = xsdt.Int(pageSize)
args.PageNumber = xsdt.Int(pageNumber)
args.MustBeRequestable = xsdt.Boolean(mustBeRequestable)
args.MustBeOwnedByCaller = xsdt.Boolean(mustBeOwnedByCaller)
request.Requests = append(request.Requests, &args)
// Send the request
req, err := client.signRequest("SearchQualificationTypes", &request)
if err == nil {
err = client.sendRequest(req, &response)
}
return response, err
}
示例10: GetQualificationsForQualificationType
// GetQualificationsForQualificationType returns all of the Qualifications
// granted to Workers for a given Qualification type.
func (client amtClient) GetQualificationsForQualificationType(
qualificationTypeId string, isGranted bool,
pageSize, pageNumber int) (
amtgen.TxsdGetQualificationsForQualificationTypeResponse, error) {
// Prepare the request
var (
request amtgen.TxsdGetQualificationsForQualificationType
args amtgen.TGetQualificationsForQualificationTypeRequest
response amtgen.TxsdGetQualificationsForQualificationTypeResponse
)
args.QualificationTypeId = xsdt.String(qualificationTypeId)
if isGranted {
args.Status = amtgen.TQualificationStatus("Granted")
} else {
args.Status = amtgen.TQualificationStatus("Revoked")
}
args.PageSize = xsdt.Int(pageSize)
args.PageNumber = xsdt.Int(pageNumber)
request.Requests = append(request.Requests, &args)
// Send the request
req, err := client.signRequest("GetQualificationsForQualificationType", &request)
if err == nil {
err = client.sendRequest(req, &response)
}
return response, err
}
示例11: GetReviewableHITs
// GetReviewableHITs retrieves the HITs with Status equal to Reviewable or
// Status equal to Reviewing that belong to the Requester calling the operation.
func (client amtClient) GetReviewableHITs(hitTypeId, status,
sortProperty string, sortAscending bool,
pageSize, pageNumber int) (amtgen.TxsdGetReviewableHITsResponse, error) {
// Prepare the request
var (
request amtgen.TxsdGetReviewableHITs
args amtgen.TGetReviewableHITsRequest
response amtgen.TxsdGetReviewableHITsResponse
)
args.HITTypeId = xsdt.String(hitTypeId)
args.Status = amtgen.TReviewableHITStatus(status)
args.SortProperty = amtgen.TGetReviewableHITsSortProperty(sortProperty)
if sortAscending {
args.SortDirection = amtgen.TSortDirection("Ascending")
} else {
args.SortDirection = amtgen.TSortDirection("Descending")
}
args.PageSize = xsdt.Int(pageSize)
args.PageNumber = xsdt.Int(pageNumber)
request.Requests = append(request.Requests, &args)
// Send the request
req, err := client.signRequest("GetReviewableHITs", &request)
if err == nil {
err = client.sendRequest(req, &response)
}
return response, err
}
示例12: CreateHITFromHITTypeId
// CreateHITFromHITTypeId creates a new Human Intelligence Task (HIT) from a
// HITTypeId.
func (client amtClient) CreateHITFromHITTypeId(hitTypeId, question string,
hitLayoutId string, hitLayoutParameters map[string]string,
lifetimeInSeconds, maxAssignments int,
assignmentReviewPolicy, hitReviewPolicy *amtgen.TReviewPolicy,
requesterAnnotation, uniqueRequestToken string) (
amtgen.TxsdCreateHITResponse, error) {
// Prepare the request
var (
args amtgen.TCreateHITRequest
)
args.HITTypeId = xsdt.String(hitTypeId)
args.Question = xsdt.String(question)
args.HITLayoutId = xsdt.String(hitLayoutId)
var hitLayoutParameterOrder []string
for name, _ := range hitLayoutParameters {
hitLayoutParameterOrder = append(hitLayoutParameterOrder, name)
}
sort.Strings(hitLayoutParameterOrder)
for _, name := range hitLayoutParameterOrder {
value := hitLayoutParameters[name]
var param amtgen.THITLayoutParameter
param.Name = xsdt.String(name)
param.Value = xsdt.String(value)
args.HITLayoutParameters = append(args.HITLayoutParameters, ¶m)
}
args.LifetimeInSeconds = xsdt.Long(lifetimeInSeconds)
args.MaxAssignments = xsdt.Int(maxAssignments)
args.AssignmentReviewPolicy = assignmentReviewPolicy
args.HITReviewPolicy = hitReviewPolicy
args.RequesterAnnotation = xsdt.String(requesterAnnotation)
args.UniqueRequestToken = xsdt.String(uniqueRequestToken)
return client.CreateHITFromArgs(args)
}
示例13: AddEmbeddedBinaryContent
// Add an EmbeddedBinary item to the most recent Question/Overview added.
func (question *QuestionForm) AddEmbeddedBinaryContent(
dataURL *url.URL, altText string, width, height int,
applicationParameters map[string]string, mimeType, mimeSubType string) {
binary := &questionform.TEmbeddedBinaryContentType{}
binary.DataURL = questionform.TURLType(dataURL.String())
binary.AltText = xsdt.String(altText)
binary.Width = xsdt.String(fmt.Sprint(width))
binary.Height = xsdt.String(fmt.Sprint(height))
for key, value := range applicationParameters {
param := &questionform.TApplicationParameter{}
param.Name = xsdt.String(key)
param.Value = xsdt.String(value)
binary.ApplicationParameters = append(
binary.ApplicationParameters, param)
}
if mimeType != "" || mimeSubType != "" {
binary.EmbeddedMimeType = &questionform.TEmbeddedMimeType{}
if mimeType != "" {
binary.EmbeddedMimeType.Type = xsdt.String(mimeType)
}
if mimeSubType != "" {
binary.EmbeddedMimeType.SubType = xsdt.String(mimeSubType)
}
}
content := question.getCurrentContent()
content.EmbeddedBinaries = append(content.EmbeddedBinaries, binary)
}
示例14: AddListContent
// Add a List item to the most recent Question/Overview added.
func (question *QuestionForm) AddListContent(listItems []string) {
list := &questionform.TxsdContentTypeChoiceList{}
for _, listItem := range listItems {
list.ListItems = append(list.ListItems, xsdt.String(listItem))
}
content := question.getCurrentContent()
content.Lists = append(content.Lists, list)
}
示例15: AddFlashApplicationContent
// Add a Flash Application item to the most recent Question/Overview added.
func (question *QuestionForm) AddFlashApplicationContent(flashMovieURL *url.URL,
width, height int, applicationParameters map[string]string) {
application := &questionform.TApplicationContentType{}
application.Flash = &questionform.TFlashContentType{}
application.Flash.FlashMovieURL = questionform.TURLType(flashMovieURL.String())
application.Flash.Width = xsdt.String(fmt.Sprint(width))
application.Flash.Height = xsdt.String(fmt.Sprint(height))
for key, value := range applicationParameters {
param := &questionform.TApplicationParameter{}
param.Name = xsdt.String(key)
param.Value = xsdt.String(value)
application.Flash.ApplicationParameters = append(
application.Flash.ApplicationParameters, param)
}
content := question.getCurrentContent()
content.Applications = append(content.Applications, application)
}