id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
136,700
spotinst/spotinst-sdk-go
spotinst/util/jsonutil/json.go
includeField
func includeField(v reflect.Value, f reflect.StructField, mustInclude map[string]struct{}) bool { // The regular JSON encoding of a nil pointer is "null", which means "delete this field". // Therefore, we could enable field deletion by honoring pointer fields' presence in the mustInclude set. // However, many fields...
go
func includeField(v reflect.Value, f reflect.StructField, mustInclude map[string]struct{}) bool { // The regular JSON encoding of a nil pointer is "null", which means "delete this field". // Therefore, we could enable field deletion by honoring pointer fields' presence in the mustInclude set. // However, many fields...
[ "func", "includeField", "(", "v", "reflect", ".", "Value", ",", "f", "reflect", ".", "StructField", ",", "mustInclude", "map", "[", "string", "]", "struct", "{", "}", ")", "bool", "{", "// The regular JSON encoding of a nil pointer is \"null\", which means \"delete th...
// Reports whether the struct field "f" with value "v" should be included in JSON output.
[ "Reports", "whether", "the", "struct", "field", "f", "with", "value", "v", "should", "be", "included", "in", "JSON", "output", "." ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/spotinst/util/jsonutil/json.go#L142-L161
136,701
spotinst/spotinst-sdk-go
spotinst/session/session.go
New
func New(cfgs ...*spotinst.Config) *Session { s := &Session{Config: spotinst.DefaultConfig()} s.Config.Merge(cfgs...) return s }
go
func New(cfgs ...*spotinst.Config) *Session { s := &Session{Config: spotinst.DefaultConfig()} s.Config.Merge(cfgs...) return s }
[ "func", "New", "(", "cfgs", "...", "*", "spotinst", ".", "Config", ")", "*", "Session", "{", "s", ":=", "&", "Session", "{", "Config", ":", "spotinst", ".", "DefaultConfig", "(", ")", "}", "\n", "s", ".", "Config", ".", "Merge", "(", "cfgs", "...",...
// New creates a new instance of Session. Once the Session is created it // can be mutated to modify the Config. The Session is safe to be read // concurrently, but it should not be written to concurrently.
[ "New", "creates", "a", "new", "instance", "of", "Session", ".", "Once", "the", "Session", "is", "created", "it", "can", "be", "mutated", "to", "modify", "the", "Config", ".", "The", "Session", "is", "safe", "to", "be", "read", "concurrently", "but", "it"...
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/spotinst/session/session.go#L18-L22
136,702
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetCluster
func (o *Scaler) SetCluster(v *Cluster) *Scaler { if o.Cluster = v; o.Cluster == nil { o.nullFields = append(o.nullFields, "Cluster") } return o }
go
func (o *Scaler) SetCluster(v *Cluster) *Scaler { if o.Cluster = v; o.Cluster == nil { o.nullFields = append(o.nullFields, "Cluster") } return o }
[ "func", "(", "o", "*", "Scaler", ")", "SetCluster", "(", "v", "*", "Cluster", ")", "*", "Scaler", "{", "if", "o", ".", "Cluster", "=", "v", ";", "o", ".", "Cluster", "==", "nil", "{", "o", ".", "nullFields", "=", "append", "(", "o", ".", "nullF...
// SetCluster sets the Cluster object used when creating a new Scaler
[ "SetCluster", "sets", "the", "Cluster", "object", "used", "when", "creating", "a", "new", "Scaler" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L503-L508
136,703
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetLogURI
func (o *Cluster) SetLogURI(v *string) *Cluster { if o.LogURI = v; o.LogURI == nil { o.nullFields = append(o.nullFields, "LogURI") } return o }
go
func (o *Cluster) SetLogURI(v *string) *Cluster { if o.LogURI = v; o.LogURI == nil { o.nullFields = append(o.nullFields, "LogURI") } return o }
[ "func", "(", "o", "*", "Cluster", ")", "SetLogURI", "(", "v", "*", "string", ")", "*", "Cluster", "{", "if", "o", ".", "LogURI", "=", "v", ";", "o", ".", "LogURI", "==", "nil", "{", "o", ".", "nullFields", "=", "append", "(", "o", ".", "nullFie...
// SetLogURI sets the log uri when creating a new cluster
[ "SetLogURI", "sets", "the", "log", "uri", "when", "creating", "a", "new", "cluster" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L535-L540
136,704
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetAdditionalInfo
func (o *Cluster) SetAdditionalInfo(v *string) *Cluster { if o.AdditionalInfo = v; o.AdditionalInfo == nil { o.nullFields = append(o.nullFields, "AdditionalInfo") } return o }
go
func (o *Cluster) SetAdditionalInfo(v *string) *Cluster { if o.AdditionalInfo = v; o.AdditionalInfo == nil { o.nullFields = append(o.nullFields, "AdditionalInfo") } return o }
[ "func", "(", "o", "*", "Cluster", ")", "SetAdditionalInfo", "(", "v", "*", "string", ")", "*", "Cluster", "{", "if", "o", ".", "AdditionalInfo", "=", "v", ";", "o", ".", "AdditionalInfo", "==", "nil", "{", "o", ".", "nullFields", "=", "append", "(", ...
// SetAdditionalInfo sets the additional info field used by third party integrations when creating a new mrscaler
[ "SetAdditionalInfo", "sets", "the", "additional", "info", "field", "used", "by", "third", "party", "integrations", "when", "creating", "a", "new", "mrscaler" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L543-L548
136,705
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetJobFlowRole
func (o *Cluster) SetJobFlowRole(v *string) *Cluster { if o.JobFlowRole = v; o.JobFlowRole == nil { o.nullFields = append(o.nullFields, "JobFlowRole") } return o }
go
func (o *Cluster) SetJobFlowRole(v *string) *Cluster { if o.JobFlowRole = v; o.JobFlowRole == nil { o.nullFields = append(o.nullFields, "JobFlowRole") } return o }
[ "func", "(", "o", "*", "Cluster", ")", "SetJobFlowRole", "(", "v", "*", "string", ")", "*", "Cluster", "{", "if", "o", ".", "JobFlowRole", "=", "v", ";", "o", ".", "JobFlowRole", "==", "nil", "{", "o", ".", "nullFields", "=", "append", "(", "o", ...
// SetJobFlowRole sets the IAM role that will be adopted by the launched EC2 instances
[ "SetJobFlowRole", "sets", "the", "IAM", "role", "that", "will", "be", "adopted", "by", "the", "launched", "EC2", "instances" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L551-L556
136,706
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetSecurityConfiguration
func (o *Cluster) SetSecurityConfiguration(v *string) *Cluster { if o.SecurityConfiguration = v; o.SecurityConfiguration == nil { o.nullFields = append(o.nullFields, "SecurityConfiguration") } return o }
go
func (o *Cluster) SetSecurityConfiguration(v *string) *Cluster { if o.SecurityConfiguration = v; o.SecurityConfiguration == nil { o.nullFields = append(o.nullFields, "SecurityConfiguration") } return o }
[ "func", "(", "o", "*", "Cluster", ")", "SetSecurityConfiguration", "(", "v", "*", "string", ")", "*", "Cluster", "{", "if", "o", ".", "SecurityConfiguration", "=", "v", ";", "o", ".", "SecurityConfiguration", "==", "nil", "{", "o", ".", "nullFields", "="...
// SetSecurityConfiguration sets the name of the security configuration to be applied to the cluster
[ "SetSecurityConfiguration", "sets", "the", "name", "of", "the", "security", "configuration", "to", "be", "applied", "to", "the", "cluster" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L559-L564
136,707
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetServiceRole
func (o *Cluster) SetServiceRole(v *string) *Cluster { if o.ServiceRole = v; o.ServiceRole == nil { o.nullFields = append(o.nullFields, "ServiceRole") } return o }
go
func (o *Cluster) SetServiceRole(v *string) *Cluster { if o.ServiceRole = v; o.ServiceRole == nil { o.nullFields = append(o.nullFields, "ServiceRole") } return o }
[ "func", "(", "o", "*", "Cluster", ")", "SetServiceRole", "(", "v", "*", "string", ")", "*", "Cluster", "{", "if", "o", ".", "ServiceRole", "=", "v", ";", "o", ".", "ServiceRole", "==", "nil", "{", "o", ".", "nullFields", "=", "append", "(", "o", ...
// SetServiceRole sets the IAM role that the EMR will assume to access AWS resources on your behalf
[ "SetServiceRole", "sets", "the", "IAM", "role", "that", "the", "EMR", "will", "assume", "to", "access", "AWS", "resources", "on", "your", "behalf" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L567-L572
136,708
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetVisibleToAllUsers
func (o *Cluster) SetVisibleToAllUsers(v *bool) *Cluster { if o.VisibleToAllUsers = v; o.VisibleToAllUsers == nil { o.nullFields = append(o.nullFields, "VisibleToAllUsers") } return o }
go
func (o *Cluster) SetVisibleToAllUsers(v *bool) *Cluster { if o.VisibleToAllUsers = v; o.VisibleToAllUsers == nil { o.nullFields = append(o.nullFields, "VisibleToAllUsers") } return o }
[ "func", "(", "o", "*", "Cluster", ")", "SetVisibleToAllUsers", "(", "v", "*", "bool", ")", "*", "Cluster", "{", "if", "o", ".", "VisibleToAllUsers", "=", "v", ";", "o", ".", "VisibleToAllUsers", "==", "nil", "{", "o", ".", "nullFields", "=", "append", ...
// SetVisibleToAllUsers sets a flag indicating if the cluster is visibile to all IAM users
[ "SetVisibleToAllUsers", "sets", "a", "flag", "indicating", "if", "the", "cluster", "is", "visibile", "to", "all", "IAM", "users" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L575-L580
136,709
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetTerminationProtected
func (o *Cluster) SetTerminationProtected(v *bool) *Cluster { if o.TerminationProtected = v; o.TerminationProtected == nil { o.nullFields = append(o.nullFields, "TerminationProtected") } return o }
go
func (o *Cluster) SetTerminationProtected(v *bool) *Cluster { if o.TerminationProtected = v; o.TerminationProtected == nil { o.nullFields = append(o.nullFields, "TerminationProtected") } return o }
[ "func", "(", "o", "*", "Cluster", ")", "SetTerminationProtected", "(", "v", "*", "bool", ")", "*", "Cluster", "{", "if", "o", ".", "TerminationProtected", "=", "v", ";", "o", ".", "TerminationProtected", "==", "nil", "{", "o", ".", "nullFields", "=", "...
// SetTerminationProtected sets whether the EC2 instances in the cluster are protected from terminating API calls
[ "SetTerminationProtected", "sets", "whether", "the", "EC2", "instances", "in", "the", "cluster", "are", "protected", "from", "terminating", "API", "calls" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L583-L588
136,710
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetKeepJobFlowAliveWhenNoSteps
func (o *Cluster) SetKeepJobFlowAliveWhenNoSteps(v *bool) *Cluster { if o.KeepJobFlowAliveWhenNoSteps = v; o.KeepJobFlowAliveWhenNoSteps == nil { o.nullFields = append(o.nullFields, "KeepJobFlowAliveWhenNoSteps") } return o }
go
func (o *Cluster) SetKeepJobFlowAliveWhenNoSteps(v *bool) *Cluster { if o.KeepJobFlowAliveWhenNoSteps = v; o.KeepJobFlowAliveWhenNoSteps == nil { o.nullFields = append(o.nullFields, "KeepJobFlowAliveWhenNoSteps") } return o }
[ "func", "(", "o", "*", "Cluster", ")", "SetKeepJobFlowAliveWhenNoSteps", "(", "v", "*", "bool", ")", "*", "Cluster", "{", "if", "o", ".", "KeepJobFlowAliveWhenNoSteps", "=", "v", ";", "o", ".", "KeepJobFlowAliveWhenNoSteps", "==", "nil", "{", "o", ".", "nu...
// SetKeepJobFlowAliveWhenNoSteps sets KeepJobFlowAliveWhenNoSteps
[ "SetKeepJobFlowAliveWhenNoSteps", "sets", "KeepJobFlowAliveWhenNoSteps" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L591-L596
136,711
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetInstanceGroupType
func (o *Task) SetInstanceGroupType(v *string) *Task { if o.InstanceGroupType = v; o.InstanceGroupType == nil { o.nullFields = append(o.nullFields, "InstanceGroupType") } return o }
go
func (o *Task) SetInstanceGroupType(v *string) *Task { if o.InstanceGroupType = v; o.InstanceGroupType == nil { o.nullFields = append(o.nullFields, "InstanceGroupType") } return o }
[ "func", "(", "o", "*", "Task", ")", "SetInstanceGroupType", "(", "v", "*", "string", ")", "*", "Task", "{", "if", "o", ".", "InstanceGroupType", "=", "v", ";", "o", ".", "InstanceGroupType", "==", "nil", "{", "o", ".", "nullFields", "=", "append", "(...
// SetInstanceGroupType sets the instance group to apply the scheduled task to.
[ "SetInstanceGroupType", "sets", "the", "instance", "group", "to", "apply", "the", "scheduled", "task", "to", "." ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L640-L645
136,712
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetCreateNew
func (o *Strategy) SetCreateNew(v *CreateNew) *Strategy { if o.CreateNew = v; o.CreateNew == nil { o.nullFields = append(o.nullFields, "CreateNew") } return o }
go
func (o *Strategy) SetCreateNew(v *CreateNew) *Strategy { if o.CreateNew = v; o.CreateNew == nil { o.nullFields = append(o.nullFields, "CreateNew") } return o }
[ "func", "(", "o", "*", "Strategy", ")", "SetCreateNew", "(", "v", "*", "CreateNew", ")", "*", "Strategy", "{", "if", "o", ".", "CreateNew", "=", "v", ";", "o", ".", "CreateNew", "==", "nil", "{", "o", ".", "nullFields", "=", "append", "(", "o", "...
// SetCreateNew sets a new mrscaler object
[ "SetCreateNew", "sets", "a", "new", "mrscaler", "object" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L700-L705
136,713
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetProvisioningTimeout
func (o *Strategy) SetProvisioningTimeout(v *ProvisioningTimeout) *Strategy { if o.ProvisioningTimeout = v; o.ProvisioningTimeout == nil { o.nullFields = append(o.nullFields, "ProvisioningTimeout") } return o }
go
func (o *Strategy) SetProvisioningTimeout(v *ProvisioningTimeout) *Strategy { if o.ProvisioningTimeout = v; o.ProvisioningTimeout == nil { o.nullFields = append(o.nullFields, "ProvisioningTimeout") } return o }
[ "func", "(", "o", "*", "Strategy", ")", "SetProvisioningTimeout", "(", "v", "*", "ProvisioningTimeout", ")", "*", "Strategy", "{", "if", "o", ".", "ProvisioningTimeout", "=", "v", ";", "o", ".", "ProvisioningTimeout", "==", "nil", "{", "o", ".", "nullField...
// SetProvisioningTimeout sets the timeout when creating or cloning a scaler
[ "SetProvisioningTimeout", "sets", "the", "timeout", "when", "creating", "or", "cloning", "a", "scaler" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L708-L713
136,714
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetReleaseLabel
func (o *CreateNew) SetReleaseLabel(v *string) *CreateNew { if o.ReleaseLabel = v; o.ReleaseLabel == nil { o.nullFields = append(o.nullFields, "ReleaseLabel") } return o }
go
func (o *CreateNew) SetReleaseLabel(v *string) *CreateNew { if o.ReleaseLabel = v; o.ReleaseLabel == nil { o.nullFields = append(o.nullFields, "ReleaseLabel") } return o }
[ "func", "(", "o", "*", "CreateNew", ")", "SetReleaseLabel", "(", "v", "*", "string", ")", "*", "CreateNew", "{", "if", "o", ".", "ReleaseLabel", "=", "v", ";", "o", ".", "ReleaseLabel", "==", "nil", "{", "o", ".", "nullFields", "=", "append", "(", ...
// SetReleaseLabel sets the release label for a new scaler
[ "SetReleaseLabel", "sets", "the", "release", "label", "for", "a", "new", "scaler" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L768-L773
136,715
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetRetries
func (o *CreateNew) SetRetries(v *int) *CreateNew { if o.Retries = v; o.Retries == nil { o.nullFields = append(o.nullFields, "Retries") } return o }
go
func (o *CreateNew) SetRetries(v *int) *CreateNew { if o.Retries = v; o.Retries == nil { o.nullFields = append(o.nullFields, "Retries") } return o }
[ "func", "(", "o", "*", "CreateNew", ")", "SetRetries", "(", "v", "*", "int", ")", "*", "CreateNew", "{", "if", "o", ".", "Retries", "=", "v", ";", "o", ".", "Retries", "==", "nil", "{", "o", ".", "nullFields", "=", "append", "(", "o", ".", "nul...
// SetRetries sets the number of retries to attempt when creating a new scaler
[ "SetRetries", "sets", "the", "number", "of", "retries", "to", "attempt", "when", "creating", "a", "new", "scaler" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L776-L781
136,716
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetTimeoutAction
func (o *ProvisioningTimeout) SetTimeoutAction(v *string) *ProvisioningTimeout { if o.TimeoutAction = v; o.TimeoutAction == nil { o.nullFields = append(o.nullFields, "TimeoutAction") } return o }
go
func (o *ProvisioningTimeout) SetTimeoutAction(v *string) *ProvisioningTimeout { if o.TimeoutAction = v; o.TimeoutAction == nil { o.nullFields = append(o.nullFields, "TimeoutAction") } return o }
[ "func", "(", "o", "*", "ProvisioningTimeout", ")", "SetTimeoutAction", "(", "v", "*", "string", ")", "*", "ProvisioningTimeout", "{", "if", "o", ".", "TimeoutAction", "=", "v", ";", "o", ".", "TimeoutAction", "==", "nil", "{", "o", ".", "nullFields", "="...
// SetTimeoutAction sets the action to take on timeout
[ "SetTimeoutAction", "sets", "the", "action", "to", "take", "on", "timeout" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L802-L807
136,717
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetBootstrapActions
func (o *Compute) SetBootstrapActions(v *BootstrapActions) *Compute { if o.BootstrapActions = v; o.BootstrapActions == nil { o.nullFields = append(o.nullFields, "BootstrapActions") } return o }
go
func (o *Compute) SetBootstrapActions(v *BootstrapActions) *Compute { if o.BootstrapActions = v; o.BootstrapActions == nil { o.nullFields = append(o.nullFields, "BootstrapActions") } return o }
[ "func", "(", "o", "*", "Compute", ")", "SetBootstrapActions", "(", "v", "*", "BootstrapActions", ")", "*", "Compute", "{", "if", "o", ".", "BootstrapActions", "=", "v", ";", "o", ".", "BootstrapActions", "==", "nil", "{", "o", ".", "nullFields", "=", "...
// SetBootstrapActions sets the path for a bootstrap actions file stored in AWS S3
[ "SetBootstrapActions", "sets", "the", "path", "for", "a", "bootstrap", "actions", "file", "stored", "in", "AWS", "S3" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L852-L857
136,718
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetSteps
func (o *Compute) SetSteps(v *Steps) *Compute { if o.Steps = v; o.Steps == nil { o.nullFields = append(o.nullFields, "Steps") } return o }
go
func (o *Compute) SetSteps(v *Steps) *Compute { if o.Steps = v; o.Steps == nil { o.nullFields = append(o.nullFields, "Steps") } return o }
[ "func", "(", "o", "*", "Compute", ")", "SetSteps", "(", "v", "*", "Steps", ")", "*", "Compute", "{", "if", "o", ".", "Steps", "=", "v", ";", "o", ".", "Steps", "==", "nil", "{", "o", ".", "nullFields", "=", "append", "(", "o", ".", "nullFields"...
// SetSteps sets the path for a steps file stored in AWS S3
[ "SetSteps", "sets", "the", "path", "for", "a", "steps", "file", "stored", "in", "AWS", "S3" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L860-L865
136,719
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetEBSRootVolumeSize
func (o *Compute) SetEBSRootVolumeSize(v *int) *Compute { if o.EBSRootVolumeSize = v; o.EBSRootVolumeSize == nil { o.nullFields = append(o.nullFields, "EBSRootVolumeSize") } return o }
go
func (o *Compute) SetEBSRootVolumeSize(v *int) *Compute { if o.EBSRootVolumeSize = v; o.EBSRootVolumeSize == nil { o.nullFields = append(o.nullFields, "EBSRootVolumeSize") } return o }
[ "func", "(", "o", "*", "Compute", ")", "SetEBSRootVolumeSize", "(", "v", "*", "int", ")", "*", "Compute", "{", "if", "o", ".", "EBSRootVolumeSize", "=", "v", ";", "o", ".", "EBSRootVolumeSize", "==", "nil", "{", "o", ".", "nullFields", "=", "append", ...
// SetEBSRootVolumeSize sets the ebs root volume size when creating a new scaler
[ "SetEBSRootVolumeSize", "sets", "the", "ebs", "root", "volume", "size", "when", "creating", "a", "new", "scaler" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L868-L873
136,720
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetManagedPrimarySecurityGroup
func (o *Compute) SetManagedPrimarySecurityGroup(v *string) *Compute { if o.ManagedPrimarySecurityGroup = v; o.ManagedPrimarySecurityGroup == nil { o.nullFields = append(o.nullFields, "ManagedPrimarySecurityGroup") } return o }
go
func (o *Compute) SetManagedPrimarySecurityGroup(v *string) *Compute { if o.ManagedPrimarySecurityGroup = v; o.ManagedPrimarySecurityGroup == nil { o.nullFields = append(o.nullFields, "ManagedPrimarySecurityGroup") } return o }
[ "func", "(", "o", "*", "Compute", ")", "SetManagedPrimarySecurityGroup", "(", "v", "*", "string", ")", "*", "Compute", "{", "if", "o", ".", "ManagedPrimarySecurityGroup", "=", "v", ";", "o", ".", "ManagedPrimarySecurityGroup", "==", "nil", "{", "o", ".", "...
// SetManagedPrimarySecurityGroup sets the managed primary security group when creating a new scaler
[ "SetManagedPrimarySecurityGroup", "sets", "the", "managed", "primary", "security", "group", "when", "creating", "a", "new", "scaler" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L876-L881
136,721
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetManagedReplicaSecurityGroup
func (o *Compute) SetManagedReplicaSecurityGroup(v *string) *Compute { if o.ManagedReplicaSecurityGroup = v; o.ManagedReplicaSecurityGroup == nil { o.nullFields = append(o.nullFields, "ManagedReplicaSecurityGroup") } return o }
go
func (o *Compute) SetManagedReplicaSecurityGroup(v *string) *Compute { if o.ManagedReplicaSecurityGroup = v; o.ManagedReplicaSecurityGroup == nil { o.nullFields = append(o.nullFields, "ManagedReplicaSecurityGroup") } return o }
[ "func", "(", "o", "*", "Compute", ")", "SetManagedReplicaSecurityGroup", "(", "v", "*", "string", ")", "*", "Compute", "{", "if", "o", ".", "ManagedReplicaSecurityGroup", "=", "v", ";", "o", ".", "ManagedReplicaSecurityGroup", "==", "nil", "{", "o", ".", "...
// SetManagedReplicaSecurityGroup sets the managed replica security group when creating a new scaler
[ "SetManagedReplicaSecurityGroup", "sets", "the", "managed", "replica", "security", "group", "when", "creating", "a", "new", "scaler" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L884-L889
136,722
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetServiceAccessSecurityGroup
func (o *Compute) SetServiceAccessSecurityGroup(v *string) *Compute { if o.ServiceAccessSecurityGroup = v; o.ServiceAccessSecurityGroup == nil { o.nullFields = append(o.nullFields, "ServiceAccessSecurityGroup") } return o }
go
func (o *Compute) SetServiceAccessSecurityGroup(v *string) *Compute { if o.ServiceAccessSecurityGroup = v; o.ServiceAccessSecurityGroup == nil { o.nullFields = append(o.nullFields, "ServiceAccessSecurityGroup") } return o }
[ "func", "(", "o", "*", "Compute", ")", "SetServiceAccessSecurityGroup", "(", "v", "*", "string", ")", "*", "Compute", "{", "if", "o", ".", "ServiceAccessSecurityGroup", "=", "v", ";", "o", ".", "ServiceAccessSecurityGroup", "==", "nil", "{", "o", ".", "nul...
// SetServiceAccessSecurityGroup sets the service security group when creating a new scaler
[ "SetServiceAccessSecurityGroup", "sets", "the", "service", "security", "group", "when", "creating", "a", "new", "scaler" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L892-L897
136,723
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetAdditionalPrimarySecurityGroups
func (o *Compute) SetAdditionalPrimarySecurityGroups(v []string) *Compute { if o.AdditionalPrimarySecurityGroups = v; o.AdditionalPrimarySecurityGroups == nil { o.nullFields = append(o.nullFields, "AdditionalPrimarySecurityGroups") } return o }
go
func (o *Compute) SetAdditionalPrimarySecurityGroups(v []string) *Compute { if o.AdditionalPrimarySecurityGroups = v; o.AdditionalPrimarySecurityGroups == nil { o.nullFields = append(o.nullFields, "AdditionalPrimarySecurityGroups") } return o }
[ "func", "(", "o", "*", "Compute", ")", "SetAdditionalPrimarySecurityGroups", "(", "v", "[", "]", "string", ")", "*", "Compute", "{", "if", "o", ".", "AdditionalPrimarySecurityGroups", "=", "v", ";", "o", ".", "AdditionalPrimarySecurityGroups", "==", "nil", "{"...
// SetAdditionalPrimarySecurityGroups sets a list of additional primary security groups
[ "SetAdditionalPrimarySecurityGroups", "sets", "a", "list", "of", "additional", "primary", "security", "groups" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L900-L905
136,724
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetAdditionalReplicaSecurityGroups
func (o *Compute) SetAdditionalReplicaSecurityGroups(v []string) *Compute { if o.AdditionalReplicaSecurityGroups = v; o.AdditionalReplicaSecurityGroups == nil { o.nullFields = append(o.nullFields, "AdditionalReplicaSecurityGroups") } return o }
go
func (o *Compute) SetAdditionalReplicaSecurityGroups(v []string) *Compute { if o.AdditionalReplicaSecurityGroups = v; o.AdditionalReplicaSecurityGroups == nil { o.nullFields = append(o.nullFields, "AdditionalReplicaSecurityGroups") } return o }
[ "func", "(", "o", "*", "Compute", ")", "SetAdditionalReplicaSecurityGroups", "(", "v", "[", "]", "string", ")", "*", "Compute", "{", "if", "o", ".", "AdditionalReplicaSecurityGroups", "=", "v", ";", "o", ".", "AdditionalReplicaSecurityGroups", "==", "nil", "{"...
// SetAdditionalReplicaSecurityGroups sets a list of additional Replica security groups
[ "SetAdditionalReplicaSecurityGroups", "sets", "a", "list", "of", "additional", "Replica", "security", "groups" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L908-L913
136,725
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetCustomAMIID
func (o *Compute) SetCustomAMIID(v *string) *Compute { if o.CustomAMIID = v; o.CustomAMIID == nil { o.nullFields = append(o.nullFields, "CustomAMIID") } return o }
go
func (o *Compute) SetCustomAMIID(v *string) *Compute { if o.CustomAMIID = v; o.CustomAMIID == nil { o.nullFields = append(o.nullFields, "CustomAMIID") } return o }
[ "func", "(", "o", "*", "Compute", ")", "SetCustomAMIID", "(", "v", "*", "string", ")", "*", "Compute", "{", "if", "o", ".", "CustomAMIID", "=", "v", ";", "o", ".", "CustomAMIID", "==", "nil", "{", "o", ".", "nullFields", "=", "append", "(", "o", ...
// SetCustomAMIID sets the custom AMI ID
[ "SetCustomAMIID", "sets", "the", "custom", "AMI", "ID" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L916-L921
136,726
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetEC2KeyName
func (o *Compute) SetEC2KeyName(v *string) *Compute { if o.EC2KeyName = v; o.EC2KeyName == nil { o.nullFields = append(o.nullFields, "EC2KeyName") } return o }
go
func (o *Compute) SetEC2KeyName(v *string) *Compute { if o.EC2KeyName = v; o.EC2KeyName == nil { o.nullFields = append(o.nullFields, "EC2KeyName") } return o }
[ "func", "(", "o", "*", "Compute", ")", "SetEC2KeyName", "(", "v", "*", "string", ")", "*", "Compute", "{", "if", "o", ".", "EC2KeyName", "=", "v", ";", "o", ".", "EC2KeyName", "==", "nil", "{", "o", ".", "nullFields", "=", "append", "(", "o", "."...
// SetEC2KeyName sets the EC2 key name
[ "SetEC2KeyName", "sets", "the", "EC2", "key", "name" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L931-L936
136,727
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetApplications
func (o *Compute) SetApplications(v []*Application) *Compute { if o.Applications = v; o.Applications == nil { o.nullFields = append(o.nullFields, "Applications") } return o }
go
func (o *Compute) SetApplications(v []*Application) *Compute { if o.Applications = v; o.Applications == nil { o.nullFields = append(o.nullFields, "Applications") } return o }
[ "func", "(", "o", "*", "Compute", ")", "SetApplications", "(", "v", "[", "]", "*", "Application", ")", "*", "Compute", "{", "if", "o", ".", "Applications", "=", "v", ";", "o", ".", "Applications", "==", "nil", "{", "o", ".", "nullFields", "=", "app...
// SetApplications sets the applications object
[ "SetApplications", "sets", "the", "applications", "object" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L939-L944
136,728
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetInstanceWeights
func (o *Compute) SetInstanceWeights(v []*InstanceWeight) *Compute { if o.InstanceWeights = v; o.InstanceWeights == nil { o.nullFields = append(o.nullFields, "InstanceWeights") } return o }
go
func (o *Compute) SetInstanceWeights(v []*InstanceWeight) *Compute { if o.InstanceWeights = v; o.InstanceWeights == nil { o.nullFields = append(o.nullFields, "InstanceWeights") } return o }
[ "func", "(", "o", "*", "Compute", ")", "SetInstanceWeights", "(", "v", "[", "]", "*", "InstanceWeight", ")", "*", "Compute", "{", "if", "o", ".", "InstanceWeights", "=", "v", ";", "o", ".", "InstanceWeights", "==", "nil", "{", "o", ".", "nullFields", ...
// SetInstanceWeights sets a list if instance weights by type
[ "SetInstanceWeights", "sets", "a", "list", "if", "instance", "weights", "by", "type" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L947-L952
136,729
spotinst/spotinst-sdk-go
service/mrscaler/mrscaler.go
SetArgs
func (o *Application) SetArgs(v []string) *Application { if o.Args = v; o.Args == nil { o.nullFields = append(o.nullFields, "Args") } return o }
go
func (o *Application) SetArgs(v []string) *Application { if o.Args = v; o.Args == nil { o.nullFields = append(o.nullFields, "Args") } return o }
[ "func", "(", "o", "*", "Application", ")", "SetArgs", "(", "v", "[", "]", "string", ")", "*", "Application", "{", "if", "o", ".", "Args", "=", "v", ";", "o", ".", "Args", "==", "nil", "{", "o", ".", "nullFields", "=", "append", "(", "o", ".", ...
// SetArgs sets the list of args to use with the application
[ "SetArgs", "sets", "the", "list", "of", "args", "to", "use", "with", "the", "application" ]
8cd52da677ef8425428ef610f0243863759639c8
https://github.com/spotinst/spotinst-sdk-go/blob/8cd52da677ef8425428ef610f0243863759639c8/service/mrscaler/mrscaler.go#L965-L970
136,730
aanand/compose-file
template/template.go
partition
func partition(s, sep string) (string, string) { if strings.Contains(s, sep) { parts := strings.SplitN(s, sep, 2) return parts[0], parts[1] } else { return s, "" } }
go
func partition(s, sep string) (string, string) { if strings.Contains(s, sep) { parts := strings.SplitN(s, sep, 2) return parts[0], parts[1] } else { return s, "" } }
[ "func", "partition", "(", "s", ",", "sep", "string", ")", "(", "string", ",", "string", ")", "{", "if", "strings", ".", "Contains", "(", "s", ",", "sep", ")", "{", "parts", ":=", "strings", ".", "SplitN", "(", "s", ",", "sep", ",", "2", ")", "\...
// Split the string at the first occurrence of sep, and return the part before the separator, // and the part after the separator. // // If the separator is not found, return the string itself, followed by an empty string.
[ "Split", "the", "string", "at", "the", "first", "occurrence", "of", "sep", "and", "return", "the", "part", "before", "the", "separator", "and", "the", "part", "after", "the", "separator", ".", "If", "the", "separator", "is", "not", "found", "return", "the"...
8b762b24ea40ea5ceda5aac2dd1cd465d0fe6d42
https://github.com/aanand/compose-file/blob/8b762b24ea40ea5ceda5aac2dd1cd465d0fe6d42/template/template.go#L101-L108
136,731
DavidHuie/gomigrate
utils.go
parseMigrationPath
func parseMigrationPath(path string) (uint64, migrationType, string, error) { filebase := filepath.Base(path) matches := upMigrationFile.FindAllSubmatch([]byte(filebase), -1) if matches != nil { return parseMatches(matches, upMigration) } matches = downMigrationFile.FindAllSubmatch([]byte(filebase), -1) if mat...
go
func parseMigrationPath(path string) (uint64, migrationType, string, error) { filebase := filepath.Base(path) matches := upMigrationFile.FindAllSubmatch([]byte(filebase), -1) if matches != nil { return parseMatches(matches, upMigration) } matches = downMigrationFile.FindAllSubmatch([]byte(filebase), -1) if mat...
[ "func", "parseMigrationPath", "(", "path", "string", ")", "(", "uint64", ",", "migrationType", ",", "string", ",", "error", ")", "{", "filebase", ":=", "filepath", ".", "Base", "(", "path", ")", "\n\n", "matches", ":=", "upMigrationFile", ".", "FindAllSubmat...
// Returns the migration number, type and base name, so 1, "up", "migration" from "01_migration_up.sql"
[ "Returns", "the", "migration", "number", "type", "and", "base", "name", "so", "1", "up", "migration", "from", "01_migration_up", ".", "sql" ]
4004e6142040f5d622e9d2be6e833a4652741571
https://github.com/DavidHuie/gomigrate/blob/4004e6142040f5d622e9d2be6e833a4652741571/utils.go#L17-L30
136,732
DavidHuie/gomigrate
utils.go
parseMatches
func parseMatches(matches [][][]byte, mType migrationType) (uint64, migrationType, string, error) { num := matches[0][1] name := matches[0][2] parsedNum, err := strconv.ParseUint(string(num), 10, 64) if err != nil { return 0, "", "", err } return parsedNum, mType, string(name), nil }
go
func parseMatches(matches [][][]byte, mType migrationType) (uint64, migrationType, string, error) { num := matches[0][1] name := matches[0][2] parsedNum, err := strconv.ParseUint(string(num), 10, 64) if err != nil { return 0, "", "", err } return parsedNum, mType, string(name), nil }
[ "func", "parseMatches", "(", "matches", "[", "]", "[", "]", "[", "]", "byte", ",", "mType", "migrationType", ")", "(", "uint64", ",", "migrationType", ",", "string", ",", "error", ")", "{", "num", ":=", "matches", "[", "0", "]", "[", "1", "]", "\n"...
// Parses matches given by a migration file regex.
[ "Parses", "matches", "given", "by", "a", "migration", "file", "regex", "." ]
4004e6142040f5d622e9d2be6e833a4652741571
https://github.com/DavidHuie/gomigrate/blob/4004e6142040f5d622e9d2be6e833a4652741571/utils.go#L33-L41
136,733
DavidHuie/gomigrate
migration.go
valid
func (m *Migration) valid() bool { if m.Id != 0 && m.Name != "" && m.UpPath != "" && m.DownPath != "" { return true } return false }
go
func (m *Migration) valid() bool { if m.Id != 0 && m.Name != "" && m.UpPath != "" && m.DownPath != "" { return true } return false }
[ "func", "(", "m", "*", "Migration", ")", "valid", "(", ")", "bool", "{", "if", "m", ".", "Id", "!=", "0", "&&", "m", ".", "Name", "!=", "\"", "\"", "&&", "m", ".", "UpPath", "!=", "\"", "\"", "&&", "m", ".", "DownPath", "!=", "\"", "\"", "{...
// Performs a basic validation of a migration.
[ "Performs", "a", "basic", "validation", "of", "a", "migration", "." ]
4004e6142040f5d622e9d2be6e833a4652741571
https://github.com/DavidHuie/gomigrate/blob/4004e6142040f5d622e9d2be6e833a4652741571/migration.go#L21-L26
136,734
DavidHuie/gomigrate
gomigrate.go
MigrationTableExists
func (m *Migrator) MigrationTableExists() (bool, error) { row := m.DB.QueryRow(m.dbAdapter.SelectMigrationTableSql(), migrationTableName) var tableName string err := row.Scan(&tableName) if err == sql.ErrNoRows { m.logger.Print("Migrations table not found") return false, nil } if err != nil { m.logger.Print...
go
func (m *Migrator) MigrationTableExists() (bool, error) { row := m.DB.QueryRow(m.dbAdapter.SelectMigrationTableSql(), migrationTableName) var tableName string err := row.Scan(&tableName) if err == sql.ErrNoRows { m.logger.Print("Migrations table not found") return false, nil } if err != nil { m.logger.Print...
[ "func", "(", "m", "*", "Migrator", ")", "MigrationTableExists", "(", ")", "(", "bool", ",", "error", ")", "{", "row", ":=", "m", ".", "DB", ".", "QueryRow", "(", "m", ".", "dbAdapter", ".", "SelectMigrationTableSql", "(", ")", ",", "migrationTableName", ...
// Returns true if the migration table already exists.
[ "Returns", "true", "if", "the", "migration", "table", "already", "exists", "." ]
4004e6142040f5d622e9d2be6e833a4652741571
https://github.com/DavidHuie/gomigrate/blob/4004e6142040f5d622e9d2be6e833a4652741571/gomigrate.go#L47-L61
136,735
DavidHuie/gomigrate
gomigrate.go
CreateMigrationsTable
func (m *Migrator) CreateMigrationsTable() error { _, err := m.DB.Exec(m.dbAdapter.CreateMigrationTableSql()) if err != nil { m.logger.Fatalf("Error creating migrations table: %v", err) } m.logger.Printf("Created migrations table: %s", migrationTableName) return nil }
go
func (m *Migrator) CreateMigrationsTable() error { _, err := m.DB.Exec(m.dbAdapter.CreateMigrationTableSql()) if err != nil { m.logger.Fatalf("Error creating migrations table: %v", err) } m.logger.Printf("Created migrations table: %s", migrationTableName) return nil }
[ "func", "(", "m", "*", "Migrator", ")", "CreateMigrationsTable", "(", ")", "error", "{", "_", ",", "err", ":=", "m", ".", "DB", ".", "Exec", "(", "m", ".", "dbAdapter", ".", "CreateMigrationTableSql", "(", ")", ")", "\n", "if", "err", "!=", "nil", ...
// Creates the migrations table if it doesn't exist.
[ "Creates", "the", "migrations", "table", "if", "it", "doesn", "t", "exist", "." ]
4004e6142040f5d622e9d2be6e833a4652741571
https://github.com/DavidHuie/gomigrate/blob/4004e6142040f5d622e9d2be6e833a4652741571/gomigrate.go#L64-L73
136,736
DavidHuie/gomigrate
gomigrate.go
NewMigrator
func NewMigrator(db *sql.DB, adapter Migratable, migrationsPath string) (*Migrator, error) { return NewMigratorWithLogger(db, adapter, migrationsPath, log.New(os.Stderr, "[gomigrate] ", log.LstdFlags)) }
go
func NewMigrator(db *sql.DB, adapter Migratable, migrationsPath string) (*Migrator, error) { return NewMigratorWithLogger(db, adapter, migrationsPath, log.New(os.Stderr, "[gomigrate] ", log.LstdFlags)) }
[ "func", "NewMigrator", "(", "db", "*", "sql", ".", "DB", ",", "adapter", "Migratable", ",", "migrationsPath", "string", ")", "(", "*", "Migrator", ",", "error", ")", "{", "return", "NewMigratorWithLogger", "(", "db", ",", "adapter", ",", "migrationsPath", ...
// Returns a new migrator.
[ "Returns", "a", "new", "migrator", "." ]
4004e6142040f5d622e9d2be6e833a4652741571
https://github.com/DavidHuie/gomigrate/blob/4004e6142040f5d622e9d2be6e833a4652741571/gomigrate.go#L76-L78
136,737
DavidHuie/gomigrate
gomigrate.go
NewMigratorWithLogger
func NewMigratorWithLogger(db *sql.DB, adapter Migratable, migrationsPath string, logger Logger) (*Migrator, error) { // Normalize the migrations path. path := []byte(migrationsPath) pathLength := len(path) if path[pathLength-1] != '/' { path = append(path, '/') } logger.Printf("Migrations path: %s", path) m...
go
func NewMigratorWithLogger(db *sql.DB, adapter Migratable, migrationsPath string, logger Logger) (*Migrator, error) { // Normalize the migrations path. path := []byte(migrationsPath) pathLength := len(path) if path[pathLength-1] != '/' { path = append(path, '/') } logger.Printf("Migrations path: %s", path) m...
[ "func", "NewMigratorWithLogger", "(", "db", "*", "sql", ".", "DB", ",", "adapter", "Migratable", ",", "migrationsPath", "string", ",", "logger", "Logger", ")", "(", "*", "Migrator", ",", "error", ")", "{", "// Normalize the migrations path.", "path", ":=", "["...
// Returns a new migrator with the specified logger.
[ "Returns", "a", "new", "migrator", "with", "the", "specified", "logger", "." ]
4004e6142040f5d622e9d2be6e833a4652741571
https://github.com/DavidHuie/gomigrate/blob/4004e6142040f5d622e9d2be6e833a4652741571/gomigrate.go#L81-L119
136,738
DavidHuie/gomigrate
gomigrate.go
fetchMigrations
func (m *Migrator) fetchMigrations() error { pathGlob := append([]byte(m.MigrationsPath), []byte("*")...) matches, err := filepath.Glob(string(pathGlob)) if err != nil { m.logger.Fatalf("Error while globbing migrations: %v", err) } for _, match := range matches { num, migrationType, name, err := parseMigrati...
go
func (m *Migrator) fetchMigrations() error { pathGlob := append([]byte(m.MigrationsPath), []byte("*")...) matches, err := filepath.Glob(string(pathGlob)) if err != nil { m.logger.Fatalf("Error while globbing migrations: %v", err) } for _, match := range matches { num, migrationType, name, err := parseMigrati...
[ "func", "(", "m", "*", "Migrator", ")", "fetchMigrations", "(", ")", "error", "{", "pathGlob", ":=", "append", "(", "[", "]", "byte", "(", "m", ".", "MigrationsPath", ")", ",", "[", "]", "byte", "(", "\"", "\"", ")", "...", ")", "\n\n", "matches", ...
// Populates a migrator with a sorted list of migrations from the file system.
[ "Populates", "a", "migrator", "with", "a", "sorted", "list", "of", "migrations", "from", "the", "file", "system", "." ]
4004e6142040f5d622e9d2be6e833a4652741571
https://github.com/DavidHuie/gomigrate/blob/4004e6142040f5d622e9d2be6e833a4652741571/gomigrate.go#L122-L166
136,739
DavidHuie/gomigrate
gomigrate.go
getMigrationStatuses
func (m *Migrator) getMigrationStatuses() error { for _, migration := range m.migrations { row := m.DB.QueryRow(m.dbAdapter.GetMigrationSql(), migration.Id) var mid uint64 err := row.Scan(&mid) if err == sql.ErrNoRows { continue } if err != nil { m.logger.Printf( "Error getting migration status f...
go
func (m *Migrator) getMigrationStatuses() error { for _, migration := range m.migrations { row := m.DB.QueryRow(m.dbAdapter.GetMigrationSql(), migration.Id) var mid uint64 err := row.Scan(&mid) if err == sql.ErrNoRows { continue } if err != nil { m.logger.Printf( "Error getting migration status f...
[ "func", "(", "m", "*", "Migrator", ")", "getMigrationStatuses", "(", ")", "error", "{", "for", "_", ",", "migration", ":=", "range", "m", ".", "migrations", "{", "row", ":=", "m", ".", "DB", ".", "QueryRow", "(", "m", ".", "dbAdapter", ".", "GetMigra...
// Queries the migration table to determine the status of each // migration.
[ "Queries", "the", "migration", "table", "to", "determine", "the", "status", "of", "each", "migration", "." ]
4004e6142040f5d622e9d2be6e833a4652741571
https://github.com/DavidHuie/gomigrate/blob/4004e6142040f5d622e9d2be6e833a4652741571/gomigrate.go#L170-L189
136,740
DavidHuie/gomigrate
gomigrate.go
Migrations
func (m *Migrator) Migrations(status int) []*Migration { // Sort all migration ids. ids := make([]uint64, 0) for id, _ := range m.migrations { ids = append(ids, id) } sort.Sort(uint64slice(ids)) // Find ids for the given status. migrations := make([]*Migration, 0) for _, id := range ids { migration := m.mi...
go
func (m *Migrator) Migrations(status int) []*Migration { // Sort all migration ids. ids := make([]uint64, 0) for id, _ := range m.migrations { ids = append(ids, id) } sort.Sort(uint64slice(ids)) // Find ids for the given status. migrations := make([]*Migration, 0) for _, id := range ids { migration := m.mi...
[ "func", "(", "m", "*", "Migrator", ")", "Migrations", "(", "status", "int", ")", "[", "]", "*", "Migration", "{", "// Sort all migration ids.", "ids", ":=", "make", "(", "[", "]", "uint64", ",", "0", ")", "\n", "for", "id", ",", "_", ":=", "range", ...
// Returns a sorted list of migration ids for a given status. -1 returns // all migrations.
[ "Returns", "a", "sorted", "list", "of", "migration", "ids", "for", "a", "given", "status", ".", "-", "1", "returns", "all", "migrations", "." ]
4004e6142040f5d622e9d2be6e833a4652741571
https://github.com/DavidHuie/gomigrate/blob/4004e6142040f5d622e9d2be6e833a4652741571/gomigrate.go#L193-L210
136,741
DavidHuie/gomigrate
gomigrate.go
ApplyMigration
func (m *Migrator) ApplyMigration(migration *Migration, mType migrationType) error { var path string if mType == upMigration { path = migration.UpPath } else if mType == downMigration { path = migration.DownPath } else { return InvalidMigrationType } m.logger.Printf("Applying migration: %s", path) sql, e...
go
func (m *Migrator) ApplyMigration(migration *Migration, mType migrationType) error { var path string if mType == upMigration { path = migration.UpPath } else if mType == downMigration { path = migration.DownPath } else { return InvalidMigrationType } m.logger.Printf("Applying migration: %s", path) sql, e...
[ "func", "(", "m", "*", "Migrator", ")", "ApplyMigration", "(", "migration", "*", "Migration", ",", "mType", "migrationType", ")", "error", "{", "var", "path", "string", "\n", "if", "mType", "==", "upMigration", "{", "path", "=", "migration", ".", "UpPath",...
// Applies a single migration.
[ "Applies", "a", "single", "migration", "." ]
4004e6142040f5d622e9d2be6e833a4652741571
https://github.com/DavidHuie/gomigrate/blob/4004e6142040f5d622e9d2be6e833a4652741571/gomigrate.go#L213-L297
136,742
DavidHuie/gomigrate
gomigrate.go
Migrate
func (m *Migrator) Migrate() error { for _, migration := range m.Migrations(Inactive) { if err := m.ApplyMigration(migration, upMigration); err != nil { return err } } return nil }
go
func (m *Migrator) Migrate() error { for _, migration := range m.Migrations(Inactive) { if err := m.ApplyMigration(migration, upMigration); err != nil { return err } } return nil }
[ "func", "(", "m", "*", "Migrator", ")", "Migrate", "(", ")", "error", "{", "for", "_", ",", "migration", ":=", "range", "m", ".", "Migrations", "(", "Inactive", ")", "{", "if", "err", ":=", "m", ".", "ApplyMigration", "(", "migration", ",", "upMigrat...
// Applies all inactive migrations.
[ "Applies", "all", "inactive", "migrations", "." ]
4004e6142040f5d622e9d2be6e833a4652741571
https://github.com/DavidHuie/gomigrate/blob/4004e6142040f5d622e9d2be6e833a4652741571/gomigrate.go#L300-L307
136,743
DavidHuie/gomigrate
gomigrate.go
RollbackN
func (m *Migrator) RollbackN(n int) error { migrations := m.Migrations(Active) if len(migrations) == 0 { return nil } last_migration := len(migrations) - 1 - n for i := len(migrations) - 1; i != last_migration; i-- { if err := m.ApplyMigration(migrations[i], downMigration); err != nil { return err } } ...
go
func (m *Migrator) RollbackN(n int) error { migrations := m.Migrations(Active) if len(migrations) == 0 { return nil } last_migration := len(migrations) - 1 - n for i := len(migrations) - 1; i != last_migration; i-- { if err := m.ApplyMigration(migrations[i], downMigration); err != nil { return err } } ...
[ "func", "(", "m", "*", "Migrator", ")", "RollbackN", "(", "n", "int", ")", "error", "{", "migrations", ":=", "m", ".", "Migrations", "(", "Active", ")", "\n", "if", "len", "(", "migrations", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", ...
// Rolls back N migrations.
[ "Rolls", "back", "N", "migrations", "." ]
4004e6142040f5d622e9d2be6e833a4652741571
https://github.com/DavidHuie/gomigrate/blob/4004e6142040f5d622e9d2be6e833a4652741571/gomigrate.go#L315-L330
136,744
DavidHuie/gomigrate
gomigrate.go
RollbackAll
func (m *Migrator) RollbackAll() error { migrations := m.Migrations(Active) return m.RollbackN(len(migrations)) }
go
func (m *Migrator) RollbackAll() error { migrations := m.Migrations(Active) return m.RollbackN(len(migrations)) }
[ "func", "(", "m", "*", "Migrator", ")", "RollbackAll", "(", ")", "error", "{", "migrations", ":=", "m", ".", "Migrations", "(", "Active", ")", "\n", "return", "m", ".", "RollbackN", "(", "len", "(", "migrations", ")", ")", "\n", "}" ]
// Rolls back all migrations.
[ "Rolls", "back", "all", "migrations", "." ]
4004e6142040f5d622e9d2be6e833a4652741571
https://github.com/DavidHuie/gomigrate/blob/4004e6142040f5d622e9d2be6e833a4652741571/gomigrate.go#L333-L336
136,745
crewjam/go-cloudformation
scraper/aws_schema.go
MarshalJSON
func (piType *PropertyItemType) MarshalJSON() ([]byte, error) { var value interface{} if len(piType.Scalar) != 0 { value = piType.Scalar } else { value = piType.MultiValues } return json.Marshal(value) }
go
func (piType *PropertyItemType) MarshalJSON() ([]byte, error) { var value interface{} if len(piType.Scalar) != 0 { value = piType.Scalar } else { value = piType.MultiValues } return json.Marshal(value) }
[ "func", "(", "piType", "*", "PropertyItemType", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "value", "interface", "{", "}", "\n", "if", "len", "(", "piType", ".", "Scalar", ")", "!=", "0", "{", "value", "=", ...
// MarshalJSON to handle whichever field is set
[ "MarshalJSON", "to", "handle", "whichever", "field", "is", "set" ]
38e5b663797c837aa76bea2dd4be52f3563be652
https://github.com/crewjam/go-cloudformation/blob/38e5b663797c837aa76bea2dd4be52f3563be652/scraper/aws_schema.go#L47-L55
136,746
crewjam/go-cloudformation
scraper/aws_schema.go
UnmarshalJSON
func (piType *PropertyItemType) UnmarshalJSON(data []byte) error { singleString := "" singleErr := json.Unmarshal(data, &singleString) if singleErr == nil { piType.Scalar = singleString return nil } var stringArray []string sliceErr := json.Unmarshal(data, &stringArray) if sliceErr == nil { piType.MultiVal...
go
func (piType *PropertyItemType) UnmarshalJSON(data []byte) error { singleString := "" singleErr := json.Unmarshal(data, &singleString) if singleErr == nil { piType.Scalar = singleString return nil } var stringArray []string sliceErr := json.Unmarshal(data, &stringArray) if sliceErr == nil { piType.MultiVal...
[ "func", "(", "piType", "*", "PropertyItemType", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "singleString", ":=", "\"", "\"", "\n", "singleErr", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "singleString", ")", "\n",...
// UnmarshalJSON does the custom unmarshalling
[ "UnmarshalJSON", "does", "the", "custom", "unmarshalling" ]
38e5b663797c837aa76bea2dd4be52f3563be652
https://github.com/crewjam/go-cloudformation/blob/38e5b663797c837aa76bea2dd4be52f3563be652/scraper/aws_schema.go#L58-L72
136,747
crewjam/go-cloudformation
examples/app_old.go
makeTemplateTheOldWay
func makeTemplateTheOldWay() *cf.Template { t := cf.NewTemplate() t.Description = "example production infrastructure" t.Parameters["DnsName"] = &cf.Parameter{ Description: "The top level DNS name for the infrastructure", Type: "String", Default: "preview.example.io", } t.AddResource("ServerLoadBa...
go
func makeTemplateTheOldWay() *cf.Template { t := cf.NewTemplate() t.Description = "example production infrastructure" t.Parameters["DnsName"] = &cf.Parameter{ Description: "The top level DNS name for the infrastructure", Type: "String", Default: "preview.example.io", } t.AddResource("ServerLoadBa...
[ "func", "makeTemplateTheOldWay", "(", ")", "*", "cf", ".", "Template", "{", "t", ":=", "cf", ".", "NewTemplate", "(", ")", "\n", "t", ".", "Description", "=", "\"", "\"", "\n", "t", ".", "Parameters", "[", "\"", "\"", "]", "=", "&", "cf", ".", "P...
// makeTemplateTheOldWay is an implementation of makeTemplate that uses the // older pre-Stringable syntax. If this file builds, then maybe we haven't broken // backcompat.
[ "makeTemplateTheOldWay", "is", "an", "implementation", "of", "makeTemplate", "that", "uses", "the", "older", "pre", "-", "Stringable", "syntax", ".", "If", "this", "file", "builds", "then", "maybe", "we", "haven", "t", "broken", "backcompat", "." ]
38e5b663797c837aa76bea2dd4be52f3563be652
https://github.com/crewjam/go-cloudformation/blob/38e5b663797c837aa76bea2dd4be52f3563be652/examples/app_old.go#L9-L66
136,748
crewjam/go-cloudformation
func_findinmap.go
FindInMap
func FindInMap(mapName string, topLevelKey Stringable, secondLevelKey Stringable) *StringExpr { return FindInMapFunc{ MapName: mapName, TopLevelKey: *topLevelKey.String(), SecondLevelKey: *secondLevelKey.String(), }.String() }
go
func FindInMap(mapName string, topLevelKey Stringable, secondLevelKey Stringable) *StringExpr { return FindInMapFunc{ MapName: mapName, TopLevelKey: *topLevelKey.String(), SecondLevelKey: *secondLevelKey.String(), }.String() }
[ "func", "FindInMap", "(", "mapName", "string", ",", "topLevelKey", "Stringable", ",", "secondLevelKey", "Stringable", ")", "*", "StringExpr", "{", "return", "FindInMapFunc", "{", "MapName", ":", "mapName", ",", "TopLevelKey", ":", "*", "topLevelKey", ".", "Strin...
// FindInMap returns a new instance of FindInMapFunc.
[ "FindInMap", "returns", "a", "new", "instance", "of", "FindInMapFunc", "." ]
38e5b663797c837aa76bea2dd4be52f3563be652
https://github.com/crewjam/go-cloudformation/blob/38e5b663797c837aa76bea2dd4be52f3563be652/func_findinmap.go#L6-L12
136,749
crewjam/go-cloudformation
func.go
unmarshalFunc
func unmarshalFunc(data []byte) (Func, error) { rawDecode := map[string]json.RawMessage{} err := json.Unmarshal(data, &rawDecode) if err != nil { return nil, err } for key := range rawDecode { switch key { case "Ref": f := RefFunc{} if err := json.Unmarshal(data, &f); err == nil { return f, nil ...
go
func unmarshalFunc(data []byte) (Func, error) { rawDecode := map[string]json.RawMessage{} err := json.Unmarshal(data, &rawDecode) if err != nil { return nil, err } for key := range rawDecode { switch key { case "Ref": f := RefFunc{} if err := json.Unmarshal(data, &f); err == nil { return f, nil ...
[ "func", "unmarshalFunc", "(", "data", "[", "]", "byte", ")", "(", "Func", ",", "error", ")", "{", "rawDecode", ":=", "map", "[", "string", "]", "json", ".", "RawMessage", "{", "}", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&",...
// unmarshalFunc unmarshals data into a Func, or returns an error // if the function call is invalid.
[ "unmarshalFunc", "unmarshals", "data", "into", "a", "Func", "or", "returns", "an", "error", "if", "the", "function", "call", "is", "invalid", "." ]
38e5b663797c837aa76bea2dd4be52f3563be652
https://github.com/crewjam/go-cloudformation/blob/38e5b663797c837aa76bea2dd4be52f3563be652/func.go#L54-L112
136,750
crewjam/go-cloudformation
func_getatt.go
GetAtt
func GetAtt(resource, name string) *StringExpr { return GetAttFunc{Resource: resource, Name: name}.String() }
go
func GetAtt(resource, name string) *StringExpr { return GetAttFunc{Resource: resource, Name: name}.String() }
[ "func", "GetAtt", "(", "resource", ",", "name", "string", ")", "*", "StringExpr", "{", "return", "GetAttFunc", "{", "Resource", ":", "resource", ",", "Name", ":", "name", "}", ".", "String", "(", ")", "\n", "}" ]
// GetAtt returns a new instance of GetAttFunc.
[ "GetAtt", "returns", "a", "new", "instance", "of", "GetAttFunc", "." ]
38e5b663797c837aa76bea2dd4be52f3563be652
https://github.com/crewjam/go-cloudformation/blob/38e5b663797c837aa76bea2dd4be52f3563be652/func_getatt.go#L6-L8
136,751
crewjam/go-cloudformation
func_join.go
Join
func Join(separator string, items ...Stringable) *StringExpr { return JoinFunc{Separator: separator, Items: *StringList(items...)}.String() }
go
func Join(separator string, items ...Stringable) *StringExpr { return JoinFunc{Separator: separator, Items: *StringList(items...)}.String() }
[ "func", "Join", "(", "separator", "string", ",", "items", "...", "Stringable", ")", "*", "StringExpr", "{", "return", "JoinFunc", "{", "Separator", ":", "separator", ",", "Items", ":", "*", "StringList", "(", "items", "...", ")", "}", ".", "String", "(",...
// Join returns a new instance of JoinFunc that joins items with separator.
[ "Join", "returns", "a", "new", "instance", "of", "JoinFunc", "that", "joins", "items", "with", "separator", "." ]
38e5b663797c837aa76bea2dd4be52f3563be652
https://github.com/crewjam/go-cloudformation/blob/38e5b663797c837aa76bea2dd4be52f3563be652/func_join.go#L6-L8
136,752
crewjam/go-cloudformation
deploycfn/watcher.go
NewStackEventWatcher
func NewStackEventWatcher(session client.ConfigProvider, stackName string) (*StackEventWatcher, error) { sw := StackEventWatcher{ Service: cloudformation.New(session), StackName: stackName, seenEvents: map[string]struct{}{}, } err := sw.Service.DescribeStackEventsPages(&cloudformation.DescribeStackEventsI...
go
func NewStackEventWatcher(session client.ConfigProvider, stackName string) (*StackEventWatcher, error) { sw := StackEventWatcher{ Service: cloudformation.New(session), StackName: stackName, seenEvents: map[string]struct{}{}, } err := sw.Service.DescribeStackEventsPages(&cloudformation.DescribeStackEventsI...
[ "func", "NewStackEventWatcher", "(", "session", "client", ".", "ConfigProvider", ",", "stackName", "string", ")", "(", "*", "StackEventWatcher", ",", "error", ")", "{", "sw", ":=", "StackEventWatcher", "{", "Service", ":", "cloudformation", ".", "New", "(", "s...
// NewStackEventWatcher returns a new StackEventWatcher that emits events for the // specified stack. It scans all the existing events and adds them to seenEvents // so that events the occur prior to the invocation of this function will not be // printed.
[ "NewStackEventWatcher", "returns", "a", "new", "StackEventWatcher", "that", "emits", "events", "for", "the", "specified", "stack", ".", "It", "scans", "all", "the", "existing", "events", "and", "adds", "them", "to", "seenEvents", "so", "that", "events", "the", ...
38e5b663797c837aa76bea2dd4be52f3563be652
https://github.com/crewjam/go-cloudformation/blob/38e5b663797c837aa76bea2dd4be52f3563be652/deploycfn/watcher.go#L30-L49
136,753
crewjam/go-cloudformation
deploycfn/watcher.go
Watch
func (sw *StackEventWatcher) Watch() error { if sw.seenEvents == nil { sw.seenEvents = map[string]struct{}{} } lastStackStatus := "" for { // print the events for the stack sw.Service.DescribeStackEventsPages(&cloudformation.DescribeStackEventsInput{ StackName: aws.String(sw.StackName), }, func(p *cloudf...
go
func (sw *StackEventWatcher) Watch() error { if sw.seenEvents == nil { sw.seenEvents = map[string]struct{}{} } lastStackStatus := "" for { // print the events for the stack sw.Service.DescribeStackEventsPages(&cloudformation.DescribeStackEventsInput{ StackName: aws.String(sw.StackName), }, func(p *cloudf...
[ "func", "(", "sw", "*", "StackEventWatcher", ")", "Watch", "(", ")", "error", "{", "if", "sw", ".", "seenEvents", "==", "nil", "{", "sw", ".", "seenEvents", "=", "map", "[", "string", "]", "struct", "{", "}", "{", "}", "\n", "}", "\n", "lastStackSt...
// Watch monitors the stack for events, reporting each unseen event to the // log channel. Returns when the stack enters a non-transitional state. The // return value is non-nil if the final state is an error state.
[ "Watch", "monitors", "the", "stack", "for", "events", "reporting", "each", "unseen", "event", "to", "the", "log", "channel", ".", "Returns", "when", "the", "stack", "enters", "a", "non", "-", "transitional", "state", ".", "The", "return", "value", "is", "n...
38e5b663797c837aa76bea2dd4be52f3563be652
https://github.com/crewjam/go-cloudformation/blob/38e5b663797c837aa76bea2dd4be52f3563be652/deploycfn/watcher.go#L54-L135
136,754
crewjam/go-cloudformation
func_select.go
Select
func Select(selector string, items ...interface{}) *StringExpr { if len(items) == 1 { if itemList, ok := items[0].(StringListable); ok { return SelectFunc{Selector: selector, Items: *itemList.StringList()}.String() } } stringableItems := make([]Stringable, len(items)) for i, item := range items { stringabl...
go
func Select(selector string, items ...interface{}) *StringExpr { if len(items) == 1 { if itemList, ok := items[0].(StringListable); ok { return SelectFunc{Selector: selector, Items: *itemList.StringList()}.String() } } stringableItems := make([]Stringable, len(items)) for i, item := range items { stringabl...
[ "func", "Select", "(", "selector", "string", ",", "items", "...", "interface", "{", "}", ")", "*", "StringExpr", "{", "if", "len", "(", "items", ")", "==", "1", "{", "if", "itemList", ",", "ok", ":=", "items", "[", "0", "]", ".", "(", "StringListab...
// Select returns a new instance of SelectFunc chooses among items via selector. If you
[ "Select", "returns", "a", "new", "instance", "of", "SelectFunc", "chooses", "among", "items", "via", "selector", ".", "If", "you" ]
38e5b663797c837aa76bea2dd4be52f3563be652
https://github.com/crewjam/go-cloudformation/blob/38e5b663797c837aa76bea2dd4be52f3563be652/func_select.go#L11-L22
136,755
crewjam/go-cloudformation
template.go
NewTemplate
func NewTemplate() *Template { return &Template{ AWSTemplateFormatVersion: "2010-09-09", Mappings: map[string]*Mapping{}, Parameters: map[string]*Parameter{}, Resources: map[string]*Resource{}, Outputs: map[string]*Output{}, Conditions: ...
go
func NewTemplate() *Template { return &Template{ AWSTemplateFormatVersion: "2010-09-09", Mappings: map[string]*Mapping{}, Parameters: map[string]*Parameter{}, Resources: map[string]*Resource{}, Outputs: map[string]*Output{}, Conditions: ...
[ "func", "NewTemplate", "(", ")", "*", "Template", "{", "return", "&", "Template", "{", "AWSTemplateFormatVersion", ":", "\"", "\"", ",", "Mappings", ":", "map", "[", "string", "]", "*", "Mapping", "{", "}", ",", "Parameters", ":", "map", "[", "string", ...
// NewTemplate returns a new empty Template initialized with some // default values.
[ "NewTemplate", "returns", "a", "new", "empty", "Template", "initialized", "with", "some", "default", "values", "." ]
38e5b663797c837aa76bea2dd4be52f3563be652
https://github.com/crewjam/go-cloudformation/blob/38e5b663797c837aa76bea2dd4be52f3563be652/template.go#L10-L19
136,756
crewjam/go-cloudformation
template.go
AddResource
func (t *Template) AddResource(name string, resource ResourceProperties) *Resource { templateResource := &Resource{Properties: resource} t.Resources[name] = templateResource return templateResource }
go
func (t *Template) AddResource(name string, resource ResourceProperties) *Resource { templateResource := &Resource{Properties: resource} t.Resources[name] = templateResource return templateResource }
[ "func", "(", "t", "*", "Template", ")", "AddResource", "(", "name", "string", ",", "resource", "ResourceProperties", ")", "*", "Resource", "{", "templateResource", ":=", "&", "Resource", "{", "Properties", ":", "resource", "}", "\n", "t", ".", "Resources", ...
// AddResource adds the resource to the template as name, displacing // any resource with the same name that already exists.
[ "AddResource", "adds", "the", "resource", "to", "the", "template", "as", "name", "displacing", "any", "resource", "with", "the", "same", "name", "that", "already", "exists", "." ]
38e5b663797c837aa76bea2dd4be52f3563be652
https://github.com/crewjam/go-cloudformation/blob/38e5b663797c837aa76bea2dd4be52f3563be652/template.go#L34-L38
136,757
crewjam/go-cloudformation
iam_policy.go
ToJSON
func (i IAMPolicyDocument) ToJSON() string { buf, err := json.Marshal(i) if err != nil { panic(err) } return string(buf) }
go
func (i IAMPolicyDocument) ToJSON() string { buf, err := json.Marshal(i) if err != nil { panic(err) } return string(buf) }
[ "func", "(", "i", "IAMPolicyDocument", ")", "ToJSON", "(", ")", "string", "{", "buf", ",", "err", ":=", "json", ".", "Marshal", "(", "i", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "string", "("...
// ToJSON returns the JSON representation of the policy document or // panics if the object cannot be marshaled.
[ "ToJSON", "returns", "the", "JSON", "representation", "of", "the", "policy", "document", "or", "panics", "if", "the", "object", "cannot", "be", "marshaled", "." ]
38e5b663797c837aa76bea2dd4be52f3563be652
https://github.com/crewjam/go-cloudformation/blob/38e5b663797c837aa76bea2dd4be52f3563be652/iam_policy.go#L23-L29
136,758
crewjam/go-cloudformation
iam_policy.go
UnmarshalJSON
func (i *IAMPolicyDocument) UnmarshalJSON(data []byte) error { // Handle single statement policy documents var v iamPolicyDocumentSingleStatement err := json.Unmarshal(data, &v) if err == nil { i.Version = v.Version i.Statement = []IAMPolicyStatement{v.Statement} return nil } // Handle multiple statements ...
go
func (i *IAMPolicyDocument) UnmarshalJSON(data []byte) error { // Handle single statement policy documents var v iamPolicyDocumentSingleStatement err := json.Unmarshal(data, &v) if err == nil { i.Version = v.Version i.Statement = []IAMPolicyStatement{v.Statement} return nil } // Handle multiple statements ...
[ "func", "(", "i", "*", "IAMPolicyDocument", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "// Handle single statement policy documents", "var", "v", "iamPolicyDocumentSingleStatement", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "da...
// UnmarshalJSON sets the object from the provided JSON representation. This has // been added to handle the special case of a single statement versus an array.
[ "UnmarshalJSON", "sets", "the", "object", "from", "the", "provided", "JSON", "representation", ".", "This", "has", "been", "added", "to", "handle", "the", "special", "case", "of", "a", "single", "statement", "versus", "an", "array", "." ]
38e5b663797c837aa76bea2dd4be52f3563be652
https://github.com/crewjam/go-cloudformation/blob/38e5b663797c837aa76bea2dd4be52f3563be652/iam_policy.go#L33-L54
136,759
mailgun/ttlmap
ttlmap.go
Clock
func Clock(c timetools.TimeProvider) TtlMapOption { return func(m *TtlMap) error { m.clock = c return nil } }
go
func Clock(c timetools.TimeProvider) TtlMapOption { return func(m *TtlMap) error { m.clock = c return nil } }
[ "func", "Clock", "(", "c", "timetools", ".", "TimeProvider", ")", "TtlMapOption", "{", "return", "func", "(", "m", "*", "TtlMap", ")", "error", "{", "m", ".", "clock", "=", "c", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// Clock sets the time provider clock, handy for testing
[ "Clock", "sets", "the", "time", "provider", "clock", "handy", "for", "testing" ]
c1c17f74874f2a5ea48bfb06b5459d4ef2689749
https://github.com/mailgun/ttlmap/blob/c1c17f74874f2a5ea48bfb06b5459d4ef2689749/ttlmap.go#L16-L21
136,760
mailgun/ttlmap
ttlmap.go
CallOnExpire
func CallOnExpire(cb Callback) TtlMapOption { return func(m *TtlMap) error { m.onExpire = cb return nil } }
go
func CallOnExpire(cb Callback) TtlMapOption { return func(m *TtlMap) error { m.onExpire = cb return nil } }
[ "func", "CallOnExpire", "(", "cb", "Callback", ")", "TtlMapOption", "{", "return", "func", "(", "m", "*", "TtlMap", ")", "error", "{", "m", ".", "onExpire", "=", "cb", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// CallOnExpire will call this callback on expiration of elements
[ "CallOnExpire", "will", "call", "this", "callback", "on", "expiration", "of", "elements" ]
c1c17f74874f2a5ea48bfb06b5459d4ef2689749
https://github.com/mailgun/ttlmap/blob/c1c17f74874f2a5ea48bfb06b5459d4ef2689749/ttlmap.go#L26-L31
136,761
yosssi/gohtml
writer.go
SetLastElement
func (wr *Writer) SetLastElement(lastElement string) *Writer { wr.lastElement = lastElement return wr }
go
func (wr *Writer) SetLastElement(lastElement string) *Writer { wr.lastElement = lastElement return wr }
[ "func", "(", "wr", "*", "Writer", ")", "SetLastElement", "(", "lastElement", "string", ")", "*", "Writer", "{", "wr", ".", "lastElement", "=", "lastElement", "\n", "return", "wr", "\n", "}" ]
// SetLastElement set the lastElement to the Writer.
[ "SetLastElement", "set", "the", "lastElement", "to", "the", "Writer", "." ]
9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8
https://github.com/yosssi/gohtml/blob/9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8/writer.go#L16-L19
136,762
yosssi/gohtml
writer.go
Write
func (wr *Writer) Write(p []byte) (n int, err error) { wr.bf.Write(p) if bytes.HasSuffix(p, []byte(wr.lastElement)) { return wr.writer.Write([]byte(Format(wr.bf.String()) + "\n")) } return 0, nil }
go
func (wr *Writer) Write(p []byte) (n int, err error) { wr.bf.Write(p) if bytes.HasSuffix(p, []byte(wr.lastElement)) { return wr.writer.Write([]byte(Format(wr.bf.String()) + "\n")) } return 0, nil }
[ "func", "(", "wr", "*", "Writer", ")", "Write", "(", "p", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "wr", ".", "bf", ".", "Write", "(", "p", ")", "\n", "if", "bytes", ".", "HasSuffix", "(", "p", ",", "[", "]", ...
// Write writes the parameter.
[ "Write", "writes", "the", "parameter", "." ]
9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8
https://github.com/yosssi/gohtml/blob/9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8/writer.go#L22-L28
136,763
yosssi/gohtml
writer.go
NewWriter
func NewWriter(wr io.Writer) *Writer { return &Writer{writer: wr, lastElement: defaultLastElement, bf: &bytes.Buffer{}} }
go
func NewWriter(wr io.Writer) *Writer { return &Writer{writer: wr, lastElement: defaultLastElement, bf: &bytes.Buffer{}} }
[ "func", "NewWriter", "(", "wr", "io", ".", "Writer", ")", "*", "Writer", "{", "return", "&", "Writer", "{", "writer", ":", "wr", ",", "lastElement", ":", "defaultLastElement", ",", "bf", ":", "&", "bytes", ".", "Buffer", "{", "}", "}", "\n", "}" ]
// NewWriter generates a Writer and returns it.
[ "NewWriter", "generates", "a", "Writer", "and", "returns", "it", "." ]
9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8
https://github.com/yosssi/gohtml/blob/9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8/writer.go#L31-L33
136,764
yosssi/gohtml
utils.go
writeLine
func writeLine(bf *bytes.Buffer, indent int, strs ...string) { writeLineFeed(bf) writeIndent(bf, indent) for _, s := range strs { bf.WriteString(s) } }
go
func writeLine(bf *bytes.Buffer, indent int, strs ...string) { writeLineFeed(bf) writeIndent(bf, indent) for _, s := range strs { bf.WriteString(s) } }
[ "func", "writeLine", "(", "bf", "*", "bytes", ".", "Buffer", ",", "indent", "int", ",", "strs", "...", "string", ")", "{", "writeLineFeed", "(", "bf", ")", "\n", "writeIndent", "(", "bf", ",", "indent", ")", "\n", "for", "_", ",", "s", ":=", "range...
// writeLine writes an HTML line to the buffer.
[ "writeLine", "writes", "an", "HTML", "line", "to", "the", "buffer", "." ]
9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8
https://github.com/yosssi/gohtml/blob/9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8/utils.go#L9-L15
136,765
yosssi/gohtml
utils.go
writeIndent
func writeIndent(bf *bytes.Buffer, indent int) { bf.WriteString(strings.Repeat(defaultIndentString, indent)) }
go
func writeIndent(bf *bytes.Buffer, indent int) { bf.WriteString(strings.Repeat(defaultIndentString, indent)) }
[ "func", "writeIndent", "(", "bf", "*", "bytes", ".", "Buffer", ",", "indent", "int", ")", "{", "bf", ".", "WriteString", "(", "strings", ".", "Repeat", "(", "defaultIndentString", ",", "indent", ")", ")", "\n", "}" ]
// writeIndent writes indents to the buffer.
[ "writeIndent", "writes", "indents", "to", "the", "buffer", "." ]
9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8
https://github.com/yosssi/gohtml/blob/9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8/utils.go#L25-L27
136,766
yosssi/gohtml
tag_element.go
write
func (e *tagElement) write(bf *bytes.Buffer, indent int) { if Condense { l := len(e.children) if l == 0 { writeLine(bf, indent, e.startTagRaw, e.endTagRaw) return } else if l == 1 && e.endTagRaw != "" { if c, ok := e.children[0].(*textElement); ok { writeLine(bf, indent, e.startTagRaw, c.text, e.end...
go
func (e *tagElement) write(bf *bytes.Buffer, indent int) { if Condense { l := len(e.children) if l == 0 { writeLine(bf, indent, e.startTagRaw, e.endTagRaw) return } else if l == 1 && e.endTagRaw != "" { if c, ok := e.children[0].(*textElement); ok { writeLine(bf, indent, e.startTagRaw, c.text, e.end...
[ "func", "(", "e", "*", "tagElement", ")", "write", "(", "bf", "*", "bytes", ".", "Buffer", ",", "indent", "int", ")", "{", "if", "Condense", "{", "l", ":=", "len", "(", "e", ".", "children", ")", "\n", "if", "l", "==", "0", "{", "writeLine", "(...
// write writes a tag to the buffer.
[ "write", "writes", "a", "tag", "to", "the", "buffer", "." ]
9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8
https://github.com/yosssi/gohtml/blob/9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8/tag_element.go#L17-L44
136,767
yosssi/gohtml
tag_element.go
appendChild
func (e *tagElement) appendChild(child element) { e.children = append(e.children, child) }
go
func (e *tagElement) appendChild(child element) { e.children = append(e.children, child) }
[ "func", "(", "e", "*", "tagElement", ")", "appendChild", "(", "child", "element", ")", "{", "e", ".", "children", "=", "append", "(", "e", ".", "children", ",", "child", ")", "\n", "}" ]
// appendChild append an element to the element's children.
[ "appendChild", "append", "an", "element", "to", "the", "element", "s", "children", "." ]
9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8
https://github.com/yosssi/gohtml/blob/9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8/tag_element.go#L47-L49
136,768
yosssi/gohtml
text_element.go
write
func (e *textElement) write(bf *bytes.Buffer, indent int) { lines := strings.Split(strings.Trim(unifyLineFeed(e.text), "\n"), "\n") for _, line := range lines { writeLineFeed(bf) writeIndent(bf, indent) bf.WriteString(line) } }
go
func (e *textElement) write(bf *bytes.Buffer, indent int) { lines := strings.Split(strings.Trim(unifyLineFeed(e.text), "\n"), "\n") for _, line := range lines { writeLineFeed(bf) writeIndent(bf, indent) bf.WriteString(line) } }
[ "func", "(", "e", "*", "textElement", ")", "write", "(", "bf", "*", "bytes", ".", "Buffer", ",", "indent", "int", ")", "{", "lines", ":=", "strings", ".", "Split", "(", "strings", ".", "Trim", "(", "unifyLineFeed", "(", "e", ".", "text", ")", ",", ...
// write writes a text to the buffer.
[ "write", "writes", "a", "text", "to", "the", "buffer", "." ]
9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8
https://github.com/yosssi/gohtml/blob/9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8/text_element.go#L14-L21
136,769
yosssi/gohtml
parser.go
parse
func parse(r io.Reader) *htmlDocument { htmlDoc := &htmlDocument{} tokenizer := html.NewTokenizer(r) for { if errorToken, _, _ := parseToken(tokenizer, htmlDoc, nil); errorToken { break } } return htmlDoc }
go
func parse(r io.Reader) *htmlDocument { htmlDoc := &htmlDocument{} tokenizer := html.NewTokenizer(r) for { if errorToken, _, _ := parseToken(tokenizer, htmlDoc, nil); errorToken { break } } return htmlDoc }
[ "func", "parse", "(", "r", "io", ".", "Reader", ")", "*", "htmlDocument", "{", "htmlDoc", ":=", "&", "htmlDocument", "{", "}", "\n", "tokenizer", ":=", "html", ".", "NewTokenizer", "(", "r", ")", "\n", "for", "{", "if", "errorToken", ",", "_", ",", ...
// parse parses a stirng and converts it into an html.
[ "parse", "parses", "a", "stirng", "and", "converts", "it", "into", "an", "html", "." ]
9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8
https://github.com/yosssi/gohtml/blob/9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8/parser.go#L10-L19
136,770
yosssi/gohtml
parser.go
appendElement
func appendElement(htmlDoc *htmlDocument, parent *tagElement, e element) { if parent != nil { parent.appendChild(e) } else { htmlDoc.append(e) } }
go
func appendElement(htmlDoc *htmlDocument, parent *tagElement, e element) { if parent != nil { parent.appendChild(e) } else { htmlDoc.append(e) } }
[ "func", "appendElement", "(", "htmlDoc", "*", "htmlDocument", ",", "parent", "*", "tagElement", ",", "e", "element", ")", "{", "if", "parent", "!=", "nil", "{", "parent", ".", "appendChild", "(", "e", ")", "\n", "}", "else", "{", "htmlDoc", ".", "appen...
// appendElement appends the element to the htmlDocument or parent tagElement.
[ "appendElement", "appends", "the", "element", "to", "the", "htmlDocument", "or", "parent", "tagElement", "." ]
9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8
https://github.com/yosssi/gohtml/blob/9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8/parser.go#L61-L67
136,771
yosssi/gohtml
parser.go
getTagName
func getTagName(tokenizer *html.Tokenizer) string { tagName, _ := tokenizer.TagName() return string(tagName) }
go
func getTagName(tokenizer *html.Tokenizer) string { tagName, _ := tokenizer.TagName() return string(tagName) }
[ "func", "getTagName", "(", "tokenizer", "*", "html", ".", "Tokenizer", ")", "string", "{", "tagName", ",", "_", ":=", "tokenizer", ".", "TagName", "(", ")", "\n", "return", "string", "(", "tagName", ")", "\n", "}" ]
// getTagName gets a tagName from tokenizer.
[ "getTagName", "gets", "a", "tagName", "from", "tokenizer", "." ]
9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8
https://github.com/yosssi/gohtml/blob/9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8/parser.go#L70-L73
136,772
yosssi/gohtml
parser.go
setEndTagRaw
func setEndTagRaw(tokenizer *html.Tokenizer, parent *tagElement, tagName string) string { if parent != nil && parent.tagName == tagName { parent.endTagRaw = string(tokenizer.Raw()) return "" } return tagName }
go
func setEndTagRaw(tokenizer *html.Tokenizer, parent *tagElement, tagName string) string { if parent != nil && parent.tagName == tagName { parent.endTagRaw = string(tokenizer.Raw()) return "" } return tagName }
[ "func", "setEndTagRaw", "(", "tokenizer", "*", "html", ".", "Tokenizer", ",", "parent", "*", "tagElement", ",", "tagName", "string", ")", "string", "{", "if", "parent", "!=", "nil", "&&", "parent", ".", "tagName", "==", "tagName", "{", "parent", ".", "en...
// setEndTagRaw sets an endTagRaw to the parent.
[ "setEndTagRaw", "sets", "an", "endTagRaw", "to", "the", "parent", "." ]
9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8
https://github.com/yosssi/gohtml/blob/9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8/parser.go#L76-L82
136,773
yosssi/gohtml
html_document.go
bytes
func (htmlDoc *htmlDocument) bytes() []byte { bf := &bytes.Buffer{} for _, e := range htmlDoc.elements { e.write(bf, startIndent) } return bf.Bytes() }
go
func (htmlDoc *htmlDocument) bytes() []byte { bf := &bytes.Buffer{} for _, e := range htmlDoc.elements { e.write(bf, startIndent) } return bf.Bytes() }
[ "func", "(", "htmlDoc", "*", "htmlDocument", ")", "bytes", "(", ")", "[", "]", "byte", "{", "bf", ":=", "&", "bytes", ".", "Buffer", "{", "}", "\n", "for", "_", ",", "e", ":=", "range", "htmlDoc", ".", "elements", "{", "e", ".", "write", "(", "...
// bytes reads from htmlDocument's internal array of elements and returns HTML source code
[ "bytes", "reads", "from", "htmlDocument", "s", "internal", "array", "of", "elements", "and", "returns", "HTML", "source", "code" ]
9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8
https://github.com/yosssi/gohtml/blob/9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8/html_document.go#L16-L22
136,774
yosssi/gohtml
html_document.go
append
func (htmlDoc *htmlDocument) append(e element) { htmlDoc.elements = append(htmlDoc.elements, e) }
go
func (htmlDoc *htmlDocument) append(e element) { htmlDoc.elements = append(htmlDoc.elements, e) }
[ "func", "(", "htmlDoc", "*", "htmlDocument", ")", "append", "(", "e", "element", ")", "{", "htmlDoc", ".", "elements", "=", "append", "(", "htmlDoc", ".", "elements", ",", "e", ")", "\n", "}" ]
// append appends an element to the htmlDocument.
[ "append", "appends", "an", "element", "to", "the", "htmlDocument", "." ]
9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8
https://github.com/yosssi/gohtml/blob/9b7db94d32d9901e7ad2488fddf91f7b9fcc36c8/html_document.go#L25-L27
136,775
posener/wstest
dialer.go
runServer
func (r *recorder) runServer(h http.Handler) { // read from the recorder connection the request sent by the recorder.Dial, // and use the handler to serve this request. req, err := http.ReadRequest(bufio.NewReader(r.server)) if err != nil { return } h.ServeHTTP(r, req) }
go
func (r *recorder) runServer(h http.Handler) { // read from the recorder connection the request sent by the recorder.Dial, // and use the handler to serve this request. req, err := http.ReadRequest(bufio.NewReader(r.server)) if err != nil { return } h.ServeHTTP(r, req) }
[ "func", "(", "r", "*", "recorder", ")", "runServer", "(", "h", "http", ".", "Handler", ")", "{", "// read from the recorder connection the request sent by the recorder.Dial,", "// and use the handler to serve this request.", "req", ",", "err", ":=", "http", ".", "ReadRequ...
// runServer reads the request sent on the connection to the recorder // from the websocket.NewDialer.Dial function, and pass it to the recorder. // once this is done, the communication is done on the wsConn
[ "runServer", "reads", "the", "request", "sent", "on", "the", "connection", "to", "the", "recorder", "from", "the", "websocket", ".", "NewDialer", ".", "Dial", "function", "and", "pass", "it", "to", "the", "recorder", ".", "once", "this", "is", "done", "the...
28272a7ea048139a5b9c30c1cfb591fbd0481686
https://github.com/posener/wstest/blob/28272a7ea048139a5b9c30c1cfb591fbd0481686/dialer.go#L47-L55
136,776
posener/wstest
dialer.go
Hijack
func (r *recorder) Hijack() (net.Conn, *bufio.ReadWriter, error) { // return to the recorder the recorder, which is the recorder side of the connection rw := bufio.NewReadWriter(bufio.NewReader(r.server), bufio.NewWriter(r.server)) return r.server, rw, nil }
go
func (r *recorder) Hijack() (net.Conn, *bufio.ReadWriter, error) { // return to the recorder the recorder, which is the recorder side of the connection rw := bufio.NewReadWriter(bufio.NewReader(r.server), bufio.NewWriter(r.server)) return r.server, rw, nil }
[ "func", "(", "r", "*", "recorder", ")", "Hijack", "(", ")", "(", "net", ".", "Conn", ",", "*", "bufio", ".", "ReadWriter", ",", "error", ")", "{", "// return to the recorder the recorder, which is the recorder side of the connection", "rw", ":=", "bufio", ".", "...
// Hijack the connection
[ "Hijack", "the", "connection" ]
28272a7ea048139a5b9c30c1cfb591fbd0481686
https://github.com/posener/wstest/blob/28272a7ea048139a5b9c30c1cfb591fbd0481686/dialer.go#L58-L62
136,777
posener/wstest
dialer.go
WriteHeader
func (r *recorder) WriteHeader(code int) { resp := http.Response{StatusCode: code, Header: r.Header()} resp.Write(r.server) }
go
func (r *recorder) WriteHeader(code int) { resp := http.Response{StatusCode: code, Header: r.Header()} resp.Write(r.server) }
[ "func", "(", "r", "*", "recorder", ")", "WriteHeader", "(", "code", "int", ")", "{", "resp", ":=", "http", ".", "Response", "{", "StatusCode", ":", "code", ",", "Header", ":", "r", ".", "Header", "(", ")", "}", "\n", "resp", ".", "Write", "(", "r...
// WriteHeader write HTTP header to the client and closes the connection
[ "WriteHeader", "write", "HTTP", "header", "to", "the", "client", "and", "closes", "the", "connection" ]
28272a7ea048139a5b9c30c1cfb591fbd0481686
https://github.com/posener/wstest/blob/28272a7ea048139a5b9c30c1cfb591fbd0481686/dialer.go#L65-L68
136,778
julienschmidt/sse
sse.go
New
func New() *Streamer { s := &Streamer{ event: make(chan []byte, 1), clients: make(map[client]bool), connecting: make(chan client), disconnecting: make(chan client), bufSize: 2, } s.run() return s }
go
func New() *Streamer { s := &Streamer{ event: make(chan []byte, 1), clients: make(map[client]bool), connecting: make(chan client), disconnecting: make(chan client), bufSize: 2, } s.run() return s }
[ "func", "New", "(", ")", "*", "Streamer", "{", "s", ":=", "&", "Streamer", "{", "event", ":", "make", "(", "chan", "[", "]", "byte", ",", "1", ")", ",", "clients", ":", "make", "(", "map", "[", "client", "]", "bool", ")", ",", "connecting", ":"...
// New returns a new initialized SSE Streamer
[ "New", "returns", "a", "new", "initialized", "SSE", "Streamer" ]
dedc8dfa3d5dbf90d2c4d70dfc25e7f8d657b424
https://github.com/julienschmidt/sse/blob/dedc8dfa3d5dbf90d2c4d70dfc25e7f8d657b424/sse.go#L33-L44
136,779
julienschmidt/sse
sse.go
run
func (s *Streamer) run() { go func() { for { select { case cl := <-s.connecting: s.clients[cl] = true case cl := <-s.disconnecting: delete(s.clients, cl) case event := <-s.event: for cl := range s.clients { // TODO: non-blocking broadcast //select { //case cl <- event: // Try...
go
func (s *Streamer) run() { go func() { for { select { case cl := <-s.connecting: s.clients[cl] = true case cl := <-s.disconnecting: delete(s.clients, cl) case event := <-s.event: for cl := range s.clients { // TODO: non-blocking broadcast //select { //case cl <- event: // Try...
[ "func", "(", "s", "*", "Streamer", ")", "run", "(", ")", "{", "go", "func", "(", ")", "{", "for", "{", "select", "{", "case", "cl", ":=", "<-", "s", ".", "connecting", ":", "s", ".", "clients", "[", "cl", "]", "=", "true", "\n\n", "case", "cl...
// run starts a goroutine to handle client connects and broadcast events.
[ "run", "starts", "a", "goroutine", "to", "handle", "client", "connects", "and", "broadcast", "events", "." ]
dedc8dfa3d5dbf90d2c4d70dfc25e7f8d657b424
https://github.com/julienschmidt/sse/blob/dedc8dfa3d5dbf90d2c4d70dfc25e7f8d657b424/sse.go#L47-L70
136,780
elodina/go-avro
datum_reader.go
NewGenericEnum
func NewGenericEnum(symbols []string) *GenericEnum { symbolsToIndex := make(map[string]int32) for index, symbol := range symbols { symbolsToIndex[symbol] = int32(index) } return &GenericEnum{ Symbols: symbols, symbolsToIndex: symbolsToIndex, } }
go
func NewGenericEnum(symbols []string) *GenericEnum { symbolsToIndex := make(map[string]int32) for index, symbol := range symbols { symbolsToIndex[symbol] = int32(index) } return &GenericEnum{ Symbols: symbols, symbolsToIndex: symbolsToIndex, } }
[ "func", "NewGenericEnum", "(", "symbols", "[", "]", "string", ")", "*", "GenericEnum", "{", "symbolsToIndex", ":=", "make", "(", "map", "[", "string", "]", "int32", ")", "\n", "for", "index", ",", "symbol", ":=", "range", "symbols", "{", "symbolsToIndex", ...
// NewGenericEnum returns a new GenericEnum that uses provided enum symbols.
[ "NewGenericEnum", "returns", "a", "new", "GenericEnum", "that", "uses", "provided", "enum", "symbols", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/datum_reader.go#L40-L50
136,781
elodina/go-avro
datum_reader.go
Read
func (reader *GenericDatumReader) Read(v interface{}, dec Decoder) error { rv := reflect.ValueOf(v) if rv.Kind() != reflect.Ptr || rv.IsNil() { return errors.New("Not applicable for non-pointer types or nil") } rv = rv.Elem() if reader.schema == nil { return SchemaNotSet } //read the value value, err := re...
go
func (reader *GenericDatumReader) Read(v interface{}, dec Decoder) error { rv := reflect.ValueOf(v) if rv.Kind() != reflect.Ptr || rv.IsNil() { return errors.New("Not applicable for non-pointer types or nil") } rv = rv.Elem() if reader.schema == nil { return SchemaNotSet } //read the value value, err := re...
[ "func", "(", "reader", "*", "GenericDatumReader", ")", "Read", "(", "v", "interface", "{", "}", ",", "dec", "Decoder", ")", "error", "{", "rv", ":=", "reflect", ".", "ValueOf", "(", "v", ")", "\n", "if", "rv", ".", "Kind", "(", ")", "!=", "reflect"...
// Read reads a single entry using this GenericDatumReader. // Accepts a value to fill with data and a Decoder to read from. Given value MUST be of pointer type. // May return an error indicating a read failure.
[ "Read", "reads", "a", "single", "entry", "using", "this", "GenericDatumReader", ".", "Accepts", "a", "value", "to", "fill", "with", "data", "and", "a", "Decoder", "to", "read", "from", ".", "Given", "value", "MUST", "be", "of", "pointer", "type", ".", "M...
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/datum_reader.go#L384-L410
136,782
elodina/go-avro
datum_writer.go
Write
func (writer *GenericDatumWriter) Write(obj interface{}, enc Encoder) error { return writer.write(obj, enc, writer.schema) }
go
func (writer *GenericDatumWriter) Write(obj interface{}, enc Encoder) error { return writer.write(obj, enc, writer.schema) }
[ "func", "(", "writer", "*", "GenericDatumWriter", ")", "Write", "(", "obj", "interface", "{", "}", ",", "enc", "Encoder", ")", "error", "{", "return", "writer", ".", "write", "(", "obj", ",", "enc", ",", "writer", ".", "schema", ")", "\n", "}" ]
// Write writes a single entry using this GenericDatumWriter according to provided Schema. // Accepts a value to write and Encoder to write to. // May return an error indicating a write failure.
[ "Write", "writes", "a", "single", "entry", "using", "this", "GenericDatumWriter", "according", "to", "provided", "Schema", ".", "Accepts", "a", "value", "to", "write", "and", "Encoder", "to", "write", "to", ".", "May", "return", "an", "error", "indicating", ...
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/datum_writer.go#L284-L286
136,783
elodina/go-avro
encoder.go
WriteBoolean
func (be *BinaryEncoder) WriteBoolean(x bool) { if x { _, _ = be.buffer.Write([]byte{0x01}) } else { _, _ = be.buffer.Write([]byte{0x00}) } }
go
func (be *BinaryEncoder) WriteBoolean(x bool) { if x { _, _ = be.buffer.Write([]byte{0x01}) } else { _, _ = be.buffer.Write([]byte{0x00}) } }
[ "func", "(", "be", "*", "BinaryEncoder", ")", "WriteBoolean", "(", "x", "bool", ")", "{", "if", "x", "{", "_", ",", "_", "=", "be", ".", "buffer", ".", "Write", "(", "[", "]", "byte", "{", "0x01", "}", ")", "\n", "}", "else", "{", "_", ",", ...
// WriteBoolean writes a boolean value.
[ "WriteBoolean", "writes", "a", "boolean", "value", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/encoder.go#L72-L78
136,784
elodina/go-avro
encoder.go
WriteInt
func (be *BinaryEncoder) WriteInt(x int32) { _, _ = be.buffer.Write(be.encodeVarint32(x)) }
go
func (be *BinaryEncoder) WriteInt(x int32) { _, _ = be.buffer.Write(be.encodeVarint32(x)) }
[ "func", "(", "be", "*", "BinaryEncoder", ")", "WriteInt", "(", "x", "int32", ")", "{", "_", ",", "_", "=", "be", ".", "buffer", ".", "Write", "(", "be", ".", "encodeVarint32", "(", "x", ")", ")", "\n", "}" ]
// WriteInt writes an int value.
[ "WriteInt", "writes", "an", "int", "value", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/encoder.go#L81-L83
136,785
elodina/go-avro
encoder.go
WriteLong
func (be *BinaryEncoder) WriteLong(x int64) { _, _ = be.buffer.Write(be.encodeVarint64(x)) }
go
func (be *BinaryEncoder) WriteLong(x int64) { _, _ = be.buffer.Write(be.encodeVarint64(x)) }
[ "func", "(", "be", "*", "BinaryEncoder", ")", "WriteLong", "(", "x", "int64", ")", "{", "_", ",", "_", "=", "be", ".", "buffer", ".", "Write", "(", "be", ".", "encodeVarint64", "(", "x", ")", ")", "\n", "}" ]
// WriteLong writes a long value.
[ "WriteLong", "writes", "a", "long", "value", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/encoder.go#L86-L88
136,786
elodina/go-avro
encoder.go
WriteFloat
func (be *BinaryEncoder) WriteFloat(x float32) { bytes := make([]byte, 4) binary.LittleEndian.PutUint32(bytes, math.Float32bits(x)) _, _ = be.buffer.Write(bytes) }
go
func (be *BinaryEncoder) WriteFloat(x float32) { bytes := make([]byte, 4) binary.LittleEndian.PutUint32(bytes, math.Float32bits(x)) _, _ = be.buffer.Write(bytes) }
[ "func", "(", "be", "*", "BinaryEncoder", ")", "WriteFloat", "(", "x", "float32", ")", "{", "bytes", ":=", "make", "(", "[", "]", "byte", ",", "4", ")", "\n", "binary", ".", "LittleEndian", ".", "PutUint32", "(", "bytes", ",", "math", ".", "Float32bit...
// WriteFloat writes a float value.
[ "WriteFloat", "writes", "a", "float", "value", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/encoder.go#L91-L95
136,787
elodina/go-avro
encoder.go
WriteDouble
func (be *BinaryEncoder) WriteDouble(x float64) { bytes := make([]byte, 8) binary.LittleEndian.PutUint64(bytes, math.Float64bits(x)) _, _ = be.buffer.Write(bytes) }
go
func (be *BinaryEncoder) WriteDouble(x float64) { bytes := make([]byte, 8) binary.LittleEndian.PutUint64(bytes, math.Float64bits(x)) _, _ = be.buffer.Write(bytes) }
[ "func", "(", "be", "*", "BinaryEncoder", ")", "WriteDouble", "(", "x", "float64", ")", "{", "bytes", ":=", "make", "(", "[", "]", "byte", ",", "8", ")", "\n", "binary", ".", "LittleEndian", ".", "PutUint64", "(", "bytes", ",", "math", ".", "Float64bi...
// WriteDouble writes a double value.
[ "WriteDouble", "writes", "a", "double", "value", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/encoder.go#L98-L102
136,788
elodina/go-avro
encoder.go
WriteRaw
func (be *BinaryEncoder) WriteRaw(x []byte) { _, _ = be.buffer.Write(x) }
go
func (be *BinaryEncoder) WriteRaw(x []byte) { _, _ = be.buffer.Write(x) }
[ "func", "(", "be", "*", "BinaryEncoder", ")", "WriteRaw", "(", "x", "[", "]", "byte", ")", "{", "_", ",", "_", "=", "be", ".", "buffer", ".", "Write", "(", "x", ")", "\n", "}" ]
// WriteRaw writes raw bytes to this Encoder.
[ "WriteRaw", "writes", "raw", "bytes", "to", "this", "Encoder", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/encoder.go#L105-L107
136,789
elodina/go-avro
encoder.go
WriteBytes
func (be *BinaryEncoder) WriteBytes(x []byte) { be.WriteLong(int64(len(x))) _, _ = be.buffer.Write(x) }
go
func (be *BinaryEncoder) WriteBytes(x []byte) { be.WriteLong(int64(len(x))) _, _ = be.buffer.Write(x) }
[ "func", "(", "be", "*", "BinaryEncoder", ")", "WriteBytes", "(", "x", "[", "]", "byte", ")", "{", "be", ".", "WriteLong", "(", "int64", "(", "len", "(", "x", ")", ")", ")", "\n", "_", ",", "_", "=", "be", ".", "buffer", ".", "Write", "(", "x"...
// WriteBytes writes a bytes value.
[ "WriteBytes", "writes", "a", "bytes", "value", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/encoder.go#L110-L113
136,790
elodina/go-avro
encoder.go
WriteString
func (be *BinaryEncoder) WriteString(x string) { be.WriteLong(int64(len(x))) _, _ = be.buffer.Write([]byte(x)) }
go
func (be *BinaryEncoder) WriteString(x string) { be.WriteLong(int64(len(x))) _, _ = be.buffer.Write([]byte(x)) }
[ "func", "(", "be", "*", "BinaryEncoder", ")", "WriteString", "(", "x", "string", ")", "{", "be", ".", "WriteLong", "(", "int64", "(", "len", "(", "x", ")", ")", ")", "\n", "_", ",", "_", "=", "be", ".", "buffer", ".", "Write", "(", "[", "]", ...
// WriteString writes a string value.
[ "WriteString", "writes", "a", "string", "value", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/encoder.go#L116-L119
136,791
elodina/go-avro
datum_utils.go
fill
func (rm *reflectInfo) fill(t reflect.Type, indexPrefix []int) { // simple infinite recursion preventer: stop when we are >10 deep. if len(indexPrefix) > 10 { return } fillName := func(tag string, idx []int) { if _, ok := rm.names[tag]; !ok { rm.names[tag] = idx } } // these are anonymous structs to inv...
go
func (rm *reflectInfo) fill(t reflect.Type, indexPrefix []int) { // simple infinite recursion preventer: stop when we are >10 deep. if len(indexPrefix) > 10 { return } fillName := func(tag string, idx []int) { if _, ok := rm.names[tag]; !ok { rm.names[tag] = idx } } // these are anonymous structs to inv...
[ "func", "(", "rm", "*", "reflectInfo", ")", "fill", "(", "t", "reflect", ".", "Type", ",", "indexPrefix", "[", "]", "int", ")", "{", "// simple infinite recursion preventer: stop when we are >10 deep.", "if", "len", "(", "indexPrefix", ")", ">", "10", "{", "re...
// fill the given reflect info with the field names mapped. // // fill will recurse into anonymous structs incrementing the index prefix // so that untagged anonymous structs can be used as the source of truth.
[ "fill", "the", "given", "reflect", "info", "with", "the", "field", "names", "mapped", ".", "fill", "will", "recurse", "into", "anonymous", "structs", "incrementing", "the", "index", "prefix", "so", "that", "untagged", "anonymous", "structs", "can", "be", "used...
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/datum_utils.go#L68-L101
136,792
elodina/go-avro
codegen.go
NewCodeGenerator
func NewCodeGenerator(schemas []string) *CodeGenerator { return &CodeGenerator{ rawSchemas: schemas, structs: make(map[string]*bytes.Buffer), codeSnippets: make([]*bytes.Buffer, 0), schemaDefinitions: &bytes.Buffer{}, } }
go
func NewCodeGenerator(schemas []string) *CodeGenerator { return &CodeGenerator{ rawSchemas: schemas, structs: make(map[string]*bytes.Buffer), codeSnippets: make([]*bytes.Buffer, 0), schemaDefinitions: &bytes.Buffer{}, } }
[ "func", "NewCodeGenerator", "(", "schemas", "[", "]", "string", ")", "*", "CodeGenerator", "{", "return", "&", "CodeGenerator", "{", "rawSchemas", ":", "schemas", ",", "structs", ":", "make", "(", "map", "[", "string", "]", "*", "bytes", ".", "Buffer", "...
// NewCodeGenerator creates a new CodeGenerator for given Avro schemas.
[ "NewCodeGenerator", "creates", "a", "new", "CodeGenerator", "for", "given", "Avro", "schemas", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/codegen.go#L36-L43
136,793
elodina/go-avro
decoder.go
ReadInt
func (bd *BinaryDecoder) ReadInt() (int32, error) { if err := checkEOF(bd.buf, bd.pos, 1); err != nil { return 0, EOF } var value uint32 var b uint8 var offset int bufLen := int64(len(bd.buf)) for { if offset == maxIntBufSize { return 0, IntOverflow } if bd.pos >= bufLen { return 0, InvalidInt ...
go
func (bd *BinaryDecoder) ReadInt() (int32, error) { if err := checkEOF(bd.buf, bd.pos, 1); err != nil { return 0, EOF } var value uint32 var b uint8 var offset int bufLen := int64(len(bd.buf)) for { if offset == maxIntBufSize { return 0, IntOverflow } if bd.pos >= bufLen { return 0, InvalidInt ...
[ "func", "(", "bd", "*", "BinaryDecoder", ")", "ReadInt", "(", ")", "(", "int32", ",", "error", ")", "{", "if", "err", ":=", "checkEOF", "(", "bd", ".", "buf", ",", "bd", ".", "pos", ",", "1", ")", ";", "err", "!=", "nil", "{", "return", "0", ...
// ReadInt reads an int value. Returns a decoded value and an error if it occurs.
[ "ReadInt", "reads", "an", "int", "value", ".", "Returns", "a", "decoded", "value", "and", "an", "error", "if", "it", "occurs", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/decoder.go#L110-L137
136,794
elodina/go-avro
decoder.go
ReadLong
func (bd *BinaryDecoder) ReadLong() (int64, error) { var value uint64 var b uint8 var offset int bufLen := int64(len(bd.buf)) for { if offset == maxLongBufSize { return 0, LongOverflow } if bd.pos >= bufLen { return 0, InvalidLong } b = bd.buf[bd.pos] value |= uint64(b&0x7F) << uint(7*offset) ...
go
func (bd *BinaryDecoder) ReadLong() (int64, error) { var value uint64 var b uint8 var offset int bufLen := int64(len(bd.buf)) for { if offset == maxLongBufSize { return 0, LongOverflow } if bd.pos >= bufLen { return 0, InvalidLong } b = bd.buf[bd.pos] value |= uint64(b&0x7F) << uint(7*offset) ...
[ "func", "(", "bd", "*", "BinaryDecoder", ")", "ReadLong", "(", ")", "(", "int64", ",", "error", ")", "{", "var", "value", "uint64", "\n", "var", "b", "uint8", "\n", "var", "offset", "int", "\n", "bufLen", ":=", "int64", "(", "len", "(", "bd", ".", ...
// ReadLong reads a long value. Returns a decoded value and an error if it occurs.
[ "ReadLong", "reads", "a", "long", "value", ".", "Returns", "a", "decoded", "value", "and", "an", "error", "if", "it", "occurs", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/decoder.go#L140-L165
136,795
elodina/go-avro
decoder.go
ReadString
func (bd *BinaryDecoder) ReadString() (string, error) { if err := checkEOF(bd.buf, bd.pos, 1); err != nil { return "", err } length, err := bd.ReadLong() if err != nil || length < 0 { return "", InvalidStringLength } if err := checkEOF(bd.buf, bd.pos, int(length)); err != nil { return "", err } value := s...
go
func (bd *BinaryDecoder) ReadString() (string, error) { if err := checkEOF(bd.buf, bd.pos, 1); err != nil { return "", err } length, err := bd.ReadLong() if err != nil || length < 0 { return "", InvalidStringLength } if err := checkEOF(bd.buf, bd.pos, int(length)); err != nil { return "", err } value := s...
[ "func", "(", "bd", "*", "BinaryDecoder", ")", "ReadString", "(", ")", "(", "string", ",", "error", ")", "{", "if", "err", ":=", "checkEOF", "(", "bd", ".", "buf", ",", "bd", ".", "pos", ",", "1", ")", ";", "err", "!=", "nil", "{", "return", "\"...
// ReadString reads a string value. Returns a decoded value and an error if it occurs.
[ "ReadString", "reads", "a", "string", "value", ".", "Returns", "a", "decoded", "value", "and", "an", "error", "if", "it", "occurs", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/decoder.go#L168-L182
136,796
elodina/go-avro
decoder.go
ReadBoolean
func (bd *BinaryDecoder) ReadBoolean() (bool, error) { b := bd.buf[bd.pos] & 0xFF bd.pos++ var err error if b != 0 && b != 1 { err = InvalidBool } return b == 1, err }
go
func (bd *BinaryDecoder) ReadBoolean() (bool, error) { b := bd.buf[bd.pos] & 0xFF bd.pos++ var err error if b != 0 && b != 1 { err = InvalidBool } return b == 1, err }
[ "func", "(", "bd", "*", "BinaryDecoder", ")", "ReadBoolean", "(", ")", "(", "bool", ",", "error", ")", "{", "b", ":=", "bd", ".", "buf", "[", "bd", ".", "pos", "]", "&", "0xFF", "\n", "bd", ".", "pos", "++", "\n", "var", "err", "error", "\n", ...
// ReadBoolean reads a boolean value. Returns a decoded value and an error if it occurs.
[ "ReadBoolean", "reads", "a", "boolean", "value", ".", "Returns", "a", "decoded", "value", "and", "an", "error", "if", "it", "occurs", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/decoder.go#L185-L193
136,797
elodina/go-avro
decoder.go
ReadBytes
func (bd *BinaryDecoder) ReadBytes() ([]byte, error) { //TODO make something with these if's!! if err := checkEOF(bd.buf, bd.pos, 1); err != nil { return nil, EOF } length, err := bd.ReadLong() if err != nil { return nil, err } if length < 0 { return nil, NegativeBytesLength } if err = checkEOF(bd.buf, b...
go
func (bd *BinaryDecoder) ReadBytes() ([]byte, error) { //TODO make something with these if's!! if err := checkEOF(bd.buf, bd.pos, 1); err != nil { return nil, EOF } length, err := bd.ReadLong() if err != nil { return nil, err } if length < 0 { return nil, NegativeBytesLength } if err = checkEOF(bd.buf, b...
[ "func", "(", "bd", "*", "BinaryDecoder", ")", "ReadBytes", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "//TODO make something with these if's!!", "if", "err", ":=", "checkEOF", "(", "bd", ".", "buf", ",", "bd", ".", "pos", ",", "1", ")", ...
// ReadBytes reads a bytes value. Returns a decoded value and an error if it occurs.
[ "ReadBytes", "reads", "a", "bytes", "value", ".", "Returns", "a", "decoded", "value", "and", "an", "error", "if", "it", "occurs", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/decoder.go#L196-L216
136,798
elodina/go-avro
decoder.go
ReadFloat
func (bd *BinaryDecoder) ReadFloat() (float32, error) { var float float32 if err := checkEOF(bd.buf, bd.pos, 4); err != nil { return float, err } bits := binary.LittleEndian.Uint32(bd.buf[bd.pos : bd.pos+4]) float = math.Float32frombits(bits) bd.pos += 4 return float, nil }
go
func (bd *BinaryDecoder) ReadFloat() (float32, error) { var float float32 if err := checkEOF(bd.buf, bd.pos, 4); err != nil { return float, err } bits := binary.LittleEndian.Uint32(bd.buf[bd.pos : bd.pos+4]) float = math.Float32frombits(bits) bd.pos += 4 return float, nil }
[ "func", "(", "bd", "*", "BinaryDecoder", ")", "ReadFloat", "(", ")", "(", "float32", ",", "error", ")", "{", "var", "float", "float32", "\n", "if", "err", ":=", "checkEOF", "(", "bd", ".", "buf", ",", "bd", ".", "pos", ",", "4", ")", ";", "err", ...
// ReadFloat reads a float value. Returns a decoded value and an error if it occurs.
[ "ReadFloat", "reads", "a", "float", "value", ".", "Returns", "a", "decoded", "value", "and", "an", "error", "if", "it", "occurs", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/decoder.go#L219-L228
136,799
elodina/go-avro
decoder.go
ReadDouble
func (bd *BinaryDecoder) ReadDouble() (float64, error) { var double float64 if err := checkEOF(bd.buf, bd.pos, 8); err != nil { return double, err } bits := binary.LittleEndian.Uint64(bd.buf[bd.pos : bd.pos+8]) double = math.Float64frombits(bits) bd.pos += 8 return double, nil }
go
func (bd *BinaryDecoder) ReadDouble() (float64, error) { var double float64 if err := checkEOF(bd.buf, bd.pos, 8); err != nil { return double, err } bits := binary.LittleEndian.Uint64(bd.buf[bd.pos : bd.pos+8]) double = math.Float64frombits(bits) bd.pos += 8 return double, nil }
[ "func", "(", "bd", "*", "BinaryDecoder", ")", "ReadDouble", "(", ")", "(", "float64", ",", "error", ")", "{", "var", "double", "float64", "\n", "if", "err", ":=", "checkEOF", "(", "bd", ".", "buf", ",", "bd", ".", "pos", ",", "8", ")", ";", "err"...
// ReadDouble reads a double value. Returns a decoded value and an error if it occurs.
[ "ReadDouble", "reads", "a", "double", "value", ".", "Returns", "a", "decoded", "value", "and", "an", "error", "if", "it", "occurs", "." ]
0c8185d9a3ba82aeac98db3313a268a5b6df99b5
https://github.com/elodina/go-avro/blob/0c8185d9a3ba82aeac98db3313a268a5b6df99b5/decoder.go#L231-L240