All Projects → devfeel → Mapper

devfeel / Mapper

A simple and easy go tools for auto mapper map to struct, struct to map, struct to struct, slice to slice, map to slice, map to json.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Mapper

Defaults
Initialize structs with default values
Stars: ✭ 290 (+65.71%)
Mutual labels:  struct, map
awesome-maps-ukraine
A curated list of maps of Ukraine, ukrainian mappers and tools that they use or develop for creating and publish maps
Stars: ✭ 35 (-80%)
Mutual labels:  map, mapper
Change By Example
Finds a function that transforms a given object into another given object.
Stars: ✭ 32 (-81.71%)
Mutual labels:  mapper, map
UltraMapper
A fast and lightweight object-to-object .NET mapper.
Stars: ✭ 28 (-84%)
Mutual labels:  map, mapper
Geo Data Viewer
🗺️ Geo Data Viewer w/0 Py 🐍 || pyWidgets ⚙️ || pandas 🐼 || @reactjs ⚛️ required to gen. some snazzy maps 🗺️ with keplerGL ...
Stars: ✭ 115 (-34.29%)
Mutual labels:  tool, map
Windows Auto Night Mode
Automatically switches between the dark and light theme of Windows 10 and Windows 11
Stars: ✭ 3,375 (+1828.57%)
Mutual labels:  tool
Technowlogger
TechNowLogger is Windows/Linux Keylogger Generator which sends key-logs via email with other juicy target info
Stars: ✭ 172 (-1.71%)
Mutual labels:  tool
Aphotomanager
Manage local photos on Android: gallery, geotag with photomap, privacy, tags, find, sort, view, copy, send, ... .
Stars: ✭ 164 (-6.29%)
Mutual labels:  map
Django Loci
Reusable Django app for storing geographic and indoor coordinates. Maintained by the OpenWISP Project.
Stars: ✭ 164 (-6.29%)
Mutual labels:  map
Vue Baidu Map
Baidu Map components for Vue 2.x
Stars: ✭ 2,191 (+1152%)
Mutual labels:  map
Pypyr
pypyr task-runner cli & api for automation pipelines. Automate anything by combining commands, different scripts in different languages & applications into one pipeline process.
Stars: ✭ 173 (-1.14%)
Mutual labels:  tool
React Openlayers
OpenLayer React Components
Stars: ✭ 169 (-3.43%)
Mutual labels:  map
Grex
A command-line tool and library for generating regular expressions from user-provided test cases
Stars: ✭ 4,847 (+2669.71%)
Mutual labels:  tool
J2team Community
Join our group to see more
Stars: ✭ 172 (-1.71%)
Mutual labels:  tool
Seedsearcherstandalonetool
Minecraft, searching numeric seeds for specific features/biomes
Stars: ✭ 165 (-5.71%)
Mutual labels:  tool
Yar
Yar is a tool for plunderin' organizations, users and/or repositories.
Stars: ✭ 174 (-0.57%)
Mutual labels:  tool
Deploy Rs
A simple multi-profile Nix-flake deploy tool.
Stars: ✭ 164 (-6.29%)
Mutual labels:  tool
Excelmapper
Map POCO objects to Excel files
Stars: ✭ 166 (-5.14%)
Mutual labels:  mapper
Database Doc Generator
数据库文档成成器,根据数据库表DDL生成markdown和word文档,如果你觉得powerdesigener太重,可以试试这个小工具
Stars: ✭ 173 (-1.14%)
Mutual labels:  tool
Protodep
Collect necessary .proto files (Protocol Buffers IDL) and manage dependencies
Stars: ✭ 167 (-4.57%)
Mutual labels:  tool

devfeel/mapper

A simple and easy go tools for auto mapper struct to map, struct to struct, slice to slice, map to slice, map to json.

1. Install

go get -u github.com/devfeel/mapper

2. Getting Started

package main

import (
	"fmt"
	"github.com/devfeel/mapper"
)

type (
	User struct {
		Name string
		Age  int
		Id   string `mapper:"_id"`
		AA   string `json:"Score"`
		Time time.Time
	}

	Student struct {
		Name  string
		Age   int
		Id    string `mapper:"_id"`
		Score string
	}

	Teacher struct {
		Name  string
		Age   int
		Id    string `mapper:"_id"`
		Level string
	}
)

func init() {
	mapper.Register(&User{})
	mapper.Register(&Student{})
}

func main() {
	user := &User{}
	userMap := &User{}
	teacher := &Teacher{}
	student := &Student{Name: "test", Age: 10, Id: "testId", Score: "100"}
	valMap := make(map[string]interface{})
	valMap["Name"] = "map"
	valMap["Age"] = 10
	valMap["_id"] = "x1asd"
	valMap["Score"] = 100
	valMap["Time"] = time.Now()

	mapper.Mapper(student, user)
	mapper.AutoMapper(student, teacher)
	mapper.MapperMap(valMap, userMap)

	fmt.Println("student:", student)
	fmt.Println("user:", user)
	fmt.Println("teacher", teacher)
	fmt.Println("userMap:", userMap)
}

执行main,输出:

student: &{test 10 testId 100}
user: &{test 10 testId 100 0001-01-01 00:00:00 +0000 UTC}
teacher &{test 10 testId }
userMap: &{map 10 x1asd 100 2017-11-20 13:45:56.3972504 +0800 CST m=+0.006004001}

Features

  • 支持不同结构体相同名称相同类型字段自动赋值,使用Mapper
  • 支持不同结构体Slice的自动赋值,使用MapperSlice
  • 支持字段为结构体时的自动赋值
  • 支持struct到map的自动映射赋值,使用Mapper
  • 支持map到struct的自动映射赋值,使用MapperMap
  • 支持map到struct slice的自动赋值,使用MapToSlice
  • 支持map与json的互相转换
  • 支持Time与Unix自动转换
  • 支持tag标签,tag关键字为 mapper
  • 兼容json-tag标签
  • 当tag为"-"时,将忽略tag定义,使用struct field name
  • 无需手动Register struct,内部自动识别
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].