Documentation ¶
Overview ¶
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func AppendMember(r redis.Conn, k, v string)
- func Clear()
- func Execute()
- func GetAllMembers() []string
- func GetCacheConn() redis.Conn
- func GetKeys(r redis.Conn) []string
- func GetMembers(r redis.Conn, key string) []string
- func InsertAll(r redis.Conn, k string, args []string)
- func KeyExists(r redis.Conn, k string) bool
- func MemberExists(r redis.Conn, k, v string) bool
- func RemoveAll(key string) error
- func RemoveMember(key, val string) error
Constants ¶
This section is empty.
Variables ¶
var ADDCmd = &cobra.Command{ Use: "ADD", Short: "Add a key and value", Long: "Add a member to a collection for a given key.", Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 { log.Fatal("please supply a key and value to add") return } AppendMember(nil, args[0], args[1]) }, }
ADDCmd represents the ADD command
var ALLMEMBERSCmd = &cobra.Command{ Use: "ALLMEMBERS", Short: "Get all members (keys)", Long: `Get all members (keys)`, Run: func(cmd *cobra.Command, args []string) { members := GetAllMembers() for i := 0; i < len(members); i++ { fmt.Printf("%d) %s \n", i+1, members[i]) } }, }
ALLMEMBERSCmd represents the ALLMEMBERS command
var CLEARCmd = &cobra.Command{ Use: "CLEAR", Short: "Removes all keys and all members", Long: `Removes all keys and all members from the dictionary`, Run: func(cmd *cobra.Command, args []string) { Clear() }, }
CLEARCmd represents the CLEAR command
var INTERSECTCmd = &cobra.Command{ Use: "INTERSECT", Short: "INTERSECT", Long: `INTERSECT`, Run: func(cmd *cobra.Command, args []string) { intersect(args[0], args[1]) }, }
INTERSECTCmd
var ITEMSCmd = &cobra.Command{ Use: "ITEMS", Short: "Get everything", Long: `Get everything including keys and members`, Run: func(cmd *cobra.Command, args []string) { fmt.Println(getItems()) }, }
ITEMSCmd represents the ITEMS command
var KEYEXISTSCmd = &cobra.Command{ Use: "KEYEXISTS", Short: "Does key exist?", Long: "Returns whether a key exists or not.", Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 { log.Fatal("please supply a key to search for") return } fmt.Println(KeyExists(nil, args[0])) }, }
KEYEXISTSCmd represents the KEYEXISTS command
var KEYSCmd = &cobra.Command{ Use: "KEYS", Short: "Get all keys", Long: "Returns a collection of keys", Run: func(cmd *cobra.Command, args []string) { keys := GetKeys(nil) for index, key := range keys { fmt.Printf("%d) %s\n", index+1, key) } }, }
KEYSCmd represents the KEYS command
var MEMBEREXISTSCmd = &cobra.Command{ Use: "MEMBEREXISTS", Short: "Is the value here?", Long: `Is the value here?`, Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 || len(args) == 1 { log.Fatal("please supply a key and value to search for") return } fmt.Println(MemberExists(nil, args[0], args[1])) }, }
MEMBEREXISTSCmd represents the MEMBEREXISTS command
var MEMBERSCmd = &cobra.Command{ Use: "MEMBERS", Short: "Get values for key", Long: "Returns the collection of strings for the given key.", Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 { log.Fatal("please supply a key to get members for") return } members := GetMembers(nil, args[0]) for i := 0; i < len(members); i++ { fmt.Printf("%d) %s \n", i+1, members[i]) } }, }
MEMBERSCmd represents the MEMBERS command
var REMOVEALLCmd = &cobra.Command{ Use: "REMOVEALL", Short: "Removes a key and values", Long: `Removes a key and values`, Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 { log.Fatal("please supply a key to remove values for") return } e := RemoveAll(args[0]) if e != nil { fmt.Println(e) } }, }
REMOVEALLCmd represents the REMOVE command
var REMOVECmd = &cobra.Command{ Use: "REMOVE", Short: "Remove a key and value", Long: `Remove a key and value`, Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 { log.Fatal("please supply a key and value to remove") return } e := RemoveMember(args[0], args[1]) if e != nil { fmt.Println(e) } }, }
REMOVECmd represents the REMOVE command
Functions ¶
func AppendMember ¶
Append adds a member to a collection for a given key.
func Execute ¶
func Execute()
Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func GetAllMembers ¶
func GetAllMembers() []string
GetAllMembers returns all the members in the dictionary. Returns nothing if there are none. Order is not guaranteed.
func GetCacheConn ¶
func GetMembers ¶
GetMembers returns the collection of strings for the given key.
func MemberExists ¶
MemberExists returns whether a key exists or not.
func RemoveAll ¶
RemoveMember removes all members for a key and removes the key from the dictionary. Returns an error if the key does not exist.
func RemoveMember ¶
RemoveMember removes a member from a key.
Types ¶
This section is empty.