Skip to content

Commit

Permalink
feat: Laravel Queue options
Browse files Browse the repository at this point in the history
  • Loading branch information
lyan-on-jakpat committed Mar 29, 2023
1 parent 155230f commit cd7dda8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions serialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ type MarshalOptions struct {
// and "stdClass" will be used instead. The default value is false.
OnlyStdClass bool
StructName string
LaravelQueue bool
}

// DefaultMarshalOptions will create a new instance of MarshalOptions with
// sensible defaults. See MarshalOptions for a full description of options.
func DefaultMarshalOptions() *MarshalOptions {
options := new(MarshalOptions)
options.OnlyStdClass = false
options.StructName = ""
options.LaravelQueue = false

return options
}
Expand Down Expand Up @@ -176,7 +179,10 @@ func MarshalStruct(input interface{}, options *MarshalOptions) ([]byte, error) {
continue
} else if fieldName == "" {
fieldName = lowerCaseFirstLetter(typeOfValue.Field(i).Name)
} else if fieldName == "data" {
fieldName = "\000" + options.StructName + "\000" + fieldName
}

buffer.Write(MarshalString(fieldName))

m, err := Marshal(f.Interface(), options)
Expand Down

0 comments on commit cd7dda8

Please sign in to comment.