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 list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
137,700 | terra-farm/go-xen-api-client | vgpu_type_gen.go | GetAll | func (_class VGPUTypeClass) GetAll(sessionID SessionRef) (_retval []VGPUTypeRef, _err error) {
_method := "VGPU_type.get_all"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionID... | go | func (_class VGPUTypeClass) GetAll(sessionID SessionRef) (_retval []VGPUTypeRef, _err error) {
_method := "VGPU_type.get_all"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionID... | [
"func",
"(",
"_class",
"VGPUTypeClass",
")",
"GetAll",
"(",
"sessionID",
"SessionRef",
")",
"(",
"_retval",
"[",
"]",
"VGPUTypeRef",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":=",
"convertSessionRefToXe... | // Return a list of all the VGPU_types known to the system. | [
"Return",
"a",
"list",
"of",
"all",
"the",
"VGPU_types",
"known",
"to",
"the",
"system",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/vgpu_type_gen.go#L92-L104 |
137,701 | terra-farm/go-xen-api-client | vgpu_type_gen.go | GetExperimental | func (_class VGPUTypeClass) GetExperimental(sessionID SessionRef, self VGPUTypeRef) (_retval bool, _err error) {
_method := "VGPU_type.get_experimental"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVGPUTy... | go | func (_class VGPUTypeClass) GetExperimental(sessionID SessionRef, self VGPUTypeRef) (_retval bool, _err error) {
_method := "VGPU_type.get_experimental"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVGPUTy... | [
"func",
"(",
"_class",
"VGPUTypeClass",
")",
"GetExperimental",
"(",
"sessionID",
"SessionRef",
",",
"self",
"VGPUTypeRef",
")",
"(",
"_retval",
"bool",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":=",
... | // Get the experimental field of the given VGPU_type. | [
"Get",
"the",
"experimental",
"field",
"of",
"the",
"given",
"VGPU_type",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/vgpu_type_gen.go#L107-L123 |
137,702 | terra-farm/go-xen-api-client | vgpu_type_gen.go | GetImplementation | func (_class VGPUTypeClass) GetImplementation(sessionID SessionRef, self VGPUTypeRef) (_retval VgpuTypeImplementation, _err error) {
_method := "VGPU_type.get_implementation"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg,... | go | func (_class VGPUTypeClass) GetImplementation(sessionID SessionRef, self VGPUTypeRef) (_retval VgpuTypeImplementation, _err error) {
_method := "VGPU_type.get_implementation"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg,... | [
"func",
"(",
"_class",
"VGPUTypeClass",
")",
"GetImplementation",
"(",
"sessionID",
"SessionRef",
",",
"self",
"VGPUTypeRef",
")",
"(",
"_retval",
"VgpuTypeImplementation",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
... | // Get the implementation field of the given VGPU_type. | [
"Get",
"the",
"implementation",
"field",
"of",
"the",
"given",
"VGPU_type",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/vgpu_type_gen.go#L145-L161 |
137,703 | terra-farm/go-xen-api-client | vgpu_type_gen.go | GetEnabledOnGPUGroups | func (_class VGPUTypeClass) GetEnabledOnGPUGroups(sessionID SessionRef, self VGPUTypeRef) (_retval []GPUGroupRef, _err error) {
_method := "VGPU_type.get_enabled_on_GPU_groups"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfAr... | go | func (_class VGPUTypeClass) GetEnabledOnGPUGroups(sessionID SessionRef, self VGPUTypeRef) (_retval []GPUGroupRef, _err error) {
_method := "VGPU_type.get_enabled_on_GPU_groups"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfAr... | [
"func",
"(",
"_class",
"VGPUTypeClass",
")",
"GetEnabledOnGPUGroups",
"(",
"sessionID",
"SessionRef",
",",
"self",
"VGPUTypeRef",
")",
"(",
"_retval",
"[",
"]",
"GPUGroupRef",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
... | // Get the enabled_on_GPU_groups field of the given VGPU_type. | [
"Get",
"the",
"enabled_on_GPU_groups",
"field",
"of",
"the",
"given",
"VGPU_type",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/vgpu_type_gen.go#L164-L180 |
137,704 | terra-farm/go-xen-api-client | vgpu_type_gen.go | GetVGPUs | func (_class VGPUTypeClass) GetVGPUs(sessionID SessionRef, self VGPUTypeRef) (_retval []VGPURef, _err error) {
_method := "VGPU_type.get_VGPUs"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVGPUTypeRefToXe... | go | func (_class VGPUTypeClass) GetVGPUs(sessionID SessionRef, self VGPUTypeRef) (_retval []VGPURef, _err error) {
_method := "VGPU_type.get_VGPUs"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVGPUTypeRefToXe... | [
"func",
"(",
"_class",
"VGPUTypeClass",
")",
"GetVGPUs",
"(",
"sessionID",
"SessionRef",
",",
"self",
"VGPUTypeRef",
")",
"(",
"_retval",
"[",
"]",
"VGPURef",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
... | // Get the VGPUs field of the given VGPU_type. | [
"Get",
"the",
"VGPUs",
"field",
"of",
"the",
"given",
"VGPU_type",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/vgpu_type_gen.go#L202-L218 |
137,705 | terra-farm/go-xen-api-client | vgpu_type_gen.go | GetEnabledOnPGPUs | func (_class VGPUTypeClass) GetEnabledOnPGPUs(sessionID SessionRef, self VGPUTypeRef) (_retval []PGPURef, _err error) {
_method := "VGPU_type.get_enabled_on_PGPUs"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := co... | go | func (_class VGPUTypeClass) GetEnabledOnPGPUs(sessionID SessionRef, self VGPUTypeRef) (_retval []PGPURef, _err error) {
_method := "VGPU_type.get_enabled_on_PGPUs"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := co... | [
"func",
"(",
"_class",
"VGPUTypeClass",
")",
"GetEnabledOnPGPUs",
"(",
"sessionID",
"SessionRef",
",",
"self",
"VGPUTypeRef",
")",
"(",
"_retval",
"[",
"]",
"PGPURef",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
... | // Get the enabled_on_PGPUs field of the given VGPU_type. | [
"Get",
"the",
"enabled_on_PGPUs",
"field",
"of",
"the",
"given",
"VGPU_type",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/vgpu_type_gen.go#L221-L237 |
137,706 | terra-farm/go-xen-api-client | vgpu_type_gen.go | GetMaxResolutionY | func (_class VGPUTypeClass) GetMaxResolutionY(sessionID SessionRef, self VGPUTypeRef) (_retval int, _err error) {
_method := "VGPU_type.get_max_resolution_y"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertV... | go | func (_class VGPUTypeClass) GetMaxResolutionY(sessionID SessionRef, self VGPUTypeRef) (_retval int, _err error) {
_method := "VGPU_type.get_max_resolution_y"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertV... | [
"func",
"(",
"_class",
"VGPUTypeClass",
")",
"GetMaxResolutionY",
"(",
"sessionID",
"SessionRef",
",",
"self",
"VGPUTypeRef",
")",
"(",
"_retval",
"int",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":=",
... | // Get the max_resolution_y field of the given VGPU_type. | [
"Get",
"the",
"max_resolution_y",
"field",
"of",
"the",
"given",
"VGPU_type",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/vgpu_type_gen.go#L259-L275 |
137,707 | terra-farm/go-xen-api-client | vgpu_type_gen.go | GetRecord | func (_class VGPUTypeClass) GetRecord(sessionID SessionRef, self VGPUTypeRef) (_retval VGPUTypeRecord, _err error) {
_method := "VGPU_type.get_record"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVGPUType... | go | func (_class VGPUTypeClass) GetRecord(sessionID SessionRef, self VGPUTypeRef) (_retval VGPUTypeRecord, _err error) {
_method := "VGPU_type.get_record"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertVGPUType... | [
"func",
"(",
"_class",
"VGPUTypeClass",
")",
"GetRecord",
"(",
"sessionID",
"SessionRef",
",",
"self",
"VGPUTypeRef",
")",
"(",
"_retval",
"VGPUTypeRecord",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":="... | // Get a record containing the current state of the given VGPU_type. | [
"Get",
"a",
"record",
"containing",
"the",
"current",
"state",
"of",
"the",
"given",
"VGPU_type",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/vgpu_type_gen.go#L411-L427 |
137,708 | terra-farm/go-xen-api-client | user_gen.go | Destroy | func (_class UserClass) Destroy(sessionID SessionRef, self UserRef) (_err error) {
_method := "user.destroy"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertUserRefToXen(fmt.Sprintf("%s(%s)", _method, "self"... | go | func (_class UserClass) Destroy(sessionID SessionRef, self UserRef) (_err error) {
_method := "user.destroy"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertUserRefToXen(fmt.Sprintf("%s(%s)", _method, "self"... | [
"func",
"(",
"_class",
"UserClass",
")",
"Destroy",
"(",
"sessionID",
"SessionRef",
",",
"self",
"UserRef",
")",
"(",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":=",
"convertSessionRefToXen",
"(",
"fmt",
".... | // Destroy the specified user instance. | [
"Destroy",
"the",
"specified",
"user",
"instance",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/user_gen.go#L198-L210 |
137,709 | terra-farm/go-xen-api-client | user_gen.go | GetRecord | func (_class UserClass) GetRecord(sessionID SessionRef, self UserRef) (_retval UserRecord, _err error) {
_method := "user.get_record"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertUserRefToXen(fmt.Sprintf(... | go | func (_class UserClass) GetRecord(sessionID SessionRef, self UserRef) (_retval UserRecord, _err error) {
_method := "user.get_record"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertUserRefToXen(fmt.Sprintf(... | [
"func",
"(",
"_class",
"UserClass",
")",
"GetRecord",
"(",
"sessionID",
"SessionRef",
",",
"self",
"UserRef",
")",
"(",
"_retval",
"UserRecord",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":=",
"convert... | // Get a record containing the current state of the given user. | [
"Get",
"a",
"record",
"containing",
"the",
"current",
"state",
"of",
"the",
"given",
"user",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/user_gen.go#L252-L268 |
137,710 | terra-farm/go-xen-api-client | tunnel_gen.go | GetAllRecords | func (_class TunnelClass) GetAllRecords(sessionID SessionRef) (_retval map[TunnelRef]TunnelRecord, _err error) {
_method := "tunnel.get_all_records"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_result, _err := _class.client.APIC... | go | func (_class TunnelClass) GetAllRecords(sessionID SessionRef) (_retval map[TunnelRef]TunnelRecord, _err error) {
_method := "tunnel.get_all_records"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_result, _err := _class.client.APIC... | [
"func",
"(",
"_class",
"TunnelClass",
")",
"GetAllRecords",
"(",
"sessionID",
"SessionRef",
")",
"(",
"_retval",
"map",
"[",
"TunnelRef",
"]",
"TunnelRecord",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
... | // Return a map of tunnel references to tunnel records for all tunnels known to the system. | [
"Return",
"a",
"map",
"of",
"tunnel",
"references",
"to",
"tunnel",
"records",
"for",
"all",
"tunnels",
"known",
"to",
"the",
"system",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/tunnel_gen.go#L44-L56 |
137,711 | terra-farm/go-xen-api-client | tunnel_gen.go | GetAll | func (_class TunnelClass) GetAll(sessionID SessionRef) (_retval []TunnelRef, _err error) {
_method := "tunnel.get_all"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg)
i... | go | func (_class TunnelClass) GetAll(sessionID SessionRef) (_retval []TunnelRef, _err error) {
_method := "tunnel.get_all"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg)
i... | [
"func",
"(",
"_class",
"TunnelClass",
")",
"GetAll",
"(",
"sessionID",
"SessionRef",
")",
"(",
"_retval",
"[",
"]",
"TunnelRef",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":=",
"convertSessionRefToXen",
... | // Return a list of all the tunnels known to the system. | [
"Return",
"a",
"list",
"of",
"all",
"the",
"tunnels",
"known",
"to",
"the",
"system",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/tunnel_gen.go#L59-L71 |
137,712 | terra-farm/go-xen-api-client | tunnel_gen.go | Destroy | func (_class TunnelClass) Destroy(sessionID SessionRef, self TunnelRef) (_err error) {
_method := "tunnel.destroy"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertTunnelRefToXen(fmt.Sprintf("%s(%s)", _method... | go | func (_class TunnelClass) Destroy(sessionID SessionRef, self TunnelRef) (_err error) {
_method := "tunnel.destroy"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertTunnelRefToXen(fmt.Sprintf("%s(%s)", _method... | [
"func",
"(",
"_class",
"TunnelClass",
")",
"Destroy",
"(",
"sessionID",
"SessionRef",
",",
"self",
"TunnelRef",
")",
"(",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":=",
"convertSessionRefToXen",
"(",
"fmt",
... | // Destroy a tunnel | [
"Destroy",
"a",
"tunnel"
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/tunnel_gen.go#L74-L86 |
137,713 | terra-farm/go-xen-api-client | tunnel_gen.go | GetTransportPIF | func (_class TunnelClass) GetTransportPIF(sessionID SessionRef, self TunnelRef) (_retval PIFRef, _err error) {
_method := "tunnel.get_transport_PIF"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertTunnelRefT... | go | func (_class TunnelClass) GetTransportPIF(sessionID SessionRef, self TunnelRef) (_retval PIFRef, _err error) {
_method := "tunnel.get_transport_PIF"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertTunnelRefT... | [
"func",
"(",
"_class",
"TunnelClass",
")",
"GetTransportPIF",
"(",
"sessionID",
"SessionRef",
",",
"self",
"TunnelRef",
")",
"(",
"_retval",
"PIFRef",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":=",
"c... | // Get the transport_PIF field of the given tunnel. | [
"Get",
"the",
"transport_PIF",
"field",
"of",
"the",
"given",
"tunnel",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/tunnel_gen.go#L277-L293 |
137,714 | terra-farm/go-xen-api-client | tunnel_gen.go | GetRecord | func (_class TunnelClass) GetRecord(sessionID SessionRef, self TunnelRef) (_retval TunnelRecord, _err error) {
_method := "tunnel.get_record"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertTunnelRefToXen(fm... | go | func (_class TunnelClass) GetRecord(sessionID SessionRef, self TunnelRef) (_retval TunnelRecord, _err error) {
_method := "tunnel.get_record"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertTunnelRefToXen(fm... | [
"func",
"(",
"_class",
"TunnelClass",
")",
"GetRecord",
"(",
"sessionID",
"SessionRef",
",",
"self",
"TunnelRef",
")",
"(",
"_retval",
"TunnelRecord",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":=",
"c... | // Get a record containing the current state of the given tunnel. | [
"Get",
"a",
"record",
"containing",
"the",
"current",
"state",
"of",
"the",
"given",
"tunnel",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/tunnel_gen.go#L353-L369 |
137,715 | terra-farm/go-xen-api-client | vbd_metrics_gen.go | GetAllRecords | func (_class VBDMetricsClass) GetAllRecords(sessionID SessionRef) (_retval map[VBDMetricsRef]VBDMetricsRecord, _err error) {
_method := "VBD_metrics.get_all_records"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_result, _err := _... | go | func (_class VBDMetricsClass) GetAllRecords(sessionID SessionRef) (_retval map[VBDMetricsRef]VBDMetricsRecord, _err error) {
_method := "VBD_metrics.get_all_records"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_result, _err := _... | [
"func",
"(",
"_class",
"VBDMetricsClass",
")",
"GetAllRecords",
"(",
"sessionID",
"SessionRef",
")",
"(",
"_retval",
"map",
"[",
"VBDMetricsRef",
"]",
"VBDMetricsRecord",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
... | // Return a map of VBD_metrics references to VBD_metrics records for all VBD_metrics instances known to the system. | [
"Return",
"a",
"map",
"of",
"VBD_metrics",
"references",
"to",
"VBD_metrics",
"records",
"for",
"all",
"VBD_metrics",
"instances",
"known",
"to",
"the",
"system",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/vbd_metrics_gen.go#L44-L56 |
137,716 | terra-farm/go-xen-api-client | vbd_metrics_gen.go | GetAll | func (_class VBDMetricsClass) GetAll(sessionID SessionRef) (_retval []VBDMetricsRef, _err error) {
_method := "VBD_metrics.get_all"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _ses... | go | func (_class VBDMetricsClass) GetAll(sessionID SessionRef) (_retval []VBDMetricsRef, _err error) {
_method := "VBD_metrics.get_all"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _ses... | [
"func",
"(",
"_class",
"VBDMetricsClass",
")",
"GetAll",
"(",
"sessionID",
"SessionRef",
")",
"(",
"_retval",
"[",
"]",
"VBDMetricsRef",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":=",
"convertSessionRef... | // Return a list of all the VBD_metrics instances known to the system. | [
"Return",
"a",
"list",
"of",
"all",
"the",
"VBD_metrics",
"instances",
"known",
"to",
"the",
"system",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/vbd_metrics_gen.go#L59-L71 |
137,717 | terra-farm/go-xen-api-client | vbd_metrics_gen.go | GetLastUpdated | func (_class VBDMetricsClass) GetLastUpdated(sessionID SessionRef, self VBDMetricsRef) (_retval time.Time, _err error) {
_method := "VBD_metrics.get_last_updated"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := con... | go | func (_class VBDMetricsClass) GetLastUpdated(sessionID SessionRef, self VBDMetricsRef) (_retval time.Time, _err error) {
_method := "VBD_metrics.get_last_updated"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := con... | [
"func",
"(",
"_class",
"VBDMetricsClass",
")",
"GetLastUpdated",
"(",
"sessionID",
"SessionRef",
",",
"self",
"VBDMetricsRef",
")",
"(",
"_retval",
"time",
".",
"Time",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
... | // Get the last_updated field of the given VBD_metrics. | [
"Get",
"the",
"last_updated",
"field",
"of",
"the",
"given",
"VBD_metrics",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/vbd_metrics_gen.go#L154-L170 |
137,718 | terra-farm/go-xen-api-client | vbd_metrics_gen.go | GetRecord | func (_class VBDMetricsClass) GetRecord(sessionID SessionRef, self VBDMetricsRef) (_retval VBDMetricsRecord, _err error) {
_method := "VBD_metrics.get_record"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convert... | go | func (_class VBDMetricsClass) GetRecord(sessionID SessionRef, self VBDMetricsRef) (_retval VBDMetricsRecord, _err error) {
_method := "VBD_metrics.get_record"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convert... | [
"func",
"(",
"_class",
"VBDMetricsClass",
")",
"GetRecord",
"(",
"sessionID",
"SessionRef",
",",
"self",
"VBDMetricsRef",
")",
"(",
"_retval",
"VBDMetricsRecord",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
... | // Get a record containing the current state of the given VBD_metrics. | [
"Get",
"a",
"record",
"containing",
"the",
"current",
"state",
"of",
"the",
"given",
"VBD_metrics",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/vbd_metrics_gen.go#L249-L265 |
137,719 | terra-farm/go-xen-api-client | bond_gen.go | GetAllRecords | func (_class BondClass) GetAllRecords(sessionID SessionRef) (_retval map[BondRef]BondRecord, _err error) {
_method := "Bond.get_all_records"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_met... | go | func (_class BondClass) GetAllRecords(sessionID SessionRef) (_retval map[BondRef]BondRecord, _err error) {
_method := "Bond.get_all_records"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_met... | [
"func",
"(",
"_class",
"BondClass",
")",
"GetAllRecords",
"(",
"sessionID",
"SessionRef",
")",
"(",
"_retval",
"map",
"[",
"BondRef",
"]",
"BondRecord",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":=",
... | // Return a map of Bond references to Bond records for all Bonds known to the system. | [
"Return",
"a",
"map",
"of",
"Bond",
"references",
"to",
"Bond",
"records",
"for",
"all",
"Bonds",
"known",
"to",
"the",
"system",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/bond_gen.go#L61-L73 |
137,720 | terra-farm/go-xen-api-client | bond_gen.go | GetAll | func (_class BondClass) GetAll(sessionID SessionRef) (_retval []BondRef, _err error) {
_method := "Bond.get_all"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg)
if _err... | go | func (_class BondClass) GetAll(sessionID SessionRef) (_retval []BondRef, _err error) {
_method := "Bond.get_all"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg)
if _err... | [
"func",
"(",
"_class",
"BondClass",
")",
"GetAll",
"(",
"sessionID",
"SessionRef",
")",
"(",
"_retval",
"[",
"]",
"BondRef",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":=",
"convertSessionRefToXen",
"(... | // Return a list of all the Bonds known to the system. | [
"Return",
"a",
"list",
"of",
"all",
"the",
"Bonds",
"known",
"to",
"the",
"system",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/bond_gen.go#L76-L88 |
137,721 | terra-farm/go-xen-api-client | bond_gen.go | SetProperty | func (_class BondClass) SetProperty(sessionID SessionRef, self BondRef, name string, value string) (_err error) {
_method := "Bond.set_property"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertBondRefToXen(f... | go | func (_class BondClass) SetProperty(sessionID SessionRef, self BondRef, name string, value string) (_err error) {
_method := "Bond.set_property"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertBondRefToXen(f... | [
"func",
"(",
"_class",
"BondClass",
")",
"SetProperty",
"(",
"sessionID",
"SessionRef",
",",
"self",
"BondRef",
",",
"name",
"string",
",",
"value",
"string",
")",
"(",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"... | // Set the value of a property of the bond | [
"Set",
"the",
"value",
"of",
"a",
"property",
"of",
"the",
"bond"
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/bond_gen.go#L91-L111 |
137,722 | terra-farm/go-xen-api-client | bond_gen.go | SetMode | func (_class BondClass) SetMode(sessionID SessionRef, self BondRef, value BondMode) (_err error) {
_method := "Bond.set_mode"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertBondRefToXen(fmt.Sprintf("%s(%s)"... | go | func (_class BondClass) SetMode(sessionID SessionRef, self BondRef, value BondMode) (_err error) {
_method := "Bond.set_mode"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertBondRefToXen(fmt.Sprintf("%s(%s)"... | [
"func",
"(",
"_class",
"BondClass",
")",
"SetMode",
"(",
"sessionID",
"SessionRef",
",",
"self",
"BondRef",
",",
"value",
"BondMode",
")",
"(",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":=",
"convertSessio... | // Change the bond mode | [
"Change",
"the",
"bond",
"mode"
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/bond_gen.go#L114-L130 |
137,723 | terra-farm/go-xen-api-client | bond_gen.go | Destroy | func (_class BondClass) Destroy(sessionID SessionRef, self BondRef) (_err error) {
_method := "Bond.destroy"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertBondRefToXen(fmt.Sprintf("%s(%s)", _method, "self"... | go | func (_class BondClass) Destroy(sessionID SessionRef, self BondRef) (_err error) {
_method := "Bond.destroy"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertBondRefToXen(fmt.Sprintf("%s(%s)", _method, "self"... | [
"func",
"(",
"_class",
"BondClass",
")",
"Destroy",
"(",
"sessionID",
"SessionRef",
",",
"self",
"BondRef",
")",
"(",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":=",
"convertSessionRefToXen",
"(",
"fmt",
".... | // Destroy an interface bond | [
"Destroy",
"an",
"interface",
"bond"
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/bond_gen.go#L133-L145 |
137,724 | terra-farm/go-xen-api-client | bond_gen.go | Create | func (_class BondClass) Create(sessionID SessionRef, network NetworkRef, members []PIFRef, mac string, mode BondMode, properties map[string]string) (_retval BondRef, _err error) {
_method := "Bond.create"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err !... | go | func (_class BondClass) Create(sessionID SessionRef, network NetworkRef, members []PIFRef, mac string, mode BondMode, properties map[string]string) (_retval BondRef, _err error) {
_method := "Bond.create"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err !... | [
"func",
"(",
"_class",
"BondClass",
")",
"Create",
"(",
"sessionID",
"SessionRef",
",",
"network",
"NetworkRef",
",",
"members",
"[",
"]",
"PIFRef",
",",
"mac",
"string",
",",
"mode",
"BondMode",
",",
"properties",
"map",
"[",
"string",
"]",
"string",
")",... | // Create an interface bond | [
"Create",
"an",
"interface",
"bond"
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/bond_gen.go#L148-L180 |
137,725 | terra-farm/go-xen-api-client | bond_gen.go | GetLinksUp | func (_class BondClass) GetLinksUp(sessionID SessionRef, self BondRef) (_retval int, _err error) {
_method := "Bond.get_links_up"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertBondRefToXen(fmt.Sprintf("%s(... | go | func (_class BondClass) GetLinksUp(sessionID SessionRef, self BondRef) (_retval int, _err error) {
_method := "Bond.get_links_up"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertBondRefToXen(fmt.Sprintf("%s(... | [
"func",
"(",
"_class",
"BondClass",
")",
"GetLinksUp",
"(",
"sessionID",
"SessionRef",
",",
"self",
"BondRef",
")",
"(",
"_retval",
"int",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":=",
"convertSessio... | // Get the links_up field of the given Bond. | [
"Get",
"the",
"links_up",
"field",
"of",
"the",
"given",
"Bond",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/bond_gen.go#L244-L260 |
137,726 | terra-farm/go-xen-api-client | bond_gen.go | GetMode | func (_class BondClass) GetMode(sessionID SessionRef, self BondRef) (_retval BondMode, _err error) {
_method := "Bond.get_mode"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertBondRefToXen(fmt.Sprintf("%s(%s... | go | func (_class BondClass) GetMode(sessionID SessionRef, self BondRef) (_retval BondMode, _err error) {
_method := "Bond.get_mode"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertBondRefToXen(fmt.Sprintf("%s(%s... | [
"func",
"(",
"_class",
"BondClass",
")",
"GetMode",
"(",
"sessionID",
"SessionRef",
",",
"self",
"BondRef",
")",
"(",
"_retval",
"BondMode",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":=",
"convertSess... | // Get the mode field of the given Bond. | [
"Get",
"the",
"mode",
"field",
"of",
"the",
"given",
"Bond",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/bond_gen.go#L282-L298 |
137,727 | terra-farm/go-xen-api-client | bond_gen.go | GetSlaves | func (_class BondClass) GetSlaves(sessionID SessionRef, self BondRef) (_retval []PIFRef, _err error) {
_method := "Bond.get_slaves"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertBondRefToXen(fmt.Sprintf("%... | go | func (_class BondClass) GetSlaves(sessionID SessionRef, self BondRef) (_retval []PIFRef, _err error) {
_method := "Bond.get_slaves"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertBondRefToXen(fmt.Sprintf("%... | [
"func",
"(",
"_class",
"BondClass",
")",
"GetSlaves",
"(",
"sessionID",
"SessionRef",
",",
"self",
"BondRef",
")",
"(",
"_retval",
"[",
"]",
"PIFRef",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":=",
... | // Get the slaves field of the given Bond. | [
"Get",
"the",
"slaves",
"field",
"of",
"the",
"given",
"Bond",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/bond_gen.go#L339-L355 |
137,728 | terra-farm/go-xen-api-client | bond_gen.go | GetRecord | func (_class BondClass) GetRecord(sessionID SessionRef, self BondRef) (_retval BondRecord, _err error) {
_method := "Bond.get_record"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertBondRefToXen(fmt.Sprintf(... | go | func (_class BondClass) GetRecord(sessionID SessionRef, self BondRef) (_retval BondRecord, _err error) {
_method := "Bond.get_record"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertBondRefToXen(fmt.Sprintf(... | [
"func",
"(",
"_class",
"BondClass",
")",
"GetRecord",
"(",
"sessionID",
"SessionRef",
",",
"self",
"BondRef",
")",
"(",
"_retval",
"BondRecord",
",",
"_err",
"error",
")",
"{",
"_method",
":=",
"\"",
"\"",
"\n",
"_sessionIDArg",
",",
"_err",
":=",
"convert... | // Get a record containing the current state of the given Bond. | [
"Get",
"a",
"record",
"containing",
"the",
"current",
"state",
"of",
"the",
"given",
"Bond",
"."
] | edb53e3930c18c373c1a5e6c0eacd0b5c669fefb | https://github.com/terra-farm/go-xen-api-client/blob/edb53e3930c18c373c1a5e6c0eacd0b5c669fefb/bond_gen.go#L415-L431 |
137,729 | taylorchu/generic | rewrite/rewrite_package_name.go | rewritePackageName | func (s *Spec) rewritePackageName(pkg *Package) error {
pkgName := filepath.Base(s.Name)
if s.Local {
pkgName = os.Getenv("GOPACKAGE")
if pkgName == "" {
return errors.New("GOPACKAGE cannot be empty")
}
}
for _, node := range pkg.Files {
node.Name.Name = pkgName
}
return nil
} | go | func (s *Spec) rewritePackageName(pkg *Package) error {
pkgName := filepath.Base(s.Name)
if s.Local {
pkgName = os.Getenv("GOPACKAGE")
if pkgName == "" {
return errors.New("GOPACKAGE cannot be empty")
}
}
for _, node := range pkg.Files {
node.Name.Name = pkgName
}
return nil
} | [
"func",
"(",
"s",
"*",
"Spec",
")",
"rewritePackageName",
"(",
"pkg",
"*",
"Package",
")",
"error",
"{",
"pkgName",
":=",
"filepath",
".",
"Base",
"(",
"s",
".",
"Name",
")",
"\n",
"if",
"s",
".",
"Local",
"{",
"pkgName",
"=",
"os",
".",
"Getenv",
... | // rewritePackageName sets current package name. | [
"rewritePackageName",
"sets",
"current",
"package",
"name",
"."
] | cd81575befa2658d914cb955908d4f409923ce75 | https://github.com/taylorchu/generic/blob/cd81575befa2658d914cb955908d4f409923ce75/rewrite/rewrite_package_name.go#L10-L22 |
137,730 | taylorchu/generic | rewrite/remove_placeholder.go | removePlaceholder | func (s *Spec) removePlaceholder(pkg *Package) error {
declMap := make(map[interface{}]struct{})
for _, node := range pkg.Files {
for i := len(node.Decls) - 1; i >= 0; i-- {
var remove bool
switch decl := node.Decls[i].(type) {
case *ast.GenDecl:
for _, spec := range decl.Specs {
switch spec := sp... | go | func (s *Spec) removePlaceholder(pkg *Package) error {
declMap := make(map[interface{}]struct{})
for _, node := range pkg.Files {
for i := len(node.Decls) - 1; i >= 0; i-- {
var remove bool
switch decl := node.Decls[i].(type) {
case *ast.GenDecl:
for _, spec := range decl.Specs {
switch spec := sp... | [
"func",
"(",
"s",
"*",
"Spec",
")",
"removePlaceholder",
"(",
"pkg",
"*",
"Package",
")",
"error",
"{",
"declMap",
":=",
"make",
"(",
"map",
"[",
"interface",
"{",
"}",
"]",
"struct",
"{",
"}",
")",
"\n",
"for",
"_",
",",
"node",
":=",
"range",
"... | // removePlaceholder removes type declarations defined in typeMap. | [
"removePlaceholder",
"removes",
"type",
"declarations",
"defined",
"in",
"typeMap",
"."
] | cd81575befa2658d914cb955908d4f409923ce75 | https://github.com/taylorchu/generic/blob/cd81575befa2658d914cb955908d4f409923ce75/rewrite/remove_placeholder.go#L8-L68 |
137,731 | taylorchu/generic | cmd/generic/config_v1.go | NewConfig | func NewConfig(pkgPath, newPkgPath string, rules ...string) (*ConfigV1, error) {
c := &ConfigV1{
Import: pkgPath,
}
if strings.HasPrefix(newPkgPath, ".") {
c.Local = true
c.Name = strings.TrimPrefix(newPkgPath, ".")
} else {
c.Name = newPkgPath
}
typeMap, err := ParseTypeMap(rules)
if err != nil {
ret... | go | func NewConfig(pkgPath, newPkgPath string, rules ...string) (*ConfigV1, error) {
c := &ConfigV1{
Import: pkgPath,
}
if strings.HasPrefix(newPkgPath, ".") {
c.Local = true
c.Name = strings.TrimPrefix(newPkgPath, ".")
} else {
c.Name = newPkgPath
}
typeMap, err := ParseTypeMap(rules)
if err != nil {
ret... | [
"func",
"NewConfig",
"(",
"pkgPath",
",",
"newPkgPath",
"string",
",",
"rules",
"...",
"string",
")",
"(",
"*",
"ConfigV1",
",",
"error",
")",
"{",
"c",
":=",
"&",
"ConfigV1",
"{",
"Import",
":",
"pkgPath",
",",
"}",
"\n",
"if",
"strings",
".",
"HasP... | // NewConfig creates a new rewrite context. | [
"NewConfig",
"creates",
"a",
"new",
"rewrite",
"context",
"."
] | cd81575befa2658d914cb955908d4f409923ce75 | https://github.com/taylorchu/generic/blob/cd81575befa2658d914cb955908d4f409923ce75/cmd/generic/config_v1.go#L13-L31 |
137,732 | taylorchu/generic | cmd/generic/type_map.go | ParseTypeMap | func ParseTypeMap(args []string) (map[string]rewrite.Type, error) {
typeMap := make(map[string]rewrite.Type)
for _, arg := range args {
part := strings.Split(arg, "->")
if len(part) != 2 {
return nil, errors.New("RULE must be in form of `TypeXXX->OtherType`")
}
var (
from = strings.TrimSpace(part[0])... | go | func ParseTypeMap(args []string) (map[string]rewrite.Type, error) {
typeMap := make(map[string]rewrite.Type)
for _, arg := range args {
part := strings.Split(arg, "->")
if len(part) != 2 {
return nil, errors.New("RULE must be in form of `TypeXXX->OtherType`")
}
var (
from = strings.TrimSpace(part[0])... | [
"func",
"ParseTypeMap",
"(",
"args",
"[",
"]",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"rewrite",
".",
"Type",
",",
"error",
")",
"{",
"typeMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"rewrite",
".",
"Type",
")",
"\n\n",
"for",
"_",
... | // ParseTypeMap parses raw strings to type replacements. | [
"ParseTypeMap",
"parses",
"raw",
"strings",
"to",
"type",
"replacements",
"."
] | cd81575befa2658d914cb955908d4f409923ce75 | https://github.com/taylorchu/generic/blob/cd81575befa2658d914cb955908d4f409923ce75/cmd/generic/type_map.go#L11-L56 |
137,733 | taylorchu/generic | rewrite/rewrite_ident.go | rewriteIdent | func (s *Spec) rewriteIdent(pkg *Package) error {
for _, node := range pkg.Files {
ast.Inspect(node, func(n ast.Node) bool {
switch x := n.(type) {
case *ast.Ident:
if x.Obj == nil || x.Obj.Kind != ast.Typ {
return false
}
to, ok := s.TypeMap[x.Name]
if !ok {
return false
}
x.... | go | func (s *Spec) rewriteIdent(pkg *Package) error {
for _, node := range pkg.Files {
ast.Inspect(node, func(n ast.Node) bool {
switch x := n.(type) {
case *ast.Ident:
if x.Obj == nil || x.Obj.Kind != ast.Typ {
return false
}
to, ok := s.TypeMap[x.Name]
if !ok {
return false
}
x.... | [
"func",
"(",
"s",
"*",
"Spec",
")",
"rewriteIdent",
"(",
"pkg",
"*",
"Package",
")",
"error",
"{",
"for",
"_",
",",
"node",
":=",
"range",
"pkg",
".",
"Files",
"{",
"ast",
".",
"Inspect",
"(",
"node",
",",
"func",
"(",
"n",
"ast",
".",
"Node",
... | // rewriteIdent converts TypeXXX to its replacement defined in typeMap. | [
"rewriteIdent",
"converts",
"TypeXXX",
"to",
"its",
"replacement",
"defined",
"in",
"typeMap",
"."
] | cd81575befa2658d914cb955908d4f409923ce75 | https://github.com/taylorchu/generic/blob/cd81575befa2658d914cb955908d4f409923ce75/rewrite/rewrite_ident.go#L10-L33 |
137,734 | ginuerzh/gosocks5 | client/client.go | Dial | func Dial(addr string, options ...DialOption) (net.Conn, error) {
opts := &DialOptions{}
for _, o := range options {
o(opts)
}
conn, err := net.DialTimeout("tcp", addr, opts.Timeout)
if err != nil {
return nil, err
}
selector := opts.Selector
if selector == nil {
selector = DefaultSelector
}
cc := go... | go | func Dial(addr string, options ...DialOption) (net.Conn, error) {
opts := &DialOptions{}
for _, o := range options {
o(opts)
}
conn, err := net.DialTimeout("tcp", addr, opts.Timeout)
if err != nil {
return nil, err
}
selector := opts.Selector
if selector == nil {
selector = DefaultSelector
}
cc := go... | [
"func",
"Dial",
"(",
"addr",
"string",
",",
"options",
"...",
"DialOption",
")",
"(",
"net",
".",
"Conn",
",",
"error",
")",
"{",
"opts",
":=",
"&",
"DialOptions",
"{",
"}",
"\n",
"for",
"_",
",",
"o",
":=",
"range",
"options",
"{",
"o",
"(",
"op... | // Dial connects to the SOCKS5 server. | [
"Dial",
"connects",
"to",
"the",
"SOCKS5",
"server",
"."
] | 5baaf4207eb62509f005eb2f4517a6221c04d8cd | https://github.com/ginuerzh/gosocks5/blob/5baaf4207eb62509f005eb2f4517a6221c04d8cd/client/client.go#L11-L33 |
137,735 | ginuerzh/gosocks5 | server/server.go | Serve | func (s *Server) Serve(h Handler, options ...ServerOption) error {
if s.Listener == nil {
ln, err := net.ListenTCP("tcp", nil)
if err != nil {
return err
}
s.Listener = ln
}
if h == nil {
h = DefaultHandler
}
l := s.Listener
var tempDelay time.Duration
for {
conn, e := l.Accept()
if e != nil {
... | go | func (s *Server) Serve(h Handler, options ...ServerOption) error {
if s.Listener == nil {
ln, err := net.ListenTCP("tcp", nil)
if err != nil {
return err
}
s.Listener = ln
}
if h == nil {
h = DefaultHandler
}
l := s.Listener
var tempDelay time.Duration
for {
conn, e := l.Accept()
if e != nil {
... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Serve",
"(",
"h",
"Handler",
",",
"options",
"...",
"ServerOption",
")",
"error",
"{",
"if",
"s",
".",
"Listener",
"==",
"nil",
"{",
"ln",
",",
"err",
":=",
"net",
".",
"ListenTCP",
"(",
"\"",
"\"",
",",
"ni... | // Serve serves incoming requests. | [
"Serve",
"serves",
"incoming",
"requests",
"."
] | 5baaf4207eb62509f005eb2f4517a6221c04d8cd | https://github.com/ginuerzh/gosocks5/blob/5baaf4207eb62509f005eb2f4517a6221c04d8cd/server/server.go#L19-L54 |
137,736 | ddliu/motto | module.go | CreateLoaderFromSource | func CreateLoaderFromSource(source, pwd string) ModuleLoader {
return func(vm *Motto) (otto.Value, error) {
// Wraps the source to create a module environment
source = "(function(module) {var require = module.require;var exports = module.exports;var __dirname = module.__dirname;\n" + source + "\n})"
// Provide ... | go | func CreateLoaderFromSource(source, pwd string) ModuleLoader {
return func(vm *Motto) (otto.Value, error) {
// Wraps the source to create a module environment
source = "(function(module) {var require = module.require;var exports = module.exports;var __dirname = module.__dirname;\n" + source + "\n})"
// Provide ... | [
"func",
"CreateLoaderFromSource",
"(",
"source",
",",
"pwd",
"string",
")",
"ModuleLoader",
"{",
"return",
"func",
"(",
"vm",
"*",
"Motto",
")",
"(",
"otto",
".",
"Value",
",",
"error",
")",
"{",
"// Wraps the source to create a module environment",
"source",
"=... | // Create module loader from javascript source code.
//
// When the loader is called, the javascript source is executed in Motto.
//
// "pwd" indicates current working directory, which might be used to search for
// modules. | [
"Create",
"module",
"loader",
"from",
"javascript",
"source",
"code",
".",
"When",
"the",
"loader",
"is",
"called",
"the",
"javascript",
"source",
"is",
"executed",
"in",
"Motto",
".",
"pwd",
"indicates",
"current",
"working",
"directory",
"which",
"might",
"b... | b73cfd26c91b45e1c1dcb9ff70634b5240e442c3 | https://github.com/ddliu/motto/blob/b73cfd26c91b45e1c1dcb9ff70634b5240e442c3/module.go#L24-L62 |
137,737 | ddliu/motto | module.go | CreateLoaderFromFile | func CreateLoaderFromFile(filename string) ModuleLoader {
return func(vm *Motto) (otto.Value, error) {
source, err := ioutil.ReadFile(filename)
if err != nil {
return otto.UndefinedValue(), err
}
// load json
if filepath.Ext(filename) == ".json" {
return vm.Call("JSON.parse", nil, string(source))
}... | go | func CreateLoaderFromFile(filename string) ModuleLoader {
return func(vm *Motto) (otto.Value, error) {
source, err := ioutil.ReadFile(filename)
if err != nil {
return otto.UndefinedValue(), err
}
// load json
if filepath.Ext(filename) == ".json" {
return vm.Call("JSON.parse", nil, string(source))
}... | [
"func",
"CreateLoaderFromFile",
"(",
"filename",
"string",
")",
"ModuleLoader",
"{",
"return",
"func",
"(",
"vm",
"*",
"Motto",
")",
"(",
"otto",
".",
"Value",
",",
"error",
")",
"{",
"source",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"filename"... | // Create module loader from javascript file.
//
// Filename can be a javascript file or a json file. | [
"Create",
"module",
"loader",
"from",
"javascript",
"file",
".",
"Filename",
"can",
"be",
"a",
"javascript",
"file",
"or",
"a",
"json",
"file",
"."
] | b73cfd26c91b45e1c1dcb9ff70634b5240e442c3 | https://github.com/ddliu/motto/blob/b73cfd26c91b45e1c1dcb9ff70634b5240e442c3/module.go#L67-L84 |
137,738 | ddliu/motto | motto.go | Run | func (m *Motto) Run(name string) (otto.Value, error) {
if ok, _ := isFile(name); ok {
name, _ = filepath.Abs(name)
}
return m.Require(name, ".")
} | go | func (m *Motto) Run(name string) (otto.Value, error) {
if ok, _ := isFile(name); ok {
name, _ = filepath.Abs(name)
}
return m.Require(name, ".")
} | [
"func",
"(",
"m",
"*",
"Motto",
")",
"Run",
"(",
"name",
"string",
")",
"(",
"otto",
".",
"Value",
",",
"error",
")",
"{",
"if",
"ok",
",",
"_",
":=",
"isFile",
"(",
"name",
")",
";",
"ok",
"{",
"name",
",",
"_",
"=",
"filepath",
".",
"Abs",
... | // Run a module or file | [
"Run",
"a",
"module",
"or",
"file"
] | b73cfd26c91b45e1c1dcb9ff70634b5240e442c3 | https://github.com/ddliu/motto/blob/b73cfd26c91b45e1c1dcb9ff70634b5240e442c3/motto.go#L43-L49 |
137,739 | ddliu/motto | motto.go | Require | func (m *Motto) Require(id, pwd string) (otto.Value, error) {
if cache, ok := m.cachedModule(id); ok {
return cache, nil
}
loader := m.module(id)
if loader == nil {
loader = Module(id)
}
if loader != nil {
v, err := loader(m)
if err != nil {
return otto.UndefinedValue(), err
}
m.addCachedModule(... | go | func (m *Motto) Require(id, pwd string) (otto.Value, error) {
if cache, ok := m.cachedModule(id); ok {
return cache, nil
}
loader := m.module(id)
if loader == nil {
loader = Module(id)
}
if loader != nil {
v, err := loader(m)
if err != nil {
return otto.UndefinedValue(), err
}
m.addCachedModule(... | [
"func",
"(",
"m",
"*",
"Motto",
")",
"Require",
"(",
"id",
",",
"pwd",
"string",
")",
"(",
"otto",
".",
"Value",
",",
"error",
")",
"{",
"if",
"cache",
",",
"ok",
":=",
"m",
".",
"cachedModule",
"(",
"id",
")",
";",
"ok",
"{",
"return",
"cache"... | // Require a module with cache | [
"Require",
"a",
"module",
"with",
"cache"
] | b73cfd26c91b45e1c1dcb9ff70634b5240e442c3 | https://github.com/ddliu/motto/blob/b73cfd26c91b45e1c1dcb9ff70634b5240e442c3/motto.go#L52-L92 |
137,740 | ddliu/motto | motto.go | AddModule | func (m *Motto) AddModule(id string, l ModuleLoader) {
m.modulesMu.Lock()
m.modules[id] = l
m.modulesMu.Unlock()
} | go | func (m *Motto) AddModule(id string, l ModuleLoader) {
m.modulesMu.Lock()
m.modules[id] = l
m.modulesMu.Unlock()
} | [
"func",
"(",
"m",
"*",
"Motto",
")",
"AddModule",
"(",
"id",
"string",
",",
"l",
"ModuleLoader",
")",
"{",
"m",
".",
"modulesMu",
".",
"Lock",
"(",
")",
"\n",
"m",
".",
"modules",
"[",
"id",
"]",
"=",
"l",
"\n",
"m",
".",
"modulesMu",
".",
"Unl... | // AddModule registers a new module to current vm. | [
"AddModule",
"registers",
"a",
"new",
"module",
"to",
"current",
"vm",
"."
] | b73cfd26c91b45e1c1dcb9ff70634b5240e442c3 | https://github.com/ddliu/motto/blob/b73cfd26c91b45e1c1dcb9ff70634b5240e442c3/motto.go#L108-L112 |
137,741 | ddliu/motto | motto.go | AddPath | func (m *Motto) AddPath(paths ...string) {
m.pathsMu.Lock()
m.paths = append(m.paths, paths...)
m.pathsMu.Unlock()
} | go | func (m *Motto) AddPath(paths ...string) {
m.pathsMu.Lock()
m.paths = append(m.paths, paths...)
m.pathsMu.Unlock()
} | [
"func",
"(",
"m",
"*",
"Motto",
")",
"AddPath",
"(",
"paths",
"...",
"string",
")",
"{",
"m",
".",
"pathsMu",
".",
"Lock",
"(",
")",
"\n",
"m",
".",
"paths",
"=",
"append",
"(",
"m",
".",
"paths",
",",
"paths",
"...",
")",
"\n",
"m",
".",
"pa... | // AddPath adds paths to search for modules. | [
"AddPath",
"adds",
"paths",
"to",
"search",
"for",
"modules",
"."
] | b73cfd26c91b45e1c1dcb9ff70634b5240e442c3 | https://github.com/ddliu/motto/blob/b73cfd26c91b45e1c1dcb9ff70634b5240e442c3/motto.go#L121-L125 |
137,742 | ddliu/motto | motto.go | AddModule | func AddModule(id string, m ModuleLoader) {
globalMu.Lock()
globalModules[id] = m
globalMu.Unlock()
} | go | func AddModule(id string, m ModuleLoader) {
globalMu.Lock()
globalModules[id] = m
globalMu.Unlock()
} | [
"func",
"AddModule",
"(",
"id",
"string",
",",
"m",
"ModuleLoader",
")",
"{",
"globalMu",
".",
"Lock",
"(",
")",
"\n",
"globalModules",
"[",
"id",
"]",
"=",
"m",
"\n",
"globalMu",
".",
"Unlock",
"(",
")",
"\n",
"}"
] | // AddModule registers global module | [
"AddModule",
"registers",
"global",
"module"
] | b73cfd26c91b45e1c1dcb9ff70634b5240e442c3 | https://github.com/ddliu/motto/blob/b73cfd26c91b45e1c1dcb9ff70634b5240e442c3/motto.go#L128-L132 |
137,743 | ddliu/motto | motto.go | Module | func Module(id string) ModuleLoader {
globalMu.RLock()
defer globalMu.RUnlock()
return globalModules[id]
} | go | func Module(id string) ModuleLoader {
globalMu.RLock()
defer globalMu.RUnlock()
return globalModules[id]
} | [
"func",
"Module",
"(",
"id",
"string",
")",
"ModuleLoader",
"{",
"globalMu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"globalMu",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"globalModules",
"[",
"id",
"]",
"\n",
"}"
] | // Module returns ModuleLoader for a given ID. | [
"Module",
"returns",
"ModuleLoader",
"for",
"a",
"given",
"ID",
"."
] | b73cfd26c91b45e1c1dcb9ff70634b5240e442c3 | https://github.com/ddliu/motto/blob/b73cfd26c91b45e1c1dcb9ff70634b5240e442c3/motto.go#L135-L140 |
137,744 | ddliu/motto | motto.go | AddPath | func AddPath(paths ...string) {
globalMu.Lock()
globalPaths = append(globalPaths, paths...)
globalMu.Unlock()
} | go | func AddPath(paths ...string) {
globalMu.Lock()
globalPaths = append(globalPaths, paths...)
globalMu.Unlock()
} | [
"func",
"AddPath",
"(",
"paths",
"...",
"string",
")",
"{",
"globalMu",
".",
"Lock",
"(",
")",
"\n",
"globalPaths",
"=",
"append",
"(",
"globalPaths",
",",
"paths",
"...",
")",
"\n",
"globalMu",
".",
"Unlock",
"(",
")",
"\n",
"}"
] | // AddPath registers global path. | [
"AddPath",
"registers",
"global",
"path",
"."
] | b73cfd26c91b45e1c1dcb9ff70634b5240e442c3 | https://github.com/ddliu/motto/blob/b73cfd26c91b45e1c1dcb9ff70634b5240e442c3/motto.go#L143-L147 |
137,745 | ddliu/motto | motto.go | Run | func Run(name string) (*Motto, otto.Value, error) {
vm := New()
v, err := vm.Run(name)
return vm, v, err
} | go | func Run(name string) (*Motto, otto.Value, error) {
vm := New()
v, err := vm.Run(name)
return vm, v, err
} | [
"func",
"Run",
"(",
"name",
"string",
")",
"(",
"*",
"Motto",
",",
"otto",
".",
"Value",
",",
"error",
")",
"{",
"vm",
":=",
"New",
"(",
")",
"\n",
"v",
",",
"err",
":=",
"vm",
".",
"Run",
"(",
"name",
")",
"\n\n",
"return",
"vm",
",",
"v",
... | // Run module by name in the motto module environment. | [
"Run",
"module",
"by",
"name",
"in",
"the",
"motto",
"module",
"environment",
"."
] | b73cfd26c91b45e1c1dcb9ff70634b5240e442c3 | https://github.com/ddliu/motto/blob/b73cfd26c91b45e1c1dcb9ff70634b5240e442c3/motto.go#L150-L155 |
137,746 | ddliu/motto | motto.go | New | func New() *Motto {
return &Motto{
Otto: otto.New(),
modules: make(map[string]ModuleLoader),
moduleCache: make(map[string]otto.Value),
}
} | go | func New() *Motto {
return &Motto{
Otto: otto.New(),
modules: make(map[string]ModuleLoader),
moduleCache: make(map[string]otto.Value),
}
} | [
"func",
"New",
"(",
")",
"*",
"Motto",
"{",
"return",
"&",
"Motto",
"{",
"Otto",
":",
"otto",
".",
"New",
"(",
")",
",",
"modules",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"ModuleLoader",
")",
",",
"moduleCache",
":",
"make",
"(",
"map",
"["... | // New creates a new motto vm instance. | [
"New",
"creates",
"a",
"new",
"motto",
"vm",
"instance",
"."
] | b73cfd26c91b45e1c1dcb9ff70634b5240e442c3 | https://github.com/ddliu/motto/blob/b73cfd26c91b45e1c1dcb9ff70634b5240e442c3/motto.go#L158-L164 |
137,747 | asergeyev/nradix | tree.go | DeleteWholeRangeCIDR | func (tree *Tree) DeleteWholeRangeCIDR(cidr string) error {
return tree.DeleteWholeRangeCIDRb([]byte(cidr))
} | go | func (tree *Tree) DeleteWholeRangeCIDR(cidr string) error {
return tree.DeleteWholeRangeCIDRb([]byte(cidr))
} | [
"func",
"(",
"tree",
"*",
"Tree",
")",
"DeleteWholeRangeCIDR",
"(",
"cidr",
"string",
")",
"error",
"{",
"return",
"tree",
".",
"DeleteWholeRangeCIDRb",
"(",
"[",
"]",
"byte",
"(",
"cidr",
")",
")",
"\n",
"}"
] | // DeleteWholeRangeCIDR removes all values associated with IPs
// in the entire subnet specified by the CIDR. | [
"DeleteWholeRangeCIDR",
"removes",
"all",
"values",
"associated",
"with",
"IPs",
"in",
"the",
"entire",
"subnet",
"specified",
"by",
"the",
"CIDR",
"."
] | 3872ab85bb568d5400c3f53ac4d903744b2c8ea9 | https://github.com/asergeyev/nradix/blob/3872ab85bb568d5400c3f53ac4d903744b2c8ea9/tree.go#L111-L113 |
137,748 | asergeyev/nradix | tree.go | FindCIDR | func (tree *Tree) FindCIDR(cidr string) (interface{}, error) {
return tree.FindCIDRb([]byte(cidr))
} | go | func (tree *Tree) FindCIDR(cidr string) (interface{}, error) {
return tree.FindCIDRb([]byte(cidr))
} | [
"func",
"(",
"tree",
"*",
"Tree",
")",
"FindCIDR",
"(",
"cidr",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"return",
"tree",
".",
"FindCIDRb",
"(",
"[",
"]",
"byte",
"(",
"cidr",
")",
")",
"\n",
"}"
] | // Find CIDR traverses tree to proper Node and returns previously saved information in longest covered IP. | [
"Find",
"CIDR",
"traverses",
"tree",
"to",
"proper",
"Node",
"and",
"returns",
"previously",
"saved",
"information",
"in",
"longest",
"covered",
"IP",
"."
] | 3872ab85bb568d5400c3f53ac4d903744b2c8ea9 | https://github.com/asergeyev/nradix/blob/3872ab85bb568d5400c3f53ac4d903744b2c8ea9/tree.go#L151-L153 |
137,749 | doneland/yquotes | yquotes.go | GetPrice | func GetPrice(symbol string) (*Price, error) {
data, err := loadSingleStockPrice(symbol)
if err != nil {
return nil, err
}
price := parsePrice(data)
return price, nil
} | go | func GetPrice(symbol string) (*Price, error) {
data, err := loadSingleStockPrice(symbol)
if err != nil {
return nil, err
}
price := parsePrice(data)
return price, nil
} | [
"func",
"GetPrice",
"(",
"symbol",
"string",
")",
"(",
"*",
"Price",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"loadSingleStockPrice",
"(",
"symbol",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
... | // Get single stock price data. | [
"Get",
"single",
"stock",
"price",
"data",
"."
] | 12a8815112a7d135dff0c61b8f8acbabe3dd4034 | https://github.com/doneland/yquotes/blob/12a8815112a7d135dff0c61b8f8acbabe3dd4034/yquotes.go#L124-L132 |
137,750 | doneland/yquotes | yquotes.go | GetPriceForDate | func GetPriceForDate(symbol string, date time.Time) (PriceH, error) {
var price PriceH
// We need to get price information for single date, so date passed to
// this function will be used both for "from" and "to" arguments.
data, err := loadHistoricalPrice(symbol, date, date, Daily)
if err != nil {
return price,... | go | func GetPriceForDate(symbol string, date time.Time) (PriceH, error) {
var price PriceH
// We need to get price information for single date, so date passed to
// this function will be used both for "from" and "to" arguments.
data, err := loadHistoricalPrice(symbol, date, date, Daily)
if err != nil {
return price,... | [
"func",
"GetPriceForDate",
"(",
"symbol",
"string",
",",
"date",
"time",
".",
"Time",
")",
"(",
"PriceH",
",",
"error",
")",
"{",
"var",
"price",
"PriceH",
"\n",
"// We need to get price information for single date, so date passed to",
"// this function will be used both ... | // Get single stock price for certain date. | [
"Get",
"single",
"stock",
"price",
"for",
"certain",
"date",
"."
] | 12a8815112a7d135dff0c61b8f8acbabe3dd4034 | https://github.com/doneland/yquotes/blob/12a8815112a7d135dff0c61b8f8acbabe3dd4034/yquotes.go#L135-L152 |
137,751 | doneland/yquotes | yquotes.go | GetDailyHistory | func GetDailyHistory(symbol string, from, to time.Time) ([]PriceH, error) {
var prices []PriceH
// Create URL with daily frequency of data.
data, err := loadHistoricalPrice(symbol, from, to, Daily)
if err != nil {
return prices, err
}
prices, err = parseHistorical(data)
if err != nil {
return prices, err
}... | go | func GetDailyHistory(symbol string, from, to time.Time) ([]PriceH, error) {
var prices []PriceH
// Create URL with daily frequency of data.
data, err := loadHistoricalPrice(symbol, from, to, Daily)
if err != nil {
return prices, err
}
prices, err = parseHistorical(data)
if err != nil {
return prices, err
}... | [
"func",
"GetDailyHistory",
"(",
"symbol",
"string",
",",
"from",
",",
"to",
"time",
".",
"Time",
")",
"(",
"[",
"]",
"PriceH",
",",
"error",
")",
"{",
"var",
"prices",
"[",
"]",
"PriceH",
"\n",
"// Create URL with daily frequency of data.",
"data",
",",
"e... | // Get historical prices for the stock. | [
"Get",
"historical",
"prices",
"for",
"the",
"stock",
"."
] | 12a8815112a7d135dff0c61b8f8acbabe3dd4034 | https://github.com/doneland/yquotes/blob/12a8815112a7d135dff0c61b8f8acbabe3dd4034/yquotes.go#L155-L169 |
137,752 | doneland/yquotes | yquotes.go | HistoryForYears | func HistoryForYears(symbol string, years int, period string) ([]PriceH, error) {
var prices []PriceH
duration := time.Duration(int64(time.Hour) * 24 * 365 * int64(years))
to := time.Now()
from := to.Add(-duration)
data, err := loadHistoricalPrice(symbol, from, to, period)
if err != nil {
return prices, err
}... | go | func HistoryForYears(symbol string, years int, period string) ([]PriceH, error) {
var prices []PriceH
duration := time.Duration(int64(time.Hour) * 24 * 365 * int64(years))
to := time.Now()
from := to.Add(-duration)
data, err := loadHistoricalPrice(symbol, from, to, period)
if err != nil {
return prices, err
}... | [
"func",
"HistoryForYears",
"(",
"symbol",
"string",
",",
"years",
"int",
",",
"period",
"string",
")",
"(",
"[",
"]",
"PriceH",
",",
"error",
")",
"{",
"var",
"prices",
"[",
"]",
"PriceH",
"\n",
"duration",
":=",
"time",
".",
"Duration",
"(",
"int64",
... | // Get stock price history for number of years backwards. | [
"Get",
"stock",
"price",
"history",
"for",
"number",
"of",
"years",
"backwards",
"."
] | 12a8815112a7d135dff0c61b8f8acbabe3dd4034 | https://github.com/doneland/yquotes/blob/12a8815112a7d135dff0c61b8f8acbabe3dd4034/yquotes.go#L172-L189 |
137,753 | doneland/yquotes | yquotes.go | loadSingleStockPrice | func loadSingleStockPrice(symbol string) ([]string, error) {
url := singleStockUrl(symbol)
resp, err := http.Get(url)
if err != nil {
return nil, err
}
defer resp.Body.Close()
reader := csv.NewReader(resp.Body)
data, err := reader.Read()
if err != nil {
return nil, err
}
return data, err
} | go | func loadSingleStockPrice(symbol string) ([]string, error) {
url := singleStockUrl(symbol)
resp, err := http.Get(url)
if err != nil {
return nil, err
}
defer resp.Body.Close()
reader := csv.NewReader(resp.Body)
data, err := reader.Read()
if err != nil {
return nil, err
}
return data, err
} | [
"func",
"loadSingleStockPrice",
"(",
"symbol",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"url",
":=",
"singleStockUrl",
"(",
"symbol",
")",
"\n",
"resp",
",",
"err",
":=",
"http",
".",
"Get",
"(",
"url",
")",
"\n",
"if",
"err",
... | // Single company data request to Yahoo Finance. | [
"Single",
"company",
"data",
"request",
"to",
"Yahoo",
"Finance",
"."
] | 12a8815112a7d135dff0c61b8f8acbabe3dd4034 | https://github.com/doneland/yquotes/blob/12a8815112a7d135dff0c61b8f8acbabe3dd4034/yquotes.go#L192-L207 |
137,754 | doneland/yquotes | yquotes.go | loadHistoricalPrice | func loadHistoricalPrice(symbol string, from, to time.Time, period string) ([][]string, error) {
url := stockHistoryURL(symbol, from, to, period)
var data [][]string
resp, err := http.Get(url)
if err != nil {
return data, err
}
defer resp.Body.Close()
reader := csv.NewReader(resp.Body)
data, err = reader.Re... | go | func loadHistoricalPrice(symbol string, from, to time.Time, period string) ([][]string, error) {
url := stockHistoryURL(symbol, from, to, period)
var data [][]string
resp, err := http.Get(url)
if err != nil {
return data, err
}
defer resp.Body.Close()
reader := csv.NewReader(resp.Body)
data, err = reader.Re... | [
"func",
"loadHistoricalPrice",
"(",
"symbol",
"string",
",",
"from",
",",
"to",
"time",
".",
"Time",
",",
"period",
"string",
")",
"(",
"[",
"]",
"[",
"]",
"string",
",",
"error",
")",
"{",
"url",
":=",
"stockHistoryURL",
"(",
"symbol",
",",
"from",
... | // Load historical data price. | [
"Load",
"historical",
"data",
"price",
"."
] | 12a8815112a7d135dff0c61b8f8acbabe3dd4034 | https://github.com/doneland/yquotes/blob/12a8815112a7d135dff0c61b8f8acbabe3dd4034/yquotes.go#L210-L227 |
137,755 | doneland/yquotes | yquotes.go | singleStockUrl | func singleStockUrl(symbol string) string {
url := fmt.Sprintf(YURL, symbol, BaseFormat)
return url
} | go | func singleStockUrl(symbol string) string {
url := fmt.Sprintf(YURL, symbol, BaseFormat)
return url
} | [
"func",
"singleStockUrl",
"(",
"symbol",
"string",
")",
"string",
"{",
"url",
":=",
"fmt",
".",
"Sprintf",
"(",
"YURL",
",",
"symbol",
",",
"BaseFormat",
")",
"\n",
"return",
"url",
"\n",
"}"
] | // Generate request URL for single stock. | [
"Generate",
"request",
"URL",
"for",
"single",
"stock",
"."
] | 12a8815112a7d135dff0c61b8f8acbabe3dd4034 | https://github.com/doneland/yquotes/blob/12a8815112a7d135dff0c61b8f8acbabe3dd4034/yquotes.go#L230-L233 |
137,756 | doneland/yquotes | yquotes.go | stockHistoryURL | func stockHistoryURL(symbol string, from, to time.Time, frequency string) string {
// From date
fMonth := (from.Month() - 1) // Need to subtract 1 because months in query is 0 based.
fDay := from.Day()
fYear := from.Year()
// To date
tMonth := (to.Month() - 1)
tDay := to.Day()
tYear := to.Year()
url := fmt.Sp... | go | func stockHistoryURL(symbol string, from, to time.Time, frequency string) string {
// From date
fMonth := (from.Month() - 1) // Need to subtract 1 because months in query is 0 based.
fDay := from.Day()
fYear := from.Year()
// To date
tMonth := (to.Month() - 1)
tDay := to.Day()
tYear := to.Year()
url := fmt.Sp... | [
"func",
"stockHistoryURL",
"(",
"symbol",
"string",
",",
"from",
",",
"to",
"time",
".",
"Time",
",",
"frequency",
"string",
")",
"string",
"{",
"// From date",
"fMonth",
":=",
"(",
"from",
".",
"Month",
"(",
")",
"-",
"1",
")",
"// Need to subtract 1 beca... | // Generate request URL for historicat stock data. | [
"Generate",
"request",
"URL",
"for",
"historicat",
"stock",
"data",
"."
] | 12a8815112a7d135dff0c61b8f8acbabe3dd4034 | https://github.com/doneland/yquotes/blob/12a8815112a7d135dff0c61b8f8acbabe3dd4034/yquotes.go#L236-L258 |
137,757 | doneland/yquotes | yquotes.go | parseStock | func parseStock(data []string) *Stock {
s := &Stock{
Symbol: data[0],
Name: data[1],
Price: parsePrice(data),
}
return s
} | go | func parseStock(data []string) *Stock {
s := &Stock{
Symbol: data[0],
Name: data[1],
Price: parsePrice(data),
}
return s
} | [
"func",
"parseStock",
"(",
"data",
"[",
"]",
"string",
")",
"*",
"Stock",
"{",
"s",
":=",
"&",
"Stock",
"{",
"Symbol",
":",
"data",
"[",
"0",
"]",
",",
"Name",
":",
"data",
"[",
"1",
"]",
",",
"Price",
":",
"parsePrice",
"(",
"data",
")",
",",
... | // Parse base information of stock price. Base inforamtion is reperesented by
// request format BaseFormat. | [
"Parse",
"base",
"information",
"of",
"stock",
"price",
".",
"Base",
"inforamtion",
"is",
"reperesented",
"by",
"request",
"format",
"BaseFormat",
"."
] | 12a8815112a7d135dff0c61b8f8acbabe3dd4034 | https://github.com/doneland/yquotes/blob/12a8815112a7d135dff0c61b8f8acbabe3dd4034/yquotes.go#L262-L270 |
137,758 | doneland/yquotes | yquotes.go | parseHistorical | func parseHistorical(data [][]string) ([]PriceH, error) {
// This is the list of prices with allocated space. Length of space should
// subtracted by 1 because the first row of data is title.
var list = make([]PriceH, len(data)-1)
// We need to leave the first row, because it contains title of columns.
for k, v :=... | go | func parseHistorical(data [][]string) ([]PriceH, error) {
// This is the list of prices with allocated space. Length of space should
// subtracted by 1 because the first row of data is title.
var list = make([]PriceH, len(data)-1)
// We need to leave the first row, because it contains title of columns.
for k, v :=... | [
"func",
"parseHistorical",
"(",
"data",
"[",
"]",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"PriceH",
",",
"error",
")",
"{",
"// This is the list of prices with allocated space. Length of space should",
"// subtracted by 1 because the first row of data is title.",
"var",
"li... | // Parse collection of historical prices. | [
"Parse",
"collection",
"of",
"historical",
"prices",
"."
] | 12a8815112a7d135dff0c61b8f8acbabe3dd4034 | https://github.com/doneland/yquotes/blob/12a8815112a7d135dff0c61b8f8acbabe3dd4034/yquotes.go#L273-L293 |
137,759 | doneland/yquotes | yquotes.go | parseDate | func parseDate(date string) (time.Time, error) {
d, err := time.Parse("1/2/2006", date)
if err != nil {
return time.Time{}, err
}
return d, nil
} | go | func parseDate(date string) (time.Time, error) {
d, err := time.Parse("1/2/2006", date)
if err != nil {
return time.Time{}, err
}
return d, nil
} | [
"func",
"parseDate",
"(",
"date",
"string",
")",
"(",
"time",
".",
"Time",
",",
"error",
")",
"{",
"d",
",",
"err",
":=",
"time",
".",
"Parse",
"(",
"\"",
"\"",
",",
"date",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"time",
".",
"Time... | // Parse date from string into time.Time type. | [
"Parse",
"date",
"from",
"string",
"into",
"time",
".",
"Time",
"type",
"."
] | 12a8815112a7d135dff0c61b8f8acbabe3dd4034 | https://github.com/doneland/yquotes/blob/12a8815112a7d135dff0c61b8f8acbabe3dd4034/yquotes.go#L326-L333 |
137,760 | doneland/yquotes | yquotes.go | parsePrice | func parsePrice(data []string) *Price {
p := &Price{}
p.Bid, _ = strconv.ParseFloat(data[2], 64)
p.Ask, _ = strconv.ParseFloat(data[3], 64)
p.Open, _ = strconv.ParseFloat(data[4], 64)
p.PreviousClose, _ = strconv.ParseFloat(data[5], 64)
p.Last, _ = strconv.ParseFloat(data[6], 64)
p.Date, _ = parseDate(data[7])
... | go | func parsePrice(data []string) *Price {
p := &Price{}
p.Bid, _ = strconv.ParseFloat(data[2], 64)
p.Ask, _ = strconv.ParseFloat(data[3], 64)
p.Open, _ = strconv.ParseFloat(data[4], 64)
p.PreviousClose, _ = strconv.ParseFloat(data[5], 64)
p.Last, _ = strconv.ParseFloat(data[6], 64)
p.Date, _ = parseDate(data[7])
... | [
"func",
"parsePrice",
"(",
"data",
"[",
"]",
"string",
")",
"*",
"Price",
"{",
"p",
":=",
"&",
"Price",
"{",
"}",
"\n",
"p",
".",
"Bid",
",",
"_",
"=",
"strconv",
".",
"ParseFloat",
"(",
"data",
"[",
"2",
"]",
",",
"64",
")",
"\n",
"p",
".",
... | // Parse price information from base data. | [
"Parse",
"price",
"information",
"from",
"base",
"data",
"."
] | 12a8815112a7d135dff0c61b8f8acbabe3dd4034 | https://github.com/doneland/yquotes/blob/12a8815112a7d135dff0c61b8f8acbabe3dd4034/yquotes.go#L336-L346 |
137,761 | pusher-community/pusher-websocket-go | client.go | New | func New(key string) *Client {
config := ClientConfig{
Scheme: defaultScheme,
Host: defaultHost,
Port: defaultPort,
Key: key,
}
return NewWithConfig(config)
} | go | func New(key string) *Client {
config := ClientConfig{
Scheme: defaultScheme,
Host: defaultHost,
Port: defaultPort,
Key: key,
}
return NewWithConfig(config)
} | [
"func",
"New",
"(",
"key",
"string",
")",
"*",
"Client",
"{",
"config",
":=",
"ClientConfig",
"{",
"Scheme",
":",
"defaultScheme",
",",
"Host",
":",
"defaultHost",
",",
"Port",
":",
"defaultPort",
",",
"Key",
":",
"key",
",",
"}",
"\n",
"return",
"NewW... | // New creates a new Pusher client with given Pusher application key | [
"New",
"creates",
"a",
"new",
"Pusher",
"client",
"with",
"given",
"Pusher",
"application",
"key"
] | d33b2ac886afad95e380123908bcb9c6c52459ae | https://github.com/pusher-community/pusher-websocket-go/blob/d33b2ac886afad95e380123908bcb9c6c52459ae/client.go#L63-L71 |
137,762 | pusher-community/pusher-websocket-go | client.go | NewWithConfig | func NewWithConfig(c ClientConfig) *Client {
client := &Client{
ClientConfig: c,
bindings: make(chanbindings),
globalBindings: map[*func(string, string, interface{})]struct{}{},
_subscribe: make(chan *Channel),
_unsubscribe: make(chan string),
_disconnect: make(chan bool),
Channels: make([]*Ch... | go | func NewWithConfig(c ClientConfig) *Client {
client := &Client{
ClientConfig: c,
bindings: make(chanbindings),
globalBindings: map[*func(string, string, interface{})]struct{}{},
_subscribe: make(chan *Channel),
_unsubscribe: make(chan string),
_disconnect: make(chan bool),
Channels: make([]*Ch... | [
"func",
"NewWithConfig",
"(",
"c",
"ClientConfig",
")",
"*",
"Client",
"{",
"client",
":=",
"&",
"Client",
"{",
"ClientConfig",
":",
"c",
",",
"bindings",
":",
"make",
"(",
"chanbindings",
")",
",",
"globalBindings",
":",
"map",
"[",
"*",
"func",
"(",
... | // NewWithConfig allows creating a new Pusher client which connects to a custom endpoint | [
"NewWithConfig",
"allows",
"creating",
"a",
"new",
"Pusher",
"client",
"which",
"connects",
"to",
"a",
"custom",
"endpoint"
] | d33b2ac886afad95e380123908bcb9c6c52459ae | https://github.com/pusher-community/pusher-websocket-go/blob/d33b2ac886afad95e380123908bcb9c6c52459ae/client.go#L74-L86 |
137,763 | pusher-community/pusher-websocket-go | client.go | Subscribe | func (self *Client) Subscribe(channel string) (ch *Channel) {
for _, ch := range self.Channels {
if ch.Name == channel {
self._subscribe <- ch
return ch
}
}
ch = &Channel{Name: channel, bindings: &self.bindings}
self._subscribe <- ch
return
} | go | func (self *Client) Subscribe(channel string) (ch *Channel) {
for _, ch := range self.Channels {
if ch.Name == channel {
self._subscribe <- ch
return ch
}
}
ch = &Channel{Name: channel, bindings: &self.bindings}
self._subscribe <- ch
return
} | [
"func",
"(",
"self",
"*",
"Client",
")",
"Subscribe",
"(",
"channel",
"string",
")",
"(",
"ch",
"*",
"Channel",
")",
"{",
"for",
"_",
",",
"ch",
":=",
"range",
"self",
".",
"Channels",
"{",
"if",
"ch",
".",
"Name",
"==",
"channel",
"{",
"self",
"... | // Subscribe subscribes the client to the channel | [
"Subscribe",
"subscribes",
"the",
"client",
"to",
"the",
"channel"
] | d33b2ac886afad95e380123908bcb9c6c52459ae | https://github.com/pusher-community/pusher-websocket-go/blob/d33b2ac886afad95e380123908bcb9c6c52459ae/client.go#L93-L103 |
137,764 | sotetsuk/goscholar | parse.go | ParseDocument | func ParseDocument(ch chan *Article, doc *goquery.Document) {
defer close(ch)
parse := func(i int, s *goquery.Selection) {
a, err := ParseSelection(s)
if err != nil {
log.Error(err)
return
}
ch <- a
}
doc.Find(whole_article_selector).Each(parse)
} | go | func ParseDocument(ch chan *Article, doc *goquery.Document) {
defer close(ch)
parse := func(i int, s *goquery.Selection) {
a, err := ParseSelection(s)
if err != nil {
log.Error(err)
return
}
ch <- a
}
doc.Find(whole_article_selector).Each(parse)
} | [
"func",
"ParseDocument",
"(",
"ch",
"chan",
"*",
"Article",
",",
"doc",
"*",
"goquery",
".",
"Document",
")",
"{",
"defer",
"close",
"(",
"ch",
")",
"\n\n",
"parse",
":=",
"func",
"(",
"i",
"int",
",",
"s",
"*",
"goquery",
".",
"Selection",
")",
"{... | // ParseDocument sends the pointers of parsed Articles to the given channel.
// The channel will be closed if there are no articles to be sent. | [
"ParseDocument",
"sends",
"the",
"pointers",
"of",
"parsed",
"Articles",
"to",
"the",
"given",
"channel",
".",
"The",
"channel",
"will",
"be",
"closed",
"if",
"there",
"are",
"no",
"articles",
"to",
"be",
"sent",
"."
] | a65dff4595e8cc3c9f076063298f0a49a0e00ad0 | https://github.com/sotetsuk/goscholar/blob/a65dff4595e8cc3c9f076063298f0a49a0e00ad0/parse.go#L16-L28 |
137,765 | sotetsuk/goscholar | parse.go | parseH3 | func parseH3(s *goquery.Selection) (title *Title) {
title = &Title{}
h3 := s.Find(article_h3_selector)
url, exists := h3.Attr("href")
if exists {
title.Url = url
title.Name = h3.Text()
} else {
name := s.Find("h3").Text()
rep, _ := regexp.Compile("\\[[a-zA-Z0-9]*\\]\\[[a-zA-Z0-9]*\\]\\s")
title.Name = r... | go | func parseH3(s *goquery.Selection) (title *Title) {
title = &Title{}
h3 := s.Find(article_h3_selector)
url, exists := h3.Attr("href")
if exists {
title.Url = url
title.Name = h3.Text()
} else {
name := s.Find("h3").Text()
rep, _ := regexp.Compile("\\[[a-zA-Z0-9]*\\]\\[[a-zA-Z0-9]*\\]\\s")
title.Name = r... | [
"func",
"parseH3",
"(",
"s",
"*",
"goquery",
".",
"Selection",
")",
"(",
"title",
"*",
"Title",
")",
"{",
"title",
"=",
"&",
"Title",
"{",
"}",
"\n",
"h3",
":=",
"s",
".",
"Find",
"(",
"article_h3_selector",
")",
"\n",
"url",
",",
"exists",
":=",
... | // parseH3 an article title and its link | [
"parseH3",
"an",
"article",
"title",
"and",
"its",
"link"
] | a65dff4595e8cc3c9f076063298f0a49a0e00ad0 | https://github.com/sotetsuk/goscholar/blob/a65dff4595e8cc3c9f076063298f0a49a0e00ad0/parse.go#L85-L100 |
137,766 | sotetsuk/goscholar | parse.go | parseGreenLine | func parseGreenLine(s *goquery.Selection) (year string) {
year = parseYearText(s.Find(article_green_line_selector).Text())
return year
} | go | func parseGreenLine(s *goquery.Selection) (year string) {
year = parseYearText(s.Find(article_green_line_selector).Text())
return year
} | [
"func",
"parseGreenLine",
"(",
"s",
"*",
"goquery",
".",
"Selection",
")",
"(",
"year",
"string",
")",
"{",
"year",
"=",
"parseYearText",
"(",
"s",
".",
"Find",
"(",
"article_green_line_selector",
")",
".",
"Text",
"(",
")",
")",
"\n\n",
"return",
"year"... | // parseGreenLine parse article published year | [
"parseGreenLine",
"parse",
"article",
"published",
"year"
] | a65dff4595e8cc3c9f076063298f0a49a0e00ad0 | https://github.com/sotetsuk/goscholar/blob/a65dff4595e8cc3c9f076063298f0a49a0e00ad0/parse.go#L103-L107 |
137,767 | sotetsuk/goscholar | parse.go | parseBottom | func parseBottom(s *goquery.Selection) (clusterId, numCite, numVer, infoId string) {
divFooter := s.Find(article_bottom_selector)
parseFooter := func(i int, s *goquery.Selection) {
href, _ := s.Attr("href")
text := s.Text()
if strings.HasPrefix(href, "/scholar?cites") {
clusterId = parseClusterIdText(href)... | go | func parseBottom(s *goquery.Selection) (clusterId, numCite, numVer, infoId string) {
divFooter := s.Find(article_bottom_selector)
parseFooter := func(i int, s *goquery.Selection) {
href, _ := s.Attr("href")
text := s.Text()
if strings.HasPrefix(href, "/scholar?cites") {
clusterId = parseClusterIdText(href)... | [
"func",
"parseBottom",
"(",
"s",
"*",
"goquery",
".",
"Selection",
")",
"(",
"clusterId",
",",
"numCite",
",",
"numVer",
",",
"infoId",
"string",
")",
"{",
"divFooter",
":=",
"s",
".",
"Find",
"(",
"article_bottom_selector",
")",
"\n",
"parseFooter",
":=",... | // parseBottom parse the line under the abstract | [
"parseBottom",
"parse",
"the",
"line",
"under",
"the",
"abstract"
] | a65dff4595e8cc3c9f076063298f0a49a0e00ad0 | https://github.com/sotetsuk/goscholar/blob/a65dff4595e8cc3c9f076063298f0a49a0e00ad0/parse.go#L110-L132 |
137,768 | sotetsuk/goscholar | parse.go | parseSideBar | func parseSideBar(s *goquery.Selection) (link *Link) {
link = &Link{}
sideBarA := s.Find(article_sidebar_selector)
url, exists := sideBarA.Attr("href")
if !exists {
return link
}
link.Url = url
link.Name, link.Format = parseLinkText(sideBarA.Find(sidebar_text_selector).Text())
return link
} | go | func parseSideBar(s *goquery.Selection) (link *Link) {
link = &Link{}
sideBarA := s.Find(article_sidebar_selector)
url, exists := sideBarA.Attr("href")
if !exists {
return link
}
link.Url = url
link.Name, link.Format = parseLinkText(sideBarA.Find(sidebar_text_selector).Text())
return link
} | [
"func",
"parseSideBar",
"(",
"s",
"*",
"goquery",
".",
"Selection",
")",
"(",
"link",
"*",
"Link",
")",
"{",
"link",
"=",
"&",
"Link",
"{",
"}",
"\n\n",
"sideBarA",
":=",
"s",
".",
"Find",
"(",
"article_sidebar_selector",
")",
"\n",
"url",
",",
"exis... | // parseSideBar parse the right side link | [
"parseSideBar",
"parse",
"the",
"right",
"side",
"link"
] | a65dff4595e8cc3c9f076063298f0a49a0e00ad0 | https://github.com/sotetsuk/goscholar/blob/a65dff4595e8cc3c9f076063298f0a49a0e00ad0/parse.go#L135-L148 |
137,769 | sotetsuk/goscholar | fetch.go | Fetch | func Fetch(url string) (doc *goquery.Document, err error) {
log.WithFields(log.Fields{"url": url}).Info("Fetch sends request")
// set request
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.WithFields(log.Fields{"url": url, "err": err}).Error("Failed to generate new request")
return nil, err
... | go | func Fetch(url string) (doc *goquery.Document, err error) {
log.WithFields(log.Fields{"url": url}).Info("Fetch sends request")
// set request
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.WithFields(log.Fields{"url": url, "err": err}).Error("Failed to generate new request")
return nil, err
... | [
"func",
"Fetch",
"(",
"url",
"string",
")",
"(",
"doc",
"*",
"goquery",
".",
"Document",
",",
"err",
"error",
")",
"{",
"log",
".",
"WithFields",
"(",
"log",
".",
"Fields",
"{",
"\"",
"\"",
":",
"url",
"}",
")",
".",
"Info",
"(",
"\"",
"\"",
")... | // Fetch gets a Document from a given URL. For usage, see the example of Overview. | [
"Fetch",
"gets",
"a",
"Document",
"from",
"a",
"given",
"URL",
".",
"For",
"usage",
"see",
"the",
"example",
"of",
"Overview",
"."
] | a65dff4595e8cc3c9f076063298f0a49a0e00ad0 | https://github.com/sotetsuk/goscholar/blob/a65dff4595e8cc3c9f076063298f0a49a0e00ad0/fetch.go#L12-L53 |
137,770 | sotetsuk/goscholar | article.go | newArticle | func newArticle() *Article {
a := &Article{}
title := &Title{}
link := &Link{}
a.Title = title
a.Link = link
return a
} | go | func newArticle() *Article {
a := &Article{}
title := &Title{}
link := &Link{}
a.Title = title
a.Link = link
return a
} | [
"func",
"newArticle",
"(",
")",
"*",
"Article",
"{",
"a",
":=",
"&",
"Article",
"{",
"}",
"\n",
"title",
":=",
"&",
"Title",
"{",
"}",
"\n",
"link",
":=",
"&",
"Link",
"{",
"}",
"\n\n",
"a",
".",
"Title",
"=",
"title",
"\n",
"a",
".",
"Link",
... | // NewArticle creates an Article in which all entry is blank. | [
"NewArticle",
"creates",
"an",
"Article",
"in",
"which",
"all",
"entry",
"is",
"blank",
"."
] | a65dff4595e8cc3c9f076063298f0a49a0e00ad0 | https://github.com/sotetsuk/goscholar/blob/a65dff4595e8cc3c9f076063298f0a49a0e00ad0/article.go#L44-L53 |
137,771 | sotetsuk/goscholar | article.go | Json | func (a *Article) Json() string {
bytes, err := json.Marshal(a)
if err != nil {
log.WithFields(log.Fields{"a": a, "err": err}).Error("Json encoding failed")
}
return string(bytes)
} | go | func (a *Article) Json() string {
bytes, err := json.Marshal(a)
if err != nil {
log.WithFields(log.Fields{"a": a, "err": err}).Error("Json encoding failed")
}
return string(bytes)
} | [
"func",
"(",
"a",
"*",
"Article",
")",
"Json",
"(",
")",
"string",
"{",
"bytes",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"a",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"WithFields",
"(",
"log",
".",
"Fields",
"{",
"\"",
"\"",... | // Json provides JSON formatted Article. | [
"Json",
"provides",
"JSON",
"formatted",
"Article",
"."
] | a65dff4595e8cc3c9f076063298f0a49a0e00ad0 | https://github.com/sotetsuk/goscholar/blob/a65dff4595e8cc3c9f076063298f0a49a0e00ad0/article.go#L61-L67 |
137,772 | sotetsuk/goscholar | article.go | isValid | func (a *Article) isValid() bool { // TODO: fix (return error w/ message)
// avoid author-contamination. See #29 for details.
title_validation := strings.HasPrefix(a.Title.Name, "User profiles for")
url_validation := strings.HasPrefix(a.Title.Url, "/citations?view_op=search_authors")
if title_validation && url_vali... | go | func (a *Article) isValid() bool { // TODO: fix (return error w/ message)
// avoid author-contamination. See #29 for details.
title_validation := strings.HasPrefix(a.Title.Name, "User profiles for")
url_validation := strings.HasPrefix(a.Title.Url, "/citations?view_op=search_authors")
if title_validation && url_vali... | [
"func",
"(",
"a",
"*",
"Article",
")",
"isValid",
"(",
")",
"bool",
"{",
"// TODO: fix (return error w/ message)",
"// avoid author-contamination. See #29 for details.",
"title_validation",
":=",
"strings",
".",
"HasPrefix",
"(",
"a",
".",
"Title",
".",
"Name",
",",
... | // isValid checks the Article whose attributes have wrong values | [
"isValid",
"checks",
"the",
"Article",
"whose",
"attributes",
"have",
"wrong",
"values"
] | a65dff4595e8cc3c9f076063298f0a49a0e00ad0 | https://github.com/sotetsuk/goscholar/blob/a65dff4595e8cc3c9f076063298f0a49a0e00ad0/article.go#L70-L88 |
137,773 | masci/flickr | photos/photos.go | Delete | func Delete(client *flickr.FlickrClient, id string) (*flickr.BasicResponse, error) {
client.Init()
client.EndpointUrl = flickr.API_ENDPOINT
client.HTTPVerb = "POST"
client.Args.Set("method", "flickr.photos.delete")
client.Args.Set("photo_id", id)
client.OAuthSign()
response := &flickr.BasicResponse{}
err := fl... | go | func Delete(client *flickr.FlickrClient, id string) (*flickr.BasicResponse, error) {
client.Init()
client.EndpointUrl = flickr.API_ENDPOINT
client.HTTPVerb = "POST"
client.Args.Set("method", "flickr.photos.delete")
client.Args.Set("photo_id", id)
client.OAuthSign()
response := &flickr.BasicResponse{}
err := fl... | [
"func",
"Delete",
"(",
"client",
"*",
"flickr",
".",
"FlickrClient",
",",
"id",
"string",
")",
"(",
"*",
"flickr",
".",
"BasicResponse",
",",
"error",
")",
"{",
"client",
".",
"Init",
"(",
")",
"\n",
"client",
".",
"EndpointUrl",
"=",
"flickr",
".",
... | // Delete a photo from Flickr
// This method requires authentication with 'delete' permission. | [
"Delete",
"a",
"photo",
"from",
"Flickr",
"This",
"method",
"requires",
"authentication",
"with",
"delete",
"permission",
"."
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/photos/photos.go#L69-L80 |
137,774 | masci/flickr | photos/photos.go | GetInfo | func GetInfo(client *flickr.FlickrClient, id string, secret string) (*PhotoInfoResponse, error) {
client.Init()
client.EndpointUrl = flickr.API_ENDPOINT
client.HTTPVerb = "POST"
client.Args.Set("method", "flickr.photos.getInfo")
client.Args.Set("photo_id", id)
if secret != "" {
client.Args.Set("secret", secret)... | go | func GetInfo(client *flickr.FlickrClient, id string, secret string) (*PhotoInfoResponse, error) {
client.Init()
client.EndpointUrl = flickr.API_ENDPOINT
client.HTTPVerb = "POST"
client.Args.Set("method", "flickr.photos.getInfo")
client.Args.Set("photo_id", id)
if secret != "" {
client.Args.Set("secret", secret)... | [
"func",
"GetInfo",
"(",
"client",
"*",
"flickr",
".",
"FlickrClient",
",",
"id",
"string",
",",
"secret",
"string",
")",
"(",
"*",
"PhotoInfoResponse",
",",
"error",
")",
"{",
"client",
".",
"Init",
"(",
")",
"\n",
"client",
".",
"EndpointUrl",
"=",
"f... | // Get information about a Flickr photo | [
"Get",
"information",
"about",
"a",
"Flickr",
"photo"
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/photos/photos.go#L83-L97 |
137,775 | masci/flickr | photos/photos.go | SetDates | func SetDates(client *flickr.FlickrClient, id string, datePosted string, dateTaken string) (*flickr.BasicResponse, error) {
client.Init()
client.EndpointUrl = flickr.API_ENDPOINT
client.HTTPVerb = "POST"
client.Args.Set("method", "flickr.photos.setDates")
client.Args.Set("photo_id", id)
if datePosted != "" {
cl... | go | func SetDates(client *flickr.FlickrClient, id string, datePosted string, dateTaken string) (*flickr.BasicResponse, error) {
client.Init()
client.EndpointUrl = flickr.API_ENDPOINT
client.HTTPVerb = "POST"
client.Args.Set("method", "flickr.photos.setDates")
client.Args.Set("photo_id", id)
if datePosted != "" {
cl... | [
"func",
"SetDates",
"(",
"client",
"*",
"flickr",
".",
"FlickrClient",
",",
"id",
"string",
",",
"datePosted",
"string",
",",
"dateTaken",
"string",
")",
"(",
"*",
"flickr",
".",
"BasicResponse",
",",
"error",
")",
"{",
"client",
".",
"Init",
"(",
")",
... | // Set date posted and date taken on a Flickr photo
// datePosted and dateTaken are optional and may be set to "" | [
"Set",
"date",
"posted",
"and",
"date",
"taken",
"on",
"a",
"Flickr",
"photo",
"datePosted",
"and",
"dateTaken",
"are",
"optional",
"and",
"may",
"be",
"set",
"to"
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/photos/photos.go#L101-L118 |
137,776 | masci/flickr | response.go | SetErrorStatus | func (r *BasicResponse) SetErrorStatus(hasErrors bool) {
if hasErrors {
r.Status = "fail"
} else {
r.Status = "ok"
}
} | go | func (r *BasicResponse) SetErrorStatus(hasErrors bool) {
if hasErrors {
r.Status = "fail"
} else {
r.Status = "ok"
}
} | [
"func",
"(",
"r",
"*",
"BasicResponse",
")",
"SetErrorStatus",
"(",
"hasErrors",
"bool",
")",
"{",
"if",
"hasErrors",
"{",
"r",
".",
"Status",
"=",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"r",
".",
"Status",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"}"
] | // Set error status explicitly | [
"Set",
"error",
"status",
"explicitly"
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/response.go#L50-L56 |
137,777 | masci/flickr | response.go | parseApiResponse | func parseApiResponse(res *http.Response, r FlickrResponse) error {
defer res.Body.Close()
responseBody, err := ioutil.ReadAll(res.Body)
if err != nil {
return err
}
err = xml.Unmarshal(responseBody, r)
if err != nil {
// In case of OAuth errors (signature, parameters, etc) Flicker does not
// return a RES... | go | func parseApiResponse(res *http.Response, r FlickrResponse) error {
defer res.Body.Close()
responseBody, err := ioutil.ReadAll(res.Body)
if err != nil {
return err
}
err = xml.Unmarshal(responseBody, r)
if err != nil {
// In case of OAuth errors (signature, parameters, etc) Flicker does not
// return a RES... | [
"func",
"parseApiResponse",
"(",
"res",
"*",
"http",
".",
"Response",
",",
"r",
"FlickrResponse",
")",
"error",
"{",
"defer",
"res",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"responseBody",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"res",
".",... | // Given an http.Response retrieved from Flickr, unmarshal results
// into a FlickrResponse struct. | [
"Given",
"an",
"http",
".",
"Response",
"retrieved",
"from",
"Flickr",
"unmarshal",
"results",
"into",
"a",
"FlickrResponse",
"struct",
"."
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/response.go#L70-L93 |
137,778 | masci/flickr | photosets/photosets.go | GetList | func GetList(client *flickr.FlickrClient, authenticate bool, userId string, page int) (*PhotosetsListResponse, error) {
client.Init()
client.Args.Set("method", "flickr.photosets.getList")
if userId != "" {
client.Args.Set("user_id", userId)
}
// if not provided, flickr defaults this argument to 1
if page > 1 {
... | go | func GetList(client *flickr.FlickrClient, authenticate bool, userId string, page int) (*PhotosetsListResponse, error) {
client.Init()
client.Args.Set("method", "flickr.photosets.getList")
if userId != "" {
client.Args.Set("user_id", userId)
}
// if not provided, flickr defaults this argument to 1
if page > 1 {
... | [
"func",
"GetList",
"(",
"client",
"*",
"flickr",
".",
"FlickrClient",
",",
"authenticate",
"bool",
",",
"userId",
"string",
",",
"page",
"int",
")",
"(",
"*",
"PhotosetsListResponse",
",",
"error",
")",
"{",
"client",
".",
"Init",
"(",
")",
"\n",
"client... | // Return the public sets belonging to the user with userId.
// If userId is not provided it defaults to the caller user but call needs to be authenticated.
// This method requires authentication to retrieve private sets. | [
"Return",
"the",
"public",
"sets",
"belonging",
"to",
"the",
"user",
"with",
"userId",
".",
"If",
"userId",
"is",
"not",
"provided",
"it",
"defaults",
"to",
"the",
"caller",
"user",
"but",
"call",
"needs",
"to",
"be",
"authenticated",
".",
"This",
"method"... | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/photosets/photosets.go#L67-L87 |
137,779 | masci/flickr | photosets/photosets.go | Create | func Create(client *flickr.FlickrClient, title, description, primaryPhotoId string) (*PhotosetResponse, error) {
client.Init()
client.HTTPVerb = "POST"
client.Args.Set("method", "flickr.photosets.create")
client.Args.Set("title", title)
client.Args.Set("description", description)
client.Args.Set("primary_photo_id... | go | func Create(client *flickr.FlickrClient, title, description, primaryPhotoId string) (*PhotosetResponse, error) {
client.Init()
client.HTTPVerb = "POST"
client.Args.Set("method", "flickr.photosets.create")
client.Args.Set("title", title)
client.Args.Set("description", description)
client.Args.Set("primary_photo_id... | [
"func",
"Create",
"(",
"client",
"*",
"flickr",
".",
"FlickrClient",
",",
"title",
",",
"description",
",",
"primaryPhotoId",
"string",
")",
"(",
"*",
"PhotosetResponse",
",",
"error",
")",
"{",
"client",
".",
"Init",
"(",
")",
"\n",
"client",
".",
"HTTP... | // Create a photoset specifying its primary photo
// This method requires authentication with 'write' permission. | [
"Create",
"a",
"photoset",
"specifying",
"its",
"primary",
"photo",
"This",
"method",
"requires",
"authentication",
"with",
"write",
"permission",
"."
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/photosets/photosets.go#L107-L120 |
137,780 | masci/flickr | photosets/photosets.go | GetPhotos | func GetPhotos(client *flickr.FlickrClient, authenticate bool, photosetId, ownerID string, page int) (*PhotosListResponse, error) {
client.Init()
client.Args.Set("method", "flickr.photosets.getPhotos")
client.Args.Set("photoset_id", photosetId)
// this argument is optional but increases query performances
if owner... | go | func GetPhotos(client *flickr.FlickrClient, authenticate bool, photosetId, ownerID string, page int) (*PhotosListResponse, error) {
client.Init()
client.Args.Set("method", "flickr.photosets.getPhotos")
client.Args.Set("photoset_id", photosetId)
// this argument is optional but increases query performances
if owner... | [
"func",
"GetPhotos",
"(",
"client",
"*",
"flickr",
".",
"FlickrClient",
",",
"authenticate",
"bool",
",",
"photosetId",
",",
"ownerID",
"string",
",",
"page",
"int",
")",
"(",
"*",
"PhotosListResponse",
",",
"error",
")",
"{",
"client",
".",
"Init",
"(",
... | // Get the photos in a set
// This method requires authentication to retrieve photos from private sets | [
"Get",
"the",
"photos",
"in",
"a",
"set",
"This",
"method",
"requires",
"authentication",
"to",
"retrieve",
"photos",
"from",
"private",
"sets"
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/photosets/photosets.go#L155-L177 |
137,781 | masci/flickr | photosets/photosets.go | EditMeta | func EditMeta(client *flickr.FlickrClient, photosetId, title, description string) (*flickr.BasicResponse, error) {
client.Init()
client.HTTPVerb = "POST"
client.Args.Set("method", "flickr.photosets.editMeta")
client.Args.Set("photoset_id", photosetId)
client.Args.Set("title", title)
if description != "" {
clien... | go | func EditMeta(client *flickr.FlickrClient, photosetId, title, description string) (*flickr.BasicResponse, error) {
client.Init()
client.HTTPVerb = "POST"
client.Args.Set("method", "flickr.photosets.editMeta")
client.Args.Set("photoset_id", photosetId)
client.Args.Set("title", title)
if description != "" {
clien... | [
"func",
"EditMeta",
"(",
"client",
"*",
"flickr",
".",
"FlickrClient",
",",
"photosetId",
",",
"title",
",",
"description",
"string",
")",
"(",
"*",
"flickr",
".",
"BasicResponse",
",",
"error",
")",
"{",
"client",
".",
"Init",
"(",
")",
"\n",
"client",
... | // Edit set name and description
// This method requires authentication with 'write' permission. | [
"Edit",
"set",
"name",
"and",
"description",
"This",
"method",
"requires",
"authentication",
"with",
"write",
"permission",
"."
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/photosets/photosets.go#L181-L196 |
137,782 | masci/flickr | photosets/photosets.go | EditPhotos | func EditPhotos(client *flickr.FlickrClient, photosetId, primaryId string, photoIds []string) (*flickr.BasicResponse, error) {
client.Init()
client.HTTPVerb = "POST"
client.Args.Set("method", "flickr.photosets.editPhotos")
client.Args.Set("photoset_id", photosetId)
client.Args.Set("primary_photo_id", primaryId)
p... | go | func EditPhotos(client *flickr.FlickrClient, photosetId, primaryId string, photoIds []string) (*flickr.BasicResponse, error) {
client.Init()
client.HTTPVerb = "POST"
client.Args.Set("method", "flickr.photosets.editPhotos")
client.Args.Set("photoset_id", photosetId)
client.Args.Set("primary_photo_id", primaryId)
p... | [
"func",
"EditPhotos",
"(",
"client",
"*",
"flickr",
".",
"FlickrClient",
",",
"photosetId",
",",
"primaryId",
"string",
",",
"photoIds",
"[",
"]",
"string",
")",
"(",
"*",
"flickr",
".",
"BasicResponse",
",",
"error",
")",
"{",
"client",
".",
"Init",
"("... | // Modify the photos in a photoset. Use this method to add, remove and re-order photos.
// This method requires authentication with 'write' permission. | [
"Modify",
"the",
"photos",
"in",
"a",
"photoset",
".",
"Use",
"this",
"method",
"to",
"add",
"remove",
"and",
"re",
"-",
"order",
"photos",
".",
"This",
"method",
"requires",
"authentication",
"with",
"write",
"permission",
"."
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/photosets/photosets.go#L200-L214 |
137,783 | masci/flickr | photosets/photosets.go | GetInfo | func GetInfo(client *flickr.FlickrClient, authenticate bool, photosetId, ownerID string) (*PhotosetResponse, error) {
client.Init()
client.Args.Set("method", "flickr.photosets.getInfo")
client.Args.Set("photoset_id", photosetId)
// this argument is optional but increases query performances
if ownerID != "" {
cli... | go | func GetInfo(client *flickr.FlickrClient, authenticate bool, photosetId, ownerID string) (*PhotosetResponse, error) {
client.Init()
client.Args.Set("method", "flickr.photosets.getInfo")
client.Args.Set("photoset_id", photosetId)
// this argument is optional but increases query performances
if ownerID != "" {
cli... | [
"func",
"GetInfo",
"(",
"client",
"*",
"flickr",
".",
"FlickrClient",
",",
"authenticate",
"bool",
",",
"photosetId",
",",
"ownerID",
"string",
")",
"(",
"*",
"PhotosetResponse",
",",
"error",
")",
"{",
"client",
".",
"Init",
"(",
")",
"\n",
"client",
".... | // Gets information about a photoset.
// This method does not require authentication unless you want to access a private set | [
"Gets",
"information",
"about",
"a",
"photoset",
".",
"This",
"method",
"does",
"not",
"require",
"authentication",
"unless",
"you",
"want",
"to",
"access",
"a",
"private",
"set"
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/photosets/photosets.go#L218-L237 |
137,784 | masci/flickr | photosets/photosets.go | OrderSets | func OrderSets(client *flickr.FlickrClient, photosetIds []string) (*flickr.BasicResponse, error) {
client.Init()
client.HTTPVerb = "POST"
client.Args.Set("method", "flickr.photosets.orderSets")
sets := strings.Join(photosetIds, ",")
client.Args.Set("photoset_ids", sets)
client.OAuthSign()
response := &flickr.B... | go | func OrderSets(client *flickr.FlickrClient, photosetIds []string) (*flickr.BasicResponse, error) {
client.Init()
client.HTTPVerb = "POST"
client.Args.Set("method", "flickr.photosets.orderSets")
sets := strings.Join(photosetIds, ",")
client.Args.Set("photoset_ids", sets)
client.OAuthSign()
response := &flickr.B... | [
"func",
"OrderSets",
"(",
"client",
"*",
"flickr",
".",
"FlickrClient",
",",
"photosetIds",
"[",
"]",
"string",
")",
"(",
"*",
"flickr",
".",
"BasicResponse",
",",
"error",
")",
"{",
"client",
".",
"Init",
"(",
")",
"\n",
"client",
".",
"HTTPVerb",
"="... | // Set the order of photosets for the calling user.
// Any set IDs not given in the list will be set to appear at the end of the list, ordered by their IDs.
// This method requires authentication with 'write' permission. | [
"Set",
"the",
"order",
"of",
"photosets",
"for",
"the",
"calling",
"user",
".",
"Any",
"set",
"IDs",
"not",
"given",
"in",
"the",
"list",
"will",
"be",
"set",
"to",
"appear",
"at",
"the",
"end",
"of",
"the",
"list",
"ordered",
"by",
"their",
"IDs",
"... | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/photosets/photosets.go#L242-L254 |
137,785 | masci/flickr | photosets/photosets.go | ReorderPhotos | func ReorderPhotos(client *flickr.FlickrClient, photosetId, primaryId string, photoIds []string) (*flickr.BasicResponse, error) {
return EditPhotos(client, photosetId, primaryId, photoIds)
} | go | func ReorderPhotos(client *flickr.FlickrClient, photosetId, primaryId string, photoIds []string) (*flickr.BasicResponse, error) {
return EditPhotos(client, photosetId, primaryId, photoIds)
} | [
"func",
"ReorderPhotos",
"(",
"client",
"*",
"flickr",
".",
"FlickrClient",
",",
"photosetId",
",",
"primaryId",
"string",
",",
"photoIds",
"[",
"]",
"string",
")",
"(",
"*",
"flickr",
".",
"BasicResponse",
",",
"error",
")",
"{",
"return",
"EditPhotos",
"... | // Alias for EditPhotos | [
"Alias",
"for",
"EditPhotos"
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/photosets/photosets.go#L274-L276 |
137,786 | masci/flickr | photosets/photosets.go | SetPrimaryPhoto | func SetPrimaryPhoto(client *flickr.FlickrClient, photosetId, primaryId string) (*flickr.BasicResponse, error) {
client.Init()
client.HTTPVerb = "POST"
client.Args.Set("method", "flickr.photosets.setPrimaryPhoto")
client.Args.Set("photoset_id", photosetId)
client.Args.Set("photo_id", primaryId)
client.OAuthSign(... | go | func SetPrimaryPhoto(client *flickr.FlickrClient, photosetId, primaryId string) (*flickr.BasicResponse, error) {
client.Init()
client.HTTPVerb = "POST"
client.Args.Set("method", "flickr.photosets.setPrimaryPhoto")
client.Args.Set("photoset_id", photosetId)
client.Args.Set("photo_id", primaryId)
client.OAuthSign(... | [
"func",
"SetPrimaryPhoto",
"(",
"client",
"*",
"flickr",
".",
"FlickrClient",
",",
"photosetId",
",",
"primaryId",
"string",
")",
"(",
"*",
"flickr",
".",
"BasicResponse",
",",
"error",
")",
"{",
"client",
".",
"Init",
"(",
")",
"\n",
"client",
".",
"HTT... | // Set photoset primary photo
// This method requires authentication with 'write' permission. | [
"Set",
"photoset",
"primary",
"photo",
"This",
"method",
"requires",
"authentication",
"with",
"write",
"permission",
"."
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/photosets/photosets.go#L280-L292 |
137,787 | masci/flickr | client.go | generateNonce | func generateNonce() string {
rand.Seed(time.Now().UTC().UnixNano())
// For convenience, use a set of chars we don't need to url-escape
var letters = []rune("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ")
b := make([]rune, 8)
for i := range b {
b[i] = letters[rand.Intn(len(letters))]
}
return str... | go | func generateNonce() string {
rand.Seed(time.Now().UTC().UnixNano())
// For convenience, use a set of chars we don't need to url-escape
var letters = []rune("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ")
b := make([]rune, 8)
for i := range b {
b[i] = letters[rand.Intn(len(letters))]
}
return str... | [
"func",
"generateNonce",
"(",
")",
"string",
"{",
"rand",
".",
"Seed",
"(",
"time",
".",
"Now",
"(",
")",
".",
"UTC",
"(",
")",
".",
"UnixNano",
"(",
")",
")",
"\n",
"// For convenience, use a set of chars we don't need to url-escape",
"var",
"letters",
"=",
... | // Generate a random string of 8 chars, needed for OAuth signature | [
"Generate",
"a",
"random",
"string",
"of",
"8",
"chars",
"needed",
"for",
"OAuth",
"signature"
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/client.go#L19-L28 |
137,788 | masci/flickr | client.go | NewFlickrClient | func NewFlickrClient(apiKey string, apiSecret string) *FlickrClient {
return &FlickrClient{
ApiKey: apiKey,
ApiSecret: apiSecret,
HTTPClient: &http.Client{},
HTTPVerb: "GET",
Args: url.Values{},
}
} | go | func NewFlickrClient(apiKey string, apiSecret string) *FlickrClient {
return &FlickrClient{
ApiKey: apiKey,
ApiSecret: apiSecret,
HTTPClient: &http.Client{},
HTTPVerb: "GET",
Args: url.Values{},
}
} | [
"func",
"NewFlickrClient",
"(",
"apiKey",
"string",
",",
"apiSecret",
"string",
")",
"*",
"FlickrClient",
"{",
"return",
"&",
"FlickrClient",
"{",
"ApiKey",
":",
"apiKey",
",",
"ApiSecret",
":",
"apiSecret",
",",
"HTTPClient",
":",
"&",
"http",
".",
"Client"... | // Create a Flickr client, apiKey and apiSecret are mandatory | [
"Create",
"a",
"Flickr",
"client",
"apiKey",
"and",
"apiSecret",
"are",
"mandatory"
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/client.go#L54-L62 |
137,789 | masci/flickr | client.go | Sign | func (c *FlickrClient) Sign(tokenSecret string) {
// the "oauth_signature" param must not be included in the signing process
c.Args.Del("oauth_signature")
c.Args.Set("oauth_signature", c.getSignature(tokenSecret))
} | go | func (c *FlickrClient) Sign(tokenSecret string) {
// the "oauth_signature" param must not be included in the signing process
c.Args.Del("oauth_signature")
c.Args.Set("oauth_signature", c.getSignature(tokenSecret))
} | [
"func",
"(",
"c",
"*",
"FlickrClient",
")",
"Sign",
"(",
"tokenSecret",
"string",
")",
"{",
"// the \"oauth_signature\" param must not be included in the signing process",
"c",
".",
"Args",
".",
"Del",
"(",
"\"",
"\"",
")",
"\n",
"c",
".",
"Args",
".",
"Set",
... | // Sign the next request performed by the FlickrClient | [
"Sign",
"the",
"next",
"request",
"performed",
"by",
"the",
"FlickrClient"
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/client.go#L65-L69 |
137,790 | masci/flickr | client.go | SetOAuthDefaults | func (c *FlickrClient) SetOAuthDefaults() {
c.Args.Add("oauth_version", "1.0")
c.Args.Add("oauth_signature_method", "HMAC-SHA1")
c.Args.Add("oauth_nonce", generateNonce())
c.Args.Add("oauth_timestamp", fmt.Sprintf("%d", time.Now().Unix()))
} | go | func (c *FlickrClient) SetOAuthDefaults() {
c.Args.Add("oauth_version", "1.0")
c.Args.Add("oauth_signature_method", "HMAC-SHA1")
c.Args.Add("oauth_nonce", generateNonce())
c.Args.Add("oauth_timestamp", fmt.Sprintf("%d", time.Now().Unix()))
} | [
"func",
"(",
"c",
"*",
"FlickrClient",
")",
"SetOAuthDefaults",
"(",
")",
"{",
"c",
".",
"Args",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"c",
".",
"Args",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"c",
".",
"... | // Set the mandatory params for an OAuth request | [
"Set",
"the",
"mandatory",
"params",
"for",
"an",
"OAuth",
"request"
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/client.go#L72-L77 |
137,791 | masci/flickr | client.go | getSigningBaseString | func (c *FlickrClient) getSigningBaseString() string {
request_url := url.QueryEscape(c.EndpointUrl)
flickr_encoded := strings.Replace(c.Args.Encode(), "+", "%20", -1)
query := url.QueryEscape(flickr_encoded)
ret := fmt.Sprintf("%s&%s&%s", c.HTTPVerb, request_url, query)
return ret
} | go | func (c *FlickrClient) getSigningBaseString() string {
request_url := url.QueryEscape(c.EndpointUrl)
flickr_encoded := strings.Replace(c.Args.Encode(), "+", "%20", -1)
query := url.QueryEscape(flickr_encoded)
ret := fmt.Sprintf("%s&%s&%s", c.HTTPVerb, request_url, query)
return ret
} | [
"func",
"(",
"c",
"*",
"FlickrClient",
")",
"getSigningBaseString",
"(",
")",
"string",
"{",
"request_url",
":=",
"url",
".",
"QueryEscape",
"(",
"c",
".",
"EndpointUrl",
")",
"\n",
"flickr_encoded",
":=",
"strings",
".",
"Replace",
"(",
"c",
".",
"Args",
... | // Get the base string to compose the signature | [
"Get",
"the",
"base",
"string",
"to",
"compose",
"the",
"signature"
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/client.go#L116-L123 |
137,792 | masci/flickr | client.go | getSignature | func (c *FlickrClient) getSignature(token_secret string) string {
key := fmt.Sprintf("%s&%s", url.QueryEscape(c.ApiSecret), url.QueryEscape(token_secret))
base_string := c.getSigningBaseString()
mac := hmac.New(sha1.New, []byte(key))
mac.Write([]byte(base_string))
ret := base64.StdEncoding.EncodeToString(mac.Sum... | go | func (c *FlickrClient) getSignature(token_secret string) string {
key := fmt.Sprintf("%s&%s", url.QueryEscape(c.ApiSecret), url.QueryEscape(token_secret))
base_string := c.getSigningBaseString()
mac := hmac.New(sha1.New, []byte(key))
mac.Write([]byte(base_string))
ret := base64.StdEncoding.EncodeToString(mac.Sum... | [
"func",
"(",
"c",
"*",
"FlickrClient",
")",
"getSignature",
"(",
"token_secret",
"string",
")",
"string",
"{",
"key",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"c",
".",
"ApiSecret",
")",
",",
"url",
".",
"Que... | // Compute the signature of a signed request | [
"Compute",
"the",
"signature",
"of",
"a",
"signed",
"request"
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/client.go#L126-L136 |
137,793 | masci/flickr | client.go | getApiSignature | func (c *FlickrClient) getApiSignature(token_secret string) string {
var buf bytes.Buffer
buf.WriteString(token_secret)
keys := make([]string, 0, len(c.Args))
for k := range c.Args {
keys = append(keys, k)
}
// args needs to be in alphabetical order
sort.Strings(keys)
for _, k := range keys {
arg := c.Arg... | go | func (c *FlickrClient) getApiSignature(token_secret string) string {
var buf bytes.Buffer
buf.WriteString(token_secret)
keys := make([]string, 0, len(c.Args))
for k := range c.Args {
keys = append(keys, k)
}
// args needs to be in alphabetical order
sort.Strings(keys)
for _, k := range keys {
arg := c.Arg... | [
"func",
"(",
"c",
"*",
"FlickrClient",
")",
"getApiSignature",
"(",
"token_secret",
"string",
")",
"string",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"buf",
".",
"WriteString",
"(",
"token_secret",
")",
"\n\n",
"keys",
":=",
"make",
"(",
"[",
"]"... | // Sign API requests. This method differs from the signing process needed for
// OAuth authenticated requests. | [
"Sign",
"API",
"requests",
".",
"This",
"method",
"differs",
"from",
"the",
"signing",
"process",
"needed",
"for",
"OAuth",
"authenticated",
"requests",
"."
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/client.go#L140-L161 |
137,794 | masci/flickr | authentication.go | ParseRequestToken | func ParseRequestToken(response string) (*RequestToken, error) {
val, err := url.ParseQuery(strings.TrimSpace(response))
if err != nil {
return nil, err
}
ret := &RequestToken{}
oauth_problem := val.Get("oauth_problem")
if oauth_problem != "" {
ret.OAuthProblem = oauth_problem
return ret, flickErr.NewErro... | go | func ParseRequestToken(response string) (*RequestToken, error) {
val, err := url.ParseQuery(strings.TrimSpace(response))
if err != nil {
return nil, err
}
ret := &RequestToken{}
oauth_problem := val.Get("oauth_problem")
if oauth_problem != "" {
ret.OAuthProblem = oauth_problem
return ret, flickErr.NewErro... | [
"func",
"ParseRequestToken",
"(",
"response",
"string",
")",
"(",
"*",
"RequestToken",
",",
"error",
")",
"{",
"val",
",",
"err",
":=",
"url",
".",
"ParseQuery",
"(",
"strings",
".",
"TrimSpace",
"(",
"response",
")",
")",
"\n",
"if",
"err",
"!=",
"nil... | // Extract a RequestToken from the response body | [
"Extract",
"a",
"RequestToken",
"from",
"the",
"response",
"body"
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/authentication.go#L25-L45 |
137,795 | masci/flickr | authentication.go | ParseOAuthToken | func ParseOAuthToken(response string) (*OAuthToken, error) {
val, err := url.ParseQuery(strings.TrimSpace(response))
if err != nil {
return nil, err
}
ret := &OAuthToken{}
oauth_problem := val.Get("oauth_problem")
if oauth_problem != "" {
ret.OAuthProblem = oauth_problem
return ret, flickErr.NewError(flic... | go | func ParseOAuthToken(response string) (*OAuthToken, error) {
val, err := url.ParseQuery(strings.TrimSpace(response))
if err != nil {
return nil, err
}
ret := &OAuthToken{}
oauth_problem := val.Get("oauth_problem")
if oauth_problem != "" {
ret.OAuthProblem = oauth_problem
return ret, flickErr.NewError(flic... | [
"func",
"ParseOAuthToken",
"(",
"response",
"string",
")",
"(",
"*",
"OAuthToken",
",",
"error",
")",
"{",
"val",
",",
"err",
":=",
"url",
".",
"ParseQuery",
"(",
"strings",
".",
"TrimSpace",
"(",
"response",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // Extract a OAuthToken from the response body | [
"Extract",
"a",
"OAuthToken",
"from",
"the",
"response",
"body"
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/authentication.go#L64-L85 |
137,796 | masci/flickr | authentication.go | GetAuthorizeUrl | func GetAuthorizeUrl(client *FlickrClient, reqToken *RequestToken) (string, error) {
client.EndpointUrl = AUTHORIZE_URL
client.Args = url.Values{}
client.Args.Set("oauth_token", reqToken.OauthToken)
// TODO make permission value parametric
client.Args.Set("perms", "delete")
return client.GetUrl(), nil
} | go | func GetAuthorizeUrl(client *FlickrClient, reqToken *RequestToken) (string, error) {
client.EndpointUrl = AUTHORIZE_URL
client.Args = url.Values{}
client.Args.Set("oauth_token", reqToken.OauthToken)
// TODO make permission value parametric
client.Args.Set("perms", "delete")
return client.GetUrl(), nil
} | [
"func",
"GetAuthorizeUrl",
"(",
"client",
"*",
"FlickrClient",
",",
"reqToken",
"*",
"RequestToken",
")",
"(",
"string",
",",
"error",
")",
"{",
"client",
".",
"EndpointUrl",
"=",
"AUTHORIZE_URL",
"\n",
"client",
".",
"Args",
"=",
"url",
".",
"Values",
"{"... | // Returns the URL users need to reach to grant permission to our application | [
"Returns",
"the",
"URL",
"users",
"need",
"to",
"reach",
"to",
"grant",
"permission",
"to",
"our",
"application"
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/authentication.go#L113-L121 |
137,797 | masci/flickr | authentication.go | GetAccessToken | func GetAccessToken(client *FlickrClient, reqToken *RequestToken, oauthVerifier string) (*OAuthToken, error) {
client.EndpointUrl = ACCESS_TOKEN_URL
client.SetOAuthDefaults()
client.Args.Set("oauth_verifier", oauthVerifier)
client.Args.Set("oauth_consumer_key", client.ApiKey)
client.Args.Set("oauth_token", reqToke... | go | func GetAccessToken(client *FlickrClient, reqToken *RequestToken, oauthVerifier string) (*OAuthToken, error) {
client.EndpointUrl = ACCESS_TOKEN_URL
client.SetOAuthDefaults()
client.Args.Set("oauth_verifier", oauthVerifier)
client.Args.Set("oauth_consumer_key", client.ApiKey)
client.Args.Set("oauth_token", reqToke... | [
"func",
"GetAccessToken",
"(",
"client",
"*",
"FlickrClient",
",",
"reqToken",
"*",
"RequestToken",
",",
"oauthVerifier",
"string",
")",
"(",
"*",
"OAuthToken",
",",
"error",
")",
"{",
"client",
".",
"EndpointUrl",
"=",
"ACCESS_TOKEN_URL",
"\n",
"client",
".",... | // Get an access token providing an OAuth verifier provided by Flickr once the user
// authorizes your application | [
"Get",
"an",
"access",
"token",
"providing",
"an",
"OAuth",
"verifier",
"provided",
"by",
"Flickr",
"once",
"the",
"user",
"authorizes",
"your",
"application"
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/authentication.go#L125-L153 |
137,798 | masci/flickr | auth/oauth/oauth.go | CheckToken | func CheckToken(client *flickr.FlickrClient, oauthToken string) (*CheckTokenResponse, error) {
client.EndpointUrl = flickr.API_ENDPOINT
client.ClearArgs()
client.Args.Set("method", "flickr.auth.oauth.checkToken")
client.Args.Set("oauth_token", oauthToken)
client.ApiSign()
response := &CheckTokenResponse{}
err :... | go | func CheckToken(client *flickr.FlickrClient, oauthToken string) (*CheckTokenResponse, error) {
client.EndpointUrl = flickr.API_ENDPOINT
client.ClearArgs()
client.Args.Set("method", "flickr.auth.oauth.checkToken")
client.Args.Set("oauth_token", oauthToken)
client.ApiSign()
response := &CheckTokenResponse{}
err :... | [
"func",
"CheckToken",
"(",
"client",
"*",
"flickr",
".",
"FlickrClient",
",",
"oauthToken",
"string",
")",
"(",
"*",
"CheckTokenResponse",
",",
"error",
")",
"{",
"client",
".",
"EndpointUrl",
"=",
"flickr",
".",
"API_ENDPOINT",
"\n",
"client",
".",
"ClearAr... | // Returns the credentials attached to an OAuth authentication token.
// This method does not require user authentication, but the request must be api-signed. | [
"Returns",
"the",
"credentials",
"attached",
"to",
"an",
"OAuth",
"authentication",
"token",
".",
"This",
"method",
"does",
"not",
"require",
"user",
"authentication",
"but",
"the",
"request",
"must",
"be",
"api",
"-",
"signed",
"."
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/auth/oauth/oauth.go#L30-L40 |
137,799 | masci/flickr | upload.go | streamUploadBody | func streamUploadBody(client *FlickrClient, photo io.Reader, body *io.PipeWriter, fileName string, boundary string) {
// multipart writer to fill the body
defer body.Close()
writer := multipart.NewWriter(body)
writer.SetBoundary(boundary)
// create the "photo" field
part, err := writer.CreateFormFile("photo", fi... | go | func streamUploadBody(client *FlickrClient, photo io.Reader, body *io.PipeWriter, fileName string, boundary string) {
// multipart writer to fill the body
defer body.Close()
writer := multipart.NewWriter(body)
writer.SetBoundary(boundary)
// create the "photo" field
part, err := writer.CreateFormFile("photo", fi... | [
"func",
"streamUploadBody",
"(",
"client",
"*",
"FlickrClient",
",",
"photo",
"io",
".",
"Reader",
",",
"body",
"*",
"io",
".",
"PipeWriter",
",",
"fileName",
"string",
",",
"boundary",
"string",
")",
"{",
"// multipart writer to fill the body",
"defer",
"body",... | // Encode the file and request parameters in a multipart body.
// File contents are streamed into the request using an io.Pipe in a separated goroutine | [
"Encode",
"the",
"file",
"and",
"request",
"parameters",
"in",
"a",
"multipart",
"body",
".",
"File",
"contents",
"are",
"streamed",
"into",
"the",
"request",
"using",
"an",
"io",
".",
"Pipe",
"in",
"a",
"separated",
"goroutine"
] | 3cc496dc15cd2a9460265656665423635e0a4a0b | https://github.com/masci/flickr/blob/3cc496dc15cd2a9460265656665423635e0a4a0b/upload.go#L30-L61 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.