//Map function plugins must implement a function named "Map" with the following signature
Map function plugins must implement a function named "Map" with the following signature
// Map function plugins must implement a function named " Map " with the following signature
func Map(input *monstachemap.MapperPluginInput) (output *monstachemap.MapperPluginOutput, err error) {
	doc := input.Document
	createdAt := doc["created_at"]
	if createdAt != nil {
		createdAtStr, ok := createdAt.(string)
		if ok {
			createdAtt, err := time.Parse("2006-01-02 15:04:05", createdAtStr)
			if err == nil {
				doc["created_at"] = createdAtt
			}
		}
	}
	uid := doc["uid"]
	if uid != nil {
		uidStr, ok := uid.(string)
		if ok {
			rs := []rune(uidStr)
			length := len(rs)
			doc["uid_last_6char"] = string(rs[length-6:])
		}
	}
	output = &monstachemap.MapperPluginOutput{Document: doc}
	return output, nil
}
func Map ( input * monstachemap . MapperPluginInput ) ( output * monstachemap . MapperPluginOutput , err error ) { doc := input . Document createdAt := doc [ " " ] if createdAt != nil { createdAtStr , ok := createdAt . ( string ) if ok { createdAtt , err := time . Parse ( " " , createdAtStr ) if err == nil { doc [ " " ] = createdAtt } } } uid := doc [ " " ] if uid != nil { uidStr , ok := uid . ( string ) if ok { rs := [ ] rune ( uidStr ) length := len ( rs ) doc [ " " ] = string ( rs [ length - 6 : ] ) } } output = & monstachemap . MapperPluginOutput { Document : doc } return output , nil }
Map function plugins must implement a function named "Map" with the following signature
Map function plugins must implement a function named " Map " with the following signature
// infoLog.Printf("plugin Map input=%v output = %v", input, output)