mirror of
https://github.com/gogf/gf.git
synced 2025-04-05 11:18:50 +08:00
fix typo for comments (#2268)
* Modify comment syntax error * Modify comment syntax error
This commit is contained in:
parent
9f12673631
commit
4f4109cdb6
@ -53,7 +53,7 @@ func NewArraySize(size int, cap int, safe ...bool) *Array {
|
||||
}
|
||||
}
|
||||
|
||||
// NewArrayRange creates and returns a array by a range from `start` to `end`
|
||||
// NewArrayRange creates and returns an array by a range from `start` to `end`
|
||||
// with step value `step`.
|
||||
func NewArrayRange(start, end, step int, safe ...bool) *Array {
|
||||
if step == 0 {
|
||||
|
@ -45,7 +45,7 @@ func NewIntArraySize(size int, cap int, safe ...bool) *IntArray {
|
||||
}
|
||||
}
|
||||
|
||||
// NewIntArrayRange creates and returns a array by a range from `start` to `end`
|
||||
// NewIntArrayRange creates and returns an array by a range from `start` to `end`
|
||||
// with step value `step`.
|
||||
func NewIntArrayRange(start, end, step int, safe ...bool) *IntArray {
|
||||
if step == 0 {
|
||||
|
@ -55,7 +55,7 @@ func NewSortedArraySize(cap int, comparator func(a, b interface{}) int, safe ...
|
||||
}
|
||||
}
|
||||
|
||||
// NewSortedArrayRange creates and returns a array by a range from `start` to `end`
|
||||
// NewSortedArrayRange creates and returns an array by a range from `start` to `end`
|
||||
// with step value `step`.
|
||||
func NewSortedArrayRange(start, end, step int, comparator func(a, b interface{}) int, safe ...bool) *SortedArray {
|
||||
if step == 0 {
|
||||
|
@ -56,7 +56,7 @@ func NewSortedIntArraySize(cap int, safe ...bool) *SortedIntArray {
|
||||
}
|
||||
}
|
||||
|
||||
// NewSortedIntArrayRange creates and returns a array by a range from `start` to `end`
|
||||
// NewSortedIntArrayRange creates and returns an array by a range from `start` to `end`
|
||||
// with step value `step`.
|
||||
func NewSortedIntArrayRange(start, end, step int, safe ...bool) *SortedIntArray {
|
||||
if step == 0 {
|
||||
|
@ -184,7 +184,7 @@ func (set *Set) Clear() {
|
||||
set.mu.Unlock()
|
||||
}
|
||||
|
||||
// Slice returns the a of items of the set as slice.
|
||||
// Slice returns the an of items of the set as slice.
|
||||
func (set *Set) Slice() []interface{} {
|
||||
set.mu.RLock()
|
||||
var (
|
||||
|
@ -165,7 +165,7 @@ func (set *IntSet) Clear() {
|
||||
set.mu.Unlock()
|
||||
}
|
||||
|
||||
// Slice returns the a of items of the set as slice.
|
||||
// Slice returns the an of items of the set as slice.
|
||||
func (set *IntSet) Slice() []int {
|
||||
set.mu.RLock()
|
||||
var (
|
||||
|
@ -178,7 +178,7 @@ func (set *StrSet) Clear() {
|
||||
set.mu.Unlock()
|
||||
}
|
||||
|
||||
// Slice returns the a of items of the set as slice.
|
||||
// Slice returns the an of items of the set as slice.
|
||||
func (set *StrSet) Slice() []string {
|
||||
set.mu.RLock()
|
||||
var (
|
||||
|
@ -313,7 +313,7 @@ func ExampleIntSet_Size() {
|
||||
// 4
|
||||
}
|
||||
|
||||
// Slice returns the a of items of the set as slice.
|
||||
// Slice returns the an of items of the set as slice.
|
||||
func ExampleIntSet_Slice() {
|
||||
s1 := gset.NewIntSet()
|
||||
s1.Add([]int{1, 2, 3, 4}...)
|
||||
|
@ -325,7 +325,7 @@ func ExampleStrSet_Size() {
|
||||
// 4
|
||||
}
|
||||
|
||||
// Slice returns the a of items of the set as slice.
|
||||
// Slice returns the an of items of the set as slice.
|
||||
func ExampleStrSet_Slice() {
|
||||
s1 := gset.NewStrSet(true)
|
||||
s1.Add([]string{"a", "b", "c", "d"}...)
|
||||
|
@ -52,7 +52,7 @@ func (d *Driver) New(core *gdb.Core, node *gdb.ConfigNode) (gdb.DB, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Open creates and returns a underlying sql.DB object for sqlite.
|
||||
// Open creates and returns an underlying sql.DB object for sqlite.
|
||||
// https://github.com/glebarez/go-sqlite
|
||||
func (d *Driver) Open(config *gdb.ConfigNode) (db *sql.DB, err error) {
|
||||
var (
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
// Encode escapes the string so it can be safely placed
|
||||
// inside a URL query.
|
||||
// inside an URL query.
|
||||
func Encode(str string) string {
|
||||
return url.QueryEscape(str)
|
||||
}
|
||||
@ -49,7 +49,7 @@ func BuildQuery(queryData url.Values) string {
|
||||
return queryData.Encode()
|
||||
}
|
||||
|
||||
// ParseURL Parse a URL and return its components.
|
||||
// ParseURL Parse an URL and return its components.
|
||||
// -1: all; 1: scheme; 2: host; 4: port; 8: user; 16: pass; 32: path; 64: query; 128: fragment.
|
||||
// See http://php.net/manual/en/function.parse-url.php.
|
||||
func ParseURL(str string, component int) (map[string]string, error) {
|
||||
|
@ -48,7 +48,7 @@ func (c *Client) ConnectBytes(ctx context.Context, url string, data ...interface
|
||||
return c.RequestBytes(ctx, http.MethodConnect, url, data...)
|
||||
}
|
||||
|
||||
// OptionsBytes sends a OPTIONS request, retrieves and returns the result content as bytes.
|
||||
// OptionsBytes sends an OPTIONS request, retrieves and returns the result content as bytes.
|
||||
func (c *Client) OptionsBytes(ctx context.Context, url string, data ...interface{}) []byte {
|
||||
return c.RequestBytes(ctx, http.MethodOptions, url, data...)
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ func (c *Client) ConnectVar(ctx context.Context, url string, data ...interface{}
|
||||
return c.RequestVar(ctx, http.MethodConnect, url, data...)
|
||||
}
|
||||
|
||||
// OptionsVar sends a OPTIONS request, retrieves and converts the result content to specified pointer.
|
||||
// OptionsVar sends an OPTIONS request, retrieves and converts the result content to specified pointer.
|
||||
// The parameter `pointer` can be type of: struct/*struct/**struct/[]struct/[]*struct/*[]struct, etc.
|
||||
func (c *Client) OptionsVar(ctx context.Context, url string, data ...interface{}) *gvar.Var {
|
||||
return c.RequestVar(ctx, http.MethodOptions, url, data...)
|
||||
|
@ -524,7 +524,7 @@ func ExampleClient_GetVar() {
|
||||
// &{1 john}
|
||||
}
|
||||
|
||||
// ExampleClient_SetProxy a example for `gclient.Client.SetProxy` method.
|
||||
// ExampleClient_SetProxy an example for `gclient.Client.SetProxy` method.
|
||||
// please prepare two proxy server before running this example.
|
||||
// http proxy server listening on `127.0.0.1:1081`
|
||||
// socks5 proxy server listening on `127.0.0.1:1080`
|
||||
|
@ -81,7 +81,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
// New creates and returns a OpenApiV3 implements object.
|
||||
// New creates and returns an OpenApiV3 implements object.
|
||||
func New() *OpenApiV3 {
|
||||
oai := &OpenApiV3{}
|
||||
oai.fillWithDefaultValue()
|
||||
|
@ -44,7 +44,7 @@ func NewConn(remoteAddress string, localAddress ...string) (*Conn, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// NewConnByNetConn creates a UDP connection object with given *net.UDPConn object.
|
||||
// NewConnByNetConn creates an UDP connection object with given *net.UDPConn object.
|
||||
func NewConnByNetConn(udp *net.UDPConn) *Conn {
|
||||
return &Conn{
|
||||
UDPConn: udp,
|
||||
|
@ -40,7 +40,7 @@ var (
|
||||
serverMapping = gmap.NewStrAnyMap(true)
|
||||
)
|
||||
|
||||
// GetServer creates and returns a UDP server instance with given name.
|
||||
// GetServer creates and returns an UDP server instance with given name.
|
||||
func GetServer(name ...interface{}) *Server {
|
||||
serverName := defaultServer
|
||||
if len(name) > 0 && name[0] != "" {
|
||||
@ -54,7 +54,7 @@ func GetServer(name ...interface{}) *Server {
|
||||
return s
|
||||
}
|
||||
|
||||
// NewServer creates and returns a UDP server.
|
||||
// NewServer creates and returns an UDP server.
|
||||
// The optional parameter `name` is used to specify its name, which can be used for
|
||||
// GetServer function to retrieve its instance.
|
||||
func NewServer(address string, handler func(*Conn), name ...string) *Server {
|
||||
|
@ -59,7 +59,7 @@ func New(path string, cache bool) *SPath {
|
||||
return sp
|
||||
}
|
||||
|
||||
// Get creates and returns a instance of searching manager for given path.
|
||||
// Get creates and returns an instance of searching manager for given path.
|
||||
// The parameter `cache` specifies whether using cache feature for this manager.
|
||||
// If cache feature is enabled, it asynchronously and recursively scans the path
|
||||
// and updates all sub files/folders to the cache using package gfsnotify.
|
||||
@ -73,7 +73,7 @@ func Get(root string, cache bool) *SPath {
|
||||
}
|
||||
|
||||
// Search searches file `name` under path `root`.
|
||||
// The parameter `root` should be a absolute path. It will not automatically
|
||||
// The parameter `root` should be an absolute path. It will not automatically
|
||||
// convert `root` to absolute path for performance reason.
|
||||
// The optional parameter `indexFiles` specifies the searching index files when the result is a directory.
|
||||
// For example, if the result `filePath` is a directory, and `indexFiles` is [index.html, main.html], it will also
|
||||
@ -84,7 +84,7 @@ func Search(root string, name string, indexFiles ...string) (filePath string, is
|
||||
}
|
||||
|
||||
// SearchWithCache searches file `name` under path `root` with cache feature enabled.
|
||||
// The parameter `root` should be a absolute path. It will not automatically
|
||||
// The parameter `root` should be an absolute path. It will not automatically
|
||||
// convert `root` to absolute path for performance reason.
|
||||
// The optional parameter `indexFiles` specifies the searching index files when the result is a directory.
|
||||
// For example, if the result `filePath` is a directory, and `indexFiles` is [index.html, main.html], it will also
|
||||
@ -215,7 +215,7 @@ func (sp *SPath) Search(name string, indexFiles ...string) (filePath string, isD
|
||||
}
|
||||
|
||||
// Remove deletes the `path` from cache files of the manager.
|
||||
// The parameter `path` can be either a absolute path or just a relative file name.
|
||||
// The parameter `path` can be either an absolute path or just a relative file name.
|
||||
func (sp *SPath) Remove(path string) {
|
||||
if sp.cache == nil {
|
||||
return
|
||||
|
@ -24,7 +24,7 @@ type priorityQueue struct {
|
||||
nextPriority *gtype.Int64 // nextPriority stores the next priority value of the heap, which is used to check if necessary to call the Pop of heap by Timer.
|
||||
}
|
||||
|
||||
// priorityQueueHeap is a heap manager, of which the underlying `array` is a array implementing a heap structure.
|
||||
// priorityQueueHeap is a heap manager, of which the underlying `array` is an array implementing a heap structure.
|
||||
type priorityQueueHeap struct {
|
||||
array []priorityQueueItem
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ func (p *Page) GetContent(mode int) string {
|
||||
}
|
||||
|
||||
// GetUrl parses the UrlTemplate with given page number and returns the URL string.
|
||||
// Note that the UrlTemplate attribute can be either an URL or a URI string with "{.page}"
|
||||
// Note that the UrlTemplate attribute can be either an URL or an URI string with "{.page}"
|
||||
// place holder specifying the page number position.
|
||||
func (p *Page) GetUrl(page int) string {
|
||||
return gstr.Replace(p.UrlTemplate, DefaultPagePlaceHolder, gconv.String(page))
|
||||
|
@ -28,7 +28,7 @@ func init() {
|
||||
go asyncProducingRandomBufferBytesLoop()
|
||||
}
|
||||
|
||||
// asyncProducingRandomBufferBytes is a named goroutine, which uses a asynchronous goroutine
|
||||
// asyncProducingRandomBufferBytes is a named goroutine, which uses an asynchronous goroutine
|
||||
// to produce the random bytes, and a buffer chan to store the random bytes.
|
||||
// So it has high performance to generate random numbers.
|
||||
func asyncProducingRandomBufferBytesLoop() {
|
||||
|
@ -344,7 +344,7 @@ func Test_CheckStruct_Recursively_MapAttribute(t *testing.T) {
|
||||
|
||||
// https://github.com/gogf/gf/issues/1983
|
||||
func Test_Issue1983(t *testing.T) {
|
||||
// Error as the attribute Student in Teacher is a initialized struct, which has default value.
|
||||
// Error as the attribute Student in Teacher is an initialized struct, which has default value.
|
||||
gtest.C(t, func(t *gtest.T) {
|
||||
type Student struct {
|
||||
Name string `v:"required"`
|
||||
|
Loading…
x
Reference in New Issue
Block a user