<commit_before>//
// Copyright 2017 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

package resque

// JobArgument represent a single argument.
type JobArgument interface{}

// Job represents a unit of work.
// Each job lives on a single queue and has an associated payload object.
//
// The payload is a hash with two attributes: `class` and `args`.
// The `class` is the name of the class which
// should be used to run the job.
//
// `Args` are an array of arguments which
// should be passed to the class's `perform` function.
//
type Job struct {
	Class string        `json:"class"`
	Args  []JobArgument `json:"args"`
}<commit_msg>job.go: added MarshalBinary() and UnmarshalBinary().<commit_after>//
// Copyright 2017 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

package resque

import (
	"encoding/json"
)

// JobArgument represent a single argument.
type JobArgument interface{}

// Job represents a unit of work.
// Each job lives on a single queue and has an associated payload object.
//
// The payload is a hash with two attributes: `class` and `args`.
// The `class` is the name of the class which
// should be used to run the job.
//
// `Args` are an array of arguments which
// should be passed to the class's `perform` function.
//
type Job struct {
	Class string        `json:"class"`
	Args  []JobArgument `json:"args"`
}

// MarshalBinary encodes itself into a binary format.
func (j Job) MarshalBinary() ([]byte, error) {
	return json.Marshal(j)
}

// UnmarshalBinary decodes the binary representation into itself.
func (j *Job) UnmarshalBinary(b []byte) error {
	return json.Unmarshal(b, j)
}
{'fraction_non_alphanumeric': 0.10369532428355958, 'fraction_numerical': 0.006033182503770739, 'mean_word_length': 3.3563218390804597, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6006460', 'n_tokens_mistral': 720, 'n_tokens_neox': 701, 'n_words': 361}