This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | func CalculateEvectivityTimespan(dueDate, dueTime, duration string) (*protocol.EvectivityDateTime, *protocol.EvectivityDateTime, error) { | |
| if dueTime == "" { | |
| return dateOnlySpan(dueDate, duration) | |
| } | |
| return dateTimeSpan(dueDate, dueTime, duration) | |
| } | |
| func dateOnlySpan(dueDate, duration string) (*protocol.EvectivityDateTime, *protocol.EvectivityDateTime, error) { | |
| start, err := time.Parse(PDDateFormat, dueDate) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package main | |
| import ( | |
| "context" | |
| "time" | |
| "github.com/pipedrive/fastis-packages/asyncutil" | |
| "github.com/pkg/errors" | |
| ) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | func logFieldName(prefixes []string) string { | |
| filtered := make([]string, 0, len(prefixes)) | |
| for _, p := range prefixes { | |
| if p != "" { | |
| filtered = append(filtered, p) | |
| } | |
| } | |
| return strings.Join(filtered, "_") | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | func extractLogField(fd protoreflect.FieldDescriptor, hasPrefix bool) (string, bool) { | |
| // check if there are any options available for the field | |
| opts, ok := fd.Options().(*descriptorpb.FieldOptions) | |
| if !ok || opts == nil { | |
| return "", false | |
| } | |
| // check if protocol.FieldOptions specified for the field | |
| // basically extracting anything from [(protocol.options).logField = "something_here"] | |
| field, ok := proto.GetExtension(opts, protocol.E_Options).(*protocol.FieldOptions) | |
| if !ok || field == nil { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | func sanitizeProtoMessage(m protoreflect.ProtoMessage, parentPrefixes ...string) map[string]interface{} { | |
| result := make(map[string]interface{}) | |
| reflect := m.ProtoReflect() | |
| reflect.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { | |
| if !v.IsValid() { | |
| return true | |
| } | |
| if fd.IsList() || fd.IsMap() { | |
| return true | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | func sanitize(args ...interface{}) []interface{} { | |
| res := make([]interface{}, 0, len(args)) | |
| for _, v := range args { | |
| switch a := v.(type) { | |
| case protoreflect.ProtoMessage: | |
| res = append(res, sanitizeProtoMessage(a)) | |
| default: | |
| res = append(res, a) | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | syntax = "proto3"; | |
| import "google/protobuf/descriptor.proto"; | |
| package protocol; | |
| option go_package = ".;protocol"; | |
| message FieldOptions { | |
| string logField = 1; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | func Log(level, message string, args ...interface{}) { | |
| params := append([]interface{}{level + ": ", message + " "}, sanitize(args...)...) | |
| log.Print(params...) | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | syntax = "proto3"; | |
| import "options.proto"; | |
| package protocol; | |
| option go_package = ".;protocol"; | |
| message Title { | |
| int64 id = 1 [(protocol.options).logField = "profession_id"]; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package main | |
| import ( | |
| "blodpost/controller" | |
| "blodpost/protocol" | |
| ) | |
| func main() { | |
| _ = controller.Process(&protocol.Company{ | |
| Id: 11, | 
NewerOlder